src/ZF/Constructible/Separation.thy
author paulson
Fri Jul 05 18:33:50 2002 +0200 (2002-07-05)
changeset 13306 6eebcddee32b
child 13314 84b9de3cbc91
permissions -rw-r--r--
more internalized formulas and separation proofs
paulson@13306
     1
header{*Proving instances of Separation using Reflection!*}
paulson@13306
     2
paulson@13306
     3
theory Separation = L_axioms:
paulson@13306
     4
paulson@13306
     5
text{*Helps us solve for de Bruijn indices!*}
paulson@13306
     6
lemma nth_ConsI: "[|nth(n,l) = x; n \<in> nat|] ==> nth(succ(n), Cons(a,l)) = x"
paulson@13306
     7
by simp
paulson@13306
     8
paulson@13306
     9
paulson@13306
    10
lemma Collect_conj_in_DPow:
paulson@13306
    11
     "[| {x\<in>A. P(x)} \<in> DPow(A);  {x\<in>A. Q(x)} \<in> DPow(A) |] 
paulson@13306
    12
      ==> {x\<in>A. P(x) & Q(x)} \<in> DPow(A)"
paulson@13306
    13
by (simp add: Int_in_DPow Collect_Int_Collect_eq [symmetric]) 
paulson@13306
    14
paulson@13306
    15
lemma Collect_conj_in_DPow_Lset:
paulson@13306
    16
     "[|z \<in> Lset(j); {x \<in> Lset(j). P(x)} \<in> DPow(Lset(j))|]
paulson@13306
    17
      ==> {x \<in> Lset(j). x \<in> z & P(x)} \<in> DPow(Lset(j))"
paulson@13306
    18
apply (frule mem_Lset_imp_subset_Lset)
paulson@13306
    19
apply (simp add: Collect_conj_in_DPow Collect_mem_eq 
paulson@13306
    20
                 subset_Int_iff2 elem_subset_in_DPow)
paulson@13306
    21
done
paulson@13306
    22
paulson@13306
    23
lemma separation_CollectI:
paulson@13306
    24
     "(\<And>z. L(z) ==> L({x \<in> z . P(x)})) ==> separation(L, \<lambda>x. P(x))"
paulson@13306
    25
apply (unfold separation_def, clarify) 
paulson@13306
    26
apply (rule_tac x="{x\<in>z. P(x)}" in rexI) 
paulson@13306
    27
apply simp_all
paulson@13306
    28
done
paulson@13306
    29
paulson@13306
    30
text{*Reduces the original comprehension to the reflected one*}
paulson@13306
    31
lemma reflection_imp_L_separation:
paulson@13306
    32
      "[| \<forall>x\<in>Lset(j). P(x) <-> Q(x);
paulson@13306
    33
          {x \<in> Lset(j) . Q(x)} \<in> DPow(Lset(j)); 
paulson@13306
    34
          Ord(j);  z \<in> Lset(j)|] ==> L({x \<in> z . P(x)})"
paulson@13306
    35
apply (rule_tac i = "succ(j)" in L_I)
paulson@13306
    36
 prefer 2 apply simp
paulson@13306
    37
apply (subgoal_tac "{x \<in> z. P(x)} = {x \<in> Lset(j). x \<in> z & (Q(x))}")
paulson@13306
    38
 prefer 2
paulson@13306
    39
 apply (blast dest: mem_Lset_imp_subset_Lset) 
paulson@13306
    40
apply (simp add: Lset_succ Collect_conj_in_DPow_Lset)
paulson@13306
    41
done
paulson@13306
    42
paulson@13306
    43
paulson@13306
    44
subsubsection{*Separation for Intersection*}
paulson@13306
    45
paulson@13306
    46
lemma Inter_Reflects:
paulson@13306
    47
     "L_Reflects(?Cl, \<lambda>x. \<forall>y[L]. y\<in>A --> x \<in> y, 
paulson@13306
    48
               \<lambda>i x. \<forall>y\<in>Lset(i). y\<in>A --> x \<in> y)"
paulson@13306
    49
by fast
paulson@13306
    50
paulson@13306
    51
lemma Inter_separation:
paulson@13306
    52
     "L(A) ==> separation(L, \<lambda>x. \<forall>y[L]. y\<in>A --> x\<in>y)"
paulson@13306
    53
apply (rule separation_CollectI) 
paulson@13306
    54
apply (rule_tac A="{A,z}" in subset_LsetE, blast ) 
paulson@13306
    55
apply (rule ReflectsE [OF Inter_Reflects], assumption)
paulson@13306
    56
apply (drule subset_Lset_ltD, assumption) 
paulson@13306
    57
apply (erule reflection_imp_L_separation)
paulson@13306
    58
  apply (simp_all add: lt_Ord2, clarify)
paulson@13306
    59
apply (rule DPowI2) 
paulson@13306
    60
apply (rule ball_iff_sats) 
paulson@13306
    61
apply (rule imp_iff_sats)
paulson@13306
    62
apply (rule_tac [2] i=1 and j=0 and env="[y,x,A]" in mem_iff_sats)
paulson@13306
    63
apply (rule_tac i=0 and j=2 in mem_iff_sats)
paulson@13306
    64
apply (simp_all add: succ_Un_distrib [symmetric])
paulson@13306
    65
done
paulson@13306
    66
paulson@13306
    67
subsubsection{*Separation for Cartesian Product*}
paulson@13306
    68
paulson@13306
    69
lemma cartprod_Reflects [simplified]:
paulson@13306
    70
     "L_Reflects(?Cl, \<lambda>z. \<exists>x[L]. x\<in>A & (\<exists>y[L]. y\<in>B & pair(L,x,y,z)),
paulson@13306
    71
                \<lambda>i z. \<exists>x\<in>Lset(i). x\<in>A & (\<exists>y\<in>Lset(i). y\<in>B & 
paulson@13306
    72
                               pair(**Lset(i),x,y,z)))"
paulson@13306
    73
by fast
paulson@13306
    74
paulson@13306
    75
lemma cartprod_separation:
paulson@13306
    76
     "[| L(A); L(B) |] 
paulson@13306
    77
      ==> separation(L, \<lambda>z. \<exists>x[L]. x\<in>A & (\<exists>y[L]. y\<in>B & pair(L,x,y,z)))"
paulson@13306
    78
apply (rule separation_CollectI) 
paulson@13306
    79
apply (rule_tac A="{A,B,z}" in subset_LsetE, blast ) 
paulson@13306
    80
apply (rule ReflectsE [OF cartprod_Reflects], assumption)
paulson@13306
    81
apply (drule subset_Lset_ltD, assumption) 
paulson@13306
    82
apply (erule reflection_imp_L_separation)
paulson@13306
    83
  apply (simp_all add: lt_Ord2, clarify) 
paulson@13306
    84
apply (rule DPowI2)
paulson@13306
    85
apply (rename_tac u)  
paulson@13306
    86
apply (rule bex_iff_sats) 
paulson@13306
    87
apply (rule conj_iff_sats)
paulson@13306
    88
apply (rule_tac i=0 and j=2 and env="[x,u,A,B]" in mem_iff_sats, simp_all)
paulson@13306
    89
apply (rule bex_iff_sats) 
paulson@13306
    90
apply (rule conj_iff_sats)
paulson@13306
    91
apply (rule mem_iff_sats)
paulson@13306
    92
apply (blast intro: nth_0 nth_ConsI) 
paulson@13306
    93
apply (blast intro: nth_0 nth_ConsI, simp_all)
paulson@13306
    94
apply (rule_tac i=1 and j=0 and k=2 in pair_iff_sats)
paulson@13306
    95
apply (simp_all add: succ_Un_distrib [symmetric])
paulson@13306
    96
done
paulson@13306
    97
paulson@13306
    98
subsubsection{*Separation for Image*}
paulson@13306
    99
paulson@13306
   100
text{*No @{text simplified} here: it simplifies the occurrence of 
paulson@13306
   101
      the predicate @{term pair}!*}
paulson@13306
   102
lemma image_Reflects:
paulson@13306
   103
     "L_Reflects(?Cl, \<lambda>y. \<exists>p[L]. p\<in>r & (\<exists>x[L]. x\<in>A & pair(L,x,y,p)),
paulson@13306
   104
           \<lambda>i y. \<exists>p\<in>Lset(i). p\<in>r & (\<exists>x\<in>Lset(i). x\<in>A & pair(**Lset(i),x,y,p)))"
paulson@13306
   105
by fast
paulson@13306
   106
paulson@13306
   107
paulson@13306
   108
lemma image_separation:
paulson@13306
   109
     "[| L(A); L(r) |] 
paulson@13306
   110
      ==> separation(L, \<lambda>y. \<exists>p[L]. p\<in>r & (\<exists>x[L]. x\<in>A & pair(L,x,y,p)))"
paulson@13306
   111
apply (rule separation_CollectI) 
paulson@13306
   112
apply (rule_tac A="{A,r,z}" in subset_LsetE, blast ) 
paulson@13306
   113
apply (rule ReflectsE [OF image_Reflects], assumption)
paulson@13306
   114
apply (drule subset_Lset_ltD, assumption) 
paulson@13306
   115
apply (erule reflection_imp_L_separation)
paulson@13306
   116
  apply (simp_all add: lt_Ord2, clarify)
paulson@13306
   117
apply (rule DPowI2)
paulson@13306
   118
apply (rule bex_iff_sats) 
paulson@13306
   119
apply (rule conj_iff_sats)
paulson@13306
   120
apply (rule_tac env="[p,y,A,r]" in mem_iff_sats)
paulson@13306
   121
apply (blast intro: nth_0 nth_ConsI) 
paulson@13306
   122
apply (blast intro: nth_0 nth_ConsI, simp_all)
paulson@13306
   123
apply (rule bex_iff_sats) 
paulson@13306
   124
apply (rule conj_iff_sats)
paulson@13306
   125
apply (rule mem_iff_sats)
paulson@13306
   126
apply (blast intro: nth_0 nth_ConsI) 
paulson@13306
   127
apply (blast intro: nth_0 nth_ConsI, simp_all)
paulson@13306
   128
apply (rule pair_iff_sats)
paulson@13306
   129
apply (blast intro: nth_0 nth_ConsI) 
paulson@13306
   130
apply (blast intro: nth_0 nth_ConsI) 
paulson@13306
   131
apply (blast intro: nth_0 nth_ConsI)
paulson@13306
   132
apply (simp_all add: succ_Un_distrib [symmetric])
paulson@13306
   133
done
paulson@13306
   134
paulson@13306
   135
paulson@13306
   136
subsubsection{*Separation for Converse*}
paulson@13306
   137
paulson@13306
   138
lemma converse_Reflects:
paulson@13306
   139
     "L_Reflects(?Cl, 
paulson@13306
   140
        \<lambda>z. \<exists>p[L]. p\<in>r & (\<exists>x[L]. \<exists>y[L]. pair(L,x,y,p) & pair(L,y,x,z)),
paulson@13306
   141
     \<lambda>i z. \<exists>p\<in>Lset(i). p\<in>r & (\<exists>x\<in>Lset(i). \<exists>y\<in>Lset(i). 
paulson@13306
   142
                     pair(**Lset(i),x,y,p) & pair(**Lset(i),y,x,z)))"
paulson@13306
   143
by fast
paulson@13306
   144
paulson@13306
   145
lemma converse_separation:
paulson@13306
   146
     "L(r) ==> separation(L, 
paulson@13306
   147
         \<lambda>z. \<exists>p[L]. p\<in>r & (\<exists>x[L]. \<exists>y[L]. pair(L,x,y,p) & pair(L,y,x,z)))"
paulson@13306
   148
apply (rule separation_CollectI) 
paulson@13306
   149
apply (rule_tac A="{r,z}" in subset_LsetE, blast ) 
paulson@13306
   150
apply (rule ReflectsE [OF converse_Reflects], assumption)
paulson@13306
   151
apply (drule subset_Lset_ltD, assumption) 
paulson@13306
   152
apply (erule reflection_imp_L_separation)
paulson@13306
   153
  apply (simp_all add: lt_Ord2, clarify)
paulson@13306
   154
apply (rule DPowI2)
paulson@13306
   155
apply (rename_tac u) 
paulson@13306
   156
apply (rule bex_iff_sats) 
paulson@13306
   157
apply (rule conj_iff_sats)
paulson@13306
   158
apply (rule_tac i=0 and j="2" and env="[p,u,r]" in mem_iff_sats, simp_all)
paulson@13306
   159
apply (rule bex_iff_sats) 
paulson@13306
   160
apply (rule bex_iff_sats) 
paulson@13306
   161
apply (rule conj_iff_sats)
paulson@13306
   162
apply (rule_tac i=1 and j=0 and k=2 in pair_iff_sats, simp_all)
paulson@13306
   163
apply (rule pair_iff_sats)
paulson@13306
   164
apply (blast intro: nth_0 nth_ConsI) 
paulson@13306
   165
apply (blast intro: nth_0 nth_ConsI) 
paulson@13306
   166
apply (blast intro: nth_0 nth_ConsI)
paulson@13306
   167
apply (simp_all add: succ_Un_distrib [symmetric])
paulson@13306
   168
done
paulson@13306
   169
paulson@13306
   170
paulson@13306
   171
subsubsection{*Separation for Restriction*}
paulson@13306
   172
paulson@13306
   173
lemma restrict_Reflects:
paulson@13306
   174
     "L_Reflects(?Cl, \<lambda>z. \<exists>x[L]. x\<in>A & (\<exists>y[L]. pair(L,x,y,z)),
paulson@13306
   175
        \<lambda>i z. \<exists>x\<in>Lset(i). x\<in>A & (\<exists>y\<in>Lset(i). pair(**Lset(i),x,y,z)))"
paulson@13306
   176
by fast
paulson@13306
   177
paulson@13306
   178
lemma restrict_separation:
paulson@13306
   179
   "L(A) ==> separation(L, \<lambda>z. \<exists>x[L]. x\<in>A & (\<exists>y[L]. pair(L,x,y,z)))"
paulson@13306
   180
apply (rule separation_CollectI) 
paulson@13306
   181
apply (rule_tac A="{A,z}" in subset_LsetE, blast ) 
paulson@13306
   182
apply (rule ReflectsE [OF restrict_Reflects], assumption)
paulson@13306
   183
apply (drule subset_Lset_ltD, assumption) 
paulson@13306
   184
apply (erule reflection_imp_L_separation)
paulson@13306
   185
  apply (simp_all add: lt_Ord2, clarify)
paulson@13306
   186
apply (rule DPowI2)
paulson@13306
   187
apply (rename_tac u) 
paulson@13306
   188
apply (rule bex_iff_sats) 
paulson@13306
   189
apply (rule conj_iff_sats)
paulson@13306
   190
apply (rule_tac i=0 and j="2" and env="[x,u,A]" in mem_iff_sats, simp_all)
paulson@13306
   191
apply (rule bex_iff_sats) 
paulson@13306
   192
apply (rule_tac i=1 and j=0 and k=2 in pair_iff_sats)
paulson@13306
   193
apply (simp_all add: succ_Un_distrib [symmetric])
paulson@13306
   194
done
paulson@13306
   195
paulson@13306
   196
paulson@13306
   197
subsubsection{*Separation for Composition*}
paulson@13306
   198
paulson@13306
   199
lemma comp_Reflects:
paulson@13306
   200
     "L_Reflects(?Cl, \<lambda>xz. \<exists>x[L]. \<exists>y[L]. \<exists>z[L]. \<exists>xy[L]. \<exists>yz[L]. 
paulson@13306
   201
		  pair(L,x,z,xz) & pair(L,x,y,xy) & pair(L,y,z,yz) & 
paulson@13306
   202
                  xy\<in>s & yz\<in>r,
paulson@13306
   203
        \<lambda>i xz. \<exists>x\<in>Lset(i). \<exists>y\<in>Lset(i). \<exists>z\<in>Lset(i). \<exists>xy\<in>Lset(i). \<exists>yz\<in>Lset(i). 
paulson@13306
   204
		  pair(**Lset(i),x,z,xz) & pair(**Lset(i),x,y,xy) & 
paulson@13306
   205
                  pair(**Lset(i),y,z,yz) & xy\<in>s & yz\<in>r)"
paulson@13306
   206
by fast
paulson@13306
   207
paulson@13306
   208
lemma comp_separation:
paulson@13306
   209
     "[| L(r); L(s) |]
paulson@13306
   210
      ==> separation(L, \<lambda>xz. \<exists>x[L]. \<exists>y[L]. \<exists>z[L]. \<exists>xy[L]. \<exists>yz[L]. 
paulson@13306
   211
		  pair(L,x,z,xz) & pair(L,x,y,xy) & pair(L,y,z,yz) & 
paulson@13306
   212
                  xy\<in>s & yz\<in>r)"
paulson@13306
   213
apply (rule separation_CollectI) 
paulson@13306
   214
apply (rule_tac A="{r,s,z}" in subset_LsetE, blast ) 
paulson@13306
   215
apply (rule ReflectsE [OF comp_Reflects], assumption)
paulson@13306
   216
apply (drule subset_Lset_ltD, assumption) 
paulson@13306
   217
apply (erule reflection_imp_L_separation)
paulson@13306
   218
  apply (simp_all add: lt_Ord2, clarify)
paulson@13306
   219
apply (rule DPowI2)
paulson@13306
   220
apply (rename_tac u) 
paulson@13306
   221
apply (rule bex_iff_sats)+
paulson@13306
   222
apply (rename_tac x y z)  
paulson@13306
   223
apply (rule conj_iff_sats)
paulson@13306
   224
apply (rule_tac env="[z,y,x,u,r,s]" in pair_iff_sats)
paulson@13306
   225
apply (blast intro: nth_0 nth_ConsI) 
paulson@13306
   226
apply (blast intro: nth_0 nth_ConsI) 
paulson@13306
   227
apply (blast intro: nth_0 nth_ConsI, simp_all)
paulson@13306
   228
apply (rule bex_iff_sats) 
paulson@13306
   229
apply (rule conj_iff_sats)
paulson@13306
   230
apply (rule pair_iff_sats)
paulson@13306
   231
apply (blast intro: nth_0 nth_ConsI) 
paulson@13306
   232
apply (blast intro: nth_0 nth_ConsI) 
paulson@13306
   233
apply (blast intro: nth_0 nth_ConsI, simp_all)
paulson@13306
   234
apply (rule bex_iff_sats) 
paulson@13306
   235
apply (rule conj_iff_sats)
paulson@13306
   236
apply (rule pair_iff_sats)
paulson@13306
   237
apply (blast intro: nth_0 nth_ConsI) 
paulson@13306
   238
apply (blast intro: nth_0 nth_ConsI) 
paulson@13306
   239
apply (blast intro: nth_0 nth_ConsI, simp_all) 
paulson@13306
   240
apply (rule conj_iff_sats)
paulson@13306
   241
apply (rule mem_iff_sats) 
paulson@13306
   242
apply (blast intro: nth_0 nth_ConsI) 
paulson@13306
   243
apply (blast intro: nth_0 nth_ConsI, simp) 
paulson@13306
   244
apply (rule mem_iff_sats) 
paulson@13306
   245
apply (blast intro: nth_0 nth_ConsI) 
paulson@13306
   246
apply (blast intro: nth_0 nth_ConsI)
paulson@13306
   247
apply (simp_all add: succ_Un_distrib [symmetric])
paulson@13306
   248
done
paulson@13306
   249
paulson@13306
   250
subsubsection{*Separation for Predecessors in an Order*}
paulson@13306
   251
paulson@13306
   252
lemma pred_Reflects:
paulson@13306
   253
     "L_Reflects(?Cl, \<lambda>y. \<exists>p[L]. p\<in>r & pair(L,y,x,p),
paulson@13306
   254
                    \<lambda>i y. \<exists>p \<in> Lset(i). p\<in>r & pair(**Lset(i),y,x,p))"
paulson@13306
   255
by fast
paulson@13306
   256
paulson@13306
   257
lemma pred_separation:
paulson@13306
   258
     "[| L(r); L(x) |] ==> separation(L, \<lambda>y. \<exists>p[L]. p\<in>r & pair(L,y,x,p))"
paulson@13306
   259
apply (rule separation_CollectI) 
paulson@13306
   260
apply (rule_tac A="{r,x,z}" in subset_LsetE, blast ) 
paulson@13306
   261
apply (rule ReflectsE [OF pred_Reflects], assumption)
paulson@13306
   262
apply (drule subset_Lset_ltD, assumption) 
paulson@13306
   263
apply (erule reflection_imp_L_separation)
paulson@13306
   264
  apply (simp_all add: lt_Ord2, clarify)
paulson@13306
   265
apply (rule DPowI2)
paulson@13306
   266
apply (rename_tac u) 
paulson@13306
   267
apply (rule bex_iff_sats)
paulson@13306
   268
apply (rule conj_iff_sats)
paulson@13306
   269
apply (rule_tac env = "[p,u,r,x]" in mem_iff_sats) 
paulson@13306
   270
apply (blast intro: nth_0 nth_ConsI) 
paulson@13306
   271
apply (blast intro: nth_0 nth_ConsI, simp) 
paulson@13306
   272
apply (rule pair_iff_sats)
paulson@13306
   273
apply (blast intro: nth_0 nth_ConsI) 
paulson@13306
   274
apply (blast intro: nth_0 nth_ConsI) 
paulson@13306
   275
apply (blast intro: nth_0 nth_ConsI, simp_all)
paulson@13306
   276
apply (simp_all add: succ_Un_distrib [symmetric])
paulson@13306
   277
done
paulson@13306
   278
paulson@13306
   279
paulson@13306
   280
subsubsection{*Separation for the Membership Relation*}
paulson@13306
   281
paulson@13306
   282
lemma Memrel_Reflects:
paulson@13306
   283
     "L_Reflects(?Cl, \<lambda>z. \<exists>x[L]. \<exists>y[L]. pair(L,x,y,z) & x \<in> y,
paulson@13306
   284
            \<lambda>i z. \<exists>x \<in> Lset(i). \<exists>y \<in> Lset(i). pair(**Lset(i),x,y,z) & x \<in> y)"
paulson@13306
   285
by fast
paulson@13306
   286
paulson@13306
   287
lemma Memrel_separation:
paulson@13306
   288
     "separation(L, \<lambda>z. \<exists>x[L]. \<exists>y[L]. pair(L,x,y,z) & x \<in> y)"
paulson@13306
   289
apply (rule separation_CollectI) 
paulson@13306
   290
apply (rule_tac A="{z}" in subset_LsetE, blast ) 
paulson@13306
   291
apply (rule ReflectsE [OF Memrel_Reflects], assumption)
paulson@13306
   292
apply (drule subset_Lset_ltD, assumption) 
paulson@13306
   293
apply (erule reflection_imp_L_separation)
paulson@13306
   294
  apply (simp_all add: lt_Ord2)
paulson@13306
   295
apply (rule DPowI2)
paulson@13306
   296
apply (rename_tac u) 
paulson@13306
   297
apply (rule bex_iff_sats)+
paulson@13306
   298
apply (rule conj_iff_sats)
paulson@13306
   299
apply (rule_tac env = "[y,x,u]" in pair_iff_sats) 
paulson@13306
   300
apply (blast intro: nth_0 nth_ConsI) 
paulson@13306
   301
apply (blast intro: nth_0 nth_ConsI) 
paulson@13306
   302
apply (blast intro: nth_0 nth_ConsI, simp_all) 
paulson@13306
   303
apply (rule mem_iff_sats)
paulson@13306
   304
apply (blast intro: nth_0 nth_ConsI) 
paulson@13306
   305
apply (blast intro: nth_0 nth_ConsI)
paulson@13306
   306
apply (simp_all add: succ_Un_distrib [symmetric])
paulson@13306
   307
done
paulson@13306
   308
paulson@13306
   309
paulson@13306
   310
subsubsection{*Replacement for FunSpace*}
paulson@13306
   311
		
paulson@13306
   312
lemma funspace_succ_Reflects:
paulson@13306
   313
 "L_Reflects(?Cl, \<lambda>z. \<exists>p[L]. p\<in>A & (\<exists>f[L]. \<exists>b[L]. \<exists>nb[L]. \<exists>cnbf[L]. 
paulson@13306
   314
	    pair(L,f,b,p) & pair(L,n,b,nb) & is_cons(L,nb,f,cnbf) &
paulson@13306
   315
	    upair(L,cnbf,cnbf,z)),
paulson@13306
   316
	\<lambda>i z. \<exists>p \<in> Lset(i). p\<in>A & (\<exists>f \<in> Lset(i). \<exists>b \<in> Lset(i). 
paulson@13306
   317
	      \<exists>nb \<in> Lset(i). \<exists>cnbf \<in> Lset(i). 
paulson@13306
   318
		pair(**Lset(i),f,b,p) & pair(**Lset(i),n,b,nb) & 
paulson@13306
   319
		is_cons(**Lset(i),nb,f,cnbf) & upair(**Lset(i),cnbf,cnbf,z)))"
paulson@13306
   320
by fast
paulson@13306
   321
paulson@13306
   322
lemma funspace_succ_replacement:
paulson@13306
   323
     "L(n) ==> 
paulson@13306
   324
      strong_replacement(L, \<lambda>p z. \<exists>f[L]. \<exists>b[L]. \<exists>nb[L]. \<exists>cnbf[L]. 
paulson@13306
   325
                pair(L,f,b,p) & pair(L,n,b,nb) & is_cons(L,nb,f,cnbf) &
paulson@13306
   326
                upair(L,cnbf,cnbf,z))"
paulson@13306
   327
apply (rule strong_replacementI) 
paulson@13306
   328
apply (rule rallI) 
paulson@13306
   329
apply (rule separation_CollectI) 
paulson@13306
   330
apply (rule_tac A="{n,A,z}" in subset_LsetE, blast ) 
paulson@13306
   331
apply (rule ReflectsE [OF funspace_succ_Reflects], assumption)
paulson@13306
   332
apply (drule subset_Lset_ltD, assumption) 
paulson@13306
   333
apply (erule reflection_imp_L_separation)
paulson@13306
   334
  apply (simp_all add: lt_Ord2)
paulson@13306
   335
apply (rule DPowI2)
paulson@13306
   336
apply (rename_tac u) 
paulson@13306
   337
apply (rule bex_iff_sats)
paulson@13306
   338
apply (rule conj_iff_sats)
paulson@13306
   339
apply (rule_tac env = "[x,u,n,A]" in mem_iff_sats) 
paulson@13306
   340
apply (blast intro: nth_0 nth_ConsI) 
paulson@13306
   341
apply (blast intro: nth_0 nth_ConsI, simp_all) 
paulson@13306
   342
apply (rule conj_iff_sats bex_iff_sats)+
paulson@13306
   343
apply (rule pair_iff_sats) 
paulson@13306
   344
apply (blast intro: nth_0 nth_ConsI) 
paulson@13306
   345
apply (blast intro: nth_0 nth_ConsI) 
paulson@13306
   346
apply (blast intro: nth_0 nth_ConsI, simp_all) 
paulson@13306
   347
apply (rule bex_iff_sats)
paulson@13306
   348
apply (rule conj_iff_sats)
paulson@13306
   349
apply (rule pair_iff_sats) 
paulson@13306
   350
apply (blast intro: nth_0 nth_ConsI) 
paulson@13306
   351
apply (blast intro: nth_0 nth_ConsI) 
paulson@13306
   352
apply (blast intro: nth_0 nth_ConsI, simp_all) 
paulson@13306
   353
apply (rule bex_iff_sats)
paulson@13306
   354
apply (rule conj_iff_sats)
paulson@13306
   355
apply (rule cons_iff_sats) 
paulson@13306
   356
apply (blast intro!: nth_0 nth_ConsI) 
paulson@13306
   357
apply (blast intro!: nth_0 nth_ConsI) 
paulson@13306
   358
apply (blast intro!: nth_0 nth_ConsI, simp_all)
paulson@13306
   359
apply (rule upair_iff_sats) 
paulson@13306
   360
apply (blast intro: nth_0 nth_ConsI) 
paulson@13306
   361
apply (blast intro: nth_0 nth_ConsI) 
paulson@13306
   362
apply (blast intro: nth_0 nth_ConsI) 
paulson@13306
   363
apply (simp_all add: succ_Un_distrib [symmetric])
paulson@13306
   364
done
paulson@13306
   365
paulson@13306
   366
paulson@13306
   367
subsubsection{*Separation for Order-Isomorphisms*}
paulson@13306
   368
paulson@13306
   369
lemma well_ord_iso_Reflects:
paulson@13306
   370
     "L_Reflects(?Cl, \<lambda>x. x\<in>A --> (\<exists>y[L]. \<exists>p[L]. 
paulson@13306
   371
		     fun_apply(L,f,x,y) & pair(L,y,x,p) & p \<in> r),
paulson@13306
   372
            \<lambda>i x. x\<in>A --> (\<exists>y \<in> Lset(i). \<exists>p \<in> Lset(i). 
paulson@13306
   373
		     fun_apply(**Lset(i),f,x,y) & pair(**Lset(i),y,x,p) & p \<in> r))"
paulson@13306
   374
by fast
paulson@13306
   375
paulson@13306
   376
lemma well_ord_iso_separation:
paulson@13306
   377
     "[| L(A); L(f); L(r) |] 
paulson@13306
   378
      ==> separation (L, \<lambda>x. x\<in>A --> (\<exists>y[L]. (\<exists>p[L]. 
paulson@13306
   379
		     fun_apply(L,f,x,y) & pair(L,y,x,p) & p \<in> r)))"
paulson@13306
   380
apply (rule separation_CollectI) 
paulson@13306
   381
apply (rule_tac A="{A,f,r,z}" in subset_LsetE, blast ) 
paulson@13306
   382
apply (rule ReflectsE [OF well_ord_iso_Reflects], assumption)
paulson@13306
   383
apply (drule subset_Lset_ltD, assumption) 
paulson@13306
   384
apply (erule reflection_imp_L_separation)
paulson@13306
   385
  apply (simp_all add: lt_Ord2)
paulson@13306
   386
apply (rule DPowI2)
paulson@13306
   387
apply (rename_tac u) 
paulson@13306
   388
apply (rule imp_iff_sats)
paulson@13306
   389
apply (rule_tac env = "[u,A,f,r]" in mem_iff_sats) 
paulson@13306
   390
apply (blast intro: nth_0 nth_ConsI) 
paulson@13306
   391
apply (blast intro: nth_0 nth_ConsI, simp_all) 
paulson@13306
   392
apply (rule bex_iff_sats)
paulson@13306
   393
apply (rule conj_iff_sats)
paulson@13306
   394
apply (rule fun_apply_iff_sats) 
paulson@13306
   395
apply (blast intro: nth_0 nth_ConsI) 
paulson@13306
   396
apply (blast intro: nth_0 nth_ConsI) 
paulson@13306
   397
apply (blast intro: nth_0 nth_ConsI, simp_all) 
paulson@13306
   398
apply (rule bex_iff_sats)
paulson@13306
   399
apply (rule conj_iff_sats)
paulson@13306
   400
apply (rule pair_iff_sats) 
paulson@13306
   401
apply (blast intro: nth_0 nth_ConsI) 
paulson@13306
   402
apply (blast intro: nth_0 nth_ConsI) 
paulson@13306
   403
apply (blast intro: nth_0 nth_ConsI, simp_all) 
paulson@13306
   404
apply (rule mem_iff_sats)
paulson@13306
   405
apply (blast intro: nth_0 nth_ConsI) 
paulson@13306
   406
apply (blast intro: nth_0 nth_ConsI)
paulson@13306
   407
apply (simp_all add: succ_Un_distrib [symmetric])
paulson@13306
   408
done
paulson@13306
   409
paulson@13306
   410
end