src/ZF/Coind/ECR.thy
changeset 46822 95f1e700b712
parent 45602 2a858377c3d2
child 57492 74bf65a1910a
equal deleted inserted replaced
46821:ff6b0c1087f2 46822:95f1e700b712
     8 (* The extended correspondence relation *)
     8 (* The extended correspondence relation *)
     9 
     9 
    10 consts
    10 consts
    11   HasTyRel :: i
    11   HasTyRel :: i
    12 coinductive
    12 coinductive
    13   domains "HasTyRel" <= "Val * Ty"
    13   domains "HasTyRel" \<subseteq> "Val * Ty"
    14   intros
    14   intros
    15     htr_constI [intro!]:
    15     htr_constI [intro!]:
    16       "[| c \<in> Const; t \<in> Ty; isof(c,t) |] ==> <v_const(c),t> \<in> HasTyRel"
    16       "[| c \<in> Const; t \<in> Ty; isof(c,t) |] ==> <v_const(c),t> \<in> HasTyRel"
    17     htr_closI [intro]:
    17     htr_closI [intro]:
    18       "[| x \<in> ExVar; e \<in> Exp; t \<in> Ty; ve \<in> ValEnv; te \<in> TyEnv; 
    18       "[| x \<in> ExVar; e \<in> Exp; t \<in> Ty; ve \<in> ValEnv; te \<in> TyEnv; 
    35 
    35 
    36 lemma htr_closCI [intro]:
    36 lemma htr_closCI [intro]:
    37      "[| x \<in> ExVar; e \<in> Exp; t \<in> Ty; ve \<in> ValEnv; te \<in> TyEnv;   
    37      "[| x \<in> ExVar; e \<in> Exp; t \<in> Ty; ve \<in> ValEnv; te \<in> TyEnv;   
    38          <te, e_fn(x, e), t> \<in> ElabRel; ve_dom(ve) = te_dom(te);  
    38          <te, e_fn(x, e), t> \<in> ElabRel; ve_dom(ve) = te_dom(te);  
    39          {<ve_app(ve,y),te_app(te,y)>.y \<in> ve_dom(ve)} \<in>
    39          {<ve_app(ve,y),te_app(te,y)>.y \<in> ve_dom(ve)} \<in>
    40            Pow({<v_clos(x,e,ve),t>} Un HasTyRel) |]     
    40            Pow({<v_clos(x,e,ve),t>} \<union> HasTyRel) |]     
    41       ==> <v_clos(x, e, ve),t> \<in> HasTyRel"
    41       ==> <v_clos(x, e, ve),t> \<in> HasTyRel"
    42 apply (rule singletonI [THEN HasTyRel.coinduct], auto)
    42 apply (rule singletonI [THEN HasTyRel.coinduct], auto)
    43 done
    43 done
    44 
    44 
    45 (* Specialised elimination rules *)
    45 (* Specialised elimination rules *)
   111 
   111 
   112 lemma consistency_app1:
   112 lemma consistency_app1:
   113  "[| ve \<in> ValEnv; e1 \<in> Exp; e2 \<in> Exp; c1 \<in> Const; c2 \<in> Const;    
   113  "[| ve \<in> ValEnv; e1 \<in> Exp; e2 \<in> Exp; c1 \<in> Const; c2 \<in> Const;    
   114      <ve,e1,v_const(c1)> \<in> EvalRel;                       
   114      <ve,e1,v_const(c1)> \<in> EvalRel;                       
   115      \<forall>t te.                                          
   115      \<forall>t te.                                          
   116        hastyenv(ve,te) --> <te,e1,t> \<in> ElabRel --> <v_const(c1),t> \<in> HasTyRel;
   116        hastyenv(ve,te) \<longrightarrow> <te,e1,t> \<in> ElabRel \<longrightarrow> <v_const(c1),t> \<in> HasTyRel;
   117      <ve, e2, v_const(c2)> \<in> EvalRel;                   
   117      <ve, e2, v_const(c2)> \<in> EvalRel;                   
   118      \<forall>t te.                                          
   118      \<forall>t te.                                          
   119        hastyenv(ve,te) --> <te,e2,t> \<in> ElabRel --> <v_const(c2),t> \<in> HasTyRel;
   119        hastyenv(ve,te) \<longrightarrow> <te,e2,t> \<in> ElabRel \<longrightarrow> <v_const(c2),t> \<in> HasTyRel;
   120      hastyenv(ve, te);                                  
   120      hastyenv(ve, te);                                  
   121      <te,e_app(e1,e2),t> \<in> ElabRel |] 
   121      <te,e_app(e1,e2),t> \<in> ElabRel |] 
   122   ==> <v_const(c_app(c1, c2)),t> \<in> HasTyRel"
   122   ==> <v_const(c_app(c1, c2)),t> \<in> HasTyRel"
   123 by (blast intro!: c_appI intro: isof_app)
   123 by (blast intro!: c_appI intro: isof_app)
   124 
   124 
   125 lemma consistency_app2:
   125 lemma consistency_app2:
   126  "[| ve \<in> ValEnv; vem \<in> ValEnv; e1 \<in> Exp; e2 \<in> Exp; em \<in> Exp; xm \<in> ExVar; 
   126  "[| ve \<in> ValEnv; vem \<in> ValEnv; e1 \<in> Exp; e2 \<in> Exp; em \<in> Exp; xm \<in> ExVar; 
   127      v \<in> Val;   
   127      v \<in> Val;   
   128      <ve,e1,v_clos(xm,em,vem)> \<in> EvalRel;        
   128      <ve,e1,v_clos(xm,em,vem)> \<in> EvalRel;        
   129      \<forall>t te. hastyenv(ve,te) -->                     
   129      \<forall>t te. hastyenv(ve,te) \<longrightarrow>                     
   130             <te,e1,t> \<in> ElabRel --> <v_clos(xm,em,vem),t> \<in> HasTyRel;         
   130             <te,e1,t> \<in> ElabRel \<longrightarrow> <v_clos(xm,em,vem),t> \<in> HasTyRel;         
   131      <ve,e2,v2> \<in> EvalRel;                       
   131      <ve,e2,v2> \<in> EvalRel;                       
   132      \<forall>t te. hastyenv(ve,te) --> <te,e2,t> \<in> ElabRel --> <v2,t> \<in> HasTyRel;
   132      \<forall>t te. hastyenv(ve,te) \<longrightarrow> <te,e2,t> \<in> ElabRel \<longrightarrow> <v2,t> \<in> HasTyRel;
   133      <ve_owr(vem,xm,v2),em,v> \<in> EvalRel;         
   133      <ve_owr(vem,xm,v2),em,v> \<in> EvalRel;         
   134      \<forall>t te. hastyenv(ve_owr(vem,xm,v2),te) -->      
   134      \<forall>t te. hastyenv(ve_owr(vem,xm,v2),te) \<longrightarrow>      
   135             <te,em,t> \<in> ElabRel --> <v,t> \<in> HasTyRel;
   135             <te,em,t> \<in> ElabRel \<longrightarrow> <v,t> \<in> HasTyRel;
   136      hastyenv(ve,te); <te,e_app(e1,e2),t> \<in> ElabRel |] 
   136      hastyenv(ve,te); <te,e_app(e1,e2),t> \<in> ElabRel |] 
   137    ==> <v,t> \<in> HasTyRel"
   137    ==> <v,t> \<in> HasTyRel"
   138 apply (erule elab_appE)
   138 apply (erule elab_appE)
   139 apply (drule spec [THEN spec, THEN mp, THEN mp], assumption+)
   139 apply (drule spec [THEN spec, THEN mp, THEN mp], assumption+)
   140 apply (drule spec [THEN spec, THEN mp, THEN mp], assumption+)
   140 apply (drule spec [THEN spec, THEN mp, THEN mp], assumption+)
   148 apply (simp add: hastyenv_def, blast+)
   148 apply (simp add: hastyenv_def, blast+)
   149 done
   149 done
   150 
   150 
   151 lemma consistency [rule_format]:
   151 lemma consistency [rule_format]:
   152    "<ve,e,v> \<in> EvalRel 
   152    "<ve,e,v> \<in> EvalRel 
   153     ==> (\<forall>t te. hastyenv(ve,te) --> <te,e,t> \<in> ElabRel --> <v,t> \<in> HasTyRel)"
   153     ==> (\<forall>t te. hastyenv(ve,te) \<longrightarrow> <te,e,t> \<in> ElabRel \<longrightarrow> <v,t> \<in> HasTyRel)"
   154 apply (erule EvalRel.induct)
   154 apply (erule EvalRel.induct)
   155 apply (simp_all add: consistency_const consistency_var consistency_fn 
   155 apply (simp_all add: consistency_const consistency_var consistency_fn 
   156                      consistency_fix consistency_app1)
   156                      consistency_fix consistency_app1)
   157 apply (blast intro: consistency_app2)
   157 apply (blast intro: consistency_app2)
   158 done
   158 done