section‹Conformance Relations for Type Soundness Proofs›
theory Conform imports Exceptions begin
definition conf :: "'m prog ==> heap ==> val ==> ty ==> bool" (‹_,_ ⊨ _ :≤ _› [51,51,51,51] 50) where "P,h ⊨ v :≤ T ≡ ∃T'. typeof v = Some T' ∧ P ⊨ T' ≤ T"
definition oconf :: "'m prog ==> heap ==> obj ==> bool" (‹_,_ ⊨ _ √› [51,51,51] 50) where "P,h ⊨ obj √≡ let (C,fs) = obj in ∀F D T. P ⊨ C has F:T in D ⟶ (∃v. fs(F,D) = Some v ∧ P,h ⊨ v :≤ T)"
definition hconf :: "'m prog ==> heap ==> bool" (‹_ ⊨ _ √› [51,51] 50) where "P ⊨ h √≡ (∀a obj. h a = Some obj ⟶ P,h ⊨ obj √) ∧ preallocated h"
definition lconf :: "'m prog ==> heap ==> (vname ⇀ val) ==> (vname ⇀ ty) ==> bool" (‹_,_ ⊨ _ '(:≤') _› [51,51,51,51] 50) where "P,h ⊨ l (:≤) E ≡ ∀V v. l V = Some v ⟶ (∃T. E V = Some T ∧ P,h ⊨ v :≤ T)"
abbreviation
confs :: "'m prog ==> heap ==> val list ==> ty list ==> bool"
(‹_,_ ⊨ _ [:≤] _› [51,51,51,51] 50) where "P,h ⊨ vs [:≤] Ts ≡ list_all2 (conf P h) vs Ts"
subsection‹Value conformance ‹:≤››
lemma conf_Null [simp]: "P,h ⊨ Null :≤ T = P ⊨ NT ≤ T" (*<*)by (simp (no_asm) add: conf_def)(*>*)
lemma typeof_conf[simp]: "typeof v = Some T ==> P,h ⊨ v :≤ T" (*<*)by (induct v) (auto simp: conf_def)(*>*)
lemma typeof_lit_conf[simp]: "typeof v = Some T ==> P,h ⊨ v :≤ T" (*<*)by (rule typeof_conf[OF typeof_lit_typeof])(*>*)
lemma conf_upd_obj: "h a = Some(C,fs) ==> (P,h(a↦(C,fs')) ⊨ x :≤ T) = (P,h ⊨ x :≤T)" (*<*)by (rule val.induct) (auto simp:conf_def fun_upd_apply)(*>*)
lemma conf_widen: "P,h ⊨ v :≤ T ==> P ⊨ T ≤ T' ==> P,h ⊨ v :≤ T'" (*<*)by (induct v) (auto intro: widen_trans simp: conf_def)(*>*)
lemma conf_hext: "h ⊴ h' ==> P,h ⊨ v :≤ T ==> P,h' ⊨ v :≤ T" (*<*)by (induct v) (auto dest: hext_objD simp: conf_def)(*>*)
lemma conf_ClassD: "P,h ⊨ v :≤ Class C ==> v = Null ∨ (∃a obj T. v = Addr a ∧ h a = Some obj ∧ obj_ty obj = T ∧ P ⊨ T ≤ Class C)" (*<*)by(induct v) (auto simp: conf_def)(*>*)
lemma conf_NT [iff]: "P,h ⊨ v :≤ NT = (v = Null)" (*<*)by (auto simp add: conf_def)(*>*)
lemma non_npD: "[ v ≠ Null; P,h ⊨ v :≤ Class C ] ==>∃a C' fs. v = Addr a ∧ h a = Some(C',fs) ∧ P ⊨ C' ⪯* C" (*<*)by (auto dest: conf_ClassD)(*>*)
subsection‹Value list conformance ‹[:≤]››
lemma confs_widens [trans]: "[P,h ⊨ vs [:≤] Ts; P ⊨ Ts [≤] Ts']==> P,h ⊨ vs [:≤] Ts'" (*<*)by(auto intro: list_all2_trans conf_widen)(*>*)
lemma confs_rev: "P,h ⊨ rev s [:≤] t = (P,h ⊨ s [:≤] rev t)" (*<*)by (simp add: list_all2_rev1)(*>*)
lemma confs_conv_map: "∧Ts'. P,h ⊨ vs [:≤] Ts' = (∃Ts. map typeof vs = map Some Ts ∧ P ⊨ Ts [≤] Ts')" (*<*) proof(induct vs) case (Cons a vs) thenshow ?caseby(case_tac Ts') (auto simp add:conf_def) qed simp (*>*)
lemma confs_hext: "P,h ⊨ vs [:≤] Ts ==> h ⊴ h' ==> P,h' ⊨ vs [:≤] Ts" (*<*)by (erule list_all2_mono, erule conf_hext, assumption)(*>*)
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.