src/ZF/Coind/MT.ML
author clasohm
Tue Feb 06 12:27:17 1996 +0100 (1996-02-06)
changeset 1478 2b8c2a7547ab
parent 1461 6bcb44e4d6e5
child 1740 b50755328aad
permissions -rw-r--r--
expanded tabs
clasohm@1461
     1
(*  Title:      ZF/Coind/MT.ML
lcp@915
     2
    ID:         $Id$
clasohm@1461
     3
    Author:     Jacob Frost, Cambridge University Computer Laboratory
lcp@915
     4
    Copyright   1995  University of Cambridge
lcp@915
     5
*)
lcp@915
     6
lcp@915
     7
open MT;
lcp@915
     8
lcp@915
     9
       
lcp@915
    10
(* ############################################################ *)
lcp@915
    11
(* The Consistency theorem                                      *)
lcp@915
    12
(* ############################################################ *)
lcp@915
    13
lcp@915
    14
val prems = goal MT.thy 
clasohm@1461
    15
  "[| c:Const; hastyenv(ve,te);<te,e_const(c),t>:ElabRel |] ==>         \
lcp@915
    16
\  <v_const(c), t> : HasTyRel";
lcp@915
    17
by (cut_facts_tac prems 1);
lcp@915
    18
by (fast_tac htr_cs 1);
lcp@915
    19
qed "consistency_const";
lcp@915
    20
lcp@915
    21
lcp@915
    22
val prems = goalw  MT.thy [hastyenv_def]
clasohm@1461
    23
  "[| x:ve_dom(ve); hastyenv(ve,te); <te,e_var(x),t>:ElabRel |] ==>     \
lcp@915
    24
\  <ve_app(ve,x),t>:HasTyRel";
lcp@915
    25
by (cut_facts_tac prems 1);
lcp@915
    26
by (fast_tac static_cs 1);
lcp@915
    27
qed "consistency_var";
lcp@915
    28
lcp@915
    29
lcp@915
    30
val prems = goalw MT.thy [hastyenv_def]
clasohm@1461
    31
  "[| ve:ValEnv; x:ExVar; e:Exp; hastyenv(ve,te);       \
clasohm@1461
    32
\     <te,e_fn(x,e),t>:ElabRel  \
clasohm@1461
    33
\  |] ==>       \
lcp@915
    34
\  <v_clos(x, e, ve), t> : HasTyRel";
lcp@915
    35
by (cut_facts_tac prems 1);
lcp@915
    36
by (best_tac htr_cs 1);
lcp@915
    37
qed "consistency_fn";
lcp@915
    38
lcp@915
    39
val MT_cs = ZF_cs 
lcp@915
    40
  addIs (Ty.intrs@TyEnv.intrs@Val_ValEnv.intrs)
lcp@915
    41
  addDs [te_owrE,(ElabRel.dom_subset RS subsetD)];
lcp@915
    42
lcp@915
    43
val MT_ss = 
lcp@915
    44
  ZF_ss addsimps 
lcp@915
    45
  [ve_dom_owr,te_dom_owr,ve_app_owr1,ve_app_owr2,te_app_owr1,te_app_owr2];
lcp@915
    46
lcp@915
    47
val clean_tac = 
lcp@915
    48
  REPEAT_FIRST (fn i => 
lcp@915
    49
    (eq_assume_tac i) ORELSE 
lcp@915
    50
    (match_tac (Ty.intrs@TyEnv.intrs@Val_ValEnv.intrs) i) ORELSE
lcp@915
    51
    (ematch_tac [te_owrE] i));
lcp@915
    52
lcp@915
    53
val prems = goalw MT.thy [hastyenv_def]
clasohm@1461
    54
  "[| ve:ValEnv; x:ExVar; e:Exp; f:ExVar; cl:Val;               \
clasohm@1461
    55
\     v_clos(x,e,ve_owr(ve,f,cl)) = cl;                         \ 
clasohm@1461
    56
\     hastyenv(ve,te); <te,e_fix(f,x,e),t>:ElabRel |] ==>       \
lcp@915
    57
\  <cl,t>:HasTyRel";
lcp@915
    58
by (cut_facts_tac prems 1);
lcp@915
    59
by (etac elab_fixE 1);
lcp@915
    60
by (safe_tac ZF_cs);
lcp@915
    61
by (EVERY [forward_tac [subst] 1,atac 2,rtac htr_closCI 1]);
lcp@915
    62
by clean_tac;
lcp@915
    63
by (rtac ve_owrI 1);
lcp@915
    64
by clean_tac;
lcp@915
    65
by (dtac (ElabRel.dom_subset RS subsetD) 1);
lcp@915
    66
by ( eres_inst_tac 
lcp@915
    67
     [("Q","te_owr(te,f,t_fun(t1,t2)):TyEnv")] 
lcp@915
    68
     (SigmaD1 RS te_owrE) 1
lcp@915
    69
   );
lcp@915
    70
by (assume_tac 1);
lcp@915
    71
by (rtac ElabRel.elab_fnI 1);
lcp@915
    72
by clean_tac;
lcp@915
    73
by (asm_simp_tac MT_ss 1);
lcp@915
    74
by (rtac (ve_dom_owr RS ssubst) 1);
lcp@915
    75
by (assume_tac 1);
lcp@915
    76
by (etac subst 1);
lcp@915
    77
by (rtac v_closNE 1);
lcp@915
    78
by (asm_simp_tac ZF_ss 1);
lcp@915
    79
lcp@915
    80
by (rtac PowI 1);
lcp@915
    81
by (rtac (ve_dom_owr RS ssubst) 1);
lcp@915
    82
by (assume_tac 1);
lcp@915
    83
by (etac subst 1);
lcp@915
    84
by (rtac v_closNE 1);
lcp@915
    85
by (rtac subsetI 1);
lcp@915
    86
by (etac RepFunE 1);
lcp@915
    87
by (dtac lem_fix 1);
lcp@915
    88
by (etac UnE' 1);
lcp@915
    89
by (rtac UnI1 1);
lcp@915
    90
by (etac singletonE 1);
lcp@915
    91
by (asm_full_simp_tac MT_ss 1);
lcp@915
    92
by (rtac UnI2 1);
lcp@915
    93
by (etac notsingletonE 1);
lcp@915
    94
by (dtac not_sym 1);
lcp@915
    95
by (asm_full_simp_tac MT_ss 1);
lcp@915
    96
qed "consistency_fix";
lcp@915
    97
lcp@915
    98
lcp@915
    99
val prems = goal MT.thy
clasohm@1461
   100
  " [| ve:ValEnv; e1:Exp; e2:Exp; c1:Const; c2:Const;   \
clasohm@1461
   101
\     <ve,e1,v_const(c1)>:EvalRel;                      \
clasohm@1461
   102
\     ALL t te.                                         \
lcp@915
   103
\       hastyenv(ve,te) --> <te,e1,t>:ElabRel --> <v_const(c1),t>:HasTyRel; \
clasohm@1461
   104
\     <ve, e2, v_const(c2)> : EvalRel;                  \
clasohm@1461
   105
\     ALL t te.                                         \
lcp@915
   106
\       hastyenv(ve,te) --> <te,e2,t>:ElabRel --> <v_const(c2),t>:HasTyRel; \
clasohm@1461
   107
\     hastyenv(ve, te);                                 \
clasohm@1461
   108
\     <te,e_app(e1,e2),t>:ElabRel |] ==>                \
lcp@915
   109
\   <v_const(c_app(c1, c2)),t>:HasTyRel";
lcp@915
   110
by (cut_facts_tac prems 1);
lcp@915
   111
by (etac elab_appE 1);
lcp@915
   112
by (fast_tac ((mk_htr_cs ZF_cs) addSIs [c_appI] addIs [isof_app]) 1);
lcp@915
   113
qed "consistency_app1";
lcp@915
   114
lcp@915
   115
val prems = goal MT.thy
clasohm@1461
   116
  " [| ve:ValEnv; vem:ValEnv; e1:Exp; e2:Exp; em:Exp; xm:ExVar; v:Val;  \
clasohm@1461
   117
\      <ve,e1,v_clos(xm,em,vem)>:EvalRel;       \
clasohm@1461
   118
\      ALL t te.                                \
clasohm@1461
   119
\        hastyenv(ve,te) -->                    \
clasohm@1461
   120
\        <te,e1,t>:ElabRel -->                  \
clasohm@1461
   121
\        <v_clos(xm,em,vem),t>:HasTyRel;        \
clasohm@1461
   122
\      <ve,e2,v2>:EvalRel;                      \
clasohm@1461
   123
\      ALL t te.                                \
clasohm@1461
   124
\        hastyenv(ve,te) -->                    \
clasohm@1461
   125
\        <te,e2,t>:ElabRel -->                  \
clasohm@1461
   126
\        <v2,t>:HasTyRel;                       \
clasohm@1461
   127
\      <ve_owr(vem,xm,v2),em,v>:EvalRel;        \
clasohm@1461
   128
\      ALL t te.                                \
clasohm@1461
   129
\        hastyenv(ve_owr(vem,xm,v2),te) -->     \
clasohm@1461
   130
\        <te,em,t>:ElabRel -->                  \
clasohm@1461
   131
\        <v,t>:HasTyRel;                        \
clasohm@1461
   132
\      hastyenv(ve,te); <te,e_app(e1,e2),t>:ElabRel |] ==>      \
lcp@915
   133
\   <v,t>:HasTyRel ";
lcp@915
   134
by (cut_facts_tac prems 1);
lcp@915
   135
by (etac elab_appE 1);
lcp@915
   136
by (dtac (spec RS spec RS mp RS mp) 1);
lcp@915
   137
by (assume_tac 1);
lcp@915
   138
by (assume_tac 1);
lcp@915
   139
by (dtac (spec RS spec RS mp RS mp) 1);
lcp@915
   140
by (assume_tac 1);
lcp@915
   141
by (assume_tac 1);
lcp@915
   142
by (etac htr_closE 1);
lcp@915
   143
by (etac elab_fnE 1);
lcp@915
   144
by (rewrite_tac Ty.con_defs);
lcp@915
   145
by (safe_tac sum_cs);
lcp@915
   146
by (dtac (spec RS spec RS mp RS mp) 1);
lcp@915
   147
by (assume_tac 3);
lcp@915
   148
by (assume_tac 2);
lcp@915
   149
by (rtac hastyenv_owr 1);
lcp@915
   150
by (assume_tac 1);
lcp@915
   151
by (assume_tac 1);
lcp@915
   152
by (assume_tac 2);
lcp@915
   153
by (rewrite_tac [hastyenv_def]);
lcp@915
   154
by (fast_tac ZF_cs 1);
lcp@915
   155
qed "consistency_app2";
lcp@915
   156
lcp@915
   157
fun mt_cases_tac t = ((rtac t 1) THEN (TRYALL assume_tac)); 
lcp@915
   158
lcp@915
   159
val prems = goal MT.thy 
clasohm@1461
   160
  "<ve,e,v>:EvalRel ==>         \
lcp@915
   161
\  (ALL t te. hastyenv(ve,te) --> <te,e,t>:ElabRel --> <v,t>:HasTyRel)";
lcp@915
   162
by (rtac (EvalRel.mutual_induct RS spec RS spec RS spec RS impE) 1);
lcp@915
   163
by (resolve_tac prems 7 THEN assume_tac 7);
lcp@915
   164
by (safe_tac ZF_cs);
lcp@915
   165
by (mt_cases_tac consistency_const);
lcp@915
   166
by (mt_cases_tac consistency_var);
lcp@915
   167
by (mt_cases_tac consistency_fn);
lcp@915
   168
by (mt_cases_tac consistency_fix);
lcp@915
   169
by (mt_cases_tac consistency_app1);
lcp@915
   170
by (mt_cases_tac consistency_app2);
lcp@915
   171
qed "consistency";
lcp@915
   172
lcp@915
   173
lcp@915
   174
val prems = goal MT.thy
clasohm@1461
   175
  "[| ve:ValEnv; te:TyEnv;              \
clasohm@1461
   176
\     isofenv(ve,te);                   \
clasohm@1461
   177
\     <ve,e,v_const(c)>:EvalRel;        \
clasohm@1461
   178
\     <te,e,t>:ElabRel                  \
clasohm@1461
   179
\  |] ==>                               \
lcp@915
   180
\  isof(c,t)";
lcp@915
   181
by (cut_facts_tac prems 1);
lcp@915
   182
by (rtac (htr_constE) 1);
lcp@915
   183
by (dtac consistency 1);
lcp@915
   184
by (fast_tac (ZF_cs addSIs [basic_consistency_lem]) 1);
lcp@915
   185
by (assume_tac 1);
lcp@915
   186
qed "basic_consistency";
lcp@915
   187
lcp@915
   188
lcp@915
   189
lcp@915
   190