diff options
| author | Hugo Herbelin | 2020-10-24 14:44:49 +0200 |
|---|---|---|
| committer | Hugo Herbelin | 2020-11-20 20:02:35 +0100 |
| commit | 7508be4f6d61dd2735ff0b8d406a6a66cd2faad9 (patch) | |
| tree | 38c0efea2e171e6f88b074acee52936ae365f4ee | |
| parent | 93654a0ba50f26f90f84e98b33ec13caa92d1799 (diff) | |
Documentation of the support for general single binders in notations.
Co-authored-by: Théo Zimmermann <theo.zimmi@gmail.com>
| -rw-r--r-- | doc/sphinx/user-extensions/syntax-extensions.rst | 24 |
1 files changed, 24 insertions, 0 deletions
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 |
