src/Provers/simplifier.ML
author nipkow
Fri Mar 06 15:20:29 1998 +0100 (1998-03-06 ago)
changeset 4682 ff081854fc86
parent 4677 c4b07b8579fd
child 4713 bea2ab2e360b
permissions -rw-r--r--
Added delspilts, Addsplits, Delsplits.
clasohm@1243
     1
(*  Title:      Provers/simplifier.ML
nipkow@1
     2
    ID:         $Id$
wenzelm@3557
     3
    Author:     Tobias Nipkow and Markus Wenzel, TU Muenchen
nipkow@1
     4
wenzelm@3577
     5
Generic simplifier, suitable for most logics.  See also Pure/thm.ML
wenzelm@3577
     6
for the actual meta level rewriting engine.
nipkow@1
     7
*)
clasohm@1260
     8
wenzelm@3551
     9
infix 4
nipkow@4682
    10
  setsubgoaler setloop addloop delloop setSSolver addSSolver setSolver
nipkow@4677
    11
  addSolver addsimps delsimps addeqcongs deleqcongs
nipkow@4677
    12
  setmksimps setmkeqTrue setmksym settermless addsimprocs delsimprocs;
oheimb@2567
    13
clasohm@0
    14
clasohm@0
    15
signature SIMPLIFIER =
clasohm@0
    16
sig
wenzelm@2509
    17
  type simproc
wenzelm@3577
    18
  val mk_simproc: string -> cterm list
wenzelm@3577
    19
    -> (Sign.sg -> thm list -> term -> thm option) -> simproc
clasohm@0
    20
  type simpset
wenzelm@2503
    21
  val empty_ss: simpset
wenzelm@3551
    22
  val rep_ss: simpset ->
wenzelm@3551
    23
   {mss: meta_simpset,
wenzelm@3551
    24
    subgoal_tac:        simpset -> int -> tactic,
nipkow@4668
    25
    loop_tacs:          (string * (int -> tactic))list,
wenzelm@3551
    26
           finish_tac: thm list -> int -> tactic,
wenzelm@3551
    27
    unsafe_finish_tac: thm list -> int -> tactic};
wenzelm@3551
    28
  val print_ss: simpset -> unit
wenzelm@4366
    29
  val print_simpset: theory -> unit
oheimb@2629
    30
  val setsubgoaler: simpset *  (simpset -> int -> tactic) -> simpset
oheimb@2629
    31
  val setloop:      simpset *             (int -> tactic) -> simpset
nipkow@4668
    32
  val addloop:      simpset *  (string * (int -> tactic)) -> simpset
nipkow@4682
    33
  val delloop:      simpset *   string                    -> simpset
oheimb@2629
    34
  val setSSolver:   simpset * (thm list -> int -> tactic) -> simpset
oheimb@2629
    35
  val addSSolver:   simpset * (thm list -> int -> tactic) -> simpset
oheimb@2629
    36
  val setSolver:    simpset * (thm list -> int -> tactic) -> simpset
oheimb@2629
    37
  val addSolver:    simpset * (thm list -> int -> tactic) -> simpset
wenzelm@3577
    38
  val setmksimps:   simpset * (thm -> thm list) -> simpset
nipkow@4677
    39
  val setmkeqTrue:  simpset * (thm -> thm option) -> simpset
nipkow@4677
    40
  val setmksym:     simpset * (thm -> thm option) -> simpset
wenzelm@3577
    41
  val settermless:  simpset * (term * term -> bool) -> simpset
wenzelm@3577
    42
  val addsimps:     simpset * thm list -> simpset
wenzelm@3577
    43
  val delsimps:     simpset * thm list -> simpset
wenzelm@3577
    44
  val addeqcongs:   simpset * thm list -> simpset
wenzelm@3577
    45
  val deleqcongs:   simpset * thm list -> simpset
wenzelm@3577
    46
  val addsimprocs:  simpset * simproc list -> simpset
wenzelm@3577
    47
  val delsimprocs:  simpset * simproc list -> simpset
wenzelm@3577
    48
  val merge_ss:     simpset * simpset -> simpset
wenzelm@3577
    49
  val prems_of_ss:  simpset -> thm list
wenzelm@4080
    50
wenzelm@4124
    51
  val simpset_thy_data: string * (object * (object -> object) *
wenzelm@4259
    52
    (object * object -> object) * (Sign.sg -> object -> unit))
wenzelm@4080
    53
  val simpset_ref_of_sg: Sign.sg -> simpset ref
wenzelm@4080
    54
  val simpset_ref_of: theory -> simpset ref
wenzelm@4080
    55
  val simpset_of_sg: Sign.sg -> simpset
wenzelm@4080
    56
  val simpset_of: theory -> simpset
wenzelm@4080
    57
  val SIMPSET: (simpset -> tactic) -> tactic
wenzelm@4080
    58
  val SIMPSET': (simpset -> 'a -> tactic) -> 'a -> tactic
wenzelm@4080
    59
  val simpset: unit -> simpset
wenzelm@4080
    60
  val simpset_ref: unit -> simpset ref
clasohm@1243
    61
  val Addsimps: thm list -> unit
clasohm@1243
    62
  val Delsimps: thm list -> unit
wenzelm@2509
    63
  val Addsimprocs: simproc list -> unit
wenzelm@2509
    64
  val Delsimprocs: simproc list -> unit
wenzelm@4080
    65
oheimb@2629
    66
  val               simp_tac: simpset -> int -> tactic
oheimb@2629
    67
  val           asm_simp_tac: simpset -> int -> tactic
oheimb@2629
    68
  val          full_simp_tac: simpset -> int -> tactic
oheimb@2629
    69
  val      asm_full_simp_tac: simpset -> int -> tactic
oheimb@2629
    70
  val safe_asm_full_simp_tac: simpset -> int -> tactic
oheimb@2629
    71
  val               Simp_tac:            int -> tactic
oheimb@2629
    72
  val           Asm_simp_tac:            int -> tactic
oheimb@2629
    73
  val          Full_simp_tac:            int -> tactic
oheimb@2629
    74
  val      Asm_full_simp_tac:            int -> tactic
wenzelm@3557
    75
  val          simplify: simpset -> thm -> thm
wenzelm@3557
    76
  val      asm_simplify: simpset -> thm -> thm
wenzelm@3557
    77
  val     full_simplify: simpset -> thm -> thm
wenzelm@3557
    78
  val asm_full_simplify: simpset -> thm -> thm
clasohm@0
    79
end;
clasohm@0
    80
wenzelm@2503
    81
wenzelm@2503
    82
structure Simplifier: SIMPLIFIER =
clasohm@0
    83
struct
clasohm@0
    84
wenzelm@2509
    85
wenzelm@2509
    86
(** simplification procedures **)
wenzelm@2509
    87
wenzelm@2509
    88
(* datatype simproc *)
wenzelm@2509
    89
wenzelm@2509
    90
datatype simproc =
wenzelm@3577
    91
  Simproc of string * cterm list * (Sign.sg -> thm list -> term -> thm option) * stamp;
wenzelm@2509
    92
wenzelm@3557
    93
fun mk_simproc name lhss proc =
wenzelm@3557
    94
  Simproc (name, map (Thm.cterm_fun Logic.varify) lhss, proc, stamp ());
wenzelm@3557
    95
wenzelm@3551
    96
fun rep_simproc (Simproc args) = args;
wenzelm@2509
    97
wenzelm@2509
    98
wenzelm@2509
    99
wenzelm@2503
   100
(** simplification sets **)
wenzelm@2503
   101
wenzelm@2503
   102
(* type simpset *)
wenzelm@2503
   103
clasohm@0
   104
datatype simpset =
wenzelm@2503
   105
  Simpset of {
wenzelm@2503
   106
    mss: meta_simpset,
oheimb@2629
   107
    subgoal_tac:        simpset -> int -> tactic,
nipkow@4668
   108
    loop_tacs:          (string * (int -> tactic))list,
oheimb@2629
   109
           finish_tac: thm list -> int -> tactic,
oheimb@2629
   110
    unsafe_finish_tac: thm list -> int -> tactic};
wenzelm@2503
   111
nipkow@4668
   112
fun make_ss (mss, subgoal_tac, loop_tacs, finish_tac, unsafe_finish_tac) =
nipkow@4668
   113
  Simpset {mss = mss, subgoal_tac = subgoal_tac, loop_tacs = loop_tacs,
oheimb@2629
   114
    finish_tac = finish_tac, unsafe_finish_tac = unsafe_finish_tac};
clasohm@0
   115
clasohm@0
   116
val empty_ss =
nipkow@4677
   117
  let val mss = Thm.set_mk_sym(Thm.empty_mss, Some o symmetric_fun)
nipkow@4677
   118
  in make_ss (mss, K (K no_tac), [], K (K no_tac), K (K no_tac)) end;
wenzelm@3551
   119
wenzelm@3551
   120
fun rep_ss (Simpset args) = args;
wenzelm@3551
   121
fun prems_of_ss (Simpset {mss, ...}) = Thm.prems_of_mss mss;
wenzelm@3551
   122
wenzelm@3551
   123
wenzelm@3551
   124
(* print simpsets *)
wenzelm@2503
   125
wenzelm@3551
   126
fun print_ss ss =
wenzelm@3551
   127
  let
wenzelm@3551
   128
    val Simpset {mss, ...} = ss;
wenzelm@3551
   129
    val {simps, procs, congs} = Thm.dest_mss mss;
wenzelm@2503
   130
wenzelm@3551
   131
    val pretty_thms = map Display.pretty_thm;
wenzelm@3551
   132
    fun pretty_proc (name, lhss) =
wenzelm@3551
   133
      Pretty.big_list (name ^ ":") (map Display.pretty_cterm lhss);
wenzelm@3551
   134
  in
wenzelm@3551
   135
    Pretty.writeln (Pretty.big_list "simplification rules:" (pretty_thms simps));
wenzelm@3551
   136
    Pretty.writeln (Pretty.big_list "simplification procedures:" (map pretty_proc procs));
wenzelm@3551
   137
    Pretty.writeln (Pretty.big_list "congruences:" (pretty_thms congs))
wenzelm@3551
   138
  end;
wenzelm@2503
   139
wenzelm@2503
   140
wenzelm@2503
   141
(* extend simpsets *)
wenzelm@2503
   142
nipkow@4668
   143
fun (Simpset {mss, subgoal_tac = _, loop_tacs, finish_tac, unsafe_finish_tac})
wenzelm@3551
   144
    setsubgoaler subgoal_tac =
nipkow@4668
   145
  make_ss (mss, subgoal_tac, loop_tacs, finish_tac, unsafe_finish_tac);
oheimb@2629
   146
nipkow@4668
   147
fun (Simpset {mss, subgoal_tac, loop_tacs = _, finish_tac, unsafe_finish_tac})
nipkow@4668
   148
    setloop tac =
nipkow@4668
   149
  make_ss (mss, subgoal_tac, [("",tac)], finish_tac, unsafe_finish_tac);
wenzelm@2503
   150
nipkow@4668
   151
fun (Simpset {mss, subgoal_tac, loop_tacs, finish_tac, unsafe_finish_tac})
nipkow@4668
   152
    addloop atac =
nipkow@4668
   153
  make_ss (mss, subgoal_tac, overwrite(loop_tacs,atac),
nipkow@4668
   154
           finish_tac, unsafe_finish_tac);
oheimb@2567
   155
nipkow@4682
   156
fun (ss as Simpset {mss,subgoal_tac,loop_tacs,finish_tac,unsafe_finish_tac})
nipkow@4682
   157
    delloop name =
nipkow@4682
   158
  let val (del,rest) = partition (fn (n,_) => n=name) loop_tacs
nipkow@4682
   159
  in if null del then (warning ("No such looper in simpset: " ^ name); ss)
nipkow@4682
   160
     else make_ss (mss, subgoal_tac, rest, finish_tac, unsafe_finish_tac)
nipkow@4682
   161
  end;
nipkow@4682
   162
nipkow@4668
   163
fun (Simpset {mss, subgoal_tac, loop_tacs, finish_tac = _, unsafe_finish_tac})
wenzelm@3551
   164
    setSSolver finish_tac =
nipkow@4668
   165
  make_ss (mss, subgoal_tac, loop_tacs, finish_tac, unsafe_finish_tac);
wenzelm@2503
   166
nipkow@4668
   167
fun (Simpset {mss, subgoal_tac, loop_tacs, finish_tac, unsafe_finish_tac})
wenzelm@3551
   168
    addSSolver tac =
nipkow@4668
   169
  make_ss (mss, subgoal_tac, loop_tacs, fn hyps => finish_tac hyps ORELSE' tac hyps,
wenzelm@3551
   170
    unsafe_finish_tac);
wenzelm@2503
   171
nipkow@4668
   172
fun (Simpset {mss, subgoal_tac, loop_tacs, finish_tac, unsafe_finish_tac = _})
wenzelm@3551
   173
    setSolver unsafe_finish_tac =
nipkow@4668
   174
  make_ss (mss, subgoal_tac, loop_tacs, finish_tac, unsafe_finish_tac);
wenzelm@2503
   175
nipkow@4668
   176
fun (Simpset {mss, subgoal_tac, loop_tacs, finish_tac, unsafe_finish_tac})
wenzelm@3551
   177
    addSolver tac =
nipkow@4668
   178
  make_ss (mss, subgoal_tac, loop_tacs, finish_tac,
wenzelm@3551
   179
    fn hyps => unsafe_finish_tac hyps ORELSE' tac hyps);
wenzelm@2503
   180
nipkow@4668
   181
fun (Simpset {mss, subgoal_tac, loop_tacs, finish_tac, unsafe_finish_tac})
wenzelm@3551
   182
    setmksimps mk_simps =
wenzelm@2645
   183
  make_ss (Thm.set_mk_rews (mss, map (Thm.strip_shyps o Drule.zero_var_indexes) o mk_simps),
nipkow@4668
   184
    subgoal_tac, loop_tacs, finish_tac, unsafe_finish_tac);
wenzelm@2509
   185
nipkow@4677
   186
fun (Simpset {mss, subgoal_tac, loop_tacs, finish_tac, unsafe_finish_tac})
nipkow@4677
   187
    setmkeqTrue mk_eq_True =
nipkow@4677
   188
  make_ss (Thm.set_mk_eq_True (mss, mk_eq_True),
nipkow@4677
   189
    subgoal_tac, loop_tacs, finish_tac, unsafe_finish_tac);
nipkow@4677
   190
nipkow@4677
   191
fun (Simpset {mss, subgoal_tac, loop_tacs, finish_tac, unsafe_finish_tac})
nipkow@4677
   192
    setmksym mksym =
nipkow@4677
   193
  make_ss (Thm.set_mk_sym (mss, mksym),
nipkow@4677
   194
    subgoal_tac, loop_tacs, finish_tac, unsafe_finish_tac);
nipkow@4677
   195
nipkow@4668
   196
fun (Simpset {mss, subgoal_tac, loop_tacs,  finish_tac, unsafe_finish_tac})
wenzelm@3551
   197
    settermless termless =
nipkow@4668
   198
  make_ss (Thm.set_termless (mss, termless), subgoal_tac, loop_tacs,
wenzelm@3551
   199
    finish_tac, unsafe_finish_tac);
wenzelm@3551
   200
nipkow@4668
   201
fun (Simpset {mss, subgoal_tac, loop_tacs, finish_tac, unsafe_finish_tac})
wenzelm@3551
   202
    addsimps rews =
nipkow@4668
   203
  make_ss (Thm.add_simps (mss, rews), subgoal_tac, loop_tacs,
nipkow@4668
   204
           finish_tac, unsafe_finish_tac);
wenzelm@2503
   205
nipkow@4668
   206
fun (Simpset {mss, subgoal_tac, loop_tacs, finish_tac, unsafe_finish_tac})
wenzelm@3551
   207
    delsimps rews =
nipkow@4668
   208
  make_ss (Thm.del_simps (mss, rews), subgoal_tac, loop_tacs,
nipkow@4668
   209
           finish_tac, unsafe_finish_tac);
wenzelm@2503
   210
nipkow@4668
   211
fun (Simpset {mss, subgoal_tac, loop_tacs, finish_tac, unsafe_finish_tac})
wenzelm@3551
   212
    addeqcongs newcongs =
nipkow@4668
   213
  make_ss (Thm.add_congs (mss, newcongs), subgoal_tac, loop_tacs,
wenzelm@3551
   214
    finish_tac, unsafe_finish_tac);
wenzelm@2509
   215
nipkow@4668
   216
fun (Simpset {mss, subgoal_tac, loop_tacs, finish_tac, unsafe_finish_tac})
wenzelm@3551
   217
    deleqcongs oldcongs =
nipkow@4668
   218
  make_ss (Thm.del_congs (mss, oldcongs), subgoal_tac, loop_tacs,
wenzelm@3551
   219
    finish_tac, unsafe_finish_tac);
oheimb@2629
   220
nipkow@4668
   221
fun (Simpset {mss, subgoal_tac, loop_tacs, finish_tac, unsafe_finish_tac})
wenzelm@3551
   222
    addsimprocs simprocs =
wenzelm@3551
   223
  make_ss
wenzelm@3551
   224
    (Thm.add_simprocs (mss, map rep_simproc simprocs),
nipkow@4668
   225
      subgoal_tac, loop_tacs, finish_tac, unsafe_finish_tac);
wenzelm@2509
   226
nipkow@4668
   227
fun (Simpset {mss, subgoal_tac, loop_tacs, finish_tac, unsafe_finish_tac})
wenzelm@3551
   228
    delsimprocs simprocs =
wenzelm@3551
   229
  make_ss
wenzelm@3551
   230
    (Thm.del_simprocs (mss, map rep_simproc simprocs),
nipkow@4668
   231
      subgoal_tac, loop_tacs, finish_tac, unsafe_finish_tac);
wenzelm@2503
   232
wenzelm@2503
   233
wenzelm@3551
   234
(* merge simpsets *)	(*NOTE: ignores tactics of 2nd simpset*)
wenzelm@2503
   235
wenzelm@3551
   236
fun merge_ss
nipkow@4668
   237
   (Simpset {mss = mss1, loop_tacs = loop_tacs1,
nipkow@4668
   238
             subgoal_tac, finish_tac, unsafe_finish_tac},
nipkow@4668
   239
    Simpset {mss = mss2, loop_tacs = loop_tacs2, ...}) =
nipkow@4668
   240
  make_ss (Thm.merge_mss (mss1, mss2), subgoal_tac,
nipkow@4668
   241
           foldl overwrite (loop_tacs1,loop_tacs2),
nipkow@4668
   242
           finish_tac, unsafe_finish_tac);
wenzelm@2503
   243
wenzelm@2503
   244
wenzelm@3557
   245
wenzelm@4080
   246
(** simpset theory data **)
wenzelm@4080
   247
wenzelm@4080
   248
(* data kind simpset *)
wenzelm@4080
   249
wenzelm@4080
   250
val simpsetK = "simpset";
wenzelm@4080
   251
exception SimpsetData of simpset ref;
wenzelm@4080
   252
wenzelm@4080
   253
local
wenzelm@4080
   254
  val empty = SimpsetData (ref empty_ss);
clasohm@0
   255
wenzelm@4080
   256
  (*create new reference*)
wenzelm@4080
   257
  fun prep_ext (SimpsetData (ref ss)) = SimpsetData (ref ss);
wenzelm@4080
   258
wenzelm@4080
   259
  fun merge (SimpsetData (ref ss1), SimpsetData (ref ss2)) =
wenzelm@4080
   260
    SimpsetData (ref (merge_ss (ss1, ss2)));
wenzelm@4080
   261
wenzelm@4259
   262
  fun print (_: Sign.sg) (SimpsetData (ref ss)) = print_ss ss;
wenzelm@4080
   263
in
wenzelm@4080
   264
  val simpset_thy_data = (simpsetK, (empty, prep_ext, merge, print));
wenzelm@4080
   265
end;
wenzelm@4080
   266
wenzelm@4080
   267
wenzelm@4080
   268
(* access simpset *)
clasohm@0
   269
wenzelm@4366
   270
fun print_simpset thy = Display.print_data thy simpsetK;
wenzelm@4366
   271
wenzelm@4080
   272
fun simpset_ref_of_sg sg =
wenzelm@4080
   273
  (case Sign.get_data sg simpsetK of
wenzelm@4080
   274
    SimpsetData r => r
wenzelm@4080
   275
  | _ => sys_error "simpset_ref_of_sg")
wenzelm@4080
   276
wenzelm@4080
   277
val simpset_ref_of = simpset_ref_of_sg o sign_of;
wenzelm@4080
   278
val simpset_of_sg = ! o simpset_ref_of_sg;
wenzelm@4080
   279
val simpset_of = simpset_of_sg o sign_of;
wenzelm@4080
   280
wenzelm@4080
   281
fun SIMPSET tacf state = tacf (simpset_of_sg (sign_of_thm state)) state;
wenzelm@4080
   282
fun SIMPSET' tacf i state = tacf (simpset_of_sg (sign_of_thm state)) i state;
clasohm@0
   283
wenzelm@4080
   284
val simpset = simpset_of o Context.get_context;
wenzelm@4080
   285
val simpset_ref = simpset_ref_of_sg o sign_of o Context.get_context;
wenzelm@4080
   286
wenzelm@4080
   287
wenzelm@4080
   288
(* change simpset *)
wenzelm@4080
   289
wenzelm@4080
   290
fun change_simpset f x = simpset_ref () := (f (simpset (), x));
wenzelm@4080
   291
wenzelm@4080
   292
val Addsimps = change_simpset (op addsimps);
wenzelm@4080
   293
val Delsimps = change_simpset (op delsimps);
wenzelm@4080
   294
val Addsimprocs = change_simpset (op addsimprocs);
wenzelm@4080
   295
val Delsimprocs = change_simpset (op delsimprocs);
wenzelm@2509
   296
clasohm@0
   297
wenzelm@3557
   298
wenzelm@2503
   299
(** simplification tactics **)
clasohm@0
   300
nipkow@4668
   301
fun solve_all_tac (subgoal_tac, loop_tacs, finish_tac, unsafe_finish_tac) mss =
wenzelm@3557
   302
  let
wenzelm@3557
   303
    val ss =
nipkow@4668
   304
      make_ss (mss, subgoal_tac, loop_tacs, unsafe_finish_tac, unsafe_finish_tac);
nipkow@4612
   305
    val solve1_tac = (subgoal_tac ss THEN_ALL_NEW (K no_tac)) 1
wenzelm@3557
   306
  in DEPTH_SOLVE solve1_tac end;
wenzelm@3557
   307
nipkow@4668
   308
fun loop_tac loop_tacs = FIRST'(map snd loop_tacs);
wenzelm@3557
   309
oheimb@2629
   310
(*not totally safe: may instantiate unknowns that appear also in other subgoals*)
oheimb@2629
   311
fun basic_gen_simp_tac mode =
nipkow@4668
   312
  fn (Simpset {mss, subgoal_tac, loop_tacs, finish_tac, unsafe_finish_tac}) =>
wenzelm@3551
   313
    let
nipkow@4612
   314
      fun simp_loop_tac i =
nipkow@4612
   315
        asm_rewrite_goal_tac mode
nipkow@4668
   316
          (solve_all_tac (subgoal_tac,loop_tacs,finish_tac,unsafe_finish_tac))
nipkow@4612
   317
          mss i
nipkow@4612
   318
        THEN (finish_tac (prems_of_mss mss) i ORELSE
nipkow@4668
   319
              TRY ((loop_tac loop_tacs THEN_ALL_NEW simp_loop_tac) i))
nipkow@4612
   320
    in simp_loop_tac end;
clasohm@0
   321
wenzelm@3551
   322
fun gen_simp_tac mode (ss as Simpset {unsafe_finish_tac, ...}) =
wenzelm@3551
   323
  basic_gen_simp_tac mode (ss setSSolver unsafe_finish_tac);
wenzelm@3551
   324
oheimb@2629
   325
wenzelm@2503
   326
val          simp_tac = gen_simp_tac (false, false);
wenzelm@2503
   327
val      asm_simp_tac = gen_simp_tac (false, true);
wenzelm@2503
   328
val     full_simp_tac = gen_simp_tac (true,  false);
wenzelm@2503
   329
val asm_full_simp_tac = gen_simp_tac (true,  true);
clasohm@0
   330
oheimb@2629
   331
(*not totally safe: may instantiate unknowns that appear also in other subgoals*)
oheimb@2629
   332
val safe_asm_full_simp_tac = basic_gen_simp_tac (true, true);
oheimb@2629
   333
paulson@3728
   334
(** The abstraction over the proof state delays the dereferencing **)
paulson@3728
   335
wenzelm@4080
   336
fun          Simp_tac i st =          simp_tac (simpset ()) i st;
wenzelm@4080
   337
fun      Asm_simp_tac i st =      asm_simp_tac (simpset ()) i st;
wenzelm@4080
   338
fun     Full_simp_tac i st =     full_simp_tac (simpset ()) i st;
wenzelm@4080
   339
fun Asm_full_simp_tac i st = asm_full_simp_tac (simpset ()) i st;
nipkow@406
   340
wenzelm@3557
   341
wenzelm@3557
   342
wenzelm@3557
   343
(** simplification meta rules **)
wenzelm@3557
   344
nipkow@4668
   345
fun simp mode (Simpset {mss, subgoal_tac, loop_tacs, finish_tac, unsafe_finish_tac}) thm =
wenzelm@3557
   346
  let
nipkow@4668
   347
    val tacf = solve_all_tac (subgoal_tac, loop_tacs, finish_tac, unsafe_finish_tac);
wenzelm@4271
   348
    fun prover m th = apsome fst (Seq.pull (tacf m th));
wenzelm@3557
   349
  in
wenzelm@3557
   350
    Drule.rewrite_thm mode prover mss thm
wenzelm@3557
   351
  end;
wenzelm@3557
   352
wenzelm@3557
   353
val          simplify = simp (false, false);
wenzelm@3557
   354
val      asm_simplify = simp (false, true);
wenzelm@3557
   355
val     full_simplify = simp (true, false);
wenzelm@3557
   356
val asm_full_simplify = simp (true, true);
wenzelm@3557
   357
wenzelm@3557
   358
clasohm@1243
   359
end;