src/ZF/Zorn.thy
author paulson
Tue Jul 02 13:28:08 2002 +0200 (2002-07-02)
changeset 13269 3ba9be497c33
parent 13175 81082cfa5618
child 13356 c9cfe1638bf2
permissions -rw-r--r--
Tidying and introduction of various new theorems
clasohm@1478
     1
(*  Title:      ZF/Zorn.thy
lcp@516
     2
    ID:         $Id$
clasohm@1478
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
lcp@516
     4
    Copyright   1994  University of Cambridge
lcp@516
     5
lcp@516
     6
Based upon the article
lcp@516
     7
    Abrial & Laffitte, 
lcp@516
     8
    Towards the Mechanization of the Proofs of Some 
lcp@516
     9
    Classical Theorems of Set Theory. 
lcp@516
    10
lcp@516
    11
Union_in_Pow is proved in ZF.ML
lcp@516
    12
*)
lcp@516
    13
paulson@13134
    14
theory Zorn = OrderArith + AC + Inductive:
lcp@516
    15
paulson@13134
    16
constdefs
paulson@13134
    17
  Subset_rel :: "i=>i"
paulson@13134
    18
   "Subset_rel(A) == {z: A*A . EX x y. z=<x,y> & x<=y & x~=y}"
paulson@13134
    19
paulson@13134
    20
  chain      :: "i=>i"
paulson@13134
    21
   "chain(A)      == {F: Pow(A). ALL X:F. ALL Y:F. X<=Y | Y<=X}"
lcp@516
    22
paulson@13134
    23
  maxchain   :: "i=>i"
paulson@13134
    24
   "maxchain(A)   == {c: chain(A). super(A,c)=0}"
paulson@13134
    25
  
paulson@13134
    26
  super      :: "[i,i]=>i"
paulson@13134
    27
   "super(A,c)    == {d: chain(A). c<=d & c~=d}"
lcp@485
    28
lcp@516
    29
paulson@13134
    30
constdefs
paulson@13134
    31
  increasing :: "i=>i"
paulson@13134
    32
    "increasing(A) == {f: Pow(A)->Pow(A). ALL x. x<=A --> x<=f`x}"
lcp@516
    33
lcp@516
    34
(** We could make the inductive definition conditional on next: increasing(S)
lcp@516
    35
    but instead we make this a side-condition of an introduction rule.  Thus
lcp@516
    36
    the induction rule lets us assume that condition!  Many inductive proofs
lcp@516
    37
    are therefore unconditional.
lcp@516
    38
**)
lcp@516
    39
consts
paulson@13134
    40
  "TFin" :: "[i,i]=>i"
lcp@516
    41
lcp@516
    42
inductive
lcp@516
    43
  domains       "TFin(S,next)" <= "Pow(S)"
paulson@13134
    44
  intros
paulson@13134
    45
    nextI:       "[| x : TFin(S,next);  next: increasing(S) |]
paulson@13134
    46
                  ==> next`x : TFin(S,next)"
lcp@516
    47
paulson@13134
    48
    Pow_UnionI: "Y : Pow(TFin(S,next)) ==> Union(Y) : TFin(S,next)"
lcp@516
    49
paulson@6053
    50
  monos         Pow_mono
paulson@6053
    51
  con_defs      increasing_def
paulson@13134
    52
  type_intros   CollectD1 [THEN apply_funtype] Union_in_Pow
paulson@13134
    53
paulson@13134
    54
paulson@13134
    55
(*** Section 1.  Mathematical Preamble ***)
paulson@13134
    56
paulson@13134
    57
lemma Union_lemma0: "(ALL x:C. x<=A | B<=x) ==> Union(C)<=A | B<=Union(C)"
paulson@13269
    58
by blast
paulson@13134
    59
paulson@13134
    60
lemma Inter_lemma0: "[| c:C; ALL x:C. A<=x | x<=B |] ==> A<=Inter(C) | Inter(C)<=B"
paulson@13269
    61
by blast
paulson@13134
    62
paulson@13134
    63
paulson@13134
    64
(*** Section 2.  The Transfinite Construction ***)
paulson@13134
    65
paulson@13134
    66
lemma increasingD1: "f: increasing(A) ==> f: Pow(A)->Pow(A)"
paulson@13134
    67
apply (unfold increasing_def)
paulson@13134
    68
apply (erule CollectD1)
paulson@13134
    69
done
paulson@13134
    70
paulson@13134
    71
lemma increasingD2: "[| f: increasing(A); x<=A |] ==> x <= f`x"
paulson@13269
    72
by (unfold increasing_def, blast)
paulson@13134
    73
paulson@13134
    74
lemmas TFin_UnionI = PowI [THEN TFin.Pow_UnionI, standard]
paulson@13134
    75
paulson@13134
    76
lemmas TFin_is_subset = TFin.dom_subset [THEN subsetD, THEN PowD, standard]
paulson@13134
    77
paulson@13134
    78
paulson@13134
    79
(** Structural induction on TFin(S,next) **)
paulson@13134
    80
paulson@13134
    81
lemma TFin_induct:
paulson@13134
    82
  "[| n: TFin(S,next);   
paulson@13134
    83
      !!x. [| x : TFin(S,next);  P(x);  next: increasing(S) |] ==> P(next`x);  
paulson@13134
    84
      !!Y. [| Y <= TFin(S,next);  ALL y:Y. P(y) |] ==> P(Union(Y))  
paulson@13134
    85
   |] ==> P(n)"
paulson@13269
    86
apply (erule TFin.induct, blast+)
paulson@13134
    87
done
paulson@13134
    88
paulson@13134
    89
paulson@13134
    90
(*** Section 3.  Some Properties of the Transfinite Construction ***)
paulson@13134
    91
paulson@13134
    92
lemmas increasing_trans = subset_trans [OF _ increasingD2, 
paulson@13134
    93
                                        OF _ _ TFin_is_subset]
paulson@13134
    94
paulson@13134
    95
(*Lemma 1 of section 3.1*)
paulson@13134
    96
lemma TFin_linear_lemma1:
paulson@13134
    97
     "[| n: TFin(S,next);  m: TFin(S,next);   
paulson@13134
    98
         ALL x: TFin(S,next) . x<=m --> x=m | next`x<=m |] 
paulson@13134
    99
      ==> n<=m | next`m<=n"
paulson@13134
   100
apply (erule TFin_induct)
paulson@13134
   101
apply (erule_tac [2] Union_lemma0) (*or just Blast_tac*)
paulson@13134
   102
(*downgrade subsetI from intro! to intro*)
paulson@13134
   103
apply (blast dest: increasing_trans)
paulson@13134
   104
done
paulson@13134
   105
paulson@13134
   106
(*Lemma 2 of section 3.2.  Interesting in its own right!
paulson@13134
   107
  Requires next: increasing(S) in the second induction step. *)
paulson@13134
   108
lemma TFin_linear_lemma2:
paulson@13134
   109
    "[| m: TFin(S,next);  next: increasing(S) |] 
paulson@13134
   110
     ==> ALL n: TFin(S,next) . n<=m --> n=m | next`n<=m"
paulson@13134
   111
apply (erule TFin_induct)
paulson@13134
   112
apply (rule impI [THEN ballI])
paulson@13134
   113
(*case split using TFin_linear_lemma1*)
paulson@13134
   114
apply (rule_tac n1 = "n" and m1 = "x" in TFin_linear_lemma1 [THEN disjE],
paulson@13134
   115
       assumption+)
paulson@13134
   116
apply (blast del: subsetI
paulson@13269
   117
	     intro: increasing_trans subsetI, blast) 
paulson@13134
   118
(*second induction step*)
paulson@13134
   119
apply (rule impI [THEN ballI])
paulson@13134
   120
apply (rule Union_lemma0 [THEN disjE])
paulson@13134
   121
apply (erule_tac [3] disjI2)
paulson@13269
   122
prefer 2 apply blast 
paulson@13134
   123
apply (rule ballI)
paulson@13134
   124
apply (drule bspec, assumption) 
paulson@13134
   125
apply (drule subsetD, assumption) 
paulson@13134
   126
apply (rule_tac n1 = "n" and m1 = "x" in TFin_linear_lemma1 [THEN disjE],
paulson@13269
   127
       assumption+, blast) 
paulson@13134
   128
apply (erule increasingD2 [THEN subset_trans, THEN disjI1])
paulson@13134
   129
apply (blast dest: TFin_is_subset)+
paulson@13134
   130
done
paulson@13134
   131
paulson@13134
   132
(*a more convenient form for Lemma 2*)
paulson@13134
   133
lemma TFin_subsetD:
paulson@13134
   134
     "[| n<=m;  m: TFin(S,next);  n: TFin(S,next);  next: increasing(S) |]  
paulson@13134
   135
      ==> n=m | next`n<=m"
paulson@13134
   136
by (blast dest: TFin_linear_lemma2 [rule_format]) 
paulson@13134
   137
paulson@13134
   138
(*Consequences from section 3.3 -- Property 3.2, the ordering is total*)
paulson@13134
   139
lemma TFin_subset_linear:
paulson@13134
   140
     "[| m: TFin(S,next);  n: TFin(S,next);  next: increasing(S) |]  
paulson@13134
   141
      ==> n<=m | m<=n"
paulson@13134
   142
apply (rule disjE) 
paulson@13134
   143
apply (rule TFin_linear_lemma1 [OF _ _TFin_linear_lemma2])
paulson@13134
   144
apply (assumption+, erule disjI2)
paulson@13134
   145
apply (blast del: subsetI 
paulson@13134
   146
             intro: subsetI increasingD2 [THEN subset_trans] TFin_is_subset)
paulson@13134
   147
done
paulson@13134
   148
paulson@13134
   149
paulson@13134
   150
(*Lemma 3 of section 3.3*)
paulson@13134
   151
lemma equal_next_upper:
paulson@13134
   152
     "[| n: TFin(S,next);  m: TFin(S,next);  m = next`m |] ==> n<=m"
paulson@13134
   153
apply (erule TFin_induct)
paulson@13134
   154
apply (drule TFin_subsetD)
paulson@13269
   155
apply (assumption+, force) 
paulson@13269
   156
apply blast
paulson@13134
   157
done
paulson@13134
   158
paulson@13134
   159
(*Property 3.3 of section 3.3*)
paulson@13134
   160
lemma equal_next_Union: "[| m: TFin(S,next);  next: increasing(S) |]   
paulson@13134
   161
      ==> m = next`m <-> m = Union(TFin(S,next))"
paulson@13134
   162
apply (rule iffI)
paulson@13134
   163
apply (rule Union_upper [THEN equalityI])
paulson@13134
   164
apply (rule_tac [2] equal_next_upper [THEN Union_least])
paulson@13134
   165
apply (assumption+)
paulson@13134
   166
apply (erule ssubst)
paulson@13269
   167
apply (rule increasingD2 [THEN equalityI], assumption)
paulson@13134
   168
apply (blast del: subsetI
paulson@13134
   169
	     intro: subsetI TFin_UnionI TFin.nextI TFin_is_subset)+
paulson@13134
   170
done
paulson@13134
   171
paulson@13134
   172
paulson@13134
   173
(*** Section 4.  Hausdorff's Theorem: every set contains a maximal chain ***)
paulson@13134
   174
(*** NB: We assume the partial ordering is <=, the subset relation! **)
paulson@13134
   175
paulson@13134
   176
(** Defining the "next" operation for Hausdorff's Theorem **)
paulson@13134
   177
paulson@13134
   178
lemma chain_subset_Pow: "chain(A) <= Pow(A)"
paulson@13134
   179
apply (unfold chain_def)
paulson@13134
   180
apply (rule Collect_subset)
paulson@13134
   181
done
paulson@13134
   182
paulson@13134
   183
lemma super_subset_chain: "super(A,c) <= chain(A)"
paulson@13134
   184
apply (unfold super_def)
paulson@13134
   185
apply (rule Collect_subset)
paulson@13134
   186
done
paulson@13134
   187
paulson@13134
   188
lemma maxchain_subset_chain: "maxchain(A) <= chain(A)"
paulson@13134
   189
apply (unfold maxchain_def)
paulson@13134
   190
apply (rule Collect_subset)
paulson@13134
   191
done
paulson@13134
   192
paulson@13134
   193
lemma choice_super: "[| ch : (PROD X:Pow(chain(S)) - {0}. X);   
paulson@13134
   194
         X : chain(S);  X ~: maxchain(S) |]      
paulson@13134
   195
      ==> ch ` super(S,X) : super(S,X)"
paulson@13134
   196
apply (erule apply_type)
paulson@13269
   197
apply (unfold super_def maxchain_def, blast)
paulson@13134
   198
done
paulson@13134
   199
paulson@13134
   200
lemma choice_not_equals:
paulson@13134
   201
     "[| ch : (PROD X:Pow(chain(S)) - {0}. X);       
paulson@13134
   202
         X : chain(S);  X ~: maxchain(S) |]      
paulson@13134
   203
      ==> ch ` super(S,X) ~= X"
paulson@13134
   204
apply (rule notI)
paulson@13269
   205
apply (drule choice_super, assumption)
paulson@13134
   206
apply assumption
paulson@13134
   207
apply (simp add: super_def)
paulson@13134
   208
done
paulson@13134
   209
paulson@13134
   210
(*This justifies Definition 4.4*)
paulson@13134
   211
lemma Hausdorff_next_exists:
paulson@13134
   212
     "ch: (PROD X: Pow(chain(S))-{0}. X) ==>         
paulson@13134
   213
      EX next: increasing(S). ALL X: Pow(S).        
paulson@13134
   214
                   next`X = if(X: chain(S)-maxchain(S), ch`super(S,X), X)"
paulson@13175
   215
apply (rule_tac x="\<lambda>X\<in>Pow(S). 
paulson@13175
   216
                   if X \<in> chain(S) - maxchain(S) then ch ` super(S, X) else X" 
paulson@13175
   217
       in bexI)
paulson@13269
   218
apply force 
paulson@13134
   219
apply (unfold increasing_def)
paulson@13134
   220
apply (rule CollectI)
paulson@13134
   221
apply (rule lam_type)
paulson@13134
   222
apply (simp (no_asm_simp))
paulson@13134
   223
apply (blast dest: super_subset_chain [THEN subsetD] chain_subset_Pow [THEN subsetD] choice_super)
paulson@13134
   224
(*Now, verify that it increases*)
paulson@13134
   225
apply (simp (no_asm_simp) add: Pow_iff subset_refl)
paulson@13134
   226
apply safe
paulson@13134
   227
apply (drule choice_super)
paulson@13134
   228
apply (assumption+)
paulson@13269
   229
apply (simp add: super_def, blast)
paulson@13134
   230
done
paulson@13134
   231
paulson@13134
   232
(*Lemma 4*)
paulson@13134
   233
lemma TFin_chain_lemma4:
paulson@13134
   234
     "[| c: TFin(S,next);                               
paulson@13134
   235
         ch: (PROD X: Pow(chain(S))-{0}. X);            
paulson@13134
   236
         next: increasing(S);                           
paulson@13134
   237
         ALL X: Pow(S). next`X =        
paulson@13134
   238
                          if(X: chain(S)-maxchain(S), ch`super(S,X), X) |] 
paulson@13134
   239
     ==> c: chain(S)"
paulson@13134
   240
apply (erule TFin_induct)
paulson@13134
   241
apply (simp (no_asm_simp) add: chain_subset_Pow [THEN subsetD, THEN PowD] 
paulson@13134
   242
            choice_super [THEN super_subset_chain [THEN subsetD]])
paulson@13134
   243
apply (unfold chain_def)
paulson@13269
   244
apply (rule CollectI, blast, safe)
paulson@13269
   245
apply (rule_tac m1 = "B" and n1 = "Ba" in TFin_subset_linear [THEN disjE], fast+) (*Blast_tac's slow*)
paulson@13134
   246
done
paulson@13134
   247
paulson@13134
   248
lemma Hausdorff: "EX c. c : maxchain(S)"
paulson@13134
   249
apply (rule AC_Pi_Pow [THEN exE])
paulson@13269
   250
apply (rule Hausdorff_next_exists [THEN bexE], assumption)
paulson@13134
   251
apply (rename_tac ch "next")
paulson@13134
   252
apply (subgoal_tac "Union (TFin (S,next)) : chain (S) ")
paulson@13134
   253
prefer 2
paulson@13134
   254
 apply (blast intro!: TFin_chain_lemma4 subset_refl [THEN TFin_UnionI])
paulson@13134
   255
apply (rule_tac x = "Union (TFin (S,next))" in exI)
paulson@13134
   256
apply (rule classical)
paulson@13134
   257
apply (subgoal_tac "next ` Union (TFin (S,next)) = Union (TFin (S,next))")
paulson@13134
   258
apply (rule_tac [2] equal_next_Union [THEN iffD2, symmetric])
paulson@13134
   259
apply (rule_tac [2] subset_refl [THEN TFin_UnionI])
paulson@13269
   260
prefer 2 apply assumption
paulson@13134
   261
apply (rule_tac [2] refl)
paulson@13134
   262
apply (simp add: subset_refl [THEN TFin_UnionI, 
paulson@13134
   263
                              THEN TFin.dom_subset [THEN subsetD, THEN PowD]])
paulson@13134
   264
apply (erule choice_not_equals [THEN notE])
paulson@13134
   265
apply (assumption+)
paulson@13134
   266
done
paulson@13134
   267
paulson@13134
   268
paulson@13134
   269
(*** Section 5.  Zorn's Lemma: if all chains in S have upper bounds in S 
paulson@13134
   270
                               then S contains a maximal element ***)
paulson@13134
   271
paulson@13134
   272
(*Used in the proof of Zorn's Lemma*)
paulson@13134
   273
lemma chain_extend: 
paulson@13134
   274
    "[| c: chain(A);  z: A;  ALL x:c. x<=z |] ==> cons(z,c) : chain(A)"
paulson@13269
   275
apply (unfold chain_def, blast)
paulson@13134
   276
done
paulson@13134
   277
paulson@13134
   278
lemma Zorn: "ALL c: chain(S). Union(c) : S ==> EX y:S. ALL z:S. y<=z --> y=z"
paulson@13134
   279
apply (rule Hausdorff [THEN exE])
paulson@13134
   280
apply (simp add: maxchain_def)
paulson@13134
   281
apply (rename_tac c)
paulson@13134
   282
apply (rule_tac x = "Union (c)" in bexI)
paulson@13269
   283
prefer 2 apply blast
paulson@13134
   284
apply safe
paulson@13134
   285
apply (rename_tac z)
paulson@13134
   286
apply (rule classical)
paulson@13134
   287
apply (subgoal_tac "cons (z,c) : super (S,c) ")
paulson@13134
   288
apply (blast elim: equalityE)
paulson@13269
   289
apply (unfold super_def, safe)
paulson@13134
   290
apply (fast elim: chain_extend)
paulson@13134
   291
apply (fast elim: equalityE)
paulson@13134
   292
done
paulson@13134
   293
paulson@13134
   294
paulson@13134
   295
(*** Section 6.  Zermelo's Theorem: every set can be well-ordered ***)
paulson@13134
   296
paulson@13134
   297
(*Lemma 5*)
paulson@13134
   298
lemma TFin_well_lemma5:
paulson@13134
   299
     "[| n: TFin(S,next);  Z <= TFin(S,next);  z:Z;  ~ Inter(Z) : Z |]   
paulson@13134
   300
      ==> ALL m:Z. n<=m"
paulson@13134
   301
apply (erule TFin_induct)
paulson@13269
   302
prefer 2 apply blast (*second induction step is easy*)
paulson@13134
   303
apply (rule ballI)
paulson@13269
   304
apply (rule bspec [THEN TFin_subsetD, THEN disjE], auto) 
paulson@13134
   305
apply (subgoal_tac "m = Inter (Z) ")
paulson@13134
   306
apply blast+
paulson@13134
   307
done
paulson@13134
   308
paulson@13134
   309
(*Well-ordering of TFin(S,next)*)
paulson@13134
   310
lemma well_ord_TFin_lemma: "[| Z <= TFin(S,next);  z:Z |] ==> Inter(Z) : Z"
paulson@13134
   311
apply (rule classical)
paulson@13134
   312
apply (subgoal_tac "Z = {Union (TFin (S,next))}")
paulson@13134
   313
apply (simp (no_asm_simp) add: Inter_singleton)
paulson@13134
   314
apply (erule equal_singleton)
paulson@13134
   315
apply (rule Union_upper [THEN equalityI])
paulson@13269
   316
apply (rule_tac [2] subset_refl [THEN TFin_UnionI, THEN TFin_well_lemma5, THEN bspec], blast+)
paulson@13134
   317
done
paulson@13134
   318
paulson@13134
   319
(*This theorem just packages the previous result*)
paulson@13134
   320
lemma well_ord_TFin:
paulson@13134
   321
     "next: increasing(S) ==> well_ord(TFin(S,next), Subset_rel(TFin(S,next)))"
paulson@13134
   322
apply (rule well_ordI)
paulson@13134
   323
apply (unfold Subset_rel_def linear_def)
paulson@13134
   324
(*Prove the well-foundedness goal*)
paulson@13134
   325
apply (rule wf_onI)
paulson@13269
   326
apply (frule well_ord_TFin_lemma, assumption)
paulson@13269
   327
apply (drule_tac x = "Inter (Z) " in bspec, assumption)
paulson@13134
   328
apply blast
paulson@13134
   329
(*Now prove the linearity goal*)
paulson@13134
   330
apply (intro ballI)
paulson@13134
   331
apply (case_tac "x=y")
paulson@13269
   332
 apply blast
paulson@13134
   333
(*The x~=y case remains*)
paulson@13134
   334
apply (rule_tac n1=x and m1=y in TFin_subset_linear [THEN disjE],
paulson@13269
   335
       assumption+, blast+)
paulson@13134
   336
done
paulson@13134
   337
paulson@13134
   338
(** Defining the "next" operation for Zermelo's Theorem **)
paulson@13134
   339
paulson@13134
   340
lemma choice_Diff:
paulson@13134
   341
     "[| ch \<in> (\<Pi>X \<in> Pow(S) - {0}. X);  X \<subseteq> S;  X\<noteq>S |] ==> ch ` (S-X) \<in> S-X"
paulson@13134
   342
apply (erule apply_type)
paulson@13134
   343
apply (blast elim!: equalityE)
paulson@13134
   344
done
paulson@13134
   345
paulson@13134
   346
(*This justifies Definition 6.1*)
paulson@13134
   347
lemma Zermelo_next_exists:
paulson@13134
   348
     "ch: (PROD X: Pow(S)-{0}. X) ==>                
paulson@13134
   349
           EX next: increasing(S). ALL X: Pow(S).        
paulson@13175
   350
                      next`X = (if X=S then S else cons(ch`(S-X), X))"
paulson@13175
   351
apply (rule_tac x="\<lambda>X\<in>Pow(S). if X=S then S else cons(ch`(S-X), X)"
paulson@13175
   352
       in bexI)
paulson@13269
   353
apply force  
paulson@13134
   354
apply (unfold increasing_def)
paulson@13134
   355
apply (rule CollectI)
paulson@13134
   356
apply (rule lam_type)
paulson@13134
   357
(*Type checking is surprisingly hard!*)
paulson@13134
   358
apply (simp (no_asm_simp) add: Pow_iff cons_subset_iff subset_refl)
paulson@13134
   359
apply (blast intro!: choice_Diff [THEN DiffD1])
paulson@13134
   360
(*Verify that it increases*)
paulson@13134
   361
apply (intro allI impI) 
paulson@13134
   362
apply (simp add: Pow_iff subset_consI subset_refl)
paulson@13134
   363
done
paulson@13134
   364
paulson@13134
   365
paulson@13134
   366
(*The construction of the injection*)
paulson@13134
   367
lemma choice_imp_injection:
paulson@13134
   368
     "[| ch: (PROD X: Pow(S)-{0}. X);                  
paulson@13134
   369
         next: increasing(S);                          
paulson@13134
   370
         ALL X: Pow(S). next`X = if(X=S, S, cons(ch`(S-X), X)) |]  
paulson@13134
   371
      ==> (lam x:S. Union({y: TFin(S,next). x~: y}))        
paulson@13134
   372
               : inj(S, TFin(S,next) - {S})"
paulson@13134
   373
apply (rule_tac d = "%y. ch` (S-y) " in lam_injective)
paulson@13134
   374
apply (rule DiffI)
paulson@13134
   375
apply (rule Collect_subset [THEN TFin_UnionI])
paulson@13134
   376
apply (blast intro!: Collect_subset [THEN TFin_UnionI] elim: equalityE)
paulson@13134
   377
apply (subgoal_tac "x ~: Union ({y: TFin (S,next) . x~: y}) ")
paulson@13134
   378
prefer 2 apply (blast elim: equalityE)
paulson@13134
   379
apply (subgoal_tac "Union ({y: TFin (S,next) . x~: y}) ~= S")
paulson@13134
   380
prefer 2 apply (blast elim: equalityE)
paulson@13134
   381
(*For proving x : next`Union(...)
paulson@13134
   382
  Abrial & Laffitte's justification appears to be faulty.*)
paulson@13134
   383
apply (subgoal_tac "~ next ` Union ({y: TFin (S,next) . x~: y}) <= Union ({y: TFin (S,next) . x~: y}) ")
paulson@13134
   384
prefer 2
paulson@13134
   385
apply (simp del: Union_iff 
paulson@13134
   386
            add: Collect_subset [THEN TFin_UnionI, THEN TFin_is_subset] 
paulson@13134
   387
            Pow_iff cons_subset_iff subset_refl choice_Diff [THEN DiffD2])
paulson@13134
   388
apply (subgoal_tac "x : next ` Union ({y: TFin (S,next) . x~: y}) ")
paulson@13134
   389
prefer 2
paulson@13134
   390
apply (blast intro!: Collect_subset [THEN TFin_UnionI] TFin.nextI)
paulson@13134
   391
(*End of the lemmas!*)
paulson@13134
   392
apply (simp add: Collect_subset [THEN TFin_UnionI, THEN TFin_is_subset])
paulson@13134
   393
done
paulson@13134
   394
paulson@13134
   395
(*The wellordering theorem*)
paulson@13134
   396
lemma AC_well_ord: "EX r. well_ord(S,r)"
paulson@13134
   397
apply (rule AC_Pi_Pow [THEN exE])
paulson@13269
   398
apply (rule Zermelo_next_exists [THEN bexE], assumption)
paulson@13134
   399
apply (rule exI)
paulson@13134
   400
apply (rule well_ord_rvimage)
paulson@13134
   401
apply (erule_tac [2] well_ord_TFin)
paulson@13269
   402
apply (rule choice_imp_injection [THEN inj_weaken_type], blast+)
paulson@13134
   403
done
lcp@516
   404
  
lcp@516
   405
end