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 ==> staticb ==> ty list ==> ty ==> nat ==> nat ==> ex_table ==> tyi' err list ==> instr list ==> bool" where "wt_lbv P C b Ts Tr mxs mxl0 et cert ins ≡ (b = Static ∨ b = NonStatic) ∧ check_cert P mxs ((case b of Static ==> 0 | NonStatic ==> 1)+size Ts+mxl0) (size ins) cert ∧ 0 < size ins ∧ (let start = Some ([],(case b of Static ==> [] | NonStatic ==> [OK (Class C)]) @((map OK Ts))@(replicate mxl0 Err)); result = lbvjvm P mxs ((case b of Static ==> 0 | NonStatic ==> 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,b,Ts,Tr,(mxs,mxl0,ins,et)). wt_lbv P C b Ts Tr mxs mxl0 et (cert C mn) ins) 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,b,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 b 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 (cases b; 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 b Ts Tr mxs mxl0 xt cert is" shows"∃τs. wt_method P C b Ts Tr mxs mxl0 is xt τs" (*<*) proof - from lbv have l: "is ≠ []"and
stab: "b = Static ∨ b = NonStatic"by (auto 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 b Ts mxl0 (map ok_val τs)" by (cases b; 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 b 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 b Ts Tr mxs mxl0 is xt τs" defines [simp]: "cert ≡ mk_cert P mxs Tr xt is τs"
shows"wt_lbv P C b 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 b 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 (cases b; 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" by (fastforce simp: make_cert_def check_types_def JVM_states_unfold
dest!: nth_mem) moreovernote0 size ultimatelyshow ?thesis using staticb 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,b,Ts,Tr,(mxs,mxl0,is,xt)) = method P C mn in SOME τs. wt_method P C b Ts Tr mxs mxl0 is xt τs"
let ?A = "λP C (mn,b,Ts,Tr,(mxs,mxl0,ins,et)). wt_lbv P C b Ts Tr mxs mxl0 et (Cert C mn) ins" let ?B = "λP C (M,b,Ts,Tr,(mxs,mxl0,is,xt)). wt_method P C b Ts Tr mxs mxl0 is xt (?Φ C M)"
assume wt: "wt_jvm_prog_lbv P Cert" thenhave"wf_prog ?A P"by(simp add: wt_jvm_prog_lbv_def) moreover { fix wf_md C M b Ts Ca T m bd
assume ass1: "wf_prog wf_md P"and sees: "P ⊨ Ca sees M, b : Ts→T = m in Ca"and
ass2: "set Ts ⊆ types P"and ass3: "bd = (M, b, Ts, T, m)"and
ass4: "?A P Ca bd" from ass3 ass4 have stab: "b = Static ∨ b = NonStatic"by (simp add:wt_lbv_def) from ass1 sees ass2 ass3 ass4 have"?B P Ca bd"using sees_method_is_class[OF sees] by (auto dest!: start_context.wt_lbv_wt_method [OF start_context_intro_auxi[OF stab]]
intro: someI)
} ultimatelyhave"wf_prog ?B P"by(rule wf_prog_lift) hence"wf_jvm_progΦ P"by (simp add: wf_jvm_prog_phi_def) thus ?thesis by (unfold wf_jvm_prog_def) blast qed (*>*)
theorem jvm_lbv_complete: assumes wt: "wf_jvm_prog<Phi> P" shows"wt_jvm_prog_lbv P (prg_cert P Φ)" (*<*) proof - let ?cert = "prg_cert P Φ" let ?A = "λP C (M,b,Ts,Tr,(mxs,mxl0,is,xt)). wt_method P C b Ts Tr mxs mxl0 is xt (Φ C M)" let ?B = "λP C (mn,b,Ts,Tr,(mxs,mxl0,ins,et)). wt_lbv P C b Ts Tr mxs mxl0 et (?cert C mn) ins"
from wt have"wf_prog ?A P"by(clarsimp simp: wf_jvm_prog_def wf_jvm_prog_phi_def) moreover { fix wf_md C M b Ts Ca T m bd assume ass1: "wf_prog wf_md P"and sees: "P ⊨ Ca sees M, b : Ts→T = m in Ca"and
ass2: "set Ts ⊆ types P"and ass3: "bd = (M, b, Ts, T, m)"and
ass4: "?A P Ca bd" from ass3 ass4 have stab: "b = Static ∨ b = NonStatic"by (simp add:wt_method_def) from ass1 sees ass2 ass3 ass4 have"?B P Ca bd"using sees_method_is_class[OF sees] by (auto simp add: prg_cert_def
intro!: start_context.wt_method_wt_lbv start_context_intro_auxi[OF stab])
} ultimatelyhave"wf_prog ?B P"by(rule wf_prog_lift) thus"wt_jvm_prog_lbv P (prg_cert P Φ)"by (simp add: wt_jvm_prog_lbv_def) qed (*>*)
end
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.2 Sekunden
(vorverarbeitet am 2026-06-10)
¤
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.