author | Walther Neuper <walther.neuper@jku.at> |
Thu, 17 Dec 2020 09:10:30 +0100 | |
changeset 60134 | 85ce6e27e130 |
parent 60133 | 83003c700845 |
child 60139 | c3cb65678c47 |
permissions | -rw-r--r-- |
wenzelm@52688 | 1 |
(* Title: Pure/skip_proof.ML |
wenzelm@52688 | 2 |
Author: Makarius |
wenzelm@6888 | 3 |
|
wenzelm@52688 | 4 |
Skip proof via oracle invocation. |
wenzelm@6888 | 5 |
*) |
wenzelm@6888 | 6 |
|
wenzelm@6888 | 7 |
signature SKIP_PROOF = |
wenzelm@6888 | 8 |
sig |
wenzelm@52688 | 9 |
val report: Proof.context -> unit |
wenzelm@43290 | 10 |
val make_thm_cterm: cterm -> thm |
wenzelm@11892 | 11 |
val make_thm: theory -> term -> thm |
wneuper@59180 | 12 |
val cheat_tac: Proof.context -> int -> tactic |
wenzelm@6888 | 13 |
end; |
wenzelm@6888 | 14 |
|
wenzelm@32970 | 15 |
structure Skip_Proof: SKIP_PROOF = |
wenzelm@6888 | 16 |
struct |
wenzelm@6888 | 17 |
|
wenzelm@52688 | 18 |
(* report *) |
wenzelm@52688 | 19 |
|
wenzelm@52688 | 20 |
fun report ctxt = |
wenzelm@57636 | 21 |
if Context_Position.is_visible ctxt then |
wneuper@59324 | 22 |
Output.report [Markup.markup (Markup.bad ()) "Skipped proof"] |
wenzelm@57636 | 23 |
else (); |
walther@60133 | 24 |
fun report ctxt = |
walther@60133 | 25 |
if Context_Position.is_visible ctxt then |
walther@60133 | 26 |
((** )@{print} {a = "### Skip_Proof.report"};( *..NOT yet available 2 *) |
walther@60134 | 27 |
(**) writeln "### Skip_Proof.report";(**) |
walther@60133 | 28 |
Output.report [Markup.markup (Markup.bad ()) "Skipped proof"]) |
walther@60133 | 29 |
else (); |
wenzelm@52688 | 30 |
|
wenzelm@52688 | 31 |
|
wenzelm@11892 | 32 |
(* oracle setup *) |
wenzelm@6888 | 33 |
|
wenzelm@43290 | 34 |
val (_, make_thm_cterm) = |
wenzelm@57778 | 35 |
Context.>>> |
wneuper@59324 | 36 |
(Context.map_theory_result (Thm.add_oracle (Binding.make ("skip_proof", \<^here>), I))); |
wenzelm@43290 | 37 |
|
wneuper@59180 | 38 |
fun make_thm thy prop = make_thm_cterm (Thm.global_cterm_of thy prop); |
wenzelm@6888 | 39 |
|
wenzelm@11892 | 40 |
|
walther@60065 | 41 |
(* cheat_tac -- 'sorry' *) |
wenzelm@11892 | 42 |
|
walther@60065 | 43 |
fun cheat_tac ctxt = SUBGOAL (fn (goal, i) => |
walther@60065 | 44 |
let |
walther@60065 | 45 |
val thy = Proof_Context.theory_of ctxt; |
walther@60065 | 46 |
val assms = Assumption.all_assms_of ctxt; |
walther@60065 | 47 |
val cheat = make_thm thy (Logic.list_implies (map Thm.term_of assms, goal)); |
walther@60065 | 48 |
val thm = Drule.implies_elim_list cheat (map Thm.assume assms); |
walther@60065 | 49 |
in PRIMITIVE (Drule.with_subgoal i (Thm.elim_implies thm)) end); |
berghofe@26530 | 50 |
|
wenzelm@6888 | 51 |
end; |