src/Pure/Isar/attrib.ML
author wenzelm
Sun Apr 01 19:07:32 2012 +0200 (2012-04-01)
changeset 47249 c0481c3c2a6c
parent 47005 421760a1efe7
child 47815 43f677b3ae91
permissions -rw-r--r--
added Attrib.global_notes/local_notes/generic_notes convenience;
     1 (*  Title:      Pure/Isar/attrib.ML
     2     Author:     Markus Wenzel, TU Muenchen
     3 
     4 Symbolic representation of attributes -- with name and syntax.
     5 *)
     6 
     7 signature ATTRIB =
     8 sig
     9   type src = Args.src
    10   type binding = binding * src list
    11   val empty_binding: binding
    12   val is_empty_binding: binding -> bool
    13   val print_attributes: theory -> unit
    14   val intern: theory -> xstring -> string
    15   val intern_src: theory -> src -> src
    16   val pretty_attribs: Proof.context -> src list -> Pretty.T list
    17   val defined: theory -> string -> bool
    18   val attribute: theory -> src -> attribute
    19   val attribute_i: theory -> src -> attribute
    20   val map_specs: ('a list -> 'att list) ->
    21     (('c * 'a list) * 'b) list -> (('c * 'att list) * 'b) list
    22   val map_facts: ('a list -> 'att list) ->
    23     (('c * 'a list) * ('d * 'a list) list) list ->
    24     (('c * 'att list) * ('d * 'att list) list) list
    25   val map_facts_refs: ('a list -> 'att list) -> ('b -> 'fact) ->
    26     (('c * 'a list) * ('b * 'a list) list) list ->
    27     (('c * 'att list) * ('fact * 'att list) list) list
    28   val global_notes: string -> (binding * (thm list * src list) list) list ->
    29     theory -> (string * thm list) list * theory
    30   val local_notes: string -> (binding * (thm list * src list) list) list ->
    31     Proof.context -> (string * thm list) list * Proof.context
    32   val generic_notes: string -> (binding * (thm list * src list) list) list ->
    33     Context.generic -> (string * thm list) list * Context.generic
    34   val eval_thms: Proof.context -> (Facts.ref * src list) list -> thm list
    35   val setup: Binding.binding -> attribute context_parser -> string -> theory -> theory
    36   val attribute_setup: bstring * Position.T -> Symbol_Pos.text * Position.T -> string ->
    37     theory -> theory
    38   val add_del: attribute -> attribute -> attribute context_parser
    39   val thm_sel: Facts.interval list parser
    40   val thm: thm context_parser
    41   val thms: thm list context_parser
    42   val multi_thm: thm list context_parser
    43   val partial_evaluation: Proof.context ->
    44     (binding * (thm list * Args.src list) list) list ->
    45     (binding * (thm list * Args.src list) list) list
    46   val internal: (morphism -> attribute) -> src
    47   val print_configs: Proof.context -> unit
    48   val config_bool: Binding.binding ->
    49     (Context.generic -> bool) -> bool Config.T * (theory -> theory)
    50   val config_int: Binding.binding ->
    51     (Context.generic -> int) -> int Config.T * (theory -> theory)
    52   val config_real: Binding.binding ->
    53     (Context.generic -> real) -> real Config.T * (theory -> theory)
    54   val config_string: Binding.binding ->
    55     (Context.generic -> string) -> string Config.T * (theory -> theory)
    56   val setup_config_bool: Binding.binding -> (Context.generic -> bool) -> bool Config.T
    57   val setup_config_int: Binding.binding -> (Context.generic -> int) -> int Config.T
    58   val setup_config_string: Binding.binding -> (Context.generic -> string) -> string Config.T
    59   val setup_config_real: Binding.binding -> (Context.generic -> real) -> real Config.T
    60 end;
    61 
    62 structure Attrib: ATTRIB =
    63 struct
    64 
    65 (* source and bindings *)
    66 
    67 type src = Args.src;
    68 
    69 type binding = binding * src list;
    70 
    71 val empty_binding: binding = (Binding.empty, []);
    72 fun is_empty_binding ((b, srcs): binding) = Binding.is_empty b andalso null srcs;
    73 
    74 
    75 
    76 (** named attributes **)
    77 
    78 (* theory data *)
    79 
    80 structure Attributes = Theory_Data
    81 (
    82   type T = ((src -> attribute) * string) Name_Space.table;
    83   val empty : T = Name_Space.empty_table "attribute";
    84   val extend = I;
    85   fun merge data : T = Name_Space.merge_tables data;
    86 );
    87 
    88 fun print_attributes thy =
    89   let
    90     val ctxt = Proof_Context.init_global thy;
    91     val attribs = Attributes.get thy;
    92     fun prt_attr (name, (_, "")) = Pretty.str name
    93       | prt_attr (name, (_, comment)) =
    94           Pretty.block [Pretty.str (name ^ ":"), Pretty.brk 2, Pretty.str comment];
    95   in
    96     [Pretty.big_list "attributes:" (map prt_attr (Name_Space.extern_table ctxt attribs))]
    97     |> Pretty.chunks |> Pretty.writeln
    98   end;
    99 
   100 fun add_attribute name att comment thy = thy
   101   |> Attributes.map (Name_Space.define (Context.Theory thy) true (name, (att, comment)) #> snd);
   102 
   103 
   104 (* name space *)
   105 
   106 val intern = Name_Space.intern o #1 o Attributes.get;
   107 val intern_src = Args.map_name o intern;
   108 
   109 fun extern ctxt = Name_Space.extern ctxt (#1 (Attributes.get (Proof_Context.theory_of ctxt)));
   110 
   111 
   112 (* pretty printing *)
   113 
   114 fun pretty_attribs _ [] = []
   115   | pretty_attribs ctxt srcs =
   116       [Pretty.enum "," "[" "]" (map (Args.pretty_src ctxt o Args.map_name (extern ctxt)) srcs)];
   117 
   118 
   119 (* get attributes *)
   120 
   121 val defined = Symtab.defined o #2 o Attributes.get;
   122 
   123 fun attribute_i thy =
   124   let
   125     val (space, tab) = Attributes.get thy;
   126     fun attr src =
   127       let val ((name, _), pos) = Args.dest_src src in
   128         (case Symtab.lookup tab name of
   129           NONE => error ("Unknown attribute: " ^ quote name ^ Position.str_of pos)
   130         | SOME (att, _) => (Position.report pos (Name_Space.markup space name); att src))
   131       end;
   132   in attr end;
   133 
   134 fun attribute thy = attribute_i thy o intern_src thy;
   135 
   136 
   137 (* attributed declarations *)
   138 
   139 fun map_specs f = map (apfst (apsnd f));
   140 
   141 fun map_facts f = map (apfst (apsnd f) o apsnd (map (apsnd f)));
   142 fun map_facts_refs f g = map_facts f #> map (apsnd (map (apfst g)));
   143 
   144 
   145 (* fact expressions *)
   146 
   147 fun global_notes kind facts thy = thy |>
   148   Global_Theory.note_thmss kind (map_facts (map (attribute_i thy)) facts);
   149 
   150 fun local_notes kind facts ctxt = ctxt |>
   151   Proof_Context.note_thmss kind (map_facts (map (attribute_i (Proof_Context.theory_of ctxt))) facts);
   152 
   153 fun generic_notes kind facts context = context |>
   154   Context.mapping_result (global_notes kind facts) (local_notes kind facts);
   155 
   156 fun eval_thms ctxt srcs = ctxt
   157   |> Proof_Context.note_thmss ""
   158     (map_facts_refs (map (attribute (Proof_Context.theory_of ctxt))) (Proof_Context.get_fact ctxt)
   159       [((Binding.empty, []), srcs)])
   160   |> fst |> maps snd;
   161 
   162 
   163 (* attribute setup *)
   164 
   165 fun syntax scan = Args.syntax "attribute" scan;
   166 
   167 fun setup name scan =
   168   add_attribute name
   169     (fn src => fn (ctxt, th) => let val (a, ctxt') = syntax scan src ctxt in a (ctxt', th) end);
   170 
   171 fun attribute_setup name (txt, pos) cmt =
   172   Context.theory_map (ML_Context.expression pos
   173     "val (name, scan, comment): binding * attribute context_parser * string"
   174     "Context.map_theory (Attrib.setup name scan comment)"
   175     (ML_Lex.read Position.none ("(" ^ ML_Syntax.make_binding name ^ ", ") @
   176       ML_Lex.read pos txt @
   177       ML_Lex.read Position.none (", " ^ ML_Syntax.print_string cmt ^ ")")));
   178 
   179 
   180 (* add/del syntax *)
   181 
   182 fun add_del add del = Scan.lift (Args.add >> K add || Args.del >> K del || Scan.succeed add);
   183 
   184 
   185 
   186 (** parsing attributed theorems **)
   187 
   188 val thm_sel = Parse.$$$ "(" |-- Parse.list1
   189  (Parse.nat --| Parse.minus -- Parse.nat >> Facts.FromTo ||
   190   Parse.nat --| Parse.minus >> Facts.From ||
   191   Parse.nat >> Facts.Single) --| Parse.$$$ ")";
   192 
   193 local
   194 
   195 val fact_name = Args.internal_fact >> K "<fact>" || Args.name;
   196 
   197 fun gen_thm pick = Scan.depend (fn context =>
   198   let
   199     val thy = Context.theory_of context;
   200     val get = Context.cases (Global_Theory.get_fact context) Proof_Context.get_fact context;
   201     val get_fact = get o Facts.Fact;
   202     fun get_named pos name = get (Facts.Named ((name, pos), NONE));
   203   in
   204     Parse.$$$ "[" |-- Args.attribs (intern thy) --| Parse.$$$ "]" >> (fn srcs =>
   205       let
   206         val atts = map (attribute_i thy) srcs;
   207         val (th', context') = fold (uncurry o Thm.apply_attribute) atts (Drule.dummy_thm, context);
   208       in (context', pick "" [th']) end)
   209     ||
   210     (Scan.ahead Args.alt_name -- Args.named_fact get_fact
   211       >> (fn (s, fact) => ("", Facts.Fact s, fact)) ||
   212      Scan.ahead (Parse.position fact_name) :|-- (fn (name, pos) =>
   213       Args.named_fact (get_named pos) -- Scan.option thm_sel
   214         >> (fn (fact, sel) => (name, Facts.Named ((name, pos), sel), fact))))
   215     -- Args.opt_attribs (intern thy) >> (fn ((name, thmref, fact), srcs) =>
   216       let
   217         val ths = Facts.select thmref fact;
   218         val atts = map (attribute_i thy) srcs;
   219         val (ths', context') =
   220           fold_map (curry (fold (uncurry o Thm.apply_attribute) atts)) ths context;
   221       in (context', pick name ths') end)
   222   end);
   223 
   224 in
   225 
   226 val thm = gen_thm Facts.the_single;
   227 val multi_thm = gen_thm (K I);
   228 val thms = Scan.repeat multi_thm >> flat;
   229 
   230 end;
   231 
   232 
   233 
   234 (** partial evaluation -- observing rule/declaration/mixed attributes **)
   235 
   236 local
   237 
   238 val strict_eq_thm = op = o pairself Thm.rep_thm;
   239 
   240 fun apply_att src (context, th) =
   241   let
   242     val src1 = Args.assignable src;
   243     val result = attribute_i (Context.theory_of context) src1 (context, th);
   244     val src2 = Args.closure src1;
   245   in (src2, result) end;
   246 
   247 fun err msg src =
   248   let val ((name, _), pos) = Args.dest_src src
   249   in error (msg ^ " " ^ quote name ^ Position.str_of pos) end;
   250 
   251 fun eval src ((th, dyn), (decls, context)) =
   252   (case (apply_att src (context, th), dyn) of
   253     ((_, (NONE, SOME th')), NONE) => ((th', NONE), (decls, context))
   254   | ((_, (NONE, SOME _)), SOME _) => err "Mixed dynamic attribute followed by static rule" src
   255   | ((src', (SOME context', NONE)), NONE) =>
   256       let
   257         val decls' =
   258           (case decls of
   259             [] => [(th, [src'])]
   260           | (th2, srcs2) :: rest =>
   261               if strict_eq_thm (th, th2)
   262               then ((th2, src' :: srcs2) :: rest)
   263               else (th, [src']) :: (th2, srcs2) :: rest);
   264       in ((th, NONE), (decls', context')) end
   265   | ((src', (opt_context', opt_th')), _) =>
   266       let
   267         val context' = the_default context opt_context';
   268         val th' = the_default th opt_th';
   269         val dyn' =
   270           (case dyn of
   271             NONE => SOME (th, [src'])
   272           | SOME (dyn_th, srcs) => SOME (dyn_th, src' :: srcs));
   273       in ((th', dyn'), (decls, context')) end);
   274 
   275 in
   276 
   277 fun partial_evaluation ctxt facts =
   278   (facts, Context.Proof (Context_Position.set_visible false ctxt)) |->
   279     fold_map (fn ((b, more_atts), fact) => fn context =>
   280       let
   281         val (fact', (decls, context')) =
   282           (fact, ([], context)) |-> fold_map (fn (ths, atts) => fn res1 =>
   283             (ths, res1) |-> fold_map (fn th => fn res2 =>
   284               let
   285                 val ((th', dyn'), res3) = fold eval (atts @ more_atts) ((th, NONE), res2);
   286                 val th_atts' =
   287                   (case dyn' of
   288                     NONE => (th', [])
   289                   | SOME (dyn_th', atts') => (dyn_th', rev atts'));
   290               in (th_atts', res3) end))
   291           |>> flat;
   292         val decls' = rev (map (apsnd rev) decls);
   293         val facts' =
   294           if eq_list (eq_fst strict_eq_thm) (decls', fact') then
   295             [((b, []), map2 (fn (th, atts1) => fn (_, atts2) => (th, atts1 @ atts2)) decls' fact')]
   296           else if null decls' then [((b, []), fact')]
   297           else [(empty_binding, decls'), ((b, []), fact')];
   298       in (facts', context') end)
   299   |> fst |> flat |> map (apsnd (map (apfst single)))
   300   |> filter_out (fn (b, fact) => is_empty_binding b andalso forall (null o #2) fact);
   301 
   302 end;
   303 
   304 
   305 
   306 (** basic attributes **)
   307 
   308 (* internal *)
   309 
   310 fun internal att = Args.src (("Pure.attribute", [Token.mk_attribute att]), Position.none);
   311 
   312 
   313 (* rule composition *)
   314 
   315 val COMP_att =
   316   Scan.lift (Scan.optional (Args.bracks Parse.nat) 1) -- thm
   317     >> (fn (i, B) => Thm.rule_attribute (fn _ => fn A => Drule.compose_single (A, i, B)));
   318 
   319 val THEN_att =
   320   Scan.lift (Scan.optional (Args.bracks Parse.nat) 1) -- thm
   321     >> (fn (i, B) => Thm.rule_attribute (fn _ => fn A => A RSN (i, B)));
   322 
   323 val OF_att =
   324   thms >> (fn Bs => Thm.rule_attribute (fn _ => fn A => Bs MRS A));
   325 
   326 
   327 (* rename_abs *)
   328 
   329 val rename_abs =
   330   Scan.repeat (Args.maybe Args.name)
   331   >> (fn args => Thm.rule_attribute (K (Drule.rename_bvars' args)));
   332 
   333 
   334 (* unfold / fold definitions *)
   335 
   336 fun unfolded_syntax rule =
   337   thms >> (fn ths => Thm.rule_attribute (fn context => rule (Context.proof_of context) ths));
   338 
   339 val unfolded = unfolded_syntax Local_Defs.unfold;
   340 val folded = unfolded_syntax Local_Defs.fold;
   341 
   342 
   343 (* rule format *)
   344 
   345 val rule_format = Args.mode "no_asm"
   346   >> (fn true => Object_Logic.rule_format_no_asm | false => Object_Logic.rule_format);
   347 
   348 val elim_format = Thm.rule_attribute (K Tactic.make_elim);
   349 
   350 
   351 (* case names *)
   352 
   353 val case_names =
   354   Scan.repeat1 (Args.name --
   355     Scan.optional (Parse.$$$ "[" |-- Scan.repeat1 (Args.maybe Args.name) --| Parse.$$$ "]") []) >>
   356   (fn cs =>
   357     Rule_Cases.cases_hyp_names (map fst cs)
   358       (map (map (the_default Rule_Cases.case_hypsN) o snd) cs));
   359 
   360 
   361 (* misc rules *)
   362 
   363 val no_vars = Thm.rule_attribute (fn context => fn th =>
   364   let
   365     val ctxt = Variable.set_body false (Context.proof_of context);
   366     val ((_, [th']), _) = Variable.import true [th] ctxt;
   367   in th' end);
   368 
   369 val eta_long =
   370   Thm.rule_attribute (K (Conv.fconv_rule Drule.eta_long_conversion));
   371 
   372 val rotated = Scan.optional Parse.int 1 >> (fn n => Thm.rule_attribute (K (rotate_prems n)));
   373 
   374 
   375 (* theory setup *)
   376 
   377 val _ = Context.>> (Context.map_theory
   378  (setup (Binding.name "attribute") (Scan.lift Args.internal_attribute >> Morphism.form)
   379     "internal attribute" #>
   380   setup (Binding.name "tagged") (Scan.lift (Args.name -- Args.name) >> Thm.tag) "tagged theorem" #>
   381   setup (Binding.name "untagged") (Scan.lift Args.name >> Thm.untag) "untagged theorem" #>
   382   setup (Binding.name "kind") (Scan.lift Args.name >> Thm.kind) "theorem kind" #>
   383   setup (Binding.name "COMP") COMP_att "direct composition with rules (no lifting)" #>
   384   setup (Binding.name "THEN") THEN_att "resolution with rule" #>
   385   setup (Binding.name "OF") OF_att "rule applied to facts" #>
   386   setup (Binding.name "rename_abs") (Scan.lift rename_abs)
   387     "rename bound variables in abstractions" #>
   388   setup (Binding.name "unfolded") unfolded "unfolded definitions" #>
   389   setup (Binding.name "folded") folded "folded definitions" #>
   390   setup (Binding.name "consumes") (Scan.lift (Scan.optional Parse.nat 1) >> Rule_Cases.consumes)
   391     "number of consumed facts" #>
   392   setup (Binding.name "constraints") (Scan.lift Parse.nat >> Rule_Cases.constraints)
   393     "number of equality constraints" #>
   394   setup (Binding.name "case_names") (Scan.lift case_names) "named rule cases" #>
   395   setup (Binding.name "case_conclusion")
   396     (Scan.lift (Args.name -- Scan.repeat Args.name) >> Rule_Cases.case_conclusion)
   397     "named conclusion of rule cases" #>
   398   setup (Binding.name "params")
   399     (Scan.lift (Parse.and_list1 (Scan.repeat Args.name)) >> Rule_Cases.params)
   400     "named rule parameters" #>
   401   setup (Binding.name "standard") (Scan.succeed (Thm.rule_attribute (K Drule.export_without_context)))
   402     "result put into standard form (legacy)" #>
   403   setup (Binding.name "rule_format") rule_format "result put into canonical rule format" #>
   404   setup (Binding.name "elim_format") (Scan.succeed elim_format)
   405     "destruct rule turned into elimination rule format" #>
   406   setup (Binding.name "no_vars") (Scan.succeed no_vars) "frozen schematic vars" #>
   407   setup (Binding.name "eta_long") (Scan.succeed eta_long)
   408     "put theorem into eta long beta normal form" #>
   409   setup (Binding.name "atomize") (Scan.succeed Object_Logic.declare_atomize)
   410     "declaration of atomize rule" #>
   411   setup (Binding.name "rulify") (Scan.succeed Object_Logic.declare_rulify)
   412     "declaration of rulify rule" #>
   413   setup (Binding.name "rotated") (Scan.lift rotated) "rotated theorem premises" #>
   414   setup (Binding.name "defn") (add_del Local_Defs.defn_add Local_Defs.defn_del)
   415     "declaration of definitional transformations" #>
   416   setup (Binding.name "abs_def")
   417     (Scan.succeed (Thm.rule_attribute (fn context =>
   418       Local_Defs.meta_rewrite_rule (Context.proof_of context) #> Drule.abs_def)))
   419     "abstract over free variables of definitionial theorem"));
   420 
   421 
   422 
   423 (** configuration options **)
   424 
   425 (* naming *)
   426 
   427 structure Configs = Theory_Data
   428 (
   429   type T = Config.raw Symtab.table;
   430   val empty = Symtab.empty;
   431   val extend = I;
   432   fun merge data = Symtab.merge (K true) data;
   433 );
   434 
   435 fun print_configs ctxt =
   436   let
   437     val thy = Proof_Context.theory_of ctxt;
   438     fun prt (name, config) =
   439       let val value = Config.get ctxt config in
   440         Pretty.block [Pretty.str (name ^ ": " ^ Config.print_type value ^ " ="), Pretty.brk 1,
   441           Pretty.str (Config.print_value value)]
   442       end;
   443     val configs = Name_Space.extern_table ctxt (#1 (Attributes.get thy), Configs.get thy);
   444   in Pretty.writeln (Pretty.big_list "configuration options" (map prt configs)) end;
   445 
   446 
   447 (* concrete syntax *)
   448 
   449 local
   450 
   451 val equals = Parse.$$$ "=";
   452 
   453 fun scan_value (Config.Bool _) =
   454       equals -- Args.$$$ "false" >> K (Config.Bool false) ||
   455       equals -- Args.$$$ "true" >> K (Config.Bool true) ||
   456       Scan.succeed (Config.Bool true)
   457   | scan_value (Config.Int _) = equals |-- Parse.int >> Config.Int
   458   | scan_value (Config.Real _) = equals |-- Parse.real >> Config.Real
   459   | scan_value (Config.String _) = equals |-- Args.name >> Config.String;
   460 
   461 fun scan_config thy config =
   462   let val config_type = Config.get_global thy config
   463   in scan_value config_type >> (K o Thm.declaration_attribute o K o Config.put_generic config) end;
   464 
   465 fun register binding config thy =
   466   let val name = Sign.full_name thy binding in
   467     thy
   468     |> setup binding (Scan.lift (scan_config thy config) >> Morphism.form) "configuration option"
   469     |> Configs.map (Symtab.update (name, config))
   470   end;
   471 
   472 fun declare make coerce binding default =
   473   let
   474     val name = Binding.name_of binding;
   475     val config_value = Config.declare_generic {global = false} name (make o default);
   476     val config = coerce config_value;
   477   in (config, register binding config_value) end;
   478 
   479 in
   480 
   481 val config_bool = declare Config.Bool Config.bool;
   482 val config_int = declare Config.Int Config.int;
   483 val config_real = declare Config.Real Config.real;
   484 val config_string = declare Config.String Config.string;
   485 
   486 fun register_config config = register (Binding.name (Config.name_of config)) config;
   487 
   488 end;
   489 
   490 
   491 (* implicit setup *)
   492 
   493 local
   494 
   495 fun setup_config declare_config binding default =
   496   let
   497     val (config, setup) = declare_config binding default;
   498     val _ = Context.>> (Context.map_theory setup);
   499   in config end;
   500 
   501 in
   502 
   503 val setup_config_bool = setup_config config_bool;
   504 val setup_config_int = setup_config config_int;
   505 val setup_config_string = setup_config config_string;
   506 val setup_config_real = setup_config config_real;
   507 
   508 end;
   509 
   510 
   511 (* theory setup *)
   512 
   513 val _ = Context.>> (Context.map_theory
   514  (register_config Ast.trace_raw #>
   515   register_config Ast.stats_raw #>
   516   register_config Printer.show_brackets_raw #>
   517   register_config Printer.show_sorts_raw #>
   518   register_config Printer.show_types_raw #>
   519   register_config Printer.show_structs_raw #>
   520   register_config Printer.show_question_marks_raw #>
   521   register_config Syntax.ambiguity_warning_raw #>
   522   register_config Syntax.ambiguity_limit_raw #>
   523   register_config Syntax_Trans.eta_contract_raw #>
   524   register_config Name_Space.names_long_raw #>
   525   register_config Name_Space.names_short_raw #>
   526   register_config Name_Space.names_unique_raw #>
   527   register_config ML_Context.trace_raw #>
   528   register_config Proof_Context.show_abbrevs_raw #>
   529   register_config Goal_Display.goals_limit_raw #>
   530   register_config Goal_Display.show_main_goal_raw #>
   531   register_config Goal_Display.show_consts_raw #>
   532   register_config Display.show_hyps_raw #>
   533   register_config Display.show_tags_raw #>
   534   register_config Unify.trace_bound_raw #>
   535   register_config Unify.search_bound_raw #>
   536   register_config Unify.trace_simp_raw #>
   537   register_config Unify.trace_types_raw #>
   538   register_config Raw_Simplifier.simp_depth_limit_raw #>
   539   register_config Raw_Simplifier.simp_trace_depth_limit_raw #>
   540   register_config Raw_Simplifier.simp_debug_raw #>
   541   register_config Raw_Simplifier.simp_trace_raw));
   542 
   543 end;