X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fmatita%2Flibrary%2Fdemo%2Fformal_topology.ma;h=190e00e5d0eb549e6822d06c0e72fc6d9efe18a4;hb=7a29aa43eb607d019699f0a76dc83e7093e5b222;hp=54c6aa629e0edc819f05b62d54f8f964b806c32d;hpb=839d7d2a1c009f20318a9cbdedd99e95d11d3e74;p=helm.git diff --git a/helm/software/matita/library/demo/formal_topology.ma b/helm/software/matita/library/demo/formal_topology.ma index 54c6aa629..190e00e5d 100644 --- a/helm/software/matita/library/demo/formal_topology.ma +++ b/helm/software/matita/library/demo/formal_topology.ma @@ -12,26 +12,169 @@ (* *) (**************************************************************************) -include "logic/connectives.ma". +include "logic/equality.ma". +include "logic/cprop_connectives.ma". -coinductive fish (A:Type) (i: A → Type) (C: ∀a:A.i a → A → Prop) (U: A → Prop) - : A → Prop -≝ - mk_foo: ∀a:A. (U a ∧ ∀j: i a. ∃y: A. C a j y ∧ fish A i C U y) → fish A i C U a. +record powerset (A : Type) : Type ≝ { char : A → CProp }. -let corec fish_rec (A:Type) (i: A → Type) (C: ∀a:A.i a → A → Prop) (U: A → Prop) - (P: A → Prop) (H1: ∀a:A. P a → U a) - (H2: ∀a:A. P a → ∀j: i a. ∃y: A. C a j y ∧ P y) : - ∀a:A. ∀p: P a. fish A i C U a ≝ +interpretation "char" 'subset p = (mk_powerset _ p). + +interpretation "pwset" 'powerset a = (powerset a). + +interpretation "in" 'mem a X = (char _ X a). + +definition subseteq ≝ λA.λu,v:\Omega \sup A.∀x.x ∈ u → x ∈ v. + +interpretation "subseteq" 'subseteq u v = (subseteq _ u v). + +definition overlaps ≝ λA.λU,V : Ω \sup A. exT2 ? (λx.x ∈ U) (λx.x ∈ V). + +interpretation "overlaps" 'overlaps u v = (overlaps _ u v). + +definition intersect ≝ λA.λu,v:Ω\sup A.{ y | y ∈ u ∧ y ∈ v }. + +interpretation "intersect" 'intersects u v = (intersect _ u v). + +record axiom_set : Type ≝ { + A:> Type; + i: A → Type; + C: ∀a:A. i a → Ω \sup A +}. + +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. + +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. 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 }. (* a \ltri b *) + +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: \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 + match q return λ_:(C ? a j) ◃ U. C ? a j ⊆ P with + [ iter f ⇒ λb.λr. aux b (f b r) ]] + in + aux. + +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 }. (* a \ltimes b *) + +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: \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_foo A i C U a - (conj ? ? (H1 ? p) - (λj: i a. + mk_fish A U a + (H1 ? p) + (λj: i ? a. match H2 a p j with - [ ex_intro (y: A) (Ha: C a j y ∧ P y) ⇒ - match Ha with - [ conj (fHa: C a j y) (sHa: P y) ⇒ - ex_intro A (λy.C a j y ∧ fish A i C U y) y - (conj ? ? fHa (fish_rec A i C U P H1 H2 y sHa)) - ] - ])). \ No newline at end of file + [ 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; + apply refl; + assumption. +qed. + +theorem transitivity: ∀A:axiom_set.∀a:A.∀U,V. a ◃ U → U ◃ V → a ◃ V. + intros; + apply (covers_elim ?? {a | a ◃ V} ??? H); simplify; intros; + [ cases H1 in H2; apply H2; + | apply infinity; + [ assumption + | constructor 1; + assumption]] +qed. + +theorem coreflexivity: ∀A:axiom_set.∀a:A.∀V. a ⋉ V → a ∈ V. + intros; + cases H; + 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 ?? {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; + apply (covers_elim ?? {a|a ⋉ V → U ⋉ V} ??? H1); + clear H1; simplify; intros; + [ exists [apply x] assumption + | cases H2 in j H H1; clear H2 a1; intros; + cases (H1 i); clear H1; apply (H3 a1); assumption] +qed. + +definition leq ≝ λA:axiom_set.λa,b:A. a ◃ {y|b=y}. + +interpretation "covered by one" 'leq a b = (leq _ a b). + +theorem leq_refl: ∀A:axiom_set.∀a:A. a ≤ a. + intros; + apply refl; + normalize; + reflexivity. +qed. + +theorem leq_trans: ∀A:axiom_set.∀a,b,c:A. a ≤ b → b ≤ c → a ≤ c. + intros; + unfold in H H1 ⊢ %; + apply (transitivity ???? H); + constructor 1; + intros; + normalize in H2; + rewrite < H2; + assumption. +qed. + +definition uparrow ≝ λA:axiom_set.λa:A.mk_powerset ? (λb:A. a ≤ b). + +notation "↑a" with precedence 80 for @{ 'uparrow $a }. + +interpretation "uparrow" 'uparrow a = (uparrow _ a). + +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:Ω \sup A.↓U ∩ ↓V. + +interpretation "fintersects" 'fintersects U V = (fintersects _ U V). + +(* +record convergent_generated_topology : Type ≝ + { AA:> axiom_set; + convergence: ∀a:AA.∀U,V:Ω \sup AA. a ◃ U → a ◃ V → a ◃ (U ↓ V) + }. +*)