src/HOL/MicroJava/BV/BVSpecTypeSafe.thy
changeset 13006 51c5f3f11d16
parent 12951 a9fdcb71d252
child 13052 3bf41c474a88
equal deleted inserted replaced
13005:42a54d6cec15 13006:51c5f3f11d16
    29 text {*
    29 text {*
    30   If we have a welltyped program and a conforming state, we
    30   If we have a welltyped program and a conforming state, we
    31   can directly infer that the current instruction is well typed:
    31   can directly infer that the current instruction is well typed:
    32 *}
    32 *}
    33 lemma wt_jvm_prog_impl_wt_instr_cor:
    33 lemma wt_jvm_prog_impl_wt_instr_cor:
    34   "[| wt_jvm_prog G phi; method (G,C) sig = Some (C,rT,maxs,maxl,ins,et); 
    34   "\<lbrakk> wt_jvm_prog G phi; method (G,C) sig = Some (C,rT,maxs,maxl,ins,et); 
    35       G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> |] 
    35       G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> \<rbrakk> 
    36   ==> wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc"
    36   \<Longrightarrow> wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc"
    37 apply (unfold correct_state_def Let_def correct_frame_def)
    37 apply (unfold correct_state_def Let_def correct_frame_def)
    38 apply simp
    38 apply simp
    39 apply (blast intro: wt_jvm_prog_impl_wt_instr)
    39 apply (blast intro: wt_jvm_prog_impl_wt_instr)
    40 done
    40 done
    41 
    41 
    55 text {*
    55 text {*
    56   Relates @{text match_any} from the Bytecode Verifier with 
    56   Relates @{text match_any} from the Bytecode Verifier with 
    57   @{text match_exception_table} from the operational semantics:
    57   @{text match_exception_table} from the operational semantics:
    58 *}
    58 *}
    59 lemma in_match_any:
    59 lemma in_match_any:
    60   "match_exception_table G xcpt pc et = Some pc' ==> 
    60   "match_exception_table G xcpt pc et = Some pc' \<Longrightarrow> 
    61   \<exists>C. C \<in> set (match_any G pc et) \<and> G \<turnstile> xcpt \<preceq>C C \<and> 
    61   \<exists>C. C \<in> set (match_any G pc et) \<and> G \<turnstile> xcpt \<preceq>C C \<and> 
    62       match_exception_table G C pc et = Some pc'"
    62       match_exception_table G C pc et = Some pc'"
    63   (is "PROP ?P et" is "?match et ==> ?match_any et")
    63   (is "PROP ?P et" is "?match et \<Longrightarrow> ?match_any et")
    64 proof (induct et)  
    64 proof (induct et)  
    65   show "PROP ?P []" 
    65   show "PROP ?P []" 
    66     by simp
    66     by simp
    67 
    67 
    68   fix e es
    68   fix e es
   129   in the current frame). We require that the exception is a valid
   129   in the current frame). We require that the exception is a valid
   130   heap address, and that the state before the exception occured
   130   heap address, and that the state before the exception occured
   131   conforms. 
   131   conforms. 
   132 *}
   132 *}
   133 lemma uncaught_xcpt_correct:
   133 lemma uncaught_xcpt_correct:
   134   "!!f. [| wt_jvm_prog G phi; xcp = Addr adr; hp adr = Some T;
   134   "\<And>f. \<lbrakk> wt_jvm_prog G phi; xcp = Addr adr; hp adr = Some T;
   135       G,phi \<turnstile>JVM (None, hp, f#frs)\<surd> |]
   135       G,phi \<turnstile>JVM (None, hp, f#frs)\<surd> \<rbrakk>
   136   ==> G,phi \<turnstile>JVM (find_handler G (Some xcp) hp frs)\<surd>" 
   136   \<Longrightarrow> G,phi \<turnstile>JVM (find_handler G (Some xcp) hp frs)\<surd>" 
   137   (is "!!f. [| ?wt; ?adr; ?hp; ?correct (None, hp, f#frs) |] ==> ?correct (?find frs)")
   137   (is "\<And>f. \<lbrakk> ?wt; ?adr; ?hp; ?correct (None, hp, f#frs) \<rbrakk> \<Longrightarrow> ?correct (?find frs)")
   138 proof (induct frs) 
   138 proof (induct frs) 
   139   -- "the base case is trivial, as it should be"
   139   -- "the base case is trivial, as it should be"
   140   show "?correct (?find [])" by (simp add: correct_state_def)
   140   show "?correct (?find [])" by (simp add: correct_state_def)
   141 
   141 
   142   -- "we will need both forms @{text wt_jvm_prog} and @{text wf_prog} later"
   142   -- "we will need both forms @{text wt_jvm_prog} and @{text wf_prog} later"
   151   fix f f' frs' 
   151   fix f f' frs' 
   152   assume cr: "?correct (None, hp, f#f'#frs')" 
   152   assume cr: "?correct (None, hp, f#f'#frs')" 
   153 
   153 
   154   -- "the induction hypothesis as produced by Isabelle, immediatly simplified
   154   -- "the induction hypothesis as produced by Isabelle, immediatly simplified
   155     with the fixed assumptions above"
   155     with the fixed assumptions above"
   156   assume "\<And>f. [| ?wt; ?adr; ?hp; ?correct (None, hp, f#frs') |] ==> ?correct (?find frs')"  
   156   assume "\<And>f. \<lbrakk> ?wt; ?adr; ?hp; ?correct (None, hp, f#frs') \<rbrakk> \<Longrightarrow> ?correct (?find frs')"  
   157   with wt adr hp 
   157   with wt adr hp 
   158   have IH: "\<And>f. ?correct (None, hp, f#frs') ==> ?correct (?find frs')" by blast
   158   have IH: "\<And>f. ?correct (None, hp, f#frs') \<Longrightarrow> ?correct (?find frs')" by blast
   159 
   159 
   160   from cr
   160   from cr
   161   have cr': "?correct (None, hp, f'#frs')" by (auto simp add: correct_state_def)
   161   have cr': "?correct (None, hp, f'#frs')" by (auto simp add: correct_state_def)
   162     
   162     
   163   obtain stk loc C sig pc where f' [simp]: "f' = (stk,loc,C,sig,pc)"
   163   obtain stk loc C sig pc where f' [simp]: "f' = (stk,loc,C,sig,pc)"
   247   The requirement of lemma @{text uncaught_xcpt_correct} (that
   247   The requirement of lemma @{text uncaught_xcpt_correct} (that
   248   the exception is a valid reference on the heap) is always met
   248   the exception is a valid reference on the heap) is always met
   249   for welltyped instructions and conformant states:
   249   for welltyped instructions and conformant states:
   250 *}
   250 *}
   251 lemma exec_instr_xcpt_hp:
   251 lemma exec_instr_xcpt_hp:
   252   "[|  fst (exec_instr (ins!pc) G hp stk vars Cl sig pc frs) = Some xcp;
   252   "\<lbrakk>  fst (exec_instr (ins!pc) G hp stk vars Cl sig pc frs) = Some xcp;
   253        wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc;
   253        wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc;
   254        G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> |]
   254        G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> \<rbrakk>
   255   ==> \<exists>adr T. xcp = Addr adr \<and> hp adr = Some T" 
   255   \<Longrightarrow> \<exists>adr T. xcp = Addr adr \<and> hp adr = Some T" 
   256   (is "[| ?xcpt; ?wt; ?correct |] ==> ?thesis")
   256   (is "\<lbrakk> ?xcpt; ?wt; ?correct \<rbrakk> \<Longrightarrow> ?thesis")
   257 proof -
   257 proof -
   258   note [simp] = split_beta raise_system_xcpt_def
   258   note [simp] = split_beta raise_system_xcpt_def
   259   note [split] = split_if_asm option.split_asm 
   259   note [split] = split_if_asm option.split_asm 
   260   
   260   
   261   assume wt: ?wt ?correct
   261   assume wt: ?wt ?correct
   277 text {*
   277 text {*
   278   Finally we can state that, whenever an exception occurs, the
   278   Finally we can state that, whenever an exception occurs, the
   279   resulting next state always conforms:
   279   resulting next state always conforms:
   280 *}
   280 *}
   281 lemma xcpt_correct:
   281 lemma xcpt_correct:
   282   "[| wt_jvm_prog G phi;
   282   "\<lbrakk> wt_jvm_prog G phi;
   283       method (G,C) sig = Some (C,rT,maxs,maxl,ins,et); 
   283       method (G,C) sig = Some (C,rT,maxs,maxl,ins,et); 
   284       wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc; 
   284       wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc; 
   285       fst (exec_instr (ins!pc) G hp stk loc C sig pc frs) = Some xcp; 
   285       fst (exec_instr (ins!pc) G hp stk loc C sig pc frs) = Some xcp; 
   286       Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs); 
   286       Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs); 
   287       G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> |] 
   287       G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> \<rbrakk> 
   288   ==> G,phi \<turnstile>JVM state'\<surd>"
   288   \<Longrightarrow> G,phi \<turnstile>JVM state'\<surd>"
   289 proof -
   289 proof -
   290   assume wtp: "wt_jvm_prog G phi"
   290   assume wtp: "wt_jvm_prog G phi"
   291   assume meth: "method (G,C) sig = Some (C,rT,maxs,maxl,ins,et)"
   291   assume meth: "method (G,C) sig = Some (C,rT,maxs,maxl,ins,et)"
   292   assume wt: "wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc"
   292   assume wt: "wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc"
   293   assume xp: "fst (exec_instr (ins!pc) G hp stk loc C sig pc frs) = Some xcp"
   293   assume xp: "fst (exec_instr (ins!pc) G hp stk loc C sig pc frs) = Some xcp"
   586 *}
   586 *}
   587 
   587 
   588 lemmas [iff] = not_Err_eq
   588 lemmas [iff] = not_Err_eq
   589 
   589 
   590 lemma Load_correct:
   590 lemma Load_correct:
   591 "[| wf_prog wt G;
   591 "\<lbrakk> wf_prog wt G;
   592     method (G,C) sig = Some (C,rT,maxs,maxl,ins,et); 
   592     method (G,C) sig = Some (C,rT,maxs,maxl,ins,et); 
   593     ins!pc = Load idx; 
   593     ins!pc = Load idx; 
   594     wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc; 
   594     wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc; 
   595     Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs); 
   595     Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs); 
   596     G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> |]
   596     G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> \<rbrakk>
   597 ==> G,phi \<turnstile>JVM state'\<surd>"
   597 \<Longrightarrow> G,phi \<turnstile>JVM state'\<surd>"
   598 apply (clarsimp simp add: defs1 map_eq_Cons)
   598 apply (clarsimp simp add: defs1 map_eq_Cons)
   599 apply (blast intro: approx_loc_imp_approx_val_sup)
   599 apply (blast intro: approx_loc_imp_approx_val_sup)
   600 done
   600 done
   601 
   601 
   602 lemma Store_correct:
   602 lemma Store_correct:
   603 "[| wf_prog wt G;
   603 "\<lbrakk> wf_prog wt G;
   604   method (G,C) sig = Some (C,rT,maxs,maxl,ins,et);
   604   method (G,C) sig = Some (C,rT,maxs,maxl,ins,et);
   605   ins!pc = Store idx;
   605   ins!pc = Store idx;
   606   wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc;
   606   wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc;
   607   Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs);
   607   Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs);
   608   G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> |]
   608   G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> \<rbrakk>
   609 ==> G,phi \<turnstile>JVM state'\<surd>"
   609 \<Longrightarrow> G,phi \<turnstile>JVM state'\<surd>"
   610 apply (clarsimp simp add: defs1 map_eq_Cons)
   610 apply (clarsimp simp add: defs1 map_eq_Cons)
   611 apply (blast intro: approx_loc_subst)
   611 apply (blast intro: approx_loc_subst)
   612 done
   612 done
   613 
   613 
   614 
   614 
   615 lemma LitPush_correct:
   615 lemma LitPush_correct:
   616 "[| wf_prog wt G;
   616 "\<lbrakk> wf_prog wt G;
   617     method (G,C) sig = Some (C,rT,maxs,maxl,ins,et); 
   617     method (G,C) sig = Some (C,rT,maxs,maxl,ins,et); 
   618     ins!pc = LitPush v;
   618     ins!pc = LitPush v;
   619     wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc; 
   619     wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc; 
   620     Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs);
   620     Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs);
   621     G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> |]
   621     G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> \<rbrakk>
   622 ==> G,phi \<turnstile>JVM state'\<surd>" 
   622 \<Longrightarrow> G,phi \<turnstile>JVM state'\<surd>" 
   623 apply (clarsimp simp add: defs1 sup_PTS_eq map_eq_Cons)
   623 apply (clarsimp simp add: defs1 sup_PTS_eq map_eq_Cons)
   624 apply (blast dest: conf_litval intro: conf_widen)
   624 apply (blast dest: conf_litval intro: conf_widen)
   625 done
   625 done
   626 
   626 
   627 
   627 
   628 lemma Cast_conf2:
   628 lemma Cast_conf2:
   629   "[| wf_prog ok G; G,h\<turnstile>v::\<preceq>RefT rt; cast_ok G C h v; 
   629   "\<lbrakk> wf_prog ok G; G,h\<turnstile>v::\<preceq>RefT rt; cast_ok G C h v; 
   630       G\<turnstile>Class C\<preceq>T; is_class G C|] 
   630       G\<turnstile>Class C\<preceq>T; is_class G C\<rbrakk> 
   631   ==> G,h\<turnstile>v::\<preceq>T"
   631   \<Longrightarrow> G,h\<turnstile>v::\<preceq>T"
   632 apply (unfold cast_ok_def)
   632 apply (unfold cast_ok_def)
   633 apply (frule widen_Class)
   633 apply (frule widen_Class)
   634 apply (elim exE disjE) 
   634 apply (elim exE disjE) 
   635  apply (simp add: null)
   635  apply (simp add: null)
   636 apply (clarsimp simp add: conf_def obj_ty_def)
   636 apply (clarsimp simp add: conf_def obj_ty_def)
   639 done
   639 done
   640 
   640 
   641 lemmas defs1 = defs1 raise_system_xcpt_def
   641 lemmas defs1 = defs1 raise_system_xcpt_def
   642 
   642 
   643 lemma Checkcast_correct:
   643 lemma Checkcast_correct:
   644 "[| wt_jvm_prog G phi;
   644 "\<lbrakk> wt_jvm_prog G phi;
   645     method (G,C) sig = Some (C,rT,maxs,maxl,ins,et); 
   645     method (G,C) sig = Some (C,rT,maxs,maxl,ins,et); 
   646     ins!pc = Checkcast D; 
   646     ins!pc = Checkcast D; 
   647     wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc; 
   647     wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc; 
   648     Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs) ; 
   648     Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs) ; 
   649     G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd>;
   649     G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd>;
   650     fst (exec_instr (ins!pc) G hp stk loc C sig pc frs) = None |] 
   650     fst (exec_instr (ins!pc) G hp stk loc C sig pc frs) = None \<rbrakk> 
   651 ==> G,phi \<turnstile>JVM state'\<surd>"
   651 \<Longrightarrow> G,phi \<turnstile>JVM state'\<surd>"
   652 apply (clarsimp simp add: defs1 wt_jvm_prog_def map_eq_Cons split: split_if_asm)
   652 apply (clarsimp simp add: defs1 wt_jvm_prog_def map_eq_Cons split: split_if_asm)
   653 apply (blast intro: Cast_conf2)
   653 apply (blast intro: Cast_conf2)
   654 done
   654 done
   655 
   655 
   656 
   656 
   657 lemma Getfield_correct:
   657 lemma Getfield_correct:
   658 "[| wt_jvm_prog G phi;
   658 "\<lbrakk> wt_jvm_prog G phi;
   659   method (G,C) sig = Some (C,rT,maxs,maxl,ins,et); 
   659   method (G,C) sig = Some (C,rT,maxs,maxl,ins,et); 
   660   ins!pc = Getfield F D; 
   660   ins!pc = Getfield F D; 
   661   wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc; 
   661   wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc; 
   662   Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs) ; 
   662   Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs) ; 
   663   G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd>;
   663   G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd>;
   664   fst (exec_instr (ins!pc) G hp stk loc C sig pc frs) = None |] 
   664   fst (exec_instr (ins!pc) G hp stk loc C sig pc frs) = None \<rbrakk> 
   665 ==> G,phi \<turnstile>JVM state'\<surd>"
   665 \<Longrightarrow> G,phi \<turnstile>JVM state'\<surd>"
   666 apply (clarsimp simp add: defs1 map_eq_Cons wt_jvm_prog_def 
   666 apply (clarsimp simp add: defs1 map_eq_Cons wt_jvm_prog_def 
   667                 split: option.split split_if_asm)
   667                 split: option.split split_if_asm)
   668 apply (frule conf_widen)
   668 apply (frule conf_widen)
   669 apply assumption+
   669 apply assumption+
   670 apply (drule conf_RefTD)
   670 apply (drule conf_RefTD)
   685 apply blast
   685 apply blast
   686 done
   686 done
   687 
   687 
   688 
   688 
   689 lemma Putfield_correct:
   689 lemma Putfield_correct:
   690 "[| wf_prog wt G;
   690 "\<lbrakk> wf_prog wt G;
   691   method (G,C) sig = Some (C,rT,maxs,maxl,ins,et); 
   691   method (G,C) sig = Some (C,rT,maxs,maxl,ins,et); 
   692   ins!pc = Putfield F D; 
   692   ins!pc = Putfield F D; 
   693   wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc; 
   693   wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc; 
   694   Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs) ; 
   694   Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs) ; 
   695   G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd>;
   695   G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd>;
   696   fst (exec_instr (ins!pc) G hp stk loc C sig pc frs) = None |] 
   696   fst (exec_instr (ins!pc) G hp stk loc C sig pc frs) = None \<rbrakk> 
   697 ==> G,phi \<turnstile>JVM state'\<surd>"
   697 \<Longrightarrow> G,phi \<turnstile>JVM state'\<surd>"
   698 apply (clarsimp simp add: defs1 split_beta split: option.split List.split split_if_asm)
   698 apply (clarsimp simp add: defs1 split_beta split: option.split List.split split_if_asm)
   699 apply (frule conf_widen)
   699 apply (frule conf_widen)
   700 prefer 2
   700 prefer 2
   701   apply assumption
   701   apply assumption
   702  apply assumption
   702  apply assumption
   713          widen_cfs_fields)
   713          widen_cfs_fields)
   714 done
   714 done
   715     
   715     
   716 
   716 
   717 lemma New_correct:
   717 lemma New_correct:
   718 "[| wf_prog wt G;
   718 "\<lbrakk> wf_prog wt G;
   719   method (G,C) sig = Some (C,rT,maxs,maxl,ins,et); 
   719   method (G,C) sig = Some (C,rT,maxs,maxl,ins,et); 
   720   ins!pc = New X; 
   720   ins!pc = New X; 
   721   wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc; 
   721   wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc; 
   722   Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs) ; 
   722   Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs) ; 
   723   G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd>;
   723   G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd>;
   724   fst (exec_instr (ins!pc) G hp stk loc C sig pc frs) = None |] 
   724   fst (exec_instr (ins!pc) G hp stk loc C sig pc frs) = None \<rbrakk> 
   725 ==> G,phi \<turnstile>JVM state'\<surd>"
   725 \<Longrightarrow> G,phi \<turnstile>JVM state'\<surd>"
   726 proof -
   726 proof -
   727   assume wf:   "wf_prog wt G"
   727   assume wf:   "wf_prog wt G"
   728   assume meth: "method (G,C) sig = Some (C,rT,maxs,maxl,ins,et)"
   728   assume meth: "method (G,C) sig = Some (C,rT,maxs,maxl,ins,et)"
   729   assume ins:  "ins!pc = New X"
   729   assume ins:  "ins!pc = New X"
   730   assume wt:   "wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc"
   730   assume wt:   "wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc"
   791 
   791 
   792 lemmas [simp del] = split_paired_Ex
   792 lemmas [simp del] = split_paired_Ex
   793 
   793 
   794 
   794 
   795 lemma Invoke_correct: 
   795 lemma Invoke_correct: 
   796 "[| wt_jvm_prog G phi; 
   796 "\<lbrakk> wt_jvm_prog G phi; 
   797   method (G,C) sig = Some (C,rT,maxs,maxl,ins,et); 
   797   method (G,C) sig = Some (C,rT,maxs,maxl,ins,et); 
   798   ins ! pc = Invoke C' mn pTs; 
   798   ins ! pc = Invoke C' mn pTs; 
   799   wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc; 
   799   wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc; 
   800   Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs) ; 
   800   Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs) ; 
   801   G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd>;
   801   G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd>;
   802   fst (exec_instr (ins!pc) G hp stk loc C sig pc frs) = None |] 
   802   fst (exec_instr (ins!pc) G hp stk loc C sig pc frs) = None \<rbrakk> 
   803 ==> G,phi \<turnstile>JVM state'\<surd>" 
   803 \<Longrightarrow> G,phi \<turnstile>JVM state'\<surd>" 
   804 proof -
   804 proof -
   805   assume wtprog: "wt_jvm_prog G phi"
   805   assume wtprog: "wt_jvm_prog G phi"
   806   assume method: "method (G,C) sig = Some (C,rT,maxs,maxl,ins,et)"
   806   assume method: "method (G,C) sig = Some (C,rT,maxs,maxl,ins,et)"
   807   assume ins:    "ins ! pc = Invoke C' mn pTs"
   807   assume ins:    "ins ! pc = Invoke C' mn pTs"
   808   assume wti:    "wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc"
   808   assume wti:    "wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc"
   970 qed
   970 qed
   971 
   971 
   972 lemmas [simp del] = map_append
   972 lemmas [simp del] = map_append
   973 
   973 
   974 lemma Return_correct:
   974 lemma Return_correct:
   975 "[| wt_jvm_prog G phi; 
   975 "\<lbrakk> wt_jvm_prog G phi; 
   976   method (G,C) sig = Some (C,rT,maxs,maxl,ins,et); 
   976   method (G,C) sig = Some (C,rT,maxs,maxl,ins,et); 
   977   ins ! pc = Return; 
   977   ins ! pc = Return; 
   978   wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc; 
   978   wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc; 
   979   Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs) ; 
   979   Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs) ; 
   980   G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> |]
   980   G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> \<rbrakk>
   981 ==> G,phi \<turnstile>JVM state'\<surd>"
   981 \<Longrightarrow> G,phi \<turnstile>JVM state'\<surd>"
   982 proof -
   982 proof -
   983   assume wt_prog: "wt_jvm_prog G phi"
   983   assume wt_prog: "wt_jvm_prog G phi"
   984   assume meth: "method (G,C) sig = Some (C,rT,maxs,maxl,ins,et)"
   984   assume meth: "method (G,C) sig = Some (C,rT,maxs,maxl,ins,et)"
   985   assume ins: "ins ! pc = Return"
   985   assume ins: "ins ! pc = Return"
   986   assume wt: "wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc"
   986   assume wt: "wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc"
  1096 qed
  1096 qed
  1097   
  1097   
  1098 lemmas [simp] = map_append
  1098 lemmas [simp] = map_append
  1099 
  1099 
  1100 lemma Goto_correct:
  1100 lemma Goto_correct:
  1101 "[| wf_prog wt G; 
  1101 "\<lbrakk> wf_prog wt G; 
  1102   method (G,C) sig = Some (C,rT,maxs,maxl,ins,et); 
  1102   method (G,C) sig = Some (C,rT,maxs,maxl,ins,et); 
  1103   ins ! pc = Goto branch; 
  1103   ins ! pc = Goto branch; 
  1104   wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc; 
  1104   wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc; 
  1105   Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs) ; 
  1105   Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs) ; 
  1106   G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> |] 
  1106   G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> \<rbrakk> 
  1107 ==> G,phi \<turnstile>JVM state'\<surd>"
  1107 \<Longrightarrow> G,phi \<turnstile>JVM state'\<surd>"
  1108 apply (clarsimp simp add: defs1)
  1108 apply (clarsimp simp add: defs1)
  1109 apply fast
  1109 apply fast
  1110 done
  1110 done
  1111 
  1111 
  1112 
  1112 
  1113 lemma Ifcmpeq_correct:
  1113 lemma Ifcmpeq_correct:
  1114 "[| wf_prog wt G; 
  1114 "\<lbrakk> wf_prog wt G; 
  1115   method (G,C) sig = Some (C,rT,maxs,maxl,ins,et); 
  1115   method (G,C) sig = Some (C,rT,maxs,maxl,ins,et); 
  1116   ins ! pc = Ifcmpeq branch; 
  1116   ins ! pc = Ifcmpeq branch; 
  1117   wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc; 
  1117   wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc; 
  1118   Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs) ; 
  1118   Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs) ; 
  1119   G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> |] 
  1119   G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> \<rbrakk> 
  1120 ==> G,phi \<turnstile>JVM state'\<surd>"
  1120 \<Longrightarrow> G,phi \<turnstile>JVM state'\<surd>"
  1121 apply (clarsimp simp add: defs1)
  1121 apply (clarsimp simp add: defs1)
  1122 apply fast
  1122 apply fast
  1123 done
  1123 done
  1124 
  1124 
  1125 lemma Pop_correct:
  1125 lemma Pop_correct:
  1126 "[| wf_prog wt G; 
  1126 "\<lbrakk> wf_prog wt G; 
  1127   method (G,C) sig = Some (C,rT,maxs,maxl,ins,et); 
  1127   method (G,C) sig = Some (C,rT,maxs,maxl,ins,et); 
  1128   ins ! pc = Pop;
  1128   ins ! pc = Pop;
  1129   wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc; 
  1129   wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc; 
  1130   Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs) ; 
  1130   Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs) ; 
  1131   G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> |] 
  1131   G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> \<rbrakk> 
  1132 ==> G,phi \<turnstile>JVM state'\<surd>"
  1132 \<Longrightarrow> G,phi \<turnstile>JVM state'\<surd>"
  1133 apply (clarsimp simp add: defs1)
  1133 apply (clarsimp simp add: defs1)
  1134 apply fast
  1134 apply fast
  1135 done
  1135 done
  1136 
  1136 
  1137 lemma Dup_correct:
  1137 lemma Dup_correct:
  1138 "[| wf_prog wt G; 
  1138 "\<lbrakk> wf_prog wt G; 
  1139   method (G,C) sig = Some (C,rT,maxs,maxl,ins,et); 
  1139   method (G,C) sig = Some (C,rT,maxs,maxl,ins,et); 
  1140   ins ! pc = Dup;
  1140   ins ! pc = Dup;
  1141   wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc; 
  1141   wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc; 
  1142   Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs) ; 
  1142   Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs) ; 
  1143   G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> |] 
  1143   G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> \<rbrakk> 
  1144 ==> G,phi \<turnstile>JVM state'\<surd>"
  1144 \<Longrightarrow> G,phi \<turnstile>JVM state'\<surd>"
  1145 apply (clarsimp simp add: defs1 map_eq_Cons)
  1145 apply (clarsimp simp add: defs1 map_eq_Cons)
  1146 apply (blast intro: conf_widen)
  1146 apply (blast intro: conf_widen)
  1147 done
  1147 done
  1148 
  1148 
  1149 lemma Dup_x1_correct:
  1149 lemma Dup_x1_correct:
  1150 "[| wf_prog wt G; 
  1150 "\<lbrakk> wf_prog wt G; 
  1151   method (G,C) sig = Some (C,rT,maxs,maxl,ins,et); 
  1151   method (G,C) sig = Some (C,rT,maxs,maxl,ins,et); 
  1152   ins ! pc = Dup_x1;
  1152   ins ! pc = Dup_x1;
  1153   wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc; 
  1153   wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc; 
  1154   Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs) ; 
  1154   Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs) ; 
  1155   G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> |] 
  1155   G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> \<rbrakk> 
  1156 ==> G,phi \<turnstile>JVM state'\<surd>"
  1156 \<Longrightarrow> G,phi \<turnstile>JVM state'\<surd>"
  1157 apply (clarsimp simp add: defs1 map_eq_Cons)
  1157 apply (clarsimp simp add: defs1 map_eq_Cons)
  1158 apply (blast intro: conf_widen)
  1158 apply (blast intro: conf_widen)
  1159 done
  1159 done
  1160 
  1160 
  1161 lemma Dup_x2_correct:
  1161 lemma Dup_x2_correct:
  1162 "[| wf_prog wt G; 
  1162 "\<lbrakk> wf_prog wt G; 
  1163   method (G,C) sig = Some (C,rT,maxs,maxl,ins,et); 
  1163   method (G,C) sig = Some (C,rT,maxs,maxl,ins,et); 
  1164   ins ! pc = Dup_x2;
  1164   ins ! pc = Dup_x2;
  1165   wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc; 
  1165   wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc; 
  1166   Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs) ; 
  1166   Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs) ; 
  1167   G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> |] 
  1167   G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> \<rbrakk> 
  1168 ==> G,phi \<turnstile>JVM state'\<surd>"
  1168 \<Longrightarrow> G,phi \<turnstile>JVM state'\<surd>"
  1169 apply (clarsimp simp add: defs1 map_eq_Cons)
  1169 apply (clarsimp simp add: defs1 map_eq_Cons)
  1170 apply (blast intro: conf_widen)
  1170 apply (blast intro: conf_widen)
  1171 done
  1171 done
  1172 
  1172 
  1173 lemma Swap_correct:
  1173 lemma Swap_correct:
  1174 "[| wf_prog wt G; 
  1174 "\<lbrakk> wf_prog wt G; 
  1175   method (G,C) sig = Some (C,rT,maxs,maxl,ins,et); 
  1175   method (G,C) sig = Some (C,rT,maxs,maxl,ins,et); 
  1176   ins ! pc = Swap;
  1176   ins ! pc = Swap;
  1177   wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc; 
  1177   wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc; 
  1178   Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs) ; 
  1178   Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs) ; 
  1179   G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> |] 
  1179   G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> \<rbrakk> 
  1180 ==> G,phi \<turnstile>JVM state'\<surd>"
  1180 \<Longrightarrow> G,phi \<turnstile>JVM state'\<surd>"
  1181 apply (clarsimp simp add: defs1 map_eq_Cons)
  1181 apply (clarsimp simp add: defs1 map_eq_Cons)
  1182 apply (blast intro: conf_widen)
  1182 apply (blast intro: conf_widen)
  1183 done
  1183 done
  1184 
  1184 
  1185 lemma IAdd_correct:
  1185 lemma IAdd_correct:
  1186 "[| wf_prog wt G; 
  1186 "\<lbrakk> wf_prog wt G; 
  1187   method (G,C) sig = Some (C,rT,maxs,maxl,ins,et); 
  1187   method (G,C) sig = Some (C,rT,maxs,maxl,ins,et); 
  1188   ins ! pc = IAdd; 
  1188   ins ! pc = IAdd; 
  1189   wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc; 
  1189   wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) et pc; 
  1190   Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs) ; 
  1190   Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs) ; 
  1191   G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> |] 
  1191   G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> \<rbrakk> 
  1192 ==> G,phi \<turnstile>JVM state'\<surd>"
  1192 \<Longrightarrow> G,phi \<turnstile>JVM state'\<surd>"
  1193 apply (clarsimp simp add: defs1 map_eq_Cons approx_val_def conf_def)
  1193 apply (clarsimp simp add: defs1 map_eq_Cons approx_val_def conf_def)
  1194 apply blast
  1194 apply blast
  1195 done
  1195 done
  1196 
  1196 
  1197 lemma Throw_correct:
  1197 lemma Throw_correct:
  1198 "[| wf_prog wt G; 
  1198 "\<lbrakk> wf_prog wt G; 
  1199   method (G,C) sig = Some (C,rT,maxs,maxl,ins,et); 
  1199   method (G,C) sig = Some (C,rT,maxs,maxl,ins,et); 
  1200   ins ! pc = Throw; 
  1200   ins ! pc = Throw; 
  1201   Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs) ; 
  1201   Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs) ; 
  1202   G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd>;
  1202   G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd>;
  1203   fst (exec_instr (ins!pc) G hp stk loc C sig pc frs) = None |] 
  1203   fst (exec_instr (ins!pc) G hp stk loc C sig pc frs) = None \<rbrakk> 
  1204 ==> G,phi \<turnstile>JVM state'\<surd>"
  1204 \<Longrightarrow> G,phi \<turnstile>JVM state'\<surd>"
  1205   by simp
  1205   by simp
  1206 
  1206 
  1207 
  1207 
  1208 text {*
  1208 text {*
  1209   The next theorem collects the results of the sections above,
  1209   The next theorem collects the results of the sections above,
  1211   instruction. It states type safety for single step execution:
  1211   instruction. It states type safety for single step execution:
  1212   in welltyped programs, a conforming state is transformed
  1212   in welltyped programs, a conforming state is transformed
  1213   into another conforming state when one instruction is executed.
  1213   into another conforming state when one instruction is executed.
  1214 *}
  1214 *}
  1215 theorem instr_correct:
  1215 theorem instr_correct:
  1216 "[| wt_jvm_prog G phi;
  1216 "\<lbrakk> wt_jvm_prog G phi;
  1217   method (G,C) sig = Some (C,rT,maxs,maxl,ins,et);
  1217   method (G,C) sig = Some (C,rT,maxs,maxl,ins,et);
  1218   Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs); 
  1218   Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs); 
  1219   G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> |] 
  1219   G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> \<rbrakk> 
  1220 ==> G,phi \<turnstile>JVM state'\<surd>"
  1220 \<Longrightarrow> G,phi \<turnstile>JVM state'\<surd>"
  1221 apply (frule wt_jvm_prog_impl_wt_instr_cor)
  1221 apply (frule wt_jvm_prog_impl_wt_instr_cor)
  1222 apply assumption+
  1222 apply assumption+
  1223 apply (cases "fst (exec_instr (ins!pc) G hp stk loc C sig pc frs)")
  1223 apply (cases "fst (exec_instr (ins!pc) G hp stk loc C sig pc frs)")
  1224 defer
  1224 defer
  1225 apply (erule xcpt_correct, assumption+) 
  1225 apply (erule xcpt_correct, assumption+) 
  1252 
  1252 
  1253 section {* Main *}
  1253 section {* Main *}
  1254 
  1254 
  1255 lemma correct_state_impl_Some_method:
  1255 lemma correct_state_impl_Some_method:
  1256   "G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> 
  1256   "G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> 
  1257   ==> \<exists>meth. method (G,C) sig = Some(C,meth)"
  1257   \<Longrightarrow> \<exists>meth. method (G,C) sig = Some(C,meth)"
  1258 by (auto simp add: correct_state_def Let_def)
  1258 by (auto simp add: correct_state_def Let_def)
  1259 
  1259 
  1260 
  1260 
  1261 lemma BV_correct_1 [rule_format]:
  1261 lemma BV_correct_1 [rule_format]:
  1262 "!!state. [| wt_jvm_prog G phi; G,phi \<turnstile>JVM state\<surd>|] 
  1262 "\<And>state. \<lbrakk> wt_jvm_prog G phi; G,phi \<turnstile>JVM state\<surd>\<rbrakk> 
  1263  ==> exec (G,state) = Some state' --> G,phi \<turnstile>JVM state'\<surd>"
  1263  \<Longrightarrow> exec (G,state) = Some state' \<longrightarrow> G,phi \<turnstile>JVM state'\<surd>"
  1264 apply (simp only: split_tupled_all)
  1264 apply (simp only: split_tupled_all)
  1265 apply (rename_tac xp hp frs)
  1265 apply (rename_tac xp hp frs)
  1266 apply (case_tac xp)
  1266 apply (case_tac xp)
  1267  apply (case_tac frs)
  1267  apply (case_tac frs)
  1268   apply simp
  1268   apply simp
  1275 done
  1275 done
  1276 
  1276 
  1277 
  1277 
  1278 
  1278 
  1279 lemma L0:
  1279 lemma L0:
  1280   "[| xp=None; frs\<noteq>[] |] ==> (\<exists>state'. exec (G,xp,hp,frs) = Some state')"
  1280   "\<lbrakk> xp=None; frs\<noteq>[] \<rbrakk> \<Longrightarrow> (\<exists>state'. exec (G,xp,hp,frs) = Some state')"
  1281 by (clarsimp simp add: neq_Nil_conv split_beta)
  1281 by (clarsimp simp add: neq_Nil_conv split_beta)
  1282 
  1282 
  1283 lemma L1:
  1283 lemma L1:
  1284   "[|wt_jvm_prog G phi; G,phi \<turnstile>JVM (xp,hp,frs)\<surd>; xp=None; frs\<noteq>[]|] 
  1284   "\<lbrakk>wt_jvm_prog G phi; G,phi \<turnstile>JVM (xp,hp,frs)\<surd>; xp=None; frs\<noteq>[]\<rbrakk> 
  1285   ==> \<exists>state'. exec(G,xp,hp,frs) = Some state' \<and> G,phi \<turnstile>JVM state'\<surd>"
  1285   \<Longrightarrow> \<exists>state'. exec(G,xp,hp,frs) = Some state' \<and> G,phi \<turnstile>JVM state'\<surd>"
  1286 apply (drule L0)
  1286 apply (drule L0)
  1287 apply assumption
  1287 apply assumption
  1288 apply (fast intro: BV_correct_1)
  1288 apply (fast intro: BV_correct_1)
  1289 done
  1289 done
  1290 
  1290 
  1291 theorem BV_correct [rule_format]:
  1291 theorem BV_correct [rule_format]:
  1292 "[| wt_jvm_prog G phi; G \<turnstile> s -jvm-> t |] ==> G,phi \<turnstile>JVM s\<surd> --> G,phi \<turnstile>JVM t\<surd>"
  1292 "\<lbrakk> wt_jvm_prog G phi; G \<turnstile> s -jvm\<rightarrow> t \<rbrakk> \<Longrightarrow> G,phi \<turnstile>JVM s\<surd> \<longrightarrow> G,phi \<turnstile>JVM t\<surd>"
  1293 apply (unfold exec_all_def)
  1293 apply (unfold exec_all_def)
  1294 apply (erule rtrancl_induct)
  1294 apply (erule rtrancl_induct)
  1295  apply simp
  1295  apply simp
  1296 apply (auto intro: BV_correct_1)
  1296 apply (auto intro: BV_correct_1)
  1297 done
  1297 done
  1298 
  1298 
  1299 theorem BV_correct_implies_approx:
  1299 theorem BV_correct_implies_approx:
  1300 "[| wt_jvm_prog G phi; 
  1300 "\<lbrakk> wt_jvm_prog G phi; 
  1301     G \<turnstile> s0 -jvm-> (None,hp,(stk,loc,C,sig,pc)#frs); G,phi \<turnstile>JVM s0 \<surd>|] 
  1301     G \<turnstile> s0 -jvm\<rightarrow> (None,hp,(stk,loc,C,sig,pc)#frs); G,phi \<turnstile>JVM s0 \<surd>\<rbrakk> 
  1302 ==> approx_stk G hp stk (fst (the (phi C sig ! pc))) \<and> 
  1302 \<Longrightarrow> approx_stk G hp stk (fst (the (phi C sig ! pc))) \<and> 
  1303     approx_loc G hp loc (snd (the (phi C sig ! pc)))"
  1303     approx_loc G hp loc (snd (the (phi C sig ! pc)))"
  1304 apply (drule BV_correct)
  1304 apply (drule BV_correct)
  1305 apply assumption+
  1305 apply assumption+
  1306 apply (simp add: correct_state_def correct_frame_def split_def 
  1306 apply (simp add: correct_state_def correct_frame_def split_def 
  1307             split: option.splits)
  1307             split: option.splits)