294 case compilation of |
294 case compilation of |
295 Pos_Random_DSeq => |
295 Pos_Random_DSeq => |
296 let |
296 let |
297 val compiled_term = |
297 val compiled_term = |
298 Code_Runtime.dynamic_value_strict (Dseq_Result.get, put_dseq_result, "Predicate_Compile_Quickcheck.put_dseq_result") |
298 Code_Runtime.dynamic_value_strict (Dseq_Result.get, put_dseq_result, "Predicate_Compile_Quickcheck.put_dseq_result") |
299 thy4 (SOME target) |
299 (Proof_Context.init_global thy4) (SOME target) |
300 (fn proc => fn g => fn n => fn size => fn s => g n size s |>> (Limited_Sequence.map o map) proc) |
300 (fn proc => fn g => fn n => fn size => fn s => g n size s |>> (Limited_Sequence.map o map) proc) |
301 qc_term [] |
301 qc_term [] |
302 in |
302 in |
303 (fn size => fn nrandom => fn depth => |
303 (fn size => fn nrandom => fn depth => |
304 Option.map fst (Limited_Sequence.yield |
304 Option.map fst (Limited_Sequence.yield |
307 | New_Pos_Random_DSeq => |
307 | New_Pos_Random_DSeq => |
308 let |
308 let |
309 val compiled_term = |
309 val compiled_term = |
310 Code_Runtime.dynamic_value_strict |
310 Code_Runtime.dynamic_value_strict |
311 (Lseq_Result.get, put_lseq_result, "Predicate_Compile_Quickcheck.put_lseq_result") |
311 (Lseq_Result.get, put_lseq_result, "Predicate_Compile_Quickcheck.put_lseq_result") |
312 thy4 (SOME target) |
312 (Proof_Context.init_global thy4) (SOME target) |
313 (fn proc => fn g => fn nrandom => fn size => fn s => fn depth => |
313 (fn proc => fn g => fn nrandom => fn size => fn s => fn depth => |
314 g nrandom size s depth |> (Lazy_Sequence.map o map) proc) |
314 g nrandom size s depth |> (Lazy_Sequence.map o map) proc) |
315 qc_term [] |
315 qc_term [] |
316 in |
316 in |
317 fn size => fn nrandom => fn depth => Option.map fst (Lazy_Sequence.yield |
317 fn size => fn nrandom => fn depth => Option.map fst (Lazy_Sequence.yield |
323 | Pos_Generator_DSeq => |
323 | Pos_Generator_DSeq => |
324 let |
324 let |
325 val compiled_term = |
325 val compiled_term = |
326 Code_Runtime.dynamic_value_strict |
326 Code_Runtime.dynamic_value_strict |
327 (New_Dseq_Result.get, put_new_dseq_result, "Predicate_Compile_Quickcheck.put_new_dseq_result") |
327 (New_Dseq_Result.get, put_new_dseq_result, "Predicate_Compile_Quickcheck.put_new_dseq_result") |
328 thy4 (SOME target) |
328 (Proof_Context.init_global thy4) (SOME target) |
329 (fn proc => fn g => fn depth => g depth |> (Lazy_Sequence.map o map) proc) |
329 (fn proc => fn g => fn depth => g depth |> (Lazy_Sequence.map o map) proc) |
330 qc_term [] |
330 qc_term [] |
331 in |
331 in |
332 fn size => fn nrandom => fn depth => Option.map fst (Lazy_Sequence.yield (compiled_term depth)) |
332 fn size => fn nrandom => fn depth => Option.map fst (Lazy_Sequence.yield (compiled_term depth)) |
333 end |
333 end |
334 | Pos_Generator_CPS => |
334 | Pos_Generator_CPS => |
335 let |
335 let |
336 val compiled_term = |
336 val compiled_term = |
337 Code_Runtime.dynamic_value_strict |
337 Code_Runtime.dynamic_value_strict |
338 (CPS_Result.get, put_cps_result, "Predicate_Compile_Quickcheck.put_cps_result") |
338 (CPS_Result.get, put_cps_result, "Predicate_Compile_Quickcheck.put_cps_result") |
339 thy4 (SOME target) |
339 (Proof_Context.init_global thy4) (SOME target) |
340 (fn proc => fn g => fn depth => g depth |> Option.map (apsnd (map proc))) |
340 (fn proc => fn g => fn depth => g depth |> Option.map (apsnd (map proc))) |
341 qc_term [] |
341 qc_term [] |
342 in |
342 in |
343 fn _ => fn _ => Option.map snd o compiled_term |
343 fn _ => fn _ => Option.map snd o compiled_term |
344 end |
344 end |
345 | Depth_Limited_Random => |
345 | Depth_Limited_Random => |
346 let |
346 let |
347 val compiled_term = Code_Runtime.dynamic_value_strict |
347 val compiled_term = Code_Runtime.dynamic_value_strict |
348 (Pred_Result.get, put_pred_result, "Predicate_Compile_Quickcheck.put_pred_result") |
348 (Pred_Result.get, put_pred_result, "Predicate_Compile_Quickcheck.put_pred_result") |
349 thy4 (SOME target) (fn proc => fn g => fn depth => fn nrandom => fn size => fn seed => |
349 (Proof_Context.init_global thy4) (SOME target) (fn proc => fn g => fn depth => fn nrandom => fn size => fn seed => |
350 g depth nrandom size seed |> (Predicate.map o map) proc) |
350 g depth nrandom size seed |> (Predicate.map o map) proc) |
351 qc_term [] |
351 qc_term [] |
352 in |
352 in |
353 fn size => fn nrandom => fn depth => Option.map fst (Predicate.yield |
353 fn size => fn nrandom => fn depth => Option.map fst (Predicate.yield |
354 (compiled_term depth nrandom size (Random_Engine.run (fn s => (s, s))))) |
354 (compiled_term depth nrandom size (Random_Engine.run (fn s => (s, s))))) |