]> matita.cs.unibo.it Git - helm.git/blob - helm/software/matita/nlibrary/topology/igft.ma
...
[helm.git] / helm / software / matita / nlibrary / topology / igft.ma
1 include "sets/sets.ma".
2
3 nrecord Ax : Type[1] ≝ { 
4   S:> setoid; (* Type[0]; *)
5   I: S → Type[0];
6   C: ∀a:S. I a → Ω ^ S
7 }.
8
9 notation "𝐈  \sub( ❨a❩ )" non associative with precedence 70 for @{ 'I $a }.
10 notation "𝐂 \sub ( ❨a,\emsp i❩ )" non associative with precedence 70 for @{ 'C $a $i }.
11
12 notation > "𝐈 term 90 a" non associative with precedence 70 for @{ 'I $a }.
13 notation > "𝐂 term 90 a term 90 i" non associative with precedence 70 for @{ 'C $a $i }.
14
15 interpretation "I" 'I a = (I ? a).
16 interpretation "C" 'C a i = (C ? a i).
17
18 ndefinition cover_set ≝ λc:∀A:Ax.Ω^A → A → CProp[0].λA,C,U.
19   ∀y.y ∈ C → c A U y.
20
21 (* a \ltri b *)
22 notation "hvbox(a break ◃ b)" non associative with precedence 45
23 for @{ 'covers $a $b }.
24
25 interpretation "covers set temp" 'covers C U = (cover_set ?? C U).
26
27 ninductive cover (A : Ax) (U : Ω^A) : A → CProp[0] ≝ 
28 | creflexivity : ∀a:A. a ∈ U → cover ? U a
29 | cinfinity    : ∀a:A.∀i:𝐈 a. 𝐂 a i ◃ U → cover ? U a.
30 napply cover;
31 nqed.
32
33 interpretation "covers" 'covers a U = (cover ? U a).
34 interpretation "covers set" 'covers a U = (cover_set cover ? a U).
35
36 ndefinition fish_set ≝ λf:∀A:Ax.Ω^A → A → CProp[0].
37  λA,U,V.
38   ∃a.a ∈ V ∧ f A U a.
39
40 (* a \ltimes b *)
41 notation "hvbox(a break ⋉ b)" non associative with precedence 45
42 for @{ 'fish $a $b }. 
43
44 interpretation "fish set temp" 'fish A U = (fish_set ?? U A).
45
46 ncoinductive fish (A : Ax) (F : Ω^A) : A → CProp[0] ≝ 
47 | cfish : ∀a. a ∈ F → (∀i:𝐈 a .𝐂  a i ⋉ F) → fish A F a.
48 napply fish;
49 nqed.
50
51 interpretation "fish set" 'fish A U = (fish_set fish ? U A).
52 interpretation "fish" 'fish a U = (fish ? U a).
53
54 nlet corec fish_rec (A:Ax) (U: Ω^A)
55  (P: Ω^A) (H1: P ⊆ U)
56   (H2: ∀a:A. a ∈ P → ∀j: 𝐈 a. 𝐂 a j ≬ P):
57    ∀a:A. ∀p: a ∈ P. a ⋉ U ≝ ?.
58 #a; #p; napply cfish;
59 ##[ napply H1; napply p;
60 ##| #i; ncases (H2 a p i); #x; *; #xC; #xP; @; ##[napply x]
61     @; ##[ napply xC ] napply (fish_rec ? U P); nassumption;
62 ##]
63 nqed.
64
65 notation "◃U" non associative with precedence 55
66 for @{ 'coverage $U }.
67
68 ndefinition coverage : ∀A:Ax.∀U:Ω^A.Ω^A ≝ λA,U.{ a | a ◃ U }.
69
70 interpretation "coverage cover" 'coverage U = (coverage ? U).
71
72 ndefinition cover_equation : ∀A:Ax.∀U,X:Ω^A.CProp[0] ≝  λA,U,X. 
73   ∀a.a ∈ X ↔ (a ∈ U ∨ ∃i:𝐈 a.∀y.y ∈ 𝐂 a i → y ∈ X).  
74
75 ntheorem coverage_cover_equation : ∀A,U. cover_equation A U (◃U).
76 #A; #U; #a; @; #H;
77 ##[ nelim H; #b; (* manca clear *)
78     ##[ #bU; @1; nassumption;
79     ##| #i; #CaiU; #IH; @2; @ i; #c; #cCbi; ncases (IH ? cCbi);
80         ##[ #E; @; napply E;
81         ##| #_; napply CaiU; nassumption; ##] ##]
82 ##| ncases H; ##[ #E; @; nassumption]
83     *; #j; #Hj; @2 j; #w; #wC; napply Hj; nassumption;
84 ##]
85 nqed. 
86
87 ntheorem coverage_min_cover_equation : 
88   ∀A,U,W. cover_equation A U W → ◃U ⊆ W.
89 #A; #U; #W; #H; #a; #aU; nelim aU; #b;
90 ##[ #bU; ncases (H b); #_; #H1; napply H1; @1; nassumption;
91 ##| #i; #CbiU; #IH; ncases (H b); #_; #H1; napply H1; @2; @i; napply IH;
92 ##]
93 nqed.
94
95 notation "⋉F" non associative with precedence 55
96 for @{ 'fished $F }.
97
98 ndefinition fished : ∀A:Ax.∀F:Ω^A.Ω^A ≝ λA,F.{ a | a ⋉ F }.
99
100 interpretation "fished fish" 'fished F = (fished ? F).
101
102 ndefinition fish_equation : ∀A:Ax.∀F,X:Ω^A.CProp[0] ≝ λA,F,X.
103   ∀a. a ∈ X ↔ a ∈ F ∧ ∀i:𝐈 a.∃y.y ∈ 𝐂 a i ∧ y ∈ X. 
104   
105 ntheorem fised_fish_equation : ∀A,F. fish_equation A F (⋉F).
106 #A; #F; #a; @; (* bug, fare case sotto diverso da farlo sopra *) #H; ncases H;
107 ##[ #b; #bF; #H2; @ bF; #i; ncases (H2 i); #c; *; #cC; #cF; @c; @ cC;
108     napply cF;  
109 ##| #aF; #H1; @ aF; napply H1;
110 ##]
111 nqed.
112
113 ntheorem fised_max_fish_equation : ∀A,F,G. fish_equation A F G → G ⊆ ⋉F.
114 #A; #F; #G; #H; #a; #aG; napply (fish_rec … aG);
115 #b; ncases (H b); #H1; #_; #bG; ncases (H1 bG); #E1; #E2; nassumption; 
116 nqed. 
117
118 nrecord nAx : Type[2] ≝ { 
119   nS:> setoid; (*Type[0];*)
120   nI: nS → Type[0];
121   nD: ∀a:nS. nI a → Type[0];
122   nd: ∀a:nS. ∀i:nI a. nD a i → nS
123 }.
124
125 (*
126 TYPE f A → B, g : B → A, f ∘ g = id, g ∘ g = id.
127
128 a = b → I a = I b
129 *)
130
131 notation "𝐃 \sub ( ❨a,\emsp i❩ )" non associative with precedence 70 for @{ 'D $a $i }.
132 notation "𝐝 \sub ( ❨a,\emsp i,\emsp j❩ )" non associative with precedence 70 for @{ 'd $a $i $j}.
133
134 notation > "𝐃 term 90 a term 90 i" non associative with precedence 70 for @{ 'D $a $i }.
135 notation > "𝐝 term 90 a term 90 i term 90 j" non associative with precedence 70 for @{ 'd $a $i $j}.
136
137 interpretation "D" 'D a i = (nD ? a i).
138 interpretation "d" 'd a i j = (nd ? a i j).
139 interpretation "new I" 'I a = (nI ? a).
140
141 ndefinition image ≝ λA:nAx.λa:A.λi. { x | ∃j:𝐃 a i. x = 𝐝 a i j }.
142
143 notation > "𝐈𝐦  [𝐝 term 90 a term 90 i]" non associative with precedence 70 for @{ 'Im $a $i }.
144 notation "𝐈𝐦  [𝐝 \sub ( ❨a,\emsp i❩ )]" non associative with precedence 70 for @{ 'Im $a $i }.
145
146 interpretation "image" 'Im a i = (image ? a i).
147
148 ndefinition Ax_of_nAx : nAx → Ax.
149 #A; @ A (nI ?); #a; #i; napply (𝐈𝐦 [𝐝 a i]);
150 nqed.
151
152 ninductive sigma (A : Type[0]) (P : A → CProp[0]) : Type[0] ≝ 
153  sig_intro : ∀x:A.P x → sigma A P. 
154
155 interpretation "sigma" 'sigma \eta.p = (sigma ? p). 
156
157 ndefinition nAx_of_Ax : Ax → nAx.
158 #A; @ A (I ?);
159 ##[ #a; #i; napply (Σx:A.x ∈ 𝐂 a i);
160 ##| #a; #i; *; #x; #_; napply x;
161 ##]
162 nqed.
163
164 ninductive Ord (A : nAx) : Type[0] ≝ 
165  | oO : Ord A
166  | oS : Ord A → Ord A
167  | oL : ∀a:A.∀i.∀f:𝐃 a i → Ord A. Ord A.
168
169 notation "Λ term 90 f" non associative with precedence 50 for @{ 'oL $f }.
170 notation "x+1" non associative with precedence 50 for @{'oS $x }.
171
172 interpretation "ordinals Lambda" 'oL f = (oL ? ? ? f).
173 interpretation "ordinals Succ" 'oS x = (oS ? x).
174
175 nlet rec famU (A : nAx) (U : Ω^A) (x : Ord A) on x : Ω^A ≝ 
176   match x with
177   [ oO ⇒ U
178   | oS y ⇒ let Un ≝ famU A U y in Un ∪ { x | ∃i.𝐈𝐦[𝐝 x i] ⊆ Un} 
179   | oL a i f ⇒ { x | ∃j.x ∈ famU A U (f j) } ].
180   
181 notation < "term 90 U \sub (term 90 x)" non associative with precedence 50 for @{ 'famU $U $x }.
182 notation > "U ⎽ term 90 x" non associative with precedence 50 for @{ 'famU $U $x }.
183
184 interpretation "famU" 'famU U x = (famU ? U x).
185   
186 ndefinition ord_coverage : ∀A:nAx.∀U:Ω^A.Ω^A ≝ λA,U.{ y | ∃x:Ord A. y ∈ famU ? U x }.
187
188 ndefinition ord_cover_set ≝ λc:∀A:nAx.Ω^A → Ω^A.λA,C,U.
189   ∀y.y ∈ C → y ∈ c A U.
190
191 interpretation "coverage new cover" 'coverage U = (ord_coverage ? U).
192 interpretation "new covers set" 'covers a U = (ord_cover_set ord_coverage ? a U).
193 interpretation "new covers" 'covers a U = (mem ? (ord_coverage ? U) a).
194
195 ntheorem new_coverage_reflexive:
196   ∀A:nAx.∀U:Ω^A.∀a. a ∈ U → a ◃ U.
197 #A; #U; #a; #H; @ (oO A); napply H;
198 nqed.
199
200 nlemma ord_subset:
201   ∀A:nAx.∀a:A.∀i,f,U.∀j:𝐃 a i.U⎽(f j) ⊆ U⎽(Λ f).
202 #A; #a; #i; #f; #U; #j; #b; #bUf; @ j; nassumption;
203 nqed.
204
205 naxiom AC : ∀A,a,i,U.(∀j:𝐃 a i.∃x:Ord A.𝐝 a i j ∈ U⎽x) → (Σf.∀j:𝐃 a i.𝐝 a i j ∈ U⎽(f j)).
206
207 naxiom setoidification :
208   ∀A:nAx.∀a,b:A.∀U.a=b → b ∈ U → a ∈ U.
209
210 alias symbol "covers" = "new covers".
211 alias symbol "covers" = "new covers set".
212 alias symbol "covers" = "new covers".
213 ntheorem new_coverage_infinity:
214   ∀A:nAx.∀U:Ω^A.∀a:A. (∃i:𝐈 a. 𝐈𝐦[𝐝 a i] ◃ U) → a ◃ U.
215 #A; #U; #a; *; #i; #H; nnormalize in H;
216 ncut (∀y:𝐃 a i.∃x:Ord A.𝐝 a i y ∈ U⎽x); ##[
217   #y; napply H; @ y; napply #; ##] #H'; 
218 ncases (AC … H'); #f; #Hf;
219 ncut (∀j.𝐝 a i j ∈ U⎽(Λ f));
220   ##[ #j; napply (ord_subset … f … (Hf j));##] #Hf';
221 @ ((Λ f)+1); @2; nwhd; @i; #x; *; #d; #Hd; 
222 napply (setoidification … Hd); napply Hf';
223 nqed.
224
225 (* move away *)
226 nlemma subseteq_union: ∀A.∀U,V,W:Ω^A.U ⊆ W → V ⊆ W → U ∪ V ⊆ W.
227 #A; #U; #V; #W; #H; #H1; #x; *; #Hx; ##[ napply H; ##| napply H1; ##] nassumption;
228 nqed. 
229
230 nlemma new_coverage_min :  
231   ∀A:nAx.∀U:qpowerclass A.∀V.U ⊆ V → (∀a:A.∀i.𝐈𝐦[𝐝 a i] ⊆ V → a ∈ V) → ◃(pc ? U) ⊆ V.
232 #A; #U; #V; #HUV; #Im;  #b; *; #o; ngeneralize in match b; nchange with ((pc ? U)⎽o ⊆ V);
233 nelim o;
234 ##[ #b; #bU0; napply HUV; napply bU0;
235 ##| #p; #IH; napply subseteq_union; ##[ nassumption; ##]
236     #x; *; #i; #H; napply (Im ? i); napply (subseteq_trans … IH); napply H;
237 ##| #a; #i; #f; #IH; #x; *; #d; napply IH; ##]
238 nqed.
239
240 nlet rec famF (A: nAx) (F : Ω^A) (x : Ord A) on x : Ω^A ≝ 
241   match x with
242   [ oO ⇒ F
243   | oS o ⇒ let Fo ≝ famF A F o in Fo ∩ { x | ∀i:𝐈 x.∃j:𝐃 x i.𝐝 x i j ∈ Fo } 
244   | oL a i f ⇒ { x | ∀j:𝐃 a i.x ∈ famF A F (f j) }
245   ].
246
247 interpretation "famF" 'famU U x = (famF ? U x).
248
249 ndefinition ord_fished : ∀A:nAx.∀F:Ω^A.Ω^A ≝ λA,F.{ y | ∀x:Ord A. y ∈ F⎽x }.
250
251 interpretation "fished new fish" 'fished U = (ord_fished ? U).
252 interpretation "new fish" 'fish a U = (mem ? (ord_fished ? U) a).
253
254 ntheorem new_fish_antirefl:
255  ∀A:nAx.∀F:Ω^A.∀a. a ⋉ F → a ∈ F.
256 #A; #F; #a; #H; nlapply (H (oO ?)); #aFo; napply aFo;
257 nqed.
258
259 nlemma co_ord_subset:
260  ∀A:nAx.∀F:Ω^A.∀a,i.∀f:𝐃 a i → Ord A.∀j. F⎽(Λ f) ⊆ F⎽(f j).
261 #A; #F; #a; #i; #f; #j; #x; #H; napply H;
262 nqed.
263
264 naxiom AC_dual : 
265   ∀A:nAx.∀a:A.∀i,F. (∀f:𝐃 a i → Ord A.∃x:𝐃 a i.𝐝 a i x ∈ F⎽(f x)) → ∃j:𝐃 a i.∀x:Ord A.𝐝 a i j ∈ F⎽x.
266
267
268 ntheorem new_fish_compatible: 
269  ∀A:nAx.∀F:Ω^A.∀a. a ⋉ F → ∀i:𝐈 a.∃j:𝐃 a i.𝐝 a i j ⋉ F.
270 #A; #F; #a; #aF; #i; nnormalize;
271 napply AC_dual; #f;
272 nlapply (aF (Λf+1)); #aLf;
273 nchange in aLf with (a ∈ F⎽(Λ f) ∧ ∀i:𝐈 a.∃j:𝐃 a i.𝐝 a i j ∈ F⎽(Λ f));
274 ncut (∃j:𝐃 a i.𝐝 a i j ∈ F⎽(f j));##[
275   ncases aLf; #_; #H; nlapply (H i); *; #j; #Hj; @j; napply Hj;##] #aLf';
276 napply aLf';
277 nqed.
278
279 (* move away *)
280 nlemma subseteq_intersection_l: ∀A.∀U,V,W:Ω^A.U ⊆ W ∨ V ⊆ W → U ∩ V ⊆ W.
281 #A; #U; #V; #W; *; #H; #x; *; #xU; #xV; napply H; nassumption;
282 nqed.
283
284 nlemma subseteq_intersection_r: ∀A.∀U,V,W:Ω^A.W ⊆ U → W ⊆ V → W ⊆ U ∩ V.
285 #A; #U; #V; #W; #H1; #H2; #x; #Hx; @; ##[ napply H1; ##| napply H2; ##] nassumption;
286 nqed. 
287  
288 ntheorem max_new_fished: 
289   ∀A:nAx.∀G,F:Ω^A.G ⊆ F → (∀a.a ∈ G → ∀i.𝐈𝐦[𝐝 a i] ≬ G) → G ⊆ ⋉F.
290 #A; #G; #F; #GF; #H; #b; #HbG; #o; ngeneralize in match HbG; ngeneralize in match b;
291 nchange with (G ⊆ F⎽o);
292 nelim o;
293 ##[ napply GF;
294 ##| #p; #IH; napply (subseteq_intersection_r … IH);
295     #x; #Hx; #i; ncases (H … Hx i); #c; *; *; #d; #Ed; #cG;
296     @d; napply IH; napply (setoidification … Ed^-1); napply cG;   
297 ##| #a; #i; #f; #Hf; nchange with (G ⊆ { y | ∀x. y ∈ F⎽(f x) }); 
298     #b; #Hb; #d; napply (Hf d); napply Hb;
299 ##]
300 nqed.
301