src/HOL/Mirabelle/Tools/mirabelle_quickcheck.ML
author boehmes
Wed, 02 Sep 2009 16:23:53 +0200
changeset 32496 4ab00a2642c3
parent 32467 src/HOL/Tools/Mirabelle/Tools/mirabelle_quickcheck.ML@1ad7d4fc0954
child 32497 922718ac81e4
permissions -rw-r--r--
moved Mirabelle from HOL/Tools to HOL,
added session HOL-Mirabelle
boehmes@32385
     1
(* Title:  mirabelle_quickcheck.ML
boehmes@32385
     2
   Author: Jasmin Blanchette and Sascha Boehme
boehmes@32385
     3
*)
boehmes@32385
     4
boehmes@32385
     5
structure Mirabelle_Quickcheck : MIRABELLE_ACTION =
boehmes@32385
     6
struct
boehmes@32385
     7
boehmes@32467
     8
fun quickcheck_action limit args {pre=st, ...} =
boehmes@32385
     9
  let
boehmes@32385
    10
    val has_valid_key = member (op =) ["iterations", "size", "generator"] o fst
boehmes@32467
    11
    val quickcheck = Quickcheck.quickcheck (filter has_valid_key args) 1
boehmes@32385
    12
  in
boehmes@32467
    13
    (case TimeLimit.timeLimit limit quickcheck st of
boehmes@32385
    14
      NONE => SOME "no counterexample"
boehmes@32385
    15
    | SOME _ => SOME "counterexample found")
boehmes@32385
    16
  end
boehmes@32385
    17
boehmes@32385
    18
fun invoke args = Mirabelle.register ("quickcheck", quickcheck_action args)
boehmes@32385
    19
boehmes@32385
    20
end