definition check_cert :: "jvm_prog ==> nat ==> nat ==> nat ==> tyi' err list ==> bool" where "check_cert P mxs mxl n cert ≡ check_types P mxs mxl cert ∧ size cert = n+1 ∧ (∀i<n. cert!i ≠ Err) ∧ cert!n = OK None"
definition lbvjvm :: "jvm_prog ==> nat ==> nat ==> ty ==> ex_table ==> tyi' err list ==> instr list ==> tyi' err ==> tyi' err" where "lbvjvm P mxs maxr Tr et cert bs ≡ wtl_inst_list bs cert (JVM_SemiType.sup P mxs maxr) (JVM_SemiType.le P mxs maxr) Err (OK None) (exec P mxs Tr et bs) 0"
definition wt_lbv :: "jvm_prog ==> cname ==> ty list ==> ty ==> nat ==> nat ==> ex_table ==> tyi' err list ==> instr list ==> bool" where "wt_lbv P C Ts Tr mxs mxl0 et cert ins ≡ check_cert P mxs (1+size Ts+mxl0) (size ins) cert ∧ 0 < size ins ∧ (let start = Some ([],(OK (Class C))#((map OK Ts))@(replicate mxl0 Err)); result = lbvjvm P mxs (1+size Ts+mxl0) Tr et cert ins (OK start) in result ≠ Err)"
definition wt_jvm_prog_lbv :: "jvm_prog ==> prog_cert ==> bool" where "wt_jvm_prog_lbv P cert ≡ wf_prog (λP C (mn,Ts,Tr,(mxs,mxl0,b,et)). wt_lbv P C Ts Tr mxs mxl0 et (cert C mn) b) P"
definition mk_cert :: "jvm_prog ==> nat ==> ty ==> ex_table ==> instr list ==> tym==> tyi' err list" where "mk_cert P mxs Tr et bs phi ≡ make_cert (exec P mxs Tr et bs) (map OK phi) (OK None)"
definition prg_cert :: "jvm_prog ==> tyP==> prog_cert" where "prg_cert P phi C mn ≡ let (C,Ts,Tr,(mxs,mxl0,ins,et)) = method P C mn in mk_cert P mxs Tr et ins (phi C mn)"
lemma check_certD [intro?]: "check_cert P mxs mxl n cert ==> cert_ok cert n Err (OK None) (states P mxs mxl)" by (unfold cert_ok_def check_cert_def check_types_def) auto
lemma (in start_context) wt_lbv_wt_step: assumes lbv: "wt_lbv P C Ts Tr mxs mxl0 xt cert is" shows"∃τs ∈ nlists (size is) A. wt_step r Err step τs ∧ OK first ⊑r τs!0" (*<*) proof - from wf have"semilat (JVM_SemiType.sl P mxs mxl)" .. hence"semilat (A, r, f)"by (simp add: sl_def2) moreoverhave"top r Err"by (simp add: JVM_le_Err_conv) moreoverhave"Err ∈ A"by (simp add: JVM_states_unfold) moreoverhave"bottom r (OK None)" by (simp add: JVM_le_Err_conv bottom_def lesub_def Err.le_def split: err.split) moreoverhave"OK None ∈ A"by (simp add: JVM_states_unfold) moreovernote bounded_step moreoverfrom lbv have"cert_ok cert (size is) Err (OK None) A" by (unfold wt_lbv_def) (auto dest: check_certD) moreovernote exec_pres_type moreover from lbv have"wtl_inst_list is cert f r Err (OK None) step 0 (OK first) ≠ Err" by (simp add: wt_lbv_def lbvjvm_def step_def_exec [symmetric]) moreovernote first_in_A moreoverfrom lbv have"0 < size is"by (simp add: wt_lbv_def) ultimatelyshow ?thesis by (rule lbvs.wtl_sound_strong [OF lbvs.intro, OF lbv.intro lbvs_axioms.intro, OF Semilat.intro lbv_axioms.intro]) qed (*>*)
lemma (in start_context) wt_lbv_wt_method: assumes lbv: "wt_lbv P C Ts Tr mxs mxl0 xt cert is" shows"∃τs. wt_method P C Ts Tr mxs mxl0 is xt τs" (*<*) proof - from lbv have l: "is ≠ []"by (simp add: wt_lbv_def) moreover from wf lbv C Ts obtain τs where
list: "τs ∈ nlists (size is) A"and
step: "wt_step r Err step τs"and
start: "OK first ⊑r τs!0" by (blast dest: wt_lbv_wt_step) from list have [simp]: "size τs = size is"by simp have"size (map ok_val τs) = size is"by simp moreoverfrom l have0: "0 < size τs"by simp with step obtain τs0 where"τs!0 = OK τs0" by (unfold wt_step_def) blast with start 0have"wt_start P C Ts mxl0 (map ok_val τs)" by (simp add: wt_start_def JVM_le_Err_conv lesub_def Err.le_def) moreover { from list have"check_types P mxs mxl τs"by (simp add: check_types_def) alsofrom step have"∀x ∈ set τs. x ≠ Err" by (auto simp add: all_set_conv_all_nth wt_step_def) hence [symmetric]: "map OK (map ok_val τs) = τs" by (auto intro!: map_idI) finallyhave"check_types P mxs mxl (map OK (map ok_val τs))" .
} moreover { note bounded_step moreoverfrom list have"set τs ⊆ A"by simp moreoverfrom step have"wt_err_step (sup_state_opt P) step τs" by (simp add: wt_err_step_def JVM_le_Err_conv) ultimatelyhave"wt_app_eff (sup_state_opt P) app eff (map ok_val τs)" by (auto intro: wt_err_imp_wt_app_eff simp add: exec_def states_def)
} ultimatelyhave"wt_method P C Ts Tr mxs mxl0 is xt (map ok_val τs)" by (simp add: wt_method_def2 check_types_def del: map_map) thus ?thesis .. qed (*>*)
lemma (in start_context) wt_method_wt_lbv: assumes wt: "wt_method P C Ts Tr mxs mxl0 is xt τs" defines [simp]: "cert ≡ mk_cert P mxs Tr xt is τs"
shows"wt_lbv P C Ts Tr mxs mxl0 xt cert is" (*<*) proof - let ?τs = "map OK τs" let ?cert = "make_cert step ?τs (OK None)"
from wt obtain 0: "0 < size is"and
size: "size is = size ?τs"and
ck_types: "check_types P mxs mxl ?τs"and
wt_start: "wt_start P C Ts mxl0 τs"and
app_eff: "wt_app_eff (sup_state_opt P) app eff τs" by (force simp add: wt_method_def2 check_types_def)
from wf have"semilat (JVM_SemiType.sl P mxs mxl)" .. hence"semilat (A, r, f)"by (simp add: sl_def2) moreoverhave"top r Err"by (simp add: JVM_le_Err_conv) moreoverhave"Err ∈ A"by (simp add: JVM_states_unfold) moreoverhave"bottom r (OK None)" by (simp add: JVM_le_Err_conv bottom_def lesub_def Err.le_def split: err.split) moreoverhave"OK None ∈ A"by (simp add: JVM_states_unfold) moreoverfrom wf have"mono r step (size is) A"by (rule step_mono) hence"mono r step (size ?τs) A"by (simp add: size) moreoverfrom exec_pres_type have"pres_type step (size ?τs) A"by (simp add: size) moreover from ck_types have τs_in_A: "set ?τs ⊆ A"by (simp add: check_types_def) hence"∀pc. pc < size ?τs ⟶ ?τs!pc ∈ A ∧ ?τs!pc ≠ Err"by auto moreoverfrom bounded_step have"bounded step (size ?τs)"by (simp add: size) moreoverhave"OK None ≠ Err"by simp moreoverfrom bounded_step size τs_in_A app_eff have"wt_err_step (sup_state_opt P) step ?τs" by (auto intro: wt_app_eff_imp_wt_err simp add: exec_def states_def) hence"wt_step r Err step ?τs" by (simp add: wt_err_step_def JVM_le_Err_conv) moreover from0 size have"0 < size τs"by auto hence"?τs!0 = OK (τs!0)"by simp with wt_start have"OK first ⊑r ?τs!0" by (clarsimp simp add: wt_start_def lesub_def Err.le_def JVM_le_Err_conv) moreovernote first_in_A moreoverhave"OK first ≠ Err"by simp moreovernote size ultimately have"wtl_inst_list is ?cert f r Err (OK None) step 0 (OK first) ≠ Err" by (rule lbvc.wtl_complete [OF lbvc.intro, OF lbv.intro lbvc_axioms.intro, OF Semilat.intro lbv_axioms.intro]) moreoverfrom0 size have"τs ≠ []"by auto moreoverfrom ck_types have"check_types P mxs mxl ?cert" apply (auto simp add: make_cert_def check_types_def JVM_states_unfold) apply (subst Ok_in_err [symmetric]) apply (drule nth_mem) apply auto done moreovernote0 size ultimatelyshow ?thesis by (simp add: wt_lbv_def lbvjvm_def mk_cert_def step_def_exec [symmetric]
check_cert_def make_cert_def nth_append) qed (*>*)
theorem jvm_lbv_correct: "wt_jvm_prog_lbv P Cert ==> wf_jvm_prog P" (*<*) proof - let ?Φ = "λC mn. let (C,Ts,Tr,(mxs,mxl0,is,xt)) = method P C mn in SOME τs. wt_method P C Ts Tr mxs mxl0 is xt τs"
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.