src/Pure/raw_simplifier.ML
changeset 69575 f77cc54f6d47
parent 69137 90fce429e1bc
child 70472 cf66d2db97fe
equal deleted inserted replaced
69574:b4ea943ce0b7 69575:f77cc54f6d47
   102   val set_mksym: (Proof.context -> thm -> thm option) -> Proof.context -> Proof.context
   102   val set_mksym: (Proof.context -> thm -> thm option) -> Proof.context -> Proof.context
   103   val set_mkeqTrue: (Proof.context -> thm -> thm option) -> Proof.context -> Proof.context
   103   val set_mkeqTrue: (Proof.context -> thm -> thm option) -> Proof.context -> Proof.context
   104   val set_term_ord: (term * term -> order) -> Proof.context -> Proof.context
   104   val set_term_ord: (term * term -> order) -> Proof.context -> Proof.context
   105   val set_subgoaler: (Proof.context -> int -> tactic) -> Proof.context -> Proof.context
   105   val set_subgoaler: (Proof.context -> int -> tactic) -> Proof.context -> Proof.context
   106   val solver: Proof.context -> solver -> int -> tactic
   106   val solver: Proof.context -> solver -> int -> tactic
   107   val simp_depth_limit_raw: Config.raw
       
   108   val default_mk_sym: Proof.context -> thm -> thm option
   107   val default_mk_sym: Proof.context -> thm -> thm option
   109   val simp_trace_depth_limit_raw: Config.raw
       
   110   val simp_trace_raw: Config.raw
       
   111   val simp_debug_raw: Config.raw
       
   112   val add_prems: thm list -> Proof.context -> Proof.context
   108   val add_prems: thm list -> Proof.context -> Proof.context
   113   val set_reorient: (Proof.context -> term list -> term -> term -> bool) ->
   109   val set_reorient: (Proof.context -> term list -> term -> term -> bool) ->
   114     Proof.context -> Proof.context
   110     Proof.context -> Proof.context
   115   val set_solvers: solver list -> Proof.context -> Proof.context
   111   val set_solvers: solver list -> Proof.context -> Proof.context
   116   val rewrite_cterm: bool * bool * bool ->
   112   val rewrite_cterm: bool * bool * bool ->
   394 The simp_depth_limit is meant to abort infinite recursion of the simplifier
   390 The simp_depth_limit is meant to abort infinite recursion of the simplifier
   395 early but should not terminate "normal" executions.
   391 early but should not terminate "normal" executions.
   396 As of 2017, 25 would suffice; 40 builds in a safety margin.
   392 As of 2017, 25 would suffice; 40 builds in a safety margin.
   397 *)
   393 *)
   398 
   394 
   399 val simp_depth_limit_raw = Config.declare ("simp_depth_limit", \<^here>) (K (Config.Int 40));
   395 val simp_depth_limit = Config.declare_int ("simp_depth_limit", \<^here>) (K 40);
   400 val simp_depth_limit = Config.int simp_depth_limit_raw;
   396 val simp_trace_depth_limit = Config.declare_int ("simp_trace_depth_limit", \<^here>) (K 1);
   401 
       
   402 val simp_trace_depth_limit_raw =
       
   403   Config.declare ("simp_trace_depth_limit", \<^here>) (fn _ => Config.Int 1);
       
   404 val simp_trace_depth_limit = Config.int simp_trace_depth_limit_raw;
       
   405 
   397 
   406 fun inc_simp_depth ctxt =
   398 fun inc_simp_depth ctxt =
   407   ctxt |> map_simpset1 (fn (rules, prems, (depth, exceeded)) =>
   399   ctxt |> map_simpset1 (fn (rules, prems, (depth, exceeded)) =>
   408     (rules, prems,
   400     (rules, prems,
   409       (depth + 1,
   401       (depth + 1,
   417 
   409 
   418 (* diagnostics *)
   410 (* diagnostics *)
   419 
   411 
   420 exception SIMPLIFIER of string * thm list;
   412 exception SIMPLIFIER of string * thm list;
   421 
   413 
   422 val simp_debug_raw = Config.declare ("simp_debug", \<^here>) (K (Config.Bool false));
   414 val simp_debug = Config.declare_bool ("simp_debug", \<^here>) (K false);
   423 val simp_debug = Config.bool simp_debug_raw;
   415 val simp_trace = Config.declare_bool ("simp_trace", \<^here>) (K false);
   424 
       
   425 val simp_trace_raw = Config.declare ("simp_trace", \<^here>) (fn _ => Config.Bool false);
       
   426 val simp_trace = Config.bool simp_trace_raw;
       
   427 
   416 
   428 fun cond_warning ctxt msg =
   417 fun cond_warning ctxt msg =
   429   if Context_Position.is_really_visible ctxt then warning (msg ()) else ();
   418   if Context_Position.is_really_visible ctxt then warning (msg ()) else ();
   430 
   419 
   431 fun cond_tracing' ctxt flag msg =
   420 fun cond_tracing' ctxt flag msg =