src/ZF/Constructible/Satisfies_absolute.thy
changeset 13807 a28a8fbc76d4
parent 13702 c7cf8fa66534
child 16417 9bc16273c2d4
equal deleted inserted replaced
13806:fd40c9d9076b 13807:a28a8fbc76d4
    30 by (simp add: depth_fm_def)
    30 by (simp add: depth_fm_def)
    31 
    31 
    32 lemma sats_depth_fm [simp]:
    32 lemma sats_depth_fm [simp]:
    33    "[| x \<in> nat; y < length(env); env \<in> list(A)|]
    33    "[| x \<in> nat; y < length(env); env \<in> list(A)|]
    34     ==> sats(A, depth_fm(x,y), env) <->
    34     ==> sats(A, depth_fm(x,y), env) <->
    35         is_depth(**A, nth(x,env), nth(y,env))"
    35         is_depth(##A, nth(x,env), nth(y,env))"
    36 apply (frule_tac x=y in lt_length_in_nat, assumption)  
    36 apply (frule_tac x=y in lt_length_in_nat, assumption)  
    37 apply (simp add: depth_fm_def is_depth_def) 
    37 apply (simp add: depth_fm_def is_depth_def) 
    38 done
    38 done
    39 
    39 
    40 lemma depth_iff_sats:
    40 lemma depth_iff_sats:
    41       "[| nth(i,env) = x; nth(j,env) = y; 
    41       "[| nth(i,env) = x; nth(j,env) = y; 
    42           i \<in> nat; j < length(env); env \<in> list(A)|]
    42           i \<in> nat; j < length(env); env \<in> list(A)|]
    43        ==> is_depth(**A, x, y) <-> sats(A, depth_fm(i,j), env)"
    43        ==> is_depth(##A, x, y) <-> sats(A, depth_fm(i,j), env)"
    44 by (simp add: sats_depth_fm)
    44 by (simp add: sats_depth_fm)
    45 
    45 
    46 theorem depth_reflection:
    46 theorem depth_reflection:
    47      "REFLECTS[\<lambda>x. is_depth(L, f(x), g(x)),  
    47      "REFLECTS[\<lambda>x. is_depth(L, f(x), g(x)),  
    48                \<lambda>i x. is_depth(**Lset(i), f(x), g(x))]"
    48                \<lambda>i x. is_depth(##Lset(i), f(x), g(x))]"
    49 apply (simp only: is_depth_def)
    49 apply (simp only: is_depth_def)
    50 apply (intro FOL_reflections function_reflections formula_N_reflection) 
    50 apply (intro FOL_reflections function_reflections formula_N_reflection) 
    51 done
    51 done
    52 
    52 
    53 
    53 
   109         [|a0\<in>A; a1\<in>A|]  
   109         [|a0\<in>A; a1\<in>A|]  
   110         ==> ISD(a1, a0) <-> sats(A, is_d, Cons(a0,Cons(a1,env)))"
   110         ==> ISD(a1, a0) <-> sats(A, is_d, Cons(a0,Cons(a1,env)))"
   111   shows 
   111   shows 
   112       "[|x \<in> nat; y < length(env); env \<in> list(A)|]
   112       "[|x \<in> nat; y < length(env); env \<in> list(A)|]
   113        ==> sats(A, formula_case_fm(is_a,is_b,is_c,is_d,x,y), env) <->
   113        ==> sats(A, formula_case_fm(is_a,is_b,is_c,is_d,x,y), env) <->
   114            is_formula_case(**A, ISA, ISB, ISC, ISD, nth(x,env), nth(y,env))"
   114            is_formula_case(##A, ISA, ISB, ISC, ISD, nth(x,env), nth(y,env))"
   115 apply (frule_tac x=y in lt_length_in_nat, assumption)  
   115 apply (frule_tac x=y in lt_length_in_nat, assumption)  
   116 apply (simp add: formula_case_fm_def is_formula_case_def 
   116 apply (simp add: formula_case_fm_def is_formula_case_def 
   117                  is_a_iff_sats [THEN iff_sym] is_b_iff_sats [THEN iff_sym]
   117                  is_a_iff_sats [THEN iff_sym] is_b_iff_sats [THEN iff_sym]
   118                  is_c_iff_sats [THEN iff_sym] is_d_iff_sats [THEN iff_sym])
   118                  is_c_iff_sats [THEN iff_sym] is_d_iff_sats [THEN iff_sym])
   119 done
   119 done
   136         [|a0\<in>A; a1\<in>A|]  
   136         [|a0\<in>A; a1\<in>A|]  
   137         ==> ISD(a1, a0) <-> sats(A, is_d, Cons(a0,Cons(a1,env)))"
   137         ==> ISD(a1, a0) <-> sats(A, is_d, Cons(a0,Cons(a1,env)))"
   138   shows 
   138   shows 
   139       "[|nth(i,env) = x; nth(j,env) = y; 
   139       "[|nth(i,env) = x; nth(j,env) = y; 
   140       i \<in> nat; j < length(env); env \<in> list(A)|]
   140       i \<in> nat; j < length(env); env \<in> list(A)|]
   141        ==> is_formula_case(**A, ISA, ISB, ISC, ISD, x, y) <->
   141        ==> is_formula_case(##A, ISA, ISB, ISC, ISD, x, y) <->
   142            sats(A, formula_case_fm(is_a,is_b,is_c,is_d,i,j), env)"
   142            sats(A, formula_case_fm(is_a,is_b,is_c,is_d,i,j), env)"
   143 by (simp add: sats_formula_case_fm [OF is_a_iff_sats is_b_iff_sats 
   143 by (simp add: sats_formula_case_fm [OF is_a_iff_sats is_b_iff_sats 
   144                                        is_c_iff_sats is_d_iff_sats])
   144                                        is_c_iff_sats is_d_iff_sats])
   145 
   145 
   146 
   146 
   148   which is essential for handling free variable references.  Treatment is
   148   which is essential for handling free variable references.  Treatment is
   149   based on that of @{text is_nat_case_reflection}.*}
   149   based on that of @{text is_nat_case_reflection}.*}
   150 theorem is_formula_case_reflection:
   150 theorem is_formula_case_reflection:
   151   assumes is_a_reflection:
   151   assumes is_a_reflection:
   152     "!!h f g g'. REFLECTS[\<lambda>x. is_a(L, h(x), f(x), g(x), g'(x)),
   152     "!!h f g g'. REFLECTS[\<lambda>x. is_a(L, h(x), f(x), g(x), g'(x)),
   153                      \<lambda>i x. is_a(**Lset(i), h(x), f(x), g(x), g'(x))]"
   153                      \<lambda>i x. is_a(##Lset(i), h(x), f(x), g(x), g'(x))]"
   154   and is_b_reflection:
   154   and is_b_reflection:
   155     "!!h f g g'. REFLECTS[\<lambda>x. is_b(L, h(x), f(x), g(x), g'(x)),
   155     "!!h f g g'. REFLECTS[\<lambda>x. is_b(L, h(x), f(x), g(x), g'(x)),
   156                      \<lambda>i x. is_b(**Lset(i), h(x), f(x), g(x), g'(x))]"
   156                      \<lambda>i x. is_b(##Lset(i), h(x), f(x), g(x), g'(x))]"
   157   and is_c_reflection:
   157   and is_c_reflection:
   158     "!!h f g g'. REFLECTS[\<lambda>x. is_c(L, h(x), f(x), g(x), g'(x)),
   158     "!!h f g g'. REFLECTS[\<lambda>x. is_c(L, h(x), f(x), g(x), g'(x)),
   159                      \<lambda>i x. is_c(**Lset(i), h(x), f(x), g(x), g'(x))]"
   159                      \<lambda>i x. is_c(##Lset(i), h(x), f(x), g(x), g'(x))]"
   160   and is_d_reflection:
   160   and is_d_reflection:
   161     "!!h f g g'. REFLECTS[\<lambda>x. is_d(L, h(x), f(x), g(x)),
   161     "!!h f g g'. REFLECTS[\<lambda>x. is_d(L, h(x), f(x), g(x)),
   162                      \<lambda>i x. is_d(**Lset(i), h(x), f(x), g(x))]"
   162                      \<lambda>i x. is_d(##Lset(i), h(x), f(x), g(x))]"
   163   shows "REFLECTS[\<lambda>x. is_formula_case(L, is_a(L,x), is_b(L,x), is_c(L,x), is_d(L,x), g(x), h(x)),
   163   shows "REFLECTS[\<lambda>x. is_formula_case(L, is_a(L,x), is_b(L,x), is_c(L,x), is_d(L,x), g(x), h(x)),
   164                \<lambda>i x. is_formula_case(**Lset(i), is_a(**Lset(i), x), is_b(**Lset(i), x), is_c(**Lset(i), x), is_d(**Lset(i), x), g(x), h(x))]"
   164                \<lambda>i x. is_formula_case(##Lset(i), is_a(##Lset(i), x), is_b(##Lset(i), x), is_c(##Lset(i), x), is_d(##Lset(i), x), g(x), h(x))]"
   165 apply (simp (no_asm_use) only: is_formula_case_def)
   165 apply (simp (no_asm_use) only: is_formula_case_def)
   166 apply (intro FOL_reflections function_reflections finite_ordinal_reflection
   166 apply (intro FOL_reflections function_reflections finite_ordinal_reflection
   167          mem_formula_reflection
   167          mem_formula_reflection
   168          Member_reflection Equal_reflection Nand_reflection Forall_reflection
   168          Member_reflection Equal_reflection Nand_reflection Forall_reflection
   169          is_a_reflection is_b_reflection is_c_reflection is_d_reflection)
   169          is_a_reflection is_b_reflection is_c_reflection is_d_reflection)
   516 by (simp add: depth_apply_fm_def)
   516 by (simp add: depth_apply_fm_def)
   517 
   517 
   518 lemma sats_depth_apply_fm [simp]:
   518 lemma sats_depth_apply_fm [simp]:
   519    "[| x \<in> nat; y \<in> nat; z \<in> nat; env \<in> list(A)|]
   519    "[| x \<in> nat; y \<in> nat; z \<in> nat; env \<in> list(A)|]
   520     ==> sats(A, depth_apply_fm(x,y,z), env) <->
   520     ==> sats(A, depth_apply_fm(x,y,z), env) <->
   521         is_depth_apply(**A, nth(x,env), nth(y,env), nth(z,env))"
   521         is_depth_apply(##A, nth(x,env), nth(y,env), nth(z,env))"
   522 by (simp add: depth_apply_fm_def is_depth_apply_def)
   522 by (simp add: depth_apply_fm_def is_depth_apply_def)
   523 
   523 
   524 lemma depth_apply_iff_sats:
   524 lemma depth_apply_iff_sats:
   525     "[| nth(i,env) = x; nth(j,env) = y; nth(k,env) = z;
   525     "[| nth(i,env) = x; nth(j,env) = y; nth(k,env) = z;
   526         i \<in> nat; j \<in> nat; k \<in> nat; env \<in> list(A)|]
   526         i \<in> nat; j \<in> nat; k \<in> nat; env \<in> list(A)|]
   527      ==> is_depth_apply(**A, x, y, z) <-> sats(A, depth_apply_fm(i,j,k), env)"
   527      ==> is_depth_apply(##A, x, y, z) <-> sats(A, depth_apply_fm(i,j,k), env)"
   528 by simp
   528 by simp
   529 
   529 
   530 lemma depth_apply_reflection:
   530 lemma depth_apply_reflection:
   531      "REFLECTS[\<lambda>x. is_depth_apply(L,f(x),g(x),h(x)),
   531      "REFLECTS[\<lambda>x. is_depth_apply(L,f(x),g(x),h(x)),
   532                \<lambda>i x. is_depth_apply(**Lset(i),f(x),g(x),h(x))]"
   532                \<lambda>i x. is_depth_apply(##Lset(i),f(x),g(x),h(x))]"
   533 apply (simp only: is_depth_apply_def)
   533 apply (simp only: is_depth_apply_def)
   534 apply (intro FOL_reflections function_reflections depth_reflection 
   534 apply (intro FOL_reflections function_reflections depth_reflection 
   535              finite_ordinal_reflection)
   535              finite_ordinal_reflection)
   536 done
   536 done
   537 
   537 
   563 by (simp add: satisfies_is_a_fm_def)
   563 by (simp add: satisfies_is_a_fm_def)
   564 
   564 
   565 lemma sats_satisfies_is_a_fm [simp]:
   565 lemma sats_satisfies_is_a_fm [simp]:
   566    "[| u \<in> nat; x < length(env); y < length(env); z \<in> nat; env \<in> list(A)|]
   566    "[| u \<in> nat; x < length(env); y < length(env); z \<in> nat; env \<in> list(A)|]
   567     ==> sats(A, satisfies_is_a_fm(u,x,y,z), env) <->
   567     ==> sats(A, satisfies_is_a_fm(u,x,y,z), env) <->
   568         satisfies_is_a(**A, nth(u,env), nth(x,env), nth(y,env), nth(z,env))"
   568         satisfies_is_a(##A, nth(u,env), nth(x,env), nth(y,env), nth(z,env))"
   569 apply (frule_tac x=x in lt_length_in_nat, assumption)  
   569 apply (frule_tac x=x in lt_length_in_nat, assumption)  
   570 apply (frule_tac x=y in lt_length_in_nat, assumption)  
   570 apply (frule_tac x=y in lt_length_in_nat, assumption)  
   571 apply (simp add: satisfies_is_a_fm_def satisfies_is_a_def sats_lambda_fm 
   571 apply (simp add: satisfies_is_a_fm_def satisfies_is_a_def sats_lambda_fm 
   572                  sats_bool_of_o_fm)
   572                  sats_bool_of_o_fm)
   573 done
   573 done
   574 
   574 
   575 lemma satisfies_is_a_iff_sats:
   575 lemma satisfies_is_a_iff_sats:
   576   "[| nth(u,env) = nu; nth(x,env) = nx; nth(y,env) = ny; nth(z,env) = nz;
   576   "[| nth(u,env) = nu; nth(x,env) = nx; nth(y,env) = ny; nth(z,env) = nz;
   577       u \<in> nat; x < length(env); y < length(env); z \<in> nat; env \<in> list(A)|]
   577       u \<in> nat; x < length(env); y < length(env); z \<in> nat; env \<in> list(A)|]
   578    ==> satisfies_is_a(**A,nu,nx,ny,nz) <->
   578    ==> satisfies_is_a(##A,nu,nx,ny,nz) <->
   579        sats(A, satisfies_is_a_fm(u,x,y,z), env)"
   579        sats(A, satisfies_is_a_fm(u,x,y,z), env)"
   580 by simp
   580 by simp
   581 
   581 
   582 theorem satisfies_is_a_reflection:
   582 theorem satisfies_is_a_reflection:
   583      "REFLECTS[\<lambda>x. satisfies_is_a(L,f(x),g(x),h(x),g'(x)),
   583      "REFLECTS[\<lambda>x. satisfies_is_a(L,f(x),g(x),h(x),g'(x)),
   584                \<lambda>i x. satisfies_is_a(**Lset(i),f(x),g(x),h(x),g'(x))]"
   584                \<lambda>i x. satisfies_is_a(##Lset(i),f(x),g(x),h(x),g'(x))]"
   585 apply (unfold satisfies_is_a_def) 
   585 apply (unfold satisfies_is_a_def) 
   586 apply (intro FOL_reflections is_lambda_reflection bool_of_o_reflection 
   586 apply (intro FOL_reflections is_lambda_reflection bool_of_o_reflection 
   587              nth_reflection is_list_reflection)
   587              nth_reflection is_list_reflection)
   588 done
   588 done
   589 
   589 
   611 by (simp add: satisfies_is_b_fm_def)
   611 by (simp add: satisfies_is_b_fm_def)
   612 
   612 
   613 lemma sats_satisfies_is_b_fm [simp]:
   613 lemma sats_satisfies_is_b_fm [simp]:
   614    "[| u \<in> nat; x < length(env); y < length(env); z \<in> nat; env \<in> list(A)|]
   614    "[| u \<in> nat; x < length(env); y < length(env); z \<in> nat; env \<in> list(A)|]
   615     ==> sats(A, satisfies_is_b_fm(u,x,y,z), env) <->
   615     ==> sats(A, satisfies_is_b_fm(u,x,y,z), env) <->
   616         satisfies_is_b(**A, nth(u,env), nth(x,env), nth(y,env), nth(z,env))"
   616         satisfies_is_b(##A, nth(u,env), nth(x,env), nth(y,env), nth(z,env))"
   617 apply (frule_tac x=x in lt_length_in_nat, assumption)  
   617 apply (frule_tac x=x in lt_length_in_nat, assumption)  
   618 apply (frule_tac x=y in lt_length_in_nat, assumption)  
   618 apply (frule_tac x=y in lt_length_in_nat, assumption)  
   619 apply (simp add: satisfies_is_b_fm_def satisfies_is_b_def sats_lambda_fm 
   619 apply (simp add: satisfies_is_b_fm_def satisfies_is_b_def sats_lambda_fm 
   620                  sats_bool_of_o_fm)
   620                  sats_bool_of_o_fm)
   621 done
   621 done
   622 
   622 
   623 lemma satisfies_is_b_iff_sats:
   623 lemma satisfies_is_b_iff_sats:
   624   "[| nth(u,env) = nu; nth(x,env) = nx; nth(y,env) = ny; nth(z,env) = nz;
   624   "[| nth(u,env) = nu; nth(x,env) = nx; nth(y,env) = ny; nth(z,env) = nz;
   625       u \<in> nat; x < length(env); y < length(env); z \<in> nat; env \<in> list(A)|]
   625       u \<in> nat; x < length(env); y < length(env); z \<in> nat; env \<in> list(A)|]
   626    ==> satisfies_is_b(**A,nu,nx,ny,nz) <->
   626    ==> satisfies_is_b(##A,nu,nx,ny,nz) <->
   627        sats(A, satisfies_is_b_fm(u,x,y,z), env)"
   627        sats(A, satisfies_is_b_fm(u,x,y,z), env)"
   628 by simp
   628 by simp
   629 
   629 
   630 theorem satisfies_is_b_reflection:
   630 theorem satisfies_is_b_reflection:
   631      "REFLECTS[\<lambda>x. satisfies_is_b(L,f(x),g(x),h(x),g'(x)),
   631      "REFLECTS[\<lambda>x. satisfies_is_b(L,f(x),g(x),h(x),g'(x)),
   632                \<lambda>i x. satisfies_is_b(**Lset(i),f(x),g(x),h(x),g'(x))]"
   632                \<lambda>i x. satisfies_is_b(##Lset(i),f(x),g(x),h(x),g'(x))]"
   633 apply (unfold satisfies_is_b_def) 
   633 apply (unfold satisfies_is_b_def) 
   634 apply (intro FOL_reflections is_lambda_reflection bool_of_o_reflection 
   634 apply (intro FOL_reflections is_lambda_reflection bool_of_o_reflection 
   635              nth_reflection is_list_reflection)
   635              nth_reflection is_list_reflection)
   636 done
   636 done
   637 
   637 
   663 by (simp add: satisfies_is_c_fm_def)
   663 by (simp add: satisfies_is_c_fm_def)
   664 
   664 
   665 lemma sats_satisfies_is_c_fm [simp]:
   665 lemma sats_satisfies_is_c_fm [simp]:
   666    "[| u \<in> nat; v \<in> nat; x \<in> nat; y \<in> nat; z \<in> nat; env \<in> list(A)|]
   666    "[| u \<in> nat; v \<in> nat; x \<in> nat; y \<in> nat; z \<in> nat; env \<in> list(A)|]
   667     ==> sats(A, satisfies_is_c_fm(u,v,x,y,z), env) <->
   667     ==> sats(A, satisfies_is_c_fm(u,v,x,y,z), env) <->
   668         satisfies_is_c(**A, nth(u,env), nth(v,env), nth(x,env), 
   668         satisfies_is_c(##A, nth(u,env), nth(v,env), nth(x,env), 
   669                             nth(y,env), nth(z,env))"  
   669                             nth(y,env), nth(z,env))"  
   670 by (simp add: satisfies_is_c_fm_def satisfies_is_c_def sats_lambda_fm)
   670 by (simp add: satisfies_is_c_fm_def satisfies_is_c_def sats_lambda_fm)
   671 
   671 
   672 lemma satisfies_is_c_iff_sats:
   672 lemma satisfies_is_c_iff_sats:
   673   "[| nth(u,env) = nu; nth(v,env) = nv; nth(x,env) = nx; nth(y,env) = ny; 
   673   "[| nth(u,env) = nu; nth(v,env) = nv; nth(x,env) = nx; nth(y,env) = ny; 
   674       nth(z,env) = nz;
   674       nth(z,env) = nz;
   675       u \<in> nat; v \<in> nat; x \<in> nat; y \<in> nat; z \<in> nat; env \<in> list(A)|]
   675       u \<in> nat; v \<in> nat; x \<in> nat; y \<in> nat; z \<in> nat; env \<in> list(A)|]
   676    ==> satisfies_is_c(**A,nu,nv,nx,ny,nz) <->
   676    ==> satisfies_is_c(##A,nu,nv,nx,ny,nz) <->
   677        sats(A, satisfies_is_c_fm(u,v,x,y,z), env)"
   677        sats(A, satisfies_is_c_fm(u,v,x,y,z), env)"
   678 by simp
   678 by simp
   679 
   679 
   680 theorem satisfies_is_c_reflection:
   680 theorem satisfies_is_c_reflection:
   681      "REFLECTS[\<lambda>x. satisfies_is_c(L,f(x),g(x),h(x),g'(x),h'(x)),
   681      "REFLECTS[\<lambda>x. satisfies_is_c(L,f(x),g(x),h(x),g'(x),h'(x)),
   682                \<lambda>i x. satisfies_is_c(**Lset(i),f(x),g(x),h(x),g'(x),h'(x))]"
   682                \<lambda>i x. satisfies_is_c(##Lset(i),f(x),g(x),h(x),g'(x),h'(x))]"
   683 apply (unfold satisfies_is_c_def) 
   683 apply (unfold satisfies_is_c_def) 
   684 apply (intro FOL_reflections function_reflections is_lambda_reflection
   684 apply (intro FOL_reflections function_reflections is_lambda_reflection
   685              extra_reflections nth_reflection depth_apply_reflection 
   685              extra_reflections nth_reflection depth_apply_reflection 
   686              is_list_reflection)
   686              is_list_reflection)
   687 done
   687 done
   719 by (simp add: satisfies_is_d_fm_def)
   719 by (simp add: satisfies_is_d_fm_def)
   720 
   720 
   721 lemma sats_satisfies_is_d_fm [simp]:
   721 lemma sats_satisfies_is_d_fm [simp]:
   722    "[| u \<in> nat; x \<in> nat; y \<in> nat; z \<in> nat; env \<in> list(A)|]
   722    "[| u \<in> nat; x \<in> nat; y \<in> nat; z \<in> nat; env \<in> list(A)|]
   723     ==> sats(A, satisfies_is_d_fm(u,x,y,z), env) <->
   723     ==> sats(A, satisfies_is_d_fm(u,x,y,z), env) <->
   724         satisfies_is_d(**A, nth(u,env), nth(x,env), nth(y,env), nth(z,env))"  
   724         satisfies_is_d(##A, nth(u,env), nth(x,env), nth(y,env), nth(z,env))"  
   725 by (simp add: satisfies_is_d_fm_def satisfies_is_d_def sats_lambda_fm
   725 by (simp add: satisfies_is_d_fm_def satisfies_is_d_def sats_lambda_fm
   726               sats_bool_of_o_fm)
   726               sats_bool_of_o_fm)
   727 
   727 
   728 lemma satisfies_is_d_iff_sats:
   728 lemma satisfies_is_d_iff_sats:
   729   "[| nth(u,env) = nu; nth(x,env) = nx; nth(y,env) = ny; nth(z,env) = nz;
   729   "[| nth(u,env) = nu; nth(x,env) = nx; nth(y,env) = ny; nth(z,env) = nz;
   730       u \<in> nat; x \<in> nat; y \<in> nat; z \<in> nat; env \<in> list(A)|]
   730       u \<in> nat; x \<in> nat; y \<in> nat; z \<in> nat; env \<in> list(A)|]
   731    ==> satisfies_is_d(**A,nu,nx,ny,nz) <->
   731    ==> satisfies_is_d(##A,nu,nx,ny,nz) <->
   732        sats(A, satisfies_is_d_fm(u,x,y,z), env)"
   732        sats(A, satisfies_is_d_fm(u,x,y,z), env)"
   733 by simp
   733 by simp
   734 
   734 
   735 theorem satisfies_is_d_reflection:
   735 theorem satisfies_is_d_reflection:
   736      "REFLECTS[\<lambda>x. satisfies_is_d(L,f(x),g(x),h(x),g'(x)),
   736      "REFLECTS[\<lambda>x. satisfies_is_d(L,f(x),g(x),h(x),g'(x)),
   737                \<lambda>i x. satisfies_is_d(**Lset(i),f(x),g(x),h(x),g'(x))]"
   737                \<lambda>i x. satisfies_is_d(##Lset(i),f(x),g(x),h(x),g'(x))]"
   738 apply (unfold satisfies_is_d_def) 
   738 apply (unfold satisfies_is_d_def) 
   739 apply (intro FOL_reflections function_reflections is_lambda_reflection
   739 apply (intro FOL_reflections function_reflections is_lambda_reflection
   740              extra_reflections nth_reflection depth_apply_reflection 
   740              extra_reflections nth_reflection depth_apply_reflection 
   741              is_list_reflection)
   741              is_list_reflection)
   742 done
   742 done
   771 by (simp add: satisfies_MH_fm_def)
   771 by (simp add: satisfies_MH_fm_def)
   772 
   772 
   773 lemma sats_satisfies_MH_fm [simp]:
   773 lemma sats_satisfies_MH_fm [simp]:
   774    "[| u \<in> nat; x \<in> nat; y \<in> nat; z \<in> nat; env \<in> list(A)|]
   774    "[| u \<in> nat; x \<in> nat; y \<in> nat; z \<in> nat; env \<in> list(A)|]
   775     ==> sats(A, satisfies_MH_fm(u,x,y,z), env) <->
   775     ==> sats(A, satisfies_MH_fm(u,x,y,z), env) <->
   776         satisfies_MH(**A, nth(u,env), nth(x,env), nth(y,env), nth(z,env))"  
   776         satisfies_MH(##A, nth(u,env), nth(x,env), nth(y,env), nth(z,env))"  
   777 by (simp add: satisfies_MH_fm_def satisfies_MH_def sats_lambda_fm
   777 by (simp add: satisfies_MH_fm_def satisfies_MH_def sats_lambda_fm
   778               sats_formula_case_fm)
   778               sats_formula_case_fm)
   779 
   779 
   780 lemma satisfies_MH_iff_sats:
   780 lemma satisfies_MH_iff_sats:
   781   "[| nth(u,env) = nu; nth(x,env) = nx; nth(y,env) = ny; nth(z,env) = nz;
   781   "[| nth(u,env) = nu; nth(x,env) = nx; nth(y,env) = ny; nth(z,env) = nz;
   782       u \<in> nat; x \<in> nat; y \<in> nat; z \<in> nat; env \<in> list(A)|]
   782       u \<in> nat; x \<in> nat; y \<in> nat; z \<in> nat; env \<in> list(A)|]
   783    ==> satisfies_MH(**A,nu,nx,ny,nz) <->
   783    ==> satisfies_MH(##A,nu,nx,ny,nz) <->
   784        sats(A, satisfies_MH_fm(u,x,y,z), env)"
   784        sats(A, satisfies_MH_fm(u,x,y,z), env)"
   785 by simp 
   785 by simp 
   786 
   786 
   787 lemmas satisfies_reflections =
   787 lemmas satisfies_reflections =
   788        is_lambda_reflection is_formula_reflection 
   788        is_lambda_reflection is_formula_reflection 
   790        satisfies_is_a_reflection satisfies_is_b_reflection 
   790        satisfies_is_a_reflection satisfies_is_b_reflection 
   791        satisfies_is_c_reflection satisfies_is_d_reflection
   791        satisfies_is_c_reflection satisfies_is_d_reflection
   792 
   792 
   793 theorem satisfies_MH_reflection:
   793 theorem satisfies_MH_reflection:
   794      "REFLECTS[\<lambda>x. satisfies_MH(L,f(x),g(x),h(x),g'(x)),
   794      "REFLECTS[\<lambda>x. satisfies_MH(L,f(x),g(x),h(x),g'(x)),
   795                \<lambda>i x. satisfies_MH(**Lset(i),f(x),g(x),h(x),g'(x))]"
   795                \<lambda>i x. satisfies_MH(##Lset(i),f(x),g(x),h(x),g'(x))]"
   796 apply (unfold satisfies_MH_def) 
   796 apply (unfold satisfies_MH_def) 
   797 apply (intro FOL_reflections satisfies_reflections)
   797 apply (intro FOL_reflections satisfies_reflections)
   798 done
   798 done
   799 
   799 
   800 
   800 
   806 lemma Member_Reflects:
   806 lemma Member_Reflects:
   807  "REFLECTS[\<lambda>u. \<exists>v[L]. v \<in> B \<and> (\<exists>bo[L]. \<exists>nx[L]. \<exists>ny[L].
   807  "REFLECTS[\<lambda>u. \<exists>v[L]. v \<in> B \<and> (\<exists>bo[L]. \<exists>nx[L]. \<exists>ny[L].
   808           v \<in> lstA \<and> is_nth(L,x,v,nx) \<and> is_nth(L,y,v,ny) \<and>
   808           v \<in> lstA \<and> is_nth(L,x,v,nx) \<and> is_nth(L,y,v,ny) \<and>
   809           is_bool_of_o(L, nx \<in> ny, bo) \<and> pair(L,v,bo,u)),
   809           is_bool_of_o(L, nx \<in> ny, bo) \<and> pair(L,v,bo,u)),
   810    \<lambda>i u. \<exists>v \<in> Lset(i). v \<in> B \<and> (\<exists>bo \<in> Lset(i). \<exists>nx \<in> Lset(i). \<exists>ny \<in> Lset(i).
   810    \<lambda>i u. \<exists>v \<in> Lset(i). v \<in> B \<and> (\<exists>bo \<in> Lset(i). \<exists>nx \<in> Lset(i). \<exists>ny \<in> Lset(i).
   811              v \<in> lstA \<and> is_nth(**Lset(i), x, v, nx) \<and> 
   811              v \<in> lstA \<and> is_nth(##Lset(i), x, v, nx) \<and> 
   812              is_nth(**Lset(i), y, v, ny) \<and>
   812              is_nth(##Lset(i), y, v, ny) \<and>
   813           is_bool_of_o(**Lset(i), nx \<in> ny, bo) \<and> pair(**Lset(i), v, bo, u))]"
   813           is_bool_of_o(##Lset(i), nx \<in> ny, bo) \<and> pair(##Lset(i), v, bo, u))]"
   814 by (intro FOL_reflections function_reflections nth_reflection 
   814 by (intro FOL_reflections function_reflections nth_reflection 
   815           bool_of_o_reflection)
   815           bool_of_o_reflection)
   816 
   816 
   817 
   817 
   818 lemma Member_replacement:
   818 lemma Member_replacement:
   836 lemma Equal_Reflects:
   836 lemma Equal_Reflects:
   837  "REFLECTS[\<lambda>u. \<exists>v[L]. v \<in> B \<and> (\<exists>bo[L]. \<exists>nx[L]. \<exists>ny[L].
   837  "REFLECTS[\<lambda>u. \<exists>v[L]. v \<in> B \<and> (\<exists>bo[L]. \<exists>nx[L]. \<exists>ny[L].
   838           v \<in> lstA \<and> is_nth(L, x, v, nx) \<and> is_nth(L, y, v, ny) \<and>
   838           v \<in> lstA \<and> is_nth(L, x, v, nx) \<and> is_nth(L, y, v, ny) \<and>
   839           is_bool_of_o(L, nx = ny, bo) \<and> pair(L, v, bo, u)),
   839           is_bool_of_o(L, nx = ny, bo) \<and> pair(L, v, bo, u)),
   840    \<lambda>i u. \<exists>v \<in> Lset(i). v \<in> B \<and> (\<exists>bo \<in> Lset(i). \<exists>nx \<in> Lset(i). \<exists>ny \<in> Lset(i).
   840    \<lambda>i u. \<exists>v \<in> Lset(i). v \<in> B \<and> (\<exists>bo \<in> Lset(i). \<exists>nx \<in> Lset(i). \<exists>ny \<in> Lset(i).
   841              v \<in> lstA \<and> is_nth(**Lset(i), x, v, nx) \<and> 
   841              v \<in> lstA \<and> is_nth(##Lset(i), x, v, nx) \<and> 
   842              is_nth(**Lset(i), y, v, ny) \<and>
   842              is_nth(##Lset(i), y, v, ny) \<and>
   843           is_bool_of_o(**Lset(i), nx = ny, bo) \<and> pair(**Lset(i), v, bo, u))]"
   843           is_bool_of_o(##Lset(i), nx = ny, bo) \<and> pair(##Lset(i), v, bo, u))]"
   844 by (intro FOL_reflections function_reflections nth_reflection 
   844 by (intro FOL_reflections function_reflections nth_reflection 
   845           bool_of_o_reflection)
   845           bool_of_o_reflection)
   846 
   846 
   847 
   847 
   848 lemma Equal_replacement:
   848 lemma Equal_replacement:
   868 		 fun_apply(L, rp, u, rpe) \<and> fun_apply(L, rq, u, rqe) \<and>
   868 		 fun_apply(L, rp, u, rpe) \<and> fun_apply(L, rq, u, rqe) \<and>
   869 		 is_and(L, rpe, rqe, andpq) \<and> is_not(L, andpq, notpq) \<and>
   869 		 is_and(L, rpe, rqe, andpq) \<and> is_not(L, andpq, notpq) \<and>
   870 		 u \<in> list(A) \<and> pair(L, u, notpq, x)),
   870 		 u \<in> list(A) \<and> pair(L, u, notpq, x)),
   871     \<lambda>i x. \<exists>u \<in> Lset(i). u \<in> B \<and>
   871     \<lambda>i x. \<exists>u \<in> Lset(i). u \<in> B \<and>
   872      (\<exists>rpe \<in> Lset(i). \<exists>rqe \<in> Lset(i). \<exists>andpq \<in> Lset(i). \<exists>notpq \<in> Lset(i).
   872      (\<exists>rpe \<in> Lset(i). \<exists>rqe \<in> Lset(i). \<exists>andpq \<in> Lset(i). \<exists>notpq \<in> Lset(i).
   873        fun_apply(**Lset(i), rp, u, rpe) \<and> fun_apply(**Lset(i), rq, u, rqe) \<and>
   873        fun_apply(##Lset(i), rp, u, rpe) \<and> fun_apply(##Lset(i), rq, u, rqe) \<and>
   874        is_and(**Lset(i), rpe, rqe, andpq) \<and> is_not(**Lset(i), andpq, notpq) \<and>
   874        is_and(##Lset(i), rpe, rqe, andpq) \<and> is_not(##Lset(i), andpq, notpq) \<and>
   875        u \<in> list(A) \<and> pair(**Lset(i), u, notpq, x))]"
   875        u \<in> list(A) \<and> pair(##Lset(i), u, notpq, x))]"
   876 apply (unfold is_and_def is_not_def) 
   876 apply (unfold is_and_def is_not_def) 
   877 apply (intro FOL_reflections function_reflections)
   877 apply (intro FOL_reflections function_reflections)
   878 done
   878 done
   879 
   879 
   880 lemma Nand_replacement:
   880 lemma Nand_replacement:
   901      \<forall>a[L]. \<forall>co[L]. \<forall>rpco[L]. a \<in> A \<longrightarrow>
   901      \<forall>a[L]. \<forall>co[L]. \<forall>rpco[L]. a \<in> A \<longrightarrow>
   902                 is_Cons(L,a,u,co) \<longrightarrow> fun_apply(L,rp,co,rpco) \<longrightarrow> 
   902                 is_Cons(L,a,u,co) \<longrightarrow> fun_apply(L,rp,co,rpco) \<longrightarrow> 
   903                 number1(L,rpco),
   903                 number1(L,rpco),
   904                            bo) \<and> pair(L,u,bo,x)),
   904                            bo) \<and> pair(L,u,bo,x)),
   905  \<lambda>i x. \<exists>u \<in> Lset(i). u \<in> B \<and> (\<exists>bo \<in> Lset(i). u \<in> list(A) \<and>
   905  \<lambda>i x. \<exists>u \<in> Lset(i). u \<in> B \<and> (\<exists>bo \<in> Lset(i). u \<in> list(A) \<and>
   906         is_bool_of_o (**Lset(i),
   906         is_bool_of_o (##Lset(i),
   907  \<forall>a \<in> Lset(i). \<forall>co \<in> Lset(i). \<forall>rpco \<in> Lset(i). a \<in> A \<longrightarrow>
   907  \<forall>a \<in> Lset(i). \<forall>co \<in> Lset(i). \<forall>rpco \<in> Lset(i). a \<in> A \<longrightarrow>
   908 	    is_Cons(**Lset(i),a,u,co) \<longrightarrow> fun_apply(**Lset(i),rp,co,rpco) \<longrightarrow> 
   908 	    is_Cons(##Lset(i),a,u,co) \<longrightarrow> fun_apply(##Lset(i),rp,co,rpco) \<longrightarrow> 
   909 	    number1(**Lset(i),rpco),
   909 	    number1(##Lset(i),rpco),
   910 		       bo) \<and> pair(**Lset(i),u,bo,x))]"
   910 		       bo) \<and> pair(##Lset(i),u,bo,x))]"
   911 apply (unfold is_bool_of_o_def) 
   911 apply (unfold is_bool_of_o_def) 
   912 apply (intro FOL_reflections function_reflections Cons_reflection)
   912 apply (intro FOL_reflections function_reflections Cons_reflection)
   913 done
   913 done
   914 
   914 
   915 lemma Forall_replacement:
   915 lemma Forall_replacement:
   934 subsubsection{*The @{term "transrec_replacement"} Case*}
   934 subsubsection{*The @{term "transrec_replacement"} Case*}
   935 
   935 
   936 lemma formula_rec_replacement_Reflects:
   936 lemma formula_rec_replacement_Reflects:
   937  "REFLECTS [\<lambda>x. \<exists>u[L]. u \<in> B \<and> (\<exists>y[L]. pair(L, u, y, x) \<and>
   937  "REFLECTS [\<lambda>x. \<exists>u[L]. u \<in> B \<and> (\<exists>y[L]. pair(L, u, y, x) \<and>
   938              is_wfrec (L, satisfies_MH(L,A), mesa, u, y)),
   938              is_wfrec (L, satisfies_MH(L,A), mesa, u, y)),
   939     \<lambda>i x. \<exists>u \<in> Lset(i). u \<in> B \<and> (\<exists>y \<in> Lset(i). pair(**Lset(i), u, y, x) \<and>
   939     \<lambda>i x. \<exists>u \<in> Lset(i). u \<in> B \<and> (\<exists>y \<in> Lset(i). pair(##Lset(i), u, y, x) \<and>
   940              is_wfrec (**Lset(i), satisfies_MH(**Lset(i),A), mesa, u, y))]"
   940              is_wfrec (##Lset(i), satisfies_MH(##Lset(i),A), mesa, u, y))]"
   941 by (intro FOL_reflections function_reflections satisfies_MH_reflection 
   941 by (intro FOL_reflections function_reflections satisfies_MH_reflection 
   942           is_wfrec_reflection) 
   942           is_wfrec_reflection) 
   943 
   943 
   944 lemma formula_rec_replacement: 
   944 lemma formula_rec_replacement: 
   945       --{*For the @{term transrec}*}
   945       --{*For the @{term transrec}*}
   963 	 is_formula_case
   963 	 is_formula_case
   964 	  (L, satisfies_is_a(L,A), satisfies_is_b(L,A),
   964 	  (L, satisfies_is_a(L,A), satisfies_is_b(L,A),
   965 	   satisfies_is_c(L,A,g), satisfies_is_d(L,A,g),
   965 	   satisfies_is_c(L,A,g), satisfies_is_d(L,A,g),
   966 	   u, c) &
   966 	   u, c) &
   967 	 pair(L,u,c,x)),
   967 	 pair(L,u,c,x)),
   968   \<lambda>i x. \<exists>u \<in> Lset(i). u \<in> B & mem_formula(**Lset(i),u) &
   968   \<lambda>i x. \<exists>u \<in> Lset(i). u \<in> B & mem_formula(##Lset(i),u) &
   969      (\<exists>c \<in> Lset(i).
   969      (\<exists>c \<in> Lset(i).
   970 	 is_formula_case
   970 	 is_formula_case
   971 	  (**Lset(i), satisfies_is_a(**Lset(i),A), satisfies_is_b(**Lset(i),A),
   971 	  (##Lset(i), satisfies_is_a(##Lset(i),A), satisfies_is_b(##Lset(i),A),
   972 	   satisfies_is_c(**Lset(i),A,g), satisfies_is_d(**Lset(i),A,g),
   972 	   satisfies_is_c(##Lset(i),A,g), satisfies_is_d(##Lset(i),A,g),
   973 	   u, c) &
   973 	   u, c) &
   974 	 pair(**Lset(i),u,c,x))]"
   974 	 pair(##Lset(i),u,c,x))]"
   975 by (intro FOL_reflections function_reflections mem_formula_reflection
   975 by (intro FOL_reflections function_reflections mem_formula_reflection
   976           is_formula_case_reflection satisfies_is_a_reflection
   976           is_formula_case_reflection satisfies_is_a_reflection
   977           satisfies_is_b_reflection satisfies_is_c_reflection
   977           satisfies_is_b_reflection satisfies_is_c_reflection
   978           satisfies_is_d_reflection)  
   978           satisfies_is_d_reflection)  
   979 
   979