aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Spiwack2014-09-08 09:29:20 +0200
committerArnaud Spiwack2014-09-08 10:58:22 +0200
commitd7072a91a9c40cf9a9cc6e6cdd087f925e591aec (patch)
tree59abfc567a6d9270a3721c3fa5d66585dfdcaf08
parenta1a792a0839d12c27164481c14282daf1bc900d3 (diff)
Add a tactic [revgoals] to reverse the list of focused goals.
-rw-r--r--proofs/proofview.ml6
-rw-r--r--proofs/proofview.mli3
-rw-r--r--tactics/extratactics.ml45
3 files changed, 14 insertions, 0 deletions
diff --git a/proofs/proofview.ml b/proofs/proofview.ml
index 48ca848915..7cdfacadb2 100644
--- a/proofs/proofview.ml
+++ b/proofs/proofview.ml
@@ -692,6 +692,12 @@ let swap i j =
in
Proof.set {initial with comb}
+let revgoals =
+ (* spiwack: convenience notations, waiting for ocaml 3.12 *)
+ let (>>=) = Proof.bind in
+ Proof.get >>= fun initial ->
+ Proof.set {initial with comb=List.rev initial.comb}
+
let numgoals =
(* spiwack: convenience notations, waiting for ocaml 3.12 *)
let (>>=) = Proof.bind in
diff --git a/proofs/proofview.mli b/proofs/proofview.mli
index 72dcc8c375..ae18934e71 100644
--- a/proofs/proofview.mli
+++ b/proofs/proofview.mli
@@ -287,6 +287,9 @@ val cycle : int -> unit tactic
[1] as well, rather than raising an error. *)
val swap : int -> int -> unit tactic
+(** [revgoals] reverse the list of focused goals. *)
+val revgoals : unit tactic
+
(** [numgoals] returns the number of goals under focus. *)
val numgoals : int tactic
diff --git a/tactics/extratactics.ml4 b/tactics/extratactics.ml4
index c90ec92d2b..4498c3197b 100644
--- a/tactics/extratactics.ml4
+++ b/tactics/extratactics.ml4
@@ -891,6 +891,11 @@ TACTIC EXTEND swap
| [ "swap" int_or_var(i) int_or_var(j) ] -> [ Proofview.swap (out_arg i) (out_arg j) ]
END
+(* reverses the list of focused goals *)
+TACTIC EXTEND revgoals
+| [ "revgoals" ] -> [ Proofview.revgoals ]
+END
+
type cmp =
| Eq