diff -r cf7f3465eaf1 -r 240563fbf41d src/ZF/Zorn.thy --- a/src/ZF/Zorn.thy Thu Jul 23 14:20:51 2015 +0200 +++ b/src/ZF/Zorn.thy Thu Jul 23 14:25:05 2015 +0200 @@ -3,12 +3,12 @@ Copyright 1994 University of Cambridge *) -section{*Zorn's Lemma*} +section\Zorn's Lemma\ theory Zorn imports OrderArith AC Inductive_ZF begin -text{*Based upon the unpublished article ``Towards the Mechanization of the -Proofs of Some Classical Theorems of Set Theory,'' by Abrial and Laffitte.*} +text\Based upon the unpublished article ``Towards the Mechanization of the +Proofs of Some Classical Theorems of Set Theory,'' by Abrial and Laffitte.\ definition Subset_rel :: "i=>i" where @@ -31,16 +31,16 @@ "increasing(A) == {f \ Pow(A)->Pow(A). \x. x<=A \ x<=f`x}" -text{*Lemma for the inductive definition below*} +text\Lemma for the inductive definition below\ lemma Union_in_Pow: "Y \ Pow(Pow(A)) ==> \(Y) \ Pow(A)" by blast -text{*We could make the inductive definition conditional on +text\We could make the inductive definition conditional on @{term "next \ increasing(S)"} but instead we make this a side-condition of an introduction rule. Thus the induction rule lets us assume that condition! Many inductive proofs - are therefore unconditional.*} + are therefore unconditional.\ consts "TFin" :: "[i,i]=>i" @@ -57,7 +57,7 @@ type_intros CollectD1 [THEN apply_funtype] Union_in_Pow -subsection{*Mathematical Preamble *} +subsection\Mathematical Preamble\ lemma Union_lemma0: "(\x\C. x<=A | B<=x) ==> \(C)<=A | B<=\(C)" by blast @@ -67,7 +67,7 @@ by blast -subsection{*The Transfinite Construction *} +subsection\The Transfinite Construction\ lemma increasingD1: "f \ increasing(A) ==> f \ Pow(A)->Pow(A)" apply (unfold increasing_def) @@ -82,7 +82,7 @@ lemmas TFin_is_subset = TFin.dom_subset [THEN subsetD, THEN PowD] -text{*Structural induction on @{term "TFin(S,next)"} *} +text\Structural induction on @{term "TFin(S,next)"}\ lemma TFin_induct: "[| n \ TFin(S,next); !!x. [| x \ TFin(S,next); P(x); next \ increasing(S) |] ==> P(next`x); @@ -91,12 +91,12 @@ by (erule TFin.induct, blast+) -subsection{*Some Properties of the Transfinite Construction *} +subsection\Some Properties of the Transfinite Construction\ lemmas increasing_trans = subset_trans [OF _ increasingD2, OF _ _ TFin_is_subset] -text{*Lemma 1 of section 3.1*} +text\Lemma 1 of section 3.1\ lemma TFin_linear_lemma1: "[| n \ TFin(S,next); m \ TFin(S,next); \x \ TFin(S,next) . x<=m \ x=m | next`x<=m |] @@ -107,19 +107,19 @@ apply (blast dest: increasing_trans) done -text{*Lemma 2 of section 3.2. Interesting in its own right! - Requires @{term "next \ increasing(S)"} in the second induction step.*} +text\Lemma 2 of section 3.2. Interesting in its own right! + Requires @{term "next \ increasing(S)"} in the second induction step.\ lemma TFin_linear_lemma2: "[| m \ TFin(S,next); next \ increasing(S) |] ==> \n \ TFin(S,next). n<=m \ n=m | next`n \ m" apply (erule TFin_induct) apply (rule impI [THEN ballI]) -txt{*case split using @{text TFin_linear_lemma1}*} +txt\case split using @{text TFin_linear_lemma1}\ apply (rule_tac n1 = n and m1 = x in TFin_linear_lemma1 [THEN disjE], assumption+) apply (blast del: subsetI intro: increasing_trans subsetI, blast) -txt{*second induction step*} +txt\second induction step\ apply (rule impI [THEN ballI]) apply (rule Union_lemma0 [THEN disjE]) apply (erule_tac [3] disjI2) @@ -133,13 +133,13 @@ apply (blast dest: TFin_is_subset)+ done -text{*a more convenient form for Lemma 2*} +text\a more convenient form for Lemma 2\ lemma TFin_subsetD: "[| n<=m; m \ TFin(S,next); n \ TFin(S,next); next \ increasing(S) |] ==> n=m | next`n \ m" by (blast dest: TFin_linear_lemma2 [rule_format]) -text{*Consequences from section 3.3 -- Property 3.2, the ordering is total*} +text\Consequences from section 3.3 -- Property 3.2, the ordering is total\ lemma TFin_subset_linear: "[| m \ TFin(S,next); n \ TFin(S,next); next \ increasing(S) |] ==> n \ m | m<=n" @@ -151,7 +151,7 @@ done -text{*Lemma 3 of section 3.3*} +text\Lemma 3 of section 3.3\ lemma equal_next_upper: "[| n \ TFin(S,next); m \ TFin(S,next); m = next`m |] ==> n \ m" apply (erule TFin_induct) @@ -159,7 +159,7 @@ apply (assumption+, force, blast) done -text{*Property 3.3 of section 3.3*} +text\Property 3.3 of section 3.3\ lemma equal_next_Union: "[| m \ TFin(S,next); next \ increasing(S) |] ==> m = next`m <-> m = \(TFin(S,next))" @@ -174,12 +174,12 @@ done -subsection{*Hausdorff's Theorem: Every Set Contains a Maximal Chain*} +subsection\Hausdorff's Theorem: Every Set Contains a Maximal Chain\ -text{*NOTE: We assume the partial ordering is @{text "\"}, the subset -relation!*} +text\NOTE: We assume the partial ordering is @{text "\"}, the subset +relation!\ -text{** Defining the "next" operation for Hausdorff's Theorem **} +text\* Defining the "next" operation for Hausdorff's Theorem *\ lemma chain_subset_Pow: "chain(A) \ Pow(A)" apply (unfold chain_def) @@ -211,7 +211,7 @@ apply (simp add: super_def) done -text{*This justifies Definition 4.4*} +text\This justifies Definition 4.4\ lemma Hausdorff_next_exists: "ch \ (\ X \ Pow(chain(S))-{0}. X) ==> \next \ increasing(S). \X \ Pow(S). @@ -226,7 +226,7 @@ apply (simp (no_asm_simp)) apply (blast dest: super_subset_chain [THEN subsetD] chain_subset_Pow [THEN subsetD] choice_super) -txt{*Now, verify that it increases*} +txt\Now, verify that it increases\ apply (simp (no_asm_simp) add: Pow_iff subset_refl) apply safe apply (drule choice_super) @@ -234,7 +234,7 @@ apply (simp add: super_def, blast) done -text{*Lemma 4*} +text\Lemma 4\ lemma TFin_chain_lemma4: "[| c \ TFin(S,next); ch \ (\ X \ Pow(chain(S))-{0}. X); @@ -248,7 +248,7 @@ apply (unfold chain_def) apply (rule CollectI, blast, safe) apply (rule_tac m1=B and n1=Ba in TFin_subset_linear [THEN disjE], fast+) - txt{*@{text "Blast_tac's"} slow*} + txt\@{text "Blast_tac's"} slow\ done theorem Hausdorff: "\c. c \ maxchain(S)" @@ -272,10 +272,10 @@ done -subsection{*Zorn's Lemma: If All Chains in S Have Upper Bounds In S, - then S contains a Maximal Element*} +subsection\Zorn's Lemma: If All Chains in S Have Upper Bounds In S, + then S contains a Maximal Element\ -text{*Used in the proof of Zorn's Lemma*} +text\Used in the proof of Zorn's Lemma\ lemma chain_extend: "[| c \ chain(A); z \ A; \x \ c. x<=z |] ==> cons(z,c) \ chain(A)" by (unfold chain_def, blast) @@ -296,7 +296,7 @@ apply (fast elim: equalityE) done -text {* Alternative version of Zorn's Lemma *} +text \Alternative version of Zorn's Lemma\ theorem Zorn2: "\c \ chain(S). \y \ S. \x \ c. x \ y ==> \y \ S. \z \ S. y<=z \ y=z" @@ -317,21 +317,21 @@ done -subsection{*Zermelo's Theorem: Every Set can be Well-Ordered*} +subsection\Zermelo's Theorem: Every Set can be Well-Ordered\ -text{*Lemma 5*} +text\Lemma 5\ lemma TFin_well_lemma5: "[| n \ TFin(S,next); Z \ TFin(S,next); z:Z; ~ \(Z) \ Z |] ==> \m \ Z. n \ m" apply (erule TFin_induct) -prefer 2 apply blast txt{*second induction step is easy*} +prefer 2 apply blast txt\second induction step is easy\ apply (rule ballI) apply (rule bspec [THEN TFin_subsetD, THEN disjE], auto) apply (subgoal_tac "m = \(Z) ") apply blast+ done -text{*Well-ordering of @{term "TFin(S,next)"} *} +text\Well-ordering of @{term "TFin(S,next)"}\ lemma well_ord_TFin_lemma: "[| Z \ TFin(S,next); z \ Z |] ==> \(Z) \ Z" apply (rule classical) apply (subgoal_tac "Z = {\(TFin (S,next))}") @@ -341,27 +341,27 @@ apply (rule_tac [2] subset_refl [THEN TFin_UnionI, THEN TFin_well_lemma5, THEN bspec], blast+) done -text{*This theorem just packages the previous result*} +text\This theorem just packages the previous result\ lemma well_ord_TFin: "next \ increasing(S) ==> well_ord(TFin(S,next), Subset_rel(TFin(S,next)))" apply (rule well_ordI) apply (unfold Subset_rel_def linear_def) -txt{*Prove the well-foundedness goal*} +txt\Prove the well-foundedness goal\ apply (rule wf_onI) apply (frule well_ord_TFin_lemma, assumption) apply (drule_tac x = "\(Z) " in bspec, assumption) apply blast -txt{*Now prove the linearity goal*} +txt\Now prove the linearity goal\ apply (intro ballI) apply (case_tac "x=y") apply blast -txt{*The @{term "x\y"} case remains*} +txt\The @{term "x\y"} case remains\ apply (rule_tac n1=x and m1=y in TFin_subset_linear [THEN disjE], assumption+, blast+) done -text{** Defining the "next" operation for Zermelo's Theorem **} +text\* Defining the "next" operation for Zermelo's Theorem *\ lemma choice_Diff: "[| ch \ (\ X \ Pow(S) - {0}. X); X \ S; X\S |] ==> ch ` (S-X) \ S-X" @@ -369,7 +369,7 @@ apply (blast elim!: equalityE) done -text{*This justifies Definition 6.1*} +text\This justifies Definition 6.1\ lemma Zermelo_next_exists: "ch \ (\ X \ Pow(S)-{0}. X) ==> \next \ increasing(S). \X \ Pow(S). @@ -380,16 +380,16 @@ apply (unfold increasing_def) apply (rule CollectI) apply (rule lam_type) -txt{*Type checking is surprisingly hard!*} +txt\Type checking is surprisingly hard!\ apply (simp (no_asm_simp) add: Pow_iff cons_subset_iff subset_refl) apply (blast intro!: choice_Diff [THEN DiffD1]) -txt{*Verify that it increases*} +txt\Verify that it increases\ apply (intro allI impI) apply (simp add: Pow_iff subset_consI subset_refl) done -text{*The construction of the injection*} +text\The construction of the injection\ lemma choice_imp_injection: "[| ch \ (\ X \ Pow(S)-{0}. X); next \ increasing(S); @@ -404,8 +404,8 @@ prefer 2 apply (blast elim: equalityE) apply (subgoal_tac "\({y \ TFin (S,next) . x \ y}) \ S") prefer 2 apply (blast elim: equalityE) -txt{*For proving @{text "x \ next`\(...)"}. - Abrial and Laffitte's justification appears to be faulty.*} +txt\For proving @{text "x \ next`\(...)"}. + Abrial and Laffitte's justification appears to be faulty.\ apply (subgoal_tac "~ next ` Union({y \ TFin (S,next) . x \ y}) \ \({y \ TFin (S,next) . x \ y}) ") prefer 2 @@ -415,11 +415,11 @@ apply (subgoal_tac "x \ next ` Union({y \ TFin (S,next) . x \ y}) ") prefer 2 apply (blast intro!: Collect_subset [THEN TFin_UnionI] TFin.nextI) -txt{*End of the lemmas!*} +txt\End of the lemmas!\ apply (simp add: Collect_subset [THEN TFin_UnionI, THEN TFin_is_subset]) done -text{*The wellordering theorem*} +text\The wellordering theorem\ theorem AC_well_ord: "\r. well_ord(S,r)" apply (rule AC_Pi_Pow [THEN exE]) apply (rule Zermelo_next_exists [THEN bexE], assumption) @@ -430,9 +430,9 @@ done -subsection {* Zorn's Lemma for Partial Orders *} +subsection \Zorn's Lemma for Partial Orders\ -text {* Reimported from HOL by Clemens Ballarin. *} +text \Reimported from HOL by Clemens Ballarin.\ definition Chain :: "i => i" where @@ -449,7 +449,7 @@ shows "\m\field(r). \a\field(r). \ r \ a = m" proof - have "Preorder(r)" using po by (simp add: partial_order_on_def) - --{* Mirror r in the set of subsets below (wrt r) elements of A (?). *} + --\Mirror r in the set of subsets below (wrt r) elements of A (?).\ let ?B = "\x\field(r). r -`` {x}" let ?S = "?B `` field(r)" have "\C\chain(?S). \U\?S. \A\C. A \ U" proof (clarsimp simp: chain_def Subset_rel_def bex_image_simp) @@ -478,7 +478,7 @@ assume "a \ field(r)" "r -`` {a} \ C" "b \ field(r)" "r -`` {b} \ C" hence "r -`` {a} \ r -`` {b} | r -`` {b} \ r -`` {a}" using 2 by auto then show " \ r | \ r" - using `Preorder(r)` `a \ field(r)` `b \ field(r)` + using \Preorder(r)\ \a \ field(r)\ \b \ field(r)\ by (simp add: subset_vimage1_vimage1_iff) qed then obtain u where uA: "u \ field(r)" "\a\?A. \ r" @@ -498,20 +498,20 @@ apply (erule lamE) apply simp done - then show " \ r" using uA aB `Preorder(r)` + then show " \ r" using uA aB \Preorder(r)\ by (auto simp: preorder_on_def refl_def) (blast dest: trans_onD)+ qed then show "\U\field(r). \A\C. A \ r -`` {U}" - using `u \ field(r)` .. + using \u \ field(r)\ .. qed from Zorn2 [OF this] obtain m B where "m \ field(r)" "B = r -`` {m}" "\x\field(r). B \ r -`` {x} \ B = r -`` {x}" by (auto elim!: lamE simp: ball_image_simp) then have "\a\field(r). \ r \ a = m" - using po `Preorder(r)` `m \ field(r)` + using po \Preorder(r)\ \m \ field(r)\ by (auto simp: subset_vimage1_vimage1_iff Partial_order_eq_vimage1_vimage1_iff) - then show ?thesis using `m \ field(r)` by blast + then show ?thesis using \m \ field(r)\ by blast qed end