src/ZF/Coind/MT.ML
author wenzelm
Sat, 27 Oct 2001 00:09:59 +0200
changeset 11963 a6608d44a46b
parent 11318 6536fb8c9fc6
permissions -rw-r--r--
impose hyps on initial goal configuration (prevents res_inst_tac problems);
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
11318
6536fb8c9fc6 X-symbols for ZF
paulson
parents: 7499
diff changeset
    11
Goal "[| c \\<in> Const; hastyenv(ve,te);<te,e_const(c),t>:ElabRel |] ==>         \
6536fb8c9fc6 X-symbols for ZF
paulson
parents: 7499
diff changeset
    12
\       <v_const(c), t> \\<in> HasTyRel";
2469
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]
11318
6536fb8c9fc6 X-symbols for ZF
paulson
parents: 7499
diff changeset
    18
  "[| x \\<in> 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]
11318
6536fb8c9fc6 X-symbols for ZF
paulson
parents: 7499
diff changeset
    25
  "[| ve \\<in> ValEnv; x \\<in> ExVar; e \\<in> 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  \
11318
6536fb8c9fc6 X-symbols for ZF
paulson
parents: 7499
diff changeset
    27
\       |] ==> <v_clos(x, e, ve), t> \\<in> 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
6154
6a00a5baef2b automatic insertion of datatype intr rules into claset
paulson
parents: 6141
diff changeset
    31
AddDs [te_owrE, ElabRel.dom_subset RS subsetD];
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    32
6046
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
    33
Addsimps [ve_dom_owr, ve_app_owr1, ve_app_owr2, 
2493
bdeb5024353a Removal of sum_cs and eq_cs
paulson
parents: 2469
diff changeset
    34
          te_app_owr1, te_app_owr2];
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    35
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    36
val clean_tac = 
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    37
  REPEAT_FIRST (fn i => 
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    38
    (eq_assume_tac i) ORELSE 
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    39
    (match_tac (Ty.intrs@TyEnv.intrs@Val_ValEnv.intrs) i) ORELSE
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    40
    (ematch_tac [te_owrE] i));
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    41
6046
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
    42
Goalw [hastyenv_def]
11318
6536fb8c9fc6 X-symbols for ZF
paulson
parents: 7499
diff changeset
    43
  "[| ve \\<in> ValEnv; x \\<in> ExVar; e \\<in> Exp; f \\<in> ExVar; cl \\<in> Val;               \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 915
diff changeset
    44
\     v_clos(x,e,ve_owr(ve,f,cl)) = cl;                         \ 
6bcb44e4d6e5 expanded tabs
clasohm
parents: 915
diff changeset
    45
\     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
    46
\  <cl,t>:HasTyRel";
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    47
by (etac elab_fixE 1);
4152
451104c223e2 Ran expandshort, especially to introduce Safe_tac
paulson
parents: 4091
diff changeset
    48
by Safe_tac;
7499
23e090051cb8 isatool expandshort;
wenzelm
parents: 6154
diff changeset
    49
by (EVERY [ftac subst 1,atac 2,rtac htr_closCI 1]);
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    50
by clean_tac;
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    51
by (rtac ve_owrI 1);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    52
by clean_tac;
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    53
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
    54
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
    55
    (SigmaD1 RS te_owrE) 1);
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    56
by (assume_tac 1);
6141
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
    57
by (rtac ElabRel.fnI 1);
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    58
by clean_tac;
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 2034
diff changeset
    59
by (Asm_simp_tac 1);
2034
5079fdf938dd Ran expandshort; used stac instead of ssubst
paulson
parents: 1740
diff changeset
    60
by (stac ve_dom_owr 1);
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    61
by (assume_tac 1);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    62
by (etac subst 1);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    63
by (rtac v_closNE 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 2034
diff changeset
    64
by (Asm_simp_tac 1);
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    65
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    66
by (rtac PowI 1);
2034
5079fdf938dd Ran expandshort; used stac instead of ssubst
paulson
parents: 1740
diff changeset
    67
by (stac ve_dom_owr 1);
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    68
by (assume_tac 1);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    69
by (etac subst 1);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    70
by (rtac v_closNE 1);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    71
by (rtac subsetI 1);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    72
by (etac RepFunE 1);
6154
6a00a5baef2b automatic insertion of datatype intr rules into claset
paulson
parents: 6141
diff changeset
    73
by (case_tac "f=y" 1);
4477
b3e5857d8d99 New Auto_tac (by Oheimb), and new syntax (without parens), and expandshort
paulson
parents: 4152
diff changeset
    74
by Auto_tac;
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    75
qed "consistency_fix";
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    76
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    77
11318
6536fb8c9fc6 X-symbols for ZF
paulson
parents: 7499
diff changeset
    78
Goal "[| ve \\<in> ValEnv; e1 \\<in> Exp; e2 \\<in> Exp; c1 \\<in> Const; c2 \\<in> Const;   \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 915
diff changeset
    79
\     <ve,e1,v_const(c1)>:EvalRel;                      \
11318
6536fb8c9fc6 X-symbols for ZF
paulson
parents: 7499
diff changeset
    80
\     \\<forall>t te.                                         \
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    81
\       hastyenv(ve,te) --> <te,e1,t>:ElabRel --> <v_const(c1),t>:HasTyRel; \
11318
6536fb8c9fc6 X-symbols for ZF
paulson
parents: 7499
diff changeset
    82
\     <ve, e2, v_const(c2)> \\<in> EvalRel;                  \
6536fb8c9fc6 X-symbols for ZF
paulson
parents: 7499
diff changeset
    83
\     \\<forall>t te.                                         \
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    84
\       hastyenv(ve,te) --> <te,e2,t>:ElabRel --> <v_const(c2),t>:HasTyRel; \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 915
diff changeset
    85
\     hastyenv(ve, te);                                 \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 915
diff changeset
    86
\     <te,e_app(e1,e2),t>:ElabRel |] ==>                \
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    87
\   <v_const(c_app(c1, c2)),t>:HasTyRel";
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    88
by (etac elab_appE 1);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    89
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
    90
qed "consistency_app1";
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
    91
11318
6536fb8c9fc6 X-symbols for ZF
paulson
parents: 7499
diff changeset
    92
Goal "[| ve \\<in> ValEnv; vem \\<in> ValEnv; e1 \\<in> Exp; e2 \\<in> Exp; em \\<in> Exp; xm \\<in> ExVar; v \\<in> Val;  \
6141
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
    93
\        <ve,e1,v_clos(xm,em,vem)>:EvalRel;       \
11318
6536fb8c9fc6 X-symbols for ZF
paulson
parents: 7499
diff changeset
    94
\        \\<forall>t te.                                \
6141
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
    95
\          hastyenv(ve,te) -->                    \
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
    96
\          <te,e1,t>:ElabRel -->                  \
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
    97
\          <v_clos(xm,em,vem),t>:HasTyRel;        \
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
    98
\        <ve,e2,v2>:EvalRel;                      \
11318
6536fb8c9fc6 X-symbols for ZF
paulson
parents: 7499
diff changeset
    99
\        \\<forall>t te.                                \
6141
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   100
\          hastyenv(ve,te) -->                    \
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   101
\          <te,e2,t>:ElabRel -->                  \
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   102
\          <v2,t>:HasTyRel;                       \
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   103
\        <ve_owr(vem,xm,v2),em,v>:EvalRel;        \
11318
6536fb8c9fc6 X-symbols for ZF
paulson
parents: 7499
diff changeset
   104
\        \\<forall>t te.                                \
6141
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   105
\          hastyenv(ve_owr(vem,xm,v2),te) -->     \
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   106
\          <te,em,t>:ElabRel -->                  \
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   107
\          <v,t>:HasTyRel;                        \
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   108
\        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
   109
\     <v,t>:HasTyRel ";
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   110
by (etac elab_appE 1);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   111
by (dtac (spec RS spec RS mp RS mp) 1);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   112
by (assume_tac 1);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   113
by (assume_tac 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 (etac htr_closE 1);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   118
by (etac elab_fnE 1);
6141
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   119
by (Full_simp_tac 1);
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   120
by (Clarify_tac 1);
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   121
by (dtac (spec RS spec RS mp RS mp) 1);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   122
by (assume_tac 3);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   123
by (assume_tac 2);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   124
by (rtac hastyenv_owr 1);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   125
by (assume_tac 1);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   126
by (assume_tac 1);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   127
by (assume_tac 2);
6141
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   128
by (asm_simp_tac (simpset() addsimps [hastyenv_def]) 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 2034
diff changeset
   129
by (Fast_tac 1);
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   130
qed "consistency_app2";
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   131
5147
825877190618 More tidying and removal of "\!\!... from Goal commands
paulson
parents: 5068
diff changeset
   132
Goal "<ve,e,v>:EvalRel ==>         \
11318
6536fb8c9fc6 X-symbols for ZF
paulson
parents: 7499
diff changeset
   133
\       (\\<forall>t te. hastyenv(ve,te) --> <te,e,t>:ElabRel --> <v,t>:HasTyRel)";
1740
b50755328aad Updated for new form of induction rules
paulson
parents: 1461
diff changeset
   134
by (etac EvalRel.induct 1);
6141
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   135
by (blast_tac (claset() addIs [consistency_app2]) 6);
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   136
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
   137
qed "consistency";
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   138
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   139
11318
6536fb8c9fc6 X-symbols for ZF
paulson
parents: 7499
diff changeset
   140
Goal "[| ve \\<in> ValEnv; te \\<in> TyEnv;              \
6141
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   141
\        isofenv(ve,te);                   \
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   142
\        <ve,e,v_const(c)>:EvalRel;        \
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   143
\        <te,e,t>:ElabRel                  \
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   144
\     |] ==> isof(c,t)";
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
   145
by (rtac htr_constE 1);
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   146
by (dtac consistency 1);
6154
6a00a5baef2b automatic insertion of datatype intr rules into claset
paulson
parents: 6141
diff changeset
   147
by (blast_tac (claset() addSIs [basic_consistency_lem]) 1);
915
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   148
by (assume_tac 1);
6dae0daf57b7 New example by Jacob Frost, tidied by lcp
lcp
parents:
diff changeset
   149
qed "basic_consistency";