avoid misleading Simplifier trace in quickcheck, notably in auto quickcheck;
authorwenzelm
Thu, 14 Apr 2016 16:59:47 +0200
changeset 62983 ba9072b303a2
parent 62982 4b71cd0bfe14
child 62984 61b32a6d87e9
avoid misleading Simplifier trace in quickcheck, notably in auto quickcheck;
src/Pure/Tools/simplifier_trace.ML
src/Tools/quickcheck.ML
--- a/src/Pure/Tools/simplifier_trace.ML	Thu Apr 14 16:02:22 2016 +0200
+++ b/src/Pure/Tools/simplifier_trace.ML	Thu Apr 14 16:59:47 2016 +0200
@@ -6,6 +6,7 @@
 
 signature SIMPLIFIER_TRACE =
 sig
+  val disable: Proof.context -> Proof.context
   val add_term_breakpoint: term -> Context.generic -> Context.generic
   val add_thm_breakpoint: thm -> Context.generic -> Context.generic
 end
@@ -63,6 +64,13 @@
 val get_data = Data.get o Context.Proof
 val put_data = Context.proof_map o Data.put
 
+val disable =
+  Config.put simp_trace false #>
+  (Context.proof_map o Data.map)
+    (fn {max_depth, mode = _, interactive, parent, memory, breakpoints} =>
+      {max_depth = max_depth, mode = Disabled, interactive = interactive, parent = parent,
+        memory = memory, breakpoints = breakpoints});
+
 val get_breakpoints = #breakpoints o get_data
 
 fun map_breakpoints f =
--- a/src/Tools/quickcheck.ML	Thu Apr 14 16:02:22 2016 +0200
+++ b/src/Tools/quickcheck.ML	Thu Apr 14 16:59:47 2016 +0200
@@ -293,17 +293,19 @@
   if not (Config.get ctxt quiet) andalso Config.get ctxt verbose
   then writeln s else ();
 
-fun test_terms ctxt (limit_time, is_interactive) insts goals =
-  (case active_testers ctxt of
-    [] => error "No active testers for quickcheck"
-  | testers =>
-      limit (seconds (Config.get ctxt timeout)) (limit_time, is_interactive)
-        (fn () =>
-          Par_List.get_some (fn tester =>
-            tester ctxt (length testers > 1) insts goals |>
-            (fn result => if exists found_counterexample result then SOME result else NONE))
-          testers)
-        (fn () => (message ctxt "Quickcheck ran out of time"; NONE)) ());
+fun test_terms ctxt0 (limit_time, is_interactive) insts goals =
+  let val ctxt = Simplifier_Trace.disable ctxt0 in
+    (case active_testers ctxt of
+      [] => error "No active testers for quickcheck"
+    | testers =>
+        limit (seconds (Config.get ctxt timeout)) (limit_time, is_interactive)
+          (fn () =>
+            Par_List.get_some (fn tester =>
+              tester ctxt (length testers > 1) insts goals |>
+              (fn result => if exists found_counterexample result then SOME result else NONE))
+            testers)
+          (fn () => (message ctxt "Quickcheck ran out of time"; NONE)) ())
+  end
 
 fun all_axioms_of ctxt t =
   let