src/HOL/Bali/Evaln.thy
changeset 21765 89275a3ed7be
parent 18249 4398f0f12579
child 22218 30a8890d2967
equal deleted inserted replaced
21764:720b0add5206 21765:89275a3ed7be
    26 @{term check_field_access} and @{term check_method_access} like @{term eval}. 
    26 @{term check_field_access} and @{term check_method_access} like @{term eval}. 
    27 If it would omit them @{term evaln} and @{term eval} would only be equivalent 
    27 If it would omit them @{term evaln} and @{term eval} would only be equivalent 
    28 for welltyped, and definitely assigned terms.
    28 for welltyped, and definitely assigned terms.
    29 *}
    29 *}
    30 
    30 
    31 consts
    31 inductive2
    32 
    32   evaln	:: "[prog, state, term, nat, vals, state] \<Rightarrow> bool"
    33   evaln	:: "prog \<Rightarrow> (state \<times> term \<times> nat \<times> vals \<times> state) set"
    33     ("_\<turnstile>_ \<midarrow>_\<succ>\<midarrow>_\<rightarrow> '(_, _')" [61,61,80,61,0,0] 60)
    34 
    34   and evarn :: "[prog, state, var, vvar, nat, state] \<Rightarrow> bool"
    35 syntax
    35     ("_\<turnstile>_ \<midarrow>_=\<succ>_\<midarrow>_\<rightarrow> _" [61,61,90,61,61,61] 60)
    36 
    36   and eval_n:: "[prog, state, expr, val, nat, state] \<Rightarrow> bool"
    37   evaln	:: "[prog, state, term,        nat, vals * state] => bool"
    37     ("_\<turnstile>_ \<midarrow>_-\<succ>_\<midarrow>_\<rightarrow> _" [61,61,80,61,61,61] 60)
    38 				("_|-_ -_>-_-> _"   [61,61,80,   61,61] 60)
    38   and evalsn :: "[prog, state, expr list, val  list, nat, state] \<Rightarrow> bool"
    39   evarn	:: "[prog, state, var  , vvar        , nat, state] => bool"
    39     ("_\<turnstile>_ \<midarrow>_\<doteq>\<succ>_\<midarrow>_\<rightarrow> _" [61,61,61,61,61,61] 60)
    40 				("_|-_ -_=>_-_-> _" [61,61,90,61,61,61] 60)
    40   and execn	:: "[prog, state, stmt, nat, state] \<Rightarrow> bool"
    41   eval_n:: "[prog, state, expr , val         , nat, state] => bool"
    41     ("_\<turnstile>_ \<midarrow>_\<midarrow>_\<rightarrow> _"     [61,61,65,   61,61] 60)
    42 				("_|-_ -_->_-_-> _" [61,61,80,61,61,61] 60)
    42   for G :: prog
    43   evalsn:: "[prog, state, expr list, val list, nat, state] => bool"
    43 where
    44 				("_|-_ -_#>_-_-> _" [61,61,61,61,61,61] 60)
    44 
    45   execn	:: "[prog, state, stmt ,               nat, state] => bool"
    45   "G\<turnstile>s \<midarrow>c     \<midarrow>n\<rightarrow>    s' \<equiv> G\<turnstile>s \<midarrow>In1r  c\<succ>\<midarrow>n\<rightarrow> (\<diamondsuit>    ,  s')"
    46 				("_|-_ -_-_-> _"    [61,61,65,   61,61] 60)
    46 | "G\<turnstile>s \<midarrow>e-\<succ>v  \<midarrow>n\<rightarrow>    s' \<equiv> G\<turnstile>s \<midarrow>In1l e\<succ>\<midarrow>n\<rightarrow> (In1 v ,  s')"
    47 
    47 | "G\<turnstile>s \<midarrow>e=\<succ>vf \<midarrow>n\<rightarrow>    s' \<equiv> G\<turnstile>s \<midarrow>In2  e\<succ>\<midarrow>n\<rightarrow> (In2 vf,  s')"
    48 syntax (xsymbols)
    48 | "G\<turnstile>s \<midarrow>e\<doteq>\<succ>v  \<midarrow>n\<rightarrow>    s' \<equiv> G\<turnstile>s \<midarrow>In3  e\<succ>\<midarrow>n\<rightarrow> (In3 v ,  s')"
    49 
       
    50   evaln	:: "[prog, state, term,         nat, vals \<times> state] \<Rightarrow> bool"
       
    51 				("_\<turnstile>_ \<midarrow>_\<succ>\<midarrow>_\<rightarrow> _"   [61,61,80,   61,61] 60)
       
    52   evarn	:: "[prog, state, var  , vvar         , nat, state] \<Rightarrow> bool"
       
    53 				("_\<turnstile>_ \<midarrow>_=\<succ>_\<midarrow>_\<rightarrow> _" [61,61,90,61,61,61] 60)
       
    54   eval_n:: "[prog, state, expr , val ,          nat, state] \<Rightarrow> bool"
       
    55 				("_\<turnstile>_ \<midarrow>_-\<succ>_\<midarrow>_\<rightarrow> _" [61,61,80,61,61,61] 60)
       
    56   evalsn:: "[prog, state, expr list, val  list, nat, state] \<Rightarrow> bool"
       
    57 				("_\<turnstile>_ \<midarrow>_\<doteq>\<succ>_\<midarrow>_\<rightarrow> _" [61,61,61,61,61,61] 60)
       
    58   execn	:: "[prog, state, stmt ,                nat, state] \<Rightarrow> bool"
       
    59 				("_\<turnstile>_ \<midarrow>_\<midarrow>_\<rightarrow> _"     [61,61,65,   61,61] 60)
       
    60 
       
    61 translations
       
    62 
       
    63   "G\<turnstile>s \<midarrow>t    \<succ>\<midarrow>n\<rightarrow>  w___s' " == "(s,t,n,w___s') \<in> evaln G"
       
    64   "G\<turnstile>s \<midarrow>t    \<succ>\<midarrow>n\<rightarrow> (w,  s')" <= "(s,t,n,w,  s') \<in> evaln G"
       
    65   "G\<turnstile>s \<midarrow>t    \<succ>\<midarrow>n\<rightarrow> (w,x,s')" <= "(s,t,n,w,x,s') \<in> evaln G"
       
    66   "G\<turnstile>s \<midarrow>c     \<midarrow>n\<rightarrow> (x,s')" <= "G\<turnstile>s \<midarrow>In1r  c\<succ>\<midarrow>n\<rightarrow> (\<diamondsuit>    ,x,s')"
       
    67   "G\<turnstile>s \<midarrow>c     \<midarrow>n\<rightarrow>    s' " == "G\<turnstile>s \<midarrow>In1r  c\<succ>\<midarrow>n\<rightarrow> (\<diamondsuit>    ,  s')"
       
    68   "G\<turnstile>s \<midarrow>e-\<succ>v  \<midarrow>n\<rightarrow> (x,s')" <= "G\<turnstile>s \<midarrow>In1l e\<succ>\<midarrow>n\<rightarrow> (In1 v ,x,s')"
       
    69   "G\<turnstile>s \<midarrow>e-\<succ>v  \<midarrow>n\<rightarrow>    s' " == "G\<turnstile>s \<midarrow>In1l e\<succ>\<midarrow>n\<rightarrow> (In1 v ,  s')"
       
    70   "G\<turnstile>s \<midarrow>e=\<succ>vf \<midarrow>n\<rightarrow> (x,s')" <= "G\<turnstile>s \<midarrow>In2  e\<succ>\<midarrow>n\<rightarrow> (In2 vf,x,s')"
       
    71   "G\<turnstile>s \<midarrow>e=\<succ>vf \<midarrow>n\<rightarrow>    s' " == "G\<turnstile>s \<midarrow>In2  e\<succ>\<midarrow>n\<rightarrow> (In2 vf,  s')"
       
    72   "G\<turnstile>s \<midarrow>e\<doteq>\<succ>v  \<midarrow>n\<rightarrow> (x,s')" <= "G\<turnstile>s \<midarrow>In3  e\<succ>\<midarrow>n\<rightarrow> (In3 v ,x,s')"
       
    73   "G\<turnstile>s \<midarrow>e\<doteq>\<succ>v  \<midarrow>n\<rightarrow>    s' " == "G\<turnstile>s \<midarrow>In3  e\<succ>\<midarrow>n\<rightarrow> (In3 v ,  s')"
       
    74 
       
    75 
       
    76 inductive "evaln G" intros
       
    77 
    49 
    78 --{* propagation of abrupt completion *}
    50 --{* propagation of abrupt completion *}
    79 
    51 
    80   Abrupt:   "G\<turnstile>(Some xc,s) \<midarrow>t\<succ>\<midarrow>n\<rightarrow> (arbitrary3 t,(Some xc,s))"
    52 | Abrupt:   "G\<turnstile>(Some xc,s) \<midarrow>t\<succ>\<midarrow>n\<rightarrow> (arbitrary3 t,(Some xc,s))"
    81 
    53 
    82 
    54 
    83 --{* evaluation of variables *}
    55 --{* evaluation of variables *}
    84 
    56 
    85   LVar:	"G\<turnstile>Norm s \<midarrow>LVar vn=\<succ>lvar vn s\<midarrow>n\<rightarrow> Norm s"
    57 | LVar:	"G\<turnstile>Norm s \<midarrow>LVar vn=\<succ>lvar vn s\<midarrow>n\<rightarrow> Norm s"
    86 
    58 
    87   FVar:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>Init statDeclC\<midarrow>n\<rightarrow> s1; G\<turnstile>s1 \<midarrow>e-\<succ>a\<midarrow>n\<rightarrow> s2;
    59 | FVar:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>Init statDeclC\<midarrow>n\<rightarrow> s1; G\<turnstile>s1 \<midarrow>e-\<succ>a\<midarrow>n\<rightarrow> s2;
    88 	  (v,s2') = fvar statDeclC stat fn a s2;
    60 	  (v,s2') = fvar statDeclC stat fn a s2;
    89           s3 = check_field_access G accC statDeclC fn stat a s2'\<rbrakk> \<Longrightarrow>
    61           s3 = check_field_access G accC statDeclC fn stat a s2'\<rbrakk> \<Longrightarrow>
    90 	  G\<turnstile>Norm s0 \<midarrow>{accC,statDeclC,stat}e..fn=\<succ>v\<midarrow>n\<rightarrow> s3"
    62 	  G\<turnstile>Norm s0 \<midarrow>{accC,statDeclC,stat}e..fn=\<succ>v\<midarrow>n\<rightarrow> s3"
    91 
    63 
    92   AVar:	"\<lbrakk>G\<turnstile> Norm s0 \<midarrow>e1-\<succ>a\<midarrow>n\<rightarrow> s1 ; G\<turnstile>s1 \<midarrow>e2-\<succ>i\<midarrow>n\<rightarrow> s2; 
    64 | AVar:	"\<lbrakk>G\<turnstile> Norm s0 \<midarrow>e1-\<succ>a\<midarrow>n\<rightarrow> s1 ; G\<turnstile>s1 \<midarrow>e2-\<succ>i\<midarrow>n\<rightarrow> s2; 
    93 	  (v,s2') = avar G i a s2\<rbrakk> \<Longrightarrow>
    65 	  (v,s2') = avar G i a s2\<rbrakk> \<Longrightarrow>
    94 	              G\<turnstile>Norm s0 \<midarrow>e1.[e2]=\<succ>v\<midarrow>n\<rightarrow> s2'"
    66 	              G\<turnstile>Norm s0 \<midarrow>e1.[e2]=\<succ>v\<midarrow>n\<rightarrow> s2'"
    95 
    67 
    96 
    68 
    97 
    69 
    98 
    70 
    99 --{* evaluation of expressions *}
    71 --{* evaluation of expressions *}
   100 
    72 
   101   NewC:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>Init C\<midarrow>n\<rightarrow> s1;
    73 | NewC:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>Init C\<midarrow>n\<rightarrow> s1;
   102 	  G\<turnstile>     s1 \<midarrow>halloc (CInst C)\<succ>a\<rightarrow> s2\<rbrakk> \<Longrightarrow>
    74 	  G\<turnstile>     s1 \<midarrow>halloc (CInst C)\<succ>a\<rightarrow> s2\<rbrakk> \<Longrightarrow>
   103 	                          G\<turnstile>Norm s0 \<midarrow>NewC C-\<succ>Addr a\<midarrow>n\<rightarrow> s2"
    75 	                          G\<turnstile>Norm s0 \<midarrow>NewC C-\<succ>Addr a\<midarrow>n\<rightarrow> s2"
   104 
    76 
   105   NewA:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>init_comp_ty T\<midarrow>n\<rightarrow> s1; G\<turnstile>s1 \<midarrow>e-\<succ>i'\<midarrow>n\<rightarrow> s2; 
    77 | NewA:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>init_comp_ty T\<midarrow>n\<rightarrow> s1; G\<turnstile>s1 \<midarrow>e-\<succ>i'\<midarrow>n\<rightarrow> s2; 
   106 	  G\<turnstile>abupd (check_neg i') s2 \<midarrow>halloc (Arr T (the_Intg i'))\<succ>a\<rightarrow> s3\<rbrakk> \<Longrightarrow>
    78 	  G\<turnstile>abupd (check_neg i') s2 \<midarrow>halloc (Arr T (the_Intg i'))\<succ>a\<rightarrow> s3\<rbrakk> \<Longrightarrow>
   107 	                        G\<turnstile>Norm s0 \<midarrow>New T[e]-\<succ>Addr a\<midarrow>n\<rightarrow> s3"
    79 	                        G\<turnstile>Norm s0 \<midarrow>New T[e]-\<succ>Addr a\<midarrow>n\<rightarrow> s3"
   108 
    80 
   109   Cast:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<midarrow>n\<rightarrow> s1;
    81 | Cast:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<midarrow>n\<rightarrow> s1;
   110 	  s2 = abupd (raise_if (\<not>G,snd s1\<turnstile>v fits T) ClassCast) s1\<rbrakk> \<Longrightarrow>
    82 	  s2 = abupd (raise_if (\<not>G,snd s1\<turnstile>v fits T) ClassCast) s1\<rbrakk> \<Longrightarrow>
   111 			        G\<turnstile>Norm s0 \<midarrow>Cast T e-\<succ>v\<midarrow>n\<rightarrow> s2"
    83 			        G\<turnstile>Norm s0 \<midarrow>Cast T e-\<succ>v\<midarrow>n\<rightarrow> s2"
   112 
    84 
   113   Inst:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<midarrow>n\<rightarrow> s1;
    85 | Inst:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<midarrow>n\<rightarrow> s1;
   114 	  b = (v\<noteq>Null \<and> G,store s1\<turnstile>v fits RefT T)\<rbrakk> \<Longrightarrow>
    86 	  b = (v\<noteq>Null \<and> G,store s1\<turnstile>v fits RefT T)\<rbrakk> \<Longrightarrow>
   115 			      G\<turnstile>Norm s0 \<midarrow>e InstOf T-\<succ>Bool b\<midarrow>n\<rightarrow> s1"
    87 			      G\<turnstile>Norm s0 \<midarrow>e InstOf T-\<succ>Bool b\<midarrow>n\<rightarrow> s1"
   116 
    88 
   117   Lit:			   "G\<turnstile>Norm s \<midarrow>Lit v-\<succ>v\<midarrow>n\<rightarrow> Norm s"
    89 | Lit:			   "G\<turnstile>Norm s \<midarrow>Lit v-\<succ>v\<midarrow>n\<rightarrow> Norm s"
   118 
    90 
   119   UnOp: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<midarrow>n\<rightarrow> s1\<rbrakk> 
    91 | UnOp: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<midarrow>n\<rightarrow> s1\<rbrakk> 
   120          \<Longrightarrow> G\<turnstile>Norm s0 \<midarrow>UnOp unop e-\<succ>(eval_unop unop v)\<midarrow>n\<rightarrow> s1"
    92          \<Longrightarrow> G\<turnstile>Norm s0 \<midarrow>UnOp unop e-\<succ>(eval_unop unop v)\<midarrow>n\<rightarrow> s1"
   121 
    93 
   122   BinOp: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e1-\<succ>v1\<midarrow>n\<rightarrow> s1; 
    94 | BinOp: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e1-\<succ>v1\<midarrow>n\<rightarrow> s1; 
   123            G\<turnstile>s1 \<midarrow>(if need_second_arg binop v1 then (In1l e2) else (In1r Skip))
    95            G\<turnstile>s1 \<midarrow>(if need_second_arg binop v1 then (In1l e2) else (In1r Skip))
   124             \<succ>\<midarrow>n\<rightarrow> (In1 v2,s2)\<rbrakk> 
    96             \<succ>\<midarrow>n\<rightarrow> (In1 v2,s2)\<rbrakk> 
   125          \<Longrightarrow> G\<turnstile>Norm s0 \<midarrow>BinOp binop e1 e2-\<succ>(eval_binop binop v1 v2)\<midarrow>n\<rightarrow> s2"
    97          \<Longrightarrow> G\<turnstile>Norm s0 \<midarrow>BinOp binop e1 e2-\<succ>(eval_binop binop v1 v2)\<midarrow>n\<rightarrow> s2"
   126 
    98 
   127   Super:		   "G\<turnstile>Norm s \<midarrow>Super-\<succ>val_this s\<midarrow>n\<rightarrow> Norm s"
    99 | Super:		   "G\<turnstile>Norm s \<midarrow>Super-\<succ>val_this s\<midarrow>n\<rightarrow> Norm s"
   128 
   100 
   129   Acc:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>va=\<succ>(v,f)\<midarrow>n\<rightarrow> s1\<rbrakk> \<Longrightarrow>
   101 | Acc:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>va=\<succ>(v,f)\<midarrow>n\<rightarrow> s1\<rbrakk> \<Longrightarrow>
   130 	                          G\<turnstile>Norm s0 \<midarrow>Acc va-\<succ>v\<midarrow>n\<rightarrow> s1"
   102 	                          G\<turnstile>Norm s0 \<midarrow>Acc va-\<succ>v\<midarrow>n\<rightarrow> s1"
   131 
   103 
   132   Ass:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>va=\<succ>(w,f)\<midarrow>n\<rightarrow> s1;
   104 | Ass:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>va=\<succ>(w,f)\<midarrow>n\<rightarrow> s1;
   133           G\<turnstile>     s1 \<midarrow>e-\<succ>v     \<midarrow>n\<rightarrow> s2\<rbrakk> \<Longrightarrow>
   105           G\<turnstile>     s1 \<midarrow>e-\<succ>v     \<midarrow>n\<rightarrow> s2\<rbrakk> \<Longrightarrow>
   134 				   G\<turnstile>Norm s0 \<midarrow>va:=e-\<succ>v\<midarrow>n\<rightarrow> assign f v s2"
   106 				   G\<turnstile>Norm s0 \<midarrow>va:=e-\<succ>v\<midarrow>n\<rightarrow> assign f v s2"
   135 
   107 
   136   Cond:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e0-\<succ>b\<midarrow>n\<rightarrow> s1;
   108 | Cond:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e0-\<succ>b\<midarrow>n\<rightarrow> s1;
   137           G\<turnstile>     s1 \<midarrow>(if the_Bool b then e1 else e2)-\<succ>v\<midarrow>n\<rightarrow> s2\<rbrakk> \<Longrightarrow>
   109           G\<turnstile>     s1 \<midarrow>(if the_Bool b then e1 else e2)-\<succ>v\<midarrow>n\<rightarrow> s2\<rbrakk> \<Longrightarrow>
   138 			    G\<turnstile>Norm s0 \<midarrow>e0 ? e1 : e2-\<succ>v\<midarrow>n\<rightarrow> s2"
   110 			    G\<turnstile>Norm s0 \<midarrow>e0 ? e1 : e2-\<succ>v\<midarrow>n\<rightarrow> s2"
   139 
   111 
   140   Call:	
   112 | Call:	
   141   "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>a'\<midarrow>n\<rightarrow> s1; G\<turnstile>s1 \<midarrow>args\<doteq>\<succ>vs\<midarrow>n\<rightarrow> s2;
   113   "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>a'\<midarrow>n\<rightarrow> s1; G\<turnstile>s1 \<midarrow>args\<doteq>\<succ>vs\<midarrow>n\<rightarrow> s2;
   142     D = invocation_declclass G mode (store s2) a' statT \<lparr>name=mn,parTs=pTs\<rparr>; 
   114     D = invocation_declclass G mode (store s2) a' statT \<lparr>name=mn,parTs=pTs\<rparr>; 
   143     s3=init_lvars G D \<lparr>name=mn,parTs=pTs\<rparr> mode a' vs s2;
   115     s3=init_lvars G D \<lparr>name=mn,parTs=pTs\<rparr> mode a' vs s2;
   144     s3' = check_method_access G accC statT mode \<lparr>name=mn,parTs=pTs\<rparr> a' s3;
   116     s3' = check_method_access G accC statT mode \<lparr>name=mn,parTs=pTs\<rparr> a' s3;
   145     G\<turnstile>s3'\<midarrow>Methd D \<lparr>name=mn,parTs=pTs\<rparr>-\<succ>v\<midarrow>n\<rightarrow> s4
   117     G\<turnstile>s3'\<midarrow>Methd D \<lparr>name=mn,parTs=pTs\<rparr>-\<succ>v\<midarrow>n\<rightarrow> s4
   146    \<rbrakk>
   118    \<rbrakk>
   147    \<Longrightarrow> 
   119    \<Longrightarrow> 
   148     G\<turnstile>Norm s0 \<midarrow>{accC,statT,mode}e\<cdot>mn({pTs}args)-\<succ>v\<midarrow>n\<rightarrow> (restore_lvars s2 s4)"
   120     G\<turnstile>Norm s0 \<midarrow>{accC,statT,mode}e\<cdot>mn({pTs}args)-\<succ>v\<midarrow>n\<rightarrow> (restore_lvars s2 s4)"
   149 
   121 
   150   Methd:"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>body G D sig-\<succ>v\<midarrow>n\<rightarrow> s1\<rbrakk> \<Longrightarrow>
   122 | Methd:"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>body G D sig-\<succ>v\<midarrow>n\<rightarrow> s1\<rbrakk> \<Longrightarrow>
   151 				G\<turnstile>Norm s0 \<midarrow>Methd D sig-\<succ>v\<midarrow>Suc n\<rightarrow> s1"
   123 				G\<turnstile>Norm s0 \<midarrow>Methd D sig-\<succ>v\<midarrow>Suc n\<rightarrow> s1"
   152 
   124 
   153   Body:	"\<lbrakk>G\<turnstile>Norm s0\<midarrow>Init D\<midarrow>n\<rightarrow> s1; G\<turnstile>s1 \<midarrow>c\<midarrow>n\<rightarrow> s2;
   125 | Body:	"\<lbrakk>G\<turnstile>Norm s0\<midarrow>Init D\<midarrow>n\<rightarrow> s1; G\<turnstile>s1 \<midarrow>c\<midarrow>n\<rightarrow> s2;
   154           s3 = (if (\<exists> l. abrupt s2 = Some (Jump (Break l)) \<or>  
   126           s3 = (if (\<exists> l. abrupt s2 = Some (Jump (Break l)) \<or>  
   155                          abrupt s2 = Some (Jump (Cont l)))
   127                          abrupt s2 = Some (Jump (Cont l)))
   156                   then abupd (\<lambda> x. Some (Error CrossMethodJump)) s2 
   128                   then abupd (\<lambda> x. Some (Error CrossMethodJump)) s2 
   157                   else s2)\<rbrakk>\<Longrightarrow>
   129                   else s2)\<rbrakk>\<Longrightarrow>
   158          G\<turnstile>Norm s0 \<midarrow>Body D c
   130          G\<turnstile>Norm s0 \<midarrow>Body D c
   159           -\<succ>the (locals (store s2) Result)\<midarrow>n\<rightarrow>abupd (absorb Ret) s3"
   131           -\<succ>the (locals (store s2) Result)\<midarrow>n\<rightarrow>abupd (absorb Ret) s3"
   160 
   132 
   161 --{* evaluation of expression lists *}
   133 --{* evaluation of expression lists *}
   162 
   134 
   163   Nil:
   135 | Nil:
   164 				"G\<turnstile>Norm s0 \<midarrow>[]\<doteq>\<succ>[]\<midarrow>n\<rightarrow> Norm s0"
   136 				"G\<turnstile>Norm s0 \<midarrow>[]\<doteq>\<succ>[]\<midarrow>n\<rightarrow> Norm s0"
   165 
   137 
   166   Cons:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e -\<succ> v \<midarrow>n\<rightarrow> s1;
   138 | Cons:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e -\<succ> v \<midarrow>n\<rightarrow> s1;
   167           G\<turnstile>     s1 \<midarrow>es\<doteq>\<succ>vs\<midarrow>n\<rightarrow> s2\<rbrakk> \<Longrightarrow>
   139           G\<turnstile>     s1 \<midarrow>es\<doteq>\<succ>vs\<midarrow>n\<rightarrow> s2\<rbrakk> \<Longrightarrow>
   168 			     G\<turnstile>Norm s0 \<midarrow>e#es\<doteq>\<succ>v#vs\<midarrow>n\<rightarrow> s2"
   140 			     G\<turnstile>Norm s0 \<midarrow>e#es\<doteq>\<succ>v#vs\<midarrow>n\<rightarrow> s2"
   169 
   141 
   170 
   142 
   171 --{* execution of statements *}
   143 --{* execution of statements *}
   172 
   144 
   173   Skip:	 			    "G\<turnstile>Norm s \<midarrow>Skip\<midarrow>n\<rightarrow> Norm s"
   145 | Skip:	 			    "G\<turnstile>Norm s \<midarrow>Skip\<midarrow>n\<rightarrow> Norm s"
   174 
   146 
   175   Expr:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<midarrow>n\<rightarrow> s1\<rbrakk> \<Longrightarrow>
   147 | Expr:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<midarrow>n\<rightarrow> s1\<rbrakk> \<Longrightarrow>
   176 				  G\<turnstile>Norm s0 \<midarrow>Expr e\<midarrow>n\<rightarrow> s1"
   148 				  G\<turnstile>Norm s0 \<midarrow>Expr e\<midarrow>n\<rightarrow> s1"
   177 
   149 
   178   Lab:  "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>c \<midarrow>n\<rightarrow> s1\<rbrakk> \<Longrightarrow>
   150 | Lab:  "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>c \<midarrow>n\<rightarrow> s1\<rbrakk> \<Longrightarrow>
   179                              G\<turnstile>Norm s0 \<midarrow>l\<bullet> c\<midarrow>n\<rightarrow> abupd (absorb l) s1"
   151                              G\<turnstile>Norm s0 \<midarrow>l\<bullet> c\<midarrow>n\<rightarrow> abupd (absorb l) s1"
   180 
   152 
   181   Comp:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>c1 \<midarrow>n\<rightarrow> s1;
   153 | Comp:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>c1 \<midarrow>n\<rightarrow> s1;
   182 	  G\<turnstile>     s1 \<midarrow>c2 \<midarrow>n\<rightarrow> s2\<rbrakk> \<Longrightarrow>
   154 	  G\<turnstile>     s1 \<midarrow>c2 \<midarrow>n\<rightarrow> s2\<rbrakk> \<Longrightarrow>
   183 				 G\<turnstile>Norm s0 \<midarrow>c1;; c2\<midarrow>n\<rightarrow> s2"
   155 				 G\<turnstile>Norm s0 \<midarrow>c1;; c2\<midarrow>n\<rightarrow> s2"
   184 
   156 
   185   If:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>b\<midarrow>n\<rightarrow> s1;
   157 | If:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>b\<midarrow>n\<rightarrow> s1;
   186 	  G\<turnstile>     s1\<midarrow>(if the_Bool b then c1 else c2)\<midarrow>n\<rightarrow> s2\<rbrakk> \<Longrightarrow>
   158 	  G\<turnstile>     s1\<midarrow>(if the_Bool b then c1 else c2)\<midarrow>n\<rightarrow> s2\<rbrakk> \<Longrightarrow>
   187 		       G\<turnstile>Norm s0 \<midarrow>If(e) c1 Else c2 \<midarrow>n\<rightarrow> s2"
   159 		       G\<turnstile>Norm s0 \<midarrow>If(e) c1 Else c2 \<midarrow>n\<rightarrow> s2"
   188 
   160 
   189   Loop:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>b\<midarrow>n\<rightarrow> s1;
   161 | Loop:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>b\<midarrow>n\<rightarrow> s1;
   190 	  if the_Bool b 
   162 	  if the_Bool b 
   191              then (G\<turnstile>s1 \<midarrow>c\<midarrow>n\<rightarrow> s2 \<and> 
   163              then (G\<turnstile>s1 \<midarrow>c\<midarrow>n\<rightarrow> s2 \<and> 
   192                    G\<turnstile>(abupd (absorb (Cont l)) s2) \<midarrow>l\<bullet> While(e) c\<midarrow>n\<rightarrow> s3)
   164                    G\<turnstile>(abupd (absorb (Cont l)) s2) \<midarrow>l\<bullet> While(e) c\<midarrow>n\<rightarrow> s3)
   193 	     else s3 = s1\<rbrakk> \<Longrightarrow>
   165 	     else s3 = s1\<rbrakk> \<Longrightarrow>
   194 			      G\<turnstile>Norm s0 \<midarrow>l\<bullet> While(e) c\<midarrow>n\<rightarrow> s3"
   166 			      G\<turnstile>Norm s0 \<midarrow>l\<bullet> While(e) c\<midarrow>n\<rightarrow> s3"
   195   
   167   
   196   Jmp: "G\<turnstile>Norm s \<midarrow>Jmp j\<midarrow>n\<rightarrow> (Some (Jump j), s)"
   168 | Jmp: "G\<turnstile>Norm s \<midarrow>Jmp j\<midarrow>n\<rightarrow> (Some (Jump j), s)"
   197   
   169   
   198   Throw:"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>a'\<midarrow>n\<rightarrow> s1\<rbrakk> \<Longrightarrow>
   170 | Throw:"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>a'\<midarrow>n\<rightarrow> s1\<rbrakk> \<Longrightarrow>
   199 				 G\<turnstile>Norm s0 \<midarrow>Throw e\<midarrow>n\<rightarrow> abupd (throw a') s1"
   171 				 G\<turnstile>Norm s0 \<midarrow>Throw e\<midarrow>n\<rightarrow> abupd (throw a') s1"
   200 
   172 
   201   Try:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>c1\<midarrow>n\<rightarrow> s1; G\<turnstile>s1 \<midarrow>sxalloc\<rightarrow> s2;
   173 | Try:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>c1\<midarrow>n\<rightarrow> s1; G\<turnstile>s1 \<midarrow>sxalloc\<rightarrow> s2;
   202 	  if G,s2\<turnstile>catch tn then G\<turnstile>new_xcpt_var vn s2 \<midarrow>c2\<midarrow>n\<rightarrow> s3 else s3 = s2\<rbrakk>
   174 	  if G,s2\<turnstile>catch tn then G\<turnstile>new_xcpt_var vn s2 \<midarrow>c2\<midarrow>n\<rightarrow> s3 else s3 = s2\<rbrakk>
   203           \<Longrightarrow>
   175           \<Longrightarrow>
   204 		  G\<turnstile>Norm s0 \<midarrow>Try c1 Catch(tn vn) c2\<midarrow>n\<rightarrow> s3"
   176 		  G\<turnstile>Norm s0 \<midarrow>Try c1 Catch(tn vn) c2\<midarrow>n\<rightarrow> s3"
   205 
   177 
   206   Fin:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>c1\<midarrow>n\<rightarrow> (x1,s1);
   178 | Fin:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>c1\<midarrow>n\<rightarrow> (x1,s1);
   207 	  G\<turnstile>Norm s1 \<midarrow>c2\<midarrow>n\<rightarrow> s2;
   179 	  G\<turnstile>Norm s1 \<midarrow>c2\<midarrow>n\<rightarrow> s2;
   208           s3=(if (\<exists> err. x1=Some (Error err)) 
   180           s3=(if (\<exists> err. x1=Some (Error err)) 
   209               then (x1,s1) 
   181               then (x1,s1) 
   210               else abupd (abrupt_if (x1\<noteq>None) x1) s2)\<rbrakk> \<Longrightarrow>
   182               else abupd (abrupt_if (x1\<noteq>None) x1) s2)\<rbrakk> \<Longrightarrow>
   211               G\<turnstile>Norm s0 \<midarrow>c1 Finally c2\<midarrow>n\<rightarrow> s3"
   183               G\<turnstile>Norm s0 \<midarrow>c1 Finally c2\<midarrow>n\<rightarrow> s3"
   212   
   184   
   213   Init:	"\<lbrakk>the (class G C) = c;
   185 | Init:	"\<lbrakk>the (class G C) = c;
   214 	  if inited C (globs s0) then s3 = Norm s0
   186 	  if inited C (globs s0) then s3 = Norm s0
   215 	  else (G\<turnstile>Norm (init_class_obj G C s0)
   187 	  else (G\<turnstile>Norm (init_class_obj G C s0)
   216 	          \<midarrow>(if C = Object then Skip else Init (super c))\<midarrow>n\<rightarrow> s1 \<and>
   188 	          \<midarrow>(if C = Object then Skip else Init (super c))\<midarrow>n\<rightarrow> s1 \<and>
   217 	        G\<turnstile>set_lvars empty s1 \<midarrow>init c\<midarrow>n\<rightarrow> s2 \<and> 
   189 	        G\<turnstile>set_lvars empty s1 \<midarrow>init c\<midarrow>n\<rightarrow> s2 \<and> 
   218                 s3 = restore_lvars s1 s2)\<rbrakk>
   190                 s3 = restore_lvars s1 s2)\<rbrakk>
   227         not_None_eq [simp del] 
   199         not_None_eq [simp del] 
   228         split_paired_All [simp del] split_paired_Ex [simp del]
   200         split_paired_All [simp del] split_paired_Ex [simp del]
   229 ML_setup {*
   201 ML_setup {*
   230 change_simpset (fn ss => ss delloop "split_all_tac");
   202 change_simpset (fn ss => ss delloop "split_all_tac");
   231 *}
   203 *}
   232 inductive_cases evaln_cases: "G\<turnstile>s \<midarrow>t\<succ>\<midarrow>n\<rightarrow> vs'"
   204 inductive_cases2 evaln_cases: "G\<turnstile>s \<midarrow>t\<succ>\<midarrow>n\<rightarrow> (v, s')"
   233 
   205 
   234 inductive_cases evaln_elim_cases:
   206 inductive_cases2 evaln_elim_cases:
   235 	"G\<turnstile>(Some xc, s) \<midarrow>t                        \<succ>\<midarrow>n\<rightarrow> vs'"
   207 	"G\<turnstile>(Some xc, s) \<midarrow>t                        \<succ>\<midarrow>n\<rightarrow> (v, s')"
   236 	"G\<turnstile>Norm s \<midarrow>In1r Skip                      \<succ>\<midarrow>n\<rightarrow> xs'"
   208 	"G\<turnstile>Norm s \<midarrow>In1r Skip                      \<succ>\<midarrow>n\<rightarrow> (x, s')"
   237         "G\<turnstile>Norm s \<midarrow>In1r (Jmp j)                   \<succ>\<midarrow>n\<rightarrow> xs'"
   209         "G\<turnstile>Norm s \<midarrow>In1r (Jmp j)                   \<succ>\<midarrow>n\<rightarrow> (x, s')"
   238         "G\<turnstile>Norm s \<midarrow>In1r (l\<bullet> c)                    \<succ>\<midarrow>n\<rightarrow> xs'"
   210         "G\<turnstile>Norm s \<midarrow>In1r (l\<bullet> c)                    \<succ>\<midarrow>n\<rightarrow> (x, s')"
   239 	"G\<turnstile>Norm s \<midarrow>In3  ([])                      \<succ>\<midarrow>n\<rightarrow> vs'"
   211 	"G\<turnstile>Norm s \<midarrow>In3  ([])                      \<succ>\<midarrow>n\<rightarrow> (v, s')"
   240 	"G\<turnstile>Norm s \<midarrow>In3  (e#es)                    \<succ>\<midarrow>n\<rightarrow> vs'"
   212 	"G\<turnstile>Norm s \<midarrow>In3  (e#es)                    \<succ>\<midarrow>n\<rightarrow> (v, s')"
   241 	"G\<turnstile>Norm s \<midarrow>In1l (Lit w)                   \<succ>\<midarrow>n\<rightarrow> vs'"
   213 	"G\<turnstile>Norm s \<midarrow>In1l (Lit w)                   \<succ>\<midarrow>n\<rightarrow> (v, s')"
   242         "G\<turnstile>Norm s \<midarrow>In1l (UnOp unop e)             \<succ>\<midarrow>n\<rightarrow> vs'"
   214         "G\<turnstile>Norm s \<midarrow>In1l (UnOp unop e)             \<succ>\<midarrow>n\<rightarrow> (v, s')"
   243         "G\<turnstile>Norm s \<midarrow>In1l (BinOp binop e1 e2)       \<succ>\<midarrow>n\<rightarrow> vs'"
   215         "G\<turnstile>Norm s \<midarrow>In1l (BinOp binop e1 e2)       \<succ>\<midarrow>n\<rightarrow> (v, s')"
   244 	"G\<turnstile>Norm s \<midarrow>In2  (LVar vn)                 \<succ>\<midarrow>n\<rightarrow> vs'"
   216 	"G\<turnstile>Norm s \<midarrow>In2  (LVar vn)                 \<succ>\<midarrow>n\<rightarrow> (v, s')"
   245 	"G\<turnstile>Norm s \<midarrow>In1l (Cast T e)                \<succ>\<midarrow>n\<rightarrow> vs'"
   217 	"G\<turnstile>Norm s \<midarrow>In1l (Cast T e)                \<succ>\<midarrow>n\<rightarrow> (v, s')"
   246 	"G\<turnstile>Norm s \<midarrow>In1l (e InstOf T)              \<succ>\<midarrow>n\<rightarrow> vs'"
   218 	"G\<turnstile>Norm s \<midarrow>In1l (e InstOf T)              \<succ>\<midarrow>n\<rightarrow> (v, s')"
   247 	"G\<turnstile>Norm s \<midarrow>In1l (Super)                   \<succ>\<midarrow>n\<rightarrow> vs'"
   219 	"G\<turnstile>Norm s \<midarrow>In1l (Super)                   \<succ>\<midarrow>n\<rightarrow> (v, s')"
   248 	"G\<turnstile>Norm s \<midarrow>In1l (Acc va)                  \<succ>\<midarrow>n\<rightarrow> vs'"
   220 	"G\<turnstile>Norm s \<midarrow>In1l (Acc va)                  \<succ>\<midarrow>n\<rightarrow> (v, s')"
   249 	"G\<turnstile>Norm s \<midarrow>In1r (Expr e)                  \<succ>\<midarrow>n\<rightarrow> xs'"
   221 	"G\<turnstile>Norm s \<midarrow>In1r (Expr e)                  \<succ>\<midarrow>n\<rightarrow> (x, s')"
   250 	"G\<turnstile>Norm s \<midarrow>In1r (c1;; c2)                 \<succ>\<midarrow>n\<rightarrow> xs'"
   222 	"G\<turnstile>Norm s \<midarrow>In1r (c1;; c2)                 \<succ>\<midarrow>n\<rightarrow> (x, s')"
   251 	"G\<turnstile>Norm s \<midarrow>In1l (Methd C sig)             \<succ>\<midarrow>n\<rightarrow> xs'"
   223 	"G\<turnstile>Norm s \<midarrow>In1l (Methd C sig)             \<succ>\<midarrow>n\<rightarrow> (x, s')"
   252 	"G\<turnstile>Norm s \<midarrow>In1l (Body D c)                \<succ>\<midarrow>n\<rightarrow> xs'"
   224 	"G\<turnstile>Norm s \<midarrow>In1l (Body D c)                \<succ>\<midarrow>n\<rightarrow> (x, s')"
   253 	"G\<turnstile>Norm s \<midarrow>In1l (e0 ? e1 : e2)            \<succ>\<midarrow>n\<rightarrow> vs'"
   225 	"G\<turnstile>Norm s \<midarrow>In1l (e0 ? e1 : e2)            \<succ>\<midarrow>n\<rightarrow> (v, s')"
   254 	"G\<turnstile>Norm s \<midarrow>In1r (If(e) c1 Else c2)        \<succ>\<midarrow>n\<rightarrow> xs'"
   226 	"G\<turnstile>Norm s \<midarrow>In1r (If(e) c1 Else c2)        \<succ>\<midarrow>n\<rightarrow> (x, s')"
   255 	"G\<turnstile>Norm s \<midarrow>In1r (l\<bullet> While(e) c)           \<succ>\<midarrow>n\<rightarrow> xs'"
   227 	"G\<turnstile>Norm s \<midarrow>In1r (l\<bullet> While(e) c)           \<succ>\<midarrow>n\<rightarrow> (x, s')"
   256 	"G\<turnstile>Norm s \<midarrow>In1r (c1 Finally c2)           \<succ>\<midarrow>n\<rightarrow> xs'"
   228 	"G\<turnstile>Norm s \<midarrow>In1r (c1 Finally c2)           \<succ>\<midarrow>n\<rightarrow> (x, s')"
   257 	"G\<turnstile>Norm s \<midarrow>In1r (Throw e)                 \<succ>\<midarrow>n\<rightarrow> xs'"
   229 	"G\<turnstile>Norm s \<midarrow>In1r (Throw e)                 \<succ>\<midarrow>n\<rightarrow> (x, s')"
   258 	"G\<turnstile>Norm s \<midarrow>In1l (NewC C)                  \<succ>\<midarrow>n\<rightarrow> vs'"
   230 	"G\<turnstile>Norm s \<midarrow>In1l (NewC C)                  \<succ>\<midarrow>n\<rightarrow> (v, s')"
   259 	"G\<turnstile>Norm s \<midarrow>In1l (New T[e])                \<succ>\<midarrow>n\<rightarrow> vs'"
   231 	"G\<turnstile>Norm s \<midarrow>In1l (New T[e])                \<succ>\<midarrow>n\<rightarrow> (v, s')"
   260 	"G\<turnstile>Norm s \<midarrow>In1l (Ass va e)                \<succ>\<midarrow>n\<rightarrow> vs'"
   232 	"G\<turnstile>Norm s \<midarrow>In1l (Ass va e)                \<succ>\<midarrow>n\<rightarrow> (v, s')"
   261 	"G\<turnstile>Norm s \<midarrow>In1r (Try c1 Catch(tn vn) c2)  \<succ>\<midarrow>n\<rightarrow> xs'"
   233 	"G\<turnstile>Norm s \<midarrow>In1r (Try c1 Catch(tn vn) c2)  \<succ>\<midarrow>n\<rightarrow> (x, s')"
   262 	"G\<turnstile>Norm s \<midarrow>In2  ({accC,statDeclC,stat}e..fn) \<succ>\<midarrow>n\<rightarrow> vs'"
   234 	"G\<turnstile>Norm s \<midarrow>In2  ({accC,statDeclC,stat}e..fn) \<succ>\<midarrow>n\<rightarrow> (v, s')"
   263 	"G\<turnstile>Norm s \<midarrow>In2  (e1.[e2])                 \<succ>\<midarrow>n\<rightarrow> vs'"
   235 	"G\<turnstile>Norm s \<midarrow>In2  (e1.[e2])                 \<succ>\<midarrow>n\<rightarrow> (v, s')"
   264 	"G\<turnstile>Norm s \<midarrow>In1l ({accC,statT,mode}e\<cdot>mn({pT}p)) \<succ>\<midarrow>n\<rightarrow> vs'"
   236 	"G\<turnstile>Norm s \<midarrow>In1l ({accC,statT,mode}e\<cdot>mn({pT}p)) \<succ>\<midarrow>n\<rightarrow> (v, s')"
   265 	"G\<turnstile>Norm s \<midarrow>In1r (Init C)                  \<succ>\<midarrow>n\<rightarrow> xs'"
   237 	"G\<turnstile>Norm s \<midarrow>In1r (Init C)                  \<succ>\<midarrow>n\<rightarrow> (x, s')"
   266         "G\<turnstile>Norm s \<midarrow>In1r (Init C)                  \<succ>\<midarrow>n\<rightarrow> xs'"
   238         "G\<turnstile>Norm s \<midarrow>In1r (Init C)                  \<succ>\<midarrow>n\<rightarrow> (x, s')"
   267 
   239 
   268 declare split_if     [split] split_if_asm     [split] 
   240 declare split_if     [split] split_if_asm     [split] 
   269         option.split [split] option.split_asm [split]
   241         option.split [split] option.split_asm [split]
   270         not_None_eq [simp] 
   242         not_None_eq [simp] 
   271         split_paired_All [simp] split_paired_Ex [simp]
   243         split_paired_All [simp] split_paired_Ex [simp]
   286  E.g. an expression 
   258  E.g. an expression 
   287  (injection @{term In1l} into terms) always evaluates to ordinary values 
   259  (injection @{term In1l} into terms) always evaluates to ordinary values 
   288  (injection @{term In1} into generalised values @{term vals}). 
   260  (injection @{term In1} into generalised values @{term vals}). 
   289 *}
   261 *}
   290 
   262 
       
   263 lemma evaln_expr_eq: "G\<turnstile>s \<midarrow>In1l t\<succ>\<midarrow>n\<rightarrow> (w, s') = (\<exists>v. w=In1 v \<and> G\<turnstile>s \<midarrow>t-\<succ>v \<midarrow>n\<rightarrow> s')"
       
   264   by (auto, frule evaln_Inj_elim, auto)
       
   265 
       
   266 lemma evaln_var_eq: "G\<turnstile>s \<midarrow>In2 t\<succ>\<midarrow>n\<rightarrow> (w, s') = (\<exists>vf. w=In2 vf \<and> G\<turnstile>s \<midarrow>t=\<succ>vf\<midarrow>n\<rightarrow> s')"
       
   267   by (auto, frule evaln_Inj_elim, auto)
       
   268 
       
   269 lemma evaln_exprs_eq: "G\<turnstile>s \<midarrow>In3 t\<succ>\<midarrow>n\<rightarrow> (w, s') = (\<exists>vs. w=In3 vs \<and> G\<turnstile>s \<midarrow>t\<doteq>\<succ>vs\<midarrow>n\<rightarrow> s')"
       
   270   by (auto, frule evaln_Inj_elim, auto)
       
   271 
       
   272 lemma evaln_stmt_eq: "G\<turnstile>s \<midarrow>In1r t\<succ>\<midarrow>n\<rightarrow> (w, s') = (w=\<diamondsuit> \<and> G\<turnstile>s \<midarrow>t \<midarrow>n\<rightarrow> s')"
       
   273   by (auto, frule evaln_Inj_elim, auto, frule evaln_Inj_elim, auto)
       
   274 
   291 ML_setup {*
   275 ML_setup {*
   292 fun enf nam inj rhs =
   276 fun enf name lhs =
   293 let
   277 let
   294   val name = "evaln_" ^ nam ^ "_eq"
       
   295   val lhs = "G\<turnstile>s \<midarrow>" ^ inj ^ " t\<succ>\<midarrow>n\<rightarrow> (w, s')"
       
   296   val () = qed_goal name (the_context()) (lhs ^ " = (" ^ rhs ^ ")") 
       
   297 	(K [Auto_tac, ALLGOALS (ftac (thm "evaln_Inj_elim")) THEN Auto_tac])
       
   298   fun is_Inj (Const (inj,_) $ _) = true
   278   fun is_Inj (Const (inj,_) $ _) = true
   299     | is_Inj _                   = false
   279     | is_Inj _                   = false
   300   fun pred (_ $ (Const ("Pair",_) $ _ $ (Const ("Pair", _) $ _ $ 
   280   fun pred (_ $ _ $ _ $ _ $ _ $ x $ _) = is_Inj x
   301     (Const ("Pair", _) $ _ $ (Const ("Pair", _) $ x $ _ )))) $ _ ) = is_Inj x
       
   302 in
   281 in
   303   cond_simproc name lhs pred (thm name)
   282   cond_simproc name lhs pred (thm name)
   304 end;
   283 end;
   305 
   284 
   306 val evaln_expr_proc = enf "expr" "In1l" "\<exists>v.  w=In1 v  \<and> G\<turnstile>s \<midarrow>t-\<succ>v \<midarrow>n\<rightarrow> s'";
   285 val evaln_expr_proc  = enf "evaln_expr_eq"  "G\<turnstile>s \<midarrow>In1l t\<succ>\<midarrow>n\<rightarrow> (w, s')";
   307 val evaln_var_proc  = enf "var"  "In2"  "\<exists>vf. w=In2 vf \<and> G\<turnstile>s \<midarrow>t=\<succ>vf\<midarrow>n\<rightarrow> s'";
   286 val evaln_var_proc   = enf "evaln_var_eq"   "G\<turnstile>s \<midarrow>In2 t\<succ>\<midarrow>n\<rightarrow> (w, s')";
   308 val evaln_exprs_proc= enf "exprs""In3"  "\<exists>vs. w=In3 vs \<and> G\<turnstile>s \<midarrow>t\<doteq>\<succ>vs\<midarrow>n\<rightarrow> s'";
   287 val evaln_exprs_proc = enf "evaln_exprs_eq" "G\<turnstile>s \<midarrow>In3 t\<succ>\<midarrow>n\<rightarrow> (w, s')";
   309 val evaln_stmt_proc = enf "stmt" "In1r" "     w=\<diamondsuit>      \<and> G\<turnstile>s \<midarrow>t     \<midarrow>n\<rightarrow> s'";
   288 val evaln_stmt_proc  = enf "evaln_stmt_eq"  "G\<turnstile>s \<midarrow>In1r t\<succ>\<midarrow>n\<rightarrow> (w, s')";
   310 Addsimprocs [evaln_expr_proc,evaln_var_proc,evaln_exprs_proc,evaln_stmt_proc];
   289 Addsimprocs [evaln_expr_proc,evaln_var_proc,evaln_exprs_proc,evaln_stmt_proc];
   311 
   290 
   312 bind_thms ("evaln_AbruptIs", sum3_instantiate (thm "evaln.Abrupt"))
   291 bind_thms ("evaln_AbruptIs", sum3_instantiate (thm "evaln.Abrupt"))
   313 *}
   292 *}
   314 declare evaln_AbruptIs [intro!]
   293 declare evaln_AbruptIs [intro!]
   317 proof -
   296 proof -
   318   { fix s t v s'
   297   { fix s t v s'
   319     assume eval: "G\<turnstile>s \<midarrow>t\<succ>\<midarrow>n\<rightarrow> (v,s')" and
   298     assume eval: "G\<turnstile>s \<midarrow>t\<succ>\<midarrow>n\<rightarrow> (v,s')" and
   320          normal: "normal s" and
   299          normal: "normal s" and
   321          callee: "t=In1l (Callee l e)"
   300          callee: "t=In1l (Callee l e)"
   322     then have "False"
   301     then have "False" by induct auto
   323     proof (induct)
       
   324     qed (auto)
       
   325   }
   302   }
   326   then show ?thesis
   303   then show ?thesis
   327     by (cases s') fastsimp 
   304     by (cases s') fastsimp 
   328 qed
   305 qed
   329 
   306 
   331 proof -
   308 proof -
   332   { fix s t v s'
   309   { fix s t v s'
   333     assume eval: "G\<turnstile>s \<midarrow>t\<succ>\<midarrow>n\<rightarrow> (v,s')" and
   310     assume eval: "G\<turnstile>s \<midarrow>t\<succ>\<midarrow>n\<rightarrow> (v,s')" and
   334          normal: "normal s" and
   311          normal: "normal s" and
   335          callee: "t=In1l (InsInitE c e)"
   312          callee: "t=In1l (InsInitE c e)"
   336     then have "False"
   313     then have "False" by induct auto
   337     proof (induct)
       
   338     qed (auto)
       
   339   }
   314   }
   340   then show ?thesis
   315   then show ?thesis
   341     by (cases s') fastsimp
   316     by (cases s') fastsimp
   342 qed
   317 qed
   343 
   318 
   345 proof -
   320 proof -
   346   { fix s t v s'
   321   { fix s t v s'
   347     assume eval: "G\<turnstile>s \<midarrow>t\<succ>\<midarrow>n\<rightarrow> (v,s')" and
   322     assume eval: "G\<turnstile>s \<midarrow>t\<succ>\<midarrow>n\<rightarrow> (v,s')" and
   348          normal: "normal s" and
   323          normal: "normal s" and
   349          callee: "t=In2 (InsInitV c w)"
   324          callee: "t=In2 (InsInitV c w)"
   350     then have "False"
   325     then have "False" by induct auto
   351     proof (induct)
       
   352     qed (auto)
       
   353   }  
   326   }  
   354   then show ?thesis
   327   then show ?thesis
   355     by (cases s') fastsimp
   328     by (cases s') fastsimp
   356 qed
   329 qed
   357 
   330 
   359 proof -
   332 proof -
   360   { fix s t v s'
   333   { fix s t v s'
   361     assume eval: "G\<turnstile>s \<midarrow>t\<succ>\<midarrow>n\<rightarrow> (v,s')" and
   334     assume eval: "G\<turnstile>s \<midarrow>t\<succ>\<midarrow>n\<rightarrow> (v,s')" and
   362          normal: "normal s" and
   335          normal: "normal s" and
   363          callee: "t=In1r (FinA a c)"
   336          callee: "t=In1r (FinA a c)"
   364     then have "False"
   337     then have "False" by induct auto
   365     proof (induct)
       
   366     qed (auto)
       
   367   } 
   338   } 
   368   then show ?thesis
   339   then show ?thesis
   369     by (cases s') fastsimp
   340     by (cases s') fastsimp
   370 qed
   341 qed
   371 
   342 
   383 
   354 
   384 ML {*
   355 ML {*
   385 local
   356 local
   386   fun is_Some (Const ("Pair",_) $ (Const ("Datatype.option.Some",_) $ _)$ _) =true
   357   fun is_Some (Const ("Pair",_) $ (Const ("Datatype.option.Some",_) $ _)$ _) =true
   387     | is_Some _ = false
   358     | is_Some _ = false
   388   fun pred (_ $ (Const ("Pair",_) $
   359   fun pred (_ $ _ $ _ $ _ $ _ $ _ $ x) = is_Some x
   389      _ $ (Const ("Pair", _) $ _ $ (Const ("Pair", _) $ _ $
       
   390        (Const ("Pair", _) $ _ $ x)))) $ _ ) = is_Some x
       
   391 in
   360 in
   392   val evaln_abrupt_proc = 
   361   val evaln_abrupt_proc = 
   393  cond_simproc "evaln_abrupt" "G\<turnstile>(Some xc,s) \<midarrow>e\<succ>\<midarrow>n\<rightarrow> (w,s')" pred (thm "evaln_abrupt")
   362  cond_simproc "evaln_abrupt" "G\<turnstile>(Some xc,s) \<midarrow>e\<succ>\<midarrow>n\<rightarrow> (w,s')" pred (thm "evaln_abrupt")
   394 end;
   363 end;
   395 Addsimprocs [evaln_abrupt_proc]
   364 Addsimprocs [evaln_abrupt_proc]
   438 lemma evaln_eval:  
   407 lemma evaln_eval:  
   439   assumes evaln: "G\<turnstile>s0 \<midarrow>t\<succ>\<midarrow>n\<rightarrow> (v,s1)" 
   408   assumes evaln: "G\<turnstile>s0 \<midarrow>t\<succ>\<midarrow>n\<rightarrow> (v,s1)" 
   440   shows "G\<turnstile>s0 \<midarrow>t\<succ>\<rightarrow> (v,s1)"
   409   shows "G\<turnstile>s0 \<midarrow>t\<succ>\<rightarrow> (v,s1)"
   441 using evaln 
   410 using evaln 
   442 proof (induct)
   411 proof (induct)
   443   case (Loop b c e l n s0 s1 s2 s3)
   412   case (Loop s0 e n b s1 c s2 l s3)
   444   have "G\<turnstile>Norm s0 \<midarrow>e-\<succ>b\<rightarrow> s1".
   413   have "G\<turnstile>Norm s0 \<midarrow>e-\<succ>b\<rightarrow> s1".
   445   moreover
   414   moreover
   446   have "if the_Bool b
   415   have "if the_Bool b
   447         then (G\<turnstile>s1 \<midarrow>c\<rightarrow> s2) \<and> 
   416         then (G\<turnstile>s1 \<midarrow>c\<rightarrow> s2) \<and> 
   448              G\<turnstile>abupd (absorb (Cont l)) s2 \<midarrow>l\<bullet> While(e) c\<rightarrow> s3
   417              G\<turnstile>abupd (absorb (Cont l)) s2 \<midarrow>l\<bullet> While(e) c\<rightarrow> s3
   449         else s3 = s1"
   418         else s3 = s1"
   450     using Loop.hyps by simp
   419     using Loop.hyps by simp
   451   ultimately show ?case by (rule eval.Loop)
   420   ultimately show ?case by (rule eval.Loop)
   452 next
   421 next
   453   case (Try c1 c2 n s0 s1 s2 s3 C vn)
   422   case (Try s0 c1 n s1 s2 C vn c2 s3)
   454   have "G\<turnstile>Norm s0 \<midarrow>c1\<rightarrow> s1".
   423   have "G\<turnstile>Norm s0 \<midarrow>c1\<rightarrow> s1".
   455   moreover
   424   moreover
   456   have "G\<turnstile>s1 \<midarrow>sxalloc\<rightarrow> s2".
   425   have "G\<turnstile>s1 \<midarrow>sxalloc\<rightarrow> s2".
   457   moreover
   426   moreover
   458   have "if G,s2\<turnstile>catch C then G\<turnstile>new_xcpt_var vn s2 \<midarrow>c2\<rightarrow> s3 else s3 = s2"
   427   have "if G,s2\<turnstile>catch C then G\<turnstile>new_xcpt_var vn s2 \<midarrow>c2\<rightarrow> s3 else s3 = s2"
   459     using Try.hyps by simp
   428     using Try.hyps by simp
   460   ultimately show ?case by (rule eval.Try)
   429   ultimately show ?case by (rule eval.Try)
   461 next
   430 next
   462   case (Init C c n s0 s1 s2 s3)
   431   case (Init C c s0 s3 n s1 s2)
   463   have "the (class G C) = c".
   432   have "the (class G C) = c".
   464   moreover
   433   moreover
   465   have "if inited C (globs s0) 
   434   have "if inited C (globs s0) 
   466            then s3 = Norm s0
   435            then s3 = Norm s0
   467            else G\<turnstile>Norm ((init_class_obj G C) s0) 
   436            else G\<turnstile>Norm ((init_class_obj G C) s0) 
   476 apply (frule Suc_le_D)
   445 apply (frule Suc_le_D)
   477 apply fast
   446 apply fast
   478 done
   447 done
   479 
   448 
   480 lemma evaln_nonstrict [rule_format (no_asm), elim]: 
   449 lemma evaln_nonstrict [rule_format (no_asm), elim]: 
   481   "\<And>ws. G\<turnstile>s \<midarrow>t\<succ>\<midarrow>n\<rightarrow> ws \<Longrightarrow> \<forall>m. n\<le>m \<longrightarrow> G\<turnstile>s \<midarrow>t\<succ>\<midarrow>m\<rightarrow> ws"
   450   "G\<turnstile>s \<midarrow>t\<succ>\<midarrow>n\<rightarrow> (w, s') \<Longrightarrow> \<forall>m. n\<le>m \<longrightarrow> G\<turnstile>s \<midarrow>t\<succ>\<midarrow>m\<rightarrow> (w, s')"
   482 apply (simp (no_asm_simp) only: split_tupled_all)
       
   483 apply (erule evaln.induct)
   451 apply (erule evaln.induct)
   484 apply (tactic {* ALLGOALS (EVERY'[strip_tac, TRY o etac (thm "Suc_le_D_lemma"),
   452 apply (tactic {* ALLGOALS (EVERY'[strip_tac, TRY o etac (thm "Suc_le_D_lemma"),
   485   REPEAT o smp_tac 1, 
   453   REPEAT o smp_tac 1, 
   486   resolve_tac (thms "evaln.intros") THEN_ALL_NEW TRY o atac]) *})
   454   resolve_tac (thms "evaln.intros") THEN_ALL_NEW TRY o atac]) *})
   487 (* 3 subgoals *)
   455 (* 3 subgoals *)
   488 apply (auto split del: split_if)
   456 apply (auto split del: split_if)
   489 done
   457 done
   490 
   458 
   491 lemmas evaln_nonstrict_Suc = evaln_nonstrict [OF _ le_refl [THEN le_SucI]]
   459 lemmas evaln_nonstrict_Suc = evaln_nonstrict [OF _ le_refl [THEN le_SucI]]
   492 
   460 
   493 lemma evaln_max2: "\<lbrakk>G\<turnstile>s1 \<midarrow>t1\<succ>\<midarrow>n1\<rightarrow> ws1; G\<turnstile>s2 \<midarrow>t2\<succ>\<midarrow>n2\<rightarrow> ws2\<rbrakk> \<Longrightarrow> 
   461 lemma evaln_max2: "\<lbrakk>G\<turnstile>s1 \<midarrow>t1\<succ>\<midarrow>n1\<rightarrow> (w1, s1'); G\<turnstile>s2 \<midarrow>t2\<succ>\<midarrow>n2\<rightarrow> (w2, s2')\<rbrakk> \<Longrightarrow> 
   494              G\<turnstile>s1 \<midarrow>t1\<succ>\<midarrow>max n1 n2\<rightarrow> ws1 \<and> G\<turnstile>s2 \<midarrow>t2\<succ>\<midarrow>max n1 n2\<rightarrow> ws2"
   462              G\<turnstile>s1 \<midarrow>t1\<succ>\<midarrow>max n1 n2\<rightarrow> (w1, s1') \<and> G\<turnstile>s2 \<midarrow>t2\<succ>\<midarrow>max n1 n2\<rightarrow> (w2, s2')"
   495 by (fast intro: le_maxI1 le_maxI2)
   463 by (fast intro: le_maxI1 le_maxI2)
   496 
   464 
   497 corollary evaln_max2E [consumes 2]:
   465 corollary evaln_max2E [consumes 2]:
   498   "\<lbrakk>G\<turnstile>s1 \<midarrow>t1\<succ>\<midarrow>n1\<rightarrow> ws1; G\<turnstile>s2 \<midarrow>t2\<succ>\<midarrow>n2\<rightarrow> ws2; 
   466   "\<lbrakk>G\<turnstile>s1 \<midarrow>t1\<succ>\<midarrow>n1\<rightarrow> (w1, s1'); G\<turnstile>s2 \<midarrow>t2\<succ>\<midarrow>n2\<rightarrow> (w2, s2'); 
   499     \<lbrakk>G\<turnstile>s1 \<midarrow>t1\<succ>\<midarrow>max n1 n2\<rightarrow> ws1;G\<turnstile>s2 \<midarrow>t2\<succ>\<midarrow>max n1 n2\<rightarrow> ws2 \<rbrakk> \<Longrightarrow> P \<rbrakk> \<Longrightarrow> P"
   467     \<lbrakk>G\<turnstile>s1 \<midarrow>t1\<succ>\<midarrow>max n1 n2\<rightarrow> (w1, s1');G\<turnstile>s2 \<midarrow>t2\<succ>\<midarrow>max n1 n2\<rightarrow> (w2, s2') \<rbrakk> \<Longrightarrow> P \<rbrakk> \<Longrightarrow> P"
   500 by (drule (1) evaln_max2) simp
   468 by (drule (1) evaln_max2) simp
   501 
   469 
   502 
   470 
   503 lemma evaln_max3: 
   471 lemma evaln_max3: 
   504 "\<lbrakk>G\<turnstile>s1 \<midarrow>t1\<succ>\<midarrow>n1\<rightarrow> ws1; G\<turnstile>s2 \<midarrow>t2\<succ>\<midarrow>n2\<rightarrow> ws2; G\<turnstile>s3 \<midarrow>t3\<succ>\<midarrow>n3\<rightarrow> ws3\<rbrakk> \<Longrightarrow>
   472 "\<lbrakk>G\<turnstile>s1 \<midarrow>t1\<succ>\<midarrow>n1\<rightarrow> (w1, s1'); G\<turnstile>s2 \<midarrow>t2\<succ>\<midarrow>n2\<rightarrow> (w2, s2'); G\<turnstile>s3 \<midarrow>t3\<succ>\<midarrow>n3\<rightarrow> (w3, s3')\<rbrakk> \<Longrightarrow>
   505  G\<turnstile>s1 \<midarrow>t1\<succ>\<midarrow>max (max n1 n2) n3\<rightarrow> ws1 \<and>
   473  G\<turnstile>s1 \<midarrow>t1\<succ>\<midarrow>max (max n1 n2) n3\<rightarrow> (w1, s1') \<and>
   506  G\<turnstile>s2 \<midarrow>t2\<succ>\<midarrow>max (max n1 n2) n3\<rightarrow> ws2 \<and> 
   474  G\<turnstile>s2 \<midarrow>t2\<succ>\<midarrow>max (max n1 n2) n3\<rightarrow> (w2, s2') \<and> 
   507  G\<turnstile>s3 \<midarrow>t3\<succ>\<midarrow>max (max n1 n2) n3\<rightarrow> ws3"
   475  G\<turnstile>s3 \<midarrow>t3\<succ>\<midarrow>max (max n1 n2) n3\<rightarrow> (w3, s3')"
   508 apply (drule (1) evaln_max2, erule thin_rl)
   476 apply (drule (1) evaln_max2, erule thin_rl)
   509 apply (fast intro!: le_maxI1 le_maxI2)
   477 apply (fast intro!: le_maxI1 le_maxI2)
   510 done
   478 done
   511 
   479 
   512 corollary evaln_max3E: 
   480 corollary evaln_max3E: 
   513 "\<lbrakk>G\<turnstile>s1 \<midarrow>t1\<succ>\<midarrow>n1\<rightarrow> ws1; G\<turnstile>s2 \<midarrow>t2\<succ>\<midarrow>n2\<rightarrow> ws2; G\<turnstile>s3 \<midarrow>t3\<succ>\<midarrow>n3\<rightarrow> ws3;
   481 "\<lbrakk>G\<turnstile>s1 \<midarrow>t1\<succ>\<midarrow>n1\<rightarrow> (w1, s1'); G\<turnstile>s2 \<midarrow>t2\<succ>\<midarrow>n2\<rightarrow> (w2, s2'); G\<turnstile>s3 \<midarrow>t3\<succ>\<midarrow>n3\<rightarrow> (w3, s3');
   514    \<lbrakk>G\<turnstile>s1 \<midarrow>t1\<succ>\<midarrow>max (max n1 n2) n3\<rightarrow> ws1;
   482    \<lbrakk>G\<turnstile>s1 \<midarrow>t1\<succ>\<midarrow>max (max n1 n2) n3\<rightarrow> (w1, s1');
   515     G\<turnstile>s2 \<midarrow>t2\<succ>\<midarrow>max (max n1 n2) n3\<rightarrow> ws2; 
   483     G\<turnstile>s2 \<midarrow>t2\<succ>\<midarrow>max (max n1 n2) n3\<rightarrow> (w2, s2'); 
   516     G\<turnstile>s3 \<midarrow>t3\<succ>\<midarrow>max (max n1 n2) n3\<rightarrow> ws3
   484     G\<turnstile>s3 \<midarrow>t3\<succ>\<midarrow>max (max n1 n2) n3\<rightarrow> (w3, s3')
   517    \<rbrakk> \<Longrightarrow> P
   485    \<rbrakk> \<Longrightarrow> P
   518   \<rbrakk> \<Longrightarrow> P"
   486   \<rbrakk> \<Longrightarrow> P"
   519 by (drule (2) evaln_max3) simp
   487 by (drule (2) evaln_max3) simp
   520 
   488 
   521 
   489 
   549 lemma eval_evaln: 
   517 lemma eval_evaln: 
   550   assumes eval: "G\<turnstile>s0 \<midarrow>t\<succ>\<rightarrow> (v,s1)"
   518   assumes eval: "G\<turnstile>s0 \<midarrow>t\<succ>\<rightarrow> (v,s1)"
   551   shows  "\<exists>n. G\<turnstile>s0 \<midarrow>t\<succ>\<midarrow>n\<rightarrow> (v,s1)"
   519   shows  "\<exists>n. G\<turnstile>s0 \<midarrow>t\<succ>\<midarrow>n\<rightarrow> (v,s1)"
   552 using eval 
   520 using eval 
   553 proof (induct)
   521 proof (induct)
   554   case (Abrupt s t xc)
   522   case (Abrupt xc s t)
   555   obtain n where
   523   obtain n where
   556     "G\<turnstile>(Some xc, s) \<midarrow>t\<succ>\<midarrow>n\<rightarrow> (arbitrary3 t, Some xc, s)"
   524     "G\<turnstile>(Some xc, s) \<midarrow>t\<succ>\<midarrow>n\<rightarrow> (arbitrary3 t, (Some xc, s))"
   557     by (iprover intro: evaln.Abrupt)
   525     by (iprover intro: evaln.Abrupt)
   558   then show ?case ..
   526   then show ?case ..
   559 next
   527 next
   560   case Skip
   528   case Skip
   561   show ?case by (blast intro: evaln.Skip)
   529   show ?case by (blast intro: evaln.Skip)
   562 next
   530 next
   563   case (Expr e s0 s1 v)
   531   case (Expr s0 e v s1)
   564   then obtain n where
   532   then obtain n where
   565     "G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<midarrow>n\<rightarrow> s1"
   533     "G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<midarrow>n\<rightarrow> s1"
   566     by (iprover)
   534     by (iprover)
   567   then have "G\<turnstile>Norm s0 \<midarrow>Expr e\<midarrow>n\<rightarrow> s1"
   535   then have "G\<turnstile>Norm s0 \<midarrow>Expr e\<midarrow>n\<rightarrow> s1"
   568     by (rule evaln.Expr) 
   536     by (rule evaln.Expr) 
   569   then show ?case ..
   537   then show ?case ..
   570 next
   538 next
   571   case (Lab c l s0 s1)
   539   case (Lab s0 c s1 l)
   572   then obtain n where
   540   then obtain n where
   573     "G\<turnstile>Norm s0 \<midarrow>c\<midarrow>n\<rightarrow> s1"
   541     "G\<turnstile>Norm s0 \<midarrow>c\<midarrow>n\<rightarrow> s1"
   574     by (iprover)
   542     by (iprover)
   575   then have "G\<turnstile>Norm s0 \<midarrow>l\<bullet> c\<midarrow>n\<rightarrow> abupd (absorb l) s1"
   543   then have "G\<turnstile>Norm s0 \<midarrow>l\<bullet> c\<midarrow>n\<rightarrow> abupd (absorb l) s1"
   576     by (rule evaln.Lab)
   544     by (rule evaln.Lab)
   577   then show ?case ..
   545   then show ?case ..
   578 next
   546 next
   579   case (Comp c1 c2 s0 s1 s2)
   547   case (Comp s0 c1 s1 c2 s2)
   580   then obtain n1 n2 where
   548   then obtain n1 n2 where
   581     "G\<turnstile>Norm s0 \<midarrow>c1\<midarrow>n1\<rightarrow> s1"
   549     "G\<turnstile>Norm s0 \<midarrow>c1\<midarrow>n1\<rightarrow> s1"
   582     "G\<turnstile>s1 \<midarrow>c2\<midarrow>n2\<rightarrow> s2"
   550     "G\<turnstile>s1 \<midarrow>c2\<midarrow>n2\<rightarrow> s2"
   583     by (iprover)
   551     by (iprover)
   584   then have "G\<turnstile>Norm s0 \<midarrow>c1;; c2\<midarrow>max n1 n2\<rightarrow> s2"
   552   then have "G\<turnstile>Norm s0 \<midarrow>c1;; c2\<midarrow>max n1 n2\<rightarrow> s2"
   585     by (blast intro: evaln.Comp dest: evaln_max2 )
   553     by (blast intro: evaln.Comp dest: evaln_max2 )
   586   then show ?case ..
   554   then show ?case ..
   587 next
   555 next
   588   case (If b c1 c2 e s0 s1 s2)
   556   case (If s0 e b s1 c1 c2 s2)
   589   then obtain n1 n2 where
   557   then obtain n1 n2 where
   590     "G\<turnstile>Norm s0 \<midarrow>e-\<succ>b\<midarrow>n1\<rightarrow> s1"
   558     "G\<turnstile>Norm s0 \<midarrow>e-\<succ>b\<midarrow>n1\<rightarrow> s1"
   591     "G\<turnstile>s1 \<midarrow>(if the_Bool b then c1 else c2)\<midarrow>n2\<rightarrow> s2"
   559     "G\<turnstile>s1 \<midarrow>(if the_Bool b then c1 else c2)\<midarrow>n2\<rightarrow> s2"
   592     by (iprover)
   560     by (iprover)
   593   then have "G\<turnstile>Norm s0 \<midarrow>If(e) c1 Else c2\<midarrow>max n1 n2\<rightarrow> s2"
   561   then have "G\<turnstile>Norm s0 \<midarrow>If(e) c1 Else c2\<midarrow>max n1 n2\<rightarrow> s2"
   594     by (blast intro: evaln.If dest: evaln_max2)
   562     by (blast intro: evaln.If dest: evaln_max2)
   595   then show ?case ..
   563   then show ?case ..
   596 next
   564 next
   597   case (Loop b c e l s0 s1 s2 s3)
   565   case (Loop s0 e b s1 c s2 l s3)
   598   from Loop.hyps obtain n1 where
   566   from Loop.hyps obtain n1 where
   599     "G\<turnstile>Norm s0 \<midarrow>e-\<succ>b\<midarrow>n1\<rightarrow> s1"
   567     "G\<turnstile>Norm s0 \<midarrow>e-\<succ>b\<midarrow>n1\<rightarrow> s1"
   600     by (iprover)
   568     by (iprover)
   601   moreover from Loop.hyps obtain n2 where
   569   moreover from Loop.hyps obtain n2 where
   602     "if the_Bool b 
   570     "if the_Bool b 
   612 
   580 
   613     apply   (auto intro: evaln_nonstrict intro: le_maxI2)
   581     apply   (auto intro: evaln_nonstrict intro: le_maxI2)
   614     done
   582     done
   615   then show ?case ..
   583   then show ?case ..
   616 next
   584 next
   617   case (Jmp j s)
   585   case (Jmp s j)
   618   have "G\<turnstile>Norm s \<midarrow>Jmp j\<midarrow>n\<rightarrow> (Some (Jump j), s)"
   586   have "G\<turnstile>Norm s \<midarrow>Jmp j\<midarrow>n\<rightarrow> (Some (Jump j), s)"
   619     by (rule evaln.Jmp)
   587     by (rule evaln.Jmp)
   620   then show ?case ..
   588   then show ?case ..
   621 next
   589 next
   622   case (Throw a e s0 s1)
   590   case (Throw s0 e a s1)
   623   then obtain n where
   591   then obtain n where
   624     "G\<turnstile>Norm s0 \<midarrow>e-\<succ>a\<midarrow>n\<rightarrow> s1"
   592     "G\<turnstile>Norm s0 \<midarrow>e-\<succ>a\<midarrow>n\<rightarrow> s1"
   625     by (iprover)
   593     by (iprover)
   626   then have "G\<turnstile>Norm s0 \<midarrow>Throw e\<midarrow>n\<rightarrow> abupd (throw a) s1"
   594   then have "G\<turnstile>Norm s0 \<midarrow>Throw e\<midarrow>n\<rightarrow> abupd (throw a) s1"
   627     by (rule evaln.Throw)
   595     by (rule evaln.Throw)
   628   then show ?case ..
   596   then show ?case ..
   629 next 
   597 next 
   630   case (Try catchC c1 c2 s0 s1 s2 s3 vn)
   598   case (Try s0 c1 s1 s2 catchC vn c2 s3)
   631   from Try.hyps obtain n1 where
   599   from Try.hyps obtain n1 where
   632     "G\<turnstile>Norm s0 \<midarrow>c1\<midarrow>n1\<rightarrow> s1"
   600     "G\<turnstile>Norm s0 \<midarrow>c1\<midarrow>n1\<rightarrow> s1"
   633     by (iprover)
   601     by (iprover)
   634   moreover 
   602   moreover 
   635   have sxalloc: "G\<turnstile>s1 \<midarrow>sxalloc\<rightarrow> s2" .
   603   have sxalloc: "G\<turnstile>s1 \<midarrow>sxalloc\<rightarrow> s2" .
   640   ultimately
   608   ultimately
   641   have "G\<turnstile>Norm s0 \<midarrow>Try c1 Catch(catchC vn) c2\<midarrow>max n1 n2\<rightarrow> s3"
   609   have "G\<turnstile>Norm s0 \<midarrow>Try c1 Catch(catchC vn) c2\<midarrow>max n1 n2\<rightarrow> s3"
   642     by (auto intro!: evaln.Try le_maxI1 le_maxI2)
   610     by (auto intro!: evaln.Try le_maxI1 le_maxI2)
   643   then show ?case ..
   611   then show ?case ..
   644 next
   612 next
   645   case (Fin c1 c2 s0 s1 s2 s3 x1)
   613   case (Fin s0 c1 x1 s1 c2 s2 s3)
   646   from Fin obtain n1 n2 where 
   614   from Fin obtain n1 n2 where 
   647     "G\<turnstile>Norm s0 \<midarrow>c1\<midarrow>n1\<rightarrow> (x1, s1)"
   615     "G\<turnstile>Norm s0 \<midarrow>c1\<midarrow>n1\<rightarrow> (x1, s1)"
   648     "G\<turnstile>Norm s1 \<midarrow>c2\<midarrow>n2\<rightarrow> s2"
   616     "G\<turnstile>Norm s1 \<midarrow>c2\<midarrow>n2\<rightarrow> s2"
   649     by iprover
   617     by iprover
   650   moreover
   618   moreover
   655   have 
   623   have 
   656     "G\<turnstile>Norm s0 \<midarrow>c1 Finally c2\<midarrow>max n1 n2\<rightarrow> s3"
   624     "G\<turnstile>Norm s0 \<midarrow>c1 Finally c2\<midarrow>max n1 n2\<rightarrow> s3"
   657     by (blast intro: evaln.Fin dest: evaln_max2)
   625     by (blast intro: evaln.Fin dest: evaln_max2)
   658   then show ?case ..
   626   then show ?case ..
   659 next
   627 next
   660   case (Init C c s0 s1 s2 s3)
   628   case (Init C c s0 s3 s1 s2)
   661   have     cls: "the (class G C) = c" .
   629   have     cls: "the (class G C) = c" .
   662   moreover from Init.hyps obtain n where
   630   moreover from Init.hyps obtain n where
   663       "if inited C (globs s0) then s3 = Norm s0
   631       "if inited C (globs s0) then s3 = Norm s0
   664        else (G\<turnstile>Norm (init_class_obj G C s0)
   632        else (G\<turnstile>Norm (init_class_obj G C s0)
   665 	      \<midarrow>(if C = Object then Skip else Init (super c))\<midarrow>n\<rightarrow> s1 \<and>
   633 	      \<midarrow>(if C = Object then Skip else Init (super c))\<midarrow>n\<rightarrow> s1 \<and>
   668     by (auto intro: evaln_nonstrict le_maxI1 le_maxI2)
   636     by (auto intro: evaln_nonstrict le_maxI1 le_maxI2)
   669   ultimately have "G\<turnstile>Norm s0 \<midarrow>Init C\<midarrow>n\<rightarrow> s3"
   637   ultimately have "G\<turnstile>Norm s0 \<midarrow>Init C\<midarrow>n\<rightarrow> s3"
   670     by (rule evaln.Init)
   638     by (rule evaln.Init)
   671   then show ?case ..
   639   then show ?case ..
   672 next
   640 next
   673   case (NewC C a s0 s1 s2)
   641   case (NewC s0 C s1 a s2)
   674   then obtain n where 
   642   then obtain n where 
   675     "G\<turnstile>Norm s0 \<midarrow>Init C\<midarrow>n\<rightarrow> s1"
   643     "G\<turnstile>Norm s0 \<midarrow>Init C\<midarrow>n\<rightarrow> s1"
   676     by (iprover)
   644     by (iprover)
   677   with NewC 
   645   with NewC 
   678   have "G\<turnstile>Norm s0 \<midarrow>NewC C-\<succ>Addr a\<midarrow>n\<rightarrow> s2"
   646   have "G\<turnstile>Norm s0 \<midarrow>NewC C-\<succ>Addr a\<midarrow>n\<rightarrow> s2"
   679     by (iprover intro: evaln.NewC)
   647     by (iprover intro: evaln.NewC)
   680   then show ?case ..
   648   then show ?case ..
   681 next
   649 next
   682   case (NewA T a e i s0 s1 s2 s3)
   650   case (NewA s0 T s1 e i s2 a s3)
   683   then obtain n1 n2 where 
   651   then obtain n1 n2 where 
   684     "G\<turnstile>Norm s0 \<midarrow>init_comp_ty T\<midarrow>n1\<rightarrow> s1"
   652     "G\<turnstile>Norm s0 \<midarrow>init_comp_ty T\<midarrow>n1\<rightarrow> s1"
   685     "G\<turnstile>s1 \<midarrow>e-\<succ>i\<midarrow>n2\<rightarrow> s2"      
   653     "G\<turnstile>s1 \<midarrow>e-\<succ>i\<midarrow>n2\<rightarrow> s2"      
   686     by (iprover)
   654     by (iprover)
   687   moreover
   655   moreover
   689   ultimately
   657   ultimately
   690   have "G\<turnstile>Norm s0 \<midarrow>New T[e]-\<succ>Addr a\<midarrow>max n1 n2\<rightarrow> s3"
   658   have "G\<turnstile>Norm s0 \<midarrow>New T[e]-\<succ>Addr a\<midarrow>max n1 n2\<rightarrow> s3"
   691     by (blast intro: evaln.NewA dest: evaln_max2)
   659     by (blast intro: evaln.NewA dest: evaln_max2)
   692   then show ?case ..
   660   then show ?case ..
   693 next
   661 next
   694   case (Cast castT e s0 s1 s2 v)
   662   case (Cast s0 e v s1 s2 castT)
   695   then obtain n where
   663   then obtain n where
   696     "G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<midarrow>n\<rightarrow> s1"
   664     "G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<midarrow>n\<rightarrow> s1"
   697     by (iprover)
   665     by (iprover)
   698   moreover 
   666   moreover 
   699   have "s2 = abupd (raise_if (\<not> G,snd s1\<turnstile>v fits castT) ClassCast) s1" .
   667   have "s2 = abupd (raise_if (\<not> G,snd s1\<turnstile>v fits castT) ClassCast) s1" .
   700   ultimately
   668   ultimately
   701   have "G\<turnstile>Norm s0 \<midarrow>Cast castT e-\<succ>v\<midarrow>n\<rightarrow> s2"
   669   have "G\<turnstile>Norm s0 \<midarrow>Cast castT e-\<succ>v\<midarrow>n\<rightarrow> s2"
   702     by (rule evaln.Cast)
   670     by (rule evaln.Cast)
   703   then show ?case ..
   671   then show ?case ..
   704 next
   672 next
   705   case (Inst T b e s0 s1 v)
   673   case (Inst s0 e v s1 b T)
   706   then obtain n where
   674   then obtain n where
   707     "G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<midarrow>n\<rightarrow> s1"
   675     "G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<midarrow>n\<rightarrow> s1"
   708     by (iprover)
   676     by (iprover)
   709   moreover 
   677   moreover 
   710   have "b = (v \<noteq> Null \<and> G,snd s1\<turnstile>v fits RefT T)" .
   678   have "b = (v \<noteq> Null \<and> G,snd s1\<turnstile>v fits RefT T)" .
   716   case (Lit s v)
   684   case (Lit s v)
   717   have "G\<turnstile>Norm s \<midarrow>Lit v-\<succ>v\<midarrow>n\<rightarrow> Norm s"
   685   have "G\<turnstile>Norm s \<midarrow>Lit v-\<succ>v\<midarrow>n\<rightarrow> Norm s"
   718     by (rule evaln.Lit)
   686     by (rule evaln.Lit)
   719   then show ?case ..
   687   then show ?case ..
   720 next
   688 next
   721   case (UnOp e s0 s1 unop v )
   689   case (UnOp s0 e v s1 unop)
   722   then obtain n where
   690   then obtain n where
   723     "G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<midarrow>n\<rightarrow> s1"
   691     "G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<midarrow>n\<rightarrow> s1"
   724     by (iprover)
   692     by (iprover)
   725   hence "G\<turnstile>Norm s0 \<midarrow>UnOp unop e-\<succ>eval_unop unop v\<midarrow>n\<rightarrow> s1"
   693   hence "G\<turnstile>Norm s0 \<midarrow>UnOp unop e-\<succ>eval_unop unop v\<midarrow>n\<rightarrow> s1"
   726     by (rule evaln.UnOp)
   694     by (rule evaln.UnOp)
   727   then show ?case ..
   695   then show ?case ..
   728 next
   696 next
   729   case (BinOp binop e1 e2 s0 s1 s2 v1 v2)
   697   case (BinOp s0 e1 v1 s1 binop e2 v2 s2)
   730   then obtain n1 n2 where 
   698   then obtain n1 n2 where 
   731     "G\<turnstile>Norm s0 \<midarrow>e1-\<succ>v1\<midarrow>n1\<rightarrow> s1"
   699     "G\<turnstile>Norm s0 \<midarrow>e1-\<succ>v1\<midarrow>n1\<rightarrow> s1"
   732     "G\<turnstile>s1 \<midarrow>(if need_second_arg binop v1 then In1l e2
   700     "G\<turnstile>s1 \<midarrow>(if need_second_arg binop v1 then In1l e2
   733                else In1r Skip)\<succ>\<midarrow>n2\<rightarrow> (In1 v2, s2)"    
   701                else In1r Skip)\<succ>\<midarrow>n2\<rightarrow> (In1 v2, s2)"    
   734     by (iprover)
   702     by (iprover)
   740   case (Super s )
   708   case (Super s )
   741   have "G\<turnstile>Norm s \<midarrow>Super-\<succ>val_this s\<midarrow>n\<rightarrow> Norm s"
   709   have "G\<turnstile>Norm s \<midarrow>Super-\<succ>val_this s\<midarrow>n\<rightarrow> Norm s"
   742     by (rule evaln.Super)
   710     by (rule evaln.Super)
   743   then show ?case ..
   711   then show ?case ..
   744 next
   712 next
   745   case (Acc f s0 s1 v va)
   713   case (Acc s0 va v f s1)
   746   then obtain n where
   714   then obtain n where
   747     "G\<turnstile>Norm s0 \<midarrow>va=\<succ>(v, f)\<midarrow>n\<rightarrow> s1"
   715     "G\<turnstile>Norm s0 \<midarrow>va=\<succ>(v, f)\<midarrow>n\<rightarrow> s1"
   748     by (iprover)
   716     by (iprover)
   749   then
   717   then
   750   have "G\<turnstile>Norm s0 \<midarrow>Acc va-\<succ>v\<midarrow>n\<rightarrow> s1"
   718   have "G\<turnstile>Norm s0 \<midarrow>Acc va-\<succ>v\<midarrow>n\<rightarrow> s1"
   751     by (rule evaln.Acc)
   719     by (rule evaln.Acc)
   752   then show ?case ..
   720   then show ?case ..
   753 next
   721 next
   754   case (Ass e f s0 s1 s2 v var w)
   722   case (Ass s0 var w f s1 e v s2)
   755   then obtain n1 n2 where 
   723   then obtain n1 n2 where 
   756     "G\<turnstile>Norm s0 \<midarrow>var=\<succ>(w, f)\<midarrow>n1\<rightarrow> s1"
   724     "G\<turnstile>Norm s0 \<midarrow>var=\<succ>(w, f)\<midarrow>n1\<rightarrow> s1"
   757     "G\<turnstile>s1 \<midarrow>e-\<succ>v\<midarrow>n2\<rightarrow> s2"      
   725     "G\<turnstile>s1 \<midarrow>e-\<succ>v\<midarrow>n2\<rightarrow> s2"      
   758     by (iprover)
   726     by (iprover)
   759   then
   727   then
   760   have "G\<turnstile>Norm s0 \<midarrow>var:=e-\<succ>v\<midarrow>max n1 n2\<rightarrow> assign f v s2"
   728   have "G\<turnstile>Norm s0 \<midarrow>var:=e-\<succ>v\<midarrow>max n1 n2\<rightarrow> assign f v s2"
   761     by (blast intro: evaln.Ass dest: evaln_max2)
   729     by (blast intro: evaln.Ass dest: evaln_max2)
   762   then show ?case ..
   730   then show ?case ..
   763 next
   731 next
   764   case (Cond b e0 e1 e2 s0 s1 s2 v)
   732   case (Cond s0 e0 b s1 e1 e2 v s2)
   765   then obtain n1 n2 where 
   733   then obtain n1 n2 where 
   766     "G\<turnstile>Norm s0 \<midarrow>e0-\<succ>b\<midarrow>n1\<rightarrow> s1"
   734     "G\<turnstile>Norm s0 \<midarrow>e0-\<succ>b\<midarrow>n1\<rightarrow> s1"
   767     "G\<turnstile>s1 \<midarrow>(if the_Bool b then e1 else e2)-\<succ>v\<midarrow>n2\<rightarrow> s2"
   735     "G\<turnstile>s1 \<midarrow>(if the_Bool b then e1 else e2)-\<succ>v\<midarrow>n2\<rightarrow> s2"
   768     by (iprover)
   736     by (iprover)
   769   then
   737   then
   770   have "G\<turnstile>Norm s0 \<midarrow>e0 ? e1 : e2-\<succ>v\<midarrow>max n1 n2\<rightarrow> s2"
   738   have "G\<turnstile>Norm s0 \<midarrow>e0 ? e1 : e2-\<succ>v\<midarrow>max n1 n2\<rightarrow> s2"
   771     by (blast intro: evaln.Cond dest: evaln_max2)
   739     by (blast intro: evaln.Cond dest: evaln_max2)
   772   then show ?case ..
   740   then show ?case ..
   773 next
   741 next
   774   case (Call invDeclC a' accC' args e mn mode pTs' s0 s1 s2 s3 s3' s4 statT 
   742   case (Call s0 e a' s1 args vs s2 invDeclC mode statT mn pTs' s3 s3' accC' v s4)
   775         v vs)
       
   776   then obtain n1 n2 where
   743   then obtain n1 n2 where
   777     "G\<turnstile>Norm s0 \<midarrow>e-\<succ>a'\<midarrow>n1\<rightarrow> s1"
   744     "G\<turnstile>Norm s0 \<midarrow>e-\<succ>a'\<midarrow>n1\<rightarrow> s1"
   778     "G\<turnstile>s1 \<midarrow>args\<doteq>\<succ>vs\<midarrow>n2\<rightarrow> s2"
   745     "G\<turnstile>s1 \<midarrow>args\<doteq>\<succ>vs\<midarrow>n2\<rightarrow> s2"
   779     by iprover
   746     by iprover
   780   moreover
   747   moreover
   793   have "G\<turnstile>Norm s0 \<midarrow>{accC',statT,mode}e\<cdot>mn( {pTs'}args)-\<succ>v\<midarrow>max n1 (max n2 m)\<rightarrow> 
   760   have "G\<turnstile>Norm s0 \<midarrow>{accC',statT,mode}e\<cdot>mn( {pTs'}args)-\<succ>v\<midarrow>max n1 (max n2 m)\<rightarrow> 
   794             (set_lvars (locals (store s2))) s4"
   761             (set_lvars (locals (store s2))) s4"
   795     by (auto intro!: evaln.Call le_maxI1 le_max3I1 le_max3I2)
   762     by (auto intro!: evaln.Call le_maxI1 le_max3I1 le_max3I2)
   796   thus ?case ..
   763   thus ?case ..
   797 next
   764 next
   798   case (Methd D s0 s1 sig v )
   765   case (Methd s0 D sig v s1)
   799   then obtain n where
   766   then obtain n where
   800     "G\<turnstile>Norm s0 \<midarrow>body G D sig-\<succ>v\<midarrow>n\<rightarrow> s1"
   767     "G\<turnstile>Norm s0 \<midarrow>body G D sig-\<succ>v\<midarrow>n\<rightarrow> s1"
   801     by iprover
   768     by iprover
   802   then have "G\<turnstile>Norm s0 \<midarrow>Methd D sig-\<succ>v\<midarrow>Suc n\<rightarrow> s1"
   769   then have "G\<turnstile>Norm s0 \<midarrow>Methd D sig-\<succ>v\<midarrow>Suc n\<rightarrow> s1"
   803     by (rule evaln.Methd)
   770     by (rule evaln.Methd)
   804   then show ?case ..
   771   then show ?case ..
   805 next
   772 next
   806   case (Body D c s0 s1 s2 s3 )
   773   case (Body s0 D s1 c s2 s3)
   807   from Body.hyps obtain n1 n2 where 
   774   from Body.hyps obtain n1 n2 where 
   808     evaln_init: "G\<turnstile>Norm s0 \<midarrow>Init D\<midarrow>n1\<rightarrow> s1" and
   775     evaln_init: "G\<turnstile>Norm s0 \<midarrow>Init D\<midarrow>n1\<rightarrow> s1" and
   809     evaln_c: "G\<turnstile>s1 \<midarrow>c\<midarrow>n2\<rightarrow> s2"
   776     evaln_c: "G\<turnstile>s1 \<midarrow>c\<midarrow>n2\<rightarrow> s2"
   810     by (iprover)
   777     by (iprover)
   811   moreover
   778   moreover
   824   obtain n where
   791   obtain n where
   825     "G\<turnstile>Norm s \<midarrow>LVar vn=\<succ>lvar vn s\<midarrow>n\<rightarrow> Norm s"
   792     "G\<turnstile>Norm s \<midarrow>LVar vn=\<succ>lvar vn s\<midarrow>n\<rightarrow> Norm s"
   826     by (iprover intro: evaln.LVar)
   793     by (iprover intro: evaln.LVar)
   827   then show ?case ..
   794   then show ?case ..
   828 next
   795 next
   829   case (FVar a accC e fn s0 s1 s2 s2' s3 stat statDeclC v)
   796   case (FVar s0 statDeclC s1 e a s2 v s2' stat fn s3 accC)
   830   then obtain n1 n2 where
   797   then obtain n1 n2 where
   831     "G\<turnstile>Norm s0 \<midarrow>Init statDeclC\<midarrow>n1\<rightarrow> s1"
   798     "G\<turnstile>Norm s0 \<midarrow>Init statDeclC\<midarrow>n1\<rightarrow> s1"
   832     "G\<turnstile>s1 \<midarrow>e-\<succ>a\<midarrow>n2\<rightarrow> s2"
   799     "G\<turnstile>s1 \<midarrow>e-\<succ>a\<midarrow>n2\<rightarrow> s2"
   833     by iprover
   800     by iprover
   834   moreover
   801   moreover
   837   ultimately
   804   ultimately
   838   have "G\<turnstile>Norm s0 \<midarrow>{accC,statDeclC,stat}e..fn=\<succ>v\<midarrow>max n1 n2\<rightarrow> s3"
   805   have "G\<turnstile>Norm s0 \<midarrow>{accC,statDeclC,stat}e..fn=\<succ>v\<midarrow>max n1 n2\<rightarrow> s3"
   839     by (iprover intro: evaln.FVar dest: evaln_max2)
   806     by (iprover intro: evaln.FVar dest: evaln_max2)
   840   then show ?case ..
   807   then show ?case ..
   841 next
   808 next
   842   case (AVar a e1 e2 i s0 s1 s2 s2' v )
   809   case (AVar s0 e1 a s1 e2 i s2 v s2')
   843   then obtain n1 n2 where 
   810   then obtain n1 n2 where 
   844     "G\<turnstile>Norm s0 \<midarrow>e1-\<succ>a\<midarrow>n1\<rightarrow> s1"
   811     "G\<turnstile>Norm s0 \<midarrow>e1-\<succ>a\<midarrow>n1\<rightarrow> s1"
   845     "G\<turnstile>s1 \<midarrow>e2-\<succ>i\<midarrow>n2\<rightarrow> s2"      
   812     "G\<turnstile>s1 \<midarrow>e2-\<succ>i\<midarrow>n2\<rightarrow> s2"      
   846     by iprover
   813     by iprover
   847   moreover 
   814   moreover 
   852   then show ?case ..
   819   then show ?case ..
   853 next
   820 next
   854   case (Nil s0)
   821   case (Nil s0)
   855   show ?case by (iprover intro: evaln.Nil)
   822   show ?case by (iprover intro: evaln.Nil)
   856 next
   823 next
   857   case (Cons e es s0 s1 s2 v vs)
   824   case (Cons s0 e v s1 es vs s2)
   858   then obtain n1 n2 where 
   825   then obtain n1 n2 where 
   859     "G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<midarrow>n1\<rightarrow> s1"
   826     "G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<midarrow>n1\<rightarrow> s1"
   860     "G\<turnstile>s1 \<midarrow>es\<doteq>\<succ>vs\<midarrow>n2\<rightarrow> s2"      
   827     "G\<turnstile>s1 \<midarrow>es\<doteq>\<succ>vs\<midarrow>n2\<rightarrow> s2"      
   861     by iprover
   828     by iprover
   862   then
   829   then