1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 include "formal_topology/relations.ma".
16 include "formal_topology/o-algebra.ma".
18 definition POW': objs1 SET → OAlgebra.
19 intro A; constructor 1;
23 | apply big_intersects;
26 simplify; intros; apply (refl1 ? (eq1 CPROP));
27 | apply ({x | False});
28 simplify; intros; apply (refl1 ? (eq1 CPROP));
29 | intros; whd; intros; assumption
30 | intros; whd; split; assumption
31 | intros; apply transitive_subseteq_operator; [2: apply f; | skip | assumption]
32 | intros; cases f; exists [apply w] assumption
33 | intros; split; [ intros 4; apply (f ? f1 i); | intros 3; intro; apply (f i ? f1); ]
35 [ intros 4; apply f; exists; [apply i] assumption;
36 | intros 3; intros; cases f1; apply (f w a x); ]
38 | intros 3; constructor 1;
39 | intros; cases f; exists; [apply w]
41 | whd; intros; cases i; simplify; assumption]
42 | intros; split; intro;
43 [ (** screenshot "screen-pow". *) cases f; cases x1; exists [apply w1] exists [apply w] assumption;
44 | cases e; cases x; exists; [apply w1] [ assumption | exists; [apply w] assumption]]
45 | intros; intros 2; cases (f {(a)} ?);
46 [ exists; [apply a] [assumption | change with (a = a); apply refl1;]
47 | change in x1 with (a = w); change with (mem A a q); apply (. (x1‡#));
51 definition powerset_of_POW': ∀A.oa_P (POW' A) → Ω^A ≝ λA,x.x.
52 coercion powerset_of_POW'.
54 definition foo : ∀o1,o2:REL.carr1 (o1 ⇒_\r1 o2) → carr2 (setoid2_of_setoid1 (o1 ⇒_\r1 o2)) ≝ λo1,o2,x.x.
56 definition orelation_of_relation: ∀o1,o2:REL. o1 ⇒_\r1 o2 → (POW' o1) ⇒_\o2 (POW' o2).
60 | apply rule ((foo ?? c)⎻* );
61 | apply rule ((foo ?? c)* );
62 | apply rule ((foo ?? c)⎻);
63 | intros; split; intro;
64 [ intros 2; intros 2; apply (f y); exists[apply a] split; assumption;
65 | intros 2; change with (a ∈ q); cases f1; cases x; clear f1 x;
66 apply (f w f3); assumption; ]
67 | unfold foo; intros; split; intro;
68 [ intros 2; intros 2; apply (f x); exists [apply a] split; assumption;
69 | intros 2; change with (a ∈ q); cases f1; cases x; apply (f w f3); assumption;]
70 | intros; split; unfold foo; unfold image_coercion; simplify; intro; cases f; clear f;
71 [ cases x; cases x2; clear x x2; exists; [apply w1]
72 [ assumption | exists; [apply w] split; assumption]
73 | cases x1; cases x2; clear x1 x2; exists; [apply w1]
74 [ exists; [apply w] split; assumption;
78 lemma orelation_of_relation_preserves_equality:
79 ∀o1,o2:REL.∀t,t': o1 ⇒_\r1 o2.
80 t = t' → orelation_of_relation ?? t =_2 orelation_of_relation ?? t'.
81 intros; split; unfold orelation_of_relation; unfold foo; simplify;
82 change in e with (t =_2 t'); unfold image_coercion; apply (†e);
85 lemma minus_image_id : ∀o:REL.(foo ?? (id1 REL o))⎻ =_1 (id2 SET1 Ω^o).
86 unfold foo; intro o; intro; unfold minus_image; simplify; split; simplify; intros;
87 [ cases e; cases x; change with (a1 ∈ a); change in f with (a1 =_1 w);
88 apply (. f‡#); assumption;
89 | change in f with (a1 ∈ a); exists [ apply a1] split; try assumption;
90 change with (a1 =_1 a1); apply refl1;]
93 lemma star_image_id : ∀o:REL. (foo ?? (id1 REL o))* =_1 (id2 SET1 Ω^o).
94 unfold foo; intro o; intro; unfold star_image; simplify; split; simplify; intros;
95 [ change with (a1 ∈ a); apply f; change with (a1 =_1 a1); apply rule refl1;
96 | change in f1 with (a1 =_1 y); apply (. f1^-1‡#); apply f;]
99 lemma orelation_of_relation_preserves_identity:
100 ∀o1:REL. orelation_of_relation ?? (id1 ? o1) =_2 id2 OA (POW' o1).
102 (unfold orelation_of_relation; unfold OA; unfold foo; simplify);
103 [ apply (minus_star_image_id o1);
104 | apply (minus_image_id o1);
105 | apply (image_id o1);
106 | apply (star_image_id o1) ]
111 [ change with ((∀x. x ♮(id1 REL o1) a1→x∈a) → a1 ∈ a); intros;
112 apply (f a1); change with (a1 = a1); apply refl1;
113 | change with (a1 ∈ a → ∀x. x ♮(id1 REL o1) a1→x∈a); intros;
114 change in f1 with (x = a1); apply (. f1‡#); apply f;
115 | alias symbol "and" = "and_morphism".
116 change with ((∃y:o1.a1 ♮(id1 REL o1) y ∧ y∈a) → a1 ∈ a);
117 intro; cases e; clear e; cases x; clear x; change in f with (a1=w);
118 apply (. f‡#); apply f1;
119 | change with (a1 ∈ a → ∃y:o1.a1 ♮(id1 REL o1) y ∧ y∈a);
120 intro; exists; [apply a1]; split; [ change with (a1=a1); apply refl1; | apply f]
121 | change with ((∃x:o1.x ♮(id1 REL o1) a1∧x∈a) → a1 ∈ a);
122 intro; cases e; clear e; cases x; clear x; change in f with (w=a1);
123 apply (. f^-1‡#); apply f1;
124 | change with (a1 ∈ a → ∃x:o1.x ♮(id1 REL o1) a1∧x∈a);
125 intro; exists; [apply a1]; split; [ change with (a1=a1); apply refl1; | apply f]
126 | change with ((∀y.a1 ♮(id1 REL o1) y→y∈a) → a1 ∈ a); intros;
127 apply (f a1); change with (a1 = a1); apply refl1;
128 | change with (a1 ∈ a → ∀y.a1 ♮(id1 REL o1) y→y∈a); intros;
129 change in f1 with (a1 = y); apply (. f1^-1‡#); apply f;]
133 (* CSC: ???? forse un uncertain mancato *)
134 alias symbol "eq" = "setoid2 eq".
135 alias symbol "compose" = "category1 composition".
136 lemma orelation_of_relation_preserves_composition:
137 ∀o1,o2,o3:REL.∀F: o1 ⇒_\r1 o2.∀G: o2 ⇒_\r1 o3.
138 orelation_of_relation ?? (G ∘ F) =
139 comp2 OA ??? (orelation_of_relation ?? F) (orelation_of_relation ?? G).
140 intros; split; intro; split; whd; intro; whd in ⊢ (% → %); intros;
141 [ whd; intros; apply f; exists; [ apply x] split; assumption;
142 | cases f1; clear f1; cases x1; clear x1; apply (f w); assumption;
143 | cases e; cases x; cases f; cases x1; clear e x f x1; exists; [ apply w1 ]
144 split; [ assumption | exists; [apply w] split; assumption ]
145 | cases e; cases x; cases f1; cases x1; clear e x f1 x1; exists; [apply w1 ]
146 split; [ exists; [apply w] split; assumption | assumption ]
147 | unfold arrows1_of_ORelation_setoid;
148 cases e; cases x; cases f; cases x1; clear e x f x1; exists; [ apply w1 ]
149 split; [ assumption | exists; [apply w] split; assumption ]
150 | unfold arrows1_of_ORelation_setoid in e;
151 cases e; cases x; cases f1; cases x1; clear e x f1 x1; exists; [apply w1 ]
152 split; [ exists; [apply w] split; assumption | assumption ]
153 | whd; intros; apply f; exists; [ apply y] split; assumption;
154 | cases f1; clear f1; cases x; clear x; apply (f w); assumption;]
157 definition POW: carr3 (arrows3 CAT2 (category2_of_category1 REL) OA).
160 | intros; constructor 1;
161 [ apply (orelation_of_relation S T);
162 | intros; apply (orelation_of_relation_preserves_equality S T a a' e); ]
163 | apply orelation_of_relation_preserves_identity;
164 | apply orelation_of_relation_preserves_composition; ]
167 theorem POW_faithful: faithful2 ?? POW.
168 intros 5; unfold POW in e; simplify in e; cases e;
169 unfold orelation_of_relation in e3; simplify in e3; clear e e1 e2 e4;
170 intros 2; simplify; unfold image_coercion in e3; cases (e3 {(x)});
171 split; intro; [ lapply (s y); | lapply (s1 y); ]
172 [2,4: exists; [1,3:apply x] split; [1,3: assumption |*: change with (x=x); apply rule #]
173 |*: cases Hletin; cases x1; change in f3 with (x =_1 w); apply (. f3‡#); assumption;]
178 lemma currify: ∀A,B,C. (A × B ⇒_1 C) → A → (B ⇒_1 C).
179 intros; constructor 1; [ apply (b c); | intros; apply (#‡e);]
183 include "formal_topology/notation.ma".
185 theorem POW_full: full2 ?? POW.
186 intros 3 (S T); exists;
187 [ constructor 1; constructor 1;
188 [ apply (λx:carr S.λy:carr T. y ∈ f {(x)});
189 | apply hide; intros; unfold FunClass_1_OF_carr2; lapply (.= e1‡#);
190 [4: apply mem; |6: apply Hletin;|1,2,3,5: skip]
191 lapply (#‡prop11 ?? f ?? (†e)); [6: apply Hletin; |*:skip ]]
192 | (split; intro; split; simplify);
194 whd; split; whd; intro; simplify; unfold map_arrows2; simplify;
196 [ change with (∀a1.(∀x. a1 ∈ (f {(x):S}) → x ∈ a) → a1 ∈ f⎻* a);
197 | change with (∀a1.a1 ∈ f⎻* a → (∀x.a1 ∈ f {(x):S} → x ∈ a));
198 | alias symbol "and" (instance 4) = "and_morphism".
199 change with (∀a1.(∃y:carr T. y ∈ f {(a1):S} ∧ y ∈ a) → a1 ∈ f⎻ a);
200 | alias symbol "and" (instance 2) = "and_morphism".
201 change with (∀a1.a1 ∈ f⎻ a → (∃y:carr T.y ∈ f {(a1):S} ∧ y ∈ a));
202 | alias symbol "and" (instance 3) = "and_morphism".
203 change with (∀a1.(∃x:carr S. a1 ∈ f {(x):S} ∧ x ∈ a) → a1 ∈ f a);
204 | change with (∀a1.a1 ∈. f a → (∃x:carr S. a1 ∈ f {(x):S} ∧ x ∈ a));
205 | change with (∀a1.(∀y. y ∈ f {(a1):S} → y ∈ a) → a1 ∈ f* a);
206 | change with (∀a1.a1 ∈ f* a → (∀y. y ∈ f {(a1):S} → y ∈ a)); ]
207 [ intros; apply ((. (or_prop2 ?? f (singleton ? a1) a)^-1) ? a1);
208 [ intros 2; apply (f1 a2); change in f2 with (a2 ∈ f⎻ (singleton ? a1));
209 lapply (. (or_prop3 ?? f (singleton ? a2) (singleton ? a1)));
210 [ cases Hletin; change in x1 with (eq1 ? a1 w);
211 apply (. x1‡#); assumption;
212 | exists; [apply a2] [change with (a2=a2); apply rule #; | assumption]]
213 | change with (a1 = a1); apply rule #; ]
214 | intros; apply ((. (or_prop2 ?? f (singleton ? a1) a)) ? x);
215 [ intros 2; change in f3 with (eq1 ? a1 a2); change with (a2 ∈ f⎻* a); apply (. f3^-1‡#);
217 | lapply (. (or_prop3 ?? f (singleton ? x) (singleton ? a1))^-1);
218 [ cases Hletin; change in x1 with (eq1 ? x w);
219 change with (x ∈ f⎻ (singleton ? a1)); apply (. x1‡#); assumption;
220 | exists; [apply a1] [assumption | change with (a1=a1); apply rule #; ]]]
221 | intros; cases e; cases x; clear e x;
222 lapply (. (or_prop3 ?? f (singleton ? a1) a)^-1);
223 [ cases Hletin; change in x with (eq1 ? a1 w1); apply (. x‡#); assumption;
224 | exists; [apply w] assumption ]
225 | intros; lapply (. (or_prop3 ?? f (singleton ? a1) a));
226 [ cases Hletin; exists; [apply w] split; assumption;
227 | exists; [apply a1] [change with (a1=a1); apply rule #; | assumption ]]
228 | intros; cases e; cases x; clear e x;
229 apply (f_image_monotone ?? f (singleton ? w) a ? a1);
230 [ intros 2; change in f3 with (eq1 ? w a2); change with (a2 ∈ a);
231 apply (. f3^-1‡#); assumption;
233 | intros; lapply (. (or_prop3 ?? f a (singleton ? a1))^-1);
234 [ cases Hletin; exists; [apply w] split;
235 [ lapply (. (or_prop3 ?? f (singleton ? w) (singleton ? a1)));
236 [ cases Hletin1; change in x3 with (eq1 ? a1 w1); apply (. x3‡#); assumption;
237 | exists; [apply w] [change with (w=w); apply rule #; | assumption ]]
239 | exists; [apply a1] [ assumption; | change with (a1=a1); apply rule #;]]
240 | intros; apply ((. (or_prop1 ?? f (singleton ? a1) a)^-1) ? a1);
241 [ apply f1; | change with (a1=a1); apply rule #; ]
242 | intros; apply ((. (or_prop1 ?? f (singleton ? a1) a)) ? y);
243 [ intros 2; change in f3 with (eq1 ? a1 a2); change with (a2 ∈ f* a);
244 apply (. f3^-1‡#); assumption;