aboutsummaryrefslogtreecommitdiff
path: root/proofs/goal_select.ml
diff options
context:
space:
mode:
Diffstat (limited to 'proofs/goal_select.ml')
-rw-r--r--proofs/goal_select.ml19
1 files changed, 19 insertions, 0 deletions
diff --git a/proofs/goal_select.ml b/proofs/goal_select.ml
index e847535aaf..68646c93c9 100644
--- a/proofs/goal_select.ml
+++ b/proofs/goal_select.ml
@@ -57,3 +57,22 @@ let get_default_goal_selector =
~value:(SelectNth 1)
parse_goal_selector
(fun v -> Pp.string_of_ppcmds @@ pr_goal_selector v)
+
+(* Select a subset of the goals *)
+let tclSELECT ?nosuchgoal g tac = match g with
+ | SelectNth i -> Proofview.tclFOCUS ?nosuchgoal i i tac
+ | SelectList l -> Proofview.tclFOCUSLIST ?nosuchgoal l tac
+ | SelectId id -> Proofview.tclFOCUSID ?nosuchgoal id tac
+ | SelectAll -> tac
+ | SelectAlreadyFocused ->
+ let open Proofview.Notations in
+ Proofview.numgoals >>= fun n ->
+ if n == 1 then tac
+ else
+ let e = CErrors.UserError
+ (None,
+ Pp.(str "Expected a single focused goal but " ++
+ int n ++ str " goals are focused."))
+ in
+ let info = Exninfo.reify () in
+ Proofview.tclZERO ~info e