aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/LICENSE15
-rw-r--r--doc/changelog/01-kernel/11972-fix-require-in-section.rst6
-rw-r--r--doc/changelog/02-specification-language/12121-master+fix11903-warn-non-truly-fixpoint.rst5
-rw-r--r--doc/changelog/03-notations/12163-fix-12159.rst11
-rw-r--r--doc/changelog/03-notations/8808-master+support-binder+term-in-abbrev.rst4
-rw-r--r--doc/changelog/04-tactics/12116-master+fix12045-missing-reduction-in-using-ind-scheme.rst5
-rw-r--r--doc/changelog/04-tactics/12129-add-with-strategy.rst4
-rw-r--r--doc/changelog/04-tactics/12146-master+fix10812-subst-failure-section-variables.rst9
-rw-r--r--doc/changelog/04-tactics/12256-unfold-dyn-check.rst4
-rw-r--r--doc/changelog/05-tactic-language/11503-ltac2-rebind-with-value.rst6
-rw-r--r--doc/changelog/05-tactic-language/12254-wit-ref-dyn.rst5
-rw-r--r--doc/changelog/07-commands-and-options/11828-obligations+depr_hide_obligation.rst9
-rw-r--r--doc/changelog/07-commands-and-options/12070-native-compiler-disabled.rst5
-rw-r--r--doc/changelog/07-commands-and-options/12296-master+fix12234-show-proof-proper.rst5
-rw-r--r--doc/changelog/08-tools/11851-coqc-flags-fix.rst11
-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.rst7
-rw-r--r--doc/changelog/10-standard-library/12008-ollibs-bool.rst2
-rw-r--r--doc/changelog/10-standard-library/12121-master+fix11903-warn-non-truly-fixpoint.rst5
-rw-r--r--doc/changelog/10-standard-library/12162-bool-leb.rst4
-rw-r--r--doc/changelog/10-standard-library/12263-fix-haskell-extraction.rst9
-rw-r--r--doc/plugin_tutorial/tuto1/src/simple_declare.ml4
-rw-r--r--doc/sphinx/_templates/versions.html48
-rw-r--r--doc/sphinx/addendum/program.rst12
-rw-r--r--doc/sphinx/changes.rst53
-rwxr-xr-xdoc/sphinx/conf.py22
-rw-r--r--doc/sphinx/language/cic.rst69
-rw-r--r--doc/sphinx/language/coq-library.rst8
-rw-r--r--doc/sphinx/language/core/basic.rst39
-rw-r--r--doc/sphinx/practical-tools/coq-commands.rst83
-rw-r--r--doc/sphinx/proof-engine/ltac.rst2
-rw-r--r--doc/sphinx/proof-engine/ltac2.rst48
-rw-r--r--doc/sphinx/proof-engine/proof-handling.rst6
-rw-r--r--doc/sphinx/proof-engine/ssreflect-proof-language.rst2
-rw-r--r--doc/sphinx/proof-engine/tactics.rst142
-rw-r--r--doc/sphinx/proof-engine/vernacular-commands.rst4
-rw-r--r--doc/sphinx/user-extensions/syntax-extensions.rst87
-rw-r--r--doc/stdlib/Library.tex1
-rw-r--r--doc/tools/coqrst/coqdoc/main.py26
-rw-r--r--doc/tools/coqrst/coqdomain.py12
-rw-r--r--doc/tools/docgram/common.edit_mlg4
-rw-r--r--doc/tools/docgram/fullGrammar21
-rw-r--r--doc/tools/docgram/orderedGrammar6
44 files changed, 691 insertions, 150 deletions
diff --git a/doc/LICENSE b/doc/LICENSE
index 9f3a6b3f4c..a327156144 100644
--- a/doc/LICENSE
+++ b/doc/LICENSE
@@ -6,13 +6,16 @@ copyright (c) 1999-2019, Inria, CNRS and contributors, with the
exception of the Ubuntu font file UbuntuMono-B.ttf, which is Copyright
2010,2011 Canonical Ltd and licensed under the Ubuntu font license,
version 1.0
-(https://www.ubuntu.com/legal/terms-and-policies/font-licence), and
+(https://www.ubuntu.com/legal/terms-and-policies/font-licence),
its derivative CoqNotations.ttf distributed under the same
-license. The material connected to the Reference Manual may be
-distributed only subject to the terms and conditions set forth in the
-Open Publication License, v1.0 or later (the latest version is
-presently available at http://www.opencontent.org/openpub/). Options
-A and B are *not* elected.
+license, and the _templates/versions.html file derived from
+sphinx_rtd_theme, which is Copyright 2013-2018 Dave Snider, Read the
+Docs, Inc. & contributors and distributed under the MIT License
+included in that file. The material connected to the Reference Manual
+may be distributed only subject to the terms and conditions set forth in
+the Open Publication License, v1.0 or later (the latest version is
+presently available at http://www.opencontent.org/openpub/). Options A
+and B are *not* elected.
The Coq Standard Library is a collective work from the Coq Development
Team whose members are listed in the file CREDITS of the Coq source
diff --git a/doc/changelog/01-kernel/11972-fix-require-in-section.rst b/doc/changelog/01-kernel/11972-fix-require-in-section.rst
deleted file mode 100644
index 7a2fa9185f..0000000000
--- a/doc/changelog/01-kernel/11972-fix-require-in-section.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-- **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/12121-master+fix11903-warn-non-truly-fixpoint.rst b/doc/changelog/02-specification-language/12121-master+fix11903-warn-non-truly-fixpoint.rst
new file mode 100644
index 0000000000..d69a94205f
--- /dev/null
+++ b/doc/changelog/02-specification-language/12121-master+fix11903-warn-non-truly-fixpoint.rst
@@ -0,0 +1,5 @@
+- **Added:**
+ New warning on using :cmd:`Fixpoint` or :cmd:`CoFixpoint` for
+ definitions which are not recursive
+ (`#12121 <https://github.com/coq/coq/pull/12121>`_,
+ by Hugo Herbelin)
diff --git a/doc/changelog/03-notations/12163-fix-12159.rst b/doc/changelog/03-notations/12163-fix-12159.rst
new file mode 100644
index 0000000000..978ed561dd
--- /dev/null
+++ b/doc/changelog/03-notations/12163-fix-12159.rst
@@ -0,0 +1,11 @@
+- **Fixed:**
+ Numeral Notations now play better with multiple scopes for the same
+ inductive type. Previously, when multiple numeral notations were defined
+ for the same inductive, only the last one was considered for
+ printing. Now, among the notations that are usable for printing and either
+ have a scope delimiter or are open, the selection is made according
+ to the order of open scopes, or according to the last defined
+ notation if no appropriate scope is open
+ (`#12163 <https://github.com/coq/coq/pull/12163>`_,
+ fixes `#12159 <https://github.com/coq/coq/pull/12159>`_,
+ by Pierre Roux, review by Hugo Herbelin and Jason Gross).
diff --git a/doc/changelog/03-notations/8808-master+support-binder+term-in-abbrev.rst b/doc/changelog/03-notations/8808-master+support-binder+term-in-abbrev.rst
new file mode 100644
index 0000000000..e1fcfb78c4
--- /dev/null
+++ b/doc/changelog/03-notations/8808-master+support-binder+term-in-abbrev.rst
@@ -0,0 +1,4 @@
+- **Added:**
+ Abbreviations support arguments occurring both in term and binder position
+ (`#8808 <https://github.com/coq/coq/pull/8808>`_,
+ by Hugo Herbelin).
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
deleted file mode 100644
index 7af2b4d97b..0000000000
--- a/doc/changelog/04-tactics/12116-master+fix12045-missing-reduction-in-using-ind-scheme.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-- **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/04-tactics/12129-add-with-strategy.rst b/doc/changelog/04-tactics/12129-add-with-strategy.rst
new file mode 100644
index 0000000000..68558c0cf4
--- /dev/null
+++ b/doc/changelog/04-tactics/12129-add-with-strategy.rst
@@ -0,0 +1,4 @@
+- **Added:**
+ New tactical :tacn:`with_strategy` added which behaves like the
+ command :cmd:`Strategy`, with effects local to the given tactic
+ (`#12129 <https://github.com/coq/coq/pull/12129>`_, by Jason Gross).
diff --git a/doc/changelog/04-tactics/12146-master+fix10812-subst-failure-section-variables.rst b/doc/changelog/04-tactics/12146-master+fix10812-subst-failure-section-variables.rst
new file mode 100644
index 0000000000..055006d3b4
--- /dev/null
+++ b/doc/changelog/04-tactics/12146-master+fix10812-subst-failure-section-variables.rst
@@ -0,0 +1,9 @@
+- **Changed:**
+ Tactic :tacn:`subst` :n:`@ident` now fails over a section variable which is
+ indirectly dependent in the goal; the incompatibility can generally
+ be fixed by first clearing the hypotheses causing an indirect
+ dependency, as reported by the error message, or by using :tacn:`rewrite` :n:`in *`
+ instead; similarly, :tacn:`subst` has no more effect on such variables
+ (`#12146 <https://github.com/coq/coq/pull/12146>`_,
+ by Hugo Herbelin; fixes `#10812 <https://github.com/coq/coq/pull/10812>`_;
+ fixes `#12139 <https://github.com/coq/coq/pull/12139>`_).
diff --git a/doc/changelog/04-tactics/12256-unfold-dyn-check.rst b/doc/changelog/04-tactics/12256-unfold-dyn-check.rst
new file mode 100644
index 0000000000..c2f7065f4c
--- /dev/null
+++ b/doc/changelog/04-tactics/12256-unfold-dyn-check.rst
@@ -0,0 +1,4 @@
+- **Changed:**
+ The check that unfold arguments were indeed unfoldable has been moved to runtime
+ (`#12256 <https://github.com/coq/coq/pull/12256>`_,
+ by Pierre-Marie Pédrot).
diff --git a/doc/changelog/05-tactic-language/11503-ltac2-rebind-with-value.rst b/doc/changelog/05-tactic-language/11503-ltac2-rebind-with-value.rst
new file mode 100644
index 0000000000..0dd0fed4e2
--- /dev/null
+++ b/doc/changelog/05-tactic-language/11503-ltac2-rebind-with-value.rst
@@ -0,0 +1,6 @@
+- **Added:**
+ The Ltac2 rebinding command :cmd:`Ltac2 Set` has been extended with the ability to
+ give a name to the old value so as to be able to reuse it inside the
+ new one
+ (`#11503 <https://github.com/coq/coq/pull/11503>`_,
+ by Pierre-Marie Pédrot).
diff --git a/doc/changelog/05-tactic-language/12254-wit-ref-dyn.rst b/doc/changelog/05-tactic-language/12254-wit-ref-dyn.rst
new file mode 100644
index 0000000000..69632fd202
--- /dev/null
+++ b/doc/changelog/05-tactic-language/12254-wit-ref-dyn.rst
@@ -0,0 +1,5 @@
+- **Changed:**
+ The "reference" tactic generic argument now accepts arbitrary
+ variables of the goal context
+ (`#12254 <https://github.com/coq/coq/pull/12254>`_,
+ by Pierre-Marie Pédrot).
diff --git a/doc/changelog/07-commands-and-options/11828-obligations+depr_hide_obligation.rst b/doc/changelog/07-commands-and-options/11828-obligations+depr_hide_obligation.rst
new file mode 100644
index 0000000000..5ab2941446
--- /dev/null
+++ b/doc/changelog/07-commands-and-options/11828-obligations+depr_hide_obligation.rst
@@ -0,0 +1,9 @@
+- **Deprecated:**
+ Option :flag:`Hide Obligations` has been deprecated
+ (`#11828 <https://github.com/coq/coq/pull/11828>`_,
+ by Emilio Jesus Gallego Arias).
+
+- **Removed:**
+ Deprecated option ``Shrink Obligations`` has been removed
+ (`#11828 <https://github.com/coq/coq/pull/11828>`_,
+ by Emilio Jesus Gallego Arias).
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
deleted file mode 100644
index 0f30b5f5e8..0000000000
--- a/doc/changelog/07-commands-and-options/12070-native-compiler-disabled.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-- **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/07-commands-and-options/12296-master+fix12234-show-proof-proper.rst b/doc/changelog/07-commands-and-options/12296-master+fix12234-show-proof-proper.rst
new file mode 100644
index 0000000000..dc71a27eb8
--- /dev/null
+++ b/doc/changelog/07-commands-and-options/12296-master+fix12234-show-proof-proper.rst
@@ -0,0 +1,5 @@
+- **Fixed:**
+ Anomalies with :cmd:`Show Proof`
+ (`#12296 <https://github.com/coq/coq/pull/12296>`_,
+ by Hugo Herbelin; fixes
+ `#12234 <https://github.com/coq/coq/pull/12234>`_).
diff --git a/doc/changelog/08-tools/11851-coqc-flags-fix.rst b/doc/changelog/08-tools/11851-coqc-flags-fix.rst
index a07e48d2d8..ff736641b4 100644
--- a/doc/changelog/08-tools/11851-coqc-flags-fix.rst
+++ b/doc/changelog/08-tools/11851-coqc-flags-fix.rst
@@ -1,6 +1,9 @@
- **Changed:**
- The order in which the require/load flags `-l`, `-ri`, `-re`, `-rfrom`, etc.
- and the option set flags `-set`, `-unset` are processed have been reversed.
- In the new behavior, require/load flags are processed before option flags.
- (`#11851 <https://github.com/coq/coq/pull/11851>`_,
+ The order in which the require flags `-ri`, `-re`, `-rfrom`, etc.
+ and the option flags `-set`, `-unset` are given now matters. In
+ particular, it is now possible to interleave the loading of plugins
+ and the setting of options by choosing the right order for these
+ flags. The load flags `-l` and `-lv` are still processed afterward
+ for now (`#11851 <https://github.com/coq/coq/pull/11851>`_ and
+ `#12097 <https://github.com/coq/coq/pull/12097>`_,
by Lasse Blaauwbroek).
diff --git a/doc/changelog/09-coqide/12060-ide-disable-csd.rst b/doc/changelog/09-coqide/12060-ide-disable-csd.rst
deleted file mode 100644
index b61ab26007..0000000000
--- a/doc/changelog/09-coqide/12060-ide-disable-csd.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-- **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
deleted file mode 100644
index 6b1148a9a8..0000000000
--- a/doc/changelog/09-coqide/12106-master+coqide-style-apply-all-windows.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-- **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
index be15fbf8f5..be54e45808 100644
--- a/doc/changelog/10-standard-library/11249-ollibs-list-changelog.rst
+++ b/doc/changelog/10-standard-library/11249-ollibs-list-changelog.rst
@@ -7,11 +7,12 @@
- 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 ``incl``: ``incl_nil_l``, ``incl_l_nil``, ``incl_cons_inv``, ``incl_app_app``, ``incl_app_inv``, ``remove_incl``, ``incl_map``, ``incl_filter``, ``incl_Forall_in_iff``
+ - properties of ``NoDup`` and ``nodup``: ``NoDup_rev``, ``NoDup_filter``, ``nodup_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``
+ - misc: ``elt_eq_unit``, ``last_length``, ``rev_eq_app``, ``removelast_firstn_len``, ``cons_seq``, ``seq_S``
- (`#11249 <https://github.com/coq/coq/pull/11249>`_,
+ (`#11249 <https://github.com/coq/coq/pull/11249>`_, `#12237 <https://github.com/coq/coq/pull/12237>`_,
by Olivier Laurent).
diff --git a/doc/changelog/10-standard-library/12008-ollibs-bool.rst b/doc/changelog/10-standard-library/12008-ollibs-bool.rst
index 7c10d261a7..42e5eb96eb 100644
--- a/doc/changelog/10-standard-library/12008-ollibs-bool.rst
+++ b/doc/changelog/10-standard-library/12008-ollibs-bool.rst
@@ -1,5 +1,5 @@
- **Added:**
- Order relations ``ltb`` and ``compareb`` added in ``Bool.Bool``.
+ Order relations ``lt`` and ``compare`` added in ``Bool.Bool``.
Order properties for ``bool`` added in ``Bool.BoolOrder`` as well as two modules ``Bool_as_OT`` and ``Bool_as_DT`` in ``Structures.OrdersEx``
(`#12008 <https://github.com/coq/coq/pull/12008>`_,
by Olivier Laurent).
diff --git a/doc/changelog/10-standard-library/12121-master+fix11903-warn-non-truly-fixpoint.rst b/doc/changelog/10-standard-library/12121-master+fix11903-warn-non-truly-fixpoint.rst
new file mode 100644
index 0000000000..f22fff0736
--- /dev/null
+++ b/doc/changelog/10-standard-library/12121-master+fix11903-warn-non-truly-fixpoint.rst
@@ -0,0 +1,5 @@
+- **Fixed:**
+ :cmd:`Fixpoint`\s of the standard library without a recursive call turned
+ into ordinary :cmd:`Definition`\s
+ (`#12121 <https://github.com/coq/coq/pull/12121>`_,
+ by Hugo Herbelin; fixes `#11903 <https://github.com/coq/coq/pull/11903>`_).
diff --git a/doc/changelog/10-standard-library/12162-bool-leb.rst b/doc/changelog/10-standard-library/12162-bool-leb.rst
new file mode 100644
index 0000000000..6a4070a82e
--- /dev/null
+++ b/doc/changelog/10-standard-library/12162-bool-leb.rst
@@ -0,0 +1,4 @@
+- **Deprecated:**
+ ``Bool.leb`` in favor of ``Bool.le``. The definition of ``Bool.le`` is made local to avoid conflicts with ``Nat.le``. As a consequence, previous calls to ``leb`` based on importing ``Bool`` should now be qualified into ``Bool.le`` even if ``Bool`` is imported.
+ (`#12162 <https://github.com/coq/coq/pull/12162>`_,
+ by Olivier Laurent).
diff --git a/doc/changelog/10-standard-library/12263-fix-haskell-extraction.rst b/doc/changelog/10-standard-library/12263-fix-haskell-extraction.rst
new file mode 100644
index 0000000000..c80a070181
--- /dev/null
+++ b/doc/changelog/10-standard-library/12263-fix-haskell-extraction.rst
@@ -0,0 +1,9 @@
+- **Fixed:**
+ In Haskell extraction with ``ExtrHaskellString``, equality comparisons on
+ strings and characters are now guaranteed to be uniquely well-typed, even in
+ very polymorphic contexts under ``unsafeCoerce``; this is achieved by adding
+ type annotations to the extracted code, and by making ``ExtrHaskellString``
+ export ``ExtrHaskellBasic`` (`#12263
+ <https://github.com/coq/coq/pull/12263>`_, fixes `#12257
+ <https://github.com/coq/coq/issues/12257>`_ and `#12258
+ <https://github.com/coq/coq/issues/12258>`_, by Jason Gross).
diff --git a/doc/plugin_tutorial/tuto1/src/simple_declare.ml b/doc/plugin_tutorial/tuto1/src/simple_declare.ml
index b94b1fc657..e9e866c5fb 100644
--- a/doc/plugin_tutorial/tuto1/src/simple_declare.ml
+++ b/doc/plugin_tutorial/tuto1/src/simple_declare.ml
@@ -1,6 +1,6 @@
let declare_definition ~poly name sigma body =
let udecl = UState.default_univ_decl in
- let scope = DeclareDef.Global Declare.ImportDefaultBehavior in
+ let scope = Declare.Global Declare.ImportDefaultBehavior in
let kind = Decls.(IsDefinition Definition) in
- DeclareDef.declare_definition ~name ~scope ~kind ~impargs:[] ~udecl
+ Declare.declare_definition ~name ~scope ~kind ~impargs:[] ~udecl
~opaque:false ~poly ~types:None ~body sigma
diff --git a/doc/sphinx/_templates/versions.html b/doc/sphinx/_templates/versions.html
new file mode 100644
index 0000000000..967d00d2bf
--- /dev/null
+++ b/doc/sphinx/_templates/versions.html
@@ -0,0 +1,48 @@
+{# Forked from versions.html in sphinx_rtd_theme 0.4.3 #}
+
+{#
+The MIT License (MIT)
+
+Copyright (c) 2013-2018 Dave Snider, Read the Docs, Inc. & contributors
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#}
+
+{% if not READTHEDOCS %}
+ <div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="versions">
+ <span class="rst-current-version" data-toggle="rst-current-version">
+ <span class="fa fa-book"> Other versions</span>
+ v: {{ version }}
+ <span class="fa fa-caret-down"></span>
+ </span>
+ <div class="rst-other-versions">
+ <dl>
+ <dt>{{ _('Versions') }}</dt>
+ {% for slug, url in versions %}
+ <dd><a href="{{ url }}">{{ slug }}</a></dd>
+ {% endfor %}
+ </dl>
+ <dl>
+ <dt>{{ _('Downloads') }}</dt>
+ {% for type, url in downloads %}
+ <dd><a href="{{ url }}">{{ type }}</a></dd>
+ {% endfor %}
+ </dl>
+ </div>
+ </div>
+{% endif %}
diff --git a/doc/sphinx/addendum/program.rst b/doc/sphinx/addendum/program.rst
index 52862dea47..b5618c5721 100644
--- a/doc/sphinx/addendum/program.rst
+++ b/doc/sphinx/addendum/program.rst
@@ -342,17 +342,11 @@ optional tactic is replaced by the default one if not specified.
.. flag:: Hide Obligations
+ .. deprecated:: 8.12
+
Controls whether obligations appearing in the
term should be hidden as implicit arguments of the special
- constantProgram.Tactics.obligation.
-
-.. flag:: Shrink Obligations
-
- .. deprecated:: 8.7
-
- This flag (on by default) controls whether obligations should have
- their context minimized to the set of variables used in the proof of
- the obligation, to avoid unnecessary dependencies.
+ constant ``Program.Tactics.obligation``.
The module :g:`Coq.Program.Tactics` defines the default tactic for solving
obligations called :g:`program_simpl`. Importing :g:`Coq.Program.Program` also
diff --git a/doc/sphinx/changes.rst b/doc/sphinx/changes.rst
index 453b8597f9..5954ded67f 100644
--- a/doc/sphinx/changes.rst
+++ b/doc/sphinx/changes.rst
@@ -701,6 +701,59 @@ Changes in 8.11.1
(`#11329 <https://github.com/coq/coq/pull/11329>`_,
by Hugo Herbelin, fixes `#11114 <https://github.com/coq/coq/pull/11114>`_).
+Changes in 8.11.2
+~~~~~~~~~~~~~~~~~
+
+**Kernel**
+
+- **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).
+
+**Tactics**
+
+- **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>`_)
+- **Fixed:**
+ Loss of location of some tactic errors
+ (`#12223 <https://github.com/coq/coq/pull/12223>`_,
+ by Hugo Herbelin; fixes
+ `#12152 <https://github.com/coq/coq/pull/12152>`_ and
+ `#12255 <https://github.com/coq/coq/pull/12255>`_).
+
+**Commands and options**
+
+- **Changed:**
+ Ignore -native-compiler option when built without native compute
+ support.
+ (`#12070 <https://github.com/coq/coq/pull/12070>`_,
+ by Pierre Roux).
+
+**CoqIDE**
+
+- **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).
+- **Fixed:**
+ New patch presumably fixing the random Coq 8.11 segfault issue with CoqIDE completion
+ (`#12068 <https://github.com/coq/coq/pull/12068>`_,
+ by Hugo Herbelin, presumably fixing
+ `#11943 <https://github.com/coq/coq/pull/11943>`_).
+- **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>`_).
+
Version 8.10
------------
diff --git a/doc/sphinx/conf.py b/doc/sphinx/conf.py
index dbe582df95..4136b406de 100755
--- a/doc/sphinx/conf.py
+++ b/doc/sphinx/conf.py
@@ -202,6 +202,7 @@ html_theme = 'sphinx_rtd_theme'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
+PDF_URL = "https://github.com/coq/coq/releases/download/V{version}/coq-{version}-reference-manual.pdf"
html_theme_options = {
'collapse_navigation': False
}
@@ -210,7 +211,26 @@ html_context = {
'github_user': 'coq',
'github_repo': 'coq',
'github_version': 'master',
- 'conf_py_path': '/doc/sphinx/'
+ 'conf_py_path': '/doc/sphinx/',
+ # Versions and downloads listed in the versions menu (see _templates/versions.html)
+ 'versions': [
+ ("master", "https://coq.github.io/doc/master/refman/"),
+ ("stable", "https://coq.inria.fr/distrib/current/refman/"),
+ ("v8.11", "https://coq.github.io/doc/v8.11/refman/"),
+ ("v8.10", "https://coq.github.io/doc/v8.10/refman/"),
+ ("v8.9", "https://coq.github.io/doc/v8.9/refman/"),
+ ("8.8", "https://coq.inria.fr/distrib/V8.8.2/refman/"),
+ ("8.7", "https://coq.inria.fr/distrib/V8.7.2/refman/"),
+ ("8.6", "https://coq.inria.fr/distrib/V8.6.1/refman/"),
+ ("8.5", "https://coq.inria.fr/distrib/V8.5pl3/refman/"),
+ ("8.4", "https://coq.inria.fr/distrib/V8.4pl6/refman/"),
+ ("8.3", "https://coq.inria.fr/distrib/V8.3pl5/refman/"),
+ ("8.2", "https://coq.inria.fr/distrib/V8.2pl3/refman/"),
+ ("8.1", "https://coq.inria.fr/distrib/V8.1pl6/refman/"),
+ ("8.0", "https://coq.inria.fr/distrib/V8.0/doc/")
+ ],
+ 'downloads': ([("PDF", PDF_URL.format(version=version))]
+ if coq_config.is_a_released_version else [])
}
# Add any paths that contain custom themes here, relative to this directory.
diff --git a/doc/sphinx/language/cic.rst b/doc/sphinx/language/cic.rst
index e5af39c8fb..b125d21a3c 100644
--- a/doc/sphinx/language/cic.rst
+++ b/doc/sphinx/language/cic.rst
@@ -1108,6 +1108,75 @@ between universes for inductive types in the Type hierarchy.
Check infinite_loop (lam (@id Lam)) : False.
+.. example:: Non strictly positive occurrence
+
+ It is less obvious why inductive type definitions with occurences
+ that are positive but not strictly positive are harmful.
+ We will see that in presence of an impredicative type they
+ are unsound:
+
+ .. coqtop:: all
+
+ Fail Inductive A: Type := introA: ((A -> Prop) -> Prop) -> A.
+
+ If we were to accept this definition we could derive a contradiction
+ by creating an injective function from :math:`A → \Prop` to :math:`A`.
+
+ This function is defined by composing the injective constructor of
+ the type :math:`A` with the function :math:`λx. λz. z = x` injecting
+ any type :math:`T` into :math:`T → \Prop`.
+
+ .. coqtop:: none
+
+ Unset Positivity Checking.
+ Inductive A: Type := introA: ((A -> Prop) -> Prop) -> A.
+ Set Positivity Checking.
+
+ .. coqtop:: all
+
+ Definition f (x: A -> Prop): A := introA (fun z => z = x).
+
+ .. coqtop:: in
+
+ Lemma f_inj: forall x y, f x = f y -> x = y.
+ Proof.
+ unfold f; intros ? ? H; injection H.
+ set (F := fun z => z = y); intro HF.
+ symmetry; replace (y = x) with (F y).
+ + unfold F; reflexivity.
+ + rewrite <- HF; reflexivity.
+ Qed.
+
+ The type :math:`A → \Prop` can be understood as the powerset
+ of the type :math:`A`. To derive a contradiction from the
+ injective function :math:`f` we use Cantor's classic diagonal
+ argument.
+
+ .. coqtop:: all
+
+ Definition d: A -> Prop := fun x => exists s, x = f s /\ ~s x.
+ Definition fd: A := f d.
+
+ .. coqtop:: in
+
+ Lemma cantor: (d fd) <-> ~(d fd).
+ Proof.
+ split.
+ + intros [s [H1 H2]]; unfold fd in H1.
+ replace d with s.
+ * assumption.
+ * apply f_inj; congruence.
+ + intro; exists d; tauto.
+ Qed.
+
+ Lemma bad: False.
+ Proof.
+ pose cantor; tauto.
+ Qed.
+
+ This derivation was first presented by Thierry Coquand and Christine
+ Paulin in :cite:`CP90`.
+
.. _Template-polymorphism:
Template polymorphism
diff --git a/doc/sphinx/language/coq-library.rst b/doc/sphinx/language/coq-library.rst
index acdd4408ed..899173a83a 100644
--- a/doc/sphinx/language/coq-library.rst
+++ b/doc/sphinx/language/coq-library.rst
@@ -9,11 +9,11 @@ The |Coq| library
The |Coq| library has two parts:
- * **The basic library**: definitions and theorems for
+ * The :gdef:`prelude`: definitions and theorems for
the most commonly used elementary logical notions and
data types. |Coq| normally loads these files automatically when it starts.
- * **The standard library**: general-purpose libraries with
+ * The :gdef:`standard library`: general-purpose libraries with
definitions and theorems for sets, lists, sorting,
arithmetic, etc. To use these files, users must load them explicitly
with the ``Require`` command (see :ref:`compiled-files`)
@@ -28,8 +28,8 @@ also be browsed at http://coq.inria.fr/stdlib/.
-The basic library
------------------
+The prelude
+-----------
This section lists the basic notions and results which are directly
available in the standard |Coq| system. Most of these constructions
diff --git a/doc/sphinx/language/core/basic.rst b/doc/sphinx/language/core/basic.rst
index 9473cc5a15..aa93b4d21f 100644
--- a/doc/sphinx/language/core/basic.rst
+++ b/doc/sphinx/language/core/basic.rst
@@ -130,30 +130,37 @@ Strings
identified with :production:`string`.
Keywords
- The following character sequences are reserved keywords that cannot be
- used as identifiers::
+ The following character sequences are keywords defined in the main Coq grammar
+ that cannot be used as identifiers (even when starting Coq with the `-noinit`
+ command-line flag)::
_ Axiom CoFixpoint Definition Fixpoint Hypothesis Parameter Prop
- SProp Set Theorem Type Variable as at cofix discriminated else end
+ SProp Set Theorem Type Variable as at cofix else end
fix for forall fun if in let match return then where with
- Note that notations and plugins may define additional keywords.
+ The following are keywords defined in notations or plugins loaded in the :term:`prelude`::
-Other tokens
- The set of
- tokens defined at any given time can vary because the :cmd:`Notation`
- command can define new tokens. A :cmd:`Require` command may load more notation definitions,
- while the end of a :cmd:`Section` may remove notations. Some notations
- are defined in the standard library (see :ref:`thecoqlibrary`) and are generally
- loaded automatically at startup time.
+ IF by exists exists2 using
+
+ Note that loading additional modules or plugins may expand the set of reserved
+ keywords.
- Here are the character sequences that |Coq| directly defines as tokens
- without using :cmd:`Notation`::
+Other tokens
+ The following character sequences are tokens defined in the main Coq grammar
+ (even when starting Coq with the `-noinit` command-line flag)::
- ! #[ % & ' ( () (bfs) (dfs) ) * ** + , - ->
+ ! #[ % & ' ( () ) * + , - ->
. .( .. ... / : ::= := :> :>> ; < <+ <- <:
- <<: <= = => > >-> >= ? @ @{ [ [= ] _
- `( `{ { {| | |- || }
+ <<: <= = => > >-> >= ? @ @{ [ ] _
+ `( `{ { {| | }
+
+ The following character sequences are tokens defined in notations or plugins
+ loaded in the :term:`prelude`::
+
+ ** [= |- || ->
+
+ Note that loading additional modules or plugins may expand the set of defined
+ tokens.
When multiple tokens match the beginning of a sequence of characters,
the longest matching token is used.
diff --git a/doc/sphinx/practical-tools/coq-commands.rst b/doc/sphinx/practical-tools/coq-commands.rst
index 545bba4930..d4ceffac9f 100644
--- a/doc/sphinx/practical-tools/coq-commands.rst
+++ b/doc/sphinx/practical-tools/coq-commands.rst
@@ -151,7 +151,7 @@ and ``coqtop``, unless stated otherwise:
while processing options such as -R and -Q. By default, only the
conventional version control management directories named CVS
and_darcs are excluded.
-:-nois: Start from an empty state instead of loading the Init.Prelude
+:-nois, -noinit: Start from an empty state instead of loading the `Init.Prelude`
module.
:-init-file *file*: Load *file* as the resource file instead of
loading the default resource file from the standard configuration
@@ -163,32 +163,53 @@ and ``coqtop``, unless stated otherwise:
|Coq| script from *file.v*. Write its contents to the standard output as
it is executed.
:-load-vernac-object *qualid*: Load |Coq| compiled library :n:`@qualid`. This
- is equivalent to running :cmd:`Require` :n:`qualid`.
+ is equivalent to running :cmd:`Require` :n:`@qualid`.
+
+ .. _interleave-command-line:
+
+ .. note::
+
+ Note that the relative order of this command-line option and its
+ variants (`-rfrom`, `-ri`, `-re`, etc.) and of the `-set` and
+ `-unset` options matters since the various :cmd:`Require`,
+ :cmd:`Require Import`, :cmd:`Require Export`, :cmd:`Set` and
+ :cmd:`Unset` commands will be executed in the order specified on
+ the command-line.
+
:-rfrom *dirpath* *qualid*: Load |Coq| compiled library :n:`@qualid`.
- This is equivalent to running :n:`From` :n:`@dirpath` :cmd:`Require Import` :n:`@qualid`.
+ This is equivalent to running :cmd:`From <From ... Require>`
+ :n:`@dirpath` :cmd:`Require <From ... Require>` :n:`@qualid`.
+ See the :ref:`note above <interleave-command-line>` regarding the order
+ of command-line options.
:-ri *qualid*, -require-import *qualid*: Load |Coq| compiled library :n:`@qualid` and import it.
This is equivalent to running :cmd:`Require Import` :n:`@qualid`.
+ See the :ref:`note above <interleave-command-line>` regarding the order
+ of command-line options.
:-re *qualid*, -require-export *qualid*: Load |Coq| compiled library :n:`@qualid` and transitively import it.
This is equivalent to running :cmd:`Require Export` :n:`@qualid`.
-:-rifrom *dirpath* *qualid*, -require-import-from *dirpath* *qualid*: Load |Coq| compiled library :n:`@qualid` and import it.
- 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`.
+ See the :ref:`note above <interleave-command-line>` regarding the order
+ of command-line options.
+:-rifrom *dirpath* *qualid*, -require-import-from *dirpath* *qualid*:
+ Load |Coq| compiled library :n:`@qualid` and import it. This is
+ equivalent to running :cmd:`From <From ... Require>` :n:`@dirpath`
+ :cmd:`Require Import <From ... Require>` :n:`@qualid`. See the
+ :ref:`note above <interleave-command-line>` regarding the order of
+ command-line options.
+:-refrom *dirpath* *qualid*, -require-export-from *dirpath* *qualid*:
+ Load |Coq| compiled library :n:`@qualid` and transitively import it.
+ This is equivalent to running :cmd:`From <From ... Require>`
+ :n:`@dirpath` :cmd:`Require Export <From ... Require>` :n:`@qualid`.
+ See the :ref:`note above <interleave-command-line>` regarding the
+ order of command-line options.
:-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
- for `coqtop`, as this behavior is the purpose of ``coqc``.
-:-compile-verbose *file.v*: Deprecated. Use ``coqc -verbose``. Same as -compile but also output the
- content of *file.v* as it is compiled.
:-verbose: Output the content of the input file as it is compiled.
- This option is available for ``coqc`` only; it is the counterpart of
- -compile-verbose.
+ This option is available for ``coqc`` only.
:-vos: Indicate |Coq| to skip the processing of opaque proofs
- (i.e., proofs ending with ``Qed`` or ``Admitted``), output a ``.vos`` files
+ (i.e., proofs ending with :cmd:`Qed` or :cmd:`Admitted`), output a ``.vos`` files
instead of a ``.vo`` file, and to load ``.vos`` files instead of ``.vo`` files
- when interpreting ``Require`` commands.
+ when interpreting :cmd:`Require` commands.
:-vok: Indicate |Coq| to check a file completely, to load ``.vos`` files instead
- of ``.vo`` files when interpreting ``Require`` commands, and to output an empty
+ of ``.vo`` files when interpreting :cmd:`Require` commands, and to output an empty
``.vok`` files upon success instead of writing a ``.vo`` file.
:-w (all|none|w₁,…,wₙ): Configure the display of warnings. This
option expects all, none or a comma-separated list of warning names or
@@ -198,7 +219,7 @@ and ``coqtop``, unless stated otherwise:
the output channel supports ANSI escape sequences.
:-diffs (on|off|removed): *Coqtop only*. Controls highlighting of differences
between proof steps. ``on`` highlights added tokens, ``removed`` highlights both added and
- removed tokens. Requires that ``–color`` is enabled. (see Section
+ removed tokens. Requires that ``-color`` is enabled. (see Section
:ref:`showing_diffs`).
:-beautify: Pretty-print each command to *file.beautified* when
compiling *file.v*, in order to get old-fashioned
@@ -224,17 +245,25 @@ and ``coqtop``, unless stated otherwise:
changes in the auto-generated name scheme. The options are provided to
facilitate tracking down problems.
:-set *string*: Enable flags and set options. *string* should be
- ``Option Name=value``, the value is interpreted according to the
- type of the option. For flags ``Option Name`` is equivalent to
- ``Option Name=true``. For instance ``-set "Universe Polymorphism"``
+ :n:`@setting_name=value`, the value is interpreted according to the
+ type of the option. For flags :n:`@setting_name` is equivalent to
+ :n:`@setting_name=true`. For instance ``-set "Universe Polymorphism"``
will enable :flag:`Universe Polymorphism`. Note that the quotes are
- shell syntax, Coq does not see them. Flags are processed after initialization
- of the document. This includes the `Prelude` if loaded and any libraries loaded
- through the `-l`, `-lv`, `-r`, `-re`, `-ri`, `rfrom`, `-refrom` and `-rifrom`
- options.
+ shell syntax, Coq does not see them.
+ See the :ref:`note above <interleave-command-line>` regarding the order
+ of command-line options.
:-unset *string*: As ``-set`` but used to disable options and flags.
-:-compat *version*: Attempt to maintain some backward-compatibility
- with a previous version.
+ *string* must be :n:`"@setting_name"`.
+ See the :ref:`note above <interleave-command-line>` regarding the order
+ of command-line options.
+:-compat *version*: Load a file that sets a few options to maintain
+ partial backward-compatibility with a previous version. This is
+ equivalent to :cmd:`Require Import` `Coq.Compat.CoqXXX` with `XXX`
+ one of the last three released versions (including the current
+ version). Note that the :ref:`explanations above
+ <interleave-command-line>` regarding the order of command-line
+ options apply, and this could be relevant if you are resetting some
+ of the compatibility options.
:-dump-glob *file*: Dump references for global names in file *file*
(to be used by coqdoc, see :ref:`coqdoc`). By default, if *file.v* is being
compiled, *file.glob* is used.
diff --git a/doc/sphinx/proof-engine/ltac.rst b/doc/sphinx/proof-engine/ltac.rst
index b184311bef..90173d65bf 100644
--- a/doc/sphinx/proof-engine/ltac.rst
+++ b/doc/sphinx/proof-engine/ltac.rst
@@ -57,6 +57,8 @@ mode but it can also be used in toplevel definitions as shown below.
.. note::
+ - The grammar reserves the token ``||``.
+
- The infix tacticals  ``… || …`` ,  ``… + …`` , and  ``… ; …``  are associative.
.. example::
diff --git a/doc/sphinx/proof-engine/ltac2.rst b/doc/sphinx/proof-engine/ltac2.rst
index 35062e0057..1e35160205 100644
--- a/doc/sphinx/proof-engine/ltac2.rst
+++ b/doc/sphinx/proof-engine/ltac2.rst
@@ -213,25 +213,63 @@ There is dedicated syntax for list and array literals.
Ltac Definitions
~~~~~~~~~~~~~~~~
-.. cmd:: Ltac2 {? mutable} {? rec} @lident := @ltac2_term
+.. cmd:: Ltac2 {? mutable} {? rec} @lident := @ltac2_value
:name: Ltac2
This command defines a new global Ltac2 value.
- For semantic reasons, the body of the Ltac2 definition must be a syntactical
- value, that is, a function, a constant or a pure constructor recursively applied to
- values.
+ The body of an Ltac2 definition is required to be a syntactical value
+ that is, a function, a constant, a pure constructor recursively applied to
+ values or a (non-recursive) let binding of a value in a value.
+
+ .. productionlist:: coq
+ ltac2_value: fun `ltac2_var` => `ltac2_term`
+ : `ltac2_qualid`
+ : `ltac2_constructor` `ltac2_value` ... `ltac2_value`
+ : `ltac2_var`
+ : let `ltac2_var` := `ltac2_value` in `ltac2_value`
If ``rec`` is set, the tactic is expanded into a recursive binding.
If ``mutable`` is set, the definition can be redefined at a later stage (see below).
-.. cmd:: Ltac2 Set @qualid := @ltac2_term
+.. cmd:: Ltac2 Set @qualid {? as @lident} := @ltac2_term
:name: Ltac2 Set
This command redefines a previous ``mutable`` definition.
Mutable definitions act like dynamic binding, i.e. at runtime, the last defined
value for this entry is chosen. This is useful for global flags and the like.
+ The previous value of the binding can be optionally accessed using the `as`
+ binding syntax.
+
+ .. example:: Dynamic nature of mutable cells
+
+ .. coqtop:: all
+
+ Ltac2 mutable x := true.
+ Ltac2 y := x.
+ Ltac2 Eval y.
+ Ltac2 Set x := false.
+ Ltac2 Eval y.
+
+ .. example:: Interaction with recursive calls
+
+
+ .. coqtop:: all
+
+ Ltac2 mutable rec f b := match b with true => 0 | _ => f true end.
+ Ltac2 Set f := fun b =>
+ match b with true => 1 | _ => f true end.
+ Ltac2 Eval (f false).
+ Ltac2 Set f as oldf := fun b =>
+ match b with true => 2 | _ => oldf false end.
+ Ltac2 Eval (f false).
+
+ In the definition, the `f` in the body is resolved statically
+ because the definition is marked recursive. In the first re-definition,
+ the `f` in the body is resolved dynamically. This is witnessed by
+ the second re-definition.
+
Reduction
~~~~~~~~~
diff --git a/doc/sphinx/proof-engine/proof-handling.rst b/doc/sphinx/proof-engine/proof-handling.rst
index 3b5233502d..cf4d432f64 100644
--- a/doc/sphinx/proof-engine/proof-handling.rst
+++ b/doc/sphinx/proof-engine/proof-handling.rst
@@ -90,9 +90,7 @@ list of assertion commands is given in :ref:`Assertions`. The command
.. cmd:: Save @ident
:name: Save
- Forces the name of the original goal to be :token:`ident`. This
- command can only be used if the original goal
- was opened using the :cmd:`Goal` command.
+ Forces the name of the original goal to be :token:`ident`.
.. cmd:: Admitted
@@ -821,7 +819,7 @@ in compacted hypotheses:
..
.. image:: ../_static/diffs-coqide-compacted.png
- :alt: coqide with Set Diffs on with compacted hyptotheses
+ :alt: coqide with Set Diffs on with compacted hypotheses
Controlling the effect of proof editing commands
------------------------------------------------
diff --git a/doc/sphinx/proof-engine/ssreflect-proof-language.rst b/doc/sphinx/proof-engine/ssreflect-proof-language.rst
index 28c5359a04..4be18ccda9 100644
--- a/doc/sphinx/proof-engine/ssreflect-proof-language.rst
+++ b/doc/sphinx/proof-engine/ssreflect-proof-language.rst
@@ -286,7 +286,7 @@ example, the null and all list function(al)s can be defined as follows:
.. coqtop:: all
Variable d: Set.
- Fixpoint null (s : list d) :=
+ Definition null (s : list d) :=
if s is nil then true else false.
Variable a : d -> bool.
Fixpoint all (s : list d) : bool :=
diff --git a/doc/sphinx/proof-engine/tactics.rst b/doc/sphinx/proof-engine/tactics.rst
index 8989dd29ab..ad799fbbcd 100644
--- a/doc/sphinx/proof-engine/tactics.rst
+++ b/doc/sphinx/proof-engine/tactics.rst
@@ -36,6 +36,18 @@ language will be described in Chapter :ref:`ltac`.
Common elements of tactics
--------------------------
+Reserved keywords
+~~~~~~~~~~~~~~~~~
+
+The tactics described in this chapter reserve the following keywords::
+
+ by using
+
+Thus, these keywords cannot be used as identifiers. It also declares
+the following character sequences as tokens::
+
+ ** [= |-
+
.. _invocation-of-tactics:
Invocation of tactics
@@ -2832,6 +2844,11 @@ simply :g:`t=u` dropping the implicit type of :g:`t` and :g:`u`.
If :n:`@ident` is a local definition of the form :n:`@ident := t`, it is also
unfolded and cleared.
+ If :n:`@ident` is a section variable it is expected to have no
+ indirect occurrences in the goal, i.e. that no global declarations
+ implicitly depending on the section variable must be present in the
+ goal.
+
.. note::
+ When several hypotheses have the form :n:`@ident = t` or :n:`t = @ident`, the
first one is used.
@@ -2845,9 +2862,11 @@ simply :g:`t=u` dropping the implicit type of :g:`t` and :g:`u`.
.. tacv:: subst
- This applies subst repeatedly from top to bottom to all identifiers of the
+ This applies :tacn:`subst` repeatedly from top to bottom to all hypotheses of the
context for which an equality of the form :n:`@ident = t` or :n:`t = @ident`
- or :n:`@ident := t` exists, with :n:`@ident` not occurring in ``t``.
+ or :n:`@ident := t` exists, with :n:`@ident` not occurring in
+ ``t`` and :n:`@ident` not a section variable with indirect
+ dependencies in the goal.
.. flag:: Regular Subst Tactic
@@ -2873,6 +2892,15 @@ simply :g:`t=u` dropping the implicit type of :g:`t` and :g:`u`.
hypotheses, which without the flag it may break.
default.
+ .. exn:: Cannot find any non-recursive equality over :n:`@ident`.
+ :undocumented:
+
+ .. exn:: Section variable :n:`@ident` occurs implicitly in global declaration :n:`@qualid` present in hypothesis :n:`@ident`.
+ Section variable :n:`@ident` occurs implicitly in global declaration :n:`@qualid` present in the conclusion.
+
+ Raised when the variable is a section variable with indirect
+ dependencies in the goal.
+
.. tacn:: stepl @term
:name: stepl
@@ -3355,6 +3383,116 @@ the conversion in hypotheses :n:`{+ @ident}`.
This is the most general syntax that combines the different variants.
+.. tacn:: with_strategy @strategy_level_or_var [ {+ @smart_qualid } ] @ltac_expr3
+ :name: with_strategy
+
+ Executes :token:`ltac_expr3`, applying the alternate unfolding
+ behavior that the :cmd:`Strategy` command controls, but only for
+ :token:`ltac_expr3`. This can be useful for guarding calls to
+ reduction in tactic automation to ensure that certain constants are
+ never unfolded by tactics like :tacn:`simpl` and :tacn:`cbn` or to
+ ensure that unfolding does not fail.
+
+ .. example::
+
+ .. coqtop:: all reset abort
+
+ Opaque id.
+ Goal id 10 = 10.
+ Fail unfold id.
+ with_strategy transparent [id] unfold id.
+
+ .. warning::
+
+ Use this tactic with care, as effects do not persist past the
+ end of the proof script. Notably, this fine-tuning of the
+ conversion strategy is not in effect during :cmd:`Qed` nor
+ :cmd:`Defined`, so this tactic is most useful either in
+ combination with :tacn:`abstract`, which will check the proof
+ early while the fine-tuning is still in effect, or to guard
+ calls to conversion in tactic automation to ensure that, e.g.,
+ :tacn:`unfold` does not fail just because the user made a
+ constant :cmd:`Opaque`.
+
+ This can be illustrated with the following example involving the
+ factorial function.
+
+ .. coqtop:: in reset
+
+ Fixpoint fact (n : nat) : nat :=
+ match n with
+ | 0 => 1
+ | S n' => n * fact n'
+ end.
+
+ Suppose now that, for whatever reason, we want in general to
+ unfold the :g:`id` function very late during conversion:
+
+ .. coqtop:: in
+
+ Strategy 1000 [id].
+
+ If we try to prove :g:`id (fact n) = fact n` by
+ :tacn:`reflexivity`, it will now take time proportional to
+ :math:`n!`, because |Coq| will keep unfolding :g:`fact` and
+ :g:`*` and :g:`+` before it unfolds :g:`id`, resulting in a full
+ computation of :g:`fact n` (in unary, because we are using
+ :g:`nat`), which takes time :math:`n!`. We can see this cross
+ the relevant threshold at around :math:`n = 9`:
+
+ .. coqtop:: all abort
+
+ Goal True.
+ Time assert (id (fact 8) = fact 8) by reflexivity.
+ Time assert (id (fact 9) = fact 9) by reflexivity.
+
+ Note that behavior will be the same if you mark :g:`id` as
+ :g:`Opaque` because while most reduction tactics refuse to
+ unfold :g:`Opaque` constants, conversion treats :g:`Opaque` as
+ merely a hint to unfold this constant last.
+
+ We can get around this issue by using :tacn:`with_strategy`:
+
+ .. coqtop:: all
+
+ Goal True.
+ Fail Timeout 1 assert (id (fact 100) = fact 100) by reflexivity.
+ Time assert (id (fact 100) = fact 100) by with_strategy -1 [id] reflexivity.
+
+ However, when we go to close the proof, we will run into
+ trouble, because the reduction strategy changes are local to the
+ tactic passed to :tacn:`with_strategy`.
+
+ .. coqtop:: all abort fail
+
+ exact I.
+ Timeout 1 Defined.
+
+ We can fix this issue by using :tacn:`abstract`:
+
+ .. coqtop:: all
+
+ Goal True.
+ Time assert (id (fact 100) = fact 100) by with_strategy -1 [id] abstract reflexivity.
+ exact I.
+ Time Defined.
+
+ On small examples this sort of behavior doesn't matter, but
+ because |Coq| is a super-linear performance domain in so many
+ places, unless great care is taken, tactic automation using
+ :tacn:`with_strategy` may not be robustly performant when
+ scaling the size of the input.
+
+ .. warning::
+
+ In much the same way this tactic does not play well with
+ :cmd:`Qed` and :cmd:`Defined` without using :tacn:`abstract` as
+ an intermediary, this tactic does not play well with ``coqchk``,
+ even when used with :tacn:`abstract`, due to the inability of
+ tactics to persist information about conversion hints in the
+ proof term. See `#12200
+ <https://github.com/coq/coq/issues/12200>`_ for more details.
+
Conversion tactics applied to hypotheses
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/doc/sphinx/proof-engine/vernacular-commands.rst b/doc/sphinx/proof-engine/vernacular-commands.rst
index 1759264e87..7191444bac 100644
--- a/doc/sphinx/proof-engine/vernacular-commands.rst
+++ b/doc/sphinx/proof-engine/vernacular-commands.rst
@@ -817,13 +817,15 @@ described first.
.. cmd:: Strategy {+ @strategy_level [ {+ @smart_qualid } ] }
- .. insertprodn strategy_level strategy_level
+ .. insertprodn strategy_level strategy_level_or_var
.. prodn::
strategy_level ::= opaque
| @int
| expand
| transparent
+ strategy_level_or_var ::= @strategy_level
+ | @ident
This command accepts the :attr:`local` attribute, which limits its effect
to the current section or module, in which case the section and module
diff --git a/doc/sphinx/user-extensions/syntax-extensions.rst b/doc/sphinx/user-extensions/syntax-extensions.rst
index d72409e0d9..c5ec636d5f 100644
--- a/doc/sphinx/user-extensions/syntax-extensions.rst
+++ b/doc/sphinx/user-extensions/syntax-extensions.rst
@@ -618,6 +618,41 @@ the next command fails because p does not bind in the instance of n.
Notation "[> a , .. , b <]" :=
(cons a .. (cons b nil) .., cons b .. (cons a nil) ..).
+Notations with expressions used both as binder and term
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+It is possible to use parameters of the notation both in term and
+binding position. Here is an example:
+
+.. coqtop:: in
+
+ Definition force n (P:nat -> Prop) := forall n', n' >= n -> P n'.
+ Notation "▢_ n P" := (force n (fun n => P))
+ (at level 0, n ident, P at level 9, format "▢_ n P").
+
+.. coqtop:: all
+
+ Check exists p, ▢_p (p >= 1).
+
+More generally, the parameter can be a pattern, as in the following
+variant:
+
+.. coqtop:: in reset
+
+ Definition force2 q (P:nat*nat -> Prop) :=
+ (forall n', n' >= fst q -> forall p', p' >= snd q -> P q).
+
+ Notation "▢_ p P" := (force2 p (fun p => P))
+ (at level 0, p pattern at level 0, P at level 9, format "▢_ p P").
+
+.. coqtop:: all
+
+ Check exists x y, ▢_(x,y) (x >= 1 /\ y >= 2).
+
+This support is experimental. For instance, the notation is used for
+printing only if the occurrence of the parameter in term position
+comes in the right-hand side before the occurrence in binding position.
+
.. _RecursiveNotations:
Notations with recursive patterns
@@ -1383,6 +1418,17 @@ Abbreviations
exception, if the right-hand side is just of the form :n:`@@qualid`,
this conventionally stops the inheritance of implicit arguments.
+ Like for notations, it is possible to bind binders in
+ abbreviations. Here is an example:
+
+ .. coqtop:: in reset
+
+ Definition force2 q (P:nat*nat -> Prop) :=
+ (forall n', n' >= fst q -> forall p', p' >= snd q -> P q).
+
+ Notation F p P := (force2 p (fun p => P)).
+ Check exists x y, F (x,y) (x >= 1 /\ y >= 2).
+
.. _numeral-notations:
Numeral notations
@@ -1714,6 +1760,11 @@ Tactic notations allow customizing the syntax of tactics.
- a global reference of term
- :tacn:`unfold`
+ * - ``smart_global``
+ - :token:`smart_qualid`
+ - a global reference of term
+ - :tacn:`with_strategy`
+
* - ``constr``
- :token:`term`
- a term
@@ -1734,6 +1785,16 @@ Tactic notations allow customizing the syntax of tactics.
- an integer
- :tacn:`do`
+ * - ``strategy_level``
+ - :token:`strategy_level`
+ - a strategy level
+ -
+
+ * - ``strategy_level_or_var``
+ - :token:`strategy_level_or_var`
+ - a strategy level
+ - :tacn:`with_strategy`
+
* - ``tactic``
- :token:`ltac_expr`
- a tactic
@@ -1766,18 +1827,24 @@ Tactic notations allow customizing the syntax of tactics.
.. todo: notation doesn't support italics
- .. note:: In order to be bound in tactic definitions, each syntactic
- entry for argument type must include the case of a simple |Ltac|
- identifier as part of what it parses. This is naturally the case for
- ``ident``, ``simple_intropattern``, ``reference``, ``constr``, ... but not for ``integer``.
- This is the reason for introducing a special entry ``int_or_var`` which
- evaluates to integers only but which syntactically includes
+ .. note:: In order to be bound in tactic definitions, each
+ syntactic entry for argument type must include the case
+ of a simple |Ltac| identifier as part of what it
+ parses. This is naturally the case for ``ident``,
+ ``simple_intropattern``, ``reference``, ``constr``, ...
+ but not for ``integer`` nor for ``strategy_level``. This
+ is the reason for introducing special entries
+ ``int_or_var`` and ``strategy_level_or_var`` which
+ evaluate to integers or strategy levels only,
+ respectively, but which syntactically includes
identifiers in order to be usable in tactic definitions.
- .. note:: The *entry*\ ``_list*`` and ``ne_``\ *entry*\ ``_list*`` entries can be used in
- primitive tactics or in other notations at places where a list of the
- underlying entry can be used: entry is either ``constr``, ``hyp``, ``integer``
- or ``int_or_var``.
+ .. note:: The *entry*\ ``_list*`` and ``ne_``\ *entry*\ ``_list*``
+ entries can be used in primitive tactics or in other
+ notations at places where a list of the underlying entry
+ can be used: entry is either ``constr``, ``hyp``,
+ ``integer``, ``smart_qualid``, ``strategy_level``,
+ ``strategy_level_or_var``, or ``int_or_var``.
.. rubric:: Footnotes
diff --git a/doc/stdlib/Library.tex b/doc/stdlib/Library.tex
index 44a0b1d361..1a9d4d738f 100644
--- a/doc/stdlib/Library.tex
+++ b/doc/stdlib/Library.tex
@@ -5,6 +5,7 @@
\usepackage[T1]{fontenc}
\usepackage{fullpage}
\usepackage{amsfonts}
+\usepackage{amssymb}
\usepackage{url}
\usepackage[color]{../../coqdoc}
diff --git a/doc/tools/coqrst/coqdoc/main.py b/doc/tools/coqrst/coqdoc/main.py
index a3fc069e6c..de0d912c03 100644
--- a/doc/tools/coqrst/coqdoc/main.py
+++ b/doc/tools/coqrst/coqdoc/main.py
@@ -48,28 +48,22 @@ def coqdoc(coq_code, coqdoc_bin=None):
finally:
os.remove(filename)
-def is_whitespace_string(elem):
- return isinstance(elem, NavigableString) and elem.strip() == ""
-
-def strip_soup(soup, pred):
- """Strip elements matching pred from front and tail of soup."""
- while soup.contents and pred(soup.contents[-1]):
- soup.contents.pop()
-
- skip = 0
- for elem in soup.contents:
- if not pred(elem):
- break
- skip += 1
-
- soup.contents[:] = soup.contents[skip:]
+def first_string_node(node):
+ """Return the first string node, or None if does not exist"""
+ while node.children:
+ node = next(node.children)
+ if isinstance(node, NavigableString):
+ return node
def lex(source):
"""Convert source into a stream of (css_classes, token_string)."""
coqdoc_output = coqdoc(source)
soup = BeautifulSoup(coqdoc_output, "html.parser")
root = soup.find(class_='code')
- strip_soup(root, is_whitespace_string)
+ # strip the leading '\n'
+ first = first_string_node(root)
+ if first and first.string[0] == '\n':
+ first.string.replace_with(first.string[1:])
for elem in root.children:
if isinstance(elem, NavigableString):
yield [], elem
diff --git a/doc/tools/coqrst/coqdomain.py b/doc/tools/coqrst/coqdomain.py
index 9d51d2198a..df11960403 100644
--- a/doc/tools/coqrst/coqdomain.py
+++ b/doc/tools/coqrst/coqdomain.py
@@ -905,9 +905,13 @@ class CoqtopBlocksTransform(Transform):
return isinstance(node, nodes.Element) and 'coqtop_options' in node
@staticmethod
- def split_sentences(source):
- """Split Coq sentences in source. Could be improved."""
- return re.split(r"(?<=(?<!\.)\.)\s+", source)
+ def split_lines(source):
+ """Split Coq input in chunks
+
+ A chunk is a minimal sequence of consecutive lines of the input that
+ ends with a '.'
+ """
+ return re.split(r"(?<=(?<!\.)\.)\s+\n", source)
@staticmethod
def parse_options(node):
@@ -986,7 +990,7 @@ class CoqtopBlocksTransform(Transform):
repl.sendone('Unset Coqtop Exit On Error.')
if options['warn']:
repl.sendone('Set Warnings "default".')
- for sentence in self.split_sentences(node.rawsource):
+ for sentence in self.split_lines(node.rawsource):
pairs.append((sentence, repl.sendone(sentence)))
if options['abort']:
repl.sendone('Abort All.')
diff --git a/doc/tools/docgram/common.edit_mlg b/doc/tools/docgram/common.edit_mlg
index c7e3ee18ad..62cc8ea86b 100644
--- a/doc/tools/docgram/common.edit_mlg
+++ b/doc/tools/docgram/common.edit_mlg
@@ -1839,3 +1839,7 @@ sentence: [
document: [
| LIST0 sentence
]
+
+strategy_level: [
+| DELETE strategy_level0
+]
diff --git a/doc/tools/docgram/fullGrammar b/doc/tools/docgram/fullGrammar
index 4274dccb40..92e9df51d5 100644
--- a/doc/tools/docgram/fullGrammar
+++ b/doc/tools/docgram/fullGrammar
@@ -451,6 +451,14 @@ bar_cbrace: [
| test_pipe_closedcurly "|" "}"
]
+strategy_level: [
+| "expand"
+| "opaque"
+| integer
+| "transparent"
+| strategy_level0
+]
+
vernac_toplevel: [
| "Drop" "."
| "Quit" "."
@@ -1213,13 +1221,6 @@ more_implicits_block: [
| "{" LIST1 name "}"
]
-strategy_level: [
-| "expand"
-| "opaque"
-| integer
-| "transparent"
-]
-
instance_name: [
| ident_decl binders
|
@@ -1598,6 +1599,7 @@ simple_tactic: [
| "guard" test
| "decompose" "[" LIST1 constr "]" constr
| "optimize_heap"
+| "with_strategy" strategy_level_or_var "[" LIST1 smart_global "]" tactic3
| "eassumption"
| "eexact" constr
| "trivial" auto_using hintbases
@@ -1855,6 +1857,11 @@ test_lpar_id_colon: [
| local_test_lpar_id_colon
]
+strategy_level_or_var: [
+| strategy_level
+| identref
+]
+
comparison: [
| "="
| "<"
diff --git a/doc/tools/docgram/orderedGrammar b/doc/tools/docgram/orderedGrammar
index df4e5a22e3..11f06b7b8a 100644
--- a/doc/tools/docgram/orderedGrammar
+++ b/doc/tools/docgram/orderedGrammar
@@ -659,6 +659,11 @@ strategy_level: [
| "transparent"
]
+strategy_level_or_var: [
+| strategy_level
+| ident
+]
+
reserv_list: [
| LIST1 ( "(" simple_reserv ")" )
| simple_reserv
@@ -1234,6 +1239,7 @@ simple_tactic: [
| "guard" int_or_var comparison int_or_var
| "decompose" "[" LIST1 one_term "]" one_term
| "optimize_heap"
+| "with_strategy" strategy_level_or_var "[" LIST1 smart_qualid "]" ltac_expr3
| "start" "ltac" "profiling"
| "stop" "ltac" "profiling"
| "reset" "ltac" "profile"