fun blocks :: "vname list * ty list * val list * expr ==> expr" where "blocks(V#Vs, T#Ts, v#vs, e) = {V:T := Val v; blocks(Vs,Ts,vs,e)}"
|"blocks([],[],[],e) = e"
| CallObj: "P ⊨⟨e,s⟩→⟨e',s'⟩==> P ⊨⟨e∙M(es),s⟩→⟨e'∙M(es),s'⟩"
| CallParams: "P ⊨⟨es,s⟩ [→] ⟨es',s'⟩==> P ⊨⟨(Val v)∙M(es),s⟩→⟨(Val v)∙M(es'),s'⟩"
| RedCall: "[ hp s a = Some(C,fs); P ⊨ C sees M:Ts→T = (pns,body) in D; size vs = size pns; size Ts = size pns ] ==> P ⊨⟨(addr a)∙M(map Val vs), s⟩→⟨blocks(this#pns, Class D#Ts, Addr a#vs, body), s⟩"
| RedCallNull: "P ⊨⟨null∙M(map Val vs),s⟩→⟨THROW NullPointer,s⟩"
| BlockRedNone: "[ P ⊨⟨e, (h,l(V:=None))⟩→⟨e', (h',l')⟩; l' V = None; ¬ assigned V e ] ==> P ⊨⟨{V:T; e}, (h,l)⟩→⟨{V:T; e'}, (h',l'(V := l V))⟩"
| BlockRedSome: "[ P ⊨⟨e, (h,l(V:=None))⟩→⟨e', (h',l')⟩; l' V = Some v;¬ assigned V e ] ==> P ⊨⟨{V:T; e}, (h,l)⟩→⟨{V:T := Val v; e'}, (h',l'(V := l V))⟩"
| InitBlockRed: "[ P ⊨⟨e, (h,l(V↦v))⟩→⟨e', (h',l')⟩; l' V = Some v' ] ==> P ⊨⟨{V:T := Val v; e}, (h,l)⟩→⟨{V:T := Val v'; e'}, (h',l'(V := l V))⟩"
| RedBlock: "P ⊨⟨{V:T; Val u}, s⟩→⟨Val u, s⟩"
| RedInitBlock: "P ⊨⟨{V:T := Val v; Val u}, s⟩→⟨Val u, s⟩"
| SeqRed: "P ⊨⟨e,s⟩→⟨e',s'⟩==> P ⊨⟨e;;e2, s⟩→⟨e';;e2, s'⟩"
abbreviation
Steps :: "J_prog ==> expr list ==> state ==> expr list ==> state ==> bool"
(‹_ ⊨ ((1⟨_,/_⟩) [→]*/ (1⟨_,/_⟩))› [51,0,0,0,0] 81) where"P ⊨⟨es,s⟩ [→]* ⟨es',s'⟩≡ ((es,s), es',s') ∈ (reds P)*"
lemma converse_rtrancl_induct_red[consumes 1]: assumes"P ⊨⟨e,(h,l)⟩→* ⟨e',(h',l')⟩" and"∧e h l. R e h l e h l" and"∧e0 h0 l0 e1 h1 l1 e' h' l'. [ P ⊨⟨e0,(h0,l0)⟩→⟨e1,(h1,l1)⟩; R e1 h1 l1 e' h' l' ]==> R e0 h0 l0 e' h' l'" shows"R e h l e' h' l'" (*<*) proof -
{ fix s s' assume reds: "P ⊨⟨e,s⟩→* ⟨e',s'⟩" and base: "∧e s. R e (hp s) (lcl s) e (hp s) (lcl s)" and red1: "∧e0 s0 e1 s1 e' s'. [ P ⊨⟨e0,s0⟩→⟨e1,s1⟩; R e1 (hp s1) (lcl s1) e' (hp s') (lcl s') ] ==> R e0 (hp s0) (lcl s0) e' (hp s') (lcl s')" from reds have"R e (hp s) (lcl s) e' (hp s') (lcl s')" proof (induct rule:converse_rtrancl_induct2) case refl show ?caseby(rule base) next case (step e0 s0 e s) thus ?caseby(blast intro:red1) qed
} with assms show ?thesis by fastforce qed (*>*)
subsection‹Some easy lemmas›
lemma [iff]: "¬ P ⊨⟨[],s⟩ [→] ⟨es',s'⟩" (*<*)by(blast elim: reds.cases)(*>*)
lemma [iff]: "¬ P ⊨⟨Val v,s⟩→⟨e',s'⟩" (*<*)by(fastforce elim: red.cases)(*>*)
lemma [iff]: "¬ P ⊨⟨Throw a,s⟩→⟨e',s'⟩" (*<*)by(fastforce elim: red.cases)(*>*)
lemma red_hext_incr: "P ⊨⟨e,(h,l)⟩→⟨e',(h',l')⟩==> h ⊴ h'" and reds_hext_incr: "P ⊨⟨es,(h,l)⟩ [→] ⟨es',(h',l')⟩==> h ⊴ h'" (*<*) proof(induct rule:red_reds_inducts) case RedNew thus ?case by(fastforce dest:new_Addr_SomeD simp:hext_def split:if_splits) next case RedFAss thus ?caseby(simp add:hext_def split:if_splits) qed simp_all (*>*)
lemma red_lcl_incr: "P ⊨⟨e,(h0,l0)⟩→⟨e',(h1,l1)⟩==> dom l0⊆ dom l1" and"P ⊨⟨es,(h0,l0)⟩ [→] ⟨es',(h1,l1)⟩==> dom l0⊆ dom l1" (*<*)by(induct rule: red_reds_inducts)(auto simp del:fun_upd_apply)(*>*)
lemma red_lcl_add: "P ⊨⟨e,(h,l)⟩→⟨e',(h',l')⟩==> (∧l0. P ⊨⟨e,(h,l0++l)⟩→⟨e',(h',l0++l')⟩)" and"P ⊨⟨es,(h,l)⟩ [→] ⟨es',(h',l')⟩==> (∧l0. P ⊨⟨es,(h,l0++l)⟩ [→] ⟨es',(h',l0++l')⟩)" (*<*) proof (induct rule:red_reds_inducts) case RedCast thus ?caseby(fastforce intro:red_reds.intros) next case RedCastFail thus ?caseby(force intro:red_reds.intros) next case RedFAcc thus ?caseby(fastforce intro:red_reds.intros) next case RedCall thus ?caseby(fastforce intro:red_reds.intros) next case (InitBlockRed e h l V v e' h' l' v' T l0) have IH: "∧l0. P ⊨⟨e,(h, l0 ++ l(V ↦ v))⟩→⟨e',(h', l0 ++ l')⟩" and l'V: "l' V = Some v'"by fact+ from IH have IH': "P ⊨⟨e,(h, (l0 ++ l)(V ↦ v))⟩→⟨e',(h', l0 ++ l')⟩" by simp have"(l0 ++ l')(V := (l0 ++ l) V) = l0 ++ l'(V := l V)" by(rule ext)(simp add:map_add_def) with red_reds.InitBlockRed[OF IH'] l'V show ?caseby(simp del:fun_upd_apply) next case (BlockRedNone e h l V e' h' l' T l0) have IH: "∧l0. P ⊨⟨e,(h, l0 ++ l(V := None))⟩→⟨e',(h', l0 ++ l')⟩" and l'V: "l' V = None"and unass: "¬ assigned V e"by fact+ have"l0(V := None) ++ l(V := None) = (l0 ++ l)(V := None)" by(simp add:fun_eq_iff map_add_def) hence IH': "P ⊨⟨e,(h, (l0++l)(V := None))⟩→⟨e',(h', l0(V := None) ++ l')⟩" using IH[of "l0(V := None)"] by simp have"(l0(V := None) ++ l')(V := (l0 ++ l) V) = l0 ++ l'(V := l V)" by(simp add:fun_eq_iff map_add_def) with red_reds.BlockRedNone[OF IH' _ unass] l'V show ?case by(simp add: map_add_def) next case (BlockRedSome e h l V e' h' l' v T l0) have IH: "∧l0. P ⊨⟨e,(h, l0 ++ l(V := None))⟩→⟨e',(h', l0 ++ l')⟩" and l'V: "l' V = Some v"and unass: "¬ assigned V e"by fact+ have"l0(V := None) ++ l(V := None) = (l0 ++ l)(V := None)" by(simp add:fun_eq_iff map_add_def) hence IH': "P ⊨⟨e,(h, (l0++l)(V := None))⟩→⟨e',(h', l0(V := None) ++ l')⟩" using IH[of "l0(V := None)"] by simp have"(l0(V := None) ++ l')(V := (l0 ++ l) V) = l0 ++ l'(V := l V)" by(simp add:fun_eq_iff map_add_def) with red_reds.BlockRedSome[OF IH' _ unass] l'V show ?case by(simp add:map_add_def) next case RedTryCatch thus ?caseby(fastforce intro:red_reds.intros) next case RedTryFail thus ?caseby(force intro!:red_reds.intros) qed (simp_all add:red_reds.intros) (*>*)
lemma Red_lcl_add: assumes"P ⊨⟨e,(h,l)⟩→* ⟨e',(h',l')⟩"shows"P ⊨⟨e,(h,l0++l)⟩→* ⟨e',(h',l0++l')⟩" (*<*) using assms proof(induct rule:converse_rtrancl_induct_red) case1thus ?caseby simp next case2thus ?case by (blast dest: red_lcl_add intro: converse_rtrancl_into_rtrancl) qed (*>*)
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.