(* Title: HOL/MicroJava/BV/Typing_Framework_JVM.thy Author: Tobias Nipkow, Gerwin Klein Copyright 2000 TUM *)
section‹The Typing Framework for the JVM \label{sec:JVM}›
theory Typing_Framework_JVM imports"../DFA/Abstract_BV" JVMType EffectMono BVSpec begin
definition exec :: "jvm_prog ==> nat ==> ty ==> exception_table ==> instr list ==>JVMType.state step_type"where "exec G maxs rT et bs == err_step (size bs) (λpc. app (bs!pc) G maxs rT pc et) (λpc. eff (bs!pc) G pc et)"
definition opt_states :: "'c prog ==> nat ==> nat ==> (ty list × ty err list) option set"where "opt_states G maxs maxr ≡ opt (∪{list n (types G) |n. n ≤ maxs} × list maxr (err (types G)))"
subsection‹Executability of 🍋‹check_bounded›\›
primrec list_all'_rec :: "('a ==> nat ==> bool) ==> nat ==> 'a list ==> bool" where "list_all'_rec P n [] = True"
| "list_all'_rec P n (x#xs) = (P x n ∧ list_all'_rec P (Suc n) xs)"
definition list_all' :: "('a ==> nat ==> bool) ==> 'a list ==> bool"where "list_all' P xs ≡ list_all'_rec P 0 xs"
lemma list_all'_rec: "list_all'_rec P n xs = (∀p < size xs. P (xs!p) (p+n))" apply (induct xs arbitrary: n) apply auto apply (case_tac p) apply auto done
lemma list_all' [iff]: "list_all' P xs = (∀n < size xs. P (xs!n) n)" by (unfold list_all'_def) (simp add: list_all'_rec)
lemma [code]: "check_bounded ins et = (list_all' (λi pc. list_all (λpc'. pc' < length ins) (succs i pc)) ins ∧ list_all (λe. fst (snd (snd e)) < length ins) et)" by (simp add: list_all_iff check_bounded_def)
subsection‹Connecting JVM and Framework›
lemma check_bounded_is_bounded: "check_bounded ins et ==> bounded (λpc. eff (ins!pc) G pc et) (length ins)" by (unfold bounded_def) (blast dest: check_boundedD)
lemma special_ex_swap_lemma [iff]: "(∃X. (∃n. X = A n ∧ P n) & Q X) = (∃n. Q(A n) ∧ P n)" by blast
lemma sl_triple_conv: "JVMType.sl G maxs maxr == (states G maxs maxr, JVMType.le G maxs maxr, JVMType.sup G maxs maxr)" by (simp (no_asm) add: states_def JVMType.le_def JVMType.sup_def)
lemma is_type_pTs: "[ wf_prog wf_mb G; (C,S,fs,mdecls) ∈ set G; ((mn,pTs),rT,code) ∈ set mdecls ] ==> set pTs ⊆ types G" proof assume"wf_prog wf_mb G" "(C,S,fs,mdecls) ∈ set G" "((mn,pTs),rT,code) ∈ set mdecls" hence"wf_mdecl wf_mb G C ((mn,pTs),rT,code)" by (rule wf_prog_wf_mdecl) hence"∀t ∈ set pTs. is_type G t" by (unfold wf_mdecl_def wf_mhead_def) auto moreover fix t assume"t ∈ set pTs" ultimately have"is_type G t"by blast thus"t ∈ types G" .. qed
lemma jvm_prog_lift: assumes wf: "wf_prog (λG C bd. P G C bd) G"
assumes rule: "∧wf_mb C mn pTs C rT maxs maxl b et bd. wf_prog wf_mb G ==> method (G,C) (mn,pTs) = Some (C,rT,maxs,maxl,b,et) ==> is_class G C ==> set pTs ⊆ types G ==> bd = ((mn,pTs),rT,maxs,maxl,b,et) ==> P G C bd ==> Q G C bd"
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.