261 |
261 |
262 fun mk_test_term lookup mk_closure mk_if mk_let none_t return ctxt = |
262 fun mk_test_term lookup mk_closure mk_if mk_let none_t return ctxt = |
263 let |
263 let |
264 val cnstrs = flat (maps |
264 val cnstrs = flat (maps |
265 (map (fn (_, (Tname, _, cs)) => map (apsnd (rpair Tname o length)) cs) o #descr o snd) |
265 (map (fn (_, (Tname, _, cs)) => map (apsnd (rpair Tname o length)) cs) o #descr o snd) |
266 (Symtab.dest (BNF_LFP_Compat.get_all (Proof_Context.theory_of ctxt) BNF_LFP_Compat.Keep_Nesting))) |
266 (Symtab.dest (BNF_LFP_Compat.get_all (Proof_Context.theory_of ctxt) |
|
267 Quickcheck_Common.compat_prefs))) |
267 fun is_constrt (Const (s, T), ts) = (case (AList.lookup (op =) cnstrs s, body_type T) of |
268 fun is_constrt (Const (s, T), ts) = (case (AList.lookup (op =) cnstrs s, body_type T) of |
268 (SOME (i, Tname), Type (Tname', _)) => length ts = i andalso Tname = Tname' |
269 (SOME (i, Tname), Type (Tname', _)) => length ts = i andalso Tname = Tname' |
269 | _ => false) |
270 | _ => false) |
270 | is_constrt _ = false |
271 | is_constrt _ = false |
271 fun mk_naive_test_term t = |
272 fun mk_naive_test_term t = |
545 val setup_exhaustive_datatype_interpretation = |
546 val setup_exhaustive_datatype_interpretation = |
546 Quickcheck_Common.datatype_interpretation exhaustive_plugin |
547 Quickcheck_Common.datatype_interpretation exhaustive_plugin |
547 (@{sort exhaustive}, instantiate_exhaustive_datatype) |
548 (@{sort exhaustive}, instantiate_exhaustive_datatype) |
548 |
549 |
549 val setup_bounded_forall_datatype_interpretation = |
550 val setup_bounded_forall_datatype_interpretation = |
550 BNF_LFP_Compat.interpretation bounded_forall_plugin BNF_LFP_Compat.Keep_Nesting |
551 BNF_LFP_Compat.interpretation bounded_forall_plugin Quickcheck_Common.compat_prefs |
551 (Quickcheck_Common.ensure_sort |
552 (Quickcheck_Common.ensure_sort |
552 (((@{sort type}, @{sort type}), @{sort bounded_forall}), |
553 (((@{sort type}, @{sort type}), @{sort bounded_forall}), |
553 (fn thy => BNF_LFP_Compat.the_descr thy BNF_LFP_Compat.Keep_Nesting, instantiate_bounded_forall_datatype))) |
554 (fn thy => BNF_LFP_Compat.the_descr thy Quickcheck_Common.compat_prefs, |
|
555 instantiate_bounded_forall_datatype))) |
554 |
556 |
555 val active = Attrib.setup_config_bool @{binding quickcheck_exhaustive_active} (K true); |
557 val active = Attrib.setup_config_bool @{binding quickcheck_exhaustive_active} (K true); |
556 |
558 |
557 val setup = |
559 val setup = |
558 Quickcheck_Common.datatype_interpretation full_exhaustive_plugin |
560 Quickcheck_Common.datatype_interpretation full_exhaustive_plugin |