src/Pure/simplifier.ML
author wenzelm
Thu Jan 19 21:22:08 2006 +0100 (2006-01-19 ago)
changeset 18708 4b3dadb4fe33
parent 18688 abf0f018b5ec
child 18728 6790126ab5f6
permissions -rw-r--r--
setup: theory -> theory;
wenzelm@16014
     1
(*  Title:      Pure/simplifier.ML
wenzelm@16014
     2
    ID:         $Id$
wenzelm@16014
     3
    Author:     Tobias Nipkow and Markus Wenzel, TU Muenchen
wenzelm@16014
     4
wenzelm@16014
     5
Generic simplifier, suitable for most logics (see also
wenzelm@16014
     6
meta_simplifier.ML for the actual meta-level rewriting engine).
wenzelm@16014
     7
*)
wenzelm@16014
     8
wenzelm@16014
     9
signature BASIC_SIMPLIFIER =
wenzelm@16014
    10
sig
wenzelm@16014
    11
  include BASIC_META_SIMPLIFIER
wenzelm@16014
    12
  val print_simpset: theory -> unit
wenzelm@17883
    13
  val change_simpset_of: theory -> (simpset -> simpset) -> unit
wenzelm@17883
    14
  val change_simpset: (simpset -> simpset) -> unit
wenzelm@16014
    15
  val simpset_of: theory -> simpset
wenzelm@17883
    16
  val simpset: unit -> simpset
wenzelm@16014
    17
  val SIMPSET: (simpset -> tactic) -> tactic
wenzelm@16014
    18
  val SIMPSET': (simpset -> 'a -> tactic) -> 'a -> tactic
wenzelm@16014
    19
  val Addsimps: thm list -> unit
wenzelm@16014
    20
  val Delsimps: thm list -> unit
wenzelm@16014
    21
  val Addsimprocs: simproc list -> unit
wenzelm@16014
    22
  val Delsimprocs: simproc list -> unit
wenzelm@16014
    23
  val Addcongs: thm list -> unit
wenzelm@16014
    24
  val Delcongs: thm list -> unit
wenzelm@16014
    25
  val local_simpset_of: Proof.context -> simpset
wenzelm@17967
    26
  val generic_simp_tac: bool -> bool * bool * bool -> simpset -> int -> tactic
wenzelm@16014
    27
  val safe_asm_full_simp_tac: simpset -> int -> tactic
wenzelm@16014
    28
  val               simp_tac: simpset -> int -> tactic
wenzelm@16014
    29
  val           asm_simp_tac: simpset -> int -> tactic
wenzelm@16014
    30
  val          full_simp_tac: simpset -> int -> tactic
wenzelm@16014
    31
  val        asm_lr_simp_tac: simpset -> int -> tactic
wenzelm@16014
    32
  val      asm_full_simp_tac: simpset -> int -> tactic
wenzelm@16014
    33
  val               Simp_tac:            int -> tactic
wenzelm@16014
    34
  val           Asm_simp_tac:            int -> tactic
wenzelm@16014
    35
  val          Full_simp_tac:            int -> tactic
wenzelm@16014
    36
  val        Asm_lr_simp_tac:            int -> tactic
wenzelm@16014
    37
  val      Asm_full_simp_tac:            int -> tactic
wenzelm@16014
    38
  val          simplify: simpset -> thm -> thm
wenzelm@16014
    39
  val      asm_simplify: simpset -> thm -> thm
wenzelm@16014
    40
  val     full_simplify: simpset -> thm -> thm
wenzelm@16014
    41
  val   asm_lr_simplify: simpset -> thm -> thm
wenzelm@16014
    42
  val asm_full_simplify: simpset -> thm -> thm
wenzelm@16014
    43
end;
wenzelm@16014
    44
wenzelm@16014
    45
signature SIMPLIFIER =
wenzelm@16014
    46
sig
wenzelm@16014
    47
  include BASIC_SIMPLIFIER
wenzelm@17004
    48
  val clear_ss: simpset -> simpset
wenzelm@17723
    49
  val debug_bounds: bool ref
wenzelm@17883
    50
  val inherit_context: simpset -> simpset -> simpset
wenzelm@17898
    51
  val the_context: simpset -> Proof.context
wenzelm@17898
    52
  val context: Proof.context -> simpset -> simpset
wenzelm@17898
    53
  val theory_context: theory  -> simpset -> simpset
wenzelm@16458
    54
  val simproc_i: theory -> string -> term list
wenzelm@16458
    55
    -> (theory -> simpset -> term -> thm option) -> simproc
wenzelm@16458
    56
  val simproc: theory -> string -> string list
wenzelm@16458
    57
    -> (theory -> simpset -> term -> thm option) -> simproc
wenzelm@16014
    58
  val          rewrite: simpset -> cterm -> thm
wenzelm@16014
    59
  val      asm_rewrite: simpset -> cterm -> thm
wenzelm@16014
    60
  val     full_rewrite: simpset -> cterm -> thm
wenzelm@16014
    61
  val   asm_lr_rewrite: simpset -> cterm -> thm
wenzelm@16014
    62
  val asm_full_rewrite: simpset -> cterm -> thm
wenzelm@17883
    63
  val get_simpset: theory -> simpset
wenzelm@16014
    64
  val print_local_simpset: Proof.context -> unit
wenzelm@16014
    65
  val get_local_simpset: Proof.context -> simpset
wenzelm@16014
    66
  val put_local_simpset: simpset -> Proof.context -> Proof.context
wenzelm@18688
    67
  val attrib: (simpset * thm list -> simpset) -> Context.generic attribute
wenzelm@18688
    68
  val simp_add: Context.generic attribute
wenzelm@18688
    69
  val simp_del: Context.generic attribute
wenzelm@18688
    70
  val cong_add: Context.generic attribute
wenzelm@18688
    71
  val cong_del: Context.generic attribute
wenzelm@18033
    72
  val cong_modifiers: (Args.T list -> (Method.modifier * Args.T list)) list
wenzelm@18033
    73
  val simp_modifiers': (Args.T list -> (Method.modifier * Args.T list)) list
wenzelm@16014
    74
  val simp_modifiers: (Args.T list -> (Method.modifier * Args.T list)) list
wenzelm@16014
    75
  val method_setup: (Args.T list -> (Method.modifier * Args.T list)) list
wenzelm@18708
    76
    -> theory -> theory
wenzelm@18708
    77
  val easy_setup: thm -> thm list -> theory -> theory
wenzelm@16014
    78
end;
wenzelm@16014
    79
wenzelm@16014
    80
structure Simplifier: SIMPLIFIER =
wenzelm@16014
    81
struct
wenzelm@16014
    82
wenzelm@17883
    83
(** simpset data **)
wenzelm@16014
    84
wenzelm@17883
    85
(* global simpsets *)
wenzelm@16014
    86
wenzelm@16458
    87
structure GlobalSimpset = TheoryDataFun
wenzelm@16458
    88
(struct
wenzelm@16014
    89
  val name = "Pure/simpset";
wenzelm@17883
    90
  type T = simpset ref;
wenzelm@16014
    91
wenzelm@17883
    92
  val empty = ref empty_ss;
wenzelm@17883
    93
  fun copy (ref ss) = ref ss: T;            (*create new reference!*)
wenzelm@17898
    94
  fun extend (ref ss) = ref (MetaSimplifier.inherit_context empty_ss ss);
wenzelm@17883
    95
  fun merge _ (ref ss1, ref ss2) = ref (merge_ss (ss1, ss2));
wenzelm@17883
    96
  fun print _ (ref ss) = print_ss ss;
wenzelm@16458
    97
end);
wenzelm@16014
    98
wenzelm@18708
    99
val _ = Context.add_setup GlobalSimpset.init;
wenzelm@16014
   100
val print_simpset = GlobalSimpset.print;
wenzelm@17883
   101
val get_simpset = ! o GlobalSimpset.get;
wenzelm@16014
   102
wenzelm@17883
   103
val change_simpset_of = change o GlobalSimpset.get;
wenzelm@17883
   104
fun change_simpset f = change_simpset_of (Context.the_context ()) f;
wenzelm@16014
   105
wenzelm@17898
   106
fun simpset_of thy = MetaSimplifier.context (ProofContext.init thy) (get_simpset thy);
wenzelm@17883
   107
val simpset = simpset_of o Context.the_context;
wenzelm@16014
   108
wenzelm@16014
   109
wenzelm@17883
   110
fun SIMPSET tacf st = tacf (simpset_of (Thm.theory_of_thm st)) st;
wenzelm@17883
   111
fun SIMPSET' tacf i st = tacf (simpset_of (Thm.theory_of_thm st)) i st;
wenzelm@16014
   112
wenzelm@17883
   113
fun Addsimps args = change_simpset (fn ss => ss addsimps args);
wenzelm@17883
   114
fun Delsimps args = change_simpset (fn ss => ss delsimps args);
wenzelm@17883
   115
fun Addsimprocs args = change_simpset (fn ss => ss addsimprocs args);
wenzelm@17883
   116
fun Delsimprocs args = change_simpset (fn ss => ss delsimprocs args);
wenzelm@17883
   117
fun Addcongs args = change_simpset (fn ss => ss addcongs args);
wenzelm@17883
   118
fun Delcongs args = change_simpset (fn ss => ss delcongs args);
wenzelm@16014
   119
wenzelm@16014
   120
wenzelm@17883
   121
(* local simpsets *)
wenzelm@16014
   122
wenzelm@16458
   123
structure LocalSimpset = ProofDataFun
wenzelm@16458
   124
(struct
wenzelm@16014
   125
  val name = "Pure/simpset";
wenzelm@16014
   126
  type T = simpset;
wenzelm@17883
   127
  val init = get_simpset;
wenzelm@17883
   128
  fun print _ ss = print_ss ss;
wenzelm@16458
   129
end);
wenzelm@16014
   130
wenzelm@18708
   131
val _ = Context.add_setup LocalSimpset.init;
wenzelm@16014
   132
val print_local_simpset = LocalSimpset.print;
wenzelm@16014
   133
val get_local_simpset = LocalSimpset.get;
wenzelm@16014
   134
val put_local_simpset = LocalSimpset.put;
wenzelm@16014
   135
wenzelm@17898
   136
fun local_simpset_of ctxt = MetaSimplifier.context ctxt (get_local_simpset ctxt);
wenzelm@16014
   137
wenzelm@16014
   138
wenzelm@16014
   139
(* attributes *)
wenzelm@16014
   140
wenzelm@18688
   141
fun attrib f = Attrib.declaration (fn th =>
wenzelm@18688
   142
   fn Context.Theory thy => (change_simpset_of thy (fn ss => f (ss, [th])); Context.Theory thy)
wenzelm@18688
   143
    | Context.Proof ctxt => Context.Proof (LocalSimpset.map (fn ss => f (ss, [th])) ctxt));
wenzelm@16014
   144
wenzelm@18688
   145
val simp_add = attrib (op addsimps);
wenzelm@18688
   146
val simp_del = attrib (op delsimps);
wenzelm@18688
   147
val cong_add = attrib (op addcongs);
wenzelm@18688
   148
val cong_del = attrib (op delcongs);
wenzelm@16014
   149
wenzelm@16014
   150
wenzelm@17967
   151
wenzelm@17967
   152
(** simplification tactics and rules **)
wenzelm@17967
   153
wenzelm@17967
   154
fun solve_all_tac solvers ss =
wenzelm@17967
   155
  let
wenzelm@17967
   156
    val (_, {subgoal_tac, ...}) = MetaSimplifier.rep_ss ss;
wenzelm@17967
   157
    val solve_tac = subgoal_tac (MetaSimplifier.set_solvers solvers ss) THEN_ALL_NEW (K no_tac);
wenzelm@17967
   158
  in DEPTH_SOLVE (solve_tac 1) end;
wenzelm@17967
   159
wenzelm@17967
   160
(*NOTE: may instantiate unknowns that appear also in other subgoals*)
wenzelm@17967
   161
fun generic_simp_tac safe mode ss =
wenzelm@17967
   162
  let
wenzelm@17967
   163
    val (_, {loop_tacs, solvers = (unsafe_solvers, solvers), ...}) = MetaSimplifier.rep_ss ss;
wenzelm@17967
   164
    val loop_tac = FIRST' (map (fn (_, tac) => tac ss) loop_tacs);
wenzelm@17967
   165
    val solve_tac = FIRST' (map (MetaSimplifier.solver ss)
wenzelm@17967
   166
      (if safe then solvers else unsafe_solvers));
wenzelm@17967
   167
wenzelm@17967
   168
    fun simp_loop_tac i =
wenzelm@17967
   169
      asm_rewrite_goal_tac mode (solve_all_tac unsafe_solvers) ss i THEN
wenzelm@17967
   170
      (solve_tac i ORELSE TRY ((loop_tac THEN_ALL_NEW simp_loop_tac) i));
wenzelm@17967
   171
  in simp_loop_tac end;
wenzelm@17967
   172
wenzelm@17967
   173
local
wenzelm@17967
   174
wenzelm@17967
   175
fun simp rew mode ss thm =
wenzelm@17967
   176
  let
wenzelm@17967
   177
    val (_, {solvers = (unsafe_solvers, _), ...}) = MetaSimplifier.rep_ss ss;
wenzelm@17967
   178
    val tacf = solve_all_tac unsafe_solvers;
wenzelm@17967
   179
    fun prover s th = Option.map #1 (Seq.pull (tacf s th));
wenzelm@17967
   180
  in rew mode prover ss thm end;
wenzelm@17967
   181
wenzelm@17967
   182
in
wenzelm@17967
   183
wenzelm@17967
   184
val simp_thm = simp MetaSimplifier.rewrite_thm;
wenzelm@17967
   185
val simp_cterm = simp MetaSimplifier.rewrite_cterm;
wenzelm@17967
   186
wenzelm@17967
   187
end;
wenzelm@17967
   188
wenzelm@17967
   189
wenzelm@16806
   190
(* tactics *)
wenzelm@16806
   191
wenzelm@16014
   192
val simp_tac = generic_simp_tac false (false, false, false);
wenzelm@16014
   193
val asm_simp_tac = generic_simp_tac false (false, true, false);
wenzelm@16014
   194
val full_simp_tac = generic_simp_tac false (true, false, false);
wenzelm@16014
   195
val asm_lr_simp_tac = generic_simp_tac false (true, true, false);
wenzelm@16014
   196
val asm_full_simp_tac = generic_simp_tac false (true, true, true);
wenzelm@16014
   197
val safe_asm_full_simp_tac = generic_simp_tac true (true, true, true);
wenzelm@16014
   198
wenzelm@16014
   199
(*the abstraction over the proof state delays the dereferencing*)
wenzelm@16014
   200
fun          Simp_tac i st =          simp_tac (simpset ()) i st;
wenzelm@16014
   201
fun      Asm_simp_tac i st =      asm_simp_tac (simpset ()) i st;
wenzelm@16014
   202
fun     Full_simp_tac i st =     full_simp_tac (simpset ()) i st;
wenzelm@16014
   203
fun   Asm_lr_simp_tac i st =   asm_lr_simp_tac (simpset ()) i st;
wenzelm@16014
   204
fun Asm_full_simp_tac i st = asm_full_simp_tac (simpset ()) i st;
wenzelm@16014
   205
wenzelm@16806
   206
wenzelm@16806
   207
(* conversions *)
wenzelm@16806
   208
wenzelm@17967
   209
val          simplify = simp_thm (false, false, false);
wenzelm@17967
   210
val      asm_simplify = simp_thm (false, true, false);
wenzelm@17967
   211
val     full_simplify = simp_thm (true, false, false);
wenzelm@17967
   212
val   asm_lr_simplify = simp_thm (true, true, false);
wenzelm@17967
   213
val asm_full_simplify = simp_thm (true, true, true);
wenzelm@16014
   214
wenzelm@17967
   215
val          rewrite = simp_cterm (false, false, false);
wenzelm@17967
   216
val      asm_rewrite = simp_cterm (false, true, false);
wenzelm@17967
   217
val     full_rewrite = simp_cterm (true, false, false);
wenzelm@17967
   218
val   asm_lr_rewrite = simp_cterm (true, true, false);
wenzelm@17967
   219
val asm_full_rewrite = simp_cterm (true, true, true);
wenzelm@16014
   220
wenzelm@16014
   221
wenzelm@16014
   222
wenzelm@16014
   223
(** concrete syntax of attributes **)
wenzelm@16014
   224
wenzelm@16014
   225
(* add / del *)
wenzelm@16014
   226
wenzelm@16014
   227
val simpN = "simp";
wenzelm@16014
   228
val congN = "cong";
wenzelm@16014
   229
val addN = "add";
wenzelm@16014
   230
val delN = "del";
wenzelm@16014
   231
val onlyN = "only";
wenzelm@16014
   232
val no_asmN = "no_asm";
wenzelm@16014
   233
val no_asm_useN = "no_asm_use";
wenzelm@16014
   234
val no_asm_simpN = "no_asm_simp";
wenzelm@16014
   235
val asm_lrN = "asm_lr";
wenzelm@16014
   236
wenzelm@16014
   237
wenzelm@16014
   238
(* conversions *)
wenzelm@16014
   239
wenzelm@16014
   240
local
wenzelm@16014
   241
wenzelm@16014
   242
fun conv_mode x =
wenzelm@16014
   243
  ((Args.parens (Args.$$$ no_asmN) >> K simplify ||
wenzelm@16014
   244
    Args.parens (Args.$$$ no_asm_simpN) >> K asm_simplify ||
wenzelm@16014
   245
    Args.parens (Args.$$$ no_asm_useN) >> K full_simplify ||
wenzelm@16014
   246
    Scan.succeed asm_full_simplify) |> Scan.lift) x;
wenzelm@16014
   247
wenzelm@18688
   248
fun get_ss (Context.Theory thy) = simpset_of thy
wenzelm@18688
   249
  | get_ss (Context.Proof ctxt) = local_simpset_of ctxt;
wenzelm@16014
   250
wenzelm@16014
   251
in
wenzelm@16014
   252
wenzelm@18688
   253
val simplified =
wenzelm@18688
   254
  Attrib.syntax (conv_mode -- Attrib.thmss >> (fn (f, ths) => Attrib.rule (fn x =>
wenzelm@18688
   255
    f ((if null ths then I else MetaSimplifier.clear_ss) (get_ss x) addsimps ths))));
wenzelm@16014
   256
wenzelm@16014
   257
end;
wenzelm@16014
   258
wenzelm@16014
   259
wenzelm@16014
   260
(* setup attributes *)
wenzelm@16014
   261
wenzelm@16014
   262
val _ = Context.add_setup
wenzelm@18708
   263
 (Attrib.add_attributes
wenzelm@18688
   264
   [(simpN, Attrib.common (Attrib.add_del_args simp_add simp_del),
wenzelm@18688
   265
      "declaration of Simplifier rule"),
wenzelm@18688
   266
    (congN, Attrib.common (Attrib.add_del_args cong_add cong_del),
wenzelm@18688
   267
      "declaration of Simplifier congruence rule"),
wenzelm@18708
   268
    ("simplified", Attrib.common simplified, "simplified rule")]);
wenzelm@16014
   269
wenzelm@16014
   270
wenzelm@16014
   271
wenzelm@16014
   272
(** proof methods **)
wenzelm@16014
   273
wenzelm@16014
   274
(* simplification *)
wenzelm@16014
   275
wenzelm@16014
   276
val simp_options =
wenzelm@16014
   277
 (Args.parens (Args.$$$ no_asmN) >> K simp_tac ||
wenzelm@16014
   278
  Args.parens (Args.$$$ no_asm_simpN) >> K asm_simp_tac ||
wenzelm@16014
   279
  Args.parens (Args.$$$ no_asm_useN) >> K full_simp_tac ||
wenzelm@16014
   280
  Args.parens (Args.$$$ asm_lrN) >> K asm_lr_simp_tac ||
wenzelm@16014
   281
  Scan.succeed asm_full_simp_tac);
wenzelm@16014
   282
wenzelm@16685
   283
fun simp_flags x = (Scan.repeat
wenzelm@16684
   284
  (Args.parens (Args.$$$ "depth_limit" -- Args.colon |-- Args.nat)
wenzelm@16684
   285
    >> setmp MetaSimplifier.simp_depth_limit)
wenzelm@16709
   286
  >> (curry (Library.foldl op o) I o rev)) x;
wenzelm@16684
   287
wenzelm@16014
   288
val cong_modifiers =
wenzelm@18688
   289
 [Args.$$$ congN -- Args.colon >> K ((I, Attrib.context cong_add): Method.modifier),
wenzelm@18688
   290
  Args.$$$ congN -- Args.add -- Args.colon >> K (I, Attrib.context cong_add),
wenzelm@18688
   291
  Args.$$$ congN -- Args.del -- Args.colon >> K (I, Attrib.context cong_del)];
wenzelm@16014
   292
wenzelm@16014
   293
val simp_modifiers =
wenzelm@18688
   294
 [Args.$$$ simpN -- Args.colon >> K (I, Attrib.context simp_add),
wenzelm@18688
   295
  Args.$$$ simpN -- Args.add -- Args.colon >> K (I, Attrib.context simp_add),
wenzelm@18688
   296
  Args.$$$ simpN -- Args.del -- Args.colon >> K (I, Attrib.context simp_del),
wenzelm@17883
   297
  Args.$$$ simpN -- Args.$$$ onlyN -- Args.colon
wenzelm@18688
   298
    >> K (LocalSimpset.map MetaSimplifier.clear_ss, Attrib.context simp_add)]
wenzelm@16014
   299
   @ cong_modifiers;
wenzelm@16014
   300
wenzelm@16014
   301
val simp_modifiers' =
wenzelm@18688
   302
 [Args.add -- Args.colon >> K (I, Attrib.context simp_add),
wenzelm@18688
   303
  Args.del -- Args.colon >> K (I, Attrib.context simp_del),
wenzelm@18688
   304
  Args.$$$ onlyN -- Args.colon
wenzelm@18688
   305
    >> K (LocalSimpset.map MetaSimplifier.clear_ss, Attrib.context simp_add)]
wenzelm@16014
   306
   @ cong_modifiers;
wenzelm@16014
   307
wenzelm@16014
   308
fun simp_args more_mods =
wenzelm@16684
   309
  Method.sectioned_args (Args.bang_facts -- Scan.lift simp_options -- Scan.lift simp_flags)
wenzelm@16684
   310
    (more_mods @ simp_modifiers');
wenzelm@16014
   311
wenzelm@16684
   312
fun simp_method ((prems, tac), FLAGS) ctxt = Method.METHOD (fn facts =>
wenzelm@16014
   313
  ALLGOALS (Method.insert_tac (prems @ facts)) THEN
wenzelm@16684
   314
    (FLAGS o CHANGED_PROP o ALLGOALS o tac) (local_simpset_of ctxt));
wenzelm@16014
   315
wenzelm@16684
   316
fun simp_method' ((prems, tac), FLAGS) ctxt = Method.METHOD (fn facts =>
wenzelm@16014
   317
  HEADGOAL (Method.insert_tac (prems @ facts) THEN'
wenzelm@16684
   318
      ((FLAGS o CHANGED_PROP) oo tac) (local_simpset_of ctxt)));
wenzelm@16014
   319
wenzelm@16014
   320
wenzelm@16014
   321
wenzelm@18708
   322
(** setup **)
wenzelm@18708
   323
wenzelm@18708
   324
fun method_setup more_mods = Method.add_methods
wenzelm@16014
   325
 [(simpN, simp_args more_mods simp_method', "simplification"),
wenzelm@16014
   326
  ("simp_all", simp_args more_mods simp_method, "simplification (all goals)")];
wenzelm@16014
   327
wenzelm@18708
   328
fun easy_setup reflect trivs = method_setup [] #> (fn thy =>
wenzelm@16014
   329
  let
wenzelm@16014
   330
    val trivialities = Drule.reflexive_thm :: trivs;
wenzelm@16014
   331
wenzelm@16014
   332
    fun unsafe_solver_tac prems = FIRST' [resolve_tac (trivialities @ prems), assume_tac];
wenzelm@16014
   333
    val unsafe_solver = mk_solver "easy unsafe" unsafe_solver_tac;
wenzelm@16014
   334
wenzelm@16014
   335
    (*no premature instantiation of variables during simplification*)
wenzelm@16014
   336
    fun safe_solver_tac prems = FIRST' [match_tac (trivialities @ prems), eq_assume_tac];
wenzelm@16014
   337
    val safe_solver = mk_solver "easy safe" safe_solver_tac;
wenzelm@16014
   338
wenzelm@16014
   339
    fun mk_eq thm =
wenzelm@16014
   340
      if Logic.is_equals (Thm.concl_of thm) then [thm]
wenzelm@16014
   341
      else [thm RS reflect] handle THM _ => [];
wenzelm@16014
   342
wenzelm@16014
   343
    fun mksimps thm = mk_eq (Drule.forall_elim_vars (#maxidx (Thm.rep_thm thm) + 1) thm);
wenzelm@18708
   344
  in
wenzelm@18708
   345
    GlobalSimpset.get thy :=
wenzelm@18708
   346
      empty_ss setsubgoaler asm_simp_tac
wenzelm@18708
   347
      setSSolver safe_solver
wenzelm@18708
   348
      setSolver unsafe_solver
wenzelm@18708
   349
      setmksimps mksimps;
wenzelm@18708
   350
    thy
wenzelm@18708
   351
  end);
wenzelm@16014
   352
wenzelm@17883
   353
wenzelm@17883
   354
open MetaSimplifier;
wenzelm@17883
   355
wenzelm@16014
   356
end;
wenzelm@16014
   357
wenzelm@16014
   358
structure BasicSimplifier: BASIC_SIMPLIFIER = Simplifier;
wenzelm@16014
   359
open BasicSimplifier;