1 (* Title : HOL/Library/Zorn.thy |
1 (* Title: HOL/Library/Zorn.thy |
2 Author : Jacques D. Fleuriot, Tobias Nipkow |
2 Author: Jacques D. Fleuriot, Tobias Nipkow |
3 Description : Zorn's Lemma (ported from Larry Paulson's Zorn.thy in ZF) |
3 |
4 The well-ordering theorem |
4 Zorn's Lemma (ported from Larry Paulson's Zorn.thy in ZF). |
|
5 The well-ordering theorem. |
5 *) |
6 *) |
6 |
7 |
7 header {* Zorn's Lemma *} |
8 header {* Zorn's Lemma *} |
8 |
9 |
9 theory Zorn |
10 theory Zorn |
287 proof (simp add:Chain_def, intro allI impI, elim conjE) |
288 proof (simp add:Chain_def, intro allI impI, elim conjE) |
288 fix a b |
289 fix a b |
289 assume "a \<in> Field r" "?B a \<in> C" "b \<in> Field r" "?B b \<in> C" |
290 assume "a \<in> Field r" "?B a \<in> C" "b \<in> Field r" "?B b \<in> C" |
290 hence "?B a \<subseteq> ?B b \<or> ?B b \<subseteq> ?B a" using 2 by auto |
291 hence "?B a \<subseteq> ?B b \<or> ?B b \<subseteq> ?B a" using 2 by auto |
291 thus "(a, b) \<in> r \<or> (b, a) \<in> r" using `Preorder r` `a:Field r` `b:Field r` |
292 thus "(a, b) \<in> r \<or> (b, a) \<in> r" using `Preorder r` `a:Field r` `b:Field r` |
292 by(simp add:subset_Image1_Image1_iff) |
293 by (simp add:subset_Image1_Image1_iff) |
293 qed |
294 qed |
294 then obtain u where uA: "u:Field r" "\<forall>a\<in>?A. (a,u) : r" using u by auto |
295 then obtain u where uA: "u:Field r" "\<forall>a\<in>?A. (a,u) : r" using u by auto |
295 have "\<forall>A\<in>C. A \<subseteq> r^-1 `` {u}" (is "?P u") |
296 have "\<forall>A\<in>C. A \<subseteq> r^-1 `` {u}" (is "?P u") |
296 proof auto |
297 proof auto |
297 fix a B assume aB: "B:C" "a:B" |
298 fix a B assume aB: "B:C" "a:B" |
298 with 1 obtain x where "x:Field r" "B = r^-1 `` {x}" by auto |
299 with 1 obtain x where "x:Field r" "B = r^-1 `` {x}" by auto |
299 thus "(a,u) : r" using uA aB `Preorder r` |
300 thus "(a,u) : r" using uA aB `Preorder r` |
300 by (auto simp add: preorder_on_def refl_on_def) (metis transD) |
301 by (auto simp add: preorder_on_def refl_on_def) (metis transD) |
301 qed |
302 qed |
302 thus "EX u:Field r. ?P u" using `u:Field r` by blast |
303 thus "EX u:Field r. ?P u" using `u:Field r` by blast |
303 qed |
304 qed |
304 from Zorn_Lemma2[OF this] |
305 from Zorn_Lemma2[OF this] |
305 obtain m B where "m:Field r" "B = r^-1 `` {m}" |
306 obtain m B where "m:Field r" "B = r^-1 `` {m}" |
379 proof(induct i) |
380 proof(induct i) |
380 case 0 show ?case by fact |
381 case 0 show ?case by fact |
381 next |
382 next |
382 case (Suc i) |
383 case (Suc i) |
383 moreover obtain s where "s\<in>R" and "(f(Suc(Suc i)), f(Suc i)) \<in> s" |
384 moreover obtain s where "s\<in>R" and "(f(Suc(Suc i)), f(Suc i)) \<in> s" |
384 using 1 by auto |
385 using 1 by auto |
385 moreover hence "s initial_segment_of r \<or> r initial_segment_of s" |
386 moreover hence "s initial_segment_of r \<or> r initial_segment_of s" |
386 using assms(1) `r:R` by(simp add: Chain_def) |
387 using assms(1) `r:R` by(simp add: Chain_def) |
387 ultimately show ?case by(simp add:init_seg_of_def) blast |
388 ultimately show ?case by(simp add:init_seg_of_def) blast |
388 qed |
389 qed |
389 } |
390 } |
390 thus False using assms(2) `r:R` |
391 thus False using assms(2) `r:R` |
391 by(simp add:wf_iff_no_infinite_down_chain) blast |
392 by(simp add:wf_iff_no_infinite_down_chain) blast |
450 --{*We assume that x is not covered and extend m at the top with x*} |
451 --{*We assume that x is not covered and extend m at the top with x*} |
451 have "m \<noteq> {}" |
452 have "m \<noteq> {}" |
452 proof |
453 proof |
453 assume "m={}" |
454 assume "m={}" |
454 moreover have "Well_order {(x,x)}" |
455 moreover have "Well_order {(x,x)}" |
455 by(simp add:order_on_defs refl_on_def trans_def antisym_def total_on_def Field_def Domain_def Range_def) |
456 by(simp add:order_on_defs refl_on_def trans_def antisym_def total_on_def Field_def Domain_def Range_def) |
456 ultimately show False using max |
457 ultimately show False using max |
457 by (auto simp:I_def init_seg_of_def simp del:Field_insert) |
458 by (auto simp:I_def init_seg_of_def simp del:Field_insert) |
458 qed |
459 qed |
459 hence "Field m \<noteq> {}" by(auto simp:Field_def) |
460 hence "Field m \<noteq> {}" by(auto simp:Field_def) |
460 moreover have "wf(m-Id)" using `Well_order m` |
461 moreover have "wf(m-Id)" using `Well_order m` |
461 by(simp add:well_order_on_def) |
462 by(simp add:well_order_on_def) |
462 --{*The extension of m by x:*} |
463 --{*The extension of m by x:*} |
474 unfolding antisym_def Field_def Domain_def Range_def by blast |
475 unfolding antisym_def Field_def Domain_def Range_def by blast |
475 moreover have "Total ?m" using `Total m` Fm by(auto simp: total_on_def) |
476 moreover have "Total ?m" using `Total m` Fm by(auto simp: total_on_def) |
476 moreover have "wf(?m-Id)" |
477 moreover have "wf(?m-Id)" |
477 proof- |
478 proof- |
478 have "wf ?s" using `x \<notin> Field m` |
479 have "wf ?s" using `x \<notin> Field m` |
479 by(auto simp add:wf_eq_minimal Field_def Domain_def Range_def) metis |
480 by(auto simp add:wf_eq_minimal Field_def Domain_def Range_def) metis |
480 thus ?thesis using `wf(m-Id)` `x \<notin> Field m` |
481 thus ?thesis using `wf(m-Id)` `x \<notin> Field m` |
481 wf_subset[OF `wf ?s` Diff_subset] |
482 wf_subset[OF `wf ?s` Diff_subset] |
482 by (fastsimp intro!: wf_Un simp add: Un_Diff Field_def) |
483 by (fastsimp intro!: wf_Un simp add: Un_Diff Field_def) |
483 qed |
484 qed |
484 ultimately have "Well_order ?m" by(simp add:order_on_defs) |
485 ultimately have "Well_order ?m" by(simp add:order_on_defs) |
485 --{*We show that the extension is above m*} |
486 --{*We show that the extension is above m*} |
486 moreover hence "(m,?m) : I" using `Well_order m` `x \<notin> Field m` |
487 moreover hence "(m,?m) : I" using `Well_order m` `x \<notin> Field m` |
487 by(fastsimp simp:I_def init_seg_of_def Field_def Domain_def Range_def) |
488 by(fastsimp simp:I_def init_seg_of_def Field_def Domain_def Range_def) |