From: Claudio Sacerdoti Coen Date: Sat, 17 Jan 2009 19:36:45 +0000 (+0000) Subject: CAT2 X-Git-Tag: make_still_working~4246 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=4bdb34a1cce33b4387b04cc37bf229e08f5bbafb;p=helm.git CAT2 --- diff --git a/helm/software/matita/contribs/formal_topology/overlap/categories.ma b/helm/software/matita/contribs/formal_topology/overlap/categories.ma index c5db6ad60..7ac1b0b3d 100644 --- a/helm/software/matita/contribs/formal_topology/overlap/categories.ma +++ b/helm/software/matita/contribs/formal_topology/overlap/categories.ma @@ -26,10 +26,6 @@ record setoid : Type1 ≝ eq: equivalence_relation carr }. -definition reflexive1: ∀A:Type1.∀R:A→A→CProp1.CProp1 ≝ λA:Type1.λR:A→A→CProp1.∀x:A.R x x. -definition symmetric1: ∀A:Type1.∀R:A→A→CProp1.CProp1 ≝ λC:Type1.λlt:C→C→CProp1. ∀x,y:C.lt x y → lt y x. -definition transitive1: ∀A:Type1.∀R:A→A→CProp1.CProp1 ≝ λA:Type1.λR:A→A→CProp1.∀x,y,z:A.R x y → R y z → R x z. - record equivalence_relation1 (A:Type1) : Type2 ≝ { eq_rel1:2> A → A → CProp1; refl1: reflexive1 ? eq_rel1; @@ -57,10 +53,6 @@ qed. coercion setoid1_of_setoid. prefer coercion Type_OF_setoid. -definition reflexive2: ∀A:Type2.∀R:A→A→CProp2.CProp2 ≝ λA:Type2.λR:A→A→CProp2.∀x:A.R x x. -definition symmetric2: ∀A:Type2.∀R:A→A→CProp2.CProp2 ≝ λC:Type2.λlt:C→C→CProp2. ∀x,y:C.lt x y → lt y x. -definition transitive2: ∀A:Type2.∀R:A→A→CProp2.CProp2 ≝ λA:Type2.λR:A→A→CProp2.∀x,y,z:A.R x y → R y z → R x z. - record equivalence_relation2 (A:Type2) : Type3 ≝ { eq_rel2:2> A → A → CProp2; refl2: reflexive2 ? eq_rel2; @@ -91,13 +83,29 @@ prefer coercion Type_OF_setoid. prefer coercion Type_OF_setoid1. (* we prefer 0 < 1 < 2 *) +record equivalence_relation3 (A:Type3) : Type4 ≝ + { eq_rel3:2> A → A → CProp3; + refl3: reflexive3 ? eq_rel3; + sym3: symmetric3 ? eq_rel3; + trans3: transitive3 ? eq_rel3 + }. + +record setoid3: Type4 ≝ + { carr3:> Type3; + eq3: equivalence_relation3 carr3 + }. + + +interpretation "setoid3 eq" 'eq x y = (eq_rel3 _ (eq3 _) x y). interpretation "setoid2 eq" 'eq x y = (eq_rel2 _ (eq2 _) x y). interpretation "setoid1 eq" 'eq x y = (eq_rel1 _ (eq1 _) x y). interpretation "setoid eq" 'eq x y = (eq_rel _ (eq _) x y). +interpretation "setoid3 symmetry" 'invert r = (sym3 ____ r). interpretation "setoid2 symmetry" 'invert r = (sym2 ____ r). interpretation "setoid1 symmetry" 'invert r = (sym1 ____ r). interpretation "setoid symmetry" 'invert r = (sym ____ r). notation ".= r" with precedence 50 for @{'trans $r}. +interpretation "trans3" 'trans r = (trans3 _____ r). interpretation "trans2" 'trans r = (trans2 _____ r). interpretation "trans1" 'trans r = (trans1 _____ r). interpretation "trans" 'trans r = (trans _____ r). @@ -117,6 +125,11 @@ record unary_morphism2 (A,B: setoid2) : Type2 ≝ prop12: ∀a,a'. eq2 ? a a' → eq2 ? (fun12 a) (fun12 a') }. +record unary_morphism3 (A,B: setoid3) : Type3 ≝ + { fun13:1> A → B; + prop13: ∀a,a'. eq3 ? a a' → eq3 ? (fun13 a) (fun13 a') + }. + record binary_morphism (A,B,C:setoid) : Type0 ≝ { fun2:2> A → B → C; prop2: ∀a,a',b,b'. eq ? a a' → eq ? b b' → eq ? (fun2 a b) (fun2 a' b') @@ -132,18 +145,33 @@ record binary_morphism2 (A,B,C:setoid2) : Type2 ≝ prop22: ∀a,a',b,b'. eq2 ? a a' → eq2 ? b b' → eq2 ? (fun22 a b) (fun22 a' b') }. +record binary_morphism3 (A,B,C:setoid3) : Type3 ≝ + { fun23:2> A → B → C; + prop23: ∀a,a',b,b'. eq3 ? a a' → eq3 ? b b' → eq3 ? (fun23 a b) (fun23 a' b') + }. + notation "† c" with precedence 90 for @{'prop1 $c }. notation "l ‡ r" with precedence 90 for @{'prop2 $l $r }. notation "#" with precedence 90 for @{'refl}. interpretation "prop1" 'prop1 c = (prop1 _____ c). interpretation "prop11" 'prop1 c = (prop11 _____ c). interpretation "prop12" 'prop1 c = (prop12 _____ c). +interpretation "prop13" 'prop1 c = (prop13 _____ c). interpretation "prop2" 'prop2 l r = (prop2 ________ l r). interpretation "prop21" 'prop2 l r = (prop21 ________ l r). interpretation "prop22" 'prop2 l r = (prop22 ________ l r). +interpretation "prop23" 'prop2 l r = (prop23 ________ l r). interpretation "refl" 'refl = (refl ___). interpretation "refl1" 'refl = (refl1 ___). interpretation "refl2" 'refl = (refl2 ___). +interpretation "refl3" 'refl = (refl3 ___). + +definition unary_morphism2_of_unary_morphism1: ∀S,T.unary_morphism1 S T → unary_morphism2 S T. + intros; + constructor 1; + [ apply (fun11 ?? u); + | apply (prop11 ?? u); ] +qed. definition CPROP: setoid1. constructor 1; @@ -233,6 +261,17 @@ record category2 : Type3 ≝ id_neutral_left2: ∀o1,o2. ∀a: arrows2 o1 o2. comp2 ??? a (id2 o2) = a }. +record category3 : Type4 ≝ + { objs3:> Type3; + arrows3: objs3 → objs3 → setoid3; + id3: ∀o:objs3. arrows3 o o; + comp3: ∀o1,o2,o3. binary_morphism3 (arrows3 o1 o2) (arrows3 o2 o3) (arrows3 o1 o3); + comp_assoc3: ∀o1,o2,o3,o4. ∀a12,a23,a34. + comp3 o1 o3 o4 (comp3 o1 o2 o3 a12 a23) a34 = comp3 o1 o2 o4 a12 (comp3 o2 o3 o4 a23 a34); + id_neutral_right3: ∀o1,o2. ∀a: arrows3 o1 o2. comp3 ??? (id3 o1) a = a; + id_neutral_left3: ∀o1,o2. ∀a: arrows3 o1 o2. comp3 ??? a (id3 o2) = a + }. + notation "'ASSOC'" with precedence 90 for @{'assoc}. interpretation "category2 composition" 'compose x y = (fun22 ___ (comp2 ____) y x). @@ -242,6 +281,85 @@ interpretation "category1 assoc" 'assoc = (comp_assoc1 ________). interpretation "category composition" 'compose x y = (fun2 ___ (comp ____) y x). interpretation "category assoc" 'assoc = (comp_assoc ________). +definition category2_of_category1: category1 → category2. + intro; + constructor 1; + [ apply (objs1 c); + | intros; apply (setoid2_of_setoid1 (arrows1 c o o1)); + | apply (id1 c); + | intros; + constructor 1; + [ intros; apply (comp1 c o1 o2 o3 c1 c2); + | intros; whd in e e1 a a' b b'; change with (eq1 ? (b∘a) (b'∘a')); apply (e‡e1); ] + | intros; simplify; whd in a12 a23 a34; whd; apply rule (ASSOC); + | intros; simplify; whd in a; whd; apply id_neutral_right1; + | intros; simplify; whd in a; whd; apply id_neutral_left1; ] +qed. +(*coercion category2_of_category1.*) + +record functor2 (C1: category2) (C2: category2) : Type3 ≝ + { map_objs2:1> C1 → C2; + map_arrows2: ∀S,T. unary_morphism2 (arrows2 ? S T) (arrows2 ? (map_objs2 S) (map_objs2 T)); + respects_id2: ∀o:C1. map_arrows2 ?? (id2 ? o) = id2 ? (map_objs2 o); + respects_comp2: + ∀o1,o2,o3,o4.∀f1:arrows2 ? o1 o2.∀f2:arrows2 ? o2 o3.∀f3:arrows2 ? o3 o4. + map_arrows2 ?? (f3 ∘ f2 ∘ f1) = + map_arrows2 ?? f3 ∘ map_arrows2 ?? f2 ∘ map_arrows2 ?? f1}. + +definition functor2_setoid: category2 → category2 → setoid3. + intros (C1 C2); + constructor 1; + [ apply (functor2 C1 C2); + | constructor 1; + [ intros (f g); + apply (∀c:C1. cic:/matita/logic/equality/eq.ind#xpointer(1/1) ? (f c) (g c)); + | simplify; intros; apply cic:/matita/logic/equality/eq.ind#xpointer(1/1/1); + | simplify; intros; apply cic:/matita/logic/equality/sym_eq.con; apply H; + | simplify; intros; apply cic:/matita/logic/equality/trans_eq.con; + [2: apply H; | skip | apply H1;]]] +qed. + +definition functor2_of_functor2_setoid: ∀S,T. functor2_setoid S T → functor2 S T ≝ λS,T,x.x. +coercion functor2_of_functor2_setoid. + +definition CAT2: category3. + constructor 1; + [ apply category2; + | apply functor2_setoid; + | intros; constructor 1; + [ apply (λx.x); + | intros; constructor 1; + [ apply (λx.x); + | intros; assumption;] + | intros; apply rule #; + | intros; apply rule #; ] + | intros; constructor 1; + [ intros; constructor 1; + [ intros; apply (c1 (c o)); + | intros; constructor 1; + [ intro; apply (map_arrows2 ?? c1 ?? (map_arrows2 ?? c ?? c2)); + | intros; apply (††e); ] + | intros; simplify; + apply (.= †(respects_id2 : ?)); + apply (respects_id2 : ?); + | intros; simplify; + apply (.= †(respects_comp2 : ?)); + apply (respects_comp2 : ?); ] + | intros; intro; simplify; + apply (cic:/matita/logic/equality/eq_ind.con ????? (e ?)); + apply (cic:/matita/logic/equality/eq_ind.con ????? (e1 ?)); + constructor 1; ] + | intros; intro; simplify; constructor 1; + | intros; intro; simplify; constructor 1; + | intros; intro; simplify; constructor 1; ] +qed. + +definition category2_of_objs3_CAT2: objs3 CAT2 → category2 ≝ λx.x. +coercion category2_of_objs3_CAT2. + +definition functor2_setoid_of_arrows3_CAT2: ∀S,T. arrows3 CAT2 S T → functor2_setoid S T ≝ λS,T,x.x. +coercion functor2_setoid_of_arrows3_CAT2. + definition unary_morphism_setoid: setoid → setoid → setoid. intros; constructor 1; @@ -296,7 +414,7 @@ definition unary_morphism1_of_unary_morphism1_setoid1 : ∀S,T. unary_morphism1_setoid1 S T → unary_morphism1 S T ≝ λP,Q,x.x. coercion unary_morphism1_of_unary_morphism1_setoid1. -definition SET1: category2. +definition SET1: objs3 CAT2. constructor 1; [ apply setoid1; | apply rule (λS,T.setoid2_of_setoid1 (unary_morphism1_setoid1 S T)); @@ -325,4 +443,4 @@ coercion objs2_of_category1. prefer coercion Type_OF_setoid. (* we prefer the lower carrier projection *) prefer coercion Type_OF_objs1. -interpretation "unary morphism1" 'Imply a b = (arrows2 SET1 a b). +interpretation "unary morphism1" 'Imply a b = (arrows2 SET1 a b). \ No newline at end of file diff --git a/helm/software/matita/contribs/formal_topology/overlap/cprop_connectives.ma b/helm/software/matita/contribs/formal_topology/overlap/cprop_connectives.ma index 167c33317..644acc218 100644 --- a/helm/software/matita/contribs/formal_topology/overlap/cprop_connectives.ma +++ b/helm/software/matita/contribs/formal_topology/overlap/cprop_connectives.ma @@ -14,7 +14,8 @@ include "logic/connectives.ma". -definition Type3 : Type := Type. +definition Type4 : Type := Type. +definition Type3 : Type4 := Type. definition Type2 : Type3 := Type. definition Type1 : Type2 := Type. definition Type0 : Type1 := Type. @@ -23,20 +24,25 @@ definition Type_of_Type0: Type0 → Type := λx.x. definition Type_of_Type1: Type1 → Type := λx.x. definition Type_of_Type2: Type2 → Type := λx.x. definition Type_of_Type3: Type3 → Type := λx.x. +definition Type_of_Type4: Type4 → Type := λx.x. coercion Type_of_Type0. coercion Type_of_Type1. coercion Type_of_Type2. coercion Type_of_Type3. +coercion Type_of_Type4. definition CProp0 : Type1 := Type0. definition CProp1 : Type2 := Type1. definition CProp2 : Type3 := Type2. +definition CProp3 : Type4 := Type3. definition CProp_of_CProp0: CProp0 → CProp ≝ λx.x. definition CProp_of_CProp1: CProp1 → CProp ≝ λx.x. definition CProp_of_CProp2: CProp2 → CProp ≝ λx.x. +definition CProp_of_CProp3: CProp3 → CProp ≝ λx.x. coercion CProp_of_CProp0. coercion CProp_of_CProp1. coercion CProp_of_CProp2. +coercion CProp_of_CProp3. inductive Or (A,B:CProp0) : CProp0 ≝ | Left : A → Or A B @@ -155,3 +161,15 @@ definition antisymmetric: ∀A:Type0. ∀R:A→A→CProp0. ∀eq:A→A→Prop.CP definition reflexive: ∀C:Type0. ∀lt:C→C→CProp0.CProp0 ≝ λA:Type0.λR:A→A→CProp0.∀x:A.R x x. definition transitive: ∀C:Type0. ∀lt:C→C→CProp0.CProp0 ≝ λA:Type0.λR:A→A→CProp0.∀x,y,z:A.R x y → R y z → R x z. + +definition reflexive1: ∀A:Type1.∀R:A→A→CProp1.CProp1 ≝ λA:Type1.λR:A→A→CProp1.∀x:A.R x x. +definition symmetric1: ∀A:Type1.∀R:A→A→CProp1.CProp1 ≝ λC:Type1.λlt:C→C→CProp1. ∀x,y:C.lt x y → lt y x. +definition transitive1: ∀A:Type1.∀R:A→A→CProp1.CProp1 ≝ λA:Type1.λR:A→A→CProp1.∀x,y,z:A.R x y → R y z → R x z. + +definition reflexive2: ∀A:Type2.∀R:A→A→CProp2.CProp2 ≝ λA:Type2.λR:A→A→CProp2.∀x:A.R x x. +definition symmetric2: ∀A:Type2.∀R:A→A→CProp2.CProp2 ≝ λC:Type2.λlt:C→C→CProp2. ∀x,y:C.lt x y → lt y x. +definition transitive2: ∀A:Type2.∀R:A→A→CProp2.CProp2 ≝ λA:Type2.λR:A→A→CProp2.∀x,y,z:A.R x y → R y z → R x z. + +definition reflexive3: ∀A:Type3.∀R:A→A→CProp3.CProp3 ≝ λA:Type3.λR:A→A→CProp3.∀x:A.R x x. +definition symmetric3: ∀A:Type3.∀R:A→A→CProp3.CProp3 ≝ λC:Type3.λlt:C→C→CProp3. ∀x,y:C.lt x y → lt y x. +definition transitive3: ∀A:Type3.∀R:A→A→CProp3.CProp3 ≝ λA:Type3.λR:A→A→CProp3.∀x,y,z:A.R x y → R y z → R x z. diff --git a/helm/software/matita/contribs/formal_topology/overlap/relations_to_o-algebra.ma b/helm/software/matita/contribs/formal_topology/overlap/relations_to_o-algebra.ma index 3317c0e64..a7041357a 100644 --- a/helm/software/matita/contribs/formal_topology/overlap/relations_to_o-algebra.ma +++ b/helm/software/matita/contribs/formal_topology/overlap/relations_to_o-algebra.ma @@ -157,3 +157,17 @@ lemma orelation_of_relation_preserves_composition: | whd; intros; apply f; exists; [ apply y] split; assumption; | cases f1; clear f1; cases x; clear x; apply (f w); assumption;] qed. + +definition SUBSETS': carr3 (arrows3 CAT2 (category2_of_category1 REL) OA). + constructor 1; + [ apply SUBSETS; + | intros; constructor 1; + [ apply (orelation_of_relation S T); + | intros; apply (orelation_of_relation_preserves_equality S T a a' e); ] + | apply orelation_of_relation_preserves_identity; + | simplify; intros; + apply (.= (orelation_of_relation_preserves_composition o1 o2 o4 f1 (f3∘f2))); + apply (#‡(orelation_of_relation_preserves_composition o2 o3 o4 f2 f3)); ] +qed. + + \ No newline at end of file