src/Tools/quickcheck.ML
changeset 62983 ba9072b303a2
parent 62982 4b71cd0bfe14
child 67149 e61557884799
equal deleted inserted replaced
62982:4b71cd0bfe14 62983:ba9072b303a2
   291 
   291 
   292 fun verbose_message ctxt s =
   292 fun verbose_message ctxt s =
   293   if not (Config.get ctxt quiet) andalso Config.get ctxt verbose
   293   if not (Config.get ctxt quiet) andalso Config.get ctxt verbose
   294   then writeln s else ();
   294   then writeln s else ();
   295 
   295 
   296 fun test_terms ctxt (limit_time, is_interactive) insts goals =
   296 fun test_terms ctxt0 (limit_time, is_interactive) insts goals =
   297   (case active_testers ctxt of
   297   let val ctxt = Simplifier_Trace.disable ctxt0 in
   298     [] => error "No active testers for quickcheck"
   298     (case active_testers ctxt of
   299   | testers =>
   299       [] => error "No active testers for quickcheck"
   300       limit (seconds (Config.get ctxt timeout)) (limit_time, is_interactive)
   300     | testers =>
   301         (fn () =>
   301         limit (seconds (Config.get ctxt timeout)) (limit_time, is_interactive)
   302           Par_List.get_some (fn tester =>
   302           (fn () =>
   303             tester ctxt (length testers > 1) insts goals |>
   303             Par_List.get_some (fn tester =>
   304             (fn result => if exists found_counterexample result then SOME result else NONE))
   304               tester ctxt (length testers > 1) insts goals |>
   305           testers)
   305               (fn result => if exists found_counterexample result then SOME result else NONE))
   306         (fn () => (message ctxt "Quickcheck ran out of time"; NONE)) ());
   306             testers)
       
   307           (fn () => (message ctxt "Quickcheck ran out of time"; NONE)) ())
       
   308   end
   307 
   309 
   308 fun all_axioms_of ctxt t =
   310 fun all_axioms_of ctxt t =
   309   let
   311   let
   310     val intros = Locale.get_intros ctxt;
   312     val intros = Locale.get_intros ctxt;
   311     val unfolds = Locale.get_unfolds ctxt;
   313     val unfolds = Locale.get_unfolds ctxt;