aboutsummaryrefslogtreecommitdiff
path: root/printing/printer.ml
diff options
context:
space:
mode:
authorEmilio Jesus Gallego Arias2019-06-30 23:17:09 +0200
committerEmilio Jesus Gallego Arias2019-06-30 23:17:09 +0200
commit82aa7ed1c929533f2b9e7acaa8264c5a81e7a45e (patch)
tree5d33bce9bf95ea1812c2dc370c8d385bd7d5e774 /printing/printer.ml
parent6d6b2d7132bc768783bad6738d778519c28c8f08 (diff)
parent403917b7d9ecb2ddfaaac2185c355d415d5fa5bc (diff)
Merge PR #10356: Re-add the "Show Goal" command for Prooftree in PG.
Reviewed-by: Zimmi48 Reviewed-by: ejgallego Reviewed-by: gares Ack-by: herbelin Ack-by: jfehrle
Diffstat (limited to 'printing/printer.ml')
-rw-r--r--printing/printer.ml16
1 files changed, 16 insertions, 0 deletions
diff --git a/printing/printer.ml b/printing/printer.ml
index 0bcea3b01c..1f68018678 100644
--- a/printing/printer.ml
+++ b/printing/printer.ml
@@ -831,6 +831,22 @@ let pr_goal_by_id ~proof id =
pr_selected_subgoal (pr_id id) sigma g)
with Not_found -> user_err Pp.(str "No such goal.")
+(** print a goal identified by the goal id as it appears in -emacs mode.
+ sid should be the Stm state id corresponding to proof. Used to support
+ the Prooftree tool in Proof General. (https://askra.de/software/prooftree/).
+*)
+let pr_goal_emacs ~proof gid sid =
+ match proof with
+ | None -> user_err Pp.(str "No proof for that state.")
+ | Some proof ->
+ let pr gs =
+ v 0 ((str "goal ID " ++ (int gid) ++ str " at state " ++ (int sid)) ++ cut ()
+ ++ pr_goal gs)
+ in
+ try
+ Proof.in_proof proof (fun sigma -> pr {it=(Evar.unsafe_of_int gid);sigma=sigma;})
+ with Not_found -> user_err Pp.(str "No such goal.")
+
(* Printer function for sets of Assumptions.assumptions.
It is used primarily by the Print Assumptions command. *)