X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fmatita%2Fcontribs%2Fformal_topology%2Foverlap%2Fcategories.ma;h=c5db6ad6082e91d03461ffba6f3341b924849b0b;hb=785d106d742a690c88ff0d65fbe88ca4169dbd05;hp=3a7614fca8b652e8668375d3bc1024bc6b3166a4;hpb=c78cbede35ed85575e274864e6b6b9c635c6956d;p=helm.git diff --git a/helm/software/matita/contribs/formal_topology/overlap/categories.ma b/helm/software/matita/contribs/formal_topology/overlap/categories.ma index 3a7614fca..c5db6ad60 100644 --- a/helm/software/matita/contribs/formal_topology/overlap/categories.ma +++ b/helm/software/matita/contribs/formal_topology/overlap/categories.ma @@ -26,9 +26,9 @@ record setoid : Type1 ≝ eq: equivalence_relation carr }. -definition reflexive1 ≝ λA:Type1.λR:A→A→CProp1.∀x:A.R x x. -definition symmetric1 ≝ λC:Type1.λlt:C→C→CProp1. ∀x,y:C.lt x y → lt y x. -definition transitive1 ≝ λA:Type1.λR:A→A→CProp1.∀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. record equivalence_relation1 (A:Type1) : Type2 ≝ { eq_rel1:2> A → A → CProp1; @@ -54,12 +54,12 @@ definition setoid1_of_setoid: setoid → setoid1. | apply (trans s)]] qed. -(* questa coercion e' necessaria per problemi di unificazione *) coercion setoid1_of_setoid. +prefer coercion Type_OF_setoid. -definition reflexive2 ≝ λA:Type2.λR:A→A→CProp2.∀x:A.R x x. -definition symmetric2 ≝ λC:Type2.λlt:C→C→CProp2. ∀x,y:C.lt x y → lt y x. -definition transitive2 ≝ λA:Type2.λR:A→A→CProp2.∀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. record equivalence_relation2 (A:Type2) : Type3 ≝ { eq_rel2:2> A → A → CProp2; @@ -85,25 +85,11 @@ definition setoid2_of_setoid1: setoid1 → setoid2. | apply (trans1 s)]] qed. -(*coercion setoid2_of_setoid1.*) - -(* -definition Leibniz: Type → setoid. - intro; - constructor 1; - [ apply T - | constructor 1; - [ apply (λx,y:T.cic:/matita/logic/equality/eq.ind#xpointer(1/1) ? x y) - | alias id "refl_eq" = "cic:/matita/logic/equality/eq.ind#xpointer(1/1/1)". - apply refl_eq - | alias id "sym_eq" = "cic:/matita/logic/equality/sym_eq.con". - apply sym_eq - | alias id "trans_eq" = "cic:/matita/logic/equality/trans_eq.con". - apply trans_eq ]] -qed. - -coercion Leibniz. -*) +coercion setoid2_of_setoid1. +prefer coercion Type_OF_setoid2. +prefer coercion Type_OF_setoid. +prefer coercion Type_OF_setoid1. +(* we prefer 0 < 1 < 2 *) interpretation "setoid2 eq" 'eq x y = (eq_rel2 _ (eq2 _) x y). interpretation "setoid1 eq" 'eq x y = (eq_rel1 _ (eq1 _) x y). @@ -170,13 +156,16 @@ definition CPROP: setoid1. [ apply (f2 (f x1)) | apply (f1 (f3 z1))]]] qed. +definition CProp0_of_CPROP: carr1 CPROP → CProp0 ≝ λx.x. +coercion CProp0_of_CPROP. + alias symbol "eq" = "setoid1 eq". -definition if': ∀A,B:CPROP. A = B → A → B. - intros; apply (if ?? e); assumption. +definition fi': ∀A,B:CPROP. A = B → B → A. + intros; apply (fi ?? e); assumption. qed. -notation ". r" with precedence 50 for @{'if $r}. -interpretation "if" 'if r = (if' __ r). +notation ". r" with precedence 50 for @{'fi $r}. +interpretation "fi" 'fi r = (fi' __ r). definition and_morphism: binary_morphism1 CPROP CPROP CPROP. constructor 1; @@ -210,26 +199,12 @@ definition if_morphism: binary_morphism1 CPROP CPROP CPROP. | apply (fi ?? e1); apply f; apply (if ?? e); assumption]] qed. -(* -definition eq_morphism: ∀S:setoid. binary_morphism S S CPROP. - intro; - constructor 1; - [ apply (eq_rel ? (eq S)) - | intros; split; intro; - [ apply (.= H \sup -1); - apply (.= H2); - assumption - | apply (.= H); - apply (.= H2); - apply (H1 \sup -1)]] -qed. -*) record category : Type1 ≝ { objs:> Type0; arrows: objs → objs → setoid; id: ∀o:objs. arrows o o; - comp: ∀o1,o2,o3. binary_morphism1 (arrows o1 o2) (arrows o2 o3) (arrows o1 o3); + comp: ∀o1,o2,o3. binary_morphism (arrows o1 o2) (arrows o2 o3) (arrows o1 o3); comp_assoc: ∀o1,o2,o3,o4. ∀a12,a23,a34. comp o1 o3 o4 (comp o1 o2 o3 a12 a23) a34 = comp o1 o2 o4 a12 (comp o2 o3 o4 a23 a34); id_neutral_left: ∀o1,o2. ∀a: arrows o1 o2. comp ??? (id o1) a = a; @@ -267,9 +242,7 @@ interpretation "category1 assoc" 'assoc = (comp_assoc1 ________). interpretation "category composition" 'compose x y = (fun2 ___ (comp ____) y x). interpretation "category assoc" 'assoc = (comp_assoc ________). -(* bug grande come una casa? - Ma come fa a passare la quantificazione larga??? *) -definition unary_morphism_setoid: setoid → setoid → setoid1. +definition unary_morphism_setoid: setoid → setoid → setoid. intros; constructor 1; [ apply (unary_morphism s s1); @@ -283,9 +256,9 @@ qed. definition SET: category1. constructor 1; [ apply setoid; - | apply rule (λS,T:setoid.unary_morphism_setoid S T); + | apply rule (λS,T:setoid.setoid1_of_setoid (unary_morphism_setoid S T)); | intros; constructor 1; [ apply (λx:carr o.x); | intros; assumption ] - | intros; constructor 1; [ intros; constructor 1; [ apply (λx. t1 (t x)); | intros; + | intros; constructor 1; [ intros; constructor 1; [ apply (λx. c1 (c x)); | intros; apply († (†e));] | intros; whd; intros; simplify; whd in H1; whd in H; apply trans; [ apply (b (a' a1)); | lapply (prop1 ?? b (a a1) (a' a1)); @@ -296,29 +269,17 @@ definition SET: category1. ] qed. -definition setoid_of_SET: objs1 SET → setoid. - intros; apply o; qed. +definition setoid_of_SET: objs1 SET → setoid ≝ λx.x. coercion setoid_of_SET. -definition setoid1_of_SET: SET → setoid1. - intro; whd in t; apply setoid1_of_setoid; apply t. -qed. -coercion setoid1_of_SET. - -definition eq': ∀w:SET.equivalence_relation ? := λw.eq w. +definition unary_morphism_setoid_of_arrows1_SET: + ∀P,Q.arrows1 SET P Q → unary_morphism_setoid P Q ≝ λP,Q,x.x. +coercion unary_morphism_setoid_of_arrows1_SET. -definition prop1_SET : - ∀A,B:SET.∀w:arrows1 SET A B.∀a,b:Type_OF_objs1 A.eq' ? a b→eq' ? (w a) (w b). -intros; apply (prop1 A B w a b e); -qed. - - -interpretation "SET dagger" 'prop1 h = (prop1_SET _ _ _ _ _ h). notation "hbox(a break ⇒ b)" right associative with precedence 20 for @{ 'Imply $a $b }. interpretation "unary morphism" 'Imply a b = (arrows1 SET a b). -interpretation "SET eq" 'eq x y = (eq_rel _ (eq' _) x y). -definition unary_morphism1_setoid1: setoid1 → setoid1 → setoid2. +definition unary_morphism1_setoid1: setoid1 → setoid1 → setoid1. intros; constructor 1; [ apply (unary_morphism1 s s1); @@ -331,12 +292,16 @@ definition unary_morphism1_setoid1: setoid1 → setoid1 → setoid2. | simplify; intros; apply trans1; [2: apply f; | skip | apply f1]]] qed. +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. constructor 1; [ apply setoid1; - | apply rule (λS,T.unary_morphism1_setoid1 S T); + | apply rule (λS,T.setoid2_of_setoid1 (unary_morphism1_setoid1 S T)); | intros; constructor 1; [ apply (λx.x); | intros; assumption ] - | intros; constructor 1; [ intros; constructor 1; [ apply (λx. t1 (t x)); | intros; + | intros; constructor 1; [ intros; constructor 1; [ apply (λx. c1 (c x)); | intros; apply († (†e));] | intros; whd; intros; simplify; whd in H1; whd in H; apply trans1; [ apply (b (a' a1)); | lapply (prop11 ?? b (a a1) (a' a1)); @@ -347,36 +312,17 @@ definition SET1: category2. ] qed. -definition setoid1_OF_SET1: objs2 SET1 → setoid1. - intros; apply o; qed. - -coercion setoid1_OF_SET1. - -definition eq'': ∀w:SET1.equivalence_relation1 ? := λw.eq1 w. - -definition prop11_SET1 : - ∀A,B:SET1.∀w:arrows2 SET1 A B.∀a,b:Type_OF_objs2 A.eq'' ? a b→eq'' ? (w a) (w b). -intros; apply (prop11 A B w a b e); -qed. - -definition setoid2_OF_category2: Type_OF_category2 SET1 → setoid2. - intro; apply (setoid2_of_setoid1 t); qed. -coercion setoid2_OF_category2. +definition setoid1_of_SET1: objs2 SET1 → setoid1 ≝ λx.x. +coercion setoid1_of_SET1. -definition objs2_OF_category1: Type_OF_category1 SET → objs2 SET1. - intro; apply (setoid1_of_setoid t); qed. -coercion objs2_OF_category1. +definition unary_morphism1_setoid1_of_arrows2_SET1: + ∀P,Q.arrows2 SET1 P Q → unary_morphism1_setoid1 P Q ≝ λP,Q,x.x. +coercion unary_morphism1_setoid1_of_arrows2_SET1. + +variant objs2_of_category1: objs1 SET → objs2 SET1 ≝ setoid1_of_setoid. +coercion objs2_of_category1. -definition Type1_OF_SET1: Type_OF_category2 SET1 → Type1. - intro; whd in t; apply (carr1 t); -qed. -coercion Type1_OF_SET1. +prefer coercion Type_OF_setoid. (* we prefer the lower carrier projection *) +prefer coercion Type_OF_objs1. -interpretation "SET dagger" 'prop1 h = (prop11_SET1 _ _ _ _ _ h). interpretation "unary morphism1" 'Imply a b = (arrows2 SET1 a b). -interpretation "SET1 eq" 'eq x y = (eq_rel1 _ (eq'' _) x y). - -lemma unary_morphism1_of_arrows1_SET1: ∀S,T. (S ⇒ T) → unary_morphism1 S T. - intros; apply t; -qed. -coercion unary_morphism1_of_arrows1_SET1.