aboutsummaryrefslogtreecommitdiff
path: root/doc/sphinx
diff options
context:
space:
mode:
Diffstat (limited to 'doc/sphinx')
-rw-r--r--doc/sphinx/addendum/miscellaneous-extensions.rst67
-rw-r--r--doc/sphinx/credits.rst15
-rw-r--r--doc/sphinx/index.rst4
-rw-r--r--doc/sphinx/introduction.rst2
-rw-r--r--doc/sphinx/language/cic.rst98
-rw-r--r--doc/sphinx/language/gallina-extensions.rst295
-rw-r--r--doc/sphinx/practical-tools/coqide.rst10
-rw-r--r--doc/sphinx/practical-tools/utilities.rst999
-rw-r--r--doc/sphinx/proof-engine/proof-handling.rst592
-rw-r--r--doc/sphinx/proof-engine/ssreflect-proof-language.rst102
-rw-r--r--doc/sphinx/proof-engine/tactics.rst2
-rw-r--r--doc/sphinx/proof-engine/vernacular-commands.rst1414
-rw-r--r--doc/sphinx/user-extensions/syntax-extensions.rst20
13 files changed, 3311 insertions, 309 deletions
diff --git a/doc/sphinx/addendum/miscellaneous-extensions.rst b/doc/sphinx/addendum/miscellaneous-extensions.rst
new file mode 100644
index 0000000000..b0343a8f01
--- /dev/null
+++ b/doc/sphinx/addendum/miscellaneous-extensions.rst
@@ -0,0 +1,67 @@
+.. include:: ../replaces.rst
+
+.. _miscellaneousextensions:
+
+Miscellaneous extensions
+=======================
+
+:Source: https://coq.inria.fr/distrib/current/refman/miscellaneous.html
+:Converted by: Paul Steckler
+
+.. contents::
+ :local:
+ :depth: 1
+----
+
+Program derivation
+-----------------
+
+|Coq| comes with an extension called ``Derive``, which supports program
+derivation. Typically in the style of Bird and Meertens or derivations
+of program refinements. To use the Derive extension it must first be
+required with ``Require Coq.Derive.Derive``. When the extension is loaded,
+it provides the following command:
+
+.. cmd:: Derive @ident SuchThat @term As @ident
+
+The first `ident` can appear in `term`. This command opens a new proof
+presenting the user with a goal for term in which the name `ident` is
+bound to an existential variable `?x` (formally, there are other goals
+standing for the existential variables but they are shelved, as
+described in Section :ref:`TODO-8.17.4`).
+
+When the proof ends two constants are defined:
+
++ The first one is named using the first `ident` and is defined as the proof of the
+ shelved goal (which is also the value of `?x`). It is always
+ transparent.
++ The second one is named using the second `ident`. It has type `term`, and its body is
+ the proof of the initially visible goal. It is opaque if the proof
+ ends with ``Qed``, and transparent if the proof ends with ``Defined``.
+
+.. example::
+ .. coqtop:: all
+
+ Require Coq.derive.Derive.
+ Require Import Coq.Numbers.Natural.Peano.NPeano.
+
+ Section P.
+
+ Variables (n m k:nat).
+
+ Derive p SuchThat ((k*n)+(k*m) = p) As h.
+ Proof.
+ rewrite <- Nat.mul_add_distr_l.
+ subst p.
+ reflexivity.
+ Qed.
+
+ End P.
+
+ Print p.
+ Check h.
+
+Any property can be used as `term`, not only an equation. In particular,
+it could be an order relation specifying some form of program
+refinement or a non-executable property from which deriving a program
+is convenient.
diff --git a/doc/sphinx/credits.rst b/doc/sphinx/credits.rst
index fac0d0a4f9..f3d9f57b42 100644
--- a/doc/sphinx/credits.rst
+++ b/doc/sphinx/credits.rst
@@ -1307,9 +1307,9 @@ features and deprecations, cleanups of the internals of the system along
with a few new features. The main user visible changes are:
- Kernel: fix a subject reduction failure due to allowing fixpoints
- on non-recursive values, which allows to recover full parametricity
- for CIC, by Matthieu Sozeau. Handling of evars in the VM (the kernel
- still does not accept evars) by Pierre-Marie Pédrot.
+ on non-recursive values, by Matthieu Sozeau.
+ Handling of evars in the VM (the kernel still does not accept evars)
+ by Pierre-Marie Pédrot.
- Notations: many improvements on recursive notations and support for
destructuring patterns in the syntax of notations by Hugo Herbelin.
@@ -1338,7 +1338,14 @@ with a few new features. The main user visible changes are:
- Documentation: a large community effort resulted in the migration
of the reference manual to the Sphinx documentation tool. The result
- is this manual.
+ is this manual. The new documentation infrastructure (based on Sphinx)
+ is by Clément Pit-Claudel. The migration was coordinated by Maxime Dénès
+ and Paul Steckler, with some help of Théo Zimmermann during the
+ final integration phase. The 14 people who ported the manual are
+ Calvin Beck, Heiko Becker, Yves Bertot, Maxime Dénès, Richard Ford,
+ Pierre Letouzey, Assia Mahboubi, Clément Pit-Claudel,
+ Laurence Rideau, Matthieu Sozeau, Paul Steckler, Enrico Tassi,
+ Laurent Théry, Nikita Zyuzin.
- Tools: experimental ``-mangle-names`` option to coqtop/coqc for
linting proof scripts, by Jasper Hugunin.
diff --git a/doc/sphinx/index.rst b/doc/sphinx/index.rst
index 3dd4f80200..15e4ff3bc5 100644
--- a/doc/sphinx/index.rst
+++ b/doc/sphinx/index.rst
@@ -24,6 +24,8 @@ Table of contents
.. toctree::
:caption: The proof engine
+ proof-engine/vernacular-commands
+ proof-engine/proof-handling
proof-engine/tactics
proof-engine/detailed-tactic-examples
proof-engine/ssreflect-proof-language
@@ -38,6 +40,7 @@ Table of contents
:caption: Practical tools
practical-tools/coq-commands
+ practical-tools/utilities
practical-tools/coqide
.. toctree::
@@ -55,6 +58,7 @@ Table of contents
addendum/nsatz
addendum/generalized-rewriting
addendum/parallel-proof-processing
+ addendum/miscellaneous-extensions
.. toctree::
:caption: Reference
diff --git a/doc/sphinx/introduction.rst b/doc/sphinx/introduction.rst
index 514745c1bf..67de2ae68e 100644
--- a/doc/sphinx/introduction.rst
+++ b/doc/sphinx/introduction.rst
@@ -2,7 +2,7 @@
Introduction
------------------------
-This document is the Reference Manual of version of the |Coq|  proof
+This document is the Reference Manual of the |Coq|  proof
assistant. A companion volume, the |Coq| Tutorial, is provided for the
beginners. It is advised to read the Tutorial first. A
book :cite:`CoqArt` on practical uses of the |Coq| system was
diff --git a/doc/sphinx/language/cic.rst b/doc/sphinx/language/cic.rst
index 7ed6524095..13d20d7cf1 100644
--- a/doc/sphinx/language/cic.rst
+++ b/doc/sphinx/language/cic.rst
@@ -373,19 +373,22 @@ following rules.
-**Remark**: **Prod-Prop** and **Prod-Set** typing-rules make sense if we consider the
-semantic difference between :math:`\Prop` and :math:`\Set`:
+.. note::
+ **Prod-Prop** and **Prod-Set** typing-rules make sense if we consider the
+ semantic difference between :math:`\Prop` and :math:`\Set`:
-+ All values of a type that has a sort :math:`\Set` are extractable.
-+ No values of a type that has a sort :math:`\Prop` are extractable.
+ + All values of a type that has a sort :math:`\Set` are extractable.
+ + No values of a type that has a sort :math:`\Prop` are extractable.
-**Remark**: We may have :math:`\letin{x}{t:T}{u}` well-typed without having
-:math:`((λ x:T.u) t)` well-typed (where :math:`T` is a type of
-:math:`t`). This is because the value :math:`t` associated to
-:math:`x` may be used in a conversion rule (see Section :ref:`Conversion-rules`).
+.. note::
+ We may have :math:`\letin{x}{t:T}{u}` well-typed without having
+ :math:`((λ x:T.u) t)` well-typed (where :math:`T` is a type of
+ :math:`t`). This is because the value :math:`t` associated to
+ :math:`x` may be used in a conversion rule
+ (see Section :ref:`Conversion-rules`).
.. _Conversion-rules:
@@ -487,29 +490,31 @@ term :math:`t` of functional type :math:`∀ x:T, U` with its so-called η-expan
for :math:`x` an arbitrary variable name fresh in :math:`t`.
-**Remark**: We deliberately do not define η-reduction:
+.. note::
-.. math::
- λ x:T. (t~x) \not\triangleright_η t
+ We deliberately do not define η-reduction:
-This is because, in general, the type of :math:`t` need not to be convertible
-to the type of :math:`λ x:T. (t~x)`. E.g., if we take :math:`f` such that:
+ .. math::
+ λ x:T. (t~x) \not\triangleright_η t
-.. math::
- f : ∀ x:\Type(2),\Type(1)
+ This is because, in general, the type of :math:`t` need not to be convertible
+ to the type of :math:`λ x:T. (t~x)`. E.g., if we take :math:`f` such that:
+
+ .. math::
+ f : ∀ x:\Type(2),\Type(1)
-then
+ then
-.. math::
- λ x:\Type(1),(f~x) : ∀ x:\Type(1),\Type(1)
+ .. math::
+ λ x:\Type(1),(f~x) : ∀ x:\Type(1),\Type(1)
-We could not allow
+ We could not allow
-.. math::
- λ x:Type(1),(f x) \triangleright_η f
+ .. math::
+ λ x:Type(1),(f x) \triangleright_η f
-because the type of the reduced term :math:`∀ x:\Type(2),\Type(1)` would not be
-convertible to the type of the original term :math:`∀ x:\Type(1),\Type(1).`
+ because the type of the reduced term :math:`∀ x:\Type(2),\Type(1)` would not be
+ convertible to the type of the original term :math:`∀ x:\Type(1),\Type(1).`
.. _Convertibility:
@@ -794,18 +799,18 @@ contains an inductive declaration.
---------------------
E[Γ] ⊢ c : C
-**Example.**
-Provided that our environment :math:`E` contains inductive definitions we showed before,
-these two inference rules above enable us to conclude that:
+.. example::
+ Provided that our environment :math:`E` contains inductive definitions we showed before,
+ these two inference rules above enable us to conclude that:
-.. math::
- \begin{array}{l}
+ .. math::
+ \begin{array}{l}
E[Γ] ⊢ \even : \nat→\Prop\\
E[Γ] ⊢ \odd : \nat→\Prop\\
E[Γ] ⊢ \even\_O : \even~O\\
E[Γ] ⊢ \even\_S : \forall~n:\nat, \odd~n → \even~(S~n)\\
E[Γ] ⊢ \odd\_S : \forall~n:\nat, \even~n → \odd~(S~n)
- \end{array}
+ \end{array}
@@ -1135,9 +1140,10 @@ eliminations schemes are allowed.
Check (fun (A:Prop) (B:Set) => prod A B).
Check (fun (A:Type) (B:Prop) => prod A B).
-Remark: Template polymorphism used to be called “sort-polymorphism of
-inductive types” before universe polymorphism (see Chapter :ref:`polymorphicuniverses`) was
-introduced.
+.. note::
+ Template polymorphism used to be called “sort-polymorphism of
+ inductive types” before universe polymorphism
+ (see Chapter :ref:`polymorphicuniverses`) was introduced.
.. _Destructors:
@@ -1473,20 +1479,20 @@ definition :math:`\ind{r}{Γ_I}{Γ_C}` with :math:`Γ_C = [c_1 :C_1 ;…;c_n :C_
-**Example.**
-Below is a typing rule for the term shown in the previous example:
-
-.. inference:: list example
-
- \begin{array}{l}
- E[Γ] ⊢ t : (\List ~\nat) \\
- E[Γ] ⊢ P : B \\
- [(\List ~\nat)|B] \\
- E[Γ] ⊢ f_1 : {(\kw{nil} ~\nat)}^P \\
- E[Γ] ⊢ f_2 : {(\kw{cons} ~\nat)}^P
- \end{array}
- ------------------------------------------------
- E[Γ] ⊢ \case(t,P,f_1 |f_2 ) : (P~t)
+.. example::
+ Below is a typing rule for the term shown in the previous example:
+
+ .. inference:: list example
+
+ \begin{array}{l}
+ E[Γ] ⊢ t : (\List ~\nat) \\
+ E[Γ] ⊢ P : B \\
+ [(\List ~\nat)|B] \\
+ E[Γ] ⊢ f_1 : {(\kw{nil} ~\nat)}^P \\
+ E[Γ] ⊢ f_2 : {(\kw{cons} ~\nat)}^P
+ \end{array}
+ ------------------------------------------------
+ E[Γ] ⊢ \case(t,P,f_1 |f_2 ) : (P~t)
.. _Definition-of-ι-reduction:
diff --git a/doc/sphinx/language/gallina-extensions.rst b/doc/sphinx/language/gallina-extensions.rst
index 1d6c11b38d..6877759806 100644
--- a/doc/sphinx/language/gallina-extensions.rst
+++ b/doc/sphinx/language/gallina-extensions.rst
@@ -41,7 +41,9 @@ Remark that the type of a particular identifier may depend on a previously-given
order of the fields is important. Finally, each `param` is a parameter of the record.
More generally, a record may have explicitly defined (a.k.a. manifest)
-fields. For instance, we might have::
+fields. For instance, we might have:
+
+.. coqtop:: in
Record ident param : sort := { ident₁ : type₁ ; ident₂ := term₂ ; ident₃ : type₃ }.
@@ -50,6 +52,8 @@ may depend on |ident_1|.
.. example::
+ The set of rational numbers may be defined as:
+
.. coqtop:: reset all
Record Rat : Set := mkRat
@@ -169,7 +173,7 @@ and the syntax `term.(@qualid` |term_1| |term_n| `)` to `@qualid` |term_1| `…`
In each case, `term` is the object projected and the
other arguments are the parameters of the inductive type.
-.. note::. Records defined with the ``Record`` keyword are not allowed to be
+.. note:: Records defined with the ``Record`` keyword are not allowed to be
recursive (references to the record's name in the type of its field
raises an error). To define recursive records, one can use the ``Inductive``
and ``CoInductive`` keywords, resulting in an inductive or co-inductive record.
@@ -181,7 +185,7 @@ other arguments are the parameters of the inductive type.
defined with the ``Record`` keyword can be activated with the
``Nonrecursive Elimination Schemes`` option (see :ref:`TODO-13.1.1-nonrecursive-elimination-schemes`).
-.. note::``Structure`` is a synonym of the keyword ``Record``.
+.. note:: ``Structure`` is a synonym of the keyword ``Record``.
.. warn:: @ident cannot be defined.
@@ -217,7 +221,9 @@ the errors of inductive definitions, as described in Section
Primitive Projections
~~~~~~~~~~~~~~~~~~~~~
-The option ``Set Primitive Projections`` turns on the use of primitive
+.. opt:: Primitive Projections
+
+Turns on the use of primitive
projections when defining subsequent records (even through the ``Inductive``
and ``CoInductive`` commands). Primitive projections
extended the Calculus of Inductive Constructions with a new binary
@@ -229,11 +235,15 @@ terms when manipulating parameterized records and typechecking time.
On the user level, primitive projections can be used as a replacement
for the usual defined ones, although there are a few notable differences.
-The internally omitted parameters can be reconstructed at printing time
-even though they are absent in the actual AST manipulated by the kernel. This
-can be obtained by setting the ``Printing Primitive Projection Parameters``
-flag. Another compatibility printing can be activated thanks to the
-``Printing Primitive Projection Compatibility`` option which governs the
+.. opt:: Printing Primitive Projection Parameters
+
+This compatibility option reconstructs internally omitted parameters at
+printing time (even though they are absent in the actual AST manipulated
+by the kernel).
+
+.. opt:: Printing Primitive Projection Compatibility
+
+This compatibility option (on by default) governs the
printing of pattern-matching over primitive records.
Primitive Record Types
@@ -244,6 +254,8 @@ record types change meaning. When a type is declared with primitive
projections, its :g:`match` construct is disabled (see :ref:`primitive_projections` though).
To eliminate the (co-)inductive type, one must use its defined primitive projections.
+.. The following paragraph is quite redundant with what is above
+
For compatibility, the parameters still appear to the user when
printing terms even though they are absent in the actual AST
manipulated by the kernel. This can be changed by unsetting the
@@ -462,116 +474,63 @@ of :g:`match` expressions.
Printing nested patterns
+++++++++++++++++++++++++
+.. opt:: Printing Matching.
+
The Calculus of Inductive Constructions knows pattern-matching only
over simple patterns. It is however convenient to re-factorize nested
pattern-matching into a single pattern-matching over a nested
-pattern. |Coq|’s printer tries to do such limited re-factorization.
-
-.. cmd:: Set Printing Matching.
+pattern.
-This tells |Coq| to try to use nested patterns. This is the default
-behavior.
+When this option is on (default), |Coq|’s printer tries to do such
+limited re-factorization.
+Turning it off tells |Coq| to print only simple pattern-matching problems
+in the same way as the |Coq| kernel handles them.
-.. cmd:: Unset Printing Matching.
-
-This tells |Coq| to print only simple pattern-matching problems in the
-same way as the |Coq| kernel handles them.
-
-.. cmd:: Test Printing Matching.
-
-This tells if the printing matching mode is on or off. The default is
-on.
Factorization of clauses with same right-hand side
++++++++++++++++++++++++++++++++++++++++++++++++++
+.. opt:: Printing Factorizable Match Patterns.
+
When several patterns share the same right-hand side, it is additionally
possible to share the clauses using disjunctive patterns. Assuming that the
-printing matching mode is on, whether |Coq|'s printer shall try to do this kind
-of factorization is governed by the following commands:
-
-.. cmd:: Set Printing Factorizable Match Patterns.
-
-This tells |Coq|'s printer to try to use disjunctive patterns. This is the
-default behavior.
-
-.. cmd:: Unset Printing Factorizable Match Patterns.
-
-This tells |Coq|'s printer not to try to use disjunctive patterns.
-
-.. cmd:: Test Printing Factorizable Match Patterns.
-
-This tells if the factorization of clauses with same right-hand side is on or
-off.
+printing matching mode is on, this option (on by default) tells |Coq|'s
+printer to try to do this kind of factorization.
Use of a default clause
+++++++++++++++++++++++
+.. opt:: Printing Allow Default Clause.
+
When several patterns share the same right-hand side which do not depend on the
arguments of the patterns, yet an extra factorization is possible: the
disjunction of patterns can be replaced with a `_` default clause. Assuming that
-the printing matching mode and the factorization mode are on, whether |Coq|'s
-printer shall try to use a default clause is governed by the following commands:
-
-.. cmd:: Set Printing Allow Default Clause.
-
-This tells |Coq|'s printer to use a default clause when relevant. This is the
-default behavior.
-
-.. cmd:: Unset Printing Allow Default Clause.
-
-This tells |Coq|'s printer not to use a default clause.
-
-.. cmd:: Test Printing Allow Default Clause.
-
-This tells if the use of a default clause is allowed.
+the printing matching mode and the factorization mode are on, this option (on by
+default) tells |Coq|'s printer to use a default clause when relevant.
Printing of wildcard patterns
++++++++++++++++++++++++++++++
-Some variables in a pattern may not occur in the right-hand side of
-the pattern-matching clause. There are options to control the display
-of these variables.
-
-.. cmd:: Set Printing Wildcard.
+.. opt:: Printing Wildcard.
-The variables having no occurrences in the right-hand side of the
+Some variables in a pattern may not occur in the right-hand side of
+the pattern-matching clause. When this option is on (default), the
+variables having no occurrences in the right-hand side of the
pattern-matching clause are just printed using the wildcard symbol
“_”.
-.. cmd:: Unset Printing Wildcard.
-
-The variables, even useless, are printed using their usual name. But
-some non-dependent variables have no name. These ones are still
-printed using a “_”.
-
-.. cmd:: Test Printing Wildcard.
-
-This tells if the wildcard printing mode is on or off. The default is
-to print wildcard for useless variables.
-
Printing of the elimination predicate
+++++++++++++++++++++++++++++++++++++
+.. opt:: Printing Synth.
+
In most of the cases, the type of the result of a matched term is
mechanically synthesizable. Especially, if the result type does not
-depend of the matched term.
-
-.. cmd:: Set Printing Synth.
-
-The result type is not printed when |Coq| knows that it can re-
+depend of the matched term. When this option is on (default),
+the result type is not printed when |Coq| knows that it can re-
synthesize it.
-.. cmd:: Unset Printing Synth.
-
-This forces the result type to be always printed.
-
-.. cmd:: Test Printing Synth.
-
-This tells if the non-printing of synthesizable types is on or off.
-The default is to not print synthesizable types.
-
Printing matching on irrefutable patterns
++++++++++++++++++++++++++++++++++++++++++
@@ -1188,24 +1147,24 @@ some of the fields and give one of its possible implementations:
Notice that ``M`` is a correct body for the component ``M2`` since its ``T``
component is equal ``nat`` and hence ``M1.T`` as specified.
-**Remarks:**
+.. note::
-#. Modules and module types can be nested components of each other.
-#. One can have sections inside a module or a module type, but not a
- module or a module type inside a section.
-#. Commands like ``Hint`` or ``Notation`` can also appear inside modules and
- module types. Note that in case of a module definition like:
+ #. Modules and module types can be nested components of each other.
+ #. One can have sections inside a module or a module type, but not a
+ module or a module type inside a section.
+ #. Commands like ``Hint`` or ``Notation`` can also appear inside modules and
+ module types. Note that in case of a module definition like:
-::
+ ::
- Module N : SIG := M.
+ Module N : SIG := M.
-or::
+ or::
- Module N : SIG. … End N.
+ Module N : SIG. … End N.
-hints and the like valid for ``N`` are not those defined in ``M`` (or the module body) but the ones defined
-in ``SIG``.
+ hints and the like valid for ``N`` are not those defined in ``M``
+ (or the module body) but the ones defined in ``SIG``.
.. _import_qualid:
@@ -1780,14 +1739,10 @@ appear strictly in the body of the type, they are implicit.
Mode for automatic declaration of implicit arguments
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-In case one wants to systematically declare implicit the arguments
-detectable as such, one may switch to the automatic declaration of
-implicit arguments mode by using the command:
+.. opt:: Implicit Arguments.
-.. cmd:: Set Implicit Arguments.
-
-Conversely, one may unset the mode by using ``Unset Implicit Arguments``.
-The mode is off by default. Auto-detection of implicit arguments is
+This option (off by default) allows to systematically declare implicit
+the arguments detectable as such. Auto-detection of implicit arguments is
governed by options controlling whether strict and contextual implicit
arguments have to be considered or not.
@@ -1796,76 +1751,53 @@ arguments have to be considered or not.
Controlling strict implicit arguments
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.. opt:: Strict Implicit.
+
When the mode for automatic declaration of implicit arguments is on,
the default is to automatically set implicit only the strict implicit
arguments plus, for historical reasons, a small subset of the non-strict
implicit arguments. To relax this constraint and to set
-implicit all non strict implicit arguments by default, use the command:
-
-.. cmd:: Unset Strict Implicit.
-
-Conversely, use the command ``Set Strict Implicit`` to restore the
-original mode that declares implicit only the strict implicit
-arguments plus a small subset of the non strict implicit arguments.
+implicit all non strict implicit arguments by default, you can turn this
+option off.
-In the other way round, to capture exactly the strict implicit
-arguments and no more than the strict implicit arguments, use the
-command
+.. opt:: Strongly Strict Implicit.
-.. cmd:: Set Strongly Strict Implicit.
-
-Conversely, use the command ``Unset Strongly Strict Implicit`` to let the
-option “Strict Implicit” decide what to do.
-
-Remark: In versions of |Coq| prior to version 8.0, the default was to
-declare the strict implicit arguments as implicit.
+Use this option (off by default) to capture exactly the strict implicit
+arguments and no more than the strict implicit arguments.
.. _controlling-contextual-implicit-args:
Controlling contextual implicit arguments
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-By default, |Coq| does not automatically set implicit the contextual
-implicit arguments. To tell |Coq| to infer also contextual implicit
-argument, use command
+.. opt:: Contextual Implicit.
-.. cmd:: Set Contextual Implicit.
-
-Conversely, use command ``Unset Contextual Implicit`` to unset the
-contextual implicit mode.
+By default, |Coq| does not automatically set implicit the contextual
+implicit arguments. You can turn this option on to tell |Coq| to also
+infer contextual implicit argument.
.. _controlling-rev-pattern-implicit-args:
Controlling reversible-pattern implicit arguments
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-By default, |Coq| does not automatically set implicit the reversible-pattern
-implicit arguments. To tell |Coq| to infer also reversible-
-pattern implicit argument, use command
-
-.. cmd:: Set Reversible Pattern Implicit.
+.. opt:: Reversible Pattern Implicit.
-Conversely, use command ``Unset Reversible Pattern Implicit`` to unset the
-reversible-pattern implicit mode.
+By default, |Coq| does not automatically set implicit the reversible-pattern
+implicit arguments. You can turn this option on to tell |Coq| to also infer
+reversible-pattern implicit argument.
.. _controlling-insertion-implicit-args:
Controlling the insertion of implicit arguments not followed by explicit arguments
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Implicit arguments can be declared to be automatically inserted when a
-function is partially applied and the next argument of the function is
-an implicit one. In case the implicit arguments are automatically
-declared (with the command ``Set Implicit Arguments``), the command
+.. opt:: Maximal Implicit Insertion.
-.. cmd:: Set Maximal Implicit Insertion.
-
-is used to tell to declare the implicit arguments with a maximal
-insertion status. By default, automatically declared implicit
-arguments are not declared to be insertable maximally. To restore the
-default mode for maximal insertion, use the command
-
-.. cmd:: Unset Maximal Implicit Insertion.
+Assuming the implicit argument mode is on, this option (off by default)
+declares implicit arguments to be automatically inserted when a
+function is partially applied and the next argument of the function is
+an implicit one.
Explicit applications
~~~~~~~~~~~~~~~~~~~~~
@@ -1935,26 +1867,18 @@ if each of them is to be used maximally or not, use the command
Explicit displaying of implicit arguments for pretty-printing
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-By default the basic pretty-printing rules hide the inferable implicit
-arguments of an application. To force printing all implicit arguments,
-use command
+.. opt:: Printing Implicit.
-.. cmd:: Set Printing Implicit.
-
-Conversely, to restore the hiding of implicit arguments, use command
+By default, the basic pretty-printing rules hide the inferable implicit
+arguments of an application. Turn this option on to force printing all
+implicit arguments.
-.. cmd:: Unset Printing Implicit.
+.. opt:: Printing Implicit Defensive.
-By default the basic pretty-printing rules display the implicit
+By default, the basic pretty-printing rules display the implicit
arguments that are not detected as strict implicit arguments. This
“defensive” mode can quickly make the display cumbersome so this can
-be deactivated by using the command
-
-.. cmd:: Unset Printing Implicit Defensive.
-
-Conversely, to force the display of non strict arguments, use command
-
-.. cmd:: Set Printing Implicit Defensive.
+be deactivated by turning this option off.
See also: ``Set Printing All`` in :ref:`printing_constructions_full`.
@@ -1981,17 +1905,14 @@ but succeeds in
Deactivation of implicit arguments for parsing
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Use of implicit arguments can be deactivated by issuing the command:
+.. opt:: Parsing Explicit.
-.. cmd:: Set Parsing Explicit.
+Turning this option on, deactivates the use of implicit arguments.
In this case, all arguments of constants, inductive types,
constructors, etc, including the arguments declared as implicit, have
-to be given as if none arguments were implicit. By symmetry, this also
-affects printing. To restore parsing and normal printing of implicit
-arguments, use:
-
-.. cmd:: Unset Parsing Explicit.
+to be given as if no arguments were implicit. By symmetry, this also
+affects printing.
Canonical structures
~~~~~~~~~~~~~~~~~~~~
@@ -2201,38 +2122,30 @@ to coercions are provided in :ref:`implicitcoercions`.
Printing constructions in full
------------------------------
+.. opt:: Printing All.
+
Coercions, implicit arguments, the type of pattern-matching, but also
notations (see :ref:`syntaxextensionsandinterpretationscopes`) can obfuscate the behavior of some
tactics (typically the tactics applying to occurrences of subterms are
-sensitive to the implicit arguments). The command
-
-.. cmd:: Set Printing All.
-
+sensitive to the implicit arguments). Turning this option on
deactivates all high-level printing features such as coercions,
implicit arguments, returned type of pattern-matching, notations and
various syntactic sugar for pattern-matching or record projections.
Otherwise said, ``Set Printing All`` includes the effects of the commands
``Set Printing Implicit``, ``Set Printing Coercions``, ``Set Printing Synth``,
``Unset Printing Projections``, and ``Unset Printing Notations``. To reactivate
-the high-level printing features, use the command
-
-.. cmd:: Unset Printing All.
+the high-level printing features, use the command ``Unset Printing All``.
Printing universes
------------------
-The following command:
+.. opt:: Printing Universes.
-.. cmd:: Set Printing Universes.
-
-activates the display of the actual level of each occurrence of ``Type``.
+Turn this option on to activate the display of the actual level of each occurrence of ``Type``.
See :ref:`TODO-4.1.1-sorts` for details. This wizard option, in combination
with ``Set Printing All`` (see :ref:`printing_constructions_full`) can help to diagnose failures
to unify terms apparently identical but internally different in the
-Calculus of Inductive Constructions. To reactivate the display of the
-actual level of the occurrences of Type, use
-
-.. cmd:: Unset Printing Universes.
+Calculus of Inductive Constructions.
The constraints on the internal level of the occurrences of Type
(see :ref:`TODO-4.1.1-sorts`) can be printed using the command
@@ -2314,18 +2227,12 @@ with a named-goal selector, see :ref:`TODO-9.2-goal-selectors`).
Explicit displaying of existential instances for pretty-printing
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The command:
-
-.. cmd:: Set Printing Existential Instances.
-
-activates the full display of how the context of an existential
-variable is instantiated at each of the occurrences of the existential
-variable.
+.. opt:: Printing Existential Instances.
-To deactivate the full display of the instances of existential
-variables, use
+This option (off by default) activates the full display of how the
+context of an existential variable is instantiated at each of the
+occurrences of the existential variable.
-.. cmd:: Unset Printing Existential Instances.
Solving existential variables using tactics
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/doc/sphinx/practical-tools/coqide.rst b/doc/sphinx/practical-tools/coqide.rst
index 1fcfc665be..a3b9426287 100644
--- a/doc/sphinx/practical-tools/coqide.rst
+++ b/doc/sphinx/practical-tools/coqide.rst
@@ -10,7 +10,7 @@ used as a user-friendly replacement to `coqtop`. Its main purpose is to
allow the user to navigate forward and backward into a Coq vernacular
file, executing corresponding commands or undoing them respectively.
-CoqIDE is run by typing the command `coqide` on the command line.
+|CoqIDE| is run by typing the command `coqide` on the command line.
Without argument, the main screen is displayed with an “unnamed
buffer”, and with a file name as argument, another buffer displaying
the contents of that file. Additionally, `coqide` accepts the same
@@ -43,7 +43,7 @@ is the one where Coq commands are currently executed.
Buffers may be edited as in any text editor, and classical basic
editing commands (Copy/Paste, …) are available in the *Edit* menu.
-CoqIDE offers only basic editing commands, so if you need more complex
+|CoqIDE| offers only basic editing commands, so if you need more complex
editing commands, you may launch your favorite text editor on the
current buffer, using the *Edit/External Editor* menu.
@@ -86,7 +86,7 @@ If you ever try to execute a command which happens to run during a
long time, and would like to abort it before its termination, you may
use the interrupt button (the white cross on a red circle).
-There are other buttons on the CoqIDE toolbar: a button to save the running
+There are other buttons on the |CoqIDE| toolbar: a button to save the running
buffer; a button to close the current buffer (an "X"); buttons to switch among
buffers (left and right arrows); an "information" button; and a "gears" button.
@@ -157,7 +157,7 @@ Queries
We call *query* any vernacular command that does not change the current state,
such as ``Check``, ``Search``, etc. To run such commands interactively, without
-writing them in scripts, CoqIDE offers a *query pane*. The query pane can be
+writing them in scripts, |CoqIDE| offers a *query pane*. The query pane can be
displayed on demand by using the ``View`` menu, or using the shortcut ``F1``.
Queries can also be performed by selecting a particular phrase, then choosing an
item from the ``Queries`` menu. The response then appears in the message window.
@@ -221,7 +221,7 @@ still edit this configuration file by hand, but this is more involved.
Using Unicode symbols
--------------------------
-CoqIDE is based on GTK+ and inherits from it support for Unicode in
+|CoqIDE| is based on GTK+ and inherits from it support for Unicode in
its text windows. Consequently a large set of symbols is available for
notations.
diff --git a/doc/sphinx/practical-tools/utilities.rst b/doc/sphinx/practical-tools/utilities.rst
new file mode 100644
index 0000000000..620c002ff3
--- /dev/null
+++ b/doc/sphinx/practical-tools/utilities.rst
@@ -0,0 +1,999 @@
+.. include:: ../replaces.rst
+
+.. _utilities:
+
+---------------------
+ Utilities
+---------------------
+
+The distribution provides utilities to simplify some tedious works
+beside proof development, tactics writing or documentation.
+
+
+Using Coq as a library
+----------------------
+
+In previous versions, ``coqmktop`` was used to build custom
+toplevels - for example for better debugging or custom static
+linking. Nowadays, the preferred method is to use ``ocamlfind``.
+
+The most basic custom toplevel is built using:
+
+::
+
+ % ocamlfind ocamlopt -thread -rectypes -linkall -linkpkg \
+ -package coq.toplevel \
+ toplevel/coqtop\_bin.ml -o my\_toplevel.native
+
+
+For example, to statically link |L_tac|, you can just do:
+
+::
+
+ % ocamlfind ocamlopt -thread -rectypes -linkall -linkpkg \
+ -package coq.toplevel -package coq.ltac \
+ toplevel/coqtop\_bin.ml -o my\_toplevel.native
+and similarly for other plugins.
+
+
+Building a |Coq| project with coq_makefile
+------------------------------------------
+
+The majority of |Coq| projects are very similar: a collection of ``.v``
+files and eventually some ``.ml`` ones (a |Coq| plugin). The main piece of
+metadata needed in order to build the project are the command line
+options to ``coqc`` (e.g. ``-R``, ``-I``, see also: Section
+:ref:`bycommandline`). Collecting the list of files and options is the job
+of the ``_CoqProject`` file.
+
+A simple example of a ``_CoqProject`` file follows:
+
+::
+
+ -R theories/ MyCode
+ theories/foo.v
+ theories/bar.v
+ -I src/
+ src/baz.ml4
+ src/bazaux.ml
+ src/qux_plugin.mlpack
+
+
+Currently, both |CoqIDE| and |ProofGeneral| (version ≥ ``4.3pre``)
+understand ``_CoqProject`` files and invoke |Coq| with the desired options.
+
+The ``coq_makefile`` utility can be used to set up a build infrastructure
+for the |Coq| project based on makefiles. The recommended way of
+invoking ``coq_makefile`` is the following one:
+
+::
+
+ coq_makefile -f _CoqProject -o CoqMakefile
+
+
+Such command generates the following files:
+
+CoqMakefile
+ is a generic makefile for ``GNU Make`` that provides
+ targets to build the project (both ``.v`` and ``.ml*`` files), to install it
+ system-wide in the ``coq-contrib`` directory (i.e. where |Coq| is installed)
+ as well as to invoke |coqdoc| to generate |HTML| documentation.
+
+CoqMakefile.conf
+ contains make variables assignments that reflect
+ the contents of the ``_CoqProject`` file as well as the path relevant to
+ |Coq|.
+
+
+An optional file ``CoqMakefile.local`` can be provided by the user in order to
+extend ``CoqMakefile``. In particular one can declare custom actions to be
+performed before or after the build process. Similarly one can customize the
+install target or even provide new targets. Extension points are documented in
+paragraph :ref:`coqmakefile:local`.
+
+The extensions of the files listed in ``_CoqProject`` is used in order to
+decide how to build them. In particular:
+
+
++ |Coq| files must use the ``.v`` extension
++ |OCaml| files must use the ``.ml`` or ``.mli`` extension
++ |OCaml| files that require pre processing for syntax
+ extensions (like ``VERNAC EXTEND``) must use the ``.ml4`` extension
++ In order to generate a plugin one has to list all |OCaml|
+ modules (i.e. ``Baz`` for ``baz.ml``) in a ``.mlpack`` file (or ``.mllib``
+ file).
+
+
+The use of ``.mlpack`` files has to be preferred over ``.mllib`` files,
+since it results in a “packed” plugin: All auxiliary modules (as
+``Baz`` and ``Bazaux``) are hidden inside the plugin’s “name space”
+(``Qux_plugin``). This reduces the chances of begin unable to load two
+distinct plugins because of a clash in their auxiliary module names.
+
+.. _coqmakefilelocal:
+
+CoqMakefile.local
++++++++++++++++++
+
+
+
+The optional file ``CoqMakefile.local`` is included by the generated
+file ``CoqMakefile``. It can contain two kinds of directives.
+
+Variable assignment
+ The variable must belong to the variables listed in the ``Parameters`` section of the generated makefile.
+ Here we describe only few of them.
+ :CAMLPKGS:
+ can be used to specify third party findlib packages, and is
+ passed to the OCaml compiler on building or linking of modules. Eg:
+ ``-package yojson``.
+ :CAMLFLAGS:
+ can be used to specify additional flags to the |OCaml|
+ compiler, like ``-bin-annot`` or ``-w``....
+ :COQC, COQDEP, COQDOC:
+ can be set in order to use alternative binaries
+ (e.g. wrappers)
+ :COQ_SRC_SUBDIRS: can be extended by including other paths in which ``*.cm*`` files are searched. For example ``COQ\_SRC\_SUBDIRS+=user-contrib/Unicoq`` lets you build a plugin containing OCaml code that depends on the OCaml code of ``Unicoq``.
+
+Rule extension
+ The following makefile rules can be extended.
+
+ .. example ::
+
+ ::
+
+ pre-all::
+ echo "This line is print before making the all target"
+ install-extra::
+ cp ThisExtraFile /there/it/goes
+
+ ``pre-all::``
+ run before the all target. One can use this to configure
+ the project, or initialize sub modules or check dependencies are met.
+
+ ``post-all::``
+ run after the all target. One can use this to run a test
+ suite, or compile extracted code.
+
+
+ ``install-extra::``
+ run after install. One can use this to install extra files.
+
+ ``install-doc::``
+ One can use this to install extra doc.
+
+ ``uninstall::``
+ \
+
+ ``uninstall-doc::``
+ \
+
+ ``clean::``
+ \
+
+ ``cleanall::``
+ \
+
+ ``archclean::``
+ \
+
+ ``merlin-hook::``
+ One can append lines to the generated .merlin file extending this
+ target.
+
+Timing targets and performance testing
+++++++++++++++++++++++++++++++++++++++
+
+The generated ``Makefile`` supports the generation of two kinds of timing
+data: per-file build-times, and per-line times for an individual file.
+
+The following targets and Makefile variables allow collection of per-
+file timing data:
+
+
++ ``TIMED=1``
+ passing this variable will cause ``make`` to emit a line
+ describing the user-space build-time and peak memory usage for each
+ file built.
+
+ .. note::
+ On ``Mac OS``, this works best if you’ve installed ``gnu-time``.
+
+ .. example::
+ For example, the output of ``make TIMED=1`` may look like
+ this:
+
+ ::
+
+ COQDEP Fast.v
+ COQDEP Slow.v
+ COQC Slow.v
+ Slow (user: 0.34 mem: 395448 ko)
+ COQC Fast.v
+ Fast (user: 0.01 mem: 45184 ko)
+
++ ``pretty-timed``
+ this target stores the output of ``make TIMED=1`` into
+ ``time-of-build.log``, and displays a table of the times, sorted from
+ slowest to fastest, which is also stored in ``time-of-build-pretty.log``.
+ If you want to construct the ``log`` for targets other than the default
+ one, you can pass them via the variable ``TGTS``, e.g., ``make pretty-timed
+ TGTS="a.vo b.vo"``.
+
+ .. ::
+ This target requires ``python`` to build the table.
+
+ .. note::
+ This target will *append* to the timing log; if you want a
+ fresh start, you must remove the ``filetime-of-build.log`` or
+ ``run make cleanall``.
+
+ .. example::
+
+ For example, the output of ``make pretty-timed`` may look like this:
+
+ ::
+
+ COQDEP Fast.v
+ COQDEP Slow.v
+ COQC Slow.v
+ Slow (user: 0.36 mem: 393912 ko)
+ COQC Fast.v
+ Fast (user: 0.05 mem: 45992 ko)
+ Time | File Name
+ --------------------
+ 0m00.41s | Total
+ --------------------
+ 0m00.36s | Slow
+ 0m00.05s | Fast
+
+
++ ``print-pretty-timed-diff``
+ this target builds a table of timing
+ changes between two compilations; run ``make make-pretty-timed-before`` to
+ build the log of the “before” times, and run ``make make-pretty-timed-
+ after`` to build the log of the “after” times. The table is printed on
+ the command line, and stored in ``time-of-build-both.log``. This target is
+ most useful for profiling the difference between two commits to a
+ repo.
+
+ .. note::
+ This target requires ``python`` to build the table.
+
+ .. note::
+ The ``make-pretty-timed-before`` and ``make-pretty-timed-after`` targets will
+ *append* to the timing log; if you want a fresh start, you must remove
+ the files ``time-of-build-before.log`` and ``time-of-build-after.log`` or run
+ ``make cleanall`` *before* building either the “before” or “after”
+ targets.
+
+ .. note::
+ The table will be sorted first by absolute time
+ differences rounded towards zero to a whole-number of seconds, then by
+ times in the “after” column, and finally lexicographically by file
+ name. This will put the biggest changes in either direction first, and
+ will prefer sorting by build-time over subsecond changes in build time
+ (which are frequently noise); lexicographic sorting forces an order on
+ files which take effectively no time to compile.
+
+ .. example::
+ For example, the output table from
+ ``make print-pretty-timed-diff`` may look like this:
+
+ ::
+
+ After | File Name | Before || Change | % Change
+ --------------------------------------------------------
+ 0m00.39s | Total | 0m00.35s || +0m00.03s | +11.42%
+ --------------------------------------------------------
+ 0m00.37s | Slow | 0m00.01s || +0m00.36s | +3600.00%
+ 0m00.02s | Fast | 0m00.34s || -0m00.32s | -94.11%
+
+
+The following targets and ``Makefile`` variables allow collection of per-
+line timing data:
+
+
++ ``TIMING=1``
+ passing this variable will cause ``make`` to use ``coqc -time`` to
+ write to a ``.v.timing`` file for each ``.v`` file compiled, which contains
+ line-by-line timing information.
+
+ .. example::
+ For example, running ``make all TIMING=1`` may result in a file like this:
+
+ ::
+
+ Chars 0 - 26 [Require~Coq.ZArith.BinInt.] 0.157 secs (0.128u,0.028s)
+ Chars 27 - 68 [Declare~Reduction~comp~:=~vm_c...] 0. secs (0.u,0.s)
+ Chars 69 - 162 [Definition~foo0~:=~Eval~comp~i...] 0.153 secs (0.136u,0.019s)
+ Chars 163 - 208 [Definition~foo1~:=~Eval~comp~i...] 0.239 secs (0.236u,0.s)
+
++ ``print-pretty-single-time-diff``
+ ::
+
+ print-pretty-single-time-diff BEFORE=path/to/file.v.before-timing AFTER=path/to/file.v.after-timing
+ this target will make a sorted table of the per-line timing differences
+ between the timing logs in the ``BEFORE`` and ``AFTER`` files, display it, and
+ save it to the file specified by the ``TIME_OF_PRETTY_BUILD_FILE`` variable,
+ which defaults to ``time-of-build-pretty.log``.
+ To generate the ``.v.before-timing`` or ``.v.after-timing`` files, you should
+ pass ``TIMING=before`` or ``TIMING=after`` rather than ``TIMING=1``.
+
+ .. note::
+ The sorting used here is the same as in the ``print-pretty-timed -diff`` target.
+
+ .. note::
+ This target requires python to build the table.
+
+ .. example::
+ For example, running ``print-pretty-single-time-diff`` might give a table like this:
+
+ ::
+
+ After | Code | Before || Change | % Change
+ ---------------------------------------------------------------------------------------------------
+ 0m00.50s | Total | 0m04.17s || -0m03.66s | -87.96%
+ ---------------------------------------------------------------------------------------------------
+ 0m00.145s | Chars 069 - 162 [Definition~foo0~:=~Eval~comp~i...] | 0m00.192s || -0m00.04s | -24.47%
+ 0m00.126s | Chars 000 - 026 [Require~Coq.ZArith.BinInt.] | 0m00.143s || -0m00.01s | -11.88%
+ N/A | Chars 027 - 068 [Declare~Reduction~comp~:=~nati...] | 0m00.s || +0m00.00s | N/A
+ 0m00.s | Chars 027 - 068 [Declare~Reduction~comp~:=~vm_c...] | N/A || +0m00.00s | N/A
+ 0m00.231s | Chars 163 - 208 [Definition~foo1~:=~Eval~comp~i...] | 0m03.836s || -0m03.60s | -93.97%
+
+
++ ``all.timing.diff``, ``path/to/file.v.timing.diff``
+ The ``path/to/file.v.timing.diff`` target will make a ``.v.timing.diff`` file for
+ the corresponding ``.v`` file, with a table as would be generated by
+ the ``print-pretty-single-time-diff`` target; it depends on having already
+ made the corresponding ``.v.before-timing`` and ``.v.after-timing`` files,
+ which can be made by passing ``TIMING=before`` and ``TIMING=after``.
+ The ``all.timing.diff`` target will make such timing difference files for
+ all of the ``.v`` files that the ``Makefile`` knows about. It will fail if
+ some ``.v.before-timing`` or ``.v.after-timing`` files don’t exist.
+
+ .. note::
+ This target requires python to build the table.
+
+
+Reusing/extending the generated Makefile
+++++++++++++++++++++++++++++++++++++++++
+
+Including the generated makefile with an include directive is
+discouraged. The contents of this file, including variable names and
+status of rules shall change in the future. Users are advised to
+include ``Makefile.conf`` or call a target of the generated Makefile as in
+``make -f Makefile target`` from another Makefile.
+
+One way to get access to all targets of the generated ``CoqMakefile`` is to
+have a generic target for invoking unknown targets.
+
+.. example::
+
+ ::
+
+ # KNOWNTARGETS will not be passed along to CoqMakefile
+ KNOWNTARGETS := CoqMakefile extra-stuff extra-stuff2
+ # KNOWNFILES will not get implicit targets from the final rule, and so
+ # depending on them won't invoke the submake
+ # Warning: These files get declared as PHONY, so any targets depending
+ # on them always get rebuilt
+ KNOWNFILES := Makefile _CoqProject
+
+ .DEFAULT_GOAL := invoke-coqmakefile
+
+ CoqMakefile: Makefile _CoqProject
+ $(COQBIN)coq_makefile -f _CoqProject -o CoqMakefile
+
+ invoke-coqmakefile: CoqMakefile
+ $(MAKE) --no-print-directory -f CoqMakefile $(filter-out $(KNOWNTARGETS),$(MAKECMDGOALS))
+
+ .PHONY: invoke-coqmakefile $(KNOWNFILES)
+
+ ####################################################################
+ ## Your targets here ##
+ ####################################################################
+
+ # This should be the last rule, to handle any targets not declared above
+ %: invoke-coqmakefile
+ @true
+
+
+
+Building a subset of the targets with -j
+++++++++++++++++++++++++++++++++++++++++
+
+To build, say, two targets foo.vo and bar.vo in parallel one can use
+``make only TGTS="foo.vo bar.vo" -j``.
+
+.. note::
+
+ ``make foo.vo bar.vo -j`` has a different meaning for the make
+ utility, in particular it may build a shared prerequisite twice.
+
+
+.. note::
+
+ For users of coq_makefile with version < 8.7
+
+ + Support for “sub-directory” is deprecated. To perform actions before
+ or after the build (like invoking ``make`` on a subdirectory) one can hook
+ in pre-all and post-all extension points.
+ + ``-extra-phony`` and ``-extra`` are deprecated. To provide additional target
+ (``.PHONY`` or not) please use ``CoqMakefile.local``.
+
+
+
+Modules dependencies
+--------------------
+
+In order to compute modules dependencies (so to use ``make``), |Coq| comes
+with an appropriate tool, ``coqdep``.
+
+``coqdep`` computes inter-module dependencies for |Coq| and |OCaml|
+programs, and prints the dependencies on the standard output in a
+format readable by make. When a directory is given as argument, it is
+recursively looked at.
+
+Dependencies of |Coq| modules are computed by looking at ``Require``
+commands (``Require``, ``Require Export``, ``Require Import``), but also at the
+command ``Declare ML Module``.
+
+Dependencies of |OCaml| modules are computed by looking at
+`open` commands and the dot notation *module.value*. However, this is
+done approximately and you are advised to use ``ocamldep`` instead for the
+|OCaml| modules dependencies.
+
+See the man page of ``coqdep`` for more details and options.
+
+The build infrastructure generated by ``coq_makefile`` uses ``coqdep`` to
+automatically compute the dependencies among the files part of the
+project.
+
+
+Documenting |Coq| files with coqdoc
+-----------------------------------
+
+|coqdoc| is a documentation tool for the proof assistant |Coq|, similar to
+``javadoc`` or ``ocamldoc``. The task of |coqdoc| is
+
+
+#. to produce a nice |Latex| and/or |HTML| document from the |Coq|
+ sources, readable for a human and not only for the proof assistant;
+#. to help the user navigating in his own (or third-party) sources.
+
+
+
+Principles
+~~~~~~~~~~
+
+Documentation is inserted into |Coq| files as *special comments*. Thus
+your files will compile as usual, whether you use |coqdoc| or not. |coqdoc|
+presupposes that the given |Coq| files are well-formed (at least
+lexically). Documentation starts with ``(**``, followed by a space, and
+ends with the pending ``*)``. The documentation format is inspired by Todd
+A. Coram’s *Almost Free Text (AFT)* tool: it is mainly ``ASCII`` text with
+some syntax-light controls, described below. |coqdoc| is robust: it
+shouldn’t fail, whatever the input is. But remember: “garbage in,
+garbage out”.
+
+
+|Coq| material inside documentation.
+++++++++++++++++++++++++++++++++++
+
+|Coq| material is quoted between the delimiters ``[`` and ``]``. Square brackets
+may be nested, the inner ones being understood as being part of the
+quoted code (thus you can quote a term like ``fun x => u`` by writing ``[fun
+x => u]``). Inside quotations, the code is pretty-printed in the same
+way as it is in code parts.
+
+Pre-formatted vernacular is enclosed by ``[[`` and ``]]``. The former must be
+followed by a newline and the latter must follow a newline.
+
+
+Pretty-printing.
+++++++++++++++++
+
+|coqdoc| uses different faces for identifiers and keywords. The pretty-
+printing of |Coq| tokens (identifiers or symbols) can be controlled
+using one of the following commands:
+
+::
+
+
+ (** printing *token* %...LATEX...% #...html...# *)
+
+
+or
+
+::
+
+
+ (** printing *token* $...LATEX math...$ #...html...# *)
+
+
+It gives the |Latex| and |HTML| texts to be produced for the given |Coq|
+token. One of the |Latex| or |HTML| text may be omitted, causing the
+default pretty-printing to be used for this token.
+
+The printing for one token can be removed with
+
+::
+
+
+ (** remove printing *token* *)
+
+
+Initially, the pretty-printing table contains the following mapping:
+
+==== === ==== ===== === ==== ==== ===
+`->` → `<-` ← `*` ×
+`<=` ≤ `>=` ≥ `=>` ⇒
+`<>` ≠ `<->` ↔ `|-` ⊢
+`\/` ∨ `/\` ∧ `~` ¬
+==== === ==== ===== === ==== ==== ===
+
+Any of these can be overwritten or suppressed using the printing
+commands.
+
+.. note ::
+ The recognition of tokens is done by a (``ocaml``) lex
+ automaton and thus applies the longest-match rule. For instance, `->~`
+ is recognized as a single token, where |Coq| sees two tokens. It is the
+ responsibility of the user to insert space between tokens *or* to give
+ pretty-printing rules for the possible combinations, e.g.
+
+ ::
+
+ (** printing ->~ %\ensuremath{\rightarrow\lnot}% *)
+
+
+
+Sections.
++++++++++
+
+Sections are introduced by 1 to 4 leading stars (i.e. at the beginning
+of the line) followed by a space. One star is a section, two stars a
+sub-section, etc. The section title is given on the remaining of the
+line.
+
+.. example::
+
+ ::
+
+ (** * Well-founded relations
+
+ In this section, we introduce... *)
+
+
+Lists.
+++++++
+
+List items are introduced by a leading dash. coqdoc uses whitespace to
+determine the depth of a new list item and which text belongs in which
+list items. A list ends when a line of text starts at or before the
+level of indenting of the list’s dash. A list item’s dash must always
+be the first non-space character on its line (so, in particular, a
+list can not begin on the first line of a comment - start it on the
+second line instead).
+
+.. example::
+
+ ::
+
+ We go by induction on [n]:
+ - If [n] is 0...
+ - If [n] is [S n'] we require...
+
+ two paragraphs of reasoning, and two subcases:
+
+ - In the first case...
+ - In the second case...
+
+ So the theorem holds.
+
+
+
+Rules.
+++++++
+
+More than 4 leading dashes produce a horizontal rule.
+
+
+Emphasis.
++++++++++
+
+Text can be italicized by placing it in underscores. A non-identifier
+character must precede the leading underscore and follow the trailing
+underscore, so that uses of underscores in names aren’t mistaken for
+emphasis. Usually, these are spaces or punctuation.
+
+::
+
+ This sentence contains some _emphasized text_.
+
+
+
+Escaping to |Latex| and |HTML|.
++++++++++++++++++++++++++++++++
+
+Pure |Latex| or |HTML| material can be inserted using the following
+escape sequences:
+
+
++ ``$...LATEX stuff...$`` inserts some |Latex| material in math mode.
+ Simply discarded in |HTML| output.
++ ``%...LATEX stuff...%`` inserts some |Latex| material. Simply
+ discarded in |HTML| output.
++ ``#...HTML stuff...#`` inserts some |HTML| material. Simply discarded in
+ |Latex| output.
+
+.. note::
+ to simply output the characters ``$``, ``%`` and ``#`` and escaping
+ their escaping role, these characters must be doubled.
+
+
+Verbatim
+++++++++
+
+Verbatim material is introduced by a leading ``<<`` and closed by ``>>``
+at the beginning of a line.
+
+.. example::
+
+ ::
+
+ Here is the corresponding caml code:
+ <<
+ let rec fact n =
+ if n <= 1 then 1 else n * fact (n-1)
+ >>
+
+
+
+Hyperlinks
+++++++++++
+
+Hyperlinks can be inserted into the |HTML| output, so that any
+identifier is linked to the place of its definition.
+
+``coqc file.v`` automatically dumps localization information in
+``file.glob`` or appends it to a file specified using option ``--dump-glob
+file``. Take care of erasing this global file, if any, when starting
+the whole compilation process.
+
+Then invoke |coqdoc| or ``coqdoc --glob-from file`` to tell |coqdoc| to look
+for name resolutions into the file ``file`` (it will look in ``file.glob``
+by default).
+
+Identifiers from the |Coq| standard library are linked to the Coq web
+site at `<http://coq.inria.fr/library/>`_. This behavior can be changed
+using command line options ``--no-externals`` and ``--coqlib``; see below.
+
+
+Hiding / Showing parts of the source.
++++++++++++++++++++++++++++++++++++++
+
+Some parts of the source can be hidden using command line options ``-g``
+and ``-l`` (see below), or using such comments:
+
+::
+
+
+ (* begin hide *)
+ *some Coq material*
+ (* end hide *)
+
+
+Conversely, some parts of the source which would be hidden can be
+shown using such comments:
+
+::
+
+
+ (* begin show *)
+ *some Coq material*
+ (* end show *)
+
+
+The latter cannot be used around some inner parts of a proof, but can
+be used around a whole proof.
+
+
+Usage
+~~~~~
+
+|coqdoc| is invoked on a shell command line as follows:
+``coqdoc <options and files>``.
+Any command line argument which is not an option is considered to be a
+file (even if it starts with a ``-``). |Coq| files are identified by the
+suffixes ``.v`` and ``.g`` and |Latex| files by the suffix ``.tex``.
+
+
+:|HTML| output: This is the default output. One |HTML| file is created for
+ each |Coq| file given on the command line, together with a file
+ ``index.html`` (unless ``option-no-index is passed``). The |HTML| pages use a
+ style sheet named ``style.css``. Such a file is distributed with |coqdoc|.
+:|Latex| output: A single |Latex| file is created, on standard
+ output. It can be redirected to a file with option ``-o``. The order of
+ files on the command line is kept in the final document. |Latex|
+ files given on the command line are copied ‘as is’ in the final
+ document . DVI and PostScript can be produced directly with the
+ options ``-dvi`` and ``-ps`` respectively.
+:TEXmacs output: To translate the input files to TEXmacs format,
+ to be used by the TEXmacs |Coq| interface.
+
+
+
+Command line options
+++++++++++++++++++++
+
+
+**Overall options**
+
+
+ :--|HTML|: Select a |HTML| output.
+ :--|Latex|: Select a |Latex| output.
+ :--dvi: Select a DVI output.
+ :--ps: Select a PostScript output.
+ :--texmacs: Select a TEXmacs output.
+ :--stdout: Write output to stdout.
+ :-o file, --output file: Redirect the output into the file ‘file’
+ (meaningless with ``-html``).
+ :-d dir, --directory dir: Output files into directory ‘dir’ instead of
+ current directory (option ``-d`` does not change the filename specified
+ with option ``-o``, if any).
+ :--body-only: Suppress the header and trailer of the final document.
+ Thus, you can insert the resulting document into a larger one.
+ :-p string, --preamble string: Insert some material in the |Latex|
+ preamble, right before ``\begin{document}`` (meaningless with ``-html``).
+ :--vernac-file file,--tex-file file: Considers the file ‘file’
+ respectively as a ``.v`` (or ``.g``) file or a ``.tex`` file.
+ :--files-from file: Read file names to process in file ‘file’ as if
+ they were given on the command line. Useful for program sources split
+ up into several directories.
+ :-q, --quiet: Be quiet. Do not print anything except errors.
+ :-h, --help: Give a short summary of the options and exit.
+ :-v, --version: Print the version and exit.
+
+
+
+**Index options**
+
+ Default behavior is to build an index, for the |HTML| output only,
+ into ``index.html``.
+
+ :--no-index: Do not output the index.
+ :--multi-index: Generate one page for each category and each letter in
+ the index, together with a top page ``index.html``.
+ :--index string: Make the filename of the index string instead of
+ “index”. Useful since “index.html” is special.
+
+
+
+**Table of contents option**
+
+ :-toc, --table-of-contents: Insert a table of contents. For a |Latex|
+ output, it inserts a ``\tableofcontents`` at the beginning of the
+ document. For a |HTML| output, it builds a table of contents into
+ ``toc.html``.
+ :--toc-depth int: Only include headers up to depth ``int`` in the table of
+ contents.
+
+
+**Hyperlinks options**
+
+ :--glob-from file: Make references using |Coq| globalizations from file
+ file. (Such globalizations are obtained with Coq option ``-dump-glob``).
+ :--no-externals: Do not insert links to the |Coq| standard library.
+ :--external url coqdir: Use given URL for linking references whose
+ name starts with prefix ``coqdir``.
+ :--coqlib url: Set base URL for the Coq standard library (default is
+ `<http://coq.inria.fr/library/>`_). This is equivalent to ``--external url
+ Coq``.
+ :-R dir coqdir: Map physical directory dir to |Coq| logical
+ directory ``coqdir`` (similarly to |Coq| option ``-R``).
+
+ .. note::
+ option ``-R`` only has
+ effect on the files *following* it on the command line, so you will
+ probably need to put this option first.
+
+
+**Title options**
+
+ :-s , --short: Do not insert titles for the files. The default
+ behavior is to insert a title like “Library Foo” for each file.
+ :--lib-name string: Print “string Foo” instead of “Library Foo” in
+ titles. For example “Chapter” and “Module” are reasonable choices.
+ :--no-lib-name: Print just “Foo” instead of “Library Foo” in titles.
+ :--lib-subtitles: Look for library subtitles. When enabled, the
+ beginning of each file is checked for a comment of the form:
+
+ ::
+
+
+ (** * ModuleName : text *)
+
+ where ``ModuleName`` must be the name of the file. If it is present, the
+ text is used as a subtitle for the module in appropriate places.
+ :-t string, --title string: Set the document title.
+
+
+**Contents options**
+
+ :-g, --gallina: Do not print proofs.
+ :-l, --light: Light mode. Suppress proofs (as with ``-g``) and the following commands:
+
+ + [Recursive] Tactic Definition
+ + Hint / Hints
+ + Require
+ + Transparent / Opaque
+ + Implicit Argument / Implicits
+ + Section / Variable / Hypothesis / End
+
+
+
+ The behavior of options ``-g`` and ``-l`` can be locally overridden using the
+ ``(* begin show *) … (* end show *)`` environment (see above).
+
+ There are a few options to drive the parsing of comments:
+
+ :--parse-comments: Parses regular comments delimited by ``(*`` and ``*)`` as
+ well. They are typeset inline.
+ :--plain-comments: Do not interpret comments, simply copy them as
+ plain-text.
+ :--interpolate: Use the globalization information to typeset
+ identifiers appearing in |Coq| escapings inside comments.
+
+**Language options**
+
+
+ Default behavior is to assume ASCII 7 bits input files.
+
+ :-latin1, --latin1: Select ISO-8859-1 input files. It is equivalent to
+ --inputenc latin1 --charset iso-8859-1.
+ :-utf8, --utf8: Set --inputenc utf8x for |Latex| output and--charset
+ utf-8 for |HTML| output. Also use Unicode replacements for a couple of
+ standard plain ASCII notations such as → for ``->`` and ∀ for ``forall``. |Latex|
+ UTF-8 support can be found
+ at `<http://www.ctan.org/pkg/unicode>`_. For the interpretation of Unicode
+ characters by |Latex|, extra packages which |coqdoc| does not provide
+ by default might be required, such as textgreek for some Greek letters
+ or ``stmaryrd`` for some mathematical symbols. If a Unicode character is
+ missing an interpretation in the utf8x input encoding, add
+ ``\DeclareUnicodeCharacter{code}{LATEX-interpretation}``. Packages
+ and declarations can be added with option ``-p``.
+ :--inputenc string: Give a |Latex| input encoding, as an option to |Latex|
+ package ``inputenc``.
+ :--charset string: Specify the |HTML| character set, to be inserted in
+ the |HTML| header.
+
+
+
+The coqdoc |Latex| style file
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+In case you choose to produce a document without the default |Latex|
+preamble (by using option ``--no-preamble``), then you must insert into
+your own preamble the command
+
+::
+
+ \usepackage{coqdoc}
+
+The package optionally takes the argument ``[color]`` to typeset
+identifiers with colors (this requires the ``xcolor`` package).
+
+Then you may alter the rendering of the document by redefining some
+macros:
+
+:coqdockw, coqdocid, …: The one-argument macros for typesetting
+ keywords and identifiers. Defaults are sans-serif for keywords and
+ italic for identifiers.For example, if you would like a slanted font
+ for keywords, you may insert
+
+ ::
+
+ \renewcommand{\coqdockw}[1]{\textsl{#1}}
+
+
+ anywhere between ``\usepackage{coqdoc}`` and ``\begin{document}``.
+
+
+:coqdocmodule:
+ One-argument macro for typesetting the title of a ``.v``
+ file. Default is
+
+ ::
+
+ \newcommand{\coqdocmodule}[1]{\section*{Module #1}}
+
+ and you may redefine it using ``\renewcommand``.
+
+Embedded Coq phrases inside |Latex| documents
+---------------------------------------------
+
+When writing a documentation about a proof development, one may want
+to insert |Coq| phrases inside a |Latex| document, possibly together
+with the corresponding answers of the system. We provide a mechanical
+way to process such |Coq| phrases embedded in |Latex| files: the ``coq-tex``
+filter. This filter extracts |Coq| phrases embedded in |Latex| files,
+evaluates them, and insert the outcome of the evaluation after each
+phrase.
+
+Starting with a file ``file.tex`` containing |Coq| phrases, the ``coq-tex``
+filter produces a file named ``file.v.tex`` with the Coq outcome.
+
+There are options to produce the |Coq| parts in smaller font, italic,
+between horizontal rules, etc. See the man page of ``coq-tex`` for more
+details.
+
+|Coq| and |GNU| |Emacs|
+-----------------------
+
+
+The |Coq| |Emacs| mode
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+|Coq| comes with a Major mode for |GNU| |Emacs|, ``gallina.el``. This mode
+provides syntax highlighting and also a rudimentary indentation
+facility in the style of the ``Caml`` |GNU| |Emacs| mode.
+
+Add the following lines to your ``.emacs`` file:
+
+::
+
+ (setq auto-mode-alist (cons '("\\.v$" . coq-mode) auto-mode-alist))
+ (autoload 'coq-mode "gallina" "Major mode for editing Coq vernacular." t)
+
+
+The |Coq| major mode is triggered by visiting a file with extension ``.v``,
+or manually with the command ``M-x coq-mode``. It gives you the correct
+syntax table for the |Coq| language, and also a rudimentary indentation
+facility:
+
+
++ pressing ``Tab`` at the beginning of a line indents the line like the
+ line above;
++ extra ``Tab``s increase the indentation level (by 2 spaces by default);
++ ``M-Tab`` decreases the indentation level.
+
+
+An inferior mode to run |Coq| under |Emacs|, by Marco Maggesi, is also
+included in the distribution, in file ``inferior-coq.el``. Instructions to
+use it are contained in this file.
+
+
+Proof General
+~~~~~~~~~~~~~
+
+|ProofGeneral| is a generic interface for proof assistants based on
+|Emacs|. The main idea is that the |Coq| commands you are editing are sent
+to a |Coq| toplevel running behind |Emacs| and the answers of the system
+automatically inserted into other |Emacs| buffers. Thus you don’t need
+to copy-paste the |Coq| material from your files to the |Coq| toplevel or
+conversely from the |Coq| toplevel to some files.
+
+|ProofGeneral| is developed and distributed independently of the system
+|Coq|. It is freely available at `<https://proofgeneral.github.io/>`_.
+
+
+Module specification
+--------------------
+
+Given a |Coq| vernacular file, the gallina filter extracts its
+specification (inductive types declarations, definitions, type of
+lemmas and theorems), removing the proofs parts of the file. The |Coq|
+file ``file.v`` gives birth to the specification file ``file.g`` (where
+the suffix ``.g`` stands for |Gallina|).
+
+See the man page of ``gallina`` for more details and options.
+
+
+Man pages
+---------
+
+There are man pages for the commands ``coqdep``, ``gallina`` and ``coq-tex``. Man
+pages are installed at installation time (see installation
+instructions in file ``INSTALL``, step 6).
diff --git a/doc/sphinx/proof-engine/proof-handling.rst b/doc/sphinx/proof-engine/proof-handling.rst
new file mode 100644
index 0000000000..52cde52c69
--- /dev/null
+++ b/doc/sphinx/proof-engine/proof-handling.rst
@@ -0,0 +1,592 @@
+.. include:: ../replaces.rst
+.. _proofhandling:
+
+-------------------
+ Proof handling
+-------------------
+
+In |Coq|’s proof editing mode all top-level commands documented in
+Chapter :ref:`vernacularcommands` remain available and the user has access to specialized
+commands dealing with proof development pragmas documented in this
+section. He can also use some other specialized commands called
+*tactics*. They are the very tools allowing the user to deal with
+logical reasoning. They are documented in Chapter :ref:`tactics`.
+When switching in editing proof mode, the prompt ``Coq <`` is changed into
+``ident <`` where ``ident`` is the declared name of the theorem currently
+edited.
+
+At each stage of a proof development, one has a list of goals to
+prove. Initially, the list consists only in the theorem itself. After
+having applied some tactics, the list of goals contains the subgoals
+generated by the tactics.
+
+To each subgoal is associated a number of hypotheses called the *local
+context* of the goal. Initially, the local context contains the local
+variables and hypotheses of the current section (see Section :ref:`TODO_gallina_assumptions`)
+and the local variables and hypotheses of the theorem statement. It is
+enriched by the use of certain tactics (see e.g. ``intro`` in Section
+:ref:`managingthelocalcontext`).
+
+When a proof is completed, the message ``Proof completed`` is displayed.
+One can then register this proof as a defined constant in the
+environment. Because there exists a correspondence between proofs and
+terms of λ-calculus, known as the *Curry-Howard isomorphism* [[How80]_,
+[Bar81]_, [Gir89]_, [Hue88]_ ], |Coq|
+stores proofs as terms of |Cic|. Those terms
+are called *proof terms*.
+
+
+.. exn:: No focused proof
+
+Coq raises this error message when one attempts to use a proof editing command
+out of the proof editing mode.
+
+Switching on/off the proof editing mode
+-------------------------------------------
+
+The proof editing mode is entered by asserting a statement, which
+typically is the assertion of a theorem:
+
+.. cmd:: Theorem @ident [@binders] : @form.
+
+The list of assertion commands is given in Section :ref:TODO-assertions_and_proof`. The
+command ``Goal`` can also be used.
+
+.. cmd:: Goal @form.
+
+This is intended for quick assertion of statements, without knowing in
+advance which name to give to the assertion, typically for quick
+testing of the provability of a statement. If the proof of the
+statement is eventually completed and validated, the statement is then
+bound to the name ``Unnamed_thm`` (or a variant of this name not already
+used for another statement).
+
+.. cmd:: Qed.
+
+This command is available in interactive editing proof mode when the
+proof is completed. Then ``Qed`` extracts a proof term from the proof
+script, switches back to Coq top-level and attaches the extracted
+proof term to the declared name of the original goal. This name is
+added to the environment as an ``Opaque`` constant.
+
+
+.. exn:: Attempt to save an incomplete proof
+
+.. note::
+
+ Sometimes an error occurs when building the proof term, because
+ tactics do not enforce completely the term construction
+ constraints.
+
+The user should also be aware of the fact that since the
+proof term is completely rechecked at this point, one may have to wait
+a while when the proof is large. In some exceptional cases one may
+even incur a memory overflow.
+
+.. cmdv:: Defined.
+
+Defines the proved term as a transparent constant.
+
+.. cmdv:: Save @ident.
+
+Forces the name of the original goal to be :n:`@ident`. This
+command (and the following ones) can only be used if the original goal
+has been opened using the ``Goal`` command.
+
+
+.. cmd:: Admitted.
+
+This command is available in interactive editing proof mode to give up
+the current proof and declare the initial goal as an axiom.
+
+
+.. cmd:: Proof @term.
+
+This command applies in proof editing mode. It is equivalent to
+
+.. cmd:: exact @term. Qed.
+
+That is, you have to give the full proof in one gulp, as a
+proof term (see Section :ref:`applyingtheorems`).
+
+
+.. cmdv:: Proof.
+
+Is a noop which is useful to delimit the sequence of tactic commands
+which start a proof, after a ``Theorem`` command. It is a good practice to
+use ``Proof``. as an opening parenthesis, closed in the script with a
+closing ``Qed``.
+
+
+See also: ``Proof with tactic.`` in Section
+:ref:`setimpautotactics`.
+
+
+.. cmd:: Proof using @ident1 ... @identn.
+
+This command applies in proof editing mode. It declares the set of
+section variables (see :ref:`TODO-gallina-assumptions`) used by the proof. At ``Qed`` time, the
+system will assert that the set of section variables actually used in
+the proof is a subset of the declared one.
+
+The set of declared variables is closed under type dependency. For
+example if ``T`` is variable and a is a variable of type ``T``, the commands
+``Proof using a`` and ``Proof using T a``` are actually equivalent.
+
+
+.. cmdv:: Proof using @ident1 ... @identn with @tactic.
+
+in Section :ref:`setimpautotactics`.
+
+.. cmdv:: Proof using All.
+
+Use all section variables.
+
+
+.. cmdv:: Proof using Type.
+
+.. cmdv:: Proof using.
+
+Use only section variables occurring in the statement.
+
+
+.. cmdv:: Proof using Type*.
+
+The ``*`` operator computes the forward transitive closure. E.g. if the
+variable ``H`` has type ``p < 5`` then ``H`` is in ``p*`` since ``p`` occurs in the type
+of ``H``. ``Type*`` is the forward transitive closure of the entire set of
+section variables occurring in the statement.
+
+
+.. cmdv:: Proof using -(@ident1 ... @identn).
+
+Use all section variables except :n:`@ident1` ... :n:`@identn`.
+
+
+.. cmdv:: Proof using @collection1 + @collection2 .
+
+
+.. cmdv:: Proof using @collection1 - @collection2 .
+
+
+.. cmdv:: Proof using @collection - ( @ident1 ... @identn ).
+
+
+.. cmdv:: Proof using @collection * .
+
+Use section variables being, respectively, in the set union, set
+difference, set complement, set forward transitive closure. See
+Section :ref:`nameaset` to know how to form a named collection. The ``*`` operator
+binds stronger than ``+`` and ``-``.
+
+
+Proof using options
+```````````````````
+
+The following options modify the behavior of ``Proof using``.
+
+
+.. cmdv:: Set Default Proof Using "@expression".
+
+Use :n:`@expression` as the default ``Proof``` using value. E.g. ``Set Default
+Proof Using "a b"``. will complete all ``Proof`` commands not followed by a
+using part with using ``a`` ``b``.
+
+
+.. cmdv:: Set Suggest Proof Using.
+
+When ``Qed`` is performed, suggest a using annotation if the user did not
+provide one.
+
+.. _`nameaset`:
+
+Name a set of section hypotheses for ``Proof using``
+````````````````````````````````````````````````````
+
+The command ``Collection`` can be used to name a set of section
+hypotheses, with the purpose of making ``Proof using`` annotations more
+compact.
+
+
+.. cmdv:: Collection Some := x y z.
+
+Define the collection named "Some" containing ``x``, ``y`` and ``z``.
+
+
+.. cmdv:: Collection Fewer := Some - z.
+
+Define the collection named "Fewer" containing only ``x`` and ``y``.
+
+
+.. cmdv:: Collection Many := Fewer + Some.
+.. cmdv:: Collection Many := Fewer - Some.
+
+Define the collection named "Many" containing the set union or set
+difference of "Fewer" and "Some".
+
+
+.. cmdv:: Collection Many := Fewer - (x y).
+
+Define the collection named "Many" containing the set difference of
+"Fewer" and the unnamed collection ``x`` ``y``.
+
+
+.. cmd:: Abort.
+
+This command cancels the current proof development, switching back to
+the previous proof development, or to the |Coq| toplevel if no other
+proof was edited.
+
+
+.. exn:: No focused proof (No proof-editing in progress)
+
+
+
+.. cmdv:: Abort @ident.
+
+Aborts the editing of the proof named :n:`@ident`.
+
+.. cmdv:: Abort All.
+
+Aborts all current goals, switching back to the |Coq|
+toplevel.
+
+
+
+.. cmd:: Existential @num := @term.
+
+This command instantiates an existential variable. :n:`@num` is an index in
+the list of uninstantiated existential variables displayed by ``Show
+Existentials`` (described in Section :ref:`requestinginformation`).
+
+This command is intended to be used to instantiate existential
+variables when the proof is completed but some uninstantiated
+existential variables remain. To instantiate existential variables
+during proof edition, you should use the tactic instantiate.
+
+
+See also: ``instantiate (num:= term).`` in Section
+:ref:`TODO-controllingtheproofflow`.
+See also: ``Grab Existential Variables.`` below.
+
+
+.. cmd:: Grab Existential Variables.
+
+This command can be run when a proof has no more goal to be solved but
+has remaining uninstantiated existential variables. It takes every
+uninstantiated existential variable and turns it into a goal.
+
+
+Navigation in the proof tree
+--------------------------------
+
+
+.. cmd:: Undo.
+
+This command cancels the effect of the last command. Thus, it
+backtracks one step.
+
+
+.. cmdv:: Undo @num.
+
+Repeats Undo :n:`@num` times.
+
+.. cmdv:: Restart.
+
+This command restores the proof editing process to the original goal.
+
+
+.. exn:: No focused proof to restart
+
+
+.. cmd:: Focus.
+
+This focuses the attention on the first subgoal to prove and the
+printing of the other subgoals is suspended until the focused subgoal
+is solved or unfocused. This is useful when there are many current
+subgoals which clutter your screen.
+
+
+.. cmdv:: Focus @num.
+
+This focuses the attention on the :n:`@num` th subgoal to
+prove.
+
+*This command is deprecated since 8.8*: prefer the use of bullets or
+focusing brackets instead, including :n:`@num : %{`
+
+.. cmd:: Unfocus.
+
+This command restores to focus the goal that were suspended by the
+last ``Focus`` command.
+
+*This command is deprecated since 8.8.*
+
+.. cmd:: Unfocused.
+
+Succeeds if the proof is fully unfocused, fails is there are some
+goals out of focus.
+
+
+.. cmd:: %{ %| %}
+
+The command ``{`` (without a terminating period) focuses on the first
+goal, much like ``Focus.`` does, however, the subproof can only be
+unfocused when it has been fully solved ( *i.e.* when there is no
+focused goal left). Unfocusing is then handled by ``}`` (again, without a
+terminating period). See also example in next section.
+
+Note that when a focused goal is proved a message is displayed
+together with a suggestion about the right bullet or ``}`` to unfocus it
+or focus the next one.
+
+.. cmdv:: @num: %{
+
+This focuses on the :n:`@num` th subgoal to prove.
+
+Error messages:
+
+.. exn:: This proof is focused, but cannot be unfocused this way
+
+You are trying to use ``}`` but the current subproof has not been fully solved.
+
+.. exn:: No such goal
+
+.. exn:: Brackets only support the single numbered goal selector
+
+
+See also error messages about bullets below.
+
+Bullets
+```````
+
+Alternatively to ``{`` and ``}``, proofs can be structured with bullets. The
+use of a bullet ``b`` for the first time focuses on the first goal ``g``, the
+same bullet cannot be used again until the proof of ``g`` is completed,
+then it is mandatory to focus the next goal with ``b``. The consequence is
+that ``g`` and all goals present when ``g`` was focused are focused with the
+same bullet ``b``. See the example below.
+
+Different bullets can be used to nest levels. The scope of bullet does
+not go beyond enclosing ``{`` and ``}``, so bullets can be reused as further
+nesting levels provided they are delimited by these. Available bullets
+are ``-``, ``+``, ``*``, ``--``, ``++``, ``**``, ``---``, ``+++``, ``***``, ... (without a terminating period).
+
+Note again that when a focused goal is proved a message is displayed
+together with a suggestion about the right bullet or ``}`` to unfocus it
+or focus the next one.
+
+.. note::
+
+ In Proof General (``Emacs`` interface to |Coq|), you must use
+ bullets with the priority ordering shown above to have a correct
+ indentation. For example ``-`` must be the outer bullet and ``**`` the inner
+ one in the example below.
+
+The following example script illustrates all these features:
+
+.. example::
+ .. coqtop:: all
+
+ Goal (((True /\ True) /\ True) /\ True) /\ True.
+ Proof.
+ split.
+ - split.
+ + split.
+ ** { split.
+ - trivial.
+ - trivial.
+ }
+ ** trivial.
+ + trivial.
+ - assert True.
+ { trivial. }
+ assumption.
+
+
+.. exn:: Wrong bullet @bullet1 : Current bullet @bullet2 is not finished.
+
+Before using bullet :n:`@bullet1` again, you should first finish proving the current focused goal. Note that :n:`@bullet1` and :n:`@bullet2` may be the same.
+
+.. exn:: Wrong bullet @bullet1 : Bullet @bullet2 is mandatory here.
+
+You must put :n:`@bullet2` to focus next goal. No other bullet is allowed here.
+
+.. exn:: No such goal. Focus next goal with bullet @bullet.
+
+You tried to applied a tactic but no goal where under focus. Using :n:`@bullet` is mandatory here.
+
+.. exn:: No such goal. Try unfocusing with %{.
+
+You just finished a goal focused by ``{``, you must unfocus it with ``}``.
+
+Set Bullet Behavior
+```````````````````
+
+The bullet behavior can be controlled by the following commands.
+
+.. opt:: Bullet Behavior "None".
+
+This makes bullets inactive.
+
+.. opt:: Bullet Behavior "Strict Subproofs".
+
+This makes bullets active (this is the default behavior).
+
+
+
+Requesting information
+----------------------
+
+
+.. cmd:: Show.
+
+This command displays the current goals.
+
+
+.. cmdv:: Show @num
+
+Displays only the :n:`@num`-th subgoal.
+
+.. exn:: No such goal
+.. exn:: No focused proof
+
+.. cmdv:: Show @ident.
+
+Displays the named goal :n:`@ident`. This is useful in
+particular to display a shelved goal but only works if the
+corresponding existential variable has been named by the user
+(see :ref:`exvariables`) as in the following example.
+
+.. example::
+
+ .. coqtop:: all
+
+ Goal exists n, n = 0.
+ eexists ?[n].
+ Show n.
+
+.. cmdv:: Show Script.
+
+Displays the whole list of tactics applied from the
+beginning of the current proof. This tactics script may contain some
+holes (subgoals not yet proved). They are printed under the form
+
+``<Your Tactic Text here>``.
+
+.. cmdv:: Show Proof.
+
+It displays the proof term generated by the tactics
+that have been applied. If the proof is not completed, this term
+contain holes, which correspond to the sub-terms which are still to be
+constructed. These holes appear as a question mark indexed by an
+integer, and applied to the list of variables in the context, since it
+may depend on them. The types obtained by abstracting away the context
+from the type of each hole-placer are also printed.
+
+.. cmdv:: Show Conjectures.
+
+It prints the list of the names of all the
+theorems that are currently being proved. As it is possible to start
+proving a previous lemma during the proof of a theorem, this list may
+contain several names.
+
+.. cmdv:: Show Intro.
+
+If the current goal begins by at least one product,
+this command prints the name of the first product, as it would be
+generated by an anonymous ``intro``. The aim of this command is to ease
+the writing of more robust scripts. For example, with an appropriate
+Proof General macro, it is possible to transform any anonymous ``intro``
+into a qualified one such as ``intro y13``. In the case of a non-product
+goal, it prints nothing.
+
+.. cmdv:: Show Intros.
+
+This command is similar to the previous one, it
+simulates the naming process of an intros.
+
+.. cmdv:: Show Existentials.
+
+It displays the set of all uninstantiated
+existential variables in the current proof tree, along with the type
+and the context of each variable.
+
+.. cmdv:: Show Match @ident.
+
+This variant displays a template of the Gallina
+``match`` construct with a branch for each constructor of the type
+:n:`@ident`
+
+.. example::
+ .. coqtop:: all
+
+ Show Match nat.
+
+.. exn:: Unknown inductive type
+
+.. exn:: Show Universes.
+
+It displays the set of all universe constraints and
+its normalized form at the current stage of the proof, useful for
+debugging universe inconsistencies.
+
+
+.. cmd:: Guarded.
+
+Some tactics (e.g. refine :ref:`applyingtheorems`) allow to build proofs using
+fixpoint or co-fixpoint constructions. Due to the incremental nature
+of interactive proof construction, the check of the termination (or
+guardedness) of the recursive calls in the fixpoint or cofixpoint
+constructions is postponed to the time of the completion of the proof.
+
+The command ``Guarded`` allows checking if the guard condition for
+fixpoint and cofixpoint is violated at some time of the construction
+of the proof without having to wait the completion of the proof.
+
+
+Controlling the effect of proof editing commands
+------------------------------------------------
+
+
+.. opt:: Hyps Limit @num.
+
+This option controls the maximum number of hypotheses displayed in goals
+after the application of a tactic. All the hypotheses remain usable
+in the proof development.
+When unset, it goes back to the default mode which is to print all
+available hypotheses.
+
+
+.. opt:: Automatic Introduction.
+
+This option controls the way binders are handled
+in assertion commands such as ``Theorem ident [binders] : form``. When the
+option is set, which is the default, binders are automatically put in
+the local context of the goal to prove.
+
+The option can be unset by issuing ``Unset Automatic Introduction``. When
+the option is unset, binders are discharged on the statement to be
+proved and a tactic such as intro (see Section :ref:`managingthelocalcontext`) has to be
+used to move the assumptions to the local context.
+
+
+Controlling memory usage
+------------------------
+
+When experiencing high memory usage the following commands can be used
+to force |Coq| to optimize some of its internal data structures.
+
+
+.. cmd:: Optimize Proof.
+
+This command forces |Coq| to shrink the data structure used to represent
+the ongoing proof.
+
+
+.. cmd:: Optimize Heap.
+
+This command forces the |OCaml| runtime to perform a heap compaction.
+This is in general an expensive operation.
+See: `OCaml Gc <http://caml.inria.fr/pub/docs/manual-ocaml/libref/Gc.html#VALcompact>`_
+There is also an analogous tactic ``optimize_heap`` (see~:ref:`tactic-optimizeheap`)
diff --git a/doc/sphinx/proof-engine/ssreflect-proof-language.rst b/doc/sphinx/proof-engine/ssreflect-proof-language.rst
index 61dffa0243..bd71e5ed81 100644
--- a/doc/sphinx/proof-engine/ssreflect-proof-language.rst
+++ b/doc/sphinx/proof-engine/ssreflect-proof-language.rst
@@ -451,7 +451,7 @@ Anonymous arguments
~~~~~~~~~~~~~~~~~~~
When in a definition, the type of a certain argument is mandatory, but
-not its name, one usually use “arrow” abstractions for prenex
+not its name, one usually uses “arrow” abstractions for prenex
arguments, or the ``(_ : term)`` syntax for inner arguments. In |SSR|,
the latter can be replaced by the open syntax ``of term`` or
(equivalently) ``& term``, which are both syntactically equivalent to a
@@ -518,7 +518,7 @@ is a valid tactic expression.
The pose tactic is also improved for the local definition of higher
order terms. Local definitions of functions can use the same syntax as
-global ones. For example the tactic ``pose`` supoprts parameters:
+global ones. For example, the tactic ``pose`` supoprts parameters:
.. example::
@@ -1295,7 +1295,7 @@ is a synonym for:
intro top; first [refine top | refine (top _) | refine (top _ _) | …]; clear top.
-where ``top`` is fresh name, and the sequence of refine tactics tries to
+where ``top`` is a fresh name, and the sequence of refine tactics tries to
catch the appropriate number of wildcards to be inserted. Note that
this use of the refine tactic implies that the tactic tries to match
the goal up to expansion of constants and evaluation of subterms.
@@ -1573,7 +1573,7 @@ The :token:`i_pattern` s can be seen as a variant of *intro patterns*
:ref:`tactics`: each performs an introduction operation, i.e., pops some
variables or assumptions from the goal.
-An :token:`s_item` can simplify the set of subgoals or the subgoal themselves:
+An :token:`s_item` can simplify the set of subgoals or the subgoals themselves:
+ ``//`` removes all the “trivial” subgoals that can be resolved by the
|SSR| tactic ``done`` described in :ref:`terminators_ssr`, i.e.,
@@ -1831,7 +1831,7 @@ compact syntax:
case: {2}_ / eqP.
-were ``_`` is interpreted as ``(_ == _)`` since
+where ``_`` is interpreted as ``(_ == _)`` since
``eqP T a b : reflect (a = b) (a == b)`` and reflect is a type family with
one index.
@@ -2074,7 +2074,7 @@ is equivalent to:
do [done | by move=> top; apply top].
-where top is a fresh name affected to the top assumption of the goal.
+where ``top`` is a fresh name assigned to the top assumption of the goal.
This applied form is supported by the : discharge tactical, and the
tactic:
@@ -2090,7 +2090,7 @@ is equivalent to:
(see section :ref:`discharge_ssr` for the documentation of the apply: combination).
-Warning The list of tactics, possibly chained by semi-columns, that
+Warning The list of tactics, possibly chained by semicolons, that
follows a by keyword is considered as a parenthesized block applied to
the current goal. Hence for example if the tactic:
@@ -2123,7 +2123,7 @@ generated by the previous tactic. This covers the frequent cases where
a tactic generates two subgoals one of which can be easily disposed
of.
-This is an other powerful way of linearization of scripts, since it
+This is another powerful way of linearization of scripts, since it
happens very often that a trivial subgoal can be solved in a less than
one line tactic. For instance, the tactic:
@@ -2131,14 +2131,14 @@ one line tactic. For instance, the tactic:
:name: last
tries to solve the last subgoal generated by the first
-tactic using the given second tactic , and fails if it does not succeeds.
-Its analogous
+tactic using the given second tactic, and fails if it does not succeed.
+Its analogue
.. tacn:: @tactic ; first by @tactic
:name: first
tries to solve the first subgoal generated by the first tactic using the
-second given tactic, and fails if it does not succeeds.
+second given tactic, and fails if it does not succeed.
|SSR| also offers an extension of this facility, by supplying
tactics to *permute* the subgoals generated by a tactic. The tactic:
@@ -2259,14 +2259,14 @@ For instance, the tactic:
tactic; do 1? rewrite mult_comm.
-rewrites at most one time the lemma ``mult_com`` in all the subgoals
+rewrites at most one time the lemma ``mult_comm`` in all the subgoals
generated by tactic , whereas the tactic:
.. coqtop:: in
tactic; do 2! rewrite mult_comm.
-rewrites exactly two times the lemma ``mult_com`` in all the subgoals
+rewrites exactly two times the lemma ``mult_comm`` in all the subgoals
generated by tactic, and fails if this rewrite is not possible in some
subgoal.
@@ -2335,10 +2335,10 @@ to the following one:
.. tacv:: @tactic in {+ @clear_switch | {? @ } @ident | ( @ident ) | ( {? @ } @ident := @c_pattern ) } {? * }
In its simplest form the last option lets one rename hypotheses that
-can’t be cleared (like section variables). For example ``(y := x)``
+can’t be cleared (like section variables). For example, ``(y := x)``
generalizes over ``x`` and reintroduces the generalized variable under the
name ``y`` (and does not clear ``x``).
-For a more precise description this form of localization refer
+For a more precise description of this form of localization refer
to :ref:`advanced_generalization_ssr`.
@@ -2351,7 +2351,7 @@ Forward reasoning structures the script by explicitly specifying some
assumptions to be added to the proof context. It is closely associated
with the declarative style of proof, since an extensive use of these
highlighted statements make the script closer to a (very detailed)
-text book proof.
+textbook proof.
Forward chaining tactics allow to state an intermediate lemma and start a
piece of script dedicated to the proof of this statement. The use of closing
@@ -2492,7 +2492,7 @@ also supported (assuming x occurs in the goal only):
have {x} -> : x = y.
-An other frequent use of the intro patterns combined with ``have`` is the
+Another frequent use of the intro patterns combined with ``have`` is the
destruction of existential assumptions like in the tactic:
.. example::
@@ -2845,8 +2845,8 @@ term -> G.
If the optional list of :token:`itent` is present
on the left side of ``/``, these constants are generalized in the
-premise (term -> G) of the first subgoal. By default the body of local
-definitions is erased. This behavior can be inhibited prefixing the
+premise (term -> G) of the first subgoal. By default bodies of local
+definitions are erased. This behavior can be inhibited by prefixing the
name of the local definition with the ``@`` character.
In the second subgoal, the tactic:
@@ -2936,7 +2936,7 @@ renaming does not require the original variable to be cleared.
The syntax ``(@x := y)`` generates a let-in abstraction but with the
following caveat: ``x`` will not bind ``y``, but its body, whenever ``y`` can be
-unfolded. This cover the case of both local and global definitions, as
+unfolded. This covers the case of both local and global definitions, as
illustrated in the following example.
.. example::
@@ -3035,7 +3035,7 @@ operation should be performed:
specifies if and how the
rewrite operation should be repeated.
+ A rewrite operation matches the occurrences of a *rewrite pattern*,
- and replaces these occurrences by an other term, according to the
+ and replaces these occurrences by another term, according to the
given :token:`r_item`. The optional *redex switch* ``[r_pattern]``,
which should
always be surrounded by brackets, gives explicitly this rewrite
@@ -3329,7 +3329,7 @@ The rewrite tactic can be provided a *tuple* of rewrite rules, or more
generally a tree of such rules, since this tuple can feature arbitrary
inner parentheses. We call *multirule* such a generalized rewrite
rule. This feature is of special interest when it is combined with
-multiplier switches, which makes the rewrite tactic iterates the
+multiplier switches, which makes the rewrite tactic iterate the
rewrite operations prescribed by the rules on the current goal.
@@ -3473,7 +3473,7 @@ efficient ones, e.g. for the purpose of a correctness proof.
Wildcards vs abstractions
`````````````````````````
-The rewrite tactic supports :token:`r_items` containing holes. For example in
+The rewrite tactic supports :token:`r_items` containing holes. For example, in
the tactic ``rewrite (_ : _ * 0 = 0).``
the term ``_ * 0 = 0`` is interpreted as ``forall n : nat, n * 0 = 0.``
Anyway this tactic is *not* equivalent to
@@ -3736,8 +3736,8 @@ replaces the occurrence(s) of :token:`ident` coded by the
We found that it was usually preferable to prevent the expansion of
some functions by the partial evaluation switch ``/=``, unless this
-allowed the evaluation of a condition. This is possible thanks to an
-other mechanism of term tagging, resting on the following *Notation*:
+allowed the evaluation of a condition. This is possible thanks to another
+mechanism of term tagging, resting on the following *Notation*:
.. coqtop:: in
@@ -3781,7 +3781,7 @@ arithmetic operations. We define for instance:
The operation ``addn`` behaves exactly like ``plus``, except that
``(addn (S n) m)`` will not simplify spontaneously to
-``(S (addn n m))`` (the two terms, however, are inter-convertible).
+``(S (addn n m))`` (the two terms, however, are convertible).
In addition, the unfolding step: ``rewrite /addn``
will replace ``addn`` directly with ``plus``, so the ``nosimpl`` form is
essentially invisible.
@@ -3792,7 +3792,7 @@ essentially invisible.
Congruence
~~~~~~~~~~
-Because of the way matching interferes with type families parameters,
+Because of the way matching interferes with parameters of type families,
the tactic:
.. coqtop:: in
@@ -3912,8 +3912,8 @@ The simple form of patterns used so far, terms possibly containing
wild cards, often require an additional :token:`occ_switch` to be specified.
While this may work pretty fine for small goals, the use of
polymorphic functions and dependent types may lead to an invisible
-duplication of functions arguments. These copies usually end up in
-types hidden by the implicit arguments machinery or by user defined
+duplication of function arguments. These copies usually end up in
+types hidden by the implicit arguments machinery or by user-defined
notations. In these situations computing the right occurrence numbers
is very tedious because they must be counted on the goal as printed
after setting the Printing All flag. Moreover the resulting script is
@@ -3981,7 +3981,7 @@ pattern for the redex looking at the rule used for rewriting.
The first :token:`c_pattern` is the simplest form matching any context but
selecting a specific redex and has been described in the previous
sections. We have seen so far that the possibility of selecting a
-redex using a term with holes is already a powerful mean of redex
+redex using a term with holes is already a powerful means of redex
selection. Similarly, any terms provided by the user in the more
complex forms of :token:`c_patterns`
presented in the tables above can contain
@@ -4064,7 +4064,7 @@ Contextual pattern in set and the : tactical
As already mentioned in section :ref:`abbreviations_ssr` the ``set``
tactic takes as an
argument a term in open syntax. This term is interpreted as the
-simplest for of :token:`c_pattern`. To void confusion in the grammar, open
+simplest form of :token:`c_pattern`. To avoid confusion in the grammar, open
syntax is supported only for the simplest form of patterns, while
parentheses are required around more complex patterns.
@@ -4086,17 +4086,17 @@ parentheses are required around more complex patterns.
set t := (a + _ in X in _ = X).
-Since the user may define an infix notation for ``in`` the former tactic
-may result ambiguous. The disambiguation rule implemented is to prefer
+Since the user may define an infix notation for ``in`` the result of the former
+tactic may be ambiguous. The disambiguation rule implemented is to prefer
patterns over simple terms, but to interpret a pattern with double
-parentheses as a simple term. For example the following tactic would
+parentheses as a simple term. For example, the following tactic would
capture any occurrence of the term ``a in A``.
.. coqtop:: in
set t := ((a in A)).
-Contextual pattern can also be used as arguments of the ``:`` tactical.
+Contextual patterns can also be used as arguments of the ``:`` tactical.
For example:
.. coqtop:: in
@@ -4139,7 +4139,7 @@ Contextual patterns in rewrite
Note that the right hand side of ``addn0`` is undetermined, but the
rewrite pattern specifies the redex explicitly. The right hand side
- of ``addn0`` is unified with the term identified by ``X``, ``0`` here.
+ of ``addn0`` is unified with the term identified by ``X``, here ``0``.
The following pattern does not specify a redex, since it identifies an
@@ -4269,7 +4269,7 @@ generation (see section :ref:`generation_of_equations_ssr`).
.. example::
- The following script illustrate a toy example of this feature. Let us
+ The following script illustrates a toy example of this feature. Let us
define a function adding an element at the end of a list:
.. coqtop:: reset
@@ -4283,7 +4283,7 @@ generation (see section :ref:`generation_of_equations_ssr`).
.. coqtop:: all
Variable d : Type.
- Fixpoint add_last(s : list d) (z : d) {struct s} : list d :=
+ Fixpoint add_last (s : list d) (z : d) {struct s} : list d :=
if s is cons x s' then cons x (add_last s' z) else z :: nil.
One can define an alternative, reversed, induction principle on
@@ -4296,7 +4296,7 @@ generation (see section :ref:`generation_of_equations_ssr`).
forall s : list d, P s.
Then the combination of elimination views with equation names result
- in a concise syntax for reasoning inductively using the user defined
+ in a concise syntax for reasoning inductively using the user-defined
elimination scheme.
.. coqtop:: all
@@ -4305,8 +4305,8 @@ generation (see section :ref:`generation_of_equations_ssr`).
elim/last_ind_list E : l=> [| u v]; last first.
-User provided eliminators (potentially generated with the ``Function``
-|Coq|’s command) can be combined with the type family switches described
+User-provided eliminators (potentially generated with |Coq|’s ``Function``
+command) can be combined with the type family switches described
in section :ref:`type_families_ssr`.
Consider an eliminator ``foo_ind`` of type:
@@ -4341,7 +4341,7 @@ The ``elim/`` tactic distinguishes two cases:
As explained in section :ref:`type_families_ssr`, the initial prefix of
``ei`` can be omitted.
-Here an example of a regular, but non trivial, eliminator.
+Here is an example of a regular, but nontrivial, eliminator.
.. example::
@@ -4423,7 +4423,7 @@ Here an example of a regular, but non trivial, eliminator.
``P`` should be the same as the second argument of ``plus``, in the
second argument of ``P``, but ``y`` and ``z`` do no unify.
-Here an example of a truncated eliminator:
+Here is an example of a truncated eliminator:
.. example::
@@ -4481,7 +4481,7 @@ Interpreting assumptions
~~~~~~~~~~~~~~~~~~~~~~~~
Interpreting an assumption in the context of a proof consists in
-applying it a lemma before generalizing, and/or decomposing this
+applying to it a lemma before generalizing, and/or decomposing this
assumption. For instance, with the extensive use of boolean reflection
(see section :ref:`views_and_reflection_ssr`.4), it is quite frequent
to need to decompose the logical interpretation of (the boolean
@@ -4689,7 +4689,7 @@ the bookkeeping tactical ``=>`` since this would be redundant with the
Boolean reflection
~~~~~~~~~~~~~~~~~~
-In the Calculus of Inductive Construction, there is an obvious
+In the Calculus of Inductive Constructions, there is an obvious
distinction between logical propositions and boolean values. On the
one hand, logical propositions are objects of *sort* ``Prop`` which is
the carrier of intuitionistic reasoning. Logical connectives in
@@ -5002,7 +5002,7 @@ but they also allow complex transformation, involving negations.
Note that views, being part of :token:`i_pattern`, can be used to interpret
assertions too. For example the following script asserts ``a && b`` but
-actually used its propositional interpretation.
+actually uses its propositional interpretation.
.. example::
@@ -5038,7 +5038,7 @@ applied to a goal ``top`` is interpreted in the following way:
Like assumption interpretation view hints, goal interpretation ones
-are user defined lemmas stored (see section :ref:`views_and_reflection_ssr`) in the ``Hint View``
+are user-defined lemmas stored (see section :ref:`views_and_reflection_ssr`) in the ``Hint View``
database bridging the possible gap between the type of ``term`` and the
type of the goal.
@@ -5132,7 +5132,7 @@ See the files ``ssreflect.v`` and ``ssrbool.v`` for examples.
Multiple views
~~~~~~~~~~~~~~
-The hypotheses and the goal can be interpreted applying multiple views
+The hypotheses and the goal can be interpreted by applying multiple views
in sequence. Both move and apply can be followed by an arbitrary
number of ``/term``. The main difference between the following two
tactics
@@ -5189,7 +5189,7 @@ equivalences are indeed taken into account, otherwise only single
.. cmd:: Search {? @pattern } {* {? - } %( @string %| @pattern %) {? % @ident} } {? in {+ {? - } @qualid } }
-where :token:`qualid` is the name of an open module. This command search returns
+where :token:`qualid` is the name of an open module. This command returns
the list of lemmas:
@@ -5214,7 +5214,7 @@ Note that:
+ As for regular terms, patterns can feature scope indications. For
instance, the command: ``Search _ (_ + _)%N.`` lists all the lemmas whose
- statement (conclusion or hypotheses) involve an application of the
+ statement (conclusion or hypotheses) involves an application of the
binary operation denoted by the infix ``+`` symbol in the ``N`` scope (which is
|SSR| scope for natural numbers).
+ Patterns with holes should be surrounded by parentheses.
@@ -5491,7 +5491,7 @@ prenex implicits declaration see :ref:`parametric_polymorphism_ssr`
used for such generated names.
.. [#7] More precisely, it should have a quantified inductive type with a
assumptions and m − a constructors.
-.. [#8] This is an implementation feature: there is not such obstruction
+.. [#8] This is an implementation feature: there is no such obstruction
in the metatheory
.. [#9] The current state of the proof shall be displayed by the Show
Proof command of |Coq| proof mode.
diff --git a/doc/sphinx/proof-engine/tactics.rst b/doc/sphinx/proof-engine/tactics.rst
index da34e3b55b..2af73c28e5 100644
--- a/doc/sphinx/proof-engine/tactics.rst
+++ b/doc/sphinx/proof-engine/tactics.rst
@@ -1635,7 +1635,7 @@ analysis on inductive or co-inductive objects (see :ref:`TODO-4.5`).
.. tacv:: elim @term using @term
.. tacv:: elim @term using @term with @bindings_list
- Allows the user to give explicitly an elimination predicate :n:`@term` that
+ Allows the user to give explicitly an induction principle :n:`@term` that
is not the standard one for the underlying inductive type of :n:`@term`. The
:n:`@bindings_list` clause allows instantiating premises of the type of
:n:`@term`.
diff --git a/doc/sphinx/proof-engine/vernacular-commands.rst b/doc/sphinx/proof-engine/vernacular-commands.rst
new file mode 100644
index 0000000000..0bb6eea233
--- /dev/null
+++ b/doc/sphinx/proof-engine/vernacular-commands.rst
@@ -0,0 +1,1414 @@
+.. include:: ../preamble.rst
+.. include:: ../replaces.rst
+
+.. _vernacularcommands:
+
+Vernacular commands
+=============================
+
+.. _displaying:
+
+Displaying
+--------------
+
+
+.. _Print:
+
+.. cmd:: Print @qualid.
+
+This command displays on the screen information about the declared or
+defined object referred by :n:`@qualid`.
+
+
+Error messages:
+
+
+.. exn:: @qualid not a defined object
+
+.. exn:: Universe instance should have length :n:`num`.
+
+.. exn:: This object does not support universe names.
+
+
+Variants:
+
+
+.. cmdv:: Print Term @qualid.
+
+This is a synonym to ``Print`` :n:`@qualid` when :n:`@qualid`
+denotes a global constant.
+
+.. cmdv:: About @qualid.
+
+This displays various information about the object
+denoted by :n:`@qualid`: its kind (module, constant, assumption, inductive,
+constructor, abbreviation, …), long name, type, implicit arguments and
+argument scopes. It does not print the body of definitions or proofs.
+
+.. cmdv:: Print @qualid\@@name
+
+This locally renames the polymorphic universes of :n:`@qualid`.
+An underscore means the raw universe is printed.
+This form can be used with ``Print Term`` and ``About``.
+
+.. cmd:: Print All.
+
+This command displays information about the current state of the
+environment, including sections and modules.
+
+
+Variants:
+
+
+.. cmdv:: Inspect @num.
+
+This command displays the :n:`@num` last objects of the
+current environment, including sections and modules.
+
+.. cmdv:: Print Section @ident.
+
+The name :n:`@ident` should correspond to a currently open section,
+this command displays the objects defined since the beginning of this
+section.
+
+
+.. _flags-options-tables:
+
+Flags, Options and Tables
+-----------------------------
+
+|Coq| configurability is based on flags (e.g. Set Printing All in
+Section :ref:`TODO-2.9-printing-full`), options (e.g. ``Set Printing Widthinteger`` in Section
+:ref:`TODO-6.9.6-set-printing-width`), or tables (e.g. ``Add Printing Record ident``, in Section
+:ref:`TODO-2.2.4-add-printing-record`). The names of flags, options and tables are made of non-empty sequences of identifiers
+(conventionally with capital initial
+letter). The general commands handling flags, options and tables are
+given below.
+
+.. TODO : flag is not a syntax entry
+
+.. cmd:: Set @flag.
+
+This command switches :n:`@flag` on. The original state of :n:`@flag` is restored
+when the current module ends.
+
+
+Variants:
+
+
+.. cmdv:: Local Set @flag.
+
+This command switches :n:`@flag` on. The original state
+of :n:`@flag` is restored when the current *section* ends.
+
+.. cmdv:: Global Set @flag.
+
+This command switches :n:`@flag` on. The original state
+of :n:`@flag` is *not* restored at the end of the module. Additionally, if
+set in a file, :n:`@flag` is switched on when the file is `Require`-d.
+
+
+
+.. cmd:: Unset @flag.
+
+This command switches :n:`@flag` off. The original state of :n:`@flag` is restored
+when the current module ends.
+
+
+Variants:
+
+.. cmdv:: Local Unset @flag.
+
+This command switches :n:`@flag` off. The original
+state of :n:`@flag` is restored when the current *section* ends.
+
+.. cmdv:: Global Unset @flag.
+
+This command switches :n:`@flag` off. The original
+state of :n:`@flag` is *not* restored at the end of the module. Additionally,
+if set in a file, :n:`@flag` is switched off when the file is `Require`-d.
+
+
+
+.. cmd:: Test @flag.
+
+This command prints whether :n:`@flag` is on or off.
+
+
+.. cmd:: Set @option @value.
+
+This command sets :n:`@option` to :n:`@value`. The original value of ` option` is
+restored when the current module ends.
+
+
+Variants:
+
+.. TODO : option and value are not syntax entries
+
+.. cmdv:: Local Set @option @value.
+
+This command sets :n:`@option` to :n:`@value`. The
+original value of :n:`@option` is restored at the end of the module.
+
+.. cmdv:: Global Set @option @value.
+
+This command sets :n:`@option` to :n:`@value`. The
+original value of :n:`@option` is *not* restored at the end of the module.
+Additionally, if set in a file, :n:`@option` is set to value when the file
+is `Require`-d.
+
+
+
+.. cmd:: Unset @option.
+
+This command resets option to its default value.
+
+
+Variants:
+
+
+.. cmdv:: Local Unset @option.
+
+This command resets :n:`@option` to its default
+value. The original state of :n:`@option` is restored when the current
+*section* ends.
+
+.. cmdv:: Global Unset @option.
+
+This command resets :n:`@option` to its default
+value. The original state of :n:`@option` is *not* restored at the end of the
+module. Additionally, if unset in a file, :n:`@option` is reset to its
+default value when the file is `Require`-d.
+
+
+
+.. cmd:: Test @option.
+
+This command prints the current value of :n:`@option`.
+
+
+.. TODO : table is not a syntax entry
+
+.. cmd:: Add @table @value.
+.. cmd:: Remove @table @value.
+.. cmd:: Test @table @value.
+.. cmd:: Test @table for @value.
+.. cmd:: Print Table @table.
+
+These are general commands for tables.
+
+.. cmd:: Print Options.
+
+This command lists all available flags, options and tables.
+
+
+Variants:
+
+
+.. cmdv:: Print Tables.
+
+This is a synonymous of ``Print Options``.
+
+
+.. _requests-to-the-environment:
+
+Requests to the environment
+-------------------------------
+
+.. cmd:: Check @term.
+
+This command displays the type of :n:`@term`. When called in proof mode, the
+term is checked in the local context of the current subgoal.
+
+
+Variants:
+
+.. TODO : selector is not a syntax entry
+
+.. cmdv:: @selector: Check @term.
+
+specifies on which subgoal to perform typing
+(see Section :ref:`TODO-8.1-invocation-of-tactics`).
+
+.. TODO : convtactic is not a syntax entry
+
+.. cmd:: Eval @convtactic in @term.
+
+This command performs the specified reduction on :n:`@term`, and displays
+the resulting term with its type. The term to be reduced may depend on
+hypothesis introduced in the first subgoal (if a proof is in
+progress).
+
+
+See also: Section :ref:`TODO-8.7-performing-computations`.
+
+
+.. cmd:: Compute @term.
+
+This command performs a call-by-value evaluation of term by using the
+bytecode-based virtual machine. It is a shortcut for ``Eval vm_compute in``
+:n:`@term`.
+
+
+See also: Section :ref:`TODO-8.7-performing-computations`.
+
+
+.. cmd::Extraction @term.
+
+This command displays the extracted term from :n:`@term`. The extraction is
+processed according to the distinction between ``Set`` and ``Prop``; that is
+to say, between logical and computational content (see Section
+:ref:`TODO-4.1.1-sorts`). The extracted term is displayed in OCaml
+syntax,
+where global identifiers are still displayed as in |Coq| terms.
+
+
+Variants:
+
+
+.. cmdv:: Recursive Extraction {+ @qualid }.
+
+Recursively extracts all
+the material needed for the extraction of the qualified identifiers.
+
+
+See also: Chapter ref:`TODO-23-chapter-extraction`.
+
+
+.. cmd:: Print Assumptions @qualid.
+
+This commands display all the assumptions (axioms, parameters and
+variables) a theorem or definition depends on. Especially, it informs
+on the assumptions with respect to which the validity of a theorem
+relies.
+
+
+Variants:
+
+
+.. cmdv:: Print Opaque Dependencies @qualid.
+
+Displays the set of opaque constants :n:`@qualid` relies on in addition to
+the assumptions.
+
+.. cmdv:: Print Transparent Dependencies @qualid.
+
+Displays the set of
+transparent constants :n:`@qualid` relies on in addition to the assumptions.
+
+.. cmdv:: Print All Dependencies @qualid.
+
+Displays all assumptions and constants :n:`@qualid` relies on.
+
+
+
+.. cmd:: Search @qualid.
+
+This command displays the name and type of all objects (hypothesis of
+the current goal, theorems, axioms, etc) of the current context whose
+statement contains :n:`@qualid`. This command is useful to remind the user
+of the name of library lemmas.
+
+
+Error messages:
+
+
+.. exn:: The reference @qualid was not found in the current environment
+
+There is no constant in the environment named qualid.
+
+Variants:
+
+.. cmdv:: Search @string.
+
+If :n:`@string` is a valid identifier, this command
+displays the name and type of all objects (theorems, axioms, etc) of
+the current context whose name contains string. If string is a
+notation’s string denoting some reference :n:`@qualid` (referred to by its
+main symbol as in `"+"` or by its notation’s string as in `"_ + _"` or
+`"_ 'U' _"`, see Section :ref:`TODO-12.1-notations`), the command works like ``Search`` :n:`@qualid`.
+
+.. cmdv:: Search @string%@key.
+
+The string string must be a notation or the main
+symbol of a notation which is then interpreted in the scope bound to
+the delimiting key :n:`@key` (see Section :ref:`TODO-12.2.2-local-interpretation-rules-for-notations`).
+
+.. cmdv:: Search @term_pattern.
+
+This searches for all statements or types of
+definition that contains a subterm that matches the pattern
+`term_pattern` (holes of the pattern are either denoted by `_` or by
+`?ident` when non linear patterns are expected).
+
+.. cmdv:: Search { + [-]@term_pattern_string }.
+
+where
+:n:`@term_pattern_string` is a term_pattern, a string, or a string followed
+by a scope delimiting key `%key`. This generalization of ``Search`` searches
+for all objects whose statement or type contains a subterm matching
+:n:`@term_pattern` (or :n:`@qualid` if :n:`@string` is the notation for a reference
+qualid) and whose name contains all string of the request that
+correspond to valid identifiers. If a term_pattern or a string is
+prefixed by `-`, the search excludes the objects that mention that
+term_pattern or that string.
+
+.. cmdv:: Search @term_pattern_string … @term_pattern_string inside {+ @qualid } .
+
+This restricts the search to constructions defined in the modules named by the given :n:`qualid` sequence.
+
+.. cmdv:: Search @term_pattern_string … @term_pattern_string outside {+ @qualid }.
+
+This restricts the search to constructions not defined in the modules named by the given :n:`qualid` sequence.
+
+.. cmdv:: @selector: Search [-]@term_pattern_string … [-]@term_pattern_string.
+
+This specifies the goal on which to search hypothesis (see
+Section :ref:`TODO-8.1-invocation-of-tactics`).
+By default the 1st goal is searched. This variant can
+be combined with other variants presented here.
+
+
+.. coqtop:: in
+
+ Require Import ZArith.
+
+.. coqtop:: all
+
+ Search Z.mul Z.add "distr".
+
+ Search "+"%Z "*"%Z "distr" -positive -Prop.
+
+ Search (?x * _ + ?x * _)%Z outside OmegaLemmas.
+
+.. note:: Up to |Coq| version 8.4, ``Search`` had the behavior of current
+``SearchHead`` and the behavior of current Search was obtained with
+command ``SearchAbout``. For compatibility, the deprecated name
+SearchAbout can still be used as a synonym of Search. For
+compatibility, the list of objects to search when using ``SearchAbout``
+may also be enclosed by optional[ ] delimiters.
+
+
+.. cmd:: SearchHead @term.
+
+This command displays the name and type of all hypothesis of the
+current goal (if any) and theorems of the current context whose
+statement’s conclusion has the form `(term t1 .. tn)`. This command is
+useful to remind the user of the name of library lemmas.
+
+
+
+.. coqtop:: reset all
+
+ SearchHead le.
+
+ SearchHead (@eq bool).
+
+
+Variants:
+
+.. cmdv:: SearchHead @term inside {+ @qualid }.
+
+This restricts the search to constructions defined in the modules named by the given :n:`qualid` sequence.
+
+.. cmdv:: SearchHead term outside {+ @qualid }.
+
+This restricts the search to constructions not defined in the modules named by the given :n:`qualid` sequence.
+
+Error messages:
+
+.. exn:: Module/section @qualid not found
+
+No module :n:`@qualid` has been required
+(see Section :ref:`TODO-6.5.1-require`).
+
+.. cmdv:: @selector: SearchHead @term.
+
+This specifies the goal on which to
+search hypothesis (see Section :ref:`TODO-8.1-invocation-of-tactics`).
+By default the 1st goal is
+searched. This variant can be combined with other variants presented
+here.
+
+.. note:: Up to |Coq| version 8.4, ``SearchHead`` was named ``Search``.
+
+
+.. cmd:: SearchPattern @term.
+
+This command displays the name and type of all hypothesis of the
+current goal (if any) and theorems of the current context whose
+statement’s conclusion or last hypothesis and conclusion matches the
+expressionterm where holes in the latter are denoted by `_`.
+It is a
+variant of Search @term_pattern that does not look for subterms but
+searches for statements whose conclusion has exactly the expected
+form, or whose statement finishes by the given series of
+hypothesis/conclusion.
+
+.. coqtop:: in
+
+ Require Import Arith.
+
+.. coqtop:: all
+
+ SearchPattern (_ + _ = _ + _).
+
+ SearchPattern (nat -> bool).
+
+ SearchPattern (forall l : list _, _ l l).
+
+Patterns need not be linear: you can express that the same expression
+must occur in two places by using pattern variables `?ident`.
+
+
+.. coqtop:: all
+
+ SearchPattern (?X1 + _ = _ + ?X1).
+
+Variants:
+
+
+.. cmdv:: SearchPattern @term inside {+ @qualid } .
+
+This restricts the search to constructions defined in the modules named by the given :n:`qualid` sequence.
+
+.. cmdv:: SearchPattern @term outside {+ @qualid }.
+
+This restricts the search to constructions not defined in the modules named by the given :n:`qualid` sequence.
+
+.. cmdv:: @selector: SearchPattern @term.
+
+This specifies the goal on which to
+search hypothesis (see Section :ref:`TODO-8.1-invocation-of-tactics`). By default the 1st goal is
+searched. This variant can be combined with other variants presented
+here.
+
+
+
+.. cmdv:: SearchRewrite @term.
+
+This command displays the name and type of all hypothesis of the
+current goal (if any) and theorems of the current context whose
+statement’s conclusion is an equality of which one side matches the
+expression term. Holes in term are denoted by “_”.
+
+.. coqtop:: in
+
+ Require Import Arith.
+
+.. coqtop:: all
+
+ SearchRewrite (_ + _ + _).
+
+Variants:
+
+
+.. cmdv:: SearchRewrite term inside {+ @qualid }.
+
+This restricts the search to constructions defined in the modules named by the given :n:`qualid` sequence.
+
+.. cmdv:: SearchRewrite @term outside {+ @qualid }.
+
+This restricts the search to constructions not defined in the modules named by the given :n:`qualid` sequence.
+
+.. cmdv:: @selector: SearchRewrite @term.
+
+This specifies the goal on which to
+search hypothesis (see Section :ref:`TODO-8.1-invocation-of-tactics`). By default the 1st goal is
+searched. This variant can be combined with other variants presented
+here.
+
+.. note::
+
+ For the ``Search``, ``SearchHead``, ``SearchPattern`` and ``SearchRewrite``
+ queries, it
+ is possible to globally filter the search results via the command
+ ``Add Search Blacklist`` :n:`@substring`. A lemma whose fully-qualified name
+ contains any of the declared substrings will be removed from the
+ search results. The default blacklisted substrings are ``_subproof``
+ ``Private_``. The command ``Remove Search Blacklist ...`` allows expunging
+ this blacklist.
+
+
+.. cmd:: Locate @qualid.
+
+This command displays the full name of objects whose name is a prefix
+of the qualified identifier :n:`@qualid`, and consequently the |Coq| module in
+which they are defined. It searches for objects from the different
+qualified name spaces of |Coq|: terms, modules, Ltac, etc.
+
+.. coqtop:: none
+
+ Set Printing Depth 50.
+
+.. coqtop:: all
+
+ Locate nat.
+
+ Locate Datatypes.O.
+
+ Locate Init.Datatypes.O.
+
+ Locate Coq.Init.Datatypes.O.
+
+ Locate I.Dont.Exist.
+
+Variants:
+
+
+.. cmdv:: Locate Term @qualid.
+
+As Locate but restricted to terms.
+
+.. cmdv:: Locate Module @qualid.
+
+As Locate but restricted to modules.
+
+.. cmdv:: Locate Ltac @qualid.
+
+As Locate but restricted to tactics.
+
+
+See also: Section :ref:`TODO-12.1.10-LocateSymbol`
+
+
+.. _loading-files:
+
+Loading files
+-----------------
+
+|Coq| offers the possibility of loading different parts of a whole
+development stored in separate files. Their contents will be loaded as
+if they were entered from the keyboard. This means that the loaded
+files are ASCII files containing sequences of commands for |Coq|’s
+toplevel. This kind of file is called a *script* for |Coq|. The standard
+(and default) extension of |Coq|’s script files is .v.
+
+
+.. cmd:: Load @ident.
+
+This command loads the file named :n:`ident`.v, searching successively in
+each of the directories specified in the *loadpath*. (see Section
+:ref:`TODO-2.6.3-libraries-and-filesystem`)
+
+Files loaded this way cannot leave proofs open, and the ``Load``
+command cannot be used inside a proof either.
+
+Variants:
+
+
+.. cmdv:: Load @string.
+
+Loads the file denoted by the string :n:`@string`, where
+string is any complete filename. Then the `~` and .. abbreviations are
+allowed as well as shell variables. If no extension is specified, |Coq|
+will use the default extension ``.v``.
+
+.. cmdv:: Load Verbose @ident.
+
+.. cmdv:: Load Verbose @string.
+
+Display, while loading,
+the answers of |Coq| to each command (including tactics) contained in
+the loaded file See also: Section :ref:`TODO-6.9.1-silent`.
+
+Error messages:
+
+.. exn:: Can’t find file @ident on loadpath
+
+.. exn:: Load is not supported inside proofs
+
+.. exn:: Files processed by Load cannot leave open proofs
+
+.. _compiled-files:
+
+Compiled files
+------------------
+
+This section describes the commands used to load compiled files (see
+Chapter :ref:`TODO-14-coq-commands` for documentation on how to compile a file). A compiled
+file is a particular case of module called *library file*.
+
+
+.. cmd:: Require @qualid.
+
+This command looks in the loadpath for a file containing module :n:`@qualid`
+and adds the corresponding module to the environment of |Coq|. As
+library files have dependencies in other library files, the command
+``Require`` :n:`@qualid` recursively requires all library files the module
+qualid depends on and adds the corresponding modules to the
+environment of |Coq| too. |Coq| assumes that the compiled files have been
+produced by a valid |Coq| compiler and their contents are then not
+replayed nor rechecked.
+
+To locate the file in the file system, :n:`@qualid` is decomposed under the
+form `dirpath.ident` and the file `ident.vo` is searched in the physical
+directory of the file system that is mapped in |Coq| loadpath to the
+logical path dirpath (see Section :ref:`TODO-2.6.3-libraries-and-filesystem`). The mapping between
+physical directories and logical names at the time of requiring the
+file must be consistent with the mapping used to compile the file. If
+several files match, one of them is picked in an unspecified fashion.
+
+
+Variants:
+
+.. cmdv:: Require Import @qualid.
+
+This loads and declares the module :n:`@qualid`
+and its dependencies then imports the contents of :n:`@qualid` as described
+in Section :ref:`TODO-2.5.8-import`.It does not import the modules on which
+qualid depends unless these modules were themselves required in module
+:n:`@qualid`
+using ``Require Export``, as described below, or recursively required
+through a sequence of ``Require Export``. If the module required has
+already been loaded, ``Require Import`` :n:`@qualid` simply imports it, as ``Import``
+:n:`@qualid` would.
+
+.. cmdv:: Require Export @qualid.
+
+This command acts as ``Require Import`` :n:`@qualid`,
+but if a further module, say `A`, contains a command ``Require Export`` `B`,
+then the command ``Require Import`` `A` also imports the module `B.`
+
+.. cmdv:: Require [Import | Export] {+ @qualid }.
+
+This loads the
+modules named by the :n:`qualid` sequence and their recursive
+dependencies. If
+``Import`` or ``Export`` is given, it also imports these modules and
+all the recursive dependencies that were marked or transitively marked
+as ``Export``.
+
+.. cmdv:: From @dirpath Require @qualid.
+
+This command acts as ``Require``, but picks
+any library whose absolute name is of the form dirpath.dirpath’.qualid
+for some `dirpath’`. This is useful to ensure that the :n:`@qualid` library
+comes from a given package by making explicit its absolute root.
+
+
+
+Error messages:
+
+.. exn:: Cannot load qualid: no physical path bound to dirpath
+
+.. exn:: Cannot find library foo in loadpath
+
+The command did not find the
+file foo.vo. Either foo.v exists but is not compiled or foo.vo is in a
+directory which is not in your LoadPath (see Section :ref:`TODO-2.6.3-libraries-and-filesystem`).
+
+.. exn:: Compiled library ident.vo makes inconsistent assumptions over library qualid
+
+The command tried to load library file `ident.vo` that
+depends on some specific version of library :n:`@qualid` which is not the
+one already loaded in the current |Coq| session. Probably `ident.v` was
+not properly recompiled with the last version of the file containing
+module :n:`@qualid`.
+
+.. exn:: Bad magic number
+
+The file `ident.vo` was found but either it is not a
+|Coq| compiled module, or it was compiled with an incompatible
+version of |Coq|.
+
+.. exn:: The file `ident.vo` contains library dirpath and not library dirpath’
+
+The library file `dirpath’` is indirectly required by the
+``Require`` command but it is bound in the current loadpath to the
+file `ident.vo` which was bound to a different library name `dirpath` at
+the time it was compiled.
+
+
+.. exn:: Require is not allowed inside a module or a module type
+
+This command
+is not allowed inside a module or a module type being defined. It is
+meant to describe a dependency between compilation units. Note however
+that the commands Import and Export alone can be used inside modules
+(see Section :ref:`TODO-2.5.8-import`).
+
+
+
+See also: Chapter :ref:`TODO-14-coq-commands`
+
+
+.. cmd:: Print Libraries.
+
+This command displays the list of library files loaded in the
+current |Coq| session. For each of these libraries, it also tells if it
+is imported.
+
+
+.. cmd:: Declare ML Module {+ @string } .
+
+This commands loads the OCaml compiled files
+with names given by the :n:`@string` sequence
+(dynamic link). It is mainly used to load tactics dynamically. The
+files are searched into the current OCaml loadpath (see the
+command ``Add ML Path`` in Section :ref:`TODO-2.6.3-libraries-and-filesystem`). Loading of OCaml files is only possible under the bytecode version of ``coqtop`` (i.e.
+``coqtop`` called with option ``-byte``, see chapter :ref:`TODO-14-coq-commands`), or when |Coq| has been compiled with a
+version of OCaml that supports native Dynlink (≥ 3.11).
+
+
+Variants:
+
+
+.. cmdv:: Local Declare ML Module {+ @string }.
+
+This variant is not
+exported to the modules that import the module where they occur, even
+if outside a section.
+
+
+
+Error messages:
+
+.. exn:: File not found on loadpath : @string
+
+.. exn:: Loading of ML object file forbidden in a native |Coq|
+
+
+
+.. cmd:: Print ML Modules.
+
+This prints the name of all OCaml modules loaded with ``Declare
+ML Module``. To know from where these module were loaded, the user
+should use the command Locate File (see Section :ref:`TODO-6.6.10-locate-file`)
+
+
+.. _loadpath:
+
+Loadpath
+------------
+
+Loadpaths are preferably managed using |Coq| command line options (see
+Section `2.6.3-libraries-and-filesystem`) but there remain vernacular commands to manage them
+for practical purposes. Such commands are only meant to be issued in
+the toplevel, and using them in source files is discouraged.
+
+
+.. cmd:: Pwd.
+
+This command displays the current working directory.
+
+
+.. cmd:: Cd @string.
+
+This command changes the current directory according to :n:`@string` which
+can be any valid path.
+
+
+Variants:
+
+
+.. cmdv:: Cd.
+
+Is equivalent to Pwd.
+
+
+
+.. cmd:: Add LoadPath @string as @dirpath.
+
+This command is equivalent to the command line option
+``-Q`` :n:`@string` :n:`@dirpath`. It adds the physical directory string to the current
+|Coq| loadpath and maps it to the logical directory dirpath.
+
+Variants:
+
+
+.. cmdv:: Add LoadPath @string.
+
+Performs as Add LoadPath :n:`@string` as :n:`@dirpath` but
+for the empty directory path.
+
+
+
+.. cmd:: Add Rec LoadPath @string as @dirpath.
+
+This command is equivalent to the command line option
+``-R`` :n:`@string` :n:`@dirpath`. It adds the physical directory string and all its
+subdirectories to the current |Coq| loadpath.
+
+Variants:
+
+
+.. cmdv:: Add Rec LoadPath @string.
+
+Works as ``Add Rec LoadPath`` :n:`@string` as :n:`@dirpath` but for the empty
+logical directory path.
+
+
+
+.. cmd:: Remove LoadPath @string.
+
+This command removes the path :n:`@string` from the current |Coq| loadpath.
+
+
+.. cmd:: Print LoadPath.
+
+This command displays the current |Coq| loadpath.
+
+
+Variants:
+
+
+.. cmdv:: Print LoadPath @dirpath.
+
+Works as ``Print LoadPath`` but displays only
+the paths that extend the :n:`@dirpath` prefix.
+
+
+.. cmd:: Add ML Path @string.
+
+This command adds the path :n:`@string` to the current OCaml
+loadpath (see the command `Declare ML Module`` in Section :ref:`TODO-6.5-compiled-files`).
+
+
+.. cmd:: Add Rec ML Path @string.
+
+This command adds the directory :n:`@string` and all its subdirectories to
+the current OCaml loadpath (see the command ``Declare ML Module``
+in Section :ref:`TODO-6.5-compiled-files`).
+
+
+.. cmd:: Print ML Path @string.
+
+This command displays the current OCaml loadpath. This
+command makes sense only under the bytecode version of ``coqtop``, i.e.
+using option ``-byte``
+(see the command Declare ML Module in Section :ref:`TODO-6.5-compiled-files`).
+
+
+.. cmd:: Locate File @string.
+
+This command displays the location of file string in the current
+loadpath. Typically, string is a .cmo or .vo or .v file.
+
+
+.. cmd:: Locate Library @dirpath.
+
+This command gives the status of the |Coq| module dirpath. It tells if
+the module is loaded and if not searches in the load path for a module
+of logical name :n:`@dirpath`.
+
+
+.. _backtracking:
+
+Backtracking
+----------------
+
+The backtracking commands described in this section can only be used
+interactively, they cannot be part of a vernacular file loaded via
+``Load`` or compiled by ``coqc``.
+
+
+.. cmd:: Reset @ident.
+
+This command removes all the objects in the environment since :n:`@ident`
+was introduced, including :n:`@ident`. :n:`@ident` may be the name of a defined or
+declared object as well as the name of a section. One cannot reset
+over the name of a module or of an object inside a module.
+
+
+Error messages:
+
+.. exn:: @ident: no such entry
+
+Variants:
+
+.. cmd:: Reset Initial.
+
+Goes back to the initial state, just after the start
+of the interactive session.
+
+
+
+.. cmd:: Back.
+
+This commands undoes all the effects of the last vernacular command.
+Commands read from a vernacular file via a ``Load`` are considered as a
+single command. Proof management commands are also handled by this
+command (see Chapter :ref:`TODO-7-proof-handling`). For that, Back may have to undo more than
+one command in order to reach a state where the proof management
+information is available. For instance, when the last command is a
+``Qed``, the management information about the closed proof has been
+discarded. In this case, ``Back`` will then undo all the proof steps up to
+the statement of this proof.
+
+
+Variants:
+
+
+.. cmdv:: Back @num.
+
+Undoes :n:`@num` vernacular commands. As for Back, some extra
+commands may be undone in order to reach an adequate state. For
+instance Back :n:`@num` will not re-enter a closed proof, but rather go just
+before that proof.
+
+
+
+Error messages:
+
+
+.. exn:: Invalid backtrack
+
+The user wants to undo more commands than available in the history.
+
+.. cmd:: BackTo @num.
+
+This command brings back the system to the state labeled :n:`@num`,
+forgetting the effect of all commands executed after this state. The
+state label is an integer which grows after each successful command.
+It is displayed in the prompt when in -emacs mode. Just as ``Back`` (see
+above), the ``BackTo`` command now handles proof states. For that, it may
+have to undo some extra commands and end on a state `num′ ≤ num` if
+necessary.
+
+
+Variants:
+
+
+.. cmdv:: Backtrack @num @num @num.
+
+`Backtrack` is a *deprecated* form of
+`BackTo` which allows explicitly manipulating the proof environment. The
+three numbers represent the following:
+
+ + *first number* : State label to reach, as for BackTo.
+ + *second number* : *Proof state number* to unbury once aborts have been done.
+ |Coq| will compute the number of Undo to perform (see Chapter :ref:`TODO-7-proof-handling`).
+ + *third number* : Number of Abort to perform, i.e. the number of currently
+ opened nested proofs that must be canceled (see Chapter :ref:`TODO-7-proof-handling`).
+
+
+
+
+Error messages:
+
+
+.. exn:: Invalid backtrack
+
+
+The destination state label is unknown.
+
+
+.. _quitting-and-debugging:
+
+Quitting and debugging
+--------------------------
+
+
+.. cmd:: Quit.
+
+This command permits to quit |Coq|.
+
+
+.. cmd:: Drop.
+
+This is used mostly as a debug facility by |Coq|’s implementors and does
+not concern the casual user. This command permits to leave |Coq|
+temporarily and enter the OCaml toplevel. The OCaml
+command:
+
+
+::
+
+ #use "include";;
+
+
+adds the right loadpaths and loads some toplevel printers for all
+abstract types of |Coq|- section_path, identifiers, terms, judgments, ….
+You can also use the file base_include instead, that loads only the
+pretty-printers for section_paths and identifiers. You can return back
+to |Coq| with the command:
+
+
+::
+
+ go();;
+
+
+
+Warnings:
+
+
+#. It only works with the bytecode version of |Coq| (i.e. `coqtop.byte`,
+ see Section `TODO-14.1-interactive-use`).
+#. You must have compiled |Coq| from the source package and set the
+ environment variable COQTOP to the root of your copy of the sources
+ (see Section `14.3.2-customization-by-envionment-variables`).
+
+
+
+.. TODO : command is not a syntax entry
+
+.. cmd:: Time @command.
+
+This command executes the vernacular command :n:`@command` and displays the
+time needed to execute it.
+
+
+.. cmd:: Redirect @string @command.
+
+This command executes the vernacular command :n:`@command`, redirecting its
+output to ":n:`@string`.out".
+
+
+.. cmd:: Timeout @num @command.
+
+This command executes the vernacular command :n:`@command`. If the command
+has not terminated after the time specified by the :n:`@num` (time
+expressed in seconds), then it is interrupted and an error message is
+displayed.
+
+
+.. cmd:: Set Default Timeout @num.
+
+After using this command, all subsequent commands behave as if they
+were passed to a Timeout command. Commands already starting by a
+`Timeout` are unaffected.
+
+
+.. cmd:: Unset Default Timeout.
+
+This command turns off the use of a default timeout.
+
+.. cmd:: Test Default Timeout.
+
+This command displays whether some default timeout has been set or not.
+
+.. cmd:: Fail @command.
+
+For debugging scripts, sometimes it is desirable to know
+whether a command or a tactic fails. If the given :n:`@command`
+fails, the ``Fail`` statement succeeds, without changing the proof
+state, and in interactive mode, the system
+prints a message confirming the failure.
+If the given :n:`@command` succeeds, the statement is an error, and
+it prints a message indicating that the failure did not occur.
+
+Error messages:
+
+.. exn:: The command has not failed!
+
+.. _controlling-display:
+
+Controlling display
+-----------------------
+
+
+.. cmd:: Set Silent.
+
+This command turns off the normal displaying.
+
+
+.. cmd:: Unset Silent.
+
+This command turns the normal display on.
+
+TODO : check that spaces are handled well
+
+.. cmd:: Set Warnings ‘‘(@ident {* , @ident } )’’.
+
+This command configures the display of warnings. It is experimental,
+and expects, between quotes, a comma-separated list of warning names
+or categories. Adding - in front of a warning or category disables it,
+adding + makes it an error. It is possible to use the special
+categories all and default, the latter containing the warnings enabled
+by default. The flags are interpreted from left to right, so in case
+of an overlap, the flags on the right have higher priority, meaning
+that `A,-A` is equivalent to `-A`.
+
+
+.. cmd:: Set Search Output Name Only.
+
+This command restricts the output of search commands to identifier
+names; turning it on causes invocations of ``Search``, ``SearchHead``,
+``SearchPattern``, ``SearchRewrite`` etc. to omit types from their output,
+printing only identifiers.
+
+
+.. cmd:: Unset Search Output Name Only.
+
+This command turns type display in search results back on.
+
+
+.. cmd:: Set Printing Width @integer.
+
+This command sets which left-aligned part of the width of the screen
+is used for display.
+
+
+.. cmd:: Unset Printing Width.
+
+This command resets the width of the screen used for display to its
+default value (which is 78 at the time of writing this documentation).
+
+
+.. cmd:: Test Printing Width.
+
+This command displays the current screen width used for display.
+
+
+.. cmd:: Set Printing Depth @integer.
+
+This command sets the nesting depth of the formatter used for pretty-
+printing. Beyond this depth, display of subterms is replaced by dots.
+
+
+.. cmd:: Unset Printing Depth.
+
+This command resets the nesting depth of the formatter used for
+pretty-printing to its default value (at the time of writing this
+documentation, the default value is 50).
+
+
+.. cmd:: Test Printing Depth.
+
+This command displays the current nesting depth used for display.
+
+
+.. cmd:: Unset Printing Compact Contexts.
+
+This command resets the displaying of goals contexts to non compact
+mode (default at the time of writing this documentation). Non compact
+means that consecutive variables of different types are printed on
+different lines.
+
+
+.. cmd:: Set Printing Compact Contexts.
+
+This command sets the displaying of goals contexts to compact mode.
+The printer tries to reduce the vertical size of goals contexts by
+putting several variables (even if of different types) on the same
+line provided it does not exceed the printing width (See Set Printing
+Width above).
+
+
+.. cmd:: Test Printing Compact Contexts.
+
+This command displays the current state of compaction of goal.
+
+
+.. cmd:: Unset Printing Unfocused.
+
+This command resets the displaying of goals to focused goals only
+(default). Unfocused goals are created by focusing other goals with
+bullets (see :ref:`TODO-7.2.7-bullets`) or curly braces (see `7.2.6-curly-braces`).
+
+
+.. cmd:: Set Printing Unfocused.
+
+This command enables the displaying of unfocused goals. The goals are
+displayed after the focused ones and are distinguished by a separator.
+
+
+.. cmd:: Test Printing Unfocused.
+
+This command displays the current state of unfocused goals display.
+
+
+.. cmd:: Set Printing Dependent Evars Line.
+
+This command enables the printing of the “(dependent evars: …)” line
+when -emacs is passed.
+
+
+.. cmd:: Unset Printing Dependent Evars Line.
+
+This command disables the printing of the “(dependent evars: …)” line
+when -emacs is passed.
+
+
+Controlling the reduction strategies and the conversion algorithm
+----------------------------------------------------------------------
+
+
+|Coq| provides reduction strategies that the tactics can invoke and two
+different algorithms to check the convertibility of types. The first
+conversion algorithm lazily compares applicative terms while the other
+is a brute-force but efficient algorithm that first normalizes the
+terms before comparing them. The second algorithm is based on a
+bytecode representation of terms similar to the bytecode
+representation used in the ZINC virtual machine [`98`]. It is
+especially useful for intensive computation of algebraic values, such
+as numbers, and for reflection-based tactics. The commands to fine-
+tune the reduction strategies and the lazy conversion algorithm are
+described first.
+
+.. cmd:: Opaque {+ @qualid }.
+
+This command has an effect on unfoldable constants, i.e. on constants
+defined by ``Definition`` or ``Let`` (with an explicit body), or by a command
+assimilated to a definition such as ``Fixpoint``, ``Program Definition``, etc,
+or by a proof ended by ``Defined``. The command tells not to unfold the
+constants in the :n:`@qualid` sequence in tactics using δ-conversion (unfolding
+a constant is replacing it by its definition).
+
+``Opaque`` has also an effect on the conversion algorithm of |Coq|, telling
+it to delay the unfolding of a constant as much as possible when |Coq|
+has to check the conversion (see Section :ref:`TODO-4.3-conversion-rules`) of two distinct
+applied constants.
+
+The scope of ``Opaque`` is limited to the current section, or current
+file, unless the variant ``Global Opaque`` is used.
+
+
+See also: sections :ref:`TODO-8.7-performing-computations`, :ref:`TODO-8.16-automatizing`, :ref:`TODO-7.1-switching-on-off-proof-editing-mode`
+
+
+Error messages:
+
+
+.. exn:: The reference @qualid was not found in the current environment
+
+There is no constant referred by :n:`@qualid` in the environment.
+Nevertheless, if you asked ``Opaque`` `foo` `bar` and if `bar` does not exist, `foo` is set opaque.
+
+.. cmd:: Transparent {+ @qualid }.
+
+This command is the converse of `Opaque`` and it applies on unfoldable
+constants to restore their unfoldability after an Opaque command.
+
+Note in particular that constants defined by a proof ended by Qed are
+not unfoldable and Transparent has no effect on them. This is to keep
+with the usual mathematical practice of *proof irrelevance*: what
+matters in a mathematical development is the sequence of lemma
+statements, not their actual proofs. This distinguishes lemmas from
+the usual defined constants, whose actual values are of course
+relevant in general.
+
+The scope of Transparent is limited to the current section, or current
+file, unless the variant ``Global Transparent`` is
+used.
+
+
+Error messages:
+
+
+.. exn:: The reference @qualid was not found in the current environment
+
+There is no constant referred by :n:`@qualid` in the environment.
+
+
+
+See also: sections :ref:`TODO-8.7-performing-computations`, :ref:`TODO-8.16-automatizing`, :ref:`TODO-7.1-switching-on-off-proof-editing-mode`
+
+
+.. cmd:: Strategy @level [ {+ @qualid } ].
+
+This command generalizes the behavior of Opaque and Transparent
+commands. It is used to fine-tune the strategy for unfolding
+constants, both at the tactic level and at the kernel level. This
+command associates a level to the qualified names in the :n:`@qualid`
+sequence. Whenever two
+expressions with two distinct head constants are compared (for
+instance, this comparison can be triggered by a type cast), the one
+with lower level is expanded first. In case of a tie, the second one
+(appearing in the cast type) is expanded.
+
+Levels can be one of the following (higher to lower):
+
+ + ``opaque`` : level of opaque constants. They cannot be expanded by
+ tactics (behaves like +∞, see next item).
+ + :n:`@num` : levels indexed by an integer. Level 0 corresponds to the
+ default behavior, which corresponds to transparent constants. This
+ level can also be referred to as transparent. Negative levels
+ correspond to constants to be expanded before normal transparent
+ constants, while positive levels correspond to constants to be
+ expanded after normal transparent constants.
+ + ``expand`` : level of constants that should be expanded first (behaves
+ like −∞)
+
+
+These directives survive section and module closure, unless the
+command is prefixed by Local. In the latter case, the behavior
+regarding sections and modules is the same as for the ``Transparent`` and
+``Opaque`` commands.
+
+
+.. cmd:: Print Strategy @qualid.
+
+This command prints the strategy currently associated to :n:`@qualid`. It
+fails if :n:`@qualid` is not an unfoldable reference, that is, neither a
+variable nor a constant.
+
+
+Error messages:
+
+
+.. exn:: The reference is not unfoldable.
+
+
+
+Variants:
+
+
+.. cmdv:: Print Strategies.
+
+Print all the currently non-transparent strategies.
+
+
+
+.. cmd:: Declare Reduction @ident := @convtactic.
+
+This command allows giving a short name to a reduction expression, for
+instance lazy beta delta [foo bar]. This short name can then be used
+in ``Eval`` :n:`@ident` ``in`` ... or ``eval`` directives. This command
+accepts the
+Local modifier, for discarding this reduction name at the end of the
+file or module. For the moment the name cannot be qualified. In
+particular declaring the same name in several modules or in several
+functor applications will be refused if these declarations are not
+local. The name :n:`@ident` cannot be used directly as an Ltac tactic, but
+nothing prevents the user to also perform a
+``Ltac`` `ident` ``:=`` `convtactic`.
+
+
+See also: sections :ref:`TODO-8.7-performing-computations`
+
+
+.. _controlling-locality-of-commands:
+
+Controlling the locality of commands
+-----------------------------------------
+
+
+.. cmd:: Local @command.
+.. cmd:: Global @command.
+
+Some commands support a Local or Global prefix modifier to control the
+scope of their effect. There are four kinds of commands:
+
+
++ Commands whose default is to extend their effect both outside the
+ section and the module or library file they occur in. For these
+ commands, the Local modifier limits the effect of the command to the
+ current section or module it occurs in. As an example, the ``Coercion``
+ (see Section :ref:`TODO-2.8-coercions`) and ``Strategy`` (see Section :ref:`TODO-6.10.3-strategy`) commands belong
+ to this category.
++ Commands whose default behavior is to stop their effect at the end
+ of the section they occur in but to extent their effect outside the
+ module or library file they occur in. For these commands, the Local
+ modifier limits the effect of the command to the current module if the
+ command does not occur in a section and the Global modifier extends
+ the effect outside the current sections and current module if the
+ command occurs in a section. As an example, the ``Implicit Arguments`` (see
+ Section :ref:`TODO-2.7-implicit-arguments`), Ltac (see Chapter :ref:`TODO-9-tactic-language`) or ``Notation`` (see Section
+ :ref:`TODO-12.1-notations`) commands belong to this category. Notice that a subclass of
+ these commands do not support extension of their scope outside
+ sections at all and the Global is not applicable to them.
++ Commands whose default behavior is to stop their effect at the end
+ of the section or module they occur in. For these commands, the Global
+ modifier extends their effect outside the sections and modules they
+ occurs in. The ``Transparent`` and ``Opaque`` (see Section :ref:`TODO-6.10-opaque`) commands belong to this category.
++ Commands whose default behavior is to extend their effect outside
+ sections but not outside modules when they occur in a section and to
+ extend their effect outside the module or library file they occur in
+ when no section contains them.For these commands, the Local modifier
+ limits the effect to the current section or module while the Global
+ modifier extends the effect outside the module even when the command
+ occurs in a section. The ``Set`` and ``Unset`` commands belong to this
+ category.
diff --git a/doc/sphinx/user-extensions/syntax-extensions.rst b/doc/sphinx/user-extensions/syntax-extensions.rst
index 6e6d664475..531295b63a 100644
--- a/doc/sphinx/user-extensions/syntax-extensions.rst
+++ b/doc/sphinx/user-extensions/syntax-extensions.rst
@@ -10,12 +10,12 @@ parses and prints objects, i.e. the translations between the concrete
and internal representations of terms and commands.
The main commands to provide custom symbolic notations for terms are
-``Notation`` and ``Infix``. They are described in section 12.1. There is also a
+``Notation`` and ``Infix``. They are described in section :ref:`Notations`. There is also a
variant of ``Notation`` which does not modify the parser. This provides with a
form of abbreviation and it is described in Section :ref:`Abbreviations`. It is
sometimes expected that the same symbolic notation has different meanings in
different contexts. To achieve this form of overloading, |Coq| offers a notion
-of interpretation scope. This is described in Section :ref:`scopes`.
+of interpretation scope. This is described in Section :ref:`Scopes`.
The main command to provide custom notations for tactics is ``Tactic Notation``.
It is described in Section :ref:`TacticNotation`.
@@ -24,6 +24,8 @@ It is described in Section :ref:`TacticNotation`.
Set Printing Depth 50.
+.. _Notations:
+
Notations
---------
@@ -68,7 +70,7 @@ have to be given.
.. note::
The right-hand side of a notation is interpreted at the time the notation is
- given. In particular, disambiguiation of constants, implicit arguments (see
+ given. In particular, disambiguation of constants, implicit arguments (see
Section :ref:`ImplicitArguments`), coercions (see Section :ref:`Coercions`),
etc. are resolved at the time of the declaration of the notation.
@@ -689,8 +691,7 @@ side. E.g.:
Summary
~~~~~~~
-Syntax of notations
-~~~~~~~~~~~~~~~~~~~
+**Syntax of notations**
The different syntactic variants of the command Notation are given on the
following figure. The optional :token:`scope` is described in the Section 12.2.
@@ -743,8 +744,7 @@ following figure. The optional :token:`scope` is described in the Section 12.2.
given to some notation, say ``"{ y } & { z }"`` in fact applies to the
underlying ``"{ x }"``\-free rule which is ``"y & z"``).
-Persistence of notations
-~~~~~~~~~~~~~~~~~~~~~~~~
+**Persistence of notations**
Notations do not survive the end of sections.
@@ -753,6 +753,8 @@ Notations do not survive the end of sections.
Notations survive modules unless the command ``Local Notation`` is used instead
of ``Notation``.
+.. _Scopes:
+
Interpretation scopes
----------------------
@@ -1125,6 +1127,8 @@ Displaying informations about scopes
class of all the existing interpretation scopes. It also displays the
lonely notations.
+.. _Abbreviations:
+
Abbreviations
--------------
@@ -1187,6 +1191,8 @@ Abbreviations
denoted expression is performed at definition time. Type-checking is
done only at the time of use of the abbreviation.
+.. _TacticNotation:
+
Tactic Notations
-----------------