|
1 (* Title: HOL/Cardinals/Wellorder_Embedding_LFP.thy |
|
2 Author: Andrei Popescu, TU Muenchen |
|
3 Copyright 2012 |
|
4 |
|
5 Well-order embeddings (LFP). |
|
6 *) |
|
7 |
|
8 header {* Well-Order Embeddings (LFP) *} |
|
9 |
|
10 theory Wellorder_Embedding_LFP |
|
11 imports "~~/src/HOL/Library/Zorn" Fun_More_LFP Wellorder_Relation_LFP |
|
12 begin |
|
13 |
|
14 |
|
15 text{* In this section, we introduce well-order {\em embeddings} and {\em isomorphisms} and |
|
16 prove their basic properties. The notion of embedding is considered from the point |
|
17 of view of the theory of ordinals, and therefore requires the source to be injected |
|
18 as an {\em initial segment} (i.e., {\em order filter}) of the target. A main result |
|
19 of this section is the existence of embeddings (in one direction or another) between |
|
20 any two well-orders, having as a consequence the fact that, given any two sets on |
|
21 any two types, one is smaller than (i.e., can be injected into) the other. *} |
|
22 |
|
23 |
|
24 subsection {* Auxiliaries *} |
|
25 |
|
26 lemma UNION_inj_on_ofilter: |
|
27 assumes WELL: "Well_order r" and |
|
28 OF: "\<And> i. i \<in> I \<Longrightarrow> wo_rel.ofilter r (A i)" and |
|
29 INJ: "\<And> i. i \<in> I \<Longrightarrow> inj_on f (A i)" |
|
30 shows "inj_on f (\<Union> i \<in> I. A i)" |
|
31 proof- |
|
32 have "wo_rel r" using WELL by (simp add: wo_rel_def) |
|
33 hence "\<And> i j. \<lbrakk>i \<in> I; j \<in> I\<rbrakk> \<Longrightarrow> A i <= A j \<or> A j <= A i" |
|
34 using wo_rel.ofilter_linord[of r] OF by blast |
|
35 with WELL INJ show ?thesis |
|
36 by (auto simp add: inj_on_UNION_chain) |
|
37 qed |
|
38 |
|
39 |
|
40 lemma under_underS_bij_betw: |
|
41 assumes WELL: "Well_order r" and WELL': "Well_order r'" and |
|
42 IN: "a \<in> Field r" and IN': "f a \<in> Field r'" and |
|
43 BIJ: "bij_betw f (rel.underS r a) (rel.underS r' (f a))" |
|
44 shows "bij_betw f (rel.under r a) (rel.under r' (f a))" |
|
45 proof- |
|
46 have "a \<notin> rel.underS r a \<and> f a \<notin> rel.underS r' (f a)" |
|
47 unfolding rel.underS_def by auto |
|
48 moreover |
|
49 {have "Refl r \<and> Refl r'" using WELL WELL' |
|
50 by (auto simp add: order_on_defs) |
|
51 hence "rel.under r a = rel.underS r a \<union> {a} \<and> |
|
52 rel.under r' (f a) = rel.underS r' (f a) \<union> {f a}" |
|
53 using IN IN' by(auto simp add: rel.Refl_under_underS) |
|
54 } |
|
55 ultimately show ?thesis |
|
56 using BIJ notIn_Un_bij_betw[of a "rel.underS r a" f "rel.underS r' (f a)"] by auto |
|
57 qed |
|
58 |
|
59 |
|
60 |
|
61 subsection {* (Well-order) embeddings, strict embeddings, isomorphisms and order-compatible |
|
62 functions *} |
|
63 |
|
64 |
|
65 text{* Standardly, a function is an embedding of a well-order in another if it injectively and |
|
66 order-compatibly maps the former into an order filter of the latter. |
|
67 Here we opt for a more succinct definition (operator @{text "embed"}), |
|
68 asking that, for any element in the source, the function should be a bijection |
|
69 between the set of strict lower bounds of that element |
|
70 and the set of strict lower bounds of its image. (Later we prove equivalence with |
|
71 the standard definition -- lemma @{text "embed_iff_compat_inj_on_ofilter"}.) |
|
72 A {\em strict embedding} (operator @{text "embedS"}) is a non-bijective embedding |
|
73 and an isomorphism (operator @{text "iso"}) is a bijective embedding. *} |
|
74 |
|
75 |
|
76 definition embed :: "'a rel \<Rightarrow> 'a' rel \<Rightarrow> ('a \<Rightarrow> 'a') \<Rightarrow> bool" |
|
77 where |
|
78 "embed r r' f \<equiv> \<forall>a \<in> Field r. bij_betw f (rel.under r a) (rel.under r' (f a))" |
|
79 |
|
80 |
|
81 lemmas embed_defs = embed_def embed_def[abs_def] |
|
82 |
|
83 |
|
84 text {* Strict embeddings: *} |
|
85 |
|
86 definition embedS :: "'a rel \<Rightarrow> 'a' rel \<Rightarrow> ('a \<Rightarrow> 'a') \<Rightarrow> bool" |
|
87 where |
|
88 "embedS r r' f \<equiv> embed r r' f \<and> \<not> bij_betw f (Field r) (Field r')" |
|
89 |
|
90 |
|
91 lemmas embedS_defs = embedS_def embedS_def[abs_def] |
|
92 |
|
93 |
|
94 definition iso :: "'a rel \<Rightarrow> 'a' rel \<Rightarrow> ('a \<Rightarrow> 'a') \<Rightarrow> bool" |
|
95 where |
|
96 "iso r r' f \<equiv> embed r r' f \<and> bij_betw f (Field r) (Field r')" |
|
97 |
|
98 |
|
99 lemmas iso_defs = iso_def iso_def[abs_def] |
|
100 |
|
101 |
|
102 definition compat :: "'a rel \<Rightarrow> 'a' rel \<Rightarrow> ('a \<Rightarrow> 'a') \<Rightarrow> bool" |
|
103 where |
|
104 "compat r r' f \<equiv> \<forall>a b. (a,b) \<in> r \<longrightarrow> (f a, f b) \<in> r'" |
|
105 |
|
106 |
|
107 lemma compat_wf: |
|
108 assumes CMP: "compat r r' f" and WF: "wf r'" |
|
109 shows "wf r" |
|
110 proof- |
|
111 have "r \<le> inv_image r' f" |
|
112 unfolding inv_image_def using CMP |
|
113 by (auto simp add: compat_def) |
|
114 with WF show ?thesis |
|
115 using wf_inv_image[of r' f] wf_subset[of "inv_image r' f"] by auto |
|
116 qed |
|
117 |
|
118 |
|
119 lemma id_embed: "embed r r id" |
|
120 by(auto simp add: id_def embed_def bij_betw_def) |
|
121 |
|
122 |
|
123 lemma id_iso: "iso r r id" |
|
124 by(auto simp add: id_def embed_def iso_def bij_betw_def) |
|
125 |
|
126 |
|
127 lemma embed_in_Field: |
|
128 assumes WELL: "Well_order r" and |
|
129 EMB: "embed r r' f" and IN: "a \<in> Field r" |
|
130 shows "f a \<in> Field r'" |
|
131 proof- |
|
132 have Well: "wo_rel r" |
|
133 using WELL by (auto simp add: wo_rel_def) |
|
134 hence 1: "Refl r" |
|
135 by (auto simp add: wo_rel.REFL) |
|
136 hence "a \<in> rel.under r a" using IN rel.Refl_under_in by fastforce |
|
137 hence "f a \<in> rel.under r' (f a)" |
|
138 using EMB IN by (auto simp add: embed_def bij_betw_def) |
|
139 thus ?thesis unfolding Field_def |
|
140 by (auto simp: rel.under_def) |
|
141 qed |
|
142 |
|
143 |
|
144 lemma comp_embed: |
|
145 assumes WELL: "Well_order r" and |
|
146 EMB: "embed r r' f" and EMB': "embed r' r'' f'" |
|
147 shows "embed r r'' (f' o f)" |
|
148 proof(unfold embed_def, auto) |
|
149 fix a assume *: "a \<in> Field r" |
|
150 hence "bij_betw f (rel.under r a) (rel.under r' (f a))" |
|
151 using embed_def[of r] EMB by auto |
|
152 moreover |
|
153 {have "f a \<in> Field r'" |
|
154 using EMB WELL * by (auto simp add: embed_in_Field) |
|
155 hence "bij_betw f' (rel.under r' (f a)) (rel.under r'' (f' (f a)))" |
|
156 using embed_def[of r'] EMB' by auto |
|
157 } |
|
158 ultimately |
|
159 show "bij_betw (f' \<circ> f) (rel.under r a) (rel.under r'' (f'(f a)))" |
|
160 by(auto simp add: bij_betw_trans) |
|
161 qed |
|
162 |
|
163 |
|
164 lemma comp_iso: |
|
165 assumes WELL: "Well_order r" and |
|
166 EMB: "iso r r' f" and EMB': "iso r' r'' f'" |
|
167 shows "iso r r'' (f' o f)" |
|
168 using assms unfolding iso_def |
|
169 by (auto simp add: comp_embed bij_betw_trans) |
|
170 |
|
171 |
|
172 text{* That @{text "embedS"} is also preserved by function composition shall be proved only later. *} |
|
173 |
|
174 |
|
175 lemma embed_Field: |
|
176 "\<lbrakk>Well_order r; embed r r' f\<rbrakk> \<Longrightarrow> f`(Field r) \<le> Field r'" |
|
177 by (auto simp add: embed_in_Field) |
|
178 |
|
179 |
|
180 lemma embed_preserves_ofilter: |
|
181 assumes WELL: "Well_order r" and WELL': "Well_order r'" and |
|
182 EMB: "embed r r' f" and OF: "wo_rel.ofilter r A" |
|
183 shows "wo_rel.ofilter r' (f`A)" |
|
184 proof- |
|
185 (* Preliminary facts *) |
|
186 from WELL have Well: "wo_rel r" unfolding wo_rel_def . |
|
187 from WELL' have Well': "wo_rel r'" unfolding wo_rel_def . |
|
188 from OF have 0: "A \<le> Field r" by(auto simp add: Well wo_rel.ofilter_def) |
|
189 (* Main proof *) |
|
190 show ?thesis using Well' WELL EMB 0 embed_Field[of r r' f] |
|
191 proof(unfold wo_rel.ofilter_def, auto simp add: image_def) |
|
192 fix a b' |
|
193 assume *: "a \<in> A" and **: "b' \<in> rel.under r' (f a)" |
|
194 hence "a \<in> Field r" using 0 by auto |
|
195 hence "bij_betw f (rel.under r a) (rel.under r' (f a))" |
|
196 using * EMB by (auto simp add: embed_def) |
|
197 hence "f`(rel.under r a) = rel.under r' (f a)" |
|
198 by (simp add: bij_betw_def) |
|
199 with ** image_def[of f "rel.under r a"] obtain b where |
|
200 1: "b \<in> rel.under r a \<and> b' = f b" by blast |
|
201 hence "b \<in> A" using Well * OF |
|
202 by (auto simp add: wo_rel.ofilter_def) |
|
203 with 1 show "\<exists>b \<in> A. b' = f b" by blast |
|
204 qed |
|
205 qed |
|
206 |
|
207 |
|
208 lemma embed_Field_ofilter: |
|
209 assumes WELL: "Well_order r" and WELL': "Well_order r'" and |
|
210 EMB: "embed r r' f" |
|
211 shows "wo_rel.ofilter r' (f`(Field r))" |
|
212 proof- |
|
213 have "wo_rel.ofilter r (Field r)" |
|
214 using WELL by (auto simp add: wo_rel_def wo_rel.Field_ofilter) |
|
215 with WELL WELL' EMB |
|
216 show ?thesis by (auto simp add: embed_preserves_ofilter) |
|
217 qed |
|
218 |
|
219 |
|
220 lemma embed_compat: |
|
221 assumes EMB: "embed r r' f" |
|
222 shows "compat r r' f" |
|
223 proof(unfold compat_def, clarify) |
|
224 fix a b |
|
225 assume *: "(a,b) \<in> r" |
|
226 hence 1: "b \<in> Field r" using Field_def[of r] by blast |
|
227 have "a \<in> rel.under r b" |
|
228 using * rel.under_def[of r] by simp |
|
229 hence "f a \<in> rel.under r' (f b)" |
|
230 using EMB embed_def[of r r' f] |
|
231 bij_betw_def[of f "rel.under r b" "rel.under r' (f b)"] |
|
232 image_def[of f "rel.under r b"] 1 by auto |
|
233 thus "(f a, f b) \<in> r'" |
|
234 by (auto simp add: rel.under_def) |
|
235 qed |
|
236 |
|
237 |
|
238 lemma embed_inj_on: |
|
239 assumes WELL: "Well_order r" and EMB: "embed r r' f" |
|
240 shows "inj_on f (Field r)" |
|
241 proof(unfold inj_on_def, clarify) |
|
242 (* Preliminary facts *) |
|
243 from WELL have Well: "wo_rel r" unfolding wo_rel_def . |
|
244 with wo_rel.TOTAL[of r] |
|
245 have Total: "Total r" by simp |
|
246 from Well wo_rel.REFL[of r] |
|
247 have Refl: "Refl r" by simp |
|
248 (* Main proof *) |
|
249 fix a b |
|
250 assume *: "a \<in> Field r" and **: "b \<in> Field r" and |
|
251 ***: "f a = f b" |
|
252 hence 1: "a \<in> Field r \<and> b \<in> Field r" |
|
253 unfolding Field_def by auto |
|
254 {assume "(a,b) \<in> r" |
|
255 hence "a \<in> rel.under r b \<and> b \<in> rel.under r b" |
|
256 using Refl by(auto simp add: rel.under_def refl_on_def) |
|
257 hence "a = b" |
|
258 using EMB 1 *** |
|
259 by (auto simp add: embed_def bij_betw_def inj_on_def) |
|
260 } |
|
261 moreover |
|
262 {assume "(b,a) \<in> r" |
|
263 hence "a \<in> rel.under r a \<and> b \<in> rel.under r a" |
|
264 using Refl by(auto simp add: rel.under_def refl_on_def) |
|
265 hence "a = b" |
|
266 using EMB 1 *** |
|
267 by (auto simp add: embed_def bij_betw_def inj_on_def) |
|
268 } |
|
269 ultimately |
|
270 show "a = b" using Total 1 |
|
271 by (auto simp add: total_on_def) |
|
272 qed |
|
273 |
|
274 |
|
275 lemma embed_underS: |
|
276 assumes WELL: "Well_order r" and WELL': "Well_order r'" and |
|
277 EMB: "embed r r' f" and IN: "a \<in> Field r" |
|
278 shows "bij_betw f (rel.underS r a) (rel.underS r' (f a))" |
|
279 proof- |
|
280 have "bij_betw f (rel.under r a) (rel.under r' (f a))" |
|
281 using assms by (auto simp add: embed_def) |
|
282 moreover |
|
283 {have "f a \<in> Field r'" using assms embed_Field[of r r' f] by auto |
|
284 hence "rel.under r a = rel.underS r a \<union> {a} \<and> |
|
285 rel.under r' (f a) = rel.underS r' (f a) \<union> {f a}" |
|
286 using assms by (auto simp add: order_on_defs rel.Refl_under_underS) |
|
287 } |
|
288 moreover |
|
289 {have "a \<notin> rel.underS r a \<and> f a \<notin> rel.underS r' (f a)" |
|
290 unfolding rel.underS_def by blast |
|
291 } |
|
292 ultimately show ?thesis |
|
293 by (auto simp add: notIn_Un_bij_betw3) |
|
294 qed |
|
295 |
|
296 |
|
297 lemma embed_iff_compat_inj_on_ofilter: |
|
298 assumes WELL: "Well_order r" and WELL': "Well_order r'" |
|
299 shows "embed r r' f = (compat r r' f \<and> inj_on f (Field r) \<and> wo_rel.ofilter r' (f`(Field r)))" |
|
300 using assms |
|
301 proof(auto simp add: embed_compat embed_inj_on embed_Field_ofilter, |
|
302 unfold embed_def, auto) (* get rid of one implication *) |
|
303 fix a |
|
304 assume *: "inj_on f (Field r)" and |
|
305 **: "compat r r' f" and |
|
306 ***: "wo_rel.ofilter r' (f`(Field r))" and |
|
307 ****: "a \<in> Field r" |
|
308 (* Preliminary facts *) |
|
309 have Well: "wo_rel r" |
|
310 using WELL wo_rel_def[of r] by simp |
|
311 hence Refl: "Refl r" |
|
312 using wo_rel.REFL[of r] by simp |
|
313 have Total: "Total r" |
|
314 using Well wo_rel.TOTAL[of r] by simp |
|
315 have Well': "wo_rel r'" |
|
316 using WELL' wo_rel_def[of r'] by simp |
|
317 hence Antisym': "antisym r'" |
|
318 using wo_rel.ANTISYM[of r'] by simp |
|
319 have "(a,a) \<in> r" |
|
320 using **** Well wo_rel.REFL[of r] |
|
321 refl_on_def[of _ r] by auto |
|
322 hence "(f a, f a) \<in> r'" |
|
323 using ** by(auto simp add: compat_def) |
|
324 hence 0: "f a \<in> Field r'" |
|
325 unfolding Field_def by auto |
|
326 have "f a \<in> f`(Field r)" |
|
327 using **** by auto |
|
328 hence 2: "rel.under r' (f a) \<le> f`(Field r)" |
|
329 using Well' *** wo_rel.ofilter_def[of r' "f`(Field r)"] by fastforce |
|
330 (* Main proof *) |
|
331 show "bij_betw f (rel.under r a) (rel.under r' (f a))" |
|
332 proof(unfold bij_betw_def, auto) |
|
333 show "inj_on f (rel.under r a)" |
|
334 using * |
|
335 by (auto simp add: rel.under_Field subset_inj_on) |
|
336 next |
|
337 fix b assume "b \<in> rel.under r a" |
|
338 thus "f b \<in> rel.under r' (f a)" |
|
339 unfolding rel.under_def using ** |
|
340 by (auto simp add: compat_def) |
|
341 next |
|
342 fix b' assume *****: "b' \<in> rel.under r' (f a)" |
|
343 hence "b' \<in> f`(Field r)" |
|
344 using 2 by auto |
|
345 with Field_def[of r] obtain b where |
|
346 3: "b \<in> Field r" and 4: "b' = f b" by auto |
|
347 have "(b,a): r" |
|
348 proof- |
|
349 {assume "(a,b) \<in> r" |
|
350 with ** 4 have "(f a, b'): r'" |
|
351 by (auto simp add: compat_def) |
|
352 with ***** Antisym' have "f a = b'" |
|
353 by(auto simp add: rel.under_def antisym_def) |
|
354 with 3 **** 4 * have "a = b" |
|
355 by(auto simp add: inj_on_def) |
|
356 } |
|
357 moreover |
|
358 {assume "a = b" |
|
359 hence "(b,a) \<in> r" using Refl **** 3 |
|
360 by (auto simp add: refl_on_def) |
|
361 } |
|
362 ultimately |
|
363 show ?thesis using Total **** 3 by (fastforce simp add: total_on_def) |
|
364 qed |
|
365 with 4 show "b' \<in> f`(rel.under r a)" |
|
366 unfolding rel.under_def by auto |
|
367 qed |
|
368 qed |
|
369 |
|
370 |
|
371 lemma inv_into_ofilter_embed: |
|
372 assumes WELL: "Well_order r" and OF: "wo_rel.ofilter r A" and |
|
373 BIJ: "\<forall>b \<in> A. bij_betw f (rel.under r b) (rel.under r' (f b))" and |
|
374 IMAGE: "f ` A = Field r'" |
|
375 shows "embed r' r (inv_into A f)" |
|
376 proof- |
|
377 (* Preliminary facts *) |
|
378 have Well: "wo_rel r" |
|
379 using WELL wo_rel_def[of r] by simp |
|
380 have Refl: "Refl r" |
|
381 using Well wo_rel.REFL[of r] by simp |
|
382 have Total: "Total r" |
|
383 using Well wo_rel.TOTAL[of r] by simp |
|
384 (* Main proof *) |
|
385 have 1: "bij_betw f A (Field r')" |
|
386 proof(unfold bij_betw_def inj_on_def, auto simp add: IMAGE) |
|
387 fix b1 b2 |
|
388 assume *: "b1 \<in> A" and **: "b2 \<in> A" and |
|
389 ***: "f b1 = f b2" |
|
390 have 11: "b1 \<in> Field r \<and> b2 \<in> Field r" |
|
391 using * ** Well OF by (auto simp add: wo_rel.ofilter_def) |
|
392 moreover |
|
393 {assume "(b1,b2) \<in> r" |
|
394 hence "b1 \<in> rel.under r b2 \<and> b2 \<in> rel.under r b2" |
|
395 unfolding rel.under_def using 11 Refl |
|
396 by (auto simp add: refl_on_def) |
|
397 hence "b1 = b2" using BIJ * ** *** |
|
398 by (auto simp add: bij_betw_def inj_on_def) |
|
399 } |
|
400 moreover |
|
401 {assume "(b2,b1) \<in> r" |
|
402 hence "b1 \<in> rel.under r b1 \<and> b2 \<in> rel.under r b1" |
|
403 unfolding rel.under_def using 11 Refl |
|
404 by (auto simp add: refl_on_def) |
|
405 hence "b1 = b2" using BIJ * ** *** |
|
406 by (auto simp add: bij_betw_def inj_on_def) |
|
407 } |
|
408 ultimately |
|
409 show "b1 = b2" |
|
410 using Total by (auto simp add: total_on_def) |
|
411 qed |
|
412 (* *) |
|
413 let ?f' = "(inv_into A f)" |
|
414 (* *) |
|
415 have 2: "\<forall>b \<in> A. bij_betw ?f' (rel.under r' (f b)) (rel.under r b)" |
|
416 proof(clarify) |
|
417 fix b assume *: "b \<in> A" |
|
418 hence "rel.under r b \<le> A" |
|
419 using Well OF by(auto simp add: wo_rel.ofilter_def) |
|
420 moreover |
|
421 have "f ` (rel.under r b) = rel.under r' (f b)" |
|
422 using * BIJ by (auto simp add: bij_betw_def) |
|
423 ultimately |
|
424 show "bij_betw ?f' (rel.under r' (f b)) (rel.under r b)" |
|
425 using 1 by (auto simp add: bij_betw_inv_into_subset) |
|
426 qed |
|
427 (* *) |
|
428 have 3: "\<forall>b' \<in> Field r'. bij_betw ?f' (rel.under r' b') (rel.under r (?f' b'))" |
|
429 proof(clarify) |
|
430 fix b' assume *: "b' \<in> Field r'" |
|
431 have "b' = f (?f' b')" using * 1 |
|
432 by (auto simp add: bij_betw_inv_into_right) |
|
433 moreover |
|
434 {obtain b where 31: "b \<in> A" and "f b = b'" using IMAGE * by force |
|
435 hence "?f' b' = b" using 1 by (auto simp add: bij_betw_inv_into_left) |
|
436 with 31 have "?f' b' \<in> A" by auto |
|
437 } |
|
438 ultimately |
|
439 show "bij_betw ?f' (rel.under r' b') (rel.under r (?f' b'))" |
|
440 using 2 by auto |
|
441 qed |
|
442 (* *) |
|
443 thus ?thesis unfolding embed_def . |
|
444 qed |
|
445 |
|
446 |
|
447 lemma inv_into_underS_embed: |
|
448 assumes WELL: "Well_order r" and |
|
449 BIJ: "\<forall>b \<in> rel.underS r a. bij_betw f (rel.under r b) (rel.under r' (f b))" and |
|
450 IN: "a \<in> Field r" and |
|
451 IMAGE: "f ` (rel.underS r a) = Field r'" |
|
452 shows "embed r' r (inv_into (rel.underS r a) f)" |
|
453 using assms |
|
454 by(auto simp add: wo_rel_def wo_rel.underS_ofilter inv_into_ofilter_embed) |
|
455 |
|
456 |
|
457 lemma inv_into_Field_embed: |
|
458 assumes WELL: "Well_order r" and EMB: "embed r r' f" and |
|
459 IMAGE: "Field r' \<le> f ` (Field r)" |
|
460 shows "embed r' r (inv_into (Field r) f)" |
|
461 proof- |
|
462 have "(\<forall>b \<in> Field r. bij_betw f (rel.under r b) (rel.under r' (f b)))" |
|
463 using EMB by (auto simp add: embed_def) |
|
464 moreover |
|
465 have "f ` (Field r) \<le> Field r'" |
|
466 using EMB WELL by (auto simp add: embed_Field) |
|
467 ultimately |
|
468 show ?thesis using assms |
|
469 by(auto simp add: wo_rel_def wo_rel.Field_ofilter inv_into_ofilter_embed) |
|
470 qed |
|
471 |
|
472 |
|
473 lemma inv_into_Field_embed_bij_betw: |
|
474 assumes WELL: "Well_order r" and |
|
475 EMB: "embed r r' f" and BIJ: "bij_betw f (Field r) (Field r')" |
|
476 shows "embed r' r (inv_into (Field r) f)" |
|
477 proof- |
|
478 have "Field r' \<le> f ` (Field r)" |
|
479 using BIJ by (auto simp add: bij_betw_def) |
|
480 thus ?thesis using assms |
|
481 by(auto simp add: inv_into_Field_embed) |
|
482 qed |
|
483 |
|
484 |
|
485 |
|
486 |
|
487 |
|
488 subsection {* Given any two well-orders, one can be embedded in the other *} |
|
489 |
|
490 |
|
491 text{* Here is an overview of the proof of of this fact, stated in theorem |
|
492 @{text "wellorders_totally_ordered"}: |
|
493 |
|
494 Fix the well-orders @{text "r::'a rel"} and @{text "r'::'a' rel"}. |
|
495 Attempt to define an embedding @{text "f::'a \<Rightarrow> 'a'"} from @{text "r"} to @{text "r'"} in the |
|
496 natural way by well-order recursion ("hoping" that @{text "Field r"} turns out to be smaller |
|
497 than @{text "Field r'"}), but also record, at the recursive step, in a function |
|
498 @{text "g::'a \<Rightarrow> bool"}, the extra information of whether @{text "Field r'"} |
|
499 gets exhausted or not. |
|
500 |
|
501 If @{text "Field r'"} does not get exhausted, then @{text "Field r"} is indeed smaller |
|
502 and @{text "f"} is the desired embedding from @{text "r"} to @{text "r'"} |
|
503 (lemma @{text "wellorders_totally_ordered_aux"}). |
|
504 |
|
505 Otherwise, it means that @{text "Field r'"} is the smaller one, and the inverse of |
|
506 (the "good" segment of) @{text "f"} is the desired embedding from @{text "r'"} to @{text "r"} |
|
507 (lemma @{text "wellorders_totally_ordered_aux2"}). |
|
508 *} |
|
509 |
|
510 |
|
511 lemma wellorders_totally_ordered_aux: |
|
512 fixes r ::"'a rel" and r'::"'a' rel" and |
|
513 f :: "'a \<Rightarrow> 'a'" and a::'a |
|
514 assumes WELL: "Well_order r" and WELL': "Well_order r'" and IN: "a \<in> Field r" and |
|
515 IH: "\<forall>b \<in> rel.underS r a. bij_betw f (rel.under r b) (rel.under r' (f b))" and |
|
516 NOT: "f ` (rel.underS r a) \<noteq> Field r'" and SUC: "f a = wo_rel.suc r' (f`(rel.underS r a))" |
|
517 shows "bij_betw f (rel.under r a) (rel.under r' (f a))" |
|
518 proof- |
|
519 (* Preliminary facts *) |
|
520 have Well: "wo_rel r" using WELL unfolding wo_rel_def . |
|
521 hence Refl: "Refl r" using wo_rel.REFL[of r] by auto |
|
522 have Trans: "trans r" using Well wo_rel.TRANS[of r] by auto |
|
523 have Well': "wo_rel r'" using WELL' unfolding wo_rel_def . |
|
524 have OF: "wo_rel.ofilter r (rel.underS r a)" |
|
525 by (auto simp add: Well wo_rel.underS_ofilter) |
|
526 hence UN: "rel.underS r a = (\<Union> b \<in> rel.underS r a. rel.under r b)" |
|
527 using Well wo_rel.ofilter_under_UNION[of r "rel.underS r a"] by blast |
|
528 (* Gather facts about elements of rel.underS r a *) |
|
529 {fix b assume *: "b \<in> rel.underS r a" |
|
530 hence t0: "(b,a) \<in> r \<and> b \<noteq> a" unfolding rel.underS_def by auto |
|
531 have t1: "b \<in> Field r" |
|
532 using * rel.underS_Field[of r a] by auto |
|
533 have t2: "f`(rel.under r b) = rel.under r' (f b)" |
|
534 using IH * by (auto simp add: bij_betw_def) |
|
535 hence t3: "wo_rel.ofilter r' (f`(rel.under r b))" |
|
536 using Well' by (auto simp add: wo_rel.under_ofilter) |
|
537 have "f`(rel.under r b) \<le> Field r'" |
|
538 using t2 by (auto simp add: rel.under_Field) |
|
539 moreover |
|
540 have "b \<in> rel.under r b" |
|
541 using t1 by(auto simp add: Refl rel.Refl_under_in) |
|
542 ultimately |
|
543 have t4: "f b \<in> Field r'" by auto |
|
544 have "f`(rel.under r b) = rel.under r' (f b) \<and> |
|
545 wo_rel.ofilter r' (f`(rel.under r b)) \<and> |
|
546 f b \<in> Field r'" |
|
547 using t2 t3 t4 by auto |
|
548 } |
|
549 hence bFact: |
|
550 "\<forall>b \<in> rel.underS r a. f`(rel.under r b) = rel.under r' (f b) \<and> |
|
551 wo_rel.ofilter r' (f`(rel.under r b)) \<and> |
|
552 f b \<in> Field r'" by blast |
|
553 (* *) |
|
554 have subField: "f`(rel.underS r a) \<le> Field r'" |
|
555 using bFact by blast |
|
556 (* *) |
|
557 have OF': "wo_rel.ofilter r' (f`(rel.underS r a))" |
|
558 proof- |
|
559 have "f`(rel.underS r a) = f`(\<Union> b \<in> rel.underS r a. rel.under r b)" |
|
560 using UN by auto |
|
561 also have "\<dots> = (\<Union> b \<in> rel.underS r a. f`(rel.under r b))" by blast |
|
562 also have "\<dots> = (\<Union> b \<in> rel.underS r a. (rel.under r' (f b)))" |
|
563 using bFact by auto |
|
564 finally |
|
565 have "f`(rel.underS r a) = (\<Union> b \<in> rel.underS r a. (rel.under r' (f b)))" . |
|
566 thus ?thesis |
|
567 using Well' bFact |
|
568 wo_rel.ofilter_UNION[of r' "rel.underS r a" "\<lambda> b. rel.under r' (f b)"] by fastforce |
|
569 qed |
|
570 (* *) |
|
571 have "f`(rel.underS r a) \<union> rel.AboveS r' (f`(rel.underS r a)) = Field r'" |
|
572 using Well' OF' by (auto simp add: wo_rel.ofilter_AboveS_Field) |
|
573 hence NE: "rel.AboveS r' (f`(rel.underS r a)) \<noteq> {}" |
|
574 using subField NOT by blast |
|
575 (* Main proof *) |
|
576 have INCL1: "f`(rel.underS r a) \<le> rel.underS r' (f a) " |
|
577 proof(auto) |
|
578 fix b assume *: "b \<in> rel.underS r a" |
|
579 have "f b \<noteq> f a \<and> (f b, f a) \<in> r'" |
|
580 using subField Well' SUC NE * |
|
581 wo_rel.suc_greater[of r' "f`(rel.underS r a)" "f b"] by auto |
|
582 thus "f b \<in> rel.underS r' (f a)" |
|
583 unfolding rel.underS_def by simp |
|
584 qed |
|
585 (* *) |
|
586 have INCL2: "rel.underS r' (f a) \<le> f`(rel.underS r a)" |
|
587 proof |
|
588 fix b' assume "b' \<in> rel.underS r' (f a)" |
|
589 hence "b' \<noteq> f a \<and> (b', f a) \<in> r'" |
|
590 unfolding rel.underS_def by simp |
|
591 thus "b' \<in> f`(rel.underS r a)" |
|
592 using Well' SUC NE OF' |
|
593 wo_rel.suc_ofilter_in[of r' "f ` rel.underS r a" b'] by auto |
|
594 qed |
|
595 (* *) |
|
596 have INJ: "inj_on f (rel.underS r a)" |
|
597 proof- |
|
598 have "\<forall>b \<in> rel.underS r a. inj_on f (rel.under r b)" |
|
599 using IH by (auto simp add: bij_betw_def) |
|
600 moreover |
|
601 have "\<forall>b. wo_rel.ofilter r (rel.under r b)" |
|
602 using Well by (auto simp add: wo_rel.under_ofilter) |
|
603 ultimately show ?thesis |
|
604 using WELL bFact UN |
|
605 UNION_inj_on_ofilter[of r "rel.underS r a" "\<lambda>b. rel.under r b" f] |
|
606 by auto |
|
607 qed |
|
608 (* *) |
|
609 have BIJ: "bij_betw f (rel.underS r a) (rel.underS r' (f a))" |
|
610 unfolding bij_betw_def |
|
611 using INJ INCL1 INCL2 by auto |
|
612 (* *) |
|
613 have "f a \<in> Field r'" |
|
614 using Well' subField NE SUC |
|
615 by (auto simp add: wo_rel.suc_inField) |
|
616 thus ?thesis |
|
617 using WELL WELL' IN BIJ under_underS_bij_betw[of r r' a f] by auto |
|
618 qed |
|
619 |
|
620 |
|
621 lemma wellorders_totally_ordered_aux2: |
|
622 fixes r ::"'a rel" and r'::"'a' rel" and |
|
623 f :: "'a \<Rightarrow> 'a'" and g :: "'a \<Rightarrow> bool" and a::'a |
|
624 assumes WELL: "Well_order r" and WELL': "Well_order r'" and |
|
625 MAIN1: |
|
626 "\<And> a. (False \<notin> g`(rel.underS r a) \<and> f`(rel.underS r a) \<noteq> Field r' |
|
627 \<longrightarrow> f a = wo_rel.suc r' (f`(rel.underS r a)) \<and> g a = True) |
|
628 \<and> |
|
629 (\<not>(False \<notin> (g`(rel.underS r a)) \<and> f`(rel.underS r a) \<noteq> Field r') |
|
630 \<longrightarrow> g a = False)" and |
|
631 MAIN2: "\<And> a. a \<in> Field r \<and> False \<notin> g`(rel.under r a) \<longrightarrow> |
|
632 bij_betw f (rel.under r a) (rel.under r' (f a))" and |
|
633 Case: "a \<in> Field r \<and> False \<in> g`(rel.under r a)" |
|
634 shows "\<exists>f'. embed r' r f'" |
|
635 proof- |
|
636 have Well: "wo_rel r" using WELL unfolding wo_rel_def . |
|
637 hence Refl: "Refl r" using wo_rel.REFL[of r] by auto |
|
638 have Trans: "trans r" using Well wo_rel.TRANS[of r] by auto |
|
639 have Antisym: "antisym r" using Well wo_rel.ANTISYM[of r] by auto |
|
640 have Well': "wo_rel r'" using WELL' unfolding wo_rel_def . |
|
641 (* *) |
|
642 have 0: "rel.under r a = rel.underS r a \<union> {a}" |
|
643 using Refl Case by(auto simp add: rel.Refl_under_underS) |
|
644 (* *) |
|
645 have 1: "g a = False" |
|
646 proof- |
|
647 {assume "g a \<noteq> False" |
|
648 with 0 Case have "False \<in> g`(rel.underS r a)" by blast |
|
649 with MAIN1 have "g a = False" by blast} |
|
650 thus ?thesis by blast |
|
651 qed |
|
652 let ?A = "{a \<in> Field r. g a = False}" |
|
653 let ?a = "(wo_rel.minim r ?A)" |
|
654 (* *) |
|
655 have 2: "?A \<noteq> {} \<and> ?A \<le> Field r" using Case 1 by blast |
|
656 (* *) |
|
657 have 3: "False \<notin> g`(rel.underS r ?a)" |
|
658 proof |
|
659 assume "False \<in> g`(rel.underS r ?a)" |
|
660 then obtain b where "b \<in> rel.underS r ?a" and 31: "g b = False" by auto |
|
661 hence 32: "(b,?a) \<in> r \<and> b \<noteq> ?a" |
|
662 by (auto simp add: rel.underS_def) |
|
663 hence "b \<in> Field r" unfolding Field_def by auto |
|
664 with 31 have "b \<in> ?A" by auto |
|
665 hence "(?a,b) \<in> r" using wo_rel.minim_least 2 Well by fastforce |
|
666 (* again: why worked without type annotations? *) |
|
667 with 32 Antisym show False |
|
668 by (auto simp add: antisym_def) |
|
669 qed |
|
670 have temp: "?a \<in> ?A" |
|
671 using Well 2 wo_rel.minim_in[of r ?A] by auto |
|
672 hence 4: "?a \<in> Field r" by auto |
|
673 (* *) |
|
674 have 5: "g ?a = False" using temp by blast |
|
675 (* *) |
|
676 have 6: "f`(rel.underS r ?a) = Field r'" |
|
677 using MAIN1[of ?a] 3 5 by blast |
|
678 (* *) |
|
679 have 7: "\<forall>b \<in> rel.underS r ?a. bij_betw f (rel.under r b) (rel.under r' (f b))" |
|
680 proof |
|
681 fix b assume as: "b \<in> rel.underS r ?a" |
|
682 moreover |
|
683 have "wo_rel.ofilter r (rel.underS r ?a)" |
|
684 using Well by (auto simp add: wo_rel.underS_ofilter) |
|
685 ultimately |
|
686 have "False \<notin> g`(rel.under r b)" using 3 Well by (subst (asm) wo_rel.ofilter_def) fast+ |
|
687 moreover have "b \<in> Field r" |
|
688 unfolding Field_def using as by (auto simp add: rel.underS_def) |
|
689 ultimately |
|
690 show "bij_betw f (rel.under r b) (rel.under r' (f b))" |
|
691 using MAIN2 by auto |
|
692 qed |
|
693 (* *) |
|
694 have "embed r' r (inv_into (rel.underS r ?a) f)" |
|
695 using WELL WELL' 7 4 6 inv_into_underS_embed[of r ?a f r'] by auto |
|
696 thus ?thesis |
|
697 unfolding embed_def by blast |
|
698 qed |
|
699 |
|
700 |
|
701 theorem wellorders_totally_ordered: |
|
702 fixes r ::"'a rel" and r'::"'a' rel" |
|
703 assumes WELL: "Well_order r" and WELL': "Well_order r'" |
|
704 shows "(\<exists>f. embed r r' f) \<or> (\<exists>f'. embed r' r f')" |
|
705 proof- |
|
706 (* Preliminary facts *) |
|
707 have Well: "wo_rel r" using WELL unfolding wo_rel_def . |
|
708 hence Refl: "Refl r" using wo_rel.REFL[of r] by auto |
|
709 have Trans: "trans r" using Well wo_rel.TRANS[of r] by auto |
|
710 have Well': "wo_rel r'" using WELL' unfolding wo_rel_def . |
|
711 (* Main proof *) |
|
712 obtain H where H_def: "H = |
|
713 (\<lambda>h a. if False \<notin> (snd o h)`(rel.underS r a) \<and> (fst o h)`(rel.underS r a) \<noteq> Field r' |
|
714 then (wo_rel.suc r' ((fst o h)`(rel.underS r a)), True) |
|
715 else (undefined, False))" by blast |
|
716 have Adm: "wo_rel.adm_wo r H" |
|
717 using Well |
|
718 proof(unfold wo_rel.adm_wo_def, clarify) |
|
719 fix h1::"'a \<Rightarrow> 'a' * bool" and h2::"'a \<Rightarrow> 'a' * bool" and x |
|
720 assume "\<forall>y\<in>rel.underS r x. h1 y = h2 y" |
|
721 hence "\<forall>y\<in>rel.underS r x. (fst o h1) y = (fst o h2) y \<and> |
|
722 (snd o h1) y = (snd o h2) y" by auto |
|
723 hence "(fst o h1)`(rel.underS r x) = (fst o h2)`(rel.underS r x) \<and> |
|
724 (snd o h1)`(rel.underS r x) = (snd o h2)`(rel.underS r x)" |
|
725 by (auto simp add: image_def) |
|
726 thus "H h1 x = H h2 x" by (simp add: H_def del: not_False_in_image_Ball) |
|
727 qed |
|
728 (* More constant definitions: *) |
|
729 obtain h::"'a \<Rightarrow> 'a' * bool" and f::"'a \<Rightarrow> 'a'" and g::"'a \<Rightarrow> bool" |
|
730 where h_def: "h = wo_rel.worec r H" and |
|
731 f_def: "f = fst o h" and g_def: "g = snd o h" by blast |
|
732 obtain test where test_def: |
|
733 "test = (\<lambda> a. False \<notin> (g`(rel.underS r a)) \<and> f`(rel.underS r a) \<noteq> Field r')" by blast |
|
734 (* *) |
|
735 have *: "\<And> a. h a = H h a" |
|
736 using Adm Well wo_rel.worec_fixpoint[of r H] by (simp add: h_def) |
|
737 have Main1: |
|
738 "\<And> a. (test a \<longrightarrow> f a = wo_rel.suc r' (f`(rel.underS r a)) \<and> g a = True) \<and> |
|
739 (\<not>(test a) \<longrightarrow> g a = False)" |
|
740 proof- (* How can I prove this withou fixing a? *) |
|
741 fix a show "(test a \<longrightarrow> f a = wo_rel.suc r' (f`(rel.underS r a)) \<and> g a = True) \<and> |
|
742 (\<not>(test a) \<longrightarrow> g a = False)" |
|
743 using *[of a] test_def f_def g_def H_def by auto |
|
744 qed |
|
745 (* *) |
|
746 let ?phi = "\<lambda> a. a \<in> Field r \<and> False \<notin> g`(rel.under r a) \<longrightarrow> |
|
747 bij_betw f (rel.under r a) (rel.under r' (f a))" |
|
748 have Main2: "\<And> a. ?phi a" |
|
749 proof- |
|
750 fix a show "?phi a" |
|
751 proof(rule wo_rel.well_order_induct[of r ?phi], |
|
752 simp only: Well, clarify) |
|
753 fix a |
|
754 assume IH: "\<forall>b. b \<noteq> a \<and> (b,a) \<in> r \<longrightarrow> ?phi b" and |
|
755 *: "a \<in> Field r" and |
|
756 **: "False \<notin> g`(rel.under r a)" |
|
757 have 1: "\<forall>b \<in> rel.underS r a. bij_betw f (rel.under r b) (rel.under r' (f b))" |
|
758 proof(clarify) |
|
759 fix b assume ***: "b \<in> rel.underS r a" |
|
760 hence 0: "(b,a) \<in> r \<and> b \<noteq> a" unfolding rel.underS_def by auto |
|
761 moreover have "b \<in> Field r" |
|
762 using *** rel.underS_Field[of r a] by auto |
|
763 moreover have "False \<notin> g`(rel.under r b)" |
|
764 using 0 ** Trans rel.under_incr[of r b a] by auto |
|
765 ultimately show "bij_betw f (rel.under r b) (rel.under r' (f b))" |
|
766 using IH by auto |
|
767 qed |
|
768 (* *) |
|
769 have 21: "False \<notin> g`(rel.underS r a)" |
|
770 using ** rel.underS_subset_under[of r a] by auto |
|
771 have 22: "g`(rel.under r a) \<le> {True}" using ** by auto |
|
772 moreover have 23: "a \<in> rel.under r a" |
|
773 using Refl * by (auto simp add: rel.Refl_under_in) |
|
774 ultimately have 24: "g a = True" by blast |
|
775 have 2: "f`(rel.underS r a) \<noteq> Field r'" |
|
776 proof |
|
777 assume "f`(rel.underS r a) = Field r'" |
|
778 hence "g a = False" using Main1 test_def by blast |
|
779 with 24 show False using ** by blast |
|
780 qed |
|
781 (* *) |
|
782 have 3: "f a = wo_rel.suc r' (f`(rel.underS r a))" |
|
783 using 21 2 Main1 test_def by blast |
|
784 (* *) |
|
785 show "bij_betw f (rel.under r a) (rel.under r' (f a))" |
|
786 using WELL WELL' 1 2 3 * |
|
787 wellorders_totally_ordered_aux[of r r' a f] by auto |
|
788 qed |
|
789 qed |
|
790 (* *) |
|
791 let ?chi = "(\<lambda> a. a \<in> Field r \<and> False \<in> g`(rel.under r a))" |
|
792 show ?thesis |
|
793 proof(cases "\<exists>a. ?chi a") |
|
794 assume "\<not> (\<exists>a. ?chi a)" |
|
795 hence "\<forall>a \<in> Field r. bij_betw f (rel.under r a) (rel.under r' (f a))" |
|
796 using Main2 by blast |
|
797 thus ?thesis unfolding embed_def by blast |
|
798 next |
|
799 assume "\<exists>a. ?chi a" |
|
800 then obtain a where "?chi a" by blast |
|
801 hence "\<exists>f'. embed r' r f'" |
|
802 using wellorders_totally_ordered_aux2[of r r' g f a] |
|
803 WELL WELL' Main1 Main2 test_def by blast |
|
804 thus ?thesis by blast |
|
805 qed |
|
806 qed |
|
807 |
|
808 |
|
809 subsection {* Uniqueness of embeddings *} |
|
810 |
|
811 |
|
812 text{* Here we show a fact complementary to the one from the previous subsection -- namely, |
|
813 that between any two well-orders there is {\em at most} one embedding, and is the one |
|
814 definable by the expected well-order recursive equation. As a consequence, any two |
|
815 embeddings of opposite directions are mutually inverse. *} |
|
816 |
|
817 |
|
818 lemma embed_determined: |
|
819 assumes WELL: "Well_order r" and WELL': "Well_order r'" and |
|
820 EMB: "embed r r' f" and IN: "a \<in> Field r" |
|
821 shows "f a = wo_rel.suc r' (f`(rel.underS r a))" |
|
822 proof- |
|
823 have "bij_betw f (rel.underS r a) (rel.underS r' (f a))" |
|
824 using assms by (auto simp add: embed_underS) |
|
825 hence "f`(rel.underS r a) = rel.underS r' (f a)" |
|
826 by (auto simp add: bij_betw_def) |
|
827 moreover |
|
828 {have "f a \<in> Field r'" using IN |
|
829 using EMB WELL embed_Field[of r r' f] by auto |
|
830 hence "f a = wo_rel.suc r' (rel.underS r' (f a))" |
|
831 using WELL' by (auto simp add: wo_rel_def wo_rel.suc_underS) |
|
832 } |
|
833 ultimately show ?thesis by simp |
|
834 qed |
|
835 |
|
836 |
|
837 lemma embed_unique: |
|
838 assumes WELL: "Well_order r" and WELL': "Well_order r'" and |
|
839 EMBf: "embed r r' f" and EMBg: "embed r r' g" |
|
840 shows "a \<in> Field r \<longrightarrow> f a = g a" |
|
841 proof(rule wo_rel.well_order_induct[of r], auto simp add: WELL wo_rel_def) |
|
842 fix a |
|
843 assume IH: "\<forall>b. b \<noteq> a \<and> (b,a): r \<longrightarrow> b \<in> Field r \<longrightarrow> f b = g b" and |
|
844 *: "a \<in> Field r" |
|
845 hence "\<forall>b \<in> rel.underS r a. f b = g b" |
|
846 unfolding rel.underS_def by (auto simp add: Field_def) |
|
847 hence "f`(rel.underS r a) = g`(rel.underS r a)" by force |
|
848 thus "f a = g a" |
|
849 using assms * embed_determined[of r r' f a] embed_determined[of r r' g a] by auto |
|
850 qed |
|
851 |
|
852 |
|
853 lemma embed_bothWays_inverse: |
|
854 assumes WELL: "Well_order r" and WELL': "Well_order r'" and |
|
855 EMB: "embed r r' f" and EMB': "embed r' r f'" |
|
856 shows "(\<forall>a \<in> Field r. f'(f a) = a) \<and> (\<forall>a' \<in> Field r'. f(f' a') = a')" |
|
857 proof- |
|
858 have "embed r r (f' o f)" using assms |
|
859 by(auto simp add: comp_embed) |
|
860 moreover have "embed r r id" using assms |
|
861 by (auto simp add: id_embed) |
|
862 ultimately have "\<forall>a \<in> Field r. f'(f a) = a" |
|
863 using assms embed_unique[of r r "f' o f" id] id_def by auto |
|
864 moreover |
|
865 {have "embed r' r' (f o f')" using assms |
|
866 by(auto simp add: comp_embed) |
|
867 moreover have "embed r' r' id" using assms |
|
868 by (auto simp add: id_embed) |
|
869 ultimately have "\<forall>a' \<in> Field r'. f(f' a') = a'" |
|
870 using assms embed_unique[of r' r' "f o f'" id] id_def by auto |
|
871 } |
|
872 ultimately show ?thesis by blast |
|
873 qed |
|
874 |
|
875 |
|
876 lemma embed_bothWays_bij_betw: |
|
877 assumes WELL: "Well_order r" and WELL': "Well_order r'" and |
|
878 EMB: "embed r r' f" and EMB': "embed r' r g" |
|
879 shows "bij_betw f (Field r) (Field r')" |
|
880 proof- |
|
881 let ?A = "Field r" let ?A' = "Field r'" |
|
882 have "embed r r (g o f) \<and> embed r' r' (f o g)" |
|
883 using assms by (auto simp add: comp_embed) |
|
884 hence 1: "(\<forall>a \<in> ?A. g(f a) = a) \<and> (\<forall>a' \<in> ?A'. f(g a') = a')" |
|
885 using WELL id_embed[of r] embed_unique[of r r "g o f" id] |
|
886 WELL' id_embed[of r'] embed_unique[of r' r' "f o g" id] |
|
887 id_def by auto |
|
888 have 2: "(\<forall>a \<in> ?A. f a \<in> ?A') \<and> (\<forall>a' \<in> ?A'. g a' \<in> ?A)" |
|
889 using assms embed_Field[of r r' f] embed_Field[of r' r g] by blast |
|
890 (* *) |
|
891 show ?thesis |
|
892 proof(unfold bij_betw_def inj_on_def, auto simp add: 2) |
|
893 fix a b assume *: "a \<in> ?A" "b \<in> ?A" and **: "f a = f b" |
|
894 have "a = g(f a) \<and> b = g(f b)" using * 1 by auto |
|
895 with ** show "a = b" by auto |
|
896 next |
|
897 fix a' assume *: "a' \<in> ?A'" |
|
898 hence "g a' \<in> ?A \<and> f(g a') = a'" using 1 2 by auto |
|
899 thus "a' \<in> f ` ?A" by force |
|
900 qed |
|
901 qed |
|
902 |
|
903 |
|
904 lemma embed_bothWays_iso: |
|
905 assumes WELL: "Well_order r" and WELL': "Well_order r'" and |
|
906 EMB: "embed r r' f" and EMB': "embed r' r g" |
|
907 shows "iso r r' f" |
|
908 unfolding iso_def using assms by (auto simp add: embed_bothWays_bij_betw) |
|
909 |
|
910 |
|
911 subsection {* More properties of embeddings, strict embeddings and isomorphisms *} |
|
912 |
|
913 |
|
914 lemma embed_bothWays_Field_bij_betw: |
|
915 assumes WELL: "Well_order r" and WELL': "Well_order r'" and |
|
916 EMB: "embed r r' f" and EMB': "embed r' r f'" |
|
917 shows "bij_betw f (Field r) (Field r')" |
|
918 proof- |
|
919 have "(\<forall>a \<in> Field r. f'(f a) = a) \<and> (\<forall>a' \<in> Field r'. f(f' a') = a')" |
|
920 using assms by (auto simp add: embed_bothWays_inverse) |
|
921 moreover |
|
922 have "f`(Field r) \<le> Field r' \<and> f' ` (Field r') \<le> Field r" |
|
923 using assms by (auto simp add: embed_Field) |
|
924 ultimately |
|
925 show ?thesis using bij_betw_byWitness[of "Field r" f' f "Field r'"] by auto |
|
926 qed |
|
927 |
|
928 |
|
929 lemma embedS_comp_embed: |
|
930 assumes WELL: "Well_order r" and WELL': "Well_order r'" and WELL'': "Well_order r''" |
|
931 and EMB: "embedS r r' f" and EMB': "embed r' r'' f'" |
|
932 shows "embedS r r'' (f' o f)" |
|
933 proof- |
|
934 let ?g = "(f' o f)" let ?h = "inv_into (Field r) ?g" |
|
935 have 1: "embed r r' f \<and> \<not> (bij_betw f (Field r) (Field r'))" |
|
936 using EMB by (auto simp add: embedS_def) |
|
937 hence 2: "embed r r'' ?g" |
|
938 using WELL EMB' comp_embed[of r r' f r'' f'] by auto |
|
939 moreover |
|
940 {assume "bij_betw ?g (Field r) (Field r'')" |
|
941 hence "embed r'' r ?h" using 2 WELL |
|
942 by (auto simp add: inv_into_Field_embed_bij_betw) |
|
943 hence "embed r' r (?h o f')" using WELL' EMB' |
|
944 by (auto simp add: comp_embed) |
|
945 hence "bij_betw f (Field r) (Field r')" using WELL WELL' 1 |
|
946 by (auto simp add: embed_bothWays_Field_bij_betw) |
|
947 with 1 have False by blast |
|
948 } |
|
949 ultimately show ?thesis unfolding embedS_def by auto |
|
950 qed |
|
951 |
|
952 |
|
953 lemma embed_comp_embedS: |
|
954 assumes WELL: "Well_order r" and WELL': "Well_order r'" and WELL'': "Well_order r''" |
|
955 and EMB: "embed r r' f" and EMB': "embedS r' r'' f'" |
|
956 shows "embedS r r'' (f' o f)" |
|
957 proof- |
|
958 let ?g = "(f' o f)" let ?h = "inv_into (Field r) ?g" |
|
959 have 1: "embed r' r'' f' \<and> \<not> (bij_betw f' (Field r') (Field r''))" |
|
960 using EMB' by (auto simp add: embedS_def) |
|
961 hence 2: "embed r r'' ?g" |
|
962 using WELL EMB comp_embed[of r r' f r'' f'] by auto |
|
963 moreover |
|
964 {assume "bij_betw ?g (Field r) (Field r'')" |
|
965 hence "embed r'' r ?h" using 2 WELL |
|
966 by (auto simp add: inv_into_Field_embed_bij_betw) |
|
967 hence "embed r'' r' (f o ?h)" using WELL'' EMB |
|
968 by (auto simp add: comp_embed) |
|
969 hence "bij_betw f' (Field r') (Field r'')" using WELL' WELL'' 1 |
|
970 by (auto simp add: embed_bothWays_Field_bij_betw) |
|
971 with 1 have False by blast |
|
972 } |
|
973 ultimately show ?thesis unfolding embedS_def by auto |
|
974 qed |
|
975 |
|
976 |
|
977 lemma embed_comp_iso: |
|
978 assumes WELL: "Well_order r" and WELL': "Well_order r'" and WELL'': "Well_order r''" |
|
979 and EMB: "embed r r' f" and EMB': "iso r' r'' f'" |
|
980 shows "embed r r'' (f' o f)" |
|
981 using assms unfolding iso_def |
|
982 by (auto simp add: comp_embed) |
|
983 |
|
984 |
|
985 lemma iso_comp_embed: |
|
986 assumes WELL: "Well_order r" and WELL': "Well_order r'" and WELL'': "Well_order r''" |
|
987 and EMB: "iso r r' f" and EMB': "embed r' r'' f'" |
|
988 shows "embed r r'' (f' o f)" |
|
989 using assms unfolding iso_def |
|
990 by (auto simp add: comp_embed) |
|
991 |
|
992 |
|
993 lemma embedS_comp_iso: |
|
994 assumes WELL: "Well_order r" and WELL': "Well_order r'" and WELL'': "Well_order r''" |
|
995 and EMB: "embedS r r' f" and EMB': "iso r' r'' f'" |
|
996 shows "embedS r r'' (f' o f)" |
|
997 using assms unfolding iso_def |
|
998 by (auto simp add: embedS_comp_embed) |
|
999 |
|
1000 |
|
1001 lemma iso_comp_embedS: |
|
1002 assumes WELL: "Well_order r" and WELL': "Well_order r'" and WELL'': "Well_order r''" |
|
1003 and EMB: "iso r r' f" and EMB': "embedS r' r'' f'" |
|
1004 shows "embedS r r'' (f' o f)" |
|
1005 using assms unfolding iso_def using embed_comp_embedS |
|
1006 by (auto simp add: embed_comp_embedS) |
|
1007 |
|
1008 |
|
1009 lemma embedS_Field: |
|
1010 assumes WELL: "Well_order r" and EMB: "embedS r r' f" |
|
1011 shows "f ` (Field r) < Field r'" |
|
1012 proof- |
|
1013 have "f`(Field r) \<le> Field r'" using assms |
|
1014 by (auto simp add: embed_Field embedS_def) |
|
1015 moreover |
|
1016 {have "inj_on f (Field r)" using assms |
|
1017 by (auto simp add: embedS_def embed_inj_on) |
|
1018 hence "f`(Field r) \<noteq> Field r'" using EMB |
|
1019 by (auto simp add: embedS_def bij_betw_def) |
|
1020 } |
|
1021 ultimately show ?thesis by blast |
|
1022 qed |
|
1023 |
|
1024 |
|
1025 lemma embedS_iff: |
|
1026 assumes WELL: "Well_order r" and ISO: "embed r r' f" |
|
1027 shows "embedS r r' f = (f ` (Field r) < Field r')" |
|
1028 proof |
|
1029 assume "embedS r r' f" |
|
1030 thus "f ` Field r \<subset> Field r'" |
|
1031 using WELL by (auto simp add: embedS_Field) |
|
1032 next |
|
1033 assume "f ` Field r \<subset> Field r'" |
|
1034 hence "\<not> bij_betw f (Field r) (Field r')" |
|
1035 unfolding bij_betw_def by blast |
|
1036 thus "embedS r r' f" unfolding embedS_def |
|
1037 using ISO by auto |
|
1038 qed |
|
1039 |
|
1040 |
|
1041 lemma iso_Field: |
|
1042 "iso r r' f \<Longrightarrow> f ` (Field r) = Field r'" |
|
1043 using assms by (auto simp add: iso_def bij_betw_def) |
|
1044 |
|
1045 |
|
1046 lemma iso_iff: |
|
1047 assumes "Well_order r" |
|
1048 shows "iso r r' f = (embed r r' f \<and> f ` (Field r) = Field r')" |
|
1049 proof |
|
1050 assume "iso r r' f" |
|
1051 thus "embed r r' f \<and> f ` (Field r) = Field r'" |
|
1052 by (auto simp add: iso_Field iso_def) |
|
1053 next |
|
1054 assume *: "embed r r' f \<and> f ` Field r = Field r'" |
|
1055 hence "inj_on f (Field r)" using assms by (auto simp add: embed_inj_on) |
|
1056 with * have "bij_betw f (Field r) (Field r')" |
|
1057 unfolding bij_betw_def by simp |
|
1058 with * show "iso r r' f" unfolding iso_def by auto |
|
1059 qed |
|
1060 |
|
1061 |
|
1062 lemma iso_iff2: |
|
1063 assumes "Well_order r" |
|
1064 shows "iso r r' f = (bij_betw f (Field r) (Field r') \<and> |
|
1065 (\<forall>a \<in> Field r. \<forall>b \<in> Field r. |
|
1066 (((a,b) \<in> r) = ((f a, f b) \<in> r'))))" |
|
1067 using assms |
|
1068 proof(auto simp add: iso_def) |
|
1069 fix a b |
|
1070 assume "embed r r' f" |
|
1071 hence "compat r r' f" using embed_compat[of r] by auto |
|
1072 moreover assume "(a,b) \<in> r" |
|
1073 ultimately show "(f a, f b) \<in> r'" using compat_def[of r] by auto |
|
1074 next |
|
1075 let ?f' = "inv_into (Field r) f" |
|
1076 assume "embed r r' f" and 1: "bij_betw f (Field r) (Field r')" |
|
1077 hence "embed r' r ?f'" using assms |
|
1078 by (auto simp add: inv_into_Field_embed_bij_betw) |
|
1079 hence 2: "compat r' r ?f'" using embed_compat[of r'] by auto |
|
1080 fix a b assume *: "a \<in> Field r" "b \<in> Field r" and **: "(f a,f b) \<in> r'" |
|
1081 hence "?f'(f a) = a \<and> ?f'(f b) = b" using 1 |
|
1082 by (auto simp add: bij_betw_inv_into_left) |
|
1083 thus "(a,b) \<in> r" using ** 2 compat_def[of r' r ?f'] by fastforce |
|
1084 next |
|
1085 assume *: "bij_betw f (Field r) (Field r')" and |
|
1086 **: "\<forall>a\<in>Field r. \<forall>b\<in>Field r. ((a, b) \<in> r) = ((f a, f b) \<in> r')" |
|
1087 have 1: "\<And> a. rel.under r a \<le> Field r \<and> rel.under r' (f a) \<le> Field r'" |
|
1088 by (auto simp add: rel.under_Field) |
|
1089 have 2: "inj_on f (Field r)" using * by (auto simp add: bij_betw_def) |
|
1090 {fix a assume ***: "a \<in> Field r" |
|
1091 have "bij_betw f (rel.under r a) (rel.under r' (f a))" |
|
1092 proof(unfold bij_betw_def, auto) |
|
1093 show "inj_on f (rel.under r a)" |
|
1094 using 1 2 by (auto simp add: subset_inj_on) |
|
1095 next |
|
1096 fix b assume "b \<in> rel.under r a" |
|
1097 hence "a \<in> Field r \<and> b \<in> Field r \<and> (b,a) \<in> r" |
|
1098 unfolding rel.under_def by (auto simp add: Field_def Range_def Domain_def) |
|
1099 with 1 ** show "f b \<in> rel.under r' (f a)" |
|
1100 unfolding rel.under_def by auto |
|
1101 next |
|
1102 fix b' assume "b' \<in> rel.under r' (f a)" |
|
1103 hence 3: "(b',f a) \<in> r'" unfolding rel.under_def by simp |
|
1104 hence "b' \<in> Field r'" unfolding Field_def by auto |
|
1105 with * obtain b where "b \<in> Field r \<and> f b = b'" |
|
1106 unfolding bij_betw_def by force |
|
1107 with 3 ** *** |
|
1108 show "b' \<in> f ` (rel.under r a)" unfolding rel.under_def by blast |
|
1109 qed |
|
1110 } |
|
1111 thus "embed r r' f" unfolding embed_def using * by auto |
|
1112 qed |
|
1113 |
|
1114 |
|
1115 lemma iso_iff3: |
|
1116 assumes WELL: "Well_order r" and WELL': "Well_order r'" |
|
1117 shows "iso r r' f = (bij_betw f (Field r) (Field r') \<and> compat r r' f)" |
|
1118 proof |
|
1119 assume "iso r r' f" |
|
1120 thus "bij_betw f (Field r) (Field r') \<and> compat r r' f" |
|
1121 unfolding compat_def using WELL by (auto simp add: iso_iff2 Field_def) |
|
1122 next |
|
1123 have Well: "wo_rel r \<and> wo_rel r'" using WELL WELL' |
|
1124 by (auto simp add: wo_rel_def) |
|
1125 assume *: "bij_betw f (Field r) (Field r') \<and> compat r r' f" |
|
1126 thus "iso r r' f" |
|
1127 unfolding "compat_def" using assms |
|
1128 proof(auto simp add: iso_iff2) |
|
1129 fix a b assume **: "a \<in> Field r" "b \<in> Field r" and |
|
1130 ***: "(f a, f b) \<in> r'" |
|
1131 {assume "(b,a) \<in> r \<or> b = a" |
|
1132 hence "(b,a): r"using Well ** wo_rel.REFL[of r] refl_on_def[of _ r] by blast |
|
1133 hence "(f b, f a) \<in> r'" using * unfolding compat_def by auto |
|
1134 hence "f a = f b" |
|
1135 using Well *** wo_rel.ANTISYM[of r'] antisym_def[of r'] by blast |
|
1136 hence "a = b" using * ** unfolding bij_betw_def inj_on_def by auto |
|
1137 hence "(a,b) \<in> r" using Well ** wo_rel.REFL[of r] refl_on_def[of _ r] by blast |
|
1138 } |
|
1139 thus "(a,b) \<in> r" |
|
1140 using Well ** wo_rel.TOTAL[of r] total_on_def[of _ r] by blast |
|
1141 qed |
|
1142 qed |
|
1143 |
|
1144 |
|
1145 |
|
1146 end |