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