1009 fun strip (Const ("all", _) $ Abs (_, _, t)) = strip t |
1009 fun strip (Const ("all", _) $ Abs (_, _, t)) = strip t |
1010 | strip t = t; |
1010 | strip t = t; |
1011 val (gi, frees) = Logic.goal_params |
1011 val (gi, frees) = Logic.goal_params |
1012 (prop_of (snd (snd (Proof.get_goal (Toplevel.proof_of st))))) i; |
1012 (prop_of (snd (snd (Proof.get_goal (Toplevel.proof_of st))))) i; |
1013 val gi' = ObjectLogic.atomize_term thy (map_term_types |
1013 val gi' = ObjectLogic.atomize_term thy (map_term_types |
1014 (map_type_tfree (fn p as (s, _) => getOpt (AList.lookup (op =) tvinsts s, |
1014 (map_type_tfree (fn p as (s, _) => |
1015 getOpt (default_type, TFree p)))) (subst_bounds (frees, strip gi))); |
1015 the_default (the_default (TFree p) default_type) |
|
1016 (AList.lookup (op =) tvinsts s))) (subst_bounds (frees, strip gi))); |
1016 in case test_term (Toplevel.theory_of st) size iterations gi' of |
1017 in case test_term (Toplevel.theory_of st) size iterations gi' of |
1017 NONE => writeln "No counterexamples found." |
1018 NONE => writeln "No counterexamples found." |
1018 | SOME cex => writeln ("Counterexample found:\n" ^ |
1019 | SOME cex => writeln ("Counterexample found:\n" ^ |
1019 Pretty.string_of (Pretty.chunks (map (fn (s, t) => |
1020 Pretty.string_of (Pretty.chunks (map (fn (s, t) => |
1020 Pretty.block [Pretty.str (s ^ " ="), Pretty.brk 1, |
1021 Pretty.block [Pretty.str (s ^ " ="), Pretty.brk 1, |
1187 OuterSyntax.command "quickcheck" "try to find counterexample for subgoal" K.diag |
1188 OuterSyntax.command "quickcheck" "try to find counterexample for subgoal" K.diag |
1188 (Scan.option (P.$$$ "[" |-- P.list1 |
1189 (Scan.option (P.$$$ "[" |-- P.list1 |
1189 ( parse_test_params >> (fn f => fn thy => apfst (f thy)) |
1190 ( parse_test_params >> (fn f => fn thy => apfst (f thy)) |
1190 || parse_tyinst) --| P.$$$ "]") -- Scan.optional P.nat 1 >> |
1191 || parse_tyinst) --| P.$$$ "]") -- Scan.optional P.nat 1 >> |
1191 (fn (ps, g) => Toplevel.keep (fn st => |
1192 (fn (ps, g) => Toplevel.keep (fn st => |
1192 test_goal (app (getOpt (Option.map |
1193 test_goal (app (the_default [] (Option.map (map (fn f => f (Toplevel.theory_of st))) ps)) |
1193 (map (fn f => f (Toplevel.theory_of st))) ps, [])) |
|
1194 (get_test_params (Toplevel.theory_of st), [])) g st))); |
1194 (get_test_params (Toplevel.theory_of st), [])) g st))); |
1195 |
1195 |
1196 val valueP = |
1196 val valueP = |
1197 OuterSyntax.improper_command "value" "read, evaluate and print term" K.diag |
1197 OuterSyntax.improper_command "value" "read, evaluate and print term" K.diag |
1198 (P.term >> (Toplevel.no_timing oo print_evaluated_term)); |
1198 (P.term >> (Toplevel.no_timing oo print_evaluated_term)); |