author | wenzelm |
Sat, 26 May 2018 21:24:07 +0200 | |
changeset 68294 | 0f513ae3db77 |
parent 67673 | c8caefb20564 |
child 68745 | 345ce5f262ea |
permissions | -rw-r--r-- |
63572 | 1 |
(* Title: HOL/Zorn.thy |
2 |
Author: Jacques D. Fleuriot |
|
3 |
Author: Tobias Nipkow, TUM |
|
4 |
Author: Christian Sternagel, JAIST |
|
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30663
diff
changeset
|
5 |
|
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30663
diff
changeset
|
6 |
Zorn's Lemma (ported from Larry Paulson's Zorn.thy in ZF). |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30663
diff
changeset
|
7 |
The well-ordering theorem. |
14706 | 8 |
*) |
13551
b7f64ee8da84
converted Hyperreal/Zorn to Isar format and moved to Library
paulson
parents:
diff
changeset
|
9 |
|
60758 | 10 |
section \<open>Zorn's Lemma\<close> |
13551
b7f64ee8da84
converted Hyperreal/Zorn to Isar format and moved to Library
paulson
parents:
diff
changeset
|
11 |
|
15131 | 12 |
theory Zorn |
63572 | 13 |
imports Order_Relation Hilbert_Choice |
15131 | 14 |
begin |
13551
b7f64ee8da84
converted Hyperreal/Zorn to Isar format and moved to Library
paulson
parents:
diff
changeset
|
15 |
|
60758 | 16 |
subsection \<open>Zorn's Lemma for the Subset Relation\<close> |
52181 | 17 |
|
60758 | 18 |
subsubsection \<open>Results that do not require an order\<close> |
52181 | 19 |
|
61799 | 20 |
text \<open>Let \<open>P\<close> be a binary predicate on the set \<open>A\<close>.\<close> |
52181 | 21 |
locale pred_on = |
22 |
fixes A :: "'a set" |
|
63572 | 23 |
and P :: "'a \<Rightarrow> 'a \<Rightarrow> bool" (infix "\<sqsubset>" 50) |
52181 | 24 |
begin |
25 |
||
63572 | 26 |
abbreviation Peq :: "'a \<Rightarrow> 'a \<Rightarrow> bool" (infix "\<sqsubseteq>" 50) |
27 |
where "x \<sqsubseteq> y \<equiv> P\<^sup>=\<^sup>= x y" |
|
28 |
||
29 |
text \<open>A chain is a totally ordered subset of \<open>A\<close>.\<close> |
|
30 |
definition chain :: "'a set \<Rightarrow> bool" |
|
31 |
where "chain C \<longleftrightarrow> C \<subseteq> A \<and> (\<forall>x\<in>C. \<forall>y\<in>C. x \<sqsubseteq> y \<or> y \<sqsubseteq> x)" |
|
52181 | 32 |
|
63572 | 33 |
text \<open> |
34 |
We call a chain that is a proper superset of some set \<open>X\<close>, |
|
35 |
but not necessarily a chain itself, a superchain of \<open>X\<close>. |
|
36 |
\<close> |
|
37 |
abbreviation superchain :: "'a set \<Rightarrow> 'a set \<Rightarrow> bool" (infix "<c" 50) |
|
38 |
where "X <c C \<equiv> chain C \<and> X \<subset> C" |
|
52181 | 39 |
|
60758 | 40 |
text \<open>A maximal chain is a chain that does not have a superchain.\<close> |
63572 | 41 |
definition maxchain :: "'a set \<Rightarrow> bool" |
42 |
where "maxchain C \<longleftrightarrow> chain C \<and> (\<nexists>S. C <c S)" |
|
52181 | 43 |
|
63572 | 44 |
text \<open> |
45 |
We define the successor of a set to be an arbitrary |
|
46 |
superchain, if such exists, or the set itself, otherwise. |
|
47 |
\<close> |
|
48 |
definition suc :: "'a set \<Rightarrow> 'a set" |
|
49 |
where "suc C = (if \<not> chain C \<or> maxchain C then C else (SOME D. C <c D))" |
|
52181 | 50 |
|
63572 | 51 |
lemma chainI [Pure.intro?]: "C \<subseteq> A \<Longrightarrow> (\<And>x y. x \<in> C \<Longrightarrow> y \<in> C \<Longrightarrow> x \<sqsubseteq> y \<or> y \<sqsubseteq> x) \<Longrightarrow> chain C" |
52181 | 52 |
unfolding chain_def by blast |
53 |
||
63572 | 54 |
lemma chain_total: "chain C \<Longrightarrow> x \<in> C \<Longrightarrow> y \<in> C \<Longrightarrow> x \<sqsubseteq> y \<or> y \<sqsubseteq> x" |
52181 | 55 |
by (simp add: chain_def) |
56 |
||
57 |
lemma not_chain_suc [simp]: "\<not> chain X \<Longrightarrow> suc X = X" |
|
58 |
by (simp add: suc_def) |
|
59 |
||
60 |
lemma maxchain_suc [simp]: "maxchain X \<Longrightarrow> suc X = X" |
|
61 |
by (simp add: suc_def) |
|
62 |
||
63 |
lemma suc_subset: "X \<subseteq> suc X" |
|
64 |
by (auto simp: suc_def maxchain_def intro: someI2) |
|
65 |
||
66 |
lemma chain_empty [simp]: "chain {}" |
|
67 |
by (auto simp: chain_def) |
|
68 |
||
63572 | 69 |
lemma not_maxchain_Some: "chain C \<Longrightarrow> \<not> maxchain C \<Longrightarrow> C <c (SOME D. C <c D)" |
52181 | 70 |
by (rule someI_ex) (auto simp: maxchain_def) |
71 |
||
63572 | 72 |
lemma suc_not_equals: "chain C \<Longrightarrow> \<not> maxchain C \<Longrightarrow> suc C \<noteq> C" |
55811 | 73 |
using not_maxchain_Some by (auto simp: suc_def) |
52181 | 74 |
|
75 |
lemma subset_suc: |
|
63572 | 76 |
assumes "X \<subseteq> Y" |
77 |
shows "X \<subseteq> suc Y" |
|
52181 | 78 |
using assms by (rule subset_trans) (rule suc_subset) |
79 |
||
63572 | 80 |
text \<open> |
81 |
We build a set @{term \<C>} that is closed under applications |
|
82 |
of @{term suc} and contains the union of all its subsets. |
|
83 |
\<close> |
|
84 |
inductive_set suc_Union_closed ("\<C>") |
|
85 |
where |
|
86 |
suc: "X \<in> \<C> \<Longrightarrow> suc X \<in> \<C>" |
|
87 |
| Union [unfolded Pow_iff]: "X \<in> Pow \<C> \<Longrightarrow> \<Union>X \<in> \<C>" |
|
52181 | 88 |
|
63572 | 89 |
text \<open> |
90 |
Since the empty set as well as the set itself is a subset of |
|
91 |
every set, @{term \<C>} contains at least @{term "{} \<in> \<C>"} and |
|
92 |
@{term "\<Union>\<C> \<in> \<C>"}. |
|
93 |
\<close> |
|
94 |
lemma suc_Union_closed_empty: "{} \<in> \<C>" |
|
95 |
and suc_Union_closed_Union: "\<Union>\<C> \<in> \<C>" |
|
96 |
using Union [of "{}"] and Union [of "\<C>"] by simp_all |
|
97 |
||
98 |
text \<open>Thus closure under @{term suc} will hit a maximal chain |
|
99 |
eventually, as is shown below.\<close> |
|
26272 | 100 |
|
63572 | 101 |
lemma suc_Union_closed_induct [consumes 1, case_names suc Union, induct pred: suc_Union_closed]: |
52181 | 102 |
assumes "X \<in> \<C>" |
63572 | 103 |
and "\<And>X. X \<in> \<C> \<Longrightarrow> Q X \<Longrightarrow> Q (suc X)" |
104 |
and "\<And>X. X \<subseteq> \<C> \<Longrightarrow> \<forall>x\<in>X. Q x \<Longrightarrow> Q (\<Union>X)" |
|
105 |
shows "Q X" |
|
106 |
using assms by induct blast+ |
|
107 |
||
108 |
lemma suc_Union_closed_cases [consumes 1, case_names suc Union, cases pred: suc_Union_closed]: |
|
109 |
assumes "X \<in> \<C>" |
|
110 |
and "\<And>Y. X = suc Y \<Longrightarrow> Y \<in> \<C> \<Longrightarrow> Q" |
|
111 |
and "\<And>Y. X = \<Union>Y \<Longrightarrow> Y \<subseteq> \<C> \<Longrightarrow> Q" |
|
52181 | 112 |
shows "Q" |
63572 | 113 |
using assms by cases simp_all |
52181 | 114 |
|
60758 | 115 |
text \<open>On chains, @{term suc} yields a chain.\<close> |
52181 | 116 |
lemma chain_suc: |
63572 | 117 |
assumes "chain X" |
118 |
shows "chain (suc X)" |
|
52181 | 119 |
using assms |
63572 | 120 |
by (cases "\<not> chain X \<or> maxchain X") (force simp: suc_def dest: not_maxchain_Some)+ |
52181 | 121 |
|
122 |
lemma chain_sucD: |
|
63572 | 123 |
assumes "chain X" |
124 |
shows "suc X \<subseteq> A \<and> chain (suc X)" |
|
52181 | 125 |
proof - |
63572 | 126 |
from \<open>chain X\<close> have *: "chain (suc X)" |
127 |
by (rule chain_suc) |
|
128 |
then have "suc X \<subseteq> A" |
|
129 |
unfolding chain_def by blast |
|
53374
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents:
52821
diff
changeset
|
130 |
with * show ?thesis by blast |
52181 | 131 |
qed |
132 |
||
133 |
lemma suc_Union_closed_total': |
|
134 |
assumes "X \<in> \<C>" and "Y \<in> \<C>" |
|
135 |
and *: "\<And>Z. Z \<in> \<C> \<Longrightarrow> Z \<subseteq> Y \<Longrightarrow> Z = Y \<or> suc Z \<subseteq> Y" |
|
136 |
shows "X \<subseteq> Y \<or> suc Y \<subseteq> X" |
|
60758 | 137 |
using \<open>X \<in> \<C>\<close> |
63572 | 138 |
proof induct |
52181 | 139 |
case (suc X) |
140 |
with * show ?case by (blast del: subsetI intro: subset_suc) |
|
63572 | 141 |
next |
142 |
case Union |
|
143 |
then show ?case by blast |
|
144 |
qed |
|
13551
b7f64ee8da84
converted Hyperreal/Zorn to Isar format and moved to Library
paulson
parents:
diff
changeset
|
145 |
|
52181 | 146 |
lemma suc_Union_closed_subsetD: |
147 |
assumes "Y \<subseteq> X" and "X \<in> \<C>" and "Y \<in> \<C>" |
|
148 |
shows "X = Y \<or> suc Y \<subseteq> X" |
|
63572 | 149 |
using assms(2,3,1) |
52181 | 150 |
proof (induct arbitrary: Y) |
151 |
case (suc X) |
|
63572 | 152 |
note * = \<open>\<And>Y. Y \<in> \<C> \<Longrightarrow> Y \<subseteq> X \<Longrightarrow> X = Y \<or> suc Y \<subseteq> X\<close> |
60758 | 153 |
with suc_Union_closed_total' [OF \<open>Y \<in> \<C>\<close> \<open>X \<in> \<C>\<close>] |
63572 | 154 |
have "Y \<subseteq> X \<or> suc X \<subseteq> Y" by blast |
52181 | 155 |
then show ?case |
156 |
proof |
|
157 |
assume "Y \<subseteq> X" |
|
60758 | 158 |
with * and \<open>Y \<in> \<C>\<close> have "X = Y \<or> suc Y \<subseteq> X" by blast |
52181 | 159 |
then show ?thesis |
160 |
proof |
|
63572 | 161 |
assume "X = Y" |
162 |
then show ?thesis by simp |
|
52181 | 163 |
next |
164 |
assume "suc Y \<subseteq> X" |
|
165 |
then have "suc Y \<subseteq> suc X" by (rule subset_suc) |
|
166 |
then show ?thesis by simp |
|
167 |
qed |
|
168 |
next |
|
169 |
assume "suc X \<subseteq> Y" |
|
60758 | 170 |
with \<open>Y \<subseteq> suc X\<close> show ?thesis by blast |
52181 | 171 |
qed |
172 |
next |
|
173 |
case (Union X) |
|
174 |
show ?case |
|
175 |
proof (rule ccontr) |
|
176 |
assume "\<not> ?thesis" |
|
60758 | 177 |
with \<open>Y \<subseteq> \<Union>X\<close> obtain x y z |
63572 | 178 |
where "\<not> suc Y \<subseteq> \<Union>X" |
179 |
and "x \<in> X" and "y \<in> x" and "y \<notin> Y" |
|
180 |
and "z \<in> suc Y" and "\<forall>x\<in>X. z \<notin> x" by blast |
|
60758 | 181 |
with \<open>X \<subseteq> \<C>\<close> have "x \<in> \<C>" by blast |
63572 | 182 |
from Union and \<open>x \<in> X\<close> have *: "\<And>y. y \<in> \<C> \<Longrightarrow> y \<subseteq> x \<Longrightarrow> x = y \<or> suc y \<subseteq> x" |
183 |
by blast |
|
184 |
with suc_Union_closed_total' [OF \<open>Y \<in> \<C>\<close> \<open>x \<in> \<C>\<close>] have "Y \<subseteq> x \<or> suc x \<subseteq> Y" |
|
185 |
by blast |
|
52181 | 186 |
then show False |
187 |
proof |
|
188 |
assume "Y \<subseteq> x" |
|
60758 | 189 |
with * [OF \<open>Y \<in> \<C>\<close>] have "x = Y \<or> suc Y \<subseteq> x" by blast |
52181 | 190 |
then show False |
191 |
proof |
|
63572 | 192 |
assume "x = Y" |
193 |
with \<open>y \<in> x\<close> and \<open>y \<notin> Y\<close> show False by blast |
|
52181 | 194 |
next |
195 |
assume "suc Y \<subseteq> x" |
|
60758 | 196 |
with \<open>x \<in> X\<close> have "suc Y \<subseteq> \<Union>X" by blast |
197 |
with \<open>\<not> suc Y \<subseteq> \<Union>X\<close> show False by contradiction |
|
52181 | 198 |
qed |
199 |
next |
|
200 |
assume "suc x \<subseteq> Y" |
|
60758 | 201 |
moreover from suc_subset and \<open>y \<in> x\<close> have "y \<in> suc x" by blast |
202 |
ultimately show False using \<open>y \<notin> Y\<close> by blast |
|
52181 | 203 |
qed |
204 |
qed |
|
205 |
qed |
|
13551
b7f64ee8da84
converted Hyperreal/Zorn to Isar format and moved to Library
paulson
parents:
diff
changeset
|
206 |
|
60758 | 207 |
text \<open>The elements of @{term \<C>} are totally ordered by the subset relation.\<close> |
52181 | 208 |
lemma suc_Union_closed_total: |
209 |
assumes "X \<in> \<C>" and "Y \<in> \<C>" |
|
210 |
shows "X \<subseteq> Y \<or> Y \<subseteq> X" |
|
211 |
proof (cases "\<forall>Z\<in>\<C>. Z \<subseteq> Y \<longrightarrow> Z = Y \<or> suc Z \<subseteq> Y") |
|
212 |
case True |
|
213 |
with suc_Union_closed_total' [OF assms] |
|
63572 | 214 |
have "X \<subseteq> Y \<or> suc Y \<subseteq> X" by blast |
215 |
with suc_subset [of Y] show ?thesis by blast |
|
52181 | 216 |
next |
217 |
case False |
|
63572 | 218 |
then obtain Z where "Z \<in> \<C>" and "Z \<subseteq> Y" and "Z \<noteq> Y" and "\<not> suc Z \<subseteq> Y" |
219 |
by blast |
|
220 |
with suc_Union_closed_subsetD and \<open>Y \<in> \<C>\<close> show ?thesis |
|
221 |
by blast |
|
52181 | 222 |
qed |
223 |
||
60758 | 224 |
text \<open>Once we hit a fixed point w.r.t. @{term suc}, all other elements |
63572 | 225 |
of @{term \<C>} are subsets of this fixed point.\<close> |
52181 | 226 |
lemma suc_Union_closed_suc: |
227 |
assumes "X \<in> \<C>" and "Y \<in> \<C>" and "suc Y = Y" |
|
228 |
shows "X \<subseteq> Y" |
|
63572 | 229 |
using \<open>X \<in> \<C>\<close> |
230 |
proof induct |
|
52181 | 231 |
case (suc X) |
63572 | 232 |
with \<open>Y \<in> \<C>\<close> and suc_Union_closed_subsetD have "X = Y \<or> suc X \<subseteq> Y" |
233 |
by blast |
|
234 |
then show ?case |
|
235 |
by (auto simp: \<open>suc Y = Y\<close>) |
|
236 |
next |
|
237 |
case Union |
|
238 |
then show ?case by blast |
|
239 |
qed |
|
52181 | 240 |
|
241 |
lemma eq_suc_Union: |
|
242 |
assumes "X \<in> \<C>" |
|
243 |
shows "suc X = X \<longleftrightarrow> X = \<Union>\<C>" |
|
63572 | 244 |
(is "?lhs \<longleftrightarrow> ?rhs") |
52181 | 245 |
proof |
63572 | 246 |
assume ?lhs |
247 |
then have "\<Union>\<C> \<subseteq> X" |
|
248 |
by (rule suc_Union_closed_suc [OF suc_Union_closed_Union \<open>X \<in> \<C>\<close>]) |
|
249 |
with \<open>X \<in> \<C>\<close> show ?rhs |
|
250 |
by blast |
|
52181 | 251 |
next |
60758 | 252 |
from \<open>X \<in> \<C>\<close> have "suc X \<in> \<C>" by (rule suc) |
52181 | 253 |
then have "suc X \<subseteq> \<Union>\<C>" by blast |
63572 | 254 |
moreover assume ?rhs |
52181 | 255 |
ultimately have "suc X \<subseteq> X" by simp |
256 |
moreover have "X \<subseteq> suc X" by (rule suc_subset) |
|
63572 | 257 |
ultimately show ?lhs .. |
52181 | 258 |
qed |
13551
b7f64ee8da84
converted Hyperreal/Zorn to Isar format and moved to Library
paulson
parents:
diff
changeset
|
259 |
|
52181 | 260 |
lemma suc_in_carrier: |
261 |
assumes "X \<subseteq> A" |
|
262 |
shows "suc X \<subseteq> A" |
|
263 |
using assms |
|
63572 | 264 |
by (cases "\<not> chain X \<or> maxchain X") (auto dest: chain_sucD) |
52181 | 265 |
|
266 |
lemma suc_Union_closed_in_carrier: |
|
267 |
assumes "X \<in> \<C>" |
|
268 |
shows "X \<subseteq> A" |
|
269 |
using assms |
|
63572 | 270 |
by induct (auto dest: suc_in_carrier) |
52181 | 271 |
|
60758 | 272 |
text \<open>All elements of @{term \<C>} are chains.\<close> |
52181 | 273 |
lemma suc_Union_closed_chain: |
274 |
assumes "X \<in> \<C>" |
|
275 |
shows "chain X" |
|
63572 | 276 |
using assms |
277 |
proof induct |
|
278 |
case (suc X) |
|
279 |
then show ?case |
|
280 |
using not_maxchain_Some by (simp add: suc_def) |
|
52181 | 281 |
next |
282 |
case (Union X) |
|
63572 | 283 |
then have "\<Union>X \<subseteq> A" |
284 |
by (auto dest: suc_Union_closed_in_carrier) |
|
52181 | 285 |
moreover have "\<forall>x\<in>\<Union>X. \<forall>y\<in>\<Union>X. x \<sqsubseteq> y \<or> y \<sqsubseteq> x" |
286 |
proof (intro ballI) |
|
287 |
fix x y |
|
288 |
assume "x \<in> \<Union>X" and "y \<in> \<Union>X" |
|
63572 | 289 |
then obtain u v where "x \<in> u" and "u \<in> X" and "y \<in> v" and "v \<in> X" |
290 |
by blast |
|
291 |
with Union have "u \<in> \<C>" and "v \<in> \<C>" and "chain u" and "chain v" |
|
292 |
by blast+ |
|
293 |
with suc_Union_closed_total have "u \<subseteq> v \<or> v \<subseteq> u" |
|
294 |
by blast |
|
52181 | 295 |
then show "x \<sqsubseteq> y \<or> y \<sqsubseteq> x" |
296 |
proof |
|
297 |
assume "u \<subseteq> v" |
|
60758 | 298 |
from \<open>chain v\<close> show ?thesis |
52181 | 299 |
proof (rule chain_total) |
300 |
show "y \<in> v" by fact |
|
60758 | 301 |
show "x \<in> v" using \<open>u \<subseteq> v\<close> and \<open>x \<in> u\<close> by blast |
52181 | 302 |
qed |
303 |
next |
|
304 |
assume "v \<subseteq> u" |
|
60758 | 305 |
from \<open>chain u\<close> show ?thesis |
52181 | 306 |
proof (rule chain_total) |
307 |
show "x \<in> u" by fact |
|
60758 | 308 |
show "y \<in> u" using \<open>v \<subseteq> u\<close> and \<open>y \<in> v\<close> by blast |
52181 | 309 |
qed |
310 |
qed |
|
311 |
qed |
|
312 |
ultimately show ?case unfolding chain_def .. |
|
313 |
qed |
|
314 |
||
60758 | 315 |
subsubsection \<open>Hausdorff's Maximum Principle\<close> |
52181 | 316 |
|
63572 | 317 |
text \<open>There exists a maximal totally ordered subset of \<open>A\<close>. (Note that we do not |
318 |
require \<open>A\<close> to be partially ordered.)\<close> |
|
46980 | 319 |
|
52181 | 320 |
theorem Hausdorff: "\<exists>C. maxchain C" |
321 |
proof - |
|
322 |
let ?M = "\<Union>\<C>" |
|
323 |
have "maxchain ?M" |
|
324 |
proof (rule ccontr) |
|
63572 | 325 |
assume "\<not> ?thesis" |
52181 | 326 |
then have "suc ?M \<noteq> ?M" |
63572 | 327 |
using suc_not_equals and suc_Union_closed_chain [OF suc_Union_closed_Union] by simp |
52181 | 328 |
moreover have "suc ?M = ?M" |
329 |
using eq_suc_Union [OF suc_Union_closed_Union] by simp |
|
330 |
ultimately show False by contradiction |
|
331 |
qed |
|
332 |
then show ?thesis by blast |
|
333 |
qed |
|
334 |
||
60758 | 335 |
text \<open>Make notation @{term \<C>} available again.\<close> |
63572 | 336 |
no_notation suc_Union_closed ("\<C>") |
52181 | 337 |
|
63572 | 338 |
lemma chain_extend: "chain C \<Longrightarrow> z \<in> A \<Longrightarrow> \<forall>x\<in>C. x \<sqsubseteq> z \<Longrightarrow> chain ({z} \<union> C)" |
52181 | 339 |
unfolding chain_def by blast |
340 |
||
63572 | 341 |
lemma maxchain_imp_chain: "maxchain C \<Longrightarrow> chain C" |
52181 | 342 |
by (simp add: maxchain_def) |
343 |
||
344 |
end |
|
345 |
||
60758 | 346 |
text \<open>Hide constant @{const pred_on.suc_Union_closed}, which was just needed |
63572 | 347 |
for the proof of Hausforff's maximum principle.\<close> |
52181 | 348 |
hide_const pred_on.suc_Union_closed |
349 |
||
350 |
lemma chain_mono: |
|
63572 | 351 |
assumes "\<And>x y. x \<in> A \<Longrightarrow> y \<in> A \<Longrightarrow> P x y \<Longrightarrow> Q x y" |
52181 | 352 |
and "pred_on.chain A P C" |
353 |
shows "pred_on.chain A Q C" |
|
354 |
using assms unfolding pred_on.chain_def by blast |
|
355 |
||
63572 | 356 |
|
60758 | 357 |
subsubsection \<open>Results for the proper subset relation\<close> |
52181 | 358 |
|
67399 | 359 |
interpretation subset: pred_on "A" "(\<subset>)" for A . |
13551
b7f64ee8da84
converted Hyperreal/Zorn to Isar format and moved to Library
paulson
parents:
diff
changeset
|
360 |
|
52181 | 361 |
lemma subset_maxchain_max: |
63572 | 362 |
assumes "subset.maxchain A C" |
363 |
and "X \<in> A" |
|
364 |
and "\<Union>C \<subseteq> X" |
|
52181 | 365 |
shows "\<Union>C = X" |
366 |
proof (rule ccontr) |
|
367 |
let ?C = "{X} \<union> C" |
|
60758 | 368 |
from \<open>subset.maxchain A C\<close> have "subset.chain A C" |
52181 | 369 |
and *: "\<And>S. subset.chain A S \<Longrightarrow> \<not> C \<subset> S" |
370 |
by (auto simp: subset.maxchain_def) |
|
60758 | 371 |
moreover have "\<forall>x\<in>C. x \<subseteq> X" using \<open>\<Union>C \<subseteq> X\<close> by auto |
52181 | 372 |
ultimately have "subset.chain A ?C" |
60758 | 373 |
using subset.chain_extend [of A C X] and \<open>X \<in> A\<close> by auto |
53374
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents:
52821
diff
changeset
|
374 |
moreover assume **: "\<Union>C \<noteq> X" |
60758 | 375 |
moreover from ** have "C \<subset> ?C" using \<open>\<Union>C \<subseteq> X\<close> by auto |
52181 | 376 |
ultimately show False using * by blast |
377 |
qed |
|
13551
b7f64ee8da84
converted Hyperreal/Zorn to Isar format and moved to Library
paulson
parents:
diff
changeset
|
378 |
|
63572 | 379 |
|
60758 | 380 |
subsubsection \<open>Zorn's lemma\<close> |
13551
b7f64ee8da84
converted Hyperreal/Zorn to Isar format and moved to Library
paulson
parents:
diff
changeset
|
381 |
|
60758 | 382 |
text \<open>If every chain has an upper bound, then there is a maximal set.\<close> |
52181 | 383 |
lemma subset_Zorn: |
384 |
assumes "\<And>C. subset.chain A C \<Longrightarrow> \<exists>U\<in>A. \<forall>X\<in>C. X \<subseteq> U" |
|
385 |
shows "\<exists>M\<in>A. \<forall>X\<in>A. M \<subseteq> X \<longrightarrow> X = M" |
|
386 |
proof - |
|
387 |
from subset.Hausdorff [of A] obtain M where "subset.maxchain A M" .. |
|
63572 | 388 |
then have "subset.chain A M" |
389 |
by (rule subset.maxchain_imp_chain) |
|
390 |
with assms obtain Y where "Y \<in> A" and "\<forall>X\<in>M. X \<subseteq> Y" |
|
391 |
by blast |
|
52181 | 392 |
moreover have "\<forall>X\<in>A. Y \<subseteq> X \<longrightarrow> Y = X" |
393 |
proof (intro ballI impI) |
|
394 |
fix X |
|
395 |
assume "X \<in> A" and "Y \<subseteq> X" |
|
396 |
show "Y = X" |
|
397 |
proof (rule ccontr) |
|
63572 | 398 |
assume "\<not> ?thesis" |
60758 | 399 |
with \<open>Y \<subseteq> X\<close> have "\<not> X \<subseteq> Y" by blast |
400 |
from subset.chain_extend [OF \<open>subset.chain A M\<close> \<open>X \<in> A\<close>] and \<open>\<forall>X\<in>M. X \<subseteq> Y\<close> |
|
63572 | 401 |
have "subset.chain A ({X} \<union> M)" |
402 |
using \<open>Y \<subseteq> X\<close> by auto |
|
403 |
moreover have "M \<subset> {X} \<union> M" |
|
404 |
using \<open>\<forall>X\<in>M. X \<subseteq> Y\<close> and \<open>\<not> X \<subseteq> Y\<close> by auto |
|
52181 | 405 |
ultimately show False |
60758 | 406 |
using \<open>subset.maxchain A M\<close> by (auto simp: subset.maxchain_def) |
52181 | 407 |
qed |
408 |
qed |
|
55811 | 409 |
ultimately show ?thesis by blast |
52181 | 410 |
qed |
411 |
||
63572 | 412 |
text \<open>Alternative version of Zorn's lemma for the subset relation.\<close> |
52181 | 413 |
lemma subset_Zorn': |
414 |
assumes "\<And>C. subset.chain A C \<Longrightarrow> \<Union>C \<in> A" |
|
415 |
shows "\<exists>M\<in>A. \<forall>X\<in>A. M \<subseteq> X \<longrightarrow> X = M" |
|
416 |
proof - |
|
417 |
from subset.Hausdorff [of A] obtain M where "subset.maxchain A M" .. |
|
63572 | 418 |
then have "subset.chain A M" |
419 |
by (rule subset.maxchain_imp_chain) |
|
52181 | 420 |
with assms have "\<Union>M \<in> A" . |
421 |
moreover have "\<forall>Z\<in>A. \<Union>M \<subseteq> Z \<longrightarrow> \<Union>M = Z" |
|
422 |
proof (intro ballI impI) |
|
423 |
fix Z |
|
424 |
assume "Z \<in> A" and "\<Union>M \<subseteq> Z" |
|
60758 | 425 |
with subset_maxchain_max [OF \<open>subset.maxchain A M\<close>] |
52181 | 426 |
show "\<Union>M = Z" . |
427 |
qed |
|
428 |
ultimately show ?thesis by blast |
|
429 |
qed |
|
13551
b7f64ee8da84
converted Hyperreal/Zorn to Isar format and moved to Library
paulson
parents:
diff
changeset
|
430 |
|
b7f64ee8da84
converted Hyperreal/Zorn to Isar format and moved to Library
paulson
parents:
diff
changeset
|
431 |
|
60758 | 432 |
subsection \<open>Zorn's Lemma for Partial Orders\<close> |
52181 | 433 |
|
60758 | 434 |
text \<open>Relate old to new definitions.\<close> |
17200 | 435 |
|
63572 | 436 |
definition chain_subset :: "'a set set \<Rightarrow> bool" ("chain\<^sub>\<subseteq>") (* Define globally? In Set.thy? *) |
437 |
where "chain\<^sub>\<subseteq> C \<longleftrightarrow> (\<forall>A\<in>C. \<forall>B\<in>C. A \<subseteq> B \<or> B \<subseteq> A)" |
|
13551
b7f64ee8da84
converted Hyperreal/Zorn to Isar format and moved to Library
paulson
parents:
diff
changeset
|
438 |
|
63572 | 439 |
definition chains :: "'a set set \<Rightarrow> 'a set set set" |
440 |
where "chains A = {C. C \<subseteq> A \<and> chain\<^sub>\<subseteq> C}" |
|
13551
b7f64ee8da84
converted Hyperreal/Zorn to Isar format and moved to Library
paulson
parents:
diff
changeset
|
441 |
|
63572 | 442 |
definition Chains :: "('a \<times> 'a) set \<Rightarrow> 'a set set" (* Define globally? In Relation.thy? *) |
443 |
where "Chains r = {C. \<forall>a\<in>C. \<forall>b\<in>C. (a, b) \<in> r \<or> (b, a) \<in> r}" |
|
13551
b7f64ee8da84
converted Hyperreal/Zorn to Isar format and moved to Library
paulson
parents:
diff
changeset
|
444 |
|
63572 | 445 |
lemma chains_extend: "c \<in> chains S \<Longrightarrow> z \<in> S \<Longrightarrow> \<forall>x \<in> c. x \<subseteq> z \<Longrightarrow> {z} \<union> c \<in> chains S" |
446 |
for z :: "'a set" |
|
63172 | 447 |
unfolding chains_def chain_subset_def by blast |
52183
667961fa6a60
fixed files broken due to Zorn changes (cf. 59e5dd7b8f9a)
popescua
parents:
52181
diff
changeset
|
448 |
|
52181 | 449 |
lemma mono_Chains: "r \<subseteq> s \<Longrightarrow> Chains r \<subseteq> Chains s" |
450 |
unfolding Chains_def by blast |
|
451 |
||
452 |
lemma chain_subset_alt_def: "chain\<^sub>\<subseteq> C = subset.chain UNIV C" |
|
54482 | 453 |
unfolding chain_subset_def subset.chain_def by fast |
13551
b7f64ee8da84
converted Hyperreal/Zorn to Isar format and moved to Library
paulson
parents:
diff
changeset
|
454 |
|
52181 | 455 |
lemma chains_alt_def: "chains A = {C. subset.chain A C}" |
456 |
by (simp add: chains_def chain_subset_alt_def subset.chain_def) |
|
457 |
||
63572 | 458 |
lemma Chains_subset: "Chains r \<subseteq> {C. pred_on.chain UNIV (\<lambda>x y. (x, y) \<in> r) C}" |
52181 | 459 |
by (force simp add: Chains_def pred_on.chain_def) |
13551
b7f64ee8da84
converted Hyperreal/Zorn to Isar format and moved to Library
paulson
parents:
diff
changeset
|
460 |
|
52181 | 461 |
lemma Chains_subset': |
462 |
assumes "refl r" |
|
463 |
shows "{C. pred_on.chain UNIV (\<lambda>x y. (x, y) \<in> r) C} \<subseteq> Chains r" |
|
464 |
using assms |
|
465 |
by (auto simp add: Chains_def pred_on.chain_def refl_on_def) |
|
13551
b7f64ee8da84
converted Hyperreal/Zorn to Isar format and moved to Library
paulson
parents:
diff
changeset
|
466 |
|
52181 | 467 |
lemma Chains_alt_def: |
468 |
assumes "refl r" |
|
469 |
shows "Chains r = {C. pred_on.chain UNIV (\<lambda>x y. (x, y) \<in> r) C}" |
|
55811 | 470 |
using assms Chains_subset Chains_subset' by blast |
52181 | 471 |
|
67673
c8caefb20564
lots of new material, ultimately related to measure theory
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
472 |
lemma pairwise_chain_Union: |
c8caefb20564
lots of new material, ultimately related to measure theory
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
473 |
assumes P: "\<And>S. S \<in> \<C> \<Longrightarrow> pairwise R S" and "chain\<^sub>\<subseteq> \<C>" |
c8caefb20564
lots of new material, ultimately related to measure theory
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
474 |
shows "pairwise R (\<Union>\<C>)" |
c8caefb20564
lots of new material, ultimately related to measure theory
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
475 |
using \<open>chain\<^sub>\<subseteq> \<C>\<close> unfolding pairwise_def chain_subset_def |
c8caefb20564
lots of new material, ultimately related to measure theory
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
476 |
by (blast intro: P [unfolded pairwise_def, rule_format]) |
c8caefb20564
lots of new material, ultimately related to measure theory
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
477 |
|
63572 | 478 |
lemma Zorn_Lemma: "\<forall>C\<in>chains A. \<Union>C \<in> A \<Longrightarrow> \<exists>M\<in>A. \<forall>X\<in>A. M \<subseteq> X \<longrightarrow> X = M" |
52183
667961fa6a60
fixed files broken due to Zorn changes (cf. 59e5dd7b8f9a)
popescua
parents:
52181
diff
changeset
|
479 |
using subset_Zorn' [of A] by (force simp: chains_alt_def) |
13551
b7f64ee8da84
converted Hyperreal/Zorn to Isar format and moved to Library
paulson
parents:
diff
changeset
|
480 |
|
63572 | 481 |
lemma Zorn_Lemma2: "\<forall>C\<in>chains A. \<exists>U\<in>A. \<forall>X\<in>C. X \<subseteq> U \<Longrightarrow> \<exists>M\<in>A. \<forall>X\<in>A. M \<subseteq> X \<longrightarrow> X = M" |
52181 | 482 |
using subset_Zorn [of A] by (auto simp: chains_alt_def) |
13551
b7f64ee8da84
converted Hyperreal/Zorn to Isar format and moved to Library
paulson
parents:
diff
changeset
|
483 |
|
63572 | 484 |
text \<open>Various other lemmas\<close> |
52183
667961fa6a60
fixed files broken due to Zorn changes (cf. 59e5dd7b8f9a)
popescua
parents:
52181
diff
changeset
|
485 |
|
63572 | 486 |
lemma chainsD: "c \<in> chains S \<Longrightarrow> x \<in> c \<Longrightarrow> y \<in> c \<Longrightarrow> x \<subseteq> y \<or> y \<subseteq> x" |
63172 | 487 |
unfolding chains_def chain_subset_def by blast |
52183
667961fa6a60
fixed files broken due to Zorn changes (cf. 59e5dd7b8f9a)
popescua
parents:
52181
diff
changeset
|
488 |
|
63572 | 489 |
lemma chainsD2: "c \<in> chains S \<Longrightarrow> c \<subseteq> S" |
63172 | 490 |
unfolding chains_def by blast |
52183
667961fa6a60
fixed files broken due to Zorn changes (cf. 59e5dd7b8f9a)
popescua
parents:
52181
diff
changeset
|
491 |
|
52181 | 492 |
lemma Zorns_po_lemma: |
493 |
assumes po: "Partial_order r" |
|
494 |
and u: "\<forall>C\<in>Chains r. \<exists>u\<in>Field r. \<forall>a\<in>C. (a, u) \<in> r" |
|
495 |
shows "\<exists>m\<in>Field r. \<forall>a\<in>Field r. (m, a) \<in> r \<longrightarrow> a = m" |
|
496 |
proof - |
|
63572 | 497 |
have "Preorder r" |
498 |
using po by (simp add: partial_order_on_def) |
|
499 |
txt \<open>Mirror \<open>r\<close> in the set of subsets below (wrt \<open>r\<close>) elements of \<open>A\<close>.\<close> |
|
500 |
let ?B = "\<lambda>x. r\<inverse> `` {x}" |
|
501 |
let ?S = "?B ` Field r" |
|
502 |
have "\<exists>u\<in>Field r. \<forall>A\<in>C. A \<subseteq> r\<inverse> `` {u}" (is "\<exists>u\<in>Field r. ?P u") |
|
503 |
if 1: "C \<subseteq> ?S" and 2: "\<forall>A\<in>C. \<forall>B\<in>C. A \<subseteq> B \<or> B \<subseteq> A" for C |
|
504 |
proof - |
|
52181 | 505 |
let ?A = "{x\<in>Field r. \<exists>M\<in>C. M = ?B x}" |
63572 | 506 |
from 1 have "C = ?B ` ?A" by (auto simp: image_def) |
52181 | 507 |
have "?A \<in> Chains r" |
508 |
proof (simp add: Chains_def, intro allI impI, elim conjE) |
|
509 |
fix a b |
|
510 |
assume "a \<in> Field r" and "?B a \<in> C" and "b \<in> Field r" and "?B b \<in> C" |
|
63572 | 511 |
with 2 have "?B a \<subseteq> ?B b \<or> ?B b \<subseteq> ?B a" by auto |
512 |
then show "(a, b) \<in> r \<or> (b, a) \<in> r" |
|
60758 | 513 |
using \<open>Preorder r\<close> and \<open>a \<in> Field r\<close> and \<open>b \<in> Field r\<close> |
52181 | 514 |
by (simp add:subset_Image1_Image1_iff) |
515 |
qed |
|
63572 | 516 |
with u obtain u where uA: "u \<in> Field r" "\<forall>a\<in>?A. (a, u) \<in> r" by auto |
517 |
have "?P u" |
|
52181 | 518 |
proof auto |
519 |
fix a B assume aB: "B \<in> C" "a \<in> B" |
|
520 |
with 1 obtain x where "x \<in> Field r" and "B = r\<inverse> `` {x}" by auto |
|
63572 | 521 |
then show "(a, u) \<in> r" |
522 |
using uA and aB and \<open>Preorder r\<close> |
|
54482 | 523 |
unfolding preorder_on_def refl_on_def by simp (fast dest: transD) |
52181 | 524 |
qed |
63572 | 525 |
then show ?thesis |
526 |
using \<open>u \<in> Field r\<close> by blast |
|
527 |
qed |
|
52181 | 528 |
then have "\<forall>C\<in>chains ?S. \<exists>U\<in>?S. \<forall>A\<in>C. A \<subseteq> U" |
529 |
by (auto simp: chains_def chain_subset_def) |
|
63572 | 530 |
from Zorn_Lemma2 [OF this] obtain m B |
531 |
where "m \<in> Field r" |
|
532 |
and "B = r\<inverse> `` {m}" |
|
533 |
and "\<forall>x\<in>Field r. B \<subseteq> r\<inverse> `` {x} \<longrightarrow> r\<inverse> `` {x} = B" |
|
52181 | 534 |
by auto |
63572 | 535 |
then have "\<forall>a\<in>Field r. (m, a) \<in> r \<longrightarrow> a = m" |
60758 | 536 |
using po and \<open>Preorder r\<close> and \<open>m \<in> Field r\<close> |
52181 | 537 |
by (auto simp: subset_Image1_Image1_iff Partial_order_eq_Image1_Image1_iff) |
63572 | 538 |
then show ?thesis |
539 |
using \<open>m \<in> Field r\<close> by blast |
|
52181 | 540 |
qed |
13551
b7f64ee8da84
converted Hyperreal/Zorn to Isar format and moved to Library
paulson
parents:
diff
changeset
|
541 |
|
b7f64ee8da84
converted Hyperreal/Zorn to Isar format and moved to Library
paulson
parents:
diff
changeset
|
542 |
|
60758 | 543 |
subsection \<open>The Well Ordering Theorem\<close> |
26191 | 544 |
|
545 |
(* The initial segment of a relation appears generally useful. |
|
546 |
Move to Relation.thy? |
|
547 |
Definition correct/most general? |
|
548 |
Naming? |
|
549 |
*) |
|
63572 | 550 |
definition init_seg_of :: "(('a \<times> 'a) set \<times> ('a \<times> 'a) set) set" |
551 |
where "init_seg_of = {(r, s). r \<subseteq> s \<and> (\<forall>a b c. (a, b) \<in> s \<and> (b, c) \<in> r \<longrightarrow> (a, b) \<in> r)}" |
|
26191 | 552 |
|
63572 | 553 |
abbreviation initial_segment_of_syntax :: "('a \<times> 'a) set \<Rightarrow> ('a \<times> 'a) set \<Rightarrow> bool" |
554 |
(infix "initial'_segment'_of" 55) |
|
555 |
where "r initial_segment_of s \<equiv> (r, s) \<in> init_seg_of" |
|
26191 | 556 |
|
52181 | 557 |
lemma refl_on_init_seg_of [simp]: "r initial_segment_of r" |
558 |
by (simp add: init_seg_of_def) |
|
26191 | 559 |
|
560 |
lemma trans_init_seg_of: |
|
561 |
"r initial_segment_of s \<Longrightarrow> s initial_segment_of t \<Longrightarrow> r initial_segment_of t" |
|
54482 | 562 |
by (simp (no_asm_use) add: init_seg_of_def) blast |
26191 | 563 |
|
63572 | 564 |
lemma antisym_init_seg_of: "r initial_segment_of s \<Longrightarrow> s initial_segment_of r \<Longrightarrow> r = s" |
52181 | 565 |
unfolding init_seg_of_def by safe |
26191 | 566 |
|
63572 | 567 |
lemma Chains_init_seg_of_Union: "R \<in> Chains init_seg_of \<Longrightarrow> r\<in>R \<Longrightarrow> r initial_segment_of \<Union>R" |
52181 | 568 |
by (auto simp: init_seg_of_def Ball_def Chains_def) blast |
26191 | 569 |
|
26272 | 570 |
lemma chain_subset_trans_Union: |
55811 | 571 |
assumes "chain\<^sub>\<subseteq> R" "\<forall>r\<in>R. trans r" |
572 |
shows "trans (\<Union>R)" |
|
573 |
proof (intro transI, elim UnionE) |
|
63572 | 574 |
fix S1 S2 :: "'a rel" and x y z :: 'a |
55811 | 575 |
assume "S1 \<in> R" "S2 \<in> R" |
63572 | 576 |
with assms(1) have "S1 \<subseteq> S2 \<or> S2 \<subseteq> S1" |
577 |
unfolding chain_subset_def by blast |
|
55811 | 578 |
moreover assume "(x, y) \<in> S1" "(y, z) \<in> S2" |
63572 | 579 |
ultimately have "((x, y) \<in> S1 \<and> (y, z) \<in> S1) \<or> ((x, y) \<in> S2 \<and> (y, z) \<in> S2)" |
580 |
by blast |
|
581 |
with \<open>S1 \<in> R\<close> \<open>S2 \<in> R\<close> assms(2) show "(x, z) \<in> \<Union>R" |
|
582 |
by (auto elim: transE) |
|
55811 | 583 |
qed |
26191 | 584 |
|
26272 | 585 |
lemma chain_subset_antisym_Union: |
55811 | 586 |
assumes "chain\<^sub>\<subseteq> R" "\<forall>r\<in>R. antisym r" |
587 |
shows "antisym (\<Union>R)" |
|
588 |
proof (intro antisymI, elim UnionE) |
|
63572 | 589 |
fix S1 S2 :: "'a rel" and x y :: 'a |
55811 | 590 |
assume "S1 \<in> R" "S2 \<in> R" |
63572 | 591 |
with assms(1) have "S1 \<subseteq> S2 \<or> S2 \<subseteq> S1" |
592 |
unfolding chain_subset_def by blast |
|
55811 | 593 |
moreover assume "(x, y) \<in> S1" "(y, x) \<in> S2" |
63572 | 594 |
ultimately have "((x, y) \<in> S1 \<and> (y, x) \<in> S1) \<or> ((x, y) \<in> S2 \<and> (y, x) \<in> S2)" |
595 |
by blast |
|
596 |
with \<open>S1 \<in> R\<close> \<open>S2 \<in> R\<close> assms(2) show "x = y" |
|
597 |
unfolding antisym_def by auto |
|
55811 | 598 |
qed |
26191 | 599 |
|
26272 | 600 |
lemma chain_subset_Total_Union: |
52181 | 601 |
assumes "chain\<^sub>\<subseteq> R" and "\<forall>r\<in>R. Total r" |
602 |
shows "Total (\<Union>R)" |
|
603 |
proof (simp add: total_on_def Ball_def, auto del: disjCI) |
|
63572 | 604 |
fix r s a b |
605 |
assume A: "r \<in> R" "s \<in> R" "a \<in> Field r" "b \<in> Field s" "a \<noteq> b" |
|
60758 | 606 |
from \<open>chain\<^sub>\<subseteq> R\<close> and \<open>r \<in> R\<close> and \<open>s \<in> R\<close> have "r \<subseteq> s \<or> s \<subseteq> r" |
52181 | 607 |
by (auto simp add: chain_subset_def) |
63572 | 608 |
then show "(\<exists>r\<in>R. (a, b) \<in> r) \<or> (\<exists>r\<in>R. (b, a) \<in> r)" |
26191 | 609 |
proof |
63572 | 610 |
assume "r \<subseteq> s" |
611 |
then have "(a, b) \<in> s \<or> (b, a) \<in> s" |
|
612 |
using assms(2) A mono_Field[of r s] |
|
55811 | 613 |
by (auto simp add: total_on_def) |
63572 | 614 |
then show ?thesis |
615 |
using \<open>s \<in> R\<close> by blast |
|
26191 | 616 |
next |
63572 | 617 |
assume "s \<subseteq> r" |
618 |
then have "(a, b) \<in> r \<or> (b, a) \<in> r" |
|
619 |
using assms(2) A mono_Field[of s r] |
|
55811 | 620 |
by (fastforce simp add: total_on_def) |
63572 | 621 |
then show ?thesis |
622 |
using \<open>r \<in> R\<close> by blast |
|
26191 | 623 |
qed |
624 |
qed |
|
625 |
||
626 |
lemma wf_Union_wf_init_segs: |
|
63572 | 627 |
assumes "R \<in> Chains init_seg_of" |
628 |
and "\<forall>r\<in>R. wf r" |
|
52181 | 629 |
shows "wf (\<Union>R)" |
63572 | 630 |
proof (simp add: wf_iff_no_infinite_down_chain, rule ccontr, auto) |
631 |
fix f |
|
632 |
assume 1: "\<forall>i. \<exists>r\<in>R. (f (Suc i), f i) \<in> r" |
|
52181 | 633 |
then obtain r where "r \<in> R" and "(f (Suc 0), f 0) \<in> r" by auto |
63572 | 634 |
have "(f (Suc i), f i) \<in> r" for i |
635 |
proof (induct i) |
|
636 |
case 0 |
|
637 |
show ?case by fact |
|
638 |
next |
|
639 |
case (Suc i) |
|
640 |
then obtain s where s: "s \<in> R" "(f (Suc (Suc i)), f(Suc i)) \<in> s" |
|
641 |
using 1 by auto |
|
642 |
then have "s initial_segment_of r \<or> r initial_segment_of s" |
|
643 |
using assms(1) \<open>r \<in> R\<close> by (simp add: Chains_def) |
|
644 |
with Suc s show ?case by (simp add: init_seg_of_def) blast |
|
645 |
qed |
|
646 |
then show False |
|
647 |
using assms(2) and \<open>r \<in> R\<close> |
|
52181 | 648 |
by (simp add: wf_iff_no_infinite_down_chain) blast |
26191 | 649 |
qed |
650 |
||
63572 | 651 |
lemma initial_segment_of_Diff: "p initial_segment_of q \<Longrightarrow> p - s initial_segment_of q - s" |
52181 | 652 |
unfolding init_seg_of_def by blast |
27476 | 653 |
|
63572 | 654 |
lemma Chains_inits_DiffI: "R \<in> Chains init_seg_of \<Longrightarrow> {r - s |r. r \<in> R} \<in> Chains init_seg_of" |
52181 | 655 |
unfolding Chains_def by (blast intro: initial_segment_of_Diff) |
26191 | 656 |
|
52181 | 657 |
theorem well_ordering: "\<exists>r::'a rel. Well_order r \<and> Field r = UNIV" |
658 |
proof - |
|
61799 | 659 |
\<comment> \<open>The initial segment relation on well-orders:\<close> |
52181 | 660 |
let ?WO = "{r::'a rel. Well_order r}" |
63040 | 661 |
define I where "I = init_seg_of \<inter> ?WO \<times> ?WO" |
63572 | 662 |
then have I_init: "I \<subseteq> init_seg_of" by simp |
663 |
then have subch: "\<And>R. R \<in> Chains I \<Longrightarrow> chain\<^sub>\<subseteq> R" |
|
54482 | 664 |
unfolding init_seg_of_def chain_subset_def Chains_def by blast |
52181 | 665 |
have Chains_wo: "\<And>R r. R \<in> Chains I \<Longrightarrow> r \<in> R \<Longrightarrow> Well_order r" |
666 |
by (simp add: Chains_def I_def) blast |
|
63572 | 667 |
have FI: "Field I = ?WO" |
668 |
by (auto simp add: I_def init_seg_of_def Field_def) |
|
669 |
then have 0: "Partial_order I" |
|
52181 | 670 |
by (auto simp: partial_order_on_def preorder_on_def antisym_def antisym_init_seg_of refl_on_def |
63572 | 671 |
trans_def I_def elim!: trans_init_seg_of) |
672 |
\<comment> \<open>\<open>I\<close>-chains have upper bounds in \<open>?WO\<close> wrt \<open>I\<close>: their Union\<close> |
|
673 |
have "\<Union>R \<in> ?WO \<and> (\<forall>r\<in>R. (r, \<Union>R) \<in> I)" if "R \<in> Chains I" for R |
|
674 |
proof - |
|
675 |
from that have Ris: "R \<in> Chains init_seg_of" |
|
676 |
using mono_Chains [OF I_init] by blast |
|
677 |
have subch: "chain\<^sub>\<subseteq> R" |
|
67613 | 678 |
using \<open>R \<in> Chains I\<close> I_init by (auto simp: init_seg_of_def chain_subset_def Chains_def) |
52181 | 679 |
have "\<forall>r\<in>R. Refl r" and "\<forall>r\<in>R. trans r" and "\<forall>r\<in>R. antisym r" |
680 |
and "\<forall>r\<in>R. Total r" and "\<forall>r\<in>R. wf (r - Id)" |
|
60758 | 681 |
using Chains_wo [OF \<open>R \<in> Chains I\<close>] by (simp_all add: order_on_defs) |
63572 | 682 |
have "Refl (\<Union>R)" |
683 |
using \<open>\<forall>r\<in>R. Refl r\<close> unfolding refl_on_def by fastforce |
|
26191 | 684 |
moreover have "trans (\<Union>R)" |
60758 | 685 |
by (rule chain_subset_trans_Union [OF subch \<open>\<forall>r\<in>R. trans r\<close>]) |
52181 | 686 |
moreover have "antisym (\<Union>R)" |
60758 | 687 |
by (rule chain_subset_antisym_Union [OF subch \<open>\<forall>r\<in>R. antisym r\<close>]) |
26191 | 688 |
moreover have "Total (\<Union>R)" |
60758 | 689 |
by (rule chain_subset_Total_Union [OF subch \<open>\<forall>r\<in>R. Total r\<close>]) |
52181 | 690 |
moreover have "wf ((\<Union>R) - Id)" |
691 |
proof - |
|
692 |
have "(\<Union>R) - Id = \<Union>{r - Id | r. r \<in> R}" by blast |
|
60758 | 693 |
with \<open>\<forall>r\<in>R. wf (r - Id)\<close> and wf_Union_wf_init_segs [OF Chains_inits_DiffI [OF Ris]] |
54482 | 694 |
show ?thesis by fastforce |
26191 | 695 |
qed |
63572 | 696 |
ultimately have "Well_order (\<Union>R)" |
697 |
by (simp add:order_on_defs) |
|
698 |
moreover have "\<forall>r \<in> R. r initial_segment_of \<Union>R" |
|
699 |
using Ris by (simp add: Chains_init_seg_of_Union) |
|
700 |
ultimately show ?thesis |
|
60758 | 701 |
using mono_Chains [OF I_init] Chains_wo[of R] and \<open>R \<in> Chains I\<close> |
55811 | 702 |
unfolding I_def by blast |
63572 | 703 |
qed |
704 |
then have 1: "\<forall>R \<in> Chains I. \<exists>u\<in>Field I. \<forall>r\<in>R. (r, u) \<in> I" |
|
705 |
by (subst FI) blast |
|
67443
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents:
67399
diff
changeset
|
706 |
\<comment> \<open>Zorn's Lemma yields a maximal well-order \<open>m\<close>:\<close> |
63572 | 707 |
then obtain m :: "'a rel" |
708 |
where "Well_order m" |
|
709 |
and max: "\<forall>r. Well_order r \<and> (m, r) \<in> I \<longrightarrow> r = m" |
|
54482 | 710 |
using Zorns_po_lemma[OF 0 1] unfolding FI by fastforce |
67443
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents:
67399
diff
changeset
|
711 |
\<comment> \<open>Now show by contradiction that \<open>m\<close> covers the whole type:\<close> |
63572 | 712 |
have False if "x \<notin> Field m" for x :: 'a |
713 |
proof - |
|
67443
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents:
67399
diff
changeset
|
714 |
\<comment> \<open>Assuming that \<open>x\<close> is not covered and extend \<open>m\<close> at the top with \<open>x\<close>\<close> |
26191 | 715 |
have "m \<noteq> {}" |
716 |
proof |
|
52181 | 717 |
assume "m = {}" |
718 |
moreover have "Well_order {(x, x)}" |
|
719 |
by (simp add: order_on_defs refl_on_def trans_def antisym_def total_on_def Field_def) |
|
26191 | 720 |
ultimately show False using max |
52181 | 721 |
by (auto simp: I_def init_seg_of_def simp del: Field_insert) |
26191 | 722 |
qed |
63572 | 723 |
then have "Field m \<noteq> {}" by (auto simp: Field_def) |
724 |
moreover have "wf (m - Id)" |
|
725 |
using \<open>Well_order m\<close> by (simp add: well_order_on_def) |
|
67443
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents:
67399
diff
changeset
|
726 |
\<comment> \<open>The extension of \<open>m\<close> by \<open>x\<close>:\<close> |
52181 | 727 |
let ?s = "{(a, x) | a. a \<in> Field m}" |
728 |
let ?m = "insert (x, x) m \<union> ?s" |
|
26191 | 729 |
have Fm: "Field ?m = insert x (Field m)" |
52181 | 730 |
by (auto simp: Field_def) |
731 |
have "Refl m" and "trans m" and "antisym m" and "Total m" and "wf (m - Id)" |
|
60758 | 732 |
using \<open>Well_order m\<close> by (simp_all add: order_on_defs) |
67443
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents:
67399
diff
changeset
|
733 |
\<comment> \<open>We show that the extension is a well-order\<close> |
63572 | 734 |
have "Refl ?m" |
735 |
using \<open>Refl m\<close> Fm unfolding refl_on_def by blast |
|
60758 | 736 |
moreover have "trans ?m" using \<open>trans m\<close> and \<open>x \<notin> Field m\<close> |
52181 | 737 |
unfolding trans_def Field_def by blast |
63572 | 738 |
moreover have "antisym ?m" |
739 |
using \<open>antisym m\<close> and \<open>x \<notin> Field m\<close> unfolding antisym_def Field_def by blast |
|
740 |
moreover have "Total ?m" |
|
741 |
using \<open>Total m\<close> and Fm by (auto simp: total_on_def) |
|
52181 | 742 |
moreover have "wf (?m - Id)" |
743 |
proof - |
|
63572 | 744 |
have "wf ?s" |
745 |
using \<open>x \<notin> Field m\<close> by (auto simp: wf_eq_minimal Field_def Bex_def) |
|
746 |
then show ?thesis |
|
747 |
using \<open>wf (m - Id)\<close> and \<open>x \<notin> Field m\<close> wf_subset [OF \<open>wf ?s\<close> Diff_subset] |
|
63172 | 748 |
by (auto simp: Un_Diff Field_def intro: wf_Un) |
26191 | 749 |
qed |
63572 | 750 |
ultimately have "Well_order ?m" |
751 |
by (simp add: order_on_defs) |
|
67443
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents:
67399
diff
changeset
|
752 |
\<comment> \<open>We show that the extension is above \<open>m\<close>\<close> |
63572 | 753 |
moreover have "(m, ?m) \<in> I" |
754 |
using \<open>Well_order ?m\<close> and \<open>Well_order m\<close> and \<open>x \<notin> Field m\<close> |
|
52181 | 755 |
by (fastforce simp: I_def init_seg_of_def Field_def) |
26191 | 756 |
ultimately |
67443
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents:
67399
diff
changeset
|
757 |
\<comment> \<open>This contradicts maximality of \<open>m\<close>:\<close> |
63572 | 758 |
show False |
759 |
using max and \<open>x \<notin> Field m\<close> unfolding Field_def by blast |
|
760 |
qed |
|
761 |
then have "Field m = UNIV" by auto |
|
60758 | 762 |
with \<open>Well_order m\<close> show ?thesis by blast |
26272 | 763 |
qed |
764 |
||
52181 | 765 |
corollary well_order_on: "\<exists>r::'a rel. well_order_on A r" |
26272 | 766 |
proof - |
63572 | 767 |
obtain r :: "'a rel" where wo: "Well_order r" and univ: "Field r = UNIV" |
52181 | 768 |
using well_ordering [where 'a = "'a"] by blast |
769 |
let ?r = "{(x, y). x \<in> A \<and> y \<in> A \<and> (x, y) \<in> r}" |
|
63572 | 770 |
have 1: "Field ?r = A" |
771 |
using wo univ by (fastforce simp: Field_def order_on_defs refl_on_def) |
|
772 |
from \<open>Well_order r\<close> have "Refl r" "trans r" "antisym r" "Total r" "wf (r - Id)" |
|
773 |
by (simp_all add: order_on_defs) |
|
774 |
from \<open>Refl r\<close> have "Refl ?r" |
|
775 |
by (auto simp: refl_on_def 1 univ) |
|
776 |
moreover from \<open>trans r\<close> have "trans ?r" |
|
26272 | 777 |
unfolding trans_def by blast |
63572 | 778 |
moreover from \<open>antisym r\<close> have "antisym ?r" |
26272 | 779 |
unfolding antisym_def by blast |
63572 | 780 |
moreover from \<open>Total r\<close> have "Total ?r" |
781 |
by (simp add:total_on_def 1 univ) |
|
782 |
moreover have "wf (?r - Id)" |
|
783 |
by (rule wf_subset [OF \<open>wf (r - Id)\<close>]) blast |
|
784 |
ultimately have "Well_order ?r" |
|
785 |
by (simp add: order_on_defs) |
|
54482 | 786 |
with 1 show ?thesis by auto |
26191 | 787 |
qed |
788 |
||
58184
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents:
55811
diff
changeset
|
789 |
(* Move this to Hilbert Choice and wfrec to Wellfounded*) |
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents:
55811
diff
changeset
|
790 |
|
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents:
55811
diff
changeset
|
791 |
lemma wfrec_def_adm: "f \<equiv> wfrec R F \<Longrightarrow> wf R \<Longrightarrow> adm_wf R F \<Longrightarrow> f = F f" |
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents:
55811
diff
changeset
|
792 |
using wfrec_fixpoint by simp |
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents:
55811
diff
changeset
|
793 |
|
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents:
55811
diff
changeset
|
794 |
lemma dependent_wf_choice: |
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents:
55811
diff
changeset
|
795 |
fixes P :: "('a \<Rightarrow> 'b) \<Rightarrow> 'a \<Rightarrow> 'b \<Rightarrow> bool" |
63572 | 796 |
assumes "wf R" |
797 |
and adm: "\<And>f g x r. (\<And>z. (z, x) \<in> R \<Longrightarrow> f z = g z) \<Longrightarrow> P f x r = P g x r" |
|
798 |
and P: "\<And>x f. (\<And>y. (y, x) \<in> R \<Longrightarrow> P f y (f y)) \<Longrightarrow> \<exists>r. P f x r" |
|
58184
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents:
55811
diff
changeset
|
799 |
shows "\<exists>f. \<forall>x. P f x (f x)" |
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents:
55811
diff
changeset
|
800 |
proof (intro exI allI) |
63572 | 801 |
fix x |
63040 | 802 |
define f where "f \<equiv> wfrec R (\<lambda>f x. SOME r. P f x r)" |
60758 | 803 |
from \<open>wf R\<close> show "P f x (f x)" |
58184
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents:
55811
diff
changeset
|
804 |
proof (induct x) |
63572 | 805 |
case (less x) |
58184
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents:
55811
diff
changeset
|
806 |
show "P f x (f x)" |
60758 | 807 |
proof (subst (2) wfrec_def_adm[OF f_def \<open>wf R\<close>]) |
58184
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents:
55811
diff
changeset
|
808 |
show "adm_wf R (\<lambda>f x. SOME r. P f x r)" |
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents:
55811
diff
changeset
|
809 |
by (auto simp add: adm_wf_def intro!: arg_cong[where f=Eps] ext adm) |
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents:
55811
diff
changeset
|
810 |
show "P f x (Eps (P f x))" |
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents:
55811
diff
changeset
|
811 |
using P by (rule someI_ex) fact |
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents:
55811
diff
changeset
|
812 |
qed |
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents:
55811
diff
changeset
|
813 |
qed |
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents:
55811
diff
changeset
|
814 |
qed |
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents:
55811
diff
changeset
|
815 |
|
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents:
55811
diff
changeset
|
816 |
lemma (in wellorder) dependent_wellorder_choice: |
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents:
55811
diff
changeset
|
817 |
assumes "\<And>r f g x. (\<And>y. y < x \<Longrightarrow> f y = g y) \<Longrightarrow> P f x r = P g x r" |
63572 | 818 |
and P: "\<And>x f. (\<And>y. y < x \<Longrightarrow> P f y (f y)) \<Longrightarrow> \<exists>r. P f x r" |
58184
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents:
55811
diff
changeset
|
819 |
shows "\<exists>f. \<forall>x. P f x (f x)" |
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents:
55811
diff
changeset
|
820 |
using wf by (rule dependent_wf_choice) (auto intro!: assms) |
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents:
55811
diff
changeset
|
821 |
|
13551
b7f64ee8da84
converted Hyperreal/Zorn to Isar format and moved to Library
paulson
parents:
diff
changeset
|
822 |
end |