aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/changelog/01-kernel/11811-uncheck_positivity_bug.rst4
-rw-r--r--doc/changelog/01-kernel/11972-fix-require-in-section.rst6
-rw-r--r--doc/changelog/02-specification-language/11579-inductive-params.rst7
-rw-r--r--doc/changelog/03-notations/11530-master+fix11331-custom-entries-precedence.rst8
-rw-r--r--doc/changelog/03-notations/11859-warn-inexact-float.rst6
-rw-r--r--doc/changelog/04-tactics/11023-nativecompute-timing.rst7
-rw-r--r--doc/changelog/04-tactics/11025-nativecompute-timing.rst11
-rw-r--r--doc/changelog/04-tactics/11883-fix-autounfold.rst13
-rw-r--r--doc/changelog/04-tactics/11976-deprecate-omega.rst5
-rw-r--r--doc/changelog/04-tactics/12023-master+fixing-empty-Ltac-v-file.rst6
-rw-r--r--doc/changelog/04-tactics/12116-master+fix12045-missing-reduction-in-using-ind-scheme.rst5
-rw-r--r--doc/changelog/05-tactic-language/11882-master+ltac2-fresh-in-context.rst6
-rw-r--r--doc/changelog/07-commands-and-options/11534-let-with-annotations.rst3
-rw-r--r--doc/changelog/07-commands-and-options/11746-remove-chapter.rst3
-rw-r--r--doc/changelog/07-commands-and-options/12034-cumul-sprop.rst5
-rw-r--r--doc/changelog/07-commands-and-options/12070-native-compiler-disabled.rst5
-rw-r--r--doc/changelog/08-tools/10592-coqdoc-details.rst5
-rw-r--r--doc/changelog/08-tools/12005-remove-deprecated-coqtop-options.rst5
-rw-r--r--doc/changelog/08-tools/12006-issue5632.rst4
-rw-r--r--doc/changelog/08-tools/12026-master+coqdoc-self-linked-defs-wish7093.rst4
-rw-r--r--doc/changelog/08-tools/12033-master+coqdoc-fix7697-passing-binders-location.rst5
-rw-r--r--doc/changelog/08-tools/12037-coqdoc-preformatted.rst6
-rw-r--r--doc/changelog/08-tools/12091-master+coqdoc-css-target.rst4
-rw-r--r--doc/changelog/08-tools/12126-adjust-timed-name.rst8
-rw-r--r--doc/changelog/09-coqide/10008-snyke7+escape_spaces.rst4
-rw-r--r--doc/changelog/09-coqide/12060-ide-disable-csd.rst6
-rw-r--r--doc/changelog/09-coqide/12106-master+coqide-style-apply-all-windows.rst5
-rw-r--r--doc/changelog/10-standard-library/11249-ollibs-list-changelog.rst17
-rw-r--r--doc/changelog/10-standard-library/11335-ollibs-wfnat-changelog.rst4
-rw-r--r--doc/changelog/10-standard-library/11880-iter.rst8
-rw-r--r--doc/changelog/10-standard-library/11909-fix-≡-level.rst7
-rw-r--r--doc/changelog/10-standard-library/11946-ollibs-permutation.rst10
-rw-r--r--doc/changelog/10-standard-library/11957-signotations.rst4
-rw-r--r--doc/changelog/10-standard-library/12014-ollibs-vector.rst10
-rw-r--r--doc/changelog/10-standard-library/12031-ollibs-cpermutation.rst4
-rw-r--r--doc/changelog/10-standard-library/12044-issue-12015.rst10
-rw-r--r--doc/changelog/10-standard-library/12119-issue12119.rst5
-rw-r--r--doc/changelog/10-standard-library/9803-reals.rst14
-rw-r--r--doc/changelog/11-infrastructure-and-dependencies/11860-ci+ocaml_to_4091.rst4
-rw-r--r--doc/changelog/12-misc/11329-master+fix11114-extraction-anomaly-implicit-record.rst4
-rw-r--r--doc/common/styles/html/coqremote/sites/all/themes/coq/coqdoc.css329
-rw-r--r--doc/common/styles/html/coqremote/sites/all/themes/coq/style.css801
-rw-r--r--doc/dune18
-rw-r--r--doc/plugin_tutorial/tuto1/src/g_tuto1.mlg4
-rw-r--r--doc/plugin_tutorial/tuto1/src/simple_declare.ml14
-rw-r--r--doc/sphinx/addendum/implicit-coercions.rst2
-rw-r--r--doc/sphinx/addendum/micromega.rst2
-rw-r--r--doc/sphinx/addendum/omega.rst35
-rw-r--r--doc/sphinx/addendum/sprop.rst7
-rw-r--r--doc/sphinx/addendum/universe-polymorphism.rst15
-rw-r--r--doc/sphinx/appendix/indexes/index.rst4
-rw-r--r--doc/sphinx/changes.rst54
-rw-r--r--doc/sphinx/coq-attrindex.rst5
-rw-r--r--doc/sphinx/coqdoc.css338
-rw-r--r--doc/sphinx/language/core/index.rst2
-rw-r--r--doc/sphinx/language/core/records.rst312
-rw-r--r--doc/sphinx/language/core/sections.rst104
-rw-r--r--doc/sphinx/language/extensions/implicit-arguments.rst903
-rw-r--r--doc/sphinx/language/extensions/index.rst1
-rw-r--r--doc/sphinx/language/gallina-extensions.rst1543
-rw-r--r--doc/sphinx/language/gallina-specification-language.rst29
-rw-r--r--doc/sphinx/practical-tools/coq-commands.rst5
-rw-r--r--doc/sphinx/practical-tools/coqide.rst28
-rw-r--r--doc/sphinx/practical-tools/utilities.rst18
-rw-r--r--doc/sphinx/proof-engine/detailed-tactic-examples.rst4
-rw-r--r--doc/sphinx/proof-engine/ltac.rst4
-rw-r--r--doc/sphinx/proof-engine/proof-handling.rst4
-rw-r--r--doc/sphinx/proof-engine/ssreflect-proof-language.rst28
-rw-r--r--doc/sphinx/proof-engine/tactics.rst139
-rw-r--r--doc/sphinx/proof-engine/vernacular-commands.rst939
-rw-r--r--doc/sphinx/user-extensions/proof-schemes.rst141
-rw-r--r--doc/sphinx/user-extensions/syntax-extensions.rst9
-rw-r--r--doc/sphinx/using/libraries/funind.rst400
-rw-r--r--doc/sphinx/using/libraries/index.rst1
-rw-r--r--doc/sphinx/using/tools/coqdoc.rst21
-rw-r--r--doc/stdlib/hidden-files1
-rw-r--r--doc/stdlib/index-list.html.template3
-rw-r--r--doc/tools/coqrst/coqdomain.py18
-rw-r--r--doc/tools/docgram/common.edit_mlg178
-rw-r--r--doc/tools/docgram/doc_grammar.ml38
-rw-r--r--doc/tools/docgram/dune5
-rw-r--r--doc/tools/docgram/fullGrammar28
-rw-r--r--doc/tools/docgram/orderedGrammar174
83 files changed, 2914 insertions, 4051 deletions
diff --git a/doc/changelog/01-kernel/11811-uncheck_positivity_bug.rst b/doc/changelog/01-kernel/11811-uncheck_positivity_bug.rst
deleted file mode 100644
index c08ebb7f25..0000000000
--- a/doc/changelog/01-kernel/11811-uncheck_positivity_bug.rst
+++ /dev/null
@@ -1,4 +0,0 @@
-- **Fixed:**
- Allow more inductive types in `Unset Positivity Checking` mode
- (`#11811 <https://github.com/coq/coq/pull/11811>`_,
- by SimonBoulier).
diff --git a/doc/changelog/01-kernel/11972-fix-require-in-section.rst b/doc/changelog/01-kernel/11972-fix-require-in-section.rst
new file mode 100644
index 0000000000..7a2fa9185f
--- /dev/null
+++ b/doc/changelog/01-kernel/11972-fix-require-in-section.rst
@@ -0,0 +1,6 @@
+- **Fixed:**
+ Using :cmd:`Require` inside a section caused an anomaly when closing
+ the section. (`#11972 <https://github.com/coq/coq/pull/11972>`_, by
+ Gaëtan Gilbert, fixing `#11783
+ <https://github.com/coq/coq/issues/11783>`_, reported by Attila
+ Boros).
diff --git a/doc/changelog/02-specification-language/11579-inductive-params.rst b/doc/changelog/02-specification-language/11579-inductive-params.rst
new file mode 100644
index 0000000000..28bc8e9592
--- /dev/null
+++ b/doc/changelog/02-specification-language/11579-inductive-params.rst
@@ -0,0 +1,7 @@
+- **Fixed:**
+ More robust and expressive treatment of implicit inductive
+ parameters in inductive declarations (`#11579
+ <https://github.com/coq/coq/pull/11579>`_, by Maxime Dénès, Gaëtan
+ Gilbert and Jasper Hugunin; fixes `#7253
+ <https://github.com/coq/coq/pull/7253>`_ and `#11585
+ <https://github.com/coq/coq/pull/11585>`_)
diff --git a/doc/changelog/03-notations/11530-master+fix11331-custom-entries-precedence.rst b/doc/changelog/03-notations/11530-master+fix11331-custom-entries-precedence.rst
deleted file mode 100644
index b105928b22..0000000000
--- a/doc/changelog/03-notations/11530-master+fix11331-custom-entries-precedence.rst
+++ /dev/null
@@ -1,8 +0,0 @@
-- **Fixed:**
- Bugs in dealing with precedences of notations in custom entries
- (`#11530 <https://github.com/coq/coq/pull/11530>`_,
- by Hugo Herbelin, fixing in particular
- `#9517 <https://github.com/coq/coq/pull/9517>`_,
- `#9519 <https://github.com/coq/coq/pull/9519>`_,
- `#9521 <https://github.com/coq/coq/pull/9521>`_,
- `#11331 <https://github.com/coq/coq/pull/11331>`_).
diff --git a/doc/changelog/03-notations/11859-warn-inexact-float.rst b/doc/changelog/03-notations/11859-warn-inexact-float.rst
deleted file mode 100644
index 224ffdbe9b..0000000000
--- a/doc/changelog/03-notations/11859-warn-inexact-float.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-- **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/11023-nativecompute-timing.rst b/doc/changelog/04-tactics/11023-nativecompute-timing.rst
deleted file mode 100644
index e8cdfcca21..0000000000
--- a/doc/changelog/04-tactics/11023-nativecompute-timing.rst
+++ /dev/null
@@ -1,7 +0,0 @@
-- The :flag:`NativeCompute Timing` flag causes calls to
- :tacn:`native_compute` (as well as kernel calls to the native
- compiler) to emit separate timing information about compilation,
- execution, and reification. It replaces the timing information
- previously emitted when the `-debug` flag was set, and allows more
- fine-grained timing of the native compiler (`#11023
- <https://github.com/coq/coq/pull/11023>`_, by Jason Gross).
diff --git a/doc/changelog/04-tactics/11025-nativecompute-timing.rst b/doc/changelog/04-tactics/11025-nativecompute-timing.rst
new file mode 100644
index 0000000000..cb77457c31
--- /dev/null
+++ b/doc/changelog/04-tactics/11025-nativecompute-timing.rst
@@ -0,0 +1,11 @@
+- **Changed:** The :flag:`NativeCompute Timing` flag causes calls to
+ :tacn:`native_compute` (as well as kernel calls to the native
+ compiler) to emit separate timing information about conversion to
+ native code, compilation, execution, and reification. It replaces
+ the timing information previously emitted when the `-debug` flag was
+ set, and allows more fine-grained timing of the native compiler
+ (`#11025 <https://github.com/coq/coq/pull/11025>`_, by Jason Gross).
+ Additionally, the timing information now uses real time rather than
+ user time (Fixes `#11962
+ <https://github.com/coq/coq/issues/11962>`_, `#11963
+ <https://github.com/coq/coq/pull/11963>`_, by Jason Gross)
diff --git a/doc/changelog/04-tactics/11883-fix-autounfold.rst b/doc/changelog/04-tactics/11883-fix-autounfold.rst
new file mode 100644
index 0000000000..83ff177380
--- /dev/null
+++ b/doc/changelog/04-tactics/11883-fix-autounfold.rst
@@ -0,0 +1,13 @@
+- **Fixed:**
+ The behavior of :tacn:`autounfold` no longer depends on the names of terms and modules
+ (`#11883 <https://github.com/coq/coq/pull/11883>`_,
+ fixes `#7812 <https://github.com/coq/coq/issues/7812>`_,
+ by Attila Gáspár).
+- **Changed:**
+ `at` clauses can no longer be used with :tacn:`autounfold`. Since they had no effect, it is safe to remove them
+ (`#11883 <https://github.com/coq/coq/pull/11883>`_,
+ by Attila Gáspár).
+- **Changed:**
+ :tacn:`autounfold` no longer fails when the :cmd:`Opaque` command is used on constants in the hint databases
+ (`#11883 <https://github.com/coq/coq/pull/11883>`_,
+ by Attila Gáspár).
diff --git a/doc/changelog/04-tactics/11976-deprecate-omega.rst b/doc/changelog/04-tactics/11976-deprecate-omega.rst
new file mode 100644
index 0000000000..59c9612d17
--- /dev/null
+++ b/doc/changelog/04-tactics/11976-deprecate-omega.rst
@@ -0,0 +1,5 @@
+- **Deprecated:**
+ The :tacn:`omega` tactic is deprecated;
+ use :tacn:`lia` from the :ref:`Micromega <micromega>` plugin instead
+ (`#11976 <https://github.com/coq/coq/pull/11976>`_,
+ by Vincent Laporte).
diff --git a/doc/changelog/04-tactics/12023-master+fixing-empty-Ltac-v-file.rst b/doc/changelog/04-tactics/12023-master+fixing-empty-Ltac-v-file.rst
new file mode 100644
index 0000000000..f10208e9b2
--- /dev/null
+++ b/doc/changelog/04-tactics/12023-master+fixing-empty-Ltac-v-file.rst
@@ -0,0 +1,6 @@
+- **Changed:**
+ Tactics with qualified name of the form ``Coq.Init.Notations`` are
+ now qualified with prefix ``Coq.Init.Ltac``; users of the -noinit
+ option should now import Coq.Init.Ltac if they want to use Ltac
+ (`#12023 <https://github.com/coq/coq/pull/12023>`_,
+ by Hugo Herbelin; minor source of incompatibilities).
diff --git a/doc/changelog/04-tactics/12116-master+fix12045-missing-reduction-in-using-ind-scheme.rst b/doc/changelog/04-tactics/12116-master+fix12045-missing-reduction-in-using-ind-scheme.rst
new file mode 100644
index 0000000000..7af2b4d97b
--- /dev/null
+++ b/doc/changelog/04-tactics/12116-master+fix12045-missing-reduction-in-using-ind-scheme.rst
@@ -0,0 +1,5 @@
+- **Fixed:**
+ Anomaly with induction schemes whose conclusion is not normalized
+ (`#12116 <https://github.com/coq/coq/pull/12116>`_,
+ by Hugo Herbelin; fixes
+ `#12045 <https://github.com/coq/coq/pull/12045>`_)
diff --git a/doc/changelog/05-tactic-language/11882-master+ltac2-fresh-in-context.rst b/doc/changelog/05-tactic-language/11882-master+ltac2-fresh-in-context.rst
new file mode 100644
index 0000000000..47e7be4d0e
--- /dev/null
+++ b/doc/changelog/05-tactic-language/11882-master+ltac2-fresh-in-context.rst
@@ -0,0 +1,6 @@
+- **Added:**
+ New Ltac2 function ``Fresh.Free.of_goal`` to return the list of
+ names of declarations of the current goal; new Ltac2 function
+ ``Fresh.in_goal`` to return a variable fresh in the current goal
+ (`#11882 <https://github.com/coq/coq/pull/11882>`_,
+ by Hugo Herbelin).
diff --git a/doc/changelog/07-commands-and-options/11534-let-with-annotations.rst b/doc/changelog/07-commands-and-options/11534-let-with-annotations.rst
new file mode 100644
index 0000000000..7bcbb9a8e3
--- /dev/null
+++ b/doc/changelog/07-commands-and-options/11534-let-with-annotations.rst
@@ -0,0 +1,3 @@
+- **Added:** Support for universe bindings and universe contrainsts in
+ :cmd:`Let` definitions (`#11534
+ <https://github.com/coq/coq/pull/11534>`_, by Théo Zimmermann).
diff --git a/doc/changelog/07-commands-and-options/11746-remove-chapter.rst b/doc/changelog/07-commands-and-options/11746-remove-chapter.rst
new file mode 100644
index 0000000000..0316432b0a
--- /dev/null
+++ b/doc/changelog/07-commands-and-options/11746-remove-chapter.rst
@@ -0,0 +1,3 @@
+- **Removed:** undocumented ``Chapter`` command. Use :cmd:`Section`
+ instead (`#11746 <https://github.com/coq/coq/pull/11746>`_, by Théo
+ Zimmermann).
diff --git a/doc/changelog/07-commands-and-options/12034-cumul-sprop.rst b/doc/changelog/07-commands-and-options/12034-cumul-sprop.rst
new file mode 100644
index 0000000000..ad7cf44482
--- /dev/null
+++ b/doc/changelog/07-commands-and-options/12034-cumul-sprop.rst
@@ -0,0 +1,5 @@
+- **Changed:**
+ Added :flag:`Cumulative StrictProp` to control cumulativity of
+ |SProp| and deprecated now redundant command line
+ ``--cumulative-sprop`` (`#12034
+ <https://github.com/coq/coq/pull/12034>`_, by Gaëtan Gilbert).
diff --git a/doc/changelog/07-commands-and-options/12070-native-compiler-disabled.rst b/doc/changelog/07-commands-and-options/12070-native-compiler-disabled.rst
new file mode 100644
index 0000000000..0f30b5f5e8
--- /dev/null
+++ b/doc/changelog/07-commands-and-options/12070-native-compiler-disabled.rst
@@ -0,0 +1,5 @@
+- **Changed:**
+ Ignore -native-compiler option when built without native compute
+ support.
+ (`#12070 <https://github.com/coq/coq/pull/12070>`_,
+ by Pierre Roux).
diff --git a/doc/changelog/08-tools/10592-coqdoc-details.rst b/doc/changelog/08-tools/10592-coqdoc-details.rst
new file mode 100644
index 0000000000..c5bdc1dbb0
--- /dev/null
+++ b/doc/changelog/08-tools/10592-coqdoc-details.rst
@@ -0,0 +1,5 @@
+- **Added:**
+ A new documentation environment ``details`` to make certain portion
+ of a Coq document foldable. See :ref:`coqdoc`
+ (`#10592 <https://github.com/coq/coq/pull/10592>`_,
+ by Thomas Letan).
diff --git a/doc/changelog/08-tools/12005-remove-deprecated-coqtop-options.rst b/doc/changelog/08-tools/12005-remove-deprecated-coqtop-options.rst
new file mode 100644
index 0000000000..affb685fcb
--- /dev/null
+++ b/doc/changelog/08-tools/12005-remove-deprecated-coqtop-options.rst
@@ -0,0 +1,5 @@
+- **Removed:**
+ Confusingly-named and deprecated since 8.11 `-require` option.
+ Use the equivalent `-require-import` instead
+ (`#12005 <https://github.com/coq/coq/pull/12005>`_,
+ by Théo Zimmermann).
diff --git a/doc/changelog/08-tools/12006-issue5632.rst b/doc/changelog/08-tools/12006-issue5632.rst
new file mode 100644
index 0000000000..162d56b1b6
--- /dev/null
+++ b/doc/changelog/08-tools/12006-issue5632.rst
@@ -0,0 +1,4 @@
+- **Added:**
+ ``Makefile`` generated by ``coq_makefile`` erases ``.lia.cache`` and ``.nia.cache`` by ``make cleanall``.
+ (`#12006 <https://github.com/coq/coq/pull/12006>`_,
+ by Olivier Laurent).
diff --git a/doc/changelog/08-tools/12026-master+coqdoc-self-linked-defs-wish7093.rst b/doc/changelog/08-tools/12026-master+coqdoc-self-linked-defs-wish7093.rst
new file mode 100644
index 0000000000..5c4ef82b8b
--- /dev/null
+++ b/doc/changelog/08-tools/12026-master+coqdoc-self-linked-defs-wish7093.rst
@@ -0,0 +1,4 @@
+- **Added:**
+ Definitions in coqdoc link to themselves, giving access in html to their own url
+ (`#12026 <https://github.com/coq/coq/pull/12026>`_,
+ by Hugo Herbelin; granting `#7093 <https://github.com/coq/coq/pull/7093>`_).
diff --git a/doc/changelog/08-tools/12033-master+coqdoc-fix7697-passing-binders-location.rst b/doc/changelog/08-tools/12033-master+coqdoc-fix7697-passing-binders-location.rst
new file mode 100644
index 0000000000..af0d28305a
--- /dev/null
+++ b/doc/changelog/08-tools/12033-master+coqdoc-fix7697-passing-binders-location.rst
@@ -0,0 +1,5 @@
+- **Added:**
+ Add hyperlinks on bound variables for coqdoc
+ (`#12033 <https://github.com/coq/coq/pull/12033>`_,
+ by Hugo Herbelin; it incidentally fixes
+ `#7697 <https://github.com/coq/coq/pull/7697>`_).
diff --git a/doc/changelog/08-tools/12037-coqdoc-preformatted.rst b/doc/changelog/08-tools/12037-coqdoc-preformatted.rst
new file mode 100644
index 0000000000..bf65719516
--- /dev/null
+++ b/doc/changelog/08-tools/12037-coqdoc-preformatted.rst
@@ -0,0 +1,6 @@
+- **Fixed:**
+ ``coqdoc`` now reports the location of a mismatched opening ``[[`` instead of
+ throwing an uninformative exception.
+ (`#12037 <https://github.com/coq/coq/pull/12037>`_,
+ fixes `#9670 <https://github.com/coq/coq/issues/9670>`_,
+ by Lysxia).
diff --git a/doc/changelog/08-tools/12091-master+coqdoc-css-target.rst b/doc/changelog/08-tools/12091-master+coqdoc-css-target.rst
new file mode 100644
index 0000000000..f6af5d40e8
--- /dev/null
+++ b/doc/changelog/08-tools/12091-master+coqdoc-css-target.rst
@@ -0,0 +1,4 @@
+- **Added:**
+ ``Coqdoc``: Highlighting of the exact position of the target of links
+ (`#12091 <https://github.com/coq/coq/pull/12091>`_,
+ by Hugo Herbelin).
diff --git a/doc/changelog/08-tools/12126-adjust-timed-name.rst b/doc/changelog/08-tools/12126-adjust-timed-name.rst
new file mode 100644
index 0000000000..c305b384d9
--- /dev/null
+++ b/doc/changelog/08-tools/12126-adjust-timed-name.rst
@@ -0,0 +1,8 @@
+- **Changed:**
+ The output of ``make TIMED=1`` (and therefore the timing targets
+ such as ``print-pretty-timed`` and ``print-pretty-timed-diff``) now
+ displays the full name of the output file being built, rather than
+ the stem of the rule (which was usually the filename without the
+ extension, but in general could be anything for user-defined rules
+ involving ``%``) (`#12126
+ <https://github.com/coq/coq/pull/12126>`_, by Jason Gross).
diff --git a/doc/changelog/09-coqide/10008-snyke7+escape_spaces.rst b/doc/changelog/09-coqide/10008-snyke7+escape_spaces.rst
deleted file mode 100644
index cbd97688c3..0000000000
--- a/doc/changelog/09-coqide/10008-snyke7+escape_spaces.rst
+++ /dev/null
@@ -1,4 +0,0 @@
-- **Fixed:**
- Compiling file paths containing spaces
- (`#10008 <https://github.com/coq/coq/pull/10008>`_,
- by snyke7, fixing `#11595 <https://github.com/coq/coq/pull/11595>`_).
diff --git a/doc/changelog/09-coqide/12060-ide-disable-csd.rst b/doc/changelog/09-coqide/12060-ide-disable-csd.rst
new file mode 100644
index 0000000000..b61ab26007
--- /dev/null
+++ b/doc/changelog/09-coqide/12060-ide-disable-csd.rst
@@ -0,0 +1,6 @@
+- **Changed:**
+ CoqIDE now uses native window frames by default on Windows.
+ The GTK window frames can be restored by setting the `GTK_CSD` environment variable to `1`
+ (`#12060 <https://github.com/coq/coq/pull/12060>`_,
+ fixes `#11080 <https://github.com/coq/coq/issues/11080>`_,
+ by Attila Gáspár).
diff --git a/doc/changelog/09-coqide/12106-master+coqide-style-apply-all-windows.rst b/doc/changelog/09-coqide/12106-master+coqide-style-apply-all-windows.rst
new file mode 100644
index 0000000000..6b1148a9a8
--- /dev/null
+++ b/doc/changelog/09-coqide/12106-master+coqide-style-apply-all-windows.rst
@@ -0,0 +1,5 @@
+- **Fixed:**
+ Highlighting style consistently applied to all three buffers of CoqIDE
+ (`#12106 <https://github.com/coq/coq/pull/12106>`_,
+ by Hugo Herbelin; fixes
+ `#11506 <https://github.com/coq/coq/pull/11506>`_).
diff --git a/doc/changelog/10-standard-library/11249-ollibs-list-changelog.rst b/doc/changelog/10-standard-library/11249-ollibs-list-changelog.rst
new file mode 100644
index 0000000000..be15fbf8f5
--- /dev/null
+++ b/doc/changelog/10-standard-library/11249-ollibs-list-changelog.rst
@@ -0,0 +1,17 @@
+- **Added:**
+ lemmas about lists:
+
+ - properties of ``In``: ``in_elt``, ``in_elt_inv``
+ - properties of ``nth``: ``app_nth2_plus``, ``nth_middle``, ``nth_ext``
+ - properties of ``last``: ``last_last``, ``removelast_last``
+ - properties of ``remove``: ``remove_cons``, ``remove_app``, ``notin_remove``, ``in_remove``, ``in_in_remove``, ``remove_remove_comm``, ``remove_remove_eq``, ``remove_length_le``, ``remove_length_lt``
+ - properties of ``concat``: ``in_concat``, ``remove_concat``
+ - properties of ``map`` and ``flat_map``: ``map_last``, ``map_eq_cons``, ``map_eq_app``, ``flat_map_app``, ``flat_map_ext``, ``nth_nth_nth_map``
+ - properties of ``incl``: ``incl_nil_l``, ``incl_l_nil``, ``incl_cons_inv``, ``incl_app_app``, ``incl_app_inv``, ``remove_incl``
+ - properties of ``Exists`` and ``Forall``: ``Exists_nth``, ``Exists_app``, ``Exists_rev``, ``Exists_fold_right``, ``incl_Exists``, ``Forall_nth``, ``Forall_app``, ``Forall_elt``, ``Forall_rev``, ``Forall_fold_right``, ``incl_Forall``, ``map_ext_Forall``, ``Exists_or``, ``Exists_or_inv``, ``Forall_and``, ``Forall_and_inv``, ``exists_Forall``, ``Forall_image``, ``concat_nil_Forall``, ``in_flat_map_Exists``, ``notin_flat_map_Forall``
+ - properties of ``repeat``: ``repeat_cons``, ``repeat_to_concat``
+ - definitions and properties of ``list_sum`` and ``list_max``: ``list_sum_app``, ``list_max_app``, ``list_max_le``, ``list_max_lt``
+ - misc: ``elt_eq_unit``, ``last_length``, ``rev_eq_app``, ``removelast_firstn_len``, ``NoDup_rev``, ``nodup_incl``, ``cons_seq``, ``seq_S``
+
+ (`#11249 <https://github.com/coq/coq/pull/11249>`_,
+ by Olivier Laurent).
diff --git a/doc/changelog/10-standard-library/11335-ollibs-wfnat-changelog.rst b/doc/changelog/10-standard-library/11335-ollibs-wfnat-changelog.rst
new file mode 100644
index 0000000000..0eb3eefde5
--- /dev/null
+++ b/doc/changelog/10-standard-library/11335-ollibs-wfnat-changelog.rst
@@ -0,0 +1,4 @@
+- **Added:**
+ Well-founded induction principles for `nat`: ``lt_wf_rect1``, ``lt_wf_rect``, ``gt_wf_rect``, ``lt_wf_double_rect``
+ (`#11335 <https://github.com/coq/coq/pull/11335>`_,
+ by Olivier Laurent).
diff --git a/doc/changelog/10-standard-library/11880-iter.rst b/doc/changelog/10-standard-library/11880-iter.rst
new file mode 100644
index 0000000000..be4e44ce4c
--- /dev/null
+++ b/doc/changelog/10-standard-library/11880-iter.rst
@@ -0,0 +1,8 @@
+- **Added:**
+ Facts about ``N.iter`` and ``Pos.iter``:
+
+ - ``N.iter_swap_gen``, ``N.iter_swap``, ``N.iter_succ``, ``N.iter_succ_r``, ``N.iter_add``, ``N.iter_ind``, ``N.iter_invariant``;
+ - ``Pos.iter_succ_r``, ``Pos.iter_ind``.
+
+ (`#11880 <https://github.com/coq/coq/pull/11880>`_,
+ by Lysxia).
diff --git a/doc/changelog/10-standard-library/11909-fix-≡-level.rst b/doc/changelog/10-standard-library/11909-fix-≡-level.rst
new file mode 100644
index 0000000000..96551be537
--- /dev/null
+++ b/doc/changelog/10-standard-library/11909-fix-≡-level.rst
@@ -0,0 +1,7 @@
+- **Changed:**
+ The level of :g:`≡` in ``Coq.Numbers.Cyclic.Int63.Int63`` is now 70,
+ no associativity, in line with :g:`=`. Note that this is a minor
+ incompatibility with developments that declare their own :g:`≡`
+ notation and import ``Int63`` (fixes `#11905
+ <https://github.com/coq/coq/issues/11905>`_, `#11909
+ <https://github.com/coq/coq/pull/11909>`_, by Jason Gross).
diff --git a/doc/changelog/10-standard-library/11946-ollibs-permutation.rst b/doc/changelog/10-standard-library/11946-ollibs-permutation.rst
new file mode 100644
index 0000000000..626677d31a
--- /dev/null
+++ b/doc/changelog/10-standard-library/11946-ollibs-permutation.rst
@@ -0,0 +1,10 @@
+- **Added:**
+ Facts about ``Permutation``:
+
+ - structure: ``Permutation_refl'``, ``Permutation_morph_transp``
+ - compatibilities: ``Permutation_app_rot``, ``Permutation_app_swap_app``, ``Permutation_app_middle``, ``Permutation_middle2``, ``Permutation_elt``, ``Permutation_Forall``, ``Permutation_Exists``, ``Permutation_Forall2``, ``Permutation_flat_map``, ``Permutation_list_sum``, ``Permutation_list_max``
+ - inversions: ``Permutation_app_inv_m``, ``Permutation_vs_elt_inv``, ``Permutation_vs_cons_inv``, ``Permutation_vs_cons_cons_inv``, ``Permutation_map_inv``, ``Permutation_image``, ``Permutation_elt_map_inv``
+ - length-preserving definition by means of transpositions ``Permutation_transp`` with associated properties: ``Permutation_transp_sym``, ``Permutation_transp_equiv``, ``Permutation_transp_cons``, ``Permutation_Permutation_transp``, ``Permutation_ind_transp``
+
+ (`#11946 <https://github.com/coq/coq/pull/11946>`_,
+ by Olivier Laurent).
diff --git a/doc/changelog/10-standard-library/11957-signotations.rst b/doc/changelog/10-standard-library/11957-signotations.rst
new file mode 100644
index 0000000000..fc5d434274
--- /dev/null
+++ b/doc/changelog/10-standard-library/11957-signotations.rst
@@ -0,0 +1,4 @@
+- **Added:**
+ notations for sigma types: ``{ x & P & Q }``, ``{ ' pat & P }``, ``{ ' pat & P & Q }``
+ (`#11957 <https://github.com/coq/coq/pull/11957>`_,
+ by Olivier Laurent).
diff --git a/doc/changelog/10-standard-library/12014-ollibs-vector.rst b/doc/changelog/10-standard-library/12014-ollibs-vector.rst
new file mode 100644
index 0000000000..87625dd23b
--- /dev/null
+++ b/doc/changelog/10-standard-library/12014-ollibs-vector.rst
@@ -0,0 +1,10 @@
+- **Added:**
+ Properties of some operations on vectors:
+
+ - ``nth_order``: ``nth_order_hd``, ``nth_order_tl``, ``nth_order_ext``
+ - ``replace``: ``nth_order_replace_eq``, ``nth_order_replace_neq``, ``replace_id``, ``replace_replace_eq``, ``replace_replace_neq``
+ - ``map``: ``map_id``, ``map_map``, ``map_ext_in``, ``map_ext``
+ - ``Forall`` and ``Forall2``: ``Forall_impl``, ``Forall_forall``, ``Forall_nth_order``, ``Forall2_nth_order``
+
+ (`#12014 <https://github.com/coq/coq/pull/12014>`_,
+ by Olivier Laurent).
diff --git a/doc/changelog/10-standard-library/12031-ollibs-cpermutation.rst b/doc/changelog/10-standard-library/12031-ollibs-cpermutation.rst
new file mode 100644
index 0000000000..95b4cce2f7
--- /dev/null
+++ b/doc/changelog/10-standard-library/12031-ollibs-cpermutation.rst
@@ -0,0 +1,4 @@
+- **Added:**
+ Definition and properties of cyclic permutations / circular shifts: ``CPermutation``
+ (`#12031 <https://github.com/coq/coq/pull/12031>`_,
+ by Olivier Laurent).
diff --git a/doc/changelog/10-standard-library/12044-issue-12015.rst b/doc/changelog/10-standard-library/12044-issue-12015.rst
new file mode 100644
index 0000000000..166fc80fb0
--- /dev/null
+++ b/doc/changelog/10-standard-library/12044-issue-12015.rst
@@ -0,0 +1,10 @@
+- **Fixed:**
+ Rewrote ``Structures.OrderedTypeEx.String_as_OT.compare``
+ to avoid huge proof terms
+ (Fixes `#12015 <https://github.com/coq/coq/issues/12015>`_,
+ `#12044 <https://github.com/coq/coq/pull/12044>`_,
+ by formalize.eth (formalize@protonmail.com)).
+- **Added:**
+ Added ``Structures.OrderedTypeEx.Ascii_as_OT``
+ (`#12044 <https://github.com/coq/coq/pull/12044>`_,
+ by formalize.eth (formalize@protonmail.com)).
diff --git a/doc/changelog/10-standard-library/12119-issue12119.rst b/doc/changelog/10-standard-library/12119-issue12119.rst
new file mode 100644
index 0000000000..42672b1465
--- /dev/null
+++ b/doc/changelog/10-standard-library/12119-issue12119.rst
@@ -0,0 +1,5 @@
+- **Changed:**
+ new lemma ``NoDup_incl_NoDup`` in ``List.v``
+ to remove useless hypothesis `NoDup l'` in ``Sorting.Permutation.NoDup_Permutation_bis``
+ (`#12119 <https://github.com/coq/coq/pull/12119>`_,
+ by Olivier Laurent).
diff --git a/doc/changelog/10-standard-library/9803-reals.rst b/doc/changelog/10-standard-library/9803-reals.rst
new file mode 100644
index 0000000000..86c5e45bc1
--- /dev/null
+++ b/doc/changelog/10-standard-library/9803-reals.rst
@@ -0,0 +1,14 @@
+- **Changed:**
+ Cleanup of names in the Reals theory: replaced `tan_is_inj` with `tan_inj` and replaced `atan_right_inv` with `tan_atan` -
+ compatibility notations are provided. Moved various auxiliary lemmas from `Ratan.v` to more appropriate places.
+ (`#9803 <https://github.com/coq/coq/pull/9803>`_,
+ by Laurent Théry and Michael Soegtrop).
+
+- **Added:** to the Reals theory:
+ inverse trigonometric functions `asin` and `acos` with lemmas for the derivatives, bounds and special values of these functions;
+ an extensive set of identities between trigonometric functions and their inverse functions;
+ lemmas for the injectivity of sine and cosine;
+ lemmas on the derivative of the inverse of decreasing functions and on the derivative of horizontally mirrored functions;
+ various generic auxiliary lemmas and definitions for Rsqr, sqrt, posreal an others.
+ (`#9803 <https://github.com/coq/coq/pull/9803>`_,
+ by Laurent Théry and Michael Soegtrop).
diff --git a/doc/changelog/11-infrastructure-and-dependencies/11860-ci+ocaml_to_4091.rst b/doc/changelog/11-infrastructure-and-dependencies/11860-ci+ocaml_to_4091.rst
deleted file mode 100644
index 94e2c34828..0000000000
--- a/doc/changelog/11-infrastructure-and-dependencies/11860-ci+ocaml_to_4091.rst
+++ /dev/null
@@ -1,4 +0,0 @@
-- **Added:**
- Bump official OCaml support to 4.09.1
- (`#11860 <https://github.com/coq/coq/pull/11860>`_,
- by Emilio Jesus Gallego Arias).
diff --git a/doc/changelog/12-misc/11329-master+fix11114-extraction-anomaly-implicit-record.rst b/doc/changelog/12-misc/11329-master+fix11114-extraction-anomaly-implicit-record.rst
deleted file mode 100644
index 0a686dd87d..0000000000
--- a/doc/changelog/12-misc/11329-master+fix11114-extraction-anomaly-implicit-record.rst
+++ /dev/null
@@ -1,4 +0,0 @@
-- **Fixed:**
- :cmd:`Extraction Implicit` on the constructor of a record was leading to an anomaly
- (`#11329 <https://github.com/coq/coq/pull/11329>`_,
- by Hugo Herbelin, fixes `#11114 <https://github.com/coq/coq/pull/11114>`_).
diff --git a/doc/common/styles/html/coqremote/sites/all/themes/coq/coqdoc.css b/doc/common/styles/html/coqremote/sites/all/themes/coq/coqdoc.css
deleted file mode 100644
index d23ea8f362..0000000000
--- a/doc/common/styles/html/coqremote/sites/all/themes/coq/coqdoc.css
+++ /dev/null
@@ -1,329 +0,0 @@
-body { padding: 0px 0px;
- margin: 0px 0px;
- background-color: white }
-
-#page { display: block;
- padding: 0px;
- margin: 0px;
- padding-bottom: 10px; }
-
-#header { display: block;
- position: relative;
- padding: 0;
- margin: 0;
- vertical-align: middle;
- border-bottom-style: solid;
- border-width: thin }
-
-#header h1 { padding: 0;
- margin: 0;}
-
-
-/* Contents */
-
-#main{ display: block;
- padding: 10px;
- font-family: sans-serif;
- font-size: 100%;
- line-height: 100% }
-
-#main h1 { line-height: 95% } /* allow for multi-line headers */
-
-#main a.idref:visited {color : #416DFF; text-decoration : none; }
-#main a.idref:link {color : #416DFF; text-decoration : none; }
-#main a.idref:hover {text-decoration : none; }
-#main a.idref:active {text-decoration : none; }
-
-#main a.modref:visited {color : #416DFF; text-decoration : none; }
-#main a.modref:link {color : #416DFF; text-decoration : none; }
-#main a.modref:hover {text-decoration : none; }
-#main a.modref:active {text-decoration : none; }
-
-#main .keyword { color : #cf1d1d }
-#main { color: black }
-
-.section { background-color: rgb(60%,60%,100%);
- padding-top: 13px;
- padding-bottom: 13px;
- padding-left: 3px;
- margin-top: 5px;
- margin-bottom: 5px;
- font-size : 175% }
-
-h2.section { background-color: rgb(80%,80%,100%);
- padding-left: 3px;
- padding-top: 12px;
- padding-bottom: 10px;
- font-size : 130% }
-
-h3.section { background-color: rgb(90%,90%,100%);
- padding-left: 3px;
- padding-top: 7px;
- padding-bottom: 7px;
- font-size : 115% }
-
-h4.section {
-/*
- background-color: rgb(80%,80%,80%);
- max-width: 20em;
- padding-left: 5px;
- padding-top: 5px;
- padding-bottom: 5px;
-*/
- background-color: white;
- padding-left: 0px;
- padding-top: 0px;
- padding-bottom: 0px;
- font-size : 100%;
- font-weight : bold;
- text-decoration : underline;
- }
-
-#main .doc { margin: 0px;
- font-family: sans-serif;
- font-size: 100%;
- line-height: 125%;
- max-width: 40em;
- color: black;
- padding: 10px;
- background-color: #90bdff}
-
-.inlinecode {
- display: inline;
-/* font-size: 125%; */
- color: #666666;
- font-family: monospace }
-
-.doc .inlinecode {
- display: inline;
- font-size: 120%;
- color: rgb(30%,30%,70%);
- font-family: monospace }
-
-.doc .inlinecode .id {
- color: rgb(30%,30%,70%);
-}
-
-.inlinecodenm {
- display: inline;
- color: #444444;
-}
-
-.doc .code {
- display: inline;
- font-size: 120%;
- color: rgb(30%,30%,70%);
- font-family: monospace }
-
-.comment {
- display: inline;
- font-family: monospace;
- color: rgb(50%,50%,80%);
-}
-
-.code {
- display: block;
-/* padding-left: 15px; */
- font-size: 110%;
- font-family: monospace;
- }
-
-table.infrule {
- border: 0px;
- margin-left: 50px;
- margin-top: 10px;
- margin-bottom: 10px;
-}
-
-td.infrule {
- font-family: monospace;
- text-align: center;
-/* color: rgb(35%,35%,70%); */
- padding: 0px;
- line-height: 100%;
-}
-
-tr.infrulemiddle hr {
- margin: 1px 0 1px 0;
-}
-
-.infrulenamecol {
- color: rgb(60%,60%,60%);
- font-size: 80%;
- padding-left: 1em;
- padding-bottom: 0.1em
-}
-
-/* Pied de page */
-
-#footer { font-size: 65%;
- font-family: sans-serif; }
-
-/* Identifiers: <span class="id" title="...">) */
-
-.id { display: inline; }
-
-.id[title="constructor"] {
- color: rgb(60%,0%,0%);
-}
-
-.id[title="var"] {
- color: rgb(40%,0%,40%);
-}
-
-.id[title="variable"] {
- color: rgb(40%,0%,40%);
-}
-
-.id[title="definition"] {
- color: rgb(0%,40%,0%);
-}
-
-.id[title="abbreviation"] {
- color: rgb(0%,40%,0%);
-}
-
-.id[title="lemma"] {
- color: rgb(0%,40%,0%);
-}
-
-.id[title="instance"] {
- color: rgb(0%,40%,0%);
-}
-
-.id[title="projection"] {
- color: rgb(0%,40%,0%);
-}
-
-.id[title="method"] {
- color: rgb(0%,40%,0%);
-}
-
-.id[title="inductive"] {
- color: rgb(0%,0%,80%);
-}
-
-.id[title="record"] {
- color: rgb(0%,0%,80%);
-}
-
-.id[title="class"] {
- color: rgb(0%,0%,80%);
-}
-
-.id[title="keyword"] {
- color : #cf1d1d;
-/* color: black; */
-}
-
-/* Deprecated rules using the 'type' attribute of <span> (not xhtml valid) */
-
-.id[type="constructor"] {
- color: rgb(60%,0%,0%);
-}
-
-.id[type="var"] {
- color: rgb(40%,0%,40%);
-}
-
-.id[type="variable"] {
- color: rgb(40%,0%,40%);
-}
-
-.id[type="definition"] {
- color: rgb(0%,40%,0%);
-}
-
-.id[type="abbreviation"] {
- color: rgb(0%,40%,0%);
-}
-
-.id[type="lemma"] {
- color: rgb(0%,40%,0%);
-}
-
-.id[type="instance"] {
- color: rgb(0%,40%,0%);
-}
-
-.id[type="projection"] {
- color: rgb(0%,40%,0%);
-}
-
-.id[type="method"] {
- color: rgb(0%,40%,0%);
-}
-
-.id[type="inductive"] {
- color: rgb(0%,0%,80%);
-}
-
-.id[type="record"] {
- color: rgb(0%,0%,80%);
-}
-
-.id[type="class"] {
- color: rgb(0%,0%,80%);
-}
-
-.id[type="keyword"] {
- color : #cf1d1d;
-/* color: black; */
-}
-
-.inlinecode .id {
- color: rgb(0%,0%,0%);
-}
-
-
-/* TOC */
-
-#toc h2 {
- padding: 10px;
- background-color: rgb(60%,60%,100%);
-}
-
-#toc li {
- padding-bottom: 8px;
-}
-
-/* Index */
-
-#index {
- margin: 0;
- padding: 0;
- width: 100%;
-}
-
-#index #frontispiece {
- margin: 1em auto;
- padding: 1em;
- width: 60%;
-}
-
-.booktitle { font-size : 140% }
-.authors { font-size : 90%;
- line-height: 115%; }
-.moreauthors { font-size : 60% }
-
-#index #entrance {
- text-align: center;
-}
-
-#index #entrance .spacer {
- margin: 0 30px 0 30px;
-}
-
-#index #footer {
- position: absolute;
- bottom: 0;
-}
-
-.paragraph {
- height: 0.75em;
-}
-
-ul.doclist {
- margin-top: 0em;
- margin-bottom: 0em;
-}
diff --git a/doc/common/styles/html/coqremote/sites/all/themes/coq/style.css b/doc/common/styles/html/coqremote/sites/all/themes/coq/style.css
deleted file mode 100644
index 32c0b33166..0000000000
--- a/doc/common/styles/html/coqremote/sites/all/themes/coq/style.css
+++ /dev/null
@@ -1,801 +0,0 @@
-body
-{
- background: white;
- color:#444;
- font:normal normal normal small/1.5em "Lucida Grande", Verdana, sans-serif;
- margin:0;
- padding:0;
-}
-
-h2
-{
- font-size:150%;
- font-weight:normal;
- margin:20px 0 0;
-}
-
-h3
-{
- font-size:130%;
- font-weight:normal;
-}
-
-a:link,a:visited
-{
- color:#660403;
- font-weight:normal;
- text-decoration:none;
-}
-
-a:hover
-{
- color: red;
- text-decoration:none;
-}
-
-#container
-{
- margin: 0;
- padding: 0;
- }
-
- /*----------header, logo and site name styles----------*/
- #headertop
- {
- display: block;
- /* position:absolute; */
- min-width: 700px;
- top: 0;
- width: 100%;
- height:30px;
- z-index: 1;
- background: transparent url('images/header_top.png') repeat-x;
- }
-
- #header
- {
- min-width: 700px;
- width: 100%; height:70px;
- position: relative;
- left: 0; top: 0;
- background: transparent url('images/header_bot.png') repeat-x;
- }
-
- #logo
- {
- float:left;
- z-index: 2;
- position: absolute;
- top: -15px;
- left: 0px;
- }
-
- #logo img
- {
- border:0;
- float:left;
- }
-
- #logoWrapper
- {
- line-height:4em;
- }
-
- #siteName
- {
- position: relative;
- top: 10px; left: 80px;
- color:#fff;
- float:left;
- font-size:350%;
- }
-
- #siteName a
- {
- color:#fff;
- text-decoration:none;
- }
-
- #siteName a:hover
- {
- color:#ddd;
- text-decoration:none;
- }
-
- #siteSlogan
- {
- color:#eee;
- float:left;
- font-size:170%;
- margin:50px 0 0 10px;
- text-transform:lowercase;
- white-space:nowrap;
- }
-
- /*----------nav styles -- primary links in header----------*/
-
- #nav
-{
- position:absolute; right:0;
- margin: 0;
- padding: 5px;
- }
-
-#nav ul
- {
- list-style:none outside none;
- list-style-image:none;
- margin:0;
- padding:0;
- }
-
- #nav li
- {
- display: inline;
- margin: 0; padding: 4px;
- }
-
- #nav li a
- {
- border:medium none;
- color:#ccc;
- font-weight:normal;
- padding-left:10px;
- padding-right:10px;
- text-decoration:none;
- }
-
- #nav li a:hover
- {
- background:#7B0505 none repeat;
- border:medium none;
- border-left:1px solid #ddd;
- border-right:1px solid #ddd;
- color:#fff;
- padding: 6px 9px 5px 9px;
- }
-
-
-/************** FOOTER *******************/
-
-
-#footer
-{
- background:transparent url('images/footer.png') repeat-x;
- width:100%;
- clear:both;
- font-size:85%;
- text-align:center;
- /* position:fixed; */
- margin: 0;
- padding: 0;
-}
-
-
-#nav-footer
-{
- display: inline;
- color:#444;
- margin: 0;
- padding: 0;
- text-align:right;
- }
-
-#nav-footer ul
- {
- list-style:none outside none;
- list-style-image:none;
- margin:0;
- padding:0px; padding-right: 5px;
- }
-
-#nav-footer li
-{
- display:inline; padding: 4px;
-}
-
- #nav-footer li a
- {
- border:medium none;
- color:#ccc;
- font-size: 11px;
- font-weight:normal;
- padding-left: 10px;
- padding-right: 10px;
- text-decoration:none;
- }
-
- #nav-footer li a:hover
- {
- background:#7B0505 none repeat;
- border:medium none;
- border-left:1px solid #ddd;
- border-right:1px solid #ddd;
- color:#fff;
- margin:0;
- padding: 3px 9px 0px 9px;
- }
-
-
- /*----------main content----------*/
- #content
- {
- display: block;
- position: static;
-
-/* min-width: 640px; */
- max-width: 800px;
-
- margin-left:40px;
- margin-right:300px;
- padding: 2ex 2ex;
-
- z-index:1;
- }
-
-.content {
- display: block;
- position: relative;
-
- margin: 0;
- padding: 0;
-}
-
- /*----------sidebar styles----------*/
- #sidebarWrapper
- {
- /* background:transparent url('images/sidebar_bottom.jpg') no-repeat scroll left bottom;*/
- display:block;
- position:fixed;
- /* avant : top: 100px; right:0px*/
- top: 15px; /* 180 */
- right:0px;
- left: auto;
-
- margin-right: 0px;
-
- /* avant
- width: 12%;
- min-width:80px; */
-
- /* width: 18%; */
- /* min-*/
- width:270px;
-
- z-index:0;
- overflow:hidden;
-
-/* ajout precedent:*/
-/* min-height:320px;
- padding:10px;
- background-image:url('http://www.lix.polytechnique.fr/Labo/Denis.Cousineau/data/coq/rttr340bis.png');
- background-repeat : repeat-x ;*/
-
-/* last ajout */
- /* min-height:510px; */ /* 360 */
- padding-left:0px;
- padding-right:0px;
- padding-top:105px; /* 40 */
- padding-bottom:/*105px*/115px;
- /* background:transparent url('http://www.lix.polytechnique.fr/Labo/Denis.Cousineau/data/coq/trig6b.png') no-repeat scroll left top; */
- background:transparent url('images/sidebarbot.png') no-repeat scroll right bottom;
-
- }
-
-#sidebar {
- padding-left: 40px;
- padding-top: 105px;
- overflow: visible;
- background:transparent url('images/sidebartop.png') no-repeat scroll right top;
-}
-
-#sidebar .title
-{
- /* avant :border-bottom:1px solid #eee;*/
- /* avant : color:#660403;*/
- color:#2D0102;
- font-size:120%;
- font-weight:bold;
- line-height:19px;
- margin:10px 0;
-}
-
-/*----------page styles----------*/
-.pageTitle
-{
- color:#2D0102;
- font-size:220%;
- margin:10px 0 20px;
-}
-
-.mission
-{
- background-color:#efefef;
- border:solid 1px #ccc;
- margin:0 0 10px 0;
- padding:10px;
-}
-
-.messages
-{
- color:#C80000;
- font-size:110%;
- margin:10px 0;
-}
-
-/*----------node styles----------*/
-.nodeTitle
-{
- background: url('images/nodeTitle.gif') no-repeat 0 100%;
- color:#9a0000;
- font-size: 100%;
- margin:0;
-}
-
-.nodeTitle a
-{
- color:#660403;
- text-decoration:none;
-}
-
-.nodeTitle a:hover
-{
- color:#d00000;
- text-decoration:none;
-}
-
-.node
-{
- margin:0 0 20px;
-}
-
-.content p
-{
- margin:10px 0;
-}
-
-.submitted
-{
- color:#a3a3a3;
- font-size:70%;
-}
-
-.nodeLinks
-{
- font-size:95%;
- margin:0;
- padding:0;
-}
-
-.taxonomy
-{
- background:url('icons/tag_red.png') no-repeat 0 7px;
- font-size:80%;
- padding:0 0 5px 16px;
-}
-
-/*----------comment styles----------*/
-.commentTitle
-{
- Border-bottom:1px solid #ddd;
- color:#9a0000;
- font-size:130%;
- margin:20px 0 0;
-}
-
-.commentTitle a
-{
- color:#660403;
- text-decoration:none;
-}
-
-.commentTitle a:hover
-{
- color:#d00000;
- text-decoration:none;
-}
-
-.commentLinks
-{
- background:#f7f7f7;
- border:1px solid #e1e1e1;
- color:#444;
- font-size:95%;
- margin:20px 0 30px;
- padding:4px 0 4px 4px;
-}
-
-
-/*----------img styles----------*/
-img
-{
- padding:3px;
-}
-
-/*----------icons for links----------*/
-.comment_comments a
-{
- background:url('icons/comment.png') no-repeat 0 2px;
- padding-bottom:5px;
- padding-left:20px;
-}
-
-.node_read_more a
-{
- background:url('icons/page_white_go.png') no-repeat;
- padding-bottom:5px;
- padding-left:20px;
-}
-
-.comment_add a,.comment_reply a
-{
- background:url('icons/comment_add.png') no-repeat;
- padding-bottom:5px;
- padding-left:20px;
-}
-.comment_delete a
-{
- background:url('icons/comment_delete.png') no-repeat;
- padding-bottom:5px;
- padding-left:20px;
-}
-
-.comment_edit a
-{
- background:url('icons/comment_edit.png') no-repeat;
- padding-bottom:5px;
- padding-left:20px;
-}
-
-/*----------TinyMCE editor----------*/
-body.mceContentBody
-{
- background:#fff;
- color:#000;
- font-size:12px;
-}
-
-body.mceContentBody a:link
-{
- color:#ff0000;
-}
-
-/*----------table styles----------*/
-table
-{
- margin:1em 0;
- width:100%;
-}
-
-thead th
-{
- border-bottom:2px solid #AAA;
- color:#494949;
- font-weight:bold;
-}
-
-td,th
-{
- padding:.3em 0 .5em;
-}
-
-tr.even,tr.odd,tbody th
-{
- border:solid #D5D6D7;
- border-width:1px 0;
-}
-
-tr.even
-{
- background:#fff;
-}
-
-td.region,td.module,td.container
-{
- background:#D5D6D7;
- border-bottom:1px solid #AAA;
- border-top:1.5em solid #fff;
- color:#455067;
- font-weight:bold;
-}
-
-tr:first-child td.region,tr:first-child td.module,tr:first-child td.container
-{
- border-top-width:0;
-}
-
-td.menu-disabled,td.menu-disabled a
-{
- background-color:#D5C2C2;
- color:#000;
-}
-
-/*----------other styles----------*/
-
-.block
-{
- margin:5px 0 20px;
-}
-
-.thumbnail,.preview
-{
- border:1px solid #ccc;
-}
-
-.lstlisting {
- display: block;
- font-family: monospace;
- white-space: pre;
- margin: 1em 0;
-}
-.center {
- text-align: center;
-}
-.centered {
- display: block-inline;
-}
-
-/*----------download table------------*/
-
-table.downloadtable
-{
- width:90%;
- margin-left:auto;
- margin-right:auto;
-}
-
-table.downloadtable td.downloadheader
-{
-padding: 2px 1em;
-font-weight: bold;
-font-size: 120%;
-color: white;
-background: transparent url('images/header_bot.png') repeat-x;
-/*background-color: #660403; */
-border: solid 2px white;
-border-left: none;
-}
-
-table.downloadtable td.downloadcategory
-{
-padding: 2px 1em;
-background-color: #dfbfbe;
-text-indent: 0;
-}
-
-table.downloadtable td.downloadsize
-{
-text-indent: 0;
-white-space: nowrap;
-height: 52px;
-}
-
-table.downloadtable td
-{
-padding: 2px 1em;
-background-color: #dfbfbe;
-border-right: solid white 2px;
-}
-
-
-table.downloadtable td.downloadtopline
-{
-border-top: solid white 2px;
-}
-
-table.downloadtable td.downloadtoprightline
-{
-border-top: solid 2px white;
-border-right: solid 2px white;
-}
-
-table.downloadtable td.downloadbottomline
-{
-border-bottom: solid 2px white;
-border-right: solid 2px white;
-}
-
-table.downloadtable td.downloadbottomrightline
-{
-border-bottom: solid 2px white;
-border-right: solid 2px white;
-}
-
-table.downloadtable td.downloadrightline
-{
-border-right: solid 2px white;
-}
-
-table.downloadtable td.downloadback
-{
-background-color: #efe4e4;
-}
-
-table.downloadtable td.downloadbottomback
-{
-border-bottom: solid 2px white;
-background-color: #efe4e4;
-}
-
-
-/*********** Normal text style ************/
-
-p {
- text-indent:3em;
-}
-
-ul {
- margin: 0px;
- margin-left:4em;
- padding: 0px;
- list-style-type:square;
-}
-
-li
-{
- text-indent: 0px;
- margin: 0px;
- padding: 0px;
-}
-
-tt { font-size: 1em; }
-
-pre { font-size: 1em; }
-
-/*********** Framework ***********/
-.framework
-{
- display: block;
- position:relative;
- border:solid 1px #660033;
- margin: 8ex 1em; /* 8ex 8ex 1em 1em; */
- padding: 0;
-}
-
-.frameworkcontent
-{
- position:relative;
- left:0px;
-
-
- margin: 0;
- padding: .5ex 2em;
-
- text-indent: 2em;
- text-align: justify;
-}
-
-
-.frameworklabel
-{
- display: inline;
- position:relative;
- top:-1.3ex;
-
- margin-left:2ex;
- padding-top:.4ex;
- padding-bottom:.4ex;
- padding-right:1ex;
- padding-left:1ex;
-
- border: none;
- background: white;
- color: black;
-
- font-weight: bold;
- font-size:115%;
-}
-
-.frameworklinks {
- display:block;
- position:relative;
- top:1.4ex;
-
- margin-right:2ex;
-
- text-align:right;
- font-size:100%
- }
-
-.frameworklinks ul
-{
- display: inline;
- padding: 0px 1ex;
-
- border: none;
- background: white;
-}
-
-
-.frameworklinks li
- {
- display:inline;
- padding: 1ex 0px;
- }
-
- .frameworklinks li a
-{
- border:medium none;
-
- margin: 0px 1ex;
- padding-left:2px;
- padding-right:3px;
-
- font-weight:normal;
- text-decoration:none;
-
- color: #660003;
-}
-
- .frameworklinks li a:hover
- {
- color: red;
-
- border: none;
- }
-
-/* General flat lists */
-.flatlist li {display: inline}
-
-/* For sections in bycat.html */
-.bycatsection dt {
- text-indent: 3em
-}
-
-.bycatsection dt a
-{
- font-weight: bold;
- color:#444;
-}
-
-/* footnote is used in the new contribution form */
-.footnote {
- text-indent: 0pt;
- font-size: 80%;
- color: silver;
- text-align: justify
-}
-
-/****************** CoqIDE Screenshots *****************/
-
-
-.SCpager {
- position:relative;
- top:5px;
- width:630px;
- background: transparent url('images/header_bot.png') repeat-x;
- padding:4px;
-}
-
-.SCpagercontent {
- width:390px;
- position:relative;
- margin-left:auto;
- margin-right:auto;
-}
-
-.SCthumb {
- height:45px;
- margin-left:2px;
- margin-right:2px;
-}
-
-.SCthumbselected {
- height:55px;
- margin-left:2px;
- margin-right:2px;
-}
-
-.SCcontent {
- position:relative;
- top:5px;
- width:638px;
- background-color: #dfbfbe;
-}
-
-.SCscreenshot {
- position:relative;
- height:400px;
- width:auto;
- margin:15px auto 15px 19px;
-}
diff --git a/doc/dune b/doc/dune
index 4210c0a482..8b005f5b2f 100644
--- a/doc/dune
+++ b/doc/dune
@@ -23,7 +23,14 @@
(targets refman-html)
(alias refman-html)
(package coq-doc)
- (deps (alias refman-deps))
+ ; Cannot use this deps alias because of ocaml/dune#3415
+ ; (deps (alias refman-deps))
+ (deps
+ (package coq)
+ (source_tree sphinx)
+ (source_tree tools/coqrst)
+ unreleased.rst
+ (env_var SPHINXWARNOPT))
(action
(run env COQLIB=%{project_root} sphinx-build %{env:SPHINXWARNOPT=-W} -b html sphinx %{targets})))
@@ -31,7 +38,14 @@
(targets refman-pdf)
(alias refman-pdf)
(package coq-doc)
- (deps (alias refman-deps))
+ ; Cannot use this deps alias because of ocaml/dune#3415
+ ; (deps (alias refman-deps))
+ (deps
+ (package coq)
+ (source_tree sphinx)
+ (source_tree tools/coqrst)
+ unreleased.rst
+ (env_var SPHINXWARNOPT))
(action
(progn
(run env COQLIB=%{project_root} sphinx-build %{env:SPHINXWARNOPT=-W} -b latex sphinx %{targets})
diff --git a/doc/plugin_tutorial/tuto1/src/g_tuto1.mlg b/doc/plugin_tutorial/tuto1/src/g_tuto1.mlg
index 73d94c2a51..8c2090f3be 100644
--- a/doc/plugin_tutorial/tuto1/src/g_tuto1.mlg
+++ b/doc/plugin_tutorial/tuto1/src/g_tuto1.mlg
@@ -286,8 +286,8 @@ END
VERNAC COMMAND EXTEND ExploreProof CLASSIFIED AS QUERY
| ![ proof_query ] [ "ExploreProof" ] ->
{ fun ~pstate ->
- let sigma, env = Pfedit.get_current_context pstate in
- let pprf = Proof.partial_proof (Proof_global.get_proof pstate) in
+ let sigma, env = Declare.get_current_context pstate in
+ let pprf = Proof.partial_proof (Declare.Proof.get_proof pstate) in
Feedback.msg_notice
(Pp.prlist_with_sep Pp.fnl (Printer.pr_econstr_env env sigma) pprf)
}
diff --git a/doc/plugin_tutorial/tuto1/src/simple_declare.ml b/doc/plugin_tutorial/tuto1/src/simple_declare.ml
index 2fdca15552..b94b1fc657 100644
--- a/doc/plugin_tutorial/tuto1/src/simple_declare.ml
+++ b/doc/plugin_tutorial/tuto1/src/simple_declare.ml
@@ -1,12 +1,6 @@
-let edeclare ?hook ~name ~poly ~scope ~kind ~opaque ~udecl ~impargs sigma body tyopt =
- 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 ubind = Evd.universe_binders sigma in
- let hook_data = Option.map (fun hook -> hook, uctx, []) hook in
- DeclareDef.declare_definition ~name ~scope ~kind ~ubind ce ~impargs ?hook_data
-
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 ~impargs:[] ~udecl sigma body None
+ let scope = DeclareDef.Global Declare.ImportDefaultBehavior in
+ let kind = Decls.(IsDefinition Definition) in
+ DeclareDef.declare_definition ~name ~scope ~kind ~impargs:[] ~udecl
+ ~opaque:false ~poly ~types:None ~body sigma
diff --git a/doc/sphinx/addendum/implicit-coercions.rst b/doc/sphinx/addendum/implicit-coercions.rst
index 1f33775a01..cfaa681d20 100644
--- a/doc/sphinx/addendum/implicit-coercions.rst
+++ b/doc/sphinx/addendum/implicit-coercions.rst
@@ -257,7 +257,7 @@ Activating the Printing of Coercions
:name: Printing Coercion
Specifies a set of qualids for which coercions are always displayed. Use the
- :cmd:`Add @table` and :cmd:`Remove @table` commands to update the set of qualids.
+ :cmd:`Add` and :cmd:`Remove` commands to update the set of qualids.
.. _coercions-classes-as-records:
diff --git a/doc/sphinx/addendum/micromega.rst b/doc/sphinx/addendum/micromega.rst
index f706633da9..77bf58aac6 100644
--- a/doc/sphinx/addendum/micromega.rst
+++ b/doc/sphinx/addendum/micromega.rst
@@ -1,4 +1,4 @@
-.. _ micromega:
+.. _micromega:
Micromega: tactics for solving arithmetic goals over ordered rings
==================================================================
diff --git a/doc/sphinx/addendum/omega.rst b/doc/sphinx/addendum/omega.rst
index daca43e65e..e1b1ee8e8d 100644
--- a/doc/sphinx/addendum/omega.rst
+++ b/doc/sphinx/addendum/omega.rst
@@ -1,4 +1,4 @@
-.. _omega:
+.. _omega_chapter:
Omega: a solver for quantifier-free problems in Presburger Arithmetic
=====================================================================
@@ -7,20 +7,18 @@ Omega: a solver for quantifier-free problems in Presburger Arithmetic
.. warning::
- The :tacn:`omega` tactic is about to be deprecated in favor of the
- :tacn:`lia` tactic. The goal is to consolidate the arithmetic
- solving capabilities of Coq into a single engine; moreover,
- :tacn:`lia` is in general more powerful than :tacn:`omega` (it is a
- complete Presburger arithmetic solver while :tacn:`omega` was known
- to be incomplete).
-
- Work is in progress to make sure that there are no regressions
- (including no performance regression) when switching from
- :tacn:`omega` to :tacn:`lia` in existing projects. However, we
- already recommend using :tacn:`lia` in new or refactored proof
- scripts. We also ask that you report (in our `bug tracker
- <https://github.com/coq/coq/issues>`_) any issue you encounter,
- especially if the issue was not present in :tacn:`omega`.
+ The :tacn:`omega` tactic is deprecated in favor of the :tacn:`lia`
+ tactic. The goal is to consolidate the arithmetic solving
+ capabilities of Coq into a single engine; moreover, :tacn:`lia` is
+ in general more powerful than :tacn:`omega` (it is a complete
+ Presburger arithmetic solver while :tacn:`omega` was known to be
+ incomplete).
+
+ It is recommended to switch from :tacn:`omega` to :tacn:`lia` in existing
+ projects. We also ask that you report (in our `bug tracker
+ <https://github.com/coq/coq/issues>`_) any issue you encounter, especially
+ if the issue was not present in :tacn:`omega`. If no new issues are
+ reported, :tacn:`omega` will be removed soon.
Note that replacing :tacn:`omega` with :tacn:`lia` can break
non-robust proof scripts which rely on incompleteness bugs of
@@ -30,6 +28,11 @@ Description of ``omega``
------------------------
.. tacn:: omega
+ :name: omega
+
+ .. deprecated:: 8.12
+
+ Use :tacn:`lia` instead.
:tacn:`omega` is a tactic for solving goals in Presburger arithmetic,
i.e. for proving formulas made of equations and inequalities over the
@@ -118,7 +121,7 @@ loaded by
.. example::
- .. coqtop:: all
+ .. coqtop:: all warn
Require Import Omega.
diff --git a/doc/sphinx/addendum/sprop.rst b/doc/sphinx/addendum/sprop.rst
index 9acdd18b89..b2d3687780 100644
--- a/doc/sphinx/addendum/sprop.rst
+++ b/doc/sphinx/addendum/sprop.rst
@@ -240,3 +240,10 @@ so correctly converts ``x`` and ``y``.
the kernel when it is passed a term with incorrect relevance marks.
To avoid conversion issues as in ``late_mark`` you may wish to use
it to find when your tactics are producing incorrect marks.
+
+.. flag:: Cumulative StrictProp
+ :name: Cumulative StrictProp
+
+ Set this flag (it is off by default) to make the kernel accept
+ cumulativity between |SProp| and other universes. This makes
+ typechecking incomplete.
diff --git a/doc/sphinx/addendum/universe-polymorphism.rst b/doc/sphinx/addendum/universe-polymorphism.rst
index a08495badd..2958d866ac 100644
--- a/doc/sphinx/addendum/universe-polymorphism.rst
+++ b/doc/sphinx/addendum/universe-polymorphism.rst
@@ -227,7 +227,7 @@ constraints by prefixing the level names with symbols.
Because inductive subtypings are only produced by comparing inductives
to themselves with universes changed, they amount to variance
information: each universe is either invariant, covariant or
-irrelevant (there are no contravariant subtypings in Coq),
+irrelevant (there are no contravariant subtypings in |Coq|),
respectively represented by the symbols `=`, `+` and `*`.
Here we see that :g:`list` binds an irrelevant universe, so any two
@@ -426,6 +426,19 @@ mode, introduced universe names can be referred to in terms. Note that
local universe names shadow global universe names. During a proof, one
can use :cmd:`Show Universes` to display the current context of universes.
+It is possible to provide only some universe levels and let |Coq| infer the others
+by adding a :g:`+` in the list of bound universe levels:
+
+.. coqtop:: all
+
+ Fail Definition foobar@{u} : Type@{u} := Type.
+ Definition foobar@{u +} : Type@{u} := Type.
+ Set Printing Universes.
+ Print foobar.
+
+This can be used to find which universes need to be explicitly bound in a given
+definition.
+
Definitions can also be instantiated explicitly, giving their full
instance:
diff --git a/doc/sphinx/appendix/indexes/index.rst b/doc/sphinx/appendix/indexes/index.rst
index a5032ff822..2ece726df7 100644
--- a/doc/sphinx/appendix/indexes/index.rst
+++ b/doc/sphinx/appendix/indexes/index.rst
@@ -16,9 +16,11 @@ find what you are looking for.
../../coq-tacindex
../../coq-optindex
../../coq-exnindex
+ ../../coq-attrindex
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.
+ option;
+- :ref:`gallina-attributes`.
diff --git a/doc/sphinx/changes.rst b/doc/sphinx/changes.rst
index ba1cb741ed..6615b98660 100644
--- a/doc/sphinx/changes.rst
+++ b/doc/sphinx/changes.rst
@@ -55,7 +55,8 @@ __ 811Reals_
Additionally, while the :tacn:`omega` tactic is not yet deprecated in
this version of Coq, it should soon be the case and we already
recommend users to switch to :tacn:`lia` in new proof scripts (see
-also the warning message in the :ref:`corresponding chapter <omega>`).
+also the warning message in the :ref:`corresponding chapter
+<omega_chapter>`).
The ``dev/doc/critical-bugs`` file documents the known critical bugs
of |Coq| and affected releases. See the `Changes in 8.11+beta1`_
@@ -649,6 +650,57 @@ Changes in 8.11.0
(`#11227 <https://github.com/coq/coq/pull/11227>`_,
by Bernhard M. Wiedemann).
+Changes in 8.11.1
+~~~~~~~~~~~~~~~~~
+
+**Kernel**
+
+- **Fixed:**
+ Allow more inductive types in `Unset Positivity Checking` mode
+ (`#11811 <https://github.com/coq/coq/pull/11811>`_,
+ by SimonBoulier).
+
+**Notations**
+
+- **Fixed:**
+ Bugs in dealing with precedences of notations in custom entries
+ (`#11530 <https://github.com/coq/coq/pull/11530>`_,
+ by Hugo Herbelin, fixing in particular
+ `#9517 <https://github.com/coq/coq/pull/9517>`_,
+ `#9519 <https://github.com/coq/coq/pull/9519>`_,
+ `#9521 <https://github.com/coq/coq/pull/9521>`_,
+ `#11331 <https://github.com/coq/coq/pull/11331>`_).
+- **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).
+
+**CoqIDE**
+
+- **Fixed:**
+ Compiling file paths containing spaces
+ (`#10008 <https://github.com/coq/coq/pull/10008>`_,
+ by snyke7, fixing `#11595 <https://github.com/coq/coq/pull/11595>`_).
+
+**Infrastructure and dependencies**
+
+- **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).
+
+**Miscellaneous**
+
+- **Fixed:**
+ :cmd:`Extraction Implicit` on the constructor of a record was leading to an anomaly
+ (`#11329 <https://github.com/coq/coq/pull/11329>`_,
+ by Hugo Herbelin, fixes `#11114 <https://github.com/coq/coq/pull/11114>`_).
+
Version 8.10
------------
diff --git a/doc/sphinx/coq-attrindex.rst b/doc/sphinx/coq-attrindex.rst
new file mode 100644
index 0000000000..f2ace20374
--- /dev/null
+++ b/doc/sphinx/coq-attrindex.rst
@@ -0,0 +1,5 @@
+:orphan:
+
+---------------
+Attribute index
+---------------
diff --git a/doc/sphinx/coqdoc.css b/doc/sphinx/coqdoc.css
deleted file mode 100644
index a325a33842..0000000000
--- a/doc/sphinx/coqdoc.css
+++ /dev/null
@@ -1,338 +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) */
-/************************************************************************/
-body { padding: 0px 0px;
- margin: 0px 0px;
- background-color: white }
-
-#page { display: block;
- padding: 0px;
- margin: 0px;
- padding-bottom: 10px; }
-
-#header { display: block;
- position: relative;
- padding: 0;
- margin: 0;
- vertical-align: middle;
- border-bottom-style: solid;
- border-width: thin }
-
-#header h1 { padding: 0;
- margin: 0;}
-
-
-/* Contents */
-
-#main{ display: block;
- padding: 10px;
- font-family: sans-serif;
- font-size: 100%;
- line-height: 100% }
-
-#main h1 { line-height: 95% } /* allow for multi-line headers */
-
-#main a.idref:visited {color : #416DFF; text-decoration : none; }
-#main a.idref:link {color : #416DFF; text-decoration : none; }
-#main a.idref:hover {text-decoration : none; }
-#main a.idref:active {text-decoration : none; }
-
-#main a.modref:visited {color : #416DFF; text-decoration : none; }
-#main a.modref:link {color : #416DFF; text-decoration : none; }
-#main a.modref:hover {text-decoration : none; }
-#main a.modref:active {text-decoration : none; }
-
-#main .keyword { color : #cf1d1d }
-#main { color: black }
-
-.section { background-color: rgb(60%,60%,100%);
- padding-top: 13px;
- padding-bottom: 13px;
- padding-left: 3px;
- margin-top: 5px;
- margin-bottom: 5px;
- font-size : 175% }
-
-h2.section { background-color: rgb(80%,80%,100%);
- padding-left: 3px;
- padding-top: 12px;
- padding-bottom: 10px;
- font-size : 130% }
-
-h3.section { background-color: rgb(90%,90%,100%);
- padding-left: 3px;
- padding-top: 7px;
- padding-bottom: 7px;
- font-size : 115% }
-
-h4.section {
-/*
- background-color: rgb(80%,80%,80%);
- max-width: 20em;
- padding-left: 5px;
- padding-top: 5px;
- padding-bottom: 5px;
-*/
- background-color: white;
- padding-left: 0px;
- padding-top: 0px;
- padding-bottom: 0px;
- font-size : 100%;
- font-weight : bold;
- text-decoration : underline;
- }
-
-#main .doc { margin: 0px;
- font-family: sans-serif;
- font-size: 100%;
- line-height: 125%;
- max-width: 40em;
- color: black;
- padding: 10px;
- background-color: #90bdff }
-
-.inlinecode {
- display: inline;
-/* font-size: 125%; */
- color: #666666;
- font-family: monospace }
-
-.doc .inlinecode {
- display: inline;
- font-size: 120%;
- color: rgb(30%,30%,70%);
- font-family: monospace }
-
-.doc .inlinecode .id {
- color: rgb(30%,30%,70%);
-}
-
-.inlinecodenm {
- display: inline;
- color: #444444;
-}
-
-.doc .code {
- display: inline;
- font-size: 120%;
- color: rgb(30%,30%,70%);
- font-family: monospace }
-
-.comment {
- display: inline;
- font-family: monospace;
- color: rgb(50%,50%,80%);
-}
-
-.code {
- display: block;
-/* padding-left: 15px; */
- font-size: 110%;
- font-family: monospace;
- }
-
-table.infrule {
- border: 0px;
- margin-left: 50px;
- margin-top: 10px;
- margin-bottom: 10px;
-}
-
-td.infrule {
- font-family: monospace;
- text-align: center;
-/* color: rgb(35%,35%,70%); */
- padding: 0px;
- line-height: 100%;
-}
-
-tr.infrulemiddle hr {
- margin: 1px 0 1px 0;
-}
-
-.infrulenamecol {
- color: rgb(60%,60%,60%);
- font-size: 80%;
- padding-left: 1em;
- padding-bottom: 0.1em
-}
-
-/* Pied de page */
-
-#footer { font-size: 65%;
- font-family: sans-serif; }
-
-/* Identifiers: <span class="id" title="...">) */
-
-.id { display: inline; }
-
-.id[title="constructor"] {
- color: rgb(60%,0%,0%);
-}
-
-.id[title="var"] {
- color: rgb(40%,0%,40%);
-}
-
-.id[title="variable"] {
- color: rgb(40%,0%,40%);
-}
-
-.id[title="definition"] {
- color: rgb(0%,40%,0%);
-}
-
-.id[title="abbreviation"] {
- color: rgb(0%,40%,0%);
-}
-
-.id[title="lemma"] {
- color: rgb(0%,40%,0%);
-}
-
-.id[title="instance"] {
- color: rgb(0%,40%,0%);
-}
-
-.id[title="projection"] {
- color: rgb(0%,40%,0%);
-}
-
-.id[title="method"] {
- color: rgb(0%,40%,0%);
-}
-
-.id[title="inductive"] {
- color: rgb(0%,0%,80%);
-}
-
-.id[title="record"] {
- color: rgb(0%,0%,80%);
-}
-
-.id[title="class"] {
- color: rgb(0%,0%,80%);
-}
-
-.id[title="keyword"] {
- color : #cf1d1d;
-/* color: black; */
-}
-
-/* Deprecated rules using the 'type' attribute of <span> (not xhtml valid) */
-
-.id[type="constructor"] {
- color: rgb(60%,0%,0%);
-}
-
-.id[type="var"] {
- color: rgb(40%,0%,40%);
-}
-
-.id[type="variable"] {
- color: rgb(40%,0%,40%);
-}
-
-.id[type="definition"] {
- color: rgb(0%,40%,0%);
-}
-
-.id[type="abbreviation"] {
- color: rgb(0%,40%,0%);
-}
-
-.id[type="lemma"] {
- color: rgb(0%,40%,0%);
-}
-
-.id[type="instance"] {
- color: rgb(0%,40%,0%);
-}
-
-.id[type="projection"] {
- color: rgb(0%,40%,0%);
-}
-
-.id[type="method"] {
- color: rgb(0%,40%,0%);
-}
-
-.id[type="inductive"] {
- color: rgb(0%,0%,80%);
-}
-
-.id[type="record"] {
- color: rgb(0%,0%,80%);
-}
-
-.id[type="class"] {
- color: rgb(0%,0%,80%);
-}
-
-.id[type="keyword"] {
- color : #cf1d1d;
-/* color: black; */
-}
-
-.inlinecode .id {
- color: rgb(0%,0%,0%);
-}
-
-
-/* TOC */
-
-#toc h2 {
- padding: 10px;
- background-color: rgb(60%,60%,100%);
-}
-
-#toc li {
- padding-bottom: 8px;
-}
-
-/* Index */
-
-#index {
- margin: 0;
- padding: 0;
- width: 100%;
-}
-
-#index #frontispiece {
- margin: 1em auto;
- padding: 1em;
- width: 60%;
-}
-
-.booktitle { font-size : 140% }
-.authors { font-size : 90%;
- line-height: 115%; }
-.moreauthors { font-size : 60% }
-
-#index #entrance {
- text-align: center;
-}
-
-#index #entrance .spacer {
- margin: 0 30px 0 30px;
-}
-
-#index #footer {
- position: absolute;
- bottom: 0;
-}
-
-.paragraph {
- height: 0.75em;
-}
-
-ul.doclist {
- margin-top: 0em;
- margin-bottom: 0em;
-}
diff --git a/doc/sphinx/language/core/index.rst b/doc/sphinx/language/core/index.rst
index 07dcfff444..5ee960d99b 100644
--- a/doc/sphinx/language/core/index.rst
+++ b/doc/sphinx/language/core/index.rst
@@ -32,6 +32,8 @@ will have to check their output.
../gallina-specification-language
../cic
+ records
../../addendum/universe-polymorphism
../../addendum/sprop
+ sections
../module-system
diff --git a/doc/sphinx/language/core/records.rst b/doc/sphinx/language/core/records.rst
new file mode 100644
index 0000000000..928378f55e
--- /dev/null
+++ b/doc/sphinx/language/core/records.rst
@@ -0,0 +1,312 @@
+.. _record-types:
+
+Record types
+----------------
+
+The :cmd:`Record` construction is a macro allowing the definition of
+records as is done in many programming languages. Its syntax is
+described in the grammar below. In fact, the :cmd:`Record` macro is more general
+than the usual record types, since it allows also for “manifest”
+expressions. In this sense, the :cmd:`Record` construction allows defining
+“signatures”.
+
+.. _record_grammar:
+
+.. cmd:: {| Record | Structure } @record_definition {* with @record_definition }
+ :name: Record; Structure
+
+ .. 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:`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:
+:n:`Record @ident {* @binder } : @sort := { @ident__1 : @type__1 ; @ident__2 := @term__2 ; @ident__3 : @type__3 }`.
+in which case the correctness of :n:`@type__3` may rely on the instance :n:`@term__2` of :n:`@ident__2` and :n:`@term__2` may in turn depend on :n:`@ident__1`.
+
+.. example::
+
+ The set of rational numbers may be defined as:
+
+ .. coqtop:: reset all
+
+ Record Rat : Set := mkRat
+ { sign : bool
+ ; top : nat
+ ; bottom : nat
+ ; Rat_bottom_cond : 0 <> bottom
+ ; Rat_irred_cond :
+ forall x y z:nat, (x * y) = top /\ (x * z) = bottom -> x = 1
+ }.
+
+ Note here that the fields ``Rat_bottom_cond`` depends on the field ``bottom``
+ and ``Rat_irred_cond`` depends on both ``top`` and ``bottom``.
+
+Let us now see the work done by the ``Record`` macro. First the macro
+generates a variant type definition with just one constructor:
+:n:`Variant @ident {* @binder } : @sort := @ident__0 {* @binder }`.
+
+To build an object of type :token:`ident`, one should provide the constructor
+:n:`@ident__0` with the appropriate number of terms filling the fields of the record.
+
+.. example::
+
+ Let us define the rational :math:`1/2`:
+
+ .. coqtop:: in
+
+ Theorem one_two_irred : forall x y z:nat, x * y = 1 /\ x * z = 2 -> x = 1.
+ Admitted.
+
+ Definition half := mkRat true 1 2 (O_S 1) one_two_irred.
+ Check half.
+
+Alternatively, the following syntax allows creating objects by using named fields, as
+shown in this grammar. The fields do not have to be in any particular order, nor do they have
+to be all present if the missing ones can be inferred or prompted for
+(see :ref:`programs`).
+
+.. coqtop:: all
+
+ Definition half' :=
+ {| sign := true;
+ Rat_bottom_cond := O_S 1;
+ Rat_irred_cond := one_two_irred |}.
+
+The following settings let you control the display format for types:
+
+.. flag:: Printing Records
+
+ If set, use the record syntax (shown above) as the default display format.
+
+You can override the display format for specified types by adding entries to these tables:
+
+.. table:: Printing Record @qualid
+ :name: Printing Record
+
+ Specifies a set of qualids which are displayed as records. Use the
+ :cmd:`Add` and :cmd:`Remove` commands to update the set of qualids.
+
+.. table:: Printing Constructor @qualid
+ :name: Printing Constructor
+
+ Specifies a set of qualids which are displayed as constructors. Use the
+ :cmd:`Add` and :cmd:`Remove` commands to update the set of qualids.
+
+This syntax can also be used for pattern matching.
+
+.. coqtop:: all
+
+ Eval compute in (
+ match half with
+ | {| sign := true; top := n |} => n
+ | _ => 0
+ end).
+
+The macro generates also, when it is possible, the projection
+functions for destructuring an object of type :token:`ident`. These
+projection functions are given the names of the corresponding
+fields. If a field is named `_` then no projection is built
+for it. In our example:
+
+.. coqtop:: all
+
+ Eval compute in top half.
+ Eval compute in bottom half.
+ Eval compute in Rat_bottom_cond half.
+
+An alternative syntax for projections based on a dot notation is
+available:
+
+.. coqtop:: all
+
+ Eval compute in half.(top).
+
+.. flag:: Printing Projections
+
+ This flag activates the dot notation for printing.
+
+ .. example::
+
+ .. coqtop:: all
+
+ Set Printing Projections.
+ Check top half.
+
+.. FIXME: move this to the main grammar in the spec chapter
+
+.. _record_projections_grammar:
+
+ .. insertprodn term_projection term_projection
+
+ .. prodn::
+ term_projection ::= @term0 .( @qualid {* @arg } )
+ | @term0 .( @ @qualid {* @term1 } )
+
+ Syntax of Record projections
+
+The corresponding grammar rules are given in the preceding grammar. When :token:`qualid`
+denotes a projection, the syntax :n:`@term0.(@qualid)` is equivalent to :n:`@qualid @term0`,
+the syntax :n:`@term0.(@qualid {+ @arg })` to :n:`@qualid {+ @arg } @term0`.
+and the syntax :n:`@term0.(@@qualid {+ @term0 })` to :n:`@@qualid {+ @term0 } @term0`.
+In each case, :token:`term0` is the object projected and the
+other arguments are the parameters of the inductive type.
+
+
+.. note:: Records defined with the ``Record`` keyword are not allowed to be
+ recursive (references to the record's name in the type of its field
+ raises an error). To define recursive records, one can use the ``Inductive``
+ and ``CoInductive`` keywords, resulting in an inductive or co-inductive record.
+ Definition of mutually inductive or co-inductive records are also allowed, as long
+ as all of the types in the block are records.
+
+.. note:: Induction schemes are automatically generated for inductive records.
+ Automatic generation of induction schemes for non-recursive records
+ defined with the ``Record`` keyword can be activated with the
+ :flag:`Nonrecursive Elimination Schemes` flag (see :ref:`proofschemes-induction-principles`).
+
+.. warn:: @ident cannot be defined.
+
+ It can happen that the definition of a projection is impossible.
+ This message is followed by an explanation of this impossibility.
+ There may be three reasons:
+
+ #. The name :token:`ident` already exists in the environment (see :cmd:`Axiom`).
+ #. The body of :token:`ident` uses an incorrect elimination for
+ :token:`ident` (see :cmd:`Fixpoint` and :ref:`Destructors`).
+ #. The type of the projections :token:`ident` depends on previous
+ projections which themselves could not be defined.
+
+.. exn:: Records declared with the keyword Record or Structure cannot be recursive.
+
+ The record name :token:`ident` appears in the type of its fields, but uses
+ the keyword ``Record``. Use the keyword ``Inductive`` or ``CoInductive`` instead.
+
+.. exn:: Cannot handle mutually (co)inductive records.
+
+ Records cannot be defined as part of mutually inductive (or
+ co-inductive) definitions, whether with records only or mixed with
+ standard definitions.
+
+During the definition of the one-constructor inductive definition, all
+the errors of inductive definitions, as described in Section
+:ref:`gallina-inductive-definitions`, may also occur.
+
+.. seealso:: Coercions and records in section :ref:`coercions-classes-as-records` of the chapter devoted to coercions.
+
+.. _primitive_projections:
+
+Primitive Projections
+~~~~~~~~~~~~~~~~~~~~~
+
+.. flag:: Primitive Projections
+
+ Turns on the use of primitive
+ projections when defining subsequent records (even through the ``Inductive``
+ and ``CoInductive`` commands). Primitive projections
+ extended the Calculus of Inductive Constructions with a new binary
+ term constructor `r.(p)` representing a primitive projection `p` applied
+ to a record object `r` (i.e., primitive projections are always applied).
+ Even if the record type has parameters, these do not appear
+ in the internal representation of
+ applications of the projection, considerably reducing the sizes of
+ terms when manipulating parameterized records and type checking time.
+ On the user level, primitive projections can be used as a replacement
+ for the usual defined ones, although there are a few notable differences.
+
+.. flag:: Printing Primitive Projection Parameters
+
+ This compatibility flag reconstructs internally omitted parameters at
+ printing time (even though they are absent in the actual AST manipulated
+ by the kernel).
+
+Primitive Record Types
+++++++++++++++++++++++
+
+When the :flag:`Primitive Projections` flag is on, definitions of
+record types change meaning. When a type is declared with primitive
+projections, its :g:`match` construct is disabled (see :ref:`primitive_projections` though).
+To eliminate the (co-)inductive type, one must use its defined primitive projections.
+
+.. The following paragraph is quite redundant with what is above
+
+For compatibility, the parameters still appear to the user when
+printing terms even though they are absent in the actual AST
+manipulated by the kernel. This can be changed by unsetting the
+:flag:`Printing Primitive Projection Parameters` flag.
+
+There are currently two ways to introduce primitive records types:
+
+#. Through the ``Record`` command, in which case the type has to be
+ non-recursive. The defined type enjoys eta-conversion definitionally,
+ that is the generalized form of surjective pairing for records:
+ `r` ``= Build_``\ `R` ``(``\ `r`\ ``.(``\ |p_1|\ ``) …`` `r`\ ``.(``\ |p_n|\ ``))``.
+ Eta-conversion allows to define dependent elimination for these types as well.
+#. Through the ``Inductive`` and ``CoInductive`` commands, when
+ the body of the definition is a record declaration of the form
+ ``Build_``\ `R` ``{`` |p_1| ``:`` |t_1|\ ``; … ;`` |p_n| ``:`` |t_n| ``}``.
+ In this case the types can be recursive and eta-conversion is disallowed. These kind of record types
+ differ from their traditional versions in the sense that dependent
+ elimination is not available for them and only non-dependent case analysis
+ can be defined.
+
+Reduction
++++++++++
+
+The basic reduction rule of a primitive projection is
+|p_i| ``(Build_``\ `R` |t_1| … |t_n|\ ``)`` :math:`{\rightarrow_{\iota}}` |t_i|.
+However, to take the :math:`{\delta}` flag into
+account, projections can be in two states: folded or unfolded. An
+unfolded primitive projection application obeys the rule above, while
+the folded version delta-reduces to the unfolded version. This allows to
+precisely mimic the usual unfolding rules of constants. Projections
+obey the usual ``simpl`` flags of the ``Arguments`` command in particular.
+There is currently no way to input unfolded primitive projections at the
+user-level, and there is no way to display unfolded projections differently
+from folded ones.
+
+
+Compatibility Projections and :g:`match`
+++++++++++++++++++++++++++++++++++++++++
+
+To ease compatibility with ordinary record types, each primitive
+projection is also defined as a ordinary constant taking parameters and
+an object of the record type as arguments, and whose body is an
+application of the unfolded primitive projection of the same name. These
+constants are used when elaborating partial applications of the
+projection. One can distinguish them from applications of the primitive
+projection if the :flag:`Printing Primitive Projection Parameters` flag
+is off: For a primitive projection application, parameters are printed
+as underscores while for the compatibility projections they are printed
+as usual.
+
+Additionally, user-written :g:`match` constructs on primitive records
+are desugared into substitution of the projections, they cannot be
+printed back as :g:`match` constructs.
diff --git a/doc/sphinx/language/core/sections.rst b/doc/sphinx/language/core/sections.rst
new file mode 100644
index 0000000000..df50dbafe3
--- /dev/null
+++ b/doc/sphinx/language/core/sections.rst
@@ -0,0 +1,104 @@
+.. _section-mechanism:
+
+Section mechanism
+-----------------
+
+Sections create local contexts which can be shared across multiple definitions.
+
+.. example::
+
+ Sections are opened by the :cmd:`Section` command, and closed by :cmd:`End`.
+
+ .. coqtop:: all
+
+ Section s1.
+
+ Inside a section, local parameters can be introduced using :cmd:`Variable`,
+ :cmd:`Hypothesis`, or :cmd:`Context` (there are also plural variants for
+ the first two).
+
+ .. coqtop:: all
+
+ Variables x y : nat.
+
+ The command :cmd:`Let` introduces section-wide :ref:`let-in`. These definitions
+ won't persist when the section is closed, and all persistent definitions which
+ depend on `y'` will be prefixed with `let y' := y in`.
+
+ .. coqtop:: in
+
+ Let y' := y.
+ Definition x' := S x.
+ Definition x'' := x' + y'.
+
+ .. coqtop:: all
+
+ Print x'.
+ Print x''.
+
+ End s1.
+
+ Print x'.
+ Print x''.
+
+ Notice the difference between the value of :g:`x'` and :g:`x''` inside section
+ :g:`s1` and outside.
+
+.. cmd:: Section @ident
+
+ This command is used to open a section named :token:`ident`.
+ Section names do not need to be unique.
+
+
+.. cmd:: End @ident
+
+ 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:: 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_decl @def_body
+ Let Fixpoint @fix_definition {* with @fix_definition }
+ Let CoFixpoint @cofix_definition {* with @cofix_definition }
+ :name: Let; Let Fixpoint; Let CoFixpoint
+
+ 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.
+
+ 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`.
+
+.. cmd:: Context {+ @binder }
+
+ Declare variables in the context of the current section, like :cmd:`Variable`,
+ but also allowing implicit variables, :ref:`implicit-generalization`, and
+ let-binders.
+
+ .. coqdoc::
+
+ Context {A : Type} (a b : A).
+ Context `{EqDec A}.
+ Context (b' := b).
+
+.. seealso:: Section :ref:`binders`. Section :ref:`contexts` in chapter :ref:`typeclasses`.
diff --git a/doc/sphinx/language/extensions/implicit-arguments.rst b/doc/sphinx/language/extensions/implicit-arguments.rst
new file mode 100644
index 0000000000..36ce2fdd25
--- /dev/null
+++ b/doc/sphinx/language/extensions/implicit-arguments.rst
@@ -0,0 +1,903 @@
+.. _ImplicitArguments:
+
+Implicit arguments
+------------------
+
+An implicit argument of a function is an argument which can be
+inferred from contextual knowledge. There are different kinds of
+implicit arguments that can be considered implicit in different ways.
+There are also various commands to control the setting or the
+inference of implicit arguments.
+
+
+The different kinds of implicit arguments
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Implicit arguments inferable from the knowledge of other arguments of a function
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+The first kind of implicit arguments covers the arguments that are
+inferable from the knowledge of the type of other arguments of the
+function, or of the type of the surrounding context of the
+application. Especially, such implicit arguments correspond to
+parameters dependent in the type of the function. Typical implicit
+arguments are the type arguments in polymorphic functions. There are
+several kinds of such implicit arguments.
+
+**Strict Implicit Arguments**
+
+An implicit argument can be either strict or non strict. An implicit
+argument is said to be *strict* if, whatever the other arguments of the
+function are, it is still inferable from the type of some other
+argument. Technically, an implicit argument is strict if it
+corresponds to a parameter which is not applied to a variable which
+itself is another parameter of the function (since this parameter may
+erase its arguments), not in the body of a match, and not itself
+applied or matched against patterns (since the original form of the
+argument can be lost by reduction).
+
+For instance, the first argument of
+::
+
+ cons: forall A:Set, A -> list A -> list A
+
+in module ``List.v`` is strict because :g:`list` is an inductive type and :g:`A`
+will always be inferable from the type :g:`list A` of the third argument of
+:g:`cons`. Also, the first argument of :g:`cons` is strict with respect to the second one,
+since the first argument is exactly the type of the second argument.
+On the contrary, the second argument of a term of type
+::
+
+ forall P:nat->Prop, forall n:nat, P n -> ex nat P
+
+is implicit but not strict, since it can only be inferred from the
+type :g:`P n` of the third argument and if :g:`P` is, e.g., :g:`fun _ => True`, it
+reduces to an expression where ``n`` does not occur any longer. The first
+argument :g:`P` is implicit but not strict either because it can only be
+inferred from :g:`P n` and :g:`P` is not canonically inferable from an arbitrary
+:g:`n` and the normal form of :g:`P n`. Consider, e.g., that :g:`n` is :math:`0` and the third
+argument has type :g:`True`, then any :g:`P` of the form
+::
+
+ fun n => match n with 0 => True | _ => anything end
+
+would be a solution of the inference problem.
+
+**Contextual Implicit Arguments**
+
+An implicit argument can be *contextual* or not. An implicit argument
+is said *contextual* if it can be inferred only from the knowledge of
+the type of the context of the current expression. For instance, the
+only argument of::
+
+ nil : forall A:Set, list A`
+
+is contextual. Similarly, both arguments of a term of type::
+
+ forall P:nat->Prop, forall n:nat, P n \/ n = 0
+
+are contextual (moreover, :g:`n` is strict and :g:`P` is not).
+
+**Reversible-Pattern Implicit Arguments**
+
+There is another class of implicit arguments that can be reinferred
+unambiguously if all the types of the remaining arguments are known.
+This is the class of implicit arguments occurring in the type of
+another argument in position of reversible pattern, which means it is
+at the head of an application but applied only to uninstantiated
+distinct variables. Such an implicit argument is called *reversible-
+pattern implicit argument*. A typical example is the argument :g:`P` of
+nat_rec in
+::
+
+ nat_rec : forall P : nat -> Set, P 0 ->
+ (forall n : nat, P n -> P (S n)) -> forall x : nat, P x
+
+(:g:`P` is reinferable by abstracting over :g:`n` in the type :g:`P n`).
+
+See :ref:`controlling-rev-pattern-implicit-args` for the automatic declaration of reversible-pattern
+implicit arguments.
+
+Implicit arguments inferable by resolution
+++++++++++++++++++++++++++++++++++++++++++
+
+This corresponds to a class of non-dependent implicit arguments that
+are solved based on the structure of their type only.
+
+
+Maximal or non maximal insertion of implicit arguments
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+In case a function is partially applied, and the next argument to be
+applied is an implicit argument, two disciplines are applicable. In
+the first case, the function is considered to have no arguments
+furtherly: one says that the implicit argument is not maximally
+inserted. In the second case, the function is considered to be
+implicitly applied to the implicit arguments it is waiting for: one
+says that the implicit argument is maximally inserted.
+
+Each implicit argument can be declared to be inserted maximally or non
+maximally. In Coq, maximally-inserted implicit arguments are written between curly braces
+"{ }" and non-maximally-inserted implicit arguments are written in square brackets "[ ]".
+
+.. seealso:: :flag:`Maximal Implicit Insertion`
+
+Trailing Implicit Arguments
++++++++++++++++++++++++++++
+
+An implicit argument is considered trailing when all following arguments are declared
+implicit. Trailing implicit arguments cannot be declared non maximally inserted,
+otherwise they would never be inserted.
+
+.. exn:: Argument @name is a trailing implicit, so it can't be declared non maximal. Please use %{ %} instead of [ ].
+
+ For instance:
+
+ .. coqtop:: all fail
+
+ Fail Definition double [n] := n + n.
+
+
+Casual use of implicit arguments
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+In a given expression, if it is clear that some argument of a function
+can be inferred from the type of the other arguments, the user can
+force the given argument to be guessed by replacing it by “_”. If
+possible, the correct argument will be automatically generated.
+
+.. exn:: Cannot infer a term for this placeholder.
+ :name: Cannot infer a term for this placeholder. (Casual use of implicit arguments)
+
+ |Coq| was not able to deduce an instantiation of a “_”.
+
+.. _declare-implicit-args:
+
+Declaration of implicit arguments
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+In case one wants that some arguments of a given object (constant,
+inductive types, constructors, assumptions, local or not) are always
+inferred by |Coq|, one may declare once and for all which are the
+expected implicit arguments of this object. There are two ways to do
+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
+braces or square braces:
+
+.. coqtop:: all
+
+ Definition id {A : Type} (x : A) : A := x.
+
+This automatically declares the argument A of id as a maximally
+inserted implicit argument. One can then do as-if the argument was
+absent in every situation but still be able to specify it if needed:
+
+.. coqtop:: all
+
+ Definition compose {A B C} (g : B -> C) (f : A -> B) := fun x => g (f x).
+
+ Goal forall A, compose id id = id (A:=A).
+
+For non maximally inserted implicit arguments, use square brackets:
+
+.. coqtop:: all
+
+ Fixpoint map [A B : Type] (f : A -> B) (l : list A) : list B :=
+ match l with
+ | nil => nil
+ | cons a t => cons (f a) (map f t)
+ end.
+
+ Print Implicit map.
+
+The syntax is supported in all top-level definitions:
+:cmd:`Definition`, :cmd:`Fixpoint`, :cmd:`Lemma` and so on. For (co-)inductive datatype
+declarations, the semantics are the following: an inductive parameter
+declared as an implicit argument need not be repeated in the inductive
+definition and will become implicit for the inductive type and the constructors.
+For example:
+
+.. coqtop:: all
+
+ Inductive list {A : Type} : Type :=
+ | nil : list
+ | cons : A -> list -> list.
+
+ Print list.
+
+One can always specify the parameter if it is not uniform using the
+usual implicit arguments disambiguation syntax.
+
+The syntax is also supported in internal binders. For instance, in the
+following kinds of expressions, the type of each declaration present
+in :token:`binders` can be bracketed to mark the declaration as
+implicit:
+:n:`fun (@ident:forall {* @binder }, @type) => @term`,
+:n:`forall (@ident:forall {* @binder }, @type), @type`,
+:n:`let @ident {* @binder } := @term in @term`,
+:n:`fix @ident {* @binder } := @term in @term` and
+:n:`cofix @ident {* @binder } := @term in @term`.
+Here is an example:
+
+.. coqtop:: all
+
+ Axiom Ax :
+ forall (f:forall {A} (a:A), A * A),
+ let g {A} (x y:A) := (x,y) in
+ f 0 = g 0 0.
+
+.. warn:: Ignoring implicit binder declaration in unexpected position
+
+ This is triggered when setting an argument implicit in an
+ expression which does not correspond to the type of an assumption
+ or to the body of a definition. Here is an example:
+
+ .. coqtop:: all warn
+
+ Definition f := forall {y}, y = 0.
+
+.. warn:: Making shadowed name of implicit argument accessible by position
+
+ This is triggered when two variables of same name are set implicit
+ in the same block of binders, in which case the first occurrence is
+ considered to be unnamed. Here is an example:
+
+ .. coqtop:: all warn
+
+ Check let g {x:nat} (H:x=x) {x} (H:x=x) := x in 0.
+
+
+Declaring Implicit Arguments
+++++++++++++++++++++++++++++
+
+
+
+.. 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 {? % @scope }
+ argument_spec_block ::= @argument_spec
+ | /
+ | &
+ | ( {+ @argument_spec } ) {? % @scope }
+ | [ {+ @argument_spec } ] {? % @scope }
+ | %{ {+ @argument_spec } %} {? % @scope }
+ argument_spec ::= {? ! } @name {? % @scope }
+ 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:
+
+.. exn:: The & modifier may only occur once.
+ :undocumented:
+
+.. example::
+
+ .. coqtop:: reset all
+
+ Inductive list (A : Type) : Type :=
+ | nil : list A
+ | cons : A -> list A -> list A.
+
+ Check (cons nat 3 (nil nat)).
+
+ Arguments cons [A] _ _.
+
+ Arguments nil {A}.
+
+ Check (cons 3 nil).
+
+ Fixpoint map (A B : Type) (f : A -> B) (l : list A) : list B :=
+ match l with nil => nil | cons a t => cons (f a) (map A B f t) end.
+
+ Fixpoint length (A : Type) (l : list A) : nat :=
+ match l with nil => 0 | cons _ m => S (length A m) end.
+
+ Arguments map [A B] f l.
+
+ Arguments length {A} l. (* A has to be maximally inserted *)
+
+ 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::
+ 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
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ The :n:`default implicits @arguments_modifier` clause tells |Coq| to automatically determine the
+ implicit arguments of the object.
+
+ 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-contextual-implicit-args`,
+ :ref:`controlling-rev-pattern-implicit-args` and also :ref:`controlling-insertion-implicit-args`).
+
+.. example:: Default implicits
+
+ .. coqtop:: reset all
+
+ Inductive list (A:Set) : Set :=
+ | nil : list A
+ | cons : A -> list A -> list A.
+
+ Arguments cons : default implicits.
+
+ Print Implicit cons.
+
+ Arguments nil : default implicits.
+
+ Print Implicit nil.
+
+ Set Contextual Implicit.
+
+ Arguments nil : default implicits.
+
+ Print Implicit nil.
+
+The computation of implicit arguments takes account of the unfolding
+of constants. For instance, the variable ``p`` below has type
+``(Transitivity R)`` which is reducible to
+``forall x,y:U, R x y -> forall z:U, R y z -> R x z``. As the variables ``x``, ``y`` and ``z``
+appear strictly in the body of the type, they are implicit.
+
+.. coqtop:: all
+
+ Parameter X : Type.
+
+ Definition Relation := X -> X -> Prop.
+
+ Definition Transitivity (R:Relation) := forall x y:X, R x y -> forall z:X, R y z -> R x z.
+
+ Parameters (R : Relation) (p : Transitivity R).
+
+ Arguments p : default implicits.
+
+ Print p.
+
+ Print Implicit p.
+
+ Parameters (a b c : X) (r1 : R a b) (r2 : R b c).
+
+ Check (p r1 r2).
+
+
+Mode for automatic declaration of implicit arguments
+++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+.. flag:: Implicit Arguments
+
+ This flag (off by default) allows to systematically declare implicit
+ the arguments detectable as such. Auto-detection of implicit arguments is
+ governed by flags controlling whether strict and contextual implicit
+ arguments have to be considered or not.
+
+.. _controlling-strict-implicit-args:
+
+Controlling strict implicit arguments
++++++++++++++++++++++++++++++++++++++
+
+.. flag:: Strict Implicit
+
+ When the mode for automatic declaration of implicit arguments is on,
+ the default is to automatically set implicit only the strict implicit
+ arguments plus, for historical reasons, a small subset of the non-strict
+ implicit arguments. To relax this constraint and to set
+ implicit all non strict implicit arguments by default, you can turn this
+ flag off.
+
+.. flag:: Strongly Strict Implicit
+
+ Use this flag (off by default) to capture exactly the strict implicit
+ arguments and no more than the strict implicit arguments.
+
+.. _controlling-contextual-implicit-args:
+
+Controlling contextual implicit arguments
++++++++++++++++++++++++++++++++++++++++++
+
+.. flag:: Contextual Implicit
+
+ By default, |Coq| does not automatically set implicit the contextual
+ implicit arguments. You can turn this flag on to tell |Coq| to also
+ infer contextual implicit argument.
+
+.. _controlling-rev-pattern-implicit-args:
+
+Controlling reversible-pattern implicit arguments
++++++++++++++++++++++++++++++++++++++++++++++++++
+
+.. flag:: Reversible Pattern Implicit
+
+ By default, |Coq| does not automatically set implicit the reversible-pattern
+ implicit arguments. You can turn this flag on to tell |Coq| to also infer
+ reversible-pattern implicit argument.
+
+.. _controlling-insertion-implicit-args:
+
+Controlling the insertion of implicit arguments not followed by explicit arguments
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+.. flag:: Maximal Implicit Insertion
+
+ Assuming the implicit argument mode is on, this flag (off by default)
+ declares implicit arguments to be automatically inserted when a
+ function is partially applied and the next argument of the function is
+ an implicit one.
+
+Combining manual declaration and automatic declaration
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+When some arguments are manually specified implicit with binders in a definition
+and the automatic declaration mode in on, the manual implicit arguments are added to the
+automatically declared ones.
+
+In that case, and when the flag :flag:`Maximal Implicit Insertion` is set to off,
+some trailing implicit arguments can be inferred to be non maximally inserted. In
+this case, they are converted to maximally inserted ones.
+
+.. example::
+
+ .. coqtop:: all
+
+ Set Implicit Arguments.
+ Axiom eq0_le0 : forall (n : nat) (x : n = 0), n <= 0.
+ Print Implicit eq0_le0.
+ Axiom eq0_le0' : forall (n : nat) {x : n = 0}, n <= 0.
+ Print Implicit eq0_le0'.
+
+
+.. _explicit-applications:
+
+Explicit applications
+~~~~~~~~~~~~~~~~~~~~~
+
+In presence of non-strict or contextual arguments, or in presence of
+partial applications, the synthesis of implicit arguments may fail, so
+one may have to explicitly give certain implicit arguments of an
+application. Use the :n:`(@ident := @term)` form of :token:`arg` to do so,
+where :token:`ident` is the name of the implicit argument and :token:`term`
+is its corresponding explicit term. Alternatively, one can deactivate
+the hiding of implicit arguments for a single function application using the
+:n:`@ @qualid {? @univ_annot } {* @term1 }` form of :token:`term10`.
+
+.. example:: Syntax for explicitly giving implicit arguments (continued)
+
+ .. coqtop:: all
+
+ Check (p r1 (z:=c)).
+
+ Check (p (x:=a) (y:=b) r1 (z:=c) r2).
+
+
+.. _renaming_implicit_arguments:
+
+Renaming implicit arguments
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. example:: (continued) Renaming implicit arguments
+
+ .. coqtop:: all
+
+ Arguments p [s t] _ [u] _: rename.
+
+ Check (p r1 (u:=c)).
+
+ Check (p (s:=a) (t:=b) r1 (u:=c) r2).
+
+ Fail Arguments p [s t] _ [w] _ : assert.
+
+.. _displaying-implicit-args:
+
+Displaying implicit arguments
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. cmd:: Print Implicit @smart_qualid
+
+ Displays the implicit arguments associated with an object,
+ identifying which arguments are applied maximally or not.
+
+
+Displaying implicit arguments when pretty-printing
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. flag:: Printing 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 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.
+
+.. seealso:: :flag:`Printing All`.
+
+Interaction with subtyping
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+When an implicit argument can be inferred from the type of more than
+one of the other arguments, then only the type of the first of these
+arguments is taken into account, and not an upper type of all of them.
+As a consequence, the inference of the implicit argument of “=” fails
+in
+
+.. coqtop:: all
+
+ Fail Check nat = Prop.
+
+but succeeds in
+
+.. coqtop:: all
+
+ Check Prop = nat.
+
+
+Deactivation of implicit arguments for parsing
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. flag:: Parsing Explicit
+
+ Turning this flag on (it is off by default) deactivates the use of implicit arguments.
+
+ In this case, all arguments of constants, inductive types,
+ constructors, etc, including the arguments declared as implicit, have
+ to be given as if no arguments were implicit. By symmetry, this also
+ affects printing.
+
+.. _canonical-structure-declaration:
+
+Canonical structures
+~~~~~~~~~~~~~~~~~~~~
+
+A canonical structure is an instance of a record/structure type that
+can be used to solve unification problems involving a projection
+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:: 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 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|.
+ Then, each time an equation of the form ``(``\ |x_i| ``_)`` |eq_beta_delta_iota_zeta| |c_i| has to be
+ solved during the type checking process, :token:`qualid` is used as a solution.
+ Otherwise said, :token:`qualid` is canonically used to extend the field |c_i|
+ into a complete structure built on |c_i|.
+
+ Canonical structures are particularly useful when mixed with coercions
+ and strict implicit arguments.
+
+ .. example::
+
+ Here is an example.
+
+ .. coqtop:: all
+
+ Require Import Relations.
+
+ Require Import EqNat.
+
+ Set Implicit Arguments.
+
+ Unset Strict Implicit.
+
+ Structure Setoid : Type := {Carrier :> Set; Equal : relation Carrier;
+ Prf_equiv : equivalence Carrier Equal}.
+
+ Definition is_law (A B:Setoid) (f:A -> B) := forall x y:A, Equal x y -> Equal (f x) (f y).
+
+ Axiom eq_nat_equiv : equivalence nat eq_nat.
+
+ Definition nat_setoid : Setoid := Build_Setoid eq_nat_equiv.
+
+ Canonical nat_setoid.
+
+ Thanks to :g:`nat_setoid` declared as canonical, the implicit arguments :g:`A`
+ and :g:`B` can be synthesized in the next statement.
+
+ .. coqtop:: all abort
+
+ Lemma is_law_S : is_law S.
+
+ .. note::
+ If a same field occurs in several canonical structures, then
+ only the structure declared first as canonical is considered.
+
+ .. 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::
+
+ For instance, when declaring the :g:`Setoid` structure above, the
+ :g:`Prf_equiv` field declaration could be written as follows.
+
+ .. coqdoc::
+
+ #[canonical(false)] Prf_equiv : equivalence Carrier Equal
+
+ See :ref:`canonicalstructures` for a more realistic example.
+
+.. 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.
+
+.. 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
+ which it is a projection is indicated. If constants are given as
+ its arguments, only the unification rules that involve or are
+ synthesized from simultaneously all given constants will be shown.
+
+ .. example::
+
+ For instance, the above example gives the following output:
+
+ .. coqtop:: all
+
+ Print Canonical Projections.
+
+ .. coqtop:: all
+
+ Print Canonical Projections nat.
+
+ .. note::
+
+ The last line in the first example would not show up if the
+ corresponding projection (namely :g:`Prf_equiv`) were annotated as not
+ canonical, as described above.
+
+Implicit types of variables
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+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 {| 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
+
+ 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 :token:`type` (unless the bound variable is already declared
+ with an explicit type, in which case, that type will be used).
+
+.. example::
+
+ .. coqtop:: all
+
+ Require Import List.
+
+ Implicit Types m n : nat.
+
+ Lemma cons_inj_nat : forall m n l, n :: l = m :: l -> n = m.
+ Proof. intros m n. Abort.
+
+ Lemma cons_inj_bool : forall (m n:bool) l, n :: l = m :: l -> n = m.
+ Abort.
+
+.. flag:: Printing Use Implicit Types
+
+ By default, the type of bound variables is not printed when
+ the variable name is associated to an implicit type which matches the
+ actual type of the variable. This feature can be deactivated by
+ turning this flag off.
+
+.. _implicit-generalization:
+
+Implicit generalization
+~~~~~~~~~~~~~~~~~~~~~~~
+
+.. index:: `{ }
+.. index:: `[ ]
+.. index:: `( )
+.. index:: `{! }
+.. 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. 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 \`( ).
+
+Terms surrounded by \`{ } introduce their free variables as maximally
+inserted implicit arguments, terms surrounded by \`[ ] introduce them as
+non maximally inserted implicit arguments and terms surrounded by \`( )
+introduce them as explicit arguments.
+
+Generalizing binders always introduce their free variables as
+maximally inserted implicit arguments. The binder itself introduces
+its argument as usual.
+
+In the following statement, ``A`` and ``y`` are automatically
+generalized, ``A`` is implicit and ``x``, ``y`` and the anonymous
+equality argument are explicit.
+
+.. coqtop:: all reset
+
+ Generalizable All Variables.
+
+ Definition sym `(x:A) : `(x = y -> y = x) := fun _ p => eq_sym p.
+
+ Print sym.
+
+Dually to normal binders, the name is optional but the type is required:
+
+.. coqtop:: all
+
+ Check (forall `{x = y :> A}, y = x).
+
+When generalizing a binder whose type is a typeclass, its own class
+arguments are omitted from the syntax and are generalized using
+automatic names, without instance search. Other arguments are also
+generalized unless provided. This produces a fully general statement.
+this behaviour may be disabled by prefixing the type with a ``!`` or
+by forcing the typeclass name to be an explicit application using
+``@`` (however the later ignores implicit argument information).
+
+.. coqtop:: all
+
+ Class Op (A:Type) := op : A -> A -> A.
+
+ Class Commutative (A:Type) `(Op A) := commutative : forall x y, op x y = op y x.
+ Instance nat_op : Op nat := plus.
+
+ Set Printing Implicit.
+ Check (forall `{Commutative }, True).
+ Check (forall `{Commutative nat}, True).
+ Fail Check (forall `{Commutative nat _}, True).
+ Fail Check (forall `{!Commutative nat}, True).
+ Arguments Commutative _ {_}.
+ Check (forall `{!Commutative nat}, True).
+ Check (forall `{@Commutative nat plus}, True).
+
+Multiple binders can be merged using ``,`` as a separator:
+
+.. coqtop:: all
+
+ Check (forall `{Commutative A, Hnat : !Commutative nat}, True).
+
+.. cmd:: Generalizable {| {| Variable | Variables } {+ @ident } | All Variables | No Variables }
+
+ Controls the set of generalizable identifiers. By default, no variables are
+ generalizable.
+
+ This command supports the :attr:`global` attribute.
+
+ 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.
+
+ 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.
+
+ The :n:`No Variables` form disables implicit generalization entirely. This is
+ the default behavior (before any :cmd:`Generalizable` command has been entered).
diff --git a/doc/sphinx/language/extensions/index.rst b/doc/sphinx/language/extensions/index.rst
index f22927d627..627e7f0acb 100644
--- a/doc/sphinx/language/extensions/index.rst
+++ b/doc/sphinx/language/extensions/index.rst
@@ -17,6 +17,7 @@ language presented in the :ref:`previous chapter <core-language>`.
:maxdepth: 1
../gallina-extensions
+ implicit-arguments
../../addendum/extended-pattern-matching
../../user-extensions/syntax-extensions
../../addendum/implicit-coercions
diff --git a/doc/sphinx/language/gallina-extensions.rst b/doc/sphinx/language/gallina-extensions.rst
index 18b05e47d3..57c8683aaa 100644
--- a/doc/sphinx/language/gallina-extensions.rst
+++ b/doc/sphinx/language/gallina-extensions.rst
@@ -6,319 +6,6 @@ Extensions of |Gallina|
|Gallina| is the kernel language of |Coq|. We describe here extensions of
|Gallina|’s syntax.
-.. _record-types:
-
-Record types
-----------------
-
-The :cmd:`Record` construction is a macro allowing the definition of
-records as is done in many programming languages. Its syntax is
-described in the grammar below. In fact, the :cmd:`Record` macro is more general
-than the usual record types, since it allows also for “manifest”
-expressions. In this sense, the :cmd:`Record` construction allows defining
-“signatures”.
-
-.. _record_grammar:
-
-.. cmd:: {| Record | Structure } @record_definition {* with @record_definition }
- :name: Record; Structure
-
- .. 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:`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:
-:n:`Record @ident {* @binder } : @sort := { @ident__1 : @type__1 ; @ident__2 := @term__2 ; @ident__3 : @type__3 }`.
-in which case the correctness of :n:`@type__3` may rely on the instance :n:`@term__2` of :n:`@ident__2` and :n:`@term__2` may in turn depend on :n:`@ident__1`.
-
-.. example::
-
- The set of rational numbers may be defined as:
-
- .. coqtop:: reset all
-
- Record Rat : Set := mkRat
- { sign : bool
- ; top : nat
- ; bottom : nat
- ; Rat_bottom_cond : 0 <> bottom
- ; Rat_irred_cond :
- forall x y z:nat, (x * y) = top /\ (x * z) = bottom -> x = 1
- }.
-
- Note here that the fields ``Rat_bottom_cond`` depends on the field ``bottom``
- and ``Rat_irred_cond`` depends on both ``top`` and ``bottom``.
-
-Let us now see the work done by the ``Record`` macro. First the macro
-generates a variant type definition with just one constructor:
-:n:`Variant @ident {* @binder } : @sort := @ident__0 {* @binder }`.
-
-To build an object of type :token:`ident`, one should provide the constructor
-:n:`@ident__0` with the appropriate number of terms filling the fields of the record.
-
-.. example::
-
- Let us define the rational :math:`1/2`:
-
- .. coqtop:: in
-
- Theorem one_two_irred : forall x y z:nat, x * y = 1 /\ x * z = 2 -> x = 1.
- Admitted.
-
- Definition half := mkRat true 1 2 (O_S 1) one_two_irred.
- Check half.
-
-Alternatively, the following syntax allows creating objects by using named fields, as
-shown in this grammar. The fields do not have to be in any particular order, nor do they have
-to be all present if the missing ones can be inferred or prompted for
-(see :ref:`programs`).
-
-.. coqtop:: all
-
- Definition half' :=
- {| sign := true;
- Rat_bottom_cond := O_S 1;
- Rat_irred_cond := one_two_irred |}.
-
-The following settings let you control the display format for types:
-
-.. flag:: Printing Records
-
- If set, use the record syntax (shown above) as the default display format.
-
-You can override the display format for specified types by adding entries to these tables:
-
-.. table:: Printing Record @qualid
- :name: Printing Record
-
- Specifies a set of qualids which are displayed as records. Use the
- :cmd:`Add @table` and :cmd:`Remove @table` commands to update the set of qualids.
-
-.. table:: Printing Constructor @qualid
- :name: Printing Constructor
-
- Specifies a set of qualids which are displayed as constructors. Use the
- :cmd:`Add @table` and :cmd:`Remove @table` commands to update the set of qualids.
-
-This syntax can also be used for pattern matching.
-
-.. coqtop:: all
-
- Eval compute in (
- match half with
- | {| sign := true; top := n |} => n
- | _ => 0
- end).
-
-The macro generates also, when it is possible, the projection
-functions for destructuring an object of type :token:`ident`. These
-projection functions are given the names of the corresponding
-fields. If a field is named `_` then no projection is built
-for it. In our example:
-
-.. coqtop:: all
-
- Eval compute in top half.
- Eval compute in bottom half.
- Eval compute in Rat_bottom_cond half.
-
-An alternative syntax for projections based on a dot notation is
-available:
-
-.. coqtop:: all
-
- Eval compute in half.(top).
-
-.. flag:: Printing Projections
-
- This flag activates the dot notation for printing.
-
- .. example::
-
- .. coqtop:: all
-
- Set Printing Projections.
- Check top half.
-
-.. FIXME: move this to the main grammar in the spec chapter
-
-.. _record_projections_grammar:
-
- .. insertprodn term_projection term_projection
-
- .. prodn::
- term_projection ::= @term0 .( @qualid {* @arg } )
- | @term0 .( @ @qualid {* @term1 } )
-
- Syntax of Record projections
-
-The corresponding grammar rules are given in the preceding grammar. When :token:`qualid`
-denotes a projection, the syntax :n:`@term0.(@qualid)` is equivalent to :n:`@qualid @term0`,
-the syntax :n:`@term0.(@qualid {+ @arg })` to :n:`@qualid {+ @arg } @term0`.
-and the syntax :n:`@term0.(@@qualid {+ @term0 })` to :n:`@@qualid {+ @term0 } @term0`.
-In each case, :token:`term0` is the object projected and the
-other arguments are the parameters of the inductive type.
-
-
-.. note:: Records defined with the ``Record`` keyword are not allowed to be
- recursive (references to the record's name in the type of its field
- raises an error). To define recursive records, one can use the ``Inductive``
- and ``CoInductive`` keywords, resulting in an inductive or co-inductive record.
- Definition of mutually inductive or co-inductive records are also allowed, as long
- as all of the types in the block are records.
-
-.. note:: Induction schemes are automatically generated for inductive records.
- Automatic generation of induction schemes for non-recursive records
- defined with the ``Record`` keyword can be activated with the
- :flag:`Nonrecursive Elimination Schemes` flag (see :ref:`proofschemes-induction-principles`).
-
-.. warn:: @ident cannot be defined.
-
- It can happen that the definition of a projection is impossible.
- This message is followed by an explanation of this impossibility.
- There may be three reasons:
-
- #. The name :token:`ident` already exists in the environment (see :cmd:`Axiom`).
- #. The body of :token:`ident` uses an incorrect elimination for
- :token:`ident` (see :cmd:`Fixpoint` and :ref:`Destructors`).
- #. The type of the projections :token:`ident` depends on previous
- projections which themselves could not be defined.
-
-.. exn:: Records declared with the keyword Record or Structure cannot be recursive.
-
- The record name :token:`ident` appears in the type of its fields, but uses
- the keyword ``Record``. Use the keyword ``Inductive`` or ``CoInductive`` instead.
-
-.. exn:: Cannot handle mutually (co)inductive records.
-
- Records cannot be defined as part of mutually inductive (or
- co-inductive) definitions, whether with records only or mixed with
- standard definitions.
-
-During the definition of the one-constructor inductive definition, all
-the errors of inductive definitions, as described in Section
-:ref:`gallina-inductive-definitions`, may also occur.
-
-.. seealso:: Coercions and records in section :ref:`coercions-classes-as-records` of the chapter devoted to coercions.
-
-.. _primitive_projections:
-
-Primitive Projections
-~~~~~~~~~~~~~~~~~~~~~
-
-.. flag:: Primitive Projections
-
- Turns on the use of primitive
- projections when defining subsequent records (even through the ``Inductive``
- and ``CoInductive`` commands). Primitive projections
- extended the Calculus of Inductive Constructions with a new binary
- term constructor `r.(p)` representing a primitive projection `p` applied
- to a record object `r` (i.e., primitive projections are always applied).
- Even if the record type has parameters, these do not appear
- in the internal representation of
- applications of the projection, considerably reducing the sizes of
- terms when manipulating parameterized records and type checking time.
- On the user level, primitive projections can be used as a replacement
- for the usual defined ones, although there are a few notable differences.
-
-.. flag:: Printing Primitive Projection Parameters
-
- This compatibility flag reconstructs internally omitted parameters at
- printing time (even though they are absent in the actual AST manipulated
- by the kernel).
-
-Primitive Record Types
-++++++++++++++++++++++
-
-When the :flag:`Primitive Projections` flag is on, definitions of
-record types change meaning. When a type is declared with primitive
-projections, its :g:`match` construct is disabled (see :ref:`primitive_projections` though).
-To eliminate the (co-)inductive type, one must use its defined primitive projections.
-
-.. The following paragraph is quite redundant with what is above
-
-For compatibility, the parameters still appear to the user when
-printing terms even though they are absent in the actual AST
-manipulated by the kernel. This can be changed by unsetting the
-:flag:`Printing Primitive Projection Parameters` flag.
-
-There are currently two ways to introduce primitive records types:
-
-#. Through the ``Record`` command, in which case the type has to be
- non-recursive. The defined type enjoys eta-conversion definitionally,
- that is the generalized form of surjective pairing for records:
- `r` ``= Build_``\ `R` ``(``\ `r`\ ``.(``\ |p_1|\ ``) …`` `r`\ ``.(``\ |p_n|\ ``))``.
- Eta-conversion allows to define dependent elimination for these types as well.
-#. Through the ``Inductive`` and ``CoInductive`` commands, when
- the body of the definition is a record declaration of the form
- ``Build_``\ `R` ``{`` |p_1| ``:`` |t_1|\ ``; … ;`` |p_n| ``:`` |t_n| ``}``.
- In this case the types can be recursive and eta-conversion is disallowed. These kind of record types
- differ from their traditional versions in the sense that dependent
- elimination is not available for them and only non-dependent case analysis
- can be defined.
-
-Reduction
-+++++++++
-
-The basic reduction rule of a primitive projection is
-|p_i| ``(Build_``\ `R` |t_1| … |t_n|\ ``)`` :math:`{\rightarrow_{\iota}}` |t_i|.
-However, to take the :math:`{\delta}` flag into
-account, projections can be in two states: folded or unfolded. An
-unfolded primitive projection application obeys the rule above, while
-the folded version delta-reduces to the unfolded version. This allows to
-precisely mimic the usual unfolding rules of constants. Projections
-obey the usual ``simpl`` flags of the ``Arguments`` command in particular.
-There is currently no way to input unfolded primitive projections at the
-user-level, and there is no way to display unfolded projections differently
-from folded ones.
-
-
-Compatibility Projections and :g:`match`
-++++++++++++++++++++++++++++++++++++++++
-
-To ease compatibility with ordinary record types, each primitive
-projection is also defined as a ordinary constant taking parameters and
-an object of the record type as arguments, and whose body is an
-application of the unfolded primitive projection of the same name. These
-constants are used when elaborating partial applications of the
-projection. One can distinguish them from applications of the primitive
-projection if the :flag:`Printing Primitive Projection Parameters` flag
-is off: For a primitive projection application, parameters are printed
-as underscores while for the compatibility projections they are printed
-as usual.
-
-Additionally, user-written :g:`match` constructs on primitive records
-are desugared into substitution of the projections, they cannot be
-printed back as :g:`match` constructs.
-
Variants and extensions of :g:`match`
-------------------------------------
@@ -551,7 +238,7 @@ written using the first destructuring let syntax.
Note that this only applies to pattern matching instances entered with :g:`match`.
It doesn't affect pattern matching explicitly entered with a destructuring
:g:`let`.
- Use the :cmd:`Add @table` and :cmd:`Remove @table` commands to update this set.
+ Use the :cmd:`Add` and :cmd:`Remove` commands to update this set.
Printing matching on booleans
@@ -565,7 +252,7 @@ which types are written this way:
:name: Printing If
Specifies a set of qualids for which pattern matching is displayed using
- ``if`` … ``then`` … ``else`` …. Use the :cmd:`Add @table` and :cmd:`Remove @table`
+ ``if`` … ``then`` … ``else`` …. Use the :cmd:`Add` and :cmd:`Remove`
commands to update this set.
This example emphasizes what the printing settings offer.
@@ -590,278 +277,6 @@ This example emphasizes what the printing settings offer.
Print snd.
-.. _advanced-recursive-functions:
-
-Advanced recursive functions
-----------------------------
-
-The following command is available when the ``FunInd`` library has been loaded via ``Require Import FunInd``:
-
-.. cmd:: Function @fix_definition {* with @fix_definition }
-
- 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.
- 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. 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.
-
- :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::
-
- To obtain the right principle, it is better to put rigid
- parameters of the function as first arguments. For example it is
- better to define plus like this:
-
- .. coqtop:: reset none
-
- Require Import FunInd.
-
- .. coqtop:: all
-
- Function plus (m n : nat) {struct n} : nat :=
- match n with
- | 0 => m
- | S p => S (plus m p)
- end.
-
- than like this:
-
- .. coqtop:: reset none
-
- Require Import FunInd.
-
- .. coqtop:: all
-
- Function plus (n m : nat) {struct n} : nat :=
- match n with
- | 0 => m
- | S p => S (plus p m)
- end.
-
-
-*Limitations*
-
-:token:`term` must be built as a *pure pattern matching tree* (:g:`match … with`)
-with applications only *at the end* of each branch.
-
-: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`:
-
-.. coqtop:: none
-
- Require List.
- Import List.ListNotations.
-
-.. coqtop:: all fail
-
- Function wrong (C:nat) : nat :=
- List.hd 0 (List.map wrong (C::nil)).
-
-For now, dependent cases are not treated for non structurally
-terminating functions.
-
-.. exn:: The recursive argument must be specified.
- :undocumented:
-
-.. exn:: No argument name @ident.
- :undocumented:
-
-.. exn:: Cannot use mutual definition with well-founded recursion or measure.
- :undocumented:
-
-.. warn:: Cannot define graph for @ident.
-
- The generation of the graph relation (:n:`R_@ident`) used to compute the induction scheme of ident
- raised a typing error. Only :token:`ident` is defined; the induction scheme
- will not be generated. This error happens generally when:
-
- - the definition uses pattern matching on dependent types,
- 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.
-
- The generation of the graph relation (:n:`R_@ident`) succeeded but the induction principle
- could not be built. Only :token:`ident` is defined. Please report.
-
-.. warn:: Cannot build functional inversion principle.
-
- :tacn:`functional inversion` will not be available for the function.
-
-.. seealso:: :ref:`functional-scheme` and :tacn:`function induction`
-
-.. _section-mechanism:
-
-Section mechanism
------------------
-
-Sections create local contexts which can be shared across multiple definitions.
-
-.. example::
-
- Sections are opened by the :cmd:`Section` command, and closed by :cmd:`End`.
-
- .. coqtop:: all
-
- Section s1.
-
- Inside a section, local parameters can be introduced using :cmd:`Variable`,
- :cmd:`Hypothesis`, or :cmd:`Context` (there are also plural variants for
- the first two).
-
- .. coqtop:: all
-
- Variables x y : nat.
-
- The command :cmd:`Let` introduces section-wide :ref:`let-in`. These definitions
- won't persist when the section is closed, and all persistent definitions which
- depend on `y'` will be prefixed with `let y' := y in`.
-
- .. coqtop:: in
-
- Let y' := y.
- Definition x' := S x.
- Definition x'' := x' + y'.
-
- .. coqtop:: all
-
- Print x'.
- Print x''.
-
- End s1.
-
- Print x'.
- Print x''.
-
- Notice the difference between the value of :g:`x'` and :g:`x''` inside section
- :g:`s1` and outside.
-
-.. cmd:: Section @ident
-
- This command is used to open a section named :token:`ident`.
- Section names do not need to be unique.
-
-
-.. cmd:: End @ident
-
- 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:: 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 @def_body
- Let Fixpoint @fix_definition {* with @fix_definition }
- Let CoFixpoint @cofix_definition {* with @cofix_definition }
- :name: Let; Let Fixpoint; Let CoFixpoint
-
- 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.
-
- 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`.
-
-.. cmd:: Context {+ @binder }
-
- Declare variables in the context of the current section, like :cmd:`Variable`,
- but also allowing implicit variables, :ref:`implicit-generalization`, and
- let-binders.
-
- .. coqdoc::
-
- Context {A : Type} (a b : A).
- Context `{EqDec A}.
- Context (b' := b).
-
-.. seealso:: Section :ref:`binders`. Section :ref:`contexts` in chapter :ref:`typeclasses`.
-
Module system
-------------
@@ -1007,7 +422,12 @@ are now available through the dot notation.
If :n:`@module_binder`\s are specified, declares a functor with parameters given by the list of
:token:`module_binder`\s.
-.. cmd:: Import {+ @qualid }
+.. cmd:: Import {+ @filtered_import }
+
+ .. insertprodn filtered_import filtered_import
+
+ .. prodn::
+ filtered_import ::= @qualid {? ( {+, @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.
@@ -1050,12 +470,50 @@ are now available through the dot notation.
Check B.T.
-.. cmd:: Export {+ @qualid }
+ Appending a module name with a parenthesized list of names will
+ make only those names available with short names, not other names
+ defined in the module nor will it activate other features.
+
+ The names to import may be constants, inductive types and
+ constructors, and notation aliases (for instance, Ltac definitions
+ cannot be selectively imported). If they are from an inner module
+ to the one being imported, they must be prefixed by the inner path.
+
+ The name of an inductive type may also be followed by ``(..)`` to
+ import it, its constructors and its eliminators if they exist. For
+ this purpose "eliminator" means a constant in the same module whose
+ name is the inductive type's name suffixed by one of ``_sind``,
+ ``_ind``, ``_rec`` or ``_rect``.
+
+ .. example::
+
+ .. coqtop:: reset in
+
+ Module A.
+ Module B.
+ Inductive T := C.
+ Definition U := nat.
+ End B.
+ Definition Z := Prop.
+ End A.
+ Import A(B.T(..), Z).
+
+ .. coqtop:: all
+
+ Check B.T.
+ Check B.C.
+ Check Z.
+ Fail Check B.U.
+ Check A.B.U.
+
+.. cmd:: Export {+ @filtered_import }
:name: Export
Similar to :cmd:`Import`, except that when the module containing this command
is imported, the :n:`{+ @qualid }` are imported as well.
+ The selective import syntax also works with Export.
+
.. exn:: @qualid is not a module.
:undocumented:
@@ -1304,7 +762,7 @@ accessible, absolute names can never be hidden.
Locate nat.
-.. seealso:: Commands :cmd:`Locate` and :cmd:`Locate Library`.
+.. seealso:: Commands :cmd:`Locate`.
.. _libraries-and-filesystem:
@@ -1369,911 +827,6 @@ subdirectories of path). See the command :cmd:`Declare ML Module` in
See :ref:`command-line-options` for a more general view over the |Coq| command
line options.
-.. _ImplicitArguments:
-
-Implicit arguments
-------------------
-
-An implicit argument of a function is an argument which can be
-inferred from contextual knowledge. There are different kinds of
-implicit arguments that can be considered implicit in different ways.
-There are also various commands to control the setting or the
-inference of implicit arguments.
-
-
-The different kinds of implicit arguments
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Implicit arguments inferable from the knowledge of other arguments of a function
-++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
-The first kind of implicit arguments covers the arguments that are
-inferable from the knowledge of the type of other arguments of the
-function, or of the type of the surrounding context of the
-application. Especially, such implicit arguments correspond to
-parameters dependent in the type of the function. Typical implicit
-arguments are the type arguments in polymorphic functions. There are
-several kinds of such implicit arguments.
-
-**Strict Implicit Arguments**
-
-An implicit argument can be either strict or non strict. An implicit
-argument is said to be *strict* if, whatever the other arguments of the
-function are, it is still inferable from the type of some other
-argument. Technically, an implicit argument is strict if it
-corresponds to a parameter which is not applied to a variable which
-itself is another parameter of the function (since this parameter may
-erase its arguments), not in the body of a match, and not itself
-applied or matched against patterns (since the original form of the
-argument can be lost by reduction).
-
-For instance, the first argument of
-::
-
- cons: forall A:Set, A -> list A -> list A
-
-in module ``List.v`` is strict because :g:`list` is an inductive type and :g:`A`
-will always be inferable from the type :g:`list A` of the third argument of
-:g:`cons`. Also, the first argument of :g:`cons` is strict with respect to the second one,
-since the first argument is exactly the type of the second argument.
-On the contrary, the second argument of a term of type
-::
-
- forall P:nat->Prop, forall n:nat, P n -> ex nat P
-
-is implicit but not strict, since it can only be inferred from the
-type :g:`P n` of the third argument and if :g:`P` is, e.g., :g:`fun _ => True`, it
-reduces to an expression where ``n`` does not occur any longer. The first
-argument :g:`P` is implicit but not strict either because it can only be
-inferred from :g:`P n` and :g:`P` is not canonically inferable from an arbitrary
-:g:`n` and the normal form of :g:`P n`. Consider, e.g., that :g:`n` is :math:`0` and the third
-argument has type :g:`True`, then any :g:`P` of the form
-::
-
- fun n => match n with 0 => True | _ => anything end
-
-would be a solution of the inference problem.
-
-**Contextual Implicit Arguments**
-
-An implicit argument can be *contextual* or not. An implicit argument
-is said *contextual* if it can be inferred only from the knowledge of
-the type of the context of the current expression. For instance, the
-only argument of::
-
- nil : forall A:Set, list A`
-
-is contextual. Similarly, both arguments of a term of type::
-
- forall P:nat->Prop, forall n:nat, P n \/ n = 0
-
-are contextual (moreover, :g:`n` is strict and :g:`P` is not).
-
-**Reversible-Pattern Implicit Arguments**
-
-There is another class of implicit arguments that can be reinferred
-unambiguously if all the types of the remaining arguments are known.
-This is the class of implicit arguments occurring in the type of
-another argument in position of reversible pattern, which means it is
-at the head of an application but applied only to uninstantiated
-distinct variables. Such an implicit argument is called *reversible-
-pattern implicit argument*. A typical example is the argument :g:`P` of
-nat_rec in
-::
-
- nat_rec : forall P : nat -> Set, P 0 ->
- (forall n : nat, P n -> P (S n)) -> forall x : nat, P x
-
-(:g:`P` is reinferable by abstracting over :g:`n` in the type :g:`P n`).
-
-See :ref:`controlling-rev-pattern-implicit-args` for the automatic declaration of reversible-pattern
-implicit arguments.
-
-Implicit arguments inferable by resolution
-++++++++++++++++++++++++++++++++++++++++++
-
-This corresponds to a class of non-dependent implicit arguments that
-are solved based on the structure of their type only.
-
-
-Maximal or non maximal insertion of implicit arguments
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-In case a function is partially applied, and the next argument to be
-applied is an implicit argument, two disciplines are applicable. In
-the first case, the function is considered to have no arguments
-furtherly: one says that the implicit argument is not maximally
-inserted. In the second case, the function is considered to be
-implicitly applied to the implicit arguments it is waiting for: one
-says that the implicit argument is maximally inserted.
-
-Each implicit argument can be declared to be inserted maximally or non
-maximally. In Coq, maximally-inserted implicit arguments are written between curly braces
-"{ }" and non-maximally-inserted implicit arguments are written in square brackets "[ ]".
-
-.. seealso:: :flag:`Maximal Implicit Insertion`
-
-Trailing Implicit Arguments
-+++++++++++++++++++++++++++
-
-An implicit argument is considered trailing when all following arguments are declared
-implicit. Trailing implicit arguments cannot be declared non maximally inserted,
-otherwise they would never be inserted.
-
-.. exn:: Argument @name is a trailing implicit, so it can't be declared non maximal. Please use %{ %} instead of [ ].
-
- For instance:
-
- .. coqtop:: all fail
-
- Fail Definition double [n] := n + n.
-
-
-Casual use of implicit arguments
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-In a given expression, if it is clear that some argument of a function
-can be inferred from the type of the other arguments, the user can
-force the given argument to be guessed by replacing it by “_”. If
-possible, the correct argument will be automatically generated.
-
-.. exn:: Cannot infer a term for this placeholder.
- :name: Cannot infer a term for this placeholder. (Casual use of implicit arguments)
-
- |Coq| was not able to deduce an instantiation of a “_”.
-
-.. _declare-implicit-args:
-
-Declaration of implicit arguments
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-In case one wants that some arguments of a given object (constant,
-inductive types, constructors, assumptions, local or not) are always
-inferred by |Coq|, one may declare once and for all which are the
-expected implicit arguments of this object. There are two ways to do
-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
-braces or square braces:
-
-.. coqtop:: all
-
- Definition id {A : Type} (x : A) : A := x.
-
-This automatically declares the argument A of id as a maximally
-inserted implicit argument. One can then do as-if the argument was
-absent in every situation but still be able to specify it if needed:
-
-.. coqtop:: all
-
- Definition compose {A B C} (g : B -> C) (f : A -> B) := fun x => g (f x).
-
- Goal forall A, compose id id = id (A:=A).
-
-For non maximally inserted implicit arguments, use square brackets:
-
-.. coqtop:: all
-
- Fixpoint map [A B : Type] (f : A -> B) (l : list A) : list B :=
- match l with
- | nil => nil
- | cons a t => cons (f a) (map f t)
- end.
-
- Print Implicit map.
-
-The syntax is supported in all top-level definitions:
-:cmd:`Definition`, :cmd:`Fixpoint`, :cmd:`Lemma` and so on. For (co-)inductive datatype
-declarations, the semantics are the following: an inductive parameter
-declared as an implicit argument need not be repeated in the inductive
-definition and will become implicit for the inductive type and the constructors.
-For example:
-
-.. coqtop:: all
-
- Inductive list {A : Type} : Type :=
- | nil : list
- | cons : A -> list -> list.
-
- Print list.
-
-One can always specify the parameter if it is not uniform using the
-usual implicit arguments disambiguation syntax.
-
-The syntax is also supported in internal binders. For instance, in the
-following kinds of expressions, the type of each declaration present
-in :token:`binders` can be bracketed to mark the declaration as
-implicit:
-:n:`fun (@ident:forall {* @binder }, @type) => @term`,
-:n:`forall (@ident:forall {* @binder }, @type), @type`,
-:n:`let @ident {* @binder } := @term in @term`,
-:n:`fix @ident {* @binder } := @term in @term` and
-:n:`cofix @ident {* @binder } := @term in @term`.
-Here is an example:
-
-.. coqtop:: all
-
- Axiom Ax :
- forall (f:forall {A} (a:A), A * A),
- let g {A} (x y:A) := (x,y) in
- f 0 = g 0 0.
-
-.. warn:: Ignoring implicit binder declaration in unexpected position
-
- This is triggered when setting an argument implicit in an
- expression which does not correspond to the type of an assumption
- or to the body of a definition. Here is an example:
-
- .. coqtop:: all warn
-
- Definition f := forall {y}, y = 0.
-
-.. warn:: Making shadowed name of implicit argument accessible by position
-
- This is triggered when two variables of same name are set implicit
- in the same block of binders, in which case the first occurrence is
- considered to be unnamed. Here is an example:
-
- .. coqtop:: all warn
-
- Check let g {x:nat} (H:x=x) {x} (H:x=x) := x in 0.
-
-
-Declaring Implicit Arguments
-++++++++++++++++++++++++++++
-
-
-
-.. 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:
-
-.. exn:: The & modifier may only occur once.
- :undocumented:
-
-.. example::
-
- .. coqtop:: reset all
-
- Inductive list (A : Type) : Type :=
- | nil : list A
- | cons : A -> list A -> list A.
-
- Check (cons nat 3 (nil nat)).
-
- Arguments cons [A] _ _.
-
- Arguments nil {A}.
-
- Check (cons 3 nil).
-
- Fixpoint map (A B : Type) (f : A -> B) (l : list A) : list B :=
- match l with nil => nil | cons a t => cons (f a) (map A B f t) end.
-
- Fixpoint length (A : Type) (l : list A) : nat :=
- match l with nil => 0 | cons _ m => S (length A m) end.
-
- Arguments map [A B] f l.
-
- Arguments length {A} l. (* A has to be maximally inserted *)
-
- 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::
- 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
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- The :n:`default implicits @arguments_modifier` clause tells |Coq| to automatically determine the
- implicit arguments of the object.
-
- 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-contextual-implicit-args`,
- :ref:`controlling-rev-pattern-implicit-args` and also :ref:`controlling-insertion-implicit-args`).
-
-.. example:: Default implicits
-
- .. coqtop:: reset all
-
- Inductive list (A:Set) : Set :=
- | nil : list A
- | cons : A -> list A -> list A.
-
- Arguments cons : default implicits.
-
- Print Implicit cons.
-
- Arguments nil : default implicits.
-
- Print Implicit nil.
-
- Set Contextual Implicit.
-
- Arguments nil : default implicits.
-
- Print Implicit nil.
-
-The computation of implicit arguments takes account of the unfolding
-of constants. For instance, the variable ``p`` below has type
-``(Transitivity R)`` which is reducible to
-``forall x,y:U, R x y -> forall z:U, R y z -> R x z``. As the variables ``x``, ``y`` and ``z``
-appear strictly in the body of the type, they are implicit.
-
-.. coqtop:: all
-
- Parameter X : Type.
-
- Definition Relation := X -> X -> Prop.
-
- Definition Transitivity (R:Relation) := forall x y:X, R x y -> forall z:X, R y z -> R x z.
-
- Parameters (R : Relation) (p : Transitivity R).
-
- Arguments p : default implicits.
-
- Print p.
-
- Print Implicit p.
-
- Parameters (a b c : X) (r1 : R a b) (r2 : R b c).
-
- Check (p r1 r2).
-
-
-Mode for automatic declaration of implicit arguments
-++++++++++++++++++++++++++++++++++++++++++++++++++++
-
-.. flag:: Implicit Arguments
-
- This flag (off by default) allows to systematically declare implicit
- the arguments detectable as such. Auto-detection of implicit arguments is
- governed by flags controlling whether strict and contextual implicit
- arguments have to be considered or not.
-
-.. _controlling-strict-implicit-args:
-
-Controlling strict implicit arguments
-+++++++++++++++++++++++++++++++++++++
-
-.. flag:: Strict Implicit
-
- When the mode for automatic declaration of implicit arguments is on,
- the default is to automatically set implicit only the strict implicit
- arguments plus, for historical reasons, a small subset of the non-strict
- implicit arguments. To relax this constraint and to set
- implicit all non strict implicit arguments by default, you can turn this
- flag off.
-
-.. flag:: Strongly Strict Implicit
-
- Use this flag (off by default) to capture exactly the strict implicit
- arguments and no more than the strict implicit arguments.
-
-.. _controlling-contextual-implicit-args:
-
-Controlling contextual implicit arguments
-+++++++++++++++++++++++++++++++++++++++++
-
-.. flag:: Contextual Implicit
-
- By default, |Coq| does not automatically set implicit the contextual
- implicit arguments. You can turn this flag on to tell |Coq| to also
- infer contextual implicit argument.
-
-.. _controlling-rev-pattern-implicit-args:
-
-Controlling reversible-pattern implicit arguments
-+++++++++++++++++++++++++++++++++++++++++++++++++
-
-.. flag:: Reversible Pattern Implicit
-
- By default, |Coq| does not automatically set implicit the reversible-pattern
- implicit arguments. You can turn this flag on to tell |Coq| to also infer
- reversible-pattern implicit argument.
-
-.. _controlling-insertion-implicit-args:
-
-Controlling the insertion of implicit arguments not followed by explicit arguments
-++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
-.. flag:: Maximal Implicit Insertion
-
- Assuming the implicit argument mode is on, this flag (off by default)
- declares implicit arguments to be automatically inserted when a
- function is partially applied and the next argument of the function is
- an implicit one.
-
-Combining manual declaration and automatic declaration
-++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
-When some arguments are manually specified implicit with binders in a definition
-and the automatic declaration mode in on, the manual implicit arguments are added to the
-automatically declared ones.
-
-In that case, and when the flag :flag:`Maximal Implicit Insertion` is set to off,
-some trailing implicit arguments can be inferred to be non maximally inserted. In
-this case, they are converted to maximally inserted ones.
-
-.. example::
-
- .. coqtop:: all
-
- Set Implicit Arguments.
- Axiom eq0_le0 : forall (n : nat) (x : n = 0), n <= 0.
- Print Implicit eq0_le0.
- Axiom eq0_le0' : forall (n : nat) {x : n = 0}, n <= 0.
- Print Implicit eq0_le0'.
-
-
-.. _explicit-applications:
-
-Explicit applications
-~~~~~~~~~~~~~~~~~~~~~
-
-In presence of non-strict or contextual arguments, or in presence of
-partial applications, the synthesis of implicit arguments may fail, so
-one may have to explicitly give certain implicit arguments of an
-application. Use the :n:`(@ident := @term)` form of :token:`arg` to do so,
-where :token:`ident` is the name of the implicit argument and :token:`term`
-is its corresponding explicit term. Alternatively, one can deactivate
-the hiding of implicit arguments for a single function application using the
-:n:`@ @qualid {? @univ_annot } {* @term1 }` form of :token:`term10`.
-
-.. example:: Syntax for explicitly giving implicit arguments (continued)
-
- .. coqtop:: all
-
- Check (p r1 (z:=c)).
-
- Check (p (x:=a) (y:=b) r1 (z:=c) r2).
-
-
-.. _renaming_implicit_arguments:
-
-Renaming implicit arguments
-~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-.. example:: (continued) Renaming implicit arguments
-
- .. coqtop:: all
-
- Arguments p [s t] _ [u] _: rename.
-
- Check (p r1 (u:=c)).
-
- Check (p (s:=a) (t:=b) r1 (u:=c) r2).
-
- Fail Arguments p [s t] _ [w] _ : assert.
-
-.. _displaying-implicit-args:
-
-Displaying implicit arguments
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-.. cmd:: Print Implicit @smart_qualid
-
- Displays the implicit arguments associated with an object,
- identifying which arguments are applied maximally or not.
-
-
-Displaying implicit arguments when pretty-printing
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-.. flag:: Printing 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 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.
-
-.. seealso:: :flag:`Printing All`.
-
-Interaction with subtyping
-~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-When an implicit argument can be inferred from the type of more than
-one of the other arguments, then only the type of the first of these
-arguments is taken into account, and not an upper type of all of them.
-As a consequence, the inference of the implicit argument of “=” fails
-in
-
-.. coqtop:: all
-
- Fail Check nat = Prop.
-
-but succeeds in
-
-.. coqtop:: all
-
- Check Prop = nat.
-
-
-Deactivation of implicit arguments for parsing
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-.. flag:: Parsing Explicit
-
- Turning this flag on (it is off by default) deactivates the use of implicit arguments.
-
- In this case, all arguments of constants, inductive types,
- constructors, etc, including the arguments declared as implicit, have
- to be given as if no arguments were implicit. By symmetry, this also
- affects printing.
-
-.. _canonical-structure-declaration:
-
-Canonical structures
-~~~~~~~~~~~~~~~~~~~~
-
-A canonical structure is an instance of a record/structure type that
-can be used to solve unification problems involving a projection
-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:: 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 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|.
- Then, each time an equation of the form ``(``\ |x_i| ``_)`` |eq_beta_delta_iota_zeta| |c_i| has to be
- solved during the type checking process, :token:`qualid` is used as a solution.
- Otherwise said, :token:`qualid` is canonically used to extend the field |c_i|
- into a complete structure built on |c_i|.
-
- Canonical structures are particularly useful when mixed with coercions
- and strict implicit arguments.
-
- .. example::
-
- Here is an example.
-
- .. coqtop:: all
-
- Require Import Relations.
-
- Require Import EqNat.
-
- Set Implicit Arguments.
-
- Unset Strict Implicit.
-
- Structure Setoid : Type := {Carrier :> Set; Equal : relation Carrier;
- Prf_equiv : equivalence Carrier Equal}.
-
- Definition is_law (A B:Setoid) (f:A -> B) := forall x y:A, Equal x y -> Equal (f x) (f y).
-
- Axiom eq_nat_equiv : equivalence nat eq_nat.
-
- Definition nat_setoid : Setoid := Build_Setoid eq_nat_equiv.
-
- Canonical nat_setoid.
-
- Thanks to :g:`nat_setoid` declared as canonical, the implicit arguments :g:`A`
- and :g:`B` can be synthesized in the next statement.
-
- .. coqtop:: all abort
-
- Lemma is_law_S : is_law S.
-
- .. note::
- If a same field occurs in several canonical structures, then
- only the structure declared first as canonical is considered.
-
- .. 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::
-
- For instance, when declaring the :g:`Setoid` structure above, the
- :g:`Prf_equiv` field declaration could be written as follows.
-
- .. coqdoc::
-
- #[canonical(false)] Prf_equiv : equivalence Carrier Equal
-
- See :ref:`canonicalstructures` for a more realistic example.
-
-.. 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.
-
-.. 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
- which it is a projection is indicated. If constants are given as
- its arguments, only the unification rules that involve or are
- synthesized from simultaneously all given constants will be shown.
-
- .. example::
-
- For instance, the above example gives the following output:
-
- .. coqtop:: all
-
- Print Canonical Projections.
-
- .. coqtop:: all
-
- Print Canonical Projections nat.
-
- .. note::
-
- The last line in the first example would not show up if the
- corresponding projection (namely :g:`Prf_equiv`) were annotated as not
- canonical, as described above.
-
-Implicit types of variables
-~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-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 {| 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
-
- 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 :token:`type` (unless the bound variable is already declared
- with an explicit type, in which case, that type will be used).
-
-.. example::
-
- .. coqtop:: all
-
- Require Import List.
-
- Implicit Types m n : nat.
-
- Lemma cons_inj_nat : forall m n l, n :: l = m :: l -> n = m.
- Proof. intros m n. Abort.
-
- Lemma cons_inj_bool : forall (m n:bool) l, n :: l = m :: l -> n = m.
- Abort.
-
-.. flag:: Printing Use Implicit Types
-
- By default, the type of bound variables is not printed when
- the variable name is associated to an implicit type which matches the
- actual type of the variable. This feature can be deactivated by
- turning this flag off.
-
-.. _implicit-generalization:
-
-Implicit generalization
-~~~~~~~~~~~~~~~~~~~~~~~
-
-.. index:: `{ }
-.. index:: `[ ]
-.. index:: `( )
-.. index:: `{! }
-.. 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. 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 \`( ).
-
-Terms surrounded by \`{ } introduce their free variables as maximally
-inserted implicit arguments, terms surrounded by \`[ ] introduce them as
-non maximally inserted implicit arguments and terms surrounded by \`( )
-introduce them as explicit arguments.
-
-Generalizing binders always introduce their free variables as
-maximally inserted implicit arguments. The binder itself introduces
-its argument as usual.
-
-In the following statement, ``A`` and ``y`` are automatically
-generalized, ``A`` is implicit and ``x``, ``y`` and the anonymous
-equality argument are explicit.
-
-.. coqtop:: all reset
-
- Generalizable All Variables.
-
- Definition sym `(x:A) : `(x = y -> y = x) := fun _ p => eq_sym p.
-
- Print sym.
-
-Dually to normal binders, the name is optional but the type is required:
-
-.. coqtop:: all
-
- Check (forall `{x = y :> A}, y = x).
-
-When generalizing a binder whose type is a typeclass, its own class
-arguments are omitted from the syntax and are generalized using
-automatic names, without instance search. Other arguments are also
-generalized unless provided. This produces a fully general statement.
-this behaviour may be disabled by prefixing the type with a ``!`` or
-by forcing the typeclass name to be an explicit application using
-``@`` (however the later ignores implicit argument information).
-
-.. coqtop:: all
-
- Class Op (A:Type) := op : A -> A -> A.
-
- Class Commutative (A:Type) `(Op A) := commutative : forall x y, op x y = op y x.
- Instance nat_op : Op nat := plus.
-
- Set Printing Implicit.
- Check (forall `{Commutative }, True).
- Check (forall `{Commutative nat}, True).
- Fail Check (forall `{Commutative nat _}, True).
- Fail Check (forall `{!Commutative nat}, True).
- Arguments Commutative _ {_}.
- Check (forall `{!Commutative nat}, True).
- Check (forall `{@Commutative nat plus}, True).
-
-Multiple binders can be merged using ``,`` as a separator:
-
-.. coqtop:: all
-
- Check (forall `{Commutative A, Hnat : !Commutative nat}, True).
-
-.. cmd:: Generalizable {| {| Variable | Variables } {+ @ident } | All Variables | No Variables }
-
- Controls the set of generalizable identifiers. By default, no variables are
- generalizable.
-
- This command supports the :attr:`global` attribute.
-
- 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.
-
- 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.
-
- The :n:`No Variables` form disables implicit generalization entirely. This is
- the default behavior (before any :cmd:`Generalizable` command has been entered).
-
-
.. _Coercions:
Coercions
diff --git a/doc/sphinx/language/gallina-specification-language.rst b/doc/sphinx/language/gallina-specification-language.rst
index f4592f8f37..ccb236a174 100644
--- a/doc/sphinx/language/gallina-specification-language.rst
+++ b/doc/sphinx/language/gallina-specification-language.rst
@@ -161,7 +161,7 @@ is described in Chapter :ref:`syntaxextensionsandinterpretationscopes`.
one_term ::= @term1
| @ @qualid {? @univ_annot }
term1 ::= @term_projection
- | @term0 % @ident
+ | @term0 % @scope
| @term0
term0 ::= @qualid {? @univ_annot }
| @sort
@@ -373,12 +373,10 @@ the propositional implication and function types.
Applications
------------
-The expression :n:`@term__fun @term` denotes the application of
-:n:`@term__fun` (which is expected to have a function type) to
-:token:`term`.
+:n:`@term__fun @term` denotes applying the function :n:`@term__fun` to :token:`term`.
-The expression :n:`@term__fun {+ @term__i }` denotes the application
-of the term :n:`@term__fun` to the arguments :n:`@term__i`. It is
+:n:`@term__fun {+ @term__i }` denotes applying
+:n:`@term__fun` to the arguments :n:`@term__i`. It is
equivalent to :n:`( … ( @term__fun @term__1 ) … ) @term__n`:
associativity is to the left.
@@ -458,7 +456,7 @@ Definition by cases: match
pattern10 ::= @pattern1 as @name
| @pattern1 {* @pattern1 }
| @ @qualid {* @pattern1 }
- pattern1 ::= @pattern0 % @ident
+ pattern1 ::= @pattern0 % @scope
| @pattern0
pattern0 ::= @qualid
| %{%| {* @qualid := @pattern } %|%}
@@ -636,13 +634,18 @@ co-recursion. It is the local counterpart of the :cmd:`CoFixpoint` command. When
The Vernacular
==============
-.. insertprodn vernacular vernacular
+.. insertprodn vernacular sentence
.. prodn::
- vernacular ::= {* {? @all_attrs } {| @command | @ltac_expr } . }
-
-The top-level input to |Coq| is a series of :production:`command`\s and :production:`tactic`\s,
-each terminated with a period
+ vernacular ::= {* @sentence }
+ sentence ::= {? @all_attrs } @command .
+ | {? @all_attrs } {? @num : } @query_command .
+ | {? @all_attrs } {? @toplevel_selector } @ltac_expr {| . | ... }
+ | @control_command
+
+The top-level input to |Coq| is a series of :n:`@sentence`\s,
+which are :production:`tactic`\s or :production:`command`\s,
+generally 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
simple tactics.
@@ -718,7 +721,7 @@ has type :n:`@type`.
:name: @ident already exists. (Axiom)
:undocumented:
-.. warn:: @ident is declared as a local axiom [local-declaration,scope]
+.. warn:: @ident is declared as a local axiom
Warning generated when using :cmd:`Variable` or its equivalent
instead of :n:`Local Parameter` or its equivalent.
diff --git a/doc/sphinx/practical-tools/coq-commands.rst b/doc/sphinx/practical-tools/coq-commands.rst
index aa4b6edd7d..545bba4930 100644
--- a/doc/sphinx/practical-tools/coq-commands.rst
+++ b/doc/sphinx/practical-tools/coq-commands.rst
@@ -164,6 +164,8 @@ and ``coqtop``, unless stated otherwise:
it is executed.
:-load-vernac-object *qualid*: Load |Coq| compiled library :n:`@qualid`. This
is equivalent to running :cmd:`Require` :n:`qualid`.
+:-rfrom *dirpath* *qualid*: Load |Coq| compiled library :n:`@qualid`.
+ This is equivalent to running :n:`From` :n:`@dirpath` :cmd:`Require Import` :n:`@qualid`.
:-ri *qualid*, -require-import *qualid*: Load |Coq| compiled library :n:`@qualid` and import it.
This is equivalent to running :cmd:`Require Import` :n:`@qualid`.
:-re *qualid*, -require-export *qualid*: Load |Coq| compiled library :n:`@qualid` and transitively import it.
@@ -172,7 +174,6 @@ and ``coqtop``, unless stated otherwise:
This is equivalent to running :n:`From` :n:`@dirpath` :cmd:`Require Import` :n:`@qualid`.
:-refrom *dirpath* *qualid*, -require-export-from *dirpath* *qualid*: Load |Coq| compiled library :n:`@qualid` and transitively import it.
This is equivalent to running :n:`From` :n:`@dirpath` :cmd:`Require Export` :n:`@qualid`.
-:-require *qualid*: Deprecated; use ``-ri`` *qualid*.
:-batch: Exit just after argument parsing. Available for ``coqtop`` only.
:-compile *file.v*: Deprecated; use ``coqc`` instead. Compile file *file.v* into *file.vo*. This option
implies -batch (exit just after argument parsing). It is available only
@@ -379,7 +380,7 @@ Compiled libraries checker (coqchk)
----------------------------------------
The ``coqchk`` command takes a list of library paths as argument, described either
-by their logical name or by their physical filename, hich must end in ``.vo``. The
+by their logical name or by their physical filename, which must end in ``.vo``. The
corresponding compiled libraries (``.vo`` files) are searched in the path,
recursively processing the libraries they depend on. The content of all these
libraries is then type checked. The effect of ``coqchk`` is only to return with
diff --git a/doc/sphinx/practical-tools/coqide.rst b/doc/sphinx/practical-tools/coqide.rst
index b1f392c337..a045120b70 100644
--- a/doc/sphinx/practical-tools/coqide.rst
+++ b/doc/sphinx/practical-tools/coqide.rst
@@ -1,3 +1,5 @@
+.. |GtkSourceView| replace:: :smallcaps:`GtkSourceView`
+
.. _coqintegrateddevelopmentenvironment:
|Coq| Integrated Development Environment
@@ -98,19 +100,6 @@ processed color, though their preceding proofs have the processed color.
Notice that for all these buttons, except for the "gears" button, their operations
are also available in the menu, where their keyboard shortcuts are given.
-Proof folding
-------------------
-
-As your script grows bigger and bigger, it might be useful to hide the
-proofs of your theorems and lemmas.
-
-This feature is toggled via the Hide entry of the Navigation menu. The
-proof shall be enclosed between ``Proof.`` and ``Qed.``, both with their final
-dots. The proof that shall be hidden or revealed is the first one
-whose beginning statement (such as ``Theorem``) precedes the insertion
-cursor.
-
-
Vernacular commands, templates
-----------------------------------
@@ -158,7 +147,18 @@ presented as a notebook.
The first section is for selecting the text font used for scripts,
goal and message windows.
-The second and third sections are for controlling colors and style.
+The second and third sections are for controlling colors and style of
+the three main buffers. A predefined |Coq| highlighting style as well
+as standard |GtkSourceView| styles are available. Other styles can be
+added e.g. in ``$HOME/.local/share/gtksourceview-3.0/styles/`` (see
+the general documentation about |GtkSourceView| for the various
+possibilities). Note that the style of the rest of graphical part of
+Coqide is not under the control of |GtkSourceView| but of GTK+ and
+governed by files such as ``settings.ini`` and ``gtk.css`` in
+``$XDG_CONFIG_HOME/gtk-3.0`` or files in
+``$HOME/.themes/NameOfTheme/gtk-3.0``, as well as the environment
+variable ``GTK_THEME`` (search on internet for the various
+possibilities).
The fourth section is for customizing the editor. It includes in
particular the ability to activate an Emacs mode named
diff --git a/doc/sphinx/practical-tools/utilities.rst b/doc/sphinx/practical-tools/utilities.rst
index d61e5ddce7..bc77e2e58c 100644
--- a/doc/sphinx/practical-tools/utilities.rst
+++ b/doc/sphinx/practical-tools/utilities.rst
@@ -42,6 +42,8 @@ As of today it is possible to build Coq projects using two tools:
- coq_makefile, which is distributed by Coq and is based on generating a makefile,
- Dune, the standard OCaml build tool, which, since version 1.9, supports building Coq libraries.
+.. _coq_makefile:
+
Building a |Coq| project with coq_makefile
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -243,9 +245,9 @@ file timing data:
COQDEP Fast.v
COQDEP Slow.v
COQC Slow.v
- Slow (user: 0.34 mem: 395448 ko)
+ Slow.vo (user: 0.34 mem: 395448 ko)
COQC Fast.v
- Fast (user: 0.01 mem: 45184 ko)
+ Fast.vo (user: 0.01 mem: 45184 ko)
+ ``pretty-timed``
this target stores the output of ``make TIMED=1`` into
@@ -278,15 +280,15 @@ file timing data:
COQDEP Fast.v
COQDEP Slow.v
COQC Slow.v
- Slow (user: 0.36 mem: 393912 ko)
+ Slow.vo (user: 0.36 mem: 393912 ko)
COQC Fast.v
- Fast (user: 0.05 mem: 45992 ko)
+ Fast.vo (user: 0.05 mem: 45992 ko)
Time | File Name
--------------------
0m00.41s | Total
--------------------
- 0m00.36s | Slow
- 0m00.05s | Fast
+ 0m00.36s | Slow.vo
+ 0m00.05s | Fast.vo
+ ``print-pretty-timed-diff``
@@ -336,8 +338,8 @@ file timing data:
--------------------------------------------------------
0m00.39s | Total | 0m00.35s || +0m00.03s | +11.42%
--------------------------------------------------------
- 0m00.37s | Slow | 0m00.01s || +0m00.36s | +3600.00%
- 0m00.02s | Fast | 0m00.34s || -0m00.32s | -94.11%
+ 0m00.37s | Slow.vo | 0m00.01s || +0m00.36s | +3600.00%
+ 0m00.02s | Fast.vo | 0m00.34s || -0m00.32s | -94.11%
The following targets and ``Makefile`` variables allow collection of per-
diff --git a/doc/sphinx/proof-engine/detailed-tactic-examples.rst b/doc/sphinx/proof-engine/detailed-tactic-examples.rst
index 0ace9ef5b9..b63ae32311 100644
--- a/doc/sphinx/proof-engine/detailed-tactic-examples.rst
+++ b/doc/sphinx/proof-engine/detailed-tactic-examples.rst
@@ -353,7 +353,7 @@ the optional tactic of the ``Hint Rewrite`` command.
.. coqtop:: in reset
- Require Import Omega.
+ Require Import Lia.
.. coqtop:: in
@@ -367,7 +367,7 @@ the optional tactic of the ``Hint Rewrite`` command.
.. coqtop:: in
- Hint Rewrite g0 g1 g2 using omega : base1.
+ Hint Rewrite g0 g1 g2 using lia : base1.
.. coqtop:: in
diff --git a/doc/sphinx/proof-engine/ltac.rst b/doc/sphinx/proof-engine/ltac.rst
index b2b426ada5..1772362351 100644
--- a/doc/sphinx/proof-engine/ltac.rst
+++ b/doc/sphinx/proof-engine/ltac.rst
@@ -258,6 +258,9 @@ following form:
Goal selectors
~~~~~~~~~~~~~~
+.. todo: mention this applies to Print commands and the Info command
+
+
We can restrict the application of a tactic to a subset of the currently
focused goals with:
@@ -1712,6 +1715,7 @@ performance issue.
.. coqtop:: reset in
+ Set Warnings "-omega-is-deprecated".
Require Import Coq.omega.Omega.
Ltac mytauto := tauto.
diff --git a/doc/sphinx/proof-engine/proof-handling.rst b/doc/sphinx/proof-engine/proof-handling.rst
index 03eebc32f9..3b5233502d 100644
--- a/doc/sphinx/proof-engine/proof-handling.rst
+++ b/doc/sphinx/proof-engine/proof-handling.rst
@@ -41,8 +41,8 @@ terms are called *proof terms*.
.. _proof-editing-mode:
-Switching on/off the proof editing mode
--------------------------------------------
+Entering and leaving proof editing mode
+---------------------------------------
The proof editing mode is entered by asserting a statement, which typically is
the assertion of a theorem using an assertion command like :cmd:`Theorem`. The
diff --git a/doc/sphinx/proof-engine/ssreflect-proof-language.rst b/doc/sphinx/proof-engine/ssreflect-proof-language.rst
index 90a991794f..28c5359a04 100644
--- a/doc/sphinx/proof-engine/ssreflect-proof-language.rst
+++ b/doc/sphinx/proof-engine/ssreflect-proof-language.rst
@@ -1624,9 +1624,15 @@ previous :token:`i_item` have been performed.
The second entry in the :token:`i_view` grammar rule,
``/ltac:(`` :token:`tactic` ``)``, executes :token:`tactic`.
-Notations can be used to name tactics, for example::
+Notations can be used to name tactics, for example
- Notation myop := (ltac:(some ltac code)) : ssripat_scope.
+.. coqtop:: none
+
+ Tactic Notation "my" "ltac" "code" := idtac.
+
+.. coqtop:: in warn
+
+ Notation "'myop'" := (ltac:(my ltac code)) : ssripat_scope.
lets one write just ``/myop`` in the intro pattern. Note the scope
annotation: views are interpreted opening the ``ssripat`` scope.
@@ -2607,7 +2613,7 @@ After the :token:`i_pattern`, a list of binders is allowed.
.. coqtop:: reset none
From Coq Require Import ssreflect.
- From Coq Require Import Omega.
+ From Coq Require Import ZArith Lia.
Set Implicit Arguments.
Unset Strict Implicit.
Unset Printing Implicit Defensive.
@@ -2615,7 +2621,7 @@ After the :token:`i_pattern`, a list of binders is allowed.
.. coqtop:: all
Lemma test : True.
- have H x (y : nat) : 2 * x + y = x + x + y by omega.
+ have H x (y : nat) : 2 * x + y = x + x + y by lia.
A proof term provided after ``:=`` can mention these bound variables
(that are automatically introduced with the given names).
@@ -2625,7 +2631,7 @@ with parentheses even if no type is specified:
.. coqtop:: all restart
- have (x) : 2 * x = x + x by omega.
+ have (x) : 2 * x = x + x by lia.
The :token:`i_item` and :token:`s_item` can be used to interpret the asserted
hypothesis with views (see section :ref:`views_and_reflection_ssr`) or simplify the resulting
@@ -2668,9 +2674,9 @@ context entry name.
Arguments Sub {_} _ _.
Lemma test n m (H : m + 1 < n) : True.
- have @i : 'I_n by apply: (Sub m); omega.
+ have @i : 'I_n by apply: (Sub m); lia.
-Note that the subterm produced by :tacn:`omega` is in general huge and
+Note that the subterm produced by :tacn:`lia` is in general huge and
uninteresting, and hence one may want to hide it.
For this purpose the ``[: name ]`` intro pattern and the tactic
``abstract`` (see :ref:`abstract_ssr`) are provided.
@@ -2680,7 +2686,7 @@ For this purpose the ``[: name ]`` intro pattern and the tactic
.. coqtop:: all abort
Lemma test n m (H : m + 1 < n) : True.
- have [:pm] @i : 'I_n by apply: (Sub m); abstract: pm; omega.
+ have [:pm] @i : 'I_n by apply: (Sub m); abstract: pm; lia.
The type of ``pm`` can be cleaned up by its annotation ``(*1*)`` by just
simplifying it. The annotations are there for technical reasons only.
@@ -2694,7 +2700,7 @@ with have and an explicit term, they must be used as follows:
Lemma test n m (H : m + 1 < n) : True.
have [:pm] @i : 'I_n := Sub m pm.
- by omega.
+ by lia.
In this case the abstract constant ``pm`` is assigned by using it in
the term that follows ``:=`` and its corresponding goal is left to be
@@ -2712,7 +2718,7 @@ makes use of it).
.. coqtop:: all abort
Lemma test n m (H : m + 1 < n) : True.
- have [:pm] @i k : 'I_(n+k) by apply: (Sub m); abstract: pm k; omega.
+ have [:pm] @i k : 'I_(n+k) by apply: (Sub m); abstract: pm k; lia.
Last, notice that the use of intro patterns for abstract constants is
orthogonal to the transparent flag ``@`` for have.
@@ -2963,7 +2969,7 @@ illustrated in the following example.
.. coqtop:: reset none
- From Coq Require Import ssreflect Omega.
+ From Coq Require Import ssreflect Lia.
Set Implicit Arguments.
Unset Strict Implicit.
Unset Printing Implicit Defensive.
diff --git a/doc/sphinx/proof-engine/tactics.rst b/doc/sphinx/proof-engine/tactics.rst
index 19573eee43..7e6da490fb 100644
--- a/doc/sphinx/proof-engine/tactics.rst
+++ b/doc/sphinx/proof-engine/tactics.rst
@@ -51,6 +51,11 @@ specified, the default selector is used.
tactic_invocation : `toplevel_selector` : `tactic`.
: `tactic`.
+.. todo: fully describe selectors. At the moment, ltac has a fairly complete description
+
+.. todo: mention selectors can be applied to some commands, such as
+ Check, Search, SearchHead, SearchPattern, SearchRewrite.
+
.. opt:: Default Goal Selector "@toplevel_selector"
:name: Default Goal Selector
@@ -1870,6 +1875,7 @@ analysis on inductive or co-inductive objects (see :ref:`inductive-definitions`)
Lemma induction_test : forall n:nat, n = n -> n <= n.
intros n H.
induction n.
+ exact (le_n 0).
.. exn:: Not an inductive product.
:undocumented:
@@ -2071,7 +2077,7 @@ analysis on inductive or co-inductive objects (see :ref:`inductive-definitions`)
Now we are in a contradictory context and the proof can be solved.
- .. coqtop:: all
+ .. coqtop:: all abort
inversion H.
@@ -2099,68 +2105,7 @@ analysis on inductive or co-inductive objects (see :ref:`inductive-definitions`)
See also the larger example of :tacn:`dependent induction`
and an explanation of the underlying technique.
-.. tacn:: function induction (@qualid {+ @term})
- :name: function induction
-
- The tactic functional induction performs case analysis and induction
- following the definition of a function. It makes use of a principle
- generated by ``Function`` (see :ref:`advanced-recursive-functions`) or
- ``Functional Scheme`` (see :ref:`functional-scheme`).
- Note that this tactic is only available after a ``Require Import FunInd``.
-
-.. example::
-
- .. coqtop:: reset all
-
- Require Import FunInd.
- Functional Scheme minus_ind := Induction for minus Sort Prop.
- Check minus_ind.
- Lemma le_minus (n m:nat) : n - m <= n.
- functional induction (minus n m) using minus_ind; simpl; auto.
- Qed.
-
-.. note::
- :n:`(@qualid {+ @term})` must be a correct full application
- of :n:`@qualid`. In particular, the rules for implicit arguments are the
- same as usual. For example use :n:`@qualid` if you want to write implicit
- arguments explicitly.
-
-.. note::
- Parentheses around :n:`@qualid {+ @term}` are not mandatory and can be skipped.
-
-.. note::
- :n:`functional induction (f x1 x2 x3)` is actually a wrapper for
- :n:`induction x1, x2, x3, (f x1 x2 x3) using @qualid` followed by a cleaning
- phase, where :n:`@qualid` is the induction principle registered for :g:`f`
- (by the ``Function`` (see :ref:`advanced-recursive-functions`) or
- ``Functional Scheme`` (see :ref:`functional-scheme`)
- command) corresponding to the sort of the goal. Therefore
- ``functional induction`` may fail if the induction scheme :n:`@qualid` is not
- defined. See also :ref:`advanced-recursive-functions` for the function
- terms accepted by ``Function``.
-
-.. note::
- There is a difference between obtaining an induction scheme
- for a function by using :g:`Function` (see :ref:`advanced-recursive-functions`)
- and by using :g:`Functional Scheme` after a normal definition using
- :g:`Fixpoint` or :g:`Definition`. See :ref:`advanced-recursive-functions`
- for details.
-
-.. seealso:: :ref:`advanced-recursive-functions`, :ref:`functional-scheme` and :tacn:`inversion`
-
-.. exn:: Cannot find induction information on @qualid.
- :undocumented:
-
-.. exn:: Not the right number of induction arguments.
- :undocumented:
-
-.. tacv:: functional induction (@qualid {+ @term}) as @simple_intropattern using @term with @bindings_list
-
- Similarly to :tacn:`induction` and :tacn:`elim`, this allows giving
- explicitly the name of the introduced variables, the induction principle, and
- the values of dependent premises of the elimination scheme, including
- *predicates* for mutual induction when :n:`@qualid` is part of a mutually
- recursive definition.
+.. seealso:: :tacn:`functional induction`
.. tacn:: discriminate @term
:name: discriminate
@@ -2667,6 +2612,8 @@ and an explanation of the underlying technique.
assumption.
Qed.
+.. seealso:: :tacn:`functional inversion`
+
.. tacn:: fix @ident @num
:name: fix
@@ -3032,8 +2979,8 @@ following:
For backward compatibility, the notation :n:`in {+ @ident}` performs
the conversion in hypotheses :n:`{+ @ident}`.
-.. tacn:: cbv {* @flag}
- lazy {* @flag}
+.. tacn:: {? @strategy_flag }
+ lazy {? @strategy_flag }
:name: cbv; lazy
These parameterized reduction tactics apply to any goal and perform
@@ -3129,8 +3076,10 @@ the conversion in hypotheses :n:`{+ @ident}`.
.. flag:: NativeCompute Timing
This flag causes all calls to the native compiler to print
- timing information for the compilation, execution, and
- reification phases of native compilation.
+ timing information for the conversion to native code,
+ compilation, execution, and reification phases of native
+ compilation. Timing is printed in units of seconds of
+ wall-clock time.
.. flag:: NativeCompute Profiling
@@ -4003,10 +3952,10 @@ At Coq startup, only the core database is nonempty and can be used.
:arith: This database contains all lemmas about Peano’s arithmetic proved in the
directories Init and Arith.
-:zarith: contains lemmas about binary signed integers from the directories
- theories/ZArith. When required, the module Omega also extends the
- database zarith with a high-cost hint that calls ``omega`` on equations
- and inequalities in ``nat`` or ``Z``.
+:zarith: contains lemmas about binary signed integers from the
+ directories theories/ZArith. The database also contains
+ high-cost hints that call :tacn:`lia` on equations and
+ inequalities in ``nat`` or ``Z``.
:bool: contains lemmas about booleans, mostly from directory theories/Bool.
@@ -4597,42 +4546,6 @@ symbol :g:`=`.
Analogous to :tacn:`dependent rewrite ->` but uses the equality from right to
left.
-Inversion
----------
-
-.. tacn:: functional inversion @ident
- :name: functional inversion
-
- :tacn:`functional inversion` is a tactic that performs inversion on hypothesis
- :n:`@ident` of the form :n:`@qualid {+ @term} = @term` or :n:`@term = @qualid
- {+ @term}` where :n:`@qualid` must have been defined using Function (see
- :ref:`advanced-recursive-functions`). Note that this tactic is only
- available after a ``Require Import FunInd``.
-
- .. exn:: Hypothesis @ident must contain at least one Function.
- :undocumented:
-
- .. exn:: Cannot find inversion information for hypothesis @ident.
-
- This error may be raised when some inversion lemma failed to be generated by
- Function.
-
-
- .. tacv:: functional inversion @num
-
- This does the same thing as :n:`intros until @num` followed by
- :n:`functional inversion @ident` where :token:`ident` is the
- identifier for the last introduced hypothesis.
-
- .. tacv:: functional inversion @ident @qualid
- functional inversion @num @qualid
-
- If the hypothesis :token:`ident` (or :token:`num`) has a type of the form
- :n:`@qualid__1 {+ @term__i } = @qualid__2 {+ @term__j }` where
- :n:`@qualid__1` and :n:`@qualid__2` are valid candidates to
- functional inversion, this variant allows choosing which :token:`qualid`
- is inverted.
-
Classical tactics
-----------------
@@ -4689,18 +4602,6 @@ Automating
The goal is not of the form :g:`t = u`. Especially note that :tacn:`btauto`
doesn't introduce variables into the context on its own.
-.. tacn:: omega
- :name: omega
-
- The tactic :tacn:`omega`, due to Pierre Crégut, is an automatic decision
- procedure for Presburger arithmetic. It solves quantifier-free
- formulas built with `~`, `\\/`, `/\\`, `->` on top of equalities,
- inequalities and disequalities on both the type :g:`nat` of natural numbers
- and :g:`Z` of binary integers. This tactic must be loaded by the command
- ``Require Import Omega``. See the additional documentation about omega
- (see Chapter :ref:`omega`).
-
-
.. tacn:: ring
:name: ring
diff --git a/doc/sphinx/proof-engine/vernacular-commands.rst b/doc/sphinx/proof-engine/vernacular-commands.rst
index b22c5286fe..60fdbf0a9d 100644
--- a/doc/sphinx/proof-engine/vernacular-commands.rst
+++ b/doc/sphinx/proof-engine/vernacular-commands.rst
@@ -6,18 +6,28 @@ Vernacular commands
.. _displaying:
Displaying
---------------
+----------
.. _Print:
-.. cmd:: Print @qualid
- :name: Print
+.. cmd:: Print {? Term } @smart_qualid {? @univ_name_list }
+
+ .. insertprodn univ_name_list univ_name_list
+
+ .. prodn::
+ univ_name_list ::= @%{ {* @name } %}
- This command displays on the screen information about the declared or
- defined object referred by :n:`@qualid`.
+ Displays definitions of terms, including opaque terms, for the object :n:`@smart_qualid`.
- Error messages:
+ * :n:`Term` - a syntactic marker to allow printing a term
+ that is the same as one of the various :n:`Print` commands. For example,
+ :cmd:`Print All` is a different command, while :n:`Print Term All` shows
+ information on the object whose name is ":n:`All`".
+
+ * :n:`@univ_name_list` - locally renames the
+ polymorphic universes of :n:`@smart_qualid`.
+ The name `_` means the usual name is printed.
.. exn:: @qualid not a defined object.
:undocumented:
@@ -29,48 +39,22 @@ Displaying
:undocumented:
- .. cmdv:: Print Term @qualid
- :name: Print Term
-
- This is a synonym of :cmd:`Print` :n:`@qualid` when :n:`@qualid`
- denotes a global constant.
-
- .. cmdv:: Print {? Term } @qualid\@@name
-
- This locally renames the polymorphic universes of :n:`@qualid`.
- An underscore means the usual name is printed.
-
-
-.. cmd:: About @qualid
- :name: About
-
- This displays various information about the object
- denoted by :n:`@qualid`: its kind (module, constant, assumption, inductive,
- constructor, abbreviation, …), long name, type, implicit arguments and
- argument scopes. It does not print the body of definitions or proofs.
-
- .. cmdv:: About @qualid\@@name
-
- This locally renames the polymorphic universes of :n:`@qualid`.
- An underscore means the usual name is printed.
-
-
.. cmd:: Print All
This command displays information about the current state of the
environment, including sections and modules.
- .. cmdv:: Inspect @num
- :name: Inspect
+.. cmd:: Inspect @num
+
+ This command displays the :n:`@num` last objects of the
+ current environment, including sections and modules.
- This command displays the :n:`@num` last objects of the
- current environment, including sections and modules.
+.. cmd:: Print Section @qualid
- .. cmdv:: Print Section @ident
+ Displays the objects defined since the beginning of the section named :n:`@qualid`.
- The name :n:`@ident` should correspond to a currently open section,
- this command displays the objects defined since the beginning of this
- section.
+ .. todo: "A.B" is permitted but unnecessary for modules/sections.
+ should the command just take an @ident?
.. _flags-options-tables:
@@ -81,9 +65,9 @@ Flags, Options and Tables
Coq has many settings to control its behavior. Setting types include flags, options
and tables:
-* A :production:`flag` has a boolean value, such as :flag:`Asymmetric Patterns`.
-* An :production:`option` generally has a numeric or string value, such as :opt:`Firstorder Depth`.
-* A :production:`table` contains a set of strings or qualids.
+* A *flag* has a boolean value, such as :flag:`Asymmetric Patterns`.
+* An *option* generally has a numeric or string value, such as :opt:`Firstorder Depth`.
+* A *table* contains a set of strings or qualids.
* In addition, some commands provide settings, such as :cmd:`Extraction Language`.
.. FIXME Convert "Extraction Language" to an option.
@@ -91,68 +75,84 @@ and tables:
Flags, options and tables are identified by a series of identifiers, each with an initial
capital letter.
-.. cmd:: Set @flag
+.. cmd:: Set @setting_name {? {| @int | @string } }
:name: Set
- Sets :token:`flag` on.
+ .. insertprodn setting_name setting_name
-.. cmd:: Unset @flag
- :name: Unset
+ .. prodn::
+ setting_name ::= {+ @ident }
- Sets :token:`flag` off.
+ If :n:`@setting_name` is a flag, no value may be provided; the flag
+ is set to on.
+ If :n:`@setting_name` is an option, a value of the appropriate type
+ must be provided; the option is set to the specified value.
-.. cmd:: Test @flag
+ This command supports the :attr:`local`, :attr:`global` and :attr:`export` attributes.
+ They are described :ref:`here <set_unset_scope_qualifiers>`.
- Prints the current value of :token:`flag`.
+ .. warn:: There is no flag or option with this name: "@setting_name".
+ This warning message can be raised by :cmd:`Set` and
+ :cmd:`Unset` when :n:`@setting_name` is unknown. It is a
+ warning rather than an error because this helps library authors
+ produce Coq code that is compatible with several Coq versions.
+ To preserve the same behavior, they may need to set some
+ compatibility flags or options that did not exist in previous
+ Coq versions.
-.. cmd:: Set @option {| @num | @string }
- :name: Set @option
+.. cmd:: Unset @setting_name
+ :name: Unset
- Sets :token:`option` to the specified value.
+ If :n:`@setting_name` is a flag, it is set to off. If :n:`@setting_name` is an option, it is
+ set to its default value.
-.. cmd:: Unset @option
- :name: Unset @option
+ This command supports the :attr:`local`, :attr:`global` and :attr:`export` attributes.
+ They are described :ref:`here <set_unset_scope_qualifiers>`.
- Sets :token:`option` to its default value.
+.. cmd:: Add @setting_name {+ {| @qualid | @string } }
-.. cmd:: Test @option
+ Adds the specified values to the table :n:`@setting_name`.
- Prints the current value of :token:`option`.
+.. cmd:: Remove @setting_name {+ {| @qualid | @string } }
-.. cmd:: Print Options
-
- Prints the current value of all flags and options, and the names of all tables.
+ Removes the specified value from the table :n:`@setting_name`.
+.. cmd:: Test @setting_name {? for {+ {| @qualid | @string } } }
-.. cmd:: Add @table {| @string | @qualid }
- :name: Add @table
+ If :n:`@setting_name` is a flag or option, prints its current value.
+ If :n:`@setting_name` is a table: if the `for` clause is specified, reports
+ whether the table contains each specified value, otherise this is equivalent to
+ :cmd:`Print Table`. The `for` clause is not valid for flags and options.
- Adds the specified value to :token:`table`.
+ .. exn:: There is no flag, option or table with this name: "@setting_name".
-.. cmd:: Remove @table {| @string | @qualid }
- :name: Remove @table
+ This error message is raised when calling the :cmd:`Test`
+ command (without the `for` clause), or the :cmd:`Print Table`
+ command, for an unknown :n:`@setting_name`.
- Removes the specified value from :token:`table`.
+ .. exn:: There is no qualid-valued table with this name: "@setting_name".
+ There is no string-valued table with this name: "@setting_name".
-.. cmd:: Test @table for {| @string | @qualid }
- :name: Test @table for
+ These error messages are raised when calling the :cmd:`Add` or
+ :cmd:`Remove` commands, or the :cmd:`Test` command with the
+ `for` clause, if :n:`@setting_name` is unknown or does not have
+ the right type.
- Reports whether :token:`table` contains the specified value.
-
-.. cmd:: Print Table @table
- :name: Print Table @table
+.. cmd:: Print Options
- Prints the values in :token:`table`.
+ Prints the current value of all flags and options, and the names of all tables.
-.. cmd:: Test @table
+.. cmd:: Print Table @setting_name
- A synonym for :cmd:`Print Table @table`.
+ Prints the values in the table :n:`@setting_name`.
.. cmd:: Print Tables
A synonym for :cmd:`Print Options`.
+.. _set_unset_scope_qualifiers:
+
Locality attributes supported by :cmd:`Set` and :cmd:`Unset`
````````````````````````````````````````````````````````````
@@ -185,194 +185,128 @@ Newly opened modules and sections inherit the current settings.
arguments ``-set`` and ``-unset`` for setting flags and options
(cf. :ref:`command-line-options`).
-.. _requests-to-the-environment:
-
-Requests to the environment
--------------------------------
+Query commands
+--------------
-.. cmd:: Check @term
+Unlike other commands, :production:`query_command`\s may be prefixed with
+a goal selector (:n:`@num:`) to specify which goal context it applies to.
+If no selector is provided,
+the command applies to the current goal. If no proof is open, then the command only applies
+to accessible objects. (see Section :ref:`invocation-of-tactics`).
- This command displays the type of :n:`@term`. When called in proof mode, the
- term is checked in the local context of the current subgoal.
+.. cmd:: About @smart_qualid {? @univ_name_list }
- .. cmdv:: @selector: Check @term
+ Displays information about the :n:`@smart_qualid` object, which,
+ if a proof is open, may be a hypothesis of the selected goal,
+ or an accessible theorem, axiom, etc.:
+ its kind (module, constant, assumption, inductive,
+ constructor, abbreviation, …), long name, type, implicit arguments and
+ argument scopes. It does not print the body of definitions or proofs.
- This variant specifies on which subgoal to perform typing
- (see Section :ref:`invocation-of-tactics`).
+.. cmd:: Check @term
+ Displays the type of :n:`@term`. When called in proof mode, the
+ term is checked in the local context of the selected goal.
.. cmd:: Eval @red_expr in @term
- This command performs the specified reduction on :n:`@term`, and displays
- the resulting term with its type. The term to be reduced may depend on
- hypothesis introduced in the first subgoal (if a proof is in
- progress).
+ Performs the specified reduction on :n:`@term` and displays
+ the resulting term with its type. If a proof is open, :n:`@term`
+ may reference hypotheses of the selected goal.
.. seealso:: Section :ref:`performingcomputations`.
.. cmd:: Compute @term
- This command performs a call-by-value evaluation of term by using the
- bytecode-based virtual machine. It is a shortcut for ``Eval vm_compute in``
- :n:`@term`.
+ Evaluates :n:`@term` using the bytecode-based virtual machine.
+ It is a shortcut for :cmd:`Eval` :n:`vm_compute in @term`.
.. seealso:: Section :ref:`performingcomputations`.
+.. cmd:: Search {+ {? - } @search_item } {? {| inside | outside } {+ @qualid } }
-.. cmd:: Print Assumptions @qualid
-
- This commands display all the assumptions (axioms, parameters and
- variables) a theorem or definition depends on. Especially, it informs
- on the assumptions with respect to which the validity of a theorem
- relies.
-
- .. cmdv:: Print Opaque Dependencies @qualid
- :name: Print Opaque Dependencies
-
- Displays the set of opaque constants :n:`@qualid` relies on in addition to
- the assumptions.
-
- .. cmdv:: Print Transparent Dependencies @qualid
- :name: Print Transparent Dependencies
-
- Displays the set of transparent constants :n:`@qualid` relies on
- in addition to the assumptions.
-
- .. cmdv:: Print All Dependencies @qualid
- :name: Print All Dependencies
-
- Displays all assumptions and constants :n:`@qualid` relies on.
-
-
-.. cmd:: Search @qualid
-
- This command displays the name and type of all objects (hypothesis of
- the current goal, theorems, axioms, etc) of the current context whose
- statement contains :n:`@qualid`. This command is useful to remind the user
- of the name of library lemmas.
-
- .. exn:: The reference @qualid was not found in the current environment.
-
- There is no constant in the environment named qualid.
-
- .. cmdv:: Search @string
-
- If :n:`@string` is a valid identifier, this command
- displays the name and type of all objects (theorems, axioms, etc) of
- the current context whose name contains string. If string is a
- notation’s string denoting some reference :n:`@qualid` (referred to by its
- main symbol as in `"+"` or by its notation’s string as in `"_ + _"` or
- `"_ 'U' _"`, see Section :ref:`notations`), the command works like ``Search`` :n:`@qualid`.
-
- .. cmdv:: Search @string%@ident
+ .. insertprodn search_item search_item
- The string string must be a notation or the main
- symbol of a notation which is then interpreted in the scope bound to
- the delimiting key :token:`ident` (see Section :ref:`LocalInterpretationRulesForNotations`).
+ .. prodn::
+ search_item ::= @one_term
+ | @string {? % @scope }
- .. cmdv:: Search @term_pattern
+ Displays the name and type of all hypotheses of the
+ selected goal (if any) and theorems of the current context
+ matching :n:`@search_item`\s.
+ It's useful for finding the names of library lemmas.
- This searches for all statements or types of
- definition that contains a subterm that matches the pattern
- :token:`term_pattern` (holes of the pattern are either denoted by `_` or by
- :n:`?@ident` when non linear patterns are expected).
+ * :n:`@one_term` - Search for objects containing a subterm matching the pattern
+ :n:`@one_term` in which holes of the pattern are indicated by `_` or :n:`?@ident`.
+ If the same :n:`?@ident` occurs more than once in the pattern, all occurrences must
+ match the same value.
- .. cmdv:: Search {+ {? -}@term_pattern_string}
+ * :n:`@string` - If :n:`@string` is a substring of a valid identifier,
+ search for objects whose name contains :n:`@string`. If :n:`@string` is a notation
+ string associated with a :n:`@qualid`, that's equivalent to :cmd:`Search` :n:`@qualid`.
+ For example, specifying `"+"` or `"_ + _"`, which are notations for `Nat.add`, are equivalent
+ to :cmd:`Search` `Nat.add`.
- where
- :n:`@term_pattern_string` is a term_pattern, a string, or a string followed
- by a scope delimiting key `%key`. This generalization of ``Search`` searches
- for all objects whose statement or type contains a subterm matching
- :n:`@term_pattern` (or :n:`@qualid` if :n:`@string` is the notation for a reference
- qualid) and whose name contains all string of the request that
- correspond to valid identifiers. If a term_pattern or a string is
- prefixed by `-`, the search excludes the objects that mention that
- term_pattern or that string.
+ * :n:`% @scope` - limits the search to the scope bound to
+ the delimiting key :n:`@scope`, such as, for example, :n:`%nat`.
+ This clause may be used only if :n:`@string` contains a notation string.
+ (see Section :ref:`LocalInterpretationRulesForNotations`)
- .. cmdv:: Search {+ {? -}@term_pattern_string} inside {+ @qualid }
+ If you specify multiple :n:`@search_item`\s, all the conditions must be satisfied
+ for the object to be displayed. The minus sign `-` excludes objects that contain
+ the :n:`@search_item`.
- This restricts the search to constructions defined in the modules
- named by the given :n:`qualid` sequence.
+ Additional clauses:
- .. cmdv:: Search {+ {? -}@term_pattern_string} outside {+ @qualid }
+ * :n:`inside {+ @qualid }` - limit the search to the specified modules
+ * :n:`outside {+ @qualid }` - exclude the specified modules from the search
- This restricts the search to constructions not defined in the modules
- named by the given :n:`qualid` sequence.
-
- .. cmdv:: @selector: Search {+ {? -}@term_pattern_string}
-
- This specifies the goal on which to search hypothesis (see
- Section :ref:`invocation-of-tactics`).
- By default the 1st goal is searched. This variant can
- be combined with other variants presented here.
+ .. exn:: Module/section @qualid not found.
- .. example::
+ There is no constant in the environment named :n:`@qualid`, where :n:`@qualid`
+ is in an `inside` or `outside` clause.
- .. coqtop:: in
+ .. example:: :cmd:`Search` examples
- Require Import ZArith.
+ .. coqtop:: in
- .. coqtop:: all
+ Require Import ZArith.
- Search Z.mul Z.add "distr".
+ .. coqtop:: all
- Search "+"%Z "*"%Z "distr" -positive -Prop.
+ Search Z.mul Z.add "distr".
+ Search "+"%Z "*"%Z "distr" -Prop.
+ Search (?x * _ + ?x * _)%Z outside OmegaLemmas.
- Search (?x * _ + ?x * _)%Z outside OmegaLemmas.
+.. cmd:: SearchHead @one_term {? {| inside | outside } {+ @qualid } }
-.. cmd:: SearchHead @term
+ Displays the name and type of all hypotheses of the
+ selected goal (if any) and theorems of the current context that have the
+ form :n:`{? forall {* @binder }, } {* P__i -> } C` where :n:`@one_term`
+ matches a prefix of `C`. For example, a :n:`@one_term` of `f _ b`
+ matches `f a b`, which is a prefix of `C` when `C` is `f a b c`.
- This command displays the name and type of all hypothesis of the
- current goal (if any) and theorems of the current context whose
- statement’s conclusion has the form `(term t1 .. tn)`. This command is
- useful to remind the user of the name of library lemmas.
+ See :cmd:`Search` for an explanation of the `inside`/`outside` clauses.
- .. example::
+ .. example:: :cmd:`SearchHead` examples
.. coqtop:: reset all
SearchHead le.
-
SearchHead (@eq bool).
- .. cmdv:: SearchHead @term inside {+ @qualid }
-
- This restricts the search to constructions defined in the modules named
- by the given :n:`qualid` sequence.
+.. cmd:: SearchPattern @one_term {? {| inside | outside } {+ @qualid } }
- .. cmdv:: SearchHead @term outside {+ @qualid }
+ Displays the name and type of all hypotheses of the
+ selected goal (if any) and theorems of the current context
+ ending with :n:`{? forall {* @binder }, } {* P__i -> } C` that match the pattern
+ :n:`@one_term`.
- This restricts the search to constructions not defined in the modules
- named by the given :n:`qualid` sequence.
-
- .. exn:: Module/section @qualid not found.
+ See :cmd:`Search` for an explanation of the `inside`/`outside` clauses.
- No module :n:`@qualid` has been required (see Section :ref:`compiled-files`).
-
- .. cmdv:: @selector: SearchHead @term
-
- This specifies the goal on which to
- search hypothesis (see Section :ref:`invocation-of-tactics`).
- By default the 1st goal is searched. This variant can be combined
- with other variants presented here.
-
- .. note:: Up to |Coq| version 8.4, ``SearchHead`` was named ``Search``.
-
-
-.. cmd:: SearchPattern @term
-
- This command displays the name and type of all hypothesis of the
- current goal (if any) and theorems of the current context whose
- statement’s conclusion or last hypothesis and conclusion matches the
- expressionterm where holes in the latter are denoted by `_`.
- It is a variant of :n:`Search @term_pattern` that does not look for subterms
- but searches for statements whose conclusion has exactly the expected
- form, or whose statement finishes by the given series of
- hypothesis/conclusion.
-
- .. example::
+ .. example:: :cmd:`SearchPattern` examples
.. coqtop:: in
@@ -381,123 +315,118 @@ Requests to the environment
.. coqtop:: all
SearchPattern (_ + _ = _ + _).
-
SearchPattern (nat -> bool).
-
SearchPattern (forall l : list _, _ l l).
- Patterns need not be linear: you can express that the same expression
- must occur in two places by using pattern variables `?ident`.
-
-
- .. example::
-
.. coqtop:: all
SearchPattern (?X1 + _ = _ + ?X1).
- .. cmdv:: SearchPattern @term inside {+ @qualid }
+.. cmd:: SearchRewrite @one_term {? {| inside | outside } {+ @qualid } }
- This restricts the search to constructions defined in the modules
- named by the given :n:`qualid` sequence.
+ Displays the name and type of all hypotheses of the
+ selected goal (if any) and theorems of the current context that have the form
+ :n:`{? forall {* @binder }, } {* P__i -> } LHS = RHS` where :n:`@one_term`
+ matches either `LHS` or `RHS`.
- .. cmdv:: SearchPattern @term outside {+ @qualid }
+ See :cmd:`Search` for an explanation of the `inside`/`outside` clauses.
- This restricts the search to constructions not defined in the modules
- named by the given :n:`qualid` sequence.
+ .. example:: :cmd:`SearchRewrite` examples
- .. cmdv:: @selector: SearchPattern @term
+ .. coqtop:: in
- This specifies the goal on which to
- search hypothesis (see Section :ref:`invocation-of-tactics`).
- By default the 1st goal is
- searched. This variant can be combined with other variants presented
- here.
+ Require Import Arith.
+ .. coqtop:: all
-.. cmd:: SearchRewrite @term
+ SearchRewrite (_ + _ + _).
- This command displays the name and type of all hypothesis of the
- current goal (if any) and theorems of the current context whose
- statement’s conclusion is an equality of which one side matches the
- expression term. Holes in term are denoted by “_”.
+.. table:: Search Blacklist @string
+ :name: Search Blacklist
- .. example::
+ Specifies a set of strings used to exclude lemmas from the results of :cmd:`Search`,
+ :cmd:`SearchHead`, :cmd:`SearchPattern` and :cmd:`SearchRewrite` queries. A lemma whose
+ fully-qualified name contains any of the strings will be excluded from the
+ search results. The default blacklisted substrings are ``_subterm``, ``_subproof`` and
+ ``Private_``.
- .. coqtop:: in
+ Use the :cmd:`Add` and :cmd:`Remove` commands to update the set of
+ blacklisted strings.
- Require Import Arith.
- .. coqtop:: all
+.. _requests-to-the-environment:
- SearchRewrite (_ + _ + _).
+Requests to the environment
+-------------------------------
- .. cmdv:: SearchRewrite @term inside {+ @qualid }
+.. cmd:: Print Assumptions @smart_qualid
- This restricts the search to constructions defined in the modules
- named by the given :n:`qualid` sequence.
+ Displays all the assumptions (axioms, parameters and
+ variables) a theorem or definition depends on.
- .. cmdv:: SearchRewrite @term outside {+ @qualid }
+ The message "Closed under the global context" indicates that the theorem or
+ definition has no dependencies.
- This restricts the search to constructions not defined in the modules
- named by the given :n:`qualid` sequence.
+.. cmd:: Print Opaque Dependencies @smart_qualid
- .. cmdv:: @selector: SearchRewrite @term
+ Displays the assumptions and opaque constants that :n:`@smart_qualid` depends on.
- This specifies the goal on which to
- search hypothesis (see Section :ref:`invocation-of-tactics`).
- By default the 1st goal is
- searched. This variant can be combined with other variants presented
- here.
+.. cmd:: Print Transparent Dependencies @smart_qualid
-.. note::
+ Displays the assumptions and transparent constants that :n:`@smart_qualid` depends on.
- .. table:: Search Blacklist @string
- :name: Search Blacklist
+.. cmd:: Print All Dependencies @smart_qualid
- Specifies a set of strings used to exclude lemmas from the results of :cmd:`Search`,
- :cmd:`SearchHead`, :cmd:`SearchPattern` and :cmd:`SearchRewrite` queries. A lemma whose
- fully-qualified name contains any of the strings will be excluded from the
- search results. The default blacklisted substrings are ``_subterm``, ``_subproof`` and
- ``Private_``.
+ Displays all the assumptions and constants :n:`@smart_qualid` depends on.
- Use the :cmd:`Add @table` and :cmd:`Remove @table` commands to update the set of
- blacklisted strings.
+.. cmd:: Locate @smart_qualid
-.. cmd:: Locate @qualid
+ Displays the full name of objects from |Coq|'s various qualified namespaces such as terms,
+ modules and Ltac. It also displays notation definitions.
- This command displays the full name of objects whose name is a prefix
- of the qualified identifier :n:`@qualid`, and consequently the |Coq| module in
- which they are defined. It searches for objects from the different
- qualified namespaces of |Coq|: terms, modules, Ltac, etc.
+ If the argument is:
- .. example::
+ * :n:`@qualid` - displays the full name of objects that
+ end with :n:`@qualid`, thereby showing the module they are defined in.
+ * :n:`@string {? "%" @ident }` - displays the definition of a notation. :n:`@string`
+ can be a single token in the notation such as "`->`" or a pattern that matches the
+ notation. See :ref:`locating-notations`.
- .. coqtop:: all
+ .. todo somewhere we should list all the qualified namespaces
- Locate nat.
+.. cmd:: Locate Term @smart_qualid
- Locate Datatypes.O.
+ Like :cmd:`Locate`, but limits the search to terms
- Locate Init.Datatypes.O.
+.. cmd:: Locate Module @qualid
- Locate Coq.Init.Datatypes.O.
+ Like :cmd:`Locate`, but limits the search to modules
- Locate I.Dont.Exist.
+.. cmd:: Locate Ltac @qualid
- .. cmdv:: Locate Term @qualid
+ Like :cmd:`Locate`, but limits the search to tactics
- As Locate but restricted to terms.
+.. cmd:: Locate Library @qualid
- .. cmdv:: Locate Module @qualid
+ Displays the full name, status and file system path of the module :n:`@qualid`, whether loaded or not.
- As Locate but restricted to modules.
+.. cmd:: Locate File @string
+
+ Displays the file system path of the file ending with :n:`@string`.
+ Typically, :n:`@string` has a suffix such as ``.cmo`` or ``.vo`` or ``.v`` file, such as :n:`Nat.v`.
+
+ .. todo: also works for directory names such as "Data" (parent of Nat.v)
+ also "Data/Nat.v" works, but not a substring match
- .. cmdv:: Locate Ltac @qualid
+.. example:: Locate examples
- As Locate but restricted to tactics.
+ .. coqtop:: all
-.. seealso:: Section :ref:`locating-notations`
+ Locate nat.
+ Locate Datatypes.O.
+ Locate Init.Datatypes.O.
+ Locate Coq.Init.Datatypes.O.
+ Locate I.Dont.Exist.
.. _printing-flags:
@@ -522,35 +451,32 @@ Loading files
|Coq| offers the possibility of loading different parts of a whole
development stored in separate files. Their contents will be loaded as
if they were entered from the keyboard. This means that the loaded
-files are ASCII files containing sequences of commands for |Coq|’s
+files are text files containing sequences of commands for |Coq|’s
toplevel. This kind of file is called a *script* for |Coq|. The standard
(and default) extension of |Coq|’s script files is .v.
-.. cmd:: Load @ident
+.. cmd:: Load {? Verbose } {| @string | @ident }
- This command loads the file named :n:`ident`.v, searching successively in
+ Loads a file. If :n:`@ident` is specified, the command loads a file
+ named :n:`@ident.v`, searching successively in
each of the directories specified in the *loadpath*. (see Section
:ref:`libraries-and-filesystem`)
- Files loaded this way cannot leave proofs open, and the ``Load``
- command cannot be used inside a proof either.
-
- .. cmdv:: Load @string
-
- Loads the file denoted by the string :n:`@string`, where
- string is any complete filename. Then the `~` and .. abbreviations are
- allowed as well as shell variables. If no extension is specified, |Coq|
- will use the default extension ``.v``.
+ If :n:`@string` is specified, it must specify a complete filename.
+ `~` and .. abbreviations are
+ allowed as well as shell variables. If no extension is specified, |Coq|
+ will use the default extension ``.v``.
- .. cmdv:: Load Verbose @ident
- Load Verbose @string
+ Files loaded this way can't leave proofs open, nor can :cmd:`Load`
+ be used inside a proof.
- Display, while loading,
- the answers of |Coq| to each command (including tactics) contained in
- the loaded file.
+ We discourage the use of :cmd:`Load`; use :cmd:`Require` instead.
+ :cmd:`Require` loads `.vo` files that were previously
+ compiled from `.v` files.
- .. seealso:: Section :ref:`controlling-display`.
+ :n:`Verbose` displays the |Coq| output for each command and tactic
+ in the loaded file, as if the commands and tactics were entered interactively.
.. exn:: Can’t find file @ident on loadpath.
:undocumented:
@@ -568,67 +494,50 @@ Compiled files
This section describes the commands used to load compiled files (see
Chapter :ref:`thecoqcommands` for documentation on how to compile a file). A compiled
-file is a particular case of module called *library file*.
-
-
-.. cmd:: Require @qualid
-
- This command looks in the loadpath for a file containing module :n:`@qualid`
- and adds the corresponding module to the environment of |Coq|. As
- library files have dependencies in other library files, the command
- :cmd:`Require` :n:`@qualid` recursively requires all library files the module
- qualid depends on and adds the corresponding modules to the
- environment of |Coq| too. |Coq| assumes that the compiled files have been
- produced by a valid |Coq| compiler and their contents are then not
- replayed nor rechecked.
-
- To locate the file in the file system, :n:`@qualid` is decomposed under the
- form :n:`dirpath.@ident` and the file :n:`@ident.vo` is searched in the physical
- directory of the file system that is mapped in |Coq| loadpath to the
- logical path dirpath (see Section :ref:`libraries-and-filesystem`). The mapping between
- physical directories and logical names at the time of requiring the
- file must be consistent with the mapping used to compile the file. If
- several files match, one of them is picked in an unspecified fashion.
+file is a particular case of a module called a *library file*.
+
+.. cmd:: Require {? {| Import | Export } } {+ @qualid }
+ :name: Require; Require Import; Require Export
- .. cmdv:: Require Import @qualid
- :name: Require Import
+ Loads compiled modules into the |Coq| environment. For each :n:`@qualid`, which has the form
+ :n:`{* @ident__prefix . } @ident`, the command searches for the logical name represented
+ by the :n:`@ident__prefix`\s and loads the compiled file :n:`@ident.vo` from the associated
+ filesystem directory.
- This loads and declares the module :n:`@qualid`
- and its dependencies then imports the contents of :n:`@qualid` as described
- 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`, 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.
+ The process is applied recursively to all the loaded files;
+ if they contain :cmd:`Require` commands, those commands are executed as well.
+ The compiled files must have been compiled with the same version of |Coq|.
+ The compiled files are neither replayed nor rechecked.
- .. cmdv:: Require Export @qualid
- :name: Require Export
+ * :n:`Import` - additionally does an :cmd:`Import` on the loaded module, making components defined
+ in the module available by their short names
+ * :n:`Export` - additionally does an :cmd:`Export` on the loaded module, making components defined
+ in the module available by their short names *and* marking them to be exported by the current
+ module
- This command acts as :cmd:`Require Import` :n:`@qualid`,
- but if a further module, say `A`, contains a command :cmd:`Require Export` `B`,
- then the command :cmd:`Require Import` `A` also imports the module `B.`
+ If the required module has already been loaded, :n:`Import` and :n:`Export` make the command
+ equivalent to :cmd:`Import` or :cmd:`Export`.
+
+ The loadpath must contain the same mapping used to compile the file
+ (see Section :ref:`libraries-and-filesystem`). If
+ several files match, one of them is picked in an unspecified fashion.
+ Therefore, library authors should use a unique name for each module and
+ users are encouraged to use fully-qualified names
+ or the :cmd:`From ... Require` command to load files.
- .. cmdv:: Require {| Import | Export } {+ @qualid }
- This loads the
- modules named by the :token:`qualid` sequence and their recursive
- dependencies. If
- ``Import`` or ``Export`` is given, it also imports these modules and
- all the recursive dependencies that were marked or transitively marked
- as ``Export``.
+ .. todo common user error on dirpaths see https://github.com/coq/coq/pull/11961#discussion_r402852390
- .. cmdv:: From @dirpath Require @qualid
- :name: From ... Require ...
+ .. cmd:: From @dirpath Require {? {| Import | Export } } {+ @qualid }
+ :name: From ... Require
- This command acts as :cmd:`Require`, but picks
- any library whose absolute name is of the form :n:`@dirpath.@dirpath’.@qualid`
- for some :n:`@dirpath’`. This is useful to ensure that the :token:`qualid` library
- comes from a given package by making explicit its absolute root.
+ Works like :cmd:`Require`, but loads, for each :n:`@qualid`,
+ the library whose fully-qualified name matches :n:`@dirpath.{* @ident . }@qualid`
+ for some :n:`{* @ident . }`. This is useful to ensure that the :n:`@qualid` library
+ comes from a particular package.
- .. exn:: Cannot load qualid: no physical path bound to dirpath.
+ .. exn:: Cannot load @qualid: no physical path bound to @dirpath.
:undocumented:
.. exn:: Cannot find library foo in loadpath.
@@ -637,7 +546,7 @@ file is a particular case of module called *library file*.
file foo.vo. Either foo.v exists but is not compiled or foo.vo is in a
directory which is not in your LoadPath (see Section :ref:`libraries-and-filesystem`).
- .. exn:: Compiled library @ident.vo makes inconsistent assumptions over library qualid.
+ .. exn:: Compiled library @ident.vo makes inconsistent assumptions over library @qualid.
The command tried to load library file :n:`@ident`.vo that
depends on some specific version of library :n:`@qualid` which is not the
@@ -651,13 +560,13 @@ file is a particular case of module called *library file*.
|Coq| compiled module, or it was compiled with an incompatible
version of |Coq|.
- .. exn:: The file :n:`@ident.vo` contains library dirpath and not library dirpath’.
-
- The library file :n:`@dirpath’` is indirectly required by the
- ``Require`` command but it is bound in the current loadpath to the
- file :n:`@ident.vo` which was bound to a different library name :token:`dirpath` at
- the time it was compiled.
+ .. exn:: The file @ident.vo contains library @qualid__1 and not library @qualid__2.
+ The library :n:`@qualid__2` is indirectly required by a :cmd:`Require` or
+ :cmd:`From ... Require` command. The loadpath maps :n:`@qualid__2` to :n:`@ident.vo`,
+ which was compiled using a loadpath that bound it to :n:`@qualid__1`. Usually
+ the appropriate solution is to recompile :n:`@ident.v` using the correct loadpath.
+ See :ref:`libraries-and-filesystem`.
.. warn:: Require inside a module is deprecated and strongly discouraged. You can Require a module at toplevel and optionally Import it inside another one.
@@ -668,33 +577,26 @@ file is a particular case of module called *library file*.
.. cmd:: Print Libraries
This command displays the list of library files loaded in the
- current |Coq| session. For each of these libraries, it also tells if it
- is imported.
-
+ current |Coq| session.
.. cmd:: Declare ML Module {+ @string }
- This commands loads the OCaml compiled files
- with names given by the :token:`string` sequence
- (dynamic link). It is mainly used to load tactics dynamically. The
- files are searched into the current OCaml loadpath (see the
- command :cmd:`Add ML Path`).
- Loading of OCaml files is only possible under the bytecode version of
- ``coqtop`` (i.e. ``coqtop`` called with option ``-byte``, see chapter
- :ref:`thecoqcommands`), or when |Coq| has been compiled with a
- version of OCaml that supports native Dynlink (≥ 3.11).
+ This commands dynamically loads OCaml compiled code from
+ a :n:`.mllib` file.
+ It is used to load plugins dynamically. The
+ files must be accessible in the current OCaml loadpath (see the
+ command :cmd:`Add ML Path`). The :n:`.mllib` suffix may be omitted.
- .. cmdv:: Local Declare ML Module {+ @string }
+ This command is reserved for plugin developers, who should provide
+ a .v file containing the command. Users of the plugins will then generally
+ load the .v file.
- This variant is not exported to the modules that import the module
- where they occur, even if outside a section.
+ This command supports the :attr:`local` attribute. If present,
+ the listed files are not exported, even if they're outside a section.
.. exn:: File not found on loadpath: @string.
:undocumented:
- .. exn:: Loading of ML object file forbidden in a native Coq.
- :undocumented:
-
.. cmd:: Print ML Modules
@@ -709,7 +611,7 @@ Loadpath
------------
Loadpaths are preferably managed using |Coq| command line options (see
-Section `libraries-and-filesystem`) but there remain vernacular commands to manage them
+Section :ref:`libraries-and-filesystem`) but there remain vernacular commands to manage them
for practical purposes. Such commands are only meant to be issued in
the toplevel, and using them in source files is discouraged.
@@ -719,22 +621,27 @@ the toplevel, and using them in source files is discouraged.
This command displays the current working directory.
-.. cmd:: Cd @string
+.. cmd:: Cd {? @string }
- This command changes the current directory according to :token:`string` which
- can be any valid path.
+ If :n:`@string` is specified, changes the current directory according to :token:`string` which
+ can be any valid path. Otherwise, it displays the current directory.
- .. cmdv:: Cd
- Is equivalent to Pwd.
+.. cmd:: Add LoadPath @string as @dirpath
+ .. insertprodn dirpath dirpath
-.. cmd:: Add LoadPath @string as @dirpath
+ .. prodn::
+ dirpath ::= {* @ident . } @ident
This command is equivalent to the command line option
- :n:`-Q @string @dirpath`. It adds the physical directory string to the current
- |Coq| loadpath and maps it to the logical directory dirpath.
+ :n:`-Q @string @dirpath`. It adds a mapping to the loadpath from
+ the logical name :n:`@dirpath` to the file system directory :n:`@string`.
+ * :n:`@dirpath` is a prefix of a module name. The module name hierarchy
+ follows the file system hierarchy. On Linux, for example, the prefix
+ `A.B.C` maps to the directory :n:`@string/B/C`. Avoid using spaces after a `.` in the
+ path because the parser will interpret that as the end of a command or tactic.
.. cmd:: Add Rec LoadPath @string as @dirpath
@@ -748,42 +655,24 @@ the toplevel, and using them in source files is discouraged.
This command removes the path :n:`@string` from the current |Coq| loadpath.
-.. cmd:: Print LoadPath
-
- This command displays the current |Coq| loadpath.
-
- .. cmdv:: Print LoadPath @dirpath
+.. cmd:: Print LoadPath {? @dirpath }
- Works as :cmd:`Print LoadPath` but displays only
- the paths that extend the :n:`@dirpath` prefix.
+ This command displays the current |Coq| loadpath. If :n:`@dirpath` is specified,
+ displays only the paths that extend that prefix.
.. cmd:: Add ML Path @string
This command adds the path :n:`@string` to the current OCaml
- loadpath (see the command `Declare ML Module`` in Section :ref:`compiled-files`).
+ loadpath (cf. :cmd:`Declare ML Module`).
-.. cmd:: Print ML Path @string
+.. cmd:: Print ML Path
This command displays the current OCaml loadpath. This
command makes sense only under the bytecode version of ``coqtop``, i.e.
using option ``-byte``
- (see the command Declare ML Module in Section :ref:`compiled-files`).
-
-.. _locate-file:
-
-.. cmd:: Locate File @string
-
- This command displays the location of file string in the current
- loadpath. Typically, string is a ``.cmo`` or ``.vo`` or ``.v`` file.
-
-
-.. cmd:: Locate Library @dirpath
-
- This command gives the status of the |Coq| module dirpath. It tells if
- the module is loaded and if not searches in the load path for a module
- of logical name :n:`@dirpath`.
+ (cf. :cmd:`Declare ML Module`).
.. _backtracking:
@@ -806,30 +695,22 @@ interactively, they cannot be part of a vernacular file loaded via
.. exn:: @ident: no such entry.
:undocumented:
- .. cmdv:: Reset Initial
-
- Goes back to the initial state, just after the start
- of the interactive session.
-
+.. cmd:: Reset Initial
-.. cmd:: Back
+ Goes back to the initial state, just after the start
+ of the interactive session.
- This command undoes all the effects of the last vernacular command.
- Commands read from a vernacular file via a :cmd:`Load` are considered as a
- single command. Proof management commands are also handled by this
- command (see Chapter :ref:`proofhandling`). For that, Back may have to undo more than
- one command in order to reach a state where the proof management
- information is available. For instance, when the last command is a
- :cmd:`Qed`, the management information about the closed proof has been
- discarded. In this case, :cmd:`Back` will then undo all the proof steps up to
- the statement of this proof.
- .. cmdv:: Back @num
+.. cmd:: Back {? @num }
- Undo :n:`@num` vernacular commands. As for Back, some extra
- commands may be undone in order to reach an adequate state. For
- instance Back :n:`@num` will not re-enter a closed proof, but rather go just
- before that proof.
+ Undoes all the effects of the last :n:`@num @sentence`\s. If
+ :n:`@num` is not specified, the command undoes one sentence.
+ Sentences read from a `.v` file via a :cmd:`Load` are considered a
+ single sentence. While :cmd:`Back` can undo tactics and commands executed
+ within proof mode, once you exit proof mode, such as with :cmd:`Qed`, all
+ the statements executed within are thereafter considered a single sentence.
+ :cmd:`Back` immediately following :cmd:`Qed` gets you back to the state
+ just after the statement of the proof.
.. exn:: Invalid backtrack.
@@ -850,18 +731,17 @@ interactively, they cannot be part of a vernacular file loaded via
Quitting and debugging
--------------------------
-
.. cmd:: Quit
- This command permits to quit |Coq|.
+ Causes |Coq| to exit. Valid only in coqtop.
.. cmd:: Drop
- This is used mostly as a debug facility by |Coq|’s implementers and does
- not concern the casual user. This command permits to leave |Coq|
- temporarily and enter the OCaml toplevel. The OCaml
- command:
+ This command temporarily enters the OCaml toplevel.
+ It is a debug facility used by |Coq|’s implementers. Valid only in the
+ bytecode version of coqtop.
+ The OCaml command:
::
@@ -886,49 +766,53 @@ Quitting and debugging
(see Section `customization-by-environment-variables`).
-.. TODO : command is not a syntax entry
-
-.. cmd:: Time @command
+.. cmd:: Time @sentence
- This command executes the vernacular command :n:`@command` and displays the
+ Executes :n:`@sentence` and displays the
time needed to execute it.
-.. cmd:: Redirect @string @command
+.. cmd:: Redirect @string @sentence
- This command executes the vernacular command :n:`@command`, redirecting its
- output to ":n:`@string`.out".
+ Executes :n:`@sentence`, redirecting its
+ output to the file ":n:`@string`.out".
-.. cmd:: Timeout @num @command
+.. cmd:: Timeout @num @sentence
- This command executes the vernacular command :n:`@command`. If the command
- has not terminated after the time specified by the :n:`@num` (time
- expressed in seconds), then it is interrupted and an error message is
+ Executes :n:`@sentence`. If the operation
+ has not terminated after :n:`@num` seconds, then it is interrupted and an error message is
displayed.
.. opt:: Default Timeout @num
:name: Default Timeout
- This option controls a default timeout for subsequent commands, as if they
- were passed to a :cmd:`Timeout` command. Commands already starting by a
- :cmd:`Timeout` are unaffected.
+ If set, each :n:`@sentence` is treated as if it was prefixed with :cmd:`Timeout` :n:`@num`,
+ except for :cmd:`Timeout` commands themselves. If unset,
+ no timeout is applied.
-.. cmd:: Fail @command
+.. cmd:: Fail @sentence
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
+ command or a tactic fails. If :n:`@sentence` fails, then
+ :n:`Fail @sentence` succeeds (except for
+ critical errors, such as "stack overflow"), without changing the
+ proof state. In interactive mode, the system prints a message
confirming the failure.
.. exn:: The command has not failed!
- If the given :n:`@command` succeeds, then :n:`Fail @command`
+ If the given :n:`@command` succeeds, then :n:`Fail @sentence`
fails with this error message.
+.. note::
+
+ :cmd:`Time`, :cmd:`Redirect`, :cmd:`Timeout` and :cmd:`Fail` are
+ :production:`control_command`\s. For these commands, attributes and goal
+ selectors, when specified, are part of the :n:`@sentence` argument, and thus come after
+ the control command prefix and before the inner command or tactic. For
+ example: `Time #[ local ] Definition foo := 0.` or `Fail Timeout 10 all: auto.`
.. _controlling-display:
@@ -1010,13 +894,16 @@ as numbers, and for reflection-based tactics. The commands to fine-
tune the reduction strategies and the lazy conversion algorithm are
described first.
-.. cmd:: Opaque {+ @qualid }
+.. cmd:: Opaque {+ @smart_qualid }
+
+ This command accepts the :attr:`global` attribute. By default, the scope
+ of :cmd:`Opaque` is limited to the current section or module.
This command has an effect on unfoldable constants, i.e. on constants
defined by :cmd:`Definition` or :cmd:`Let` (with an explicit body), or by a command
assimilated to a definition such as :cmd:`Fixpoint`, :cmd:`Program Definition`, etc,
or by a proof ended by :cmd:`Defined`. The command tells not to unfold the
- constants in the :n:`@qualid` sequence in tactics using δ-conversion (unfolding
+ constants in the :n:`@smart_qualid` sequence in tactics using δ-conversion (unfolding
a constant is replacing it by its definition).
:cmd:`Opaque` has also an effect on the conversion algorithm of |Coq|, telling
@@ -1024,24 +911,15 @@ described first.
has to check the conversion (see Section :ref:`conversion-rules`) of two distinct
applied constants.
- .. cmdv:: Global Opaque {+ @qualid }
- :name: Global Opaque
-
- The scope of :cmd:`Opaque` is limited to the current section, or current
- file, unless the variant :cmd:`Global Opaque` is used.
-
.. seealso::
Sections :ref:`performingcomputations`, :ref:`tactics-automating`,
:ref:`proof-editing-mode`
- .. exn:: The reference @qualid was not found in the current environment.
+.. cmd:: Transparent {+ @smart_qualid }
- There is no constant referred by :n:`@qualid` in the environment.
- Nevertheless, if you asked :cmd:`Opaque` `foo` `bar` and if `bar` does
- not exist, `foo` is set opaque.
-
-.. cmd:: Transparent {+ @qualid }
+ This command accepts the :attr:`global` attribute. By default, the scope
+ of :cmd:`Transparent` is limited to the current section or module.
This command is the converse of :cmd:`Opaque` and it applies on unfoldable
constants to restore their unfoldability after an Opaque command.
@@ -1054,16 +932,9 @@ described first.
the usual defined constants, whose actual values are of course
relevant in general.
- .. cmdv:: Global Transparent {+ @qualid }
- :name: Global Transparent
-
- The scope of Transparent is limited to the current section, or current
- file, unless the variant :cmd:`Global Transparent` is
- used.
-
.. exn:: The reference @qualid was not found in the current environment.
- There is no constant referred by :n:`@qualid` in the environment.
+ There is no constant named :n:`@qualid` in the environment.
.. seealso::
@@ -1072,63 +943,66 @@ described first.
.. _vernac-strategy:
-.. cmd:: Strategy @level [ {+ @qualid } ]
+.. cmd:: Strategy {+ @strategy_level [ {+ @smart_qualid } ] }
+
+ .. insertprodn strategy_level strategy_level
- This command generalizes the behavior of Opaque and Transparent
+ .. prodn::
+ strategy_level ::= opaque
+ | @int
+ | expand
+ | transparent
+
+ This command accepts the :attr:`local` attribute, which limits its effect
+ to the current section or module, in which case the section and module
+ behavior is the same as :cmd:`Opaque` and :cmd:`Transparent` (without :attr:`global`).
+
+ This command generalizes the behavior of the :cmd:`Opaque` and :cmd:`Transparent`
commands. It is used to fine-tune the strategy for unfolding
constants, both at the tactic level and at the kernel level. This
- command associates a level to the qualified names in the :n:`@qualid`
+ command associates a :n:`@strategy_level` with the qualified names in the :n:`@smart_qualid`
sequence. Whenever two
expressions with two distinct head constants are compared (for
instance, this comparison can be triggered by a type cast), the one
with lower level is expanded first. In case of a tie, the second one
(appearing in the cast type) is expanded.
- .. prodn:: level ::= {| opaque | @num | expand }
-
Levels can be one of the following (higher to lower):
+ ``opaque`` : level of opaque constants. They cannot be expanded by
tactics (behaves like +∞, see next item).
- + :n:`@num` : levels indexed by an integer. Level 0 corresponds to the
+ + :n:`@int` : levels indexed by an integer. Level 0 corresponds to the
default behavior, which corresponds to transparent constants. This
- level can also be referred to as transparent. Negative levels
+ level can also be referred to as ``transparent``. Negative levels
correspond to constants to be expanded before normal transparent
constants, while positive levels correspond to constants to be
expanded after normal transparent constants.
+ ``expand`` : level of constants that should be expanded first (behaves
like −∞)
+ + ``transparent`` : Equivalent to level 0
- .. cmdv:: Local Strategy @level [ {+ @qualid } ]
-
- These directives survive section and module closure, unless the
- command is prefixed by ``Local``. In the latter case, the behavior
- regarding sections and modules is the same as for the :cmd:`Transparent` and
- :cmd:`Opaque` commands.
+.. cmd:: Print Strategy @smart_qualid
-
-.. cmd:: Print Strategy @qualid
-
- This command prints the strategy currently associated to :n:`@qualid`. It
- fails if :n:`@qualid` is not an unfoldable reference, that is, neither a
+ This command prints the strategy currently associated with :n:`@smart_qualid`. It
+ fails if :n:`@smart_qualid` is not an unfoldable reference, that is, neither a
variable nor a constant.
.. exn:: The reference is not unfoldable.
:undocumented:
- .. cmdv:: Print Strategies
+.. cmd:: Print Strategies
- Print all the currently non-transparent strategies.
+ Print all the currently non-transparent strategies.
.. cmd:: Declare Reduction @ident := @red_expr
- This command allows giving a short name to a reduction expression, for
+ Declares a short name for the reduction expression :n:`@red_expr`, for
instance ``lazy beta delta [foo bar]``. This short name can then be used
- in :n:`Eval @ident in` or ``eval`` directives. This command
- accepts the
- ``Local`` modifier, for discarding this reduction name at the end of the
- file or module. For the moment, the name is not qualified. In
+ in :n:`Eval @ident in` or ``eval`` constructs. This command
+ accepts the :attr:`local` attribute, which indicates that the reduction
+ will be discarded at the end of the
+ file or module. The name is not qualified. In
particular declaring the same name in several modules or in several
functor applications will be rejected if these declarations are not
local. The name :n:`@ident` cannot be used directly as an Ltac tactic, but
@@ -1222,6 +1096,8 @@ Controlling Typing Flags
Print the status of the three typing flags: guard checking, positivity checking
and universe checking.
+See also :flag:`Cumulative StrictProp` in the |SProp| chapter.
+
.. example::
.. coqtop:: all reset
@@ -1274,14 +1150,15 @@ in support libraries of plug-ins.
.. _exposing-constants-to-ocaml-libraries:
Exposing constants to OCaml libraries
-````````````````````````````````````````````````````````````````
+`````````````````````````````````````
.. cmd:: Register @qualid__1 as @qualid__2
- This command exposes the constant :n:`@qualid__1` to OCaml libraries under
- the name :n:`@qualid__2`. This constant can then be dynamically located
- calling :n:`Coqlib.lib_ref "@qualid__2"`; i.e., there is no need to known
- where is the constant defined (file, module, library, etc.).
+ Makes the constant :n:`@qualid__1` accessible to OCaml libraries under
+ the name :n:`@qualid__2`. The constant can then be dynamically located
+ in OCaml code by
+ calling :n:`Coqlib.lib_ref "@qualid__2"`. The OCaml code doesn't need
+ to know where the constant is defined (what file, module, library, etc.).
As a special case, when the first segment of :n:`@qualid__2` is :g:`kernel`,
the constant is exposed to the kernel. For instance, the `Int63` module
@@ -1291,27 +1168,41 @@ Exposing constants to OCaml libraries
Register bool as kernel.ind_bool.
- This makes the kernel aware of what is the type of boolean values. This
- information is used for instance to define the return type of the
- :g:`#int63_eq` primitive.
+ This makes the kernel aware of the `bool` type, which is used, for example,
+ to define the return type of the :g:`#int63_eq` primitive.
.. seealso:: :ref:`primitive-integers`
Inlining hints for the fast reduction machines
-````````````````````````````````````````````````````````````````
+``````````````````````````````````````````````
.. cmd:: Register Inline @qualid
- This command gives as a hint to the reduction machines (VM and native) that
+ Gives a hint to the reduction machines (VM and native) that
the body of the constant :n:`@qualid` should be inlined in the generated code.
Registering primitive operations
````````````````````````````````
-.. cmd:: Primitive @ident__1 := #@ident__2.
+.. cmd:: Primitive @ident {? : @term } := #@ident__prim
+
+ Makes the primitive type or primitive operator :n:`#@ident__prim` defined in OCaml
+ accessible in |Coq| commands and tactics.
+ For internal use by implementors of |Coq|'s standard library or standard library
+ replacements. No space is allowed after the `#`. Invalid values give a syntax
+ error.
+
+ For example, the standard library files `Int63.v` and `PrimFloat.v` use :cmd:`Primitive`
+ to support, respectively, the features described in :ref:`primitive-integers` and
+ :ref:`primitive-floats`.
+
+ The types associated with an operator must be declared to the kernel before declaring operations
+ that use the type. Do this with :cmd:`Primitive` for primitive types and
+ :cmd:`Register` with the :g:`kernel` prefix for other types. For example,
+ in `Int63.v`, `#int63_type` must be declared before the associated operations.
+
+ .. exn:: The type @ident must be registered before this construction can be typechecked.
+ :undocumented:
- Declares :n:`@ident__1` as the primitive operator :n:`#@ident__2`. When
- running this command, the type of the primitive should be already known by
- the kernel (this is achieved through this command for primitive types and
- through the :cmd:`Register` command with the :g:`kernel` name-space for other
- types).
+ The type must be defined with :cmd:`Primitive` command before this
+ :cmd:`Primitive` command (declaring an operation using the type) will succeed.
diff --git a/doc/sphinx/user-extensions/proof-schemes.rst b/doc/sphinx/user-extensions/proof-schemes.rst
index 34197c4fcf..e05be7c2c2 100644
--- a/doc/sphinx/user-extensions/proof-schemes.rst
+++ b/doc/sphinx/user-extensions/proof-schemes.rst
@@ -190,146 +190,7 @@ Combined Scheme
Check tree_forest_mutrect.
-.. _functional-scheme:
-
-Generation of induction principles with ``Functional`` ``Scheme``
------------------------------------------------------------------
-
-
-.. cmd:: Functional Scheme @ident__0 := Induction for @ident' Sort @sort {* with @ident__i := Induction for @ident__i' Sort @sort}
-
- This command is a high-level experimental tool for
- generating automatically induction principles corresponding to
- (possibly mutually recursive) functions. First, it must be made
- available via ``Require Import FunInd``.
- Each :n:`@ident__i` is a different mutually defined function
- name (the names must be in the same order as when they were defined). This
- command generates the induction principle for each :n:`@ident__i`, following
- the recursive structure and case analyses of the corresponding function
- :n:`@ident__i'`.
-
-.. warning::
-
- There is a difference between induction schemes generated by the command
- :cmd:`Functional Scheme` and these generated by the :cmd:`Function`. Indeed,
- :cmd:`Function` generally produces smaller principles that are closer to how
- a user would implement them. See :ref:`advanced-recursive-functions` for details.
-
-.. example::
-
- Induction scheme for div2.
-
- We define the function div2 as follows:
-
- .. coqtop:: all
-
- Require Import FunInd.
- Require Import Arith.
-
- Fixpoint div2 (n:nat) : nat :=
- match n with
- | O => 0
- | S O => 0
- | S (S n') => S (div2 n')
- end.
-
- The definition of a principle of induction corresponding to the
- recursive structure of `div2` is defined by the command:
-
- .. coqtop:: all
-
- Functional Scheme div2_ind := Induction for div2 Sort Prop.
-
- You may now look at the type of div2_ind:
-
- .. coqtop:: all
-
- Check div2_ind.
-
- We can now prove the following lemma using this principle:
-
- .. coqtop:: all
-
- Lemma div2_le' : forall n:nat, div2 n <= n.
- intro n.
- pattern n, (div2 n).
- apply div2_ind; intros.
- auto with arith.
- auto with arith.
- simpl; auto with arith.
- Qed.
-
- We can use directly the functional induction (:tacn:`function induction`) tactic instead
- of the pattern/apply trick:
-
- .. coqtop:: all
-
- Reset div2_le'.
-
- Lemma div2_le : forall n:nat, div2 n <= n.
- intro n.
- functional induction (div2 n).
- auto with arith.
- auto with arith.
- auto with arith.
- Qed.
-
-.. example::
-
- Induction scheme for tree_size.
-
- We define trees by the following mutual inductive type:
-
- .. original LaTeX had "Variable" instead of "Axiom", which generates an ugly warning
-
- .. coqtop:: reset all
-
- Axiom A : Set.
-
- Inductive tree : Set :=
- node : A -> forest -> tree
- with forest : Set :=
- | empty : forest
- | cons : tree -> forest -> forest.
-
- We define the function tree_size that computes the size of a tree or a
- forest. Note that we use ``Function`` which generally produces better
- principles.
-
- .. coqtop:: all
-
- Require Import FunInd.
-
- Function tree_size (t:tree) : nat :=
- match t with
- | node A f => S (forest_size f)
- end
- with forest_size (f:forest) : nat :=
- match f with
- | empty => 0
- | cons t f' => (tree_size t + forest_size f')
- end.
-
- Notice that the induction principles ``tree_size_ind`` and ``forest_size_ind``
- generated by ``Function`` are not mutual.
-
- .. coqtop:: all
-
- Check tree_size_ind.
-
- Mutual induction principles following the recursive structure of ``tree_size``
- and ``forest_size`` can be generated by the following command:
-
- .. coqtop:: all
-
- Functional Scheme tree_size_ind2 := Induction for tree_size Sort Prop
- with forest_size_ind2 := Induction for forest_size Sort Prop.
-
- You may now look at the type of `tree_size_ind2`:
-
- .. coqtop:: all
-
- Check tree_size_ind2.
+.. seealso:: :ref:`functional-scheme`
.. _derive-inversion:
diff --git a/doc/sphinx/user-extensions/syntax-extensions.rst b/doc/sphinx/user-extensions/syntax-extensions.rst
index 669975ba7e..512378b9fc 100644
--- a/doc/sphinx/user-extensions/syntax-extensions.rst
+++ b/doc/sphinx/user-extensions/syntax-extensions.rst
@@ -902,7 +902,7 @@ Syntax of notations
+++++++++++++++++++
The different syntactic forms taken by the commands declaring
-notations are given below. The optional :production:`scope` is described in
+notations are given below. The optional :n:`@scope` is described in
:ref:`Scopes`.
.. productionlist:: coq
@@ -1001,6 +1001,11 @@ Notations disappear when a section is closed.
Interpretation scopes
----------------------
+ .. insertprodn scope scope
+
+ .. prodn::
+ scope ::= @ident
+
An *interpretation scope* is a set of notations for terms with their
interpretations. Interpretation scopes provide a weak, purely
syntactical form of notation overloading: the same notation, for
@@ -1090,7 +1095,7 @@ Local opening of an interpretation scope
It is possible to locally extend the interpretation scope stack using the syntax
:n:`(@term)%@ident` (or simply :n:`@term%@ident` for atomic terms), where :token:`ident` is a
-special identifier called *delimiting key* and bound to a given scope.
+special identifier called a *delimiting key* and bound to a given scope.
In such a situation, the term term, and all its subterms, are
interpreted in the scope stack extended with the scope bound to :token:`ident`.
diff --git a/doc/sphinx/using/libraries/funind.rst b/doc/sphinx/using/libraries/funind.rst
new file mode 100644
index 0000000000..40f9eedcf0
--- /dev/null
+++ b/doc/sphinx/using/libraries/funind.rst
@@ -0,0 +1,400 @@
+Functional induction
+====================
+
+.. _advanced-recursive-functions:
+
+Advanced recursive functions
+----------------------------
+
+The following command is available when the ``FunInd`` library has been loaded via ``Require Import FunInd``:
+
+.. cmd:: Function @fix_definition {* with @fix_definition }
+
+ 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:`functional induction`) and its fixpoint equality.
+ 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. 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.
+
+ :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:`functional 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::
+
+ To obtain the right principle, it is better to put rigid
+ parameters of the function as first arguments. For example it is
+ better to define plus like this:
+
+ .. coqtop:: reset none
+
+ Require Import FunInd.
+
+ .. coqtop:: all
+
+ Function plus (m n : nat) {struct n} : nat :=
+ match n with
+ | 0 => m
+ | S p => S (plus m p)
+ end.
+
+ than like this:
+
+ .. coqtop:: reset none
+
+ Require Import FunInd.
+
+ .. coqtop:: all
+
+ Function plus (n m : nat) {struct n} : nat :=
+ match n with
+ | 0 => m
+ | S p => S (plus p m)
+ end.
+
+
+*Limitations*
+
+:token:`term` must be built as a *pure pattern matching tree* (:g:`match … with`)
+with applications only *at the end* of each branch.
+
+: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`:
+
+.. coqtop:: none
+
+ Require List.
+ Import List.ListNotations.
+
+.. coqtop:: all fail
+
+ Function wrong (C:nat) : nat :=
+ List.hd 0 (List.map wrong (C::nil)).
+
+For now, dependent cases are not treated for non structurally
+terminating functions.
+
+.. exn:: The recursive argument must be specified.
+ :undocumented:
+
+.. exn:: No argument name @ident.
+ :undocumented:
+
+.. exn:: Cannot use mutual definition with well-founded recursion or measure.
+ :undocumented:
+
+.. warn:: Cannot define graph for @ident.
+
+ The generation of the graph relation (:n:`R_@ident`) used to compute the induction scheme of ident
+ raised a typing error. Only :token:`ident` is defined; the induction scheme
+ will not be generated. This error happens generally when:
+
+ - the definition uses pattern matching on dependent types,
+ 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.
+
+ The generation of the graph relation (:n:`R_@ident`) succeeded but the induction principle
+ could not be built. Only :token:`ident` is defined. Please report.
+
+.. warn:: Cannot build functional inversion principle.
+
+ :tacn:`functional inversion` will not be available for the function.
+
+Tactics
+-------
+
+.. tacn:: functional induction (@qualid {+ @term})
+ :name: functional induction
+
+ The tactic functional induction performs case analysis and induction
+ following the definition of a function. It makes use of a principle
+ generated by :cmd:`Function` or :cmd:`Functional Scheme`.
+ Note that this tactic is only available after a ``Require Import FunInd``.
+
+ .. example::
+
+ .. coqtop:: reset all
+
+ Require Import FunInd.
+ Functional Scheme minus_ind := Induction for minus Sort Prop.
+ Check minus_ind.
+ Lemma le_minus (n m:nat) : n - m <= n.
+ functional induction (minus n m) using minus_ind; simpl; auto.
+ Qed.
+
+ .. note::
+ :n:`(@qualid {+ @term})` must be a correct full application
+ of :n:`@qualid`. In particular, the rules for implicit arguments are the
+ same as usual. For example use :n:`@qualid` if you want to write implicit
+ arguments explicitly.
+
+ .. note::
+ Parentheses around :n:`@qualid {+ @term}` are not mandatory and can be skipped.
+
+ .. note::
+ :n:`functional induction (f x1 x2 x3)` is actually a wrapper for
+ :n:`induction x1, x2, x3, (f x1 x2 x3) using @qualid` followed by a cleaning
+ phase, where :n:`@qualid` is the induction principle registered for :g:`f`
+ (by the :cmd:`Function` or :cmd:`Functional Scheme` command)
+ corresponding to the sort of the goal. Therefore
+ :tacn:`functional induction` may fail if the induction scheme :n:`@qualid` is not
+ defined.
+
+ .. note::
+ There is a difference between obtaining an induction scheme
+ for a function by using :cmd:`Function`
+ and by using :cmd:`Functional Scheme` after a normal definition using
+ :cmd:`Fixpoint` or :cmd:`Definition`.
+
+ .. exn:: Cannot find induction information on @qualid.
+ :undocumented:
+
+ .. exn:: Not the right number of induction arguments.
+ :undocumented:
+
+ .. tacv:: functional induction (@qualid {+ @term}) as @simple_intropattern using @term with @bindings_list
+
+ Similarly to :tacn:`induction` and :tacn:`elim`, this allows giving
+ explicitly the name of the introduced variables, the induction principle, and
+ the values of dependent premises of the elimination scheme, including
+ *predicates* for mutual induction when :n:`@qualid` is part of a mutually
+ recursive definition.
+
+.. tacn:: functional inversion @ident
+ :name: functional inversion
+
+ :tacn:`functional inversion` is a tactic that performs inversion on hypothesis
+ :n:`@ident` of the form :n:`@qualid {+ @term} = @term` or :n:`@term = @qualid
+ {+ @term}` where :n:`@qualid` must have been defined using :cmd:`Function`.
+ Note that this tactic is only available after a ``Require Import FunInd``.
+
+ .. exn:: Hypothesis @ident must contain at least one Function.
+ :undocumented:
+
+ .. exn:: Cannot find inversion information for hypothesis @ident.
+
+ This error may be raised when some inversion lemma failed to be generated by
+ Function.
+
+
+ .. tacv:: functional inversion @num
+
+ This does the same thing as :n:`intros until @num` followed by
+ :n:`functional inversion @ident` where :token:`ident` is the
+ identifier for the last introduced hypothesis.
+
+ .. tacv:: functional inversion @ident @qualid
+ functional inversion @num @qualid
+
+ If the hypothesis :token:`ident` (or :token:`num`) has a type of the form
+ :n:`@qualid__1 {+ @term__i } = @qualid__2 {+ @term__j }` where
+ :n:`@qualid__1` and :n:`@qualid__2` are valid candidates to
+ functional inversion, this variant allows choosing which :token:`qualid`
+ is inverted.
+
+.. _functional-scheme:
+
+Generation of induction principles with ``Functional`` ``Scheme``
+-----------------------------------------------------------------
+
+
+.. cmd:: Functional Scheme @ident__0 := Induction for @ident' Sort @sort {* with @ident__i := Induction for @ident__i' Sort @sort}
+
+ This command is a high-level experimental tool for
+ generating automatically induction principles corresponding to
+ (possibly mutually recursive) functions. First, it must be made
+ available via ``Require Import FunInd``.
+ Each :n:`@ident__i` is a different mutually defined function
+ name (the names must be in the same order as when they were defined). This
+ command generates the induction principle for each :n:`@ident__i`, following
+ the recursive structure and case analyses of the corresponding function
+ :n:`@ident__i'`.
+
+.. warning::
+
+ There is a difference between induction schemes generated by the command
+ :cmd:`Functional Scheme` and these generated by the :cmd:`Function`. Indeed,
+ :cmd:`Function` generally produces smaller principles that are closer to how
+ a user would implement them. See :ref:`advanced-recursive-functions` for details.
+
+.. example::
+
+ Induction scheme for div2.
+
+ We define the function div2 as follows:
+
+ .. coqtop:: all
+
+ Require Import FunInd.
+ Require Import Arith.
+
+ Fixpoint div2 (n:nat) : nat :=
+ match n with
+ | O => 0
+ | S O => 0
+ | S (S n') => S (div2 n')
+ end.
+
+ The definition of a principle of induction corresponding to the
+ recursive structure of `div2` is defined by the command:
+
+ .. coqtop:: all
+
+ Functional Scheme div2_ind := Induction for div2 Sort Prop.
+
+ You may now look at the type of div2_ind:
+
+ .. coqtop:: all
+
+ Check div2_ind.
+
+ We can now prove the following lemma using this principle:
+
+ .. coqtop:: all
+
+ Lemma div2_le' : forall n:nat, div2 n <= n.
+ intro n.
+ pattern n, (div2 n).
+ apply div2_ind; intros.
+ auto with arith.
+ auto with arith.
+ simpl; auto with arith.
+ Qed.
+
+ We can use directly the functional induction (:tacn:`functional induction`) tactic instead
+ of the pattern/apply trick:
+
+ .. coqtop:: all
+
+ Reset div2_le'.
+
+ Lemma div2_le : forall n:nat, div2 n <= n.
+ intro n.
+ functional induction (div2 n).
+ auto with arith.
+ auto with arith.
+ auto with arith.
+ Qed.
+
+.. example::
+
+ Induction scheme for tree_size.
+
+ We define trees by the following mutual inductive type:
+
+ .. original LaTeX had "Variable" instead of "Axiom", which generates an ugly warning
+
+ .. coqtop:: reset all
+
+ Axiom A : Set.
+
+ Inductive tree : Set :=
+ node : A -> forest -> tree
+ with forest : Set :=
+ | empty : forest
+ | cons : tree -> forest -> forest.
+
+ We define the function tree_size that computes the size of a tree or a
+ forest. Note that we use ``Function`` which generally produces better
+ principles.
+
+ .. coqtop:: all
+
+ Require Import FunInd.
+
+ Function tree_size (t:tree) : nat :=
+ match t with
+ | node A f => S (forest_size f)
+ end
+ with forest_size (f:forest) : nat :=
+ match f with
+ | empty => 0
+ | cons t f' => (tree_size t + forest_size f')
+ end.
+
+ Notice that the induction principles ``tree_size_ind`` and ``forest_size_ind``
+ generated by ``Function`` are not mutual.
+
+ .. coqtop:: all
+
+ Check tree_size_ind.
+
+ Mutual induction principles following the recursive structure of ``tree_size``
+ and ``forest_size`` can be generated by the following command:
+
+ .. coqtop:: all
+
+ Functional Scheme tree_size_ind2 := Induction for tree_size Sort Prop
+ with forest_size_ind2 := Induction for forest_size Sort Prop.
+
+ You may now look at the type of `tree_size_ind2`:
+
+ .. coqtop:: all
+
+ Check tree_size_ind2.
diff --git a/doc/sphinx/using/libraries/index.rst b/doc/sphinx/using/libraries/index.rst
index d0848e6c3f..ad10869439 100644
--- a/doc/sphinx/using/libraries/index.rst
+++ b/doc/sphinx/using/libraries/index.rst
@@ -22,3 +22,4 @@ installed with the `opam package manager
../../language/coq-library
../../addendum/extraction
../../addendum/miscellaneous-extensions
+ funind
diff --git a/doc/sphinx/using/tools/coqdoc.rst b/doc/sphinx/using/tools/coqdoc.rst
index cada680895..b4b14fb392 100644
--- a/doc/sphinx/using/tools/coqdoc.rst
+++ b/doc/sphinx/using/tools/coqdoc.rst
@@ -248,6 +248,27 @@ shown using such comments:
The latter cannot be used around some inner parts of a proof, but can
be used around a whole proof.
+Lastly, it is possible to adopt a middle-ground approach when the
+desired output is HTML, where a given snippet of Coq material is
+hidden by default, but can be made visible with user interaction.
+
+::
+
+
+ (* begin details *)
+ *some Coq material*
+ (* end details *)
+
+
+There is also an alternative syntax available.
+
+::
+
+
+ (* begin details : Some summary describing the snippet *)
+ *some Coq material*
+ (* end details *)
+
Usage
~~~~~
diff --git a/doc/stdlib/hidden-files b/doc/stdlib/hidden-files
index 67d0b37e81..65c88ed8d5 100644
--- a/doc/stdlib/hidden-files
+++ b/doc/stdlib/hidden-files
@@ -44,6 +44,7 @@ theories/micromega/Refl.v
theories/micromega/RingMicromega.v
theories/micromega/Tauto.v
theories/micromega/VarMap.v
+theories/micromega/ZArith_hints.v
theories/micromega/ZCoeff.v
theories/micromega/ZMicromega.v
theories/micromega/ZifyInst.v
diff --git a/doc/stdlib/index-list.html.template b/doc/stdlib/index-list.html.template
index e64b4be454..b2c9c936c9 100644
--- a/doc/stdlib/index-list.html.template
+++ b/doc/stdlib/index-list.html.template
@@ -13,6 +13,7 @@ through the <tt>Require Import</tt> command.</p>
The core library (automatically loaded when starting Coq)
</dt>
<dd>
+ theories/Init/Ltac.v
theories/Init/Notations.v
theories/Init/Datatypes.v
theories/Init/Logic.v
@@ -444,6 +445,7 @@ through the <tt>Require Import</tt> command.</p>
theories/Sorting/PermutSetoid.v
theories/Sorting/Mergesort.v
theories/Sorting/Sorted.v
+ theories/Sorting/CPermutation.v
</dd>
<dt> <b>Wellfounded</b>:
@@ -558,6 +560,7 @@ through the <tt>Require Import</tt> command.</p>
theories/Reals/Rtrigo_fun.v
theories/Reals/Rtrigo1.v
theories/Reals/Rtrigo.v
+ theories/Reals/Rtrigo_facts.v
theories/Reals/Ratan.v
theories/Reals/Machin.v
theories/Reals/SplitAbsolu.v
diff --git a/doc/tools/coqrst/coqdomain.py b/doc/tools/coqrst/coqdomain.py
index 6332c4c81d..57243207f0 100644
--- a/doc/tools/coqrst/coqdomain.py
+++ b/doc/tools/coqrst/coqdomain.py
@@ -188,20 +188,19 @@ class CoqObject(ObjectDescription):
def _add_index_entry(self, name, target):
"""Add `name` (pointing to `target`) to the main index."""
assert isinstance(name, str)
- if not name.startswith("_"):
- # remove trailing . , found in commands, but not ... (ellipsis)
- trim = name.endswith(".") and not name.endswith("...")
- index_text = name[:-1] if trim else name
- if self.index_suffix:
- index_text += " " + self.index_suffix
- self.indexnode['entries'].append(('single', index_text, target, '', None))
+ # remove trailing . , found in commands, but not ... (ellipsis)
+ trim = name.endswith(".") and not name.endswith("...")
+ index_text = name[:-1] if trim else name
+ if self.index_suffix:
+ index_text += " " + self.index_suffix
+ self.indexnode['entries'].append(('single', index_text, target, '', None))
aliases = None # additional indexed names for a command or other object
def add_target_and_index(self, name, _, signode):
"""Attach a link target to `signode` and an index entry for `name`.
This is only called (from ``ObjectDescription.run``) if ``:noindex:`` isn't specified."""
- if name:
+ if name and not (isinstance(name, str) and name.startswith('_')):
target = self._add_target(signode, name)
self._add_index_entry(name, target)
if self.aliases is not None:
@@ -1092,7 +1091,6 @@ class CoqVernacIndex(CoqSubdomainsIndex):
class CoqTacticIndex(CoqSubdomainsIndex):
name, localname, shortname, subdomains = "tacindex", "Tactic Index", "tactics", ["tacn"]
-# Attribute index is generated but not included in output
class CoqAttributeIndex(CoqSubdomainsIndex):
name, localname, shortname, subdomains = "attrindex", "Attribute Index", "attributes", ["attr"]
@@ -1217,7 +1215,7 @@ class CoqDomain(Domain):
'g': CoqCodeRole
}
- indices = [CoqVernacIndex, CoqTacticIndex, CoqOptionIndex, CoqGallinaIndex, CoqExceptionIndex]
+ indices = [CoqVernacIndex, CoqTacticIndex, CoqOptionIndex, CoqGallinaIndex, CoqExceptionIndex, CoqAttributeIndex]
data_version = 1
initial_data = {
diff --git a/doc/tools/docgram/common.edit_mlg b/doc/tools/docgram/common.edit_mlg
index 60b845c4be..700170b3c6 100644
--- a/doc/tools/docgram/common.edit_mlg
+++ b/doc/tools/docgram/common.edit_mlg
@@ -151,8 +151,7 @@ fields: [ | DELETENT ]
dirpath: [
| REPLACE ident LIST0 field
-| WITH ident
-| dirpath field_ident
+| WITH LIST0 ( ident "." ) ident
]
binders: [
@@ -220,6 +219,15 @@ tactic_expr0: [
| WITH "[>" tactic_then_gen "]"
]
+(* lexer token *)
+IDENT: [
+| ident
+]
+
+scope: [
+| IDENT
+]
+
operconstr100: [
| MOVETO term_cast operconstr99 "<:" operconstr200
| MOVETO term_cast operconstr99 "<<:" operconstr200
@@ -240,7 +248,9 @@ operconstr9: [
operconstr1: [
| REPLACE operconstr0 ".(" global LIST0 appl_arg ")"
-| WITH operconstr0 ".(" global LIST0 appl_arg ")"
+| WITH operconstr0 ".(" global LIST0 appl_arg ")" (* huh? *)
+| REPLACE operconstr0 "%" IDENT
+| WITH operconstr0 "%" scope
| MOVETO term_projection operconstr0 ".(" global LIST0 appl_arg ")"
| MOVETO term_projection operconstr0 ".(" "@" global LIST0 ( operconstr9 ) ")"
]
@@ -364,6 +374,11 @@ pattern10: [
| DELETE pattern1
]
+pattern1: [
+| REPLACE pattern0 "%" IDENT
+| WITH pattern0 "%" scope
+]
+
pattern0: [
| REPLACE "(" pattern200 ")"
| WITH "(" LIST1 pattern200 SEP "|" ")"
@@ -419,6 +434,8 @@ gallina: [
| WITH "Let" "CoFixpoint" corec_definition LIST0 ( "with" corec_definition )
| REPLACE "Scheme" LIST1 scheme SEP "with"
| WITH "Scheme" scheme LIST0 ( "with" scheme )
+| REPLACE "Primitive" identref OPT [ ":" lconstr ] ":=" register_token
+| WITH "Primitive" identref OPT [ ":" lconstr ] ":=" "#" identref
]
constructor_list_or_record_decl: [
@@ -494,8 +511,10 @@ strategy_flag: [
| OPTINREF
]
-export_token: [
-| OPTINREF
+filtered_import: [
+| REPLACE global "(" LIST1 one_import_filter_name SEP "," ")"
+| WITH global OPT [ "(" LIST1 one_import_filter_name SEP "," ")" ]
+| DELETE global
]
functor_app_annot: [
@@ -536,20 +555,23 @@ gallina_ext: [
| REPLACE "Generalizable" [ "All" "Variables" | "No" "Variables" | [ "Variable" | "Variables" ] LIST1 identref ]
| WITH "Generalizable" [ [ "Variable" | "Variables" ] LIST1 identref | "All" "Variables" | "No" "Variables" ]
+(* don't show Export for Set, Unset *)
| REPLACE "Export" "Set" option_table option_setting
-| WITH OPT "Export" "Set" option_table option_setting
+| WITH "Set" option_table option_setting
| REPLACE "Export" "Unset" option_table
-| WITH OPT "Export" "Unset" option_table
+| WITH "Unset" option_table
| REPLACE "Instance" instance_name ":" operconstr200 hint_info [ ":=" "{" record_declaration "}" | ":=" lconstr | ]
| WITH "Instance" instance_name ":" operconstr200 hint_info OPT [ ":=" "{" record_declaration "}" | ":=" lconstr ]
+| REPLACE "From" global "Require" export_token LIST1 global
+| WITH "From" dirpath "Require" export_token LIST1 global
]
-(* lexer stuff *)
-IDENT: [
-| ident
+export_token: [
+| OPTINREF
]
+(* lexer stuff *)
integer: [ | DELETENT ]
RENAME: [
| integer int (* todo: review uses in .mlg files, some should be "natural" *)
@@ -859,6 +881,7 @@ bar_cbrace: [
printable: [
| REPLACE [ "Sorted" | ] "Universes" OPT printunivs_subgraph OPT ne_string
| WITH OPT "Sorted" "Universes" OPT printunivs_subgraph OPT ne_string
+| DELETE "Term" smart_global OPT univ_name_list (* readded in commands *)
| INSERTALL "Print"
]
@@ -878,16 +901,19 @@ command: [
| 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
+| REPLACE "Set" option_table option_setting
+| WITH OPT "Export" "Set" option_table (* set flag *)
+| REPLACE "Test" option_table "for" LIST1 table_value
+| WITH "Test" option_table OPT ( "for" LIST1 table_value )
+| DELETE "Test" option_table
+
+(* hide the fact that table names are limited to 2 IDENTs *)
+| REPLACE "Add" IDENT IDENT LIST1 table_value
+| WITH "Add" option_table LIST1 table_value
+| DELETE "Add" IDENT LIST1 table_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
@@ -941,7 +967,11 @@ command: [
| REPLACE "Preterm" "of" ident
| WITH "Preterm" OPT ( "of" ident )
| DELETE "Preterm"
-| EDIT "Remove" ADD_OPT IDENT IDENT LIST1 option_ref_value
+
+(* hide the fact that table names are limited to 2 IDENTs *)
+| REPLACE "Remove" IDENT IDENT LIST1 table_value
+| WITH "Remove" option_table LIST1 table_value
+| DELETE "Remove" IDENT LIST1 table_value
| DELETE "Restore" "State" IDENT
| DELETE "Restore" "State" ne_string
| "Restore" "State" [ IDENT | ne_string ]
@@ -976,6 +1006,16 @@ command: [
| REPLACE "Abort" identref
| WITH "Abort" OPT [ "All" | identref ]
+(* show the locate options as separate commands *)
+| DELETE "Locate" locatable
+| locatable
+| REPLACE "Print" smart_global OPT univ_name_list
+| WITH "Print" OPT "Term" smart_global OPT univ_name_list
+
+]
+
+option_setting: [
+| OPTINREF
]
only_parsing: [
@@ -1062,9 +1102,7 @@ legacy_attr: [
| DELETE "NonCumulative"
]
-vernacular: [
-| LIST0 ( OPT all_attrs [ command | tactic ] "." )
-]
+sentence: [ ] (* productions defined below *)
rec_definition: [
| REPLACE ident_decl binders_fixannot type_cstr OPT [ ":=" lconstr ] decl_notations
@@ -1124,7 +1162,7 @@ query_command: [
| 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
+| WITH "Search" searchabout_queries
]
vernac_toplevel: [
@@ -1142,37 +1180,25 @@ vernac_toplevel: [
| 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
+| WITH "Time" sentence
| REPLACE "Redirect" ne_string vernac_control
-| WITH "Redirect" ne_string command
+| WITH "Redirect" ne_string sentence
| REPLACE "Timeout" natural vernac_control
-| WITH "Timeout" natural command
+| WITH "Timeout" natural sentence
| REPLACE "Fail" vernac_control
-| WITH "Fail" command
+| WITH "Fail" sentence
| DELETE decorated_vernac
]
-option_setting: [
-| OPTINREF
-]
-
orient: [
| OPTINREF
]
@@ -1351,6 +1377,51 @@ module_expr: [
| DELETE module_expr module_expr_atom
]
+locatable: [
+| INSERTALL "Locate"
+]
+
+ne_in_or_out_modules: [
+| REPLACE "inside" LIST1 global
+| WITH [ "inside" | "outside" ] LIST1 global
+| DELETE "outside" LIST1 global
+]
+
+searchabout_query: [
+| REPLACE positive_search_mark ne_string OPT scope_delimiter
+| WITH ne_string OPT scope_delimiter
+| REPLACE positive_search_mark constr_pattern
+| WITH constr_pattern
+]
+
+searchabout_queries: [
+| DELETE ne_in_or_out_modules
+| REPLACE searchabout_query searchabout_queries
+| WITH LIST1 ( positive_search_mark searchabout_query ) OPT ne_in_or_out_modules
+| DELETE (* empty *)
+]
+
+positive_search_mark: [
+| OPTINREF
+]
+
+by_notation: [
+| REPLACE ne_string OPT [ "%" IDENT ]
+| WITH ne_string OPT [ "%" scope ]
+]
+
+scope_delimiter: [
+| REPLACE "%" IDENT
+| WITH "%" scope
+]
+
+(* Don't show these details *)
+DELETE: [
+| register_token
+| register_prim_token
+| register_type_token
+]
+
SPLICE: [
| noedit_mode
| bigint
@@ -1435,9 +1506,7 @@ SPLICE: [
| mode
| mult_pattern
| open_constr
-| option_table
| record_declaration
-| register_type_token
| tactic
| uconstr
| impl_ident_head
@@ -1466,14 +1535,12 @@ SPLICE: [
| assum_coe
| inline
| occs
-| univ_name_list
| ltac_info
| field_mods
| ltac_production_sep
| ltac_tactic_level
| printunivs_subgraph
| ring_mods
-| scope_delimiter
| eliminator (* todo: splice or not? *)
| quoted_attributes (* todo: splice or not? *)
| printable
@@ -1483,10 +1550,9 @@ SPLICE: [
| constructor_type
| record_binder
| at_level_opt
-| option_ref_value
+| table_value
| positive_search_mark
| in_or_out_modules
-| register_prim_token
| option_setting
| orient
| with_bindings
@@ -1518,6 +1584,11 @@ SPLICE: [
| ltac_def_kind
| intropatterns
| instance_name
+| ne_in_or_out_modules
+| searchabout_queries
+| locatable
+| scope_delimiter
+| one_import_filter_name
] (* end SPLICE *)
RENAME: [
@@ -1567,8 +1638,12 @@ RENAME: [
| record_binder_body field_body
| class_rawexpr class
| smart_global smart_qualid
+| searchabout_query search_item
+| option_table setting_name
]
+(* todo: positive_search_mark is a lousy name for OPT "-" *)
+
(* todo: doesn't work if up above... maybe because 'clause' doesn't exist? *)
clause_dft_concl: [
| OPTINREF
@@ -1656,3 +1731,18 @@ SPLICE: [
| tactic_notation_tactics
]
(* todo: ssrreflect*.rst ref to fix_body is incorrect *)
+
+(* not included in insertprodn; defined in rst with :production: *)
+control_command: [ ]
+query_command: [ ] (* re-add since previously spliced *)
+
+sentence: [
+| OPT all_attrs command "."
+| OPT all_attrs OPT ( num ":" ) query_command "."
+| OPT all_attrs OPT toplevel_selector ltac_expr [ "." | "..." ]
+| control_command
+]
+
+vernacular: [
+| LIST0 sentence
+]
diff --git a/doc/tools/docgram/doc_grammar.ml b/doc/tools/docgram/doc_grammar.ml
index eea1d5081d..f00fda0e8c 100644
--- a/doc/tools/docgram/doc_grammar.ml
+++ b/doc/tools/docgram/doc_grammar.ml
@@ -189,6 +189,9 @@ let rec db_output_prodn = function
and db_out_list prod = sprintf "(%s)" (map_and_concat db_output_prodn prod)
and db_out_prods prods = sprintf "( %s )" (map_and_concat ~delim:" | " db_out_list prods)
+(* identify special chars that don't get a trailing space in output *)
+let omit_space s = List.mem s ["?"; "."; "#"]
+
let rec output_prod plist need_semi = function
| Sterm s -> if plist then sprintf "%s" s else sprintf "\"%s\"" s
| Snterm s ->
@@ -225,7 +228,7 @@ let rec output_prod plist need_semi = function
and prod_to_str_r plist prod =
match prod with
- | Sterm s :: Snterm "ident" :: tl when List.mem s ["?"; "."] && plist ->
+ | Sterm s :: Snterm "ident" :: tl when omit_space s && plist ->
(sprintf "%s`ident`" s) :: (prod_to_str_r plist tl)
| p :: tl ->
let need_semi =
@@ -282,7 +285,7 @@ and output_sep sep =
and prod_to_prodn_r prod =
match prod with
- | Sterm s :: Snterm "ident" :: tl when List.mem s ["?"; "."] ->
+ | Sterm s :: Snterm "ident" :: tl when omit_space s ->
(sprintf "%s@ident" s) :: (prod_to_prodn_r tl)
| p :: tl -> (output_prodn p) :: (prod_to_prodn_r tl)
| [] -> []
@@ -1621,6 +1624,7 @@ let open_temp_bin file =
open_out_bin (sprintf "%s.new" file)
let match_cmd_regex = Str.regexp "[a-zA-Z0-9_ ]+"
+let match_subscripts = Str.regexp "__[a-zA-Z0-9]+"
let find_longest_match prods str =
let get_pfx str = String.trim (if Str.string_match match_cmd_regex str 0 then Str.matched_string str else "") in
@@ -1634,19 +1638,26 @@ let find_longest_match prods str =
in
aux 0
in
+ let remove_subscrs str = Str.global_replace match_subscripts "" str in
let slen = String.length str in
let str_pfx = get_pfx str in
+ let no_subscrs = remove_subscrs str in
+ let has_subscrs = no_subscrs <> str in
let rec longest best multi best_len prods =
match prods with
| [] -> best, multi, best_len
| prod :: tl ->
let pstr = String.trim prod in (* todo: should be pretrimmed *)
let clen = common_prefix_len str pstr in
- if str_pfx = "" || str_pfx <> get_pfx pstr then
+ if has_subscrs && no_subscrs = pstr then
+ str, false, clen (* exact match ignoring subscripts *)
+ else if pstr = str then
+ pstr, false, clen (* exact match of full line *)
+ else 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 *)
+ pstr, false, clen (* exact match on prefix *)
else if clen > best_len then
longest pstr false clen tl (* better match *)
else if clen = best_len then
@@ -1654,7 +1665,11 @@ let find_longest_match prods str =
else
longest best multi best_len tl (* worse match *)
in
- longest "" false 0 prods
+ let mtch, multi, _ = longest "" false 0 prods in
+ if has_subscrs && mtch <> str then
+ "", multi, mtch (* no match for subscripted entry *)
+ else
+ mtch, multi, ""
type seen = {
nts: (string * int) NTMap.t;
@@ -1753,8 +1768,14 @@ let process_rst g file args seen tac_prods cmd_prods =
(* in*)
let cmd_replace_files = [
+ "doc/sphinx/language/core/records.rst";
+ "doc/sphinx/language/core/sections.rst";
+ "doc/sphinx/language/extensions/implicit-arguments.rst";
+ "doc/sphinx/language/using/libraries/funind.rst";
+
"doc/sphinx/language/gallina-specification-language.rst";
- "doc/sphinx/language/gallina-extensions.rst"
+ "doc/sphinx/language/gallina-extensions.rst";
+ "doc/sphinx/proof-engine/vernacular-commands.rst"
]
in
@@ -1763,11 +1784,14 @@ let process_rst g file args seen tac_prods cmd_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
+ let mtch, multi, best = find_longest_match prods rhs in
+(* Printf.printf "mtch = '%s' rhs = '%s'\n" mtch rhs;*)
if mtch = rhs then
rhs (* no change *)
else if mtch = "" then begin
warn "%s line %d: NO MATCH `%s`\n" file !linenum rhs;
+ if best <> "" then
+ warn "%s line %d: BEST `%s`\n" file !linenum best;
rhs
end else if multi then begin
warn "%s line %d: MULTIMATCH `%s`\n" file !linenum rhs;
diff --git a/doc/tools/docgram/dune b/doc/tools/docgram/dune
index fba4856241..a533a6d367 100644
--- a/doc/tools/docgram/dune
+++ b/doc/tools/docgram/dune
@@ -43,9 +43,6 @@
orderedGrammar)
(action
(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")
+ (chdir %{project_root} (run doc_grammar -check-cmds -no-update %{input}))
(diff? fullGrammar fullGrammar.new)
(diff? orderedGrammar orderedGrammar.new))))
diff --git a/doc/tools/docgram/fullGrammar b/doc/tools/docgram/fullGrammar
index 272d17bb35..4274dccb40 100644
--- a/doc/tools/docgram/fullGrammar
+++ b/doc/tools/docgram/fullGrammar
@@ -524,12 +524,12 @@ command: [
| "Set" option_table option_setting
| "Unset" option_table
| "Print" "Table" option_table
-| "Add" IDENT IDENT LIST1 option_ref_value
-| "Add" IDENT LIST1 option_ref_value
-| "Test" option_table "for" LIST1 option_ref_value
+| "Add" IDENT IDENT LIST1 table_value
+| "Add" IDENT LIST1 table_value
+| "Test" option_table "for" LIST1 table_value
| "Test" option_table
-| "Remove" IDENT IDENT LIST1 option_ref_value
-| "Remove" IDENT LIST1 option_ref_value
+| "Remove" IDENT IDENT LIST1 table_value
+| "Remove" IDENT LIST1 table_value
| "Write" "State" IDENT
| "Write" "State" ne_string
| "Restore" "State" IDENT
@@ -773,7 +773,7 @@ gallina: [
| assumption_token inline assum_list
| assumptions_token inline assum_list
| def_token ident_decl def_body
-| "Let" identref def_body
+| "Let" ident_decl def_body
| finite_token LIST1 inductive_definition SEP "with"
| "Fixpoint" LIST1 rec_definition SEP "with"
| "Let" "Fixpoint" LIST1 rec_definition SEP "with"
@@ -1027,13 +1027,12 @@ gallina_ext: [
| "Module" "Type" identref LIST0 module_binder check_module_types is_module_type
| "Declare" "Module" export_token identref LIST0 module_binder ":" module_type_inl
| "Section" identref
-| "Chapter" identref
| "End" identref
| "Collection" identref ":=" section_subset_expr
| "Require" export_token LIST1 global
| "From" global "Require" export_token LIST1 global
-| "Import" LIST1 global
-| "Export" LIST1 global
+| "Import" LIST1 filtered_import
+| "Export" LIST1 filtered_import
| "Include" module_type_inl LIST0 ext_module_expr
| "Include" "Type" module_type_inl LIST0 ext_module_type
| "Transparent" LIST1 smart_global
@@ -1058,6 +1057,15 @@ gallina_ext: [
| "Export" "Unset" option_table
]
+filtered_import: [
+| global
+| global "(" LIST1 one_import_filter_name SEP "," ")"
+]
+
+one_import_filter_name: [
+| global OPT [ "(" ".." ")" ]
+]
+
export_token: [
| "Import"
| "Export"
@@ -1310,7 +1318,7 @@ option_setting: [
| STRING
]
-option_ref_value: [
+table_value: [
| global
| STRING
]
diff --git a/doc/tools/docgram/orderedGrammar b/doc/tools/docgram/orderedGrammar
index 0c9d7a853b..e71c80f829 100644
--- a/doc/tools/docgram/orderedGrammar
+++ b/doc/tools/docgram/orderedGrammar
@@ -47,7 +47,7 @@ one_term: [
term1: [
| term_projection
-| term0 "%" ident
+| term0 "%" scope
| term0
]
@@ -159,7 +159,20 @@ where: [
]
vernacular: [
-| LIST0 ( OPT all_attrs [ command | ltac_expr ] "." )
+| LIST0 sentence
+]
+
+sentence: [
+| OPT all_attrs command "."
+| OPT all_attrs OPT ( num ":" ) query_command "."
+| OPT all_attrs OPT toplevel_selector ltac_expr [ "." | "..." ]
+| control_command
+]
+
+control_command: [
+]
+
+query_command: [
]
tacticals: [
@@ -330,7 +343,7 @@ pattern10: [
]
pattern1: [
-| pattern0 "%" ident
+| pattern0 "%" scope
| pattern0
]
@@ -367,53 +380,6 @@ decl_notation: [
| string ":=" one_term OPT ( "(" "only" "parsing" ")" ) OPT [ ":" ident ]
]
-register_token: [
-| "#int63_type"
-| "#float64_type"
-| "#int63_head0"
-| "#int63_tail0"
-| "#int63_add"
-| "#int63_sub"
-| "#int63_mul"
-| "#int63_div"
-| "#int63_mod"
-| "#int63_lsr"
-| "#int63_lsl"
-| "#int63_land"
-| "#int63_lor"
-| "#int63_lxor"
-| "#int63_addc"
-| "#int63_subc"
-| "#int63_addcarryc"
-| "#int63_subcarryc"
-| "#int63_mulc"
-| "#int63_diveucl"
-| "#int63_div21"
-| "#int63_addmuldiv"
-| "#int63_eq"
-| "#int63_lt"
-| "#int63_le"
-| "#int63_compare"
-| "#float64_opp"
-| "#float64_abs"
-| "#float64_eq"
-| "#float64_lt"
-| "#float64_le"
-| "#float64_compare"
-| "#float64_classify"
-| "#float64_add"
-| "#float64_sub"
-| "#float64_mul"
-| "#float64_div"
-| "#float64_sqrt"
-| "#float64_of_int63"
-| "#float64_normfr_mantissa"
-| "#float64_frshiftexp"
-| "#float64_ldshiftexp"
-| "#float64_next_up"
-| "#float64_next_down"
-]
-
thm_token: [
| "Theorem"
| "Lemma"
@@ -531,6 +497,10 @@ constructor: [
| ident LIST0 binder OPT of_type
]
+filtered_import: [
+| qualid OPT [ "(" LIST1 ( qualid OPT [ "(" ".." ")" ] ) SEP "," ")" ]
+]
+
cofix_definition: [
| ident_decl LIST0 binder OPT ( ":" type ) OPT [ ":=" term ] OPT decl_notations
]
@@ -601,20 +571,20 @@ smart_qualid: [
]
by_notation: [
-| string OPT [ "%" ident ]
+| string OPT [ "%" scope ]
]
argument_spec_block: [
| argument_spec
| "/"
| "&"
-| "(" LIST1 argument_spec ")" OPT ( "%" ident )
-| "[" LIST1 argument_spec "]" OPT ( "%" ident )
-| "{" LIST1 argument_spec "}" OPT ( "%" ident )
+| "(" LIST1 argument_spec ")" OPT ( "%" scope )
+| "[" LIST1 argument_spec "]" OPT ( "%" scope )
+| "{" LIST1 argument_spec "}" OPT ( "%" scope )
]
argument_spec: [
-| OPT "!" name OPT ( "%" ident )
+| OPT "!" name OPT ( "%" scope )
]
more_implicits_block: [
@@ -637,10 +607,14 @@ arguments_modifier: [
| "extra" "scopes"
]
+scope: [
+| ident
+]
+
strategy_level: [
-| "expand"
| "opaque"
| int
+| "expand"
| "transparent"
]
@@ -660,12 +634,16 @@ command: [
| "Cd" OPT string
| "Load" OPT "Verbose" [ string | ident ]
| "Declare" "ML" "Module" LIST1 string
-| "Locate" locatable
+| "Locate" smart_qualid
+| "Locate" "Term" smart_qualid
+| "Locate" "Module" qualid
+| "Locate" "Ltac" qualid
+| "Locate" "Library" qualid
+| "Locate" "File" string
| "Add" "LoadPath" string "as" dirpath
| "Add" "Rec" "LoadPath" string "as" dirpath
| "Remove" "LoadPath" string
| "Type" term
-| "Print" "Term" smart_qualid OPT ( "@{" LIST0 name "}" )
| "Print" "All"
| "Print" "Section" qualid
| "Print" "Grammar" ident
@@ -702,18 +680,17 @@ command: [
| "Print" "Strategy" smart_qualid
| "Print" "Strategies"
| "Print" "Registered"
-| "Print" smart_qualid OPT ( "@{" LIST0 name "}" )
+| "Print" OPT "Term" smart_qualid OPT univ_name_list
| "Print" "Module" "Type" qualid
| "Print" "Module" qualid
| "Print" "Namespace" dirpath
| "Inspect" num
| "Add" "ML" "Path" string
-| OPT "Export" "Set" LIST1 ident OPT [ int | string ]
-| OPT "Export" "Unset" LIST1 ident
-| "Print" "Table" LIST1 ident
-| "Add" ident OPT ident LIST1 [ qualid | string ]
-| "Test" LIST1 ident OPT ( "for" LIST1 [ qualid | string ] )
-| "Remove" OPT ident ident LIST1 [ qualid | string ]
+| OPT "Export" "Set" setting_name
+| "Print" "Table" setting_name
+| "Add" setting_name LIST1 [ qualid | string ]
+| "Test" setting_name OPT ( "for" LIST1 [ qualid | string ] )
+| "Remove" setting_name LIST1 [ qualid | string ]
| "Write" "State" [ ident | string ]
| "Restore" "State" [ ident | string ]
| "Reset" "Initial"
@@ -806,7 +783,6 @@ command: [
| "Tactic" "Notation" OPT ( "(" "at" "level" num ")" ) LIST1 ltac_production_item ":=" ltac_expr
| "Print" "Rewrite" "HintDb" ident
| "Print" "Ltac" qualid
-| "Locate" "Ltac" qualid
| "Ltac" tacdef_body LIST0 ( "with" tacdef_body )
| "Print" "Ltac" "Signatures"
| "Set" "Firstorder" "Solver" ltac_expr
@@ -851,7 +827,7 @@ command: [
| 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
+| "Let" ident_decl def_body
| "Inductive" inductive_definition LIST0 ( "with" inductive_definition )
| "Fixpoint" fix_definition LIST0 ( "with" fix_definition )
| "Let" "Fixpoint" fix_definition LIST0 ( "with" fix_definition )
@@ -861,7 +837,7 @@ command: [
| "Combined" "Scheme" ident "from" LIST1 ident SEP ","
| "Register" qualid "as" qualid
| "Register" "Inline" qualid
-| "Primitive" ident OPT [ ":" term ] ":=" register_token
+| "Primitive" ident OPT [ ":" term ] ":=" "#" ident
| "Universe" LIST1 ident
| "Universes" LIST1 ident
| "Constraint" LIST1 univ_constraint SEP ","
@@ -873,13 +849,12 @@ command: [
| "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
+| "From" dirpath "Require" OPT [ "Import" | "Export" ] LIST1 qualid
+| "Import" LIST1 filtered_import
+| "Export" LIST1 filtered_import
| "Include" module_type_inl LIST0 ( "<+" module_expr_inl )
| "Include" "Type" LIST1 module_type_inl SEP "<+"
| "Transparent" LIST1 smart_qualid
@@ -899,6 +874,8 @@ command: [
| "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" ]
+| "Set" setting_name OPT [ int | string ]
+| "Unset" setting_name
| "Open" "Scope" ident
| "Close" "Scope" ident
| "Delimit" "Scope" ident "with" ident
@@ -913,15 +890,15 @@ command: [
| "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
+| "About" smart_qualid OPT univ_name_list
+| "SearchHead" one_term OPT ( [ "inside" | "outside" ] LIST1 qualid )
+| "SearchPattern" one_term OPT ( [ "inside" | "outside" ] LIST1 qualid )
+| "SearchRewrite" one_term OPT ( [ "inside" | "outside" ] LIST1 qualid )
+| "Search" LIST1 ( OPT "-" search_item ) OPT ( [ "inside" | "outside" ] LIST1 qualid )
+| "Time" sentence
+| "Redirect" string sentence
+| "Timeout" num sentence
+| "Fail" sentence
| "Drop"
| "Quit"
| "BackTo" num
@@ -960,20 +937,15 @@ starredidentref: [
]
dirpath: [
-| ident
-| dirpath field_ident
+| LIST0 ( ident "." ) ident
]
bignat: [
| numeral
]
-locatable: [
-| smart_qualid
-| "Term" smart_qualid
-| "File" string
-| "Library" qualid
-| "Module" qualid
+setting_name: [
+| LIST1 ident
]
comment: [
@@ -982,6 +954,15 @@ comment: [
| num
]
+search_item: [
+| one_term
+| string OPT ( "%" scope )
+]
+
+univ_name_list: [
+| "@{" LIST0 name "}"
+]
+
hint: [
| "Resolve" LIST1 [ qualid | one_term ] OPT hint_info
| "Resolve" "->" LIST1 qualid OPT num
@@ -1069,21 +1050,6 @@ class: [
| smart_qualid
]
-ne_in_or_out_modules: [
-| "inside" LIST1 qualid
-| "outside" LIST1 qualid
-]
-
-searchabout_query: [
-| OPT "-" string OPT ( "%" ident )
-| OPT "-" one_term
-]
-
-searchabout_queries: [
-| ne_in_or_out_modules
-| searchabout_query searchabout_queries
-]
-
level: [
| "level" num
| "next" "level"