Theory Apply_Trace_Cmd
theory Apply_Trace_Cmd
imports Apply_Trace
keywords "apply_trace" :: prf_script
begin
ML‹
val _ =
Outer_Syntax.command @{command_keyword "apply_trace"} "initial refinement step (unstructured)"
(Args.mode "only_names" -- (Scan.option (Parse.position Parse.cartouche)) -- Method.parse >>
(fn ((on,query),text) => Toplevel.proofs (Apply_Trace.apply_results {silent_fail = false}
(Pretty.writeln ooo (Apply_Trace.pretty_deps on query)) text)));
›
lemmas [no_trace] = protectI protectD TrueI Eq_TrueI eq_reflection
lemma "(a ∧ b) = (b ∧ a)"
apply_trace auto
oops
lemma "(a ∧ b) = (b ∧ a)"
apply_trace ‹intro› auto
oops
lemma
assumes X: "b = a"
assumes Y: "b = a"
shows
"b = a"
apply_trace (rule Y)
oops
locale Apply_Trace_foo = fixes b a
assumes X: "b = a"
begin
lemma shows "b = a" "b = a"
apply -
apply_trace (rule Apply_Trace_foo.X)
prefer 2
apply_trace (rule X)
oops
end
experiment begin
text ‹Example of trace for grouped lemmas›
definition ex :: "nat set" where
"ex = {1,2,3,4}"
lemma v1: "1 ∈ ex" by (simp add: ex_def)
lemma v2: "2 ∈ ex" by (simp add: ex_def)
lemma v3: "3 ∈ ex" by (simp add: ex_def)
text ‹Group several lemmas in a single one›
lemmas vs = v1 v2 v3
lemma "2 ∈ ex"
apply_trace (simp add: vs)
oops
end
end