src/Provers/simplifier.ML
author wenzelm
Mon Nov 03 11:56:53 1997 +0100 (1997-11-03 ago)
changeset 4080 7dce11095b0a
parent 3728 f92594f65af6
child 4124 1af16493c57f
permissions -rw-r--r--
new implicit simpset mechanism based on Sign.sg anytype data;
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
wenzelm@3551
    10
  setsubgoaler setloop addloop setSSolver addSSolver setSolver
wenzelm@3551
    11
  addSolver setmksimps addsimps delsimps addeqcongs deleqcongs
wenzelm@3551
    12
  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
wenzelm@2509
    20
  val conv_prover: (term * term -> term) -> thm -> (thm -> thm)
wenzelm@3557
    21
    -> tactic -> (int -> tactic) -> Sign.sg -> term -> term -> thm
clasohm@0
    22
  type simpset
wenzelm@2503
    23
  val empty_ss: simpset
wenzelm@3551
    24
  val rep_ss: simpset ->
wenzelm@3551
    25
   {mss: meta_simpset,
wenzelm@3551
    26
    subgoal_tac:        simpset -> int -> tactic,
wenzelm@3551
    27
    loop_tac:                      int -> tactic,
wenzelm@3551
    28
           finish_tac: thm list -> int -> tactic,
wenzelm@3551
    29
    unsafe_finish_tac: thm list -> int -> tactic};
wenzelm@3551
    30
  val print_ss: simpset -> unit
oheimb@2629
    31
  val setsubgoaler: simpset *  (simpset -> int -> tactic) -> simpset
oheimb@2629
    32
  val setloop:      simpset *             (int -> tactic) -> simpset
oheimb@2629
    33
  val addloop:      simpset *             (int -> tactic) -> 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
wenzelm@3577
    39
  val settermless:  simpset * (term * term -> bool) -> simpset
wenzelm@3577
    40
  val addsimps:     simpset * thm list -> simpset
wenzelm@3577
    41
  val delsimps:     simpset * thm list -> simpset
wenzelm@3577
    42
  val addeqcongs:   simpset * thm list -> simpset
wenzelm@3577
    43
  val deleqcongs:   simpset * thm list -> simpset
wenzelm@3577
    44
  val addsimprocs:  simpset * simproc list -> simpset
wenzelm@3577
    45
  val delsimprocs:  simpset * simproc list -> simpset
wenzelm@3577
    46
  val merge_ss:     simpset * simpset -> simpset
wenzelm@3577
    47
  val prems_of_ss:  simpset -> thm list
wenzelm@4080
    48
wenzelm@4080
    49
  val simpset_thy_data: string * (exn * (exn -> exn) * (exn * exn -> exn) * (exn -> unit))
wenzelm@4080
    50
  val simpset_ref_of_sg: Sign.sg -> simpset ref
wenzelm@4080
    51
  val simpset_ref_of: theory -> simpset ref
wenzelm@4080
    52
  val simpset_of_sg: Sign.sg -> simpset
wenzelm@4080
    53
  val simpset_of: theory -> simpset
wenzelm@4080
    54
  val SIMPSET: (simpset -> tactic) -> tactic
wenzelm@4080
    55
  val SIMPSET': (simpset -> 'a -> tactic) -> 'a -> tactic
wenzelm@4080
    56
  val simpset: unit -> simpset
wenzelm@4080
    57
  val simpset_ref: unit -> simpset ref
clasohm@1243
    58
  val Addsimps: thm list -> unit
clasohm@1243
    59
  val Delsimps: thm list -> unit
wenzelm@2509
    60
  val Addsimprocs: simproc list -> unit
wenzelm@2509
    61
  val Delsimprocs: simproc list -> unit
wenzelm@4080
    62
oheimb@2629
    63
  val               simp_tac: simpset -> int -> tactic
oheimb@2629
    64
  val           asm_simp_tac: simpset -> int -> tactic
oheimb@2629
    65
  val          full_simp_tac: simpset -> int -> tactic
oheimb@2629
    66
  val      asm_full_simp_tac: simpset -> int -> tactic
oheimb@2629
    67
  val safe_asm_full_simp_tac: simpset -> int -> tactic
oheimb@2629
    68
  val               Simp_tac:            int -> tactic
oheimb@2629
    69
  val           Asm_simp_tac:            int -> tactic
oheimb@2629
    70
  val          Full_simp_tac:            int -> tactic
oheimb@2629
    71
  val      Asm_full_simp_tac:            int -> tactic
wenzelm@3557
    72
  val          simplify: simpset -> thm -> thm
wenzelm@3557
    73
  val      asm_simplify: simpset -> thm -> thm
wenzelm@3557
    74
  val     full_simplify: simpset -> thm -> thm
wenzelm@3557
    75
  val asm_full_simplify: simpset -> thm -> thm
clasohm@0
    76
end;
clasohm@0
    77
wenzelm@2503
    78
wenzelm@2503
    79
structure Simplifier: SIMPLIFIER =
clasohm@0
    80
struct
clasohm@0
    81
wenzelm@2509
    82
wenzelm@2509
    83
(** simplification procedures **)
wenzelm@2509
    84
wenzelm@2509
    85
(* datatype simproc *)
wenzelm@2509
    86
wenzelm@2509
    87
datatype simproc =
wenzelm@3577
    88
  Simproc of string * cterm list * (Sign.sg -> thm list -> term -> thm option) * stamp;
wenzelm@2509
    89
wenzelm@3557
    90
fun mk_simproc name lhss proc =
wenzelm@3557
    91
  Simproc (name, map (Thm.cterm_fun Logic.varify) lhss, proc, stamp ());
wenzelm@3557
    92
wenzelm@3551
    93
fun rep_simproc (Simproc args) = args;
wenzelm@2509
    94
wenzelm@2509
    95
wenzelm@4080
    96
(* generic conversion prover *)
wenzelm@2509
    97
wenzelm@2509
    98
fun conv_prover mk_eqv eqv_refl mk_meta_eq expand_tac norm_tac sg t u =
wenzelm@2509
    99
  let
wenzelm@2509
   100
    val X = Free (gensym "X.", fastype_of t);
wenzelm@2509
   101
    val goal = Logic.mk_implies (mk_eqv (X, t), mk_eqv (X, u));
wenzelm@2509
   102
    val pre_result =
wenzelm@2509
   103
      prove_goalw_cterm [] (cterm_of sg goal)   (*goal: X=t ==> X=u*)
wenzelm@2509
   104
        (fn prems => [
wenzelm@2509
   105
          expand_tac,				(*expand u*)
wenzelm@2509
   106
          ALLGOALS (cut_facts_tac prems),
wenzelm@2509
   107
          ALLGOALS norm_tac]);			(*normalize both t and u*)
wenzelm@2509
   108
  in
wenzelm@2509
   109
    mk_meta_eq (eqv_refl RS pre_result)         (*final result: t==u*)
wenzelm@2509
   110
  end
wenzelm@2509
   111
  handle ERROR => error ("The error(s) above occurred while trying to prove " ^
wenzelm@2509
   112
    (string_of_cterm (cterm_of sg (mk_eqv (t, u)))));
wenzelm@2509
   113
wenzelm@2509
   114
wenzelm@2509
   115
wenzelm@2503
   116
(** simplification sets **)
wenzelm@2503
   117
wenzelm@2503
   118
(* type simpset *)
wenzelm@2503
   119
clasohm@0
   120
datatype simpset =
wenzelm@2503
   121
  Simpset of {
wenzelm@2503
   122
    mss: meta_simpset,
oheimb@2629
   123
    subgoal_tac:        simpset -> int -> tactic,
oheimb@2629
   124
    loop_tac:                      int -> tactic,
oheimb@2629
   125
           finish_tac: thm list -> int -> tactic,
oheimb@2629
   126
    unsafe_finish_tac: thm list -> int -> tactic};
wenzelm@2503
   127
wenzelm@3551
   128
fun make_ss (mss, subgoal_tac, loop_tac, finish_tac, unsafe_finish_tac) =
wenzelm@3551
   129
  Simpset {mss = mss, subgoal_tac = subgoal_tac, loop_tac = loop_tac,
oheimb@2629
   130
    finish_tac = finish_tac, unsafe_finish_tac = unsafe_finish_tac};
clasohm@0
   131
clasohm@0
   132
val empty_ss =
wenzelm@3551
   133
  make_ss (Thm.empty_mss, K (K no_tac), K no_tac, K (K no_tac), K (K no_tac));
wenzelm@3551
   134
wenzelm@3551
   135
fun rep_ss (Simpset args) = args;
wenzelm@3551
   136
fun prems_of_ss (Simpset {mss, ...}) = Thm.prems_of_mss mss;
wenzelm@3551
   137
wenzelm@3551
   138
wenzelm@3551
   139
(* print simpsets *)
wenzelm@2503
   140
wenzelm@3551
   141
fun print_ss ss =
wenzelm@3551
   142
  let
wenzelm@3551
   143
    val Simpset {mss, ...} = ss;
wenzelm@3551
   144
    val {simps, procs, congs} = Thm.dest_mss mss;
wenzelm@2503
   145
wenzelm@3551
   146
    val pretty_thms = map Display.pretty_thm;
wenzelm@3551
   147
    fun pretty_proc (name, lhss) =
wenzelm@3551
   148
      Pretty.big_list (name ^ ":") (map Display.pretty_cterm lhss);
wenzelm@3551
   149
  in
wenzelm@3551
   150
    Pretty.writeln (Pretty.big_list "simplification rules:" (pretty_thms simps));
wenzelm@3551
   151
    Pretty.writeln (Pretty.big_list "simplification procedures:" (map pretty_proc procs));
wenzelm@3551
   152
    Pretty.writeln (Pretty.big_list "congruences:" (pretty_thms congs))
wenzelm@3551
   153
  end;
wenzelm@2503
   154
wenzelm@2503
   155
wenzelm@2503
   156
(* extend simpsets *)
wenzelm@2503
   157
wenzelm@3551
   158
fun (Simpset {mss, subgoal_tac = _, loop_tac, finish_tac, unsafe_finish_tac})
wenzelm@3551
   159
    setsubgoaler subgoal_tac =
wenzelm@3551
   160
  make_ss (mss, subgoal_tac, loop_tac, finish_tac, unsafe_finish_tac);
oheimb@2629
   161
wenzelm@3551
   162
fun (Simpset {mss, subgoal_tac, loop_tac = _, finish_tac, unsafe_finish_tac})
wenzelm@3551
   163
    setloop loop_tac =
wenzelm@3551
   164
  make_ss (mss, subgoal_tac, DETERM o loop_tac, finish_tac, unsafe_finish_tac);
wenzelm@2503
   165
wenzelm@3551
   166
fun (Simpset {mss, subgoal_tac, loop_tac, finish_tac, unsafe_finish_tac})
wenzelm@3551
   167
    addloop tac =
wenzelm@3551
   168
  make_ss (mss, subgoal_tac, loop_tac ORELSE' (DETERM o tac), finish_tac, unsafe_finish_tac);
oheimb@2567
   169
wenzelm@3551
   170
fun (Simpset {mss, subgoal_tac, loop_tac, finish_tac = _, unsafe_finish_tac})
wenzelm@3551
   171
    setSSolver finish_tac =
wenzelm@3551
   172
  make_ss (mss, subgoal_tac, loop_tac, finish_tac, unsafe_finish_tac);
wenzelm@2503
   173
wenzelm@3551
   174
fun (Simpset {mss, subgoal_tac, loop_tac, finish_tac, unsafe_finish_tac})
wenzelm@3551
   175
    addSSolver tac =
wenzelm@3551
   176
  make_ss (mss, subgoal_tac, loop_tac, fn hyps => finish_tac hyps ORELSE' tac hyps,
wenzelm@3551
   177
    unsafe_finish_tac);
wenzelm@2503
   178
wenzelm@3551
   179
fun (Simpset {mss, subgoal_tac, loop_tac, finish_tac, unsafe_finish_tac = _})
wenzelm@3551
   180
    setSolver unsafe_finish_tac =
wenzelm@3551
   181
  make_ss (mss, subgoal_tac, loop_tac, finish_tac, unsafe_finish_tac);
wenzelm@2503
   182
wenzelm@3551
   183
fun (Simpset {mss, subgoal_tac, loop_tac, finish_tac, unsafe_finish_tac})
wenzelm@3551
   184
    addSolver tac =
wenzelm@3551
   185
  make_ss (mss, subgoal_tac, loop_tac, finish_tac,
wenzelm@3551
   186
    fn hyps => unsafe_finish_tac hyps ORELSE' tac hyps);
wenzelm@2503
   187
wenzelm@3551
   188
fun (Simpset {mss, subgoal_tac, loop_tac, finish_tac, unsafe_finish_tac})
wenzelm@3551
   189
    setmksimps mk_simps =
wenzelm@2645
   190
  make_ss (Thm.set_mk_rews (mss, map (Thm.strip_shyps o Drule.zero_var_indexes) o mk_simps),
oheimb@2629
   191
    subgoal_tac, loop_tac, finish_tac, unsafe_finish_tac);
wenzelm@2509
   192
wenzelm@3551
   193
fun (Simpset {mss, subgoal_tac, loop_tac,  finish_tac, unsafe_finish_tac})
wenzelm@3551
   194
    settermless termless =
wenzelm@3551
   195
  make_ss (Thm.set_termless (mss, termless), subgoal_tac, loop_tac,
wenzelm@3551
   196
    finish_tac, unsafe_finish_tac);
wenzelm@3551
   197
wenzelm@3551
   198
fun (Simpset {mss, subgoal_tac, loop_tac, finish_tac, unsafe_finish_tac})
wenzelm@3551
   199
    addsimps rews =
wenzelm@2503
   200
  let val rews' = flat (map (Thm.mk_rews_of_mss mss) rews) in
wenzelm@3551
   201
    make_ss (Thm.add_simps (mss, rews'), subgoal_tac, loop_tac,
wenzelm@3551
   202
      finish_tac, unsafe_finish_tac)
wenzelm@2503
   203
  end;
wenzelm@2503
   204
wenzelm@3551
   205
fun (Simpset {mss, subgoal_tac, loop_tac, finish_tac, unsafe_finish_tac})
wenzelm@3551
   206
    delsimps rews =
wenzelm@2503
   207
  let val rews' = flat (map (Thm.mk_rews_of_mss mss) rews) in
wenzelm@3551
   208
    make_ss (Thm.del_simps (mss, rews'), subgoal_tac, loop_tac,
wenzelm@3551
   209
      finish_tac, unsafe_finish_tac)
wenzelm@2503
   210
  end;
wenzelm@2503
   211
wenzelm@3551
   212
fun (Simpset {mss, subgoal_tac, loop_tac, finish_tac, unsafe_finish_tac})
wenzelm@3551
   213
    addeqcongs newcongs =
wenzelm@3551
   214
  make_ss (Thm.add_congs (mss, newcongs), subgoal_tac, loop_tac,
wenzelm@3551
   215
    finish_tac, unsafe_finish_tac);
wenzelm@2509
   216
wenzelm@3551
   217
fun (Simpset {mss, subgoal_tac, loop_tac, finish_tac, unsafe_finish_tac})
wenzelm@3551
   218
    deleqcongs oldcongs =
wenzelm@3551
   219
  make_ss (Thm.del_congs (mss, oldcongs), subgoal_tac, loop_tac,
wenzelm@3551
   220
    finish_tac, unsafe_finish_tac);
oheimb@2629
   221
wenzelm@3551
   222
fun (Simpset {mss, subgoal_tac, loop_tac, finish_tac, unsafe_finish_tac})
wenzelm@3551
   223
    addsimprocs simprocs =
wenzelm@3551
   224
  make_ss
wenzelm@3551
   225
    (Thm.add_simprocs (mss, map rep_simproc simprocs),
wenzelm@3551
   226
      subgoal_tac, loop_tac, finish_tac, unsafe_finish_tac);
wenzelm@2509
   227
wenzelm@3551
   228
fun (Simpset {mss, subgoal_tac, loop_tac, finish_tac, unsafe_finish_tac})
wenzelm@3551
   229
    delsimprocs simprocs =
wenzelm@3551
   230
  make_ss
wenzelm@3551
   231
    (Thm.del_simprocs (mss, map rep_simproc simprocs),
wenzelm@3551
   232
      subgoal_tac, loop_tac, finish_tac, unsafe_finish_tac);
wenzelm@2503
   233
wenzelm@2503
   234
wenzelm@3551
   235
(* merge simpsets *)	(*NOTE: ignores tactics of 2nd simpset*)
wenzelm@2503
   236
wenzelm@3551
   237
fun merge_ss
wenzelm@3551
   238
   (Simpset {mss = mss1, subgoal_tac, loop_tac, finish_tac, unsafe_finish_tac},
wenzelm@3551
   239
    Simpset {mss = mss2, ...}) =
wenzelm@3551
   240
  make_ss (Thm.merge_mss (mss1, mss2),
wenzelm@3551
   241
    subgoal_tac, loop_tac, finish_tac, unsafe_finish_tac);
wenzelm@2503
   242
wenzelm@2503
   243
wenzelm@3557
   244
wenzelm@4080
   245
(** simpset theory data **)
wenzelm@4080
   246
wenzelm@4080
   247
(* data kind simpset *)
wenzelm@4080
   248
wenzelm@4080
   249
val simpsetK = "simpset";
wenzelm@4080
   250
exception SimpsetData of simpset ref;
wenzelm@4080
   251
wenzelm@4080
   252
local
wenzelm@4080
   253
  val empty = SimpsetData (ref empty_ss);
clasohm@0
   254
wenzelm@4080
   255
  (*create new reference*)
wenzelm@4080
   256
  fun prep_ext (SimpsetData (ref ss)) = SimpsetData (ref ss);
wenzelm@4080
   257
wenzelm@4080
   258
  fun merge (SimpsetData (ref ss1), SimpsetData (ref ss2)) =
wenzelm@4080
   259
    SimpsetData (ref (merge_ss (ss1, ss2)));
wenzelm@4080
   260
wenzelm@4080
   261
  fun print (SimpsetData (ref ss)) = print_ss ss;
wenzelm@4080
   262
in
wenzelm@4080
   263
  val simpset_thy_data = (simpsetK, (empty, prep_ext, merge, print));
wenzelm@4080
   264
end;
wenzelm@4080
   265
wenzelm@4080
   266
wenzelm@4080
   267
(* access simpset *)
clasohm@0
   268
wenzelm@4080
   269
fun simpset_ref_of_sg sg =
wenzelm@4080
   270
  (case Sign.get_data sg simpsetK of
wenzelm@4080
   271
    SimpsetData r => r
wenzelm@4080
   272
  | _ => sys_error "simpset_ref_of_sg")
wenzelm@4080
   273
wenzelm@4080
   274
val simpset_ref_of = simpset_ref_of_sg o sign_of;
wenzelm@4080
   275
val simpset_of_sg = ! o simpset_ref_of_sg;
wenzelm@4080
   276
val simpset_of = simpset_of_sg o sign_of;
wenzelm@4080
   277
wenzelm@4080
   278
fun SIMPSET tacf state = tacf (simpset_of_sg (sign_of_thm state)) state;
wenzelm@4080
   279
fun SIMPSET' tacf i state = tacf (simpset_of_sg (sign_of_thm state)) i state;
clasohm@0
   280
wenzelm@4080
   281
val simpset = simpset_of o Context.get_context;
wenzelm@4080
   282
val simpset_ref = simpset_ref_of_sg o sign_of o Context.get_context;
wenzelm@4080
   283
wenzelm@4080
   284
wenzelm@4080
   285
(* change simpset *)
wenzelm@4080
   286
wenzelm@4080
   287
fun change_simpset f x = simpset_ref () := (f (simpset (), x));
wenzelm@4080
   288
wenzelm@4080
   289
val Addsimps = change_simpset (op addsimps);
wenzelm@4080
   290
val Delsimps = change_simpset (op delsimps);
wenzelm@4080
   291
val Addsimprocs = change_simpset (op addsimprocs);
wenzelm@4080
   292
val Delsimprocs = change_simpset (op delsimprocs);
wenzelm@2509
   293
clasohm@0
   294
wenzelm@3557
   295
wenzelm@2503
   296
(** simplification tactics **)
clasohm@0
   297
wenzelm@3551
   298
fun NEWSUBGOALS tac tacf st0 =
wenzelm@3551
   299
  st0 |> (tac THEN (fn st1 => tacf (nprems_of st1 - nprems_of st0) st1));
nipkow@1
   300
wenzelm@3557
   301
fun solve_all_tac (subgoal_tac, loop_tac, finish_tac, unsafe_finish_tac) mss =
wenzelm@3557
   302
  let
wenzelm@3557
   303
    val ss =
wenzelm@3557
   304
      make_ss (mss, subgoal_tac, loop_tac, unsafe_finish_tac, unsafe_finish_tac);
wenzelm@3557
   305
    val solve1_tac =
wenzelm@3557
   306
      NEWSUBGOALS (subgoal_tac ss 1) (fn n => if n < 0 then all_tac else no_tac);
wenzelm@3557
   307
  in DEPTH_SOLVE solve1_tac end;
wenzelm@3557
   308
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 =
wenzelm@3551
   312
  fn (Simpset {mss, subgoal_tac, loop_tac, finish_tac, unsafe_finish_tac}) =>
wenzelm@3551
   313
    let
paulson@1512
   314
      fun simp_loop_tac i thm =
wenzelm@3557
   315
        (asm_rewrite_goal_tac mode
wenzelm@3557
   316
          (solve_all_tac (subgoal_tac, loop_tac, finish_tac, unsafe_finish_tac)) mss i
wenzelm@3557
   317
        THEN (finish_tac (prems_of_mss mss) i ORELSE looper i)) thm
wenzelm@3551
   318
      and allsimp i n = EVERY (map (fn j => simp_loop_tac (i + j)) (n downto 0))
wenzelm@3551
   319
      and looper i = TRY (NEWSUBGOALS (loop_tac i) (allsimp i));
nipkow@217
   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
wenzelm@3557
   345
fun simp mode (Simpset {mss, subgoal_tac, loop_tac, finish_tac, unsafe_finish_tac}) thm =
wenzelm@3557
   346
  let
wenzelm@3557
   347
    val tacf = solve_all_tac (subgoal_tac, loop_tac, finish_tac, unsafe_finish_tac);
wenzelm@3557
   348
    fun prover m th = apsome fst (Sequence.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;