src/ZF/Constructible/Satisfies_absolute.thy
author paulson
Tue, 13 Aug 2002 11:03:11 +0200
changeset 13494 1c44289716ae
child 13496 6f0c57def6d5
permissions -rw-r--r--
new file Constructible/Satisfies_absolute.thy
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13494
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
     1
(*  Title:      ZF/Constructible/Satisfies_absolute.thy
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
     2
    ID:         $Id$
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
     4
    Copyright   2002  University of Cambridge
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
     5
*)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
     6
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
     7
theory Satisfies_absolute = Datatype_absolute + Rec_Separation: 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
     8
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
     9
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    10
subsection{*More Internalizations*}
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    11
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    12
lemma and_reflection:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    13
     "REFLECTS[\<lambda>x. is_and(L,f(x),g(x),h(x)),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    14
               \<lambda>i x. is_and(**Lset(i),f(x),g(x),h(x))]"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    15
apply (simp only: is_and_def setclass_simps)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    16
apply (intro FOL_reflections function_reflections)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    17
done
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    18
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    19
lemma not_reflection:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    20
     "REFLECTS[\<lambda>x. is_not(L,f(x),g(x)),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    21
               \<lambda>i x. is_not(**Lset(i),f(x),g(x))]"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    22
apply (simp only: is_not_def setclass_simps)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    23
apply (intro FOL_reflections function_reflections)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    24
done
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    25
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    26
subsubsection{*The Operator @{term is_lambda}*}
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    27
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    28
text{*The two arguments of @{term p} are always 1, 0. Remember that
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    29
 @{term p} will be enclosed by three quantifiers.*}
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    30
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    31
(* is_lambda :: "[i=>o, i, [i,i]=>o, i] => o"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    32
    "is_lambda(M, A, is_b, z) == 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    33
       \<forall>p[M]. p \<in> z <->
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    34
        (\<exists>u[M]. \<exists>v[M]. u\<in>A & pair(M,u,v,p) & is_b(u,v))" *)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    35
constdefs lambda_fm :: "[i, i, i]=>i"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    36
 "lambda_fm(p,A,z) == 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    37
    Forall(Iff(Member(0,succ(z)),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    38
            Exists(Exists(And(Member(1,A#+3),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    39
                           And(pair_fm(1,0,2), p))))))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    40
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    41
text{*We call @{term p} with arguments x, y by equating them with 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    42
  the corresponding quantified variables with de Bruijn indices 1, 0.*}
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    43
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    44
lemma is_lambda_type [TC]:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    45
     "[| p \<in> formula; x \<in> nat; y \<in> nat |] 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    46
      ==> lambda_fm(p,x,y) \<in> formula"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    47
by (simp add: lambda_fm_def) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    48
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    49
lemma sats_lambda_fm:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    50
  assumes is_b_iff_sats: 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    51
      "!!a0 a1 a2. 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    52
        [|a0\<in>A; a1\<in>A; a2\<in>A|] 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    53
        ==> is_b(a1, a0) <-> sats(A, p, Cons(a0,Cons(a1,Cons(a2,env))))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    54
  shows 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    55
      "[|x \<in> nat; y \<in> nat; env \<in> list(A)|]
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    56
       ==> sats(A, lambda_fm(p,x,y), env) <-> 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    57
           is_lambda(**A, nth(x,env), is_b, nth(y,env))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    58
by (simp add: lambda_fm_def sats_is_recfun_fm is_lambda_def is_b_iff_sats [THEN iff_sym]) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    59
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    60
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    61
lemma is_lambda_iff_sats:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    62
  assumes is_b_iff_sats: 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    63
      "!!a0 a1 a2. 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    64
        [|a0\<in>A; a1\<in>A; a2\<in>A|] 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    65
        ==> is_b(a1, a0) <-> sats(A, p, Cons(a0,Cons(a1,Cons(a2,env))))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    66
  shows
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    67
  "[|nth(i,env) = x; nth(j,env) = y; 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    68
      i \<in> nat; j \<in> nat; env \<in> list(A)|]
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    69
   ==> is_lambda(**A, x, is_b, y) <-> sats(A, lambda_fm(p,i,j), env)" 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    70
by (simp add: sats_lambda_fm [OF is_b_iff_sats])
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    71
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    72
theorem is_lambda_reflection:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    73
  assumes is_b_reflection:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    74
    "!!f' f g h. REFLECTS[\<lambda>x. is_b(L, f'(x), f(x), g(x)), 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    75
                     \<lambda>i x. is_b(**Lset(i), f'(x), f(x), g(x))]"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    76
  shows "REFLECTS[\<lambda>x. is_lambda(L, A(x), is_b(L,x), f(x)), 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    77
               \<lambda>i x. is_lambda(**Lset(i), A(x), is_b(**Lset(i),x), f(x))]"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    78
apply (simp (no_asm_use) only: is_lambda_def setclass_simps)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    79
apply (intro FOL_reflections is_b_reflection pair_reflection)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    80
done
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    81
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    82
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    83
subsubsection{*The Operator @{term is_Member}, Internalized*}
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    84
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    85
(*    "is_Member(M,x,y,Z) ==
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    86
	\<exists>p[M]. \<exists>u[M]. pair(M,x,y,p) & is_Inl(M,p,u) & is_Inl(M,u,Z)" *)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    87
constdefs Member_fm :: "[i,i,i]=>i"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    88
    "Member_fm(x,y,Z) ==
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    89
       Exists(Exists(And(pair_fm(x#+2,y#+2,1), 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    90
                      And(Inl_fm(1,0), Inl_fm(0,Z#+2)))))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    91
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    92
lemma is_Member_type [TC]:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    93
     "[| x \<in> nat; y \<in> nat; z \<in> nat |] ==> Member_fm(x,y,z) \<in> formula"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    94
by (simp add: Member_fm_def)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    95
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    96
lemma sats_Member_fm [simp]:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    97
   "[| x \<in> nat; y \<in> nat; z \<in> nat; env \<in> list(A)|]
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    98
    ==> sats(A, Member_fm(x,y,z), env) <->
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
    99
        is_Member(**A, nth(x,env), nth(y,env), nth(z,env))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   100
by (simp add: Member_fm_def is_Member_def)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   101
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   102
lemma Member_iff_sats:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   103
      "[| nth(i,env) = x; nth(j,env) = y; nth(k,env) = z;
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   104
          i \<in> nat; j \<in> nat; k \<in> nat; env \<in> list(A)|]
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   105
       ==> is_Member(**A, x, y, z) <-> sats(A, Member_fm(i,j,k), env)"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   106
by (simp add: sats_Member_fm)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   107
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   108
theorem Member_reflection:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   109
     "REFLECTS[\<lambda>x. is_Member(L,f(x),g(x),h(x)),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   110
               \<lambda>i x. is_Member(**Lset(i),f(x),g(x),h(x))]"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   111
apply (simp only: is_Member_def setclass_simps)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   112
apply (intro FOL_reflections pair_reflection Inl_reflection)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   113
done
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   114
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   115
subsubsection{*The Operator @{term is_Equal}, Internalized*}
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   116
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   117
(*    "is_Equal(M,x,y,Z) ==
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   118
	\<exists>p[M]. \<exists>u[M]. pair(M,x,y,p) & is_Inr(M,p,u) & is_Inl(M,u,Z)" *)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   119
constdefs Equal_fm :: "[i,i,i]=>i"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   120
    "Equal_fm(x,y,Z) ==
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   121
       Exists(Exists(And(pair_fm(x#+2,y#+2,1), 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   122
                      And(Inr_fm(1,0), Inl_fm(0,Z#+2)))))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   123
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   124
lemma is_Equal_type [TC]:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   125
     "[| x \<in> nat; y \<in> nat; z \<in> nat |] ==> Equal_fm(x,y,z) \<in> formula"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   126
by (simp add: Equal_fm_def)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   127
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   128
lemma sats_Equal_fm [simp]:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   129
   "[| x \<in> nat; y \<in> nat; z \<in> nat; env \<in> list(A)|]
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   130
    ==> sats(A, Equal_fm(x,y,z), env) <->
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   131
        is_Equal(**A, nth(x,env), nth(y,env), nth(z,env))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   132
by (simp add: Equal_fm_def is_Equal_def)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   133
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   134
lemma Equal_iff_sats:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   135
      "[| nth(i,env) = x; nth(j,env) = y; nth(k,env) = z;
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   136
          i \<in> nat; j \<in> nat; k \<in> nat; env \<in> list(A)|]
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   137
       ==> is_Equal(**A, x, y, z) <-> sats(A, Equal_fm(i,j,k), env)"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   138
by (simp add: sats_Equal_fm)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   139
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   140
theorem Equal_reflection:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   141
     "REFLECTS[\<lambda>x. is_Equal(L,f(x),g(x),h(x)),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   142
               \<lambda>i x. is_Equal(**Lset(i),f(x),g(x),h(x))]"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   143
apply (simp only: is_Equal_def setclass_simps)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   144
apply (intro FOL_reflections pair_reflection Inl_reflection Inr_reflection)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   145
done
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   146
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   147
subsubsection{*The Operator @{term is_Nand}, Internalized*}
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   148
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   149
(*    "is_Nand(M,x,y,Z) ==
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   150
	\<exists>p[M]. \<exists>u[M]. pair(M,x,y,p) & is_Inl(M,p,u) & is_Inr(M,u,Z)" *)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   151
constdefs Nand_fm :: "[i,i,i]=>i"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   152
    "Nand_fm(x,y,Z) ==
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   153
       Exists(Exists(And(pair_fm(x#+2,y#+2,1), 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   154
                      And(Inl_fm(1,0), Inr_fm(0,Z#+2)))))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   155
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   156
lemma is_Nand_type [TC]:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   157
     "[| x \<in> nat; y \<in> nat; z \<in> nat |] ==> Nand_fm(x,y,z) \<in> formula"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   158
by (simp add: Nand_fm_def)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   159
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   160
lemma sats_Nand_fm [simp]:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   161
   "[| x \<in> nat; y \<in> nat; z \<in> nat; env \<in> list(A)|]
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   162
    ==> sats(A, Nand_fm(x,y,z), env) <->
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   163
        is_Nand(**A, nth(x,env), nth(y,env), nth(z,env))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   164
by (simp add: Nand_fm_def is_Nand_def)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   165
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   166
lemma Nand_iff_sats:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   167
      "[| nth(i,env) = x; nth(j,env) = y; nth(k,env) = z;
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   168
          i \<in> nat; j \<in> nat; k \<in> nat; env \<in> list(A)|]
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   169
       ==> is_Nand(**A, x, y, z) <-> sats(A, Nand_fm(i,j,k), env)"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   170
by (simp add: sats_Nand_fm)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   171
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   172
theorem Nand_reflection:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   173
     "REFLECTS[\<lambda>x. is_Nand(L,f(x),g(x),h(x)),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   174
               \<lambda>i x. is_Nand(**Lset(i),f(x),g(x),h(x))]"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   175
apply (simp only: is_Nand_def setclass_simps)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   176
apply (intro FOL_reflections pair_reflection Inl_reflection Inr_reflection)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   177
done
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   178
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   179
subsubsection{*The Operator @{term is_Forall}, Internalized*}
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   180
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   181
(* "is_Forall(M,p,Z) == \<exists>u[M]. is_Inr(M,p,u) & is_Inr(M,u,Z)" *)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   182
constdefs Forall_fm :: "[i,i]=>i"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   183
    "Forall_fm(x,Z) ==
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   184
       Exists(And(Inr_fm(succ(x),0), Inr_fm(0,succ(Z))))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   185
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   186
lemma is_Forall_type [TC]:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   187
     "[| x \<in> nat; y \<in> nat |] ==> Forall_fm(x,y) \<in> formula"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   188
by (simp add: Forall_fm_def)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   189
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   190
lemma sats_Forall_fm [simp]:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   191
   "[| x \<in> nat; y \<in> nat; env \<in> list(A)|]
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   192
    ==> sats(A, Forall_fm(x,y), env) <->
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   193
        is_Forall(**A, nth(x,env), nth(y,env))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   194
by (simp add: Forall_fm_def is_Forall_def)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   195
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   196
lemma Forall_iff_sats:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   197
      "[| nth(i,env) = x; nth(j,env) = y; 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   198
          i \<in> nat; j \<in> nat; env \<in> list(A)|]
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   199
       ==> is_Forall(**A, x, y) <-> sats(A, Forall_fm(i,j), env)"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   200
by (simp add: sats_Forall_fm)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   201
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   202
theorem Forall_reflection:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   203
     "REFLECTS[\<lambda>x. is_Forall(L,f(x),g(x)),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   204
               \<lambda>i x. is_Forall(**Lset(i),f(x),g(x))]"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   205
apply (simp only: is_Forall_def setclass_simps)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   206
apply (intro FOL_reflections pair_reflection Inr_reflection)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   207
done
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   208
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   209
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   210
subsubsection{*The Formula @{term is_formula_N}, Internalized*}
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   211
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   212
(* "is_nth(M,n,l,Z) == 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   213
      \<exists>X[M]. \<exists>sn[M]. \<exists>msn[M]. 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   214
       2       1       0
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   215
       successor(M,n,sn) & membership(M,sn,msn) &
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   216
       is_wfrec(M, iterates_MH(M, is_tl(M), l), msn, n, X) &
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   217
       is_hd(M,X,Z)" *)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   218
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   219
(* "is_formula_N(M,n,Z) == 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   220
      \<exists>zero[M]. \<exists>sn[M]. \<exists>msn[M]. 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   221
          2       1       0
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   222
       empty(M,zero) & 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   223
       successor(M,n,sn) & membership(M,sn,msn) &
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   224
       is_wfrec(M, iterates_MH(M, is_formula_functor(M),zero), msn, n, Z)" *) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   225
constdefs formula_N_fm :: "[i,i]=>i"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   226
  "formula_N_fm(n,Z) == 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   227
     Exists(Exists(Exists(
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   228
       And(empty_fm(2),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   229
         And(succ_fm(n#+3,1),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   230
          And(Memrel_fm(1,0),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   231
              is_wfrec_fm(iterates_MH_fm(formula_functor_fm(1,0),7,2,1,0), 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   232
                           0, n#+3, Z#+3)))))))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   233
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   234
lemma formula_N_fm_type [TC]:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   235
 "[| x \<in> nat; y \<in> nat |] ==> formula_N_fm(x,y) \<in> formula"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   236
by (simp add: formula_N_fm_def)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   237
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   238
lemma sats_formula_N_fm [simp]:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   239
   "[| x < length(env); y < length(env); env \<in> list(A)|]
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   240
    ==> sats(A, formula_N_fm(x,y), env) <->
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   241
        is_formula_N(**A, nth(x,env), nth(y,env))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   242
apply (frule_tac x=y in lt_length_in_nat, assumption)  
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   243
apply (frule lt_length_in_nat, assumption)  
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   244
apply (simp add: formula_N_fm_def is_formula_N_def sats_is_wfrec_fm sats_iterates_MH_fm) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   245
done
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   246
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   247
lemma formula_N_iff_sats:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   248
      "[| nth(i,env) = x; nth(j,env) = y; 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   249
          i < length(env); j < length(env); env \<in> list(A)|]
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   250
       ==> is_formula_N(**A, x, y) <-> sats(A, formula_N_fm(i,j), env)"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   251
by (simp add: sats_formula_N_fm)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   252
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   253
theorem formula_N_reflection:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   254
     "REFLECTS[\<lambda>x. is_formula_N(L, f(x), g(x)),  
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   255
               \<lambda>i x. is_formula_N(**Lset(i), f(x), g(x))]"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   256
apply (simp only: is_formula_N_def setclass_simps)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   257
apply (intro FOL_reflections function_reflections is_wfrec_reflection 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   258
             iterates_MH_reflection formula_functor_reflection) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   259
done
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   260
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   261
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   262
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   263
subsubsection{*The Predicate ``Is A Formula''*}
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   264
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   265
(*  mem_formula(M,p) == 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   266
      \<exists>n[M]. \<exists>formn[M]. 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   267
       finite_ordinal(M,n) & is_formula_N(M,n,formn) & p \<in> formn *)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   268
constdefs mem_formula_fm :: "i=>i"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   269
    "mem_formula_fm(x) ==
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   270
       Exists(Exists(
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   271
         And(finite_ordinal_fm(1),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   272
           And(formula_N_fm(1,0), Member(x#+2,0)))))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   273
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   274
lemma mem_formula_type [TC]:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   275
     "x \<in> nat ==> mem_formula_fm(x) \<in> formula"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   276
by (simp add: mem_formula_fm_def)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   277
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   278
lemma sats_mem_formula_fm [simp]:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   279
   "[| x \<in> nat; env \<in> list(A)|]
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   280
    ==> sats(A, mem_formula_fm(x), env) <-> mem_formula(**A, nth(x,env))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   281
by (simp add: mem_formula_fm_def mem_formula_def)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   282
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   283
lemma mem_formula_iff_sats:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   284
      "[| nth(i,env) = x; nth(j,env) = y;
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   285
          i \<in> nat; env \<in> list(A)|]
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   286
       ==> mem_formula(**A, x) <-> sats(A, mem_formula_fm(i), env)"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   287
by simp
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   288
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   289
theorem mem_formula_reflection:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   290
     "REFLECTS[\<lambda>x. mem_formula(L,f(x)),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   291
               \<lambda>i x. mem_formula(**Lset(i),f(x))]"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   292
apply (simp only: mem_formula_def setclass_simps)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   293
apply (intro FOL_reflections finite_ordinal_reflection formula_N_reflection)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   294
done
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   295
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   296
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   297
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   298
subsubsection{*The Formula @{term is_depth}, Internalized*}
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   299
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   300
(*    "is_depth(M,p,n) == 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   301
       \<exists>sn[M]. \<exists>formula_n[M]. \<exists>formula_sn[M]. 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   302
         2          1                0
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   303
        is_formula_N(M,n,formula_n) & p \<notin> formula_n &
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   304
        successor(M,n,sn) & is_formula_N(M,sn,formula_sn) & p \<in> formula_sn" *)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   305
constdefs depth_fm :: "[i,i]=>i"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   306
  "depth_fm(p,n) == 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   307
     Exists(Exists(Exists(
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   308
       And(formula_N_fm(n#+3,1),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   309
         And(Neg(Member(p#+3,1)),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   310
          And(succ_fm(n#+3,2),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   311
           And(formula_N_fm(2,0), Member(p#+3,0))))))))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   312
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   313
lemma depth_fm_type [TC]:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   314
 "[| x \<in> nat; y \<in> nat |] ==> depth_fm(x,y) \<in> formula"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   315
by (simp add: depth_fm_def)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   316
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   317
lemma sats_depth_fm [simp]:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   318
   "[| x \<in> nat; y < length(env); env \<in> list(A)|]
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   319
    ==> sats(A, depth_fm(x,y), env) <->
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   320
        is_depth(**A, nth(x,env), nth(y,env))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   321
apply (frule_tac x=y in lt_length_in_nat, assumption)  
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   322
apply (simp add: depth_fm_def is_depth_def) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   323
done
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   324
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   325
lemma depth_iff_sats:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   326
      "[| nth(i,env) = x; nth(j,env) = y; 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   327
          i \<in> nat; j < length(env); env \<in> list(A)|]
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   328
       ==> is_depth(**A, x, y) <-> sats(A, depth_fm(i,j), env)"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   329
by (simp add: sats_depth_fm)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   330
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   331
theorem depth_reflection:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   332
     "REFLECTS[\<lambda>x. is_depth(L, f(x), g(x)),  
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   333
               \<lambda>i x. is_depth(**Lset(i), f(x), g(x))]"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   334
apply (simp only: is_depth_def setclass_simps)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   335
apply (intro FOL_reflections function_reflections formula_N_reflection) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   336
done
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   337
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   338
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   339
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   340
subsubsection{*The Operator @{term is_formula_case}*}
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   341
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   342
text{*The arguments of @{term is_a} are always 2, 1, 0, and the formula
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   343
      will be enclosed by three quantifiers.*}
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   344
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   345
(* is_formula_case :: 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   346
    "[i=>o, [i,i,i]=>o, [i,i,i]=>o, [i,i,i]=>o, [i,i]=>o, i, i] => o"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   347
  "is_formula_case(M, is_a, is_b, is_c, is_d, v, z) == 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   348
      (\<forall>x[M]. \<forall>y[M]. x\<in>nat --> y\<in>nat --> is_Member(M,x,y,v) --> is_a(x,y,z)) &
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   349
      (\<forall>x[M]. \<forall>y[M]. x\<in>nat --> y\<in>nat --> is_Equal(M,x,y,v) --> is_b(x,y,z)) &
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   350
      (\<forall>x[M]. \<forall>y[M]. x\<in>formula --> y\<in>formula --> 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   351
                     is_Nand(M,x,y,v) --> is_c(x,y,z)) &
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   352
      (\<forall>x[M]. x\<in>formula --> is_Forall(M,x,v) --> is_d(x,z))" *)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   353
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   354
constdefs formula_case_fm :: "[i, i, i, i, i, i]=>i"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   355
 "formula_case_fm(is_a, is_b, is_c, is_d, v, z) == 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   356
        And(Forall(Forall(Implies(finite_ordinal_fm(1), 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   357
                           Implies(finite_ordinal_fm(0), 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   358
                            Implies(Member_fm(1,0,v#+2), 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   359
                             Forall(Implies(Equal(0,z#+3), is_a))))))),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   360
        And(Forall(Forall(Implies(finite_ordinal_fm(1), 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   361
                           Implies(finite_ordinal_fm(0), 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   362
                            Implies(Equal_fm(1,0,v#+2), 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   363
                             Forall(Implies(Equal(0,z#+3), is_b))))))),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   364
        And(Forall(Forall(Implies(mem_formula_fm(1), 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   365
                           Implies(mem_formula_fm(0), 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   366
                            Implies(Nand_fm(1,0,v#+2), 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   367
                             Forall(Implies(Equal(0,z#+3), is_c))))))),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   368
        Forall(Implies(mem_formula_fm(0), 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   369
                       Implies(Forall_fm(0,succ(v)), 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   370
                             Forall(Implies(Equal(0,z#+2), is_d))))))))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   371
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   372
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   373
lemma is_formula_case_type [TC]:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   374
     "[| is_a \<in> formula;  is_b \<in> formula;  is_c \<in> formula;  is_d \<in> formula;  
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   375
         x \<in> nat; y \<in> nat |] 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   376
      ==> formula_case_fm(is_a, is_b, is_c, is_d, x, y) \<in> formula"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   377
by (simp add: formula_case_fm_def)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   378
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   379
lemma sats_formula_case_fm:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   380
  assumes is_a_iff_sats: 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   381
      "!!a0 a1 a2. 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   382
        [|a0\<in>A; a1\<in>A; a2\<in>A|]  
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   383
        ==> ISA(a2, a1, a0) <-> sats(A, is_a, Cons(a0,Cons(a1,Cons(a2,env))))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   384
  and is_b_iff_sats: 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   385
      "!!a0 a1 a2. 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   386
        [|a0\<in>A; a1\<in>A; a2\<in>A|]  
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   387
        ==> ISB(a2, a1, a0) <-> sats(A, is_b, Cons(a0,Cons(a1,Cons(a2,env))))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   388
  and is_c_iff_sats: 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   389
      "!!a0 a1 a2. 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   390
        [|a0\<in>A; a1\<in>A; a2\<in>A|]  
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   391
        ==> ISC(a2, a1, a0) <-> sats(A, is_c, Cons(a0,Cons(a1,Cons(a2,env))))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   392
  and is_d_iff_sats: 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   393
      "!!a0 a1. 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   394
        [|a0\<in>A; a1\<in>A|]  
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   395
        ==> ISD(a1, a0) <-> sats(A, is_d, Cons(a0,Cons(a1,env)))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   396
  shows 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   397
      "[|x \<in> nat; y < length(env); env \<in> list(A)|]
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   398
       ==> sats(A, formula_case_fm(is_a,is_b,is_c,is_d,x,y), env) <->
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   399
           is_formula_case(**A, ISA, ISB, ISC, ISD, nth(x,env), nth(y,env))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   400
apply (frule_tac x=y in lt_length_in_nat, assumption)  
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   401
apply (simp add: formula_case_fm_def is_formula_case_def 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   402
                 is_a_iff_sats [THEN iff_sym] is_b_iff_sats [THEN iff_sym]
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   403
                 is_c_iff_sats [THEN iff_sym] is_d_iff_sats [THEN iff_sym])
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   404
done
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   405
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   406
lemma formula_case_iff_sats:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   407
  assumes is_a_iff_sats: 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   408
      "!!a0 a1 a2. 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   409
        [|a0\<in>A; a1\<in>A; a2\<in>A|]  
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   410
        ==> ISA(a2, a1, a0) <-> sats(A, is_a, Cons(a0,Cons(a1,Cons(a2,env))))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   411
  and is_b_iff_sats: 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   412
      "!!a0 a1 a2. 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   413
        [|a0\<in>A; a1\<in>A; a2\<in>A|]  
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   414
        ==> ISB(a2, a1, a0) <-> sats(A, is_b, Cons(a0,Cons(a1,Cons(a2,env))))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   415
  and is_c_iff_sats: 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   416
      "!!a0 a1 a2. 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   417
        [|a0\<in>A; a1\<in>A; a2\<in>A|]  
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   418
        ==> ISC(a2, a1, a0) <-> sats(A, is_c, Cons(a0,Cons(a1,Cons(a2,env))))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   419
  and is_d_iff_sats: 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   420
      "!!a0 a1. 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   421
        [|a0\<in>A; a1\<in>A|]  
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   422
        ==> ISD(a1, a0) <-> sats(A, is_d, Cons(a0,Cons(a1,env)))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   423
  shows 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   424
      "[|nth(i,env) = x; nth(j,env) = y; 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   425
      i \<in> nat; j < length(env); env \<in> list(A)|]
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   426
       ==> is_formula_case(**A, ISA, ISB, ISC, ISD, x, y) <->
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   427
           sats(A, formula_case_fm(is_a,is_b,is_c,is_d,i,j), env)"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   428
by (simp add: sats_formula_case_fm [OF is_a_iff_sats is_b_iff_sats 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   429
                                       is_c_iff_sats is_d_iff_sats])
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   430
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   431
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   432
text{*The second argument of @{term is_a} gives it direct access to @{term x},
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   433
  which is essential for handling free variable references.  Treatment is
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   434
  based on that of @{text is_nat_case_reflection}.*}
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   435
theorem is_formula_case_reflection:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   436
  assumes is_a_reflection:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   437
    "!!h f g g'. REFLECTS[\<lambda>x. is_a(L, h(x), f(x), g(x), g'(x)),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   438
                     \<lambda>i x. is_a(**Lset(i), h(x), f(x), g(x), g'(x))]"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   439
  and is_b_reflection:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   440
    "!!h f g g'. REFLECTS[\<lambda>x. is_b(L, h(x), f(x), g(x), g'(x)),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   441
                     \<lambda>i x. is_b(**Lset(i), h(x), f(x), g(x), g'(x))]"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   442
  and is_c_reflection:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   443
    "!!h f g g'. REFLECTS[\<lambda>x. is_c(L, h(x), f(x), g(x), g'(x)),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   444
                     \<lambda>i x. is_c(**Lset(i), h(x), f(x), g(x), g'(x))]"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   445
  and is_d_reflection:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   446
    "!!h f g g'. REFLECTS[\<lambda>x. is_d(L, h(x), f(x), g(x)),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   447
                     \<lambda>i x. is_d(**Lset(i), h(x), f(x), g(x))]"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   448
  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)),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   449
               \<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))]"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   450
apply (simp (no_asm_use) only: is_formula_case_def setclass_simps)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   451
apply (intro FOL_reflections function_reflections finite_ordinal_reflection
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   452
         mem_formula_reflection
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   453
         Member_reflection Equal_reflection Nand_reflection Forall_reflection
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   454
         is_a_reflection is_b_reflection is_c_reflection is_d_reflection)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   455
done
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   456
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   457
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   458
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   459
subsection {*Absoluteness for @{term formula_rec}*}
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   460
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   461
constdefs
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   462
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   463
  formula_rec_case :: "[[i,i]=>i, [i,i]=>i, [i,i,i,i]=>i, [i,i]=>i, i, i] => i"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   464
    --{* the instance of @{term formula_case} in @{term formula_rec}*}
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   465
   "formula_rec_case(a,b,c,d,h) ==
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   466
        formula_case (a, b,
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   467
                \<lambda>u v. c(u, v, h ` succ(depth(u)) ` u, 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   468
                              h ` succ(depth(v)) ` v),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   469
                \<lambda>u. d(u, h ` succ(depth(u)) ` u))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   470
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   471
  is_formula_rec :: "[i=>o, [i,i,i]=>o, 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   472
                      [i,i]=>i, [i,i]=>i, [i,i,i,i]=>i, [i,i]=>i, 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   473
                      i, i] => o"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   474
    --{* predicate to relative the functional @{term formula_rec}*}
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   475
   "is_formula_rec(M,MH,a,b,c,d,p,z)  ==
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   476
    \<exists>i[M]. \<exists>f[M]. i = succ(depth(p)) & fun_apply(M,f,p,z) &
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   477
                  is_transrec(M,MH,i,f)"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   478
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   479
text{*Unfold @{term formula_rec} to @{term formula_rec_case}*}
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   480
lemma (in M_triv_axioms) formula_rec_eq2:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   481
  "p \<in> formula ==>
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   482
   formula_rec(a,b,c,d,p) = 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   483
   transrec (succ(depth(p)),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   484
             \<lambda>x h. Lambda (formula, formula_rec_case(a,b,c,d,h))) ` p"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   485
by (simp add: formula_rec_eq  formula_rec_case_def)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   486
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   487
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   488
text{*Sufficient conditions to relative the instance of @{term formula_case}
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   489
      in @{term formula_rec}*}
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   490
lemma (in M_datatypes) Relativize1_formula_rec_case:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   491
     "[|Relativize2(M, nat, nat, is_a, a);
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   492
        Relativize2(M, nat, nat, is_b, b);
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   493
        Relativize2 (M, formula, formula, 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   494
           is_c, \<lambda>u v. c(u, v, h`succ(depth(u))`u, h`succ(depth(v))`v));
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   495
        Relativize1(M, formula, 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   496
           is_d, \<lambda>u. d(u, h ` succ(depth(u)) ` u));
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   497
 	M(h) |] 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   498
      ==> Relativize1(M, formula,
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   499
                         is_formula_case (M, is_a, is_b, is_c, is_d),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   500
                         formula_rec_case(a, b, c, d, h))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   501
apply (simp (no_asm) add: formula_rec_case_def Relativize1_def) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   502
apply (simp add: formula_case_abs) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   503
done
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   504
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   505
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   506
text{*This locale packages the premises of the following theorems,
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   507
      which is the normal purpose of locales.  It doesn't accumulate
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   508
      constraints on the class @{term M}, as in most of this deveopment.*}
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   509
locale M_formula_rec = M_eclose +
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   510
  fixes a and is_a and b and is_b and c and is_c and d and is_d and MH
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   511
  defines
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   512
      "MH(u::i,f,z) ==
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   513
	is_lambda
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   514
	 (M, formula, is_formula_case (M, is_a, is_b, is_c(f), is_d(f)), z)"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   515
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   516
  assumes a_closed: "[|x\<in>nat; y\<in>nat|] ==> M(a(x,y))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   517
      and a_rel:    "Relativize2(M, nat, nat, is_a, a)"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   518
      and b_closed: "[|x\<in>nat; y\<in>nat|] ==> M(b(x,y))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   519
      and b_rel:    "Relativize2(M, nat, nat, is_b, b)"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   520
      and c_closed: "[|x \<in> formula; y \<in> formula; M(gx); M(gy)|]
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   521
                     ==> M(c(x, y, gx, gy))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   522
      and c_rel:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   523
         "M(f) ==> 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   524
          Relativize2 (M, formula, formula, is_c(f),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   525
             \<lambda>u v. c(u, v, f ` succ(depth(u)) ` u, f ` succ(depth(v)) ` v))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   526
      and d_closed: "[|x \<in> formula; M(gx)|] ==> M(d(x, gx))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   527
      and d_rel:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   528
         "M(f) ==> 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   529
          Relativize1(M, formula, is_d(f), \<lambda>u. d(u, f ` succ(depth(u)) ` u))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   530
      and fr_replace: "n \<in> nat ==> transrec_replacement(M,MH,n)"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   531
      and fr_lam_replace:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   532
           "M(g) ==>
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   533
            strong_replacement
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   534
	      (M, \<lambda>x y. x \<in> formula &
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   535
		  y = \<langle>x, formula_rec_case(a,b,c,d,g,x)\<rangle>)";
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   536
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   537
lemma (in M_formula_rec) formula_rec_case_closed:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   538
    "[|M(g); p \<in> formula|] ==> M(formula_rec_case(a, b, c, d, g, p))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   539
by (simp add: formula_rec_case_def a_closed b_closed c_closed d_closed) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   540
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   541
lemma (in M_formula_rec) formula_rec_lam_closed:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   542
    "M(g) ==> M(Lambda (formula, formula_rec_case(a,b,c,d,g)))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   543
by (simp add: lam_closed2 fr_lam_replace formula_rec_case_closed)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   544
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   545
lemma (in M_formula_rec) MH_rel2:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   546
     "relativize2 (M, MH,
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   547
             \<lambda>x h. Lambda (formula, formula_rec_case(a,b,c,d,h)))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   548
apply (simp add: relativize2_def MH_def, clarify) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   549
apply (rule lambda_abs2) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   550
apply (rule fr_lam_replace, assumption)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   551
apply (rule Relativize1_formula_rec_case)  
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   552
apply (simp_all add: a_rel b_rel c_rel d_rel formula_rec_case_closed) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   553
done
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   554
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   555
lemma (in M_formula_rec) fr_transrec_closed:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   556
    "n \<in> nat
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   557
     ==> M(transrec
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   558
          (n, \<lambda>x h. Lambda(formula, formula_rec_case(a, b, c, d, h))))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   559
by (simp add: transrec_closed [OF fr_replace MH_rel2]  
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   560
              nat_into_M formula_rec_lam_closed) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   561
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   562
text{*The main two results: @{term formula_rec} is absolute for @{term M}.*}
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   563
theorem (in M_formula_rec) formula_rec_closed:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   564
    "p \<in> formula ==> M(formula_rec(a,b,c,d,p))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   565
by (simp add: formula_rec_eq2 fr_transrec_closed 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   566
              transM [OF _ formula_closed])
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   567
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   568
theorem (in M_formula_rec) formula_rec_abs:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   569
  "[| p \<in> formula; M(z)|] 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   570
   ==> is_formula_rec(M,MH,a,b,c,d,p,z) <-> z = formula_rec(a,b,c,d,p)" 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   571
by (simp add: is_formula_rec_def formula_rec_eq2 transM [OF _ formula_closed]
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   572
              transrec_abs [OF fr_replace MH_rel2] 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   573
              fr_transrec_closed formula_rec_lam_closed eq_commute)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   574
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   575
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   576
subsection {*Absoluteness for the Function @{term satisfies}*}
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   577
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   578
constdefs
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   579
  is_depth_apply :: "[i=>o,i,i,i] => o"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   580
   --{*Merely a useful abbreviation for the sequel.*}
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   581
   "is_depth_apply(M,h,p,z) ==
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   582
    \<exists>dp[M]. \<exists>sdp[M]. \<exists>hsdp[M]. 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   583
	dp \<in> nat & is_depth(M,p,dp) & successor(M,dp,sdp) &
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   584
	fun_apply(M,h,sdp,hsdp) & fun_apply(M,hsdp,p,z)"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   585
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   586
lemma (in M_datatypes) is_depth_apply_abs [simp]:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   587
     "[|M(h); p \<in> formula; M(z)|] 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   588
      ==> is_depth_apply(M,h,p,z) <-> z = h ` succ(depth(p)) ` p"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   589
by (simp add: is_depth_apply_def formula_into_M depth_type eq_commute)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   590
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   591
lemma depth_apply_reflection:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   592
     "REFLECTS[\<lambda>x. is_depth_apply(L,f(x),g(x),h(x)),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   593
               \<lambda>i x. is_depth_apply(**Lset(i),f(x),g(x),h(x))]"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   594
apply (simp only: is_depth_apply_def setclass_simps)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   595
apply (intro FOL_reflections function_reflections depth_reflection)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   596
done
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   597
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   598
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   599
text{*There is at present some redundancy between the relativizations in
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   600
 e.g. @{text satisfies_is_a} and those in e.g. @{text Member_replacement}.*}
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   601
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   602
text{*These constants let us instantiate the parameters @{term a}, @{term b},
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   603
      @{term c}, @{term d}, etc., of the locale @{text M_formula_rec}.*}
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   604
constdefs
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   605
  satisfies_a :: "[i,i,i]=>i"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   606
   "satisfies_a(A) == 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   607
    \<lambda>x y. \<lambda>env \<in> list(A). bool_of_o (nth(x,env) \<in> nth(y,env))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   608
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   609
  satisfies_is_a :: "[i=>o,i,i,i,i]=>o"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   610
   "satisfies_is_a(M,A) == 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   611
    \<lambda>x y. is_lambda(M, list(A), 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   612
        \<lambda>env z. is_bool_of_o(M, \<exists>nx[M]. \<exists>ny[M]. 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   613
                  is_nth(M,x,env,nx) & is_nth(M,y,env,ny) & nx \<in> ny, z))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   614
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   615
  satisfies_b :: "[i,i,i]=>i"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   616
   "satisfies_b(A) ==
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   617
    \<lambda>x y. \<lambda>env \<in> list(A). bool_of_o (nth(x,env) = nth(y,env))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   618
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   619
  satisfies_is_b :: "[i=>o,i,i,i,i]=>o"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   620
   --{*We simplify the formula to have just @{term nx} rather than 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   621
       introducing @{term ny} with  @{term "nx=ny"} *}
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   622
   "satisfies_is_b(M,A) == 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   623
    \<lambda>x y. is_lambda(M, list(A), 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   624
         \<lambda>env z. 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   625
         is_bool_of_o(M, \<exists>nx[M]. is_nth(M,x,env,nx) & is_nth(M,y,env,nx), z))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   626
 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   627
  satisfies_c :: "[i,i,i,i,i]=>i"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   628
   "satisfies_c(A,p,q,rp,rq) == \<lambda>env \<in> list(A). not(rp ` env and rq ` env)"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   629
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   630
  satisfies_is_c :: "[i=>o,i,i,i,i,i]=>o"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   631
   "satisfies_is_c(M,A,h) == 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   632
    \<lambda>p q. is_lambda(M, list(A), 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   633
        \<lambda>env z. \<exists>hp[M]. \<exists>hq[M]. 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   634
		 (\<exists>rp[M]. is_depth_apply(M,h,p,rp) & fun_apply(M,rp,env,hp)) & 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   635
		 (\<exists>rq[M]. is_depth_apply(M,h,q,rq) & fun_apply(M,rq,env,hq)) & 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   636
                 (\<exists>pq[M]. is_and(M,hp,hq,pq) & is_not(M,pq,z)))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   637
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   638
  satisfies_d :: "[i,i,i]=>i"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   639
   "satisfies_d(A) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   640
    == \<lambda>p rp. \<lambda>env \<in> list(A). bool_of_o (\<forall>x\<in>A. rp ` (Cons(x,env)) = 1)"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   641
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   642
  satisfies_is_d :: "[i=>o,i,i,i,i]=>o"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   643
   "satisfies_is_d(M,A,h) == 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   644
    \<lambda>p. is_lambda(M, list(A), 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   645
        \<lambda>env z. \<exists>rp[M]. is_depth_apply(M,h,p,rp) & 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   646
           is_bool_of_o(M, 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   647
                \<forall>x[M]. \<forall>xenv[M]. \<forall>hp[M]. 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   648
                       x\<in>A --> is_Cons(M,x,env,xenv) --> 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   649
                       fun_apply(M,rp,xenv,hp) --> number1(M,hp),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   650
                  z))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   651
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   652
  satisfies_MH :: "[i=>o,i,i,i,i]=>o"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   653
   "satisfies_MH == 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   654
    \<lambda>M A u f. is_lambda
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   655
	 (M, formula, 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   656
          is_formula_case (M, satisfies_is_a(M,A), 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   657
                           satisfies_is_b(M,A), 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   658
                           satisfies_is_c(M,A,f), satisfies_is_d(M,A,f)))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   659
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   660
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   661
text{*Further constraints on the class @{term M} in order to prove
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   662
      absoluteness for the constants defined above.  The ultimate goal
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   663
      is the absoluteness of the function @{term satisfies}. *}
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   664
locale M_satisfies = M_datatypes +
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   665
 assumes 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   666
   Member_replacement:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   667
    "[|M(A); x \<in> nat; y \<in> nat|]
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   668
     ==> strong_replacement
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   669
	 (M, \<lambda>env z. \<exists>bo[M]. \<exists>nx[M]. \<exists>ny[M]. 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   670
              env \<in> list(A) & is_nth(M,x,env,nx) & is_nth(M,y,env,ny) & 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   671
              is_bool_of_o(M, nx \<in> ny, bo) &
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   672
              pair(M, env, bo, z))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   673
 and
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   674
   Equal_replacement:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   675
    "[|M(A); x \<in> nat; y \<in> nat|]
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   676
     ==> strong_replacement
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   677
	 (M, \<lambda>env z. \<exists>bo[M]. \<exists>nx[M]. \<exists>ny[M]. 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   678
              env \<in> list(A) & is_nth(M,x,env,nx) & is_nth(M,y,env,ny) & 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   679
              is_bool_of_o(M, nx = ny, bo) &
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   680
              pair(M, env, bo, z))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   681
 and
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   682
   Nand_replacement:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   683
    "[|M(A); M(rp); M(rq)|]
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   684
     ==> strong_replacement
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   685
	 (M, \<lambda>env z. \<exists>rpe[M]. \<exists>rqe[M]. \<exists>andpq[M]. \<exists>notpq[M]. 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   686
               fun_apply(M,rp,env,rpe) & fun_apply(M,rq,env,rqe) & 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   687
               is_and(M,rpe,rqe,andpq) & is_not(M,andpq,notpq) & 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   688
               env \<in> list(A) & pair(M, env, notpq, z))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   689
 and
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   690
  Forall_replacement:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   691
   "[|M(A); M(rp)|]
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   692
    ==> strong_replacement
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   693
	(M, \<lambda>env z. \<exists>bo[M]. 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   694
	      env \<in> list(A) & 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   695
	      is_bool_of_o (M, 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   696
			    \<forall>a[M]. \<forall>co[M]. \<forall>rpco[M]. 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   697
			       a\<in>A --> is_Cons(M,a,env,co) -->
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   698
			       fun_apply(M,rp,co,rpco) --> number1(M, rpco), 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   699
                            bo) &
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   700
	      pair(M,env,bo,z))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   701
 and
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   702
  formula_rec_replacement: 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   703
      --{*For the @{term transrec}*}
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   704
   "[|n \<in> nat; M(A)|] ==> transrec_replacement(M, satisfies_MH(M,A), n)"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   705
(*NEEDS RELATIVIZATION?*)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   706
 and
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   707
  formula_rec_lambda_replacement:  
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   708
      --{*For the @{text "\<lambda>-abstraction"} in the @{term transrec} body*}
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   709
   "M(g) ==>
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   710
    strong_replacement (M, \<lambda>x y. x \<in> formula &
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   711
            y = \<langle>x, 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   712
                 formula_rec_case(satisfies_a(A),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   713
                                  satisfies_b(A),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   714
                                  satisfies_c(A),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   715
                                  satisfies_d(A), g, x)\<rangle>)"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   716
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   717
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   718
lemma (in M_satisfies) Member_replacement':
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   719
    "[|M(A); x \<in> nat; y \<in> nat|]
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   720
     ==> strong_replacement
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   721
	 (M, \<lambda>env z. env \<in> list(A) &
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   722
		     z = \<langle>env, bool_of_o(nth(x, env) \<in> nth(y, env))\<rangle>)"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   723
by (insert Member_replacement, simp) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   724
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   725
lemma (in M_satisfies) Equal_replacement':
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   726
    "[|M(A); x \<in> nat; y \<in> nat|]
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   727
     ==> strong_replacement
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   728
	 (M, \<lambda>env z. env \<in> list(A) &
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   729
		     z = \<langle>env, bool_of_o(nth(x, env) = nth(y, env))\<rangle>)"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   730
by (insert Equal_replacement, simp) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   731
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   732
lemma (in M_satisfies) Nand_replacement':
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   733
    "[|M(A); M(rp); M(rq)|]
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   734
     ==> strong_replacement
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   735
	 (M, \<lambda>env z. env \<in> list(A) & z = \<langle>env, not(rp`env and rq`env)\<rangle>)"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   736
by (insert Nand_replacement, simp) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   737
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   738
lemma (in M_satisfies) Forall_replacement':
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   739
   "[|M(A); M(rp)|]
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   740
    ==> strong_replacement
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   741
	(M, \<lambda>env z.
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   742
	       env \<in> list(A) &
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   743
	       z = \<langle>env, bool_of_o (\<forall>a\<in>A. rp ` Cons(a,env) = 1)\<rangle>)"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   744
by (insert Forall_replacement, simp) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   745
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   746
lemma (in M_satisfies) a_closed:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   747
     "[|M(A); x\<in>nat; y\<in>nat|] ==> M(satisfies_a(A,x,y))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   748
apply (simp add: satisfies_a_def) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   749
apply (blast intro: lam_closed2 Member_replacement') 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   750
done
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   751
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   752
lemma (in M_satisfies) a_rel:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   753
     "M(A) ==> Relativize2(M, nat, nat, satisfies_is_a(M,A), satisfies_a(A))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   754
apply (simp add: Relativize2_def satisfies_is_a_def satisfies_a_def)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   755
apply (simp add: lambda_abs2 [OF Member_replacement'] Relativize1_def)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   756
done
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   757
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   758
lemma (in M_satisfies) b_closed:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   759
     "[|M(A); x\<in>nat; y\<in>nat|] ==> M(satisfies_b(A,x,y))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   760
apply (simp add: satisfies_b_def) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   761
apply (blast intro: lam_closed2 Equal_replacement') 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   762
done
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   763
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   764
lemma (in M_satisfies) b_rel:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   765
     "M(A) ==> Relativize2(M, nat, nat, satisfies_is_b(M,A), satisfies_b(A))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   766
apply (simp add: Relativize2_def satisfies_is_b_def satisfies_b_def)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   767
apply (simp add: lambda_abs2 [OF Equal_replacement'] Relativize1_def)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   768
done
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   769
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   770
lemma (in M_satisfies) c_closed:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   771
     "[|M(A); x \<in> formula; y \<in> formula; M(rx); M(ry)|] 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   772
      ==> M(satisfies_c(A,x,y,rx,ry))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   773
apply (simp add: satisfies_c_def) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   774
apply (rule lam_closed2) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   775
apply (rule Nand_replacement') 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   776
apply (simp_all add: formula_into_M list_into_M [of _ A])
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   777
done
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   778
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   779
lemma (in M_satisfies) c_rel:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   780
 "[|M(A); M(f)|] ==> 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   781
  Relativize2 (M, formula, formula, 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   782
               satisfies_is_c(M,A,f),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   783
	       \<lambda>u v. satisfies_c(A, u, v, f ` succ(depth(u)) ` u, 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   784
					  f ` succ(depth(v)) ` v))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   785
apply (simp add: Relativize2_def satisfies_is_c_def satisfies_c_def)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   786
apply (simp add: lambda_abs2 [OF Nand_replacement' triv_Relativize1] 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   787
                 formula_into_M)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   788
done
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   789
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   790
lemma (in M_satisfies) d_closed:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   791
     "[|M(A); x \<in> formula; M(rx)|] ==> M(satisfies_d(A,x,rx))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   792
apply (simp add: satisfies_d_def) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   793
apply (rule lam_closed2) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   794
apply (rule Forall_replacement') 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   795
apply (simp_all add: formula_into_M list_into_M [of _ A])
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   796
done
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   797
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   798
lemma (in M_satisfies) d_rel:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   799
 "[|M(A); M(f)|] ==> 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   800
  Relativize1(M, formula, satisfies_is_d(M,A,f), 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   801
     \<lambda>u. satisfies_d(A, u, f ` succ(depth(u)) ` u))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   802
apply (simp del: rall_abs 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   803
            add: Relativize1_def satisfies_is_d_def satisfies_d_def)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   804
apply (simp add: lambda_abs2 [OF Forall_replacement' triv_Relativize1] 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   805
                 formula_into_M)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   806
done
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   807
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   808
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   809
lemma (in M_satisfies) fr_replace:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   810
      "[|n \<in> nat; M(A)|] ==> transrec_replacement(M,satisfies_MH(M,A),n)" 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   811
by (blast intro: formula_rec_replacement) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   812
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   813
lemma (in M_satisfies) fr_lam_replace:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   814
   "M(g) ==>
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   815
    strong_replacement (M, \<lambda>x y. x \<in> formula &
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   816
            y = \<langle>x, 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   817
                 formula_rec_case(satisfies_a(A),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   818
                                  satisfies_b(A),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   819
                                  satisfies_c(A),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   820
                                  satisfies_d(A), g, x)\<rangle>)"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   821
by (blast intro: formula_rec_lambda_replacement)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   822
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   823
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   824
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   825
subsection{*Instantiating the Locale @{text "M_satisfies"}*}
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   826
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   827
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   828
subsubsection{*The @{term "Member"} Case*}
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   829
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   830
lemma Member_Reflects:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   831
 "REFLECTS[\<lambda>u. \<exists>v[L]. v \<in> B \<and> (\<exists>bo[L]. \<exists>nx[L]. \<exists>ny[L].
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   832
          v \<in> lstA \<and> is_nth(L,x,v,nx) \<and> is_nth(L,y,v,ny) \<and>
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   833
          is_bool_of_o(L, nx \<in> ny, bo) \<and> pair(L,v,bo,u)),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   834
   \<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).
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   835
             v \<in> lstA \<and> is_nth(**Lset(i), x, v, nx) \<and> 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   836
             is_nth(**Lset(i), y, v, ny) \<and>
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   837
          is_bool_of_o(**Lset(i), nx \<in> ny, bo) \<and> pair(**Lset(i), v, bo, u))]"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   838
by (intro FOL_reflections function_reflections nth_reflection 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   839
          bool_of_o_reflection)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   840
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   841
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   842
lemma Member_replacement:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   843
    "[|L(A); x \<in> nat; y \<in> nat|]
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   844
     ==> strong_replacement
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   845
	 (L, \<lambda>env z. \<exists>bo[L]. \<exists>nx[L]. \<exists>ny[L]. 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   846
              env \<in> list(A) & is_nth(L,x,env,nx) & is_nth(L,y,env,ny) & 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   847
              is_bool_of_o(L, nx \<in> ny, bo) &
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   848
              pair(L, env, bo, z))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   849
apply (frule list_closed) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   850
apply (rule strong_replacementI) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   851
apply (rule rallI)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   852
apply (rename_tac B)  
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   853
apply (rule separation_CollectI) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   854
apply (rule_tac A="{list(A),B,x,y,z}" in subset_LsetE, blast ) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   855
apply (rule ReflectsE [OF Member_Reflects], assumption)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   856
apply (drule subset_Lset_ltD, assumption) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   857
apply (erule reflection_imp_L_separation)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   858
  apply (simp_all add: lt_Ord2)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   859
apply (simp add: is_nth_def is_wfrec_def is_bool_of_o_def)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   860
apply (rule DPow_LsetI)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   861
apply (rename_tac u) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   862
apply (rule bex_iff_sats conj_iff_sats conj_iff_sats)+
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   863
apply (rule_tac env = "[v,u,list(A),B,x,y,z]" in mem_iff_sats) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   864
apply (rule sep_rules is_nat_case_iff_sats iterates_MH_iff_sats
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   865
            is_recfun_iff_sats hd_iff_sats tl_iff_sats quasinat_iff_sats
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   866
     | simp)+
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   867
done
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   868
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   869
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   870
subsubsection{*The @{term "Equal"} Case*}
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   871
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   872
lemma Equal_Reflects:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   873
 "REFLECTS[\<lambda>u. \<exists>v[L]. v \<in> B \<and> (\<exists>bo[L]. \<exists>nx[L]. \<exists>ny[L].
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   874
          v \<in> lstA \<and> is_nth(L, x, v, nx) \<and> is_nth(L, y, v, ny) \<and>
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   875
          is_bool_of_o(L, nx = ny, bo) \<and> pair(L, v, bo, u)),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   876
   \<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).
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   877
             v \<in> lstA \<and> is_nth(**Lset(i), x, v, nx) \<and> 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   878
             is_nth(**Lset(i), y, v, ny) \<and>
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   879
          is_bool_of_o(**Lset(i), nx = ny, bo) \<and> pair(**Lset(i), v, bo, u))]"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   880
by (intro FOL_reflections function_reflections nth_reflection 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   881
          bool_of_o_reflection)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   882
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   883
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   884
lemma Equal_replacement:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   885
    "[|L(A); x \<in> nat; y \<in> nat|]
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   886
     ==> strong_replacement
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   887
	 (L, \<lambda>env z. \<exists>bo[L]. \<exists>nx[L]. \<exists>ny[L]. 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   888
              env \<in> list(A) & is_nth(L,x,env,nx) & is_nth(L,y,env,ny) & 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   889
              is_bool_of_o(L, nx = ny, bo) &
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   890
              pair(L, env, bo, z))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   891
apply (frule list_closed) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   892
apply (rule strong_replacementI) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   893
apply (rule rallI)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   894
apply (rename_tac B)  
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   895
apply (rule separation_CollectI) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   896
apply (rule_tac A="{list(A),B,x,y,z}" in subset_LsetE, blast ) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   897
apply (rule ReflectsE [OF Equal_Reflects], assumption)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   898
apply (drule subset_Lset_ltD, assumption) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   899
apply (erule reflection_imp_L_separation)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   900
  apply (simp_all add: lt_Ord2)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   901
apply (simp add: is_nth_def is_wfrec_def is_bool_of_o_def)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   902
apply (rule DPow_LsetI)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   903
apply (rename_tac u) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   904
apply (rule bex_iff_sats conj_iff_sats conj_iff_sats)+
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   905
apply (rule_tac env = "[v,u,list(A),B,x,y,z]" in mem_iff_sats) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   906
apply (rule sep_rules is_nat_case_iff_sats iterates_MH_iff_sats
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   907
            is_recfun_iff_sats hd_iff_sats tl_iff_sats quasinat_iff_sats
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   908
     | simp)+
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   909
done
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   910
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   911
subsubsection{*The @{term "Nand"} Case*}
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   912
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   913
lemma Nand_Reflects:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   914
    "REFLECTS [\<lambda>x. \<exists>u[L]. u \<in> B \<and>
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   915
	       (\<exists>rpe[L]. \<exists>rqe[L]. \<exists>andpq[L]. \<exists>notpq[L].
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   916
		 fun_apply(L, rp, u, rpe) \<and> fun_apply(L, rq, u, rqe) \<and>
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   917
		 is_and(L, rpe, rqe, andpq) \<and> is_not(L, andpq, notpq) \<and>
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   918
		 u \<in> list(A) \<and> pair(L, u, notpq, x)),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   919
    \<lambda>i x. \<exists>u \<in> Lset(i). u \<in> B \<and>
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   920
     (\<exists>rpe \<in> Lset(i). \<exists>rqe \<in> Lset(i). \<exists>andpq \<in> Lset(i). \<exists>notpq \<in> Lset(i).
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   921
       fun_apply(**Lset(i), rp, u, rpe) \<and> fun_apply(**Lset(i), rq, u, rqe) \<and>
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   922
       is_and(**Lset(i), rpe, rqe, andpq) \<and> is_not(**Lset(i), andpq, notpq) \<and>
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   923
       u \<in> list(A) \<and> pair(**Lset(i), u, notpq, x))]"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   924
apply (unfold is_and_def is_not_def) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   925
apply (intro FOL_reflections function_reflections)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   926
done
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   927
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   928
lemma Nand_replacement:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   929
    "[|L(A); L(rp); L(rq)|]
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   930
     ==> strong_replacement
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   931
	 (L, \<lambda>env z. \<exists>rpe[L]. \<exists>rqe[L]. \<exists>andpq[L]. \<exists>notpq[L]. 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   932
               fun_apply(L,rp,env,rpe) & fun_apply(L,rq,env,rqe) & 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   933
               is_and(L,rpe,rqe,andpq) & is_not(L,andpq,notpq) & 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   934
               env \<in> list(A) & pair(L, env, notpq, z))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   935
apply (frule list_closed) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   936
apply (rule strong_replacementI) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   937
apply (rule rallI)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   938
apply (rename_tac B)  
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   939
apply (rule separation_CollectI) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   940
apply (rule_tac A="{list(A),B,rp,rq,z}" in subset_LsetE, blast ) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   941
apply (rule ReflectsE [OF Nand_Reflects], assumption)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   942
apply (drule subset_Lset_ltD, assumption) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   943
apply (erule reflection_imp_L_separation)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   944
  apply (simp_all add: lt_Ord2)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   945
apply (simp add: is_and_def is_not_def)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   946
apply (rule DPow_LsetI)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   947
apply (rename_tac v) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   948
apply (rule bex_iff_sats conj_iff_sats conj_iff_sats)+
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   949
apply (rule_tac env = "[u,v,list(A),B,rp,rq,z]" in mem_iff_sats) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   950
apply (rule sep_rules | simp)+
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   951
done
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   952
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   953
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   954
subsubsection{*The @{term "Forall"} Case*}
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   955
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   956
lemma Forall_Reflects:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   957
 "REFLECTS [\<lambda>x. \<exists>u[L]. u \<in> B \<and> (\<exists>bo[L]. u \<in> list(A) \<and>
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   958
                 is_bool_of_o (L,
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   959
     \<forall>a[L]. \<forall>co[L]. \<forall>rpco[L]. a \<in> A \<longrightarrow>
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   960
                is_Cons(L,a,u,co) \<longrightarrow> fun_apply(L,rp,co,rpco) \<longrightarrow> 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   961
                number1(L,rpco),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   962
                           bo) \<and> pair(L,u,bo,x)),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   963
 \<lambda>i x. \<exists>u \<in> Lset(i). u \<in> B \<and> (\<exists>bo \<in> Lset(i). u \<in> list(A) \<and>
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   964
        is_bool_of_o (**Lset(i),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   965
 \<forall>a \<in> Lset(i). \<forall>co \<in> Lset(i). \<forall>rpco \<in> Lset(i). a \<in> A \<longrightarrow>
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   966
	    is_Cons(**Lset(i),a,u,co) \<longrightarrow> fun_apply(**Lset(i),rp,co,rpco) \<longrightarrow> 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   967
	    number1(**Lset(i),rpco),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   968
		       bo) \<and> pair(**Lset(i),u,bo,x))]"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   969
apply (unfold is_bool_of_o_def) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   970
apply (intro FOL_reflections function_reflections Cons_reflection)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   971
done
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   972
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   973
lemma Forall_replacement:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   974
   "[|L(A); L(rp)|]
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   975
    ==> strong_replacement
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   976
	(L, \<lambda>env z. \<exists>bo[L]. 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   977
	      env \<in> list(A) & 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   978
	      is_bool_of_o (L, 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   979
			    \<forall>a[L]. \<forall>co[L]. \<forall>rpco[L]. 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   980
			       a\<in>A --> is_Cons(L,a,env,co) -->
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   981
			       fun_apply(L,rp,co,rpco) --> number1(L, rpco), 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   982
                            bo) &
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   983
	      pair(L,env,bo,z))"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   984
apply (frule list_closed) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   985
apply (rule strong_replacementI) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   986
apply (rule rallI)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   987
apply (rename_tac B)  
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   988
apply (rule separation_CollectI) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   989
apply (rule_tac A="{A,list(A),B,rp,z}" in subset_LsetE, blast ) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   990
apply (rule ReflectsE [OF Forall_Reflects], assumption)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   991
apply (drule subset_Lset_ltD, assumption) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   992
apply (erule reflection_imp_L_separation)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   993
  apply (simp_all add: lt_Ord2)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   994
apply (simp add: is_bool_of_o_def)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   995
apply (rule DPow_LsetI)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   996
apply (rename_tac v) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   997
apply (rule bex_iff_sats conj_iff_sats conj_iff_sats)+
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   998
apply (rule_tac env = "[u,v,A,list(A),B,rp,z]" in mem_iff_sats)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
   999
apply (rule sep_rules Cons_iff_sats | simp)+
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1000
done
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1001
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1002
subsubsection{*The @{term "transrec_replacement"} Case*}
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1003
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1004
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1005
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1006
theorem satisfies_is_a_reflection:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1007
     "REFLECTS[\<lambda>x. satisfies_is_a(L,f(x),g(x),h(x),g'(x)),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1008
               \<lambda>i x. satisfies_is_a(**Lset(i),f(x),g(x),h(x),g'(x))]"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1009
apply (unfold satisfies_is_a_def) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1010
apply (intro FOL_reflections is_lambda_reflection bool_of_o_reflection 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1011
             nth_reflection)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1012
done
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1013
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1014
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1015
theorem satisfies_is_b_reflection:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1016
     "REFLECTS[\<lambda>x. satisfies_is_b(L,f(x),g(x),h(x),g'(x)),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1017
               \<lambda>i x. satisfies_is_b(**Lset(i),f(x),g(x),h(x),g'(x))]"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1018
apply (unfold satisfies_is_b_def) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1019
apply (intro FOL_reflections is_lambda_reflection bool_of_o_reflection 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1020
             nth_reflection)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1021
done
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1022
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1023
theorem satisfies_is_c_reflection:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1024
     "REFLECTS[\<lambda>x. satisfies_is_c(L,f(x),g(x),h(x),g'(x),h'(x)),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1025
               \<lambda>i x. satisfies_is_c(**Lset(i),f(x),g(x),h(x),g'(x),h'(x))]"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1026
apply (unfold satisfies_is_c_def ) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1027
apply (intro FOL_reflections function_reflections is_lambda_reflection
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1028
             bool_of_o_reflection not_reflection and_reflection
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1029
             nth_reflection depth_apply_reflection)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1030
done
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1031
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1032
theorem satisfies_is_d_reflection:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1033
     "REFLECTS[\<lambda>x. satisfies_is_d(L,f(x),g(x),h(x),g'(x)),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1034
               \<lambda>i x. satisfies_is_d(**Lset(i),f(x),g(x),h(x),g'(x))]"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1035
apply (unfold satisfies_is_d_def ) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1036
apply (intro FOL_reflections function_reflections is_lambda_reflection
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1037
             bool_of_o_reflection not_reflection and_reflection
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1038
             nth_reflection depth_apply_reflection Cons_reflection)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1039
done
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1040
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1041
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1042
lemma formula_rec_replacement_Reflects:
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1043
 "REFLECTS [\<lambda>x. \<exists>u[L]. u \<in> B \<and> (\<exists>y[L]. pair(L, u, y, x) \<and>
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1044
             is_wfrec (L, satisfies_MH(L,A), mesa, u, y)),
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1045
    \<lambda>i x. \<exists>u \<in> Lset(i). u \<in> B \<and> (\<exists>y \<in> Lset(i). pair(**Lset(i), u, y, x) \<and>
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1046
             is_wfrec (**Lset(i), satisfies_MH(**Lset(i),A), mesa, u, y))]"
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1047
apply (unfold satisfies_MH_def) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1048
apply (intro FOL_reflections function_reflections is_wfrec_reflection
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1049
             is_lambda_reflection) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1050
apply (simp only: is_formula_case_def) 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1051
apply (intro FOL_reflections finite_ordinal_reflection mem_formula_reflection
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1052
          Member_reflection Equal_reflection Nand_reflection Forall_reflection
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1053
          satisfies_is_a_reflection satisfies_is_b_reflection 
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1054
          satisfies_is_c_reflection satisfies_is_d_reflection)
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1055
done
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1056
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1057
end
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1058
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1059
1c44289716ae new file Constructible/Satisfies_absolute.thy
paulson
parents:
diff changeset
  1060