26 maxchain :: "i=>i" where |
26 maxchain :: "i=>i" where |
27 "maxchain(A) == {c \<in> chain(A). super(A,c)=0}" |
27 "maxchain(A) == {c \<in> chain(A). super(A,c)=0}" |
28 |
28 |
29 definition |
29 definition |
30 increasing :: "i=>i" where |
30 increasing :: "i=>i" where |
31 "increasing(A) == {f \<in> Pow(A)->Pow(A). \<forall>x. x<=A --> x<=f`x}" |
31 "increasing(A) == {f \<in> Pow(A)->Pow(A). \<forall>x. x<=A \<longrightarrow> x<=f`x}" |
32 |
32 |
33 |
33 |
34 text{*Lemma for the inductive definition below*} |
34 text{*Lemma for the inductive definition below*} |
35 lemma Union_in_Pow: "Y \<in> Pow(Pow(A)) ==> Union(Y) \<in> Pow(A)" |
35 lemma Union_in_Pow: "Y \<in> Pow(Pow(A)) ==> \<Union>(Y) \<in> Pow(A)" |
36 by blast |
36 by blast |
37 |
37 |
38 |
38 |
39 text{*We could make the inductive definition conditional on |
39 text{*We could make the inductive definition conditional on |
40 @{term "next \<in> increasing(S)"} |
40 @{term "next \<in> increasing(S)"} |
43 are therefore unconditional.*} |
43 are therefore unconditional.*} |
44 consts |
44 consts |
45 "TFin" :: "[i,i]=>i" |
45 "TFin" :: "[i,i]=>i" |
46 |
46 |
47 inductive |
47 inductive |
48 domains "TFin(S,next)" <= "Pow(S)" |
48 domains "TFin(S,next)" \<subseteq> "Pow(S)" |
49 intros |
49 intros |
50 nextI: "[| x \<in> TFin(S,next); next \<in> increasing(S) |] |
50 nextI: "[| x \<in> TFin(S,next); next \<in> increasing(S) |] |
51 ==> next`x \<in> TFin(S,next)" |
51 ==> next`x \<in> TFin(S,next)" |
52 |
52 |
53 Pow_UnionI: "Y \<in> Pow(TFin(S,next)) ==> Union(Y) \<in> TFin(S,next)" |
53 Pow_UnionI: "Y \<in> Pow(TFin(S,next)) ==> \<Union>(Y) \<in> TFin(S,next)" |
54 |
54 |
55 monos Pow_mono |
55 monos Pow_mono |
56 con_defs increasing_def |
56 con_defs increasing_def |
57 type_intros CollectD1 [THEN apply_funtype] Union_in_Pow |
57 type_intros CollectD1 [THEN apply_funtype] Union_in_Pow |
58 |
58 |
59 |
59 |
60 subsection{*Mathematical Preamble *} |
60 subsection{*Mathematical Preamble *} |
61 |
61 |
62 lemma Union_lemma0: "(\<forall>x\<in>C. x<=A | B<=x) ==> Union(C)<=A | B<=Union(C)" |
62 lemma Union_lemma0: "(\<forall>x\<in>C. x<=A | B<=x) ==> \<Union>(C)<=A | B<=\<Union>(C)" |
63 by blast |
63 by blast |
64 |
64 |
65 lemma Inter_lemma0: |
65 lemma Inter_lemma0: |
66 "[| c \<in> C; \<forall>x\<in>C. A<=x | x<=B |] ==> A <= Inter(C) | Inter(C) <= B" |
66 "[| c \<in> C; \<forall>x\<in>C. A<=x | x<=B |] ==> A \<subseteq> \<Inter>(C) | \<Inter>(C) \<subseteq> B" |
67 by blast |
67 by blast |
68 |
68 |
69 |
69 |
70 subsection{*The Transfinite Construction *} |
70 subsection{*The Transfinite Construction *} |
71 |
71 |
72 lemma increasingD1: "f \<in> increasing(A) ==> f \<in> Pow(A)->Pow(A)" |
72 lemma increasingD1: "f \<in> increasing(A) ==> f \<in> Pow(A)->Pow(A)" |
73 apply (unfold increasing_def) |
73 apply (unfold increasing_def) |
74 apply (erule CollectD1) |
74 apply (erule CollectD1) |
75 done |
75 done |
76 |
76 |
77 lemma increasingD2: "[| f \<in> increasing(A); x<=A |] ==> x <= f`x" |
77 lemma increasingD2: "[| f \<in> increasing(A); x<=A |] ==> x \<subseteq> f`x" |
78 by (unfold increasing_def, blast) |
78 by (unfold increasing_def, blast) |
79 |
79 |
80 lemmas TFin_UnionI = PowI [THEN TFin.Pow_UnionI] |
80 lemmas TFin_UnionI = PowI [THEN TFin.Pow_UnionI] |
81 |
81 |
82 lemmas TFin_is_subset = TFin.dom_subset [THEN subsetD, THEN PowD] |
82 lemmas TFin_is_subset = TFin.dom_subset [THEN subsetD, THEN PowD] |
84 |
84 |
85 text{*Structural induction on @{term "TFin(S,next)"} *} |
85 text{*Structural induction on @{term "TFin(S,next)"} *} |
86 lemma TFin_induct: |
86 lemma TFin_induct: |
87 "[| n \<in> TFin(S,next); |
87 "[| n \<in> TFin(S,next); |
88 !!x. [| x \<in> TFin(S,next); P(x); next \<in> increasing(S) |] ==> P(next`x); |
88 !!x. [| x \<in> TFin(S,next); P(x); next \<in> increasing(S) |] ==> P(next`x); |
89 !!Y. [| Y <= TFin(S,next); \<forall>y\<in>Y. P(y) |] ==> P(Union(Y)) |
89 !!Y. [| Y \<subseteq> TFin(S,next); \<forall>y\<in>Y. P(y) |] ==> P(\<Union>(Y)) |
90 |] ==> P(n)" |
90 |] ==> P(n)" |
91 by (erule TFin.induct, blast+) |
91 by (erule TFin.induct, blast+) |
92 |
92 |
93 |
93 |
94 subsection{*Some Properties of the Transfinite Construction *} |
94 subsection{*Some Properties of the Transfinite Construction *} |
97 OF _ _ TFin_is_subset] |
97 OF _ _ TFin_is_subset] |
98 |
98 |
99 text{*Lemma 1 of section 3.1*} |
99 text{*Lemma 1 of section 3.1*} |
100 lemma TFin_linear_lemma1: |
100 lemma TFin_linear_lemma1: |
101 "[| n \<in> TFin(S,next); m \<in> TFin(S,next); |
101 "[| n \<in> TFin(S,next); m \<in> TFin(S,next); |
102 \<forall>x \<in> TFin(S,next) . x<=m --> x=m | next`x<=m |] |
102 \<forall>x \<in> TFin(S,next) . x<=m \<longrightarrow> x=m | next`x<=m |] |
103 ==> n<=m | next`m<=n" |
103 ==> n<=m | next`m<=n" |
104 apply (erule TFin_induct) |
104 apply (erule TFin_induct) |
105 apply (erule_tac [2] Union_lemma0) (*or just Blast_tac*) |
105 apply (erule_tac [2] Union_lemma0) (*or just Blast_tac*) |
106 (*downgrade subsetI from intro! to intro*) |
106 (*downgrade subsetI from intro! to intro*) |
107 apply (blast dest: increasing_trans) |
107 apply (blast dest: increasing_trans) |
109 |
109 |
110 text{*Lemma 2 of section 3.2. Interesting in its own right! |
110 text{*Lemma 2 of section 3.2. Interesting in its own right! |
111 Requires @{term "next \<in> increasing(S)"} in the second induction step.*} |
111 Requires @{term "next \<in> increasing(S)"} in the second induction step.*} |
112 lemma TFin_linear_lemma2: |
112 lemma TFin_linear_lemma2: |
113 "[| m \<in> TFin(S,next); next \<in> increasing(S) |] |
113 "[| m \<in> TFin(S,next); next \<in> increasing(S) |] |
114 ==> \<forall>n \<in> TFin(S,next). n<=m --> n=m | next`n <= m" |
114 ==> \<forall>n \<in> TFin(S,next). n<=m \<longrightarrow> n=m | next`n \<subseteq> m" |
115 apply (erule TFin_induct) |
115 apply (erule TFin_induct) |
116 apply (rule impI [THEN ballI]) |
116 apply (rule impI [THEN ballI]) |
117 txt{*case split using @{text TFin_linear_lemma1}*} |
117 txt{*case split using @{text TFin_linear_lemma1}*} |
118 apply (rule_tac n1 = n and m1 = x in TFin_linear_lemma1 [THEN disjE], |
118 apply (rule_tac n1 = n and m1 = x in TFin_linear_lemma1 [THEN disjE], |
119 assumption+) |
119 assumption+) |
134 done |
134 done |
135 |
135 |
136 text{*a more convenient form for Lemma 2*} |
136 text{*a more convenient form for Lemma 2*} |
137 lemma TFin_subsetD: |
137 lemma TFin_subsetD: |
138 "[| n<=m; m \<in> TFin(S,next); n \<in> TFin(S,next); next \<in> increasing(S) |] |
138 "[| n<=m; m \<in> TFin(S,next); n \<in> TFin(S,next); next \<in> increasing(S) |] |
139 ==> n=m | next`n <= m" |
139 ==> n=m | next`n \<subseteq> m" |
140 by (blast dest: TFin_linear_lemma2 [rule_format]) |
140 by (blast dest: TFin_linear_lemma2 [rule_format]) |
141 |
141 |
142 text{*Consequences from section 3.3 -- Property 3.2, the ordering is total*} |
142 text{*Consequences from section 3.3 -- Property 3.2, the ordering is total*} |
143 lemma TFin_subset_linear: |
143 lemma TFin_subset_linear: |
144 "[| m \<in> TFin(S,next); n \<in> TFin(S,next); next \<in> increasing(S) |] |
144 "[| m \<in> TFin(S,next); n \<in> TFin(S,next); next \<in> increasing(S) |] |
145 ==> n <= m | m<=n" |
145 ==> n \<subseteq> m | m<=n" |
146 apply (rule disjE) |
146 apply (rule disjE) |
147 apply (rule TFin_linear_lemma1 [OF _ _TFin_linear_lemma2]) |
147 apply (rule TFin_linear_lemma1 [OF _ _TFin_linear_lemma2]) |
148 apply (assumption+, erule disjI2) |
148 apply (assumption+, erule disjI2) |
149 apply (blast del: subsetI |
149 apply (blast del: subsetI |
150 intro: subsetI increasingD2 [THEN subset_trans] TFin_is_subset) |
150 intro: subsetI increasingD2 [THEN subset_trans] TFin_is_subset) |
151 done |
151 done |
152 |
152 |
153 |
153 |
154 text{*Lemma 3 of section 3.3*} |
154 text{*Lemma 3 of section 3.3*} |
155 lemma equal_next_upper: |
155 lemma equal_next_upper: |
156 "[| n \<in> TFin(S,next); m \<in> TFin(S,next); m = next`m |] ==> n <= m" |
156 "[| n \<in> TFin(S,next); m \<in> TFin(S,next); m = next`m |] ==> n \<subseteq> m" |
157 apply (erule TFin_induct) |
157 apply (erule TFin_induct) |
158 apply (drule TFin_subsetD) |
158 apply (drule TFin_subsetD) |
159 apply (assumption+, force, blast) |
159 apply (assumption+, force, blast) |
160 done |
160 done |
161 |
161 |
162 text{*Property 3.3 of section 3.3*} |
162 text{*Property 3.3 of section 3.3*} |
163 lemma equal_next_Union: |
163 lemma equal_next_Union: |
164 "[| m \<in> TFin(S,next); next \<in> increasing(S) |] |
164 "[| m \<in> TFin(S,next); next \<in> increasing(S) |] |
165 ==> m = next`m <-> m = Union(TFin(S,next))" |
165 ==> m = next`m <-> m = \<Union>(TFin(S,next))" |
166 apply (rule iffI) |
166 apply (rule iffI) |
167 apply (rule Union_upper [THEN equalityI]) |
167 apply (rule Union_upper [THEN equalityI]) |
168 apply (rule_tac [2] equal_next_upper [THEN Union_least]) |
168 apply (rule_tac [2] equal_next_upper [THEN Union_least]) |
169 apply (assumption+) |
169 apply (assumption+) |
170 apply (erule ssubst) |
170 apply (erule ssubst) |
179 text{*NOTE: We assume the partial ordering is @{text "\<subseteq>"}, the subset |
179 text{*NOTE: We assume the partial ordering is @{text "\<subseteq>"}, the subset |
180 relation!*} |
180 relation!*} |
181 |
181 |
182 text{** Defining the "next" operation for Hausdorff's Theorem **} |
182 text{** Defining the "next" operation for Hausdorff's Theorem **} |
183 |
183 |
184 lemma chain_subset_Pow: "chain(A) <= Pow(A)" |
184 lemma chain_subset_Pow: "chain(A) \<subseteq> Pow(A)" |
185 apply (unfold chain_def) |
185 apply (unfold chain_def) |
186 apply (rule Collect_subset) |
186 apply (rule Collect_subset) |
187 done |
187 done |
188 |
188 |
189 lemma super_subset_chain: "super(A,c) <= chain(A)" |
189 lemma super_subset_chain: "super(A,c) \<subseteq> chain(A)" |
190 apply (unfold super_def) |
190 apply (unfold super_def) |
191 apply (rule Collect_subset) |
191 apply (rule Collect_subset) |
192 done |
192 done |
193 |
193 |
194 lemma maxchain_subset_chain: "maxchain(A) <= chain(A)" |
194 lemma maxchain_subset_chain: "maxchain(A) \<subseteq> chain(A)" |
195 apply (unfold maxchain_def) |
195 apply (unfold maxchain_def) |
196 apply (rule Collect_subset) |
196 apply (rule Collect_subset) |
197 done |
197 done |
198 |
198 |
199 lemma choice_super: |
199 lemma choice_super: |
253 |
253 |
254 theorem Hausdorff: "\<exists>c. c \<in> maxchain(S)" |
254 theorem Hausdorff: "\<exists>c. c \<in> maxchain(S)" |
255 apply (rule AC_Pi_Pow [THEN exE]) |
255 apply (rule AC_Pi_Pow [THEN exE]) |
256 apply (rule Hausdorff_next_exists [THEN bexE], assumption) |
256 apply (rule Hausdorff_next_exists [THEN bexE], assumption) |
257 apply (rename_tac ch "next") |
257 apply (rename_tac ch "next") |
258 apply (subgoal_tac "Union (TFin (S,next)) \<in> chain (S) ") |
258 apply (subgoal_tac "\<Union>(TFin (S,next)) \<in> chain (S) ") |
259 prefer 2 |
259 prefer 2 |
260 apply (blast intro!: TFin_chain_lemma4 subset_refl [THEN TFin_UnionI]) |
260 apply (blast intro!: TFin_chain_lemma4 subset_refl [THEN TFin_UnionI]) |
261 apply (rule_tac x = "Union (TFin (S,next))" in exI) |
261 apply (rule_tac x = "\<Union>(TFin (S,next))" in exI) |
262 apply (rule classical) |
262 apply (rule classical) |
263 apply (subgoal_tac "next ` Union (TFin (S,next)) = Union (TFin (S,next))") |
263 apply (subgoal_tac "next ` Union(TFin (S,next)) = \<Union>(TFin (S,next))") |
264 apply (rule_tac [2] equal_next_Union [THEN iffD2, symmetric]) |
264 apply (rule_tac [2] equal_next_Union [THEN iffD2, symmetric]) |
265 apply (rule_tac [2] subset_refl [THEN TFin_UnionI]) |
265 apply (rule_tac [2] subset_refl [THEN TFin_UnionI]) |
266 prefer 2 apply assumption |
266 prefer 2 apply assumption |
267 apply (rule_tac [2] refl) |
267 apply (rule_tac [2] refl) |
268 apply (simp add: subset_refl [THEN TFin_UnionI, |
268 apply (simp add: subset_refl [THEN TFin_UnionI, |
278 text{*Used in the proof of Zorn's Lemma*} |
278 text{*Used in the proof of Zorn's Lemma*} |
279 lemma chain_extend: |
279 lemma chain_extend: |
280 "[| c \<in> chain(A); z \<in> A; \<forall>x \<in> c. x<=z |] ==> cons(z,c) \<in> chain(A)" |
280 "[| c \<in> chain(A); z \<in> A; \<forall>x \<in> c. x<=z |] ==> cons(z,c) \<in> chain(A)" |
281 by (unfold chain_def, blast) |
281 by (unfold chain_def, blast) |
282 |
282 |
283 lemma Zorn: "\<forall>c \<in> chain(S). Union(c) \<in> S ==> \<exists>y \<in> S. \<forall>z \<in> S. y<=z --> y=z" |
283 lemma Zorn: "\<forall>c \<in> chain(S). \<Union>(c) \<in> S ==> \<exists>y \<in> S. \<forall>z \<in> S. y<=z \<longrightarrow> y=z" |
284 apply (rule Hausdorff [THEN exE]) |
284 apply (rule Hausdorff [THEN exE]) |
285 apply (simp add: maxchain_def) |
285 apply (simp add: maxchain_def) |
286 apply (rename_tac c) |
286 apply (rename_tac c) |
287 apply (rule_tac x = "Union (c)" in bexI) |
287 apply (rule_tac x = "\<Union>(c)" in bexI) |
288 prefer 2 apply blast |
288 prefer 2 apply blast |
289 apply safe |
289 apply safe |
290 apply (rename_tac z) |
290 apply (rename_tac z) |
291 apply (rule classical) |
291 apply (rule classical) |
292 apply (subgoal_tac "cons (z,c) \<in> super (S,c) ") |
292 apply (subgoal_tac "cons (z,c) \<in> super (S,c) ") |
297 done |
297 done |
298 |
298 |
299 text {* Alternative version of Zorn's Lemma *} |
299 text {* Alternative version of Zorn's Lemma *} |
300 |
300 |
301 theorem Zorn2: |
301 theorem Zorn2: |
302 "\<forall>c \<in> chain(S). \<exists>y \<in> S. \<forall>x \<in> c. x <= y ==> \<exists>y \<in> S. \<forall>z \<in> S. y<=z --> y=z" |
302 "\<forall>c \<in> chain(S). \<exists>y \<in> S. \<forall>x \<in> c. x \<subseteq> y ==> \<exists>y \<in> S. \<forall>z \<in> S. y<=z \<longrightarrow> y=z" |
303 apply (cut_tac Hausdorff maxchain_subset_chain) |
303 apply (cut_tac Hausdorff maxchain_subset_chain) |
304 apply (erule exE) |
304 apply (erule exE) |
305 apply (drule subsetD, assumption) |
305 apply (drule subsetD, assumption) |
306 apply (drule bspec, assumption, erule bexE) |
306 apply (drule bspec, assumption, erule bexE) |
307 apply (rule_tac x = y in bexI) |
307 apply (rule_tac x = y in bexI) |
319 |
319 |
320 subsection{*Zermelo's Theorem: Every Set can be Well-Ordered*} |
320 subsection{*Zermelo's Theorem: Every Set can be Well-Ordered*} |
321 |
321 |
322 text{*Lemma 5*} |
322 text{*Lemma 5*} |
323 lemma TFin_well_lemma5: |
323 lemma TFin_well_lemma5: |
324 "[| n \<in> TFin(S,next); Z <= TFin(S,next); z:Z; ~ Inter(Z) \<in> Z |] |
324 "[| n \<in> TFin(S,next); Z \<subseteq> TFin(S,next); z:Z; ~ \<Inter>(Z) \<in> Z |] |
325 ==> \<forall>m \<in> Z. n <= m" |
325 ==> \<forall>m \<in> Z. n \<subseteq> m" |
326 apply (erule TFin_induct) |
326 apply (erule TFin_induct) |
327 prefer 2 apply blast txt{*second induction step is easy*} |
327 prefer 2 apply blast txt{*second induction step is easy*} |
328 apply (rule ballI) |
328 apply (rule ballI) |
329 apply (rule bspec [THEN TFin_subsetD, THEN disjE], auto) |
329 apply (rule bspec [THEN TFin_subsetD, THEN disjE], auto) |
330 apply (subgoal_tac "m = Inter (Z) ") |
330 apply (subgoal_tac "m = \<Inter>(Z) ") |
331 apply blast+ |
331 apply blast+ |
332 done |
332 done |
333 |
333 |
334 text{*Well-ordering of @{term "TFin(S,next)"} *} |
334 text{*Well-ordering of @{term "TFin(S,next)"} *} |
335 lemma well_ord_TFin_lemma: "[| Z <= TFin(S,next); z \<in> Z |] ==> Inter(Z) \<in> Z" |
335 lemma well_ord_TFin_lemma: "[| Z \<subseteq> TFin(S,next); z \<in> Z |] ==> \<Inter>(Z) \<in> Z" |
336 apply (rule classical) |
336 apply (rule classical) |
337 apply (subgoal_tac "Z = {Union (TFin (S,next))}") |
337 apply (subgoal_tac "Z = {\<Union>(TFin (S,next))}") |
338 apply (simp (no_asm_simp) add: Inter_singleton) |
338 apply (simp (no_asm_simp) add: Inter_singleton) |
339 apply (erule equal_singleton) |
339 apply (erule equal_singleton) |
340 apply (rule Union_upper [THEN equalityI]) |
340 apply (rule Union_upper [THEN equalityI]) |
341 apply (rule_tac [2] subset_refl [THEN TFin_UnionI, THEN TFin_well_lemma5, THEN bspec], blast+) |
341 apply (rule_tac [2] subset_refl [THEN TFin_UnionI, THEN TFin_well_lemma5, THEN bspec], blast+) |
342 done |
342 done |
348 apply (rule well_ordI) |
348 apply (rule well_ordI) |
349 apply (unfold Subset_rel_def linear_def) |
349 apply (unfold Subset_rel_def linear_def) |
350 txt{*Prove the well-foundedness goal*} |
350 txt{*Prove the well-foundedness goal*} |
351 apply (rule wf_onI) |
351 apply (rule wf_onI) |
352 apply (frule well_ord_TFin_lemma, assumption) |
352 apply (frule well_ord_TFin_lemma, assumption) |
353 apply (drule_tac x = "Inter (Z) " in bspec, assumption) |
353 apply (drule_tac x = "\<Inter>(Z) " in bspec, assumption) |
354 apply blast |
354 apply blast |
355 txt{*Now prove the linearity goal*} |
355 txt{*Now prove the linearity goal*} |
356 apply (intro ballI) |
356 apply (intro ballI) |
357 apply (case_tac "x=y") |
357 apply (case_tac "x=y") |
358 apply blast |
358 apply blast |
392 text{*The construction of the injection*} |
392 text{*The construction of the injection*} |
393 lemma choice_imp_injection: |
393 lemma choice_imp_injection: |
394 "[| ch \<in> (\<Pi> X \<in> Pow(S)-{0}. X); |
394 "[| ch \<in> (\<Pi> X \<in> Pow(S)-{0}. X); |
395 next \<in> increasing(S); |
395 next \<in> increasing(S); |
396 \<forall>X \<in> Pow(S). next`X = if(X=S, S, cons(ch`(S-X), X)) |] |
396 \<forall>X \<in> Pow(S). next`X = if(X=S, S, cons(ch`(S-X), X)) |] |
397 ==> (\<lambda> x \<in> S. Union({y \<in> TFin(S,next). x \<notin> y})) |
397 ==> (\<lambda> x \<in> S. \<Union>({y \<in> TFin(S,next). x \<notin> y})) |
398 \<in> inj(S, TFin(S,next) - {S})" |
398 \<in> inj(S, TFin(S,next) - {S})" |
399 apply (rule_tac d = "%y. ch` (S-y) " in lam_injective) |
399 apply (rule_tac d = "%y. ch` (S-y) " in lam_injective) |
400 apply (rule DiffI) |
400 apply (rule DiffI) |
401 apply (rule Collect_subset [THEN TFin_UnionI]) |
401 apply (rule Collect_subset [THEN TFin_UnionI]) |
402 apply (blast intro!: Collect_subset [THEN TFin_UnionI] elim: equalityE) |
402 apply (blast intro!: Collect_subset [THEN TFin_UnionI] elim: equalityE) |
403 apply (subgoal_tac "x \<notin> Union ({y \<in> TFin (S,next) . x \<notin> y}) ") |
403 apply (subgoal_tac "x \<notin> \<Union>({y \<in> TFin (S,next) . x \<notin> y}) ") |
404 prefer 2 apply (blast elim: equalityE) |
404 prefer 2 apply (blast elim: equalityE) |
405 apply (subgoal_tac "Union ({y \<in> TFin (S,next) . x \<notin> y}) \<noteq> S") |
405 apply (subgoal_tac "\<Union>({y \<in> TFin (S,next) . x \<notin> y}) \<noteq> S") |
406 prefer 2 apply (blast elim: equalityE) |
406 prefer 2 apply (blast elim: equalityE) |
407 txt{*For proving @{text "x \<in> next`Union(...)"}. |
407 txt{*For proving @{text "x \<in> next`\<Union>(...)"}. |
408 Abrial and Laffitte's justification appears to be faulty.*} |
408 Abrial and Laffitte's justification appears to be faulty.*} |
409 apply (subgoal_tac "~ next ` Union ({y \<in> TFin (S,next) . x \<notin> y}) |
409 apply (subgoal_tac "~ next ` Union({y \<in> TFin (S,next) . x \<notin> y}) |
410 <= Union ({y \<in> TFin (S,next) . x \<notin> y}) ") |
410 \<subseteq> \<Union>({y \<in> TFin (S,next) . x \<notin> y}) ") |
411 prefer 2 |
411 prefer 2 |
412 apply (simp del: Union_iff |
412 apply (simp del: Union_iff |
413 add: Collect_subset [THEN TFin_UnionI, THEN TFin_is_subset] |
413 add: Collect_subset [THEN TFin_UnionI, THEN TFin_is_subset] |
414 Pow_iff cons_subset_iff subset_refl choice_Diff [THEN DiffD2]) |
414 Pow_iff cons_subset_iff subset_refl choice_Diff [THEN DiffD2]) |
415 apply (subgoal_tac "x \<in> next ` Union ({y \<in> TFin (S,next) . x \<notin> y}) ") |
415 apply (subgoal_tac "x \<in> next ` Union({y \<in> TFin (S,next) . x \<notin> y}) ") |
416 prefer 2 |
416 prefer 2 |
417 apply (blast intro!: Collect_subset [THEN TFin_UnionI] TFin.nextI) |
417 apply (blast intro!: Collect_subset [THEN TFin_UnionI] TFin.nextI) |
418 txt{*End of the lemmas!*} |
418 txt{*End of the lemmas!*} |
419 apply (simp add: Collect_subset [THEN TFin_UnionI, THEN TFin_is_subset]) |
419 apply (simp add: Collect_subset [THEN TFin_UnionI, THEN TFin_is_subset]) |
420 done |
420 done |
434 |
434 |
435 text {* Reimported from HOL by Clemens Ballarin. *} |
435 text {* Reimported from HOL by Clemens Ballarin. *} |
436 |
436 |
437 |
437 |
438 definition Chain :: "i => i" where |
438 definition Chain :: "i => i" where |
439 "Chain(r) = {A : Pow(field(r)). ALL a:A. ALL b:A. <a, b> : r | <b, a> : r}" |
439 "Chain(r) = {A \<in> Pow(field(r)). \<forall>a\<in>A. \<forall>b\<in>A. <a, b> \<in> r | <b, a> \<in> r}" |
440 |
440 |
441 lemma mono_Chain: |
441 lemma mono_Chain: |
442 "r \<subseteq> s ==> Chain(r) \<subseteq> Chain(s)" |
442 "r \<subseteq> s ==> Chain(r) \<subseteq> Chain(s)" |
443 unfolding Chain_def |
443 unfolding Chain_def |
444 by blast |
444 by blast |
445 |
445 |
446 theorem Zorn_po: |
446 theorem Zorn_po: |
447 assumes po: "Partial_order(r)" |
447 assumes po: "Partial_order(r)" |
448 and u: "ALL C:Chain(r). EX u:field(r). ALL a:C. <a, u> : r" |
448 and u: "\<forall>C\<in>Chain(r). \<exists>u\<in>field(r). \<forall>a\<in>C. <a, u> \<in> r" |
449 shows "EX m:field(r). ALL a:field(r). <m, a> : r --> a = m" |
449 shows "\<exists>m\<in>field(r). \<forall>a\<in>field(r). <m, a> \<in> r \<longrightarrow> a = m" |
450 proof - |
450 proof - |
451 have "Preorder(r)" using po by (simp add: partial_order_on_def) |
451 have "Preorder(r)" using po by (simp add: partial_order_on_def) |
452 --{* Mirror r in the set of subsets below (wrt r) elements of A (?). *} |
452 --{* Mirror r in the set of subsets below (wrt r) elements of A (?). *} |
453 let ?B = "lam x:field(r). r -`` {x}" let ?S = "?B `` field(r)" |
453 let ?B = "\<lambda>x\<in>field(r). r -`` {x}" let ?S = "?B `` field(r)" |
454 have "ALL C:chain(?S). EX U:?S. ALL A:C. A \<subseteq> U" |
454 have "\<forall>C\<in>chain(?S). \<exists>U\<in>?S. \<forall>A\<in>C. A \<subseteq> U" |
455 proof (clarsimp simp: chain_def Subset_rel_def bex_image_simp) |
455 proof (clarsimp simp: chain_def Subset_rel_def bex_image_simp) |
456 fix C |
456 fix C |
457 assume 1: "C \<subseteq> ?S" and 2: "ALL A:C. ALL B:C. A \<subseteq> B | B \<subseteq> A" |
457 assume 1: "C \<subseteq> ?S" and 2: "\<forall>A\<in>C. \<forall>B\<in>C. A \<subseteq> B | B \<subseteq> A" |
458 let ?A = "{x : field(r). EX M:C. M = ?B`x}" |
458 let ?A = "{x \<in> field(r). \<exists>M\<in>C. M = ?B`x}" |
459 have "C = ?B `` ?A" using 1 |
459 have "C = ?B `` ?A" using 1 |
460 apply (auto simp: image_def) |
460 apply (auto simp: image_def) |
461 apply rule |
461 apply rule |
462 apply rule |
462 apply rule |
463 apply (drule subsetD) apply assumption |
463 apply (drule subsetD) apply assumption |
470 apply assumption |
470 apply assumption |
471 |
471 |
472 apply (thin_tac "C \<subseteq> ?X") |
472 apply (thin_tac "C \<subseteq> ?X") |
473 apply (fast elim: lamE) |
473 apply (fast elim: lamE) |
474 done |
474 done |
475 have "?A : Chain(r)" |
475 have "?A \<in> Chain(r)" |
476 proof (simp add: Chain_def subsetI, intro conjI ballI impI) |
476 proof (simp add: Chain_def subsetI, intro conjI ballI impI) |
477 fix a b |
477 fix a b |
478 assume "a : field(r)" "r -`` {a} : C" "b : field(r)" "r -`` {b} : C" |
478 assume "a \<in> field(r)" "r -`` {a} \<in> C" "b \<in> field(r)" "r -`` {b} \<in> C" |
479 hence "r -`` {a} \<subseteq> r -`` {b} | r -`` {b} \<subseteq> r -`` {a}" using 2 by auto |
479 hence "r -`` {a} \<subseteq> r -`` {b} | r -`` {b} \<subseteq> r -`` {a}" using 2 by auto |
480 then show "<a, b> : r | <b, a> : r" |
480 then show "<a, b> \<in> r | <b, a> \<in> r" |
481 using `Preorder(r)` `a : field(r)` `b : field(r)` |
481 using `Preorder(r)` `a \<in> field(r)` `b \<in> field(r)` |
482 by (simp add: subset_vimage1_vimage1_iff) |
482 by (simp add: subset_vimage1_vimage1_iff) |
483 qed |
483 qed |
484 then obtain u where uA: "u : field(r)" "ALL a:?A. <a, u> : r" |
484 then obtain u where uA: "u \<in> field(r)" "\<forall>a\<in>?A. <a, u> \<in> r" |
485 using u |
485 using u |
486 apply auto |
486 apply auto |
487 apply (drule bspec) apply assumption |
487 apply (drule bspec) apply assumption |
488 apply auto |
488 apply auto |
489 done |
489 done |
490 have "ALL A:C. A \<subseteq> r -`` {u}" |
490 have "\<forall>A\<in>C. A \<subseteq> r -`` {u}" |
491 proof (auto intro!: vimageI) |
491 proof (auto intro!: vimageI) |
492 fix a B |
492 fix a B |
493 assume aB: "B : C" "a : B" |
493 assume aB: "B \<in> C" "a \<in> B" |
494 with 1 obtain x where "x : field(r)" "B = r -`` {x}" |
494 with 1 obtain x where "x \<in> field(r)" "B = r -`` {x}" |
495 apply - |
495 apply - |
496 apply (drule subsetD) apply assumption |
496 apply (drule subsetD) apply assumption |
497 apply (erule imageE) |
497 apply (erule imageE) |
498 apply (erule lamE) |
498 apply (erule lamE) |
499 apply simp |
499 apply simp |
500 done |
500 done |
501 then show "<a, u> : r" using uA aB `Preorder(r)` |
501 then show "<a, u> \<in> r" using uA aB `Preorder(r)` |
502 by (auto simp: preorder_on_def refl_def) (blast dest: trans_onD)+ |
502 by (auto simp: preorder_on_def refl_def) (blast dest: trans_onD)+ |
503 qed |
503 qed |
504 then show "EX U:field(r). ALL A:C. A \<subseteq> r -`` {U}" |
504 then show "\<exists>U\<in>field(r). \<forall>A\<in>C. A \<subseteq> r -`` {U}" |
505 using `u : field(r)` .. |
505 using `u \<in> field(r)` .. |
506 qed |
506 qed |
507 from Zorn2 [OF this] |
507 from Zorn2 [OF this] |
508 obtain m B where "m : field(r)" "B = r -`` {m}" |
508 obtain m B where "m \<in> field(r)" "B = r -`` {m}" |
509 "ALL x:field(r). B \<subseteq> r -`` {x} --> B = r -`` {x}" |
509 "\<forall>x\<in>field(r). B \<subseteq> r -`` {x} \<longrightarrow> B = r -`` {x}" |
510 by (auto elim!: lamE simp: ball_image_simp) |
510 by (auto elim!: lamE simp: ball_image_simp) |
511 then have "ALL a:field(r). <m, a> : r --> a = m" |
511 then have "\<forall>a\<in>field(r). <m, a> \<in> r \<longrightarrow> a = m" |
512 using po `Preorder(r)` `m : field(r)` |
512 using po `Preorder(r)` `m \<in> field(r)` |
513 by (auto simp: subset_vimage1_vimage1_iff Partial_order_eq_vimage1_vimage1_iff) |
513 by (auto simp: subset_vimage1_vimage1_iff Partial_order_eq_vimage1_vimage1_iff) |
514 then show ?thesis using `m : field(r)` by blast |
514 then show ?thesis using `m \<in> field(r)` by blast |
515 qed |
515 qed |
516 |
516 |
517 end |
517 end |