src/HOL/Tools/Predicate_Compile/predicate_compile_quickcheck.ML
changeset 44241 7943b69f0188
parent 43886 bf068e758783
child 45214 66ba67adafab
equal deleted inserted replaced
44240:4b1a63678839 44241:7943b69f0188
   216   let val ({cpu, ...}, result) = Timing.timing e ()
   216   let val ({cpu, ...}, result) = Timing.timing e ()
   217   in (result, (description, Time.toMilliseconds cpu)) end
   217   in (result, (description, Time.toMilliseconds cpu)) end
   218 
   218 
   219 fun compile_term compilation options ctxt t =
   219 fun compile_term compilation options ctxt t =
   220   let
   220   let
   221     val t' = list_abs_free (Term.add_frees t [], t)
   221     val t' = fold_rev absfree (Term.add_frees t []) t
   222     val thy = Theory.copy (Proof_Context.theory_of ctxt)
   222     val thy = Theory.copy (Proof_Context.theory_of ctxt)
   223     val ((((full_constname, constT), vs'), intro), thy1) =
   223     val ((((full_constname, constT), vs'), intro), thy1) =
   224       Predicate_Compile_Aux.define_quickcheck_predicate t' thy
   224       Predicate_Compile_Aux.define_quickcheck_predicate t' thy
   225     val thy2 = Context.theory_map (Predicate_Compile_Alternative_Defs.add_thm intro) thy1
   225     val thy2 = Context.theory_map (Predicate_Compile_Alternative_Defs.add_thm intro) thy1
   226     val (thy3, preproc_time) = cpu_time "predicate preprocessing"
   226     val (thy3, preproc_time) = cpu_time "predicate preprocessing"
   267             mk_split_lambda (map Free vs') (mk_new_return (HOLogic.mk_list @{typ term}
   267             mk_split_lambda (map Free vs') (mk_new_return (HOLogic.mk_list @{typ term}
   268             (map2 HOLogic.mk_term_of (map snd vs') (map Free vs')))))
   268             (map2 HOLogic.mk_term_of (map snd vs') (map Free vs')))))
   269         | Pos_Generator_DSeq => mk_gen_bind (prog,
   269         | Pos_Generator_DSeq => mk_gen_bind (prog,
   270             mk_split_lambda (map Free vs') (mk_gen_return (HOLogic.mk_list @{typ term}
   270             mk_split_lambda (map Free vs') (mk_gen_return (HOLogic.mk_list @{typ term}
   271             (map2 HOLogic.mk_term_of (map snd vs') (map Free vs')))))
   271             (map2 HOLogic.mk_term_of (map snd vs') (map Free vs')))))
   272         | Depth_Limited_Random => fold_rev (curry absdummy)
   272         | Depth_Limited_Random => fold_rev absdummy
   273             [@{typ code_numeral}, @{typ code_numeral}, @{typ code_numeral},
   273             [@{typ code_numeral}, @{typ code_numeral}, @{typ code_numeral},
   274              @{typ "code_numeral * code_numeral"}]
   274              @{typ "code_numeral * code_numeral"}]
   275             (mk_bind' (list_comb (prog, map Bound (3 downto 0)),
   275             (mk_bind' (list_comb (prog, map Bound (3 downto 0)),
   276             mk_split_lambda (map Free vs') (mk_return' (HOLogic.mk_list @{typ term}
   276             mk_split_lambda (map Free vs') (mk_return' (HOLogic.mk_list @{typ term}
   277             (map2 HOLogic.mk_term_of (map snd vs') (map Free vs'))))))
   277             (map2 HOLogic.mk_term_of (map snd vs') (map Free vs'))))))