Skip to content
Snippets Groups Projects
Commit 06531b45 authored by Robbert Krebbers's avatar Robbert Krebbers
Browse files

Fix documentation of `select` to state that it selects the "last" hypothesis.

parent 1f7d13f3
No related branches found
No related tags found
No related merge requests found
...@@ -51,3 +51,6 @@ Qed. ...@@ -51,3 +51,6 @@ Qed.
Goal (n : nat), m : nat, True. Goal (n : nat), m : nat, True.
Proof. intros ?. rename select nat into m. exists m. done. Qed. Proof. intros ?. rename select nat into m. exists m. done. Qed.
Goal (P : nat Prop), P 3 P 4 P 4.
Proof. intros. rename select (P _) into HP4. apply HP4. Qed.
...@@ -508,14 +508,13 @@ Ltac block_goal := match goal with [ |- ?T ] => change (block T) end. ...@@ -508,14 +508,13 @@ Ltac block_goal := match goal with [ |- ?T ] => change (block T) end.
Ltac unblock_goal := unfold block in *. Ltac unblock_goal := unfold block in *.
(** [select] finds the first hypothesis matching [pat] and passes it (** The tactic [select pat tac] finds the last (i.e., bottommost) hypothesis
to the continuation [tac]. Its main advantage over using [match goal matching [pat] and passes it to the continuation [tac]. Its main advantage over
with ] directly is that it is shorter. If [pat] matches multiple using [match goal with ] directly is that it is shorter. If [pat] matches
hypotheses, then [tac] will only be called on the first matching multiple hypotheses and [tac] fails, then [select tac] will not backtrack on
hypothesis. If [tac] fails, [select] will not backtrack on subsequent subsequent matching hypotheses.
matching hypotheses.
The tactic [select] is written in CPS and does not return the name of the
[select] is written in CPS and does not return the name of the
hypothesis due to limitations in the Ltac1 tactic runtime (see hypothesis due to limitations in the Ltac1 tactic runtime (see
https://gitter.im/coq/coq?at=5e96c82f85b01628f04bbb89). *) https://gitter.im/coq/coq?at=5e96c82f85b01628f04bbb89). *)
Tactic Notation "select" open_constr(pat) tactic3(tac) := Tactic Notation "select" open_constr(pat) tactic3(tac) :=
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment