src/ZF/Coind/MT.ML
author paulson
Tue, 19 Jan 1999 11:18:11 +0100
changeset 6141 a6922171b396
parent 6046 2c8a8be36c94
child 6154 6a00a5baef2b
permissions -rw-r--r--
removal of the (thm list) argument of mk_cases
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 915
diff changeset
     1
(*  Title:      ZF/Coind/MT.ML
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
     2
    ID:         $Id$
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 915
diff changeset
     3
    Author:     Jacob Frost, Cambridge University Computer Laboratory
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
     4
    Copyright   1995  University of Cambridge
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
     5
*)
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
     6
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
     7
(* ############################################################ *)
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
     8
(* The Consistency theorem                                      *)
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
     9
(* ############################################################ *)
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    10
5147
825877190618 More tidying and removal of "\!\!... from Goal commands
paulson
parents: 5068
diff changeset
    11
Goal "[| c:Const; hastyenv(ve,te);<te,e_const(c),t>:ElabRel |] ==>         \
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 2034
diff changeset
    12
\       <v_const(c), t> : HasTyRel";
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 2034
diff changeset
    13
by (Fast_tac 1);
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    14
qed "consistency_const";
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    15
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    16
5068
fb28eaa07e01 isatool fixgoal;
wenzelm
parents: 4477
diff changeset
    17
Goalw [hastyenv_def]
5147
825877190618 More tidying and removal of "\!\!... from Goal commands
paulson
parents: 5068
diff changeset
    18
  "[| x:ve_dom(ve); hastyenv(ve,te); <te,e_var(x),t>:ElabRel |] ==>     \
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    19
\  <ve_app(ve,x),t>:HasTyRel";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 2034
diff changeset
    20
by (Fast_tac 1);
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    21
qed "consistency_var";
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    22
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    23
5068
fb28eaa07e01 isatool fixgoal;
wenzelm
parents: 4477
diff changeset
    24
Goalw [hastyenv_def]
5147
825877190618 More tidying and removal of "\!\!... from Goal commands
paulson
parents: 5068
diff changeset
    25
  "[| ve:ValEnv; x:ExVar; e:Exp; hastyenv(ve,te);       \
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 2034
diff changeset
    26
\          <te,e_fn(x,e),t>:ElabRel  \
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 2034
diff changeset
    27
\       |] ==> <v_clos(x, e, ve), t> : HasTyRel";
6046
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
    28
by (Blast_tac 1);
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    29
qed "consistency_fn";
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    30
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 2034
diff changeset
    31
AddIs (Ty.intrs@TyEnv.intrs@Val_ValEnv.intrs);
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 2034
diff changeset
    32
AddDs [te_owrE,(ElabRel.dom_subset RS subsetD)];
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    33
6046
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
    34
Addsimps [ve_dom_owr, ve_app_owr1, ve_app_owr2, 
2493
bdeb5024353a Removal of sum_cs and eq_cs
paulson
parents: 2469
diff changeset
    35
          te_app_owr1, te_app_owr2];
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    36
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    37
val clean_tac = 
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    38
  REPEAT_FIRST (fn i => 
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    39
    (eq_assume_tac i) ORELSE 
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    40
    (match_tac (Ty.intrs@TyEnv.intrs@Val_ValEnv.intrs) i) ORELSE
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    41
    (ematch_tac [te_owrE] i));
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    42
6046
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
    43
Goalw [hastyenv_def]
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 915
diff changeset
    44
  "[| ve:ValEnv; x:ExVar; e:Exp; f:ExVar; cl:Val;               \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 915
diff changeset
    45
\     v_clos(x,e,ve_owr(ve,f,cl)) = cl;                         \ 
6bcb44e4d6e5 expanded tabs
clasohm
parents: 915
diff changeset
    46
\     hastyenv(ve,te); <te,e_fix(f,x,e),t>:ElabRel |] ==>       \
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    47
\  <cl,t>:HasTyRel";
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    48
by (etac elab_fixE 1);
4152
451104c223e2 Ran expandshort, especially to introduce Safe_tac
paulson
parents: 4091
diff changeset
    49
by Safe_tac;
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    50
by (EVERY [forward_tac [subst] 1,atac 2,rtac htr_closCI 1]);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    51
by clean_tac;
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    52
by (rtac ve_owrI 1);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    53
by clean_tac;
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    54
by (dtac (ElabRel.dom_subset RS subsetD) 1);
2885
8d229dc0cfe2 Two extra commands shorten the proof time by 800 seconds...
paulson
parents: 2493
diff changeset
    55
by (eres_inst_tac [("Q","te_owr(te,f,t_fun(t1,t2)):TyEnv")] 
8d229dc0cfe2 Two extra commands shorten the proof time by 800 seconds...
paulson
parents: 2493
diff changeset
    56
    (SigmaD1 RS te_owrE) 1);
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    57
by (assume_tac 1);
6141
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
    58
by (rtac ElabRel.fnI 1);
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    59
by clean_tac;
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 2034
diff changeset
    60
by (Asm_simp_tac 1);
2034
5079fdf938dd Ran expandshort; used stac instead of ssubst
paulson
parents: 1740
diff changeset
    61
by (stac ve_dom_owr 1);
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    62
by (assume_tac 1);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    63
by (etac subst 1);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    64
by (rtac v_closNE 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 2034
diff changeset
    65
by (Asm_simp_tac 1);
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    66
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    67
by (rtac PowI 1);
2034
5079fdf938dd Ran expandshort; used stac instead of ssubst
paulson
parents: 1740
diff changeset
    68
by (stac ve_dom_owr 1);
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    69
by (assume_tac 1);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    70
by (etac subst 1);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    71
by (rtac v_closNE 1);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    72
by (rtac subsetI 1);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    73
by (etac RepFunE 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 2034
diff changeset
    74
by (excluded_middle_tac "f=y" 1);
2885
8d229dc0cfe2 Two extra commands shorten the proof time by 800 seconds...
paulson
parents: 2493
diff changeset
    75
by (rtac UnI1 2);
8d229dc0cfe2 Two extra commands shorten the proof time by 800 seconds...
paulson
parents: 2493
diff changeset
    76
by (rtac UnI2 1);
4477
b3e5857d8d99 New Auto_tac (by Oheimb), and new syntax (without parens), and expandshort
paulson
parents: 4152
diff changeset
    77
by Auto_tac;
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    78
qed "consistency_fix";
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    79
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    80
6141
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
    81
Goal "[| ve:ValEnv; e1:Exp; e2:Exp; c1:Const; c2:Const;   \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 915
diff changeset
    82
\     <ve,e1,v_const(c1)>:EvalRel;                      \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 915
diff changeset
    83
\     ALL t te.                                         \
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    84
\       hastyenv(ve,te) --> <te,e1,t>:ElabRel --> <v_const(c1),t>:HasTyRel; \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 915
diff changeset
    85
\     <ve, e2, v_const(c2)> : EvalRel;                  \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 915
diff changeset
    86
\     ALL t te.                                         \
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    87
\       hastyenv(ve,te) --> <te,e2,t>:ElabRel --> <v_const(c2),t>:HasTyRel; \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 915
diff changeset
    88
\     hastyenv(ve, te);                                 \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 915
diff changeset
    89
\     <te,e_app(e1,e2),t>:ElabRel |] ==>                \
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    90
\   <v_const(c_app(c1, c2)),t>:HasTyRel";
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    91
by (etac elab_appE 1);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    92
by (fast_tac ((mk_htr_cs ZF_cs) addSIs [c_appI] addIs [isof_app]) 1);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    93
qed "consistency_app1";
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    94
6141
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
    95
Goal "[| ve:ValEnv; vem:ValEnv; e1:Exp; e2:Exp; em:Exp; xm:ExVar; v:Val;  \
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
    96
\        <ve,e1,v_clos(xm,em,vem)>:EvalRel;       \
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
    97
\        ALL t te.                                \
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
    98
\          hastyenv(ve,te) -->                    \
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
    99
\          <te,e1,t>:ElabRel -->                  \
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   100
\          <v_clos(xm,em,vem),t>:HasTyRel;        \
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   101
\        <ve,e2,v2>:EvalRel;                      \
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   102
\        ALL t te.                                \
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   103
\          hastyenv(ve,te) -->                    \
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   104
\          <te,e2,t>:ElabRel -->                  \
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   105
\          <v2,t>:HasTyRel;                       \
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   106
\        <ve_owr(vem,xm,v2),em,v>:EvalRel;        \
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   107
\        ALL t te.                                \
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   108
\          hastyenv(ve_owr(vem,xm,v2),te) -->     \
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   109
\          <te,em,t>:ElabRel -->                  \
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   110
\          <v,t>:HasTyRel;                        \
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   111
\        hastyenv(ve,te); <te,e_app(e1,e2),t>:ElabRel |] ==>      \
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   112
\     <v,t>:HasTyRel ";
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   113
by (etac elab_appE 1);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   114
by (dtac (spec RS spec RS mp RS mp) 1);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   115
by (assume_tac 1);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   116
by (assume_tac 1);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   117
by (dtac (spec RS spec RS mp RS mp) 1);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   118
by (assume_tac 1);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   119
by (assume_tac 1);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   120
by (etac htr_closE 1);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   121
by (etac elab_fnE 1);
6141
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   122
by (Full_simp_tac 1);
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   123
by (Clarify_tac 1);
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   124
by (dtac (spec RS spec RS mp RS mp) 1);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   125
by (assume_tac 3);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   126
by (assume_tac 2);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   127
by (rtac hastyenv_owr 1);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   128
by (assume_tac 1);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   129
by (assume_tac 1);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   130
by (assume_tac 2);
6141
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   131
by (asm_simp_tac (simpset() addsimps [hastyenv_def]) 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 2034
diff changeset
   132
by (Fast_tac 1);
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   133
qed "consistency_app2";
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   134
5147
825877190618 More tidying and removal of "\!\!... from Goal commands
paulson
parents: 5068
diff changeset
   135
Goal "<ve,e,v>:EvalRel ==>         \
1740
b50755328aad Updated for new form of induction rules
paulson
parents: 1461
diff changeset
   136
\       (ALL t te. hastyenv(ve,te) --> <te,e,t>:ElabRel --> <v,t>:HasTyRel)";
b50755328aad Updated for new form of induction rules
paulson
parents: 1461
diff changeset
   137
by (etac EvalRel.induct 1);
6141
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   138
by (blast_tac (claset() addIs [consistency_app2]) 6);
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   139
by (ALLGOALS (asm_simp_tac (simpset() addsimps [consistency_const, consistency_var, consistency_fn, consistency_fix, consistency_app1])));
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   140
qed "consistency";
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   141
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   142
6141
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   143
Goal "[| ve:ValEnv; te:TyEnv;              \
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   144
\        isofenv(ve,te);                   \
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   145
\        <ve,e,v_const(c)>:EvalRel;        \
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   146
\        <te,e,t>:ElabRel                  \
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   147
\     |] ==> isof(c,t)";
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   148
by (rtac htr_constE 1);
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   149
by (dtac consistency 1);
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 2885
diff changeset
   150
by (fast_tac (claset() addSIs [basic_consistency_lem]) 1);
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   151
by (assume_tac 1);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   152
qed "basic_consistency";