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