src/HOL/simpdata.ML
author paulson
Fri Nov 28 11:00:42 1997 +0100 (1997-11-28)
changeset 4327 2335f6584a1b
parent 4321 2a2956ccb86c
child 4351 36b28f78ed1b
permissions -rw-r--r--
Added comments
     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
     7 *)
     8 
     9 section "Simplifier";
    10 
    11 open Simplifier;
    12 
    13 (*** Addition of rules to simpsets and clasets simultaneously ***)
    14 
    15 (*Takes UNCONDITIONAL theorems of the form A<->B to 
    16         the Safe Intr     rule B==>A and 
    17         the Safe Destruct rule A==>B.
    18   Also ~A goes to the Safe Elim rule A ==> ?R
    19   Failing other cases, A is added as a Safe Intr rule*)
    20 local
    21   val iff_const = HOLogic.eq_const HOLogic.boolT;
    22 
    23   fun addIff th = 
    24       (case HOLogic.dest_Trueprop (#prop(rep_thm th)) of
    25                 (Const("Not",_) $ A) =>
    26                     AddSEs [zero_var_indexes (th RS notE)]
    27               | (con $ _ $ _) =>
    28                     if con=iff_const
    29                     then (AddSIs [zero_var_indexes (th RS iffD2)];  
    30                           AddSDs [zero_var_indexes (th RS iffD1)])
    31                     else  AddSIs [th]
    32               | _ => AddSIs [th];
    33        Addsimps [th])
    34       handle _ => error ("AddIffs: theorem must be unconditional\n" ^ 
    35                          string_of_thm th)
    36 
    37   fun delIff th = 
    38       (case HOLogic.dest_Trueprop (#prop(rep_thm th)) of
    39                 (Const("Not",_) $ A) =>
    40                     Delrules [zero_var_indexes (th RS notE)]
    41               | (con $ _ $ _) =>
    42                     if con=iff_const
    43                     then Delrules [zero_var_indexes (th RS iffD2),
    44                                    make_elim (zero_var_indexes (th RS iffD1))]
    45                     else Delrules [th]
    46               | _ => Delrules [th];
    47        Delsimps [th])
    48       handle _ => warning("DelIffs: ignoring conditional theorem\n" ^ 
    49                           string_of_thm th)
    50 in
    51 val AddIffs = seq addIff
    52 val DelIffs = seq delIff
    53 end;
    54 
    55 (** instantiate generic simp procs for `quantifier elimination': **)
    56 structure Quantifier1 = Quantifier1Fun(
    57 struct
    58   (*abstract syntax*)
    59   fun dest_eq((c as Const("op =",_)) $ s $ t) = Some(c,s,t)
    60     | dest_eq _ = None;
    61   fun dest_conj((c as Const("op &",_)) $ s $ t) = Some(c,s,t)
    62     | dest_conj _ = None;
    63   val conj = HOLogic.conj
    64   val imp  = HOLogic.imp
    65   (*rules*)
    66   val iff_reflection = eq_reflection
    67   val iffI = iffI
    68   val sym  = sym
    69   val conjI= conjI
    70   val conjE= conjE
    71   val impI = impI
    72   val impE = impE
    73   val mp   = mp
    74   val exI  = exI
    75   val exE  = exE
    76   val allI = allI
    77   val allE = allE
    78 end);
    79 
    80 
    81 local
    82 
    83   fun prover s = prove_goal HOL.thy s (fn _ => [blast_tac HOL_cs 1]);
    84 
    85   val P_imp_P_iff_True = prover "P --> (P = True)" RS mp;
    86   val P_imp_P_eq_True = P_imp_P_iff_True RS eq_reflection;
    87 
    88   val not_P_imp_P_iff_F = prover "~P --> (P = False)" RS mp;
    89   val not_P_imp_P_eq_False = not_P_imp_P_iff_F RS eq_reflection;
    90 
    91   fun atomize pairs =
    92     let fun atoms th =
    93           (case concl_of th of
    94              Const("Trueprop",_) $ p =>
    95                (case head_of p of
    96                   Const(a,_) =>
    97                     (case assoc(pairs,a) of
    98                        Some(rls) => flat (map atoms ([th] RL rls))
    99                      | None => [th])
   100                 | _ => [th])
   101            | _ => [th])
   102     in atoms end;
   103 
   104   fun gen_all th = forall_elim_vars (#maxidx(rep_thm th)+1) th;
   105 
   106 in
   107 
   108   fun mk_meta_eq r = r RS eq_reflection;
   109 
   110   fun mk_meta_eq_simp r = case concl_of r of
   111           Const("==",_)$_$_ => r
   112       |   _$(Const("op =",_)$lhs$rhs) =>
   113              (case fst(Logic.rewrite_rule_ok (#sign(rep_thm r)) (prems_of r) lhs rhs) of
   114                 None => mk_meta_eq r
   115               | Some _ => r RS P_imp_P_eq_True)
   116       |   _$(Const("Not",_)$_) => r RS not_P_imp_P_eq_False
   117       |   _ => r RS P_imp_P_eq_True;
   118   (* last 2 lines requires all formulae to be of the from Trueprop(.) *)
   119 
   120 val simp_thms = map prover
   121  [ "(x=x) = True",
   122    "(~True) = False", "(~False) = True", "(~ ~ P) = P",
   123    "(~P) ~= P", "P ~= (~P)", "(P ~= Q) = (P = (~Q))",
   124    "(True=P) = P", "(P=True) = P",
   125    "(True --> P) = P", "(False --> P) = True", 
   126    "(P --> True) = True", "(P --> P) = True",
   127    "(P --> False) = (~P)", "(P --> ~P) = (~P)",
   128    "(P & True) = P", "(True & P) = P", 
   129    "(P & False) = False", "(False & P) = False",
   130    "(P & P) = P", "(P & (P & Q)) = (P & Q)",
   131    "(P & ~P) = False",    "(~P & P) = False",
   132    "(P | True) = True", "(True | P) = True", 
   133    "(P | False) = P", "(False | P) = P",
   134    "(P | P) = P", "(P | (P | Q)) = (P | Q)",
   135    "(P | ~P) = True",    "(~P | P) = True",
   136    "((~P) = (~Q)) = (P=Q)",
   137    "(!x. P) = P", "(? x. P) = P", "? x. x=t", "? x. t=x", 
   138    "(? x. x=t & P(x)) = P(t)",
   139    "(! x. t=x --> P(x)) = P(t)" ];
   140 
   141 (*Add congruence rules for = (instead of ==) *)
   142 infix 4 addcongs delcongs;
   143 fun ss addcongs congs = ss addeqcongs (map standard (congs RL [eq_reflection]));
   144 fun ss delcongs congs = ss deleqcongs (map standard (congs RL [eq_reflection]));
   145 
   146 fun Addcongs congs = (simpset_ref() := simpset() addcongs congs);
   147 fun Delcongs congs = (simpset_ref() := simpset() delcongs congs);
   148 
   149 fun mksimps pairs = map mk_meta_eq_simp o atomize pairs o gen_all;
   150 
   151 val imp_cong = impI RSN
   152     (2, prove_goal HOL.thy "(P=P')--> (P'--> (Q=Q'))--> ((P-->Q) = (P'-->Q'))"
   153         (fn _=> [blast_tac HOL_cs 1]) RS mp RS mp);
   154 
   155 (*Miniscoping: pushing in existential quantifiers*)
   156 val ex_simps = map prover 
   157                 ["(EX x. P x & Q)   = ((EX x. P x) & Q)",
   158                  "(EX x. P & Q x)   = (P & (EX x. Q x))",
   159                  "(EX x. P x | Q)   = ((EX x. P x) | Q)",
   160                  "(EX x. P | Q x)   = (P | (EX x. Q x))",
   161                  "(EX x. P x --> Q) = ((ALL x. P x) --> Q)",
   162                  "(EX x. P --> Q x) = (P --> (EX x. Q x))"];
   163 
   164 (*Miniscoping: pushing in universal quantifiers*)
   165 val all_simps = map prover
   166                 ["(ALL x. P x & Q)   = ((ALL x. P x) & Q)",
   167                  "(ALL x. P & Q x)   = (P & (ALL x. Q x))",
   168                  "(ALL x. P x | Q)   = ((ALL x. P x) | Q)",
   169                  "(ALL x. P | Q x)   = (P | (ALL x. Q x))",
   170                  "(ALL x. P x --> Q) = ((EX x. P x) --> Q)",
   171                  "(ALL x. P --> Q x) = (P --> (ALL x. Q x))"];
   172 
   173 
   174 (* elimination of existential quantifiers in assumptions *)
   175 
   176 val ex_all_equiv =
   177   let val lemma1 = prove_goal HOL.thy
   178         "(? x. P(x) ==> PROP Q) ==> (!!x. P(x) ==> PROP Q)"
   179         (fn prems => [resolve_tac prems 1, etac exI 1]);
   180       val lemma2 = prove_goalw HOL.thy [Ex_def]
   181         "(!!x. P(x) ==> PROP Q) ==> (? x. P(x) ==> PROP Q)"
   182         (fn prems => [REPEAT(resolve_tac prems 1)])
   183   in equal_intr lemma1 lemma2 end;
   184 
   185 end;
   186 
   187 (* Elimination of True from asumptions: *)
   188 
   189 val True_implies_equals = prove_goal HOL.thy
   190  "(True ==> PROP P) == PROP P"
   191 (fn _ => [rtac equal_intr_rule 1, atac 2,
   192           METAHYPS (fn prems => resolve_tac prems 1) 1,
   193           rtac TrueI 1]);
   194 
   195 fun prove nm thm  = qed_goal nm HOL.thy thm (fn _ => [blast_tac HOL_cs 1]);
   196 
   197 prove "conj_commute" "(P&Q) = (Q&P)";
   198 prove "conj_left_commute" "(P&(Q&R)) = (Q&(P&R))";
   199 val conj_comms = [conj_commute, conj_left_commute];
   200 prove "conj_assoc" "((P&Q)&R) = (P&(Q&R))";
   201 
   202 prove "disj_commute" "(P|Q) = (Q|P)";
   203 prove "disj_left_commute" "(P|(Q|R)) = (Q|(P|R))";
   204 val disj_comms = [disj_commute, disj_left_commute];
   205 prove "disj_assoc" "((P|Q)|R) = (P|(Q|R))";
   206 
   207 prove "conj_disj_distribL" "(P&(Q|R)) = (P&Q | P&R)";
   208 prove "conj_disj_distribR" "((P|Q)&R) = (P&R | Q&R)";
   209 
   210 prove "disj_conj_distribL" "(P|(Q&R)) = ((P|Q) & (P|R))";
   211 prove "disj_conj_distribR" "((P&Q)|R) = ((P|R) & (Q|R))";
   212 
   213 prove "imp_conjR" "(P --> (Q&R)) = ((P-->Q) & (P-->R))";
   214 prove "imp_conjL" "((P&Q) -->R)  = (P --> (Q --> R))";
   215 prove "imp_disjL" "((P|Q) --> R) = ((P-->R)&(Q-->R))";
   216 
   217 (*These two are specialized, but imp_disj_not1 is useful in Auth/Yahalom.ML*)
   218 prove "imp_disj_not1" "((P --> Q | R)) = (~Q --> P --> R)";
   219 prove "imp_disj_not2" "((P --> Q | R)) = (~R --> P --> Q)";
   220 
   221 prove "imp_disj1" "((P-->Q)|R) = (P--> Q|R)";
   222 prove "imp_disj2" "(Q|(P-->R)) = (P--> Q|R)";
   223 
   224 prove "de_Morgan_disj" "(~(P | Q)) = (~P & ~Q)";
   225 prove "de_Morgan_conj" "(~(P & Q)) = (~P | ~Q)";
   226 prove "not_imp" "(~(P --> Q)) = (P & ~Q)";
   227 prove "not_iff" "(P~=Q) = (P = (~Q))";
   228 
   229 (*Avoids duplication of subgoals after expand_if, when the true and false 
   230   cases boil down to the same thing.*) 
   231 prove "cases_simp" "((P --> Q) & (~P --> Q)) = Q";
   232 
   233 prove "not_all" "(~ (! x. P(x))) = (? x.~P(x))";
   234 prove "imp_all" "((! x. P x) --> Q) = (? x. P x --> Q)";
   235 prove "not_ex"  "(~ (? x. P(x))) = (! x.~P(x))";
   236 prove "imp_ex" "((? x. P x) --> Q) = (! x. P x --> Q)";
   237 
   238 prove "ex_disj_distrib" "(? x. P(x) | Q(x)) = ((? x. P(x)) | (? x. Q(x)))";
   239 prove "all_conj_distrib" "(!x. P(x) & Q(x)) = ((! x. P(x)) & (! x. Q(x)))";
   240 
   241 (* '&' congruence rule: not included by default!
   242    May slow rewrite proofs down by as much as 50% *)
   243 
   244 let val th = prove_goal HOL.thy 
   245                 "(P=P')--> (P'--> (Q=Q'))--> ((P&Q) = (P'&Q'))"
   246                 (fn _=> [blast_tac HOL_cs 1])
   247 in  bind_thm("conj_cong",standard (impI RSN (2, th RS mp RS mp)))  end;
   248 
   249 let val th = prove_goal HOL.thy 
   250                 "(Q=Q')--> (Q'--> (P=P'))--> ((P&Q) = (P'&Q'))"
   251                 (fn _=> [blast_tac HOL_cs 1])
   252 in  bind_thm("rev_conj_cong",standard (impI RSN (2, th RS mp RS mp)))  end;
   253 
   254 (* '|' congruence rule: not included by default! *)
   255 
   256 let val th = prove_goal HOL.thy 
   257                 "(P=P')--> (~P'--> (Q=Q'))--> ((P|Q) = (P'|Q'))"
   258                 (fn _=> [blast_tac HOL_cs 1])
   259 in  bind_thm("disj_cong",standard (impI RSN (2, th RS mp RS mp)))  end;
   260 
   261 prove "eq_sym_conv" "(x=y) = (y=x)";
   262 
   263 qed_goalw "o_apply" HOL.thy [o_def] "(f o g) x = f (g x)"
   264  (fn _ => [rtac refl 1]);
   265 
   266 qed_goal "meta_eq_to_obj_eq" HOL.thy "x==y ==> x=y"
   267   (fn [prem] => [rewtac prem, rtac refl 1]);
   268 
   269 qed_goalw "if_True" HOL.thy [if_def] "(if True then x else y) = x"
   270  (fn _=>[blast_tac (HOL_cs addIs [select_equality]) 1]);
   271 
   272 qed_goalw "if_False" HOL.thy [if_def] "(if False then x else y) = y"
   273  (fn _=>[blast_tac (HOL_cs addIs [select_equality]) 1]);
   274 
   275 qed_goal "if_P" HOL.thy "P ==> (if P then x else y) = x"
   276  (fn [prem] => [ stac (prem RS eqTrueI) 1, rtac if_True 1 ]);
   277 (*
   278 qed_goal "if_not_P" HOL.thy "~P ==> (if P then x else y) = y"
   279  (fn [prem] => [ stac (prem RS not_P_imp_P_iff_F) 1, rtac if_False 1 ]);
   280 *)
   281 qed_goalw "if_not_P" HOL.thy [if_def] "!!P. ~P ==> (if P then x else y) = y"
   282  (fn _ => [blast_tac (HOL_cs addIs [select_equality]) 1]);
   283 
   284 qed_goal "expand_if" HOL.thy
   285     "P(if Q then x else y) = ((Q --> P(x)) & (~Q --> P(y)))" (K [
   286 	res_inst_tac [("Q","Q")] (excluded_middle RS disjE) 1,
   287          stac if_P 2,
   288          stac if_not_P 1,
   289          ALLGOALS (blast_tac HOL_cs)]);
   290 
   291 qed_goal "split_if_asm" HOL.thy
   292     "P(if Q then x else y) = (~((Q & ~P x) | (~Q & ~P y)))" (K [
   293 	stac expand_if 1,
   294         blast_tac HOL_cs 1]);
   295 
   296 qed_goal "if_bool_eq" HOL.thy
   297                    "(if P then Q else R) = ((P-->Q) & (~P-->R))"
   298                    (fn _ => [rtac expand_if 1]);
   299 
   300 (** make simp procs for quantifier elimination **)
   301 local
   302 val ex_pattern =
   303   read_cterm (sign_of HOL.thy) ("? x. P(x) & Q(x)",HOLogic.boolT)
   304 
   305 val all_pattern =
   306   read_cterm (sign_of HOL.thy) ("! x. P(x) & P'(x) --> Q(x)",HOLogic.boolT)
   307 
   308 in
   309 val defEX_regroup =
   310   mk_simproc "defined EX" [ex_pattern] Quantifier1.rearrange_ex;
   311 val defALL_regroup =
   312   mk_simproc "defined ALL" [all_pattern] Quantifier1.rearrange_all;
   313 end;
   314 
   315 (** Case splitting **)
   316 
   317 local val mktac = mk_case_split_tac (meta_eq_to_obj_eq RS iffD2)
   318 in
   319 fun split_tac splits = mktac (map mk_meta_eq splits)
   320 end;
   321 
   322 local val mktac = mk_case_split_inside_tac (meta_eq_to_obj_eq RS iffD2)
   323 in
   324 fun split_inside_tac splits = mktac (map mk_meta_eq splits)
   325 end;
   326 
   327 val split_asm_tac = mk_case_split_asm_tac split_tac 
   328 			(disjE,conjE,exE,contrapos,contrapos2,notnotD);
   329 
   330 infix 4 addsplits;
   331 fun ss addsplits splits = ss addloop (split_tac splits);
   332 
   333 
   334 qed_goal "if_cancel" HOL.thy "(if c then x else x) = x"
   335   (fn _ => [split_tac [expand_if] 1, blast_tac HOL_cs 1]);
   336 
   337 (** 'if' congruence rules: neither included by default! *)
   338 
   339 (*Simplifies x assuming c and y assuming ~c*)
   340 qed_goal "if_cong" HOL.thy
   341   "[| b=c; c ==> x=u; ~c ==> y=v |] ==>\
   342 \  (if b then x else y) = (if c then u else v)"
   343   (fn rew::prems =>
   344    [stac rew 1, stac expand_if 1, stac expand_if 1,
   345     blast_tac (HOL_cs addDs prems) 1]);
   346 
   347 (*Prevents simplification of x and y: much faster*)
   348 qed_goal "if_weak_cong" HOL.thy
   349   "b=c ==> (if b then x else y) = (if c then x else y)"
   350   (fn [prem] => [rtac (prem RS arg_cong) 1]);
   351 
   352 (*Prevents simplification of t: much faster*)
   353 qed_goal "let_weak_cong" HOL.thy
   354   "a = b ==> (let x=a in t(x)) = (let x=b in t(x))"
   355   (fn [prem] => [rtac (prem RS arg_cong) 1]);
   356 
   357 (*In general it seems wrong to add distributive laws by default: they
   358   might cause exponential blow-up.  But imp_disjL has been in for a while
   359   and cannot be removed without affecting existing proofs.  Moreover, 
   360   rewriting by "(P|Q --> R) = ((P-->R)&(Q-->R))" might be justified on the
   361   grounds that it allows simplification of R in the two cases.*)
   362 
   363 val mksimps_pairs =
   364   [("op -->", [mp]), ("op &", [conjunct1,conjunct2]),
   365    ("All", [spec]), ("True", []), ("False", []),
   366    ("If", [if_bool_eq RS iffD1])];
   367 
   368 fun unsafe_solver prems = FIRST'[resolve_tac (TrueI::refl::prems),
   369 				 atac, etac FalseE];
   370 (*No premature instantiation of variables during simplification*)
   371 fun   safe_solver prems = FIRST'[match_tac (TrueI::refl::prems),
   372 				 eq_assume_tac, ematch_tac [FalseE]];
   373 
   374 val HOL_basic_ss = empty_ss setsubgoaler asm_simp_tac
   375 			    setSSolver   safe_solver
   376 			    setSolver  unsafe_solver
   377 			    setmksimps (mksimps mksimps_pairs);
   378 
   379 val HOL_ss = 
   380     HOL_basic_ss addsimps 
   381      ([triv_forall_equality, (* prunes params *)
   382        True_implies_equals, (* prune asms `True' *)
   383        if_True, if_False, if_cancel,
   384        o_apply, imp_disjL, conj_assoc, disj_assoc,
   385        de_Morgan_conj, de_Morgan_disj, imp_disj1, imp_disj2, not_imp,
   386        not_all, not_ex, cases_simp]
   387      @ ex_simps @ all_simps @ simp_thms)
   388      addsimprocs [defALL_regroup,defEX_regroup]
   389      addcongs [imp_cong];
   390 
   391 qed_goal "if_distrib" HOL.thy
   392   "f(if c then x else y) = (if c then f x else f y)" 
   393   (fn _ => [simp_tac (HOL_ss setloop (split_tac [expand_if])) 1]);
   394 
   395 qed_goalw "o_assoc" HOL.thy [o_def] "f o (g o h) = f o g o h"
   396   (fn _ => [rtac ext 1, rtac refl 1]);
   397 
   398 
   399 (*For expand_case_tac*)
   400 val prems = goal HOL.thy "[| P ==> Q(True); ~P ==> Q(False) |] ==> Q(P)";
   401 by (case_tac "P" 1);
   402 by (ALLGOALS (asm_simp_tac (HOL_ss addsimps prems)));
   403 val expand_case = result();
   404 
   405 (*Used in Auth proofs.  Typically P contains Vars that become instantiated
   406   during unification.*)
   407 fun expand_case_tac P i =
   408     res_inst_tac [("P",P)] expand_case i THEN
   409     Simp_tac (i+1) THEN 
   410     Simp_tac i;
   411 
   412 
   413 (* install implicit simpset *)
   414 
   415 simpset_ref() := HOL_ss;
   416 
   417 
   418 (*** Integration of simplifier with classical reasoner ***)
   419 
   420 (* rot_eq_tac rotates the first equality premise of subgoal i to the front,
   421    fails if there is no equaliy or if an equality is already at the front *)
   422 local
   423   fun is_eq (Const ("Trueprop", _) $ (Const("op ="  ,_) $ _ $ _)) = true
   424     | is_eq _ = false;
   425   val find_eq = find_index is_eq;
   426 in
   427 val rot_eq_tac = 
   428      SUBGOAL (fn (Bi,i) => let val n = find_eq (Logic.strip_assums_hyp Bi) in
   429 		if n>0 then rotate_tac n i else no_tac end)
   430 end;
   431 
   432 (*an unsatisfactory fix for the incomplete asm_full_simp_tac!
   433   better: asm_really_full_simp_tac, a yet to be implemented version of
   434 			asm_full_simp_tac that applies all equalities in the
   435 			premises to all the premises *)
   436 fun safe_asm_more_full_simp_tac ss = TRY o rot_eq_tac THEN' 
   437 				     safe_asm_full_simp_tac ss;
   438 
   439 (*Add a simpset to a classical set!*)
   440 infix 4 addSss addss;
   441 fun cs addSss ss = cs addSaltern (CHANGED o (safe_asm_more_full_simp_tac ss));
   442 fun cs addss  ss = cs addbefore                        asm_full_simp_tac ss;
   443 
   444 fun Addss ss = (claset_ref() := claset() addss ss);
   445 
   446 (*Designed to be idempotent, except if best_tac instantiates variables
   447   in some of the subgoals*)
   448 
   449 type clasimpset = (claset * simpset);
   450 
   451 val HOL_css = (HOL_cs, HOL_ss);
   452 
   453 fun pair_upd1 f ((a,b),x) = (f(a,x), b);
   454 fun pair_upd2 f ((a,b),x) = (a, f(b,x));
   455 
   456 infix 4 addSIs2 addSEs2 addSDs2 addIs2 addEs2 addDs2
   457 	addsimps2 delsimps2 addcongs2 delcongs2;
   458 fun op addSIs2   arg = pair_upd1 (op addSIs) arg;
   459 fun op addSEs2   arg = pair_upd1 (op addSEs) arg;
   460 fun op addSDs2   arg = pair_upd1 (op addSDs) arg;
   461 fun op addIs2    arg = pair_upd1 (op addIs ) arg;
   462 fun op addEs2    arg = pair_upd1 (op addEs ) arg;
   463 fun op addDs2    arg = pair_upd1 (op addDs ) arg;
   464 fun op addsimps2 arg = pair_upd2 (op addsimps) arg;
   465 fun op delsimps2 arg = pair_upd2 (op delsimps) arg;
   466 fun op addcongs2 arg = pair_upd2 (op addcongs) arg;
   467 fun op delcongs2 arg = pair_upd2 (op delcongs) arg;
   468 
   469 fun auto_tac (cs,ss) = 
   470     let val cs' = cs addss ss 
   471     in  EVERY [TRY (safe_tac cs'),
   472 	       REPEAT (FIRSTGOAL (fast_tac cs')),
   473                TRY (safe_tac (cs addSss ss)),
   474 	       prune_params_tac] 
   475     end;
   476 
   477 fun Auto_tac () = auto_tac (claset(), simpset());
   478 
   479 fun auto () = by (Auto_tac ());