definition init_vars :: "('a × ty) list => ('a ⇀ val)"where "init_vars == map_of o map (λ(n,T). (n,default_val T))"
type_synonym aheap = "loc ⇀ obj"―‹"‹heap›" used in a translation below› type_synonym locals = "vname ⇀ val"―‹simple state, i.e. variable contents›
type_synonym state = "aheap × locals"―‹heap, local parameter including This› type_synonym xstate = "val option × state"―‹state including exception information›
abbreviation (input)
heap :: "state => aheap" where"heap == fst"
abbreviation (input)
locals :: "state => locals" where"locals == snd"
lemma raise_if_True [simp]: "raise_if True x y ≠ None" apply (unfold raise_if_def) apply auto done
lemma raise_if_False [simp]: "raise_if False x y = y" apply (unfold raise_if_def) apply auto done
lemma raise_if_Some [simp]: "raise_if c x (Some y) ≠ None" apply (unfold raise_if_def) apply auto done
lemma raise_if_Some2 [simp]: "raise_if c z (if x = None then Some y else x) ≠ None" unfolding raise_if_def by (induct x) auto
lemma raise_if_SomeD [rule_format (no_asm)]: "raise_if c x y = Some z ⟶ c ∧ Some z = Some (Addr (XcptRef x)) | y = Some z" apply (unfold raise_if_def) apply auto done
lemma raise_if_NoneD [rule_format (no_asm)]: "raise_if c x y = None --> ¬ c ∧ y = None" apply (unfold raise_if_def) apply auto done
lemma np_NoneD [rule_format (no_asm)]: "np a' x' = None --> x' = None ∧ a' ≠ Null" apply (unfold np_def raise_if_def) apply auto done
lemma np_Some [simp]: "np a' (Some xc) = Some xc" apply (unfold np_def raise_if_def) apply auto done
lemma np_Null [simp]: "np Null None = Some (Addr (XcptRef NullPointer))" apply (unfold np_def raise_if_def) apply auto done
lemma np_Addr [simp]: "np (Addr a) None = None" apply (unfold np_def raise_if_def) apply auto done
lemma np_raise_if [simp]: "(np Null (raise_if c xc None)) = Some (Addr (XcptRef (if c then xc else NullPointer)))" apply (unfold raise_if_def) apply (simp (no_asm)) done
lemma c_hupd_fst [simp]: "fst (c_hupd h (x, s)) = x" by (simp add: c_hupd_def split_beta)
text‹Naive implementation for term‹new_Addr› by exhaustive search›
definition gen_new_Addr :: "aheap => nat → loc × val option"where "gen_new_Addr h n ≡ if ∃a. a ≥ n ∧ h (Loc (nat_to_loc' a)) = None then (Loc (nat_to_loc' (LEAST a. a ≥ n ∧ h (Loc (nat_to_loc' a)) = None)), None) else (Loc (nat_to_loc' 0), Some (Addr (XcptRef OutOfMemory)))"
lemma new_Addr_code_code [code]: "new_Addr h = gen_new_Addr h 0" by(simp only: new_Addr_def gen_new_Addr_def split: if_split) simp
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.