src/HOL/simpdata.ML
author wenzelm
Tue Sep 05 18:46:36 2000 +0200 (2000-09-05 ago)
changeset 9851 e22db9397e17
parent 9832 2092298f7421
child 9875 c50349d252b7
permissions -rw-r--r--
iff declarations moved to clasimp.ML;
     1 (*  Title:      HOL/simpdata.ML
     2     ID:         $Id$
     3     Author:     Tobias Nipkow
     4     Copyright   1991  University of Cambridge
     5 
     6 Instantiation of the generic simplifier for HOL.
     7 *)
     8 
     9 section "Simplifier";
    10 
    11 val [prem] = goal (the_context ()) "x==y ==> x=y";
    12 by (rewtac prem);
    13 by (rtac refl 1);
    14 qed "meta_eq_to_obj_eq";
    15 
    16 Goal "(%s. f s) = f";
    17 br refl 1;
    18 qed "eta_contract_eq";
    19 
    20 local
    21 
    22   fun prover s = prove_goal (the_context ()) s (fn _ => [(Blast_tac 1)]);
    23 
    24 in
    25 
    26 (*Make meta-equalities.  The operator below is Trueprop*)
    27 
    28 fun mk_meta_eq r = r RS eq_reflection;
    29 fun safe_mk_meta_eq r = mk_meta_eq r handle Thm.THM _ => r;
    30 
    31 val Eq_TrueI  = mk_meta_eq(prover  "P --> (P = True)"  RS mp);
    32 val Eq_FalseI = mk_meta_eq(prover "~P --> (P = False)" RS mp);
    33 
    34 fun mk_eq th = case concl_of th of
    35         Const("==",_)$_$_       => th
    36     |   _$(Const("op =",_)$_$_) => mk_meta_eq th
    37     |   _$(Const("Not",_)$_)    => th RS Eq_FalseI
    38     |   _                       => th RS Eq_TrueI;
    39 (* last 2 lines requires all formulae to be of the from Trueprop(.) *)
    40 
    41 fun mk_eq_True r = Some(r RS meta_eq_to_obj_eq RS Eq_TrueI);
    42 
    43 (*Congruence rules for = (instead of ==)*)
    44 fun mk_meta_cong rl =
    45   standard(mk_meta_eq(replicate (nprems_of rl) meta_eq_to_obj_eq MRS rl))
    46   handle THM _ =>
    47   error("Premises and conclusion of congruence rules must be =-equalities");
    48 
    49 val not_not = prover "(~ ~ P) = P";
    50 
    51 val simp_thms = [not_not] @ map prover
    52  [ "(x=x) = True",
    53    "(~True) = False", "(~False) = True",
    54    "(~P) ~= P", "P ~= (~P)", "(P ~= Q) = (P = (~Q))",
    55    "(True=P) = P", "(P=True) = P", "(False=P) = (~P)", "(P=False) = (~P)",
    56    "(True --> P) = P", "(False --> P) = True",
    57    "(P --> True) = True", "(P --> P) = True",
    58    "(P --> False) = (~P)", "(P --> ~P) = (~P)",
    59    "(P & True) = P", "(True & P) = P",
    60    "(P & False) = False", "(False & P) = False",
    61    "(P & P) = P", "(P & (P & Q)) = (P & Q)",
    62    "(P & ~P) = False",    "(~P & P) = False",
    63    "(P | True) = True", "(True | P) = True",
    64    "(P | False) = P", "(False | P) = P",
    65    "(P | P) = P", "(P | (P | Q)) = (P | Q)",
    66    "(P | ~P) = True",    "(~P | P) = True",
    67    "((~P) = (~Q)) = (P=Q)",
    68    "(!x. P) = P", "(? x. P) = P", "? x. x=t", "? x. t=x",
    69 (*two needed for the one-point-rule quantifier simplification procs*)
    70    "(? x. x=t & P(x)) = P(t)",          (*essential for termination!!*)
    71    "(! x. t=x --> P(x)) = P(t)" ];      (*covers a stray case*)
    72 
    73 val imp_cong = impI RSN
    74     (2, prove_goal (the_context ()) "(P=P')--> (P'--> (Q=Q'))--> ((P-->Q) = (P'-->Q'))"
    75         (fn _=> [(Blast_tac 1)]) RS mp RS mp);
    76 
    77 (*Miniscoping: pushing in existential quantifiers*)
    78 val ex_simps = map prover
    79                 ["(EX x. P x & Q)   = ((EX x. P x) & Q)",
    80                  "(EX x. P & Q x)   = (P & (EX x. Q x))",
    81                  "(EX x. P x | Q)   = ((EX x. P x) | Q)",
    82                  "(EX x. P | Q x)   = (P | (EX x. Q x))",
    83                  "(EX x. P x --> Q) = ((ALL x. P x) --> Q)",
    84                  "(EX x. P --> Q x) = (P --> (EX x. Q x))"];
    85 
    86 (*Miniscoping: pushing in universal quantifiers*)
    87 val all_simps = map prover
    88                 ["(ALL x. P x & Q)   = ((ALL x. P x) & Q)",
    89                  "(ALL x. P & Q x)   = (P & (ALL x. Q x))",
    90                  "(ALL x. P x | Q)   = ((ALL x. P x) | Q)",
    91                  "(ALL x. P | Q x)   = (P | (ALL x. Q x))",
    92                  "(ALL x. P x --> Q) = ((EX x. P x) --> Q)",
    93                  "(ALL x. P --> Q x) = (P --> (ALL x. Q x))"];
    94 
    95 
    96 (* elimination of existential quantifiers in assumptions *)
    97 
    98 val ex_all_equiv =
    99   let val lemma1 = prove_goal (the_context ())
   100         "(? x. P(x) ==> PROP Q) ==> (!!x. P(x) ==> PROP Q)"
   101         (fn prems => [resolve_tac prems 1, etac exI 1]);
   102       val lemma2 = prove_goalw (the_context ()) [Ex_def]
   103         "(!!x. P(x) ==> PROP Q) ==> (? x. P(x) ==> PROP Q)"
   104         (fn prems => [(REPEAT(resolve_tac prems 1))])
   105   in equal_intr lemma1 lemma2 end;
   106 
   107 end;
   108 
   109 bind_thms ("ex_simps", ex_simps);
   110 bind_thms ("all_simps", all_simps);
   111 bind_thm ("not_not", not_not);
   112 
   113 (* Elimination of True from asumptions: *)
   114 
   115 val True_implies_equals = prove_goal (the_context ())
   116  "(True ==> PROP P) == PROP P"
   117 (fn _ => [rtac equal_intr_rule 1, atac 2,
   118           METAHYPS (fn prems => resolve_tac prems 1) 1,
   119           rtac TrueI 1]);
   120 
   121 fun prove nm thm  = qed_goal nm (the_context ()) thm (fn _ => [(Blast_tac 1)]);
   122 
   123 prove "eq_commute" "(a=b) = (b=a)";
   124 prove "eq_left_commute" "(P=(Q=R)) = (Q=(P=R))";
   125 prove "eq_assoc" "((P=Q)=R) = (P=(Q=R))";
   126 val eq_ac = [eq_commute, eq_left_commute, eq_assoc];
   127 
   128 prove "neq_commute" "(a~=b) = (b~=a)";
   129 
   130 prove "conj_commute" "(P&Q) = (Q&P)";
   131 prove "conj_left_commute" "(P&(Q&R)) = (Q&(P&R))";
   132 val conj_comms = [conj_commute, conj_left_commute];
   133 prove "conj_assoc" "((P&Q)&R) = (P&(Q&R))";
   134 
   135 prove "disj_commute" "(P|Q) = (Q|P)";
   136 prove "disj_left_commute" "(P|(Q|R)) = (Q|(P|R))";
   137 val disj_comms = [disj_commute, disj_left_commute];
   138 prove "disj_assoc" "((P|Q)|R) = (P|(Q|R))";
   139 
   140 prove "conj_disj_distribL" "(P&(Q|R)) = (P&Q | P&R)";
   141 prove "conj_disj_distribR" "((P|Q)&R) = (P&R | Q&R)";
   142 
   143 prove "disj_conj_distribL" "(P|(Q&R)) = ((P|Q) & (P|R))";
   144 prove "disj_conj_distribR" "((P&Q)|R) = ((P|R) & (Q|R))";
   145 
   146 prove "imp_conjR" "(P --> (Q&R)) = ((P-->Q) & (P-->R))";
   147 prove "imp_conjL" "((P&Q) -->R)  = (P --> (Q --> R))";
   148 prove "imp_disjL" "((P|Q) --> R) = ((P-->R)&(Q-->R))";
   149 
   150 (*These two are specialized, but imp_disj_not1 is useful in Auth/Yahalom.ML*)
   151 prove "imp_disj_not1" "(P --> Q | R) = (~Q --> P --> R)";
   152 prove "imp_disj_not2" "(P --> Q | R) = (~R --> P --> Q)";
   153 
   154 prove "imp_disj1" "((P-->Q)|R) = (P--> Q|R)";
   155 prove "imp_disj2" "(Q|(P-->R)) = (P--> Q|R)";
   156 
   157 prove "de_Morgan_disj" "(~(P | Q)) = (~P & ~Q)";
   158 prove "de_Morgan_conj" "(~(P & Q)) = (~P | ~Q)";
   159 prove "not_imp" "(~(P --> Q)) = (P & ~Q)";
   160 prove "not_iff" "(P~=Q) = (P = (~Q))";
   161 prove "disj_not1" "(~P | Q) = (P --> Q)";
   162 prove "disj_not2" "(P | ~Q) = (Q --> P)"; (* changes orientation :-( *)
   163 prove "imp_conv_disj" "(P --> Q) = ((~P) | Q)";
   164 
   165 prove "iff_conv_conj_imp" "(P = Q) = ((P --> Q) & (Q --> P))";
   166 
   167 
   168 (*Avoids duplication of subgoals after split_if, when the true and false
   169   cases boil down to the same thing.*)
   170 prove "cases_simp" "((P --> Q) & (~P --> Q)) = Q";
   171 
   172 prove "not_all" "(~ (! x. P(x))) = (? x.~P(x))";
   173 prove "imp_all" "((! x. P x) --> Q) = (? x. P x --> Q)";
   174 prove "not_ex"  "(~ (? x. P(x))) = (! x.~P(x))";
   175 prove "imp_ex" "((? x. P x) --> Q) = (! x. P x --> Q)";
   176 
   177 prove "ex_disj_distrib" "(? x. P(x) | Q(x)) = ((? x. P(x)) | (? x. Q(x)))";
   178 prove "all_conj_distrib" "(!x. P(x) & Q(x)) = ((! x. P(x)) & (! x. Q(x)))";
   179 
   180 (* '&' congruence rule: not included by default!
   181    May slow rewrite proofs down by as much as 50% *)
   182 
   183 let val th = prove_goal (the_context ())
   184                 "(P=P')--> (P'--> (Q=Q'))--> ((P&Q) = (P'&Q'))"
   185                 (fn _=> [(Blast_tac 1)])
   186 in  bind_thm("conj_cong",standard (impI RSN (2, th RS mp RS mp)))  end;
   187 
   188 let val th = prove_goal (the_context ())
   189                 "(Q=Q')--> (Q'--> (P=P'))--> ((P&Q) = (P'&Q'))"
   190                 (fn _=> [(Blast_tac 1)])
   191 in  bind_thm("rev_conj_cong",standard (impI RSN (2, th RS mp RS mp)))  end;
   192 
   193 (* '|' congruence rule: not included by default! *)
   194 
   195 let val th = prove_goal (the_context ())
   196                 "(P=P')--> (~P'--> (Q=Q'))--> ((P|Q) = (P'|Q'))"
   197                 (fn _=> [(Blast_tac 1)])
   198 in  bind_thm("disj_cong",standard (impI RSN (2, th RS mp RS mp)))  end;
   199 
   200 prove "eq_sym_conv" "(x=y) = (y=x)";
   201 
   202 
   203 (** if-then-else rules **)
   204 
   205 Goalw [if_def] "(if True then x else y) = x";
   206 by (Blast_tac 1);
   207 qed "if_True";
   208 
   209 Goalw [if_def] "(if False then x else y) = y";
   210 by (Blast_tac 1);
   211 qed "if_False";
   212 
   213 Goalw [if_def] "P ==> (if P then x else y) = x";
   214 by (Blast_tac 1);
   215 qed "if_P";
   216 
   217 Goalw [if_def] "~P ==> (if P then x else y) = y";
   218 by (Blast_tac 1);
   219 qed "if_not_P";
   220 
   221 Goal "P(if Q then x else y) = ((Q --> P(x)) & (~Q --> P(y)))";
   222 by (res_inst_tac [("Q","Q")] (excluded_middle RS disjE) 1);
   223 by (stac if_P 2);
   224 by (stac if_not_P 1);
   225 by (ALLGOALS (Blast_tac));
   226 qed "split_if";
   227 
   228 Goal "P(if Q then x else y) = (~((Q & ~P x) | (~Q & ~P y)))";
   229 by (stac split_if 1);
   230 by (Blast_tac 1);
   231 qed "split_if_asm";
   232 
   233 bind_thms ("if_splits", [split_if, split_if_asm]);
   234 
   235 Goal "(if c then x else x) = x";
   236 by (stac split_if 1);
   237 by (Blast_tac 1);
   238 qed "if_cancel";
   239 
   240 Goal "(if x = y then y else x) = x";
   241 by (stac split_if 1);
   242 by (Blast_tac 1);
   243 qed "if_eq_cancel";
   244 
   245 (*This form is useful for expanding IFs on the RIGHT of the ==> symbol*)
   246 Goal "(if P then Q else R) = ((P-->Q) & (~P-->R))";
   247 by (rtac split_if 1);
   248 qed "if_bool_eq_conj";
   249 
   250 (*And this form is useful for expanding IFs on the LEFT*)
   251 Goal "(if P then Q else R) = ((P&Q) | (~P&R))";
   252 by (stac split_if 1);
   253 by (Blast_tac 1);
   254 qed "if_bool_eq_disj";
   255 
   256 
   257 (*** make simplification procedures for quantifier elimination ***)
   258 
   259 structure Quantifier1 = Quantifier1Fun
   260 (struct
   261   (*abstract syntax*)
   262   fun dest_eq((c as Const("op =",_)) $ s $ t) = Some(c,s,t)
   263     | dest_eq _ = None;
   264   fun dest_conj((c as Const("op &",_)) $ s $ t) = Some(c,s,t)
   265     | dest_conj _ = None;
   266   val conj = HOLogic.conj
   267   val imp  = HOLogic.imp
   268   (*rules*)
   269   val iff_reflection = eq_reflection
   270   val iffI = iffI
   271   val sym  = sym
   272   val conjI= conjI
   273   val conjE= conjE
   274   val impI = impI
   275   val impE = impE
   276   val mp   = mp
   277   val exI  = exI
   278   val exE  = exE
   279   val allI = allI
   280   val allE = allE
   281 end);
   282 
   283 local
   284 val ex_pattern =
   285   Thm.read_cterm (Theory.sign_of (the_context ())) ("EX x. P(x) & Q(x)",HOLogic.boolT)
   286 
   287 val all_pattern =
   288   Thm.read_cterm (Theory.sign_of (the_context ())) ("ALL x. P(x) & P'(x) --> Q(x)",HOLogic.boolT)
   289 
   290 in
   291 val defEX_regroup =
   292   mk_simproc "defined EX" [ex_pattern] Quantifier1.rearrange_ex;
   293 val defALL_regroup =
   294   mk_simproc "defined ALL" [all_pattern] Quantifier1.rearrange_all;
   295 end;
   296 
   297 
   298 (*** Case splitting ***)
   299 
   300 structure SplitterData =
   301   struct
   302   structure Simplifier = Simplifier
   303   val mk_eq          = mk_eq
   304   val meta_eq_to_iff = meta_eq_to_obj_eq
   305   val iffD           = iffD2
   306   val disjE          = disjE
   307   val conjE          = conjE
   308   val exE            = exE
   309   val contrapos      = contrapos
   310   val contrapos2     = contrapos2
   311   val notnotD        = notnotD
   312   end;
   313 
   314 structure Splitter = SplitterFun(SplitterData);
   315 
   316 val split_tac        = Splitter.split_tac;
   317 val split_inside_tac = Splitter.split_inside_tac;
   318 val split_asm_tac    = Splitter.split_asm_tac;
   319 val op addsplits     = Splitter.addsplits;
   320 val op delsplits     = Splitter.delsplits;
   321 val Addsplits        = Splitter.Addsplits;
   322 val Delsplits        = Splitter.Delsplits;
   323 
   324 (*In general it seems wrong to add distributive laws by default: they
   325   might cause exponential blow-up.  But imp_disjL has been in for a while
   326   and cannot be removed without affecting existing proofs.  Moreover,
   327   rewriting by "(P|Q --> R) = ((P-->R)&(Q-->R))" might be justified on the
   328   grounds that it allows simplification of R in the two cases.*)
   329 
   330 fun gen_all th = forall_elim_vars (#maxidx(rep_thm th)+1) th;
   331 
   332 val mksimps_pairs =
   333   [("op -->", [mp]), ("op &", [conjunct1,conjunct2]),
   334    ("All", [spec]), ("True", []), ("False", []),
   335    ("If", [if_bool_eq_conj RS iffD1])];
   336 
   337 (* ###FIXME: move to Provers/simplifier.ML
   338 val mk_atomize:      (string * thm list) list -> thm -> thm list
   339 *)
   340 (* ###FIXME: move to Provers/simplifier.ML *)
   341 fun mk_atomize pairs =
   342   let fun atoms th =
   343         (case concl_of th of
   344            Const("Trueprop",_) $ p =>
   345              (case head_of p of
   346                 Const(a,_) =>
   347                   (case assoc(pairs,a) of
   348                      Some(rls) => flat (map atoms ([th] RL rls))
   349                    | None => [th])
   350               | _ => [th])
   351          | _ => [th])
   352   in atoms end;
   353 
   354 fun mksimps pairs = (map mk_eq o mk_atomize pairs o gen_all);
   355 
   356 fun unsafe_solver_tac prems =
   357   FIRST'[resolve_tac(reflexive_thm::TrueI::refl::prems), atac, etac FalseE];
   358 val unsafe_solver = mk_solver "HOL unsafe" unsafe_solver_tac;
   359 
   360 (*No premature instantiation of variables during simplification*)
   361 fun safe_solver_tac prems =
   362   FIRST'[match_tac(reflexive_thm::TrueI::refl::prems),
   363          eq_assume_tac, ematch_tac [FalseE]];
   364 val safe_solver = mk_solver "HOL safe" safe_solver_tac;
   365 
   366 val HOL_basic_ss =
   367   empty_ss setsubgoaler asm_simp_tac
   368     setSSolver safe_solver
   369     setSolver unsafe_solver
   370     setmksimps (mksimps mksimps_pairs)
   371     setmkeqTrue mk_eq_True
   372     setmkcong mk_meta_cong;
   373 
   374 val HOL_ss =
   375     HOL_basic_ss addsimps
   376      ([triv_forall_equality, (* prunes params *)
   377        True_implies_equals, (* prune asms `True' *)
   378        eta_contract_eq, (* prunes eta-expansions *)
   379        if_True, if_False, if_cancel, if_eq_cancel,
   380        imp_disjL, conj_assoc, disj_assoc,
   381        de_Morgan_conj, de_Morgan_disj, imp_disj1, imp_disj2, not_imp,
   382        disj_not1, not_all, not_ex, cases_simp, Eps_eq, Eps_sym_eq,
   383        thm"plus_ac0.zero", thm"plus_ac0_zero_right"]
   384      @ ex_simps @ all_simps @ simp_thms)
   385      addsimprocs [defALL_regroup,defEX_regroup]
   386      addcongs [imp_cong]
   387      addsplits [split_if];
   388 
   389 (*Simplifies x assuming c and y assuming ~c*)
   390 val prems = Goalw [if_def]
   391   "[| b=c; c ==> x=u; ~c ==> y=v |] ==> \
   392 \  (if b then x else y) = (if c then u else v)";
   393 by (asm_simp_tac (HOL_ss addsimps prems) 1);
   394 qed "if_cong";
   395 
   396 (*Prevents simplification of x and y: faster and allows the execution
   397   of functional programs. NOW THE DEFAULT.*)
   398 Goal "b=c ==> (if b then x else y) = (if c then x else y)";
   399 by (etac arg_cong 1);
   400 qed "if_weak_cong";
   401 
   402 (*Prevents simplification of t: much faster*)
   403 Goal "a = b ==> (let x=a in t(x)) = (let x=b in t(x))";
   404 by (etac arg_cong 1);
   405 qed "let_weak_cong";
   406 
   407 Goal "f(if c then x else y) = (if c then f x else f y)";
   408 by (simp_tac (HOL_ss setloop (split_tac [split_if])) 1);
   409 qed "if_distrib";
   410 
   411 (*For expand_case_tac*)
   412 val prems = Goal "[| P ==> Q(True); ~P ==> Q(False) |] ==> Q(P)";
   413 by (case_tac "P" 1);
   414 by (ALLGOALS (asm_simp_tac (HOL_ss addsimps prems)));
   415 qed "expand_case";
   416 
   417 (*Used in Auth proofs.  Typically P contains Vars that become instantiated
   418   during unification.*)
   419 fun expand_case_tac P i =
   420     res_inst_tac [("P",P)] expand_case i THEN
   421     Simp_tac (i+1) THEN
   422     Simp_tac i;
   423 
   424 (*This lemma restricts the effect of the rewrite rule u=v to the left-hand
   425   side of an equality.  Used in {Integ,Real}/simproc.ML*)
   426 Goal "x=y ==> (x=z) = (y=z)";
   427 by (asm_simp_tac HOL_ss 1);
   428 qed "restrict_to_left";
   429 
   430 (* default simpset *)
   431 val simpsetup =
   432   [fn thy => (simpset_ref_of thy := HOL_ss addcongs [if_weak_cong]; thy)];
   433 
   434 (*** conversion of -->/! into ==>/!! ***)
   435 
   436 local
   437   val rules = [symmetric(thm"all_eq"),symmetric(thm"imp_eq"),Drule.norm_hhf_eq]
   438   val ss = HOL_basic_ss addsimps rules
   439 in
   440 
   441 val rulify = zero_var_indexes o strip_shyps_warning o forall_elim_vars_safe o simplify ss;
   442 
   443 fun qed_spec_mp name = ThmDatabase.ml_store_thm(name, rulify(result()));
   444 
   445 fun qed_goal_spec_mp name thy s p = 
   446 	bind_thm (name, rulify (prove_goal thy s p));
   447 
   448 fun qed_goalw_spec_mp name thy defs s p = 
   449 	bind_thm (name, rulify (prove_goalw thy defs s p));
   450 
   451 end;
   452 
   453 local
   454 
   455 fun gen_rulify x =
   456   Attrib.no_args (Drule.rule_attribute (fn _ => rulify)) x;
   457 
   458 in
   459 
   460 val rulify_attrib_setup =
   461  [Attrib.add_attributes
   462   [("rulify", (gen_rulify, gen_rulify), "put theorem into standard rule form")]];
   463 
   464 end;
   465 
   466 (*** integration of simplifier with classical reasoner ***)
   467 
   468 structure Clasimp = ClasimpFun
   469  (structure Simplifier = Simplifier and Splitter = Splitter
   470   and Classical  = Classical and Blast = Blast
   471   val dest_Trueprop = HOLogic.dest_Trueprop
   472   val iff_const = HOLogic.eq_const HOLogic.boolT
   473   val not_const = HOLogic.not_const
   474   val notE = notE val iffD1 = iffD1 val iffD2 = iffD2
   475   val cla_make_elim = cla_make_elim);
   476 open Clasimp;
   477 
   478 val HOL_css = (HOL_cs, HOL_ss);
   479 
   480 
   481 
   482 (*** A general refutation procedure ***)
   483 
   484 (* Parameters:
   485 
   486    test: term -> bool
   487    tests if a term is at all relevant to the refutation proof;
   488    if not, then it can be discarded. Can improve performance,
   489    esp. if disjunctions can be discarded (no case distinction needed!).
   490 
   491    prep_tac: int -> tactic
   492    A preparation tactic to be applied to the goal once all relevant premises
   493    have been moved to the conclusion.
   494 
   495    ref_tac: int -> tactic
   496    the actual refutation tactic. Should be able to deal with goals
   497    [| A1; ...; An |] ==> False
   498    where the Ai are atomic, i.e. no top-level &, | or ?
   499 *)
   500 
   501 fun refute_tac test prep_tac ref_tac =
   502   let val nnf_simps =
   503         [imp_conv_disj,iff_conv_conj_imp,de_Morgan_disj,de_Morgan_conj,
   504          not_all,not_ex,not_not];
   505       val nnf_simpset =
   506         empty_ss setmkeqTrue mk_eq_True
   507                  setmksimps (mksimps mksimps_pairs)
   508                  addsimps nnf_simps;
   509       val prem_nnf_tac = full_simp_tac nnf_simpset;
   510 
   511       val refute_prems_tac =
   512         REPEAT(eresolve_tac [conjE, exE] 1 ORELSE
   513                filter_prems_tac test 1 ORELSE
   514                etac disjE 1) THEN
   515         ref_tac 1;
   516   in EVERY'[TRY o filter_prems_tac test,
   517             DETERM o REPEAT o etac rev_mp, prep_tac, rtac ccontr, prem_nnf_tac,
   518             SELECT_GOAL (DEPTH_SOLVE refute_prems_tac)]
   519   end;