135 timings = #timings r, reports = #reports r} |
135 timings = #timings r, reports = #reports r} |
136 end |
136 end |
137 | set_response _ _ NONE result = result |
137 | set_response _ _ NONE result = result |
138 |
138 |
139 |
139 |
140 fun set_counterexample counterexample (Result r) = |
|
141 Result {counterexample = counterexample, evaluation_terms = #evaluation_terms r, |
|
142 timings = #timings r, reports = #reports r} |
|
143 |
|
144 fun set_evaluation_terms evaluation_terms (Result r) = |
|
145 Result {counterexample = #counterexample r, evaluation_terms = evaluation_terms, |
|
146 timings = #timings r, reports = #reports r} |
|
147 |
|
148 fun cons_timing timing (Result r) = |
140 fun cons_timing timing (Result r) = |
149 Result {counterexample = #counterexample r, evaluation_terms = #evaluation_terms r, |
141 Result {counterexample = #counterexample r, evaluation_terms = #evaluation_terms r, |
150 timings = cons timing (#timings r), reports = #reports r} |
142 timings = cons timing (#timings r), reports = #reports r} |
151 |
143 |
152 fun cons_report size (SOME report) (Result r) = |
144 fun cons_report size (SOME report) (Result r) = |
286 val mk_batch_tester = |
278 val mk_batch_tester = |
287 gen_mk_tester (fn ctxt => AList.lookup (op =) ((fst o snd o fst o Data.get o Context.Proof) ctxt)) |
279 gen_mk_tester (fn ctxt => AList.lookup (op =) ((fst o snd o fst o Data.get o Context.Proof) ctxt)) |
288 val mk_batch_validator = |
280 val mk_batch_validator = |
289 gen_mk_tester (fn ctxt => AList.lookup (op =) ((snd o snd o fst o Data.get o Context.Proof) ctxt)) |
281 gen_mk_tester (fn ctxt => AList.lookup (op =) ((snd o snd o fst o Data.get o Context.Proof) ctxt)) |
290 |
282 |
291 fun lookup_tester ctxt = AList.lookup (op =) ((fst o fst o Data.get o Context.Proof) ctxt) |
|
292 |
|
293 (* testing propositions *) |
283 (* testing propositions *) |
294 |
284 |
295 type compile_generator = |
285 type compile_generator = |
296 Proof.context -> (term * term list) list -> int list -> term list option * report option |
286 Proof.context -> (term * term list) list -> int list -> term list option * report option |
297 |
287 |
411 (fn (i, n) => pretty_stat ("satisfied " ^ string_of_int (i + 1) ^ ". assumption") n) |
401 (fn (i, n) => pretty_stat ("satisfied " ^ string_of_int (i + 1) ^ ". assumption") n) |
412 satisfied_assms |
402 satisfied_assms |
413 @ [pretty_stat "positive conclusion tests" positive_concl_tests]) |
403 @ [pretty_stat "positive conclusion tests" positive_concl_tests]) |
414 end |
404 end |
415 |
405 |
416 fun pretty_reports ctxt (SOME reports) = |
|
417 Pretty.chunks (Pretty.fbrk :: Pretty.str "Quickcheck report:" :: |
|
418 maps (fn (size, report) => |
|
419 Pretty.str ("size " ^ string_of_int size ^ ":") :: pretty_report report @ [Pretty.brk 1]) |
|
420 (rev reports)) |
|
421 | pretty_reports ctxt NONE = Pretty.str "" |
|
422 |
|
423 fun pretty_timings timings = |
406 fun pretty_timings timings = |
424 Pretty.chunks (Pretty.fbrk :: Pretty.str "timings:" :: |
407 Pretty.chunks (Pretty.fbrk :: Pretty.str "timings:" :: |
425 maps (fn (label, time) => |
408 maps (fn (label, time) => |
426 Pretty.str (label ^ ": " ^ string_of_int time ^ " ms") :: Pretty.brk 1 :: []) (rev timings)) |
409 Pretty.str (label ^ ": " ^ string_of_int time ^ " ms") :: Pretty.brk 1 :: []) (rev timings)) |
427 |
|
428 fun pretty_counterex_and_reports ctxt auto [] = |
|
429 Pretty.chunks [Pretty.strs (tool_name auto :: |
|
430 space_explode " " "is used in a locale where no interpretation is provided."), |
|
431 Pretty.strs (space_explode " " "Please provide an executable interpretation for the locale.")] |
|
432 | pretty_counterex_and_reports ctxt auto (result :: _) = |
|
433 Pretty.chunks (pretty_counterex ctxt auto (response_of result) :: |
|
434 (* map (pretty_reports ctxt) (reports_of result) :: *) |
|
435 (if Config.get ctxt timing then cons (pretty_timings (timings_of result)) else I) []) |
|
436 |
410 |
437 (* Isar commands *) |
411 (* Isar commands *) |
438 |
412 |
439 fun read_nat s = case (Library.read_int o Symbol.explode) s |
413 fun read_nat s = case (Library.read_int o Symbol.explode) s |
440 of (k, []) => if k >= 0 then k |
414 of (k, []) => if k >= 0 then k |