src/HOL/Library/Zorn.thy
 author paulson Sat Aug 31 14:03:49 2002 +0200 (2002-08-31) changeset 13551 b7f64ee8da84 child 13652 172600c40793 permissions -rw-r--r--
converted Hyperreal/Zorn to Isar format and moved to Library
```     1 (*  Title       \<in> Zorn.thy
```
```     2     ID          \<in> \$Id\$
```
```     3     Author      \<in> Jacques D. Fleuriot
```
```     4     Copyright   \<in> 1998  University of Cambridge
```
```     5     Description \<in> Zorn's Lemma -- See Larry Paulson's Zorn.thy in ZF
```
```     6 *)
```
```     7
```
```     8 header {*Zorn's Lemma*}
```
```     9
```
```    10 theory Zorn = Main:
```
```    11
```
```    12 text{*The lemma and section numbers refer to an unpublished article ``Towards
```
```    13 the Mechanization of the Proofs of Some Classical Theorems of Set Theory,'' by
```
```    14 Abrial and Laffitte.  *}
```
```    15
```
```    16 constdefs
```
```    17   chain     ::  "'a::ord set => 'a set set"
```
```    18     "chain S  == {F. F \<subseteq> S & (\<forall>x \<in> F. \<forall>y \<in> F. x \<subseteq> y | y \<subseteq> x)}"
```
```    19
```
```    20   super     ::  "['a::ord set,'a set] => 'a set set"
```
```    21     "super S c == {d. d \<in> chain(S) & c < d}"
```
```    22
```
```    23   maxchain  ::  "'a::ord set => 'a set set"
```
```    24     "maxchain S == {c. c \<in> chain S & super S c = {}}"
```
```    25
```
```    26   succ      ::  "['a::ord set,'a set] => 'a set"
```
```    27     "succ S c == if (c \<notin> chain S| c \<in> maxchain S)
```
```    28                  then c else (@c'. c': (super S c))"
```
```    29
```
```    30 consts
```
```    31   "TFin" ::  "'a::ord set => 'a set set"
```
```    32
```
```    33 inductive "TFin(S)"
```
```    34   intros
```
```    35     succI:        "x \<in> TFin S ==> succ S x \<in> TFin S"
```
```    36     Pow_UnionI:   "Y \<in> Pow(TFin S) ==> Union(Y) \<in> TFin S"
```
```    37
```
```    38   monos          Pow_mono
```
```    39
```
```    40
```
```    41 subsection{*Mathematical Preamble*}
```
```    42
```
```    43 lemma Union_lemma0: "(\<forall>x \<in> C. x \<subseteq> A | B \<subseteq> x) ==> Union(C)<=A | B \<subseteq> Union(C)"
```
```    44 by blast
```
```    45
```
```    46
```
```    47 text{*This is theorem @{text increasingD2} of ZF/Zorn.thy*}
```
```    48 lemma Abrial_axiom1: "x \<subseteq> succ S x"
```
```    49 apply (unfold succ_def)
```
```    50 apply (rule split_if [THEN iffD2])
```
```    51 apply (auto simp add: super_def maxchain_def psubset_def)
```
```    52 apply (rule swap, assumption)
```
```    53 apply (rule someI2, blast+)
```
```    54 done
```
```    55
```
```    56 lemmas TFin_UnionI = TFin.Pow_UnionI [OF PowI]
```
```    57
```
```    58 lemma TFin_induct:
```
```    59           "[| n \<in> TFin S;
```
```    60              !!x. [| x \<in> TFin S; P(x) |] ==> P(succ S x);
```
```    61              !!Y. [| Y \<subseteq> TFin S; Ball Y P |] ==> P(Union Y) |]
```
```    62           ==> P(n)"
```
```    63 apply (erule TFin.induct, blast+)
```
```    64 done
```
```    65
```
```    66 lemma succ_trans: "x \<subseteq> y ==> x \<subseteq> succ S y"
```
```    67 apply (erule subset_trans)
```
```    68 apply (rule Abrial_axiom1)
```
```    69 done
```
```    70
```
```    71 text{*Lemma 1 of section 3.1*}
```
```    72 lemma TFin_linear_lemma1:
```
```    73      "[| n \<in> TFin S;  m \<in> TFin S;
```
```    74          \<forall>x \<in> TFin S. x \<subseteq> m --> x = m | succ S x \<subseteq> m
```
```    75       |] ==> n \<subseteq> m | succ S m \<subseteq> n"
```
```    76 apply (erule TFin_induct)
```
```    77 apply (erule_tac [2] Union_lemma0) txt{*or just Blast_tac*}
```
```    78 apply (blast del: subsetI intro: succ_trans)
```
```    79 done
```
```    80
```
```    81 text{* Lemma 2 of section 3.2 *}
```
```    82 lemma TFin_linear_lemma2:
```
```    83      "m \<in> TFin S ==> \<forall>n \<in> TFin S. n \<subseteq> m --> n=m | succ S n \<subseteq> m"
```
```    84 apply (erule TFin_induct)
```
```    85 apply (rule impI [THEN ballI])
```
```    86 txt{*case split using TFin_linear_lemma1*}
```
```    87 apply (rule_tac n1 = n and m1 = x in TFin_linear_lemma1 [THEN disjE],
```
```    88        assumption+)
```
```    89 apply (drule_tac x = n in bspec, assumption)
```
```    90 apply (blast del: subsetI intro: succ_trans, blast)
```
```    91 txt{*second induction step*}
```
```    92 apply (rule impI [THEN ballI])
```
```    93 apply (rule Union_lemma0 [THEN disjE])
```
```    94 apply (rule_tac [3] disjI2)
```
```    95  prefer 2 apply blast
```
```    96 apply (rule ballI)
```
```    97 apply (rule_tac n1 = n and m1 = x in TFin_linear_lemma1 [THEN disjE],
```
```    98        assumption+, auto)
```
```    99 apply (blast intro!: Abrial_axiom1 [THEN subsetD])
```
```   100 done
```
```   101
```
```   102 text{*Re-ordering the premises of Lemma 2*}
```
```   103 lemma TFin_subsetD:
```
```   104      "[| n \<subseteq> m;  m \<in> TFin S;  n \<in> TFin S |] ==> n=m | succ S n \<subseteq> m"
```
```   105 apply (rule TFin_linear_lemma2 [rule_format])
```
```   106 apply (assumption+)
```
```   107 done
```
```   108
```
```   109 text{*Consequences from section 3.3 -- Property 3.2, the ordering is total*}
```
```   110 lemma TFin_subset_linear: "[| m \<in> TFin S;  n \<in> TFin S|] ==> n \<subseteq> m | m \<subseteq> n"
```
```   111 apply (rule disjE)
```
```   112 apply (rule TFin_linear_lemma1 [OF _ _TFin_linear_lemma2])
```
```   113 apply (assumption+, erule disjI2)
```
```   114 apply (blast del: subsetI
```
```   115              intro: subsetI Abrial_axiom1 [THEN subset_trans])
```
```   116 done
```
```   117
```
```   118 text{*Lemma 3 of section 3.3*}
```
```   119 lemma eq_succ_upper: "[| n \<in> TFin S;  m \<in> TFin S;  m = succ S m |] ==> n \<subseteq> m"
```
```   120 apply (erule TFin_induct)
```
```   121 apply (drule TFin_subsetD)
```
```   122 apply (assumption+, force, blast)
```
```   123 done
```
```   124
```
```   125 text{*Property 3.3 of section 3.3*}
```
```   126 lemma equal_succ_Union: "m \<in> TFin S ==> (m = succ S m) = (m = Union(TFin S))"
```
```   127 apply (rule iffI)
```
```   128 apply (rule Union_upper [THEN equalityI])
```
```   129 apply (rule_tac [2] eq_succ_upper [THEN Union_least])
```
```   130 apply (assumption+)
```
```   131 apply (erule ssubst)
```
```   132 apply (rule Abrial_axiom1 [THEN equalityI])
```
```   133 apply (blast del: subsetI
```
```   134 	     intro: subsetI TFin_UnionI TFin.succI)
```
```   135 done
```
```   136
```
```   137 subsection{*Hausdorff's Theorem: Every Set Contains a Maximal Chain.*}
```
```   138
```
```   139 text{*NB: We assume the partial ordering is @{text "\<subseteq>"},
```
```   140  the subset relation!*}
```
```   141
```
```   142 lemma empty_set_mem_chain: "({} :: 'a set set) \<in> chain S"
```
```   143 by (unfold chain_def, auto)
```
```   144
```
```   145 lemma super_subset_chain: "super S c \<subseteq> chain S"
```
```   146 by (unfold super_def, fast)
```
```   147
```
```   148 lemma maxchain_subset_chain: "maxchain S \<subseteq> chain S"
```
```   149 by (unfold maxchain_def, fast)
```
```   150
```
```   151 lemma mem_super_Ex: "c \<in> chain S - maxchain S ==> ? d. d \<in> super S c"
```
```   152 by (unfold super_def maxchain_def, auto)
```
```   153
```
```   154 lemma select_super: "c \<in> chain S - maxchain S ==>
```
```   155                           (@c'. c': super S c): super S c"
```
```   156 apply (erule mem_super_Ex [THEN exE])
```
```   157 apply (rule someI2, auto)
```
```   158 done
```
```   159
```
```   160 lemma select_not_equals: "c \<in> chain S - maxchain S ==>
```
```   161                           (@c'. c': super S c) \<noteq> c"
```
```   162 apply (rule notI)
```
```   163 apply (drule select_super)
```
```   164 apply (simp add: super_def psubset_def)
```
```   165 done
```
```   166
```
```   167 lemma succI3: "c \<in> chain S - maxchain S ==> succ S c = (@c'. c': super S c)"
```
```   168 apply (unfold succ_def)
```
```   169 apply (fast intro!: if_not_P)
```
```   170 done
```
```   171
```
```   172 lemma succ_not_equals: "c \<in> chain S - maxchain S ==> succ S c \<noteq> c"
```
```   173 apply (frule succI3)
```
```   174 apply (simp (no_asm_simp))
```
```   175 apply (rule select_not_equals, assumption)
```
```   176 done
```
```   177
```
```   178 lemma TFin_chain_lemma4: "c \<in> TFin S ==> (c :: 'a set set): chain S"
```
```   179 apply (erule TFin_induct)
```
```   180 apply (simp add: succ_def select_super [THEN super_subset_chain[THEN subsetD]])
```
```   181 apply (unfold chain_def)
```
```   182 apply (rule CollectI, safe)
```
```   183 apply (drule bspec, assumption)
```
```   184 apply (rule_tac [2] m1 = Xa and n1 = X in TFin_subset_linear [THEN disjE],
```
```   185        blast+)
```
```   186 done
```
```   187
```
```   188 theorem Hausdorff: "\<exists>c. (c :: 'a set set): maxchain S"
```
```   189 apply (rule_tac x = "Union (TFin S) " in exI)
```
```   190 apply (rule classical)
```
```   191 apply (subgoal_tac "succ S (Union (TFin S)) = Union (TFin S) ")
```
```   192  prefer 2
```
```   193  apply (blast intro!: TFin_UnionI equal_succ_Union [THEN iffD2, symmetric])
```
```   194 apply (cut_tac subset_refl [THEN TFin_UnionI, THEN TFin_chain_lemma4])
```
```   195 apply (drule DiffI [THEN succ_not_equals], blast+)
```
```   196 done
```
```   197
```
```   198
```
```   199 subsection{*Zorn's Lemma: If All Chains Have Upper Bounds Then
```
```   200                                There Is  a Maximal Element*}
```
```   201
```
```   202 lemma chain_extend:
```
```   203     "[| c \<in> chain S; z \<in> S;
```
```   204         \<forall>x \<in> c. x<=(z:: 'a set) |] ==> {z} Un c \<in> chain S"
```
```   205 by (unfold chain_def, blast)
```
```   206
```
```   207 lemma chain_Union_upper: "[| c \<in> chain S; x \<in> c |] ==> x \<subseteq> Union(c)"
```
```   208 by (unfold chain_def, auto)
```
```   209
```
```   210 lemma chain_ball_Union_upper: "c \<in> chain S ==> \<forall>x \<in> c. x \<subseteq> Union(c)"
```
```   211 by (unfold chain_def, auto)
```
```   212
```
```   213 lemma maxchain_Zorn:
```
```   214      "[| c \<in> maxchain S; u \<in> S; Union(c) \<subseteq> u |] ==> Union(c) = u"
```
```   215 apply (rule ccontr)
```
```   216 apply (simp add: maxchain_def)
```
```   217 apply (erule conjE)
```
```   218 apply (subgoal_tac " ({u} Un c) \<in> super S c")
```
```   219 apply simp
```
```   220 apply (unfold super_def psubset_def)
```
```   221 apply (blast intro: chain_extend dest: chain_Union_upper)
```
```   222 done
```
```   223
```
```   224 theorem Zorn_Lemma:
```
```   225      "\<forall>c \<in> chain S. Union(c): S ==> \<exists>y \<in> S. \<forall>z \<in> S. y \<subseteq> z --> y = z"
```
```   226 apply (cut_tac Hausdorff maxchain_subset_chain)
```
```   227 apply (erule exE)
```
```   228 apply (drule subsetD, assumption)
```
```   229 apply (drule bspec, assumption)
```
```   230 apply (rule_tac x = "Union (c) " in bexI)
```
```   231 apply (rule ballI, rule impI)
```
```   232 apply (blast dest!: maxchain_Zorn, assumption)
```
```   233 done
```
```   234
```
```   235 subsection{*Alternative version of Zorn's Lemma*}
```
```   236
```
```   237 lemma Zorn_Lemma2:
```
```   238      "\<forall>c \<in> chain S. \<exists>y \<in> S. \<forall>x \<in> c. x \<subseteq> y
```
```   239       ==> \<exists>y \<in> S. \<forall>x \<in> S. (y :: 'a set) \<subseteq> x --> y = x"
```
```   240 apply (cut_tac Hausdorff maxchain_subset_chain)
```
```   241 apply (erule exE)
```
```   242 apply (drule subsetD, assumption)
```
```   243 apply (drule bspec, assumption, erule bexE)
```
```   244 apply (rule_tac x = y in bexI)
```
```   245  prefer 2 apply assumption
```
```   246 apply clarify
```
```   247 apply (rule ccontr)
```
```   248 apply (frule_tac z = x in chain_extend)
```
```   249 apply (assumption, blast)
```
```   250 apply (unfold maxchain_def super_def psubset_def)
```
```   251 apply (blast elim!: equalityCE)
```
```   252 done
```
```   253
```
```   254 text{*Various other lemmas*}
```
```   255
```
```   256 lemma chainD: "[| c \<in> chain S; x \<in> c; y \<in> c |] ==> x \<subseteq> y | y \<subseteq> x"
```
```   257 by (unfold chain_def, blast)
```
```   258
```
```   259 lemma chainD2: "!!(c :: 'a set set). c \<in> chain S ==> c \<subseteq> S"
```
```   260 by (unfold chain_def, blast)
```
```   261
```
```   262 end
```
```   263
```