src/HOL/Tools/Mirabelle/mirabelle_quickcheck.ML
author desharna
Fri, 17 Dec 2021 09:51:37 +0100
changeset 74948 15ce207f69c8
parent 73847 58f6b41efe88
child 75003 f21e7e6172a0
permissions -rw-r--r--
added support for initialization messages to Mirabelle

(*  Title:      HOL/Mirabelle/Tools/mirabelle_quickcheck.ML
    Author:     Jasmin Blanchette, TU Munich
    Author:     Sascha Boehme, TU Munich
    Author:     Martin Desharnais, UniBw Munich

Mirabelle action: "quickcheck".
*)

structure Mirabelle_Quickcheck: MIRABELLE_ACTION =
struct

fun make_action ({arguments, timeout, ...} : Mirabelle.action_context) =
  let
    val has_valid_key = member (op =) ["iterations", "size", "generator"] o fst
    val quickcheck =
      Quickcheck.quickcheck (map (apsnd single) (filter has_valid_key arguments)) 1

    fun run_action ({pre, ...} : Mirabelle.command) =
      (case Timeout.apply timeout quickcheck pre of
        NONE => "no counterexample"
      | SOME _ => "counterexample found")
  in ("", {run_action = run_action, finalize = K ""}) end

val () = Mirabelle.register_action "quickcheck" make_action

end