src/ZF/Constructible/AC_in_L.thy
author wenzelm
Thu Sep 02 00:48:07 2010 +0200 (2010-09-02)
changeset 38980 af73cf0dc31f
parent 32960 69916a850301
child 46823 57bf0cecb366
permissions -rw-r--r--
turned show_question_marks into proper configuration option;
show_question_marks only affects regular type/term pretty printing, not raw Term.string_of_vname;
tuned;
paulson@13543
     1
(*  Title:      ZF/Constructible/AC_in_L.thy
paulson@13543
     2
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
paulson@13543
     3
*)
paulson@13543
     4
paulson@13543
     5
header {* The Axiom of Choice Holds in L! *}
paulson@13543
     6
haftmann@16417
     7
theory AC_in_L imports Formula begin
paulson@13543
     8
paulson@13543
     9
subsection{*Extending a Wellordering over a List -- Lexicographic Power*}
paulson@13543
    10
paulson@13543
    11
text{*This could be moved into a library.*}
paulson@13543
    12
paulson@13543
    13
consts
paulson@13543
    14
  rlist   :: "[i,i]=>i"
paulson@13543
    15
paulson@13543
    16
inductive
paulson@13543
    17
  domains "rlist(A,r)" \<subseteq> "list(A) * list(A)"
paulson@13543
    18
  intros
paulson@13543
    19
    shorterI:
paulson@13692
    20
      "[| length(l') < length(l); l' \<in> list(A); l \<in> list(A) |]
paulson@13543
    21
       ==> <l', l> \<in> rlist(A,r)"
paulson@13543
    22
paulson@13543
    23
    sameI:
paulson@13692
    24
      "[| <l',l> \<in> rlist(A,r); a \<in> A |]
paulson@13543
    25
       ==> <Cons(a,l'), Cons(a,l)> \<in> rlist(A,r)"
paulson@13543
    26
paulson@13543
    27
    diffI:
paulson@13692
    28
      "[| length(l') = length(l); <a',a> \<in> r;
paulson@13692
    29
          l' \<in> list(A); l \<in> list(A); a' \<in> A; a \<in> A |]
paulson@13543
    30
       ==> <Cons(a',l'), Cons(a,l)> \<in> rlist(A,r)"
paulson@13543
    31
  type_intros list.intros
paulson@13543
    32
paulson@13543
    33
paulson@13543
    34
subsubsection{*Type checking*}
paulson@13543
    35
paulson@13543
    36
lemmas rlist_type = rlist.dom_subset
paulson@13543
    37
paulson@13543
    38
lemmas field_rlist = rlist_type [THEN field_rel_subset]
paulson@13543
    39
paulson@13543
    40
subsubsection{*Linearity*}
paulson@13543
    41
paulson@13543
    42
lemma rlist_Nil_Cons [intro]:
paulson@13543
    43
    "[|a \<in> A; l \<in> list(A)|] ==> <[], Cons(a,l)> \<in> rlist(A, r)"
paulson@13692
    44
by (simp add: shorterI)
paulson@13543
    45
paulson@13543
    46
lemma linear_rlist:
paulson@13543
    47
    "linear(A,r) ==> linear(list(A),rlist(A,r))"
paulson@13543
    48
apply (simp (no_asm_simp) add: linear_def)
paulson@13692
    49
apply (rule ballI)
paulson@13692
    50
apply (induct_tac x)
paulson@13692
    51
 apply (rule ballI)
paulson@13692
    52
 apply (induct_tac y)
paulson@13692
    53
  apply (simp_all add: shorterI)
paulson@13692
    54
apply (rule ballI)
paulson@13692
    55
apply (erule_tac a=y in list.cases)
paulson@13692
    56
 apply (rename_tac [2] a2 l2)
paulson@13543
    57
 apply (rule_tac [2] i = "length(l)" and j = "length(l2)" in Ord_linear_lt)
paulson@13692
    58
     apply (simp_all add: shorterI)
paulson@13692
    59
apply (erule_tac x=a and y=a2 in linearE)
paulson@13692
    60
    apply (simp_all add: diffI)
paulson@13692
    61
apply (blast intro: sameI)
paulson@13543
    62
done
paulson@13543
    63
paulson@13543
    64
paulson@13543
    65
subsubsection{*Well-foundedness*}
paulson@13543
    66
paulson@13543
    67
text{*Nothing preceeds Nil in this ordering.*}
paulson@13543
    68
inductive_cases rlist_NilE: " <l,[]> \<in> rlist(A,r)"
paulson@13543
    69
paulson@13543
    70
inductive_cases rlist_ConsE: " <l', Cons(x,l)> \<in> rlist(A,r)"
paulson@13543
    71
paulson@13543
    72
lemma not_rlist_Nil [simp]: " <l,[]> \<notin> rlist(A,r)"
paulson@13543
    73
by (blast intro: elim: rlist_NilE)
paulson@13543
    74
paulson@13543
    75
lemma rlist_imp_length_le: "<l',l> \<in> rlist(A,r) ==> length(l') \<le> length(l)"
paulson@13543
    76
apply (erule rlist.induct)
paulson@13692
    77
apply (simp_all add: leI)
paulson@13543
    78
done
paulson@13543
    79
paulson@13543
    80
lemma wf_on_rlist_n:
paulson@13543
    81
  "[| n \<in> nat; wf[A](r) |] ==> wf[{l \<in> list(A). length(l) = n}](rlist(A,r))"
paulson@13692
    82
apply (induct_tac n)
paulson@13692
    83
 apply (rule wf_onI2, simp)
paulson@13692
    84
apply (rule wf_onI2, clarify)
paulson@13692
    85
apply (erule_tac a=y in list.cases, clarify)
paulson@13543
    86
 apply (simp (no_asm_use))
paulson@13692
    87
apply clarify
paulson@13543
    88
apply (simp (no_asm_use))
paulson@13543
    89
apply (subgoal_tac "\<forall>l2 \<in> list(A). length(l2) = x --> Cons(a,l2) \<in> B", blast)
paulson@13543
    90
apply (erule_tac a=a in wf_on_induct, assumption)
paulson@13543
    91
apply (rule ballI)
paulson@13692
    92
apply (rule impI)
paulson@13543
    93
apply (erule_tac a=l2 in wf_on_induct, blast, clarify)
paulson@13692
    94
apply (rename_tac a' l2 l')
paulson@13692
    95
apply (drule_tac x="Cons(a',l')" in bspec, typecheck)
paulson@13692
    96
apply simp
paulson@13692
    97
apply (erule mp, clarify)
paulson@13543
    98
apply (erule rlist_ConsE, auto)
paulson@13543
    99
done
paulson@13543
   100
paulson@13543
   101
lemma list_eq_UN_length: "list(A) = (\<Union>n\<in>nat. {l \<in> list(A). length(l) = n})"
paulson@13543
   102
by (blast intro: length_type)
paulson@13543
   103
paulson@13543
   104
paulson@13543
   105
lemma wf_on_rlist: "wf[A](r) ==> wf[list(A)](rlist(A,r))"
paulson@13692
   106
apply (subst list_eq_UN_length)
paulson@13692
   107
apply (rule wf_on_Union)
paulson@13543
   108
  apply (rule wf_imp_wf_on [OF wf_Memrel [of nat]])
paulson@13543
   109
 apply (simp add: wf_on_rlist_n)
paulson@13692
   110
apply (frule rlist_type [THEN subsetD])
paulson@13692
   111
apply (simp add: length_type)
paulson@13543
   112
apply (drule rlist_imp_length_le)
paulson@13692
   113
apply (erule leE)
paulson@13692
   114
apply (simp_all add: lt_def)
paulson@13543
   115
done
paulson@13543
   116
paulson@13543
   117
paulson@13543
   118
lemma wf_rlist: "wf(r) ==> wf(rlist(field(r),r))"
paulson@13543
   119
apply (simp add: wf_iff_wf_on_field)
paulson@13543
   120
apply (rule wf_on_subset_A [OF _ field_rlist])
paulson@13692
   121
apply (blast intro: wf_on_rlist)
paulson@13543
   122
done
paulson@13543
   123
paulson@13543
   124
lemma well_ord_rlist:
paulson@13543
   125
     "well_ord(A,r) ==> well_ord(list(A), rlist(A,r))"
paulson@13543
   126
apply (rule well_ordI)
paulson@13543
   127
apply (simp add: well_ord_def wf_on_rlist)
paulson@13543
   128
apply (simp add: well_ord_def tot_ord_def linear_rlist)
paulson@13543
   129
done
paulson@13543
   130
paulson@13543
   131
paulson@13543
   132
subsection{*An Injection from Formulas into the Natural Numbers*}
paulson@13543
   133
paulson@13543
   134
text{*There is a well-known bijection between @{term "nat*nat"} and @{term
paulson@13543
   135
nat} given by the expression f(m,n) = triangle(m+n) + m, where triangle(k)
paulson@13543
   136
enumerates the triangular numbers and can be defined by triangle(0)=0,
paulson@13543
   137
triangle(succ(k)) = succ(k + triangle(k)).  Some small amount of effort is
paulson@13692
   138
needed to show that f is a bijection.  We already know that such a bijection exists by the theorem @{text well_ord_InfCard_square_eq}:
paulson@13692
   139
@{thm[display] well_ord_InfCard_square_eq[no_vars]}
paulson@13543
   140
paulson@13692
   141
However, this result merely states that there is a bijection between the two
paulson@13692
   142
sets.  It provides no means of naming a specific bijection.  Therefore, we
paulson@13692
   143
conduct the proofs under the assumption that a bijection exists.  The simplest
paulson@13692
   144
way to organize this is to use a locale.*}
paulson@13692
   145
paulson@13692
   146
text{*Locale for any arbitrary injection between @{term "nat*nat"}
paulson@13543
   147
      and @{term nat}*}
paulson@13543
   148
locale Nat_Times_Nat =
paulson@13543
   149
  fixes fn
paulson@13543
   150
  assumes fn_inj: "fn \<in> inj(nat*nat, nat)"
paulson@13543
   151
paulson@13543
   152
paulson@13543
   153
consts   enum :: "[i,i]=>i"
paulson@13543
   154
primrec
paulson@13543
   155
  "enum(f, Member(x,y)) = f ` <0, f ` <x,y>>"
paulson@13543
   156
  "enum(f, Equal(x,y)) = f ` <1, f ` <x,y>>"
paulson@13543
   157
  "enum(f, Nand(p,q)) = f ` <2, f ` <enum(f,p), enum(f,q)>>"
paulson@13543
   158
  "enum(f, Forall(p)) = f ` <succ(2), enum(f,p)>"
paulson@13543
   159
paulson@13543
   160
lemma (in Nat_Times_Nat) fn_type [TC,simp]:
paulson@13543
   161
    "[|x \<in> nat; y \<in> nat|] ==> fn`<x,y> \<in> nat"
paulson@13692
   162
by (blast intro: inj_is_fun [OF fn_inj] apply_funtype)
paulson@13543
   163
paulson@13543
   164
lemma (in Nat_Times_Nat) fn_iff:
paulson@13692
   165
    "[|x \<in> nat; y \<in> nat; u \<in> nat; v \<in> nat|]
paulson@13543
   166
     ==> (fn`<x,y> = fn`<u,v>) <-> (x=u & y=v)"
paulson@13692
   167
by (blast dest: inj_apply_equality [OF fn_inj])
paulson@13543
   168
paulson@13543
   169
lemma (in Nat_Times_Nat) enum_type [TC,simp]:
paulson@13543
   170
    "p \<in> formula ==> enum(fn,p) \<in> nat"
paulson@13692
   171
by (induct_tac p, simp_all)
paulson@13543
   172
paulson@13543
   173
lemma (in Nat_Times_Nat) enum_inject [rule_format]:
paulson@13543
   174
    "p \<in> formula ==> \<forall>q\<in>formula. enum(fn,p) = enum(fn,q) --> p=q"
paulson@13692
   175
apply (induct_tac p, simp_all)
paulson@13692
   176
   apply (rule ballI)
paulson@13692
   177
   apply (erule formula.cases)
paulson@13692
   178
   apply (simp_all add: fn_iff)
paulson@13692
   179
  apply (rule ballI)
paulson@13692
   180
  apply (erule formula.cases)
paulson@13692
   181
  apply (simp_all add: fn_iff)
paulson@13692
   182
 apply (rule ballI)
paulson@13692
   183
 apply (erule_tac a=qa in formula.cases)
paulson@13692
   184
 apply (simp_all add: fn_iff)
paulson@13692
   185
 apply blast
paulson@13692
   186
apply (rule ballI)
paulson@13692
   187
apply (erule_tac a=q in formula.cases)
paulson@13692
   188
apply (simp_all add: fn_iff, blast)
paulson@13543
   189
done
paulson@13543
   190
paulson@13543
   191
lemma (in Nat_Times_Nat) inj_formula_nat:
paulson@13543
   192
    "(\<lambda>p \<in> formula. enum(fn,p)) \<in> inj(formula, nat)"
paulson@13692
   193
apply (simp add: inj_def lam_type)
paulson@13692
   194
apply (blast intro: enum_inject)
paulson@13543
   195
done
paulson@13543
   196
paulson@13543
   197
lemma (in Nat_Times_Nat) well_ord_formula:
paulson@13543
   198
    "well_ord(formula, measure(formula, enum(fn)))"
paulson@13543
   199
apply (rule well_ord_measure, simp)
paulson@13692
   200
apply (blast intro: enum_inject)
paulson@13543
   201
done
paulson@13543
   202
paulson@13543
   203
lemmas nat_times_nat_lepoll_nat =
paulson@13543
   204
    InfCard_nat [THEN InfCard_square_eqpoll, THEN eqpoll_imp_lepoll]
paulson@13543
   205
paulson@13543
   206
paulson@13543
   207
text{*Not needed--but interesting?*}
paulson@13543
   208
theorem formula_lepoll_nat: "formula \<lesssim> nat"
paulson@13543
   209
apply (insert nat_times_nat_lepoll_nat)
paulson@13543
   210
apply (unfold lepoll_def)
paulson@13692
   211
apply (blast intro: Nat_Times_Nat.inj_formula_nat Nat_Times_Nat.intro)
paulson@13692
   212
done
paulson@13692
   213
paulson@13692
   214
paulson@13692
   215
subsection{*Defining the Wellordering on @{term "DPow(A)"}*}
paulson@13692
   216
paulson@13692
   217
text{*The objective is to build a wellordering on @{term "DPow(A)"} from a
paulson@13692
   218
given one on @{term A}.  We first introduce wellorderings for environments,
paulson@13692
   219
which are lists built over @{term "A"}.  We combine it with the enumeration of
paulson@13692
   220
formulas.  The order type of the resulting wellordering gives us a map from
paulson@13692
   221
(environment, formula) pairs into the ordinals.  For each member of @{term
paulson@13702
   222
"DPow(A)"}, we take the minimum such ordinal.*}
paulson@13692
   223
wenzelm@21233
   224
definition
wenzelm@21404
   225
  env_form_r :: "[i,i,i]=>i" where
paulson@13692
   226
    --{*wellordering on (environment, formula) pairs*}
paulson@13692
   227
   "env_form_r(f,r,A) ==
paulson@13692
   228
      rmult(list(A), rlist(A, r),
wenzelm@32960
   229
            formula, measure(formula, enum(f)))"
paulson@13692
   230
wenzelm@21404
   231
definition
wenzelm@21404
   232
  env_form_map :: "[i,i,i,i]=>i" where
paulson@13692
   233
    --{*map from (environment, formula) pairs to ordinals*}
paulson@13692
   234
   "env_form_map(f,r,A,z)
paulson@13692
   235
      == ordermap(list(A) * formula, env_form_r(f,r,A)) ` z"
paulson@13692
   236
wenzelm@21404
   237
definition
wenzelm@21404
   238
  DPow_ord :: "[i,i,i,i,i]=>o" where
paulson@13692
   239
    --{*predicate that holds if @{term k} is a valid index for @{term X}*}
paulson@13702
   240
   "DPow_ord(f,r,A,X,k) ==
paulson@13692
   241
           \<exists>env \<in> list(A). \<exists>p \<in> formula.
paulson@13692
   242
             arity(p) \<le> succ(length(env)) &
paulson@13692
   243
             X = {x\<in>A. sats(A, p, Cons(x,env))} &
paulson@13692
   244
             env_form_map(f,r,A,<env,p>) = k"
paulson@13692
   245
wenzelm@21404
   246
definition
wenzelm@21404
   247
  DPow_least :: "[i,i,i,i]=>i" where
paulson@13692
   248
    --{*function yielding the smallest index for @{term X}*}
skalberg@14171
   249
   "DPow_least(f,r,A,X) == \<mu> k. DPow_ord(f,r,A,X,k)"
paulson@13692
   250
wenzelm@21404
   251
definition
wenzelm@21404
   252
  DPow_r :: "[i,i,i]=>i" where
paulson@13692
   253
    --{*a wellordering on @{term "DPow(A)"}*}
paulson@13702
   254
   "DPow_r(f,r,A) == measure(DPow(A), DPow_least(f,r,A))"
paulson@13692
   255
paulson@13692
   256
paulson@13692
   257
lemma (in Nat_Times_Nat) well_ord_env_form_r:
paulson@13692
   258
    "well_ord(A,r)
paulson@13692
   259
     ==> well_ord(list(A) * formula, env_form_r(fn,r,A))"
paulson@13692
   260
by (simp add: env_form_r_def well_ord_rmult well_ord_rlist well_ord_formula)
paulson@13692
   261
paulson@13692
   262
lemma (in Nat_Times_Nat) Ord_env_form_map:
paulson@13692
   263
    "[|well_ord(A,r); z \<in> list(A) * formula|]
paulson@13692
   264
     ==> Ord(env_form_map(fn,r,A,z))"
paulson@13692
   265
by (simp add: env_form_map_def Ord_ordermap well_ord_env_form_r)
paulson@13692
   266
paulson@13702
   267
lemma DPow_imp_ex_DPow_ord:
paulson@13702
   268
    "X \<in> DPow(A) ==> \<exists>k. DPow_ord(fn,r,A,X,k)"
paulson@13702
   269
apply (simp add: DPow_ord_def)
paulson@13692
   270
apply (blast dest!: DPowD)
paulson@13692
   271
done
paulson@13692
   272
paulson@13702
   273
lemma (in Nat_Times_Nat) DPow_ord_imp_Ord:
paulson@13702
   274
     "[|DPow_ord(fn,r,A,X,k); well_ord(A,r)|] ==> Ord(k)"
paulson@13702
   275
apply (simp add: DPow_ord_def, clarify)
paulson@13692
   276
apply (simp add: Ord_env_form_map)
paulson@13543
   277
done
paulson@13543
   278
paulson@13702
   279
lemma (in Nat_Times_Nat) DPow_imp_DPow_least:
paulson@13692
   280
    "[|X \<in> DPow(A); well_ord(A,r)|]
paulson@13702
   281
     ==> DPow_ord(fn, r, A, X, DPow_least(fn,r,A,X))"
paulson@13702
   282
apply (simp add: DPow_least_def)
paulson@13702
   283
apply (blast dest: DPow_imp_ex_DPow_ord intro: DPow_ord_imp_Ord LeastI)
paulson@13692
   284
done
paulson@13692
   285
paulson@13692
   286
lemma (in Nat_Times_Nat) env_form_map_inject:
paulson@13692
   287
    "[|env_form_map(fn,r,A,u) = env_form_map(fn,r,A,v); well_ord(A,r);
paulson@13692
   288
       u \<in> list(A) * formula;  v \<in> list(A) * formula|]
paulson@13692
   289
     ==> u=v"
paulson@13692
   290
apply (simp add: env_form_map_def)
paulson@13692
   291
apply (rule inj_apply_equality [OF bij_is_inj, OF ordermap_bij,
paulson@13692
   292
                                OF well_ord_env_form_r], assumption+)
paulson@13692
   293
done
paulson@13692
   294
paulson@13702
   295
lemma (in Nat_Times_Nat) DPow_ord_unique:
paulson@13702
   296
    "[|DPow_ord(fn,r,A,X,k); DPow_ord(fn,r,A,Y,k); well_ord(A,r)|]
paulson@13692
   297
     ==> X=Y"
paulson@13702
   298
apply (simp add: DPow_ord_def, clarify)
paulson@13692
   299
apply (drule env_form_map_inject, auto)
paulson@13692
   300
done
paulson@13692
   301
paulson@13702
   302
lemma (in Nat_Times_Nat) well_ord_DPow_r:
paulson@13702
   303
    "well_ord(A,r) ==> well_ord(DPow(A), DPow_r(fn,r,A))"
paulson@13702
   304
apply (simp add: DPow_r_def)
paulson@13692
   305
apply (rule well_ord_measure)
paulson@13702
   306
 apply (simp add: DPow_least_def Ord_Least)
paulson@13702
   307
apply (drule DPow_imp_DPow_least, assumption)+
paulson@13692
   308
apply simp
paulson@13702
   309
apply (blast intro: DPow_ord_unique)
paulson@13692
   310
done
paulson@13692
   311
paulson@13692
   312
lemma (in Nat_Times_Nat) DPow_r_type:
paulson@13702
   313
    "DPow_r(fn,r,A) \<subseteq> DPow(A) * DPow(A)"
paulson@13702
   314
by (simp add: DPow_r_def measure_def, blast)
paulson@13692
   315
paulson@13543
   316
paulson@13543
   317
subsection{*Limit Construction for Well-Orderings*}
paulson@13543
   318
paulson@13543
   319
text{*Now we work towards the transfinite definition of wellorderings for
paulson@13543
   320
@{term "Lset(i)"}.  We assume as an inductive hypothesis that there is a family
paulson@13543
   321
of wellorderings for smaller ordinals.*}
paulson@13543
   322
wenzelm@21233
   323
definition
wenzelm@21404
   324
  rlimit :: "[i,i=>i]=>i" where
paulson@13702
   325
  --{*Expresses the wellordering at limit ordinals.  The conditional
paulson@13702
   326
      lets us remove the premise @{term "Limit(i)"} from some theorems.*}
paulson@13692
   327
    "rlimit(i,r) ==
paulson@13702
   328
       if Limit(i) then 
wenzelm@32960
   329
         {z: Lset(i) * Lset(i).
wenzelm@32960
   330
          \<exists>x' x. z = <x',x> &
wenzelm@32960
   331
                 (lrank(x') < lrank(x) |
wenzelm@32960
   332
                  (lrank(x') = lrank(x) & <x',x> \<in> r(succ(lrank(x)))))}
paulson@13702
   333
       else 0"
paulson@13692
   334
wenzelm@21404
   335
definition
wenzelm@21404
   336
  Lset_new :: "i=>i" where
paulson@13692
   337
  --{*This constant denotes the set of elements introduced at level
paulson@13692
   338
      @{term "succ(i)"}*}
paulson@13543
   339
    "Lset_new(i) == {x \<in> Lset(succ(i)). lrank(x) = i}"
paulson@13543
   340
paulson@13543
   341
lemma Limit_Lset_eq2:
paulson@13543
   342
    "Limit(i) ==> Lset(i) = (\<Union>j\<in>i. Lset_new(j))"
paulson@13692
   343
apply (simp add: Limit_Lset_eq)
paulson@13543
   344
apply (rule equalityI)
paulson@13543
   345
 apply safe
paulson@13543
   346
 apply (subgoal_tac "Ord(y)")
paulson@13543
   347
  prefer 2 apply (blast intro: Ord_in_Ord Limit_is_Ord)
paulson@13692
   348
 apply (simp_all add: Limit_is_Ord Lset_iff_lrank_lt Lset_new_def
paulson@13692
   349
                      Ord_mem_iff_lt)
paulson@13692
   350
 apply (blast intro: lt_trans)
paulson@13543
   351
apply (rule_tac x = "succ(lrank(x))" in bexI)
paulson@13692
   352
 apply (simp add: Lset_succ_lrank_iff)
paulson@13692
   353
apply (blast intro: Limit_has_succ ltD)
paulson@13543
   354
done
paulson@13543
   355
paulson@13543
   356
lemma wf_on_Lset:
paulson@13543
   357
    "wf[Lset(succ(j))](r(succ(j))) ==> wf[Lset_new(j)](rlimit(i,r))"
paulson@13692
   358
apply (simp add: wf_on_def Lset_new_def)
paulson@13692
   359
apply (erule wf_subset)
paulson@13702
   360
apply (simp add: rlimit_def, force)
paulson@13543
   361
done
paulson@13543
   362
paulson@13543
   363
lemma wf_on_rlimit:
paulson@13702
   364
    "(\<forall>j<i. wf[Lset(j)](r(j))) ==> wf[Lset(i)](rlimit(i,r))"
paulson@13702
   365
apply (case_tac "Limit(i)") 
paulson@13702
   366
 prefer 2
paulson@13702
   367
 apply (simp add: rlimit_def wf_on_any_0)
paulson@13543
   368
apply (simp add: Limit_Lset_eq2)
paulson@13543
   369
apply (rule wf_on_Union)
paulson@13692
   370
  apply (rule wf_imp_wf_on [OF wf_Memrel [of i]])
paulson@13692
   371
 apply (blast intro: wf_on_Lset Limit_has_succ Limit_is_Ord ltI)
paulson@13543
   372
apply (force simp add: rlimit_def Limit_is_Ord Lset_iff_lrank_lt Lset_new_def
paulson@13543
   373
                       Ord_mem_iff_lt)
paulson@13543
   374
done
paulson@13543
   375
paulson@13543
   376
lemma linear_rlimit:
paulson@13543
   377
    "[|Limit(i); \<forall>j<i. linear(Lset(j), r(j)) |]
paulson@13543
   378
     ==> linear(Lset(i), rlimit(i,r))"
paulson@13692
   379
apply (frule Limit_is_Ord)
paulson@13692
   380
apply (simp add: Limit_Lset_eq2 Lset_new_def)
paulson@13692
   381
apply (simp add: linear_def rlimit_def Ball_def lt_Ord Lset_iff_lrank_lt)
paulson@13692
   382
apply (simp add: ltI, clarify)
paulson@13692
   383
apply (rename_tac u v)
paulson@13692
   384
apply (rule_tac i="lrank(u)" and j="lrank(v)" in Ord_linear_lt, simp_all) 
paulson@13692
   385
apply (drule_tac x="succ(lrank(u) Un lrank(v))" in ospec)
paulson@13692
   386
 apply (simp add: ltI)
paulson@13692
   387
apply (drule_tac x=u in spec, simp)
paulson@13692
   388
apply (drule_tac x=v in spec, simp)
paulson@13543
   389
done
paulson@13543
   390
paulson@13543
   391
lemma well_ord_rlimit:
paulson@13543
   392
    "[|Limit(i); \<forall>j<i. well_ord(Lset(j), r(j)) |]
paulson@13543
   393
     ==> well_ord(Lset(i), rlimit(i,r))"
paulson@13692
   394
by (blast intro: well_ordI wf_on_rlimit well_ord_is_wf
paulson@13692
   395
                           linear_rlimit well_ord_is_linear)
paulson@13543
   396
paulson@13702
   397
lemma rlimit_cong:
paulson@13702
   398
     "(!!j. j<i ==> r'(j) = r(j)) ==> rlimit(i,r) = rlimit(i,r')"
paulson@13702
   399
apply (simp add: rlimit_def, clarify) 
paulson@13702
   400
apply (rule refl iff_refl Collect_cong ex_cong conj_cong)+
paulson@13702
   401
apply (simp add: Limit_is_Ord Lset_lrank_lt)
paulson@13702
   402
done
paulson@13702
   403
paulson@13543
   404
paulson@13543
   405
subsection{*Transfinite Definition of the Wellordering on @{term "L"}*}
paulson@13543
   406
wenzelm@21233
   407
definition
wenzelm@21404
   408
  L_r :: "[i, i] => i" where
paulson@13702
   409
  "L_r(f) == %i.
paulson@13702
   410
      transrec3(i, 0, \<lambda>x r. DPow_r(f, r, Lset(x)), 
paulson@13702
   411
                \<lambda>x r. rlimit(x, \<lambda>y. r`y))"
paulson@13543
   412
paulson@13543
   413
subsubsection{*The Corresponding Recursion Equations*}
paulson@13543
   414
lemma [simp]: "L_r(f,0) = 0"
paulson@13702
   415
by (simp add: L_r_def)
paulson@13543
   416
paulson@13702
   417
lemma [simp]: "L_r(f, succ(i)) = DPow_r(f, L_r(f,i), Lset(i))"
paulson@13702
   418
by (simp add: L_r_def)
paulson@13543
   419
paulson@13702
   420
text{*The limit case is non-trivial because of the distinction between
paulson@13702
   421
object-level and meta-level abstraction.*}
paulson@13543
   422
lemma [simp]: "Limit(i) ==> L_r(f,i) = rlimit(i, L_r(f))"
paulson@13702
   423
by (simp cong: rlimit_cong add: transrec3_Limit L_r_def ltD)
paulson@13543
   424
paulson@13543
   425
lemma (in Nat_Times_Nat) L_r_type:
paulson@13543
   426
    "Ord(i) ==> L_r(fn,i) \<subseteq> Lset(i) * Lset(i)"
paulson@13543
   427
apply (induct i rule: trans_induct3_rule)
paulson@13692
   428
  apply (simp_all add: Lset_succ DPow_r_type well_ord_DPow_r rlimit_def
paulson@13692
   429
                       Transset_subset_DPow [OF Transset_Lset], blast)
paulson@13543
   430
done
paulson@13543
   431
paulson@13543
   432
lemma (in Nat_Times_Nat) well_ord_L_r:
paulson@13543
   433
    "Ord(i) ==> well_ord(Lset(i), L_r(fn,i))"
paulson@13543
   434
apply (induct i rule: trans_induct3_rule)
paulson@13692
   435
apply (simp_all add: well_ord0 Lset_succ L_r_type well_ord_DPow_r
paulson@13692
   436
                     well_ord_rlimit ltD)
paulson@13543
   437
done
paulson@13543
   438
paulson@13543
   439
lemma well_ord_L_r:
paulson@13543
   440
    "Ord(i) ==> \<exists>r. well_ord(Lset(i), r)"
paulson@13543
   441
apply (insert nat_times_nat_lepoll_nat)
paulson@13543
   442
apply (unfold lepoll_def)
paulson@13692
   443
apply (blast intro: Nat_Times_Nat.well_ord_L_r Nat_Times_Nat.intro)
paulson@13543
   444
done
paulson@13543
   445
paulson@13543
   446
paulson@13543
   447
text{*Locale for proving results under the assumption @{text "V=L"}*}
paulson@13543
   448
locale V_equals_L =
paulson@13543
   449
  assumes VL: "L(x)"
paulson@13543
   450
paulson@13543
   451
text{*The Axiom of Choice holds in @{term L}!  Or, to be precise, the
paulson@13543
   452
Wellordering Theorem.*}
paulson@13543
   453
theorem (in V_equals_L) AC: "\<exists>r. well_ord(x,r)"
paulson@13692
   454
apply (insert Transset_Lset VL [of x])
paulson@13543
   455
apply (simp add: Transset_def L_def)
paulson@13692
   456
apply (blast dest!: well_ord_L_r intro: well_ord_subset)
paulson@13543
   457
done
paulson@13543
   458
paulson@13543
   459
end