]> matita.cs.unibo.it Git - helm.git/blob - helm/software/matita/nlibrary/topology/igft.ma
initial and incomplete port of the old demo about inductively generated formal
[helm.git] / helm / software / matita / nlibrary / topology / igft.ma
1 include "logic/connectives.ma".
2
3 nrecord powerset (X : Type[0]) : Type[1] ≝ { char : X → CProp[0] }.
4
5 interpretation "char" 'subset p = (mk_powerset ? p).  
6
7 interpretation "pwset" 'powerset a = (powerset a). 
8
9 interpretation "in" 'mem a X = (char ? X a). 
10
11 ndefinition subseteq ≝ λA.λU,V : Ω^A. 
12   ∀x.x ∈ U → x ∈ V.
13
14 interpretation "subseteq" 'subseteq u v = (subseteq ? u v).
15
16 ndefinition overlaps ≝ λA.λU,V : Ω^A. 
17   ∃x.x ∈ U ∧ x ∈ V.
18
19 interpretation "overlaps" 'overlaps u v = (overlaps ? u v).
20 (*
21 ndefinition intersect ≝ λA.λu,v:Ω\sup A.{ y | y ∈ u ∧ y ∈ v }.
22
23 interpretation "intersect" 'intersects u v = (intersect ? u v). 
24 *)
25 nrecord axiom_set : Type[1] ≝ { 
26   S:> Type[0];
27   I: S → Type[0];
28   C: ∀a:S. I a → Ω ^ S
29 }.
30
31 ndefinition cover_set ≝ λc:∀A:axiom_set.Ω^A → A → CProp[0].λA,C,U.
32   ∀y.y ∈ C → c A U y.
33
34 notation "hvbox(a break ◃ b)" non associative with precedence 45
35 for @{ 'covers $a $b }. (* a \ltri b *)
36
37 interpretation "covers set temp" 'covers C U = (cover_set ?? C U).
38
39 ninductive cover (A : axiom_set) (U : Ω^A) : A → CProp[0] ≝ 
40 | creflexivity : ∀a:A. a ∈ U → cover ? U a
41 | cinfinity    : ∀a:A. ∀i:I ? a. (C ? a i ◃ U) → cover ? U a.
42 napply cover;
43 nqed.
44
45 interpretation "covers" 'covers a U = (cover ? U a).
46 interpretation "covers set" 'covers a U = (cover_set cover ? a U).
47
48 ndefinition fish_set ≝ λf:∀A:axiom_set.Ω^A → A → CProp[0].
49  λA,U,V.
50   ∃a.a ∈ V ∧ f A U a.
51
52 notation "hvbox(a break ⋉ b)" non associative with precedence 45
53 for @{ 'fish $a $b }. (* a \ltimes b *)
54
55 interpretation "fish set temp" 'fish A U = (fish_set ?? U A).
56
57 ncoinductive fish (A : axiom_set) (F : Ω^A) : A → CProp[0] ≝ 
58 | cfish : ∀a. a ∈ F → (∀i:I ? a.C A a i ⋉ F) → fish A F a.
59 napply fish;
60 nqed.
61
62 interpretation "fish set" 'fish A U = (fish_set fish ? U A).
63 interpretation "fish" 'fish a U = (fish ? U a).
64
65 nlet corec fish_rec (A:axiom_set) (U: Ω^A)
66  (P: Ω^A) (H1: P ⊆ U)
67   (H2: ∀a:A. a ∈ P → ∀j: I ? a. C ? a j ≬ P):
68    ∀a:A. ∀p: a ∈ P. a ⋉ U ≝ ?.
69 #a; #p; napply cfish;
70 ##[ napply H1; napply p;
71 ##| #i; ncases (H2 a p i); #x; *; #xC; #xP; napply ex_intro; ##[napply x]
72     napply conj; ##[ napply xC ] napply (fish_rec ? U P); nassumption;
73 ##]
74 nqed.
75
76 STOP
77
78 theorem reflexivity: ∀A:axiom_set.∀a:A.∀V. a ∈ V → a ◃ V.
79  intros;
80  apply refl;
81  assumption.
82 qed.
83
84 theorem transitivity: ∀A:axiom_set.∀a:A.∀U,V. a ◃ U → U ◃ V → a ◃ V.
85  intros;
86  apply (covers_elim ?? {a | a ◃ V} ??? H); simplify; intros;
87   [ cases H1 in H2; apply H2;
88   | apply infinity;
89      [ assumption
90      | constructor 1;
91        assumption]]
92 qed.
93
94 theorem covers_elim2:
95  ∀A: axiom_set. ∀U:Ω \sup A.∀P: A → CProp.
96   (∀a:A. a ∈ U → P a) →
97    (∀a:A.∀V:Ω \sup A. a ◃ V → V ◃ U → (∀y. y ∈ V → P y) → P a) →
98      ∀a:A. a ◃ U → P a.
99  intros;
100  change with (a ∈ {a | P a});
101  apply (covers_elim ?????? H2);
102   [ intros 2; simplify; apply H; assumption
103   | intros;
104     simplify in H4 ⊢ %;
105     apply H1;
106      [ apply (C ? a1 j);
107      | autobatch; 
108      | assumption;
109      | assumption]]
110 qed.
111
112 theorem coreflexivity: ∀A:axiom_set.∀a:A.∀V. a ⋉ V → a ∈ V.
113  intros;
114  cases H;
115  assumption.
116 qed.
117
118 theorem cotransitivity:
119  ∀A:axiom_set.∀a:A.∀U,V. a ⋉ U → (∀b:A. b ⋉ U → b ∈ V) → a ⋉ V.
120  intros;
121  apply (fish_rec ?? {a|a ⋉ U} ??? H); simplify; intros;
122   [ apply H1; apply H2;
123   | cases H2 in j; clear H2; intro i;
124     cases (H4 i); clear H4; exists[apply a3] assumption]
125 qed.
126
127 theorem compatibility: ∀A:axiom_set.∀a:A.∀U,V. a ⋉ V → a ◃ U → U ⋉ V.
128  intros;
129  generalize in match H; clear H; 
130  apply (covers_elim ?? {a|a ⋉ V → U ⋉ V} ??? H1);
131  clear H1; simplify; intros;
132   [ exists [apply x] assumption
133   | cases H2 in j H H1; clear H2 a1; intros; 
134     cases (H1 i); clear H1; apply (H3 a1); assumption]
135 qed.
136
137 definition leq ≝ λA:axiom_set.λa,b:A. a ◃ {y|b=y}.
138
139 interpretation "covered by one" 'leq a b = (leq ? a b).
140
141 theorem leq_refl: ∀A:axiom_set.∀a:A. a ≤ a.
142  intros;
143  apply refl;
144  normalize;
145  reflexivity.
146 qed.
147
148 theorem leq_trans: ∀A:axiom_set.∀a,b,c:A. a ≤ b → b ≤ c → a ≤ c.
149  intros;
150  unfold in H H1 ⊢ %;
151  apply (transitivity ???? H);
152  constructor 1;
153  intros;
154  normalize in H2;
155  rewrite < H2;
156  assumption.
157 qed.
158
159 definition uparrow ≝ λA:axiom_set.λa:A.mk_powerset ? (λb:A. a ≤ b).
160
161 interpretation "uparrow" 'uparrow a = (uparrow ? a).
162
163 definition downarrow ≝ λA:axiom_set.λU:Ω \sup A.mk_powerset ? (λa:A. (↑a) ≬ U).
164
165 interpretation "downarrow" 'downarrow a = (downarrow ? a).
166
167 definition fintersects ≝ λA:axiom_set.λU,V:Ω \sup A.↓U ∩ ↓V.
168
169 interpretation "fintersects" 'fintersects U V = (fintersects ? U V).
170
171 record convergent_generated_topology : Type ≝
172  { AA:> axiom_set;
173    convergence: ∀a:AA.∀U,V:Ω \sup AA. a ◃ U → a ◃ V → a ◃ (U ↓ V)
174  }.