src/HOL/Bali/Evaln.thy
changeset 17589 58eeffd73be1
parent 16417 9bc16273c2d4
child 17876 b9c92f384109
equal deleted inserted replaced
17588:f2bd501398ee 17589:58eeffd73be1
   552 using eval 
   552 using eval 
   553 proof (induct)
   553 proof (induct)
   554   case (Abrupt s t xc)
   554   case (Abrupt s t xc)
   555   obtain n where
   555   obtain n where
   556     "G\<turnstile>(Some xc, s) \<midarrow>t\<succ>\<midarrow>n\<rightarrow> (arbitrary3 t, Some xc, s)"
   556     "G\<turnstile>(Some xc, s) \<midarrow>t\<succ>\<midarrow>n\<rightarrow> (arbitrary3 t, Some xc, s)"
   557     by (rules intro: evaln.Abrupt)
   557     by (iprover intro: evaln.Abrupt)
   558   then show ?case ..
   558   then show ?case ..
   559 next
   559 next
   560   case Skip
   560   case Skip
   561   show ?case by (blast intro: evaln.Skip)
   561   show ?case by (blast intro: evaln.Skip)
   562 next
   562 next
   563   case (Expr e s0 s1 v)
   563   case (Expr e s0 s1 v)
   564   then obtain n where
   564   then obtain n where
   565     "G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<midarrow>n\<rightarrow> s1"
   565     "G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<midarrow>n\<rightarrow> s1"
   566     by (rules)
   566     by (iprover)
   567   then have "G\<turnstile>Norm s0 \<midarrow>Expr e\<midarrow>n\<rightarrow> s1"
   567   then have "G\<turnstile>Norm s0 \<midarrow>Expr e\<midarrow>n\<rightarrow> s1"
   568     by (rule evaln.Expr) 
   568     by (rule evaln.Expr) 
   569   then show ?case ..
   569   then show ?case ..
   570 next
   570 next
   571   case (Lab c l s0 s1)
   571   case (Lab c l s0 s1)
   572   then obtain n where
   572   then obtain n where
   573     "G\<turnstile>Norm s0 \<midarrow>c\<midarrow>n\<rightarrow> s1"
   573     "G\<turnstile>Norm s0 \<midarrow>c\<midarrow>n\<rightarrow> s1"
   574     by (rules)
   574     by (iprover)
   575   then have "G\<turnstile>Norm s0 \<midarrow>l\<bullet> c\<midarrow>n\<rightarrow> abupd (absorb l) s1"
   575   then have "G\<turnstile>Norm s0 \<midarrow>l\<bullet> c\<midarrow>n\<rightarrow> abupd (absorb l) s1"
   576     by (rule evaln.Lab)
   576     by (rule evaln.Lab)
   577   then show ?case ..
   577   then show ?case ..
   578 next
   578 next
   579   case (Comp c1 c2 s0 s1 s2)
   579   case (Comp c1 c2 s0 s1 s2)
   580   then obtain n1 n2 where
   580   then obtain n1 n2 where
   581     "G\<turnstile>Norm s0 \<midarrow>c1\<midarrow>n1\<rightarrow> s1"
   581     "G\<turnstile>Norm s0 \<midarrow>c1\<midarrow>n1\<rightarrow> s1"
   582     "G\<turnstile>s1 \<midarrow>c2\<midarrow>n2\<rightarrow> s2"
   582     "G\<turnstile>s1 \<midarrow>c2\<midarrow>n2\<rightarrow> s2"
   583     by (rules)
   583     by (iprover)
   584   then have "G\<turnstile>Norm s0 \<midarrow>c1;; c2\<midarrow>max n1 n2\<rightarrow> s2"
   584   then have "G\<turnstile>Norm s0 \<midarrow>c1;; c2\<midarrow>max n1 n2\<rightarrow> s2"
   585     by (blast intro: evaln.Comp dest: evaln_max2 )
   585     by (blast intro: evaln.Comp dest: evaln_max2 )
   586   then show ?case ..
   586   then show ?case ..
   587 next
   587 next
   588   case (If b c1 c2 e s0 s1 s2)
   588   case (If b c1 c2 e s0 s1 s2)
   589   then obtain n1 n2 where
   589   then obtain n1 n2 where
   590     "G\<turnstile>Norm s0 \<midarrow>e-\<succ>b\<midarrow>n1\<rightarrow> s1"
   590     "G\<turnstile>Norm s0 \<midarrow>e-\<succ>b\<midarrow>n1\<rightarrow> s1"
   591     "G\<turnstile>s1 \<midarrow>(if the_Bool b then c1 else c2)\<midarrow>n2\<rightarrow> s2"
   591     "G\<turnstile>s1 \<midarrow>(if the_Bool b then c1 else c2)\<midarrow>n2\<rightarrow> s2"
   592     by (rules)
   592     by (iprover)
   593   then have "G\<turnstile>Norm s0 \<midarrow>If(e) c1 Else c2\<midarrow>max n1 n2\<rightarrow> s2"
   593   then have "G\<turnstile>Norm s0 \<midarrow>If(e) c1 Else c2\<midarrow>max n1 n2\<rightarrow> s2"
   594     by (blast intro: evaln.If dest: evaln_max2)
   594     by (blast intro: evaln.If dest: evaln_max2)
   595   then show ?case ..
   595   then show ?case ..
   596 next
   596 next
   597   case (Loop b c e l s0 s1 s2 s3)
   597   case (Loop b c e l s0 s1 s2 s3)
   598   from Loop.hyps obtain n1 where
   598   from Loop.hyps obtain n1 where
   599     "G\<turnstile>Norm s0 \<midarrow>e-\<succ>b\<midarrow>n1\<rightarrow> s1"
   599     "G\<turnstile>Norm s0 \<midarrow>e-\<succ>b\<midarrow>n1\<rightarrow> s1"
   600     by (rules)
   600     by (iprover)
   601   moreover from Loop.hyps obtain n2 where
   601   moreover from Loop.hyps obtain n2 where
   602     "if the_Bool b 
   602     "if the_Bool b 
   603         then (G\<turnstile>s1 \<midarrow>c\<midarrow>n2\<rightarrow> s2 \<and> 
   603         then (G\<turnstile>s1 \<midarrow>c\<midarrow>n2\<rightarrow> s2 \<and> 
   604               G\<turnstile>(abupd (absorb (Cont l)) s2)\<midarrow>l\<bullet> While(e) c\<midarrow>n2\<rightarrow> s3)
   604               G\<turnstile>(abupd (absorb (Cont l)) s2)\<midarrow>l\<bullet> While(e) c\<midarrow>n2\<rightarrow> s3)
   605 	else s3 = s1"
   605 	else s3 = s1"
   606     by simp (rules intro: evaln_nonstrict le_maxI1 le_maxI2)
   606     by simp (iprover intro: evaln_nonstrict le_maxI1 le_maxI2)
   607   ultimately
   607   ultimately
   608   have "G\<turnstile>Norm s0 \<midarrow>l\<bullet> While(e) c\<midarrow>max n1 n2\<rightarrow> s3"
   608   have "G\<turnstile>Norm s0 \<midarrow>l\<bullet> While(e) c\<midarrow>max n1 n2\<rightarrow> s3"
   609     apply -
   609     apply -
   610     apply (rule evaln.Loop)
   610     apply (rule evaln.Loop)
   611     apply   (rules intro: evaln_nonstrict intro: le_maxI1)
   611     apply   (iprover intro: evaln_nonstrict intro: le_maxI1)
   612 
   612 
   613     apply   (auto intro: evaln_nonstrict intro: le_maxI2)
   613     apply   (auto intro: evaln_nonstrict intro: le_maxI2)
   614     done
   614     done
   615   then show ?case ..
   615   then show ?case ..
   616 next
   616 next
   620   then show ?case ..
   620   then show ?case ..
   621 next
   621 next
   622   case (Throw a e s0 s1)
   622   case (Throw a e s0 s1)
   623   then obtain n where
   623   then obtain n where
   624     "G\<turnstile>Norm s0 \<midarrow>e-\<succ>a\<midarrow>n\<rightarrow> s1"
   624     "G\<turnstile>Norm s0 \<midarrow>e-\<succ>a\<midarrow>n\<rightarrow> s1"
   625     by (rules)
   625     by (iprover)
   626   then have "G\<turnstile>Norm s0 \<midarrow>Throw e\<midarrow>n\<rightarrow> abupd (throw a) s1"
   626   then have "G\<turnstile>Norm s0 \<midarrow>Throw e\<midarrow>n\<rightarrow> abupd (throw a) s1"
   627     by (rule evaln.Throw)
   627     by (rule evaln.Throw)
   628   then show ?case ..
   628   then show ?case ..
   629 next 
   629 next 
   630   case (Try catchC c1 c2 s0 s1 s2 s3 vn)
   630   case (Try catchC c1 c2 s0 s1 s2 s3 vn)
   631   from Try.hyps obtain n1 where
   631   from Try.hyps obtain n1 where
   632     "G\<turnstile>Norm s0 \<midarrow>c1\<midarrow>n1\<rightarrow> s1"
   632     "G\<turnstile>Norm s0 \<midarrow>c1\<midarrow>n1\<rightarrow> s1"
   633     by (rules)
   633     by (iprover)
   634   moreover 
   634   moreover 
   635   have sxalloc: "G\<turnstile>s1 \<midarrow>sxalloc\<rightarrow> s2" .
   635   have sxalloc: "G\<turnstile>s1 \<midarrow>sxalloc\<rightarrow> s2" .
   636   moreover
   636   moreover
   637   from Try.hyps obtain n2 where
   637   from Try.hyps obtain n2 where
   638     "if G,s2\<turnstile>catch catchC then G\<turnstile>new_xcpt_var vn s2 \<midarrow>c2\<midarrow>n2\<rightarrow> s3 else s3 = s2"
   638     "if G,s2\<turnstile>catch catchC then G\<turnstile>new_xcpt_var vn s2 \<midarrow>c2\<midarrow>n2\<rightarrow> s3 else s3 = s2"
   644 next
   644 next
   645   case (Fin c1 c2 s0 s1 s2 s3 x1)
   645   case (Fin c1 c2 s0 s1 s2 s3 x1)
   646   from Fin obtain n1 n2 where 
   646   from Fin obtain n1 n2 where 
   647     "G\<turnstile>Norm s0 \<midarrow>c1\<midarrow>n1\<rightarrow> (x1, s1)"
   647     "G\<turnstile>Norm s0 \<midarrow>c1\<midarrow>n1\<rightarrow> (x1, s1)"
   648     "G\<turnstile>Norm s1 \<midarrow>c2\<midarrow>n2\<rightarrow> s2"
   648     "G\<turnstile>Norm s1 \<midarrow>c2\<midarrow>n2\<rightarrow> s2"
   649     by rules
   649     by iprover
   650   moreover
   650   moreover
   651   have s3: "s3 = (if \<exists>err. x1 = Some (Error err) 
   651   have s3: "s3 = (if \<exists>err. x1 = Some (Error err) 
   652                      then (x1, s1)
   652                      then (x1, s1)
   653                      else abupd (abrupt_if (x1 \<noteq> None) x1) s2)" .
   653                      else abupd (abrupt_if (x1 \<noteq> None) x1) s2)" .
   654   ultimately 
   654   ultimately 
   671   then show ?case ..
   671   then show ?case ..
   672 next
   672 next
   673   case (NewC C a s0 s1 s2)
   673   case (NewC C a s0 s1 s2)
   674   then obtain n where 
   674   then obtain n where 
   675     "G\<turnstile>Norm s0 \<midarrow>Init C\<midarrow>n\<rightarrow> s1"
   675     "G\<turnstile>Norm s0 \<midarrow>Init C\<midarrow>n\<rightarrow> s1"
   676     by (rules)
   676     by (iprover)
   677   with NewC 
   677   with NewC 
   678   have "G\<turnstile>Norm s0 \<midarrow>NewC C-\<succ>Addr a\<midarrow>n\<rightarrow> s2"
   678   have "G\<turnstile>Norm s0 \<midarrow>NewC C-\<succ>Addr a\<midarrow>n\<rightarrow> s2"
   679     by (rules intro: evaln.NewC)
   679     by (iprover intro: evaln.NewC)
   680   then show ?case ..
   680   then show ?case ..
   681 next
   681 next
   682   case (NewA T a e i s0 s1 s2 s3)
   682   case (NewA T a e i s0 s1 s2 s3)
   683   then obtain n1 n2 where 
   683   then obtain n1 n2 where 
   684     "G\<turnstile>Norm s0 \<midarrow>init_comp_ty T\<midarrow>n1\<rightarrow> s1"
   684     "G\<turnstile>Norm s0 \<midarrow>init_comp_ty T\<midarrow>n1\<rightarrow> s1"
   685     "G\<turnstile>s1 \<midarrow>e-\<succ>i\<midarrow>n2\<rightarrow> s2"      
   685     "G\<turnstile>s1 \<midarrow>e-\<succ>i\<midarrow>n2\<rightarrow> s2"      
   686     by (rules)
   686     by (iprover)
   687   moreover
   687   moreover
   688   have "G\<turnstile>abupd (check_neg i) s2 \<midarrow>halloc Arr T (the_Intg i)\<succ>a\<rightarrow> s3" .
   688   have "G\<turnstile>abupd (check_neg i) s2 \<midarrow>halloc Arr T (the_Intg i)\<succ>a\<rightarrow> s3" .
   689   ultimately
   689   ultimately
   690   have "G\<turnstile>Norm s0 \<midarrow>New T[e]-\<succ>Addr a\<midarrow>max n1 n2\<rightarrow> s3"
   690   have "G\<turnstile>Norm s0 \<midarrow>New T[e]-\<succ>Addr a\<midarrow>max n1 n2\<rightarrow> s3"
   691     by (blast intro: evaln.NewA dest: evaln_max2)
   691     by (blast intro: evaln.NewA dest: evaln_max2)
   692   then show ?case ..
   692   then show ?case ..
   693 next
   693 next
   694   case (Cast castT e s0 s1 s2 v)
   694   case (Cast castT e s0 s1 s2 v)
   695   then obtain n where
   695   then obtain n where
   696     "G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<midarrow>n\<rightarrow> s1"
   696     "G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<midarrow>n\<rightarrow> s1"
   697     by (rules)
   697     by (iprover)
   698   moreover 
   698   moreover 
   699   have "s2 = abupd (raise_if (\<not> G,snd s1\<turnstile>v fits castT) ClassCast) s1" .
   699   have "s2 = abupd (raise_if (\<not> G,snd s1\<turnstile>v fits castT) ClassCast) s1" .
   700   ultimately
   700   ultimately
   701   have "G\<turnstile>Norm s0 \<midarrow>Cast castT e-\<succ>v\<midarrow>n\<rightarrow> s2"
   701   have "G\<turnstile>Norm s0 \<midarrow>Cast castT e-\<succ>v\<midarrow>n\<rightarrow> s2"
   702     by (rule evaln.Cast)
   702     by (rule evaln.Cast)
   703   then show ?case ..
   703   then show ?case ..
   704 next
   704 next
   705   case (Inst T b e s0 s1 v)
   705   case (Inst T b e s0 s1 v)
   706   then obtain n where
   706   then obtain n where
   707     "G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<midarrow>n\<rightarrow> s1"
   707     "G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<midarrow>n\<rightarrow> s1"
   708     by (rules)
   708     by (iprover)
   709   moreover 
   709   moreover 
   710   have "b = (v \<noteq> Null \<and> G,snd s1\<turnstile>v fits RefT T)" .
   710   have "b = (v \<noteq> Null \<and> G,snd s1\<turnstile>v fits RefT T)" .
   711   ultimately
   711   ultimately
   712   have "G\<turnstile>Norm s0 \<midarrow>e InstOf T-\<succ>Bool b\<midarrow>n\<rightarrow> s1"
   712   have "G\<turnstile>Norm s0 \<midarrow>e InstOf T-\<succ>Bool b\<midarrow>n\<rightarrow> s1"
   713     by (rule evaln.Inst)
   713     by (rule evaln.Inst)
   719   then show ?case ..
   719   then show ?case ..
   720 next
   720 next
   721   case (UnOp e s0 s1 unop v )
   721   case (UnOp e s0 s1 unop v )
   722   then obtain n where
   722   then obtain n where
   723     "G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<midarrow>n\<rightarrow> s1"
   723     "G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<midarrow>n\<rightarrow> s1"
   724     by (rules)
   724     by (iprover)
   725   hence "G\<turnstile>Norm s0 \<midarrow>UnOp unop e-\<succ>eval_unop unop v\<midarrow>n\<rightarrow> s1"
   725   hence "G\<turnstile>Norm s0 \<midarrow>UnOp unop e-\<succ>eval_unop unop v\<midarrow>n\<rightarrow> s1"
   726     by (rule evaln.UnOp)
   726     by (rule evaln.UnOp)
   727   then show ?case ..
   727   then show ?case ..
   728 next
   728 next
   729   case (BinOp binop e1 e2 s0 s1 s2 v1 v2)
   729   case (BinOp binop e1 e2 s0 s1 s2 v1 v2)
   730   then obtain n1 n2 where 
   730   then obtain n1 n2 where 
   731     "G\<turnstile>Norm s0 \<midarrow>e1-\<succ>v1\<midarrow>n1\<rightarrow> s1"
   731     "G\<turnstile>Norm s0 \<midarrow>e1-\<succ>v1\<midarrow>n1\<rightarrow> s1"
   732     "G\<turnstile>s1 \<midarrow>(if need_second_arg binop v1 then In1l e2
   732     "G\<turnstile>s1 \<midarrow>(if need_second_arg binop v1 then In1l e2
   733                else In1r Skip)\<succ>\<midarrow>n2\<rightarrow> (In1 v2, s2)"    
   733                else In1r Skip)\<succ>\<midarrow>n2\<rightarrow> (In1 v2, s2)"    
   734     by (rules)
   734     by (iprover)
   735   hence "G\<turnstile>Norm s0 \<midarrow>BinOp binop e1 e2-\<succ>(eval_binop binop v1 v2)\<midarrow>max n1 n2
   735   hence "G\<turnstile>Norm s0 \<midarrow>BinOp binop e1 e2-\<succ>(eval_binop binop v1 v2)\<midarrow>max n1 n2
   736           \<rightarrow> s2"
   736           \<rightarrow> s2"
   737     by (blast intro!: evaln.BinOp dest: evaln_max2)
   737     by (blast intro!: evaln.BinOp dest: evaln_max2)
   738   then show ?case ..
   738   then show ?case ..
   739 next
   739 next
   747 *} (* dummy text command to break paragraph for latex;
   747 *} (* dummy text command to break paragraph for latex;
   748               large paragraphs exhaust memory of debian pdflatex *)
   748               large paragraphs exhaust memory of debian pdflatex *)
   749   case (Acc f s0 s1 v va)
   749   case (Acc f s0 s1 v va)
   750   then obtain n where
   750   then obtain n where
   751     "G\<turnstile>Norm s0 \<midarrow>va=\<succ>(v, f)\<midarrow>n\<rightarrow> s1"
   751     "G\<turnstile>Norm s0 \<midarrow>va=\<succ>(v, f)\<midarrow>n\<rightarrow> s1"
   752     by (rules)
   752     by (iprover)
   753   then
   753   then
   754   have "G\<turnstile>Norm s0 \<midarrow>Acc va-\<succ>v\<midarrow>n\<rightarrow> s1"
   754   have "G\<turnstile>Norm s0 \<midarrow>Acc va-\<succ>v\<midarrow>n\<rightarrow> s1"
   755     by (rule evaln.Acc)
   755     by (rule evaln.Acc)
   756   then show ?case ..
   756   then show ?case ..
   757 next
   757 next
   758   case (Ass e f s0 s1 s2 v var w)
   758   case (Ass e f s0 s1 s2 v var w)
   759   then obtain n1 n2 where 
   759   then obtain n1 n2 where 
   760     "G\<turnstile>Norm s0 \<midarrow>var=\<succ>(w, f)\<midarrow>n1\<rightarrow> s1"
   760     "G\<turnstile>Norm s0 \<midarrow>var=\<succ>(w, f)\<midarrow>n1\<rightarrow> s1"
   761     "G\<turnstile>s1 \<midarrow>e-\<succ>v\<midarrow>n2\<rightarrow> s2"      
   761     "G\<turnstile>s1 \<midarrow>e-\<succ>v\<midarrow>n2\<rightarrow> s2"      
   762     by (rules)
   762     by (iprover)
   763   then
   763   then
   764   have "G\<turnstile>Norm s0 \<midarrow>var:=e-\<succ>v\<midarrow>max n1 n2\<rightarrow> assign f v s2"
   764   have "G\<turnstile>Norm s0 \<midarrow>var:=e-\<succ>v\<midarrow>max n1 n2\<rightarrow> assign f v s2"
   765     by (blast intro: evaln.Ass dest: evaln_max2)
   765     by (blast intro: evaln.Ass dest: evaln_max2)
   766   then show ?case ..
   766   then show ?case ..
   767 next
   767 next
   768   case (Cond b e0 e1 e2 s0 s1 s2 v)
   768   case (Cond b e0 e1 e2 s0 s1 s2 v)
   769   then obtain n1 n2 where 
   769   then obtain n1 n2 where 
   770     "G\<turnstile>Norm s0 \<midarrow>e0-\<succ>b\<midarrow>n1\<rightarrow> s1"
   770     "G\<turnstile>Norm s0 \<midarrow>e0-\<succ>b\<midarrow>n1\<rightarrow> s1"
   771     "G\<turnstile>s1 \<midarrow>(if the_Bool b then e1 else e2)-\<succ>v\<midarrow>n2\<rightarrow> s2"
   771     "G\<turnstile>s1 \<midarrow>(if the_Bool b then e1 else e2)-\<succ>v\<midarrow>n2\<rightarrow> s2"
   772     by (rules)
   772     by (iprover)
   773   then
   773   then
   774   have "G\<turnstile>Norm s0 \<midarrow>e0 ? e1 : e2-\<succ>v\<midarrow>max n1 n2\<rightarrow> s2"
   774   have "G\<turnstile>Norm s0 \<midarrow>e0 ? e1 : e2-\<succ>v\<midarrow>max n1 n2\<rightarrow> s2"
   775     by (blast intro: evaln.Cond dest: evaln_max2)
   775     by (blast intro: evaln.Cond dest: evaln_max2)
   776   then show ?case ..
   776   then show ?case ..
   777 next
   777 next
   778   case (Call invDeclC a' accC' args e mn mode pTs' s0 s1 s2 s3 s3' s4 statT 
   778   case (Call invDeclC a' accC' args e mn mode pTs' s0 s1 s2 s3 s3' s4 statT 
   779         v vs)
   779         v vs)
   780   then obtain n1 n2 where
   780   then obtain n1 n2 where
   781     "G\<turnstile>Norm s0 \<midarrow>e-\<succ>a'\<midarrow>n1\<rightarrow> s1"
   781     "G\<turnstile>Norm s0 \<midarrow>e-\<succ>a'\<midarrow>n1\<rightarrow> s1"
   782     "G\<turnstile>s1 \<midarrow>args\<doteq>\<succ>vs\<midarrow>n2\<rightarrow> s2"
   782     "G\<turnstile>s1 \<midarrow>args\<doteq>\<succ>vs\<midarrow>n2\<rightarrow> s2"
   783     by rules
   783     by iprover
   784   moreover
   784   moreover
   785   have "invDeclC = invocation_declclass G mode (store s2) a' statT 
   785   have "invDeclC = invocation_declclass G mode (store s2) a' statT 
   786                        \<lparr>name=mn,parTs=pTs'\<rparr>" .
   786                        \<lparr>name=mn,parTs=pTs'\<rparr>" .
   787   moreover
   787   moreover
   788   have "s3 = init_lvars G invDeclC \<lparr>name=mn,parTs=pTs'\<rparr> mode a' vs s2" .
   788   have "s3 = init_lvars G invDeclC \<lparr>name=mn,parTs=pTs'\<rparr> mode a' vs s2" .
   790   have "s3'=check_method_access G accC' statT mode \<lparr>name=mn,parTs=pTs'\<rparr> a' s3".
   790   have "s3'=check_method_access G accC' statT mode \<lparr>name=mn,parTs=pTs'\<rparr> a' s3".
   791   moreover 
   791   moreover 
   792   from Call.hyps
   792   from Call.hyps
   793   obtain m where 
   793   obtain m where 
   794     "G\<turnstile>s3' \<midarrow>Methd invDeclC \<lparr>name=mn, parTs=pTs'\<rparr>-\<succ>v\<midarrow>m\<rightarrow> s4"
   794     "G\<turnstile>s3' \<midarrow>Methd invDeclC \<lparr>name=mn, parTs=pTs'\<rparr>-\<succ>v\<midarrow>m\<rightarrow> s4"
   795     by rules
   795     by iprover
   796   ultimately
   796   ultimately
   797   have "G\<turnstile>Norm s0 \<midarrow>{accC',statT,mode}e\<cdot>mn( {pTs'}args)-\<succ>v\<midarrow>max n1 (max n2 m)\<rightarrow> 
   797   have "G\<turnstile>Norm s0 \<midarrow>{accC',statT,mode}e\<cdot>mn( {pTs'}args)-\<succ>v\<midarrow>max n1 (max n2 m)\<rightarrow> 
   798             (set_lvars (locals (store s2))) s4"
   798             (set_lvars (locals (store s2))) s4"
   799     by (auto intro!: evaln.Call le_maxI1 le_max3I1 le_max3I2)
   799     by (auto intro!: evaln.Call le_maxI1 le_max3I1 le_max3I2)
   800   thus ?case ..
   800   thus ?case ..
   801 next
   801 next
   802   case (Methd D s0 s1 sig v )
   802   case (Methd D s0 s1 sig v )
   803   then obtain n where
   803   then obtain n where
   804     "G\<turnstile>Norm s0 \<midarrow>body G D sig-\<succ>v\<midarrow>n\<rightarrow> s1"
   804     "G\<turnstile>Norm s0 \<midarrow>body G D sig-\<succ>v\<midarrow>n\<rightarrow> s1"
   805     by rules
   805     by iprover
   806   then have "G\<turnstile>Norm s0 \<midarrow>Methd D sig-\<succ>v\<midarrow>Suc n\<rightarrow> s1"
   806   then have "G\<turnstile>Norm s0 \<midarrow>Methd D sig-\<succ>v\<midarrow>Suc n\<rightarrow> s1"
   807     by (rule evaln.Methd)
   807     by (rule evaln.Methd)
   808   then show ?case ..
   808   then show ?case ..
   809 next
   809 next
   810   case (Body D c s0 s1 s2 s3 )
   810   case (Body D c s0 s1 s2 s3 )
   811   from Body.hyps obtain n1 n2 where 
   811   from Body.hyps obtain n1 n2 where 
   812     evaln_init: "G\<turnstile>Norm s0 \<midarrow>Init D\<midarrow>n1\<rightarrow> s1" and
   812     evaln_init: "G\<turnstile>Norm s0 \<midarrow>Init D\<midarrow>n1\<rightarrow> s1" and
   813     evaln_c: "G\<turnstile>s1 \<midarrow>c\<midarrow>n2\<rightarrow> s2"
   813     evaln_c: "G\<turnstile>s1 \<midarrow>c\<midarrow>n2\<rightarrow> s2"
   814     by (rules)
   814     by (iprover)
   815   moreover
   815   moreover
   816   have "s3 = (if \<exists>l. fst s2 = Some (Jump (Break l)) \<or> 
   816   have "s3 = (if \<exists>l. fst s2 = Some (Jump (Break l)) \<or> 
   817                      fst s2 = Some (Jump (Cont l))
   817                      fst s2 = Some (Jump (Cont l))
   818                  then abupd (\<lambda>x. Some (Error CrossMethodJump)) s2 
   818                  then abupd (\<lambda>x. Some (Error CrossMethodJump)) s2 
   819                  else s2)".
   819                  else s2)".
   820   ultimately
   820   ultimately
   821   have
   821   have
   822      "G\<turnstile>Norm s0 \<midarrow>Body D c-\<succ>the (locals (store s2) Result)\<midarrow>max n1 n2
   822      "G\<turnstile>Norm s0 \<midarrow>Body D c-\<succ>the (locals (store s2) Result)\<midarrow>max n1 n2
   823        \<rightarrow> abupd (absorb Ret) s3"
   823        \<rightarrow> abupd (absorb Ret) s3"
   824     by (rules intro: evaln.Body dest: evaln_max2)
   824     by (iprover intro: evaln.Body dest: evaln_max2)
   825   then show ?case ..
   825   then show ?case ..
   826 next
   826 next
   827   case (LVar s vn )
   827   case (LVar s vn )
   828   obtain n where
   828   obtain n where
   829     "G\<turnstile>Norm s \<midarrow>LVar vn=\<succ>lvar vn s\<midarrow>n\<rightarrow> Norm s"
   829     "G\<turnstile>Norm s \<midarrow>LVar vn=\<succ>lvar vn s\<midarrow>n\<rightarrow> Norm s"
   830     by (rules intro: evaln.LVar)
   830     by (iprover intro: evaln.LVar)
   831   then show ?case ..
   831   then show ?case ..
   832 next
   832 next
   833   case (FVar a accC e fn s0 s1 s2 s2' s3 stat statDeclC v)
   833   case (FVar a accC e fn s0 s1 s2 s2' s3 stat statDeclC v)
   834   then obtain n1 n2 where
   834   then obtain n1 n2 where
   835     "G\<turnstile>Norm s0 \<midarrow>Init statDeclC\<midarrow>n1\<rightarrow> s1"
   835     "G\<turnstile>Norm s0 \<midarrow>Init statDeclC\<midarrow>n1\<rightarrow> s1"
   836     "G\<turnstile>s1 \<midarrow>e-\<succ>a\<midarrow>n2\<rightarrow> s2"
   836     "G\<turnstile>s1 \<midarrow>e-\<succ>a\<midarrow>n2\<rightarrow> s2"
   837     by rules
   837     by iprover
   838   moreover
   838   moreover
   839   have "s3 = check_field_access G accC statDeclC fn stat a s2'" 
   839   have "s3 = check_field_access G accC statDeclC fn stat a s2'" 
   840        "(v, s2') = fvar statDeclC stat fn a s2" .
   840        "(v, s2') = fvar statDeclC stat fn a s2" .
   841   ultimately
   841   ultimately
   842   have "G\<turnstile>Norm s0 \<midarrow>{accC,statDeclC,stat}e..fn=\<succ>v\<midarrow>max n1 n2\<rightarrow> s3"
   842   have "G\<turnstile>Norm s0 \<midarrow>{accC,statDeclC,stat}e..fn=\<succ>v\<midarrow>max n1 n2\<rightarrow> s3"
   843     by (rules intro: evaln.FVar dest: evaln_max2)
   843     by (iprover intro: evaln.FVar dest: evaln_max2)
   844   then show ?case ..
   844   then show ?case ..
   845 next
   845 next
   846   case (AVar a e1 e2 i s0 s1 s2 s2' v )
   846   case (AVar a e1 e2 i s0 s1 s2 s2' v )
   847   then obtain n1 n2 where 
   847   then obtain n1 n2 where 
   848     "G\<turnstile>Norm s0 \<midarrow>e1-\<succ>a\<midarrow>n1\<rightarrow> s1"
   848     "G\<turnstile>Norm s0 \<midarrow>e1-\<succ>a\<midarrow>n1\<rightarrow> s1"
   849     "G\<turnstile>s1 \<midarrow>e2-\<succ>i\<midarrow>n2\<rightarrow> s2"      
   849     "G\<turnstile>s1 \<midarrow>e2-\<succ>i\<midarrow>n2\<rightarrow> s2"      
   850     by rules
   850     by iprover
   851   moreover 
   851   moreover 
   852   have "(v, s2') = avar G i a s2" .
   852   have "(v, s2') = avar G i a s2" .
   853   ultimately 
   853   ultimately 
   854   have "G\<turnstile>Norm s0 \<midarrow>e1.[e2]=\<succ>v\<midarrow>max n1 n2\<rightarrow> s2'"
   854   have "G\<turnstile>Norm s0 \<midarrow>e1.[e2]=\<succ>v\<midarrow>max n1 n2\<rightarrow> s2'"
   855     by (blast intro!: evaln.AVar dest: evaln_max2)
   855     by (blast intro!: evaln.AVar dest: evaln_max2)
   856   then show ?case ..
   856   then show ?case ..
   857 next
   857 next
   858   case (Nil s0)
   858   case (Nil s0)
   859   show ?case by (rules intro: evaln.Nil)
   859   show ?case by (iprover intro: evaln.Nil)
   860 next
   860 next
   861   case (Cons e es s0 s1 s2 v vs)
   861   case (Cons e es s0 s1 s2 v vs)
   862   then obtain n1 n2 where 
   862   then obtain n1 n2 where 
   863     "G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<midarrow>n1\<rightarrow> s1"
   863     "G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<midarrow>n1\<rightarrow> s1"
   864     "G\<turnstile>s1 \<midarrow>es\<doteq>\<succ>vs\<midarrow>n2\<rightarrow> s2"      
   864     "G\<turnstile>s1 \<midarrow>es\<doteq>\<succ>vs\<midarrow>n2\<rightarrow> s2"      
   865     by rules
   865     by iprover
   866   then
   866   then
   867   have "G\<turnstile>Norm s0 \<midarrow>e # es\<doteq>\<succ>v # vs\<midarrow>max n1 n2\<rightarrow> s2"
   867   have "G\<turnstile>Norm s0 \<midarrow>e # es\<doteq>\<succ>v # vs\<midarrow>max n1 n2\<rightarrow> s2"
   868     by (blast intro!: evaln.Cons dest: evaln_max2)
   868     by (blast intro!: evaln.Cons dest: evaln_max2)
   869   then show ?case ..
   869   then show ?case ..
   870 qed
   870 qed