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