151 constdefs |
151 constdefs |
152 empty_dt :: "dyn_ty" |
152 empty_dt :: "dyn_ty" |
153 "empty_dt \<equiv> \<lambda>a. None" |
153 "empty_dt \<equiv> \<lambda>a. None" |
154 |
154 |
155 invmode :: "('a::type)member_scheme \<Rightarrow> expr \<Rightarrow> inv_mode" |
155 invmode :: "('a::type)member_scheme \<Rightarrow> expr \<Rightarrow> inv_mode" |
156 "invmode m e \<equiv> if static m then Static else if e=Super then SuperM else IntVir" |
156 "invmode m e \<equiv> if is_static m |
|
157 then Static |
|
158 else if e=Super then SuperM else IntVir" |
157 |
159 |
158 lemma invmode_nonstatic [simp]: |
160 lemma invmode_nonstatic [simp]: |
159 "invmode \<lparr>access=a,static=False,\<dots>=x\<rparr> (Acc (LVar e)) = IntVir" |
161 "invmode \<lparr>access=a,static=False,\<dots>=x\<rparr> (Acc (LVar e)) = IntVir" |
160 apply (unfold invmode_def) |
162 apply (unfold invmode_def) |
161 apply (simp (no_asm)) |
163 apply (simp (no_asm) add: member_is_static_simp) |
162 done |
164 done |
163 |
165 |
164 |
166 |
165 lemma invmode_Static_eq [simp]: "(invmode m e = Static) = static m" |
167 lemma invmode_Static_eq [simp]: "(invmode m e = Static) = is_static m" |
166 apply (unfold invmode_def) |
168 apply (unfold invmode_def) |
167 apply (simp (no_asm)) |
169 apply (simp (no_asm)) |
168 done |
170 done |
169 |
171 |
170 |
172 |
171 lemma invmode_IntVir_eq: "(invmode m e = IntVir) = (\<not>(static m) \<and> e\<noteq>Super)" |
173 lemma invmode_IntVir_eq: "(invmode m e = IntVir) = (\<not>(is_static m) \<and> e\<noteq>Super)" |
172 apply (unfold invmode_def) |
174 apply (unfold invmode_def) |
173 apply (simp (no_asm)) |
175 apply (simp (no_asm)) |
174 done |
176 done |
175 |
177 |
176 lemma Null_staticD: |
178 lemma Null_staticD: |
177 "a'=Null \<longrightarrow> (static m) \<Longrightarrow> invmode m e = IntVir \<longrightarrow> a' \<noteq> Null" |
179 "a'=Null \<longrightarrow> (is_static m) \<Longrightarrow> invmode m e = IntVir \<longrightarrow> a' \<noteq> Null" |
178 apply (clarsimp simp add: invmode_IntVir_eq) |
180 apply (clarsimp simp add: invmode_IntVir_eq) |
179 done |
181 done |
180 |
182 |
181 |
183 |
182 types tys = "ty + ty list" |
184 types tys = "ty + ty list" |
335 Call: "\<lbrakk>E,dt\<Turnstile>e\<Colon>-RefT statT; |
337 Call: "\<lbrakk>E,dt\<Turnstile>e\<Colon>-RefT statT; |
336 E,dt\<Turnstile>ps\<Colon>\<doteq>pTs; |
338 E,dt\<Turnstile>ps\<Colon>\<doteq>pTs; |
337 max_spec (prg E) (cls E) statT \<lparr>name=mn,parTs=pTs\<rparr> |
339 max_spec (prg E) (cls E) statT \<lparr>name=mn,parTs=pTs\<rparr> |
338 = {((statDeclT,m),pTs')} |
340 = {((statDeclT,m),pTs')} |
339 \<rbrakk> \<Longrightarrow> |
341 \<rbrakk> \<Longrightarrow> |
340 E,dt\<Turnstile>{statT,invmode m e}e\<cdot>mn({pTs'}ps)\<Colon>-(resTy m)" |
342 E,dt\<Turnstile>{cls E,statT,invmode m e}e\<cdot>mn({pTs'}ps)\<Colon>-(resTy m)" |
341 |
343 |
342 Methd: "\<lbrakk>is_class (prg E) C; |
344 Methd: "\<lbrakk>is_class (prg E) C; |
343 methd (prg E) C sig = Some m; |
345 methd (prg E) C sig = Some m; |
344 E,dt\<Turnstile>Body (declclass m) (stmt (mbody (mthd m)))\<Colon>-T\<rbrakk> \<Longrightarrow> |
346 E,dt\<Turnstile>Body (declclass m) (stmt (mbody (mthd m)))\<Colon>-T\<rbrakk> \<Longrightarrow> |
345 E,dt\<Turnstile>Methd C sig\<Colon>-T" |
347 E,dt\<Turnstile>Methd C sig\<Colon>-T" |
365 (* cf. 15.13.1 *) |
367 (* cf. 15.13.1 *) |
366 LVar: "\<lbrakk>lcl E vn = Some T; is_acc_type (prg E) (pkg E) T\<rbrakk> \<Longrightarrow> |
368 LVar: "\<lbrakk>lcl E vn = Some T; is_acc_type (prg E) (pkg E) T\<rbrakk> \<Longrightarrow> |
367 E,dt\<Turnstile>LVar vn\<Colon>=T" |
369 E,dt\<Turnstile>LVar vn\<Colon>=T" |
368 (* cf. 15.10.1 *) |
370 (* cf. 15.10.1 *) |
369 FVar: "\<lbrakk>E,dt\<Turnstile>e\<Colon>-Class C; |
371 FVar: "\<lbrakk>E,dt\<Turnstile>e\<Colon>-Class C; |
370 accfield (prg E) (cls E) C fn = Some (fd,f)\<rbrakk> \<Longrightarrow> |
372 accfield (prg E) (cls E) C fn = Some (statDeclC,f)\<rbrakk> \<Longrightarrow> |
371 E,dt\<Turnstile>{fd,static f}e..fn\<Colon>=(type f)" |
373 E,dt\<Turnstile>{cls E,statDeclC,is_static f}e..fn\<Colon>=(type f)" |
372 (* cf. 15.12 *) |
374 (* cf. 15.12 *) |
373 AVar: "\<lbrakk>E,dt\<Turnstile>e\<Colon>-T.[]; |
375 AVar: "\<lbrakk>E,dt\<Turnstile>e\<Colon>-T.[]; |
374 E,dt\<Turnstile>i\<Colon>-PrimT Integer\<rbrakk> \<Longrightarrow> |
376 E,dt\<Turnstile>i\<Colon>-PrimT Integer\<rbrakk> \<Longrightarrow> |
375 E,dt\<Turnstile>e.[i]\<Colon>=T" |
377 E,dt\<Turnstile>e.[i]\<Colon>=T" |
376 |
378 |
393 simpset_ref() := simpset() delloop "split_all_tac" |
395 simpset_ref() := simpset() delloop "split_all_tac" |
394 *} |
396 *} |
395 inductive_cases wt_stmt_cases: "E,dt\<Turnstile>c\<Colon>\<surd>" |
397 inductive_cases wt_stmt_cases: "E,dt\<Turnstile>c\<Colon>\<surd>" |
396 inductive_cases wt_elim_cases: |
398 inductive_cases wt_elim_cases: |
397 "E,dt\<Turnstile>In2 (LVar vn) \<Colon>T" |
399 "E,dt\<Turnstile>In2 (LVar vn) \<Colon>T" |
398 "E,dt\<Turnstile>In2 ({fd,s}e..fn) \<Colon>T" |
400 "E,dt\<Turnstile>In2 ({accC,statDeclC,s}e..fn)\<Colon>T" |
399 "E,dt\<Turnstile>In2 (e.[i]) \<Colon>T" |
401 "E,dt\<Turnstile>In2 (e.[i]) \<Colon>T" |
400 "E,dt\<Turnstile>In1l (NewC C) \<Colon>T" |
402 "E,dt\<Turnstile>In1l (NewC C) \<Colon>T" |
401 "E,dt\<Turnstile>In1l (New T'[i]) \<Colon>T" |
403 "E,dt\<Turnstile>In1l (New T'[i]) \<Colon>T" |
402 "E,dt\<Turnstile>In1l (Cast T' e) \<Colon>T" |
404 "E,dt\<Turnstile>In1l (Cast T' e) \<Colon>T" |
403 "E,dt\<Turnstile>In1l (e InstOf T') \<Colon>T" |
405 "E,dt\<Turnstile>In1l (e InstOf T') \<Colon>T" |
404 "E,dt\<Turnstile>In1l (Lit x) \<Colon>T" |
406 "E,dt\<Turnstile>In1l (Lit x) \<Colon>T" |
405 "E,dt\<Turnstile>In1l (Super) \<Colon>T" |
407 "E,dt\<Turnstile>In1l (Super) \<Colon>T" |
406 "E,dt\<Turnstile>In1l (Acc va) \<Colon>T" |
408 "E,dt\<Turnstile>In1l (Acc va) \<Colon>T" |
407 "E,dt\<Turnstile>In1l (Ass va v) \<Colon>T" |
409 "E,dt\<Turnstile>In1l (Ass va v) \<Colon>T" |
408 "E,dt\<Turnstile>In1l (e0 ? e1 : e2) \<Colon>T" |
410 "E,dt\<Turnstile>In1l (e0 ? e1 : e2) \<Colon>T" |
409 "E,dt\<Turnstile>In1l ({statT,mode}e\<cdot>mn({pT'}p))\<Colon>T" |
411 "E,dt\<Turnstile>In1l ({accC,statT,mode}e\<cdot>mn({pT'}p))\<Colon>T" |
410 "E,dt\<Turnstile>In1l (Methd C sig) \<Colon>T" |
412 "E,dt\<Turnstile>In1l (Methd C sig) \<Colon>T" |
411 "E,dt\<Turnstile>In1l (Body D blk) \<Colon>T" |
413 "E,dt\<Turnstile>In1l (Body D blk) \<Colon>T" |
412 "E,dt\<Turnstile>In3 ([]) \<Colon>Ts" |
414 "E,dt\<Turnstile>In3 ([]) \<Colon>Ts" |
413 "E,dt\<Turnstile>In3 (e#es) \<Colon>Ts" |
415 "E,dt\<Turnstile>In3 (e#es) \<Colon>Ts" |
414 "E,dt\<Turnstile>In1r Skip \<Colon>x" |
416 "E,dt\<Turnstile>In1r Skip \<Colon>x" |
461 "\<lbrakk>lcl E This = Some (Class C); C \<noteq> Object; |
463 "\<lbrakk>lcl E This = Some (Class C); C \<noteq> Object; |
462 class (prg E) C = Some c;D=super c\<rbrakk> |
464 class (prg E) C = Some c;D=super c\<rbrakk> |
463 \<Longrightarrow> E,dt\<Turnstile>Super\<Colon>-Class D" |
465 \<Longrightarrow> E,dt\<Turnstile>Super\<Colon>-Class D" |
464 by (auto elim: wt.Super) |
466 by (auto elim: wt.Super) |
465 |
467 |
|
468 |
466 lemma wt_Call: |
469 lemma wt_Call: |
467 "\<lbrakk>E,dt\<Turnstile>e\<Colon>-RefT statT; E,dt\<Turnstile>ps\<Colon>\<doteq>pTs; |
470 "\<lbrakk>E,dt\<Turnstile>e\<Colon>-RefT statT; E,dt\<Turnstile>ps\<Colon>\<doteq>pTs; |
468 max_spec (prg E) (cls E) statT \<lparr>name=mn,parTs=pTs\<rparr> |
471 max_spec (prg E) (cls E) statT \<lparr>name=mn,parTs=pTs\<rparr> |
469 = {((statDeclC,m),pTs')};rT=(resTy m); |
472 = {((statDeclC,m),pTs')};rT=(resTy m);accC=cls E; |
470 mode = invmode m e\<rbrakk> \<Longrightarrow> E,dt\<Turnstile>{statT,mode}e\<cdot>mn({pTs'}ps)\<Colon>-rT" |
473 mode = invmode m e\<rbrakk> \<Longrightarrow> E,dt\<Turnstile>{accC,statT,mode}e\<cdot>mn({pTs'}ps)\<Colon>-rT" |
471 by (auto elim: wt.Call) |
474 by (auto elim: wt.Call) |
472 |
|
473 |
475 |
474 |
476 |
475 lemma invocationTypeExpr_noClassD: |
477 lemma invocationTypeExpr_noClassD: |
476 "\<lbrakk> E\<turnstile>e\<Colon>-RefT statT\<rbrakk> |
478 "\<lbrakk> E\<turnstile>e\<Colon>-RefT statT\<rbrakk> |
477 \<Longrightarrow> (\<forall> statC. statT \<noteq> ClassT statC) \<longrightarrow> invmode m e \<noteq> SuperM" |
479 \<Longrightarrow> (\<forall> statC. statT \<noteq> ClassT statC) \<longrightarrow> invmode m e \<noteq> SuperM" |
491 lemma wt_Super: |
493 lemma wt_Super: |
492 "\<lbrakk>lcl E This = Some (Class C); C \<noteq> Object; class (prg E) C = Some c; D=super c\<rbrakk> |
494 "\<lbrakk>lcl E This = Some (Class C); C \<noteq> Object; class (prg E) C = Some c; D=super c\<rbrakk> |
493 \<Longrightarrow> E,dt\<Turnstile>Super\<Colon>-Class D" |
495 \<Longrightarrow> E,dt\<Turnstile>Super\<Colon>-Class D" |
494 by (auto elim: wt.Super) |
496 by (auto elim: wt.Super) |
495 |
497 |
496 |
|
497 lemma wt_FVar: |
498 lemma wt_FVar: |
498 "\<lbrakk>E,dt\<Turnstile>e\<Colon>-Class C; accfield (prg E) (cls E) C fn = Some (fd,f); |
499 "\<lbrakk>E,dt\<Turnstile>e\<Colon>-Class C; accfield (prg E) (cls E) C fn = Some (statDeclC,f); |
499 sf=static f; fT=(type f)\<rbrakk> \<Longrightarrow> E,dt\<Turnstile>{fd,sf}e..fn\<Colon>=fT" |
500 sf=is_static f; fT=(type f); accC=cls E\<rbrakk> |
500 by (auto elim: wt.FVar) |
501 \<Longrightarrow> E,dt\<Turnstile>{accC,statDeclC,sf}e..fn\<Colon>=fT" |
|
502 by (auto dest: wt.FVar) |
|
503 |
501 |
504 |
502 lemma wt_init [iff]: "E,dt\<Turnstile>Init C\<Colon>\<surd> = is_class (prg E) C" |
505 lemma wt_init [iff]: "E,dt\<Turnstile>Init C\<Colon>\<surd> = is_class (prg E) C" |
503 by (auto elim: wt_elim_cases intro: "wt.Init") |
506 by (auto elim: wt_elim_cases intro: "wt.Init") |
504 |
507 |
505 declare wt.Skip [iff] |
508 declare wt.Skip [iff] |