8 header {* Constructions on Wellorders as Needed by Bounded Natural Functors *} |
8 header {* Constructions on Wellorders as Needed by Bounded Natural Functors *} |
9 |
9 |
10 theory BNF_Constructions_on_Wellorders |
10 theory BNF_Constructions_on_Wellorders |
11 imports BNF_Wellorder_Embedding |
11 imports BNF_Wellorder_Embedding |
12 begin |
12 begin |
13 |
|
14 |
13 |
15 text {* In this section, we study basic constructions on well-orders, such as restriction to |
14 text {* In this section, we study basic constructions on well-orders, such as restriction to |
16 a set/order filter, copy via direct images, ordinal-like sum of disjoint well-orders, |
15 a set/order filter, copy via direct images, ordinal-like sum of disjoint well-orders, |
17 and bounded square. We also define between well-orders |
16 and bounded square. We also define between well-orders |
18 the relations @{text "ordLeq"}, of being embedded (abbreviated @{text "\<le>o"}), |
17 the relations @{text "ordLeq"}, of being embedded (abbreviated @{text "\<le>o"}), |
19 @{text "ordLess"}, of being strictly embedded (abbreviated @{text "<o"}), and |
18 @{text "ordLess"}, of being strictly embedded (abbreviated @{text "<o"}), and |
20 @{text "ordIso"}, of being isomorphic (abbreviated @{text "=o"}). We study the |
19 @{text "ordIso"}, of being isomorphic (abbreviated @{text "=o"}). We study the |
21 connections between these relations, order filters, and the aforementioned constructions. |
20 connections between these relations, order filters, and the aforementioned constructions. |
22 A main result of this section is that @{text "<o"} is well-founded. *} |
21 A main result of this section is that @{text "<o"} is well-founded. *} |
23 |
22 |
24 |
23 |
25 subsection {* Restriction to a set *} |
24 subsection {* Restriction to a set *} |
26 |
|
27 |
25 |
28 abbreviation Restr :: "'a rel \<Rightarrow> 'a set \<Rightarrow> 'a rel" |
26 abbreviation Restr :: "'a rel \<Rightarrow> 'a set \<Rightarrow> 'a rel" |
29 where "Restr r A \<equiv> r Int (A \<times> A)" |
27 where "Restr r A \<equiv> r Int (A \<times> A)" |
30 |
|
31 |
28 |
32 lemma Restr_subset: |
29 lemma Restr_subset: |
33 "A \<le> B \<Longrightarrow> Restr (Restr r B) A = Restr r A" |
30 "A \<le> B \<Longrightarrow> Restr (Restr r B) A = Restr r A" |
34 by blast |
31 by blast |
35 |
32 |
36 |
|
37 lemma Restr_Field: "Restr r (Field r) = r" |
33 lemma Restr_Field: "Restr r (Field r) = r" |
38 unfolding Field_def by auto |
34 unfolding Field_def by auto |
39 |
35 |
40 |
|
41 lemma Refl_Restr: "Refl r \<Longrightarrow> Refl(Restr r A)" |
36 lemma Refl_Restr: "Refl r \<Longrightarrow> Refl(Restr r A)" |
42 unfolding refl_on_def Field_def by auto |
37 unfolding refl_on_def Field_def by auto |
43 |
|
44 |
38 |
45 lemma antisym_Restr: |
39 lemma antisym_Restr: |
46 "antisym r \<Longrightarrow> antisym(Restr r A)" |
40 "antisym r \<Longrightarrow> antisym(Restr r A)" |
47 unfolding antisym_def Field_def by auto |
41 unfolding antisym_def Field_def by auto |
48 |
42 |
49 |
|
50 lemma Total_Restr: |
43 lemma Total_Restr: |
51 "Total r \<Longrightarrow> Total(Restr r A)" |
44 "Total r \<Longrightarrow> Total(Restr r A)" |
52 unfolding total_on_def Field_def by auto |
45 unfolding total_on_def Field_def by auto |
53 |
46 |
54 |
|
55 lemma trans_Restr: |
47 lemma trans_Restr: |
56 "trans r \<Longrightarrow> trans(Restr r A)" |
48 "trans r \<Longrightarrow> trans(Restr r A)" |
57 unfolding trans_def Field_def by blast |
49 unfolding trans_def Field_def by blast |
58 |
50 |
59 |
|
60 lemma Preorder_Restr: |
51 lemma Preorder_Restr: |
61 "Preorder r \<Longrightarrow> Preorder(Restr r A)" |
52 "Preorder r \<Longrightarrow> Preorder(Restr r A)" |
62 unfolding preorder_on_def by (simp add: Refl_Restr trans_Restr) |
53 unfolding preorder_on_def by (simp add: Refl_Restr trans_Restr) |
63 |
54 |
64 |
|
65 lemma Partial_order_Restr: |
55 lemma Partial_order_Restr: |
66 "Partial_order r \<Longrightarrow> Partial_order(Restr r A)" |
56 "Partial_order r \<Longrightarrow> Partial_order(Restr r A)" |
67 unfolding partial_order_on_def by (simp add: Preorder_Restr antisym_Restr) |
57 unfolding partial_order_on_def by (simp add: Preorder_Restr antisym_Restr) |
68 |
58 |
69 |
|
70 lemma Linear_order_Restr: |
59 lemma Linear_order_Restr: |
71 "Linear_order r \<Longrightarrow> Linear_order(Restr r A)" |
60 "Linear_order r \<Longrightarrow> Linear_order(Restr r A)" |
72 unfolding linear_order_on_def by (simp add: Partial_order_Restr Total_Restr) |
61 unfolding linear_order_on_def by (simp add: Partial_order_Restr Total_Restr) |
73 |
|
74 |
62 |
75 lemma Well_order_Restr: |
63 lemma Well_order_Restr: |
76 assumes "Well_order r" |
64 assumes "Well_order r" |
77 shows "Well_order(Restr r A)" |
65 shows "Well_order(Restr r A)" |
78 proof- |
66 proof- |
81 using well_order_on_def wf_subset by blast |
69 using well_order_on_def wf_subset by blast |
82 thus ?thesis using assms unfolding well_order_on_def |
70 thus ?thesis using assms unfolding well_order_on_def |
83 by (simp add: Linear_order_Restr) |
71 by (simp add: Linear_order_Restr) |
84 qed |
72 qed |
85 |
73 |
86 |
|
87 lemma Field_Restr_subset: "Field(Restr r A) \<le> A" |
74 lemma Field_Restr_subset: "Field(Restr r A) \<le> A" |
88 by (auto simp add: Field_def) |
75 by (auto simp add: Field_def) |
89 |
|
90 |
76 |
91 lemma Refl_Field_Restr: |
77 lemma Refl_Field_Restr: |
92 "Refl r \<Longrightarrow> Field(Restr r A) = (Field r) Int A" |
78 "Refl r \<Longrightarrow> Field(Restr r A) = (Field r) Int A" |
93 unfolding refl_on_def Field_def by blast |
79 unfolding refl_on_def Field_def by blast |
94 |
80 |
95 |
|
96 lemma Refl_Field_Restr2: |
81 lemma Refl_Field_Restr2: |
97 "\<lbrakk>Refl r; A \<le> Field r\<rbrakk> \<Longrightarrow> Field(Restr r A) = A" |
82 "\<lbrakk>Refl r; A \<le> Field r\<rbrakk> \<Longrightarrow> Field(Restr r A) = A" |
98 by (auto simp add: Refl_Field_Restr) |
83 by (auto simp add: Refl_Field_Restr) |
99 |
|
100 |
84 |
101 lemma well_order_on_Restr: |
85 lemma well_order_on_Restr: |
102 assumes WELL: "Well_order r" and SUB: "A \<le> Field r" |
86 assumes WELL: "Well_order r" and SUB: "A \<le> Field r" |
103 shows "well_order_on A (Restr r A)" |
87 shows "well_order_on A (Restr r A)" |
104 using assms |
88 using assms |
105 using Well_order_Restr[of r A] Refl_Field_Restr2[of r A] |
89 using Well_order_Restr[of r A] Refl_Field_Restr2[of r A] |
106 order_on_defs[of "Field r" r] by auto |
90 order_on_defs[of "Field r" r] by auto |
107 |
91 |
108 |
92 |
109 subsection {* Order filters versus restrictions and embeddings *} |
93 subsection {* Order filters versus restrictions and embeddings *} |
110 |
|
111 |
94 |
112 lemma Field_Restr_ofilter: |
95 lemma Field_Restr_ofilter: |
113 "\<lbrakk>Well_order r; wo_rel.ofilter r A\<rbrakk> \<Longrightarrow> Field(Restr r A) = A" |
96 "\<lbrakk>Well_order r; wo_rel.ofilter r A\<rbrakk> \<Longrightarrow> Field(Restr r A) = A" |
114 by (auto simp add: wo_rel_def wo_rel.ofilter_def wo_rel.REFL Refl_Field_Restr2) |
97 by (auto simp add: wo_rel_def wo_rel.ofilter_def wo_rel.REFL Refl_Field_Restr2) |
115 |
|
116 |
98 |
117 lemma ofilter_Restr_under: |
99 lemma ofilter_Restr_under: |
118 assumes WELL: "Well_order r" and OF: "wo_rel.ofilter r A" and IN: "a \<in> A" |
100 assumes WELL: "Well_order r" and OF: "wo_rel.ofilter r A" and IN: "a \<in> A" |
119 shows "under (Restr r A) a = under r a" |
101 shows "under (Restr r A) a = under r a" |
120 using assms wo_rel_def |
102 using assms wo_rel_def |
181 fix a b assume "a \<in> A" and "(b,a) \<in> r" |
161 fix a b assume "a \<in> A" and "(b,a) \<in> r" |
182 thus "b \<in> A" using Well OFA by (auto simp add: wo_rel.ofilter_def under_def) |
162 thus "b \<in> A" using Well OFA by (auto simp add: wo_rel.ofilter_def under_def) |
183 qed |
163 qed |
184 qed |
164 qed |
185 |
165 |
186 |
|
187 lemma ofilter_Restr_subset: |
166 lemma ofilter_Restr_subset: |
188 assumes WELL: "Well_order r" and OFA: "wo_rel.ofilter r A" and SUB: "A \<le> B" |
167 assumes WELL: "Well_order r" and OFA: "wo_rel.ofilter r A" and SUB: "A \<le> B" |
189 shows "wo_rel.ofilter (Restr r B) A" |
168 shows "wo_rel.ofilter (Restr r B) A" |
190 proof- |
169 proof- |
191 have "A Int B = A" using SUB by blast |
170 have "A Int B = A" using SUB by blast |
192 thus ?thesis using assms ofilter_Restr_Int[of r A B] by auto |
171 thus ?thesis using assms ofilter_Restr_Int[of r A B] by auto |
193 qed |
172 qed |
194 |
|
195 |
173 |
196 lemma ofilter_subset_embed: |
174 lemma ofilter_subset_embed: |
197 assumes WELL: "Well_order r" and |
175 assumes WELL: "Well_order r" and |
198 OFA: "wo_rel.ofilter r A" and OFB: "wo_rel.ofilter r B" |
176 OFA: "wo_rel.ofilter r A" and OFB: "wo_rel.ofilter r B" |
199 shows "(A \<le> B) = (embed (Restr r A) (Restr r B) id)" |
177 shows "(A \<le> B) = (embed (Restr r A) (Restr r B) id)" |
253 show ?thesis unfolding embedS_def iso_def |
230 show ?thesis unfolding embedS_def iso_def |
254 using assms ofilter_subset_embed[of r A B] |
231 using assms ofilter_subset_embed[of r A B] |
255 FieldA FieldB bij_betw_id_iff[of A B] by auto |
232 FieldA FieldB bij_betw_id_iff[of A B] by auto |
256 qed |
233 qed |
257 |
234 |
258 |
|
259 lemma ofilter_subset_embedS: |
235 lemma ofilter_subset_embedS: |
260 assumes WELL: "Well_order r" and |
236 assumes WELL: "Well_order r" and |
261 OFA: "wo_rel.ofilter r A" and OFB: "wo_rel.ofilter r B" |
237 OFA: "wo_rel.ofilter r A" and OFB: "wo_rel.ofilter r B" |
262 shows "(A < B) = embedS (Restr r A) (Restr r B) id" |
238 shows "(A < B) = embedS (Restr r A) (Restr r B) id" |
263 using assms by (simp add: ofilter_subset_embedS_iso) |
239 using assms by (simp add: ofilter_subset_embedS_iso) |
264 |
|
265 |
240 |
266 lemma embed_implies_iso_Restr: |
241 lemma embed_implies_iso_Restr: |
267 assumes WELL: "Well_order r" and WELL': "Well_order r'" and |
242 assumes WELL: "Well_order r" and WELL': "Well_order r'" and |
268 EMB: "embed r' r f" |
243 EMB: "embed r' r f" |
269 shows "iso r' (Restr r (f ` (Field r'))) f" |
244 shows "iso r' (Restr r (f ` (Field r'))) f" |
343 The prefix "ord" and the index "o" in these names stand for "ordinal-like". |
314 The prefix "ord" and the index "o" in these names stand for "ordinal-like". |
344 These relations shall be proved to be inter-connected in a similar fashion as the trio |
315 These relations shall be proved to be inter-connected in a similar fashion as the trio |
345 @{text "\<le>"}, @{text "<"}, @{text "="} associated to a total order on a set. |
316 @{text "\<le>"}, @{text "<"}, @{text "="} associated to a total order on a set. |
346 *} |
317 *} |
347 |
318 |
348 |
|
349 definition ordLeq :: "('a rel * 'a' rel) set" |
319 definition ordLeq :: "('a rel * 'a' rel) set" |
350 where |
320 where |
351 "ordLeq = {(r,r'). Well_order r \<and> Well_order r' \<and> (\<exists>f. embed r r' f)}" |
321 "ordLeq = {(r,r'). Well_order r \<and> Well_order r' \<and> (\<exists>f. embed r r' f)}" |
352 |
322 |
353 |
|
354 abbreviation ordLeq2 :: "'a rel \<Rightarrow> 'a' rel \<Rightarrow> bool" (infix "<=o" 50) |
323 abbreviation ordLeq2 :: "'a rel \<Rightarrow> 'a' rel \<Rightarrow> bool" (infix "<=o" 50) |
355 where "r <=o r' \<equiv> (r,r') \<in> ordLeq" |
324 where "r <=o r' \<equiv> (r,r') \<in> ordLeq" |
356 |
325 |
357 |
|
358 abbreviation ordLeq3 :: "'a rel \<Rightarrow> 'a' rel \<Rightarrow> bool" (infix "\<le>o" 50) |
326 abbreviation ordLeq3 :: "'a rel \<Rightarrow> 'a' rel \<Rightarrow> bool" (infix "\<le>o" 50) |
359 where "r \<le>o r' \<equiv> r <=o r'" |
327 where "r \<le>o r' \<equiv> r <=o r'" |
360 |
|
361 |
328 |
362 definition ordLess :: "('a rel * 'a' rel) set" |
329 definition ordLess :: "('a rel * 'a' rel) set" |
363 where |
330 where |
364 "ordLess = {(r,r'). Well_order r \<and> Well_order r' \<and> (\<exists>f. embedS r r' f)}" |
331 "ordLess = {(r,r'). Well_order r \<and> Well_order r' \<and> (\<exists>f. embedS r r' f)}" |
365 |
332 |
366 abbreviation ordLess2 :: "'a rel \<Rightarrow> 'a' rel \<Rightarrow> bool" (infix "<o" 50) |
333 abbreviation ordLess2 :: "'a rel \<Rightarrow> 'a' rel \<Rightarrow> bool" (infix "<o" 50) |
367 where "r <o r' \<equiv> (r,r') \<in> ordLess" |
334 where "r <o r' \<equiv> (r,r') \<in> ordLess" |
368 |
335 |
369 |
|
370 definition ordIso :: "('a rel * 'a' rel) set" |
336 definition ordIso :: "('a rel * 'a' rel) set" |
371 where |
337 where |
372 "ordIso = {(r,r'). Well_order r \<and> Well_order r' \<and> (\<exists>f. iso r r' f)}" |
338 "ordIso = {(r,r'). Well_order r \<and> Well_order r' \<and> (\<exists>f. iso r r' f)}" |
373 |
339 |
374 abbreviation ordIso2 :: "'a rel \<Rightarrow> 'a' rel \<Rightarrow> bool" (infix "=o" 50) |
340 abbreviation ordIso2 :: "'a rel \<Rightarrow> 'a' rel \<Rightarrow> bool" (infix "=o" 50) |
375 where "r =o r' \<equiv> (r,r') \<in> ordIso" |
341 where "r =o r' \<equiv> (r,r') \<in> ordIso" |
376 |
|
377 |
342 |
378 lemmas ordRels_def = ordLeq_def ordLess_def ordIso_def |
343 lemmas ordRels_def = ordLeq_def ordLess_def ordIso_def |
379 |
344 |
380 lemma ordLeq_Well_order_simp: |
345 lemma ordLeq_Well_order_simp: |
381 assumes "r \<le>o r'" |
346 assumes "r \<le>o r'" |
382 shows "Well_order r \<and> Well_order r'" |
347 shows "Well_order r \<and> Well_order r'" |
383 using assms unfolding ordLeq_def by simp |
348 using assms unfolding ordLeq_def by simp |
384 |
349 |
385 |
|
386 text{* Notice that the relations @{text "\<le>o"}, @{text "<o"}, @{text "=o"} connect well-orders |
350 text{* Notice that the relations @{text "\<le>o"}, @{text "<o"}, @{text "=o"} connect well-orders |
387 on potentially {\em distinct} types. However, some of the lemmas below, including the next one, |
351 on potentially {\em distinct} types. However, some of the lemmas below, including the next one, |
388 restrict implicitly the type of these relations to @{text "(('a rel) * ('a rel)) set"} , i.e., |
352 restrict implicitly the type of these relations to @{text "(('a rel) * ('a rel)) set"} , i.e., |
389 to @{text "'a rel rel"}. *} |
353 to @{text "'a rel rel"}. *} |
390 |
|
391 |
354 |
392 lemma ordLeq_reflexive: |
355 lemma ordLeq_reflexive: |
393 "Well_order r \<Longrightarrow> r \<le>o r" |
356 "Well_order r \<Longrightarrow> r \<le>o r" |
394 unfolding ordLeq_def using id_embed[of r] by blast |
357 unfolding ordLeq_def using id_embed[of r] by blast |
395 |
|
396 |
358 |
397 lemma ordLeq_transitive[trans]: |
359 lemma ordLeq_transitive[trans]: |
398 assumes *: "r \<le>o r'" and **: "r' \<le>o r''" |
360 assumes *: "r \<le>o r'" and **: "r' \<le>o r''" |
399 shows "r \<le>o r''" |
361 shows "r \<le>o r''" |
400 proof- |
362 proof- |
405 hence "embed r r'' (f' o f)" |
367 hence "embed r r'' (f' o f)" |
406 using comp_embed[of r r' f r'' f'] by auto |
368 using comp_embed[of r r' f r'' f'] by auto |
407 thus "r \<le>o r''" unfolding ordLeq_def using 1 by auto |
369 thus "r \<le>o r''" unfolding ordLeq_def using 1 by auto |
408 qed |
370 qed |
409 |
371 |
410 |
|
411 lemma ordLeq_total: |
372 lemma ordLeq_total: |
412 "\<lbrakk>Well_order r; Well_order r'\<rbrakk> \<Longrightarrow> r \<le>o r' \<or> r' \<le>o r" |
373 "\<lbrakk>Well_order r; Well_order r'\<rbrakk> \<Longrightarrow> r \<le>o r' \<or> r' \<le>o r" |
413 unfolding ordLeq_def using wellorders_totally_ordered by blast |
374 unfolding ordLeq_def using wellorders_totally_ordered by blast |
414 |
375 |
415 |
|
416 lemma ordIso_reflexive: |
376 lemma ordIso_reflexive: |
417 "Well_order r \<Longrightarrow> r =o r" |
377 "Well_order r \<Longrightarrow> r =o r" |
418 unfolding ordIso_def using id_iso[of r] by blast |
378 unfolding ordIso_def using id_iso[of r] by blast |
419 |
|
420 |
379 |
421 lemma ordIso_transitive[trans]: |
380 lemma ordIso_transitive[trans]: |
422 assumes *: "r =o r'" and **: "r' =o r''" |
381 assumes *: "r =o r'" and **: "r' =o r''" |
423 shows "r =o r''" |
382 shows "r =o r''" |
424 proof- |
383 proof- |
443 have "embed r' r ?f' \<and> bij_betw ?f' (Field r') (Field r)" |
401 have "embed r' r ?f' \<and> bij_betw ?f' (Field r') (Field r)" |
444 using 1 2 by (simp add: bij_betw_inv_into inv_into_Field_embed_bij_betw) |
402 using 1 2 by (simp add: bij_betw_inv_into inv_into_Field_embed_bij_betw) |
445 thus "r' =o r" unfolding ordIso_def using 1 by (auto simp add: iso_def) |
403 thus "r' =o r" unfolding ordIso_def using 1 by (auto simp add: iso_def) |
446 qed |
404 qed |
447 |
405 |
448 |
|
449 lemma ordLeq_ordLess_trans[trans]: |
406 lemma ordLeq_ordLess_trans[trans]: |
450 assumes "r \<le>o r'" and " r' <o r''" |
407 assumes "r \<le>o r'" and " r' <o r''" |
451 shows "r <o r''" |
408 shows "r <o r''" |
452 proof- |
409 proof- |
453 have "Well_order r \<and> Well_order r''" |
410 have "Well_order r \<and> Well_order r''" |
454 using assms unfolding ordLeq_def ordLess_def by auto |
411 using assms unfolding ordLeq_def ordLess_def by auto |
455 thus ?thesis using assms unfolding ordLeq_def ordLess_def |
412 thus ?thesis using assms unfolding ordLeq_def ordLess_def |
456 using embed_comp_embedS by blast |
413 using embed_comp_embedS by blast |
457 qed |
414 qed |
458 |
415 |
459 |
|
460 lemma ordLess_ordLeq_trans[trans]: |
416 lemma ordLess_ordLeq_trans[trans]: |
461 assumes "r <o r'" and " r' \<le>o r''" |
417 assumes "r <o r'" and " r' \<le>o r''" |
462 shows "r <o r''" |
418 shows "r <o r''" |
463 proof- |
419 proof- |
464 have "Well_order r \<and> Well_order r''" |
420 have "Well_order r \<and> Well_order r''" |
465 using assms unfolding ordLeq_def ordLess_def by auto |
421 using assms unfolding ordLeq_def ordLess_def by auto |
466 thus ?thesis using assms unfolding ordLeq_def ordLess_def |
422 thus ?thesis using assms unfolding ordLeq_def ordLess_def |
467 using embedS_comp_embed by blast |
423 using embedS_comp_embed by blast |
468 qed |
424 qed |
469 |
425 |
470 |
|
471 lemma ordLeq_ordIso_trans[trans]: |
426 lemma ordLeq_ordIso_trans[trans]: |
472 assumes "r \<le>o r'" and " r' =o r''" |
427 assumes "r \<le>o r'" and " r' =o r''" |
473 shows "r \<le>o r''" |
428 shows "r \<le>o r''" |
474 proof- |
429 proof- |
475 have "Well_order r \<and> Well_order r''" |
430 have "Well_order r \<and> Well_order r''" |
476 using assms unfolding ordLeq_def ordIso_def by auto |
431 using assms unfolding ordLeq_def ordIso_def by auto |
477 thus ?thesis using assms unfolding ordLeq_def ordIso_def |
432 thus ?thesis using assms unfolding ordLeq_def ordIso_def |
478 using embed_comp_iso by blast |
433 using embed_comp_iso by blast |
479 qed |
434 qed |
480 |
435 |
481 |
|
482 lemma ordIso_ordLeq_trans[trans]: |
436 lemma ordIso_ordLeq_trans[trans]: |
483 assumes "r =o r'" and " r' \<le>o r''" |
437 assumes "r =o r'" and " r' \<le>o r''" |
484 shows "r \<le>o r''" |
438 shows "r \<le>o r''" |
485 proof- |
439 proof- |
486 have "Well_order r \<and> Well_order r''" |
440 have "Well_order r \<and> Well_order r''" |
487 using assms unfolding ordLeq_def ordIso_def by auto |
441 using assms unfolding ordLeq_def ordIso_def by auto |
488 thus ?thesis using assms unfolding ordLeq_def ordIso_def |
442 thus ?thesis using assms unfolding ordLeq_def ordIso_def |
489 using iso_comp_embed by blast |
443 using iso_comp_embed by blast |
490 qed |
444 qed |
491 |
445 |
492 |
|
493 lemma ordLess_ordIso_trans[trans]: |
446 lemma ordLess_ordIso_trans[trans]: |
494 assumes "r <o r'" and " r' =o r''" |
447 assumes "r <o r'" and " r' =o r''" |
495 shows "r <o r''" |
448 shows "r <o r''" |
496 proof- |
449 proof- |
497 have "Well_order r \<and> Well_order r''" |
450 have "Well_order r \<and> Well_order r''" |
498 using assms unfolding ordLess_def ordIso_def by auto |
451 using assms unfolding ordLess_def ordIso_def by auto |
499 thus ?thesis using assms unfolding ordLess_def ordIso_def |
452 thus ?thesis using assms unfolding ordLess_def ordIso_def |
500 using embedS_comp_iso by blast |
453 using embedS_comp_iso by blast |
501 qed |
454 qed |
502 |
455 |
503 |
|
504 lemma ordIso_ordLess_trans[trans]: |
456 lemma ordIso_ordLess_trans[trans]: |
505 assumes "r =o r'" and " r' <o r''" |
457 assumes "r =o r'" and " r' <o r''" |
506 shows "r <o r''" |
458 shows "r <o r''" |
507 proof- |
459 proof- |
508 have "Well_order r \<and> Well_order r''" |
460 have "Well_order r \<and> Well_order r''" |
509 using assms unfolding ordLess_def ordIso_def by auto |
461 using assms unfolding ordLess_def ordIso_def by auto |
510 thus ?thesis using assms unfolding ordLess_def ordIso_def |
462 thus ?thesis using assms unfolding ordLess_def ordIso_def |
511 using iso_comp_embedS by blast |
463 using iso_comp_embedS by blast |
512 qed |
464 qed |
513 |
|
514 |
465 |
515 lemma ordLess_not_embed: |
466 lemma ordLess_not_embed: |
516 assumes "r <o r'" |
467 assumes "r <o r'" |
517 shows "\<not>(\<exists>f'. embed r' r f')" |
468 shows "\<not>(\<exists>f'. embed r' r f')" |
518 proof- |
469 proof- |
566 } |
515 } |
567 ultimately show "(r,r') \<in> ordLess" |
516 ultimately show "(r,r') \<in> ordLess" |
568 unfolding ordLess_def using * by (fastforce simp add: embedS_def) |
517 unfolding ordLess_def using * by (fastforce simp add: embedS_def) |
569 qed |
518 qed |
570 |
519 |
571 |
|
572 lemma ordLess_irreflexive: "\<not> r <o r" |
520 lemma ordLess_irreflexive: "\<not> r <o r" |
573 proof |
521 proof |
574 assume "r <o r" |
522 assume "r <o r" |
575 hence "Well_order r \<and> \<not>(\<exists>f. embed r r f)" |
523 hence "Well_order r \<and> \<not>(\<exists>f. embed r r f)" |
576 unfolding ordLess_iff .. |
524 unfolding ordLess_iff .. |
577 moreover have "embed r r id" using id_embed[of r] . |
525 moreover have "embed r r id" using id_embed[of r] . |
578 ultimately show False by blast |
526 ultimately show False by blast |
579 qed |
527 qed |
580 |
528 |
581 |
|
582 lemma ordLeq_iff_ordLess_or_ordIso: |
529 lemma ordLeq_iff_ordLess_or_ordIso: |
583 "r \<le>o r' = (r <o r' \<or> r =o r')" |
530 "r \<le>o r' = (r <o r' \<or> r =o r')" |
584 unfolding ordRels_def embedS_defs iso_defs by blast |
531 unfolding ordRels_def embedS_defs iso_defs by blast |
585 |
|
586 |
532 |
587 lemma ordIso_iff_ordLeq: |
533 lemma ordIso_iff_ordLeq: |
588 "(r =o r') = (r \<le>o r' \<and> r' \<le>o r)" |
534 "(r =o r') = (r \<le>o r' \<and> r' \<le>o r)" |
589 proof |
535 proof |
590 assume "r =o r'" |
536 assume "r =o r'" |
602 unfolding ordLeq_def by auto |
548 unfolding ordLeq_def by auto |
603 hence "iso r r' f" by (auto simp add: embed_bothWays_iso) |
549 hence "iso r r' f" by (auto simp add: embed_bothWays_iso) |
604 thus "r =o r'" unfolding ordIso_def using 1 by auto |
550 thus "r =o r'" unfolding ordIso_def using 1 by auto |
605 qed |
551 qed |
606 |
552 |
607 |
|
608 lemma not_ordLess_ordLeq: |
553 lemma not_ordLess_ordLeq: |
609 "r <o r' \<Longrightarrow> \<not> r' \<le>o r" |
554 "r <o r' \<Longrightarrow> \<not> r' \<le>o r" |
610 using ordLess_ordLeq_trans ordLess_irreflexive by blast |
555 using ordLess_ordLeq_trans ordLess_irreflexive by blast |
611 |
|
612 |
556 |
613 lemma ordLess_or_ordLeq: |
557 lemma ordLess_or_ordLeq: |
614 assumes WELL: "Well_order r" and WELL': "Well_order r'" |
558 assumes WELL: "Well_order r" and WELL': "Well_order r'" |
615 shows "r <o r' \<or> r' \<le>o r" |
559 shows "r <o r' \<or> r' \<le>o r" |
616 proof- |
560 proof- |
622 hence "r' \<le>o r" using ordIso_symmetric ordIso_iff_ordLeq by blast |
566 hence "r' \<le>o r" using ordIso_symmetric ordIso_iff_ordLeq by blast |
623 } |
567 } |
624 ultimately show ?thesis by blast |
568 ultimately show ?thesis by blast |
625 qed |
569 qed |
626 |
570 |
627 |
|
628 lemma not_ordLess_ordIso: |
571 lemma not_ordLess_ordIso: |
629 "r <o r' \<Longrightarrow> \<not> r =o r'" |
572 "r <o r' \<Longrightarrow> \<not> r =o r'" |
630 using assms ordLess_ordIso_trans ordIso_symmetric ordLess_irreflexive by blast |
573 using assms ordLess_ordIso_trans ordIso_symmetric ordLess_irreflexive by blast |
631 |
|
632 |
574 |
633 lemma not_ordLeq_iff_ordLess: |
575 lemma not_ordLeq_iff_ordLess: |
634 assumes WELL: "Well_order r" and WELL': "Well_order r'" |
576 assumes WELL: "Well_order r" and WELL': "Well_order r'" |
635 shows "(\<not> r' \<le>o r) = (r <o r')" |
577 shows "(\<not> r' \<le>o r) = (r <o r')" |
636 using assms not_ordLess_ordLeq ordLess_or_ordLeq by blast |
578 using assms not_ordLess_ordLeq ordLess_or_ordLeq by blast |
637 |
579 |
638 |
|
639 lemma not_ordLess_iff_ordLeq: |
580 lemma not_ordLess_iff_ordLeq: |
640 assumes WELL: "Well_order r" and WELL': "Well_order r'" |
581 assumes WELL: "Well_order r" and WELL': "Well_order r'" |
641 shows "(\<not> r' <o r) = (r \<le>o r')" |
582 shows "(\<not> r' <o r) = (r \<le>o r')" |
642 using assms not_ordLess_ordLeq ordLess_or_ordLeq by blast |
583 using assms not_ordLess_ordLeq ordLess_or_ordLeq by blast |
643 |
584 |
644 |
|
645 lemma ordLess_transitive[trans]: |
585 lemma ordLess_transitive[trans]: |
646 "\<lbrakk>r <o r'; r' <o r''\<rbrakk> \<Longrightarrow> r <o r''" |
586 "\<lbrakk>r <o r'; r' <o r''\<rbrakk> \<Longrightarrow> r <o r''" |
647 using assms ordLess_ordLeq_trans ordLeq_iff_ordLess_or_ordIso by blast |
587 using assms ordLess_ordLeq_trans ordLeq_iff_ordLess_or_ordIso by blast |
648 |
588 |
649 |
|
650 corollary ordLess_trans: "trans ordLess" |
589 corollary ordLess_trans: "trans ordLess" |
651 unfolding trans_def using ordLess_transitive by blast |
590 unfolding trans_def using ordLess_transitive by blast |
652 |
591 |
653 |
|
654 lemmas ordIso_equivalence = ordIso_transitive ordIso_reflexive ordIso_symmetric |
592 lemmas ordIso_equivalence = ordIso_transitive ordIso_reflexive ordIso_symmetric |
655 |
|
656 |
593 |
657 lemma ordIso_imp_ordLeq: |
594 lemma ordIso_imp_ordLeq: |
658 "r =o r' \<Longrightarrow> r \<le>o r'" |
595 "r =o r' \<Longrightarrow> r \<le>o r'" |
659 using ordIso_iff_ordLeq by blast |
596 using ordIso_iff_ordLeq by blast |
660 |
597 |
661 |
|
662 lemma ordLess_imp_ordLeq: |
598 lemma ordLess_imp_ordLeq: |
663 "r <o r' \<Longrightarrow> r \<le>o r'" |
599 "r <o r' \<Longrightarrow> r \<le>o r'" |
664 using ordLeq_iff_ordLess_or_ordIso by blast |
600 using ordLeq_iff_ordLess_or_ordIso by blast |
665 |
|
666 |
601 |
667 lemma ofilter_subset_ordLeq: |
602 lemma ofilter_subset_ordLeq: |
668 assumes WELL: "Well_order r" and |
603 assumes WELL: "Well_order r" and |
669 OFA: "wo_rel.ofilter r A" and OFB: "wo_rel.ofilter r B" |
604 OFA: "wo_rel.ofilter r A" and OFB: "wo_rel.ofilter r B" |
670 shows "(A \<le> B) = (Restr r A \<le>o Restr r B)" |
605 shows "(A \<le> B) = (Restr r A \<le>o Restr r B)" |
703 also have "\<dots> = (Restr r A <o Restr r B)" |
637 also have "\<dots> = (Restr r A <o Restr r B)" |
704 using 1 not_ordLeq_iff_ordLess by blast |
638 using 1 not_ordLeq_iff_ordLess by blast |
705 finally show ?thesis . |
639 finally show ?thesis . |
706 qed |
640 qed |
707 |
641 |
708 |
|
709 lemma ofilter_ordLess: |
642 lemma ofilter_ordLess: |
710 "\<lbrakk>Well_order r; wo_rel.ofilter r A\<rbrakk> \<Longrightarrow> (A < Field r) = (Restr r A <o r)" |
643 "\<lbrakk>Well_order r; wo_rel.ofilter r A\<rbrakk> \<Longrightarrow> (A < Field r) = (Restr r A <o r)" |
711 by (simp add: ofilter_subset_ordLess wo_rel.Field_ofilter |
644 by (simp add: ofilter_subset_ordLess wo_rel.Field_ofilter |
712 wo_rel_def Restr_Field) |
645 wo_rel_def Restr_Field) |
713 |
646 |
714 |
|
715 corollary underS_Restr_ordLess: |
647 corollary underS_Restr_ordLess: |
716 assumes "Well_order r" and "Field r \<noteq> {}" |
648 assumes "Well_order r" and "Field r \<noteq> {}" |
717 shows "Restr r (underS r a) <o r" |
649 shows "Restr r (underS r a) <o r" |
718 proof- |
650 proof- |
719 have "underS r a < Field r" using assms |
651 have "underS r a < Field r" using assms |
720 by (simp add: underS_Field3) |
652 by (simp add: underS_Field3) |
721 thus ?thesis using assms |
653 thus ?thesis using assms |
722 by (simp add: ofilter_ordLess wo_rel.underS_ofilter wo_rel_def) |
654 by (simp add: ofilter_ordLess wo_rel.underS_ofilter wo_rel_def) |
723 qed |
655 qed |
724 |
|
725 |
656 |
726 lemma embed_ordLess_ofilterIncl: |
657 lemma embed_ordLess_ofilterIncl: |
727 assumes |
658 assumes |
728 OL12: "r1 <o r2" and OL23: "r2 <o r3" and |
659 OL12: "r1 <o r2" and OL23: "r2 <o r3" and |
729 EMB13: "embed r1 r3 f13" and EMB23: "embed r2 r3 f23" |
660 EMB13: "embed r1 r3 f13" and EMB23: "embed r2 r3 f23" |
895 thus "r =o r'" unfolding ordIso_def iso_def[abs_def] using 1 2 by auto |
820 thus "r =o r'" unfolding ordIso_def iso_def[abs_def] using 1 2 by auto |
896 qed |
821 qed |
897 ultimately show ?thesis using assms ordLeq_total ordIso_symmetric by metis |
822 ultimately show ?thesis using assms ordLeq_total ordIso_symmetric by metis |
898 qed |
823 qed |
899 |
824 |
900 |
|
901 subsection{* @{text "<o"} is well-founded *} |
825 subsection{* @{text "<o"} is well-founded *} |
902 |
|
903 |
826 |
904 text {* Of course, it only makes sense to state that the @{text "<o"} is well-founded |
827 text {* Of course, it only makes sense to state that the @{text "<o"} is well-founded |
905 on the restricted type @{text "'a rel rel"}. We prove this by first showing that, for any set |
828 on the restricted type @{text "'a rel rel"}. We prove this by first showing that, for any set |
906 of well-orders all embedded in a fixed well-order, the function mapping each well-order |
829 of well-orders all embedded in a fixed well-order, the function mapping each well-order |
907 in the set to an order filter of the fixed well-order is compatible w.r.t. to @{text "<o"} versus |
830 in the set to an order filter of the fixed well-order is compatible w.r.t. to @{text "<o"} versus |
908 {\em strict inclusion}; and we already know that strict inclusion of order filters is well-founded. *} |
831 {\em strict inclusion}; and we already know that strict inclusion of order filters is well-founded. *} |
909 |
832 |
910 |
|
911 definition ord_to_filter :: "'a rel \<Rightarrow> 'a rel \<Rightarrow> 'a set" |
833 definition ord_to_filter :: "'a rel \<Rightarrow> 'a rel \<Rightarrow> 'a set" |
912 where "ord_to_filter r0 r \<equiv> (SOME f. embed r r0 f) ` (Field r)" |
834 where "ord_to_filter r0 r \<equiv> (SOME f. embed r r0 f) ` (Field r)" |
913 |
|
914 |
835 |
915 lemma ord_to_filter_compat: |
836 lemma ord_to_filter_compat: |
916 "compat (ordLess Int (ordLess^-1``{r0} \<times> ordLess^-1``{r0})) |
837 "compat (ordLess Int (ordLess^-1``{r0} \<times> ordLess^-1``{r0})) |
917 (ofilterIncl r0) |
838 (ofilterIncl r0) |
918 (ord_to_filter r0)" |
839 (ord_to_filter r0)" |
961 equals0I[of R] by blast |
881 equals0I[of R] by blast |
962 with not_ordLeq_iff_ordLess WELL show ?thesis by blast |
882 with not_ordLeq_iff_ordLess WELL show ?thesis by blast |
963 qed |
883 qed |
964 |
884 |
965 |
885 |
966 |
886 subsection {* Copy via direct images *} |
967 subsection {* Copy via direct images *} |
|
968 |
|
969 |
887 |
970 text{* The direct image operator is the dual of the inverse image operator @{text "inv_image"} |
888 text{* The direct image operator is the dual of the inverse image operator @{text "inv_image"} |
971 from @{text "Relation.thy"}. It is useful for transporting a well-order between |
889 from @{text "Relation.thy"}. It is useful for transporting a well-order between |
972 different types. *} |
890 different types. *} |
973 |
891 |
974 |
|
975 definition dir_image :: "'a rel \<Rightarrow> ('a \<Rightarrow> 'a') \<Rightarrow> 'a' rel" |
892 definition dir_image :: "'a rel \<Rightarrow> ('a \<Rightarrow> 'a') \<Rightarrow> 'a' rel" |
976 where |
893 where |
977 "dir_image r f = {(f a, f b)| a b. (a,b) \<in> r}" |
894 "dir_image r f = {(f a, f b)| a b. (a,b) \<in> r}" |
978 |
895 |
979 |
|
980 lemma dir_image_Field: |
896 lemma dir_image_Field: |
981 "Field(dir_image r f) \<le> f ` (Field r)" |
897 "Field(dir_image r f) \<le> f ` (Field r)" |
982 unfolding dir_image_def Field_def by auto |
898 unfolding dir_image_def Field_def by auto |
983 |
899 |
984 |
|
985 lemma dir_image_minus_Id: |
900 lemma dir_image_minus_Id: |
986 "inj_on f (Field r) \<Longrightarrow> (dir_image r f) - Id = dir_image (r - Id) f" |
901 "inj_on f (Field r) \<Longrightarrow> (dir_image r f) - Id = dir_image (r - Id) f" |
987 unfolding inj_on_def Field_def dir_image_def by auto |
902 unfolding inj_on_def Field_def dir_image_def by auto |
988 |
|
989 |
903 |
990 lemma Refl_dir_image: |
904 lemma Refl_dir_image: |
991 assumes "Refl r" |
905 assumes "Refl r" |
992 shows "Refl(dir_image r f)" |
906 shows "Refl(dir_image r f)" |
993 proof- |
907 proof- |
1020 hence "(a,c): r" using 2 TRANS unfolding trans_def by blast |
933 hence "(a,c): r" using 2 TRANS unfolding trans_def by blast |
1021 thus "(a',c') \<in> dir_image r f" |
934 thus "(a',c') \<in> dir_image r f" |
1022 unfolding dir_image_def using 1 by auto |
935 unfolding dir_image_def using 1 by auto |
1023 qed |
936 qed |
1024 |
937 |
1025 |
|
1026 lemma Preorder_dir_image: |
938 lemma Preorder_dir_image: |
1027 "\<lbrakk>Preorder r; inj_on f (Field r)\<rbrakk> \<Longrightarrow> Preorder (dir_image r f)" |
939 "\<lbrakk>Preorder r; inj_on f (Field r)\<rbrakk> \<Longrightarrow> Preorder (dir_image r f)" |
1028 by (simp add: preorder_on_def Refl_dir_image trans_dir_image) |
940 by (simp add: preorder_on_def Refl_dir_image trans_dir_image) |
1029 |
|
1030 |
941 |
1031 lemma antisym_dir_image: |
942 lemma antisym_dir_image: |
1032 assumes AN: "antisym r" and INJ: "inj_on f (Field r)" |
943 assumes AN: "antisym r" and INJ: "inj_on f (Field r)" |
1033 shows "antisym(dir_image r f)" |
944 shows "antisym(dir_image r f)" |
1034 proof(unfold antisym_def, auto) |
945 proof(unfold antisym_def, auto) |
1041 hence "a1 = a2 \<and> b1 = b2" using INJ unfolding inj_on_def by auto |
952 hence "a1 = a2 \<and> b1 = b2" using INJ unfolding inj_on_def by auto |
1042 hence "a1 = b2" using 2 AN unfolding antisym_def by auto |
953 hence "a1 = b2" using 2 AN unfolding antisym_def by auto |
1043 thus "a' = b'" using 1 by auto |
954 thus "a' = b'" using 1 by auto |
1044 qed |
955 qed |
1045 |
956 |
1046 |
|
1047 lemma Partial_order_dir_image: |
957 lemma Partial_order_dir_image: |
1048 "\<lbrakk>Partial_order r; inj_on f (Field r)\<rbrakk> \<Longrightarrow> Partial_order (dir_image r f)" |
958 "\<lbrakk>Partial_order r; inj_on f (Field r)\<rbrakk> \<Longrightarrow> Partial_order (dir_image r f)" |
1049 by (simp add: partial_order_on_def Preorder_dir_image antisym_dir_image) |
959 by (simp add: partial_order_on_def Preorder_dir_image antisym_dir_image) |
1050 |
|
1051 |
960 |
1052 lemma Total_dir_image: |
961 lemma Total_dir_image: |
1053 assumes TOT: "Total r" and INJ: "inj_on f (Field r)" |
962 assumes TOT: "Total r" and INJ: "inj_on f (Field r)" |
1054 shows "Total(dir_image r f)" |
963 shows "Total(dir_image r f)" |
1055 proof(unfold total_on_def, intro ballI impI) |
964 proof(unfold total_on_def, intro ballI impI) |
1062 hence "(a,b) \<in> r \<or> (b,a) \<in> r" using 1 TOT unfolding total_on_def by auto |
971 hence "(a,b) \<in> r \<or> (b,a) \<in> r" using 1 TOT unfolding total_on_def by auto |
1063 thus "(a',b') \<in> dir_image r f \<or> (b',a') \<in> dir_image r f" |
972 thus "(a',b') \<in> dir_image r f \<or> (b',a') \<in> dir_image r f" |
1064 using 1 unfolding dir_image_def by auto |
973 using 1 unfolding dir_image_def by auto |
1065 qed |
974 qed |
1066 |
975 |
1067 |
|
1068 lemma Linear_order_dir_image: |
976 lemma Linear_order_dir_image: |
1069 "\<lbrakk>Linear_order r; inj_on f (Field r)\<rbrakk> \<Longrightarrow> Linear_order (dir_image r f)" |
977 "\<lbrakk>Linear_order r; inj_on f (Field r)\<rbrakk> \<Longrightarrow> Linear_order (dir_image r f)" |
1070 by (simp add: linear_order_on_def Partial_order_dir_image Total_dir_image) |
978 by (simp add: linear_order_on_def Partial_order_dir_image Total_dir_image) |
1071 |
|
1072 |
979 |
1073 lemma wf_dir_image: |
980 lemma wf_dir_image: |
1074 assumes WF: "wf r" and INJ: "inj_on f (Field r)" |
981 assumes WF: "wf r" and INJ: "inj_on f (Field r)" |
1075 shows "wf(dir_image r f)" |
982 shows "wf(dir_image r f)" |
1076 proof(unfold wf_eq_minimal2, intro allI impI, elim conjE) |
983 proof(unfold wf_eq_minimal2, intro allI impI, elim conjE) |
1093 qed |
1000 qed |
1094 thus "\<exists>a'\<in>A'. \<forall>b'\<in>A'. (b', a') \<notin> dir_image r f" |
1001 thus "\<exists>a'\<in>A'. \<forall>b'\<in>A'. (b', a') \<notin> dir_image r f" |
1095 using A_def 1 by blast |
1002 using A_def 1 by blast |
1096 qed |
1003 qed |
1097 |
1004 |
1098 |
|
1099 lemma Well_order_dir_image: |
1005 lemma Well_order_dir_image: |
1100 "\<lbrakk>Well_order r; inj_on f (Field r)\<rbrakk> \<Longrightarrow> Well_order (dir_image r f)" |
1006 "\<lbrakk>Well_order r; inj_on f (Field r)\<rbrakk> \<Longrightarrow> Well_order (dir_image r f)" |
1101 using assms unfolding well_order_on_def |
1007 using assms unfolding well_order_on_def |
1102 using Linear_order_dir_image[of r f] wf_dir_image[of "r - Id" f] |
1008 using Linear_order_dir_image[of r f] wf_dir_image[of "r - Id" f] |
1103 dir_image_minus_Id[of f r] |
1009 dir_image_minus_Id[of f r] |
1104 subset_inj_on[of f "Field r" "Field(r - Id)"] |
1010 subset_inj_on[of f "Field r" "Field(r - Id)"] |
1105 mono_Field[of "r - Id" r] by auto |
1011 mono_Field[of "r - Id" r] by auto |
1106 |
1012 |
1107 |
|
1108 lemma dir_image_Field2: |
1013 lemma dir_image_Field2: |
1109 "Refl r \<Longrightarrow> Field(dir_image r f) = f ` (Field r)" |
1014 "Refl r \<Longrightarrow> Field(dir_image r f) = f ` (Field r)" |
1110 unfolding Field_def dir_image_def refl_on_def Domain_def Range_def by blast |
1015 unfolding Field_def dir_image_def refl_on_def Domain_def Range_def by blast |
1111 |
|
1112 |
1016 |
1113 lemma dir_image_bij_betw: |
1017 lemma dir_image_bij_betw: |
1114 "\<lbrakk>Well_order r; inj_on f (Field r)\<rbrakk> \<Longrightarrow> bij_betw f (Field r) (Field (dir_image r f))" |
1018 "\<lbrakk>Well_order r; inj_on f (Field r)\<rbrakk> \<Longrightarrow> bij_betw f (Field r) (Field (dir_image r f))" |
1115 unfolding bij_betw_def |
1019 unfolding bij_betw_def |
1116 by (simp add: dir_image_Field2 order_on_defs) |
1020 by (simp add: dir_image_Field2 order_on_defs) |
1117 |
1021 |
1118 |
|
1119 lemma dir_image_compat: |
1022 lemma dir_image_compat: |
1120 "compat r (dir_image r f) f" |
1023 "compat r (dir_image r f) f" |
1121 unfolding compat_def dir_image_def by auto |
1024 unfolding compat_def dir_image_def by auto |
1122 |
1025 |
1123 |
|
1124 lemma dir_image_iso: |
1026 lemma dir_image_iso: |
1125 "\<lbrakk>Well_order r; inj_on f (Field r)\<rbrakk> \<Longrightarrow> iso r (dir_image r f) f" |
1027 "\<lbrakk>Well_order r; inj_on f (Field r)\<rbrakk> \<Longrightarrow> iso r (dir_image r f) f" |
1126 using iso_iff3 dir_image_compat dir_image_bij_betw Well_order_dir_image by blast |
1028 using iso_iff3 dir_image_compat dir_image_bij_betw Well_order_dir_image by blast |
1127 |
1029 |
1128 |
|
1129 lemma dir_image_ordIso: |
1030 lemma dir_image_ordIso: |
1130 "\<lbrakk>Well_order r; inj_on f (Field r)\<rbrakk> \<Longrightarrow> r =o dir_image r f" |
1031 "\<lbrakk>Well_order r; inj_on f (Field r)\<rbrakk> \<Longrightarrow> r =o dir_image r f" |
1131 unfolding ordIso_def using dir_image_iso Well_order_dir_image by blast |
1032 unfolding ordIso_def using dir_image_iso Well_order_dir_image by blast |
1132 |
|
1133 |
1033 |
1134 lemma Well_order_iso_copy: |
1034 lemma Well_order_iso_copy: |
1135 assumes WELL: "well_order_on A r" and BIJ: "bij_betw f A A'" |
1035 assumes WELL: "well_order_on A r" and BIJ: "bij_betw f A A'" |
1136 shows "\<exists>r'. well_order_on A' r' \<and> r =o r'" |
1036 shows "\<exists>r'. well_order_on A' r' \<and> r =o r'" |
1137 proof- |
1037 proof- |
1166 at proving that the square of an infinite set has the same cardinal |
1064 at proving that the square of an infinite set has the same cardinal |
1167 as that set. The essential property required there (and which is ensured by this |
1065 as that set. The essential property required there (and which is ensured by this |
1168 construction) is that any proper order filter of the product order is included in a rectangle, i.e., |
1066 construction) is that any proper order filter of the product order is included in a rectangle, i.e., |
1169 in a product of proper filters on the original relation (assumed to be a well-order). *} |
1067 in a product of proper filters on the original relation (assumed to be a well-order). *} |
1170 |
1068 |
1171 |
|
1172 definition bsqr :: "'a rel => ('a * 'a)rel" |
1069 definition bsqr :: "'a rel => ('a * 'a)rel" |
1173 where |
1070 where |
1174 "bsqr r = {((a1,a2),(b1,b2)). |
1071 "bsqr r = {((a1,a2),(b1,b2)). |
1175 {a1,a2,b1,b2} \<le> Field r \<and> |
1072 {a1,a2,b1,b2} \<le> Field r \<and> |
1176 (a1 = b1 \<and> a2 = b2 \<or> |
1073 (a1 = b1 \<and> a2 = b2 \<or> |
1177 (wo_rel.max2 r a1 a2, wo_rel.max2 r b1 b2) \<in> r - Id \<or> |
1074 (wo_rel.max2 r a1 a2, wo_rel.max2 r b1 b2) \<in> r - Id \<or> |
1178 wo_rel.max2 r a1 a2 = wo_rel.max2 r b1 b2 \<and> (a1,b1) \<in> r - Id \<or> |
1075 wo_rel.max2 r a1 a2 = wo_rel.max2 r b1 b2 \<and> (a1,b1) \<in> r - Id \<or> |
1179 wo_rel.max2 r a1 a2 = wo_rel.max2 r b1 b2 \<and> a1 = b1 \<and> (a2,b2) \<in> r - Id |
1076 wo_rel.max2 r a1 a2 = wo_rel.max2 r b1 b2 \<and> a1 = b1 \<and> (a2,b2) \<in> r - Id |
1180 )}" |
1077 )}" |
1181 |
|
1182 |
1078 |
1183 lemma Field_bsqr: |
1079 lemma Field_bsqr: |
1184 "Field (bsqr r) = Field r \<times> Field r" |
1080 "Field (bsqr r) = Field r \<times> Field r" |
1185 proof |
1081 proof |
1186 show "Field (bsqr r) \<le> Field r \<times> Field r" |
1082 show "Field (bsqr r) \<le> Field r \<times> Field r" |
1200 hence "((a1,a2),(a1,a2)) \<in> bsqr r" unfolding bsqr_def by blast |
1096 hence "((a1,a2),(a1,a2)) \<in> bsqr r" unfolding bsqr_def by blast |
1201 thus "(a1,a2) \<in> Field (bsqr r)" unfolding Field_def by auto |
1097 thus "(a1,a2) \<in> Field (bsqr r)" unfolding Field_def by auto |
1202 qed |
1098 qed |
1203 qed |
1099 qed |
1204 |
1100 |
1205 |
|
1206 lemma bsqr_Refl: "Refl(bsqr r)" |
1101 lemma bsqr_Refl: "Refl(bsqr r)" |
1207 by(unfold refl_on_def Field_bsqr, auto simp add: bsqr_def) |
1102 by(unfold refl_on_def Field_bsqr, auto simp add: bsqr_def) |
1208 |
|
1209 |
1103 |
1210 lemma bsqr_Trans: |
1104 lemma bsqr_Trans: |
1211 assumes "Well_order r" |
1105 assumes "Well_order r" |
1212 shows "trans (bsqr r)" |
1106 shows "trans (bsqr r)" |
1213 proof(unfold trans_def, auto) |
1107 proof(unfold trans_def, auto) |