src/ZF/Constructible/Datatype_absolute.thy
changeset 13353 1800e7134d2e
parent 13352 3cd767f8d78b
child 13363 c26eeb000470
     1.1 --- a/src/ZF/Constructible/Datatype_absolute.thy	Fri Jul 12 11:24:40 2002 +0200
     1.2 +++ b/src/ZF/Constructible/Datatype_absolute.thy	Fri Jul 12 16:41:39 2002 +0200
     1.3 @@ -92,33 +92,58 @@
     1.4  
     1.5  subsection {*Absoluteness for "Iterates"*}
     1.6  
     1.7 -lemma (in M_trancl) iterates_relativize:
     1.8 -  "[|n \<in> nat; M(v); \<forall>x[M]. M(F(x));
     1.9 -     strong_replacement(M, 
    1.10 -       \<lambda>x z. \<exists>y[M]. \<exists>g[M]. pair(M,x,y,z) &
    1.11 -              M_is_recfun(M, \<lambda>n f z. z = nat_case(v, \<lambda>m. F(f`m), n), 
    1.12 -                          Memrel(succ(n)), x, g) &
    1.13 -              y = nat_case(v, \<lambda>m. F(g`m), x))|] 
    1.14 -   ==> iterates(F,n,v) = z <-> 
    1.15 -       (\<exists>g[M]. is_recfun(Memrel(succ(n)), n, 
    1.16 -                             \<lambda>n g. nat_case(v, \<lambda>m. F(g`m), n), g) &
    1.17 -            z = nat_case(v, \<lambda>m. F(g`m), n))"
    1.18 -by (simp add: iterates_nat_def recursor_def transrec_def 
    1.19 -              eclose_sing_Ord_eq trans_wfrec_relativize nat_into_M
    1.20 -              wf_Memrel trans_Memrel relation_Memrel
    1.21 -              is_recfun_abs [of "\<lambda>n g. nat_case(v, \<lambda>m. F(g`m), n)"])
    1.22 +constdefs
    1.23 +
    1.24 +  iterates_MH :: "[i=>o, [i,i]=>o, i, i, i, i] => o"
    1.25 +   "iterates_MH(M,isF,v,n,g,z) ==
    1.26 +        is_nat_case(M, v, \<lambda>m u. \<exists>gm[M]. fun_apply(M,g,m,gm) & isF(gm,u),
    1.27 +                    n, z)"
    1.28 +
    1.29 +  iterates_replacement :: "[i=>o, [i,i]=>o, i] => o"
    1.30 +   "iterates_replacement(M,isF,v) ==
    1.31 +      \<forall>n[M]. n\<in>nat -->
    1.32 +         wfrec_replacement(M, iterates_MH(M,isF,v), Memrel(succ(n)))"
    1.33 +
    1.34 +lemma (in M_axioms) iterates_MH_abs:
    1.35 +  "[| relativize1(M,isF,F); M(n); M(g); M(z) |] 
    1.36 +   ==> iterates_MH(M,isF,v,n,g,z) <-> z = nat_case(v, \<lambda>m. F(g`m), n)"
    1.37 +apply (simp add: iterates_MH_def) 
    1.38 +apply (rule nat_case_abs) 
    1.39 +apply (simp_all add: relativize1_def) 
    1.40 +done
    1.41 +
    1.42 +
    1.43 +lemma (in M_axioms) iterates_imp_wfrec_replacement:
    1.44 +  "[|relativize1(M,isF,F); n \<in> nat; iterates_replacement(M,isF,v)|] 
    1.45 +   ==> wfrec_replacement(M, \<lambda>n f z. z = nat_case(v, \<lambda>m. F(f`m), n), 
    1.46 +                       Memrel(succ(n)))" 
    1.47 +by (simp add: iterates_replacement_def iterates_MH_abs)
    1.48 +
    1.49 +theorem (in M_trancl) iterates_abs:
    1.50 +  "[| iterates_replacement(M,isF,v); relativize1(M,isF,F);
    1.51 +      n \<in> nat; M(v); M(z); \<forall>x[M]. M(F(x)) |] 
    1.52 +   ==> is_wfrec(M, iterates_MH(M,isF,v), Memrel(succ(n)), n, z) <->
    1.53 +       z = iterates(F,n,v)" 
    1.54 +apply (frule iterates_imp_wfrec_replacement, assumption+)
    1.55 +apply (simp add: wf_Memrel trans_Memrel relation_Memrel nat_into_M
    1.56 +                 relativize2_def iterates_MH_abs 
    1.57 +                 iterates_nat_def recursor_def transrec_def 
    1.58 +                 eclose_sing_Ord_eq nat_into_M
    1.59 +         trans_wfrec_abs [of _ _ _ _ "\<lambda>n g. nat_case(v, \<lambda>m. F(g`m), n)"])
    1.60 +done
    1.61 +
    1.62  
    1.63  lemma (in M_wfrank) iterates_closed [intro,simp]:
    1.64 -  "[|n \<in> nat; M(v); \<forall>x[M]. M(F(x));
    1.65 -     strong_replacement(M, 
    1.66 -       \<lambda>x z. \<exists>y[M]. \<exists>g[M]. pair(M, x, y, z) &
    1.67 -              is_recfun (Memrel(succ(n)), x,
    1.68 -                         \<lambda>n f. nat_case(v, \<lambda>m. F(f`m), n), g) &
    1.69 -              y = nat_case(v, \<lambda>m. F(g`m), x))|] 
    1.70 +  "[| iterates_replacement(M,isF,v); relativize1(M,isF,F);
    1.71 +      n \<in> nat; M(v); \<forall>x[M]. M(F(x)) |] 
    1.72     ==> M(iterates(F,n,v))"
    1.73 -by (simp add: iterates_nat_def recursor_def transrec_def 
    1.74 -              eclose_sing_Ord_eq trans_wfrec_closed nat_into_M
    1.75 -              wf_Memrel trans_Memrel relation_Memrel nat_case_closed)
    1.76 +apply (frule iterates_imp_wfrec_replacement, assumption+)
    1.77 +apply (simp add: wf_Memrel trans_Memrel relation_Memrel nat_into_M
    1.78 +                 relativize2_def iterates_MH_abs 
    1.79 +                 iterates_nat_def recursor_def transrec_def 
    1.80 +                 eclose_sing_Ord_eq nat_into_M
    1.81 +         trans_wfrec_closed [of _ _ _ "\<lambda>n g. nat_case(v, \<lambda>m. F(g`m), n)"])
    1.82 +done
    1.83  
    1.84  
    1.85  constdefs
    1.86 @@ -127,60 +152,43 @@
    1.87          \<exists>n1[M]. \<exists>AX[M]. 
    1.88           number1(M,n1) & cartprod(M,A,X,AX) & is_sum(M,n1,AX,Z)"
    1.89  
    1.90 -  list_functor_case :: "[i=>o,i,i,i,i] => o"
    1.91 -    --{*Abbreviation for the definition of lists below*}
    1.92 -    "list_functor_case(M,A,g,x,y) == 
    1.93 -        is_nat_case(M, 0, 
    1.94 -             \<lambda>m u. \<exists>gm[M]. fun_apply(M,g,m,gm) & is_list_functor(M,A,gm,u),
    1.95 -             x, y)"
    1.96 -
    1.97  lemma (in M_axioms) list_functor_abs [simp]: 
    1.98       "[| M(A); M(X); M(Z) |] ==> is_list_functor(M,A,X,Z) <-> (Z = {0} + A*X)"
    1.99  by (simp add: is_list_functor_def singleton_0 nat_into_M)
   1.100  
   1.101 -lemma (in M_axioms) list_functor_case_abs: 
   1.102 -     "[| M(A); M(n); M(y); M(g) |] 
   1.103 -      ==> list_functor_case(M,A,g,n,y) <-> 
   1.104 -          y = nat_case(0, \<lambda>m. {0} + A * g`m, n)"
   1.105 -by (simp add: list_functor_case_def nat_into_M)
   1.106 -
   1.107  
   1.108  locale M_datatypes = M_wfrank +
   1.109 -  assumes list_replacement1: 
   1.110 -       "[|M(A); n \<in> nat|] ==> 
   1.111 -	strong_replacement(M, 
   1.112 -	  \<lambda>x z. \<exists>y[M]. \<exists>g[M]. \<exists>sucn[M]. \<exists>memr[M]. 
   1.113 -		 pair(M,x,y,z) & successor(M,n,sucn) & 
   1.114 -		 membership(M,sucn,memr) &
   1.115 -		 M_is_recfun(M, \<lambda>n f z. list_functor_case(M,A,f,n,z), 
   1.116 -                             memr, x, g) &
   1.117 -                 list_functor_case(M,A,g,x,y))"
   1.118 -(*THEY NEED RELATIVIZATION*)
   1.119 -      and list_replacement2: 
   1.120 -           "M(A) ==> strong_replacement(M, \<lambda>x y. y = (\<lambda>X. {0} + A * X)^x (0))"
   1.121 + assumes list_replacement1: 
   1.122 +   "M(A) ==> \<exists>zero[M]. empty(M,zero) & 
   1.123 +		       iterates_replacement(M, is_list_functor(M,A), zero)"
   1.124 +  and list_replacement2: 
   1.125 +   "M(A) ==> 
   1.126 +    \<exists>zero[M]. empty(M,zero) & 
   1.127 +	      strong_replacement(M, 
   1.128 +         \<lambda>n y. n\<in>nat & 
   1.129 +               (\<exists>sn[M]. \<exists>msn[M]. successor(M,n,sn) & membership(M,sn,msn) &
   1.130 +               is_wfrec(M, iterates_MH(M,is_list_functor(M,A), zero), 
   1.131 +                        msn, n, y)))"
   1.132  
   1.133 -
   1.134 -
   1.135 -lemma (in M_datatypes) list_replacement1':
   1.136 -  "[|M(A); n \<in> nat|]
   1.137 -   ==> strong_replacement
   1.138 -	  (M, \<lambda>x z. \<exists>y[M]. z = \<langle>x,y\<rangle> &
   1.139 -               (\<exists>g[M]. is_recfun (Memrel(succ(n)), x,
   1.140 -		          \<lambda>n f. nat_case(0, \<lambda>m. {0} + A * f`m, n), g) &
   1.141 - 	       y = nat_case(0, \<lambda>m. {0} + A * g ` m, x)))"
   1.142 -apply (insert list_replacement1 [of A n], simp add: nat_into_M)
   1.143 -apply (simp add: nat_into_M list_functor_case_abs
   1.144 -                 is_recfun_abs [of "\<lambda>n f. nat_case(0, \<lambda>m. {0} + A * f`m, n)"])
   1.145 +lemma (in M_datatypes) list_replacement1': 
   1.146 +   "M(A) ==> iterates_replacement(M, is_list_functor(M,A), 0)"
   1.147 +apply (insert list_replacement1, simp) 
   1.148  done
   1.149  
   1.150  lemma (in M_datatypes) list_replacement2': 
   1.151 -  "M(A) ==> strong_replacement(M, \<lambda>x y. y = (\<lambda>X. {0} + A * X)^x (0))"
   1.152 -by (insert list_replacement2, simp add: nat_into_M) 
   1.153 -
   1.154 +  "M(A) ==> strong_replacement(M, \<lambda>n y. n\<in>nat & y = (\<lambda>X. {0} + A * X)^n (0))"
   1.155 +apply (insert list_replacement2 [of A]) 
   1.156 +apply (rule strong_replacement_cong [THEN iffD1])  
   1.157 +apply (rule conj_cong [OF iff_refl iterates_abs [of "is_list_functor(M,A)"]]) 
   1.158 +apply (simp_all add: list_replacement1' relativize1_def) 
   1.159 +done
   1.160  
   1.161  lemma (in M_datatypes) list_closed [intro,simp]:
   1.162       "M(A) ==> M(list(A))"
   1.163 -by (simp add: list_eq_Union list_replacement1' list_replacement2')
   1.164 +apply (insert list_replacement1)
   1.165 +by  (simp add: RepFun_closed2 list_eq_Union 
   1.166 +               list_replacement2' relativize1_def
   1.167 +               iterates_closed [of "is_list_functor(M,A)"])
   1.168  
   1.169  
   1.170  end