X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fmatita%2Flibrary%2Fdemo%2Fformal_topology.ma;h=3814ac3f1d138c77f5638ce922c34424ee9fe3b9;hb=924e5de699b84c18d438df639ebb1efe094c39a1;hp=50671aa41afa50e12f3c3ebfdc6e18e5424e21e5;hpb=d57b04c45c3dafa7b56a3dc2019c2ab0de730406;p=helm.git diff --git a/helm/software/matita/library/demo/formal_topology.ma b/helm/software/matita/library/demo/formal_topology.ma index 50671aa41..3814ac3f1 100644 --- a/helm/software/matita/library/demo/formal_topology.ma +++ b/helm/software/matita/library/demo/formal_topology.ma @@ -12,91 +12,65 @@ (* *) (**************************************************************************) -include "logic/equality.ma". +include "datatypes/subsets.ma". -inductive And (A,B:CProp) : CProp ≝ - conj: A → B → And A B. - -interpretation "constructive and" 'and x y = (And x y). +record axiom_set : Type ≝ { + A:> Type; + i: A → Type; + C: ∀a:A. i a → Ω \sup A +}. -inductive exT (A:Type) (P:A→CProp) : CProp ≝ - ex_introT: ∀w:A. P w → exT A P. +inductive for_all (A: axiom_set) (U,V: Ω \sup A) (covers: A → CProp) : CProp ≝ + iter: (∀a:A.a ∈ V → covers a) → for_all A U V covers. -interpretation "CProp exists" 'exists \eta.x = (exT _ x). - -record powerset (A: Type) : Type ≝ { char: A → CProp }. - -notation "hvbox(2 \sup A)" non associative with precedence 45 -for @{ 'powerset $A }. - -interpretation "powerset" 'powerset A = (powerset A). - -definition mem ≝ λA.λS:2 \sup A.λx:A. match S with [mk_powerset c ⇒ c x]. - -notation "hvbox(a break ∈ b)" non associative with precedence 45 -for @{ 'mem $a $b }. - -interpretation "mem" 'mem a S = (mem _ S a). - -record axiom_set : Type ≝ - { A:> Type; - i: A → Type; - C: ∀a:A. i a → 2 \sup A - }. - -inductive covers (A: axiom_set) (U: 2 \sup A) : A → CProp ≝ +inductive covers (A: axiom_set) (U: \Omega \sup A) : A → CProp ≝ refl: ∀a:A. a ∈ U → covers A U a - | infinity: ∀a:A. ∀j: i ? a. coversl A U (C ? a j) → covers A U a -with coversl : (2 \sup A) → CProp ≝ - iter: ∀V:2 \sup A.(∀a:A.a ∈ V → covers A U a) → coversl A U V. + | infinity: ∀a:A. ∀j: i ? a. for_all A U (C ? a j) (covers A U) → covers A U a. notation "hvbox(a break ◃ b)" non associative with precedence 45 -for @{ 'covers $a $b }. +for @{ 'covers $a $b }. (* a \ltri b *) -interpretation "coversl" 'covers A U = (coversl _ U A). +interpretation "coversl" 'covers A U = (for_all _ U A (covers _ U)). interpretation "covers" 'covers a U = (covers _ U a). definition covers_elim ≝ - λA:axiom_set.λU: 2 \sup A.λP:2 \sup A. - λH1:∀a:A. a ∈ U → a ∈ P. - λH2:∀a:A.∀j:i ? a. C ? a j ◃ U → (∀b. b ∈ C ? a j → b ∈ P) → a ∈ P. + λA:axiom_set.λU: \Omega \sup A.λP:\Omega \sup A. + λH1: U ⊆ P. + λH2:∀a:A.∀j:i ? a. C ? a j ◃ U → C ? a j ⊆ P → a ∈ P. let rec aux (a:A) (p:a ◃ U) on p : a ∈ P ≝ match p return λaa.λ_:aa ◃ U.aa ∈ P with [ refl a q ⇒ H1 a q - | infinity a j q ⇒ H2 a j q (auxl (C ? a j) q) - ] - and auxl (V: 2 \sup A) (q: V ◃ U) on q : ∀b. b ∈ V → b ∈ P ≝ - match q return λVV.λ_:VV ◃ U.∀b. b ∈ VV → b ∈ P with - [ iter VV f ⇒ λb.λr. aux b (f b r) ] + | infinity a j q ⇒ + H2 a j q + match q return λ_:(C ? a j) ◃ U. C ? a j ⊆ P with + [ iter f ⇒ λb.λr. aux b (f b r) ]] in aux. -coinductive fish (A:axiom_set) (U: 2 \sup A) : A → CProp ≝ - mk_fish: ∀a:A. (a ∈ U ∧ ∀j: i ? a. ∃y: A. y ∈ C ? a j ∧ fish A U y) → fish A U a. -definition fishl ≝ λA:axiom_set.λU:2 \sup A.λV:2 \sup A. ∃a. a ∈ V ∧ fish ? U a. +inductive ex_such (A : axiom_set) (U,V : \Omega \sup A) (fish: A → CProp) : CProp ≝ + found : ∀a. a ∈ V → fish a → ex_such A U V fish. + +coinductive fish (A:axiom_set) (U: \Omega \sup A) : A → CProp ≝ + mk_fish: ∀a:A. a ∈ U → (∀j: i ? a. ex_such A U (C ? a j) (fish A U)) → fish A U a. notation "hvbox(a break ⋉ b)" non associative with precedence 45 -for @{ 'fish $a $b }. +for @{ 'fish $a $b }. (* a \ltimes b *) -interpretation "fishl" 'fish A U = (fishl _ U A). +interpretation "fishl" 'fish A U = (ex_such _ U A (fish _ U)). interpretation "fish" 'fish a U = (fish _ U a). -let corec fish_rec (A:axiom_set) (U: 2 \sup A) - (P: 2 \sup A) (H1: ∀a:A. a ∈ P → a ∈ U) - (H2: ∀a:A. a ∈ P → ∀j: i ? a. ∃y: A. y ∈ C ? a j ∧ y ∈ P) : +let corec fish_rec (A:axiom_set) (U: \Omega \sup A) + (P: Ω \sup A) (H1: P ⊆ U) + (H2: ∀a:A. a ∈ P → ∀j: i ? a. C ? a j ≬ P): ∀a:A. ∀p: a ∈ P. a ⋉ U ≝ λa,p. mk_fish A U a - (conj ? ? (H1 ? p) + (H1 ? p) (λj: i ? a. match H2 a p j with - [ ex_introT (y: A) (Ha: y ∈ C ? a j ∧ y ∈ P) ⇒ - match Ha with - [ conj (fHa: y ∈ C ? a j) (sHa: y ∈ P) ⇒ - ex_introT A (λy.y ∈ C ? a j ∧ fish A U y) y - (conj ? ? fHa (fish_rec A U P H1 H2 y sHa)) - ] - ])). + [ ex_introT2 (y: A) (HyC : y ∈ C ? a j) (HyP : y ∈ P) ⇒ + found ???? y HyC (fish_rec A U P H1 H2 y HyP) + ]). theorem reflexivity: ∀A:axiom_set.∀a:A.∀V. a ∈ V → a ◃ V. intros; @@ -106,11 +80,8 @@ qed. theorem transitivity: ∀A:axiom_set.∀a:A.∀U,V. a ◃ U → U ◃ V → a ◃ V. intros; - apply (covers_elim ?? (mk_powerset A (λa.a ◃ V)) ??? H); simplify; intros; - [ cases H1 in H2; - intro; - apply H2; - assumption + apply (covers_elim ?? {a | a ◃ V} ??? H); simplify; intros; + [ cases H1 in H2; apply H2; | apply infinity; [ assumption | constructor 1; @@ -120,41 +91,28 @@ qed. theorem coreflexivity: ∀A:axiom_set.∀a:A.∀V. a ⋉ V → a ∈ V. intros; cases H; - cases H1; assumption. qed. theorem cotransitivity: ∀A:axiom_set.∀a:A.∀U,V. a ⋉ U → (∀b:A. b ⋉ U → b ∈ V) → a ⋉ V. intros; - apply (fish_rec ?? (mk_powerset A (λa.a ⋉ U)) ??? H); simplify; intros; - [ apply H1; - assumption - | cases H2 in j; clear H2; cases H3; clear H3; - assumption] + apply (fish_rec ?? {a|a ⋉ U} ??? H); simplify; intros; + [ apply H1; apply H2; + | cases H2 in j; clear H2; intro i; + cases (H4 i); clear H4; exists[apply a3] assumption] qed. theorem compatibility: ∀A:axiom_set.∀a:A.∀U,V. a ⋉ V → a ◃ U → U ⋉ V. intros; - generalize in match H; clear H; generalize in match V; clear V; - apply (covers_elim ?? (mk_powerset A (λa.∀p:2 \sup A.a ⋉ p → U ⋉ p)) ??? H1); + generalize in match H; clear H; + apply (covers_elim ?? {a|a ⋉ V → U ⋉ V} ??? H1); clear H1; simplify; intros; - [ exists [apply a1] - split; - assumption - | cases H2 in j H H1; clear H2 a1; intros; - cases H; clear H; - cases (H4 i); clear H4; cases H; clear H; - apply (H2 w); clear H2; - assumption] + [ exists [apply a1] assumption + | cases H2 in j H H1; clear H2 a1; intros; + cases (H1 i); clear H1; apply (H3 a1); assumption] qed. -definition singleton ≝ λA:axiom_set.λa:A.mk_powerset ? (λb:A.a=b). - -notation "hvbox({ term 19 a })" with precedence 90 for @{ 'singl $a}. - -interpretation "singleton" 'singl a = (singleton _ a). - definition leq ≝ λA:axiom_set.λa,b:A. a ◃ {b}. interpretation "covered by one" 'leq a b = (leq _ a b). @@ -183,27 +141,13 @@ notation "↑a" with precedence 80 for @{ 'uparrow $a }. interpretation "uparrow" 'uparrow a = (uparrow _ a). -definition overlaps ≝ λA:Type.λU,V:2 \sup A.∃a:A. a ∈ U ∧ a ∈ V. - -notation "hvbox(a break ≬ b)" non associative with precedence 45 -for @{ 'overlaps $a $b }. - -interpretation "overlaps" 'overlaps U V = (overlaps _ U V). - -definition intersects ≝ λA:Type.λU,V:2 \sup A.mk_powerset ? (λa:A. a ∈ U ∧ a ∈ V). - -notation "hvbox(a break ∩ b)" non associative with precedence 55 -for @{ 'intersects $a $b }. - -interpretation "intersects" 'intersects U V = (intersects _ U V). - -definition downarrow ≝ λA:axiom_set.λU:2 \sup A.mk_powerset ? (λa:A. ↑a ≬ U). +definition downarrow ≝ λA:axiom_set.λU:Ω \sup A.mk_powerset ? (λa:A. ↑a ≬ U). notation "↓a" with precedence 80 for @{ 'downarrow $a }. interpretation "downarrow" 'downarrow a = (downarrow _ a). -definition fintersects ≝ λA:axiom_set.λU,V:2 \sup A.↓U ∩ ↓V. +definition fintersects ≝ λA:axiom_set.λU,V:Ω \sup A.↓U ∩ ↓V. notation "hvbox(U break ↓ V)" non associative with precedence 80 for @{ 'fintersects $U $V }. @@ -211,6 +155,6 @@ interpretation "fintersects" 'fintersects U V = (fintersects _ U V). record convergent_generated_topology : Type ≝ { AA:> axiom_set; - convergence: ∀a:AA.∀U,V:2 \sup AA. a ◃ U → a ◃ V → a ◃ U ↓ V + convergence: ∀a:AA.∀U,V:Ω \sup AA. a ◃ U → a ◃ V → a ◃ U ↓ V }.