From 3d7b244a79a1c57d3355deb2f9a70764cde077b9 Mon Sep 17 00:00:00 2001 From: Claudio Sacerdoti Coen Date: Sun, 28 Dec 2008 12:42:21 +0000 Subject: [PATCH] WARNING: partial commit to try to understand something. I have fixed the universes in categories, adding a new category (of level 2) and trying to prove that powersets form a SET1. Failing, so far. --- .../formal_topology/overlap/categories.ma | 376 ++++++++++++++++++ .../contribs/formal_topology/overlap/depends | 3 +- .../formal_topology/overlap/o-algebra.ma | 28 +- .../overlap/o-formal_topologies.ma | 14 +- .../formal_topology/overlap/subsets.ma | 139 +++++++ 5 files changed, 543 insertions(+), 17 deletions(-) create mode 100644 helm/software/matita/contribs/formal_topology/overlap/categories.ma create mode 100644 helm/software/matita/contribs/formal_topology/overlap/subsets.ma diff --git a/helm/software/matita/contribs/formal_topology/overlap/categories.ma b/helm/software/matita/contribs/formal_topology/overlap/categories.ma new file mode 100644 index 000000000..5afda73d9 --- /dev/null +++ b/helm/software/matita/contribs/formal_topology/overlap/categories.ma @@ -0,0 +1,376 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +include "logic/cprop_connectives.ma". + +definition Type0 := Type. +definition Type1 := Type. +definition Type2 := Type. +definition Type3 := Type. +definition Type0_lt_Type1 := (Type0 : Type1). +definition Type1_lt_Type2 := (Type1 : Type2). +definition Type2_lt_Type3 := (Type2 : Type3). + +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. +coercion Type_OF_Type0. +coercion Type_OF_Type1. +coercion Type_OF_Type2. +coercion Type_OF_Type3. + +definition CProp0 := CProp. +definition CProp1 := CProp. +definition CProp2 := CProp. +definition CProp0_lt_CProp1 := (CProp0 : CProp1). +definition CProp1_lt_CProp2 := (CProp1 : CProp2). + +definition CProp_OF_CProp0: CProp0 → CProp := λx.x. +definition CProp_OF_CProp1: CProp1 → CProp := λx.x. +definition CProp_OF_CProp2: CProp2 → CProp := λx.x. + +record equivalence_relation (A:Type0) : Type1 ≝ + { eq_rel:2> A → A → CProp0; + refl: reflexive ? eq_rel; + sym: symmetric ? eq_rel; + trans: transitive ? eq_rel + }. + +record setoid : Type1 ≝ + { carr:> Type0; + 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. + +record equivalence_relation1 (A:Type1) : Type1 ≝ + { eq_rel1:2> A → A → CProp1; + refl1: reflexive1 ? eq_rel1; + sym1: symmetric1 ? eq_rel1; + trans1: transitive1 ? eq_rel1 + }. + +record setoid1: Type2 ≝ + { carr1:> Type1; + eq1: equivalence_relation1 carr1 + }. + +definition setoid1_of_setoid: setoid → setoid1. + intro; + constructor 1; + [ apply (carr s) + | constructor 1; + [ apply (eq_rel s); + apply (eq s) + | apply (refl s) + | apply (sym s) + | apply (trans s)]] +qed. + +(* questa coercion e' necessaria per problemi di unificazione *) +coercion setoid1_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. + +record equivalence_relation2 (A:Type2) : Type2 ≝ + { eq_rel2:2> A → A → CProp2; + refl2: reflexive2 ? eq_rel2; + sym2: symmetric2 ? eq_rel2; + trans2: transitive2 ? eq_rel2 + }. + +record setoid2: Type3 ≝ + { carr2:> Type2; + eq2: equivalence_relation2 carr2 + }. + +(* +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. +*) + +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 "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 "trans2" 'trans r = (trans2 _____ r). +interpretation "trans1" 'trans r = (trans1 _____ r). +interpretation "trans" 'trans r = (trans _____ r). + +record unary_morphism (A,B: setoid) : Type0 ≝ + { fun1:1> A → B; + prop1: ∀a,a'. eq ? a a' → eq ? (fun1 a) (fun1 a') + }. + +record unary_morphism1 (A,B: setoid1) : Type1 ≝ + { fun11:1> A → B; + prop11: ∀a,a'. eq1 ? a a' → eq1 ? (fun11 a) (fun11 a') + }. + +record unary_morphism2 (A,B: setoid2) : Type2 ≝ + { fun12:1> A → B; + prop12: ∀a,a'. eq2 ? a a' → eq2 ? (fun12 a) (fun12 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') + }. + +record binary_morphism1 (A,B,C:setoid1) : Type1 ≝ + { fun21:2> A → B → C; + prop21: ∀a,a',b,b'. eq1 ? a a' → eq1 ? b b' → eq1 ? (fun21 a b) (fun21 a' b') + }. + +record binary_morphism2 (A,B,C:setoid2) : Type2 ≝ + { fun22:2> A → B → C; + prop22: ∀a,a',b,b'. eq2 ? a a' → eq2 ? b b' → eq2 ? (fun22 a b) (fun22 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 "prop2" 'prop2 l r = (prop2 ________ l r). +interpretation "prop21" 'prop2 l r = (prop21 ________ l r). +interpretation "refl" 'refl = (refl ___). +interpretation "refl1" 'refl = (refl1 ___). +interpretation "refl2" 'refl = (refl2 ___). + +definition CPROP: setoid1. + constructor 1; + [ apply CProp0 + | constructor 1; + [ apply Iff + | intros 1; split; intro; assumption + | intros 3; cases H; split; assumption + | intros 5; cases H; cases H1; split; intro; + [ apply (H4 (H2 x1)) | apply (H3 (H5 z1))]]] +qed. + +definition if': ∀A,B:CPROP. A = B → A → B. + intros; apply (if ?? e); assumption. +qed. + +notation ". r" with precedence 50 for @{'if $r}. +interpretation "if" 'if r = (if' __ r). + +definition and_morphism: binary_morphism1 CPROP CPROP CPROP. + constructor 1; + [ apply And + | intros; split; intro; cases H; split; + [ apply (if ?? e a1) + | apply (if ?? e1 b1) + | apply (fi ?? e a1) + | apply (fi ?? e1 b1)]] +qed. + +interpretation "and_morphism" 'and a b = (fun21 ___ and_morphism a b). + +definition or_morphism: binary_morphism1 CPROP CPROP CPROP. + constructor 1; + [ apply Or + | intros; split; intro; cases H; [1,3:left |2,4: right] + [ apply (if ?? e a1) + | apply (fi ?? e a1) + | apply (if ?? e1 b1) + | apply (fi ?? e1 b1)]] +qed. + +interpretation "or_morphism" 'or a b = (fun21 ___ or_morphism a b). + +definition if_morphism: binary_morphism1 CPROP CPROP CPROP. + constructor 1; + [ apply (λA,B. A → B) + | intros; split; intros; + [ apply (if ?? e1); apply H; apply (fi ?? e); assumption + | apply (fi ?? e1); apply H; 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_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; + id_neutral_right: ∀o1,o2. ∀a: arrows o1 o2. comp ??? a (id o2) = a + }. + +record category1 : Type2 ≝ + { objs1:> Type1; + arrows1: objs1 → objs1 → setoid1; + id1: ∀o:objs1. arrows1 o o; + comp1: ∀o1,o2,o3. binary_morphism1 (arrows1 o1 o2) (arrows1 o2 o3) (arrows1 o1 o3); + comp_assoc1: ∀o1,o2,o3,o4. ∀a12,a23,a34. + comp1 o1 o3 o4 (comp1 o1 o2 o3 a12 a23) a34 = comp1 o1 o2 o4 a12 (comp1 o2 o3 o4 a23 a34); + id_neutral_right1: ∀o1,o2. ∀a: arrows1 o1 o2. comp1 ??? (id1 o1) a = a; + id_neutral_left1: ∀o1,o2. ∀a: arrows1 o1 o2. comp1 ??? a (id1 o2) = a + }. + +record category2 : Type3 ≝ + { objs2:> Type2; + arrows2: objs2 → objs2 → setoid2; + id2: ∀o:objs2. arrows2 o o; + comp2: ∀o1,o2,o3. binary_morphism2 (arrows2 o1 o2) (arrows2 o2 o3) (arrows2 o1 o3); + comp_assoc2: ∀o1,o2,o3,o4. ∀a12,a23,a34. + comp2 o1 o3 o4 (comp2 o1 o2 o3 a12 a23) a34 = comp2 o1 o2 o4 a12 (comp2 o2 o3 o4 a23 a34); + id_neutral_right2: ∀o1,o2. ∀a: arrows2 o1 o2. comp2 ??? (id2 o1) a = a; + id_neutral_left2: ∀o1,o2. ∀a: arrows2 o1 o2. comp2 ??? a (id2 o2) = a + }. + +notation "'ASSOC'" with precedence 90 for @{'assoc}. +notation "'ASSOC1'" with precedence 90 for @{'assoc1}. +notation "'ASSOC2'" with precedence 90 for @{'assoc2}. + +interpretation "category1 composition" 'compose x y = (fun22 ___ (comp2 ____) y x). +interpretation "category1 assoc" 'assoc1 = (comp_assoc2 ________). +interpretation "category1 composition" 'compose x y = (fun21 ___ (comp1 ____) y x). +interpretation "category1 assoc" 'assoc1 = (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 → setoid. + intros; + constructor 1; + [ apply (unary_morphism s s1); + | constructor 1; + [ intros (f g); apply (∀a:s. f a = g a); + | intros 1; simplify; intros; apply refl; + | simplify; intros; apply sym; apply H; + | simplify; intros; apply trans; [2: apply H; | skip | apply H1]]] +qed. + +definition SET: category1. + constructor 1; + [ apply setoid; + | apply rule (λS,T: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; + 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)); + [ apply Hletin | apply (e a1); ] | apply e1; ]] + | intros; whd; intros; simplify; apply refl; + | intros; simplify; whd; intros; simplify; apply refl; + | intros; simplify; whd; intros; simplify; apply refl; + ] +qed. + +definition setoid_of_SET: objs1 SET → setoid. + intros; apply o; qed. +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 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. + intros; + constructor 1; + [ apply (unary_morphism1 s s1); + | constructor 1; + [ intros (f g); apply (∀a: carr1 s. f a = g a); + | intros 1; simplify; intros; apply refl1; + | simplify; intros; apply sym1; apply H; + | simplify; intros; apply trans1; [2: apply H; | skip | apply H1]]] +qed. + +definition SET1: category2. + constructor 1; + [ apply setoid1; + | apply rule (λS,T.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; + 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)); + [ apply Hletin | apply (e a1); ] | apply e1; ]] + | intros; whd; intros; simplify; apply refl1; + | intros; simplify; whd; intros; simplify; apply refl1; + | intros; simplify; whd; intros; simplify; apply refl1; + ] +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. + +interpretation "SET dagger" 'prop1 h = (prop11_SET1 _ _ _ _ _ h). +notation "hbox(a break ⇒ b)" right associative with precedence 20 for @{ 'Imply $a $b }. +interpretation "unary morphism1" 'Imply a b = (arrows2 SET1 a b). +interpretation "SET1 eq" 'eq x y = (eq_rel1 _ (eq'' _) x y). \ No newline at end of file diff --git a/helm/software/matita/contribs/formal_topology/overlap/depends b/helm/software/matita/contribs/formal_topology/overlap/depends index 0032b3151..377b1d243 100644 --- a/helm/software/matita/contribs/formal_topology/overlap/depends +++ b/helm/software/matita/contribs/formal_topology/overlap/depends @@ -2,7 +2,8 @@ o-basic_pairs.ma datatypes/categories.ma o-algebra.ma o-concrete_spaces.ma o-basic_pairs.ma o-saturations.ma o-saturations.ma o-algebra.ma o-algebra.ma datatypes/categories.ma logic/cprop_connectives.ma -o-formal_topologies.ma o-concrete_spaces.ma +o-formal_topologies.ma o-basic_topologies.ma +categories.ma logic/cprop_connectives.ma o-basic_topologies.ma o-algebra.ma o-saturations.ma datatypes/categories.ma logic/cprop_connectives.ma diff --git a/helm/software/matita/contribs/formal_topology/overlap/o-algebra.ma b/helm/software/matita/contribs/formal_topology/overlap/o-algebra.ma index cb2113414..617c58b60 100644 --- a/helm/software/matita/contribs/formal_topology/overlap/o-algebra.ma +++ b/helm/software/matita/contribs/formal_topology/overlap/o-algebra.ma @@ -12,10 +12,10 @@ (* *) (**************************************************************************) -include "datatypes/categories.ma". +include "categories.ma". include "logic/cprop_connectives.ma". -inductive bool : Type := true : bool | false : bool. +inductive bool : Type0 := true : bool | false : bool. lemma BOOL : objs1 SET. constructor 1; [apply bool] constructor 1; @@ -36,6 +36,8 @@ qed. interpretation "unary morphism comprehension with no proof" 'comprehension T P = (mk_unary_morphism T _ P _). +interpretation "unary morphism1 comprehension with no proof" 'comprehension T P = + (mk_unary_morphism1 T _ P _). notation > "hvbox({ ident i ∈ s | term 19 p | by })" with precedence 90 for @{ 'comprehension_by $s (λ${ident i}. $p) $by}. @@ -44,17 +46,23 @@ for @{ 'comprehension_by $s (λ${ident i}:$_. $p) $by}. interpretation "unary morphism comprehension with proof" 'comprehension_by s \eta.f p = (mk_unary_morphism s _ f p). +interpretation "unary morphism1 comprehension with proof" 'comprehension_by s \eta.f p = + (mk_unary_morphism1 s _ f p). + +definition Type_of_SET: SET → Type0 := λS.carr S. +coercion Type_of_SET. (* per il set-indexing vedere capitolo BPTools (foundational tools), Sect. 0.3.4 complete lattices, Definizione 0.9 *) (* USARE L'ESISTENZIALE DEBOLE *) (* Far salire SET usando setoidi1 *) -record OAlgebra : Type := { +alias symbol "comprehension_by" = "unary morphism comprehension with proof". +record OAlgebra : Type1 := { oa_P :> SET; - oa_leq : binary_morphism1 oa_P oa_P CPROP; (* CPROP is setoid1, CPROP importante che sia small *) - oa_overlap: binary_morphism1 oa_P oa_P CPROP; - oa_meet: ∀I:SET.unary_morphism (arrows1 SET I oa_P) oa_P; - oa_join: ∀I:SET.unary_morphism (arrows1 SET I oa_P) oa_P; + oa_leq : binary_morphism1 (setoid1_of_setoid oa_P) (setoid1_of_setoid oa_P) CPROP; (* CPROP is setoid1, CPROP importante che sia small *) + oa_overlap: binary_morphism1 (setoid1_of_setoid oa_P) (setoid1_of_setoid oa_P) CPROP; + oa_meet: ∀I:SET.unary_morphism1 (arrows1 SET I oa_P) (setoid1_of_setoid oa_P); + oa_join: ∀I:SET.unary_morphism1 (arrows1 SET I oa_P) (setoid1_of_setoid oa_P); oa_one: oa_P; oa_zero: oa_P; oa_leq_refl: ∀a:oa_P. oa_leq a a; @@ -68,7 +76,7 @@ record OAlgebra : Type := { oa_one_top: ∀p:oa_P.oa_leq p oa_one; (* preservers!! (typo) *) oa_overlap_preservers_meet_: - ∀p,q.oa_overlap p q → oa_overlap p + ∀p,q:oa_P.oa_overlap p q → oa_overlap p (oa_meet ? { x ∈ BOOL | match x with [ true ⇒ p | false ⇒ q ] | IF_THEN_ELSE_p oa_P p q }); (* ⇔ deve essere =, l'esiste debole *) oa_join_split: @@ -105,9 +113,9 @@ notation > "hovbox(a ∧ b)" left associative with precedence 50 for @{ 'oa_meet (mk_unary_morphism BOOL ? (λx__:bool.match x__ with [ true ⇒ $a | false ⇒ $b ]) (IF_THEN_ELSE_p ? $a $b)) }. *) interpretation "o-algebra meet" 'oa_meet f = - (fun_1 __ (oa_meet __) f). + (fun11 __ (oa_meet __) f). interpretation "o-algebra meet with explicit function" 'oa_meet_mk f = - (fun_1 __ (oa_meet __) (mk_unary_morphism _ _ f _)). + (fun11 __ (oa_meet __) (mk_unary_morphism _ _ f _)). definition binary_meet : ∀O:OAlgebra. binary_morphism1 O O O. intros; split; diff --git a/helm/software/matita/contribs/formal_topology/overlap/o-formal_topologies.ma b/helm/software/matita/contribs/formal_topology/overlap/o-formal_topologies.ma index 1693b55f6..e136821af 100644 --- a/helm/software/matita/contribs/formal_topology/overlap/o-formal_topologies.ma +++ b/helm/software/matita/contribs/formal_topology/overlap/o-formal_topologies.ma @@ -12,13 +12,13 @@ (* *) (**************************************************************************) -include "o-concrete_spaces.ma". - -definition btop_carr: BTop → Type ≝ λo:BTop. carr (carrbt o). +include "o-basic_topologies.ma". +definition btop_carr: BTop → Type ≝ λo:BTop. carr1 (oa_P (carrbt o)). coercion btop_carr. -definition btop_carr': BTop → setoid ≝ λo:BTop. carrbt o. +(* +definition btop_carr': BTop → setoid1 ≝ λo:BTop. carrbt o. coercion btop_carr'. @@ -40,12 +40,14 @@ definition ffintersects: ∀S:BTop. binary_morphism1 (Ω \sup S) (Ω \sup S) (Ω qed. interpretation "ffintersects" 'fintersects U V = (fun1 ___ (ffintersects _) U V). +*) record formal_topology: Type ≝ { bt:> BTop; - converges: ∀U,V: Ω \sup bt. A ? (U ↓ V) = A ? U ∩ A ? V + converges: ∀U,V: bt. A ? (U ↓ V) = (A ? U ∧ A ? V) }. +(* definition bt': formal_topology → basic_topology ≝ λo:formal_topology.bt o. coercion bt'. @@ -57,7 +59,7 @@ definition ffintersects': ∀S:BTop. binary_morphism1 S S (Ω \sup S). qed. interpretation "ffintersects'" 'fintersects U V = (fun1 ___ (ffintersects' _) U V). - +*) record formal_map (S,T: formal_topology) : Type ≝ { cr:> continuous_relation_setoid S T; C1: ∀b,c. extS ?? cr (b ↓ c) = ext ?? cr b ↓ ext ?? cr c; diff --git a/helm/software/matita/contribs/formal_topology/overlap/subsets.ma b/helm/software/matita/contribs/formal_topology/overlap/subsets.ma new file mode 100644 index 000000000..17128ae6a --- /dev/null +++ b/helm/software/matita/contribs/formal_topology/overlap/subsets.ma @@ -0,0 +1,139 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +include "logic/cprop_connectives.ma". +include "categories.ma". + +record powerset_carrier (A: SET) : Type1 ≝ { mem_operator: unary_morphism1 A CPROP }. + +definition subseteq_operator: ∀A: SET. powerset_carrier A → powerset_carrier A → CProp2 ≝ + λA:SET.λU,V.∀a:A. mem_operator ? U a → mem_operator ? V a. + +theorem transitive_subseteq_operator: ∀A. transitive2 ? (subseteq_operator A). + intros 6; intros 2; + apply s1; apply s; + assumption. +qed. + +definition powerset_setoid1: SET → SET1. + intros (T); + constructor 1; + [ apply (powerset_carrier T) + | constructor 1; + [ apply (λU,V. subseteq_operator ? U V ∧ subseteq_operator ? V U) + | simplify; intros; split; intros 2; assumption + | simplify; intros (x y H); cases H; split; assumption + | simplify; intros (x y z H H1); cases H; cases H1; split; + apply transitive_subseteq_operator; [1,4: apply y ] + assumption ]] +qed. + +interpretation "powerset" 'powerset A = (powerset_setoid1 A). + +interpretation "subset construction" 'subset \eta.x = + (mk_powerset_carrier _ (mk_unary_morphism1 _ CPROP x _)). + +definition mem: ∀A. binary_morphism1 A (Ω \sup A) CPROP. + intros; + constructor 1; + [ apply (λx,S. mem_operator ? S x) + | intros 5; + cases b; clear b; cases b'; clear b'; simplify; intros; + apply (trans1 ????? (prop11 ?? u ?? e)); + cases e1; whd in s s1; + split; intro; + [ apply s; assumption + | apply s1; assumption]] +qed. + +interpretation "mem" 'mem a S = (fun21 ___ (mem _) a S). + +definition subseteq: ∀A. binary_morphism1 (Ω \sup A) (Ω \sup A) CPROP. + intros; + constructor 1; + [ apply (λU,V. subseteq_operator ? U V) + | intros; + cases e; cases e1; + split; intros 1; + [ apply (transitive_subseteq_operator ????? s2); + apply (transitive_subseteq_operator ???? s1 s4) + | apply (transitive_subseteq_operator ????? s3); + apply (transitive_subseteq_operator ???? s s4) ]] +qed. + +interpretation "subseteq" 'subseteq U V = (fun21 ___ (subseteq _) U V). + +theorem subseteq_refl: ∀A.∀S:Ω \sup A.S ⊆ S. + intros 4; assumption. +qed. + +theorem subseteq_trans: ∀A.∀S1,S2,S3: Ω \sup A. S1 ⊆ S2 → S2 ⊆ S3 → S1 ⊆ S3. + intros; apply transitive_subseteq_operator; [apply S2] assumption. +qed. + +definition overlaps: ∀A. binary_morphism1 (Ω \sup A) (Ω \sup A) CPROP. + intros; + constructor 1; + [ apply (λA.λU,V:Ω \sup A.exT2 ? (λx:A.x ∈ U) (λx:A.x ∈ V)) + | intros; + constructor 1; intro; cases H; exists; [1,4: apply w] + [ apply (. #‡e); assumption + | apply (. #‡e1); assumption + | apply (. #‡(e \sup -1)); assumption; + | apply (. #‡(e1 \sup -1)); assumption]] +qed. + +interpretation "overlaps" 'overlaps U V = (fun21 ___ (overlaps _) U V). + +definition intersects: + ∀A. binary_morphism1 (Ω \sup A) (Ω \sup A) (Ω \sup A). + intros; + constructor 1; + [ apply rule (λU,V. {x | x ∈ U ∧ x ∈ V }); + intros; simplify; apply (.= (e‡#)‡(e‡#)); apply refl1; + | intros; + split; intros 2; simplify in f ⊢ %; + [ apply (. (#‡e)‡(#‡e1)); assumption + | apply (. (#‡(e \sup -1))‡(#‡(e1 \sup -1))); assumption]] +qed. + +interpretation "intersects" 'intersects U V = (fun21 ___ (intersects _) U V). + +definition union: + ∀A. binary_morphism1 (Ω \sup A) (Ω \sup A) (Ω \sup A). + intros; + constructor 1; + [ apply (λU,V. {x | x ∈ U ∨ x ∈ V }); + intros; simplify; apply (.= (e‡#)‡(e‡#)); apply refl1 + | intros; + split; intros 2; simplify in f ⊢ %; + [ apply (. (#‡e)‡(#‡e1)); assumption + | apply (. (#‡(e \sup -1))‡(#‡(e1 \sup -1))); assumption]] +qed. + +interpretation "union" 'union U V = (fun21 ___ (union _) U V). + +definition singleton: ∀A:setoid. unary_morphism1 A (Ω \sup A). + intros; constructor 1; + [ apply (λa:A.{b | eq ? a b}); unfold setoid1_of_setoid; simplify; + intros; simplify; + split; intro; + apply (.= e1); + [ apply e | apply (e \sup -1) ] + | unfold setoid1_of_setoid; simplify; + intros; split; intros 2; simplify in f ⊢ %; apply trans; + [ apply a |4: apply a'] try assumption; apply sym; assumption] +qed. + +interpretation "singleton" 'singl a = (fun11 __ (singleton _) a). \ No newline at end of file -- 2.39.2