chapter‹Experimental commands 🪙‹sketch› and 🪙‹explore››
theory Sketch_and_Explore imports Main ― ‹TODO: generalize existing sledgehammer functions to Pure›
keywords "sketch""explore""sketch_subgoals" :: diag begin
ML ‹
split_clause t =
let
val (fixes, horn) = funpow_yield (length (Term.strip_all_vars t)) Logic.dest_all_global t;
val assms = Logic.strip_imp_prems horn;
val concl = Logic.strip_imp_concl horn;
in (fixes, assms, concl) end;
print_typ ctxt T =
T
|> Syntax.string_of_typ ctxt
|> ATP_Util.maybe_quote ctxt;
print_subgoal apply_line_opt (is_prems, is_for, is_sh) ctxt indent stmt =
let
val ((fixes, _, _), ctxt') = eigen_context_for_statement stmt ctxt;
val prefix = Symbol.spaces indent;
val fixes_s =
if not is_for orelse null fixes then NONE
else SOME ("for " ^ implode_space
(map (fn (v, _) => Thy_Header.print_name' ctxt' v) fixes));
val premises_s = if is_prems then SOME "premises prems" else NONE;
val sh_s = if is_sh then SOME "sledgehammer" else NONE;
val subgoal_s = map_filter I [SOME "subgoal", premises_s, fixes_s]
|> implode_space;
val using_s = if is_prems then SOME "using prems" else NONE;
val s = cat_lines (
[subgoal_s]
@ map_filter (Option.map (fn s => prefix ^ s)) [using_s, apply_line_opt, sh_s]
@ [prefix ^ "sorry"]);
in
s
end;
subgoals options method_ref =
let
val apply_line_opt = case method_ref of
NONE => NONE
| SOME (_, toks) => SOME ("apply " ^ coalesce_method_txt (map Token.unparse toks))
val succeed_method_ref = SOME ((Method.succeed_text, Position.no_range), [])
in
print_proof_text_from_state (print_subgoals options apply_line_opt) succeed_method_ref
end;
subgoals_cmd (modes, method_ref) =
let
val is_prems = not (member (op =) modes "noprems")
val is_for = not (member (op =) modes "nofor")
val is_sh = member (op =) modes "sh"
in
Toplevel.keep_proof (fn state =>
subgoals (is_prems, is_for, is_sh) method_ref (Toplevel.proof_of state))
end;
_ =
Outer_Syntax.command 🍋‹sketch›
"print sketch of Isar proof text after method application"
(Scan.option (Scan.trace Method.parse) >> sketch_cmd);
_ =
Outer_Syntax.command 🍋‹explore›
"explore proof obligations after method application as Isar proof text"
(Scan.trace Method.parse >> explore_cmd);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.