Adapted to new inductive definition package.
authorberghofe
Mon Dec 11 16:06:14 2006 +0100 (2006-12-11)
changeset 2176589275a3ed7be
parent 21764 720b0add5206
child 21766 3eb48154388e
Adapted to new inductive definition package.
src/HOL/Bali/AxSem.thy
src/HOL/Bali/AxSound.thy
src/HOL/Bali/DeclConcepts.thy
src/HOL/Bali/DefiniteAssignment.thy
src/HOL/Bali/DefiniteAssignmentCorrect.thy
src/HOL/Bali/Eval.thy
src/HOL/Bali/Evaln.thy
src/HOL/Bali/Trans.thy
src/HOL/Bali/TypeRel.thy
src/HOL/Bali/TypeSafe.thy
src/HOL/Bali/WellForm.thy
src/HOL/Bali/WellType.thy
     1.1 --- a/src/HOL/Bali/AxSem.thy	Mon Dec 11 12:28:16 2006 +0100
     1.2 +++ b/src/HOL/Bali/AxSem.thy	Mon Dec 11 16:06:14 2006 +0100
     1.3 @@ -435,7 +435,6 @@
     1.4                                                  (   "_\<Turnstile>_:_" [61,0, 58] 57)
     1.5      ax_valids :: "prog \<Rightarrow> 'b triples \<Rightarrow> 'a triples \<Rightarrow> bool"
     1.6                                                  ("_,_|\<Turnstile>_"   [61,58,58] 57)
     1.7 -    ax_derivs :: "prog \<Rightarrow> ('a triples \<times> 'a triples) set"
     1.8  
     1.9  syntax
    1.10  
    1.11 @@ -443,10 +442,6 @@
    1.12                                                  (  "_||=_:_" [61,0, 58] 57)
    1.13       ax_valid :: "prog \<Rightarrow>  'b triples \<Rightarrow> 'a triple  \<Rightarrow> bool"
    1.14                                                  ( "_,_|=_"   [61,58,58] 57)
    1.15 -     ax_Derivs:: "prog \<Rightarrow>  'b triples \<Rightarrow> 'a triples \<Rightarrow> bool"
    1.16 -                                                ("_,_||-_"   [61,58,58] 57)
    1.17 -     ax_Deriv :: "prog \<Rightarrow>  'b triples \<Rightarrow> 'a triple  \<Rightarrow> bool"
    1.18 -                                                ( "_,_|-_"   [61,58,58] 57)
    1.19  
    1.20  syntax (xsymbols)
    1.21  
    1.22 @@ -454,10 +449,6 @@
    1.23                                                  (  "_|\<Turnstile>_:_" [61,0, 58] 57)
    1.24       ax_valid :: "prog \<Rightarrow>  'b triples \<Rightarrow> 'a triple  \<Rightarrow> bool"
    1.25                                                  ( "_,_\<Turnstile>_"   [61,58,58] 57)
    1.26 -     ax_Derivs:: "prog \<Rightarrow>  'b triples \<Rightarrow> 'a triples \<Rightarrow> bool"
    1.27 -                                                ("_,_|\<turnstile>_"   [61,58,58] 57)
    1.28 -     ax_Deriv :: "prog \<Rightarrow>  'b triples \<Rightarrow> 'a triple  \<Rightarrow> bool"
    1.29 -                                                ( "_,_\<turnstile>_"   [61,58,58] 57)
    1.30  
    1.31  defs  triple_valid_def:  "G\<Turnstile>n:t  \<equiv> case t of {P} t\<succ> {Q} \<Rightarrow>
    1.32                            \<forall>Y s Z. P Y s Z \<longrightarrow> type_ok G t s \<longrightarrow>
    1.33 @@ -465,8 +456,6 @@
    1.34  translations         "G|\<Turnstile>n:ts" == "Ball ts (triple_valid G n)"
    1.35  defs   ax_valids_def:"G,A|\<Turnstile>ts  \<equiv>  \<forall>n. G|\<Turnstile>n:A \<longrightarrow> G|\<Turnstile>n:ts"
    1.36  translations         "G,A \<Turnstile>t"  == "G,A|\<Turnstile>{t}"
    1.37 -                     "G,A|\<turnstile>ts" == "(A,ts) \<in> ax_derivs G"
    1.38 -                     "G,A \<turnstile>t"  == "G,A|\<turnstile>{t}"
    1.39  
    1.40  lemma triple_valid_def2: "G\<Turnstile>n:{P} t\<succ> {Q} =  
    1.41   (\<forall>Y s Z. P Y s Z 
    1.42 @@ -487,63 +476,69 @@
    1.43  change_claset (fn cs => cs delSWrapper "split_all_tac");
    1.44  *}
    1.45  
    1.46 -inductive "ax_derivs G" intros
    1.47 +inductive2
    1.48 +  ax_derivs :: "prog \<Rightarrow> 'a triples \<Rightarrow> 'a triples \<Rightarrow> bool" ("_,_|\<turnstile>_" [61,58,58] 57)
    1.49 +  and ax_deriv :: "prog \<Rightarrow> 'a triples \<Rightarrow> 'a triple  \<Rightarrow> bool" ("_,_\<turnstile>_" [61,58,58] 57)
    1.50 +  for G :: prog
    1.51 +where
    1.52  
    1.53 -  empty: " G,A|\<turnstile>{}"
    1.54 -  insert:"\<lbrakk>G,A\<turnstile>t; G,A|\<turnstile>ts\<rbrakk> \<Longrightarrow>
    1.55 +  "G,A \<turnstile>t \<equiv> G,A|\<turnstile>{t}"
    1.56 +
    1.57 +| empty: " G,A|\<turnstile>{}"
    1.58 +| insert:"\<lbrakk>G,A\<turnstile>t; G,A|\<turnstile>ts\<rbrakk> \<Longrightarrow>
    1.59            G,A|\<turnstile>insert t ts"
    1.60  
    1.61 -  asm:   "ts\<subseteq>A \<Longrightarrow> G,A|\<turnstile>ts"
    1.62 +| asm:   "ts\<subseteq>A \<Longrightarrow> G,A|\<turnstile>ts"
    1.63  
    1.64  (* could be added for convenience and efficiency, but is not necessary
    1.65    cut:   "\<lbrakk>G,A'|\<turnstile>ts; G,A|\<turnstile>A'\<rbrakk> \<Longrightarrow>
    1.66             G,A |\<turnstile>ts"
    1.67  *)
    1.68 -  weaken:"\<lbrakk>G,A|\<turnstile>ts'; ts \<subseteq> ts'\<rbrakk> \<Longrightarrow> G,A|\<turnstile>ts"
    1.69 +| weaken:"\<lbrakk>G,A|\<turnstile>ts'; ts \<subseteq> ts'\<rbrakk> \<Longrightarrow> G,A|\<turnstile>ts"
    1.70  
    1.71 -  conseq:"\<forall>Y s Z . P  Y s Z  \<longrightarrow> (\<exists>P' Q'. G,A\<turnstile>{P'} t\<succ> {Q'} \<and> (\<forall>Y' s'. 
    1.72 +| conseq:"\<forall>Y s Z . P  Y s Z  \<longrightarrow> (\<exists>P' Q'. G,A\<turnstile>{P'} t\<succ> {Q'} \<and> (\<forall>Y' s'. 
    1.73           (\<forall>Y   Z'. P' Y s Z' \<longrightarrow> Q' Y' s' Z') \<longrightarrow>
    1.74                                   Q  Y' s' Z ))
    1.75                                           \<Longrightarrow> G,A\<turnstile>{P } t\<succ> {Q }"
    1.76  
    1.77 -  hazard:"G,A\<turnstile>{P \<and>. Not \<circ> type_ok G t} t\<succ> {Q}"
    1.78 +| hazard:"G,A\<turnstile>{P \<and>. Not \<circ> type_ok G t} t\<succ> {Q}"
    1.79  
    1.80 -  Abrupt:  "G,A\<turnstile>{P\<leftarrow>(arbitrary3 t) \<and>. Not \<circ> normal} t\<succ> {P}"
    1.81 +| Abrupt:  "G,A\<turnstile>{P\<leftarrow>(arbitrary3 t) \<and>. Not \<circ> normal} t\<succ> {P}"
    1.82  
    1.83    --{* variables *}
    1.84 -  LVar:  " G,A\<turnstile>{Normal (\<lambda>s.. P\<leftarrow>Var (lvar vn s))} LVar vn=\<succ> {P}"
    1.85 +| LVar:  " G,A\<turnstile>{Normal (\<lambda>s.. P\<leftarrow>Var (lvar vn s))} LVar vn=\<succ> {P}"
    1.86  
    1.87 -  FVar: "\<lbrakk>G,A\<turnstile>{Normal P} .Init C. {Q};
    1.88 +| FVar: "\<lbrakk>G,A\<turnstile>{Normal P} .Init C. {Q};
    1.89            G,A\<turnstile>{Q} e-\<succ> {\<lambda>Val:a:. fvar C stat fn a ..; R}\<rbrakk> \<Longrightarrow>
    1.90                                   G,A\<turnstile>{Normal P} {accC,C,stat}e..fn=\<succ> {R}"
    1.91  
    1.92 -  AVar:  "\<lbrakk>G,A\<turnstile>{Normal P} e1-\<succ> {Q};
    1.93 +| AVar:  "\<lbrakk>G,A\<turnstile>{Normal P} e1-\<succ> {Q};
    1.94            \<forall>a. G,A\<turnstile>{Q\<leftarrow>Val a} e2-\<succ> {\<lambda>Val:i:. avar G i a ..; R}\<rbrakk> \<Longrightarrow>
    1.95                                   G,A\<turnstile>{Normal P} e1.[e2]=\<succ> {R}"
    1.96    --{* expressions *}
    1.97  
    1.98 -  NewC: "\<lbrakk>G,A\<turnstile>{Normal P} .Init C. {Alloc G (CInst C) Q}\<rbrakk> \<Longrightarrow>
    1.99 +| NewC: "\<lbrakk>G,A\<turnstile>{Normal P} .Init C. {Alloc G (CInst C) Q}\<rbrakk> \<Longrightarrow>
   1.100                                   G,A\<turnstile>{Normal P} NewC C-\<succ> {Q}"
   1.101  
   1.102 -  NewA: "\<lbrakk>G,A\<turnstile>{Normal P} .init_comp_ty T. {Q};  G,A\<turnstile>{Q} e-\<succ>
   1.103 +| NewA: "\<lbrakk>G,A\<turnstile>{Normal P} .init_comp_ty T. {Q};  G,A\<turnstile>{Q} e-\<succ>
   1.104  	  {\<lambda>Val:i:. abupd (check_neg i) .; Alloc G (Arr T (the_Intg i)) R}\<rbrakk> \<Longrightarrow>
   1.105                                   G,A\<turnstile>{Normal P} New T[e]-\<succ> {R}"
   1.106  
   1.107 -  Cast: "\<lbrakk>G,A\<turnstile>{Normal P} e-\<succ> {\<lambda>Val:v:. \<lambda>s..
   1.108 +| Cast: "\<lbrakk>G,A\<turnstile>{Normal P} e-\<succ> {\<lambda>Val:v:. \<lambda>s..
   1.109            abupd (raise_if (\<not>G,s\<turnstile>v fits T) ClassCast) .; Q\<leftarrow>Val v}\<rbrakk> \<Longrightarrow>
   1.110                                   G,A\<turnstile>{Normal P} Cast T e-\<succ> {Q}"
   1.111  
   1.112 -  Inst: "\<lbrakk>G,A\<turnstile>{Normal P} e-\<succ> {\<lambda>Val:v:. \<lambda>s..
   1.113 +| Inst: "\<lbrakk>G,A\<turnstile>{Normal P} e-\<succ> {\<lambda>Val:v:. \<lambda>s..
   1.114                    Q\<leftarrow>Val (Bool (v\<noteq>Null \<and> G,s\<turnstile>v fits RefT T))}\<rbrakk> \<Longrightarrow>
   1.115                                   G,A\<turnstile>{Normal P} e InstOf T-\<succ> {Q}"
   1.116  
   1.117 -  Lit:                          "G,A\<turnstile>{Normal (P\<leftarrow>Val v)} Lit v-\<succ> {P}"
   1.118 +| Lit:                          "G,A\<turnstile>{Normal (P\<leftarrow>Val v)} Lit v-\<succ> {P}"
   1.119  
   1.120 -  UnOp: "\<lbrakk>G,A\<turnstile>{Normal P} e-\<succ> {\<lambda>Val:v:. Q\<leftarrow>Val (eval_unop unop v)}\<rbrakk>
   1.121 +| UnOp: "\<lbrakk>G,A\<turnstile>{Normal P} e-\<succ> {\<lambda>Val:v:. Q\<leftarrow>Val (eval_unop unop v)}\<rbrakk>
   1.122            \<Longrightarrow>
   1.123            G,A\<turnstile>{Normal P} UnOp unop e-\<succ> {Q}"
   1.124  
   1.125 -  BinOp:
   1.126 +| BinOp:
   1.127     "\<lbrakk>G,A\<turnstile>{Normal P} e1-\<succ> {Q};
   1.128       \<forall>v1. G,A\<turnstile>{Q\<leftarrow>Val v1} 
   1.129                 (if need_second_arg binop v1 then (In1l e2) else (In1r Skip))\<succ>
   1.130 @@ -551,20 +546,20 @@
   1.131      \<Longrightarrow>
   1.132      G,A\<turnstile>{Normal P} BinOp binop e1 e2-\<succ> {R}" 
   1.133  
   1.134 -  Super:" G,A\<turnstile>{Normal (\<lambda>s.. P\<leftarrow>Val (val_this s))} Super-\<succ> {P}"
   1.135 +| Super:" G,A\<turnstile>{Normal (\<lambda>s.. P\<leftarrow>Val (val_this s))} Super-\<succ> {P}"
   1.136  
   1.137 -  Acc:  "\<lbrakk>G,A\<turnstile>{Normal P} va=\<succ> {\<lambda>Var:(v,f):. Q\<leftarrow>Val v}\<rbrakk> \<Longrightarrow>
   1.138 +| Acc:  "\<lbrakk>G,A\<turnstile>{Normal P} va=\<succ> {\<lambda>Var:(v,f):. Q\<leftarrow>Val v}\<rbrakk> \<Longrightarrow>
   1.139                                   G,A\<turnstile>{Normal P} Acc va-\<succ> {Q}"
   1.140  
   1.141 -  Ass:  "\<lbrakk>G,A\<turnstile>{Normal P} va=\<succ> {Q};
   1.142 +| Ass:  "\<lbrakk>G,A\<turnstile>{Normal P} va=\<succ> {Q};
   1.143       \<forall>vf. G,A\<turnstile>{Q\<leftarrow>Var vf} e-\<succ> {\<lambda>Val:v:. assign (snd vf) v .; R}\<rbrakk> \<Longrightarrow>
   1.144                                   G,A\<turnstile>{Normal P} va:=e-\<succ> {R}"
   1.145  
   1.146 -  Cond: "\<lbrakk>G,A \<turnstile>{Normal P} e0-\<succ> {P'};
   1.147 +| Cond: "\<lbrakk>G,A \<turnstile>{Normal P} e0-\<succ> {P'};
   1.148            \<forall>b. G,A\<turnstile>{P'\<leftarrow>=b} (if b then e1 else e2)-\<succ> {Q}\<rbrakk> \<Longrightarrow>
   1.149                                   G,A\<turnstile>{Normal P} e0 ? e1 : e2-\<succ> {Q}"
   1.150  
   1.151 -  Call: 
   1.152 +| Call: 
   1.153  "\<lbrakk>G,A\<turnstile>{Normal P} e-\<succ> {Q}; \<forall>a. G,A\<turnstile>{Q\<leftarrow>Val a} args\<doteq>\<succ> {R a};
   1.154    \<forall>a vs invC declC l. G,A\<turnstile>{(R a\<leftarrow>Vals vs \<and>.
   1.155   (\<lambda>s. declC=invocation_declclass G mode (store s) a statT \<lparr>name=mn,parTs=pTs\<rparr> \<and>
   1.156 @@ -575,37 +570,37 @@
   1.157   Methd declC \<lparr>name=mn,parTs=pTs\<rparr>-\<succ> {set_lvars l .; S}\<rbrakk> \<Longrightarrow>
   1.158           G,A\<turnstile>{Normal P} {accC,statT,mode}e\<cdot>mn({pTs}args)-\<succ> {S}"
   1.159  
   1.160 -  Methd:"\<lbrakk>G,A\<union> {{P} Methd-\<succ> {Q} | ms} |\<turnstile> {{P} body G-\<succ> {Q} | ms}\<rbrakk> \<Longrightarrow>
   1.161 +| Methd:"\<lbrakk>G,A\<union> {{P} Methd-\<succ> {Q} | ms} |\<turnstile> {{P} body G-\<succ> {Q} | ms}\<rbrakk> \<Longrightarrow>
   1.162                                   G,A|\<turnstile>{{P} Methd-\<succ>  {Q} | ms}"
   1.163  
   1.164 -  Body: "\<lbrakk>G,A\<turnstile>{Normal P} .Init D. {Q}; 
   1.165 +| Body: "\<lbrakk>G,A\<turnstile>{Normal P} .Init D. {Q}; 
   1.166    G,A\<turnstile>{Q} .c. {\<lambda>s.. abupd (absorb Ret) .; R\<leftarrow>(In1 (the (locals s Result)))}\<rbrakk> 
   1.167      \<Longrightarrow>
   1.168                                   G,A\<turnstile>{Normal P} Body D c-\<succ> {R}"
   1.169    
   1.170    --{* expression lists *}
   1.171  
   1.172 -  Nil:                          "G,A\<turnstile>{Normal (P\<leftarrow>Vals [])} []\<doteq>\<succ> {P}"
   1.173 +| Nil:                          "G,A\<turnstile>{Normal (P\<leftarrow>Vals [])} []\<doteq>\<succ> {P}"
   1.174  
   1.175 -  Cons: "\<lbrakk>G,A\<turnstile>{Normal P} e-\<succ> {Q};
   1.176 +| Cons: "\<lbrakk>G,A\<turnstile>{Normal P} e-\<succ> {Q};
   1.177            \<forall>v. G,A\<turnstile>{Q\<leftarrow>Val v} es\<doteq>\<succ> {\<lambda>Vals:vs:. R\<leftarrow>Vals (v#vs)}\<rbrakk> \<Longrightarrow>
   1.178                                   G,A\<turnstile>{Normal P} e#es\<doteq>\<succ> {R}"
   1.179  
   1.180    --{* statements *}
   1.181  
   1.182 -  Skip:                         "G,A\<turnstile>{Normal (P\<leftarrow>\<diamondsuit>)} .Skip. {P}"
   1.183 +| Skip:                         "G,A\<turnstile>{Normal (P\<leftarrow>\<diamondsuit>)} .Skip. {P}"
   1.184  
   1.185 -  Expr: "\<lbrakk>G,A\<turnstile>{Normal P} e-\<succ> {Q\<leftarrow>\<diamondsuit>}\<rbrakk> \<Longrightarrow>
   1.186 +| Expr: "\<lbrakk>G,A\<turnstile>{Normal P} e-\<succ> {Q\<leftarrow>\<diamondsuit>}\<rbrakk> \<Longrightarrow>
   1.187                                   G,A\<turnstile>{Normal P} .Expr e. {Q}"
   1.188  
   1.189 -  Lab: "\<lbrakk>G,A\<turnstile>{Normal P} .c. {abupd (absorb l) .; Q}\<rbrakk> \<Longrightarrow>
   1.190 +| Lab: "\<lbrakk>G,A\<turnstile>{Normal P} .c. {abupd (absorb l) .; Q}\<rbrakk> \<Longrightarrow>
   1.191                             G,A\<turnstile>{Normal P} .l\<bullet> c. {Q}"
   1.192  
   1.193 -  Comp: "\<lbrakk>G,A\<turnstile>{Normal P} .c1. {Q};
   1.194 +| Comp: "\<lbrakk>G,A\<turnstile>{Normal P} .c1. {Q};
   1.195            G,A\<turnstile>{Q} .c2. {R}\<rbrakk> \<Longrightarrow>
   1.196                                   G,A\<turnstile>{Normal P} .c1;;c2. {R}"
   1.197  
   1.198 -  If:   "\<lbrakk>G,A \<turnstile>{Normal P} e-\<succ> {P'};
   1.199 +| If:   "\<lbrakk>G,A \<turnstile>{Normal P} e-\<succ> {P'};
   1.200            \<forall>b. G,A\<turnstile>{P'\<leftarrow>=b} .(if b then c1 else c2). {Q}\<rbrakk> \<Longrightarrow>
   1.201                                   G,A\<turnstile>{Normal P} .If(e) c1 Else c2. {Q}"
   1.202  (* unfolding variant of Loop, not needed here
   1.203 @@ -613,28 +608,28 @@
   1.204            \<forall>b. G,A\<turnstile>{P'\<leftarrow>=b} .(if b then c;;While(e) c else Skip).{Q}\<rbrakk>
   1.205           \<Longrightarrow>              G,A\<turnstile>{Normal P} .While(e) c. {Q}"
   1.206  *)
   1.207 -  Loop: "\<lbrakk>G,A\<turnstile>{P} e-\<succ> {P'}; 
   1.208 +| Loop: "\<lbrakk>G,A\<turnstile>{P} e-\<succ> {P'}; 
   1.209            G,A\<turnstile>{Normal (P'\<leftarrow>=True)} .c. {abupd (absorb (Cont l)) .; P}\<rbrakk> \<Longrightarrow>
   1.210                              G,A\<turnstile>{P} .l\<bullet> While(e) c. {(P'\<leftarrow>=False)\<down>=\<diamondsuit>}"
   1.211    
   1.212 -  Jmp: "G,A\<turnstile>{Normal (abupd (\<lambda>a. (Some (Jump j))) .; P\<leftarrow>\<diamondsuit>)} .Jmp j. {P}"
   1.213 +| Jmp: "G,A\<turnstile>{Normal (abupd (\<lambda>a. (Some (Jump j))) .; P\<leftarrow>\<diamondsuit>)} .Jmp j. {P}"
   1.214  
   1.215 -  Throw:"\<lbrakk>G,A\<turnstile>{Normal P} e-\<succ> {\<lambda>Val:a:. abupd (throw a) .; Q\<leftarrow>\<diamondsuit>}\<rbrakk> \<Longrightarrow>
   1.216 +| Throw:"\<lbrakk>G,A\<turnstile>{Normal P} e-\<succ> {\<lambda>Val:a:. abupd (throw a) .; Q\<leftarrow>\<diamondsuit>}\<rbrakk> \<Longrightarrow>
   1.217                                   G,A\<turnstile>{Normal P} .Throw e. {Q}"
   1.218  
   1.219 -  Try:  "\<lbrakk>G,A\<turnstile>{Normal P} .c1. {SXAlloc G Q};
   1.220 +| Try:  "\<lbrakk>G,A\<turnstile>{Normal P} .c1. {SXAlloc G Q};
   1.221            G,A\<turnstile>{Q \<and>. (\<lambda>s.  G,s\<turnstile>catch C) ;. new_xcpt_var vn} .c2. {R};
   1.222                (Q \<and>. (\<lambda>s. \<not>G,s\<turnstile>catch C)) \<Rightarrow> R\<rbrakk> \<Longrightarrow>
   1.223                                   G,A\<turnstile>{Normal P} .Try c1 Catch(C vn) c2. {R}"
   1.224  
   1.225 -  Fin:  "\<lbrakk>G,A\<turnstile>{Normal P} .c1. {Q};
   1.226 +| Fin:  "\<lbrakk>G,A\<turnstile>{Normal P} .c1. {Q};
   1.227        \<forall>x. G,A\<turnstile>{Q \<and>. (\<lambda>s. x = fst s) ;. abupd (\<lambda>x. None)}
   1.228                .c2. {abupd (abrupt_if (x\<noteq>None) x) .; R}\<rbrakk> \<Longrightarrow>
   1.229                                   G,A\<turnstile>{Normal P} .c1 Finally c2. {R}"
   1.230  
   1.231 -  Done:                       "G,A\<turnstile>{Normal (P\<leftarrow>\<diamondsuit> \<and>. initd C)} .Init C. {P}"
   1.232 +| Done:                       "G,A\<turnstile>{Normal (P\<leftarrow>\<diamondsuit> \<and>. initd C)} .Init C. {P}"
   1.233  
   1.234 -  Init: "\<lbrakk>the (class G C) = c;
   1.235 +| Init: "\<lbrakk>the (class G C) = c;
   1.236            G,A\<turnstile>{Normal ((P \<and>. Not \<circ> initd C) ;. supd (init_class_obj G C))}
   1.237                .(if C = Object then Skip else Init (super c)). {Q};
   1.238        \<forall>l. G,A\<turnstile>{Q \<and>. (\<lambda>s. l = locals (store s)) ;. set_lvars empty}
   1.239 @@ -645,10 +640,10 @@
   1.240  @{text InsInitE}, @{text InsInitV}, @{text FinA} only used by the smallstep 
   1.241  semantics.
   1.242  *}
   1.243 -  InsInitV: " G,A\<turnstile>{Normal P} InsInitV c v=\<succ> {Q}"
   1.244 -  InsInitE: " G,A\<turnstile>{Normal P} InsInitE c e-\<succ> {Q}"
   1.245 -  Callee:    " G,A\<turnstile>{Normal P} Callee l e-\<succ> {Q}"
   1.246 -  FinA:      " G,A\<turnstile>{Normal P} .FinA a c. {Q}"
   1.247 +| InsInitV: " G,A\<turnstile>{Normal P} InsInitV c v=\<succ> {Q}"
   1.248 +| InsInitE: " G,A\<turnstile>{Normal P} InsInitE c e-\<succ> {Q}"
   1.249 +| Callee:    " G,A\<turnstile>{Normal P} Callee l e-\<succ> {Q}"
   1.250 +| FinA:      " G,A\<turnstile>{Normal P} .FinA a c. {Q}"
   1.251  (*
   1.252  axioms 
   1.253  *)
   1.254 @@ -1032,7 +1027,7 @@
   1.255  *}
   1.256  declare ax_Abrupts [intro!]
   1.257  
   1.258 -lemmas ax_Normal_cases = ax_cases [of _ _ normal]
   1.259 +lemmas ax_Normal_cases = ax_cases [of _ _ _ normal]
   1.260  
   1.261  lemma ax_Skip [intro!]: "G,(A::'a triple set)\<turnstile>{P\<leftarrow>\<diamondsuit>} .Skip. {P::'a assn}"
   1.262  apply (rule ax_Normal_cases)
     2.1 --- a/src/HOL/Bali/AxSound.thy	Mon Dec 11 12:28:16 2006 +0100
     2.2 +++ b/src/HOL/Bali/AxSound.thy	Mon Dec 11 16:06:14 2006 +0100
     2.3 @@ -375,18 +375,18 @@
     2.4    thus ?case
     2.5      by (unfold ax_valids2_def) blast
     2.6  next
     2.7 -  case (asm A ts)
     2.8 +  case (asm ts A)
     2.9    have "ts \<subseteq> A" .
    2.10    then show "G,A|\<Turnstile>\<Colon>ts"
    2.11      by (auto simp add: ax_valids2_def triple_valid2_def)
    2.12  next
    2.13 -  case (weaken A ts ts')
    2.14 +  case (weaken A ts' ts)
    2.15    have "G,A|\<Turnstile>\<Colon>ts'" .
    2.16    moreover have "ts \<subseteq> ts'" .
    2.17    ultimately show "G,A|\<Turnstile>\<Colon>ts"
    2.18      by (unfold ax_valids2_def triple_valid2_def) blast
    2.19  next
    2.20 -  case (conseq A P Q t)
    2.21 +  case (conseq P A t Q)
    2.22    have con: "\<forall>Y s Z. P Y s Z \<longrightarrow> 
    2.23                (\<exists>P' Q'.
    2.24                    (G,A\<turnstile>{P'} t\<succ> {Q'} \<and> G,A|\<Turnstile>\<Colon>{ {P'} t\<succ> {Q'} }) \<and>
    2.25 @@ -431,7 +431,7 @@
    2.26      qed
    2.27    qed
    2.28  next
    2.29 -  case (hazard A P Q t)
    2.30 +  case (hazard A P t Q)
    2.31    show "G,A|\<Turnstile>\<Colon>{ {P \<and>. Not \<circ> type_ok G t} t\<succ> {Q} }"
    2.32      by (simp add: ax_valids2_def triple_valid2_def2 type_ok_def) fast
    2.33  next
    2.34 @@ -474,7 +474,7 @@
    2.35      qed
    2.36    qed
    2.37  next
    2.38 -  case (FVar A statDeclC P Q R accC e fn stat)
    2.39 +  case (FVar A P statDeclC Q e stat fn R accC)
    2.40    have valid_init: "G,A|\<Turnstile>\<Colon>{ {Normal P} .Init statDeclC. {Q} }" .
    2.41    have valid_e: "G,A|\<Turnstile>\<Colon>{ {Q} e-\<succ> {\<lambda>Val:a:. fvar statDeclC stat fn a ..; R} }" .
    2.42    show "G,A|\<Turnstile>\<Colon>{ {Normal P} {accC,statDeclC,stat}e..fn=\<succ> {R} }"
    2.43 @@ -569,7 +569,7 @@
    2.44      qed
    2.45    qed
    2.46  next
    2.47 -  case (AVar A P Q R e1 e2)
    2.48 +  case (AVar A P e1 Q e2 R)
    2.49    have valid_e1: "G,A|\<Turnstile>\<Colon>{ {Normal P} e1-\<succ> {Q} }" .
    2.50    have valid_e2: "\<And> a. G,A|\<Turnstile>\<Colon>{ {Q\<leftarrow>In1 a} e2-\<succ> {\<lambda>Val:i:. avar G i a ..; R} }"
    2.51      using AVar.hyps by simp
    2.52 @@ -633,7 +633,7 @@
    2.53      qed
    2.54    qed
    2.55  next
    2.56 -  case (NewC A C P Q)
    2.57 +  case (NewC A P C Q)
    2.58    have valid_init: "G,A|\<Turnstile>\<Colon>{ {Normal P} .Init C. {Alloc G (CInst C) Q} }".
    2.59    show "G,A|\<Turnstile>\<Colon>{ {Normal P} NewC C-\<succ> {Q} }"
    2.60    proof (rule valid_expr_NormalI)
    2.61 @@ -673,7 +673,7 @@
    2.62      qed
    2.63    qed
    2.64  next
    2.65 -  case (NewA A P Q R T e)
    2.66 +  case (NewA A P T Q e R)
    2.67    have valid_init: "G,A|\<Turnstile>\<Colon>{ {Normal P} .init_comp_ty T. {Q} }" .
    2.68    have valid_e: "G,A|\<Turnstile>\<Colon>{ {Q} e-\<succ> {\<lambda>Val:i:. abupd (check_neg i) .; 
    2.69                                              Alloc G (Arr T (the_Intg i)) R}}" .
    2.70 @@ -746,7 +746,7 @@
    2.71      qed
    2.72    qed
    2.73  next
    2.74 -  case (Cast A P Q T e)
    2.75 +  case (Cast A P e T Q)
    2.76    have valid_e: "G,A|\<Turnstile>\<Colon>{ {Normal P} e-\<succ> 
    2.77                   {\<lambda>Val:v:. \<lambda>s.. abupd (raise_if (\<not> G,s\<turnstile>v fits T) ClassCast) .;
    2.78                    Q\<leftarrow>In1 v} }" .
    2.79 @@ -786,7 +786,7 @@
    2.80      qed
    2.81    qed
    2.82  next
    2.83 -  case (Inst A P Q T e)
    2.84 +  case (Inst A P e Q T)
    2.85    assume valid_e: "G,A|\<Turnstile>\<Colon>{ {Normal P} e-\<succ>
    2.86                 {\<lambda>Val:v:. \<lambda>s.. Q\<leftarrow>In1 (Bool (v \<noteq> Null \<and> G,s\<turnstile>v fits RefT T))} }"
    2.87    show "G,A|\<Turnstile>\<Colon>{ {Normal P} e InstOf T-\<succ> {Q} }"
    2.88 @@ -841,7 +841,7 @@
    2.89      qed
    2.90    qed
    2.91  next
    2.92 -  case (UnOp A P Q e unop)
    2.93 +  case (UnOp A P e Q unop)
    2.94    assume valid_e: "G,A|\<Turnstile>\<Colon>{ {Normal P}e-\<succ>{\<lambda>Val:v:. Q\<leftarrow>In1 (eval_unop unop v)} }"
    2.95    show "G,A|\<Turnstile>\<Colon>{ {Normal P} UnOp unop e-\<succ> {Q} }"
    2.96    proof (rule valid_expr_NormalI)
    2.97 @@ -878,7 +878,7 @@
    2.98      qed
    2.99    qed
   2.100  next
   2.101 -  case (BinOp A P Q R binop e1 e2)
   2.102 +  case (BinOp A P e1 Q binop e2 R)
   2.103    assume valid_e1: "G,A|\<Turnstile>\<Colon>{ {Normal P} e1-\<succ> {Q} }" 
   2.104    have valid_e2: "\<And> v1.  G,A|\<Turnstile>\<Colon>{ {Q\<leftarrow>In1 v1}
   2.105                (if need_second_arg binop v1 then In1l e2 else In1r Skip)\<succ>
   2.106 @@ -977,7 +977,7 @@
   2.107      qed
   2.108    qed
   2.109  next
   2.110 -  case (Acc A P Q var)
   2.111 +  case (Acc A P var Q)
   2.112    have valid_var: "G,A|\<Turnstile>\<Colon>{ {Normal P} var=\<succ> {\<lambda>Var:(v, f):. Q\<leftarrow>In1 v} }" .
   2.113    show "G,A|\<Turnstile>\<Colon>{ {Normal P} Acc var-\<succ> {Q} }"
   2.114    proof (rule valid_expr_NormalI)
   2.115 @@ -1013,7 +1013,7 @@
   2.116      qed
   2.117    qed
   2.118  next
   2.119 -  case (Ass A P Q R e var)
   2.120 +  case (Ass A P var Q e R)
   2.121    have valid_var: "G,A|\<Turnstile>\<Colon>{ {Normal P} var=\<succ> {Q} }" .
   2.122    have valid_e: "\<And> vf. 
   2.123                    G,A|\<Turnstile>\<Colon>{ {Q\<leftarrow>In2 vf} e-\<succ> {\<lambda>Val:v:. assign (snd vf) v .; R} }"
   2.124 @@ -1125,7 +1125,7 @@
   2.125      qed
   2.126    qed
   2.127  next
   2.128 -  case (Cond A P P' Q e0 e1 e2)
   2.129 +  case (Cond A P e0 P' e1 e2 Q)
   2.130    have valid_e0: "G,A|\<Turnstile>\<Colon>{ {Normal P} e0-\<succ> {P'} }" .
   2.131    have valid_then_else:"\<And> b.  G,A|\<Turnstile>\<Colon>{ {P'\<leftarrow>=b} (if b then e1 else e2)-\<succ> {Q} }"
   2.132      using Cond.hyps by simp
   2.133 @@ -1215,7 +1215,7 @@
   2.134      qed
   2.135    qed
   2.136  next
   2.137 -  case (Call A P Q R S accC' args e mn mode pTs' statT)
   2.138 +  case (Call A P e Q args R mode statT mn pTs' S accC')
   2.139    have valid_e: "G,A|\<Turnstile>\<Colon>{ {Normal P} e-\<succ> {Q} }" .
   2.140    have valid_args: "\<And> a. G,A|\<Turnstile>\<Colon>{ {Q\<leftarrow>In1 a} args\<doteq>\<succ> {R a} }"
   2.141      using Call.hyps by simp
   2.142 @@ -1604,7 +1604,7 @@
   2.143    show "G,A|\<Turnstile>\<Colon>{{P} Methd-\<succ> {Q} | ms}"
   2.144      by (rule Methd_sound)
   2.145  next
   2.146 -  case (Body A D P Q R c)
   2.147 +  case (Body A P D Q c R)
   2.148    have valid_init: "G,A|\<Turnstile>\<Colon>{ {Normal P} .Init D. {Q} }".
   2.149    have valid_c: "G,A|\<Turnstile>\<Colon>{ {Q} .c. 
   2.150                {\<lambda>s.. abupd (absorb Ret) .; R\<leftarrow>In1 (the (locals s Result))} }".
   2.151 @@ -1697,7 +1697,7 @@
   2.152      qed
   2.153    qed
   2.154  next
   2.155 -  case (Cons A P Q R e es)
   2.156 +  case (Cons A P e Q es R)
   2.157    have valid_e: "G,A|\<Turnstile>\<Colon>{ {Normal P} e-\<succ> {Q} }".
   2.158    have valid_es: "\<And> v. G,A|\<Turnstile>\<Colon>{ {Q\<leftarrow>\<lfloor>v\<rfloor>\<^sub>e} es\<doteq>\<succ> {\<lambda>Vals:vs:. R\<leftarrow>\<lfloor>(v # vs)\<rfloor>\<^sub>l} }"
   2.159      using Cons.hyps by simp
   2.160 @@ -1779,7 +1779,7 @@
   2.161      qed
   2.162    qed
   2.163  next
   2.164 -  case (Expr A P Q e)
   2.165 +  case (Expr A P e Q)
   2.166    have valid_e: "G,A|\<Turnstile>\<Colon>{ {Normal P} e-\<succ> {Q\<leftarrow>\<diamondsuit>} }".
   2.167    show "G,A|\<Turnstile>\<Colon>{ {Normal P} .Expr e. {Q} }"
   2.168    proof (rule valid_stmt_NormalI)
   2.169 @@ -1809,7 +1809,7 @@
   2.170      qed
   2.171    qed
   2.172  next
   2.173 -  case (Lab A P Q c l)
   2.174 +  case (Lab A P c l Q)
   2.175    have valid_c: "G,A|\<Turnstile>\<Colon>{ {Normal P} .c. {abupd (absorb l) .; Q} }".
   2.176    show "G,A|\<Turnstile>\<Colon>{ {Normal P} .l\<bullet> c. {Q} }"
   2.177    proof (rule valid_stmt_NormalI)
   2.178 @@ -1846,7 +1846,7 @@
   2.179      qed
   2.180    qed
   2.181  next
   2.182 -  case (Comp A P Q R c1 c2)
   2.183 +  case (Comp A P c1 Q c2 R)
   2.184    have valid_c1: "G,A|\<Turnstile>\<Colon>{ {Normal P} .c1. {Q} }" .
   2.185    have valid_c2: "G,A|\<Turnstile>\<Colon>{ {Q} .c2. {R} }" .
   2.186    show "G,A|\<Turnstile>\<Colon>{ {Normal P} .c1;; c2. {R} }"
   2.187 @@ -1905,7 +1905,7 @@
   2.188      qed
   2.189    qed
   2.190  next
   2.191 -  case (If A P P' Q c1 c2 e)
   2.192 +  case (If A P e P' c1 c2 Q)
   2.193    have valid_e: "G,A|\<Turnstile>\<Colon>{ {Normal P} e-\<succ> {P'} }" .
   2.194    have valid_then_else: "\<And> b. G,A|\<Turnstile>\<Colon>{ {P'\<leftarrow>=b} .(if b then c1 else c2). {Q} }" 
   2.195      using If.hyps by simp
   2.196 @@ -1982,7 +1982,7 @@
   2.197      qed
   2.198    qed
   2.199  next
   2.200 -  case (Loop A P P' c e l)
   2.201 +  case (Loop A P e P' c l)
   2.202    have valid_e: "G,A|\<Turnstile>\<Colon>{ {P} e-\<succ> {P'} }".
   2.203    have valid_c: "G,A|\<Turnstile>\<Colon>{ {Normal (P'\<leftarrow>=True)} 
   2.204                           .c. 
   2.205 @@ -2020,7 +2020,7 @@
   2.206                  \<rbrakk>\<Longrightarrow> (P'\<leftarrow>=False\<down>=\<diamondsuit>) v s' Z"
   2.207  	  (is "PROP ?Hyp n t s v s'")
   2.208  	proof (induct)
   2.209 -	  case (Loop b c' e' l' n' s0' s1' s2' s3' Y' T E)
   2.210 +	  case (Loop s0' e' n' b s1' c' s2' l' s3' Y' T E)
   2.211  	  have while: "(\<langle>l'\<bullet> While(e') c'\<rangle>\<^sub>s::term) = \<langle>l\<bullet> While(e) c\<rangle>\<^sub>s" .
   2.212            hence eqs: "l'=l" "e'=e" "c'=c" by simp_all
   2.213  	  have valid_A: "\<forall>t\<in>A. G\<Turnstile>n'\<Colon>t". 
   2.214 @@ -2173,7 +2173,7 @@
   2.215  	    qed
   2.216  	  qed
   2.217  	next
   2.218 -	  case (Abrupt n' s t' abr Y' T E)
   2.219 +	  case (Abrupt abr s t' n' Y' T E)
   2.220  	  have t': "t' = \<langle>l\<bullet> While(e) c\<rangle>\<^sub>s".
   2.221  	  have conf: "(Some abr, s)\<Colon>\<preceq>(G, L)".
   2.222  	  have P: "P Y' (Some abr, s) Z".
   2.223 @@ -2212,7 +2212,7 @@
   2.224      qed
   2.225    qed
   2.226  next
   2.227 -  case (Jmp A P j)
   2.228 +  case (Jmp A j P)
   2.229    show "G,A|\<Turnstile>\<Colon>{ {Normal (abupd (\<lambda>a. Some (Jump j)) .; P\<leftarrow>\<diamondsuit>)} .Jmp j. {P} }"
   2.230    proof (rule valid_stmt_NormalI)
   2.231      fix n s0 L accC C s1 Y Z
   2.232 @@ -2239,7 +2239,7 @@
   2.233      qed
   2.234    qed
   2.235  next
   2.236 -  case (Throw A P Q e)
   2.237 +  case (Throw A P e Q)
   2.238    have valid_e: "G,A|\<Turnstile>\<Colon>{ {Normal P} e-\<succ> {\<lambda>Val:a:. abupd (throw a) .; Q\<leftarrow>\<diamondsuit>} }".
   2.239    show "G,A|\<Turnstile>\<Colon>{ {Normal P} .Throw e. {Q} }"
   2.240    proof (rule valid_stmt_NormalI)
   2.241 @@ -2277,7 +2277,7 @@
   2.242      qed
   2.243    qed
   2.244  next
   2.245 -  case (Try A C P Q R c1 c2 vn)
   2.246 +  case (Try A P c1 Q C vn c2 R)
   2.247    have valid_c1: "G,A|\<Turnstile>\<Colon>{ {Normal P} .c1. {SXAlloc G Q} }".
   2.248    have valid_c2: "G,A|\<Turnstile>\<Colon>{ {Q \<and>. (\<lambda>s. G,s\<turnstile>catch C) ;. new_xcpt_var vn} 
   2.249                             .c2. 
   2.250 @@ -2409,7 +2409,7 @@
   2.251      qed
   2.252    qed
   2.253  next
   2.254 -  case (Fin A P Q R c1 c2)
   2.255 +  case (Fin A P c1 Q  c2 R)
   2.256    have valid_c1: "G,A|\<Turnstile>\<Colon>{ {Normal P} .c1. {Q} }".
   2.257    have valid_c2: "\<And> abr. G,A|\<Turnstile>\<Colon>{ {Q \<and>. (\<lambda>s. abr = fst s) ;. abupd (\<lambda>x. None)} 
   2.258                                    .c2.
   2.259 @@ -2483,7 +2483,7 @@
   2.260      qed
   2.261    qed
   2.262  next
   2.263 -  case (Done A C P)
   2.264 +  case (Done A P C)
   2.265    show "G,A|\<Turnstile>\<Colon>{ {Normal (P\<leftarrow>\<diamondsuit> \<and>. initd C)} .Init C. {P} }" 
   2.266    proof (rule valid_stmt_NormalI)
   2.267      fix n s0 L accC E s3 Y Z
   2.268 @@ -2506,7 +2506,7 @@
   2.269      qed
   2.270    qed
   2.271  next
   2.272 -  case (Init A C P Q R c)
   2.273 +  case (Init C c A P Q R)
   2.274    have c: "the (class G C) = c".
   2.275    have valid_super: 
   2.276          "G,A|\<Turnstile>\<Colon>{ {Normal (P \<and>. Not \<circ> initd C ;. supd (init_class_obj G C))}
   2.277 @@ -2618,7 +2618,7 @@
   2.278      qed
   2.279    qed
   2.280  next
   2.281 -  case (InsInitV A P Q c v)
   2.282 +  case (InsInitV A P c v Q)
   2.283    show "G,A|\<Turnstile>\<Colon>{ {Normal P} InsInitV c v=\<succ> {Q} }"
   2.284    proof (rule valid_var_NormalI)
   2.285      fix s0 vf n s1 L Z
   2.286 @@ -2630,7 +2630,7 @@
   2.287      thus "Q \<lfloor>vf\<rfloor>\<^sub>v s1 Z \<and> s1\<Colon>\<preceq>(G, L)"..
   2.288    qed
   2.289  next
   2.290 -  case (InsInitE A P Q c e)
   2.291 +  case (InsInitE A P c e Q)
   2.292    show "G,A|\<Turnstile>\<Colon>{ {Normal P} InsInitE c e-\<succ> {Q} }"
   2.293    proof (rule valid_expr_NormalI)
   2.294      fix s0 v n s1 L Z
   2.295 @@ -2642,7 +2642,7 @@
   2.296      thus "Q \<lfloor>v\<rfloor>\<^sub>e s1 Z \<and> s1\<Colon>\<preceq>(G, L)"..
   2.297    qed
   2.298  next
   2.299 -  case (Callee A P Q e l)
   2.300 +  case (Callee A P l e Q)
   2.301    show "G,A|\<Turnstile>\<Colon>{ {Normal P} Callee l e-\<succ> {Q} }"
   2.302    proof (rule valid_expr_NormalI)
   2.303      fix s0 v n s1 L Z
   2.304 @@ -2654,7 +2654,7 @@
   2.305      thus "Q \<lfloor>v\<rfloor>\<^sub>e s1 Z \<and> s1\<Colon>\<preceq>(G, L)"..
   2.306    qed
   2.307  next
   2.308 -  case (FinA A P Q a c)
   2.309 +  case (FinA A P a c Q)
   2.310    show "G,A|\<Turnstile>\<Colon>{ {Normal P} .FinA a c. {Q} }"
   2.311    proof (rule valid_stmt_NormalI)
   2.312      fix s0 v n s1 L Z
     3.1 --- a/src/HOL/Bali/DeclConcepts.thy	Mon Dec 11 12:28:16 2006 +0100
     3.2 +++ b/src/HOL/Bali/DeclConcepts.thy	Mon Dec 11 16:06:14 2006 +0100
     3.3 @@ -536,26 +536,21 @@
     3.4  
     3.5  subsubsection "members"
     3.6  
     3.7 -consts
     3.8 -members:: "prog \<Rightarrow> (qtname \<times> (qtname \<times> memberdecl)) set"
     3.9  (* Can't just take a function: prog \<Rightarrow> qtname \<Rightarrow> memberdecl set because
    3.10     the class qtname changes to the superclass in the inductive definition
    3.11     below
    3.12  *)
    3.13  
    3.14 -syntax
    3.15 -member_of:: "prog \<Rightarrow> (qtname \<times> memberdecl) \<Rightarrow> qtname \<Rightarrow> bool"
    3.16 -                           ("_ \<turnstile> _ member'_of _" [61,61,61] 60)
    3.17 -
    3.18 -translations
    3.19 - "G\<turnstile>m member_of C" \<rightleftharpoons> "(C,m) \<in> members G"
    3.20 +inductive2
    3.21 +  members :: "prog \<Rightarrow> (qtname \<times> memberdecl) \<Rightarrow> qtname \<Rightarrow> bool"
    3.22 +    ("_ \<turnstile> _ member'_of _" [61,61,61] 60)
    3.23 +  for G :: prog
    3.24 +where
    3.25  
    3.26 -inductive "members G"  intros
    3.27 -
    3.28 -Immediate: "\<lbrakk>G\<turnstile>mbr m declared_in C;declclass m = C\<rbrakk> \<Longrightarrow> G\<turnstile>m member_of C"
    3.29 -Inherited: "\<lbrakk>G\<turnstile>m inheritable_in (pid C); G\<turnstile>memberid m undeclared_in C; 
    3.30 -             G\<turnstile>C \<prec>\<^sub>C\<^sub>1 S; G\<turnstile>(Class S) accessible_in (pid C);G\<turnstile>m member_of S 
    3.31 -            \<rbrakk> \<Longrightarrow> G\<turnstile>m member_of C"
    3.32 +  Immediate: "\<lbrakk>G\<turnstile>mbr m declared_in C;declclass m = C\<rbrakk> \<Longrightarrow> G\<turnstile>m member_of C"
    3.33 +| Inherited: "\<lbrakk>G\<turnstile>m inheritable_in (pid C); G\<turnstile>memberid m undeclared_in C; 
    3.34 +               G\<turnstile>C \<prec>\<^sub>C\<^sub>1 S; G\<turnstile>(Class S) accessible_in (pid C);G\<turnstile>m member_of S 
    3.35 +              \<rbrakk> \<Longrightarrow> G\<turnstile>m member_of C"
    3.36  text {* Note that in the case of an inherited member only the members of the
    3.37  direct superclass are concerned. If a member of a superclass of the direct
    3.38  superclass isn't inherited in the direct superclass (not member of the
    3.39 @@ -619,9 +614,6 @@
    3.40  translations
    3.41   "G\<turnstile>Methd s m member_in C" \<rightleftharpoons> "G\<turnstile>(method s m) member_in C" 
    3.42  
    3.43 -consts stat_overridesR::
    3.44 -  "prog  \<Rightarrow> ((qtname \<times> mdecl) \<times> (qtname \<times> mdecl)) set"
    3.45 -
    3.46  lemma member_inD: "G\<turnstile>m member_in C 
    3.47   \<Longrightarrow> \<exists> provC. G\<turnstile> C \<preceq>\<^sub>C provC \<and> G \<turnstile> m member_of provC"
    3.48  by (auto simp add: member_in_def)
    3.49 @@ -641,48 +633,43 @@
    3.50  *}
    3.51  
    3.52  text {* Static overriding (used during the typecheck of the compiler) *}
    3.53 -syntax
    3.54 -stat_overrides:: "prog  \<Rightarrow> (qtname \<times> mdecl) \<Rightarrow> (qtname \<times> mdecl) \<Rightarrow> bool" 
    3.55 -                                  ("_ \<turnstile> _ overrides\<^sub>S _" [61,61,61] 60)
    3.56 -translations
    3.57 - "G\<turnstile>new overrides\<^sub>S  old" == "(new,old) \<in> stat_overridesR G "
    3.58  
    3.59 -inductive "stat_overridesR G" intros
    3.60 +inductive2
    3.61 +  stat_overridesR :: "prog \<Rightarrow> (qtname \<times> mdecl) \<Rightarrow> (qtname \<times> mdecl) \<Rightarrow> bool"
    3.62 +    ("_ \<turnstile> _ overrides\<^sub>S _" [61,61,61] 60)
    3.63 +  for G :: prog
    3.64 +where
    3.65  
    3.66 -Direct: "\<lbrakk>\<not> is_static new; msig new = msig old; 
    3.67 -         G\<turnstile>Method new declared_in (declclass new);  
    3.68 -         G\<turnstile>Method old declared_in (declclass old); 
    3.69 -         G\<turnstile>Method old inheritable_in pid (declclass new);
    3.70 -         G\<turnstile>(declclass new) \<prec>\<^sub>C\<^sub>1 superNew;
    3.71 -         G \<turnstile>Method old member_of superNew
    3.72 -         \<rbrakk> \<Longrightarrow> G\<turnstile>new overrides\<^sub>S old"
    3.73 +  Direct: "\<lbrakk>\<not> is_static new; msig new = msig old; 
    3.74 +           G\<turnstile>Method new declared_in (declclass new);  
    3.75 +           G\<turnstile>Method old declared_in (declclass old); 
    3.76 +           G\<turnstile>Method old inheritable_in pid (declclass new);
    3.77 +           G\<turnstile>(declclass new) \<prec>\<^sub>C\<^sub>1 superNew;
    3.78 +           G \<turnstile>Method old member_of superNew
    3.79 +           \<rbrakk> \<Longrightarrow> G\<turnstile>new overrides\<^sub>S old"
    3.80  
    3.81 -Indirect: "\<lbrakk>G\<turnstile>new overrides\<^sub>S inter; G\<turnstile>inter overrides\<^sub>S old\<rbrakk>
    3.82 -           \<Longrightarrow> G\<turnstile>new overrides\<^sub>S old"
    3.83 +| Indirect: "\<lbrakk>G\<turnstile>new overrides\<^sub>S inter; G\<turnstile>inter overrides\<^sub>S old\<rbrakk>
    3.84 +             \<Longrightarrow> G\<turnstile>new overrides\<^sub>S old"
    3.85  
    3.86  text {* Dynamic overriding (used during the typecheck of the compiler) *}
    3.87 -consts overridesR::
    3.88 -  "prog  \<Rightarrow> ((qtname \<times> mdecl) \<times> (qtname \<times> mdecl)) set"
    3.89  
    3.90 -
    3.91 -overrides:: "prog  \<Rightarrow> (qtname \<times> mdecl) \<Rightarrow> (qtname \<times> mdecl) \<Rightarrow> bool" 
    3.92 -                                  ("_ \<turnstile> _ overrides _" [61,61,61] 60)
    3.93 -translations
    3.94 - "G\<turnstile>new overrides old" == "(new,old) \<in> overridesR G "
    3.95 -
    3.96 -inductive "overridesR G" intros
    3.97 +inductive2
    3.98 +  overridesR :: "prog \<Rightarrow> (qtname \<times> mdecl) \<Rightarrow> (qtname \<times> mdecl) \<Rightarrow> bool"
    3.99 +    ("_ \<turnstile> _ overrides _" [61,61,61] 60)
   3.100 +  for G :: prog
   3.101 +where
   3.102  
   3.103 -Direct: "\<lbrakk>\<not> is_static new; \<not> is_static old; accmodi new \<noteq> Private;
   3.104 -         msig new = msig old; 
   3.105 -         G\<turnstile>(declclass new) \<prec>\<^sub>C (declclass old);
   3.106 -         G\<turnstile>Method new declared_in (declclass new);  
   3.107 -         G\<turnstile>Method old declared_in (declclass old);    
   3.108 -         G\<turnstile>Method old inheritable_in pid (declclass new);
   3.109 -         G\<turnstile>resTy new \<preceq> resTy old
   3.110 -         \<rbrakk> \<Longrightarrow> G\<turnstile>new overrides old"
   3.111 +  Direct: "\<lbrakk>\<not> is_static new; \<not> is_static old; accmodi new \<noteq> Private;
   3.112 +           msig new = msig old; 
   3.113 +           G\<turnstile>(declclass new) \<prec>\<^sub>C (declclass old);
   3.114 +           G\<turnstile>Method new declared_in (declclass new);  
   3.115 +           G\<turnstile>Method old declared_in (declclass old);    
   3.116 +           G\<turnstile>Method old inheritable_in pid (declclass new);
   3.117 +           G\<turnstile>resTy new \<preceq> resTy old
   3.118 +           \<rbrakk> \<Longrightarrow> G\<turnstile>new overrides old"
   3.119  
   3.120 -Indirect: "\<lbrakk>G\<turnstile>new overrides inter; G\<turnstile>inter overrides old\<rbrakk>
   3.121 -           \<Longrightarrow> G\<turnstile>new overrides old"
   3.122 +| Indirect: "\<lbrakk>G\<turnstile>new overrides inter; G\<turnstile>inter overrides old\<rbrakk>
   3.123 +            \<Longrightarrow> G\<turnstile>new overrides old"
   3.124  
   3.125  syntax
   3.126  sig_stat_overrides:: 
   3.127 @@ -797,28 +784,31 @@
   3.128  \end{itemize} 
   3.129  *} 
   3.130  
   3.131 -
   3.132 -consts
   3.133 -accessible_fromR:: 
   3.134 - "prog \<Rightarrow> qtname \<Rightarrow> ((qtname \<times> memberdecl) \<times>  qtname) set"
   3.135 +inductive2
   3.136 +  accessible_fromR :: "prog \<Rightarrow> qtname \<Rightarrow> (qtname \<times> memberdecl) \<Rightarrow> qtname \<Rightarrow> bool"
   3.137 +  and accessible_from :: "prog \<Rightarrow> (qtname \<times> memberdecl) \<Rightarrow> qtname \<Rightarrow> qtname \<Rightarrow> bool"
   3.138 +    ("_ \<turnstile> _ of _ accessible'_from _" [61,61,61,61] 60)
   3.139 +  and method_accessible_from :: "prog \<Rightarrow> (qtname \<times> mdecl) \<Rightarrow> qtname \<Rightarrow> qtname \<Rightarrow> bool"
   3.140 +    ("_ \<turnstile>Method _ of _ accessible'_from _" [61,61,61,61] 60)
   3.141 +  for G :: prog and accclass :: qtname
   3.142 +where
   3.143 +  "G\<turnstile>membr of cls accessible_from accclass \<equiv> accessible_fromR G accclass membr cls"
   3.144  
   3.145 -syntax 
   3.146 -accessible_from:: 
   3.147 - "prog \<Rightarrow> (qtname \<times> memberdecl) \<Rightarrow> qtname \<Rightarrow> qtname \<Rightarrow> bool"
   3.148 -                   ("_ \<turnstile> _ of _ accessible'_from _" [61,61,61,61] 60)
   3.149 +| "G\<turnstile>Method m of cls accessible_from accclass \<equiv>
   3.150 +   G\<turnstile>methdMembr m of cls accessible_from accclass"  
   3.151  
   3.152 -translations
   3.153 -"G\<turnstile>membr of cls accessible_from accclass"  
   3.154 - \<rightleftharpoons> "(membr,cls) \<in> accessible_fromR G accclass"
   3.155 +| Immediate:  "\<lbrakk>G\<turnstile>membr member_of class;
   3.156 +                G\<turnstile>(Class class) accessible_in (pid accclass);
   3.157 +                G\<turnstile>membr in class permits_acc_from accclass 
   3.158 +               \<rbrakk> \<Longrightarrow> G\<turnstile>membr of class accessible_from accclass"
   3.159  
   3.160 -syntax 
   3.161 -method_accessible_from:: 
   3.162 - "prog \<Rightarrow> (qtname \<times> mdecl) \<Rightarrow> qtname \<Rightarrow> qtname \<Rightarrow> bool"
   3.163 -                   ("_ \<turnstile>Method _ of _ accessible'_from _" [61,61,61,61] 60)
   3.164 -
   3.165 -translations
   3.166 -"G\<turnstile>Method m of cls accessible_from accclass"  
   3.167 - \<rightleftharpoons> "G\<turnstile>methdMembr m of cls accessible_from accclass"  
   3.168 +| Overriding: "\<lbrakk>G\<turnstile>membr member_of class;
   3.169 +                G\<turnstile>(Class class) accessible_in (pid accclass);
   3.170 +                membr=(C,mdecl new);
   3.171 +                G\<turnstile>(C,new) overrides\<^sub>S old; 
   3.172 +                G\<turnstile>class \<prec>\<^sub>C sup;
   3.173 +                G\<turnstile>Method old of sup accessible_from accclass
   3.174 +               \<rbrakk>\<Longrightarrow> G\<turnstile>membr of class accessible_from accclass"
   3.175  
   3.176  syntax 
   3.177  methd_accessible_from:: 
   3.178 @@ -838,41 +828,29 @@
   3.179  "G\<turnstile>Field fn f of C accessible_from accclass"  
   3.180   \<rightleftharpoons> "G\<turnstile>(fieldm fn f) of C accessible_from accclass" 
   3.181  
   3.182 -inductive "accessible_fromR G accclass" intros
   3.183 -Immediate:  "\<lbrakk>G\<turnstile>membr member_of class;
   3.184 -              G\<turnstile>(Class class) accessible_in (pid accclass);
   3.185 -              G\<turnstile>membr in class permits_acc_from accclass 
   3.186 -             \<rbrakk> \<Longrightarrow> G\<turnstile>membr of class accessible_from accclass"
   3.187 -
   3.188 -Overriding: "\<lbrakk>G\<turnstile>membr member_of class;
   3.189 -              G\<turnstile>(Class class) accessible_in (pid accclass);
   3.190 -              membr=(C,mdecl new);
   3.191 -              G\<turnstile>(C,new) overrides\<^sub>S old; 
   3.192 -              G\<turnstile>class \<prec>\<^sub>C sup;
   3.193 -              G\<turnstile>Method old of sup accessible_from accclass
   3.194 -             \<rbrakk>\<Longrightarrow> G\<turnstile>membr of class accessible_from accclass"
   3.195 -
   3.196 -consts
   3.197 -dyn_accessible_fromR:: 
   3.198 - "prog \<Rightarrow> qtname \<Rightarrow> ((qtname \<times> memberdecl) \<times>  qtname) set"
   3.199 +inductive2
   3.200 +  dyn_accessible_fromR :: "prog \<Rightarrow> qtname \<Rightarrow> (qtname \<times> memberdecl) \<Rightarrow> qtname \<Rightarrow> bool"
   3.201 +  and dyn_accessible_from' ::  "prog \<Rightarrow> (qtname \<times> memberdecl) \<Rightarrow> qtname \<Rightarrow> qtname \<Rightarrow> bool"
   3.202 +    ("_ \<turnstile> _ in _ dyn'_accessible'_from _" [61,61,61,61] 60)
   3.203 +  and method_dyn_accessible_from :: "prog \<Rightarrow> (qtname \<times> mdecl) \<Rightarrow> qtname \<Rightarrow> qtname \<Rightarrow> bool"
   3.204 +    ("_ \<turnstile>Method _ in _ dyn'_accessible'_from _" [61,61,61,61] 60)
   3.205 +  for G :: prog and accclass :: qtname
   3.206 +where
   3.207 +  "G\<turnstile>membr in C dyn_accessible_from accC \<equiv> dyn_accessible_fromR G accC membr C"
   3.208  
   3.209 -syntax 
   3.210 -dyn_accessible_from:: 
   3.211 - "prog \<Rightarrow> (qtname \<times> memberdecl) \<Rightarrow> qtname \<Rightarrow> qtname \<Rightarrow> bool"
   3.212 -                   ("_ \<turnstile> _ in _ dyn'_accessible'_from _" [61,61,61,61] 60)
   3.213 +| "G\<turnstile>Method m in C dyn_accessible_from accC \<equiv>
   3.214 +   G\<turnstile>methdMembr m in C dyn_accessible_from accC"
   3.215  
   3.216 -translations
   3.217 -"G\<turnstile>membr in C dyn_accessible_from accC"  
   3.218 - \<rightleftharpoons> "(membr,C) \<in> dyn_accessible_fromR G accC"
   3.219 +| Immediate:  "\<lbrakk>G\<turnstile>membr member_in class;
   3.220 +                G\<turnstile>membr in class permits_acc_from accclass 
   3.221 +               \<rbrakk> \<Longrightarrow> G\<turnstile>membr in class dyn_accessible_from accclass"
   3.222  
   3.223 -syntax 
   3.224 -method_dyn_accessible_from:: 
   3.225 - "prog \<Rightarrow> (qtname \<times> mdecl) \<Rightarrow> qtname \<Rightarrow> qtname \<Rightarrow> bool"
   3.226 -                 ("_ \<turnstile>Method _ in _ dyn'_accessible'_from _" [61,61,61,61] 60)
   3.227 -
   3.228 -translations
   3.229 -"G\<turnstile>Method m in C dyn_accessible_from accC"  
   3.230 - \<rightleftharpoons> "G\<turnstile>methdMembr m in C dyn_accessible_from accC"  
   3.231 +| Overriding: "\<lbrakk>G\<turnstile>membr member_in class;
   3.232 +                membr=(C,mdecl new);
   3.233 +                G\<turnstile>(C,new) overrides old; 
   3.234 +                G\<turnstile>class \<prec>\<^sub>C sup;
   3.235 +                G\<turnstile>Method old in sup dyn_accessible_from accclass
   3.236 +               \<rbrakk>\<Longrightarrow> G\<turnstile>membr in class dyn_accessible_from accclass"
   3.237  
   3.238  syntax 
   3.239  methd_dyn_accessible_from:: 
   3.240 @@ -891,18 +869,6 @@
   3.241  translations
   3.242  "G\<turnstile>Field fn f in dynC dyn_accessible_from accC"  
   3.243   \<rightleftharpoons> "G\<turnstile>(fieldm fn f) in dynC dyn_accessible_from accC"
   3.244 -  
   3.245 -inductive "dyn_accessible_fromR G accclass" intros
   3.246 -Immediate:  "\<lbrakk>G\<turnstile>membr member_in class;
   3.247 -              G\<turnstile>membr in class permits_acc_from accclass 
   3.248 -             \<rbrakk> \<Longrightarrow> G\<turnstile>membr in class dyn_accessible_from accclass"
   3.249 -
   3.250 -Overriding: "\<lbrakk>G\<turnstile>membr member_in class;
   3.251 -              membr=(C,mdecl new);
   3.252 -              G\<turnstile>(C,new) overrides old; 
   3.253 -              G\<turnstile>class \<prec>\<^sub>C sup;
   3.254 -              G\<turnstile>Method old in sup dyn_accessible_from accclass
   3.255 -             \<rbrakk>\<Longrightarrow> G\<turnstile>membr in class dyn_accessible_from accclass"
   3.256  
   3.257  
   3.258  lemma accessible_from_commonD: "G\<turnstile>m of C accessible_from S
   3.259 @@ -967,13 +933,13 @@
   3.260    from n m eqid  
   3.261    show "n=m"
   3.262    proof (induct)
   3.263 -    case (Immediate C n)
   3.264 +    case (Immediate n C)
   3.265      assume member_n: "G\<turnstile> mbr n declared_in C" "declclass n = C"
   3.266      assume eqid: "memberid n = memberid m"
   3.267      assume "G \<turnstile> m member_of C"
   3.268      then show "n=m"
   3.269      proof (cases)
   3.270 -      case (Immediate _ m')
   3.271 +      case (Immediate m' _)
   3.272        with eqid 
   3.273        have "m=m'"
   3.274             "memberid n = memberid m" 
   3.275 @@ -987,7 +953,7 @@
   3.276                             cdeclaredmethd_def cdeclaredfield_def
   3.277                      split: memberdecl.splits)
   3.278      next
   3.279 -      case (Inherited _ _ m')
   3.280 +      case (Inherited m' _ _)
   3.281        then have "G\<turnstile> memberid m undeclared_in C"
   3.282  	by simp
   3.283        with eqid member_n
   3.284 @@ -995,7 +961,7 @@
   3.285  	by (cases n) (auto dest: declared_not_undeclared)
   3.286      qed
   3.287    next
   3.288 -    case (Inherited C S n)
   3.289 +    case (Inherited n C S)
   3.290      assume undecl: "G\<turnstile> memberid n undeclared_in C"
   3.291      assume  super: "G\<turnstile>C\<prec>\<^sub>C\<^sub>1S"
   3.292      assume    hyp: "\<lbrakk>G \<turnstile> m member_of S; memberid n = memberid m\<rbrakk> \<Longrightarrow> n = m"
   3.293 @@ -1021,13 +987,13 @@
   3.294  
   3.295  lemma member_of_is_classD: "G\<turnstile>m member_of C \<Longrightarrow> is_class G C"
   3.296  proof (induct set: members)
   3.297 -  case (Immediate C m)
   3.298 +  case (Immediate m C)
   3.299    assume "G\<turnstile> mbr m declared_in C"
   3.300    then show "is_class G C"
   3.301      by (cases "mbr m")
   3.302         (auto simp add: declared_in_def cdeclaredmethd_def cdeclaredfield_def)
   3.303  next
   3.304 -  case (Inherited C S m)  
   3.305 +  case (Inherited m C S)  
   3.306    assume "G\<turnstile>C\<prec>\<^sub>C\<^sub>1S" and "is_class G S"
   3.307    then show "is_class G C"
   3.308      by - (rule subcls_is_class2,auto)
   3.309 @@ -1046,10 +1012,10 @@
   3.310  lemma member_of_class_relation:
   3.311    "G\<turnstile>m member_of C \<Longrightarrow> G\<turnstile>C \<preceq>\<^sub>C declclass m"
   3.312  proof (induct set: members)
   3.313 -  case (Immediate C m)
   3.314 +  case (Immediate m C)
   3.315    then show "G\<turnstile>C \<preceq>\<^sub>C declclass m" by simp
   3.316  next
   3.317 -  case (Inherited C S m)
   3.318 +  case (Inherited m C S)
   3.319    then show "G\<turnstile>C \<preceq>\<^sub>C declclass m" 
   3.320      by (auto dest: r_into_rtrancl intro: rtrancl_trans)
   3.321  qed
   3.322 @@ -1152,12 +1118,12 @@
   3.323    from acc_C static
   3.324    show "G\<turnstile>m in (declclass m) dyn_accessible_from accC"
   3.325    proof (induct)
   3.326 -    case (Immediate C m)
   3.327 +    case (Immediate m C)
   3.328      then show ?case 
   3.329        by (auto intro!: dyn_accessible_fromR.Immediate
   3.330                   dest: member_in_declC permits_acc_static_declC) 
   3.331    next 
   3.332 -    case (Overriding declCNew C m new old sup)
   3.333 +    case (Overriding m C declCNew new old sup)
   3.334      then have "\<not> is_static m"
   3.335        by (auto dest: overrides_commonD)
   3.336      moreover
   3.337 @@ -1259,7 +1225,7 @@
   3.338    from m subclseq_D_C subclseq_C_m
   3.339    show ?thesis
   3.340    proof (induct)
   3.341 -    case (Immediate D m)
   3.342 +    case (Immediate m D)
   3.343      assume "declclass m = D" and
   3.344             "G\<turnstile>D\<preceq>\<^sub>C C" and "G\<turnstile>C\<preceq>\<^sub>C declclass m"
   3.345      with ws have "D=C" 
   3.346 @@ -1268,7 +1234,7 @@
   3.347      show "G\<turnstile>m member_of C"
   3.348        by (auto intro: members.Immediate)
   3.349    next
   3.350 -    case (Inherited D S m)
   3.351 +    case (Inherited m D S)
   3.352      assume member_of_D_props: 
   3.353              "G \<turnstile> m inheritable_in pid D" 
   3.354              "G\<turnstile> memberid m undeclared_in D"  
   3.355 @@ -1714,7 +1680,7 @@
   3.356      from member_of
   3.357      show "?Methd C"
   3.358      proof (cases)
   3.359 -      case (Immediate Ca membr)
   3.360 +      case (Immediate membr Ca)
   3.361        then have "Ca=C" "membr = method sig m" and 
   3.362                  "G\<turnstile>Methd sig m declared_in C" "declclass m = C"
   3.363  	by (cases m,auto)
   3.364 @@ -1727,7 +1693,7 @@
   3.365        show ?thesis
   3.366  	by (simp add: methd_rec)
   3.367      next
   3.368 -      case (Inherited Ca S membr)
   3.369 +      case (Inherited membr Ca S)
   3.370        with clsC
   3.371        have eq_Ca_C: "Ca=C" and
   3.372              undecl: "G\<turnstile>mid sig undeclared_in C" and
     4.1 --- a/src/HOL/Bali/DefiniteAssignment.thy	Mon Dec 11 12:28:16 2006 +0100
     4.2 +++ b/src/HOL/Bali/DefiniteAssignment.thy	Mon Dec 11 16:06:14 2006 +0100
     4.3 @@ -513,25 +513,6 @@
     4.4           brk :: "breakass" --{* Definetly assigned variables for 
     4.5                                  abrupt completion with a break *}
     4.6  
     4.7 -consts da :: "(env \<times> lname set \<times> term \<times> assigned) set"  
     4.8 -text {* The environment @{term env} is only needed for the 
     4.9 -        conditional @{text "_ ? _ : _"}.
    4.10 -        The definite assignment rules refer to the typing rules here to
    4.11 -        distinguish boolean and other expressions.
    4.12 -      *}
    4.13 -
    4.14 -syntax
    4.15 -da :: "env \<Rightarrow> lname set \<Rightarrow> term \<Rightarrow> assigned \<Rightarrow> bool" 
    4.16 -                           ("_\<turnstile> _ \<guillemotright>_\<guillemotright> _" [65,65,65,65] 71)
    4.17 -
    4.18 -translations 
    4.19 -  "E\<turnstile> B \<guillemotright>t\<guillemotright> A" == "(E,B,t,A) \<in> da"
    4.20 -
    4.21 -text {* @{text B}: the ''assigned'' variables before evaluating term @{text t};
    4.22 -        @{text A}: the ''assigned'' variables after evaluating term @{text t}
    4.23 -*}
    4.24 -
    4.25 -
    4.26  constdefs rmlab :: "'a \<Rightarrow> ('a,'b) tables \<Rightarrow> ('a,'b) tables"
    4.27  "rmlab k A \<equiv> \<lambda> x. if x=k then UNIV else A x"
    4.28   
    4.29 @@ -543,35 +524,45 @@
    4.30  constdefs range_inter_ts :: "('a,'b) tables \<Rightarrow> 'b set" ("\<Rightarrow>\<Inter>_" 80)
    4.31   "\<Rightarrow>\<Inter>A \<equiv> {x |x. \<forall> k. x \<in> A k}"
    4.32  
    4.33 -inductive "da" intros
    4.34 -
    4.35 - Skip: "Env\<turnstile> B \<guillemotright>\<langle>Skip\<rangle>\<guillemotright> \<lparr>nrm=B,brk=\<lambda> l. UNIV\<rparr>"
    4.36 +text {*
    4.37 +In @{text "E\<turnstile> B \<guillemotright>t\<guillemotright> A"},
    4.38 +@{text B} denotes the ''assigned'' variables before evaluating term @{text t},
    4.39 +whereas @{text A} denotes the ''assigned'' variables after evaluating term @{text t}.
    4.40 +The environment @{term E} is only needed for the conditional @{text "_ ? _ : _"}.
    4.41 +The definite assignment rules refer to the typing rules here to
    4.42 +distinguish boolean and other expressions.
    4.43 +*}
    4.44  
    4.45 - Expr: "Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> A 
    4.46 -        \<Longrightarrow>  
    4.47 -        Env\<turnstile> B \<guillemotright>\<langle>Expr e\<rangle>\<guillemotright> A"
    4.48 - Lab:  "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>c\<rangle>\<guillemotright> C; nrm A = nrm C \<inter> (brk C) l; brk A = rmlab l (brk C)\<rbrakk>
    4.49 -        \<Longrightarrow> 
    4.50 -        Env\<turnstile> B \<guillemotright>\<langle>Break l\<bullet> c\<rangle>\<guillemotright> A" 
    4.51 +inductive2
    4.52 +  da :: "env \<Rightarrow> lname set \<Rightarrow> term \<Rightarrow> assigned \<Rightarrow> bool" ("_\<turnstile> _ \<guillemotright>_\<guillemotright> _" [65,65,65,65] 71)
    4.53 +where
    4.54 +  Skip: "Env\<turnstile> B \<guillemotright>\<langle>Skip\<rangle>\<guillemotright> \<lparr>nrm=B,brk=\<lambda> l. UNIV\<rparr>"
    4.55  
    4.56 - Comp: "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>c1\<rangle>\<guillemotright> C1; Env\<turnstile> nrm C1 \<guillemotright>\<langle>c2\<rangle>\<guillemotright> C2; 
    4.57 -        nrm A = nrm C2; brk A = (brk C1) \<Rightarrow>\<inter> (brk C2)\<rbrakk> 
    4.58 -        \<Longrightarrow>  
    4.59 -        Env\<turnstile> B \<guillemotright>\<langle>c1;; c2\<rangle>\<guillemotright> A"
    4.60 +| Expr: "Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> A 
    4.61 +         \<Longrightarrow>  
    4.62 +         Env\<turnstile> B \<guillemotright>\<langle>Expr e\<rangle>\<guillemotright> A"
    4.63 +| Lab:  "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>c\<rangle>\<guillemotright> C; nrm A = nrm C \<inter> (brk C) l; brk A = rmlab l (brk C)\<rbrakk>
    4.64 +         \<Longrightarrow> 
    4.65 +         Env\<turnstile> B \<guillemotright>\<langle>Break l\<bullet> c\<rangle>\<guillemotright> A" 
    4.66  
    4.67 - If:   "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> E;
    4.68 -         Env\<turnstile> (B \<union> assigns_if True  e) \<guillemotright>\<langle>c1\<rangle>\<guillemotright> C1;
    4.69 -         Env\<turnstile> (B \<union> assigns_if False e) \<guillemotright>\<langle>c2\<rangle>\<guillemotright> C2;
    4.70 -         nrm A = nrm C1 \<inter> nrm C2;
    4.71 -         brk A = brk C1 \<Rightarrow>\<inter> brk C2 \<rbrakk>  
    4.72 -         \<Longrightarrow>
    4.73 -         Env\<turnstile> B \<guillemotright>\<langle>If(e) c1 Else c2\<rangle>\<guillemotright> A"
    4.74 +| Comp: "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>c1\<rangle>\<guillemotright> C1; Env\<turnstile> nrm C1 \<guillemotright>\<langle>c2\<rangle>\<guillemotright> C2; 
    4.75 +         nrm A = nrm C2; brk A = (brk C1) \<Rightarrow>\<inter> (brk C2)\<rbrakk> 
    4.76 +         \<Longrightarrow>  
    4.77 +         Env\<turnstile> B \<guillemotright>\<langle>c1;; c2\<rangle>\<guillemotright> A"
    4.78 +
    4.79 +| If:   "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> E;
    4.80 +          Env\<turnstile> (B \<union> assigns_if True  e) \<guillemotright>\<langle>c1\<rangle>\<guillemotright> C1;
    4.81 +          Env\<turnstile> (B \<union> assigns_if False e) \<guillemotright>\<langle>c2\<rangle>\<guillemotright> C2;
    4.82 +          nrm A = nrm C1 \<inter> nrm C2;
    4.83 +          brk A = brk C1 \<Rightarrow>\<inter> brk C2 \<rbrakk>  
    4.84 +          \<Longrightarrow>
    4.85 +          Env\<turnstile> B \<guillemotright>\<langle>If(e) c1 Else c2\<rangle>\<guillemotright> A"
    4.86  
    4.87  --{* Note that @{term E} is not further used, because we take the specialized
    4.88       sets that also consider if the expression evaluates to true or false. 
    4.89       Inside of @{term e} there is no {\tt break} or {\tt finally}, so the break
    4.90       map of @{term E} will be the trivial one. So 
    4.91 -     @{term "Env\<turnstile>B \<guillemotright>\<langle>e\<rangle>\<guillemotright> E"} is just used to enshure the definite assignment in
    4.92 +     @{term "Env\<turnstile>B \<guillemotright>\<langle>e\<rangle>\<guillemotright> E"} is just used to ensure the definite assignment in
    4.93       expression @{term e}.
    4.94       Notice the implicit analysis of a constant boolean expression @{term e}
    4.95       in this rule. For example, if @{term e} is constantly @{term True} then 
    4.96 @@ -585,12 +576,12 @@
    4.97       contribution.
    4.98    *}
    4.99  
   4.100 - Loop: "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> E; 
   4.101 -         Env\<turnstile> (B \<union> assigns_if True e) \<guillemotright>\<langle>c\<rangle>\<guillemotright> C;
   4.102 -         nrm A = nrm C \<inter> (B \<union> assigns_if False e);
   4.103 -         brk A = brk C\<rbrakk>  
   4.104 -         \<Longrightarrow>
   4.105 -         Env\<turnstile> B \<guillemotright>\<langle>l\<bullet> While(e) c\<rangle>\<guillemotright> A"
   4.106 +| Loop: "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> E; 
   4.107 +          Env\<turnstile> (B \<union> assigns_if True e) \<guillemotright>\<langle>c\<rangle>\<guillemotright> C;
   4.108 +          nrm A = nrm C \<inter> (B \<union> assigns_if False e);
   4.109 +          brk A = brk C\<rbrakk>  
   4.110 +          \<Longrightarrow>
   4.111 +          Env\<turnstile> B \<guillemotright>\<langle>l\<bullet> While(e) c\<rangle>\<guillemotright> A"
   4.112  --{* The @{text Loop} rule resembles some of the ideas of the @{text If} rule.
   4.113       For the @{term "nrm A"} the set @{term "B \<union> assigns_if False e"} 
   4.114       will be @{term UNIV} if the condition is constantly true. To normally exit
   4.115 @@ -602,14 +593,14 @@
   4.116       handle the breaks specially. 
   4.117    *}
   4.118  
   4.119 - Jmp: "\<lbrakk>jump=Ret \<longrightarrow> Result \<in> B;
   4.120 -        nrm A = UNIV;
   4.121 -        brk A = (case jump of
   4.122 -                   Break l \<Rightarrow> \<lambda> k. if k=l then B else UNIV     
   4.123 -                 | Cont l  \<Rightarrow> \<lambda> k. UNIV
   4.124 -                 | Ret     \<Rightarrow> \<lambda> k. UNIV)\<rbrakk> 
   4.125 -       \<Longrightarrow> 
   4.126 -       Env\<turnstile> B \<guillemotright>\<langle>Jmp jump\<rangle>\<guillemotright> A"
   4.127 +| Jmp: "\<lbrakk>jump=Ret \<longrightarrow> Result \<in> B;
   4.128 +         nrm A = UNIV;
   4.129 +         brk A = (case jump of
   4.130 +                    Break l \<Rightarrow> \<lambda> k. if k=l then B else UNIV     
   4.131 +                  | Cont l  \<Rightarrow> \<lambda> k. UNIV
   4.132 +                  | Ret     \<Rightarrow> \<lambda> k. UNIV)\<rbrakk> 
   4.133 +        \<Longrightarrow> 
   4.134 +        Env\<turnstile> B \<guillemotright>\<langle>Jmp jump\<rangle>\<guillemotright> A"
   4.135  --{* In case of a break to label @{term l} the corresponding break set is all
   4.136       variables assigned before the break. The assigned variables for normal
   4.137       completion of the @{term Jmp} is @{term UNIV}, because the statement will
   4.138 @@ -618,21 +609,21 @@
   4.139       assigned.
   4.140    *}
   4.141  
   4.142 - Throw: "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> E; nrm A = UNIV; brk A = (\<lambda> l. UNIV)\<rbrakk> 
   4.143 -        \<Longrightarrow> Env\<turnstile> B \<guillemotright>\<langle>Throw e\<rangle>\<guillemotright> A"
   4.144 +| Throw: "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> E; nrm A = UNIV; brk A = (\<lambda> l. UNIV)\<rbrakk> 
   4.145 +         \<Longrightarrow> Env\<turnstile> B \<guillemotright>\<langle>Throw e\<rangle>\<guillemotright> A"
   4.146  
   4.147 - Try:  "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>c1\<rangle>\<guillemotright> C1; 
   4.148 -         Env\<lparr>lcl := lcl Env(VName vn\<mapsto>Class C)\<rparr>\<turnstile> (B \<union> {VName vn}) \<guillemotright>\<langle>c2\<rangle>\<guillemotright> C2;  
   4.149 -         nrm A = nrm C1 \<inter> nrm C2;
   4.150 -         brk A = brk C1 \<Rightarrow>\<inter> brk C2\<rbrakk> 
   4.151 -        \<Longrightarrow> Env\<turnstile> B \<guillemotright>\<langle>Try c1 Catch(C vn) c2\<rangle>\<guillemotright> A"
   4.152 +| Try:  "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>c1\<rangle>\<guillemotright> C1; 
   4.153 +          Env\<lparr>lcl := lcl Env(VName vn\<mapsto>Class C)\<rparr>\<turnstile> (B \<union> {VName vn}) \<guillemotright>\<langle>c2\<rangle>\<guillemotright> C2;  
   4.154 +          nrm A = nrm C1 \<inter> nrm C2;
   4.155 +          brk A = brk C1 \<Rightarrow>\<inter> brk C2\<rbrakk> 
   4.156 +         \<Longrightarrow> Env\<turnstile> B \<guillemotright>\<langle>Try c1 Catch(C vn) c2\<rangle>\<guillemotright> A"
   4.157  
   4.158 - Fin:  "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>c1\<rangle>\<guillemotright> C1;
   4.159 -         Env\<turnstile> B \<guillemotright>\<langle>c2\<rangle>\<guillemotright> C2;
   4.160 -         nrm A = nrm C1 \<union> nrm C2;
   4.161 -         brk A = ((brk C1) \<Rightarrow>\<union>\<^sub>\<forall> (nrm C2)) \<Rightarrow>\<inter> (brk C2)\<rbrakk>  
   4.162 -         \<Longrightarrow>
   4.163 -         Env\<turnstile> B \<guillemotright>\<langle>c1 Finally c2\<rangle>\<guillemotright> A" 
   4.164 +| Fin:  "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>c1\<rangle>\<guillemotright> C1;
   4.165 +          Env\<turnstile> B \<guillemotright>\<langle>c2\<rangle>\<guillemotright> C2;
   4.166 +          nrm A = nrm C1 \<union> nrm C2;
   4.167 +          brk A = ((brk C1) \<Rightarrow>\<union>\<^sub>\<forall> (nrm C2)) \<Rightarrow>\<inter> (brk C2)\<rbrakk>  
   4.168 +          \<Longrightarrow>
   4.169 +          Env\<turnstile> B \<guillemotright>\<langle>c1 Finally c2\<rangle>\<guillemotright> A" 
   4.170  --{* The set of assigned variables before execution @{term c2} are the same
   4.171       as before execution @{term c1}, because @{term c1} could throw an exception
   4.172       and so we can't guarantee that any variable will be assigned in @{term c1}.
   4.173 @@ -671,7 +662,7 @@
   4.174       and @{text NewA}
   4.175  *}
   4.176  
   4.177 - Init: "Env\<turnstile> B \<guillemotright>\<langle>Init C\<rangle>\<guillemotright> \<lparr>nrm=B,brk=\<lambda> l. UNIV\<rparr>"
   4.178 +| Init: "Env\<turnstile> B \<guillemotright>\<langle>Init C\<rangle>\<guillemotright> \<lparr>nrm=B,brk=\<lambda> l. UNIV\<rparr>"
   4.179  --{* Wellformedness of a program will ensure, that every static initialiser 
   4.180       is definetly assigned and the jumps are nested correctly. The case here
   4.181       for @{term Init} is just for convenience, to get a proper precondition 
   4.182 @@ -679,91 +670,91 @@
   4.183       expand the initialisation on every point where it is triggerred by the
   4.184       evaluation rules.
   4.185    *}   
   4.186 - NewC: "Env\<turnstile> B \<guillemotright>\<langle>NewC C\<rangle>\<guillemotright> \<lparr>nrm=B,brk=\<lambda> l. UNIV\<rparr>" 
   4.187 +| NewC: "Env\<turnstile> B \<guillemotright>\<langle>NewC C\<rangle>\<guillemotright> \<lparr>nrm=B,brk=\<lambda> l. UNIV\<rparr>" 
   4.188 +
   4.189 +| NewA: "Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> A 
   4.190 +         \<Longrightarrow>
   4.191 +         Env\<turnstile> B \<guillemotright>\<langle>New T[e]\<rangle>\<guillemotright> A"
   4.192  
   4.193 - NewA: "Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> A 
   4.194 -        \<Longrightarrow>
   4.195 -        Env\<turnstile> B \<guillemotright>\<langle>New T[e]\<rangle>\<guillemotright> A"
   4.196 +| Cast: "Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> A
   4.197 +         \<Longrightarrow>
   4.198 +         Env\<turnstile> B \<guillemotright>\<langle>Cast T e\<rangle>\<guillemotright> A"
   4.199  
   4.200 - Cast: "Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> A
   4.201 -        \<Longrightarrow>
   4.202 -        Env\<turnstile> B \<guillemotright>\<langle>Cast T e\<rangle>\<guillemotright> A"
   4.203 +| Inst: "Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> A 
   4.204 +         \<Longrightarrow> 
   4.205 +         Env\<turnstile> B \<guillemotright>\<langle>e InstOf T\<rangle>\<guillemotright> A"
   4.206  
   4.207 - Inst: "Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> A 
   4.208 -        \<Longrightarrow> 
   4.209 -        Env\<turnstile> B \<guillemotright>\<langle>e InstOf T\<rangle>\<guillemotright> A"
   4.210 +| Lit:  "Env\<turnstile> B \<guillemotright>\<langle>Lit v\<rangle>\<guillemotright> \<lparr>nrm=B,brk=\<lambda> l. UNIV\<rparr>"
   4.211  
   4.212 - Lit:  "Env\<turnstile> B \<guillemotright>\<langle>Lit v\<rangle>\<guillemotright> \<lparr>nrm=B,brk=\<lambda> l. UNIV\<rparr>"
   4.213 +| UnOp: "Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> A
   4.214 +         \<Longrightarrow> 
   4.215 +         Env\<turnstile> B \<guillemotright>\<langle>UnOp unop e\<rangle>\<guillemotright> A"
   4.216  
   4.217 - UnOp: "Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> A
   4.218 -        \<Longrightarrow> 
   4.219 -        Env\<turnstile> B \<guillemotright>\<langle>UnOp unop e\<rangle>\<guillemotright> A"
   4.220 +| CondAnd: "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>e1\<rangle>\<guillemotright> E1; Env\<turnstile> (B \<union> assigns_if True e1) \<guillemotright>\<langle>e2\<rangle>\<guillemotright> E2; 
   4.221 +             nrm A = B \<union> (assigns_if True (BinOp CondAnd e1 e2) \<inter> 
   4.222 +                             assigns_if False (BinOp CondAnd e1 e2));
   4.223 +             brk A = (\<lambda> l. UNIV) \<rbrakk>
   4.224 +            \<Longrightarrow>
   4.225 +            Env\<turnstile> B \<guillemotright>\<langle>BinOp CondAnd e1 e2\<rangle>\<guillemotright> A"
   4.226  
   4.227 - CondAnd: "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>e1\<rangle>\<guillemotright> E1; Env\<turnstile> (B \<union> assigns_if True e1) \<guillemotright>\<langle>e2\<rangle>\<guillemotright> E2; 
   4.228 -            nrm A = B \<union> (assigns_if True (BinOp CondAnd e1 e2) \<inter> 
   4.229 -                            assigns_if False (BinOp CondAnd e1 e2));
   4.230 +| CondOr: "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>e1\<rangle>\<guillemotright> E1; Env\<turnstile> (B \<union> assigns_if False e1) \<guillemotright>\<langle>e2\<rangle>\<guillemotright> E2; 
   4.231 +            nrm A = B \<union> (assigns_if True (BinOp CondOr e1 e2) \<inter> 
   4.232 +                              assigns_if False (BinOp CondOr e1 e2));
   4.233              brk A = (\<lambda> l. UNIV) \<rbrakk>
   4.234 -           \<Longrightarrow>
   4.235 -           Env\<turnstile> B \<guillemotright>\<langle>BinOp CondAnd e1 e2\<rangle>\<guillemotright> A"
   4.236 +            \<Longrightarrow>
   4.237 +            Env\<turnstile> B \<guillemotright>\<langle>BinOp CondOr e1 e2\<rangle>\<guillemotright> A"
   4.238  
   4.239 - CondOr: "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>e1\<rangle>\<guillemotright> E1; Env\<turnstile> (B \<union> assigns_if False e1) \<guillemotright>\<langle>e2\<rangle>\<guillemotright> E2; 
   4.240 -           nrm A = B \<union> (assigns_if True (BinOp CondOr e1 e2) \<inter> 
   4.241 -                             assigns_if False (BinOp CondOr e1 e2));
   4.242 -           brk A = (\<lambda> l. UNIV) \<rbrakk>
   4.243 -           \<Longrightarrow>
   4.244 -           Env\<turnstile> B \<guillemotright>\<langle>BinOp CondOr e1 e2\<rangle>\<guillemotright> A"
   4.245 +| BinOp: "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>e1\<rangle>\<guillemotright> E1; Env\<turnstile> nrm E1 \<guillemotright>\<langle>e2\<rangle>\<guillemotright> A; 
   4.246 +           binop \<noteq> CondAnd; binop \<noteq> CondOr\<rbrakk>
   4.247 +          \<Longrightarrow>
   4.248 +          Env\<turnstile> B \<guillemotright>\<langle>BinOp binop e1 e2\<rangle>\<guillemotright> A"
   4.249  
   4.250 - BinOp: "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>e1\<rangle>\<guillemotright> E1; Env\<turnstile> nrm E1 \<guillemotright>\<langle>e2\<rangle>\<guillemotright> A; 
   4.251 -          binop \<noteq> CondAnd; binop \<noteq> CondOr\<rbrakk>
   4.252 -         \<Longrightarrow>
   4.253 -         Env\<turnstile> B \<guillemotright>\<langle>BinOp binop e1 e2\<rangle>\<guillemotright> A"
   4.254 +| Super: "This \<in> B 
   4.255 +          \<Longrightarrow> 
   4.256 +          Env\<turnstile> B \<guillemotright>\<langle>Super\<rangle>\<guillemotright> \<lparr>nrm=B,brk=\<lambda> l. UNIV\<rparr>"
   4.257  
   4.258 - Super: "This \<in> B 
   4.259 -         \<Longrightarrow> 
   4.260 -         Env\<turnstile> B \<guillemotright>\<langle>Super\<rangle>\<guillemotright> \<lparr>nrm=B,brk=\<lambda> l. UNIV\<rparr>"
   4.261 -
   4.262 - AccLVar: "\<lbrakk>vn \<in> B;
   4.263 -            nrm A = B; brk A = (\<lambda> k. UNIV)\<rbrakk> 
   4.264 -            \<Longrightarrow> 
   4.265 -            Env\<turnstile> B \<guillemotright>\<langle>Acc (LVar vn)\<rangle>\<guillemotright> A"
   4.266 +| AccLVar: "\<lbrakk>vn \<in> B;
   4.267 +             nrm A = B; brk A = (\<lambda> k. UNIV)\<rbrakk> 
   4.268 +             \<Longrightarrow> 
   4.269 +             Env\<turnstile> B \<guillemotright>\<langle>Acc (LVar vn)\<rangle>\<guillemotright> A"
   4.270  --{* To properly access a local variable we have to test the definite 
   4.271       assignment here. The variable must occur in the set @{term B} 
   4.272    *}
   4.273  
   4.274 - Acc: "\<lbrakk>\<forall> vn. v \<noteq> LVar vn;
   4.275 -        Env\<turnstile> B \<guillemotright>\<langle>v\<rangle>\<guillemotright> A\<rbrakk>
   4.276 -        \<Longrightarrow>
   4.277 -        Env\<turnstile> B \<guillemotright>\<langle>Acc v\<rangle>\<guillemotright> A"
   4.278 +| Acc: "\<lbrakk>\<forall> vn. v \<noteq> LVar vn;
   4.279 +         Env\<turnstile> B \<guillemotright>\<langle>v\<rangle>\<guillemotright> A\<rbrakk>
   4.280 +         \<Longrightarrow>
   4.281 +         Env\<turnstile> B \<guillemotright>\<langle>Acc v\<rangle>\<guillemotright> A"
   4.282  
   4.283 - AssLVar: "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> E; nrm A = nrm E \<union> {vn}; brk A = brk E\<rbrakk> 
   4.284 -           \<Longrightarrow> 
   4.285 -           Env\<turnstile> B \<guillemotright>\<langle>(LVar vn) := e\<rangle>\<guillemotright> A"
   4.286 +| AssLVar: "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> E; nrm A = nrm E \<union> {vn}; brk A = brk E\<rbrakk> 
   4.287 +            \<Longrightarrow> 
   4.288 +            Env\<turnstile> B \<guillemotright>\<langle>(LVar vn) := e\<rangle>\<guillemotright> A"
   4.289  
   4.290 - Ass: "\<lbrakk>\<forall> vn. v \<noteq> LVar vn; Env\<turnstile> B \<guillemotright>\<langle>v\<rangle>\<guillemotright> V; Env\<turnstile> nrm V \<guillemotright>\<langle>e\<rangle>\<guillemotright> A\<rbrakk>
   4.291 -        \<Longrightarrow>
   4.292 -        Env\<turnstile> B \<guillemotright>\<langle>v := e\<rangle>\<guillemotright> A"
   4.293 +| Ass: "\<lbrakk>\<forall> vn. v \<noteq> LVar vn; Env\<turnstile> B \<guillemotright>\<langle>v\<rangle>\<guillemotright> V; Env\<turnstile> nrm V \<guillemotright>\<langle>e\<rangle>\<guillemotright> A\<rbrakk>
   4.294 +         \<Longrightarrow>
   4.295 +         Env\<turnstile> B \<guillemotright>\<langle>v := e\<rangle>\<guillemotright> A"
   4.296  
   4.297 - CondBool: "\<lbrakk>Env\<turnstile>(c ? e1 : e2)\<Colon>-(PrimT Boolean);
   4.298 -             Env\<turnstile> B \<guillemotright>\<langle>c\<rangle>\<guillemotright> C;
   4.299 -             Env\<turnstile> (B \<union> assigns_if True  c) \<guillemotright>\<langle>e1\<rangle>\<guillemotright> E1;
   4.300 -             Env\<turnstile> (B \<union> assigns_if False c) \<guillemotright>\<langle>e2\<rangle>\<guillemotright> E2;
   4.301 -             nrm A = B \<union> (assigns_if True  (c ? e1 : e2) \<inter> 
   4.302 -                              assigns_if False (c ? e1 : e2));
   4.303 -             brk A = (\<lambda> l. UNIV)\<rbrakk>
   4.304 -             \<Longrightarrow> 
   4.305 -             Env\<turnstile> B \<guillemotright>\<langle>c ? e1 : e2\<rangle>\<guillemotright> A" 
   4.306 +| CondBool: "\<lbrakk>Env\<turnstile>(c ? e1 : e2)\<Colon>-(PrimT Boolean);
   4.307 +              Env\<turnstile> B \<guillemotright>\<langle>c\<rangle>\<guillemotright> C;
   4.308 +              Env\<turnstile> (B \<union> assigns_if True  c) \<guillemotright>\<langle>e1\<rangle>\<guillemotright> E1;
   4.309 +              Env\<turnstile> (B \<union> assigns_if False c) \<guillemotright>\<langle>e2\<rangle>\<guillemotright> E2;
   4.310 +              nrm A = B \<union> (assigns_if True  (c ? e1 : e2) \<inter> 
   4.311 +                               assigns_if False (c ? e1 : e2));
   4.312 +              brk A = (\<lambda> l. UNIV)\<rbrakk>
   4.313 +              \<Longrightarrow> 
   4.314 +              Env\<turnstile> B \<guillemotright>\<langle>c ? e1 : e2\<rangle>\<guillemotright> A" 
   4.315  
   4.316 - Cond: "\<lbrakk>\<not> Env\<turnstile>(c ? e1 : e2)\<Colon>-(PrimT Boolean);
   4.317 -         Env\<turnstile> B \<guillemotright>\<langle>c\<rangle>\<guillemotright> C;
   4.318 -         Env\<turnstile> (B \<union> assigns_if True  c) \<guillemotright>\<langle>e1\<rangle>\<guillemotright> E1;
   4.319 -         Env\<turnstile> (B \<union> assigns_if False c) \<guillemotright>\<langle>e2\<rangle>\<guillemotright> E2;
   4.320 -        nrm A = nrm E1 \<inter> nrm E2; brk A = (\<lambda> l. UNIV)\<rbrakk>
   4.321 -        \<Longrightarrow> 
   4.322 -        Env\<turnstile> B \<guillemotright>\<langle>c ? e1 : e2\<rangle>\<guillemotright> A" 
   4.323 +| Cond: "\<lbrakk>\<not> Env\<turnstile>(c ? e1 : e2)\<Colon>-(PrimT Boolean);
   4.324 +          Env\<turnstile> B \<guillemotright>\<langle>c\<rangle>\<guillemotright> C;
   4.325 +          Env\<turnstile> (B \<union> assigns_if True  c) \<guillemotright>\<langle>e1\<rangle>\<guillemotright> E1;
   4.326 +          Env\<turnstile> (B \<union> assigns_if False c) \<guillemotright>\<langle>e2\<rangle>\<guillemotright> E2;
   4.327 +          nrm A = nrm E1 \<inter> nrm E2; brk A = (\<lambda> l. UNIV)\<rbrakk>
   4.328 +          \<Longrightarrow> 
   4.329 +          Env\<turnstile> B \<guillemotright>\<langle>c ? e1 : e2\<rangle>\<guillemotright> A" 
   4.330  
   4.331 - Call: "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> E; Env\<turnstile> nrm E \<guillemotright>\<langle>args\<rangle>\<guillemotright> A\<rbrakk> 
   4.332 -        \<Longrightarrow>  
   4.333 -        Env\<turnstile> B \<guillemotright>\<langle>{accC,statT,mode}e\<cdot>mn({pTs}args)\<rangle>\<guillemotright> A"
   4.334 +| Call: "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> E; Env\<turnstile> nrm E \<guillemotright>\<langle>args\<rangle>\<guillemotright> A\<rbrakk> 
   4.335 +         \<Longrightarrow>  
   4.336 +         Env\<turnstile> B \<guillemotright>\<langle>{accC,statT,mode}e\<cdot>mn({pTs}args)\<rangle>\<guillemotright> A"
   4.337  
   4.338  -- {* The interplay of @{term Call}, @{term Methd} and @{term Body}:
   4.339        Why rules for @{term Methd} and @{term Body} at all? Note that a
   4.340 @@ -786,16 +777,16 @@
   4.341        also a precondition for type-safety and so we can omit some assertion 
   4.342        that are already ensured by well-typedness. 
   4.343     *}
   4.344 - Methd: "\<lbrakk>methd (prg Env) D sig = Some m;
   4.345 -          Env\<turnstile> B \<guillemotright>\<langle>Body (declclass m) (stmt (mbody (mthd m)))\<rangle>\<guillemotright> A
   4.346 -         \<rbrakk>
   4.347 +| Methd: "\<lbrakk>methd (prg Env) D sig = Some m;
   4.348 +           Env\<turnstile> B \<guillemotright>\<langle>Body (declclass m) (stmt (mbody (mthd m)))\<rangle>\<guillemotright> A
   4.349 +          \<rbrakk>
   4.350 +          \<Longrightarrow>
   4.351 +          Env\<turnstile> B \<guillemotright>\<langle>Methd D sig\<rangle>\<guillemotright> A" 
   4.352 +
   4.353 +| Body: "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>c\<rangle>\<guillemotright> C; jumpNestingOkS {Ret} c; Result \<in> nrm C;
   4.354 +          nrm A = B; brk A = (\<lambda> l. UNIV)\<rbrakk>
   4.355           \<Longrightarrow>
   4.356 -         Env\<turnstile> B \<guillemotright>\<langle>Methd D sig\<rangle>\<guillemotright> A" 
   4.357 -
   4.358 - Body: "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>c\<rangle>\<guillemotright> C; jumpNestingOkS {Ret} c; Result \<in> nrm C;
   4.359 -         nrm A = B; brk A = (\<lambda> l. UNIV)\<rbrakk>
   4.360 -        \<Longrightarrow>
   4.361 -        Env\<turnstile> B \<guillemotright>\<langle>Body D c\<rangle>\<guillemotright> A"
   4.362 +         Env\<turnstile> B \<guillemotright>\<langle>Body D c\<rangle>\<guillemotright> A"
   4.363  -- {* Note that @{term A} is not correlated to  @{term C}. If the body
   4.364        statement returns abruptly with return, evaluation of  @{term Body}
   4.365        will absorb this return and complete normally. So we cannot trivially
   4.366 @@ -809,21 +800,21 @@
   4.367        set and then this information must be carried over to the @{term Body}
   4.368        rule by the conformance predicate of the state.
   4.369     *}
   4.370 - LVar: "Env\<turnstile> B \<guillemotright>\<langle>LVar vn\<rangle>\<guillemotright> \<lparr>nrm=B, brk=\<lambda> l. UNIV\<rparr>" 
   4.371 +| LVar: "Env\<turnstile> B \<guillemotright>\<langle>LVar vn\<rangle>\<guillemotright> \<lparr>nrm=B, brk=\<lambda> l. UNIV\<rparr>" 
   4.372  
   4.373 - FVar: "Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> A 
   4.374 -        \<Longrightarrow> 
   4.375 -        Env\<turnstile> B \<guillemotright>\<langle>{accC,statDeclC,stat}e..fn\<rangle>\<guillemotright> A" 
   4.376 -
   4.377 - AVar: "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>e1\<rangle>\<guillemotright> E1; Env\<turnstile> nrm E1 \<guillemotright>\<langle>e2\<rangle>\<guillemotright> A\<rbrakk>
   4.378 +| FVar: "Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> A 
   4.379           \<Longrightarrow> 
   4.380 -         Env\<turnstile> B \<guillemotright>\<langle>e1.[e2]\<rangle>\<guillemotright> A" 
   4.381 +         Env\<turnstile> B \<guillemotright>\<langle>{accC,statDeclC,stat}e..fn\<rangle>\<guillemotright> A" 
   4.382  
   4.383 - Nil: "Env\<turnstile> B \<guillemotright>\<langle>[]::expr list\<rangle>\<guillemotright> \<lparr>nrm=B, brk=\<lambda> l. UNIV\<rparr>" 
   4.384 +| AVar: "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>e1\<rangle>\<guillemotright> E1; Env\<turnstile> nrm E1 \<guillemotright>\<langle>e2\<rangle>\<guillemotright> A\<rbrakk>
   4.385 +          \<Longrightarrow> 
   4.386 +          Env\<turnstile> B \<guillemotright>\<langle>e1.[e2]\<rangle>\<guillemotright> A" 
   4.387  
   4.388 - Cons: "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>e::expr\<rangle>\<guillemotright> E; Env\<turnstile> nrm E \<guillemotright>\<langle>es\<rangle>\<guillemotright> A\<rbrakk>
   4.389 -        \<Longrightarrow> 
   4.390 -        Env\<turnstile> B \<guillemotright>\<langle>e#es\<rangle>\<guillemotright> A" 
   4.391 +| Nil: "Env\<turnstile> B \<guillemotright>\<langle>[]::expr list\<rangle>\<guillemotright> \<lparr>nrm=B, brk=\<lambda> l. UNIV\<rparr>" 
   4.392 +
   4.393 +| Cons: "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>e::expr\<rangle>\<guillemotright> E; Env\<turnstile> nrm E \<guillemotright>\<langle>es\<rangle>\<guillemotright> A\<rbrakk>
   4.394 +         \<Longrightarrow> 
   4.395 +         Env\<turnstile> B \<guillemotright>\<langle>e#es\<rangle>\<guillemotright> A" 
   4.396  
   4.397  
   4.398  declare inj_term_sym_simps [simp]
   4.399 @@ -832,7 +823,7 @@
   4.400  ML_setup {*
   4.401  change_simpset (fn ss => ss delloop "split_all_tac");
   4.402  *}
   4.403 -inductive_cases da_elim_cases [cases set]:
   4.404 +inductive_cases2 da_elim_cases [cases set]:
   4.405    "Env\<turnstile> B \<guillemotright>\<langle>Skip\<rangle>\<guillemotright> A" 
   4.406    "Env\<turnstile> B \<guillemotright>In1r Skip\<guillemotright> A" 
   4.407    "Env\<turnstile> B \<guillemotright>\<langle>Expr e\<rangle>\<guillemotright> A"
   4.408 @@ -1076,7 +1067,7 @@
   4.409      from Expr.prems Expr.hyps 
   4.410      show ?case by cases simp
   4.411    next
   4.412 -    case (Lab A B C Env c l B' A')
   4.413 +    case (Lab Env B c C A l B' A')
   4.414      have A: "nrm A = nrm C \<inter> brk C l" "brk A = rmlab l (brk C)" .
   4.415      have "PROP ?Hyp Env B \<langle>c\<rangle> C" .
   4.416      moreover
   4.417 @@ -1102,7 +1093,7 @@
   4.418      ultimately show ?case
   4.419        by simp
   4.420    next
   4.421 -    case (Comp A B C1 C2 Env c1 c2 B' A')
   4.422 +    case (Comp Env B c1 C1 c2 C2 A B' A')
   4.423      have A: "nrm A = nrm C2" "brk A = brk C1 \<Rightarrow>\<inter>  brk C2" .
   4.424      have "Env\<turnstile> B' \<guillemotright>\<langle>c1;; c2\<rangle>\<guillemotright> A'" .
   4.425      then obtain  C1' C2'
   4.426 @@ -1123,7 +1114,7 @@
   4.427      show ?case
   4.428        by auto
   4.429    next
   4.430 -    case (If A B C1 C2 E Env c1 c2 e B' A')
   4.431 +    case (If Env B e E c1 C1 c2 C2 A B' A')
   4.432      have A: "nrm A = nrm C1 \<inter> nrm C2" "brk A = brk C1 \<Rightarrow>\<inter>  brk C2" .
   4.433      have "Env\<turnstile> B' \<guillemotright>\<langle>If(e) c1 Else c2\<rangle>\<guillemotright> A'" .
   4.434      then obtain C1' C2'
   4.435 @@ -1144,7 +1135,7 @@
   4.436      show ?case
   4.437        by auto
   4.438    next
   4.439 -    case (Loop A B C E Env c e l B' A')
   4.440 +    case (Loop Env B e E c C A l B' A')
   4.441      have A: "nrm A = nrm C \<inter> (B \<union> assigns_if False e)"
   4.442              "brk A = brk C" .
   4.443      have "Env\<turnstile> B' \<guillemotright>\<langle>l\<bullet> While(e) c\<rangle>\<guillemotright> A'" .
   4.444 @@ -1180,12 +1171,12 @@
   4.445      ultimately show ?case
   4.446        by auto
   4.447    next
   4.448 -    case (Jmp A B Env jump B' A')
   4.449 +    case (Jmp jump B A Env B' A')
   4.450      thus ?case by (elim da_elim_cases) (auto split: jump.splits)
   4.451    next
   4.452      case Throw thus ?case by -  (erule da_elim_cases, auto)
   4.453    next
   4.454 -    case (Try A B C C1 C2 Env c1 c2 vn B' A')
   4.455 +    case (Try Env B c1 C1 vn C c2 C2 A B' A')
   4.456      have A: "nrm A = nrm C1 \<inter> nrm C2"
   4.457              "brk A = brk C1 \<Rightarrow>\<inter>  brk C2" .
   4.458      have "Env\<turnstile> B' \<guillemotright>\<langle>Try c1 Catch(C vn) c2\<rangle>\<guillemotright> A'" .
   4.459 @@ -1210,7 +1201,7 @@
   4.460      show ?case
   4.461        by auto
   4.462    next
   4.463 -    case (Fin A B C1 C2 Env c1 c2 B' A')
   4.464 +    case (Fin Env B c1 C1 c2 C2 A B' A')
   4.465      have A: "nrm A = nrm C1 \<union> nrm C2"
   4.466              "brk A = (brk C1 \<Rightarrow>\<union>\<^sub>\<forall> nrm C2) \<Rightarrow>\<inter> (brk C2)" .
   4.467      have "Env\<turnstile> B' \<guillemotright>\<langle>c1 Finally c2\<rangle>\<guillemotright> A'" .
   4.468 @@ -1247,7 +1238,7 @@
   4.469     next
   4.470       case UnOp thus ?case by -  (erule da_elim_cases, auto)
   4.471     next
   4.472 -     case (CondAnd A B E1 E2 Env e1 e2 B' A')
   4.473 +     case (CondAnd Env B e1 E1 e2 E2 A B' A')
   4.474       have A: "nrm A = B \<union>
   4.475                         assigns_if True (BinOp CondAnd e1 e2) \<inter>
   4.476                         assigns_if False (BinOp CondAnd e1 e2)"
   4.477 @@ -1276,7 +1267,7 @@
   4.478     next
   4.479       case Ass thus ?case by -  (erule da_elim_cases, auto)
   4.480     next
   4.481 -     case (CondBool A B C E1 E2 Env c e1 e2 B' A')
   4.482 +     case (CondBool Env c e1 e2 B C E1 E2 A B' A')
   4.483       have A: "nrm A = B \<union> 
   4.484                          assigns_if True (c ? e1 : e2) \<inter> 
   4.485                          assigns_if False (c ? e1 : e2)"
   4.486 @@ -1295,7 +1286,7 @@
   4.487       with A A' show ?case 
   4.488         by auto 
   4.489     next
   4.490 -     case (Cond A B C E1 E2 Env c e1 e2 B' A')  
   4.491 +     case (Cond Env c e1 e2 B C E1 E2 A B' A')  
   4.492       have A: "nrm A = nrm E1 \<inter> nrm E2"
   4.493               "brk A = (\<lambda>l. UNIV)" .
   4.494       have not_bool: "\<not> Env\<turnstile> (c ? e1 : e2)\<Colon>- (PrimT Boolean)" .
   4.495 @@ -1354,7 +1345,7 @@
   4.496    next
   4.497      case Expr thus ?case by (iprover intro: da.Expr)
   4.498    next
   4.499 -    case (Lab A B C Env c l B')  
   4.500 +    case (Lab Env B c C A l B')  
   4.501      have "PROP ?Hyp Env B \<langle>c\<rangle>" .
   4.502      moreover
   4.503      have B': "B \<subseteq> B'" .
   4.504 @@ -1364,7 +1355,7 @@
   4.505        by (iprover intro: da.Lab)
   4.506      thus ?case ..
   4.507    next
   4.508 -    case (Comp A B C1 C2 Env c1 c2 B')
   4.509 +    case (Comp Env B c1 C1 c2 C2 A B')
   4.510      have da_c1: "Env\<turnstile> B \<guillemotright>\<langle>c1\<rangle>\<guillemotright> C1" .
   4.511      have "PROP ?Hyp Env B \<langle>c1\<rangle>" .
   4.512      moreover
   4.513 @@ -1383,7 +1374,7 @@
   4.514        by (iprover intro: da.Comp)
   4.515      thus ?case ..
   4.516    next
   4.517 -    case (If A B C1 C2 E Env c1 c2 e B')
   4.518 +    case (If Env B e E c1 C1 c2 C2 A B')
   4.519      have B': "B \<subseteq> B'" .
   4.520      obtain  E' where "Env\<turnstile> B' \<guillemotright>\<langle>e\<rangle>\<guillemotright> E'"
   4.521      proof -
   4.522 @@ -1417,7 +1408,7 @@
   4.523        by (iprover intro: da.If)
   4.524      thus ?case ..
   4.525    next  
   4.526 -    case (Loop A B C E Env c e l B')
   4.527 +    case (Loop Env B e E c C A l B')
   4.528      have B': "B \<subseteq> B'" .
   4.529      obtain  E' where "Env\<turnstile> B' \<guillemotright>\<langle>e\<rangle>\<guillemotright> E'"
   4.530      proof -
   4.531 @@ -1441,7 +1432,7 @@
   4.532        by (iprover intro: da.Loop )
   4.533      thus ?case ..
   4.534    next
   4.535 -    case (Jmp A B Env jump B') 
   4.536 +    case (Jmp jump B A Env B') 
   4.537      have B': "B \<subseteq> B'" .
   4.538      with Jmp.hyps have "jump = Ret \<longrightarrow> Result \<in> B' "
   4.539        by auto
   4.540 @@ -1460,7 +1451,7 @@
   4.541    next
   4.542      case Throw thus ?case by (iprover intro: da.Throw )
   4.543    next
   4.544 -    case (Try A B C C1 C2 Env c1 c2 vn B')
   4.545 +    case (Try Env B c1 C1 vn C c2 C2 A B')
   4.546      have B': "B \<subseteq> B'" .
   4.547      obtain C1' where "Env\<turnstile> B' \<guillemotright>\<langle>c1\<rangle>\<guillemotright> C1'"
   4.548      proof -
   4.549 @@ -1485,7 +1476,7 @@
   4.550        by (iprover intro: da.Try )
   4.551      thus ?case ..
   4.552    next
   4.553 -    case (Fin A B C1 C2 Env c1 c2 B')
   4.554 +    case (Fin Env B c1 C1 c2 C2 A B')
   4.555      have B': "B \<subseteq> B'" .
   4.556      obtain C1' where C1': "Env\<turnstile> B' \<guillemotright>\<langle>c1\<rangle>\<guillemotright> C1'"
   4.557      proof -
   4.558 @@ -1519,7 +1510,7 @@
   4.559    next
   4.560      case UnOp thus ?case by (iprover intro: da.UnOp)
   4.561    next
   4.562 -    case (CondAnd A B E1 E2 Env e1 e2 B')
   4.563 +    case (CondAnd Env B e1 E1 e2 E2 A B')
   4.564      have B': "B \<subseteq> B'" .
   4.565      obtain E1' where "Env\<turnstile> B' \<guillemotright>\<langle>e1\<rangle>\<guillemotright> E1'"
   4.566      proof -
   4.567 @@ -1541,7 +1532,7 @@
   4.568        by (iprover intro: da.CondAnd)
   4.569      thus ?case ..
   4.570    next
   4.571 -    case (CondOr A B E1 E2 Env e1 e2 B')
   4.572 +    case (CondOr Env B e1 E1 e2 E2 A B')
   4.573      have B': "B \<subseteq> B'" .
   4.574      obtain E1' where "Env\<turnstile> B' \<guillemotright>\<langle>e1\<rangle>\<guillemotright> E1'"
   4.575      proof -
   4.576 @@ -1563,7 +1554,7 @@
   4.577        by (iprover intro: da.CondOr)
   4.578      thus ?case ..
   4.579    next
   4.580 -    case (BinOp A B E1 Env binop e1 e2 B')
   4.581 +    case (BinOp Env B e1 E1 e2 A binop B')
   4.582      have B': "B \<subseteq> B'" .
   4.583      obtain E1' where E1': "Env\<turnstile> B' \<guillemotright>\<langle>e1\<rangle>\<guillemotright> E1'"
   4.584      proof -
   4.585 @@ -1593,7 +1584,7 @@
   4.586        by auto
   4.587      thus ?case by (iprover intro: da.Super)
   4.588    next
   4.589 -    case (AccLVar A B Env vn B')
   4.590 +    case (AccLVar vn B A Env B')
   4.591      have "vn \<in> B" .
   4.592      moreover
   4.593      have "B \<subseteq> B'" .
   4.594 @@ -1602,7 +1593,7 @@
   4.595    next
   4.596      case Acc thus ?case by (iprover intro: da.Acc)
   4.597    next 
   4.598 -    case (AssLVar A B E Env e vn B')
   4.599 +    case (AssLVar Env B e E A vn B')
   4.600      have B': "B \<subseteq> B'" .
   4.601      then obtain E' where "Env\<turnstile> B' \<guillemotright>\<langle>e\<rangle>\<guillemotright> E'"
   4.602        by (rule AssLVar.hyps [elim_format]) iprover
   4.603 @@ -1611,7 +1602,7 @@
   4.604        by (iprover intro: da.AssLVar)
   4.605      thus ?case ..
   4.606    next
   4.607 -    case (Ass A B Env V e v B') 
   4.608 +    case (Ass v Env B V e A B') 
   4.609      have B': "B \<subseteq> B'" .
   4.610      have "\<forall>vn. v \<noteq> LVar vn".
   4.611      moreover
   4.612 @@ -1637,7 +1628,7 @@
   4.613        by (iprover intro: da.Ass)
   4.614      thus ?case ..
   4.615    next
   4.616 -    case (CondBool A B C E1 E2 Env c e1 e2 B')
   4.617 +    case (CondBool Env c e1 e2 B C E1 E2 A B')
   4.618      have B': "B \<subseteq> B'" .
   4.619      have "Env\<turnstile>(c ? e1 : e2)\<Colon>-(PrimT Boolean)" .
   4.620      moreover obtain C' where C': "Env\<turnstile> B' \<guillemotright>\<langle>c\<rangle>\<guillemotright> C'"
   4.621 @@ -1673,7 +1664,7 @@
   4.622        by (iprover intro: da.CondBool)
   4.623      thus ?case ..
   4.624    next
   4.625 -    case (Cond A B C E1 E2 Env c e1 e2 B')
   4.626 +    case (Cond Env c e1 e2 B C E1 E2 A B')
   4.627      have B': "B \<subseteq> B'" .
   4.628      have "\<not> Env\<turnstile>(c ? e1 : e2)\<Colon>-(PrimT Boolean)" .
   4.629      moreover obtain C' where C': "Env\<turnstile> B' \<guillemotright>\<langle>c\<rangle>\<guillemotright> C'"
   4.630 @@ -1709,7 +1700,7 @@
   4.631        by (iprover intro: da.Cond)
   4.632      thus ?case ..
   4.633    next
   4.634 -    case (Call A B E Env accC args e mn mode pTs statT B')
   4.635 +    case (Call Env B e E args A accC statT mode mn pTs B')
   4.636      have B': "B \<subseteq> B'" .
   4.637      obtain E' where E': "Env\<turnstile> B' \<guillemotright>\<langle>e\<rangle>\<guillemotright> E'"
   4.638      proof -
   4.639 @@ -1735,7 +1726,7 @@
   4.640    next
   4.641      case Methd thus ?case by (iprover intro: da.Methd)
   4.642    next
   4.643 -    case (Body A B C D Env c B')  
   4.644 +    case (Body Env B c C A D B')  
   4.645      have B': "B \<subseteq> B'" .
   4.646      obtain C' where C': "Env\<turnstile> B' \<guillemotright>\<langle>c\<rangle>\<guillemotright> C'" and nrm_C': "nrm C \<subseteq> nrm C'"
   4.647      proof -
   4.648 @@ -1763,7 +1754,7 @@
   4.649    next
   4.650      case FVar thus ?case by (iprover intro: da.FVar)
   4.651    next
   4.652 -    case (AVar A B E1 Env e1 e2 B')
   4.653 +    case (AVar Env B e1 E1 e2 A B')
   4.654      have B': "B \<subseteq> B'" .
   4.655      obtain E1' where E1': "Env\<turnstile> B' \<guillemotright>\<langle>e1\<rangle>\<guillemotright> E1'"
   4.656      proof -
   4.657 @@ -1789,7 +1780,7 @@
   4.658    next
   4.659      case Nil thus ?case by (iprover intro: da.Nil)
   4.660    next
   4.661 -    case (Cons A B E Env e es B')
   4.662 +    case (Cons Env B e E es A B')
   4.663      have B': "B \<subseteq> B'" .
   4.664      obtain E' where E': "Env\<turnstile> B' \<guillemotright>\<langle>e\<rangle>\<guillemotright> E'"
   4.665      proof -
     5.1 --- a/src/HOL/Bali/DefiniteAssignmentCorrect.thy	Mon Dec 11 12:28:16 2006 +0100
     5.2 +++ b/src/HOL/Bali/DefiniteAssignmentCorrect.thy	Mon Dec 11 16:06:14 2006 +0100
     5.3 @@ -309,7 +309,7 @@
     5.4    next
     5.5      case Expr thus ?case by (elim wt_elim_cases) simp
     5.6    next
     5.7 -    case (Lab c jmp s0 s1 jmps T Env) 
     5.8 +    case (Lab s0 c s1 jmp jmps T Env) 
     5.9      have jmpOK: "jumpNestingOk jmps (In1r (jmp\<bullet> c))" .
    5.10      have G: "prg Env = G" .
    5.11      have wt_c: "Env\<turnstile>c\<Colon>\<surd>" 
    5.12 @@ -338,7 +338,7 @@
    5.13      }
    5.14      thus ?case by simp
    5.15    next
    5.16 -    case (Comp c1 c2 s0 s1 s2 jmps T Env)
    5.17 +    case (Comp s0 c1 s1 c2 s2 jmps T Env)
    5.18      have jmpOk: "jumpNestingOk jmps (In1r (c1;; c2))" .
    5.19      have G: "prg Env = G" .
    5.20      from Comp.prems obtain 
    5.21 @@ -363,7 +363,7 @@
    5.22        qed
    5.23      } thus ?case by simp
    5.24    next
    5.25 -    case (If b c1 c2 e s0 s1 s2 jmps T Env)
    5.26 +    case (If s0 e b s1 c1 c2 s2 jmps T Env)
    5.27      have jmpOk: "jumpNestingOk jmps (In1r (If(e) c1 Else c2))" .
    5.28      have G: "prg Env = G" .
    5.29      from If.prems obtain 
    5.30 @@ -389,7 +389,7 @@
    5.31      }
    5.32      thus ?case by simp
    5.33    next
    5.34 -    case (Loop b c e l s0 s1 s2 s3 jmps T Env)
    5.35 +    case (Loop s0 e b s1 c s2 l s3 jmps T Env)
    5.36      have jmpOk: "jumpNestingOk jmps (In1r (l\<bullet> While(e) c))" .
    5.37      have G: "prg Env = G" .
    5.38      have wt: "Env\<turnstile>In1r (l\<bullet> While(e) c)\<Colon>T" .
    5.39 @@ -467,9 +467,9 @@
    5.40      }
    5.41      thus ?case by simp
    5.42    next
    5.43 -    case (Jmp j s jmps T Env) thus ?case by simp
    5.44 +    case (Jmp s j jmps T Env) thus ?case by simp
    5.45    next
    5.46 -    case (Throw a e s0 s1 jmps T Env)
    5.47 +    case (Throw s0 e a s1 jmps T Env)
    5.48      have jmpOk: "jumpNestingOk jmps (In1r (Throw e))" .
    5.49      have G: "prg Env = G" .
    5.50      from Throw.prems obtain Te where 
    5.51 @@ -491,7 +491,7 @@
    5.52      }
    5.53      thus ?case by simp
    5.54    next
    5.55 -    case (Try C c1 c2 s0 s1 s2 s3 vn jmps T Env)
    5.56 +    case (Try s0 c1 s1 s2 C vn c2 s3 jmps T Env)
    5.57      have jmpOk: "jumpNestingOk jmps (In1r (Try c1 Catch(C vn) c2))" .
    5.58      have G: "prg Env = G" .
    5.59      from Try.prems obtain 
    5.60 @@ -543,7 +543,7 @@
    5.61      }
    5.62      thus ?case by simp
    5.63    next
    5.64 -    case (Fin c1 c2 s0 s1 s2 s3 x1 jmps T Env)
    5.65 +    case (Fin s0 c1 x1 s1 c2 s2 s3 jmps T Env)
    5.66      have jmpOk: " jumpNestingOk jmps (In1r (c1 Finally c2))" .
    5.67      have G: "prg Env = G" .
    5.68      from Fin.prems obtain 
    5.69 @@ -571,7 +571,7 @@
    5.70      }
    5.71      thus ?case by simp
    5.72    next
    5.73 -    case (Init C c s0 s1 s2 s3 jmps T Env)
    5.74 +    case (Init C c s0 s3 s1 s2 jmps T Env)
    5.75      have "jumpNestingOk jmps (In1r (Init C))".
    5.76      have G: "prg Env = G" .
    5.77      have "the (class G C) = c" .
    5.78 @@ -636,7 +636,7 @@
    5.79      }
    5.80      thus ?case by simp
    5.81    next
    5.82 -    case (NewC C a s0 s1 s2 jmps T Env)
    5.83 +    case (NewC s0 C s1 a s2 jmps T Env)
    5.84      {
    5.85        fix j
    5.86        assume jmp: "abrupt s2 = Some (Jump j)"
    5.87 @@ -660,7 +660,7 @@
    5.88      }
    5.89      thus ?case by simp
    5.90    next
    5.91 -    case (NewA elT a e i s0 s1 s2 s3 jmps T Env)
    5.92 +    case (NewA s0 elT s1 e i s2 a s3 jmps T Env)
    5.93      {
    5.94        fix j
    5.95        assume jmp: "abrupt s3 = Some (Jump j)"
    5.96 @@ -692,7 +692,7 @@
    5.97      }
    5.98      thus ?case by simp
    5.99    next
   5.100 -    case (Cast cT e s0 s1 s2 v jmps T Env)
   5.101 +    case (Cast s0 e v s1 s2 cT jmps T Env)
   5.102      {
   5.103        fix j
   5.104        assume jmp: "abrupt s2 = Some (Jump j)"
   5.105 @@ -715,7 +715,7 @@
   5.106      }
   5.107      thus ?case by simp
   5.108    next
   5.109 -    case (Inst eT b e s0 s1 v jmps T Env)
   5.110 +    case (Inst s0 e v s1 b eT jmps T Env)
   5.111      {
   5.112        fix j
   5.113        assume jmp: "abrupt s1 = Some (Jump j)"
   5.114 @@ -734,7 +734,7 @@
   5.115    next
   5.116      case Lit thus ?case by simp
   5.117    next
   5.118 -    case (UnOp e s0 s1 unop v jmps T Env)
   5.119 +    case (UnOp s0 e v s1 unop jmps T Env)
   5.120      {
   5.121        fix j
   5.122        assume jmp: "abrupt s1 = Some (Jump j)"
   5.123 @@ -751,7 +751,7 @@
   5.124      }
   5.125      thus ?case by simp
   5.126    next
   5.127 -    case (BinOp binop e1 e2 s0 s1 s2 v1 v2 jmps T Env)
   5.128 +    case (BinOp s0 e1 v1 s1 binop e2 v2 s2 jmps T Env)
   5.129      {
   5.130        fix j
   5.131        assume jmp: "abrupt s2 = Some (Jump j)"
   5.132 @@ -784,7 +784,7 @@
   5.133    next
   5.134      case Super thus ?case by simp
   5.135    next
   5.136 -    case (Acc f s0 s1 v va jmps T Env)
   5.137 +    case (Acc s0 va v f s1 jmps T Env)
   5.138      {
   5.139        fix j
   5.140        assume jmp: "abrupt s1 = Some (Jump j)"
   5.141 @@ -801,7 +801,7 @@
   5.142      }
   5.143      thus ?case by simp
   5.144    next
   5.145 -    case (Ass e f s0 s1 s2 v va w jmps T Env)
   5.146 +    case (Ass s0 va w f s1 e v s2 jmps T Env)
   5.147      have G: "prg Env = G" .
   5.148      from Ass.prems
   5.149      obtain vT eT where
   5.150 @@ -841,7 +841,7 @@
   5.151      }
   5.152      thus ?case by simp
   5.153    next
   5.154 -    case (Cond b e0 e1 e2 s0 s1 s2 v jmps T Env)
   5.155 +    case (Cond s0 e0 b s1 e1 e2 v s2 jmps T Env)
   5.156      have G: "prg Env = G" .
   5.157      have hyp_e0: "PROP ?Hyp (In1l e0) (Norm s0) s1 (In1 b)" .
   5.158      have hyp_e1_e2: "PROP ?Hyp (In1l (if the_Bool b then e1 else e2)) 
   5.159 @@ -876,7 +876,7 @@
   5.160      }
   5.161      thus ?case by simp
   5.162    next
   5.163 -    case (Call D a accC args e mn mode pTs s0 s1 s2 s3 s3' s4 statT v vs 
   5.164 +    case (Call s0 e a s1 args vs s2 D mode statT mn pTs s3 s3' accC v s4
   5.165                 jmps T Env)
   5.166      have G: "prg Env = G" .
   5.167      from Call.prems
   5.168 @@ -919,14 +919,14 @@
   5.169      }
   5.170      thus ?case by simp
   5.171    next
   5.172 -    case (Methd D s0 s1 sig v jmps T Env)
   5.173 +    case (Methd s0 D sig v s1 jmps T Env)
   5.174      have "G\<turnstile>Norm s0 \<midarrow>Methd D sig-\<succ>v\<rightarrow> s1"
   5.175        by (rule eval.Methd)
   5.176      hence "\<And> j. abrupt s1 \<noteq> Some (Jump j)"
   5.177        by (rule Methd_no_jump) simp
   5.178      thus ?case by simp
   5.179    next
   5.180 -    case (Body D c s0 s1 s2 s3 jmps T Env)
   5.181 +    case (Body s0 D s1 c s2 s3 jmps T Env)
   5.182      have "G\<turnstile>Norm s0 \<midarrow>Body D c-\<succ>the (locals (store s2) Result)
   5.183             \<rightarrow> abupd (absorb Ret) s3"
   5.184        by (rule eval.Body)
   5.185 @@ -937,7 +937,7 @@
   5.186      case LVar
   5.187      thus ?case by (simp add: lvar_def Let_def)
   5.188    next
   5.189 -    case (FVar a accC e fn s0 s1 s2 s2' s3 stat statDeclC v jmps T Env)
   5.190 +    case (FVar s0 statDeclC s1 e a s2 v s2' stat fn s3 accC jmps T Env)
   5.191      have G: "prg Env = G" .
   5.192      from wf FVar.prems 
   5.193      obtain  statC f where
   5.194 @@ -996,7 +996,7 @@
   5.195      }
   5.196      ultimately show ?case using v by simp
   5.197    next
   5.198 -    case (AVar a e1 e2 i s0 s1 s2 s2' v jmps T Env)
   5.199 +    case (AVar s0 e1 a s1 e2 i s2 v s2' jmps T Env)
   5.200      have G: "prg Env = G" .
   5.201      from AVar.prems 
   5.202      obtain  e1T e2T where
   5.203 @@ -1042,7 +1042,7 @@
   5.204    next
   5.205      case Nil thus ?case by simp
   5.206    next
   5.207 -    case (Cons e es s0 s1 s2 v vs jmps T Env)
   5.208 +    case (Cons s0 e v s1 es vs s2 jmps T Env)
   5.209      have G: "prg Env = G" .
   5.210      from Cons.prems obtain eT esT
   5.211        where wt_e: "Env\<turnstile>e\<Colon>-eT" and wt_e2: "Env\<turnstile>es\<Colon>\<doteq>esT"
   5.212 @@ -1290,7 +1290,7 @@
   5.213    next
   5.214      case Lab thus ?case by simp
   5.215    next
   5.216 -    case (Comp c1 c2 s0 s1 s2) 
   5.217 +    case (Comp s0 c1 s1 c2 s2) 
   5.218      from Comp.hyps 
   5.219      have "dom (locals (store ((Norm s0)::state))) \<subseteq> dom (locals (store s1))"
   5.220        by simp
   5.221 @@ -1300,7 +1300,7 @@
   5.222        by simp
   5.223      finally show ?case by simp
   5.224    next
   5.225 -    case (If b c1 c2 e s0 s1 s2)
   5.226 +    case (If s0 e b s1 c1 c2 s2)
   5.227      from If.hyps 
   5.228      have "dom (locals (store ((Norm s0)::state))) \<subseteq> dom (locals (store s1))"
   5.229        by simp
   5.230 @@ -1310,7 +1310,7 @@
   5.231        by simp
   5.232      finally show ?case by simp
   5.233    next
   5.234 -    case (Loop b c e l s0 s1 s2 s3) 
   5.235 +    case (Loop s0 e b s1 c s2 l s3) 
   5.236      show ?case
   5.237      proof (cases "the_Bool b")
   5.238        case True
   5.239 @@ -1334,7 +1334,7 @@
   5.240    next
   5.241      case Throw thus ?case by simp
   5.242    next
   5.243 -    case (Try C c1 c2 s0 s1 s2 s3 vn)
   5.244 +    case (Try s0 c1 s1 s2 C vn c2 s3)
   5.245      then
   5.246      have s0_s1: "dom (locals (store ((Norm s0)::state))) 
   5.247                    \<subseteq> dom (locals (store s1))" by simp
   5.248 @@ -1361,7 +1361,7 @@
   5.249  	using False Try.hyps by simp
   5.250      qed
   5.251    next
   5.252 -    case (Fin c1 c2 s0 s1 s2 s3 x1) 
   5.253 +    case (Fin s0 c1 x1 s1 c2 s2 s3) 
   5.254      show ?case
   5.255      proof (cases "\<exists>err. x1 = Some (Error err)")
   5.256        case True
   5.257 @@ -1384,7 +1384,7 @@
   5.258  	using Fin.hyps by simp
   5.259      qed
   5.260    next
   5.261 -    case (Init C c s0 s1 s2 s3)
   5.262 +    case (Init C c s0 s3 s1 s2)
   5.263      show ?case
   5.264      proof (cases "inited C (globs s0)")
   5.265        case True
   5.266 @@ -1405,7 +1405,7 @@
   5.267        thus ?thesis by simp
   5.268      qed
   5.269    next
   5.270 -    case (NewC C a s0 s1 s2)
   5.271 +    case (NewC s0 C s1 a s2)
   5.272      have halloc: "G\<turnstile>s1 \<midarrow>halloc CInst C\<succ>a\<rightarrow> s2" .
   5.273      from NewC.hyps
   5.274      have "dom (locals (store ((Norm s0)::state))) \<subseteq> dom (locals (store s1))" 
   5.275 @@ -1415,7 +1415,7 @@
   5.276      have "\<dots>  \<subseteq> dom (locals (store s2))" by (rule dom_locals_halloc_mono)
   5.277      finally show ?case by simp
   5.278    next
   5.279 -    case (NewA T a e i s0 s1 s2 s3)
   5.280 +    case (NewA s0 T s1 e i s2 a s3)
   5.281      have halloc: "G\<turnstile>abupd (check_neg i) s2 \<midarrow>halloc Arr T (the_Intg i)\<succ>a\<rightarrow> s3" .
   5.282      from NewA.hyps
   5.283      have "dom (locals (store ((Norm s0)::state))) \<subseteq> dom (locals (store s1))" 
   5.284 @@ -1437,7 +1437,7 @@
   5.285    next
   5.286      case UnOp thus ?case by simp
   5.287    next
   5.288 -    case (BinOp binop e1 e2 s0 s1 s2 v1 v2) 
   5.289 +    case (BinOp s0 e1 v1 s1 binop e2 v2 s2) 
   5.290      from BinOp.hyps
   5.291      have "dom (locals (store ((Norm s0)::state))) \<subseteq> dom (locals (store s1))" 
   5.292        by simp
   5.293 @@ -1450,7 +1450,7 @@
   5.294    next
   5.295      case Acc thus ?case by simp
   5.296    next
   5.297 -    case (Ass e f s0 s1 s2 v va w)
   5.298 +    case (Ass s0 va w f s1 e v s2)
   5.299      from Ass.hyps
   5.300      have s0_s1: 
   5.301        "dom (locals (store ((Norm s0)::state))) \<subseteq> dom (locals (store s1))" 
   5.302 @@ -1486,7 +1486,7 @@
   5.303  	by simp
   5.304      qed
   5.305    next
   5.306 -    case (Cond b e0 e1 e2 s0 s1 s2 v)
   5.307 +    case (Cond s0 e0 b s1 e1 e2 v s2)
   5.308      from Cond.hyps 
   5.309      have "dom (locals (store ((Norm s0)::state))) \<subseteq> dom (locals (store s1))"
   5.310        by simp
   5.311 @@ -1496,7 +1496,7 @@
   5.312        by simp
   5.313      finally show ?case by simp
   5.314    next
   5.315 -    case (Call D a' accC args e mn mode pTs s0 s1 s2 s3 s3' s4 statT v vs)
   5.316 +    case (Call s0 e a' s1 args vs s2 D mode statT mn pTs s3 s3' accC v s4)
   5.317      have s3: "s3 = init_lvars G D \<lparr>name = mn, parTs = pTs\<rparr> mode a' vs s2" .
   5.318      from Call.hyps 
   5.319      have "dom (locals (store ((Norm s0)::state))) \<subseteq> dom (locals (store s1))"
   5.320 @@ -1512,7 +1512,7 @@
   5.321    next
   5.322      case Methd thus ?case by simp
   5.323    next
   5.324 -    case (Body D c s0 s1 s2 s3)
   5.325 +    case (Body s0 D s1 c s2 s3)
   5.326      from Body.hyps 
   5.327      have "dom (locals (store ((Norm s0)::state))) \<subseteq> dom (locals (store s1))"
   5.328        by simp
   5.329 @@ -1540,7 +1540,7 @@
   5.330        using dom_locals_lvar_mono
   5.331        by simp
   5.332    next
   5.333 -    case (FVar a accC e fn s0 s1 s2 s2' s3 stat statDeclC v)
   5.334 +    case (FVar s0 statDeclC s1 e a s2 v s2' stat fn s3 accC)
   5.335      from FVar.hyps
   5.336      obtain s2': "s2' = snd (fvar statDeclC stat fn a s2)" and
   5.337               v: "v = fst (fvar statDeclC stat fn a s2)"
   5.338 @@ -1572,7 +1572,7 @@
   5.339        using v_ok
   5.340        by simp
   5.341    next
   5.342 -    case (AVar a e1 e2 i s0 s1 s2 s2' v)
   5.343 +    case (AVar s0 e1 a s1 e2 i s2 v s2')
   5.344      from AVar.hyps
   5.345      obtain s2': "s2' = snd (avar G i a s2)" and
   5.346               v: "v   = fst (avar G i a s2)"
   5.347 @@ -1599,7 +1599,7 @@
   5.348    next
   5.349      case Nil thus ?case by simp
   5.350    next
   5.351 -    case (Cons e es s0 s1 s2 v vs)
   5.352 +    case (Cons s0 e v s1 es vs s2)
   5.353      from Cons.hyps
   5.354      have "dom (locals (store ((Norm s0)::state))) \<subseteq> dom (locals (store s1))"
   5.355        by simp
   5.356 @@ -1689,7 +1689,7 @@
   5.357    next
   5.358      case NewC show ?case by simp
   5.359    next
   5.360 -    case (NewA T a e i s0 s1 s2 s3)
   5.361 +    case (NewA s0 T s1 e i s2 a s3)
   5.362      have halloc: "G\<turnstile>abupd (check_neg i) s2 \<midarrow>halloc Arr T (the_Intg i)\<succ>a\<rightarrow> s3" .
   5.363      have "assigns (In1l e) \<subseteq> dom (locals (store s2))"
   5.364      proof -
   5.365 @@ -1706,7 +1706,7 @@
   5.366        by (rule dom_locals_halloc_mono [elim_format]) simp
   5.367      finally show ?case by simp 
   5.368    next
   5.369 -    case (Cast T e s0 s1 s2 v)
   5.370 +    case (Cast s0 e v s1 s2 T)
   5.371      hence "normal s1" by (cases s1,simp)
   5.372      with Cast.hyps
   5.373      have "assigns (In1l e) \<subseteq> dom (locals (store s1))"
   5.374 @@ -1725,7 +1725,7 @@
   5.375    next
   5.376      case UnOp thus ?case by simp
   5.377    next
   5.378 -    case (BinOp binop e1 e2 s0 s1 s2 v1 v2)
   5.379 +    case (BinOp s0 e1 v1 s1 binop e2 v2 s2)
   5.380      hence "normal s1" by - (erule eval_no_abrupt_lemma [rule_format]) 
   5.381      with BinOp.hyps
   5.382      have "assigns (In1l e1) \<subseteq> dom (locals (store s1))"
   5.383 @@ -1756,7 +1756,7 @@
   5.384    next
   5.385      case Acc thus ?case by simp
   5.386    next 
   5.387 -    case (Ass e f s0 s1 s2 v va w)
   5.388 +    case (Ass s0 va w f s1 e v s2)
   5.389      have  nrm_ass_s2: "normal (assign f v s2)" .
   5.390      hence nrm_s2: "normal s2"
   5.391        by (cases s2, simp add: assign_def Let_def)
   5.392 @@ -1808,7 +1808,7 @@
   5.393        show ?thesis by (simp add: Un_assoc)
   5.394      qed
   5.395    next
   5.396 -    case (Cond b e0 e1 e2 s0 s1 s2 v) 
   5.397 +    case (Cond s0 e0 b s1 e1 e2 v s2) 
   5.398      hence "normal s1"
   5.399        by - (erule eval_no_abrupt_lemma [rule_format])
   5.400      with Cond.hyps
   5.401 @@ -1845,7 +1845,7 @@
   5.402        thus ?thesis using False by simp 
   5.403      qed
   5.404    next
   5.405 -    case (Call D a' accC args e mn mode pTs s0 s1 s2 s3 s3' s4 statT v vs)
   5.406 +    case (Call s0 e a' s1 args vs s2 D mode statT mn pTs s3 s3' accC v s4)
   5.407      have nrm_s2: "normal s2"
   5.408      proof -
   5.409        have "normal ((set_lvars (locals (snd s2))) s4)" .
   5.410 @@ -1887,7 +1887,7 @@
   5.411    next
   5.412      case LVar thus ?case by simp
   5.413    next
   5.414 -    case (FVar a accC e fn s0 s1 s2 s2' s3 stat statDeclC v)
   5.415 +    case (FVar s0 statDeclC s1 e a s2 v s2' stat fn s3 accC)
   5.416      have s3:  "s3 = check_field_access G accC statDeclC fn stat a s2'" .
   5.417      have avar: "(v, s2') = fvar statDeclC stat fn a s2" .
   5.418      have nrm_s2: "normal s2"
   5.419 @@ -1916,7 +1916,7 @@
   5.420      finally show ?case
   5.421        by simp
   5.422    next
   5.423 -    case (AVar a e1 e2 i s0 s1 s2 s2' v)
   5.424 +    case (AVar s0 e1 a s1 e2 i s2 v s2')
   5.425      have avar: "(v, s2') = avar G i a s2" .
   5.426      have nrm_s2: "normal s2"
   5.427      proof -
   5.428 @@ -1954,7 +1954,7 @@
   5.429    next
   5.430      case Nil show ?case by simp
   5.431    next
   5.432 -    case (Cons e es s0 s1 s2 v vs)
   5.433 +    case (Cons s0 e v s1 es vs s2)
   5.434      have "assigns (In1l e) \<subseteq> dom (locals (store s1))"
   5.435      proof -
   5.436        from Cons
   5.437 @@ -2254,19 +2254,19 @@
   5.438     proof (induct)
   5.439       case Abrupt thus ?case by simp
   5.440     next
   5.441 -     case (NewC C a s0 s1 s2)
   5.442 +     case (NewC s0 C s1 a s2)
   5.443       have "Env\<turnstile>NewC C\<Colon>-PrimT Boolean" .
   5.444       hence False 
   5.445         by cases simp
   5.446       thus ?case ..
   5.447     next
   5.448 -     case (NewA T a e i s0 s1 s2 s3)
   5.449 +     case (NewA s0 T s1 e i s2 a s3)
   5.450       have "Env\<turnstile>New T[e]\<Colon>-PrimT Boolean" .
   5.451       hence False 
   5.452         by cases simp
   5.453       thus ?case ..
   5.454     next
   5.455 -     case (Cast T e s0 s1 s2 b)
   5.456 +     case (Cast s0 e b s1 s2 T)
   5.457       have s2: "s2 = abupd (raise_if (\<not> prg Env,snd s1\<turnstile>b fits T) ClassCast) s1".
   5.458       have "assigns_if (the_Bool b) e \<subseteq> dom (locals (store s1))" 
   5.459       proof -
   5.460 @@ -2285,7 +2285,7 @@
   5.461         by simp
   5.462       finally show ?case by simp
   5.463     next
   5.464 -     case (Inst T b e s0 s1 v)
   5.465 +     case (Inst s0 e v s1 b T)
   5.466       have "prg Env\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<rightarrow> s1" and "normal s1" .
   5.467       hence "assignsE e \<subseteq> dom (locals (store s1))"
   5.468         by (rule assignsE_good_approx)
   5.469 @@ -2301,7 +2301,7 @@
   5.470       thus ?case
   5.471         by simp
   5.472     next
   5.473 -     case (UnOp e s0 s1 unop v)
   5.474 +     case (UnOp s0 e v s1 unop)
   5.475       have bool: "Env\<turnstile>UnOp unop e\<Colon>-PrimT Boolean" .
   5.476       hence bool_e: "Env\<turnstile>e\<Colon>-PrimT Boolean" 
   5.477         by cases (cases unop,simp_all)
   5.478 @@ -2341,7 +2341,7 @@
   5.479         thus ?thesis by simp
   5.480       qed
   5.481     next
   5.482 -     case (BinOp binop e1 e2 s0 s1 s2 v1 v2)
   5.483 +     case (BinOp s0 e1 v1 s1 binop e2 v2 s2)
   5.484       have bool: "Env\<turnstile>BinOp binop e1 e2\<Colon>-PrimT Boolean" .
   5.485       show ?case
   5.486       proof (cases "constVal (BinOp binop e1 e2)") 
   5.487 @@ -2507,13 +2507,13 @@
   5.488         by cases simp
   5.489       thus ?case ..
   5.490     next
   5.491 -     case (Acc f s0 s1 v va)
   5.492 +     case (Acc s0 va v f s1)
   5.493       have "prg Env\<turnstile>Norm s0 \<midarrow>va=\<succ>(v, f)\<rightarrow> s1"  and "normal s1".
   5.494       hence "assignsV va \<subseteq> dom (locals (store s1))"
   5.495         by (rule assignsV_good_approx)
   5.496       thus ?case by simp
   5.497     next
   5.498 -     case (Ass e f s0 s1 s2 v va w)
   5.499 +     case (Ass s0 va w f s1 e v s2)
   5.500       hence "prg Env\<turnstile>Norm s0 \<midarrow>va := e-\<succ>v\<rightarrow> assign f v s2"
   5.501         by - (rule eval.Ass)
   5.502       moreover have "normal (assign f v s2)" .
   5.503 @@ -2522,7 +2522,7 @@
   5.504         by (rule assignsE_good_approx)
   5.505       thus ?case by simp
   5.506     next
   5.507 -     case (Cond b e0 e1 e2 s0 s1 s2 v)
   5.508 +     case (Cond s0 e0 b s1 e1 e2 v s2)
   5.509       have "Env\<turnstile>e0 ? e1 : e2\<Colon>-PrimT Boolean" .
   5.510       then obtain wt_e1: "Env\<turnstile>e1\<Colon>-PrimT Boolean" and
   5.511                   wt_e2: "Env\<turnstile>e2\<Colon>-PrimT Boolean"
   5.512 @@ -2599,7 +2599,7 @@
   5.513         qed
   5.514       qed
   5.515     next
   5.516 -     case (Call D a accC args e mn mode pTs s0 s1 s2 s3 s3' s4 statT v vs)
   5.517 +     case (Call s0 e a s1 args vs s2 D mode statT mn pTs s3 s3' accC v s4)
   5.518       hence
   5.519       "prg Env\<turnstile>Norm s0 \<midarrow>({accC,statT,mode}e\<cdot>mn( {pTs}args))-\<succ>v\<rightarrow> 
   5.520                         (set_lvars (locals (store s2)) s4)"
   5.521 @@ -2662,7 +2662,7 @@
   5.522    from eval and wt da G
   5.523    show ?thesis
   5.524    proof (induct arbitrary: Env T A)
   5.525 -    case (Abrupt s t xc Env T A)
   5.526 +    case (Abrupt xc s t Env T A)
   5.527      have da: "Env\<turnstile> dom (locals s) \<guillemotright>t\<guillemotright> A" using Abrupt.prems by simp 
   5.528      have "?NormalAssigned (Some xc,s) A" 
   5.529        by simp
   5.530 @@ -2687,14 +2687,14 @@
   5.531        by simp
   5.532      ultimately show ?case by (intro conjI)
   5.533    next
   5.534 -    case (Expr e s0 s1 v Env T A)
   5.535 +    case (Expr s0 e v s1 Env T A)
   5.536      from Expr.prems
   5.537      show "?NormalAssigned s1 A \<and> ?BreakAssigned (Norm s0) s1 A 
   5.538             \<and> ?ResAssigned (Norm s0) s1"
   5.539        by (elim wt_elim_cases da_elim_cases) 
   5.540           (rule Expr.hyps, auto)
   5.541    next 
   5.542 -    case (Lab c j s0 s1 Env T A)
   5.543 +    case (Lab s0 c s1 j Env T A)
   5.544      have G: "prg Env = G" .
   5.545      from Lab.prems
   5.546      obtain C l where
   5.547 @@ -2753,7 +2753,7 @@
   5.548        by (cases s1) (simp add: absorb_def)
   5.549      ultimately show ?case by (intro conjI)
   5.550    next
   5.551 -    case (Comp c1 c2 s0 s1 s2 Env T A)
   5.552 +    case (Comp s0 c1 s1 c2 s2 Env T A)
   5.553      have G: "prg Env = G" .
   5.554      from Comp.prems
   5.555      obtain C1 C2
   5.556 @@ -2826,7 +2826,7 @@
   5.557        ultimately show ?thesis by (intro conjI)
   5.558      qed
   5.559    next
   5.560 -    case (If b c1 c2 e s0 s1 s2 Env T A)
   5.561 +    case (If s0 e b s1 c1 c2 s2 Env T A)
   5.562      have G: "prg Env = G" .
   5.563      with If.hyps have eval_e: "prg Env \<turnstile>Norm s0 \<midarrow>e-\<succ>b\<rightarrow> s1" by simp
   5.564      from If.prems
   5.565 @@ -2930,7 +2930,7 @@
   5.566        ultimately show ?thesis by simp
   5.567      qed
   5.568    next
   5.569 -    case (Loop b c e l s0 s1 s2 s3 Env T A)
   5.570 +    case (Loop s0 e b s1 c s2 l s3 Env T A)
   5.571      have G: "prg Env = G" .
   5.572      with Loop.hyps have eval_e: "prg Env\<turnstile>Norm s0 \<midarrow>e-\<succ>b\<rightarrow> s1" 
   5.573        by (simp (no_asm_simp))
   5.574 @@ -3118,7 +3118,7 @@
   5.575  	by simp 
   5.576      qed
   5.577    next 
   5.578 -    case (Jmp j s Env T A)
   5.579 +    case (Jmp s j Env T A)
   5.580      have "?NormalAssigned (Some (Jump j),s) A" by simp
   5.581      moreover
   5.582      from Jmp.prems
   5.583 @@ -3136,7 +3136,7 @@
   5.584        by simp
   5.585      ultimately show ?case by (intro conjI)
   5.586    next
   5.587 -    case (Throw a e s0 s1 Env T A)
   5.588 +    case (Throw s0 e a s1 Env T A)
   5.589      have G: "prg Env = G" .
   5.590      from Throw.prems obtain E where 
   5.591        da_e: "Env\<turnstile> dom (locals (store ((Norm s0)::state))) \<guillemotright>\<langle>e\<rangle>\<guillemotright> E"
   5.592 @@ -3166,7 +3166,7 @@
   5.593        by (cases s1) (simp add: throw_def abrupt_if_def)
   5.594      ultimately show ?case by (intro conjI)
   5.595    next
   5.596 -    case (Try C c1 c2 s0 s1 s2 s3 vn Env T A)
   5.597 +    case (Try s0 c1 s1 s2 C vn c2 s3 Env T A)
   5.598      have G: "prg Env = G" .
   5.599      from Try.prems obtain C1 C2 where
   5.600        da_c1: "Env\<turnstile> dom (locals (store ((Norm s0)::state))) \<guillemotright>\<langle>c1\<rangle>\<guillemotright> C1"  and
   5.601 @@ -3313,7 +3313,7 @@
   5.602        qed
   5.603      qed
   5.604    next
   5.605 -    case (Fin c1 c2 s0 s1 s2 s3 x1 Env T A)
   5.606 +    case (Fin s0 c1 x1 s1 c2 s2 s3 Env T A)
   5.607      have G: "prg Env = G" .
   5.608      from Fin.prems obtain C1 C2 where 
   5.609        da_C1: "Env\<turnstile> dom (locals (store ((Norm s0)::state))) \<guillemotright>\<langle>c1\<rangle>\<guillemotright> C1" and
   5.610 @@ -3472,7 +3472,7 @@
   5.611        by simp
   5.612      ultimately show ?case by (intro conjI)
   5.613    next 
   5.614 -    case (Init C c s0 s1 s2 s3 Env T A)
   5.615 +    case (Init C c s0 s3 s1 s2 Env T A)
   5.616      have G: "prg Env = G" .
   5.617      from Init.hyps
   5.618      have eval: "prg Env\<turnstile> Norm s0 \<midarrow>Init C\<rightarrow> s3"
   5.619 @@ -3528,7 +3528,7 @@
   5.620        ultimately show ?thesis by (intro conjI)
   5.621      qed
   5.622    next 
   5.623 -    case (NewC C a s0 s1 s2 Env T A)
   5.624 +    case (NewC s0 C s1 a s2 Env T A)
   5.625      have G: "prg Env = G" .
   5.626      from NewC.prems
   5.627      obtain A: "nrm A = dom (locals (store ((Norm s0)::state)))"
   5.628 @@ -3568,7 +3568,7 @@
   5.629        by simp_all      
   5.630      ultimately show ?case by (intro conjI)
   5.631    next
   5.632 -    case (NewA elT a e i s0 s1 s2 s3 Env T A) 
   5.633 +    case (NewA s0 elT s1 e i s2 a s3 Env T A) 
   5.634      have G: "prg Env = G" .
   5.635      from NewA.prems obtain
   5.636        da_e: "Env\<turnstile> dom (locals (store ((Norm s0)::state))) \<guillemotright>\<langle>e\<rangle>\<guillemotright> A"
   5.637 @@ -3633,7 +3633,7 @@
   5.638        by simp_all
   5.639      ultimately show ?case by (intro conjI)
   5.640    next
   5.641 -    case (Cast cT e s0 s1 s2 v Env T A)
   5.642 +    case (Cast s0 e v s1 s2 cT Env T A)
   5.643      have G: "prg Env = G" .
   5.644      from Cast.prems obtain
   5.645        da_e: "Env\<turnstile> dom (locals (store ((Norm s0)::state))) \<guillemotright>\<langle>e\<rangle>\<guillemotright> A"
   5.646 @@ -3678,7 +3678,7 @@
   5.647        by simp_all
   5.648      ultimately show ?case by (intro conjI)
   5.649    next
   5.650 -    case (Inst iT b e s0 s1 v Env T A)
   5.651 +    case (Inst s0 e v s1 b iT Env T A)
   5.652      have G: "prg Env = G" .
   5.653      from Inst.prems obtain
   5.654        da_e: "Env\<turnstile> dom (locals (store ((Norm s0)::state))) \<guillemotright>\<langle>e\<rangle>\<guillemotright> A"
   5.655 @@ -3700,7 +3700,7 @@
   5.656        by (elim da_elim_cases) simp
   5.657      thus ?case by simp
   5.658    next
   5.659 -    case (UnOp e s0 s1 unop v Env T A)
   5.660 +    case (UnOp s0 e v s1 unop Env T A)
   5.661       have G: "prg Env = G" .
   5.662      from UnOp.prems obtain
   5.663        da_e: "Env\<turnstile> dom (locals (store ((Norm s0)::state))) \<guillemotright>\<langle>e\<rangle>\<guillemotright> A"
   5.664 @@ -3716,7 +3716,7 @@
   5.665        by simp
   5.666      thus ?case by (intro conjI)
   5.667    next
   5.668 -    case (BinOp binop e1 e2 s0 s1 s2 v1 v2 Env T A)
   5.669 +    case (BinOp s0 e1 v1 s1 binop e2 v2 s2 Env T A)
   5.670      have G: "prg Env = G". 
   5.671      from BinOp.hyps 
   5.672      have 
   5.673 @@ -3875,7 +3875,7 @@
   5.674        by (elim da_elim_cases) simp
   5.675      thus ?case by simp
   5.676    next
   5.677 -    case (Acc upd s0 s1 w v Env T A)
   5.678 +    case (Acc s0 v w upd s1 Env T A)
   5.679      show ?case
   5.680      proof (cases "\<exists> vn. v = LVar vn")
   5.681        case True
   5.682 @@ -3905,7 +3905,7 @@
   5.683        thus ?thesis by (intro conjI)
   5.684      qed
   5.685    next
   5.686 -    case (Ass e upd s0 s1 s2 v var w Env T A)
   5.687 +    case (Ass s0 var w upd s1 e v s2 Env T A)
   5.688      have G: "prg Env = G" .
   5.689      from Ass.prems obtain varT eT where
   5.690        wt_var: "Env\<turnstile>var\<Colon>=varT" and
   5.691 @@ -4019,7 +4019,7 @@
   5.692        by simp_all
   5.693      ultimately show ?case by (intro conjI)
   5.694    next
   5.695 -    case (Cond b e0 e1 e2 s0 s1 s2 v Env T A)
   5.696 +    case (Cond s0 e0 b s1 e1 e2 v s2 Env T A)
   5.697      have G: "prg Env = G" .
   5.698      have "?NormalAssigned s2 A"
   5.699      proof 
   5.700 @@ -4140,7 +4140,7 @@
   5.701        by simp_all
   5.702      ultimately show ?case by (intro conjI)
   5.703    next
   5.704 -    case (Call D a accC args e mn mode pTs s0 s1 s2 s3 s3' s4 statT v vs 
   5.705 +    case (Call s0 e a s1 args vs s2 D mode statT mn pTs s3 s3' accC v s4
   5.706             Env T A)
   5.707      have G: "prg Env = G" .
   5.708      have "?NormalAssigned (restore_lvars s2 s4) A"
   5.709 @@ -4213,7 +4213,7 @@
   5.710        by simp_all
   5.711      ultimately show ?case by (intro conjI)
   5.712    next
   5.713 -    case (Methd D s0 s1 sig v Env T A)
   5.714 +    case (Methd s0 D sig v s1 Env T A)
   5.715      have G: "prg Env = G". 
   5.716      from Methd.prems obtain m where
   5.717         m:      "methd (prg Env) D sig = Some m" and
   5.718 @@ -4235,7 +4235,7 @@
   5.719      ultimately show ?case
   5.720        using G by simp
   5.721    next
   5.722 -    case (Body D c s0 s1 s2 s3 Env T A)
   5.723 +    case (Body s0 D s1 c s2 s3 Env T A)
   5.724      have G: "prg Env = G" .
   5.725      from Body.prems 
   5.726      have nrm_A: "nrm A = dom (locals (store ((Norm s0)::state)))"
   5.727 @@ -4261,7 +4261,7 @@
   5.728        by (elim da_elim_cases) simp
   5.729      thus ?case by simp
   5.730    next
   5.731 -    case (FVar a accC e fn s0 s1 s2 s2' s3 stat statDeclC v Env T A)
   5.732 +    case (FVar s0 statDeclC s1 e a s2 v s2' stat fn s3 accC Env T A)
   5.733      have G: "prg Env = G" .
   5.734      have "?NormalAssigned s3 A"
   5.735      proof 
   5.736 @@ -4333,7 +4333,7 @@
   5.737        by simp_all
   5.738      ultimately show ?case by (intro conjI)
   5.739    next
   5.740 -    case (AVar a e1 e2 i s0 s1 s2 s2' v Env T A)
   5.741 +    case (AVar s0 e1 a s1 e2 i s2 v s2' Env T A)
   5.742      have G: "prg Env = G" .
   5.743      have "?NormalAssigned s2' A"
   5.744      proof 
   5.745 @@ -4405,7 +4405,7 @@
   5.746        by (elim da_elim_cases) simp
   5.747      thus ?case by simp
   5.748    next 
   5.749 -    case (Cons e es s0 s1 s2 v vs Env T A)
   5.750 +    case (Cons s0 e v s1 es vs s2 Env T A)
   5.751      have G: "prg Env = G" .
   5.752      have "?NormalAssigned s2 A"
   5.753      proof 
     6.1 --- a/src/HOL/Bali/Eval.thy	Mon Dec 11 12:28:16 2006 +0100
     6.2 +++ b/src/HOL/Bali/Eval.thy	Mon Dec 11 16:06:14 2006 +0100
     6.3 @@ -474,104 +474,75 @@
     6.4         
     6.5  section "evaluation judgments"
     6.6  
     6.7 -consts
     6.8 -  eval   :: "prog \<Rightarrow> (state \<times> term    \<times> vals \<times> state) set"
     6.9 -  halloc::  "prog \<Rightarrow> (state \<times> obj_tag \<times> loc  \<times> state) set"
    6.10 -  sxalloc:: "prog \<Rightarrow> (state                  \<times> state) set"
    6.11 -
    6.12 -
    6.13 -syntax
    6.14 -eval ::"[prog,state,term,vals*state]=>bool"("_|-_ -_>-> _"  [61,61,80,   61]60)
    6.15 -exec ::"[prog,state,stmt      ,state]=>bool"("_|-_ -_-> _"   [61,61,65,   61]60)
    6.16 -evar ::"[prog,state,var  ,vvar,state]=>bool"("_|-_ -_=>_-> _"[61,61,90,61,61]60)
    6.17 -eval_::"[prog,state,expr ,val, state]=>bool"("_|-_ -_->_-> _"[61,61,80,61,61]60)
    6.18 -evals::"[prog,state,expr list ,
    6.19 -		    val  list ,state]=>bool"("_|-_ -_#>_-> _"[61,61,61,61,61]60)
    6.20 -hallo::"[prog,state,obj_tag,
    6.21 -	             loc,state]=>bool"("_|-_ -halloc _>_-> _"[61,61,61,61,61]60)
    6.22 -sallo::"[prog,state        ,state]=>bool"("_|-_ -sxalloc-> _"[61,61,      61]60)
    6.23 -
    6.24 -syntax (xsymbols)
    6.25 -eval ::"[prog,state,term,vals\<times>state]\<Rightarrow>bool" ("_\<turnstile>_ \<midarrow>_\<succ>\<rightarrow> _"  [61,61,80,   61]60)
    6.26 -exec ::"[prog,state,stmt      ,state]\<Rightarrow>bool"("_\<turnstile>_ \<midarrow>_\<rightarrow> _"   [61,61,65,   61]60)
    6.27 -evar ::"[prog,state,var  ,vvar,state]\<Rightarrow>bool"("_\<turnstile>_ \<midarrow>_=\<succ>_\<rightarrow> _"[61,61,90,61,61]60)
    6.28 -eval_::"[prog,state,expr ,val ,state]\<Rightarrow>bool"("_\<turnstile>_ \<midarrow>_-\<succ>_\<rightarrow> _"[61,61,80,61,61]60)
    6.29 -evals::"[prog,state,expr list ,
    6.30 -		    val  list ,state]\<Rightarrow>bool"("_\<turnstile>_ \<midarrow>_\<doteq>\<succ>_\<rightarrow> _"[61,61,61,61,61]60)
    6.31 -hallo::"[prog,state,obj_tag,
    6.32 -	             loc,state]\<Rightarrow>bool"("_\<turnstile>_ \<midarrow>halloc _\<succ>_\<rightarrow> _"[61,61,61,61,61]60)
    6.33 -sallo::"[prog,state,        state]\<Rightarrow>bool"("_\<turnstile>_ \<midarrow>sxalloc\<rightarrow> _"[61,61,      61]60)
    6.34 -
    6.35 -translations
    6.36 -  "G\<turnstile>s \<midarrow>t   \<succ>\<rightarrow>  w___s' " == "(s,t,w___s') \<in> eval G"
    6.37 -  "G\<turnstile>s \<midarrow>t   \<succ>\<rightarrow> (w,  s')" <= "(s,t,w,  s') \<in> eval G"
    6.38 -  "G\<turnstile>s \<midarrow>t   \<succ>\<rightarrow> (w,x,s')" <= "(s,t,w,x,s') \<in> eval G"
    6.39 -  "G\<turnstile>s \<midarrow>c    \<rightarrow>  (x,s')" <= "G\<turnstile>s \<midarrow>In1r c\<succ>\<rightarrow> (\<diamondsuit>,x,s')"
    6.40 -  "G\<turnstile>s \<midarrow>c    \<rightarrow>     s' " == "G\<turnstile>s \<midarrow>In1r c\<succ>\<rightarrow> (\<diamondsuit>  ,  s')"
    6.41 -  "G\<turnstile>s \<midarrow>e-\<succ>v \<rightarrow>  (x,s')" <= "G\<turnstile>s \<midarrow>In1l e\<succ>\<rightarrow> (In1 v ,x,s')"
    6.42 -  "G\<turnstile>s \<midarrow>e-\<succ>v \<rightarrow>     s' " == "G\<turnstile>s \<midarrow>In1l e\<succ>\<rightarrow> (In1 v ,  s')"
    6.43 -  "G\<turnstile>s \<midarrow>e=\<succ>vf\<rightarrow>  (x,s')" <= "G\<turnstile>s \<midarrow>In2  e\<succ>\<rightarrow> (In2 vf,x,s')"
    6.44 -  "G\<turnstile>s \<midarrow>e=\<succ>vf\<rightarrow>     s' " == "G\<turnstile>s \<midarrow>In2  e\<succ>\<rightarrow> (In2 vf,  s')"
    6.45 -  "G\<turnstile>s \<midarrow>e\<doteq>\<succ>v \<rightarrow>  (x,s')" <= "G\<turnstile>s \<midarrow>In3  e\<succ>\<rightarrow> (In3 v ,x,s')"
    6.46 -  "G\<turnstile>s \<midarrow>e\<doteq>\<succ>v \<rightarrow>     s' " == "G\<turnstile>s \<midarrow>In3  e\<succ>\<rightarrow> (In3 v ,  s')"
    6.47 -  "G\<turnstile>s \<midarrow>halloc oi\<succ>a\<rightarrow> (x,s')" <= "(s,oi,a,x,s') \<in> halloc G"
    6.48 -  "G\<turnstile>s \<midarrow>halloc oi\<succ>a\<rightarrow>    s' " == "(s,oi,a,  s') \<in> halloc G"
    6.49 -  "G\<turnstile>s \<midarrow>sxalloc\<rightarrow>     (x,s')" <= "(s     ,x,s') \<in> sxalloc G"
    6.50 -  "G\<turnstile>s \<midarrow>sxalloc\<rightarrow>        s' " == "(s     ,  s') \<in> sxalloc G"
    6.51 -
    6.52 -inductive "halloc G" intros --{* allocating objects on the heap, cf. 12.5 *}
    6.53 +inductive2
    6.54 +  halloc :: "[prog,state,obj_tag,loc,state]\<Rightarrow>bool" ("_\<turnstile>_ \<midarrow>halloc _\<succ>_\<rightarrow> _"[61,61,61,61,61]60) for G::prog
    6.55 +where --{* allocating objects on the heap, cf. 12.5 *}
    6.56  
    6.57    Abrupt: 
    6.58    "G\<turnstile>(Some x,s) \<midarrow>halloc oi\<succ>arbitrary\<rightarrow> (Some x,s)"
    6.59  
    6.60 -  New:	  "\<lbrakk>new_Addr (heap s) = Some a; 
    6.61 +| New:	  "\<lbrakk>new_Addr (heap s) = Some a; 
    6.62  	    (x,oi') = (if atleast_free (heap s) (Suc (Suc 0)) then (None,oi)
    6.63  		       else (Some (Xcpt (Loc a)),CInst (SXcpt OutOfMemory)))\<rbrakk>
    6.64              \<Longrightarrow>
    6.65  	    G\<turnstile>Norm s \<midarrow>halloc oi\<succ>a\<rightarrow> (x,init_obj G oi' (Heap a) s)"
    6.66  
    6.67 -inductive "sxalloc G" intros --{* allocating exception objects for
    6.68 -	 	 	      standard exceptions (other than OutOfMemory) *}
    6.69 +inductive2 sxalloc :: "[prog,state,state]\<Rightarrow>bool" ("_\<turnstile>_ \<midarrow>sxalloc\<rightarrow> _"[61,61,61]60) for G::prog
    6.70 +where --{* allocating exception objects for
    6.71 +  standard exceptions (other than OutOfMemory) *}
    6.72  
    6.73    Norm:	 "G\<turnstile> Norm              s   \<midarrow>sxalloc\<rightarrow>  Norm             s"
    6.74  
    6.75 -  Jmp:   "G\<turnstile>(Some (Jump j), s)  \<midarrow>sxalloc\<rightarrow> (Some (Jump j), s)"
    6.76 +| Jmp:   "G\<turnstile>(Some (Jump j), s)  \<midarrow>sxalloc\<rightarrow> (Some (Jump j), s)"
    6.77  
    6.78 -  Error: "G\<turnstile>(Some (Error e), s)  \<midarrow>sxalloc\<rightarrow> (Some (Error e), s)"
    6.79 +| Error: "G\<turnstile>(Some (Error e), s)  \<midarrow>sxalloc\<rightarrow> (Some (Error e), s)"
    6.80  
    6.81 -  XcptL: "G\<turnstile>(Some (Xcpt (Loc a) ),s)  \<midarrow>sxalloc\<rightarrow> (Some (Xcpt (Loc a)),s)"
    6.82 +| XcptL: "G\<turnstile>(Some (Xcpt (Loc a) ),s)  \<midarrow>sxalloc\<rightarrow> (Some (Xcpt (Loc a)),s)"
    6.83  
    6.84 -  SXcpt: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>halloc (CInst (SXcpt xn))\<succ>a\<rightarrow> (x,s1)\<rbrakk> \<Longrightarrow>
    6.85 +| SXcpt: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>halloc (CInst (SXcpt xn))\<succ>a\<rightarrow> (x,s1)\<rbrakk> \<Longrightarrow>
    6.86  	  G\<turnstile>(Some (Xcpt (Std xn)),s0) \<midarrow>sxalloc\<rightarrow> (Some (Xcpt (Loc a)),s1)"
    6.87  
    6.88  
    6.89 -inductive "eval G" intros
    6.90 +inductive2
    6.91 +  eval :: "[prog,state,term,vals,state]\<Rightarrow>bool" ("_\<turnstile>_ \<midarrow>_\<succ>\<rightarrow> '(_, _')"  [61,61,80,0,0]60)
    6.92 +  and exec ::"[prog,state,stmt      ,state]\<Rightarrow>bool"("_\<turnstile>_ \<midarrow>_\<rightarrow> _"   [61,61,65,   61]60)
    6.93 +  and evar ::"[prog,state,var  ,vvar,state]\<Rightarrow>bool"("_\<turnstile>_ \<midarrow>_=\<succ>_\<rightarrow> _"[61,61,90,61,61]60)
    6.94 +  and eval'::"[prog,state,expr ,val ,state]\<Rightarrow>bool"("_\<turnstile>_ \<midarrow>_-\<succ>_\<rightarrow> _"[61,61,80,61,61]60)
    6.95 +  and evals::"[prog,state,expr list ,
    6.96 +		    val  list ,state]\<Rightarrow>bool"("_\<turnstile>_ \<midarrow>_\<doteq>\<succ>_\<rightarrow> _"[61,61,61,61,61]60)
    6.97 +  for G::prog
    6.98 +where
    6.99 +
   6.100 +  "G\<turnstile>s \<midarrow>c    \<rightarrow>     s' \<equiv> G\<turnstile>s \<midarrow>In1r c\<succ>\<rightarrow> (\<diamondsuit>,  s')"
   6.101 +| "G\<turnstile>s \<midarrow>e-\<succ>v \<rightarrow>     s' \<equiv> G\<turnstile>s \<midarrow>In1l e\<succ>\<rightarrow> (In1 v,  s')"
   6.102 +| "G\<turnstile>s \<midarrow>e=\<succ>vf\<rightarrow>     s' \<equiv> G\<turnstile>s \<midarrow>In2  e\<succ>\<rightarrow> (In2 vf, s')"
   6.103 +| "G\<turnstile>s \<midarrow>e\<doteq>\<succ>v \<rightarrow>     s' \<equiv> G\<turnstile>s \<midarrow>In3  e\<succ>\<rightarrow> (In3 v,  s')"
   6.104  
   6.105  --{* propagation of abrupt completion *}
   6.106  
   6.107    --{* cf. 14.1, 15.5 *}
   6.108 -  Abrupt: 
   6.109 -   "G\<turnstile>(Some xc,s) \<midarrow>t\<succ>\<rightarrow> (arbitrary3 t,(Some xc,s))"
   6.110 +| Abrupt: 
   6.111 +   "G\<turnstile>(Some xc,s) \<midarrow>t\<succ>\<rightarrow> (arbitrary3 t, (Some xc, s))"
   6.112  
   6.113  
   6.114  --{* execution of statements *}
   6.115  
   6.116    --{* cf. 14.5 *}
   6.117 -  Skip:	 			    "G\<turnstile>Norm s \<midarrow>Skip\<rightarrow> Norm s"
   6.118 +| Skip:	 			    "G\<turnstile>Norm s \<midarrow>Skip\<rightarrow> Norm s"
   6.119  
   6.120    --{* cf. 14.7 *}
   6.121 -  Expr:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<rightarrow> s1\<rbrakk> \<Longrightarrow>
   6.122 +| Expr:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<rightarrow> s1\<rbrakk> \<Longrightarrow>
   6.123  				  G\<turnstile>Norm s0 \<midarrow>Expr e\<rightarrow> s1"
   6.124  
   6.125 -  Lab:  "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>c \<rightarrow> s1\<rbrakk> \<Longrightarrow>
   6.126 +| Lab:  "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>c \<rightarrow> s1\<rbrakk> \<Longrightarrow>
   6.127                                  G\<turnstile>Norm s0 \<midarrow>l\<bullet> c\<rightarrow> abupd (absorb l) s1"
   6.128    --{* cf. 14.2 *}
   6.129 -  Comp:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>c1 \<rightarrow> s1;
   6.130 +| Comp:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>c1 \<rightarrow> s1;
   6.131  	  G\<turnstile>     s1 \<midarrow>c2 \<rightarrow> s2\<rbrakk> \<Longrightarrow>
   6.132  				 G\<turnstile>Norm s0 \<midarrow>c1;; c2\<rightarrow> s2"
   6.133  
   6.134    --{* cf. 14.8.2 *}
   6.135 -  If:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>b\<rightarrow> s1;
   6.136 +| If:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>b\<rightarrow> s1;
   6.137  	  G\<turnstile>     s1\<midarrow>(if the_Bool b then c1 else c2)\<rightarrow> s2\<rbrakk> \<Longrightarrow>
   6.138  		       G\<turnstile>Norm s0 \<midarrow>If(e) c1 Else c2 \<rightarrow> s2"
   6.139  
   6.140 @@ -583,26 +554,26 @@
   6.141       the state before the iterative evaluation of the while statement.
   6.142       A break jump is handled by the Lab Statement @{text "Lab l (while\<dots>)"}.
   6.143    *}
   6.144 -  Loop:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>b\<rightarrow> s1;
   6.145 +| Loop:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>b\<rightarrow> s1;
   6.146  	  if the_Bool b 
   6.147               then (G\<turnstile>s1 \<midarrow>c\<rightarrow> s2 \<and> 
   6.148                     G\<turnstile>(abupd (absorb (Cont l)) s2) \<midarrow>l\<bullet> While(e) c\<rightarrow> s3)
   6.149  	     else s3 = s1\<rbrakk> \<Longrightarrow>
   6.150  			      G\<turnstile>Norm s0 \<midarrow>l\<bullet> While(e) c\<rightarrow> s3"
   6.151  
   6.152 -  Jmp: "G\<turnstile>Norm s \<midarrow>Jmp j\<rightarrow> (Some (Jump j), s)"
   6.153 +| Jmp: "G\<turnstile>Norm s \<midarrow>Jmp j\<rightarrow> (Some (Jump j), s)"
   6.154     
   6.155    --{* cf. 14.16 *}
   6.156 -  Throw: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>a'\<rightarrow> s1\<rbrakk> \<Longrightarrow>
   6.157 +| Throw: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>a'\<rightarrow> s1\<rbrakk> \<Longrightarrow>
   6.158  				 G\<turnstile>Norm s0 \<midarrow>Throw e\<rightarrow> abupd (throw a') s1"
   6.159  
   6.160    --{* cf. 14.18.1 *}
   6.161 -  Try:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>c1\<rightarrow> s1; G\<turnstile>s1 \<midarrow>sxalloc\<rightarrow> s2; 
   6.162 +| Try:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>c1\<rightarrow> s1; G\<turnstile>s1 \<midarrow>sxalloc\<rightarrow> s2; 
   6.163  	  if G,s2\<turnstile>catch C then G\<turnstile>new_xcpt_var vn s2 \<midarrow>c2\<rightarrow> s3 else s3 = s2\<rbrakk> \<Longrightarrow>
   6.164  		  G\<turnstile>Norm s0 \<midarrow>Try c1 Catch(C vn) c2\<rightarrow> s3"
   6.165  
   6.166    --{* cf. 14.18.2 *}
   6.167 -  Fin:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>c1\<rightarrow> (x1,s1);
   6.168 +| Fin:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>c1\<rightarrow> (x1,s1);
   6.169  	  G\<turnstile>Norm s1 \<midarrow>c2\<rightarrow> s2;
   6.170            s3=(if (\<exists> err. x1=Some (Error err)) 
   6.171                then (x1,s1) 
   6.172 @@ -610,7 +581,7 @@
   6.173            \<Longrightarrow>
   6.174            G\<turnstile>Norm s0 \<midarrow>c1 Finally c2\<rightarrow> s3"
   6.175    --{* cf. 12.4.2, 8.5 *}
   6.176 -  Init:	"\<lbrakk>the (class G C) = c;
   6.177 +| Init:	"\<lbrakk>the (class G C) = c;
   6.178  	  if inited C (globs s0) then s3 = Norm s0
   6.179  	  else (G\<turnstile>Norm (init_class_obj G C s0) 
   6.180  		  \<midarrow>(if C = Object then Skip else Init (super c))\<rightarrow> s1 \<and>
   6.181 @@ -642,51 +613,51 @@
   6.182  --{* evaluation of expressions *}
   6.183  
   6.184    --{* cf. 15.8.1, 12.4.1 *}
   6.185 -  NewC:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>Init C\<rightarrow> s1;
   6.186 +| NewC:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>Init C\<rightarrow> s1;
   6.187  	  G\<turnstile>     s1 \<midarrow>halloc (CInst C)\<succ>a\<rightarrow> s2\<rbrakk> \<Longrightarrow>
   6.188  	                          G\<turnstile>Norm s0 \<midarrow>NewC C-\<succ>Addr a\<rightarrow> s2"
   6.189  
   6.190    --{* cf. 15.9.1, 12.4.1 *}
   6.191 -  NewA:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>init_comp_ty T\<rightarrow> s1; G\<turnstile>s1 \<midarrow>e-\<succ>i'\<rightarrow> s2; 
   6.192 +| NewA:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>init_comp_ty T\<rightarrow> s1; G\<turnstile>s1 \<midarrow>e-\<succ>i'\<rightarrow> s2; 
   6.193  	  G\<turnstile>abupd (check_neg i') s2 \<midarrow>halloc (Arr T (the_Intg i'))\<succ>a\<rightarrow> s3\<rbrakk> \<Longrightarrow>
   6.194  	                        G\<turnstile>Norm s0 \<midarrow>New T[e]-\<succ>Addr a\<rightarrow> s3"
   6.195  
   6.196    --{* cf. 15.15 *}
   6.197 -  Cast:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<rightarrow> s1;
   6.198 +| Cast:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<rightarrow> s1;
   6.199  	  s2 = abupd (raise_if (\<not>G,store s1\<turnstile>v fits T) ClassCast) s1\<rbrakk> \<Longrightarrow>
   6.200  			        G\<turnstile>Norm s0 \<midarrow>Cast T e-\<succ>v\<rightarrow> s2"
   6.201  
   6.202    --{* cf. 15.19.2 *}
   6.203 -  Inst:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<rightarrow> s1;
   6.204 +| Inst:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<rightarrow> s1;
   6.205  	  b = (v\<noteq>Null \<and> G,store s1\<turnstile>v fits RefT T)\<rbrakk> \<Longrightarrow>
   6.206  			      G\<turnstile>Norm s0 \<midarrow>e InstOf T-\<succ>Bool b\<rightarrow> s1"
   6.207  
   6.208    --{* cf. 15.7.1 *}
   6.209 -  Lit:	"G\<turnstile>Norm s \<midarrow>Lit v-\<succ>v\<rightarrow> Norm s"
   6.210 +| Lit:	"G\<turnstile>Norm s \<midarrow>Lit v-\<succ>v\<rightarrow> Norm s"
   6.211  
   6.212 -  UnOp: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<rightarrow> s1\<rbrakk> 
   6.213 +| UnOp: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<rightarrow> s1\<rbrakk> 
   6.214           \<Longrightarrow> G\<turnstile>Norm s0 \<midarrow>UnOp unop e-\<succ>(eval_unop unop v)\<rightarrow> s1"
   6.215   
   6.216 -  BinOp: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e1-\<succ>v1\<rightarrow> s1; 
   6.217 +| BinOp: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e1-\<succ>v1\<rightarrow> s1; 
   6.218            G\<turnstile>s1 \<midarrow>(if need_second_arg binop v1 then (In1l e2) else (In1r Skip))
   6.219 -                \<succ>\<rightarrow> (In1 v2,s2)
   6.220 +                \<succ>\<rightarrow> (In1 v2, s2)
   6.221            \<rbrakk> 
   6.222           \<Longrightarrow> G\<turnstile>Norm s0 \<midarrow>BinOp binop e1 e2-\<succ>(eval_binop binop v1 v2)\<rightarrow> s2"
   6.223     
   6.224    --{* cf. 15.10.2 *}
   6.225 -  Super: "G\<turnstile>Norm s \<midarrow>Super-\<succ>val_this s\<rightarrow> Norm s"
   6.226 +| Super: "G\<turnstile>Norm s \<midarrow>Super-\<succ>val_this s\<rightarrow> Norm s"
   6.227  
   6.228    --{* cf. 15.2 *}
   6.229 -  Acc:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>va=\<succ>(v,f)\<rightarrow> s1\<rbrakk> \<Longrightarrow>
   6.230 +| Acc:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>va=\<succ>(v,f)\<rightarrow> s1\<rbrakk> \<Longrightarrow>
   6.231  	                          G\<turnstile>Norm s0 \<midarrow>Acc va-\<succ>v\<rightarrow> s1"
   6.232  
   6.233    --{* cf. 15.25.1 *}
   6.234 -  Ass:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>va=\<succ>(w,f)\<rightarrow> s1;
   6.235 +| Ass:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>va=\<succ>(w,f)\<rightarrow> s1;
   6.236            G\<turnstile>     s1 \<midarrow>e-\<succ>v  \<rightarrow> s2\<rbrakk> \<Longrightarrow>
   6.237  				   G\<turnstile>Norm s0 \<midarrow>va:=e-\<succ>v\<rightarrow> assign f v s2"
   6.238  
   6.239    --{* cf. 15.24 *}
   6.240 -  Cond:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e0-\<succ>b\<rightarrow> s1;
   6.241 +| Cond:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e0-\<succ>b\<rightarrow> s1;
   6.242            G\<turnstile>     s1 \<midarrow>(if the_Bool b then e1 else e2)-\<succ>v\<rightarrow> s2\<rbrakk> \<Longrightarrow>
   6.243  			    G\<turnstile>Norm s0 \<midarrow>e0 ? e1 : e2-\<succ>v\<rightarrow> s2"
   6.244  
   6.245 @@ -710,7 +681,7 @@
   6.246        \end{itemize}
   6.247     *}
   6.248    --{* cf. 15.11.4.1, 15.11.4.2, 15.11.4.4, 15.11.4.5 *}
   6.249 -  Call:	
   6.250 +| Call:	
   6.251    "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>a'\<rightarrow> s1; G\<turnstile>s1 \<midarrow>args\<doteq>\<succ>vs\<rightarrow> s2;
   6.252      D = invocation_declclass G mode (store s2) a' statT \<lparr>name=mn,parTs=pTs\<rparr>;
   6.253      s3=init_lvars G D \<lparr>name=mn,parTs=pTs\<rparr> mode a' vs s2;
   6.254 @@ -723,10 +694,10 @@
   6.255     reference in case of an instance method invocation.
   6.256  *}
   6.257  
   6.258 -  Methd:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>body G D sig-\<succ>v\<rightarrow> s1\<rbrakk> \<Longrightarrow>
   6.259 +| Methd:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>body G D sig-\<succ>v\<rightarrow> s1\<rbrakk> \<Longrightarrow>
   6.260  				G\<turnstile>Norm s0 \<midarrow>Methd D sig-\<succ>v\<rightarrow> s1"
   6.261    
   6.262 -  Body:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>Init D\<rightarrow> s1; G\<turnstile>s1 \<midarrow>c\<rightarrow> s2; 
   6.263 +| Body:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>Init D\<rightarrow> s1; G\<turnstile>s1 \<midarrow>c\<rightarrow> s2; 
   6.264            s3 = (if (\<exists> l. abrupt s2 = Some (Jump (Break l)) \<or>  
   6.265                           abrupt s2 = Some (Jump (Cont l)))
   6.266                    then abupd (\<lambda> x. Some (Error CrossMethodJump)) s2 
   6.267 @@ -742,10 +713,10 @@
   6.268  --{* evaluation of variables *}
   6.269  
   6.270    --{* cf. 15.13.1, 15.7.2 *}
   6.271 -  LVar:	"G\<turnstile>Norm s \<midarrow>LVar vn=\<succ>lvar vn s\<rightarrow> Norm s"
   6.272 +| LVar:	"G\<turnstile>Norm s \<midarrow>LVar vn=\<succ>lvar vn s\<rightarrow> Norm s"
   6.273  
   6.274    --{* cf. 15.10.1, 12.4.1 *}
   6.275 -  FVar:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>Init statDeclC\<rightarrow> s1; G\<turnstile>s1 \<midarrow>e-\<succ>a\<rightarrow> s2;
   6.276 +| FVar:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>Init statDeclC\<rightarrow> s1; G\<turnstile>s1 \<midarrow>e-\<succ>a\<rightarrow> s2;
   6.277  	  (v,s2') = fvar statDeclC stat fn a s2;
   6.278            s3 = check_field_access G accC statDeclC fn stat a s2' \<rbrakk> \<Longrightarrow>
   6.279  	  G\<turnstile>Norm s0 \<midarrow>{accC,statDeclC,stat}e..fn=\<succ>v\<rightarrow> s3"
   6.280 @@ -755,7 +726,7 @@
   6.281    *}
   6.282  
   6.283    --{* cf. 15.12.1, 15.25.1 *}
   6.284 -  AVar:	"\<lbrakk>G\<turnstile> Norm s0 \<midarrow>e1-\<succ>a\<rightarrow> s1; G\<turnstile>s1 \<midarrow>e2-\<succ>i\<rightarrow> s2;
   6.285 +| AVar:	"\<lbrakk>G\<turnstile> Norm s0 \<midarrow>e1-\<succ>a\<rightarrow> s1; G\<turnstile>s1 \<midarrow>e2-\<succ>i\<rightarrow> s2;
   6.286  	  (v,s2') = avar G i a s2\<rbrakk> \<Longrightarrow>
   6.287  	              G\<turnstile>Norm s0 \<midarrow>e1.[e2]=\<succ>v\<rightarrow> s2'"
   6.288  
   6.289 @@ -763,11 +734,11 @@
   6.290  --{* evaluation of expression lists *}
   6.291  
   6.292    --{* cf. 15.11.4.2 *}
   6.293 -  Nil:
   6.294 +| Nil:
   6.295  				    "G\<turnstile>Norm s0 \<midarrow>[]\<doteq>\<succ>[]\<rightarrow> Norm s0"
   6.296  
   6.297    --{* cf. 15.6.4 *}
   6.298 -  Cons:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e -\<succ> v \<rightarrow> s1;
   6.299 +| Cons:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e -\<succ> v \<rightarrow> s1;
   6.300            G\<turnstile>     s1 \<midarrow>es\<doteq>\<succ>vs\<rightarrow> s2\<rbrakk> \<Longrightarrow>
   6.301  				   G\<turnstile>Norm s0 \<midarrow>e#es\<doteq>\<succ>v#vs\<rightarrow> s2"
   6.302  
   6.303 @@ -794,17 +765,17 @@
   6.304  
   6.305  declare split_if     [split del] split_if_asm     [split del] 
   6.306          option.split [split del] option.split_asm [split del]
   6.307 -inductive_cases halloc_elim_cases: 
   6.308 +inductive_cases2 halloc_elim_cases: 
   6.309    "G\<turnstile>(Some xc,s) \<midarrow>halloc oi\<succ>a\<rightarrow> s'"
   6.310    "G\<turnstile>(Norm    s) \<midarrow>halloc oi\<succ>a\<rightarrow> s'"
   6.311  
   6.312 -inductive_cases sxalloc_elim_cases:
   6.313 +inductive_cases2 sxalloc_elim_cases:
   6.314   	"G\<turnstile> Norm                 s  \<midarrow>sxalloc\<rightarrow> s'"
   6.315          "G\<turnstile>(Some (Jump j),s) \<midarrow>sxalloc\<rightarrow> s'"
   6.316   	"G\<turnstile>(Some (Error e),s) \<midarrow>sxalloc\<rightarrow> s'"
   6.317          "G\<turnstile>(Some (Xcpt (Loc a )),s) \<midarrow>sxalloc\<rightarrow> s'"
   6.318   	"G\<turnstile>(Some (Xcpt (Std xn)),s) \<midarrow>sxalloc\<rightarrow> s'"
   6.319 -inductive_cases sxalloc_cases: "G\<turnstile>s \<midarrow>sxalloc\<rightarrow> s'"
   6.320 +inductive_cases2 sxalloc_cases: "G\<turnstile>s \<midarrow>sxalloc\<rightarrow> s'"
   6.321  
   6.322  lemma sxalloc_elim_cases2: "\<lbrakk>G\<turnstile>s \<midarrow>sxalloc\<rightarrow> s';  
   6.323         \<And>s.   \<lbrakk>s' = Norm s\<rbrakk> \<Longrightarrow> P;  
   6.324 @@ -822,40 +793,40 @@
   6.325  ML_setup {*
   6.326  change_simpset (fn ss => ss delloop "split_all_tac");
   6.327  *}
   6.328 -inductive_cases eval_cases: "G\<turnstile>s \<midarrow>t\<succ>\<rightarrow> vs'"
   6.329 +inductive_cases2 eval_cases: "G\<turnstile>s \<midarrow>t\<succ>\<rightarrow> (v, s')"
   6.330  
   6.331 -inductive_cases eval_elim_cases [cases set]:
   6.332 -        "G\<turnstile>(Some xc,s) \<midarrow>t                              \<succ>\<rightarrow> vs'"
   6.333 -	"G\<turnstile>Norm s \<midarrow>In1r Skip                           \<succ>\<rightarrow> xs'"
   6.334 -        "G\<turnstile>Norm s \<midarrow>In1r (Jmp j)                        \<succ>\<rightarrow> xs'"
   6.335 -        "G\<turnstile>Norm s \<midarrow>In1r (l\<bullet> c)                         \<succ>\<rightarrow> xs'"
   6.336 -	"G\<turnstile>Norm s \<midarrow>In3  ([])                           \<succ>\<rightarrow> vs'"
   6.337 -	"G\<turnstile>Norm s \<midarrow>In3  (e#es)                         \<succ>\<rightarrow> vs'"
   6.338 -	"G\<turnstile>Norm s \<midarrow>In1l (Lit w)                        \<succ>\<rightarrow> vs'"
   6.339 -        "G\<turnstile>Norm s \<midarrow>In1l (UnOp unop e)                  \<succ>\<rightarrow> vs'"
   6.340 -        "G\<turnstile>Norm s \<midarrow>In1l (BinOp binop e1 e2)            \<succ>\<rightarrow> vs'"
   6.341 -	"G\<turnstile>Norm s \<midarrow>In2  (LVar vn)                      \<succ>\<rightarrow> vs'"
   6.342 -	"G\<turnstile>Norm s \<midarrow>In1l (Cast T e)                     \<succ>\<rightarrow> vs'"
   6.343 -	"G\<turnstile>Norm s \<midarrow>In1l (e InstOf T)                   \<succ>\<rightarrow> vs'"
   6.344 -	"G\<turnstile>Norm s \<midarrow>In1l (Super)                        \<succ>\<rightarrow> vs'"
   6.345 -	"G\<turnstile>Norm s \<midarrow>In1l (Acc va)                       \<succ>\<rightarrow> vs'"
   6.346 -	"G\<turnstile>Norm s \<midarrow>In1r (Expr e)                       \<succ>\<rightarrow> xs'"
   6.347 -	"G\<turnstile>Norm s \<midarrow>In1r (c1;; c2)                      \<succ>\<rightarrow> xs'"
   6.348 -	"G\<turnstile>Norm s \<midarrow>In1l (Methd C sig)                  \<succ>\<rightarrow> xs'"
   6.349 -	"G\<turnstile>Norm s \<midarrow>In1l (Body D c)                     \<succ>\<rightarrow> xs'"
   6.350 -	"G\<turnstile>Norm s \<midarrow>In1l (e0 ? e1 : e2)                 \<succ>\<rightarrow> vs'"
   6.351 -	"G\<turnstile>Norm s \<midarrow>In1r (If(e) c1 Else c2)             \<succ>\<rightarrow> xs'"
   6.352 -	"G\<turnstile>Norm s \<midarrow>In1r (l\<bullet> While(e) c)                \<succ>\<rightarrow> xs'"
   6.353 -	"G\<turnstile>Norm s \<midarrow>In1r (c1 Finally c2)                \<succ>\<rightarrow> xs'"
   6.354 -	"G\<turnstile>Norm s \<midarrow>In1r (Throw e)                      \<succ>\<rightarrow> xs'"
   6.355 -	"G\<turnstile>Norm s \<midarrow>In1l (NewC C)                       \<succ>\<rightarrow> vs'"
   6.356 -	"G\<turnstile>Norm s \<midarrow>In1l (New T[e])                     \<succ>\<rightarrow> vs'"
   6.357 -	"G\<turnstile>Norm s \<midarrow>In1l (Ass va e)                     \<succ>\<rightarrow> vs'"
   6.358 -	"G\<turnstile>Norm s \<midarrow>In1r (Try c1 Catch(tn vn) c2)       \<succ>\<rightarrow> xs'"
   6.359 -	"G\<turnstile>Norm s \<midarrow>In2  ({accC,statDeclC,stat}e..fn)   \<succ>\<rightarrow> vs'"
   6.360 -	"G\<turnstile>Norm s \<midarrow>In2  (e1.[e2])                      \<succ>\<rightarrow> vs'"
   6.361 -	"G\<turnstile>Norm s \<midarrow>In1l ({accC,statT,mode}e\<cdot>mn({pT}p)) \<succ>\<rightarrow> vs'"
   6.362 -	"G\<turnstile>Norm s \<midarrow>In1r (Init C)                       \<succ>\<rightarrow> xs'"
   6.363 +inductive_cases2 eval_elim_cases [cases set]:
   6.364 +        "G\<turnstile>(Some xc,s) \<midarrow>t                              \<succ>\<rightarrow> (v, s')"
   6.365 +	"G\<turnstile>Norm s \<midarrow>In1r Skip                           \<succ>\<rightarrow> (x, s')"
   6.366 +        "G\<turnstile>Norm s \<midarrow>In1r (Jmp j)                        \<succ>\<rightarrow> (x, s')"
   6.367 +        "G\<turnstile>Norm s \<midarrow>In1r (l\<bullet> c)                         \<succ>\<rightarrow> (x, s')"
   6.368 +	"G\<turnstile>Norm s \<midarrow>In3  ([])                           \<succ>\<rightarrow> (v, s')"
   6.369 +	"G\<turnstile>Norm s \<midarrow>In3  (e#es)                         \<succ>\<rightarrow> (v, s')"
   6.370 +	"G\<turnstile>Norm s \<midarrow>In1l (Lit w)                        \<succ>\<rightarrow> (v, s')"
   6.371 +        "G\<turnstile>Norm s \<midarrow>In1l (UnOp unop e)                  \<succ>\<rightarrow> (v, s')"
   6.372 +        "G\<turnstile>Norm s \<midarrow>In1l (BinOp binop e1 e2)            \<succ>\<rightarrow> (v, s')"
   6.373 +	"G\<turnstile>Norm s \<midarrow>In2  (LVar vn)                      \<succ>\<rightarrow> (v, s')"
   6.374 +	"G\<turnstile>Norm s \<midarrow>In1l (Cast T e)                     \<succ>\<rightarrow> (v, s')"
   6.375 +	"G\<turnstile>Norm s \<midarrow>In1l (e InstOf T)                   \<succ>\<rightarrow> (v, s')"
   6.376 +	"G\<turnstile>Norm s \<midarrow>In1l (Super)                        \<succ>\<rightarrow> (v, s')"
   6.377 +	"G\<turnstile>Norm s \<midarrow>In1l (Acc va)                       \<succ>\<rightarrow> (v, s')"
   6.378 +	"G\<turnstile>Norm s \<midarrow>In1r (Expr e)                       \<succ>\<rightarrow> (x, s')"
   6.379 +	"G\<turnstile>Norm s \<midarrow>In1r (c1;; c2)                      \<succ>\<rightarrow> (x, s')"
   6.380 +	"G\<turnstile>Norm s \<midarrow>In1l (Methd C sig)                  \<succ>\<rightarrow> (x, s')"
   6.381 +	"G\<turnstile>Norm s \<midarrow>In1l (Body D c)                     \<succ>\<rightarrow> (x, s')"
   6.382 +	"G\<turnstile>Norm s \<midarrow>In1l (e0 ? e1 : e2)                 \<succ>\<rightarrow> (v, s')"
   6.383 +	"G\<turnstile>Norm s \<midarrow>In1r (If(e) c1 Else c2)             \<succ>\<rightarrow> (x, s')"
   6.384 +	"G\<turnstile>Norm s \<midarrow>In1r (l\<bullet> While(e) c)                \<succ>\<rightarrow> (x, s')"
   6.385 +	"G\<turnstile>Norm s \<midarrow>In1r (c1 Finally c2)                \<succ>\<rightarrow> (x, s')"
   6.386 +	"G\<turnstile>Norm s \<midarrow>In1r (Throw e)                      \<succ>\<rightarrow> (x, s')"
   6.387 +	"G\<turnstile>Norm s \<midarrow>In1l (NewC C)                       \<succ>\<rightarrow> (v, s')"
   6.388 +	"G\<turnstile>Norm s \<midarrow>In1l (New T[e])                     \<succ>\<rightarrow> (v, s')"
   6.389 +	"G\<turnstile>Norm s \<midarrow>In1l (Ass va e)                     \<succ>\<rightarrow> (v, s')"
   6.390 +	"G\<turnstile>Norm s \<midarrow>In1r (Try c1 Catch(tn vn) c2)       \<succ>\<rightarrow> (x, s')"
   6.391 +	"G\<turnstile>Norm s \<midarrow>In2  ({accC,statDeclC,stat}e..fn)   \<succ>\<rightarrow> (v, s')"
   6.392 +	"G\<turnstile>Norm s \<midarrow>In2  (e1.[e2])                      \<succ>\<rightarrow> (v, s')"
   6.393 +	"G\<turnstile>Norm s \<midarrow>In1l ({accC,statT,mode}e\<cdot>mn({pT}p)) \<succ>\<rightarrow> (v, s')"
   6.394 +	"G\<turnstile>Norm s \<midarrow>In1r (Init C)                       \<succ>\<rightarrow> (x, s')"
   6.395  declare not_None_eq [simp]  (* IntDef.Zero_def [simp] *)
   6.396  declare split_paired_All [simp] split_paired_Ex [simp]
   6.397  ML_setup {*
   6.398 @@ -885,25 +856,33 @@
   6.399   (injection @{term In1l} into terms) always evaluates to ordinary values 
   6.400   (injection @{term In1} into generalised values @{term vals}). 
   6.401  *}
   6.402 +
   6.403 +lemma eval_expr_eq: "G\<turnstile>s \<midarrow>In1l t\<succ>\<rightarrow> (w, s') = (\<exists>v. w=In1 v \<and> G\<turnstile>s \<midarrow>t-\<succ>v \<rightarrow> s')"
   6.404 +  by (auto, frule eval_Inj_elim, auto)
   6.405 +
   6.406 +lemma eval_var_eq: "G\<turnstile>s \<midarrow>In2 t\<succ>\<rightarrow> (w, s') = (\<exists>vf. w=In2 vf \<and> G\<turnstile>s \<midarrow>t=\<succ>vf\<rightarrow> s')"
   6.407 +  by (auto, frule eval_Inj_elim, auto)
   6.408 +
   6.409 +lemma eval_exprs_eq: "G\<turnstile>s \<midarrow>In3 t\<succ>\<rightarrow> (w, s') = (\<exists>vs. w=In3 vs \<and> G\<turnstile>s \<midarrow>t\<doteq>\<succ>vs\<rightarrow> s')"
   6.410 +  by (auto, frule eval_Inj_elim, auto)
   6.411 +
   6.412 +lemma eval_stmt_eq: "G\<turnstile>s \<midarrow>In1r t\<succ>\<rightarrow> (w, s') = (w=\<diamondsuit> \<and> G\<turnstile>s \<midarrow>t \<rightarrow> s')"
   6.413 +  by (auto, frule eval_Inj_elim, auto, frule eval_Inj_elim, auto)
   6.414 +
   6.415  ML_setup {*
   6.416 -fun eval_fun nam inj rhs =
   6.417 +fun eval_fun name lhs =
   6.418  let
   6.419 -  val name = "eval_" ^ nam ^ "_eq"
   6.420 -  val lhs = "G\<turnstile>s \<midarrow>" ^ inj ^ " t\<succ>\<rightarrow> (w, s')"
   6.421 -  val () = qed_goal name (the_context()) (lhs ^ " = (" ^ rhs ^ ")") 
   6.422 -	(K [Auto_tac, ALLGOALS (ftac (thm "eval_Inj_elim")) THEN Auto_tac])
   6.423    fun is_Inj (Const (inj,_) $ _) = true
   6.424      | is_Inj _                   = false
   6.425 -  fun pred (_ $ (Const ("Pair",_) $ _ $ 
   6.426 -      (Const ("Pair", _) $ _ $ (Const ("Pair", _) $ x $ _ ))) $ _ ) = is_Inj x
   6.427 +  fun pred (_ $ _ $ _ $ _ $ x $ _) = is_Inj x
   6.428  in
   6.429    cond_simproc name lhs pred (thm name)
   6.430  end
   6.431  
   6.432 -val eval_expr_proc =eval_fun "expr" "In1l" "\<exists>v.  w=In1 v   \<and> G\<turnstile>s \<midarrow>t-\<succ>v \<rightarrow> s'"
   6.433 -val eval_var_proc  =eval_fun "var"  "In2"  "\<exists>vf. w=In2 vf  \<and> G\<turnstile>s \<midarrow>t=\<succ>vf\<rightarrow> s'"
   6.434 -val eval_exprs_proc=eval_fun "exprs""In3"  "\<exists>vs. w=In3 vs  \<and> G\<turnstile>s \<midarrow>t\<doteq>\<succ>vs\<rightarrow> s'"
   6.435 -val eval_stmt_proc =eval_fun "stmt" "In1r" "     w=\<diamondsuit> \<and> G\<turnstile>s \<midarrow>t    \<rightarrow> s'";
   6.436 +val eval_expr_proc  = eval_fun "eval_expr_eq"  "G\<turnstile>s \<midarrow>In1l t\<succ>\<rightarrow> (w, s')";
   6.437 +val eval_var_proc   = eval_fun "eval_var_eq"   "G\<turnstile>s \<midarrow>In2 t\<succ>\<rightarrow> (w, s')";
   6.438 +val eval_exprs_proc = eval_fun "eval_exprs_eq" "G\<turnstile>s \<midarrow>In3 t\<succ>\<rightarrow> (w, s')";
   6.439 +val eval_stmt_proc  = eval_fun "eval_stmt_eq"  "G\<turnstile>s \<midarrow>In1r t\<succ>\<rightarrow> (w, s')";
   6.440  Addsimprocs [eval_expr_proc,eval_var_proc,eval_exprs_proc,eval_stmt_proc];
   6.441  bind_thms ("AbruptIs", sum3_instantiate (thm "eval.Abrupt"))
   6.442  *}
   6.443 @@ -922,9 +901,7 @@
   6.444      assume eval: "G\<turnstile>s \<midarrow>t\<succ>\<rightarrow> (v,s')" and
   6.445           normal: "normal s" and
   6.446           callee: "t=In1l (Callee l e)"
   6.447 -    then have "False"
   6.448 -    proof (induct)
   6.449 -    qed (auto)
   6.450 +    then have "False" by induct auto
   6.451    }  
   6.452    then show ?thesis
   6.453      by (cases s') fastsimp
   6.454 @@ -937,9 +914,7 @@
   6.455      assume eval: "G\<turnstile>s \<midarrow>t\<succ>\<rightarrow> (v,s')" and
   6.456           normal: "normal s" and
   6.457           callee: "t=In1l (InsInitE c e)"
   6.458 -    then have "False"
   6.459 -    proof (induct)
   6.460 -    qed (auto)
   6.461 +    then have "False" by induct auto
   6.462    }
   6.463    then show ?thesis
   6.464      by (cases s') fastsimp
   6.465 @@ -951,9 +926,7 @@
   6.466      assume eval: "G\<turnstile>s \<midarrow>t\<succ>\<rightarrow> (v,s')" and
   6.467           normal: "normal s" and
   6.468           callee: "t=In2 (InsInitV c w)"
   6.469 -    then have "False"
   6.470 -    proof (induct)
   6.471 -    qed (auto)
   6.472 +    then have "False" by induct auto
   6.473    }  
   6.474    then show ?thesis
   6.475      by (cases s') fastsimp
   6.476 @@ -965,9 +938,7 @@
   6.477      assume eval: "G\<turnstile>s \<midarrow>t\<succ>\<rightarrow> (v,s')" and
   6.478           normal: "normal s" and
   6.479           callee: "t=In1r (FinA a c)"
   6.480 -    then have "False"
   6.481 -    proof (induct)
   6.482 -    qed (auto)
   6.483 +    then have "False" by induct auto
   6.484    }  
   6.485    then show ?thesis
   6.486      by (cases s') fastsimp 
   6.487 @@ -988,8 +959,7 @@
   6.488  local
   6.489    fun is_None (Const ("Datatype.option.None",_)) = true
   6.490      | is_None _ = false
   6.491 -  fun pred (t as (_ $ (Const ("Pair",_) $
   6.492 -     (Const ("Pair", _) $ x $ _) $ _ ) $ _)) = is_None x
   6.493 +  fun pred (_ $ _ $ (Const ("Pair", _) $ x $ _) $ _  $ _ $ _) = is_None x
   6.494  in
   6.495    val eval_no_abrupt_proc = 
   6.496    cond_simproc "eval_no_abrupt" "G\<turnstile>(x,s) \<midarrow>e\<succ>\<rightarrow> (w,Norm s')" pred 
   6.497 @@ -1015,9 +985,7 @@
   6.498  local
   6.499    fun is_Some (Const ("Pair",_) $ (Const ("Datatype.option.Some",_) $ _)$ _) =true
   6.500      | is_Some _ = false
   6.501 -  fun pred (_ $ (Const ("Pair",_) $
   6.502 -     _ $ (Const ("Pair", _) $ _ $ (Const ("Pair", _) $ _ $
   6.503 -       x))) $ _ ) = is_Some x
   6.504 +  fun pred (_ $ _ $ _ $ _ $ _ $ x) = is_Some x
   6.505  in
   6.506    val eval_abrupt_proc = 
   6.507    cond_simproc "eval_abrupt" 
   6.508 @@ -1174,8 +1142,7 @@
   6.509  section "single valued"
   6.510  
   6.511  lemma unique_halloc [rule_format (no_asm)]: 
   6.512 -  "\<And>s as as'. (s,oi,as)\<in>halloc G \<Longrightarrow> (s,oi,as')\<in>halloc G \<longrightarrow> as'=as"
   6.513 -apply (simp (no_asm_simp) only: split_tupled_all)
   6.514 +  "G\<turnstile>s \<midarrow>halloc oi\<succ>a \<rightarrow> s' \<Longrightarrow> G\<turnstile>s \<midarrow>halloc oi\<succ>a' \<rightarrow> s'' \<longrightarrow> a' = a \<and> s'' = s'"
   6.515  apply (erule halloc.induct)
   6.516  apply  (auto elim!: halloc_elim_cases split del: split_if split_if_asm)
   6.517  apply (drule trans [THEN sym], erule sym) 
   6.518 @@ -1192,8 +1159,7 @@
   6.519  
   6.520  
   6.521  lemma unique_sxalloc [rule_format (no_asm)]: 
   6.522 -  "\<And>s s'. G\<turnstile>s \<midarrow>sxalloc\<rightarrow> s' \<Longrightarrow> G\<turnstile>s \<midarrow>sxalloc\<rightarrow> s'' \<longrightarrow> s'' = s'"
   6.523 -apply (simp (no_asm_simp) only: split_tupled_all)
   6.524 +  "G\<turnstile>s \<midarrow>sxalloc\<rightarrow> s' \<Longrightarrow> G\<turnstile>s \<midarrow>sxalloc\<rightarrow> s'' \<longrightarrow> s'' = s'"
   6.525  apply (erule sxalloc.induct)
   6.526  apply   (auto dest: unique_halloc elim!: sxalloc_elim_cases 
   6.527                split del: split_if split_if_asm)
   6.528 @@ -1210,9 +1176,7 @@
   6.529  
   6.530  
   6.531  lemma unique_eval [rule_format (no_asm)]: 
   6.532 -  "G\<turnstile>s \<midarrow>t\<succ>\<rightarrow> ws \<Longrightarrow> (\<forall>ws'. G\<turnstile>s \<midarrow>t\<succ>\<rightarrow> ws' \<longrightarrow> ws' = ws)"
   6.533 -apply (case_tac "ws")
   6.534 -apply hypsubst
   6.535 +  "G\<turnstile>s \<midarrow>t\<succ>\<rightarrow> (w, s') \<Longrightarrow> (\<forall>w' s''. G\<turnstile>s \<midarrow>t\<succ>\<rightarrow> (w', s'') \<longrightarrow> w' = w \<and> s'' = s')"
   6.536  apply (erule eval_induct)
   6.537  apply (tactic {* ALLGOALS (EVERY'
   6.538        [strip_tac, rotate_tac ~1, eresolve_tac (thms "eval_elim_cases")]) *})
   6.539 @@ -1221,19 +1185,16 @@
   6.540  apply (simp (no_asm_use) only: split add: split_if_asm)
   6.541  (* 34 subgoals *)
   6.542  prefer 30 (* Init *)
   6.543 -apply (case_tac "inited C (globs s0)", (simp only: if_True if_False)+)
   6.544 +apply (case_tac "inited C (globs s0)", (simp only: if_True if_False simp_thms)+)
   6.545  prefer 26 (* While *)
   6.546  apply (simp (no_asm_use) only: split add: split_if_asm, blast)
   6.547 -apply (drule_tac x="(In1 bb, s1a)" in spec, drule (1) mp, simp)
   6.548 -apply (drule_tac x="(In1 bb, s1a)" in spec, drule (1) mp, simp)
   6.549 -apply blast
   6.550 -(* 33 subgoals *)
   6.551 +(* 36 subgoals *)
   6.552  apply (blast dest: unique_sxalloc unique_halloc split_pairD)+
   6.553  done
   6.554  
   6.555  (* unused *)
   6.556  lemma single_valued_eval: 
   6.557 - "single_valued {((s,t),vs'). G\<turnstile>s \<midarrow>t\<succ>\<rightarrow> vs'}"
   6.558 + "single_valued {((s, t), (v, s')). G\<turnstile>s \<midarrow>t\<succ>\<rightarrow> (v, s')}"
   6.559  apply (unfold single_valued_def)
   6.560  by (clarify, drule (1) unique_eval, auto)
   6.561  
     7.1 --- a/src/HOL/Bali/Evaln.thy	Mon Dec 11 12:28:16 2006 +0100
     7.2 +++ b/src/HOL/Bali/Evaln.thy	Mon Dec 11 16:06:14 2006 +0100
     7.3 @@ -28,68 +28,40 @@
     7.4  for welltyped, and definitely assigned terms.
     7.5  *}
     7.6  
     7.7 -consts
     7.8 -
     7.9 -  evaln	:: "prog \<Rightarrow> (state \<times> term \<times> nat \<times> vals \<times> state) set"
    7.10 -
    7.11 -syntax
    7.12 -
    7.13 -  evaln	:: "[prog, state, term,        nat, vals * state] => bool"
    7.14 -				("_|-_ -_>-_-> _"   [61,61,80,   61,61] 60)
    7.15 -  evarn	:: "[prog, state, var  , vvar        , nat, state] => bool"
    7.16 -				("_|-_ -_=>_-_-> _" [61,61,90,61,61,61] 60)
    7.17 -  eval_n:: "[prog, state, expr , val         , nat, state] => bool"
    7.18 -				("_|-_ -_->_-_-> _" [61,61,80,61,61,61] 60)
    7.19 -  evalsn:: "[prog, state, expr list, val list, nat, state] => bool"
    7.20 -				("_|-_ -_#>_-_-> _" [61,61,61,61,61,61] 60)
    7.21 -  execn	:: "[prog, state, stmt ,               nat, state] => bool"
    7.22 -				("_|-_ -_-_-> _"    [61,61,65,   61,61] 60)
    7.23 -
    7.24 -syntax (xsymbols)
    7.25 +inductive2
    7.26 +  evaln	:: "[prog, state, term, nat, vals, state] \<Rightarrow> bool"
    7.27 +    ("_\<turnstile>_ \<midarrow>_\<succ>\<midarrow>_\<rightarrow> '(_, _')" [61,61,80,61,0,0] 60)
    7.28 +  and evarn :: "[prog, state, var, vvar, nat, state] \<Rightarrow> bool"
    7.29 +    ("_\<turnstile>_ \<midarrow>_=\<succ>_\<midarrow>_\<rightarrow> _" [61,61,90,61,61,61] 60)
    7.30 +  and eval_n:: "[prog, state, expr, val, nat, state] \<Rightarrow> bool"
    7.31 +    ("_\<turnstile>_ \<midarrow>_-\<succ>_\<midarrow>_\<rightarrow> _" [61,61,80,61,61,61] 60)
    7.32 +  and evalsn :: "[prog, state, expr list, val  list, nat, state] \<Rightarrow> bool"
    7.33 +    ("_\<turnstile>_ \<midarrow>_\<doteq>\<succ>_\<midarrow>_\<rightarrow> _" [61,61,61,61,61,61] 60)
    7.34 +  and execn	:: "[prog, state, stmt, nat, state] \<Rightarrow> bool"
    7.35 +    ("_\<turnstile>_ \<midarrow>_\<midarrow>_\<rightarrow> _"     [61,61,65,   61,61] 60)
    7.36 +  for G :: prog
    7.37 +where
    7.38  
    7.39 -  evaln	:: "[prog, state, term,         nat, vals \<times> state] \<Rightarrow> bool"
    7.40 -				("_\<turnstile>_ \<midarrow>_\<succ>\<midarrow>_\<rightarrow> _"   [61,61,80,   61,61] 60)
    7.41 -  evarn	:: "[prog, state, var  , vvar         , nat, state] \<Rightarrow> bool"
    7.42 -				("_\<turnstile>_ \<midarrow>_=\<succ>_\<midarrow>_\<rightarrow> _" [61,61,90,61,61,61] 60)
    7.43 -  eval_n:: "[prog, state, expr , val ,          nat, state] \<Rightarrow> bool"
    7.44 -				("_\<turnstile>_ \<midarrow>_-\<succ>_\<midarrow>_\<rightarrow> _" [61,61,80,61,61,61] 60)
    7.45 -  evalsn:: "[prog, state, expr list, val  list, nat, state] \<Rightarrow> bool"
    7.46 -				("_\<turnstile>_ \<midarrow>_\<doteq>\<succ>_\<midarrow>_\<rightarrow> _" [61,61,61,61,61,61] 60)
    7.47 -  execn	:: "[prog, state, stmt ,                nat, state] \<Rightarrow> bool"
    7.48 -				("_\<turnstile>_ \<midarrow>_\<midarrow>_\<rightarrow> _"     [61,61,65,   61,61] 60)
    7.49 -
    7.50 -translations
    7.51 -
    7.52 -  "G\<turnstile>s \<midarrow>t    \<succ>\<midarrow>n\<rightarrow>  w___s' " == "(s,t,n,w___s') \<in> evaln G"
    7.53 -  "G\<turnstile>s \<midarrow>t    \<succ>\<midarrow>n\<rightarrow> (w,  s')" <= "(s,t,n,w,  s') \<in> evaln G"
    7.54 -  "G\<turnstile>s \<midarrow>t    \<succ>\<midarrow>n\<rightarrow> (w,x,s')" <= "(s,t,n,w,x,s') \<in> evaln G"
    7.55 -  "G\<turnstile>s \<midarrow>c     \<midarrow>n\<rightarrow> (x,s')" <= "G\<turnstile>s \<midarrow>In1r  c\<succ>\<midarrow>n\<rightarrow> (\<diamondsuit>    ,x,s')"
    7.56 -  "G\<turnstile>s \<midarrow>c     \<midarrow>n\<rightarrow>    s' " == "G\<turnstile>s \<midarrow>In1r  c\<succ>\<midarrow>n\<rightarrow> (\<diamondsuit>    ,  s')"
    7.57 -  "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')"
    7.58 -  "G\<turnstile>s \<midarrow>e-\<succ>v  \<midarrow>n\<rightarrow>    s' " == "G\<turnstile>s \<midarrow>In1l e\<succ>\<midarrow>n\<rightarrow> (In1 v ,  s')"
    7.59 -  "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')"
    7.60 -  "G\<turnstile>s \<midarrow>e=\<succ>vf \<midarrow>n\<rightarrow>    s' " == "G\<turnstile>s \<midarrow>In2  e\<succ>\<midarrow>n\<rightarrow> (In2 vf,  s')"
    7.61 -  "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')"
    7.62 -  "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')"
    7.63 -
    7.64 -
    7.65 -inductive "evaln G" intros
    7.66 +  "G\<turnstile>s \<midarrow>c     \<midarrow>n\<rightarrow>    s' \<equiv> G\<turnstile>s \<midarrow>In1r  c\<succ>\<midarrow>n\<rightarrow> (\<diamondsuit>    ,  s')"
    7.67 +| "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')"
    7.68 +| "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')"
    7.69 +| "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')"
    7.70  
    7.71  --{* propagation of abrupt completion *}
    7.72  
    7.73 -  Abrupt:   "G\<turnstile>(Some xc,s) \<midarrow>t\<succ>\<midarrow>n\<rightarrow> (arbitrary3 t,(Some xc,s))"
    7.74 +| Abrupt:   "G\<turnstile>(Some xc,s) \<midarrow>t\<succ>\<midarrow>n\<rightarrow> (arbitrary3 t,(Some xc,s))"
    7.75  
    7.76  
    7.77  --{* evaluation of variables *}
    7.78  
    7.79 -  LVar:	"G\<turnstile>Norm s \<midarrow>LVar vn=\<succ>lvar vn s\<midarrow>n\<rightarrow> Norm s"
    7.80 +| LVar:	"G\<turnstile>Norm s \<midarrow>LVar vn=\<succ>lvar vn s\<midarrow>n\<rightarrow> Norm s"
    7.81  
    7.82 -  FVar:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>Init statDeclC\<midarrow>n\<rightarrow> s1; G\<turnstile>s1 \<midarrow>e-\<succ>a\<midarrow>n\<rightarrow> s2;
    7.83 +| FVar:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>Init statDeclC\<midarrow>n\<rightarrow> s1; G\<turnstile>s1 \<midarrow>e-\<succ>a\<midarrow>n\<rightarrow> s2;
    7.84  	  (v,s2') = fvar statDeclC stat fn a s2;
    7.85            s3 = check_field_access G accC statDeclC fn stat a s2'\<rbrakk> \<Longrightarrow>
    7.86  	  G\<turnstile>Norm s0 \<midarrow>{accC,statDeclC,stat}e..fn=\<succ>v\<midarrow>n\<rightarrow> s3"
    7.87  
    7.88 -  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; 
    7.89 +| 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; 
    7.90  	  (v,s2') = avar G i a s2\<rbrakk> \<Longrightarrow>
    7.91  	              G\<turnstile>Norm s0 \<midarrow>e1.[e2]=\<succ>v\<midarrow>n\<rightarrow> s2'"
    7.92  
    7.93 @@ -98,46 +70,46 @@
    7.94  
    7.95  --{* evaluation of expressions *}
    7.96  
    7.97 -  NewC:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>Init C\<midarrow>n\<rightarrow> s1;
    7.98 +| NewC:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>Init C\<midarrow>n\<rightarrow> s1;
    7.99  	  G\<turnstile>     s1 \<midarrow>halloc (CInst C)\<succ>a\<rightarrow> s2\<rbrakk> \<Longrightarrow>
   7.100  	                          G\<turnstile>Norm s0 \<midarrow>NewC C-\<succ>Addr a\<midarrow>n\<rightarrow> s2"
   7.101  
   7.102 -  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; 
   7.103 +| 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; 
   7.104  	  G\<turnstile>abupd (check_neg i') s2 \<midarrow>halloc (Arr T (the_Intg i'))\<succ>a\<rightarrow> s3\<rbrakk> \<Longrightarrow>
   7.105  	                        G\<turnstile>Norm s0 \<midarrow>New T[e]-\<succ>Addr a\<midarrow>n\<rightarrow> s3"
   7.106  
   7.107 -  Cast:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<midarrow>n\<rightarrow> s1;
   7.108 +| Cast:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<midarrow>n\<rightarrow> s1;
   7.109  	  s2 = abupd (raise_if (\<not>G,snd s1\<turnstile>v fits T) ClassCast) s1\<rbrakk> \<Longrightarrow>
   7.110  			        G\<turnstile>Norm s0 \<midarrow>Cast T e-\<succ>v\<midarrow>n\<rightarrow> s2"
   7.111  
   7.112 -  Inst:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<midarrow>n\<rightarrow> s1;
   7.113 +| Inst:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<midarrow>n\<rightarrow> s1;
   7.114  	  b = (v\<noteq>Null \<and> G,store s1\<turnstile>v fits RefT T)\<rbrakk> \<Longrightarrow>
   7.115  			      G\<turnstile>Norm s0 \<midarrow>e InstOf T-\<succ>Bool b\<midarrow>n\<rightarrow> s1"
   7.116  
   7.117 -  Lit:			   "G\<turnstile>Norm s \<midarrow>Lit v-\<succ>v\<midarrow>n\<rightarrow> Norm s"
   7.118 +| Lit:			   "G\<turnstile>Norm s \<midarrow>Lit v-\<succ>v\<midarrow>n\<rightarrow> Norm s"
   7.119  
   7.120 -  UnOp: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<midarrow>n\<rightarrow> s1\<rbrakk> 
   7.121 +| UnOp: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<midarrow>n\<rightarrow> s1\<rbrakk> 
   7.122           \<Longrightarrow> G\<turnstile>Norm s0 \<midarrow>UnOp unop e-\<succ>(eval_unop unop v)\<midarrow>n\<rightarrow> s1"
   7.123  
   7.124 -  BinOp: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e1-\<succ>v1\<midarrow>n\<rightarrow> s1; 
   7.125 +| BinOp: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e1-\<succ>v1\<midarrow>n\<rightarrow> s1; 
   7.126             G\<turnstile>s1 \<midarrow>(if need_second_arg binop v1 then (In1l e2) else (In1r Skip))
   7.127              \<succ>\<midarrow>n\<rightarrow> (In1 v2,s2)\<rbrakk> 
   7.128           \<Longrightarrow> G\<turnstile>Norm s0 \<midarrow>BinOp binop e1 e2-\<succ>(eval_binop binop v1 v2)\<midarrow>n\<rightarrow> s2"
   7.129  
   7.130 -  Super:		   "G\<turnstile>Norm s \<midarrow>Super-\<succ>val_this s\<midarrow>n\<rightarrow> Norm s"
   7.131 +| Super:		   "G\<turnstile>Norm s \<midarrow>Super-\<succ>val_this s\<midarrow>n\<rightarrow> Norm s"
   7.132  
   7.133 -  Acc:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>va=\<succ>(v,f)\<midarrow>n\<rightarrow> s1\<rbrakk> \<Longrightarrow>
   7.134 +| Acc:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>va=\<succ>(v,f)\<midarrow>n\<rightarrow> s1\<rbrakk> \<Longrightarrow>
   7.135  	                          G\<turnstile>Norm s0 \<midarrow>Acc va-\<succ>v\<midarrow>n\<rightarrow> s1"
   7.136  
   7.137 -  Ass:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>va=\<succ>(w,f)\<midarrow>n\<rightarrow> s1;
   7.138 +| Ass:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>va=\<succ>(w,f)\<midarrow>n\<rightarrow> s1;
   7.139            G\<turnstile>     s1 \<midarrow>e-\<succ>v     \<midarrow>n\<rightarrow> s2\<rbrakk> \<Longrightarrow>
   7.140  				   G\<turnstile>Norm s0 \<midarrow>va:=e-\<succ>v\<midarrow>n\<rightarrow> assign f v s2"
   7.141  
   7.142 -  Cond:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e0-\<succ>b\<midarrow>n\<rightarrow> s1;
   7.143 +| Cond:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e0-\<succ>b\<midarrow>n\<rightarrow> s1;
   7.144            G\<turnstile>     s1 \<midarrow>(if the_Bool b then e1 else e2)-\<succ>v\<midarrow>n\<rightarrow> s2\<rbrakk> \<Longrightarrow>
   7.145  			    G\<turnstile>Norm s0 \<midarrow>e0 ? e1 : e2-\<succ>v\<midarrow>n\<rightarrow> s2"
   7.146  
   7.147 -  Call:	
   7.148 +| Call:	
   7.149    "\<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;
   7.150      D = invocation_declclass G mode (store s2) a' statT \<lparr>name=mn,parTs=pTs\<rparr>; 
   7.151      s3=init_lvars G D \<lparr>name=mn,parTs=pTs\<rparr> mode a' vs s2;
   7.152 @@ -147,10 +119,10 @@
   7.153     \<Longrightarrow> 
   7.154      G\<turnstile>Norm s0 \<midarrow>{accC,statT,mode}e\<cdot>mn({pTs}args)-\<succ>v\<midarrow>n\<rightarrow> (restore_lvars s2 s4)"
   7.155  
   7.156 -  Methd:"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>body G D sig-\<succ>v\<midarrow>n\<rightarrow> s1\<rbrakk> \<Longrightarrow>
   7.157 +| Methd:"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>body G D sig-\<succ>v\<midarrow>n\<rightarrow> s1\<rbrakk> \<Longrightarrow>
   7.158  				G\<turnstile>Norm s0 \<midarrow>Methd D sig-\<succ>v\<midarrow>Suc n\<rightarrow> s1"
   7.159  
   7.160 -  Body:	"\<lbrakk>G\<turnstile>Norm s0\<midarrow>Init D\<midarrow>n\<rightarrow> s1; G\<turnstile>s1 \<midarrow>c\<midarrow>n\<rightarrow> s2;
   7.161 +| Body:	"\<lbrakk>G\<turnstile>Norm s0\<midarrow>Init D\<midarrow>n\<rightarrow> s1; G\<turnstile>s1 \<midarrow>c\<midarrow>n\<rightarrow> s2;
   7.162            s3 = (if (\<exists> l. abrupt s2 = Some (Jump (Break l)) \<or>  
   7.163                           abrupt s2 = Some (Jump (Cont l)))
   7.164                    then abupd (\<lambda> x. Some (Error CrossMethodJump)) s2 
   7.165 @@ -160,57 +132,57 @@
   7.166  
   7.167  --{* evaluation of expression lists *}
   7.168  
   7.169 -  Nil:
   7.170 +| Nil:
   7.171  				"G\<turnstile>Norm s0 \<midarrow>[]\<doteq>\<succ>[]\<midarrow>n\<rightarrow> Norm s0"
   7.172  
   7.173 -  Cons:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e -\<succ> v \<midarrow>n\<rightarrow> s1;
   7.174 +| Cons:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e -\<succ> v \<midarrow>n\<rightarrow> s1;
   7.175            G\<turnstile>     s1 \<midarrow>es\<doteq>\<succ>vs\<midarrow>n\<rightarrow> s2\<rbrakk> \<Longrightarrow>
   7.176  			     G\<turnstile>Norm s0 \<midarrow>e#es\<doteq>\<succ>v#vs\<midarrow>n\<rightarrow> s2"
   7.177  
   7.178  
   7.179  --{* execution of statements *}
   7.180  
   7.181 -  Skip:	 			    "G\<turnstile>Norm s \<midarrow>Skip\<midarrow>n\<rightarrow> Norm s"
   7.182 +| Skip:	 			    "G\<turnstile>Norm s \<midarrow>Skip\<midarrow>n\<rightarrow> Norm s"
   7.183  
   7.184 -  Expr:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<midarrow>n\<rightarrow> s1\<rbrakk> \<Longrightarrow>
   7.185 +| Expr:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<midarrow>n\<rightarrow> s1\<rbrakk> \<Longrightarrow>
   7.186  				  G\<turnstile>Norm s0 \<midarrow>Expr e\<midarrow>n\<rightarrow> s1"
   7.187  
   7.188 -  Lab:  "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>c \<midarrow>n\<rightarrow> s1\<rbrakk> \<Longrightarrow>
   7.189 +| Lab:  "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>c \<midarrow>n\<rightarrow> s1\<rbrakk> \<Longrightarrow>
   7.190                               G\<turnstile>Norm s0 \<midarrow>l\<bullet> c\<midarrow>n\<rightarrow> abupd (absorb l) s1"
   7.191  
   7.192 -  Comp:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>c1 \<midarrow>n\<rightarrow> s1;
   7.193 +| Comp:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>c1 \<midarrow>n\<rightarrow> s1;
   7.194  	  G\<turnstile>     s1 \<midarrow>c2 \<midarrow>n\<rightarrow> s2\<rbrakk> \<Longrightarrow>
   7.195  				 G\<turnstile>Norm s0 \<midarrow>c1;; c2\<midarrow>n\<rightarrow> s2"
   7.196  
   7.197 -  If:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>b\<midarrow>n\<rightarrow> s1;
   7.198 +| If:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>b\<midarrow>n\<rightarrow> s1;
   7.199  	  G\<turnstile>     s1\<midarrow>(if the_Bool b then c1 else c2)\<midarrow>n\<rightarrow> s2\<rbrakk> \<Longrightarrow>
   7.200  		       G\<turnstile>Norm s0 \<midarrow>If(e) c1 Else c2 \<midarrow>n\<rightarrow> s2"
   7.201  
   7.202 -  Loop:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>b\<midarrow>n\<rightarrow> s1;
   7.203 +| Loop:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>b\<midarrow>n\<rightarrow> s1;
   7.204  	  if the_Bool b 
   7.205               then (G\<turnstile>s1 \<midarrow>c\<midarrow>n\<rightarrow> s2 \<and> 
   7.206                     G\<turnstile>(abupd (absorb (Cont l)) s2) \<midarrow>l\<bullet> While(e) c\<midarrow>n\<rightarrow> s3)
   7.207  	     else s3 = s1\<rbrakk> \<Longrightarrow>
   7.208  			      G\<turnstile>Norm s0 \<midarrow>l\<bullet> While(e) c\<midarrow>n\<rightarrow> s3"
   7.209    
   7.210 -  Jmp: "G\<turnstile>Norm s \<midarrow>Jmp j\<midarrow>n\<rightarrow> (Some (Jump j), s)"
   7.211 +| Jmp: "G\<turnstile>Norm s \<midarrow>Jmp j\<midarrow>n\<rightarrow> (Some (Jump j), s)"
   7.212    
   7.213 -  Throw:"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>a'\<midarrow>n\<rightarrow> s1\<rbrakk> \<Longrightarrow>
   7.214 +| Throw:"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>a'\<midarrow>n\<rightarrow> s1\<rbrakk> \<Longrightarrow>
   7.215  				 G\<turnstile>Norm s0 \<midarrow>Throw e\<midarrow>n\<rightarrow> abupd (throw a') s1"
   7.216  
   7.217 -  Try:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>c1\<midarrow>n\<rightarrow> s1; G\<turnstile>s1 \<midarrow>sxalloc\<rightarrow> s2;
   7.218 +| Try:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>c1\<midarrow>n\<rightarrow> s1; G\<turnstile>s1 \<midarrow>sxalloc\<rightarrow> s2;
   7.219  	  if G,s2\<turnstile>catch tn then G\<turnstile>new_xcpt_var vn s2 \<midarrow>c2\<midarrow>n\<rightarrow> s3 else s3 = s2\<rbrakk>
   7.220            \<Longrightarrow>
   7.221  		  G\<turnstile>Norm s0 \<midarrow>Try c1 Catch(tn vn) c2\<midarrow>n\<rightarrow> s3"
   7.222  
   7.223 -  Fin:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>c1\<midarrow>n\<rightarrow> (x1,s1);
   7.224 +| Fin:	"\<lbrakk>G\<turnstile>Norm s0 \<midarrow>c1\<midarrow>n\<rightarrow> (x1,s1);
   7.225  	  G\<turnstile>Norm s1 \<midarrow>c2\<midarrow>n\<rightarrow> s2;
   7.226            s3=(if (\<exists> err. x1=Some (Error err)) 
   7.227                then (x1,s1) 
   7.228                else abupd (abrupt_if (x1\<noteq>None) x1) s2)\<rbrakk> \<Longrightarrow>
   7.229                G\<turnstile>Norm s0 \<midarrow>c1 Finally c2\<midarrow>n\<rightarrow> s3"
   7.230    
   7.231 -  Init:	"\<lbrakk>the (class G C) = c;
   7.232 +| Init:	"\<lbrakk>the (class G C) = c;
   7.233  	  if inited C (globs s0) then s3 = Norm s0
   7.234  	  else (G\<turnstile>Norm (init_class_obj G C s0)
   7.235  	          \<midarrow>(if C = Object then Skip else Init (super c))\<midarrow>n\<rightarrow> s1 \<and>
   7.236 @@ -229,41 +201,41 @@
   7.237  ML_setup {*
   7.238  change_simpset (fn ss => ss delloop "split_all_tac");
   7.239  *}
   7.240 -inductive_cases evaln_cases: "G\<turnstile>s \<midarrow>t\<succ>\<midarrow>n\<rightarrow> vs'"
   7.241 +inductive_cases2 evaln_cases: "G\<turnstile>s \<midarrow>t\<succ>\<midarrow>n\<rightarrow> (v, s')"
   7.242  
   7.243 -inductive_cases evaln_elim_cases:
   7.244 -	"G\<turnstile>(Some xc, s) \<midarrow>t                        \<succ>\<midarrow>n\<rightarrow> vs'"
   7.245 -	"G\<turnstile>Norm s \<midarrow>In1r Skip                      \<succ>\<midarrow>n\<rightarrow> xs'"
   7.246 -        "G\<turnstile>Norm s \<midarrow>In1r (Jmp j)                   \<succ>\<midarrow>n\<rightarrow> xs'"
   7.247 -        "G\<turnstile>Norm s \<midarrow>In1r (l\<bullet> c)                    \<succ>\<midarrow>n\<rightarrow> xs'"
   7.248 -	"G\<turnstile>Norm s \<midarrow>In3  ([])                      \<succ>\<midarrow>n\<rightarrow> vs'"
   7.249 -	"G\<turnstile>Norm s \<midarrow>In3  (e#es)                    \<succ>\<midarrow>n\<rightarrow> vs'"
   7.250 -	"G\<turnstile>Norm s \<midarrow>In1l (Lit w)                   \<succ>\<midarrow>n\<rightarrow> vs'"
   7.251 -        "G\<turnstile>Norm s \<midarrow>In1l (UnOp unop e)             \<succ>\<midarrow>n\<rightarrow> vs'"
   7.252 -        "G\<turnstile>Norm s \<midarrow>In1l (BinOp binop e1 e2)       \<succ>\<midarrow>n\<rightarrow> vs'"
   7.253 -	"G\<turnstile>Norm s \<midarrow>In2  (LVar vn)                 \<succ>\<midarrow>n\<rightarrow> vs'"
   7.254 -	"G\<turnstile>Norm s \<midarrow>In1l (Cast T e)                \<succ>\<midarrow>n\<rightarrow> vs'"
   7.255 -	"G\<turnstile>Norm s \<midarrow>In1l (e InstOf T)              \<succ>\<midarrow>n\<rightarrow> vs'"
   7.256 -	"G\<turnstile>Norm s \<midarrow>In1l (Super)                   \<succ>\<midarrow>n\<rightarrow> vs'"
   7.257 -	"G\<turnstile>Norm s \<midarrow>In1l (Acc va)                  \<succ>\<midarrow>n\<rightarrow> vs'"
   7.258 -	"G\<turnstile>Norm s \<midarrow>In1r (Expr e)                  \<succ>\<midarrow>n\<rightarrow> xs'"
   7.259 -	"G\<turnstile>Norm s \<midarrow>In1r (c1;; c2)                 \<succ>\<midarrow>n\<rightarrow> xs'"
   7.260 -	"G\<turnstile>Norm s \<midarrow>In1l (Methd C sig)             \<succ>\<midarrow>n\<rightarrow> xs'"
   7.261 -	"G\<turnstile>Norm s \<midarrow>In1l (Body D c)                \<succ>\<midarrow>n\<rightarrow> xs'"
   7.262 -	"G\<turnstile>Norm s \<midarrow>In1l (e0 ? e1 : e2)            \<succ>\<midarrow>n\<rightarrow> vs'"
   7.263 -	"G\<turnstile>Norm s \<midarrow>In1r (If(e) c1 Else c2)        \<succ>\<midarrow>n\<rightarrow> xs'"
   7.264 -	"G\<turnstile>Norm s \<midarrow>In1r (l\<bullet> While(e) c)           \<succ>\<midarrow>n\<rightarrow> xs'"
   7.265 -	"G\<turnstile>Norm s \<midarrow>In1r (c1 Finally c2)           \<succ>\<midarrow>n\<rightarrow> xs'"
   7.266 -	"G\<turnstile>Norm s \<midarrow>In1r (Throw e)                 \<succ>\<midarrow>n\<rightarrow> xs'"
   7.267 -	"G\<turnstile>Norm s \<midarrow>In1l (NewC C)                  \<succ>\<midarrow>n\<rightarrow> vs'"
   7.268 -	"G\<turnstile>Norm s \<midarrow>In1l (New T[e])                \<succ>\<midarrow>n\<rightarrow> vs'"
   7.269 -	"G\<turnstile>Norm s \<midarrow>In1l (Ass va e)                \<succ>\<midarrow>n\<rightarrow> vs'"
   7.270 -	"G\<turnstile>Norm s \<midarrow>In1r (Try c1 Catch(tn vn) c2)  \<succ>\<midarrow>n\<rightarrow> xs'"
   7.271 -	"G\<turnstile>Norm s \<midarrow>In2  ({accC,statDeclC,stat}e..fn) \<succ>\<midarrow>n\<rightarrow> vs'"
   7.272 -	"G\<turnstile>Norm s \<midarrow>In2  (e1.[e2])                 \<succ>\<midarrow>n\<rightarrow> vs'"
   7.273 -	"G\<turnstile>Norm s \<midarrow>In1l ({accC,statT,mode}e\<cdot>mn({pT}p)) \<succ>\<midarrow>n\<rightarrow> vs'"
   7.274 -	"G\<turnstile>Norm s \<midarrow>In1r (Init C)                  \<succ>\<midarrow>n\<rightarrow> xs'"
   7.275 -        "G\<turnstile>Norm s \<midarrow>In1r (Init C)                  \<succ>\<midarrow>n\<rightarrow> xs'"
   7.276 +inductive_cases2 evaln_elim_cases:
   7.277 +	"G\<turnstile>(Some xc, s) \<midarrow>t                        \<succ>\<midarrow>n\<rightarrow> (v, s')"
   7.278 +	"G\<turnstile>Norm s \<midarrow>In1r Skip                      \<succ>\<midarrow>n\<rightarrow> (x, s')"
   7.279 +        "G\<turnstile>Norm s \<midarrow>In1r (Jmp j)                   \<succ>\<midarrow>n\<rightarrow> (x, s')"
   7.280 +        "G\<turnstile>Norm s \<midarrow>In1r (l\<bullet> c)                    \<succ>\<midarrow>n\<rightarrow> (x, s')"
   7.281 +	"G\<turnstile>Norm s \<midarrow>In3  ([])                      \<succ>\<midarrow>n\<rightarrow> (v, s')"
   7.282 +	"G\<turnstile>Norm s \<midarrow>In3  (e#es)                    \<succ>\<midarrow>n\<rightarrow> (v, s')"
   7.283 +	"G\<turnstile>Norm s \<midarrow>In1l (Lit w)                   \<succ>\<midarrow>n\<rightarrow> (v, s')"
   7.284 +        "G\<turnstile>Norm s \<midarrow>In1l (UnOp unop e)             \<succ>\<midarrow>n\<rightarrow> (v, s')"
   7.285 +        "G\<turnstile>Norm s \<midarrow>In1l (BinOp binop e1 e2)       \<succ>\<midarrow>n\<rightarrow> (v, s')"
   7.286 +	"G\<turnstile>Norm s \<midarrow>In2  (LVar vn)                 \<succ>\<midarrow>n\<rightarrow> (v, s')"
   7.287 +	"G\<turnstile>Norm s \<midarrow>In1l (Cast T e)                \<succ>\<midarrow>n\<rightarrow> (v, s')"
   7.288 +	"G\<turnstile>Norm s \<midarrow>In1l (e InstOf T)              \<succ>\<midarrow>n\<rightarrow> (v, s')"
   7.289 +	"G\<turnstile>Norm s \<midarrow>In1l (Super)                   \<succ>\<midarrow>n\<rightarrow> (v, s')"
   7.290 +	"G\<turnstile>Norm s \<midarrow>In1l (Acc va)                  \<succ>\<midarrow>n\<rightarrow> (v, s')"
   7.291 +	"G\<turnstile>Norm s \<midarrow>In1r (Expr e)                  \<succ>\<midarrow>n\<rightarrow> (x, s')"
   7.292 +	"G\<turnstile>Norm s \<midarrow>In1r (c1;; c2)                 \<succ>\<midarrow>n\<rightarrow> (x, s')"
   7.293 +	"G\<turnstile>Norm s \<midarrow>In1l (Methd C sig)             \<succ>\<midarrow>n\<rightarrow> (x, s')"
   7.294 +	"G\<turnstile>Norm s \<midarrow>In1l (Body D c)                \<succ>\<midarrow>n\<rightarrow> (x, s')"
   7.295 +	"G\<turnstile>Norm s \<midarrow>In1l (e0 ? e1 : e2)            \<succ>\<midarrow>n\<rightarrow> (v, s')"
   7.296 +	"G\<turnstile>Norm s \<midarrow>In1r (If(e) c1 Else c2)        \<succ>\<midarrow>n\<rightarrow> (x, s')"
   7.297 +	"G\<turnstile>Norm s \<midarrow>In1r (l\<bullet> While(e) c)           \<succ>\<midarrow>n\<rightarrow> (x, s')"
   7.298 +	"G\<turnstile>Norm s \<midarrow>In1r (c1 Finally c2)           \<succ>\<midarrow>n\<rightarrow> (x, s')"
   7.299 +	"G\<turnstile>Norm s \<midarrow>In1r (Throw e)                 \<succ>\<midarrow>n\<rightarrow> (x, s')"
   7.300 +	"G\<turnstile>Norm s \<midarrow>In1l (NewC C)                  \<succ>\<midarrow>n\<rightarrow> (v, s')"
   7.301 +	"G\<turnstile>Norm s \<midarrow>In1l (New T[e])                \<succ>\<midarrow>n\<rightarrow> (v, s')"
   7.302 +	"G\<turnstile>Norm s \<midarrow>In1l (Ass va e)                \<succ>\<midarrow>n\<rightarrow> (v, s')"
   7.303 +	"G\<turnstile>Norm s \<midarrow>In1r (Try c1 Catch(tn vn) c2)  \<succ>\<midarrow>n\<rightarrow> (x, s')"
   7.304 +	"G\<turnstile>Norm s \<midarrow>In2  ({accC,statDeclC,stat}e..fn) \<succ>\<midarrow>n\<rightarrow> (v, s')"
   7.305 +	"G\<turnstile>Norm s \<midarrow>In2  (e1.[e2])                 \<succ>\<midarrow>n\<rightarrow> (v, s')"
   7.306 +	"G\<turnstile>Norm s \<midarrow>In1l ({accC,statT,mode}e\<cdot>mn({pT}p)) \<succ>\<midarrow>n\<rightarrow> (v, s')"
   7.307 +	"G\<turnstile>Norm s \<midarrow>In1r (Init C)                  \<succ>\<midarrow>n\<rightarrow> (x, s')"
   7.308 +        "G\<turnstile>Norm s \<midarrow>In1r (Init C)                  \<succ>\<midarrow>n\<rightarrow> (x, s')"
   7.309  
   7.310  declare split_if     [split] split_if_asm     [split] 
   7.311          option.split [split] option.split_asm [split]
   7.312 @@ -288,25 +260,32 @@
   7.313   (injection @{term In1} into generalised values @{term vals}). 
   7.314  *}
   7.315  
   7.316 +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')"
   7.317 +  by (auto, frule evaln_Inj_elim, auto)
   7.318 +
   7.319 +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')"
   7.320 +  by (auto, frule evaln_Inj_elim, auto)
   7.321 +
   7.322 +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')"
   7.323 +  by (auto, frule evaln_Inj_elim, auto)
   7.324 +
   7.325 +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')"
   7.326 +  by (auto, frule evaln_Inj_elim, auto, frule evaln_Inj_elim, auto)
   7.327 +
   7.328  ML_setup {*
   7.329 -fun enf nam inj rhs =
   7.330 +fun enf name lhs =
   7.331  let
   7.332 -  val name = "evaln_" ^ nam ^ "_eq"
   7.333 -  val lhs = "G\<turnstile>s \<midarrow>" ^ inj ^ " t\<succ>\<midarrow>n\<rightarrow> (w, s')"
   7.334 -  val () = qed_goal name (the_context()) (lhs ^ " = (" ^ rhs ^ ")") 
   7.335 -	(K [Auto_tac, ALLGOALS (ftac (thm "evaln_Inj_elim")) THEN Auto_tac])
   7.336    fun is_Inj (Const (inj,_) $ _) = true
   7.337      | is_Inj _                   = false
   7.338 -  fun pred (_ $ (Const ("Pair",_) $ _ $ (Const ("Pair", _) $ _ $ 
   7.339 -    (Const ("Pair", _) $ _ $ (Const ("Pair", _) $ x $ _ )))) $ _ ) = is_Inj x
   7.340 +  fun pred (_ $ _ $ _ $ _ $ _ $ x $ _) = is_Inj x
   7.341  in
   7.342    cond_simproc name lhs pred (thm name)
   7.343  end;
   7.344  
   7.345 -val evaln_expr_proc = enf "expr" "In1l" "\<exists>v.  w=In1 v  \<and> G\<turnstile>s \<midarrow>t-\<succ>v \<midarrow>n\<rightarrow> s'";
   7.346 -val evaln_var_proc  = enf "var"  "In2"  "\<exists>vf. w=In2 vf \<and> G\<turnstile>s \<midarrow>t=\<succ>vf\<midarrow>n\<rightarrow> s'";
   7.347 -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'";
   7.348 -val evaln_stmt_proc = enf "stmt" "In1r" "     w=\<diamondsuit>      \<and> G\<turnstile>s \<midarrow>t     \<midarrow>n\<rightarrow> s'";
   7.349 +val evaln_expr_proc  = enf "evaln_expr_eq"  "G\<turnstile>s \<midarrow>In1l t\<succ>\<midarrow>n\<rightarrow> (w, s')";
   7.350 +val evaln_var_proc   = enf "evaln_var_eq"   "G\<turnstile>s \<midarrow>In2 t\<succ>\<midarrow>n\<rightarrow> (w, s')";
   7.351 +val evaln_exprs_proc = enf "evaln_exprs_eq" "G\<turnstile>s \<midarrow>In3 t\<succ>\<midarrow>n\<rightarrow> (w, s')";
   7.352 +val evaln_stmt_proc  = enf "evaln_stmt_eq"  "G\<turnstile>s \<midarrow>In1r t\<succ>\<midarrow>n\<rightarrow> (w, s')";
   7.353  Addsimprocs [evaln_expr_proc,evaln_var_proc,evaln_exprs_proc,evaln_stmt_proc];
   7.354  
   7.355  bind_thms ("evaln_AbruptIs", sum3_instantiate (thm "evaln.Abrupt"))
   7.356 @@ -319,9 +298,7 @@
   7.357      assume eval: "G\<turnstile>s \<midarrow>t\<succ>\<midarrow>n\<rightarrow> (v,s')" and
   7.358           normal: "normal s" and
   7.359           callee: "t=In1l (Callee l e)"
   7.360 -    then have "False"
   7.361 -    proof (induct)
   7.362 -    qed (auto)
   7.363 +    then have "False" by induct auto
   7.364    }
   7.365    then show ?thesis
   7.366      by (cases s') fastsimp 
   7.367 @@ -333,9 +310,7 @@
   7.368      assume eval: "G\<turnstile>s \<midarrow>t\<succ>\<midarrow>n\<rightarrow> (v,s')" and
   7.369           normal: "normal s" and
   7.370           callee: "t=In1l (InsInitE c e)"
   7.371 -    then have "False"
   7.372 -    proof (induct)
   7.373 -    qed (auto)
   7.374 +    then have "False" by induct auto
   7.375    }
   7.376    then show ?thesis
   7.377      by (cases s') fastsimp
   7.378 @@ -347,9 +322,7 @@
   7.379      assume eval: "G\<turnstile>s \<midarrow>t\<succ>\<midarrow>n\<rightarrow> (v,s')" and
   7.380           normal: "normal s" and
   7.381           callee: "t=In2 (InsInitV c w)"
   7.382 -    then have "False"
   7.383 -    proof (induct)
   7.384 -    qed (auto)
   7.385 +    then have "False" by induct auto
   7.386    }  
   7.387    then show ?thesis
   7.388      by (cases s') fastsimp
   7.389 @@ -361,9 +334,7 @@
   7.390      assume eval: "G\<turnstile>s \<midarrow>t\<succ>\<midarrow>n\<rightarrow> (v,s')" and
   7.391           normal: "normal s" and
   7.392           callee: "t=In1r (FinA a c)"
   7.393 -    then have "False"
   7.394 -    proof (induct)
   7.395 -    qed (auto)
   7.396 +    then have "False" by induct auto
   7.397    } 
   7.398    then show ?thesis
   7.399      by (cases s') fastsimp
   7.400 @@ -385,9 +356,7 @@
   7.401  local
   7.402    fun is_Some (Const ("Pair",_) $ (Const ("Datatype.option.Some",_) $ _)$ _) =true
   7.403      | is_Some _ = false
   7.404 -  fun pred (_ $ (Const ("Pair",_) $
   7.405 -     _ $ (Const ("Pair", _) $ _ $ (Const ("Pair", _) $ _ $
   7.406 -       (Const ("Pair", _) $ _ $ x)))) $ _ ) = is_Some x
   7.407 +  fun pred (_ $ _ $ _ $ _ $ _ $ _ $ x) = is_Some x
   7.408  in
   7.409    val evaln_abrupt_proc = 
   7.410   cond_simproc "evaln_abrupt" "G\<turnstile>(Some xc,s) \<midarrow>e\<succ>\<midarrow>n\<rightarrow> (w,s')" pred (thm "evaln_abrupt")
   7.411 @@ -440,7 +409,7 @@
   7.412    shows "G\<turnstile>s0 \<midarrow>t\<succ>\<rightarrow> (v,s1)"
   7.413  using evaln 
   7.414  proof (induct)
   7.415 -  case (Loop b c e l n s0 s1 s2 s3)
   7.416 +  case (Loop s0 e n b s1 c s2 l s3)
   7.417    have "G\<turnstile>Norm s0 \<midarrow>e-\<succ>b\<rightarrow> s1".
   7.418    moreover
   7.419    have "if the_Bool b
   7.420 @@ -450,7 +419,7 @@
   7.421      using Loop.hyps by simp
   7.422    ultimately show ?case by (rule eval.Loop)
   7.423  next
   7.424 -  case (Try c1 c2 n s0 s1 s2 s3 C vn)
   7.425 +  case (Try s0 c1 n s1 s2 C vn c2 s3)
   7.426    have "G\<turnstile>Norm s0 \<midarrow>c1\<rightarrow> s1".
   7.427    moreover
   7.428    have "G\<turnstile>s1 \<midarrow>sxalloc\<rightarrow> s2".
   7.429 @@ -459,7 +428,7 @@
   7.430      using Try.hyps by simp
   7.431    ultimately show ?case by (rule eval.Try)
   7.432  next
   7.433 -  case (Init C c n s0 s1 s2 s3)
   7.434 +  case (Init C c s0 s3 n s1 s2)
   7.435    have "the (class G C) = c".
   7.436    moreover
   7.437    have "if inited C (globs s0) 
   7.438 @@ -478,8 +447,7 @@
   7.439  done
   7.440  
   7.441  lemma evaln_nonstrict [rule_format (no_asm), elim]: 
   7.442 -  "\<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"
   7.443 -apply (simp (no_asm_simp) only: split_tupled_all)
   7.444 +  "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')"
   7.445  apply (erule evaln.induct)
   7.446  apply (tactic {* ALLGOALS (EVERY'[strip_tac, TRY o etac (thm "Suc_le_D_lemma"),
   7.447    REPEAT o smp_tac 1, 
   7.448 @@ -490,30 +458,30 @@
   7.449  
   7.450  lemmas evaln_nonstrict_Suc = evaln_nonstrict [OF _ le_refl [THEN le_SucI]]
   7.451  
   7.452 -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> 
   7.453 -             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"
   7.454 +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> 
   7.455 +             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')"
   7.456  by (fast intro: le_maxI1 le_maxI2)
   7.457  
   7.458  corollary evaln_max2E [consumes 2]:
   7.459 -  "\<lbrakk>G\<turnstile>s1 \<midarrow>t1\<succ>\<midarrow>n1\<rightarrow> ws1; G\<turnstile>s2 \<midarrow>t2\<succ>\<midarrow>n2\<rightarrow> ws2; 
   7.460 -    \<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"
   7.461 +  "\<lbrakk>G\<turnstile>s1 \<midarrow>t1\<succ>\<midarrow>n1\<rightarrow> (w1, s1'); G\<turnstile>s2 \<midarrow>t2\<succ>\<midarrow>n2\<rightarrow> (w2, s2'); 
   7.462 +    \<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"
   7.463  by (drule (1) evaln_max2) simp
   7.464  
   7.465  
   7.466  lemma evaln_max3: 
   7.467 -"\<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>
   7.468 - G\<turnstile>s1 \<midarrow>t1\<succ>\<midarrow>max (max n1 n2) n3\<rightarrow> ws1 \<and>
   7.469 - G\<turnstile>s2 \<midarrow>t2\<succ>\<midarrow>max (max n1 n2) n3\<rightarrow> ws2 \<and> 
   7.470 - G\<turnstile>s3 \<midarrow>t3\<succ>\<midarrow>max (max n1 n2) n3\<rightarrow> ws3"
   7.471 +"\<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>
   7.472 + G\<turnstile>s1 \<midarrow>t1\<succ>\<midarrow>max (max n1 n2) n3\<rightarrow> (w1, s1') \<and>
   7.473 + G\<turnstile>s2 \<midarrow>t2\<succ>\<midarrow>max (max n1 n2) n3\<rightarrow> (w2, s2') \<and> 
   7.474 + G\<turnstile>s3 \<midarrow>t3\<succ>\<midarrow>max (max n1 n2) n3\<rightarrow> (w3, s3')"
   7.475  apply (drule (1) evaln_max2, erule thin_rl)
   7.476  apply (fast intro!: le_maxI1 le_maxI2)
   7.477  done
   7.478  
   7.479  corollary evaln_max3E: 
   7.480 -"\<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;
   7.481 -   \<lbrakk>G\<turnstile>s1 \<midarrow>t1\<succ>\<midarrow>max (max n1 n2) n3\<rightarrow> ws1;
   7.482 -    G\<turnstile>s2 \<midarrow>t2\<succ>\<midarrow>max (max n1 n2) n3\<rightarrow> ws2; 
   7.483 -    G\<turnstile>s3 \<midarrow>t3\<succ>\<midarrow>max (max n1 n2) n3\<rightarrow> ws3
   7.484 +"\<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');
   7.485 +   \<lbrakk>G\<turnstile>s1 \<midarrow>t1\<succ>\<midarrow>max (max n1 n2) n3\<rightarrow> (w1, s1');
   7.486 +    G\<turnstile>s2 \<midarrow>t2\<succ>\<midarrow>max (max n1 n2) n3\<rightarrow> (w2, s2'); 
   7.487 +    G\<turnstile>s3 \<midarrow>t3\<succ>\<midarrow>max (max n1 n2) n3\<rightarrow> (w3, s3')
   7.488     \<rbrakk> \<Longrightarrow> P
   7.489    \<rbrakk> \<Longrightarrow> P"
   7.490  by (drule (2) evaln_max3) simp
   7.491 @@ -551,16 +519,16 @@
   7.492    shows  "\<exists>n. G\<turnstile>s0 \<midarrow>t\<succ>\<midarrow>n\<rightarrow> (v,s1)"
   7.493  using eval 
   7.494  proof (induct)
   7.495 -  case (Abrupt s t xc)
   7.496 +  case (Abrupt xc s t)
   7.497    obtain n where
   7.498 -    "G\<turnstile>(Some xc, s) \<midarrow>t\<succ>\<midarrow>n\<rightarrow> (arbitrary3 t, Some xc, s)"
   7.499 +    "G\<turnstile>(Some xc, s) \<midarrow>t\<succ>\<midarrow>n\<rightarrow> (arbitrary3 t, (Some xc, s))"
   7.500      by (iprover intro: evaln.Abrupt)
   7.501    then show ?case ..
   7.502  next
   7.503    case Skip
   7.504    show ?case by (blast intro: evaln.Skip)
   7.505  next
   7.506 -  case (Expr e s0 s1 v)
   7.507 +  case (Expr s0 e v s1)
   7.508    then obtain n where
   7.509      "G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<midarrow>n\<rightarrow> s1"
   7.510      by (iprover)
   7.511 @@ -568,7 +536,7 @@
   7.512      by (rule evaln.Expr) 
   7.513    then show ?case ..
   7.514  next
   7.515 -  case (Lab c l s0 s1)
   7.516 +  case (Lab s0 c s1 l)
   7.517    then obtain n where
   7.518      "G\<turnstile>Norm s0 \<midarrow>c\<midarrow>n\<rightarrow> s1"
   7.519      by (iprover)
   7.520 @@ -576,7 +544,7 @@
   7.521      by (rule evaln.Lab)
   7.522    then show ?case ..
   7.523  next
   7.524 -  case (Comp c1 c2 s0 s1 s2)
   7.525 +  case (Comp s0 c1 s1 c2 s2)
   7.526    then obtain n1 n2 where
   7.527      "G\<turnstile>Norm s0 \<midarrow>c1\<midarrow>n1\<rightarrow> s1"
   7.528      "G\<turnstile>s1 \<midarrow>c2\<midarrow>n2\<rightarrow> s2"
   7.529 @@ -585,7 +553,7 @@
   7.530      by (blast intro: evaln.Comp dest: evaln_max2 )
   7.531    then show ?case ..
   7.532  next
   7.533 -  case (If b c1 c2 e s0 s1 s2)
   7.534 +  case (If s0 e b s1 c1 c2 s2)
   7.535    then obtain n1 n2 where
   7.536      "G\<turnstile>Norm s0 \<midarrow>e-\<succ>b\<midarrow>n1\<rightarrow> s1"
   7.537      "G\<turnstile>s1 \<midarrow>(if the_Bool b then c1 else c2)\<midarrow>n2\<rightarrow> s2"
   7.538 @@ -594,7 +562,7 @@
   7.539      by (blast intro: evaln.If dest: evaln_max2)
   7.540    then show ?case ..
   7.541  next
   7.542 -  case (Loop b c e l s0 s1 s2 s3)
   7.543 +  case (Loop s0 e b s1 c s2 l s3)
   7.544    from Loop.hyps obtain n1 where
   7.545      "G\<turnstile>Norm s0 \<midarrow>e-\<succ>b\<midarrow>n1\<rightarrow> s1"
   7.546      by (iprover)
   7.547 @@ -614,12 +582,12 @@
   7.548      done
   7.549    then show ?case ..
   7.550  next
   7.551 -  case (Jmp j s)
   7.552 +  case (Jmp s j)
   7.553    have "G\<turnstile>Norm s \<midarrow>Jmp j\<midarrow>n\<rightarrow> (Some (Jump j), s)"
   7.554      by (rule evaln.Jmp)
   7.555    then show ?case ..
   7.556  next
   7.557 -  case (Throw a e s0 s1)
   7.558 +  case (Throw s0 e a s1)
   7.559    then obtain n where
   7.560      "G\<turnstile>Norm s0 \<midarrow>e-\<succ>a\<midarrow>n\<rightarrow> s1"
   7.561      by (iprover)
   7.562 @@ -627,7 +595,7 @@
   7.563      by (rule evaln.Throw)
   7.564    then show ?case ..
   7.565  next 
   7.566 -  case (Try catchC c1 c2 s0 s1 s2 s3 vn)
   7.567 +  case (Try s0 c1 s1 s2 catchC vn c2 s3)
   7.568    from Try.hyps obtain n1 where
   7.569      "G\<turnstile>Norm s0 \<midarrow>c1\<midarrow>n1\<rightarrow> s1"
   7.570      by (iprover)
   7.571 @@ -642,7 +610,7 @@
   7.572      by (auto intro!: evaln.Try le_maxI1 le_maxI2)
   7.573    then show ?case ..
   7.574  next
   7.575 -  case (Fin c1 c2 s0 s1 s2 s3 x1)
   7.576 +  case (Fin s0 c1 x1 s1 c2 s2 s3)
   7.577    from Fin obtain n1 n2 where 
   7.578      "G\<turnstile>Norm s0 \<midarrow>c1\<midarrow>n1\<rightarrow> (x1, s1)"
   7.579      "G\<turnstile>Norm s1 \<midarrow>c2\<midarrow>n2\<rightarrow> s2"
   7.580 @@ -657,7 +625,7 @@
   7.581      by (blast intro: evaln.Fin dest: evaln_max2)
   7.582    then show ?case ..
   7.583  next
   7.584 -  case (Init C c s0 s1 s2 s3)
   7.585 +  case (Init C c s0 s3 s1 s2)
   7.586    have     cls: "the (class G C) = c" .
   7.587    moreover from Init.hyps obtain n where
   7.588        "if inited C (globs s0) then s3 = Norm s0
   7.589 @@ -670,7 +638,7 @@
   7.590      by (rule evaln.Init)
   7.591    then show ?case ..
   7.592  next
   7.593 -  case (NewC C a s0 s1 s2)
   7.594 +  case (NewC s0 C s1 a s2)
   7.595    then obtain n where 
   7.596      "G\<turnstile>Norm s0 \<midarrow>Init C\<midarrow>n\<rightarrow> s1"
   7.597      by (iprover)
   7.598 @@ -679,7 +647,7 @@
   7.599      by (iprover intro: evaln.NewC)
   7.600    then show ?case ..
   7.601  next
   7.602 -  case (NewA T a e i s0 s1 s2 s3)
   7.603 +  case (NewA s0 T s1 e i s2 a s3)
   7.604    then obtain n1 n2 where 
   7.605      "G\<turnstile>Norm s0 \<midarrow>init_comp_ty T\<midarrow>n1\<rightarrow> s1"
   7.606      "G\<turnstile>s1 \<midarrow>e-\<succ>i\<midarrow>n2\<rightarrow> s2"      
   7.607 @@ -691,7 +659,7 @@
   7.608      by (blast intro: evaln.NewA dest: evaln_max2)
   7.609    then show ?case ..
   7.610  next
   7.611 -  case (Cast castT e s0 s1 s2 v)
   7.612 +  case (Cast s0 e v s1 s2 castT)
   7.613    then obtain n where
   7.614      "G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<midarrow>n\<rightarrow> s1"
   7.615      by (iprover)
   7.616 @@ -702,7 +670,7 @@
   7.617      by (rule evaln.Cast)
   7.618    then show ?case ..
   7.619  next
   7.620 -  case (Inst T b e s0 s1 v)
   7.621 +  case (Inst s0 e v s1 b T)
   7.622    then obtain n where
   7.623      "G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<midarrow>n\<rightarrow> s1"
   7.624      by (iprover)
   7.625 @@ -718,7 +686,7 @@
   7.626      by (rule evaln.Lit)
   7.627    then show ?case ..
   7.628  next
   7.629 -  case (UnOp e s0 s1 unop v )
   7.630 +  case (UnOp s0 e v s1 unop)
   7.631    then obtain n where
   7.632      "G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<midarrow>n\<rightarrow> s1"
   7.633      by (iprover)
   7.634 @@ -726,7 +694,7 @@
   7.635      by (rule evaln.UnOp)
   7.636    then show ?case ..
   7.637  next
   7.638 -  case (BinOp binop e1 e2 s0 s1 s2 v1 v2)
   7.639 +  case (BinOp s0 e1 v1 s1 binop e2 v2 s2)
   7.640    then obtain n1 n2 where 
   7.641      "G\<turnstile>Norm s0 \<midarrow>e1-\<succ>v1\<midarrow>n1\<rightarrow> s1"
   7.642      "G\<turnstile>s1 \<midarrow>(if need_second_arg binop v1 then In1l e2
   7.643 @@ -742,7 +710,7 @@
   7.644      by (rule evaln.Super)
   7.645    then show ?case ..
   7.646  next
   7.647 -  case (Acc f s0 s1 v va)
   7.648 +  case (Acc s0 va v f s1)
   7.649    then obtain n where
   7.650      "G\<turnstile>Norm s0 \<midarrow>va=\<succ>(v, f)\<midarrow>n\<rightarrow> s1"
   7.651      by (iprover)
   7.652 @@ -751,7 +719,7 @@
   7.653      by (rule evaln.Acc)
   7.654    then show ?case ..
   7.655  next
   7.656 -  case (Ass e f s0 s1 s2 v var w)
   7.657 +  case (Ass s0 var w f s1 e v s2)
   7.658    then obtain n1 n2 where 
   7.659      "G\<turnstile>Norm s0 \<midarrow>var=\<succ>(w, f)\<midarrow>n1\<rightarrow> s1"
   7.660      "G\<turnstile>s1 \<midarrow>e-\<succ>v\<midarrow>n2\<rightarrow> s2"      
   7.661 @@ -761,7 +729,7 @@
   7.662      by (blast intro: evaln.Ass dest: evaln_max2)
   7.663    then show ?case ..
   7.664  next
   7.665 -  case (Cond b e0 e1 e2 s0 s1 s2 v)
   7.666 +  case (Cond s0 e0 b s1 e1 e2 v s2)
   7.667    then obtain n1 n2 where 
   7.668      "G\<turnstile>Norm s0 \<midarrow>e0-\<succ>b\<midarrow>n1\<rightarrow> s1"
   7.669      "G\<turnstile>s1 \<midarrow>(if the_Bool b then e1 else e2)-\<succ>v\<midarrow>n2\<rightarrow> s2"
   7.670 @@ -771,8 +739,7 @@
   7.671      by (blast intro: evaln.Cond dest: evaln_max2)
   7.672    then show ?case ..
   7.673  next
   7.674 -  case (Call invDeclC a' accC' args e mn mode pTs' s0 s1 s2 s3 s3' s4 statT 
   7.675 -        v vs)
   7.676 +  case (Call s0 e a' s1 args vs s2 invDeclC mode statT mn pTs' s3 s3' accC' v s4)
   7.677    then obtain n1 n2 where
   7.678      "G\<turnstile>Norm s0 \<midarrow>e-\<succ>a'\<midarrow>n1\<rightarrow> s1"
   7.679      "G\<turnstile>s1 \<midarrow>args\<doteq>\<succ>vs\<midarrow>n2\<rightarrow> s2"
   7.680 @@ -795,7 +762,7 @@
   7.681      by (auto intro!: evaln.Call le_maxI1 le_max3I1 le_max3I2)
   7.682    thus ?case ..
   7.683  next
   7.684 -  case (Methd D s0 s1 sig v )
   7.685 +  case (Methd s0 D sig v s1)
   7.686    then obtain n where
   7.687      "G\<turnstile>Norm s0 \<midarrow>body G D sig-\<succ>v\<midarrow>n\<rightarrow> s1"
   7.688      by iprover
   7.689 @@ -803,7 +770,7 @@
   7.690      by (rule evaln.Methd)
   7.691    then show ?case ..
   7.692  next
   7.693 -  case (Body D c s0 s1 s2 s3 )
   7.694 +  case (Body s0 D s1 c s2 s3)
   7.695    from Body.hyps obtain n1 n2 where 
   7.696      evaln_init: "G\<turnstile>Norm s0 \<midarrow>Init D\<midarrow>n1\<rightarrow> s1" and
   7.697      evaln_c: "G\<turnstile>s1 \<midarrow>c\<midarrow>n2\<rightarrow> s2"
   7.698 @@ -826,7 +793,7 @@
   7.699      by (iprover intro: evaln.LVar)
   7.700    then show ?case ..
   7.701  next
   7.702 -  case (FVar a accC e fn s0 s1 s2 s2' s3 stat statDeclC v)
   7.703 +  case (FVar s0 statDeclC s1 e a s2 v s2' stat fn s3 accC)
   7.704    then obtain n1 n2 where
   7.705      "G\<turnstile>Norm s0 \<midarrow>Init statDeclC\<midarrow>n1\<rightarrow> s1"
   7.706      "G\<turnstile>s1 \<midarrow>e-\<succ>a\<midarrow>n2\<rightarrow> s2"
   7.707 @@ -839,7 +806,7 @@
   7.708      by (iprover intro: evaln.FVar dest: evaln_max2)
   7.709    then show ?case ..
   7.710  next
   7.711 -  case (AVar a e1 e2 i s0 s1 s2 s2' v )
   7.712 +  case (AVar s0 e1 a s1 e2 i s2 v s2')
   7.713    then obtain n1 n2 where 
   7.714      "G\<turnstile>Norm s0 \<midarrow>e1-\<succ>a\<midarrow>n1\<rightarrow> s1"
   7.715      "G\<turnstile>s1 \<midarrow>e2-\<succ>i\<midarrow>n2\<rightarrow> s2"      
   7.716 @@ -854,7 +821,7 @@
   7.717    case (Nil s0)
   7.718    show ?case by (iprover intro: evaln.Nil)
   7.719  next
   7.720 -  case (Cons e es s0 s1 s2 v vs)
   7.721 +  case (Cons s0 e v s1 es vs s2)
   7.722    then obtain n1 n2 where 
   7.723      "G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<midarrow>n1\<rightarrow> s1"
   7.724      "G\<turnstile>s1 \<midarrow>es\<doteq>\<succ>vs\<midarrow>n2\<rightarrow> s2"      
     8.1 --- a/src/HOL/Bali/Trans.thy	Mon Dec 11 12:28:16 2006 +0100
     8.2 +++ b/src/HOL/Bali/Trans.thy	Mon Dec 11 16:06:14 2006 +0100
     8.3 @@ -60,29 +60,22 @@
     8.4  by (simp)
     8.5  declare the_var_AVar_def [simp del]
     8.6  
     8.7 -consts
     8.8 -  step	:: "prog \<Rightarrow> ((term \<times> state) \<times> (term \<times> state)) set"
     8.9 -
    8.10 -syntax (symbols)
    8.11 -  step :: "[prog,term \<times> state,term \<times> state] \<Rightarrow> bool" ("_\<turnstile>_ \<mapsto>1 _"[61,82,82] 81)
    8.12 -  stepn:: "[prog, term \<times> state,nat,term \<times> state] \<Rightarrow> bool" 
    8.13 -                                                  ("_\<turnstile>_ \<mapsto>_ _"[61,82,82] 81)
    8.14 -"step*":: "[prog,term \<times> state,term \<times> state] \<Rightarrow> bool" ("_\<turnstile>_ \<mapsto>* _"[61,82,82] 81)
    8.15 +syntax (xsymbols)
    8.16    Ref  :: "loc \<Rightarrow> expr"
    8.17    SKIP :: "expr"
    8.18  
    8.19  translations
    8.20 -  "G\<turnstile>p \<mapsto>1 p' " == "(p,p') \<in> step G"
    8.21 -  "G\<turnstile>p \<mapsto>n p' " == "(p,p') \<in> (step G)^n"
    8.22 -  "G\<turnstile>p \<mapsto>* p' " == "(p,p') \<in> (step G)\<^sup>*"
    8.23    "Ref a" == "Lit (Addr a)"
    8.24    "SKIP"  == "Lit Unit"
    8.25  
    8.26 -inductive "step G" intros 
    8.27 +inductive2
    8.28 +  step :: "[prog,term \<times> state,term \<times> state] \<Rightarrow> bool" ("_\<turnstile>_ \<mapsto>1 _"[61,82,82] 81)
    8.29 +  for G :: prog
    8.30 +where
    8.31  
    8.32  (* evaluation of expression *)
    8.33    (* cf. 15.5 *)
    8.34 -Abrupt:	         "\<lbrakk>\<forall>v. t \<noteq> \<langle>Lit v\<rangle>;
    8.35 +  Abrupt:       "\<lbrakk>\<forall>v. t \<noteq> \<langle>Lit v\<rangle>;
    8.36                    \<forall> t. t \<noteq> \<langle>l\<bullet> Skip\<rangle>;
    8.37                    \<forall> C vn c.  t \<noteq> \<langle>Try Skip Catch(C vn) c\<rangle>;
    8.38                    \<forall> x c. t \<noteq> \<langle>Skip Finally c\<rangle> \<and> xc \<noteq> Xcpt x;
    8.39 @@ -90,19 +83,19 @@
    8.40                  \<Longrightarrow> 
    8.41                    G\<turnstile>(t,Some xc,s) \<mapsto>1 (\<langle>Lit arbitrary\<rangle>,Some xc,s)"
    8.42  
    8.43 -InsInitE: "\<lbrakk>G\<turnstile>(\<langle>c\<rangle>,Norm s) \<mapsto>1 (\<langle>c'\<rangle>, s')\<rbrakk>
    8.44 -           \<Longrightarrow> 
    8.45 -           G\<turnstile>(\<langle>InsInitE c e\<rangle>,Norm s) \<mapsto>1 (\<langle>InsInitE c' e\<rangle>, s')"
    8.46 +| InsInitE: "\<lbrakk>G\<turnstile>(\<langle>c\<rangle>,Norm s) \<mapsto>1 (\<langle>c'\<rangle>, s')\<rbrakk>
    8.47 +             \<Longrightarrow> 
    8.48 +             G\<turnstile>(\<langle>InsInitE c e\<rangle>,Norm s) \<mapsto>1 (\<langle>InsInitE c' e\<rangle>, s')"
    8.49  
    8.50  (* SeqE: "G\<turnstile>(\<langle>Seq Skip e\<rangle>,Norm s) \<mapsto>1 (\<langle>e\<rangle>, Norm s)" *)
    8.51  (* Specialised rules to evaluate: 
    8.52     InsInitE Skip (NewC C), InisInitE Skip (NewA T[e]) *)
    8.53   
    8.54    (* cf. 15.8.1 *)
    8.55 -NewC: "G\<turnstile>(\<langle>NewC C\<rangle>,Norm s) \<mapsto>1 (\<langle>InsInitE (Init C) (NewC C)\<rangle>, Norm s)"
    8.56 -NewCInited: "\<lbrakk>G\<turnstile> Norm s \<midarrow>halloc (CInst C)\<succ>a\<rightarrow> s'\<rbrakk> 
    8.57 -             \<Longrightarrow> 
    8.58 -             G\<turnstile>(\<langle>InsInitE Skip (NewC C)\<rangle>,Norm s) \<mapsto>1 (\<langle>Ref a\<rangle>, s')"
    8.59 +| NewC: "G\<turnstile>(\<langle>NewC C\<rangle>,Norm s) \<mapsto>1 (\<langle>InsInitE (Init C) (NewC C)\<rangle>, Norm s)"
    8.60 +| NewCInited: "\<lbrakk>G\<turnstile> Norm s \<midarrow>halloc (CInst C)\<succ>a\<rightarrow> s'\<rbrakk> 
    8.61 +               \<Longrightarrow> 
    8.62 +               G\<turnstile>(\<langle>InsInitE Skip (NewC C)\<rangle>,Norm s) \<mapsto>1 (\<langle>Ref a\<rangle>, s')"
    8.63  
    8.64  
    8.65  
    8.66 @@ -119,68 +112,68 @@
    8.67  
    8.68  *)
    8.69    (* cf. 15.9.1 *)
    8.70 -NewA: 
    8.71 +| NewA: 
    8.72     "G\<turnstile>(\<langle>New T[e]\<rangle>,Norm s) \<mapsto>1 (\<langle>InsInitE (init_comp_ty T) (New T[e])\<rangle>,Norm s)"
    8.73 -InsInitNewAIdx: 
    8.74 +| InsInitNewAIdx: 
    8.75     "\<lbrakk>G\<turnstile>(\<langle>e\<rangle>,Norm s) \<mapsto>1 (\<langle>e'\<rangle>, s')\<rbrakk>
    8.76      \<Longrightarrow>  
    8.77      G\<turnstile>(\<langle>InsInitE Skip (New T[e])\<rangle>,Norm s) \<mapsto>1 (\<langle>InsInitE Skip (New T[e'])\<rangle>,s')"
    8.78 -InsInitNewA: 
    8.79 +| InsInitNewA: 
    8.80     "\<lbrakk>G\<turnstile>abupd (check_neg i) (Norm s) \<midarrow>halloc (Arr T (the_Intg i))\<succ>a\<rightarrow> s' \<rbrakk>
    8.81      \<Longrightarrow>
    8.82      G\<turnstile>(\<langle>InsInitE Skip (New T[Lit i])\<rangle>,Norm s) \<mapsto>1 (\<langle>Ref a\<rangle>,s')"
    8.83   
    8.84    (* cf. 15.15 *)
    8.85 -CastE:	
    8.86 +| CastE:	
    8.87     "\<lbrakk>G\<turnstile>(\<langle>e\<rangle>,Norm s) \<mapsto>1 (\<langle>e'\<rangle>,s')\<rbrakk> 
    8.88      \<Longrightarrow>
    8.89      G\<turnstile>(\<langle>Cast T e\<rangle>,None,s) \<mapsto>1 (\<langle>Cast T e'\<rangle>,s')" 
    8.90 -Cast:	
    8.91 +| Cast:	
    8.92     "\<lbrakk>s' = abupd (raise_if (\<not>G,s\<turnstile>v fits T)  ClassCast) (Norm s)\<rbrakk> 
    8.93      \<Longrightarrow> 
    8.94      G\<turnstile>(\<langle>Cast T (Lit v)\<rangle>,Norm s) \<mapsto>1 (\<langle>Lit v\<rangle>,s')"
    8.95    (* can be written without abupd, since we know Norm s *)
    8.96  
    8.97  
    8.98 -InstE: "\<lbrakk>G\<turnstile>(\<langle>e\<rangle>,Norm s) \<mapsto>1 (\<langle>e'::expr\<rangle>,s')\<rbrakk> 
    8.99 +| InstE: "\<lbrakk>G\<turnstile>(\<langle>e\<rangle>,Norm s) \<mapsto>1 (\<langle>e'::expr\<rangle>,s')\<rbrakk> 
   8.100          \<Longrightarrow> 
   8.101          G\<turnstile>(\<langle>e InstOf T\<rangle>,Norm s) \<mapsto>1 (\<langle>e'\<rangle>,s')" 
   8.102 -Inst:  "\<lbrakk>b = (v\<noteq>Null \<and> G,s\<turnstile>v fits RefT T)\<rbrakk> 
   8.103 -        \<Longrightarrow> 
   8.104 -        G\<turnstile>(\<langle>(Lit v) InstOf T\<rangle>,Norm s) \<mapsto>1 (\<langle>Lit (Bool b)\<rangle>,s')"
   8.105 +| Inst:  "\<lbrakk>b = (v\<noteq>Null \<and> G,s\<turnstile>v fits RefT T)\<rbrakk> 
   8.106 +          \<Longrightarrow> 
   8.107 +          G\<turnstile>(\<langle>(Lit v) InstOf T\<rangle>,Norm s) \<mapsto>1 (\<langle>Lit (Bool b)\<rangle>,s')"
   8.108  
   8.109    (* cf. 15.7.1 *)
   8.110  (*Lit				"G\<turnstile>(Lit v,None,s) \<mapsto>1 (Lit v,None,s)"*)
   8.111  
   8.112 -UnOpE:  "\<lbrakk>G\<turnstile>(\<langle>e\<rangle>,Norm s) \<mapsto>1 (\<langle>e'\<rangle>,s') \<rbrakk>
   8.113 -         \<Longrightarrow> 
   8.114 -         G\<turnstile>(\<langle>UnOp unop e\<rangle>,Norm s) \<mapsto>1 (\<langle>UnOp unop e'\<rangle>,s')"
   8.115 -UnOp:   "G\<turnstile>(\<langle>UnOp unop (Lit v)\<rangle>,Norm s) \<mapsto>1 (\<langle>Lit (eval_unop unop v)\<rangle>,Norm s)"
   8.116 -
   8.117 -BinOpE1:  "\<lbrakk>G\<turnstile>(\<langle>e1\<rangle>,Norm s) \<mapsto>1 (\<langle>e1'\<rangle>,s') \<rbrakk>
   8.118 +| UnOpE:  "\<lbrakk>G\<turnstile>(\<langle>e\<rangle>,Norm s) \<mapsto>1 (\<langle>e'\<rangle>,s') \<rbrakk>
   8.119             \<Longrightarrow> 
   8.120 -           G\<turnstile>(\<langle>BinOp binop e1 e2\<rangle>,Norm s) \<mapsto>1 (\<langle>BinOp binop e1' e2\<rangle>,s')"
   8.121 -BinOpE2:  "\<lbrakk>need_second_arg binop v1; G\<turnstile>(\<langle>e2\<rangle>,Norm s) \<mapsto>1 (\<langle>e2'\<rangle>,s') \<rbrakk>
   8.122 -           \<Longrightarrow> 
   8.123 -           G\<turnstile>(\<langle>BinOp binop (Lit v1) e2\<rangle>,Norm s) 
   8.124 -            \<mapsto>1 (\<langle>BinOp binop (Lit v1) e2'\<rangle>,s')"
   8.125 -BinOpTerm:  "\<lbrakk>\<not> need_second_arg binop v1\<rbrakk>
   8.126 +           G\<turnstile>(\<langle>UnOp unop e\<rangle>,Norm s) \<mapsto>1 (\<langle>UnOp unop e'\<rangle>,s')"
   8.127 +| UnOp:   "G\<turnstile>(\<langle>UnOp unop (Lit v)\<rangle>,Norm s) \<mapsto>1 (\<langle>Lit (eval_unop unop v)\<rangle>,Norm s)"
   8.128 +
   8.129 +| BinOpE1:  "\<lbrakk>G\<turnstile>(\<langle>e1\<rangle>,Norm s) \<mapsto>1 (\<langle>e1'\<rangle>,s') \<rbrakk>
   8.130 +             \<Longrightarrow> 
   8.131 +             G\<turnstile>(\<langle>BinOp binop e1 e2\<rangle>,Norm s) \<mapsto>1 (\<langle>BinOp binop e1' e2\<rangle>,s')"
   8.132 +| BinOpE2:  "\<lbrakk>need_second_arg binop v1; G\<turnstile>(\<langle>e2\<rangle>,Norm s) \<mapsto>1 (\<langle>e2'\<rangle>,s') \<rbrakk>
   8.133               \<Longrightarrow> 
   8.134               G\<turnstile>(\<langle>BinOp binop (Lit v1) e2\<rangle>,Norm s) 
   8.135 -              \<mapsto>1 (\<langle>Lit v1\<rangle>,Norm s)"
   8.136 -BinOp:    "G\<turnstile>(\<langle>BinOp binop (Lit v1) (Lit v2)\<rangle>,Norm s) 
   8.137 -            \<mapsto>1 (\<langle>Lit (eval_binop binop v1 v2)\<rangle>,Norm s)"
   8.138 +              \<mapsto>1 (\<langle>BinOp binop (Lit v1) e2'\<rangle>,s')"
   8.139 +| BinOpTerm:  "\<lbrakk>\<not> need_second_arg binop v1\<rbrakk>
   8.140 +               \<Longrightarrow> 
   8.141 +               G\<turnstile>(\<langle>BinOp binop (Lit v1) e2\<rangle>,Norm s) 
   8.142 +                \<mapsto>1 (\<langle>Lit v1\<rangle>,Norm s)"
   8.143 +| BinOp:    "G\<turnstile>(\<langle>BinOp binop (Lit v1) (Lit v2)\<rangle>,Norm s) 
   8.144 +              \<mapsto>1 (\<langle>Lit (eval_binop binop v1 v2)\<rangle>,Norm s)"
   8.145  (* Maybe its more convenient to add: need_second_arg as precondition to BinOp 
   8.146     to make the choice between BinOpTerm and BinOp deterministic *)
   8.147     
   8.148 -Super: "G\<turnstile>(\<langle>Super\<rangle>,Norm s) \<mapsto>1 (\<langle>Lit (val_this s)\<rangle>,Norm s)"
   8.149 +| Super: "G\<turnstile>(\<langle>Super\<rangle>,Norm s) \<mapsto>1 (\<langle>Lit (val_this s)\<rangle>,Norm s)"
   8.150  
   8.151 -AccVA: "\<lbrakk>G\<turnstile>(\<langle>va\<rangle>,Norm s) \<mapsto>1 (\<langle>va'\<rangle>,s') \<rbrakk>
   8.152 -        \<Longrightarrow> 
   8.153 -        G\<turnstile>(\<langle>Acc va\<rangle>,Norm s) \<mapsto>1 (\<langle>Acc va'\<rangle>,s')"
   8.154 -Acc:  "\<lbrakk>groundVar va; ((v,vf),s') = the_var G (Norm s) va\<rbrakk>
   8.155 -       \<Longrightarrow>  
   8.156 -       G\<turnstile>(\<langle>Acc va\<rangle>,Norm s) \<mapsto>1 (\<langle>Lit v\<rangle>,s')"
   8.157 +| AccVA: "\<lbrakk>G\<turnstile>(\<langle>va\<rangle>,Norm s) \<mapsto>1 (\<langle>va'\<rangle>,s') \<rbrakk>
   8.158 +          \<Longrightarrow> 
   8.159 +          G\<turnstile>(\<langle>Acc va\<rangle>,Norm s) \<mapsto>1 (\<langle>Acc va'\<rangle>,s')"
   8.160 +| Acc:  "\<lbrakk>groundVar va; ((v,vf),s') = the_var G (Norm s) va\<rbrakk>
   8.161 +         \<Longrightarrow>  
   8.162 +         G\<turnstile>(\<langle>Acc va\<rangle>,Norm s) \<mapsto>1 (\<langle>Lit v\<rangle>,s')"
   8.163  
   8.164  (*
   8.165  AccLVar: "G\<turnstile>(\<langle>Acc (LVar vn)\<rangle>,Norm s) \<mapsto>1 (\<langle>Lit (fst (lvar vn s))\<rangle>,Norm s)"
   8.166 @@ -192,68 +185,68 @@
   8.167            \<Longrightarrow>  
   8.168            G\<turnstile>(\<langle>Acc ((Lit a).[Lit i])\<rangle>,Norm s) \<mapsto>1 (\<langle>Lit v\<rangle>,s')"
   8.169  *) 
   8.170 -AssVA:  "\<lbrakk>G\<turnstile>(\<langle>va\<rangle>,Norm s) \<mapsto>1 (\<langle>va'\<rangle>,s')\<rbrakk> 
   8.171 -         \<Longrightarrow> 
   8.172 -         G\<turnstile>(\<langle>va:=e\<rangle>,Norm s) \<mapsto>1 (\<langle>va':=e\<rangle>,s')"
   8.173 -AssE:   "\<lbrakk>groundVar va; G\<turnstile>(\<langle>e\<rangle>,Norm s) \<mapsto>1 (\<langle>e'\<rangle>,s')\<rbrakk> 
   8.174 -         \<Longrightarrow> 
   8.175 -         G\<turnstile>(\<langle>va:=e\<rangle>,Norm s) \<mapsto>1 (\<langle>va:=e'\<rangle>,s')"
   8.176 -Ass:    "\<lbrakk>groundVar va; ((w,f),s') = the_var G (Norm s) va\<rbrakk> 
   8.177 -         \<Longrightarrow> 
   8.178 -         G\<turnstile>(\<langle>va:=(Lit v)\<rangle>,Norm s) \<mapsto>1 (\<langle>Lit v\<rangle>,assign f v s')"
   8.179 +| AssVA:  "\<lbrakk>G\<turnstile>(\<langle>va\<rangle>,Norm s) \<mapsto>1 (\<langle>va'\<rangle>,s')\<rbrakk> 
   8.180 +           \<Longrightarrow> 
   8.181 +           G\<turnstile>(\<langle>va:=e\<rangle>,Norm s) \<mapsto>1 (\<langle>va':=e\<rangle>,s')"
   8.182 +| AssE:   "\<lbrakk>groundVar va; G\<turnstile>(\<langle>e\<rangle>,Norm s) \<mapsto>1 (\<langle>e'\<rangle>,s')\<rbrakk> 
   8.183 +           \<Longrightarrow> 
   8.184 +           G\<turnstile>(\<langle>va:=e\<rangle>,Norm s) \<mapsto>1 (\<langle>va:=e'\<rangle>,s')"
   8.185 +| Ass:    "\<lbrakk>groundVar va; ((w,f),s') = the_var G (Norm s) va\<rbrakk> 
   8.186 +           \<Longrightarrow> 
   8.187 +           G\<turnstile>(\<langle>va:=(Lit v)\<rangle>,Norm s) \<mapsto>1 (\<langle>Lit v\<rangle>,assign f v s')"
   8.188  
   8.189 -CondC: "\<lbrakk>G\<turnstile>(\<langle>e0\<rangle>,Norm s) \<mapsto>1 (\<langle>e0'\<rangle>,s')\<rbrakk> 
   8.190 -        \<Longrightarrow> 
   8.191 -        G\<turnstile>(\<langle>e0? e1:e2\<rangle>,Norm s) \<mapsto>1 (\<langle>e0'? e1:e2\<rangle>,s')"
   8.192 -Cond:  "G\<turnstile>(\<langle>Lit b? e1:e2\<rangle>,Norm s) \<mapsto>1 (\<langle>if the_Bool b then e1 else e2\<rangle>,Norm s)"
   8.193 +| CondC: "\<lbrakk>G\<turnstile>(\<langle>e0\<rangle>,Norm s) \<mapsto>1 (\<langle>e0'\<rangle>,s')\<rbrakk> 
   8.194 +          \<Longrightarrow> 
   8.195 +          G\<turnstile>(\<langle>e0? e1:e2\<rangle>,Norm s) \<mapsto>1 (\<langle>e0'? e1:e2\<rangle>,s')"
   8.196 +| Cond:  "G\<turnstile>(\<langle>Lit b? e1:e2\<rangle>,Norm s) \<mapsto>1 (\<langle>if the_Bool b then e1 else e2\<rangle>,Norm s)"
   8.197  
   8.198  
   8.199 -CallTarget: "\<lbrakk>G\<turnstile>(\<langle>e\<rangle>,Norm s) \<mapsto>1 (\<langle>e'\<rangle>,s')\<rbrakk> 
   8.200 -             \<Longrightarrow>
   8.201 -	     G\<turnstile>(\<langle>{accC,statT,mode}e\<cdot>mn({pTs}args)\<rangle>,Norm s) 
   8.202 -              \<mapsto>1 (\<langle>{accC,statT,mode}e'\<cdot>mn({pTs}args)\<rangle>,s')"
   8.203 -CallArgs:   "\<lbrakk>G\<turnstile>(\<langle>args\<rangle>,Norm s) \<mapsto>1 (\<langle>args'\<rangle>,s')\<rbrakk> 
   8.204 -             \<Longrightarrow>
   8.205 -	     G\<turnstile>(\<langle>{accC,statT,mode}Lit a\<cdot>mn({pTs}args)\<rangle>,Norm s) 
   8.206 -              \<mapsto>1 (\<langle>{accC,statT,mode}Lit a\<cdot>mn({pTs}args')\<rangle>,s')"
   8.207 -Call:       "\<lbrakk>groundExprs args; vs = map the_val args;
   8.208 -              D = invocation_declclass G mode s a statT \<lparr>name=mn,parTs=pTs\<rparr>;
   8.209 -              s'=init_lvars G D \<lparr>name=mn,parTs=pTs\<rparr> mode a' vs (Norm s)\<rbrakk> 
   8.210 -             \<Longrightarrow> 
   8.211 -             G\<turnstile>(\<langle>{accC,statT,mode}Lit a\<cdot>mn({pTs}args)\<rangle>,Norm s) 
   8.212 -              \<mapsto>1 (\<langle>Callee (locals s) (Methd D \<lparr>name=mn,parTs=pTs\<rparr>)\<rangle>,s')"
   8.213 +| CallTarget: "\<lbrakk>G\<turnstile>(\<langle>e\<rangle>,Norm s) \<mapsto>1 (\<langle>e'\<rangle>,s')\<rbrakk> 
   8.214 +               \<Longrightarrow>
   8.215 +               G\<turnstile>(\<langle>{accC,statT,mode}e\<cdot>mn({pTs}args)\<rangle>,Norm s) 
   8.216 +                \<mapsto>1 (\<langle>{accC,statT,mode}e'\<cdot>mn({pTs}args)\<rangle>,s')"
   8.217 +| CallArgs:   "\<lbrakk>G\<turnstile>(\<langle>args\<rangle>,Norm s) \<mapsto>1 (\<langle>args'\<rangle>,s')\<rbrakk> 
   8.218 +               \<Longrightarrow>
   8.219 +               G\<turnstile>(\<langle>{accC,statT,mode}Lit a\<cdot>mn({pTs}args)\<rangle>,Norm s) 
   8.220 +                \<mapsto>1 (\<langle>{accC,statT,mode}Lit a\<cdot>mn({pTs}args')\<rangle>,s')"
   8.221 +| Call:       "\<lbrakk>groundExprs args; vs = map the_val args;
   8.222 +                D = invocation_declclass G mode s a statT \<lparr>name=mn,parTs=pTs\<rparr>;
   8.223 +                s'=init_lvars G D \<lparr>name=mn,parTs=pTs\<rparr> mode a' vs (Norm s)\<rbrakk> 
   8.224 +               \<Longrightarrow> 
   8.225 +               G\<turnstile>(\<langle>{accC,statT,mode}Lit a\<cdot>mn({pTs}args)\<rangle>,Norm s) 
   8.226 +                \<mapsto>1 (\<langle>Callee (locals s) (Methd D \<lparr>name=mn,parTs=pTs\<rparr>)\<rangle>,s')"
   8.227             
   8.228 -Callee:     "\<lbrakk>G\<turnstile>(\<langle>e\<rangle>,Norm s) \<mapsto>1 (\<langle>e'::expr\<rangle>,s')\<rbrakk>
   8.229 -             \<Longrightarrow> 
   8.230 -             G\<turnstile>(\<langle>Callee lcls_caller e\<rangle>,Norm s) \<mapsto>1 (\<langle>e'\<rangle>,s')"
   8.231 +| Callee:     "\<lbrakk>G\<turnstile>(\<langle>e\<rangle>,Norm s) \<mapsto>1 (\<langle>e'::expr\<rangle>,s')\<rbrakk>
   8.232 +               \<Longrightarrow> 
   8.233 +               G\<turnstile>(\<langle>Callee lcls_caller e\<rangle>,Norm s) \<mapsto>1 (\<langle>e'\<rangle>,s')"
   8.234  
   8.235 -CalleeRet:   "G\<turnstile>(\<langle>Callee lcls_caller (Lit v)\<rangle>,Norm s) 
   8.236 -               \<mapsto>1 (\<langle>Lit v\<rangle>,(set_lvars lcls_caller (Norm s)))"
   8.237 +| CalleeRet:   "G\<turnstile>(\<langle>Callee lcls_caller (Lit v)\<rangle>,Norm s) 
   8.238 +                 \<mapsto>1 (\<langle>Lit v\<rangle>,(set_lvars lcls_caller (Norm s)))"
   8.239  
   8.240 -Methd: "G\<turnstile>(\<langle>Methd D sig\<rangle>,Norm s) \<mapsto>1 (\<langle>body G D sig\<rangle>,Norm s)"
   8.241 +| Methd: "G\<turnstile>(\<langle>Methd D sig\<rangle>,Norm s) \<mapsto>1 (\<langle>body G D sig\<rangle>,Norm s)"
   8.242  
   8.243 -Body: "G\<turnstile>(\<langle>Body D c\<rangle>,Norm s) \<mapsto>1 (\<langle>InsInitE (Init D) (Body D c)\<rangle>,Norm s)"
   8.244 +| Body: "G\<turnstile>(\<langle>Body D c\<rangle>,Norm s) \<mapsto>1 (\<langle>InsInitE (Init D) (Body D c)\<rangle>,Norm s)"
   8.245  
   8.246 -InsInitBody: 
   8.247 +| InsInitBody: 
   8.248      "\<lbrakk>G\<turnstile>(\<langle>c\<rangle>,Norm s) \<mapsto>1 (\<langle>c'\<rangle>,s')\<rbrakk>
   8.249       \<Longrightarrow> 
   8.250       G\<turnstile>(\<langle>InsInitE Skip (Body D c)\<rangle>,Norm s) \<mapsto>1(\<langle>InsInitE Skip (Body D c')\<rangle>,s')"
   8.251 -InsInitBodyRet: 
   8.252 +| InsInitBodyRet: 
   8.253       "G\<turnstile>(\<langle>InsInitE Skip (Body D Skip)\<rangle>,Norm s)
   8.254         \<mapsto>1 (\<langle>Lit (the ((locals s) Result))\<rangle>,abupd (absorb Ret) (Norm s))"
   8.255  
   8.256  (*   LVar: "G\<turnstile>(LVar vn,Norm s)" is already evaluated *)
   8.257    
   8.258 -FVar: "\<lbrakk>\<not> inited statDeclC (globs s)\<rbrakk>
   8.259 -       \<Longrightarrow> 
   8.260 -       G\<turnstile>(\<langle>{accC,statDeclC,stat}e..fn\<rangle>,Norm s) 
   8.261 -        \<mapsto>1 (\<langle>InsInitV (Init statDeclC) ({accC,statDeclC,stat}e..fn)\<rangle>,Norm s)"
   8.262 -InsInitFVarE:
   8.263 +| FVar: "\<lbrakk>\<not> inited statDeclC (globs s)\<rbrakk>
   8.264 +         \<Longrightarrow> 
   8.265 +         G\<turnstile>(\<langle>{accC,statDeclC,stat}e..fn\<rangle>,Norm s) 
   8.266 +          \<mapsto>1 (\<langle>InsInitV (Init statDeclC) ({accC,statDeclC,stat}e..fn)\<rangle>,Norm s)"
   8.267 +| InsInitFVarE:
   8.268        "\<lbrakk>G\<turnstile>(\<langle>e\<rangle>,Norm s) \<mapsto>1 (\<langle>e'\<rangle>,s')\<rbrakk>
   8.269         \<Longrightarrow>
   8.270         G\<turnstile>(\<langle>InsInitV Skip ({accC,statDeclC,stat}e..fn)\<rangle>,Norm s) 
   8.271          \<mapsto>1 (\<langle>InsInitV Skip ({accC,statDeclC,stat}e'..fn)\<rangle>,s')"
   8.272 -InsInitFVar:
   8.273 +| InsInitFVar:
   8.274        "G\<turnstile>(\<langle>InsInitV Skip ({accC,statDeclC,stat}Lit a..fn)\<rangle>,Norm s) 
   8.275          \<mapsto>1 (\<langle>{accC,statDeclC,stat}Lit a..fn\<rangle>,Norm s)"
   8.276  --  {* Notice, that we do not have literal values for @{text vars}. 
   8.277 @@ -266,13 +259,13 @@
   8.278  *}
   8.279  
   8.280  
   8.281 -AVarE1: "\<lbrakk>G\<turnstile>(\<langle>e1\<rangle>,Norm s) \<mapsto>1 (\<langle>e1'\<rangle>,s')\<rbrakk> 
   8.282 -         \<Longrightarrow> 
   8.283 -         G\<turnstile>(\<langle>e1.[e2]\<rangle>,Norm s) \<mapsto>1 (\<langle>e1'.[e2]\<rangle>,s')"
   8.284 +| AVarE1: "\<lbrakk>G\<turnstile>(\<langle>e1\<rangle>,Norm s) \<mapsto>1 (\<langle>e1'\<rangle>,s')\<rbrakk> 
   8.285 +           \<Longrightarrow> 
   8.286 +           G\<turnstile>(\<langle>e1.[e2]\<rangle>,Norm s) \<mapsto>1 (\<langle>e1'.[e2]\<rangle>,s')"
   8.287  
   8.288 -AVarE2: "G\<turnstile>(\<langle>e2\<rangle>,Norm s) \<mapsto>1 (\<langle>e2'\<rangle>,s') 
   8.289 -         \<Longrightarrow> 
   8.290 -         G\<turnstile>(\<langle>Lit a.[e2]\<rangle>,Norm s) \<mapsto>1 (\<langle>Lit a.[e2']\<rangle>,s')"
   8.291 +| AVarE2: "G\<turnstile>(\<langle>e2\<rangle>,Norm s) \<mapsto>1 (\<langle>e2'\<rangle>,s') 
   8.292 +           \<Longrightarrow> 
   8.293 +           G\<turnstile>(\<langle>Lit a.[e2]\<rangle>,Norm s) \<mapsto>1 (\<langle>Lit a.[e2']\<rangle>,s')"
   8.294  
   8.295  (* AVar: \<langle>(Lit a).[Lit i]\<rangle> is fully evaluated *)
   8.296  
   8.297 @@ -280,89 +273,97 @@
   8.298  
   8.299    -- {* @{text Nil}  is fully evaluated *}
   8.300  
   8.301 -ConsHd: "\<lbrakk>G\<turnstile>(\<langle>e::expr\<rangle>,Norm s) \<mapsto>1 (\<langle>e'::expr\<rangle>,s')\<rbrakk> 
   8.302 -         \<Longrightarrow>
   8.303 -         G\<turnstile>(\<langle>e#es\<rangle>,Norm s) \<mapsto>1 (\<langle>e'#es\<rangle>,s')"
   8.304 +| ConsHd: "\<lbrakk>G\<turnstile>(\<langle>e::expr\<rangle>,Norm s) \<mapsto>1 (\<langle>e'::expr\<rangle>,s')\<rbrakk> 
   8.305 +           \<Longrightarrow>
   8.306 +           G\<turnstile>(\<langle>e#es\<rangle>,Norm s) \<mapsto>1 (\<langle>e'#es\<rangle>,s')"
   8.307    
   8.308 -ConsTl: "\<lbrakk>G\<turnstile>(\<langle>es\<rangle>,Norm s) \<mapsto>1 (\<langle>es'\<rangle>,s')\<rbrakk> 
   8.309 -         \<Longrightarrow>
   8.310 -         G\<turnstile>(\<langle>(Lit v)#es\<rangle>,Norm s) \<mapsto>1 (\<langle>(Lit v)#es'\<rangle>,s')"
   8.311 +| ConsTl: "\<lbrakk>G\<turnstile>(\<langle>es\<rangle>,Norm s) \<mapsto>1 (\<langle>es'\<rangle>,s')\<rbrakk> 
   8.312 +           \<Longrightarrow>
   8.313 +           G\<turnstile>(\<langle>(Lit v)#es\<rangle>,Norm s) \<mapsto>1 (\<langle>(Lit v)#es'\<rangle>,s')"
   8.314  
   8.315  (* execution of statements *)
   8.316  
   8.317    (* cf. 14.5 *)
   8.318 -Skip: "G\<turnstile>(\<langle>Skip\<rangle>,Norm s) \<mapsto>1 (\<langle>SKIP\<rangle>,Norm s)"
   8.319 +| Skip: "G\<turnstile>(\<langle>Skip\<rangle>,Norm s) \<mapsto>1 (\<langle>SKIP\<rangle>,Norm s)"
   8.320  
   8.321 -ExprE: "\<lbrakk>G\<turnstile>(\<langle>e\<rangle>,Norm s) \<mapsto>1 (\<langle>e'\<rangle>,s')\<rbrakk> 
   8.322 -        \<Longrightarrow> 
   8.323 -        G\<turnstile>(\<langle>Expr e\<rangle>,Norm s) \<mapsto>1 (\<langle>Expr e'\<rangle>,s')"
   8.324 -Expr:  "G\<turnstile>(\<langle>Expr (Lit v)\<rangle>,Norm s) \<mapsto>1 (\<langle>Skip\<rangle>,Norm s)"
   8.325 +| ExprE: "\<lbrakk>G\<turnstile>(\<langle>e\<rangle>,Norm s) \<mapsto>1 (\<langle>e'\<rangle>,s')\<rbrakk> 
   8.326 +          \<Longrightarrow> 
   8.327 +          G\<turnstile>(\<langle>Expr e\<rangle>,Norm s) \<mapsto>1 (\<langle>Expr e'\<rangle>,s')"
   8.328 +| Expr:  "G\<turnstile>(\<langle>Expr (Lit v)\<rangle>,Norm s) \<mapsto>1 (\<langle>Skip\<rangle>,Norm s)"
   8.329  
   8.330  
   8.331 -LabC: "\<lbrakk>G\<turnstile>(\<langle>c\<rangle>,Norm s) \<mapsto>1 (\<langle>c'\<rangle>,s')\<rbrakk> 
   8.332 -       \<Longrightarrow>  
   8.333 -       G\<turnstile>(\<langle>l\<bullet> c\<rangle>,Norm s) \<mapsto>1 (\<langle>l\<bullet> c'\<rangle>,s')"
   8.334 -Lab:  "G\<turnstile>(\<langle>l\<bullet> Skip\<rangle>,s) \<mapsto>1 (\<langle>Skip\<rangle>, abupd (absorb l) s)"
   8.335 +| LabC: "\<lbrakk>G\<turnstile>(\<langle>c\<rangle>,Norm s) \<mapsto>1 (\<langle>c'\<rangle>,s')\<rbrakk> 
   8.336 +         \<Longrightarrow>  
   8.337 +         G\<turnstile>(\<langle>l\<bullet> c\<rangle>,Norm s) \<mapsto>1 (\<langle>l\<bullet> c'\<rangle>,s')"
   8.338 +| Lab:  "G\<turnstile>(\<langle>l\<bullet> Skip\<rangle>,s) \<mapsto>1 (\<langle>Skip\<rangle>, abupd (absorb l) s)"
   8.339  
   8.340    (* cf. 14.2 *)
   8.341 -CompC1:	"\<lbrakk>G\<turnstile>(\<langle>c1\<rangle>,Norm s) \<mapsto>1 (\<langle>c1'\<rangle>,s')\<rbrakk> 
   8.342 -         \<Longrightarrow> 
   8.343 -         G\<turnstile>(\<langle>c1;; c2\<rangle>,Norm s) \<mapsto>1 (\<langle>c1';; c2\<rangle>,s')"
   8.344 +| CompC1: "\<lbrakk>G\<turnstile>(\<langle>c1\<rangle>,Norm s) \<mapsto>1 (\<langle>c1'\<rangle>,s')\<rbrakk> 
   8.345 +           \<Longrightarrow> 
   8.346 +           G\<turnstile>(\<langle>c1;; c2\<rangle>,Norm s) \<mapsto>1 (\<langle>c1';; c2\<rangle>,s')"
   8.347  
   8.348 -Comp:   "G\<turnstile>(\<langle>Skip;; c2\<rangle>,Norm s) \<mapsto>1 (\<langle>c2\<rangle>,Norm s)"
   8.349 +| Comp:   "G\<turnstile>(\<langle>Skip;; c2\<rangle>,Norm s) \<mapsto>1 (\<langle>c2\<rangle>,Norm s)"
   8.350  
   8.351    (* cf. 14.8.2 *)
   8.352 -IfE: "\<lbrakk>G\<turnstile>(\<langle>e\<rangle> ,Norm s) \<mapsto>1 (\<langle>e'\<rangle>,s')\<rbrakk> 
   8.353 -      \<Longrightarrow>
   8.354 -      G\<turnstile>(\<langle>If(e) s1 Else s2\<rangle>,Norm s) \<mapsto>1 (\<langle>If(e') s1 Else s2\<rangle>,s')"
   8.355 -If:  "G\<turnstile>(\<langle>If(Lit v) s1 Else s2\<rangle>,Norm s) 
   8.356 -       \<mapsto>1 (\<langle>if the_Bool v then s1 else s2\<rangle>,Norm s)"
   8.357 +| IfE: "\<lbrakk>G\<turnstile>(\<langle>e\<rangle> ,Norm s) \<mapsto>1 (\<langle>e'\<rangle>,s')\<rbrakk> 
   8.358 +        \<Longrightarrow>
   8.359 +        G\<turnstile>(\<langle>If(e) s1 Else s2\<rangle>,Norm s) \<mapsto>1 (\<langle>If(e') s1 Else s2\<rangle>,s')"
   8.360 +| If:  "G\<turnstile>(\<langle>If(Lit v) s1 Else s2\<rangle>,Norm s) 
   8.361 +         \<mapsto>1 (\<langle>if the_Bool v then s1 else s2\<rangle>,Norm s)"
   8.362  
   8.363    (* cf. 14.10, 14.10.1 *)
   8.364 -Loop: "G\<turnstile>(\<langle>l\<bullet> While(e) c\<rangle>,Norm s) 
   8.365 -        \<mapsto>1 (\<langle>If(e) (Cont l\<bullet>c;; l\<bullet> While(e) c) Else Skip\<rangle>,Norm s)"
   8.366 +| Loop: "G\<turnstile>(\<langle>l\<bullet> While(e) c\<rangle>,Norm s) 
   8.367 +          \<mapsto>1 (\<langle>If(e) (Cont l\<bullet>c;; l\<bullet> While(e) c) Else Skip\<rangle>,Norm s)"
   8.368  
   8.369 -Jmp: "G\<turnstile>(\<langle>Jmp j\<rangle>,Norm s) \<mapsto>1 (\<langle>Skip\<rangle>,(Some (Jump j), s))"
   8.370 +| Jmp: "G\<turnstile>(\<langle>Jmp j\<rangle>,Norm s) \<mapsto>1 (\<langle>Skip\<rangle>,(Some (Jump j), s))"
   8.371  
   8.372 -ThrowE: "\<lbrakk>G\<turnstile>(\<langle>e\<rangle>,Norm s) \<mapsto>1 (\<langle>e'\<rangle>,s')\<rbrakk> 
   8.373 -         \<Longrightarrow>
   8.374 -         G\<turnstile>(\<langle>Throw e\<rangle>,Norm s) \<mapsto>1 (\<langle>Throw e'\<rangle>,s')"
   8.375 -Throw:  "G\<turnstile>(\<langle>Throw (Lit a)\<rangle>,Norm s) \<mapsto>1 (\<langle>Skip\<rangle>,abupd (throw a) (Norm s))"
   8.376 +| ThrowE: "\<lbrakk>G\<turnstile>(\<langle>e\<rangle>,Norm s) \<mapsto>1 (\<langle>e'\<rangle>,s')\<rbrakk> 
   8.377 +           \<Longrightarrow>
   8.378 +           G\<turnstile>(\<langle>Throw e\<rangle>,Norm s) \<mapsto>1 (\<langle>Throw e'\<rangle>,s')"
   8.379 +| Throw:  "G\<turnstile>(\<langle>Throw (Lit a)\<rangle>,Norm s) \<mapsto>1 (\<langle>Skip\<rangle>,abupd (throw a) (Norm s))"
   8.380  
   8.381 -TryC1: "\<lbrakk>G\<turnstile>(\<langle>c1\<rangle>,Norm s) \<mapsto>1 (\<langle>c1'\<rangle>,s')\<rbrakk> 
   8.382 -        \<Longrightarrow>
   8.383 -        G\<turnstile>(\<langle>Try c1 Catch(C vn) c2\<rangle>, Norm s) \<mapsto>1 (\<langle>Try c1' Catch(C vn) c2\<rangle>,s')"
   8.384 -Try:   "\<lbrakk>G\<turnstile>s \<midarrow>sxalloc\<rightarrow> s'\<rbrakk>
   8.385 -        \<Longrightarrow>
   8.386 -        G\<turnstile>(\<langle>Try Skip Catch(C vn) c2\<rangle>, s) 
   8.387 -         \<mapsto>1 (if G,s'\<turnstile>catch C then (\<langle>c2\<rangle>,new_xcpt_var vn s')
   8.388 -                              else (\<langle>Skip\<rangle>,s'))"
   8.389 +| TryC1: "\<lbrakk>G\<turnstile>(\<langle>c1\<rangle>,Norm s) \<mapsto>1 (\<langle>c1'\<rangle>,s')\<rbrakk> 
   8.390 +          \<Longrightarrow>
   8.391 +          G\<turnstile>(\<langle>Try c1 Catch(C vn) c2\<rangle>, Norm s) \<mapsto>1 (\<langle>Try c1' Catch(C vn) c2\<rangle>,s')"
   8.392 +| Try:   "\<lbrakk>G\<turnstile>s \<midarrow>sxalloc\<rightarrow> s'\<rbrakk>
   8.393 +          \<Longrightarrow>
   8.394 +          G\<turnstile>(\<langle>Try Skip Catch(C vn) c2\<rangle>, s) 
   8.395 +           \<mapsto>1 (if G,s'\<turnstile>catch C then (\<langle>c2\<rangle>,new_xcpt_var vn s')
   8.396 +                                else (\<langle>Skip\<rangle>,s'))"
   8.397  
   8.398 -FinC1: "\<lbrakk>G\<turnstile>(\<langle>c1\<rangle>,Norm s) \<mapsto>1 (\<langle>c1'\<rangle>,s')\<rbrakk> 
   8.399 -        \<Longrightarrow>
   8.400 -        G\<turnstile>(\<langle>c1 Finally c2\<rangle>,Norm s) \<mapsto>1 (\<langle>c1' Finally c2\<rangle>,s')"
   8.401 +| FinC1: "\<lbrakk>G\<turnstile>(\<langle>c1\<rangle>,Norm s) \<mapsto>1 (\<langle>c1'\<rangle>,s')\<rbrakk> 
   8.402 +          \<Longrightarrow>
   8.403 +          G\<turnstile>(\<langle>c1 Finally c2\<rangle>,Norm s) \<mapsto>1 (\<langle>c1' Finally c2\<rangle>,s')"
   8.404  
   8.405 -Fin:    "G\<turnstile>(\<langle>Skip Finally c2\<rangle>,(a,s)) \<mapsto>1 (\<langle>FinA a c2\<rangle>,Norm s)"
   8.406 +| Fin:    "G\<turnstile>(\<langle>Skip Finally c2\<rangle>,(a,s)) \<mapsto>1 (\<langle>FinA a c2\<rangle>,Norm s)"
   8.407  
   8.408 -FinAC: "\<lbrakk>G\<turnstile>(\<langle>c\<rangle>,s) \<mapsto>1 (\<langle>c'\<rangle>,s')\<rbrakk>
   8.409 -        \<Longrightarrow>
   8.410 -        G\<turnstile>(\<langle>FinA a c\<rangle>,s) \<mapsto>1 (\<langle>FinA a c'\<rangle>,s')"
   8.411 -FinA: "G\<turnstile>(\<langle>FinA a Skip\<rangle>,s) \<mapsto>1 (\<langle>Skip\<rangle>,abupd (abrupt_if (a\<noteq>None) a) s)"
   8.412 +| FinAC: "\<lbrakk>G\<turnstile>(\<langle>c\<rangle>,s) \<mapsto>1 (\<langle>c'\<rangle>,s')\<rbrakk>
   8.413 +          \<Longrightarrow>
   8.414 +          G\<turnstile>(\<langle>FinA a c\<rangle>,s) \<mapsto>1 (\<langle>FinA a c'\<rangle>,s')"
   8.415 +| FinA: "G\<turnstile>(\<langle>FinA a Skip\<rangle>,s) \<mapsto>1 (\<langle>Skip\<rangle>,abupd (abrupt_if (a\<noteq>None) a) s)"
   8.416  
   8.417  
   8.418 -Init1: "\<lbrakk>inited C (globs s)\<rbrakk> 
   8.419 -        \<Longrightarrow> 
   8.420 -        G\<turnstile>(\<langle>Init C\<rangle>,Norm s) \<mapsto>1 (\<langle>Skip\<rangle>,Norm s)"
   8.421 -Init: "\<lbrakk>the (class G C)=c; \<not> inited C (globs s)\<rbrakk>  
   8.422 -       \<Longrightarrow> 
   8.423 -       G\<turnstile>(\<langle>Init C\<rangle>,Norm s) 
   8.424 -        \<mapsto>1 (\<langle>(if C = Object then Skip else (Init (super c)));;
   8.425 -              Expr (Callee (locals s) (InsInitE (init c) SKIP))\<rangle>
   8.426 -             ,Norm (init_class_obj G C s))"
   8.427 +| Init1: "\<lbrakk>inited C (globs s)\<rbrakk> 
   8.428 +          \<Longrightarrow> 
   8.429 +          G\<turnstile>(\<langle>Init C\<rangle>,Norm s) \<mapsto>1 (\<langle>Skip\<rangle>,Norm s)"
   8.430 +| Init: "\<lbrakk>the (class G C)=c; \<not> inited C (globs s)\<rbrakk>  
   8.431 +         \<Longrightarrow> 
   8.432 +         G\<turnstile>(\<langle>Init C\<rangle>,Norm s) 
   8.433 +          \<mapsto>1 (\<langle>(if C = Object then Skip else (Init (super c)));;
   8.434 +                Expr (Callee (locals s) (InsInitE (init c) SKIP))\<rangle>
   8.435 +               ,Norm (init_class_obj G C s))"
   8.436  -- {* @{text InsInitE} is just used as trick to embed the statement 
   8.437  @{text "init c"} into an expression*} 
   8.438 -InsInitESKIP:
   8.439 -  "G\<turnstile>(\<langle>InsInitE Skip SKIP\<rangle>,Norm s) \<mapsto>1 (\<langle>SKIP\<rangle>,Norm s)"
   8.440 +| InsInitESKIP:
   8.441 +    "G\<turnstile>(\<langle>InsInitE Skip SKIP\<rangle>,Norm s) \<mapsto>1 (\<langle>SKIP\<rangle>,Norm s)"
   8.442 +
   8.443 +abbreviation
   8.444 +  stepn:: "[prog, term \<times> state,nat,term \<times> state] \<Rightarrow> bool" ("_\<turnstile>_ \<mapsto>_ _"[61,82,82] 81)
   8.445 +  where "G\<turnstile>p \<mapsto>n p' \<equiv> (p,p') \<in> {(x, y). step G x y}^n"
   8.446 +
   8.447 +abbreviation
   8.448 +  steptr:: "[prog,term \<times> state,term \<times> state] \<Rightarrow> bool" ("_\<turnstile>_ \<mapsto>* _"[61,82,82] 81)
   8.449 +  where "G\<turnstile>p \<mapsto>* p' \<equiv> (p,p') \<in> {(x, y). step G x y}\<^sup>*"
   8.450           
   8.451  (* Equivalenzen:
   8.452    Bigstep zu Smallstep komplett.
     9.1 --- a/src/HOL/Bali/TypeRel.thy	Mon Dec 11 12:28:16 2006 +0100
     9.2 +++ b/src/HOL/Bali/TypeRel.thy	Mon Dec 11 16:06:14 2006 +0100
     9.3 @@ -34,10 +34,6 @@
     9.4  (*subcls , by translation*)                  (*        subclass           *)
     9.5  (*subclseq, by translation*)                 (* subclass + identity       *)
     9.6    implmt1   :: "prog \<Rightarrow> (qtname \<times> qtname) set" --{* direct implementation *}
     9.7 -  implmt    :: "prog \<Rightarrow> (qtname \<times> qtname) set" --{*        implementation *}
     9.8 -  widen     :: "prog \<Rightarrow> (ty    \<times> ty   ) set" --{*        widening       *}
     9.9 -  narrow    :: "prog \<Rightarrow> (ty    \<times> ty   ) set" --{*        narrowing      *}
    9.10 -  cast     :: "prog \<Rightarrow> (ty    \<times> ty   ) set"  --{*        casting        *}
    9.11  
    9.12  syntax
    9.13  
    9.14 @@ -49,12 +45,8 @@
    9.15   "@subcls"  :: "prog => [qtname, qtname] => bool" ("_|-_<:C _"[71,71,71] 70)
    9.16   *)
    9.17   "@implmt1" :: "prog => [qtname, qtname] => bool" ("_|-_~>1_"  [71,71,71] 70)
    9.18 - "@implmt"  :: "prog => [qtname, qtname] => bool" ("_|-_~>_"   [71,71,71] 70)
    9.19 - "@widen"   :: "prog => [ty   , ty   ] => bool" ("_|-_<=:_"  [71,71,71] 70)
    9.20 - "@narrow"  :: "prog => [ty   , ty   ] => bool" ("_|-_:>_"   [71,71,71] 70)
    9.21 - "@cast"    :: "prog => [ty   , ty   ] => bool" ("_|-_<=:? _"[71,71,71] 70)
    9.22  
    9.23 -syntax (symbols)
    9.24 +syntax (xsymbols)
    9.25  
    9.26    "@subint1" :: "prog \<Rightarrow> [qtname, qtname] \<Rightarrow> bool" ("_\<turnstile>_\<prec>I1_"  [71,71,71] 70)
    9.27    "@subint"  :: "prog \<Rightarrow> [qtname, qtname] \<Rightarrow> bool" ("_\<turnstile>_\<preceq>I _"  [71,71,71] 70)
    9.28 @@ -64,10 +56,6 @@
    9.29    "@subcls"  :: "prog \<Rightarrow> [qtname, qtname] \<Rightarrow> bool" ("_\<turnstile>_\<prec>\<^sub>C _"  [71,71,71] 70)
    9.30    *)
    9.31    "@implmt1" :: "prog \<Rightarrow> [qtname, qtname] \<Rightarrow> bool" ("_\<turnstile>_\<leadsto>1_"  [71,71,71] 70)
    9.32 -  "@implmt"  :: "prog \<Rightarrow> [qtname, qtname] \<Rightarrow> bool" ("_\<turnstile>_\<leadsto>_"   [71,71,71] 70)
    9.33 -  "@widen"   :: "prog \<Rightarrow> [ty   , ty   ] \<Rightarrow> bool" ("_\<turnstile>_\<preceq>_"    [71,71,71] 70)
    9.34 -  "@narrow"  :: "prog \<Rightarrow> [ty   , ty   ] \<Rightarrow> bool" ("_\<turnstile>_\<succ>_"    [71,71,71] 70)
    9.35 -  "@cast"    :: "prog \<Rightarrow> [ty   , ty   ] \<Rightarrow> bool" ("_\<turnstile>_\<preceq>? _"  [71,71,71] 70)
    9.36  
    9.37  translations
    9.38  
    9.39 @@ -78,10 +66,6 @@
    9.40  	"G\<turnstile>C \<preceq>\<^sub>C  D" == "(C,D) \<in>(subcls1 G)^*" 
    9.41  	*)
    9.42          "G\<turnstile>C \<leadsto>1 I" == "(C,I) \<in> implmt1 G"
    9.43 -	"G\<turnstile>C \<leadsto>  I" == "(C,I) \<in> implmt  G"
    9.44 -	"G\<turnstile>S \<preceq>   T" == "(S,T) \<in> widen   G"
    9.45 -	"G\<turnstile>S \<succ>   T" == "(S,T) \<in> narrow  G"
    9.46 -	"G\<turnstile>S \<preceq>?  T" == "(S,T) \<in> cast    G"
    9.47  
    9.48  
    9.49  section "subclass and subinterface relations"
    9.50 @@ -367,11 +351,13 @@
    9.51  done
    9.52  
    9.53  
    9.54 -inductive "implmt G" intros                    --{* cf. 8.1.4 *}
    9.55 -
    9.56 +inductive2 --{* implementation, cf. 8.1.4 *}
    9.57 +  implmt :: "prog \<Rightarrow> qtname \<Rightarrow> qtname \<Rightarrow> bool" ("_\<turnstile>_\<leadsto>_" [71,71,71] 70)
    9.58 +  for G :: prog
    9.59 +where
    9.60    direct:         "G\<turnstile>C\<leadsto>1J     \<spacespace>\<spacespace>     \<Longrightarrow> G\<turnstile>C\<leadsto>J"
    9.61 -  subint:        "\<lbrakk>G\<turnstile>C\<leadsto>1I; G\<turnstile>I\<preceq>I J\<rbrakk>  \<Longrightarrow> G\<turnstile>C\<leadsto>J"
    9.62 -  subcls1:       "\<lbrakk>G\<turnstile>C\<prec>\<^sub>C\<^sub>1D; G\<turnstile>D\<leadsto>J \<rbrakk>  \<Longrightarrow> G\<turnstile>C\<leadsto>J"
    9.63 +| subint:        "\<lbrakk>G\<turnstile>C\<leadsto>1I; G\<turnstile>I\<preceq>I J\<rbrakk>  \<Longrightarrow> G\<turnstile>C\<leadsto>J"
    9.64 +| subcls1:       "\<lbrakk>G\<turnstile>C\<prec>\<^sub>C\<^sub>1D; G\<turnstile>D\<leadsto>J \<rbrakk>  \<Longrightarrow> G\<turnstile>C\<leadsto>J"
    9.65  
    9.66  lemma implmtD: "G\<turnstile>C\<leadsto>J \<Longrightarrow> (\<exists>I. G\<turnstile>C\<leadsto>1I \<and> G\<turnstile>I\<preceq>I J) \<or> (\<exists>D. G\<turnstile>C\<prec>\<^sub>C\<^sub>1D \<and> G\<turnstile>D\<leadsto>J)" 
    9.67  apply (erule implmt.induct)
    9.68 @@ -399,17 +385,20 @@
    9.69  
    9.70  section "widening relation"
    9.71  
    9.72 -inductive "widen G" intros
    9.73 +inductive2
    9.74   --{*widening, viz. method invocation conversion, cf. 5.3
    9.75  			    i.e. kind of syntactic subtyping *}
    9.76 +  widen :: "prog \<Rightarrow> ty \<Rightarrow> ty \<Rightarrow> bool" ("_\<turnstile>_\<preceq>_" [71,71,71] 70)
    9.77 +  for G :: prog
    9.78 +where
    9.79    refl:    "G\<turnstile>T\<preceq>T" --{*identity conversion, cf. 5.1.1 *}
    9.80 -  subint:  "G\<turnstile>I\<preceq>I J  \<Longrightarrow> G\<turnstile>Iface I\<preceq> Iface J" --{*wid.ref.conv.,cf. 5.1.4 *}
    9.81 -  int_obj: "G\<turnstile>Iface I\<preceq> Class Object"
    9.82 -  subcls:  "G\<turnstile>C\<preceq>\<^sub>C D  \<Longrightarrow> G\<turnstile>Class C\<preceq> Class D"
    9.83 -  implmt:  "G\<turnstile>C\<leadsto>I   \<Longrightarrow> G\<turnstile>Class C\<preceq> Iface I"
    9.84 -  null:    "G\<turnstile>NT\<preceq> RefT R"
    9.85 -  arr_obj: "G\<turnstile>T.[]\<preceq> Class Object"
    9.86 -  array:   "G\<turnstile>RefT S\<preceq>RefT T \<Longrightarrow> G\<turnstile>RefT S.[]\<preceq> RefT T.[]"
    9.87 +| subint:  "G\<turnstile>I\<preceq>I J  \<Longrightarrow> G\<turnstile>Iface I\<preceq> Iface J" --{*wid.ref.conv.,cf. 5.1.4 *}
    9.88 +| int_obj: "G\<turnstile>Iface I\<preceq> Class Object"
    9.89 +| subcls:  "G\<turnstile>C\<preceq>\<^sub>C D  \<Longrightarrow> G\<turnstile>Class C\<preceq> Class D"
    9.90 +| implmt:  "G\<turnstile>C\<leadsto>I   \<Longrightarrow> G\<turnstile>Class C\<preceq> Iface I"
    9.91 +| null:    "G\<turnstile>NT\<preceq> RefT R"
    9.92 +| arr_obj: "G\<turnstile>T.[]\<preceq> Class Object"
    9.93 +| array:   "G\<turnstile>RefT S\<preceq>RefT T \<Longrightarrow> G\<turnstile>RefT S.[]\<preceq> RefT T.[]"
    9.94  
    9.95  declare widen.refl [intro!]
    9.96  declare widen.intros [simp]
    9.97 @@ -418,14 +407,14 @@
    9.98  lemma widen_PrimT: "G\<turnstile>PrimT x\<preceq>T \<Longrightarrow> T = PrimT x"
    9.99  *)
   9.100  lemma widen_PrimT: "G\<turnstile>PrimT x\<preceq>T \<Longrightarrow> (\<exists>y. T = PrimT y)"
   9.101 -apply (ind_cases "G\<turnstile>S\<preceq>T")
   9.102 +apply (ind_cases2 "G\<turnstile>PrimT x\<preceq>T")
   9.103  by auto
   9.104  
   9.105  (* too strong in general:
   9.106  lemma widen_PrimT2: "G\<turnstile>S\<preceq>PrimT x \<Longrightarrow> S = PrimT x"
   9.107  *)
   9.108  lemma widen_PrimT2: "G\<turnstile>S\<preceq>PrimT x \<Longrightarrow> \<exists>y. S = PrimT y"
   9.109 -apply (ind_cases "G\<turnstile>S\<preceq>T")
   9.110 +apply (ind_cases2 "G\<turnstile>S\<preceq>PrimT x")
   9.111  by auto
   9.112  
   9.113  text {* 
   9.114 @@ -435,37 +424,37 @@
   9.115   *}
   9.116  
   9.117  lemma widen_PrimT_strong: "G\<turnstile>PrimT x\<preceq>T \<Longrightarrow> T = PrimT x"
   9.118 -by (ind_cases "G\<turnstile>S\<preceq>T") simp_all
   9.119 +by (ind_cases2 "G\<turnstile>PrimT x\<preceq>T") simp_all
   9.120  
   9.121  lemma widen_PrimT2_strong: "G\<turnstile>S\<preceq>PrimT x \<Longrightarrow> S = PrimT x"
   9.122 -by (ind_cases "G\<turnstile>S\<preceq>T") simp_all
   9.123 +by (ind_cases2 "G\<turnstile>S\<preceq>PrimT x") simp_all
   9.124  
   9.125  text {* Specialized versions for booleans also would work for real Java *}
   9.126  
   9.127  lemma widen_Boolean: "G\<turnstile>PrimT Boolean\<preceq>T \<Longrightarrow> T = PrimT Boolean"
   9.128 -by (ind_cases "G\<turnstile>S\<preceq>T") simp_all
   9.129 +by (ind_cases2 "G\<turnstile>PrimT Boolean\<preceq>T") simp_all
   9.130  
   9.131  lemma widen_Boolean2: "G\<turnstile>S\<preceq>PrimT Boolean \<Longrightarrow> S = PrimT Boolean"
   9.132 -by (ind_cases "G\<turnstile>S\<preceq>T") simp_all
   9.133 +by (ind_cases2 "G\<turnstile>S\<preceq>PrimT Boolean") simp_all
   9.134  
   9.135  lemma widen_RefT: "G\<turnstile>RefT R\<preceq>T \<Longrightarrow> \<exists>t. T=RefT t"
   9.136 -apply (ind_cases "G\<turnstile>S\<preceq>T")
   9.137 +apply (ind_cases2 "G\<turnstile>RefT R\<preceq>T")
   9.138  by auto
   9.139  
   9.140  lemma widen_RefT2: "G\<turnstile>S\<preceq>RefT R \<Longrightarrow> \<exists>t. S=RefT t"
   9.141 -apply (ind_cases "G\<turnstile>S\<preceq>T")
   9.142 +apply (ind_cases2 "G\<turnstile>S\<preceq>RefT R")
   9.143  by auto
   9.144  
   9.145  lemma widen_Iface: "G\<turnstile>Iface I\<preceq>T \<Longrightarrow> T=Class Object \<or> (\<exists>J. T=Iface J)"
   9.146 -apply (ind_cases "G\<turnstile>S\<preceq>T")
   9.147 +apply (ind_cases2 "G\<turnstile>Iface I\<preceq>T")
   9.148  by auto
   9.149  
   9.150  lemma widen_Iface2: "G\<turnstile>S\<preceq> Iface J \<Longrightarrow> S = NT \<or> (\<exists>I. S = Iface I) \<or> (\<exists>D. S = Class D)"
   9.151 -apply (ind_cases "G\<turnstile>S\<preceq>T")
   9.152 +apply (ind_cases2 "G\<turnstile>S\<preceq> Iface J")
   9.153  by auto
   9.154  
   9.155  lemma widen_Iface_Iface: "G\<turnstile>Iface I\<preceq> Iface J \<Longrightarrow> G\<turnstile>I\<preceq>I J"
   9.156 -apply (ind_cases "G\<turnstile>S\<preceq>T")
   9.157 +apply (ind_cases2 "G\<turnstile>Iface I\<preceq> Iface J")
   9.158  by auto
   9.159  
   9.160  lemma widen_Iface_Iface_eq [simp]: "G\<turnstile>Iface I\<preceq> Iface J = G\<turnstile>I\<preceq>I J"
   9.161 @@ -475,15 +464,15 @@
   9.162  done
   9.163  
   9.164  lemma widen_Class: "G\<turnstile>Class C\<preceq>T \<Longrightarrow>  (\<exists>D. T=Class D) \<or> (\<exists>I. T=Iface I)"
   9.165 -apply (ind_cases "G\<turnstile>S\<preceq>T")
   9.166 +apply (ind_cases2 "G\<turnstile>Class C\<preceq>T")
   9.167  by auto
   9.168  
   9.169  lemma widen_Class2: "G\<turnstile>S\<preceq> Class C \<Longrightarrow> C = Object \<or> S = NT \<or> (\<exists>D. S = Class D)"
   9.170 -apply (ind_cases "G\<turnstile>S\<preceq>T")
   9.171 +apply (ind_cases2 "G\<turnstile>S\<preceq> Class C")
   9.172  by auto
   9.173  
   9.174  lemma widen_Class_Class: "G\<turnstile>Class C\<preceq> Class cm \<Longrightarrow> G\<turnstile>C\<preceq>\<^sub>C cm"
   9.175 -apply (ind_cases "G\<turnstile>S\<preceq>T")
   9.176 +apply (ind_cases2 "G\<turnstile>Class C\<preceq> Class cm")
   9.177  by auto
   9.178  
   9.179  lemma widen_Class_Class_eq [simp]: "G\<turnstile>Class C\<preceq> Class cm = G\<turnstile>C\<preceq>\<^sub>C cm"
   9.180 @@ -493,7 +482,7 @@
   9.181  done
   9.182  
   9.183  lemma widen_Class_Iface: "G\<turnstile>Class C\<preceq> Iface I \<Longrightarrow> G\<turnstile>C\<leadsto>I"
   9.184 -apply (ind_cases "G\<turnstile>S\<preceq>T")
   9.185 +apply (ind_cases2 "G\<turnstile>Class C\<preceq> Iface I")
   9.186  by auto
   9.187  
   9.188  lemma widen_Class_Iface_eq [simp]: "G\<turnstile>Class C\<preceq> Iface I = G\<turnstile>C\<leadsto>I"
   9.189 @@ -503,21 +492,21 @@
   9.190  done
   9.191  
   9.192  lemma widen_Array: "G\<turnstile>S.[]\<preceq>T \<Longrightarrow> T=Class Object \<or> (\<exists>T'. T=T'.[] \<and> G\<turnstile>S\<preceq>T')"
   9.193 -apply (ind_cases "G\<turnstile>S\<preceq>T")
   9.194 +apply (ind_cases2 "G\<turnstile>S.[]\<preceq>T")
   9.195  by auto
   9.196  
   9.197  lemma widen_Array2: "G\<turnstile>S\<preceq>T.[] \<Longrightarrow> S = NT \<or> (\<exists>S'. S=S'.[] \<and> G\<turnstile>S'\<preceq>T)"
   9.198 -apply (ind_cases "G\<turnstile>S\<preceq>T")
   9.199 +apply (ind_cases2 "G\<turnstile>S\<preceq>T.[]")
   9.200  by auto
   9.201  
   9.202  
   9.203  lemma widen_ArrayPrimT: "G\<turnstile>PrimT t.[]\<preceq>T \<Longrightarrow> T=Class Object \<or> T=PrimT t.[]"
   9.204 -apply (ind_cases "G\<turnstile>S\<preceq>T")
   9.205 +apply (ind_cases2 "G\<turnstile>PrimT t.[]\<preceq>T")
   9.206  by auto
   9.207  
   9.208  lemma widen_ArrayRefT: 
   9.209    "G\<turnstile>RefT t.[]\<preceq>T \<Longrightarrow> T=Class Object \<or> (\<exists>s. T=RefT s.[] \<and> G\<turnstile>RefT t\<preceq>RefT s)"
   9.210 -apply (ind_cases "G\<turnstile>S\<preceq>T")
   9.211 +apply (ind_cases2 "G\<turnstile>RefT t.[]\<preceq>T")
   9.212  by auto
   9.213  
   9.214  lemma widen_ArrayRefT_ArrayRefT_eq [simp]: 
   9.215 @@ -538,7 +527,7 @@
   9.216  
   9.217  
   9.218  lemma widen_NT2: "G\<turnstile>S\<preceq>NT \<Longrightarrow> S = NT"
   9.219 -apply (ind_cases "G\<turnstile>S\<preceq>T")
   9.220 +apply (ind_cases2 "G\<turnstile>S\<preceq>NT")
   9.221  by auto
   9.222  
   9.223  lemma widen_Object:"\<lbrakk>isrtype G T;ws_prog G\<rbrakk> \<Longrightarrow> G\<turnstile>RefT T \<preceq> Class Object"
   9.224 @@ -621,35 +610,35 @@
   9.225  *)
   9.226  
   9.227  (* more detailed than necessary for type-safety, see above rules. *)
   9.228 -inductive "narrow G" intros (* narrowing reference conversion, cf. 5.1.5 *)
   9.229 -
   9.230 +inductive2 --{* narrowing reference conversion, cf. 5.1.5 *}
   9.231 +  narrow :: "prog \<Rightarrow> ty \<Rightarrow> ty \<Rightarrow> bool" ("_\<turnstile>_\<succ>_" [71,71,71] 70)
   9.232 +  for G :: prog
   9.233 +where
   9.234    subcls:  "G\<turnstile>C\<preceq>\<^sub>C D \<Longrightarrow> G\<turnstile>     Class D\<succ>Class C"
   9.235 -  implmt:  "\<not>G\<turnstile>C\<leadsto>I \<Longrightarrow> G\<turnstile>     Class C\<succ>Iface I"
   9.236 -  obj_arr: "G\<turnstile>Class Object\<succ>T.[]"
   9.237 -  int_cls: "G\<turnstile>     Iface I\<succ>Class C"
   9.238 -  subint:  "imethds G I hidings imethds G J entails 
   9.239 +| implmt:  "\<not>G\<turnstile>C\<leadsto>I \<Longrightarrow> G\<turnstile>     Class C\<succ>Iface I"
   9.240 +| obj_arr: "G\<turnstile>Class Object\<succ>T.[]"
   9.241 +| int_cls: "G\<turnstile>     Iface I\<succ>Class C"
   9.242 +| subint:  "imethds G I hidings imethds G J entails 
   9.243  	   (\<lambda>(md, mh   ) (md',mh').\<spacespace>G\<turnstile>mrt mh\<preceq>mrt mh') \<Longrightarrow>
   9.244  	   \<not>G\<turnstile>I\<preceq>I J         \<spacespace>\<spacespace>\<spacespace>\<Longrightarrow> G\<turnstile>     Iface I\<succ>Iface J"
   9.245 -  array:   "G\<turnstile>RefT S\<succ>RefT T   \<spacespace>\<Longrightarrow> G\<turnstile>   RefT S.[]\<succ>RefT T.[]"
   9.246 +| array:   "G\<turnstile>RefT S\<succ>RefT T   \<spacespace>\<Longrightarrow> G\<turnstile>   RefT S.[]\<succ>RefT T.[]"
   9.247  
   9.248  (*unused*)
   9.249  lemma narrow_RefT: "G\<turnstile>RefT R\<succ>T \<Longrightarrow> \<exists>t. T=RefT t"
   9.250 -apply (ind_cases "G\<turnstile>S\<succ>T")
   9.251 +apply (ind_cases2 "G\<turnstile>RefT R\<succ>T")
   9.252  by auto
   9.253  
   9.254  lemma narrow_RefT2: "G\<turnstile>S\<succ>RefT R \<Longrightarrow> \<exists>t. S=RefT t"
   9.255 -apply (ind_cases "G\<turnstile>S\<succ>T")
   9.256 +apply (ind_cases2 "G\<turnstile>S\<succ>RefT R")
   9.257  by auto
   9.258  
   9.259  (*unused*)
   9.260  lemma narrow_PrimT: "G\<turnstile>PrimT pt\<succ>T \<Longrightarrow> \<exists>t. T=PrimT t"
   9.261 -apply (ind_cases "G\<turnstile>S\<succ>T")
   9.262 -by auto
   9.263 +by (ind_cases2 "G\<turnstile>PrimT pt\<succ>T")
   9.264  
   9.265  lemma narrow_PrimT2: "G\<turnstile>S\<succ>PrimT pt \<Longrightarrow>  
   9.266  				  \<exists>t. S=PrimT t \<and> G\<turnstile>PrimT t\<preceq>PrimT pt"
   9.267 -apply (ind_cases "G\<turnstile>S\<succ>T")
   9.268 -by auto
   9.269 +by (ind_cases2 "G\<turnstile>S\<succ>PrimT pt")
   9.270  
   9.271  text {* 
   9.272     These narrowing lemmata hold in Bali but are to strong for ordinary
   9.273 @@ -657,42 +646,44 @@
   9.274     long, int. These lemmata are just for documentation and are not used.
   9.275   *}
   9.276  lemma narrow_PrimT_strong: "G\<turnstile>PrimT pt\<succ>T \<Longrightarrow> T=PrimT pt"
   9.277 -by (ind_cases "G\<turnstile>S\<succ>T") simp_all
   9.278 +by (ind_cases2 "G\<turnstile>PrimT pt\<succ>T")
   9.279  
   9.280  lemma narrow_PrimT2_strong: "G\<turnstile>S\<succ>PrimT pt \<Longrightarrow> S=PrimT pt"
   9.281 -by (ind_cases "G\<turnstile>S\<succ>T") simp_all
   9.282 +by (ind_cases2 "G\<turnstile>S\<succ>PrimT pt")
   9.283  
   9.284  text {* Specialized versions for booleans also would work for real Java *}
   9.285  
   9.286  lemma narrow_Boolean: "G\<turnstile>PrimT Boolean\<succ>T \<Longrightarrow> T=PrimT Boolean"
   9.287 -by (ind_cases "G\<turnstile>S\<succ>T") simp_all
   9.288 +by (ind_cases2 "G\<turnstile>PrimT Boolean\<succ>T")
   9.289  
   9.290  lemma narrow_Boolean2: "G\<turnstile>S\<succ>PrimT Boolean \<Longrightarrow> S=PrimT Boolean"
   9.291 -by (ind_cases "G\<turnstile>S\<succ>T") simp_all
   9.292 +by (ind_cases2 "G\<turnstile>S\<succ>PrimT Boolean")
   9.293  
   9.294  section "casting relation"
   9.295  
   9.296 -inductive "cast G" intros --{* casting conversion, cf. 5.5 *}
   9.297 -
   9.298 +inductive2 --{* casting conversion, cf. 5.5 *}
   9.299 +  cast :: "prog \<Rightarrow> ty \<Rightarrow> ty \<Rightarrow> bool" ("_\<turnstile>_\<preceq>? _" [71,71,71] 70)
   9.300 +  for G :: prog
   9.301 +where
   9.302    widen:   "G\<turnstile>S\<preceq>T \<Longrightarrow> G\<turnstile>S\<preceq>? T"
   9.303 -  narrow:  "G\<turnstile>S\<succ>T \<Longrightarrow> G\<turnstile>S\<preceq>? T"
   9.304 +| narrow:  "G\<turnstile>S\<succ>T \<Longrightarrow> G\<turnstile>S\<preceq>? T"
   9.305  
   9.306  (*unused*)
   9.307  lemma cast_RefT: "G\<turnstile>RefT R\<preceq>? T \<Longrightarrow> \<exists>t. T=RefT t"
   9.308 -apply (ind_cases "G\<turnstile>S\<preceq>? T")
   9.309 +apply (ind_cases2 "G\<turnstile>RefT R\<preceq>? T")
   9.310  by (auto dest: widen_RefT narrow_RefT)
   9.311  
   9.312  lemma cast_RefT2: "G\<turnstile>S\<preceq>? RefT R \<Longrightarrow> \<exists>t. S=RefT t"
   9.313 -apply (ind_cases "G\<turnstile>S\<preceq>? T")
   9.314 +apply (ind_cases2 "G\<turnstile>S\<preceq>? RefT R")
   9.315  by (auto dest: widen_RefT2 narrow_RefT2)
   9.316  
   9.317  (*unused*)
   9.318  lemma cast_PrimT: "G\<turnstile>PrimT pt\<preceq>? T \<Longrightarrow> \<exists>t. T=PrimT t"
   9.319 -apply (ind_cases "G\<turnstile>S\<preceq>? T")
   9.320 +apply (ind_cases2 "G\<turnstile>PrimT pt\<preceq>? T")
   9.321  by (auto dest: widen_PrimT narrow_PrimT)
   9.322  
   9.323  lemma cast_PrimT2: "G\<turnstile>S\<preceq>? PrimT pt \<Longrightarrow> \<exists>t. S=PrimT t \<and> G\<turnstile>PrimT t\<preceq>PrimT pt"
   9.324 -apply (ind_cases "G\<turnstile>S\<preceq>? T")
   9.325 +apply (ind_cases2 "G\<turnstile>S\<preceq>? PrimT pt")
   9.326  by (auto dest: widen_PrimT2 narrow_PrimT2)
   9.327  
   9.328  lemma cast_Boolean: 
    10.1 --- a/src/HOL/Bali/TypeSafe.thy	Mon Dec 11 12:28:16 2006 +0100
    10.2 +++ b/src/HOL/Bali/TypeSafe.thy	Mon Dec 11 16:06:14 2006 +0100
    10.3 @@ -226,7 +226,7 @@
    10.4  
    10.5  lemmas eval_gext = eval_gext_lemma [THEN conjunct1]
    10.6  
    10.7 -lemma eval_gext': "G\<turnstile>(x1,s1) \<midarrow>t\<succ>\<rightarrow> (w,x2,s2) \<Longrightarrow> s1\<le>|s2"
    10.8 +lemma eval_gext': "G\<turnstile>(x1,s1) \<midarrow>t\<succ>\<rightarrow> (w,(x2,s2)) \<Longrightarrow> s1\<le>|s2"
    10.9  apply (drule eval_gext)
   10.10  apply auto
   10.11  done
   10.12 @@ -1735,7 +1735,7 @@
   10.13                   \<Longrightarrow> ?Conform L s1 \<and> ?ValueTyped L T s1 t v \<and>
   10.14                       ?ErrorFree s0 s1")
   10.15    proof (induct)
   10.16 -    case (Abrupt s t xc L accC T A) 
   10.17 +    case (Abrupt xc s t L accC T A) 
   10.18      have "(Some xc, s)\<Colon>\<preceq>(G,L)" .
   10.19      then show "(Some xc, s)\<Colon>\<preceq>(G,L) \<and> 
   10.20        (normal (Some xc, s) 
   10.21 @@ -1751,7 +1751,7 @@
   10.22                (error_free (Norm s) = error_free (Norm s))"
   10.23        by (simp)
   10.24    next
   10.25 -    case (Expr e s0 s1 v L accC T A)
   10.26 +    case (Expr s0 e v s1 L accC T A)
   10.27      have "G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<rightarrow> s1" .
   10.28      have     hyp: "PROP ?TypeSafe (Norm s0) s1 (In1l e) (In1 v)" .
   10.29      have conf_s0: "Norm s0\<Colon>\<preceq>(G, L)" .
   10.30 @@ -1773,7 +1773,7 @@
   10.31            (error_free (Norm s0) = error_free s1)"
   10.32        by (simp)
   10.33    next
   10.34 -    case (Lab c l s0 s1 L accC T A)
   10.35 +    case (Lab s0 c s1 l L accC T A)
   10.36      have     hyp: "PROP ?TypeSafe (Norm s0) s1 (In1r c) \<diamondsuit>" .
   10.37      have conf_s0: "Norm s0\<Colon>\<preceq>(G, L)" .
   10.38      moreover
   10.39 @@ -1796,7 +1796,7 @@
   10.40            (error_free (Norm s0) = error_free (abupd (absorb l) s1))"
   10.41        by (simp)
   10.42    next
   10.43 -    case (Comp c1 c2 s0 s1 s2 L accC T A)
   10.44 +    case (Comp s0 c1 s1 c2 s2 L accC T A)
   10.45      have eval_c1: "G\<turnstile>Norm s0 \<midarrow>c1\<rightarrow> s1" .
   10.46      have eval_c2: "G\<turnstile>s1 \<midarrow>c2\<rightarrow> s2" .
   10.47      have  hyp_c1: "PROP ?TypeSafe (Norm s0) s1 (In1r c1) \<diamondsuit>" .
   10.48 @@ -1842,7 +1842,7 @@
   10.49  	using wt by simp
   10.50      qed
   10.51    next
   10.52 -    case (If b c1 c2 e s0 s1 s2 L accC T)
   10.53 +    case (If s0 e b s1 c1 c2 s2 L accC T A)
   10.54      have eval_e: "G\<turnstile>Norm s0 \<midarrow>e-\<succ>b\<rightarrow> s1" .
   10.55      have eval_then_else: "G\<turnstile>s1 \<midarrow>(if the_Bool b then c1 else c2)\<rightarrow> s2" .
   10.56      have hyp_e: "PROP ?TypeSafe (Norm s0) s1 (In1l e) (In1 b)" .
   10.57 @@ -1917,7 +1917,7 @@
   10.58            a boolean value is part of @{term hyp_e}. See also Loop 
   10.59         *}
   10.60    next
   10.61 -    case (Loop b c e l s0 s1 s2 s3 L accC T A)
   10.62 +    case (Loop s0 e b s1 c s2 l s3 L accC T A)
   10.63      have eval_e: "G\<turnstile>Norm s0 \<midarrow>e-\<succ>b\<rightarrow> s1" .
   10.64      have hyp_e: "PROP ?TypeSafe (Norm s0) s1 (In1l e) (In1 b)" .
   10.65      have conf_s0: "Norm s0\<Colon>\<preceq>(G, L)" .
   10.66 @@ -2048,7 +2048,7 @@
   10.67  	by simp
   10.68      qed
   10.69    next
   10.70 -    case (Jmp j s L accC T A)
   10.71 +    case (Jmp s j L accC T A)
   10.72      have "Norm s\<Colon>\<preceq>(G, L)" .
   10.73      moreover
   10.74      from Jmp.prems 
   10.75 @@ -2062,7 +2062,7 @@
   10.76             (error_free (Norm s) = error_free (Some (Jump j), s))"
   10.77        by simp
   10.78    next
   10.79 -    case (Throw a e s0 s1 L accC T A)
   10.80 +    case (Throw s0 e a s1 L accC T A)
   10.81      have "G\<turnstile>Norm s0 \<midarrow>e-\<succ>a\<rightarrow> s1" .
   10.82      have hyp: "PROP ?TypeSafe (Norm s0) s1 (In1l e) (In1 a)" .
   10.83      have conf_s0: "Norm s0\<Colon>\<preceq>(G, L)" .
   10.84 @@ -2090,7 +2090,7 @@
   10.85              (error_free (Norm s0) = error_free (abupd (throw a) s1))"
   10.86        by simp
   10.87    next
   10.88 -    case (Try catchC c1 c2 s0 s1 s2 s3 vn L accC T A)
   10.89 +    case (Try s0 c1 s1 s2 catchC vn c2 s3 L accC T A)
   10.90      have eval_c1: "G\<turnstile>Norm s0 \<midarrow>c1\<rightarrow> s1" .
   10.91      have sx_alloc: "G\<turnstile>s1 \<midarrow>sxalloc\<rightarrow> s2" .
   10.92      have hyp_c1: "PROP ?TypeSafe (Norm s0) s1 (In1r c1) \<diamondsuit>" .
   10.93 @@ -2207,7 +2207,7 @@
   10.94        qed
   10.95      qed
   10.96    next
   10.97 -    case (Fin c1 c2 s0 s1 s2 s3 x1 L accC T A)
   10.98 +    case (Fin s0 c1 x1 s1 c2 s2 s3 L accC T A)
   10.99      have eval_c1: "G\<turnstile>Norm s0 \<midarrow>c1\<rightarrow> (x1, s1)" .
  10.100      have eval_c2: "G\<turnstile>Norm s1 \<midarrow>c2\<rightarrow> s2" .
  10.101      have s3: "s3= (if \<exists>err. x1 = Some (Error err) 
  10.102 @@ -2276,7 +2276,7 @@
  10.103  	by (cases s2) auto
  10.104      qed
  10.105    next
  10.106 -    case (Init C c s0 s1 s2 s3 L accC T)
  10.107 +    case (Init C c s0 s3 s1 s2 L accC T A)
  10.108      have     cls: "the (class G C) = c" .
  10.109      have conf_s0: "Norm s0\<Colon>\<preceq>(G, L)" .
  10.110      have      wt: "\<lparr>prg = G, cls = accC, lcl = L\<rparr>\<turnstile>In1r (Init C)\<Colon>T" .
  10.111 @@ -2382,7 +2382,7 @@
  10.112  	by simp
  10.113      qed
  10.114    next
  10.115 -    case (NewC C a s0 s1 s2 L accC T A)
  10.116 +    case (NewC s0 C s1 a s2 L accC T A)
  10.117      have         "G\<turnstile>Norm s0 \<midarrow>Init C\<rightarrow> s1" .
  10.118      have halloc: "G\<turnstile>s1 \<midarrow>halloc CInst C\<succ>a\<rightarrow> s2" .
  10.119      have hyp: "PROP ?TypeSafe (Norm s0) s1 (In1r (Init C)) \<diamondsuit>" .
  10.120 @@ -2414,7 +2414,7 @@
  10.121            (error_free (Norm s0) = error_free s2)"
  10.122        by auto
  10.123    next
  10.124 -    case (NewA elT a e i s0 s1 s2 s3 L accC T A)
  10.125 +    case (NewA s0 elT s1 e i s2 a s3 L accC T A)
  10.126      have eval_init: "G\<turnstile>Norm s0 \<midarrow>init_comp_ty elT\<rightarrow> s1" .
  10.127      have eval_e: "G\<turnstile>s1 \<midarrow>e-\<succ>i\<rightarrow> s2" .
  10.128      have halloc: "G\<turnstile>abupd (check_neg i) s2\<midarrow>halloc Arr elT (the_Intg i)\<succ>a\<rightarrow> s3".
  10.129 @@ -2485,7 +2485,7 @@
  10.130            (error_free (Norm s0) = error_free s3) "
  10.131        by simp
  10.132    next
  10.133 -    case (Cast castT e s0 s1 s2 v L accC T A)
  10.134 +    case (Cast s0 e v s1 s2 castT L accC T A)
  10.135      have "G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<rightarrow> s1" .
  10.136      have s2:"s2 = abupd (raise_if (\<not> G,store s1\<turnstile>v fits castT) ClassCast) s1" .
  10.137      have hyp: "PROP ?TypeSafe (Norm s0) s1 (In1l e) (In1 v)" .
  10.138 @@ -2531,7 +2531,7 @@
  10.139             (error_free (Norm s0) = error_free s2)"
  10.140        by blast
  10.141    next
  10.142 -    case (Inst instT b e s0 s1 v L accC T A)
  10.143 +    case (Inst s0 e v s1 b instT L accC T A)
  10.144      have hyp: "PROP ?TypeSafe (Norm s0) s1 (In1l e) (In1 v)" .
  10.145      have conf_s0: "Norm s0\<Colon>\<preceq>(G, L)" .
  10.146      from Inst.prems obtain eT
  10.147 @@ -2555,7 +2555,7 @@
  10.148        by (auto elim!: wt_elim_cases 
  10.149                 intro: conf_litval simp add: empty_dt_def)
  10.150    next
  10.151 -    case (UnOp e s0 s1 unop v L accC T A)
  10.152 +    case (UnOp s0 e v s1 unop L accC T A)
  10.153      have hyp: "PROP ?TypeSafe (Norm s0) s1 (In1l e) (In1 v)" .
  10.154      have conf_s0: "Norm s0\<Colon>\<preceq>(G, L)" .
  10.155      have      wt: "\<lparr>prg = G, cls = accC, lcl = L\<rparr>\<turnstile>In1l (UnOp unop e)\<Colon>T" .
  10.156 @@ -2582,7 +2582,7 @@
  10.157       error_free (Norm s0) = error_free s1"
  10.158        by simp
  10.159    next
  10.160 -    case (BinOp binop e1 e2 s0 s1 s2 v1 v2 L accC T A)
  10.161 +    case (BinOp s0 e1 v1 s1 binop e2 v2 s2 L accC T A)
  10.162      have eval_e1: "G\<turnstile>Norm s0 \<midarrow>e1-\<succ>v1\<rightarrow> s1" .
  10.163      have eval_e2: "G\<turnstile>s1 \<midarrow>(if need_second_arg binop v1 then In1l e2
  10.164                               else In1r Skip)\<succ>\<rightarrow> (In1 v2, s2)" .
  10.165 @@ -2698,7 +2698,7 @@
  10.166             (error_free (Norm s) = error_free (Norm s))"
  10.167        by simp
  10.168    next
  10.169 -    case (Acc upd s0 s1 w v L accC T A) 
  10.170 +    case (Acc s0 v w upd s1 L accC T A)
  10.171      have hyp: "PROP ?TypeSafe (Norm s0) s1 (In2 v) (In2 (w,upd))" .
  10.172      have conf_s0: "Norm s0\<Colon>\<preceq>(G, L)" .
  10.173      from Acc.prems obtain vT where
  10.174 @@ -2738,7 +2738,7 @@
  10.175      with conf_s1 error_free_s1 show ?case
  10.176        by simp
  10.177    next
  10.178 -    case (Ass e upd s0 s1 s2 v var w L accC T A)
  10.179 +    case (Ass s0 var w upd s1 e v s2 L accC T A)
  10.180      have eval_var: "G\<turnstile>Norm s0 \<midarrow>var=\<succ>(w, upd)\<rightarrow> s1" .
  10.181      have   eval_e: "G\<turnstile>s1 \<midarrow>e-\<succ>v\<rightarrow> s2" .
  10.182      have  hyp_var: "PROP ?TypeSafe (Norm s0) s1 (In2 var) (In2 (w,upd))" .
  10.183 @@ -2895,7 +2895,7 @@
  10.184        qed
  10.185      qed
  10.186    next
  10.187 -    case (Cond b e0 e1 e2 s0 s1 s2 v L accC T A)
  10.188 +    case (Cond s0 e0 b s1 e1 e2 v s2 L accC T A)
  10.189      have eval_e0: "G\<turnstile>Norm s0 \<midarrow>e0-\<succ>b\<rightarrow> s1" .
  10.190      have eval_e1_e2: "G\<turnstile>s1 \<midarrow>(if the_Bool b then e1 else e2)-\<succ>v\<rightarrow> s2" .
  10.191      have hyp_e0: "PROP ?TypeSafe (Norm s0) s1 (In1l e0) (In1 b)" .
  10.192 @@ -2988,8 +2988,8 @@
  10.193        qed
  10.194      qed
  10.195    next
  10.196 -    case (Call invDeclC a accC' args e mn mode pTs' s0 s1 s2 s3 s3' s4 statT 
  10.197 -           v vs L accC T A)
  10.198 +    case (Call s0 e a s1 args vs s2 invDeclC mode statT mn pTs' s3 s3' accC'
  10.199 +           v s4 L accC T A)
  10.200      have eval_e: "G\<turnstile>Norm s0 \<midarrow>e-\<succ>a\<rightarrow> s1" .
  10.201      have eval_args: "G\<turnstile>s1 \<midarrow>args\<doteq>\<succ>vs\<rightarrow> s2" .
  10.202      have invDeclC: "invDeclC 
  10.203 @@ -3332,7 +3332,7 @@
  10.204        qed
  10.205      qed
  10.206    next
  10.207 -    case (Methd D s0 s1 sig v L accC T A)
  10.208 +    case (Methd s0 D sig v s1 L accC T A)
  10.209      have "G\<turnstile>Norm s0 \<midarrow>body G D sig-\<succ>v\<rightarrow> s1" .
  10.210      have hyp:"PROP ?TypeSafe (Norm s0) s1 (In1l (body G D sig)) (In1 v)" .
  10.211      have conf_s0: "Norm s0\<Colon>\<preceq>(G, L)" .
  10.212 @@ -3357,7 +3357,7 @@
  10.213        using hyp [of _ _ "(Inl bodyT)"] conf_s0 
  10.214        by (auto simp add: Let_def body_def)
  10.215    next
  10.216 -    case (Body D c s0 s1 s2 s3 L accC T A)
  10.217 +    case (Body s0 D s1 c s2 s3 L accC T A)
  10.218      have eval_init: "G\<turnstile>Norm s0 \<midarrow>Init D\<rightarrow> s1" .
  10.219      have eval_c: "G\<turnstile>s1 \<midarrow>c\<rightarrow> s2" .
  10.220      have hyp_init: "PROP ?TypeSafe (Norm s0) s1 (In1r (Init D)) \<diamondsuit>" .
  10.221 @@ -3481,7 +3481,7 @@
  10.222                   (error_free (Norm s) = error_free (Norm s))"
  10.223        by (simp add: lvar_def) 
  10.224    next
  10.225 -    case (FVar a accC e fn s0 s1 s2 s2' s3 stat statDeclC v L accC' T A)
  10.226 +    case (FVar s0 statDeclC s1 e a s2 v s2' stat fn s3 accC L accC' T A)
  10.227      have eval_init: "G\<turnstile>Norm s0 \<midarrow>Init statDeclC\<rightarrow> s1" .
  10.228      have eval_e: "G\<turnstile>s1 \<midarrow>e-\<succ>a\<rightarrow> s2" .
  10.229      have fvar: "(v, s2') = fvar statDeclC stat fn a s2" .
  10.230 @@ -3597,7 +3597,7 @@
  10.231            (error_free (Norm s0) = error_free s3)"
  10.232        by auto
  10.233    next
  10.234 -    case (AVar a e1 e2 i s0 s1 s2 s2' v L accC T A)
  10.235 +    case (AVar s0 e1 a s1 e2 i s2 v s2' L accC T A)
  10.236      have eval_e1: "G\<turnstile>Norm s0 \<midarrow>e1-\<succ>a\<rightarrow> s1" .
  10.237      have eval_e2: "G\<turnstile>s1 \<midarrow>e2-\<succ>i\<rightarrow> s2" .
  10.238      have hyp_e1: "PROP ?TypeSafe (Norm s0) s1 (In1l e1) (In1 a)" .
  10.239 @@ -3697,7 +3697,7 @@
  10.240      then show ?case
  10.241        by (auto elim!: wt_elim_cases)
  10.242    next
  10.243 -    case (Cons e es s0 s1 s2 v vs L accC T A)
  10.244 +    case (Cons s0 e v s1 es vs s2 L accC T A)
  10.245      have eval_e: "G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<rightarrow> s1" .
  10.246      have eval_es: "G\<turnstile>s1 \<midarrow>es\<doteq>\<succ>vs\<rightarrow> s2" .
  10.247      have hyp_e: "PROP ?TypeSafe (Norm s0) s1 (In1l e) (In1 v)" .
  10.248 @@ -3905,7 +3905,7 @@
  10.249    next
  10.250      case Skip from skip show ?case by simp
  10.251    next
  10.252 -    case (Expr e s0 s1 v L accC T A) 
  10.253 +    case (Expr s0 e v s1 L accC T A) 
  10.254      from Expr.prems obtain eT where 
  10.255        "\<lparr>prg = G, cls = accC, lcl = L\<rparr>\<turnstile>e\<Colon>-eT"
  10.256        by (elim wt_elim_cases) 
  10.257 @@ -3919,7 +3919,7 @@
  10.258      ultimately show ?case
  10.259        by (rule expr)
  10.260    next
  10.261 -    case (Lab c l s0 s1 L accC T A)
  10.262 +    case (Lab s0 c s1 l L accC T A)
  10.263      from Lab.prems 
  10.264      have "\<lparr>prg = G, cls = accC, lcl = L\<rparr>\<turnstile>c\<Colon>\<surd>"
  10.265        by (elim wt_elim_cases)
  10.266 @@ -3933,7 +3933,7 @@
  10.267      ultimately show ?case
  10.268        by (rule lab)
  10.269    next
  10.270 -    case (Comp c1 c2 s0 s1 s2 L accC T A) 
  10.271 +    case (Comp s0 c1 s1 c2 s2 L accC T A) 
  10.272      have eval_c1: "G\<turnstile>Norm s0 \<midarrow>c1\<rightarrow> s1" .
  10.273      have eval_c2: "G\<turnstile>s1 \<midarrow>c2\<rightarrow> s2" .
  10.274      from Comp.prems obtain 
  10.275 @@ -3976,7 +3976,7 @@
  10.276      show ?case
  10.277        by (rule comp) iprover+
  10.278    next
  10.279 -    case (If b c1 c2 e s0 s1 s2 L accC T A)
  10.280 +    case (If s0 e b s1 c1 c2 s2 L accC T A)
  10.281      have eval_e: "G\<turnstile>Norm s0 \<midarrow>e-\<succ>b\<rightarrow> s1" .
  10.282      have eval_then_else: "G\<turnstile>s1 \<midarrow>(if the_Bool b then c1 else c2)\<rightarrow> s2" .
  10.283      from If.prems
    11.1 --- a/src/HOL/Bali/WellForm.thy	Mon Dec 11 12:28:16 2006 +0100
    11.2 +++ b/src/HOL/Bali/WellForm.thy	Mon Dec 11 16:06:14 2006 +0100
    11.3 @@ -883,7 +883,7 @@
    11.4      show "?Overrides new old" 
    11.5        by (auto intro: overridesR.Direct stat_override_declclasses_relation) 
    11.6    next
    11.7 -    case (Indirect inter new old)
    11.8 +    case (Indirect new inter old)
    11.9      then show "?Overrides new old" 
   11.10        by (blast intro: overridesR.Indirect) 
   11.11    qed
   11.12 @@ -1138,7 +1138,7 @@
   11.13        qed
   11.14      qed
   11.15    next
   11.16 -    case (Indirect inter new old)
   11.17 +    case (Indirect new inter old)
   11.18      assume accmodi_old: "accmodi old \<noteq> Package"
   11.19      assume "accmodi old \<noteq> Package \<Longrightarrow> G \<turnstile> inter overrides\<^sub>S old"
   11.20      with accmodi_old 
   11.21 @@ -1244,7 +1244,7 @@
   11.22      then show "pid (declclass old) =  pid (declclass new)"
   11.23        by (auto simp add: inheritable_in_def)
   11.24    next
   11.25 -    case (Indirect inter new old)
   11.26 +    case (Indirect new inter old)
   11.27      assume accmodi_old: "accmodi old = Package" and
   11.28             accmodi_new: "accmodi new = Package" 
   11.29      assume "G \<turnstile> new overrides inter"
   11.30 @@ -1280,7 +1280,7 @@
   11.31      show "?P new old"
   11.32        by (contradiction)
   11.33    next
   11.34 -    case (Indirect inter new old)
   11.35 +    case (Indirect new inter old)
   11.36      assume accmodi_old: "accmodi old = Package"
   11.37      assume outside_pack: "pid (declclass old) \<noteq> pid (declclass new)"
   11.38      assume override_new_inter: "G \<turnstile> new overrides inter"
   11.39 @@ -2554,13 +2554,13 @@
   11.40    from stat_acc subclseq 
   11.41    show ?thesis (is "?Dyn_accessible m")
   11.42    proof (induct rule: accessible_fromR.induct)
   11.43 -    case (Immediate statC m)
   11.44 +    case (Immediate m statC)
   11.45      then show "?Dyn_accessible m"
   11.46        by (blast intro: dyn_accessible_fromR.Immediate
   11.47                         member_inI
   11.48                         permits_acc_inheritance)
   11.49    next
   11.50 -    case (Overriding _ _ m)
   11.51 +    case (Overriding m _ _)
   11.52      with wf show "?Dyn_accessible m"
   11.53        by (blast intro: dyn_accessible_fromR.Overriding
   11.54                         member_inI
   11.55 @@ -2921,7 +2921,7 @@
   11.56    from dyn_acc priv
   11.57    show ?thesis
   11.58    proof (induct)
   11.59 -    case (Immediate C m)
   11.60 +    case (Immediate m C)
   11.61      have "G \<turnstile> m in C permits_acc_from accC" and "accmodi m = Private" .
   11.62      then show ?case
   11.63        by (simp add: permits_acc_def)
   11.64 @@ -2946,14 +2946,14 @@
   11.65              \<Longrightarrow> pid accC = pid (declclass m)"
   11.66      (is "?Pack m \<Longrightarrow> ?P m")
   11.67    proof (induct rule: dyn_accessible_fromR.induct)
   11.68 -    case (Immediate C m)
   11.69 +    case (Immediate m C)
   11.70      assume "G\<turnstile>m member_in C"
   11.71             "G \<turnstile> m in C permits_acc_from accC"
   11.72             "accmodi m = Package"      
   11.73      then show "?P m"
   11.74        by (auto simp add: permits_acc_def)
   11.75    next
   11.76 -    case (Overriding declC C new newm old Sup)
   11.77 +    case (Overriding new C declC newm old Sup)
   11.78      assume member_new: "G \<turnstile> new member_in C" and
   11.79                    new: "new = (declC, mdecl newm)" and
   11.80               override: "G \<turnstile> (declC, newm) overrides old" and
   11.81 @@ -2986,7 +2986,7 @@
   11.82    from dyn_acc pack field
   11.83    show ?thesis
   11.84    proof (induct)
   11.85 -    case (Immediate C f)
   11.86 +    case (Immediate f C)
   11.87      have "G \<turnstile> f in C permits_acc_from accC" and "accmodi f = Package" .
   11.88      then show ?case
   11.89        by (simp add: permits_acc_def)
   11.90 @@ -3010,7 +3010,7 @@
   11.91    from dyn_acc prot field instance_field outside
   11.92    show ?thesis
   11.93    proof (induct)
   11.94 -    case (Immediate C f)
   11.95 +    case (Immediate f C)
   11.96      have "G \<turnstile> f in C permits_acc_from accC" .
   11.97      moreover 
   11.98      assume "accmodi f = Protected" and  "is_field f" and "\<not> is_static f" and
   11.99 @@ -3035,7 +3035,7 @@
  11.100    from dyn_acc prot field static_field outside
  11.101    show ?thesis
  11.102    proof (induct)
  11.103 -    case (Immediate C f)
  11.104 +    case (Immediate f C)
  11.105      assume "accmodi f = Protected" and  "is_field f" and "is_static f" and
  11.106             "pid (declclass f) \<noteq> pid accC"
  11.107      moreover 
    12.1 --- a/src/HOL/Bali/WellType.thy	Mon Dec 11 12:28:16 2006 +0100
    12.2 +++ b/src/HOL/Bali/WellType.thy	Mon Dec 11 16:06:14 2006 +0100
    12.3 @@ -245,33 +245,185 @@
    12.4  translations
    12.5    "tys"   <= (type) "ty + ty list"
    12.6  
    12.7 -consts
    12.8 -  wt    :: "(env\<spacespace> \<times> dyn_ty\<spacespace> \<times>  term \<times> tys) set"
    12.9 -(*wt    :: " env \<Rightarrow> dyn_ty \<Rightarrow> (term \<times> tys) set" not feasible because of 
   12.10 -					      \<spacespace>  changing env in Try stmt *)
   12.11 +
   12.12 +inductive2 
   12.13 +  wt :: "env \<Rightarrow> dyn_ty \<Rightarrow> [term,tys] \<Rightarrow> bool" ("_,_\<Turnstile>_\<Colon>_"  [51,51,51,51] 50)
   12.14 +  and wt_stmt :: "env \<Rightarrow> dyn_ty \<Rightarrow>  stmt       \<Rightarrow> bool" ("_,_\<Turnstile>_\<Colon>\<surd>"  [51,51,51   ] 50)
   12.15 +  and ty_expr :: "env \<Rightarrow> dyn_ty \<Rightarrow> [expr ,ty ] \<Rightarrow> bool" ("_,_\<Turnstile>_\<Colon>-_" [51,51,51,51] 50)
   12.16 +  and ty_var :: "env \<Rightarrow> dyn_ty \<Rightarrow> [var  ,ty ] \<Rightarrow> bool" ("_,_\<Turnstile>_\<Colon>=_" [51,51,51,51] 50)
   12.17 +  and ty_exprs :: "env \<Rightarrow> dyn_ty \<Rightarrow> [expr list, ty   list] \<Rightarrow> bool"
   12.18 +    ("_,_\<Turnstile>_\<Colon>\<doteq>_" [51,51,51,51] 50)
   12.19 +where
   12.20 +
   12.21 +  "E,dt\<Turnstile>s\<Colon>\<surd> \<equiv> E,dt\<Turnstile>In1r s\<Colon>Inl (PrimT Void)"
   12.22 +| "E,dt\<Turnstile>e\<Colon>-T \<equiv> E,dt\<Turnstile>In1l e\<Colon>Inl T"
   12.23 +| "E,dt\<Turnstile>e\<Colon>=T \<equiv> E,dt\<Turnstile>In2  e\<Colon>Inl T"
   12.24 +| "E,dt\<Turnstile>e\<Colon>\<doteq>T \<equiv> E,dt\<Turnstile>In3  e\<Colon>Inr T"
   12.25 +
   12.26 +--{* well-typed statements *}
   12.27 +
   12.28 +| Skip:					"E,dt\<Turnstile>Skip\<Colon>\<surd>"
   12.29 +
   12.30 +| Expr:	"\<lbrakk>E,dt\<Turnstile>e\<Colon>-T\<rbrakk> \<Longrightarrow>
   12.31 +					 E,dt\<Turnstile>Expr e\<Colon>\<surd>"
   12.32 +  --{* cf. 14.6 *}
   12.33 +| Lab:  "E,dt\<Turnstile>c\<Colon>\<surd> \<Longrightarrow>                   
   12.34 +                                         E,dt\<Turnstile>l\<bullet> c\<Colon>\<surd>" 
   12.35 +
   12.36 +| Comp:	"\<lbrakk>E,dt\<Turnstile>c1\<Colon>\<surd>; 
   12.37 +	  E,dt\<Turnstile>c2\<Colon>\<surd>\<rbrakk> \<Longrightarrow>
   12.38 +					 E,dt\<Turnstile>c1;; c2\<Colon>\<surd>"
   12.39 +
   12.40 +  --{* cf. 14.8 *}
   12.41 +| If:	"\<lbrakk>E,dt\<Turnstile>e\<Colon>-PrimT Boolean;
   12.42 +	  E,dt\<Turnstile>c1\<Colon>\<surd>;
   12.43 +	  E,dt\<Turnstile>c2\<Colon>\<surd>\<rbrakk> \<Longrightarrow>
   12.44 +					 E,dt\<Turnstile>If(e) c1 Else c2\<Colon>\<surd>"
   12.45 +
   12.46 +  --{* cf. 14.10 *}
   12.47 +| Loop:	"\<lbrakk>E,dt\<Turnstile>e\<Colon>-PrimT Boolean;
   12.48 +	  E,dt\<Turnstile>c\<Colon>\<surd>\<rbrakk> \<Longrightarrow>
   12.49 +					 E,dt\<Turnstile>l\<bullet> While(e) c\<Colon>\<surd>"
   12.50 +  --{* cf. 14.13, 14.15, 14.16 *}
   12.51 +| Jmp:                                   "E,dt\<Turnstile>Jmp jump\<Colon>\<surd>"
   12.52  
   12.53 -syntax
   12.54 -wt      :: "env \<Rightarrow> dyn_ty \<Rightarrow> [term,tys]  \<Rightarrow> bool" ("_,_|=_::_" [51,51,51,51] 50)
   12.55 -wt_stmt :: "env \<Rightarrow> dyn_ty \<Rightarrow>  stmt       \<Rightarrow> bool" ("_,_|=_:<>" [51,51,51   ] 50)
   12.56 -ty_expr :: "env \<Rightarrow> dyn_ty \<Rightarrow> [expr ,ty ] \<Rightarrow> bool" ("_,_|=_:-_" [51,51,51,51] 50)
   12.57 -ty_var  :: "env \<Rightarrow> dyn_ty \<Rightarrow> [var  ,ty ] \<Rightarrow> bool" ("_,_|=_:=_" [51,51,51,51] 50)
   12.58 -ty_exprs:: "env \<Rightarrow> dyn_ty \<Rightarrow> [expr list,
   12.59 -	         \<spacespace>        \<spacespace>  ty   list] \<Rightarrow> bool" ("_,_|=_:#_" [51,51,51,51] 50)
   12.60 +  --{* cf. 14.16 *}
   12.61 +| Throw: "\<lbrakk>E,dt\<Turnstile>e\<Colon>-Class tn;
   12.62 +	  prg E\<turnstile>tn\<preceq>\<^sub>C SXcpt Throwable\<rbrakk> \<Longrightarrow>
   12.63 +					 E,dt\<Turnstile>Throw e\<Colon>\<surd>"
   12.64 +  --{* cf. 14.18 *}
   12.65 +| Try:	"\<lbrakk>E,dt\<Turnstile>c1\<Colon>\<surd>; prg E\<turnstile>tn\<preceq>\<^sub>C SXcpt Throwable;
   12.66 +	  lcl E (VName vn)=None; E \<lparr>lcl := lcl E(VName vn\<mapsto>Class tn)\<rparr>,dt\<Turnstile>c2\<Colon>\<surd>\<rbrakk>
   12.67 +          \<Longrightarrow>
   12.68 +					 E,dt\<Turnstile>Try c1 Catch(tn vn) c2\<Colon>\<surd>"
   12.69 +
   12.70 +  --{* cf. 14.18 *}
   12.71 +| Fin:	"\<lbrakk>E,dt\<Turnstile>c1\<Colon>\<surd>; E,dt\<Turnstile>c2\<Colon>\<surd>\<rbrakk> \<Longrightarrow>
   12.72 +					 E,dt\<Turnstile>c1 Finally c2\<Colon>\<surd>"
   12.73 +
   12.74 +| Init:	"\<lbrakk>is_class (prg E) C\<rbrakk> \<Longrightarrow>
   12.75 +					 E,dt\<Turnstile>Init C\<Colon>\<surd>"
   12.76 +  --{* @{term Init} is created on the fly during evaluation (see Eval.thy). 
   12.77 +     The class isn't necessarily accessible from the points @{term Init} 
   12.78 +     is called. Therefor we only demand @{term is_class} and not 
   12.79 +     @{term is_acc_class} here. 
   12.80 +   *}
   12.81 +
   12.82 +--{* well-typed expressions *}
   12.83 +
   12.84 +  --{* cf. 15.8 *}
   12.85 +| NewC:	"\<lbrakk>is_acc_class (prg E) (pkg E) C\<rbrakk> \<Longrightarrow>
   12.86 +					 E,dt\<Turnstile>NewC C\<Colon>-Class C"
   12.87 +  --{* cf. 15.9 *}
   12.88 +| NewA:	"\<lbrakk>is_acc_type (prg E) (pkg E) T;
   12.89 +	  E,dt\<Turnstile>i\<Colon>-PrimT Integer\<rbrakk> \<Longrightarrow>
   12.90 +					 E,dt\<Turnstile>New T[i]\<Colon>-T.[]"
   12.91 +
   12.92 +  --{* cf. 15.15 *}
   12.93 +| Cast:	"\<lbrakk>E,dt\<Turnstile>e\<Colon>-T; is_acc_type (prg E) (pkg E) T';
   12.94 +	  prg E\<turnstile>T\<preceq>? T'\<rbrakk> \<Longrightarrow>
   12.95 +					 E,dt\<Turnstile>Cast T' e\<Colon>-T'"
   12.96 +
   12.97 +  --{* cf. 15.19.2 *}
   12.98 +| Inst:	"\<lbrakk>E,dt\<Turnstile>e\<Colon>-RefT T; is_acc_type (prg E) (pkg E) (RefT T');
   12.99 +	  prg E\<turnstile>RefT T\<preceq>? RefT T'\<rbrakk> \<Longrightarrow>
  12.100 +					 E,dt\<Turnstile>e InstOf T'\<Colon>-PrimT Boolean"
  12.101 +
  12.102 +  --{* cf. 15.7.1 *}
  12.103 +| Lit:	"\<lbrakk>typeof dt x = Some T\<rbrakk> \<Longrightarrow>
  12.104 +					 E,dt\<Turnstile>Lit x\<Colon>-T"
  12.105  
  12.106 -syntax (xsymbols)
  12.107 -wt      :: "env \<Rightarrow> dyn_ty \<Rightarrow> [term,tys] \<Rightarrow> bool" ("_,_\<Turnstile>_\<Colon>_"  [51,51,51,51] 50)
  12.108 -wt_stmt :: "env \<Rightarrow> dyn_ty \<Rightarrow>  stmt       \<Rightarrow> bool" ("_,_\<Turnstile>_\<Colon>\<surd>"  [51,51,51   ] 50)
  12.109 -ty_expr :: "env \<Rightarrow> dyn_ty \<Rightarrow> [expr ,ty ] \<Rightarrow> bool" ("_,_\<Turnstile>_\<Colon>-_" [51,51,51,51] 50)
  12.110 -ty_var  :: "env \<Rightarrow> dyn_ty \<Rightarrow> [var  ,ty ] \<Rightarrow> bool" ("_,_\<Turnstile>_\<Colon>=_" [51,51,51,51] 50)
  12.111 -ty_exprs:: "env \<Rightarrow> dyn_ty \<Rightarrow> [expr list,
  12.112 -		  \<spacespace>        \<spacespace>  ty   list] \<Rightarrow> bool"("_,_\<Turnstile>_\<Colon>\<doteq>_" [51,51,51,51] 50)
  12.113 +| UnOp: "\<lbrakk>E,dt\<Turnstile>e\<Colon>-Te; wt_unop unop Te; T=PrimT (unop_type unop)\<rbrakk> 
  12.114 +          \<Longrightarrow>
  12.115 +	  E,dt\<Turnstile>UnOp unop e\<Colon>-T"
  12.116 +  
  12.117 +| BinOp: "\<lbrakk>E,dt\<Turnstile>e1\<Colon>-T1; E,dt\<Turnstile>e2\<Colon>-T2; wt_binop (prg E) binop T1 T2; 
  12.118 +           T=PrimT (binop_type binop)\<rbrakk> 
  12.119 +           \<Longrightarrow>
  12.120 +	   E,dt\<Turnstile>BinOp binop e1 e2\<Colon>-T"
  12.121 +  
  12.122 +  --{* cf. 15.10.2, 15.11.1 *}
  12.123 +| Super: "\<lbrakk>lcl E This = Some (Class C); C \<noteq> Object;
  12.124 +	  class (prg E) C = Some c\<rbrakk> \<Longrightarrow>
  12.125 +					 E,dt\<Turnstile>Super\<Colon>-Class (super c)"
  12.126 +
  12.127 +  --{* cf. 15.13.1, 15.10.1, 15.12 *}
  12.128 +| Acc:	"\<lbrakk>E,dt\<Turnstile>va\<Colon>=T\<rbrakk> \<Longrightarrow>
  12.129 +					 E,dt\<Turnstile>Acc va\<Colon>-T"
  12.130 +
  12.131 +  --{* cf. 15.25, 15.25.1 *}
  12.132 +| Ass:	"\<lbrakk>E,dt\<Turnstile>va\<Colon>=T; va \<noteq> LVar This;
  12.133 +	  E,dt\<Turnstile>v \<Colon>-T';
  12.134 +	  prg E\<turnstile>T'\<preceq>T\<rbrakk> \<Longrightarrow>
  12.135 +					 E,dt\<Turnstile>va:=v\<Colon>-T'"
  12.136 +
  12.137 +  --{* cf. 15.24 *}
  12.138 +| Cond:	"\<lbrakk>E,dt\<Turnstile>e0\<Colon>-PrimT Boolean;
  12.139 +	  E,dt\<Turnstile>e1\<Colon>-T1; E,dt\<Turnstile>e2\<Colon>-T2;
  12.140 +	  prg E\<turnstile>T1\<preceq>T2 \<and> T = T2  \<or>  prg E\<turnstile>T2\<preceq>T1 \<and> T = T1\<rbrakk> \<Longrightarrow>
  12.141 +					 E,dt\<Turnstile>e0 ? e1 : e2\<Colon>-T"
  12.142 +
  12.143 +  --{* cf. 15.11.1, 15.11.2, 15.11.3 *}
  12.144 +| Call:	"\<lbrakk>E,dt\<Turnstile>e\<Colon>-RefT statT;
  12.145 +	  E,dt\<Turnstile>ps\<Colon>\<doteq>pTs;
  12.146 +	  max_spec (prg E) (cls E) statT \<lparr>name=mn,parTs=pTs\<rparr> 
  12.147 +            = {((statDeclT,m),pTs')}
  12.148 +         \<rbrakk> \<Longrightarrow>
  12.149 +		   E,dt\<Turnstile>{cls E,statT,invmode m e}e\<cdot>mn({pTs'}ps)\<Colon>-(resTy m)"
  12.150  
  12.151 -translations
  12.152 -	"E,dt\<Turnstile>t\<Colon>T" == "(E,dt,t,T) \<in> wt"
  12.153 -	"E,dt\<Turnstile>s\<Colon>\<surd>"  == "E,dt\<Turnstile>In1r s\<Colon>Inl (PrimT Void)"
  12.154 -	"E,dt\<Turnstile>e\<Colon>-T" == "E,dt\<Turnstile>In1l e\<Colon>Inl T"
  12.155 -	"E,dt\<Turnstile>e\<Colon>=T" == "E,dt\<Turnstile>In2  e\<Colon>Inl T"
  12.156 -	"E,dt\<Turnstile>e\<Colon>\<doteq>T" == "E,dt\<Turnstile>In3  e\<Colon>Inr T"
  12.157 +| Methd: "\<lbrakk>is_class (prg E) C;
  12.158 +	  methd (prg E) C sig = Some m;
  12.159 +	  E,dt\<Turnstile>Body (declclass m) (stmt (mbody (mthd m)))\<Colon>-T\<rbrakk> \<Longrightarrow>
  12.160 +					 E,dt\<Turnstile>Methd C sig\<Colon>-T"
  12.161 + --{* The class @{term C} is the dynamic class of the method call 
  12.162 +    (cf. Eval.thy). 
  12.163 +    It hasn't got to be directly accessible from the current package 
  12.164 +    @{term "(pkg E)"}. 
  12.165 +    Only the static class must be accessible (enshured indirectly by 
  12.166 +    @{term Call}). 
  12.167 +    Note that l is just a dummy value. It is only used in the smallstep 
  12.168 +    semantics. To proof typesafety directly for the smallstep semantics 
  12.169 +    we would have to assume conformance of l here!
  12.170 +  *}
  12.171 +
  12.172 +| Body:	"\<lbrakk>is_class (prg E) D;
  12.173 +	  E,dt\<Turnstile>blk\<Colon>\<surd>;
  12.174 +	  (lcl E) Result = Some T;
  12.175 +          is_type (prg E) T\<rbrakk> \<Longrightarrow>
  12.176 +   					 E,dt\<Turnstile>Body D blk\<Colon>-T"
  12.177 +--{* The class @{term D} implementing the method must not directly be 
  12.178 +     accessible  from the current package @{term "(pkg E)"}, but can also 
  12.179 +     be indirectly accessible due to inheritance (enshured in @{term Call})
  12.180 +    The result type hasn't got to be accessible in Java! (If it is not 
  12.181 +    accessible you can only assign it to Object).
  12.182 +    For dummy value l see rule @{term Methd}. 
  12.183 +   *}
  12.184 +
  12.185 +--{* well-typed variables *}
  12.186 +
  12.187 +  --{* cf. 15.13.1 *}
  12.188 +| LVar:	"\<lbrakk>lcl E vn = Some T; is_acc_type (prg E) (pkg E) T\<rbrakk> \<Longrightarrow>
  12.189 +					 E,dt\<Turnstile>LVar vn\<Colon>=T"
  12.190 +  --{* cf. 15.10.1 *}
  12.191 +| FVar:	"\<lbrakk>E,dt\<Turnstile>e\<Colon>-Class C; 
  12.192 +	  accfield (prg E) (cls E) C fn = Some (statDeclC,f)\<rbrakk> \<Longrightarrow>
  12.193 +			 E,dt\<Turnstile>{cls E,statDeclC,is_static f}e..fn\<Colon>=(type f)"
  12.194 +  --{* cf. 15.12 *}
  12.195 +| AVar:	"\<lbrakk>E,dt\<Turnstile>e\<Colon>-T.[]; 
  12.196 +	  E,dt\<Turnstile>i\<Colon>-PrimT Integer\<rbrakk> \<Longrightarrow>
  12.197 +					 E,dt\<Turnstile>e.[i]\<Colon>=T"
  12.198 +
  12.199 +
  12.200 +--{* well-typed expression lists *}
  12.201 +
  12.202 +  --{* cf. 15.11.??? *}
  12.203 +| Nil:					"E,dt\<Turnstile>[]\<Colon>\<doteq>[]"
  12.204 +
  12.205 +  --{* cf. 15.11.??? *}
  12.206 +| Cons:	"\<lbrakk>E,dt\<Turnstile>e \<Colon>-T;
  12.207 +	  E,dt\<Turnstile>es\<Colon>\<doteq>Ts\<rbrakk> \<Longrightarrow>
  12.208 +					 E,dt\<Turnstile>e#es\<Colon>\<doteq>T#Ts"
  12.209 +
  12.210  
  12.211  syntax (* for purely static typing *)
  12.212    wt_      :: "env \<Rightarrow> [term,tys] \<Rightarrow> bool" ("_|-_::_" [51,51,51] 50)
  12.213 @@ -297,174 +449,6 @@
  12.214  	"E\<turnstile>e\<Colon>\<doteq>T" == "E\<turnstile>In3  e\<Colon>Inr T"
  12.215  
  12.216  
  12.217 -inductive wt intros 
  12.218 -
  12.219 -
  12.220 ---{* well-typed statements *}
  12.221 -
  12.222 -  Skip:					"E,dt\<Turnstile>Skip\<Colon>\<surd>"
  12.223 -
  12.224 -  Expr:	"\<lbrakk>E,dt\<Turnstile>e\<Colon>-T\<rbrakk> \<Longrightarrow>
  12.225 -					 E,dt\<Turnstile>Expr e\<Colon>\<surd>"
  12.226 -  --{* cf. 14.6 *}
  12.227 -  Lab:  "E,dt\<Turnstile>c\<Colon>\<surd> \<Longrightarrow>                   
  12.228 -                                         E,dt\<Turnstile>l\<bullet> c\<Colon>\<surd>" 
  12.229 -
  12.230 -  Comp:	"\<lbrakk>E,dt\<Turnstile>c1\<Colon>\<surd>; 
  12.231 -	  E,dt\<Turnstile>c2\<Colon>\<surd>\<rbrakk> \<Longrightarrow>
  12.232 -					 E,dt\<Turnstile>c1;; c2\<Colon>\<surd>"
  12.233 -
  12.234 -  --{* cf. 14.8 *}
  12.235 -  If:	"\<lbrakk>E,dt\<Turnstile>e\<Colon>-PrimT Boolean;
  12.236 -	  E,dt\<Turnstile>c1\<Colon>\<surd>;
  12.237 -	  E,dt\<Turnstile>c2\<Colon>\<surd>\<rbrakk> \<Longrightarrow>
  12.238 -					 E,dt\<Turnstile>If(e) c1 Else c2\<Colon>\<surd>"
  12.239 -
  12.240 -  --{* cf. 14.10 *}
  12.241 -  Loop:	"\<lbrakk>E,dt\<Turnstile>e\<Colon>-PrimT Boolean;
  12.242 -	  E,dt\<Turnstile>c\<Colon>\<surd>\<rbrakk> \<Longrightarrow>
  12.243 -					 E,dt\<Turnstile>l\<bullet> While(e) c\<Colon>\<surd>"
  12.244 -  --{* cf. 14.13, 14.15, 14.16 *}
  12.245 -  Jmp:                                   "E,dt\<Turnstile>Jmp jump\<Colon>\<surd>"
  12.246 -
  12.247 -  --{* cf. 14.16 *}
  12.248 -  Throw: "\<lbrakk>E,dt\<Turnstile>e\<Colon>-Class tn;
  12.249 -	  prg E\<turnstile>tn\<preceq>\<^sub>C SXcpt Throwable\<rbrakk> \<Longrightarrow>
  12.250 -					 E,dt\<Turnstile>Throw e\<Colon>\<surd>"
  12.251 -  --{* cf. 14.18 *}
  12.252 -  Try:	"\<lbrakk>E,dt\<Turnstile>c1\<Colon>\<surd>; prg E\<turnstile>tn\<preceq>\<^sub>C SXcpt Throwable;
  12.253 -	  lcl E (VName vn)=None; E \<lparr>lcl := lcl E(VName vn\<mapsto>Class tn)\<rparr>,dt\<Turnstile>c2\<Colon>\<surd>\<rbrakk>
  12.254 -          \<Longrightarrow>
  12.255 -					 E,dt\<Turnstile>Try c1 Catch(tn vn) c2\<Colon>\<surd>"
  12.256 -
  12.257 -  --{* cf. 14.18 *}
  12.258 -  Fin:	"\<lbrakk>E,dt\<Turnstile>c1\<Colon>\<surd>; E,dt\<Turnstile>c2\<Colon>\<surd>\<rbrakk> \<Longrightarrow>
  12.259 -					 E,dt\<Turnstile>c1 Finally c2\<Colon>\<surd>"
  12.260 -
  12.261 -  Init:	"\<lbrakk>is_class (prg E) C\<rbrakk> \<Longrightarrow>
  12.262 -					 E,dt\<Turnstile>Init C\<Colon>\<surd>"
  12.263 -  --{* @{term Init} is created on the fly during evaluation (see Eval.thy). 
  12.264 -     The class isn't necessarily accessible from the points @{term Init} 
  12.265 -     is called. Therefor we only demand @{term is_class} and not 
  12.266 -     @{term is_acc_class} here. 
  12.267 -   *}
  12.268 -
  12.269 ---{* well-typed expressions *}
  12.270 -
  12.271 -  --{* cf. 15.8 *}
  12.272 -  NewC:	"\<lbrakk>is_acc_class (prg E) (pkg E) C\<rbrakk> \<Longrightarrow>
  12.273 -					 E,dt\<Turnstile>NewC C\<Colon>-Class C"
  12.274 -  --{* cf. 15.9 *}
  12.275 -  NewA:	"\<lbrakk>is_acc_type (prg E) (pkg E) T;
  12.276 -	  E,dt\<Turnstile>i\<Colon>-PrimT Integer\<rbrakk> \<Longrightarrow>
  12.277 -					 E,dt\<Turnstile>New T[i]\<Colon>-T.[]"
  12.278 -
  12.279 -  --{* cf. 15.15 *}
  12.280 -  Cast:	"\<lbrakk>E,dt\<Turnstile>e\<Colon>-T; is_acc_type (prg E) (pkg E) T';
  12.281 -	  prg E\<turnstile>T\<preceq>? T'\<rbrakk> \<Longrightarrow>
  12.282 -					 E,dt\<Turnstile>Cast T' e\<Colon>-T'"
  12.283 -
  12.284 -  --{* cf. 15.19.2 *}
  12.285 -  Inst:	"\<lbrakk>E,dt\<Turnstile>e\<Colon>-RefT T; is_acc_type (prg E) (pkg E) (RefT T');
  12.286 -	  prg E\<turnstile>RefT T\<preceq>? RefT T'\<rbrakk> \<Longrightarrow>
  12.287 -					 E,dt\<Turnstile>e InstOf T'\<Colon>-PrimT Boolean"
  12.288 -
  12.289 -  --{* cf. 15.7.1 *}
  12.290 -  Lit:	"\<lbrakk>typeof dt x = Some T\<rbrakk> \<Longrightarrow>
  12.291 -					 E,dt\<Turnstile>Lit x\<Colon>-T"
  12.292 -
  12.293 -  UnOp: "\<lbrakk>E,dt\<Turnstile>e\<Colon>-Te; wt_unop unop Te; T=PrimT (unop_type unop)\<rbrakk> 
  12.294 -          \<Longrightarrow>
  12.295 -	  E,dt\<Turnstile>UnOp unop e\<Colon>-T"
  12.296 -  
  12.297 -  BinOp: "\<lbrakk>E,dt\<Turnstile>e1\<Colon>-T1; E,dt\<Turnstile>e2\<Colon>-T2; wt_binop (prg E) binop T1 T2; 
  12.298 -           T=PrimT (binop_type binop)\<rbrakk> 
  12.299 -           \<Longrightarrow>
  12.300 -	   E,dt\<Turnstile>BinOp binop e1 e2\<Colon>-T"
  12.301 -  
  12.302 -  --{* cf. 15.10.2, 15.11.1 *}
  12.303 -  Super: "\<lbrakk>lcl E This = Some (Class C); C \<noteq> Object;
  12.304 -	  class (prg E) C = Some c\<rbrakk> \<Longrightarrow>
  12.305 -					 E,dt\<Turnstile>Super\<Colon>-Class (super c)"
  12.306 -
  12.307 -  --{* cf. 15.13.1, 15.10.1, 15.12 *}
  12.308 -  Acc:	"\<lbrakk>E,dt\<Turnstile>va\<Colon>=T\<rbrakk> \<Longrightarrow>
  12.309 -					 E,dt\<Turnstile>Acc va\<Colon>-T"
  12.310 -
  12.311 -  --{* cf. 15.25, 15.25.1 *}
  12.312 -  Ass:	"\<lbrakk>E,dt\<Turnstile>va\<Colon>=T; va \<noteq> LVar This;
  12.313 -	  E,dt\<Turnstile>v \<Colon>-T';
  12.314 -	  prg E\<turnstile>T'\<preceq>T\<rbrakk> \<Longrightarrow>
  12.315 -					 E,dt\<Turnstile>va:=v\<Colon>-T'"
  12.316 -
  12.317 -  --{* cf. 15.24 *}
  12.318 -  Cond:	"\<lbrakk>E,dt\<Turnstile>e0\<Colon>-PrimT Boolean;
  12.319 -	  E,dt\<Turnstile>e1\<Colon>-T1; E,dt\<Turnstile>e2\<Colon>-T2;
  12.320 -	  prg E\<turnstile>T1\<preceq>T2 \<and> T = T2  \<or>  prg E\<turnstile>T2\<preceq>T1 \<and> T = T1\<rbrakk> \<Longrightarrow>
  12.321 -					 E,dt\<Turnstile>e0 ? e1 : e2\<Colon>-T"
  12.322 -
  12.323 -  --{* cf. 15.11.1, 15.11.2, 15.11.3 *}
  12.324 -  Call:	"\<lbrakk>E,dt\<Turnstile>e\<Colon>-RefT statT;
  12.325 -	  E,dt\<Turnstile>ps\<Colon>\<doteq>pTs;
  12.326 -	  max_spec (prg E) (cls E) statT \<lparr>name=mn,parTs=pTs\<rparr> 
  12.327 -            = {((statDeclT,m),pTs')}
  12.328 -         \<rbrakk> \<Longrightarrow>
  12.329 -		   E,dt\<Turnstile>{cls E,statT,invmode m e}e\<cdot>mn({pTs'}ps)\<Colon>-(resTy m)"
  12.330 -
  12.331 -  Methd: "\<lbrakk>is_class (prg E) C;
  12.332 -	  methd (prg E) C sig = Some m;
  12.333 -	  E,dt\<Turnstile>Body (declclass m) (stmt (mbody (mthd m)))\<Colon>-T\<rbrakk> \<Longrightarrow>
  12.334 -					 E,dt\<Turnstile>Methd C sig\<Colon>-T"
  12.335 - --{* The class @{term C} is the dynamic class of the method call 
  12.336 -    (cf. Eval.thy). 
  12.337 -    It hasn't got to be directly accessible from the current package 
  12.338 -    @{term "(pkg E)"}. 
  12.339 -    Only the static class must be accessible (enshured indirectly by 
  12.340 -    @{term Call}). 
  12.341 -    Note that l is just a dummy value. It is only used in the smallstep 
  12.342 -    semantics. To proof typesafety directly for the smallstep semantics 
  12.343 -    we would have to assume conformance of l here!
  12.344 -  *}
  12.345 -
  12.346 -  Body:	"\<lbrakk>is_class (prg E) D;
  12.347 -	  E,dt\<Turnstile>blk\<Colon>\<surd>;
  12.348 -	  (lcl E) Result = Some T;
  12.349 -          is_type (prg E) T\<rbrakk> \<Longrightarrow>
  12.350 -   					 E,dt\<Turnstile>Body D blk\<Colon>-T"
  12.351 ---{* The class @{term D} implementing the method must not directly be 
  12.352 -     accessible  from the current package @{term "(pkg E)"}, but can also 
  12.353 -     be indirectly accessible due to inheritance (enshured in @{term Call})
  12.354 -    The result type hasn't got to be accessible in Java! (If it is not 
  12.355 -    accessible you can only assign it to Object).
  12.356 -    For dummy value l see rule @{term Methd}. 
  12.357 -   *}
  12.358 -
  12.359 ---{* well-typed variables *}
  12.360 -
  12.361 -  --{* cf. 15.13.1 *}
  12.362 -  LVar:	"\<lbrakk>lcl E vn = Some T; is_acc_type (prg E) (pkg E) T\<rbrakk> \<Longrightarrow>
  12.363 -					 E,dt\<Turnstile>LVar vn\<Colon>=T"
  12.364 -  --{* cf. 15.10.1 *}
  12.365 -  FVar:	"\<lbrakk>E,dt\<Turnstile>e\<Colon>-Class C; 
  12.366 -	  accfield (prg E) (cls E) C fn = Some (statDeclC,f)\<rbrakk> \<Longrightarrow>
  12.367 -			 E,dt\<Turnstile>{cls E,statDeclC,is_static f}e..fn\<Colon>=(type f)"
  12.368 -  --{* cf. 15.12 *}
  12.369 -  AVar:	"\<lbrakk>E,dt\<Turnstile>e\<Colon>-T.[]; 
  12.370 -	  E,dt\<Turnstile>i\<Colon>-PrimT Integer\<rbrakk> \<Longrightarrow>
  12.371 -					 E,dt\<Turnstile>e.[i]\<Colon>=T"
  12.372 -
  12.373 -
  12.374 ---{* well-typed expression lists *}
  12.375 -
  12.376 -  --{* cf. 15.11.??? *}
  12.377 -  Nil:					"E,dt\<Turnstile>[]\<Colon>\<doteq>[]"
  12.378 -
  12.379 -  --{* cf. 15.11.??? *}
  12.380 -  Cons:	"\<lbrakk>E,dt\<Turnstile>e \<Colon>-T;
  12.381 -	  E,dt\<Turnstile>es\<Colon>\<doteq>Ts\<rbrakk> \<Longrightarrow>
  12.382 -					 E,dt\<Turnstile>e#es\<Colon>\<doteq>T#Ts"
  12.383 -
  12.384 -
  12.385  declare not_None_eq [simp del] 
  12.386  declare split_if [split del] split_if_asm [split del]
  12.387  declare split_paired_All [simp del] split_paired_Ex [simp del]
  12.388 @@ -472,7 +456,7 @@
  12.389  change_simpset (fn ss => ss delloop "split_all_tac")
  12.390  *}
  12.391  
  12.392 -inductive_cases wt_elim_cases [cases set]:
  12.393 +inductive_cases2 wt_elim_cases [cases set]:
  12.394  	"E,dt\<Turnstile>In2  (LVar vn)               \<Colon>T"
  12.395  	"E,dt\<Turnstile>In2  ({accC,statDeclC,s}e..fn)\<Colon>T"
  12.396  	"E,dt\<Turnstile>In2  (e.[i])                 \<Colon>T"
  12.397 @@ -610,25 +594,32 @@
  12.398      correlation. 
  12.399   *}
  12.400  
  12.401 +lemma wt_expr_eq: "E,dt\<Turnstile>In1l t\<Colon>U = (\<exists>T. U=Inl T \<and> E,dt\<Turnstile>t\<Colon>-T)"
  12.402 +  by (auto, frule wt_Inj_elim, auto)
  12.403 +
  12.404 +lemma wt_var_eq: "E,dt\<Turnstile>In2 t\<Colon>U = (\<exists>T. U=Inl T \<and> E,dt\<Turnstile>t\<Colon>=T)"
  12.405 +  by (auto, frule wt_Inj_elim, auto)
  12.406 +
  12.407 +lemma wt_exprs_eq: "E,dt\<Turnstile>In3 t\<Colon>U = (\<exists>Ts. U=Inr Ts \<and> E,dt\<Turnstile>t\<Colon>\<doteq>Ts)"
  12.408 +  by (auto, frule wt_Inj_elim, auto)
  12.409 +
  12.410 +lemma wt_stmt_eq: "E,dt\<Turnstile>In1r t\<Colon>U = (U=Inl(PrimT Void)\<and>E,dt\<Turnstile>t\<Colon>\<surd>)"
  12.411 +  by (auto, frule wt_Inj_elim, auto, frule wt_Inj_elim, auto)
  12.412 +
  12.413  ML {*
  12.414 -fun wt_fun name inj rhs =
  12.415 +fun wt_fun name lhs =
  12.416  let
  12.417 -  val lhs = "E,dt\<Turnstile>" ^ inj ^ " t\<Colon>U"
  12.418 -  val () = qed_goal name (the_context()) (lhs ^ " = (" ^ rhs ^ ")") 
  12.419 -	(K [Auto_tac, ALLGOALS (ftac (thm "wt_Inj_elim")) THEN Auto_tac])
  12.420    fun is_Inj (Const (inj,_) $ _) = true
  12.421      | is_Inj _                   = false
  12.422 -  fun pred (t as (_ $ (Const ("Pair",_) $
  12.423 -     _ $ (Const ("Pair", _) $ _ $ (Const ("Pair", _) $ _ $
  12.424 -       x))) $ _ )) = is_Inj x
  12.425 +  fun pred (_ $ _ $ _ $ _ $ x) = is_Inj x
  12.426  in
  12.427    cond_simproc name lhs pred (thm name)
  12.428  end
  12.429  
  12.430 -val wt_expr_proc  = wt_fun "wt_expr_eq"  "In1l" "\<exists>T.  U=Inl T  \<and> E,dt\<Turnstile>t\<Colon>-T"
  12.431 -val wt_var_proc   = wt_fun "wt_var_eq"   "In2"  "\<exists>T.  U=Inl T  \<and> E,dt\<Turnstile>t\<Colon>=T"
  12.432 -val wt_exprs_proc = wt_fun "wt_exprs_eq" "In3"  "\<exists>Ts. U=Inr Ts \<and> E,dt\<Turnstile>t\<Colon>\<doteq>Ts"
  12.433 -val wt_stmt_proc  = wt_fun "wt_stmt_eq"  "In1r" "U=Inl(PrimT Void)\<and>E,dt\<Turnstile>t\<Colon>\<surd>"
  12.434 +val wt_expr_proc  = wt_fun "wt_expr_eq"  "E,dt\<Turnstile>In1l t\<Colon>U";
  12.435 +val wt_var_proc   = wt_fun "wt_var_eq"   "E,dt\<Turnstile>In2 t\<Colon>U";
  12.436 +val wt_exprs_proc = wt_fun "wt_exprs_eq" "E,dt\<Turnstile>In3 t\<Colon>U";
  12.437 +val wt_stmt_proc  = wt_fun "wt_stmt_eq"  "E,dt\<Turnstile>In1r t\<Colon>U";
  12.438  *}
  12.439  
  12.440  ML {*