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