aboutsummaryrefslogtreecommitdiff
path: root/doc/sphinx
diff options
context:
space:
mode:
authorcoqbot-app[bot]2020-11-19 13:53:18 +0000
committerGitHub2020-11-19 13:53:18 +0000
commit01dea073194bf788414af549cc2753917540e964 (patch)
treeff0e73bd0a51a4735a3e2a0dcc49477309020cbd /doc/sphinx
parent7ebdf6bdbca2be4fc4ecddff0ac97bbb41c80cd0 (diff)
parent73a2675e35b25c65582c02516943b0dd010016dd (diff)
Merge PR #12984: [printing] Order notations by matching precision first, and then by last imported
Reviewed-by: Zimmi48 Ack-by: RalfJung Ack-by: gares
Diffstat (limited to 'doc/sphinx')
-rw-r--r--doc/sphinx/user-extensions/syntax-extensions.rst22
1 files changed, 21 insertions, 1 deletions
diff --git a/doc/sphinx/user-extensions/syntax-extensions.rst b/doc/sphinx/user-extensions/syntax-extensions.rst
index 56b14d0935..16c8586a9f 100644
--- a/doc/sphinx/user-extensions/syntax-extensions.rst
+++ b/doc/sphinx/user-extensions/syntax-extensions.rst
@@ -214,7 +214,7 @@ have to be observed for notations starting with a symbol, e.g., rules
starting with “\ ``{``\ ” or “\ ``(``\ ” should be put at level 0. The list
of Coq predefined notations can be found in the chapter on :ref:`thecoqlibrary`.
-Displaying symbolic notations
+Use of notations for printing
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The command :cmd:`Notation` has an effect both on the Coq parser and on the
@@ -323,6 +323,26 @@ at the time of use of the notation.
scope. Obviously, expressions printed by means of such extra
printing rules will not be reparsed to the same form.
+.. note::
+
+ When several notations can be used to print a given term, the
+ notations which capture the largest subterm of the term are used
+ preferentially. Here is an example:
+
+ .. coqtop:: in
+
+ Notation "x < y" := (lt x y) (at level 70).
+ Notation "x < y < z" := (lt x y /\ lt y z) (at level 70, y at next level).
+
+ Check (0 < 1 /\ 1 < 2).
+
+ When several notations match the same subterm, or incomparable
+ subterms of the term to print, the notation declared most recently
+ is selected. Moreover, reimporting a library or module declares the
+ notations of this library or module again. If the notation is in a
+ scope (see :ref:`Scopes`), either the scope has to be opened or a
+ delimiter has to exist in the scope for the notation to be usable.
+
The Infix command
~~~~~~~~~~~~~~~~~~