aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitlab-ci.yml11
-rw-r--r--.mailmap2
-rw-r--r--CONTRIBUTING.md2
-rw-r--r--CREDITS1
-rw-r--r--Makefile.build2
-rw-r--r--Makefile.dev2
-rw-r--r--Makefile.doc2
-rw-r--r--Makefile.dune2
-rw-r--r--Makefile.ide2
-rw-r--r--checker/include2
-rw-r--r--clib/iStream.mli2
-rw-r--r--configure.ml2
-rw-r--r--coqpp/coqpp_main.ml2
-rwxr-xr-xdev/build/windows/MakeCoq_MinGW.bat8
-rw-r--r--dev/build/windows/ReadMe.txt12
-rw-r--r--dev/build/windows/difftar-folder.sh2
-rwxr-xr-xdev/build/windows/makecoq_mingw.sh4
-rwxr-xr-xdev/build/windows/patches_coq/pkg-config.c2
-rw-r--r--dev/ci/README-developers.md2
-rw-r--r--dev/ci/user-overlays/09895-ejgallego-require+upper.sh6
-rw-r--r--dev/ci/user-overlays/10157-SkySkimmer-def-not-visible-generic-warning.sh6
-rw-r--r--dev/ci/user-overlays/10177-SkySkimmer-generalize.sh6
-rw-r--r--dev/ci/user-overlays/10185-SkySkimmer-instance-no-bang.sh6
-rw-r--r--dev/doc/MERGING.md2
-rw-r--r--dev/doc/archive/naming-conventions.tex6
-rw-r--r--dev/doc/archive/versions-history.tex2
-rw-r--r--dev/doc/build-system.dev.txt10
-rw-r--r--dev/doc/build-system.dune.md6
-rw-r--r--dev/doc/build-system.txt6
-rw-r--r--dev/doc/changes.md4
-rw-r--r--dev/doc/econstr.md2
-rw-r--r--dev/doc/proof-engine.md2
-rw-r--r--dev/doc/release-process.md2
-rw-r--r--dev/doc/universes.md4
-rw-r--r--dev/doc/xml-protocol.md2
-rw-r--r--dev/dune4
-rwxr-xr-xdev/dune-dbg.in7
-rwxr-xr-xdev/lint-commits.sh2
-rwxr-xr-xdev/nsis/coq.nsi2
-rw-r--r--dev/tools/coqdev.el29
-rw-r--r--dev/v8-syntax/memo-v8.tex4
-rw-r--r--doc/changelog/07-commands-and-options/10185-instance-no-bang.rst2
-rw-r--r--doc/common/styles/html/coqremote/modules/system/system.css2
-rw-r--r--doc/plugin_tutorial/tuto1/src/simple_declare.ml6
-rw-r--r--doc/plugin_tutorial/tuto3/src/g_tuto3.mlg2
-rw-r--r--doc/sphinx/addendum/extraction.rst2
-rw-r--r--doc/sphinx/addendum/generalized-rewriting.rst116
-rw-r--r--doc/sphinx/addendum/program.rst4
-rw-r--r--doc/sphinx/addendum/ring.rst24
-rw-r--r--doc/sphinx/addendum/type-classes.rst2
-rw-r--r--doc/sphinx/addendum/universe-polymorphism.rst26
-rw-r--r--doc/sphinx/changes.rst30
-rw-r--r--doc/sphinx/history.rst12
-rw-r--r--doc/sphinx/language/gallina-extensions.rst139
-rw-r--r--doc/sphinx/proof-engine/ltac.rst34
-rw-r--r--doc/sphinx/proof-engine/ltac2.rst20
-rw-r--r--doc/sphinx/proof-engine/proof-handling.rst10
-rw-r--r--doc/sphinx/proof-engine/ssreflect-proof-language.rst24
-rw-r--r--doc/sphinx/proof-engine/tactics.rst221
-rw-r--r--doc/sphinx/proof-engine/vernacular-commands.rst29
-rw-r--r--doc/sphinx/user-extensions/syntax-extensions.rst94
-rw-r--r--doc/tools/Translator.tex6
-rw-r--r--doc/tools/coqrst/coqdoc/main.py2
-rw-r--r--doc/tools/coqrst/repl/coqtop.py4
-rw-r--r--doc/whodidwhat/whodidwhat-8.2update.tex2
-rw-r--r--doc/whodidwhat/whodidwhat-8.3update.tex2
-rw-r--r--doc/whodidwhat/whodidwhat-8.4update.tex2
-rw-r--r--doc/whodidwhat/whodidwhat-8.5update.tex2
-rw-r--r--engine/evarutil.ml2
-rw-r--r--engine/evarutil.mli2
-rw-r--r--engine/evd.ml2
-rw-r--r--engine/ftactic.ml4
-rw-r--r--engine/ftactic.mli12
-rw-r--r--engine/logic_monad.ml2
-rw-r--r--engine/proofview.ml10
-rw-r--r--engine/proofview.mli4
-rw-r--r--engine/proofview_monad.ml2
-rw-r--r--engine/proofview_monad.mli2
-rw-r--r--engine/univMinim.ml2
-rw-r--r--gramlib/grammar.ml2
-rw-r--r--ide/configwin_types.ml2
-rw-r--r--ide/idetop.ml6
-rw-r--r--ide/protocol/interface.ml6
-rw-r--r--ide/protocol/richpp.mli2
-rw-r--r--ide/protocol/xml_printer.mli4
-rw-r--r--ide/protocol/xmlprotocol.ml2
-rw-r--r--interp/constrexpr.ml4
-rw-r--r--interp/constrexpr_ops.ml4
-rw-r--r--interp/constrextern.ml2
-rw-r--r--interp/constrintern.ml14
-rw-r--r--interp/declare.ml74
-rw-r--r--interp/declare.mli5
-rw-r--r--interp/impargs.ml4
-rw-r--r--interp/impargs.mli6
-rw-r--r--interp/implicit_quantifiers.ml59
-rw-r--r--interp/syntax_def.ml2
-rw-r--r--kernel/byterun/coq_memory.c2
-rw-r--r--kernel/cClosure.ml6
-rw-r--r--kernel/cClosure.mli4
-rw-r--r--kernel/cbytegen.ml2
-rw-r--r--kernel/cbytegen.mli2
-rw-r--r--kernel/constr.mli2
-rw-r--r--kernel/cooking.ml6
-rw-r--r--kernel/cooking.mli8
-rw-r--r--kernel/declarations.ml14
-rw-r--r--kernel/declareops.mli12
-rw-r--r--kernel/environ.ml4
-rw-r--r--kernel/environ.mli16
-rw-r--r--kernel/inductive.ml2
-rw-r--r--kernel/mod_typing.ml2
-rw-r--r--kernel/modops.ml2
-rw-r--r--kernel/nativecode.mli2
-rw-r--r--kernel/opaqueproof.ml5
-rw-r--r--kernel/opaqueproof.mli1
-rw-r--r--kernel/safe_typing.ml152
-rw-r--r--kernel/safe_typing.mli11
-rw-r--r--kernel/subtyping.ml2
-rw-r--r--kernel/term_typing.ml54
-rw-r--r--kernel/term_typing.mli8
-rw-r--r--kernel/uint63.mli2
-rw-r--r--kernel/univ.ml2
-rw-r--r--kernel/univ.mli2
-rw-r--r--kernel/vmvalues.ml2
-rw-r--r--lib/cProfile.mli2
-rw-r--r--lib/envars.mli2
-rw-r--r--lib/feedback.mli2
-rw-r--r--lib/flags.mli2
-rw-r--r--lib/pp.mli2
-rw-r--r--lib/pp_diff.mli2
-rw-r--r--lib/spawn.mli2
-rw-r--r--library/declaremods.ml2
-rw-r--r--library/global.ml3
-rw-r--r--library/global.mli7
-rw-r--r--library/lib.ml3
-rw-r--r--library/lib.mli1
-rw-r--r--library/libnames.ml3
-rw-r--r--library/libnames.mli3
-rw-r--r--library/library.ml126
-rw-r--r--library/library.mli27
-rw-r--r--library/library.mllib1
-rw-r--r--library/loadpath.ml119
-rw-r--r--library/nametab.mli2
-rw-r--r--library/summary.mli2
-rw-r--r--man/coqdep.12
-rw-r--r--parsing/g_constr.mlg4
-rw-r--r--parsing/pcoq.ml2
-rw-r--r--plugins/extraction/CHANGES2
-rw-r--r--plugins/extraction/ExtrOcamlBasic.v4
-rw-r--r--plugins/extraction/common.ml6
-rw-r--r--plugins/extraction/extraction.mli4
-rw-r--r--plugins/extraction/g_extraction.mlg2
-rw-r--r--plugins/extraction/table.ml8
-rw-r--r--plugins/extraction/table.mli8
-rw-r--r--plugins/funind/functional_principles_proofs.ml2
-rw-r--r--plugins/funind/functional_principles_types.ml6
-rw-r--r--plugins/funind/glob_term_to_relation.ml4
-rw-r--r--plugins/funind/glob_termops.mli2
-rw-r--r--plugins/funind/indfun.ml2
-rw-r--r--plugins/funind/indfun_common.ml4
-rw-r--r--plugins/funind/invfun.ml6
-rw-r--r--plugins/funind/recdef.ml2
-rw-r--r--plugins/ltac/rewrite.ml27
-rw-r--r--plugins/ltac/tacexpr.ml2
-rw-r--r--plugins/ltac/tacexpr.mli2
-rw-r--r--plugins/ltac/tacinterp.ml4
-rw-r--r--plugins/ltac/tactic_matching.ml2
-rw-r--r--plugins/micromega/DeclConstant.v1
-rw-r--r--plugins/micromega/MExtraction.v2
-rw-r--r--plugins/micromega/OrderedRing.v2
-rw-r--r--plugins/micromega/RingMicromega.v2
-rw-r--r--plugins/micromega/ZMicromega.v15
-rw-r--r--plugins/micromega/coq_micromega.ml152
-rw-r--r--plugins/micromega/micromega.ml40
-rw-r--r--plugins/micromega/micromega.mli140
-rw-r--r--plugins/micromega/persistent_cache.ml2
-rw-r--r--plugins/micromega/persistent_cache.mli2
-rw-r--r--plugins/micromega/sos_lib.ml2
-rw-r--r--plugins/nsatz/nsatz.ml2
-rw-r--r--plugins/nsatz/polynom.ml4
-rw-r--r--plugins/omega/PreOmega.v9
-rw-r--r--plugins/ssr/ssrbool.v18
-rw-r--r--plugins/ssr/ssreflect.v16
-rw-r--r--plugins/ssr/ssrelim.ml2
-rw-r--r--plugins/ssr/ssrequality.ml4
-rw-r--r--plugins/ssrmatching/ssrmatching.mli2
-rw-r--r--pretyping/cbv.ml2
-rw-r--r--printing/ppconstr.ml3
-rw-r--r--stm/asyncTaskQueue.ml2
-rw-r--r--stm/stm.ml21
-rw-r--r--stm/stm.mli15
-rw-r--r--stm/vernac_classifier.ml4
-rw-r--r--stm/vio_checking.ml31
-rw-r--r--tactics/abstract.ml5
-rw-r--r--tactics/ind_tables.ml13
-rw-r--r--tactics/tactics.ml101
-rw-r--r--test-suite/bugs/closed/bug_10176.v7
-rw-r--r--test-suite/micromega/bug_10158.v48
-rw-r--r--test-suite/micromega/rsyntax.v10
-rwxr-xr-xtest-suite/misc/changelog.sh6
-rw-r--r--test-suite/output/MExtraction.v4
-rw-r--r--theories/Classes/CRelationClasses.v2
-rw-r--r--theories/Classes/EquivDec.v6
-rw-r--r--theories/Classes/RelationClasses.v4
-rw-r--r--toplevel/ccompile.ml56
-rw-r--r--toplevel/coqargs.ml10
-rw-r--r--toplevel/coqargs.mli6
-rw-r--r--toplevel/coqcargs.ml32
-rw-r--r--toplevel/coqinit.ml16
-rw-r--r--toplevel/coqinit.mli4
-rw-r--r--toplevel/coqtop.ml2
-rw-r--r--toplevel/usage.ml16
-rw-r--r--user-contrib/Ltac2/Constr.v6
-rw-r--r--user-contrib/Ltac2/Pattern.v2
-rw-r--r--user-contrib/Ltac2/tac2expr.mli2
-rw-r--r--user-contrib/Ltac2/tac2intern.mli2
-rw-r--r--user-contrib/Ltac2/tac2match.ml2
-rw-r--r--vernac/classes.ml34
-rw-r--r--vernac/classes.mli45
-rw-r--r--vernac/comAssumption.ml26
-rw-r--r--vernac/comAssumption.mli9
-rw-r--r--vernac/comDefinition.ml4
-rw-r--r--vernac/comDefinition.mli3
-rw-r--r--vernac/comFixpoint.ml4
-rw-r--r--vernac/declareDef.ml13
-rw-r--r--vernac/declareDef.mli6
-rw-r--r--vernac/g_vernac.mlg8
-rw-r--r--vernac/loadpath.ml273
-rw-r--r--vernac/loadpath.mli (renamed from library/loadpath.mli)68
-rw-r--r--vernac/mltop.ml72
-rw-r--r--vernac/mltop.mli24
-rw-r--r--vernac/obligations.ml10
-rw-r--r--vernac/ppvernac.ml6
-rw-r--r--vernac/vernac.mllib1
-rw-r--r--vernac/vernacentries.ml77
-rw-r--r--vernac/vernacexpr.ml16
235 files changed, 1955 insertions, 1593 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 9e96d3602b..536bd0af76 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -121,7 +121,7 @@ before_script:
OPAM_VARIANT: "+flambda"
artifacts:
name: "$CI_JOB_NAME"
- expire_in: 1 month
+ expire_in: 2 months
# every non build job must set dependencies otherwise all build
# artifacts are used together and we may get some random Coq. To that
@@ -140,6 +140,7 @@ before_script:
name: "$CI_JOB_NAME"
paths:
- _install_ci/share/doc/coq/
+ expire_in: 2 months
# set dependencies when using
.test-suite-template:
@@ -159,6 +160,8 @@ before_script:
when: on_failure
paths:
- test-suite/logs
+ # Gitlab doesn't support yet "expire_in: never" so we use the instance default
+ # expire_in: never
variables:
timeout: ""
@@ -177,7 +180,7 @@ before_script:
name: "$CI_JOB_NAME.logs"
paths:
- coqchk.log
- expire_in: 1 month
+ expire_in: 2 months
.ci-template:
stage: test
@@ -341,6 +344,8 @@ pkg:opam:
when: on_failure
paths:
- nix-build-coq.drv-0/*/test-suite/logs
+ # Gitlab doesn't support yet "expire_in: never" so we use the instance default
+ # expire_in: never
pkg:nix:deploy:
extends: .nix-template
@@ -465,6 +470,8 @@ test-suite:egde:dune:dev:
when: on_failure
paths:
- _build/default/test-suite/logs
+ # Gitlab doesn't support yet "expire_in: never" so we use the instance default
+ # expire_in: never
test-suite:edge+trunk+make:
stage: test
diff --git a/.mailmap b/.mailmap
index 18155a3d28..07e9f70bc9 100644
--- a/.mailmap
+++ b/.mailmap
@@ -6,7 +6,7 @@
## To avoid spam issues, we use by default a pseudo-email <login@gforge>
## for all persons that haven't made commits with real emails
##
-## If you're mentionned here and want to update your information,
+## If you're mentioned here and want to update your information,
## either amend this file and commit it, or contact the coqdev list
Abhishek Anand <abhishek.anand.iitg@gmail.com> Abhishek Anand (@brixpro-home) <abhishek.anand.iitg@gmail.com>
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 31fa3d2c4a..e811c116b6 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -31,7 +31,7 @@ account). You can file a bug for any of the following:
It would help if you search the existing issues before reporting a bug. This
can be difficult, so consider it extra credit. We don't mind duplicate bug
reports. If unsure, you are always very welcome to ask on our [Discourse forum][]
-or [Gitter chat][] before, after, or while writting a bug report
+or [Gitter chat][] before, after, or while writing a bug report
When it applies, it's extremely helpful for bug reports to include sample
code, and much better if the code is self-contained and complete. It's not
diff --git a/CREDITS b/CREDITS
index f871dba8b3..9b5c1507f5 100644
--- a/CREDITS
+++ b/CREDITS
@@ -170,6 +170,7 @@ of the Coq Proof assistant during the indicated time:
Nickolai Zeldovich (MIT 2014-2016)
Théo Zimmermann (ORCID: https://orcid.org/0000-0002-3580-8806,
INRIA-PPS then IRIF, 2015-now)
+ Talia Ringer (UW, 2019)
***************************************************************************
INRIA refers to:
diff --git a/Makefile.build b/Makefile.build
index 034c9ea03c..147668187f 100644
--- a/Makefile.build
+++ b/Makefile.build
@@ -150,7 +150,7 @@ endif
###########################################################################
-# This include below will lauch the build of all .d.
+# This include below will launch the build of all .d.
# The - at front is for disabling warnings about currently missing ones.
# For creating the missing .d, make will recursively build things like
# coqdep_boot (for the .v.d files) or coqpp (for .mlg -> .ml -> .ml.d).
diff --git a/Makefile.dev b/Makefile.dev
index 13b85dfad4..6057696375 100644
--- a/Makefile.dev
+++ b/Makefile.dev
@@ -8,7 +8,7 @@
## # (see LICENSE file for the text of the license) ##
##########################################################################
-# Extra targets for developpers :
+# Extra targets for developers :
# debug printers, revision, partial targets ...
#########################
diff --git a/Makefile.doc b/Makefile.doc
index 25d146000b..94642e702f 100644
--- a/Makefile.doc
+++ b/Makefile.doc
@@ -167,7 +167,7 @@ doc/stdlib/Library.pdf: $(DOCCOMMON) doc/stdlib/Library.coqdoc.tex doc/stdlib/Li
$(PDFLATEX) -interaction=batchmode Library;\
../tools/show_latex_messages -no-overfull Library.log)
-### Standard library (full version if you're crazy enouth to try)
+### Standard library (full version if you're crazy enough to try)
doc/stdlib/FullLibrary.tex: doc/stdlib/Library.tex
sed -e 's/Library.coqdoc/FullLibrary.coqdoc/g;s/\\begin{document}/\\newcommand{\\textlambda}{\\ensuremath{\\lambda}}\\newcommand{\\textPi}{\\ensuremath{\\Pi}}\\begin{document}/' $< > $@
diff --git a/Makefile.dune b/Makefile.dune
index ebf74978a9..88055d62dc 100644
--- a/Makefile.dune
+++ b/Makefile.dune
@@ -5,7 +5,7 @@
.PHONY: coq coqide coqide-server # Package targets
.PHONY: quickbyte quickopt quickide # Partial / quick developer targets
.PHONY: refman-html stdlib-html apidoc # Documentation targets
-.PHONY: test-suite release # Accesory targets
+.PHONY: test-suite release # Accessory targets
.PHONY: ocheck trunk ireport clean # Maintenance targets
# use DUNEOPT=--display=short for a more verbose build
diff --git a/Makefile.ide b/Makefile.ide
index 4cec7aa443..89c1f246db 100644
--- a/Makefile.ide
+++ b/Makefile.ide
@@ -77,7 +77,7 @@ ADWAITASHARE=$(shell ls -d /usr/local/Cellar/adwaita-icon-theme/*)/share
.PHONY: coqide coqide-opt coqide-byte coqide-bindings coqide-files coqide-binaries
.PHONY: ide-toploop ide-byteloop ide-optloop
-# target to build CoqIde (native version) and the stuff needed to lauch it
+# target to build CoqIde (native version) and the stuff needed to launch it
coqide: coqide-files coqide-opt theories/Init/Prelude.$(VO) $(TOPBIN)
# target to build CoqIde (in native and byte versions), and no more
diff --git a/checker/include b/checker/include
index 3ffc301724..411321cb3e 100644
--- a/checker/include
+++ b/checker/include
@@ -3,7 +3,7 @@
(* Caml script to include for debugging the checker.
Usage: from the checker/ directory launch ocaml toplevel and then
type #use"include";;
- This command loads the relevent modules, defines some pretty
+ This command loads the relevant modules, defines some pretty
printers, and provides functions to interactively check modules
(mainly run_l and norec).
*)
diff --git a/clib/iStream.mli b/clib/iStream.mli
index 40d579be60..e56f066c5e 100644
--- a/clib/iStream.mli
+++ b/clib/iStream.mli
@@ -31,7 +31,7 @@ val cons : 'a -> 'a t -> 'a t
(** Append an element in front of a stream. *)
val thunk : (unit -> ('a,'a t) u) -> 'a t
-(** Internalize the lazyness of a stream. *)
+(** Internalize the laziness of a stream. *)
val make : ('a -> ('b, 'a) u) -> 'a -> 'b t
(** Coiteration constructor. *)
diff --git a/configure.ml b/configure.ml
index 57f31fec4c..3ced82718e 100644
--- a/configure.ml
+++ b/configure.ml
@@ -451,7 +451,7 @@ let coq_profile_flag = if !prefs.profile then "-p" else ""
let coq_annot_flag = if !prefs.annot then "-annot" else ""
let coq_bin_annot_flag = if !prefs.bin_annot then "-bin-annot" else ""
-(* This variable can be overriden only for debug purposes, use with
+(* This variable can be overridden only for debug purposes, use with
care. *)
let coq_safe_string = "-safe-string"
let coq_strict_sequence = "-strict-sequence"
diff --git a/coqpp/coqpp_main.ml b/coqpp/coqpp_main.ml
index 26e1e25fb9..42fe13e4eb 100644
--- a/coqpp/coqpp_main.ml
+++ b/coqpp/coqpp_main.ml
@@ -499,7 +499,7 @@ let print_rules fmt (name, rules) =
let pr fmt l = print_list fmt (fun fmt r -> fprintf fmt "(%a)" GramExt.print_extrule r) l in
match rules with
| [([SymbEntry (e, None)], [Some s], { code = c } )] when String.trim c = s ->
- (* This is a horrible hack to work aroud limitations of camlp5 regarding
+ (* This is a horrible hack to work around limitations of camlp5 regarding
factorization of parsing rules. It allows to recognize rules of the
form [ entry(x) ] -> [ x ] so as not to generate a proxy entry and
reuse the same entry directly. *)
diff --git a/dev/build/windows/MakeCoq_MinGW.bat b/dev/build/windows/MakeCoq_MinGW.bat
index c3f3a97ff5..7c8f73c7e4 100755
--- a/dev/build/windows/MakeCoq_MinGW.bat
+++ b/dev/build/windows/MakeCoq_MinGW.bat
@@ -285,9 +285,9 @@ SET RESULT_INSTALLDIR_WFMT=%DESTCOQ%
SET TARGET_ARCH=%ARCH%-w64-mingw32
SET BASH=%CYGWIN_INSTALLDIR_WFMT%\bin\bash
-REM Convert pathes to various formats
+REM Convert paths to various formats
REM WFMT = windows format (C:\..) Used in this batch file.
-REM CFMT = cygwin format (\cygdrive\c\..) Used for Cygwin PATH varible, which is : separated, so C: doesn't work.
+REM CFMT = cygwin format (\cygdrive\c\..) Used for Cygwin PATH variable, which is : separated, so C: doesn't work.
REM MFMT = MinGW format (C:/...) Used for the build, because \\ requires escaping. Mingw can handle \ and /.
SET CYGWIN_INSTALLDIR_MFMT=%CYGWIN_INSTALLDIR_WFMT:\=/%
@@ -429,13 +429,13 @@ ECHO ========== BATCH FUNCTIONS ==========
REM 01234567890123456789012345678901234567890123456789012345678901234567890123456789
ECHO -arch ^<i686 or x86_64^> Set cygwin, ocaml and coq to 32 or 64 bit
ECHO -mode ^<mingwincygwin = install coq in default cygwin mingw sysroot^>
- ECHO ^<absoloute = install coq in -destcoq absulute path^>
+ ECHO ^<absolute = install coq in -destcoq absolute path^>
ECHO ^<relocatable = install relocatable coq in -destcoq path^>
ECHO -installer^<Y or N^> create a windows installer (will be in /build/coq/dev/nsis)
ECHO -ocaml ^<Y or N^> install OCaml in Coq folder (Y) or just in cygwin folder (N)
ECHO -make ^<Y or N^> install GNU Make in Coq folder (Y) or not (N)
ECHO -destcyg ^<path to cygwin destination folder^>
- ECHO -destcoq ^<path to coq destination folder (mode=absoloute/relocatable)^>
+ ECHO -destcoq ^<path to coq destination folder (mode=absolute/relocatable)^>
ECHO -setup ^<cygwin setup program name^> (auto adjusted to -arch)
ECHO -proxy ^<internet proxy^>
ECHO -cygrepo ^<cygwin download repository^>
diff --git a/dev/build/windows/ReadMe.txt b/dev/build/windows/ReadMe.txt
index a392115ea4..55b46c616c 100644
--- a/dev/build/windows/ReadMe.txt
+++ b/dev/build/windows/ReadMe.txt
@@ -43,7 +43,7 @@ paths like "C:\myfolder\myfile.txt" and that they don't link to a Cygwin or msys
DLL.
The missing piece is a posix shell running on plain Windows (without msys or
-Cygwin DLL) and not beeing a binary from obscure sources. I am working on it ...
+Cygwin DLL) and not being a binary from obscure sources. I am working on it ...
Since compiling gcc and binutils takes a while and it is not of much use without
a shell, the building of these components is currently disabled. OCaml is built
@@ -274,11 +274,11 @@ Default value: N
===== -cygquiet =====
-Control if the Cygwin setup runs quitely or interactive.
+Control if the Cygwin setup runs quietly or interactive.
Possible values:
-Y: Install Cygwin quitely without user interaction.
+Y: Install Cygwin quietly without user interaction.
N: Install Cygwin interactively (allows to select additional packages).
@@ -344,12 +344,12 @@ selecting more packages)
==================== TODO ====================
- Check for spaces in destination paths
-- Check for = signs in all paths (DOS commands don't work with pathes with = in it, possibly even when quoted)
+- Check for = signs in all paths (DOS commands don't work with paths with = in it, possibly even when quoted)
- Installer doesn't remove OCAMLLIB environment variables (it is in the script, but doesn't seem to work)
- CoqIDE doesn't find theme files
- Finish / test mingw_in_Cygwin mode (coqide doesn't start, coqc slow cause of scanning complete share folder)
-- Possibly create/login as specific user to bash (not sure if it makes sense - nead to create additional bash login link then)
-- maybe move share/doc/menhir somehwere else (reduces coqc startup time)
+- Possibly create/login as specific user to bash (not sure if it makes sense - need to create additional bash login link then)
+- maybe move share/doc/menhir somewhere else (reduces coqc startup time)
- Use original installed file list for removing files in uninstaller
==================== Issues with relocation ====================
diff --git a/dev/build/windows/difftar-folder.sh b/dev/build/windows/difftar-folder.sh
index 3bba451ec6..543ca972cd 100644
--- a/dev/build/windows/difftar-folder.sh
+++ b/dev/build/windows/difftar-folder.sh
@@ -40,7 +40,7 @@ fi
# Get path prefix if --strip is used
if [ "$strip" -gt 0 ] ; then
- # Get the path/name of the first file from teh tar and extract the first $strip path components
+ # Get the path/name of the first file from the tar and extract the first $strip path components
# This assumes that the first file in the tar file has at least $strip many path components
prefix=$(tar -t -f "$tarfile" | head -1 | cut -d / -f -$strip)/
else
diff --git a/dev/build/windows/makecoq_mingw.sh b/dev/build/windows/makecoq_mingw.sh
index d737632638..549f70e8fe 100755
--- a/dev/build/windows/makecoq_mingw.sh
+++ b/dev/build/windows/makecoq_mingw.sh
@@ -765,7 +765,7 @@ function make_ncurses {
# gettext make/make install work anyway
#
# CONFIGURE PARAMETERS
- # --enable-term-driver --enable-sp-funcs is rewuired for mingw (see README.MinGW)
+ # --enable-term-driver --enable-sp-funcs is required for mingw (see README.MinGW)
# additional changes
# ADD --with-pkg-config
# ADD --enable-pc-files
@@ -1281,7 +1281,7 @@ function copy_coq_objects {
done
}
-# Copy required GTK config and suport files
+# Copy required GTK config and support files
function copy_coq_gtk {
echo 'gtk-theme-name = "Default"' > "$PREFIX/etc/gtk-3.0/gtkrc"
diff --git a/dev/build/windows/patches_coq/pkg-config.c b/dev/build/windows/patches_coq/pkg-config.c
index e4fdcd4d7d..c4c7ec2bff 100755
--- a/dev/build/windows/patches_coq/pkg-config.c
+++ b/dev/build/windows/patches_coq/pkg-config.c
@@ -1,5 +1,5 @@
// MinGW personality wrapper for pkgconf
-// This is an excutable replacement for the shell scripts /bin/ARCH-pkg-config
+// This is an executable replacement for the shell scripts /bin/ARCH-pkg-config
// Compile with e.g.
// gcc pkg-config.c -DARCH=x86_64-w64-mingw32 -o pkg-config.exe
// gcc pkg-config.c -DARCH=i686-w64-mingw32 -o pkg-config.exe
diff --git a/dev/ci/README-developers.md b/dev/ci/README-developers.md
index 98ea594366..408d36df7f 100644
--- a/dev/ci/README-developers.md
+++ b/dev/ci/README-developers.md
@@ -31,7 +31,7 @@ PR by running GitLab CI on your private branches. To do so follow these steps:
6. You are encouraged to go to the CI / CD general settings and increase the
timeout from 1h to 2h for better reliability.
-Now everytime you push (including force-push unless you changed the default
+Now every time you push (including force-push unless you changed the default
GitLab setting) to your fork on GitHub, it will be synchronized on GitLab and
CI will be run. You will receive an e-mail with a report of the failures if
there are some.
diff --git a/dev/ci/user-overlays/09895-ejgallego-require+upper.sh b/dev/ci/user-overlays/09895-ejgallego-require+upper.sh
new file mode 100644
index 0000000000..9a42c829ce
--- /dev/null
+++ b/dev/ci/user-overlays/09895-ejgallego-require+upper.sh
@@ -0,0 +1,6 @@
+if [ "$CI_PULL_REQUEST" = "9895" ] || [ "$CI_BRANCH" = "require+upper" ]; then
+
+ quickchick_CI_REF=require+upper
+ quickchick_CI_GITURL=https://github.com/ejgallego/QuickChick
+
+fi
diff --git a/dev/ci/user-overlays/10157-SkySkimmer-def-not-visible-generic-warning.sh b/dev/ci/user-overlays/10157-SkySkimmer-def-not-visible-generic-warning.sh
new file mode 100644
index 0000000000..fcbeb32a58
--- /dev/null
+++ b/dev/ci/user-overlays/10157-SkySkimmer-def-not-visible-generic-warning.sh
@@ -0,0 +1,6 @@
+if [ "$CI_PULL_REQUEST" = "10188" ] || [ "$CI_BRANCH" = "def-not-visible-remove-warning" ]; then
+
+ elpi_CI_REF=def-not-visible-generic-warning
+ elpi_CI_GITURL=https://github.com/SkySkimmer/coq-elpi
+
+fi
diff --git a/dev/ci/user-overlays/10177-SkySkimmer-generalize.sh b/dev/ci/user-overlays/10177-SkySkimmer-generalize.sh
new file mode 100644
index 0000000000..a89f6aca1b
--- /dev/null
+++ b/dev/ci/user-overlays/10177-SkySkimmer-generalize.sh
@@ -0,0 +1,6 @@
+if [ "$CI_PULL_REQUEST" = "10177" ] || [ "$CI_BRANCH" = "generalize" ]; then
+
+ quickchick_CI_REF=generalize
+ quickchick_CI_GITURL=https://github.com/SkySkimmer/QuickChick
+
+fi
diff --git a/dev/ci/user-overlays/10185-SkySkimmer-instance-no-bang.sh b/dev/ci/user-overlays/10185-SkySkimmer-instance-no-bang.sh
new file mode 100644
index 0000000000..c584438b21
--- /dev/null
+++ b/dev/ci/user-overlays/10185-SkySkimmer-instance-no-bang.sh
@@ -0,0 +1,6 @@
+if [ "$CI_PULL_REQUEST" = "10185" ] || [ "$CI_BRANCH" = "instance-no-bang" ]; then
+
+ quickchick_CI_REF=instance-no-bang
+ quickchick_CI_GITURL=https://github.com/SkySkimmer/QuickChick
+
+fi
diff --git a/dev/doc/MERGING.md b/dev/doc/MERGING.md
index c9eceb1270..66f5a96802 100644
--- a/dev/doc/MERGING.md
+++ b/dev/doc/MERGING.md
@@ -92,7 +92,7 @@ When fixes are ready, there are two cases to consider:
Once all reviewers approved the PR, the assignee is expected to check that CI
completed without relevant failures, and that the PR comes with appropriate
documentation and test cases. If not, they should leave a comment on the PR and
-put the approriate label. Otherwise, they are expected to merge the PR using the
+put the appropriate label. Otherwise, they are expected to merge the PR using the
[merge script](../tools/merge-pr.sh).
When CI has a few failures which look spurious, restarting the corresponding
diff --git a/dev/doc/archive/naming-conventions.tex b/dev/doc/archive/naming-conventions.tex
index 0b0811d81b..8b0b14efb8 100644
--- a/dev/doc/archive/naming-conventions.tex
+++ b/dev/doc/archive/naming-conventions.tex
@@ -570,11 +570,11 @@ Example: \formula{eq\_true\_neg: \~{} eq\_true b <-> eq\_true (negb b)}.
Zero on domain {\D} & D0 & (notation \verb=0=)\\
One on domain {\D} & D1 (if explicitly defined) & (notation \verb=1=)\\
Successor on domain {\D} & Dsucc\\
-Predessor on domain {\D} & Dpred\\
-Addition on domain {\D} & Dadd/Dplus\footnote{Coq historically uses \texttt{plus} and \texttt{mult} for addition and multiplication which are inconsistent notations, the recommendation is to use \texttt{add} and \texttt{mul} except in existng libraries that already use \texttt{plus} and \texttt{mult}}
+Predecessor on domain {\D} & Dpred\\
+Addition on domain {\D} & Dadd/Dplus\footnote{Coq historically uses \texttt{plus} and \texttt{mult} for addition and multiplication which are inconsistent notations, the recommendation is to use \texttt{add} and \texttt{mul} except in existing libraries that already use \texttt{plus} and \texttt{mult}}
& (infix notation \verb=+= [50,L])\\
Multiplication on domain {\D} & Dmul/Dmult\footnotemark[\value{footnote}] & (infix notation \verb=*= [40,L]))\\
-Soustraction on domain {\D} & Dminus & (infix notation \verb=-= [50,L])\\
+Subtraction on domain {\D} & Dminus & (infix notation \verb=-= [50,L])\\
Opposite on domain {\D} & Dopp (if any) & (prefix notation \verb=-= [35,R]))\\
Inverse on domain {\D} & Dinv (if any) & (prefix notation \verb=/= [35,R]))\\
Power on domain {\D} & Dpower & (infix notation \verb=^= [30,R])\\
diff --git a/dev/doc/archive/versions-history.tex b/dev/doc/archive/versions-history.tex
index 25dabad497..46516dd4e4 100644
--- a/dev/doc/archive/versions-history.tex
+++ b/dev/doc/archive/versions-history.tex
@@ -372,7 +372,7 @@ Coq V8.4pl5& released 22 October 2014 & \\
Coq V8.4pl6& released 9 April 2015 & \\
Coq V8.5 beta1 & released 21 January 2015 & \feature{computation via compilation to OCaml} [22-1-2013]\\
-&& \feature{asynchonous evaluation} [8-8-2013]\\
+&& \feature{asynchronous evaluation} [8-8-2013]\\
&& \feature{new proof engine deployed} [2-11-2013]\\
&& \feature{universe polymorphism} [6-5-2014]\\
&& \feature{primitive projections} [6-5-2014]\\
diff --git a/dev/doc/build-system.dev.txt b/dev/doc/build-system.dev.txt
index b0a2b04121..6bbf83aa7e 100644
--- a/dev/doc/build-system.dev.txt
+++ b/dev/doc/build-system.dev.txt
@@ -9,13 +9,13 @@ HISTORY:
* March 2010 (Pierre Letouzey).
Revised build system. In particular, no more stage1,2,3 :
- - Stage3 was removed some time ago when coqdep was splitted into
+ - Stage3 was removed some time ago when coqdep was split into
coqdep_boot and full coqdep.
- Stage1,2 were replaced by brutal inclusion of all .d at the start
of Makefile.build, without trying to guess what could be done at
what time. Some initial inclusions hence _fail_, but "make" tries
again later and succeed.
- - Btw, .ml4 are explicitely turned into .ml files, which stay after build.
+ - Btw, .ml4 are explicitly turned into .ml files, which stay after build.
By default, they are in binary ast format, see READABLE_ML4 option.
* February 2014 (Pierre Letouzey).
@@ -87,8 +87,8 @@ Cons:
clear-text generated .ml.
-Makefiles hierachy
-------------------
+Makefiles hierarchy
+-------------------
The Makefile is separated in several files :
@@ -101,7 +101,7 @@ The Makefile is separated in several files :
FIND_SKIP_DIRS
----------------
+--------------
The recommended style of using FIND_SKIP_DIRS is for example
diff --git a/dev/doc/build-system.dune.md b/dev/doc/build-system.dune.md
index 49251d61a1..372e40a0b7 100644
--- a/dev/doc/build-system.dune.md
+++ b/dev/doc/build-system.dune.md
@@ -108,14 +108,14 @@ automatically.
You can use `ocamldebug` with Dune; after a build, do:
```
-dune exec dev/dune-dbg
+dune exec dev/dune-dbg /path/to/foo.v
(ocd) source dune_db
```
or
```
-dune exec dev/dune-dbg checker
+dune exec dev/dune-dbg checker Foo
(ocd) source dune_db
```
@@ -124,6 +124,8 @@ refined, so you need to build enough of Coq once to use this target
[it will then correctly compute the deps and rebuild if you call the
script again] This will be fixed in the future.
+For running in emacs, use `coqdev-ocamldebug` from `coqdev.el`.
+
## Dropping from coqtop:
After doing `make -f Makefile.dune voboot`, the following commands should work:
diff --git a/dev/doc/build-system.txt b/dev/doc/build-system.txt
index 8cefe699cc..a14781a058 100644
--- a/dev/doc/build-system.txt
+++ b/dev/doc/build-system.txt
@@ -18,8 +18,8 @@ See http://www.gnu.org/software/make/manual/make.htmlPrerequisite-Types
* Annotation before commands: +/-/@
a command starting by - is always successful (errors are ignored)
-a command starting by + is runned even if option -n is given to make
-a command starting by @ is not echoed before being runned
+a command starting by + is run even if option -n is given to make
+a command starting by @ is not echoed before being run
* Custom functions
@@ -36,7 +36,7 @@ If the file given to -include doesn't exist, make tries to build it,
and even retries again if necessary, but doesn't care if this build
finally fails. We used to rely on this "feature", but this should not
be the case anymore. We kept "-include" instead of "include" for
-avoiding warnings about initially non-existant files.
+avoiding warnings about initially non-existent files.
Changes (for old-timers)
------------------------
diff --git a/dev/doc/changes.md b/dev/doc/changes.md
index 7221c3de56..339ac2d9b7 100644
--- a/dev/doc/changes.md
+++ b/dev/doc/changes.md
@@ -1278,7 +1278,7 @@ next_global_ident_away true -> next_ident_away_in_goal
next_global_ident_away false -> next_global_ident_away
```
-### Cleaning in commmand.ml
+### Cleaning in command.ml
Functions about starting/ending a lemma are in lemmas.ml
Functions about inductive schemes are in indschemes.ml
@@ -1593,7 +1593,7 @@ Other kinds of objects:
#### Writing subst_thing functions
-The subst_thing shoud not copy the thing if it hasn't actually
+The subst_thing should not copy the thing if it hasn't actually
changed. There are some cool emacs macros in dev/objects.el
to help writing subst functions this way quickly and without errors.
Also there are *_smartmap functions in Util.
diff --git a/dev/doc/econstr.md b/dev/doc/econstr.md
index bb17e8fb62..16abf3f519 100644
--- a/dev/doc/econstr.md
+++ b/dev/doc/econstr.md
@@ -25,7 +25,7 @@ val kind : Evd.evar_map -> t -> (t, t, ESorts.t, EInstance.t) Constr.kind_of_ter
Essentially, each time it sees an evar which happens to be defined in the
provided evar-map, it replaces it with the corresponding body and carries on.
-Due to universe unification occuring at the tactic level, the same goes for
+Due to universe unification occurring at the tactic level, the same goes for
universe instances and sorts. See the `ESort` and `EInstance` modules in
`EConstr`.
diff --git a/dev/doc/proof-engine.md b/dev/doc/proof-engine.md
index 774552237a..a2c8d2f5ac 100644
--- a/dev/doc/proof-engine.md
+++ b/dev/doc/proof-engine.md
@@ -121,7 +121,7 @@ a limited set of derivation rules), it is recommended to generate proofs as
much as possible by refining in ML tactics when it is possible and easy enough.
Indeed, this prevents dependence on fragile constructions such as unification.
-Obviously, it does not forbid the use of tacticals to mimick what one would do
+Obviously, it does not forbid the use of tacticals to mimic what one would do
in Ltac. Each Ltac primitive has a corresponding ML counterpart with simple
semantics. A list of such tacticals can be found in the `Tacticals` module. Most
of them are a porting of the tacticals from the old engine to the new one, so
diff --git a/dev/doc/release-process.md b/dev/doc/release-process.md
index 189d6f9fa5..452160ea5a 100644
--- a/dev/doc/release-process.md
+++ b/dev/doc/release-process.md
@@ -113,7 +113,7 @@
- [ ] Upload the new version of the reference manual to the website.
*TODO: setup some continuous deployment for this.*
- [ ] Merge the website update, publish the release
- and send annoucement e-mails.
+ and send announcement e-mails.
- [ ] Ping **@Zimmi48** to publish a new version on Zenodo.
*TODO: automate this.*
- [ ] Close the milestone
diff --git a/dev/doc/universes.md b/dev/doc/universes.md
index c276603ed2..026c3830a2 100644
--- a/dev/doc/universes.md
+++ b/dev/doc/universes.md
@@ -163,9 +163,9 @@ only, it's just a matter of using `Evd.fresh_global` /
The universe graph
------------------
-To accomodate universe polymorphic definitions, the graph structure in
+To accommodate universe polymorphic definitions, the graph structure in
kernel/univ.ml was modified. The new API forces every universe to be
-declared before it is mentionned in any constraint. This forces to
+declared before it is mentioned in any constraint. This forces to
declare every universe to be >= Set or > Set. Every universe variable
introduced during elaboration is >= Set. Every _global_ universe is now
declared explicitly > Set, _after_ typechecking the definition. In
diff --git a/dev/doc/xml-protocol.md b/dev/doc/xml-protocol.md
index 48671c03b6..e23d1234f7 100644
--- a/dev/doc/xml-protocol.md
+++ b/dev/doc/xml-protocol.md
@@ -437,7 +437,7 @@ Searches for objects that satisfy a list of constraints. If `${positiveConstrain
* Type pattern: `${constraintType} = "type_pattern"`; `${constraintValue}` is a pattern (???: an open gallina term) string.
* SubType pattern: `${constraintType} = "subtype_pattern"`; `${constraintValue}` is a pattern (???: an open gallina term) string.
* In module: `${constraintType} = "in_module"`; `${constraintValue}` is a list of strings specifying the module/directory structure.
-* Include blacklist: `${constraintType} = "include_blacklist"`; `${constraintValue}` *is ommitted*.
+* Include blacklist: `${constraintType} = "include_blacklist"`; `${constraintValue}` *is omitted*.
-------------------------------
diff --git a/dev/dune b/dev/dune
index 792da6254a..ffa885a008 100644
--- a/dev/dune
+++ b/dev/dune
@@ -3,7 +3,7 @@
(public_name coq.top_printers)
(synopsis "Coq's Debug Printers")
(wrapped false)
- (modules :standard)
+ (modules top_printers)
(optional)
(libraries coq.toplevel coq.plugins.ltac))
@@ -11,7 +11,7 @@
(targets dune-dbg)
(deps dune-dbg.in
../checker/coqchk.bc
- ../topbin/coqtop_byte_bin.bc
+ ../topbin/coqc_bin.bc
; This is not enough as the call to `ocamlfind` will fail :/
top_printers.cma)
(action (copy dune-dbg.in dune-dbg)))
diff --git a/dev/dune-dbg.in b/dev/dune-dbg.in
index 80ad0500e0..bd0a837938 100755
--- a/dev/dune-dbg.in
+++ b/dev/dune-dbg.in
@@ -3,11 +3,14 @@
# Run in a proper install dune env.
case $1 in
checker)
+ shift
exe=_build/default/checker/coqchk.bc
;;
*)
- exe=_build/default/topbin/coqtop_byte_bin.bc
+ exe=_build/default/topbin/coqc_bin.bc
;;
esac
-ocamldebug $(ocamlfind query -recursive -i-format coq.top_printers) -I +threads -I dev $exe
+emacs="${INSIDE_EMACS:+-emacs}"
+
+ocamldebug $emacs $(ocamlfind query -recursive -i-format coq.top_printers) -I +threads -I dev $exe "$@"
diff --git a/dev/lint-commits.sh b/dev/lint-commits.sh
index d8043558eb..96c92e3162 100755
--- a/dev/lint-commits.sh
+++ b/dev/lint-commits.sh
@@ -34,6 +34,6 @@ if [ "${#bad[@]}" != 0 ]
then
>&2 echo "Whitespace errors!"
>&2 echo "In commits ${bad[*]}"
- >&2 echo "If you use emacs, you can prevent this kind of error from reocurring by installing ws-butler and enabling ws-butler-convert-leading-tabs-or-spaces."
+ >&2 echo "If you use emacs, you can prevent this kind of error from reoccurring by installing ws-butler and enabling ws-butler-convert-leading-tabs-or-spaces."
exit 1
fi
diff --git a/dev/nsis/coq.nsi b/dev/nsis/coq.nsi
index f48013cf2e..b4c5d3d528 100755
--- a/dev/nsis/coq.nsi
+++ b/dev/nsis/coq.nsi
@@ -6,7 +6,7 @@
;SetCompress off
SetCompressor lzma
-; Comment out after debuging.
+; Comment out after debugging.
; The VERSION should be passed as an argument at compile time using :
;
diff --git a/dev/tools/coqdev.el b/dev/tools/coqdev.el
index c6687b9731..b89ae67a82 100644
--- a/dev/tools/coqdev.el
+++ b/dev/tools/coqdev.el
@@ -85,6 +85,35 @@ Note that this function is executed before _Coqproject is read if it exists."
(setq-local coq-prog-name (concat dir "bin/coqtop")))))
(add-hook 'hack-local-variables-hook #'coqdev-setup-proofgeneral)
+(defvar coqdev-ocamldebug-command "dune exec dev/dune-dbg"
+ "Command run by `coqdev-ocamldebug'")
+
+(defun coqdev-ocamldebug ()
+ "Runs a command in an ocamldebug buffer."
+ (interactive)
+ (let* ((dir (read-directory-name "Run from directory: "
+ (coqdev-default-directory)))
+ (name "ocamldebug-coq")
+ (buffer-name (concat "*" name "*")))
+ (pop-to-buffer buffer-name)
+ (unless (comint-check-proc buffer-name)
+ (setq default-directory dir)
+ (setq coqdev-ocamldebug-command
+ (read-from-minibuffer "Command to run: "
+ coqdev-ocamldebug-command))
+ (let* ((cmdlist (tuareg--split-args coqdev-ocamldebug-command))
+ (cmdlist (mapcar #'substitute-in-file-name cmdlist)))
+ (apply #'make-comint name
+ (car cmdlist)
+ nil
+ (cdr cmdlist))
+ (set-process-filter (get-buffer-process (current-buffer))
+ #'ocamldebug-filter)
+ (set-process-sentinel (get-buffer-process (current-buffer))
+ #'ocamldebug-sentinel)
+ (ocamldebug-mode)))
+ (ocamldebug-set-buffer)))
+
;; This Elisp snippet adds a regexp parser for the format of Anomaly
;; backtraces (coqc -bt ...), to the error parser of the Compilation
;; mode (C-c C-c: "Compile command: ..."). File locations in traces
diff --git a/dev/v8-syntax/memo-v8.tex b/dev/v8-syntax/memo-v8.tex
index ae4b569b36..84894b6f7c 100644
--- a/dev/v8-syntax/memo-v8.tex
+++ b/dev/v8-syntax/memo-v8.tex
@@ -55,7 +55,7 @@ _ are allowed after the first character.
Quoted strings are used typically to give a filename (which may not
be a regular identifier). As before they are written between double
quotes ("). Unlike for V7, there is no escape character: characters
-are written normaly but the double quote which is doubled.
+are written normally but the double quote which is doubled.
\section{Main changes in terms w.r.t. V7}
@@ -252,7 +252,7 @@ became \TERM{context}. Syntax is unified with subterm matching.
\subsection{Occurrences}
-To avoid ambiguity between a numeric literal and the optionnal
+To avoid ambiguity between a numeric literal and the optional
occurrence numbers of this term, the occurrence numbers are put after
the term itself. This applies to tactic \TERM{pattern} and also
\TERM{unfold}
diff --git a/doc/changelog/07-commands-and-options/10185-instance-no-bang.rst b/doc/changelog/07-commands-and-options/10185-instance-no-bang.rst
new file mode 100644
index 0000000000..c69cda9656
--- /dev/null
+++ b/doc/changelog/07-commands-and-options/10185-instance-no-bang.rst
@@ -0,0 +1,2 @@
+- Remove undocumented :n:`Instance : !@type` syntax
+ (`#10185 <https://github.com/coq/coq/pull/10185>`_, by Gaëtan Gilbert).
diff --git a/doc/common/styles/html/coqremote/modules/system/system.css b/doc/common/styles/html/coqremote/modules/system/system.css
index 9371bb479e..9556c7882a 100644
--- a/doc/common/styles/html/coqremote/modules/system/system.css
+++ b/doc/common/styles/html/coqremote/modules/system/system.css
@@ -327,7 +327,7 @@ html.js fieldset.collapsed legend a {
* html.js fieldset.collapsed table * {
display: inline;
}
-/* For Safari 2 to prevent collapsible fieldsets containing tables from dissapearing due to tableheader.js. */
+/* For Safari 2 to prevent collapsible fieldsets containing tables from disappearing due to tableheader.js. */
html.js fieldset.collapsible {
position: relative;
}
diff --git a/doc/plugin_tutorial/tuto1/src/simple_declare.ml b/doc/plugin_tutorial/tuto1/src/simple_declare.ml
index 3c0355c92d..e9b91d5a7e 100644
--- a/doc/plugin_tutorial/tuto1/src/simple_declare.ml
+++ b/doc/plugin_tutorial/tuto1/src/simple_declare.ml
@@ -1,16 +1,16 @@
-let edeclare ?hook ~ontop ident (_, poly, _ as k) ~opaque sigma udecl body tyopt imps =
+let edeclare ?hook ident (_, poly, _ as k) ~opaque sigma udecl body tyopt imps =
let sigma, ce = DeclareDef.prepare_definition ~allow_evars:false
~opaque ~poly sigma udecl ~types:tyopt ~body in
let uctx = Evd.evar_universe_context sigma in
let ubinders = Evd.universe_binders sigma in
let hook_data = Option.map (fun hook -> hook, uctx, []) hook in
- DeclareDef.declare_definition ~ontop ident k ce ubinders imps ?hook_data
+ DeclareDef.declare_definition ident k ce ubinders imps ?hook_data
let packed_declare_definition ~poly ident value_with_constraints =
let body, ctx = value_with_constraints in
let sigma = Evd.from_ctx ctx in
let k = (Decl_kinds.Global, poly, Decl_kinds.Definition) in
let udecl = UState.default_univ_decl in
- ignore (edeclare ~ontop:None ident k ~opaque:false sigma udecl body None [])
+ ignore (edeclare ident k ~opaque:false sigma udecl body None [])
(* But this definition cannot be undone by Reset ident *)
diff --git a/doc/plugin_tutorial/tuto3/src/g_tuto3.mlg b/doc/plugin_tutorial/tuto3/src/g_tuto3.mlg
index 82ba45726e..f4d9e7fd5b 100644
--- a/doc/plugin_tutorial/tuto3/src/g_tuto3.mlg
+++ b/doc/plugin_tutorial/tuto3/src/g_tuto3.mlg
@@ -33,7 +33,7 @@ TACTIC EXTEND collapse_hyps
END
(* More advanced examples, where automatic proof happens but
- no tactic is being called explicitely. The first one uses
+ no tactic is being called explicitly. The first one uses
type classes. *)
VERNAC COMMAND EXTEND TriggerClasses CLASSIFIED AS QUERY
| [ "Tuto3_3" int(n) ] -> { example_classes n }
diff --git a/doc/sphinx/addendum/extraction.rst b/doc/sphinx/addendum/extraction.rst
index 8a895eb515..3dc8707a34 100644
--- a/doc/sphinx/addendum/extraction.rst
+++ b/doc/sphinx/addendum/extraction.rst
@@ -168,7 +168,7 @@ The type-preserving optimizations are controlled by the following |Coq| options:
.. cmd:: Extraction NoInline {+ @qualid }
- Conversely, the constants mentionned by this command will
+ Conversely, the constants mentioned by this command will
never be inlined during extraction.
.. cmd:: Print Extraction Inline
diff --git a/doc/sphinx/addendum/generalized-rewriting.rst b/doc/sphinx/addendum/generalized-rewriting.rst
index 847abb33fc..e58049b8d0 100644
--- a/doc/sphinx/addendum/generalized-rewriting.rst
+++ b/doc/sphinx/addendum/generalized-rewriting.rst
@@ -441,7 +441,7 @@ First class setoids and morphisms
The implementation is based on a first-class representation of
properties of relations and morphisms as typeclasses. That is, the
various combinations of properties on relations and morphisms are
-represented as records and instances of theses classes are put in a
+represented as records and instances of these classes are put in a
hint database. For example, the declaration:
.. coqdoc::
@@ -528,7 +528,7 @@ pass additional arguments such as ``using relation``.
.. tacv:: setoid_reflexivity
setoid_symmetry {? in @ident}
setoid_transitivity
- setoid_rewrite {? @orientation} @term {? at @occs} {? in @ident}
+ setoid_rewrite {? @orientation} @term {? at @occurrences} {? in @ident}
setoid_replace @term with @term {? using relation @term} {? in @ident} {? by @tactic}
:name: setoid_reflexivity; setoid_symmetry; setoid_transitivity; setoid_rewrite; setoid_replace
@@ -567,13 +567,13 @@ Printing relations and morphisms
Deprecated syntax and backward incompatibilities
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.. cmd:: Add Setoid @A @Aeq @ST as @ident
+.. cmd:: Add Setoid @qualid__1 @qualid__2 @qualid__3 as @ident
This command for declaring setoids and morphisms is also accepted due
to backward compatibility reasons.
- Here ``Aeq`` is a congruence relation without parameters, ``A`` is its carrier
- and ``ST`` is an object of type (``Setoid_Theory A Aeq``) (i.e. a record
+ Here :n:`@qualid__2` is a congruence relation without parameters, :n:`@qualid__1` is its carrier
+ and :n:`@qualid__3` is an object of type (:n:`Setoid_Theory @qualid__1 @qualid__2`) (i.e. a record
packing together the reflexivity, symmetry and transitivity lemmas).
Notice that the syntax is not completely backward compatible since the
identifier was not required.
@@ -708,91 +708,65 @@ Definitions
The generalized rewriting tactic is based on a set of strategies that can be
combined to obtain custom rewriting procedures. Its set of strategies is based
on Elan’s rewriting strategies :cite:`Luttik97specificationof`. Rewriting
-strategies are applied using the tactic ``rewrite_strat s`` where ``s`` is a
+strategies are applied using the tactic :n:`rewrite_strat @strategy` where :token:`strategy` is a
strategy expression. Strategies are defined inductively as described by the
following grammar:
-.. productionlist:: rewriting
- s, t, u : `strategy`
- : `lemma`
- : `lemma_right_to_left`
- : `failure`
- : `identity`
- : `reflexivity`
- : `progress`
- : `failure_catch`
- : `composition`
- : `left_biased_choice`
- : `iteration_one_or_more`
- : `iteration_zero_or_more`
- : `one_subterm`
- : `all_subterms`
- : `innermost_first`
- : `outermost_first`
- : `bottom_up`
- : `top_down`
- : `apply_hint`
- : `any_of_the_terms`
- : `apply_reduction`
- : `fold_expression`
-
-.. productionlist:: rewriting
- strategy : ( `s` )
- lemma : `c`
- lemma_right_to_left : <- `c`
- failure : fail
- identity : id
- reflexivity : refl
- progress : progress `s`
- failure_catch : try `s`
- composition : `s` ; `u`
- left_biased_choice : choice `s` `t`
- iteration_one_or_more : repeat `s`
- iteration_zero_or_more : any `s`
- one_subterm : subterm `s`
- all_subterms : subterms `s`
- innermost_first : innermost `s`
- outermost_first : outermost `s`
- bottom_up : bottomup `s`
- top_down : topdown `s`
- apply_hint : hints `hintdb`
- any_of_the_terms : terms (`c`)+
- apply_reduction : eval `redexpr`
- fold_expression : fold `c`
-
+.. productionlist:: coq
+ strategy : `qualid` (lemma, left to right)
+ : <- `qualid` (lemma, right to left)
+ : fail (failure)
+ : id (identity)
+ : refl (reflexivity)
+ : progress `strategy` (progress)
+ : try `strategy` (try catch)
+ : `strategy` ; `strategy` (composition)
+ : choice `strategy` `strategy` (left_biased_choice)
+ : repeat `strategy` (one or more)
+ : any `strategy` (zero or more)
+ : subterm `strategy` (one subterm)
+ : subterms `strategy` (all subterms)
+ : innermost `strategy` (innermost first)
+ : outermost `strategy` (outermost first)
+ : bottomup `strategy` (bottom-up)
+ : topdown `strategy` (top-down)
+ : hints `ident` (apply hints from hint database)
+ : terms `term` ... `term` (any of the terms)
+ : eval `redexpr` (apply reduction)
+ : fold `term` (unify)
+ : ( `strategy` )
Actually a few of these are defined in term of the others using a
primitive fixpoint operator:
-.. productionlist:: rewriting
- try `s` : choice `s` `id`
- any `s` : fix `u`. try (`s` ; `u`)
- repeat `s` : `s` ; any `s`
- bottomup s : fix `bu`. (choice (progress (subterms bu)) s) ; try bu
- topdown s : fix `td`. (choice s (progress (subterms td))) ; try td
- innermost s : fix `i`. (choice (subterm i) s)
- outermost s : fix `o`. (choice s (subterm o))
+- :n:`try @strategy := choice @strategy id`
+- :n:`any @strategy := fix @ident. try (@strategy ; @ident)`
+- :n:`repeat @strategy := @strategy; any @strategy`
+- :n:`bottomup @strategy := fix @ident. (choice (progress (subterms @ident)) @strategy) ; try @ident`
+- :n:`topdown @strategy := fix @ident. (choice @strategy (progress (subterms @ident))) ; try @ident`
+- :n:`innermost @strategy := fix @ident. (choice (subterm @ident) @strategy)`
+- :n:`outermost @strategy := fix @ident. (choice @strategy (subterm @ident))`
The basic control strategy semantics are straightforward: strategies
are applied to subterms of the term to rewrite, starting from the root
of the term. The lemma strategies unify the left-hand-side of the
lemma with the current subterm and on success rewrite it to the right-
hand-side. Composition can be used to continue rewriting on the
-current subterm. The fail strategy always fails while the identity
+current subterm. The ``fail`` strategy always fails while the identity
strategy succeeds without making progress. The reflexivity strategy
succeeds, making progress using a reflexivity proof of rewriting.
-Progress tests progress of the argument strategy and fails if no
+``progress`` tests progress of the argument :token:`strategy` and fails if no
progress was made, while ``try`` always succeeds, catching failures.
-Choice is left-biased: it will launch the first strategy and fall back
+``choice`` is left-biased: it will launch the first strategy and fall back
on the second one in case of failure. One can iterate a strategy at
least 1 time using ``repeat`` and at least 0 times using ``any``.
-The ``subterm`` and ``subterms`` strategies apply their argument strategy ``s`` to
+The ``subterm`` and ``subterms`` strategies apply their argument :token:`strategy` to
respectively one or all subterms of the current term under
consideration, left-to-right. ``subterm`` stops at the first subterm for
-which ``s`` made progress. The composite strategies ``innermost`` and ``outermost``
+which :token:`strategy` made progress. The composite strategies ``innermost`` and ``outermost``
perform a single innermost or outermost rewrite using their argument
-strategy. Their counterparts ``bottomup`` and ``topdown`` perform as many
+:token:`strategy`. Their counterparts ``bottomup`` and ``topdown`` perform as many
rewritings as possible, starting from the bottom or the top of the
term.
@@ -802,15 +776,15 @@ lemmas at the current subterm. The ``terms`` strategy takes the lemma
names directly as arguments. The ``eval`` strategy expects a reduction
expression (see :ref:`performingcomputations`) and succeeds
if it reduces the subterm under consideration. The ``fold`` strategy takes
-a term ``c`` and tries to *unify* it to the current subterm, converting it to ``c``
-on success, it is stronger than the tactic ``fold``.
+a :token:`term` and tries to *unify* it to the current subterm, converting it to :token:`term`
+on success. It is stronger than the tactic ``fold``.
Usage
~~~~~
-.. tacn:: rewrite_strat @s {? in @ident }
+.. tacn:: rewrite_strat @strategy {? in @ident }
:name: rewrite_strat
Rewrite using the strategy s in hypothesis ident or the conclusion.
diff --git a/doc/sphinx/addendum/program.rst b/doc/sphinx/addendum/program.rst
index 22ddcae584..45c74ab02a 100644
--- a/doc/sphinx/addendum/program.rst
+++ b/doc/sphinx/addendum/program.rst
@@ -299,9 +299,9 @@ optional tactic is replaced by the default one if not specified.
Displays all remaining obligations.
-.. cmd:: Obligation num {? of @ident}
+.. cmd:: Obligation @num {? of @ident}
- Start the proof of obligation num.
+ Start the proof of obligation :token:`num`.
.. cmd:: Next Obligation {? of @ident}
diff --git a/doc/sphinx/addendum/ring.rst b/doc/sphinx/addendum/ring.rst
index 3b350d5dc0..3f4d5cc784 100644
--- a/doc/sphinx/addendum/ring.rst
+++ b/doc/sphinx/addendum/ring.rst
@@ -310,10 +310,10 @@ The syntax for adding a new ring is
.. productionlist:: coq
ring_mod : abstract | decidable `term` | morphism `term`
: setoid `term` `term`
- : constants [`ltac`]
- : preprocess [`ltac`]
- : postprocess [`ltac`]
- : power_tac `term` [`ltac`]
+ : constants [ `tactic` ]
+ : preprocess [ `tactic` ]
+ : postprocess [ `tactic` ]
+ : power_tac `term` [ `tactic` ]
: sign `term`
: div `term`
@@ -341,31 +341,31 @@ The syntax for adding a new ring is
This modifier needs not be used if the setoid and morphisms have been
declared.
- constants [ :n:`@ltac` ]
- specifies a tactic expression :n:`@ltac` that, given a
+ constants [ :n:`@tactic` ]
+ specifies a tactic expression :n:`@tactic` that, given a
term, returns either an object of the coefficient set that is mapped
to the expression via the morphism, or returns
``InitialRing.NotConstant``. The default behavior is to map only 0 and 1
to their counterpart in the coefficient set. This is generally not
desirable for non trivial computational rings.
- preprocess [ :n:`@ltac` ]
- specifies a tactic :n:`@ltac` that is applied as a
+ preprocess [ :n:`@tactic` ]
+ specifies a tactic :n:`@tactic` that is applied as a
preliminary step for :tacn:`ring` and :tacn:`ring_simplify`. It can be used to
transform a goal so that it is better recognized. For instance, ``S n``
can be changed to ``plus 1 n``.
- postprocess [ :n:`@ltac` ]
- specifies a tactic :n:`@ltac` that is applied as a final
+ postprocess [ :n:`@tactic` ]
+ specifies a tactic :n:`@tactic` that is applied as a final
step for :tacn:`ring_simplify`. For instance, it can be used to undo
modifications of the preprocessor.
- power_tac :n:`@term` [ :n:`@ltac` ]
+ power_tac :n:`@term` [ :n:`@tactic` ]
allows :tacn:`ring` and :tacn:`ring_simplify` to recognize
power expressions with a constant positive integer exponent (example:
:math:`x^2` ). The term :n:`@term` is a proof that a given power function satisfies
the specification of a power function (term has to be a proof of
- ``Ring_theory.power_theory``) and :n:`@ltac` specifies a tactic expression
+ ``Ring_theory.power_theory``) and :n:`@tactic` specifies a tactic expression
that, given a term, “abstracts” it into an object of type |N| whose
interpretation via ``Cp_phi`` (the evaluation function of power
coefficient) is the original term, or returns ``InitialRing.NotConstant``
diff --git a/doc/sphinx/addendum/type-classes.rst b/doc/sphinx/addendum/type-classes.rst
index 65934efaa6..2ba13db042 100644
--- a/doc/sphinx/addendum/type-classes.rst
+++ b/doc/sphinx/addendum/type-classes.rst
@@ -385,7 +385,7 @@ few other commands related to typeclasses.
.. note::
As of Coq 8.6, ``all:once (typeclasses eauto)`` faithfully
- mimicks what happens during typeclass resolution when it is called
+ mimics what happens during typeclass resolution when it is called
during refinement/type inference, except that *only* declared class
subgoals are considered at the start of resolution during type
inference, while ``all`` can select non-class subgoals as well. It might
diff --git a/doc/sphinx/addendum/universe-polymorphism.rst b/doc/sphinx/addendum/universe-polymorphism.rst
index 6b10b7c0b3..395b5ce2d3 100644
--- a/doc/sphinx/addendum/universe-polymorphism.rst
+++ b/doc/sphinx/addendum/universe-polymorphism.rst
@@ -366,24 +366,32 @@ The syntax has been extended to allow users to explicitly bind names
to universes and explicitly instantiate polymorphic definitions.
.. cmd:: Universe @ident
+ Polymorphic Universe @ident
In the monorphic case, this command declares a new global universe
named :g:`ident`, which can be referred to using its qualified name
as well. Global universe names live in a separate namespace. The
- command supports the polymorphic flag only in sections, meaning the
+ command supports the ``Polymorphic`` flag only in sections, meaning the
universe quantification will be discharged on each section definition
independently. One cannot mix polymorphic and monomorphic
declarations in the same section.
-.. cmd:: Constraint @ident @ord @ident
+.. cmd:: Constraint @universe_constraint
+ Polymorphic Constraint @universe_constraint
- This command declares a new constraint between named universes. The
- order relation :n:`@ord` can be one of :math:`<`, :math:`≤` or :math:`=`. If consistent, the constraint
- is then enforced in the global environment. Like ``Universe``, it can be
- used with the ``Polymorphic`` prefix in sections only to declare
- constraints discharged at section closing time. One cannot declare a
- global constraint on polymorphic universes.
+ This command declares a new constraint between named universes.
+
+ .. productionlist:: coq
+ universe_constraint : `qualid` < `qualid`
+ : `qualid` <= `qualid`
+ : `qualid` = `qualid`
+
+ If consistent, the constraint is then enforced in the global
+ environment. Like :cmd:`Universe`, it can be used with the
+ ``Polymorphic`` prefix in sections only to declare constraints
+ discharged at section closing time. One cannot declare a global
+ constraint on polymorphic universes.
.. exn:: Undeclared universe @ident.
:undocumented:
@@ -449,7 +457,7 @@ underscore or by omitting the annotation to a polymorphic definition.
This option, on by default, removes universes which appear only in
the body of an opaque polymorphic definition from the definition's
universe arguments. As such, no value needs to be provided for
- these universes when instanciating the definition. Universe
+ these universes when instantiating the definition. Universe
constraints are automatically adjusted.
Consider the following definition:
diff --git a/doc/sphinx/changes.rst b/doc/sphinx/changes.rst
index cc2c43e7dd..db4ebd5e38 100644
--- a/doc/sphinx/changes.rst
+++ b/doc/sphinx/changes.rst
@@ -186,7 +186,7 @@ Coq is now continuously tested against OCaml trunk, in addition to the
oldest supported and latest OCaml releases.
Coq's documentation for the development branch is now deployed
-continously at https://coq.github.io/doc/master/api (documentation of
+continuously at https://coq.github.io/doc/master/api (documentation of
the ML API), https://coq.github.io/doc/master/refman (reference
manual), and https://coq.github.io/doc/master/stdlib (documentation of
the standard library). Similar links exist for the `v8.10` branch.
@@ -656,8 +656,8 @@ changes:
attribute.
- Removed deprecated commands ``Arguments Scope`` and ``Implicit
- Arguments`` in favor of :cmd:`Arguments`, with the help of Jasper
- Hugunin.
+ Arguments`` in favor of :cmd:`Arguments (scopes)` and
+ :cmd:`Arguments (implicits)`, with the help of Jasper Hugunin.
- New flag :flag:`Uniform Inductive Parameters` by Jasper Hugunin to
avoid repeating uniform parameters in constructor declarations.
@@ -665,7 +665,7 @@ changes:
- New commands :cmd:`Hint Variables` and :cmd:`Hint Constants`, by
Matthieu Sozeau, for controlling the opacity status of variables and
constants in hint databases. It is recommended to always use these
- commands after creating a hint databse with :cmd:`Create HintDb`.
+ commands after creating a hint database with :cmd:`Create HintDb`.
- Multiple sections with the same name are now allowed, by Jasper
Hugunin.
@@ -892,7 +892,7 @@ Vernacular Commands
`Inductive list (A : Type) := nil : list | cons : A -> list -> list.`
- New `Set Hint Variables/Constants Opaque/Transparent` commands for setting
globally the opacity flag of variables and constants in hint databases,
- overwritting the opacity set of the hint database.
+ overwriting the opacity set of the hint database.
- Added generic syntax for "attributes", as in:
`#[local] Lemma foo : bar.`
- Added the `Numeral Notation` command for registering decimal numeral
@@ -1129,7 +1129,7 @@ Tactics
few rare incompatibilities (it was unintendedly recursively
rewriting in the side conditions generated by H).
- Added tactics "assert_succeeds tac" and "assert_fails tac" to ensure
- properties of the executation of a tactic without keeping the effect
+ properties of the execution of a tactic without keeping the effect
of the execution.
- `vm_compute` now supports existential variables.
- Calls to `shelve` and `give_up` within calls to tactic `refine` now working.
@@ -1262,7 +1262,7 @@ Tools
Tactic language
- The undocumented "nameless" forms `fix N`, `cofix` have been
- deprecated; please use `fix ident N /cofix ident` to explicitely
+ deprecated; please use `fix ident N /cofix ident` to explicitly
name the (co)fixpoint hypothesis to be introduced.
Documentation
@@ -2953,7 +2953,7 @@ Other bugfixes
- Fix incorrect behavior of CS resolution
- #4591: Uncaught exception in directory browsing.
- CoqIDE is more resilient to initialization errors.
-- #4614: "Fully check the document" is uninterruptable.
+- #4614: "Fully check the document" is uninterruptible.
- Try eta-expansion of records only on non-recursive ones
- Fix bug when a sort is ascribed to a Record
- Primitive projections: protect kernel from erroneous definitions.
@@ -3442,7 +3442,7 @@ Libraries
* all functions over type Z : Z.add, Z.mul, ...
* the minimal proofs of specifications for these functions : Z.add_0_l, ...
- * an instantation of all derived properties proved generically in Numbers :
+ * an instantiation of all derived properties proved generically in Numbers :
Z.add_comm, Z.add_assoc, ...
A large part of ZArith is now simply compatibility notations, for instance
@@ -4623,7 +4623,7 @@ Setoid rewriting
+ Setoid_Theory is now an alias to Equivalence, scripts building objects
of type Setoid_Theory need to unfold (or "red") the definitions
of Reflexive, Symmetric and Transitive in order to get the same goals
- as before. Scripts which introduced variables explicitely will not break.
+ as before. Scripts which introduced variables explicitly will not break.
+ The order of subgoals when doing [setoid_rewrite] with side-conditions
is always the same: first the new goal, then the conditions.
@@ -5022,7 +5022,7 @@ Syntax
Language and commands
-- Added sort-polymorphism for definitions in Type (but finally abandonned).
+- Added sort-polymorphism for definitions in Type (but finally abandoned).
- Support for implicit arguments in the types of parameters in
(co-)fixpoints and (co-)inductive declarations.
- Improved type inference: use as much of possible general information.
@@ -5251,7 +5251,7 @@ Library
- New file about the factorial function in Arith
-- An additional elimination Acc_iter for Acc, simplier than Acc_rect.
+- An additional elimination Acc_iter for Acc, simpler than Acc_rect.
This new elimination principle is used for definition well_founded_induction.
- New library NArith on binary natural numbers
@@ -5336,7 +5336,7 @@ Bugs
Miscellaneous
- Implicit parameters of inductive types definition now taken into
- account for infering other implicit arguments
+ account for inferring other implicit arguments
Incompatibilities
@@ -5417,7 +5417,7 @@ Gallina
Known problems of the automatic translation
- iso-latin-1 characters are no longer supported: move your files to
- 7-bits ASCII or unicode before translation (swith to unicode is
+ 7-bits ASCII or unicode before translation (switch to unicode is
automatically done if a file is loaded and saved again by coqide)
- Renaming in ZArith: incompatibilities in Coq user contribs due to
merging names INZ, from Reals, and inject_nat.
@@ -5442,7 +5442,7 @@ Vernacular commands
- "Functional Scheme" and "Functional Induction" extended to polymorphic
types and dependent types
- Notation now allows recursive patterns, hence recovering parts of the
- fonctionalities of pre-V8 Grammar/Syntax commands
+ functionalities of pre-V8 Grammar/Syntax commands
- Command "Print." discontinued.
- Redundant syntax "Implicit Arguments On/Off" discontinued
diff --git a/doc/sphinx/history.rst b/doc/sphinx/history.rst
index 0f5b991ba4..c4a48d6985 100644
--- a/doc/sphinx/history.rst
+++ b/doc/sphinx/history.rst
@@ -110,7 +110,7 @@ advantage of special hardware, debuggers, and the like. We hope that |Coq|
can be of use to researchers interested in experimenting with this new
methodology.
-.. [#years] At the time of writting, i.e. 1995.
+.. [#years] At the time of writing, i.e. 1995.
Versions 1 to 5
---------------
@@ -305,7 +305,7 @@ Michel Mauny, Ascander Suarez and Pierre Weis.
V3.1 was started in the summer of 1986, V3.2 was frozen at the end of
November 1986. V3.4 was developed in the first half of 1987.
-Thierry Coquand held a post-doctoral position in Cambrige University
+Thierry Coquand held a post-doctoral position in Cambridge University
in 1986-87, where he developed a variant implementation in SML, with
which he wrote some developments on fixpoints in Scott's domains.
@@ -345,7 +345,7 @@ lemmas when local hypotheses of proofs were discharged. This gave a
notion of global mathematical environment with local sections.
Another significant practical change was that the system, originally
-developped on the VAX central computer of our lab, was transferred on
+developed on the VAX central computer of our lab, was transferred on
SUN personal workstations, allowing a level of distributed
development. The extraction algorithm was modified, with three
annotations ``Pos``, ``Null`` and ``Typ`` decorating the sorts ``Prop``
@@ -503,7 +503,7 @@ of CNRS-ENS Lyon.
Chetan Murthy joined the team in 1991 and became the main software
architect of Version 5. He completely rehauled the implementation for
efficiency. Versions 5.6 and 5.8 were major distributed versions,
-with complete documentation and a library of users' developements. The
+with complete documentation and a library of users' developments. The
use of the RCS revision control system, and systematic ChangeLog
files, allow a more precise tracking of the software developments.
@@ -1330,7 +1330,7 @@ Language
- Inductive definitions now accept ">" in constructor types to declare
the corresponding constructor as a coercion.
-- Idem for assumptions declarations and constants when the type is mentionned.
+- Idem for assumptions declarations and constants when the type is mentioned.
- The "Coercion" and "Canonical Structure" keywords now accept the
same syntax as "Definition", i.e. "hyps :=c (:t)?" or "hyps :t".
- Theorem-like declaration now accepts the syntax "Theorem thm [x:t;...] : u".
@@ -1383,7 +1383,7 @@ Tactics
it can also recognize 'False' in the hypothesis and use it to solve the
goal.
- Coercions now handled in "with" bindings
-- "Subst x" replaces all ocurrences of x by t in the goal and hypotheses
+- "Subst x" replaces all occurrences of x by t in the goal and hypotheses
when an hypothesis x=t or x:=t or t=x exists
- Fresh names for Assert and Pose now based on collision-avoiding
Intro naming strategy (exceptional source of incompatibilities)
diff --git a/doc/sphinx/language/gallina-extensions.rst b/doc/sphinx/language/gallina-extensions.rst
index 5e214f6f7f..c1af4d067f 100644
--- a/doc/sphinx/language/gallina-extensions.rst
+++ b/doc/sphinx/language/gallina-extensions.rst
@@ -603,11 +603,16 @@ The following experimental command is available when the ``FunInd`` library has
The meaning of this declaration is to define a function ident,
similarly to ``Fixpoint``. Like in ``Fixpoint``, the decreasing argument must
be given (unless the function is not recursive), but it might not
- necessarily be *structurally* decreasing. The point of the {} annotation
+ necessarily be *structurally* decreasing. The point of the :n:`{ @decrease_annot }` annotation
is to name the decreasing argument *and* to describe which kind of
decreasing criteria must be used to ensure termination of recursive
calls.
+ .. productionlist::
+ decrease_annot : struct `ident`
+ : measure `term` `ident`
+ : wf `term` `ident`
+
The ``Function`` construction also enjoys the ``with`` extension to define
mutually recursive definitions. However, this feature does not work
for non structurally recursive functions.
@@ -616,31 +621,33 @@ See the documentation of functional induction (:tacn:`function induction`)
and ``Functional Scheme`` (:ref:`functional-scheme`) for how to use
the induction principle to easily reason about the function.
-Remark: 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:
+.. note::
-.. coqtop:: reset none
+ 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:
- Require Import FunInd.
+ .. coqtop:: reset none
-.. coqtop:: all
+ Require Import FunInd.
- Function plus (m n : nat) {struct n} : nat :=
- match n with
- | 0 => m
- | S p => S (plus m p)
- end.
+ .. coqtop:: all
-than like this:
+ Function plus (m n : nat) {struct n} : nat :=
+ match n with
+ | 0 => m
+ | S p => S (plus m p)
+ end.
-.. coqtop:: reset all
+ than like this:
- Function plus (n m : nat) {struct n} : nat :=
- match n with
- | 0 => m
- | S p => S (plus p m)
- end.
+ .. coqtop:: reset all
+
+ Function plus (n m : nat) {struct n} : nat :=
+ match n with
+ | 0 => m
+ | S p => S (plus p m)
+ end.
*Limitations*
@@ -710,7 +717,7 @@ used by ``Function``. A more precise description is given below.
with :cmd:`Fixpoint`. Moreover the following are defined:
+ The same objects as above;
- + The fixpoint equation of :token:`ident`: :n:`@ident_equation`.
+ + The fixpoint equation of :token:`ident`: :token:`ident`\ ``_equation``.
.. cmdv:: Function @ident {* @binder } { measure @term @ident } : @type := @term
Function @ident {* @binder } { wf @term @ident } : @type := @term
@@ -1662,6 +1669,7 @@ Declaring Implicit Arguments
of :token:`qualid`.
.. cmd:: Arguments @qualid : clear implicits
+ :name: Arguments (clear implicits)
This command clears implicit arguments.
@@ -1738,6 +1746,7 @@ Automatic declaration of implicit arguments
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. cmd:: Arguments @qualid : default implicits
+ :name: Arguments (default implicits)
This command tells |Coq| to automatically detect what are the implicit arguments of a
defined object.
@@ -1907,7 +1916,8 @@ This syntax extension is given in the following grammar:
Renaming implicit arguments
~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.. cmd:: Arguments @qualid {* @name} : @rename
+.. cmd:: Arguments @qualid {* @name} : rename
+ :name: Arguments (rename)
This command is used to redefine the names of implicit arguments.
@@ -2131,24 +2141,71 @@ Implicit generalization
.. index:: `{ }
.. index:: `( )
+.. index:: `{! }
+.. index:: `(! )
Implicit generalization is an automatic elaboration of a statement
with free variables into a closed statement where these variables are
-quantified explicitly. Implicit generalization is done inside binders
-starting with a \` and terms delimited by \`{ } and \`( ), always
-introducing maximally inserted implicit arguments for the generalized
-variables. Inside implicit generalization delimiters, free variables
-in the current context are automatically quantified using a product or
-a lambda abstraction to generate a closed term. In the following
-statement for example, the variables n and m are automatically
-generalized and become explicit arguments of the lemma as we are using
-\`( ):
+quantified explicitly.
-.. coqtop:: all
+It is activated for a binder by prefixing a \`, and for terms by
+surrounding it with \`{ } or \`( ).
+
+Terms surrounded by \`{ } introduce their free variables as 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.
- Lemma nat_comm : `(n = n + 0).
+ 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).
One can control the set of generalizable identifiers with
the ``Generalizable`` vernacular command to avoid unexpected
@@ -2176,22 +2233,6 @@ that specify which variables should be generalizable.
Allows exporting the choice of generalizable variables.
-One can also use implicit generalization for binders, in which case
-the generalized variables are added as binders and set maximally
-implicit.
-
-.. coqtop:: all
-
- Definition id `(x : A) : A := x.
-
- Print id.
-
-The generalizing binders \`{ } and \`( ) work similarly to their
-explicit counterparts, only binding the generalized variables
-implicitly, as maximally-inserted arguments. In these binders, the
-binding name for the bound object is optional, whereas the type is
-mandatory, dually to regular binders.
-
.. _Coercions:
Coercions
@@ -2262,7 +2303,7 @@ Printing universes
language, and can be processed by Graphviz tools. The format is
unspecified if `string` doesn’t end in ``.dot`` or ``.gv``.
-.. cmdv:: Print Universes Subgraph(@names)
+.. cmdv:: Print Universes Subgraph({+ @qualid })
:name: Print Universes Subgraph
Prints the graph restricted to the requested names (adjusting
diff --git a/doc/sphinx/proof-engine/ltac.rst b/doc/sphinx/proof-engine/ltac.rst
index bbd7e0ba3d..c48dd5b99e 100644
--- a/doc/sphinx/proof-engine/ltac.rst
+++ b/doc/sphinx/proof-engine/ltac.rst
@@ -32,22 +32,25 @@ The syntax of the tactic language is given below. See Chapter
:ref:`gallinaspecificationlanguage` for a description of the BNF metasyntax used
in these grammar rules. Various already defined entries will be used in this
chapter: entries :token:`natural`, :token:`integer`, :token:`ident`,
-:token:`qualid`, :token:`term`, :token:`cpattern` and :token:`atomic_tactic`
+:token:`qualid`, :token:`term`, :token:`cpattern` and :token:`tactic`
represent respectively the natural and integer numbers, the authorized
identificators and qualified names, Coq terms and patterns and all the atomic
-tactics described in Chapter :ref:`tactics`. The syntax of :token:`cpattern` is
+tactics described in Chapter :ref:`tactics`.
+
+The syntax of :production:`cpattern` is
the same as that of terms, but it is extended with pattern matching
metavariables. In :token:`cpattern`, a pattern matching metavariable is
-represented with the syntax :g:`?id` where :g:`id` is an :token:`ident`. The
+represented with the syntax :n:`?@ident`. The
notation :g:`_` can also be used to denote metavariable whose instance is
-irrelevant. In the notation :g:`?id`, the identifier allows us to keep
+irrelevant. In the notation :n:`?@ident`, the identifier allows us to keep
instantiations and to make constraints whereas :g:`_` shows that we are not
interested in what will be matched. On the right hand side of pattern matching
clauses, the named metavariables are used without the question mark prefix. There
is also a special notation for second-order pattern matching problems: in an
-applicative pattern of the form :g:`@?id id1 … idn`, the variable id matches any
-complex expression with (possible) dependencies in the variables :g:`id1 … idn`
-and returns a functional term of the form :g:`fun id1 … idn => term`.
+applicative pattern of the form :n:`%@?@ident @ident__1 … @ident__n`,
+the variable :token:`ident` matches any complex expression with (possible)
+dependencies in the variables :n:`@ident__i` and returns a functional term
+of the form :n:`fun @ident__1 … ident__n => @term`.
The main entry of the grammar is :n:`@expr`. This language is used in proof
mode but it can also be used in toplevel definitions as shown below.
@@ -121,6 +124,7 @@ mode but it can also be used in toplevel definitions as shown below.
: solve [ `expr` | ... | `expr` ]
: idtac [ `message_token` ... `message_token`]
: fail [`natural`] [`message_token` ... `message_token`]
+ : gfail [`natural`] [`message_token` ... `message_token`]
: fresh [ `component` … `component` ]
: context `ident` [`term`]
: eval `redexpr` in `term`
@@ -132,7 +136,7 @@ mode but it can also be used in toplevel definitions as shown below.
: guard `test`
: assert_fails `tacexpr3`
: assert_succeeds `tacexpr3`
- : `atomic_tactic`
+ : `tactic`
: `qualid` `tacarg` ... `tacarg`
: `atom`
atom : `qualid`
@@ -582,11 +586,11 @@ Failing
the call to :n:`fail @num` is not enclosed in a :n:`+` command,
respecting the algebraic identity.
- .. tacv:: fail {* message_token}
+ .. tacv:: fail {* @message_token}
The given tokens are used for printing the failure message.
- .. tacv:: fail @num {* message_token}
+ .. tacv:: fail @num {* @message_token}
This is a combination of the previous variants.
@@ -597,8 +601,8 @@ Failing
Similarly, ``gfail`` fails even when used after ``all:`` and there are no
goals left. See the example for clarification.
- .. tacv:: gfail {* message_token}
- gfail @num {* message_token}
+ .. tacv:: gfail {* @message_token}
+ gfail @num {* @message_token}
These variants fail with an error message or an error level even if
there are no goals left. Be careful however if Coq terms have to be
@@ -708,7 +712,7 @@ tactic
for printing.
By copying the definition of :tacn:`time_constr` from the standard library,
- users can achive support for a fixed pattern of nesting by passing
+ users can achieve support for a fixed pattern of nesting by passing
different :token:`string` parameters to :tacn:`restart_timer` and
:tacn:`finish_timing` at each level of nesting.
@@ -964,7 +968,7 @@ system decide a name with the intro tactic is not so good since it is
very awkward to retrieve the name the system gave. The following
expression returns an identifier:
-.. tacn:: fresh {* component}
+.. tacn:: fresh {* @component}
It evaluates to an identifier unbound in the goal. This fresh identifier
is obtained by concatenating the value of the :n:`@component`\ s (each of them
@@ -1676,7 +1680,7 @@ It is possible to measure the time spent in invocations of primitive
tactics as well as tactics defined in |Ltac| and their inner
invocations. The primary use is the development of complex tactics,
which can sometimes be so slow as to impede interactive usage. The
-reasons for the performence degradation can be intricate, like a slowly
+reasons for the performance degradation can be intricate, like a slowly
performing |Ltac| match or a sub-tactic whose performance only
degrades in certain situations. The profiler generates a call tree and
indicates the time spent in a tactic depending on its calling context. Thus
diff --git a/doc/sphinx/proof-engine/ltac2.rst b/doc/sphinx/proof-engine/ltac2.rst
index 73eb8a7f38..5f2e911ff9 100644
--- a/doc/sphinx/proof-engine/ltac2.rst
+++ b/doc/sphinx/proof-engine/ltac2.rst
@@ -179,7 +179,7 @@ constructions from ML.
: let `ltac2_var` := `ltac2_term` in `ltac2_term`
: let rec `ltac2_var` := `ltac2_term` in `ltac2_term`
: match `ltac2_term` with `ltac2_branch` ... `ltac2_branch` end
- : `int`
+ : `integer`
: `string`
: `ltac2_term` ; `ltac2_term`
: [| `ltac2_term` ; ... ; `ltac2_term` |]
@@ -619,7 +619,7 @@ calls to term matching functions from the `Pattern` module. Internally, it is
implemented thanks to a specific scope accepting the :n:`@constrmatching` syntax.
Variables from the :n:`@constrpattern` are statically bound in the body of the branch, to
-values of type `constr` for the variables from the :n:`@constr` pattern and to a
+values of type `constr` for the variables from the :n:`@term` pattern and to a
value of type `Pattern.context` for the variable :n:`@lident`.
Note that unlike Ltac, only lowercase identifiers are valid as Ltac2
@@ -686,20 +686,22 @@ The following scopes are built-in.
- :n:`list0(@ltac2_scope)`:
- + if :n:`@ltac2_scope` parses :production:`entry`, parses :n:`(@entry__0, ..., @entry__n)` and produces
- :n:`[@entry__0; ...; @entry__n]`.
+ + if :n:`@ltac2_scope` parses :n:`@quotentry`,
+ then it parses :n:`(@quotentry__0, ..., @quotentry__n)` and produces
+ :n:`[@quotentry__0; ...; @quotentry__n]`.
- :n:`list0(@ltac2_scope, sep = @string__sep)`:
- + if :n:`@ltac2_scope` parses :n:`@entry`, parses :n:`(@entry__0 @string__sep ... @string__sep @entry__n)`
- and produces :n:`[@entry__0; ...; @entry__n]`.
+ + if :n:`@ltac2_scope` parses :n:`@quotentry`,
+ then it parses :n:`(@quotentry__0 @string__sep ... @string__sep @quotentry__n)`
+ and produce :n:`[@quotentry__0; ...; @quotentry__n]`.
-- :n:`list1`: same as :n:`list0` (with or without separator) but parses :n:`{+ @entry}` instead
- of :n:`{* @entry}`.
+- :n:`list1`: same as :n:`list0` (with or without separator) but parses :n:`{+ @quotentry}` instead
+ of :n:`{* @quotentry}`.
- :n:`opt(@ltac2_scope)`
- + if :n:`@ltac2_scope` parses :n:`@entry`, parses :n:`{? @entry}` and produces either :n:`None` or
+ + if :n:`@ltac2_scope` parses :n:`@quotentry`, parses :n:`{? @quotentry}` and produces either :n:`None` or
:n:`Some x` where :n:`x` is the parsed expression.
- :n:`self`:
diff --git a/doc/sphinx/proof-engine/proof-handling.rst b/doc/sphinx/proof-engine/proof-handling.rst
index 4a2f9c0db3..3f966755ca 100644
--- a/doc/sphinx/proof-engine/proof-handling.rst
+++ b/doc/sphinx/proof-engine/proof-handling.rst
@@ -175,12 +175,12 @@ list of assertion commands is given in :ref:`Assertions`. The command
Use all section variables except the list of :token:`ident`.
- .. cmdv:: Proof using @collection1 + @collection2
+ .. cmdv:: Proof using @collection__1 + @collection__2
Use section variables from the union of both collections.
See :ref:`nameaset` to know how to form a named collection.
- .. cmdv:: Proof using @collection1 - @collection2
+ .. cmdv:: Proof using @collection__1 - @collection__2
Use section variables which are in the first collection but not in the
second one.
@@ -202,10 +202,10 @@ Proof using options
The following options modify the behavior of ``Proof using``.
-.. opt:: Default Proof Using "@expression"
+.. opt:: Default Proof Using "@collection"
:name: Default Proof Using
- Use :n:`@expression` as the default ``Proof using`` value. E.g. ``Set Default
+ Use :n:`@collection` as the default ``Proof using`` value. E.g. ``Set Default
Proof Using "a b"`` will complete all ``Proof`` commands not followed by a
``using`` part with ``using a b``.
@@ -220,7 +220,7 @@ The following options modify the behavior of ``Proof using``.
Name a set of section hypotheses for ``Proof using``
````````````````````````````````````````````````````
-.. cmd:: Collection @ident := @expression
+.. cmd:: Collection @ident := @collection
This can be used to name a set of section
hypotheses, with the purpose of making ``Proof using`` annotations more
diff --git a/doc/sphinx/proof-engine/ssreflect-proof-language.rst b/doc/sphinx/proof-engine/ssreflect-proof-language.rst
index 75e019592f..3149d64d3e 100644
--- a/doc/sphinx/proof-engine/ssreflect-proof-language.rst
+++ b/doc/sphinx/proof-engine/ssreflect-proof-language.rst
@@ -853,7 +853,7 @@ An *occurrence switch* can be:
algorithm in a local definition, instead of copying large terms by
hand.
-It is important to remember that matching *preceeds* occurrence
+It is important to remember that matching *precedes* occurrence
selection.
.. example::
@@ -1499,7 +1499,7 @@ side of an equation.
The abstract tactic
```````````````````
-.. tacn:: abstract: {+ d_item}
+.. tacn:: abstract: {+ @d_item}
:name: abstract (ssreflect)
This tactic assigns an abstract constant previously introduced with the
@@ -2455,7 +2455,7 @@ the holes are abstracted in term.
Lemma test : True.
have: _ * 0 = 0.
- The invokation of ``have`` is equivalent to:
+ The invocation of ``have`` is equivalent to:
.. coqtop:: reset none
@@ -3478,7 +3478,7 @@ efficient ones, e.g. for the purpose of a correctness proof.
Wildcards vs abstractions
`````````````````````````
-The rewrite tactic supports :token:`r_items` containing holes. For example, in
+The rewrite tactic supports :token:`r_item`\s containing holes. For example, in
the tactic ``rewrite (_ : _ * 0 = 0).``
the term ``_ * 0 = 0`` is interpreted as ``forall n : nat, n * 0 = 0.``
Anyway this tactic is *not* equivalent to
@@ -3753,7 +3753,7 @@ involves the following steps:
3. If so :tacn:`under` puts these n goals in head normal form (using
the defective form of the tactic :tacn:`move`), then executes
- the corresponding intro pattern :n:`@ipat__i` in each goal.
+ the corresponding intro pattern :n:`@i_pattern__i` in each goal.
4. Then :tacn:`under` checks that the first n subgoals
are (quantified) equalities or double implications between a
@@ -3802,11 +3802,11 @@ One-liner mode
The Ltac expression:
-:n:`under @term => [ @i_item__1 | … | @i_item__n ] do [ @tac__1 | … | @tac__n ].`
+:n:`under @term => [ @i_item__1 | … | @i_item__n ] do [ @tactic__1 | … | @tactic__n ].`
can be seen as a shorter form for the following expression:
-:n:`(under @term) => [ @i_item__1 | … | @i_item__n | ]; [ @tac__1; over | … | @tac__n; over | cbv beta iota ].`
+:n:`(under @term) => [ @i_item__1 | … | @i_item__n | ]; [ @tactic__1; over | … | @tactic__n; over | cbv beta iota ].`
Notes:
@@ -3819,14 +3819,14 @@ Notes:
involving the `bigop` theory from the Mathematical Components library.
+ If there is only one tactic, the brackets can be omitted, e.g.:
- :n:`under @term => i do @tac.` and that shorter form should be
+ :n:`under @term => i do @tactic.` and that shorter form should be
preferred.
+ If the ``do`` clause is provided and the intro pattern is omitted,
then the default :token:`i_item` ``*`` is applied to each branch.
E.g., the Ltac expression:
- :n:`under @term do [ @tac__1 | … | @tac__n ]` is equivalent to:
- :n:`under @term => [ * | … | * ] do [ @tac__1 | … | @tac__n ]`
+ :n:`under @term do [ @tactic__1 | … | @tactic__n ]` is equivalent to:
+ :n:`under @term => [ * | … | * ] do [ @tactic__1 | … | @tactic__n ]`
(and it can be noted here that the :tacn:`under` tactic performs a
``move.`` before processing the intro patterns ``=> [ * | … | * ]``).
@@ -4237,7 +4237,7 @@ selecting a specific redex and has been described in the previous
sections. We have seen so far that the possibility of selecting a
redex using a term with holes is already a powerful means of redex
selection. Similarly, any terms provided by the user in the more
-complex forms of :token:`c_patterns`
+complex forms of :token:`c_pattern`\s
presented in the tables above can contain
holes.
@@ -4927,7 +4927,7 @@ bookkeeping steps.
apply/PQequiv.
thus in this case, the tactic ``apply/PQequiv`` is equivalent to
- ``apply: (iffRL (PQequiv _ _))``, where ``iffRL`` is tha analogue of
+ ``apply: (iffRL (PQequiv _ _))``, where ``iffRL`` is the analogue of
``iffRL`` for the converse implication.
Any |SSR| term whose type coerces to a double implication can be
diff --git a/doc/sphinx/proof-engine/tactics.rst b/doc/sphinx/proof-engine/tactics.rst
index 4e47621938..67d32835f5 100644
--- a/doc/sphinx/proof-engine/tactics.rst
+++ b/doc/sphinx/proof-engine/tactics.rst
@@ -462,7 +462,7 @@ Occurrence sets and occurrence clauses
An occurrence clause is a modifier to some tactics that obeys the
following syntax:
- .. productionlist:: sentence
+ .. productionlist:: coq
occurrence_clause : in `goal_occurrences`
goal_occurrences : [`ident` [`at_occurrences`], ... , `ident` [`at_occurrences`] [|- [* [`at_occurrences`]]]]
: * |- [* [`at_occurrences`]]
@@ -2127,7 +2127,7 @@ and an explanation of the underlying technique.
:name: discriminate
This tactic proves any goal from an assumption stating that two
- structurally different :n:`@terms` of an inductive set are equal. For
+ structurally different :n:`@term`\s of an inductive set are equal. For
example, from :g:`(S (S O))=(S O)` we can derive by absurdity any
proposition.
@@ -2294,7 +2294,7 @@ and an explanation of the underlying technique.
.. flag:: Keep Proof Equalities
- By default, :tacn:`injection` only creates new equalities between :n:`@terms`
+ By default, :tacn:`injection` only creates new equalities between :n:`@term`\s
whose type is in sort :g:`Type` or :g:`Set`, thus implementing a special
behavior for objects that are proofs of a statement in :g:`Prop`. This option
controls this behavior.
@@ -2703,42 +2703,42 @@ simply :g:`t=u` dropping the implicit type of :g:`t` and :g:`u`.
Uses the equality :n:`@term`:sub:`1` :n:`= @term` :sub:`2` from right to left
- .. tacv:: rewrite @term in clause
+ .. tacv:: rewrite @term in @goal_occurrences
- Analogous to :n:`rewrite @term` but rewriting is done following clause
- (similarly to :ref:`performing computations <performingcomputations>`). For instance:
+ Analogous to :n:`rewrite @term` but rewriting is done following
+ the clause :token:`goal_occurrences`. For instance:
- + :n:`rewrite H in H`:sub:`1` will rewrite `H` in the hypothesis
- `H`:sub:`1` instead of the current goal.
- + :n:`rewrite H in H`:sub:`1` :g:`at 1, H`:sub:`2` :g:`at - 2 |- *` means
- :n:`rewrite H; rewrite H in H`:sub:`1` :g:`at 1; rewrite H in H`:sub:`2` :g:`at - 2.`
+ + :n:`rewrite H in H'` will rewrite `H` in the hypothesis
+ ``H'`` instead of the current goal.
+ + :n:`rewrite H in H' at 1, H'' at - 2 |- *` means
+ :n:`rewrite H; rewrite H in H' at 1; rewrite H in H'' at - 2.`
In particular a failure will happen if any of these three simpler tactics
fails.
- + :n:`rewrite H in * |-` will do :n:`rewrite H in H`:sub:`i` for all hypotheses
- :g:`H`:sub:`i` different from :g:`H`.
+ + :n:`rewrite H in * |-` will do :n:`rewrite H in H'` for all hypotheses
+ :g:`H'` different from :g:`H`.
A success will happen as soon as at least one of these simpler tactics succeeds.
+ :n:`rewrite H in *` is a combination of :n:`rewrite H` and :n:`rewrite H in * |-`
that succeeds if at least one of these two tactics succeeds.
Orientation :g:`->` or :g:`<-` can be inserted before the :token:`term` to rewrite.
- .. tacv:: rewrite @term at occurrences
+ .. tacv:: rewrite @term at @occurrences
- Rewrite only the given occurrences of :token:`term`. Occurrences are
+ Rewrite only the given :token:`occurrences` of :token:`term`. Occurrences are
specified from left to right as for pattern (:tacn:`pattern`). The rewrite is
always performed using setoid rewriting, even for Leibniz’s equality, so one
has to ``Import Setoid`` to use this variant.
- .. tacv:: rewrite @term by tactic
+ .. tacv:: rewrite @term by @tactic
Use tactic to completely solve the side-conditions arising from the
:tacn:`rewrite`.
- .. tacv:: rewrite {+, @term}
+ .. tacv:: rewrite {+, @orientation @term} {? in @ident }
Is equivalent to the `n` successive tactics :n:`{+; rewrite @term}`, each one
- working on the first subgoal generated by the previous one. Orientation
- :g:`->` or :g:`<-` can be inserted before each :token:`term` to rewrite. One
+ working on the first subgoal generated by the previous one. An :production:`orientation`
+ ``->`` or ``<-`` can be inserted before each :token:`term` to rewrite. One
unique clause can be added at the end after the keyword in; it will then
affect all rewrite operations.
@@ -2799,13 +2799,14 @@ simply :g:`t=u` dropping the implicit type of :g:`t` and :g:`u`.
Replaces :n:`@term` with :n:`@term’` using the first assumption whose type has
the form :n:`@term’ = @term`
- .. tacv:: replace @term {? with @term} in clause {? by @tactic}
- replace -> @term in clause
- replace <- @term in clause
+ .. tacv:: replace @term {? with @term} in @goal_occurrences {? by @tactic}
+ replace -> @term in @goal_occurrences
+ replace <- @term in @goal_occurrences
- Acts as before but the replacements take place in the specified clause (see
- :ref:`performingcomputations`) and not only in the conclusion of the goal. The
- clause argument must not contain any ``type of`` nor ``value of``.
+ Acts as before but the replacements take place in the specified clauses
+ (:token:`goal_occurrences`) (see :ref:`performingcomputations`) and not
+ only in the conclusion of the goal. The clause argument must not contain
+ any ``type of`` nor ``value of``.
.. tacv:: cutrewrite <- (@term = @term’)
:name: cutrewrite
@@ -2893,7 +2894,7 @@ simply :g:`t=u` dropping the implicit type of :g:`t` and :g:`u`.
This applies :n:`stepl @term` then applies :token:`tactic` to the second goal.
- .. tacv:: stepr @term stepr @term by tactic
+ .. tacv:: stepr @term by @tactic
:name: stepr
This behaves as :tacn:`stepl` but on the right-hand-side of the binary
@@ -3064,7 +3065,7 @@ the conversion in hypotheses :n:`{+ @ident}`.
.. tacv:: native_compute
:name: native_compute
- This tactic evaluates the goal by compilation to Objective Caml as described
+ This tactic evaluates the goal by compilation to OCaml as described
in :cite:`FullReduction`. If Coq is running in native code, it can be
typically two to five times faster than ``vm_compute``. Note however that the
compilation cost is higher, so it is worth using only for intensive
@@ -3159,7 +3160,7 @@ the conversion in hypotheses :n:`{+ @ident}`.
+ A constant can be marked to be unfolded only if applied to enough
arguments. The number of arguments required can be specified using the
- ``/`` symbol in the argument list of the :cmd:`Arguments` vernacular command.
+ ``/`` symbol in the argument list of the :cmd:`Arguments <Arguments (implicits)>` vernacular command.
.. example::
@@ -3230,8 +3231,8 @@ the conversion in hypotheses :n:`{+ @ident}`.
.. tacv:: simpl @pattern
- This applies ``simpl`` only to the subterms matching :n:`@pattern` in the
- current goal.
+ This applies :tacn:`simpl` only to the subterms matching
+ :n:`@pattern` in the current goal.
.. tacv:: simpl @pattern at {+ @num}
@@ -3264,50 +3265,77 @@ the conversion in hypotheses :n:`{+ @ident}`.
This tactic applies to any goal. The argument qualid must denote a
defined transparent constant or local definition (see
- :ref:`gallina-definitions` and :ref:`vernac-controlling-the-reduction-strategies`). The tactic
- ``unfold`` applies the :math:`\delta` rule to each occurrence of the constant to which
- :n:`@qualid` refers in the current goal and then replaces it with its
- :math:`\beta`:math:`\iota`-normal form.
+ :ref:`gallina-definitions` and
+ :ref:`vernac-controlling-the-reduction-strategies`). The tactic
+ :tacn:`unfold` applies the :math:`\delta` rule to each occurrence of
+ the constant to which :n:`@qualid` refers in the current goal and
+ then replaces it with its :math:`\beta`:math:`\iota`-normal form.
-.. exn:: @qualid does not denote an evaluable constant.
- :undocumented:
+ .. exn:: @qualid does not denote an evaluable constant.
-.. tacv:: unfold @qualid in @ident
+ This error is frequent when trying to unfold something that has
+ defined as an inductive type (or constructor) and not as a
+ definition.
- Replaces :n:`@qualid` in hypothesis :n:`@ident` with its definition
- and replaces the hypothesis with its :math:`\beta`:math:`\iota` normal form.
+ .. example::
-.. tacv:: unfold {+, @qualid}
+ .. coqtop:: abort all fail
- Replaces *simultaneously* :n:`{+, @qualid}` with their definitions and
- replaces the current goal with its :math:`\beta`:math:`\iota` normal form.
+ Goal 0 <= 1.
+ unfold le.
-.. tacv:: unfold {+, @qualid at {+, @num }}
+ This error can also be raised if you are trying to unfold
+ something that has been marked as opaque.
- The lists :n:`{+, @num}` specify the occurrences of :n:`@qualid` to be
- unfolded. Occurrences are located from left to right.
+ .. example::
- .. exn:: Bad occurrence number of @qualid.
- :undocumented:
+ .. coqtop:: abort all fail
- .. exn:: @qualid does not occur.
- :undocumented:
+ Opaque Nat.add.
+ Goal 1 + 0 = 1.
+ unfold Nat.add.
+
+ .. tacv:: unfold @qualid in @goal_occurrences
-.. tacv:: unfold @string
+ Replaces :n:`@qualid` in hypothesis (or hypotheses) designated
+ by :token:`goal_occurrences` with its definition and replaces
+ the hypothesis with its :math:`\beta`:math:`\iota` normal form.
- If :n:`@string` denotes the discriminating symbol of a notation (e.g. "+") or
- an expression defining a notation (e.g. `"_ + _"`), and this notation refers to an unfoldable constant, then the
- tactic unfolds it.
+ .. tacv:: unfold {+, @qualid}
-.. tacv:: unfold @string%key
+ Replaces :n:`{+, @qualid}` with their definitions and replaces
+ the current goal with its :math:`\beta`:math:`\iota` normal
+ form.
- This is variant of :n:`unfold @string` where :n:`@string` gets its
- interpretation from the scope bound to the delimiting key :n:`key`
- instead of its default interpretation (see :ref:`Localinterpretationrulesfornotations`).
-.. tacv:: unfold {+, qualid_or_string at {+, @num}}
+ .. tacv:: unfold {+, @qualid at @occurrences }
- This is the most general form, where :n:`qualid_or_string` is either a
- :n:`@qualid` or a :n:`@string` referring to a notation.
+ The list :token:`occurrences` specify the occurrences of
+ :n:`@qualid` to be unfolded. Occurrences are located from left
+ to right.
+
+ .. exn:: Bad occurrence number of @qualid.
+ :undocumented:
+
+ .. exn:: @qualid does not occur.
+ :undocumented:
+
+ .. tacv:: unfold @string
+
+ If :n:`@string` denotes the discriminating symbol of a notation
+ (e.g. "+") or an expression defining a notation (e.g. `"_ +
+ _"`), and this notation denotes an application whose head symbol
+ is an unfoldable constant, then the tactic unfolds it.
+
+ .. tacv:: unfold @string%@ident
+
+ This is variant of :n:`unfold @string` where :n:`@string` gets
+ its interpretation from the scope bound to the delimiting key
+ :token:`ident` instead of its default interpretation (see
+ :ref:`Localinterpretationrulesfornotations`).
+
+ .. tacv:: unfold {+, {| @qualid | @string{? %@ident } } {? at @occurrences } } {? in @goal_occurrences }
+
+ This is the most general form.
.. tacn:: fold @term
:name: fold
@@ -3382,14 +3410,13 @@ the conversion in hypotheses :n:`{+ @ident}`.
Conversion tactics applied to hypotheses
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.. tacn:: conv_tactic in {+, @ident}
+.. tacn:: @tactic in {+, @ident}
- Applies the conversion tactic :n:`conv_tactic` to the hypotheses
- :n:`{+ @ident}`. The tactic :n:`conv_tactic` is any of the conversion tactics
- listed in this section.
+ Applies :token:`tactic` (any of the conversion tactics listed in this
+ section) to the hypotheses :n:`{+ @ident}`.
- If :n:`@ident` is a local definition, then :n:`@ident` can be replaced by
- (type of :n:`@ident`) to address not the body but the type of the local
+ If :token:`ident` is a local definition, then :token:`ident` can be replaced by
+ :n:`type of @ident` to address not the body but the type of the local
definition.
Example: :n:`unfold not in (type of H1) (type of H3)`.
@@ -3447,9 +3474,9 @@ Automation
:ref:`The Hints Databases for auto and eauto <thehintsdatabasesforautoandeauto>` for the list of
pre-defined databases and the way to create or extend a database.
- .. tacv:: auto using {+ @ident__i} {? with {+ @ident } }
+ .. tacv:: auto using {+ @qualid__i} {? with {+ @ident } }
- Uses lemmas :n:`@ident__i` in addition to hints. If :n:`@ident` is an
+ Uses lemmas :n:`@qualid__i` in addition to hints. If :n:`@qualid` is an
inductive type, it is the collection of its constructors which are added
as hints.
@@ -3457,8 +3484,8 @@ Automation
The hints passed through the `using` clause are used in the same
way as if they were passed through a hint database. Consequently,
- they use a weaker version of :tacn:`apply` and :n:`auto using @ident`
- may fail where :n:`apply @ident` succeeds.
+ they use a weaker version of :tacn:`apply` and :n:`auto using @qualid`
+ may fail where :n:`apply @qualid` succeeds.
Given that this can be seen as counter-intuitive, it could be useful
to have an option to use full-blown :tacn:`apply` for lemmas passed
@@ -3476,7 +3503,7 @@ Automation
Behaves like :tacn:`auto` but shows the tactics it tries to solve the goal,
including failing paths.
- .. tacv:: {? info_}auto {? @num} {? using {+ @lemma}} {? with {+ @ident}}
+ .. tacv:: {? info_}auto {? @num} {? using {+ @qualid}} {? with {+ @ident}}
This is the most general form, combining the various options.
@@ -3489,10 +3516,10 @@ Automation
.. tacv:: trivial with {+ @ident}
trivial with *
- trivial using {+ @lemma}
+ trivial using {+ @qualid}
debug trivial
info_trivial
- {? info_}trivial {? using {+ @lemma}} {? with {+ @ident}}
+ {? info_}trivial {? using {+ @qualid}} {? with {+ @ident}}
:name: _; _; _; debug trivial; info_trivial; _
:undocumented:
@@ -3531,7 +3558,7 @@ Automation
Note that ``ex_intro`` should be declared as a hint.
- .. tacv:: {? info_}eauto {? @num} {? using {+ @lemma}} {? with {+ @ident}}
+ .. tacv:: {? info_}eauto {? @num} {? using {+ @qualid}} {? with {+ @ident}}
The various options for :tacn:`eauto` are the same as for :tacn:`auto`.
@@ -3550,9 +3577,9 @@ Automation
This tactic unfolds constants that were declared through a :cmd:`Hint Unfold`
in the given databases.
-.. tacv:: autounfold with {+ @ident} in clause
+.. tacv:: autounfold with {+ @ident} in @goal_occurrences
- Performs the unfolding in the given clause.
+ Performs the unfolding in the given clause (:token:`goal_occurrences`).
.. tacv:: autounfold with *
@@ -3592,10 +3619,9 @@ Automation
Performs all the rewritings in hypothesis :n:`@qualid` applying :n:`@tactic`
to the main subgoal after each rewriting step.
-.. tacv:: autorewrite with {+ @ident} in @clause
+.. tacv:: autorewrite with {+ @ident} in @goal_occurrences
- Performs all the rewriting in the clause :n:`@clause`. The clause argument
- must not contain any ``type of`` nor ``value of``.
+ Performs all the rewriting in the clause :n:`@goal_occurrences`.
.. seealso::
@@ -3666,10 +3692,11 @@ automatically created.
from the order in which they were inserted, making this implementation
observationally different from the legacy one.
-The general command to add a hint to some databases :n:`{+ @ident}` is
-
.. cmd:: Hint @hint_definition : {+ @ident}
+ The general command to add a hint to some databases :n:`{+ @ident}`.
+ The various possible :production:`hint_definition`\s are given below.
+
.. cmdv:: Hint @hint_definition
No database name is given: the hint is registered in the ``core`` database.
@@ -3714,11 +3741,11 @@ The general command to add a hint to some databases :n:`{+ @ident}` is
.. cmdv:: Hint Resolve -> @term : @ident
Adds the left-to-right implication of an equivalence as a hint (informally
- the hint will be used as :n:`apply <- @term`, although as mentionned
+ the hint will be used as :n:`apply <- @term`, although as mentioned
before, the tactic actually used is a restricted version of
:tacn:`apply`).
- .. cmdv:: Resolve <- @term
+ .. cmdv:: Hint Resolve <- @term
Adds the right-to-left implication of an equivalence as a hint.
@@ -3738,7 +3765,7 @@ The general command to add a hint to some databases :n:`{+ @ident}` is
.. exn:: @term cannot be used as a hint
:undocumented:
- .. cmdv:: Immediate {+ @term} : @ident
+ .. cmdv:: Hint Immediate {+ @term} : @ident
Adds each :n:`Hint Immediate @term`.
@@ -3783,7 +3810,7 @@ The general command to add a hint to some databases :n:`{+ @ident}` is
This sets the transparency flag used during unification of
hints in the database for all constants or all variables,
- overwritting the existing settings of opacity. It is advised
+ overwriting the existing settings of opacity. It is advised
to use this just after a :cmd:`Create HintDb` command.
.. cmdv:: Hint Extern @num {? @pattern} => @tactic : @ident
@@ -3981,7 +4008,7 @@ use one or several databases specific to your development.
Adds the rewriting rules :n:`{+ @term}` with a right-to-left orientation in
the bases :n:`{+ @ident}`.
-.. cmd:: Hint Rewrite {+ @term} using tactic : {+ @ident}
+.. cmd:: Hint Rewrite {+ @term} using @tactic : {+ @ident}
When the rewriting rules :n:`{+ @term}` in :n:`{+ @ident}` will be used, the
tactic ``tactic`` will be applied to the generated subgoals, the main subgoal
@@ -4202,7 +4229,7 @@ some incompatibilities.
Adds lemmas from :tacn:`auto` hint bases :n:`{+ @ident}` to the proof-search
environment.
-.. tacv:: firstorder tactic using {+ @qualid} with {+ @ident}
+.. tacv:: firstorder @tactic using {+ @qualid} with {+ @ident}
This combines the effects of the different variants of :tacn:`firstorder`.
@@ -4243,10 +4270,10 @@ some incompatibilities.
congruence.
Qed.
-.. tacv:: congruence n
+.. tacv:: congruence @num
- Tries to add at most `n` instances of hypotheses stating quantified equalities
- to the problem in order to solve it. A bigger value of `n` does not make
+ Tries to add at most :token:`num` instances of hypotheses stating quantified equalities
+ to the problem in order to solve it. A bigger value of :token:`num` does not make
success slower, only failure. You might consider adding some lemmas as
hypotheses using assert in order for :tacn:`congruence` to use them.
@@ -4556,14 +4583,14 @@ Automating
.. _btauto_grammar:
.. productionlist:: sentence
- t : `x`
- : true
- : false
- : orb `t` `t`
- : andb `t` `t`
- : xorb `t` `t`
- : negb `t`
- : if `t` then `t` else `t`
+ btauto_term : `ident`
+ : true
+ : false
+ : orb `btauto_term` `btauto_term`
+ : andb `btauto_term` `btauto_term`
+ : xorb `btauto_term` `btauto_term`
+ : negb `btauto_term`
+ : if `btauto_term` then `btauto_term` else `btauto_term`
Whenever the formula supplied is not a tautology, it also provides a
counter-example.
diff --git a/doc/sphinx/proof-engine/vernacular-commands.rst b/doc/sphinx/proof-engine/vernacular-commands.rst
index 26dc4e02cf..5f3e82938d 100644
--- a/doc/sphinx/proof-engine/vernacular-commands.rst
+++ b/doc/sphinx/proof-engine/vernacular-commands.rst
@@ -189,18 +189,13 @@ Requests to the environment
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.
-
- .. TODO : selector is not a syntax entry
-
.. cmdv:: @selector: Check @term
This variant specifies on which subgoal to perform typing
(see Section :ref:`invocation-of-tactics`).
-.. TODO : convtactic is not a syntax entry
-
-.. cmd:: Eval @convtactic in @term
+.. cmd:: Eval @redexpr 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
@@ -264,11 +259,11 @@ Requests to the environment
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%@key
+ .. cmdv:: Search @string%@ident
The string string must be a notation or the main
symbol of a notation which is then interpreted in the scope bound to
- the delimiting key :n:`@key` (see Section :ref:`LocalInterpretationRulesForNotations`).
+ the delimiting key :token:`ident` (see Section :ref:`LocalInterpretationRulesForNotations`).
.. cmdv:: Search @term_pattern
@@ -1132,6 +1127,8 @@ described first.
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
@@ -1167,19 +1164,19 @@ described first.
Print all the currently non-transparent strategies.
-.. cmd:: Declare Reduction @ident := @convtactic
+.. cmd:: Declare Reduction @ident := @redexpr
This command allows giving a short name to a reduction expression, for
- instance lazy beta delta [foo bar]. This short name can then be used
+ 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 cannot be qualified. In
+ ``Local`` modifier, for discarding this reduction name at the end of the
+ file or module. For the moment, the name is not qualified. In
particular declaring the same name in several modules or in several
- functor applications will be refused if these declarations are not
+ functor applications will be rejected if these declarations are not
local. The name :n:`@ident` cannot be used directly as an Ltac tactic, but
- nothing prevents the user to also perform a
- :n:`Ltac @ident := @convtactic`.
+ nothing prevents the user from also performing a
+ :n:`Ltac @ident := @redexpr`.
.. seealso:: :ref:`performingcomputations`
@@ -1208,7 +1205,7 @@ Controlling the locality of commands
effect of the command to the current module if the command does not occur in a
section and the Global modifier extends the effect outside the current
sections and current module if the command occurs in a section. As an example,
- the :cmd:`Arguments`, :cmd:`Ltac` or :cmd:`Notation` commands belong
+ the :cmd:`Arguments <Arguments (implicits)>`, :cmd:`Ltac` or :cmd:`Notation` commands belong
to this category. Notice that a subclass of these commands do not support
extension of their scope outside sections at all and the Global modifier is not
applicable to them.
diff --git a/doc/sphinx/user-extensions/syntax-extensions.rst b/doc/sphinx/user-extensions/syntax-extensions.rst
index cda228a7da..5f0b63729b 100644
--- a/doc/sphinx/user-extensions/syntax-extensions.rst
+++ b/doc/sphinx/user-extensions/syntax-extensions.rst
@@ -109,7 +109,7 @@ the associativity of disjunction and conjunction, so let us apply for instance a
right associativity (which is the choice of Coq).
Precedence levels and associativity rules of notations have to be
-given between parentheses in a list of modifiers that the :cmd:`Notation`
+given between parentheses in a list of :token:`modifiers` that the :cmd:`Notation`
command understands. Here is how the previous examples refine.
.. coqtop:: in
@@ -249,7 +249,7 @@ bar of the notation.
Check (sig (fun x : nat => x=x)).
The second, more powerful control on printing is by using the format
-modifier. Here is an example
+:token:`modifier`. Here is an example
.. coqtop:: all
@@ -298,8 +298,8 @@ expression is performed at definition time. Type checking is done only
at the time of use of the notation.
.. note:: Sometimes, a notation is expected only for the parser. To do
- so, the option ``only parsing`` is allowed in the list of modifiers
- of :cmd:`Notation`. Conversely, the ``only printing`` modifier can be
+ so, the option ``only parsing`` is allowed in the list of :token:`modifiers`
+ of :cmd:`Notation`. Conversely, the ``only printing`` :token:`modifier` can be
used to declare that a notation should only be used for printing and
should not declare a parsing rule. In particular, such notations do
not modify the parser.
@@ -310,11 +310,11 @@ The Infix command
The :cmd:`Infix` command is a shortening for declaring notations of infix
symbols.
-.. cmd:: Infix "@symbol" := @term ({+, @modifier}).
+.. cmd:: Infix "@symbol" := @term {? (@modifiers) }.
This command is equivalent to
- :n:`Notation "x @symbol y" := (@term x y) ({+, @modifier}).`
+ :n:`Notation "x @symbol y" := (@term x y) {? (@modifiers) }.`
where ``x`` and ``y`` are fresh names. Here is an example.
@@ -437,7 +437,7 @@ application of the notation:
Check sigma z : nat, z = 0.
-Notice the modifier ``x ident`` in the declaration of the
+Notice the :token:`modifier` ``x ident`` in the declaration of the
notation. It tells to parse :g:`x` as a single identifier.
Binders bound in the notation and parsed as patterns
@@ -457,7 +457,7 @@ binder. Here is an example:
Check subset '(x,y), x+y=0.
-The modifier ``p pattern`` in the declaration of the notation tells to parse
+The :token:`modifier` ``p pattern`` in the declaration of the notation tells to parse
:g:`p` as a pattern. Note that a single variable is both an identifier and a
pattern, so, e.g., the following also works:
@@ -467,7 +467,7 @@ pattern, so, e.g., the following also works:
If one wants to prevent such a notation to be used for printing when the
pattern is reduced to a single identifier, one has to use instead
-the modifier ``p strict pattern``. For parsing, however, a
+the :token:`modifier` ``p strict pattern``. For parsing, however, a
``strict pattern`` will continue to include the case of a
variable. Here is an example showing the difference:
@@ -507,7 +507,7 @@ that ``x`` is parsed as a term at level 99 (as done in the notation for
:g:`sumbool`), but that this term has actually to be an identifier.
The notation :g:`{ x | P }` is already defined in the standard
-library with the ``as ident`` modifier. We cannot redefine it but
+library with the ``as ident`` :token:`modifier`. We cannot redefine it but
one can define an alternative notation, say :g:`{ p such that P }`,
using instead ``as pattern``.
@@ -527,7 +527,7 @@ is just an identifier, one could have said
``p at level 99 as strict pattern``.
Note also that in the absence of a ``as ident``, ``as strict pattern`` or
-``as pattern`` modifiers, the default is to consider sub-expressions occurring
+``as pattern`` :token:`modifier`\s, the default is to consider sub-expressions occurring
in binding position and parsed as terms to be ``as ident``.
.. _NotationsWithBinders:
@@ -628,7 +628,7 @@ except that in the iterator
position of the binding variable of a ``fun`` or a ``forall``.
To specify that the part “``x .. y``” of the notation parses a sequence of
-binders, ``x`` and ``y`` must be marked as ``binder`` in the list of modifiers
+binders, ``x`` and ``y`` must be marked as ``binder`` in the list of :token:`modifiers`
of the notation. The binders of the parsed sequence are used to fill the
occurrences of the first placeholder of the iterating pattern which is
repeatedly nested as many times as the number of binders generated. If ever the
@@ -678,7 +678,7 @@ Predefined entries
~~~~~~~~~~~~~~~~~~
By default, sub-expressions are parsed as terms and the corresponding
-grammar entry is called :n:`@constr`. However, one may sometimes want
+grammar entry is called ``constr``. However, one may sometimes want
to restrict the syntax of terms in a notation. For instance, the
following notation will accept to parse only global reference in
position of :g:`x`:
@@ -866,16 +866,17 @@ notations are given below. The optional :production:`scope` is described in
:ref:`Scopes`.
.. productionlist:: coq
- notation : [Local] Notation `string` := `term` [`modifiers`] [: `scope`].
- : [Local] Infix `string` := `qualid` [`modifiers`] [: `scope`].
- : [Local] Reserved Notation `string` [`modifiers`] .
+ notation : [Local] Notation `string` := `term` [(`modifiers`)] [: `scope`].
+ : [Local] Infix `string` := `qualid` [(`modifiers`)] [: `scope`].
+ : [Local] Reserved Notation `string` [(`modifiers`)] .
: Inductive `ind_body` [`decl_notation`] with … with `ind_body` [`decl_notation`].
: CoInductive `ind_body` [`decl_notation`] with … with `ind_body` [`decl_notation`].
: Fixpoint `fix_body` [`decl_notation`] with … with `fix_body` [`decl_notation`].
: CoFixpoint `cofix_body` [`decl_notation`] with … with `cofix_body` [`decl_notation`].
: [Local] Declare Custom Entry `ident`.
decl_notation : [where `string` := `term` [: `scope`] and … and `string` := `term` [: `scope`]].
- modifiers : at level `num`
+ modifiers : `modifier`, … , `modifier`
+ modifier : at level `num`
: in custom `ident`
: in custom `ident` at level `num`
: `ident` , … , `ident` at level `num` [`binderinterp`]
@@ -1032,11 +1033,11 @@ Local opening of an interpretation scope
+++++++++++++++++++++++++++++++++++++++++
It is possible to locally extend the interpretation scope stack using the syntax
-:g:`(term)%key` (or simply :g:`term%key` for atomic terms), where key is a
+: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.
In such a situation, the term term, and all its subterms, are
-interpreted in the scope stack extended with the scope bound tokey.
+interpreted in the scope stack extended with the scope bound to :token:`ident`.
.. cmd:: Delimit Scope @scope with @ident
@@ -1051,15 +1052,15 @@ interpreted in the scope stack extended with the scope bound tokey.
Binding arguments of a constant to an interpretation scope
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-.. cmd:: Arguments @qualid {+ @name%@scope}
+.. cmd:: Arguments @qualid {+ @name%@ident}
:name: Arguments (scopes)
It is possible to set in advance that some arguments of a given constant have
to be interpreted in a given scope. The command is
- :n:`Arguments @qualid {+ @name%@scope}` where the list is a prefix of the
- arguments of ``qualid`` eventually annotated with their ``scope``. Grouping
+ :n:`Arguments @qualid {+ @name%@ident}` where the list is a prefix of the
+ arguments of ``qualid`` optionally annotated with their scope :token:`ident`. Grouping
round parentheses can be used to decorate multiple arguments with the same
- scope. ``scope`` can be either a scope name or its delimiting key. For
+ scope. :token:`ident` can be either a scope name or its delimiting key. For
example the following command puts the first two arguments of :g:`plus_fct`
in the scope delimited by the key ``F`` (``Rfun_scope``) and the last
argument in the scope delimited by the key ``R`` (``R_scope``).
@@ -1070,13 +1071,13 @@ Binding arguments of a constant to an interpretation scope
The ``Arguments`` command accepts scopes decoration to all grouping
parentheses. In the following example arguments A and B are marked as
- maximally inserted implicit arguments and are put into the type_scope scope.
+ maximally inserted implicit arguments and are put into the ``type_scope`` scope.
.. coqdoc::
Arguments respectful {A B}%type (R R')%signature _ _.
- When interpreting a term, if some of the arguments of qualid are built
+ When interpreting a term, if some of the arguments of :token:`qualid` are built
from a notation, then this notation is interpreted in the scope stack
extended by the scope bound (if any) to this argument. The effect of
the scope is limited to the argument itself. It does not propagate to
@@ -1088,21 +1089,21 @@ Binding arguments of a constant to an interpretation scope
This command can be used to clear argument scopes of :token:`qualid`.
- .. cmdv:: Arguments @qualid {+ @name%scope} : extra scopes
+ .. cmdv:: Arguments @qualid {+ @name%@ident} : extra scopes
Defines extra argument scopes, to be used in case of coercion to ``Funclass``
(see the :ref:`implicitcoercions` chapter) or with a computed type.
- .. cmdv:: Global Arguments @qualid {+ @name%@scope}
+ .. cmdv:: Global Arguments @qualid {+ @name%@ident}
- This behaves like :n:`Arguments qualid {+ @name%@scope}` but survives when a
+ This behaves like :n:`Arguments qualid {+ @name%@ident}` but survives when a
section is closed instead of stopping working at section closing. Without the
``Global`` modifier, the effect of the command stops when the section it belongs
to ends.
- .. cmdv:: Local Arguments @qualid {+ @name%@scope}
+ .. cmdv:: Local Arguments @qualid {+ @name%@ident}
- This behaves like :n:`Arguments @qualid {+ @name%@scope}` but does not
+ This behaves like :n:`Arguments @qualid {+ @name%@ident}` but does not
survive modules and files. Without the ``Local`` modifier, the effect of the
command is visible from within other modules or files.
@@ -1141,10 +1142,10 @@ Binding types of arguments to an interpretation scope
When an interpretation scope is naturally associated to a type (e.g. the
scope of operations on the natural numbers), it may be convenient to bind it
- to this type. When a scope ``scope`` is bound to a type ``type``, any new function
- defined later on gets its arguments of type ``type`` interpreted by default in
- scope scope (this default behavior can however be overwritten by explicitly
- using the command :cmd:`Arguments`).
+ to this type. When a scope :token:`scope` is bound to a type :token:`type`, any function
+ gets its arguments of type :token:`type` interpreted by default in scope :token:`scope`
+ (this default behavior can however be overwritten by explicitly using the
+ command :cmd:`Arguments <Arguments (scopes)>`).
Whether the argument of a function has some type ``type`` is determined
statically. For instance, if ``f`` is a polymorphic function of type
@@ -1172,6 +1173,11 @@ Binding types of arguments to an interpretation scope
Check (fun x y1 y2 z t => P _ (x + t) ((f _ (y1 + y2) + z))).
+ .. note:: When active, a bound scope has effect on all defined functions
+ (even if they are defined after the :cmd:`Bind Scope` directive), except
+ if argument scopes were assigned explicitly using the
+ :cmd:`Arguments <Arguments (scopes)>` command.
+
.. note:: The scopes ``type_scope`` and ``function_scope`` also have a local
effect on interpretation. See the next section.
@@ -1198,7 +1204,7 @@ The ``function_scope`` interpretation scope
The scope ``function_scope`` also has a special status.
It is temporarily activated each time the argument of a global reference is
-recognized to be a ``Funclass`` istance, i.e., of type :g:`forall x:A, B` or
+recognized to be a ``Funclass`` instance, i.e., of type :g:`forall x:A, B` or
:g:`A -> B`.
@@ -1657,15 +1663,15 @@ Tactic notations allow to customize the syntax of tactics. They have the followi
tacn : Tactic Notation [`tactic_level`] [`prod_item` … `prod_item`] := `tactic`.
prod_item : `string` | `tactic_argument_type`(`ident`)
tactic_level : (at level `num`)
- tactic_argument_type : `ident` | `simple_intropattern` | `reference`
- : `hyp` | `hyp_list` | `ne_hyp_list`
- : `constr` | `uconstr` | `constr_list` | `ne_constr_list`
- : `integer` | `integer_list` | `ne_integer_list`
- : `int_or_var` | `int_or_var_list` | `ne_int_or_var_list`
- : `tactic` | `tactic0` | `tactic1` | `tactic2` | `tactic3`
- : `tactic4` | `tactic5`
-
-.. cmd:: Tactic Notation {? (at level @level)} {+ @prod_item} := @tactic.
+ tactic_argument_type : ident | simple_intropattern | reference
+ : hyp | hyp_list | ne_hyp_list
+ : constr | uconstr | constr_list | ne_constr_list
+ : integer | integer_list | ne_integer_list
+ : int_or_var | int_or_var_list | ne_int_or_var_list
+ : tactic | tactic0 | tactic1 | tactic2 | tactic3
+ : tactic4 | tactic5
+
+.. cmd:: Tactic Notation {? (at level @num)} {+ @prod_item} := @tactic.
A tactic notation extends the parser and pretty-printer of tactics with a new
rule made of the list of production items. It then evaluates into the
diff --git a/doc/tools/Translator.tex b/doc/tools/Translator.tex
index d8ac640f2a..dde8a7b838 100644
--- a/doc/tools/Translator.tex
+++ b/doc/tools/Translator.tex
@@ -412,7 +412,7 @@ but its behaviour is not to fold the abbreviation at all.}.
{\tt LetTac} could be followed by a specification (called a clause) of
the places where the abbreviation had to be folded (hypothese and/or
conclusion). Clauses are the syntactic notion to denote in which parts
-of a goal a given transformation shold occur. Its basic notation is
+of a goal a given transformation should occur. Its basic notation is
either \TERM{*} (meaning everywhere), or {\tt\textrm{\em hyps} |-
\textrm{\em concl}} where {\em hyps} is either \TERM{*} (to denote all
the hypotheses), or a comma-separated list of either hypothesis name,
@@ -620,7 +620,7 @@ These constraints are met by the makefiles produced by {\tt coq\_makefile}
Otherwise, modify your build program so as to pass option {\tt
-translate} to program {\tt coqc}. The effect of this option is to
-ouptut the translated source of any {\tt .v} file in a file with
+output the translated source of any {\tt .v} file in a file with
extension {\tt .v8} located in the same directory than the original
file.
@@ -675,7 +675,7 @@ solve all occurrences of the problem.
The definition of identifiers changed. Most of those changes are
handled by the translator. They include:
\begin{itemize}
-\item {\tt \_} is not an identifier anymore: it is tranlated to {\tt
+\item {\tt \_} is not an identifier anymore: it is translated to {\tt
x\_}
\item avoid clash with new keywords by adding a trailing {\tt \_}
\end{itemize}
diff --git a/doc/tools/coqrst/coqdoc/main.py b/doc/tools/coqrst/coqdoc/main.py
index 1de9890992..ba58ff0084 100644
--- a/doc/tools/coqrst/coqdoc/main.py
+++ b/doc/tools/coqrst/coqdoc/main.py
@@ -52,7 +52,7 @@ def is_whitespace_string(elem):
return isinstance(elem, NavigableString) and elem.strip() == ""
def strip_soup(soup, pred):
- """Strip elements maching pred from front and tail of soup."""
+ """Strip elements matching pred from front and tail of soup."""
while soup.contents and pred(soup.contents[-1]):
soup.contents.pop()
diff --git a/doc/tools/coqrst/repl/coqtop.py b/doc/tools/coqrst/repl/coqtop.py
index 26f6255069..2b124ee5c1 100644
--- a/doc/tools/coqrst/repl/coqtop.py
+++ b/doc/tools/coqrst/repl/coqtop.py
@@ -47,7 +47,7 @@ class CoqTop:
:param coqtop_bin: The path to coqtop; uses $COQBIN by default, falling back to "coqtop"
:param color: When True, tell coqtop to produce ANSI color codes (see
the ansicolors module)
- :param args: Additional arugments to coqtop.
+ :param args: Additional arguments to coqtop.
"""
self.coqtop_bin = coqtop_bin or os.path.join(os.getenv('COQBIN', ""), "coqtop")
if not pexpect.utils.which(self.coqtop_bin):
@@ -68,7 +68,7 @@ class CoqTop:
self.coqtop.kill(9)
def next_prompt(self):
- """Wait for the next coqtop prompt, and return the output preceeding it."""
+ """Wait for the next coqtop prompt, and return the output preceding it."""
self.coqtop.expect(CoqTop.COQTOP_PROMPT, timeout = 10)
return self.coqtop.before
diff --git a/doc/whodidwhat/whodidwhat-8.2update.tex b/doc/whodidwhat/whodidwhat-8.2update.tex
index 4f4f0e952e..f45e6564f2 100644
--- a/doc/whodidwhat/whodidwhat-8.2update.tex
+++ b/doc/whodidwhat/whodidwhat-8.2update.tex
@@ -181,7 +181,7 @@
\item Options management: Hugo Herbelin with contributions by Arnaud Spiwack
\item Resetting and backtracking: Chet Murthy with contributions from Pierre Courtieu
\item Searching: Hugo Herbelin, Yves Bertot
-\item Whelp suppport: Hugo Herbelin
+\item Whelp support: Hugo Herbelin
\end{itemize}
\section{Parsing and printing}
diff --git a/doc/whodidwhat/whodidwhat-8.3update.tex b/doc/whodidwhat/whodidwhat-8.3update.tex
index 0a07378169..7cce0083d5 100644
--- a/doc/whodidwhat/whodidwhat-8.3update.tex
+++ b/doc/whodidwhat/whodidwhat-8.3update.tex
@@ -188,7 +188,7 @@
\item Options management: Hugo Herbelin with contributions by Arnaud Spiwack
\item Resetting and backtracking: Chet Murthy with contributions from Pierre Courtieu
\item Searching: Hugo Herbelin and Yves Bertot with extensions by Matthias Puech
-\item Whelp suppport: Hugo Herbelin
+\item Whelp support: Hugo Herbelin
\end{itemize}
\section{Parsing and printing}
diff --git a/doc/whodidwhat/whodidwhat-8.4update.tex b/doc/whodidwhat/whodidwhat-8.4update.tex
index bb4c5ce469..2d74a653ed 100644
--- a/doc/whodidwhat/whodidwhat-8.4update.tex
+++ b/doc/whodidwhat/whodidwhat-8.4update.tex
@@ -191,7 +191,7 @@
\item Options management: Hugo Herbelin with contributions by Arnaud Spiwack
\item Resetting and backtracking: Chet Murthy with contributions from Pierre Courtieu
\item Searching: Hugo Herbelin and Yves Bertot with extensions by Matthias Puech
-\item Whelp suppport: Hugo Herbelin
+\item Whelp support: Hugo Herbelin
\end{itemize}
\section{Parsing and printing}
diff --git a/doc/whodidwhat/whodidwhat-8.5update.tex b/doc/whodidwhat/whodidwhat-8.5update.tex
index ce099dc363..600ecf93db 100644
--- a/doc/whodidwhat/whodidwhat-8.5update.tex
+++ b/doc/whodidwhat/whodidwhat-8.5update.tex
@@ -197,7 +197,7 @@
\item Options management: Hugo Herbelin with contributions by Arnaud Spiwack
\item Resetting and backtracking: Chet Murthy with contributions from Pierre Courtieu
\item Searching: Hugo Herbelin and Yves Bertot with extensions by Matthias Puech
-\item Whelp suppport: Hugo Herbelin
+\item Whelp support: Hugo Herbelin
\end{itemize}
\section{Parsing and printing}
diff --git a/engine/evarutil.ml b/engine/evarutil.ml
index 0a5bba39b9..7c2ecca89e 100644
--- a/engine/evarutil.ml
+++ b/engine/evarutil.ml
@@ -860,7 +860,7 @@ let compare_constructor_instances evd u u' =
[u] up to existential variable instantiation and equalisable
universes. The term [t] is interpreted in [sigma1] while [u] is
interpreted in [sigma2]. The universe constraints in [sigma2] are
- assumed to be an extention of those in [sigma1]. *)
+ assumed to be an extension of those in [sigma1]. *)
let eq_constr_univs_test sigma1 sigma2 t u =
(* spiwack: mild code duplication with {!Evd.eq_constr_univs}. *)
let open Evd in
diff --git a/engine/evarutil.mli b/engine/evarutil.mli
index 8eaff8bd13..907be8eba2 100644
--- a/engine/evarutil.mli
+++ b/engine/evarutil.mli
@@ -208,7 +208,7 @@ val kind_of_term_upto : evar_map -> Constr.constr ->
[u] up to existential variable instantiation and equalisable
universes. The term [t] is interpreted in [sigma1] while [u] is
interpreted in [sigma2]. The universe constraints in [sigma2] are
- assumed to be an extention of those in [sigma1]. *)
+ assumed to be an extension of those in [sigma1]. *)
val eq_constr_univs_test : evar_map -> evar_map -> constr -> constr -> bool
(** [compare_cumulative_instances cv_pb variance u1 u2 sigma] Returns
diff --git a/engine/evd.ml b/engine/evd.ml
index 0f10a380d3..15b4c31851 100644
--- a/engine/evd.ml
+++ b/engine/evd.ml
@@ -222,7 +222,7 @@ let map_evar_body f = function
let map_evar_info f evi =
{evi with
evar_body = map_evar_body f evi.evar_body;
- evar_hyps = map_named_val f evi.evar_hyps;
+ evar_hyps = map_named_val (fun d -> NamedDecl.map_constr f d) evi.evar_hyps;
evar_concl = f evi.evar_concl;
evar_candidates = Option.map (List.map f) evi.evar_candidates }
diff --git a/engine/ftactic.ml b/engine/ftactic.ml
index dab2e7d5ef..b59d04e813 100644
--- a/engine/ftactic.ml
+++ b/engine/ftactic.ml
@@ -18,8 +18,8 @@ type 'a focus =
(** Type of tactics potentially goal-dependent. If it contains a [Depends],
then the length of the inner list is guaranteed to be the number of
- currently focussed goals. Otherwise it means the tactic does not depend
- on the current set of focussed goals. *)
+ currently focused goals. Otherwise it means the tactic does not depend
+ on the current set of focused goals. *)
type 'a t = 'a focus Proofview.tactic
let return (x : 'a) : 'a t = Proofview.tclUNIT (Uniform x)
diff --git a/engine/ftactic.mli b/engine/ftactic.mli
index ed95d62bc6..5922781d4d 100644
--- a/engine/ftactic.mli
+++ b/engine/ftactic.mli
@@ -18,7 +18,7 @@ type +'a t = 'a focus Proofview.tactic
(** The type of focussing tactics. A focussing tactic is like a normal tactic,
except that it is able to remember it have entered a goal. Whenever this is
the case, each subsequent effect of the tactic is dispatched on the
- focussed goals. This is a monad. *)
+ focused goals. This is a monad. *)
(** {5 Monadic interface} *)
@@ -32,20 +32,20 @@ val bind : 'a t -> ('a -> 'b t) -> 'b t
val lift : 'a Proofview.tactic -> 'a t
(** Transform a tactic into a focussing tactic. The resulting tactic is not
- focussed. *)
+ focused. *)
val run : 'a t -> ('a -> unit Proofview.tactic) -> unit Proofview.tactic
(** Given a continuation producing a tactic, evaluates the focussing tactic. If
- the tactic has not focussed, then the continuation is evaluated once.
- Otherwise it is called in each of the currently focussed goals. *)
+ the tactic has not focused, then the continuation is evaluated once.
+ Otherwise it is called in each of the currently focused goals. *)
(** {5 Focussing} *)
-(** Enter a goal. The resulting tactic is focussed. *)
+(** Enter a goal. The resulting tactic is focused. *)
val enter : (Proofview.Goal.t -> 'a t) -> 'a t
(** Enter a goal, without evar normalization. The resulting tactic is
- focussed. *)
+ focused. *)
val with_env : 'a t -> (Environ.env*'a) t
(** [with_env t] returns, in addition to the return type of [t], an
diff --git a/engine/logic_monad.ml b/engine/logic_monad.ml
index e0c24f049f..a504ee28e2 100644
--- a/engine/logic_monad.ml
+++ b/engine/logic_monad.ml
@@ -151,7 +151,7 @@ struct
(** Double-continuation backtracking monads are reasonable folklore
for "search" implementations (including the Tac interactive
prover's tactics). Yet it's quite hard to wrap your head around
- these. I recommand reading a few times the "Backtracking,
+ these. I recommend reading a few times the "Backtracking,
Interleaving, and Terminating Monad Transformers" paper by
O. Kiselyov, C. Shan, D. Friedman, and A. Sabry. The peculiar
shape of the monadic type is reminiscent of that of the
diff --git a/engine/proofview.ml b/engine/proofview.ml
index 1fd8b5d50e..c00c90e5e9 100644
--- a/engine/proofview.ml
+++ b/engine/proofview.ml
@@ -31,7 +31,7 @@ type entry = (EConstr.constr * EConstr.types) list
ide-s. *)
(* spiwack: the type of [proofview] will change as we push more
refined functions to ide-s. This would be better than spawning a
- new nearly identical function everytime. Hence the generic name. *)
+ new nearly identical function every time. Hence the generic name. *)
(* In this version: returns the list of focused goals together with
the [evar_map] context. *)
let proofview p =
@@ -46,7 +46,7 @@ let compact el ({ solution } as pv) =
let apply_subst_einfo _ ei =
Evd.({ ei with
evar_concl = nf ei.evar_concl;
- evar_hyps = Environ.map_named_val nf0 ei.evar_hyps;
+ evar_hyps = Environ.map_named_val (fun d -> map_constr nf0 d) ei.evar_hyps;
evar_candidates = Option.map (List.map nf) ei.evar_candidates }) in
let new_solution = Evd.raw_map_undefined apply_subst_einfo pruned_solution in
let new_size = Evd.fold (fun _ _ i -> i+1) new_solution 0 in
@@ -114,7 +114,7 @@ type focus_context = goal_with_state list * goal_with_state list
instance, ide-s. *)
(* spiwack: the type of [focus_context] will change as we push more
refined functions to ide-s. This would be better than spawning a
- new nearly identical function everytime. Hence the generic name. *)
+ new nearly identical function every time. Hence the generic name. *)
(* In this version: the goals in the context, as a "zipper" (the first
list is in reversed order). *)
let focus_context (left,right) =
@@ -123,7 +123,7 @@ let focus_context (left,right) =
(** This (internal) function extracts a sublist between two indices,
and returns this sublist together with its context: if it returns
[(a,(b,c))] then [a] is the sublist and [(rev b) @ a @ c] is the
- original list. The focused list has lenght [j-i-1] and contains
+ original list. The focused list has length [j-i-1] and contains
the goals from number [i] to number [j] (both included) the first
goal of the list being numbered [1]. [focus_sublist i j l] raises
[IndexOutOfRange] if [i > length l], or [j > length l] or [j <
@@ -245,7 +245,7 @@ let tclUNIT = Proof.return
(** Bind operation of the tactic monad. *)
let tclBIND = Proof.(>>=)
-(** Interpretes the ";" (semicolon) of Ltac. As a monadic operation,
+(** Interprets the ";" (semicolon) of Ltac. As a monadic operation,
it's a specialized "bind". *)
let tclTHEN = Proof.(>>)
diff --git a/engine/proofview.mli b/engine/proofview.mli
index b7ff3ac432..60697c1611 100644
--- a/engine/proofview.mli
+++ b/engine/proofview.mli
@@ -24,7 +24,7 @@ type proofview
ide-s. *)
(* spiwack: the type of [proofview] will change as we push more
refined functions to ide-s. This would be better than spawning a
- new nearly identical function everytime. Hence the generic name. *)
+ new nearly identical function every time. Hence the generic name. *)
(* In this version: returns the list of focused goals together with
the [evar_map] context. *)
val proofview : proofview -> Evar.t list * Evd.evar_map
@@ -95,7 +95,7 @@ type focus_context
instance, ide-s. *)
(* spiwack: the type of [focus_context] will change as we push more
refined functions to ide-s. This would be better than spawning a
- new nearly identical function everytime. Hence the generic name. *)
+ new nearly identical function every time. Hence the generic name. *)
(* In this version: the goals in the context, as a "zipper" (the first
list is in reversed order). *)
val focus_context : focus_context -> Evar.t list * Evar.t list
diff --git a/engine/proofview_monad.ml b/engine/proofview_monad.ml
index 80eb9d0124..8ed75a8d00 100644
--- a/engine/proofview_monad.ml
+++ b/engine/proofview_monad.ml
@@ -252,7 +252,7 @@ module Giveup : Writer with type t = goal list = struct
let put gs = Logical.put (true, gs)
end
-(** Lens and utilies pertaining to the info trace *)
+(** Lens and utilities pertaining to the info trace *)
module InfoL = struct
let recording = Logical.(map (fun {P.trace} -> trace) current)
let if_recording t =
diff --git a/engine/proofview_monad.mli b/engine/proofview_monad.mli
index 3437b6ce77..f0c9fdb589 100644
--- a/engine/proofview_monad.mli
+++ b/engine/proofview_monad.mli
@@ -145,7 +145,7 @@ module Shelf : State with type t = goal list
of the tactic. *)
module Giveup : Writer with type t = goal list
-(** Lens and utilies pertaining to the info trace *)
+(** Lens and utilities pertaining to the info trace *)
module InfoL : sig
(** [record_trace t] behaves like [t] and compute its [info] trace. *)
val record_trace : 'a Logical.t -> 'a Logical.t
diff --git a/engine/univMinim.ml b/engine/univMinim.ml
index fcbf305f9d..4f9f9ce6a5 100644
--- a/engine/univMinim.ml
+++ b/engine/univMinim.ml
@@ -353,7 +353,7 @@ let normalize_context_set g ctx us algs weak =
noneqs Constraint.empty
in
(* Compute the left and right set of flexible variables, constraints
- mentionning other variables remain in noneqs. *)
+ mentioning other variables remain in noneqs. *)
let noneqs, ucstrsl, ucstrsr =
Constraint.fold (fun (l,d,r as cstr) (noneq, ucstrsl, ucstrsr) ->
let lus = LMap.mem l us and rus = LMap.mem r us in
diff --git a/gramlib/grammar.ml b/gramlib/grammar.ml
index c452c7b307..f9d18e7190 100644
--- a/gramlib/grammar.ml
+++ b/gramlib/grammar.ml
@@ -222,7 +222,7 @@ let is_before : type s1 s2 r1 r2 a1 a2. (s1, r1, a1) ty_symbol -> (s2, r2, a2) t
| Stoken _, _ -> true
| _ -> false
-(** Ancilliary datatypes *)
+(** Ancillary datatypes *)
type 'a ty_rec = MayRec : ty_mayrec ty_rec | NoRec : ty_norec ty_rec
diff --git a/ide/configwin_types.ml b/ide/configwin_types.ml
index 251e3dded3..4c66a6944e 100644
--- a/ide/configwin_types.ml
+++ b/ide/configwin_types.ml
@@ -87,7 +87,7 @@ type modifiers_param = {
(** The value, as a list of modifiers and a key code *)
md_editable : bool ; (** indicates if the value can be changed *)
md_f_apply : Gdk.Tags.modifier list -> unit ;
- (** the function to call to apply the new value of the paramter *)
+ (** the function to call to apply the new value of the parameter *)
md_help : string option ; (** optional help string *)
md_expand : bool ; (** expand or not *)
md_allow : Gdk.Tags.modifier list
diff --git a/ide/idetop.ml b/ide/idetop.ml
index ce00ba6d8c..970d7cf650 100644
--- a/ide/idetop.ml
+++ b/ide/idetop.ml
@@ -537,7 +537,11 @@ let rec parse = function
Xmlprotocol.document Xml_printer.to_string_fmt; exit 0
| "--xml_format=Ppcmds" :: rest ->
msg_format := (fun () -> Xmlprotocol.Ppcmds); parse rest
- | x :: rest -> x :: parse rest
+ | x :: rest ->
+ if String.length x > 0 && x.[0] = '-' then
+ (prerr_endline ("Unknown option " ^ x); exit 1)
+ else
+ x :: parse rest
| [] -> []
let () = Usage.add_to_usage "coqidetop"
diff --git a/ide/protocol/interface.ml b/ide/protocol/interface.ml
index ccb6bedaf6..9d8fdf6335 100644
--- a/ide/protocol/interface.ml
+++ b/ide/protocol/interface.ml
@@ -34,7 +34,7 @@ type status = {
status_path : string list;
(** Module path of the current proof *)
status_proofname : string option;
- (** Current proof name. [None] if no focussed proof is in progress *)
+ (** Current proof name. [None] if no focused proof is in progress *)
status_allproofs : string list;
(** List of all pending proofs. Order is not significant *)
status_proofnum : int;
@@ -43,7 +43,7 @@ type status = {
type 'a pre_goals = {
fg_goals : 'a list;
- (** List of the focussed goals *)
+ (** List of the focused goals *)
bg_goals : ('a list * 'a list) list;
(** Zipper representing the unfocused background goals *)
shelved_goals : 'a list;
@@ -70,7 +70,7 @@ type option_state = {
opt_sync : bool;
(** Whether an option is synchronous *)
opt_depr : bool;
- (** Wheter an option is deprecated *)
+ (** Whether an option is deprecated *)
opt_name : string;
(** A short string that is displayed when using [Test] *)
opt_value : option_value;
diff --git a/ide/protocol/richpp.mli b/ide/protocol/richpp.mli
index 31fc7b56f1..18d4b1eeee 100644
--- a/ide/protocol/richpp.mli
+++ b/ide/protocol/richpp.mli
@@ -25,7 +25,7 @@ type 'annotation located = {
of [ppcmds] as a semi-structured document
that represents (located) annotations of this string.
The [get_annotations] function is used to convert tags into the desired
- annotation. [width] sets the printing witdh of the formatter. *)
+ annotation. [width] sets the printing width of the formatter. *)
val rich_pp : int -> Pp.t -> Pp.pp_tag located Xml_datatype.gxml
(** [annotations_positions ssdoc] returns a list associating each
diff --git a/ide/protocol/xml_printer.mli b/ide/protocol/xml_printer.mli
index 178f7c808f..4b47aa9f7c 100644
--- a/ide/protocol/xml_printer.mli
+++ b/ide/protocol/xml_printer.mli
@@ -16,11 +16,11 @@ type target = TChannel of out_channel | TBuffer of Buffer.t
val make : target -> t
(** Print the xml data structure to a source into a compact xml string (without
- any user-readable formating ). *)
+ any user-readable formatting ). *)
val print : t -> xml -> unit
(** Print the xml data structure into a compact xml string (without
- any user-readable formating ). *)
+ any user-readable formatting ). *)
val to_string : xml -> string
(** Print the xml data structure into an user-readable string with
diff --git a/ide/protocol/xmlprotocol.ml b/ide/protocol/xmlprotocol.ml
index e18219210f..5b37ca35ed 100644
--- a/ide/protocol/xmlprotocol.ml
+++ b/ide/protocol/xmlprotocol.ml
@@ -405,7 +405,7 @@ end = struct
| (lg, rg) :: l ->
Printf.sprintf "%i:%a"
(List.length lg + List.length rg) pr_focus l in
- Printf.sprintf "Still focussed: [%a]." pr_focus g.bg_goals
+ Printf.sprintf "Still focused: [%a]." pr_focus g.bg_goals
else
let pr_goal { goal_hyp = hyps; goal_ccl = goal } =
"[" ^ String.concat "; " (List.map Pp.string_of_ppcmds hyps) ^ " |- " ^
diff --git a/interp/constrexpr.ml b/interp/constrexpr.ml
index 9f778d99e9..3ebbbdfb88 100644
--- a/interp/constrexpr.ml
+++ b/interp/constrexpr.ml
@@ -40,8 +40,8 @@ type explicitation =
type binder_kind =
| Default of binding_kind
- | Generalized of binding_kind * binding_kind * bool
- (** Inner binding, outer bindings, typeclass-specific flag
+ | Generalized of binding_kind * bool
+ (** (Inner binding always Implicit) Outer bindings, typeclass-specific flag
for implicit generalization of superclasses *)
type abstraction_kind = AbsLambda | AbsPi
diff --git a/interp/constrexpr_ops.ml b/interp/constrexpr_ops.ml
index 443473d5b6..bcb2f34377 100644
--- a/interp/constrexpr_ops.ml
+++ b/interp/constrexpr_ops.ml
@@ -34,8 +34,8 @@ let abstraction_kind_eq ak1 ak2 = match ak1, ak2 with
let binder_kind_eq b1 b2 = match b1, b2 with
| Default bk1, Default bk2 -> binding_kind_eq bk1 bk2
-| Generalized (bk1, ck1, b1), Generalized (bk2, ck2, b2) ->
- binding_kind_eq bk1 bk2 && binding_kind_eq ck1 ck2 &&
+| Generalized (ck1, b1), Generalized (ck2, b2) ->
+ binding_kind_eq ck1 ck2 &&
(if b1 then b2 else not b2)
| _ -> false
diff --git a/interp/constrextern.ml b/interp/constrextern.ml
index bb66658a37..fe50bd4b08 100644
--- a/interp/constrextern.ml
+++ b/interp/constrextern.ml
@@ -107,7 +107,7 @@ let _show_inactive_notations () =
let deactivate_notation nr =
match nr with
| SynDefRule kn ->
- (* shouldn't we check wether it is well defined? *)
+ (* shouldn't we check whether it is well defined? *)
inactive_notations_table := IRuleSet.add nr !inactive_notations_table
| NotationRule (scopt, ntn) ->
match availability_of_notation (scopt, ntn) (scopt, []) with
diff --git a/interp/constrintern.ml b/interp/constrintern.ml
index f06493b374..31f3736bae 100644
--- a/interp/constrintern.ml
+++ b/interp/constrintern.ml
@@ -389,7 +389,7 @@ let push_name_env ?(global_level=false) ntnvars implargs env =
{env with ids = Id.Set.add id env.ids; impls = Id.Map.add id implargs env.impls}
let intern_generalized_binder ?(global_level=false) intern_type ntnvars
- env {loc;v=na} b b' t ty =
+ env {loc;v=na} b' t ty =
let ids = (match na with Anonymous -> fun x -> x | Name na -> Id.Set.add na) env.ids in
let ty, ids' =
if t then ty, ids else
@@ -403,7 +403,7 @@ let intern_generalized_binder ?(global_level=false) intern_type ntnvars
env fvs in
let bl = List.map
CAst.(map (fun id ->
- (Name id, b, DAst.make ?loc @@ GHole (Evar_kinds.BinderType (Name id), IntroAnonymous, None))))
+ (Name id, Implicit, DAst.make ?loc @@ GHole (Evar_kinds.BinderType (Name id), IntroAnonymous, None))))
fvs
in
let na = match na with
@@ -433,8 +433,8 @@ let intern_assumption intern ntnvars env nal bk ty =
(push_name_env ntnvars impls env locna,
(make ?loc (na,k,locate_if_hole ?loc na ty))::bl))
(env, []) nal
- | Generalized (b,b',t) ->
- let env, b = intern_generalized_binder intern_type ntnvars env (List.hd nal) b b' t ty in
+ | Generalized (b',t) ->
+ let env, b = intern_generalized_binder intern_type ntnvars env (List.hd nal) b' t ty in
env, b
let glob_local_binder_of_extended = DAst.with_loc_val (fun ?loc -> function
@@ -1229,7 +1229,7 @@ let add_local_defs_and_check_length loc env g pl args = match g with
let maxargs = Inductiveops.constructor_nalldecls env cstr in
if List.length pl' + List.length args > maxargs then
error_wrong_numarg_constructor ?loc env cstr (Inductiveops.constructor_nrealargs env cstr);
- (* Two possibilities: either the args are given with explict
+ (* Two possibilities: either the args are given with explicit
variables for local definitions, then we give the explicit args
extended with local defs, so that there is nothing more to be
added later on; or the args are not enough to have all arguments,
@@ -1467,7 +1467,7 @@ let alias_of als = match als.alias_ids with
@returns a raw_case_pattern_expr :
- no notations and syntactic definition
- - global reference and identifeir instead of reference
+ - global reference and identifier instead of reference
*)
@@ -1642,7 +1642,7 @@ let drop_notations_pattern looked_for genv =
| CPatCast (_,_) ->
(* We raise an error if the pattern contains a cast, due to
current restrictions on casts in patterns. Cast in patterns
- are supportted only in local binders and only at top
+ are supported only in local binders and only at top
level. In fact, they are currently eliminated by the
parser. The only reason why they are in the
[cases_pattern_expr] type is that the parser needs to factor
diff --git a/interp/declare.ml b/interp/declare.ml
index 76b4bab2ce..7ee7ecb5e8 100644
--- a/interp/declare.ml
+++ b/interp/declare.ml
@@ -36,9 +36,8 @@ type internal_flag =
(** Declaration of constants and parameters *)
type constant_obj = {
- cst_decl : global_declaration option;
- (** [None] when the declaration is a side-effect and has already been defined
- in the global environment. *)
+ cst_decl : Cooking.recipe option;
+ (** Non-empty only when rebuilding a constant after a section *)
cst_kind : logical_kind;
cst_locl : bool;
}
@@ -65,21 +64,21 @@ let open_constant i ((sp,kn), obj) =
let exists_name id =
variable_exists id || Global.exists_objlabel (Label.of_id id)
-let check_exists sp =
- let id = basename sp in
+let check_exists id =
if exists_name id then alreadydeclared (Id.print id ++ str " already exists")
let cache_constant ((sp,kn), obj) =
+ (* Invariant: the constant must exist in the logical environment, except when
+ redefining it when exiting a section. See [discharge_constant]. *)
let id = basename sp in
let kn' =
match obj.cst_decl with
| None ->
if Global.exists_objlabel (Label.of_id (basename sp))
then Constant.make1 kn
- else CErrors.anomaly Pp.(str"Ex seff not found: " ++ Id.print(basename sp) ++ str".")
- | Some decl ->
- let () = check_exists sp in
- Global.add_constant ~in_section:(Lib.sections_are_opened ()) id decl
+ else CErrors.anomaly Pp.(str"Missing constant " ++ Id.print(basename sp) ++ str".")
+ | Some r ->
+ Global.add_recipe ~in_section:(Lib.sections_are_opened ()) id r
in
assert (Constant.equal kn' (Constant.make1 kn));
Nametab.push (Nametab.Until 1) sp (ConstRef (Constant.make1 kn));
@@ -93,7 +92,9 @@ let discharge_constant ((sp, kn), obj) =
let modlist = replacement_context () in
let { abstr_ctx = hyps; abstr_subst = subst; abstr_uctx = uctx } = section_segment_of_constant con in
let abstract = (named_of_variable_context hyps, subst, uctx) in
- let new_decl = GlobalRecipe{ from; info = { Opaqueproof.modlist; abstract}} in
+ let new_decl = { from; info = { Opaqueproof.modlist; abstract } } in
+ (* This is a hack: when leaving a section, we lose the constant definition, so
+ we have to store it in the libobject to be able to retrieve it after. *)
Some { obj with cst_decl = Some new_decl; }
(* Hack to reduce the size of .vo: we keep only what load/open needs *)
@@ -121,27 +122,22 @@ let update_tables c =
declare_constant_implicits c;
Notation.declare_ref_arguments_scope Evd.empty (ConstRef c)
-let register_side_effect (c, role) =
+let register_constant kn kind local =
let o = inConstant {
cst_decl = None;
- cst_kind = IsProof Theorem;
- cst_locl = false;
+ cst_kind = kind;
+ cst_locl = local;
} in
- let id = Label.to_id (Constant.label c) in
- ignore(add_leaf id o);
- update_tables c;
+ let id = Label.to_id (Constant.label kn) in
+ let _ = add_leaf id o in
+ update_tables kn
+
+let register_side_effect (c, role) =
+ let () = register_constant c (IsProof Theorem) false in
match role with
| Subproof -> ()
| Schema (ind, kind) -> !declare_scheme kind [|ind,c|]
-let declare_constant_common id cst =
- let o = inConstant cst in
- let _, kn as oname = add_leaf id o in
- pull_to_head oname;
- let c = Global.constant_of_delta_kn kn in
- update_tables c;
- c
-
let default_univ_entry = Monomorphic_entry Univ.ContextSet.empty
let definition_entry ?fix_exn ?(opaque=false) ?(inline=false) ?types
?(univs=default_univ_entry) ?(eff=Safe_typing.empty_private_constants) body =
@@ -153,7 +149,8 @@ let definition_entry ?fix_exn ?(opaque=false) ?(inline=false) ?types
const_entry_feedback = None;
const_entry_inline_code = inline}
-let declare_constant ?(internal = UserIndividualRequest) ?(local = false) id ?(export_seff=false) (cd, kind) =
+let define_constant ?role ?(export_seff=false) id cd =
+ (* Logically define the constant and its subproofs, no libobject tampering *)
let is_poly de = match de.const_entry_universes with
| Monomorphic_entry _ -> false
| Polymorphic_entry _ -> true
@@ -165,20 +162,27 @@ let declare_constant ?(internal = UserIndividualRequest) ?(local = false) id ?(e
export_seff ||
not de.const_entry_opaque ||
is_poly de ->
- (* This globally defines the side-effects in the environment. We mark
- exported constants as being side-effect not to redeclare them at
- caching time. *)
+ (* This globally defines the side-effects in the environment. *)
let de, export = Global.export_private_constants ~in_section de in
export, ConstantEntry (PureEntry, DefinitionEntry de)
| _ -> [], ConstantEntry (EffectEntry, cd)
in
+ let kn, eff = Global.add_constant ?role ~in_section id decl in
+ kn, eff, export
+
+let declare_constant ?(internal = UserIndividualRequest) ?(local = false) id ?(export_seff=false) (cd, kind) =
+ let () = check_exists id in
+ let kn, _eff, export = define_constant ~export_seff id cd in
+ (* Register the libobjects attached to the constants and its subproofs *)
let () = List.iter register_side_effect export in
- let cst = {
- cst_decl = Some decl;
- cst_kind = kind;
- cst_locl = local;
- } in
- declare_constant_common id cst
+ let () = register_constant kn kind local in
+ kn
+
+let declare_private_constant ~role ?(internal=UserIndividualRequest) ?(local = false) id (cd, kind) =
+ let kn, eff, export = define_constant ~role id cd in
+ let () = assert (List.is_empty export) in
+ let () = register_constant kn kind local in
+ kn, eff
let declare_definition ?(internal=UserIndividualRequest)
?(opaque=false) ?(kind=Decl_kinds.Definition) ?(local = false)
@@ -297,7 +301,7 @@ let open_inductive i ((sp,kn),mie) =
let cache_inductive ((sp,kn),mie) =
let names = inductive_names sp kn mie in
- List.iter check_exists (List.map fst names);
+ List.iter check_exists (List.map (fun p -> basename (fst p)) names);
let id = basename sp in
let kn' = Global.add_mind id mie in
assert (MutInd.equal kn' (MutInd.make1 kn));
diff --git a/interp/declare.mli b/interp/declare.mli
index 8f1e73c88c..795d9a767d 100644
--- a/interp/declare.mli
+++ b/interp/declare.mli
@@ -40,7 +40,7 @@ type internal_flag =
| InternalTacticRequest
| UserIndividualRequest
-(* Defaut definition entries, transparent with no secctx or proj information *)
+(* Default definition entries, transparent with no secctx or proj information *)
val definition_entry : ?fix_exn:Future.fix_exn ->
?opaque:bool -> ?inline:bool -> ?types:types ->
?univs:Entries.universes_entry ->
@@ -55,6 +55,9 @@ val definition_entry : ?fix_exn:Future.fix_exn ->
val declare_constant :
?internal:internal_flag -> ?local:bool -> Id.t -> ?export_seff:bool -> constant_declaration -> Constant.t
+val declare_private_constant :
+ role:side_effect_role -> ?internal:internal_flag -> ?local:bool -> Id.t -> constant_declaration -> Constant.t * Safe_typing.private_constants
+
val declare_definition :
?internal:internal_flag -> ?opaque:bool -> ?kind:definition_object_kind ->
?local:bool -> Id.t -> ?types:constr ->
diff --git a/interp/impargs.ml b/interp/impargs.ml
index 806fe93297..f3cdd64633 100644
--- a/interp/impargs.ml
+++ b/interp/impargs.ml
@@ -96,11 +96,11 @@ let set_maximality imps b =
this kind if there is enough arguments to infer them)
- [DepFlex] means that the implicit argument can be found by unification
- along a collapsable path only (e.g. as x in (P x) where P is another
+ along a collapsible path only (e.g. as x in (P x) where P is another
argument) (we do (defensively) print the arguments of this kind)
- [DepFlexAndRigid] means that the least argument from which the
- implicit argument can be inferred is following a collapsable path
+ implicit argument can be inferred is following a collapsible path
but there is a greater argument from where the implicit argument is
inferable following a rigid path (useful to know how to print a
partial application)
diff --git a/interp/impargs.mli b/interp/impargs.mli
index ccdd448460..1099074c63 100644
--- a/interp/impargs.mli
+++ b/interp/impargs.mli
@@ -34,7 +34,7 @@ val with_implicit_protection : ('a -> 'b) -> 'a -> 'b
(** {6 ... } *)
(** An [implicits_list] is a list of positions telling which arguments
- of a reference can be automatically infered *)
+ of a reference can be automatically inferred *)
type argument_position =
@@ -50,11 +50,11 @@ type implicit_explanation =
this kind if there is enough arguments to infer them) *)
| DepFlex of argument_position
(** means that the implicit argument can be found by unification
- along a collapsable path only (e.g. as x in (P x) where P is another
+ along a collapsible path only (e.g. as x in (P x) where P is another
argument) (we do (defensively) print the arguments of this kind) *)
| DepFlexAndRigid of (*flex*) argument_position * (*rig*) argument_position
(** means that the least argument from which the
- implicit argument can be inferred is following a collapsable path
+ implicit argument can be inferred is following a collapsible path
but there is a greater argument from where the implicit argument is
inferable following a rigid path (useful to know how to print a
partial application) *)
diff --git a/interp/implicit_quantifiers.ml b/interp/implicit_quantifiers.ml
index 6277d874dd..bac46c2d2f 100644
--- a/interp/implicit_quantifiers.ml
+++ b/interp/implicit_quantifiers.ml
@@ -196,10 +196,9 @@ let combine_params avoid fn applied needed =
user_err ?loc:(Constrexpr_ops.constr_loc x) (str "Typeclass does not expect more arguments")
in aux [] avoid applied needed
-let combine_params_freevar =
- fun avoid (_, decl) ->
- let id' = next_name_away_from (RelDecl.get_name decl) avoid in
- (CAst.make @@ CRef (qualid_of_ident id',None), Id.Set.add id' avoid)
+let combine_params_freevar avoid (_, decl) =
+ let id' = next_name_away_from (RelDecl.get_name decl) avoid in
+ (CAst.make @@ CRef (qualid_of_ident id',None), Id.Set.add id' avoid)
let destClassApp cl =
let open CAst in
@@ -222,34 +221,34 @@ let implicit_application env ?(allow_partial=true) f ty =
let is_class =
try
let ({CAst.v=(qid, _, _)} as clapp) = destClassAppExpl ty in
- let gr = Nametab.locate qid in
- if Typeclasses.is_class gr then Some (clapp, gr) else None
+ if Libnames.idset_mem_qualid qid env then None
+ else
+ let gr = Nametab.locate qid in
+ if Typeclasses.is_class gr then Some (clapp, gr) else None
with Not_found -> None
in
- match is_class with
- | None -> ty, env
- | Some ({CAst.loc;v=(id, par, inst)}, gr) ->
- let avoid = Id.Set.union env (ids_of_list (free_vars_of_constr_expr ty ~bound:env [])) in
- let c, avoid =
- let env = Global.env () in
- let sigma = Evd.from_env env in
- let c = class_info env sigma gr in
- let (ci, rd) = c.cl_context in
- if not allow_partial then
- begin
- let opt_succ x n = match x with
- | None -> succ n
- | Some _ -> n
- in
- let applen = List.fold_left (fun acc (x, y) -> opt_succ y acc) 0 par in
- let needlen = List.fold_left (fun acc x -> opt_succ x acc) 0 ci in
- if not (Int.equal needlen applen) then
- mismatched_ctx_inst_err (Global.env ()) Typeclasses_errors.Parameters (List.map fst par) rd
- end;
- let pars = List.rev (List.combine ci rd) in
- let args, avoid = combine_params avoid f par pars in
- CAst.make ?loc @@ CAppExpl ((None, id, inst), args), avoid
- in c, avoid
+ match is_class with
+ | None -> ty, env
+ | Some ({CAst.loc;v=(id, par, inst)}, gr) ->
+ let avoid = Id.Set.union env (ids_of_list (free_vars_of_constr_expr ty ~bound:env [])) in
+ let env = Global.env () in
+ let sigma = Evd.from_env env in
+ let c = class_info env sigma gr in
+ let (ci, rd) = c.cl_context in
+ if not allow_partial then
+ begin
+ let opt_succ x n = match x with
+ | None -> succ n
+ | Some _ -> n
+ in
+ let applen = List.fold_left (fun acc (x, y) -> opt_succ y acc) 0 par in
+ let needlen = List.fold_left (fun acc x -> opt_succ x acc) 0 ci in
+ if not (Int.equal needlen applen) then
+ mismatched_ctx_inst_err (Global.env ()) Typeclasses_errors.Parameters (List.map fst par) rd
+ end;
+ let pars = List.rev (List.combine ci rd) in
+ let args, avoid = combine_params avoid f par pars in
+ CAst.make ?loc @@ CAppExpl ((None, id, inst), args), avoid
let warn_ignoring_implicit_status =
CWarnings.create ~name:"ignoring_implicit_status" ~category:"implicits"
diff --git a/interp/syntax_def.ml b/interp/syntax_def.ml
index 49273c4146..a7e1de736c 100644
--- a/interp/syntax_def.ml
+++ b/interp/syntax_def.ml
@@ -48,7 +48,7 @@ let open_syntax_constant i ((sp,kn),(_,pat,onlyparse)) =
match onlyparse with
| None ->
(* Redeclare it to be used as (short) name in case an other (distfix)
- notation was declared inbetween *)
+ notation was declared in between *)
Notation.declare_uninterpretation (Notation.SynDefRule kn) pat
| _ -> ()
end
diff --git a/kernel/byterun/coq_memory.c b/kernel/byterun/coq_memory.c
index 542a05fd25..a1c49bee95 100644
--- a/kernel/byterun/coq_memory.c
+++ b/kernel/byterun/coq_memory.c
@@ -105,7 +105,7 @@ value init_coq_vm(value unit) /* ML */
init_coq_interpreter();
/* Some predefined pointer code.
- * It is typically contained in accumlator blocks whose tag is 0 and thus
+ * It is typically contained in accumulator blocks whose tag is 0 and thus
* scanned by the GC, so make it look like an OCaml block. */
value accu_block = (value) coq_stat_alloc(2 * sizeof(value));
Hd_hp (accu_block) = Make_header (1, Abstract_tag, Caml_black); \
diff --git a/kernel/cClosure.ml b/kernel/cClosure.ml
index 412637c4b6..fc7d1a54f2 100644
--- a/kernel/cClosure.ml
+++ b/kernel/cClosure.ml
@@ -226,7 +226,7 @@ let unfold_red kn =
* this constant or abstraction.
* * i_tab is the cache table of the results
*
- * ref_value_cache searchs in the tab, otherwise uses i_repr to
+ * ref_value_cache searches in the tab, otherwise uses i_repr to
* compute the result and store it in the table. If the constant can't
* be unfolded, returns None, but does not store this failure. * This
* doesn't take the RESET into account. You mustn't keep such a table
@@ -389,7 +389,7 @@ type clos_infos = {
i_flags : reds;
i_cache : infos_cache }
-type clos_tab = fconstr constant_def KeyTable.t
+type clos_tab = (fconstr, Empty.t) constant_def KeyTable.t
let info_flags info = info.i_flags
let info_env info = info.i_cache.i_env
@@ -645,7 +645,7 @@ and subst_constr subst c = match [@ocaml.warning "-4"] Constr.kind c with
and comp_subs el s =
Esubst.lift_subst (fun el c -> lazy (to_constr el c)) el s
-(* This function defines the correspondance between constr and
+(* This function defines the correspondence between constr and
fconstr. When we find a closure whose substitution is the identity,
then we directly return the constr to avoid possibly huge
reallocation. *)
diff --git a/kernel/cClosure.mli b/kernel/cClosure.mli
index b1b69dded8..60185464c5 100644
--- a/kernel/cClosure.mli
+++ b/kernel/cClosure.mli
@@ -200,7 +200,7 @@ val whd_val : clos_infos -> clos_tab -> fconstr -> constr
val whd_stack :
clos_infos -> clos_tab -> fconstr -> stack -> fconstr * stack
-(** [eta_expand_ind_stack env ind c s t] computes stacks correspoding
+(** [eta_expand_ind_stack env ind c s t] computes stacks corresponding
to the conversion of the eta expansion of t, considered as an inhabitant
of ind, and the Constructor c of this inductive type applied to arguments
s.
@@ -215,7 +215,7 @@ val eta_expand_ind_stack : env -> inductive -> fconstr -> stack ->
(** Conversion auxiliary functions to do step by step normalisation *)
(** [unfold_reference] unfolds references in a [fconstr] *)
-val unfold_reference : clos_infos -> clos_tab -> table_key -> fconstr constant_def
+val unfold_reference : clos_infos -> clos_tab -> table_key -> (fconstr, Util.Empty.t) constant_def
(***********************************************************************
i This is for lazy debug *)
diff --git a/kernel/cbytegen.ml b/kernel/cbytegen.ml
index 69f004307d..90fbcb8ae3 100644
--- a/kernel/cbytegen.ml
+++ b/kernel/cbytegen.ml
@@ -386,7 +386,7 @@ let rec is_tailcall = function
| Klabel _ :: c -> is_tailcall c
| _ -> None
-(* Extention of the continuation *)
+(* Extension of the continuation *)
(* Add a Kpop n instruction in front of a continuation *)
let rec add_pop n = function
diff --git a/kernel/cbytegen.mli b/kernel/cbytegen.mli
index 6a9550342c..bdaf5fe422 100644
--- a/kernel/cbytegen.mli
+++ b/kernel/cbytegen.mli
@@ -20,7 +20,7 @@ val compile : fail_on_error:bool ->
(** init, fun, fv *)
val compile_constant_body : fail_on_error:bool ->
- env -> universes -> Constr.t Mod_subst.substituted constant_def ->
+ env -> universes -> (Constr.t Mod_subst.substituted, 'opaque) constant_def ->
body_code option
(** Shortcut of the previous function used during module strengthening *)
diff --git a/kernel/constr.mli b/kernel/constr.mli
index 7fc57cdb8a..aa5878c9d7 100644
--- a/kernel/constr.mli
+++ b/kernel/constr.mli
@@ -141,7 +141,7 @@ val mkRef : GlobRef.t Univ.puniverses -> constr
[mkCase ci p c ac] stand for match [c] as [x] in [I args] return [p] with [ac]
presented as describe in [ci].
- [p] stucture is [fun args x -> "return clause"]
+ [p] structure is [fun args x -> "return clause"]
[ac]{^ ith} element is ith constructor case presented as
{e lambda construct_args (without params). case_term } *)
diff --git a/kernel/cooking.ml b/kernel/cooking.ml
index 9b974c4ecc..9b6e37251f 100644
--- a/kernel/cooking.ml
+++ b/kernel/cooking.ml
@@ -152,11 +152,11 @@ let abstract_constant_body c (hyps, subst) =
let c = Vars.subst_vars subst c in
it_mkLambda_or_LetIn c hyps
-type recipe = { from : constant_body; info : Opaqueproof.cooking_info }
+type recipe = { from : Opaqueproof.opaque constant_body; info : Opaqueproof.cooking_info }
type inline = bool
-type result = {
- cook_body : constr Mod_subst.substituted constant_def;
+type 'opaque result = {
+ cook_body : (constr Mod_subst.substituted, 'opaque) constant_def;
cook_type : types;
cook_universes : universes;
cook_private_univs : Univ.ContextSet.t option;
diff --git a/kernel/cooking.mli b/kernel/cooking.mli
index b0f143c47d..b022e2ac09 100644
--- a/kernel/cooking.mli
+++ b/kernel/cooking.mli
@@ -13,12 +13,12 @@ open Declarations
(** {6 Cooking the constants. } *)
-type recipe = { from : constant_body; info : Opaqueproof.cooking_info }
+type recipe = { from : Opaqueproof.opaque constant_body; info : Opaqueproof.cooking_info }
type inline = bool
-type result = {
- cook_body : constr Mod_subst.substituted constant_def;
+type 'opaque result = {
+ cook_body : (constr Mod_subst.substituted, 'opaque) constant_def;
cook_type : types;
cook_universes : universes;
cook_private_univs : Univ.ContextSet.t option;
@@ -27,7 +27,7 @@ type result = {
cook_context : Constr.named_context option;
}
-val cook_constant : hcons:bool -> recipe -> result
+val cook_constant : hcons:bool -> recipe -> Opaqueproof.opaque result
val cook_constr : Opaqueproof.cooking_info -> constr -> constr
(** {6 Utility functions used in module [Discharge]. } *)
diff --git a/kernel/declarations.ml b/kernel/declarations.ml
index 5551742c02..860d19fe26 100644
--- a/kernel/declarations.ml
+++ b/kernel/declarations.ml
@@ -22,11 +22,11 @@ type engagement = set_predicativity
(** {6 Representation of constants (Definition/Axiom) } *)
(** Non-universe polymorphic mode polymorphism (Coq 8.2+): inductives
- and constants hiding inductives are implicitely polymorphic when
+ and constants hiding inductives are implicitly polymorphic when
applied to parameters, on the universes appearing in the whnf of
their parameters and their conclusion, in a template style.
- In truely universe polymorphic mode, we always use RegularArity.
+ In truly universe polymorphic mode, we always use RegularArity.
*)
type template_arity = {
@@ -47,10 +47,10 @@ type inline = int option
transparent body, or an opaque one *)
(* Global declarations (i.e. constants) can be either: *)
-type 'a constant_def =
+type ('a, 'opaque) constant_def =
| Undef of inline (** a global assumption *)
| Def of 'a (** or a transparent global definition *)
- | OpaqueDef of Opaqueproof.opaque (** or an opaque global definition *)
+ | OpaqueDef of 'opaque (** or an opaque global definition *)
| Primitive of CPrimitives.t (** or a primitive operation *)
type universes =
@@ -87,9 +87,9 @@ type typing_flags = {
(* some contraints are in constant_constraints, some other may be in
* the OpaqueDef *)
-type constant_body = {
+type 'opaque constant_body = {
const_hyps : Constr.named_context; (** New: younger hyp at top *)
- const_body : Constr.t Mod_subst.substituted constant_def;
+ const_body : (Constr.t Mod_subst.substituted, 'opaque) constant_def;
const_type : types;
const_relevance : Sorts.relevance;
const_body_code : Cemitcodes.to_patch_substituted option;
@@ -246,7 +246,7 @@ type module_alg_expr =
(** A component of a module structure *)
type structure_field_body =
- | SFBconst of constant_body
+ | SFBconst of Opaqueproof.opaque constant_body
| SFBmind of mutual_inductive_body
| SFBmodule of module_body
| SFBmodtype of module_type_body
diff --git a/kernel/declareops.mli b/kernel/declareops.mli
index 54a853fc81..fb02c6a029 100644
--- a/kernel/declareops.mli
+++ b/kernel/declareops.mli
@@ -26,21 +26,21 @@ val map_decl_arity : ('a -> 'c) -> ('b -> 'd) ->
(** {6 Constants} *)
-val subst_const_body : substitution -> constant_body -> constant_body
+val subst_const_body : substitution -> Opaqueproof.opaque constant_body -> Opaqueproof.opaque constant_body
(** Is there a actual body in const_body ? *)
-val constant_has_body : constant_body -> bool
+val constant_has_body : 'a constant_body -> bool
-val constant_polymorphic_context : constant_body -> AUContext.t
+val constant_polymorphic_context : 'a constant_body -> AUContext.t
(** Is the constant polymorphic? *)
-val constant_is_polymorphic : constant_body -> bool
+val constant_is_polymorphic : 'a constant_body -> bool
(** Return the universe context, in case the definition is polymorphic, otherwise
the context is empty. *)
-val is_opaque : constant_body -> bool
+val is_opaque : 'a constant_body -> bool
(** {6 Inductive types} *)
@@ -83,7 +83,7 @@ val safe_flags : Conv_oracle.oracle -> typing_flags
of the structure, but simply hash-cons all inner constr
and other known elements *)
-val hcons_const_body : constant_body -> constant_body
+val hcons_const_body : 'a constant_body -> 'a constant_body
val hcons_mind : mutual_inductive_body -> mutual_inductive_body
val hcons_module_body : module_body -> module_body
val hcons_module_type : module_type_body -> module_type_body
diff --git a/kernel/environ.ml b/kernel/environ.ml
index 97c9f8654a..05f342a82a 100644
--- a/kernel/environ.ml
+++ b/kernel/environ.ml
@@ -46,7 +46,7 @@ type link_info =
| LinkedInteractive of string
| NotLinked
-type constant_key = constant_body * (link_info ref * key)
+type constant_key = Opaqueproof.opaque constant_body * (link_info ref * key)
type mind_key = mutual_inductive_body * link_info ref
@@ -187,7 +187,7 @@ let match_named_context_val c = match c.env_named_ctx with
let map_named_val f ctxt =
let open Context.Named.Declaration in
let fold accu d =
- let d' = map_constr f d in
+ let d' = f d in
let accu =
if d == d' then accu
else Id.Map.modify (get_id d) (fun _ (_, v) -> (d', v)) accu
diff --git a/kernel/environ.mli b/kernel/environ.mli
index 8c6bc105c7..f6cd41861e 100644
--- a/kernel/environ.mli
+++ b/kernel/environ.mli
@@ -42,7 +42,7 @@ type link_info =
type key = int CEphemeron.key option ref
-type constant_key = constant_body * (link_info ref * key)
+type constant_key = Opaqueproof.opaque constant_body * (link_info ref * key)
type mind_key = mutual_inductive_body * link_info ref
@@ -134,9 +134,9 @@ val ids_of_named_context_val : named_context_val -> Id.Set.t
(** [map_named_val f ctxt] apply [f] to the body and the type of
each declarations.
- *** /!\ *** [f t] should be convertible with t *)
+ *** /!\ *** [f t] should be convertible with t, and preserve the name *)
val map_named_val :
- (constr -> constr) -> named_context_val -> named_context_val
+ (named_declaration -> named_declaration) -> named_context_val -> named_context_val
val push_named : Constr.named_declaration -> env -> env
val push_named_context : Constr.named_context -> env -> env
@@ -174,19 +174,19 @@ val reset_with_named_context : named_context_val -> env -> env
val pop_rel_context : int -> env -> env
(** Useful for printing *)
-val fold_constants : (Constant.t -> constant_body -> 'a -> 'a) -> env -> 'a -> 'a
+val fold_constants : (Constant.t -> Opaqueproof.opaque constant_body -> 'a -> 'a) -> env -> 'a -> 'a
(** {5 Global constants }
{6 Add entries to global environment } *)
-val add_constant : Constant.t -> constant_body -> env -> env
-val add_constant_key : Constant.t -> constant_body -> link_info ->
+val add_constant : Constant.t -> Opaqueproof.opaque constant_body -> env -> env
+val add_constant_key : Constant.t -> Opaqueproof.opaque constant_body -> link_info ->
env -> env
val lookup_constant_key : Constant.t -> env -> constant_key
(** Looks up in the context of global constant names
raises [Not_found] if the required path is not found *)
-val lookup_constant : Constant.t -> env -> constant_body
+val lookup_constant : Constant.t -> env -> Opaqueproof.opaque constant_body
val evaluable_constant : Constant.t -> env -> bool
(** New-style polymorphism *)
@@ -219,7 +219,7 @@ val constant_context : env -> Constant.t -> Univ.AUContext.t
it lives in. For monomorphic constant, the latter is empty, and for
polymorphic constants, the term contains De Bruijn universe variables that
need to be instantiated. *)
-val body_of_constant_body : env -> constant_body -> (Constr.constr * Univ.AUContext.t) option
+val body_of_constant_body : env -> Opaqueproof.opaque constant_body -> (Constr.constr * Univ.AUContext.t) option
(* These functions should be called under the invariant that [env]
already contains the constraints corresponding to the constant
diff --git a/kernel/inductive.ml b/kernel/inductive.ml
index d9335d39b5..ca7086a3e4 100644
--- a/kernel/inductive.ml
+++ b/kernel/inductive.ml
@@ -166,7 +166,7 @@ let make_subst env =
(* template, it is identity substitution otherwise (ie. when u is *)
(* already in the domain of the substitution) [remember_subst] will *)
(* update its image [x] by [sup x u] in order not to forget the *)
- (* dependency in [u] that remains to be fullfilled. *)
+ (* dependency in [u] that remains to be fulfilled. *)
make (remember_subst u subst) (sign, exp, [])
| _sign, [], _ ->
(* Uniform parameters are exhausted *)
diff --git a/kernel/mod_typing.ml b/kernel/mod_typing.ml
index 2de5faa6df..72393d0081 100644
--- a/kernel/mod_typing.ml
+++ b/kernel/mod_typing.ml
@@ -188,7 +188,7 @@ let rec check_with_mod env struc (idl,mp1) mp equiv =
in
let new_equiv = add_delta_resolver equiv new_mb.mod_delta in
(* we propagate the new equality in the rest of the signature
- with the identity substitution accompagned by the new resolver*)
+ with the identity substitution accompanied by the new resolver*)
let id_subst = map_mp mp' mp' new_mb.mod_delta in
let new_after = subst_structure id_subst after in
before@(lab,SFBmodule new_mb')::new_after, new_equiv, cst
diff --git a/kernel/modops.ml b/kernel/modops.ml
index 4fdd7ab334..472fddb829 100644
--- a/kernel/modops.ml
+++ b/kernel/modops.ml
@@ -515,7 +515,7 @@ and strengthen_and_subst_struct str subst mp_from mp_to alias incl reso =
"Module M:=P." or "Module M. Include P. End M."
We need to perform two operations to compute the body of M.
- The first one is applying the substitution {P <- M} on the type of P
- - The second one is strenghtening. *)
+ - The second one is strengthening. *)
let strengthen_and_subst_mb mb mp include_b = match mb.mod_type with
|NoFunctor struc ->
diff --git a/kernel/nativecode.mli b/kernel/nativecode.mli
index 96efa7faa5..b5c03b6ca3 100644
--- a/kernel/nativecode.mli
+++ b/kernel/nativecode.mli
@@ -65,7 +65,7 @@ val empty_updates : code_location_updates
val register_native_file : string -> unit
val compile_constant_field : env -> string -> Constant.t ->
- global list -> constant_body -> global list
+ global list -> 'a constant_body -> global list
val compile_mind_field : ModPath.t -> Label.t ->
global list -> mutual_inductive_body -> global list
diff --git a/kernel/opaqueproof.ml b/kernel/opaqueproof.ml
index 57059300b8..18c1bcc0f8 100644
--- a/kernel/opaqueproof.ml
+++ b/kernel/opaqueproof.ml
@@ -77,11 +77,6 @@ let subst_opaque sub = function
| Indirect (s,dp,i) -> Indirect (sub::s,dp,i)
| Direct _ -> CErrors.anomaly (Pp.str "Substituting a Direct opaque.")
-let iter_direct_opaque f = function
- | Indirect _ -> CErrors.anomaly (Pp.str "Not a direct opaque.")
- | Direct (d,cu) ->
- Direct (d,Future.chain cu (fun (c, u) -> f c; c, u))
-
let discharge_direct_opaque ~cook_constr ci = function
| Indirect _ -> CErrors.anomaly (Pp.str "Not a direct opaque.")
| Direct (d,cu) ->
diff --git a/kernel/opaqueproof.mli b/kernel/opaqueproof.mli
index d47c0bbb3c..4e8956af06 100644
--- a/kernel/opaqueproof.mli
+++ b/kernel/opaqueproof.mli
@@ -43,7 +43,6 @@ val get_constraints :
opaquetab -> opaque -> Univ.ContextSet.t Future.computation option
val subst_opaque : substitution -> opaque -> opaque
-val iter_direct_opaque : (constr -> unit) -> opaque -> opaque
type work_list = (Univ.Instance.t * Id.t array) Cmap.t *
(Univ.Instance.t * Id.t array) Mindmap.t
diff --git a/kernel/safe_typing.ml b/kernel/safe_typing.ml
index 75375812c0..a5d8a480ee 100644
--- a/kernel/safe_typing.ml
+++ b/kernel/safe_typing.ml
@@ -228,27 +228,10 @@ let check_engagement env expected_impredicative_set =
(** {6 Stm machinery } *)
-type seff_env =
- [ `Nothing
- (* The proof term and its universes.
- Same as the constant_body's but not in an ephemeron *)
- | `Opaque of Constr.t * Univ.ContextSet.t ]
-
-let get_opaque_body env cbo =
- match cbo.const_body with
- | Undef _ -> assert false
- | Primitive _ -> assert false
- | Def _ -> `Nothing
- | OpaqueDef opaque ->
- `Opaque
- (Opaqueproof.force_proof (Environ.opaque_tables env) opaque,
- Opaqueproof.force_constraints (Environ.opaque_tables env) opaque)
-
type side_effect = {
from_env : Declarations.structure_body CEphemeron.key;
seff_constant : Constant.t;
- seff_body : Declarations.constant_body;
- seff_env : seff_env;
+ seff_body : (Constr.t * Univ.ContextSet.t) Declarations.constant_body;
seff_role : Entries.side_effect_role;
}
@@ -288,39 +271,38 @@ type private_constants = SideEffects.t
let side_effects_of_private_constants l =
List.rev (SideEffects.repr l)
+(* Only used to push in an Environ.env. *)
+let lift_constant c =
+ let body = match c.const_body with
+ | OpaqueDef _ -> Undef None
+ | Def _ | Undef _ | Primitive _ as body -> body
+ in
+ { c with const_body = body }
+
+let map_constant f c =
+ let body = match c.const_body with
+ | OpaqueDef o -> OpaqueDef (f o)
+ | Def _ | Undef _ | Primitive _ as body -> body
+ in
+ { c with const_body = body }
+
let push_private_constants env eff =
let eff = side_effects_of_private_constants eff in
let add_if_undefined env eff =
try ignore(Environ.lookup_constant eff.seff_constant env); env
- with Not_found -> Environ.add_constant eff.seff_constant eff.seff_body env
+ with Not_found -> Environ.add_constant eff.seff_constant (lift_constant eff.seff_body) env
in
List.fold_left add_if_undefined env eff
let empty_private_constants = SideEffects.empty
let concat_private = SideEffects.concat
-let private_constant env role cst =
- (** The constant must be the last entry of the safe environment *)
- let () = match env.revstruct with
- | (lbl, SFBconst _) :: _ -> assert (Label.equal lbl (Constant.label cst))
- | _ -> assert false
- in
- let from_env = CEphemeron.create env.revstruct in
- let cbo = Environ.lookup_constant cst env.env in
- let eff = {
- from_env = from_env;
- seff_constant = cst;
- seff_body = cbo;
- seff_env = get_opaque_body env.env cbo;
- seff_role = role;
- } in
- SideEffects.add eff empty_private_constants
-
let universes_of_private eff =
let fold acc eff =
- let acc = match eff.seff_env with
- | `Nothing -> acc
- | `Opaque (_, ctx) -> ctx :: acc
+ let acc = match eff.seff_body.const_body with
+ | Def _ -> acc
+ | OpaqueDef (_, ctx) -> ctx :: acc
+ | Primitive _ | Undef _ -> assert false
in
match eff.seff_body.const_universes with
| Monomorphic ctx -> ctx :: acc
@@ -565,7 +547,6 @@ type 'a effect_entry =
type global_declaration =
| ConstantEntry : 'a effect_entry * 'a Entries.constant_entry -> global_declaration
- | GlobalRecipe of Cooking.recipe
type exported_private_constant =
Constant.t * Entries.side_effect_role
@@ -598,7 +579,7 @@ let inline_side_effects env body side_eff =
let open Constr in
(** First step: remove the constants that are still in the environment *)
let filter e =
- let cb = (e.seff_constant, e.seff_body, e.seff_env) in
+ let cb = (e.seff_constant, e.seff_body) in
try ignore (Environ.lookup_constant e.seff_constant env); None
with Not_found -> Some (cb, e.from_env)
in
@@ -612,10 +593,10 @@ let inline_side_effects env body side_eff =
else
(** Second step: compute the lifts and substitutions to apply *)
let cname c r = Context.make_annot (Name (Label.to_id (Constant.label c))) r in
- let fold (subst, var, ctx, args) (c, cb, b) =
- let (b, opaque) = match cb.const_body, b with
- | Def b, _ -> (Mod_subst.force_constr b, false)
- | OpaqueDef _, `Opaque (b,_) -> (b, true)
+ let fold (subst, var, ctx, args) (c, cb) =
+ let (b, opaque) = match cb.const_body with
+ | Def b -> (Mod_subst.force_constr b, false)
+ | OpaqueDef (b, _) -> (b, true)
| _ -> assert false
in
match cb.const_universes with
@@ -701,7 +682,8 @@ let check_signatures curmb sl =
| Some (n, _) -> n
-let constant_entry_of_side_effect cb u =
+let constant_entry_of_side_effect eff =
+ let cb = eff.seff_body in
let open Entries in
let univs =
match cb.const_universes with
@@ -711,9 +693,9 @@ let constant_entry_of_side_effect cb u =
Polymorphic_entry (Univ.AUContext.names auctx, Univ.AUContext.repr auctx)
in
let pt =
- match cb.const_body, u with
- | OpaqueDef _, `Opaque (b, c) -> b, c
- | Def b, `Nothing -> Mod_subst.force_constr b, Univ.ContextSet.empty
+ match cb.const_body with
+ | OpaqueDef (b, c) -> b, c
+ | Def b -> Mod_subst.force_constr b, Univ.ContextSet.empty
| _ -> assert false in
DefinitionEntry {
const_entry_body = Future.from_val (pt, ());
@@ -724,18 +706,6 @@ let constant_entry_of_side_effect cb u =
const_entry_opaque = Declareops.is_opaque cb;
const_entry_inline_code = cb.const_inline_code }
-let turn_direct orig =
- let cb = orig.seff_body in
- if Declareops.is_opaque cb then
- let p = match orig.seff_env with
- | `Opaque (b, c) -> (b, c)
- | _ -> assert false
- in
- let const_body = OpaqueDef (Opaqueproof.create (Future.from_val p)) in
- let cb = { cb with const_body } in
- { orig with seff_body = cb }
- else orig
-
let export_eff eff =
(eff.seff_constant, eff.seff_body, eff.seff_role)
@@ -756,13 +726,14 @@ let export_side_effects mb env c =
let trusted = check_signatures mb signatures in
let push_seff env eff =
let { seff_constant = kn; seff_body = cb ; _ } = eff in
- let env = Environ.add_constant kn cb env in
+ let env = Environ.add_constant kn (lift_constant cb) env in
match cb.const_universes with
| Polymorphic _ -> env
| Monomorphic ctx ->
- let ctx = match eff.seff_env with
- | `Nothing -> ctx
- | `Opaque(_, ctx') -> Univ.ContextSet.union ctx' ctx
+ let ctx = match eff.seff_body.const_body with
+ | Def _ -> ctx
+ | OpaqueDef (_, ctx') -> Univ.ContextSet.union ctx' ctx
+ | Undef _ | Primitive _ -> assert false
in
Environ.push_context_set ~strict:true ctx env
in
@@ -771,35 +742,39 @@ let export_side_effects mb env c =
| [] -> List.rev acc, ce
| eff :: rest ->
if Int.equal sl 0 then
- let env, cb =
- let { seff_constant = kn; seff_body = ocb; seff_env = u ; _ } = eff in
- let ce = constant_entry_of_side_effect ocb u in
+ let env, cb =
+ let kn = eff.seff_constant in
+ let ce = constant_entry_of_side_effect eff in
let cb = Term_typing.translate_constant Term_typing.Pure env kn ce in
- let eff = { eff with
- seff_body = cb;
- seff_env = `Nothing;
- } in
+ let cb = map_constant Future.force cb in
+ let eff = { eff with seff_body = cb } in
(push_seff env eff, export_eff eff)
in
translate_seff 0 rest (cb :: acc) env
else
- let cb = turn_direct eff in
- let env = push_seff env cb in
- let ecb = export_eff cb in
+ let env = push_seff env eff in
+ let ecb = export_eff eff in
translate_seff (sl - 1) rest (ecb :: acc) env
in
translate_seff trusted seff [] env
let export_private_constants ~in_section ce senv =
let exported, ce = export_side_effects senv.revstruct senv.env ce in
- let bodies = List.map (fun (kn, cb, _) -> (kn, cb)) exported in
+ let map (kn, cb, _) = (kn, map_constant (fun p -> Opaqueproof.create (Future.from_val p)) cb) in
+ let bodies = List.map map exported in
let exported = List.map (fun (kn, _, r) -> (kn, r)) exported in
let senv = List.fold_left (add_constant_aux ~in_section) senv bodies in
(ce, exported), senv
-let add_constant ~in_section l decl senv =
+let add_recipe ~in_section l r senv =
+ let kn = Constant.make2 senv.modpath l in
+ let cb = Term_typing.translate_recipe ~hcons:(not in_section) senv.env kn r in
+ let cb = if in_section then cb else Declareops.hcons_const_body cb in
+ let senv = add_constant_aux ~in_section senv (kn, cb) in
+ kn, senv
+
+let add_constant ?role ~in_section l decl senv =
let kn = Constant.make2 senv.modpath l in
- let senv =
let cb =
match decl with
| ConstantEntry (EffectEntry, ce) ->
@@ -811,9 +786,9 @@ let add_constant ~in_section l decl senv =
Term_typing.translate_constant (Term_typing.SideEffects handle) senv.env kn ce
| ConstantEntry (PureEntry, ce) ->
Term_typing.translate_constant Term_typing.Pure senv.env kn ce
- | GlobalRecipe r ->
- let cb = Term_typing.translate_recipe ~hcons:(not in_section) senv.env kn r in
- if in_section then cb else Declareops.hcons_const_body cb in
+ in
+ let senv =
+ let cb = map_constant Opaqueproof.create cb in
add_constant_aux ~in_section senv (kn, cb) in
let senv =
match decl with
@@ -822,7 +797,20 @@ let add_constant ~in_section l decl senv =
add_retroknowledge (Retroknowledge.Register_type(t,kn)) senv
| _ -> senv
in
- kn, senv
+ let eff = match role with
+ | None -> empty_private_constants
+ | Some role ->
+ let cb = map_constant Future.force cb in
+ let from_env = CEphemeron.create senv.revstruct in
+ let eff = {
+ from_env = from_env;
+ seff_constant = kn;
+ seff_body = cb;
+ seff_role = role;
+ } in
+ SideEffects.add eff empty_private_constants
+ in
+ (kn, eff), senv
(** Insertion of inductive types *)
diff --git a/kernel/safe_typing.mli b/kernel/safe_typing.mli
index d6c7022cf5..36ca3d8c47 100644
--- a/kernel/safe_typing.mli
+++ b/kernel/safe_typing.mli
@@ -48,9 +48,6 @@ val concat_private : private_constants -> private_constants -> private_constants
(** [concat_private e1 e2] adds the constants of [e1] to [e2], i.e. constants in
[e1] must be more recent than those of [e2]. *)
-val private_constant : safe_environment -> Entries.side_effect_role -> Constant.t -> private_constants
-(** Constant must be the last definition of the safe_environment. *)
-
val mk_pure_proof : Constr.constr -> private_constants Entries.proof_output
val inline_private_constants_in_constr :
Environ.env -> Constr.constr -> private_constants -> Constr.constr
@@ -91,7 +88,6 @@ type 'a effect_entry =
type global_declaration =
| ConstantEntry : 'a effect_entry * 'a Entries.constant_entry -> global_declaration
- | GlobalRecipe of Cooking.recipe
type exported_private_constant =
Constant.t * Entries.side_effect_role
@@ -103,8 +99,11 @@ val export_private_constants : in_section:bool ->
(** returns the main constant plus a list of auxiliary constants (empty
unless one requires the side effects to be exported) *)
val add_constant :
- in_section:bool -> Label.t -> global_declaration ->
- Constant.t safe_transformer
+ ?role:Entries.side_effect_role -> in_section:bool -> Label.t -> global_declaration ->
+ (Constant.t * private_constants) safe_transformer
+
+val add_recipe :
+ in_section:bool -> Label.t -> Cooking.recipe -> Constant.t safe_transformer
(** Adding an inductive type *)
diff --git a/kernel/subtyping.ml b/kernel/subtyping.ml
index 1857ea3329..24845ce459 100644
--- a/kernel/subtyping.ml
+++ b/kernel/subtyping.ml
@@ -31,7 +31,7 @@ open Mod_subst
an inductive type. It can also be useful to allow reorderings in
inductive types *)
type namedobject =
- | Constant of constant_body
+ | Constant of Opaqueproof.opaque constant_body
| IndType of inductive * mutual_inductive_body
| IndConstr of constructor * mutual_inductive_body
diff --git a/kernel/term_typing.ml b/kernel/term_typing.ml
index faa4411e92..74c6189a65 100644
--- a/kernel/term_typing.ml
+++ b/kernel/term_typing.ml
@@ -154,7 +154,7 @@ the polymorphic case
let c = Constr.hcons j.uj_val in
feedback_completion_typecheck feedback_id;
c, uctx) in
- let def = OpaqueDef (Opaqueproof.create proofterm) in
+ let def = OpaqueDef proofterm in
{
Cooking.cook_body = def;
cook_type = tyj.utj_val;
@@ -207,7 +207,7 @@ the polymorphic case
in
let def = Constr.hcons (Vars.subst_univs_level_constr usubst j.uj_val) in
let def =
- if opaque then OpaqueDef (Opaqueproof.create (Future.from_val (def, Univ.ContextSet.empty)))
+ if opaque then OpaqueDef (Future.from_val (def, Univ.ContextSet.empty))
else Def (Mod_subst.from_val def)
in
feedback_completion_typecheck feedback_id;
@@ -232,7 +232,7 @@ let record_aux env s_ty s_bo =
(keep_hyps env s_bo)) in
Aux_file.record_in_aux "context_used" v
-let build_constant_declaration _kn env result =
+let build_constant_declaration env result =
let open Cooking in
let typ = result.cook_type in
let check declared inferred =
@@ -271,11 +271,8 @@ let build_constant_declaration _kn env result =
| Undef _ | Primitive _ -> Id.Set.empty
| Def cs -> global_vars_set env (Mod_subst.force_constr cs)
| OpaqueDef lc ->
- let vars =
- global_vars_set env
- (Opaqueproof.force_proof (opaque_tables env) lc) in
- (* we force so that cst are added to the env immediately after *)
- ignore(Opaqueproof.force_constraints (opaque_tables env) lc);
+ let (lc, _) = Future.force lc in
+ let vars = global_vars_set env lc in
if !Flags.record_aux_file then record_aux env ids_typ vars;
vars
in
@@ -296,11 +293,15 @@ let build_constant_declaration _kn env result =
check declared inferred;
x
| OpaqueDef lc -> (* In this case we can postpone the check *)
- OpaqueDef (Opaqueproof.iter_direct_opaque (fun c ->
- let ids_typ = global_vars_set env typ in
- let ids_def = global_vars_set env c in
- let inferred = keep_hyps env (Id.Set.union ids_typ ids_def) in
- check declared inferred) lc) in
+ let iter k cu = Future.chain cu (fun (c, _ as p) -> k c; p) in
+ let kont c =
+ let ids_typ = global_vars_set env typ in
+ let ids_def = global_vars_set env c in
+ let inferred = keep_hyps env (Id.Set.union ids_typ ids_def) in
+ check declared inferred
+ in
+ OpaqueDef (iter kont lc)
+ in
let univs = result.cook_universes in
let tps =
let res = Cbytegen.compile_constant_body ~fail_on_error:false env univs def in
@@ -318,8 +319,8 @@ let build_constant_declaration _kn env result =
(*s Global and local constant declaration. *)
-let translate_constant mb env kn ce =
- build_constant_declaration kn env
+let translate_constant mb env _kn ce =
+ build_constant_declaration env
(infer_declaration ~trust:mb env ce)
let translate_local_assum env t =
@@ -327,8 +328,21 @@ let translate_local_assum env t =
let t = Typeops.assumption_of_judgment env j in
j.uj_val, t
-let translate_recipe ~hcons env kn r =
- build_constant_declaration kn env (Cooking.cook_constant ~hcons r)
+let translate_recipe ~hcons env _kn r =
+ let open Cooking in
+ let result = Cooking.cook_constant ~hcons r in
+ let univs = result.cook_universes in
+ let res = Cbytegen.compile_constant_body ~fail_on_error:false env univs result.cook_body in
+ let tps = Option.map Cemitcodes.from_val res in
+ { const_hyps = Option.get result.cook_context;
+ const_body = result.cook_body;
+ const_type = result.cook_type;
+ const_body_code = tps;
+ const_universes = univs;
+ const_private_poly_univs = result.cook_private_univs;
+ const_relevance = result.cook_relevance;
+ const_inline_code = result.cook_inline;
+ const_typing_flags = Environ.typing_flags env }
let translate_local_def env _id centry =
let open Cooking in
@@ -351,8 +365,7 @@ let translate_local_def env _id centry =
| Def _ -> ()
| OpaqueDef lc ->
let ids_typ = global_vars_set env typ in
- let ids_def = global_vars_set env
- (Opaqueproof.force_proof (opaque_tables env) lc) in
+ let ids_def = global_vars_set env (fst (Future.force lc)) in
record_aux env ids_typ ids_def
end;
let () = match decl.cook_universes with
@@ -362,8 +375,7 @@ let translate_local_def env _id centry =
let c = match decl.cook_body with
| Def c -> Mod_subst.force_constr c
| OpaqueDef o ->
- let p = Opaqueproof.force_proof (Environ.opaque_tables env) o in
- let cst = Opaqueproof.force_constraints (Environ.opaque_tables env) o in
+ let (p, cst) = Future.force o in
(** Let definitions are ensured to have no extra constraints coming from
the body by virtue of the typing of [Entries.section_def_entry]. *)
let () = assert (Univ.ContextSet.is_empty cst) in
diff --git a/kernel/term_typing.mli b/kernel/term_typing.mli
index 1fa5eca2e3..592a97e132 100644
--- a/kernel/term_typing.mli
+++ b/kernel/term_typing.mli
@@ -33,14 +33,14 @@ val translate_local_assum : env -> types -> types * Sorts.relevance
val translate_constant :
'a trust -> env -> Constant.t -> 'a constant_entry ->
- constant_body
+ Opaqueproof.proofterm constant_body
-val translate_recipe : hcons:bool -> env -> Constant.t -> Cooking.recipe -> constant_body
+val translate_recipe : hcons:bool -> env -> Constant.t -> Cooking.recipe -> Opaqueproof.opaque constant_body
(** Internal functions, mentioned here for debug purpose only *)
val infer_declaration : trust:'a trust -> env ->
- 'a constant_entry -> Cooking.result
+ 'a constant_entry -> Opaqueproof.proofterm Cooking.result
val build_constant_declaration :
- Constant.t -> env -> Cooking.result -> constant_body
+ env -> Opaqueproof.proofterm Cooking.result -> Opaqueproof.proofterm constant_body
diff --git a/kernel/uint63.mli b/kernel/uint63.mli
index f25f24512d..93632da110 100644
--- a/kernel/uint63.mli
+++ b/kernel/uint63.mli
@@ -13,7 +13,7 @@ val of_uint : int -> t
val hash : t -> int
- (* convertion to a string *)
+ (* conversion to a string *)
val to_string : t -> string
val of_string : string -> t
diff --git a/kernel/univ.ml b/kernel/univ.ml
index b1bbc25fe6..2b88d6884d 100644
--- a/kernel/univ.ml
+++ b/kernel/univ.ml
@@ -726,7 +726,7 @@ let univ_level_rem u v min =
| Some u' -> if Level.equal u u' then min else v
| None -> List.filter (fun (l, n) -> not (Int.equal n 0 && Level.equal u l)) v
-(* Is u mentionned in v (or equals to v) ? *)
+(* Is u mentioned in v (or equals to v) ? *)
(**********************************************************************)
diff --git a/kernel/univ.mli b/kernel/univ.mli
index db178c4bb0..ddb204dd52 100644
--- a/kernel/univ.mli
+++ b/kernel/univ.mli
@@ -163,7 +163,7 @@ val super : Universe.t -> Universe.t
val universe_level : Universe.t -> Level.t option
-(** [univ_level_mem l u] Is l is mentionned in u ? *)
+(** [univ_level_mem l u] Is l is mentioned in u ? *)
val univ_level_mem : Level.t -> Universe.t -> bool
diff --git a/kernel/vmvalues.ml b/kernel/vmvalues.ml
index 777a207013..5e3a3c3347 100644
--- a/kernel/vmvalues.ml
+++ b/kernel/vmvalues.ml
@@ -12,7 +12,7 @@ open Univ
open Constr
(*******************************************)
-(* Initalization of the abstract machine ***)
+(* Initialization of the abstract machine ***)
(* Necessary for [relaccu_tbl] *)
(*******************************************)
diff --git a/lib/cProfile.mli b/lib/cProfile.mli
index 764faf8d1a..00babe1a47 100644
--- a/lib/cProfile.mli
+++ b/lib/cProfile.mli
@@ -18,7 +18,7 @@ To trace a function "f" you first need to get a key for it by using :
let fkey = declare_profile "f";;
-(the string is used to print the profile infomation). Warning: this
+(the string is used to print the profile information). Warning: this
function does a side effect. Choose the ident you want instead "fkey".
Then if the function has ONE argument add the following just after
diff --git a/lib/envars.mli b/lib/envars.mli
index ebf86d0650..558fe74042 100644
--- a/lib/envars.mli
+++ b/lib/envars.mli
@@ -38,7 +38,7 @@ val datadir : unit -> string
(** [configdir] is the path to the installed config directory. *)
val configdir : unit -> string
-(** [set_coqlib] must be runned once before any access to [coqlib] *)
+(** [set_coqlib] must be run once before any access to [coqlib] *)
val set_coqlib : fail:(string -> string) -> unit
(** [set_user_coqlib path] sets the coqlib directory explicitedly. *)
diff --git a/lib/feedback.mli b/lib/feedback.mli
index f407e2fd5b..c9e6ca1266 100644
--- a/lib/feedback.mli
+++ b/lib/feedback.mli
@@ -56,7 +56,7 @@ type feedback = {
(** {6 Feedback sent, even asynchronously, to the user interface} *)
-(* The interpreter assignes an state_id to the ast, and feedbacks happening
+(* The interpreter assigns a state_id to the ast, and feedbacks happening
* during interpretation are attached to it.
*)
diff --git a/lib/flags.mli b/lib/flags.mli
index a70a23b902..535b46950e 100644
--- a/lib/flags.mli
+++ b/lib/flags.mli
@@ -64,7 +64,7 @@ val beautify : bool ref
val beautify_file : bool ref
(* Coq quiet mode. Note that normal mode is called "verbose" here,
- whereas [quiet] supresses normal output such as goals in coqtop *)
+ whereas [quiet] suppresses normal output such as goals in coqtop *)
val quiet : bool ref
val silently : ('a -> 'b) -> 'a -> 'b
val verbosely : ('a -> 'b) -> 'a -> 'b
diff --git a/lib/pp.mli b/lib/pp.mli
index 4ce6a535c8..8b3a07d4b2 100644
--- a/lib/pp.mli
+++ b/lib/pp.mli
@@ -18,7 +18,7 @@
(* to interpret. *)
(* *)
(* The datatype has a public view to allow serialization or advanced *)
-(* uses, however regular users are _strongly_ warned againt its use, *)
+(* uses, however regular users are _strongly_ warned against its use, *)
(* they should instead rely on the available functions below. *)
(* *)
(* Box order and number is indeed an important factor. Try to create *)
diff --git a/lib/pp_diff.mli b/lib/pp_diff.mli
index 03468271d2..0eec18bd5a 100644
--- a/lib/pp_diff.mli
+++ b/lib/pp_diff.mli
@@ -88,7 +88,7 @@ Ppcmd_strings will be split into multiple Ppcmd_strings if a diff starts or ends
in the middle of the string. Whitespace just before or just after a diff will
not be part of the highlight.
-Prexisting tags in pp may contain only a single Ppcmd_string. Those tags will be
+Preexisting tags in pp may contain only a single Ppcmd_string. Those tags will be
placed inside the diff tags to ensure proper nesting of tags within spans of
"start.diff.*" ... "end.diff.*".
diff --git a/lib/spawn.mli b/lib/spawn.mli
index 944aa27a7f..24bbded4f1 100644
--- a/lib/spawn.mli
+++ b/lib/spawn.mli
@@ -9,7 +9,7 @@
(************************************************************************)
(* This module implements spawning/killing managed processes with a
- * synchronous or asynchronous comunication channel that works with
+ * synchronous or asynchronous communication channel that works with
* threads or with a glib like main loop model.
*
* This module requires no threads and no main loop model. It takes care
diff --git a/library/declaremods.ml b/library/declaremods.ml
index 5fd11e187a..d74bdd484c 100644
--- a/library/declaremods.ml
+++ b/library/declaremods.ml
@@ -51,7 +51,7 @@ let inl2intopt = function
- Then comes either the object segment itself (for interactive
modules), or a compact way to store derived objects (path to
- a earlier module + subtitution).
+ a earlier module + substitution).
*)
type algebraic_objects =
diff --git a/library/global.ml b/library/global.ml
index 06e06a8cf2..58e2380440 100644
--- a/library/global.ml
+++ b/library/global.ml
@@ -94,7 +94,8 @@ let make_sprop_cumulative () = globalize0 Safe_typing.make_sprop_cumulative
let set_allow_sprop b = globalize0 (Safe_typing.set_allow_sprop b)
let sprop_allowed () = Environ.sprop_allowed (env())
let export_private_constants ~in_section cd = globalize (Safe_typing.export_private_constants ~in_section cd)
-let add_constant ~in_section id d = globalize (Safe_typing.add_constant ~in_section (i2l id) d)
+let add_constant ?role ~in_section id d = globalize (Safe_typing.add_constant ?role ~in_section (i2l id) d)
+let add_recipe ~in_section id d = globalize (Safe_typing.add_recipe ~in_section (i2l id) d)
let add_mind id mie = globalize (Safe_typing.add_mind (i2l id) mie)
let add_modtype id me inl = globalize (Safe_typing.add_modtype (i2l id) me inl)
let add_module id me inl = globalize (Safe_typing.add_module (i2l id) me inl)
diff --git a/library/global.mli b/library/global.mli
index a60de48897..984d8c666c 100644
--- a/library/global.mli
+++ b/library/global.mli
@@ -46,7 +46,8 @@ val export_private_constants : in_section:bool ->
unit Entries.definition_entry * Safe_typing.exported_private_constant list
val add_constant :
- in_section:bool -> Id.t -> Safe_typing.global_declaration -> Constant.t
+ ?role:Entries.side_effect_role -> in_section:bool -> Id.t -> Safe_typing.global_declaration -> Constant.t * Safe_typing.private_constants
+val add_recipe : in_section:bool -> Id.t -> Cooking.recipe -> Constant.t
val add_mind :
Id.t -> Entries.mutual_inductive_entry -> MutInd.t
@@ -84,7 +85,7 @@ val add_module_parameter :
(** {6 Queries in the global environment } *)
val lookup_named : variable -> Constr.named_declaration
-val lookup_constant : Constant.t -> Declarations.constant_body
+val lookup_constant : Constant.t -> Opaqueproof.opaque Declarations.constant_body
val lookup_inductive : inductive ->
Declarations.mutual_inductive_body * Declarations.one_inductive_body
val lookup_pinductive : Constr.pinductive ->
@@ -105,7 +106,7 @@ val body_of_constant : Constant.t -> (Constr.constr * Univ.AUContext.t) option
polymorphic constants, the term contains De Bruijn universe variables that
need to be instantiated. *)
-val body_of_constant_body : Declarations.constant_body -> (Constr.constr * Univ.AUContext.t) option
+val body_of_constant_body : Opaqueproof.opaque Declarations.constant_body -> (Constr.constr * Univ.AUContext.t) option
(** Same as {!body_of_constant} but on {!Declarations.constant_body}. *)
(** {6 Compiled libraries } *)
diff --git a/library/lib.ml b/library/lib.ml
index a046360822..4be288ed20 100644
--- a/library/lib.ml
+++ b/library/lib.ml
@@ -211,9 +211,6 @@ let split_lib_at_opening sp =
let add_entry sp node =
lib_state := { !lib_state with lib_stk = (sp,node) :: !lib_state.lib_stk }
-let pull_to_head oname =
- lib_state := { !lib_state with lib_stk = (oname,List.assoc oname !lib_state.lib_stk) :: List.remove_assoc oname !lib_state.lib_stk }
-
let anonymous_id =
let n = ref 0 in
fun () -> incr n; Names.Id.of_string ("_" ^ (string_of_int !n))
diff --git a/library/lib.mli b/library/lib.mli
index 30569197bc..5da76961a6 100644
--- a/library/lib.mli
+++ b/library/lib.mli
@@ -57,7 +57,6 @@ val segment_of_objects :
val add_leaf : Id.t -> Libobject.obj -> Libobject.object_name
val add_anonymous_leaf : ?cache_first:bool -> Libobject.obj -> unit
-val pull_to_head : Libobject.object_name -> unit
(** this operation adds all objects with the same name and calls [load_object]
for each of them *)
diff --git a/library/libnames.ml b/library/libnames.ml
index 87c4de42e8..41b38e0378 100644
--- a/library/libnames.ml
+++ b/library/libnames.ml
@@ -162,6 +162,9 @@ let qualid_basename qid =
let qualid_path qid =
qid.CAst.v.dirpath
+let idset_mem_qualid qid s =
+ qualid_is_ident qid && Id.Set.mem (qualid_basename qid) s
+
(* Default paths *)
let default_library = Names.DirPath.initial (* = ["Top"] *)
diff --git a/library/libnames.mli b/library/libnames.mli
index bbb4d2a058..7d77d95991 100644
--- a/library/libnames.mli
+++ b/library/libnames.mli
@@ -88,6 +88,9 @@ val qualid_is_ident : qualid -> bool
val qualid_path : qualid -> DirPath.t
val qualid_basename : qualid -> Id.t
+val idset_mem_qualid : qualid -> Id.Set.t -> bool
+(** false when the qualid is not an ident *)
+
(** {6 ... } *)
(** some preset paths *)
diff --git a/library/library.ml b/library/library.ml
index 04e38296d9..9f4eb531ed 100644
--- a/library/library.ml
+++ b/library/library.ml
@@ -208,7 +208,7 @@ let register_open_library export m =
let open_library export explicit_libs m =
if
(* Only libraries indirectly to open are not reopen *)
- (* Libraries explicitly mentionned by the user are always reopen *)
+ (* Libraries explicitly mentioned by the user are always reopen *)
List.exists (fun m' -> DirPath.equal m m') explicit_libs
|| not (library_is_opened m)
then begin
@@ -264,90 +264,11 @@ let in_import_library : DirPath.t list * bool -> obj =
subst_function = subst_import_library;
classify_function = classify_import_library }
-
-(************************************************************************)
-(*s Locate absolute or partially qualified library names in the path *)
-
-exception LibUnmappedDir
-exception LibNotFound
-type library_location = LibLoaded | LibInPath
-
-let warn_several_object_files =
- CWarnings.create ~name:"several-object-files" ~category:"require"
- (fun (vi, vo) -> str"Loading" ++ spc () ++ str vi ++
- strbrk " instead of " ++ str vo ++
- strbrk " because it is more recent")
-
-let locate_absolute_library dir =
- (* Search in loadpath *)
- let pref, base = split_dirpath dir in
- let loadpath = Loadpath.filter_path (fun dir -> DirPath.equal dir pref) in
- let () = match loadpath with [] -> raise LibUnmappedDir | _ -> () in
- let loadpath = List.map fst loadpath in
- let find ext =
- try
- let name = Id.to_string base ^ ext in
- let _, file = System.where_in_path ~warn:false loadpath name in
- Some file
- with Not_found -> None in
- match find ".vo", find ".vio" with
- | None, None -> raise LibNotFound
- | Some file, None | None, Some file -> file
- | Some vo, Some vi when Unix.((stat vo).st_mtime < (stat vi).st_mtime) ->
- warn_several_object_files (vi, vo);
- vi
- | Some vo, Some _ -> vo
-
-let locate_qualified_library ?root ?(warn = true) qid =
- (* Search library in loadpath *)
- let dir, base = repr_qualid qid in
- let loadpath = Loadpath.expand_path ?root dir in
- let () = match loadpath with [] -> raise LibUnmappedDir | _ -> () in
- let find ext =
- try
- let name = Id.to_string base ^ ext in
- let lpath, file =
- System.where_in_path ~warn (List.map fst loadpath) name in
- Some (lpath, file)
- with Not_found -> None in
- let lpath, file =
- match find ".vo", find ".vio" with
- | None, None -> raise LibNotFound
- | Some res, None | None, Some res -> res
- | Some (_, vo), Some (_, vi as resvi)
- when Unix.((stat vo).st_mtime < (stat vi).st_mtime) ->
- warn_several_object_files (vi, vo);
- resvi
- | Some resvo, Some _ -> resvo
- in
- let dir = add_dirpath_suffix (String.List.assoc lpath loadpath) base in
- (* Look if loaded *)
- if library_is_loaded dir then (LibLoaded, dir,library_full_filename dir)
- (* Otherwise, look for it in the file system *)
- else (LibInPath, dir, file)
-
-let error_unmapped_dir qid =
- let prefix, _ = repr_qualid qid in
- user_err ~hdr:"load_absolute_library_from"
- (str "Cannot load " ++ pr_qualid qid ++ str ":" ++ spc () ++
- str "no physical path bound to" ++ spc () ++ DirPath.print prefix ++ fnl ())
-
-let error_lib_not_found qid =
- user_err ~hdr:"load_absolute_library_from"
- (str"Cannot find library " ++ pr_qualid qid ++ str" in loadpath")
-
-let try_locate_absolute_library dir =
- try
- locate_absolute_library dir
- with
- | LibUnmappedDir -> error_unmapped_dir (qualid_of_dirpath dir)
- | LibNotFound -> error_lib_not_found (qualid_of_dirpath dir)
-
(************************************************************************)
(** {6 Tables of opaque proof terms} *)
(** We now store opaque proof terms apart from the rest of the environment.
- See the [Indirect] contructor in [Lazyconstr.lazy_constr]. This way,
+ See the [Indirect] constructor in [Lazyconstr.lazy_constr]. This way,
we can quickly load a first half of a .vo file without these opaque
terms, and access them only when a specific command (e.g. Print or
Print Assumptions) needs it. *)
@@ -450,7 +371,7 @@ let intern_from_file f =
module DPMap = Map.Make(DirPath)
-let rec intern_library (needed, contents) (dir, f) from =
+let rec intern_library ~lib_resolver (needed, contents) (dir, f) from =
(* Look if in the current logical environment *)
try (find_library dir).libsum_digests, (needed, contents)
with Not_found ->
@@ -459,7 +380,7 @@ let rec intern_library (needed, contents) (dir, f) from =
with Not_found ->
Feedback.feedback(Feedback.FileDependency (from, DirPath.to_string dir));
(* [dir] is an absolute name which matches [f] which must be in loadpath *)
- let f = match f with Some f -> f | None -> try_locate_absolute_library dir in
+ let f = match f with Some f -> f | None -> lib_resolver dir in
let m = intern_from_file f in
if not (DirPath.equal dir m.library_name) then
user_err ~hdr:"load_physical_library"
@@ -467,22 +388,24 @@ let rec intern_library (needed, contents) (dir, f) from =
DirPath.print m.library_name ++ spc () ++ str "and not library" ++
spc() ++ DirPath.print dir);
Feedback.feedback (Feedback.FileLoaded(DirPath.to_string dir, f));
- m.library_digests, intern_library_deps (needed, contents) dir m f
+ m.library_digests, intern_library_deps ~lib_resolver (needed, contents) dir m f
-and intern_library_deps libs dir m from =
- let needed, contents = Array.fold_left (intern_mandatory_library dir from) libs m.library_deps in
+and intern_library_deps ~lib_resolver libs dir m from =
+ let needed, contents =
+ Array.fold_left (intern_mandatory_library ~lib_resolver dir from)
+ libs m.library_deps in
(dir :: needed, DPMap.add dir m contents )
-and intern_mandatory_library caller from libs (dir,d) =
- let digest, libs = intern_library libs (dir, None) (Some from) in
+and intern_mandatory_library ~lib_resolver caller from libs (dir,d) =
+ let digest, libs = intern_library ~lib_resolver libs (dir, None) (Some from) in
if not (Safe_typing.digest_match ~actual:digest ~required:d) then
user_err (str "Compiled library " ++ DirPath.print caller ++
str " (in file " ++ str from ++ str ") makes inconsistent assumptions \
over library " ++ DirPath.print dir);
libs
-let rec_intern_library libs (dir, f) =
- let _, libs = intern_library libs (dir, Some f) None in
+let rec_intern_library ~lib_resolver libs (dir, f) =
+ let _, libs = intern_library ~lib_resolver libs (dir, Some f) None in
libs
let native_name_from_filename f =
@@ -557,8 +480,8 @@ let warn_require_in_module =
strbrk "You can Require a module at toplevel " ++
strbrk "and optionally Import it inside another one.")
-let require_library_from_dirpath modrefl export =
- let needed, contents = List.fold_left rec_intern_library ([], DPMap.empty) modrefl in
+let require_library_from_dirpath ~lib_resolver modrefl export =
+ let needed, contents = List.fold_left (rec_intern_library ~lib_resolver) ([], DPMap.empty) modrefl in
let needed = List.rev_map (fun dir -> DPMap.find dir contents) needed in
let modrefl = List.map fst modrefl in
if Lib.is_module_or_modtype () then
@@ -612,8 +535,6 @@ let import_module export modl =
(*s Initializing the compilation of a library. *)
let load_library_todo f =
- let longf = Loadpath.locate_file (f^".v") in
- let f = longf^"io" in
let ch = raw_intern_library f in
let (s0 : seg_sum), _, _ = System.marshal_in_segment f ch in
let (s1 : seg_lib), _, _ = System.marshal_in_segment f ch in
@@ -626,7 +547,7 @@ let load_library_todo f =
if s2 = None then user_err ~hdr:"restart" (str"not a .vio file");
if s3 = None then user_err ~hdr:"restart" (str"not a .vio file");
if pi3 (Option.get s2) then user_err ~hdr:"restart" (str"not a .vio file");
- longf, s0, s1, Option.get s2, Option.get s3, Option.get tasks, s5
+ s0, s1, Option.get s2, Option.get s3, Option.get tasks, s5
(************************************************************************)
(*s [save_library dir] ends library [dir] and save it to the disk. *)
@@ -727,14 +648,13 @@ let save_library_to ?todo ~output_native_objects dir f otab =
iraise reraise
let save_library_raw f sum lib univs proofs =
- let f' = f^"o" in
- let ch = raw_extern_library f' in
- System.marshal_out_segment f' ch (sum : seg_sum);
- System.marshal_out_segment f' ch (lib : seg_lib);
- System.marshal_out_segment f' ch (Some univs : seg_univ option);
- System.marshal_out_segment f' ch (None : seg_discharge option);
- System.marshal_out_segment f' ch (None : 'tasks option);
- System.marshal_out_segment f' ch (proofs : seg_proofs);
+ let ch = raw_extern_library f in
+ System.marshal_out_segment f ch (sum : seg_sum);
+ System.marshal_out_segment f ch (lib : seg_lib);
+ System.marshal_out_segment f ch (Some univs : seg_univ option);
+ System.marshal_out_segment f ch (None : seg_discharge option);
+ System.marshal_out_segment f ch (None : 'tasks option);
+ System.marshal_out_segment f ch (proofs : seg_proofs);
close_out ch
module StringOrd = struct type t = string let compare = String.compare end
diff --git a/library/library.mli b/library/library.mli
index a976be0184..f3186d847f 100644
--- a/library/library.mli
+++ b/library/library.mli
@@ -22,7 +22,11 @@ open Libnames
(** {6 ... }
Require = load in the environment + open (if the optional boolean
is not [None]); mark also for export if the boolean is [Some true] *)
-val require_library_from_dirpath : (DirPath.t * string) list -> bool option -> unit
+val require_library_from_dirpath
+ : lib_resolver:(DirPath.t -> CUnix.physical_path)
+ -> (DirPath.t * string) list
+ -> bool option
+ -> unit
(** {6 Start the compilation of a library } *)
@@ -45,8 +49,10 @@ val save_library_to :
output_native_objects:bool ->
DirPath.t -> string -> Opaqueproof.opaquetab -> unit
-val load_library_todo :
- string -> string * seg_sum * seg_lib * seg_univ * seg_discharge * 'tasks * seg_proofs
+val load_library_todo
+ : CUnix.physical_path
+ -> seg_sum * seg_lib * seg_univ * seg_discharge * 'tasks * seg_proofs
+
val save_library_raw : string -> seg_sum -> seg_lib -> seg_univ -> seg_proofs -> unit
(** {6 Interrogate the status of libraries } *)
@@ -65,20 +71,5 @@ val library_full_filename : DirPath.t -> string
(** - Overwrite the filename of all libraries (used when restoring a state) *)
val overwrite_library_filenames : string -> unit
-(** {6 Locate a library in the load paths } *)
-exception LibUnmappedDir
-exception LibNotFound
-type library_location = LibLoaded | LibInPath
-
-val locate_qualified_library :
- ?root:DirPath.t -> ?warn:bool -> qualid ->
- library_location * DirPath.t * CUnix.physical_path
-(** Locates a library by implicit name.
-
- @raise LibUnmappedDir if the library is not in the path
- @raise LibNotFound if there is no corresponding file in the path
-
-*)
-
(** {6 Native compiler. } *)
val native_name_from_filename : string -> string
diff --git a/library/library.mllib b/library/library.mllib
index 8f694f4a31..ef53471377 100644
--- a/library/library.mllib
+++ b/library/library.mllib
@@ -7,7 +7,6 @@ Global
Decl_kinds
Lib
Declaremods
-Loadpath
Library
States
Kindops
diff --git a/library/loadpath.ml b/library/loadpath.ml
deleted file mode 100644
index fc13c864d0..0000000000
--- a/library/loadpath.ml
+++ /dev/null
@@ -1,119 +0,0 @@
-(************************************************************************)
-(* * The Coq Proof Assistant / The Coq Development Team *)
-(* v * INRIA, CNRS and contributors - Copyright 1999-2018 *)
-(* <O___,, * (see CREDITS file for the list of authors) *)
-(* \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) *)
-(************************************************************************)
-
-open Pp
-open Util
-open CErrors
-open Names
-open Libnames
-
-(** Load paths. Mapping from physical to logical paths. *)
-
-type t = {
- path_physical : CUnix.physical_path;
- path_logical : DirPath.t;
- path_implicit : bool;
-}
-
-let load_paths = Summary.ref ([] : t list) ~name:"LOADPATHS"
-
-let logical p = p.path_logical
-
-let physical p = p.path_physical
-
-let get_load_paths () = !load_paths
-
-let anomaly_too_many_paths path =
- anomaly (str "Several logical paths are associated to" ++ spc () ++ str path ++ str ".")
-
-let find_load_path phys_dir =
- let phys_dir = CUnix.canonical_path_name phys_dir in
- let filter p = String.equal p.path_physical phys_dir in
- let paths = List.filter filter !load_paths in
- match paths with
- | [] -> raise Not_found
- | [p] -> p
- | _ -> anomaly_too_many_paths phys_dir
-
-let is_in_load_paths phys_dir =
- let dir = CUnix.canonical_path_name phys_dir in
- let lp = get_load_paths () in
- let check_p p = String.equal dir p.path_physical in
- List.exists check_p lp
-
-let remove_load_path dir =
- let filter p = not (String.equal p.path_physical dir) in
- load_paths := List.filter filter !load_paths
-
-let warn_overriding_logical_loadpath =
- CWarnings.create ~name:"overriding-logical-loadpath" ~category:"loadpath"
- (fun (phys_path, old_path, coq_path) ->
- str phys_path ++ strbrk " was previously bound to " ++
- DirPath.print old_path ++ strbrk "; it is remapped to " ++
- DirPath.print coq_path)
-
-let add_load_path phys_path coq_path ~implicit =
- let phys_path = CUnix.canonical_path_name phys_path in
- let filter p = String.equal p.path_physical phys_path in
- let binding = {
- path_logical = coq_path;
- path_physical = phys_path;
- path_implicit = implicit;
- } in
- match List.filter filter !load_paths with
- | [] ->
- load_paths := binding :: !load_paths
- | [{ path_logical = old_path; path_implicit = old_implicit }] ->
- let replace =
- if DirPath.equal coq_path old_path then
- implicit <> old_implicit
- else
- let () =
- (* Do not warn when overriding the default "-I ." path *)
- if not (DirPath.equal old_path Libnames.default_root_prefix) then
- warn_overriding_logical_loadpath (phys_path, old_path, coq_path)
- in
- true in
- if replace then
- begin
- remove_load_path phys_path;
- load_paths := binding :: !load_paths;
- end
- | _ -> anomaly_too_many_paths phys_path
-
-let filter_path f =
- let rec aux = function
- | [] -> []
- | p :: l ->
- if f p.path_logical then (p.path_physical, p.path_logical) :: aux l
- else aux l
- in
- aux !load_paths
-
-let expand_path ?root dir =
- let rec aux = function
- | [] -> []
- | { path_physical = ph; path_logical = lg; path_implicit = implicit } :: l ->
- let success =
- match root with
- | None ->
- if implicit then is_dirpath_suffix_of dir lg
- else DirPath.equal dir lg
- | Some root ->
- is_dirpath_prefix_of root lg &&
- is_dirpath_suffix_of dir (drop_dirpath_prefix root lg) in
- if success then (ph, lg) :: aux l else aux l in
- aux !load_paths
-
-let locate_file fname =
- let paths = List.map physical !load_paths in
- let _,longfname =
- System.find_file_in_path ~warn:(not !Flags.quiet) paths fname in
- longfname
diff --git a/library/nametab.mli b/library/nametab.mli
index a4f177aad0..33cb4faf99 100644
--- a/library/nametab.mli
+++ b/library/nametab.mli
@@ -38,7 +38,7 @@ open Globnames
}
{- [exists : full_user_name -> bool]
- Is the [full_user_name] already atributed as an absolute user name
+ Is the [full_user_name] already attributed as an absolute user name
of some object?
}
{- [locate : qualid -> object_reference]
diff --git a/library/summary.mli b/library/summary.mli
index 0d77d725ac..3875bcfe9e 100644
--- a/library/summary.mli
+++ b/library/summary.mli
@@ -28,7 +28,7 @@ type 'a summary_declaration = {
Beware: for tables registered dynamically after the initialization
of Coq, their init functions may not be run immediately. It is hence
- the responsability of plugins to initialize themselves properly.
+ the responsibility of plugins to initialize themselves properly.
*)
val declare_summary : string -> 'a summary_declaration -> unit
diff --git a/man/coqdep.1 b/man/coqdep.1
index c417402c25..4639a75677 100644
--- a/man/coqdep.1
+++ b/man/coqdep.1
@@ -106,7 +106,7 @@ Skips subdirectory
Output the given file name ordered by dependencies.
.TP
.B \-boot
-For coq developpers, prints dependencies over coq library files
+For coq developers, prints dependencies over coq library files
(omitted by default).
diff --git a/parsing/g_constr.mlg b/parsing/g_constr.mlg
index 4a9190c10a..6df97609f5 100644
--- a/parsing/g_constr.mlg
+++ b/parsing/g_constr.mlg
@@ -500,9 +500,9 @@ GRAMMAR EXTEND Gram
| "{"; id=name; idl=LIST1 name; "}" ->
{ List.map (fun id -> CLocalAssum ([id],Default Implicit, CAst.make ~loc @@ CHole (None, IntroAnonymous, None))) (id::idl) }
| "`("; tc = LIST1 typeclass_constraint SEP "," ; ")" ->
- { List.map (fun (n, b, t) -> CLocalAssum ([n], Generalized (Implicit, Explicit, b), t)) tc }
+ { List.map (fun (n, b, t) -> CLocalAssum ([n], Generalized (Explicit, b), t)) tc }
| "`{"; tc = LIST1 typeclass_constraint SEP "," ; "}" ->
- { List.map (fun (n, b, t) -> CLocalAssum ([n], Generalized (Implicit, Implicit, b), t)) tc }
+ { List.map (fun (n, b, t) -> CLocalAssum ([n], Generalized (Implicit, b), t)) tc }
| "'"; p = pattern LEVEL "0" ->
{ let (p, ty) =
match p.CAst.v with
diff --git a/parsing/pcoq.ml b/parsing/pcoq.ml
index 8f38e437b4..a78ad4f842 100644
--- a/parsing/pcoq.ml
+++ b/parsing/pcoq.ml
@@ -585,7 +585,7 @@ let unfreeze (grams, lex) =
(** No need to provide an init function : the grammar state is
statically available, and already empty initially, while
- the lexer state should not be resetted, since it contains
+ the lexer state should not be reset, since it contains
keywords declared in g_*.ml4 *)
let parser_summary_tag =
diff --git a/plugins/extraction/CHANGES b/plugins/extraction/CHANGES
index 4bc3dba36e..bc7e1448f7 100644
--- a/plugins/extraction/CHANGES
+++ b/plugins/extraction/CHANGES
@@ -200,7 +200,7 @@ For the moment there are:
Wf.well_founded_induction
Wf.well_founded_induction_type
Those constants does not match the auto-inlining criterion based on strictness.
-Of course, you can still overide this behaviour via some Extraction NoInline.
+Of course, you can still override this behaviour via some Extraction NoInline.
* There is now a web page showing the extraction of all standard theories:
http://www.lri.fr/~letouzey/extraction
diff --git a/plugins/extraction/ExtrOcamlBasic.v b/plugins/extraction/ExtrOcamlBasic.v
index 36bb1148b6..02da168fd0 100644
--- a/plugins/extraction/ExtrOcamlBasic.v
+++ b/plugins/extraction/ExtrOcamlBasic.v
@@ -26,9 +26,9 @@ Extract Inductive prod => "( * )" [ "" ].
Extract Inductive sumbool => bool [ true false ].
Extract Inductive sumor => option [ Some None ].
-(** Restore lazyness of andb, orb.
+(** Restore laziness of andb, orb.
NB: without these Extract Constant, andb/orb would be inlined
- by extraction in order to have lazyness, producing inelegant
+ by extraction in order to have laziness, producing inelegant
(if ... then ... else false) and (if ... then true else ...).
*)
diff --git a/plugins/extraction/common.ml b/plugins/extraction/common.ml
index 59c57cc544..f46d09e335 100644
--- a/plugins/extraction/common.ml
+++ b/plugins/extraction/common.ml
@@ -573,7 +573,7 @@ let pp_ocaml_gen k mp rls olab =
if is_mp_bound base then pp_ocaml_bound base rls
else pp_ocaml_extern k base rls
-(* For Haskell, things are simplier: we have removed (almost) all structures *)
+(* For Haskell, things are simpler: we have removed (almost) all structures *)
let pp_haskell_gen k mp rls = match rls with
| [] -> assert false
@@ -590,7 +590,7 @@ let pp_global k r =
let s = List.hd ls in
let mp,l = repr_of_r r in
if ModPath.equal mp (top_visible_mp ()) then
- (* simpliest situation: definition of r (or use in the same context) *)
+ (* simplest situation: definition of r (or use in the same context) *)
(* we update the visible environment *)
(add_visible (k,s) l; unquote s)
else
@@ -607,7 +607,7 @@ let pp_module mp =
let ls = mp_renaming mp in
match mp with
| MPdot (mp0,l) when ModPath.equal mp0 (top_visible_mp ()) ->
- (* simpliest situation: definition of mp (or use in the same context) *)
+ (* simplest situation: definition of mp (or use in the same context) *)
(* we update the visible environment *)
let s = List.hd ls in
add_visible (Mod,s) l; s
diff --git a/plugins/extraction/extraction.mli b/plugins/extraction/extraction.mli
index d27c79cb62..bf98f8cd70 100644
--- a/plugins/extraction/extraction.mli
+++ b/plugins/extraction/extraction.mli
@@ -16,9 +16,9 @@ open Environ
open Evd
open Miniml
-val extract_constant : env -> Constant.t -> constant_body -> ml_decl
+val extract_constant : env -> Constant.t -> Opaqueproof.opaque constant_body -> ml_decl
-val extract_constant_spec : env -> Constant.t -> constant_body -> ml_spec
+val extract_constant_spec : env -> Constant.t -> 'a constant_body -> ml_spec
(** For extracting "module ... with ..." declaration *)
diff --git a/plugins/extraction/g_extraction.mlg b/plugins/extraction/g_extraction.mlg
index d7bb27f121..db1a389fe7 100644
--- a/plugins/extraction/g_extraction.mlg
+++ b/plugins/extraction/g_extraction.mlg
@@ -93,7 +93,7 @@ VERNAC COMMAND EXTEND Extraction CLASSIFIED AS QUERY
END
VERNAC COMMAND EXTEND SeparateExtraction CLASSIFIED AS QUERY
-(* Same, with content splitted in several files *)
+(* Same, with content split in several files *)
| [ "Separate" "Extraction" ne_global_list(l) ]
-> { separate_extraction l }
END
diff --git a/plugins/extraction/table.ml b/plugins/extraction/table.ml
index 399a77c596..c2c48f9565 100644
--- a/plugins/extraction/table.ml
+++ b/plugins/extraction/table.ml
@@ -101,7 +101,7 @@ let labels_of_ref r =
(*S The main tables: constants, inductives, records, ... *)
-(* Theses tables are not registered within coq save/undo mechanism
+(* These tables are not registered within coq save/undo mechanism
since we reset their contents at each run of Extraction *)
(* We use [constant_body] (resp. [mutual_inductive_body]) as checksum
@@ -109,7 +109,7 @@ let labels_of_ref r =
(*s Constants tables. *)
-let typedefs = ref (Cmap_env.empty : (constant_body * ml_type) Cmap_env.t)
+let typedefs = ref (Cmap_env.empty : (Opaqueproof.opaque constant_body * ml_type) Cmap_env.t)
let init_typedefs () = typedefs := Cmap_env.empty
let add_typedef kn cb t =
typedefs := Cmap_env.add kn (cb,t) !typedefs
@@ -120,7 +120,7 @@ let lookup_typedef kn cb =
with Not_found -> None
let cst_types =
- ref (Cmap_env.empty : (constant_body * ml_schema) Cmap_env.t)
+ ref (Cmap_env.empty : (Opaqueproof.opaque constant_body * ml_schema) Cmap_env.t)
let init_cst_types () = cst_types := Cmap_env.empty
let add_cst_type kn cb s = cst_types := Cmap_env.add kn (cb,s) !cst_types
let lookup_cst_type kn cb =
@@ -842,7 +842,7 @@ let in_customs : GlobRef.t * string list * string -> obj =
~subst:(Some (fun (s,(r,ids,str)) -> (fst (subst_global s r), ids, str)))
let in_custom_matchs : GlobRef.t * string -> obj =
- declare_object @@ superglobal_object_nodischarge "ML extractions custom matchs"
+ declare_object @@ superglobal_object_nodischarge "ML extractions custom matches"
~cache:(fun (_,(r,s)) -> add_custom_match r s)
~subst:(Some (fun (subs,(r,s)) -> (fst (subst_global subs r), s)))
diff --git a/plugins/extraction/table.mli b/plugins/extraction/table.mli
index acc1bfee8a..7e53964642 100644
--- a/plugins/extraction/table.mli
+++ b/plugins/extraction/table.mli
@@ -72,11 +72,11 @@ val labels_of_ref : GlobRef.t -> ModPath.t * Label.t list
[mutual_inductive_body] as checksum. In both case, we should ideally
also check the env *)
-val add_typedef : Constant.t -> constant_body -> ml_type -> unit
-val lookup_typedef : Constant.t -> constant_body -> ml_type option
+val add_typedef : Constant.t -> Opaqueproof.opaque constant_body -> ml_type -> unit
+val lookup_typedef : Constant.t -> Opaqueproof.opaque constant_body -> ml_type option
-val add_cst_type : Constant.t -> constant_body -> ml_schema -> unit
-val lookup_cst_type : Constant.t -> constant_body -> ml_schema option
+val add_cst_type : Constant.t -> Opaqueproof.opaque constant_body -> ml_schema -> unit
+val lookup_cst_type : Constant.t -> Opaqueproof.opaque constant_body -> ml_schema option
val add_ind : MutInd.t -> mutual_inductive_body -> ml_ind -> unit
val lookup_ind : MutInd.t -> mutual_inductive_body -> ml_ind option
diff --git a/plugins/funind/functional_principles_proofs.ml b/plugins/funind/functional_principles_proofs.ml
index 287a374ab1..cffe8a3e78 100644
--- a/plugins/funind/functional_principles_proofs.ml
+++ b/plugins/funind/functional_principles_proofs.ml
@@ -658,7 +658,7 @@ let instantiate_hyps_with_args (do_prove:Id.t list -> tactic) hyps args_id =
*)
(fun g ->
-(* observe (str "Instanciation: removing hyp " ++ Ppconstr.pr_id hid); *)
+(* observe (str "Instantiation: removing hyp " ++ Ppconstr.pr_id hid); *)
thin [hid] g
)
)
diff --git a/plugins/funind/functional_principles_types.ml b/plugins/funind/functional_principles_types.ml
index e9a2c285d0..f51c6dc6be 100644
--- a/plugins/funind/functional_principles_types.ml
+++ b/plugins/funind/functional_principles_types.ml
@@ -429,11 +429,11 @@ let get_funs_constant mp =
let l_const = get_funs_constant const f in
(*
We need to check that all the functions found are in the same block
- to prevent Reset stange thing
+ to prevent Reset strange thing
*)
let l_bodies = List.map find_constant_body (Array.to_list (Array.map fst l_const)) in
let l_params,l_fixes = List.split (List.map decompose_lam l_bodies) in
- (* all the paremeter must be equal*)
+ (* all the parameters must be equal*)
let _check_params =
let first_params = List.hd l_params in
List.iter
@@ -514,7 +514,7 @@ let make_scheme evd (fas : (pconstant*Sorts.family) list) : Safe_typing.private_
)
fas
in
- (* We create the first priciple by tactic *)
+ (* We create the first principle by tactic *)
let first_type,other_princ_types =
match l_schemes with
s::l_schemes -> s,l_schemes
diff --git a/plugins/funind/glob_term_to_relation.ml b/plugins/funind/glob_term_to_relation.ml
index e15e167ff3..4c67d65816 100644
--- a/plugins/funind/glob_term_to_relation.ml
+++ b/plugins/funind/glob_term_to_relation.ml
@@ -1369,7 +1369,7 @@ let do_build_inductive
(rebuild_return_type returned_types.(i))
in
(* We need to lift back our work topconstr but only with all information
- We mimick a Set Printing All.
+ We mimic a Set Printing All.
Then save the graphs and reset Printing options to their primitive values
*)
let rel_arities = Array.mapi rel_arity funsargs in
@@ -1438,7 +1438,7 @@ let do_build_inductive
(rebuild_return_type returned_types.(i))
in
(* We need to lift back our work topconstr but only with all information
- We mimick a Set Printing All.
+ We mimic a Set Printing All.
Then save the graphs and reset Printing options to their primitive values
*)
let rel_arities = Array.mapi rel_arity funsargs in
diff --git a/plugins/funind/glob_termops.mli b/plugins/funind/glob_termops.mli
index 481a8be3ba..24b3690138 100644
--- a/plugins/funind/glob_termops.mli
+++ b/plugins/funind/glob_termops.mli
@@ -55,7 +55,7 @@ val change_vars : Id.t Id.Map.t -> glob_constr -> glob_constr
Glob_term.cases_pattern * Id.Map.key list *
Id.t Id.Map.t
-(* [alpha_rt avoid rt] alpha convert [rt] s.t. the result repects barendregt
+(* [alpha_rt avoid rt] alpha convert [rt] s.t. the result respects barendregt
conventions and does not share bound variables with avoid
*)
val alpha_rt : Id.t list -> glob_constr -> glob_constr
diff --git a/plugins/funind/indfun.ml b/plugins/funind/indfun.ml
index 6494e90a03..ce7d149ae1 100644
--- a/plugins/funind/indfun.ml
+++ b/plugins/funind/indfun.ml
@@ -414,7 +414,7 @@ let register_struct ~pstate is_rec (fixpoint_exprl:(Vernacexpr.fixpoint_expr * V
match fixpoint_exprl with
| [(({CAst.v=fname},pl),_,bl,ret_type,body),_] when not is_rec ->
let body = match body with | Some body -> body | None -> user_err ~hdr:"Function" (str "Body of Function must be given") in
- ComDefinition.do_definition ~ontop:pstate
+ ComDefinition.do_definition
~program_mode:false
fname
(Decl_kinds.Global,false,Decl_kinds.Definition) pl
diff --git a/plugins/funind/indfun_common.ml b/plugins/funind/indfun_common.ml
index 40f66ce5eb..48cf040919 100644
--- a/plugins/funind/indfun_common.ml
+++ b/plugins/funind/indfun_common.ml
@@ -115,7 +115,7 @@ let eq = lazy(EConstr.of_constr (coq_constant "eq"))
let refl_equal = lazy(EConstr.of_constr (coq_constant "eq_refl"))
(*****************************************************************)
-(* Copy of the standart save mechanism but without the much too *)
+(* Copy of the standard save mechanism but without the much too *)
(* slow reduction function *)
(*****************************************************************)
open Entries
@@ -357,7 +357,7 @@ let add_Function is_general f =
let pr_table env sigma = pr_table env sigma !from_function
(*********************************)
-(* Debuging *)
+(* Debugging *)
let functional_induction_rewrite_dependent_proofs = ref true
let function_debug = ref false
open Goptions
diff --git a/plugins/funind/invfun.ml b/plugins/funind/invfun.ml
index edb698280f..2a0140f02c 100644
--- a/plugins/funind/invfun.ml
+++ b/plugins/funind/invfun.ml
@@ -591,7 +591,7 @@ let rec reflexivity_with_destruct_cases g =
(* [prove_fun_complete funs graphs schemes lemmas_types_infos i]
- is the tactic used to prove completness lemma.
+ is the tactic used to prove completeness lemma.
[funcs], [graphs] [schemes] [lemmas_types_infos] are the mutually recursive functions
(resp. definitions of the graphs of the functions, principles and correctness lemma types) to prove correct.
@@ -748,7 +748,7 @@ let derive_correctness make_scheme (funs: pconstant list) (graphs:inductive list
let funs = Array.of_list funs and graphs = Array.of_list graphs in
let map (c, u) = mkConstU (c, EInstance.make u) in
let funs_constr = Array.map map funs in
- (* XXX STATE Why do we need this... why is the toplevel protection not enought *)
+ (* XXX STATE Why do we need this... why is the toplevel protection not enough *)
funind_purify
(fun () ->
let env = Global.env () in
@@ -928,7 +928,7 @@ let revert_graph kn post_tac hid g =
[hid] is the hypothesis to invert, [fconst] is the function to invert and [f_correct]
is the correctness lemma for [fconst].
- The sketch is the follwing~:
+ The sketch is the following~:
\begin{enumerate}
\item Transforms the hypothesis [hid] such that its type is now $res\ =\ f\ t_1 \ldots t_n$
(fails if it is not possible)
diff --git a/plugins/funind/recdef.ml b/plugins/funind/recdef.ml
index 1fca132655..216be3797b 100644
--- a/plugins/funind/recdef.ml
+++ b/plugins/funind/recdef.ml
@@ -1584,7 +1584,7 @@ let recursive_definition is_mes function_name rec_impls type_of_f r rec_arg_num
spc () ++ str"is defined" )
)
in
- (* XXX STATE Why do we need this... why is the toplevel protection not enought *)
+ (* XXX STATE Why do we need this... why is the toplevel protection not enough *)
funind_purify (fun () ->
let pstate = com_terminate
tcc_lemma_name
diff --git a/plugins/ltac/rewrite.ml b/plugins/ltac/rewrite.ml
index 963b7189f9..164bd7e118 100644
--- a/plugins/ltac/rewrite.ml
+++ b/plugins/ltac/rewrite.ml
@@ -30,7 +30,6 @@ open Evd
open Tactypes
open Locus
open Locusops
-open Decl_kinds
open Elimschemes
open Environ
open Termops
@@ -207,7 +206,7 @@ end) = struct
let mk_relation env evd a =
app_poly env evd relation [| a |]
- (** Build an infered signature from constraints on the arguments and expected output
+ (** Build an inferred signature from constraints on the arguments and expected output
relation *)
let build_signature evars env m (cstrs : (types * types option) option list)
@@ -1791,15 +1790,15 @@ let rec strategy_of_ast = function
let mkappc s l = CAst.make @@ CAppExpl ((None,qualid_of_ident (Id.of_string s),None),l)
let declare_an_instance n s args =
- (((CAst.make @@ Name n),None), Explicit,
+ (((CAst.make @@ Name n),None),
CAst.make @@ CAppExpl ((None, qualid_of_string s,None), args))
let declare_instance a aeq n s = declare_an_instance n s [a;aeq]
-let anew_instance ~pstate atts binders instance fields =
+let anew_instance ~pstate atts binders (name,t) fields =
let program_mode = atts.program in
new_instance ~pstate ~program_mode atts.polymorphic
- binders instance (Some (true, CAst.make @@ CRecord (fields)))
+ name binders t (Some (true, CAst.make @@ CRecord (fields)))
~global:atts.global ~generalize:false Hints.empty_hint_info
let declare_instance_refl ~pstate atts binders a aeq n lemma =
@@ -2014,16 +2013,18 @@ let add_morphism_infer ~pstate atts m n : Proof_global.t option =
let add_morphism ~pstate atts binders m s n =
init_setoid ();
let instance_id = add_suffix n "_Proper" in
- let instance =
- (((CAst.make @@ Name instance_id),None), Explicit,
- CAst.make @@ CAppExpl (
- (None, Libnames.qualid_of_string "Coq.Classes.Morphisms.Proper",None),
- [cHole; s; m]))
+ let instance_name = (CAst.make @@ Name instance_id),None in
+ let instance_t =
+ CAst.make @@ CAppExpl
+ ((None, Libnames.qualid_of_string "Coq.Classes.Morphisms.Proper",None),
+ [cHole; s; m])
in
let tac = Tacinterp.interp (make_tactic "add_morphism_tactic") in
- let _, pstate = new_instance ~pstate ~program_mode:atts.program ~global:atts.global atts.polymorphic binders instance
- None
- ~generalize:false ~tac ~hook:(declare_projection n instance_id) Hints.empty_hint_info in
+ let _, pstate = new_instance ~pstate
+ ~program_mode:atts.program ~global:atts.global atts.polymorphic
+ instance_name binders instance_t None
+ ~generalize:false ~tac ~hook:(declare_projection n instance_id) Hints.empty_hint_info
+ in
pstate
(** Bind to "rewrite" too *)
diff --git a/plugins/ltac/tacexpr.ml b/plugins/ltac/tacexpr.ml
index 0eb7726a18..8bd69dd4fd 100644
--- a/plugins/ltac/tacexpr.ml
+++ b/plugins/ltac/tacexpr.ml
@@ -24,7 +24,7 @@ type direction_flag = bool (* true = Left-to-right false = right-to-right *)
type lazy_flag =
| General (* returns all possible successes *)
| Select (* returns all successes of the first matching branch *)
- | Once (* returns the first success in a maching branch
+ | Once (* returns the first success in a matching branch
(not necessarily the first) *)
type global_flag = (* [gfail] or [fail] *)
| TacGlobal
diff --git a/plugins/ltac/tacexpr.mli b/plugins/ltac/tacexpr.mli
index fd303f5d94..f839c3e886 100644
--- a/plugins/ltac/tacexpr.mli
+++ b/plugins/ltac/tacexpr.mli
@@ -24,7 +24,7 @@ type direction_flag = bool (* true = Left-to-right false = right-to-right *)
type lazy_flag =
| General (* returns all possible successes *)
| Select (* returns all successes of the first matching branch *)
- | Once (* returns the first success in a maching branch
+ | Once (* returns the first success in a matching branch
(not necessarily the first) *)
type global_flag = (* [gfail] or [fail] *)
| TacGlobal
diff --git a/plugins/ltac/tacinterp.ml b/plugins/ltac/tacinterp.ml
index 800be2565d..4a0b01bcdc 100644
--- a/plugins/ltac/tacinterp.ml
+++ b/plugins/ltac/tacinterp.ml
@@ -855,7 +855,7 @@ let interp_binding_name ist env sigma = function
| NamedHyp id ->
(* If a name is bound, it has to be a quantified hypothesis *)
(* user has to use other names for variables if these ones clash with *)
- (* a name intented to be used as a (non-variable) identifier *)
+ (* a name intended to be used as a (non-variable) identifier *)
try try_interp_ltac_var (coerce_to_quantified_hypothesis sigma) ist (Some (env,sigma)) (make id)
with Not_found -> NamedHyp id
@@ -2075,7 +2075,7 @@ let _ =
let extra = TacStore.set TacStore.empty f_debug (get_debug ()) in
let ist = { lfun; poly; extra; } in
let tac = interp_tactic ist tac in
- (* EJGA: We sould also pass the proof name if desired, for now
+ (* EJGA: We should also pass the proof name if desired, for now
poly seems like enough to get reasonable behavior in practice
*)
let name, poly = Id.of_string "ltac_gen", poly in
diff --git a/plugins/ltac/tactic_matching.ml b/plugins/ltac/tactic_matching.ml
index 2b5e496168..7783661787 100644
--- a/plugins/ltac/tactic_matching.ml
+++ b/plugins/ltac/tactic_matching.ml
@@ -128,7 +128,7 @@ module PatternMatching (E:StaticEnvironment) = struct
(** To focus on the algorithmic portion of pattern-matching, the
bookkeeping is relegated to a monad: the composition of the
- bactracking monad of {!IStream.t} with a "writer" effect. *)
+ backtracking monad of {!IStream.t} with a "writer" effect. *)
(* spiwack: as we don't benefit from the various stream optimisations
of Haskell, it may be costly to give the monad in direct style such as
here. We may want to use some continuation passing style. *)
diff --git a/plugins/micromega/DeclConstant.v b/plugins/micromega/DeclConstant.v
index 47fcac6481..4e8fe5a8ff 100644
--- a/plugins/micromega/DeclConstant.v
+++ b/plugins/micromega/DeclConstant.v
@@ -62,6 +62,7 @@ Instance DZO: DeclaredConstant Z0 := {}.
Instance DZpos: DeclaredConstant Zpos := {}.
Instance DZneg: DeclaredConstant Zneg := {}.
Instance DZpow_pos : DeclaredConstant Z.pow_pos := {}.
+Instance DZpow : DeclaredConstant Z.pow := {}.
Require Import QArith.
diff --git a/plugins/micromega/MExtraction.v b/plugins/micromega/MExtraction.v
index 6112eda200..830cbdf7f6 100644
--- a/plugins/micromega/MExtraction.v
+++ b/plugins/micromega/MExtraction.v
@@ -55,7 +55,7 @@ Extract Constant Rinv => "fun x -> 1 / x".
extraction is only performed as a test in the test suite. *)
(*Extraction "micromega.ml"
Tauto.mapX Tauto.foldA Tauto.collect_annot Tauto.ids_of_formula Tauto.map_bformula
- ZMicromega.cnfZ ZMicromega.bound_problem_fr QMicromega.cnfQ
+ ZMicromega.cnfZ ZMicromega.Zeval_const ZMicromega.bound_problem_fr QMicromega.cnfQ
List.map simpl_cone (*map_cone indexes*)
denorm Qpower vm_add
normZ normQ normQ n_of_Z N.of_nat ZTautoChecker ZWeakChecker QTautoChecker RTautoChecker find.
diff --git a/plugins/micromega/OrderedRing.v b/plugins/micromega/OrderedRing.v
index e0e2232be5..7759bda7c7 100644
--- a/plugins/micromega/OrderedRing.v
+++ b/plugins/micromega/OrderedRing.v
@@ -129,7 +129,7 @@ Proof.
intros n m H1 H2; rewrite H2 in H1; now apply H1.
Qed.
-(* Propeties of plus, minus and opp *)
+(* Properties of plus, minus and opp *)
Theorem Rplus_0_l : forall n : R, 0 + n == n.
Proof.
diff --git a/plugins/micromega/RingMicromega.v b/plugins/micromega/RingMicromega.v
index 60931df517..c5e179fbb8 100644
--- a/plugins/micromega/RingMicromega.v
+++ b/plugins/micromega/RingMicromega.v
@@ -990,7 +990,7 @@ Proof.
rewrite IHs. reflexivity.
Qed.
-(** equality migth be (too) strong *)
+(** equality might be (too) strong *)
Lemma eval_formulaSC : forall env f, eval_sformula env f = eval_formula env (map_Formula f).
Proof.
destruct f.
diff --git a/plugins/micromega/ZMicromega.v b/plugins/micromega/ZMicromega.v
index ab218a1778..953690c510 100644
--- a/plugins/micromega/ZMicromega.v
+++ b/plugins/micromega/ZMicromega.v
@@ -75,6 +75,21 @@ Fixpoint Zeval_expr (env : PolEnv Z) (e: PExpr Z) : Z :=
Definition eval_expr := eval_pexpr Z.add Z.mul Z.sub Z.opp (fun x => x) (fun x => x) (pow_N 1 Z.mul).
+Fixpoint Zeval_const (e: PExpr Z) : option Z :=
+ match e with
+ | PEc c => Some c
+ | PEX _ x => None
+ | PEadd e1 e2 => map_option2 (fun x y => Some (x + y))
+ (Zeval_const e1) (Zeval_const e2)
+ | PEmul e1 e2 => map_option2 (fun x y => Some (x * y))
+ (Zeval_const e1) (Zeval_const e2)
+ | PEpow e1 n => map_option (fun x => Some (Z.pow x (Z.of_N n)))
+ (Zeval_const e1)
+ | PEsub e1 e2 => map_option2 (fun x y => Some (x - y))
+ (Zeval_const e1) (Zeval_const e2)
+ | PEopp e => map_option (fun x => Some (Z.opp x)) (Zeval_const e)
+ end.
+
Lemma ZNpower : forall r n, r ^ Z.of_N n = pow_N 1 Z.mul r n.
Proof.
destruct n.
diff --git a/plugins/micromega/coq_micromega.ml b/plugins/micromega/coq_micromega.ml
index de9dec0f74..48027442b2 100644
--- a/plugins/micromega/coq_micromega.ml
+++ b/plugins/micromega/coq_micromega.ml
@@ -346,7 +346,9 @@ struct
let coq_PsatzC = lazy (constant "PsatzC")
let coq_PsatzZ = lazy (constant "PsatzZ")
- let coq_GT = lazy (m_constant "GT")
+ (* let coq_GT = lazy (m_constant "GT")*)
+
+ let coq_DeclaredConstant = lazy (m_constant "DeclaredConstant")
let coq_TT = lazy
(gen_constant_in_modules "ZMicromega"
@@ -462,13 +464,24 @@ struct
what to consider as a constant (see [parse_constant])
*)
- let is_ground_term env sigma term =
- let typ = Retyping.get_type_of env sigma term in
- try
- ignore (Typeclasses.resolve_one_typeclass env sigma (EConstr.mkApp(Lazy.force coq_GT,[| typ;term|]))) ;
- true
- with
- | Not_found -> false
+ let is_declared_term env evd t =
+ match EConstr.kind evd t with
+ | Const _ | Construct _ -> (* Restrict typeclass resolution to trivial cases *)
+ begin
+ let typ = Retyping.get_type_of env evd t in
+ try
+ ignore (Typeclasses.resolve_one_typeclass env evd (EConstr.mkApp(Lazy.force coq_DeclaredConstant,[| typ;t|]))) ; true
+ with Not_found -> false
+ end
+ | _ -> false
+
+ let rec is_ground_term env evd term =
+ match EConstr.kind evd term with
+ | App(c,args) ->
+ is_declared_term env evd c &&
+ Array.for_all (is_ground_term env evd) args
+ | Const _ | Construct _ -> is_declared_term env evd term
+ | _ -> false
let parse_z sigma term =
@@ -674,26 +687,28 @@ struct
let parse_zop gl (op,args) =
let sigma = gl.sigma in
- match EConstr.kind sigma op with
- | Const (x,_) -> (assoc_const sigma op zop_table, args.(0) , args.(1))
- | Ind((n,0),_) ->
- if EConstr.eq_constr sigma op (Lazy.force coq_Eq) && is_convertible gl args.(0) (Lazy.force coq_Z)
- then (Mc.OpEq, args.(1), args.(2))
- else raise ParseError
- | _ -> failwith "parse_zop"
+ match args with
+ | [| a1 ; a2|] -> assoc_const sigma op zop_table, a1, a2
+ | [| ty ; a1 ; a2|] ->
+ if EConstr.eq_constr sigma op (Lazy.force coq_Eq) && is_convertible gl ty (Lazy.force coq_Z)
+ then (Mc.OpEq, args.(1), args.(2))
+ else raise ParseError
+ | _ -> raise ParseError
let parse_rop gl (op,args) =
let sigma = gl.sigma in
- match EConstr.kind sigma op with
- | Const (x,_) -> (assoc_const sigma op rop_table, args.(0) , args.(1))
- | Ind((n,0),_) ->
- if EConstr.eq_constr sigma op (Lazy.force coq_Eq) && is_convertible gl args.(0) (Lazy.force coq_R)
- then (Mc.OpEq, args.(1), args.(2))
- else raise ParseError
- | _ -> failwith "parse_zop"
+ match args with
+ | [| a1 ; a2|] -> assoc_const sigma op rop_table, a1 , a2
+ | [| ty ; a1 ; a2|] ->
+ if EConstr.eq_constr sigma op (Lazy.force coq_Eq) && is_convertible gl ty (Lazy.force coq_R)
+ then (Mc.OpEq, a1, a2)
+ else raise ParseError
+ | _ -> raise ParseError
let parse_qop gl (op,args) =
- (assoc_const gl.sigma op qop_table, args.(0) , args.(1))
+ if Array.length args = 2
+ then (assoc_const gl.sigma op qop_table, args.(0) , args.(1))
+ else raise ParseError
type 'a op =
| Binop of ('a Mc.pExpr -> 'a Mc.pExpr -> 'a Mc.pExpr)
@@ -804,7 +819,7 @@ struct
(op expr1 expr2,env) in
try (Mc.PEc (parse_constant gl term) , env)
- with ParseError ->
+ with ParseError ->
match EConstr.kind gl.sigma term with
| App(t,args) ->
(
@@ -820,7 +835,7 @@ struct
let (expr,env) = parse_expr env args.(0) in
let power = (parse_exp expr args.(1)) in
(power , env)
- with e when CErrors.noncritical e ->
+ with ParseError ->
(* if the exponent is a variable *)
let (env,n) = Env.compute_rank_add env term in (Mc.PEX n, env)
end
@@ -858,19 +873,48 @@ struct
coq_Ropp , Opp ;
coq_Rpower , Power]
- (** [parse_constant parse gl t] returns the reification of term [t].
+ let parse_constant parse gl t = parse gl.sigma t
+
+ (** [parse_more_constant parse gl t] returns the reification of term [t].
If [t] is a ground term, then it is first reduced to normal form
before using a 'syntactic' parser *)
- let parse_constant parse gl t =
- if is_ground_term gl.env gl.sigma t
- then
- parse gl.sigma (Redexpr.cbv_vm gl.env gl.sigma t)
- else raise ParseError
+ let parse_more_constant parse gl t =
+ try
+ parse gl t
+ with ParseError ->
+ begin
+ if debug then Feedback.msg_debug Pp.(str "try harder");
+ if is_ground_term gl.env gl.sigma t
+ then parse gl (Redexpr.cbv_vm gl.env gl.sigma t)
+ else raise ParseError
+ end
let zconstant = parse_constant parse_z
let qconstant = parse_constant parse_q
let nconstant = parse_constant parse_nat
+ (** [parse_more_zexpr parse_constant gl] improves the parsing of exponent
+ which can be arithmetic expressions (without variables).
+ [parse_constant_expr] returns a constant if the argument is an expression without variables. *)
+
+ let rec parse_zexpr gl =
+ parse_expr gl
+ zconstant
+ (fun expr (x:EConstr.t) ->
+ let z = parse_zconstant gl x in
+ match z with
+ | Mc.Zneg _ -> Mc.PEc Mc.Z0
+ | _ -> Mc.PEpow(expr, Mc.Z.to_N z)
+ )
+ zop_spec
+ and parse_zconstant gl e =
+ let (e,_) = parse_zexpr gl (Env.empty gl) e in
+ match Mc.zeval_const e with
+ | None -> raise ParseError
+ | Some z -> z
+
+
+
(* NB: R is a different story.
Because it is axiomatised, reducing would not be effective.
Therefore, there is a specific parser for constant over R
@@ -905,7 +949,7 @@ struct
let b = rconstant args.(1) in
f a b
with
- ParseError ->
+ ParseError ->
match op with
| op when EConstr.eq_constr sigma op (Lazy.force coq_Rinv) ->
let arg = rconstant args.(0) in
@@ -913,12 +957,12 @@ struct
then raise ParseError (* This is a division by zero -- no semantics *)
else Mc.CInv(arg)
| op when EConstr.eq_constr sigma op (Lazy.force coq_Rpower) ->
- Mc.CPow(rconstant args.(0) , Mc.Inr (nconstant gl args.(1)))
+ Mc.CPow(rconstant args.(0) , Mc.Inr (parse_more_constant nconstant gl args.(1)))
| op when EConstr.eq_constr sigma op (Lazy.force coq_IQR) ->
Mc.CQ (qconstant gl args.(0))
| op when EConstr.eq_constr sigma op (Lazy.force coq_IZR) ->
- Mc.CZ (zconstant gl args.(0))
- | _ -> raise ParseError
+ Mc.CZ (parse_more_constant zconstant gl args.(0))
+ | _ -> raise ParseError
end
| _ -> raise ParseError in
@@ -934,14 +978,6 @@ struct
res
- let parse_zexpr gl = parse_expr gl
- zconstant
- (fun expr x ->
- let exp = (zconstant gl x) in
- match exp with
- | Mc.Zneg _ -> Mc.PEc Mc.Z0
- | _ -> Mc.PEpow(expr, Mc.Z.to_N exp))
- zop_spec
let parse_qexpr gl = parse_expr gl
qconstant
@@ -952,7 +988,7 @@ struct
begin
match expr with
| Mc.PEc q -> Mc.PEc (Mc.qpower q exp)
- | _ -> print_string "parse_qexpr parse error" ; flush stdout ; raise ParseError
+ | _ -> raise ParseError
end
| _ -> let exp = Mc.Z.to_N exp in
Mc.PEpow(expr,exp))
@@ -1031,14 +1067,16 @@ struct
let g,env,tg = xparse_formula env tg b in
mkformula_binary mkIff term f g,env,tg
| _ -> parse_atom env tg term)
- | Prod(typ,a,b) when EConstr.Vars.noccurn sigma 1 b ->
+ | Prod(typ,a,b) when typ.binder_name = Anonymous || EConstr.Vars.noccurn sigma 1 b ->
let f,env,tg = xparse_formula env tg a in
let g,env,tg = xparse_formula env tg b in
mkformula_binary mkI term f g,env,tg
- | _ when EConstr.eq_constr sigma term (Lazy.force coq_True) -> (Mc.TT,env,tg)
- | _ when EConstr.eq_constr sigma term (Lazy.force coq_False) -> Mc.(FF,env,tg)
- | _ when is_prop term -> Mc.X(term),env,tg
- | _ -> raise ParseError
+ | _ -> if EConstr.eq_constr sigma term (Lazy.force coq_True)
+ then (Mc.TT,env,tg)
+ else if EConstr.eq_constr sigma term (Lazy.force coq_False)
+ then Mc.(FF,env,tg)
+ else if is_prop term then Mc.X(term),env,tg
+ else raise ParseError
in
xparse_formula env tg ((*Reductionops.whd_zeta*) term)
@@ -1170,8 +1208,8 @@ let dump_rexpr = lazy
(** [make_goal_of_formula depxr vars props form] where
- - vars is an environment for the arithmetic variables occuring in form
- - props is an environment for the propositions occuring in form
+ - vars is an environment for the arithmetic variables occurring in form
+ - props is an environment for the propositions occurring in form
@return a goal where all the variables and propositions of the formula are quantified
*)
@@ -1358,19 +1396,11 @@ let rec parse_hyps gl parse_arith env tg hyps =
let (c,env,tg) = parse_formula gl parse_arith env tg t in
((i,c)::lhyps, env,tg)
with e when CErrors.noncritical e -> (lhyps,env,tg)
- (*(if debug then Printf.printf "parse_arith : %s\n" x);*)
-
-
-(*exception ParseError*)
-
-
let parse_goal gl parse_arith (env:Env.t) hyps term =
- (* try*)
let (f,env,tg) = parse_formula gl parse_arith env (Tag.from 0) term in
let (lhyps,env,tg) = parse_hyps gl parse_arith env tg hyps in
(lhyps,f,env)
- (* with Failure x -> raise ParseError*)
(**
* The datastructures that aggregate theory-dependent proof values.
@@ -1439,7 +1469,7 @@ let pre_processZ mt f =
x <= y or (x and y are incomparable) *)
(**
- * Instanciate the current Coq goal with a Micromega formula, a varmap, and a
+ * Instantiate the current Coq goal with a Micromega formula, a varmap, and a
* witness.
*)
@@ -1886,7 +1916,7 @@ let micromega_genr prover tac =
]
with
- | ParseError -> Tacticals.New.tclFAIL 0 (Pp.str "Bad logical fragment")
+ | ParseError -> Tacticals.New.tclFAIL 0 (Pp.str "Bad logical fragment")
| Mfourier.TimeOut -> Tacticals.New.tclFAIL 0 (Pp.str "Timeout")
| CsdpNotFound -> flush stdout ;
Tacticals.New.tclFAIL 0 (Pp.str
diff --git a/plugins/micromega/micromega.ml b/plugins/micromega/micromega.ml
index b34c3b2b7d..a64a5a84b3 100644
--- a/plugins/micromega/micromega.ml
+++ b/plugins/micromega/micromega.ml
@@ -230,6 +230,13 @@ module Coq_Pos =
| XO p -> XO (mul p y)
| XH -> y
+ (** val iter : ('a1 -> 'a1) -> 'a1 -> positive -> 'a1 **)
+
+ let rec iter f x = function
+ | XI n' -> f (iter f (iter f x n') n')
+ | XO n' -> iter f (iter f x n') n'
+ | XH -> f x
+
(** val size_nat : positive -> nat **)
let rec size_nat = function
@@ -398,6 +405,18 @@ module Z =
| Zpos y' -> Zneg (Coq_Pos.mul x' y')
| Zneg y' -> Zpos (Coq_Pos.mul x' y'))
+ (** val pow_pos : z -> positive -> z **)
+
+ let pow_pos z0 =
+ Coq_Pos.iter (mul z0) (Zpos XH)
+
+ (** val pow : z -> z -> z **)
+
+ let pow x = function
+ | Z0 -> Zpos XH
+ | Zpos p -> pow_pos x p
+ | Zneg _ -> Z0
+
(** val compare : z -> z -> comparison **)
let compare x y =
@@ -460,6 +479,12 @@ module Z =
| O -> Z0
| S n1 -> Zpos (Coq_Pos.of_succ_nat n1)
+ (** val of_N : n -> z **)
+
+ let of_N = function
+ | N0 -> Z0
+ | Npos p -> Zpos p
+
(** val pos_div_eucl : positive -> z -> z * z **)
let rec pos_div_eucl a b =
@@ -1642,6 +1667,21 @@ let rec vm_add default x v = function
| XO p -> Branch ((vm_add default p v l), o, r)
| XH -> Branch (l, v, r))
+(** val zeval_const : z pExpr -> z option **)
+
+let rec zeval_const = function
+| PEc c -> Some c
+| PEX _ -> None
+| PEadd (e1, e2) ->
+ map_option2 (fun x y -> Some (Z.add x y)) (zeval_const e1) (zeval_const e2)
+| PEsub (e1, e2) ->
+ map_option2 (fun x y -> Some (Z.sub x y)) (zeval_const e1) (zeval_const e2)
+| PEmul (e1, e2) ->
+ map_option2 (fun x y -> Some (Z.mul x y)) (zeval_const e1) (zeval_const e2)
+| PEopp e0 -> map_option (fun x -> Some (Z.opp x)) (zeval_const e0)
+| PEpow (e1, n0) ->
+ map_option (fun x -> Some (Z.pow x (Z.of_N n0))) (zeval_const e1)
+
type zWitness = z psatz
(** val zWeakChecker : z nFormula list -> z psatz -> bool **)
diff --git a/plugins/micromega/micromega.mli b/plugins/micromega/micromega.mli
index 5de6caac0b..64cb3a8355 100644
--- a/plugins/micromega/micromega.mli
+++ b/plugins/micromega/micromega.mli
@@ -86,6 +86,8 @@ module Coq_Pos :
val mul : positive -> positive -> positive
+ val iter : ('a1 -> 'a1) -> 'a1 -> positive -> 'a1
+
val size_nat : positive -> nat
val compare_cont : comparison -> positive -> positive -> comparison
@@ -124,6 +126,10 @@ module Z :
val mul : z -> z -> z
+ val pow_pos : z -> positive -> z
+
+ val pow : z -> z -> z
+
val compare : z -> z -> comparison
val leb : z -> z -> bool
@@ -140,6 +146,8 @@ module Z :
val of_nat : nat -> z
+ val of_N : n -> z
+
val pos_div_eucl : positive -> z -> z * z
val div_eucl : z -> z -> z * z
@@ -179,20 +187,20 @@ val paddC : ('a1 -> 'a1 -> 'a1) -> 'a1 pol -> 'a1 -> 'a1 pol
val psubC : ('a1 -> 'a1 -> 'a1) -> 'a1 pol -> 'a1 -> 'a1 pol
val paddI :
- ('a1 -> 'a1 -> 'a1) -> ('a1 pol -> 'a1 pol -> 'a1 pol) -> 'a1 pol -> positive -> 'a1
- pol -> 'a1 pol
+ ('a1 -> 'a1 -> 'a1) -> ('a1 pol -> 'a1 pol -> 'a1 pol) -> 'a1 pol -> positive -> 'a1 pol
+ -> 'a1 pol
val psubI :
('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1) -> ('a1 pol -> 'a1 pol -> 'a1 pol) -> 'a1 pol ->
positive -> 'a1 pol -> 'a1 pol
val paddX :
- 'a1 -> ('a1 -> 'a1 -> bool) -> ('a1 pol -> 'a1 pol -> 'a1 pol) -> 'a1 pol ->
- positive -> 'a1 pol -> 'a1 pol
+ 'a1 -> ('a1 -> 'a1 -> bool) -> ('a1 pol -> 'a1 pol -> 'a1 pol) -> 'a1 pol -> positive ->
+ 'a1 pol -> 'a1 pol
val psubX :
- 'a1 -> ('a1 -> 'a1) -> ('a1 -> 'a1 -> bool) -> ('a1 pol -> 'a1 pol -> 'a1 pol) ->
- 'a1 pol -> positive -> 'a1 pol -> 'a1 pol
+ 'a1 -> ('a1 -> 'a1) -> ('a1 -> 'a1 -> bool) -> ('a1 pol -> 'a1 pol -> 'a1 pol) -> 'a1
+ pol -> positive -> 'a1 pol -> 'a1 pol
val padd :
'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> bool) -> 'a1 pol -> 'a1 pol -> 'a1 pol
@@ -205,20 +213,19 @@ val pmulC_aux :
'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> bool) -> 'a1 pol -> 'a1 -> 'a1 pol
val pmulC :
- 'a1 -> 'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> bool) -> 'a1 pol -> 'a1 -> 'a1
- pol
+ 'a1 -> 'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> bool) -> 'a1 pol -> 'a1 -> 'a1 pol
val pmulI :
- 'a1 -> 'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> bool) -> ('a1 pol -> 'a1 pol ->
- 'a1 pol) -> 'a1 pol -> positive -> 'a1 pol -> 'a1 pol
+ 'a1 -> 'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> bool) -> ('a1 pol -> 'a1 pol -> 'a1
+ pol) -> 'a1 pol -> positive -> 'a1 pol -> 'a1 pol
val pmul :
- 'a1 -> 'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> bool) ->
- 'a1 pol -> 'a1 pol -> 'a1 pol
+ 'a1 -> 'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> bool) -> 'a1
+ pol -> 'a1 pol -> 'a1 pol
val psquare :
- 'a1 -> 'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> bool) ->
- 'a1 pol -> 'a1 pol
+ 'a1 -> 'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> bool) -> 'a1
+ pol -> 'a1 pol
type 'c pExpr =
| PEc of 'c
@@ -232,16 +239,16 @@ type 'c pExpr =
val mk_X : 'a1 -> 'a1 -> positive -> 'a1 pol
val ppow_pos :
- 'a1 -> 'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> bool) ->
- ('a1 pol -> 'a1 pol) -> 'a1 pol -> 'a1 pol -> positive -> 'a1 pol
+ 'a1 -> 'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> bool) -> ('a1
+ pol -> 'a1 pol) -> 'a1 pol -> 'a1 pol -> positive -> 'a1 pol
val ppow_N :
- 'a1 -> 'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> bool) ->
- ('a1 pol -> 'a1 pol) -> 'a1 pol -> n -> 'a1 pol
+ 'a1 -> 'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> bool) -> ('a1
+ pol -> 'a1 pol) -> 'a1 pol -> n -> 'a1 pol
val norm_aux :
- 'a1 -> 'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) ->
- ('a1 -> 'a1) -> ('a1 -> 'a1 -> bool) -> 'a1 pExpr -> 'a1 pol
+ 'a1 -> 'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) -> ('a1
+ -> 'a1) -> ('a1 -> 'a1 -> bool) -> 'a1 pExpr -> 'a1 pol
type ('tA, 'tX, 'aA, 'aF) gFormula =
| TT
@@ -253,8 +260,7 @@ type ('tA, 'tX, 'aA, 'aF) gFormula =
| N of ('tA, 'tX, 'aA, 'aF) gFormula
| I of ('tA, 'tX, 'aA, 'aF) gFormula * 'aF option * ('tA, 'tX, 'aA, 'aF) gFormula
-val mapX :
- ('a2 -> 'a2) -> ('a1, 'a2, 'a3, 'a4) gFormula -> ('a1, 'a2, 'a3, 'a4) gFormula
+val mapX : ('a2 -> 'a2) -> ('a1, 'a2, 'a3, 'a4) gFormula -> ('a1, 'a2, 'a3, 'a4) gFormula
val foldA : ('a5 -> 'a3 -> 'a5) -> ('a1, 'a2, 'a3, 'a4) gFormula -> 'a5 -> 'a5
@@ -278,37 +284,36 @@ val cnf_tt : ('a1, 'a2) cnf
val cnf_ff : ('a1, 'a2) cnf
val add_term :
- ('a1 -> bool) -> ('a1 -> 'a1 -> 'a1 option) -> ('a1 * 'a2) -> ('a1, 'a2) clause ->
- ('a1, 'a2) clause option
+ ('a1 -> bool) -> ('a1 -> 'a1 -> 'a1 option) -> ('a1 * 'a2) -> ('a1, 'a2) clause -> ('a1,
+ 'a2) clause option
val or_clause :
- ('a1 -> bool) -> ('a1 -> 'a1 -> 'a1 option) -> ('a1, 'a2) clause -> ('a1, 'a2)
- clause -> ('a1, 'a2) clause option
+ ('a1 -> bool) -> ('a1 -> 'a1 -> 'a1 option) -> ('a1, 'a2) clause -> ('a1, 'a2) clause ->
+ ('a1, 'a2) clause option
val or_clause_cnf :
- ('a1 -> bool) -> ('a1 -> 'a1 -> 'a1 option) -> ('a1, 'a2) clause -> ('a1, 'a2) cnf
- -> ('a1, 'a2) cnf
+ ('a1 -> bool) -> ('a1 -> 'a1 -> 'a1 option) -> ('a1, 'a2) clause -> ('a1, 'a2) cnf ->
+ ('a1, 'a2) cnf
val or_cnf :
- ('a1 -> bool) -> ('a1 -> 'a1 -> 'a1 option) -> ('a1, 'a2) cnf -> ('a1, 'a2) cnf ->
- ('a1, 'a2) cnf
+ ('a1 -> bool) -> ('a1 -> 'a1 -> 'a1 option) -> ('a1, 'a2) cnf -> ('a1, 'a2) cnf -> ('a1,
+ 'a2) cnf
val and_cnf : ('a1, 'a2) cnf -> ('a1, 'a2) cnf -> ('a1, 'a2) cnf
type ('term, 'annot, 'tX, 'aF) tFormula = ('term, 'tX, 'annot, 'aF) gFormula
val xcnf :
- ('a2 -> bool) -> ('a2 -> 'a2 -> 'a2 option) -> ('a1 -> 'a3 -> ('a2, 'a3) cnf) ->
- ('a1 -> 'a3 -> ('a2, 'a3) cnf) -> bool -> ('a1, 'a3, 'a4, 'a5) tFormula -> ('a2,
- 'a3) cnf
+ ('a2 -> bool) -> ('a2 -> 'a2 -> 'a2 option) -> ('a1 -> 'a3 -> ('a2, 'a3) cnf) -> ('a1 ->
+ 'a3 -> ('a2, 'a3) cnf) -> bool -> ('a1, 'a3, 'a4, 'a5) tFormula -> ('a2, 'a3) cnf
val radd_term :
('a1 -> bool) -> ('a1 -> 'a1 -> 'a1 option) -> ('a1 * 'a2) -> ('a1, 'a2) clause ->
(('a1, 'a2) clause, 'a2 list) sum
val ror_clause :
- ('a1 -> bool) -> ('a1 -> 'a1 -> 'a1 option) -> ('a1 * 'a2) list -> ('a1, 'a2) clause
- -> (('a1, 'a2) clause, 'a2 list) sum
+ ('a1 -> bool) -> ('a1 -> 'a1 -> 'a1 option) -> ('a1 * 'a2) list -> ('a1, 'a2) clause ->
+ (('a1, 'a2) clause, 'a2 list) sum
val ror_clause_cnf :
('a1 -> bool) -> ('a1 -> 'a1 -> 'a1 option) -> ('a1 * 'a2) list -> ('a1, 'a2) clause
@@ -319,17 +324,16 @@ val ror_cnf :
clause list -> ('a1, 'a2) cnf * 'a2 list
val rxcnf :
- ('a2 -> bool) -> ('a2 -> 'a2 -> 'a2 option) -> ('a1 -> 'a3 -> ('a2, 'a3) cnf) ->
- ('a1 -> 'a3 -> ('a2, 'a3) cnf) -> bool -> ('a1, 'a3, 'a4, 'a5) tFormula -> ('a2,
- 'a3) cnf * 'a3 list
+ ('a2 -> bool) -> ('a2 -> 'a2 -> 'a2 option) -> ('a1 -> 'a3 -> ('a2, 'a3) cnf) -> ('a1 ->
+ 'a3 -> ('a2, 'a3) cnf) -> bool -> ('a1, 'a3, 'a4, 'a5) tFormula -> ('a2, 'a3) cnf * 'a3
+ list
-val cnf_checker :
- (('a1 * 'a2) list -> 'a3 -> bool) -> ('a1, 'a2) cnf -> 'a3 list -> bool
+val cnf_checker : (('a1 * 'a2) list -> 'a3 -> bool) -> ('a1, 'a2) cnf -> 'a3 list -> bool
val tauto_checker :
- ('a2 -> bool) -> ('a2 -> 'a2 -> 'a2 option) -> ('a1 -> 'a3 -> ('a2, 'a3) cnf) ->
- ('a1 -> 'a3 -> ('a2, 'a3) cnf) -> (('a2 * 'a3) list -> 'a4 -> bool) -> ('a1, __,
- 'a3, unit0) gFormula -> 'a4 list -> bool
+ ('a2 -> bool) -> ('a2 -> 'a2 -> 'a2 option) -> ('a1 -> 'a3 -> ('a2, 'a3) cnf) -> ('a1 ->
+ 'a3 -> ('a2, 'a3) cnf) -> (('a2 * 'a3) list -> 'a4 -> bool) -> ('a1, __, 'a3, unit0)
+ gFormula -> 'a4 list -> bool
val cneqb : ('a1 -> 'a1 -> bool) -> 'a1 -> 'a1 -> bool
@@ -363,27 +367,27 @@ val map_option : ('a1 -> 'a2 option) -> 'a1 option -> 'a2 option
val map_option2 : ('a1 -> 'a2 -> 'a3 option) -> 'a1 option -> 'a2 option -> 'a3 option
val pexpr_times_nformula :
- 'a1 -> 'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> bool) ->
- 'a1 polC -> 'a1 nFormula -> 'a1 nFormula option
+ 'a1 -> 'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> bool) -> 'a1
+ polC -> 'a1 nFormula -> 'a1 nFormula option
val nformula_times_nformula :
- 'a1 -> 'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> bool) ->
- 'a1 nFormula -> 'a1 nFormula -> 'a1 nFormula option
+ 'a1 -> 'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> bool) -> 'a1
+ nFormula -> 'a1 nFormula -> 'a1 nFormula option
val nformula_plus_nformula :
- 'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> bool) -> 'a1 nFormula -> 'a1 nFormula
- -> 'a1 nFormula option
+ 'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> bool) -> 'a1 nFormula -> 'a1 nFormula ->
+ 'a1 nFormula option
val eval_Psatz :
- 'a1 -> 'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> bool) ->
- ('a1 -> 'a1 -> bool) -> 'a1 nFormula list -> 'a1 psatz -> 'a1 nFormula option
+ 'a1 -> 'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> bool) -> ('a1
+ -> 'a1 -> bool) -> 'a1 nFormula list -> 'a1 psatz -> 'a1 nFormula option
val check_inconsistent :
'a1 -> ('a1 -> 'a1 -> bool) -> ('a1 -> 'a1 -> bool) -> 'a1 nFormula -> bool
val check_normalised_formulas :
- 'a1 -> 'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> bool) ->
- ('a1 -> 'a1 -> bool) -> 'a1 nFormula list -> 'a1 psatz -> bool
+ 'a1 -> 'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> bool) -> ('a1
+ -> 'a1 -> bool) -> 'a1 nFormula list -> 'a1 psatz -> bool
type op2 =
| OpEq
@@ -396,8 +400,8 @@ type op2 =
type 't formula = { flhs : 't pExpr; fop : op2; frhs : 't pExpr }
val norm :
- 'a1 -> 'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) ->
- ('a1 -> 'a1) -> ('a1 -> 'a1 -> bool) -> 'a1 pExpr -> 'a1 pol
+ 'a1 -> 'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) -> ('a1
+ -> 'a1) -> ('a1 -> 'a1 -> bool) -> 'a1 pExpr -> 'a1 pol
val psub0 :
'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1) -> ('a1 -> 'a1 ->
@@ -407,20 +411,20 @@ val padd0 :
'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> bool) -> 'a1 pol -> 'a1 pol -> 'a1 pol
val xnormalise :
- 'a1 -> 'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) ->
- ('a1 -> 'a1) -> ('a1 -> 'a1 -> bool) -> 'a1 formula -> 'a1 nFormula list
+ 'a1 -> 'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) -> ('a1
+ -> 'a1) -> ('a1 -> 'a1 -> bool) -> 'a1 formula -> 'a1 nFormula list
val cnf_normalise :
- 'a1 -> 'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) ->
- ('a1 -> 'a1) -> ('a1 -> 'a1 -> bool) -> 'a1 formula -> 'a2 -> ('a1 nFormula, 'a2) cnf
+ 'a1 -> 'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) -> ('a1
+ -> 'a1) -> ('a1 -> 'a1 -> bool) -> 'a1 formula -> 'a2 -> ('a1 nFormula, 'a2) cnf
val xnegate :
- 'a1 -> 'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) ->
- ('a1 -> 'a1) -> ('a1 -> 'a1 -> bool) -> 'a1 formula -> 'a1 nFormula list
+ 'a1 -> 'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) -> ('a1
+ -> 'a1) -> ('a1 -> 'a1 -> bool) -> 'a1 formula -> 'a1 nFormula list
val cnf_negate :
- 'a1 -> 'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) ->
- ('a1 -> 'a1) -> ('a1 -> 'a1 -> bool) -> 'a1 formula -> 'a2 -> ('a1 nFormula, 'a2) cnf
+ 'a1 -> 'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) -> ('a1
+ -> 'a1) -> ('a1 -> 'a1 -> bool) -> 'a1 formula -> 'a2 -> ('a1 nFormula, 'a2) cnf
val xdenorm : positive -> 'a1 pol -> 'a1 pExpr
@@ -475,6 +479,8 @@ val singleton : 'a1 -> positive -> 'a1 -> 'a1 t
val vm_add : 'a1 -> positive -> 'a1 -> 'a1 t -> 'a1 t
+val zeval_const : z pExpr -> z option
+
type zWitness = z psatz
val zWeakChecker : z nFormula list -> z psatz -> bool
@@ -563,12 +569,12 @@ val bound_var : positive -> z formula
val mk_eq_pos : positive -> positive -> positive -> z formula
val bound_vars :
- (positive -> positive -> bool option -> 'a2) -> positive -> Vars.t -> (z formula,
- 'a1, 'a2, 'a3) gFormula
+ (positive -> positive -> bool option -> 'a2) -> positive -> Vars.t -> (z formula, 'a1,
+ 'a2, 'a3) gFormula
val bound_problem_fr :
- (positive -> positive -> bool option -> 'a2) -> positive -> (z formula, 'a1, 'a2,
- 'a3) gFormula -> (z formula, 'a1, 'a2, 'a3) gFormula
+ (positive -> positive -> bool option -> 'a2) -> positive -> (z formula, 'a1, 'a2, 'a3)
+ gFormula -> (z formula, 'a1, 'a2, 'a3) gFormula
val zChecker : z nFormula list -> zArithProof -> bool
diff --git a/plugins/micromega/persistent_cache.ml b/plugins/micromega/persistent_cache.ml
index 0209030b64..f038f8a71a 100644
--- a/plugins/micromega/persistent_cache.ml
+++ b/plugins/micromega/persistent_cache.ml
@@ -21,7 +21,7 @@ module type PHashtable =
val open_in : string -> 'a t
(** [open_in f] rebuilds a table from the records stored in file [f].
- As marshaling is not type-safe, it migth segault.
+ As marshaling is not type-safe, it might segfault.
*)
val find : 'a t -> key -> 'a
diff --git a/plugins/micromega/persistent_cache.mli b/plugins/micromega/persistent_cache.mli
index 4e7a388aaf..d2f3e756a9 100644
--- a/plugins/micromega/persistent_cache.mli
+++ b/plugins/micromega/persistent_cache.mli
@@ -17,7 +17,7 @@ module type PHashtable =
val open_in : string -> 'a t
(** [open_in f] rebuilds a table from the records stored in file [f].
- As marshaling is not type-safe, it migth segault.
+ As marshaling is not type-safe, it might segfault.
*)
val find : 'a t -> key -> 'a
diff --git a/plugins/micromega/sos_lib.ml b/plugins/micromega/sos_lib.ml
index 6aebc4ca9a..e3a9f6f60f 100644
--- a/plugins/micromega/sos_lib.ml
+++ b/plugins/micromega/sos_lib.ml
@@ -200,7 +200,7 @@ let is_undefined f =
| _ -> false;;
(* ------------------------------------------------------------------------- *)
-(* Operation analagous to "map" for lists. *)
+(* Operation analogous to "map" for lists. *)
(* ------------------------------------------------------------------------- *)
let mapf =
diff --git a/plugins/nsatz/nsatz.ml b/plugins/nsatz/nsatz.ml
index 1777418ef6..bece316c7d 100644
--- a/plugins/nsatz/nsatz.ml
+++ b/plugins/nsatz/nsatz.ml
@@ -267,7 +267,7 @@ module PIdeal = Ideal.Make(Poly)
open PIdeal
(* term to sparse polynomial
- varaibles <=np are in the coefficients
+ variables <=np are in the coefficients
*)
let term_pol_sparse nvars np t=
diff --git a/plugins/nsatz/polynom.ml b/plugins/nsatz/polynom.ml
index 5db587b9cc..f6ca232c2e 100644
--- a/plugins/nsatz/polynom.ml
+++ b/plugins/nsatz/polynom.ml
@@ -357,7 +357,7 @@ let remP v p =
moinsP p (multP (coefDom v p) (puisP (x v) (deg v p)))
-(* first interger coefficient of p *)
+(* first integer coefficient of p *)
let rec coef_int_tete p =
let v = max_var_pol p in
if v>0
@@ -526,7 +526,7 @@ let div_pol_rat p q=
(* pseudo division :
q = c*x^m+q1
- retruns (r,c,d,s) s.t. c^d*p = s*q + r.
+ returns (r,c,d,s) s.t. c^d*p = s*q + r.
*)
let pseudo_div p q x =
diff --git a/plugins/omega/PreOmega.v b/plugins/omega/PreOmega.v
index 695f000cb1..23d7b141a4 100644
--- a/plugins/omega/PreOmega.v
+++ b/plugins/omega/PreOmega.v
@@ -359,7 +359,10 @@ Ltac zify_positive_rel :=
Ltac zify_positive_op :=
match goal with
- (* Zneg -> -Zpos (except for numbers) *)
+ (* Z.pow_pos -> Z.pow *)
+ | H : context [ Z.pow_pos ?a ?b ] |- _ => change (Z.pow_pos a b) with (Z.pow a (Z.pos b)) in H
+ | |- context [ Z.pow_pos ?a ?b ] => change (Z.pow_pos a b) with (Z.pow a (Z.pos b))
+ (* Zneg -> -Zpos (except for numbers) *)
| H : context [ Zneg ?a ] |- _ =>
let isp := isPcst a in
match isp with
@@ -377,6 +380,10 @@ Ltac zify_positive_op :=
| H : context [ Zpos (Pos.of_succ_nat ?a) ] |- _ => rewrite (Zpos_P_of_succ_nat a) in H
| |- context [ Zpos (Pos.of_succ_nat ?a) ] => rewrite (Zpos_P_of_succ_nat a)
+ (* Z.power_pos *)
+ | H : context [ Zpos (Pos.of_succ_nat ?a) ] |- _ => rewrite (Zpos_P_of_succ_nat a) in H
+ | |- context [ Zpos (Pos.of_succ_nat ?a) ] => rewrite (Zpos_P_of_succ_nat a)
+
(* Pos.add -> Z.add *)
| H : context [ Zpos (?a + ?b) ] |- _ => change (Zpos (a+b)) with (Zpos a + Zpos b) in H
| |- context [ Zpos (?a + ?b) ] => change (Zpos (a+b)) with (Zpos a + Zpos b)
diff --git a/plugins/ssr/ssrbool.v b/plugins/ssr/ssrbool.v
index 49d729bd6c..c5f387b248 100644
--- a/plugins/ssr/ssrbool.v
+++ b/plugins/ssr/ssrbool.v
@@ -49,7 +49,7 @@ Require Import ssreflect ssrfun.
altP (idP my_formula) but circumventing the
dependent index capture issue; destructing
boolP my_formula generates two subgoals with
- assumtions my_formula and ~~ myformula. As
+ assumptions my_formula and ~~ myformula. As
with altP, my_formula must be an application.
\unless C, P <-> we can assume property P when a something that
holds under condition C (such as C itself).
@@ -64,7 +64,7 @@ Require Import ssreflect ssrfun.
:= forall b : bool, (P -> b) -> b.
This is equivalent to ~ (~ P) when P : Prop.
implies P Q == wrapper variant type that coerces to P -> Q and
- can be used as a P -> Q view unambigously.
+ can be used as a P -> Q view unambiguously.
Useful to avoid spurious insertion of <-> views
when Q is a conjunction of foralls, as in Lemma
all_and2 below; conversely, avoids confusion in
@@ -1003,7 +1003,7 @@ Proof. by case: a; case: b. Qed.
Lemma negb_or (a b : bool) : ~~ (a || b) = ~~ a && ~~ b.
Proof. by case: a; case: b. Qed.
-(** Pseudo-cancellation -- i.e, absorbtion **)
+(** Pseudo-cancellation -- i.e, absorption **)
Lemma andbK a b : a && b || a = a. Proof. by case: a; case: b. Qed.
Lemma andKb a b : a || b && a = a. Proof. by case: a; case: b. Qed.
@@ -1245,7 +1245,7 @@ Notation "[ 'pred' x : T | E1 & E2 ]" :=
(** Coercions for simpl_pred.
As simpl_pred T values are used both applicatively and collectively we
need simpl_pred to coerce to both pred T _and_ {pred T}. However it is
- undesireable to have two distinct constants for what are essentially identical
+ undesirable to have two distinct constants for what are essentially identical
coercion functions, as this confuses the SSReflect keyed matching algorithm.
While the Coq Coercion declarations appear to disallow such Coercion aliasing,
it is possible to work around this limitation with a combination of modules
@@ -1331,9 +1331,9 @@ Variant mem_pred T := Mem of pred T.
Similarly to pred_of_simpl, it will usually not be inserted by type
inference, as all mem_pred mp =~= pred_sort ?pT unification problems will
be solve by the memPredType instance below; pred_of_mem will however
- be used if a mem_pred T is used as a {pred T}, which is desireable as it
+ be used if a mem_pred T is used as a {pred T}, which is desirable as it
will avoid a redundant mem in a collective, e.g., passing (mem A) to a lemma
- expection a generic collective predicate p : {pred T} and premise x \in P
+ exception a generic collective predicate p : {pred T} and premise x \in P
will display a subgoal x \in A rathere than x \in mem A.
Conversely, pred_of_mem will _not_ if it is used id (mem A) is used
applicatively or as a pred T; there the simpl_of_mem coercion defined below
@@ -1396,7 +1396,7 @@ Notation "[ 'rel' x y 'in' A & B ]" :=
Notation "[ 'rel' x y 'in' A | E ]" := [rel x y in A & A | E] : fun_scope.
Notation "[ 'rel' x y 'in' A ]" := [rel x y in A & A] : fun_scope.
-(** Aliases of pred T that let us tag intances of simpl_pred as applicative
+(** Aliases of pred T that let us tag instances of simpl_pred as applicative
or collective, via bespoke coercions. This tagging will give control over
the simplification behaviour of inE and othe rewriting lemmas below.
For this control to work it is crucial that collective_of_simpl _not_
@@ -1428,7 +1428,7 @@ Implicit Types (mp : mem_pred T).
- registered_applicative_pred: this user-facing structure is used to
declare values of type pred T meant to be used applicatively. The
structure parameter merely displays this same value, and is used to avoid
- undesireable, visible occurrence of the structure in the right hand side
+ undesirable, visible occurrence of the structure in the right hand side
of rewrite rules such as app_predE.
There is a canonical instance of registered_applicative_pred for values
of the applicative_of_simpl coercion, which handles the
@@ -1454,7 +1454,7 @@ Implicit Types (mp : mem_pred T).
has been fixed earlier by the manifest_mem_pred match. In particular the
definition of a predicate using the applicative_pred_of_simpl idiom above
will not be expanded - this very case is the reason in_applicative uses
- a mem_pred telescope in its left hand side. The more straighforward
+ a mem_pred telescope in its left hand side. The more straightforward
?x \in applicative_pred_value ?ap (equivalent to in_mem ?x (Mem ?ap))
with ?ap : registered_applicative_pred ?p would set ?p := [pred x | ...]
rather than ?p := Apred in the example above.
diff --git a/plugins/ssr/ssreflect.v b/plugins/ssr/ssreflect.v
index 5e3e8ce5fb..572d72ccd8 100644
--- a/plugins/ssr/ssreflect.v
+++ b/plugins/ssr/ssreflect.v
@@ -132,7 +132,7 @@ Delimit Scope ssripat_scope with ssripat.
Make the general "if" into a notation, so that we can override it below.
The notations are "only parsing" because the Coq decompiler will not
recognize the expansion of the boolean if; using the default printer
- avoids a spurrious trailing %%GEN_IF. **)
+ avoids a spurious trailing %%GEN_IF. **)
Declare Scope general_if_scope.
Delimit Scope general_if_scope with GEN_IF.
@@ -347,10 +347,10 @@ Register protect_term as plugins.ssreflect.protect_term.
(**
The ssreflect idiom for a non-keyed pattern:
- - unkeyed t wiil match any subterm that unifies with t, regardless of
+ - unkeyed t will match any subterm that unifies with t, regardless of
whether it displays the same head symbol as t.
- unkeyed t a b will match any application of a term f unifying with t,
- to two arguments unifying with with a and b, repectively, regardless of
+ to two arguments unifying with with a and b, respectively, regardless of
apparent head symbols.
- unkeyed x where x is a variable will match any subterm with the same
type as x (when x would raise the 'indeterminate pattern' error). **)
@@ -380,7 +380,7 @@ Notation "=^~ r" := (ssr_converse r) : form_scope.
locked_with k t is equal but not convertible to t, much like locked t,
but supports explicit tagging with a value k : unit. This is used to
mitigate a flaw in the term comparison heuristic of the Coq kernel,
- which treats all terms of the form locked t as equal and conpares their
+ which treats all terms of the form locked t as equal and compares their
arguments recursively, leading to an exponential blowup of comparison.
For this reason locked_with should be used rather than locked when
defining ADT operations. The unlock tactic does not support locked_with
@@ -523,7 +523,7 @@ Hint View for apply/ iffRLn|2 iffLRn|2 iffRL|2 iffLR|2.
elim/abstract_context: (pattern) => G defG.
vm_compute; rewrite {}defG {G}.
Note that vm_cast are not stored in the proof term
- for reductions occuring in the context, hence
+ for reductions occurring in the context, hence
set here := pattern; vm_compute in (value of here)
blows up at Qed time. **)
Lemma abstract_context T (P : T -> Type) x :
@@ -637,7 +637,7 @@ Ltac over :=
later complain that it cannot erase _top_assumption_ after having
abstracted the viewed assumption. Making x and y maximal implicits
would avoid this and force the intended @Some_inj nat x y _top_assumption_
- interpretation, but is undesireable as it makes it harder to use Some_inj
+ interpretation, but is undesirable as it makes it harder to use Some_inj
with the many SSReflect and MathComp lemmas that have an injectivity
premise. Specifying {T : nonPropType} solves this more elegantly, as then
(?T : Type) no longer unifies with (Some n = Some 0), which has sort Prop.
@@ -655,13 +655,13 @@ Module NonPropType.
maybeProp T to tt and use the test_negative instance and set ?r to false.
- call_of c r sets up a call to test_of on condition c with expected result r.
It has a default instance for its 'callee' projection to Type, which
- sets c := maybeProj T and r := false whe unifying with a type T.
+ sets c := maybeProj T and r := false when unifying with a type T.
- type is a telescope on call_of c r, which checks that unifying test_of ?r1
with c indeed sets ?r1 := r; the type structure bundles the 'test' instance
and its 'result' value along with its call_of c r projection. The default
instance essentially provides eta-expansion for 'type'. This is only
essential for the first 'result' projection to bool; using the instance
- for other projection merely avoids spurrious delta expansions that would
+ for other projection merely avoids spurious delta expansions that would
spoil the notProp T notation.
In detail, unifying T =~= ?S with ?S : nonPropType, i.e.,
(1) T =~= @callee (@condition (result ?S) (test ?S)) (result ?S) (frame ?S)
diff --git a/plugins/ssr/ssrelim.ml b/plugins/ssr/ssrelim.ml
index 675e4d2457..dbc9bb24c5 100644
--- a/plugins/ssr/ssrelim.ml
+++ b/plugins/ssr/ssrelim.ml
@@ -96,7 +96,7 @@ let subgoals_tys sigma (relctx, concl) =
* (occ, c), deps and the pattern inferred from the type of the eliminator
* 3. build the new predicate matching the patterns, and the tactic to
* generalize the equality in case eqid is not None
- * 4. build the tactic handle intructions and clears as required in ipats and
+ * 4. build the tactic handle instructions and clears as required in ipats and
* by eqid *)
let get_eq_type gl =
diff --git a/plugins/ssr/ssrequality.ml b/plugins/ssr/ssrequality.ml
index 93c0d5c236..59fc69f100 100644
--- a/plugins/ssr/ssrequality.ml
+++ b/plugins/ssr/ssrequality.ml
@@ -128,7 +128,7 @@ let newssrcongrtac arg ist gl =
x, re_sig si sigma in
let arr, gl = pf_mkSsrConst "ssr_congr_arrow" gl in
let ssr_congr lr = EConstr.mkApp (arr, lr) in
- (* here thw two cases: simple equality or arrow *)
+ (* here the two cases: simple equality or arrow *)
let equality, _, eq_args, gl' =
let eq, gl = pf_fresh_global Coqlib.(lib_ref "core.eq.type") gl in
pf_saturate gl (EConstr.of_constr eq) 3 in
@@ -313,7 +313,7 @@ let rw_progress rhs lhs ise = not (EConstr.eq_constr ise lhs (Evarutil.nf_evar i
(* Coq has a more general form of "equation" (any type with a single *)
(* constructor with no arguments with_rect_r elimination lemmas). *)
(* However there is no clear way of determining the LHS and RHS of *)
-(* such a generic Leibnitz equation -- short of inspecting the type *)
+(* such a generic Leibniz equation -- short of inspecting the type *)
(* of the elimination lemmas. *)
let rec strip_prod_assum c = match Constr.kind c with
diff --git a/plugins/ssrmatching/ssrmatching.mli b/plugins/ssrmatching/ssrmatching.mli
index 25975c84e8..6d1d858648 100644
--- a/plugins/ssrmatching/ssrmatching.mli
+++ b/plugins/ssrmatching/ssrmatching.mli
@@ -143,7 +143,7 @@ val mk_tpattern :
type find_P =
env -> constr -> int -> k:subst -> constr
-(** [conclude ()] asserts that all mentioned ocurrences have been visited.
+(** [conclude ()] asserts that all mentioned occurrences have been visited.
@return the instance of the pattern, the evarmap after the pattern
instantiation, the proof term and the ssrdit stored in the tpattern
@raise UserEerror if too many occurrences were specified *)
diff --git a/pretyping/cbv.ml b/pretyping/cbv.ml
index c9f18d89be..5ea9b79336 100644
--- a/pretyping/cbv.ml
+++ b/pretyping/cbv.ml
@@ -145,7 +145,7 @@ let mkSTACK = function
type cbv_infos = {
env : Environ.env;
- tab : cbv_value Declarations.constant_def KeyTable.t;
+ tab : (cbv_value, Empty.t) Declarations.constant_def KeyTable.t;
reds : RedFlags.reds;
sigma : Evd.evar_map
}
diff --git a/printing/ppconstr.ml b/printing/ppconstr.ml
index 78733784a7..9d3ed40f6c 100644
--- a/printing/ppconstr.ml
+++ b/printing/ppconstr.ml
@@ -339,8 +339,7 @@ let tag_var = tag Tag.variable
let pr_binder many pr (nal,k,t) =
match k with
- | Generalized (b, b', t') ->
- assert (match b with Implicit -> true | _ -> false);
+ | Generalized (b', t') ->
begin match nal with
|[{loc; v=Anonymous}] ->
hov 1 (str"`" ++ (surround_impl b'
diff --git a/stm/asyncTaskQueue.ml b/stm/asyncTaskQueue.ml
index 2493b1fac4..8b455821af 100644
--- a/stm/asyncTaskQueue.ml
+++ b/stm/asyncTaskQueue.ml
@@ -125,7 +125,7 @@ module Make(T : Task) () = struct
"-async-proofs-worker-priority";
CoqworkmgrApi.(string_of_priority !async_proofs_worker_priority)]
(* Options to discard: 0 arguments *)
- | ("-emacs"|"-emacs-U"|"-batch")::tl ->
+ | ("-emacs"|"-batch")::tl ->
set_slave_opt tl
(* Options to discard: 1 argument *)
| ( "-async-proofs" | "-vio2vo" | "-o"
diff --git a/stm/stm.ml b/stm/stm.ml
index 6f7cefb582..d469994f3f 100644
--- a/stm/stm.ml
+++ b/stm/stm.ml
@@ -100,6 +100,15 @@ let forward_feedback, forward_feedback_hook =
let unreachable_state, unreachable_state_hook = Hook.make
~default:(fun ~doc:_ _ _ -> ()) ()
+let document_add, document_add_hook = Hook.make
+ ~default:(fun _ _ -> ()) ()
+
+let document_edit, document_edit_hook = Hook.make
+ ~default:(fun _ -> ()) ()
+
+let sentence_exec, sentence_exec_hook = Hook.make
+ ~default:(fun _ -> ()) ()
+
include Hook
(* enables: Hooks.(call foo args) *)
@@ -571,7 +580,7 @@ end = struct (* {{{ *)
(match Vernacprop.under_control x with
| VernacDefinition (_,({CAst.v=Name i},_),_) -> Id.to_string i
| VernacStartTheoremProof (_,[({CAst.v=i},_),_]) -> Id.to_string i
- | VernacInstance (_,(({CAst.v=Name i},_),_,_),_,_) -> Id.to_string i
+ | VernacInstance (({CAst.v=Name i},_),_,_,_,_) -> Id.to_string i
| _ -> "branch")
let edit_branch = Branch.make "edit"
let branch ?root ?pos name kind = vcs := branch !vcs ?root ?pos name kind
@@ -2661,7 +2670,7 @@ type stm_init_options = {
(* Initial load path in scope for the document. Usually extracted
from -R options / _CoqProject *)
- iload_path : Mltop.coq_path list;
+ iload_path : Loadpath.coq_path list;
(* Require [require_libs] before the initial state is
ready. Parameters follow [Library], that is to say,
@@ -2719,7 +2728,7 @@ let new_doc { doc_type ; iload_path; require_libs; stm_options } =
(* Set load path; important, this has to happen before we declare
the library below as [Declaremods/Library] will infer the module
name by looking at the load path! *)
- List.iter Mltop.add_coq_path iload_path;
+ List.iter Loadpath.add_coq_path iload_path;
Safe_typing.allow_delayed_constants := !cur_opt.async_proofs_mode <> APoff;
@@ -2767,6 +2776,7 @@ let new_doc { doc_type ; iload_path; require_libs; stm_options } =
doc, VCS.cur_tip ()
let observe ~doc id =
+ Hooks.(call sentence_exec id);
let vcs = VCS.backup () in
try
Reach.known_state ~doc ~cache:(VCS.is_interactive ()) id;
@@ -3122,6 +3132,7 @@ let compute_indentation ?loc sid = Option.cata (fun loc ->
) (0, 0) loc
let add ~doc ~ontop ?newtip verb ast =
+ Hooks.(call document_add ast ontop);
let loc = ast.CAst.loc in
let cur_tip = VCS.cur_tip () in
if not (Stateid.equal ontop cur_tip) then
@@ -3167,6 +3178,7 @@ let query ~doc ~at ~route s =
s
let edit_at ~doc id =
+ Hooks.(call document_edit id);
if Stateid.equal id Stateid.dummy then anomaly(str"edit_at dummy.") else
let vcs = VCS.backup () in
let on_cur_branch id =
@@ -3322,6 +3334,9 @@ let state_computed_hook = Hooks.state_computed_hook
let state_ready_hook = Hooks.state_ready_hook
let forward_feedback_hook = Hooks.forward_feedback_hook
let unreachable_state_hook = Hooks.unreachable_state_hook
+let document_add_hook = Hooks.document_add_hook
+let document_edit_hook = Hooks.document_edit_hook
+let sentence_exec_hook = Hooks.sentence_exec_hook
let () = Hook.set Obligations.stm_get_fix_exn (fun () -> !State.fix_exn_ref)
type document = VCS.vcs
diff --git a/stm/stm.mli b/stm/stm.mli
index 9d2bf56629..24c672c973 100644
--- a/stm/stm.mli
+++ b/stm/stm.mli
@@ -69,7 +69,7 @@ type stm_init_options = {
(* Initial load path in scope for the document. Usually extracted
from -R options / _CoqProject *)
- iload_path : Mltop.coq_path list;
+ iload_path : Loadpath.coq_path list;
(* Require [require_libs] before the initial state is
ready. Parameters follow [Library], that is to say,
@@ -282,6 +282,19 @@ val state_ready_hook : (doc:doc -> Stateid.t -> unit) Hook.t
(* Messages from the workers to the master *)
val forward_feedback_hook : (Feedback.feedback -> unit) Hook.t
+(*
+ * Hooks into the UI for plugins (not for general use)
+ *)
+
+(** User adds a sentence to the document (after parsing) *)
+val document_add_hook : (Vernacexpr.vernac_control -> Stateid.t -> unit) Hook.t
+
+(** User edits a sentence in the document *)
+val document_edit_hook : (Stateid.t -> unit) Hook.t
+
+(** User requests evaluation of a sentence *)
+val sentence_exec_hook : (Stateid.t -> unit) Hook.t
+
val get_doc : Feedback.doc_id -> doc
val state_of_id : doc:doc ->
diff --git a/stm/vernac_classifier.ml b/stm/vernac_classifier.ml
index 7cecd801e4..aa16f9535d 100644
--- a/stm/vernac_classifier.ml
+++ b/stm/vernac_classifier.ml
@@ -188,11 +188,11 @@ let classify_vernac e =
| VernacDeclareMLModule _
| VernacContext _ (* TASSI: unsure *) -> VtSideff [], VtNow
| VernacProofMode pm -> VtProofMode pm, VtNow
- | VernacInstance (_,((name,_),_,_),None,_) when not (Attributes.parse_drop_extra Attributes.program atts) ->
+ | VernacInstance ((name,_),_,_,None,_) when not (Attributes.parse_drop_extra Attributes.program atts) ->
let polymorphic = Attributes.(parse_drop_extra polymorphic atts) in
let guarantee = if polymorphic then Doesn'tGuaranteeOpacity else GuaranteesOpacity in
VtStartProof (guarantee, idents_of_name name.CAst.v), VtLater
- | VernacInstance (_,((name,_),_,_),_,_) ->
+ | VernacInstance ((name,_),_,_,_,_) ->
VtSideff (idents_of_name name.CAst.v), VtLater
(* Stm will install a new classifier to handle these *)
| VernacBack _ | VernacAbortAll
diff --git a/stm/vio_checking.ml b/stm/vio_checking.ml
index 69c1d9bd23..0f78e0acf6 100644
--- a/stm/vio_checking.ml
+++ b/stm/vio_checking.ml
@@ -10,11 +10,11 @@
open Util
-let check_vio (ts,f) =
+let check_vio (ts,f_in) =
Dumpglob.noglob ();
- let long_f_dot_v, _, _, _, _, tasks, _ = Library.load_library_todo f in
- Stm.set_compilation_hints long_f_dot_v;
- List.fold_left (fun acc ids -> Stm.check_task f tasks ids && acc) true ts
+ let _, _, _, _, tasks, _ = Library.load_library_todo f_in in
+ Stm.set_compilation_hints f_in;
+ List.fold_left (fun acc ids -> Stm.check_task f_in tasks ids && acc) true ts
module Worker = Spawn.Sync ()
@@ -28,15 +28,12 @@ module Pool = Map.Make(IntOT)
let schedule_vio_checking j fs =
if j < 1 then CErrors.user_err Pp.(str "The number of workers must be bigger than 0");
let jobs = ref [] in
- List.iter (fun f ->
- let f =
- if Filename.check_suffix f ".vio" then Filename.chop_extension f
- else f in
- let long_f_dot_v, _,_,_,_, tasks, _ = Library.load_library_todo f in
- Stm.set_compilation_hints long_f_dot_v;
+ List.iter (fun long_f_dot_vio ->
+ let _,_,_,_, tasks, _ = Library.load_library_todo long_f_dot_vio in
+ Stm.set_compilation_hints long_f_dot_vio;
let infos = Stm.info_tasks tasks in
let eta = List.fold_left (fun a (_,t,_) -> a +. t) 0.0 infos in
- if infos <> [] then jobs := (f, eta, infos) :: !jobs)
+ if infos <> [] then jobs := (long_f_dot_vio, eta, infos) :: !jobs)
fs;
let cmp_job (_,t1,_) (_,t2,_) = compare t2 t1 in
jobs := List.sort cmp_job !jobs;
@@ -103,16 +100,12 @@ let schedule_vio_checking j fs =
let schedule_vio_compilation j fs =
if j < 1 then CErrors.user_err Pp.(str "The number of workers must be bigger than 0");
let jobs = ref [] in
- List.iter (fun f ->
- let f =
- if Filename.check_suffix f ".vio" then Filename.chop_extension f
- else f in
- let long_f_dot_v = Loadpath.locate_file (f^".v") in
- let aux = Aux_file.load_aux_file_for long_f_dot_v in
+ List.iter (fun long_f_dot_vio ->
+ let aux = Aux_file.load_aux_file_for long_f_dot_vio in
let eta =
try float_of_string (Aux_file.get aux "vo_compile_time")
with Not_found -> 0.0 in
- jobs := (f, eta) :: !jobs)
+ jobs := (long_f_dot_vio, eta) :: !jobs)
fs;
let cmp_job (_,t1) (_,t2) = compare t2 t1 in
jobs := List.sort cmp_job !jobs;
@@ -146,7 +139,7 @@ let schedule_vio_compilation j fs =
(* set the access and last modification time of all files to the same t
* not to confuse make into thinking that some of them are outdated *)
let t = Unix.gettimeofday () in
- List.iter (fun (f,_) -> Unix.utimes (f^".vo") t t) all_jobs;
+ List.iter (fun (f,_) -> Unix.utimes (Filename.chop_extension f^".vo") t t) all_jobs;
end;
exit !rc
diff --git a/tactics/abstract.ml b/tactics/abstract.ml
index 499152f39a..6dd9a976f9 100644
--- a/tactics/abstract.ml
+++ b/tactics/abstract.ml
@@ -158,9 +158,9 @@ let cache_term_by_tactic_then ~opaque ~name_op ?(goal_type=None) tac tacK =
(* do not compute the implicit arguments, it may be costly *)
let () = Impargs.make_implicit_args false in
(* ppedrot: seems legit to have abstracted subproofs as local*)
- Declare.declare_constant ~internal:Declare.InternalTacticRequest ~local:true id decl
+ Declare.declare_private_constant ~role:Entries.Subproof ~internal:Declare.InternalTacticRequest ~local:true id decl
in
- let cst = Impargs.with_implicit_protection cst () in
+ let cst, eff = Impargs.with_implicit_protection cst () in
let inst = match const.Entries.const_entry_universes with
| Entries.Monomorphic_entry _ -> EInstance.empty
| Entries.Polymorphic_entry (_, ctx) ->
@@ -174,7 +174,6 @@ let cache_term_by_tactic_then ~opaque ~name_op ?(goal_type=None) tac tacK =
let lem = mkConstU (cst, inst) in
let evd = Evd.set_universe_context evd ectx in
let open Safe_typing in
- let eff = private_constant (Global.safe_env ()) Entries.Subproof cst in
let effs = concat_private eff
Entries.(snd (Future.force const.const_entry_body)) in
let solve =
diff --git a/tactics/ind_tables.ml b/tactics/ind_tables.ml
index e95778a90d..b9485b8823 100644
--- a/tactics/ind_tables.ml
+++ b/tactics/ind_tables.ml
@@ -116,8 +116,7 @@ let compute_name internal id =
| InternalTacticRequest ->
Namegen.next_ident_away_from (add_prefix "internal_" id) is_visible_name
-let define internal id c poly univs =
- let fd = declare_constant ~internal in
+let define internal role id c poly univs =
let id = compute_name internal id in
let ctx = UState.minimize univs in
let c = UnivSubst.nf_evars_and_universes_opt_subst (fun _ -> None) (UState.subst ctx) c in
@@ -133,12 +132,12 @@ let define internal id c poly univs =
const_entry_inline_code = false;
const_entry_feedback = None;
} in
- let kn = fd id (DefinitionEntry entry, Decl_kinds.IsDefinition Scheme) in
+ let kn, eff = declare_private_constant ~role ~internal id (DefinitionEntry entry, Decl_kinds.IsDefinition Scheme) in
let () = match internal with
| InternalTacticRequest -> ()
| _-> definition_message id
in
- kn
+ kn, eff
let define_individual_scheme_base kind suff f mode idopt (mind,i as ind) =
let (c, ctx), eff = f mode ind in
@@ -146,9 +145,8 @@ let define_individual_scheme_base kind suff f mode idopt (mind,i as ind) =
let id = match idopt with
| Some id -> id
| None -> add_suffix mib.mind_packets.(i).mind_typename suff in
- let const = define mode id c (Declareops.inductive_is_polymorphic mib) ctx in
let role = Entries.Schema (ind, kind) in
- let neff = Safe_typing.private_constant (Global.safe_env ()) role const in
+ let const, neff = define mode role id c (Declareops.inductive_is_polymorphic mib) ctx in
declare_scheme kind [|ind,const|];
const, Safe_typing.concat_private neff eff
@@ -165,9 +163,8 @@ let define_mutual_scheme_base kind suff f mode names mind =
try Int.List.assoc i names
with Not_found -> add_suffix mib.mind_packets.(i).mind_typename suff) in
let fold i effs id cl =
- let cst = define mode id cl (Declareops.inductive_is_polymorphic mib) ctx in
let role = Entries.Schema ((mind, i), kind)in
- let neff = Safe_typing.private_constant (Global.safe_env ()) role cst in
+ let cst, neff = define mode role id cl (Declareops.inductive_is_polymorphic mib) ctx in
(Safe_typing.concat_private neff effs, cst)
in
let (eff, consts) = Array.fold_left2_map_i fold eff ids cl in
diff --git a/tactics/tactics.ml b/tactics/tactics.ml
index 2bdfc85d6d..9dafa8bad9 100644
--- a/tactics/tactics.ml
+++ b/tactics/tactics.ml
@@ -614,7 +614,7 @@ let cofix id = mutual_cofix id [] 0
type tactic_reduction = Reductionops.reduction_function
type e_tactic_reduction = Reductionops.e_reduction_function
-let e_pf_change_decl (redfun : bool -> e_reduction_function) where decl env sigma =
+let e_pf_change_decl (redfun : bool -> e_reduction_function) where env sigma decl =
let open Context.Named.Declaration in
match decl with
| LocalAssum (id,ty) ->
@@ -713,28 +713,61 @@ let e_change_in_hyp ~check ~reorder redfun (id,where) =
Proofview.Goal.enter begin fun gl ->
let sigma = Proofview.Goal.sigma gl in
let hyp = Tacmach.New.pf_get_hyp id gl in
- let (sigma, c) = e_pf_change_decl redfun where hyp (Proofview.Goal.env gl) sigma in
+ let (sigma, c) = e_pf_change_decl redfun where (Proofview.Goal.env gl) sigma hyp in
Proofview.tclTHEN (Proofview.Unsafe.tclEVARS sigma)
(convert_hyp ~check ~reorder c)
end
+type hyp_conversion =
+| AnyHypConv (** Arbitrary conversion *)
+| StableHypConv (** Does not introduce new dependencies on variables *)
+| LocalHypConv (** Same as above plus no dependence on the named environment *)
+
let e_change_in_hyps ~check ~reorder f args =
Proofview.Goal.enter begin fun gl ->
- let fold (env, sigma) arg =
- let (redfun, id, where) = f arg in
- let hyp =
- try lookup_named id env
- with Not_found ->
- raise (RefinerError (env, sigma, NoSuchHyp id))
+ let env = Proofview.Goal.env gl in
+ let sigma = Tacmach.New.project gl in
+ let (env, sigma) = match reorder with
+ | LocalHypConv ->
+ (* If the reduction function is known not to depend on the named
+ context, then we can perform it in parallel. *)
+ let fold accu arg =
+ let (id, redfun) = f arg in
+ let old = try Id.Map.find id accu with Not_found -> [] in
+ Id.Map.add id (redfun :: old) accu
+ in
+ let reds = List.fold_left fold Id.Map.empty args in
+ let evdref = ref sigma in
+ let map d =
+ let id = NamedDecl.get_id d in
+ match Id.Map.find id reds with
+ | reds ->
+ let d = EConstr.of_named_decl d in
+ let fold redfun (sigma, d) = redfun env sigma d in
+ let (sigma, d) = List.fold_right fold reds (sigma, d) in
+ let () = evdref := sigma in
+ EConstr.Unsafe.to_named_decl d
+ | exception Not_found -> d
in
- let (sigma, d) = e_pf_change_decl redfun where hyp env sigma in
- let sign = Logic.convert_hyp ~check ~reorder env sigma d in
+ let sign = Environ.map_named_val map (Environ.named_context_val env) in
let env = reset_with_named_context sign env in
- (env, sigma)
+ (env, !evdref)
+ | StableHypConv | AnyHypConv ->
+ let reorder = reorder == AnyHypConv in
+ let fold (env, sigma) arg =
+ let (id, redfun) = f arg in
+ let hyp =
+ try lookup_named id env
+ with Not_found ->
+ raise (RefinerError (env, sigma, NoSuchHyp id))
+ in
+ let (sigma, d) = redfun env sigma hyp in
+ let sign = Logic.convert_hyp ~check ~reorder env sigma d in
+ let env = reset_with_named_context sign env in
+ (env, sigma)
+ in
+ List.fold_left fold (env, sigma) args
in
- let env = Proofview.Goal.env gl in
- let sigma = Tacmach.New.project gl in
- let (env, sigma) = List.fold_left fold (env, sigma) args in
let ty = Proofview.Goal.concl gl in
Proofview.Unsafe.tclEVARS sigma
<*>
@@ -851,10 +884,12 @@ let change ~check chg c cls =
let f (id, occs, where) =
let occl = bind_change_occurrences occs chg in
let redfun deep env sigma t = change_on_subterm ~check Reduction.CONV deep c occl env sigma t in
- (redfun, id, where)
+ let redfun env sigma d = e_pf_change_decl redfun where env sigma d in
+ (id, redfun)
in
+ let reorder = if check then AnyHypConv else StableHypConv in
(* Don't check, we do it already in [change_on_subterm] *)
- e_change_in_hyps ~check:false ~reorder:check f hyps
+ e_change_in_hyps ~check:false ~reorder f hyps
end
let change_concl t =
@@ -881,6 +916,22 @@ let pattern_option l = e_reduct_option ~check:false (pattern_occs l,DEFAULTcast)
(* The main reduction function *)
+let is_local_flag env flags =
+ if flags.rDelta then false
+ else
+ let check = function
+ | EvalVarRef _ -> false
+ | EvalConstRef c -> Id.Set.is_empty (Environ.vars_of_global env (ConstRef c))
+ in
+ List.for_all check flags.rConst
+
+let is_local_unfold env flags =
+ let check (_, c) = match c with
+ | EvalVarRef _ -> false
+ | EvalConstRef c -> Id.Set.is_empty (Environ.vars_of_global env (ConstRef c))
+ in
+ List.for_all check flags
+
let reduce redexp cl =
let trace env sigma =
let open Printer in
@@ -889,23 +940,33 @@ let reduce redexp cl =
in
Proofview.Trace.name_tactic trace begin
Proofview.Goal.enter begin fun gl ->
+ let env = Proofview.Goal.env gl in
let hyps = concrete_clause_of (fun () -> Tacmach.New.pf_ids_of_hyps gl) cl in
let nbcl = (if cl.concl_occs = NoOccurrences then 0 else 1) + List.length hyps in
let check = match redexp with Fold _ | Pattern _ -> true | _ -> false in
- let reorder = match redexp with Fold _ | Pattern _ -> true | _ -> false in
+ let reorder = match redexp with
+ | Fold _ | Pattern _ -> AnyHypConv
+ | Simpl (flags, _) | Cbv flags | Cbn flags | Lazy flags ->
+ if is_local_flag env flags then LocalHypConv else StableHypConv
+ | Unfold flags ->
+ if is_local_unfold env flags then LocalHypConv else StableHypConv
+ | Red _ | Hnf | CbvVm _ | CbvNative _ -> StableHypConv
+ | ExtraRedExpr _ -> StableHypConv (* Should we be that lenient ?*)
+ in
begin match cl.concl_occs with
| NoOccurrences -> Proofview.tclUNIT ()
| occs ->
let redexp = bind_red_expr_occurrences occs nbcl redexp in
- let redfun = Redexpr.reduction_of_red_expr (Tacmach.New.pf_env gl) redexp in
+ let redfun = Redexpr.reduction_of_red_expr env redexp in
e_change_in_concl ~check (revert_cast redfun)
end
<*>
let f (id, occs, where) =
let redexp = bind_red_expr_occurrences occs nbcl redexp in
- let (redfun, _) = Redexpr.reduction_of_red_expr (Tacmach.New.pf_env gl) redexp in
+ let (redfun, _) = Redexpr.reduction_of_red_expr env redexp in
let redfun _ env sigma c = redfun env sigma c in
- (redfun, id, where)
+ let redfun env sigma d = e_pf_change_decl redfun where env sigma d in
+ (id, redfun)
in
e_change_in_hyps ~check ~reorder f hyps
end
diff --git a/test-suite/bugs/closed/bug_10176.v b/test-suite/bugs/closed/bug_10176.v
new file mode 100644
index 0000000000..fdb0eb87a4
--- /dev/null
+++ b/test-suite/bugs/closed/bug_10176.v
@@ -0,0 +1,7 @@
+Class Foo (xxx:nat) := foo : nat.
+
+Lemma aa `{Foo} : nat. Abort.
+
+Fail Lemma xy (Foo:bool->Type) `{Foo} : nat.
+
+Fail Lemma yx (Fooo:bool->Type) `{Fooo} : nat.
diff --git a/test-suite/micromega/bug_10158.v b/test-suite/micromega/bug_10158.v
new file mode 100644
index 0000000000..2c8f798f12
--- /dev/null
+++ b/test-suite/micromega/bug_10158.v
@@ -0,0 +1,48 @@
+Require Import ZArith_base.
+Require Import Coq.micromega.Lia.
+
+Open Scope Z_scope.
+
+Fixpoint fib (n: nat) : Z :=
+ match n with
+ | O => 1
+ | S O => 1
+ | S (S n as p) => fib p + fib n
+ end.
+
+Axiom fib_47_computed: fib 47 = 2971215073.
+
+Lemma fib_bound:
+ fib 47 < 2 ^ 32.
+Proof.
+ pose proof fib_47_computed.
+ lia.
+Qed.
+
+Require Import Reals.
+Require Import Coq.micromega.Lra.
+
+Open Scope R_scope.
+
+Fixpoint fibr (n: nat) : R :=
+ match n with
+ | O => 1
+ | S O => 1
+ | S (S n as p) => fibr p + fibr n
+ end.
+
+Axiom fibr_47_computed: fibr 47 = 2971215073.
+
+Lemma fibr_bound:
+ fibr 47 < 2 ^ 32.
+Proof.
+ pose proof fibr_47_computed.
+ lra.
+Qed.
+
+Lemma fibr_bound':
+ fibr 47 < IZR (Z.pow_pos 2 32).
+Proof.
+ pose proof fibr_47_computed.
+ lra.
+Qed.
diff --git a/test-suite/micromega/rsyntax.v b/test-suite/micromega/rsyntax.v
index 02b98b562f..f02d93f911 100644
--- a/test-suite/micromega/rsyntax.v
+++ b/test-suite/micromega/rsyntax.v
@@ -57,15 +57,7 @@ Require Import Lia.
Goal ( 1 ^ (2 + 2) = 1)%Z.
Proof.
- Fail lia.
- reflexivity.
-Qed.
-
-Instance DZplus : DeclaredConstant Z.add := {}.
-
-Goal ( 1 ^ (2 + 2) = 1)%Z.
-Proof.
- lia.
+ lia. (* exponent is a constant expr *)
Qed.
diff --git a/test-suite/misc/changelog.sh b/test-suite/misc/changelog.sh
index 8b4a49e577..ed473e5874 100755
--- a/test-suite/misc/changelog.sh
+++ b/test-suite/misc/changelog.sh
@@ -1,11 +1,9 @@
#!/bin/sh
-while read line; do
- if [ "$line" = "is_a_released_version = False" ]; then
+if grep -q -F "is_a_released_version = False" ../config/coq_config.py; then
echo "This is not a released version: nothing to test."
exit 0
- fi
-done < ../config/coq_config.py
+fi
for d in ../doc/changelog/*; do
if [ -d "$d" ]; then
diff --git a/test-suite/output/MExtraction.v b/test-suite/output/MExtraction.v
index 7429a521b3..c0ef9b392d 100644
--- a/test-suite/output/MExtraction.v
+++ b/test-suite/output/MExtraction.v
@@ -7,8 +7,8 @@ Require Import QMicromega.
Require Import RMicromega.
Recursive Extraction
- Tauto.mapX Tauto.foldA Tauto.collect_annot Tauto.ids_of_formula Tauto.map_bformula
- ZMicromega.cnfZ ZMicromega.bound_problem_fr QMicromega.cnfQ
+Tauto.mapX Tauto.foldA Tauto.collect_annot Tauto.ids_of_formula Tauto.map_bformula
+ ZMicromega.cnfZ ZMicromega.Zeval_const ZMicromega.bound_problem_fr QMicromega.cnfQ
List.map simpl_cone (*map_cone indexes*)
denorm Qpower vm_add
normZ normQ normQ n_of_Z N.of_nat ZTautoChecker ZWeakChecker QTautoChecker RTautoChecker find.
diff --git a/theories/Classes/CRelationClasses.v b/theories/Classes/CRelationClasses.v
index c014ecc7ab..2dd254496b 100644
--- a/theories/Classes/CRelationClasses.v
+++ b/theories/Classes/CRelationClasses.v
@@ -337,7 +337,7 @@ Section Binary.
morphism for equivalence (see Morphisms). It is also sufficient to
show that [R] is antisymmetric w.r.t. [eqA] *)
- Global Instance partial_order_antisym `(PartialOrder eqA R) : ! Antisymmetric A eqA R.
+ Global Instance partial_order_antisym `(PartialOrder eqA R) : Antisymmetric eqA R.
Proof with auto.
reduce_goal.
apply H. firstorder.
diff --git a/theories/Classes/EquivDec.v b/theories/Classes/EquivDec.v
index e9a9d6aff2..7f26181108 100644
--- a/theories/Classes/EquivDec.v
+++ b/theories/Classes/EquivDec.v
@@ -94,7 +94,7 @@ Program Instance unit_eqdec : EqDec unit eq := fun x y => in_left.
Obligation Tactic := unfold complement, equiv ; program_simpl.
Program Instance prod_eqdec `(EqDec A eq, EqDec B eq) :
- ! EqDec (prod A B) eq :=
+ EqDec (prod A B) eq :=
{ equiv_dec x y :=
let '(x1, x2) := x in
let '(y1, y2) := y in
@@ -115,7 +115,7 @@ Program Instance sum_eqdec `(EqDec A eq, EqDec B eq) :
(** Objects of function spaces with countable domains like bool have decidable
equality. Proving the reflection requires functional extensionality though. *)
-Program Instance bool_function_eqdec `(EqDec A eq) : ! EqDec (bool -> A) eq :=
+Program Instance bool_function_eqdec `(EqDec A eq) : EqDec (bool -> A) eq :=
{ equiv_dec f g :=
if f true == g true then
if f false == g false then in_left
@@ -130,7 +130,7 @@ Program Instance bool_function_eqdec `(EqDec A eq) : ! EqDec (bool -> A) eq :=
Require Import List.
-Program Instance list_eqdec `(eqa : EqDec A eq) : ! EqDec (list A) eq :=
+Program Instance list_eqdec `(eqa : EqDec A eq) : EqDec (list A) eq :=
{ equiv_dec :=
fix aux (x y : list A) :=
match x, y with
diff --git a/theories/Classes/RelationClasses.v b/theories/Classes/RelationClasses.v
index 440b317573..3c0982cde7 100644
--- a/theories/Classes/RelationClasses.v
+++ b/theories/Classes/RelationClasses.v
@@ -464,7 +464,7 @@ Section Binary.
morphism for equivalence (see Morphisms). It is also sufficient to
show that [R] is antisymmetric w.r.t. [eqA] *)
- Global Instance partial_order_antisym `(PartialOrder eqA R) : ! Antisymmetric A eqA R.
+ Global Instance partial_order_antisym `(PartialOrder eqA R) : Antisymmetric A eqA R.
Proof with auto.
reduce_goal.
pose proof partial_order_equivalence as poe. do 3 red in poe.
@@ -481,7 +481,7 @@ Hint Extern 3 (PartialOrder (flip _)) => class_apply PartialOrder_inverse : type
(** The partial order defined by subrelation and relation equivalence. *)
Program Instance subrelation_partial_order :
- ! PartialOrder (relation A) relation_equivalence subrelation.
+ PartialOrder (@relation_equivalence A) subrelation.
Next Obligation.
Proof.
diff --git a/toplevel/ccompile.ml b/toplevel/ccompile.ml
index 8934385091..7748134146 100644
--- a/toplevel/ccompile.ml
+++ b/toplevel/ccompile.ml
@@ -73,14 +73,18 @@ let ensure_bname src tgt =
let ensure ext src tgt = ensure_bname src tgt; ensure_ext ext tgt
-let ensure_v v = ensure ".v" v v
-let ensure_vo v vo = ensure ".vo" v vo
-let ensure_vio v vio = ensure ".vio" v vio
-
let ensure_exists f =
if not (Sys.file_exists f) then
fatal_error (hov 0 (str "Can't find file" ++ spc () ++ str f))
+let ensure_exists_with_prefix f_in f_out src_suffix tgt_suffix =
+ let long_f_dot_src = ensure src_suffix f_in f_in in
+ ensure_exists long_f_dot_src;
+ let long_f_dot_tgt = match f_out with
+ | None -> chop_extension long_f_dot_src ^ tgt_suffix
+ | Some f -> ensure tgt_suffix long_f_dot_src f in
+ long_f_dot_src, long_f_dot_tgt
+
(* Compile a vernac file *)
let compile opts copts ~echo ~f_in ~f_out =
let open Vernac.State in
@@ -102,12 +106,9 @@ let compile opts copts ~echo ~f_in ~f_out =
match copts.compilation_mode with
| BuildVo ->
Flags.record_aux_file := true;
- let long_f_dot_v = ensure_v f_in in
- ensure_exists long_f_dot_v;
- let long_f_dot_vo =
- match f_out with
- | None -> long_f_dot_v ^ "o"
- | Some f -> ensure_vo long_f_dot_v f in
+
+ let long_f_dot_v, long_f_dot_vo =
+ ensure_exists_with_prefix f_in f_out ".v" ".vo" in
let doc, sid = Topfmt.(in_phase ~phase:LoadingPrelude)
Stm.new_doc
@@ -138,13 +139,8 @@ let compile opts copts ~echo ~f_in ~f_out =
Flags.record_aux_file := false;
Dumpglob.noglob ();
- let long_f_dot_v = ensure_v f_in in
- ensure_exists long_f_dot_v;
-
- let long_f_dot_vio =
- match f_out with
- | None -> long_f_dot_v ^ "io"
- | Some f -> ensure_vio long_f_dot_v f in
+ let long_f_dot_v, long_f_dot_vio =
+ ensure_exists_with_prefix f_in f_out ".v" ".vio" in
(* We need to disable error resiliency, otherwise some errors
will be ignored in batch mode. c.f. #6707
@@ -175,13 +171,15 @@ let compile opts copts ~echo ~f_in ~f_out =
Stm.reset_task_queue ()
| Vio2Vo ->
- let open Filename in
+
Flags.record_aux_file := false;
Dumpglob.noglob ();
- let f = if check_suffix f_in ".vio" then chop_extension f_in else f_in in
- let lfdv, sum, lib, univs, disch, tasks, proofs = Library.load_library_todo f in
- let univs, proofs = Stm.finish_tasks lfdv univs disch proofs tasks in
- Library.save_library_raw lfdv sum lib univs proofs
+ let long_f_dot_vio, long_f_dot_vo =
+ ensure_exists_with_prefix f_in f_out ".vio" ".vo" in
+ let sum, lib, univs, disch, tasks, proofs =
+ Library.load_library_todo long_f_dot_vio in
+ let univs, proofs = Stm.finish_tasks long_f_dot_vo univs disch proofs tasks in
+ Library.save_library_raw long_f_dot_vo sum lib univs proofs
let compile opts copts ~echo ~f_in ~f_out =
ignore(CoqworkmgrApi.get 1);
@@ -205,23 +203,29 @@ let compile_files opts copts =
(******************************************************************************)
let check_vio_tasks copts =
let rc =
- List.fold_left (fun acc t -> Vio_checking.check_vio t && acc)
+ List.fold_left (fun acc (n,f) ->
+ let f_in = ensure ".vio" f f in
+ ensure_exists f_in;
+ Vio_checking.check_vio (n,f_in) && acc)
true (List.rev copts.vio_tasks) in
if not rc then fatal_error Pp.(str "VIO Task Check failed")
(* vio files *)
let schedule_vio copts =
+ let l =
+ List.map (fun f -> let f_in = ensure ".vio" f f in ensure_exists f_in; f_in)
+ copts.vio_files in
if copts.vio_checking then
- Vio_checking.schedule_vio_checking copts.vio_files_j copts.vio_files
+ Vio_checking.schedule_vio_checking copts.vio_files_j l
else
- Vio_checking.schedule_vio_compilation copts.vio_files_j copts.vio_files
+ Vio_checking.schedule_vio_compilation copts.vio_files_j l
let do_vio opts copts =
(* We must initialize the loadpath here as the vio scheduling
process happens outside of the STM *)
if copts.vio_files <> [] || copts.vio_tasks <> [] then
let iload_path = build_load_path opts in
- List.iter Mltop.add_coq_path iload_path;
+ List.iter Loadpath.add_coq_path iload_path;
(* Vio compile pass *)
if copts.vio_files <> [] then schedule_vio copts;
diff --git a/toplevel/coqargs.ml b/toplevel/coqargs.ml
index ec43dbb1d7..4ef31c73b7 100644
--- a/toplevel/coqargs.ml
+++ b/toplevel/coqargs.ml
@@ -46,8 +46,8 @@ type t = {
load_rcfile : bool;
rcfile : string option;
- ml_includes : Mltop.coq_path list;
- vo_includes : Mltop.coq_path list;
+ ml_includes : Loadpath.coq_path list;
+ vo_includes : Loadpath.coq_path list;
vo_requires : (string * string option * bool option) list;
(* None = No Import; Some false = Import; Some true = Export *)
@@ -147,10 +147,10 @@ let default = {
(* Functional arguments *)
(******************************************************************************)
let add_ml_include opts s =
- Mltop.{ opts with ml_includes = {recursive = false; path_spec = MlPath s} :: opts.ml_includes }
+ Loadpath.{ opts with ml_includes = {recursive = false; path_spec = MlPath s} :: opts.ml_includes }
let add_vo_include opts unix_path coq_path implicit =
- let open Mltop in
+ let open Loadpath in
let coq_path = Libnames.dirpath_of_string coq_path in
{ opts with vo_includes = {
recursive = true;
@@ -273,7 +273,7 @@ let usage help =
end;
let lp = Coqinit.toplevel_init_load_path () in
(* Necessary for finding the toplevels below *)
- List.iter Mltop.add_coq_path lp;
+ List.iter Loadpath.add_coq_path lp;
help ()
(* Main parsing routine *)
diff --git a/toplevel/coqargs.mli b/toplevel/coqargs.mli
index d7f9819bee..015789c1f3 100644
--- a/toplevel/coqargs.mli
+++ b/toplevel/coqargs.mli
@@ -22,8 +22,8 @@ type t = {
load_rcfile : bool;
rcfile : string option;
- ml_includes : Mltop.coq_path list;
- vo_includes : Mltop.coq_path list;
+ ml_includes : Loadpath.coq_path list;
+ vo_includes : Loadpath.coq_path list;
vo_requires : (string * string option * bool option) list;
toplevel_name : Stm.interactive_top;
@@ -69,4 +69,4 @@ val parse_args : help:(unit -> unit) -> init:t -> string list -> t * string list
val exitcode : t -> int
val require_libs : t -> (string * string option * bool option) list
-val build_load_path : t -> Mltop.coq_path list
+val build_load_path : t -> Loadpath.coq_path list
diff --git a/toplevel/coqcargs.ml b/toplevel/coqcargs.ml
index 7445619d26..2279ce5505 100644
--- a/toplevel/coqcargs.ml
+++ b/toplevel/coqcargs.ml
@@ -56,6 +56,13 @@ let error_missing_arg s =
prerr_endline "See -help for the syntax of supported options";
exit 1
+let check_compilation_output_name_consistency args =
+ match args.compilation_output_name, args.compile_list with
+ | Some _, _::_::_ ->
+ prerr_endline ("Error: option -o is not valid when more than one");
+ prerr_endline ("file have to be compiled")
+ | _ -> ()
+
let add_compile ?echo copts s =
(* make the file name explicit; needed not to break up Coq loadpath stuff. *)
let echo = Option.default copts.echo echo in
@@ -82,7 +89,22 @@ let set_vio_checking_j opts opt j =
prerr_endline "setting the J variable like in 'make vio2vo J=3'";
exit 1
-let get_task_list s = List.map int_of_string (Str.split (Str.regexp ",") s)
+let set_compilation_mode opts mode =
+ match opts.compilation_mode with
+ | BuildVo -> { opts with compilation_mode = mode }
+ | mode' when mode <> mode' ->
+ prerr_endline "Options -quick and -vio2vo are exclusive";
+ exit 1
+ | _ -> opts
+
+let get_task_list s =
+ List.map (fun s ->
+ try int_of_string s
+ with Failure _ ->
+ prerr_endline "Option -check-vio-tasks expects a comma-separated list";
+ prerr_endline "of integers followed by a list of files";
+ exit 1)
+ (Str.split (Str.regexp ",") s)
let is_not_dash_option = function
| Some f when String.length f > 0 && f.[0] <> '-' -> true
@@ -138,7 +160,7 @@ let parse arglist : t =
| "-o" ->
{ oval with compilation_output_name = Some (next ()) }
| "-quick" ->
- { oval with compilation_mode = BuildVio }
+ set_compilation_mode oval BuildVio
| "-check-vio-tasks" ->
let tno = get_task_list (next ()) in
let tfile = next () in
@@ -157,7 +179,7 @@ let parse arglist : t =
| "-vio2vo" ->
let oval = add_compile ~echo:false oval (next ()) in
- { oval with compilation_mode = Vio2Vo }
+ set_compilation_mode oval Vio2Vo
| "-outputstate" ->
set_outputstate oval (next ())
@@ -170,5 +192,7 @@ let parse arglist : t =
in
try
let opts, extra = parse default in
- List.fold_left add_compile opts extra
+ let args = List.fold_left add_compile opts extra in
+ check_compilation_output_name_consistency args;
+ args
with any -> fatal_error any
diff --git a/toplevel/coqinit.ml b/toplevel/coqinit.ml
index 74a089510e..cbe353004e 100644
--- a/toplevel/coqinit.ml
+++ b/toplevel/coqinit.ml
@@ -53,25 +53,25 @@ let load_rcfile ~rcfile ~state =
(* Recursively puts dir in the LoadPath if -nois was not passed *)
let build_stdlib_path ~load_init ~unix_path ~coq_path ~with_ml =
- let open Mltop in
+ let open Loadpath in
let add_ml = if with_ml then AddRecML else AddNoML in
{ recursive = true;
path_spec = VoPath { unix_path; coq_path ; has_ml = add_ml; implicit = load_init }
}
let build_userlib_path ~unix_path =
- let open Mltop in
+ let open Loadpath in
{ recursive = true;
path_spec = VoPath {
unix_path;
coq_path = Libnames.default_root_prefix;
- has_ml = Mltop.AddRecML;
+ has_ml = AddRecML;
implicit = false;
}
}
let ml_path_if c p =
- let open Mltop in
+ let open Loadpath in
let f x = { recursive = false; path_spec = MlPath x } in
if c then List.map f p else []
@@ -85,7 +85,7 @@ let toplevel_init_load_path () =
(* LoadPath for Coq user libraries *)
let libs_init_load_path ~load_init =
- let open Mltop in
+ let open Loadpath in
let coqlib = Envars.coqlib () in
let user_contrib = coqlib/"user-contrib" in
let xdg_dirs = Envars.xdg_dirs ~warn:(fun x -> Feedback.msg_warning (str x)) in
@@ -115,10 +115,10 @@ let libs_init_load_path ~load_init =
(* Initialises the Ocaml toplevel before launching it, so that it can
find the "include" file in the *source* directory *)
let init_ocaml_path () =
- let open Mltop in
+ let open Loadpath in
let lp s = { recursive = false; path_spec = MlPath s } in
let add_subdir dl =
- Mltop.add_coq_path (lp (List.fold_left (/) Envars.coqroot [dl]))
+ Loadpath.add_coq_path (lp (List.fold_left (/) Envars.coqroot [dl]))
in
- Mltop.add_coq_path (lp (Envars.coqlib ()));
+ Loadpath.add_coq_path (lp (Envars.coqlib ()));
List.iter add_subdir Coq_config.all_src_dirs
diff --git a/toplevel/coqinit.mli b/toplevel/coqinit.mli
index c891e736b4..04ec77a025 100644
--- a/toplevel/coqinit.mli
+++ b/toplevel/coqinit.mli
@@ -17,7 +17,7 @@ val load_rcfile : rcfile:(string option) -> state:Vernac.State.t -> Vernac.State
val init_ocaml_path : unit -> unit
(* LoadPath for toploop toplevels *)
-val toplevel_init_load_path : unit -> Mltop.coq_path list
+val toplevel_init_load_path : unit -> Loadpath.coq_path list
(* LoadPath for Coq user libraries *)
-val libs_init_load_path : load_init:bool -> Mltop.coq_path list
+val libs_init_load_path : load_init:bool -> Loadpath.coq_path list
diff --git a/toplevel/coqtop.ml b/toplevel/coqtop.ml
index b769405cf6..460c2f126e 100644
--- a/toplevel/coqtop.ml
+++ b/toplevel/coqtop.ml
@@ -222,7 +222,7 @@ let init_toplevel ~help ~init custom_init arglist =
exit 0;
end;
let top_lp = Coqinit.toplevel_init_load_path () in
- List.iter Mltop.add_coq_path top_lp;
+ List.iter Loadpath.add_coq_path top_lp;
let opts, extras = custom_init ~opts extras in
Mltop.init_known_plugins ();
diff --git a/toplevel/usage.ml b/toplevel/usage.ml
index da2094653b..29948d50b2 100644
--- a/toplevel/usage.ml
+++ b/toplevel/usage.ml
@@ -42,12 +42,12 @@ let print_usage_common co command =
\n\
\n -load-ml-object f load ML object file f\
\n -load-ml-source f load ML file f\
-\n -load-vernac-source f load Coq file f.v (Load f.)\
+\n -load-vernac-source f load Coq file f.v (Load \"f\".)\
\n -l f (idem)\
-\n -load-vernac-source-verbose f load Coq file f.v (Load Verbose f.)\
-\n -lv f (idem)\
-\n -load-vernac-object f load Coq object file f.vo\
\n -require path load Coq library path and import it (Require Import path.)\
+\n -load-vernac-source-verbose f load Coq file f.v (Load Verbose \"f\".)\
+\n -lv f (idem)\
+\n -load-vernac-object path load Coq library path (Require path)\
\n\
\n -where print Coq's standard library location and exit\
\n -config, --config print Coq's configuration information and exit\
@@ -74,9 +74,9 @@ let print_usage_common co command =
\n -indices-matter levels of indices (and nonuniform parameters) contribute to the level of inductives\
\n -type-in-type disable universe consistency checking\
\n -mangle-names x mangle auto-generated names using prefix x\
-\n -set \"Foo Bar\" enable Foo Bar (as Set Foo Bar. in a file)\
-\n -set \"Foo Bar=value\" set Foo Bar to value (value is interpreted according to Foo Bar's type)\
-\n -unset \"Foo Bar\" disable Foo Bar (as Unset Foo Bar. in a file)\
+\n -set \"Foo Bar\" enable Foo Bar (as Set Foo Bar. in a file)\
+\n -set \"Foo Bar=value\" set Foo Bar to value (value is interpreted according to Foo Bar's type)\
+\n -unset \"Foo Bar\" disable Foo Bar (as Unset Foo Bar. in a file)\
\n -time display the time taken by each command\
\n -profile-ltac display the time taken by each (sub)tactic\
\n -m, --memory display total heap size at program exit\
@@ -107,7 +107,7 @@ coqtop specific options:\
exit 1
let print_usage_coqc () =
- print_usage_common stderr "Usage: coqc <options> <Coq options> file...";
+ print_usage_common stderr "Usage: coqc <options> <Coq options> file...\n\n";
output_string stderr "\n\
coqc specific options:\
\n\
diff --git a/user-contrib/Ltac2/Constr.v b/user-contrib/Ltac2/Constr.v
index 1701bf4365..40946a8d56 100644
--- a/user-contrib/Ltac2/Constr.v
+++ b/user-contrib/Ltac2/Constr.v
@@ -48,7 +48,7 @@ Ltac2 @ external make : kind -> constr := "ltac2" "constr_make".
Ltac2 @ external check : constr -> constr result := "ltac2" "constr_check".
(** Checks that a constr generated by unsafe means is indeed safe in the
current environment, and returns it, or the error otherwise. Panics if
- not focussed. *)
+ not focused. *)
Ltac2 @ external substnl : constr list -> int -> constr -> constr := "ltac2" "constr_substnl".
(** [substnl [r₁;...;rₙ] k c] substitutes in parallel [Rel(k+1); ...; Rel(k+n)] with
@@ -68,6 +68,6 @@ Ltac2 @ external constructor : inductive -> int -> constructor := "ltac2" "const
End Unsafe.
Ltac2 @ external in_context : ident -> constr -> (unit -> unit) -> constr := "ltac2" "constr_in_context".
-(** On a focussed goal [Γ ⊢ A], [in_context id c tac] evaluates [tac] in a
- focussed goal [Γ, id : c ⊢ ?X] and returns [fun (id : c) => t] where [t] is
+(** On a focused goal [Γ ⊢ A], [in_context id c tac] evaluates [tac] in a
+ focused goal [Γ, id : c ⊢ ?X] and returns [fun (id : c) => t] where [t] is
the proof built by the tactic. *)
diff --git a/user-contrib/Ltac2/Pattern.v b/user-contrib/Ltac2/Pattern.v
index 8d1fb0cd8a..5e8eef526e 100644
--- a/user-contrib/Ltac2/Pattern.v
+++ b/user-contrib/Ltac2/Pattern.v
@@ -25,7 +25,7 @@ Ltac2 @ external empty_context : unit -> context :=
Ltac2 @ external matches : t -> constr -> (ident * constr) list :=
"ltac2" "pattern_matches".
(** If the term matches the pattern, returns the bound variables. If it doesn't,
- fail with [Match_failure]. Panics if not focussed. *)
+ fail with [Match_failure]. Panics if not focused. *)
Ltac2 @ external matches_subterm : t -> constr -> context * ((ident * constr) list) :=
"ltac2" "pattern_matches_subterm".
diff --git a/user-contrib/Ltac2/tac2expr.mli b/user-contrib/Ltac2/tac2expr.mli
index 1069d0bfa3..2e7dfc42db 100644
--- a/user-contrib/Ltac2/tac2expr.mli
+++ b/user-contrib/Ltac2/tac2expr.mli
@@ -173,7 +173,7 @@ type strexpr =
(** {5 Dynamic semantics} *)
-(** Values are represented in a way similar to OCaml, i.e. they constrast
+(** Values are represented in a way similar to OCaml, i.e. they contrast
immediate integers (integers, constructors without arguments) and structured
blocks (tuples, arrays, constructors with arguments), as well as a few other
base cases, namely closures, strings, named constructors, and dynamic type
diff --git a/user-contrib/Ltac2/tac2intern.mli b/user-contrib/Ltac2/tac2intern.mli
index d646b5cda5..829570a354 100644
--- a/user-contrib/Ltac2/tac2intern.mli
+++ b/user-contrib/Ltac2/tac2intern.mli
@@ -20,7 +20,7 @@ val is_value : glb_tacexpr -> bool
val check_unit : ?loc:Loc.t -> type_scheme -> unit
val check_subtype : type_scheme -> type_scheme -> bool
-(** [check_subtype t1 t2] returns [true] iff all values of intances of type [t1]
+(** [check_subtype t1 t2] returns [true] iff all values of instances of type [t1]
also have type [t2]. *)
val subst_type : substitution -> 'a glb_typexpr -> 'a glb_typexpr
diff --git a/user-contrib/Ltac2/tac2match.ml b/user-contrib/Ltac2/tac2match.ml
index 058d02adde..354a578cb3 100644
--- a/user-contrib/Ltac2/tac2match.ml
+++ b/user-contrib/Ltac2/tac2match.ml
@@ -88,7 +88,7 @@ module PatternMatching (E:StaticEnvironment) = struct
(** To focus on the algorithmic portion of pattern-matching, the
bookkeeping is relegated to a monad: the composition of the
- bactracking monad of {!IStream.t} with a "writer" effect. *)
+ backtracking monad of {!IStream.t} with a "writer" effect. *)
(* spiwack: as we don't benefit from the various stream optimisations
of Haskell, it may be costly to give the monad in direct style such as
here. We may want to use some continuation passing style. *)
diff --git a/vernac/classes.ml b/vernac/classes.ml
index 05a75ab435..ea66234993 100644
--- a/vernac/classes.ml
+++ b/vernac/classes.ml
@@ -318,6 +318,7 @@ let instance_hook k info global imps ?hook cst =
(match hook with Some h -> h cst | None -> ())
let declare_instance_constant k info global imps ?hook id decl poly sigma term termtype =
+ (* XXX: Duplication of the declare_constant path *)
let kind = IsDefinition Instance in
let sigma =
let levels = Univ.LSet.union (CVars.universes_of_constr termtype)
@@ -339,14 +340,9 @@ let do_declare_instance env sigma ~global ~poly k u ctx ctx' pri decl imps subst
in
let (_, ty_constr) = instance_constructor (k,u) subst in
let termtype = it_mkProd_or_LetIn ty_constr (ctx' @ ctx) in
- let sigma = Evd.minimize_universes sigma in
- Pretyping.check_evars env (Evd.from_env env) sigma termtype;
- let univs = Evd.check_univ_decl ~poly sigma decl in
- let termtype = to_constr sigma termtype in
+ let sigma, entry = DeclareDef.prepare_parameter ~allow_evars:false ~poly sigma decl termtype in
let cst = Declare.declare_constant ~internal:Declare.InternalTacticRequest id
- (ParameterEntry
- (None,(termtype,univs),None), Decl_kinds.IsAssumption Decl_kinds.Logical)
- in
+ (ParameterEntry entry, Decl_kinds.IsAssumption Decl_kinds.Logical) in
Declare.declare_univ_binders (ConstRef cst) (Evd.universe_binders sigma);
instance_hook k pri global imps (ConstRef cst)
@@ -498,21 +494,8 @@ let do_instance ~pstate env env' sigma ?hook ~tac ~global ~poly ~program_mode ct
else CErrors.user_err Pp.(str "Unsolved obligations remaining.") in
id, pstate
-let interp_instance_context ~program_mode env ctx ?(generalize=false) pl bk cl =
+let interp_instance_context ~program_mode env ctx ?(generalize=false) pl tclass =
let sigma, decl = Constrexpr_ops.interp_univ_decl_opt env pl in
- let tclass, ids =
- match bk with
- | Decl_kinds.Implicit ->
- Implicit_quantifiers.implicit_application Id.Set.empty ~allow_partial:false
- (fun avoid (clname, _) ->
- match clname with
- | Some cl ->
- let t = CAst.make @@ CHole (None, Namegen.IntroAnonymous, None) in
- t, avoid
- | None -> failwith ("new instance: under-applied typeclass"))
- cl
- | Explicit -> cl, Id.Set.empty
- in
let tclass =
if generalize then CAst.make @@ CGeneralization (Implicit, Some AbsPi, tclass)
else tclass
@@ -539,14 +522,13 @@ let interp_instance_context ~program_mode env ctx ?(generalize=false) pl bk cl =
let sigma = resolve_typeclasses ~filter:Typeclasses.all_evars ~fail:true env sigma in
sigma, cl, u, c', ctx', ctx, imps, args, decl
-
let new_instance ~pstate ?(global=false) ~program_mode
- poly ctx (instid, bk, cl) props
+ poly instid ctx cl props
?(generalize=true) ?(tac:unit Proofview.tactic option) ?hook pri =
let env = Global.env() in
let ({CAst.loc;v=instid}, pl) = instid in
let sigma, k, u, cty, ctx', ctx, imps, subst, decl =
- interp_instance_context ~program_mode env ~generalize ctx pl bk cl
+ interp_instance_context ~program_mode env ~generalize ctx pl cl
in
let id =
match instid with
@@ -559,10 +541,10 @@ let new_instance ~pstate ?(global=false) ~program_mode
do_instance ~pstate env env' sigma ?hook ~tac ~global ~poly ~program_mode
cty k u ctx ctx' pri decl imps subst id props
-let declare_new_instance ?(global=false) ~program_mode poly ctx (instid, bk, cl) pri =
+let declare_new_instance ?(global=false) ~program_mode poly instid ctx cl pri =
let env = Global.env() in
let ({CAst.loc;v=instid}, pl) = instid in
let sigma, k, u, cty, ctx', ctx, imps, subst, decl =
- interp_instance_context ~program_mode env ctx pl bk cl
+ interp_instance_context ~program_mode env ctx pl cl
in
do_declare_instance env sigma ~global ~poly k u ctx ctx' pri decl imps subst instid
diff --git a/vernac/classes.mli b/vernac/classes.mli
index 57bb9ce312..8d5f3e3a06 100644
--- a/vernac/classes.mli
+++ b/vernac/classes.mli
@@ -46,28 +46,29 @@ val declare_instance_constant :
unit
val new_instance :
- pstate:Proof_global.t option ->
- ?global:bool (** Not global by default. *) ->
- program_mode:bool ->
- Decl_kinds.polymorphic ->
- local_binder_expr list ->
- Vernacexpr.typeclass_constraint ->
- (bool * constr_expr) option ->
- ?generalize:bool ->
- ?tac:unit Proofview.tactic ->
- ?hook:(GlobRef.t -> unit) ->
- Hints.hint_info_expr ->
- (* May open a proof *)
- Id.t * Proof_global.t option
-
-val declare_new_instance :
- ?global:bool (** Not global by default. *) ->
- program_mode:bool ->
- Decl_kinds.polymorphic ->
- local_binder_expr list ->
- ident_decl * Decl_kinds.binding_kind * constr_expr ->
- Hints.hint_info_expr ->
- unit
+ pstate:Proof_global.t option
+ -> ?global:bool (** Not global by default. *)
+ -> program_mode:bool
+ -> Decl_kinds.polymorphic
+ -> name_decl
+ -> local_binder_expr list
+ -> constr_expr
+ -> (bool * constr_expr) option
+ -> ?generalize:bool
+ -> ?tac:unit Proofview.tactic
+ -> ?hook:(GlobRef.t -> unit)
+ -> Hints.hint_info_expr
+ -> Id.t * Proof_global.t option (* May open a proof *)
+
+val declare_new_instance
+ : ?global:bool (** Not global by default. *)
+ -> program_mode:bool
+ -> Decl_kinds.polymorphic
+ -> ident_decl
+ -> local_binder_expr list
+ -> constr_expr
+ -> Hints.hint_info_expr
+ -> unit
(** {6 Low level interface used by Add Morphism, do not use } *)
val mk_instance : typeclass -> hint_info -> bool -> GlobRef.t -> instance
diff --git a/vernac/comAssumption.ml b/vernac/comAssumption.ml
index 3406b6276f..635751bb24 100644
--- a/vernac/comAssumption.ml
+++ b/vernac/comAssumption.ml
@@ -43,7 +43,7 @@ let should_axiom_into_instance = function
true
| Global | Local -> !axiom_into_instance
-let declare_assumption ~pstate is_coe (local,p,kind) (c,ctx) pl imps impl nl {CAst.v=ident} =
+let declare_assumption is_coe (local,p,kind) (c,ctx) pl imps impl nl {CAst.v=ident} =
match local with
| Discharge when Lib.sections_are_opened () ->
let ctx = match ctx with
@@ -53,11 +53,6 @@ match local with
let decl = (Lib.cwd(), SectionLocalAssum ((c,ctx),p,impl), IsAssumption kind) in
let _ = declare_variable ident decl in
let () = assumption_message ident in
- let () =
- if not !Flags.quiet && Option.has_some pstate then
- Feedback.msg_info Pp.(str"Variable" ++ spc () ++ Id.print ident ++
- strbrk " is not visible from current goals")
- in
let r = VarRef ident in
let () = maybe_declare_manual_implicits true r imps in
let env = Global.env () in
@@ -101,11 +96,11 @@ let next_uctx =
| Polymorphic_entry _ as uctx -> uctx
| Monomorphic_entry _ -> empty_uctx
-let declare_assumptions ~pstate idl is_coe k (c,uctx) pl imps nl =
+let declare_assumptions idl is_coe k (c,uctx) pl imps nl =
let refs, status, _ =
List.fold_left (fun (refs,status,uctx) id ->
let ref',u',status' =
- declare_assumption ~pstate is_coe k (c,uctx) pl imps false nl id in
+ declare_assumption is_coe k (c,uctx) pl imps false nl id in
(ref',u')::refs, status' && status, next_uctx uctx)
([],true,uctx) idl
in
@@ -137,7 +132,7 @@ let process_assumptions_udecls kind l =
in
udecl, List.map (fun (coe, (idl, c)) -> coe, (List.map fst idl, c)) l
-let do_assumptions ~pstate ~program_mode kind nl l =
+let do_assumptions ~program_mode kind nl l =
let open Context.Named.Declaration in
let env = Global.env () in
let udecl, l = process_assumptions_udecls kind l in
@@ -173,12 +168,17 @@ let do_assumptions ~pstate ~program_mode kind nl l =
uvars, (coe,t,imps))
Univ.LSet.empty l
in
+ (* XXX: Using `DeclareDef.prepare_parameter` here directly is not
+ possible as we indeed declare several parameters; however,
+ restrict_universe_context should be called in a centralized place
+ IMO, thus I think we should adapt `prepare_parameter` to handle
+ this case too. *)
let sigma = Evd.restrict_universe_context sigma uvars in
let uctx = Evd.check_univ_decl ~poly:(pi2 kind) sigma udecl in
let ubinders = Evd.universe_binders sigma in
pi2 (List.fold_left (fun (subst,status,uctx) ((is_coe,idl),t,imps) ->
let t = replace_vars subst t in
- let refs, status' = declare_assumptions ~pstate idl is_coe kind (t,uctx) ubinders imps nl in
+ let refs, status' = declare_assumptions idl is_coe kind (t,uctx) ubinders imps nl in
let subst' = List.map2
(fun {CAst.v=id} (c,u) -> (id, Constr.mkRef (c,u)))
idl refs
@@ -226,7 +226,7 @@ let named_of_rel_context l =
l ([], [])
in ctx
-let context ~pstate poly l =
+let context poly l =
let env = Global.env() in
let sigma = Evd.from_env env in
let sigma, (_, ((env', fullctx), impls)) = interp_context_evars ~program_mode:false env sigma l in
@@ -291,12 +291,12 @@ let context ~pstate poly l =
let decl = (Discharge, poly, Definitional) in
let nstatus = match b with
| None ->
- pi3 (declare_assumption ~pstate false decl (t, univs) UnivNames.empty_binders [] impl
+ pi3 (declare_assumption false decl (t, univs) UnivNames.empty_binders [] impl
Declaremods.NoInline (CAst.make id))
| Some b ->
let decl = (Discharge, poly, Definition) in
let entry = Declare.definition_entry ~univs ~types:t b in
- let _gr = DeclareDef.declare_definition ~ontop:pstate id decl entry UnivNames.empty_binders [] in
+ let _gr = DeclareDef.declare_definition id decl entry UnivNames.empty_binders [] in
Lib.sections_are_opened () || Lib.is_modtype_strict ()
in
status && nstatus
diff --git a/vernac/comAssumption.mli b/vernac/comAssumption.mli
index 7c64317b70..8f37bc0ba4 100644
--- a/vernac/comAssumption.mli
+++ b/vernac/comAssumption.mli
@@ -16,8 +16,7 @@ open Decl_kinds
(** {6 Parameters/Assumptions} *)
val do_assumptions
- : pstate:Proof_global.t option
- -> program_mode:bool
+ : program_mode:bool
-> locality * polymorphic * assumption_object_kind
-> Declaremods.inline
-> (ident_decl list * constr_expr) with_coercion list
@@ -26,8 +25,7 @@ val do_assumptions
(** returns [false] if the assumption is neither local to a section,
nor in a module type and meant to be instantiated. *)
val declare_assumption
- : pstate:Proof_global.t option
- -> coercion_flag
+ : coercion_flag
-> assumption_kind
-> Constr.types Entries.in_universes_entry
-> UnivNames.universe_binders
@@ -42,8 +40,7 @@ val declare_assumption
(** returns [false] if, for lack of section, it declares an assumption
(unless in a module type). *)
val context
- : pstate:Proof_global.t option
- -> Decl_kinds.polymorphic
+ : Decl_kinds.polymorphic
-> local_binder_expr list
-> bool
diff --git a/vernac/comDefinition.ml b/vernac/comDefinition.ml
index d2c986fe5c..4cae4b8a74 100644
--- a/vernac/comDefinition.ml
+++ b/vernac/comDefinition.ml
@@ -79,7 +79,7 @@ let check_definition ~program_mode (ce, evd, _, imps) =
check_evars_are_solved ~program_mode env evd;
ce
-let do_definition ~ontop ~program_mode ?hook ident k univdecl bl red_option c ctypopt =
+let do_definition ~program_mode ?hook ident k univdecl bl red_option c ctypopt =
let (ce, evd, univdecl, imps as def) =
interp_definition ~program_mode univdecl bl (pi2 k) red_option c ctypopt
in
@@ -104,4 +104,4 @@ let do_definition ~ontop ~program_mode ?hook ident k univdecl bl red_option c ct
let ce = check_definition ~program_mode def in
let uctx = Evd.evar_universe_context evd in
let hook_data = Option.map (fun hook -> hook, uctx, []) hook in
- ignore(DeclareDef.declare_definition ~ontop ident k ?hook_data ce (Evd.universe_binders evd) imps)
+ ignore(DeclareDef.declare_definition ident k ?hook_data ce (Evd.universe_binders evd) imps)
diff --git a/vernac/comDefinition.mli b/vernac/comDefinition.mli
index 12853d83e0..fa4860b079 100644
--- a/vernac/comDefinition.mli
+++ b/vernac/comDefinition.mli
@@ -17,8 +17,7 @@ open Constrexpr
(** {6 Definitions/Let} *)
val do_definition
- : ontop:Proof_global.t option
- -> program_mode:bool
+ : program_mode:bool
-> ?hook:Lemmas.declaration_hook
-> Id.t
-> definition_kind
diff --git a/vernac/comFixpoint.ml b/vernac/comFixpoint.ml
index 1912646ffd..00f19f545c 100644
--- a/vernac/comFixpoint.ml
+++ b/vernac/comFixpoint.ml
@@ -284,7 +284,7 @@ let declare_fixpoint ~ontop local poly ((fixnames,fixrs,fixdefs,fixtypes),pl,ctx
let ctx = Evd.check_univ_decl ~poly evd pl in
let pl = Evd.universe_binders evd in
let fixdecls = List.map Safe_typing.mk_pure_proof fixdecls in
- ignore (List.map4 (DeclareDef.declare_fix ~ontop (local, poly, Fixpoint) pl ctx)
+ ignore (List.map4 (DeclareDef.declare_fix (local, poly, Fixpoint) pl ctx)
fixnames fixdecls fixtypes fiximps);
(* Declare the recursive definitions *)
fixpoint_message (Some indexes) fixnames;
@@ -319,7 +319,7 @@ let declare_cofixpoint ~ontop local poly ((fixnames,fixrs,fixdefs,fixtypes),pl,c
let evd = Evd.restrict_universe_context evd vars in
let ctx = Evd.check_univ_decl ~poly evd pl in
let pl = Evd.universe_binders evd in
- ignore (List.map4 (DeclareDef.declare_fix ~ontop (local, poly, CoFixpoint) pl ctx)
+ ignore (List.map4 (DeclareDef.declare_fix (local, poly, CoFixpoint) pl ctx)
fixnames fixdecls fixtypes fiximps);
(* Declare the recursive definitions *)
cofixpoint_message fixnames;
diff --git a/vernac/declareDef.ml b/vernac/declareDef.ml
index 052832244b..bdda3314ca 100644
--- a/vernac/declareDef.ml
+++ b/vernac/declareDef.ml
@@ -14,12 +14,6 @@ open Entries
open Globnames
open Impargs
-let warn_definition_not_visible =
- CWarnings.create ~name:"definition-not-visible" ~category:"implicits"
- Pp.(fun ident ->
- strbrk "Section definition " ++
- Names.Id.print ident ++ strbrk " is not visible from current goals")
-
let warn_local_declaration =
CWarnings.create ~name:"local-declaration" ~category:"scope"
Pp.(fun (id,kind) ->
@@ -33,12 +27,11 @@ let get_locality id ~kind = function
| Local -> true
| Global -> false
-let declare_definition ~ontop ident (local, p, k) ?hook_data ce pl imps =
+let declare_definition ident (local, p, k) ?hook_data ce pl imps =
let fix_exn = Future.fix_exn_of ce.const_entry_body in
let gr = match local with
| Discharge when Lib.sections_are_opened () ->
let _ = declare_variable ident (Lib.cwd(), SectionLocalDef ce, IsDefinition k) in
- let () = if Option.has_some ontop then warn_definition_not_visible ident in
VarRef ident
| Discharge | Local | Global ->
let local = get_locality ident ~kind:"definition" local in
@@ -57,9 +50,9 @@ let declare_definition ~ontop ident (local, p, k) ?hook_data ce pl imps =
end;
gr
-let declare_fix ~ontop ?(opaque = false) ?hook_data (_,poly,_ as kind) pl univs f ((def,_),eff) t imps =
+let declare_fix ?(opaque = false) ?hook_data (_,poly,_ as kind) pl univs f ((def,_),eff) t imps =
let ce = definition_entry ~opaque ~types:t ~univs ~eff def in
- declare_definition ~ontop f kind ?hook_data ce pl imps
+ declare_definition f kind ?hook_data ce pl imps
let check_definition_evars ~allow_evars sigma =
let env = Global.env () in
diff --git a/vernac/declareDef.mli b/vernac/declareDef.mli
index 8e4f4bf7fb..c4500d0a6b 100644
--- a/vernac/declareDef.mli
+++ b/vernac/declareDef.mli
@@ -14,8 +14,7 @@ open Decl_kinds
val get_locality : Id.t -> kind:string -> Decl_kinds.locality -> bool
val declare_definition
- : ontop:Proof_global.t option
- -> Id.t
+ : Id.t
-> definition_kind
-> ?hook_data:(Lemmas.declaration_hook * UState.t * (Id.t * Constr.t) list)
-> Safe_typing.private_constants Entries.definition_entry
@@ -24,8 +23,7 @@ val declare_definition
-> GlobRef.t
val declare_fix
- : ontop:Proof_global.t option
- -> ?opaque:bool
+ : ?opaque:bool
-> ?hook_data:(Lemmas.declaration_hook * UState.t * (Id.t * Constr.t) list)
-> definition_kind
-> UnivNames.universe_binders
diff --git a/vernac/g_vernac.mlg b/vernac/g_vernac.mlg
index 6438b48e32..b2db64f74c 100644
--- a/vernac/g_vernac.mlg
+++ b/vernac/g_vernac.mlg
@@ -723,11 +723,11 @@ GRAMMAR EXTEND Gram
{ VernacContext (List.flatten c) }
| IDENT "Instance"; namesup = instance_name; ":";
- expl = [ "!" -> { Decl_kinds.Implicit } | -> { Decl_kinds.Explicit } ] ; t = operconstr LEVEL "200";
+ t = operconstr LEVEL "200";
info = hint_info ;
props = [ ":="; "{"; r = record_declaration; "}" -> { Some (true,r) } |
":="; c = lconstr -> { Some (false,c) } | -> { None } ] ->
- { VernacInstance (snd namesup,(fst namesup,expl,t),props,info) }
+ { VernacInstance (fst namesup,snd namesup,t,props,info) }
| IDENT "Existing"; IDENT "Instance"; id = global;
info = hint_info ->
@@ -888,9 +888,9 @@ GRAMMAR EXTEND Gram
(* Hack! Should be in grammar_ext, but camlp5 factorizes badly *)
| IDENT "Declare"; IDENT "Instance"; id = ident_decl; bl = binders; ":";
- expl = [ "!" -> { Decl_kinds.Implicit } | -> { Decl_kinds.Explicit } ] ; t = operconstr LEVEL "200";
+ t = operconstr LEVEL "200";
info = hint_info ->
- { VernacDeclareInstance (bl, (id, expl, t), info) }
+ { VernacDeclareInstance (id, bl, t, info) }
(* Should be in syntax, but camlp5 would not factorize *)
| IDENT "Declare"; IDENT "Scope"; sc = IDENT ->
diff --git a/vernac/loadpath.ml b/vernac/loadpath.ml
new file mode 100644
index 0000000000..1bb44d0ef1
--- /dev/null
+++ b/vernac/loadpath.ml
@@ -0,0 +1,273 @@
+(************************************************************************)
+(* * The Coq Proof Assistant / The Coq Development Team *)
+(* v * INRIA, CNRS and contributors - Copyright 1999-2018 *)
+(* <O___,, * (see CREDITS file for the list of authors) *)
+(* \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) *)
+(************************************************************************)
+
+open Util
+module DP = Names.DirPath
+
+(** Load paths. Mapping from physical to logical paths. *)
+
+type t = {
+ path_physical : CUnix.physical_path;
+ path_logical : DP.t;
+ path_implicit : bool;
+}
+
+let load_paths = Summary.ref ([] : t list) ~name:"LOADPATHS"
+
+let logical p = p.path_logical
+let physical p = p.path_physical
+
+let pp p =
+ let dir = DP.print p.path_logical in
+ let path = Pp.str (CUnix.escaped_string_of_physical_path p.path_physical) in
+ Pp.(hov 2 (dir ++ spc () ++ path))
+
+let get_load_paths () = !load_paths
+
+let anomaly_too_many_paths path =
+ CErrors.anomaly Pp.(str "Several logical paths are associated to" ++ spc () ++ str path ++ str ".")
+
+let find_load_path phys_dir =
+ let phys_dir = CUnix.canonical_path_name phys_dir in
+ let filter p = String.equal p.path_physical phys_dir in
+ let paths = List.filter filter !load_paths in
+ match paths with
+ | [] -> raise Not_found
+ | [p] -> p
+ | _ -> anomaly_too_many_paths phys_dir
+
+let remove_load_path dir =
+ let filter p = not (String.equal p.path_physical dir) in
+ load_paths := List.filter filter !load_paths
+
+let warn_overriding_logical_loadpath =
+ CWarnings.create ~name:"overriding-logical-loadpath" ~category:"loadpath"
+ (fun (phys_path, old_path, coq_path) ->
+ Pp.(seq [str phys_path; strbrk " was previously bound to "
+ ; DP.print old_path; strbrk "; it is remapped to "
+ ; DP.print coq_path]))
+
+let add_load_path phys_path coq_path ~implicit =
+ let phys_path = CUnix.canonical_path_name phys_path in
+ let filter p = String.equal p.path_physical phys_path in
+ let binding = {
+ path_logical = coq_path;
+ path_physical = phys_path;
+ path_implicit = implicit;
+ } in
+ match List.filter filter !load_paths with
+ | [] ->
+ load_paths := binding :: !load_paths
+ | [{ path_logical = old_path; path_implicit = old_implicit }] ->
+ let replace =
+ if DP.equal coq_path old_path then
+ implicit <> old_implicit
+ else
+ let () =
+ (* Do not warn when overriding the default "-I ." path *)
+ if not (DP.equal old_path Libnames.default_root_prefix) then
+ warn_overriding_logical_loadpath (phys_path, old_path, coq_path)
+ in
+ true in
+ if replace then
+ begin
+ remove_load_path phys_path;
+ load_paths := binding :: !load_paths;
+ end
+ | _ -> anomaly_too_many_paths phys_path
+
+let filter_path f =
+ let rec aux = function
+ | [] -> []
+ | p :: l ->
+ if f p.path_logical then (p.path_physical, p.path_logical) :: aux l
+ else aux l
+ in
+ aux !load_paths
+
+let expand_path ?root dir =
+ let rec aux = function
+ | [] -> []
+ | { path_physical = ph; path_logical = lg; path_implicit = implicit } :: l ->
+ let success =
+ match root with
+ | None ->
+ if implicit then Libnames.is_dirpath_suffix_of dir lg
+ else DP.equal dir lg
+ | Some root ->
+ Libnames.(is_dirpath_prefix_of root lg &&
+ is_dirpath_suffix_of dir (drop_dirpath_prefix root lg)) in
+ if success then (ph, lg) :: aux l else aux l in
+ aux !load_paths
+
+let locate_file fname =
+ let paths = List.map physical !load_paths in
+ let _,longfname =
+ System.find_file_in_path ~warn:(not !Flags.quiet) paths fname in
+ longfname
+
+(************************************************************************)
+(*s Locate absolute or partially qualified library names in the path *)
+
+type library_location = LibLoaded | LibInPath
+type locate_error = LibUnmappedDir | LibNotFound
+type 'a locate_result = ('a, locate_error) result
+
+let warn_several_object_files =
+ CWarnings.create ~name:"several-object-files" ~category:"require"
+ Pp.(fun (vi, vo) ->
+ seq [ str "Loading"; spc (); str vi
+ ; strbrk " instead of "; str vo
+ ; strbrk " because it is more recent"
+ ])
+
+
+let select_vo_file ~warn loadpath base =
+ let find ext =
+ let loadpath = List.map fst loadpath in
+ try
+ let name = Names.Id.to_string base ^ ext in
+ let lpath, file =
+ System.where_in_path ~warn loadpath name in
+ Some (lpath, file)
+ with Not_found -> None in
+ match find ".vo", find ".vio" with
+ | None, None ->
+ Error LibNotFound
+ | Some res, None | None, Some res ->
+ Ok res
+ | Some (_, vo), Some (_, vi as resvi)
+ when Unix.((stat vo).st_mtime < (stat vi).st_mtime) ->
+ warn_several_object_files (vi, vo);
+ Ok resvi
+ | Some resvo, Some _ ->
+ Ok resvo
+
+let locate_absolute_library dir : CUnix.physical_path locate_result =
+ (* Search in loadpath *)
+ let pref, base = Libnames.split_dirpath dir in
+ let loadpath = filter_path (fun dir -> DP.equal dir pref) in
+ match loadpath with
+ | [] -> Error LibUnmappedDir
+ | _ ->
+ match select_vo_file ~warn:false loadpath base with
+ | Ok (_, file) -> Ok file
+ | Error fail -> Error fail
+
+let locate_qualified_library ?root ?(warn = true) qid :
+ (library_location * DP.t * CUnix.physical_path) locate_result =
+ (* Search library in loadpath *)
+ let dir, base = Libnames.repr_qualid qid in
+ let loadpath = expand_path ?root dir in
+ match loadpath with
+ | [] -> Error LibUnmappedDir
+ | _ ->
+ match select_vo_file ~warn loadpath base with
+ | Ok (lpath, file) ->
+ let dir = Libnames.add_dirpath_suffix
+ (CString.List.assoc lpath loadpath) base in
+ (* Look if loaded *)
+ if Library.library_is_loaded dir
+ then Ok (LibLoaded, dir, Library.library_full_filename dir)
+ (* Otherwise, look for it in the file system *)
+ else Ok (LibInPath, dir, file)
+ | Error fail -> Error fail
+
+let error_unmapped_dir qid =
+ let prefix, _ = Libnames.repr_qualid qid in
+ CErrors.user_err ~hdr:"load_absolute_library_from"
+ Pp.(seq [ str "Cannot load "; Libnames.pr_qualid qid; str ":"; spc ()
+ ; str "no physical path bound to"; spc ()
+ ; DP.print prefix; fnl ()
+ ])
+
+let error_lib_not_found qid =
+ CErrors.user_err ~hdr:"load_absolute_library_from"
+ Pp.(seq [ str "Cannot find library "; Libnames.pr_qualid qid; str" in loadpath"])
+
+let try_locate_absolute_library dir =
+ match locate_absolute_library dir with
+ | Ok res -> res
+ | Error LibUnmappedDir ->
+ error_unmapped_dir (Libnames.qualid_of_dirpath dir)
+ | Error LibNotFound ->
+ error_lib_not_found (Libnames.qualid_of_dirpath dir)
+
+(** { 5 Extending the load path } *)
+
+(* Adds a path to the Coq and ML paths *)
+type add_ml = AddNoML | AddTopML | AddRecML
+
+type vo_path_spec = {
+ unix_path : string; (* Filesystem path contaning vo/ml files *)
+ coq_path : DP.t; (* Coq prefix for the path *)
+ implicit : bool; (* [implicit = true] avoids having to qualify with [coq_path] *)
+ has_ml : add_ml; (* If [has_ml] is true, the directory will also be search for plugins *)
+}
+
+type coq_path_spec =
+ | VoPath of vo_path_spec
+ | MlPath of string
+
+type coq_path = {
+ path_spec: coq_path_spec;
+ recursive: bool;
+}
+
+let warn_cannot_open_path =
+ CWarnings.create ~name:"cannot-open-path" ~category:"filesystem"
+ (fun unix_path -> Pp.(str "Cannot open " ++ str unix_path))
+
+let warn_cannot_use_directory =
+ CWarnings.create ~name:"cannot-use-directory" ~category:"filesystem"
+ (fun d ->
+ Pp.(str "Directory " ++ str d ++
+ strbrk " cannot be used as a Coq identifier (skipped)"))
+
+let convert_string d =
+ try Names.Id.of_string d
+ with
+ | CErrors.UserError _ ->
+ let d = Unicode.escaped_if_non_utf8 d in
+ warn_cannot_use_directory d;
+ raise Exit
+
+let add_vo_path ~recursive lp =
+ let unix_path = lp.unix_path in
+ let implicit = lp.implicit in
+ if System.exists_dir unix_path then
+ let dirs = if recursive then System.all_subdirs ~unix_path else [] in
+ let prefix = DP.repr lp.coq_path in
+ let convert_dirs (lp, cp) =
+ try
+ let path = List.rev_map convert_string cp @ prefix in
+ Some (lp, DP.make path)
+ with Exit -> None
+ in
+ let dirs = List.map_filter convert_dirs dirs in
+ let add_ml_dir = Mltop.add_ml_dir ~recursive:false in
+ let () = match lp.has_ml with
+ | AddNoML -> ()
+ | AddTopML ->
+ Mltop.add_ml_dir ~recursive:false unix_path
+ | AddRecML ->
+ List.iter (fun (lp,_) -> add_ml_dir lp) dirs;
+ add_ml_dir unix_path in
+ let add (path, dir) = add_load_path path ~implicit dir in
+ let () = List.iter add dirs in
+ add_load_path unix_path ~implicit lp.coq_path
+ else
+ warn_cannot_open_path unix_path
+
+let add_coq_path { recursive; path_spec } = match path_spec with
+ | VoPath lp ->
+ add_vo_path ~recursive lp
+ | MlPath dir ->
+ Mltop.add_ml_dir ~recursive dir
diff --git a/library/loadpath.mli b/vernac/loadpath.mli
index 4044ca1127..d393fc35b5 100644
--- a/library/loadpath.mli
+++ b/vernac/loadpath.mli
@@ -20,19 +20,15 @@ open Names
type t
(** Type of loadpath bindings. *)
-val physical : t -> CUnix.physical_path
-(** Get the physical path (filesystem location) of a loadpath. *)
-
val logical : t -> DirPath.t
(** Get the logical path (Coq module hierarchy) of a loadpath. *)
+val pp : t -> Pp.t
+(** Print a load path *)
+
val get_load_paths : unit -> t list
(** Get the current loadpath association. *)
-val add_load_path : CUnix.physical_path -> DirPath.t -> implicit:bool -> unit
-(** [add_load_path phys log type] adds the binding [phys := log] to the current
- loadpaths. *)
-
val remove_load_path : CUnix.physical_path -> unit
(** Remove the current logical path binding associated to a given physical path,
if any. *)
@@ -41,17 +37,53 @@ val find_load_path : CUnix.physical_path -> t
(** Get the binding associated to a physical path. Raises [Not_found] if there
is none. *)
-val is_in_load_paths : CUnix.physical_path -> bool
-(** Whether a physical path is currently bound. *)
-
-val expand_path : ?root:DirPath.t -> DirPath.t -> (CUnix.physical_path * DirPath.t) list
-(** Given a relative logical path, associate the list of absolute physical and
- logical paths which are possible matches of it. *)
-
-val filter_path : (DirPath.t -> bool) -> (CUnix.physical_path * DirPath.t) list
-(** As {!expand_path} but uses a filter function instead, and ignores the
- implicit status of loadpaths. *)
-
val locate_file : string -> string
(** Locate a file among the registered paths. Do not use this function, as
it does not respect the visibility of paths. *)
+
+(** {6 Locate a library in the load path } *)
+type library_location = LibLoaded | LibInPath
+type locate_error = LibUnmappedDir | LibNotFound
+type 'a locate_result = ('a, locate_error) result
+
+val locate_qualified_library
+ : ?root:DirPath.t
+ -> ?warn:bool
+ -> Libnames.qualid
+ -> (library_location * DirPath.t * CUnix.physical_path) locate_result
+
+(** Locates a library by implicit name.
+
+ @raise LibUnmappedDir if the library is not in the path
+ @raise LibNotFound if there is no corresponding file in the path
+
+*)
+
+val try_locate_absolute_library : DirPath.t -> string
+
+(** {6 Extending the Load Path } *)
+
+(** Adds a path to the Coq and ML paths *)
+type add_ml = AddNoML | AddTopML | AddRecML
+
+type vo_path_spec = {
+ unix_path : string;
+ (** Filesystem path contaning vo/ml files *)
+ coq_path : Names.DirPath.t;
+ (** Coq prefix for the path *)
+ implicit : bool;
+ (** [implicit = true] avoids having to qualify with [coq_path] *)
+ has_ml : add_ml;
+ (** If [has_ml] is true, the directory will also be search for plugins *)
+}
+
+type coq_path_spec =
+ | VoPath of vo_path_spec
+ | MlPath of string
+
+type coq_path = {
+ path_spec: coq_path_spec;
+ recursive: bool;
+}
+
+val add_coq_path : coq_path -> unit
diff --git a/vernac/mltop.ml b/vernac/mltop.ml
index 78e26c65d4..bbee9988d0 100644
--- a/vernac/mltop.ml
+++ b/vernac/mltop.ml
@@ -159,75 +159,9 @@ let add_ml_dir s =
| _ -> ()
(* For Rec Add ML Path (-R) *)
-let add_rec_ml_dir unix_path =
- List.iter (fun (lp,_) -> add_ml_dir lp) (all_subdirs ~unix_path)
-
-(* Adding files to Coq and ML loadpath *)
-
-let warn_cannot_use_directory =
- CWarnings.create ~name:"cannot-use-directory" ~category:"filesystem"
- (fun d ->
- str "Directory " ++ str d ++
- strbrk " cannot be used as a Coq identifier (skipped)")
-
-let convert_string d =
- try Names.Id.of_string d
- with UserError _ ->
- let d = Unicode.escaped_if_non_utf8 d in
- warn_cannot_use_directory d;
- raise Exit
-
-let warn_cannot_open_path =
- CWarnings.create ~name:"cannot-open-path" ~category:"filesystem"
- (fun unix_path -> str "Cannot open " ++ str unix_path)
-
-type add_ml = AddNoML | AddTopML | AddRecML
-
-type vo_path_spec = {
- unix_path : string;
- coq_path : Names.DirPath.t;
- implicit : bool;
- has_ml : add_ml;
-}
-
-type coq_path_spec =
- | VoPath of vo_path_spec
- | MlPath of string
-
-type coq_path = {
- path_spec: coq_path_spec;
- recursive: bool;
-}
-
-let add_vo_path ~recursive lp =
- let unix_path = lp.unix_path in
- let implicit = lp.implicit in
- if exists_dir unix_path then
- let dirs = if recursive then all_subdirs ~unix_path else [] in
- let prefix = Names.DirPath.repr lp.coq_path in
- let convert_dirs (lp, cp) =
- try
- let path = List.rev_map convert_string cp @ prefix in
- Some (lp, Names.DirPath.make path)
- with Exit -> None
- in
- let dirs = List.map_filter convert_dirs dirs in
- let () = match lp.has_ml with
- | AddNoML -> ()
- | AddTopML -> add_ml_dir unix_path
- | AddRecML -> List.iter (fun (lp,_) -> add_ml_dir lp) dirs; add_ml_dir unix_path in
- let add (path, dir) =
- Loadpath.add_load_path path ~implicit dir in
- let () = List.iter add dirs in
- Loadpath.add_load_path unix_path ~implicit lp.coq_path
- else
- warn_cannot_open_path unix_path
-
-let add_coq_path { recursive; path_spec } = match path_spec with
- | VoPath lp ->
- add_vo_path ~recursive lp
- | MlPath dir ->
- if recursive then add_rec_ml_dir dir else add_ml_dir dir
+let add_ml_dir ~recursive unix_path =
+ let dirs = if recursive then (all_subdirs ~unix_path) else [unix_path,[]] in
+ List.iter (fun (lp,_) -> add_ml_dir lp) dirs
(* convertit un nom quelconque en nom de fichier ou de module *)
let mod_of_name name =
diff --git a/vernac/mltop.mli b/vernac/mltop.mli
index 3d796aa4aa..b457c9c88f 100644
--- a/vernac/mltop.mli
+++ b/vernac/mltop.mli
@@ -32,6 +32,9 @@ val ocaml_toploop : unit -> unit
(** {5 ML Dynlink} *)
+(** Adds a dir to the plugin search path *)
+val add_ml_dir : recursive:bool -> string -> unit
+
(** Tests if we can load ML files *)
val has_dynlink : bool
@@ -41,27 +44,6 @@ val dir_ml_load : string -> unit
(** Dynamic interpretation of .ml *)
val dir_ml_use : string -> unit
-(** Adds a path to the Coq and ML paths *)
-type add_ml = AddNoML | AddTopML | AddRecML
-
-type vo_path_spec = {
- unix_path : string; (* Filesystem path contaning vo/ml files *)
- coq_path : Names.DirPath.t; (* Coq prefix for the path *)
- implicit : bool; (* [implicit = true] avoids having to qualify with [coq_path] *)
- has_ml : add_ml; (* If [has_ml] is true, the directory will also be search for plugins *)
-}
-
-type coq_path_spec =
- | VoPath of vo_path_spec
- | MlPath of string
-
-type coq_path = {
- path_spec: coq_path_spec;
- recursive: bool;
-}
-
-val add_coq_path : coq_path -> unit
-
(** List of modules linked to the toplevel *)
val add_known_module : string -> unit
val module_is_known : string -> bool
diff --git a/vernac/obligations.ml b/vernac/obligations.ml
index f768278dd7..46c4422d17 100644
--- a/vernac/obligations.ml
+++ b/vernac/obligations.ml
@@ -454,7 +454,7 @@ let obligation_substitution expand prg =
let ints = intset_to (pred (Array.length obls)) in
obl_substitution expand obls ints
-let declare_definition ~ontop prg =
+let declare_definition prg =
let varsubst = obligation_substitution true prg in
let body, typ = subst_prog varsubst prg in
let nf = UnivSubst.nf_evars_and_universes_opt_subst (fun x -> None)
@@ -473,7 +473,7 @@ let declare_definition ~ontop prg =
let () = progmap_remove prg in
let ubinders = UState.universe_binders uctx in
let hook_data = Option.map (fun hook -> hook, uctx, obls) prg.prg_hook in
- DeclareDef.declare_definition ~ontop prg.prg_name
+ DeclareDef.declare_definition prg.prg_name
prg.prg_kind ce ubinders prg.prg_implicits ?hook_data
let rec lam_index n t acc =
@@ -552,7 +552,7 @@ let declare_mutual_definition l =
(* Declare the recursive definitions *)
let univs = UState.univ_entry ~poly first.prg_ctx in
let fix_exn = Hook.get get_fix_exn () in
- let kns = List.map4 (DeclareDef.declare_fix ~ontop:None ~opaque (local, poly, kind) UnivNames.empty_binders univs)
+ let kns = List.map4 (DeclareDef.declare_fix ~opaque (local, poly, kind) UnivNames.empty_binders univs)
fixnames fixdecls fixtypes fiximps in
(* Declare notations *)
List.iter (Metasyntax.add_notation_interpretation (Global.env())) first.prg_notations;
@@ -759,7 +759,7 @@ let update_obls prg obls rem =
else (
match prg'.prg_deps with
| [] ->
- let kn = declare_definition ~ontop:None prg' in
+ let kn = declare_definition prg' in
progmap_remove prg';
Defined kn
| l ->
@@ -1110,7 +1110,7 @@ let add_definition n ?term t ctx ?(univdecl=UState.default_univ_decl)
let obls,_ = prg.prg_obligations in
if Int.equal (Array.length obls) 0 then (
Flags.if_verbose Feedback.msg_info (info ++ str ".");
- let cst = declare_definition ~ontop:None prg in
+ let cst = declare_definition prg in
Defined cst)
else (
let len = Array.length obls in
diff --git a/vernac/ppvernac.ml b/vernac/ppvernac.ml
index f2332bab8b..2e97a169cc 100644
--- a/vernac/ppvernac.ml
+++ b/vernac/ppvernac.ml
@@ -911,7 +911,7 @@ open Pputils
spc() ++ pr_class_rawexpr c2)
)
- | VernacInstance (sup, (instid, bk, cl), props, info) ->
+ | VernacInstance (instid, sup, cl, props, info) ->
return (
hov 1 (
keyword "Instance" ++
@@ -920,7 +920,6 @@ open Pputils
| { v = Anonymous }, _ -> mt ()) ++
pr_and_type_binders_arg sup ++
str":" ++ spc () ++
- (match bk with Implicit -> str "! " | Explicit -> mt ()) ++
pr_constr env sigma cl ++ pr_hint_info (pr_constr_pattern_expr env sigma) info ++
(match props with
| Some (true, { v = CRecord l}) -> spc () ++ str":=" ++ spc () ++ str"{" ++ pr_record_body l ++ str "}"
@@ -929,13 +928,12 @@ open Pputils
| None -> mt()))
)
- | VernacDeclareInstance (sup, (instid, bk, cl), info) ->
+ | VernacDeclareInstance (instid, sup, cl, info) ->
return (
hov 1 (
keyword "Declare Instance" ++ spc () ++ pr_ident_decl instid ++ spc () ++
pr_and_type_binders_arg sup ++
str":" ++ spc () ++
- (match bk with Implicit -> str "! " | Explicit -> mt ()) ++
pr_constr env sigma cl ++ pr_hint_info (pr_constr_pattern_expr env sigma) info)
)
diff --git a/vernac/vernac.mllib b/vernac/vernac.mllib
index 7f5c265eea..57c56a58f9 100644
--- a/vernac/vernac.mllib
+++ b/vernac/vernac.mllib
@@ -32,6 +32,7 @@ Assumptions
Vernacstate
Mltop
Topfmt
+Loadpath
Vernacentries
Misctypes
diff --git a/vernac/vernacentries.ml b/vernac/vernacentries.ml
index e1d134f3a9..b9d1326ba5 100644
--- a/vernac/vernacentries.ml
+++ b/vernac/vernacentries.ml
@@ -201,11 +201,6 @@ let show_match id =
(* "Print" commands *)
-let print_path_entry p =
- let dir = DirPath.print (Loadpath.logical p) in
- let path = str (CUnix.escaped_string_of_physical_path (Loadpath.physical p)) in
- Pp.hov 2 (dir ++ spc () ++ path)
-
let print_loadpath dir =
let l = Loadpath.get_load_paths () in
let l = match dir with
@@ -215,7 +210,7 @@ let print_loadpath dir =
List.filter filter l
in
str "Logical Path / Physical path:" ++ fnl () ++
- prlist_with_sep fnl print_path_entry l
+ prlist_with_sep fnl Loadpath.pp l
let print_modules () =
let opened = Library.opened_libraries ()
@@ -444,9 +439,9 @@ let locate_file f =
str file
let msg_found_library = function
- | Library.LibLoaded, fulldir, file ->
+ | Loadpath.LibLoaded, fulldir, file ->
hov 0 (DirPath.print fulldir ++ strbrk " has been loaded from file " ++ str file)
- | Library.LibInPath, fulldir, file ->
+ | Loadpath.LibInPath, fulldir, file ->
hov 0 (DirPath.print fulldir ++ strbrk " is bound to file " ++ str file)
let err_unmapped_library ?from qid =
@@ -471,10 +466,11 @@ let err_notfound_library ?from qid =
(strbrk "Unable to locate library " ++ pr_qualid qid ++ prefix)
let print_located_library qid =
- try msg_found_library (Library.locate_qualified_library ~warn:false qid)
- with
- | Library.LibUnmappedDir -> err_unmapped_library qid
- | Library.LibNotFound -> err_notfound_library qid
+ let open Loadpath in
+ match locate_qualified_library ~warn:false qid with
+ | Ok lib -> msg_found_library lib
+ | Error LibUnmappedDir -> err_unmapped_library qid
+ | Error LibNotFound -> err_notfound_library qid
let smart_global r =
let gr = Smartlocate.smart_global r in
@@ -605,7 +601,7 @@ let vernac_definition ~atts ~pstate discharge kind ({loc;v=id}, pl) def =
| Some r ->
let sigma, env = get_current_or_global_context ~pstate in
Some (snd (Hook.get f_interp_redexp env sigma r)) in
- ComDefinition.do_definition ~ontop:pstate ~program_mode name
+ ComDefinition.do_definition ~program_mode name
(local, atts.polymorphic, kind) pl bl red_option c typ_opt ?hook;
pstate
)
@@ -632,7 +628,7 @@ let vernac_exact_proof ~pstate c =
if not status then Feedback.feedback Feedback.AddedAxiom;
pstate
-let vernac_assumption ~atts ~pstate discharge kind l nl =
+let vernac_assumption ~atts discharge kind l nl =
let open DefAttributes in
let local = enforce_locality_exp atts.locality discharge in
let global = local == Global in
@@ -642,7 +638,7 @@ let vernac_assumption ~atts ~pstate discharge kind l nl =
List.iter (fun (lid, _) ->
if global then Dumpglob.dump_definition lid false "ax"
else Dumpglob.dump_definition lid true "var") idl) l;
- let status = ComAssumption.do_assumptions ~pstate ~program_mode:atts.program kind nl l in
+ let status = ComAssumption.do_assumptions ~program_mode:atts.program kind nl l in
if not status then Feedback.feedback Feedback.AddedAxiom
let is_polymorphic_inductive_cumulativity =
@@ -1026,18 +1022,18 @@ let vernac_require from import qidl =
Some (Libnames.add_dirpath_suffix hd tl)
in
let locate qid =
- try
- let warn = not !Flags.quiet in
- let (_, dir, f) = Library.locate_qualified_library ?root ~warn qid in
- (dir, f)
- with
- | Library.LibUnmappedDir -> err_unmapped_library ?from:root qid
- | Library.LibNotFound -> err_notfound_library ?from:root qid
+ let open Loadpath in
+ let warn = not !Flags.quiet in
+ match locate_qualified_library ?root ~warn qid with
+ | Ok (_,dir,f) -> dir, f
+ | Error LibUnmappedDir -> err_unmapped_library ?from:root qid
+ | Error LibNotFound -> err_notfound_library ?from:root qid
in
let modrefl = List.map locate qidl in
if Dumpglob.dump () then
List.iter2 (fun {CAst.loc} dp -> Dumpglob.dump_libref ?loc dp "lib") qidl (List.map fst modrefl);
- Library.require_library_from_dirpath modrefl import
+ let lib_resolver = Loadpath.try_locate_absolute_library in
+ Library.require_library_from_dirpath ~lib_resolver modrefl import
(* Coercions and canonical structures *)
@@ -1062,21 +1058,21 @@ let vernac_identity_coercion ~atts id qids qidt =
(* Type classes *)
-let vernac_instance ~atts sup inst props pri =
+let vernac_instance ~atts name bl t props pri =
let open DefAttributes in
let global = not (make_section_locality atts.locality) in
- Dumpglob.dump_constraint (fst (pi1 inst)) false "inst";
+ Dumpglob.dump_constraint (fst name) false "inst";
let program_mode = atts.program in
- Classes.new_instance ~program_mode ~global atts.polymorphic sup inst props pri
+ Classes.new_instance ~program_mode ~global atts.polymorphic name bl t props pri
-let vernac_declare_instance ~atts sup inst pri =
+let vernac_declare_instance ~atts id bl inst pri =
let open DefAttributes in
let global = not (make_section_locality atts.locality) in
- Dumpglob.dump_definition (fst (pi1 inst)) false "inst";
- Classes.declare_new_instance ~program_mode:atts.program ~global atts.polymorphic sup inst pri
+ Dumpglob.dump_definition (fst id) false "inst";
+ Classes.declare_new_instance ~program_mode:atts.program ~global atts.polymorphic id bl inst pri
-let vernac_context ~pstate ~poly l =
- if not (ComAssumption.context ~pstate poly l) then Feedback.feedback Feedback.AddedAxiom
+let vernac_context ~poly l =
+ if not (ComAssumption.context poly l) then Feedback.feedback Feedback.AddedAxiom
let vernac_existing_instance ~section_local insts =
let glob = not section_local in
@@ -1133,7 +1129,7 @@ let expand filename =
Envars.expand_path_macros ~warn:(fun x -> Feedback.msg_warning (str x)) filename
let vernac_add_loadpath implicit pdir ldiropt =
- let open Mltop in
+ let open Loadpath in
let pdir = expand pdir in
let alias = Option.default Libnames.default_root_prefix ldiropt in
add_coq_path { recursive = true;
@@ -1141,11 +1137,10 @@ let vernac_add_loadpath implicit pdir ldiropt =
let vernac_remove_loadpath path =
Loadpath.remove_load_path (expand path)
-
(* Coq syntax for ML or system commands *)
let vernac_add_ml_path isrec path =
- let open Mltop in
+ let open Loadpath in
add_coq_path { recursive = isrec; path_spec = MlPath (expand path) }
let vernac_declare_ml_module ~local l =
@@ -2204,7 +2199,7 @@ let with_fail ~st f =
try let _ = f () in raise HasNotFailed
with
| HasNotFailed as e -> raise e
- | e ->
+ | e when CErrors.noncritical e || e = Timeout ->
let e = CErrors.push e in
raise (HasFailed (CErrors.iprint
(ExplainErr.process_vernac_interp_error ~allow_uncaught:false e)))
@@ -2300,7 +2295,7 @@ let rec interp_expr ?proof ~atts ~st c : Proof_global.t option =
unsupported_attributes atts;
vernac_require_open_proof ~pstate (vernac_exact_proof c)
| VernacAssumption ((discharge,kind),nl,l) ->
- with_def_attributes ~atts vernac_assumption ~pstate discharge kind l nl;
+ with_def_attributes ~atts vernac_assumption discharge kind l nl;
pstate
| VernacInductive (cum, priv, finite, l) ->
vernac_inductive ~atts cum priv finite l;
@@ -2377,13 +2372,13 @@ let rec interp_expr ?proof ~atts ~st c : Proof_global.t option =
pstate
(* Type classes *)
- | VernacInstance (sup, inst, props, info) ->
- snd @@ with_def_attributes ~atts (vernac_instance ~pstate sup inst props info)
- | VernacDeclareInstance (sup, inst, info) ->
- with_def_attributes ~atts vernac_declare_instance sup inst info;
+ | VernacInstance (name, bl, t, props, info) ->
+ snd @@ with_def_attributes ~atts (vernac_instance ~pstate name bl t props info)
+ | VernacDeclareInstance (id, bl, inst, info) ->
+ with_def_attributes ~atts vernac_declare_instance id bl inst info;
pstate
| VernacContext sup ->
- let () = vernac_context ~pstate ~poly:(only_polymorphism atts) sup in
+ let () = vernac_context ~poly:(only_polymorphism atts) sup in
pstate
| VernacExistingInstance insts ->
with_section_locality ~atts vernac_existing_instance insts;
diff --git a/vernac/vernacexpr.ml b/vernac/vernacexpr.ml
index 23633e39ab..f946e0596e 100644
--- a/vernac/vernacexpr.ml
+++ b/vernac/vernacexpr.ml
@@ -303,15 +303,17 @@ type nonrec vernac_expr =
(* Type classes *)
| VernacInstance of
- local_binder_expr list * (* super *)
- typeclass_constraint * (* instance name, class name, params *)
- (bool * constr_expr) option * (* props *)
- Hints.hint_info_expr
+ name_decl * (* name *)
+ local_binder_expr list * (* binders *)
+ constr_expr * (* type *)
+ (bool * constr_expr) option * (* body (bool=true when using {}) *)
+ Hints.hint_info_expr
| VernacDeclareInstance of
- local_binder_expr list * (* super *)
- (ident_decl * Decl_kinds.binding_kind * constr_expr) * (* instance name, class name, params *)
- Hints.hint_info_expr
+ ident_decl * (* name *)
+ local_binder_expr list * (* binders *)
+ constr_expr * (* type *)
+ Hints.hint_info_expr
| VernacContext of local_binder_expr list