aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Gross2019-10-26 00:46:14 -0400
committerJason Gross2019-10-29 12:36:49 -0400
commitc9adfcd356f2563d7c4b3927669a8268f184ec24 (patch)
treee0c51e8609f5c89a207549f911d57bbf18d00df5
parentc59815c860a11948359e96ecc51d566bb5e5d8fb (diff)
Fix #9114, assert_succeeds (exact I) solves goal
-rw-r--r--doc/changelog/04-tactics/10966-assert-succeeds-once.rst5
-rw-r--r--doc/sphinx/proof-engine/ltac.rst6
-rw-r--r--test-suite/bugs/closed/bug_9114.v5
-rw-r--r--theories/Init/Tactics.v2
4 files changed, 15 insertions, 3 deletions
diff --git a/doc/changelog/04-tactics/10966-assert-succeeds-once.rst b/doc/changelog/04-tactics/10966-assert-succeeds-once.rst
index d97c69737e..09bef82c80 100644
--- a/doc/changelog/04-tactics/10966-assert-succeeds-once.rst
+++ b/doc/changelog/04-tactics/10966-assert-succeeds-once.rst
@@ -4,3 +4,8 @@
multisuccess tactics with :tacn:`assert_succeeds`. (`#10966
<https://github.com/coq/coq/pull/10966>`_ fixes `#10965
<https://github.com/coq/coq/issues/10965>`_, by Jason Gross).
+
+- The :tacn:`assert_succeeds` and :tacn:`assert_fails` tactics now
+ behave correctly when their tactic fully solves the goal. (`#10966
+ <https://github.com/coq/coq/pull/10966>`_ fixes `#9114
+ <https://github.com/coq/coq/issues/9114>`_, by Jason Gross).
diff --git a/doc/sphinx/proof-engine/ltac.rst b/doc/sphinx/proof-engine/ltac.rst
index aa4e90560b..6efc634087 100644
--- a/doc/sphinx/proof-engine/ltac.rst
+++ b/doc/sphinx/proof-engine/ltac.rst
@@ -516,7 +516,9 @@ Coq provides a derived tactic to check that a tactic *fails*:
.. tacn:: assert_fails @ltac_expr
:name: assert_fails
- This behaves like :n:`tryif once @ltac_expr then fail 0 tac "succeeds" else idtac`.
+ This behaves like :tacn:`idtac` if :n:`@ltac_expr` fails, and
+ behaves like :n:`fail 0 @ltac_expr "succeeds"` if :n:`@ltac_expr`
+ has at least one success.
Checking the success
~~~~~~~~~~~~~~~~~~~~
@@ -528,7 +530,7 @@ success:
:name: assert_succeeds
This behaves like
- :n:`tryif (assert_fails tac) then fail 0 tac "fails" else idtac`.
+ :n:`tryif (assert_fails @ltac_expr) then fail 0 @ltac_expr "fails" else idtac`.
Solving
~~~~~~~
diff --git a/test-suite/bugs/closed/bug_9114.v b/test-suite/bugs/closed/bug_9114.v
new file mode 100644
index 0000000000..2cf91c1c2b
--- /dev/null
+++ b/test-suite/bugs/closed/bug_9114.v
@@ -0,0 +1,5 @@
+Goal True.
+ assert_succeeds (exact I).
+ idtac.
+ (* Error: No such goal. *)
+Abort.
diff --git a/theories/Init/Tactics.v b/theories/Init/Tactics.v
index d26dbe55d1..b2ace39e22 100644
--- a/theories/Init/Tactics.v
+++ b/theories/Init/Tactics.v
@@ -325,7 +325,7 @@ Ltac time_constr tac :=
(** Useful combinators *)
Ltac assert_fails tac :=
- tryif once tac then fail 0 tac "succeeds" else idtac.
+ tryif (enough True as _; [ once tac | ]) then fail 0 tac "succeeds" else idtac.
Ltac assert_succeeds tac :=
tryif (assert_fails tac) then fail 0 tac "fails" else idtac.
Tactic Notation "assert_succeeds" tactic3(tac) :=