src/HOL/Tools/Predicate_Compile/predicate_compile_quickcheck.ML
changeset 42031 2de57cda5b24
parent 41472 f6ab14e61604
child 42032 143f37194911
equal deleted inserted replaced
42030:96327c909389 42031:2de57cda5b24
    20     Proof.context -> Proof.context
    20     Proof.context -> Proof.context
    21 
    21 
    22   val tracing : bool Unsynchronized.ref;
    22   val tracing : bool Unsynchronized.ref;
    23   val quiet : bool Unsynchronized.ref;
    23   val quiet : bool Unsynchronized.ref;
    24   val quickcheck_compile_term : Predicate_Compile_Aux.compilation -> bool -> bool -> int ->
    24   val quickcheck_compile_term : Predicate_Compile_Aux.compilation -> bool -> bool -> int ->
    25     Proof.context -> term -> int -> term list option * Quickcheck.report option;
    25     Proof.context -> term * term list -> int -> term list option * Quickcheck.report option;
    26 (*  val test_term : Proof.context -> bool -> int -> int -> int -> int -> term -> *)
    26 (*  val test_term : Proof.context -> bool -> int -> int -> int -> int -> term -> *)
    27   val nrandom : int Unsynchronized.ref;
    27   val nrandom : int Unsynchronized.ref;
    28   val debug : bool Unsynchronized.ref;
    28   val debug : bool Unsynchronized.ref;
    29   val function_flattening : bool Unsynchronized.ref;
    29   val function_flattening : bool Unsynchronized.ref;
    30   val no_higher_order_predicate : string list Unsynchronized.ref;
    30   val no_higher_order_predicate : string list Unsynchronized.ref;
   216     val start = start_timing ()
   216     val start = start_timing ()
   217     val result = Exn.capture f ()
   217     val result = Exn.capture f ()
   218     val time = Time.toMilliseconds (#cpu (end_timing start))
   218     val time = Time.toMilliseconds (#cpu (end_timing start))
   219   in (Exn.release result, (description, time)) end
   219   in (Exn.release result, (description, time)) end
   220 
   220 
   221 fun compile_term compilation options ctxt t =
   221 fun compile_term compilation options ctxt (t, eval_terms) =
   222   let
   222   let
       
   223     val t' = list_abs_free (Term.add_frees t [], t)
   223     val thy = Theory.copy (ProofContext.theory_of ctxt)
   224     val thy = Theory.copy (ProofContext.theory_of ctxt)
   224     val ((((full_constname, constT), vs'), intro), thy1) =
   225     val ((((full_constname, constT), vs'), intro), thy1) =
   225       Predicate_Compile_Aux.define_quickcheck_predicate t thy
   226       Predicate_Compile_Aux.define_quickcheck_predicate t' thy
   226     val thy2 = Context.theory_map (Predicate_Compile_Alternative_Defs.add_thm intro) thy1
   227     val thy2 = Context.theory_map (Predicate_Compile_Alternative_Defs.add_thm intro) thy1
   227     val (thy3, preproc_time) = cpu_time "predicate preprocessing"
   228     val (thy3, preproc_time) = cpu_time "predicate preprocessing"
   228         (fn () => Predicate_Compile.preprocess options (Const (full_constname, constT)) thy2)
   229         (fn () => Predicate_Compile.preprocess options (Const (full_constname, constT)) thy2)
   229     val (thy4, core_comp_time) = cpu_time "random_dseq core compilation"
   230     val (thy4, core_comp_time) = cpu_time "random_dseq core compilation"
   230         (fn () =>
   231         (fn () =>