15 wt_instr_def step_def |
15 wt_instr_def step_def |
16 |
16 |
17 lemmas [simp del] = split_paired_All |
17 lemmas [simp del] = split_paired_All |
18 |
18 |
19 lemma wt_jvm_prog_impl_wt_instr_cor: |
19 lemma wt_jvm_prog_impl_wt_instr_cor: |
20 "[| wt_jvm_prog G phi; method (G,C) sig = Some (C,rT,maxs,maxl,ins); |
20 "[| wt_jvm_prog G phi;is_class G C; method (G,C) sig = Some (C,rT,maxs,maxl,ins); |
21 G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> |] |
21 G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> |] |
22 ==> wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) pc" |
22 ==> wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) pc" |
23 apply (unfold correct_state_def Let_def correct_frame_def) |
23 apply (unfold correct_state_def Let_def correct_frame_def) |
24 apply simp |
24 apply simp |
25 apply (blast intro: wt_jvm_prog_impl_wt_instr) |
25 apply (blast intro: wt_jvm_prog_impl_wt_instr) |
193 wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) pc; |
193 wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) pc; |
194 Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs) ; |
194 Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs) ; |
195 G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> |] |
195 G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> |] |
196 ==> G,phi \<turnstile>JVM state'\<surd>" |
196 ==> G,phi \<turnstile>JVM state'\<surd>" |
197 apply (clarsimp simp add: NT_subtype_conv approx_val_def conf_def defs1 |
197 apply (clarsimp simp add: NT_subtype_conv approx_val_def conf_def defs1 |
198 fun_upd_apply map_eq_Cons is_class_def raise_xcpt_def init_vars_def |
198 fun_upd_apply map_eq_Cons raise_xcpt_def init_vars_def |
199 split: option.split) |
199 split: option.split) |
200 apply (force dest!: iffD1 [OF collapse_paired_All] |
200 apply (force dest!: iffD1 [OF collapse_paired_All] |
201 intro: sup_heap_newref approx_stk_imp_approx_stk_sup_heap |
201 intro: sup_heap_newref approx_stk_imp_approx_stk_sup_heap |
202 approx_stk_imp_approx_stk_sup |
202 approx_stk_imp_approx_stk_sup |
203 approx_loc_imp_approx_loc_sup_heap |
203 approx_loc_imp_approx_loc_sup_heap |
204 approx_loc_imp_approx_loc_sup |
204 approx_loc_imp_approx_loc_sup |
205 hconf_imp_hconf_newref correct_frames_imp_correct_frames_newref |
205 hconf_imp_hconf_newref correct_frames_imp_correct_frames_newref |
206 correct_init_obj |
206 correct_init_obj |
207 simp add: NT_subtype_conv approx_val_def conf_def defs1 |
207 simp add: NT_subtype_conv approx_val_def conf_def defs1 |
208 fun_upd_apply map_eq_Cons is_class_def raise_xcpt_def init_vars_def |
208 fun_upd_apply map_eq_Cons raise_xcpt_def init_vars_def |
209 split: option.split) |
209 split: option.split) |
210 done |
210 done |
211 |
211 |
212 |
212 |
213 (****** Method Invocation ******) |
213 (****** Method Invocation ******) |
214 |
214 |
215 lemmas [simp del] = split_paired_Ex |
215 lemmas [simp del] = split_paired_Ex |
216 |
216 |
217 lemma Invoke_correct: |
217 lemma Invoke_correct: (* DvO: is_class G C' eingefügt *) |
218 "[| wt_jvm_prog G phi; |
218 "[| wt_jvm_prog G phi; is_class G C'; |
219 method (G,C) sig = Some (C,rT,maxs,maxl,ins); |
219 method (G,C) sig = Some (C,rT,maxs,maxl,ins); |
220 ins ! pc = Invoke C' mn pTs; |
220 ins ! pc = Invoke C' mn pTs; |
221 wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) pc; |
221 wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) pc; |
222 Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs) ; |
222 Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs) ; |
223 G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> |] |
223 G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> |] |
224 ==> G,phi \<turnstile>JVM state'\<surd>" |
224 ==> G,phi \<turnstile>JVM state'\<surd>" |
225 proof - |
225 proof - |
226 assume wtprog: "wt_jvm_prog G phi" |
226 assume wtprog: "wt_jvm_prog G phi" |
|
227 assume is_class: "is_class G C'" |
227 assume method: "method (G,C) sig = Some (C,rT,maxs,maxl,ins)" |
228 assume method: "method (G,C) sig = Some (C,rT,maxs,maxl,ins)" |
228 assume ins: "ins ! pc = Invoke C' mn pTs" |
229 assume ins: "ins ! pc = Invoke C' mn pTs" |
229 assume wti: "wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) pc" |
230 assume wti: "wt_instr (ins!pc) G rT (phi C sig) maxs (length ins) pc" |
230 assume state': "Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs)" |
231 assume state': "Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs)" |
231 assume approx: "G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd>" |
232 assume approx: "G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd>" |
322 obtain X' where |
323 obtain X' where |
323 X': "X = Class X'" |
324 X': "X = Class X'" |
324 by - (drule widen_Class, elim, rule that) |
325 by - (drule widen_Class, elim, rule that) |
325 |
326 |
326 with X |
327 with X |
327 have "G \<turnstile> X' \<preceq>C C'" |
328 have X'_subcls: "G \<turnstile> X' \<preceq>C C'" |
328 by simp |
329 by simp |
329 |
330 |
330 with mC' wfprog |
331 with mC' wfprog |
331 obtain D0 rT0 maxs0 maxl0 ins0 where |
332 obtain D0 rT0 maxs0 maxl0 ins0 where |
332 mX: "method (G, X') (mn, pTs) = Some (D0, rT0, maxs0, maxl0, ins0)" "G\<turnstile>rT0\<preceq>rT" |
333 mX: "method (G, X') (mn, pTs) = Some (D0, rT0, maxs0, maxl0, ins0)" "G\<turnstile>rT0\<preceq>rT" |
333 by (auto dest: subtype_widen_methd intro: that) |
334 by (auto dest: subtype_widen_methd intro: that) |
334 |
335 |
335 from X' D |
336 from X' D |
336 have "G \<turnstile> D \<preceq>C X'" |
337 have D_subcls: "G \<turnstile> D \<preceq>C X'" |
337 by simp |
338 by simp |
338 |
339 |
339 with wfprog mX |
340 with wfprog mX |
340 obtain D'' rT' mxs' mxl' ins' where |
341 obtain D'' rT' mxs' mxl' ins' where |
341 mD: "method (G, D) (mn, pTs) = Some (D'', rT', mxs', mxl', ins')" |
342 mD: "method (G, D) (mn, pTs) = Some (D'', rT', mxs', mxl', ins')" |
458 Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs) ; |
463 Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs) ; |
459 G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> |] |
464 G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> |] |
460 ==> G,phi \<turnstile>JVM state'\<surd>" |
465 ==> G,phi \<turnstile>JVM state'\<surd>" |
461 apply (clarsimp simp add: neq_Nil_conv defs1 split: split_if_asm) |
466 apply (clarsimp simp add: neq_Nil_conv defs1 split: split_if_asm) |
462 apply (frule wt_jvm_prog_impl_wt_instr) |
467 apply (frule wt_jvm_prog_impl_wt_instr) |
|
468 sorry |
|
469 (* |
463 apply (assumption, erule Suc_lessD) |
470 apply (assumption, erule Suc_lessD) |
464 apply (unfold wt_jvm_prog_def) |
471 apply (unfold wt_jvm_prog_def) |
465 apply (fastsimp |
472 apply (fastsimp |
466 dest: subcls_widen_methd |
473 dest: subcls_widen_methd |
467 elim: widen_trans [COMP swap_prems_rl] |
474 elim: widen_trans [COMP swap_prems_rl] |
468 intro: conf_widen |
475 intro: conf_widen |
469 simp: approx_val_def append_eq_conv_conj map_eq_Cons defs1) |
476 simp: approx_val_def append_eq_conv_conj map_eq_Cons defs1) |
470 done |
477 done |
|
478 *) |
471 |
479 |
472 lemmas [simp] = map_append |
480 lemmas [simp] = map_append |
473 |
481 |
474 lemma Goto_correct: |
482 lemma Goto_correct: |
475 "[| wf_prog wt G; |
483 "[| wf_prog wt G; |
593 method (G,C) sig = Some (C,rT,maxs,maxl,ins); |
601 method (G,C) sig = Some (C,rT,maxs,maxl,ins); |
594 Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs); |
602 Some state' = exec (G, None, hp, (stk,loc,C,sig,pc)#frs); |
595 G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> |] |
603 G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> |] |
596 ==> G,phi \<turnstile>JVM state'\<surd>" |
604 ==> G,phi \<turnstile>JVM state'\<surd>" |
597 apply (frule wt_jvm_prog_impl_wt_instr_cor) |
605 apply (frule wt_jvm_prog_impl_wt_instr_cor) |
|
606 sorry |
|
607 (* |
598 apply assumption+ |
608 apply assumption+ |
599 apply (cases "ins!pc") |
609 apply (cases "ins!pc") |
600 prefer 9 |
610 prefer 9 |
|
611 |
601 apply (blast intro: Invoke_correct) |
612 apply (blast intro: Invoke_correct) |
602 prefer 9 |
613 prefer 9 |
603 apply (blast intro: Return_correct) |
614 apply (blast intro: Return_correct) |
604 apply (unfold wt_jvm_prog_def) |
615 apply (unfold wt_jvm_prog_def) |
605 apply (fast intro: |
616 apply (fast intro: |
606 Load_correct Store_correct Bipush_correct Aconst_null_correct |
617 Load_correct Store_correct Bipush_correct Aconst_null_correct |
607 Checkcast_correct Getfield_correct Putfield_correct New_correct |
618 Checkcast_correct Getfield_correct Putfield_correct New_correct |
608 Goto_correct Ifcmpeq_correct Pop_correct Dup_correct |
619 Goto_correct Ifcmpeq_correct Pop_correct Dup_correct |
609 Dup_x1_correct Dup_x2_correct Swap_correct IAdd_correct)+ |
620 Dup_x1_correct Dup_x2_correct Swap_correct IAdd_correct)+ |
610 done |
621 done |
611 |
622 *) |
612 |
623 |
613 (** Main **) |
624 (** Main **) |
614 |
625 |
615 lemma correct_state_impl_Some_method: |
626 lemma correct_state_impl_Some_method: |
616 "G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> |
627 "G,phi \<turnstile>JVM (None, hp, (stk,loc,C,sig,pc)#frs)\<surd> |