src/HOL/HOL_lemmas.ML
author oheimb
Mon, 06 Sep 1999 18:17:48 +0200
changeset 7490 9a74b57740d1
parent 7427 e5a5d59dd513
child 7533 1659dc4e3552
permissions -rw-r--r--
added smp_tac
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7357
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
     1
(*  Title:      HOL/HOL_lemmas.ML
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
     2
    ID:         $Id$
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
     3
    Author:     Tobias Nipkow
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
     4
    Copyright   1991  University of Cambridge
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
     5
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
     6
Derived rules from Appendix of Mike Gordons HOL Report, Cambridge TR 68.
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
     7
*)
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
     8
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
     9
(* ML bindings *)
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    10
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    11
val plusI = thm "plusI";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    12
val minusI = thm "minusI";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    13
val timesI = thm "timesI";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    14
val powerI = thm "powerI";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    15
val eq_reflection = thm "eq_reflection";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    16
val refl = thm "refl";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    17
val subst = thm "subst";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    18
val ext = thm "ext";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    19
val selectI = thm "selectI";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    20
val impI = thm "impI";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    21
val mp = thm "mp";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    22
val True_def = thm "True_def";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    23
val All_def = thm "All_def";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    24
val Ex_def = thm "Ex_def";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    25
val False_def = thm "False_def";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    26
val not_def = thm "not_def";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    27
val and_def = thm "and_def";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    28
val or_def = thm "or_def";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    29
val Ex1_def = thm "Ex1_def";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    30
val iff = thm "iff";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    31
val True_or_False = thm "True_or_False";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    32
val Let_def = thm "Let_def";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    33
val if_def = thm "if_def";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    34
val arbitrary_def = thm "arbitrary_def";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    35
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    36
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    37
(** Equality **)
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    38
section "=";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    39
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    40
qed_goal "sym" (the_context ()) "s=t ==> t=s"
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    41
 (fn prems => [cut_facts_tac prems 1, etac subst 1, rtac refl 1]);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    42
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    43
(*calling "standard" reduces maxidx to 0*)
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    44
bind_thm ("ssubst", (sym RS subst));
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    45
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    46
qed_goal "trans" (the_context ()) "[| r=s; s=t |] ==> r=t"
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    47
 (fn prems =>
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    48
        [rtac subst 1, resolve_tac prems 1, resolve_tac prems 1]);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    49
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    50
val prems = goal (the_context ()) "(A == B) ==> A = B";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    51
by (rewrite_goals_tac prems);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    52
by (rtac refl 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    53
qed "def_imp_eq";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    54
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    55
(*Useful with eresolve_tac for proving equalties from known equalities.
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    56
        a = b
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    57
        |   |
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    58
        c = d   *)
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    59
Goal "[| a=b;  a=c;  b=d |] ==> c=d";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    60
by (rtac trans 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    61
by (rtac trans 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    62
by (rtac sym 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    63
by (REPEAT (assume_tac 1)) ;
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    64
qed "box_equals";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    65
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    66
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    67
(** Congruence rules for meta-application **)
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    68
section "Congruence";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    69
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    70
(*similar to AP_THM in Gordon's HOL*)
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    71
qed_goal "fun_cong" (the_context ()) "(f::'a=>'b) = g ==> f(x)=g(x)"
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    72
  (fn [prem] => [rtac (prem RS subst) 1, rtac refl 1]);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    73
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    74
(*similar to AP_TERM in Gordon's HOL and FOL's subst_context*)
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    75
qed_goal "arg_cong" (the_context ()) "x=y ==> f(x)=f(y)"
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    76
 (fn [prem] => [rtac (prem RS subst) 1, rtac refl 1]);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    77
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    78
qed_goal "cong" (the_context ())
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    79
   "[| f = g; (x::'a) = y |] ==> f(x) = g(y)"
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    80
 (fn [prem1,prem2] =>
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    81
   [rtac (prem1 RS subst) 1, rtac (prem2 RS subst) 1, rtac refl 1]);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    82
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    83
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    84
(** Equality of booleans -- iff **)
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    85
section "iff";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    86
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    87
val prems = Goal
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    88
   "[| P ==> Q;  Q ==> P |] ==> P=Q";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    89
by (REPEAT (ares_tac (prems@[impI, iff RS mp RS mp]) 1));
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    90
qed "iffI";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    91
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    92
qed_goal "iffD2" (the_context ()) "[| P=Q; Q |] ==> P"
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    93
 (fn prems =>
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    94
        [rtac ssubst 1, resolve_tac prems 1, resolve_tac prems 1]);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    95
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    96
qed_goal "rev_iffD2" (the_context ()) "!!P. [| Q; P=Q |] ==> P"
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    97
 (fn _ => [etac iffD2 1, assume_tac 1]);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    98
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
    99
bind_thm ("iffD1", sym RS iffD2);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   100
bind_thm ("rev_iffD1", sym RSN (2, rev_iffD2));
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   101
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   102
qed_goal "iffE" (the_context ())
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   103
    "[| P=Q; [| P --> Q; Q --> P |] ==> R |] ==> R"
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   104
 (fn [p1,p2] => [REPEAT(ares_tac([p1 RS iffD2, p1 RS iffD1, p2, impI])1)]);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   105
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   106
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   107
(** True **)
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   108
section "True";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   109
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   110
qed_goalw "TrueI" (the_context ()) [True_def] "True"
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   111
  (fn _ => [(rtac refl 1)]);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   112
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   113
qed_goal "eqTrueI" (the_context ()) "P ==> P=True" 
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   114
 (fn prems => [REPEAT(resolve_tac ([iffI,TrueI]@prems) 1)]);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   115
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   116
qed_goal "eqTrueE" (the_context ()) "P=True ==> P" 
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   117
 (fn prems => [REPEAT(resolve_tac (prems@[TrueI,iffD2]) 1)]);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   118
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   119
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   120
(** Universal quantifier **)
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   121
section "!";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   122
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   123
qed_goalw "allI" (the_context ()) [All_def] "(!!x::'a. P(x)) ==> !x. P(x)"
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   124
 (fn prems => [(resolve_tac (prems RL [eqTrueI RS ext]) 1)]);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   125
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   126
qed_goalw "spec" (the_context ()) [All_def] "! x::'a. P(x) ==> P(x)"
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   127
 (fn prems => [rtac eqTrueE 1, resolve_tac (prems RL [fun_cong]) 1]);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   128
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   129
val major::prems= goal (the_context ()) "[| !x. P(x);  P(x) ==> R |] ==> R";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   130
by (REPEAT (resolve_tac (prems @ [major RS spec]) 1)) ;
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   131
qed "allE";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   132
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   133
val prems = goal (the_context ()) 
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   134
    "[| ! x. P(x);  [| P(x); ! x. P(x) |] ==> R |] ==> R";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   135
by (REPEAT (resolve_tac (prems @ (prems RL [spec])) 1)) ;
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   136
qed "all_dupE";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   137
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   138
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   139
(** False ** Depends upon spec; it is impossible to do propositional logic
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   140
             before quantifiers! **)
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   141
section "False";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   142
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   143
qed_goalw "FalseE" (the_context ()) [False_def] "False ==> P"
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   144
 (fn [major] => [rtac (major RS spec) 1]);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   145
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   146
qed_goal "False_neq_True" (the_context ()) "False=True ==> P"
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   147
 (fn [prem] => [rtac (prem RS eqTrueE RS FalseE) 1]);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   148
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   149
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   150
(** Negation **)
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   151
section "~";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   152
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   153
qed_goalw "notI" (the_context ()) [not_def] "(P ==> False) ==> ~P"
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   154
 (fn prems=> [rtac impI 1, eresolve_tac prems 1]);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   155
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   156
qed_goal "False_not_True" (the_context ()) "False ~= True"
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   157
  (fn _ => [rtac notI 1, etac False_neq_True 1]);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   158
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   159
qed_goal "True_not_False" (the_context ()) "True ~= False"
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   160
  (fn _ => [rtac notI 1, dtac sym 1, etac False_neq_True 1]);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   161
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   162
qed_goalw "notE" (the_context ()) [not_def] "[| ~P;  P |] ==> R"
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   163
 (fn prems => [rtac (prems MRS mp RS FalseE) 1]);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   164
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   165
bind_thm ("classical2", notE RS notI);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   166
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   167
qed_goal "rev_notE" (the_context ()) "!!P R. [| P; ~P |] ==> R"
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   168
 (fn _ => [REPEAT (ares_tac [notE] 1)]);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   169
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   170
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   171
(** Implication **)
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   172
section "-->";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   173
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   174
val prems = Goal "[| P-->Q;  P;  Q ==> R |] ==> R";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   175
by (REPEAT (resolve_tac (prems@[mp]) 1));
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   176
qed "impE";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   177
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   178
(* Reduces Q to P-->Q, allowing substitution in P. *)
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   179
Goal "[| P;  P --> Q |] ==> Q";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   180
by (REPEAT (ares_tac [mp] 1)) ;
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   181
qed "rev_mp";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   182
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   183
val [major,minor] = Goal "[| ~Q;  P==>Q |] ==> ~P";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   184
by (rtac (major RS notE RS notI) 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   185
by (etac minor 1) ;
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   186
qed "contrapos";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   187
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   188
val [major,minor] = Goal "[| P==>Q; ~Q |] ==> ~P";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   189
by (rtac (minor RS contrapos) 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   190
by (etac major 1) ;
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   191
qed "rev_contrapos";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   192
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   193
(* ~(?t = ?s) ==> ~(?s = ?t) *)
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   194
bind_thm("not_sym", sym COMP rev_contrapos);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   195
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   196
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   197
(** Existential quantifier **)
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   198
section "?";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   199
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   200
qed_goalw "exI" (the_context ()) [Ex_def] "P x ==> ? x::'a. P x"
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   201
 (fn prems => [rtac selectI 1, resolve_tac prems 1]);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   202
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   203
qed_goalw "exE" (the_context ()) [Ex_def]
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   204
  "[| ? x::'a. P(x); !!x. P(x) ==> Q |] ==> Q"
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   205
  (fn prems => [REPEAT(resolve_tac prems 1)]);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   206
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   207
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   208
(** Conjunction **)
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   209
section "&";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   210
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   211
qed_goalw "conjI" (the_context ()) [and_def] "[| P; Q |] ==> P&Q"
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   212
 (fn prems =>
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   213
  [REPEAT (resolve_tac (prems@[allI,impI]) 1 ORELSE etac (mp RS mp) 1)]);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   214
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   215
qed_goalw "conjunct1" (the_context ()) [and_def] "[| P & Q |] ==> P"
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   216
 (fn prems =>
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   217
   [resolve_tac (prems RL [spec] RL [mp]) 1, REPEAT(ares_tac [impI] 1)]);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   218
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   219
qed_goalw "conjunct2" (the_context ()) [and_def] "[| P & Q |] ==> Q"
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   220
 (fn prems =>
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   221
   [resolve_tac (prems RL [spec] RL [mp]) 1, REPEAT(ares_tac [impI] 1)]);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   222
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   223
qed_goal "conjE" (the_context ()) "[| P&Q;  [| P; Q |] ==> R |] ==> R"
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   224
 (fn prems =>
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   225
         [cut_facts_tac prems 1, resolve_tac prems 1,
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   226
          etac conjunct1 1, etac conjunct2 1]);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   227
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   228
qed_goal "context_conjI" (the_context ())  "[| P; P ==> Q |] ==> P & Q"
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   229
 (fn prems => [REPEAT(resolve_tac (conjI::prems) 1)]);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   230
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   231
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   232
(** Disjunction *)
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   233
section "|";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   234
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   235
qed_goalw "disjI1" (the_context ()) [or_def] "P ==> P|Q"
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   236
 (fn [prem] => [REPEAT(ares_tac [allI,impI, prem RSN (2,mp)] 1)]);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   237
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   238
qed_goalw "disjI2" (the_context ()) [or_def] "Q ==> P|Q"
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   239
 (fn [prem] => [REPEAT(ares_tac [allI,impI, prem RSN (2,mp)] 1)]);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   240
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   241
qed_goalw "disjE" (the_context ()) [or_def] "[| P | Q; P ==> R; Q ==> R |] ==> R"
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   242
 (fn [a1,a2,a3] =>
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   243
        [rtac (mp RS mp) 1, rtac spec 1, rtac a1 1,
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   244
         rtac (a2 RS impI) 1, assume_tac 1, rtac (a3 RS impI) 1, assume_tac 1]);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   245
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   246
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   247
(** CCONTR -- classical logic **)
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   248
section "classical logic";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   249
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   250
qed_goalw "classical" (the_context ()) [not_def]  "(~P ==> P) ==> P"
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   251
 (fn [prem] =>
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   252
   [rtac (True_or_False RS (disjE RS eqTrueE)) 1,  assume_tac 1,
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   253
    rtac (impI RS prem RS eqTrueI) 1,
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   254
    etac subst 1,  assume_tac 1]);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   255
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   256
val ccontr = FalseE RS classical;
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   257
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   258
(*Double negation law*)
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   259
Goal "~~P ==> P";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   260
by (rtac classical 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   261
by (etac notE 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   262
by (assume_tac 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   263
qed "notnotD";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   264
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   265
val [p1,p2] = Goal "[| Q; ~ P ==> ~ Q |] ==> P";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   266
by (rtac classical 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   267
by (dtac p2 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   268
by (etac notE 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   269
by (rtac p1 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   270
qed "contrapos2";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   271
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   272
val [p1,p2] = Goal "[| P;  Q ==> ~ P |] ==> ~ Q";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   273
by (rtac notI 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   274
by (dtac p2 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   275
by (etac notE 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   276
by (rtac p1 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   277
qed "swap2";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   278
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   279
(** Unique existence **)
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   280
section "?!";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   281
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   282
qed_goalw "ex1I" (the_context ()) [Ex1_def]
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   283
            "[| P(a);  !!x. P(x) ==> x=a |] ==> ?! x. P(x)"
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   284
 (fn prems =>
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   285
  [REPEAT (ares_tac (prems@[exI,conjI,allI,impI]) 1)]);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   286
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   287
(*Sometimes easier to use: the premises have no shared variables.  Safe!*)
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   288
val [ex,eq] = Goal
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   289
    "[| ? x. P(x);  !!x y. [| P(x); P(y) |] ==> x=y |] ==> ?! x. P(x)";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   290
by (rtac (ex RS exE) 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   291
by (REPEAT (ares_tac [ex1I,eq] 1)) ;
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   292
qed "ex_ex1I";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   293
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   294
qed_goalw "ex1E" (the_context ()) [Ex1_def]
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   295
    "[| ?! x. P(x);  !!x. [| P(x);  ! y. P(y) --> y=x |] ==> R |] ==> R"
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   296
 (fn major::prems =>
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   297
  [rtac (major RS exE) 1, REPEAT (etac conjE 1 ORELSE ares_tac prems 1)]);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   298
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   299
Goal "?! x. P x ==> ? x. P x";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   300
by (etac ex1E 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   301
by (rtac exI 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   302
by (assume_tac 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   303
qed "ex1_implies_ex";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   304
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   305
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   306
(** Select: Hilbert's Epsilon-operator **)
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   307
section "@";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   308
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   309
(*Easier to apply than selectI: conclusion has only one occurrence of P*)
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   310
val prems = Goal
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   311
    "[| P a;  !!x. P x ==> Q x |] ==> Q (@x. P x)";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   312
by (resolve_tac prems 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   313
by (rtac selectI 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   314
by (resolve_tac prems 1) ;
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   315
qed "selectI2";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   316
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   317
(*Easier to apply than selectI2 if witness ?a comes from an EX-formula*)
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   318
qed_goal "selectI2EX" (the_context ())
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   319
  "[| ? a. P a; !!x. P x ==> Q x |] ==> Q (Eps P)"
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   320
(fn [major,minor] => [rtac (major RS exE) 1, etac selectI2 1, etac minor 1]);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   321
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   322
val prems = Goal
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   323
    "[| P a;  !!x. P x ==> x=a |] ==> (@x. P x) = a";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   324
by (rtac selectI2 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   325
by (REPEAT (ares_tac prems 1)) ;
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   326
qed "select_equality";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   327
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   328
Goalw [Ex1_def] "[| ?!x. P x; P a |] ==> (@x. P x) = a";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   329
by (rtac select_equality 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   330
by (atac 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   331
by (etac exE 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   332
by (etac conjE 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   333
by (rtac allE 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   334
by (atac 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   335
by (etac impE 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   336
by (atac 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   337
by (etac ssubst 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   338
by (etac allE 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   339
by (etac mp 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   340
by (atac 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   341
qed "select1_equality";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   342
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   343
Goal "P (@ x. P x) =  (? x. P x)";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   344
by (rtac iffI 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   345
by (etac exI 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   346
by (etac exE 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   347
by (etac selectI 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   348
qed "select_eq_Ex";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   349
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   350
Goal "(@y. y=x) = x";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   351
by (rtac select_equality 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   352
by (rtac refl 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   353
by (atac 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   354
qed "Eps_eq";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   355
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   356
Goal "(Eps (op = x)) = x";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   357
by (rtac select_equality 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   358
by (rtac refl 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   359
by (etac sym 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   360
qed "Eps_sym_eq";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   361
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   362
(** Classical intro rules for disjunction and existential quantifiers *)
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   363
section "classical intro rules";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   364
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   365
val prems= Goal "(~Q ==> P) ==> P|Q";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   366
by (rtac classical 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   367
by (REPEAT (ares_tac (prems@[disjI1,notI]) 1));
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   368
by (REPEAT (ares_tac (prems@[disjI2,notE]) 1)) ;
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   369
qed "disjCI";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   370
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   371
Goal "~P | P";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   372
by (REPEAT (ares_tac [disjCI] 1)) ;
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   373
qed "excluded_middle";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   374
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   375
(*For disjunctive case analysis*)
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   376
fun excluded_middle_tac sP =
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   377
    res_inst_tac [("Q",sP)] (excluded_middle RS disjE);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   378
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   379
(*Classical implies (-->) elimination. *)
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   380
val major::prems = Goal "[| P-->Q; ~P ==> R; Q ==> R |] ==> R";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   381
by (rtac (excluded_middle RS disjE) 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   382
by (REPEAT (DEPTH_SOLVE_1 (ares_tac (prems @ [major RS mp]) 1)));
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   383
qed "impCE";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   384
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   385
(*This version of --> elimination works on Q before P.  It works best for
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   386
  those cases in which P holds "almost everywhere".  Can't install as
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   387
  default: would break old proofs.*)
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   388
val major::prems = Goal
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   389
    "[| P-->Q;  Q ==> R;  ~P ==> R |] ==> R";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   390
by (resolve_tac [excluded_middle RS disjE] 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   391
by (DEPTH_SOLVE (ares_tac (prems@[major RS mp]) 1)) ;
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   392
qed "impCE'";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   393
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   394
(*Classical <-> elimination. *)
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   395
val major::prems = Goal
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   396
    "[| P=Q;  [| P; Q |] ==> R;  [| ~P; ~Q |] ==> R |] ==> R";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   397
by (rtac (major RS iffE) 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   398
by (REPEAT (DEPTH_SOLVE_1 
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   399
	    (eresolve_tac ([asm_rl,impCE,notE]@prems) 1)));
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   400
qed "iffCE";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   401
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   402
val prems = Goal "(! x. ~P(x) ==> P(a)) ==> ? x. P(x)";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   403
by (rtac ccontr 1);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   404
by (REPEAT (ares_tac (prems@[exI,allI,notI,notE]) 1))  ;
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   405
qed "exCI";
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   406
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   407
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   408
(* case distinction *)
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   409
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   410
qed_goal "case_split_thm" (the_context ()) "[| P ==> Q; ~P ==> Q |] ==> Q"
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   411
  (fn [p1,p2] => [rtac (excluded_middle RS disjE) 1,
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   412
                  etac p2 1, etac p1 1]);
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   413
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   414
fun case_tac a = res_inst_tac [("P",a)] case_split_thm;
7427
e5a5d59dd513 bind_thm "case";
wenzelm
parents: 7357
diff changeset
   415
bind_thm ("case", case_split_thm);
7357
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   416
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   417
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   418
(** Standard abbreviations **)
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   419
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   420
(*Apply an equality or definition ONCE.
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   421
  Fails unless the substitution has an effect*)
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   422
fun stac th = 
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   423
  let val th' = th RS def_imp_eq handle THM _ => th
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   424
  in  CHANGED_GOAL (rtac (th' RS ssubst))
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   425
  end;
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   426
7490
9a74b57740d1 added smp_tac
oheimb
parents: 7427
diff changeset
   427
(* combination of (spec RS spec RS ...(j times) ... spec RS mp *) 
9a74b57740d1 added smp_tac
oheimb
parents: 7427
diff changeset
   428
local
9a74b57740d1 added smp_tac
oheimb
parents: 7427
diff changeset
   429
  fun wrong_prem (Const ("All", _) $ (Abs (_, _, t))) = wrong_prem t
9a74b57740d1 added smp_tac
oheimb
parents: 7427
diff changeset
   430
  |   wrong_prem (Bound _) = true
9a74b57740d1 added smp_tac
oheimb
parents: 7427
diff changeset
   431
  |   wrong_prem _ = false;
9a74b57740d1 added smp_tac
oheimb
parents: 7427
diff changeset
   432
  fun wrong (Const ("==>", _) $ (Const ("Trueprop", _) $ t) $ _) = wrong_prem t
9a74b57740d1 added smp_tac
oheimb
parents: 7427
diff changeset
   433
  |   wrong _ = true;
9a74b57740d1 added smp_tac
oheimb
parents: 7427
diff changeset
   434
  val filter_right = filter (fn t => not (wrong (#prop (rep_thm t))));
9a74b57740d1 added smp_tac
oheimb
parents: 7427
diff changeset
   435
in
9a74b57740d1 added smp_tac
oheimb
parents: 7427
diff changeset
   436
  fun smp i = funpow i (fn m => filter_right ([spec] RL m)) ([mp]);
9a74b57740d1 added smp_tac
oheimb
parents: 7427
diff changeset
   437
  fun smp_tac j = EVERY'[dresolve_tac (smp j), atac]
9a74b57740d1 added smp_tac
oheimb
parents: 7427
diff changeset
   438
end;
9a74b57740d1 added smp_tac
oheimb
parents: 7427
diff changeset
   439
9a74b57740d1 added smp_tac
oheimb
parents: 7427
diff changeset
   440
7357
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   441
fun strip_tac i = REPEAT(resolve_tac [impI,allI] i); 
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   442
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   443
(** strip ! and --> from proved goal while preserving !-bound var names **)
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   444
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   445
local
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   446
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   447
(* Use XXX to avoid forall_intr failing because of duplicate variable name *)
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   448
val myspec = read_instantiate [("P","?XXX")] spec;
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   449
val _ $ (_ $ (vx as Var(_,vxT))) = concl_of myspec;
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   450
val cvx = cterm_of (#sign(rep_thm myspec)) vx;
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   451
val aspec = forall_intr cvx myspec;
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   452
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   453
in
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   454
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   455
fun RSspec th =
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   456
  (case concl_of th of
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   457
     _ $ (Const("All",_) $ Abs(a,_,_)) =>
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   458
         let val ca = cterm_of (#sign(rep_thm th)) (Var((a,0),vxT))
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   459
         in th RS forall_elim ca aspec end
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   460
  | _ => raise THM("RSspec",0,[th]));
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   461
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   462
fun RSmp th =
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   463
  (case concl_of th of
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   464
     _ $ (Const("op -->",_)$_$_) => th RS mp
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   465
  | _ => raise THM("RSmp",0,[th]));
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   466
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   467
fun normalize_thm funs =
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   468
  let fun trans [] th = th
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   469
	| trans (f::fs) th = (trans funs (f th)) handle THM _ => trans fs th
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   470
  in zero_var_indexes o trans funs end;
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   471
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   472
fun qed_spec_mp name =
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   473
  let val thm = normalize_thm [RSspec,RSmp] (result())
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   474
  in ThmDatabase.ml_store_thm(name, thm) end;
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   475
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   476
fun qed_goal_spec_mp name thy s p = 
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   477
	bind_thm (name, normalize_thm [RSspec,RSmp] (prove_goal thy s p));
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   478
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   479
fun qed_goalw_spec_mp name thy defs s p = 
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   480
	bind_thm (name, normalize_thm [RSspec,RSmp] (prove_goalw thy defs s p));
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   481
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   482
end;
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   483
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   484
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   485
(* attributes *)
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   486
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   487
local
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   488
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   489
fun gen_rulify x =
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   490
  Attrib.no_args (Drule.rule_attribute (fn _ => (normalize_thm [RSspec, RSmp]))) x;
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   491
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   492
in
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   493
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   494
val attrib_setup =
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   495
 [Attrib.add_attributes
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   496
  [("rulify", (gen_rulify, gen_rulify), "put theorem into standard rule form")]];
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   497
d0e16da40ea2 proper bootstrap of HOL theory and packages;
wenzelm
parents:
diff changeset
   498
end;