src/HOL/Bali/DefiniteAssignment.thy
changeset 21765 89275a3ed7be
parent 18459 2b102759160d
child 23350 50c5b0912a0c
equal deleted inserted replaced
21764:720b0add5206 21765:89275a3ed7be
   511          nrm :: "lname set" --{* Definetly assigned variables 
   511          nrm :: "lname set" --{* Definetly assigned variables 
   512                                  for normal completion*}
   512                                  for normal completion*}
   513          brk :: "breakass" --{* Definetly assigned variables for 
   513          brk :: "breakass" --{* Definetly assigned variables for 
   514                                 abrupt completion with a break *}
   514                                 abrupt completion with a break *}
   515 
   515 
   516 consts da :: "(env \<times> lname set \<times> term \<times> assigned) set"  
       
   517 text {* The environment @{term env} is only needed for the 
       
   518         conditional @{text "_ ? _ : _"}.
       
   519         The definite assignment rules refer to the typing rules here to
       
   520         distinguish boolean and other expressions.
       
   521       *}
       
   522 
       
   523 syntax
       
   524 da :: "env \<Rightarrow> lname set \<Rightarrow> term \<Rightarrow> assigned \<Rightarrow> bool" 
       
   525                            ("_\<turnstile> _ \<guillemotright>_\<guillemotright> _" [65,65,65,65] 71)
       
   526 
       
   527 translations 
       
   528   "E\<turnstile> B \<guillemotright>t\<guillemotright> A" == "(E,B,t,A) \<in> da"
       
   529 
       
   530 text {* @{text B}: the ''assigned'' variables before evaluating term @{text t};
       
   531         @{text A}: the ''assigned'' variables after evaluating term @{text t}
       
   532 *}
       
   533 
       
   534 
       
   535 constdefs rmlab :: "'a \<Rightarrow> ('a,'b) tables \<Rightarrow> ('a,'b) tables"
   516 constdefs rmlab :: "'a \<Rightarrow> ('a,'b) tables \<Rightarrow> ('a,'b) tables"
   536 "rmlab k A \<equiv> \<lambda> x. if x=k then UNIV else A x"
   517 "rmlab k A \<equiv> \<lambda> x. if x=k then UNIV else A x"
   537  
   518  
   538 (*
   519 (*
   539 constdefs setbrk :: "breakass \<Rightarrow> assigned \<Rightarrow> breakass set"
   520 constdefs setbrk :: "breakass \<Rightarrow> assigned \<Rightarrow> breakass set"
   541 *)
   522 *)
   542 
   523 
   543 constdefs range_inter_ts :: "('a,'b) tables \<Rightarrow> 'b set" ("\<Rightarrow>\<Inter>_" 80)
   524 constdefs range_inter_ts :: "('a,'b) tables \<Rightarrow> 'b set" ("\<Rightarrow>\<Inter>_" 80)
   544  "\<Rightarrow>\<Inter>A \<equiv> {x |x. \<forall> k. x \<in> A k}"
   525  "\<Rightarrow>\<Inter>A \<equiv> {x |x. \<forall> k. x \<in> A k}"
   545 
   526 
   546 inductive "da" intros
   527 text {*
   547 
   528 In @{text "E\<turnstile> B \<guillemotright>t\<guillemotright> A"},
   548  Skip: "Env\<turnstile> B \<guillemotright>\<langle>Skip\<rangle>\<guillemotright> \<lparr>nrm=B,brk=\<lambda> l. UNIV\<rparr>"
   529 @{text B} denotes the ''assigned'' variables before evaluating term @{text t},
   549 
   530 whereas @{text A} denotes the ''assigned'' variables after evaluating term @{text t}.
   550  Expr: "Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> A 
   531 The environment @{term E} is only needed for the conditional @{text "_ ? _ : _"}.
   551         \<Longrightarrow>  
   532 The definite assignment rules refer to the typing rules here to
   552         Env\<turnstile> B \<guillemotright>\<langle>Expr e\<rangle>\<guillemotright> A"
   533 distinguish boolean and other expressions.
   553  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>
   534 *}
   554         \<Longrightarrow> 
   535 
   555         Env\<turnstile> B \<guillemotright>\<langle>Break l\<bullet> c\<rangle>\<guillemotright> A" 
   536 inductive2
   556 
   537   da :: "env \<Rightarrow> lname set \<Rightarrow> term \<Rightarrow> assigned \<Rightarrow> bool" ("_\<turnstile> _ \<guillemotright>_\<guillemotright> _" [65,65,65,65] 71)
   557  Comp: "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>c1\<rangle>\<guillemotright> C1; Env\<turnstile> nrm C1 \<guillemotright>\<langle>c2\<rangle>\<guillemotright> C2; 
   538 where
   558         nrm A = nrm C2; brk A = (brk C1) \<Rightarrow>\<inter> (brk C2)\<rbrakk> 
   539   Skip: "Env\<turnstile> B \<guillemotright>\<langle>Skip\<rangle>\<guillemotright> \<lparr>nrm=B,brk=\<lambda> l. UNIV\<rparr>"
   559         \<Longrightarrow>  
   540 
   560         Env\<turnstile> B \<guillemotright>\<langle>c1;; c2\<rangle>\<guillemotright> A"
   541 | Expr: "Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> A 
   561 
   542          \<Longrightarrow>  
   562  If:   "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> E;
   543          Env\<turnstile> B \<guillemotright>\<langle>Expr e\<rangle>\<guillemotright> A"
   563          Env\<turnstile> (B \<union> assigns_if True  e) \<guillemotright>\<langle>c1\<rangle>\<guillemotright> C1;
   544 | 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>
   564          Env\<turnstile> (B \<union> assigns_if False e) \<guillemotright>\<langle>c2\<rangle>\<guillemotright> C2;
   545          \<Longrightarrow> 
   565          nrm A = nrm C1 \<inter> nrm C2;
   546          Env\<turnstile> B \<guillemotright>\<langle>Break l\<bullet> c\<rangle>\<guillemotright> A" 
   566          brk A = brk C1 \<Rightarrow>\<inter> brk C2 \<rbrakk>  
   547 
   567          \<Longrightarrow>
   548 | Comp: "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>c1\<rangle>\<guillemotright> C1; Env\<turnstile> nrm C1 \<guillemotright>\<langle>c2\<rangle>\<guillemotright> C2; 
   568          Env\<turnstile> B \<guillemotright>\<langle>If(e) c1 Else c2\<rangle>\<guillemotright> A"
   549          nrm A = nrm C2; brk A = (brk C1) \<Rightarrow>\<inter> (brk C2)\<rbrakk> 
       
   550          \<Longrightarrow>  
       
   551          Env\<turnstile> B \<guillemotright>\<langle>c1;; c2\<rangle>\<guillemotright> A"
       
   552 
       
   553 | If:   "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> E;
       
   554           Env\<turnstile> (B \<union> assigns_if True  e) \<guillemotright>\<langle>c1\<rangle>\<guillemotright> C1;
       
   555           Env\<turnstile> (B \<union> assigns_if False e) \<guillemotright>\<langle>c2\<rangle>\<guillemotright> C2;
       
   556           nrm A = nrm C1 \<inter> nrm C2;
       
   557           brk A = brk C1 \<Rightarrow>\<inter> brk C2 \<rbrakk>  
       
   558           \<Longrightarrow>
       
   559           Env\<turnstile> B \<guillemotright>\<langle>If(e) c1 Else c2\<rangle>\<guillemotright> A"
   569 
   560 
   570 --{* Note that @{term E} is not further used, because we take the specialized
   561 --{* Note that @{term E} is not further used, because we take the specialized
   571      sets that also consider if the expression evaluates to true or false. 
   562      sets that also consider if the expression evaluates to true or false. 
   572      Inside of @{term e} there is no {\tt break} or {\tt finally}, so the break
   563      Inside of @{term e} there is no {\tt break} or {\tt finally}, so the break
   573      map of @{term E} will be the trivial one. So 
   564      map of @{term E} will be the trivial one. So 
   574      @{term "Env\<turnstile>B \<guillemotright>\<langle>e\<rangle>\<guillemotright> E"} is just used to enshure the definite assignment in
   565      @{term "Env\<turnstile>B \<guillemotright>\<langle>e\<rangle>\<guillemotright> E"} is just used to ensure the definite assignment in
   575      expression @{term e}.
   566      expression @{term e}.
   576      Notice the implicit analysis of a constant boolean expression @{term e}
   567      Notice the implicit analysis of a constant boolean expression @{term e}
   577      in this rule. For example, if @{term e} is constantly @{term True} then 
   568      in this rule. For example, if @{term e} is constantly @{term True} then 
   578      @{term "assigns_if False e = UNIV"} and therefor @{term "nrm C2=UNIV"}.
   569      @{term "assigns_if False e = UNIV"} and therefor @{term "nrm C2=UNIV"}.
   579      So finally @{term "nrm A = nrm C1"}. For the break maps this trick 
   570      So finally @{term "nrm A = nrm C1"}. For the break maps this trick 
   583      to @{term UNIV} too, because @{term "assigns_if False e = UNIV"}. So
   574      to @{term UNIV} too, because @{term "assigns_if False e = UNIV"}. So
   584      in the intersection of the break maps the path @{term c2} will have no
   575      in the intersection of the break maps the path @{term c2} will have no
   585      contribution.
   576      contribution.
   586   *}
   577   *}
   587 
   578 
   588  Loop: "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> E; 
   579 | Loop: "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> E; 
   589          Env\<turnstile> (B \<union> assigns_if True e) \<guillemotright>\<langle>c\<rangle>\<guillemotright> C;
   580           Env\<turnstile> (B \<union> assigns_if True e) \<guillemotright>\<langle>c\<rangle>\<guillemotright> C;
   590          nrm A = nrm C \<inter> (B \<union> assigns_if False e);
   581           nrm A = nrm C \<inter> (B \<union> assigns_if False e);
   591          brk A = brk C\<rbrakk>  
   582           brk A = brk C\<rbrakk>  
   592          \<Longrightarrow>
   583           \<Longrightarrow>
   593          Env\<turnstile> B \<guillemotright>\<langle>l\<bullet> While(e) c\<rangle>\<guillemotright> A"
   584           Env\<turnstile> B \<guillemotright>\<langle>l\<bullet> While(e) c\<rangle>\<guillemotright> A"
   594 --{* The @{text Loop} rule resembles some of the ideas of the @{text If} rule.
   585 --{* The @{text Loop} rule resembles some of the ideas of the @{text If} rule.
   595      For the @{term "nrm A"} the set @{term "B \<union> assigns_if False e"} 
   586      For the @{term "nrm A"} the set @{term "B \<union> assigns_if False e"} 
   596      will be @{term UNIV} if the condition is constantly true. To normally exit
   587      will be @{term UNIV} if the condition is constantly true. To normally exit
   597      the while loop, we must consider the body @{term c} to be completed 
   588      the while loop, we must consider the body @{term c} to be completed 
   598      normally (@{term "nrm C"}) or with a break. But in this model, 
   589      normally (@{term "nrm C"}) or with a break. But in this model, 
   600      only handles continue labels, not break labels. The break label will be
   591      only handles continue labels, not break labels. The break label will be
   601      handled by an enclosing @{term Lab} statement. So we don't have to
   592      handled by an enclosing @{term Lab} statement. So we don't have to
   602      handle the breaks specially. 
   593      handle the breaks specially. 
   603   *}
   594   *}
   604 
   595 
   605  Jmp: "\<lbrakk>jump=Ret \<longrightarrow> Result \<in> B;
   596 | Jmp: "\<lbrakk>jump=Ret \<longrightarrow> Result \<in> B;
   606         nrm A = UNIV;
   597          nrm A = UNIV;
   607         brk A = (case jump of
   598          brk A = (case jump of
   608                    Break l \<Rightarrow> \<lambda> k. if k=l then B else UNIV     
   599                     Break l \<Rightarrow> \<lambda> k. if k=l then B else UNIV     
   609                  | Cont l  \<Rightarrow> \<lambda> k. UNIV
   600                   | Cont l  \<Rightarrow> \<lambda> k. UNIV
   610                  | Ret     \<Rightarrow> \<lambda> k. UNIV)\<rbrakk> 
   601                   | Ret     \<Rightarrow> \<lambda> k. UNIV)\<rbrakk> 
   611        \<Longrightarrow> 
   602         \<Longrightarrow> 
   612        Env\<turnstile> B \<guillemotright>\<langle>Jmp jump\<rangle>\<guillemotright> A"
   603         Env\<turnstile> B \<guillemotright>\<langle>Jmp jump\<rangle>\<guillemotright> A"
   613 --{* In case of a break to label @{term l} the corresponding break set is all
   604 --{* In case of a break to label @{term l} the corresponding break set is all
   614      variables assigned before the break. The assigned variables for normal
   605      variables assigned before the break. The assigned variables for normal
   615      completion of the @{term Jmp} is @{term UNIV}, because the statement will
   606      completion of the @{term Jmp} is @{term UNIV}, because the statement will
   616      never complete normally. For continue and return the break map is the 
   607      never complete normally. For continue and return the break map is the 
   617      trivial one. In case of a return we enshure that the result value is
   608      trivial one. In case of a return we enshure that the result value is
   618      assigned.
   609      assigned.
   619   *}
   610   *}
   620 
   611 
   621  Throw: "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> E; nrm A = UNIV; brk A = (\<lambda> l. UNIV)\<rbrakk> 
   612 | Throw: "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> E; nrm A = UNIV; brk A = (\<lambda> l. UNIV)\<rbrakk> 
   622         \<Longrightarrow> Env\<turnstile> B \<guillemotright>\<langle>Throw e\<rangle>\<guillemotright> A"
   613          \<Longrightarrow> Env\<turnstile> B \<guillemotright>\<langle>Throw e\<rangle>\<guillemotright> A"
   623 
   614 
   624  Try:  "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>c1\<rangle>\<guillemotright> C1; 
   615 | Try:  "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>c1\<rangle>\<guillemotright> C1; 
   625          Env\<lparr>lcl := lcl Env(VName vn\<mapsto>Class C)\<rparr>\<turnstile> (B \<union> {VName vn}) \<guillemotright>\<langle>c2\<rangle>\<guillemotright> C2;  
   616           Env\<lparr>lcl := lcl Env(VName vn\<mapsto>Class C)\<rparr>\<turnstile> (B \<union> {VName vn}) \<guillemotright>\<langle>c2\<rangle>\<guillemotright> C2;  
   626          nrm A = nrm C1 \<inter> nrm C2;
   617           nrm A = nrm C1 \<inter> nrm C2;
   627          brk A = brk C1 \<Rightarrow>\<inter> brk C2\<rbrakk> 
   618           brk A = brk C1 \<Rightarrow>\<inter> brk C2\<rbrakk> 
   628         \<Longrightarrow> Env\<turnstile> B \<guillemotright>\<langle>Try c1 Catch(C vn) c2\<rangle>\<guillemotright> A"
   619          \<Longrightarrow> Env\<turnstile> B \<guillemotright>\<langle>Try c1 Catch(C vn) c2\<rangle>\<guillemotright> A"
   629 
   620 
   630  Fin:  "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>c1\<rangle>\<guillemotright> C1;
   621 | Fin:  "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>c1\<rangle>\<guillemotright> C1;
   631          Env\<turnstile> B \<guillemotright>\<langle>c2\<rangle>\<guillemotright> C2;
   622           Env\<turnstile> B \<guillemotright>\<langle>c2\<rangle>\<guillemotright> C2;
   632          nrm A = nrm C1 \<union> nrm C2;
   623           nrm A = nrm C1 \<union> nrm C2;
   633          brk A = ((brk C1) \<Rightarrow>\<union>\<^sub>\<forall> (nrm C2)) \<Rightarrow>\<inter> (brk C2)\<rbrakk>  
   624           brk A = ((brk C1) \<Rightarrow>\<union>\<^sub>\<forall> (nrm C2)) \<Rightarrow>\<inter> (brk C2)\<rbrakk>  
   634          \<Longrightarrow>
   625           \<Longrightarrow>
   635          Env\<turnstile> B \<guillemotright>\<langle>c1 Finally c2\<rangle>\<guillemotright> A" 
   626           Env\<turnstile> B \<guillemotright>\<langle>c1 Finally c2\<rangle>\<guillemotright> A" 
   636 --{* The set of assigned variables before execution @{term c2} are the same
   627 --{* The set of assigned variables before execution @{term c2} are the same
   637      as before execution @{term c1}, because @{term c1} could throw an exception
   628      as before execution @{term c1}, because @{term c1} could throw an exception
   638      and so we can't guarantee that any variable will be assigned in @{term c1}.
   629      and so we can't guarantee that any variable will be assigned in @{term c1}.
   639      The @{text Finally} statement completes
   630      The @{text Finally} statement completes
   640      normally if both @{term c1} and @{term c2} complete normally. If @{term c1}
   631      normally if both @{term c1} and @{term c2} complete normally. If @{term c1}
   669      to fit to these circumstances. If an initialization is involved during
   660      to fit to these circumstances. If an initialization is involved during
   670      evaluation of the expression (evaluation rules @{text FVar}, @{text NewC} 
   661      evaluation of the expression (evaluation rules @{text FVar}, @{text NewC} 
   671      and @{text NewA}
   662      and @{text NewA}
   672 *}
   663 *}
   673 
   664 
   674  Init: "Env\<turnstile> B \<guillemotright>\<langle>Init C\<rangle>\<guillemotright> \<lparr>nrm=B,brk=\<lambda> l. UNIV\<rparr>"
   665 | Init: "Env\<turnstile> B \<guillemotright>\<langle>Init C\<rangle>\<guillemotright> \<lparr>nrm=B,brk=\<lambda> l. UNIV\<rparr>"
   675 --{* Wellformedness of a program will ensure, that every static initialiser 
   666 --{* Wellformedness of a program will ensure, that every static initialiser 
   676      is definetly assigned and the jumps are nested correctly. The case here
   667      is definetly assigned and the jumps are nested correctly. The case here
   677      for @{term Init} is just for convenience, to get a proper precondition 
   668      for @{term Init} is just for convenience, to get a proper precondition 
   678      for the induction hypothesis in various proofs, so that we don't have to
   669      for the induction hypothesis in various proofs, so that we don't have to
   679      expand the initialisation on every point where it is triggerred by the
   670      expand the initialisation on every point where it is triggerred by the
   680      evaluation rules.
   671      evaluation rules.
   681   *}   
   672   *}   
   682  NewC: "Env\<turnstile> B \<guillemotright>\<langle>NewC C\<rangle>\<guillemotright> \<lparr>nrm=B,brk=\<lambda> l. UNIV\<rparr>" 
   673 | NewC: "Env\<turnstile> B \<guillemotright>\<langle>NewC C\<rangle>\<guillemotright> \<lparr>nrm=B,brk=\<lambda> l. UNIV\<rparr>" 
   683 
   674 
   684  NewA: "Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> A 
   675 | NewA: "Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> A 
   685         \<Longrightarrow>
   676          \<Longrightarrow>
   686         Env\<turnstile> B \<guillemotright>\<langle>New T[e]\<rangle>\<guillemotright> A"
   677          Env\<turnstile> B \<guillemotright>\<langle>New T[e]\<rangle>\<guillemotright> A"
   687 
   678 
   688  Cast: "Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> A
   679 | Cast: "Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> A
   689         \<Longrightarrow>
   680          \<Longrightarrow>
   690         Env\<turnstile> B \<guillemotright>\<langle>Cast T e\<rangle>\<guillemotright> A"
   681          Env\<turnstile> B \<guillemotright>\<langle>Cast T e\<rangle>\<guillemotright> A"
   691 
   682 
   692  Inst: "Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> A 
   683 | Inst: "Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> A 
   693         \<Longrightarrow> 
   684          \<Longrightarrow> 
   694         Env\<turnstile> B \<guillemotright>\<langle>e InstOf T\<rangle>\<guillemotright> A"
   685          Env\<turnstile> B \<guillemotright>\<langle>e InstOf T\<rangle>\<guillemotright> A"
   695 
   686 
   696  Lit:  "Env\<turnstile> B \<guillemotright>\<langle>Lit v\<rangle>\<guillemotright> \<lparr>nrm=B,brk=\<lambda> l. UNIV\<rparr>"
   687 | Lit:  "Env\<turnstile> B \<guillemotright>\<langle>Lit v\<rangle>\<guillemotright> \<lparr>nrm=B,brk=\<lambda> l. UNIV\<rparr>"
   697 
   688 
   698  UnOp: "Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> A
   689 | UnOp: "Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> A
   699         \<Longrightarrow> 
   690          \<Longrightarrow> 
   700         Env\<turnstile> B \<guillemotright>\<langle>UnOp unop e\<rangle>\<guillemotright> A"
   691          Env\<turnstile> B \<guillemotright>\<langle>UnOp unop e\<rangle>\<guillemotright> A"
   701 
   692 
   702  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; 
   693 | 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; 
   703             nrm A = B \<union> (assigns_if True (BinOp CondAnd e1 e2) \<inter> 
   694              nrm A = B \<union> (assigns_if True (BinOp CondAnd e1 e2) \<inter> 
   704                             assigns_if False (BinOp CondAnd e1 e2));
   695                              assigns_if False (BinOp CondAnd e1 e2));
       
   696              brk A = (\<lambda> l. UNIV) \<rbrakk>
       
   697             \<Longrightarrow>
       
   698             Env\<turnstile> B \<guillemotright>\<langle>BinOp CondAnd e1 e2\<rangle>\<guillemotright> A"
       
   699 
       
   700 | 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; 
       
   701             nrm A = B \<union> (assigns_if True (BinOp CondOr e1 e2) \<inter> 
       
   702                               assigns_if False (BinOp CondOr e1 e2));
   705             brk A = (\<lambda> l. UNIV) \<rbrakk>
   703             brk A = (\<lambda> l. UNIV) \<rbrakk>
   706            \<Longrightarrow>
   704             \<Longrightarrow>
   707            Env\<turnstile> B \<guillemotright>\<langle>BinOp CondAnd e1 e2\<rangle>\<guillemotright> A"
   705             Env\<turnstile> B \<guillemotright>\<langle>BinOp CondOr e1 e2\<rangle>\<guillemotright> A"
   708 
   706 
   709  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; 
   707 | BinOp: "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>e1\<rangle>\<guillemotright> E1; Env\<turnstile> nrm E1 \<guillemotright>\<langle>e2\<rangle>\<guillemotright> A; 
   710            nrm A = B \<union> (assigns_if True (BinOp CondOr e1 e2) \<inter> 
   708            binop \<noteq> CondAnd; binop \<noteq> CondOr\<rbrakk>
   711                              assigns_if False (BinOp CondOr e1 e2));
   709           \<Longrightarrow>
   712            brk A = (\<lambda> l. UNIV) \<rbrakk>
   710           Env\<turnstile> B \<guillemotright>\<langle>BinOp binop e1 e2\<rangle>\<guillemotright> A"
   713            \<Longrightarrow>
   711 
   714            Env\<turnstile> B \<guillemotright>\<langle>BinOp CondOr e1 e2\<rangle>\<guillemotright> A"
   712 | Super: "This \<in> B 
   715 
   713           \<Longrightarrow> 
   716  BinOp: "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>e1\<rangle>\<guillemotright> E1; Env\<turnstile> nrm E1 \<guillemotright>\<langle>e2\<rangle>\<guillemotright> A; 
   714           Env\<turnstile> B \<guillemotright>\<langle>Super\<rangle>\<guillemotright> \<lparr>nrm=B,brk=\<lambda> l. UNIV\<rparr>"
   717           binop \<noteq> CondAnd; binop \<noteq> CondOr\<rbrakk>
   715 
   718          \<Longrightarrow>
   716 | AccLVar: "\<lbrakk>vn \<in> B;
   719          Env\<turnstile> B \<guillemotright>\<langle>BinOp binop e1 e2\<rangle>\<guillemotright> A"
   717              nrm A = B; brk A = (\<lambda> k. UNIV)\<rbrakk> 
   720 
   718              \<Longrightarrow> 
   721  Super: "This \<in> B 
   719              Env\<turnstile> B \<guillemotright>\<langle>Acc (LVar vn)\<rangle>\<guillemotright> A"
   722          \<Longrightarrow> 
       
   723          Env\<turnstile> B \<guillemotright>\<langle>Super\<rangle>\<guillemotright> \<lparr>nrm=B,brk=\<lambda> l. UNIV\<rparr>"
       
   724 
       
   725  AccLVar: "\<lbrakk>vn \<in> B;
       
   726             nrm A = B; brk A = (\<lambda> k. UNIV)\<rbrakk> 
       
   727             \<Longrightarrow> 
       
   728             Env\<turnstile> B \<guillemotright>\<langle>Acc (LVar vn)\<rangle>\<guillemotright> A"
       
   729 --{* To properly access a local variable we have to test the definite 
   720 --{* To properly access a local variable we have to test the definite 
   730      assignment here. The variable must occur in the set @{term B} 
   721      assignment here. The variable must occur in the set @{term B} 
   731   *}
   722   *}
   732 
   723 
   733  Acc: "\<lbrakk>\<forall> vn. v \<noteq> LVar vn;
   724 | Acc: "\<lbrakk>\<forall> vn. v \<noteq> LVar vn;
   734         Env\<turnstile> B \<guillemotright>\<langle>v\<rangle>\<guillemotright> A\<rbrakk>
   725          Env\<turnstile> B \<guillemotright>\<langle>v\<rangle>\<guillemotright> A\<rbrakk>
   735         \<Longrightarrow>
   726          \<Longrightarrow>
   736         Env\<turnstile> B \<guillemotright>\<langle>Acc v\<rangle>\<guillemotright> A"
   727          Env\<turnstile> B \<guillemotright>\<langle>Acc v\<rangle>\<guillemotright> A"
   737 
   728 
   738  AssLVar: "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> E; nrm A = nrm E \<union> {vn}; brk A = brk E\<rbrakk> 
   729 | AssLVar: "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> E; nrm A = nrm E \<union> {vn}; brk A = brk E\<rbrakk> 
   739            \<Longrightarrow> 
   730             \<Longrightarrow> 
   740            Env\<turnstile> B \<guillemotright>\<langle>(LVar vn) := e\<rangle>\<guillemotright> A"
   731             Env\<turnstile> B \<guillemotright>\<langle>(LVar vn) := e\<rangle>\<guillemotright> A"
   741 
   732 
   742  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>
   733 | 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>
   743         \<Longrightarrow>
   734          \<Longrightarrow>
   744         Env\<turnstile> B \<guillemotright>\<langle>v := e\<rangle>\<guillemotright> A"
   735          Env\<turnstile> B \<guillemotright>\<langle>v := e\<rangle>\<guillemotright> A"
   745 
   736 
   746  CondBool: "\<lbrakk>Env\<turnstile>(c ? e1 : e2)\<Colon>-(PrimT Boolean);
   737 | CondBool: "\<lbrakk>Env\<turnstile>(c ? e1 : e2)\<Colon>-(PrimT Boolean);
   747              Env\<turnstile> B \<guillemotright>\<langle>c\<rangle>\<guillemotright> C;
   738               Env\<turnstile> B \<guillemotright>\<langle>c\<rangle>\<guillemotright> C;
   748              Env\<turnstile> (B \<union> assigns_if True  c) \<guillemotright>\<langle>e1\<rangle>\<guillemotright> E1;
   739               Env\<turnstile> (B \<union> assigns_if True  c) \<guillemotright>\<langle>e1\<rangle>\<guillemotright> E1;
   749              Env\<turnstile> (B \<union> assigns_if False c) \<guillemotright>\<langle>e2\<rangle>\<guillemotright> E2;
   740               Env\<turnstile> (B \<union> assigns_if False c) \<guillemotright>\<langle>e2\<rangle>\<guillemotright> E2;
   750              nrm A = B \<union> (assigns_if True  (c ? e1 : e2) \<inter> 
   741               nrm A = B \<union> (assigns_if True  (c ? e1 : e2) \<inter> 
   751                               assigns_if False (c ? e1 : e2));
   742                                assigns_if False (c ? e1 : e2));
   752              brk A = (\<lambda> l. UNIV)\<rbrakk>
   743               brk A = (\<lambda> l. UNIV)\<rbrakk>
   753              \<Longrightarrow> 
   744               \<Longrightarrow> 
   754              Env\<turnstile> B \<guillemotright>\<langle>c ? e1 : e2\<rangle>\<guillemotright> A" 
   745               Env\<turnstile> B \<guillemotright>\<langle>c ? e1 : e2\<rangle>\<guillemotright> A" 
   755 
   746 
   756  Cond: "\<lbrakk>\<not> Env\<turnstile>(c ? e1 : e2)\<Colon>-(PrimT Boolean);
   747 | Cond: "\<lbrakk>\<not> Env\<turnstile>(c ? e1 : e2)\<Colon>-(PrimT Boolean);
   757          Env\<turnstile> B \<guillemotright>\<langle>c\<rangle>\<guillemotright> C;
   748           Env\<turnstile> B \<guillemotright>\<langle>c\<rangle>\<guillemotright> C;
   758          Env\<turnstile> (B \<union> assigns_if True  c) \<guillemotright>\<langle>e1\<rangle>\<guillemotright> E1;
   749           Env\<turnstile> (B \<union> assigns_if True  c) \<guillemotright>\<langle>e1\<rangle>\<guillemotright> E1;
   759          Env\<turnstile> (B \<union> assigns_if False c) \<guillemotright>\<langle>e2\<rangle>\<guillemotright> E2;
   750           Env\<turnstile> (B \<union> assigns_if False c) \<guillemotright>\<langle>e2\<rangle>\<guillemotright> E2;
   760         nrm A = nrm E1 \<inter> nrm E2; brk A = (\<lambda> l. UNIV)\<rbrakk>
   751           nrm A = nrm E1 \<inter> nrm E2; brk A = (\<lambda> l. UNIV)\<rbrakk>
   761         \<Longrightarrow> 
   752           \<Longrightarrow> 
   762         Env\<turnstile> B \<guillemotright>\<langle>c ? e1 : e2\<rangle>\<guillemotright> A" 
   753           Env\<turnstile> B \<guillemotright>\<langle>c ? e1 : e2\<rangle>\<guillemotright> A" 
   763 
   754 
   764  Call: "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> E; Env\<turnstile> nrm E \<guillemotright>\<langle>args\<rangle>\<guillemotright> A\<rbrakk> 
   755 | Call: "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> E; Env\<turnstile> nrm E \<guillemotright>\<langle>args\<rangle>\<guillemotright> A\<rbrakk> 
   765         \<Longrightarrow>  
   756          \<Longrightarrow>  
   766         Env\<turnstile> B \<guillemotright>\<langle>{accC,statT,mode}e\<cdot>mn({pTs}args)\<rangle>\<guillemotright> A"
   757          Env\<turnstile> B \<guillemotright>\<langle>{accC,statT,mode}e\<cdot>mn({pTs}args)\<rangle>\<guillemotright> A"
   767 
   758 
   768 -- {* The interplay of @{term Call}, @{term Methd} and @{term Body}:
   759 -- {* The interplay of @{term Call}, @{term Methd} and @{term Body}:
   769       Why rules for @{term Methd} and @{term Body} at all? Note that a
   760       Why rules for @{term Methd} and @{term Body} at all? Note that a
   770       Java source program will not include bare  @{term Methd} or @{term Body}
   761       Java source program will not include bare  @{term Methd} or @{term Body}
   771       terms. These terms are just introduced during evaluation. So definite
   762       terms. These terms are just introduced during evaluation. So definite
   784       rules, and therefor we have to establish the definite assignment of the
   775       rules, and therefor we have to establish the definite assignment of the
   785       sub-evaluation during the type-safety proof. Note that well-typedness is
   776       sub-evaluation during the type-safety proof. Note that well-typedness is
   786       also a precondition for type-safety and so we can omit some assertion 
   777       also a precondition for type-safety and so we can omit some assertion 
   787       that are already ensured by well-typedness. 
   778       that are already ensured by well-typedness. 
   788    *}
   779    *}
   789  Methd: "\<lbrakk>methd (prg Env) D sig = Some m;
   780 | Methd: "\<lbrakk>methd (prg Env) D sig = Some m;
   790           Env\<turnstile> B \<guillemotright>\<langle>Body (declclass m) (stmt (mbody (mthd m)))\<rangle>\<guillemotright> A
   781            Env\<turnstile> B \<guillemotright>\<langle>Body (declclass m) (stmt (mbody (mthd m)))\<rangle>\<guillemotright> A
   791          \<rbrakk>
   782           \<rbrakk>
       
   783           \<Longrightarrow>
       
   784           Env\<turnstile> B \<guillemotright>\<langle>Methd D sig\<rangle>\<guillemotright> A" 
       
   785 
       
   786 | Body: "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>c\<rangle>\<guillemotright> C; jumpNestingOkS {Ret} c; Result \<in> nrm C;
       
   787           nrm A = B; brk A = (\<lambda> l. UNIV)\<rbrakk>
   792          \<Longrightarrow>
   788          \<Longrightarrow>
   793          Env\<turnstile> B \<guillemotright>\<langle>Methd D sig\<rangle>\<guillemotright> A" 
   789          Env\<turnstile> B \<guillemotright>\<langle>Body D c\<rangle>\<guillemotright> A"
   794 
       
   795  Body: "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>c\<rangle>\<guillemotright> C; jumpNestingOkS {Ret} c; Result \<in> nrm C;
       
   796          nrm A = B; brk A = (\<lambda> l. UNIV)\<rbrakk>
       
   797         \<Longrightarrow>
       
   798         Env\<turnstile> B \<guillemotright>\<langle>Body D c\<rangle>\<guillemotright> A"
       
   799 -- {* Note that @{term A} is not correlated to  @{term C}. If the body
   790 -- {* Note that @{term A} is not correlated to  @{term C}. If the body
   800       statement returns abruptly with return, evaluation of  @{term Body}
   791       statement returns abruptly with return, evaluation of  @{term Body}
   801       will absorb this return and complete normally. So we cannot trivially
   792       will absorb this return and complete normally. So we cannot trivially
   802       get the assigned variables of the body statement since it has not 
   793       get the assigned variables of the body statement since it has not 
   803       completed normally or with a break.
   794       completed normally or with a break.
   807       definite assignment only talks about normal completion and breaks. So
   798       definite assignment only talks about normal completion and breaks. So
   808       for a return the @{term Jump} rule ensures that the result variable is
   799       for a return the @{term Jump} rule ensures that the result variable is
   809       set and then this information must be carried over to the @{term Body}
   800       set and then this information must be carried over to the @{term Body}
   810       rule by the conformance predicate of the state.
   801       rule by the conformance predicate of the state.
   811    *}
   802    *}
   812  LVar: "Env\<turnstile> B \<guillemotright>\<langle>LVar vn\<rangle>\<guillemotright> \<lparr>nrm=B, brk=\<lambda> l. UNIV\<rparr>" 
   803 | LVar: "Env\<turnstile> B \<guillemotright>\<langle>LVar vn\<rangle>\<guillemotright> \<lparr>nrm=B, brk=\<lambda> l. UNIV\<rparr>" 
   813 
   804 
   814  FVar: "Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> A 
   805 | FVar: "Env\<turnstile> B \<guillemotright>\<langle>e\<rangle>\<guillemotright> A 
   815         \<Longrightarrow> 
       
   816         Env\<turnstile> B \<guillemotright>\<langle>{accC,statDeclC,stat}e..fn\<rangle>\<guillemotright> A" 
       
   817 
       
   818  AVar: "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>e1\<rangle>\<guillemotright> E1; Env\<turnstile> nrm E1 \<guillemotright>\<langle>e2\<rangle>\<guillemotright> A\<rbrakk>
       
   819          \<Longrightarrow> 
   806          \<Longrightarrow> 
   820          Env\<turnstile> B \<guillemotright>\<langle>e1.[e2]\<rangle>\<guillemotright> A" 
   807          Env\<turnstile> B \<guillemotright>\<langle>{accC,statDeclC,stat}e..fn\<rangle>\<guillemotright> A" 
   821 
   808 
   822  Nil: "Env\<turnstile> B \<guillemotright>\<langle>[]::expr list\<rangle>\<guillemotright> \<lparr>nrm=B, brk=\<lambda> l. UNIV\<rparr>" 
   809 | AVar: "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>e1\<rangle>\<guillemotright> E1; Env\<turnstile> nrm E1 \<guillemotright>\<langle>e2\<rangle>\<guillemotright> A\<rbrakk>
   823 
   810           \<Longrightarrow> 
   824  Cons: "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>e::expr\<rangle>\<guillemotright> E; Env\<turnstile> nrm E \<guillemotright>\<langle>es\<rangle>\<guillemotright> A\<rbrakk>
   811           Env\<turnstile> B \<guillemotright>\<langle>e1.[e2]\<rangle>\<guillemotright> A" 
   825         \<Longrightarrow> 
   812 
   826         Env\<turnstile> B \<guillemotright>\<langle>e#es\<rangle>\<guillemotright> A" 
   813 | Nil: "Env\<turnstile> B \<guillemotright>\<langle>[]::expr list\<rangle>\<guillemotright> \<lparr>nrm=B, brk=\<lambda> l. UNIV\<rparr>" 
       
   814 
       
   815 | Cons: "\<lbrakk>Env\<turnstile> B \<guillemotright>\<langle>e::expr\<rangle>\<guillemotright> E; Env\<turnstile> nrm E \<guillemotright>\<langle>es\<rangle>\<guillemotright> A\<rbrakk>
       
   816          \<Longrightarrow> 
       
   817          Env\<turnstile> B \<guillemotright>\<langle>e#es\<rangle>\<guillemotright> A" 
   827 
   818 
   828 
   819 
   829 declare inj_term_sym_simps [simp]
   820 declare inj_term_sym_simps [simp]
   830 declare assigns_if.simps [simp del]
   821 declare assigns_if.simps [simp del]
   831 declare split_paired_All [simp del] split_paired_Ex [simp del]
   822 declare split_paired_All [simp del] split_paired_Ex [simp del]
   832 ML_setup {*
   823 ML_setup {*
   833 change_simpset (fn ss => ss delloop "split_all_tac");
   824 change_simpset (fn ss => ss delloop "split_all_tac");
   834 *}
   825 *}
   835 inductive_cases da_elim_cases [cases set]:
   826 inductive_cases2 da_elim_cases [cases set]:
   836   "Env\<turnstile> B \<guillemotright>\<langle>Skip\<rangle>\<guillemotright> A" 
   827   "Env\<turnstile> B \<guillemotright>\<langle>Skip\<rangle>\<guillemotright> A" 
   837   "Env\<turnstile> B \<guillemotright>In1r Skip\<guillemotright> A" 
   828   "Env\<turnstile> B \<guillemotright>In1r Skip\<guillemotright> A" 
   838   "Env\<turnstile> B \<guillemotright>\<langle>Expr e\<rangle>\<guillemotright> A"
   829   "Env\<turnstile> B \<guillemotright>\<langle>Expr e\<rangle>\<guillemotright> A"
   839   "Env\<turnstile> B \<guillemotright>In1r (Expr e)\<guillemotright> A"
   830   "Env\<turnstile> B \<guillemotright>In1r (Expr e)\<guillemotright> A"
   840   "Env\<turnstile> B \<guillemotright>\<langle>l\<bullet> c\<rangle>\<guillemotright> A"
   831   "Env\<turnstile> B \<guillemotright>\<langle>l\<bullet> c\<rangle>\<guillemotright> A"
  1074   next
  1065   next
  1075     case Expr 
  1066     case Expr 
  1076     from Expr.prems Expr.hyps 
  1067     from Expr.prems Expr.hyps 
  1077     show ?case by cases simp
  1068     show ?case by cases simp
  1078   next
  1069   next
  1079     case (Lab A B C Env c l B' A')
  1070     case (Lab Env B c C A l B' A')
  1080     have A: "nrm A = nrm C \<inter> brk C l" "brk A = rmlab l (brk C)" .
  1071     have A: "nrm A = nrm C \<inter> brk C l" "brk A = rmlab l (brk C)" .
  1081     have "PROP ?Hyp Env B \<langle>c\<rangle> C" .
  1072     have "PROP ?Hyp Env B \<langle>c\<rangle> C" .
  1082     moreover
  1073     moreover
  1083     have "B \<subseteq> B'" .
  1074     have "B \<subseteq> B'" .
  1084     moreover
  1075     moreover
  1100     }
  1091     }
  1101     moreover note A A'
  1092     moreover note A A'
  1102     ultimately show ?case
  1093     ultimately show ?case
  1103       by simp
  1094       by simp
  1104   next
  1095   next
  1105     case (Comp A B C1 C2 Env c1 c2 B' A')
  1096     case (Comp Env B c1 C1 c2 C2 A B' A')
  1106     have A: "nrm A = nrm C2" "brk A = brk C1 \<Rightarrow>\<inter>  brk C2" .
  1097     have A: "nrm A = nrm C2" "brk A = brk C1 \<Rightarrow>\<inter>  brk C2" .
  1107     have "Env\<turnstile> B' \<guillemotright>\<langle>c1;; c2\<rangle>\<guillemotright> A'" .
  1098     have "Env\<turnstile> B' \<guillemotright>\<langle>c1;; c2\<rangle>\<guillemotright> A'" .
  1108     then obtain  C1' C2'
  1099     then obtain  C1' C2'
  1109       where da_c1: "Env\<turnstile> B' \<guillemotright>\<langle>c1\<rangle>\<guillemotright> C1'" and
  1100       where da_c1: "Env\<turnstile> B' \<guillemotright>\<langle>c1\<rangle>\<guillemotright> C1'" and
  1110             da_c2: "Env\<turnstile> nrm C1' \<guillemotright>\<langle>c2\<rangle>\<guillemotright> C2'"  and
  1101             da_c2: "Env\<turnstile> nrm C1' \<guillemotright>\<langle>c2\<rangle>\<guillemotright> C2'"  and
  1121       by (auto)
  1112       by (auto)
  1122     with A A' C1'
  1113     with A A' C1'
  1123     show ?case
  1114     show ?case
  1124       by auto
  1115       by auto
  1125   next
  1116   next
  1126     case (If A B C1 C2 E Env c1 c2 e B' A')
  1117     case (If Env B e E c1 C1 c2 C2 A B' A')
  1127     have A: "nrm A = nrm C1 \<inter> nrm C2" "brk A = brk C1 \<Rightarrow>\<inter>  brk C2" .
  1118     have A: "nrm A = nrm C1 \<inter> nrm C2" "brk A = brk C1 \<Rightarrow>\<inter>  brk C2" .
  1128     have "Env\<turnstile> B' \<guillemotright>\<langle>If(e) c1 Else c2\<rangle>\<guillemotright> A'" .
  1119     have "Env\<turnstile> B' \<guillemotright>\<langle>If(e) c1 Else c2\<rangle>\<guillemotright> A'" .
  1129     then obtain C1' C2'
  1120     then obtain C1' C2'
  1130       where da_c1: "Env\<turnstile> B' \<union> assigns_if True e \<guillemotright>\<langle>c1\<rangle>\<guillemotright> C1'" and
  1121       where da_c1: "Env\<turnstile> B' \<union> assigns_if True e \<guillemotright>\<langle>c1\<rangle>\<guillemotright> C1'" and
  1131             da_c2: "Env\<turnstile> B' \<union> assigns_if False e \<guillemotright>\<langle>c2\<rangle>\<guillemotright> C2'" and
  1122             da_c2: "Env\<turnstile> B' \<union> assigns_if False e \<guillemotright>\<langle>c2\<rangle>\<guillemotright> C2'" and
  1142       by blast
  1133       by blast
  1143     with A A' C1'
  1134     with A A' C1'
  1144     show ?case
  1135     show ?case
  1145       by auto
  1136       by auto
  1146   next
  1137   next
  1147     case (Loop A B C E Env c e l B' A')
  1138     case (Loop Env B e E c C A l B' A')
  1148     have A: "nrm A = nrm C \<inter> (B \<union> assigns_if False e)"
  1139     have A: "nrm A = nrm C \<inter> (B \<union> assigns_if False e)"
  1149             "brk A = brk C" .
  1140             "brk A = brk C" .
  1150     have "Env\<turnstile> B' \<guillemotright>\<langle>l\<bullet> While(e) c\<rangle>\<guillemotright> A'" .
  1141     have "Env\<turnstile> B' \<guillemotright>\<langle>l\<bullet> While(e) c\<rangle>\<guillemotright> A'" .
  1151     then obtain C'
  1142     then obtain C'
  1152       where 
  1143       where 
  1178       qed
  1169       qed
  1179     }
  1170     }
  1180     ultimately show ?case
  1171     ultimately show ?case
  1181       by auto
  1172       by auto
  1182   next
  1173   next
  1183     case (Jmp A B Env jump B' A')
  1174     case (Jmp jump B A Env B' A')
  1184     thus ?case by (elim da_elim_cases) (auto split: jump.splits)
  1175     thus ?case by (elim da_elim_cases) (auto split: jump.splits)
  1185   next
  1176   next
  1186     case Throw thus ?case by -  (erule da_elim_cases, auto)
  1177     case Throw thus ?case by -  (erule da_elim_cases, auto)
  1187   next
  1178   next
  1188     case (Try A B C C1 C2 Env c1 c2 vn B' A')
  1179     case (Try Env B c1 C1 vn C c2 C2 A B' A')
  1189     have A: "nrm A = nrm C1 \<inter> nrm C2"
  1180     have A: "nrm A = nrm C1 \<inter> nrm C2"
  1190             "brk A = brk C1 \<Rightarrow>\<inter>  brk C2" .
  1181             "brk A = brk C1 \<Rightarrow>\<inter>  brk C2" .
  1191     have "Env\<turnstile> B' \<guillemotright>\<langle>Try c1 Catch(C vn) c2\<rangle>\<guillemotright> A'" .
  1182     have "Env\<turnstile> B' \<guillemotright>\<langle>Try c1 Catch(C vn) c2\<rangle>\<guillemotright> A'" .
  1192     then obtain C1' C2'
  1183     then obtain C1' C2'
  1193       where da_c1': "Env\<turnstile> B' \<guillemotright>\<langle>c1\<rangle>\<guillemotright> C1'" and
  1184       where da_c1': "Env\<turnstile> B' \<guillemotright>\<langle>c1\<rangle>\<guillemotright> C1'" and
  1208       by blast
  1199       by blast
  1209     with C1' A A'
  1200     with C1' A A'
  1210     show ?case
  1201     show ?case
  1211       by auto
  1202       by auto
  1212   next
  1203   next
  1213     case (Fin A B C1 C2 Env c1 c2 B' A')
  1204     case (Fin Env B c1 C1 c2 C2 A B' A')
  1214     have A: "nrm A = nrm C1 \<union> nrm C2"
  1205     have A: "nrm A = nrm C1 \<union> nrm C2"
  1215             "brk A = (brk C1 \<Rightarrow>\<union>\<^sub>\<forall> nrm C2) \<Rightarrow>\<inter> (brk C2)" .
  1206             "brk A = (brk C1 \<Rightarrow>\<union>\<^sub>\<forall> nrm C2) \<Rightarrow>\<inter> (brk C2)" .
  1216     have "Env\<turnstile> B' \<guillemotright>\<langle>c1 Finally c2\<rangle>\<guillemotright> A'" .
  1207     have "Env\<turnstile> B' \<guillemotright>\<langle>c1 Finally c2\<rangle>\<guillemotright> A'" .
  1217     then obtain C1' C2'
  1208     then obtain C1' C2'
  1218       where  da_c1': "Env\<turnstile> B' \<guillemotright>\<langle>c1\<rangle>\<guillemotright> C1'" and
  1209       where  da_c1': "Env\<turnstile> B' \<guillemotright>\<langle>c1\<rangle>\<guillemotright> C1'" and
  1245    next
  1236    next
  1246      case Lit thus ?case by -  (erule da_elim_cases, auto)
  1237      case Lit thus ?case by -  (erule da_elim_cases, auto)
  1247    next
  1238    next
  1248      case UnOp thus ?case by -  (erule da_elim_cases, auto)
  1239      case UnOp thus ?case by -  (erule da_elim_cases, auto)
  1249    next
  1240    next
  1250      case (CondAnd A B E1 E2 Env e1 e2 B' A')
  1241      case (CondAnd Env B e1 E1 e2 E2 A B' A')
  1251      have A: "nrm A = B \<union>
  1242      have A: "nrm A = B \<union>
  1252                        assigns_if True (BinOp CondAnd e1 e2) \<inter>
  1243                        assigns_if True (BinOp CondAnd e1 e2) \<inter>
  1253                        assigns_if False (BinOp CondAnd e1 e2)"
  1244                        assigns_if False (BinOp CondAnd e1 e2)"
  1254              "brk A = (\<lambda>l. UNIV)" .
  1245              "brk A = (\<lambda>l. UNIV)" .
  1255      have "Env\<turnstile> B' \<guillemotright>\<langle>BinOp CondAnd e1 e2\<rangle>\<guillemotright> A'" .
  1246      have "Env\<turnstile> B' \<guillemotright>\<langle>BinOp CondAnd e1 e2\<rangle>\<guillemotright> A'" .
  1274    next
  1265    next
  1275      case AssLVar thus ?case by - (erule da_elim_cases, auto)
  1266      case AssLVar thus ?case by - (erule da_elim_cases, auto)
  1276    next
  1267    next
  1277      case Ass thus ?case by -  (erule da_elim_cases, auto)
  1268      case Ass thus ?case by -  (erule da_elim_cases, auto)
  1278    next
  1269    next
  1279      case (CondBool A B C E1 E2 Env c e1 e2 B' A')
  1270      case (CondBool Env c e1 e2 B C E1 E2 A B' A')
  1280      have A: "nrm A = B \<union> 
  1271      have A: "nrm A = B \<union> 
  1281                         assigns_if True (c ? e1 : e2) \<inter> 
  1272                         assigns_if True (c ? e1 : e2) \<inter> 
  1282                         assigns_if False (c ? e1 : e2)"
  1273                         assigns_if False (c ? e1 : e2)"
  1283              "brk A = (\<lambda>l. UNIV)" .
  1274              "brk A = (\<lambda>l. UNIV)" .
  1284      have "Env\<turnstile> (c ? e1 : e2)\<Colon>- (PrimT Boolean)" .
  1275      have "Env\<turnstile> (c ? e1 : e2)\<Colon>- (PrimT Boolean)" .
  1293        (* inj_term_simps needed to handle wt (defined without \<langle>\<rangle>) *)
  1284        (* inj_term_simps needed to handle wt (defined without \<langle>\<rangle>) *)
  1294      have B': "B \<subseteq> B'" .
  1285      have B': "B \<subseteq> B'" .
  1295      with A A' show ?case 
  1286      with A A' show ?case 
  1296        by auto 
  1287        by auto 
  1297    next
  1288    next
  1298      case (Cond A B C E1 E2 Env c e1 e2 B' A')  
  1289      case (Cond Env c e1 e2 B C E1 E2 A B' A')  
  1299      have A: "nrm A = nrm E1 \<inter> nrm E2"
  1290      have A: "nrm A = nrm E1 \<inter> nrm E2"
  1300              "brk A = (\<lambda>l. UNIV)" .
  1291              "brk A = (\<lambda>l. UNIV)" .
  1301      have not_bool: "\<not> Env\<turnstile> (c ? e1 : e2)\<Colon>- (PrimT Boolean)" .
  1292      have not_bool: "\<not> Env\<turnstile> (c ? e1 : e2)\<Colon>- (PrimT Boolean)" .
  1302      have "Env\<turnstile> B' \<guillemotright>\<langle>c ? e1 : e2\<rangle>\<guillemotright> A'" .
  1293      have "Env\<turnstile> B' \<guillemotright>\<langle>c ? e1 : e2\<rangle>\<guillemotright> A'" .
  1303      then obtain E1' E2'
  1294      then obtain E1' E2'
  1352   proof (induct) 
  1343   proof (induct) 
  1353     case Skip thus ?case by (iprover intro: da.Skip)
  1344     case Skip thus ?case by (iprover intro: da.Skip)
  1354   next
  1345   next
  1355     case Expr thus ?case by (iprover intro: da.Expr)
  1346     case Expr thus ?case by (iprover intro: da.Expr)
  1356   next
  1347   next
  1357     case (Lab A B C Env c l B')  
  1348     case (Lab Env B c C A l B')  
  1358     have "PROP ?Hyp Env B \<langle>c\<rangle>" .
  1349     have "PROP ?Hyp Env B \<langle>c\<rangle>" .
  1359     moreover
  1350     moreover
  1360     have B': "B \<subseteq> B'" .
  1351     have B': "B \<subseteq> B'" .
  1361     ultimately obtain C' where "Env\<turnstile> B' \<guillemotright>\<langle>c\<rangle>\<guillemotright> C'"
  1352     ultimately obtain C' where "Env\<turnstile> B' \<guillemotright>\<langle>c\<rangle>\<guillemotright> C'"
  1362       by iprover
  1353       by iprover
  1363     then obtain A' where "Env\<turnstile> B' \<guillemotright>\<langle>Break l\<bullet> c\<rangle>\<guillemotright> A'"
  1354     then obtain A' where "Env\<turnstile> B' \<guillemotright>\<langle>Break l\<bullet> c\<rangle>\<guillemotright> A'"
  1364       by (iprover intro: da.Lab)
  1355       by (iprover intro: da.Lab)
  1365     thus ?case ..
  1356     thus ?case ..
  1366   next
  1357   next
  1367     case (Comp A B C1 C2 Env c1 c2 B')
  1358     case (Comp Env B c1 C1 c2 C2 A B')
  1368     have da_c1: "Env\<turnstile> B \<guillemotright>\<langle>c1\<rangle>\<guillemotright> C1" .
  1359     have da_c1: "Env\<turnstile> B \<guillemotright>\<langle>c1\<rangle>\<guillemotright> C1" .
  1369     have "PROP ?Hyp Env B \<langle>c1\<rangle>" .
  1360     have "PROP ?Hyp Env B \<langle>c1\<rangle>" .
  1370     moreover
  1361     moreover
  1371     have B': "B \<subseteq> B'" .
  1362     have B': "B \<subseteq> B'" .
  1372     ultimately obtain C1' where da_c1': "Env\<turnstile> B' \<guillemotright>\<langle>c1\<rangle>\<guillemotright> C1'"
  1363     ultimately obtain C1' where da_c1': "Env\<turnstile> B' \<guillemotright>\<langle>c1\<rangle>\<guillemotright> C1'"
  1381       by iprover
  1372       by iprover
  1382     with da_c1' obtain A' where "Env\<turnstile> B' \<guillemotright>\<langle>c1;; c2\<rangle>\<guillemotright> A'"
  1373     with da_c1' obtain A' where "Env\<turnstile> B' \<guillemotright>\<langle>c1;; c2\<rangle>\<guillemotright> A'"
  1383       by (iprover intro: da.Comp)
  1374       by (iprover intro: da.Comp)
  1384     thus ?case ..
  1375     thus ?case ..
  1385   next
  1376   next
  1386     case (If A B C1 C2 E Env c1 c2 e B')
  1377     case (If Env B e E c1 C1 c2 C2 A B')
  1387     have B': "B \<subseteq> B'" .
  1378     have B': "B \<subseteq> B'" .
  1388     obtain  E' where "Env\<turnstile> B' \<guillemotright>\<langle>e\<rangle>\<guillemotright> E'"
  1379     obtain  E' where "Env\<turnstile> B' \<guillemotright>\<langle>e\<rangle>\<guillemotright> E'"
  1389     proof -
  1380     proof -
  1390       have "PROP ?Hyp Env B \<langle>e\<rangle>" by (rule If.hyps)
  1381       have "PROP ?Hyp Env B \<langle>e\<rangle>" by (rule If.hyps)
  1391       with B'  
  1382       with B'  
  1415     ultimately
  1406     ultimately
  1416     obtain A' where "Env\<turnstile> B' \<guillemotright>\<langle>If(e) c1 Else c2\<rangle>\<guillemotright> A'"
  1407     obtain A' where "Env\<turnstile> B' \<guillemotright>\<langle>If(e) c1 Else c2\<rangle>\<guillemotright> A'"
  1417       by (iprover intro: da.If)
  1408       by (iprover intro: da.If)
  1418     thus ?case ..
  1409     thus ?case ..
  1419   next  
  1410   next  
  1420     case (Loop A B C E Env c e l B')
  1411     case (Loop Env B e E c C A l B')
  1421     have B': "B \<subseteq> B'" .
  1412     have B': "B \<subseteq> B'" .
  1422     obtain  E' where "Env\<turnstile> B' \<guillemotright>\<langle>e\<rangle>\<guillemotright> E'"
  1413     obtain  E' where "Env\<turnstile> B' \<guillemotright>\<langle>e\<rangle>\<guillemotright> E'"
  1423     proof -
  1414     proof -
  1424       have "PROP ?Hyp Env B \<langle>e\<rangle>" by (rule Loop.hyps)
  1415       have "PROP ?Hyp Env B \<langle>e\<rangle>" by (rule Loop.hyps)
  1425       with B'  
  1416       with B'  
  1439     ultimately
  1430     ultimately
  1440     obtain A' where "Env\<turnstile> B' \<guillemotright>\<langle>l\<bullet> While(e) c\<rangle>\<guillemotright> A'"
  1431     obtain A' where "Env\<turnstile> B' \<guillemotright>\<langle>l\<bullet> While(e) c\<rangle>\<guillemotright> A'"
  1441       by (iprover intro: da.Loop )
  1432       by (iprover intro: da.Loop )
  1442     thus ?case ..
  1433     thus ?case ..
  1443   next
  1434   next
  1444     case (Jmp A B Env jump B') 
  1435     case (Jmp jump B A Env B') 
  1445     have B': "B \<subseteq> B'" .
  1436     have B': "B \<subseteq> B'" .
  1446     with Jmp.hyps have "jump = Ret \<longrightarrow> Result \<in> B' "
  1437     with Jmp.hyps have "jump = Ret \<longrightarrow> Result \<in> B' "
  1447       by auto
  1438       by auto
  1448     moreover
  1439     moreover
  1449     obtain A'::assigned 
  1440     obtain A'::assigned 
  1458       by (rule da.Jmp)
  1449       by (rule da.Jmp)
  1459     thus ?case ..
  1450     thus ?case ..
  1460   next
  1451   next
  1461     case Throw thus ?case by (iprover intro: da.Throw )
  1452     case Throw thus ?case by (iprover intro: da.Throw )
  1462   next
  1453   next
  1463     case (Try A B C C1 C2 Env c1 c2 vn B')
  1454     case (Try Env B c1 C1 vn C c2 C2 A B')
  1464     have B': "B \<subseteq> B'" .
  1455     have B': "B \<subseteq> B'" .
  1465     obtain C1' where "Env\<turnstile> B' \<guillemotright>\<langle>c1\<rangle>\<guillemotright> C1'"
  1456     obtain C1' where "Env\<turnstile> B' \<guillemotright>\<langle>c1\<rangle>\<guillemotright> C1'"
  1466     proof -
  1457     proof -
  1467       have "PROP ?Hyp Env B \<langle>c1\<rangle>" by (rule Try.hyps)
  1458       have "PROP ?Hyp Env B \<langle>c1\<rangle>" by (rule Try.hyps)
  1468       with B'  
  1459       with B'  
  1483     ultimately
  1474     ultimately
  1484     obtain A' where "Env\<turnstile> B' \<guillemotright>\<langle>Try c1 Catch(C vn) c2\<rangle>\<guillemotright> A'"
  1475     obtain A' where "Env\<turnstile> B' \<guillemotright>\<langle>Try c1 Catch(C vn) c2\<rangle>\<guillemotright> A'"
  1485       by (iprover intro: da.Try )
  1476       by (iprover intro: da.Try )
  1486     thus ?case ..
  1477     thus ?case ..
  1487   next
  1478   next
  1488     case (Fin A B C1 C2 Env c1 c2 B')
  1479     case (Fin Env B c1 C1 c2 C2 A B')
  1489     have B': "B \<subseteq> B'" .
  1480     have B': "B \<subseteq> B'" .
  1490     obtain C1' where C1': "Env\<turnstile> B' \<guillemotright>\<langle>c1\<rangle>\<guillemotright> C1'"
  1481     obtain C1' where C1': "Env\<turnstile> B' \<guillemotright>\<langle>c1\<rangle>\<guillemotright> C1'"
  1491     proof -
  1482     proof -
  1492       have "PROP ?Hyp Env B \<langle>c1\<rangle>" by (rule Fin.hyps)
  1483       have "PROP ?Hyp Env B \<langle>c1\<rangle>" by (rule Fin.hyps)
  1493       with B'  
  1484       with B'  
  1517   next
  1508   next
  1518     case Lit thus ?case by (iprover intro: da.Lit)
  1509     case Lit thus ?case by (iprover intro: da.Lit)
  1519   next
  1510   next
  1520     case UnOp thus ?case by (iprover intro: da.UnOp)
  1511     case UnOp thus ?case by (iprover intro: da.UnOp)
  1521   next
  1512   next
  1522     case (CondAnd A B E1 E2 Env e1 e2 B')
  1513     case (CondAnd Env B e1 E1 e2 E2 A B')
  1523     have B': "B \<subseteq> B'" .
  1514     have B': "B \<subseteq> B'" .
  1524     obtain E1' where "Env\<turnstile> B' \<guillemotright>\<langle>e1\<rangle>\<guillemotright> E1'"
  1515     obtain E1' where "Env\<turnstile> B' \<guillemotright>\<langle>e1\<rangle>\<guillemotright> E1'"
  1525     proof -
  1516     proof -
  1526       have "PROP ?Hyp Env B \<langle>e1\<rangle>" by (rule CondAnd.hyps)
  1517       have "PROP ?Hyp Env B \<langle>e1\<rangle>" by (rule CondAnd.hyps)
  1527       with B'  
  1518       with B'  
  1539     ultimately
  1530     ultimately
  1540     obtain A' where "Env\<turnstile> B' \<guillemotright>\<langle>BinOp CondAnd e1 e2\<rangle>\<guillemotright> A'"
  1531     obtain A' where "Env\<turnstile> B' \<guillemotright>\<langle>BinOp CondAnd e1 e2\<rangle>\<guillemotright> A'"
  1541       by (iprover intro: da.CondAnd)
  1532       by (iprover intro: da.CondAnd)
  1542     thus ?case ..
  1533     thus ?case ..
  1543   next
  1534   next
  1544     case (CondOr A B E1 E2 Env e1 e2 B')
  1535     case (CondOr Env B e1 E1 e2 E2 A B')
  1545     have B': "B \<subseteq> B'" .
  1536     have B': "B \<subseteq> B'" .
  1546     obtain E1' where "Env\<turnstile> B' \<guillemotright>\<langle>e1\<rangle>\<guillemotright> E1'"
  1537     obtain E1' where "Env\<turnstile> B' \<guillemotright>\<langle>e1\<rangle>\<guillemotright> E1'"
  1547     proof -
  1538     proof -
  1548       have "PROP ?Hyp Env B \<langle>e1\<rangle>" by (rule CondOr.hyps)
  1539       have "PROP ?Hyp Env B \<langle>e1\<rangle>" by (rule CondOr.hyps)
  1549       with B'  
  1540       with B'  
  1561     ultimately
  1552     ultimately
  1562     obtain A' where "Env\<turnstile> B' \<guillemotright>\<langle>BinOp CondOr e1 e2\<rangle>\<guillemotright> A'"
  1553     obtain A' where "Env\<turnstile> B' \<guillemotright>\<langle>BinOp CondOr e1 e2\<rangle>\<guillemotright> A'"
  1563       by (iprover intro: da.CondOr)
  1554       by (iprover intro: da.CondOr)
  1564     thus ?case ..
  1555     thus ?case ..
  1565   next
  1556   next
  1566     case (BinOp A B E1 Env binop e1 e2 B')
  1557     case (BinOp Env B e1 E1 e2 A binop B')
  1567     have B': "B \<subseteq> B'" .
  1558     have B': "B \<subseteq> B'" .
  1568     obtain E1' where E1': "Env\<turnstile> B' \<guillemotright>\<langle>e1\<rangle>\<guillemotright> E1'"
  1559     obtain E1' where E1': "Env\<turnstile> B' \<guillemotright>\<langle>e1\<rangle>\<guillemotright> E1'"
  1569     proof -
  1560     proof -
  1570       have "PROP ?Hyp Env B \<langle>e1\<rangle>" by (rule BinOp.hyps)
  1561       have "PROP ?Hyp Env B \<langle>e1\<rangle>" by (rule BinOp.hyps)
  1571       with B'  
  1562       with B'  
  1591     have B': "B \<subseteq> B'" .
  1582     have B': "B \<subseteq> B'" .
  1592     with Super.hyps have "This \<in> B' "
  1583     with Super.hyps have "This \<in> B' "
  1593       by auto
  1584       by auto
  1594     thus ?case by (iprover intro: da.Super)
  1585     thus ?case by (iprover intro: da.Super)
  1595   next
  1586   next
  1596     case (AccLVar A B Env vn B')
  1587     case (AccLVar vn B A Env B')
  1597     have "vn \<in> B" .
  1588     have "vn \<in> B" .
  1598     moreover
  1589     moreover
  1599     have "B \<subseteq> B'" .
  1590     have "B \<subseteq> B'" .
  1600     ultimately have "vn \<in> B'" by auto
  1591     ultimately have "vn \<in> B'" by auto
  1601     thus ?case by (iprover intro: da.AccLVar)
  1592     thus ?case by (iprover intro: da.AccLVar)
  1602   next
  1593   next
  1603     case Acc thus ?case by (iprover intro: da.Acc)
  1594     case Acc thus ?case by (iprover intro: da.Acc)
  1604   next 
  1595   next 
  1605     case (AssLVar A B E Env e vn B')
  1596     case (AssLVar Env B e E A vn B')
  1606     have B': "B \<subseteq> B'" .
  1597     have B': "B \<subseteq> B'" .
  1607     then obtain E' where "Env\<turnstile> B' \<guillemotright>\<langle>e\<rangle>\<guillemotright> E'"
  1598     then obtain E' where "Env\<turnstile> B' \<guillemotright>\<langle>e\<rangle>\<guillemotright> E'"
  1608       by (rule AssLVar.hyps [elim_format]) iprover
  1599       by (rule AssLVar.hyps [elim_format]) iprover
  1609     then obtain A' where  
  1600     then obtain A' where  
  1610       "Env\<turnstile> B' \<guillemotright>\<langle>LVar vn:=e\<rangle>\<guillemotright> A'"
  1601       "Env\<turnstile> B' \<guillemotright>\<langle>LVar vn:=e\<rangle>\<guillemotright> A'"
  1611       by (iprover intro: da.AssLVar)
  1602       by (iprover intro: da.AssLVar)
  1612     thus ?case ..
  1603     thus ?case ..
  1613   next
  1604   next
  1614     case (Ass A B Env V e v B') 
  1605     case (Ass v Env B V e A B') 
  1615     have B': "B \<subseteq> B'" .
  1606     have B': "B \<subseteq> B'" .
  1616     have "\<forall>vn. v \<noteq> LVar vn".
  1607     have "\<forall>vn. v \<noteq> LVar vn".
  1617     moreover
  1608     moreover
  1618     obtain V' where V': "Env\<turnstile> B' \<guillemotright>\<langle>v\<rangle>\<guillemotright> V'"
  1609     obtain V' where V': "Env\<turnstile> B' \<guillemotright>\<langle>v\<rangle>\<guillemotright> V'"
  1619     proof -
  1610     proof -
  1635     ultimately
  1626     ultimately
  1636     have "Env\<turnstile> B' \<guillemotright>\<langle>v := e\<rangle>\<guillemotright> A'"
  1627     have "Env\<turnstile> B' \<guillemotright>\<langle>v := e\<rangle>\<guillemotright> A'"
  1637       by (iprover intro: da.Ass)
  1628       by (iprover intro: da.Ass)
  1638     thus ?case ..
  1629     thus ?case ..
  1639   next
  1630   next
  1640     case (CondBool A B C E1 E2 Env c e1 e2 B')
  1631     case (CondBool Env c e1 e2 B C E1 E2 A B')
  1641     have B': "B \<subseteq> B'" .
  1632     have B': "B \<subseteq> B'" .
  1642     have "Env\<turnstile>(c ? e1 : e2)\<Colon>-(PrimT Boolean)" .
  1633     have "Env\<turnstile>(c ? e1 : e2)\<Colon>-(PrimT Boolean)" .
  1643     moreover obtain C' where C': "Env\<turnstile> B' \<guillemotright>\<langle>c\<rangle>\<guillemotright> C'"
  1634     moreover obtain C' where C': "Env\<turnstile> B' \<guillemotright>\<langle>c\<rangle>\<guillemotright> C'"
  1644     proof -
  1635     proof -
  1645       have "PROP ?Hyp Env B \<langle>c\<rangle>" by (rule CondBool.hyps)
  1636       have "PROP ?Hyp Env B \<langle>c\<rangle>" by (rule CondBool.hyps)
  1671     ultimately 
  1662     ultimately 
  1672     obtain A' where "Env\<turnstile> B' \<guillemotright>\<langle>c ? e1 : e2\<rangle>\<guillemotright> A'"
  1663     obtain A' where "Env\<turnstile> B' \<guillemotright>\<langle>c ? e1 : e2\<rangle>\<guillemotright> A'"
  1673       by (iprover intro: da.CondBool)
  1664       by (iprover intro: da.CondBool)
  1674     thus ?case ..
  1665     thus ?case ..
  1675   next
  1666   next
  1676     case (Cond A B C E1 E2 Env c e1 e2 B')
  1667     case (Cond Env c e1 e2 B C E1 E2 A B')
  1677     have B': "B \<subseteq> B'" .
  1668     have B': "B \<subseteq> B'" .
  1678     have "\<not> Env\<turnstile>(c ? e1 : e2)\<Colon>-(PrimT Boolean)" .
  1669     have "\<not> Env\<turnstile>(c ? e1 : e2)\<Colon>-(PrimT Boolean)" .
  1679     moreover obtain C' where C': "Env\<turnstile> B' \<guillemotright>\<langle>c\<rangle>\<guillemotright> C'"
  1670     moreover obtain C' where C': "Env\<turnstile> B' \<guillemotright>\<langle>c\<rangle>\<guillemotright> C'"
  1680     proof -
  1671     proof -
  1681       have "PROP ?Hyp Env B \<langle>c\<rangle>" by (rule Cond.hyps)
  1672       have "PROP ?Hyp Env B \<langle>c\<rangle>" by (rule Cond.hyps)
  1707     ultimately 
  1698     ultimately 
  1708     obtain A' where "Env\<turnstile> B' \<guillemotright>\<langle>c ? e1 : e2\<rangle>\<guillemotright> A'"
  1699     obtain A' where "Env\<turnstile> B' \<guillemotright>\<langle>c ? e1 : e2\<rangle>\<guillemotright> A'"
  1709       by (iprover intro: da.Cond)
  1700       by (iprover intro: da.Cond)
  1710     thus ?case ..
  1701     thus ?case ..
  1711   next
  1702   next
  1712     case (Call A B E Env accC args e mn mode pTs statT B')
  1703     case (Call Env B e E args A accC statT mode mn pTs B')
  1713     have B': "B \<subseteq> B'" .
  1704     have B': "B \<subseteq> B'" .
  1714     obtain E' where E': "Env\<turnstile> B' \<guillemotright>\<langle>e\<rangle>\<guillemotright> E'"
  1705     obtain E' where E': "Env\<turnstile> B' \<guillemotright>\<langle>e\<rangle>\<guillemotright> E'"
  1715     proof -
  1706     proof -
  1716       have "PROP ?Hyp Env B \<langle>e\<rangle>" by (rule Call.hyps)
  1707       have "PROP ?Hyp Env B \<langle>e\<rangle>" by (rule Call.hyps)
  1717       with B'  
  1708       with B'  
  1733       by (iprover intro: da.Call)
  1724       by (iprover intro: da.Call)
  1734     thus ?case ..
  1725     thus ?case ..
  1735   next
  1726   next
  1736     case Methd thus ?case by (iprover intro: da.Methd)
  1727     case Methd thus ?case by (iprover intro: da.Methd)
  1737   next
  1728   next
  1738     case (Body A B C D Env c B')  
  1729     case (Body Env B c C A D B')  
  1739     have B': "B \<subseteq> B'" .
  1730     have B': "B \<subseteq> B'" .
  1740     obtain C' where C': "Env\<turnstile> B' \<guillemotright>\<langle>c\<rangle>\<guillemotright> C'" and nrm_C': "nrm C \<subseteq> nrm C'"
  1731     obtain C' where C': "Env\<turnstile> B' \<guillemotright>\<langle>c\<rangle>\<guillemotright> C'" and nrm_C': "nrm C \<subseteq> nrm C'"
  1741     proof -
  1732     proof -
  1742       have "Env\<turnstile> B \<guillemotright>\<langle>c\<rangle>\<guillemotright> C" by (rule Body.hyps)
  1733       have "Env\<turnstile> B \<guillemotright>\<langle>c\<rangle>\<guillemotright> C" by (rule Body.hyps)
  1743       moreover note B'
  1734       moreover note B'
  1761   next
  1752   next
  1762     case LVar thus ?case by (iprover intro: da.LVar)
  1753     case LVar thus ?case by (iprover intro: da.LVar)
  1763   next
  1754   next
  1764     case FVar thus ?case by (iprover intro: da.FVar)
  1755     case FVar thus ?case by (iprover intro: da.FVar)
  1765   next
  1756   next
  1766     case (AVar A B E1 Env e1 e2 B')
  1757     case (AVar Env B e1 E1 e2 A B')
  1767     have B': "B \<subseteq> B'" .
  1758     have B': "B \<subseteq> B'" .
  1768     obtain E1' where E1': "Env\<turnstile> B' \<guillemotright>\<langle>e1\<rangle>\<guillemotright> E1'"
  1759     obtain E1' where E1': "Env\<turnstile> B' \<guillemotright>\<langle>e1\<rangle>\<guillemotright> E1'"
  1769     proof -
  1760     proof -
  1770       have "PROP ?Hyp Env B \<langle>e1\<rangle>" by (rule AVar.hyps)
  1761       have "PROP ?Hyp Env B \<langle>e1\<rangle>" by (rule AVar.hyps)
  1771       with B'  
  1762       with B'  
  1787       by (iprover intro: da.AVar)
  1778       by (iprover intro: da.AVar)
  1788     thus ?case ..
  1779     thus ?case ..
  1789   next
  1780   next
  1790     case Nil thus ?case by (iprover intro: da.Nil)
  1781     case Nil thus ?case by (iprover intro: da.Nil)
  1791   next
  1782   next
  1792     case (Cons A B E Env e es B')
  1783     case (Cons Env B e E es A B')
  1793     have B': "B \<subseteq> B'" .
  1784     have B': "B \<subseteq> B'" .
  1794     obtain E' where E': "Env\<turnstile> B' \<guillemotright>\<langle>e\<rangle>\<guillemotright> E'"
  1785     obtain E' where E': "Env\<turnstile> B' \<guillemotright>\<langle>e\<rangle>\<guillemotright> E'"
  1795     proof -
  1786     proof -
  1796       have "PROP ?Hyp Env B \<langle>e\<rangle>" by (rule Cons.hyps)
  1787       have "PROP ?Hyp Env B \<langle>e\<rangle>" by (rule Cons.hyps)
  1797       with B'  
  1788       with B'