aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorcoqbot-app[bot]2020-11-20 22:01:06 +0000
committerGitHub2020-11-20 22:01:06 +0000
commit23d30fa1c19af9a29787204d81d7bd2d2e0c9b1f (patch)
tree98e1452ac1c2b2e88178461fbe51393d1d918f3e /doc
parent87a59a875b0945fa7976fd16b17a2ff5dd015402 (diff)
parent345bcc504a1ed4f11d328cc1dfa17ba37f6875b3 (diff)
Merge PR #13265: Add support for general non-necessarily-recursive binders in notations
Reviewed-by: ejgallego Ack-by: Zimmi48 Ack-by: jfehrle
Diffstat (limited to 'doc')
-rw-r--r--doc/changelog/03-notations/13265-master+allow-single-binder-entry.rst6
-rw-r--r--doc/sphinx/user-extensions/syntax-extensions.rst24
2 files changed, 30 insertions, 0 deletions
diff --git a/doc/changelog/03-notations/13265-master+allow-single-binder-entry.rst b/doc/changelog/03-notations/13265-master+allow-single-binder-entry.rst
new file mode 100644
index 0000000000..c973e157dd
--- /dev/null
+++ b/doc/changelog/03-notations/13265-master+allow-single-binder-entry.rst
@@ -0,0 +1,6 @@
+- **Added:**
+ The :n:`@binder` entry of :cmd:`Notation` can now be used in
+ notations expecting a single (non-recursive) binder
+ (`#13265 <https://github.com/coq/coq/pull/13265>`_,
+ by Hugo Herbelin, see section :n:`notations-and-binders` of the
+ reference manual).
diff --git a/doc/sphinx/user-extensions/syntax-extensions.rst b/doc/sphinx/user-extensions/syntax-extensions.rst
index 16c8586a9f..5cbd2e400e 100644
--- a/doc/sphinx/user-extensions/syntax-extensions.rst
+++ b/doc/sphinx/user-extensions/syntax-extensions.rst
@@ -709,6 +709,30 @@ Note also that in the absence of a ``as ident``, ``as strict pattern`` or
``as pattern`` :n:`@syntax_modifier`\s, the default is to consider sub-expressions occurring
in binding position and parsed as terms to be ``as ident``.
+Binders bound in the notation and parsed as general binders
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+It is also possible to rely on Coq's syntax of binders using the
+`binder` modifier as follows:
+
+.. coqtop:: in
+
+ Notation "'myforall' p , [ P , Q ] " := (forall p, P -> Q)
+ (at level 200, p binder).
+
+In this case, all of :n:`@ident`, :n:`{@ident}`, :n:`[@ident]`, :n:`@ident:@type`,
+:n:`{@ident:@type}`, :n:`[@ident:@type]`, :n:`'@pattern` can be used in place of
+the corresponding notation variable. In particular, the binder can
+declare implicit arguments:
+
+.. coqtop:: all
+
+ Check fun (f : myforall {a}, [a=0, Prop]) => f eq_refl.
+ Check myforall '((x,y):nat*nat), [ x = y, True ].
+
+By using instead `closed binder`, the same list of binders is allowed
+except that :n:`@ident:@type` requires parentheses around.
+
.. _NotationsWithBinders:
Binders not bound in the notation