aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/README.md2
-rw-r--r--doc/changelog/02-specification-language/11098-master+arguments-supports-anonymous-implicit.rst4
-rw-r--r--doc/changelog/02-specification-language/11235-non_maximal_implicit.rst2
-rw-r--r--doc/changelog/02-specification-language/11368-trailing_implicit_error.rst2
-rw-r--r--doc/changelog/03-notations/11848-nicer-decimal-printing.rst5
-rw-r--r--doc/changelog/03-notations/11859-warn-inexact-float.rst6
-rw-r--r--doc/changelog/04-tactics/11018-lia-in-auto-with-zarith.rst7
-rw-r--r--doc/changelog/04-tactics/11362-micromega-fix-11191.rst5
-rw-r--r--doc/changelog/04-tactics/11760-firstorder-leaf.rst9
-rw-r--r--doc/changelog/04-tactics/11877-master+deprecated-_eqn.rst5
-rw-r--r--doc/changelog/07-commands-and-options/11162-local-cs.rst2
-rw-r--r--doc/changelog/07-commands-and-options/11546-rm-uncheck-template.rst5
-rw-r--r--doc/changelog/07-commands-and-options/11663-remove-polymorphic-unqualified.rst5
-rw-r--r--doc/changelog/07-commands-and-options/11665-cumulative-attr.rst12
-rw-r--r--doc/changelog/07-commands-and-options/11944-rm-searchabout-cmd.rst3
-rw-r--r--doc/changelog/08-tools/11851-coqc-flags-fix.rst6
-rw-r--r--doc/changelog/10-standard-library/11725-cleanup-reals.rst6
-rw-r--r--doc/changelog/10-standard-library/1185-sort.rst5
-rw-r--r--doc/changelog/10-standard-library/11891-fix-order-notations.rst10
-rw-r--r--doc/changelog/11-infrastructure-and-dependencies/11131-ci+back_to_ocaml_410.rst7
-rw-r--r--doc/dune48
-rw-r--r--doc/plugin_tutorial/tuto1/src/simple_declare.ml12
-rw-r--r--doc/sphinx/addendum/extraction.rst4
-rw-r--r--doc/sphinx/addendum/miscellaneous-extensions.rst7
-rw-r--r--doc/sphinx/addendum/program.rst29
-rw-r--r--doc/sphinx/addendum/ring.rst4
-rw-r--r--doc/sphinx/addendum/type-classes.rst50
-rw-r--r--doc/sphinx/addendum/universe-polymorphism.rst136
-rw-r--r--doc/sphinx/appendix/history-and-changes/index.rst21
-rw-r--r--doc/sphinx/appendix/indexes/index.rst24
-rw-r--r--doc/sphinx/changes.rst22
-rwxr-xr-xdoc/sphinx/conf.py6
-rw-r--r--doc/sphinx/genindex.rst6
-rw-r--r--doc/sphinx/history.rst2
-rw-r--r--doc/sphinx/index.html.rst79
-rw-r--r--doc/sphinx/index.latex.rst78
-rw-r--r--doc/sphinx/introduction.rst175
-rw-r--r--doc/sphinx/language/cic.rst69
-rw-r--r--doc/sphinx/language/coq-library.rst5
-rw-r--r--doc/sphinx/language/core/index.rst37
-rw-r--r--doc/sphinx/language/extensions/index.rst26
-rw-r--r--doc/sphinx/language/gallina-extensions.rst1132
-rw-r--r--doc/sphinx/language/gallina-specification-language.rst239
-rw-r--r--doc/sphinx/license.rst12
-rw-r--r--doc/sphinx/practical-tools/coq-commands.rst5
-rw-r--r--doc/sphinx/practical-tools/utilities.rst498
-rw-r--r--doc/sphinx/proof-engine/tactics.rst4
-rw-r--r--doc/sphinx/proof-engine/vernacular-commands.rst157
-rw-r--r--doc/sphinx/proofs/automatic-tactics/index.rst20
-rw-r--r--doc/sphinx/proofs/creating-tactics/index.rst34
-rw-r--r--doc/sphinx/proofs/writing-proofs/index.rst34
-rw-r--r--doc/sphinx/refman-preamble.rst62
-rw-r--r--doc/sphinx/refman-preamble.sty20
-rw-r--r--doc/sphinx/using/libraries/index.rst24
-rw-r--r--doc/sphinx/using/tools/coqdoc.rst463
-rw-r--r--doc/sphinx/using/tools/index.rst21
-rw-r--r--doc/stdlib/dune14
-rw-r--r--doc/stdlib/hidden-files1
-rw-r--r--doc/stdlib/index-list.html.template16
-rwxr-xr-xdoc/stdlib/make-library-index3
-rw-r--r--doc/tools/coqrst/coqdomain.py12
-rw-r--r--doc/tools/docgram/README.md114
-rw-r--r--doc/tools/docgram/common.edit_mlg699
-rw-r--r--doc/tools/docgram/doc_grammar.ml215
-rw-r--r--doc/tools/docgram/dune63
-rw-r--r--doc/tools/docgram/fullGrammar64
-rw-r--r--doc/tools/docgram/orderedGrammar1004
-rw-r--r--doc/tools/docgram/prodn.edit_mlg24
-rw-r--r--doc/tools/docgram/productionlist.edit_mlg14
69 files changed, 3229 insertions, 2687 deletions
diff --git a/doc/README.md b/doc/README.md
index 7fa6f5cf3d..e749bcf5d1 100644
--- a/doc/README.md
+++ b/doc/README.md
@@ -30,7 +30,7 @@ To produce the complete documentation in HTML, you will need Coq dependencies
listed in [`INSTALL.md`](../INSTALL.md). Additionally, the Sphinx-based
reference manual requires Python 3, and the following Python packages:
- - sphinx >= 1.7.8
+ - sphinx >= 1.8.0
- sphinx_rtd_theme >= 0.2.5b2
- beautifulsoup4 >= 4.0.6
- antlr4-python3-runtime >= 4.7.1
diff --git a/doc/changelog/02-specification-language/11098-master+arguments-supports-anonymous-implicit.rst b/doc/changelog/02-specification-language/11098-master+arguments-supports-anonymous-implicit.rst
index 633bb6731e..70c57c718f 100644
--- a/doc/changelog/02-specification-language/11098-master+arguments-supports-anonymous-implicit.rst
+++ b/doc/changelog/02-specification-language/11098-master+arguments-supports-anonymous-implicit.rst
@@ -1,6 +1,6 @@
- **Added:**
- :cmd:`Arguments <Arguments (implicits)>` now supports setting
- implicit an anonymous argument, as e.g. in :g:`Arguments id {A} {_}`
+ :cmd:`Arguments` now supports setting
+ implicit an anonymous argument, as e.g. in :g:`Arguments id {A} {_}`.
(`#11098 <https://github.com/coq/coq/pull/11098>`_,
by Hugo Herbelin, fixes `#4696
<https://github.com/coq/coq/pull/4696>`_, `#5173
diff --git a/doc/changelog/02-specification-language/11235-non_maximal_implicit.rst b/doc/changelog/02-specification-language/11235-non_maximal_implicit.rst
index d8ff1fec31..67e43973ce 100644
--- a/doc/changelog/02-specification-language/11235-non_maximal_implicit.rst
+++ b/doc/changelog/02-specification-language/11235-non_maximal_implicit.rst
@@ -1,6 +1,6 @@
- **Added:**
Syntax for non maximal implicit arguments in definitions and terms using
square brackets. The syntax is ``[x : A]``, ``[x]``, ```[A]``
- to be consistent with the command :cmd:`Arguments (implicits)`.
+ to be consistent with the command :cmd:`Arguments`.
(`#11235 <https://github.com/coq/coq/pull/11235>`_,
by SimonBoulier).
diff --git a/doc/changelog/02-specification-language/11368-trailing_implicit_error.rst b/doc/changelog/02-specification-language/11368-trailing_implicit_error.rst
index b0e658998b..11d7218ed0 100644
--- a/doc/changelog/02-specification-language/11368-trailing_implicit_error.rst
+++ b/doc/changelog/02-specification-language/11368-trailing_implicit_error.rst
@@ -1,6 +1,6 @@
- **Changed:**
The warning raised when a trailing implicit is declared to be non maximally
- inserted (with the command :cmd:`Arguments <Arguments (implicits)>`) has been turned into an error.
+ inserted (with the command :cmd:`Arguments`) has been turned into an error.
This was deprecated since Coq 8.10
(`#11368 <https://github.com/coq/coq/pull/11368>`_,
by SimonBoulier).
diff --git a/doc/changelog/03-notations/11848-nicer-decimal-printing.rst b/doc/changelog/03-notations/11848-nicer-decimal-printing.rst
new file mode 100644
index 0000000000..1d3a390f36
--- /dev/null
+++ b/doc/changelog/03-notations/11848-nicer-decimal-printing.rst
@@ -0,0 +1,5 @@
+- **Changed:**
+ Nicer printing for decimal constants in R and Q.
+ 1.5 is now printed 1.5 rather than 15e-1.
+ (`#11848 <https://github.com/coq/coq/pull/11848>`_,
+ by Pierre Roux).
diff --git a/doc/changelog/03-notations/11859-warn-inexact-float.rst b/doc/changelog/03-notations/11859-warn-inexact-float.rst
new file mode 100644
index 0000000000..224ffdbe9b
--- /dev/null
+++ b/doc/changelog/03-notations/11859-warn-inexact-float.rst
@@ -0,0 +1,6 @@
+- **Added:**
+ In primitive floats, print a warning when parsing a decimal value
+ that is not exactly a binary64 floating-point number.
+ For instance, parsing 0.1 will print a warning whereas parsing 0.5 won't.
+ (`#11859 <https://github.com/coq/coq/pull/11859>`_,
+ by Pierre Roux).
diff --git a/doc/changelog/04-tactics/11018-lia-in-auto-with-zarith.rst b/doc/changelog/04-tactics/11018-lia-in-auto-with-zarith.rst
new file mode 100644
index 0000000000..d510416990
--- /dev/null
+++ b/doc/changelog/04-tactics/11018-lia-in-auto-with-zarith.rst
@@ -0,0 +1,7 @@
+- **Changed:** The :g:`auto with zarith` tactic and variations (including :tacn:`intuition`)
+ may now call the :tacn:`lia` tactic instead of :tacn:`omega`
+ (when the `Omega` module is loaded);
+ more goals may be automatically solved,
+ fewer section variables will be captured spuriously
+ (`#11018 <https://github.com/coq/coq/pull/11018>`_,
+ by Vincent Laporte).
diff --git a/doc/changelog/04-tactics/11362-micromega-fix-11191.rst b/doc/changelog/04-tactics/11362-micromega-fix-11191.rst
index 79879c78d5..20d48929f2 100644
--- a/doc/changelog/04-tactics/11362-micromega-fix-11191.rst
+++ b/doc/changelog/04-tactics/11362-micromega-fix-11191.rst
@@ -1,5 +1,8 @@
- **Fixed:**
- Regression of :tacn:`lia` due to more powerful :tacn:`zify`
+ :tacn:`zify` now handles :g:`Z.pow_pos` by default.
+ In Coq 8.11, this was the case only when loading module
+ :g:`ZifyPow` because this triggered a regression of :tacn:`lia`.
+ The regression is now fixed, and the module kept only for compatibility
(`#11362 <https://github.com/coq/coq/pull/11362>`_,
fixes `#11191 <https://github.com/coq/coq/issues/11191>`_,
by Frédéric Besson).
diff --git a/doc/changelog/04-tactics/11760-firstorder-leaf.rst b/doc/changelog/04-tactics/11760-firstorder-leaf.rst
new file mode 100644
index 0000000000..e6e4b827e5
--- /dev/null
+++ b/doc/changelog/04-tactics/11760-firstorder-leaf.rst
@@ -0,0 +1,9 @@
+- **Changed:**
+ The default tactic used by :g:`firstorder` is
+ :g:`auto with core` instead of :g:`auto with *`;
+ see :ref:`decisionprocedures` for details;
+ old behavior can be reset by using the `-compat 8.12` command-line flag;
+ to ease the migration of legacy code, the default solver can be set to `debug auto with *`
+ with `Set Firstorder Solver debug auto with *`
+ (`#11760 <https://github.com/coq/coq/pull/11760>`_,
+ by Vincent Laporte).
diff --git a/doc/changelog/04-tactics/11877-master+deprecated-_eqn.rst b/doc/changelog/04-tactics/11877-master+deprecated-_eqn.rst
new file mode 100644
index 0000000000..827d484b28
--- /dev/null
+++ b/doc/changelog/04-tactics/11877-master+deprecated-_eqn.rst
@@ -0,0 +1,5 @@
+- **Removed:**
+ Deprecated syntax `_eqn` for :tacn:`destruct` and :tacn:`remember`.
+ Use `eqn:` syntax instead
+ (`#11877 <https://github.com/coq/coq/pull/11877>`_,
+ by Hugo Herbelin).
diff --git a/doc/changelog/07-commands-and-options/11162-local-cs.rst b/doc/changelog/07-commands-and-options/11162-local-cs.rst
index 638222fbe1..b89e047153 100644
--- a/doc/changelog/07-commands-and-options/11162-local-cs.rst
+++ b/doc/changelog/07-commands-and-options/11162-local-cs.rst
@@ -1,3 +1,3 @@
-- **Added:** Handle the ``#[local]`` attribute in :g:`Canonical
+- **Added:** Handle the :attr:`local` attribute in :cmd:`Canonical
Structure` declarations (`#11162
<https://github.com/coq/coq/pull/11162>`_, by Enrico Tassi).
diff --git a/doc/changelog/07-commands-and-options/11546-rm-uncheck-template.rst b/doc/changelog/07-commands-and-options/11546-rm-uncheck-template.rst
new file mode 100644
index 0000000000..d134aeae8b
--- /dev/null
+++ b/doc/changelog/07-commands-and-options/11546-rm-uncheck-template.rst
@@ -0,0 +1,5 @@
+- **Removed:** Deprecated unsound compatibility ``Template Check``
+ flag that was introduced in 8.10 to help users gradually move their
+ template polymorphic inductive type definitions outside sections
+ (`#11546 <https://github.com/coq/coq/pull/11546>`_, by Pierre-Marie
+ Pédrot).
diff --git a/doc/changelog/07-commands-and-options/11663-remove-polymorphic-unqualified.rst b/doc/changelog/07-commands-and-options/11663-remove-polymorphic-unqualified.rst
index 1f8dcd3992..419d683037 100644
--- a/doc/changelog/07-commands-and-options/11663-remove-polymorphic-unqualified.rst
+++ b/doc/changelog/07-commands-and-options/11663-remove-polymorphic-unqualified.rst
@@ -1,5 +1,6 @@
- **Removed:**
Unqualified ``polymorphic``, ``monomorphic``, ``template``,
``notemplate`` attributes (they were deprecated since Coq 8.10).
- Use them as sub-attributes of the ``universes`` attribute (`#11663
- <https://github.com/coq/coq/pull/11663>`_, by Théo Zimmermann).
+ Use :attr:`universes(polymorphic)`, :attr:`universes(monomorphic)`,
+ :attr:`universes(template)` and :attr:`universes(notemplate)` instead
+ (`#11663 <https://github.com/coq/coq/pull/11663>`_, by Théo Zimmermann).
diff --git a/doc/changelog/07-commands-and-options/11665-cumulative-attr.rst b/doc/changelog/07-commands-and-options/11665-cumulative-attr.rst
new file mode 100644
index 0000000000..b6a034941d
--- /dev/null
+++ b/doc/changelog/07-commands-and-options/11665-cumulative-attr.rst
@@ -0,0 +1,12 @@
+- **Added:**
+ New attributes supported when defining an inductive type
+ :attr:`universes(cumulative)`, :attr:`universes(noncumulative)` and
+ :attr:`private(matching)`, which correspond to legacy attributes
+ ``Cumulative``, ``NonCumulative``, and the so far undocumented
+ ``Private`` (`#11665 <https://github.com/coq/coq/pull/11665>`_, by
+ Théo Zimmermann).
+
+- **Changed:**
+ Legacy attributes can now be passed in any order. See
+ :ref:`gallina-attributes` (`#11665
+ <https://github.com/coq/coq/pull/11665>`_, by Théo Zimmermann).
diff --git a/doc/changelog/07-commands-and-options/11944-rm-searchabout-cmd.rst b/doc/changelog/07-commands-and-options/11944-rm-searchabout-cmd.rst
new file mode 100644
index 0000000000..e409c638bb
--- /dev/null
+++ b/doc/changelog/07-commands-and-options/11944-rm-searchabout-cmd.rst
@@ -0,0 +1,3 @@
+- **Removed:** Removed SearchAbout command that was deprecated in 8.5.
+ Use :cmd:`Search` instead.
+ (`#11944 <https://github.com/coq/coq/pull/11944>`_, by Jim Fehrle).
diff --git a/doc/changelog/08-tools/11851-coqc-flags-fix.rst b/doc/changelog/08-tools/11851-coqc-flags-fix.rst
new file mode 100644
index 0000000000..a07e48d2d8
--- /dev/null
+++ b/doc/changelog/08-tools/11851-coqc-flags-fix.rst
@@ -0,0 +1,6 @@
+- **Changed:**
+ The order in which the require/load flags `-l`, `-ri`, `-re`, `-rfrom`, etc.
+ and the option set flags `-set`, `-unset` are processed have been reversed.
+ In the new behavior, require/load flags are processed before option flags.
+ (`#11851 <https://github.com/coq/coq/pull/11851>`_,
+ by Lasse Blaauwbroek).
diff --git a/doc/changelog/10-standard-library/11725-cleanup-reals.rst b/doc/changelog/10-standard-library/11725-cleanup-reals.rst
new file mode 100644
index 0000000000..02ee7e6c70
--- /dev/null
+++ b/doc/changelog/10-standard-library/11725-cleanup-reals.rst
@@ -0,0 +1,6 @@
+- **Changed:**
+ Use implicit arguments for ``ConstructiveReals``. Move ``ConstructiveReals``
+ into new directory ``Abstract``. Remove imports of implementations inside
+ those ``Abstract`` files. Move implementation by means of Cauchy sequences in new directory ``Cauchy``.
+ (`#11725 <https://github.com/coq/coq/pull/11725>`_,
+ by Vincent Semeria).
diff --git a/doc/changelog/10-standard-library/1185-sort.rst b/doc/changelog/10-standard-library/1185-sort.rst
new file mode 100644
index 0000000000..edb5ee3ac4
--- /dev/null
+++ b/doc/changelog/10-standard-library/1185-sort.rst
@@ -0,0 +1,5 @@
+- **Changed:**
+ The names of ``Sorted_sort`` and ``LocallySorted_sort`` in ``Coq.Sorting.MergeSort``
+ have been swapped to appropriately reflect their meanings
+ (`#1185 <https://github.com/coq/coq/pull/1185>`_,
+ by Lysxia).
diff --git a/doc/changelog/10-standard-library/11891-fix-order-notations.rst b/doc/changelog/10-standard-library/11891-fix-order-notations.rst
new file mode 100644
index 0000000000..d58d26244a
--- /dev/null
+++ b/doc/changelog/10-standard-library/11891-fix-order-notations.rst
@@ -0,0 +1,10 @@
+- **Changed:**
+ Notations :g:`<=?` and :g:`<?` from ``Coq.Structures.Orders`` and
+ ``Coq.Sorting.Mergesort.NatOrder`` are now at level 70 rather than
+ 35, so as to be compatible with the notations defined everywhere
+ else in the standard library. This may require re-parenthesizing
+ some expressions. These notations were breaking the ability to
+ import modules from the standard library that were otherwise
+ compatible (fixes `#11890
+ <https://github.com/coq/coq/issues/11890>`_, `#11891
+ <https://github.com/coq/coq/pull/11891>`_, by Jason Gross).
diff --git a/doc/changelog/11-infrastructure-and-dependencies/11131-ci+back_to_ocaml_410.rst b/doc/changelog/11-infrastructure-and-dependencies/11131-ci+back_to_ocaml_410.rst
new file mode 100644
index 0000000000..778d37e07b
--- /dev/null
+++ b/doc/changelog/11-infrastructure-and-dependencies/11131-ci+back_to_ocaml_410.rst
@@ -0,0 +1,7 @@
+- **Added:**
+ Bump official OCaml support and CI testing to 4.10.0
+ (`#11131 <https://github.com/coq/coq/pull/11131>`_,
+ `#11123 <https://github.com/coq/coq/pull/11123>`_,
+ `#11102 <https://github.com/coq/coq/pull/11123>`_,
+ by Emilio Jesus Gallego Arias, Jacques-Henri Jourdan,
+ Guillaume Melquiond, and Guillaume Munch-Maccagnoni).
diff --git a/doc/dune b/doc/dune
index 02ca33b682..4210c0a482 100644
--- a/doc/dune
+++ b/doc/dune
@@ -1,5 +1,10 @@
(rule
- (targets sphinx_build)
+ (targets unreleased.rst)
+ (deps (source_tree changelog))
+ (action (with-stdout-to %{targets} (bash "cat changelog/00-title.rst changelog/*/*.rst"))))
+
+(alias
+ (name refman-deps)
(deps
; We could use finer dependencies here so the build is faster:
;
@@ -10,23 +15,34 @@
; + tools/coqdoc/coqdoc.css
(package coq)
(source_tree sphinx)
- (source_tree tools)
+ (source_tree tools/coqrst)
unreleased.rst
- (env_var SPHINXWARNOPT))
- (action
- (run env COQLIB=%{project_root} sphinx-build %{env:SPHINXWARNOPT=-W} -b html -d sphinx_build/doctrees sphinx sphinx_build/html)))
+ (env_var SPHINXWARNOPT)))
-(alias
- (name refman-html)
- (deps sphinx_build))
+(rule
+ (targets refman-html)
+ (alias refman-html)
+ (package coq-doc)
+ (deps (alias refman-deps))
+ (action
+ (run env COQLIB=%{project_root} sphinx-build %{env:SPHINXWARNOPT=-W} -b html sphinx %{targets})))
(rule
- (targets unreleased.rst)
- (deps (source_tree changelog))
- (action (with-stdout-to %{targets} (bash "cat changelog/00-title.rst changelog/*/*.rst"))))
+ (targets refman-pdf)
+ (alias refman-pdf)
+ (package coq-doc)
+ (deps (alias refman-deps))
+ (action
+ (progn
+ (run env COQLIB=%{project_root} sphinx-build %{env:SPHINXWARNOPT=-W} -b latex sphinx %{targets})
+ (chdir %{targets} (run make)))))
+
+; Installable directories are not yet fully supported by Dune. See
+; ocaml/dune#1868. Yet, this makes coq-doc.install a valid target to
+; generate the whole Coq documentation. And the result under
+; _build/install/default/doc/coq-doc looks just right!
-; The install target still needs more work.
-; (install
-; (section doc)
-; (package coq-refman)
-; (files sphinx_build))
+(install
+ (files (refman-html as html/refman) (refman-pdf as pdf/refman))
+ (section doc)
+ (package coq-doc))
diff --git a/doc/plugin_tutorial/tuto1/src/simple_declare.ml b/doc/plugin_tutorial/tuto1/src/simple_declare.ml
index 307214089f..8c4dc0e8a6 100644
--- a/doc/plugin_tutorial/tuto1/src/simple_declare.ml
+++ b/doc/plugin_tutorial/tuto1/src/simple_declare.ml
@@ -1,12 +1,8 @@
-let edeclare ?hook ~name ~poly ~scope ~kind ~opaque sigma udecl body tyopt imps =
- let sigma, ce = DeclareDef.prepare_definition ~allow_evars:false
- ~opaque ~poly sigma udecl ~types:tyopt ~body in
- let uctx = Evd.evar_universe_context sigma in
- let ubinders = Evd.universe_binders sigma in
- let hook_data = Option.map (fun hook -> hook, uctx, []) hook in
- DeclareDef.declare_definition ~name ~scope ~kind ubinders ce imps ?hook_data
+let edeclare ?hook ~name ~poly ~scope ~kind ~opaque ~udecl ~impargs sigma body tyopt =
+ DeclareDef.declare_definition ~name ~scope ~kind ~impargs ?hook
+ ~opaque ~poly ~udecl ~types:tyopt ~body sigma
let declare_definition ~poly name sigma body =
let udecl = UState.default_univ_decl in
edeclare ~name ~poly ~scope:(DeclareDef.Global Declare.ImportDefaultBehavior)
- ~kind:Decls.(IsDefinition Definition) ~opaque:false sigma udecl body None []
+ ~kind:Decls.(IsDefinition Definition) ~opaque:false ~impargs:[] ~udecl sigma body None
diff --git a/doc/sphinx/addendum/extraction.rst b/doc/sphinx/addendum/extraction.rst
index d909f98956..41b726b069 100644
--- a/doc/sphinx/addendum/extraction.rst
+++ b/doc/sphinx/addendum/extraction.rst
@@ -1,7 +1,7 @@
.. _extraction:
-Extraction of programs in |OCaml| and Haskell
-=============================================
+Program extraction
+==================
:Authors: Jean-Christophe Filliâtre and Pierre Letouzey
diff --git a/doc/sphinx/addendum/miscellaneous-extensions.rst b/doc/sphinx/addendum/miscellaneous-extensions.rst
index db8c09d88f..0e8660cb0e 100644
--- a/doc/sphinx/addendum/miscellaneous-extensions.rst
+++ b/doc/sphinx/addendum/miscellaneous-extensions.rst
@@ -1,10 +1,5 @@
-.. _miscellaneousextensions:
-
-Miscellaneous extensions
-========================
-
Program derivation
-------------------
+==================
|Coq| comes with an extension called ``Derive``, which supports program
derivation. Typically in the style of Bird and Meertens or derivations
diff --git a/doc/sphinx/addendum/program.rst b/doc/sphinx/addendum/program.rst
index 549249d25c..5cffe9e435 100644
--- a/doc/sphinx/addendum/program.rst
+++ b/doc/sphinx/addendum/program.rst
@@ -98,10 +98,17 @@ coercions.
.. flag:: Program Mode
Enables the program mode, in which 1) typechecking allows subset coercions and
- 2) the elaboration of pattern matching of :cmd:`Program Fixpoint` and
- :cmd:`Program Definition` act
- like Program Fixpoint/Definition, generating obligations if there are
- unresolved holes after typechecking.
+ 2) the elaboration of pattern matching of :cmd:`Fixpoint` and
+ :cmd:`Definition` act as if the :attr:`program` attribute had been
+ used, generating obligations if there are unresolved holes after
+ typechecking.
+
+.. attr:: program
+
+ This attribute allows to use the Program mode on a specific
+ definition. An alternative syntax is to use the legacy ``Program``
+ prefix (cf. :n:`@legacy_attr`) as documented in the rest of this
+ chapter.
.. _syntactic_control:
@@ -155,7 +162,7 @@ Program Definition
This command types the value term in Russell and generates proof
obligations. Once solved using the commands shown below, it binds the
- final |Coq| term to the name ``ident`` in the environment.
+ final |Coq| term to the name :n:`@ident` in the environment.
.. exn:: @ident already exists.
:name: @ident already exists. (Program Definition)
@@ -163,12 +170,12 @@ Program Definition
.. cmdv:: Program Definition @ident : @type := @term
- It interprets the type ``type``, potentially generating proof
+ It interprets the type :n:`@type`, potentially generating proof
obligations to be resolved. Once done with them, we have a |Coq|
- type |type_0|. It then elaborates the preterm ``term`` into a |Coq|
- term |term_0|, checking that the type of |term_0| is coercible to
- |type_0|, and registers ``ident`` as being of type |type_0| once the
- set of obligations generated during the interpretation of |term_0|
+ type :n:`@type__0`. It then elaborates the preterm :n:`@term` into a |Coq|
+ term :n:`@term__0`, checking that the type of :n:`@term__0` is coercible to
+ :n:`@type__0`, and registers :n:`@ident` as being of type :n:`@type__0` once the
+ set of obligations generated during the interpretation of :n:`@term__0`
and the aforementioned coercion derivation are solved.
.. exn:: In environment … the term: @term does not have type @type. Actually, it has type ...
@@ -178,7 +185,7 @@ Program Definition
This is equivalent to:
- :g:`Program Definition ident : forall binders, type := fun binders => term`.
+ :n:`Program Definition @ident : forall {* @binder }, @type := fun {* @binder } => @term`.
.. TODO refer to production in alias
diff --git a/doc/sphinx/addendum/ring.rst b/doc/sphinx/addendum/ring.rst
index 76174e32b5..2a321b5cbf 100644
--- a/doc/sphinx/addendum/ring.rst
+++ b/doc/sphinx/addendum/ring.rst
@@ -1,8 +1,12 @@
+.. |bdi| replace:: :math:`\beta\delta\iota`
.. |ra| replace:: :math:`\rightarrow_{\beta\delta\iota}`
.. |la| replace:: :math:`\leftarrow_{\beta\delta\iota}`
.. |eq| replace:: `=`:sub:`(by the main correctness theorem)`
.. |re| replace:: ``(PEeval`` `v` `ap`\ ``)``
.. |le| replace:: ``(Pphi_dev`` `v` ``(norm`` `ap`\ ``))``
+.. |N| replace:: ``N``
+.. |nat| replace:: ``nat``
+.. |Z| replace:: ``Z``
.. _theringandfieldtacticfamilies:
diff --git a/doc/sphinx/addendum/type-classes.rst b/doc/sphinx/addendum/type-classes.rst
index 7abeca7815..bd4c276571 100644
--- a/doc/sphinx/addendum/type-classes.rst
+++ b/doc/sphinx/addendum/type-classes.rst
@@ -47,7 +47,7 @@ Leibniz equality on some type. An example implementation is:
| tt, tt => eq_refl tt
end }.
-Using the attribute ``refine``, if the term is not sufficient to
+Using the :attr:`refine` attribute, if the term is not sufficient to
finish the definition (e.g. due to a missing field or non-inferable
hole) it must be finished in proof mode. If it is sufficient a trivial
proof mode with no open goals is started.
@@ -77,9 +77,9 @@ remaining fields, e.g.:
Defined.
One has to take care that the transparency of every field is
-determined by the transparency of the :cmd:`Instance` proof. One can use
-alternatively the :cmd:`Program Instance` variant which has richer facilities
-for dealing with obligations.
+determined by the transparency of the :cmd:`Instance` proof. One can
+use alternatively the :attr:`program` attribute to get richer
+facilities for dealing with obligations.
Binding classes
@@ -174,7 +174,7 @@ For example:
.. coqtop:: in
- Global Program Instance option_eqb : EqDec (option A) :=
+ #[ global, program ] Instance option_eqb : EqDec (option A) :=
{ eqb x y := match x, y with
| Some x, Some y => eqb x y
| None, None => true
@@ -188,7 +188,7 @@ For example:
About option_eqb.
-Here the :cmd:`Global` modifier redeclares the instance at the end of the
+Here the :attr:`global` attribute redeclares the instance at the end of the
section, once it has been generalized by the context variables it
uses.
@@ -300,9 +300,11 @@ Summary of the commands
The :cmd:`Class` command is used to declare a typeclass with parameters
:token:`binders` and fields the declared record fields.
- This command supports the :attr:`universes(polymorphic)`, :attr:`universes(monomorphic)`,
+ Like any command declaring a record, this command supports the
+ :attr:`universes(polymorphic)`, :attr:`universes(monomorphic)`,
:attr:`universes(template)`, :attr:`universes(notemplate)`,
- :attr:`Cumulative`, :attr:`NonCumulative` and :attr:`Private` attributes.
+ :attr:`universes(cumulative)`, :attr:`universes(noncumulative)` and
+ :attr:`private(matching)` attributes.
.. _singleton-class:
@@ -341,6 +343,25 @@ Summary of the commands
:tacn:`auto` hints. If the priority :token:`num` is not specified, it defaults to the number
of non-dependent binders of the instance.
+ This command supports the :attr:`global` attribute that can be
+ used on instances declared in a section so that their
+ generalization is automatically redeclared after the section is
+ closed.
+
+ Like :cmd:`Definition`, it also supports the :attr:`program`
+ attribute to switch the type checking to `Program` (chapter
+ :ref:`programs`) and use the obligation mechanism to manage missing
+ fields.
+
+ Finally, it supports the lighter :attr:`refine` attribute:
+
+ .. attr:: refine
+
+ This attribute can be used to leave holes or not provide all
+ fields in the definition of an instance and open the tactic mode
+ to fill them. It works exactly as if no body had been given and
+ the :tacn:`refine` tactic has been used first.
+
.. cmdv:: Instance @ident {* @binder } : forall {* @binder }, @term__0 {+ @term} {? | @num } := @term
This syntax is used for declaration of singleton class instances or
@@ -348,19 +369,6 @@ Summary of the commands
{+ @term}`. One need not even mention the unique field name for
singleton classes.
- .. cmdv:: Global Instance
- :name: Global Instance
-
- One can use the :cmd:`Global` modifier on instances declared in a
- section so that their generalization is automatically redeclared
- after the section is closed.
-
- .. cmdv:: Program Instance
- :name: Program Instance
-
- Switches the type checking to `Program` (chapter :ref:`programs`) and
- uses the obligation mechanism to manage missing fields.
-
.. cmdv:: Declare Instance
:name: Declare Instance
diff --git a/doc/sphinx/addendum/universe-polymorphism.rst b/doc/sphinx/addendum/universe-polymorphism.rst
index 0e326f45d2..a08495badd 100644
--- a/doc/sphinx/addendum/universe-polymorphism.rst
+++ b/doc/sphinx/addendum/universe-polymorphism.rst
@@ -122,62 +122,92 @@ in a universe strictly higher than :g:`Set`.
Polymorphic, Monomorphic
-------------------------
-.. cmd:: Polymorphic @definition
+.. attr:: universes(polymorphic)
- As shown in the examples, polymorphic definitions and inductives can be
- declared using the ``Polymorphic`` prefix.
+ This attribute can be used to declare universe polymorphic
+ definitions and inductive types. There is also a legacy syntax
+ using the ``Polymorphic`` prefix (see :n:`@legacy_attr`) which, as
+ shown in the examples, is more commonly used.
.. flag:: Universe Polymorphism
- Once enabled, this flag will implicitly prepend ``Polymorphic`` to any
- definition of the user.
+ This flag is off by default. When it is on, new declarations are
+ polymorphic unless the :attr:`universes(monomorphic)` attribute is
+ used.
-.. cmd:: Monomorphic @definition
+.. attr:: universes(monomorphic)
- When the :flag:`Universe Polymorphism` flag is set, to make a definition
- producing global universe constraints, one can use the ``Monomorphic`` prefix.
+ This attribute can be used to declare universe monomorphic
+ definitions and inductive types (i.e. global universe constraints
+ are produced), even when the :flag:`Universe Polymorphism` flag is
+ on. There is also a legacy syntax using the ``Monomorphic`` prefix
+ (see :n:`@legacy_attr`).
-Many other commands support the ``Polymorphic`` flag, including:
+Many other commands can be used to declare universe polymorphic or
+monomorphic constants depending on whether the :flag:`Universe
+Polymorphism` flag is on or the :attr:`universes(polymorphic)` or
+:attr:`universes(monomorphic)` attributes are used:
-.. TODO add links on each of these?
+- :cmd:`Lemma`, :cmd:`Axiom`, etc. can be used to declare universe
+ polymorphic constants.
-- ``Lemma``, ``Axiom``, and all the other “definition” keywords support
- polymorphism.
+- Using the :attr:`universes(polymorphic)` attribute with the
+ :cmd:`Section` command will locally set the polymorphism flag inside
+ the section.
-- :cmd:`Section` will locally set the polymorphism flag inside the section.
+- :cmd:`Variable`, :cmd:`Context`, :cmd:`Universe` and
+ :cmd:`Constraint` in a section support polymorphism. See
+ :ref:`universe-polymorphism-in-sections` for more details.
-- ``Variables``, ``Context``, ``Universe`` and ``Constraint`` in a section support
- polymorphism. See :ref:`universe-polymorphism-in-sections` for more details.
-
-- :cmd:`Hint Resolve` and :cmd:`Hint Rewrite` will use the auto/rewrite hint
- polymorphically, not at a single instance.
+- Using the :attr:`universes(polymorphic)` attribute with the
+ :cmd:`Hint Resolve` or :cmd:`Hint Rewrite` commands will make
+ :tacn:`auto` / :tacn:`rewrite` use the hint polymorphically, not at
+ a single instance.
.. _cumulative:
Cumulative, NonCumulative
-------------------------
-Polymorphic inductive types, coinductive types, variants and records can be
-declared cumulative using the :g:`Cumulative` prefix.
+.. attr:: universes(cumulative)
+
+ Polymorphic inductive types, coinductive types, variants and
+ records can be declared cumulative using this attribute or the
+ legacy ``Cumulative`` prefix (see :n:`@legacy_attr`) which, as
+ shown in the examples, is more commonly used.
-.. cmd:: Cumulative @inductive
+ This means that two instances of the same inductive type (family)
+ are convertible based on the universe variances; they do not need
+ to be equal.
- Declares the inductive as cumulative
+ .. exn:: The cumulative and noncumulative attributes can only be used in a polymorphic context.
-Alternatively, there is a :flag:`Polymorphic Inductive
-Cumulativity` flag which when set, makes all subsequent *polymorphic*
-inductive definitions cumulative. When set, inductive types and the
-like can be enforced to be non-cumulative using the :g:`NonCumulative`
-prefix.
+ Using this attribute requires being in a polymorphic context,
+ i.e. either having the :flag:`Universe Polymorphism` flag on, or
+ having used the :attr:`universes(polymorphic)` attribute as
+ well.
-.. cmd:: NonCumulative @inductive
+ .. note::
- Declares the inductive as non-cumulative
+ ``#[ universes(polymorphic), universes(cumulative) ]`` can be
+ abbreviated into ``#[ universes(polymorphic, cumulative) ]``.
.. flag:: Polymorphic Inductive Cumulativity
- When this flag is on, it sets all following polymorphic inductive
- types as cumulative (it is off by default).
+ When this flag is on (it is off by default), it makes all
+ subsequent *polymorphic* inductive definitions cumulative, unless
+ the :attr:`universes(noncumulative)` attribute is used. It has no
+ effect on *monomorphic* inductive definitions.
+
+.. attr:: universes(noncumulative)
+
+ Declares the inductive type as non-cumulative even if the
+ :flag:`Polymorphic Inductive Cumulativity` flag is on. There is
+ also a legacy syntax using the ``NonCumulative`` prefix (see
+ :n:`@legacy_attr`).
+
+ This means that two instances of the same inductive type (family)
+ are convertible only if all the universes are equal.
Consider the examples below.
@@ -220,34 +250,10 @@ The following is an example of a record with non-trivial subtyping relation:
E[Γ] ⊢ \mathsf{packType}@\{i\} =_{βδιζη}
\mathsf{packType}@\{j\}~\mbox{ whenever }~i ≤ j
-Cumulative inductive types, coinductive types, variants and records
-only make sense when they are universe polymorphic. Therefore, an
-error is issued whenever the user uses the :g:`Cumulative` or
-:g:`NonCumulative` prefix in a monomorphic context.
-Notice that this is not the case for the :flag:`Polymorphic Inductive Cumulativity` flag.
-That is, this flag, when set, makes all subsequent *polymorphic*
-inductive declarations cumulative (unless, of course the :g:`NonCumulative` prefix is used)
-but has no effect on *monomorphic* inductive declarations.
-
-Consider the following examples.
-
-.. coqtop:: all reset
-
- Fail Monomorphic Cumulative Inductive Unit := unit.
-
-.. coqtop:: all reset
-
- Fail Monomorphic NonCumulative Inductive Unit := unit.
-
-.. coqtop:: all reset
-
- Set Polymorphic Inductive Cumulativity.
- Inductive Unit := unit.
-
An example of a proof using cumulativity
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.. coqtop:: in
+.. coqtop:: in reset
Set Universe Polymorphism.
Set Polymorphic Inductive Cumulativity.
@@ -368,10 +374,14 @@ to universes and explicitly instantiate polymorphic definitions.
In the monorphic case, this command declares a new global universe
named :g:`ident`, which can be referred to using its qualified name
as well. Global universe names live in a separate namespace. The
- command supports the ``Polymorphic`` flag only in sections, meaning the
- universe quantification will be discharged on each section definition
+ command supports the :attr:`universes(polymorphic)` attribute (or
+ the ``Polymorphic`` prefix) only in sections, meaning the universe
+ quantification will be discharged on each section definition
independently.
+ .. exn:: Polymorphic universes can only be declared inside sections, use Monomorphic Universe instead.
+ :undocumented:
+
.. cmd:: Constraint @univ_constraint
Polymorphic Constraint @univ_constraint
@@ -379,9 +389,10 @@ to universes and explicitly instantiate polymorphic definitions.
If consistent, the constraint is then enforced in the global
environment. Like :cmd:`Universe`, it can be used with the
- ``Polymorphic`` prefix in sections only to declare constraints
- discharged at section closing time. One cannot declare a global
- constraint on polymorphic universes.
+ :attr:`universes(polymorphic)` attribute (or the ``Polymorphic``
+ prefix) in sections only to declare constraints discharged at
+ section closing time. One cannot declare a global constraint on
+ polymorphic universes.
.. exn:: Undeclared universe @ident.
:undocumented:
@@ -389,6 +400,9 @@ to universes and explicitly instantiate polymorphic definitions.
.. exn:: Universe inconsistency.
:undocumented:
+ .. exn:: Polymorphic universe constraints can only be declared inside sections, use Monomorphic Constraint instead
+ :undocumented:
+
Polymorphic definitions
~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/doc/sphinx/appendix/history-and-changes/index.rst b/doc/sphinx/appendix/history-and-changes/index.rst
new file mode 100644
index 0000000000..50ffec8e3f
--- /dev/null
+++ b/doc/sphinx/appendix/history-and-changes/index.rst
@@ -0,0 +1,21 @@
+.. _history-and-changes:
+
+==========================
+History and recent changes
+==========================
+
+This chapter is divided in two parts. The first one is about the
+:ref:`early history of Coq <history>` and is presented in
+chronological order. The second one provides :ref:`release notes
+about recent versions of Coq <changes>` and is presented in reverse
+chronological order. When updating your copy of Coq to a new version
+(especially a new major version), it is strongly recommended that you
+read the corresponding release notes. They may contain advice that
+will help you understand the differences with the previous version and
+upgrade your projects.
+
+.. toctree::
+ :maxdepth: 1
+
+ ../../history
+ ../../changes
diff --git a/doc/sphinx/appendix/indexes/index.rst b/doc/sphinx/appendix/indexes/index.rst
new file mode 100644
index 0000000000..a5032ff822
--- /dev/null
+++ b/doc/sphinx/appendix/indexes/index.rst
@@ -0,0 +1,24 @@
+:orphan:
+
+.. _indexes:
+
+========
+Indexes
+========
+
+We provide various specialized indexes that are helpful to quickly
+find what you are looking for.
+
+.. toctree::
+
+ ../../genindex
+ ../../coq-cmdindex
+ ../../coq-tacindex
+ ../../coq-optindex
+ ../../coq-exnindex
+
+For reference, here are direct links to the documentation of:
+
+- :ref:`flags, options and tables <flags-options-tables>`;
+- controlling the display of warning messages with the :opt:`Warnings`
+ option.
diff --git a/doc/sphinx/changes.rst b/doc/sphinx/changes.rst
index 6d9979a704..7401aff48c 100644
--- a/doc/sphinx/changes.rst
+++ b/doc/sphinx/changes.rst
@@ -1,8 +1,10 @@
+.. _changes:
+
--------------
Recent changes
--------------
-.. ifconfig:: not coq_config.is_a_released_version
+.. ifconfig:: not is_a_released_version
.. include:: ../unreleased.rst
@@ -158,7 +160,7 @@ Changes in 8.11+beta1
Annotation in `Arguments` for bidirectionality hints: it is now possible
to tell type inference to use type information from the context once the `n`
first arguments of an application are known. The syntax is:
- `Arguments foo x y & z`. See :cmd:`Arguments (bidirectionality hints)`
+ `Arguments foo x y & z`. See :ref:`bidirectionality_hints`
(`#10049 <https://github.com/coq/coq/pull/10049>`_, by Maxime Dénès with
help from Enrico Tassi).
- **Added:**
@@ -214,13 +216,13 @@ Changes in 8.11+beta1
- **Changed:**
Output of the :cmd:`Print` and :cmd:`About` commands.
Arguments meta-data is now displayed as the corresponding
- :cmd:`Arguments <Arguments (implicits)>` command instead of the
+ :cmd:`Arguments` command instead of the
human-targeted prose used in previous Coq versions. (`#10985
<https://github.com/coq/coq/pull/10985>`_, by Gaëtan Gilbert).
.. _811RefineInstance:
-- **Added:** ``#[refine]`` attribute for :cmd:`Instance`, a more
+- **Added:** :attr:`refine` attribute for :cmd:`Instance`, a more
predictable version of the old ``Refine Instance Mode`` which
unconditionally opens a proof (`#10996
<https://github.com/coq/coq/pull/10996>`_, by Gaëtan Gilbert).
@@ -381,6 +383,10 @@ Changes in 8.11+beta1
<https://github.com/coq/coq/issues/3890>`_ and `#4638
<https://github.com/coq/coq/issues/4638>`_
by Maxime Dénès, review by Gaëtan Gilbert).
+- **Changed:**
+ :cmd:`Fail` does not catch critical errors (including "stack overflow")
+ anymore (`#10173 <https://github.com/coq/coq/pull/10173>`_,
+ by Gaëtan Gilbert).
- **Removed:**
Undocumented :n:`Instance : !@type` syntax
(`#10185 <https://github.com/coq/coq/pull/10185>`_, by Gaëtan Gilbert).
@@ -683,7 +689,7 @@ reference manual. Here are the most important user-visible changes:
- Universes:
- - Added :cmd:`Print Universes Subgraph` variant of :cmd:`Print Universes`.
+ - Added Subgraph variant to :cmd:`Print Universes`.
Try for instance
:g:`Print Universes Subgraph(sigT2.u1 sigT_of_sigT2.u1 projT3_eq.u1).`
(`#8451 <https://github.com/coq/coq/pull/8451>`_, by Gaëtan Gilbert).
@@ -1314,7 +1320,7 @@ Changes in 8.10+beta3
rules governing template-polymorphic types.
To help users incrementally fix this issue, a command line option
- `-no-template-check` and a global flag :flag:`Template Check` are
+ `-no-template-check` and a global flag ``Template Check`` are
available to selectively disable the new check. Use at your own risk.
(`#9918 <https://github.com/coq/coq/pull/9918>`_, by Matthieu Sozeau
@@ -1506,7 +1512,7 @@ changes:
- Removed deprecated commands ``Arguments Scope`` and ``Implicit
Arguments`` in favor of :cmd:`Arguments (scopes)` and
- :cmd:`Arguments (implicits)`, with the help of Jasper Hugunin.
+ :cmd:`Arguments`, with the help of Jasper Hugunin.
- New flag :flag:`Uniform Inductive Parameters` by Jasper Hugunin to
avoid repeating uniform parameters in constructor declarations.
@@ -4713,7 +4719,7 @@ Specification language
Module system
-- Include Type is now deprecated since Include now accept both modules and
+- Include Type is now deprecated since Include now accepts both modules and
module types.
- Declare ML Module supports Local option.
- The sharing between non-logical object and the management of the
diff --git a/doc/sphinx/conf.py b/doc/sphinx/conf.py
index 98272810f6..2ed9ec21b3 100755
--- a/doc/sphinx/conf.py
+++ b/doc/sphinx/conf.py
@@ -46,7 +46,7 @@ with open("refman-preamble.rst") as s:
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
-needs_sphinx = '1.7.8'
+needs_sphinx = '1.8.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
@@ -100,7 +100,7 @@ def copy_formatspecific_files(app):
def setup(app):
app.connect('builder-inited', copy_formatspecific_files)
- app.add_config_value('coq_config', coq_config, 'env')
+ app.add_config_value('is_a_released_version', coq_config.is_a_released_version, 'env')
# The master toctree document.
# We create this file in `copy_master_doc` above.
@@ -186,9 +186,7 @@ nitpick_ignore = [ ('token', token) for token in [
'assums',
'binders',
'collection',
- 'definition',
'dirpath',
- 'inductive',
'ind_body',
'modpath',
'module',
diff --git a/doc/sphinx/genindex.rst b/doc/sphinx/genindex.rst
index 29f792b3aa..e3a27fd7c4 100644
--- a/doc/sphinx/genindex.rst
+++ b/doc/sphinx/genindex.rst
@@ -2,6 +2,6 @@
.. hack to get index in TOC
------
-Index
------
+-------------
+General index
+-------------
diff --git a/doc/sphinx/history.rst b/doc/sphinx/history.rst
index c4a48d6985..153dc1f368 100644
--- a/doc/sphinx/history.rst
+++ b/doc/sphinx/history.rst
@@ -1,3 +1,5 @@
+.. _history:
+
--------------------
Early history of Coq
--------------------
diff --git a/doc/sphinx/index.html.rst b/doc/sphinx/index.html.rst
index 0a20d1c47b..6069ed42fe 100644
--- a/doc/sphinx/index.html.rst
+++ b/doc/sphinx/index.html.rst
@@ -8,84 +8,37 @@ Contents
--------
.. toctree::
- :caption: Indexes
-
- genindex
- coq-cmdindex
- coq-tacindex
- coq-optindex
- coq-exnindex
-
-.. No entries yet
- * :index:`thmindex`
-
-.. toctree::
- :caption: Preamble
self
- history
- changes
.. toctree::
- :caption: The language
+ :caption: Specification language
- language/gallina-specification-language
- language/gallina-extensions
- language/coq-library
- language/cic
- language/module-system
+ language/core/index
+ language/extensions/index
.. toctree::
- :caption: The proof engine
+ :caption: Proofs
- proof-engine/vernacular-commands
- proof-engine/proof-handling
- proof-engine/tactics
- proof-engine/ltac
- proof-engine/ltac2
- proof-engine/detailed-tactic-examples
- proof-engine/ssreflect-proof-language
+ proofs/writing-proofs/index
+ proofs/automatic-tactics/index
+ proofs/creating-tactics/index
.. toctree::
- :caption: User extensions
+ :caption: Using Coq
- user-extensions/syntax-extensions
- user-extensions/proof-schemes
+ using/libraries/index
+ using/tools/index
.. toctree::
- :caption: Practical tools
+ :caption: Appendix
- practical-tools/coq-commands
- practical-tools/utilities
- practical-tools/coqide
-
-.. toctree::
- :caption: Addendum
-
- addendum/extended-pattern-matching
- addendum/implicit-coercions
- addendum/canonical-structures
- addendum/type-classes
- addendum/omega
- addendum/micromega
- addendum/extraction
- addendum/program
- addendum/ring
- addendum/nsatz
- addendum/generalized-rewriting
- addendum/parallel-proof-processing
- addendum/miscellaneous-extensions
- addendum/universe-polymorphism
- addendum/sprop
+ appendix/history-and-changes/index
+ appendix/indexes/index
+ zebibliography
-.. toctree::
- :caption: Reference
+.. No entries yet
+ * :index:`thmindex`
- zebibliography
.. include:: license.rst
-
-.. [#PG] Proof-General is available at https://proofgeneral.github.io/.
- Optionally, you can enhance it with the minor mode
- Company-Coq :cite:`Pit16`
- (see https://github.com/cpitclaudel/company-coq).
diff --git a/doc/sphinx/index.latex.rst b/doc/sphinx/index.latex.rst
index 5562736997..62d9525194 100644
--- a/doc/sphinx/index.latex.rst
+++ b/doc/sphinx/index.latex.rst
@@ -10,81 +10,39 @@ Introduction
.. include:: license.rst
-.. [#PG] Proof-General is available at https://proofgeneral.github.io/.
- Optionally, you can enhance it with the minor mode
- Company-Coq :cite:`Pit16`
- (see https://github.com/cpitclaudel/company-coq).
-
-.. include:: history.rst
-
-.. include:: changes.rst
-
-------------
-The language
-------------
+----------------------
+Specification language
+----------------------
.. toctree::
- language/gallina-specification-language
- language/gallina-extensions
- language/coq-library
- language/cic
- language/module-system
+ language/core/index
+ language/extensions/index
-----------------
-The proof engine
-----------------
+------
+Proofs
+------
.. toctree::
- proof-engine/vernacular-commands
- proof-engine/proof-handling
- proof-engine/tactics
- proof-engine/ltac
- proof-engine/ltac2
- proof-engine/detailed-tactic-examples
- proof-engine/ssreflect-proof-language
+ proofs/writing-proofs/index
+ proofs/automatic-tactics/index
+ proofs/creating-tactics/index
----------------
-User extensions
----------------
+---------
+Using Coq
+---------
.. toctree::
- user-extensions/syntax-extensions
- user-extensions/proof-schemes
-
----------------
-Practical tools
----------------
-
-.. toctree::
-
- practical-tools/coq-commands
- practical-tools/utilities
- practical-tools/coqide
+ using/libraries/index
+ using/tools/index
--------
-Addendum
+Appendix
--------
.. toctree::
- addendum/extended-pattern-matching
- addendum/implicit-coercions
- addendum/canonical-structures
- addendum/type-classes
- addendum/omega
- addendum/micromega
- addendum/extraction
- addendum/program
- addendum/ring
- addendum/nsatz
- addendum/generalized-rewriting
- addendum/parallel-proof-processing
- addendum/miscellaneous-extensions
- addendum/universe-polymorphism
- addendum/sprop
-
-.. toctree::
+ appendix/history-and-changes/index
zebibliography
diff --git a/doc/sphinx/introduction.rst b/doc/sphinx/introduction.rst
index 1424b4f3e1..b059fb4069 100644
--- a/doc/sphinx/introduction.rst
+++ b/doc/sphinx/introduction.rst
@@ -1,107 +1,68 @@
-This document is the Reference Manual of the |Coq| proof assistant.
-To start using Coq, it is advised to first read a tutorial.
-Links to several tutorials can be found at
-https://coq.inria.fr/documentation and
-https://github.com/coq/coq/wiki#coq-tutorials
-
-The |Coq| system is designed to develop mathematical proofs, and
-especially to write formal specifications, programs and to verify that
-programs are correct with respect to their specifications. It provides a
-specification language named |Gallina|. Terms of |Gallina| can represent
-programs as well as properties of these programs and proofs of these
-properties. Using the so-called *Curry-Howard isomorphism*, programs,
-properties and proofs are formalized in the same language called
-*Calculus of Inductive Constructions*, that is a
-:math:`\lambda`-calculus with a rich type system. All logical judgments
-in |Coq| are typing judgments. The very heart of the |Coq| system is the
-type checking algorithm that checks the correctness of proofs, in other
-words that checks that a program complies to its specification. |Coq| also
-provides an interactive proof assistant to build proofs using specific
-programs called *tactics*.
-
-All services of the |Coq| proof assistant are accessible by interpretation
-of a command language called *the vernacular*.
-
-Coq has an interactive mode in which commands are interpreted as the
-user types them in from the keyboard and a compiled mode where commands
-are processed from a file.
-
-- In interactive mode, users can develop their theories and proofs step by
- step, and query the system for available theorems and definitions. The
- interactive mode is generally run with the help of an IDE, such
- as CoqIDE, documented in :ref:`coqintegrateddevelopmentenvironment`,
- Emacs with Proof-General :cite:`Asp00` [#PG]_,
- or jsCoq to run Coq in your browser (see https://github.com/ejgallego/jscoq).
- The `coqtop` read-eval-print-loop can also be used directly, for debugging
- purposes.
-
-- The compiled mode acts as a proof checker taking a file containing a
- whole development in order to ensure its correctness. Moreover,
- |Coq|’s compiler provides an output file containing a compact
- representation of its input. The compiled mode is run with the `coqc`
- command.
-
-.. seealso:: :ref:`thecoqcommands`.
-
-How to read this book
----------------------
-
-This is a Reference Manual, so it is not intended for continuous reading.
-We recommend using the various indexes to quickly locate the documentation
-you are looking for. There is a global index, and a number of specific indexes
-for tactics, vernacular commands, and error messages and warnings.
-Nonetheless, the manual has some structure that is explained below.
-
-- The first part describes the specification language, |Gallina|.
- Chapters :ref:`gallinaspecificationlanguage` and :ref:`extensionsofgallina` describe the concrete
- syntax as well as the meaning of programs, theorems and proofs in the
- Calculus of Inductive Constructions. Chapter :ref:`thecoqlibrary` describes the
- standard library of |Coq|. Chapter :ref:`calculusofinductiveconstructions` is a mathematical description
- of the formalism. Chapter :ref:`themodulesystem` describes the module
- system.
-
-- The second part describes the proof engine. It is divided into several
- chapters. Chapter :ref:`vernacularcommands` presents all commands (we
- call them *vernacular commands*) that are not directly related to
- interactive proving: requests to the environment, complete or partial
- evaluation, loading and compiling files. How to start and stop
- proofs, do multiple proofs in parallel is explained in
- Chapter :ref:`proofhandling`. In Chapter :ref:`tactics`, all commands that
- realize one or more steps of the proof are presented: we call them
- *tactics*. The legacy language to combine these tactics into complex proof
- strategies is given in Chapter :ref:`ltac`. The currently experimental
- language that will eventually replace Ltac is presented in
- Chapter :ref:`ltac2`. Examples of tactics
- are described in Chapter :ref:`detailedexamplesoftactics`.
- Finally, the |SSR| proof language is presented in
- Chapter :ref:`thessreflectprooflanguage`.
-
-- The third part describes how to extend the syntax of |Coq| in
- Chapter :ref:`syntaxextensionsandinterpretationscopes` and how to define
- new induction principles in Chapter :ref:`proofschemes`.
-
-- In the fourth part more practical tools are documented. First in
- Chapter :ref:`thecoqcommands`, the usage of `coqc` (batch mode) and
- `coqtop` (interactive mode) with their options is described. Then,
- in Chapter :ref:`utilities`, various utilities that come with the
- |Coq| distribution are presented. Finally, Chapter :ref:`coqintegrateddevelopmentenvironment`
- describes CoqIDE.
-
-- The fifth part documents a number of advanced features, including coercions,
- canonical structures, typeclasses, program extraction, and specialized
- solvers and tactics. See the table of contents for a complete list.
-
-List of additional documentation
---------------------------------
-
-This manual does not contain all the documentation the user may need
-about |Coq|. Various informations can be found in the following documents:
-
-Installation
- A text file `INSTALL` that comes with the sources explains how to
- install |Coq|.
-
-The |Coq| standard library
- A commented version of sources of the |Coq| standard library
- (including only the specifications, the proofs are removed) is
- available at https://coq.inria.fr/stdlib/.
+This is the reference manual of |Coq|. Coq is an interactive theorem
+prover. It lets you formalize mathematical concepts and then helps
+you interactively generate machine-checked proofs of theorems.
+Machine checking gives users much more confidence that the proofs are
+correct compared to human-generated and -checked proofs. Coq has been
+used in a number of flagship verification projects, including the
+`CompCert verified C compiler <http://compcert.inria.fr/>`_, and has
+served to verify the proof of the `four color theorem
+<https://github.com/math-comp/fourcolor>`_ (among many other
+mathematical formalizations).
+
+Users generate proofs by entering a series of tactics that constitute
+steps in the proof. There are many built-in tactics, some of which
+are elementary, while others implement complex decision procedures
+(such as :tacn:`lia`, a decision procedure for linear integer
+arithmetic). :ref:`Ltac <ltac>` and its planned replacement,
+:ref:`Ltac2 <ltac2>`, provide languages to define new tactics by
+combining existing tactics with looping and conditional constructs.
+These permit automation of large parts of proofs and sometimes entire
+proofs. Furthermore, users can add novel tactics or functionality by
+creating Coq plugins using OCaml.
+
+The Coq kernel, a small part of Coq, does the final verification that
+the tactic-generated proof is valid. Usually the tactic-generated
+proof is indeed correct, but delegating proof verification to the
+kernel means that even if a tactic is buggy, it won't be able to
+introduce an incorrect proof into the system.
+
+Finally, Coq also supports extraction of verified programs to
+programming languages such as OCaml and Haskell. This provides a way
+of executing Coq code efficiently and can be used to create verified
+software libraries.
+
+To learn Coq, beginners are advised to first start with a tutorial /
+book. Several such tutorials / books are listed at
+https://coq.inria.fr/documentation.
+
+This manual is organized in three main parts, plus an appendix:
+
+- **The first part presents the specification language of Coq**, that
+ allows to define programs and state mathematical theorems.
+ :ref:`core-language` presents the language that the kernel of Coq
+ understands. :ref:`extensions` presents the richer language, with
+ notations, implicits, etc. that a user can use and which is
+ translated down to the language of the kernel by means of an
+ "elaboration process".
+
+- **The second part presents the interactive proof mode**, the central
+ feature of Coq. :ref:`writing-proofs` introduces this interactive
+ proof mode and the available proof languages.
+ :ref:`automatic-tactics` presents some more advanced tactics, while
+ :ref:`writing-tactics` is about the languages that allow a user to
+ combine tactics together and develop new ones.
+
+- **The third part shows how to use Coq in practice.**
+ :ref:`libraries` presents some of the essential reusable blocks from
+ the ecosystem and some particularly important extensions such as the
+ program extraction mechanism. :ref:`tools` documents important
+ tools that a user needs to build a Coq project.
+
+- In the appendix, :ref:`history-and-changes` presents the history of
+ Coq and changes in recent releases. This is an important reference
+ if you upgrade the version of Coq that you use. The various
+ :ref:`indexes <indexes>` are very useful to **quickly browse the
+ manual and find what you are looking for.** They are often the main
+ entry point to the manual.
+
+The full table of contents is presented below:
diff --git a/doc/sphinx/language/cic.rst b/doc/sphinx/language/cic.rst
index 4beaff70f5..09a3897a06 100644
--- a/doc/sphinx/language/cic.rst
+++ b/doc/sphinx/language/cic.rst
@@ -47,8 +47,7 @@ provable. An object of type :math:`\Prop` is called a proposition.
The sort :math:`\SProp` is like :math:`\Prop` but the propositions in
:math:`\SProp` are known to have irrelevant proofs (all proofs are
equal). Objects of type :math:`\SProp` are called strict propositions.
-:math:`\SProp` is rejected except when using the compiler option
-``-allow-sprop``. See :ref:`sprop` for information about using
+See :ref:`sprop` for information about using
:math:`\SProp`, and :cite:`Gilbert:POPL2019` for meta theoretical
considerations.
@@ -1200,45 +1199,47 @@ Conversion is preserved as any (partial) instance :math:`I_j~q_1 … q_r` or
at level :math:`\Type` (without annotations or hiding it behind a
definition) template polymorphic if possible.
- This can be prevented using the ``universes(notemplate)``
+ This can be prevented using the :attr:`universes(notemplate)`
attribute.
+ Template polymorphism and full universe polymorphism (see Chapter
+ :ref:`polymorphicuniverses`) are incompatible, so if the latter is
+ enabled (through the :flag:`Universe Polymorphism` flag or the
+ :attr:`universes(polymorphic)` attribute) it will prevail over
+ automatic template polymorphism.
+
.. warn:: Automatically declaring @ident as template polymorphic.
- Warning ``auto-template`` can be used to find which types are
- implicitly declared template polymorphic by :flag:`Auto Template
- Polymorphism`.
+ Warning ``auto-template`` can be used (it is off by default) to
+ find which types are implicitly declared template polymorphic by
+ :flag:`Auto Template Polymorphism`.
An inductive type can be forced to be template polymorphic using
- the ``universes(template)`` attribute: it should then fulfill the
- criterion to be template polymorphic or an error is raised.
-
-.. exn:: Inductive @ident cannot be made template polymorphic.
-
- This error is raised when the `#[universes(template)]` attribute is
- on but the inductive cannot be made polymorphic on any universe or be
- inferred to live in :math:`\Prop` or :math:`\Set`.
-
- Template polymorphism and universe polymorphism (see Chapter
- :ref:`polymorphicuniverses`) are incompatible, so if the later is
- enabled it will prevail over automatic template polymorphism and
- cause an error when using the ``universes(template)`` attribute.
-
-.. flag:: Template Check
-
- This flag is on by default. Turning it off disables the check of
- locality of the sorts when abstracting the inductive over its
- parameters. This is a deprecated and *unsafe* flag that can introduce
- inconsistencies, it is only meant to help users incrementally update
- code from Coq versions < 8.10 which did not implement this check.
- The `Coq89.v` compatibility file sets this flag globally. A global
- ``-no-template-check`` command line option is also available. Use at
- your own risk. Use of this flag is recorded in the typing flags
- associated to a definition but is *not* supported by the |Coq|
- checker (`coqchk`). It will appear in :g:`Print Assumptions` and
- :g:`About @ident` output involving inductive declarations that were
- (potentially unsoundly) assumed to be template polymorphic.
+ the :attr:`universes(template)` attribute: in this case, the
+ warning is not emitted.
+
+.. attr:: universes(template)
+
+ This attribute can be used to explicitly declare an inductive type
+ as template polymorphic, whether the :flag:`Auto Template
+ Polymorphism` flag is on or off.
+
+ .. exn:: template and polymorphism not compatible
+
+ This attribute cannot be used in a full universe polymorphic
+ context, i.e. if the :flag:`Universe Polymorphism` flag is on or
+ if the :attr:`universes(polymorphic)` attribute is used.
+
+ .. exn:: Ill-formed template inductive declaration: not polymorphic on any universe.
+
+ The attribute was used but the inductive definition does not
+ satisfy the criterion to be template polymorphic.
+
+.. attr:: universes(notemplate)
+ This attribute can be used to prevent an inductive type to be
+ template polymorphic, even if the :flag:`Auto Template
+ Polymorphism` flag is on.
In practice, the rule **Ind-Family** is used by |Coq| only when all the
inductive types of the inductive definition are declared with an arity
diff --git a/doc/sphinx/language/coq-library.rst b/doc/sphinx/language/coq-library.rst
index 39f2ccec29..acdd4408ed 100644
--- a/doc/sphinx/language/coq-library.rst
+++ b/doc/sphinx/language/coq-library.rst
@@ -1062,6 +1062,11 @@ Floating-point constants are parsed and pretty-printed as (17-digit)
decimal constants. This ensures that the composition
:math:`\text{parse} \circ \text{print}` amounts to the identity.
+.. warn:: The constant @numeral is not a binary64 floating-point value. A closest value will be used and unambiguously printed @numeral. [inexact-float,parsing]
+
+ Not all decimal constants are floating-point values. This warning
+ is generated when parsing such a constant (for instance ``0.1``).
+
.. example::
.. coqtop:: all
diff --git a/doc/sphinx/language/core/index.rst b/doc/sphinx/language/core/index.rst
new file mode 100644
index 0000000000..07dcfff444
--- /dev/null
+++ b/doc/sphinx/language/core/index.rst
@@ -0,0 +1,37 @@
+.. _core-language:
+
+=============
+Core language
+=============
+
+At the heart of the Coq proof assistant is the Coq kernel. While
+users have access to a language with many convenient features such as
+notations, implicit arguments, etc. (that are presented in the
+:ref:`next chapter <extensions>`), such complex terms get translated
+down to a core language (the Calculus of Inductive Constructions) that
+the kernel understands, and which we present here. Furthermore, while
+users can build proofs interactively using tactics (see Chapter
+:ref:`writing-proofs`), the role of these tactics is to incrementally
+build a "proof term" which the kernel will verify. More precisely, a
+proof term is a term of the Calculus of Inductive Constructions whose
+type corresponds to a theorem statement. The kernel is a type checker
+which verifies that terms have their expected type.
+
+This separation between the kernel on the one hand and the elaboration
+engine and tactics on the other hand follows what is known as the "de
+Bruijn criterion" (keeping a small and well delimited trusted code
+base within a proof assistant which can be much more complex). This
+separation makes it possible to reduce the trust in the whole system
+to trusting a smaller, critical component: the kernel. In particular,
+users may rely on external plugins that provide advanced and complex
+tactics without fear of these tactics being buggy, because the kernel
+will have to check their output.
+
+.. toctree::
+ :maxdepth: 1
+
+ ../gallina-specification-language
+ ../cic
+ ../../addendum/universe-polymorphism
+ ../../addendum/sprop
+ ../module-system
diff --git a/doc/sphinx/language/extensions/index.rst b/doc/sphinx/language/extensions/index.rst
new file mode 100644
index 0000000000..f22927d627
--- /dev/null
+++ b/doc/sphinx/language/extensions/index.rst
@@ -0,0 +1,26 @@
+.. _extensions:
+
+===================
+Language extensions
+===================
+
+Elaboration extends the language accepted by the Coq kernel to make it
+easier to use. For example, this lets the user omit most type
+annotations because they can be inferred, call functions with implicit
+arguments which will be inferred as well, extend the syntax with
+notations, factorize branches when pattern-matching, etc. In this
+chapter, we present these language extensions and we give some
+explanations on how this language is translated down to the core
+language presented in the :ref:`previous chapter <core-language>`.
+
+.. toctree::
+ :maxdepth: 1
+
+ ../gallina-extensions
+ ../../addendum/extended-pattern-matching
+ ../../user-extensions/syntax-extensions
+ ../../addendum/implicit-coercions
+ ../../addendum/type-classes
+ ../../addendum/canonical-structures
+ ../../addendum/program
+ ../../proof-engine/vernacular-commands
diff --git a/doc/sphinx/language/gallina-extensions.rst b/doc/sphinx/language/gallina-extensions.rst
index b9e181dd94..18b05e47d3 100644
--- a/doc/sphinx/language/gallina-extensions.rst
+++ b/doc/sphinx/language/gallina-extensions.rst
@@ -20,31 +20,39 @@ expressions. In this sense, the :cmd:`Record` construction allows defining
.. _record_grammar:
- .. productionlist:: sentence
- record : `record_keyword` `record_body` with … with `record_body`
- record_keyword : Record | Inductive | CoInductive
- record_body : `ident` [ `binders` ] [: `sort` ] := [ `ident` ] { [ `field` ; … ; `field` ] }.
- field : `ident` [ `binders` ] : `type` [ `decl_notations` ]
- : `ident` [ `binders` ] [: `type` ] := `term`
-
-.. cmd:: {| Record | Structure } @inductive_definition {* with @inductive_definition }
+.. cmd:: {| Record | Structure } @record_definition {* with @record_definition }
:name: Record; Structure
- The first identifier :token:`ident` is the name of the defined record and :token:`sort` is its
- type. The optional identifier following ``:=`` is the name of its constructor. If it is omitted,
- the default name :n:`Build_@ident`, where :token:`ident` is the record name, is used. If :token:`sort` is
- omitted, the default sort is :math:`\Type`. The identifiers inside the brackets are the names of
- fields. For a given field :token:`ident`, its type is :n:`forall {* @binder }, @type`.
- Notice that the type of a particular identifier may depend on a previously-given identifier. Thus the
- order of the fields is important. The record can depend as a whole on parameters :token:`binders`
- and each field can also depend on its own :token:`binders`. Finally, notations can be attached to
- fields using the :n:`decl_notations` annotation.
+ .. insertprodn record_definition field_body
+
+ .. prodn::
+ record_definition ::= {? > } @ident_decl {* @binder } {? : @type } {? @ident } %{ {*; @record_field } %} {? @decl_notations }
+ record_field ::= {* #[ {*, @attr } ] } @name {? @field_body } {? %| @num } {? @decl_notations }
+ field_body ::= {* @binder } @of_type
+ | {* @binder } @of_type := @term
+ | {* @binder } := @term
+
+ Each :n:`@record_definition` defines a record named by :n:`@ident_decl`.
+ The constructor name is given by :n:`@ident`.
+ If the constructor name is not specified, then the default name :n:`Build_@ident` is used,
+ where :n:`@ident` is the record name.
+
+ If :n:`@type` is
+ omitted, the default type is :math:`\Type`. The identifiers inside the brackets are the field names.
+ The type of each field :n:`@ident` is :n:`forall {* @binder }, @type`.
+ Notice that the type of an identifier can depend on a previously-given identifier. Thus the
+ order of the fields is important. :n:`@binder` parameters may be applied to the record as a whole
+ or to individual fields.
+
+ Notations can be attached to fields using the :n:`@decl_notations` annotation.
:cmd:`Record` and :cmd:`Structure` are synonyms.
- This command supports the :attr:`universes(polymorphic)`, :attr:`universes(monomorphic)`,
- :attr:`universes(template)`, :attr:`universes(notemplate)`,
- :attr:`Cumulative`, :attr:`NonCumulative` and :attr:`Private` attributes.
+ This command supports the :attr:`universes(polymorphic)`,
+ :attr:`universes(monomorphic)`, :attr:`universes(template)`,
+ :attr:`universes(notemplate)`, :attr:`universes(cumulative)`,
+ :attr:`universes(noncumulative)` and :attr:`private(matching)`
+ attributes.
More generally, a record may have explicitly defined (a.k.a. manifest)
fields. For instance, we might have:
@@ -353,16 +361,12 @@ can be alternatively written
Definition not (b:bool) := if b then false else true.
-More generally, for an inductive type with constructors |C_1| and |C_2|,
-we have the following equivalence
+More generally, for an inductive type with constructors :n:`@ident__1`
+and :n:`@ident__2`, the following terms are equal:
-::
+:n:`if @term__0 {? {? as @name } return @term } then @term__1 else @term__2`
- if term [dep_ret_type] then term₁ else term₂ ≡
- match term [dep_ret_type] with
- | C₁ _ … _ => term₁
- | C₂ _ … _ => term₂
- end
+:n:`match @term__0 {? {? as @name } return @term } with | @ident__1 {* _ } => @term__1 | @ident__2 {* _ } => @term__2 end`
.. example::
@@ -390,11 +394,13 @@ constructions. There are two variants of them.
First destructuring let syntax
++++++++++++++++++++++++++++++
-The expression :g:`let (`\ |ident_1|:g:`, … ,` |ident_n|\ :g:`) :=` |term_0|\ :g:`in` |term_1| performs
-case analysis on |term_0| which must be in an inductive type with one
-constructor having itself :math:`n` arguments. Variables |ident_1| … |ident_n| are
-bound to the :math:`n` arguments of the constructor in expression |term_1|. For
-instance, the definition
+The expression :n:`let ( {*, @ident__i } ) := @term__0 in @term__1`
+performs case analysis on :n:`@term__0` whose type must be an
+inductive type with exactly one constructor. The number of variables
+:n:`@ident__i` must correspond to the number of arguments of this
+contrustor. Then, in :n:`@term__1`, these variables are bound to the
+arguments of the constructor in :n:`@term__0`. For instance, the
+definition
.. coqtop:: reset all
@@ -409,7 +415,7 @@ can be alternatively written
Definition fst (A B:Set) (p:A * B) := let (x, _) := p in x.
Notice that reduction is different from regular :g:`let … in …`
-construction since it happens only if |term_0| is in constructor form.
+construction since it happens only if :n:`@term__0` is in constructor form.
Otherwise, the reduction is blocked.
The pretty-printing of a definition by matching on a irrefutable
@@ -589,29 +595,82 @@ This example emphasizes what the printing settings offer.
Advanced recursive functions
----------------------------
-The following experimental command is available when the ``FunInd`` library has been loaded via ``Require Import FunInd``:
+The following command is available when the ``FunInd`` library has been loaded via ``Require Import FunInd``:
-.. cmd:: Function @ident {* @binder} { @fixannot } : @type := @term
+.. cmd:: Function @fix_definition {* with @fix_definition }
- This command can be seen as a generalization of ``Fixpoint``. It is actually a wrapper
- for several ways of defining a function *and other useful related
- objects*, namely: an induction principle that reflects the recursive
+ This command is a generalization of :cmd:`Fixpoint`. It is a wrapper
+ for several ways of defining a function *and* other useful related
+ objects, namely: an induction principle that reflects the recursive
structure of the function (see :tacn:`function induction`) and its fixpoint equality.
- The meaning of this declaration is to define a function ident,
- similarly to ``Fixpoint``. Like in ``Fixpoint``, the decreasing argument must
+ This defines a function similar to those defined by :cmd:`Fixpoint`.
+ As in :cmd:`Fixpoint`, the decreasing argument must
be given (unless the function is not recursive), but it might not
- necessarily be *structurally* decreasing. The point of the :n:`{ @fixannot }` annotation
- is to name the decreasing argument *and* to describe which kind of
- decreasing criteria must be used to ensure termination of recursive
+ necessarily be *structurally* decreasing. Use the :n:`@fixannot` clause
+ to name the decreasing argument *and* to describe which kind of
+ decreasing criteria to use to ensure termination of recursive
calls.
-The ``Function`` construction also enjoys the ``with`` extension to define
-mutually recursive definitions. However, this feature does not work
-for non structurally recursive functions.
-
-See the documentation of functional induction (:tacn:`function induction`)
-and ``Functional Scheme`` (:ref:`functional-scheme`) for how to use
-the induction principle to easily reason about the function.
+ :cmd:`Function` also supports the :n:`with` clause to create
+ mutually recursive definitions, however this feature is limited
+ to structurally recursive functions (i.e. when :n:`@fixannot` is a :n:`struct`
+ clause).
+
+ See :tacn:`function induction` and :cmd:`Functional Scheme` for how to use
+ the induction principle to reason easily about the function.
+
+ The form of the :n:`@fixannot` clause determines which definition mechanism :cmd:`Function` uses.
+ (Note that references to :n:`ident` below refer to the name of the function being defined.):
+
+ * If :n:`@fixannot` is not specified, :cmd:`Function`
+ defines the nonrecursive function :token:`ident` as if it was declared with
+ :cmd:`Definition`. In addition, the following are defined:
+
+ + :token:`ident`\ ``_rect``, :token:`ident`\ ``_rec`` and :token:`ident`\ ``_ind``,
+ which reflect the pattern matching structure of :token:`term` (see :cmd:`Inductive`);
+ + The inductive :n:`R_@ident` corresponding to the graph of :token:`ident` (silently);
+ + :token:`ident`\ ``_complete`` and :token:`ident`\ ``_correct`` which
+ are inversion information linking the function and its graph.
+
+ * If :n:`{ struct ... }` is specified, :cmd:`Function`
+ defines the structural recursive function :token:`ident` as if it was declared
+ with :cmd:`Fixpoint`. In addition, the following are defined:
+
+ + The same objects as above;
+ + The fixpoint equation of :token:`ident`: :n:`@ident`\ ``_equation``.
+
+ * If :n:`{ measure ... }` or :n:`{ wf ... }` are specified, :cmd:`Function`
+ defines a recursive function by well-founded recursion. The module ``Recdef``
+ of the standard library must be loaded for this feature.
+
+ + :n:`{measure @one_term__1 {? @ident } {? @one_term__2 } }`\: where :n:`@ident` is the decreasing argument
+ and :n:`@one_term__1` is a function from the type of :n:`@ident` to :g:`nat` for which
+ the decreasing argument decreases (for the :g:`lt` order on :g:`nat`)
+ for each recursive call of the function. The parameters of the function are
+ bound in :n:`@one_term__1`.
+ + :n:`{wf @one_term @ident }`\: where :n:`@ident` is the decreasing argument and
+ :n:`@one_term` is an ordering relation on the type of :n:`@ident` (i.e. of type
+ `T`\ :math:`_{\sf ident}` → `T`\ :math:`_{\sf ident}` → ``Prop``) for which the decreasing argument
+ decreases for each recursive call of the function. The order must be well-founded.
+ The parameters of the function are bound in :n:`@one_term`.
+
+ If the clause is ``measure`` or ``wf``, the user is left with some proof
+ obligations that will be used to define the function. These proofs
+ are: proofs that each recursive call is actually decreasing with
+ respect to the given criteria, and (if the criteria is `wf`) a proof
+ that the ordering relation is well-founded. Once proof obligations are
+ discharged, the following objects are defined:
+
+ + The same objects as with the ``struct`` clause;
+ + The lemma :n:`@ident`\ ``_tcc`` which collects all proof obligations in one
+ property;
+ + The lemmas :n:`@ident`\ ``_terminate`` and :n:`@ident`\ ``_F`` which will be inlined
+ during extraction of :n:`@ident`.
+
+ The way this recursive function is defined is the subject of several
+ papers by Yves Bertot and Antonia Balaa on the one hand, and Gilles
+ Barthe, Julien Forest, David Pichardie, and Vlad Rusu on the other
+ hand.
.. note::
@@ -651,7 +710,7 @@ the induction principle to easily reason about the function.
:token:`term` must be built as a *pure pattern matching tree* (:g:`match … with`)
with applications only *at the end* of each branch.
-Function does not support partial application of the function being
+:cmd:`Function` does not support partial application of the function being
defined. Thus, the following example cannot be accepted due to the
presence of partial application of :g:`wrong` in the body of :g:`wrong`:
@@ -684,7 +743,7 @@ terminating functions.
will not be generated. This error happens generally when:
- the definition uses pattern matching on dependent types,
- which ``Function`` cannot deal with yet.
+ which :cmd:`Function` cannot deal with yet.
- the definition is not a *pattern matching tree* as explained above.
.. warn:: Cannot define principle(s) for @ident.
@@ -698,65 +757,6 @@ terminating functions.
.. seealso:: :ref:`functional-scheme` and :tacn:`function induction`
-Depending on the ``{…}`` annotation, different definition mechanisms are
-used by ``Function``. A more precise description is given below.
-
-.. cmdv:: Function @ident {* @binder } : @type := @term
-
- Defines the nonrecursive function :token:`ident` as if it was declared with
- :cmd:`Definition`. Moreover the following are defined:
-
- + :token:`ident`\ ``_rect``, :token:`ident`\ ``_rec`` and :token:`ident`\ ``_ind``,
- which reflect the pattern matching structure of :token:`term` (see :cmd:`Inductive`);
- + The inductive :n:`R_@ident` corresponding to the graph of :token:`ident` (silently);
- + :token:`ident`\ ``_complete`` and :token:`ident`\ ``_correct`` which
- are inversion information linking the function and its graph.
-
-.. cmdv:: Function @ident {* @binder } { struct @ident } : @type := @term
-
- Defines the structural recursive function :token:`ident` as if declared
- with :cmd:`Fixpoint`. Moreover the following are defined:
-
- + The same objects as above;
- + The fixpoint equation of :token:`ident`: :token:`ident`\ ``_equation``.
-
-.. cmdv:: Function @ident {* @binder } { measure @term @ident } : @type := @term
- Function @ident {* @binder } { wf @term @ident } : @type := @term
-
- Defines a recursive function by well-founded recursion. The module ``Recdef``
- of the standard library must be loaded for this feature. The ``{}``
- annotation is mandatory and must be one of the following:
-
- + :n:`{measure @term @ident }` with :token:`ident` being the decreasing argument
- and :token:`term` being a function from type of :token:`ident` to :g:`nat` for which
- value on the decreasing argument decreases (for the :g:`lt` order on :g:`nat`)
- at each recursive call of :token:`term`. Parameters of the function are
- bound in :token:`term`;
- + :n:`{wf @term @ident }` with :token:`ident` being the decreasing argument and
- :token:`term` an ordering relation on the type of :token:`ident` (i.e. of type
- `T`\ :math:`_{\sf ident}` → `T`\ :math:`_{\sf ident}` → ``Prop``) for which the decreasing argument
- decreases at each recursive call of :token:`term`. The order must be well-founded.
- Parameters of the function are bound in :token:`term`.
-
- If the annotation is ``measure`` or ``fw``, the user is left with some proof
- obligations that will be used to define the function. These proofs
- are: proofs that each recursive call is actually decreasing with
- respect to the given criteria, and (if the criteria is `wf`) a proof
- that the ordering relation is well-founded. Once proof obligations are
- discharged, the following objects are defined:
-
- + The same objects as with the struct;
- + The lemma `ident`\ :math:`_{\sf tcc}` which collects all proof obligations in one
- property;
- + The lemmas `ident`\ :math:`_{\sf terminate}` and `ident`\ :math:`_{\sf F}` which is needed to be inlined
- during extraction of ident.
-
- The way this recursive function is defined is the subject of several
- papers by Yves Bertot and Antonia Balaa on the one hand, and Gilles
- Barthe, Julien Forest, David Pichardie, and Vlad Rusu on the other
- hand. Remark: Proof obligations are presented as several subgoals
- belonging to a Lemma `ident`\ :math:`_{\sf tcc}`.
-
.. _section-mechanism:
Section mechanism
@@ -811,43 +811,44 @@ Sections create local contexts which can be shared across multiple definitions.
.. cmd:: End @ident
- This command closes the section named :token:`ident`. After closing of the
- section, the local declarations (variables and local definitions, see :cmd:`Variable`) get
+ This command closes the section or module named :token:`ident`.
+ See :ref:`Terminating an interactive module or module type definition<terminating_module>`
+ for a description of its use with modules.
+
+ After closing the
+ section, the local declarations (variables and local definitions, see :cmd:`Variable`) are
*discharged*, meaning that they stop being visible and that all global
objects defined in the section are generalized with respect to the
variables and local definitions they each depended on in the section.
- .. exn:: This is not the last opened section.
+ .. exn:: There is nothing to end.
:undocumented:
+ .. exn:: Last block to end has name @ident.
+ :undocumented:
+
.. note::
Most commands, like :cmd:`Hint`, :cmd:`Notation`, option management, … which
appear inside a section are canceled when the section is closed.
-.. cmd:: Let @ident := @term
-
- This command binds the value :token:`term` to the name :token:`ident` in the
- environment of the current section. The name :token:`ident` is accessible
- only within the current section. When the section is closed, all persistent
- definitions and theorems within it and depending on :token:`ident`
- will be prefixed by the let-in definition :n:`let @ident := @term in`.
-
- .. exn:: @ident already exists.
- :name: @ident already exists. (Let)
- :undocumented:
+.. cmd:: Let @ident @def_body
+ Let Fixpoint @fix_definition {* with @fix_definition }
+ Let CoFixpoint @cofix_definition {* with @cofix_definition }
+ :name: Let; Let Fixpoint; Let CoFixpoint
- .. cmdv:: Let @ident {* @binder } {? : @type } := @term
- :undocumented:
+ These commands behave like :cmd:`Definition`, :cmd:`Fixpoint` and :cmd:`CoFixpoint`, except that
+ the declared constant is local to the current section.
+ When the section is closed, all persistent
+ definitions and theorems within it that depend on the constant
+ will be wrapped with a :n:`@term_let` with the same declaration.
- .. cmdv:: Let Fixpoint @ident @fix_body {* with @fix_body}
- :name: Let Fixpoint
- :undocumented:
+ As for :cmd:`Definition`, :cmd:`Fixpoint` and :cmd:`CoFixpoint`,
+ if :n:`@term` is omitted, :n:`@type` is required and Coq enters proof editing mode.
+ This can be used to define a term incrementally, in particular by relying on the :tacn:`refine` tactic.
+ In this case, the proof should be terminated with :cmd:`Defined` in order to define a constant
+ for which the computational behavior is relevant. See :ref:`proof-editing-mode`.
- .. cmdv:: Let CoFixpoint @ident @fix_body {* with @fix_body}
- :name: Let CoFixpoint
- :undocumented:
-
-.. cmd:: Context {* @binder }
+.. cmd:: Context {+ @binder }
Declare variables in the context of the current section, like :cmd:`Variable`,
but also allowing implicit variables, :ref:`implicit-generalization`, and
@@ -867,255 +868,297 @@ Module system
The module system provides a way of packaging related elements
together, as well as a means of massive abstraction.
- .. productionlist:: modules
- module_type : `qualid`
- : `module_type` with Definition `qualid` := `term`
- : `module_type` with Module `qualid` := `qualid`
- : `qualid` `qualid` … `qualid`
- : !`qualid` `qualid` … `qualid`
- module_binding : ( [Import|Export] `ident` … `ident` : `module_type` )
- module_bindings : `module_binding` … `module_binding`
- module_expression : `qualid` … `qualid`
- : !`qualid` … `qualid`
- Syntax of modules
+.. cmd:: Module {? {| Import | Export } } @ident {* @module_binder } {? @of_module_type } {? := {+<+ @module_expr_inl } }
-In the syntax of module application, the ! prefix indicates that any
-`Inline` directive in the type of the functor arguments will be ignored
-(see the :cmd:`Module Type` command below).
+ .. insertprodn module_binder module_expr_inl
+ .. prodn::
+ module_binder ::= ( {? {| Import | Export } } {+ @ident } : @module_type_inl )
+ module_type_inl ::= ! @module_type
+ | @module_type {? @functor_app_annot }
+ functor_app_annot ::= [ inline at level @num ]
+ | [ no inline ]
+ module_type ::= @qualid
+ | ( @module_type )
+ | @module_type @module_expr_atom
+ | @module_type with @with_declaration
+ with_declaration ::= Definition @qualid {? @univ_decl } := @term
+ | Module @qualid := @qualid
+ module_expr_atom ::= @qualid
+ | ( {+ @module_expr_atom } )
+ of_module_type ::= : @module_type_inl
+ | {* <: @module_type_inl }
+ module_expr_inl ::= ! {+ @module_expr_atom }
+ | {+ @module_expr_atom } {? @functor_app_annot }
-.. cmd:: Module @ident
+ Defines a module named :token:`ident`. See the examples :ref:`here<module_examples>`.
- This command is used to start an interactive module named :token:`ident`.
+ The :n:`Import` and :n:`Export` flags specify whether the module should be automatically
+ imported or exported.
-.. cmdv:: Module @ident {* @module_binding}
+ Specifying :n:`{* @module_binder }` starts a functor with
+ parameters given by the :n:`@module_binder`\s. (A *functor* is a function
+ from modules to modules.)
- Starts an interactive functor with
- parameters given by module_bindings.
+ .. todo: would like to find a better term than "interactive", not very descriptive
-.. cmdv:: Module @ident : @module_type
+ :n:`@of_module_type` specifies the module type. :n:`{+ <: @module_type_inl }`
+ starts a module that satisfies each :n:`@module_type_inl`.
- Starts an interactive module specifying its module type.
+ :n:`:= {+<+ @module_expr_inl }` specifies the body of a module or functor
+ definition. If it's not specified, then the module is defined *interactively*,
+ meaning that the module is defined as a series of commands terminated with :cmd:`End`
+ instead of in a single :cmd:`Module` command.
+ Interactively defining the :n:`@module_expr_inl`\s in a series of
+ :cmd:`Include` commands is equivalent to giving them all in a single
+ non-interactive :cmd:`Module` command.
-.. cmdv:: Module @ident {* @module_binding} : @module_type
+ The ! prefix indicates that any assumption command (such as :cmd:`Axiom`) with an :n:`Inline` clause
+ in the type of the functor arguments will be ignored.
- Starts an interactive functor with parameters given by the list of
- :token:`module_bindings`, and output module type :token:`module_type`.
+ .. todo: What is an Inline directive? sb command but still unclear. Maybe referring to the
+ "inline" in functor_app_annot? or assumption_token Inline assum_list?
-.. cmdv:: Module @ident <: {+<: @module_type }
+.. cmd:: Module Type @ident {* @module_binder } {* <: @module_type_inl } {? := {+<+ @module_type_inl } }
- Starts an interactive module satisfying each :token:`module_type`.
+ Defines a module type named :n:`@ident`. See the example :ref:`here<example_def_simple_module_type>`.
- .. cmdv:: Module @ident {* @module_binding} <: {+<: @module_type }.
+ Specifying :n:`{* @module_binder }` starts a functor type with
+ parameters given by the :n:`@module_binder`\s.
- Starts an interactive functor with parameters given by the list of
- :token:`module_binding`. The output module type
- is verified against each :token:`module_type`.
+ :n:`:= {+<+ @module_type_inl }` specifies the body of a module or functor type
+ definition. If it's not specified, then the module type is defined *interactively*,
+ meaning that the module type is defined as a series of commands terminated with :cmd:`End`
+ instead of in a single :cmd:`Module Type` command.
+ Interactively defining the :n:`@module_type_inl`\s in a series of
+ :cmd:`Include` commands is equivalent to giving them all in a single
+ non-interactive :cmd:`Module Type` command.
-.. cmdv:: Module {| Import | Export }
+.. _terminating_module:
- Behaves like :cmd:`Module`, but automatically imports or exports the module.
+**Terminating an interactive module or module type definition**
-Reserved commands inside an interactive module
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Interactive modules are terminated with the :cmd:`End` command, which
+is also used to terminate :ref:`Sections<section-mechanism>`.
+:n:`End @ident` closes the interactive module or module type :token:`ident`.
+If the module type was given, the command verifies that the content of the module
+matches the module type. If the module is not a
+functor, its components (constants, inductive types, submodules etc.)
+are now available through the dot notation.
-.. cmd:: Include @module
+.. exn:: No such label @ident.
+ :undocumented:
- Includes the content of module in the current
- interactive module. Here module can be a module expression or a module
- type expression. If module is a high-order module or module type
- expression then the system tries to instantiate module by the current
- interactive module.
+.. exn:: Signature components for label @ident do not match.
+ :undocumented:
-.. cmd:: Include {+<+ @module}
+.. exn:: The field @ident is missing in @qualid.
+ :undocumented:
- is a shortcut for the commands :n:`Include @module` for each :token:`module`.
+.. |br| raw:: html
-.. cmd:: End @ident
+ <br>
- This command closes the interactive module :token:`ident`. If the module type
- was given the content of the module is matched against it and an error
- is signaled if the matching fails. If the module is basic (is not a
- functor) its components (constants, inductive types, submodules etc.)
- are now available through the dot notation.
+.. note::
- .. exn:: No such label @ident.
- :undocumented:
+ #. Interactive modules and module types can be nested.
+ #. Interactive modules and module types can't be defined inside of :ref:`sections<section-mechanism>`.
+ Sections can be defined inside of interactive modules and module types.
+ #. Hints and notations (:cmd:`Hint` and :cmd:`Notation` commands) can also appear inside interactive
+ modules and module types. Note that with module definitions like:
- .. exn:: Signature components for label @ident do not match.
- :undocumented:
+ :n:`Module @ident__1 : @module_type := @ident__2.`
- .. exn:: This is not the last opened module.
- :undocumented:
+ or
-.. cmd:: Module @ident := @module_expression
+ :n:`Module @ident__1 : @module_type.` |br|
+ :n:`Include @ident__2.` |br|
+ :n:`End @ident__1.`
- This command defines the module identifier :token:`ident` to be equal
- to :token:`module_expression`.
+ hints and the like valid for :n:`@ident__1` are the ones defined in :n:`@module_type`
+ rather then those defined in :n:`@ident__2` (or the module body).
+ #. Within an interactive module type definition, the :cmd:`Parameter` command declares a
+ constant instead of definining a new axiom (which it does when not in a module type definition).
+ #. Assumptions such as :cmd:`Axiom` that include the :n:`Inline` clause will be automatically
+ expanded when the functor is applied, except when the function application is prefixed by ``!``.
- .. cmdv:: Module @ident {* @module_binding} := @module_expression
+.. cmd:: Include @module_type_inl {* <+ @module_expr_inl }
- Defines a functor with parameters given by the list of :token:`module_binding` and body :token:`module_expression`.
+ Includes the content of module(s) in the current
+ interactive module. Here :n:`@module_type_inl` can be a module expression or a module
+ type expression. If it is a high-order module or module type
+ expression then the system tries to instantiate :n:`@module_type_inl` with the current
+ interactive module.
- .. cmdv:: Module @ident {* @module_binding} : @module_type := @module_expression
+ Including multiple modules is a single :cmd:`Include` is equivalent to including each module
+ in a separate :cmd:`Include` command.
- Defines a functor with parameters given by the list of :token:`module_binding` (possibly none), and output module type :token:`module_type`,
- with body :token:`module_expression`.
+.. cmd:: Include Type {+<+ @module_type_inl }
- .. cmdv:: Module @ident {* @module_binding} <: {+<: @module_type} := @module_expression
+ .. deprecated:: 8.3
- Defines a functor with parameters given by module_bindings (possibly none) with body :token:`module_expression`.
- The body is checked against each :n:`@module_type__i`.
+ Use :cmd:`Include` instead.
- .. cmdv:: Module @ident {* @module_binding} := {+<+ @module_expression}
+.. cmd:: Declare Module {? {| Import | Export } } @ident {* @module_binder } : @module_type_inl
- is equivalent to an interactive module where each :token:`module_expression` is included.
+ Declares a module :token:`ident` of type :token:`module_type_inl`.
-.. cmd:: Module Type @ident
+ If :n:`@module_binder`\s are specified, declares a functor with parameters given by the list of
+ :token:`module_binder`\s.
- This command is used to start an interactive module type :token:`ident`.
+.. cmd:: Import {+ @qualid }
- .. cmdv:: Module Type @ident {* @module_binding}
+ If :token:`qualid` denotes a valid basic module (i.e. its module type is a
+ signature), makes its components available by their short names.
- Starts an interactive functor type with parameters given by :token:`module_bindings`.
+ .. example::
+ .. coqtop:: reset in
-Reserved commands inside an interactive module type:
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ Module Mod.
+ Definition T:=nat.
+ Check T.
+ End Mod.
+ Check Mod.T.
-.. cmd:: Include @module
+ .. coqtop:: all
- Same as ``Include`` inside a module.
+ Fail Check T.
+ Import Mod.
+ Check T.
-.. cmd:: Include {+<+ @module}
+ Some features defined in modules are activated only when a module is
+ imported. This is for instance the case of notations (see :ref:`Notations`).
- This is a shortcut for the command :n:`Include @module` for each :token:`module`.
+ Declarations made with the :attr:`local` attribute are never imported by the :cmd:`Import`
+ command. Such declarations are only accessible through their fully
+ qualified name.
-.. cmd:: @assumption_token Inline @assums
- :name: Inline
+ .. example::
- The instance of this assumption will be automatically expanded at functor application, except when
- this functor application is prefixed by a ``!`` annotation.
+ .. coqtop:: in
-.. cmd:: End @ident
+ Module A.
+ Module B.
+ Local Definition T := nat.
+ End B.
+ End A.
+ Import A.
- This command closes the interactive module type :token:`ident`.
+ .. coqtop:: all fail
- .. exn:: This is not the last opened module type.
- :undocumented:
+ Check B.T.
-.. cmd:: Module Type @ident := @module_type
+.. cmd:: Export {+ @qualid }
+ :name: Export
- Defines a module type :token:`ident` equal to :token:`module_type`.
+ Similar to :cmd:`Import`, except that when the module containing this command
+ is imported, the :n:`{+ @qualid }` are imported as well.
- .. cmdv:: Module Type @ident {* @module_binding} := @module_type
+ .. exn:: @qualid is not a module.
+ :undocumented:
- Defines a functor type :token:`ident` specifying functors taking arguments :token:`module_bindings` and
- returning :token:`module_type`.
+ .. warn:: Trying to mask the absolute name @qualid!
+ :undocumented:
- .. cmdv:: Module Type @ident {* @module_binding} := {+<+ @module_type }
+.. cmd:: Print Module @qualid
- is equivalent to an interactive module type were each :token:`module_type` is included.
+ Prints the module type and (optionally) the body of the module :n:`@qualid`.
-.. cmd:: Declare Module @ident : @module_type
+.. cmd:: Print Module Type @qualid
- Declares a module :token:`ident` of type :token:`module_type`.
+ Prints the module type corresponding to :n:`@qualid`.
- .. cmdv:: Declare Module @ident {* @module_binding} : @module_type
+.. flag:: Short Module Printing
- Declares a functor with parameters given by the list of :token:`module_binding` and output module type
- :token:`module_type`.
+ This flag (off by default) disables the printing of the types of fields,
+ leaving only their names, for the commands :cmd:`Print Module` and
+ :cmd:`Print Module Type`.
-.. example::
+.. _module_examples:
- Let us define a simple module.
+Examples
+~~~~~~~~
- .. coqtop:: all
+.. example:: Defining a simple module interactively
- Module M.
+ .. coqtop:: in
+ Module M.
Definition T := nat.
-
Definition x := 0.
- Definition y : bool.
+ .. coqtop:: all
+ Definition y : bool.
exact true.
- Defined.
+ .. coqtop:: in
+ Defined.
End M.
-Inside a module one can define constants, prove theorems and do any
-other things that can be done in the toplevel. Components of a closed
+Inside a module one can define constants, prove theorems and do anything
+else that can be done in the toplevel. Components of a closed
module can be accessed using the dot notation:
.. coqtop:: all
Print M.x.
-A simple module type:
-
-.. coqtop:: all
-
- Module Type SIG.
-
- Parameter T : Set.
-
- Parameter x : T.
-
- End SIG.
+.. _example_def_simple_module_type:
-Now we can create a new module from M, giving it a less precise
-specification: the y component is dropped as well as the body of x.
-
-.. coqtop:: all
+.. example:: Defining a simple module type interactively
- Module N : SIG with Definition T := nat := M.
-
- Print N.T.
-
- Print N.x.
-
- Fail Print N.y.
-
-.. reset to remove N (undo in last coqtop block doesn't seem to do that), invisibly redefine M, SIG
-.. coqtop:: none reset
-
- Module M.
+ .. coqtop:: in
- Definition T := nat.
+ Module Type SIG.
+ Parameter T : Set.
+ Parameter x : T.
+ End SIG.
- Definition x := 0.
+.. _example_filter_module:
- Definition y : bool.
+.. example:: Creating a new module that omits some items from an existing module
- exact true.
+ Since :n:`SIG`, the type of the new module :n:`N`, doesn't define :n:`y` or
+ give the body of :n:`x`, which are not included in :n:`N`.
- Defined.
+ .. coqtop:: all
- End M.
+ Module N : SIG with Definition T := nat := M.
+ Print N.T.
+ Print N.x.
+ Fail Print N.y.
- Module Type SIG.
+ .. reset to remove N (undo in last coqtop block doesn't seem to do that), invisibly redefine M, SIG
+ .. coqtop:: none reset
- Parameter T : Set.
+ Module M.
+ Definition T := nat.
+ Definition x := 0.
+ Definition y : bool.
+ exact true.
+ Defined.
+ End M.
- Parameter x : T.
+ Module Type SIG.
+ Parameter T : Set.
+ Parameter x : T.
+ End SIG.
- End SIG.
-
-The definition of :g:`N` using the module type expression :g:`SIG` with
+The following definition of :g:`N` using the module type expression :g:`SIG` with
:g:`Definition T := nat` is equivalent to the following one:
-.. coqtop:: all
+.. todo: what is other definition referred to above?
+ "Module N' : SIG with Definition T := nat. End N`." is not it.
- Module Type SIG'.
+.. coqtop:: in
+ Module Type SIG'.
Definition T : Set := nat.
-
Parameter x : T.
-
End SIG'.
Module N : SIG' := M.
@@ -1124,165 +1167,58 @@ If we just want to be sure that our implementation satisfies a
given module type without restricting the interface, we can use a
transparent constraint
-.. coqtop:: all
+.. coqtop:: in
Module P <: SIG := M.
- Print P.y.
-
-Now let us create a functor, i.e. a parametric module
-
-.. coqtop:: all
-
- Module Two (X Y: SIG).
-
- Definition T := (X.T * Y.T)%type.
-
- Definition x := (X.x, Y.x).
-
- End Two.
-
-and apply it to our modules and do some computations:
-
.. coqtop:: all
- Module Q := Two M N.
-
- Eval compute in (fst Q.x + snd Q.x).
-
-In the end, let us define a module type with two sub-modules, sharing
-some of the fields and give one of its possible implementations:
-
-.. coqtop:: all
+ Print P.y.
- Module Type SIG2.
+.. example:: Creating a functor (a module with parameters)
- Declare Module M1 : SIG.
+ .. coqtop:: in
- Module M2 <: SIG.
+ Module Two (X Y: SIG).
+ Definition T := (X.T * Y.T)%type.
+ Definition x := (X.x, Y.x).
+ End Two.
- Definition T := M1.T.
+ and apply it to our modules and do some computations:
- Parameter x : T.
+ .. coqtop:: in
- End M2.
- End SIG2.
+ Module Q := Two M N.
- Module Mod <: SIG2.
+ .. coqtop:: all
- Module M1.
+ Eval compute in (fst Q.x + snd Q.x).
- Definition T := nat.
+.. example:: A module type with two sub-modules, sharing some fields
- Definition x := 1.
+ .. coqtop:: in
- End M1.
+ Module Type SIG2.
+ Declare Module M1 : SIG.
+ Module M2 <: SIG.
+ Definition T := M1.T.
+ Parameter x : T.
+ End M2.
+ End SIG2.
- Module M2 := M.
+ .. coqtop:: in
- End Mod.
+ Module Mod <: SIG2.
+ Module M1.
+ Definition T := nat.
+ Definition x := 1.
+ End M1.
+ Module M2 := M.
+ End Mod.
Notice that ``M`` is a correct body for the component ``M2`` since its ``T``
-component is equal ``nat`` and hence ``M1.T`` as specified.
-
-.. 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 :cmd:`Hint` or :cmd:`Notation` can also appear inside modules and
- module types. Note that in case of a module definition like:
-
- ::
-
- Module N : SIG := M.
-
- or::
-
- 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``.
-
-
-.. _import_qualid:
-
-.. cmd:: Import @qualid
-
- If :token:`qualid` denotes a valid basic module (i.e. its module type is a
- signature), makes its components available by their short names.
-
- .. example::
-
- .. coqtop:: reset all
-
- Module Mod.
-
- Definition T:=nat.
-
- Check T.
-
- End Mod.
-
- Check Mod.T.
-
- Fail Check T.
-
- Import Mod.
-
- Check T.
-
- Some features defined in modules are activated only when a module is
- imported. This is for instance the case of notations (see :ref:`Notations`).
-
- Declarations made with the ``Local`` flag are never imported by the :cmd:`Import`
- command. Such declarations are only accessible through their fully
- qualified name.
-
- .. example::
-
- .. coqtop:: all
-
- Module A.
-
- Module B.
-
- Local Definition T := nat.
-
- End B.
-
- End A.
-
- Import A.
-
- Fail Check B.T.
-
- .. cmdv:: Export @qualid
- :name: Export
-
- When the module containing the command ``Export`` qualid
- is imported, qualid is imported as well.
-
- .. exn:: @qualid is not a module.
- :undocumented:
-
- .. warn:: Trying to mask the absolute name @qualid!
- :undocumented:
-
-.. cmd:: Print Module @ident
-
- Prints the module type and (optionally) the body of the module :token:`ident`.
-
-.. cmd:: Print Module Type @ident
-
- Prints the module type corresponding to :token:`ident`.
-
-.. flag:: Short Module Printing
-
- This flag (off by default) disables the printing of the types of fields,
- leaving only their names, for the commands :cmd:`Print Module` and
- :cmd:`Print Module Type`.
+component is ``nat`` as specified for ``M1.T``.
Libraries and qualified names
---------------------------------
@@ -1345,7 +1281,7 @@ also each time a new declaration is added to the context. An absolute
name is called visible from a given short or partially qualified name
when this latter name is enough to denote it. This means that the
short or partially qualified name is mapped to the absolute name in
-|Coq| name table. Definitions flagged as Local are only accessible with
+|Coq| name table. Definitions with the :attr:`local` attribute are only accessible with
their fully qualified name (see :ref:`gallina-definitions`).
It may happen that a visible name is hidden by the short name or a
@@ -1412,7 +1348,7 @@ with the same physical-to-logical translation and with an empty logical prefix.
The command line option ``-R`` is a variant of ``-Q`` which has the strictly
same behavior regarding loadpaths, but which also makes the
corresponding ``.vo`` files available through their short names in a way
-not unlike the ``Import`` command (see :ref:`here <import_qualid>`). For instance, ``-R path Lib``
+similar to the :cmd:`Import` command. For instance, ``-R path Lib``
associates to the file ``/path/fOO/Bar/File.vo`` the logical name
``Lib.fOO.Bar.File``, but allows this file to be accessed through the
short names ``fOO.Bar.File,Bar.File`` and ``File``. If several files with
@@ -1601,6 +1537,12 @@ this, *a priori* and *a posteriori*.
Implicit Argument Binders
+++++++++++++++++++++++++
+.. insertprodn implicit_binders implicit_binders
+
+.. prodn::
+ implicit_binders ::= %{ {+ @name } {? : @type } %}
+ | [ {+ @name } {? : @type } ]
+
In the first setting, one wants to explicitly give the implicit
arguments of a declared object as part of its definition. To do this,
one has to surround the bindings of implicit arguments by curly
@@ -1694,48 +1636,79 @@ Declaring Implicit Arguments
-.. cmd:: Arguments @qualid {* {| [ @name ] | { @name } | @name } }
- :name: Arguments (implicits)
-
- This command is used to set implicit arguments *a posteriori*,
- where the list of possibly bracketed :token:`name` is a prefix of the list of
- arguments of :token:`qualid` where the ones to be declared implicit are
- surrounded by square brackets and the ones to be declared as maximally
- inserted implicits are surrounded by curly braces.
-
- After the above declaration is issued, implicit arguments can just
- (and have to) be skipped in any expression involving an application
- of :token:`qualid`.
-
-.. cmd:: Arguments @qualid : clear implicits
- :name: Arguments (clear implicits)
-
- This command clears implicit arguments.
-
-.. cmdv:: Global Arguments @qualid {* {| [ @name ] | { @name } | @name } }
-
- This command is used to recompute the implicit arguments of
- :token:`qualid` after ending of the current section if any, enforcing the
- implicit arguments known from inside the section to be the ones
- declared by the command.
-
-.. cmdv:: Local Arguments @qualid {* {| [ @name ] | { @name } | @name } }
-
- When in a module, tell not to activate the
- implicit arguments of :token:`qualid` declared by this command to contexts that
- require the module.
-
-.. cmdv:: {? {| Global | Local } } Arguments @qualid {*, {+ {| [ @name ] | { @name } | @name } } }
+.. cmd:: Arguments @smart_qualid {* @argument_spec_block } {* , {* @more_implicits_block } } {? : {+, @arguments_modifier } }
+ :name: Arguments
+
+ .. insertprodn smart_qualid arguments_modifier
+
+ .. prodn::
+ smart_qualid ::= @qualid
+ | @by_notation
+ by_notation ::= @string {? % @ident }
+ argument_spec_block ::= @argument_spec
+ | /
+ | &
+ | ( {+ @argument_spec } ) {? % @ident }
+ | [ {+ @argument_spec } ] {? % @ident }
+ | %{ {+ @argument_spec } %} {? % @ident }
+ argument_spec ::= {? ! } @name {? % @ident }
+ more_implicits_block ::= @name
+ | [ {+ @name } ]
+ | %{ {+ @name } %}
+ arguments_modifier ::= simpl nomatch
+ | simpl never
+ | default implicits
+ | clear bidirectionality hint
+ | clear implicits
+ | clear scopes
+ | clear scopes and implicits
+ | clear implicits and scopes
+ | rename
+ | assert
+ | extra scopes
+
+ This command sets implicit arguments *a posteriori*,
+ where the list of :n:`@name`\s is a prefix of the list of
+ arguments of :n:`@smart_qualid`. Arguments in square
+ brackets are declared as implicit and arguments in curly brackets are declared as
+ maximally inserted.
+
+ After the command is issued, implicit arguments can and must be
+ omitted in any expression that applies :token:`qualid`.
+
+ This command supports the :attr:`local` and :attr:`global` attributes.
+ Default behavior is to limit the effect to the current section but also to
+ extend their effect outside the current module or library file.
+ Applying :attr:`local` limits the effect of the command to the current module if
+ it's not in a section. Applying :attr:`global` within a section extends the
+ effect outside the current sections and current module if the command occurs.
+
+ A command containing :n:`@argument_spec_block & @argument_spec_block`
+ provides :ref:`bidirectionality_hints`.
+
+ Use the :n:`@more_implicits_block` to specify multiple implicit arguments declarations
+ for names of constants, inductive types, constructors and lemmas that can only be
+ applied to a fixed number of arguments (excluding, for instance,
+ constants whose type is polymorphic).
+ The longest applicable list of implicit arguments will be used to select which
+ implicit arguments are inserted.
+ For printing, the omitted arguments are the ones of the longest list of implicit
+ arguments of the sequence. See the example :ref:`here<example_more_implicits>`.
+
+ The :n:`@arguments_modifier` values have various effects:
+
+ * :n:`clear implicits` - clears implicit arguments
+ * :n:`default implicits` - automatically determine the implicit arguments of the object.
+ See :ref:`auto_decl_implicit_args`.
+ * :n:`rename` - rename implicit arguments for the object
+ * :n:`assert` - assert that the object has the expected number of arguments with the
+ expected names. See the example here: :ref:`renaming_implicit_arguments`.
+
+.. exn:: The / modifier may only occur once.
+ :undocumented:
- For names of constants, inductive types,
- constructors, lemmas which can only be applied to a fixed number of
- arguments (this excludes for instance constants whose type is
- polymorphic), multiple implicit arguments declarations can be given.
- Depending on the number of arguments qualid is applied to in practice,
- the longest applicable list of implicit arguments is used to select
- which implicit arguments are inserted. For printing, the omitted
- arguments are the ones of the longest list of implicit arguments of
- the sequence.
+.. exn:: The & modifier may only occur once.
+ :undocumented:
.. example::
@@ -1765,40 +1738,34 @@ Declaring Implicit Arguments
Check (fun l:list (list nat) => map length l).
+.. _example_more_implicits:
+
+.. example:: Multiple implicit arguments with :n:`@more_implicits_block`
+
+ .. coqtop:: all
+
Arguments map [A B] f l, [A] B f l, A B f l.
Check (fun l => map length l = map (list nat) nat length l).
.. note::
- To know which are the implicit arguments of an object, use the
- command :cmd:`Print Implicit` (see :ref:`displaying-implicit-args`).
+ Use the :cmd:`Print Implicit` command to see the implicit arguments
+ of an object (see :ref:`displaying-implicit-args`).
+
+.. _auto_decl_implicit_args:
Automatic declaration of implicit arguments
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.. cmd:: Arguments @qualid : default implicits
- :name: Arguments (default implicits)
-
- This command tells |Coq| to automatically detect what are the implicit arguments of a
- defined object.
+ The :n:`default implicits @arguments_modifier` clause tells |Coq| to automatically determine the
+ implicit arguments of the object.
- The auto-detection is governed by flags telling if strict,
+ Auto-detection is governed by flags specifying whether strict,
contextual, or reversible-pattern implicit arguments must be
- considered or not (see :ref:`controlling-strict-implicit-args`, :ref:`controlling-strict-implicit-args`,
- :ref:`controlling-rev-pattern-implicit-args`, and also :ref:`controlling-insertion-implicit-args`).
-
- .. cmdv:: Global Arguments @qualid : default implicits
-
- Tell to recompute the
- implicit arguments of qualid after ending of the current section if
- any.
+ considered or not (see :ref:`controlling-strict-implicit-args`, :ref:`controlling-contextual-implicit-args`,
+ :ref:`controlling-rev-pattern-implicit-args` and also :ref:`controlling-insertion-implicit-args`).
- .. cmdv:: Local Arguments @qualid : default implicits
-
- When in a module, tell not to activate the implicit arguments of :token:`qualid` computed by this
- declaration to contexts that requires the module.
-
-.. example::
+.. example:: Default implicits
.. coqtop:: reset all
@@ -1955,21 +1922,12 @@ the hiding of implicit arguments for a single function application using the
Check (p (x:=a) (y:=b) r1 (z:=c) r2).
+.. _renaming_implicit_arguments:
+
Renaming implicit arguments
~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.. cmd:: Arguments @qualid {* @name} : rename
- :name: Arguments (rename)
-
- This command is used to redefine the names of implicit arguments.
-
-.. cmd:: Arguments @qualid {* @name} : assert
- :name: Arguments (assert)
-
- This command is used to assert that a given object has the expected
- number of arguments and that these arguments are named as expected.
-
-.. example:: (continued)
+.. example:: (continued) Renaming implicit arguments
.. coqtop:: all
@@ -1983,27 +1941,27 @@ Renaming implicit arguments
.. _displaying-implicit-args:
-Displaying what the implicit arguments are
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Displaying implicit arguments
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.. cmd:: Print Implicit @qualid
+.. cmd:: Print Implicit @smart_qualid
- Use this command to display the implicit arguments associated to an object,
- and to know if each of them is to be used maximally or not.
+ Displays the implicit arguments associated with an object,
+ identifying which arguments are applied maximally or not.
-Explicit displaying of implicit arguments for pretty-printing
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Displaying implicit arguments when pretty-printing
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. flag:: Printing Implicit
- By default, the basic pretty-printing rules hide the inferable implicit
+ By default, the basic pretty-printing rules hide the inferrable implicit
arguments of an application. Turn this flag on to force printing all
implicit arguments.
.. flag:: Printing Implicit Defensive
- By default, the basic pretty-printing rules display the implicit
+ By default, the basic pretty-printing rules display 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 turning this flag off.
@@ -2053,12 +2011,19 @@ applied to an unknown structure instance (an implicit argument) and a
value. The complete documentation of canonical structures can be found
in :ref:`canonicalstructures`; here only a simple example is given.
-.. cmd:: {? Local | #[local] } Canonical {? Structure } @qualid
- :name: Canonical Structure
+.. cmd:: Canonical {? Structure } @smart_qualid
+ Canonical {? Structure } @ident_decl @def_body
+ :name: Canonical Structure; _
+
+ The first form of this command declares an existing :n:`@smart_qualid` as a
+ canonical instance of a structure (a record).
+
+ The second form defines a new constant as if the :cmd:`Definition` command
+ had been used, then declares it as a canonical instance as if the first
+ form had been used on the defined object.
- This command declares :token:`qualid` as a canonical instance of a
- structure (a record). When the :g:`#[local]` attribute is given the effect
- stops at the end of the :g:`Section` containig it.
+ This command supports the :attr:`local` attribute. When used, the
+ structure is canonical only within the :cmd:`Section` containing it.
Assume that :token:`qualid` denotes an object ``(Build_struct`` |c_1| … |c_n| ``)`` in the
structure :g:`struct` of which the fields are |x_1|, …, |x_n|.
@@ -2106,9 +2071,12 @@ in :ref:`canonicalstructures`; here only a simple example is given.
If a same field occurs in several canonical structures, then
only the structure declared first as canonical is considered.
- .. note::
- To prevent a field from being involved in the inference of canonical instances,
- its declaration can be annotated with the :g:`#[canonical(false)]` attribute.
+ .. attr:: canonical(false)
+
+ To prevent a field from being involved in the inference of
+ canonical instances, its declaration can be annotated with the
+ :attr:`canonical(false)` attribute (cf. the syntax of
+ :n:`@record_field`).
.. example::
@@ -2121,12 +2089,13 @@ in :ref:`canonicalstructures`; here only a simple example is given.
See :ref:`canonicalstructures` for a more realistic example.
- .. cmdv:: {? Local | #[local] } Canonical {? Structure } @ident {? : @type } := @term
+.. attr:: canonical
- This is equivalent to a regular definition of :token:`ident` followed by the
- declaration :n:`Canonical @ident`.
+ This attribute can decorate a :cmd:`Definition` or :cmd:`Let` command.
+ It is equivalent to having a :cmd:`Canonical Structure` declaration just
+ after the command.
-.. cmd:: Print Canonical Projections {* @ident}
+.. cmd:: Print Canonical Projections {* @smart_qualid }
This displays the list of global names that are components of some
canonical structure. For each of them, the canonical structure of
@@ -2159,13 +2128,21 @@ It is possible to bind variable names to a given type (e.g. in a
development using arithmetic, it may be convenient to bind the names :g:`n`
or :g:`m` to the type :g:`nat` of natural numbers).
-.. cmd:: Implicit Types {+ @ident } : @type
+.. cmd:: Implicit {| Type | Types } @reserv_list
+ :name: Implicit Type; Implicit Types
+
+ .. insertprodn reserv_list simple_reserv
+
+ .. prodn::
+ reserv_list ::= {+ ( @simple_reserv ) }
+ | @simple_reserv
+ simple_reserv ::= {+ @ident } : @type
- The effect of the command is to automatically set the type of bound
+ Sets the type of bound
variables starting with :token:`ident` (either :token:`ident` itself or
:token:`ident` followed by one or more single quotes, underscore or
- digits) to be :token:`type` (unless the bound variable is already declared
- with an explicit type in which case, this latter type is considered).
+ digits) to :token:`type` (unless the bound variable is already declared
+ with an explicit type, in which case, that type will be used).
.. example::
@@ -2181,14 +2158,6 @@ or :g:`m` to the type :g:`nat` of natural numbers).
Lemma cons_inj_bool : forall (m n:bool) l, n :: l = m :: l -> n = m.
Abort.
-.. cmdv:: Implicit Type @ident : @type
-
- This is useful for declaring the implicit type of a single variable.
-
-.. cmdv:: Implicit Types {+ ( {+ @ident } : @type ) }
-
- Adds blocks of implicit types with different specifications.
-
.. flag:: Printing Use Implicit Types
By default, the type of bound variables is not printed when
@@ -2208,9 +2177,21 @@ Implicit generalization
.. index:: `[! ]
.. index:: `(! )
+.. insertprodn generalizing_binder typeclass_constraint
+
+.. prodn::
+ generalizing_binder ::= `( {+, @typeclass_constraint } )
+ | `%{ {+, @typeclass_constraint } %}
+ | `[ {+, @typeclass_constraint } ]
+ typeclass_constraint ::= {? ! } @term
+ | %{ @name %} : {? ! } @term
+ | @name : {? ! } @term
+
+
Implicit generalization is an automatic elaboration of a statement
with free variables into a closed statement where these variables are
-quantified explicitly.
+quantified explicitly. Use the :cmd:`Generalizable` command to designate
+which variables should be generalized.
It is activated for a binder by prefixing a \`, and for terms by
surrounding it with \`{ }, or \`[ ] or \`( ).
@@ -2272,31 +2253,26 @@ Multiple binders can be merged using ``,`` as a separator:
Check (forall `{Commutative A, Hnat : !Commutative nat}, True).
-One can control the set of generalizable identifiers with
-the ``Generalizable`` vernacular command to avoid unexpected
-generalizations when mistyping identifiers. There are several commands
-that specify which variables should be generalizable.
-
-.. cmd:: Generalizable All Variables
-
- All variables are candidate for
- generalization if they appear free in the context under a
- generalization delimiter. This may result in confusing errors in case
- of typos. In such cases, the context will probably contain some
- unexpected generalized variable.
+.. cmd:: Generalizable {| {| Variable | Variables } {+ @ident } | All Variables | No Variables }
-.. cmd:: Generalizable No Variables
+ Controls the set of generalizable identifiers. By default, no variables are
+ generalizable.
- Disable implicit generalization entirely. This is the default behavior.
+ This command supports the :attr:`global` attribute.
-.. cmd:: Generalizable {| Variable | Variables } {+ @ident }
+ The :n:`{| Variable | Variables } {+ @ident }` form allows generalization of only the given :n:`@ident`\s.
+ Using this command multiple times adds to the allowed identifiers. The other forms clear
+ the list of :n:`@ident`\s.
- Allow generalization of the given identifiers only. Calling this command multiple times
- adds to the allowed identifiers.
+ The :n:`All Variables` form generalizes all free variables in
+ the context that appear under a
+ generalization delimiter. This may result in confusing errors in case
+ of typos. In such cases, the context will probably contain some
+ unexpected generalized variables.
-.. cmd:: Global Generalizable
+ The :n:`No Variables` form disables implicit generalization entirely. This is
+ the default behavior (before any :cmd:`Generalizable` command has been entered).
- Allows exporting the choice of generalizable variables.
.. _Coercions:
@@ -2308,7 +2284,7 @@ which they reside into another one. A *class* is either a sort
(denoted by the keyword ``Sortclass``), a product type (denoted by the
keyword ``Funclass``), or a type constructor (denoted by its name), e.g.
an inductive type or any constant with a type of the form
-``forall (`` |x_1| : |A_1| ) … ``(``\ |x_n| : |A_n|\ ``)``, `s` where `s` is a sort.
+:n:`forall {+ @binder }, @sort`.
Then the user is able to apply an object that is not a function, but
can be coerced to a function, and more generally to consider that a
@@ -2350,43 +2326,36 @@ Printing universes
terms apparently identical but internally different in the Calculus of Inductive
Constructions.
-.. cmd:: Print {? Sorted} Universes
+.. cmd:: Print {? Sorted } Universes {? Subgraph ( {* @qualid } ) } {? @string }
:name: Print Universes
This command can be used to print the constraints on the internal level
of the occurrences of :math:`\Type` (see :ref:`Sorts`).
- If the ``Sorted`` keyword is present, each universe will be made
+ The :n:`Subgraph` clause limits the printed graph to the requested names (adjusting
+ constraints to preserve the implied transitive constraints between
+ kept universes).
+
+ The :n:`Sorted` clause makes each universe
equivalent to a numbered label reflecting its level (with a linear
ordering) in the universe hierarchy.
- .. cmdv:: Print {? Sorted} Universes @string
-
- This variant accepts an optional output filename.
-
- If :token:`string` ends in ``.dot`` or ``.gv``, the constraints are printed in the DOT
- language, and can be processed by Graphviz tools. The format is
- unspecified if `string` doesn’t end in ``.dot`` or ``.gv``.
-
-.. cmdv:: Print Universes Subgraph({+ @qualid })
- :name: Print Universes Subgraph
-
- Prints the graph restricted to the requested names (adjusting
- constraints to preserve the implied transitive constraints between
- kept universes).
+ :n:`@string` is an optional output filename.
+ If :n:`@string` ends in ``.dot`` or ``.gv``, the constraints are printed in the DOT
+ language, and can be processed by Graphviz tools. The format is
+ unspecified if `string` doesn’t end in ``.dot`` or ``.gv``.
.. _existential-variables:
Existential variables
---------------------
-.. insertprodn term_evar evar_binding
+.. insertprodn term_evar term_evar
.. prodn::
term_evar ::= ?[ @ident ]
| ?[ ?@ident ]
- | ?@ident {? @%{ {+; @evar_binding } %} }
- evar_binding ::= @ident := @term
+ | ?@ident {? @%{ {+; @ident := @term } %} }
|Coq| terms can include existential variables which represents unknown
subterms to eventually be replaced by actual subterms.
@@ -2578,6 +2547,8 @@ values (of type :g:`float`) written in hexadecimal notation and
wrapped into the :g:`Float64.of_float` constructor, e.g.:
:g:`Float64.of_float (0x1p+0)`.
+.. _bidirectionality_hints:
+
Bidirectionality hints
----------------------
@@ -2588,15 +2559,14 @@ Bidirectionality hints make it possible to specify that after type-checking the
first arguments of an application, typing information should be propagated from
the context to help inferring the types of the remaining arguments.
-.. cmd:: Arguments @qualid {* @ident__1 } & {* @ident__2}
- :name: Arguments (bidirectionality hints)
-
- This commands tells the typechecking algorithm, when type-checking
- applications of :n:`@qualid`, to first type-check the arguments in
- :n:`@ident__1` and then propagate information from the typing context to
- type-check the remaining arguments (in :n:`@ident__2`).
+An :cmd:`Arguments` command containing :n:`@argument_spec_block__1 & @argument_spec_block__2`
+provides :ref:`bidirectionality_hints`.
+It tells the typechecking algorithm, when type-checking
+applications of :n:`@qualid`, to first type-check the arguments in
+:n:`@argument_spec_block__1` and then propagate information from the typing context to
+type-check the remaining arguments (in :n:`@argument_spec_block__2`).
-.. example::
+.. example:: Bidirectionality hints
In a context where a coercion was declared from ``bool`` to ``nat``:
diff --git a/doc/sphinx/language/gallina-specification-language.rst b/doc/sphinx/language/gallina-specification-language.rst
index 4f0cf5f815..f4592f8f37 100644
--- a/doc/sphinx/language/gallina-specification-language.rst
+++ b/doc/sphinx/language/gallina-specification-language.rst
@@ -117,7 +117,7 @@ Other tokens
! #[ % & ' ( () (bfs) (dfs) ) * ** + , - ->
. .( .. ... / : ::= := :> :>> ; < <+ <- <:
- <<: <= = => > >-> >= ? @ @{ [ [= ] _ _eqn
+ <<: <= = => > >-> >= ? @ @{ [ [= ] _
`( `{ { {| | |- || }
When multiple tokens match the beginning of a sequence of characters,
@@ -290,7 +290,7 @@ More on sorts can be found in Section :ref:`sorts`.
Binders
-------
-.. insertprodn open_binders typeclass_constraint
+.. insertprodn open_binders binder
.. prodn::
open_binders ::= {+ @name } : @term
@@ -300,16 +300,10 @@ Binders
binder ::= @name
| ( {+ @name } : @type )
| ( @name {? : @type } := @term )
+ | @implicit_binders
+ | @generalizing_binder
| ( @name : @type %| @term )
- | %{ {+ @name } {? : @type } %}
- | [ {+ @name } {? : @type } ]
- | `( {+, @typeclass_constraint } )
- | `%{ {+, @typeclass_constraint } %}
- | `[ {+, @typeclass_constraint } ]
| ' @pattern0
- typeclass_constraint ::= {? ! } @term
- | %{ @name %} : {? ! } @term
- | @name : {? ! } @term
Various constructions such as :g:`fun`, :g:`forall`, :g:`fix` and :g:`cofix`
*bind* variables. A binding is represented by an identifier. If the binding
@@ -620,6 +614,10 @@ The association of a single fixpoint and a local definition have a special
syntax: :n:`let fix @ident {* @binder } := @term in` stands for
:n:`let @ident := fix @ident {* @binder } := @term in`. The same applies for co-fixpoints.
+Some options of :n:`@fixannot` are only supported in specific constructs. :n:`fix` and :n:`let fix`
+only support the :n:`struct` option, while :n:`wf` and :n:`measure` are only supported in
+commands such as :cmd:`Function` and :cmd:`Program Fixpoint`.
+
.. insertprodn term_cofix cofix_body
.. prodn::
@@ -646,7 +644,7 @@ The Vernacular
The top-level input to |Coq| is a series of :production:`command`\s and :production:`tactic`\s,
each terminated with a period
and optionally decorated with :ref:`gallina-attributes`. :n:`@ltac_expr` syntax supports both simple
-and compound tactics. For example: ``split.`` is a simple tactic while ``split; auto.`` combines two
+and compound tactics. For example: ``split`` is a simple tactic while ``split; auto`` combines two
simple tactics.
Tactics specify how to transform the current proof state as a step in creating a proof. They
@@ -706,6 +704,8 @@ has type :n:`@type`.
is closed, the :n:`@ident`\(s) become undefined and every object depending on them will be explicitly
parameterized (i.e., the variables are *discharged*). See Section :ref:`section-mechanism`.
+ The :n:`Inline` clause is only relevant inside functors. See :cmd:`Module`.
+
.. example:: Simple assumptions
.. coqtop:: reset in
@@ -767,8 +767,12 @@ Section :ref:`typing-rules`.
If :n:`@reduce` is present then :n:`@ident` is bound to the result of the specified
computation on :n:`@term`.
- If :n:`@term` is omitted, Coq enters the proof editing mode. This can be
- used to define a term incrementally, in particular by relying on the :tacn:`refine` tactic.
+ These commands also support the :attr:`universes(polymorphic)`,
+ :attr:`universes(monomorphic)`, :attr:`program` and
+ :attr:`canonical` attributes.
+
+ If :n:`@term` is omitted, :n:`@type` is required and Coq enters proof editing mode.
+ This can be used to define a term incrementally, in particular by relying on the :tacn:`refine` tactic.
In this case, the proof should be terminated with :cmd:`Defined` in order to define a constant
for which the computational behavior is relevant. See :ref:`proof-editing-mode`.
@@ -795,17 +799,13 @@ Inductive types
.. cmd:: Inductive @inductive_definition {* with @inductive_definition }
- .. insertprodn inductive_definition field_body
+ .. insertprodn inductive_definition constructor
.. prodn::
inductive_definition ::= {? > } @ident_decl {* @binder } {? %| {* @binder } } {? : @type } {? := {? @constructors_or_record } } {? @decl_notations }
constructors_or_record ::= {? %| } {+| @constructor }
- | {? @ident } %{ {+; @record_field } %}
+ | {? @ident } %{ {*; @record_field } %}
constructor ::= @ident {* @binder } {? @of_type }
- record_field ::= {* #[ {*, @attr } ] } @name {? @field_body } {? %| @num } {? @decl_notations }
- field_body ::= {* @binder } @of_type
- | {* @binder } @of_type := @term
- | {* @binder } := @term
This command defines one or more
inductive types and its constructors. Coq generates destructors
@@ -821,9 +821,11 @@ Inductive types
may be impossible to derive (for example, when :n:`@ident` is a
proposition).
- This command supports the :attr:`universes(polymorphic)`, :attr:`universes(monomorphic)`,
- :attr:`universes(template)`, :attr:`universes(notemplate)`,
- :attr:`Cumulative`, :attr:`NonCumulative` and :attr:`Private` attributes.
+ This command supports the :attr:`universes(polymorphic)`,
+ :attr:`universes(monomorphic)`, :attr:`universes(template)`,
+ :attr:`universes(notemplate)`, :attr:`universes(cumulative)`,
+ :attr:`universes(noncumulative)` and :attr:`private(matching)`
+ attributes.
Mutually inductive types can be defined by including multiple :n:`@inductive_definition`\s.
The :n:`@ident`\s are simultaneously added to the environment before the types of constructors are checked.
@@ -851,16 +853,16 @@ Inductive types
:n:`@ident` being defined (or :n:`@ident` applied to arguments in
the case of annotated inductive types — cf. next section).
-The following subsections show examples of simple inductive types, simple annotated
-inductive types, simple parametric inductive types and mutually inductive
-types.
+The following subsections show examples of simple inductive types,
+simple annotated inductive types, simple parametric inductive types,
+mutually inductive types and private (matching) inductive types.
.. _simple-inductive-types:
Simple inductive types
~~~~~~~~~~~~~~~~~~~~~~
-A simple inductive type belongs to a universe that is a simple :n:`sort`.
+A simple inductive type belongs to a universe that is a simple :n:`@sort`.
.. example::
@@ -1122,19 +1124,51 @@ Mutually defined inductive types
A generic command :cmd:`Scheme` is useful to build automatically various
mutual induction principles.
+Private (matching) inductive types
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. attr:: private(matching)
+
+ This attribute can be used to forbid the use of the :g:`match`
+ construct on objects of this inductive type outside of the module
+ where it is defined. There is also a legacy syntax using the
+ ``Private`` prefix (cf. :n:`@legacy_attr`).
+
+ The main use case of private (matching) inductive types is to emulate
+ quotient types / higher-order inductive types in projects such as
+ the `HoTT library <https://github.com/HoTT/HoTT>`_.
+
+.. example::
+
+ .. coqtop:: all
+
+ Module Foo.
+ #[ private(matching) ] Inductive my_nat := my_O : my_nat | my_S : my_nat -> my_nat.
+ Check (fun x : my_nat => match x with my_O => true | my_S _ => false end).
+ End Foo.
+ Import Foo.
+ Fail Check (fun x : my_nat => match x with my_O => true | my_S _ => false end).
+
Variants
~~~~~~~~
-.. cmd:: Variant @inductive_definition {* with @inductive_definition }
+.. cmd:: Variant @variant_definition {* with @variant_definition }
+
+ .. insertprodn variant_definition variant_definition
+
+ .. prodn::
+ variant_definition ::= @ident_decl {* @binder } {? %| {* @binder } } {? : @type } := {? %| } {+| @constructor } {? @decl_notations }
- The :cmd:`Variant` command is identical to the :cmd:`Inductive` command, except
+ The :cmd:`Variant` command is similar to the :cmd:`Inductive` command, except
that it disallows recursive definition of types (for instance, lists cannot
be defined using :cmd:`Variant`). No induction scheme is generated for
this variant, unless the :flag:`Nonrecursive Elimination Schemes` flag is on.
- This command supports the :attr:`universes(polymorphic)`, :attr:`universes(monomorphic)`,
- :attr:`universes(template)`, :attr:`universes(notemplate)`,
- :attr:`Cumulative`, :attr:`NonCumulative` and :attr:`Private` attributes.
+ This command supports the :attr:`universes(polymorphic)`,
+ :attr:`universes(monomorphic)`, :attr:`universes(template)`,
+ :attr:`universes(notemplate)`, :attr:`universes(cumulative)`,
+ :attr:`universes(noncumulative)` and :attr:`private(matching)`
+ attributes.
.. exn:: The @num th argument of @ident must be @ident in @type.
:undocumented:
@@ -1160,9 +1194,11 @@ of the type.
type, since such principles only make sense for inductive types.
For co-inductive types, the only elimination principle is case analysis.
- This command supports the :attr:`universes(polymorphic)`, :attr:`universes(monomorphic)`,
- :attr:`universes(template)`, :attr:`universes(notemplate)`,
- :attr:`Cumulative`, :attr:`NonCumulative` and :attr:`Private` attributes.
+ This command supports the :attr:`universes(polymorphic)`,
+ :attr:`universes(monomorphic)`, :attr:`universes(template)`,
+ :attr:`universes(notemplate)`, :attr:`universes(cumulative)`,
+ :attr:`universes(noncumulative)` and :attr:`private(matching)`
+ attributes.
.. example::
@@ -1284,7 +1320,7 @@ constructions.
consequently :n:`forall {* @binder }, @type` and its value is equivalent
to :n:`fun {* @binder } => @term`.
- To be accepted, a :cmd:`Fixpoint` definition has to satisfy some syntactical
+ To be accepted, a :cmd:`Fixpoint` definition has to satisfy syntactical
constraints on a special argument called the decreasing argument. They
are needed to ensure that the :cmd:`Fixpoint` definition always terminates.
The point of the :n:`{struct @ident}` annotation (see :n:`@fixannot`) is to
@@ -1294,11 +1330,14 @@ constructions.
system successively tries arguments from left to right until it finds one
that satisfies the decreasing condition.
+ :cmd:`Fixpoint` without the :attr:`program` attribute does not support the
+ :n:`wf` or :n:`measure` clauses of :n:`@fixannot`.
+
The :n:`with` clause allows simultaneously defining several mutual fixpoints.
It is especially useful when defining functions over mutually defined
inductive types. Example: :ref:`Mutual Fixpoints<example_mutual_fixpoints>`.
- If :n:`@term` is omitted, :n:`@type` is required and Coq enters the proof editing mode.
+ If :n:`@term` is omitted, :n:`@type` is required and Coq enters proof editing mode.
This can be used to define a term incrementally, in particular by relying on the :tacn:`refine` tactic.
In this case, the proof should be terminated with :cmd:`Defined` in order to define a constant
for which the computational behavior is relevant. See :ref:`proof-editing-mode`.
@@ -1455,7 +1494,7 @@ Definitions of recursive objects in co-inductive types
As in the :cmd:`Fixpoint` command, the :n:`with` clause allows simultaneously
defining several mutual cofixpoints.
- If :n:`@term` is omitted, :n:`@type` is required and Coq enters the proof editing mode.
+ If :n:`@term` is omitted, :n:`@type` is required and Coq enters proof editing mode.
This can be used to define a term incrementally, in particular by relying on the :tacn:`refine` tactic.
In this case, the proof should be terminated with :cmd:`Defined` in order to define a constant
for which the computational behavior is relevant. See :ref:`proof-editing-mode`.
@@ -1483,9 +1522,6 @@ Computations
| pattern {+, @pattern_occ }
| @ident
delta_flag ::= {? - } [ {+ @smart_qualid } ]
- smart_qualid ::= @qualid
- | @by_notation
- by_notation ::= @string {? % @ident }
strategy_flag ::= {+ @red_flags }
| @delta_flag
red_flags ::= beta
@@ -1497,10 +1533,8 @@ Computations
| delta {? @delta_flag }
ref_or_pattern_occ ::= @smart_qualid {? at @occs_nums }
| @one_term {? at @occs_nums }
- occs_nums ::= {+ @num_or_var }
- | - @num_or_var {* @int_or_var }
- num_or_var ::= @num
- | @ident
+ occs_nums ::= {+ {| @num | @ident } }
+ | - {| @num | @ident } {* @int_or_var }
int_or_var ::= @int
| @ident
unfold_occ ::= @smart_qualid {? at @occs_nums }
@@ -1607,14 +1641,18 @@ the proof and adds it to the environment.
Attributes
-----------
-.. insertprodn all_attrs legacy_attrs
+.. insertprodn all_attrs legacy_attr
.. prodn::
- all_attrs ::= {* #[ {*, @attr } ] } {? @legacy_attrs }
+ all_attrs ::= {* #[ {*, @attr } ] } {* @legacy_attr }
attr ::= @ident {? @attr_value }
attr_value ::= = @string
| ( {*, @attr } )
- legacy_attrs ::= {? {| Local | Global } } {? {| Polymorphic | Monomorphic } } {? Program } {? {| Cumulative | NonCumulative } } {? Private }
+ legacy_attr ::= {| Local | Global }
+ | {| Polymorphic | Monomorphic }
+ | {| Cumulative | NonCumulative }
+ | Private
+ | Program
Attributes modify the behavior of a command or tactic.
Syntactically, most commands and tactics can be decorated with attributes, but
@@ -1623,7 +1661,7 @@ attributes not supported by the command or tactic will be flagged as errors.
The order of top-level attributes doesn't affect their meaning. ``#[foo,bar]``, ``#[bar,foo]``,
``#[foo]#[bar]`` and ``#[bar]#[foo]`` are equivalent.
-The legacy attributes (:n:`@legacy_attrs`) provide an older, alternate syntax
+The legacy attributes (:n:`@legacy_attr`) provide an older, alternate syntax
for certain attributes. They are equivalent to new attributes as follows:
================ ================================
@@ -1633,65 +1671,12 @@ Legacy attribute New attribute
`Global` :attr:`global`
`Polymorphic` :attr:`universes(polymorphic)`
`Monomorphic` :attr:`universes(monomorphic)`
-`Cumulative` none
-`NonCumulative` none
-`Private` none
+`Cumulative` :attr:`universes(cumulative)`
+`NonCumulative` :attr:`universes(noncumulative)`
+`Private` :attr:`private(matching)`
`Program` :attr:`program`
================ ================================
-Some attributes are specific to a command, and so are described with
-that command. Currently, the following attributes are recognized:
-
-.. attr:: universes(monomorphic)
- :name: universes(monomorphic)
-
- See :ref:`polymorphicuniverses`.
-
-.. attr:: universes(polymorphic)
- :name: universes(polymorphic)
-
- See :ref:`polymorphicuniverses`.
-
-.. attr:: universes(template)
- :name: universes(template)
-
- See :ref:`Template-polymorphism`
-
-.. attr:: universes(notemplate)
- :name: universes(notemplate)
-
- See :ref:`Template-polymorphism`
-
-.. attr:: program
-
- See :ref:`programs`.
-
-.. attr:: global
-
- See :ref:`controlling-locality-of-commands`.
-
-.. attr:: local
-
- See :ref:`controlling-locality-of-commands`.
-
-.. attr:: Cumulative
-
- Legacy attribute, only allowed in a polymorphic context.
- Specifies that two instances of the same inductive type (family) are convertible
- based on the universe variances; they do not need to be equal.
- See :ref:`cumulative`.
-
-.. attr:: NonCumulative
-
- Legacy attribute, only allowed in a polymorphic context.
- Specifies that two instances of the same inductive type (family) are convertible
- only if all the universes are equal.
- See :ref:`cumulative`.
-
-.. attr:: Private
-
- Legacy attribute. Documentation to be added.
-
.. attr:: deprecated ( {? since = @string , } {? note = @string } )
:name: deprecated
@@ -1703,46 +1688,24 @@ that command. Currently, the following attributes are recognized:
It can trigger the following warnings:
- .. warn:: Tactic @qualid is deprecated since @string. @string.
- :undocumented:
-
- .. warn:: Tactic Notation @qualid is deprecated since @string. @string.
- :undocumented:
-
- .. warn:: Notation @string__1 is deprecated since @string__2. @string__3.
-
- :n:`@string__1` is the actual notation, :n:`@string__2` is the version number,
- :n:`@string__3` is the note.
+ .. warn:: Tactic @qualid is deprecated since @string__since. @string__note.
+ Tactic Notation @qualid is deprecated since @string__since. @string__note.
+ Notation @string is deprecated since @string__since. @string__note.
-.. attr:: canonical
-
- This attribute can decorate a :cmd:`Definition` or :cmd:`Let` command.
- It is equivalent to having a :cmd:`Canonical Structure` declaration just
- after the command.
-
- This attribute can take the value ``false`` when decorating a record field
- declaration with the effect of preventing the field from being involved in
- the inference of canonical instances.
-
- See also :ref:`canonical-structure-declaration`.
-
-.. example::
+ :n:`@qualid` or :n:`@string` is the notation, :n:`@string__since` is the version number,
+ :n:`@string__note` is the note (usually explains the replacement).
- .. coqtop:: all reset warn
+ .. example::
- From Coq Require Program.
- #[program] Definition one : nat := S _.
- Next Obligation.
- exact O.
- Defined.
+ .. coqtop:: all reset warn
- #[deprecated(since="8.9.0", note="Use idtac instead.")]
- Ltac foo := idtac.
+ #[deprecated(since="8.9.0", note="Use idtac instead.")]
+ Ltac foo := idtac.
- Goal True.
- Proof.
+ Goal True.
+ Proof.
now foo.
- Abort.
+ Abort.
.. warn:: Unsupported attribute
diff --git a/doc/sphinx/license.rst b/doc/sphinx/license.rst
index 55c6d988f0..35837f8407 100644
--- a/doc/sphinx/license.rst
+++ b/doc/sphinx/license.rst
@@ -1,7 +1,7 @@
-License
--------
+.. note:: **License**
-This material (the Coq Reference Manual) may be distributed only subject to the
-terms and conditions set forth in the Open Publication License, v1.0 or later
-(the latest version is presently available at
-http://www.opencontent.org/openpub). Options A and B are not elected.
+ This material (the Coq Reference Manual) may be distributed only
+ subject to the terms and conditions set forth in the Open
+ Publication License, v1.0 or later (the latest version is presently
+ available at http://www.opencontent.org/openpub). Options A and B
+ are not elected.
diff --git a/doc/sphinx/practical-tools/coq-commands.rst b/doc/sphinx/practical-tools/coq-commands.rst
index 98d222e317..aa4b6edd7d 100644
--- a/doc/sphinx/practical-tools/coq-commands.rst
+++ b/doc/sphinx/practical-tools/coq-commands.rst
@@ -227,7 +227,10 @@ and ``coqtop``, unless stated otherwise:
type of the option. For flags ``Option Name`` is equivalent to
``Option Name=true``. For instance ``-set "Universe Polymorphism"``
will enable :flag:`Universe Polymorphism`. Note that the quotes are
- shell syntax, Coq does not see them.
+ shell syntax, Coq does not see them. Flags are processed after initialization
+ of the document. This includes the `Prelude` if loaded and any libraries loaded
+ through the `-l`, `-lv`, `-r`, `-re`, `-ri`, `rfrom`, `-refrom` and `-rifrom`
+ options.
:-unset *string*: As ``-set`` but used to disable options and flags.
:-compat *version*: Attempt to maintain some backward-compatibility
with a previous version.
diff --git a/doc/sphinx/practical-tools/utilities.rst b/doc/sphinx/practical-tools/utilities.rst
index 514353e39b..d61e5ddce7 100644
--- a/doc/sphinx/practical-tools/utilities.rst
+++ b/doc/sphinx/practical-tools/utilities.rst
@@ -499,6 +499,40 @@ To build, say, two targets foo.vo and bar.vo in parallel one can use
(``.PHONY`` or not) please use ``CoqMakefile.local``.
+Precompiling for ``native_compute``
++++++++++++++++++++++++++++++++++++
+
+To compile files for ``native_compute``, one can use the
+``-native-compiler yes`` option of |Coq|, for instance by putting the
+following in a :ref:`coqmakefilelocal` file:
+
+::
+
+ COQEXTRAFLAGS += -native-compiler yes
+
+The generated ``CoqMakefile`` installation target will then take care
+of installing the extra ``.coq-native`` directories.
+
+.. note::
+
+ As an alternative to modifying any file, one can set the
+ environment variable when calling ``make``:
+
+ ::
+
+ COQEXTRAFLAGS="-native-compiler yes" make
+
+ This can be useful when files cannot be modified, for instance when
+ installing via OPAM a package built with ``coq_makefile``:
+
+ ::
+
+ COQEXTRAFLAGS="-native-compiler yes" opam install coq-package
+
+.. note::
+
+ This requires all dependencies to be themselves compiled with
+ ``-native-compiler yes``.
Building a |Coq| project with Dune
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -603,470 +637,6 @@ See the man page of ``coqdep`` for more details and options.
Both Dune and ``coq_makefile`` use ``coqdep`` to compute the
dependencies among the files part of a Coq project.
-.. _coqdoc:
-
-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 |Coq| source files,
- readable for a human and not only for the proof assistant;
-#. to help the user navigate 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 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.
-
-Preformatted 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. Either the |Latex| or the HTML rule 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 asterisks at the beginning of a line
-followed by a space and the title of the section. One asterisk is a section,
-two a subsection, etc.
-
-.. 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 enclosing 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 the 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 in the file ``file`` (it will look in ``file.glob``
-by default).
-
-Identifiers from the |Coq| standard library are linked to the Coq website
-`<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 format. 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 using the 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
- the current directory (option ``-d`` does not change the filename specified
- with the 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 filenames to be processed from the 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**
-
- The 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.
-
-
-**Hyperlink 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: Recursively map physical directory dir to |Coq| logical
- directory ``coqdir`` (similarly to |Coq| option ``-R``).
- :-Q dir coqdir: Map physical directory dir to |Coq| logical
- directory ``coqdir`` (similarly to |Coq| option ``-Q``).
-
- .. note::
-
- options ``-R`` and ``-Q`` only have
- effect on the files *following* them 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 that control the parsing of comments:
-
- :--parse-comments: Parse 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**
-
-
- The default behavior is to assume ASCII 7 bit 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
---------------------------------------------
diff --git a/doc/sphinx/proof-engine/tactics.rst b/doc/sphinx/proof-engine/tactics.rst
index be185e885b..19573eee43 100644
--- a/doc/sphinx/proof-engine/tactics.rst
+++ b/doc/sphinx/proof-engine/tactics.rst
@@ -3222,7 +3222,7 @@ the conversion in hypotheses :n:`{+ @ident}`.
+ A constant can be marked to be unfolded only if applied to enough
arguments. The number of arguments required can be specified using the
- ``/`` symbol in the argument list of the :cmd:`Arguments <Arguments (implicits)>` vernacular command.
+ ``/`` symbol in the argument list of the :cmd:`Arguments` command.
.. example::
@@ -4286,7 +4286,7 @@ some incompatibilities.
:name: Firstorder Solver
The default tactic used by :tacn:`firstorder` when no rule applies is
- :g:`auto with *`, it can be reset locally or globally using this option.
+ :g:`auto with core`, it can be reset locally or globally using this option.
.. cmd:: Print Firstorder Solver
diff --git a/doc/sphinx/proof-engine/vernacular-commands.rst b/doc/sphinx/proof-engine/vernacular-commands.rst
index 4401f8fa2f..b22c5286fe 100644
--- a/doc/sphinx/proof-engine/vernacular-commands.rst
+++ b/doc/sphinx/proof-engine/vernacular-commands.rst
@@ -91,34 +91,30 @@ and tables:
Flags, options and tables are identified by a series of identifiers, each with an initial
capital letter.
-.. cmd:: {? {| Local | Global | Export } } Set @flag
+.. cmd:: Set @flag
:name: Set
- Sets :token:`flag` on. Scoping qualifiers are
- described :ref:`here <set_unset_scope_qualifiers>`.
+ Sets :token:`flag` on.
-.. cmd:: {? {| Local | Global | Export } } Unset @flag
+.. cmd:: Unset @flag
:name: Unset
- Sets :token:`flag` off. Scoping qualifiers are
- described :ref:`here <set_unset_scope_qualifiers>`.
+ Sets :token:`flag` off.
.. cmd:: Test @flag
Prints the current value of :token:`flag`.
-.. cmd:: {? {| Local | Global | Export } } Set @option {| @num | @string }
+.. cmd:: Set @option {| @num | @string }
:name: Set @option
- Sets :token:`option` to the specified value. Scoping qualifiers are
- described :ref:`here <set_unset_scope_qualifiers>`.
+ Sets :token:`option` to the specified value.
-.. cmd:: {? {| Local | Global | Export } } Unset @option
+.. cmd:: Unset @option
:name: Unset @option
- Sets :token:`option` to its default value. Scoping qualifiers are
- described :ref:`here <set_unset_scope_qualifiers>`.
+ Sets :token:`option` to its default value.
.. cmd:: Test @option
@@ -157,27 +153,37 @@ capital letter.
A synonym for :cmd:`Print Options`.
-.. _set_unset_scope_qualifiers:
+Locality attributes supported by :cmd:`Set` and :cmd:`Unset`
+````````````````````````````````````````````````````````````
+
+The :cmd:`Set` and :cmd:`Unset` commands support the :attr:`local`,
+:attr:`global` and :attr:`export` locality attributes:
+
+* no attribute: the original setting is *not* restored at the end of
+ the current module or section.
+* :attr:`local` (an alternative syntax is to use the ``Local``
+ prefix): the setting is applied within the current module or
+ section. The original value of the setting is restored at the end
+ of the current module or section.
+* :attr:`export` (an alternative syntax is to use the ``Export``
+ prefix): similar to :attr:`local`, the original value of the setting
+ is restored at the end of the current module or section. In
+ addition, if the value is set in a module, then :cmd:`Import`\-ing
+ the module sets the option or flag.
+* :attr:`global` (an alternative syntax is to use the ``Global``
+ prefix): the original setting is *not* restored at the end of the
+ current module or section. In addition, if the value is set in a
+ file, then :cmd:`Require`\-ing the file sets the option.
+
+Newly opened modules and sections inherit the current settings.
-Scope qualifiers for :cmd:`Set` and :cmd:`Unset`
-`````````````````````````````````````````````````
-
-:n:`{? {| Local | Global | Export } }`
-
-Flag and option settings can be global in scope or local to nested scopes created by
-:cmd:`Module` and :cmd:`Section` commands. There are four alternatives:
-
-* no qualifier: the original setting is *not* restored at the end of the current module or section.
-* **Local**: the setting is applied within the current scope. The original value of the option
- or flag is restored at the end of the current module or section.
-* **Global**: similar to no qualifier, the original setting is *not* restored at the end of the current
- module or section. In addition, if the value is set in a file, then :cmd:`Require`-ing
- the file sets the option.
-* **Export**: similar to **Local**, the original value of the option or flag is restored at the
- end of the current module or section. In addition, if the value is set in a file, then :cmd:`Import`-ing
- the file sets the option.
+.. note::
-Newly opened scopes inherit the current settings.
+ The use of the :attr:`global` attribute with the :cmd:`Set` and
+ :cmd:`Unset` commands is discouraged. If your goal is to define
+ project-wide settings, you should rather use the command-line
+ arguments ``-set`` and ``-unset`` for setting flags and options
+ (cf. :ref:`command-line-options`).
.. _requests-to-the-environment:
@@ -315,18 +321,6 @@ Requests to the environment
Search (?x * _ + ?x * _)%Z outside OmegaLemmas.
- .. cmdv:: SearchAbout
- :name: SearchAbout
-
- .. deprecated:: 8.5
-
- Up to |Coq| version 8.4, :cmd:`Search` had the behavior of current
- :cmd:`SearchHead` and the behavior of current :cmd:`Search` was obtained with
- command :cmd:`SearchAbout`. For compatibility, the deprecated name
- :cmd:`SearchAbout` can still be used as a synonym of :cmd:`Search`. For
- compatibility, the list of objects to search when using :cmd:`SearchAbout`
- may also be enclosed by optional ``[ ]`` delimiters.
-
.. cmd:: SearchHead @term
@@ -602,11 +596,11 @@ file is a particular case of module called *library file*.
This loads and declares the module :n:`@qualid`
and its dependencies then imports the contents of :n:`@qualid` as described
- :ref:`here <import_qualid>`. It does not import the modules on which
- qualid depends unless these modules were themselves required in module
+ for :cmd:`Import`. It does not import the modules that
+ :n:`@qualid` depends on unless these modules were themselves required in module
:n:`@qualid`
- using :cmd:`Require Export`, as described below, or recursively required
- through a sequence of :cmd:`Require Export`. If the module required has
+ using :cmd:`Require Export`, or recursively required
+ through a series of :cmd:`Require Export`. If the module required has
already been loaded, :cmd:`Require Import` :n:`@qualid` simply imports it, as
:cmd:`Import` :n:`@qualid` would.
@@ -665,13 +659,9 @@ file is a particular case of module called *library file*.
the time it was compiled.
- .. exn:: Require is not allowed inside a module or a module type.
+ .. warn:: Require inside a module is deprecated and strongly discouraged. You can Require a module at toplevel and optionally Import it inside another one.
- 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:`Import <import_qualid>`).
+ Note that the :cmd:`Import` and :cmd:`Export` commands can be used inside modules.
.. seealso:: Chapter :ref:`thecoqcommands`
@@ -927,16 +917,17 @@ Quitting and debugging
.. 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.
+ For debugging scripts, sometimes it is desirable to know whether a
+ command or a tactic fails. If the given :n:`@command` fails, then
+ :n:`Fail @command` succeeds (excepts in the case of
+ critical errors, like a "stack overflow"), without changing the
+ proof state, and in interactive mode, the system prints a message
+ confirming the failure.
.. exn:: The command has not failed!
- :undocumented:
+
+ If the given :n:`@command` succeeds, then :n:`Fail @command`
+ fails with this error message.
.. _controlling-display:
@@ -1152,49 +1143,51 @@ described first.
Controlling the locality of commands
-----------------------------------------
+.. attr:: global
+ local
-.. cmd:: Local @command
- Global @command
-
- Some commands support a Local or Global prefix modifier to control the
- scope of their effect. There are four kinds of commands:
-
+ Some commands support a :attr:`local` or :attr:`global` attribute
+ to control the scope of their effect. There is also a legacy (and
+ much more commonly used) syntax using the ``Local`` or ``Global``
+ prefixes (see :n:`@legacy_attr`). 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
+ commands, the :attr:`local` attribute limits the effect of the command to the
current section or module it occurs in. As an example, the :cmd:`Coercion`
and :cmd:`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 extend their effect outside the module or
- library file they occur in. For these commands, the Local modifier limits the
+ library file they occur in. For these commands, the :attr:`local` attribute 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
+ section and the :attr:`global` attribute extends the effect outside the current
sections and current module if the command occurs in a section. As an example,
- the :cmd:`Arguments <Arguments (implicits)>`, :cmd:`Ltac` or :cmd:`Notation` commands belong
+ the :cmd:`Arguments`, :cmd:`Ltac` or :cmd:`Notation` 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 modifier is not
+ extension of their scope outside sections at all and the :attr:`global` attribute 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
- occur in. The :cmd:`Transparent` and :cmd:`Opaque`
- (see Section :ref:`vernac-controlling-the-reduction-strategies`) commands
+ of the section or module they occur in. For these commands, the :attr:`global`
+ attribute extends their effect outside the sections and modules they
+ occur in. The :cmd:`Transparent` and :cmd:`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
+ when no section contains them. For these commands, the :attr:`local` attribute
+ limits the effect to the current section or module while the :attr:`global`
+ attribute extends the effect outside the module even when the command
occurs in a section. The :cmd:`Set` and :cmd:`Unset` commands belong to this
category.
.. attr:: export
- Some commands support an :attr:`export` attribute. The effect of the attribute
- is to make the effect of the command available when the module containing it
- is imported. The :cmd:`Hint` command accepts it for instance.
+ Some commands support an :attr:`export` attribute. The effect of
+ the attribute is to make the effect of the command available when
+ the module containing it is imported. It is supported in
+ particular by the :cmd:`Hint`, :cmd:`Set` and :cmd:`Unset`
+ commands.
.. _controlling-typing-flags:
diff --git a/doc/sphinx/proofs/automatic-tactics/index.rst b/doc/sphinx/proofs/automatic-tactics/index.rst
new file mode 100644
index 0000000000..a219770c69
--- /dev/null
+++ b/doc/sphinx/proofs/automatic-tactics/index.rst
@@ -0,0 +1,20 @@
+.. _automatic-tactics:
+
+=====================================================
+Built-in decision procedures and programmable tactics
+=====================================================
+
+Some tactics are largely automated and are able to solve complex
+goals. This chapter presents both some decision procedures that can
+be used to solve some specific categories of goals, and some
+programmable tactics, that the user can instrument to handle some
+complex goals in new domains.
+
+.. toctree::
+ :maxdepth: 1
+
+ ../../addendum/omega
+ ../../addendum/micromega
+ ../../addendum/ring
+ ../../addendum/nsatz
+ ../../addendum/generalized-rewriting
diff --git a/doc/sphinx/proofs/creating-tactics/index.rst b/doc/sphinx/proofs/creating-tactics/index.rst
new file mode 100644
index 0000000000..1af1b0b726
--- /dev/null
+++ b/doc/sphinx/proofs/creating-tactics/index.rst
@@ -0,0 +1,34 @@
+.. _writing-tactics:
+
+====================
+Creating new tactics
+====================
+
+The languages presented in this chapter allow one to build complex
+tactics by combining existing ones with constructs such as
+conditionals and looping. While :ref:`Ltac <ltac>` was initially
+thought of as a language for doing some basic combinations, it has
+been used successfully to build highly complex tactics as well, but
+this has also highlighted its limits and fragility. The experimental
+language :ref:`Ltac2 <ltac2>` is a typed and more principled variant
+which is more adapted to building complex tactics.
+
+There are other solutions beyond these two tactic languages to write
+new tactics:
+
+- `Mtac2 <https://github.com/Mtac2/Mtac2>`_ is an external plugin
+ which provides another typed tactic language. While Ltac2 belongs
+ to the ML language family, Mtac2 reuses the language of Coq itself
+ as the language to build Coq tactics.
+
+- The most traditional way of building new complex tactics is to write
+ a Coq plugin in OCaml. Beware that this also requires much more
+ effort and commitment. A tutorial for writing Coq plugins is
+ available in the Coq repository in `doc/plugin_tutorial
+ <https://github.com/coq/coq/tree/master/doc/plugin_tutorial>`_.
+
+.. toctree::
+ :maxdepth: 1
+
+ ../../proof-engine/ltac
+ ../../proof-engine/ltac2
diff --git a/doc/sphinx/proofs/writing-proofs/index.rst b/doc/sphinx/proofs/writing-proofs/index.rst
new file mode 100644
index 0000000000..a279a5957f
--- /dev/null
+++ b/doc/sphinx/proofs/writing-proofs/index.rst
@@ -0,0 +1,34 @@
+.. _writing-proofs:
+
+==============
+Writing proofs
+==============
+
+Coq is an interactive theorem prover, or proof assistant, which means
+that proofs can be constructed interactively through a dialog between
+the user and the assistant. The building blocks for this dialog are
+tactics which the user will use to represent steps in the proof of a
+theorem.
+
+Incomplete proofs have one or more open (unproven) sub-goals. Each
+goal has its own context (a set of assumptions that can be used to
+prove the goal). Tactics can transform goals and contexts.
+Internally, the incomplete proof is represented as a partial proof
+term, with holes for the unproven sub-goals.
+
+When a proof is complete, the user leaves the proof mode and defers
+the verification of the resulting proof term to the :ref:`kernel
+<core-language>`.
+
+This chapter is divided in several parts, describing the basic ideas
+of the proof mode (during which tactics can be used), and several
+flavors of tactics, including the SSReflect proof language.
+
+.. toctree::
+ :maxdepth: 1
+
+ ../../proof-engine/proof-handling
+ ../../proof-engine/tactics
+ ../../proof-engine/ssreflect-proof-language
+ ../../proof-engine/detailed-tactic-examples
+ ../../user-extensions/proof-schemes
diff --git a/doc/sphinx/refman-preamble.rst b/doc/sphinx/refman-preamble.rst
index de95eda989..05e665a43b 100644
--- a/doc/sphinx/refman-preamble.rst
+++ b/doc/sphinx/refman-preamble.rst
@@ -11,60 +11,18 @@
.. role:: smallcaps
-.. |A_1| replace:: `A`\ :math:`_{1}`
-.. |A_n| replace:: `A`\ :math:`_{n}`
-.. |arg_1| replace:: `arg`\ :math:`_{1}`
-.. |arg_n| replace:: `arg`\ :math:`_{n}`
-.. |bdi| replace:: :math:`\beta\delta\iota`
-.. |binder_1| replace:: `binder`\ :math:`_{1}`
-.. |binder_n| replace:: `binder`\ :math:`_{n}`
-.. |binders_1| replace:: `binders`\ :math:`_{1}`
-.. |binders_n| replace:: `binders`\ :math:`_{n}`
-.. |C_1| replace:: `C`\ :math:`_{1}`
.. |c_1| replace:: `c`\ :math:`_{1}`
-.. |C_2| replace:: `C`\ :math:`_{2}`
.. |c_i| replace:: `c`\ :math:`_{i}`
.. |c_n| replace:: `c`\ :math:`_{n}`
-.. |Cic| replace:: :smallcaps:`Cic`
-.. |class_1| replace:: `class`\ :math:`_{1}`
-.. |class_2| replace:: `class`\ :math:`_{2}`
+.. |Cic| replace:: CIC
.. |Coq| replace:: :smallcaps:`Coq`
.. |CoqIDE| replace:: :smallcaps:`CoqIDE`
.. |eq_beta_delta_iota_zeta| replace:: `=`\ :math:`_{\beta\delta\iota\zeta}`
.. |Gallina| replace:: :smallcaps:`Gallina`
-.. |ident_0| replace:: `ident`\ :math:`_{0}`
-.. |ident_1,1| replace:: `ident`\ :math:`_{1,1}`
-.. |ident_1,k_1| replace:: `ident`\ :math:`_{1,k_1}`)
-.. |ident_1| replace:: `ident`\ :math:`_{1}`
-.. |ident_2| replace:: `ident`\ :math:`_{2}`
-.. |ident_3| replace:: `ident`\ :math:`_{3}`
-.. |ident_i| replace:: `ident`\ :math:`_{i}`
-.. |ident_j| replace:: `ident`\ :math:`_{j}`
-.. |ident_k| replace:: `ident`\ :math:`_{k}`
-.. |ident_n,1| replace:: `ident`\ :math:`_{n,1}`
-.. |ident_n,k_n| replace:: `ident`\ :math:`_{n,k_n}`
-.. |ident_n| replace:: `ident`\ :math:`_{n}`
.. |Latex| replace:: :smallcaps:`LaTeX`
.. |L_tac| replace:: `L`:sub:`tac`
.. |Ltac| replace:: `L`:sub:`tac`
.. |ML| replace:: :smallcaps:`ML`
-.. |mod_0| replace:: `mod`\ :math:`_{0}`
-.. |mod_1| replace:: `mod`\ :math:`_{1}`
-.. |mod_2| replace:: `mod`\ :math:`_{1}`
-.. |mod_n| replace:: `mod`\ :math:`_{n}`
-.. |module_0| replace:: `module`\ :math:`_{0}`
-.. |module_1| replace:: `module`\ :math:`_{1}`
-.. |module_expression_0| replace:: `module_expression`\ :math:`_{0}`
-.. |module_expression_1| replace:: `module_expression`\ :math:`_{1}`
-.. |module_expression_i| replace:: `module_expression`\ :math:`_{i}`
-.. |module_expression_n| replace:: `module_expression`\ :math:`_{n}`
-.. |module_n| replace:: `module`\ :math:`_{n}`
-.. |module_type_0| replace:: `module_type`\ :math:`_{0}`
-.. |module_type_1| replace:: `module_type`\ :math:`_{1}`
-.. |module_type_i| replace:: `module_type`\ :math:`_{i}`
-.. |module_type_n| replace:: `module_type`\ :math:`_{n}`
-.. |N| replace:: ``N``
-.. |nat| replace:: ``nat``
.. |OCaml| replace:: :smallcaps:`OCaml`
.. |p_1| replace:: `p`\ :math:`_{1}`
.. |p_i| replace:: `p`\ :math:`_{i}`
@@ -79,24 +37,6 @@
.. |t_i| replace:: `t`\ :math:`_{i}`
.. |t_m| replace:: `t`\ :math:`_{m}`
.. |t_n| replace:: `t`\ :math:`_{n}`
-.. |f_1| replace:: `f`\ :math:`_{1}`
-.. |f_i| replace:: `f`\ :math:`_{i}`
-.. |f_m| replace:: `f`\ :math:`_{m}`
-.. |f_n| replace:: `f`\ :math:`_{n}`
-.. |u_1| replace:: `u`\ :math:`_{1}`
-.. |u_i| replace:: `u`\ :math:`_{i}`
-.. |u_m| replace:: `u`\ :math:`_{m}`
-.. |u_n| replace:: `u`\ :math:`_{n}`
-.. |term_0| replace:: `term`\ :math:`_{0}`
-.. |term_1| replace:: `term`\ :math:`_{1}`
-.. |term_2| replace:: `term`\ :math:`_{2}`
-.. |term_n| replace:: `term`\ :math:`_{n}`
-.. |type_0| replace:: `type`\ :math:`_{0}`
-.. |type_1| replace:: `type`\ :math:`_{1}`
-.. |type_2| replace:: `type`\ :math:`_{2}`
-.. |type_3| replace:: `type`\ :math:`_{3}`
-.. |type_n| replace:: `type`\ :math:`_{n}`
.. |x_1| replace:: `x`\ :math:`_{1}`
.. |x_i| replace:: `x`\ :math:`_{i}`
.. |x_n| replace:: `x`\ :math:`_{n}`
-.. |Z| replace:: ``Z``
diff --git a/doc/sphinx/refman-preamble.sty b/doc/sphinx/refman-preamble.sty
index 90a63a5a2d..629c30a793 100644
--- a/doc/sphinx/refman-preamble.sty
+++ b/doc/sphinx/refman-preamble.sty
@@ -1,32 +1,20 @@
-\newcommand{\alors}{\textsf{then}}
-\newcommand{\alter}{\textsf{alter}}
\newcommand{\as}{\kw{as}}
\newcommand{\Assum}[3]{\kw{Assum}(#1)(#2:#3)}
-\newcommand{\bool}{\textsf{bool}}
\newcommand{\case}{\kw{case}}
-\newcommand{\conc}{\textsf{conc}}
\newcommand{\cons}{\textsf{cons}}
\newcommand{\consf}{\textsf{consf}}
-\newcommand{\conshl}{\textsf{cons\_hl}}
\newcommand{\Def}[4]{\kw{Def}(#1)(#2:=#3:#4)}
\newcommand{\emptyf}{\textsf{emptyf}}
\newcommand{\End}{\kw{End}}
\newcommand{\kwend}{\kw{end}}
-\newcommand{\EqSt}{\textsf{EqSt}}
\newcommand{\even}{\textsf{even}}
\newcommand{\evenO}{\textsf{even}_\textsf{O}}
\newcommand{\evenS}{\textsf{even}_\textsf{S}}
-\newcommand{\false}{\textsf{false}}
-\newcommand{\filter}{\textsf{filter}}
\newcommand{\Fix}{\kw{Fix}}
\newcommand{\fix}{\kw{fix}}
\newcommand{\for}{\textsf{for}}
\newcommand{\forest}{\textsf{forest}}
-\newcommand{\from}{\textsf{from}}
\newcommand{\Functor}{\kw{Functor}}
-\newcommand{\haslength}{\textsf{has\_length}}
-\newcommand{\hd}{\textsf{hd}}
-\newcommand{\ident}{\textsf{ident}}
\newcommand{\In}{\kw{in}}
\newcommand{\Ind}[4]{\kw{Ind}[#2](#3:=#4)}
\newcommand{\ind}[3]{\kw{Ind}~[#1]\left(#2\mathrm{~:=~}#3\right)}
@@ -34,7 +22,6 @@
\newcommand{\Indpstr}[6]{\kw{Ind}_{#5}(#1)[#2](#3:=#4)/{#6}}
\newcommand{\injective}{\kw{injective}}
\newcommand{\kw}[1]{\textsf{#1}}
-\newcommand{\lb}{\lambda}
\newcommand{\length}{\textsf{length}}
\newcommand{\letin}[3]{\kw{let}~#1:=#2~\kw{in}~#3}
\newcommand{\List}{\textsf{list}}
@@ -45,7 +32,6 @@
\newcommand{\ModS}[2]{{\kw{Mod}}({#1}:{#2})}
\newcommand{\ModType}[2]{{\kw{ModType}}({#1}:={#2})}
\newcommand{\mto}{.\;}
-\newcommand{\Nat}{\mathbb{N}}
\newcommand{\nat}{\textsf{nat}}
\newcommand{\Nil}{\textsf{nil}}
\newcommand{\nilhl}{\textsf{nil\_hl}}
@@ -57,13 +43,10 @@
\newcommand{\ovl}[1]{\overline{#1}}
\newcommand{\Pair}{\textsf{pair}}
\newcommand{\plus}{\mathsf{plus}}
-\newcommand{\Prod}{\textsf{prod}}
\newcommand{\SProp}{\textsf{SProp}}
\newcommand{\Prop}{\textsf{Prop}}
\newcommand{\return}{\kw{return}}
\newcommand{\Set}{\textsf{Set}}
-\newcommand{\si}{\textsf{if}}
-\newcommand{\sinon}{\textsf{else}}
\newcommand{\Sort}{\mathcal{S}}
\newcommand{\Str}{\textsf{Stream}}
\newcommand{\Struct}{\kw{Struct}}
@@ -71,9 +54,7 @@
\newcommand{\tl}{\textsf{tl}}
\newcommand{\tree}{\textsf{tree}}
\newcommand{\trii}{\triangleright_\iota}
-\newcommand{\true}{\textsf{true}}
\newcommand{\Type}{\textsf{Type}}
-\newcommand{\unfold}{\textsf{unfold}}
\newcommand{\WEV}[3]{\mbox{$#1[] \vdash #2 \lra #3$}}
\newcommand{\WEVT}[3]{\mbox{$#1[] \vdash #2 \lra$}\\ \mbox{$ #3$}}
\newcommand{\WF}[2]{{\mathcal{W\!F}}(#1)[#2]}
@@ -88,4 +69,3 @@
\newcommand{\WTEG}[2]{\WTE{\Gamma}{#1}{#2}}
\newcommand{\WTM}[3]{\WT{#1}{}{#2}{#3}}
\newcommand{\zeroone}[1]{[{#1}]}
-\newcommand{\zeros}{\textsf{zeros}}
diff --git a/doc/sphinx/using/libraries/index.rst b/doc/sphinx/using/libraries/index.rst
new file mode 100644
index 0000000000..d0848e6c3f
--- /dev/null
+++ b/doc/sphinx/using/libraries/index.rst
@@ -0,0 +1,24 @@
+.. _libraries:
+
+=====================
+Libraries and plugins
+=====================
+
+Coq is distributed with a standard library and a set of internal
+plugins (most of which provide tactics that have already been
+presented in :ref:`writing-proofs`). This chapter presents this
+standard library and some of these internal plugins which provide
+features that are not tactics.
+
+In addition, Coq has a rich ecosystem of external libraries and
+plugins. These libraries and plugins can be browsed online through
+the `Coq Package Index <https://coq.inria.fr/opam/www/>`_ and
+installed with the `opam package manager
+<https://coq.inria.fr/opam-using.html>`_.
+
+.. toctree::
+ :maxdepth: 1
+
+ ../../language/coq-library
+ ../../addendum/extraction
+ ../../addendum/miscellaneous-extensions
diff --git a/doc/sphinx/using/tools/coqdoc.rst b/doc/sphinx/using/tools/coqdoc.rst
new file mode 100644
index 0000000000..cada680895
--- /dev/null
+++ b/doc/sphinx/using/tools/coqdoc.rst
@@ -0,0 +1,463 @@
+.. _coqdoc:
+
+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 |Coq| source files,
+ readable for a human and not only for the proof assistant;
+#. to help the user navigate 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 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.
+
+Preformatted 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. Either the |Latex| or the HTML rule 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 asterisks at the beginning of a line
+followed by a space and the title of the section. One asterisk is a section,
+two a subsection, etc.
+
+.. 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 enclosing 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 the 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 in the file ``file`` (it will look in ``file.glob``
+by default).
+
+Identifiers from the |Coq| standard library are linked to the Coq website
+`<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 format. 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 using the 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
+ the current directory (option ``-d`` does not change the filename specified
+ with the 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 filenames to be processed from the 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**
+
+ The 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.
+
+
+**Hyperlink 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: Recursively map physical directory dir to |Coq| logical
+ directory ``coqdir`` (similarly to |Coq| option ``-R``).
+ :-Q dir coqdir: Map physical directory dir to |Coq| logical
+ directory ``coqdir`` (similarly to |Coq| option ``-Q``).
+
+ .. note::
+
+ options ``-R`` and ``-Q`` only have
+ effect on the files *following* them 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 that control the parsing of comments:
+
+ :--parse-comments: Parse 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**
+
+
+ The default behavior is to assume ASCII 7 bit 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``.
diff --git a/doc/sphinx/using/tools/index.rst b/doc/sphinx/using/tools/index.rst
new file mode 100644
index 0000000000..dfe38dfce9
--- /dev/null
+++ b/doc/sphinx/using/tools/index.rst
@@ -0,0 +1,21 @@
+.. _tools:
+
+================================
+Command-line and graphical tools
+================================
+
+This chapter presents the command-line tools that users will need to
+build their Coq project, the documentation of the CoqIDE standalone
+user interface and the documentation of the parallel proof processing
+feature that is supported by CoqIDE and several other user interfaces.
+A list of available user interfaces to interact with Coq is available
+on the `Coq website <https://coq.inria.fr/user-interfaces.html>`_.
+
+.. toctree::
+ :maxdepth: 1
+
+ ../../practical-tools/coq-commands
+ ../../practical-tools/utilities
+ coqdoc
+ ../../practical-tools/coqide
+ ../../addendum/parallel-proof-processing
diff --git a/doc/stdlib/dune b/doc/stdlib/dune
index 093c7a62b2..0b6ca5f178 100644
--- a/doc/stdlib/dune
+++ b/doc/stdlib/dune
@@ -13,6 +13,8 @@
(rule
(targets html)
+ (alias stdlib-html)
+ (package coq-doc)
(deps
; This will be replaced soon by `theories/**/*.v` soon, thanks to rgrinberg
(source_tree %{project_root}/theories)
@@ -31,6 +33,12 @@
(progn (cat %{header}) (cat index-list.html) (cat %{footer})))
(run cp _index.html html/index.html))))
-(alias
- (name stdlib-html)
- (deps html))
+; Installable directories are not yet fully supported by Dune. See
+; ocaml/dune#1868. Yet, this makes coq-doc.install a valid target to
+; generate the whole Coq documentation. And the result under
+; _build/install/default/doc/coq-doc looks just right!
+
+(install
+ (files (html as html/stdlib))
+ (section doc)
+ (package coq-doc))
diff --git a/doc/stdlib/hidden-files b/doc/stdlib/hidden-files
index 60d6039b0f..67d0b37e81 100644
--- a/doc/stdlib/hidden-files
+++ b/doc/stdlib/hidden-files
@@ -50,6 +50,7 @@ theories/micromega/ZifyInst.v
theories/micromega/ZifyBool.v
theories/micromega/ZifyComparison.v
theories/micromega/ZifyClasses.v
+theories/micromega/ZifyPow.v
theories/micromega/Zify.v
theories/nsatz/Nsatz.v
theories/omega/Omega.v
diff --git a/doc/stdlib/index-list.html.template b/doc/stdlib/index-list.html.template
index 0f05237036..e64b4be454 100644
--- a/doc/stdlib/index-list.html.template
+++ b/doc/stdlib/index-list.html.template
@@ -528,13 +528,17 @@ through the <tt>Require Import</tt> command.</p>
</dt>
<dd>
theories/Reals/Rdefinitions.v
- theories/Reals/ConstructiveReals.v
- theories/Reals/ConstructiveRealsMorphisms.v
- theories/Reals/ConstructiveCauchyReals.v
- theories/Reals/ConstructiveCauchyRealsMult.v
+ theories/Reals/Cauchy/ConstructiveCauchyReals.v
+ theories/Reals/Cauchy/ConstructiveCauchyRealsMult.v
+ theories/Reals/Cauchy/ConstructiveCauchyAbs.v
theories/Reals/ClassicalDedekindReals.v
theories/Reals/Raxioms.v
- theories/Reals/ConstructiveRealsLUB.v
+ theories/Reals/Abstract/ConstructiveReals.v
+ theories/Reals/Abstract/ConstructiveRealsMorphisms.v
+ theories/Reals/Abstract/ConstructiveLUB.v
+ theories/Reals/Abstract/ConstructiveAbs.v
+ theories/Reals/Abstract/ConstructiveLimits.v
+ theories/Reals/Abstract/ConstructiveSum.v
theories/Reals/RIneq.v
theories/Reals/DiscrR.v
theories/Reals/ROrderedType.v
@@ -579,7 +583,7 @@ through the <tt>Require Import</tt> command.</p>
theories/Reals/Ranalysis5.v
theories/Reals/Ranalysis_reg.v
theories/Reals/Rcomplete.v
- theories/Reals/ConstructiveRcomplete.v
+ theories/Reals/Cauchy/ConstructiveRcomplete.v
theories/Reals/RiemannInt.v
theories/Reals/RiemannInt_SF.v
theories/Reals/Rpow_def.v
diff --git a/doc/stdlib/make-library-index b/doc/stdlib/make-library-index
index a51308f153..cb93a4c8cc 100755
--- a/doc/stdlib/make-library-index
+++ b/doc/stdlib/make-library-index
@@ -36,7 +36,8 @@ for k in $LIBDIRS; do
fi
else
if [ $h = 0 ]; then
- echo Warning: $k/$b.v will be hidden from the index
+ # Skipping file from the index
+ :
else
echo Error: none of $FILE and $HIDDEN mention $k/$b.v
exit 1
diff --git a/doc/tools/coqrst/coqdomain.py b/doc/tools/coqrst/coqdomain.py
index b92c94fe2c..6332c4c81d 100644
--- a/doc/tools/coqrst/coqdomain.py
+++ b/doc/tools/coqrst/coqdomain.py
@@ -34,7 +34,6 @@ from sphinx.util.logging import getLogger, get_node_location
from sphinx.directives import ObjectDescription
from sphinx.domains import Domain, ObjType, Index
from sphinx.domains.std import token_xrefs
-from sphinx.ext import mathbase
from . import coqdoc
from .repl import ansicolors
@@ -74,8 +73,7 @@ def make_target(objtype, targetid):
return "coq:{}.{}".format(objtype, targetid)
def make_math_node(latex, docname, nowrap):
- node = mathbase.displaymath()
- node['latex'] = latex
+ node = nodes.math_block(latex, latex)
node['label'] = None # Otherwise equations are numbered
node['nowrap'] = nowrap
node['docname'] = docname
@@ -339,7 +337,7 @@ class TacticNotationObject(NotationObject):
"""
subdomain = "tacn"
index_suffix = "(tactic)"
- annotation = None
+ annotation = "Tactic"
class AttributeNotationObject(NotationObject):
"""An attribute.
@@ -493,9 +491,7 @@ class ProductionObject(CoqObject):
pass
def _target_id(self, name):
- # Use `name[1]` instead of ``nodes.make_id(name[1])`` to work around
- # https://github.com/sphinx-doc/sphinx/issues/4983
- return 'grammar-token-{}'.format(name[1])
+ return 'grammar-token-{}'.format(nodes.make_id(name[1]))
def _record_name(self, name, targetid):
env = self.state.document.settings.env
@@ -523,7 +519,7 @@ class ProductionObject(CoqObject):
row = nodes.inline(classes=['prodn-row'])
entry = nodes.inline(classes=['prodn-cell-nonterminal'])
if lhs != "":
- target_name = 'grammar-token-' + lhs
+ target_name = 'grammar-token-' + nodes.make_id(lhs)
target = nodes.target('', '', ids=[target_name], names=[target_name])
# putting prodn-target on the target node won't appear in the tex file
inline = nodes.inline(classes=['prodn-target'])
diff --git a/doc/tools/docgram/README.md b/doc/tools/docgram/README.md
index 8f325f957a..4cde3809f0 100644
--- a/doc/tools/docgram/README.md
+++ b/doc/tools/docgram/README.md
@@ -1,13 +1,13 @@
# Grammar extraction tool for documentation
-`doc_grammar` extracts Coq's grammar from `.mlg` files, edits it and
-inserts it in chunks into `.rst` files. The tool currently inserts
-Sphinx `productionlist` and `prodn` constructs (`productionlist` are
-gradually being replaced by `prodn` in the manual). Updates to `tacn`
-and `cmd` constructs must be done manually since the grammar doesn't
-have names for them as it does for nonterminals. There is an option
-to report which `tacn` and `cmd` were not found in the `.rst` files.
-`tacv` and `cmdv` constructs are not processed at all.
+`doc_grammar` extracts Coq's grammar from `.mlg` files, edits it and inserts it
+into `.rst` files. The tool inserts `prodn` directives for grammar productions.
+(`productionlist` are gradually being replaced by `prodn` in the manual.)
+It also updates `tacn` and `cmd` directives when they can be unambiguously matched to
+productions of the grammar (in practice, that's probably almost always).
+`tacv` and `cmdv` directives are not updated because matching them appears to require
+human judgement. `doc_grammar` generates a few files that may be useful to
+developers and documentors.
The mlg grammars present several challenges to generating an accurate grammar
for documentation purposes:
@@ -34,46 +34,49 @@ for documentation purposes:
## What the tool does
-1. The tool reads all the `mlg` files and generates `fullGrammar`, which includes
-all the grammar without the actions for each production or the OCaml code. This
-file is provided as a convenience to make it easier to examine the (mostly)
-unprocessed grammar of the mlg files with less clutter. Nonterminals that use
-levels (`"5" RIGHTA` below) are modified, for example:
-
-```
-tactic_expr:
- [ "5" RIGHTA
- [ te = binder_tactic -> { te } ]
-```
-
-becomes
-
-```
-tactic_expr5: [
-| binder_tactic
-| tactic_expr4
-]
-```
-
-2. The tool applies grammar editing operations specified by `common.edit_mlg` to
-generate `editedGrammar`.
-
-3. `orderedGrammar` gives the desired order for the nonterminals and productions
-in the documented grammar. Developers should edit this file to change the order.
-`doc_grammar` updates `orderedGrammar` so it has the same set of nonterminals and productions
-as `editedGrammar`. The update process removes manually-added comments from
-`orderedGrammar` while automatically-generated comments will be regenerated.
-
-4. The tool applies further edits to the grammar specified by `productionlist.edit_mlg`,
-then it updates the productionlists in the `.rst` files as specified by comments in the form
-`.. insertgram <first nt> <last nt>`. The edits are primarily to expand
-`.mlg` constructs such as `LIST1` and `OPT` into separate productions. The tool
-generates `productionlistGrammar`, which has the entire grammar in the form of `productionlists`.
-
-5. Using the grammar produced in step 3, the tool applies edits specified by
-`prodn.edit_mlg` and generates `prodnGrammar`, representing each production as
-a Sphinx `prodn` construct. Differently-edited grammars are used because `prodn`
-can naturally represent `LIST1 x SEP ','` whereas that is awkward for `productionlists`.
+1. The tool reads all the `mlg` files and generates `fullGrammar`, which includes
+ all the grammar without the actions for each production or the OCaml code. This
+ file is provided as a convenience to make it easier to examine the (mostly)
+ unprocessed grammar of the mlg files with less clutter. Nonterminals that use
+ levels (`"5" RIGHTA` below) are modified, for example:
+
+ ```
+ tactic_expr:
+ [ "5" RIGHTA
+ [ te = binder_tactic -> { te } ]
+ ```
+
+ becomes
+
+ ```
+ tactic_expr5: [
+ | binder_tactic
+ | tactic_expr4
+ ]
+ ```
+
+2. The tool applies grammar editing operations specified by `common.edit_mlg` to
+ generate `editedGrammar`.
+
+3. `orderedGrammar` gives the desired order for nonterminals and individual productions
+ in the documented grammar. Developers should edit this file only to reorder lines.
+ `doc_grammar` updates `orderedGrammar` so it has the same set of nonterminals and productions
+ as `editedGrammar` while retaining the previous ordering. Since the position of
+ new or renamed nonterminals is unspecified, they tend to show up in the wrong
+ place in `orderedGrammar`, therefore users should review the output and make
+ appropriate adjustments to the order.
+
+ The update process removes manually-added comments from `orderedGrammar` while
+ automatically-generated comments will be regenerated.
+
+4. The tool updates the `.rst` files. Comments in the form
+ `.. insertprodn <first nt> <last nt>` indicate inserting the productions for a
+ range of nonterminals. `.. cmd::` and `.. tacn::` directives are updated using
+ prefixes in the form `[a-zA-Z0-9_ ]+` from the directive and the
+ grammar. If there is unique match in the grammar, the directive is updated, if needed.
+ Multiple matches or no match gives an error message.
+
+5. For reference, the tool generates `prodnGrammar`, which has the entire grammar in the form of `prodns`.
## How to use the tool
@@ -107,6 +110,9 @@ Other command line arguments:
* `-no-warn` suppresses printing of some warning messages
+* `-no-update` puts updates to `fullGrammar` and `orderedGrammar` into new files named
+ `*.new`, leaving the originals unmodified. For use in Dune.
+
* `-short` limits processing to updating/verifying only the `fullGrammar` file
* `-verbose` prints more messages about the grammar
@@ -115,12 +121,12 @@ Other command line arguments:
### Grammar editing scripts
-The grammar editing scripts `*.edit_mlg` are similar in format to `.mlg` files stripped
+The grammar editing script `common.edit_mlg` is similar in format to `.mlg` files but stripped
of all OCaml features. This is an easy way to include productions to match or add without
writing another parser. The `DOC_GRAMMAR` token at the beginning of each file
-signals the use of streamlined syntax.
+signals the use of the streamlined syntax.
-Each edit file has a series of items in the form of productions. Items are applied
+The edit file has a series of items in the form of productions. Items are applied
in the order they appear. There are two types of editing operations:
* Global edits - edit rules that apply to the entire grammar in a single operation.
@@ -137,7 +143,7 @@ such as `empty: [ | ]`, which adds a new non-terminal `empty` with an
empty production on the right-hand side.
Another example: `LEFTQMARK: [ | "?" ]` is a local edit that treats `LEFTQMARK` as
-the name of a non-terminal and adds one production for it. (We know that LEFTQMARK
+the name of a non-terminal and adds a production for it. (We know that LEFTQMARK
is a token but doc_grammar does not.) `SPLICE: [ | LEFTQMARK ]` requests replacing all
uses of `LEFTQMARK` anywhere in the grammar with its productions and removing the
non-terminal. The combined effect of these two is to replace all uses of
@@ -192,7 +198,7 @@ that appear in the specified production:
```
`MOVETO <destination> <production>` - moves the production to `<destination>` and,
- if needed, creates a new production <edited_nt> -> <destination>.
+ if needed, creates a new production <edited_nt> -> \<destination>.
`OPTINREF` - verifies that <edited_nt> has an empty production. If so, it removes
the empty production and replaces all references to <edited_nt> throughout the
@@ -201,7 +207,7 @@ grammar with `OPT <edited_nt>`
`PRINT` <nonterminal> - prints the nonterminal definition at that point in
applying the edits. Most useful when the edits get a bit complicated to follow.
-* (any other nonterminal name) - adds a new production (and possibly a new nonterminal)
+`(any other nonterminal name)` - adds a new production (and possibly a new nonterminal)
to the grammar.
### `.rst` file updates
diff --git a/doc/tools/docgram/common.edit_mlg b/doc/tools/docgram/common.edit_mlg
index fe2e68a517..60b845c4be 100644
--- a/doc/tools/docgram/common.edit_mlg
+++ b/doc/tools/docgram/common.edit_mlg
@@ -140,10 +140,10 @@ field_ident: [
| "." ident
]
-basequalid: [
-| REPLACE ident fields
-| WITH ident LIST0 field_ident
-| DELETE ident
+qualid: [ | DELETENT ]
+
+qualid: [
+| ident LIST0 field_ident
]
field: [ | DELETENT ]
@@ -313,6 +313,7 @@ closed_binder: [
| REPLACE "{" name LIST1 name ":" lconstr "}"
| WITH "{" LIST1 name type_cstr "}"
| DELETE "{" name ":" lconstr "}"
+| MOVETO implicit_binders "{" LIST1 name type_cstr "}"
| DELETE "[" name "]"
| DELETE "[" name LIST1 name "]"
@@ -320,9 +321,14 @@ closed_binder: [
| REPLACE "[" name LIST1 name ":" lconstr "]"
| WITH "[" LIST1 name type_cstr "]"
| DELETE "[" name ":" lconstr "]"
+| MOVETO implicit_binders "[" LIST1 name type_cstr "]"
| REPLACE "(" Prim.name ":" lconstr "|" lconstr ")"
| WITH "(" Prim.name ":" type "|" lconstr ")"
+
+| MOVETO generalizing_binder "`(" LIST1 typeclass_constraint SEP "," ")"
+| MOVETO generalizing_binder "`{" LIST1 typeclass_constraint SEP "," "}"
+| MOVETO generalizing_binder "`[" LIST1 typeclass_constraint SEP "," "]"
]
name_colon: [
@@ -383,15 +389,25 @@ evar_instance: [
| OPTINREF
]
+(* No constructor syntax, OPT [ "|" binders ] is not supported for Record *)
+record_definition: [
+| opt_coercion ident_decl binders OPT [ ":" type ] OPT [ identref ] "{" record_fields "}" decl_notations
+]
+
+(* No record syntax, opt_coercion not supported for Variant, := ... required *)
+variant_definition: [
+| ident_decl binders OPT [ "|" binders ] OPT [ ":" type ] ":=" OPT "|" LIST1 constructor SEP "|" decl_notations
+]
+
gallina: [
| REPLACE thm_token ident_decl binders ":" lconstr LIST0 [ "with" ident_decl binders ":" lconstr ]
| WITH thm_token ident_decl binders ":" type LIST0 [ "with" ident_decl binders ":" type ]
| DELETE assumptions_token inline assum_list
-| REPLACE OPT cumulativity_token private_token finite_token LIST1 inductive_definition SEP "with"
+| REPLACE finite_token LIST1 inductive_definition SEP "with"
| WITH "Inductive" inductive_definition LIST0 ( "with" inductive_definition )
| "CoInductive" inductive_definition LIST0 ( "with" inductive_definition )
-| "Variant" inductive_definition LIST0 ( "with" inductive_definition )
-| [ "Record" | "Structure" ] inductive_definition LIST0 ( "with" inductive_definition )
+| "Variant" variant_definition LIST0 ( "with" variant_definition )
+| [ "Record" | "Structure" ] record_definition LIST0 ( "with" record_definition )
| "Class" inductive_definition LIST0 ( "with" inductive_definition )
| REPLACE "Fixpoint" LIST1 rec_definition SEP "with"
| WITH "Fixpoint" rec_definition LIST0 ( "with" rec_definition )
@@ -405,18 +421,13 @@ gallina: [
| WITH "Scheme" scheme LIST0 ( "with" scheme )
]
-DELETE: [
-| private_token
-| cumulativity_token
-]
-
constructor_list_or_record_decl: [
| OPTINREF
]
record_fields: [
| REPLACE record_field ";" record_fields
-| WITH LIST1 record_field SEP ";"
+| WITH LIST0 record_field SEP ";"
| DELETE record_field
| DELETE (* empty *)
]
@@ -492,16 +503,46 @@ functor_app_annot: [
]
is_module_expr: [
+| REPLACE ":=" module_expr_inl LIST0 ext_module_expr
+| WITH ":=" LIST1 module_expr_inl SEP "<+"
| OPTINREF
]
is_module_type: [
+| REPLACE ":=" module_type_inl LIST0 ext_module_type
+| WITH ":=" LIST1 module_type_inl SEP "<+"
| OPTINREF
]
gallina_ext: [
| REPLACE "Arguments" smart_global LIST0 argument_spec_block OPT [ "," LIST1 [ LIST0 more_implicits_block ] SEP "," ] OPT [ ":" LIST1 arguments_modifier SEP "," ]
| WITH "Arguments" smart_global LIST0 argument_spec_block LIST0 [ "," LIST0 more_implicits_block ] OPT [ ":" LIST1 arguments_modifier SEP "," ]
+| REPLACE "Implicit" "Type" reserv_list
+| WITH "Implicit" [ "Type" | "Types" ] reserv_list
+| DELETE "Implicit" "Types" reserv_list
+
+(* Per @Zimmi48, the global (qualid) must be a simple identifier if def_body is present
+ Note that smart_global is "qualid | by_notation" and that
+ ident_decl is "ident OPT univ_decl"; move
+ *)
+| REPLACE "Canonical" OPT "Structure" global OPT [ OPT univ_decl def_body ]
+| WITH "Canonical" OPT "Structure" ident_decl def_body
+| REPLACE "Canonical" OPT "Structure" by_notation
+| WITH "Canonical" OPT "Structure" smart_global
+
+| REPLACE "Include" "Type" module_type_inl LIST0 ext_module_type
+| WITH "Include" "Type" LIST1 module_type_inl SEP "<+"
+
+| REPLACE "Generalizable" [ "All" "Variables" | "No" "Variables" | [ "Variable" | "Variables" ] LIST1 identref ]
+| WITH "Generalizable" [ [ "Variable" | "Variables" ] LIST1 identref | "All" "Variables" | "No" "Variables" ]
+
+| REPLACE "Export" "Set" option_table option_setting
+| WITH OPT "Export" "Set" option_table option_setting
+| REPLACE "Export" "Unset" option_table
+| WITH OPT "Export" "Unset" option_table
+| REPLACE "Instance" instance_name ":" operconstr200 hint_info [ ":=" "{" record_declaration "}" | ":=" lconstr | ]
+| WITH "Instance" instance_name ":" operconstr200 hint_info OPT [ ":=" "{" record_declaration "}" | ":=" lconstr ]
+
]
(* lexer stuff *)
@@ -624,6 +665,19 @@ selector_body: [
range_selector_or_nth: [ | DELETENT ]
+firstorder_rhs: [
+| firstorder_using
+| "with" LIST1 preident
+| firstorder_using "with" LIST1 preident
+]
+
+where: [
+| "at" "top"
+| "at" "bottom"
+| "after" ident
+| "before" ident
+]
+
simple_tactic: [
| DELETE "intros"
| REPLACE "intros" ne_intropatterns
@@ -631,6 +685,158 @@ simple_tactic: [
| DELETE "eintros"
| REPLACE "eintros" ne_intropatterns
| WITH "eintros" intropatterns
+| DELETE "autorewrite" "with" LIST1 preident clause
+| DELETE "autorewrite" "with" LIST1 preident clause "using" tactic
+| DELETE "autorewrite" "*" "with" LIST1 preident clause
+| REPLACE "autorewrite" "*" "with" LIST1 preident clause "using" tactic
+| WITH "autorewrite" OPT "*" "with" LIST1 preident clause_dft_concl OPT ( "using" tactic )
+| DELETE "cofix" ident
+| REPLACE "cofix" ident "with" LIST1 cofixdecl
+| WITH "cofix" ident OPT ( "with" LIST1 cofixdecl )
+| DELETE "constructor"
+| DELETE "constructor" int_or_var
+| REPLACE "constructor" int_or_var "with" bindings
+| WITH "constructor" OPT int_or_var OPT ( "with" bindings )
+| DELETE "econstructor"
+| DELETE "econstructor" int_or_var
+| REPLACE "econstructor" int_or_var "with" bindings
+| WITH "econstructor" OPT ( int_or_var OPT ( "with" bindings ) )
+| DELETE "dependent" "rewrite" orient constr
+| REPLACE "dependent" "rewrite" orient constr "in" hyp
+| WITH "dependent" "rewrite" orient constr OPT ( "in" hyp )
+| "firstorder" OPT tactic firstorder_rhs
+| DELETE "firstorder" OPT tactic firstorder_using
+| DELETE "firstorder" OPT tactic "with" LIST1 preident
+| DELETE "firstorder" OPT tactic firstorder_using "with" LIST1 preident
+| DELETE "fix" ident natural
+| REPLACE "fix" ident natural "with" LIST1 fixdecl
+| WITH "fix" ident natural OPT ( "with" LIST1 fixdecl )
+| DELETE "generalize" constr
+| REPLACE "generalize" constr LIST1 constr
+| WITH "generalize" constr OPT ( LIST1 constr )
+| EDIT "simplify_eq" ADD_OPT destruction_arg
+| EDIT "esimplify_eq" ADD_OPT destruction_arg
+| EDIT "discriminate" ADD_OPT destruction_arg
+| EDIT "ediscriminate" ADD_OPT destruction_arg
+| DELETE "injection"
+| DELETE "injection" destruction_arg
+| DELETE "injection" "as" LIST0 simple_intropattern
+| REPLACE "injection" destruction_arg "as" LIST0 simple_intropattern
+| WITH "injection" OPT destruction_arg OPT ( "as" LIST0 simple_intropattern )
+| DELETE "einjection"
+| DELETE "einjection" destruction_arg
+| DELETE "einjection" "as" LIST0 simple_intropattern
+| REPLACE "einjection" destruction_arg "as" LIST0 simple_intropattern
+| WITH "einjection" OPT destruction_arg OPT ( "as" LIST0 simple_intropattern )
+| EDIT "simple" "injection" ADD_OPT destruction_arg
+| DELETE "intro" (* todo: change the mlg to simplify! *)
+| DELETE "intro" ident
+| DELETE "intro" ident "at" "top"
+| DELETE "intro" ident "at" "bottom"
+| DELETE "intro" ident "after" hyp
+| DELETE "intro" ident "before" hyp
+| DELETE "intro" "at" "top"
+| DELETE "intro" "at" "bottom"
+| DELETE "intro" "after" hyp
+| DELETE "intro" "before" hyp
+| "intro" OPT ident OPT where
+| DELETE "move" hyp "at" "top"
+| DELETE "move" hyp "at" "bottom"
+| DELETE "move" hyp "after" hyp
+| DELETE "move" hyp "before" hyp
+| "move" ident OPT where
+| DELETE "replace" "->" uconstr clause
+| DELETE "replace" "<-" uconstr clause
+| DELETE "replace" uconstr clause
+| "replace" orient uconstr clause_dft_concl (* todo: fix 'clause' *)
+| REPLACE "rewrite" "*" orient uconstr "in" hyp "at" occurrences by_arg_tac
+| WITH "rewrite" "*" orient uconstr OPT ( "in" hyp ) OPT ( "at" occurrences by_arg_tac )
+| DELETE "rewrite" "*" orient uconstr "in" hyp by_arg_tac
+| DELETE "rewrite" "*" orient uconstr "at" occurrences by_arg_tac
+| DELETE "rewrite" "*" orient uconstr by_arg_tac
+| DELETE "setoid_rewrite" orient glob_constr_with_bindings
+| DELETE "setoid_rewrite" orient glob_constr_with_bindings "in" hyp
+| DELETE "setoid_rewrite" orient glob_constr_with_bindings "at" occurrences
+| REPLACE "setoid_rewrite" orient glob_constr_with_bindings "at" occurrences "in" hyp
+| WITH "setoid_rewrite" orient glob_constr_with_bindings OPT ( "at" occurrences ) OPT ( "in" hyp )
+| REPLACE "stepl" constr "by" tactic
+| WITH "stepl" constr OPT ( "by" tactic )
+| DELETE "stepl" constr
+| REPLACE "stepr" constr "by" tactic
+| WITH "stepr" constr OPT ( "by" tactic )
+| DELETE "stepr" constr
+| DELETE "unify" constr constr
+| REPLACE "unify" constr constr "with" preident
+| WITH "unify" constr constr OPT ( "with" preident )
+| DELETE "cutrewrite" orient constr
+| REPLACE "cutrewrite" orient constr "in" hyp
+| WITH "cutrewrite" orient constr OPT ( "in" hyp )
+| DELETE "destauto"
+| REPLACE "destauto" "in" hyp
+| WITH "destauto" OPT ( "in" hyp )
+| REPLACE "autounfold_one" hintbases "in" hyp
+| WITH "autounfold_one" hintbases OPT ( "in" hyp )
+| DELETE "autounfold_one" hintbases
+| REPLACE "rewrite_db" preident "in" hyp
+| WITH "rewrite_db" preident OPT ( "in" hyp )
+| DELETE "rewrite_db" preident
+| DELETE "setoid_symmetry"
+| REPLACE "setoid_symmetry" "in" hyp
+| WITH "setoid_symmetry" OPT ( "in" hyp )
+| REPLACE "rewrite_strat" rewstrategy "in" hyp
+| WITH "rewrite_strat" rewstrategy OPT ( "in" hyp )
+| DELETE "rewrite_strat" rewstrategy
+| REPLACE "protect_fv" string "in" ident
+| WITH "protect_fv" string OPT ( "in" ident )
+| DELETE "protect_fv" string
+| DELETE "symmetry"
+| REPLACE "symmetry" "in" in_clause
+| WITH "symmetry" OPT ( "in" in_clause )
+| DELETE "split"
+| REPLACE "split" "with" bindings
+| WITH "split" OPT ( "with" bindings )
+| DELETE "esplit"
+| REPLACE "esplit" "with" bindings
+| WITH "esplit" OPT ( "with" bindings )
+| DELETE "specialize" constr_with_bindings
+| REPLACE "specialize" constr_with_bindings "as" simple_intropattern
+| WITH "specialize" constr_with_bindings OPT ( "as" simple_intropattern )
+| DELETE "exists"
+| REPLACE "exists" LIST1 bindings SEP ","
+| WITH "exists" OPT ( LIST1 bindings SEP "," )
+| DELETE "eexists"
+| REPLACE "eexists" LIST1 bindings SEP ","
+| WITH "eexists" OPT ( LIST1 bindings SEP "," )
+| DELETE "left"
+| REPLACE "left" "with" bindings
+| WITH "left" OPT ( "with" bindings )
+| DELETE "eleft"
+| REPLACE "eleft" "with" bindings
+| WITH "eleft" OPT ( "with" bindings )
+| DELETE "right"
+| REPLACE "right" "with" bindings
+| WITH "right" OPT ( "with" bindings )
+| DELETE "eright"
+| REPLACE "eright" "with" bindings
+| WITH "eright" OPT ( "with" bindings )
+| DELETE "finish_timing" OPT string
+| REPLACE "finish_timing" "(" string ")" OPT string
+| WITH "finish_timing" OPT ( "(" string ")" ) OPT string
+| REPLACE "hresolve_core" "(" ident ":=" constr ")" "at" int_or_var "in" constr
+| WITH "hresolve_core" "(" ident ":=" constr ")" OPT ( "at" int_or_var ) "in" constr
+| DELETE "hresolve_core" "(" ident ":=" constr ")" "in" constr
+| EDIT "psatz_R" ADD_OPT int_or_var tactic
+| EDIT "psatz_Q" ADD_OPT int_or_var tactic
+| EDIT "psatz_Z" ADD_OPT int_or_var tactic
+| REPLACE "subst" LIST1 var
+| WITH "subst" OPT ( LIST1 var )
+| DELETE "subst"
+| DELETE "congruence"
+| DELETE "congruence" int
+| DELETE "congruence" "with" LIST1 constr
+| REPLACE "congruence" int "with" LIST1 constr
+| WITH "congruence" OPT int OPT ( "with" LIST1 constr )
+
]
(* todo: don't use DELETENT for this *)
@@ -666,6 +872,109 @@ command: [
| WITH "Function" function_rec_definition_loc LIST0 ( "with" function_rec_definition_loc ) (* funind plugin *)
| REPLACE "Functional" "Scheme" LIST1 fun_scheme_arg SEP "with" (* funind plugin *)
| WITH "Functional" "Scheme" fun_scheme_arg LIST0 ( "with" fun_scheme_arg ) (* funind plugin *)
+| DELETE "Cd"
+| REPLACE "Cd" ne_string
+| WITH "Cd" OPT ne_string
+| DELETE "Back"
+| REPLACE "Back" natural
+| WITH "Back" OPT natural
+| REPLACE "Test" option_table "for" LIST1 option_ref_value
+| WITH "Test" option_table OPT ( "for" LIST1 option_ref_value )
+| DELETE "Test" option_table
+| REPLACE "Load" [ "Verbose" | ] [ ne_string | IDENT ]
+| WITH "Load" OPT "Verbose" [ ne_string | IDENT ]
+| DELETE "Unset" option_table
+| DELETE "Set" option_table option_setting
+| REPLACE "Add" IDENT IDENT LIST1 option_ref_value
+| WITH "Add" IDENT OPT IDENT LIST1 option_ref_value
+| DELETE "Add" IDENT LIST1 option_ref_value
+| DELETE "Add" "Parametric" "Relation" binders ":" constr constr "reflexivity" "proved" "by" constr "symmetry" "proved" "by" constr "as" ident
+| DELETE "Add" "Parametric" "Relation" binders ":" constr constr "reflexivity" "proved" "by" constr "as" ident
+| DELETE "Add" "Parametric" "Relation" binders ":" constr constr "reflexivity" "proved" "by" constr "transitivity" "proved" "by" constr "as" ident
+| DELETE "Add" "Parametric" "Relation" binders ":" constr constr "reflexivity" "proved" "by" constr "symmetry" "proved" "by" constr "transitivity" "proved" "by" constr "as" ident
+| DELETE "Add" "Parametric" "Relation" binders ":" constr constr "symmetry" "proved" "by" constr "as" ident
+| DELETE "Add" "Parametric" "Relation" binders ":" constr constr "symmetry" "proved" "by" constr "transitivity" "proved" "by" constr "as" ident
+| DELETE "Add" "Parametric" "Relation" binders ":" constr constr "transitivity" "proved" "by" constr "as" ident
+| DELETE "Add" "Parametric" "Relation" binders ":" constr constr "as" ident
+| "Add" "Parametric" "Relation" binders ":" constr constr OPT ( "reflexivity" "proved" "by" constr ) OPT ( "symmetry" "proved" "by" constr ) OPT ("transitivity" "proved" "by" constr ) "as" ident
+| DELETE "Add" "Relation" constr constr "reflexivity" "proved" "by" constr "symmetry" "proved" "by" constr "as" ident
+| DELETE "Add" "Relation" constr constr "reflexivity" "proved" "by" constr "as" ident
+| DELETE "Add" "Relation" constr constr "as" ident
+| DELETE "Add" "Relation" constr constr "symmetry" "proved" "by" constr "as" ident
+| DELETE "Add" "Relation" constr constr "symmetry" "proved" "by" constr "transitivity" "proved" "by" constr "as" ident
+| DELETE "Add" "Relation" constr constr "reflexivity" "proved" "by" constr "transitivity" "proved" "by" constr "as" ident
+| DELETE "Add" "Relation" constr constr "reflexivity" "proved" "by" constr "symmetry" "proved" "by" constr "transitivity" "proved" "by" constr "as" ident
+| DELETE "Add" "Relation" constr constr "transitivity" "proved" "by" constr "as" ident
+| "Add" "Relation" constr constr OPT ( "reflexivity" "proved" "by" constr ) OPT ( "symmetry" "proved" "by" constr ) OPT ( "transitivity" "proved" "by" constr ) "as" ident
+| REPLACE "Admit" "Obligations" "of" ident
+| WITH "Admit" "Obligations" OPT ( "of" ident )
+| DELETE "Admit" "Obligations"
+| REPLACE "Create" "HintDb" IDENT; [ "discriminated" | ]
+| WITH "Create" "HintDb" IDENT; OPT "discriminated"
+| DELETE "Debug" "On"
+| REPLACE "Debug" "Off"
+| WITH "Debug" [ "On" | "Off" ]
+| EDIT "Defined" ADD_OPT identref
+| REPLACE "Derive" "Inversion" ident "with" constr "Sort" sort_family
+| WITH "Derive" "Inversion" ident "with" constr OPT ( "Sort" sort_family )
+| DELETE "Derive" "Inversion" ident "with" constr
+| REPLACE "Derive" "Inversion_clear" ident "with" constr "Sort" sort_family
+| WITH "Derive" "Inversion_clear" ident "with" constr OPT ( "Sort" sort_family )
+| DELETE "Derive" "Inversion_clear" ident "with" constr
+| EDIT "Focus" ADD_OPT natural
+| DELETE "Hint" "Rewrite" orient LIST1 constr ":" LIST0 preident
+| REPLACE "Hint" "Rewrite" orient LIST1 constr "using" tactic ":" LIST0 preident
+| WITH "Hint" "Rewrite" orient LIST1 constr OPT ( "using" tactic ) OPT ( ":" LIST0 preident )
+| DELETE "Hint" "Rewrite" orient LIST1 constr
+| DELETE "Hint" "Rewrite" orient LIST1 constr "using" tactic
+| REPLACE "Next" "Obligation" "of" ident withtac
+| WITH "Next" "Obligation" OPT ( "of" ident ) withtac
+| DELETE "Next" "Obligation" withtac
+| REPLACE "Obligation" int "of" ident ":" lglob withtac
+| WITH "Obligation" int OPT ( "of" ident ) OPT ( ":" lglob withtac )
+| DELETE "Obligation" int "of" ident withtac
+| DELETE "Obligation" int ":" lglob withtac
+| DELETE "Obligation" int withtac
+| REPLACE "Obligations" "of" ident
+| WITH "Obligations" OPT ( "of" ident )
+| DELETE "Obligations"
+| REPLACE "Preterm" "of" ident
+| WITH "Preterm" OPT ( "of" ident )
+| DELETE "Preterm"
+| EDIT "Remove" ADD_OPT IDENT IDENT LIST1 option_ref_value
+| DELETE "Restore" "State" IDENT
+| DELETE "Restore" "State" ne_string
+| "Restore" "State" [ IDENT | ne_string ]
+| DELETE "Show"
+| DELETE "Show" natural
+| DELETE "Show" ident
+| "Show" OPT [ ident | natural ]
+| DELETE "Show" "Ltac" "Profile"
+| REPLACE "Show" "Ltac" "Profile" "CutOff" int
+| WITH "Show" "Ltac" "Profile" OPT [ "CutOff" int | string ]
+| DELETE "Show" "Ltac" "Profile" string
+| DELETE "Show" "Proof" (* combined with Show Proof Diffs in vernac_toplevel *)
+| REPLACE "Solve" "All" "Obligations" "with" tactic
+| WITH "Solve" "All" "Obligations" OPT ( "with" tactic )
+| DELETE "Solve" "All" "Obligations"
+| REPLACE "Solve" "Obligation" int "of" ident "with" tactic
+| WITH "Solve" "Obligation" int OPT ( "of" ident ) "with" tactic
+| DELETE "Solve" "Obligations"
+| DELETE "Solve" "Obligation" int "with" tactic
+| REPLACE "Solve" "Obligations" "of" ident "with" tactic
+| WITH "Solve" "Obligations" OPT ( OPT ( "of" ident ) "with" tactic )
+| DELETE "Solve" "Obligations" "with" tactic
+| DELETE "Undo"
+| DELETE "Undo" natural
+| REPLACE "Undo" "To" natural
+| WITH "Undo" OPT ( OPT "To" natural )
+| DELETE "Write" "State" IDENT
+| REPLACE "Write" "State" ne_string
+| WITH "Write" "State" [ IDENT | ne_string ]
+| DELETE "Abort"
+| DELETE "Abort" "All"
+| REPLACE "Abort" identref
+| WITH "Abort" OPT [ "All" | identref ]
]
@@ -737,12 +1046,20 @@ assumption_token: [
| WITH [ "Variable" | "Variables" ]
]
-legacy_attrs: [
-| OPT [ "Local" | "Global" ] OPT [ "Polymorphic" | "Monomorphic" ] OPT "Program" OPT [ "Cumulative" | "NonCumulative" ] OPT "Private"
+all_attrs: [
+| LIST0 ( "#[" LIST0 attribute SEP "," "]" ) LIST0 legacy_attr
]
-all_attrs: [
-| LIST0 ( "#[" LIST0 attribute SEP "," "]" ) OPT legacy_attrs
+legacy_attr: [
+| REPLACE "Local"
+| WITH [ "Local" | "Global" ]
+| DELETE "Global"
+| REPLACE "Polymorphic"
+| WITH [ "Polymorphic" | "Monomorphic" ]
+| DELETE "Monomorphic"
+| REPLACE "Cumulative"
+| WITH [ "Cumulative" | "NonCumulative" ]
+| DELETE "NonCumulative"
]
vernacular: [
@@ -770,6 +1087,7 @@ inductive_definition: [
| WITH opt_coercion ident_decl binders OPT [ "|" binders ] OPT [ ":" type ] opt_constructors_or_fields decl_notations
]
+(* note that constructor -> identref constructor_type *)
constructor_list_or_record_decl: [
| DELETE "|" LIST1 constructor SEP "|"
| REPLACE identref constructor_type "|" LIST1 constructor SEP "|"
@@ -786,6 +1104,222 @@ record_binder: [
| DELETE name
]
+at_level_opt: [
+| OPTINREF
+]
+
+query_command: [
+| REPLACE "Eval" red_expr "in" lconstr "."
+| WITH "Eval" red_expr "in" lconstr
+| REPLACE "Compute" lconstr "."
+| WITH "Compute" lconstr
+| REPLACE "Check" lconstr "."
+| WITH "Check" lconstr
+| REPLACE "About" smart_global OPT univ_name_list "."
+| WITH "About" smart_global OPT univ_name_list
+| REPLACE "SearchHead" constr_pattern in_or_out_modules "."
+| WITH "SearchHead" constr_pattern in_or_out_modules
+| REPLACE "SearchPattern" constr_pattern in_or_out_modules "."
+| WITH "SearchPattern" constr_pattern in_or_out_modules
+| REPLACE "SearchRewrite" constr_pattern in_or_out_modules "."
+| WITH "SearchRewrite" constr_pattern in_or_out_modules
+| REPLACE "Search" searchabout_query searchabout_queries "."
+| WITH "Search" searchabout_query searchabout_queries
+]
+
+vernac_toplevel: [
+(* note these commands can't be referenced by vernac_control commands *)
+| REPLACE "Drop" "."
+| WITH "Drop"
+| REPLACE "Quit" "."
+| WITH "Quit"
+| REPLACE "BackTo" natural "."
+| WITH "BackTo" natural
+| REPLACE "Show" "Goal" natural "at" natural "."
+| WITH "Show" "Goal" natural "at" natural
+| REPLACE "Show" "Proof" "Diffs" OPT "removed" "."
+| WITH "Show" "Proof" OPT ( "Diffs" OPT "removed" )
+| DELETE vernac_control
+]
+
+positive_search_mark: [
+| OPTINREF
+]
+
+in_or_out_modules: [
+| OPTINREF
+]
+
+searchabout_queries: [
+| OPTINREF
+]
+
+vernac_control: [
+(* replacing vernac_control with command is cheating a little;
+ they can't refer to the vernac_toplevel commands.
+ cover this the descriptions of these commands *)
+| REPLACE "Time" vernac_control
+| WITH "Time" command
+| REPLACE "Redirect" ne_string vernac_control
+| WITH "Redirect" ne_string command
+| REPLACE "Timeout" natural vernac_control
+| WITH "Timeout" natural command
+| REPLACE "Fail" vernac_control
+| WITH "Fail" command
+| DELETE decorated_vernac
+]
+
+option_setting: [
+| OPTINREF
+]
+
+orient: [
+| OPTINREF
+]
+
+in_hyp_as: [
+| OPTINREF
+]
+
+as_name: [
+| OPTINREF
+]
+
+hloc: [
+| OPTINREF
+]
+
+as_or_and_ipat: [
+| OPTINREF
+]
+
+hintbases: [
+| OPTINREF
+]
+
+as_ipat: [
+| OPTINREF
+]
+
+auto_using: [
+| OPTINREF
+]
+
+with_bindings: [
+| OPTINREF
+]
+
+eqn_ipat: [
+| OPTINREF
+]
+
+withtac: [
+| OPTINREF
+]
+
+of_module_type: [
+| (* empty *)
+| OPTINREF
+]
+
+
+clause_dft_all: [
+| OPTINREF
+]
+
+opt_clause: [
+| OPTINREF
+]
+
+with_names: [
+| OPTINREF
+]
+
+in_hyp_list: [
+| OPTINREF
+]
+
+struct_annot: [
+| OPTINREF
+]
+
+firstorder_using: [
+| OPTINREF
+]
+
+fun_ind_using: [
+| OPTINREF
+]
+
+by_arg_tac: [
+| OPTINREF
+]
+
+by_tactic: [
+| OPTINREF
+]
+
+rewriter: [
+| REPLACE [ "?" | LEFTQMARK ] constr_with_bindings_arg
+| WITH "?" constr_with_bindings_arg
+]
+
+intropattern_or_list_or: [
+(* todo: where does intropattern_or_list_or come from?? *)
+| REPLACE intropattern_or_list_or "|" intropatterns
+| WITH LIST0 intropattern LIST0 ( "|" intropatterns )
+| DELETE intropatterns
+]
+
+record_declaration: [
+| DELETE fields_def
+| LIST0 field_def
+]
+
+fields_def: [ | DELETENT ]
+
+hint_info: [
+| OPTINREF
+]
+
+debug: [
+| OPTINREF
+]
+
+eauto_search_strategy: [
+| OPTINREF
+]
+
+
+constr_body: [
+| DELETE ":=" lconstr
+| REPLACE ":" lconstr ":=" lconstr
+| WITH OPT ( ":" lconstr ) ":=" lconstr
+]
+
+opt_hintbases: [
+| OPTINREF
+]
+
+opthints: [
+| OPTINREF
+]
+
+scheme: [
+| DELETE scheme_kind
+| REPLACE identref ":=" scheme_kind
+| WITH OPT ( identref ":=" ) scheme_kind
+]
+
+instance_name: [
+| OPTINREF
+]
+
+simple_reserv: [
+| REPLACE LIST1 identref ":" lconstr
+| WITH LIST1 identref ":" type
+]
+
in_clause: [
| DELETE in_clause'
| REPLACE LIST0 hypident_occ SEP "," "|-" concl_occ
@@ -811,9 +1345,14 @@ decl_notations: [
| OPTINREF
]
+module_expr: [
+| REPLACE module_expr_atom
+| WITH LIST1 module_expr_atom
+| DELETE module_expr module_expr_atom
+]
+
SPLICE: [
| noedit_mode
-| command_entry
| bigint
| match_list
| match_context_list
@@ -842,7 +1381,6 @@ SPLICE: [
| ne_lstring
| ne_string
| lstring
-| basequalid
| fullyqualid
| global
| reference
@@ -918,7 +1456,6 @@ SPLICE: [
| binders_fixannot
| as_return_type
| case_type
-| fields_def
| universe_increment
| type_cstr
| record_pattern
@@ -945,8 +1482,42 @@ SPLICE: [
| record_fields
| constructor_type
| record_binder
+| at_level_opt
+| option_ref_value
+| positive_search_mark
+| in_or_out_modules
+| register_prim_token
+| option_setting
+| orient
+| with_bindings
+| by_arg_tac
+| by_tactic
+| quantified_hypothesis
+| nat_or_var
+| in_hyp_list
+| rename
+| export_token
+| reserv_tuple
+| inst
| opt_coercion
| opt_constructors_or_fields
+| is_module_type
+| is_module_expr
+| module_expr
+| mlname
+| withtac
+| debug
+| eauto_search_strategy
+| constr_body
+| reference_or_constr
+| opt_hintbases
+| hints_path_atom
+| opthints
+| scheme
+| fresh_id
+| ltac_def_kind
+| intropatterns
+| instance_name
] (* end SPLICE *)
RENAME: [
@@ -963,7 +1534,6 @@ RENAME: [
| tactic_expr0 ltac_expr0
(* | nonsimple_intropattern intropattern (* ltac2 *) *)
-| intropatterns intropattern_list_opt
| operconstr200 term (* historical name *)
| operconstr100 term100
@@ -982,14 +1552,12 @@ RENAME: [
| match_hyps match_hyp
| BULLET bullet
-| nat_or_var num_or_var
| fix_decl fix_body
| cofix_decl cofix_body
| constr one_term
| appl_arg arg
| rec_definition fix_definition
| corec_definition cofix_definition
-| inst evar_binding
| univ_instance univ_annot
| simple_assum_coe assumpt
| of_type_with_opt_coercion of_type
@@ -1001,5 +1569,90 @@ RENAME: [
| smart_global smart_qualid
]
+(* todo: doesn't work if up above... maybe because 'clause' doesn't exist? *)
+clause_dft_concl: [
+| OPTINREF
+]
+
+(* add in ltac and Tactic Notation tactics that appear in the doc: *)
+ltac_defined_tactics: [
+| "classical_left"
+| "classical_right"
+| "contradict" ident
+| "discrR"
+| "easy"
+| "exfalso"
+| "inversion_sigma"
+| "lia"
+| "lra"
+| "nia"
+| "nra"
+| "split_Rabs"
+| "split_Rmult"
+| "tauto"
+| "zify"
+]
+
+(* todo: need careful review; assume that "[" ... "]" are literals *)
+tactic_notation_tactics: [
+| "assert_fails" ltac_expr3
+| "assert_succeeds" ltac_expr3
+| "field" OPT ( "[" LIST1 term "]" )
+| "field_simplify" OPT ( "[" LIST1 term "]" ) LIST1 term OPT ( "in" ident )
+| "field_simplify_eq" OPT ( "[" LIST1 term "]" ) OPT ( "in" ident )
+| "intuition" OPT ltac_expr
+| "nsatz" OPT ( "with" "radicalmax" ":=" term "strategy" ":=" term "parameters" ":=" term "variables" ":=" term )
+| "psatz" term OPT int_or_var
+| "ring" OPT ( "[" LIST1 term "]" )
+| "ring_simplify" OPT ( "[" LIST1 term "]" ) LIST1 term OPT ( "in" ident ) (* todo: ident was "hyp", worth keeping? *)
+]
+
+tacticals: [
+]
+
+simple_tactic: [
+| ltac_defined_tactics
+| tactic_notation_tactics
+]
+
+(* move all commands under "command" *)
+
+DELETE: [
+| vernac
+]
+
+tactic_mode: [
+(* todo: make sure to document this production! *)
+(* deleting to allow splicing query_command into command *)
+| DELETE OPT toplevel_selector query_command
+]
+vernac_aux: [
+| DELETE gallina "."
+| DELETE gallina_ext "."
+| DELETE syntax "."
+| DELETE command_entry
+]
+
+command: [
+| gallina
+| gallina_ext
+| syntax
+| query_command
+| vernac_control
+| vernac_toplevel
+| command_entry
+]
+
+SPLICE: [
+| gallina
+| gallina_ext
+| syntax
+| query_command
+| vernac_control
+| vernac_toplevel
+| command_entry
+| ltac_defined_tactics
+| tactic_notation_tactics
+]
(* todo: ssrreflect*.rst ref to fix_body is incorrect *)
diff --git a/doc/tools/docgram/doc_grammar.ml b/doc/tools/docgram/doc_grammar.ml
index 5c9a13668f..eea1d5081d 100644
--- a/doc/tools/docgram/doc_grammar.ml
+++ b/doc/tools/docgram/doc_grammar.ml
@@ -32,6 +32,7 @@ type args = {
fullGrammar : bool;
check_tacs : bool;
check_cmds : bool;
+ no_update: bool;
show_warn : bool;
verbose : bool;
verify : bool;
@@ -43,12 +44,13 @@ let default_args = {
fullGrammar = false;
check_tacs = false;
check_cmds = false;
+ no_update = false;
show_warn = true;
verbose = false;
verify = false;
}
-let start_symbols = ["vernac_toplevel"]
+let start_symbols = ["vernacular"]
let tokens = [ "bullet"; "string"; "unicode_id_part"; "unicode_letter" ]
(* translated symbols *)
@@ -1165,7 +1167,7 @@ let apply_edit_file g edits =
in
aux tl prods' add_nt
| (Snterm "OPTINREF" :: _) :: tl ->
- if not (List.mem [] prods) then
+ if not (has_match [] prods) then
error "OPTINREF but no empty production for %s\n" nt;
global_repl g [(Snterm nt)] [(Sopt (Snterm nt))];
aux tl (remove_prod [] prods nt) add_nt
@@ -1574,7 +1576,7 @@ let reorder_grammar eg reordered_rules file =
g_reorder eg !og.map !og.order
-let finish_with_file old_file verify =
+let finish_with_file old_file args =
let files_eq f1 f2 =
let chunksize = 8192 in
(try
@@ -1605,21 +1607,24 @@ let finish_with_file old_file verify =
with Sys_error _ -> false)
in
- let temp_file = (old_file ^ "_temp") in
+ let temp_file = (old_file ^ ".new") in
if !exit_code <> 0 then
Sys.remove temp_file
- else if verify then begin
+ else if args.verify then begin
if not (files_eq old_file temp_file) then
error "%s is not current\n" old_file;
Sys.remove temp_file
- end else
+ end else if not args.no_update then
Sys.rename temp_file old_file
let open_temp_bin file =
- open_out_bin (sprintf "%s_temp" file)
+ open_out_bin (sprintf "%s.new" file)
+
+let match_cmd_regex = Str.regexp "[a-zA-Z0-9_ ]+"
let find_longest_match prods str =
- (* todo: require a minimum length? *)
+ let get_pfx str = String.trim (if Str.string_match match_cmd_regex str 0 then Str.matched_string str else "") in
+ let prods = StringSet.fold (fun a lst -> a :: lst) prods [] in (* todo: wasteful! *)
let common_prefix_len s1 s2 =
let limit = min (String.length s1) (String.length s2) in
let rec aux off =
@@ -1631,13 +1636,16 @@ let find_longest_match prods str =
in
let slen = String.length str in
+ let str_pfx = get_pfx str in
let rec longest best multi best_len prods =
match prods with
| [] -> best, multi, best_len
| prod :: tl ->
- let pstr = String.trim (prod_to_prodn prod) in
+ let pstr = String.trim prod in (* todo: should be pretrimmed *)
let clen = common_prefix_len str pstr in
- if clen = slen && slen = String.length pstr then
+ if str_pfx = "" || str_pfx <> get_pfx pstr then
+ longest best multi best_len tl (* prefixes don't match *)
+ else if clen = slen && slen = String.length pstr then
pstr, false, clen (* exact match *)
else if clen > best_len then
longest pstr false clen tl (* better match *)
@@ -1651,6 +1659,7 @@ let find_longest_match prods str =
type seen = {
nts: (string * int) NTMap.t;
tacs: (string * int) NTMap.t;
+ tacvs: (string * int) NTMap.t;
cmds: (string * int) NTMap.t;
cmdvs: (string * int) NTMap.t;
}
@@ -1659,8 +1668,9 @@ let process_rst g file args seen tac_prods cmd_prods =
let old_rst = open_in file in
let new_rst = open_temp_bin file in
let linenum = ref 0 in
- let dir_regex = Str.regexp "^\\([ \t]*\\)\\.\\.[ \t]*\\([a-zA-Z0-9:]*\\)\\(.*\\)" in
- let ig_args_regex = Str.regexp "^[ \t]*\\([a-zA-Z0-9_\\.]*\\)[ \t]*\\([a-zA-Z0-9_\\.]*\\)" in
+ let dir_regex = Str.regexp "^\\([ \t]*\\)\\.\\.[ \t]*\\([a-zA-Z0-9:]* *\\)\\(.*\\)" in
+ let contin_regex = Str.regexp "^\\([ \t]*\\)\\(.*\\)" in
+ let ip_args_regex = Str.regexp "^[ \t]*\\([a-zA-Z0-9_\\.]*\\)[ \t]*\\([a-zA-Z0-9_\\.]*\\)" in
let blank_regex = Str.regexp "^[ \t]*$" in
let end_prodlist_regex = Str.regexp "^[ \t]*$" in
let getline () =
@@ -1692,7 +1702,7 @@ let process_rst g file args seen tac_prods cmd_prods =
in
let process_insertprodn line rhs =
- if not (Str.string_match ig_args_regex rhs 0) then
+ if not (Str.string_match ip_args_regex rhs 0) then
error "%s line %d: bad arguments '%s' for 'insertprodn'\n" file !linenum rhs
else begin
let start = Str.matched_group 1 rhs in
@@ -1703,8 +1713,8 @@ let process_rst g file args seen tac_prods cmd_prods =
error "%s line %d: '%s' is undefined in insertprodn\n" file !linenum start;
if end_index = None then
error "%s line %d: '%s' is undefined in insertprodn\n" file !linenum end_;
- if start_index <> None && end_index <> None then
- check_range_consistency g start end_;
+(* if start_index <> None && end_index <> None then*)
+(* check_range_consistency g start end_;*)
match start_index, end_index with
| Some start_index, Some end_index ->
if start_index > end_index then
@@ -1716,7 +1726,7 @@ let process_rst g file args seen tac_prods cmd_prods =
error "%s line %d: expecting a blank line after 'insertprodn'\n" file !linenum
else begin
let line3 = getline() in
- if not (Str.string_match dir_regex line3 0) || (Str.matched_group 2 line3) <> "prodn::" then
+ if not (Str.string_match dir_regex line3 0) || (String.trim (Str.matched_group 2 line3)) <> "prodn::" then
error "%s line %d: expecting '.. prodn::' after 'insertprodn'\n" file !linenum
else begin
let indent = Str.matched_group 1 line3 in
@@ -1736,38 +1746,82 @@ let process_rst g file args seen tac_prods cmd_prods =
end
| _ -> ()
end
+ in
+
+(* let skip_files = ["doc/sphinx/proof-engine/ltac.rst"; "doc/sphinx/proof-engine/ltac2.rst";*)
+(* "doc/sphinx/proof-engine/ssreflect-proof-language.rst"]*)
+(* in*)
+ let cmd_replace_files = [
+ "doc/sphinx/language/gallina-specification-language.rst";
+ "doc/sphinx/language/gallina-extensions.rst"
+ ]
in
+
+ let save_n_get_more direc pfx first_rhs seen_map prods =
+ let replace rhs prods =
+ if StringSet.is_empty prods || not (List.mem file cmd_replace_files) then
+ rhs (* no change *)
+ else
+ let mtch, multi, len = find_longest_match prods rhs in
+ if mtch = rhs then
+ rhs (* no change *)
+ else if mtch = "" then begin
+ warn "%s line %d: NO MATCH `%s`\n" file !linenum rhs;
+ rhs
+ end else if multi then begin
+ warn "%s line %d: MULTIMATCH `%s`\n" file !linenum rhs;
+ rhs
+ end else
+ mtch (* update cmd/tacn *)
+ in
+ let map = ref seen_map in
+ if NTMap.mem first_rhs !map then
+ warn "%s line %d: Repeated %s: '%s'\n" file !linenum direc first_rhs;
+(* if not (StringSet.mem rhs seen_map) then*)
+(* warn "%s line %d: Unknown tactic: '%s'\n" file !linenum rhs;*)
+
+ fprintf new_rst "%s%s\n" pfx (replace first_rhs prods);
+
+ map := NTMap.add first_rhs (file, !linenum) !map;
+ while
+ let nextline = getline() in
+ ignore (Str.string_match contin_regex nextline 0);
+ let indent = Str.matched_group 1 nextline in
+ let rhs = Str.matched_group 2 nextline in
+ let replaceable = rhs <> "" && rhs.[0] <> ':' in
+ let upd_rhs = if replaceable then (replace rhs prods) else rhs in
+ fprintf new_rst "%s%s\n" indent upd_rhs;
+ if replaceable then begin
+ map := NTMap.add rhs (file, !linenum) !map
+ end;
+ rhs <> ""
+ do
+ ()
+ done;
+ !map
+ in
+
try
while true do
let line = getline() in
if Str.string_match dir_regex line 0 then begin
- let dir = Str.matched_group 2 line in
- let rhs = String.trim (Str.matched_group 3 line) in
+ let dir = String.trim (Str.matched_group 2 line) in
+ let rhs = Str.matched_group 3 line in
+ let pfx = String.sub line 0 (Str.group_end 2) in
match dir with
| "prodn::" ->
if rhs = "coq" then
warn "%s line %d: Missing 'insertprodn' before 'prodn:: coq'\n" file !linenum;
fprintf new_rst "%s\n" line;
| "tacn::" when args.check_tacs ->
- if not (StringSet.mem rhs tac_prods) then
- warn "%s line %d: Unknown tactic: '%s'\n" file !linenum rhs;
- if NTMap.mem rhs !seen.tacs then
- warn "%s line %d: Repeated tactic: '%s'\n" file !linenum rhs;
- seen := { !seen with tacs = (NTMap.add rhs (file, !linenum) !seen.tacs)};
- fprintf new_rst "%s\n" line
+ seen := { !seen with tacs = save_n_get_more "tacn" pfx rhs !seen.tacs tac_prods }
+ | "tacv::" when args.check_tacs ->
+ seen := { !seen with tacvs = save_n_get_more "tacv" pfx rhs !seen.tacvs StringSet.empty }
| "cmd::" when args.check_cmds ->
-(*
- if not (StringSet.mem rhs cmd_prods) then
- warn "%s line %d: Unknown command: '%s'\n" file !linenum rhs;
- if NTMap.mem rhs !seen.cmds then
- warn "%s line %d: Repeated command: '%s'\n" file !linenum rhs;
-*)
- seen := { !seen with cmds = (NTMap.add rhs (file, !linenum) !seen.cmds)};
- fprintf new_rst "%s\n" line
+ seen := { !seen with cmds = save_n_get_more "cmd" pfx rhs !seen.cmds cmd_prods }
| "cmdv::" when args.check_cmds ->
- seen := { !seen with cmdvs = (NTMap.add rhs (file, !linenum) !seen.cmdvs)};
- fprintf new_rst "%s\n" line
+ seen := { !seen with cmdvs = save_n_get_more "cmdv" pfx rhs !seen.cmdvs StringSet.empty }
| "insertprodn" ->
process_insertprodn line rhs
| _ -> fprintf new_rst "%s\n" line
@@ -1777,7 +1831,7 @@ let process_rst g file args seen tac_prods cmd_prods =
with End_of_file -> ();
close_in old_rst;
close_out new_rst;
- finish_with_file file args.verify
+ finish_with_file file args
let report_omitted_prods entries seen label split =
let maybe_warn first last n =
@@ -1825,7 +1879,7 @@ let process_grammar args =
"DOC_GRAMMAR";
print_in_order out g `MLG !g.order StringSet.empty;
close_out out;
- finish_with_file (dir "fullGrammar") args.verify;
+ finish_with_file (dir "fullGrammar") args;
if args.verbose then
print_special_tokens g;
@@ -1835,19 +1889,7 @@ let process_grammar args =
let common_edits = read_mlg_edit "common.edit_mlg" in
apply_edit_file g common_edits
end;
- let prodn_gram = ref { map = !g.map; order = !g.order } in
-
- if !exit_code = 0 && not args.verify then begin
- let prodlist_edits = read_mlg_edit "productionlist.edit_mlg" in
- apply_edit_file g prodlist_edits;
- let out = open_temp_bin (dir "productionlistGrammar") in
- if args.verbose then
- report_info g !symdef_map;
- print_in_order out g `PRODLIST !g.order StringSet.empty;
- (*print_chunks g out `PRODLIST ();*)
- close_out out;
- finish_with_file (dir "productionlistGrammar") args.verify;
- end;
+ let prodn_gram = ref { map = !g.map; order = !g.order } in (* todo: should just be 'g', right? *)
if !exit_code = 0 && not args.verify then begin
let out = open_temp_bin (dir "editedGrammar") in
@@ -1856,7 +1898,7 @@ let process_grammar args =
"DOC_GRAMMAR";
print_in_order out g `MLG !g.order StringSet.empty;
close_out out;
- finish_with_file (dir "editedGrammar") args.verify;
+ finish_with_file (dir "editedGrammar") args;
report_bad_nts g "editedGrammar"
end;
@@ -1864,18 +1906,20 @@ let process_grammar args =
let ordered_grammar = read_mlg_edit "orderedGrammar" in
let out = open_temp_bin (dir "orderedGrammar") in
fprintf out "%s\n%s\n\n"
- ("(* Defines the order to apply to editedGrammar to get productionlistGrammar.\n" ^
+ ("(* Defines the order to apply to editedGrammar to get the final grammar for the doc.\n" ^
"doc_grammar will modify this file to add/remove nonterminals and productions\n" ^
"to match editedGrammar, which will remove comments. Not compiled into Coq *)")
"DOC_GRAMMAR";
reorder_grammar g ordered_grammar "orderedGrammar";
print_in_order out g `MLG !g.order StringSet.empty;
close_out out;
- finish_with_file (dir "orderedGrammar") args.verify;
+ finish_with_file (dir "orderedGrammar") args;
check_singletons g
(* print_dominated g*)
end;
+ let seen = ref { nts=NTMap.empty; tacs=NTMap.empty; tacvs=NTMap.empty; cmds=NTMap.empty; cmdvs=NTMap.empty } in
+ let args = { args with no_update = false } in (* always update rsts in place for now *)
if !exit_code = 0 then begin
let plist nt =
let list = (List.map (fun t -> String.trim (prod_to_prodn t))
@@ -1883,11 +1927,12 @@ let process_grammar args =
list, StringSet.of_list list in
let tac_list, tac_prods = plist "simple_tactic" in
let cmd_list, cmd_prods = plist "command" in
- let seen = ref { nts=NTMap.empty; tacs=NTMap.empty; cmds=NTMap.empty; cmdvs=NTMap.empty } in
List.iter (fun file -> process_rst g file args seen tac_prods cmd_prods) args.rst_files;
report_omitted_prods !g.order !seen.nts "Nonterminal" "";
let out = open_out (dir "updated_rsts") in
close_out out;
+ end;
+
(*
if args.check_tacs then
report_omitted_prods tac_list !seen.tacs "Tactic" "\n ";
@@ -1895,41 +1940,48 @@ let process_grammar args =
report_omitted_prods cmd_list !seen.cmds "Command" "\n ";
*)
- let rstCmds = StringSet.of_list (List.map (fun b -> let c, _ = b in c) (NTMap.bindings !seen.cmds)) in
- let rstCmdvs = StringSet.of_list (List.map (fun b -> let c, _ = b in c) (NTMap.bindings !seen.cmdvs)) in
- let command_nts = ["command"; "gallina"; "gallina_ext"; "query_command"; "syntax"] in
+ if !exit_code = 0 then begin
+ (* generate report on cmds or tacs *)
+ let cmdReport outfile cmdStr cmd_nts cmds cmdvs =
+ let rstCmds = StringSet.of_list (List.map (fun b -> let c, _ = b in c) (NTMap.bindings cmds)) in
+ let rstCmdvs = StringSet.of_list (List.map (fun b -> let c, _ = b in c) (NTMap.bindings cmdvs)) in
+ let gramCmds = List.fold_left (fun set nt ->
+ StringSet.union set (StringSet.of_list (List.map (fun p -> String.trim (prod_to_prodn p)) (NTMap.find nt !prodn_gram.map)))
+ ) StringSet.empty cmd_nts in
+ let allCmds = StringSet.union rstCmdvs (StringSet.union rstCmds gramCmds) in
+ let out = open_temp_bin (dir outfile) in
+ StringSet.iter (fun c ->
+ let rsts = StringSet.mem c rstCmds in
+ let gram = StringSet.mem c gramCmds in
+ let pfx = match rsts, gram with
+ | true, false -> "+"
+ | false, true -> "-"
+ | false, false -> "?"
+ | _, _ -> " "
+ in
+ let var = if StringSet.mem c rstCmdvs then "v" else " " in
+ fprintf out "%s%s %s\n" pfx var c)
+ allCmds;
+ close_out out;
+ finish_with_file (dir outfile) args;
+ Printf.printf "# %s in rsts, gram, total = %d %d %d\n" cmdStr (StringSet.cardinal gramCmds)
+ (StringSet.cardinal rstCmds) (StringSet.cardinal allCmds);
+ in
+
+ let cmd_nts = ["command"] in
(* TODO: need to handle tactic_mode (overlaps with query_command) and subprf *)
- let gramCmds = List.fold_left (fun set nt ->
- StringSet.union set (StringSet.of_list (List.map (fun p -> String.trim (prod_to_prodn p)) (NTMap.find nt !prodn_gram.map)))
- ) StringSet.empty command_nts in
-
- let allCmds = StringSet.union rstCmdvs (StringSet.union rstCmds gramCmds) in
- let out = open_out_bin (dir "prodnCommands") in
- StringSet.iter (fun c ->
- let rsts = StringSet.mem c rstCmds in
- let gram = StringSet.mem c gramCmds in
- let pfx = match rsts, gram with
- | true, false -> "+"
- | false, true -> "-"
- | false, false -> "?"
- | _, _ -> " "
- in
- let var = if StringSet.mem c rstCmdvs then "v" else " " in
- fprintf out "%s%s %s\n" pfx var c)
- allCmds;
- close_out out;
- Printf.printf "# cmds in rsts, gram, total = %d %d %d\n" (StringSet.cardinal gramCmds)
- (StringSet.cardinal rstCmds) (StringSet.cardinal allCmds);
+ cmdReport "prodnCommands" "cmds" cmd_nts !seen.cmds !seen.cmdvs;
+
+ let tac_nts = ["simple_tactic"] in
+ cmdReport "prodnTactics" "tacs" tac_nts !seen.tacs !seen.tacvs
end;
- (* generate output for prodn: simple_tactic, command, also for Ltac?? *)
+ (* generate prodnGrammar for reference *)
if !exit_code = 0 && not args.verify then begin
- let prodn_edits = read_mlg_edit "prodn.edit_mlg" in
- apply_edit_file prodn_gram prodn_edits;
let out = open_temp_bin (dir "prodnGrammar") in
print_in_order out prodn_gram `PRODN !prodn_gram.order StringSet.empty;
close_out out;
- finish_with_file (dir "prodnGrammar") args.verify
+ finish_with_file (dir "prodnGrammar") args
end
end
@@ -1941,6 +1993,7 @@ let parse_args () =
| "-check-cmds" -> { args with check_cmds = true }
| "-check-tacs" -> { args with check_tacs = true }
| "-no-warn" -> show_warn := false; { args with show_warn = true }
+ | "-no-update" -> { args with no_update = true }
| "-short" -> { args with fullGrammar = true }
| "-verbose" -> { args with verbose = true }
| "-verify" -> { args with verify = true }
diff --git a/doc/tools/docgram/dune b/doc/tools/docgram/dune
index 3afa21f2cf..fba4856241 100644
--- a/doc/tools/docgram/dune
+++ b/doc/tools/docgram/dune
@@ -5,26 +5,47 @@
(env (_ (binaries doc_grammar.exe)))
(rule
- (targets fullGrammar)
+ (alias check-gram)
(deps
- ; Main grammar
- (glob_files %{project_root}/parsing/*.mlg)
- (glob_files %{project_root}/toplevel/*.mlg)
- (glob_files %{project_root}/vernac/*.mlg)
- ; All plugins except SSReflect for now (mimicking what is done in Makefile.doc)
- (glob_files %{project_root}/plugins/btauto/*.mlg)
- (glob_files %{project_root}/plugins/cc/*.mlg)
- (glob_files %{project_root}/plugins/derive/*.mlg)
- (glob_files %{project_root}/plugins/extraction/*.mlg)
- (glob_files %{project_root}/plugins/firstorder/*.mlg)
- (glob_files %{project_root}/plugins/funind/*.mlg)
- (glob_files %{project_root}/plugins/ltac/*.mlg)
- (glob_files %{project_root}/plugins/micromega/*.mlg)
- (glob_files %{project_root}/plugins/nsatz/*.mlg)
- (glob_files %{project_root}/plugins/omega/*.mlg)
- (glob_files %{project_root}/plugins/rtauto/*.mlg)
- (glob_files %{project_root}/plugins/setoid_ring/*.mlg)
- (glob_files %{project_root}/plugins/syntax/*.mlg))
+ (:input
+ ; Main grammar
+ (glob_files %{project_root}/parsing/*.mlg)
+ (glob_files %{project_root}/toplevel/*.mlg)
+ (glob_files %{project_root}/vernac/*.mlg)
+ ; All plugins except SSReflect and Ltac2 for now (mimicking what is done in Makefile.doc)
+ (glob_files %{project_root}/plugins/btauto/*.mlg)
+ (glob_files %{project_root}/plugins/cc/*.mlg)
+ (glob_files %{project_root}/plugins/derive/*.mlg)
+ (glob_files %{project_root}/plugins/extraction/*.mlg)
+ (glob_files %{project_root}/plugins/firstorder/*.mlg)
+ (glob_files %{project_root}/plugins/funind/*.mlg)
+ (glob_files %{project_root}/plugins/ltac/*.mlg)
+ (glob_files %{project_root}/plugins/micromega/*.mlg)
+ (glob_files %{project_root}/plugins/nsatz/*.mlg)
+ (glob_files %{project_root}/plugins/omega/*.mlg)
+ (glob_files %{project_root}/plugins/rtauto/*.mlg)
+ (glob_files %{project_root}/plugins/setoid_ring/*.mlg)
+ (glob_files %{project_root}/plugins/syntax/*.mlg)
+ ; Sphinx files
+ (glob_files %{project_root}/doc/sphinx/language/*.rst)
+ (glob_files %{project_root}/doc/sphinx/proof-engine/*.rst)
+ (glob_files %{project_root}/doc/sphinx/user-extensions/*.rst)
+ (glob_files %{project_root}/doc/sphinx/practical-tools/*.rst)
+ (glob_files %{project_root}/doc/sphinx/addendum/*.rst)
+ (glob_files %{project_root}/doc/sphinx/language/core/*.rst)
+ (glob_files %{project_root}/doc/sphinx/language/extensions/*.rst)
+ (glob_files %{project_root}/doc/sphinx/proofs/writing-proofs/*.rst)
+ (glob_files %{project_root}/doc/sphinx/proofs/automatic-tactics/*.rst)
+ (glob_files %{project_root}/doc/sphinx/proofs/creating-tactics/*.rst)
+ (glob_files %{project_root}/doc/sphinx/using/libraries/*.rst)
+ (glob_files %{project_root}/doc/sphinx/using/tools/*.rst))
+ common.edit_mlg
+ orderedGrammar)
(action
- (chdir %{project_root} (run doc_grammar -short -no-warn %{deps})))
- (mode promote))
+ (progn
+ (bash "for f in fullGrammar orderedGrammar; do cp ${f} ${f}.old; done")
+ (chdir %{project_root} (run doc_grammar -check-cmds %{input}))
+ (bash "for f in fullGrammar orderedGrammar; do cp ${f} ${f}.new; done")
+ (bash "for f in fullGrammar orderedGrammar; do cp ${f}.old ${f}; done")
+ (diff? fullGrammar fullGrammar.new)
+ (diff? orderedGrammar orderedGrammar.new))))
diff --git a/doc/tools/docgram/fullGrammar b/doc/tools/docgram/fullGrammar
index 6897437457..272d17bb35 100644
--- a/doc/tools/docgram/fullGrammar
+++ b/doc/tools/docgram/fullGrammar
@@ -386,11 +386,6 @@ fullyqualid: [
| ident
]
-basequalid: [
-| ident fields
-| ident
-]
-
name: [
| "_"
| ident
@@ -401,6 +396,10 @@ reference: [
| ident
]
+qualid: [
+| reference
+]
+
by_notation: [
| ne_string OPT [ "%" IDENT ]
]
@@ -410,10 +409,6 @@ smart_global: [
| by_notation
]
-qualid: [
-| basequalid
-]
-
ne_string: [
| STRING
]
@@ -435,17 +430,21 @@ lstring: [
]
integer: [
-| NUMERAL
-| "-" NUMERAL
+| bigint
]
natural: [
-| NUMERAL
+| bignat
| _natural
]
bigint: [
| NUMERAL
+| test_minus_nat "-" NUMERAL
+]
+
+bignat: [
+| NUMERAL
]
bar_cbrace: [
@@ -735,21 +734,22 @@ attribute_value: [
|
]
-vernac: [
-| "Local" vernac_poly
-| "Global" vernac_poly
-| vernac_poly
+legacy_attr: [
+| "Local"
+| "Global"
+| "Polymorphic"
+| "Monomorphic"
+| "Cumulative"
+| "NonCumulative"
+| "Private"
+| "Program"
]
-vernac_poly: [
-| "Polymorphic" vernac_aux
-| "Monomorphic" vernac_aux
-| vernac_aux
+vernac: [
+| LIST0 legacy_attr vernac_aux
]
vernac_aux: [
-| "Program" gallina "."
-| "Program" gallina_ext "."
| gallina "."
| gallina_ext "."
| command "."
@@ -774,7 +774,7 @@ gallina: [
| assumptions_token inline assum_list
| def_token ident_decl def_body
| "Let" identref def_body
-| OPT cumulativity_token private_token finite_token LIST1 inductive_definition SEP "with"
+| finite_token LIST1 inductive_definition SEP "with"
| "Fixpoint" LIST1 rec_definition SEP "with"
| "Let" "Fixpoint" LIST1 rec_definition SEP "with"
| "CoFixpoint" LIST1 corec_definition SEP "with"
@@ -903,16 +903,6 @@ finite_token: [
| "Class"
]
-cumulativity_token: [
-| "Cumulative"
-| "NonCumulative"
-]
-
-private_token: [
-| "Private"
-|
-]
-
def_body: [
| binders ":=" reduce lconstr
| binders ":" lconstr ":=" reduce lconstr
@@ -1254,8 +1244,6 @@ query_command: [
| "SearchPattern" constr_pattern in_or_out_modules "."
| "SearchRewrite" constr_pattern in_or_out_modules "."
| "Search" searchabout_query searchabout_queries "."
-| "SearchAbout" searchabout_query searchabout_queries "."
-| "SearchAbout" "[" LIST1 searchabout_query "]" in_or_out_modules "."
]
printable: [
@@ -2464,8 +2452,6 @@ as_or_and_ipat: [
eqn_ipat: [
| "eqn" ":" naming_intropattern
-| "_eqn" ":" naming_intropattern
-| "_eqn"
|
]
@@ -2530,7 +2516,7 @@ field_mods: [
numnotoption: [
|
-| "(" "warning" "after" bigint ")"
-| "(" "abstract" "after" bigint ")"
+| "(" "warning" "after" bignat ")"
+| "(" "abstract" "after" bignat ")"
]
diff --git a/doc/tools/docgram/orderedGrammar b/doc/tools/docgram/orderedGrammar
index f26a174722..0c9d7a853b 100644
--- a/doc/tools/docgram/orderedGrammar
+++ b/doc/tools/docgram/orderedGrammar
@@ -1,19 +1,9 @@
-(* Defines the order to apply to editedGrammar to get productionlistGrammar.
+(* Defines the order to apply to editedGrammar to get the final grammar for the doc.
doc_grammar will modify this file to add/remove nonterminals and productions
to match editedGrammar, which will remove comments. Not compiled into Coq *)
DOC_GRAMMAR
-vernac_toplevel: [
-| "Drop" "."
-| "Quit" "."
-| "BackTo" num "."
-| "Show" "Goal" num "at" num "."
-| "Show" "Proof" "Diffs" OPT "removed" "."
-| vernac_control
-]
-
tactic_mode: [
-| OPT toplevel_selector query_command
| OPT toplevel_selector "{"
| OPT toplevel_selector OPT ( "Info" num ) ltac_expr ltac_use_default
| "par" ":" OPT ( "Info" num ) ltac_expr ltac_use_default
@@ -24,14 +14,6 @@ ltac_use_default: [
| "..."
]
-vernac_control: [
-| "Time" vernac_control
-| "Redirect" string vernac_control
-| "Timeout" num vernac_control
-| "Fail" vernac_control
-| LIST0 ( "#[" LIST0 attr SEP "," "]" ) vernac
-]
-
term: [
| "forall" open_binders "," term
| "fun" open_binders "=>" term
@@ -96,11 +78,7 @@ term_projection: [
term_evar: [
| "?[" ident "]"
| "?[" "?" ident "]"
-| "?" ident OPT ( "@{" LIST1 evar_binding SEP ";" "}" )
-]
-
-evar_binding: [
-| ident ":=" term
+| "?" ident OPT ( "@{" LIST1 ( ident ":=" term ) SEP ";" "}" )
]
dangling_pattern_extension_rule: [
@@ -167,12 +145,28 @@ subsequent_letter: [
| [ first_letter | digit | "'" | unicode_id_part ]
]
+firstorder_rhs: [
+| OPT firstorder_using
+| "with" LIST1 ident
+| OPT firstorder_using "with" LIST1 ident
+]
+
+where: [
+| "at" "top"
+| "at" "bottom"
+| "after" ident
+| "before" ident
+]
+
vernacular: [
| LIST0 ( OPT all_attrs [ command | ltac_expr ] "." )
]
+tacticals: [
+]
+
all_attrs: [
-| LIST0 ( "#[" LIST0 attr SEP "," "]" ) OPT legacy_attrs
+| LIST0 ( "#[" LIST0 attr SEP "," "]" ) LIST0 legacy_attr
]
attr: [
@@ -184,8 +178,12 @@ attr_value: [
| "(" LIST0 attr SEP "," ")"
]
-legacy_attrs: [
-| OPT [ "Local" | "Global" ] OPT [ "Polymorphic" | "Monomorphic" ] OPT "Program" OPT [ "Cumulative" | "NonCumulative" ] OPT "Private"
+legacy_attr: [
+| [ "Local" | "Global" ]
+| [ "Polymorphic" | "Monomorphic" ]
+| [ "Cumulative" | "NonCumulative" ]
+| "Private"
+| "Program"
]
sort: [
@@ -278,13 +276,21 @@ binder: [
| name
| "(" LIST1 name ":" type ")"
| "(" name OPT ( ":" type ) ":=" term ")"
+| implicit_binders
+| generalizing_binder
| "(" name ":" type "|" term ")"
+| "'" pattern0
+]
+
+implicit_binders: [
| "{" LIST1 name OPT ( ":" type ) "}"
| "[" LIST1 name OPT ( ":" type ) "]"
+]
+
+generalizing_binder: [
| "`(" LIST1 typeclass_constraint SEP "," ")"
| "`{" LIST1 typeclass_constraint SEP "," "}"
| "`[" LIST1 typeclass_constraint SEP "," "]"
-| "'" pattern0
]
typeclass_constraint: [
@@ -337,28 +343,10 @@ pattern0: [
| string
]
-vernac: [
-| "Local" vernac_poly
-| "Global" vernac_poly
-| vernac_poly
-]
-
-vernac_poly: [
-| "Polymorphic" vernac_aux
-| "Monomorphic" vernac_aux
-| vernac_aux
-]
-
vernac_aux: [
-| "Program" gallina "."
-| "Program" gallina_ext "."
-| gallina "."
-| gallina_ext "."
| command "."
| tactic_mode "."
-| syntax "."
| subprf
-| query_command
]
subprf: [
@@ -367,30 +355,6 @@ subprf: [
| "}"
]
-gallina: [
-| thm_token ident_decl LIST0 binder ":" type LIST0 [ "with" ident_decl LIST0 binder ":" type ]
-| assumption_token OPT ( "Inline" OPT ( "(" num ")" ) ) [ LIST1 ( "(" assumpt ")" ) | assumpt ]
-| [ "Definition" | "Example" ] ident_decl def_body
-| "Let" ident def_body
-| "Inductive" inductive_definition LIST0 ( "with" inductive_definition )
-| "CoInductive" inductive_definition LIST0 ( "with" inductive_definition )
-| "Variant" inductive_definition LIST0 ( "with" inductive_definition )
-| [ "Record" | "Structure" ] inductive_definition LIST0 ( "with" inductive_definition )
-| "Class" inductive_definition LIST0 ( "with" inductive_definition )
-| "Fixpoint" fix_definition LIST0 ( "with" fix_definition )
-| "Let" "Fixpoint" fix_definition LIST0 ( "with" fix_definition )
-| "CoFixpoint" cofix_definition LIST0 ( "with" cofix_definition )
-| "Let" "CoFixpoint" cofix_definition LIST0 ( "with" cofix_definition )
-| "Scheme" scheme LIST0 ( "with" scheme )
-| "Combined" "Scheme" ident "from" LIST1 ident SEP ","
-| "Register" qualid "as" qualid
-| "Register" "Inline" qualid
-| "Primitive" ident OPT [ ":" term ] ":=" register_token
-| "Universe" LIST1 ident
-| "Universes" LIST1 ident
-| "Constraint" LIST1 univ_constraint SEP ","
-]
-
fix_definition: [
| ident_decl LIST0 binder OPT fixannot OPT ( ":" type ) OPT [ ":=" term ] OPT decl_notations
]
@@ -404,12 +368,8 @@ decl_notation: [
]
register_token: [
-| register_prim_token
| "#int63_type"
| "#float64_type"
-]
-
-register_prim_token: [
| "#int63_head0"
| "#int63_tail0"
| "#int63_add"
@@ -493,15 +453,6 @@ delta_flag: [
| OPT "-" "[" LIST1 smart_qualid "]"
]
-smart_qualid: [
-| qualid
-| by_notation
-]
-
-by_notation: [
-| string OPT [ "%" ident ]
-]
-
strategy_flag: [
| LIST1 red_flags
| delta_flag
@@ -523,13 +474,8 @@ ref_or_pattern_occ: [
]
occs_nums: [
-| LIST1 num_or_var
-| "-" num_or_var LIST0 int_or_var
-]
-
-num_or_var: [
-| num
-| ident
+| LIST1 [ num | ident ]
+| "-" [ num | ident ] LIST0 int_or_var
]
int_or_var: [
@@ -554,17 +500,12 @@ finite_token: [
| "Class"
]
-inductive_definition: [
-| OPT ">" ident_decl LIST0 binder OPT [ "|" LIST0 binder ] OPT [ ":" type ] OPT ( ":=" OPT constructors_or_record ) OPT decl_notations
+variant_definition: [
+| ident_decl LIST0 binder OPT [ "|" LIST0 binder ] OPT [ ":" type ] ":=" OPT "|" LIST1 constructor SEP "|" OPT decl_notations
]
-constructors_or_record: [
-| OPT "|" LIST1 constructor SEP "|"
-| OPT ident "{" LIST1 record_field SEP ";" "}"
-]
-
-constructor: [
-| ident LIST0 binder OPT of_type
+record_definition: [
+| OPT ">" ident_decl LIST0 binder OPT [ ":" type ] OPT ident "{" LIST0 record_field SEP ";" "}" OPT decl_notations
]
record_field: [
@@ -577,13 +518,21 @@ field_body: [
| LIST0 binder ":=" term
]
-cofix_definition: [
-| ident_decl LIST0 binder OPT ( ":" type ) OPT [ ":=" term ] OPT decl_notations
+inductive_definition: [
+| OPT ">" ident_decl LIST0 binder OPT [ "|" LIST0 binder ] OPT [ ":" type ] OPT ( ":=" OPT constructors_or_record ) OPT decl_notations
+]
+
+constructors_or_record: [
+| OPT "|" LIST1 constructor SEP "|"
+| OPT ident "{" LIST0 record_field SEP ";" "}"
+]
+
+constructor: [
+| ident LIST0 binder OPT of_type
]
-scheme: [
-| scheme_kind
-| ident ":=" scheme_kind
+cofix_definition: [
+| ident_decl LIST0 binder OPT ( ":" type ) OPT [ ":=" term ] OPT decl_notations
]
scheme_kind: [
@@ -601,60 +550,12 @@ sort_family: [
| "Type"
]
-gallina_ext: [
-| "Module" OPT export_token ident LIST0 module_binder of_module_type OPT is_module_expr
-| "Module" "Type" ident LIST0 module_binder LIST0 ( "<:" module_type_inl ) OPT is_module_type
-| "Declare" "Module" OPT export_token ident LIST0 module_binder ":" module_type_inl
-| "Section" ident
-| "Chapter" ident
-| "End" ident
-| "Collection" ident ":=" section_subset_expr
-| "Require" OPT export_token LIST1 qualid
-| "From" qualid "Require" OPT export_token LIST1 qualid
-| "Import" LIST1 qualid
-| "Export" LIST1 qualid
-| "Include" module_type_inl LIST0 ( "<+" module_expr_inl )
-| "Include" "Type" module_type_inl LIST0 ( "<+" module_type_inl )
-| "Transparent" LIST1 smart_qualid
-| "Opaque" LIST1 smart_qualid
-| "Strategy" LIST1 [ strategy_level "[" LIST1 smart_qualid "]" ]
-| "Canonical" OPT "Structure" qualid OPT [ OPT univ_decl def_body ]
-| "Canonical" OPT "Structure" by_notation
-| "Coercion" qualid OPT univ_decl def_body
-| "Identity" "Coercion" ident ":" class ">->" class
-| "Coercion" qualid ":" class ">->" class
-| "Coercion" by_notation ":" class ">->" class
-| "Context" LIST1 binder
-| "Instance" instance_name ":" term hint_info [ ":=" "{" [ LIST1 field_def SEP ";" | ] "}" | ":=" term | ]
-| "Existing" "Instance" qualid hint_info
-| "Existing" "Instances" LIST1 qualid OPT [ "|" num ]
-| "Existing" "Class" qualid
-| "Arguments" smart_qualid LIST0 argument_spec_block LIST0 [ "," LIST0 more_implicits_block ] OPT [ ":" LIST1 arguments_modifier SEP "," ]
-| "Implicit" "Type" reserv_list
-| "Implicit" "Types" reserv_list
-| "Generalizable" [ "All" "Variables" | "No" "Variables" | [ "Variable" | "Variables" ] LIST1 ident ]
-| "Export" "Set" LIST1 ident option_setting
-| "Export" "Unset" LIST1 ident
-]
-
-option_setting: [
-|
-| int
-| string
-]
-
hint_info: [
| "|" OPT num OPT one_term
-|
-]
-
-export_token: [
-| "Import"
-| "Export"
]
module_binder: [
-| "(" OPT export_token LIST1 ident ":" module_type_inl ")"
+| "(" OPT [ "Import" | "Export" ] LIST1 ident ":" module_type_inl ")"
]
module_type_inl: [
@@ -662,6 +563,11 @@ module_type_inl: [
| module_type OPT functor_app_annot
]
+functor_app_annot: [
+| "[" "inline" "at" "level" num "]"
+| "[" "no" "inline" "]"
+]
+
module_type: [
| qualid
| "(" module_type ")"
@@ -674,9 +580,9 @@ with_declaration: [
| "Module" qualid ":=" qualid
]
-functor_app_annot: [
-| "[" "inline" "at" "level" num "]"
-| "[" "no" "inline" "]"
+module_expr_atom: [
+| qualid
+| "(" LIST1 module_expr_atom ")"
]
of_module_type: [
@@ -684,27 +590,18 @@ of_module_type: [
| LIST0 ( "<:" module_type_inl )
]
-is_module_type: [
-| ":=" module_type_inl LIST0 ( "<+" module_type_inl )
+module_expr_inl: [
+| "!" LIST1 module_expr_atom
+| LIST1 module_expr_atom OPT functor_app_annot
]
-module_expr_atom: [
+smart_qualid: [
| qualid
-| "(" module_expr ")"
-]
-
-module_expr: [
-| module_expr_atom
-| module_expr module_expr_atom
-]
-
-is_module_expr: [
-| ":=" module_expr_inl LIST0 ( "<+" module_expr_inl )
+| by_notation
]
-module_expr_inl: [
-| "!" module_expr
-| module_expr OPT functor_app_annot
+by_notation: [
+| string OPT [ "%" ident ]
]
argument_spec_block: [
@@ -747,31 +644,21 @@ strategy_level: [
| "transparent"
]
-instance_name: [
-| ident_decl LIST0 binder
-|
-]
-
reserv_list: [
-| LIST1 reserv_tuple
+| LIST1 ( "(" simple_reserv ")" )
| simple_reserv
]
-reserv_tuple: [
-| "(" simple_reserv ")"
-]
-
simple_reserv: [
-| LIST1 ident ":" term
+| LIST1 ident ":" type
]
command: [
| "Goal" term
| "Declare" "Scope" ident
| "Pwd"
-| "Cd"
-| "Cd" string
-| "Load" [ "Verbose" | ] [ string | ident ]
+| "Cd" OPT string
+| "Load" OPT "Verbose" [ string | ident ]
| "Declare" "ML" "Module" LIST1 string
| "Locate" locatable
| "Add" "LoadPath" string "as" dirpath
@@ -821,101 +708,61 @@ command: [
| "Print" "Namespace" dirpath
| "Inspect" num
| "Add" "ML" "Path" string
-| "Set" LIST1 ident option_setting
-| "Unset" LIST1 ident
+| OPT "Export" "Set" LIST1 ident OPT [ int | string ]
+| OPT "Export" "Unset" LIST1 ident
| "Print" "Table" LIST1 ident
-| "Add" ident ident LIST1 option_ref_value
-| "Add" ident LIST1 option_ref_value
-| "Test" LIST1 ident "for" LIST1 option_ref_value
-| "Test" LIST1 ident
-| "Remove" ident ident LIST1 option_ref_value
-| "Remove" ident LIST1 option_ref_value
-| "Write" "State" ident
-| "Write" "State" string
-| "Restore" "State" ident
-| "Restore" "State" string
+| "Add" ident OPT ident LIST1 [ qualid | string ]
+| "Test" LIST1 ident OPT ( "for" LIST1 [ qualid | string ] )
+| "Remove" OPT ident ident LIST1 [ qualid | string ]
+| "Write" "State" [ ident | string ]
+| "Restore" "State" [ ident | string ]
| "Reset" "Initial"
| "Reset" ident
-| "Back"
-| "Back" num
-| "Debug" "On"
-| "Debug" "Off"
+| "Back" OPT num
+| "Debug" [ "On" | "Off" ]
| "Declare" "Reduction" ident ":=" red_expr
| "Declare" "Custom" "Entry" ident
| "Derive" ident "SuchThat" one_term "As" ident (* derive plugin *)
| "Proof"
| "Proof" "Mode" string
| "Proof" term
-| "Abort"
-| "Abort" "All"
-| "Abort" ident
-| "Existential" num constr_body
+| "Abort" OPT [ "All" | ident ]
+| "Existential" num OPT ( ":" term ) ":=" term
| "Admitted"
| "Qed"
| "Save" ident
-| "Defined"
-| "Defined" ident
+| "Defined" OPT ident
| "Restart"
-| "Undo"
-| "Undo" num
-| "Undo" "To" num
-| "Focus"
-| "Focus" num
+| "Undo" OPT ( OPT "To" num )
+| "Focus" OPT num
| "Unfocus"
| "Unfocused"
-| "Show"
-| "Show" num
-| "Show" ident
+| "Show" OPT [ ident | num ]
| "Show" "Existentials"
| "Show" "Universes"
| "Show" "Conjectures"
-| "Show" "Proof"
+| "Show" "Proof" OPT ( "Diffs" OPT "removed" )
| "Show" "Intro"
| "Show" "Intros"
| "Show" "Match" qualid
| "Guarded"
-| "Create" "HintDb" ident [ "discriminated" | ]
-| "Remove" "Hints" LIST1 qualid opt_hintbases
-| "Hint" hint opt_hintbases
+| "Create" "HintDb" ident OPT "discriminated"
+| "Remove" "Hints" LIST1 qualid OPT ( ":" LIST1 ident )
+| "Hint" hint OPT ( ":" LIST1 ident )
| "Comments" LIST0 comment
-| "Declare" "Instance" ident_decl LIST0 binder ":" term hint_info
-| "Obligation" int "of" ident ":" term withtac
-| "Obligation" int "of" ident withtac
-| "Obligation" int ":" term withtac
-| "Obligation" int withtac
-| "Next" "Obligation" "of" ident withtac
-| "Next" "Obligation" withtac
-| "Solve" "Obligation" int "of" ident "with" ltac_expr
-| "Solve" "Obligation" int "with" ltac_expr
-| "Solve" "Obligations" "of" ident "with" ltac_expr
-| "Solve" "Obligations" "with" ltac_expr
-| "Solve" "Obligations"
-| "Solve" "All" "Obligations" "with" ltac_expr
-| "Solve" "All" "Obligations"
-| "Admit" "Obligations" "of" ident
-| "Admit" "Obligations"
+| "Declare" "Instance" ident_decl LIST0 binder ":" term OPT hint_info
+| "Obligation" int OPT ( "of" ident ) OPT ( ":" term OPT ( "with" ltac_expr ) )
+| "Next" "Obligation" OPT ( "of" ident ) OPT ( "with" ltac_expr )
+| "Solve" "Obligation" int OPT ( "of" ident ) "with" ltac_expr
+| "Solve" "Obligations" OPT ( OPT ( "of" ident ) "with" ltac_expr )
+| "Solve" "All" "Obligations" OPT ( "with" ltac_expr )
+| "Admit" "Obligations" OPT ( "of" ident )
| "Obligation" "Tactic" ":=" ltac_expr
| "Show" "Obligation" "Tactic"
-| "Obligations" "of" ident
-| "Obligations"
-| "Preterm" "of" ident
-| "Preterm"
-| "Add" "Relation" one_term one_term "reflexivity" "proved" "by" one_term "symmetry" "proved" "by" one_term "as" ident
-| "Add" "Relation" one_term one_term "reflexivity" "proved" "by" one_term "as" ident
-| "Add" "Relation" one_term one_term "as" ident
-| "Add" "Relation" one_term one_term "symmetry" "proved" "by" one_term "as" ident
-| "Add" "Relation" one_term one_term "symmetry" "proved" "by" one_term "transitivity" "proved" "by" one_term "as" ident
-| "Add" "Relation" one_term one_term "reflexivity" "proved" "by" one_term "transitivity" "proved" "by" one_term "as" ident
-| "Add" "Relation" one_term one_term "reflexivity" "proved" "by" one_term "symmetry" "proved" "by" one_term "transitivity" "proved" "by" one_term "as" ident
-| "Add" "Relation" one_term one_term "transitivity" "proved" "by" one_term "as" ident
-| "Add" "Parametric" "Relation" LIST0 binder ":" one_term one_term "reflexivity" "proved" "by" one_term "symmetry" "proved" "by" one_term "as" ident
-| "Add" "Parametric" "Relation" LIST0 binder ":" one_term one_term "reflexivity" "proved" "by" one_term "as" ident
-| "Add" "Parametric" "Relation" LIST0 binder ":" one_term one_term "as" ident
-| "Add" "Parametric" "Relation" LIST0 binder ":" one_term one_term "symmetry" "proved" "by" one_term "as" ident
-| "Add" "Parametric" "Relation" LIST0 binder ":" one_term one_term "symmetry" "proved" "by" one_term "transitivity" "proved" "by" one_term "as" ident
-| "Add" "Parametric" "Relation" LIST0 binder ":" one_term one_term "reflexivity" "proved" "by" one_term "transitivity" "proved" "by" one_term "as" ident
-| "Add" "Parametric" "Relation" LIST0 binder ":" one_term one_term "reflexivity" "proved" "by" one_term "symmetry" "proved" "by" one_term "transitivity" "proved" "by" one_term "as" ident
-| "Add" "Parametric" "Relation" LIST0 binder ":" one_term one_term "transitivity" "proved" "by" one_term "as" ident
+| "Obligations" OPT ( "of" ident )
+| "Preterm" OPT ( "of" ident )
+| "Add" "Relation" one_term one_term OPT ( "reflexivity" "proved" "by" one_term ) OPT ( "symmetry" "proved" "by" one_term ) OPT ( "transitivity" "proved" "by" one_term ) "as" ident
+| "Add" "Parametric" "Relation" LIST0 binder ":" one_term one_term OPT ( "reflexivity" "proved" "by" one_term ) OPT ( "symmetry" "proved" "by" one_term ) OPT ( "transitivity" "proved" "by" one_term ) "as" ident
| "Add" "Setoid" one_term one_term one_term "as" ident
| "Add" "Parametric" "Setoid" LIST0 binder ":" one_term one_term one_term "as" ident
| "Add" "Morphism" one_term ":" ident
@@ -929,9 +776,7 @@ command: [
| "Optimize" "Proof"
| "Optimize" "Heap"
| "Reset" "Ltac" "Profile"
-| "Show" "Ltac" "Profile"
-| "Show" "Ltac" "Profile" "CutOff" int
-| "Show" "Ltac" "Profile" string
+| "Show" "Ltac" "Profile" OPT [ "CutOff" int | string ]
| "Show" "Lia" "Profile" (* micromega plugin *)
| "Add" "InjTyp" one_term (* micromega plugin *)
| "Add" "BinOp" one_term (* micromega plugin *)
@@ -952,10 +797,10 @@ command: [
| "Show" "Zify" "BinRel" (* micromega plugin *)
| "Show" "Zify" "Spec" (* micromega plugin *)
| "Add" "Ring" ident ":" one_term OPT ( "(" LIST1 ring_mod SEP "," ")" ) (* setoid_ring plugin *)
-| "Hint" "Cut" "[" hints_path "]" opthints
+| "Hint" "Cut" "[" hints_path "]" OPT ( ":" LIST1 ident )
| "Typeclasses" "Transparent" LIST0 qualid
| "Typeclasses" "Opaque" LIST0 qualid
-| "Typeclasses" "eauto" ":=" debug eauto_search_strategy OPT int
+| "Typeclasses" "eauto" ":=" OPT "debug" OPT [ "(bfs)" | "(dfs)" ] OPT int
| "Proof" "with" ltac_expr OPT [ "using" section_subset_expr ]
| "Proof" "using" section_subset_expr OPT [ "with" ltac_expr ]
| "Tactic" "Notation" OPT ( "(" "at" "level" num ")" ) LIST1 ltac_production_item ":=" ltac_expr
@@ -984,20 +829,15 @@ command: [
| "Extraction" "Blacklist" LIST1 ident (* extraction plugin *)
| "Print" "Extraction" "Blacklist" (* extraction plugin *)
| "Reset" "Extraction" "Blacklist" (* extraction plugin *)
-| "Extract" "Constant" qualid LIST0 string "=>" mlname (* extraction plugin *)
-| "Extract" "Inlined" "Constant" qualid "=>" mlname (* extraction plugin *)
-| "Extract" "Inductive" qualid "=>" mlname "[" LIST0 mlname "]" OPT string (* extraction plugin *)
+| "Extract" "Constant" qualid LIST0 string "=>" [ ident | string ] (* extraction plugin *)
+| "Extract" "Inlined" "Constant" qualid "=>" [ ident | string ] (* extraction plugin *)
+| "Extract" "Inductive" qualid "=>" [ ident | string ] "[" LIST0 [ ident | string ] "]" OPT string (* extraction plugin *)
| "Show" "Extraction" (* extraction plugin *)
| "Functional" "Case" fun_scheme_arg (* funind plugin *)
| "Generate" "graph" "for" qualid (* funind plugin *)
-| "Hint" "Rewrite" orient LIST1 one_term ":" LIST0 ident
-| "Hint" "Rewrite" orient LIST1 one_term "using" ltac_expr ":" LIST0 ident
-| "Hint" "Rewrite" orient LIST1 one_term
-| "Hint" "Rewrite" orient LIST1 one_term "using" ltac_expr
-| "Derive" "Inversion_clear" ident "with" one_term "Sort" sort_family
-| "Derive" "Inversion_clear" ident "with" one_term
-| "Derive" "Inversion" ident "with" one_term "Sort" sort_family
-| "Derive" "Inversion" ident "with" one_term
+| "Hint" "Rewrite" OPT [ "->" | "<-" ] LIST1 one_term OPT ( "using" ltac_expr ) OPT ( ":" LIST0 ident )
+| "Derive" "Inversion_clear" ident "with" one_term OPT ( "Sort" sort_family )
+| "Derive" "Inversion" ident "with" one_term OPT ( "Sort" sort_family )
| "Derive" "Dependent" "Inversion" ident "with" one_term "Sort" sort_family
| "Derive" "Dependent" "Inversion_clear" ident "with" one_term "Sort" sort_family
| "Declare" "Left" "Step" one_term
@@ -1008,12 +848,84 @@ command: [
| "Numeral" "Notation" qualid qualid qualid ":" ident OPT numnotoption
| "String" "Notation" qualid qualid qualid ":" ident
| "SubClass" ident_decl def_body
-]
-
-orient: [
-| "->"
-| "<-"
-|
+| thm_token ident_decl LIST0 binder ":" type LIST0 [ "with" ident_decl LIST0 binder ":" type ]
+| assumption_token OPT ( "Inline" OPT ( "(" num ")" ) ) [ LIST1 ( "(" assumpt ")" ) | assumpt ]
+| [ "Definition" | "Example" ] ident_decl def_body
+| "Let" ident def_body
+| "Inductive" inductive_definition LIST0 ( "with" inductive_definition )
+| "Fixpoint" fix_definition LIST0 ( "with" fix_definition )
+| "Let" "Fixpoint" fix_definition LIST0 ( "with" fix_definition )
+| "CoFixpoint" cofix_definition LIST0 ( "with" cofix_definition )
+| "Let" "CoFixpoint" cofix_definition LIST0 ( "with" cofix_definition )
+| "Scheme" OPT ( ident ":=" ) scheme_kind LIST0 ( "with" OPT ( ident ":=" ) scheme_kind )
+| "Combined" "Scheme" ident "from" LIST1 ident SEP ","
+| "Register" qualid "as" qualid
+| "Register" "Inline" qualid
+| "Primitive" ident OPT [ ":" term ] ":=" register_token
+| "Universe" LIST1 ident
+| "Universes" LIST1 ident
+| "Constraint" LIST1 univ_constraint SEP ","
+| "CoInductive" inductive_definition LIST0 ( "with" inductive_definition )
+| "Variant" variant_definition LIST0 ( "with" variant_definition )
+| [ "Record" | "Structure" ] record_definition LIST0 ( "with" record_definition )
+| "Class" inductive_definition LIST0 ( "with" inductive_definition )
+| "Module" OPT [ "Import" | "Export" ] ident LIST0 module_binder OPT of_module_type OPT ( ":=" LIST1 module_expr_inl SEP "<+" )
+| "Module" "Type" ident LIST0 module_binder LIST0 ( "<:" module_type_inl ) OPT ( ":=" LIST1 module_type_inl SEP "<+" )
+| "Declare" "Module" OPT [ "Import" | "Export" ] ident LIST0 module_binder ":" module_type_inl
+| "Section" ident
+| "Chapter" ident
+| "End" ident
+| "Collection" ident ":=" section_subset_expr
+| "Require" OPT [ "Import" | "Export" ] LIST1 qualid
+| "From" qualid "Require" OPT [ "Import" | "Export" ] LIST1 qualid
+| "Import" LIST1 qualid
+| "Export" LIST1 qualid
+| "Include" module_type_inl LIST0 ( "<+" module_expr_inl )
+| "Include" "Type" LIST1 module_type_inl SEP "<+"
+| "Transparent" LIST1 smart_qualid
+| "Opaque" LIST1 smart_qualid
+| "Strategy" LIST1 [ strategy_level "[" LIST1 smart_qualid "]" ]
+| "Canonical" OPT "Structure" ident_decl def_body
+| "Canonical" OPT "Structure" smart_qualid
+| "Coercion" qualid OPT univ_decl def_body
+| "Identity" "Coercion" ident ":" class ">->" class
+| "Coercion" qualid ":" class ">->" class
+| "Coercion" by_notation ":" class ">->" class
+| "Context" LIST1 binder
+| "Instance" OPT ( ident_decl LIST0 binder ) ":" term OPT hint_info OPT [ ":=" "{" LIST0 field_def "}" | ":=" term ]
+| "Existing" "Instance" qualid OPT hint_info
+| "Existing" "Instances" LIST1 qualid OPT [ "|" num ]
+| "Existing" "Class" qualid
+| "Arguments" smart_qualid LIST0 argument_spec_block LIST0 [ "," LIST0 more_implicits_block ] OPT [ ":" LIST1 arguments_modifier SEP "," ]
+| "Implicit" [ "Type" | "Types" ] reserv_list
+| "Generalizable" [ [ "Variable" | "Variables" ] LIST1 ident | "All" "Variables" | "No" "Variables" ]
+| "Open" "Scope" ident
+| "Close" "Scope" ident
+| "Delimit" "Scope" ident "with" ident
+| "Undelimit" "Scope" ident
+| "Bind" "Scope" ident "with" LIST1 class
+| "Infix" string ":=" one_term OPT [ "(" LIST1 syntax_modifier SEP "," ")" ] OPT [ ":" ident ]
+| "Notation" ident LIST0 ident ":=" one_term OPT ( "(" "only" "parsing" ")" )
+| "Notation" string ":=" one_term OPT [ "(" LIST1 syntax_modifier SEP "," ")" ] OPT [ ":" ident ]
+| "Format" "Notation" string string string
+| "Reserved" "Infix" string OPT [ "(" LIST1 syntax_modifier SEP "," ")" ]
+| "Reserved" "Notation" string OPT [ "(" LIST1 syntax_modifier SEP "," ")" ]
+| "Eval" red_expr "in" term
+| "Compute" term
+| "Check" term
+| "About" smart_qualid OPT ( "@{" LIST0 name "}" )
+| "SearchHead" one_term OPT ne_in_or_out_modules
+| "SearchPattern" one_term OPT ne_in_or_out_modules
+| "SearchRewrite" one_term OPT ne_in_or_out_modules
+| "Search" searchabout_query OPT searchabout_queries
+| "Time" command
+| "Redirect" string command
+| "Timeout" num command
+| "Fail" command
+| "Drop"
+| "Quit"
+| "BackTo" num
+| "Show" "Goal" num "at" num
]
section_subset_expr: [
@@ -1052,6 +964,10 @@ dirpath: [
| dirpath field_ident
]
+bignat: [
+| numeral
+]
+
locatable: [
| smart_qualid
| "Term" smart_qualid
@@ -1060,27 +976,17 @@ locatable: [
| "Module" qualid
]
-option_ref_value: [
-| qualid
-| string
-]
-
comment: [
| one_term
| string
| num
]
-reference_or_constr: [
-| qualid
-| one_term
-]
-
hint: [
-| "Resolve" LIST1 reference_or_constr hint_info
+| "Resolve" LIST1 [ qualid | one_term ] OPT hint_info
| "Resolve" "->" LIST1 qualid OPT num
| "Resolve" "<-" LIST1 qualid OPT num
-| "Immediate" LIST1 reference_or_constr
+| "Immediate" LIST1 [ qualid | one_term ]
| "Variables" "Transparent"
| "Variables" "Opaque"
| "Constants" "Transparent"
@@ -1093,24 +999,9 @@ hint: [
| "Extern" num OPT one_term "=>" ltac_expr
]
-constr_body: [
-| ":=" term
-| ":" term ":=" term
-]
-
-withtac: [
-| "with" ltac_expr
-|
-]
-
-ltac_def_kind: [
-| ":="
-| "::="
-]
-
tacdef_body: [
-| qualid LIST1 fun_var ltac_def_kind ltac_expr
-| qualid ltac_def_kind ltac_expr
+| qualid LIST1 fun_var [ ":=" | "::=" ] ltac_expr
+| qualid [ ":=" | "::=" ] ltac_expr
]
ltac_production_item: [
@@ -1120,13 +1011,8 @@ ltac_production_item: [
]
numnotoption: [
-| "(" "warning" "after" num ")"
-| "(" "abstract" "after" num ")"
-]
-
-mlname: [
-| ident (* extraction plugin *)
-| string (* extraction plugin *)
+| "(" "warning" "after" bignat ")"
+| "(" "abstract" "after" bignat ")"
]
int_or_id: [
@@ -1166,55 +1052,17 @@ field_mod: [
| "completeness" one_term (* setoid_ring plugin *)
]
-debug: [
-| "debug"
-|
-]
-
-eauto_search_strategy: [
-| "(bfs)"
-| "(dfs)"
-|
-]
-
-hints_path_atom: [
-| LIST1 qualid
-| "_"
-]
-
hints_path: [
| "(" hints_path ")"
| hints_path "*"
| "emp"
| "eps"
| hints_path "|" hints_path
-| hints_path_atom
+| LIST1 qualid
+| "_"
| hints_path hints_path
]
-opthints: [
-| ":" LIST1 ident
-|
-]
-
-opt_hintbases: [
-|
-| ":" LIST1 ident
-]
-
-query_command: [
-| "Eval" red_expr "in" term "."
-| "Compute" term "."
-| "Check" term "."
-| "About" smart_qualid OPT ( "@{" LIST0 name "}" ) "."
-| "SearchHead" one_term in_or_out_modules "."
-| "SearchPattern" one_term in_or_out_modules "."
-| "SearchRewrite" one_term in_or_out_modules "."
-| "Search" searchabout_query searchabout_queries "."
-| "SearchAbout" searchabout_query searchabout_queries "."
-| "SearchAbout" "[" LIST1 searchabout_query "]" in_or_out_modules "."
-]
-
class: [
| "Funclass"
| "Sortclass"
@@ -1226,39 +1074,14 @@ ne_in_or_out_modules: [
| "outside" LIST1 qualid
]
-in_or_out_modules: [
-| ne_in_or_out_modules
-|
-]
-
-positive_search_mark: [
-| "-"
-|
-]
-
searchabout_query: [
-| positive_search_mark string OPT ( "%" ident )
-| positive_search_mark one_term
+| OPT "-" string OPT ( "%" ident )
+| OPT "-" one_term
]
searchabout_queries: [
| ne_in_or_out_modules
| searchabout_query searchabout_queries
-|
-]
-
-syntax: [
-| "Open" "Scope" ident
-| "Close" "Scope" ident
-| "Delimit" "Scope" ident "with" ident
-| "Undelimit" "Scope" ident
-| "Bind" "Scope" ident "with" LIST1 class
-| "Infix" string ":=" one_term OPT [ "(" LIST1 syntax_modifier SEP "," ")" ] OPT [ ":" ident ]
-| "Notation" ident LIST0 ident ":=" one_term OPT ( "(" "only" "parsing" ")" )
-| "Notation" string ":=" one_term OPT [ "(" LIST1 syntax_modifier SEP "," ")" ] OPT [ ":" ident ]
-| "Format" "Notation" string string string
-| "Reserved" "Infix" string OPT [ "(" LIST1 syntax_modifier SEP "," ")" ]
-| "Reserved" "Notation" string OPT [ "(" LIST1 syntax_modifier SEP "," ")" ]
]
level: [
@@ -1294,18 +1117,13 @@ syntax_extension_type: [
| "bigint"
| "binder"
| "constr"
-| "constr" at_level_opt OPT constr_as_binder_kind
+| "constr" OPT ( "at" level ) OPT constr_as_binder_kind
| "pattern"
| "pattern" "at" "level" num
| "strict" "pattern"
| "strict" "pattern" "at" "level" num
| "closed" "binder"
-| "custom" ident at_level_opt OPT constr_as_binder_kind
-]
-
-at_level_opt: [
-| "at" level
-|
+| "custom" ident OPT ( "at" level ) OPT constr_as_binder_kind
]
simple_tactic: [
@@ -1321,125 +1139,71 @@ simple_tactic: [
| "elimtype" one_term
| "lapply" one_term
| "transitivity" one_term
-| "left"
-| "eleft"
-| "left" "with" bindings
-| "eleft" "with" bindings
-| "right"
-| "eright"
-| "right" "with" bindings
-| "eright" "with" bindings
-| "constructor"
-| "constructor" int_or_var
-| "constructor" int_or_var "with" bindings
-| "econstructor"
-| "econstructor" int_or_var
-| "econstructor" int_or_var "with" bindings
-| "specialize" constr_with_bindings
-| "specialize" constr_with_bindings "as" simple_intropattern
-| "symmetry"
-| "symmetry" "in" in_clause
-| "split"
-| "esplit"
-| "split" "with" bindings
-| "esplit" "with" bindings
-| "exists"
-| "exists" LIST1 bindings SEP ","
-| "eexists"
-| "eexists" LIST1 bindings SEP ","
-| "intros" "until" quantified_hypothesis
-| "intro"
-| "intro" ident
-| "intro" ident "at" "top"
-| "intro" ident "at" "bottom"
-| "intro" ident "after" ident
-| "intro" ident "before" ident
-| "intro" "at" "top"
-| "intro" "at" "bottom"
-| "intro" "after" ident
-| "intro" "before" ident
-| "move" ident "at" "top"
-| "move" ident "at" "bottom"
-| "move" ident "after" ident
-| "move" ident "before" ident
-| "rename" LIST1 rename SEP ","
+| "left" OPT ( "with" bindings )
+| "eleft" OPT ( "with" bindings )
+| "right" OPT ( "with" bindings )
+| "eright" OPT ( "with" bindings )
+| "constructor" OPT int_or_var OPT ( "with" bindings )
+| "econstructor" OPT ( int_or_var OPT ( "with" bindings ) )
+| "specialize" constr_with_bindings OPT ( "as" simple_intropattern )
+| "symmetry" OPT ( "in" in_clause )
+| "split" OPT ( "with" bindings )
+| "esplit" OPT ( "with" bindings )
+| "exists" OPT ( LIST1 bindings SEP "," )
+| "eexists" OPT ( LIST1 bindings SEP "," )
+| "intros" "until" [ ident | num ]
+| "intro" OPT ident OPT where
+| "move" ident OPT where
+| "rename" LIST1 ( ident "into" ident ) SEP ","
| "revert" LIST1 ident
-| "simple" "induction" quantified_hypothesis
-| "simple" "destruct" quantified_hypothesis
-| "double" "induction" quantified_hypothesis quantified_hypothesis
+| "simple" "induction" [ ident | num ]
+| "simple" "destruct" [ ident | num ]
+| "double" "induction" [ ident | num ] [ ident | num ]
| "admit"
-| "fix" ident num
-| "cofix" ident
| "clear" LIST0 ident
| "clear" "-" LIST1 ident
| "clearbody" LIST1 ident
| "generalize" "dependent" one_term
-| "replace" one_term "with" one_term clause_dft_concl by_arg_tac
-| "replace" "->" one_term clause_dft_concl
-| "replace" "<-" one_term clause_dft_concl
-| "replace" one_term clause_dft_concl
-| "simplify_eq"
-| "simplify_eq" destruction_arg
-| "esimplify_eq"
-| "esimplify_eq" destruction_arg
-| "discriminate"
-| "discriminate" destruction_arg
-| "ediscriminate"
-| "ediscriminate" destruction_arg
-| "injection"
-| "injection" destruction_arg
-| "einjection"
-| "einjection" destruction_arg
-| "injection" "as" LIST0 simple_intropattern
-| "injection" destruction_arg "as" LIST0 simple_intropattern
-| "einjection" "as" LIST0 simple_intropattern
-| "einjection" destruction_arg "as" LIST0 simple_intropattern
-| "simple" "injection"
-| "simple" "injection" destruction_arg
-| "dependent" "rewrite" orient one_term
-| "dependent" "rewrite" orient one_term "in" ident
-| "cutrewrite" orient one_term
-| "cutrewrite" orient one_term "in" ident
+| "replace" one_term "with" one_term OPT clause_dft_concl OPT ( "by" ltac_expr3 )
+| "replace" OPT [ "->" | "<-" ] one_term OPT clause_dft_concl
+| "simplify_eq" OPT destruction_arg
+| "esimplify_eq" OPT destruction_arg
+| "discriminate" OPT destruction_arg
+| "ediscriminate" OPT destruction_arg
+| "injection" OPT destruction_arg OPT ( "as" LIST0 simple_intropattern )
+| "einjection" OPT destruction_arg OPT ( "as" LIST0 simple_intropattern )
+| "simple" "injection" OPT destruction_arg
+| "dependent" "rewrite" OPT [ "->" | "<-" ] one_term OPT ( "in" ident )
+| "cutrewrite" OPT [ "->" | "<-" ] one_term OPT ( "in" ident )
| "decompose" "sum" one_term
| "decompose" "record" one_term
| "absurd" one_term
| "contradiction" OPT constr_with_bindings
-| "autorewrite" "with" LIST1 ident clause_dft_concl
-| "autorewrite" "with" LIST1 ident clause_dft_concl "using" ltac_expr
-| "autorewrite" "*" "with" LIST1 ident clause_dft_concl
-| "autorewrite" "*" "with" LIST1 ident clause_dft_concl "using" ltac_expr
-| "rewrite" "*" orient one_term "in" ident "at" occurrences by_arg_tac
-| "rewrite" "*" orient one_term "at" occurrences "in" ident by_arg_tac
-| "rewrite" "*" orient one_term "in" ident by_arg_tac
-| "rewrite" "*" orient one_term "at" occurrences by_arg_tac
-| "rewrite" "*" orient one_term by_arg_tac
+| "autorewrite" OPT "*" "with" LIST1 ident OPT clause_dft_concl OPT ( "using" ltac_expr )
+| "rewrite" "*" OPT [ "->" | "<-" ] one_term OPT ( "in" ident ) OPT ( "at" occurrences OPT ( "by" ltac_expr3 ) )
+| "rewrite" "*" OPT [ "->" | "<-" ] one_term "at" occurrences "in" ident OPT ( "by" ltac_expr3 )
| "refine" one_term
| "simple" "refine" one_term
| "notypeclasses" "refine" one_term
| "simple" "notypeclasses" "refine" one_term
| "solve_constraints"
-| "subst" LIST1 ident
-| "subst"
+| "subst" OPT ( LIST1 ident )
| "simple" "subst"
| "evar" "(" ident ":" term ")"
| "evar" one_term
| "instantiate" "(" ident ":=" term ")"
-| "instantiate" "(" int ":=" term ")" hloc
+| "instantiate" "(" int ":=" term ")" OPT hloc
| "instantiate"
-| "stepl" one_term "by" ltac_expr
-| "stepl" one_term
-| "stepr" one_term "by" ltac_expr
-| "stepr" one_term
+| "stepl" one_term OPT ( "by" ltac_expr )
+| "stepr" one_term OPT ( "by" ltac_expr )
| "generalize_eqs" ident
| "dependent" "generalize_eqs" ident
| "generalize_eqs_vars" ident
| "dependent" "generalize_eqs_vars" ident
| "specialize_eqs" ident
-| "hresolve_core" "(" ident ":=" one_term ")" "at" int_or_var "in" one_term
-| "hresolve_core" "(" ident ":=" one_term ")" "in" one_term
+| "hresolve_core" "(" ident ":=" one_term ")" OPT ( "at" int_or_var ) "in" one_term
| "hget_evar" int_or_var
-| "destauto"
-| "destauto" "in" ident
+| "destauto" OPT ( "in" ident )
| "transparent_abstract" ltac_expr3
| "transparent_abstract" ltac_expr3 "using" ident
| "constr_eq" one_term one_term
@@ -1471,27 +1235,24 @@ simple_tactic: [
| "show" "ltac" "profile" "cutoff" int
| "show" "ltac" "profile" string
| "restart_timer" OPT string
-| "finish_timing" OPT string
-| "finish_timing" "(" string ")" OPT string
+| "finish_timing" OPT ( "(" string ")" ) OPT string
| "eassumption"
| "eexact" one_term
-| "trivial" auto_using hintbases
-| "info_trivial" auto_using hintbases
-| "debug" "trivial" auto_using hintbases
-| "auto" OPT int_or_var auto_using hintbases
-| "info_auto" OPT int_or_var auto_using hintbases
-| "debug" "auto" OPT int_or_var auto_using hintbases
+| "trivial" OPT auto_using OPT hintbases
+| "info_trivial" OPT auto_using OPT hintbases
+| "debug" "trivial" OPT auto_using OPT hintbases
+| "auto" OPT int_or_var OPT auto_using OPT hintbases
+| "info_auto" OPT int_or_var OPT auto_using OPT hintbases
+| "debug" "auto" OPT int_or_var OPT auto_using OPT hintbases
| "prolog" "[" LIST0 one_term "]" int_or_var
-| "eauto" OPT int_or_var OPT int_or_var auto_using hintbases
-| "new" "auto" OPT int_or_var auto_using hintbases
-| "debug" "eauto" OPT int_or_var OPT int_or_var auto_using hintbases
-| "info_eauto" OPT int_or_var OPT int_or_var auto_using hintbases
-| "dfs" "eauto" OPT int_or_var auto_using hintbases
-| "autounfold" hintbases clause_dft_concl
-| "autounfold_one" hintbases "in" ident
-| "autounfold_one" hintbases
-| "unify" one_term one_term
-| "unify" one_term one_term "with" ident
+| "eauto" OPT int_or_var OPT int_or_var OPT auto_using OPT hintbases
+| "new" "auto" OPT int_or_var OPT auto_using OPT hintbases
+| "debug" "eauto" OPT int_or_var OPT int_or_var OPT auto_using OPT hintbases
+| "info_eauto" OPT int_or_var OPT int_or_var OPT auto_using OPT hintbases
+| "dfs" "eauto" OPT int_or_var OPT auto_using OPT hintbases
+| "autounfold" OPT hintbases OPT clause_dft_concl
+| "autounfold_one" OPT hintbases OPT ( "in" ident )
+| "unify" one_term one_term OPT ( "with" ident )
| "convert_concl_no_check" one_term
| "typeclasses" "eauto" "bfs" OPT int_or_var "with" LIST1 ident
| "typeclasses" "eauto" OPT int_or_var "with" LIST1 ident
@@ -1502,103 +1263,90 @@ simple_tactic: [
| "autoapply" one_term "using" ident
| "autoapply" one_term "with" ident
| "progress_evars" ltac_expr
-| "rewrite_strat" rewstrategy
-| "rewrite_db" ident "in" ident
-| "rewrite_db" ident
-| "substitute" orient constr_with_bindings
-| "setoid_rewrite" orient constr_with_bindings
-| "setoid_rewrite" orient constr_with_bindings "in" ident
-| "setoid_rewrite" orient constr_with_bindings "at" occurrences
-| "setoid_rewrite" orient constr_with_bindings "at" occurrences "in" ident
-| "setoid_rewrite" orient constr_with_bindings "in" ident "at" occurrences
-| "setoid_symmetry"
-| "setoid_symmetry" "in" ident
+| "rewrite_strat" rewstrategy OPT ( "in" ident )
+| "rewrite_db" ident OPT ( "in" ident )
+| "substitute" OPT [ "->" | "<-" ] constr_with_bindings
+| "setoid_rewrite" OPT [ "->" | "<-" ] constr_with_bindings OPT ( "at" occurrences ) OPT ( "in" ident )
+| "setoid_rewrite" OPT [ "->" | "<-" ] constr_with_bindings "in" ident "at" occurrences
+| "setoid_symmetry" OPT ( "in" ident )
| "setoid_reflexivity"
| "setoid_transitivity" one_term
| "setoid_etransitivity"
| "decide" "equality"
| "compare" one_term one_term
-| "rewrite_strat" rewstrategy "in" ident
-| "intros" intropattern_list_opt
-| "eintros" intropattern_list_opt
-| "apply" LIST1 constr_with_bindings_arg SEP "," in_hyp_as
-| "eapply" LIST1 constr_with_bindings_arg SEP "," in_hyp_as
-| "simple" "apply" LIST1 constr_with_bindings_arg SEP "," in_hyp_as
-| "simple" "eapply" LIST1 constr_with_bindings_arg SEP "," in_hyp_as
+| "intros" LIST0 intropattern
+| "eintros" LIST0 intropattern
+| "apply" LIST1 constr_with_bindings_arg SEP "," OPT in_hyp_as
+| "eapply" LIST1 constr_with_bindings_arg SEP "," OPT in_hyp_as
+| "simple" "apply" LIST1 constr_with_bindings_arg SEP "," OPT in_hyp_as
+| "simple" "eapply" LIST1 constr_with_bindings_arg SEP "," OPT in_hyp_as
| "elim" constr_with_bindings_arg OPT ( "using" constr_with_bindings )
| "eelim" constr_with_bindings_arg OPT ( "using" constr_with_bindings )
| "case" induction_clause_list
| "ecase" induction_clause_list
-| "fix" ident num "with" LIST1 fixdecl
-| "cofix" ident "with" LIST1 cofixdecl
+| "fix" ident num OPT ( "with" LIST1 fixdecl )
+| "cofix" ident OPT ( "with" LIST1 cofixdecl )
| "pose" bindings_with_parameters
-| "pose" one_term as_name
+| "pose" one_term OPT as_name
| "epose" bindings_with_parameters
-| "epose" one_term as_name
-| "set" bindings_with_parameters clause_dft_concl
-| "set" one_term as_name clause_dft_concl
-| "eset" bindings_with_parameters clause_dft_concl
-| "eset" one_term as_name clause_dft_concl
-| "remember" one_term as_name eqn_ipat clause_dft_all
-| "eremember" one_term as_name eqn_ipat clause_dft_all
+| "epose" one_term OPT as_name
+| "set" bindings_with_parameters OPT clause_dft_concl
+| "set" one_term OPT as_name OPT clause_dft_concl
+| "eset" bindings_with_parameters OPT clause_dft_concl
+| "eset" one_term OPT as_name OPT clause_dft_concl
+| "remember" one_term OPT as_name OPT eqn_ipat OPT clause_dft_all
+| "eremember" one_term OPT as_name OPT eqn_ipat OPT clause_dft_all
| "assert" "(" ident ":=" term ")"
| "eassert" "(" ident ":=" term ")"
-| "assert" "(" ident ":" term ")" by_tactic
-| "eassert" "(" ident ":" term ")" by_tactic
-| "enough" "(" ident ":" term ")" by_tactic
-| "eenough" "(" ident ":" term ")" by_tactic
-| "assert" one_term as_ipat by_tactic
-| "eassert" one_term as_ipat by_tactic
+| "assert" "(" ident ":" term ")" OPT ( "by" ltac_expr3 )
+| "eassert" "(" ident ":" term ")" OPT ( "by" ltac_expr3 )
+| "enough" "(" ident ":" term ")" OPT ( "by" ltac_expr3 )
+| "eenough" "(" ident ":" term ")" OPT ( "by" ltac_expr3 )
+| "assert" one_term OPT as_ipat OPT ( "by" ltac_expr3 )
+| "eassert" one_term OPT as_ipat OPT ( "by" ltac_expr3 )
| "pose" "proof" "(" ident ":=" term ")"
| "epose" "proof" "(" ident ":=" term ")"
-| "pose" "proof" term as_ipat
-| "epose" "proof" term as_ipat
-| "enough" one_term as_ipat by_tactic
-| "eenough" one_term as_ipat by_tactic
-| "generalize" one_term
-| "generalize" one_term LIST1 one_term
-| "generalize" one_term OPT ( "at" occs_nums ) as_name LIST0 [ "," pattern_occ as_name ]
+| "pose" "proof" term OPT as_ipat
+| "epose" "proof" term OPT as_ipat
+| "enough" one_term OPT as_ipat OPT ( "by" ltac_expr3 )
+| "eenough" one_term OPT as_ipat OPT ( "by" ltac_expr3 )
+| "generalize" one_term OPT ( LIST1 one_term )
+| "generalize" one_term OPT ( "at" occs_nums ) OPT as_name LIST0 [ "," pattern_occ OPT as_name ]
| "induction" induction_clause_list
| "einduction" induction_clause_list
| "destruct" induction_clause_list
| "edestruct" induction_clause_list
-| "rewrite" LIST1 oriented_rewriter SEP "," clause_dft_concl by_tactic
-| "erewrite" LIST1 oriented_rewriter SEP "," clause_dft_concl by_tactic
-| "dependent" [ "simple" "inversion" | "inversion" | "inversion_clear" ] quantified_hypothesis as_or_and_ipat OPT [ "with" one_term ]
-| "simple" "inversion" quantified_hypothesis as_or_and_ipat in_hyp_list
-| "inversion" quantified_hypothesis as_or_and_ipat in_hyp_list
-| "inversion_clear" quantified_hypothesis as_or_and_ipat in_hyp_list
-| "inversion" quantified_hypothesis "using" one_term in_hyp_list
-| "red" clause_dft_concl
-| "hnf" clause_dft_concl
-| "simpl" OPT delta_flag OPT ref_or_pattern_occ clause_dft_concl
-| "cbv" OPT strategy_flag clause_dft_concl
-| "cbn" OPT strategy_flag clause_dft_concl
-| "lazy" OPT strategy_flag clause_dft_concl
-| "compute" OPT delta_flag clause_dft_concl
-| "vm_compute" OPT ref_or_pattern_occ clause_dft_concl
-| "native_compute" OPT ref_or_pattern_occ clause_dft_concl
-| "unfold" LIST1 unfold_occ SEP "," clause_dft_concl
-| "fold" LIST1 one_term clause_dft_concl
-| "pattern" LIST1 pattern_occ SEP "," clause_dft_concl
-| "change" conversion clause_dft_concl
-| "change_no_check" conversion clause_dft_concl
+| "rewrite" LIST1 oriented_rewriter SEP "," OPT clause_dft_concl OPT ( "by" ltac_expr3 )
+| "erewrite" LIST1 oriented_rewriter SEP "," OPT clause_dft_concl OPT ( "by" ltac_expr3 )
+| "dependent" [ "simple" "inversion" | "inversion" | "inversion_clear" ] [ ident | num ] OPT as_or_and_ipat OPT [ "with" one_term ]
+| "simple" "inversion" [ ident | num ] OPT as_or_and_ipat OPT ( "in" LIST1 ident )
+| "inversion" [ ident | num ] OPT as_or_and_ipat OPT ( "in" LIST1 ident )
+| "inversion_clear" [ ident | num ] OPT as_or_and_ipat OPT ( "in" LIST1 ident )
+| "inversion" [ ident | num ] "using" one_term OPT ( "in" LIST1 ident )
+| "red" OPT clause_dft_concl
+| "hnf" OPT clause_dft_concl
+| "simpl" OPT delta_flag OPT ref_or_pattern_occ OPT clause_dft_concl
+| "cbv" OPT strategy_flag OPT clause_dft_concl
+| "cbn" OPT strategy_flag OPT clause_dft_concl
+| "lazy" OPT strategy_flag OPT clause_dft_concl
+| "compute" OPT delta_flag OPT clause_dft_concl
+| "vm_compute" OPT ref_or_pattern_occ OPT clause_dft_concl
+| "native_compute" OPT ref_or_pattern_occ OPT clause_dft_concl
+| "unfold" LIST1 unfold_occ SEP "," OPT clause_dft_concl
+| "fold" LIST1 one_term OPT clause_dft_concl
+| "pattern" LIST1 pattern_occ SEP "," OPT clause_dft_concl
+| "change" conversion OPT clause_dft_concl
+| "change_no_check" conversion OPT clause_dft_concl
| "btauto"
| "rtauto"
-| "congruence"
-| "congruence" int
-| "congruence" "with" LIST1 one_term
-| "congruence" int "with" LIST1 one_term
+| "congruence" OPT int OPT ( "with" LIST1 one_term )
| "f_equal"
-| "firstorder" OPT ltac_expr firstorder_using
-| "firstorder" OPT ltac_expr "with" LIST1 ident
-| "firstorder" OPT ltac_expr firstorder_using "with" LIST1 ident
+| "firstorder" OPT ltac_expr firstorder_rhs
| "gintuition" OPT ltac_expr
-| "functional" "inversion" quantified_hypothesis OPT qualid (* funind plugin *)
-| "functional" "induction" LIST1 one_term fun_ind_using with_names (* funind plugin *)
-| "soft" "functional" "induction" LIST1 one_term fun_ind_using with_names (* funind plugin *)
-| "psatz_Z" int_or_var ltac_expr (* micromega plugin *)
-| "psatz_Z" ltac_expr (* micromega plugin *)
+| "functional" "inversion" [ ident | num ] OPT qualid (* funind plugin *)
+| "functional" "induction" LIST1 one_term OPT fun_ind_using OPT with_names (* funind plugin *)
+| "soft" "functional" "induction" LIST1 one_term OPT fun_ind_using OPT with_names (* funind plugin *)
+| "psatz_Z" OPT int_or_var ltac_expr
| "xlia" ltac_expr (* micromega plugin *)
| "xnlia" ltac_expr (* micromega plugin *)
| "xnra" ltac_expr (* micromega plugin *)
@@ -1608,10 +1356,8 @@ simple_tactic: [
| "sos_R" ltac_expr (* micromega plugin *)
| "lra_Q" ltac_expr (* micromega plugin *)
| "lra_R" ltac_expr (* micromega plugin *)
-| "psatz_R" int_or_var ltac_expr (* micromega plugin *)
-| "psatz_R" ltac_expr (* micromega plugin *)
-| "psatz_Q" int_or_var ltac_expr (* micromega plugin *)
-| "psatz_Q" ltac_expr (* micromega plugin *)
+| "psatz_R" OPT int_or_var ltac_expr
+| "psatz_Q" OPT int_or_var ltac_expr
| "zify_iter_specs" (* micromega plugin *)
| "zify_op" (* micromega plugin *)
| "zify_saturate" (* micromega plugin *)
@@ -1619,14 +1365,37 @@ simple_tactic: [
| "zify_elim_let" (* micromega plugin *)
| "nsatz_compute" one_term (* nsatz plugin *)
| "omega" (* omega plugin *)
-| "protect_fv" string "in" ident (* setoid_ring plugin *)
-| "protect_fv" string (* setoid_ring plugin *)
+| "protect_fv" string OPT ( "in" ident )
| "ring_lookup" ltac_expr0 "[" LIST0 one_term "]" LIST1 one_term (* setoid_ring plugin *)
| "field_lookup" ltac_expr "[" LIST0 one_term "]" LIST1 one_term (* setoid_ring plugin *)
+| "classical_left"
+| "classical_right"
+| "contradict" ident
+| "discrR"
+| "easy"
+| "exfalso"
+| "inversion_sigma"
+| "lia"
+| "lra"
+| "nia"
+| "nra"
+| "split_Rabs"
+| "split_Rmult"
+| "tauto"
+| "zify"
+| "assert_fails" ltac_expr3
+| "assert_succeeds" ltac_expr3
+| "field" OPT ( "[" LIST1 term "]" )
+| "field_simplify" OPT ( "[" LIST1 term "]" ) LIST1 term OPT ( "in" ident )
+| "field_simplify_eq" OPT ( "[" LIST1 term "]" ) OPT ( "in" ident )
+| "intuition" OPT ltac_expr
+| "nsatz" OPT ( "with" "radicalmax" ":=" term "strategy" ":=" term "parameters" ":=" term "variables" ":=" term )
+| "psatz" term OPT int_or_var
+| "ring" OPT ( "[" LIST1 term "]" )
+| "ring_simplify" OPT ( "[" LIST1 term "]" ) LIST1 term OPT ( "in" ident )
]
hloc: [
-|
| "in" "|-" "*"
| "in" ident
| "in" "(" "Type" "of" ident ")"
@@ -1635,15 +1404,6 @@ hloc: [
| "in" "(" "value" "of" ident ")"
]
-rename: [
-| ident "into" ident
-]
-
-by_arg_tac: [
-| "by" ltac_expr3
-|
-]
-
in_clause: [
| LIST0 hypident_occ SEP "," OPT ( "|-" OPT concl_occ )
| "*" "|-" OPT concl_occ
@@ -1666,7 +1426,6 @@ hypident: [
as_ipat: [
| "as" simple_intropattern
-|
]
or_and_intropattern_loc: [
@@ -1676,29 +1435,19 @@ or_and_intropattern_loc: [
as_or_and_ipat: [
| "as" or_and_intropattern_loc
-|
]
eqn_ipat: [
| "eqn" ":" naming_intropattern
-| "_eqn" ":" naming_intropattern
-| "_eqn"
-|
]
as_name: [
| "as" ident
-|
-]
-
-by_tactic: [
-| "by" ltac_expr3
-|
]
rewriter: [
| "!" constr_with_bindings_arg
-| [ "?" | "?" ] constr_with_bindings_arg
+| "?" constr_with_bindings_arg
| num "!" constr_with_bindings_arg
| num [ "?" | "?" ] constr_with_bindings_arg
| num constr_with_bindings_arg
@@ -1706,24 +1455,19 @@ rewriter: [
]
oriented_rewriter: [
-| orient rewriter
+| OPT [ "->" | "<-" ] rewriter
]
induction_clause: [
-| destruction_arg as_or_and_ipat eqn_ipat opt_clause
+| destruction_arg OPT as_or_and_ipat OPT eqn_ipat OPT opt_clause
]
induction_clause_list: [
-| LIST1 induction_clause SEP "," OPT ( "using" constr_with_bindings ) opt_clause
+| LIST1 induction_clause SEP "," OPT ( "using" constr_with_bindings ) OPT opt_clause
]
auto_using: [
| "using" LIST1 one_term SEP ","
-|
-]
-
-intropattern_list_opt: [
-| LIST0 intropattern
]
or_and_intropattern: [
@@ -1733,14 +1477,13 @@ or_and_intropattern: [
]
intropattern_or_list_or: [
-| intropattern_or_list_or "|" intropattern_list_opt
-| intropattern_list_opt
+| LIST0 intropattern LIST0 ( "|" LIST0 intropattern )
]
equality_intropattern: [
| "->"
| "<-"
-| "[=" intropattern_list_opt "]"
+| "[=" LIST0 intropattern "]"
]
naming_intropattern: [
@@ -1787,7 +1530,6 @@ comparison: [
hintbases: [
| "with" "*"
| "with" LIST1 ident
-|
]
bindings_with_parameters: [
@@ -1797,28 +1539,19 @@ bindings_with_parameters: [
clause_dft_concl: [
| "in" in_clause
| OPT ( "at" occs_nums )
-|
]
clause_dft_all: [
| "in" in_clause
-|
]
opt_clause: [
| "in" in_clause
| "at" occs_nums
-|
-]
-
-in_hyp_list: [
-| "in" LIST1 ident
-|
]
in_hyp_as: [
-| "in" ident as_ipat
-|
+| "in" ident OPT as_ipat
]
simple_binder: [
@@ -1827,12 +1560,11 @@ simple_binder: [
]
fixdecl: [
-| "(" ident LIST0 simple_binder struct_annot ":" term ")"
+| "(" ident LIST0 simple_binder OPT struct_annot ":" term ")"
]
struct_annot: [
| "{" "struct" name "}"
-|
]
cofixdecl: [
@@ -1840,12 +1572,7 @@ cofixdecl: [
]
constr_with_bindings: [
-| one_term with_bindings
-]
-
-with_bindings: [
-| "with" bindings
-|
+| one_term OPT ( "with" bindings )
]
destruction_arg: [
@@ -1859,11 +1586,6 @@ constr_with_bindings_arg: [
| constr_with_bindings
]
-quantified_hypothesis: [
-| ident
-| num
-]
-
conversion: [
| one_term
| one_term "with" one_term
@@ -1874,17 +1596,14 @@ firstorder_using: [
| "using" qualid
| "using" qualid "," LIST1 qualid SEP ","
| "using" qualid qualid LIST0 qualid
-|
]
fun_ind_using: [
| "using" constr_with_bindings (* funind plugin *)
-| (* funind plugin *)
]
with_names: [
| "as" simple_intropattern (* funind plugin *)
-| (* funind plugin *)
]
occurrences: [
@@ -2032,16 +1751,11 @@ tactic_arg: [
| "eval" red_expr "in" term
| "context" ident "[" term "]"
| "type" "of" term
-| "fresh" LIST0 fresh_id
+| "fresh" LIST0 [ string | qualid ]
| "type_term" one_term
| "numgoals"
]
-fresh_id: [
-| string
-| qualid
-]
-
tactic_arg_compat: [
| tactic_arg
| term
diff --git a/doc/tools/docgram/prodn.edit_mlg b/doc/tools/docgram/prodn.edit_mlg
deleted file mode 100644
index 8bd8cad6b5..0000000000
--- a/doc/tools/docgram/prodn.edit_mlg
+++ /dev/null
@@ -1,24 +0,0 @@
-(************************************************************************)
-(* * The Coq Proof Assistant / The Coq Development Team *)
-(* v * Copyright INRIA, CNRS and contributors *)
-(* <O___,, * (see version control and CREDITS file for authors & dates) *)
-(* \VV/ **************************************************************)
-(* // * This file is distributed under the terms of the *)
-(* * GNU Lesser General Public License Version 2.1 *)
-(* * (see LICENSE file for the text of the license) *)
-(************************************************************************)
-
-(* Defines additional productions and edits for use in documentation. Not compiled into Coq *)
-(* Contents used to generate prodn in doc *)
-
-DOC_GRAMMAR
-
-(* todo: doesn't work, gives
-ltac_match: @match_key @ltac_expr with {? %| } {+| @ltac_expr } end
-instead of
-ltac_match: @match_key @ltac_expr with {? %| } {+| {| @match_pattern | _ } => @ltac_expr } end
-
-SPLICE: [
-| match_rule
-]
-*)
diff --git a/doc/tools/docgram/productionlist.edit_mlg b/doc/tools/docgram/productionlist.edit_mlg
deleted file mode 100644
index 641ab8fbe5..0000000000
--- a/doc/tools/docgram/productionlist.edit_mlg
+++ /dev/null
@@ -1,14 +0,0 @@
-(************************************************************************)
-(* * The Coq Proof Assistant / The Coq Development Team *)
-(* v * Copyright INRIA, CNRS and contributors *)
-(* <O___,, * (see version control and CREDITS file for authors & dates) *)
-(* \VV/ **************************************************************)
-(* // * This file is distributed under the terms of the *)
-(* * GNU Lesser General Public License Version 2.1 *)
-(* * (see LICENSE file for the text of the license) *)
-(************************************************************************)
-
-(* Defines additional productions and edits for use in documentation. Not compiled into Coq *)
-(* Contents used to generate productionlists in doc *)
-
-DOC_GRAMMAR