src/ZF/Constructible/Satisfies_absolute.thy
changeset 32960 69916a850301
parent 23464 bc2563c37b1a
child 46823 57bf0cecb366
equal deleted inserted replaced
32959:23a8c5ac35f8 32960:69916a850301
     1 (*  Title:      ZF/Constructible/Satisfies_absolute.thy
     1 (*  Title:      ZF/Constructible/Satisfies_absolute.thy
     2     ID:  $Id$
       
     3     Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
     2     Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
     4 *)
     3 *)
     5 
     4 
     6 header {*Absoluteness for the Satisfies Relation on Formulas*}
     5 header {*Absoluteness for the Satisfies Relation on Formulas*}
     7 
     6 
   178 definition
   177 definition
   179   is_depth_apply :: "[i=>o,i,i,i] => o" where
   178   is_depth_apply :: "[i=>o,i,i,i] => o" where
   180    --{*Merely a useful abbreviation for the sequel.*}
   179    --{*Merely a useful abbreviation for the sequel.*}
   181   "is_depth_apply(M,h,p,z) ==
   180   "is_depth_apply(M,h,p,z) ==
   182     \<exists>dp[M]. \<exists>sdp[M]. \<exists>hsdp[M]. 
   181     \<exists>dp[M]. \<exists>sdp[M]. \<exists>hsdp[M]. 
   183 	finite_ordinal(M,dp) & is_depth(M,p,dp) & successor(M,dp,sdp) &
   182         finite_ordinal(M,dp) & is_depth(M,p,dp) & successor(M,dp,sdp) &
   184 	fun_apply(M,h,sdp,hsdp) & fun_apply(M,hsdp,p,z)"
   183         fun_apply(M,h,sdp,hsdp) & fun_apply(M,hsdp,p,z)"
   185 
   184 
   186 lemma (in M_datatypes) is_depth_apply_abs [simp]:
   185 lemma (in M_datatypes) is_depth_apply_abs [simp]:
   187      "[|M(h); p \<in> formula; M(z)|] 
   186      "[|M(h); p \<in> formula; M(z)|] 
   188       ==> is_depth_apply(M,h,p,z) <-> z = h ` succ(depth(p)) ` p"
   187       ==> is_depth_apply(M,h,p,z) <-> z = h ` succ(depth(p)) ` p"
   189 by (simp add: is_depth_apply_def formula_into_M depth_type eq_commute)
   188 by (simp add: is_depth_apply_def formula_into_M depth_type eq_commute)
   203 definition
   202 definition
   204   satisfies_is_a :: "[i=>o,i,i,i,i]=>o" where
   203   satisfies_is_a :: "[i=>o,i,i,i,i]=>o" where
   205    "satisfies_is_a(M,A) == 
   204    "satisfies_is_a(M,A) == 
   206     \<lambda>x y zz. \<forall>lA[M]. is_list(M,A,lA) -->
   205     \<lambda>x y zz. \<forall>lA[M]. is_list(M,A,lA) -->
   207              is_lambda(M, lA, 
   206              is_lambda(M, lA, 
   208 		\<lambda>env z. is_bool_of_o(M, 
   207                 \<lambda>env z. is_bool_of_o(M, 
   209                       \<exists>nx[M]. \<exists>ny[M]. 
   208                       \<exists>nx[M]. \<exists>ny[M]. 
   210  		       is_nth(M,x,env,nx) & is_nth(M,y,env,ny) & nx \<in> ny, z),
   209                        is_nth(M,x,env,nx) & is_nth(M,y,env,ny) & nx \<in> ny, z),
   211                 zz)"
   210                 zz)"
   212 
   211 
   213 definition
   212 definition
   214   satisfies_b :: "[i,i,i]=>i" where
   213   satisfies_b :: "[i,i,i]=>i" where
   215    "satisfies_b(A) ==
   214    "satisfies_b(A) ==
   233 definition
   232 definition
   234   satisfies_is_c :: "[i=>o,i,i,i,i,i]=>o" where
   233   satisfies_is_c :: "[i=>o,i,i,i,i,i]=>o" where
   235    "satisfies_is_c(M,A,h) == 
   234    "satisfies_is_c(M,A,h) == 
   236     \<lambda>p q zz. \<forall>lA[M]. is_list(M,A,lA) -->
   235     \<lambda>p q zz. \<forall>lA[M]. is_list(M,A,lA) -->
   237              is_lambda(M, lA, \<lambda>env z. \<exists>hp[M]. \<exists>hq[M]. 
   236              is_lambda(M, lA, \<lambda>env z. \<exists>hp[M]. \<exists>hq[M]. 
   238 		 (\<exists>rp[M]. is_depth_apply(M,h,p,rp) & fun_apply(M,rp,env,hp)) & 
   237                  (\<exists>rp[M]. is_depth_apply(M,h,p,rp) & fun_apply(M,rp,env,hp)) & 
   239 		 (\<exists>rq[M]. is_depth_apply(M,h,q,rq) & fun_apply(M,rq,env,hq)) & 
   238                  (\<exists>rq[M]. is_depth_apply(M,h,q,rq) & fun_apply(M,rq,env,hq)) & 
   240                  (\<exists>pq[M]. is_and(M,hp,hq,pq) & is_not(M,pq,z)),
   239                  (\<exists>pq[M]. is_and(M,hp,hq,pq) & is_not(M,pq,z)),
   241                 zz)"
   240                 zz)"
   242 
   241 
   243 definition
   242 definition
   244   satisfies_d :: "[i,i,i]=>i" where
   243   satisfies_d :: "[i,i,i]=>i" where
   292 locale M_satisfies = M_eclose +
   291 locale M_satisfies = M_eclose +
   293  assumes 
   292  assumes 
   294    Member_replacement:
   293    Member_replacement:
   295     "[|M(A); x \<in> nat; y \<in> nat|]
   294     "[|M(A); x \<in> nat; y \<in> nat|]
   296      ==> strong_replacement
   295      ==> strong_replacement
   297 	 (M, \<lambda>env z. \<exists>bo[M]. \<exists>nx[M]. \<exists>ny[M]. 
   296          (M, \<lambda>env z. \<exists>bo[M]. \<exists>nx[M]. \<exists>ny[M]. 
   298               env \<in> list(A) & is_nth(M,x,env,nx) & is_nth(M,y,env,ny) & 
   297               env \<in> list(A) & is_nth(M,x,env,nx) & is_nth(M,y,env,ny) & 
   299               is_bool_of_o(M, nx \<in> ny, bo) &
   298               is_bool_of_o(M, nx \<in> ny, bo) &
   300               pair(M, env, bo, z))"
   299               pair(M, env, bo, z))"
   301  and
   300  and
   302    Equal_replacement:
   301    Equal_replacement:
   303     "[|M(A); x \<in> nat; y \<in> nat|]
   302     "[|M(A); x \<in> nat; y \<in> nat|]
   304      ==> strong_replacement
   303      ==> strong_replacement
   305 	 (M, \<lambda>env z. \<exists>bo[M]. \<exists>nx[M]. \<exists>ny[M]. 
   304          (M, \<lambda>env z. \<exists>bo[M]. \<exists>nx[M]. \<exists>ny[M]. 
   306               env \<in> list(A) & is_nth(M,x,env,nx) & is_nth(M,y,env,ny) & 
   305               env \<in> list(A) & is_nth(M,x,env,nx) & is_nth(M,y,env,ny) & 
   307               is_bool_of_o(M, nx = ny, bo) &
   306               is_bool_of_o(M, nx = ny, bo) &
   308               pair(M, env, bo, z))"
   307               pair(M, env, bo, z))"
   309  and
   308  and
   310    Nand_replacement:
   309    Nand_replacement:
   311     "[|M(A); M(rp); M(rq)|]
   310     "[|M(A); M(rp); M(rq)|]
   312      ==> strong_replacement
   311      ==> strong_replacement
   313 	 (M, \<lambda>env z. \<exists>rpe[M]. \<exists>rqe[M]. \<exists>andpq[M]. \<exists>notpq[M]. 
   312          (M, \<lambda>env z. \<exists>rpe[M]. \<exists>rqe[M]. \<exists>andpq[M]. \<exists>notpq[M]. 
   314                fun_apply(M,rp,env,rpe) & fun_apply(M,rq,env,rqe) & 
   313                fun_apply(M,rp,env,rpe) & fun_apply(M,rq,env,rqe) & 
   315                is_and(M,rpe,rqe,andpq) & is_not(M,andpq,notpq) & 
   314                is_and(M,rpe,rqe,andpq) & is_not(M,andpq,notpq) & 
   316                env \<in> list(A) & pair(M, env, notpq, z))"
   315                env \<in> list(A) & pair(M, env, notpq, z))"
   317  and
   316  and
   318   Forall_replacement:
   317   Forall_replacement:
   319    "[|M(A); M(rp)|]
   318    "[|M(A); M(rp)|]
   320     ==> strong_replacement
   319     ==> strong_replacement
   321 	(M, \<lambda>env z. \<exists>bo[M]. 
   320         (M, \<lambda>env z. \<exists>bo[M]. 
   322 	      env \<in> list(A) & 
   321               env \<in> list(A) & 
   323 	      is_bool_of_o (M, 
   322               is_bool_of_o (M, 
   324 			    \<forall>a[M]. \<forall>co[M]. \<forall>rpco[M]. 
   323                             \<forall>a[M]. \<forall>co[M]. \<forall>rpco[M]. 
   325 			       a\<in>A --> is_Cons(M,a,env,co) -->
   324                                a\<in>A --> is_Cons(M,a,env,co) -->
   326 			       fun_apply(M,rp,co,rpco) --> number1(M, rpco), 
   325                                fun_apply(M,rp,co,rpco) --> number1(M, rpco), 
   327                             bo) &
   326                             bo) &
   328 	      pair(M,env,bo,z))"
   327               pair(M,env,bo,z))"
   329  and
   328  and
   330   formula_rec_replacement: 
   329   formula_rec_replacement: 
   331       --{*For the @{term transrec}*}
   330       --{*For the @{term transrec}*}
   332    "[|n \<in> nat; M(A)|] ==> transrec_replacement(M, satisfies_MH(M,A), n)"
   331    "[|n \<in> nat; M(A)|] ==> transrec_replacement(M, satisfies_MH(M,A), n)"
   333  and
   332  and
   344 
   343 
   345 
   344 
   346 lemma (in M_satisfies) Member_replacement':
   345 lemma (in M_satisfies) Member_replacement':
   347     "[|M(A); x \<in> nat; y \<in> nat|]
   346     "[|M(A); x \<in> nat; y \<in> nat|]
   348      ==> strong_replacement
   347      ==> strong_replacement
   349 	 (M, \<lambda>env z. env \<in> list(A) &
   348          (M, \<lambda>env z. env \<in> list(A) &
   350 		     z = \<langle>env, bool_of_o(nth(x, env) \<in> nth(y, env))\<rangle>)"
   349                      z = \<langle>env, bool_of_o(nth(x, env) \<in> nth(y, env))\<rangle>)"
   351 by (insert Member_replacement, simp) 
   350 by (insert Member_replacement, simp) 
   352 
   351 
   353 lemma (in M_satisfies) Equal_replacement':
   352 lemma (in M_satisfies) Equal_replacement':
   354     "[|M(A); x \<in> nat; y \<in> nat|]
   353     "[|M(A); x \<in> nat; y \<in> nat|]
   355      ==> strong_replacement
   354      ==> strong_replacement
   356 	 (M, \<lambda>env z. env \<in> list(A) &
   355          (M, \<lambda>env z. env \<in> list(A) &
   357 		     z = \<langle>env, bool_of_o(nth(x, env) = nth(y, env))\<rangle>)"
   356                      z = \<langle>env, bool_of_o(nth(x, env) = nth(y, env))\<rangle>)"
   358 by (insert Equal_replacement, simp) 
   357 by (insert Equal_replacement, simp) 
   359 
   358 
   360 lemma (in M_satisfies) Nand_replacement':
   359 lemma (in M_satisfies) Nand_replacement':
   361     "[|M(A); M(rp); M(rq)|]
   360     "[|M(A); M(rp); M(rq)|]
   362      ==> strong_replacement
   361      ==> strong_replacement
   363 	 (M, \<lambda>env z. env \<in> list(A) & z = \<langle>env, not(rp`env and rq`env)\<rangle>)"
   362          (M, \<lambda>env z. env \<in> list(A) & z = \<langle>env, not(rp`env and rq`env)\<rangle>)"
   364 by (insert Nand_replacement, simp) 
   363 by (insert Nand_replacement, simp) 
   365 
   364 
   366 lemma (in M_satisfies) Forall_replacement':
   365 lemma (in M_satisfies) Forall_replacement':
   367    "[|M(A); M(rp)|]
   366    "[|M(A); M(rp)|]
   368     ==> strong_replacement
   367     ==> strong_replacement
   369 	(M, \<lambda>env z.
   368         (M, \<lambda>env z.
   370 	       env \<in> list(A) &
   369                env \<in> list(A) &
   371 	       z = \<langle>env, bool_of_o (\<forall>a\<in>A. rp ` Cons(a,env) = 1)\<rangle>)"
   370                z = \<langle>env, bool_of_o (\<forall>a\<in>A. rp ` Cons(a,env) = 1)\<rangle>)"
   372 by (insert Forall_replacement, simp) 
   371 by (insert Forall_replacement, simp) 
   373 
   372 
   374 lemma (in M_satisfies) a_closed:
   373 lemma (in M_satisfies) a_closed:
   375      "[|M(A); x\<in>nat; y\<in>nat|] ==> M(satisfies_a(A,x,y))"
   374      "[|M(A); x\<in>nat; y\<in>nat|] ==> M(satisfies_a(A,x,y))"
   376 apply (simp add: satisfies_a_def) 
   375 apply (simp add: satisfies_a_def) 
   406 
   405 
   407 lemma (in M_satisfies) c_rel:
   406 lemma (in M_satisfies) c_rel:
   408  "[|M(A); M(f)|] ==> 
   407  "[|M(A); M(f)|] ==> 
   409   Relation2 (M, formula, formula, 
   408   Relation2 (M, formula, formula, 
   410                satisfies_is_c(M,A,f),
   409                satisfies_is_c(M,A,f),
   411 	       \<lambda>u v. satisfies_c(A, u, v, f ` succ(depth(u)) ` u, 
   410                \<lambda>u v. satisfies_c(A, u, v, f ` succ(depth(u)) ` u, 
   412 					  f ` succ(depth(v)) ` v))"
   411                                           f ` succ(depth(v)) ` v))"
   413 apply (simp add: Relation2_def satisfies_is_c_def satisfies_c_def)
   412 apply (simp add: Relation2_def satisfies_is_c_def satisfies_c_def)
   414 apply (auto del: iffI intro!: lambda_abs2 
   413 apply (auto del: iffI intro!: lambda_abs2 
   415             simp add: Relation1_def formula_into_M) 
   414             simp add: Relation1_def formula_into_M) 
   416 done
   415 done
   417 
   416 
   465       Function @{term satisfies}*}
   464       Function @{term satisfies}*}
   466 
   465 
   467 lemma (in M_satisfies) Formula_Rec_axioms_M:
   466 lemma (in M_satisfies) Formula_Rec_axioms_M:
   468    "M(A) ==>
   467    "M(A) ==>
   469     Formula_Rec_axioms(M, satisfies_a(A), satisfies_is_a(M,A), 
   468     Formula_Rec_axioms(M, satisfies_a(A), satisfies_is_a(M,A), 
   470 			  satisfies_b(A), satisfies_is_b(M,A), 
   469                           satisfies_b(A), satisfies_is_b(M,A), 
   471 			  satisfies_c(A), satisfies_is_c(M,A), 
   470                           satisfies_c(A), satisfies_is_c(M,A), 
   472 			  satisfies_d(A), satisfies_is_d(M,A))"
   471                           satisfies_d(A), satisfies_is_d(M,A))"
   473 apply (rule Formula_Rec_axioms.intro)
   472 apply (rule Formula_Rec_axioms.intro)
   474 apply (assumption | 
   473 apply (assumption | 
   475        rule a_closed a_rel b_closed b_rel c_closed c_rel d_closed d_rel
   474        rule a_closed a_rel b_closed b_rel c_closed c_rel d_closed d_rel
   476        fr_replace [unfolded satisfies_MH_def]
   475        fr_replace [unfolded satisfies_MH_def]
   477        fr_lam_replace) +
   476        fr_lam_replace) +
   479 
   478 
   480 
   479 
   481 theorem (in M_satisfies) Formula_Rec_M: 
   480 theorem (in M_satisfies) Formula_Rec_M: 
   482     "M(A) ==>
   481     "M(A) ==>
   483      PROP Formula_Rec(M, satisfies_a(A), satisfies_is_a(M,A), 
   482      PROP Formula_Rec(M, satisfies_a(A), satisfies_is_a(M,A), 
   484 			 satisfies_b(A), satisfies_is_b(M,A), 
   483                          satisfies_b(A), satisfies_is_b(M,A), 
   485 			 satisfies_c(A), satisfies_is_c(M,A), 
   484                          satisfies_c(A), satisfies_is_c(M,A), 
   486 			 satisfies_d(A), satisfies_is_d(M,A))"
   485                          satisfies_d(A), satisfies_is_d(M,A))"
   487   apply (rule Formula_Rec.intro)
   486   apply (rule Formula_Rec.intro)
   488    apply (rule M_satisfies.axioms, rule M_satisfies_axioms)
   487    apply (rule M_satisfies.axioms, rule M_satisfies_axioms)
   489   apply (erule Formula_Rec_axioms_M) 
   488   apply (erule Formula_Rec_axioms_M) 
   490   done
   489   done
   491 
   490 
   511 subsubsection{*The Operator @{term is_depth_apply}, Internalized*}
   510 subsubsection{*The Operator @{term is_depth_apply}, Internalized*}
   512 
   511 
   513 (* is_depth_apply(M,h,p,z) ==
   512 (* is_depth_apply(M,h,p,z) ==
   514     \<exists>dp[M]. \<exists>sdp[M]. \<exists>hsdp[M]. 
   513     \<exists>dp[M]. \<exists>sdp[M]. \<exists>hsdp[M]. 
   515       2        1         0
   514       2        1         0
   516 	finite_ordinal(M,dp) & is_depth(M,p,dp) & successor(M,dp,sdp) &
   515         finite_ordinal(M,dp) & is_depth(M,p,dp) & successor(M,dp,sdp) &
   517 	fun_apply(M,h,sdp,hsdp) & fun_apply(M,hsdp,p,z) *)
   516         fun_apply(M,h,sdp,hsdp) & fun_apply(M,hsdp,p,z) *)
   518 definition
   517 definition
   519   depth_apply_fm :: "[i,i,i]=>i" where
   518   depth_apply_fm :: "[i,i,i]=>i" where
   520     "depth_apply_fm(h,p,z) ==
   519     "depth_apply_fm(h,p,z) ==
   521        Exists(Exists(Exists(
   520        Exists(Exists(Exists(
   522         And(finite_ordinal_fm(2),
   521         And(finite_ordinal_fm(2),
   552 subsubsection{*The Operator @{term satisfies_is_a}, Internalized*}
   551 subsubsection{*The Operator @{term satisfies_is_a}, Internalized*}
   553 
   552 
   554 (* satisfies_is_a(M,A) == 
   553 (* satisfies_is_a(M,A) == 
   555     \<lambda>x y zz. \<forall>lA[M]. is_list(M,A,lA) -->
   554     \<lambda>x y zz. \<forall>lA[M]. is_list(M,A,lA) -->
   556              is_lambda(M, lA, 
   555              is_lambda(M, lA, 
   557 		\<lambda>env z. is_bool_of_o(M, 
   556                 \<lambda>env z. is_bool_of_o(M, 
   558                       \<exists>nx[M]. \<exists>ny[M]. 
   557                       \<exists>nx[M]. \<exists>ny[M]. 
   559  		       is_nth(M,x,env,nx) & is_nth(M,y,env,ny) & nx \<in> ny, z),
   558                        is_nth(M,x,env,nx) & is_nth(M,y,env,ny) & nx \<in> ny, z),
   560                 zz)  *)
   559                 zz)  *)
   561 
   560 
   562 definition
   561 definition
   563   satisfies_is_a_fm :: "[i,i,i,i]=>i" where
   562   satisfies_is_a_fm :: "[i,i,i,i]=>i" where
   564   "satisfies_is_a_fm(A,x,y,z) ==
   563   "satisfies_is_a_fm(A,x,y,z) ==
   654 subsubsection{*The Operator @{term satisfies_is_c}, Internalized*}
   653 subsubsection{*The Operator @{term satisfies_is_c}, Internalized*}
   655 
   654 
   656 (* satisfies_is_c(M,A,h) == 
   655 (* satisfies_is_c(M,A,h) == 
   657     \<lambda>p q zz. \<forall>lA[M]. is_list(M,A,lA) -->
   656     \<lambda>p q zz. \<forall>lA[M]. is_list(M,A,lA) -->
   658              is_lambda(M, lA, \<lambda>env z. \<exists>hp[M]. \<exists>hq[M]. 
   657              is_lambda(M, lA, \<lambda>env z. \<exists>hp[M]. \<exists>hq[M]. 
   659 		 (\<exists>rp[M]. is_depth_apply(M,h,p,rp) & fun_apply(M,rp,env,hp)) & 
   658                  (\<exists>rp[M]. is_depth_apply(M,h,p,rp) & fun_apply(M,rp,env,hp)) & 
   660 		 (\<exists>rq[M]. is_depth_apply(M,h,q,rq) & fun_apply(M,rq,env,hq)) & 
   659                  (\<exists>rq[M]. is_depth_apply(M,h,q,rq) & fun_apply(M,rq,env,hq)) & 
   661                  (\<exists>pq[M]. is_and(M,hp,hq,pq) & is_not(M,pq,z)),
   660                  (\<exists>pq[M]. is_and(M,hp,hq,pq) & is_not(M,pq,z)),
   662                 zz) *)
   661                 zz) *)
   663 
   662 
   664 definition
   663 definition
   665   satisfies_is_c_fm :: "[i,i,i,i,i]=>i" where
   664   satisfies_is_c_fm :: "[i,i,i,i,i]=>i" where
   834 
   833 
   835 
   834 
   836 lemma Member_replacement:
   835 lemma Member_replacement:
   837     "[|L(A); x \<in> nat; y \<in> nat|]
   836     "[|L(A); x \<in> nat; y \<in> nat|]
   838      ==> strong_replacement
   837      ==> strong_replacement
   839 	 (L, \<lambda>env z. \<exists>bo[L]. \<exists>nx[L]. \<exists>ny[L]. 
   838          (L, \<lambda>env z. \<exists>bo[L]. \<exists>nx[L]. \<exists>ny[L]. 
   840               env \<in> list(A) & is_nth(L,x,env,nx) & is_nth(L,y,env,ny) & 
   839               env \<in> list(A) & is_nth(L,x,env,nx) & is_nth(L,y,env,ny) & 
   841               is_bool_of_o(L, nx \<in> ny, bo) &
   840               is_bool_of_o(L, nx \<in> ny, bo) &
   842               pair(L, env, bo, z))"
   841               pair(L, env, bo, z))"
   843 apply (rule strong_replacementI)
   842 apply (rule strong_replacementI)
   844 apply (rule_tac u="{list(A),B,x,y}" 
   843 apply (rule_tac u="{list(A),B,x,y}" 
   864 
   863 
   865 
   864 
   866 lemma Equal_replacement:
   865 lemma Equal_replacement:
   867     "[|L(A); x \<in> nat; y \<in> nat|]
   866     "[|L(A); x \<in> nat; y \<in> nat|]
   868      ==> strong_replacement
   867      ==> strong_replacement
   869 	 (L, \<lambda>env z. \<exists>bo[L]. \<exists>nx[L]. \<exists>ny[L]. 
   868          (L, \<lambda>env z. \<exists>bo[L]. \<exists>nx[L]. \<exists>ny[L]. 
   870               env \<in> list(A) & is_nth(L,x,env,nx) & is_nth(L,y,env,ny) & 
   869               env \<in> list(A) & is_nth(L,x,env,nx) & is_nth(L,y,env,ny) & 
   871               is_bool_of_o(L, nx = ny, bo) &
   870               is_bool_of_o(L, nx = ny, bo) &
   872               pair(L, env, bo, z))"
   871               pair(L, env, bo, z))"
   873 apply (rule strong_replacementI)
   872 apply (rule strong_replacementI)
   874 apply (rule_tac u="{list(A),B,x,y}" 
   873 apply (rule_tac u="{list(A),B,x,y}" 
   880 
   879 
   881 subsubsection{*The @{term "Nand"} Case*}
   880 subsubsection{*The @{term "Nand"} Case*}
   882 
   881 
   883 lemma Nand_Reflects:
   882 lemma Nand_Reflects:
   884     "REFLECTS [\<lambda>x. \<exists>u[L]. u \<in> B \<and>
   883     "REFLECTS [\<lambda>x. \<exists>u[L]. u \<in> B \<and>
   885 	       (\<exists>rpe[L]. \<exists>rqe[L]. \<exists>andpq[L]. \<exists>notpq[L].
   884                (\<exists>rpe[L]. \<exists>rqe[L]. \<exists>andpq[L]. \<exists>notpq[L].
   886 		 fun_apply(L, rp, u, rpe) \<and> fun_apply(L, rq, u, rqe) \<and>
   885                  fun_apply(L, rp, u, rpe) \<and> fun_apply(L, rq, u, rqe) \<and>
   887 		 is_and(L, rpe, rqe, andpq) \<and> is_not(L, andpq, notpq) \<and>
   886                  is_and(L, rpe, rqe, andpq) \<and> is_not(L, andpq, notpq) \<and>
   888 		 u \<in> list(A) \<and> pair(L, u, notpq, x)),
   887                  u \<in> list(A) \<and> pair(L, u, notpq, x)),
   889     \<lambda>i x. \<exists>u \<in> Lset(i). u \<in> B \<and>
   888     \<lambda>i x. \<exists>u \<in> Lset(i). u \<in> B \<and>
   890      (\<exists>rpe \<in> Lset(i). \<exists>rqe \<in> Lset(i). \<exists>andpq \<in> Lset(i). \<exists>notpq \<in> Lset(i).
   889      (\<exists>rpe \<in> Lset(i). \<exists>rqe \<in> Lset(i). \<exists>andpq \<in> Lset(i). \<exists>notpq \<in> Lset(i).
   891        fun_apply(##Lset(i), rp, u, rpe) \<and> fun_apply(##Lset(i), rq, u, rqe) \<and>
   890        fun_apply(##Lset(i), rp, u, rpe) \<and> fun_apply(##Lset(i), rq, u, rqe) \<and>
   892        is_and(##Lset(i), rpe, rqe, andpq) \<and> is_not(##Lset(i), andpq, notpq) \<and>
   891        is_and(##Lset(i), rpe, rqe, andpq) \<and> is_not(##Lset(i), andpq, notpq) \<and>
   893        u \<in> list(A) \<and> pair(##Lset(i), u, notpq, x))]"
   892        u \<in> list(A) \<and> pair(##Lset(i), u, notpq, x))]"
   896 done
   895 done
   897 
   896 
   898 lemma Nand_replacement:
   897 lemma Nand_replacement:
   899     "[|L(A); L(rp); L(rq)|]
   898     "[|L(A); L(rp); L(rq)|]
   900      ==> strong_replacement
   899      ==> strong_replacement
   901 	 (L, \<lambda>env z. \<exists>rpe[L]. \<exists>rqe[L]. \<exists>andpq[L]. \<exists>notpq[L]. 
   900          (L, \<lambda>env z. \<exists>rpe[L]. \<exists>rqe[L]. \<exists>andpq[L]. \<exists>notpq[L]. 
   902                fun_apply(L,rp,env,rpe) & fun_apply(L,rq,env,rqe) & 
   901                fun_apply(L,rp,env,rpe) & fun_apply(L,rq,env,rqe) & 
   903                is_and(L,rpe,rqe,andpq) & is_not(L,andpq,notpq) & 
   902                is_and(L,rpe,rqe,andpq) & is_not(L,andpq,notpq) & 
   904                env \<in> list(A) & pair(L, env, notpq, z))"
   903                env \<in> list(A) & pair(L, env, notpq, z))"
   905 apply (rule strong_replacementI)
   904 apply (rule strong_replacementI)
   906 apply (rule_tac u="{list(A),B,rp,rq}" 
   905 apply (rule_tac u="{list(A),B,rp,rq}" 
   921                 number1(L,rpco),
   920                 number1(L,rpco),
   922                            bo) \<and> pair(L,u,bo,x)),
   921                            bo) \<and> pair(L,u,bo,x)),
   923  \<lambda>i x. \<exists>u \<in> Lset(i). u \<in> B \<and> (\<exists>bo \<in> Lset(i). u \<in> list(A) \<and>
   922  \<lambda>i x. \<exists>u \<in> Lset(i). u \<in> B \<and> (\<exists>bo \<in> Lset(i). u \<in> list(A) \<and>
   924         is_bool_of_o (##Lset(i),
   923         is_bool_of_o (##Lset(i),
   925  \<forall>a \<in> Lset(i). \<forall>co \<in> Lset(i). \<forall>rpco \<in> Lset(i). a \<in> A \<longrightarrow>
   924  \<forall>a \<in> Lset(i). \<forall>co \<in> Lset(i). \<forall>rpco \<in> Lset(i). a \<in> A \<longrightarrow>
   926 	    is_Cons(##Lset(i),a,u,co) \<longrightarrow> fun_apply(##Lset(i),rp,co,rpco) \<longrightarrow> 
   925             is_Cons(##Lset(i),a,u,co) \<longrightarrow> fun_apply(##Lset(i),rp,co,rpco) \<longrightarrow> 
   927 	    number1(##Lset(i),rpco),
   926             number1(##Lset(i),rpco),
   928 		       bo) \<and> pair(##Lset(i),u,bo,x))]"
   927                        bo) \<and> pair(##Lset(i),u,bo,x))]"
   929 apply (unfold is_bool_of_o_def) 
   928 apply (unfold is_bool_of_o_def) 
   930 apply (intro FOL_reflections function_reflections Cons_reflection)
   929 apply (intro FOL_reflections function_reflections Cons_reflection)
   931 done
   930 done
   932 
   931 
   933 lemma Forall_replacement:
   932 lemma Forall_replacement:
   934    "[|L(A); L(rp)|]
   933    "[|L(A); L(rp)|]
   935     ==> strong_replacement
   934     ==> strong_replacement
   936 	(L, \<lambda>env z. \<exists>bo[L]. 
   935         (L, \<lambda>env z. \<exists>bo[L]. 
   937 	      env \<in> list(A) & 
   936               env \<in> list(A) & 
   938 	      is_bool_of_o (L, 
   937               is_bool_of_o (L, 
   939 			    \<forall>a[L]. \<forall>co[L]. \<forall>rpco[L]. 
   938                             \<forall>a[L]. \<forall>co[L]. \<forall>rpco[L]. 
   940 			       a\<in>A --> is_Cons(L,a,env,co) -->
   939                                a\<in>A --> is_Cons(L,a,env,co) -->
   941 			       fun_apply(L,rp,co,rpco) --> number1(L, rpco), 
   940                                fun_apply(L,rp,co,rpco) --> number1(L, rpco), 
   942                             bo) &
   941                             bo) &
   943 	      pair(L,env,bo,z))"
   942               pair(L,env,bo,z))"
   944 apply (rule strong_replacementI)
   943 apply (rule strong_replacementI)
   945 apply (rule_tac u="{A,list(A),B,rp}" 
   944 apply (rule_tac u="{A,list(A),B,rp}" 
   946          in gen_separation_multi [OF Forall_Reflects],
   945          in gen_separation_multi [OF Forall_Reflects],
   947        auto simp add: list_closed)
   946        auto simp add: list_closed)
   948 apply (rule_tac env="[A,list(A),B,rp]" in DPow_LsetI)
   947 apply (rule_tac env="[A,list(A),B,rp]" in DPow_LsetI)
   976 
   975 
   977 lemma formula_rec_lambda_replacement_Reflects:
   976 lemma formula_rec_lambda_replacement_Reflects:
   978  "REFLECTS [\<lambda>x. \<exists>u[L]. u \<in> B &
   977  "REFLECTS [\<lambda>x. \<exists>u[L]. u \<in> B &
   979      mem_formula(L,u) &
   978      mem_formula(L,u) &
   980      (\<exists>c[L].
   979      (\<exists>c[L].
   981 	 is_formula_case
   980          is_formula_case
   982 	  (L, satisfies_is_a(L,A), satisfies_is_b(L,A),
   981           (L, satisfies_is_a(L,A), satisfies_is_b(L,A),
   983 	   satisfies_is_c(L,A,g), satisfies_is_d(L,A,g),
   982            satisfies_is_c(L,A,g), satisfies_is_d(L,A,g),
   984 	   u, c) &
   983            u, c) &
   985 	 pair(L,u,c,x)),
   984          pair(L,u,c,x)),
   986   \<lambda>i x. \<exists>u \<in> Lset(i). u \<in> B & mem_formula(##Lset(i),u) &
   985   \<lambda>i x. \<exists>u \<in> Lset(i). u \<in> B & mem_formula(##Lset(i),u) &
   987      (\<exists>c \<in> Lset(i).
   986      (\<exists>c \<in> Lset(i).
   988 	 is_formula_case
   987          is_formula_case
   989 	  (##Lset(i), satisfies_is_a(##Lset(i),A), satisfies_is_b(##Lset(i),A),
   988           (##Lset(i), satisfies_is_a(##Lset(i),A), satisfies_is_b(##Lset(i),A),
   990 	   satisfies_is_c(##Lset(i),A,g), satisfies_is_d(##Lset(i),A,g),
   989            satisfies_is_c(##Lset(i),A,g), satisfies_is_d(##Lset(i),A,g),
   991 	   u, c) &
   990            u, c) &
   992 	 pair(##Lset(i),u,c,x))]"
   991          pair(##Lset(i),u,c,x))]"
   993 by (intro FOL_reflections function_reflections mem_formula_reflection
   992 by (intro FOL_reflections function_reflections mem_formula_reflection
   994           is_formula_case_reflection satisfies_is_a_reflection
   993           is_formula_case_reflection satisfies_is_a_reflection
   995           satisfies_is_b_reflection satisfies_is_c_reflection
   994           satisfies_is_b_reflection satisfies_is_c_reflection
   996           satisfies_is_d_reflection)  
   995           satisfies_is_d_reflection)  
   997 
   996 
  1020 subsection{*Instantiating @{text M_satisfies}*}
  1019 subsection{*Instantiating @{text M_satisfies}*}
  1021 
  1020 
  1022 lemma M_satisfies_axioms_L: "M_satisfies_axioms(L)"
  1021 lemma M_satisfies_axioms_L: "M_satisfies_axioms(L)"
  1023   apply (rule M_satisfies_axioms.intro)
  1022   apply (rule M_satisfies_axioms.intro)
  1024        apply (assumption | rule
  1023        apply (assumption | rule
  1025 	 Member_replacement Equal_replacement 
  1024          Member_replacement Equal_replacement 
  1026          Nand_replacement Forall_replacement
  1025          Nand_replacement Forall_replacement
  1027          formula_rec_replacement formula_rec_lambda_replacement)+
  1026          formula_rec_replacement formula_rec_lambda_replacement)+
  1028   done
  1027   done
  1029 
  1028 
  1030 theorem M_satisfies_L: "PROP M_satisfies(L)"
  1029 theorem M_satisfies_L: "PROP M_satisfies(L)"