Skip to content

Commit 9ce07bc

Browse files
author
Paolo Torrini
committed
updated encatI.v
1 parent 840b140 commit 9ce07bc

File tree

2 files changed

+263
-753
lines changed

2 files changed

+263
-753
lines changed

theories/encatI.v

Lines changed: 254 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1449,11 +1449,6 @@ Definition l_hcomp (T: SDCat.type) (a0 a1 a2: T)
14491449
(h0: hhom a0 a1) (h1: hhom a1 a2) : D1obj T :=
14501450
@TT2 T _ a0 a2 (h0 \; h1).
14511451

1452-
Notation "'sigma' x .. y , p" :=
1453-
(sigT (fun x => .. (sigT (fun y => p)) ..))
1454-
(at level 200, x binder, right associativity,
1455-
format "'[' 'sigma' '/ ' x .. y , '/ ' p ']'")
1456-
: type_scope.
14571452

14581453
(** DPobj quiver *)
14591454
Definition DP_hom (T: STUFunctor.type) (x y: DPobj T) :=
@@ -1925,5 +1920,259 @@ HB.mixin Record IsDCat_UA T of CFunctor T := {
19251920
@hom (HHomSet T) (@HO T (@hhom T) a0 a3 hh2)
19261921
(@HO T (@hhom T) a0 a3 hh1)
19271922
}.
1923+
*)
1924+
1925+
(*********************************************************************)
1926+
1927+
Program Definition brel_fcast {X Y C : Type} {F: X -> C} {G: Y -> C}
1928+
{a1 b1: X} {a2 b2: Y} {R: C -> C -> Type}
1929+
(e1: F a1 = G a2) (e2: F b1 = G b2) :
1930+
R (G a2) (G b2) = R (F a1) (F b1).
1931+
rewrite e1.
1932+
rewrite e2.
1933+
auto.
1934+
Defined.
1935+
1936+
Program Definition recast2 {X Y C : Type} {F: X -> C} {G: Y -> C}
1937+
{a1 b1: X} {a2 b2: Y} {R: C -> C -> Type}
1938+
(e1: F a1 = G a2) (e2: F b1 = G b2)
1939+
(x: R (G a2) (G b2)) : R (F a1) (F b1).
1940+
rewrite -(brel_fcast e1 e2).
1941+
exact x.
1942+
Defined.
1943+
1944+
Program Definition brel_fcast_h {X Y C : Type} {F: X -> C} {G: Y -> C}
1945+
{a1 b1: X} {a2 b2: Y} {R: C -> C -> Type}
1946+
(e1: F a1 = G a2) (e2: F b1 = G b2)
1947+
(x: R (G a2) (G b2)) (P: forall T: Type, T -> Prop) :
1948+
P _ x = P _ (recast2 e1 e2 x).
1949+
unfold recast2.
1950+
unfold eq_rect.
1951+
unfold brel_fcast.
1952+
unfold eq_ind_r.
1953+
unfold eq_ind.
1954+
unfold eq_sym.
1955+
dependent destruction e1.
1956+
dependent destruction e2.
1957+
auto.
1958+
Defined.
1959+
1960+
Program Definition brel_fcast_3h {X Y C : Type} {F: X -> C} {G: Y -> C}
1961+
{a1 b1 c1: X} {a2 b2 c2: Y} {R: C -> C -> Type}
1962+
(e1: F a1 = G a2) (e2: F b1 = G b2) (e3: F c1 = G c2)
1963+
(x: R (G a2) (G b2)) (y: R (G b2) (G c2)) (z: R (G a2) (G c2))
1964+
(P: forall T1 T2 T3: Type, T1 -> T2 -> T3 -> Prop) :
1965+
P _ _ _ x y z = P _ _ _ (recast2 e1 e2 x) (recast2 e2 e3 y) (recast2 e1 e3 z).
1966+
unfold recast2.
1967+
unfold eq_rect.
1968+
unfold brel_fcast.
1969+
unfold eq_ind_r.
1970+
unfold eq_ind.
1971+
unfold eq_sym.
1972+
dependent destruction e1.
1973+
dependent destruction e2.
1974+
dependent destruction e3.
1975+
auto.
1976+
Defined.
1977+
1978+
Program Definition brel_fcast_3hh {X Y C : Type} {F: X -> C} {G: Y -> C}
1979+
{a1 b1 c1: X} {a2 b2 c2: Y} {R: C -> C -> Type}
1980+
(e1: F a1 = G a2) (e2: F b1 = G b2) (e3: F c1 = G c2)
1981+
(x: R (G a2) (G b2)) (y: R (G b2) (G c2)) (z: R (G a2) (G c2))
1982+
(P: forall (d1 d2 d3: C), R d1 d2 -> R d2 d3 -> R d1 d3 -> Prop) :
1983+
P _ _ _ x y z = P _ _ _ (recast2 e1 e2 x) (recast2 e2 e3 y) (recast2 e1 e3 z).
1984+
unfold recast2.
1985+
unfold eq_rect.
1986+
unfold brel_fcast.
1987+
unfold eq_ind_r.
1988+
unfold eq_ind.
1989+
unfold eq_sym.
1990+
dependent destruction e1.
1991+
dependent destruction e2.
1992+
dependent destruction e3.
1993+
auto.
1994+
Defined.
1995+
1996+
Program Definition recast2_h {X Y C : Type} {F: X -> C} {G: Y -> C}
1997+
{a1 b1: X} {a2 b2: Y} {R: C -> C -> Type}
1998+
(e1: F a1 = G a2) (e2: F b1 = G b2)
1999+
(x: R (G a2) (G b2)) (P: forall T: Type, T -> Prop)
2000+
(p: P _ x) : P _ (recast2 e1 e2 x).
2001+
rewrite -(brel_fcast_h e1 e2).
2002+
exact p.
2003+
Defined.
2004+
2005+
Program Definition recast2_3h {X Y C : Type} {F: X -> C} {G: Y -> C}
2006+
{a1 b1 c1: X} {a2 b2 c2: Y} {R: C -> C -> Type}
2007+
(e1: F a1 = G a2) (e2: F b1 = G b2) (e3: F c1 = G c2)
2008+
(x: R (G a2) (G b2)) (y: R (G b2) (G c2)) (z: R (G a2) (G c2))
2009+
(P: forall T1 T2 T3: Type, T1 -> T2 -> T3 -> Prop)
2010+
(p: P _ _ _ x y z) :
2011+
P _ _ _ (recast2 e1 e2 x) (recast2 e2 e3 y) (recast2 e1 e3 z).
2012+
rewrite -(brel_fcast_3h e1 e2 e3).
2013+
exact p.
2014+
Defined.
2015+
2016+
Program Definition recast2_3hh {X Y C : Type} {F: X -> C} {G: Y -> C}
2017+
{a1 b1 c1: X} {a2 b2 c2: Y} {R: C -> C -> Type}
2018+
(e1: F a1 = G a2) (e2: F b1 = G b2) (e3: F c1 = G c2)
2019+
(x: R (G a2) (G b2)) (y: R (G b2) (G c2)) (z: R (G a2) (G c2))
2020+
(P: forall (d1 d2 d3: C), R d1 d2 -> R d2 d3 -> R d1 d3 -> Prop)
2021+
(p: P _ _ _ x y z) :
2022+
P _ _ _ (recast2 e1 e2 x) (recast2 e2 e3 y) (recast2 e1 e3 z).
2023+
rewrite -(brel_fcast_3hh e1 e2 e3).
2024+
exact p.
2025+
Defined.
2026+
2027+
Program Definition recast_hom {X Y C : precat} {F: X -> C} {G: Y -> C}
2028+
{a1 b1: X} {a2 b2: Y} {R: C -> C -> Type}
2029+
(e1: F a1 = G a2) (e2: F b1 = G b2)
2030+
(x: (G a2) ~> (G b2)) : (F a1) ~> (F b1).
2031+
eapply recast2; eauto.
2032+
Defined.
2033+
2034+
Definition recast21 {X Y C : Type} {F: X -> C} {G: Y -> C}
2035+
{R: C -> C -> Type} {a b: (X * Y)}
2036+
(e: (F (fst a), F (fst b)) = (G (snd a), G (snd b)))
2037+
(*
2038+
(e1: F (fst a) = G (snd a)) (e2: F (fst b) = G (snd b)) *)
2039+
(x: R (G (snd a)) (G (snd b))) : R (F (fst a)) (F (fst b)).
2040+
destruct a as [a1 a2].
2041+
destruct b as [b1 b2].
2042+
inversion e; subst.
2043+
rewrite H0.
2044+
rewrite H1.
2045+
auto.
2046+
Defined.
2047+
2048+
Definition mk_pair_eq {X Y C: Type} {F: X -> C} {G: Y -> C} {a b: (X * Y)}
2049+
(e1: F (fst a) = G (snd a)) (e2: F (fst b) = G (snd b)) :
2050+
(F (fst a), F (fst b)) = (G (snd a), G (snd b)).
2051+
destruct a as [a1 a2].
2052+
destruct b as [b1 b2].
2053+
simpl in *; simpl.
2054+
rewrite e1.
2055+
rewrite e2.
2056+
auto.
2057+
Defined.
2058+
2059+
Module commaE.
2060+
Section homcommaE.
2061+
Context {C D E : precat} (F : C ~> E) (G : D ~> E).
2062+
2063+
Definition ptype := { x : C * D & F x.1 = G x.2 }.
2064+
2065+
Definition hom_psubdef (a b : ptype) := {
2066+
f : tag a ~> tag b &
2067+
(F <$> f.1) = (recast2 (tagged a) (tagged b) (G <$> f.2)) }.
2068+
HB.instance Definition _ := IsQuiver.Build ptype hom_psubdef.
2069+
End homcommaE.
2070+
Arguments hom_psubdef /.
2071+
Section commaE.
2072+
Context {C D E : cat} (F : C ~> E) (G : D ~> E).
2073+
Notation ptype := (ptype F G).
2074+
2075+
Program Definition idmap_psubdef (a : ptype) : a ~> a := @Tagged _ idmap _ _.
2076+
Next Obligation.
2077+
unfold recast2.
2078+
unfold eq_rect.
2079+
unfold brel_fcast.
2080+
unfold eq_ind_r.
2081+
unfold eq_ind.
2082+
unfold eq_sym.
2083+
destruct a.
2084+
destruct x.
2085+
simpl in *; simpl.
2086+
rewrite F1.
2087+
rewrite F1.
2088+
unfold idmap.
2089+
simpl.
2090+
dependent destruction e.
2091+
auto.
2092+
Defined.
2093+
2094+
Program Definition comp_psubdef (a b c : ptype)
2095+
(f : a ~> b) (g : b ~> c) : a ~> c :=
2096+
@Tagged _ (tag f \; tag g) _ _.
2097+
Next Obligation.
2098+
destruct f as [ff ef].
2099+
destruct g as [gg eg].
2100+
destruct a as [aa ea].
2101+
destruct aa as [a1 a2].
2102+
destruct b as [bb eb].
2103+
destruct bb as [b1 b2].
2104+
destruct c as [cc ec].
2105+
destruct cc as [c1 c2].
2106+
destruct ff as [f1 f2].
2107+
destruct gg as [g1 g2].
2108+
2109+
simpl; simpl in *.
2110+
2111+
rewrite Fcomp.
2112+
rewrite Fcomp.
2113+
2114+
rewrite ef.
2115+
rewrite eg.
2116+
clear ef eg.
2117+
2118+
eapply (@recast2_3hh _ _ _ _ _ _ _ _ _ _ _ _
2119+
ea eb ec (G <$> f2) (G <$> g2) (G <$> f2 \; G <$> g2)
2120+
(fun (d1 d2 d3: E) (x: d1 ~> d2) (y: d2 ~> d3)
2121+
(z: d1 ~> d3) => x \; y = z) ); auto.
2122+
Defined.
2123+
(* by rewrite !Fcomp -compoA (tagged g) compoA (tagged f) compoA. Qed. *)
2124+
HB.instance Definition _ := IsPreCat.Build ptype idmap_psubdef comp_psubdef.
2125+
Arguments idmap_psubdef /.
2126+
Arguments comp_psubdef /.
2127+
2128+
Lemma comma_homeqP (a b : ptype) (f g : a ~> b) : projT1 f = projT1 g -> f = g.
2129+
Proof.
2130+
case: f g => [f fP] [g +]/= eqfg; case: _ / eqfg => gP.
2131+
by congr existT; apply: Prop_irrelevance.
2132+
Qed.
19282133

2134+
Lemma comma_is_cat : PreCat_IsCat ptype.
2135+
Proof.
2136+
by split=> [[a fa] [b fb] [*]|[a fa] [b fb] [*]|*];
2137+
apply/comma_homeqP; rewrite /= ?(comp1o, compo1, compoA).
2138+
Qed.
2139+
HB.instance Definition _ := comma_is_cat.
2140+
End commaE.
2141+
End commaE.
2142+
(*
2143+
Notation "F `/` G" := (@comma.type _ _ _ F G)
2144+
(at level 40, G at level 40, format "F `/` G") : cat_scope.
2145+
Notation "a /` G" := (cst unit a `/` G)
2146+
(at level 40, G at level 40, format "a /` G") : cat_scope.
2147+
Notation "F `/ b" := (F `/` cst unit b)
2148+
(at level 40, b at level 40, format "F `/ b") : cat_scope.
2149+
Notation "a / b" := (cst unit a `/ b) : cat_scope.
19292150
*)
2151+
(*
2152+
Lemma cat_pbop : HasPBop cat.
2153+
econstructor; intros.
2154+
destruct A.
2155+
destruct class as [B1 B2 B3].
2156+
destruct B1.
2157+
destruct H.
2158+
econstructor.
2159+
Admitted.
2160+
*)
2161+
(*
2162+
Program Definition pb_cat (A B: cat) (H: cospan A B) : cat.
2163+
remember A as a.
2164+
destruct a as [a_sort a_class].
2165+
remember B as b.
2166+
destruct b as [b_sort b_class].
2167+
remember H as H0.
2168+
destruct H as [t l r].
2169+
2170+
econstructor.
2171+
instantiate (1:= sigma (x: a_sort) (y: b_sort), ).
2172+
2173+
2174+
remember t as t0.
2175+
destruct t as [s c].
2176+
destruct c as [a1 a2 a3].
2177+
econstructor.
2178+
*)

0 commit comments

Comments
 (0)