src/HOL/MicroJava/BV/Correct.thy
changeset 11252 71c00cb091d2
parent 11178 0a9d14823644
child 11372 648795477bb5
equal deleted inserted replaced
11251:a6816d47f41d 11252:71c00cb091d2
     8 
     8 
     9 header "BV Type Safety Invariant"
     9 header "BV Type Safety Invariant"
    10 
    10 
    11 theory Correct = BVSpec:
    11 theory Correct = BVSpec:
    12 
    12 
       
    13 lemma list_all2_rev [simp]:
       
    14   "list_all2 P (rev l) (rev l') = list_all2 P l l'"
       
    15   apply (unfold list_all2_def)
       
    16   apply (simp add: zip_rev cong: conj_cong)
       
    17   done
       
    18 
    13 constdefs
    19 constdefs
    14   approx_val :: "[jvm_prog,aheap,val,ty err] => bool"
    20   approx_val :: "[jvm_prog,aheap,val,ty err] => bool"
    15   "approx_val G h v any == case any of Err => True | OK T => G,h\<turnstile>v::\<preceq>T"
    21   "approx_val G h v any == case any of Err => True | OK T => G,h\<turnstile>v::\<preceq>T"
    16 
    22 
    17   approx_loc :: "[jvm_prog,aheap,val list,locvars_type] => bool"
    23   approx_loc :: "[jvm_prog,aheap,val list,locvars_type] => bool"
    30  correct_frames  :: "[jvm_prog,aheap,prog_type,ty,sig,frame list] => bool"
    36  correct_frames  :: "[jvm_prog,aheap,prog_type,ty,sig,frame list] => bool"
    31 primrec
    37 primrec
    32 "correct_frames G hp phi rT0 sig0 [] = True"
    38 "correct_frames G hp phi rT0 sig0 [] = True"
    33 
    39 
    34 "correct_frames G hp phi rT0 sig0 (f#frs) =
    40 "correct_frames G hp phi rT0 sig0 (f#frs) =
    35 	(let (stk,loc,C,sig,pc) = f in
    41   (let (stk,loc,C,sig,pc) = f in
    36   (\<exists>ST LT rT maxs maxl ins.
    42   (\<exists>ST LT rT maxs maxl ins.
    37     phi C sig ! pc = Some (ST,LT) \<and> is_class G C \<and> 
    43     phi C sig ! pc = Some (ST,LT) \<and> is_class G C \<and> 
    38     method (G,C) sig = Some(C,rT,(maxs,maxl,ins)) \<and>
    44     method (G,C) sig = Some(C,rT,(maxs,maxl,ins)) \<and>
    39 	(\<exists>C' mn pTs k. pc = k+1 \<and> ins!k = (Invoke C' mn pTs) \<and> 
    45 	(\<exists>C' mn pTs k. pc = k+1 \<and> ins!k = (Invoke C' mn pTs) \<and> 
    40          (mn,pTs) = sig0 \<and> 
    46          (mn,pTs) = sig0 \<and> 
    69 
    75 
    70 syntax (HTML)
    76 syntax (HTML)
    71  correct_state :: "[jvm_prog,prog_type,jvm_state] => bool"
    77  correct_state :: "[jvm_prog,prog_type,jvm_state] => bool"
    72                   ("_,_ |-JVM _ [ok]"  [51,51] 50)
    78                   ("_,_ |-JVM _ [ok]"  [51,51] 50)
    73 
    79 
       
    80 
       
    81 lemma sup_ty_opt_OK:
       
    82   "(G \<turnstile> X <=o (OK T')) = (\<exists>T. X = OK T \<and> G \<turnstile> T \<preceq> T')"
       
    83   apply (cases X)
       
    84   apply auto
       
    85   done
       
    86 
       
    87 
    74 section {* approx-val *}
    88 section {* approx-val *}
    75 
    89 
    76 lemma approx_val_Err:
    90 lemma approx_val_Err [simp,intro!]:
    77   "approx_val G hp x Err"
    91   "approx_val G hp x Err"
    78 by (simp add: approx_val_def)
    92   by (simp add: approx_val_def)
    79 
    93 
    80 lemma approx_val_Null:
    94 lemma approx_val_OK [iff]: 
       
    95   "approx_val G hp x (OK T) = (G,hp \<turnstile> x ::\<preceq> T)"
       
    96   by (simp add: approx_val_def)
       
    97 
       
    98 lemma approx_val_Null [simp,intro!]:
    81   "approx_val G hp Null (OK (RefT x))"
    99   "approx_val G hp Null (OK (RefT x))"
    82 by (auto intro: null simp add: approx_val_def)
   100   by (auto simp add: approx_val_def)
    83 
   101 
    84 lemma approx_val_imp_approx_val_assConvertible [rule_format]: 
   102 lemma approx_val_sup_heap:
    85   "wf_prog wt G ==> approx_val G hp v (OK T) --> G\<turnstile> T\<preceq>T' 
   103   "\<lbrakk> approx_val G hp v T; hp \<le>| hp' \<rbrakk> \<Longrightarrow> approx_val G hp' v T"
    86   --> approx_val G hp v (OK T')"
   104   by (cases T) (blast intro: conf_hext)+
    87 by (cases T) (auto intro: conf_widen simp add: approx_val_def)
   105 
    88 
   106 lemma approx_val_heap_update:
    89 lemma approx_val_imp_approx_val_sup_heap [rule_format]:
   107   "[| hp a = Some obj'; G,hp\<turnstile> v::\<preceq>T; obj_ty obj = obj_ty obj'|] 
    90   "approx_val G hp v at --> hp \<le>| hp' --> approx_val G hp' v at"
       
    91 apply (simp add: approx_val_def split: err.split)
       
    92 apply (blast intro: conf_hext)
       
    93 done
       
    94 
       
    95 lemma approx_val_imp_approx_val_heap_update:
       
    96   "[|hp a = Some obj'; G,hp\<turnstile> v::\<preceq>T; obj_ty obj = obj_ty obj'|] 
       
    97   ==> G,hp(a\<mapsto>obj)\<turnstile> v::\<preceq>T"
   108   ==> G,hp(a\<mapsto>obj)\<turnstile> v::\<preceq>T"
    98 by (cases v, auto simp add: obj_ty_def conf_def)
   109   by (cases v, auto simp add: obj_ty_def conf_def)
    99 
   110 
   100 lemma approx_val_imp_approx_val_sup [rule_format]:
   111 lemma approx_val_widen:
   101   "wf_prog wt G ==> (approx_val G h v us) --> (G \<turnstile> us <=o us') 
   112   "\<lbrakk> approx_val G hp v T; G \<turnstile> T <=o T'; wf_prog wt G \<rbrakk>
   102   --> (approx_val G h v us')"
   113   \<Longrightarrow> approx_val G hp v T'"
   103 apply (simp add: sup_PTS_eq approx_val_def split: err.split)
   114   by (cases T', auto simp add: sup_ty_opt_OK intro: conf_widen)
   104 apply (blast intro: conf_widen)
   115 
   105 done
   116 section {* approx-loc *}
       
   117 
       
   118 lemma approx_loc_Nil [simp,intro!]:
       
   119   "approx_loc G hp [] []"
       
   120   by (simp add: approx_loc_def)
       
   121 
       
   122 lemma approx_loc_Cons [iff]:
       
   123   "approx_loc G hp (l#ls) (L#LT) = 
       
   124   (approx_val G hp l L \<and> approx_loc G hp ls LT)"
       
   125 by (simp add: approx_loc_def)
       
   126 
       
   127 lemma approx_loc_nth:
       
   128   "\<lbrakk> approx_loc G hp loc LT; n < length LT \<rbrakk>
       
   129   \<Longrightarrow> approx_val G hp (loc!n) (LT!n)"
       
   130   by (simp add: approx_loc_def list_all2_conv_all_nth)
   106 
   131 
   107 lemma approx_loc_imp_approx_val_sup:
   132 lemma approx_loc_imp_approx_val_sup:
   108   "[| wf_prog wt G; approx_loc G hp loc LT; idx < length LT; 
   133   "\<lbrakk>approx_loc G hp loc LT; n < length LT; LT ! n = OK T; G \<turnstile> T \<preceq> T'; wf_prog wt G\<rbrakk> 
   109       v = loc!idx; G \<turnstile> LT!idx <=o at |]
   134   \<Longrightarrow> G,hp \<turnstile> (loc!n) ::\<preceq> T'"
   110   ==> approx_val G hp v at"
   135   apply (drule approx_loc_nth, assumption) 
   111 apply (unfold approx_loc_def)
   136   apply simp
   112 apply (unfold list_all2_def)
   137   apply (erule conf_widen, assumption+)
   113 apply (auto intro: approx_val_imp_approx_val_sup 
   138   done
   114             simp add: split_def all_set_conv_all_nth)
   139 
   115 done
   140 lemma approx_loc_conv_all_nth:
   116 
   141   "approx_loc G hp loc LT = 
   117 
   142   (length loc = length LT \<and> (\<forall>n < length loc. approx_val G hp (loc!n) (LT!n)))"
   118 section {* approx-loc *}
   143   by (simp add: approx_loc_def list_all2_conv_all_nth)
   119 
   144 
   120 lemma approx_loc_Cons [iff]:
   145 lemma approx_loc_sup_heap:
   121   "approx_loc G hp (s#xs) (l#ls) = 
   146   "\<lbrakk> approx_loc G hp loc LT; hp \<le>| hp' \<rbrakk>
   122   (approx_val G hp s l \<and> approx_loc G hp xs ls)"
   147   \<Longrightarrow> approx_loc G hp' loc LT"
   123 by (simp add: approx_loc_def)
   148   apply (clarsimp simp add: approx_loc_conv_all_nth)
   124 
   149   apply (blast intro: approx_val_sup_heap)
   125 lemma assConv_approx_stk_imp_approx_loc [rule_format]:
   150   done
   126   "wf_prog wt G ==> (\<forall>tt'\<in>set (zip tys_n ts). tt' \<in> widen G) 
   151 
   127   --> length tys_n = length ts --> approx_stk G hp s tys_n --> 
   152 lemma approx_loc_widen:
   128   approx_loc G hp s (map OK ts)"
   153   "\<lbrakk> approx_loc G hp loc LT; G \<turnstile> LT <=l LT'; wf_prog wt G \<rbrakk>
   129 apply (unfold approx_stk_def approx_loc_def list_all2_def)
   154   \<Longrightarrow> approx_loc G hp loc LT'"
   130 apply (clarsimp simp add: all_set_conv_all_nth)
   155 apply (unfold Listn.le_def lesub_def sup_loc_def)
   131 apply (rule approx_val_imp_approx_val_assConvertible)
   156 apply (simp (no_asm_use) only: list_all2_conv_all_nth approx_loc_conv_all_nth)
   132 apply auto
   157 apply (simp (no_asm_simp))
   133 done
   158 apply clarify
   134 
   159 apply (erule allE, erule impE) 
   135 
       
   136 lemma approx_loc_imp_approx_loc_sup_heap [rule_format]:
       
   137   "\<forall>lvars. approx_loc G hp lvars lt --> hp \<le>| hp' 
       
   138   --> approx_loc G hp' lvars lt"
       
   139 apply (unfold approx_loc_def list_all2_def)
       
   140 apply (cases lt)
       
   141  apply simp
   160  apply simp
   142 apply clarsimp
   161 apply (erule approx_val_widen)
   143 apply (rule approx_val_imp_approx_val_sup_heap)
   162  apply simp
   144 apply auto
   163 apply assumption
   145 done
   164 done
   146 
   165 
   147 lemma approx_loc_imp_approx_loc_sup [rule_format]:
   166 lemma approx_loc_subst:
   148   "wf_prog wt G ==> approx_loc G hp lvars lt --> G \<turnstile> lt <=l lt' 
   167   "\<lbrakk> approx_loc G hp loc LT; approx_val G hp x X \<rbrakk>
   149   --> approx_loc G hp lvars lt'"
   168   \<Longrightarrow> approx_loc G hp (loc[idx:=x]) (LT[idx:=X])"
   150 apply (unfold Listn.le_def lesub_def sup_loc_def approx_loc_def list_all2_def)
       
   151 apply (auto simp add: all_set_conv_all_nth)
       
   152 apply (auto elim: approx_val_imp_approx_val_sup)
       
   153 done
       
   154 
       
   155 
       
   156 lemma approx_loc_imp_approx_loc_subst [rule_format]:
       
   157   "\<forall>loc idx x X. (approx_loc G hp loc LT) --> (approx_val G hp x X) 
       
   158   --> (approx_loc G hp (loc[idx:=x]) (LT[idx:=X]))"
       
   159 apply (unfold approx_loc_def list_all2_def)
   169 apply (unfold approx_loc_def list_all2_def)
   160 apply (auto dest: subsetD [OF set_update_subset_insert] simp add: zip_update)
   170 apply (auto dest: subsetD [OF set_update_subset_insert] simp add: zip_update)
   161 done
   171 done
   162 
   172 
   163 
   173 lemma approx_loc_append:
   164 lemmas [cong] = conj_cong 
   174   "length l1=length L1 \<Longrightarrow>
   165 
       
   166 lemma approx_loc_append [rule_format]:
       
   167   "\<forall>L1 l2 L2. length l1=length L1 --> 
       
   168   approx_loc G hp (l1@l2) (L1@L2) = 
   175   approx_loc G hp (l1@l2) (L1@L2) = 
   169   (approx_loc G hp l1 L1 \<and> approx_loc G hp l2 L2)"
   176   (approx_loc G hp l1 L1 \<and> approx_loc G hp l2 L2)"
   170 apply (unfold approx_loc_def list_all2_def)
   177   apply (unfold approx_loc_def list_all2_def)
   171 apply simp
   178   apply (simp cong: conj_cong)
   172 apply blast
   179   apply blast
   173 done
   180   done
   174 
       
   175 lemmas [cong del] = conj_cong
       
   176 
       
   177 
   181 
   178 section {* approx-stk *}
   182 section {* approx-stk *}
   179 
   183 
   180 lemma approx_stk_rev_lem:
   184 lemma approx_stk_rev_lem:
   181   "approx_stk G hp (rev s) (rev t) = approx_stk G hp s t"
   185   "approx_stk G hp (rev s) (rev t) = approx_stk G hp s t"
   182 apply (unfold approx_stk_def approx_loc_def list_all2_def)
   186   apply (unfold approx_stk_def approx_loc_def)
   183 apply (auto simp add: zip_rev sym [OF rev_map])
   187   apply (simp add: rev_map [THEN sym])
   184 done
   188   done
   185 
   189 
   186 lemma approx_stk_rev:
   190 lemma approx_stk_rev:
   187   "approx_stk G hp (rev s) t = approx_stk G hp s (rev t)"
   191   "approx_stk G hp (rev s) t = approx_stk G hp s (rev t)"
   188 by (auto intro: subst [OF approx_stk_rev_lem])
   192   by (auto intro: subst [OF approx_stk_rev_lem])
   189 
   193 
   190 
   194 lemma approx_stk_sup_heap:
   191 lemma approx_stk_imp_approx_stk_sup_heap [rule_format]:
   195   "\<lbrakk> approx_stk G hp stk ST; hp \<le>| hp' \<rbrakk> \<Longrightarrow> approx_stk G hp' stk ST"
   192   "\<forall>lvars. approx_stk G hp lvars lt --> hp \<le>| hp' 
   196   by (auto intro: approx_loc_sup_heap simp add: approx_stk_def)
   193   --> approx_stk G hp' lvars lt"
   197 
   194 by (auto intro: approx_loc_imp_approx_loc_sup_heap simp add: approx_stk_def)
   198 lemma approx_stk_widen:
   195 
   199   "\<lbrakk> approx_stk G hp stk ST; G \<turnstile> map OK ST <=l map OK ST'; wf_prog wt G \<rbrakk>
   196 lemma approx_stk_imp_approx_stk_sup [rule_format]:
   200   \<Longrightarrow> approx_stk G hp stk ST'" 
   197   "wf_prog wt G ==> approx_stk G hp lvars st --> (G \<turnstile> map OK st <=l (map OK st')) 
   201   by (auto elim: approx_loc_widen simp add: approx_stk_def)
   198   --> approx_stk G hp lvars st'" 
       
   199 by (auto intro: approx_loc_imp_approx_loc_sup simp add: approx_stk_def)
       
   200 
   202 
   201 lemma approx_stk_Nil [iff]:
   203 lemma approx_stk_Nil [iff]:
   202   "approx_stk G hp [] []"
   204   "approx_stk G hp [] []"
   203 by (simp add: approx_stk_def approx_loc_def)
   205   by (simp add: approx_stk_def)
   204 
   206 
   205 lemma approx_stk_Cons [iff]:
   207 lemma approx_stk_Cons [iff]:
   206   "approx_stk G hp (x # stk) (S#ST) = 
   208   "approx_stk G hp (x#stk) (S#ST) = 
   207    (approx_val G hp x (OK S) \<and> approx_stk G hp stk ST)"
   209   (approx_val G hp x (OK S) \<and> approx_stk G hp stk ST)"
   208 by (simp add: approx_stk_def approx_loc_def)
   210   by (simp add: approx_stk_def)
   209 
   211 
   210 lemma approx_stk_Cons_lemma [iff]:
   212 lemma approx_stk_Cons_lemma [iff]:
   211   "approx_stk G hp stk (S#ST') = 
   213   "approx_stk G hp stk (S#ST') = 
   212   (\<exists>s stk'. stk = s#stk' \<and> approx_val G hp s (OK S) \<and> approx_stk G hp stk' ST')"
   214   (\<exists>s stk'. stk = s#stk' \<and> approx_val G hp s (OK S) \<and> approx_stk G hp stk' ST')"
   213 by (simp add: list_all2_Cons2 approx_stk_def approx_loc_def)
   215   by (simp add: list_all2_Cons2 approx_stk_def approx_loc_def)
   214 
   216 
   215 lemma approx_stk_append_lemma:
   217 lemma approx_stk_append:
   216   "approx_stk G hp stk (S@ST') ==>
   218   "approx_stk G hp stk (S@S') \<Longrightarrow>
   217    (\<exists>s stk'. stk = s@stk' \<and> length s = length S \<and> length stk' = length ST' \<and> 
   219   (\<exists>s stk'. stk = s@stk' \<and> length s = length S \<and> length stk' = length S' \<and> 
   218              approx_stk G hp s S \<and> approx_stk G hp stk' ST')"
   220             approx_stk G hp s S \<and> approx_stk G hp stk' S')"
   219 by (simp add: list_all2_append2 approx_stk_def approx_loc_def)
   221   by (simp add: list_all2_append2 approx_stk_def approx_loc_def)
   220 
   222 
       
   223 lemma approx_stk_all_widen:
       
   224   "\<lbrakk> approx_stk G hp stk ST; \<forall>x \<in> set (zip ST ST'). x \<in> widen G; length ST = length ST'; wf_prog wt G \<rbrakk> 
       
   225   \<Longrightarrow> approx_stk G hp stk ST'"
       
   226 apply (unfold approx_stk_def)
       
   227 apply (clarsimp simp add: approx_loc_conv_all_nth all_set_conv_all_nth)
       
   228 apply (erule allE, erule impE, assumption)
       
   229 apply (erule allE, erule impE, assumption)
       
   230 apply (erule conf_widen, assumption+)
       
   231 done
   221 
   232 
   222 section {* oconf *}
   233 section {* oconf *}
   223 
   234 
   224 lemma correct_init_obj:
   235 lemma oconf_field_update:
   225   "[|is_class G C; wf_prog wt G|] ==> 
       
   226   G,h \<turnstile> (C, map_of (map (\<lambda>(f,fT).(f,default_val fT)) (fields(G,C)))) \<surd>"
       
   227 apply (unfold oconf_def lconf_def)
       
   228 apply (simp add: map_of_map)
       
   229 apply (force intro: defval_conf dest: map_of_SomeD fields_is_type)
       
   230 done
       
   231 
       
   232 
       
   233 lemma oconf_imp_oconf_field_update [rule_format]:
       
   234   "[|map_of (fields (G, oT)) FD = Some T; G,hp\<turnstile>v::\<preceq>T; G,hp\<turnstile>(oT,fs)\<surd> |]
   236   "[|map_of (fields (G, oT)) FD = Some T; G,hp\<turnstile>v::\<preceq>T; G,hp\<turnstile>(oT,fs)\<surd> |]
   235   ==> G,hp\<turnstile>(oT, fs(FD\<mapsto>v))\<surd>"
   237   ==> G,hp\<turnstile>(oT, fs(FD\<mapsto>v))\<surd>"
   236 by (simp add: oconf_def lconf_def)
   238   by (simp add: oconf_def lconf_def)
   237 
   239 
   238 lemma oconf_imp_oconf_heap_newref [rule_format]:
   240 lemma oconf_newref:
   239 "hp oref = None --> G,hp\<turnstile>obj\<surd> --> G,hp\<turnstile>obj'\<surd> --> G,(hp(oref\<mapsto>obj'))\<turnstile>obj\<surd>"
   241   "\<lbrakk>hp oref = None; G,hp \<turnstile> obj \<surd>; G,hp \<turnstile> obj' \<surd>\<rbrakk> \<Longrightarrow> G,hp(oref\<mapsto>obj') \<turnstile> obj \<surd>"
   240 apply (unfold oconf_def lconf_def)
   242   apply (unfold oconf_def lconf_def)
   241 apply simp
   243   apply simp
   242 apply (fast intro: conf_hext hext_new)
   244   apply (blast intro: conf_hext hext_new)
   243 done
   245   done
   244 
   246 
   245 lemma oconf_imp_oconf_heap_update [rule_format]:
   247 lemma oconf_heap_update:
   246   "hp a = Some obj' --> obj_ty obj' = obj_ty obj'' --> G,hp\<turnstile>obj\<surd> 
   248   "\<lbrakk> hp a = Some obj'; obj_ty obj' = obj_ty obj''; G,hp\<turnstile>obj\<surd> \<rbrakk>
   247   --> G,hp(a\<mapsto>obj'')\<turnstile>obj\<surd>"
   249   \<Longrightarrow> G,hp(a\<mapsto>obj'')\<turnstile>obj\<surd>"
   248 apply (unfold oconf_def lconf_def)
   250   apply (unfold oconf_def lconf_def)
   249 apply simp
   251   apply (fastsimp intro: approx_val_heap_update)
   250 apply (force intro: approx_val_imp_approx_val_heap_update)
   252   done
   251 done
       
   252 
       
   253 
   253 
   254 section {* hconf *}
   254 section {* hconf *}
   255 
   255 
   256 lemma hconf_imp_hconf_newref [rule_format]:
   256 lemma hconf_newref:
   257   "hp oref = None --> G\<turnstile>h hp\<surd> --> G,hp\<turnstile>obj\<surd> --> G\<turnstile>h hp(oref\<mapsto>obj)\<surd>"
   257   "\<lbrakk> hp oref = None; G\<turnstile>h hp\<surd>; G,hp\<turnstile>obj\<surd> \<rbrakk> \<Longrightarrow> G\<turnstile>h hp(oref\<mapsto>obj)\<surd>"
   258 apply (simp add: hconf_def)
   258   apply (simp add: hconf_def)
   259 apply (fast intro: oconf_imp_oconf_heap_newref)
   259   apply (fast intro: oconf_newref)
   260 done
   260   done
   261 
   261 
   262 lemma hconf_imp_hconf_field_update [rule_format]:
   262 lemma hconf_field_update:
   263   "map_of (fields (G, oT)) (F, D) = Some T \<and> hp oloc = Some(oT,fs) \<and> 
   263   "\<lbrakk> map_of (fields (G, oT)) X = Some T; hp a = Some(oT,fs); 
   264   G,hp\<turnstile>v::\<preceq>T \<and> G\<turnstile>h hp\<surd> --> G\<turnstile>h hp(oloc \<mapsto> (oT, fs((F,D)\<mapsto>v)))\<surd>"
   264      G,hp\<turnstile>v::\<preceq>T; G\<turnstile>h hp\<surd> \<rbrakk> 
   265 apply (simp add: hconf_def)
   265   \<Longrightarrow> G\<turnstile>h hp(a \<mapsto> (oT, fs(X\<mapsto>v)))\<surd>"
   266 apply (force intro: oconf_imp_oconf_heap_update oconf_imp_oconf_field_update 
   266   apply (simp add: hconf_def)
   267              simp add: obj_ty_def)
   267   apply (fastsimp intro: oconf_heap_update oconf_field_update 
   268 done
   268                   simp add: obj_ty_def)
       
   269   done
   269 
   270 
   270 section {* correct-frames *}
   271 section {* correct-frames *}
   271 
   272 
   272 lemmas [simp del] = fun_upd_apply
   273 lemmas [simp del] = fun_upd_apply
   273 
   274 
   274 lemma correct_frames_imp_correct_frames_field_update [rule_format]:
   275 lemma correct_frames_field_update [rule_format]:
   275   "\<forall>rT C sig. correct_frames G hp phi rT sig frs --> 
   276   "\<forall>rT C sig. 
   276   hp a = Some (C,od) --> map_of (fields (G, C)) fl = Some fd --> 
   277   correct_frames G hp phi rT sig frs --> 
       
   278   hp a = Some (C,fs) --> 
       
   279   map_of (fields (G, C)) fl = Some fd --> 
   277   G,hp\<turnstile>v::\<preceq>fd 
   280   G,hp\<turnstile>v::\<preceq>fd 
   278   --> correct_frames G (hp(a \<mapsto> (C, od(fl\<mapsto>v)))) phi rT sig frs";
   281   --> correct_frames G (hp(a \<mapsto> (C, fs(fl\<mapsto>v)))) phi rT sig frs";
   279 apply (induct frs)
   282 apply (induct frs)
   280  apply simp
   283  apply simp
   281 apply clarify
   284 apply clarify
   282 apply simp
   285 apply (simp (no_asm_use))
   283 apply clarify
   286 apply clarify
   284 apply (unfold correct_frame_def)
   287 apply (unfold correct_frame_def)
   285 apply (simp (no_asm_use))
   288 apply (simp (no_asm_use))
   286 apply clarsimp
   289 apply clarify
   287 apply (intro exI conjI)
   290 apply (intro exI conjI)
   288      apply simp
   291     apply assumption+
   289     apply simp
   292    apply (erule approx_stk_sup_heap)
   290    apply force
   293    apply (erule hext_upd_obj)
   291   apply simp
   294   apply (erule approx_loc_sup_heap)
   292  apply (rule approx_stk_imp_approx_stk_sup_heap)
   295   apply (erule hext_upd_obj)
   293   apply simp
   296  apply assumption+
   294  apply (rule hext_upd_obj)
   297 apply blast
   295  apply simp
   298 done
   296 apply (rule approx_loc_imp_approx_loc_sup_heap)
   299 
   297  apply simp
   300 lemma correct_frames_newref [rule_format]:
   298 apply (rule hext_upd_obj)
   301   "\<forall>rT C sig. 
   299 apply simp
   302   hp x = None \<longrightarrow> 
   300 done
   303   correct_frames G hp phi rT sig frs \<longrightarrow>
   301 
   304   G,hp \<turnstile> obj \<surd>
   302 lemma correct_frames_imp_correct_frames_newref [rule_format]:
   305   \<longrightarrow> correct_frames G (hp(x \<mapsto> obj)) phi rT sig frs"
   303   "\<forall>rT C sig. hp x = None --> correct_frames G hp phi rT sig frs \<and> oconf G hp obj 
       
   304   --> correct_frames G (hp(x \<mapsto> obj)) phi rT sig frs"
       
   305 apply (induct frs)
   306 apply (induct frs)
   306  apply simp
   307  apply simp
   307 apply (clarsimp simp add: correct_frame_def)
   308 apply clarify
       
   309 apply (simp (no_asm_use))
       
   310 apply clarify
       
   311 apply (unfold correct_frame_def)
       
   312 apply (simp (no_asm_use))
       
   313 apply clarify
   308 apply (intro exI conjI)
   314 apply (intro exI conjI)
   309      apply simp
   315     apply assumption+
   310     apply simp
   316    apply (erule approx_stk_sup_heap)
   311    apply force
   317    apply (erule hext_new)
   312   apply simp
   318   apply (erule approx_loc_sup_heap)
   313  apply (rule approx_stk_imp_approx_stk_sup_heap)
   319   apply (erule hext_new)
   314   apply simp
   320  apply assumption+
   315  apply (rule hext_new)
   321 apply blast
   316  apply simp
       
   317 apply (rule approx_loc_imp_approx_loc_sup_heap)
       
   318  apply simp
       
   319 apply (rule hext_new)
       
   320 apply simp
       
   321 done
   322 done
   322 
   323 
   323 end
   324 end
   324