src/HOL/Tools/Quickcheck/narrowing_generators.ML
changeset 45757 e32dd098f57a
parent 45756 295658b28d3b
child 45760 3b5a735897c3
equal deleted inserted replaced
45756:295658b28d3b 45757:e32dd098f57a
   282                   val ml_code = "\nval _ = Context.set_thread_data (SOME (Context.map_proof (" ^ put_ml
   282                   val ml_code = "\nval _ = Context.set_thread_data (SOME (Context.map_proof (" ^ put_ml
   283                     ^ " (fn () => " ^ output_value ^ ")) (ML_Context.the_generic_context ())))";
   283                     ^ " (fn () => " ^ output_value ^ ")) (ML_Context.the_generic_context ())))";
   284                   val ctxt' = ctxt
   284                   val ctxt' = ctxt
   285                     |> put (fn () => error ("Bad evaluation for " ^ quote put_ml))
   285                     |> put (fn () => error ("Bad evaluation for " ^ quote put_ml))
   286                     |> Context.proof_map (exec false ml_code);                 
   286                     |> Context.proof_map (exec false ml_code);                 
   287                   val counterexample =  get ctxt' ()
   287                   val counterexample = get ctxt' ()
   288                 in
   288                 in
   289                   if is_genuine counterexample then
   289                   if is_genuine counterexample then
   290                     (counterexample, !current_result)
   290                     (counterexample, !current_result)
   291                   else
   291                   else
   292                     let
   292                     let
   429   
   429   
   430 fun test_term ctxt (t, eval_terms) =
   430 fun test_term ctxt (t, eval_terms) =
   431   let
   431   let
   432     fun dest_result (Quickcheck.Result r) = r 
   432     fun dest_result (Quickcheck.Result r) = r 
   433     val opts =
   433     val opts =
   434       ((not (Config.get ctxt Quickcheck.potential), Config.get ctxt Quickcheck.quiet),
   434       ((Config.get ctxt Quickcheck.genuine_only, Config.get ctxt Quickcheck.quiet),
   435         Config.get ctxt Quickcheck.size)
   435         Config.get ctxt Quickcheck.size)
   436     val thy = Proof_Context.theory_of ctxt
   436     val thy = Proof_Context.theory_of ctxt
   437     val t' = fold_rev (fn (x, T) => fn t => HOLogic.mk_all (x, T, t)) (Term.add_frees t []) t
   437     val t' = fold_rev (fn (x, T) => fn t => HOLogic.mk_all (x, T, t)) (Term.add_frees t []) t
   438     val pnf_t = make_pnf_term thy t'
   438     val pnf_t = make_pnf_term thy t'
   439   in
   439   in