definition
groundVar :: "var → bool"where "groundVar v ⟷ (case v of LVar ln → True | {accC,statDeclC,stat}e..fn →∃ a. e=Lit a | e1.[e2] →∃ a i. e1= Lit a ∧ e2 = Lit i | InsInitV c v → False)"
lemma groundVar_cases: assumes ground: "groundVar v" obtains (LVar) ln where"v=LVar ln"
| (FVar) accC statDeclC stat a fn where"v={accC,statDeclC,stat}(Lit a)..fn"
| (AVar) a i where"v=(Lit a).[Lit i]" using ground LVar FVar AVar by (cases v) (auto simp add: groundVar_def)
definition
groundExprs :: "expr list → bool" where"groundExprs es ⟷ (∀e ∈ set es. ∃v. e = Lit v)"
primrec the_var:: "prog → state → var → (vvar × state)"where "the_var G s (LVar ln) = (lvar ln (store s),s)"
| the_var_FVar_def: "the_var G s ({accC,statDeclC,stat}a..fn) =fvar statDeclC stat fn (the_val a) s"
| the_var_AVar_def: "the_var G s(a.[i]) =avar G (the_val i) (the_val a) s"
lemma the_var_FVar_simp[simp]: "the_var G s ({accC,statDeclC,stat}(Lit a)..fn) = fvar statDeclC stat fn a s" by (simp) declare the_var_FVar_def [simp del]
lemma the_var_AVar_simp: "the_var G s ((Lit a).[Lit i]) = avar G i a s" by (simp) declare the_var_AVar_def [simp del]
inductive
step :: "[prog,term × state,term × state] → bool" (‹_⊨_ ↦1 _›[61,82,82] 81) for G :: prog where
(* evaluation of expression *) (* cf. 15.5 *)
Abrupt: "[∀v. t ≠⟨Lit v⟩; ∀ t. t ≠⟨l∙ Skip⟩; ∀ C vn c. t ≠⟨Try Skip Catch(C vn) c⟩; ∀ x c. t ≠⟨Skip Finally c⟩∧ xc ≠ Xcpt x; ∀ a c. t ≠⟨FinA a c⟩] ==> G⊨(t,Some xc,s) ↦1 (⟨Lit undefined⟩,Some xc,s)"
| InsInitE: "[G⊨(⟨c⟩,Norm s) ↦1 (⟨c'⟩, s')] ==> G⊨(⟨InsInitE c e⟩,Norm s) ↦1 (⟨InsInitE c' e⟩, s')"
(* Alternative when rule SeqE is present NewCInited:"\<lbrakk>initedC(globss); G\<turnstile>Norms\<midarrow>halloc(CInstC)\<succ>a\<rightarrow>s'\<rbrakk> \<Longrightarrow> G\<turnstile>(\<langle>NewCC\<rangle>,Norms)\<mapsto>1(\<langle>Refa\<rangle>,s')"
| Methd: "G⊨(⟨Methd D sig⟩,Norm s) ↦1 (⟨body G D sig⟩,Norm s)"
| Body: "G⊨(⟨Body D c⟩,Norm s) ↦1 (⟨InsInitE (Init D) (Body D c)⟩,Norm s)"
| InsInitBody: "[G⊨(⟨c⟩,Norm s) ↦1 (⟨c'⟩,s')] ==> G⊨(⟨InsInitE Skip (Body D c)⟩,Norm s) ↦1(⟨InsInitE Skip (Body D c')⟩,s')"
| InsInitBodyRet: "G⊨(⟨InsInitE Skip (Body D Skip)⟩,Norm s) ↦1 (⟨Lit (the ((locals s) Result))⟩,abupd (absorb Ret) (Norm s))"
(* LVar: "G\<turnstile>(LVar vn,Norm s)" is already evaluated *)
| FVar: "[¬ inited statDeclC (globs s)] ==> G⊨(⟨{accC,statDeclC,stat}e..fn⟩,Norm s) ↦1 (⟨InsInitV (Init statDeclC) ({accC,statDeclC,stat}e..fn)⟩,Norm s)"
| InsInitFVarE: "[G⊨(⟨e⟩,Norm s) ↦1 (⟨e'⟩,s')] ==> G⊨(⟨InsInitV Skip ({accC,statDeclC,stat}e..fn)⟩,Norm s) ↦1 (⟨InsInitV Skip ({accC,statDeclC,stat}e'..fn)⟩,s')"
| InsInitFVar: "G⊨(⟨InsInitV Skip ({accC,statDeclC,stat}Lit a..fn)⟩,Norm s) ↦1 (⟨{accC,statDeclC,stat}Lit a..fn⟩,Norm s)" ―‹Notice, that we do not have literal values for ‹vars›.
rules for accessing variables (‹Acc›) and assigning to variables ‹Ass›), test this with the predicate ‹groundVar›. After
is done and the ‹FVar› is evaluated, we can't just
away the ‹InsInitFVar› term and return a literal value, as in the
of ‹New› or ‹NewC›. Instead we just return the evaluated ‹FVar› and test for initialisation in the rule ‹FVar›.›
| Fin: "G⊨(⟨Skip Finally c2⟩,(a,s)) ↦1 (⟨FinA a c2⟩,Norm s)"
| FinAC: "[G⊨(⟨c⟩,s) ↦1 (⟨c'⟩,s')] ==> G⊨(⟨FinA a c⟩,s) ↦1 (⟨FinA a c'⟩,s')"
| FinA: "G⊨(⟨FinA a Skip⟩,s) ↦1 (⟨Skip⟩,abupd (abrupt_if (a≠None) a) s)"
| Init1: "[inited C (globs s)] ==> G⊨(⟨Init C⟩,Norm s) ↦1 (⟨Skip⟩,Norm s)"
| Init: "[the (class G C)=c; ¬ inited C (globs s)] ==> G⊨(⟨Init C⟩,Norm s) ↦1 (⟨(if C = Object then Skip else (Init (super c)));; Expr (Callee (locals s) (InsInitE (init c) SKIP))⟩ ,Norm (init_class_obj G C s))" ―‹‹InsInitE› is just used as trick to embed the statement ‹init c› into an expression›
| InsInitESKIP: "G⊨(⟨InsInitE Skip SKIP⟩,Norm s) ↦1 (⟨SKIP⟩,Norm s)"
abbreviation
stepn:: "[prog, term × state,nat,term × state] → bool" (‹_⊨_ ↦_ _›[61,82,82] 81) where"G⊨p ↦n p' ≡ (p,p') ∈ {(x, y). step G x y}^^n"
abbreviation
steptr:: "[prog,term × state,term × state] → bool" (‹_⊨_ ↦* _›[61,82,82] 81) where"G⊨p ↦* p' ≡ (p,p') ∈ {(x, y). step G x y}*"
(* lemmaimp_eval_trans: assumeseval:"G\<turnstile>s0\<midarrow>t\<succ>\<rightarrow>(v,s1)" showstrans:"G\<turnstile>(t,s0)\<mapsto>*(\<langle>Litv\<rangle>,s1)"
*) (* Jetzt muss man bei trans natürlich wieder unterscheiden: Stmt, Expr, Var! Sowasblödes: AmbestendenTerminusgroundaufVar,Stmt,Exprhochziehenunddann the_valsdefinieren\<dots> G\<turnstile>(t,s0)\<mapsto>*(t',s1)\<and>the_valst'=v
*)
end
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet am 2026-06-30)
¤
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.