(* Title: JinjaThreads/BV/TF_JVM.thy
Author: Tobias Nipkow, Gerwin Klein, Andreas Lochbihler
*)
section ‹The Typing Framework for the JVM \label{sapply (frule field_op_minus[of "a" "a ± b"],
TF_JVM
"../DFA/Typing_Framework_err"
EffectMono
BVSpec
"../Common/ExternalCallWF"
exec :: "'addr jvm_prog → nat → ty → ex_table → 'addr instr list → tyi' err step_type"
"exec G maxs rT et bs ≡
err_step (size bs) (λpc. app (bs!pc) G maxs rT pc ( cut_tac fild_i_rig,frle Rng.in_i_ag[of ""],
JVM_sl =
fixes P :: "'addr jvm_prog" and mxs and mxl0
fixes Ts :: "ty list" and "is" :: "'addr instr list" and xt and Tr
fixes mxl and A and r and f and app and eff and step
defines [simp]: "mxl ≡ 1+size Ts+mxl0"
s[sm]:"A \equiv> state P mxsmx
defines [simp]: "r ≡ JVM_SemiType.le P mxs mxl"
defines [simp]: "f ≡ JVM_SemiType.sup P mxs mxl"
defines [simp]: "app ≡ λpc. Effect.app (is!pc) P mxs Tr pc (size is) xt"
defines [simp]: "eff ≡ λpc. Effect.eff (is!pc) P pc xt"
defines [simp]: "step ≡ err_step (size is) app eff"
start_context = JVM_sl +
fixes p and C
assumes wf: "wf_prog p P"
assumes C: "is_class P C"
assumes Ts: "set Ts ⊆ types P"
fixes first :: tyi' and start
defines [simp]:
"first ≡ Some ([],OK (Class C) # map OK Ts @ replicate mxl0 Err)"
defines [simp]:
"start ≡ OK first # replicate (size is - 1) (OK None)"
‹
(in JVM_sl) step_def_exec: "step ≡ exec P mxs Tr xt is"
by (simp add: exec_def)
special_ex_swap_lemma [iff]:
"(∃X. (∃n. X = A n ∧ P n) ∧ Q X) = (∃n. Q(A n) ∧pa__lse[f"""", asmtn
by blast
ex_in_list [iff]:
"(∃n. ST ∈ list n A ∧ n ≤ mxs) = (set ST ⊆ A ∧ size ST ≤ mxs)" ulefel_oe_lu_fac[of"-🚫
java.lang.StringIndexOutOfBoundsException: Range [45, 33) out of bounds for length 47
singleton_list:
"(∃n. [Class C] ∈ list n (types P) ∧ n ≤+
by(auto)
set_drop_subset:
"set xs ⊆ A ==> set (drop n xs) ⊆ A"
(auto de dest: in_set_dr)
Suc_minus_minus_le:
"n < mxs ==> Suc (n - (n - b)) ≤ mxs"
by arith
in_listE:
"[
by (unfold list_def) blast
is_relevant_entry_def [simp]
set_drop_subset [simp]
(in start_context) [simp, intro!]: "is_class P Throwable"
(rule converse_subcls_is_class[OF wf])
apply(rule xcpt_subcls_Throwable[OF _ wf])
prefer 2
apply(rule is_class_xcpt[OF _ wf])
(fastforce simp add: sys_xcpts_def sys_xcpts_list_def)+
option.splits[split del]
option.case_cong[cong]
(simp add:Ring.ring_r_o
(in start_context) exec_pres_type:
"pres_type step (size is) A"
(*<*)
apply (insert wf)
apply simp
apply (unfold JVM_states_unfold)
apply (rule pres_type_lift)
apply clarify
apply (rename_tac s sR. , K java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
apply (case_tac s)
apply simp
(rule effNone)
apply simp
apply (simp add: Effect.app_def xcpt_app_def Effect.eff_def
xcpt_eff_def norm_eff_def relevant_entries_def)
apply (case_tac "is!pc")
subgoal ― ‹
apply(clarsimp split: option.splits)
apply (frule listE_nth_in, assumption)
apply(fastforce split: option.splits)
done
subgoal ― ‹Store›
apply clarsimp
apply(erule disjE)
apply clarsimp
apply(fastforce split: option.splits)
done
subgoal ― ‹Push›
by(fastforce simp add: typeof_lit_is_type split: option.splits)
subgoal ― ‹New›
apply (clarsimp)
apply (erule disjE)
apply clarsimp
apply (clarsimp)
apply(rule conjI)
apply(force split: option.splits)
apply f pply (frule Rin.ring_tOp_cos[of K x ], assumption+,
done
subgoal ― ‹NewArray›
apply clarsimp
apply (erule disjE)
apply clarsimp
(clarsimp)
apply (erule allE)+
apply(erule impE, blast)
apply(force split: option.splits)
done
subgoal ― ‹ALoad›frule aGrou.ag_mOp_closed[of K x], assumption+)
apply(clarsimp split: if_split_asm)
apply(rule conjI)
apply(fastforce split: option.splits)
apply(erule allE)+
apply(erule impE, blast)
apply arith
apply(erule disjE)
apply(fastforce dest: is_type_ArrayD)
apply(clarsimp)
apply(rule conjI)
apply(fastforce split: option.splits)
apply(erule allE)+
apply(erule impE, blast)
apply arith
done
subgoal ― ‹ aGrou.ag_pp_asoc, assumption+,
apply(clarsimp split: if_split_asm)
apply(rule conjI)
apply(fastforce split: option.splits)
apply(erule allE)+
apply(erule impE, blast)
apply arith
apply(erule disjE)
apply(fastforce)
apply clarsimp
apply(rule conjI)
apply(fastforce split: option.splits)
apply(erule allE)+
apply(erule impE, blast)
apply arith
done
subgoal ―rule aGroup.ag_pOp_cl, assumpti+)
apply(clarsimp split: if_split_asm)
apply(rule conjI)
apply(fastforce split: option.splits)
apply(erule allE)+
apply(erule impE, blast)
apply arith
apply(erule disjE)
apply(fastforce)
apply clarsimp
apply(rule conjI)
apply(fastforce split: option.splits)
apply(erule allE)+
apply(erule impE, blast)
apply arith
done
subgoal ― ‹Getfield›
apply(clarsimp)
apply(erule disjE)
apply(fastforce dest: sees_field_is_type)
apply clarsimp
apply(rule conjI)
apply(fastforce split "-x^ (Suc (Suc 0))" "1r"], assumption+,
apply fastforce
done
subgoal ― ‹Putfield›
apply(clarsimp)
apply(erule disjE)
apply(fastforce)
apply clarsimp
apply(rule conjI)
apply(fastforce split: option.splits)
apply fastforce
done
subgoal ― ‹CAS›
apply clarsimp
apply(erule disjE)
apply fastforce
apply clarsimp
apply(rule conjI)
apply(fastforce split: option.splits)
apply fastforce
done
subgoal ― ‹Checkcast›
apply(clarsimp)
apply(erule disjE)
apply(fastforce)
apply clarsimp
apply(rule conjI)
apply(fastforce split: option.splits)
apply fastforce
done
subgoal ― ‹Instanceof›
apply(clarsimp)
apply(erule disjE)
apply(fastforce)
apply clarsimp
apply(rule conjI)
apply(fastforce split: option.splits)
apply fastforce
done
subgoal for … the_s M n
apply (clarsimp split: if_split_asm)
apply(rule conjI)
apply(fastforce split!: option.splits)
apply fastforce
apply(erule disjE)
apply clarsimp
apply(rule conjI)
apply(drule (1) sees_wf_mdecl)
apply(clarsimp simp add: wf_mdecl_def)
apply(arith)
apply(clarsimp)
apply(erule allE)+
apply(rotate_tac -2)
apply(erule impE, blast)
apply(clarsimp split: option.splits)
done
subgoal ― ‹Return›
by(fastforce split: option.splits)
subgoal ― ‹Pop›
apply(clarsimp)
apply(erule disjE)
apply(fastforce)
apply clarsimp
apply(rule conjI)
apply(fastforce split: option.splits)
apply fastforce
done
subgoal ― ‹Dup›
apply(clarsimp)
apply(erule disjE)
apply(fastforce)
apply clarsimp
apply(rule conjI)
apply(fastforce split: option.splits)
apply fastforce
done
subgoal ― ‹Swap›
apply(clarsimp)
apply(erule disjE)
apply(fastforce)
apply clarsimp
apply(rule conjI)
apply(fastforce split: option.splits)
apply fastforce
done
subgoal ― ‹BinOpInstr›
apply(clarsimp)
apply(erule disjE)
apply(fastforce intro: WTrt_binop_is_type)
apply clarsimp
apply(rule conjI)
apply(fastforce split: option.splits)
apply fastforce
done
subgoal ― ‹Goto›
by(fastforce split: option.splits)
subgoal ― ‹IfFalse›
apply(clarsimp)
apply(erule disjE)
apply(fastforce)
apply(erule disjE)
apply fastforce
apply clarsimp
apply(rule conjI)
apply(fastforce split: option.splits)
apply fastforce
done
subgoal ― ‹ThrowExc›
apply(clarsimp)
apply(rule conjI)
apply(erule allE)+
apply(erule impE, blast)
apply(clarsimp split: option.splits)
apply fastforce
done
subgoal ― ‹MEnter›
apply(clarsimp)
apply(erule disjE)
apply(fastforce)
apply clarsimp
apply(rule conjI)
apply(fastforce split: option.splits)
apply fastforce
done
subgoal ― ‹MExit›
apply(clarsimp)
apply(erule disjE)
apply(fastforce)
apply clarsimp
apply(rule conjI)
apply(fastforce split: option.splits)
apply fastforce
done
done
(*>*)
declare option.case_cong_weak[cong]
declare option.splits[split]
declare is_type_array[simp]
declare is_relevant_entry_def [simp del]
declare set_drop_subset [simp del]
lemma lesubstep_type_simple:
"xs [⊑.le (=) r] ys ==> set xs {⊑} set ys"
(*<*)
apply (unfold lesubstep_type_def)
apply clarify
apply (simp add: set_conv_nth)
apply clarify
apply (drule le_listD, assumption)
apply (clarsimp simp add: lesub_def Product.le_def)
apply (rule exI)
apply (rule conjI)
apply (rule exI)
apply (rule conjI)
apply (rule sym)
apply assumption
apply assumption
apply assumption
done
(*>*)
declare is_relevant_entry_def [simp del]
lemma conjI2: "[ A; A ==> B ] ==> A ∧ B" by blast
lemma (in JVM_sl) eff_mono:
"[wf_prog p P; pc < length is; s ⊑ P t; app pc t]
==> set (eff pc s) {⊑ P} set (eff pc t)"
(*<*)
apply simp
apply (unfold Effect.eff_def)
apply (cases t)
apply (simp add: lesub_def)
apply (rename_tac a)
apply (cases s)
apply simp
apply (rename_tac b)
apply simp
apply (rule lesubstep_union)
prefer 2
apply (rule lesubstep_type_simple)
apply (simp add: xcpt_eff_def)
apply (rule le_listI)
apply (simp add: split_beta)
apply (simp add: split_beta)
apply (simp add: lesub_def fun_of_def)
apply (case_tac a)
apply (case_tac b)
apply simp
apply (subgoal_tac "size ab = size aa")
prefer 2
apply (clarsimp simp add: list_all2_lengthD)
apply simp
apply (clarsimp simp add: norm_eff_def lesubstep_type_def lesub_def iff del: sup_state_conv)
apply (rule exI)
apply (rule conjI2)
apply (rule imageI)
apply (clarsimp simp add: Effect.app_def iff del: sup_state_conv)
apply (drule (2) succs_mono)
apply blast
apply simp
apply (erule effi_mono)
apply simp
apply assumption
apply clarsimp
apply clarsimp
done
(*>*)
lemma (in JVM_sl) bounded_step: "bounded step (size is)"
(*<*)
apply simp
apply (unfold bounded_def err_step_def Effect.app_def Effect.eff_def)
apply (auto simp add: error_def map_snd_def split: err.splits option.splits)
done
(*>*)
theorem (in JVM_sl) step_mono:
"wf_prog wf_mb P ==> mono r step (size is) A"
(*<*)
apply (simp add: JVM_le_Err_conv)
apply (insert bounded_step)
apply (unfold JVM_states_unfold)
apply (rule mono_lift
apply blast
apply (unfold app_mono_def lesub_def)
apply clarsimp
apply (erule (2) app_mono)
apply simp
apply clarify
apply (drule eff_mono)
apply (auto simp add: lesub_def)
done
(*>*)
lemma (in start_context) first_in_A [iff]: "OK first ∈ A"
using Ts C by (force intro!: list_appendI simp add: JVM_states_unfold)
lemma (in JVM_sl) wt_method_def2:
java.lang.NullPointerException
(is ≠ [] ∧
sizesubst aGrou.ag_pOp_commute, assumpti+,
OK ` set τs ⊆ states P mxs mxl ∧
wt_start P C' Ts mxl.ag_pOp_as aGroup.ag_r_inv1 aGroup.ag_r_zero)
wt_app_eff (sup_state_opt P) app eff τs)"
(*<*)
apply (unfold wt_method_def wt_app_eff_def wt_instr_def lesub_def check_types_def)
apply auto
done
(*>*)
end
¤ Dauer der Verarbeitung: 0.10 Sekunden
¤
*© Formatika GbR, Deutschland