src/FOL/IFOL.ML
author clasohm
Thu, 16 Sep 1993 12:20:38 +0200
changeset 0 a5a9c433f639
child 12 f17d542276b6
permissions -rw-r--r--
Initial revision
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     1
(*  Title: 	FOL/ifol.ML
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     2
    ID:         $Id$
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     3
    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     4
    Copyright   1992  University of Cambridge
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     5
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     6
Tactics and lemmas for ifol.thy (intuitionistic first-order logic)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     7
*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     8
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     9
open IFOL;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    10
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    11
signature IFOL_LEMMAS = 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    12
  sig
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    13
  val allE: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    14
  val all_cong: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    15
  val all_dupE: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    16
  val all_impE: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    17
  val box_equals: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    18
  val conjE: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    19
  val conj_cong: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    20
  val conj_impE: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    21
  val contrapos: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    22
  val disj_cong: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    23
  val disj_impE: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    24
  val eq_cong: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    25
  val eq_mp_tac: int -> tactic
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    26
  val ex1I: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    27
  val ex1E: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    28
  val ex1_equalsE: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    29
  val ex1_cong: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    30
  val ex_cong: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    31
  val ex_impE: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    32
  val iffD1: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    33
  val iffD2: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    34
  val iffE: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    35
  val iffI: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    36
  val iff_cong: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    37
  val iff_impE: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    38
  val iff_refl: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    39
  val iff_sym: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    40
  val iff_trans: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    41
  val impE: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    42
  val imp_cong: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    43
  val imp_impE: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    44
  val mp_tac: int -> tactic
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    45
  val notE: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    46
  val notI: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    47
  val not_cong: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    48
  val not_impE: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    49
  val not_sym: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    50
  val not_to_imp: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    51
  val pred1_cong: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    52
  val pred2_cong: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    53
  val pred3_cong: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    54
  val pred_congs: thm list
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    55
  val rev_mp: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    56
  val simp_equals: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    57
  val ssubst: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    58
  val subst_context: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    59
  val subst_context2: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    60
  val subst_context3: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    61
  val sym: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    62
  val trans: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    63
  val TrueI: thm
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    64
  end;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    65
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    66
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    67
structure IFOL_Lemmas : IFOL_LEMMAS =
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    68
struct
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    69
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    70
val TrueI = prove_goalw IFOL.thy [True_def] "True"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    71
 (fn _ => [ (REPEAT (ares_tac [impI] 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    72
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    73
(*** Sequent-style elimination rules for & --> and ALL ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    74
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    75
val conjE = prove_goal IFOL.thy 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    76
    "[| P&Q; [| P; Q |] ==> R |] ==> R"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    77
 (fn prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    78
  [ (REPEAT (resolve_tac prems 1
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    79
      ORELSE (resolve_tac [conjunct1, conjunct2] 1 THEN
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    80
              resolve_tac prems 1))) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    81
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    82
val impE = prove_goal IFOL.thy 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    83
    "[| P-->Q;  P;  Q ==> R |] ==> R"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    84
 (fn prems=> [ (REPEAT (resolve_tac (prems@[mp]) 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    85
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    86
val allE = prove_goal IFOL.thy 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    87
    "[| ALL x.P(x); P(x) ==> R |] ==> R"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    88
 (fn prems=> [ (REPEAT (resolve_tac (prems@[spec]) 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    89
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    90
(*Duplicates the quantifier; for use with eresolve_tac*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    91
val all_dupE = prove_goal IFOL.thy 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    92
    "[| ALL x.P(x);  [| P(x); ALL x.P(x) |] ==> R \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    93
\    |] ==> R"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    94
 (fn prems=> [ (REPEAT (resolve_tac (prems@[spec]) 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    95
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    96
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    97
(*** Negation rules, which translate between ~P and P-->False ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    98
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    99
val notI = prove_goalw IFOL.thy [not_def] "(P ==> False) ==> ~P"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   100
 (fn prems=> [ (REPEAT (ares_tac (prems@[impI]) 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   101
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   102
val notE = prove_goalw IFOL.thy [not_def] "[| ~P;  P |] ==> R"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   103
 (fn prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   104
  [ (resolve_tac [mp RS FalseE] 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   105
    (REPEAT (resolve_tac prems 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   106
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   107
(*This is useful with the special implication rules for each kind of P. *)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   108
val not_to_imp = prove_goal IFOL.thy 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   109
    "[| ~P;  (P-->False) ==> Q |] ==> Q"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   110
 (fn prems=> [ (REPEAT (ares_tac (prems@[impI,notE]) 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   111
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   112
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   113
(* For substitution int an assumption P, reduce Q to P-->Q, substitute into
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   114
   this implication, then apply impI to move P back into the assumptions.
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   115
   To specify P use something like
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   116
      eres_inst_tac [ ("P","ALL y. ?S(x,y)") ] rev_mp 1   *)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   117
val rev_mp = prove_goal IFOL.thy "[| P;  P --> Q |] ==> Q"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   118
 (fn prems=> [ (REPEAT (resolve_tac (prems@[mp]) 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   119
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   120
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   121
(*Contrapositive of an inference rule*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   122
val contrapos = prove_goal IFOL.thy "[| ~Q;  P==>Q |] ==> ~P"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   123
 (fn [major,minor]=> 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   124
  [ (rtac (major RS notE RS notI) 1), 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   125
    (etac minor 1) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   126
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   127
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   128
(*** Modus Ponens Tactics ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   129
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   130
(*Finds P-->Q and P in the assumptions, replaces implication by Q *)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   131
fun mp_tac i = eresolve_tac [notE,impE] i  THEN  assume_tac i;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   132
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   133
(*Like mp_tac but instantiates no variables*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   134
fun eq_mp_tac i = eresolve_tac [notE,impE] i  THEN  eq_assume_tac i;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   135
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   136
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   137
(*** If-and-only-if ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   138
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   139
val iffI = prove_goalw IFOL.thy [iff_def]
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   140
   "[| P ==> Q;  Q ==> P |] ==> P<->Q"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   141
 (fn prems=> [ (REPEAT (ares_tac (prems@[conjI, impI]) 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   142
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   143
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   144
(*Observe use of rewrite_rule to unfold "<->" in meta-assumptions (prems) *)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   145
val iffE = prove_goalw IFOL.thy [iff_def]
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   146
    "[| P <-> Q;  [| P-->Q; Q-->P |] ==> R |] ==> R"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   147
 (fn prems => [ (resolve_tac [conjE] 1), (REPEAT (ares_tac prems 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   148
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   149
(* Destruct rules for <-> similar to Modus Ponens *)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   150
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   151
val iffD1 = prove_goalw IFOL.thy [iff_def] "[| P <-> Q;  P |] ==> Q"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   152
 (fn prems => [ (rtac (conjunct1 RS mp) 1), (REPEAT (ares_tac prems 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   153
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   154
val iffD2 = prove_goalw IFOL.thy [iff_def] "[| P <-> Q;  Q |] ==> P"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   155
 (fn prems => [ (rtac (conjunct2 RS mp) 1), (REPEAT (ares_tac prems 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   156
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   157
val iff_refl = prove_goal IFOL.thy "P <-> P"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   158
 (fn _ => [ (REPEAT (ares_tac [iffI] 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   159
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   160
val iff_sym = prove_goal IFOL.thy "Q <-> P ==> P <-> Q"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   161
 (fn [major] =>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   162
  [ (rtac (major RS iffE) 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   163
    (rtac iffI 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   164
    (REPEAT (eresolve_tac [asm_rl,mp] 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   165
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   166
val iff_trans = prove_goal IFOL.thy
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   167
    "!!P Q R. [| P <-> Q;  Q<-> R |] ==> P <-> R"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   168
 (fn _ =>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   169
  [ (rtac iffI 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   170
    (REPEAT (eresolve_tac [asm_rl,iffE] 1 ORELSE mp_tac 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   171
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   172
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   173
(*** Unique existence.  NOTE THAT the following 2 quantifications
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   174
   EX!x such that [EX!y such that P(x,y)]     (sequential)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   175
   EX!x,y such that P(x,y)                    (simultaneous)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   176
 do NOT mean the same thing.  The parser treats EX!x y.P(x,y) as sequential.
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   177
***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   178
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   179
val ex1I = prove_goalw IFOL.thy [ex1_def]
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   180
    "[| P(a);  !!x. P(x) ==> x=a |] ==> EX! x. P(x)"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   181
 (fn prems => [ (REPEAT (ares_tac (prems@[exI,conjI,allI,impI]) 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   182
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   183
val ex1E = prove_goalw IFOL.thy [ex1_def]
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   184
    "[| EX! x.P(x);  !!x. [| P(x);  ALL y. P(y) --> y=x |] ==> R |] ==> R"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   185
 (fn prems =>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   186
  [ (cut_facts_tac prems 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   187
    (REPEAT (eresolve_tac [exE,conjE] 1 ORELSE ares_tac prems 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   188
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   189
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   190
(*** <-> congruence rules for simplification ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   191
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   192
(*Use iffE on a premise.  For conj_cong, imp_cong, all_cong, ex_cong*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   193
fun iff_tac prems i =
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   194
    resolve_tac (prems RL [iffE]) i THEN
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   195
    REPEAT1 (eresolve_tac [asm_rl,mp] i);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   196
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   197
val conj_cong = prove_goal IFOL.thy 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   198
    "[| P <-> P';  P' ==> Q <-> Q' |] ==> (P&Q) <-> (P'&Q')"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   199
 (fn prems =>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   200
  [ (cut_facts_tac prems 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   201
    (REPEAT  (ares_tac [iffI,conjI] 1
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   202
      ORELSE  eresolve_tac [iffE,conjE,mp] 1
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   203
      ORELSE  iff_tac prems 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   204
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   205
val disj_cong = prove_goal IFOL.thy 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   206
    "[| P <-> P';  Q <-> Q' |] ==> (P|Q) <-> (P'|Q')"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   207
 (fn prems =>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   208
  [ (cut_facts_tac prems 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   209
    (REPEAT  (eresolve_tac [iffE,disjE,disjI1,disjI2] 1
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   210
      ORELSE  ares_tac [iffI] 1
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   211
      ORELSE  mp_tac 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   212
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   213
val imp_cong = prove_goal IFOL.thy 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   214
    "[| P <-> P';  P' ==> Q <-> Q' |] ==> (P-->Q) <-> (P'-->Q')"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   215
 (fn prems =>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   216
  [ (cut_facts_tac prems 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   217
    (REPEAT   (ares_tac [iffI,impI] 1
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   218
      ORELSE  eresolve_tac [iffE] 1
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   219
      ORELSE  mp_tac 1 ORELSE iff_tac prems 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   220
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   221
val iff_cong = prove_goal IFOL.thy 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   222
    "[| P <-> P';  Q <-> Q' |] ==> (P<->Q) <-> (P'<->Q')"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   223
 (fn prems =>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   224
  [ (cut_facts_tac prems 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   225
    (REPEAT   (eresolve_tac [iffE] 1
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   226
      ORELSE  ares_tac [iffI] 1
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   227
      ORELSE  mp_tac 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   228
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   229
val not_cong = prove_goal IFOL.thy 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   230
    "P <-> P' ==> ~P <-> ~P'"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   231
 (fn prems =>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   232
  [ (cut_facts_tac prems 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   233
    (REPEAT   (ares_tac [iffI,notI] 1
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   234
      ORELSE  mp_tac 1
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   235
      ORELSE  eresolve_tac [iffE,notE] 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   236
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   237
val all_cong = prove_goal IFOL.thy 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   238
    "(!!x.P(x) <-> Q(x)) ==> (ALL x.P(x)) <-> (ALL x.Q(x))"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   239
 (fn prems =>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   240
  [ (REPEAT   (ares_tac [iffI,allI] 1
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   241
      ORELSE   mp_tac 1
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   242
      ORELSE   eresolve_tac [allE] 1 ORELSE iff_tac prems 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   243
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   244
val ex_cong = prove_goal IFOL.thy 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   245
    "(!!x.P(x) <-> Q(x)) ==> (EX x.P(x)) <-> (EX x.Q(x))"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   246
 (fn prems =>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   247
  [ (REPEAT   (eresolve_tac [exE] 1 ORELSE ares_tac [iffI,exI] 1
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   248
      ORELSE   mp_tac 1
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   249
      ORELSE   iff_tac prems 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   250
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   251
val ex1_cong = prove_goal IFOL.thy 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   252
    "(!!x.P(x) <-> Q(x)) ==> (EX! x.P(x)) <-> (EX! x.Q(x))"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   253
 (fn prems =>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   254
  [ (REPEAT   (eresolve_tac [ex1E, spec RS mp] 1 ORELSE ares_tac [iffI,ex1I] 1
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   255
      ORELSE   mp_tac 1
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   256
      ORELSE   iff_tac prems 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   257
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   258
(*** Equality rules ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   259
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   260
val sym = prove_goal IFOL.thy "a=b ==> b=a"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   261
 (fn [major] => [ (rtac (major RS subst) 1), (rtac refl 1) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   262
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   263
val trans = prove_goal IFOL.thy "[| a=b;  b=c |] ==> a=c"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   264
 (fn [prem1,prem2] => [ (rtac (prem2 RS subst) 1), (rtac prem1 1) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   265
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   266
(** ~ b=a ==> ~ a=b **)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   267
val [not_sym] = compose(sym,2,contrapos);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   268
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   269
(*calling "standard" reduces maxidx to 0*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   270
val ssubst = standard (sym RS subst);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   271
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   272
(*A special case of ex1E that would otherwise need quantifier expansion*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   273
val ex1_equalsE = prove_goal IFOL.thy
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   274
    "[| EX! x.P(x);  P(a);  P(b) |] ==> a=b"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   275
 (fn prems =>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   276
  [ (cut_facts_tac prems 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   277
    (etac ex1E 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   278
    (rtac trans 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   279
    (rtac sym 2),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   280
    (REPEAT (eresolve_tac [asm_rl, spec RS mp] 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   281
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   282
(** Polymorphic congruence rules **)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   283
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   284
val subst_context = prove_goal IFOL.thy 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   285
   "[| a=b |]  ==>  t(a)=t(b)"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   286
 (fn prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   287
  [ (resolve_tac (prems RL [ssubst]) 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   288
    (resolve_tac [refl] 1) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   289
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   290
val subst_context2 = prove_goal IFOL.thy 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   291
   "[| a=b;  c=d |]  ==>  t(a,c)=t(b,d)"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   292
 (fn prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   293
  [ (EVERY1 (map rtac ((prems RL [ssubst]) @ [refl]))) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   294
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   295
val subst_context3 = prove_goal IFOL.thy 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   296
   "[| a=b;  c=d;  e=f |]  ==>  t(a,c,e)=t(b,d,f)"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   297
 (fn prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   298
  [ (EVERY1 (map rtac ((prems RL [ssubst]) @ [refl]))) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   299
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   300
(*Useful with eresolve_tac for proving equalties from known equalities.
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   301
	a = b
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   302
	|   |
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   303
	c = d	*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   304
val box_equals = prove_goal IFOL.thy
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   305
    "[| a=b;  a=c;  b=d |] ==> c=d"  
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   306
 (fn prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   307
  [ (resolve_tac [trans] 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   308
    (resolve_tac [trans] 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   309
    (resolve_tac [sym] 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   310
    (REPEAT (resolve_tac prems 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   311
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   312
(*Dual of box_equals: for proving equalities backwards*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   313
val simp_equals = prove_goal IFOL.thy
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   314
    "[| a=c;  b=d;  c=d |] ==> a=b"  
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   315
 (fn prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   316
  [ (resolve_tac [trans] 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   317
    (resolve_tac [trans] 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   318
    (REPEAT (resolve_tac (prems @ (prems RL [sym])) 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   319
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   320
(** Congruence rules for predicate letters **)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   321
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   322
val pred1_cong = prove_goal IFOL.thy
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   323
    "a=a' ==> P(a) <-> P(a')"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   324
 (fn prems =>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   325
  [ (cut_facts_tac prems 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   326
    (rtac iffI 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   327
    (DEPTH_SOLVE (eresolve_tac [asm_rl, subst, ssubst] 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   328
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   329
val pred2_cong = prove_goal IFOL.thy
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   330
    "[| a=a';  b=b' |] ==> P(a,b) <-> P(a',b')"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   331
 (fn prems =>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   332
  [ (cut_facts_tac prems 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   333
    (rtac iffI 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   334
    (DEPTH_SOLVE (eresolve_tac [asm_rl, subst, ssubst] 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   335
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   336
val pred3_cong = prove_goal IFOL.thy
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   337
    "[| a=a';  b=b';  c=c' |] ==> P(a,b,c) <-> P(a',b',c')"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   338
 (fn prems =>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   339
  [ (cut_facts_tac prems 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   340
    (rtac iffI 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   341
    (DEPTH_SOLVE (eresolve_tac [asm_rl, subst, ssubst] 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   342
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   343
(*special cases for free variables P, Q, R, S -- up to 3 arguments*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   344
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   345
val pred_congs = 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   346
    flat (map (fn c => 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   347
	       map (fn th => read_instantiate [("P",c)] th)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   348
		   [pred1_cong,pred2_cong,pred3_cong])
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   349
	       (explode"PQRS"));
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   350
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   351
(*special case for the equality predicate!*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   352
val eq_cong = read_instantiate [("P","op =")] pred2_cong;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   353
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   354
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   355
(*** Simplifications of assumed implications.
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   356
     Roy Dyckhoff has proved that conj_impE, disj_impE, and imp_impE
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   357
     used with mp_tac (restricted to atomic formulae) is COMPLETE for 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   358
     intuitionistic propositional logic.  See
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   359
   R. Dyckhoff, Contraction-free sequent calculi for intuitionistic logic
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   360
    (preprint, University of St Andrews, 1991)  ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   361
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   362
val conj_impE = prove_goal IFOL.thy 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   363
    "[| (P&Q)-->S;  P-->(Q-->S) ==> R |] ==> R"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   364
 (fn major::prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   365
  [ (REPEAT (ares_tac ([conjI, impI, major RS mp]@prems) 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   366
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   367
val disj_impE = prove_goal IFOL.thy 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   368
    "[| (P|Q)-->S;  [| P-->S; Q-->S |] ==> R |] ==> R"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   369
 (fn major::prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   370
  [ (DEPTH_SOLVE (ares_tac ([disjI1, disjI2, impI, major RS mp]@prems) 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   371
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   372
(*Simplifies the implication.  Classical version is stronger. 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   373
  Still UNSAFE since Q must be provable -- backtracking needed.  *)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   374
val imp_impE = prove_goal IFOL.thy 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   375
    "[| (P-->Q)-->S;  [| P; Q-->S |] ==> Q;  S ==> R |] ==> R"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   376
 (fn major::prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   377
  [ (REPEAT (ares_tac ([impI, major RS mp]@prems) 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   378
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   379
(*Simplifies the implication.  Classical version is stronger. 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   380
  Still UNSAFE since ~P must be provable -- backtracking needed.  *)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   381
val not_impE = prove_goal IFOL.thy
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   382
    "[| ~P --> S;  P ==> False;  S ==> R |] ==> R"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   383
 (fn major::prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   384
  [ (REPEAT (ares_tac ([notI, impI, major RS mp]@prems) 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   385
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   386
(*Simplifies the implication.   UNSAFE.  *)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   387
val iff_impE = prove_goal IFOL.thy 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   388
    "[| (P<->Q)-->S;  [| P; Q-->S |] ==> Q;  [| Q; P-->S |] ==> P;  \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   389
\       S ==> R |] ==> R"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   390
 (fn major::prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   391
  [ (REPEAT (ares_tac ([iffI, impI, major RS mp]@prems) 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   392
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   393
(*What if (ALL x.~~P(x)) --> ~~(ALL x.P(x)) is an assumption? UNSAFE*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   394
val all_impE = prove_goal IFOL.thy 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   395
    "[| (ALL x.P(x))-->S;  !!x.P(x);  S ==> R |] ==> R"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   396
 (fn major::prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   397
  [ (REPEAT (ares_tac ([allI, impI, major RS mp]@prems) 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   398
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   399
(*Unsafe: (EX x.P(x))-->S  is equivalent to  ALL x.P(x)-->S.  *)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   400
val ex_impE = prove_goal IFOL.thy 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   401
    "[| (EX x.P(x))-->S;  P(x)-->S ==> R |] ==> R"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   402
 (fn major::prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   403
  [ (REPEAT (ares_tac ([exI, impI, major RS mp]@prems) 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   404
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   405
end;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   406
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   407
open IFOL_Lemmas;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   408