aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.circleci/config.yml411
-rw-r--r--.gitattributes2
-rw-r--r--.github/ISSUE_TEMPLATE.md (renamed from ISSUE_TEMPLATE.md)0
-rw-r--r--.github/PULL_REQUEST_TEMPLATE.md16
-rw-r--r--.gitignore4
-rw-r--r--.gitlab-ci.yml20
-rw-r--r--.merlin14
-rw-r--r--.travis.yml150
-rw-r--r--API/API.ml283
-rw-r--r--API/API.mli5895
-rw-r--r--API/API.mllib1
-rw-r--r--API/PROPERTIES8
-rw-r--r--CHANGES75
-rw-r--r--CONTRIBUTING.md8
-rw-r--r--INSTALL2
-rw-r--r--INSTALL.ide4
-rw-r--r--META.coq363
-rw-r--r--Makefile36
-rw-r--r--Makefile.build232
-rw-r--r--Makefile.checker36
-rw-r--r--Makefile.ci18
-rw-r--r--Makefile.common10
-rw-r--r--Makefile.dev4
-rw-r--r--Makefile.doc49
-rw-r--r--Makefile.ide15
-rw-r--r--Makefile.install12
-rw-r--r--README.doc18
-rw-r--r--README.md22
-rw-r--r--checker/analyze.ml86
-rw-r--r--checker/analyze.mli21
-rw-r--r--checker/check.ml60
-rw-r--r--checker/check.mli30
-rw-r--r--checker/check.mllib1
-rw-r--r--checker/checker.ml39
-rw-r--r--checker/checker.mli9
-rw-r--r--checker/cic.mli36
-rw-r--r--checker/closure.ml79
-rw-r--r--checker/closure.mli26
-rw-r--r--checker/declarations.ml4
-rw-r--r--checker/declarations.mli12
-rw-r--r--checker/environ.ml41
-rw-r--r--checker/environ.mli37
-rw-r--r--checker/indtypes.ml17
-rw-r--r--checker/indtypes.mli6
-rw-r--r--checker/inductive.ml20
-rw-r--r--checker/inductive.mli2
-rw-r--r--checker/main.mli10
-rw-r--r--checker/mod_checking.ml13
-rw-r--r--checker/mod_checking.mli2
-rw-r--r--checker/modops.mli18
-rw-r--r--checker/print.mli11
-rw-r--r--checker/reduction.ml59
-rw-r--r--checker/term.mli4
-rw-r--r--checker/type_errors.ml6
-rw-r--r--checker/type_errors.mli10
-rw-r--r--checker/univ.ml8
-rw-r--r--checker/univ.mli2
-rw-r--r--checker/validate.ml2
-rw-r--r--checker/validate.mli9
-rw-r--r--checker/values.ml40
-rw-r--r--checker/values.mli26
-rw-r--r--checker/votour.ml72
-rw-r--r--checker/votour.mli10
-rw-r--r--clib/backtrace.ml (renamed from lib/backtrace.ml)0
-rw-r--r--clib/backtrace.mli (renamed from lib/backtrace.mli)0
-rw-r--r--clib/bigint.ml (renamed from lib/bigint.ml)0
-rw-r--r--clib/bigint.mli (renamed from lib/bigint.mli)0
-rw-r--r--clib/cArray.ml (renamed from lib/cArray.ml)0
-rw-r--r--clib/cArray.mli (renamed from lib/cArray.mli)0
-rw-r--r--clib/cEphemeron.ml (renamed from lib/cEphemeron.ml)0
-rw-r--r--clib/cEphemeron.mli (renamed from lib/cEphemeron.mli)0
-rw-r--r--clib/cList.ml (renamed from lib/cList.ml)35
-rw-r--r--clib/cList.mli (renamed from lib/cList.mli)7
-rw-r--r--clib/cMap.ml (renamed from lib/cMap.ml)10
-rw-r--r--clib/cMap.mli (renamed from lib/cMap.mli)2
-rw-r--r--clib/cObj.ml (renamed from lib/cObj.ml)0
-rw-r--r--clib/cObj.mli (renamed from lib/cObj.mli)0
-rw-r--r--clib/cSet.ml (renamed from lib/cSet.ml)0
-rw-r--r--clib/cSet.mli (renamed from lib/cSet.mli)0
-rw-r--r--clib/cSig.mli (renamed from lib/cSig.mli)6
-rw-r--r--clib/cStack.ml (renamed from lib/cStack.ml)0
-rw-r--r--clib/cStack.mli (renamed from lib/cStack.mli)0
-rw-r--r--clib/cString.ml (renamed from lib/cString.ml)0
-rw-r--r--clib/cString.mli (renamed from lib/cString.mli)0
-rw-r--r--clib/cThread.ml (renamed from lib/cThread.ml)0
-rw-r--r--clib/cThread.mli (renamed from lib/cThread.mli)0
-rw-r--r--clib/cUnix.ml (renamed from lib/cUnix.ml)5
-rw-r--r--clib/cUnix.mli (renamed from lib/cUnix.mli)7
-rw-r--r--clib/canary.ml (renamed from lib/canary.ml)0
-rw-r--r--clib/canary.mli (renamed from lib/canary.mli)0
-rw-r--r--clib/clib.mllib (renamed from lib/clib.mllib)50
-rw-r--r--clib/deque.ml (renamed from lib/deque.ml)0
-rw-r--r--clib/deque.mli (renamed from lib/deque.mli)0
-rw-r--r--clib/dyn.ml (renamed from lib/dyn.ml)10
-rw-r--r--clib/dyn.mli (renamed from lib/dyn.mli)1
-rw-r--r--clib/exninfo.ml (renamed from lib/exninfo.ml)0
-rw-r--r--clib/exninfo.mli (renamed from lib/exninfo.mli)0
-rw-r--r--clib/hMap.ml (renamed from lib/hMap.ml)26
-rw-r--r--clib/hMap.mli (renamed from lib/hMap.mli)0
-rw-r--r--clib/hashcons.ml (renamed from lib/hashcons.ml)0
-rw-r--r--clib/hashcons.mli (renamed from lib/hashcons.mli)0
-rw-r--r--clib/hashset.ml (renamed from lib/hashset.ml)0
-rw-r--r--clib/hashset.mli (renamed from lib/hashset.mli)0
-rw-r--r--clib/heap.ml (renamed from lib/heap.ml)0
-rw-r--r--clib/heap.mli (renamed from lib/heap.mli)0
-rw-r--r--clib/iStream.ml (renamed from lib/iStream.ml)0
-rw-r--r--clib/iStream.mli (renamed from lib/iStream.mli)0
-rw-r--r--clib/int.ml (renamed from lib/int.ml)0
-rw-r--r--clib/int.mli (renamed from lib/int.mli)0
-rw-r--r--clib/minisys.ml (renamed from lib/minisys.ml)0
-rw-r--r--clib/monad.ml (renamed from lib/monad.ml)0
-rw-r--r--clib/monad.mli (renamed from lib/monad.mli)0
-rw-r--r--clib/option.ml (renamed from lib/option.ml)0
-rw-r--r--clib/option.mli (renamed from lib/option.mli)0
-rw-r--r--clib/predicate.ml (renamed from lib/predicate.ml)0
-rw-r--r--clib/predicate.mli (renamed from lib/predicate.mli)0
-rw-r--r--clib/range.ml91
-rw-r--r--clib/range.mli37
-rw-r--r--clib/segmenttree.ml (renamed from lib/segmenttree.ml)0
-rw-r--r--clib/segmenttree.mli (renamed from lib/segmenttree.mli)0
-rw-r--r--clib/store.ml (renamed from lib/store.ml)0
-rw-r--r--clib/store.mli (renamed from lib/store.mli)0
-rw-r--r--clib/terminal.ml (renamed from lib/terminal.ml)0
-rw-r--r--clib/terminal.mli (renamed from lib/terminal.mli)0
-rw-r--r--clib/trie.ml (renamed from lib/trie.ml)0
-rw-r--r--clib/trie.mli (renamed from lib/trie.mli)0
-rw-r--r--clib/unicode.ml (renamed from lib/unicode.ml)0
-rw-r--r--clib/unicode.mli (renamed from lib/unicode.mli)0
-rw-r--r--clib/unicodetable.ml (renamed from lib/unicodetable.ml)0
-rw-r--r--clib/unionfind.ml (renamed from lib/unionfind.ml)0
-rw-r--r--clib/unionfind.mli (renamed from lib/unionfind.mli)0
-rw-r--r--config/coq_config.mli8
-rw-r--r--configure.ml174
-rw-r--r--default.nix73
-rw-r--r--dev/README30
-rw-r--r--dev/base_include13
-rwxr-xr-xdev/build/osx/make-macos-dmg.sh2
-rw-r--r--dev/build/windows/MakeCoq_MinGW.bat2
-rw-r--r--dev/build/windows/ReadMe.txt2
-rw-r--r--dev/build/windows/makecoq_mingw.sh4
-rw-r--r--dev/build/windows/patches_coq/coq_new.nsi4
-rw-r--r--dev/ci/README.md2
-rw-r--r--dev/ci/appveyor.bat4
-rw-r--r--dev/ci/ci-basic-overlay.sh107
-rwxr-xr-xdev/ci/ci-bignums.sh4
-rwxr-xr-xdev/ci/ci-color.sh33
-rw-r--r--dev/ci/ci-common.sh68
-rwxr-xr-xdev/ci/ci-compcert.sh6
-rwxr-xr-xdev/ci/ci-coq-dpdgraph.sh2
-rwxr-xr-xdev/ci/ci-corn.sh10
-rwxr-xr-xdev/ci/ci-equations.sh10
-rwxr-xr-xdev/ci/ci-formal-topology.sh22
-rwxr-xr-xdev/ci/ci-hott.sh2
-rwxr-xr-xdev/ci/ci-iris-lambda-rust.sh4
-rwxr-xr-xdev/ci/ci-ltac2.sh10
-rwxr-xr-xdev/ci/ci-math-classes.sh14
-rwxr-xr-xdev/ci/ci-sf.sh30
-rwxr-xr-xdev/ci/ci-vst.sh4
-rwxr-xr-xdev/ci/ci-wrapper.sh5
-rw-r--r--dev/ci/user-overlays/00669-maximedenes-ssr-merge.sh2
-rw-r--r--dev/ci/user-overlays/06405-maximedenes-rm-local-polymorphic-flag.sh4
-rw-r--r--dev/ci/user-overlays/06482-ppedrot-check-poly-effects.sh4
-rw-r--r--dev/ci/user-overlays/06493-gares-API-remove-big-file.sh8
-rw-r--r--dev/ci/user-overlays/06535-fix-push-rel-to-named.sh4
-rw-r--r--dev/ci/user-overlays/06686-ccnv-no-proj.sh4
-rw-r--r--dev/ci/user-overlays/README.md4
-rw-r--r--dev/core.dbg1
-rw-r--r--dev/db94
-rw-r--r--dev/doc/COMPATIBILITY (renamed from COMPATIBILITY)7
-rw-r--r--dev/doc/changes.md37
-rw-r--r--dev/doc/debugging.md38
-rw-r--r--dev/doc/setup.txt26
-rw-r--r--dev/doc/univpoly.txt2
-rw-r--r--dev/doc/xml-protocol.md6
-rw-r--r--dev/include1
-rwxr-xr-xdev/lint-repository.sh18
-rwxr-xr-xdev/nsis/coq.nsi2
-rw-r--r--dev/ocamldebug-coq.run3
-rw-r--r--dev/set_raw_db1
-rwxr-xr-xdev/tools/backport-pr.sh65
-rwxr-xr-xdev/tools/check-eof-newline.sh19
-rwxr-xr-xdev/tools/github-check-prs.py47
-rwxr-xr-xdev/tools/merge-pr.sh50
-rwxr-xr-xdev/tools/should-check-whitespace.sh5
-rwxr-xr-xdev/tools/sudo-apt-get-update.sh4
-rw-r--r--dev/top_printers.ml92
-rw-r--r--dev/top_printers.mli173
-rw-r--r--dev/vm_printers.ml10
-rw-r--r--doc/common/macros.tex4
-rw-r--r--doc/faq/FAQ.tex2713
-rw-r--r--doc/faq/axioms.fig131
-rw-r--r--doc/faq/fk.bib2221
-rw-r--r--doc/faq/hevea.sty78
-rw-r--r--doc/faq/interval_discr.v419
-rw-r--r--doc/refman/AsyncProofs.tex2
-rw-r--r--doc/refman/Cases.tex12
-rw-r--r--doc/refman/Classes.tex13
-rw-r--r--doc/refman/Extraction.tex48
-rw-r--r--doc/refman/Omega.tex26
-rw-r--r--doc/refman/RefMan-com.tex12
-rw-r--r--doc/refman/RefMan-ext.tex54
-rw-r--r--doc/refman/RefMan-ide.tex86
-rw-r--r--doc/refman/RefMan-ltac.tex100
-rw-r--r--doc/refman/RefMan-mod.tex6
-rw-r--r--doc/refman/RefMan-oth.tex16
-rw-r--r--doc/refman/RefMan-pre.tex10
-rw-r--r--doc/refman/RefMan-pro.tex19
-rw-r--r--doc/refman/RefMan-sch.tex6
-rw-r--r--doc/refman/RefMan-ssr.tex8
-rw-r--r--doc/refman/RefMan-tac.tex48
-rw-r--r--doc/refman/RefMan-uti.tex58
-rw-r--r--doc/refman/Universes.tex6
-rw-r--r--doc/refman/coqide-queries.pngbin27316 -> 66656 bytes
-rw-r--r--doc/refman/coqide.pngbin20953 -> 59662 bytes
-rw-r--r--engine/eConstr.ml69
-rw-r--r--engine/eConstr.mli28
-rw-r--r--engine/engine.mllib7
-rw-r--r--engine/evarutil.ml198
-rw-r--r--engine/evarutil.mli42
-rw-r--r--engine/evd.ml43
-rw-r--r--engine/evd.mli184
-rw-r--r--engine/logic_monad.ml2
-rw-r--r--engine/namegen.ml10
-rw-r--r--engine/namegen.mli3
-rw-r--r--engine/nameops.ml (renamed from library/nameops.ml)15
-rw-r--r--engine/nameops.mli (renamed from library/nameops.mli)37
-rw-r--r--engine/proofview.ml37
-rw-r--r--engine/proofview.mli31
-rw-r--r--engine/termops.ml59
-rw-r--r--engine/termops.mli29
-rw-r--r--engine/uState.ml232
-rw-r--r--engine/uState.mli65
-rw-r--r--engine/universes.ml218
-rw-r--r--engine/universes.mli123
-rw-r--r--engine/univops.ml111
-rw-r--r--engine/univops.mli (renamed from library/univops.mli)9
-rw-r--r--grammar/tacextend.mlp14
-rw-r--r--grammar/vernacextend.mlp29
-rw-r--r--ide/config_lexer.mli10
-rw-r--r--ide/coq-ssreflect.lang2
-rw-r--r--ide/coq.lang2
-rw-r--r--ide/coq_commands.mli11
-rw-r--r--ide/coq_lex.mli11
-rw-r--r--ide/coq_lex.mll10
-rw-r--r--ide/coqide.ml11
-rw-r--r--ide/coqide_main.ml43
-rw-r--r--ide/coqide_main.mli10
-rw-r--r--ide/coqide_ui.mli10
-rw-r--r--ide/gtk_parsing.ml109
-rw-r--r--ide/gtk_parsing.mli26
-rw-r--r--ide/ide_slave.ml22
-rw-r--r--ide/ide_slave.mli10
-rw-r--r--ide/ideutils.ml10
-rw-r--r--ide/ideutils.mli2
-rw-r--r--ide/macos_prehook.mli10
-rw-r--r--ide/nanoPG.mli11
-rw-r--r--ide/session.ml5
-rw-r--r--ide/utf8_convert.mli9
-rw-r--r--ide/wg_Find.ml61
-rwxr-xr-xinstall.sh8
-rw-r--r--interp/constrexpr_ops.ml495
-rw-r--r--interp/constrexpr_ops.mli37
-rw-r--r--interp/constrextern.ml38
-rw-r--r--interp/constrextern.mli16
-rw-r--r--interp/constrintern.ml116
-rw-r--r--interp/constrintern.mli30
-rw-r--r--interp/declare.ml360
-rw-r--r--interp/declare.mli22
-rw-r--r--interp/discharge.ml5
-rw-r--r--interp/dumpglob.ml7
-rw-r--r--interp/dumpglob.mli6
-rw-r--r--interp/impargs.ml23
-rw-r--r--interp/impargs.mli6
-rw-r--r--interp/implicit_quantifiers.ml12
-rw-r--r--interp/implicit_quantifiers.mli4
-rw-r--r--interp/interp.mllib7
-rw-r--r--interp/modintern.ml2
-rw-r--r--interp/notation.ml47
-rw-r--r--interp/notation.mli12
-rw-r--r--interp/notation_ops.ml52
-rw-r--r--interp/reserve.ml6
-rw-r--r--interp/syntax_def.ml7
-rw-r--r--interp/syntax_def.mli2
-rw-r--r--interp/tactypes.ml (renamed from intf/tactypes.ml)0
-rw-r--r--interp/topconstr.ml300
-rw-r--r--interp/topconstr.mli41
-rw-r--r--intf/constrexpr.ml5
-rw-r--r--intf/decl_kinds.ml9
-rw-r--r--intf/evar_kinds.ml2
-rw-r--r--intf/glob_term.ml11
-rw-r--r--intf/intf.mllib1
-rw-r--r--intf/misctypes.ml15
-rw-r--r--intf/notation_term.ml3
-rw-r--r--intf/pattern.ml6
-rw-r--r--intf/vernacexpr.ml118
-rw-r--r--kernel/cClosure.ml92
-rw-r--r--kernel/cClosure.mli18
-rw-r--r--kernel/cbytecodes.ml17
-rw-r--r--kernel/cbytecodes.mli10
-rw-r--r--kernel/cbytegen.ml36
-rw-r--r--kernel/cbytegen.mli12
-rw-r--r--kernel/cemitcodes.ml6
-rw-r--r--kernel/cemitcodes.mli4
-rw-r--r--kernel/constr.ml221
-rw-r--r--kernel/constr.mli140
-rw-r--r--kernel/conv_oracle.mli8
-rw-r--r--kernel/cooking.ml91
-rw-r--r--kernel/cooking.mli4
-rw-r--r--kernel/csymtable.ml8
-rw-r--r--kernel/csymtable.mli8
-rw-r--r--kernel/declarations.ml42
-rw-r--r--kernel/declareops.ml25
-rw-r--r--kernel/declareops.mli6
-rw-r--r--kernel/entries.ml33
-rw-r--r--kernel/environ.ml72
-rw-r--r--kernel/environ.mli56
-rw-r--r--kernel/evar.ml1
-rw-r--r--kernel/evar.mli3
-rw-r--r--kernel/indtypes.ml56
-rw-r--r--kernel/indtypes.mli6
-rw-r--r--kernel/inductive.ml130
-rw-r--r--kernel/inductive.mli28
-rw-r--r--kernel/kernel.mllib1
-rw-r--r--kernel/mod_subst.ml50
-rw-r--r--kernel/mod_subst.mli57
-rw-r--r--kernel/mod_typing.ml30
-rw-r--r--kernel/mod_typing.mli12
-rw-r--r--kernel/modops.ml14
-rw-r--r--kernel/modops.mli24
-rw-r--r--kernel/names.ml2
-rw-r--r--kernel/names.mli280
-rw-r--r--kernel/nativecode.ml77
-rw-r--r--kernel/nativecode.mli20
-rw-r--r--kernel/nativeconv.ml13
-rw-r--r--kernel/nativeconv.mli2
-rw-r--r--kernel/nativeinstr.mli20
-rw-r--r--kernel/nativelambda.ml25
-rw-r--r--kernel/nativelambda.mli10
-rw-r--r--kernel/nativelib.ml2
-rw-r--r--kernel/nativelib.mli2
-rw-r--r--kernel/nativelibrary.ml2
-rw-r--r--kernel/nativelibrary.mli2
-rw-r--r--kernel/nativevalues.ml32
-rw-r--r--kernel/nativevalues.mli22
-rw-r--r--kernel/opaqueproof.ml8
-rw-r--r--kernel/opaqueproof.mli18
-rw-r--r--kernel/pre_env.ml55
-rw-r--r--kernel/pre_env.mli30
-rw-r--r--kernel/reduction.ml246
-rw-r--r--kernel/reduction.mli10
-rw-r--r--kernel/retroknowledge.ml6
-rw-r--r--kernel/retroknowledge.mli6
-rw-r--r--kernel/safe_typing.ml54
-rw-r--r--kernel/safe_typing.mli62
-rw-r--r--kernel/sorts.ml4
-rw-r--r--kernel/sorts.mli6
-rw-r--r--kernel/subtyping.ml21
-rw-r--r--kernel/subtyping.mli2
-rw-r--r--kernel/term.ml214
-rw-r--r--kernel/term.mli346
-rw-r--r--kernel/term_typing.ml119
-rw-r--r--kernel/term_typing.mli22
-rw-r--r--kernel/type_errors.ml9
-rw-r--r--kernel/type_errors.mli16
-rw-r--r--kernel/typeops.ml21
-rw-r--r--kernel/typeops.mli10
-rw-r--r--kernel/uGraph.ml17
-rw-r--r--kernel/uGraph.mli63
-rw-r--r--kernel/univ.ml57
-rw-r--r--kernel/univ.mli274
-rw-r--r--kernel/vars.ml53
-rw-r--r--kernel/vars.mli12
-rw-r--r--kernel/vconv.ml5
-rw-r--r--kernel/vconv.mli4
-rw-r--r--kernel/vm.ml545
-rw-r--r--kernel/vm.mli114
-rw-r--r--kernel/vmvalues.ml525
-rw-r--r--kernel/vmvalues.mli144
-rw-r--r--lib/cErrors.ml2
-rw-r--r--lib/cProfile.ml (renamed from lib/profile.ml)0
-rw-r--r--lib/cProfile.mli (renamed from lib/profile.mli)0
-rw-r--r--lib/control.ml25
-rw-r--r--lib/control.mli14
-rw-r--r--lib/coqProject_file.ml417
-rw-r--r--lib/coqProject_file.mli1
-rw-r--r--lib/envars.ml12
-rw-r--r--lib/flags.ml93
-rw-r--r--lib/flags.mli55
-rw-r--r--lib/lib.mllib39
-rw-r--r--lib/pp.ml1
-rw-r--r--lib/pp.mli3
-rw-r--r--lib/system.ml16
-rw-r--r--lib/system.mli5
-rw-r--r--library/coqlib.ml10
-rw-r--r--library/coqlib.mli4
-rw-r--r--library/declaremods.ml62
-rw-r--r--library/declaremods.mli18
-rw-r--r--library/decls.ml2
-rw-r--r--library/decls.mli8
-rw-r--r--library/global.ml25
-rw-r--r--library/global.mli73
-rw-r--r--library/globnames.ml36
-rw-r--r--library/globnames.mli21
-rw-r--r--library/heads.ml8
-rw-r--r--library/heads.mli2
-rw-r--r--library/kindops.ml48
-rw-r--r--library/kindops.mli2
-rw-r--r--library/lib.ml137
-rw-r--r--library/lib.mli43
-rw-r--r--library/libnames.ml31
-rw-r--r--library/libnames.mli42
-rw-r--r--library/library.ml35
-rw-r--r--library/library.mli4
-rw-r--r--library/library.mllib2
-rw-r--r--library/loadpath.ml6
-rw-r--r--library/nametab.ml74
-rw-r--r--library/nametab.mli31
-rw-r--r--library/summary.ml203
-rw-r--r--library/summary.mli41
-rw-r--r--library/univops.ml40
-rw-r--r--man/coqchk.110
-rw-r--r--man/coqmktop.171
-rw-r--r--parsing/egramcoq.ml15
-rw-r--r--parsing/g_constr.ml432
-rw-r--r--parsing/g_proofs.ml412
-rw-r--r--parsing/g_vernac.ml4164
-rw-r--r--parsing/pcoq.ml10
-rw-r--r--parsing/pcoq.mli9
-rw-r--r--plugins/.merlin1
-rw-r--r--plugins/btauto/refl_btauto.ml27
-rw-r--r--plugins/cc/ccalgo.ml29
-rw-r--r--plugins/cc/ccalgo.mli4
-rw-r--r--plugins/cc/ccproof.ml2
-rw-r--r--plugins/cc/ccproof.mli2
-rw-r--r--plugins/cc/cctac.ml8
-rw-r--r--plugins/derive/derive.ml10
-rw-r--r--plugins/extraction/extract_env.ml8
-rw-r--r--plugins/extraction/extract_env.mli2
-rw-r--r--plugins/extraction/extraction.ml35
-rw-r--r--plugins/extraction/extraction.mli2
-rw-r--r--plugins/extraction/g_extraction.ml410
-rw-r--r--plugins/extraction/haskell.ml3
-rw-r--r--plugins/extraction/ocaml.ml34
-rw-r--r--plugins/extraction/table.ml2
-rw-r--r--plugins/extraction/table.mli2
-rw-r--r--plugins/firstorder/formula.ml7
-rw-r--r--plugins/firstorder/formula.mli2
-rw-r--r--plugins/firstorder/g_ground.ml417
-rw-r--r--plugins/firstorder/ground.ml2
-rw-r--r--plugins/firstorder/instances.ml2
-rw-r--r--plugins/firstorder/rules.ml4
-rw-r--r--plugins/firstorder/rules.mli4
-rw-r--r--plugins/firstorder/sequent.ml12
-rw-r--r--plugins/firstorder/sequent.mli6
-rw-r--r--plugins/firstorder/unify.mli2
-rw-r--r--plugins/fourier/fourierR.ml24
-rw-r--r--plugins/funind/functional_principles_proofs.ml33
-rw-r--r--plugins/funind/functional_principles_types.ml65
-rw-r--r--plugins/funind/functional_principles_types.mli6
-rw-r--r--plugins/funind/g_indfun.ml42
-rw-r--r--plugins/funind/glob_term_to_relation.ml103
-rw-r--r--plugins/funind/glob_term_to_relation.mli2
-rw-r--r--plugins/funind/glob_termops.ml166
-rw-r--r--plugins/funind/glob_termops.mli30
-rw-r--r--plugins/funind/indfun.ml36
-rw-r--r--plugins/funind/indfun_common.ml33
-rw-r--r--plugins/funind/indfun_common.mli8
-rw-r--r--plugins/funind/invfun.ml25
-rw-r--r--plugins/funind/invfun.mli17
-rw-r--r--plugins/funind/merge.ml1004
-rw-r--r--plugins/funind/recdef.ml96
-rw-r--r--plugins/funind/recdef.mli8
-rw-r--r--plugins/funind/recdef_plugin.mlpack1
-rw-r--r--plugins/ltac/extraargs.ml44
-rw-r--r--plugins/ltac/extratactics.ml4128
-rw-r--r--plugins/ltac/g_auto.ml423
-rw-r--r--plugins/ltac/g_class.ml42
-rw-r--r--plugins/ltac/g_ltac.ml445
-rw-r--r--plugins/ltac/g_obligations.ml412
-rw-r--r--plugins/ltac/g_rewrite.ml439
-rw-r--r--plugins/ltac/pptactic.ml240
-rw-r--r--plugins/ltac/pptactic.mli25
-rw-r--r--plugins/ltac/profile_ltac.ml31
-rw-r--r--plugins/ltac/profile_ltac.mli37
-rw-r--r--plugins/ltac/profile_ltac_tactics.ml440
-rw-r--r--plugins/ltac/rewrite.ml72
-rw-r--r--plugins/ltac/rewrite.mli4
-rw-r--r--plugins/ltac/taccoerce.ml26
-rw-r--r--plugins/ltac/taccoerce.mli3
-rw-r--r--plugins/ltac/tacexpr.mli4
-rw-r--r--plugins/ltac/tacintern.ml11
-rw-r--r--plugins/ltac/tacinterp.ml100
-rw-r--r--plugins/ltac/tacsubst.ml9
-rw-r--r--plugins/ltac/tactic_debug.ml7
-rw-r--r--plugins/ltac/tactic_matching.ml4
-rw-r--r--plugins/micromega/MExtraction.v17
-rw-r--r--plugins/micromega/coq_micromega.ml30
-rw-r--r--plugins/micromega/micromega.ml16
-rw-r--r--plugins/micromega/persistent_cache.ml4
-rw-r--r--plugins/nsatz/nsatz.ml30
-rw-r--r--plugins/nsatz/nsatz.mli2
-rw-r--r--plugins/omega/coq_omega.ml56
-rw-r--r--plugins/quote/quote.ml14
-rw-r--r--plugins/romega/const_omega.ml117
-rw-r--r--plugins/romega/const_omega.mli155
-rw-r--r--plugins/romega/refl_omega.ml22
-rw-r--r--plugins/rtauto/refl_tauto.ml3
-rw-r--r--plugins/rtauto/refl_tauto.mli2
-rw-r--r--plugins/setoid_ring/ArithRing.v19
-rw-r--r--plugins/setoid_ring/g_newring.ml410
-rw-r--r--plugins/setoid_ring/newring.ml51
-rw-r--r--plugins/setoid_ring/newring_ast.mli2
-rw-r--r--plugins/ssr/ssrcommon.ml51
-rw-r--r--plugins/ssr/ssrcommon.mli6
-rw-r--r--plugins/ssr/ssrelim.ml8
-rw-r--r--plugins/ssr/ssrequality.ml41
-rw-r--r--plugins/ssr/ssrfwd.ml39
-rw-r--r--plugins/ssr/ssripats.ml2
-rw-r--r--plugins/ssr/ssrparser.ml42
-rw-r--r--plugins/ssr/ssrprinters.ml2
-rw-r--r--plugins/ssr/ssrvernac.ml440
-rw-r--r--plugins/ssrmatching/ssrmatching.ml4125
-rw-r--r--plugins/ssrmatching/ssrmatching.mli2
-rw-r--r--pretyping/arguments_renaming.ml11
-rw-r--r--pretyping/arguments_renaming.mli2
-rw-r--r--pretyping/cases.ml16
-rw-r--r--pretyping/cases.mli10
-rw-r--r--pretyping/cbv.ml54
-rw-r--r--pretyping/cbv.mli4
-rw-r--r--pretyping/classops.ml46
-rw-r--r--pretyping/classops.mli6
-rw-r--r--pretyping/constr_matching.ml114
-rw-r--r--pretyping/constr_matching.mli25
-rw-r--r--pretyping/detyping.ml135
-rw-r--r--pretyping/detyping.mli13
-rw-r--r--pretyping/evarconv.ml35
-rw-r--r--pretyping/evarconv.mli2
-rw-r--r--pretyping/evardefine.ml9
-rw-r--r--pretyping/evardefine.mli3
-rw-r--r--pretyping/evarsolve.ml5
-rw-r--r--pretyping/evarsolve.mli7
-rw-r--r--pretyping/find_subterm.ml3
-rw-r--r--pretyping/geninterp.ml (renamed from engine/geninterp.ml)0
-rw-r--r--pretyping/geninterp.mli (renamed from engine/geninterp.mli)0
-rw-r--r--pretyping/glob_ops.ml14
-rw-r--r--pretyping/glob_ops.mli4
-rw-r--r--pretyping/indrec.ml23
-rw-r--r--pretyping/indrec.mli20
-rw-r--r--pretyping/inductiveops.ml11
-rw-r--r--pretyping/inductiveops.mli22
-rw-r--r--pretyping/miscops.ml3
-rw-r--r--pretyping/nativenorm.ml39
-rw-r--r--pretyping/patternops.ml31
-rw-r--r--pretyping/pretype_errors.ml13
-rw-r--r--pretyping/pretype_errors.mli24
-rw-r--r--pretyping/pretyping.ml131
-rw-r--r--pretyping/pretyping.mli9
-rw-r--r--pretyping/pretyping.mllib1
-rw-r--r--pretyping/recordops.ml20
-rw-r--r--pretyping/recordops.mli10
-rw-r--r--pretyping/reductionops.ml189
-rw-r--r--pretyping/reductionops.mli18
-rw-r--r--pretyping/retyping.ml57
-rw-r--r--pretyping/retyping.mli10
-rw-r--r--pretyping/tacred.ml32
-rw-r--r--pretyping/typeclasses.ml33
-rw-r--r--pretyping/typeclasses.mli19
-rw-r--r--pretyping/typing.ml11
-rw-r--r--pretyping/typing.mli5
-rw-r--r--pretyping/unification.ml59
-rw-r--r--pretyping/unification.mli2
-rw-r--r--pretyping/univdecls.ml21
-rw-r--r--pretyping/vnorm.ml22
-rw-r--r--printing/genprint.ml66
-rw-r--r--printing/genprint.mli20
-rw-r--r--printing/ppconstr.ml47
-rw-r--r--printing/ppconstr.mli2
-rw-r--r--printing/pputils.ml16
-rw-r--r--printing/pputils.mli8
-rw-r--r--printing/ppvernac.ml205
-rw-r--r--printing/ppvernac.mli6
-rw-r--r--printing/prettyp.ml279
-rw-r--r--printing/prettyp.mli53
-rw-r--r--printing/printer.ml87
-rw-r--r--printing/printer.mli67
-rw-r--r--printing/printmod.ml64
-rw-r--r--printing/printmod.mli8
-rw-r--r--proofs/clenv.ml22
-rw-r--r--proofs/clenv.mli2
-rw-r--r--proofs/clenvtac.ml3
-rw-r--r--proofs/evar_refiner.mli2
-rw-r--r--proofs/goal.ml4
-rw-r--r--proofs/goal.mli2
-rw-r--r--proofs/logic.ml85
-rw-r--r--proofs/logic.mli8
-rw-r--r--proofs/miscprint.ml7
-rw-r--r--proofs/pfedit.ml8
-rw-r--r--proofs/pfedit.mli16
-rw-r--r--proofs/proof.ml13
-rw-r--r--proofs/proof.mli62
-rw-r--r--proofs/proof_bullet.ml8
-rw-r--r--proofs/proof_bullet.mli10
-rw-r--r--proofs/proof_global.ml76
-rw-r--r--proofs/proof_global.mli26
-rw-r--r--proofs/proof_type.ml2
-rw-r--r--proofs/redexpr.ml15
-rw-r--r--proofs/redexpr.mli2
-rw-r--r--proofs/refine.mli2
-rw-r--r--proofs/refiner.ml4
-rw-r--r--proofs/refiner.mli8
-rw-r--r--proofs/tacmach.ml13
-rw-r--r--proofs/tacmach.mli16
-rw-r--r--stm/asyncTaskQueue.ml70
-rw-r--r--stm/asyncTaskQueue.mli185
-rw-r--r--stm/coqworkmgrApi.ml25
-rw-r--r--stm/coqworkmgrApi.mli8
-rw-r--r--stm/proofBlockDelimiter.ml27
-rw-r--r--stm/spawned.ml6
-rw-r--r--stm/spawned.mli2
-rw-r--r--stm/stm.ml647
-rw-r--r--stm/stm.mli64
-rw-r--r--stm/vernac_classifier.ml100
-rw-r--r--stm/vernac_classifier.mli2
-rw-r--r--stm/workerLoop.ml6
-rw-r--r--stm/workerLoop.mli3
-rw-r--r--tactics/auto.ml9
-rw-r--r--tactics/autorewrite.ml8
-rw-r--r--tactics/autorewrite.mli8
-rw-r--r--tactics/class_tactics.ml24
-rw-r--r--tactics/eauto.ml24
-rw-r--r--tactics/elimschemes.ml3
-rw-r--r--tactics/elimschemes.mli4
-rw-r--r--tactics/eqschemes.ml7
-rw-r--r--tactics/eqschemes.mli12
-rw-r--r--tactics/equality.ml19
-rw-r--r--tactics/hints.ml86
-rw-r--r--tactics/hints.mli19
-rw-r--r--tactics/hipattern.ml82
-rw-r--r--tactics/hipattern.mli3
-rw-r--r--tactics/ind_tables.ml14
-rw-r--r--tactics/ind_tables.mli10
-rw-r--r--tactics/inv.ml20
-rw-r--r--tactics/leminv.ml24
-rw-r--r--tactics/leminv.mli2
-rw-r--r--tactics/tacticals.ml11
-rw-r--r--tactics/tacticals.mli17
-rw-r--r--tactics/tactics.ml200
-rw-r--r--tactics/tactics.mli2
-rw-r--r--tactics/term_dnet.ml38
-rw-r--r--tactics/term_dnet.mli2
-rw-r--r--test-suite/Makefile31
-rw-r--r--test-suite/README.md75
-rw-r--r--test-suite/bugs/5996.v8
-rw-r--r--test-suite/bugs/closed/3125.v27
-rw-r--r--test-suite/bugs/closed/3559.v1
-rw-r--r--test-suite/bugs/closed/3690.v75
-rw-r--r--test-suite/bugs/closed/4390.v6
-rw-r--r--test-suite/bugs/closed/4717.v37
-rw-r--r--test-suite/bugs/closed/5215.v286
-rw-r--r--test-suite/bugs/closed/5215_2.v8
-rw-r--r--test-suite/bugs/closed/5286.v9
-rw-r--r--test-suite/bugs/closed/5347.v10
-rw-r--r--test-suite/bugs/closed/5368.v6
-rw-r--r--test-suite/bugs/closed/5717.v5
-rw-r--r--test-suite/bugs/closed/5761.v126
-rw-r--r--test-suite/bugs/closed/5762.v6
-rw-r--r--test-suite/bugs/closed/5790.v7
-rw-r--r--test-suite/bugs/closed/6129.v9
-rw-r--r--test-suite/bugs/closed/6191.v16
-rw-r--r--test-suite/bugs/closed/6297.v8
-rw-r--r--test-suite/bugs/closed/6323.v9
-rw-r--r--test-suite/bugs/closed/6378.v18
-rw-r--r--test-suite/bugs/closed/6490.v4
-rw-r--r--test-suite/bugs/closed/6534.v7
-rw-r--r--test-suite/bugs/closed/6617.v34
-rw-r--r--test-suite/bugs/closed/HoTT_coq_064.v1
-rw-r--r--test-suite/bugs/closed/gh6165.v5
-rw-r--r--test-suite/bugs/closed/gh6384.v5
-rw-r--r--test-suite/bugs/closed/gh6385.v5
-rw-r--r--test-suite/bugs/opened/4717.v19
-rw-r--r--test-suite/bugs/opened/6393.v11
-rw-r--r--test-suite/coq-makefile/.gitignore1
-rwxr-xr-xtest-suite/coq-makefile/plugin-reach-outside-API-and-fail/run.sh38
-rwxr-xr-xtest-suite/coq-makefile/plugin-reach-outside-API-and-succeed-by-bypassing-the-API/run.sh33
-rwxr-xr-xtest-suite/coq-makefile/template/init.sh26
-rwxr-xr-xtest-suite/coq-makefile/template/path-init.sh5
-rw-r--r--test-suite/coq-makefile/template/src/test.ml41
-rw-r--r--test-suite/coq-makefile/template/src/test_aux.ml2
-rw-r--r--test-suite/coq-makefile/template/src/test_aux.mli2
-rw-r--r--test-suite/coq-makefile/timing/after/time-of-build-after.log.desired3
-rw-r--r--test-suite/coq-makefile/timing/after/time-of-build-before.log.desired3
-rw-r--r--test-suite/coq-makefile/timing/precomputed-time-tests/.gitattributes2
-rwxr-xr-xtest-suite/coq-makefile/timing/precomputed-time-tests/001-correct-diff-sorting-order/run.sh10
-rw-r--r--test-suite/coq-makefile/timing/precomputed-time-tests/001-correct-diff-sorting-order/time-of-build-after.log.in1760
-rw-r--r--test-suite/coq-makefile/timing/precomputed-time-tests/001-correct-diff-sorting-order/time-of-build-before.log.in1662
-rw-r--r--test-suite/coq-makefile/timing/precomputed-time-tests/001-correct-diff-sorting-order/time-of-build-both.log.expected26
-rwxr-xr-xtest-suite/coq-makefile/timing/precomputed-time-tests/002-single-file-sorting/run.sh10
-rw-r--r--test-suite/coq-makefile/timing/precomputed-time-tests/002-single-file-sorting/time-of-build-pretty.log.expected26
-rw-r--r--test-suite/coq-makefile/timing/precomputed-time-tests/002-single-file-sorting/time-of-build.log.in1760
-rwxr-xr-xtest-suite/coq-makefile/timing/precomputed-time-tests/run.sh10
-rwxr-xr-xtest-suite/coq-makefile/timing/run.sh25
-rw-r--r--test-suite/coqchk/include.v11
-rw-r--r--test-suite/coqchk/primproj2.v10
-rw-r--r--test-suite/coqdoc/bug5648.html.out18
-rw-r--r--test-suite/coqdoc/bug5648.tex.out12
-rw-r--r--test-suite/coqdoc/bug5700.html.out2
-rw-r--r--test-suite/coqdoc/bug5700.tex.out12
-rw-r--r--test-suite/coqdoc/links.html.out8
-rw-r--r--test-suite/coqdoc/links.tex.out14
-rw-r--r--test-suite/output-modulo-time/ltacprof.out13
-rw-r--r--test-suite/output-modulo-time/ltacprof_abstract.out17
-rw-r--r--test-suite/output-modulo-time/ltacprof_abstract.v8
-rw-r--r--test-suite/output-modulo-time/ltacprof_cutoff.out40
-rw-r--r--test-suite/output-modulo-time/ltacprof_cutoff.v34
-rw-r--r--test-suite/output/Cases.out51
-rw-r--r--test-suite/output/Cases.v32
-rw-r--r--test-suite/output/Extraction_infix.out20
-rw-r--r--test-suite/output/Extraction_infix.v26
-rw-r--r--test-suite/output/InvalidDisjunctiveIntro.out16
-rw-r--r--test-suite/output/InvalidDisjunctiveIntro.v18
-rw-r--r--test-suite/output/MExtraction.v12
-rw-r--r--test-suite/output/Notations.out4
-rw-r--r--test-suite/output/Notations.v6
-rw-r--r--test-suite/output/Notations2.out19
-rw-r--r--test-suite/output/Notations2.v29
-rw-r--r--test-suite/output/Notations3.out10
-rw-r--r--test-suite/output/Notations3.v62
-rw-r--r--test-suite/output/UnivBinders.out171
-rw-r--r--test-suite/output/UnivBinders.v139
-rw-r--r--test-suite/output/bug5778.out4
-rw-r--r--test-suite/output/bug5778.v7
-rw-r--r--test-suite/output/ltac.out9
-rw-r--r--test-suite/output/ltac.v11
-rw-r--r--test-suite/output/ltac_missing_args.out40
-rw-r--r--test-suite/output/optimize_heap.out8
-rw-r--r--test-suite/output/optimize_heap.v7
-rw-r--r--test-suite/prerequisite/bind_univs.v7
-rw-r--r--test-suite/success/BracketsWithGoalSelector.v16
-rw-r--r--test-suite/success/Check.v2
-rw-r--r--test-suite/success/Notations.v6
-rw-r--r--test-suite/success/Notations2.v15
-rw-r--r--test-suite/success/Typeclasses.v17
-rw-r--r--test-suite/success/abstract_poly.v2
-rw-r--r--test-suite/success/bteauto.v1
-rw-r--r--test-suite/success/dtauto-let-deps.v24
-rw-r--r--test-suite/success/extraction.v2
-rw-r--r--test-suite/success/polymorphism.v38
-rw-r--r--test-suite/success/unidecls.v121
-rw-r--r--theories/Arith/Between.v4
-rw-r--r--theories/Compat/Coq87.v3
-rw-r--r--theories/FSets/FSetCompat.v44
-rw-r--r--theories/Init/Tactics.v7
-rw-r--r--theories/Logic/FunctionalExtensionality.v3
-rw-r--r--theories/Program/Combinators.v12
-rw-r--r--theories/Sets/Powerset_facts.v91
-rw-r--r--tools/CoqMakefile.in45
-rw-r--r--tools/TimeFileMaker.py37
-rw-r--r--tools/coq_makefile.ml50
-rw-r--r--tools/coqdep.ml2
-rw-r--r--tools/coqmktop.ml314
-rw-r--r--tools/coqworkmgr.ml8
-rw-r--r--tools/inferior-coq.el (renamed from tools/coq-inferior.el)0
-rwxr-xr-xtools/make-both-single-timing-files.py18
-rwxr-xr-xtools/make-both-time-files.py18
-rw-r--r--tools/md5sum.ml24
-rw-r--r--toplevel/coqinit.ml120
-rw-r--r--toplevel/coqinit.mli9
-rw-r--r--toplevel/coqloop.ml10
-rw-r--r--toplevel/coqloop.mli4
-rw-r--r--toplevel/coqtop.ml185
-rw-r--r--toplevel/coqtop_bin.ml2
-rw-r--r--toplevel/coqtop_byte_bin.ml21
-rw-r--r--toplevel/coqtop_opt_bin.ml3
-rw-r--r--toplevel/vernac.ml28
-rw-r--r--toplevel/vernac.mli4
-rw-r--r--vernac/assumptions.ml18
-rw-r--r--vernac/assumptions.mli6
-rw-r--r--vernac/auto_ind_decl.ml30
-rw-r--r--vernac/class.ml73
-rw-r--r--vernac/classes.ml218
-rw-r--r--vernac/classes.mli3
-rw-r--r--vernac/comAssumption.ml182
-rw-r--r--vernac/comAssumption.mli34
-rw-r--r--vernac/comDefinition.ml132
-rw-r--r--vernac/comDefinition.mli30
-rw-r--r--vernac/comFixpoint.ml356
-rw-r--r--vernac/comFixpoint.mli93
-rw-r--r--vernac/comInductive.ml455
-rw-r--r--vernac/comInductive.mli65
-rw-r--r--vernac/comProgramFixpoint.ml342
-rw-r--r--vernac/comProgramFixpoint.mli12
-rw-r--r--vernac/command.ml1335
-rw-r--r--vernac/command.mli163
-rw-r--r--vernac/declareDef.ml12
-rw-r--r--vernac/declareDef.mli7
-rw-r--r--vernac/explainErr.ml4
-rw-r--r--vernac/himsg.ml138
-rw-r--r--vernac/himsg.mli2
-rw-r--r--vernac/indschemes.ml17
-rw-r--r--vernac/indschemes.mli10
-rw-r--r--vernac/lemmas.ml176
-rw-r--r--vernac/lemmas.mli16
-rw-r--r--vernac/locality.ml75
-rw-r--r--vernac/locality.mli21
-rw-r--r--vernac/metasyntax.ml14
-rw-r--r--vernac/mltop.ml36
-rw-r--r--vernac/mltop.mli24
-rw-r--r--vernac/obligations.ml217
-rw-r--r--vernac/obligations.mli25
-rw-r--r--vernac/record.ml239
-rw-r--r--vernac/record.mli26
-rw-r--r--vernac/search.ml2
-rw-r--r--vernac/search.mli2
-rw-r--r--vernac/topfmt.ml17
-rw-r--r--vernac/vernac.mllib7
-rw-r--r--vernac/vernacentries.ml668
-rw-r--r--vernac/vernacentries.mli16
-rw-r--r--vernac/vernacinterp.ml22
-rw-r--r--vernac/vernacinterp.mli20
-rw-r--r--vernac/vernacprop.ml48
-rw-r--r--vernac/vernacprop.mli19
-rw-r--r--vernac/vernacstate.ml41
-rw-r--r--vernac/vernacstate.mli19
823 files changed, 23523 insertions, 25206 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml
new file mode 100644
index 000000000..9b0cc2119
--- /dev/null
+++ b/.circleci/config.yml
@@ -0,0 +1,411 @@
+defaults:
+ params: &params
+ # Following parameters are used in Coq CircleCI Job (using yaml
+ # reference syntax)
+ working_directory: ~/coq
+ docker:
+ - image: ocaml/opam:ubuntu
+
+ environment: &envvars
+ # required by some of the targets, e.g. compcert, passed for
+ # instance to opam to configure the number of parallel jobs
+ # allowed
+ NJOBS: 2
+ COMPILER: "system"
+ CAMLP5_VER: "6.14"
+ NATIVE_COMP: "yes"
+
+ # some useful values
+ COMPILER_32BIT: &compiler-32bit "4.02.3+32bit"
+
+ COMPILER_BLEEDING_EDGE: &compiler-be "4.06.0"
+ CAMLP5_VER_BLEEDING_EDGE: &camlp5-ver-be "7.03"
+
+ TIMING_PACKAGES: &timing-packages "time python"
+
+ COQIDE_PACKAGES: &coqide-packages "libgtk2.0-dev libgtksourceview2.0-dev"
+ #COQIDE_PACKAGES_32BIT: "libgtk2.0-dev:i386 libgtksourceview2.0-dev:i386"
+ COQIDE_OPAM: &coqide-opam "lablgtk-extras"
+ COQIDE_OPAM_BE: &coqide-opam-be "num lablgtk.2.18.6 lablgtk-extras.1.6"
+ COQDOC_PACKAGES: &coqdoc-packages "texlive-latex-base texlive-latex-recommended texlive-latex-extra texlive-math-extra texlive-fonts-recommended texlive-fonts-extra latex-xcolor ghostscript transfig imagemagick tipa"
+ COQDOC_OPAM: &coqdoc-opam "hevea"
+
+version: 2
+
+before_script: &before_script
+ name: Install system packages
+ command: |
+ echo export TERM=xterm >> ~/.profile
+ source ~/.profile
+ printenv
+ #if [ "$COMPILER" = "$COMPILER_32BIT" ]; then sudo dpkg --add-architecture i386; fi
+ if [ -n "${EXTRA_PACKAGES}" ]; then sudo apt-get update -yq && sudo apt-get install -yq --no-install-recommends ${EXTRA_PACKAGES}; fi
+
+opam-switch: &opam-switch
+ name: Select opam switch
+ command: |
+ source ~/.profile
+ opam switch ${COMPILER}
+ opam config list
+ opam list
+
+.opam-boot-template: &opam-boot-template
+ <<: *params
+ steps:
+ - checkout
+ - run: *before_script
+ - run:
+ name: Cache selection
+ command: |
+ source ~/.profile
+ # We can't use environment variables in cache names
+ # So put it in a file and use the checksum
+ echo "$COMPILER" > COMPILER
+ - restore_cache:
+ keys:
+ - coq-opam-cache-v1-{{ arch }}-{{ checksum "COMPILER" }}-{{ checksum ".circleci/config.yml" }}-
+ - coq-opam-cache-v1-{{ arch }}-{{ checksum "COMPILER" }}- # this grabs old cache if checksum doesn't match
+ - run:
+ name: Update opam lists
+ command: |
+ source ~/.profile
+ opam repository set-url default https://opam.ocaml.org
+ opam update
+ - run:
+ name: Install opam packages
+ command: |
+ source ~/.profile
+ opam switch -j ${NJOBS} ${COMPILER}
+ opam install -j ${NJOBS} -y camlp5.${CAMLP5_VER} ocamlfind ${COQIDE_OPAM} ${COQDOC_OPAM} ${EXTRA_OPAM}
+ - run:
+ name: Clean cache
+ command: |
+ source ~/.profile
+ rm -rf ~/.opam/log/
+ - save_cache:
+ key: coq-opam-cache-v1-{{ arch }}-{{ checksum "COMPILER" }}-{{ checksum ".circleci/config.yml" }}-
+ paths:
+ - ~/.opam
+ - persist_to_workspace:
+ root: &workspace ~/
+ paths:
+ - .opam/
+
+.build-template: &build-template
+ <<: *params
+ steps:
+ - checkout
+ - run: *before_script
+ - attach_workspace: &attach_workspace
+ at: *workspace
+ - run: *opam-switch
+ - run: &build-configure
+ name: Configure
+ command: |
+ source ~/.profile
+
+ ./configure -local -native-compiler ${NATIVE_COMP} ${EXTRA_CONF}
+ - run: &build-build
+ name: Build
+ command: |
+ source ~/.profile
+ make -j ${NJOBS} byte
+ make -j ${NJOBS}
+ make test-suite/misc/universes/all_stdlib.v
+ - persist_to_workspace:
+ root: *workspace
+ paths:
+ - coq/
+
+ environment: &build-variables
+ <<: *envvars
+ EXTRA_CONF: "-coqide opt"
+ EXTRA_PACKAGES: *coqide-packages
+
+.validate-template: &validate-template
+ <<: *params
+ steps:
+ - run: *before_script
+ - attach_workspace: *attach_workspace
+ - run:
+ name: Validate
+ command: |
+ source ~/.profile
+ make validate
+ environment: *envvars
+
+.documentation-template: &documentation-template
+ <<: *params
+ steps:
+ - run: *before_script
+ - attach_workspace: *attach_workspace
+ - run:
+ name: Documentation
+ command: |
+ source ~/.profile
+ make -j ${NJOBS} doc
+ environment: &documentation-variables
+ <<: *envvars
+ EXTRA_PACKAGES: *coqdoc-packages
+
+.test-suite-template: &test-suite-template
+ <<: *params
+ steps:
+ - run: *before_script
+ - attach_workspace: *attach_workspace
+ - run:
+ name: Test
+ command: |
+ source ~/.profile
+ cd test-suite
+ make clean
+ make -j ${NJOBS} all
+ environment: &test-suite-variables
+ <<: *envvars
+ EXTRA_PACKAGES: *timing-packages
+
+.ci-template: &ci-template
+ <<: *params
+ steps:
+ - run: *before_script
+ - attach_workspace: *attach_workspace
+ - run:
+ name: Test
+ command: |
+ source ~/.profile
+ dev/ci/ci-wrapper.sh ${CIRCLE_JOB}
+ - persist_to_workspace:
+ root: *workspace
+ paths:
+ - coq/
+ environment: &ci-template-vars
+ <<: *envvars
+ EXTRA_PACKAGES: *timing-packages
+
+# Defines individual jobs, see the workflows section below for job orchestration
+jobs:
+ # TODO: linter
+
+ opam-boot:
+ <<: *opam-boot-template
+ environment:
+ <<: *envvars
+ EXTRA_PACKAGES: *coqide-packages
+ EXTRA_OPAM: "ocamlgraph"
+
+ opam-boot-32bit:
+ <<: *opam-boot-template
+ environment:
+ <<: *envvars
+ EXTRA_PACKAGES: "gcc-multilib"
+ COMPILER: *compiler-32bit
+ COQIDE_OPAM: ""
+ COQDOC_OPAM: ""
+
+ opam-boot-be:
+ <<: *opam-boot-template
+ environment:
+ <<: *envvars
+ EXTRA_PACKAGES: *coqide-packages
+ COMPILER: *compiler-be
+ CAMLP5_VER: *camlp5-ver-be
+ COQIDE_OPAM: *coqide-opam-be
+
+ # Build and prepare test environment
+ build: *build-template
+
+ build-32bit:
+ <<: *build-template
+ environment:
+ <<: *envvars # no coqide for 32bit
+ EXTRA_PACKAGES: "gcc-multilib"
+ COMPILER: *compiler-32bit
+
+ build-be:
+ <<: *build-template
+ environment:
+ <<: *build-variables
+ COMPILER: *compiler-be
+
+ validate: *validate-template
+
+ validate-32bit:
+ <<: *validate-template
+ environment:
+ <<: *envvars
+ COMPILER: *compiler-32bit
+ EXTRA_PACKAGES: "gcc-multilib"
+
+ documentation: *documentation-template
+
+ documentation-be:
+ <<: *documentation-template
+ environment:
+ <<: *documentation-variables
+ COMPILER: *compiler-be
+ CAMLP5_VER: *camlp5-ver-be
+
+ test-suite:
+ <<: *test-suite-template
+
+ test-suite-32bit:
+ <<: *test-suite-template
+ environment:
+ <<: *test-suite-variables
+ COMPILER: *compiler-32bit
+ EXTRA_PACKAGES: "gcc-multilib time python"
+
+ test-suite-be:
+ <<: *test-suite-template
+ environment:
+ <<: *test-suite-variables
+ COMPILER: *compiler-be
+ EXTRA_PACKAGES: *timing-packages
+
+ bignums:
+ <<: *ci-template
+
+ color:
+ <<: *ci-template
+ environment:
+ <<: *ci-template-vars
+ EXTRA_PACKAGES: *timing-packages
+
+ compcert:
+ <<: *ci-template
+
+ coq-dpdgraph:
+ <<: *ci-template
+ environment:
+ <<: *ci-template-vars
+ EXTRA_PACKAGES: "time python autoconf automake"
+
+ coquelicot:
+ <<: *ci-template
+ environment:
+ <<: *ci-template-vars
+ EXTRA_PACKAGES: "time python autoconf automake"
+
+ equations:
+ <<: *ci-template
+
+ geocoq:
+ <<: *ci-template
+
+ fiat-crypto:
+ <<: *ci-template
+
+ fiat-parsers:
+ <<: *ci-template
+ environment:
+ <<: *ci-template-vars
+ EXTRA_PACKAGES: *timing-packages
+
+ flocq:
+ <<: *ci-template
+ environment:
+ <<: *ci-template-vars
+ EXTRA_PACKAGES: "time python autoconf automake"
+
+ math-classes:
+ <<: *ci-template
+
+ corn:
+ <<: *ci-template
+
+ formal-topology:
+ <<: *ci-template
+
+ hott:
+ <<: *ci-template
+ environment:
+ <<: *ci-template-vars
+ EXTRA_PACKAGES: "time python autoconf automake"
+
+ iris-lambda-rust:
+ <<: *ci-template
+
+ ltac2:
+ <<: *ci-template
+
+ math-comp:
+ <<: *ci-template
+
+ sf:
+ <<: *ci-template
+ environment:
+ <<: *ci-template-vars
+ EXTRA_PACKAGES: "time python wget"
+
+ unimath:
+ <<: *ci-template
+
+ vst:
+ <<: *ci-template
+
+workflows:
+ version: 2
+ # Run on each push
+ main:
+ jobs:
+ - opam-boot
+ - opam-boot-32bit
+ - opam-boot-be
+
+ - build:
+ requires:
+ - opam-boot
+ - validate: &req-main
+ requires:
+ - build
+ - test-suite: *req-main
+ - documentation: *req-main
+
+ - bignums: *req-main
+ - color:
+ requires:
+ - build
+ - bignums
+ - compcert: *req-main
+ - coq-dpdgraph: *req-main
+ - coquelicot: *req-main
+ - equations: *req-main
+ - geocoq: *req-main
+ - fiat-crypto: *req-main
+ - fiat-parsers: *req-main
+ - flocq: *req-main
+ - math-classes:
+ requires:
+ - build
+ - bignums
+ - corn:
+ requires:
+ - build
+ - math-classes
+ - formal-topology:
+ requires:
+ - build
+ - corn
+ - hott: *req-main
+ - iris-lambda-rust: *req-main
+ - ltac2: *req-main
+ - math-comp: *req-main
+ - sf: *req-main
+ - unimath: *req-main
+ - vst: *req-main
+
+ - build-32bit:
+ requires:
+ - opam-boot-32bit
+ - validate-32bit: &req-32bit
+ requires:
+ - build-32bit
+ - test-suite-32bit: *req-32bit
+
+ - build-be:
+ requires:
+ - opam-boot-be
+ - test-suite-be: &req-be
+ requires:
+ - build-be
+ - documentation-be: *req-be
diff --git a/.gitattributes b/.gitattributes
index f2c096f2d..51fa208a7 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -2,6 +2,8 @@
.gitignore export-ignore
.mailmap export-ignore
+*.out -whitespace
+
*.asciidoc whitespace=trailing-space,tab-in-indent
*.bat whitespace=cr-at-eol,trailing-space,tab-in-indent
*.bib whitespace=trailing-space,tab-in-indent
diff --git a/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
index c9cb516cd..c9cb516cd 100644
--- a/ISSUE_TEMPLATE.md
+++ b/.github/ISSUE_TEMPLATE.md
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 000000000..a9230042a
--- /dev/null
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,16 @@
+<!-- Thank you for your contribution.
+ Make sure you read the contributing guide and fill this template. -->
+
+
+<!-- Keep what applies -->
+**Kind:** documentation / bug fix / feature / performance / infrastructure.
+
+
+<!-- If this is a bug fix, make sure the bug was reported beforehand. -->
+Fixes / closes #????
+
+
+<!-- If this is a feature pull request / breaks compatibility: -->
+<!-- (Otherwise, remove these lines.) -->
+- [ ] Corresponding documentation was added / updated.
+- [ ] Entry added in CHANGES.
diff --git a/.gitignore b/.gitignore
index 36536ec96..1e7f982a5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -82,11 +82,10 @@ test-suite/coq-makefile/*/html
test-suite/coq-makefile/*/mlihtml
test-suite/coq-makefile/*/subdir/done
test-suite/coq-makefile/merlin1/.merlin
-test-suite/coq-makefile/plugin-reach-outside-API-and-fail/_CoqProject
-test-suite/coq-makefile/plugin-reach-outside-API-and-succeed-by-bypassing-the-API/_CoqProject
test-suite/coqdoc/Coqdoc.*
test-suite/coqdoc/index.html
test-suite/coqdoc/coqdoc.css
+test-suite/output/MExtraction.out
# documentation
@@ -157,7 +156,6 @@ plugins/ssr/ssrvernac.ml
kernel/byterun/coq_jumptbl.h
kernel/copcodes.ml
-tools/tolink.ml
ide/index_urls.txt
.lia.cache
checker/names.ml
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 1814aaff1..6b52870ce 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -18,14 +18,15 @@ variables:
# some useful values
COMPILER_32BIT: "4.02.3+32bit"
- COMPILER_BLEEDING_EDGE: "4.05.0"
- CAMLP5_VER_BLEEDING_EDGE: "7.01"
+ COMPILER_BLEEDING_EDGE: "4.06.0"
+ CAMLP5_VER_BLEEDING_EDGE: "7.03"
TIMING_PACKAGES: "time python"
COQIDE_PACKAGES: "libgtk2.0-dev libgtksourceview2.0-dev"
#COQIDE_PACKAGES_32BIT: "libgtk2.0-dev:i386 libgtksourceview2.0-dev:i386"
COQIDE_OPAM: "lablgtk-extras"
+ COQIDE_OPAM_BE: "num lablgtk.2.18.6 lablgtk-extras.1.6"
COQDOC_PACKAGES: "texlive-latex-base texlive-latex-recommended texlive-latex-extra texlive-math-extra texlive-fonts-recommended texlive-fonts-extra latex-xcolor ghostscript transfig imagemagick tipa"
COQDOC_OPAM: "hevea"
@@ -70,12 +71,14 @@ before_script:
- echo 'end:coq.config'
- echo 'start:coq.build'
+ - make -j ${NJOBS} byte
- make -j ${NJOBS}
- make test-suite/misc/universes/all_stdlib.v
- echo 'end:coq:build'
- echo 'start:coq.install'
- make install
+ - make install-byte
- cp bin/fake_ide _install_ci/bin/
- echo 'end:coq.install'
@@ -102,7 +105,7 @@ before_script:
- set +e
variables: &warnings-variables
- EXTRA_CONF: "-native-compiler yes -coqide opt"
+ EXTRA_CONF: "-native-compiler yes -coqide byte -byte-only"
EXTRA_PACKAGES: "$COQIDE_PACKAGES"
EXTRA_OPAM: "$COQIDE_OPAM"
@@ -133,7 +136,6 @@ before_script:
stage: test
script:
- INSTALLDIR=$(readlink -f _install_ci)
- - ./configure -prefix "$INSTALLDIR" ${EXTRA_CONF}
- cp "$INSTALLDIR/lib/coq/tools/coqdoc/coqdoc.sty" .
- LIB="$INSTALLDIR/lib/coq"
@@ -183,6 +185,7 @@ build:bleeding-edge:
<<: *build-variables
COMPILER: "$COMPILER_BLEEDING_EDGE"
CAMLP5_VER: "$CAMLP5_VER_BLEEDING_EDGE"
+ EXTRA_OPAM: "$COQIDE_OPAM_BE"
warnings:
<<: *warnings-template
@@ -200,6 +203,7 @@ warnings:bleeding-edge:
<<: *warnings-variables
COMPILER: "$COMPILER_BLEEDING_EDGE"
CAMLP5_VER: "$CAMLP5_VER_BLEEDING_EDGE"
+ EXTRA_OPAM: "$COQIDE_OPAM_BE"
test-suite:
<<: *test-suite-template
@@ -263,7 +267,7 @@ ci-color:
<<: *ci-template
variables:
<<: *ci-template-vars
- EXTRA_PACKAGES: "$TIMING_PACKAGES subversion"
+ EXTRA_PACKAGES: "$TIMING_PACKAGES"
ci-compcert:
<<: *ci-template
@@ -281,6 +285,9 @@ ci-coquelicot:
<<: *ci-template-vars
EXTRA_PACKAGES: "$TIMING_PACKAGES autoconf"
+ci-equations:
+ <<: *ci-template
+
ci-geocoq:
<<: *ci-template
allow_failure: true
@@ -314,6 +321,9 @@ ci-hott:
ci-iris-lambda-rust:
<<: *ci-template
+ci-ltac2:
+ <<: *ci-template
+
ci-math-classes:
<<: *ci-template
diff --git a/.merlin b/.merlin
index 21555f5e5..d60f5037b 100644
--- a/.merlin
+++ b/.merlin
@@ -1,17 +1,17 @@
FLG -rectypes -thread -safe-string -w +a-4-9-27-41-42-44-45-48-50
+S clib
+B clib
S config
B config
-S ide
-B ide
S lib
B lib
-S intf
-B intf
S kernel
B kernel
S kernel/byterun
B kernel/byterun
+S intf
+B intf
S library
B library
S engine
@@ -30,14 +30,16 @@ S parsing
B parsing
S stm
B stm
-S toplevel
-B toplevel
S vernac
B vernac
+S toplevel
+B toplevel
S plugins/ltac
B plugins/ltac
S API
B API
+S ide
+B ide
S tools
B tools
diff --git a/.travis.yml b/.travis.yml
index 3b90f7cf4..19e7075f2 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -20,52 +20,103 @@ addons:
apt:
sources:
- avsm
- packages:
- - opam
- - aspcud
- - gcc-multilib
+## Due to issues like
+## https://github.com/travis-ci/travis-ci/issues/8507 ,
+## https://github.com/travis-ci/travis-ci/issues/9000 ,
+## https://github.com/travis-ci/travis-ci/issues/9081 , and
+## https://github.com/travis-ci/travis-ci/issues/9126 , we get frequent
+## failures with using `packages`. Therefore, for most targets, we
+## instead invoke `apt-get update` manually with `travis_retry` before
+## invoking `apt-get install`, manually, below in the `install:`
+## target.
+# packages:
+# - opam
+# - aspcud
+# - gcc-multilib
env:
global:
- NJOBS=2
# system is == 4.02.3
- COMPILER="system"
+ - COMPILER_BE="4.06.0"
- CAMLP5_VER="6.14"
+ - CAMLP5_VER_BE="7.03"
- FINDLIB_VER="1.4.1"
+ - FINDLIB_VER_BE="1.7.3"
+ - LABLGTK="lablgtk.2.18.3 lablgtk-extras.1.6"
+ - LABLGTK_BE="lablgtk.2.18.6 lablgtk-extras.1.6"
- NATIVE_COMP="yes"
- COQ_DEST="-local"
+ - MAIN_TARGET="world"
# Main test suites
matrix:
- TEST_TARGET="test-suite" COMPILER="4.02.3+32bit"
- - TEST_TARGET="test-suite" COMPILER="4.06.0+trunk" CAMLP5_VER="7.03" EXTRA_OPAM="num" FINDLIB_VER="1.7.3"
- TEST_TARGET="validate" TW="travis_wait"
- TEST_TARGET="validate" COMPILER="4.02.3+32bit" TW="travis_wait"
- - TEST_TARGET="validate" COMPILER="4.06.0+trunk+flambda" CAMLP5_VER="7.03" NATIVE_COMP="no" EXTRA_CONF="-flambda-opts -O3" EXTRA_OPAM="num" FINDLIB_VER="1.7.3"
- - TEST_TARGET="ci-bignums TIMED=1"
- - TEST_TARGET="ci-color TIMED=1"
- - TEST_TARGET="ci-compcert TIMED=1"
- - TEST_TARGET="ci-coq-dpdgraph" EXTRA_OPAM="ocamlgraph"
- - TEST_TARGET="ci-coquelicot TIMED=1"
- - TEST_TARGET="ci-geocoq TIMED=1"
- - TEST_TARGET="ci-fiat-crypto TIMED=1"
- - TEST_TARGET="ci-fiat-parsers TIMED=1"
- - TEST_TARGET="ci-flocq TIMED=1"
- - TEST_TARGET="ci-formal-topology TIMED=1"
- - TEST_TARGET="ci-hott TIMED=1"
- - TEST_TARGET="ci-iris-lambda-rust TIMED=1"
- - TEST_TARGET="ci-math-classes TIMED=1"
- - TEST_TARGET="ci-math-comp TIMED=1"
- - TEST_TARGET="ci-sf TIMED=1"
- - TEST_TARGET="ci-unimath TIMED=1"
- - TEST_TARGET="ci-vst TIMED=1"
- # Not ready yet for 8.7
- # - TEST_TARGET="ci-cpdt TIMED=1"
- # - TEST_TARGET="ci-metacoq TIMED=1"
- # - TEST_TARGET="ci-tlc TIMED=1"
+ - TEST_TARGET="validate" COMPILER="${COMPILER_BE}+flambda" CAMLP5_VER="${CAMLP5_VER_BE}" NATIVE_COMP="no" EXTRA_CONF="-flambda-opts -O3" EXTRA_OPAM="num" FINDLIB_VER="${FINDLIB_VER_BE}"
matrix:
include:
+ - if: NOT (type = pull_request)
+ env:
+ - TEST_TARGET="ci-bignums"
+ - if: NOT (type = pull_request)
+ env:
+ - TEST_TARGET="ci-color"
+ - if: NOT (type = pull_request)
+ env:
+ - TEST_TARGET="ci-compcert"
+ - if: NOT (type = pull_request)
+ env:
+ - TEST_TARGET="ci-coq-dpdgraph" EXTRA_OPAM="ocamlgraph"
+ - if: NOT (type = pull_request)
+ env:
+ - TEST_TARGET="ci-coquelicot"
+ - if: NOT (type = pull_request)
+ env:
+ - TEST_TARGET="ci-equations"
+ - if: NOT (type = pull_request)
+ env:
+ - TEST_TARGET="ci-geocoq"
+ - if: NOT (type = pull_request)
+ env:
+ - TEST_TARGET="ci-fiat-crypto"
+ - if: NOT (type = pull_request)
+ env:
+ - TEST_TARGET="ci-fiat-parsers"
+ - if: NOT (type = pull_request)
+ env:
+ - TEST_TARGET="ci-flocq"
+ - if: NOT (type = pull_request)
+ env:
+ - TEST_TARGET="ci-formal-topology"
+ - if: NOT (type = pull_request)
+ env:
+ - TEST_TARGET="ci-hott"
+ - if: NOT (type = pull_request)
+ env:
+ - TEST_TARGET="ci-iris-lambda-rust"
+ - if: NOT (type = pull_request)
+ env:
+ - TEST_TARGET="ci-ltac2"
+ - if: NOT (type = pull_request)
+ env:
+ - TEST_TARGET="ci-math-classes"
+ - if: NOT (type = pull_request)
+ env:
+ - TEST_TARGET="ci-math-comp"
+ - if: NOT (type = pull_request)
+ env:
+ - TEST_TARGET="ci-sf"
+ - if: NOT (type = pull_request)
+ env:
+ - TEST_TARGET="ci-unimath"
+ - if: NOT (type = pull_request)
+ env:
+ - TEST_TARGET="ci-vst"
+
- env:
- TEST_TARGET="lint"
install: []
@@ -81,7 +132,7 @@ matrix:
- env:
- TEST_TARGET="test-suite"
- EXTRA_CONF="-coqide opt -with-doc yes"
- - EXTRA_OPAM="lablgtk-extras hevea"
+ - EXTRA_OPAM="hevea ${LABLGTK}"
addons:
apt:
sources:
@@ -105,11 +156,11 @@ matrix:
- env:
- TEST_TARGET="test-suite"
- - COMPILER="4.05.0"
- - FINDLIB_VER="1.7.3"
- - CAMLP5_VER="7.03"
+ - COMPILER="${COMPILER_BE}"
+ - FINDLIB_VER="${FINDLIB_VER_BE}"
+ - CAMLP5_VER="${CAMLP5_VER_BE}"
- EXTRA_CONF="-coqide opt -with-doc yes"
- - EXTRA_OPAM="lablgtk-extras hevea"
+ - EXTRA_OPAM="num hevea ${LABLGTK_BE}"
addons:
apt:
sources:
@@ -119,12 +170,12 @@ matrix:
# Full test-suite with flambda
- env:
- TEST_TARGET="test-suite"
- - COMPILER="4.05.0+flambda"
- - FINDLIB_VER="1.7.3"
- - CAMLP5_VER="7.03"
+ - COMPILER="${COMPILER_BE}+flambda"
+ - FINDLIB_VER="${FINDLIB_VER_BE}"
+ - CAMLP5_VER="${CAMLP5_VER_BE}"
- NATIVE_COMP="no"
- EXTRA_CONF="-coqide opt -with-doc yes -flambda-opts -O3"
- - EXTRA_OPAM="lablgtk-extras hevea"
+ - EXTRA_OPAM="num hevea ${LABLGTK_BE}"
addons:
apt:
sources:
@@ -133,9 +184,9 @@ matrix:
# Ocaml warnings with two compilers
- env:
- - TEST_TARGET="coqocaml"
- - EXTRA_CONF="-coqide opt -warn-error"
- - EXTRA_OPAM="lablgtk-extras hevea"
+ - MAIN_TARGET="coqocaml"
+ - EXTRA_CONF="-byte-only -coqide byte -warn-error"
+ - EXTRA_OPAM="hevea ${LABLGTK}"
# dummy target
- BUILD_TARGET="clean"
addons:
@@ -149,12 +200,12 @@ matrix:
- libgtksourceview2.0-dev
- env:
- - TEST_TARGET="coqocaml"
- - COMPILER="4.05.0"
- - CAMLP5_VER="7.03"
- - FINDLIB_VER="1.7.3"
- - EXTRA_CONF="-coqide opt -warn-error"
- - EXTRA_OPAM="lablgtk-extras hevea"
+ - MAIN_TARGET="coqocaml"
+ - COMPILER="${COMPILER_BE}"
+ - FINDLIB_VER="${FINDLIB_VER_BE}"
+ - CAMLP5_VER="${CAMLP5_VER_BE}"
+ - EXTRA_CONF="-byte-only -coqide byte -warn-error"
+ - EXTRA_OPAM="num hevea ${LABLGTK_BE}"
# dummy target
- BUILD_TARGET="clean"
addons:
@@ -176,6 +227,7 @@ matrix:
- if: NOT (type = pull_request)
os: osx
+ osx_image: xcode7.3
env:
- TEST_TARGET=""
- COMPILER="4.02.3"
@@ -183,7 +235,7 @@ matrix:
- NATIVE_COMP="no"
- COQ_DEST="-prefix ${PWD}/_install"
- EXTRA_CONF="-coqide opt -warn-error"
- - EXTRA_OPAM="lablgtk-extras"
+ - EXTRA_OPAM="${LABLGTK}"
before_install:
- brew update
- brew install opam gnu-time gtk+ expat gtksourceview libxml2 gdk-pixbuf python3
@@ -204,6 +256,8 @@ before_install:
- if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then echo "Tested commit (followed by parent commits):"; git log -1; for commit in `git log -1 --format="%P"`; do echo; git log -1 $commit; done; fi
install:
+- if [ "${TRAVIS_OS_NAME}" == "linux" ]; then travis_retry ./dev/tools/sudo-apt-get-update.sh -q; fi
+- if [ "${TRAVIS_OS_NAME}" == "linux" ]; then sudo apt-get install -y opam aspcud gcc-multilib; fi
- opam init -j ${NJOBS} --compiler=${COMPILER} -n -y
- eval $(opam config env)
- opam config list
@@ -218,11 +272,11 @@ script:
- echo -en 'travis_fold:end:coq.config\\r'
- echo 'Building Coq...' && echo -en 'travis_fold:start:coq.build\\r'
-- make -j ${NJOBS}
+- make -j ${NJOBS} ${MAIN_TARGET}
- echo -en 'travis_fold:end:coq.build\\r'
- echo 'Running tests...' && echo -en 'travis_fold:start:coq.test\\r'
-- ${TW} make -j ${NJOBS} ${TEST_TARGET}
+- if [ -n "${TEST_TARGET}" ]; then ${TW} make -j ${NJOBS} ${TEST_TARGET}; fi
- echo -en 'travis_fold:end:coq.test\\r'
- set +e
diff --git a/API/API.ml b/API/API.ml
deleted file mode 100644
index 6e61063e4..000000000
--- a/API/API.ml
+++ /dev/null
@@ -1,283 +0,0 @@
-(************************************************************************)
-(* v * The Coq Proof Assistant / The Coq Development Team *)
-(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *)
-(* \VV/ **************************************************************)
-(* // * This file is distributed under the terms of the *)
-(* * GNU Lesser General Public License Version 2.1 *)
-(************************************************************************)
-
-(* Warning, this file respects the dependency order established in Coq.
-
- To see such order issue the comand:
-
- ```
- bash -c 'for i in kernel intf library engine pretyping interp proofs parsing printing tactics vernac stm toplevel; do echo -e "\n## $i files" && cat ${i}/${i}.mllib; done > API/link
- ```
- *)
-
-(******************************************************************************)
-(* config *)
-(******************************************************************************)
-module Coq_config = Coq_config
-
-(******************************************************************************)
-(* Kernel *)
-(******************************************************************************)
-(* "mli" files *)
-module Declarations = Declarations
-module Entries = Entries
-
-module Names = Names
-(* module Uint31 *)
-module Univ = Univ
-module UGraph = UGraph
-module Esubst = Esubst
-module Sorts = Sorts
-module Evar = Evar
-module Constr = Constr
-module Context = Context
-module Vars = Vars
-module Term = Term
-module Mod_subst = Mod_subst
-module Cbytecodes = Cbytecodes
-(* module Copcodes *)
-module Cemitcodes = Cemitcodes
-(* module Nativevalues *)
-(* module CPrimitives *)
-module Opaqueproof = Opaqueproof
-module Declareops = Declareops
-module Retroknowledge = Retroknowledge
-module Conv_oracle = Conv_oracle
-(* module Pre_env *)
-(* module Cbytegen *)
-(* module Nativelambda *)
-(* module Nativecode *)
-(* module Nativelib *)
-module Environ = Environ
-module CClosure = CClosure
-module Reduction = Reduction
-(* module Nativeconv *)
-module Type_errors = Type_errors
-module Modops = Modops
-module Inductive = Inductive
-module Typeops = Typeops
-(* module Indtypes *)
-(* module Cooking *)
-(* module Term_typing *)
-(* module Subtyping *)
-module Mod_typing = Mod_typing
-(* module Nativelibrary *)
-module Safe_typing = Safe_typing
-(* module Vm *)
-(* module Csymtable *)
-(* module Vconv *)
-
-(******************************************************************************)
-(* Intf *)
-(******************************************************************************)
-module Constrexpr = Constrexpr
-module Locus = Locus
-module Glob_term = Glob_term
-module Extend = Extend
-module Misctypes = Misctypes
-module Decl_kinds = Decl_kinds
-module Vernacexpr = Vernacexpr
-module Notation_term = Notation_term
-module Evar_kinds = Evar_kinds
-module Genredexpr = Genredexpr
-
-(******************************************************************************)
-(* Library *)
-(******************************************************************************)
-module Univops = Univops
-module Nameops = Nameops
-module Libnames = Libnames
-module Globnames = Globnames
-module Libobject = Libobject
-module Summary = Summary
-module Nametab = Nametab
-module Global = Global
-module Lib = Lib
-module Declaremods = Declaremods
-(* module Loadpath *)
-module Library = Library
-module States = States
-module Kindops = Kindops
-(* module Dischargedhypsmap *)
-module Goptions = Goptions
-(* module Decls *)
-(* module Heads *)
-module Keys = Keys
-module Coqlib = Coqlib
-
-(******************************************************************************)
-(* Engine *)
-(******************************************************************************)
-(* module Logic_monad *)
-module Universes = Universes
-module UState = UState
-module Evd = Evd
-module EConstr = EConstr
-module Tactypes = Tactypes
-module Pattern = Pattern
-module Namegen = Namegen
-module Termops = Termops
-module Proofview_monad = Proofview_monad
-module Evarutil = Evarutil
-module Proofview = Proofview
-module Ftactic = Ftactic
-module Geninterp = Geninterp
-
-(******************************************************************************)
-(* Pretyping *)
-(******************************************************************************)
-module Ltac_pretype = Ltac_pretype
-module Locusops = Locusops
-module Pretype_errors = Pretype_errors
-module Reductionops = Reductionops
-module Inductiveops = Inductiveops
-(* module Vnorm *)
-(* module Arguments_renaming *)
-module Impargs = Impargs
-(* module Nativenorm *)
-module Retyping = Retyping
-(* module Cbv *)
-module Find_subterm = Find_subterm
-(* module Evardefine *)
-module Evarsolve = Evarsolve
-module Recordops = Recordops
-module Evarconv = Evarconv
-module Typing = Typing
-module Miscops = Miscops
-module Glob_ops = Glob_ops
-module Redops = Redops
-module Patternops = Patternops
-module Constr_matching = Constr_matching
-module Tacred = Tacred
-module Typeclasses = Typeclasses
-module Classops = Classops
-(* module Program *)
-(* module Coercion *)
-module Detyping = Detyping
-module Indrec = Indrec
-(* module Cases *)
-module Pretyping = Pretyping
-module Unification = Unification
-module Univdecls = Univdecls
-(******************************************************************************)
-(* interp *)
-(******************************************************************************)
-module Stdarg = Stdarg
-module Genintern = Genintern
-module Constrexpr_ops = Constrexpr_ops
-module Notation_ops = Notation_ops
-module Notation = Notation
-module Dumpglob = Dumpglob
-(* module Syntax_def *)
-module Smartlocate = Smartlocate
-module Topconstr = Topconstr
-(* module Reserve *)
-(* module Implicit_quantifiers *)
-module Constrintern = Constrintern
-(* module Modintern *)
-module Constrextern = Constrextern
-(* module Discharge *)
-module Declare = Declare
-
-(******************************************************************************)
-(* Proofs *)
-(******************************************************************************)
-module Miscprint = Miscprint
-module Goal = Goal
-module Evar_refiner = Evar_refiner
-(* module Proof_using *)
-module Proof_type = Proof_type
-module Logic = Logic
-module Refine = Refine
-module Proof = Proof
-module Proof_bullet = Proof_bullet
-module Proof_global = Proof_global
-module Redexpr = Redexpr
-module Refiner = Refiner
-module Tacmach = Tacmach
-module Pfedit = Pfedit
-module Clenv = Clenv
-(* module Clenvtac *)
-(* "mli" file *)
-
-(******************************************************************************)
-(* Printing *)
-(******************************************************************************)
-module Genprint = Genprint
-module Pputils = Pputils
-module Ppconstr = Ppconstr
-module Printer = Printer
-(* module Printmod *)
-module Prettyp = Prettyp
-module Ppvernac = Ppvernac
-
-(******************************************************************************)
-(* Parsing *)
-(******************************************************************************)
-module Tok = Tok
-module CLexer = CLexer
-module Pcoq = Pcoq
-module Egramml = Egramml
-(* Egramcoq *)
-
-module G_vernac = G_vernac
-module G_proofs = G_proofs
-
-(******************************************************************************)
-(* Tactics *)
-(******************************************************************************)
-(* module Dnet *)
-(* module Dn *)
-(* module Btermdn *)
-module Tacticals = Tacticals
-module Hipattern = Hipattern
-module Ind_tables = Ind_tables
-(* module Eqschemes *)
-module Elimschemes = Elimschemes
-module Tactics = Tactics
-module Elim = Elim
-module Equality = Equality
-module Contradiction = Contradiction
-module Inv = Inv
-module Leminv = Leminv
-module Hints = Hints
-module Auto = Auto
-module Eauto = Eauto
-module Class_tactics = Class_tactics
-(* module Term_dnet *)
-module Eqdecide = Eqdecide
-module Autorewrite = Autorewrite
-
-(******************************************************************************)
-(* Vernac *)
-(******************************************************************************)
-(* module Vernacprop *)
-module Lemmas = Lemmas
-module Himsg = Himsg
-module ExplainErr = ExplainErr
-(* module Class *)
-module Locality = Locality
-module Metasyntax = Metasyntax
-(* module Auto_ind_decl *)
-module Search = Search
-(* module Indschemes *)
-module Obligations = Obligations
-module Command = Command
-module Classes = Classes
-(* module Record *)
-(* module Assumptions *)
-module Vernacinterp = Vernacinterp
-module Mltop = Mltop
-module Topfmt = Topfmt
-module Vernacentries = Vernacentries
-
-(******************************************************************************)
-(* Stm *)
-(******************************************************************************)
-module Vernac_classifier = Vernac_classifier
-module Stm = Stm
diff --git a/API/API.mli b/API/API.mli
deleted file mode 100644
index 074b79efc..000000000
--- a/API/API.mli
+++ /dev/null
@@ -1,5895 +0,0 @@
-(************************************************************************)
-(* v * The Coq Proof Assistant / The Coq Development Team *)
-(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *)
-(* \VV/ **************************************************************)
-(* // * This file is distributed under the terms of the *)
-(* * GNU Lesser General Public License Version 2.1 *)
-(************************************************************************)
-
-(* Warning, this file should respect the dependency order established
- in Coq. To see such order issue the comand:
-
- ```
- bash -c 'for i in kernel intf library engine pretyping interp proofs parsing printing tactics vernac stm toplevel; do echo -e "\n## $i files" && cat ${i}/${i}.mllib; done > API/link
- ```
-
- Note however that files in intf/ are located manually now as their
- conceptual linking order in the Coq codebase is incorrect (but it
- works due to these files being implementation-free.
-
- See below in the file for their concrete position.
-*)
-
-(************************************************************************)
-(* Modules from config/ *)
-(************************************************************************)
-module Coq_config :
-sig
- val exec_extension : string
-end
-
-(************************************************************************)
-(* Modules from kernel/ *)
-(************************************************************************)
-module Names :
-sig
-
- open Util
-
- module Id :
- sig
- type t
- val equal : t -> t -> bool
- val compare : t -> t -> int
- val hash : t -> int
- val is_valid : string -> bool
- val of_bytes : bytes -> t
- val of_string : string -> t
- val of_string_soft : string -> t
- val to_string : t -> string
- val print : t -> Pp.t
-
- module Set : Set.S with type elt = t
- module Map : Map.ExtS with type key = t and module Set := Set
- module Pred : Predicate.S with type elt = t
- module List : List.MonoS with type elt = t
- val hcons : t -> t
- end
-
- module Name :
- sig
- type t = Anonymous (** anonymous identifier *)
- | Name of Id.t (** non-anonymous identifier *)
- val mk_name : Id.t -> t
- val is_anonymous : t -> bool
- val is_name : t -> bool
- val compare : t -> t -> int
- val equal : t -> t -> bool
- val hash : t -> int
- val hcons : t -> t
- val print : t -> Pp.t
- end
-
- type name = Name.t =
- | Anonymous
- | Name of Id.t
- [@@ocaml.deprecated "alias of API.Name.t"]
-
- module DirPath :
- sig
- type t
- val empty : t
- val make : Id.t list -> t
- val repr : t -> Id.t list
- val equal : t -> t -> bool
- val to_string : t -> string
- end
-
- module MBId : sig
- type t
- val equal : t -> t -> bool
- val to_id : t -> Id.t
- val repr : t -> int * Id.t * DirPath.t
- val debug_to_string : t -> string
- end
-
- module Label :
- sig
- type t
- val make : string -> t
- val equal : t -> t -> bool
- val compare : t -> t -> int
- val of_id : Id.t -> t
- val to_id : t -> Id.t
- val to_string : t -> string
- end
-
- module ModPath :
- sig
- type t =
- | MPfile of DirPath.t
- | MPbound of MBId.t
- | MPdot of t * Label.t
- val compare : t -> t -> int
- val equal : t -> t -> bool
- val hash : t -> int
- val initial : t
- val to_string : t -> string
- val debug_to_string : t -> string
- end
-
- module KerName :
- sig
- type t
- val make : ModPath.t -> DirPath.t -> Label.t -> t
- val make2 : ModPath.t -> Label.t -> t
- val modpath : t -> ModPath.t
- val equal : t -> t -> bool
- val compare : t -> t -> int
- val label : t -> Label.t
- val repr : t -> ModPath.t * DirPath.t * Label.t
- val print : t -> Pp.t
- val to_string : t -> string
- end
-
- type kernel_name = KerName.t
- [@@ocaml.deprecated "alias of API.Names.KerName.t"]
-
- module Constant :
- sig
- type t
- val equal : t -> t -> bool
- val make1 : KerName.t -> t
- val make2 : ModPath.t -> Label.t -> t
- val make3 : ModPath.t -> DirPath.t -> Label.t -> t
- val repr3 : t -> ModPath.t * DirPath.t * Label.t
- val canonical : t -> KerName.t
- val user : t -> KerName.t
- val label : t -> Label.t
- end
-
- module MutInd :
- sig
- type t
- val make1 : KerName.t -> t
- val make2 : ModPath.t -> Label.t -> t
- val equal : t -> t -> bool
- val repr3 : t -> ModPath.t * DirPath.t * Label.t
- val canonical : t -> KerName.t
- val modpath : t -> ModPath.t
- val label : t -> Label.t
- val user : t -> KerName.t
- val print : t -> Pp.t
- end
-
- module Projection :
- sig
- type t
- val make : Constant.t -> bool -> t
- val map : (Constant.t -> Constant.t) -> t -> t
- val constant : t -> Constant.t
- val equal : t -> t -> bool
- val unfolded : t -> bool
- val unfold : t -> t
- end
-
- type evaluable_global_reference =
- | EvalVarRef of Id.t
- | EvalConstRef of Constant.t
-
- type inductive = MutInd.t * int
- val eq_ind : inductive -> inductive -> bool
-
- type constructor = inductive * int
- val eq_constructor : constructor -> constructor -> bool
- val constructor_hash : constructor -> int
-
- module MPset : Set.S with type elt = ModPath.t
- module MPmap : Map.ExtS with type key = ModPath.t and module Set := MPset
-
- module KNset : CSig.SetS with type elt = KerName.t
- module KNpred : Predicate.S with type elt = KerName.t
- module KNmap : Map.ExtS with type key = KerName.t and module Set := KNset
-
- module Cpred : Predicate.S with type elt = Constant.t
- module Cset : CSig.SetS with type elt = Constant.t
- module Cset_env : CSig.SetS with type elt = Constant.t
-
- module Cmap : Map.ExtS with type key = Constant.t and module Set := Cset
- module Cmap_env : Map.ExtS with type key = Constant.t and module Set := Cset_env
-
- module Mindset : CSig.SetS with type elt = MutInd.t
- module Mindmap : Map.ExtS with type key = MutInd.t and module Set := Mindset
- module Mindmap_env : CSig.MapS with type key = MutInd.t
-
- module Indmap : CSig.MapS with type key = inductive
- module Constrmap : CSig.MapS with type key = constructor
- module Indmap_env : CSig.MapS with type key = inductive
- module Constrmap_env : CSig.MapS with type key = constructor
-
- type transparent_state = Id.Pred.t * Cpred.t
-
- val empty_transparent_state : transparent_state
- val full_transparent_state : transparent_state
- val var_full_transparent_state : transparent_state
- val cst_full_transparent_state : transparent_state
-
- val pr_kn : KerName.t -> Pp.t
- [@@ocaml.deprecated "alias of API.Names.KerName.print"]
-
- val eq_constant : Constant.t -> Constant.t -> bool
- [@@ocaml.deprecated "alias of API.Names.Constant.equal"]
-
- type module_path = ModPath.t =
- | MPfile of DirPath.t
- | MPbound of MBId.t
- | MPdot of ModPath.t * Label.t
- [@@ocaml.deprecated "alias of API.Names.ModPath.t"]
-
- type variable = Id.t
-
- type 'a tableKey =
- | ConstKey of 'a
- | VarKey of Id.t
- | RelKey of Int.t
-
- val id_of_string : string -> Id.t
- [@@ocaml.deprecated "alias of API.Names.Id.of_string"]
-
- val string_of_id : Id.t -> string
- [@@ocaml.deprecated "alias of API.Names.Id.to_string"]
-
- type mutual_inductive = MutInd.t
- [@@ocaml.deprecated "alias of API.Names.MutInd.t"]
-
- val eq_mind : MutInd.t -> MutInd.t -> bool
- [@@ocaml.deprecated "alias of API.Names.MutInd.equal"]
-
- val repr_con : Constant.t -> ModPath.t * DirPath.t * Label.t
- [@@ocaml.deprecated "alias of API.Names.Constant.repr3"]
-
- val repr_mind : MutInd.t -> ModPath.t * DirPath.t * Label.t
- [@@ocaml.deprecated "alias of API.Names.MutInd.repr3"]
-
- val initial_path : ModPath.t
- [@@ocaml.deprecated "alias of API.Names.ModPath.initial"]
-
- val con_label : Constant.t -> Label.t
- [@@ocaml.deprecated "alias of API.Names.Constant.label"]
-
- val mind_label : MutInd.t -> Label.t
- [@@ocaml.deprecated "alias of API.Names.MutInd.label"]
-
- val string_of_mp : ModPath.t -> string
- [@@ocaml.deprecated "alias of API.Names.ModPath.to_string"]
-
- val mind_of_kn : KerName.t -> MutInd.t
- [@@ocaml.deprecated "alias of API.Names.MutInd.make1"]
-
- type constant = Constant.t
- [@@ocaml.deprecated "alias of API.Names.Constant.t"]
-
- val mind_modpath : MutInd.t -> ModPath.t
- [@@ocaml.deprecated "alias of API.Names.MutInd.modpath"]
-
- val canonical_mind : MutInd.t -> KerName.t
- [@@ocaml.deprecated "alias of API.Names.MutInd.canonical"]
-
- val user_mind : MutInd.t -> KerName.t
- [@@ocaml.deprecated "alias of API.Names.MutInd.user"]
-
- val repr_kn : KerName.t -> ModPath.t * DirPath.t * Label.t
- [@@ocaml.deprecated "alias of API.Names.KerName.repr"]
-
- val constant_of_kn : KerName.t -> Constant.t
- [@@ocaml.deprecated "alias of API.Names.Constant.make1"]
-
- val user_con : Constant.t -> KerName.t
- [@@ocaml.deprecated "alias of API.Names.Constant.user"]
-
- val modpath : KerName.t -> ModPath.t
- [@@ocaml.deprecated "alias of API.Names.KerName.modpath"]
-
- val canonical_con : Constant.t -> KerName.t
- [@@ocaml.deprecated "alias of API.Names.Constant.canonical"]
-
- val make_kn : ModPath.t -> DirPath.t -> Label.t -> KerName.t
- [@@ocaml.deprecated "alias of API.Names.KerName.make"]
-
- val make_con : ModPath.t -> DirPath.t -> Label.t -> Constant.t
- [@@ocaml.deprecated "alias of API.Names.Constant.make3"]
-
- val debug_pr_con : Constant.t -> Pp.t
-
- val debug_pr_mind : MutInd.t -> Pp.t
-
- val pr_con : Constant.t -> Pp.t
-
- val string_of_con : Constant.t -> string
-
- val string_of_mind : MutInd.t -> string
-
- val debug_string_of_mind : MutInd.t -> string
-
- val debug_string_of_con : Constant.t -> string
-
- type identifier = Id.t
- module Idset : Set.S with type elt = identifier and type t = Id.Set.t
-
-end
-
-module Univ :
-sig
-
- module Level :
- sig
- type t
- val set : t
- val pr : t -> Pp.t
- end
-
- type universe_level = Level.t
-
- module LSet :
- sig
- include CSig.SetS with type elt = universe_level
- val pr : (Level.t -> Pp.t) -> t -> Pp.t
- end
-
- module Universe :
- sig
- type t
- val pr : t -> Pp.t
- end
-
- type universe = Universe.t
-
- module Instance :
- sig
- type t
- val empty : t
- val of_array : Level.t array -> t
- val to_array : t -> Level.t array
- val pr : (Level.t -> Pp.t) -> t -> Pp.t
- end
-
- type 'a puniverses = 'a * Instance.t
-
- val out_punivs : 'a puniverses -> 'a
-
- type constraint_type = Lt | Le | Eq
-
- type univ_constraint = universe_level * constraint_type * universe_level
-
- module Constraint : sig
- include Set.S with type elt = univ_constraint
- end
-
- type 'a constrained = 'a * Constraint.t
-
- module UContext :
- sig
- type t
- val empty : t
- end
-
- type universe_context = UContext.t
-
- module AUContext :
- sig
- type t
- val empty : t
- end
-
- type abstract_universe_context = AUContext.t
-
- module CumulativityInfo :
- sig
- type t
- end
-
- type cumulativity_info = CumulativityInfo.t
-
- module ACumulativityInfo :
- sig
- type t
- end
- type abstract_cumulativity_info = ACumulativityInfo.t
-
- module ContextSet :
- sig
- type t
- val empty : t
- val of_context : UContext.t -> t
- val to_context : t -> UContext.t
- end
-
- type 'a in_universe_context_set = 'a * ContextSet.t
- type 'a in_universe_context = 'a * UContext.t
-
- type universe_context_set = ContextSet.t
-
- type universe_set = LSet.t
-
- type 'a constraint_function = 'a -> 'a -> Constraint.t -> Constraint.t
-
- module LMap :
- sig
- include CMap.ExtS with type key = universe_level and module Set := LSet
-
- val union : 'a t -> 'a t -> 'a t
- val diff : 'a t -> 'a t -> 'a t
- val subst_union : 'a option t -> 'a option t -> 'a option t
- val pr : ('a -> Pp.t) -> 'a t -> Pp.t
- end
-
- type 'a universe_map = 'a LMap.t
- type universe_subst = universe universe_map
- type universe_level_subst = universe_level universe_map
-
- val enforce_leq : Universe.t constraint_function
- val pr_uni : Universe.t -> Pp.t
- val pr_universe_context : (Level.t -> Pp.t) -> UContext.t -> Pp.t
- val pr_universe_context_set : (Level.t -> Pp.t) -> ContextSet.t -> Pp.t
- val pr_universe_subst : universe_subst -> Pp.t
- val pr_universe_level_subst : universe_level_subst -> Pp.t
- val pr_constraints : (Level.t -> Pp.t) -> Constraint.t -> Pp.t
-end
-
-module UGraph :
-sig
- type t
- val pr_universes : (Univ.Level.t -> Pp.t) -> t -> Pp.t
-end
-
-module Esubst :
-sig
- type 'a subs
- val subs_id : int -> 'a subs
-end
-
-module Sorts :
-sig
- type contents = Pos | Null
- type t =
- | Prop of contents
- | Type of Univ.Universe.t
- val is_prop : t -> bool
- val hash : t -> int
-
- type family = InProp | InSet | InType
- val family : t -> family
-end
-
-module Evar :
-sig
- (** Unique identifier of some {i evar} *)
- type t
-
- (** Recover the underlying integer. *)
- val repr : t -> int
-
- val equal : t -> t -> bool
-
- (** a set of unique identifiers of some {i evars} *)
- module Set : Set.S with type elt = t
- module Map : CMap.ExtS with type key = t and module Set := Set
-
-end
-
-module Constr :
-sig
- open Names
-
- type t
-
- type constr = t
- type types = t
-
- type cast_kind =
- | VMcast
- | NATIVEcast
- | DEFAULTcast
- | REVERTcast
-
- type metavariable = int
-
- type existential_key = Evar.t
- type 'constr pexistential = existential_key * 'constr array
-
- type 'a puniverses = 'a Univ.puniverses
- type pconstant = Constant.t puniverses
- type pinductive = inductive puniverses
- type pconstructor = constructor puniverses
-
- type ('constr, 'types) prec_declaration =
- Name.t array * 'types array * 'constr array
-
- type ('constr, 'types) pfixpoint =
- (int array * int) * ('constr, 'types) prec_declaration
-
- type ('constr, 'types) pcofixpoint =
- int * ('constr, 'types) prec_declaration
-
- type case_style =
- LetStyle | IfStyle | LetPatternStyle | MatchStyle
- | RegularStyle (** infer printing form from number of constructor *)
-
- type case_printing =
- { ind_tags : bool list; (** tell whether letin or lambda in the arity of the inductive type *)
- cstr_tags : bool list array; (** tell whether letin or lambda in the signature of each constructor *)
- style : case_style }
-
- type case_info =
- { ci_ind : inductive; (* inductive type to which belongs the value that is being matched *)
- ci_npar : int; (* number of parameters of the above inductive type *)
- ci_cstr_ndecls : int array; (* For each constructor, the corresponding integer determines
- the number of values that can be bound in a match-construct.
- NOTE: parameters of the inductive type are therefore excluded from the count *)
- ci_cstr_nargs : int array; (* for each constructor, the corresponding integers determines
- the number of values that can be applied to the constructor,
- in addition to the parameters of the related inductive type
- NOTE: "lets" are therefore excluded from the count
- NOTE: parameters of the inductive type are also excluded from the count *)
- ci_pp_info : case_printing (* not interpreted by the kernel *)
- }
-
- type ('constr, 'types, 'sort, 'univs) kind_of_term =
- | Rel of int
- | Var of Id.t
- | Meta of metavariable
- | Evar of 'constr pexistential
- | Sort of 'sort
- | Cast of 'constr * cast_kind * 'types
- | Prod of Name.t * 'types * 'types
- | Lambda of Name.t * 'types * 'constr
- | LetIn of Name.t * 'constr * 'types * 'constr
- | App of 'constr * 'constr array
- | Const of (Constant.t * 'univs)
- | Ind of (inductive * 'univs)
- | Construct of (constructor * 'univs)
- | Case of case_info * 'constr * 'constr * 'constr array
- | Fix of ('constr, 'types) pfixpoint
- | CoFix of ('constr, 'types) pcofixpoint
- | Proj of Projection.t * 'constr
-
- val equal : t -> t -> bool
- val eq_constr_nounivs : t -> t -> bool
- val compare : t -> t -> int
-
- val hash : t -> int
-
- val mkRel : int -> t
- val mkVar : Id.t -> t
- val mkMeta : metavariable -> t
- type existential = existential_key * constr array
- val mkEvar : existential -> t
- val mkSort : Sorts.t -> t
- val mkProp : t
- val mkSet : t
- val mkType : Univ.Universe.t -> t
- val mkCast : t * cast_kind * t -> t
- val mkProd : Name.t * types * types -> types
- val mkLambda : Name.t * types * t -> t
- val mkLetIn : Name.t * t * types * t -> t
- val mkApp : t * t array -> t
- val map_puniverses : ('a -> 'b) -> 'a puniverses -> 'b puniverses
-
- val mkConst : Constant.t -> t
- val mkConstU : pconstant -> t
-
- val mkProj : (Projection.t * t) -> t
-
- val mkInd : inductive -> t
- val mkIndU : pinductive -> t
-
- val mkConstruct : constructor -> t
- val mkConstructU : pconstructor -> t
- val mkConstructUi : pinductive * int -> t
-
- val mkCase : case_info * t * t * t array -> t
-
-end
-
-module Context :
-sig
- module Rel :
- sig
- module Declaration :
- sig
- (* local declaration *)
- (* local declaration *)
- type ('constr, 'types) pt =
- | LocalAssum of Names.Name.t * 'types (** name, type *)
- | LocalDef of Names.Name.t * 'constr * 'types (** name, value, type *)
-
- type t = (Constr.constr, Constr.types) pt
-
- (** Return the name bound by a given declaration. *)
- val get_name : ('c, 't) pt -> Names.Name.t
-
- (** Return the type of the name bound by a given declaration. *)
- val get_type : ('c, 't) pt -> 't
-
- (** Set the name that is bound by a given declaration. *)
- val set_name : Names.Name.t -> ('c, 't) pt -> ('c, 't) pt
-
- (** Set the type of the bound variable in a given declaration. *)
- val set_type : 't -> ('c, 't) pt -> ('c, 't) pt
-
- (** Return [true] iff a given declaration is a local assumption. *)
- val is_local_assum : ('c, 't) pt -> bool
-
- (** Return [true] iff a given declaration is a local definition. *)
- val is_local_def : ('c, 't) pt -> bool
-
- (** Check whether the two given declarations are equal. *)
- val equal : ('c -> 'c -> bool) -> ('c, 'c) pt -> ('c, 'c) pt -> bool
-
- (** Map the name bound by a given declaration. *)
- val map_name : (Names.Name.t -> Names.Name.t) -> ('c, 't) pt -> ('c, 't) pt
-
- (** For local assumptions, this function returns the original local assumptions.
- For local definitions, this function maps the value in the local definition. *)
- val map_value : ('c -> 'c) -> ('c, 't) pt -> ('c, 't) pt
-
- (** Map the type of the name bound by a given declaration. *)
- val map_type : ('t -> 't) -> ('c, 't) pt -> ('c, 't) pt
-
- (** Map all terms in a given declaration. *)
- val map_constr : ('c -> 'c) -> ('c, 'c) pt -> ('c, 'c) pt
-
- (** Perform a given action on all terms in a given declaration. *)
- val iter_constr : ('c -> unit) -> ('c, 'c) pt -> unit
-
- (** Reduce all terms in a given declaration to a single value. *)
- val fold_constr : ('c -> 'a -> 'a) -> ('c, 'c) pt -> 'a -> 'a
- end
-
- (** Rel-context is represented as a list of declarations.
- Inner-most declarations are at the beginning of the list.
- Outer-most declarations are at the end of the list. *)
- type ('constr, 'types) pt = ('constr, 'types) Declaration.pt list
- type t = Declaration.t list
-
- (** empty rel-context *)
- val empty : ('c, 't) pt
-
- (** Return a new rel-context enriched by with a given inner-most declaration. *)
- val add : ('c, 't) Declaration.pt -> ('c, 't) pt -> ('c, 't) pt
-
- (** Return the number of {e local declarations} in a given context. *)
- val length : ('c, 't) pt -> int
-
- (** Check whether given two rel-contexts are equal. *)
- val equal : ('c -> 'c -> bool) -> ('c, 'c) pt -> ('c, 'c) pt -> bool
-
- (** Return the number of {e local assumptions} in a given rel-context. *)
- val nhyps : ('c, 't) pt -> int
-
- (** Return a declaration designated by a given de Bruijn index.
- @raise Not_found if the designated de Bruijn index outside the range. *)
- val lookup : int -> ('c, 't) pt -> ('c, 't) Declaration.pt
-
- (** Map all terms in a given rel-context. *)
- val map : ('c -> 'c) -> ('c, 'c) pt -> ('c, 'c) pt
-
- (** Perform a given action on every declaration in a given rel-context. *)
- val iter : ('c -> unit) -> ('c, 'c) pt -> unit
-
- (** Reduce all terms in a given rel-context to a single value.
- Innermost declarations are processed first. *)
- val fold_inside : ('a -> ('c, 't) Declaration.pt -> 'a) -> init:'a -> ('c, 't) pt -> 'a
-
- (** Reduce all terms in a given rel-context to a single value.
- Outermost declarations are processed first. *)
- val fold_outside : (('c, 't) Declaration.pt -> 'a -> 'a) -> ('c, 't) pt -> init:'a -> 'a
-
- (** [extended_vect n Γ] does the same, returning instead an array. *)
- val to_extended_vect : (int -> 'r) -> int -> ('c, 't) pt -> 'r array
- end
- module Named :
- sig
- module Declaration :
- sig
- (** local declaration *)
- type ('constr, 'types) pt =
- | LocalAssum of Names.Id.t * 'types (** identifier, type *)
- | LocalDef of Names.Id.t * 'constr * 'types (** identifier, value, type *)
-
- type t = (Constr.constr, Constr.types) pt
-
- (** Return the identifier bound by a given declaration. *)
- val get_id : ('c, 't) pt -> Names.Id.t
-
- (** Return the type of the name bound by a given declaration. *)
- val get_type : ('c, 't) pt -> 't
-
- (** Set the identifier that is bound by a given declaration. *)
- val set_id : Names.Id.t -> ('c, 't) pt -> ('c, 't) pt
-
- (** Set the type of the bound variable in a given declaration. *)
- val set_type : 't -> ('c, 't) pt -> ('c, 't) pt
-
- (** Return [true] iff a given declaration is a local assumption. *)
- val is_local_assum : ('c, 't) pt -> bool
-
- (** Return [true] iff a given declaration is a local definition. *)
- val is_local_def : ('c, 't) pt -> bool
-
- (** Check whether any term in a given declaration satisfies a given predicate. *)
- val exists : ('c -> bool) -> ('c, 'c) pt -> bool
-
- (** Check whether all terms in a given declaration satisfy a given predicate. *)
- val for_all : ('c -> bool) -> ('c, 'c) pt -> bool
-
- (** Check whether the two given declarations are equal. *)
- val equal : ('c -> 'c -> bool) -> ('c, 'c) pt -> ('c, 'c) pt -> bool
-
- (** Map the identifier bound by a given declaration. *)
- val map_id : (Names.Id.t -> Names.Id.t) -> ('c, 't) pt -> ('c, 't) pt
-
- (** For local assumptions, this function returns the original local assumptions.
- For local definitions, this function maps the value in the local definition. *)
- val map_value : ('c -> 'c) -> ('c, 't) pt -> ('c, 't) pt
-
- (** Map the type of the name bound by a given declaration. *)
- val map_type : ('t -> 't) -> ('c, 't) pt -> ('c, 't) pt
-
- (** Map all terms in a given declaration. *)
- val map_constr : ('c -> 'c) -> ('c, 'c) pt -> ('c, 'c) pt
-
- (** Perform a given action on all terms in a given declaration. *)
- val iter_constr : ('c -> unit) -> ('c, 'c) pt -> unit
-
- (** Reduce all terms in a given declaration to a single value. *)
- val fold_constr : ('c -> 'a -> 'a) -> ('c, 'c) pt -> 'a -> 'a
-
- val to_rel_decl : ('c, 't) pt -> ('c, 't) Rel.Declaration.pt
- end
- (** Named-context is represented as a list of declarations.
- Inner-most declarations are at the beginning of the list.
- Outer-most declarations are at the end of the list. *)
- type ('constr, 'types) pt = ('constr, 'types) Declaration.pt list
- type t = Declaration.t list
-
- (** empty named-context *)
- val empty : ('c, 't) pt
-
- (** Return a new named-context enriched by with a given inner-most declaration. *)
- val add : ('c, 't) Declaration.pt -> ('c, 't) pt -> ('c, 't) pt
-
- (** Return the number of {e local declarations} in a given named-context. *)
- val length : ('c, 't) pt -> int
-
- (** Return a declaration designated by an identifier of the variable bound in that declaration.
- @raise Not_found if the designated identifier is not bound in a given named-context. *)
- val lookup : Names.Id.t -> ('c, 't) pt -> ('c, 't) Declaration.pt
-
- (** Check whether given two named-contexts are equal. *)
- val equal : ('c -> 'c -> bool) -> ('c, 'c) pt -> ('c, 'c) pt -> bool
-
- (** Map all terms in a given named-context. *)
- val map : ('c -> 'c) -> ('c, 'c) pt -> ('c, 'c) pt
-
- (** Perform a given action on every declaration in a given named-context. *)
- val iter : ('c -> unit) -> ('c, 'c) pt -> unit
-
- (** Reduce all terms in a given named-context to a single value.
- Innermost declarations are processed first. *)
- val fold_inside : ('a -> ('c, 't) Declaration.pt -> 'a) -> init:'a -> ('c, 't) pt -> 'a
-
- (** Reduce all terms in a given named-context to a single value.
- Outermost declarations are processed first. *)
- val fold_outside : (('c, 't) Declaration.pt -> 'a -> 'a) -> ('c, 't) pt -> init:'a -> 'a
-
- (** Return the set of all identifiers bound in a given named-context. *)
- val to_vars : ('c, 't) pt -> Names.Id.Set.t
-
- (** [to_instance Ω] builds an instance [args] such
- that [Ω ⊢ args:Ω] where [Ω] is a named-context and with the local
- definitions of [Ω] skipped. Example: for [id1:T,id2:=c,id3:U], it
- gives [Var id1, Var id3]. All [idj] are supposed distinct. *)
- val to_instance : (Names.Id.t -> 'r) -> ('c, 't) pt -> 'r list
- end
-end
-
-module Vars :
-sig
- type substl = Constr.t list
-
- val substl : substl -> Constr.t -> Constr.t
-
- val subst1 : Constr.t -> Constr.t -> Constr.t
-
- val lift : int -> Constr.t -> Constr.t
-
- val closed0 : Constr.t -> bool
-
- val closedn : int -> Constr.t -> bool
-
- val replace_vars : (Names.Id.t * Constr.t) list -> Constr.t -> Constr.t
-
- val noccurn : int -> Constr.t -> bool
- val subst_var : Names.Id.t -> Constr.t -> Constr.t
- val subst_vars : Names.Id.t list -> Constr.t -> Constr.t
- val substnl : substl -> int -> Constr.t -> Constr.t
-end
-
-module Term :
-sig
-
- type sorts_family = Sorts.family = InProp | InSet | InType
-
- type contents = Sorts.contents = Pos | Null
-
- type sorts = Sorts.t =
- | Prop of contents
- | Type of Univ.Universe.t
- [@@ocaml.deprecated "alias of API.Sorts.t"]
-
- type constr = Constr.t
- type types = Constr.t
-
- type metavariable = int
-
- type ('constr, 'types) prec_declaration = Names.Name.t array * 'types array * 'constr array
-
- type 'constr pexistential = 'constr Constr.pexistential
- type cast_kind = Constr.cast_kind =
- | VMcast
- | NATIVEcast
- | DEFAULTcast
- | REVERTcast
-
- type 'a puniverses = 'a Univ.puniverses
- type pconstant = Names.Constant.t puniverses
- type pinductive = Names.inductive puniverses
- type pconstructor = Names.constructor puniverses
- type case_style = Constr.case_style =
- | LetStyle
- | IfStyle
- | LetPatternStyle
- | MatchStyle
- | RegularStyle
-
- type case_printing = Constr.case_printing =
- { ind_tags : bool list;
- cstr_tags : bool list array;
- style : case_style
- }
-
- type case_info = Constr.case_info =
- { ci_ind : Names.inductive;
- ci_npar : int;
- ci_cstr_ndecls: int array;
- ci_cstr_nargs : int array;
- ci_pp_info : case_printing
- }
-
- type ('constr, 'types) pfixpoint =
- (int array * int) * ('constr, 'types) prec_declaration
-
- type ('constr, 'types) pcofixpoint =
- int * ('constr, 'types) prec_declaration
-
- type ('constr, 'types, 'sort, 'univs) kind_of_term = ('constr, 'types, 'sort, 'univs) Constr.kind_of_term =
- | Rel of int
- | Var of Names.Id.t
- | Meta of Constr.metavariable
- | Evar of 'constr pexistential
- | Sort of 'sort
- | Cast of 'constr * cast_kind * 'types
- | Prod of Names.Name.t * 'types * 'types
- | Lambda of Names.Name.t * 'types * 'constr
- | LetIn of Names.Name.t * 'constr * 'types * 'constr
- | App of 'constr * 'constr array
- | Const of (Names.Constant.t * 'univs)
- | Ind of (Names.inductive * 'univs)
- | Construct of (Names.constructor * 'univs)
- | Case of case_info * 'constr * 'constr * 'constr array
- | Fix of ('constr, 'types) pfixpoint
- | CoFix of ('constr, 'types) pcofixpoint
- | Proj of Names.Projection.t * 'constr
- type existential = Constr.existential_key * constr array
- type rec_declaration = Names.Name.t array * constr array * constr array
- type fixpoint = (int array * int) * rec_declaration
- type cofixpoint = int * rec_declaration
- val kind_of_term : constr -> (constr, types, Sorts.t, Univ.Instance.t) kind_of_term
- val applistc : constr -> constr list -> constr
-
- val applist : constr * constr list -> constr
- [@@ocaml.deprecated "(sort of an) alias of API.Term.applistc"]
-
- val mkArrow : types -> types -> constr
- val mkRel : int -> constr
- val mkVar : Names.Id.t -> constr
-
- val mkMeta : Constr.metavariable -> constr
-
- val mkEvar : existential -> constr
- val mkSort : Sorts.t -> types
- val mkProp : types
- val mkSet : types
- val mkType : Univ.Universe.t -> types
- val mkCast : constr * cast_kind * constr -> constr
- val mkProd : Names.Name.t * types * types -> types
- val mkLambda : Names.Name.t * types * constr -> constr
- val mkLetIn : Names.Name.t * constr * types * constr -> constr
- val mkApp : constr * constr array -> constr
- val mkConst : Names.Constant.t -> constr
- val mkProj : Names.Projection.t * constr -> constr
- val mkInd : Names.inductive -> constr
- val mkConstruct : Names.constructor -> constr
- val mkConstructU : Names.constructor puniverses -> constr
- val mkConstructUi : (pinductive * int) -> constr
- val mkCase : case_info * constr * constr * constr array -> constr
- val mkFix : fixpoint -> constr
- val mkCoFix : cofixpoint -> constr
- val mkNamedLambda : Names.Id.t -> types -> constr -> constr
- val mkNamedLetIn : Names.Id.t -> constr -> types -> constr -> constr
- val mkNamedProd : Names.Id.t -> types -> types -> types
-
- val decompose_app : constr -> constr * constr list
- val decompose_prod : constr -> (Names.Name.t*constr) list * constr
- val decompose_prod_n : int -> constr -> (Names.Name.t * constr) list * constr
- val decompose_prod_assum : types -> Context.Rel.t * types
- val decompose_lam : constr -> (Names.Name.t * constr) list * constr
- val decompose_lam_n : int -> constr -> (Names.Name.t * constr) list * constr
- val decompose_prod_n_assum : int -> types -> Context.Rel.t * types
-
- val compose_prod : (Names.Name.t * constr) list -> constr -> constr
- val compose_lam : (Names.Name.t * constr) list -> constr -> constr
-
- val destSort : constr -> Sorts.t
- val destVar : constr -> Names.Id.t
- val destApp : constr -> constr * constr array
- val destProd : types -> Names.Name.t * types * types
- val destLetIn : constr -> Names.Name.t * constr * types * constr
- val destEvar : constr -> existential
- val destRel : constr -> int
- val destConst : constr -> Names.Constant.t puniverses
- val destCast : constr -> constr * cast_kind * constr
- val destLambda : constr -> Names.Name.t * types * constr
-
- val isRel : constr -> bool
- val isVar : constr -> bool
- val isEvar : constr -> bool
- val isLetIn : constr -> bool
- val isLambda : constr -> bool
- val isConst : constr -> bool
- val isEvar_or_Meta : constr -> bool
- val isCast : constr -> bool
- val isMeta : constr -> bool
- val isApp : constr -> bool
-
- val fold_constr : ('a -> constr -> 'a) -> 'a -> constr -> 'a
-
- val eq_constr : constr -> constr -> bool
-
- val hash_constr : constr -> int
- val it_mkLambda_or_LetIn : constr -> Context.Rel.t -> constr
- val it_mkProd_or_LetIn : types -> Context.Rel.t -> types
- val prod_applist : constr -> constr list -> constr
- exception DestKO
- val map_constr : (constr -> constr) -> constr -> constr
-
- val mkIndU : pinductive -> constr
- val mkConstU : pconstant -> constr
- val map_constr_with_binders :
- ('a -> 'a) -> ('a -> constr -> constr) -> 'a -> constr -> constr
- val iter_constr : (constr -> unit) -> constr -> unit
-
- (* Quotients away universes: really needed?
- * Can't we just call eq_c_univs_infer and discard the inferred csts?
- *)
- val eq_constr_nounivs : constr -> constr -> bool
-
- type ('constr, 'types) kind_of_type =
- | SortType of Sorts.t
- | CastType of 'types * 'types
- | ProdType of Names.Name.t * 'types * 'types
- | LetInType of Names.Name.t * 'constr * 'types * 'types
- | AtomicType of 'constr * 'constr array
-
- val kind_of_type : types -> (constr, types) kind_of_type
-
- val is_prop_sort : Sorts.t -> bool
- [@@ocaml.deprecated "alias of API.Sorts.is_prop"]
-
- type existential_key = Constr.existential_key
-
- val family_of_sort : Sorts.t -> Sorts.family
-
- val compare : constr -> constr -> int
-
- val constr_ord : constr -> constr -> int
- [@@ocaml.deprecated "alias of API.Term.compare"]
-
- val destInd : constr -> Names.inductive puniverses
- val univ_of_sort : Sorts.t -> Univ.Universe.t
-
- val strip_lam : constr -> constr
- val strip_prod_assum : types -> types
-
- val decompose_lam_assum : constr -> Context.Rel.t * constr
- val destFix : constr -> fixpoint
-
- val compare_constr : (constr -> constr -> bool) -> constr -> constr -> bool
-end
-
-module Mod_subst :
-sig
- type delta_resolver
- type substitution
- type 'a substituted
-
- val force_constr : Constr.t substituted -> Constr.t
-
- val empty_delta_resolver : delta_resolver
- val constant_of_delta_kn : delta_resolver -> Names.KerName.t -> Names.Constant.t
- val mind_of_delta_kn : delta_resolver -> Names.KerName.t -> Names.MutInd.t
- val subst_kn : substitution -> Names.KerName.t -> Names.KerName.t
- val subst_evaluable_reference :
- substitution -> Names.evaluable_global_reference -> Names.evaluable_global_reference
- val subst_mps : substitution -> Constr.t -> Constr.t
- val subst_constant : substitution -> Names.Constant.t -> Names.Constant.t
- val subst_ind : substitution -> Names.inductive -> Names.inductive
- val debug_pr_subst : substitution -> Pp.t
- val debug_pr_delta : delta_resolver -> Pp.t
-end
-
-module Opaqueproof :
-sig
- type opaquetab
- type opaque
- val empty_opaquetab : opaquetab
- val force_proof : opaquetab -> opaque -> Constr.t
-end
-
-module Cbytecodes :
-sig
- type tag = int
- type reloc_table = (tag * int) array
-end
-
-module Cemitcodes :
-sig
- type to_patch_substituted
-end
-
-module Decl_kinds :
-sig
- type polymorphic = bool
- type cumulative_inductive_flag = bool
- type recursivity_kind =
- | Finite
- | CoFinite
- | BiFinite
-
- type locality =
- | Discharge
- | Local
- | Global
-
- type definition_object_kind =
- | Definition
- | Coercion
- | SubClass
- | CanonicalStructure
- | Example
- | Fixpoint
- | CoFixpoint
- | Scheme
- | StructureComponent
- | IdentityCoercion
- | Instance
- | Method
- type theorem_kind =
- | Theorem
- | Lemma
- | Fact
- | Remark
- | Property
- | Proposition
- | Corollary
- type goal_object_kind =
- | DefinitionBody of definition_object_kind
- | Proof of theorem_kind
- type goal_kind = locality * polymorphic * goal_object_kind
- type assumption_object_kind =
- | Definitional
- | Logical
- | Conjectural
- type logical_kind =
- | IsAssumption of assumption_object_kind
- | IsDefinition of definition_object_kind
- | IsProof of theorem_kind
- type binding_kind =
- | Explicit
- | Implicit
- type private_flag = bool
- type definition_kind = locality * polymorphic * definition_object_kind
-end
-
-module Retroknowledge :
-sig
- type action
- type nat_field =
- | NatType
- | NatPlus
- | NatTimes
- type n_field =
- | NPositive
- | NType
- | NTwice
- | NTwicePlusOne
- | NPhi
- | NPhiInv
- | NPlus
- | NTimes
- type int31_field =
- | Int31Bits
- | Int31Type
- | Int31Constructor
- | Int31Twice
- | Int31TwicePlusOne
- | Int31Phi
- | Int31PhiInv
- | Int31Plus
- | Int31PlusC
- | Int31PlusCarryC
- | Int31Minus
- | Int31MinusC
- | Int31MinusCarryC
- | Int31Times
- | Int31TimesC
- | Int31Div21
- | Int31Div
- | Int31Diveucl
- | Int31AddMulDiv
- | Int31Compare
- | Int31Head0
- | Int31Tail0
- | Int31Lor
- | Int31Land
- | Int31Lxor
- type field =
- | KInt31 of string * int31_field
-end
-
-module Conv_oracle :
-sig
- type level
-end
-
-module Declarations :
-sig
-
- open Names
-
- type recarg =
- | Norec
- | Mrec of Names.inductive
- | Imbr of Names.inductive
- type wf_paths = recarg Rtree.t
- type inline = int option
- type constant_def =
- | Undef of inline
- | Def of Constr.t Mod_subst.substituted
- | OpaqueDef of Opaqueproof.opaque
- type template_arity = {
- template_param_levels : Univ.Level.t option list;
- template_level : Univ.Universe.t;
- }
-
- type ('a, 'b) declaration_arity =
- | RegularArity of 'a
- | TemplateArity of 'b
-
- type constant_universes =
- | Monomorphic_const of Univ.universe_context
- | Polymorphic_const of Univ.abstract_universe_context
-
- type projection_body = {
- proj_ind : Names.MutInd.t;
- proj_npars : int;
- proj_arg : int;
- proj_type : Constr.types;
- proj_eta : Constr.t * Constr.types;
- proj_body : Constr.t;
- }
-
- type typing_flags = {
- check_guarded : bool;
- check_universes : bool;
- }
-
- type constant_body = {
- const_hyps : Context.Named.t;
- const_body : constant_def;
- const_type : Term.types;
- const_body_code : Cemitcodes.to_patch_substituted option;
- const_universes : constant_universes;
- const_proj : projection_body option;
- const_inline_code : bool;
- const_typing_flags : typing_flags;
- }
-
- type regular_inductive_arity = {
- mind_user_arity : Constr.types;
- mind_sort : Sorts.t;
- }
-
- type inductive_arity = (regular_inductive_arity, template_arity) declaration_arity
-
- type one_inductive_body = {
- mind_typename : Names.Id.t;
- mind_arity_ctxt : Context.Rel.t;
- mind_arity : inductive_arity;
- mind_consnames : Names.Id.t array;
- mind_user_lc : Constr.types array;
- mind_nrealargs : int;
- mind_nrealdecls : int;
- mind_kelim : Sorts.family list;
- mind_nf_lc : Constr.types array;
- mind_consnrealargs : int array;
- mind_consnrealdecls : int array;
- mind_recargs : wf_paths;
- mind_nb_constant : int;
- mind_nb_args : int;
- mind_reloc_tbl : Cbytecodes.reloc_table;
- }
-
- type ('ty,'a) functorize =
- | NoFunctor of 'a
- | MoreFunctor of Names.MBId.t * 'ty * ('ty,'a) functorize
-
- type with_declaration =
- | WithMod of Names.Id.t list * Names.ModPath.t
- | WithDef of Names.Id.t list * Constr.t Univ.in_universe_context
-
- type module_alg_expr =
- | MEident of Names.ModPath.t
- | MEapply of module_alg_expr * Names.ModPath.t
- | MEwith of module_alg_expr * with_declaration
-
- type abstract_inductive_universes =
- | Monomorphic_ind of Univ.universe_context
- | Polymorphic_ind of Univ.abstract_universe_context
- | Cumulative_ind of Univ.abstract_cumulativity_info
-
- type record_body = (Id.t * Constant.t array * projection_body array) option
-
- type mutual_inductive_body = {
- mind_packets : one_inductive_body array;
- mind_record : record_body option;
- mind_finite : Decl_kinds.recursivity_kind;
- mind_ntypes : int;
- mind_hyps : Context.Named.t;
- mind_nparams : int;
- mind_nparams_rec : int;
- mind_params_ctxt : Context.Rel.t;
- mind_universes : abstract_inductive_universes;
- mind_private : bool option;
- mind_typing_flags : typing_flags;
- }
- and module_expression = (module_type_body,module_alg_expr) functorize
- and module_implementation =
- | Abstract
- | Algebraic of module_expression
- | Struct of module_signature
- | FullStruct
- and 'a generic_module_body =
- { mod_mp : Names.ModPath.t;
- mod_expr : 'a;
- mod_type : module_signature;
- mod_type_alg : module_expression option;
- mod_constraints : Univ.ContextSet.t;
- mod_delta : Mod_subst.delta_resolver;
- mod_retroknowledge : 'a module_retroknowledge;
- }
- and module_signature = (module_type_body,structure_body) functorize
- and module_body = module_implementation generic_module_body
- and module_type_body = unit generic_module_body
- and structure_body = (Names.Label.t * structure_field_body) list
- and structure_field_body =
- | SFBconst of constant_body
- | SFBmind of mutual_inductive_body
- | SFBmodule of module_body
- | SFBmodtype of module_type_body
- and _ module_retroknowledge =
- | ModBodyRK :
- Retroknowledge.action list -> module_implementation module_retroknowledge
- | ModTypeRK : unit module_retroknowledge
-end
-
-module Declareops :
-sig
- val constant_has_body : Declarations.constant_body -> bool
- val is_opaque : Declarations.constant_body -> bool
- val eq_recarg : Declarations.recarg -> Declarations.recarg -> bool
-end
-
-module Entries :
-sig
-
- open Names
- open Constr
-
- type local_entry =
- | LocalDefEntry of constr
- | LocalAssumEntry of constr
-
- type inductive_universes =
- | Monomorphic_ind_entry of Univ.universe_context
- | Polymorphic_ind_entry of Univ.universe_context
- | Cumulative_ind_entry of Univ.cumulativity_info
-
- type one_inductive_entry = {
- mind_entry_typename : Id.t;
- mind_entry_arity : constr;
- mind_entry_template : bool; (* Use template polymorphism *)
- mind_entry_consnames : Id.t list;
- mind_entry_lc : constr list }
-
- type mutual_inductive_entry = {
- mind_entry_record : (Names.Id.t option) option;
- (** Some (Some id): primitive record with id the binder name of the record
- in projections.
- Some None: non-primitive record *)
- mind_entry_finite : Decl_kinds.recursivity_kind;
- mind_entry_params : (Id.t * local_entry) list;
- mind_entry_inds : one_inductive_entry list;
- mind_entry_universes : inductive_universes;
- (* universe constraints and the constraints for subtyping of
- inductive types in the block. *)
- mind_entry_private : bool option;
- }
-
- type inline = int option
- type 'a proof_output = Constr.t Univ.in_universe_context_set * 'a
- type 'a const_entry_body = 'a proof_output Future.computation
- type constant_universes_entry =
- | Monomorphic_const_entry of Univ.universe_context
- | Polymorphic_const_entry of Univ.universe_context
- type 'a definition_entry =
- { const_entry_body : 'a const_entry_body;
- (* List of section variables *)
- const_entry_secctx : Context.Named.t option;
- (* State id on which the completion of type checking is reported *)
- const_entry_feedback : Stateid.t option;
- const_entry_type : Constr.types option;
- const_entry_universes : constant_universes_entry;
- const_entry_opaque : bool;
- const_entry_inline_code : bool }
- type parameter_entry = Context.Named.t option * bool * Constr.types Univ.in_universe_context * inline
-
- type projection_entry = {
- proj_entry_ind : MutInd.t;
- proj_entry_arg : int }
-
- type 'a constant_entry =
- | DefinitionEntry of 'a definition_entry
- | ParameterEntry of parameter_entry
- | ProjectionEntry of projection_entry
- type module_struct_entry = Declarations.module_alg_expr
- type module_params_entry =
- (Names.MBId.t * module_struct_entry) list
- type module_type_entry = module_params_entry * module_struct_entry
-end
-
-module Environ :
-sig
- type env
- type named_context_val
-
- type ('constr, 'types) punsafe_judgment =
- {
- uj_val : 'constr;
- uj_type : 'types
- }
- type 'types punsafe_type_judgment = {
- utj_val : 'types;
- utj_type : Sorts.t }
-
- type unsafe_type_judgment = Term.types punsafe_type_judgment
- val empty_env : env
- val lookup_mind : Names.MutInd.t -> env -> Declarations.mutual_inductive_body
- val push_rel : Context.Rel.Declaration.t -> env -> env
- val push_rel_context : Context.Rel.t -> env -> env
- val push_rec_types : Term.rec_declaration -> env -> env
- val lookup_rel : int -> env -> Context.Rel.Declaration.t
- val lookup_named : Names.Id.t -> env -> Context.Named.Declaration.t
- val lookup_named_val : Names.Id.t -> named_context_val -> Context.Named.Declaration.t
- val lookup_constant : Names.Constant.t -> env -> Declarations.constant_body
- val opaque_tables : env -> Opaqueproof.opaquetab
- val is_projection : Names.Constant.t -> env -> bool
- val lookup_projection : Names.Projection.t -> env -> Declarations.projection_body
- val named_context_of_val : named_context_val -> Context.Named.t
- val push_named : Context.Named.Declaration.t -> env -> env
- val named_context : env -> Context.Named.t
- val named_context_val : env -> named_context_val
- val push_named_context_val : Context.Named.Declaration.t -> named_context_val -> named_context_val
- val reset_with_named_context : named_context_val -> env -> env
- val rel_context : env -> Context.Rel.t
- val constant_value_in : env -> Names.Constant.t Univ.puniverses -> Constr.t
- val named_type : Names.Id.t -> env -> Constr.types
- val constant_opt_value_in : env -> Names.Constant.t Univ.puniverses -> Constr.t option
- val fold_named_context_reverse :
- ('a -> Context.Named.Declaration.t -> 'a) -> init:'a -> env -> 'a
- val evaluable_named : Names.Id.t -> env -> bool
- val push_context_set : ?strict:bool -> Univ.ContextSet.t -> env -> env
-end
-
-module CClosure :
-sig
-
- type table_key = Names.Constant.t Univ.puniverses Names.tableKey
-
- type fconstr
-
- type fterm =
- | FRel of int
- | FAtom of Constr.t (** Metas and Sorts *)
- | FCast of fconstr * Constr.cast_kind * fconstr
- | FFlex of table_key
- | FInd of Names.inductive Univ.puniverses
- | FConstruct of Names.constructor Univ.puniverses
- | FApp of fconstr * fconstr array
- | FProj of Names.Projection.t * fconstr
- | FFix of Term.fixpoint * fconstr Esubst.subs
- | FCoFix of Term.cofixpoint * fconstr Esubst.subs
- | FCaseT of Term.case_info * Constr.t * fconstr * Constr.t array * fconstr Esubst.subs (* predicate and branches are closures *)
- | FLambda of int * (Names.Name.t * Constr.t) list * Constr.t * fconstr Esubst.subs
- | FProd of Names.Name.t * fconstr * fconstr
- | FLetIn of Names.Name.t * fconstr * fconstr * Constr.t * fconstr Esubst.subs
- | FEvar of Term.existential * fconstr Esubst.subs
- | FLIFT of int * fconstr
- | FCLOS of Constr.t * fconstr Esubst.subs
- | FLOCKED
-
- module RedFlags : sig
- type reds
- type red_kind
- val mkflags : red_kind list -> reds
- val fBETA : red_kind
- val fCOFIX : red_kind
- val fCONST : Names.Constant.t -> red_kind
- val fFIX : red_kind
- val fMATCH : red_kind
- val fZETA : red_kind
- val red_add_transparent : reds -> Names.transparent_state -> reds
- end
-
- type 'a infos_cache
- type 'a infos = {
- i_flags : RedFlags.reds;
- i_cache : 'a infos_cache }
-
- type clos_infos = fconstr infos
-
- val mk_clos : fconstr Esubst.subs -> Constr.t -> fconstr
- val mk_atom : Constr.t -> fconstr
- val mk_clos_deep :
- (fconstr Esubst.subs -> Constr.t -> fconstr) ->
- fconstr Esubst.subs -> Constr.t -> fconstr
- val mk_red : fterm -> fconstr
- val all : RedFlags.reds
- val beta : RedFlags.reds
- val betaiota : RedFlags.reds
- val betaiotazeta : RedFlags.reds
-
- val create_clos_infos : ?evars:(Term.existential -> Constr.t option) -> RedFlags.reds -> Environ.env -> clos_infos
-
- val whd_val : clos_infos -> fconstr -> Constr.t
-
- val inject : Constr.t -> fconstr
-
- val kl : clos_infos -> fconstr -> Constr.t
- val term_of_fconstr : fconstr -> Constr.t
-end
-
-module Reduction :
-sig
- exception NotConvertible
- type conv_pb =
- | CONV
- | CUMUL
-
- val whd_all : Environ.env -> Constr.t -> Constr.t
-
- val whd_betaiotazeta : Environ.env -> Constr.t -> Constr.t
-
- val is_arity : Environ.env -> Term.types -> bool
-
- val dest_prod : Environ.env -> Term.types -> Context.Rel.t * Term.types
-
- type 'a extended_conversion_function =
- ?l2r:bool -> ?reds:Names.transparent_state -> Environ.env ->
- ?evars:((Term.existential->Constr.t option) * UGraph.t) ->
- 'a -> 'a -> unit
- val conv : Constr.t extended_conversion_function
-end
-
-module Type_errors :
-sig
-
- open Names
- open Term
- open Environ
-
- type 'constr pguard_error =
- (** Fixpoints *)
- | NotEnoughAbstractionInFixBody
- | RecursionNotOnInductiveType of 'constr
- | RecursionOnIllegalTerm of int * (env * 'constr) * int list * int list
- | NotEnoughArgumentsForFixCall of int
- (** CoFixpoints *)
- | CodomainNotInductiveType of 'constr
- | NestedRecursiveOccurrences
- | UnguardedRecursiveCall of 'constr
- | RecCallInTypeOfAbstraction of 'constr
- | RecCallInNonRecArgOfConstructor of 'constr
- | RecCallInTypeOfDef of 'constr
- | RecCallInCaseFun of 'constr
- | RecCallInCaseArg of 'constr
- | RecCallInCasePred of 'constr
- | NotGuardedForm of 'constr
- | ReturnPredicateNotCoInductive of 'constr
-
- type arity_error =
- | NonInformativeToInformative
- | StrongEliminationOnNonSmallType
- | WrongArity
-
- type ('constr, 'types) ptype_error =
- | UnboundRel of int
- | UnboundVar of variable
- | NotAType of ('constr, 'types) punsafe_judgment
- | BadAssumption of ('constr, 'types) punsafe_judgment
- | ReferenceVariables of identifier * 'constr
- | ElimArity of pinductive * sorts_family list * 'constr * ('constr, 'types) punsafe_judgment
- * (sorts_family * sorts_family * arity_error) option
- | CaseNotInductive of ('constr, 'types) punsafe_judgment
- | WrongCaseInfo of pinductive * case_info
- | NumberBranches of ('constr, 'types) punsafe_judgment * int
- | IllFormedBranch of 'constr * pconstructor * 'constr * 'constr
- | Generalization of (Name.t * 'types) * ('constr, 'types) punsafe_judgment
- | ActualType of ('constr, 'types) punsafe_judgment * 'types
- | CantApplyBadType of
- (int * 'constr * 'constr) * ('constr, 'types) punsafe_judgment * ('constr, 'types) punsafe_judgment array
- | CantApplyNonFunctional of ('constr, 'types) punsafe_judgment * ('constr, 'types) punsafe_judgment array
- | IllFormedRecBody of 'constr pguard_error * Name.t array * int * env * ('constr, 'types) punsafe_judgment array
- | IllTypedRecBody of
- int * Name.t array * ('constr, 'types) punsafe_judgment array * 'types array
- | UnsatisfiedConstraints of Univ.Constraint.t
-
- type type_error = (constr, types) ptype_error
-
- exception TypeError of Environ.env * type_error
-end
-
-module Modops :
-sig
- val destr_nofunctor : ('ty,'a) Declarations.functorize -> 'a
- val add_structure :
- Names.ModPath.t -> Declarations.structure_body -> Mod_subst.delta_resolver ->
- Environ.env -> Environ.env
- val add_module_type : Names.ModPath.t -> Declarations.module_type_body -> Environ.env -> Environ.env
-end
-
-module Inductive :
-sig
- type mind_specif = Declarations.mutual_inductive_body * Declarations.one_inductive_body
- val type_of_inductive : Environ.env -> mind_specif Univ.puniverses -> Term.types
- exception SingletonInductiveBecomesProp of Names.Id.t
- val lookup_mind_specif : Environ.env -> Names.inductive -> mind_specif
- val find_inductive : Environ.env -> Term.types -> Term.pinductive * Constr.t list
-end
-
-module Typeops :
-sig
- val infer_type : Environ.env -> Term.types -> Environ.unsafe_type_judgment
- val type_of_constant_in : Environ.env -> Term.pconstant -> Term.types
-end
-
-module Mod_typing :
-sig
- type 'alg translation =
- Declarations.module_signature * 'alg * Mod_subst.delta_resolver * Univ.ContextSet.t
- val translate_modtype :
- Environ.env -> Names.ModPath.t -> Entries.inline ->
- Entries.module_type_entry -> Declarations.module_type_body
- val translate_mse :
- Environ.env -> Names.ModPath.t option -> Entries.inline -> Declarations.module_alg_expr ->
- Declarations.module_alg_expr translation
-end
-
-module Safe_typing :
-sig
- type private_constants
- val mk_pure_proof : Constr.t -> private_constants Entries.proof_output
-end
-
-(************************************************************************)
-(* End of modules from kernel/ *)
-(************************************************************************)
-
-(************************************************************************)
-(* Modules from intf/ *)
-(************************************************************************)
-
-module Misctypes :
-sig
- type evars_flag = bool
- type clear_flag = bool option
- type advanced_flag = bool
- type rec_flag = bool
-
- type 'a or_by_notation =
- | AN of 'a
- | ByNotation of (string * string option) Loc.located
-
- type 'a or_var =
- | ArgArg of 'a
- | ArgVar of Names.Id.t Loc.located
-
- type 'a and_short_name = 'a * Names.Id.t Loc.located option
-
- type 'a glob_sort_gen =
- | GProp (** representation of [Prop] literal *)
- | GSet (** representation of [Set] literal *)
- | GType of 'a (** representation of [Type] literal *)
-
- type level_info = Names.Name.t Loc.located option
- type glob_level = level_info glob_sort_gen
-
- type sort_info = Names.Name.t Loc.located list
- type glob_sort = sort_info glob_sort_gen
-
- type ('a, 'b) gen_universe_decl = {
- univdecl_instance : 'a; (* Declared universes *)
- univdecl_extensible_instance : bool; (* Can new universes be added *)
- univdecl_constraints : 'b; (* Declared constraints *)
- univdecl_extensible_constraints : bool (* Can new constraints be added *) }
-
- type glob_constraint = glob_level * Univ.constraint_type * glob_level
-
- type case_style = Term.case_style =
- | LetStyle
- | IfStyle
- | LetPatternStyle
- | MatchStyle
- | RegularStyle (** infer printing form from number of constructor *)
-
- type 'a cast_type =
- | CastConv of 'a
- | CastVM of 'a
- | CastCoerce
- | CastNative of 'a
-
- type 'constr intro_pattern_expr =
- | IntroForthcoming of bool
- | IntroNaming of intro_pattern_naming_expr
- | IntroAction of 'constr intro_pattern_action_expr
- and intro_pattern_naming_expr =
- | IntroIdentifier of Names.Id.t
- | IntroFresh of Names.Id.t
- | IntroAnonymous
- and 'constr intro_pattern_action_expr =
- | IntroWildcard
- | IntroOrAndPattern of 'constr or_and_intro_pattern_expr
- | IntroInjection of ('constr intro_pattern_expr) Loc.located list
- | IntroApplyOn of 'constr Loc.located * 'constr intro_pattern_expr Loc.located
- | IntroRewrite of bool
- and 'constr or_and_intro_pattern_expr =
- | IntroOrPattern of ('constr intro_pattern_expr) Loc.located list list
- | IntroAndPattern of ('constr intro_pattern_expr) Loc.located list
-
- type quantified_hypothesis =
- | AnonHyp of int
- | NamedHyp of Names.Id.t
-
- type 'a explicit_bindings = (quantified_hypothesis * 'a) Loc.located list
-
- type 'a bindings =
- | ImplicitBindings of 'a list
- | ExplicitBindings of 'a explicit_bindings
- | NoBindings
-
- type 'a with_bindings = 'a * 'a bindings
-
- type 'a core_destruction_arg =
- | ElimOnConstr of 'a
- | ElimOnIdent of Names.Id.t Loc.located
- | ElimOnAnonHyp of int
-
- type inversion_kind =
- | SimpleInversion
- | FullInversion
- | FullInversionClear
-
- type multi =
- | Precisely of int
- | UpTo of int
- | RepeatStar
- | RepeatPlus
- type 'id move_location =
- | MoveAfter of 'id
- | MoveBefore of 'id
- | MoveFirst
- | MoveLast
-
- type 'a destruction_arg = clear_flag * 'a core_destruction_arg
-
-end
-
-module Locus :
-sig
- type 'a occurrences_gen =
- | AllOccurrences
- | AllOccurrencesBut of 'a list (** non-empty *)
- | NoOccurrences
- | OnlyOccurrences of 'a list (** non-empty *)
- type occurrences = int occurrences_gen
- type occurrences_expr = (int Misctypes.or_var) occurrences_gen
- type 'a with_occurrences = occurrences_expr * 'a
- type hyp_location_flag =
- InHyp | InHypTypeOnly | InHypValueOnly
- type 'a hyp_location_expr = 'a with_occurrences * hyp_location_flag
- type 'id clause_expr =
- { onhyps : 'id hyp_location_expr list option;
- concl_occs : occurrences_expr }
- type clause = Names.Id.t clause_expr
- type hyp_location = Names.Id.t * hyp_location_flag
- type goal_location = hyp_location option
-end
-
-(************************************************************************)
-(* End Modules from intf/ *)
-(************************************************************************)
-
-(************************************************************************)
-(* Modules from library/ *)
-(************************************************************************)
-
-module Univops :
-sig
- val universes_of_constr : Term.constr -> Univ.universe_set
- val restrict_universe_context : Univ.universe_context_set -> Univ.universe_set -> Univ.universe_context_set
-end
-
-module Nameops :
-sig
- val atompart_of_id : Names.Id.t -> string
-
- val pr_id : Names.Id.t -> Pp.t
- [@@ocaml.deprecated "alias of API.Names.Id.print"]
-
- val pr_name : Names.Name.t -> Pp.t
- [@@ocaml.deprecated "alias of API.Names.Name.print"]
-
- val name_fold : (Names.Id.t -> 'a -> 'a) -> Names.Name.t -> 'a -> 'a
- val name_app : (Names.Id.t -> Names.Id.t) -> Names.Name.t -> Names.Name.t
- val add_suffix : Names.Id.t -> string -> Names.Id.t
- val increment_subscript : Names.Id.t -> Names.Id.t
- val make_ident : string -> int option -> Names.Id.t
- val out_name : Names.Name.t -> Names.Id.t
- val pr_lab : Names.Label.t -> Pp.t
- module Name :
- sig
- include module type of struct include Names.Name end
- val get_id : t -> Names.Id.t
- val fold_right : (Names.Id.t -> 'a -> 'a) -> t -> 'a -> 'a
- end
-end
-
-module Libnames :
-sig
-
- open Util
- open Names
-
- type full_path
- val pr_path : full_path -> Pp.t
- val make_path : Names.DirPath.t -> Names.Id.t -> full_path
- val eq_full_path : full_path -> full_path -> bool
- val repr_path : full_path -> Names.DirPath.t * Names.Id.t
- val dirpath : full_path -> Names.DirPath.t
- val path_of_string : string -> full_path
-
- type qualid
- val make_qualid : Names.DirPath.t -> Names.Id.t -> qualid
- val qualid_eq : qualid -> qualid -> bool
- val repr_qualid : qualid -> Names.DirPath.t * Names.Id.t
- val pr_qualid : qualid -> Pp.t
- val string_of_qualid : qualid -> string
- val qualid_of_string : string -> qualid
- val qualid_of_path : full_path -> qualid
- val qualid_of_dirpath : Names.DirPath.t -> qualid
- val qualid_of_ident : Names.Id.t -> qualid
-
- type reference =
- | Qualid of qualid Loc.located
- | Ident of Names.Id.t Loc.located
- val loc_of_reference : reference -> Loc.t option
- val qualid_of_reference : reference -> qualid Loc.located
- val pr_reference : reference -> Pp.t
-
- val is_dirpath_prefix_of : Names.DirPath.t -> Names.DirPath.t -> bool
- val split_dirpath : Names.DirPath.t -> Names.DirPath.t * Names.Id.t
- val dirpath_of_string : string -> Names.DirPath.t
- val pr_dirpath : Names.DirPath.t -> Pp.t
-
- val string_of_path : full_path -> string
- val basename : full_path -> Names.Id.t
-
- type object_name = full_path * Names.KerName.t
- type object_prefix = Names.DirPath.t * (Names.ModPath.t * Names.DirPath.t)
-
- module Dirset : Set.S with type elt = DirPath.t
- module Dirmap : Map.ExtS with type key = DirPath.t and module Set := Dirset
- module Spmap : CSig.MapS with type key = full_path
-end
-
-module Globnames :
-sig
-
- open Util
-
- type global_reference =
- | VarRef of Names.Id.t
- | ConstRef of Names.Constant.t
- | IndRef of Names.inductive
- | ConstructRef of Names.constructor
-
- type extended_global_reference =
- | TrueGlobal of global_reference
- | SynDef of Names.KerName.t
-
- (* Long term: change implementation so that only 1 kind of order is needed.
- * Today: _env ones are fine grained, which one to pick depends. Eg.
- * - conversion rule are implemented by the non_env ones
- * - pretty printing (of user provided names/aliases) are implemented by
- * the _env ones
- *)
- module Refset : CSig.SetS with type elt = global_reference
- module Refmap : Map.ExtS
- with type key = global_reference and module Set := Refset
-
- module Refset_env : CSig.SetS with type elt = global_reference
- module Refmap_env : Map.ExtS
- with type key = global_reference and module Set := Refset_env
-
- module RefOrdered :
- sig
- type t = global_reference
- val compare : t -> t -> int
- end
-
- val pop_global_reference : global_reference -> global_reference
- val eq_gr : global_reference -> global_reference -> bool
- val destIndRef : global_reference -> Names.inductive
-
- val encode_mind : Names.DirPath.t -> Names.Id.t -> Names.MutInd.t
- val encode_con : Names.DirPath.t -> Names.Id.t -> Names.Constant.t
-
- val global_of_constr : Constr.t -> global_reference
-
- val subst_global : Mod_subst.substitution -> global_reference -> global_reference * Constr.t
- val destConstructRef : global_reference -> Names.constructor
-
- val reference_of_constr : Constr.t -> global_reference
- [@@ocaml.deprecated "alias of API.Globnames.global_of_constr"]
-
- val is_global : global_reference -> Constr.t -> bool
-end
-
-module Libobject :
-sig
- type obj
- type 'a substitutivity =
- | Dispose
- | Substitute of 'a
- | Keep of 'a
- | Anticipate of 'a
-
- type 'a object_declaration = {
- object_name : string;
- cache_function : Libnames.object_name * 'a -> unit;
- load_function : int -> Libnames.object_name * 'a -> unit;
- open_function : int -> Libnames.object_name * 'a -> unit;
- classify_function : 'a -> 'a substitutivity;
- subst_function : Mod_subst.substitution * 'a -> 'a;
- discharge_function : Libnames.object_name * 'a -> 'a option;
- rebuild_function : 'a -> 'a
- }
- val declare_object : 'a object_declaration -> ('a -> obj)
- val default_object : string -> 'a object_declaration
- val object_tag : obj -> string
-end
-
-module Summary :
-sig
-
- type frozen
-
- type marshallable =
- [ `Yes (* Full data will be marshalled to disk *)
- | `No (* Full data will be store in memory, e.g. for Undo *)
- | `Shallow ] (* Only part of the data will be marshalled to a slave process *)
-
- type 'a summary_declaration =
- { freeze_function : marshallable -> 'a;
- unfreeze_function : 'a -> unit;
- init_function : unit -> unit; }
-
- val ref : ?freeze:(marshallable -> 'a -> 'a) -> name:string -> 'a -> 'a ref
- val declare_summary : string -> 'a summary_declaration -> unit
- module Local :
- sig
- type 'a local_ref
- val ref : ?freeze:('a -> 'a) -> name:string -> 'a -> 'a local_ref
- val (:=) : 'a local_ref -> 'a -> unit
- val (!) : 'a local_ref -> 'a
- end
-end
-
-module Nametab :
-sig
- exception GlobalizationError of Libnames.qualid
-
- val global : Libnames.reference -> Globnames.global_reference
- val global_of_path : Libnames.full_path -> Globnames.global_reference
- val shortest_qualid_of_global : Names.Id.Set.t -> Globnames.global_reference -> Libnames.qualid
- val path_of_global : Globnames.global_reference -> Libnames.full_path
- val locate_extended : Libnames.qualid -> Globnames.extended_global_reference
- val full_name_module : Libnames.qualid -> Names.DirPath.t
- val pr_global_env : Names.Id.Set.t -> Globnames.global_reference -> Pp.t
- val basename_of_global : Globnames.global_reference -> Names.Id.t
-
- type visibility =
- | Until of int
- | Exactly of int
-
- val error_global_not_found : ?loc:Loc.t -> Libnames.qualid -> 'a
- val shortest_qualid_of_module : Names.ModPath.t -> Libnames.qualid
- val dirpath_of_module : Names.ModPath.t -> Names.DirPath.t
- val locate_module : Libnames.qualid -> Names.ModPath.t
- val dirpath_of_global : Globnames.global_reference -> Names.DirPath.t
- val locate : Libnames.qualid -> Globnames.global_reference
- val locate_constant : Libnames.qualid -> Names.Constant.t
-
- (** NOT FOR PUBLIC USE YET. Plugin writers, please do not rely on this API. *)
-
- module type UserName = sig
- type t
- val equal : t -> t -> bool
- val to_string : t -> string
- val repr : t -> Names.Id.t * Names.Id.t list
- end
-
- module type EqualityType =
- sig
- type t
- val equal : t -> t -> bool
- end
-
- module type NAMETREE = sig
- type elt
- type t
- type user_name
-
- val empty : t
- val push : visibility -> user_name -> elt -> t -> t
- val locate : Libnames.qualid -> t -> elt
- val find : user_name -> t -> elt
- val exists : user_name -> t -> bool
- val user_name : Libnames.qualid -> t -> user_name
- val shortest_qualid : Names.Id.Set.t -> user_name -> t -> Libnames.qualid
- val find_prefixes : Libnames.qualid -> t -> elt list
- end
-
- module Make (U : UserName) (E : EqualityType) :
- NAMETREE with type user_name = U.t and type elt = E.t
-
-end
-
-module Global :
-sig
- val env : unit -> Environ.env
- val lookup_mind : Names.MutInd.t -> Declarations.mutual_inductive_body
- val lookup_constant : Names.Constant.t -> Declarations.constant_body
- val lookup_module : Names.ModPath.t -> Declarations.module_body
- val lookup_modtype : Names.ModPath.t -> Declarations.module_type_body
- val lookup_inductive : Names.inductive -> Declarations.mutual_inductive_body * Declarations.one_inductive_body
- val constant_of_delta_kn : Names.KerName.t -> Names.Constant.t
- val register :
- Retroknowledge.field -> Constr.t -> Constr.t -> unit
- val env_of_context : Environ.named_context_val -> Environ.env
- val is_polymorphic : Globnames.global_reference -> bool
-
- val constr_of_global_in_context : Environ.env ->
- Globnames.global_reference -> Constr.types * Univ.AUContext.t
-
- val type_of_global_in_context : Environ.env ->
- Globnames.global_reference -> Constr.types * Univ.AUContext.t
-
- val current_dirpath : unit -> Names.DirPath.t
- val body_of_constant_body : Declarations.constant_body -> (Constr.t * Univ.AUContext.t) option
- val body_of_constant : Names.Constant.t -> (Constr.t * Univ.AUContext.t) option
- val add_constraints : Univ.Constraint.t -> unit
-end
-
-module Lib : sig
- type is_type = bool
- type export = bool option
- type node =
- | Leaf of Libobject.obj (* FIX: horrible hack (wrt. Enrico) *)
- | CompilingLibrary of Libnames.object_prefix
- | OpenedModule of is_type * export * Libnames.object_prefix * Summary.frozen
- | ClosedModule of library_segment
- | OpenedSection of Libnames.object_prefix * Summary.frozen
- | ClosedSection of library_segment
-
- and library_segment = (Libnames.object_name * node) list
-
- val current_mp : unit -> Names.ModPath.t
- val is_modtype : unit -> bool
- val is_module : unit -> bool
- val sections_are_opened : unit -> bool
- val add_anonymous_leaf : ?cache_first:bool -> Libobject.obj -> unit
- val contents : unit -> library_segment
- val cwd : unit -> Names.DirPath.t
- val add_leaf : Names.Id.t -> Libobject.obj -> Libnames.object_name
- val make_kn : Names.Id.t -> Names.KerName.t
- val make_path : Names.Id.t -> Libnames.full_path
- val discharge_con : Names.Constant.t -> Names.Constant.t
- val discharge_inductive : Names.inductive -> Names.inductive
-end
-
-module Declaremods :
-sig
-
- val append_end_library_hook : (unit -> unit) -> unit
-
-end
-
-module Library :
-sig
- val library_is_loaded : Names.DirPath.t -> bool
- val loaded_libraries : unit -> Names.DirPath.t list
-end
-
-module States :
-sig
- type state
-
- val with_state_protection : ('a -> 'b) -> 'a -> 'b
-end
-
-module Kindops :
-sig
- val logical_kind_of_goal_kind : Decl_kinds.goal_object_kind -> Decl_kinds.logical_kind
-end
-
-module Goptions :
-sig
- type option_name = string list
- type 'a option_sig =
- {
- optdepr : bool;
- optname : string;
- optkey : option_name;
- optread : unit -> 'a;
- optwrite : 'a -> unit
- }
-
- type 'a write_function = 'a -> unit
-
- val declare_bool_option : ?preprocess:(bool -> bool) ->
- bool option_sig -> bool write_function
- val declare_int_option : ?preprocess:(int option -> int option) ->
- int option option_sig -> int option write_function
- val declare_string_option: ?preprocess:(string -> string) ->
- string option_sig -> string write_function
- val set_bool_option_value : option_name -> bool -> unit
-end
-
-module Keys :
-sig
- type key
- val constr_key : ('a -> ('a, 't, 'u, 'i) Constr.kind_of_term) -> 'a -> key option
- val declare_equiv_keys : key -> key -> unit
- val pr_keys : (Globnames.global_reference -> Pp.t) -> Pp.t
-end
-
-module Coqlib :
-sig
-
- type coq_eq_data = { eq : Globnames.global_reference;
- ind : Globnames.global_reference;
- refl : Globnames.global_reference;
- sym : Globnames.global_reference;
- trans: Globnames.global_reference;
- congr: Globnames.global_reference;
- }
-
- type coq_sigma_data = {
- proj1 : Globnames.global_reference;
- proj2 : Globnames.global_reference;
- elim : Globnames.global_reference;
- intro : Globnames.global_reference;
- typ : Globnames.global_reference }
- val find_reference : string -> string list -> string -> Globnames.global_reference
- val check_required_library : string list -> unit
- val logic_module_name : string list
- val glob_true : Globnames.global_reference
- val glob_false : Globnames.global_reference
- val glob_O : Globnames.global_reference
- val glob_S : Globnames.global_reference
- val nat_path : Libnames.full_path
- val datatypes_module_name : string list
- val glob_eq : Globnames.global_reference
- val build_coq_eq_sym : Globnames.global_reference Util.delayed
- val build_coq_False : Globnames.global_reference Util.delayed
- val build_coq_not : Globnames.global_reference Util.delayed
- val build_coq_eq : Globnames.global_reference Util.delayed
- val build_coq_eq_data : coq_eq_data Util.delayed
- val path_of_O : Names.constructor
- val path_of_S : Names.constructor
- val build_prod : coq_sigma_data Util.delayed
- val build_coq_True : Globnames.global_reference Util.delayed
- val coq_iff_ref : Globnames.global_reference lazy_t
- val build_coq_iff_left_proj : Globnames.global_reference Util.delayed
- val build_coq_iff_right_proj : Globnames.global_reference Util.delayed
- val init_modules : string list list
- val build_coq_eq_refl : Globnames.global_reference Util.delayed
- val arith_modules : string list list
- val zarith_base_modules : string list list
- val gen_reference_in_modules : string -> string list list-> string -> Globnames.global_reference
- val jmeq_module_name : string list
- val coq_eq_ref : Globnames.global_reference lazy_t
- val coq_not_ref : Globnames.global_reference lazy_t
- val coq_or_ref : Globnames.global_reference lazy_t
- val build_coq_and : Globnames.global_reference Util.delayed
- val build_coq_or : Globnames.global_reference Util.delayed
- val build_coq_I : Globnames.global_reference Util.delayed
- val coq_reference : string -> string list -> string -> Globnames.global_reference
-end
-
-(************************************************************************)
-(* End of modules from library/ *)
-(************************************************************************)
-
-(************************************************************************)
-(* Modules from engine/ *)
-(************************************************************************)
-
-module Universes :
-sig
- type universe_binders
- type universe_opt_subst
- val fresh_inductive_instance : Environ.env -> Names.inductive -> Term.pinductive Univ.in_universe_context_set
- val new_Type : Names.DirPath.t -> Term.types
- val type_of_global : Globnames.global_reference -> Term.types Univ.in_universe_context_set
- val constr_of_global : Globnames.global_reference -> Constr.t
- val new_univ_level : Names.DirPath.t -> Univ.Level.t
- val new_sort_in_family : Sorts.family -> Sorts.t
- val pr_with_global_universes : Univ.Level.t -> Pp.t
- val pr_universe_opt_subst : universe_opt_subst -> Pp.t
- type universe_constraint
-
- module Constraints :
- sig
- type t
- val pr : t -> Pp.t
- end
-
- type universe_constraints = Constraints.t
-end
-
-module UState :
-sig
- type t
- val context : t -> Univ.UContext.t
- val context_set : t -> Univ.ContextSet.t
- val of_context_set : Univ.ContextSet.t -> t
-
- type rigid =
- | UnivRigid
- | UnivFlexible of bool
-
-end
-
-(* XXX: Moved from intf *)
-module Evar_kinds :
-sig
- type obligation_definition_status =
- | Define of bool
- | Expand
-
- type matching_var_kind =
- | FirstOrderPatVar of Names.Id.t
- | SecondOrderPatVar of Names.Id.t
-
- type t =
- | ImplicitArg of Globnames.global_reference * (int * Names.Id.t option)
- * bool (** Force inference *)
- | BinderType of Names.Name.t
- | NamedHole of Names.Id.t (* coming from some ?[id] syntax *)
- | QuestionMark of obligation_definition_status * Names.Name.t
- | CasesType of bool (* true = a subterm of the type *)
- | InternalHole
- | TomatchTypeParameter of Names.inductive * int
- | GoalEvar
- | ImpossibleCase
- | MatchingVar of matching_var_kind
- | VarInstance of Names.Id.t
- | SubEvar of Constr.existential_key
-end
-
-module Evd :
-sig
-
- type evar = Constr.existential_key
-
- val string_of_existential : Evar.t -> string
- type evar_constraint = Reduction.conv_pb * Environ.env * Constr.t * Constr.t
-
- (* --------------------------------- *)
-
- (* evar info *)
-
- module Store :
- sig
- type t
- val empty : t
- end
-
- module Filter :
- sig
- type t
- val repr : t -> bool list option
- end
-
- (** This value defines the refinement of a given {i evar} *)
- type evar_body =
- | Evar_empty (** given {i evar} was not yet refined *)
- | Evar_defined of Constr.t (** given {i var} was refined to the indicated term *)
-
- (** all the information we have concerning some {i evar} *)
- type evar_info =
- {
- evar_concl : Constr.t;
- evar_hyps : Environ.named_context_val;
- evar_body : evar_body;
- evar_filter : Filter.t;
- evar_source : Evar_kinds.t Loc.located;
- evar_candidates : Constr.t list option; (* if not None, list of allowed instances *)
- evar_extra : Store.t
- }
-
- val evar_concl : evar_info -> Constr.t
- val evar_body : evar_info -> evar_body
- val evar_context : evar_info -> Context.Named.t
- val instantiate_evar_array : evar_info -> Constr.t -> Constr.t array -> Constr.t
- val evar_filtered_env : evar_info -> Environ.env
- val evar_hyps : evar_info -> Environ.named_context_val
-
- (* ------------------------------------ *)
-
- (* evar map *)
-
- type evar_map
- type open_constr = evar_map * Constr.t
-
- open Util
-
- module Metaset : Set.S with type elt = Constr.metavariable
-
- type rigid = UState.rigid =
- | UnivRigid
- | UnivFlexible of bool
-
- type 'a freelisted = {
- rebus : 'a;
- freemetas : Metaset.t
- }
-
- type instance_constraint = IsSuperType | IsSubType | Conv
-
- type instance_typing_status =
- CoerceToType | TypeNotProcessed | TypeProcessed
-
- type instance_status = instance_constraint * instance_typing_status
-
- type clbinding =
- | Cltyp of Names.Name.t * Constr.t freelisted
- | Clval of Names.Name.t * (Constr.t freelisted * instance_status) * Constr.t freelisted
-
- val empty : evar_map
- val from_env : Environ.env -> evar_map
- val find : evar_map -> Evar.t -> evar_info
- val find_undefined : evar_map -> evar -> evar_info
- val is_defined : evar_map -> Evar.t -> bool
- val mem : evar_map -> Evar.t -> bool
- val add : evar_map -> Evar.t -> evar_info -> evar_map
- val evar_universe_context : evar_map -> UState.t
- val set_universe_context : evar_map -> UState.t -> evar_map
- val universes : evar_map -> UGraph.t
- val define : Evar.t -> Constr.t -> evar_map -> evar_map
- val fold : (Evar.t -> evar_info -> 'a -> 'a) -> evar_map -> 'a -> 'a
- val evar_key : Names.Id.t -> evar_map -> Evar.t
-
- val create_evar_defs : evar_map -> evar_map
-
- val meta_declare : Constr.metavariable -> Term.types -> ?name:Names.Name.t -> evar_map -> evar_map
-
- val clear_metas : evar_map -> evar_map
-
- (** Allocates a new evar that represents a {i sort}. *)
- val new_sort_variable : ?loc:Loc.t -> ?name:string -> rigid -> evar_map -> evar_map * Sorts.t
-
- val remove : evar_map -> Evar.t -> evar_map
- val fresh_global : ?loc:Loc.t -> ?rigid:rigid -> ?names:Univ.Instance.t -> Environ.env ->
- evar_map -> Globnames.global_reference -> evar_map * Constr.t
- val evar_filtered_context : evar_info -> Context.Named.t
- val fresh_inductive_instance : ?loc:Loc.t -> Environ.env -> evar_map -> Names.inductive -> evar_map * Term.pinductive
- val fold_undefined : (Evar.t -> evar_info -> 'a -> 'a) -> evar_map -> 'a -> 'a
-
- val universe_context_set : evar_map -> Univ.ContextSet.t
- val evar_ident : evar -> evar_map -> Names.Id.t option
- val extract_all_conv_pbs : evar_map -> evar_map * evar_constraint list
- val universe_context : names:(Names.Id.t Loc.located) list -> extensible:bool -> evar_map ->
- (Names.Id.t * Univ.Level.t) list * Univ.UContext.t
- val nf_constraints : evar_map -> evar_map
- val from_ctx : UState.t -> evar_map
-
- val meta_list : evar_map -> (Constr.metavariable * clbinding) list
-
- val meta_defined : evar_map -> Constr.metavariable -> bool
-
- val meta_name : evar_map -> Constr.metavariable -> Names.Name.t
-
- module MonadR :
- sig
- module List :
- sig
- val map_right : ('a -> evar_map -> evar_map * 'b) -> 'a list -> evar_map -> evar_map * 'b list
- end
- end
-
- type 'a sigma = {
- it : 'a ;
- sigma : evar_map
- }
-
- val sig_sig : 'a sigma -> evar_map
-
- val sig_it : 'a sigma -> 'a
-
- type 'a in_evar_universe_context = 'a * UState.t
-
- val univ_flexible : rigid
- val univ_flexible_alg : rigid
- val empty_evar_universe_context : UState.t
- val union_evar_universe_context : UState.t -> UState.t -> UState.t
- val merge_universe_context : evar_map -> UState.t -> evar_map
-
- type unsolvability_explanation =
- | SeveralInstancesFound of int
-
- (** Return {i ids} of all {i evars} that occur in a given term. *)
- val evars_of_term : Constr.t -> Evar.Set.t
-
- val evar_universe_context_of : Univ.ContextSet.t -> UState.t
- [@@ocaml.deprecated "alias of API.UState.of_context_set"]
-
- val evar_context_universe_context : UState.t -> Univ.UContext.t
- [@@ocaml.deprecated "alias of API.UState.context"]
-
- type evar_universe_context = UState.t
- [@@ocaml.deprecated "alias of API.UState.t"]
-
- val existential_opt_value : evar_map -> Term.existential -> Constr.t option
- val existential_value : evar_map -> Term.existential -> Constr.t
-
- exception NotInstantiatedEvar
-
- val fresh_sort_in_family : ?loc:Loc.t -> ?rigid:rigid -> Environ.env -> evar_map -> Sorts.family -> evar_map * Sorts.t
-end
-
-(* XXX: moved from intf *)
-module Constrexpr :
-sig
-
- type binder_kind =
- | Default of Decl_kinds.binding_kind
- | Generalized of Decl_kinds.binding_kind * Decl_kinds.binding_kind * bool
-
- type explicitation =
- | ExplByPos of int * Names.Id.t option
- | ExplByName of Names.Id.t
- type sign = bool
- type raw_natural_number = string
- type prim_token =
- | Numeral of raw_natural_number * sign
- | String of string
-
- type notation = string
- type instance_expr = Misctypes.glob_level list
- type proj_flag = int option
- type abstraction_kind =
- | AbsLambda
- | AbsPi
-
- type cases_pattern_expr_r =
- | CPatAlias of cases_pattern_expr * Names.Id.t
- | CPatCstr of Libnames.reference
- * cases_pattern_expr list option * cases_pattern_expr list
- (** [CPatCstr (_, c, Some l1, l2)] represents (@c l1) l2 *)
- | CPatAtom of Libnames.reference option
- | CPatOr of cases_pattern_expr list
- | CPatNotation of notation * cases_pattern_notation_substitution
- * cases_pattern_expr list
- | CPatPrim of prim_token
- | CPatRecord of (Libnames.reference * cases_pattern_expr) list
- | CPatDelimiters of string * cases_pattern_expr
- | CPatCast of cases_pattern_expr * constr_expr
- and cases_pattern_expr = cases_pattern_expr_r CAst.t
-
- and cases_pattern_notation_substitution =
- cases_pattern_expr list * cases_pattern_expr list list
-
- and constr_expr_r =
- | CRef of Libnames.reference * instance_expr option
- | CFix of Names.Id.t Loc.located * fix_expr list
- | CCoFix of Names.Id.t Loc.located * cofix_expr list
- | CProdN of binder_expr list * constr_expr
- | CLambdaN of binder_expr list * constr_expr
- | CLetIn of Names.Name.t Loc.located * constr_expr * constr_expr option * constr_expr
- | CAppExpl of (proj_flag * Libnames.reference * instance_expr option) * constr_expr list
- | CApp of (proj_flag * constr_expr) *
- (constr_expr * explicitation Loc.located option) list
- | CRecord of (Libnames.reference * constr_expr) list
- | CCases of Term.case_style
- * constr_expr option
- * case_expr list
- * branch_expr list
- | CLetTuple of Names.Name.t Loc.located list * (Names.Name.t Loc.located option * constr_expr option) *
- constr_expr * constr_expr
- | CIf of constr_expr * (Names.Name.t Loc.located option * constr_expr option)
- * constr_expr * constr_expr
- | CHole of Evar_kinds.t option * Misctypes.intro_pattern_naming_expr * Genarg.raw_generic_argument option
- | CPatVar of Names.Id.t
- | CEvar of Names.Id.t * (Names.Id.t * constr_expr) list
- | CSort of Misctypes.glob_sort
- | CCast of constr_expr * constr_expr Misctypes.cast_type
- | CNotation of notation * constr_notation_substitution
- | CGeneralization of Decl_kinds.binding_kind * abstraction_kind option * constr_expr
- | CPrim of prim_token
- | CDelimiters of string * constr_expr
- and constr_expr = constr_expr_r CAst.t
-
- and case_expr = constr_expr * Names.Name.t Loc.located option * cases_pattern_expr option
-
- and branch_expr =
- (cases_pattern_expr list Loc.located list * constr_expr) Loc.located
-
- and binder_expr =
- Names.Name.t Loc.located list * binder_kind * constr_expr
-
- and fix_expr =
- Names.Id.t Loc.located * (Names.Id.t Loc.located option * recursion_order_expr) *
- local_binder_expr list * constr_expr * constr_expr
-
- and cofix_expr =
- Names.Id.t Loc.located * local_binder_expr list * constr_expr * constr_expr
-
- and recursion_order_expr =
- | CStructRec
- | CWfRec of constr_expr
- | CMeasureRec of constr_expr * constr_expr option
-
- and local_binder_expr =
- | CLocalAssum of Names.Name.t Loc.located list * binder_kind * constr_expr
- | CLocalDef of Names.Name.t Loc.located * constr_expr * constr_expr option
- | CLocalPattern of (cases_pattern_expr * constr_expr option) Loc.located
-
- and constr_notation_substitution =
- constr_expr list *
- constr_expr list list *
- local_binder_expr list list
-
- type constr_pattern_expr = constr_expr
-end
-
-module Genredexpr :
-sig
-
- (** The parsing produces initially a list of [red_atom] *)
- type 'a red_atom =
- | FBeta
- | FMatch
- | FFix
- | FCofix
- | FZeta
- | FConst of 'a list
- | FDeltaBut of 'a list
-
- (** This list of atoms is immediately converted to a [glob_red_flag] *)
- type 'a glob_red_flag = {
- rBeta : bool;
- rMatch : bool;
- rFix : bool;
- rCofix : bool;
- rZeta : bool;
- rDelta : bool; (** true = delta all but rConst; false = delta only on rConst*)
- rConst : 'a list
- }
-
- (** Generic kinds of reductions *)
- type ('a,'b,'c) red_expr_gen =
- | Red of bool
- | Hnf
- | Simpl of 'b glob_red_flag*('b,'c) Util.union Locus.with_occurrences option
- | Cbv of 'b glob_red_flag
- | Cbn of 'b glob_red_flag
- | Lazy of 'b glob_red_flag
- | Unfold of 'b Locus.with_occurrences list
- | Fold of 'a list
- | Pattern of 'a Locus.with_occurrences list
- | ExtraRedExpr of string
- | CbvVm of ('b,'c) Util.union Locus.with_occurrences option
- | CbvNative of ('b,'c) Util.union Locus.with_occurrences option
-
- type ('a,'b,'c) may_eval =
- | ConstrTerm of 'a
- | ConstrEval of ('a,'b,'c) red_expr_gen * 'a
- | ConstrContext of Names.Id.t Loc.located * 'a
- | ConstrTypeOf of 'a
-
- type r_trm = Constrexpr.constr_expr
- type r_pat = Constrexpr.constr_pattern_expr
- type r_cst = Libnames.reference Misctypes.or_by_notation
- type raw_red_expr = (r_trm, r_cst, r_pat) red_expr_gen
-end
-
-(* XXX: end of moved from intf *)
-
-module EConstr :
-sig
- type t
- type constr = t
- type types = t
- type unsafe_judgment = (constr, types) Environ.punsafe_judgment
- type named_declaration = (constr, types) Context.Named.Declaration.pt
- type named_context = (constr, types) Context.Named.pt
- type rel_context = (constr, types) Context.Rel.pt
- type rel_declaration = (constr, types) Context.Rel.Declaration.pt
- type existential = constr Constr.pexistential
- module ESorts :
- sig
- type t
- (** Type of sorts up-to universe unification. Essentially a wrapper around
- Sorts.t so that normalization is ensured statically. *)
-
- val make : Sorts.t -> t
- (** Turn a sort into an up-to sort. *)
-
- val kind : Evd.evar_map -> t -> Sorts.t
- (** Returns the view into the current sort. Note that the kind of a variable
- may change if the unification state of the evar map changes. *)
-
- end
-
- module EInstance :
- sig
- type t
- (** Type of universe instances up-to universe unification. Similar to
- {ESorts.t} for {Univ.Instance.t}. *)
-
- val make : Univ.Instance.t -> t
- val kind : Evd.evar_map -> t -> Univ.Instance.t
- val empty : t
- val is_empty : t -> bool
- end
-
- val of_constr : Constr.t -> constr
-
- val kind : Evd.evar_map -> constr -> (constr, constr, ESorts.t, EInstance.t) Constr.kind_of_term
-
- val mkArrow : constr -> constr -> constr
- val mkInd : Names.inductive -> t
- val mkProp : constr
- val mkProd : Names.Name.t * constr * constr -> constr
- val mkRel : int -> constr
- val mkSort : Sorts.t -> constr
- val mkVar : Names.Id.t -> constr
- val mkLambda : Names.Name.t * constr * constr -> constr
- val mkLambda_or_LetIn : rel_declaration -> constr -> constr
- val mkApp : constr * constr array -> constr
- val mkEvar : constr Constr.pexistential -> constr
-
- val mkMeta : Constr.metavariable -> constr
-
- val mkConstructU : Names.constructor * EInstance.t -> constr
- val mkLetIn : Names.Name.t * constr * constr * constr -> constr
- val mkProd_or_LetIn : rel_declaration -> constr -> constr
- val mkCast : constr * Constr.cast_kind * constr -> constr
- val mkNamedLambda : Names.Id.t -> types -> constr -> constr
- val mkNamedProd : Names.Id.t -> types -> types -> types
-
- val isCast : Evd.evar_map -> t -> bool
- val isEvar : Evd.evar_map -> constr -> bool
- val isInd : Evd.evar_map -> constr -> bool
- val isRel : Evd.evar_map -> constr -> bool
- val isSort : Evd.evar_map -> constr -> bool
- val isVar : Evd.evar_map -> constr -> bool
- val isConst : Evd.evar_map -> constr -> bool
- val isConstruct : Evd.evar_map -> constr -> bool
-
- val destInd : Evd.evar_map -> constr -> Names.inductive * EInstance.t
- val destVar : Evd.evar_map -> constr -> Names.Id.t
- val destEvar : Evd.evar_map -> constr -> constr Constr.pexistential
- val destRel : Evd.evar_map -> constr -> int
- val destProd : Evd.evar_map -> constr -> Names.Name.t * types * types
- val destLambda : Evd.evar_map -> constr -> Names.Name.t * types * constr
- val destApp : Evd.evar_map -> constr -> constr * constr array
- val destConst : Evd.evar_map -> constr -> Names.Constant.t * EInstance.t
- val destConstruct : Evd.evar_map -> constr -> Names.constructor * EInstance.t
- val destFix : Evd.evar_map -> t -> (t, t) Constr.pfixpoint
- val destCast : Evd.evar_map -> t -> t * Constr.cast_kind * t
-
- val mkConstruct : Names.constructor -> constr
-
- val compose_lam : (Names.Name.t * constr) list -> constr -> constr
-
- val decompose_lam : Evd.evar_map -> constr -> (Names.Name.t * constr) list * constr
- val decompose_lam_n_assum : Evd.evar_map -> int -> constr -> rel_context * constr
- val decompose_app : Evd.evar_map -> constr -> constr * constr list
- val decompose_prod : Evd.evar_map -> constr -> (Names.Name.t * constr) list * constr
- val decompose_prod_assum : Evd.evar_map -> constr -> rel_context * constr
-
- val applist : constr * constr list -> constr
-
- val to_constr : Evd.evar_map -> constr -> Constr.t
-
- val push_rel : rel_declaration -> Environ.env -> Environ.env
-
- module Unsafe :
- sig
- val to_constr : constr -> Constr.t
-
- val to_rel_decl : (constr, types) Context.Rel.Declaration.pt -> (Constr.constr, Constr.types) Context.Rel.Declaration.pt
-
- (** Physical identity. Does not care for defined evars. *)
-
- val to_named_decl : (constr, types) Context.Named.Declaration.pt -> (Constr.constr, Constr.types) Context.Named.Declaration.pt
-
- val to_instance : EInstance.t -> Univ.Instance.t
- end
-
- module Vars :
- sig
- val substnl : t list -> int -> t -> t
- val noccurn : Evd.evar_map -> int -> constr -> bool
- val closed0 : Evd.evar_map -> constr -> bool
- val subst1 : constr -> constr -> constr
- val substl : constr list -> constr -> constr
- val lift : int -> constr -> constr
- val liftn : int -> int -> t -> t
- val subst_var : Names.Id.t -> t -> t
- val subst_vars : Names.Id.t list -> t -> t
- end
-
- val fresh_global :
- ?loc:Loc.t -> ?rigid:UState.rigid -> ?names:Univ.Instance.t -> Environ.env ->
- Evd.evar_map -> Globnames.global_reference -> Evd.evar_map * t
-
- val of_named_decl : (Constr.t, Constr.types) Context.Named.Declaration.pt -> (constr, types) Context.Named.Declaration.pt
- val of_rel_decl : (Constr.t, Constr.types) Context.Rel.Declaration.pt -> (constr, types) Context.Rel.Declaration.pt
- val kind_of_type : Evd.evar_map -> constr -> (constr, constr) Term.kind_of_type
- val to_lambda : Evd.evar_map -> int -> constr -> constr
- val it_mkLambda_or_LetIn : constr -> rel_context -> constr
- val push_rel_context : rel_context -> Environ.env -> Environ.env
- val eq_constr : Evd.evar_map -> constr -> constr -> bool
- val iter_with_binders : Evd.evar_map -> ('a -> 'a) -> ('a -> constr -> unit) -> 'a -> constr -> unit
- val fold : Evd.evar_map -> ('a -> constr -> 'a) -> 'a -> constr -> 'a
- val existential_type : Evd.evar_map -> existential -> types
- val iter : Evd.evar_map -> (constr -> unit) -> constr -> unit
- val eq_constr_universes : Evd.evar_map -> constr -> constr -> Universes.universe_constraints option
- val eq_constr_nounivs : Evd.evar_map -> constr -> constr -> bool
- val compare_constr : Evd.evar_map -> (constr -> constr -> bool) -> constr -> constr -> bool
- val isApp : Evd.evar_map -> constr -> bool
- val it_mkProd_or_LetIn : constr -> rel_context -> constr
- val push_named : named_declaration -> Environ.env -> Environ.env
- val destCase : Evd.evar_map -> constr -> Constr.case_info * constr * constr * constr array
- val decompose_lam_assum : Evd.evar_map -> constr -> rel_context * constr
- val mkConst : Names.Constant.t -> constr
- val mkCase : Constr.case_info * constr * constr * constr array -> constr
- val named_context : Environ.env -> named_context
- val val_of_named_context : named_context -> Environ.named_context_val
- val mkFix : (t, t) Constr.pfixpoint -> t
- val decompose_prod_n_assum : Evd.evar_map -> int -> t -> rel_context * t
- val isMeta : Evd.evar_map -> t -> bool
-
- val destMeta : Evd.evar_map -> t -> Constr.metavariable
-
- val map_with_binders : Evd.evar_map -> ('a -> 'a) -> ('a -> t -> t) -> 'a -> t -> t
- val mkNamedLetIn : Names.Id.t -> constr -> types -> constr -> constr
- val map : Evd.evar_map -> (t -> t) -> t -> t
- val mkConstU : Names.Constant.t * EInstance.t -> t
- val isProd : Evd.evar_map -> t -> bool
- val mkConstructUi : (Names.inductive * EInstance.t) * int -> t
- val isLambda : Evd.evar_map -> t -> bool
-end
-
-(* XXX: Located manually from intf *)
-module Pattern :
-sig
-
- type case_info_pattern =
- { cip_style : Misctypes.case_style;
- cip_ind : Names.inductive option;
- cip_ind_tags : bool list option; (** indicates LetIn/Lambda in arity *)
- cip_extensible : bool (** does this match end with _ => _ ? *) }
-
- type constr_pattern =
- | PRef of Globnames.global_reference
- | PVar of Names.Id.t
- | PEvar of Evar.t * constr_pattern array
- | PRel of int
- | PApp of constr_pattern * constr_pattern array
- | PSoApp of Names.Id.t * constr_pattern list
- | PProj of Names.Projection.t * constr_pattern
- | PLambda of Names.Name.t * constr_pattern * constr_pattern
- | PProd of Names.Name.t * constr_pattern * constr_pattern
- | PLetIn of Names.Name.t * constr_pattern * constr_pattern option * constr_pattern
- | PSort of Misctypes.glob_sort
- | PMeta of Names.Id.t option
- | PIf of constr_pattern * constr_pattern * constr_pattern
- | PCase of case_info_pattern * constr_pattern * constr_pattern *
- (int * bool list * constr_pattern) list (** index of constructor, nb of args *)
- | PFix of Term.fixpoint
- | PCoFix of Term.cofixpoint
-
-end
-
-module Namegen :
-sig
- (** *)
-
- (** [next_ident_away original_id unwanted_ids] returns a new identifier as close as possible
- to the [original_id] while avoiding all [unwanted_ids].
-
- In particular:
- {ul {- if [original_id] does not appear in the list of [unwanted_ids], then [original_id] is returned.}
- {- if [original_id] appears in the list of [unwanted_ids],
- then this function returns a new id that:
- {ul {- has the same {i root} as the [original_id],}
- {- does not occur in the list of [unwanted_ids],}
- {- has the smallest possible {i subscript}.}}}}
-
- where by {i subscript} of some identifier we mean last part of it that is composed
- only from (decimal) digits and by {i root} of some identifier we mean
- the whole identifier except for the {i subscript}.
-
- E.g. if we take [foo42], then [42] is the {i subscript}, and [foo] is the root. *)
- val next_ident_away : Names.Id.t -> Names.Id.Set.t -> Names.Id.t
-
- val hdchar : Environ.env -> Evd.evar_map -> EConstr.types -> string
- val id_of_name_using_hdchar : Environ.env -> Evd.evar_map -> EConstr.types -> Names.Name.t -> Names.Id.t
- val next_ident_away_in_goal : Names.Id.t -> Names.Id.Set.t -> Names.Id.t
- val default_dependent_ident : Names.Id.t
- val next_global_ident_away : Names.Id.t -> Names.Id.Set.t -> Names.Id.t
- val rename_bound_vars_as_displayed :
- Evd.evar_map -> Names.Id.Set.t -> Names.Name.t list -> EConstr.types -> EConstr.types
-end
-
-module Termops :
-sig
- val it_mkLambda_or_LetIn : Constr.t -> Context.Rel.t -> Constr.t
- val local_occur_var : Evd.evar_map -> Names.Id.t -> EConstr.constr -> bool
- val occur_var : Environ.env -> Evd.evar_map -> Names.Id.t -> EConstr.constr -> bool
- val pr_evar_info : Evd.evar_info -> Pp.t
-
- val print_constr : EConstr.constr -> Pp.t
- val pr_sort_family : Sorts.family -> Pp.t
-
- (** [dependent m t] tests whether [m] is a subterm of [t] *)
- val dependent : Evd.evar_map -> EConstr.constr -> EConstr.constr -> bool
-
- (** [pop c] returns a copy of [c] with decremented De Bruijn indexes *)
- val pop : EConstr.constr -> EConstr.constr
-
- (** Does a given term contain an existential variable? *)
- val occur_existential : Evd.evar_map -> EConstr.constr -> bool
-
- (** [map_constr_with_binders_left_to_right g f acc c] maps [f updated_acc] on all the immediate subterms of [c].
- {ul {- if a given immediate subterm of [c] is not below a binder, then [updated_acc] is the same as [acc].}
- {- if a given immediate subterm of [c] is below a binder [b], then [updated_acc] is computed as [g b acc].}} *)
- val map_constr_with_binders_left_to_right :
- Evd.evar_map -> (EConstr.rel_declaration -> 'a -> 'a) -> ('a -> EConstr.constr -> EConstr.constr) -> 'a -> EConstr.constr -> EConstr.constr
-
- (** Remove the outer-most {!Term.kind_of_term.Cast} from a given term. *)
- val strip_outer_cast : Evd.evar_map -> EConstr.constr -> EConstr.constr
-
- (** [nb_lam] ⟦[fun (x1:t1)...(xn:tn) => c]⟧ where [c] is not an abstraction gives [n].
- Casts are ignored. *)
- val nb_lam : Evd.evar_map -> EConstr.constr -> int
-
- (** [push_rel_assum env_assumtion env] adds a given {i env assumption} to the {i env context} of a given {i environment}. *)
- val push_rel_assum : Names.Name.t * EConstr.types -> Environ.env -> Environ.env
-
- (** [push_rels_assum env_assumptions env] adds given {i env assumptions} to the {i env context} of a given {i environment}. *)
- val push_rels_assum : (Names.Name.t * Term.types) list -> Environ.env -> Environ.env
-
- type meta_value_map = (Constr.metavariable * Constr.t) list
-
- val last_arg : Evd.evar_map -> EConstr.constr -> EConstr.constr
- val assums_of_rel_context : ('c, 't) Context.Rel.pt -> (Names.Name.t * 't) list
- val prod_applist : Evd.evar_map -> EConstr.constr -> EConstr.constr list -> EConstr.constr
- val nb_prod : Evd.evar_map -> EConstr.constr -> int
- val is_section_variable : Names.Id.t -> bool
- val ids_of_rel_context : ('c, 't) Context.Rel.pt -> Names.Id.t list
- val subst_term : Evd.evar_map -> EConstr.constr -> EConstr.constr -> EConstr.constr
- val global_vars_set_of_decl : Environ.env -> Evd.evar_map -> EConstr.named_declaration -> Names.Id.Set.t
- val vars_of_env: Environ.env -> Names.Id.Set.t
- val ids_of_named_context : ('c, 't) Context.Named.pt -> Names.Id.t list
- val ids_of_context : Environ.env -> Names.Id.t list
- val global_of_constr : Evd.evar_map -> EConstr.constr -> Globnames.global_reference * EConstr.EInstance.t
- val print_named_context : Environ.env -> Pp.t
- val print_constr_env : Environ.env -> Evd.evar_map -> EConstr.constr -> Pp.t
- val clear_named_body : Names.Id.t -> Environ.env -> Environ.env
- val is_Prop : Evd.evar_map -> EConstr.constr -> bool
- val is_Set : Evd.evar_map -> EConstr.constr -> bool
- val is_Type : Evd.evar_map -> EConstr.constr -> bool
- val is_global : Evd.evar_map -> Globnames.global_reference -> EConstr.constr -> bool
-
- val eq_constr : Evd.evar_map -> EConstr.constr -> EConstr.constr -> bool
-
- val occur_var_in_decl :
- Environ.env -> Evd.evar_map ->
- Names.Id.t -> EConstr.named_declaration -> bool
-
- val subst_meta : meta_value_map -> Constr.t -> Constr.t
-
- val free_rels : Evd.evar_map -> EConstr.constr -> Int.Set.t
-
- val occur_term : Evd.evar_map -> EConstr.constr -> EConstr.constr -> bool
- [@@ocaml.deprecated "alias of API.Termops.dependent"]
-
- val replace_term : Evd.evar_map -> EConstr.constr -> EConstr.constr -> EConstr.constr -> EConstr.constr
- val map_named_decl : ('a -> 'b) -> ('a, 'a) Context.Named.Declaration.pt -> ('b, 'b) Context.Named.Declaration.pt
- val map_rel_decl : ('a -> 'b) -> ('a, 'a) Context.Rel.Declaration.pt -> ('b, 'b) Context.Rel.Declaration.pt
- val pr_metaset : Evd.Metaset.t -> Pp.t
- val pr_evar_map : ?with_univs:bool -> int option -> Evd.evar_map -> Pp.t
- val pr_evar_universe_context : UState.t -> Pp.t
-end
-
-module Proofview_monad :
-sig
- type lazy_msg = unit -> Pp.t
- module Info :
- sig
- type tree
- end
-end
-
-module Evarutil :
-sig
- val e_new_global : Evd.evar_map ref -> Globnames.global_reference -> EConstr.constr
-
- val nf_evars_and_universes : Evd.evar_map -> Evd.evar_map * (Constr.t -> Constr.t)
- val nf_evar : Evd.evar_map -> EConstr.constr -> EConstr.constr
- val nf_evar_info : Evd.evar_map -> Evd.evar_info -> Evd.evar_info
-
- val mk_new_meta : unit -> EConstr.constr
-
- (** [new_meta] is a generator of unique meta variables *)
- val new_meta : unit -> Constr.metavariable
-
- val new_Type : ?rigid:Evd.rigid -> Environ.env -> Evd.evar_map -> Evd.evar_map * EConstr.constr
- val new_global : Evd.evar_map -> Globnames.global_reference -> Evd.evar_map * EConstr.constr
-
- val new_evar :
- Environ.env -> Evd.evar_map -> ?src:Evar_kinds.t Loc.located -> ?filter:Evd.Filter.t ->
- ?candidates:EConstr.constr list -> ?store:Evd.Store.t ->
- ?naming:Misctypes.intro_pattern_naming_expr ->
- ?principal:bool -> EConstr.types -> Evd.evar_map * EConstr.constr
-
- val new_evar_instance :
- Environ.named_context_val -> Evd.evar_map -> EConstr.types ->
- ?src:Evar_kinds.t Loc.located -> ?filter:Evd.Filter.t -> ?candidates:EConstr.constr list ->
- ?store:Evd.Store.t -> ?naming:Misctypes.intro_pattern_naming_expr ->
- ?principal:bool ->
- EConstr.constr list -> Evd.evar_map * EConstr.constr
-
- val clear_hyps_in_evi : Environ.env -> Evd.evar_map ref -> Environ.named_context_val ->
- EConstr.types -> Names.Id.Set.t -> Environ.named_context_val * EConstr.types
-
- type clear_dependency_error =
- | OccurHypInSimpleClause of Names.Id.t option
- | EvarTypingBreak of Constr.existential
-
- exception ClearDependencyError of Names.Id.t * clear_dependency_error
- val undefined_evars_of_term : Evd.evar_map -> EConstr.constr -> Evar.Set.t
- val e_new_evar :
- Environ.env -> Evd.evar_map ref -> ?src:Evar_kinds.t Loc.located -> ?filter:Evd.Filter.t ->
- ?candidates:EConstr.constr list -> ?store:Evd.Store.t ->
- ?naming:Misctypes.intro_pattern_naming_expr ->
- ?principal:bool -> EConstr.types -> EConstr.constr
- val new_type_evar :
- Environ.env -> Evd.evar_map -> ?src:Evar_kinds.t Loc.located -> ?filter:Evd.Filter.t ->
- ?naming:Misctypes.intro_pattern_naming_expr -> ?principal:bool -> Evd.rigid ->
- Evd.evar_map * (EConstr.constr * Sorts.t)
- val nf_evars_universes : Evd.evar_map -> Constr.t -> Constr.t
- val safe_evar_value : Evd.evar_map -> Term.existential -> Constr.t option
- val evd_comb1 : (Evd.evar_map -> 'b -> Evd.evar_map * 'a) -> Evd.evar_map ref -> 'b -> 'a
-end
-
-module Proofview :
-sig
- type proofview
- type entry
- type +'a tactic
- type telescope =
- | TNil of Evd.evar_map
- | TCons of Environ.env * Evd.evar_map * EConstr.types * (Evd.evar_map -> EConstr.constr -> telescope)
-
- module NonLogical :
- sig
- type +'a t
- val make : (unit -> 'a) -> 'a t
- val return : 'a -> 'a t
- val ( >> ) : unit t -> 'a t -> 'a t
- val ( >>= ) : 'a t -> ('a -> 'b t) -> 'b t
- val print_char : char -> unit t
- val print_debug : Pp.t -> unit t
- val print_warning : Pp.t -> unit t
- val print_notice : Pp.t -> unit t
- val print_info : Pp.t -> unit t
- val run : 'a t -> 'a
- type 'a ref
- val ref : 'a -> 'a ref t
- val ( := ) : 'a ref -> 'a -> unit t
- val ( ! ) : 'a ref -> 'a t
- val raise : ?info:Exninfo.info -> exn -> 'a t
- val catch : 'a t -> (Exninfo.iexn -> 'a t) -> 'a t
- val read_line : string t
- end
- val proofview : proofview -> Evd.evar list * Evd.evar_map
- val cycle : int -> unit tactic
- val swap : int -> int -> unit tactic
- val revgoals : unit tactic
- val give_up : unit tactic
- val init : Evd.evar_map -> (Environ.env * EConstr.types) list -> entry * proofview
- val shelve : unit tactic
- val tclZERO : ?info:Exninfo.info -> exn -> 'a tactic
- val tclUNIT : 'a -> 'a tactic
- val tclBIND : 'a tactic -> ('a -> 'b tactic) -> 'b tactic
- val tclORELSE : 'a tactic -> (Util.iexn -> 'a tactic) -> 'a tactic
- val tclFOCUS : int -> int -> 'a tactic -> 'a tactic
- val tclEVARMAP : Evd.evar_map tactic
- val tclTHEN : unit tactic -> 'a tactic -> 'a tactic
- val tclLIFT : 'a NonLogical.t -> 'a tactic
- val tclOR : 'a tactic -> (Exninfo.iexn -> 'a tactic) -> 'a tactic
- val tclIFCATCH : 'a tactic -> ('a -> 'b tactic) -> (Exninfo.iexn -> 'b tactic) -> 'b tactic
- val tclINDEPENDENT : unit tactic -> unit tactic
- val tclDISPATCH : unit tactic list -> unit tactic
- val tclEXTEND : unit tactic list -> unit tactic -> unit tactic list -> unit tactic
- val tclBREAK : (Exninfo.iexn -> Exninfo.iexn option) -> 'a tactic -> 'a tactic
- val tclENV : Environ.env tactic
- val tclONCE : 'a tactic -> 'a tactic
- val tclPROGRESS : 'a tactic -> 'a tactic
- val shelve_unifiable : unit tactic
- val apply : Environ.env -> 'a tactic -> proofview -> 'a
- * proofview
- * (bool * Evd.evar list * Evd.evar list)
- * Proofview_monad.Info.tree
- val numgoals : int tactic
- val with_shelf : 'a tactic -> (Evd.evar list * 'a) tactic
-
- module Unsafe :
- sig
- val tclEVARS : Evd.evar_map -> unit tactic
-
- val tclGETGOALS : Evd.evar list tactic
-
- val tclSETGOALS : Evd.evar list -> unit tactic
-
- val tclNEWGOALS : Evd.evar list -> unit tactic
- end
-
- module Goal :
- sig
- type 'a t
- val enter : ([ `LZ ] t -> unit tactic) -> unit tactic
- val hyps : 'a t -> EConstr.named_context
- val nf_enter : ([ `NF ] t -> unit tactic) -> unit tactic
- val enter_one : ([ `LZ ] t -> 'a tactic) -> 'a tactic
- val concl : 'a t -> EConstr.constr
- val sigma : 'a t -> Evd.evar_map
- val goal : [ `NF ] t -> Evar.t
- val env : 'a t -> Environ.env
- val assume : 'a t -> [ `NF ] t
- end
-
- module Notations :
- sig
- val (>>=) : 'a tactic -> ('a -> 'b tactic) -> 'b tactic
- val (<*>) : unit tactic -> 'a tactic -> 'a tactic
- val (<+>) : 'a tactic -> 'a tactic -> 'a tactic
- end
- module V82 :
- sig
- type tac = Evar.t Evd.sigma -> Evar.t list Evd.sigma
-
- val tactic : tac -> unit tactic
-
- val of_tactic : 'a tactic -> tac
-
- val nf_evar_goals : unit tactic
-
- val wrap_exceptions : (unit -> 'a tactic) -> 'a tactic
-
- val catchable_exception : exn -> bool
- end
- module Trace :
- sig
- val name_tactic : Proofview_monad.lazy_msg -> 'a tactic -> 'a tactic
- val log : Proofview_monad.lazy_msg -> unit tactic
- end
-end
-
-module Ftactic :
-sig
- type +'a focus
- type +'a t = 'a focus Proofview.tactic
- val return : 'a -> 'a t
- val run : 'a t -> ('a -> unit Proofview.tactic) -> unit Proofview.tactic
- val enter : ([ `LZ ] Proofview.Goal.t -> 'a t) -> 'a t
- val nf_enter : ([ `NF ] Proofview.Goal.t -> 'a t) -> 'a t
- val bind : 'a t -> ('a -> 'b t) -> 'b t
- val (>>=) : 'a t -> ('a -> 'b t) -> 'b t
- val lift : 'a Proofview.tactic -> 'a t
- val with_env : 'a t -> (Environ.env * 'a) t
- module List :
- sig
- val map : ('a -> 'b t) -> 'a list -> 'b list t
- val map_right : ('a -> 'b t) -> 'a list -> 'b list t
- end
- module Notations :
- sig
- val (>>=) : 'a t -> ('a -> 'b t) -> 'b t
- val (<*>) : unit t -> 'a t -> 'a t
- end
-end
-
-module Geninterp :
-sig
- module Val :
- sig
- type 'a typ
- type t = Dyn : 'a typ * 'a -> t
- type 'a tag =
- | Base : 'a typ -> 'a tag
- | List : 'a tag -> 'a list tag
- | Opt : 'a tag -> 'a option tag
- | Pair : 'a tag * 'b tag -> ('a * 'b) tag
- val create : string -> 'a typ
- val pr : 'a typ -> Pp.t
- val eq : 'a typ -> 'b typ -> ('a, 'b) CSig.eq option
- val typ_list : t list typ
- val typ_opt : t option typ
- val typ_pair : (t * t) typ
- val repr : 'a typ -> string
- val inject : 'a tag -> 'a -> t
- end
- module TacStore :
- sig
- type t
- type 'a field
- val empty : t
- val field : unit -> 'a field
- val get : t -> 'a field -> 'a option
- val set : t -> 'a field -> 'a -> t
- val remove : t -> 'a field -> t
- val merge : t -> t -> t
- end
- type interp_sign = {
- lfun : Val.t Names.Id.Map.t;
- extra : TacStore.t
- }
- type ('glb, 'top) interp_fun = interp_sign -> 'glb -> 'top Ftactic.t
- val register_interp0 :
- ('raw, 'glb, 'top) Genarg.genarg_type -> ('glb, Val.t) interp_fun -> unit
- val register_val0 : ('raw, 'glb, 'top) Genarg.genarg_type -> 'top Val.tag option -> unit
- val val_tag : 'a Genarg.typed_abstract_argument_type -> 'a Val.tag
- val interp : ('raw, 'glb, 'top) Genarg.genarg_type -> ('glb, Val.t) interp_fun
-end
-
-(* XXX: Located manually from intf *)
-module Glob_term :
-sig
- type 'a cases_pattern_r =
- | PatVar of Names.Name.t
- | PatCstr of Names.constructor * 'a cases_pattern_g list * Names.Name.t
- and 'a cases_pattern_g = ('a cases_pattern_r, 'a) DAst.t
- type cases_pattern = [ `any ] cases_pattern_g
- type existential_name = Names.Id.t
- type 'a glob_constr_r =
- | GRef of Globnames.global_reference * Misctypes.glob_level list option
- (** An identifier that represents a reference to an object defined
- either in the (global) environment or in the (local) context. *)
- | GVar of Names.Id.t
- (** An identifier that cannot be regarded as "GRef".
- Bound variables are typically represented this way. *)
- | GEvar of existential_name * (Names.Id.t * 'a glob_constr_g) list
- | GPatVar of Evar_kinds.matching_var_kind
- | GApp of 'a glob_constr_g * 'a glob_constr_g list
- | GLambda of Names.Name.t * Decl_kinds.binding_kind * 'a glob_constr_g * 'a glob_constr_g
- | GProd of Names.Name.t * Decl_kinds.binding_kind * 'a glob_constr_g * 'a glob_constr_g
- | GLetIn of Names.Name.t * 'a glob_constr_g * 'a glob_constr_g option * 'a glob_constr_g
- | GCases of Term.case_style * 'a glob_constr_g option * 'a tomatch_tuples_g * 'a cases_clauses_g
- | GLetTuple of Names.Name.t list * (Names.Name.t * 'a glob_constr_g option) * 'a glob_constr_g * 'a glob_constr_g
- | GIf of 'a glob_constr_g * (Names.Name.t * 'a glob_constr_g option) * 'a glob_constr_g * 'a glob_constr_g
- | GRec of 'a fix_kind_g * Names.Id.t array * 'a glob_decl_g list array *
- 'a glob_constr_g array * 'a glob_constr_g array
- | GSort of Misctypes.glob_sort
- | GHole of Evar_kinds.t * Misctypes.intro_pattern_naming_expr * Genarg.glob_generic_argument option
- | GCast of 'a glob_constr_g * 'a glob_constr_g Misctypes.cast_type
-
- and 'a glob_constr_g = ('a glob_constr_r, 'a) DAst.t
-
- and 'a glob_decl_g = Names.Name.t * Decl_kinds.binding_kind * 'a glob_constr_g option * 'a glob_constr_g
-
- and 'a fix_recursion_order_g =
- | GStructRec
- | GWfRec of 'a glob_constr_g
- | GMeasureRec of 'a glob_constr_g * 'a glob_constr_g option
-
- and 'a fix_kind_g =
- | GFix of ((int option * 'a fix_recursion_order_g) array * int)
- | GCoFix of int
-
- and 'a predicate_pattern_g =
- Names.Name.t * (Names.inductive * Names.Name.t list) Loc.located option
-
- and 'a tomatch_tuple_g = ('a glob_constr_g * 'a predicate_pattern_g)
-
- and 'a tomatch_tuples_g = 'a tomatch_tuple_g list
-
- and 'a cases_clause_g = (Names.Id.t list * 'a cases_pattern_g list * 'a glob_constr_g) Loc.located
- and 'a cases_clauses_g = 'a cases_clause_g list
-
- type glob_constr = [ `any ] glob_constr_g
- type tomatch_tuple = [ `any ] tomatch_tuple_g
- type tomatch_tuples = [ `any ] tomatch_tuples_g
- type cases_clause = [ `any ] cases_clause_g
- type cases_clauses = [ `any ] cases_clauses_g
- type glob_decl = [ `any ] glob_decl_g
- type fix_kind = [ `any ] fix_kind_g
- type predicate_pattern = [ `any ] predicate_pattern_g
- type any_glob_constr =
- | AnyGlobConstr : 'r glob_constr_g -> any_glob_constr
-
-end
-
-module Notation_term :
-sig
- type scope_name = string
- type notation_var_instance_type =
- | NtnTypeConstr | NtnTypeOnlyBinder | NtnTypeConstrList | NtnTypeBinderList
- type tmp_scope_name = scope_name
-
- type subscopes = tmp_scope_name option * scope_name list
- type notation_constr =
- | NRef of Globnames.global_reference
- | NVar of Names.Id.t
- | NApp of notation_constr * notation_constr list
- | NHole of Evar_kinds.t * Misctypes.intro_pattern_naming_expr * Genarg.glob_generic_argument option
- | NList of Names.Id.t * Names.Id.t * notation_constr * notation_constr * bool
- | NLambda of Names.Name.t * notation_constr * notation_constr
- | NProd of Names.Name.t * notation_constr * notation_constr
- | NBinderList of Names.Id.t * Names.Id.t * notation_constr * notation_constr
- | NLetIn of Names.Name.t * notation_constr * notation_constr option * notation_constr
- | NCases of Term.case_style * notation_constr option *
- (notation_constr * (Names.Name.t * (Names.inductive * Names.Name.t list) option)) list *
- (Glob_term.cases_pattern list * notation_constr) list
- | NLetTuple of Names.Name.t list * (Names.Name.t * notation_constr option) *
- notation_constr * notation_constr
- | NIf of notation_constr * (Names.Name.t * notation_constr option) *
- notation_constr * notation_constr
- | NRec of Glob_term.fix_kind * Names.Id.t array *
- (Names.Name.t * notation_constr option * notation_constr) list array *
- notation_constr array * notation_constr array
- | NSort of Misctypes.glob_sort
- | NCast of notation_constr * notation_constr Misctypes.cast_type
- type interpretation = (Names.Id.t * (subscopes * notation_var_instance_type)) list *
- notation_constr
- type precedence = int
- type parenRelation =
- | L | E | Any | Prec of precedence
- type tolerability = precedence * parenRelation
-end
-
-module Tactypes :
-sig
- type glob_constr_and_expr = Glob_term.glob_constr * Constrexpr.constr_expr option
- type glob_constr_pattern_and_expr = Names.Id.Set.t * glob_constr_and_expr * Pattern.constr_pattern
- type 'a delayed_open = Environ.env -> Evd.evar_map -> Evd.evar_map * 'a
- type delayed_open_constr = EConstr.constr delayed_open
- type delayed_open_constr_with_bindings = EConstr.constr Misctypes.with_bindings delayed_open
- type intro_pattern = delayed_open_constr Misctypes.intro_pattern_expr Loc.located
- type intro_patterns = delayed_open_constr Misctypes.intro_pattern_expr Loc.located list
- type intro_pattern_naming = Misctypes.intro_pattern_naming_expr Loc.located
- type or_and_intro_pattern = delayed_open_constr Misctypes.or_and_intro_pattern_expr Loc.located
-end
-
-(* XXX: end of moved from intf *)
-
-(************************************************************************)
-(* End of modules from engine/ *)
-(************************************************************************)
-
-(************************************************************************)
-(* Modules from pretyping/ *)
-(************************************************************************)
-
-module Ltac_pretype :
-sig
-open Names
-open Glob_term
-
-(** {5 Maps of pattern variables} *)
-
-(** Type [constr_under_binders] is for representing the term resulting
- of a matching. Matching can return terms defined in a some context
- of named binders; in the context, variable names are ordered by
- (<) and referred to by index in the term Thanks to the canonical
- ordering, a matching problem like
-
- [match ... with [(fun x y => ?p,fun y x => ?p)] => [forall x y => p]]
-
- will be accepted. Thanks to the reference by index, a matching
- problem like
-
- [match ... with [(fun x => ?p)] => [forall x => p]]
-
- will work even if [x] is also the name of an existing goal
- variable.
-
- Note: we do not keep types in the signature. Besides simplicity,
- the main reason is that it would force to close the signature over
- binders that occur only in the types of effective binders but not
- in the term itself (e.g. for a term [f x] with [f:A -> True] and
- [x:A]).
-
- On the opposite side, by not keeping the types, we loose
- opportunity to propagate type informations which otherwise would
- not be inferable, as e.g. when matching [forall x, x = 0] with
- pattern [forall x, ?h = 0] and using the solution "x|-h:=x" in
- expression [forall x, h = x] where nothing tells how the type of x
- could be inferred. We also loose the ability of typing ltac
- variables before calling the right-hand-side of ltac matching clauses. *)
-
-type constr_under_binders = Id.t list * EConstr.constr
-
-(** Types of substitutions with or w/o bound variables *)
-
-type patvar_map = EConstr.constr Id.Map.t
-type extended_patvar_map = constr_under_binders Id.Map.t
-
-(** A globalised term together with a closure representing the value
- of its free variables. Intended for use when these variables are taken
- from the Ltac environment. *)
-type closure = {
- idents:Id.t Id.Map.t;
- typed: constr_under_binders Id.Map.t ;
- untyped:closed_glob_constr Id.Map.t }
-and closed_glob_constr = {
- closure: closure;
- term: glob_constr }
-
-(** Ltac variable maps *)
-type var_map = constr_under_binders Id.Map.t
-type uconstr_var_map = closed_glob_constr Id.Map.t
-type unbound_ltac_var_map = Geninterp.Val.t Id.Map.t
-
-type ltac_var_map = {
- ltac_constrs : var_map;
- (** Ltac variables bound to constrs *)
- ltac_uconstrs : uconstr_var_map;
- (** Ltac variables bound to untyped constrs *)
- ltac_idents: Id.t Id.Map.t;
- (** Ltac variables bound to identifiers *)
- ltac_genargs : unbound_ltac_var_map;
- (** Ltac variables bound to other kinds of arguments *)
-}
-
-end
-
-module Locusops :
-sig
- val clause_with_generic_occurrences : 'a Locus.clause_expr -> bool
- val nowhere : 'a Locus.clause_expr
- val allHypsAndConcl : 'a Locus.clause_expr
- val is_nowhere : 'a Locus.clause_expr -> bool
- val occurrences_map :
- ('a list -> 'b list) -> 'a Locus.occurrences_gen -> 'b Locus.occurrences_gen
- val convert_occs : Locus.occurrences -> bool * int list
- val onConcl : 'a Locus.clause_expr
- val onHyp : 'a -> 'a Locus.clause_expr
-end
-
-module Pretype_errors :
-sig
- type unification_error
- type subterm_unification_error
-
- type type_error = (EConstr.t, EConstr.types) Type_errors.ptype_error
-
- type pretype_error =
- | CantFindCaseType of EConstr.constr
- | ActualTypeNotCoercible of EConstr.unsafe_judgment * EConstr.types * unification_error
- | UnifOccurCheck of Evar.t * EConstr.constr
- | UnsolvableImplicit of Evar.t * Evd.unsolvability_explanation option
- | CannotUnify of EConstr.constr * EConstr.constr * unification_error option
- | CannotUnifyLocal of EConstr.constr * EConstr.constr * EConstr.constr
- | CannotUnifyBindingType of EConstr.constr * EConstr.constr
- | CannotGeneralize of EConstr.constr
- | NoOccurrenceFound of EConstr.constr * Names.Id.t option
- | CannotFindWellTypedAbstraction of EConstr.constr * EConstr.constr list * (Environ.env * type_error) option
- | WrongAbstractionType of Names.Name.t * EConstr.constr * EConstr.types * EConstr.types
- | AbstractionOverMeta of Names.Name.t * Names.Name.t
- | NonLinearUnification of Names.Name.t * EConstr.constr
- | VarNotFound of Names.Id.t
- | UnexpectedType of EConstr.constr * EConstr.constr
- | NotProduct of EConstr.constr
- | TypingError of type_error
- | CannotUnifyOccurrences of subterm_unification_error
- | UnsatisfiableConstraints of
- (Evar.t * Evar_kinds.t) option * Evar.Set.t option
-
- exception PretypeError of Environ.env * Evd.evar_map * pretype_error
- val error_var_not_found : ?loc:Loc.t -> Names.Id.t -> 'b
- val precatchable_exception : exn -> bool
-end
-
-module Reductionops :
-sig
- type local_reduction_function = Evd.evar_map -> EConstr.constr -> EConstr.constr
-
- type reduction_function = Environ.env -> Evd.evar_map -> EConstr.constr -> EConstr.constr
-
- type local_stack_reduction_function =
- Evd.evar_map -> EConstr.constr -> EConstr.constr * EConstr.constr list
-
- type e_reduction_function = Environ.env -> Evd.evar_map -> EConstr.constr -> Evd.evar_map * EConstr.constr
- type state
-
- val clos_whd_flags : CClosure.RedFlags.reds -> reduction_function
- val nf_beta : local_reduction_function
- val nf_betaiota : local_reduction_function
- val splay_prod : Environ.env -> Evd.evar_map -> EConstr.constr ->
- (Names.Name.t * EConstr.constr) list * EConstr.constr
- val splay_prod_n : Environ.env -> Evd.evar_map -> int -> EConstr.constr -> EConstr.rel_context * EConstr.constr
- val whd_all : reduction_function
- val whd_beta : local_reduction_function
-
- val whd_betaiotazeta : local_reduction_function
-
- val whd_betaiota_stack : local_stack_reduction_function
-
- val clos_norm_flags : CClosure.RedFlags.reds -> reduction_function
- val is_conv : ?reds:Names.transparent_state -> Environ.env -> Evd.evar_map -> EConstr.constr -> EConstr.constr -> bool
- val beta_applist : Evd.evar_map -> EConstr.constr * EConstr.constr list -> EConstr.constr
- val sort_of_arity : Environ.env -> Evd.evar_map -> EConstr.constr -> EConstr.ESorts.t
- val is_conv_leq : ?reds:Names.transparent_state -> Environ.env -> Evd.evar_map -> EConstr.constr -> EConstr.constr -> bool
- val whd_betaiota : local_reduction_function
- val is_arity : Environ.env -> Evd.evar_map -> EConstr.constr -> bool
- val nf_evar : Evd.evar_map -> EConstr.constr -> EConstr.constr
- val nf_meta : Evd.evar_map -> EConstr.constr -> EConstr.constr
- val hnf_prod_appvect : Environ.env -> Evd.evar_map -> EConstr.constr -> EConstr.constr array -> EConstr.constr
- val pr_state : state -> Pp.t
- module Stack :
- sig
- type 'a t
- val pr : ('a -> Pp.t) -> 'a t -> Pp.t
- end
- module Cst_stack :
- sig
- type t
- val pr : t -> Pp.t
- end
-end
-
-module Inductiveops :
-sig
- type inductive_family
- type inductive_type =
- | IndType of inductive_family * EConstr.constr list
- type constructor_summary =
- {
- cs_cstr : Term.pconstructor;
- cs_params : Constr.t list;
- cs_nargs : int;
- cs_args : Context.Rel.t;
- cs_concl_realargs : Constr.t array;
- }
-
- val arities_of_constructors : Environ.env -> Term.pinductive -> Term.types array
- val constructors_nrealargs_env : Environ.env -> Names.inductive -> int array
- val constructor_nallargs_env : Environ.env -> Names.constructor -> int
-
- val inductive_nparams : Names.inductive -> int
-
- val inductive_nparamdecls : Names.inductive -> int
-
- val type_of_constructors : Environ.env -> Term.pinductive -> Term.types array
- val find_mrectype : Environ.env -> Evd.evar_map -> EConstr.types -> (Names.inductive * EConstr.EInstance.t) * EConstr.constr list
- val mis_is_recursive :
- Names.inductive * Declarations.mutual_inductive_body * Declarations.one_inductive_body -> bool
- val nconstructors : Names.inductive -> int
- val find_rectype : Environ.env -> Evd.evar_map -> EConstr.types -> inductive_type
- val get_constructors : Environ.env -> inductive_family -> constructor_summary array
- val dest_ind_family : inductive_family -> Names.inductive Term.puniverses * Constr.t list
- val find_inductive : Environ.env -> Evd.evar_map -> EConstr.types -> (Names.inductive * EConstr.EInstance.t) * Constr.t list
- val type_of_inductive : Environ.env -> Term.pinductive -> Term.types
-end
-
-module Impargs :
-sig
- type implicit_status
- type implicit_side_condition
- type implicits_list = implicit_side_condition * implicit_status list
- type manual_explicitation = Constrexpr.explicitation * (bool * bool * bool)
- type manual_implicits = manual_explicitation list
- val is_status_implicit : implicit_status -> bool
- val name_of_implicit : implicit_status -> Names.Id.t
- val implicits_of_global : Globnames.global_reference -> implicits_list list
- val declare_manual_implicits : bool -> Globnames.global_reference -> ?enriching:bool ->
- manual_implicits list -> unit
- val is_implicit_args : unit -> bool
- val is_strict_implicit_args : unit -> bool
- val is_contextual_implicit_args : unit -> bool
- val make_implicit_args : bool -> unit
- val make_strict_implicit_args : bool -> unit
- val make_contextual_implicit_args : bool -> unit
-end
-
-module Retyping : (* reconstruct the type of a term knowing that it was already typechecked *)
-sig
- val get_type_of : ?polyprop:bool -> ?lax:bool -> Environ.env -> Evd.evar_map -> EConstr.constr -> EConstr.types
- val get_sort_family_of : ?polyprop:bool -> Environ.env -> Evd.evar_map -> EConstr.types -> Sorts.family
- val expand_projection : Environ.env -> Evd.evar_map -> Names.Projection.t -> EConstr.constr -> EConstr.constr list -> EConstr.constr
- val get_sort_of :
- ?polyprop:bool -> Environ.env -> Evd.evar_map -> EConstr.types -> Sorts.t
-end
-
-module Find_subterm :
-sig
- val error_invalid_occurrence : int list -> 'a
-end
-
-module Evarsolve :
-sig
- val refresh_universes :
- ?status:Evd.rigid -> ?onlyalg:bool -> ?refreshset:bool -> bool option ->
- Environ.env -> Evd.evar_map -> EConstr.types -> Evd.evar_map * EConstr.types
-end
-
-module Recordops :
-sig
-
- type cs_pattern =
- | Const_cs of Globnames.global_reference
- | Prod_cs
- | Sort_cs of Sorts.family
- | Default_cs
-
- type obj_typ = {
- o_DEF : Constr.t;
- o_CTX : Univ.AUContext.t;
- o_INJ : int option; (** position of trivial argument *)
- o_TABS : Constr.t list; (** ordered *)
- o_TPARAMS : Constr.t list; (** ordered *)
- o_NPARAMS : int;
- o_TCOMPS : Constr.t list }
-
- val lookup_projections : Names.inductive -> Names.Constant.t option list
- val lookup_canonical_conversion : (Globnames.global_reference * cs_pattern) -> Constr.t * obj_typ
- val find_projection_nparams : Globnames.global_reference -> int
-end
-
-module Evarconv :
-sig
- val e_conv : Environ.env -> ?ts:Names.transparent_state -> Evd.evar_map ref -> EConstr.constr -> EConstr.constr -> bool
- val the_conv_x : Environ.env -> ?ts:Names.transparent_state -> EConstr.constr -> EConstr.constr -> Evd.evar_map -> Evd.evar_map
- val the_conv_x_leq : Environ.env -> ?ts:Names.transparent_state -> EConstr.constr -> EConstr.constr -> Evd.evar_map -> Evd.evar_map
- val solve_unif_constraints_with_heuristics : Environ.env -> ?ts:Names.transparent_state -> Evd.evar_map -> Evd.evar_map
-end
-
-module Typing :
-sig
- val e_sort_of : Environ.env -> Evd.evar_map ref -> EConstr.types -> Sorts.t
-
- val type_of : ?refresh:bool -> Environ.env -> Evd.evar_map -> EConstr.constr -> Evd.evar_map * EConstr.types
- val e_solve_evars : Environ.env -> Evd.evar_map ref -> EConstr.constr -> EConstr.constr
-
- val unsafe_type_of : Environ.env -> Evd.evar_map -> EConstr.constr -> EConstr.types
-
- val e_check : Environ.env -> Evd.evar_map ref -> EConstr.constr -> EConstr.types -> unit
-
- val e_type_of : ?refresh:bool -> Environ.env -> Evd.evar_map ref -> EConstr.constr -> EConstr.types
-end
-
-module Miscops :
-sig
- val map_red_expr_gen : ('a -> 'd) -> ('b -> 'e) -> ('c -> 'f) ->
- ('a,'b,'c) Genredexpr.red_expr_gen -> ('d,'e,'f) Genredexpr.red_expr_gen
- val map_cast_type : ('a -> 'b) -> 'a Misctypes.cast_type -> 'b Misctypes.cast_type
-end
-
-module Glob_ops :
-sig
- val map_glob_constr_left_to_right : (Glob_term.glob_constr -> Glob_term.glob_constr) -> Glob_term.glob_constr -> Glob_term.glob_constr
- val loc_of_glob_constr : Glob_term.glob_constr -> Loc.t option
- val glob_constr_eq : Glob_term.glob_constr -> Glob_term.glob_constr -> bool
- val bound_glob_vars : Glob_term.glob_constr -> Names.Id.Set.t
-
- (** Conversion from glob_constr to cases pattern, if possible
-
- Take the current alias as parameter,
- @raise Not_found if translation is impossible *)
- val cases_pattern_of_glob_constr : Names.Name.t -> Glob_term.glob_constr -> Glob_term.cases_pattern
- val map_glob_constr :
- (Glob_term.glob_constr -> Glob_term.glob_constr) -> Glob_term.glob_constr -> Glob_term.glob_constr
-
- val empty_lvar : Ltac_pretype.ltac_var_map
-
-end
-
-module Redops :
-sig
- val all_flags : 'a Genredexpr.glob_red_flag
- val make_red_flag : 'a Genredexpr.red_atom list -> 'a Genredexpr.glob_red_flag
-end
-
-module Patternops :
-sig
- val pattern_of_glob_constr : Glob_term.glob_constr -> Names.Id.t list * Pattern.constr_pattern
- val subst_pattern : Mod_subst.substitution -> Pattern.constr_pattern -> Pattern.constr_pattern
- val pattern_of_constr : Environ.env -> Evd.evar_map -> Constr.t -> Pattern.constr_pattern
- val instantiate_pattern : Environ.env ->
- Evd.evar_map -> Ltac_pretype.extended_patvar_map ->
- Pattern.constr_pattern -> Pattern.constr_pattern
-end
-
-module Constr_matching :
-sig
- val special_meta : Constr.metavariable
-
- type binding_bound_vars = Names.Id.Set.t
- type bound_ident_map = Names.Id.t Names.Id.Map.t
- val is_matching : Environ.env -> Evd.evar_map -> Pattern.constr_pattern -> EConstr.constr -> bool
- val extended_matches :
- Environ.env -> Evd.evar_map -> binding_bound_vars * Pattern.constr_pattern ->
- EConstr.constr -> bound_ident_map * Ltac_pretype.extended_patvar_map
- exception PatternMatchingFailure
- type matching_result =
- { m_sub : bound_ident_map * Ltac_pretype.patvar_map;
- m_ctx : EConstr.constr }
- val match_subterm_gen : Environ.env -> Evd.evar_map ->
- bool ->
- binding_bound_vars * Pattern.constr_pattern -> EConstr.constr ->
- matching_result IStream.t
- val matches : Environ.env -> Evd.evar_map -> Pattern.constr_pattern -> EConstr.constr -> Ltac_pretype.patvar_map
-end
-
-module Tacred :
-sig
- val try_red_product : Reductionops.reduction_function
- val simpl : Reductionops.reduction_function
- val unfoldn :
- (Locus.occurrences * Names.evaluable_global_reference) list -> Reductionops.reduction_function
- val hnf_constr : Reductionops.reduction_function
- val red_product : Reductionops.reduction_function
- val is_evaluable : Environ.env -> Names.evaluable_global_reference -> bool
- val evaluable_of_global_reference :
- Environ.env -> Globnames.global_reference -> Names.evaluable_global_reference
- val error_not_evaluable : Globnames.global_reference -> 'a
- val reduce_to_quantified_ref :
- Environ.env -> Evd.evar_map -> Globnames.global_reference -> EConstr.types -> EConstr.types
- val pattern_occs : (Locus.occurrences * EConstr.constr) list -> Reductionops.e_reduction_function
- val cbv_norm_flags : CClosure.RedFlags.reds -> Reductionops.reduction_function
-end
-
-(* XXX: Located manually from intf *)
-module Tok :
-sig
-
- type t =
- | KEYWORD of string
- | PATTERNIDENT of string
- | IDENT of string
- | FIELD of string
- | INT of string
- | STRING of string
- | LEFTQMARK
- | BULLET of string
- | EOI
-
-end
-
-module CLexer :
-sig
- val add_keyword : string -> unit
- val remove_keyword : string -> unit
- val is_keyword : string -> bool
- val keywords : unit -> CString.Set.t
-
- type keyword_state
- val set_keyword_state : keyword_state -> unit
- val get_keyword_state : unit -> keyword_state
-
- val check_ident : string -> unit
- val terminal : string -> Tok.t
-
- include Grammar.GLexerType with type te = Tok.t
-end
-
-module Extend :
-sig
-
- type gram_assoc = NonA | RightA | LeftA
-
- type gram_position =
- | First
- | Last
- | Before of string
- | After of string
- | Level of string
-
- type production_level =
- | NextLevel
- | NumLevel of int
-
- type 'a entry = 'a Grammar.GMake(CLexer).Entry.e
-
- type 'a user_symbol =
- | Ulist1 of 'a user_symbol
- | Ulist1sep of 'a user_symbol * string
- | Ulist0 of 'a user_symbol
- | Ulist0sep of 'a user_symbol * string
- | Uopt of 'a user_symbol
- | Uentry of 'a
- | Uentryl of 'a * int
-
- type ('self, 'a) symbol =
- | Atoken : Tok.t -> ('self, string) symbol
- | Alist1 : ('self, 'a) symbol -> ('self, 'a list) symbol
- | Alist1sep : ('self, 'a) symbol * ('self, _) symbol -> ('self, 'a list) symbol
- | Alist0 : ('self, 'a) symbol -> ('self, 'a list) symbol
- | Alist0sep : ('self, 'a) symbol * ('self, _) symbol -> ('self, 'a list) symbol
- | Aopt : ('self, 'a) symbol -> ('self, 'a option) symbol
- | Aself : ('self, 'self) symbol
- | Anext : ('self, 'self) symbol
- | Aentry : 'a entry -> ('self, 'a) symbol
- | Aentryl : 'a entry * int -> ('self, 'a) symbol
- | Arules : 'a rules list -> ('self, 'a) symbol
-
- and ('self, _, 'r) rule =
- | Stop : ('self, 'r, 'r) rule
- | Next : ('self, 'a, 'r) rule * ('self, 'b) symbol -> ('self, 'b -> 'a, 'r) rule
-
- and ('a, 'r) norec_rule = { norec_rule : 's. ('s, 'a, 'r) rule }
-
- and 'a rules =
- | Rules : ('act, Loc.t -> 'a) norec_rule * 'act -> 'a rules
-
- type ('lev,'pos) constr_entry_key_gen =
- | ETName | ETReference | ETBigint
- | ETBinder of bool
- | ETConstr of ('lev * 'pos)
- | ETPattern
- | ETOther of string * string
- | ETConstrList of ('lev * 'pos) * Tok.t list
- | ETBinderList of bool * Tok.t list
-
- type side = Left | Right
-
- type production_position =
- | BorderProd of side * gram_assoc option
- | InternalProd
-
- type constr_prod_entry_key =
- (production_level,production_position) constr_entry_key_gen
-
- type simple_constr_prod_entry_key =
- (production_level,unit) constr_entry_key_gen
-
- type 'a production_rule =
- | Rule : ('a, 'act, Loc.t -> 'a) rule * 'act -> 'a production_rule
-
- type 'a single_extend_statment =
- string option *
- (** Level *)
- gram_assoc option *
- (** Associativity *)
- 'a production_rule list
- (** Symbol list with the interpretation function *)
-
- type 'a extend_statment =
- gram_position option *
- 'a single_extend_statment list
-end
-
-(* XXX: Located manually from intf *)
-module Vernacexpr :
-sig
- open Misctypes
- open Constrexpr
- open Libnames
-
- type instance_flag = bool option
- type coercion_flag = bool
- type inductive_flag = Decl_kinds.recursivity_kind
- type lname = Names.Name.t Loc.located
- type lident = Names.Id.t Loc.located
- type opacity_flag =
- | Opaque
- | Transparent
- type locality_flag = bool
- type inductive_kind =
- | Inductive_kw | CoInductive | Variant | Record | Structure | Class of bool
-
- type vernac_type =
- | VtStartProof of vernac_start
- | VtSideff of vernac_sideff_type
- | VtQed of vernac_qed_type
- | VtProofStep of proof_step
- | VtProofMode of string
- | VtQuery of vernac_part_of_script * Feedback.route_id
- | VtMeta
- | VtUnknown
- and vernac_qed_type =
- | VtKeep
- | VtKeepAsAxiom
- | VtDrop
- and vernac_start = string * opacity_guarantee * Names.Id.t list
- and vernac_sideff_type = Names.Id.t list
- and vernac_part_of_script = bool
- and opacity_guarantee =
- | GuaranteesOpacity
- | Doesn'tGuaranteeOpacity
- and proof_step = {
- parallel : [ `Yes of solving_tac * anon_abstracting_tac | `No ];
- proof_block_detection : proof_block_name option
- }
- and solving_tac = bool
- and anon_abstracting_tac = bool
- and proof_block_name = string
-
- type vernac_when =
- | VtNow
- | VtLater
-
- type verbose_flag = bool
-
- type obsolete_locality = bool
-
- type universe_decl_expr = (lident list, Misctypes.glob_constraint list) gen_universe_decl
-
- type ident_decl = lident * universe_decl_expr option
-
- type lstring
- type 'a with_coercion = coercion_flag * 'a
- type scope_name = string
- type decl_notation = lstring * Constrexpr.constr_expr * scope_name option
- type constructor_expr = (lident * Constrexpr.constr_expr) with_coercion
- type 'a with_notation = 'a * decl_notation list
-
- type local_decl_expr =
- | AssumExpr of lname * Constrexpr.constr_expr
- | DefExpr of lname * Constrexpr.constr_expr * Constrexpr.constr_expr option
-
- type 'a with_priority = 'a * int option
- type 'a with_instance = instance_flag * 'a
- type constructor_list_or_record_decl_expr =
- | Constructors of constructor_expr list
- | RecordDecl of lident option * local_decl_expr with_instance with_priority with_notation list
-
- type inductive_expr = ident_decl with_coercion * Constrexpr.local_binder_expr list * Constrexpr.constr_expr option * inductive_kind * constructor_list_or_record_decl_expr
-
- type syntax_modifier =
- | SetItemLevel of string list * Extend.production_level
- | SetLevel of int
- | SetAssoc of Extend.gram_assoc
- | SetEntryType of string * Extend.simple_constr_prod_entry_key
- | SetOnlyParsing
- | SetOnlyPrinting
- | SetCompatVersion of Flags.compat_version
- | SetFormat of string * string Loc.located
-
- type class_rawexpr = FunClass | SortClass | RefClass of reference or_by_notation
-
- type typeclass_constraint = (Names.Name.t Loc.located * universe_decl_expr option) * Decl_kinds.binding_kind * constr_expr
-
- type definition_expr =
- | ProveBody of local_binder_expr list * constr_expr
- | DefineBody of local_binder_expr list * Genredexpr.raw_red_expr option * constr_expr
- * constr_expr option
- type proof_expr =
- ident_decl option * (local_binder_expr list * constr_expr)
-
- type proof_end =
- | Admitted
- | Proved of opacity_flag * lident option
-
- type fixpoint_expr = ident_decl * (Names.Id.t Loc.located option * Constrexpr.recursion_order_expr) * Constrexpr.local_binder_expr list * Constrexpr.constr_expr * Constrexpr.constr_expr option
-
- type cofixpoint_expr
-
- type scheme
-
- type section_subset_expr
-
- type module_binder
-
- type vernac_argument_status
- type vernac_implicit_status
- type module_ast_inl
- type extend_name = string * int
- type simple_binder
- type option_value
- type showable
- type bullet
- type comment
- type register_kind
- type locatable
- type search_restriction
- type searchable
- type printable
- type option_ref_value
- type onlyparsing_flag
- type reference_or_constr
-
- type hint_mode
-
- type 'a hint_info_gen =
- { hint_priority : int option;
- hint_pattern : 'a option }
-
- type hint_info_expr = Constrexpr.constr_pattern_expr hint_info_gen
-
- type hints_expr =
- | HintsResolve of (hint_info_expr * bool * reference_or_constr) list
- | HintsImmediate of reference_or_constr list
- | HintsUnfold of Libnames.reference list
- | HintsTransparency of Libnames.reference list * bool
- | HintsMode of Libnames.reference * hint_mode list
- | HintsConstructors of Libnames.reference list
- | HintsExtern of int * Constrexpr.constr_expr option * Genarg.raw_generic_argument
-
- type 'a module_signature =
- | Enforce of 'a (** ... : T *)
- | Check of 'a list (** ... <: T1 <: T2, possibly empty *)
-
- type inline =
- | NoInline
- | DefaultInline
- | InlineAt of int
-
- type cumulative_inductive_parsing_flag =
- | GlobalCumulativity
- | GlobalNonCumulativity
- | LocalCumulativity
- | LocalNonCumulativity
-
- type vernac_expr =
- | VernacLoad of verbose_flag * string
- | VernacTime of vernac_expr Loc.located
- | VernacRedirect of string * vernac_expr Loc.located
- | VernacTimeout of int * vernac_expr
- | VernacFail of vernac_expr
- | VernacSyntaxExtension of
- bool * obsolete_locality * (lstring * syntax_modifier list)
- | VernacOpenCloseScope of obsolete_locality * (bool * scope_name)
- | VernacDelimiters of scope_name * string option
- | VernacBindScope of scope_name * class_rawexpr list
- | VernacInfix of obsolete_locality * (lstring * syntax_modifier list) *
- Constrexpr.constr_expr * scope_name option
- | VernacNotation of
- obsolete_locality * Constrexpr.constr_expr * (lstring * syntax_modifier list) *
- scope_name option
- | VernacNotationAddFormat of string * string * string
- | VernacDefinition of
- (Decl_kinds.locality option * Decl_kinds.definition_object_kind) * ident_decl * definition_expr
- | VernacStartTheoremProof of Decl_kinds.theorem_kind * proof_expr list
- | VernacEndProof of proof_end
- | VernacExactProof of Constrexpr.constr_expr
- | VernacAssumption of (Decl_kinds.locality option * Decl_kinds.assumption_object_kind) *
- inline * (ident_decl list * Constrexpr.constr_expr) with_coercion list
- | VernacInductive of cumulative_inductive_parsing_flag * Decl_kinds.private_flag * inductive_flag * (inductive_expr * decl_notation list) list
- | VernacFixpoint of
- Decl_kinds.locality option * (fixpoint_expr * decl_notation list) list
- | VernacCoFixpoint of
- Decl_kinds.locality option * (cofixpoint_expr * decl_notation list) list
- | VernacScheme of (lident option * scheme) list
- | VernacCombinedScheme of lident * lident list
- | VernacUniverse of lident list
- | VernacConstraint of (Misctypes.glob_level * Univ.constraint_type * Misctypes.glob_level) list
- | VernacBeginSection of lident
- | VernacEndSegment of lident
- | VernacRequire of
- Libnames.reference option * bool option * Libnames.reference list
- | VernacImport of bool * Libnames.reference list
- | VernacCanonical of Libnames.reference Misctypes.or_by_notation
- | VernacCoercion of obsolete_locality * Libnames.reference Misctypes.or_by_notation *
- class_rawexpr * class_rawexpr
- | VernacIdentityCoercion of obsolete_locality * lident *
- class_rawexpr * class_rawexpr
- | VernacNameSectionHypSet of lident * section_subset_expr
- | VernacInstance of
- bool *
- Constrexpr.local_binder_expr list *
- typeclass_constraint *
- (bool * Constrexpr.constr_expr) option *
- hint_info_expr
- | VernacContext of Constrexpr.local_binder_expr list
- | VernacDeclareInstances of
- (Libnames.reference * hint_info_expr) list
- | VernacDeclareClass of Libnames.reference
- | VernacDeclareModule of bool option * lident *
- module_binder list * module_ast_inl
- | VernacDefineModule of bool option * lident * module_binder list *
- module_ast_inl module_signature * module_ast_inl list
- | VernacDeclareModuleType of lident *
- module_binder list * module_ast_inl list * module_ast_inl list
- | VernacInclude of module_ast_inl list
- | VernacSolveExistential of int * Constrexpr.constr_expr
- | VernacAddLoadPath of bool * string * Names.DirPath.t option
- | VernacRemoveLoadPath of string
- | VernacAddMLPath of bool * string
- | VernacDeclareMLModule of string list
- | VernacChdir of string option
- | VernacWriteState of string
- | VernacRestoreState of string
- | VernacResetName of lident
- | VernacResetInitial
- | VernacBack of int
- | VernacBackTo of int
- | VernacCreateHintDb of string * bool
- | VernacRemoveHints of string list * Libnames.reference list
- | VernacHints of obsolete_locality * string list * hints_expr
- | VernacSyntacticDefinition of Names.Id.t Loc.located * (Names.Id.t list * Constrexpr.constr_expr) *
- obsolete_locality * onlyparsing_flag
- | VernacDeclareImplicits of Libnames.reference Misctypes.or_by_notation *
- (Constrexpr.explicitation * bool * bool) list list
- | VernacArguments of Libnames.reference Misctypes.or_by_notation *
- vernac_argument_status list *
- (Names.Name.t * vernac_implicit_status) list list *
- int option *
- [ `ReductionDontExposeCase | `ReductionNeverUnfold | `Rename |
- `ExtraScopes | `Assert | `ClearImplicits | `ClearScopes |
- `DefaultImplicits ] list
- | VernacArgumentsScope of Libnames.reference Misctypes.or_by_notation *
- scope_name option list
- | VernacReserve of simple_binder list
- | VernacGeneralizable of (lident list) option
- | VernacSetOpacity of (Conv_oracle.level * Libnames.reference Misctypes.or_by_notation list)
- | VernacSetStrategy of
- (Conv_oracle.level * Libnames.reference Misctypes.or_by_notation list) list
- | VernacUnsetOption of Goptions.option_name
- | VernacSetOption of Goptions.option_name * option_value
- | VernacSetAppendOption of Goptions.option_name * string
- | VernacAddOption of Goptions.option_name * option_ref_value list
- | VernacRemoveOption of Goptions.option_name * option_ref_value list
- | VernacMemOption of Goptions.option_name * option_ref_value list
- | VernacPrintOption of Goptions.option_name
- | VernacCheckMayEval of Genredexpr.raw_red_expr option * goal_selector option * Constrexpr.constr_expr
- | VernacGlobalCheck of Constrexpr.constr_expr
- | VernacDeclareReduction of string * Genredexpr.raw_red_expr
- | VernacPrint of printable
- | VernacSearch of searchable * goal_selector option * search_restriction
- | VernacLocate of locatable
- | VernacRegister of lident * register_kind
- | VernacComments of comment list
- | VernacGoal of Constrexpr.constr_expr
- | VernacAbort of lident option
- | VernacAbortAll
- | VernacRestart
- | VernacUndo of int
- | VernacUndoTo of int
- | VernacBacktrack of int*int*int
- | VernacFocus of int option
- | VernacUnfocus
- | VernacUnfocused
- | VernacBullet of bullet
- | VernacSubproof of int option
- | VernacEndSubproof
- | VernacShow of showable
- | VernacCheckGuard
- | VernacProof of Genarg.raw_generic_argument option * section_subset_expr option
- | VernacProofMode of string
- | VernacToplevelControl of exn
- | VernacExtend of extend_name * Genarg.raw_generic_argument list
- | VernacProgram of vernac_expr
- | VernacPolymorphic of bool * vernac_expr
- | VernacLocal of bool * vernac_expr
- and goal_selector =
- | SelectNth of int
- | SelectList of (int * int) list
- | SelectId of Names.Id.t
- | SelectAll
- and vernac_classification = vernac_type * vernac_when
- and one_inductive_expr =
- ident_decl * Constrexpr.local_binder_expr list * Constrexpr.constr_expr option * constructor_expr list
-end
-
-(* XXX: end manual intf move *)
-
-module Typeclasses :
-sig
- type typeclass = {
- cl_univs : Univ.AUContext.t;
- cl_impl : Globnames.global_reference;
- cl_context : (Globnames.global_reference * bool) option list * Context.Rel.t;
- cl_props : Context.Rel.t;
- cl_projs : (Names.Name.t * (direction * Vernacexpr.hint_info_expr) option
- * Names.Constant.t option) list;
- cl_strict : bool;
- cl_unique : bool;
- }
- and direction
-
- type instance
- type evar_filter = Evar.t -> Evar_kinds.t -> bool
-
- val resolve_typeclasses : ?fast_path:bool -> ?filter:evar_filter -> ?unique:bool ->
- ?split:bool -> ?fail:bool -> Environ.env -> Evd.evar_map -> Evd.evar_map
- val set_resolvable : Evd.Store.t -> bool -> Evd.Store.t
- val resolve_one_typeclass : ?unique:bool -> Environ.env -> Evd.evar_map -> EConstr.types -> Evd.evar_map * EConstr.constr
- val class_info : Globnames.global_reference -> typeclass
- val mark_resolvables : ?filter:evar_filter -> Evd.evar_map -> Evd.evar_map
- val add_instance : instance -> unit
- val new_instance : typeclass -> Vernacexpr.hint_info_expr -> bool -> Decl_kinds.polymorphic ->
- Globnames.global_reference -> instance
-end
-
-module Classops :
-sig
- type coe_index
- type inheritance_path = coe_index list
- type cl_index
-
- val hide_coercion : Globnames.global_reference -> int option
- val lookup_path_to_sort_from : Environ.env -> Evd.evar_map -> EConstr.types ->
- EConstr.types * inheritance_path
- val get_coercion_value : coe_index -> Constr.t
- val coercions : unit -> coe_index list
- val pr_cl_index : cl_index -> Pp.t
-end
-
-module Detyping :
-sig
- type 'a delay =
- | Now : 'a delay
- | Later : [ `thunk ] delay
- val print_universes : bool ref
- val print_evar_arguments : bool ref
- val detype : 'a delay -> ?lax:bool -> bool -> Names.Id.Set.t -> Environ.env -> Evd.evar_map -> EConstr.constr -> 'a Glob_term.glob_constr_g
- val subst_glob_constr : Mod_subst.substitution -> Glob_term.glob_constr -> Glob_term.glob_constr
- val set_detype_anonymous : (?loc:Loc.t -> int -> Names.Id.t) -> unit
-end
-
-module Indrec :
-sig
- type dep_flag = bool
- val lookup_eliminator : Names.inductive -> Sorts.family -> Globnames.global_reference
- val build_case_analysis_scheme : Environ.env -> Evd.evar_map -> Term.pinductive ->
- dep_flag -> Sorts.family -> Evd.evar_map * Constr.t
- val make_elimination_ident : Names.Id.t -> Sorts.family -> Names.Id.t
- val build_mutual_induction_scheme :
- Environ.env -> Evd.evar_map -> (Term.pinductive * dep_flag * Sorts.family) list -> Evd.evar_map * Constr.t list
- val build_case_analysis_scheme_default : Environ.env -> Evd.evar_map -> Term.pinductive ->
- Sorts.family -> Evd.evar_map * Constr.t
-end
-
-module Pretyping :
-sig
- type typing_constraint =
- | OfType of EConstr.types
- | IsType
- | WithoutTypeConstraint
-
- type inference_hook = Environ.env -> Evd.evar_map -> Evar.t -> Evd.evar_map * EConstr.constr
-
- type inference_flags = {
- use_typeclasses : bool;
- solve_unification_constraints : bool;
- use_hook : inference_hook option;
- fail_evar : bool;
- expand_evars : bool
- }
-
- val understand_ltac : inference_flags ->
- Environ.env -> Evd.evar_map -> Ltac_pretype.ltac_var_map ->
- typing_constraint -> Glob_term.glob_constr -> Evd.evar_map * EConstr.t
- val understand_tcc : ?flags:inference_flags -> Environ.env -> Evd.evar_map ->
- ?expected_type:typing_constraint -> Glob_term.glob_constr -> Evd.evar_map * EConstr.constr
- val understand : ?flags:inference_flags -> ?expected_type:typing_constraint ->
- Environ.env -> Evd.evar_map -> Glob_term.glob_constr -> Constr.t Evd.in_evar_universe_context
- val check_evars : Environ.env -> Evd.evar_map -> Evd.evar_map -> EConstr.constr -> unit
- val register_constr_interp0 :
- ('r, 'g, 't) Genarg.genarg_type ->
- (Ltac_pretype.unbound_ltac_var_map -> Environ.env -> Evd.evar_map -> EConstr.types -> 'g -> EConstr.constr * Evd.evar_map) -> unit
- val all_and_fail_flags : inference_flags
- val ise_pretype_gen :
- inference_flags -> Environ.env -> Evd.evar_map ->
- Ltac_pretype.ltac_var_map -> typing_constraint -> Glob_term.glob_constr -> Evd.evar_map * EConstr.constr
-end
-
-module Unification :
-sig
- type core_unify_flags = {
- modulo_conv_on_closed_terms : Names.transparent_state option;
- use_metas_eagerly_in_conv_on_closed_terms : bool;
- use_evars_eagerly_in_conv_on_closed_terms : bool;
- modulo_delta : Names.transparent_state;
- modulo_delta_types : Names.transparent_state;
- check_applied_meta_types : bool;
- use_pattern_unification : bool;
- use_meta_bound_pattern_unification : bool;
- frozen_evars : Evar.Set.t;
- restrict_conv_on_strict_subterms : bool;
- modulo_betaiota : bool;
- modulo_eta : bool;
- }
- type unify_flags =
- {
- core_unify_flags : core_unify_flags;
- merge_unify_flags : core_unify_flags;
- subterm_unify_flags : core_unify_flags;
- allow_K_in_toplevel_higher_order_unification : bool;
- resolve_evars : bool
- }
- val default_no_delta_unify_flags : unit -> unify_flags
- val w_unify : Environ.env -> Evd.evar_map -> Reduction.conv_pb -> ?flags:unify_flags -> EConstr.constr -> EConstr.constr -> Evd.evar_map
- val elim_flags : unit -> unify_flags
- val w_unify_to_subterm :
- Environ.env -> Evd.evar_map -> ?flags:unify_flags -> EConstr.constr * EConstr.constr -> Evd.evar_map * EConstr.constr
-end
-
-module Univdecls :
-sig
- type universe_decl =
- (Names.Id.t Loc.located list, Univ.Constraint.t) Misctypes.gen_universe_decl
-
- val interp_univ_decl : Environ.env -> Vernacexpr.universe_decl_expr ->
- Evd.evar_map * universe_decl
- val interp_univ_decl_opt : Environ.env -> Vernacexpr.universe_decl_expr option ->
- Evd.evar_map * universe_decl
- val default_univ_decl : universe_decl
-end
-
-(************************************************************************)
-(* End of modules from pretyping/ *)
-(************************************************************************)
-
-(************************************************************************)
-(* Modules from interp/ *)
-(************************************************************************)
-
-module Genintern :
-sig
- open Genarg
-
- module Store : Store.S
-
- type glob_sign = {
- ltacvars : Names.Id.Set.t;
- genv : Environ.env;
- extra : Store.t;
- }
-
- val empty_glob_sign : Environ.env -> glob_sign
-
- type ('raw, 'glb) intern_fun = glob_sign -> 'raw -> glob_sign * 'glb
-
-
- val generic_intern : (raw_generic_argument, glob_generic_argument) intern_fun
-
- type 'glb subst_fun = Mod_subst.substitution -> 'glb -> 'glb
- val generic_substitute : Genarg.glob_generic_argument subst_fun
-
- type 'glb ntn_subst_fun = Tactypes.glob_constr_and_expr Names.Id.Map.t -> 'glb -> 'glb
-
- val register_intern0 : ('raw, 'glb, 'top) genarg_type ->
- ('raw, 'glb) intern_fun -> unit
-
- val register_subst0 : ('raw, 'glb, 'top) genarg_type ->
- 'glb subst_fun -> unit
-
- val register_ntn_subst0 : ('raw, 'glb, 'top) genarg_type ->
- 'glb ntn_subst_fun -> unit
-
-end
-
-module Stdarg :
-sig
- val loc_of_or_by_notation : ('a -> Loc.t option) -> 'a Misctypes.or_by_notation -> Loc.t option
- val wit_unit : unit Genarg.uniform_genarg_type
- val wit_int : int Genarg.uniform_genarg_type
- val wit_var : (Names.Id.t Loc.located, Names.Id.t Loc.located, Names.Id.t) Genarg.genarg_type
- val wit_bool : bool Genarg.uniform_genarg_type
- val wit_string : string Genarg.uniform_genarg_type
- val wit_pre_ident : string Genarg.uniform_genarg_type
- val wit_global : (Libnames.reference, Globnames.global_reference Loc.located Misctypes.or_var, Globnames.global_reference) Genarg.genarg_type
- val wit_ident : Names.Id.t Genarg.uniform_genarg_type
- val wit_integer : int Genarg.uniform_genarg_type
- val wit_sort_family : (Sorts.family, unit, unit) Genarg.genarg_type
- val wit_constr : (Constrexpr.constr_expr, Tactypes.glob_constr_and_expr, EConstr.constr) Genarg.genarg_type
- val wit_open_constr : (Constrexpr.constr_expr, Tactypes.glob_constr_and_expr, EConstr.constr) Genarg.genarg_type
- val wit_intro_pattern : (Constrexpr.constr_expr Misctypes.intro_pattern_expr Loc.located, Tactypes.glob_constr_and_expr Misctypes.intro_pattern_expr Loc.located, Tactypes.intro_pattern) Genarg.genarg_type
- val wit_int_or_var : (int Misctypes.or_var, int Misctypes.or_var, int) Genarg.genarg_type
- val wit_ref : (Libnames.reference, Globnames.global_reference Loc.located Misctypes.or_var, Globnames.global_reference) Genarg.genarg_type
- val wit_clause_dft_concl : (Names.Id.t Loc.located Locus.clause_expr,Names.Id.t Loc.located Locus.clause_expr,Names.Id.t Locus.clause_expr) Genarg.genarg_type
- val wit_uconstr : (Constrexpr.constr_expr , Tactypes.glob_constr_and_expr, Ltac_pretype.closed_glob_constr) Genarg.genarg_type
- val wit_red_expr :
- ((Constrexpr.constr_expr,Libnames.reference Misctypes.or_by_notation,Constrexpr.constr_expr) Genredexpr.red_expr_gen,
- (Tactypes.glob_constr_and_expr,Names.evaluable_global_reference Misctypes.and_short_name Misctypes.or_var,Tactypes.glob_constr_pattern_and_expr) Genredexpr.red_expr_gen,
- (EConstr.constr,Names.evaluable_global_reference,Pattern.constr_pattern) Genredexpr.red_expr_gen) Genarg.genarg_type
- val wit_quant_hyp : Misctypes.quantified_hypothesis Genarg.uniform_genarg_type
- val wit_bindings :
- (Constrexpr.constr_expr Misctypes.bindings,
- Tactypes.glob_constr_and_expr Misctypes.bindings,
- EConstr.constr Misctypes.bindings Tactypes.delayed_open) Genarg.genarg_type
- val wit_constr_with_bindings :
- (Constrexpr.constr_expr Misctypes.with_bindings,
- Tactypes.glob_constr_and_expr Misctypes.with_bindings,
- EConstr.constr Misctypes.with_bindings Tactypes.delayed_open) Genarg.genarg_type
- val wit_intropattern : (Constrexpr.constr_expr Misctypes.intro_pattern_expr Loc.located, Tactypes.glob_constr_and_expr Misctypes.intro_pattern_expr Loc.located, Tactypes.intro_pattern) Genarg.genarg_type
- val wit_quantified_hypothesis : Misctypes.quantified_hypothesis Genarg.uniform_genarg_type
- val wit_clause : (Names.Id.t Loc.located Locus.clause_expr,Names.Id.t Loc.located Locus.clause_expr,Names.Id.t Locus.clause_expr) Genarg.genarg_type
- val wit_preident : string Genarg.uniform_genarg_type
- val wit_reference : (Libnames.reference, Globnames.global_reference Loc.located Misctypes.or_var, Globnames.global_reference) Genarg.genarg_type
- val wit_open_constr_with_bindings :
- (Constrexpr.constr_expr Misctypes.with_bindings,
- Tactypes.glob_constr_and_expr Misctypes.with_bindings,
- EConstr.constr Misctypes.with_bindings Tactypes.delayed_open) Genarg.genarg_type
-end
-
-module Constrexpr_ops :
-sig
- val mkIdentC : Names.Id.t -> Constrexpr.constr_expr
- val mkAppC : Constrexpr.constr_expr * Constrexpr.constr_expr list -> Constrexpr.constr_expr
- val names_of_local_assums : Constrexpr.local_binder_expr list -> Names.Name.t Loc.located list
- val coerce_reference_to_id : Libnames.reference -> Names.Id.t
- val coerce_to_id : Constrexpr.constr_expr -> Names.Id.t Loc.located
- val constr_loc : Constrexpr.constr_expr -> Loc.t option
- val mkRefC : Libnames.reference -> Constrexpr.constr_expr
- val mkLambdaC : Names.Name.t Loc.located list * Constrexpr.binder_kind * Constrexpr.constr_expr * Constrexpr.constr_expr -> Constrexpr.constr_expr
- val default_binder_kind : Constrexpr.binder_kind
- val mkLetInC : Names.Name.t Loc.located * Constrexpr.constr_expr * Constrexpr.constr_expr option * Constrexpr.constr_expr -> Constrexpr.constr_expr
- val mkCProdN : ?loc:Loc.t -> Constrexpr.local_binder_expr list -> Constrexpr.constr_expr -> Constrexpr.constr_expr
-end
-
-module Notation_ops :
-sig
- val glob_constr_of_notation_constr : ?loc:Loc.t -> Notation_term.notation_constr -> Glob_term.glob_constr
- val glob_constr_of_notation_constr_with_binders : ?loc:Loc.t ->
- ('a -> Names.Name.t -> 'a * Names.Name.t) ->
- ('a -> Notation_term.notation_constr -> Glob_term.glob_constr) ->
- 'a -> Notation_term.notation_constr -> Glob_term.glob_constr
-end
-
-module Notation :
-sig
- type cases_pattern_status = bool
- type required_module = Libnames.full_path * string list
- type 'a prim_token_interpreter = ?loc:Loc.t -> 'a -> Glob_term.glob_constr
- type 'a prim_token_uninterpreter = Glob_term.glob_constr list * (Glob_term.any_glob_constr -> 'a option) * cases_pattern_status
- type delimiters = string
- type local_scopes = Notation_term.tmp_scope_name option * Notation_term.scope_name list
- type notation_location = (Names.DirPath.t * Names.DirPath.t) * string
- val declare_string_interpreter : Notation_term.scope_name -> required_module ->
- string prim_token_interpreter -> string prim_token_uninterpreter -> unit
- val declare_numeral_interpreter : Notation_term.scope_name -> required_module ->
- Bigint.bigint prim_token_interpreter -> Bigint.bigint prim_token_uninterpreter -> unit
- val interp_notation_as_global_reference : ?loc:Loc.t -> (Globnames.global_reference -> bool) ->
- Constrexpr.notation -> delimiters option -> Globnames.global_reference
- val locate_notation : (Glob_term.glob_constr -> Pp.t) -> Constrexpr.notation ->
- Notation_term.scope_name option -> Pp.t
- val find_delimiters_scope : ?loc:Loc.t -> delimiters -> Notation_term.scope_name
- val pr_scope : (Glob_term.glob_constr -> Pp.t) -> Notation_term.scope_name -> Pp.t
- val pr_scopes : (Glob_term.glob_constr -> Pp.t) -> Pp.t
- val interp_notation : ?loc:Loc.t -> Constrexpr.notation -> local_scopes ->
- Notation_term.interpretation * (notation_location * Notation_term.scope_name option)
- val uninterp_prim_token : Glob_term.glob_constr -> Notation_term.scope_name * Constrexpr.prim_token
-end
-
-module Dumpglob :
-sig
- val add_glob : ?loc:Loc.t -> Globnames.global_reference -> unit
- val pause : unit -> unit
- val continue : unit -> unit
-end
-
-module Smartlocate :
-sig
- val locate_global_with_alias : ?head:bool -> Libnames.qualid Loc.located -> Globnames.global_reference
- val global_with_alias : ?head:bool -> Libnames.reference -> Globnames.global_reference
- val global_of_extended_global : Globnames.extended_global_reference -> Globnames.global_reference
- val loc_of_smart_reference : Libnames.reference Misctypes.or_by_notation -> Loc.t option
- val smart_global : ?head:bool -> Libnames.reference Misctypes.or_by_notation -> Globnames.global_reference
-end
-
-module Topconstr :
-sig
- val replace_vars_constr_expr :
- Names.Id.t Names.Id.Map.t -> Constrexpr.constr_expr -> Constrexpr.constr_expr
-end
-
-module Constrintern :
-sig
- type ltac_sign = {
- ltac_vars : Names.Id.Set.t;
- ltac_bound : Names.Id.Set.t;
- ltac_extra : Genintern.Store.t;
- }
-
- type var_internalization_data
-
- type var_internalization_type =
- | Inductive of Names.Id.t list * bool
- | Recursive
- | Method
- | Variable
- type internalization_env = var_internalization_data Names.Id.Map.t
-
- val interp_constr_evars : Environ.env -> Evd.evar_map ref ->
- ?impls:internalization_env -> Constrexpr.constr_expr -> EConstr.constr
-
- val interp_type_evars : Environ.env -> Evd.evar_map ref ->
- ?impls:internalization_env -> Constrexpr.constr_expr -> EConstr.types
-
- val empty_ltac_sign : ltac_sign
- val intern_gen : Pretyping.typing_constraint -> Environ.env ->
- ?impls:internalization_env -> ?pattern_mode:bool -> ?ltacvars:ltac_sign ->
- Constrexpr.constr_expr -> Glob_term.glob_constr
- val intern_constr_pattern :
- Environ.env -> ?as_type:bool -> ?ltacvars:ltac_sign ->
- Constrexpr.constr_pattern_expr -> Names.Id.t list * Pattern.constr_pattern
- val intern_constr : Environ.env -> Constrexpr.constr_expr -> Glob_term.glob_constr
- val for_grammar : ('a -> 'b) -> 'a -> 'b
- val interp_reference : ltac_sign -> Libnames.reference -> Glob_term.glob_constr
- val interp_constr : Environ.env -> Evd.evar_map -> ?impls:internalization_env ->
- Constrexpr.constr_expr -> Constr.t Evd.in_evar_universe_context
- val interp_open_constr : Environ.env -> Evd.evar_map -> Constrexpr.constr_expr -> Evd.evar_map * EConstr.constr
- val locate_reference : Libnames.qualid -> Globnames.global_reference
- val interp_type : Environ.env -> Evd.evar_map -> ?impls:internalization_env ->
- Constrexpr.constr_expr -> Term.types Evd.in_evar_universe_context
- val interp_context_evars :
- ?global_level:bool -> ?impl_env:internalization_env -> ?shift:int ->
- Environ.env -> Evd.evar_map ref -> Constrexpr.local_binder_expr list ->
- internalization_env * ((Environ.env * EConstr.rel_context) * Impargs.manual_implicits)
- val compute_internalization_data : Environ.env -> var_internalization_type ->
- Term.types -> Impargs.manual_explicitation list -> var_internalization_data
- val empty_internalization_env : internalization_env
- val global_reference : Names.Id.t -> Globnames.global_reference
-end
-
-module Constrextern :
-sig
- val extern_glob_constr : Names.Id.Set.t -> Glob_term.glob_constr -> Constrexpr.constr_expr
- val extern_glob_type : Names.Id.Set.t -> Glob_term.glob_constr -> Constrexpr.constr_expr
- val extern_constr : ?lax:bool -> bool -> Environ.env -> Evd.evar_map -> EConstr.t -> Constrexpr.constr_expr
- val without_symbols : ('a -> 'b) -> 'a -> 'b
- val print_universes : bool ref
- val extern_type : bool -> Environ.env -> Evd.evar_map -> EConstr.t -> Constrexpr.constr_expr
- val with_universes : ('a -> 'b) -> 'a -> 'b
- val set_extern_reference :
- (?loc:Loc.t -> Names.Id.Set.t -> Globnames.global_reference -> Libnames.reference) -> unit
-end
-
-module Declare :
-sig
- type internal_flag =
- | UserAutomaticRequest
- | InternalTacticRequest
- | UserIndividualRequest
-
- type constant_declaration = Safe_typing.private_constants Entries.constant_entry * Decl_kinds.logical_kind
-
- type section_variable_entry =
- | SectionLocalDef of Safe_typing.private_constants Entries.definition_entry
- | SectionLocalAssum of Term.types Univ.in_universe_context_set * Decl_kinds.polymorphic * bool
-
- type variable_declaration = Names.DirPath.t * section_variable_entry * Decl_kinds.logical_kind
-
- val declare_constant :
- ?internal:internal_flag -> ?local:bool -> Names.Id.t -> ?export_seff:bool -> constant_declaration -> Names.Constant.t
-
- val declare_universe_context : Decl_kinds.polymorphic -> Univ.ContextSet.t -> unit
-
- val declare_definition :
- ?internal:internal_flag -> ?opaque:bool -> ?kind:Decl_kinds.definition_object_kind ->
- ?local:bool -> ?poly:Decl_kinds.polymorphic -> Names.Id.t -> ?types:Constr.t ->
- Constr.t Univ.in_universe_context_set -> Names.Constant.t
- val definition_entry : ?fix_exn:Future.fix_exn ->
- ?opaque:bool -> ?inline:bool -> ?types:Term.types ->
- ?poly:Decl_kinds.polymorphic -> ?univs:Univ.UContext.t ->
- ?eff:Safe_typing.private_constants -> Constr.t -> Safe_typing.private_constants Entries.definition_entry
- val definition_message : Names.Id.t -> unit
- val declare_variable : Names.Id.t -> variable_declaration -> Libnames.object_name
-end
-
-(************************************************************************)
-(* End of modules from interp/ *)
-(************************************************************************)
-
-(************************************************************************)
-(* Modules from proofs/ *)
-(************************************************************************)
-
-module Miscprint :
-sig
- val pr_or_and_intro_pattern :
- ('a -> Pp.t) -> 'a Misctypes.or_and_intro_pattern_expr -> Pp.t
- val pr_intro_pattern_naming : Misctypes.intro_pattern_naming_expr -> Pp.t
- val pr_intro_pattern :
- ('a -> Pp.t) -> 'a Misctypes.intro_pattern_expr Loc.located -> Pp.t
- val pr_bindings :
- ('a -> Pp.t) ->
- ('a -> Pp.t) -> 'a Misctypes.bindings -> Pp.t
- val pr_bindings_no_with :
- ('a -> Pp.t) ->
- ('a -> Pp.t) -> 'a Misctypes.bindings -> Pp.t
- val pr_with_bindings :
- ('a -> Pp.t) ->
- ('a -> Pp.t) -> 'a * 'a Misctypes.bindings -> Pp.t
-end
-
-(* All items in the Goal modules are deprecated. *)
-module Goal :
-sig
- type goal = Evar.t
-
- val pr_goal : goal -> Pp.t
-
- module V82 :
- sig
- val new_goal_with : Evd.evar_map -> goal -> Context.Named.t -> goal Evd.sigma
-
- val nf_hyps : Evd.evar_map -> goal -> Environ.named_context_val
-
- val env : Evd.evar_map -> goal -> Environ.env
-
- val concl : Evd.evar_map -> goal -> EConstr.constr
-
- val mk_goal : Evd.evar_map ->
- Environ.named_context_val ->
- EConstr.constr ->
- Evd.Store.t ->
- goal * EConstr.constr * Evd.evar_map
-
- val extra : Evd.evar_map -> goal -> Evd.Store.t
-
- val partial_solution_to : Evd.evar_map -> goal -> goal -> EConstr.constr -> Evd.evar_map
-
- val partial_solution : Evd.evar_map -> goal -> EConstr.constr -> Evd.evar_map
-
- val hyps : Evd.evar_map -> goal -> Environ.named_context_val
-
- val abstract_type : Evd.evar_map -> goal -> EConstr.types
- end
-end
-
-module Evar_refiner :
-sig
- type glob_constr_ltac_closure = Ltac_pretype.ltac_var_map * Glob_term.glob_constr
-
- val w_refine : Evar.t * Evd.evar_info ->
- glob_constr_ltac_closure -> Evd.evar_map -> Evd.evar_map
-end
-
-
-module Proof_type :
-sig
- type prim_rule = Refine of Constr.t
-
- type tactic = Goal.goal Evd.sigma -> Goal.goal list Evd.sigma
-end
-
-module Logic :
-sig
- type refiner_error =
- | BadType of Constr.t * Constr.t * Constr.t
- | UnresolvedBindings of Names.Name.t list
- | CannotApply of Constr.t * Constr.t
- | NotWellTyped of Constr.t
- | NonLinearProof of Constr.t
- | MetaInType of EConstr.constr
- | IntroNeedsProduct
- | DoesNotOccurIn of Constr.t * Names.Id.t
- | NoSuchHyp of Names.Id.t
- exception RefinerError of refiner_error
- val catchable_exception : exn -> bool
-end
-
-module Refine :
-sig
- val refine : typecheck:bool -> (Evd.evar_map -> Evd.evar_map * EConstr.t) -> unit Proofview.tactic
- val solve_constraints : unit Proofview.tactic
-end
-
-module Proof :
-sig
- type proof
- type 'a focus_kind
-
- val run_tactic : Environ.env ->
- unit Proofview.tactic -> proof -> proof * (bool * Proofview_monad.Info.tree)
- val unshelve : proof -> proof
- val maximal_unfocus : 'a focus_kind -> proof -> proof
- val pr_proof : proof -> Pp.t
- module V82 :
- sig
- val grab_evars : proof -> proof
-
- val subgoals : proof -> Goal.goal list Evd.sigma
- end
-end
-
-module Proof_bullet :
-sig
- val get_default_goal_selector : unit -> Vernacexpr.goal_selector
-end
-
-module Proof_global :
-sig
-
- type state
-
- type proof_mode = {
- name : string;
- set : unit -> unit ;
- reset : unit -> unit
- }
- type proof_universes = UState.t * Universes.universe_binders option
- type proof_object = {
- id : Names.Id.t;
- entries : Safe_typing.private_constants Entries.definition_entry list;
- persistence : Decl_kinds.goal_kind;
- universes: proof_universes;
- }
-
- type proof_ending =
- | Admitted of Names.Id.t * Decl_kinds.goal_kind * Entries.parameter_entry *
- proof_universes
- | Proved of Vernacexpr.opacity_flag *
- Vernacexpr.lident option *
- proof_object
-
- type proof_terminator
- type lemma_possible_guards
- type closed_proof = proof_object * proof_terminator
-
- val make_terminator : (proof_ending -> unit) -> proof_terminator
- val start_dependent_proof :
- Names.Id.t -> ?pl:Univdecls.universe_decl -> Decl_kinds.goal_kind ->
- Proofview.telescope -> proof_terminator -> unit
- val with_current_proof :
- (unit Proofview.tactic -> Proof.proof -> Proof.proof * 'a) -> 'a
- val simple_with_current_proof :
- (unit Proofview.tactic -> Proof.proof -> Proof.proof) -> unit
- val compact_the_proof : unit -> unit
- val register_proof_mode : proof_mode -> unit
-
- exception NoCurrentProof
- val give_me_the_proof : unit -> Proof.proof
- (** @raise NoCurrentProof when outside proof mode. *)
-
- val discard_all : unit -> unit
- val discard_current : unit -> unit
- val get_current_proof_name : unit -> Names.Id.t
-end
-
-module Redexpr :
-sig
- type red_expr =
- (EConstr.constr, Names.evaluable_global_reference, Pattern.constr_pattern) Genredexpr.red_expr_gen
- val reduction_of_red_expr :
- Environ.env -> red_expr -> Reductionops.e_reduction_function * Constr.cast_kind
- val declare_reduction : string -> Reductionops.reduction_function -> unit
-end
-
-module Refiner :
-sig
- val project : 'a Evd.sigma -> Evd.evar_map
-
- val unpackage : 'a Evd.sigma -> Evd.evar_map ref * 'a
-
- val repackage : Evd.evar_map ref -> 'a -> 'a Evd.sigma
-
- val tclSHOWHYPS : Proof_type.tactic -> Proof_type.tactic
- exception FailError of int * Pp.t Lazy.t
-
- val tclEVARS : Evd.evar_map -> Proof_type.tactic
- val tclMAP : ('a -> Proof_type.tactic) -> 'a list -> Proof_type.tactic
- val tclREPEAT : Proof_type.tactic -> Proof_type.tactic
- val tclORELSE : Proof_type.tactic -> Proof_type.tactic -> Proof_type.tactic
- val tclFAIL : int -> Pp.t -> Proof_type.tactic
- val tclIDTAC : Proof_type.tactic
- val tclTHEN : Proof_type.tactic -> Proof_type.tactic -> Proof_type.tactic
- val tclTHENLIST : Proof_type.tactic list -> Proof_type.tactic
- val tclTRY : Proof_type.tactic -> Proof_type.tactic
- val tclAT_LEAST_ONCE : Proof_type.tactic -> Proof_type.tactic
-end
-
-module Tacmach :
-sig
-
- type tactic = Proof_type.tactic
-
- type 'a sigma = 'a Evd.sigma
- [@@ocaml.deprecated "alias of API.Evd.sigma"]
-
- val re_sig : 'a -> Evd.evar_map -> 'a Evd.sigma
-
- val pf_reduction_of_red_expr : Goal.goal Evd.sigma -> Redexpr.red_expr -> EConstr.constr -> Evd.evar_map * EConstr.constr
-
- val pf_unsafe_type_of : Goal.goal Evd.sigma -> EConstr.constr -> EConstr.types
-
- val pf_get_new_id : Names.Id.t -> Goal.goal Evd.sigma -> Names.Id.t
-
- val pf_env : Goal.goal Evd.sigma -> Environ.env
-
- val pf_concl : Goal.goal Evd.sigma -> EConstr.types
-
- val pf_apply : (Environ.env -> Evd.evar_map -> 'a) -> Goal.goal Evd.sigma -> 'a
-
- val pf_get_hyp : Goal.goal Evd.sigma -> Names.Id.t -> EConstr.named_declaration
- val pf_get_hyp_typ : Goal.goal Evd.sigma -> Names.Id.t -> EConstr.types
- val project : Goal.goal Evd.sigma -> Evd.evar_map
- val refine : EConstr.constr -> Proof_type.tactic
- val refine_no_check : EConstr.constr -> Proof_type.tactic
- val pf_type_of : Goal.goal Evd.sigma -> EConstr.constr -> Evd.evar_map * EConstr.types
-
- val pf_hyps : Goal.goal Evd.sigma -> EConstr.named_context
-
- val pf_ids_of_hyps : Goal.goal Evd.sigma -> Names.Id.t list
-
- val pf_reduce_to_atomic_ind : Goal.goal Evd.sigma -> EConstr.types -> (Names.inductive * EConstr.EInstance.t) * EConstr.types
-
- val pf_reduce_to_quantified_ind : Goal.goal Evd.sigma -> EConstr.types -> (Names.inductive * EConstr.EInstance.t) * EConstr.types
-
- val pf_eapply : (Environ.env -> Evd.evar_map -> 'a -> Evd.evar_map * 'b) ->
- Evar.t Evd.sigma -> 'a -> Evar.t Evd.sigma * 'b
-
- val pf_unfoldn : (Locus.occurrences * Names.evaluable_global_reference) list
- -> Goal.goal Evd.sigma -> EConstr.constr -> EConstr.constr
-
- val pf_reduce : (Environ.env -> Evd.evar_map -> EConstr.constr -> EConstr.constr) -> Goal.goal Evd.sigma -> EConstr.constr -> EConstr.constr
-
- val pf_conv_x : Goal.goal Evd.sigma -> EConstr.constr -> EConstr.constr -> bool
-
- val pf_is_matching : Goal.goal Evd.sigma -> Pattern.constr_pattern -> EConstr.constr -> bool
-
- val pf_hyps_types : Goal.goal Evd.sigma -> (Names.Id.t * EConstr.types) list
-
- val pr_gls : Goal.goal Evd.sigma -> Pp.t
-
- val pf_nf_betaiota : Goal.goal Evd.sigma -> EConstr.constr -> EConstr.constr
-
- val pf_last_hyp : Goal.goal Evd.sigma -> EConstr.named_declaration
-
- val pf_nth_hyp_id : Goal.goal Evd.sigma -> int -> Names.Id.t
-
- val sig_it : 'a Evd.sigma -> 'a
-
- module New :
- sig
- val pf_apply : (Environ.env -> Evd.evar_map -> 'a) -> 'b Proofview.Goal.t -> 'a
- val project : 'a Proofview.Goal.t -> Evd.evar_map
- val pf_unsafe_type_of : 'a Proofview.Goal.t -> EConstr.constr -> EConstr.types
- val of_old : (Goal.goal Evd.sigma -> 'a) -> [ `NF ] Proofview.Goal.t -> 'a
-
- val pf_env : 'a Proofview.Goal.t -> Environ.env
- val pf_ids_of_hyps : 'a Proofview.Goal.t -> Names.Id.t list
- val pf_ids_set_of_hyps : 'a Proofview.Goal.t -> Names.Id.Set.t
- val pf_concl : 'a Proofview.Goal.t -> EConstr.types
- val pf_get_new_id : Names.Id.t -> 'a Proofview.Goal.t -> Names.Id.t
- val pf_get_hyp : Names.Id.t -> 'a Proofview.Goal.t -> EConstr.named_declaration
- val pf_get_hyp_typ : Names.Id.t -> 'a Proofview.Goal.t -> EConstr.types
- val pf_get_type_of : 'a Proofview.Goal.t -> EConstr.constr -> EConstr.types
- val pf_global : Names.Id.t -> 'a Proofview.Goal.t -> Globnames.global_reference
- val pf_hyps_types : 'a Proofview.Goal.t -> (Names.Id.t * EConstr.types) list
- end
-end
-
-module Pfedit :
-sig
- val solve_by_implicit_tactic : unit -> Pretyping.inference_hook option
- val refine_by_tactic : Environ.env -> Evd.evar_map -> EConstr.types -> unit Proofview.tactic ->
- Constr.t * Evd.evar_map
- val declare_implicit_tactic : unit Proofview.tactic -> unit
- val clear_implicit_tactic : unit -> unit
- val by : unit Proofview.tactic -> bool
- val solve : ?with_end_tac:unit Proofview.tactic ->
- Vernacexpr.goal_selector -> int option -> unit Proofview.tactic ->
- Proof.proof -> Proof.proof * bool
- val cook_proof :
- unit -> (Names.Id.t * (Safe_typing.private_constants Entries.definition_entry * Proof_global.proof_universes * Decl_kinds.goal_kind))
-
- val get_current_context : unit -> Evd.evar_map * Environ.env
- val current_proof_statement : unit -> Names.Id.t * Decl_kinds.goal_kind * EConstr.types
-end
-
-module Clenv :
-sig
-
- type hole = {
- hole_evar : EConstr.constr;
- hole_type : EConstr.types;
- hole_deps : bool;
- hole_name : Names.Name.t;
- }
-
- type clause = {
- cl_holes : hole list;
- cl_concl : EConstr.types;
- }
-
- val make_evar_clause : Environ.env -> Evd.evar_map -> ?len:int -> EConstr.types ->
- (Evd.evar_map * clause)
- val solve_evar_clause : Environ.env -> Evd.evar_map -> bool -> clause -> EConstr.constr Misctypes.bindings ->
- Evd.evar_map
- type clausenv
- val pr_clenv : clausenv -> Pp.t
-end
-
-(************************************************************************)
-(* End of modules from proofs/ *)
-(************************************************************************)
-
-(************************************************************************)
-(* Modules from parsing/ *)
-(************************************************************************)
-
-module Pcoq :
-sig
-
- open Loc
- open Names
- open Extend
- open Vernacexpr
- open Genarg
- open Constrexpr
- open Libnames
- open Misctypes
- open Genredexpr
-
- module Gram : sig
- include Grammar.S with type te = Tok.t
-
- type 'a entry = 'a Entry.e
- type internal_entry = Tok.t Gramext.g_entry
- type symbol = Tok.t Gramext.g_symbol
- type action = Gramext.g_action
- type production_rule = symbol list * action
- type single_extend_statment =
- string option * Gramext.g_assoc option * production_rule list
- type extend_statment =
- Gramext.position option * single_extend_statment list
-
- type coq_parsable
-
- val parsable : ?file:Loc.source -> char Stream.t -> coq_parsable
- val action : 'a -> action
- val entry_create : string -> 'a entry
- val entry_parse : 'a entry -> coq_parsable -> 'a
- val entry_print : Format.formatter -> 'a entry -> unit
- val with_parsable : coq_parsable -> ('a -> 'b) -> 'a -> 'b
-
- (* Apparently not used *)
- val srules' : production_rule list -> symbol
- val parse_tokens_after_filter : 'a entry -> Tok.t Stream.t -> 'a
-
- end with type 'a Entry.e = 'a Grammar.GMake(CLexer).Entry.e
-
- val parse_string : 'a Gram.entry -> string -> 'a
- val eoi_entry : 'a Gram.entry -> 'a Gram.entry
- val map_entry : ('a -> 'b) -> 'a Gram.entry -> 'b Gram.entry
-
- type gram_universe
-
- val uprim : gram_universe
- val uconstr : gram_universe
- val utactic : gram_universe
- val uvernac : gram_universe
-
- val register_grammar : ('raw, 'glb, 'top) genarg_type -> 'raw Gram.entry -> unit
-
- val genarg_grammar : ('raw, 'glb, 'top) genarg_type -> 'raw Gram.entry
-
- val create_generic_entry : gram_universe -> string ->
- ('a, rlevel) abstract_argument_type -> 'a Gram.entry
-
- module Prim :
- sig
- open Names
- open Libnames
- val preident : string Gram.entry
- val ident : Id.t Gram.entry
- val name : Name.t located Gram.entry
- val identref : Id.t located Gram.entry
- val pidentref : (Id.t located * (Id.t located list) option) Gram.entry
- val pattern_ident : Id.t Gram.entry
- val pattern_identref : Id.t located Gram.entry
- val base_ident : Id.t Gram.entry
- val natural : int Gram.entry
- val bigint : Constrexpr.raw_natural_number Gram.entry
- val integer : int Gram.entry
- val string : string Gram.entry
- val lstring : string located Gram.entry
- val qualid : qualid located Gram.entry
- val fullyqualid : Id.t list located Gram.entry
- val reference : reference Gram.entry
- val by_notation : (string * string option) Loc.located Gram.entry
- val smart_global : reference or_by_notation Gram.entry
- val dirpath : DirPath.t Gram.entry
- val ne_string : string Gram.entry
- val ne_lstring : string located Gram.entry
- val var : Id.t located Gram.entry
- end
-
- module Constr :
- sig
- val constr : constr_expr Gram.entry
- val constr_eoi : constr_expr Gram.entry
- val lconstr : constr_expr Gram.entry
- val binder_constr : constr_expr Gram.entry
- val operconstr : constr_expr Gram.entry
- val ident : Id.t Gram.entry
- val global : reference Gram.entry
- val universe_level : glob_level Gram.entry
- val sort : glob_sort Gram.entry
- val sort_family : Sorts.family Gram.entry
- val pattern : cases_pattern_expr Gram.entry
- val constr_pattern : constr_expr Gram.entry
- val lconstr_pattern : constr_expr Gram.entry
- val closed_binder : local_binder_expr list Gram.entry
- val binder : local_binder_expr list Gram.entry (* closed_binder or variable *)
- val binders : local_binder_expr list Gram.entry (* list of binder *)
- val open_binders : local_binder_expr list Gram.entry
- val binders_fixannot : (local_binder_expr list * (Id.t located option * recursion_order_expr)) Gram.entry
- val typeclass_constraint : (Name.t located * bool * constr_expr) Gram.entry
- val record_declaration : constr_expr Gram.entry
- val appl_arg : (constr_expr * explicitation located option) Gram.entry
- end
-
- module Vernac_ :
- sig
- val gallina : vernac_expr Gram.entry
- val gallina_ext : vernac_expr Gram.entry
- val command : vernac_expr Gram.entry
- val syntax : vernac_expr Gram.entry
- val vernac : vernac_expr Gram.entry
- val rec_definition : (fixpoint_expr * decl_notation list) Gram.entry
- val vernac_eoi : vernac_expr Gram.entry
- val noedit_mode : vernac_expr Gram.entry
- val command_entry : vernac_expr Gram.entry
- val red_expr : raw_red_expr Gram.entry
- val hint_info : Vernacexpr.hint_info_expr Gram.entry
- end
-
- val epsilon_value : ('a -> 'self) -> ('self, 'a) Extend.symbol -> 'self option
-
- val get_command_entry : unit -> vernac_expr Gram.entry
- val set_command_entry : vernac_expr Gram.entry -> unit
-
- type gram_reinit = gram_assoc * gram_position
- val grammar_extend : 'a Gram.entry -> gram_reinit option ->
- 'a Extend.extend_statment -> unit
-
- module GramState : Store.S
-
- type 'a grammar_command
-
- type extend_rule =
- | ExtendRule : 'a Gram.entry * gram_reinit option * 'a extend_statment -> extend_rule
-
- type 'a grammar_extension = 'a -> GramState.t -> extend_rule list * GramState.t
-
- val create_grammar_command : string -> 'a grammar_extension -> 'a grammar_command
-
- val extend_grammar_command : 'a grammar_command -> 'a -> unit
- val recover_grammar_command : 'a grammar_command -> 'a list
- val with_grammar_rule_protection : ('a -> 'b) -> 'a -> 'b
-
- val to_coqloc : Ploc.t -> Loc.t
- val (!@) : Ploc.t -> Loc.t
-
-end
-
-module Egramml :
-sig
- open Vernacexpr
-
- type 's grammar_prod_item =
- | GramTerminal of string
- | GramNonTerminal : ('a Genarg.raw_abstract_argument_type option *
- ('s, 'a) Extend.symbol) Loc.located -> 's grammar_prod_item
-
- val extend_vernac_command_grammar :
- extend_name -> vernac_expr Pcoq.Gram.entry option ->
- vernac_expr grammar_prod_item list -> unit
-
- val make_rule :
- (Loc.t -> Genarg.raw_generic_argument list -> 'a) ->
- 'a grammar_prod_item list -> 'a Extend.production_rule
-
-end
-
-module G_vernac :
-sig
-
- val def_body : Vernacexpr.definition_expr Pcoq.Gram.entry
- val section_subset_expr : Vernacexpr.section_subset_expr Pcoq.Gram.entry
- val query_command : (Vernacexpr.goal_selector option -> Vernacexpr.vernac_expr) Pcoq.Gram.entry
-
-end
-
-module G_proofs :
-sig
-
- val hint : Vernacexpr.hints_expr Pcoq.Gram.entry
-
-end
-
-(************************************************************************)
-(* End of modules from parsing/ *)
-(************************************************************************)
-
-(************************************************************************)
-(* Modules from printing/ *)
-(************************************************************************)
-
-module Genprint :
-sig
- type printer_with_level =
- { default_already_surrounded : Notation_term.tolerability;
- default_ensure_surrounded : Notation_term.tolerability;
- printer : Environ.env -> Evd.evar_map -> Notation_term.tolerability -> Pp.t }
- type printer_result =
- | PrinterBasic of (unit -> Pp.t)
- | PrinterNeedsContext of (Environ.env -> Evd.evar_map -> Pp.t)
- | PrinterNeedsContextAndLevel of printer_with_level
- type 'a printer = 'a -> Pp.t
- type 'a top_printer = 'a -> printer_result
- val register_print0 : ('raw, 'glb, 'top) Genarg.genarg_type ->
- 'raw printer -> 'glb printer -> 'top top_printer -> unit
- val register_vernac_print0 : ('raw, 'glb, 'top) Genarg.genarg_type ->
- 'raw printer -> unit
- val register_val_print0 : 'top Geninterp.Val.typ -> 'top top_printer -> unit
- val generic_top_print : Genarg.tlevel Genarg.generic_argument top_printer
- val generic_val_print : Geninterp.Val.t top_printer
-end
-
-module Pputils :
-sig
- val pr_with_occurrences : ('a -> Pp.t) -> (string -> Pp.t) -> 'a Locus.with_occurrences -> Pp.t
- val pr_red_expr :
- ('a -> Pp.t) * ('a -> Pp.t) * ('b -> Pp.t) * ('c -> Pp.t) ->
- (string -> Pp.t) ->
- ('a,'b,'c) Genredexpr.red_expr_gen -> Pp.t
- val pr_raw_generic : Environ.env -> Genarg.rlevel Genarg.generic_argument -> Pp.t
- val pr_glb_generic : Environ.env -> Genarg.glevel Genarg.generic_argument -> Pp.t
- val pr_or_var : ('a -> Pp.t) -> 'a Misctypes.or_var -> Pp.t
- val pr_or_by_notation : ('a -> Pp.t) -> 'a Misctypes.or_by_notation -> Pp.t
-end
-
-module Ppconstr :
-sig
- val pr_name : Names.Name.t -> Pp.t
- [@@ocaml.deprecated "alias of API.Names.Name.print"]
-
- val lsimpleconstr : Notation_term.tolerability
- val ltop : Notation_term.tolerability
- val pr_id : Names.Id.t -> Pp.t
- val pr_or_var : ('a -> Pp.t) -> 'a Misctypes.or_var -> Pp.t
- val pr_with_comments : ?loc:Loc.t -> Pp.t -> Pp.t
- val pr_lident : Names.Id.t Loc.located -> Pp.t
- val pr_lname : Names.Name.t Loc.located -> Pp.t
- val prec_less : int -> int * Notation_term.parenRelation -> bool
- val pr_constr_expr : Constrexpr.constr_expr -> Pp.t
- val pr_lconstr_expr : Constrexpr.constr_expr -> Pp.t
- val pr_constr_pattern_expr : Constrexpr.constr_pattern_expr -> Pp.t
- val pr_lconstr_pattern_expr : Constrexpr.constr_pattern_expr -> Pp.t
- val pr_binders : Constrexpr.local_binder_expr list -> Pp.t
- val pr_glob_sort : Misctypes.glob_sort -> Pp.t
-end
-
-module Printer :
-sig
- val pr_named_context : Environ.env -> Evd.evar_map -> Context.Named.t -> Pp.t
- val pr_rel_context : Environ.env -> Evd.evar_map -> Context.Rel.t -> Pp.t
- val pr_goal : Goal.goal Evd.sigma -> Pp.t
-
- val pr_constr_env : Environ.env -> Evd.evar_map -> Constr.t -> Pp.t
- val pr_lconstr_env : Environ.env -> Evd.evar_map -> Constr.t -> Pp.t
-
- val pr_constr : Constr.t -> Pp.t
-
- val pr_lconstr : Constr.t -> Pp.t
-
- val pr_econstr : EConstr.constr -> Pp.t
- val pr_glob_constr : Glob_term.glob_constr -> Pp.t
- val pr_constr_pattern : Pattern.constr_pattern -> Pp.t
- val pr_glob_constr_env : Environ.env -> Glob_term.glob_constr -> Pp.t
- val pr_lglob_constr_env : Environ.env -> Glob_term.glob_constr -> Pp.t
- val pr_econstr_n_env : Environ.env -> Evd.evar_map -> Notation_term.tolerability -> EConstr.constr -> Pp.t
- val pr_econstr_env : Environ.env -> Evd.evar_map -> EConstr.constr -> Pp.t
- val pr_constr_pattern_env : Environ.env -> Evd.evar_map -> Pattern.constr_pattern -> Pp.t
- val pr_lconstr_pattern_env : Environ.env -> Evd.evar_map -> Pattern.constr_pattern -> Pp.t
- val pr_closed_glob : Ltac_pretype.closed_glob_constr -> Pp.t
- val pr_lglob_constr : Glob_term.glob_constr -> Pp.t
- val pr_leconstr_env : Environ.env -> Evd.evar_map -> EConstr.constr -> Pp.t
- val pr_leconstr : EConstr.constr -> Pp.t
- val pr_global : Globnames.global_reference -> Pp.t
- val pr_lconstr_under_binders : Ltac_pretype.constr_under_binders -> Pp.t
- val pr_lconstr_under_binders_env : Environ.env -> Evd.evar_map -> Ltac_pretype.constr_under_binders -> Pp.t
-
- val pr_constr_under_binders_env : Environ.env -> Evd.evar_map -> Ltac_pretype.constr_under_binders -> Pp.t
- val pr_closed_glob_n_env : Environ.env -> Evd.evar_map -> Notation_term.tolerability -> Ltac_pretype.closed_glob_constr -> Pp.t
- val pr_closed_glob_env : Environ.env -> Evd.evar_map -> Ltac_pretype.closed_glob_constr -> Pp.t
- val pr_rel_context_of : Environ.env -> Evd.evar_map -> Pp.t
- val pr_named_context_of : Environ.env -> Evd.evar_map -> Pp.t
- val pr_ltype : Term.types -> Pp.t
- val pr_ljudge : EConstr.unsafe_judgment -> Pp.t * Pp.t
- val pr_idpred : Names.Id.Pred.t -> Pp.t
- val pr_cpred : Names.Cpred.t -> Pp.t
- val pr_transparent_state : Names.transparent_state -> Pp.t
-end
-
-module Prettyp :
-sig
- type 'a locatable_info = {
- locate : Libnames.qualid -> 'a option;
- locate_all : Libnames.qualid -> 'a list;
- shortest_qualid : 'a -> Libnames.qualid;
- name : 'a -> Pp.t;
- print : 'a -> Pp.t;
- about : 'a -> Pp.t;
- }
-
- val register_locatable : string -> 'a locatable_info -> unit
- val print_located_other : string -> Libnames.reference -> Pp.t
-end
-
-(************************************************************************)
-(* End of modules from printing/ *)
-(************************************************************************)
-
-(************************************************************************)
-(* Modules from tactics/ *)
-(************************************************************************)
-
-module Tacticals :
-sig
- open Proof_type
-
- val tclORELSE : tactic -> tactic -> tactic
- val tclDO : int -> tactic -> tactic
- val tclIDTAC : tactic
- val tclFAIL : int -> Pp.t -> tactic
- val tclTHEN : tactic -> tactic -> tactic
- val tclTHENLIST : tactic list -> tactic
- val pf_constr_of_global :
- Globnames.global_reference -> (EConstr.constr -> Proof_type.tactic) -> Proof_type.tactic
- val tclMAP : ('a -> tactic) -> 'a list -> tactic
- val tclTRY : tactic -> tactic
- val tclCOMPLETE : tactic -> tactic
- val tclTHENS : tactic -> tactic list -> tactic
- val tclFIRST : tactic list -> tactic
- val tclTHENFIRST : tactic -> tactic -> tactic
- val tclTHENLAST : tactic -> tactic -> tactic
- val tclTHENSFIRSTn : tactic -> tactic array -> tactic -> tactic
- val tclTHENSLASTn : tactic -> tactic -> tactic array -> tactic
- val tclSOLVE : tactic list -> tactic
-
- val onClause : (Names.Id.t option -> tactic) -> Locus.clause -> tactic
- val onAllHypsAndConcl : (Names.Id.t option -> tactic) -> tactic
- val onLastHypId : (Names.Id.t -> tactic) -> tactic
- val onNthHypId : int -> (Names.Id.t -> tactic) -> tactic
- val onNLastHypsId : int -> (Names.Id.t list -> tactic) -> tactic
-
- val tclTHENSEQ : tactic list -> tactic
- [@@ocaml.deprecated "alias of API.Tacticals.tclTHENLIST"]
-
- val nLastDecls : int -> Goal.goal Evd.sigma -> EConstr.named_context
-
- val tclTHEN_i : tactic -> (int -> tactic) -> tactic
-
- val tclPROGRESS : tactic -> tactic
-
- val elimination_sort_of_goal : Goal.goal Evd.sigma -> Sorts.family
-
- module New :
- sig
- open Proofview
- val tclORELSE0 : unit tactic -> unit tactic -> unit tactic
- val tclFAIL : int -> Pp.t -> 'a tactic
- val pf_constr_of_global : Globnames.global_reference -> EConstr.constr tactic
- val tclTHEN : unit tactic -> unit tactic -> unit tactic
- val tclTHENS : unit tactic -> unit tactic list -> unit tactic
- val tclFIRST : unit tactic list -> unit tactic
- val tclZEROMSG : ?loc:Loc.t -> Pp.t -> 'a tactic
- val tclORELSE : unit tactic -> unit tactic -> unit tactic
- val tclREPEAT : unit tactic -> unit tactic
- val tclTRY : unit tactic -> unit tactic
- val tclTHENFIRST : unit tactic -> unit tactic -> unit tactic
- val tclPROGRESS : unit Proofview.tactic -> unit Proofview.tactic
- val tclTHENS3PARTS : unit tactic -> unit tactic array -> unit tactic -> unit tactic array -> unit tactic
- val tclDO : int -> unit tactic -> unit tactic
- val tclTIMEOUT : int -> unit tactic -> unit tactic
- val tclTIME : string option -> 'a tactic -> 'a tactic
- val tclOR : unit tactic -> unit tactic -> unit tactic
- val tclONCE : unit tactic -> unit tactic
- val tclEXACTLY_ONCE : unit tactic -> unit tactic
- val tclIFCATCH :
- unit tactic ->
- (unit -> unit tactic) ->
- (unit -> unit tactic) -> unit tactic
- val tclSOLVE : unit tactic list -> unit tactic
- val tclCOMPLETE : 'a tactic -> 'a tactic
- val tclSELECT : Vernacexpr.goal_selector -> 'a tactic -> 'a tactic
- val tclWITHHOLES : bool -> 'a tactic -> Evd.evar_map -> 'a tactic
- val tclDELAYEDWITHHOLES : bool -> 'a Tactypes.delayed_open -> ('a -> unit tactic) -> unit tactic
- val tclTHENLIST : unit tactic list -> unit tactic
- val tclTHENLAST : unit tactic -> unit tactic -> unit tactic
- val tclMAP : ('a -> unit tactic) -> 'a list -> unit tactic
- val tclIDTAC : unit tactic
- val tclIFTHENELSE : unit tactic -> unit tactic -> unit tactic -> unit tactic
- val tclIFTHENSVELSE : unit tactic -> unit tactic array -> unit tactic -> unit tactic
- end
-end
-
-module Hipattern :
-sig
- exception NoEquationFound
- type 'a matching_function = Evd.evar_map -> EConstr.constr -> 'a option
- type testing_function = Evd.evar_map -> EConstr.constr -> bool
- val is_disjunction : ?strict:bool -> ?onlybinary:bool -> testing_function
- val match_with_disjunction : ?strict:bool -> ?onlybinary:bool -> (EConstr.constr * EConstr.constr list) matching_function
- val match_with_equality_type : (EConstr.constr * EConstr.constr list) matching_function
- val is_empty_type : testing_function
- val is_unit_type : testing_function
- val is_unit_or_eq_type : testing_function
- val is_conjunction : ?strict:bool -> ?onlybinary:bool -> testing_function
- val match_with_conjunction : ?strict:bool -> ?onlybinary:bool -> (EConstr.constr * EConstr.constr list) matching_function
- val match_with_imp_term : (EConstr.constr * EConstr.constr) matching_function
- val match_with_forall_term : (Names.Name.t * EConstr.constr * EConstr.constr) matching_function
- val match_with_nodep_ind : (EConstr.constr * EConstr.constr list * int) matching_function
- val match_with_sigma_type : (EConstr.constr * EConstr.constr list) matching_function
-end
-
-module Ind_tables :
-sig
- type individual
- type 'a scheme_kind
-
- val check_scheme : 'a scheme_kind -> Names.inductive -> bool
- val find_scheme : ?mode:Declare.internal_flag -> 'a scheme_kind -> Names.inductive -> Names.Constant.t * Safe_typing.private_constants
- val pr_scheme_kind : 'a scheme_kind -> Pp.t
-end
-
-module Elimschemes :
-sig
- val case_scheme_kind_from_prop : Ind_tables.individual Ind_tables.scheme_kind
- val case_dep_scheme_kind_from_type_in_prop : Ind_tables.individual Ind_tables.scheme_kind
- val case_scheme_kind_from_type : Ind_tables.individual Ind_tables.scheme_kind
- val case_dep_scheme_kind_from_type : Ind_tables.individual Ind_tables.scheme_kind
- val case_dep_scheme_kind_from_prop : Ind_tables.individual Ind_tables.scheme_kind
-end
-
-module Tactics :
-sig
- open Proofview
-
- type change_arg = Ltac_pretype.patvar_map -> Evd.evar_map -> Evd.evar_map * EConstr.constr
- type tactic_reduction = Environ.env -> Evd.evar_map -> EConstr.constr -> EConstr.constr
-
- type elim_scheme =
- {
- elimc: EConstr.constr Misctypes.with_bindings option;
- elimt: EConstr.types;
- indref: Globnames.global_reference option;
- params: EConstr.rel_context;
- nparams: int;
- predicates: EConstr.rel_context;
- npredicates: int;
- branches: EConstr.rel_context;
- nbranches: int;
- args: EConstr.rel_context;
- nargs: int;
- indarg: EConstr.rel_declaration option;
- concl: EConstr.types;
- indarg_in_concl: bool;
- farg_in_concl: bool;
- }
-
- val unify : ?state:Names.transparent_state -> EConstr.constr -> EConstr.constr -> unit Proofview.tactic
- val intro_then : (Names.Id.t -> unit Proofview.tactic) -> unit Proofview.tactic
- val reflexivity : unit tactic
- val change_concl : EConstr.constr -> unit tactic
- val apply : EConstr.constr -> unit tactic
- val normalise_vm_in_concl : unit tactic
- val assert_before : Names.Name.t -> EConstr.types -> unit tactic
- val exact_check : EConstr.constr -> unit tactic
- val simplest_elim : EConstr.constr -> unit tactic
- val introf : unit tactic
- val cut : EConstr.types -> unit tactic
- val convert_concl : ?check:bool -> EConstr.types -> Constr.cast_kind -> unit tactic
- val intro_using : Names.Id.t -> unit tactic
- val intro : unit tactic
- val fresh_id_in_env : Names.Id.Set.t -> Names.Id.t -> Environ.env -> Names.Id.t
- val is_quantified_hypothesis : Names.Id.t -> 'a Goal.t -> bool
- val tclABSTRACT : ?opaque:bool -> Names.Id.t option -> unit Proofview.tactic -> unit Proofview.tactic
- val intro_patterns : bool -> Tactypes.intro_patterns -> unit Proofview.tactic
- val apply_with_delayed_bindings_gen :
- Misctypes.advanced_flag -> Misctypes.evars_flag -> (Misctypes.clear_flag * Tactypes.delayed_open_constr_with_bindings Loc.located) list -> unit Proofview.tactic
- val apply_delayed_in :
- Misctypes.advanced_flag -> Misctypes.evars_flag -> Names.Id.t ->
- (Misctypes.clear_flag * Tactypes.delayed_open_constr_with_bindings Loc.located) list ->
- Tactypes.intro_pattern option -> unit Proofview.tactic
- val elim :
- Misctypes.evars_flag -> Misctypes.clear_flag -> EConstr.constr Misctypes.with_bindings -> EConstr.constr Misctypes.with_bindings option -> unit Proofview.tactic
- val general_case_analysis : Misctypes.evars_flag -> Misctypes.clear_flag -> EConstr.constr Misctypes.with_bindings -> unit Proofview.tactic
- val mutual_fix :
- Names.Id.t -> int -> (Names.Id.t * int * EConstr.constr) list -> int -> unit Proofview.tactic
- val mutual_cofix : Names.Id.t -> (Names.Id.t * EConstr.constr) list -> int -> unit Proofview.tactic
- val forward : bool -> unit Proofview.tactic option option ->
- Tactypes.intro_pattern option -> EConstr.constr -> unit Proofview.tactic
- val generalize_gen : (EConstr.constr Locus.with_occurrences * Names.Name.t) list -> unit Proofview.tactic
- val letin_tac : (bool * Tactypes.intro_pattern_naming) option ->
- Names.Name.t -> EConstr.constr -> EConstr.types option -> Locus.clause -> unit Proofview.tactic
- val letin_pat_tac : Misctypes.evars_flag ->
- (bool * Tactypes.intro_pattern_naming) option ->
- Names.Name.t ->
- Evd.evar_map * EConstr.constr ->
- Locus.clause -> unit Proofview.tactic
- val induction_destruct : Misctypes.rec_flag -> Misctypes.evars_flag ->
- (Tactypes.delayed_open_constr_with_bindings Misctypes.destruction_arg
- * (Tactypes.intro_pattern_naming option * Tactypes.or_and_intro_pattern option)
- * Locus.clause option) list *
- EConstr.constr Misctypes.with_bindings option -> unit Proofview.tactic
- val reduce : Redexpr.red_expr -> Locus.clause -> unit Proofview.tactic
- val change : Pattern.constr_pattern option -> change_arg -> Locus.clause -> unit Proofview.tactic
- val intros_reflexivity : unit Proofview.tactic
- val exact_no_check : EConstr.constr -> unit Proofview.tactic
- val assumption : unit Proofview.tactic
- val intros_transitivity : EConstr.constr option -> unit Proofview.tactic
- val vm_cast_no_check : EConstr.constr -> unit Proofview.tactic
- val native_cast_no_check : EConstr.constr -> unit Proofview.tactic
- val case_type : EConstr.types -> unit Proofview.tactic
- val elim_type : EConstr.types -> unit Proofview.tactic
- val cut_and_apply : EConstr.constr -> unit Proofview.tactic
- val left_with_bindings : Misctypes.evars_flag -> EConstr.constr Misctypes.bindings -> unit Proofview.tactic
- val right_with_bindings : Misctypes.evars_flag -> EConstr.constr Misctypes.bindings -> unit Proofview.tactic
- val any_constructor : Misctypes.evars_flag -> unit Proofview.tactic option -> unit Proofview.tactic
- val constructor_tac : Misctypes.evars_flag -> int option -> int ->
- EConstr.constr Misctypes.bindings -> unit Proofview.tactic
- val specialize : EConstr.constr Misctypes.with_bindings -> Tactypes.intro_pattern option -> unit Proofview.tactic
- val intros_symmetry : Locus.clause -> unit Proofview.tactic
- val split_with_bindings : Misctypes.evars_flag -> EConstr.constr Misctypes.bindings list -> unit Proofview.tactic
- val intros_until : Misctypes.quantified_hypothesis -> unit Proofview.tactic
- val intro_move : Names.Id.t option -> Names.Id.t Misctypes.move_location -> unit Proofview.tactic
- val move_hyp : Names.Id.t -> Names.Id.t Misctypes.move_location -> unit Proofview.tactic
- val rename_hyp : (Names.Id.t * Names.Id.t) list -> unit Proofview.tactic
- val revert : Names.Id.t list -> unit Proofview.tactic
- val simple_induct : Misctypes.quantified_hypothesis -> unit Proofview.tactic
- val simple_destruct : Misctypes.quantified_hypothesis -> unit Proofview.tactic
- val fix : Names.Id.t option -> int -> unit Proofview.tactic
- val cofix : Names.Id.t option -> unit Proofview.tactic
- val keep : Names.Id.t list -> unit Proofview.tactic
- val clear : Names.Id.t list -> unit Proofview.tactic
- val clear_body : Names.Id.t list -> unit Proofview.tactic
- val generalize_dep : ?with_let:bool (** Don't lose let bindings *) -> EConstr.constr -> unit Proofview.tactic
- val force_destruction_arg : Misctypes.evars_flag -> Environ.env -> Evd.evar_map ->
- Tactypes.delayed_open_constr_with_bindings Misctypes.destruction_arg ->
- Evd.evar_map * EConstr.constr Misctypes.with_bindings Misctypes.destruction_arg
- val apply_with_bindings : EConstr.constr Misctypes.with_bindings -> unit Proofview.tactic
- val abstract_generalize : ?generalize_vars:bool -> ?force_dep:bool -> Names.Id.t -> unit Proofview.tactic
- val specialize_eqs : Names.Id.t -> unit Proofview.tactic
- val generalize : EConstr.constr list -> unit Proofview.tactic
- val simplest_case : EConstr.constr -> unit Proofview.tactic
- val introduction : ?check:bool -> Names.Id.t -> unit Proofview.tactic
- val convert_concl_no_check : EConstr.types -> Constr.cast_kind -> unit Proofview.tactic
- val reduct_in_concl : tactic_reduction * Constr.cast_kind -> unit Proofview.tactic
- val reduct_in_hyp : ?check:bool -> tactic_reduction -> Locus.hyp_location -> unit Proofview.tactic
- val convert_hyp_no_check : EConstr.named_declaration -> unit Proofview.tactic
- val reflexivity_red : bool -> unit Proofview.tactic
- val symmetry_red : bool -> unit Proofview.tactic
- val eapply : EConstr.constr -> unit Proofview.tactic
- val transitivity_red : bool -> EConstr.constr option -> unit Proofview.tactic
- val assert_after_replacing : Names.Id.t -> EConstr.types -> unit Proofview.tactic
- val intros : unit Proofview.tactic
- val setoid_reflexivity : unit Proofview.tactic Hook.t
- val setoid_symmetry : unit Proofview.tactic Hook.t
- val setoid_symmetry_in : (Names.Id.t -> unit Proofview.tactic) Hook.t
- val setoid_transitivity : (EConstr.constr option -> unit Proofview.tactic) Hook.t
- val unfold_in_concl :
- (Locus.occurrences * Names.evaluable_global_reference) list -> unit Proofview.tactic
- val intros_using : Names.Id.t list -> unit Proofview.tactic
- val simpl_in_concl : unit Proofview.tactic
- val reduct_option : ?check:bool -> tactic_reduction * Constr.cast_kind -> Locus.goal_location -> unit Proofview.tactic
- val simplest_split : unit Proofview.tactic
- val unfold_in_hyp :
- (Locus.occurrences * Names.evaluable_global_reference) list -> Locus.hyp_location -> unit Proofview.tactic
- val split : EConstr.constr Misctypes.bindings -> unit Proofview.tactic
- val red_in_concl : unit Proofview.tactic
- val change_in_concl : (Locus.occurrences * Pattern.constr_pattern) option -> change_arg -> unit Proofview.tactic
- val eapply_with_bindings : EConstr.constr Misctypes.with_bindings -> unit Proofview.tactic
- val assert_by : Names.Name.t -> EConstr.types -> unit Proofview.tactic ->
- unit Proofview.tactic
- val intro_avoiding : Names.Id.Set.t -> unit Proofview.tactic
- val pose_proof : Names.Name.t -> EConstr.constr -> unit Proofview.tactic
- val pattern_option : (Locus.occurrences * EConstr.constr) list -> Locus.goal_location -> unit Proofview.tactic
- val compute_elim_sig : Evd.evar_map -> ?elimc:EConstr.constr Misctypes.with_bindings -> EConstr.types -> elim_scheme
- val try_intros_until :
- (Names.Id.t -> unit Proofview.tactic) -> Misctypes.quantified_hypothesis -> unit Proofview.tactic
- val cache_term_by_tactic_then :
- opaque:bool -> ?goal_type:(EConstr.constr option) -> Names.Id.t ->
- Decl_kinds.goal_kind -> unit Proofview.tactic -> (EConstr.constr -> EConstr.constr list -> unit Proofview.tactic) -> unit Proofview.tactic
- val apply_type : EConstr.constr -> EConstr.constr list -> unit Proofview.tactic
- val hnf_in_concl : unit Proofview.tactic
- val intro_mustbe_force : Names.Id.t -> unit Proofview.tactic
-
- module New :
- sig
- val refine : typecheck:bool -> (Evd.evar_map -> Evd.evar_map * EConstr.constr) -> unit Proofview.tactic
- val reduce_after_refine : unit Proofview.tactic
- end
- module Simple :
- sig
- val intro : Names.Id.t -> unit Proofview.tactic
- val apply : EConstr.constr -> unit Proofview.tactic
- val case : EConstr.constr -> unit Proofview.tactic
- end
-end
-
-module Elim :
-sig
- val h_decompose : Names.inductive list -> EConstr.constr -> unit Proofview.tactic
- val h_double_induction : Misctypes.quantified_hypothesis -> Misctypes.quantified_hypothesis-> unit Proofview.tactic
- val h_decompose_or : EConstr.constr -> unit Proofview.tactic
- val h_decompose_and : EConstr.constr -> unit Proofview.tactic
-end
-
-module Equality :
-sig
- type orientation = bool
- type freeze_evars_flag = bool
- type dep_proof_flag = bool
- type conditions =
- | Naive
- | FirstSolved
- | AllMatches
- type inj_flags = {
- keep_proof_equalities : bool; (* One may want it or not *)
- injection_in_context : bool; (* For regularity; one may want it from ML code but not interactively *)
- injection_pattern_l2r_order : bool; (* Compatibility option: no reason not to want it *)
- }
-
- val build_selector :
- Environ.env -> Evd.evar_map -> int -> EConstr.constr -> EConstr.types ->
- EConstr.constr -> EConstr.constr -> EConstr.constr
- val replace : EConstr.constr -> EConstr.constr -> unit Proofview.tactic
- val general_rewrite :
- orientation -> Locus.occurrences -> freeze_evars_flag -> dep_proof_flag ->
- ?tac:(unit Proofview.tactic * conditions) -> EConstr.constr -> unit Proofview.tactic
- val inj : inj_flags option -> Tactypes.intro_patterns option -> Misctypes.evars_flag ->
- Misctypes.clear_flag -> EConstr.constr Misctypes.with_bindings -> unit Proofview.tactic
- val general_multi_rewrite :
- Misctypes.evars_flag -> (bool * Misctypes.multi * Misctypes.clear_flag * Tactypes.delayed_open_constr_with_bindings) list ->
- Locus.clause -> (unit Proofview.tactic * conditions) option -> unit Proofview.tactic
- val replace_in_clause_maybe_by : EConstr.constr -> EConstr.constr -> Locus.clause -> unit Proofview.tactic option -> unit Proofview.tactic
- val replace_term : bool option -> EConstr.constr -> Locus.clause -> unit Proofview.tactic
- val dEq : keep_proofs:bool option -> Misctypes.evars_flag -> EConstr.constr Misctypes.with_bindings Misctypes.destruction_arg option -> unit Proofview.tactic
- val discr_tac : Misctypes.evars_flag ->
- EConstr.constr Misctypes.with_bindings Misctypes.destruction_arg option -> unit Proofview.tactic
- val injClause : inj_flags option -> Tactypes.intro_patterns option -> Misctypes.evars_flag ->
- EConstr.constr Misctypes.with_bindings Misctypes.destruction_arg option -> unit Proofview.tactic
-
- val simpleInjClause : inj_flags option -> Misctypes.evars_flag ->
- EConstr.constr Misctypes.with_bindings Misctypes.destruction_arg option ->
- unit Proofview.tactic
- val rewriteInConcl : bool -> EConstr.constr -> unit Proofview.tactic
- val rewriteInHyp : bool -> EConstr.constr -> Names.Id.t -> unit Proofview.tactic
- val cutRewriteInConcl : bool -> EConstr.constr -> unit Proofview.tactic
- val cutRewriteInHyp : bool -> EConstr.types -> Names.Id.t -> unit Proofview.tactic
- val general_rewrite_ebindings_clause : Names.Id.t option ->
- orientation -> Locus.occurrences -> freeze_evars_flag -> dep_proof_flag ->
- ?tac:(unit Proofview.tactic * conditions) -> EConstr.constr Misctypes.with_bindings -> Misctypes.evars_flag -> unit Proofview.tactic
- val subst : Names.Id.t list -> unit Proofview.tactic
-
- type subst_tactic_flags = {
- only_leibniz : bool;
- rewrite_dependent_proof : bool
- }
- val subst_all : ?flags:subst_tactic_flags -> unit -> unit Proofview.tactic
-
- val general_rewrite_in :
- orientation -> Locus.occurrences -> freeze_evars_flag -> dep_proof_flag ->
- ?tac:(unit Proofview.tactic * conditions) -> Names.Id.t -> EConstr.constr -> Misctypes.evars_flag -> unit Proofview.tactic
-
- val general_setoid_rewrite_clause :
- (Names.Id.t option -> orientation -> Locus.occurrences -> EConstr.constr Misctypes.with_bindings ->
- new_goals:EConstr.constr list -> unit Proofview.tactic) Hook.t
-
- val discrConcl : unit Proofview.tactic
- val rewriteLR : ?tac:(unit Proofview.tactic * conditions) -> EConstr.constr -> unit Proofview.tactic
- val rewriteRL : ?tac:(unit Proofview.tactic * conditions) -> EConstr.constr -> unit Proofview.tactic
- val general_rewrite_bindings :
- orientation -> Locus.occurrences -> freeze_evars_flag -> dep_proof_flag ->
- ?tac:(unit Proofview.tactic * conditions) -> EConstr.constr Misctypes.with_bindings -> Misctypes.evars_flag -> unit Proofview.tactic
- val discriminable : Environ.env -> Evd.evar_map -> EConstr.constr -> EConstr.constr -> bool
- val discrHyp : Names.Id.t -> unit Proofview.tactic
- val injectable : Environ.env -> Evd.evar_map -> keep_proofs:(bool option) -> EConstr.constr -> EConstr.constr -> bool
- val injHyp : inj_flags option -> Misctypes.clear_flag -> Names.Id.t -> unit Proofview.tactic
- val subst_gen : bool -> Names.Id.t list -> unit Proofview.tactic
-end
-
-module Contradiction :
-sig
- val contradiction : EConstr.constr Misctypes.with_bindings option -> unit Proofview.tactic
- val absurd : EConstr.constr -> unit Proofview.tactic
-end
-
-module Inv :
-sig
- val dinv :
- Misctypes.inversion_kind -> EConstr.constr option ->
- Tactypes.or_and_intro_pattern option -> Misctypes.quantified_hypothesis -> unit Proofview.tactic
- val inv_clause :
- Misctypes.inversion_kind -> Tactypes.or_and_intro_pattern option -> Names.Id.t list ->
- Misctypes.quantified_hypothesis -> unit Proofview.tactic
- val inv_clear_tac : Names.Id.t -> unit Proofview.tactic
- val inv_tac : Names.Id.t -> unit Proofview.tactic
- val dinv_tac : Names.Id.t -> unit Proofview.tactic
- val dinv_clear_tac : Names.Id.t -> unit Proofview.tactic
- val inv : Misctypes.inversion_kind -> Tactypes.or_and_intro_pattern option ->
- Misctypes.quantified_hypothesis -> unit Proofview.tactic
-end
-
-module Leminv :
-sig
- val lemInv_clause :
- Misctypes.quantified_hypothesis -> EConstr.constr -> Names.Id.t list -> unit Proofview.tactic
- val add_inversion_lemma_exn :
- Names.Id.t -> Constrexpr.constr_expr -> Sorts.family -> bool -> (Names.Id.t -> unit Proofview.tactic) ->
- unit
-end
-
-module Hints :
-sig
-
- type raw_hint = EConstr.t * EConstr.types * Univ.universe_context_set
-
- type 'a hint_ast =
- | Res_pf of 'a (* Hint Apply *)
- | ERes_pf of 'a (* Hint EApply *)
- | Give_exact of 'a
- | Res_pf_THEN_trivial_fail of 'a (* Hint Immediate *)
- | Unfold_nth of Names.evaluable_global_reference (* Hint Unfold *)
- | Extern of Genarg.glob_generic_argument (* Hint Extern *)
-
- type hint
-
- type debug =
- | Debug | Info | Off
-
- type 'a hints_path_atom_gen =
- | PathHints of 'a list
- | PathAny
-
- type hint_term =
- | IsGlobRef of Globnames.global_reference
- | IsConstr of EConstr.constr * Univ.ContextSet.t
-
- type hint_db_name = string
- type hint_info = (Names.Id.t list * Pattern.constr_pattern) Vernacexpr.hint_info_gen
- type hnf = bool
- type hints_path_atom = Globnames.global_reference hints_path_atom_gen
-
- type 'a hints_path_gen =
- | PathAtom of 'a hints_path_atom_gen
- | PathStar of 'a hints_path_gen
- | PathSeq of 'a hints_path_gen * 'a hints_path_gen
- | PathOr of 'a hints_path_gen * 'a hints_path_gen
- | PathEmpty
- | PathEpsilon
-
- type hints_path = Globnames.global_reference hints_path_gen
-
- type hints_entry =
- | HintsResolveEntry of (hint_info * Decl_kinds.polymorphic * hnf * hints_path_atom * hint_term) list
- | HintsImmediateEntry of (hints_path_atom * Decl_kinds.polymorphic * hint_term) list
- | HintsCutEntry of hints_path
- | HintsUnfoldEntry of Names.evaluable_global_reference list
- | HintsTransparencyEntry of Names.evaluable_global_reference list * bool
- | HintsModeEntry of Globnames.global_reference * Vernacexpr.hint_mode list
- | HintsExternEntry of hint_info * Genarg.glob_generic_argument
-
- type 'a with_metadata = private {
- pri : int;
- poly : Decl_kinds.polymorphic;
- pat : Pattern.constr_pattern option;
- name : hints_path_atom;
- db : string option;
- secvars : Names.Id.Pred.t;
- code : 'a;
- }
- type full_hint = hint with_metadata
-
- module Hint_db :
- sig
- type t
- val empty : ?name:hint_db_name -> Names.transparent_state -> bool -> t
- val transparent_state : t -> Names.transparent_state
- val iter : (Globnames.global_reference option ->
- Vernacexpr.hint_mode array list -> full_hint list -> unit) -> t -> unit
- end
- type hint_db = Hint_db.t
-
- val add_hints : bool -> hint_db_name list -> hints_entry -> unit
- val searchtable_map : hint_db_name -> hint_db
- val pp_hints_path_atom : ('a -> Pp.t) -> 'a hints_path_atom_gen -> Pp.t
- val pp_hints_path_gen : ('a -> Pp.t) -> 'a hints_path_gen -> Pp.t
- val glob_hints_path_atom :
- Libnames.reference hints_path_atom_gen -> Globnames.global_reference hints_path_atom_gen
- val pp_hints_path : hints_path -> Pp.t
- val glob_hints_path :
- Libnames.reference hints_path_gen -> Globnames.global_reference hints_path_gen
- val run_hint : hint ->
- ((raw_hint * Clenv.clausenv) hint_ast -> 'r Proofview.tactic) -> 'r Proofview.tactic
- val typeclasses_db : hint_db_name
- val add_hints_init : (unit -> unit) -> unit
- val create_hint_db : bool -> hint_db_name -> Names.transparent_state -> bool -> unit
- val empty_hint_info : 'a Vernacexpr.hint_info_gen
- val repr_hint : hint -> (raw_hint * Clenv.clausenv) hint_ast
- val pr_hint_db : Hint_db.t -> Pp.t
-end
-
-module Auto :
-sig
- val default_auto : unit Proofview.tactic
- val full_trivial : ?debug:Hints.debug ->
- Tactypes.delayed_open_constr list -> unit Proofview.tactic
- val h_auto : ?debug:Hints.debug ->
- int option -> Tactypes.delayed_open_constr list -> Hints.hint_db_name list option -> unit Proofview.tactic
- val h_trivial : ?debug:Hints.debug ->
- Tactypes.delayed_open_constr list -> Hints.hint_db_name list option -> unit Proofview.tactic
- val new_full_auto : ?debug:Hints.debug ->
- int -> Tactypes.delayed_open_constr list -> unit Proofview.tactic
- val full_auto : ?debug:Hints.debug ->
- int -> Tactypes.delayed_open_constr list -> unit Proofview.tactic
- val new_auto : ?debug:Hints.debug ->
- int -> Tactypes.delayed_open_constr list -> Hints.hint_db_name list -> unit Proofview.tactic
- val default_full_auto : unit Proofview.tactic
-end
-
-module Eauto :
-sig
- val e_assumption : unit Proofview.tactic
- val e_give_exact : ?flags:Unification.unify_flags -> EConstr.constr -> unit Proofview.tactic
- val prolog_tac : Tactypes.delayed_open_constr list -> int -> unit Proofview.tactic
- val make_dimension : int option -> int option -> bool * int
- val gen_eauto : ?debug:Hints.debug -> bool * int -> Tactypes.delayed_open_constr list ->
- Hints.hint_db_name list option -> unit Proofview.tactic
- val autounfold_tac : Hints.hint_db_name list option -> Locus.clause -> unit Proofview.tactic
- val autounfold_one : Hints.hint_db_name list -> Locus.hyp_location option -> unit Proofview.tactic
- val eauto_with_bases :
- ?debug:Hints.debug -> bool * int -> Tactypes.delayed_open_constr list -> Hints.hint_db list -> Proof_type.tactic
-end
-
-module Class_tactics :
-sig
-
- type search_strategy =
- | Dfs
- | Bfs
-
- val set_typeclasses_debug : bool -> unit
- val set_typeclasses_strategy : search_strategy -> unit
- val set_typeclasses_depth : int option -> unit
- val typeclasses_eauto : ?only_classes:bool -> ?st:Names.transparent_state -> ?strategy:search_strategy ->
- depth:(Int.t option) ->
- Hints.hint_db_name list -> unit Proofview.tactic
- val head_of_constr : Names.Id.t -> EConstr.constr -> unit Proofview.tactic
- val not_evar : EConstr.constr -> unit Proofview.tactic
- val is_ground : EConstr.constr -> unit Proofview.tactic
- val autoapply : EConstr.constr -> Hints.hint_db_name -> unit Proofview.tactic
- val catchable : exn -> bool
-end
-
-module Eqdecide :
-sig
- val compare : EConstr.constr -> EConstr.constr -> unit Proofview.tactic
- val decideEqualityGoal : unit Proofview.tactic
-end
-
-module Autorewrite :
-sig
- type rew_rule = { rew_lemma: Constr.t;
- rew_type: Term.types;
- rew_pat: Constr.t;
- rew_ctx: Univ.ContextSet.t;
- rew_l2r: bool;
- rew_tac: Genarg.glob_generic_argument option }
- type raw_rew_rule = (Constr.t Univ.in_universe_context_set * bool *
- Genarg.raw_generic_argument option)
- Loc.located
- val auto_multi_rewrite : ?conds:Equality.conditions -> string list -> Locus.clause -> unit Proofview.tactic
- val auto_multi_rewrite_with : ?conds:Equality.conditions -> unit Proofview.tactic -> string list -> Locus.clause -> unit Proofview.tactic
- val add_rew_rules : string -> raw_rew_rule list -> unit
- val find_rewrites : string -> rew_rule list
- val find_matches : string -> Constr.t -> rew_rule list
- val print_rewrite_hintdb : string -> Pp.t
-end
-
-(************************************************************************)
-(* End of modules from tactics/ *)
-(************************************************************************)
-
-(************************************************************************)
-(* Modules from vernac/ *)
-(************************************************************************)
-
-module Ppvernac :
-sig
- val pr_vernac : Vernacexpr.vernac_expr -> Pp.t
- val pr_rec_definition : (Vernacexpr.fixpoint_expr * Vernacexpr.decl_notation list) -> Pp.t
-end
-
-module Lemmas :
-sig
-
- type 'a declaration_hook
-
- val mk_hook :
- (Decl_kinds.locality -> Globnames.global_reference -> 'a) -> 'a declaration_hook
- val start_proof : Names.Id.t -> ?pl:Univdecls.universe_decl -> Decl_kinds.goal_kind -> Evd.evar_map ->
- ?terminator:(Proof_global.lemma_possible_guards -> unit declaration_hook -> Proof_global.proof_terminator) ->
- ?sign:Environ.named_context_val -> EConstr.types ->
- ?init_tac:unit Proofview.tactic -> ?compute_guard:Proof_global.lemma_possible_guards ->
- unit declaration_hook -> unit
- val call_hook :
- Future.fix_exn -> 'a declaration_hook -> Decl_kinds.locality -> Globnames.global_reference -> 'a
- val save_proof : ?proof:Proof_global.closed_proof -> Vernacexpr.proof_end -> unit
- val get_current_context : unit -> Evd.evar_map * Environ.env
-end
-
-module Himsg :
-sig
- val explain_refiner_error : Logic.refiner_error -> Pp.t
- val explain_pretype_error : Environ.env -> Evd.evar_map -> Pretype_errors.pretype_error -> Pp.t
-end
-
-module ExplainErr :
-sig
- val process_vernac_interp_error : ?allow_uncaught:bool -> Util.iexn -> Util.iexn
- val register_additional_error_info : (Util.iexn -> Pp.t option Loc.located option) -> unit
-end
-
-module Locality :
-sig
- val make_section_locality : bool option -> bool
- module LocalityFixme : sig
- val consume : unit -> bool option
- end
- val make_module_locality : bool option -> bool
-end
-
-module Metasyntax :
-sig
-
- val add_token_obj : string -> unit
-
- type any_entry = AnyEntry : 'a Pcoq.Gram.entry -> any_entry
- val register_grammar : string -> any_entry list -> unit
-
-end
-
-module Search :
-sig
- type glob_search_about_item =
- | GlobSearchSubPattern of Pattern.constr_pattern
- | GlobSearchString of string
- type filter_function = Globnames.global_reference -> Environ.env -> Constr.t -> bool
- type display_function = Globnames.global_reference -> Environ.env -> Constr.t -> unit
- val search_about_filter : glob_search_about_item -> filter_function
- val module_filter : Names.DirPath.t list * bool -> filter_function
- val generic_search : int option -> display_function -> unit
-end
-
-module Obligations :
-sig
- val default_tactic : unit Proofview.tactic ref
- val obligation : int * Names.Id.t option * Constrexpr.constr_expr option ->
- Genarg.glob_generic_argument option -> unit
- val next_obligation : Names.Id.t option -> Genarg.glob_generic_argument option -> unit
- val try_solve_obligation : int -> Names.Id.t option -> unit Proofview.tactic option -> unit
- val try_solve_obligations : Names.Id.t option -> unit Proofview.tactic option -> unit
- val solve_all_obligations : unit Proofview.tactic option -> unit
- val admit_obligations : Names.Id.t option -> unit
- val show_obligations : ?msg:bool -> Names.Id.t option -> unit
- val show_term : Names.Id.t option -> Pp.t
-end
-
-module Command :
-sig
- open Names
- open Constrexpr
- open Vernacexpr
-
- type structured_fixpoint_expr = {
- fix_name : Id.t;
- fix_univs : universe_decl_expr option;
- fix_annot : Id.t Loc.located option;
- fix_binders : local_binder_expr list;
- fix_body : constr_expr option;
- fix_type : constr_expr
- }
-
- type structured_one_inductive_expr = {
- ind_name : Id.t;
- ind_univs : universe_decl_expr option;
- ind_arity : constr_expr;
- ind_lc : (Id.t * constr_expr) list
- }
-
- type structured_inductive_expr =
- local_binder_expr list * structured_one_inductive_expr list
-
- type recursive_preentry = Names.Id.t list * Constr.t option list * Constr.types list
-
- type one_inductive_impls
-
- val do_mutual_inductive :
- (Vernacexpr.one_inductive_expr * Vernacexpr.decl_notation list) list -> Decl_kinds.cumulative_inductive_flag -> Decl_kinds.polymorphic ->
- Decl_kinds.private_flag -> Decl_kinds.recursivity_kind -> unit
-
- val do_definition : Names.Id.t -> Decl_kinds.definition_kind -> Vernacexpr.universe_decl_expr option ->
- Constrexpr.local_binder_expr list -> Redexpr.red_expr option -> Constrexpr.constr_expr ->
- Constrexpr.constr_expr option -> unit Lemmas.declaration_hook -> unit
-
- val do_fixpoint :
- Decl_kinds.locality -> Decl_kinds.polymorphic -> (Vernacexpr.fixpoint_expr * Vernacexpr.decl_notation list) list -> unit
-
- val extract_fixpoint_components : bool ->
- (Vernacexpr.fixpoint_expr * Vernacexpr.decl_notation list) list ->
- structured_fixpoint_expr list * Vernacexpr.decl_notation list
-
- val interp_fixpoint :
- structured_fixpoint_expr list -> Vernacexpr.decl_notation list ->
- recursive_preentry * Univdecls.universe_decl * UState.t *
- (EConstr.rel_context * Impargs.manual_implicits * int option) list
-
- val extract_mutual_inductive_declaration_components :
- (Vernacexpr.one_inductive_expr * Vernacexpr.decl_notation list) list ->
- structured_inductive_expr * Libnames.qualid list * Vernacexpr.decl_notation list
-
- val interp_mutual_inductive :
- structured_inductive_expr -> Vernacexpr.decl_notation list ->
- Decl_kinds.cumulative_inductive_flag ->
- Decl_kinds.polymorphic ->
- Decl_kinds.private_flag -> Decl_kinds.recursivity_kind ->
- Entries.mutual_inductive_entry * Universes.universe_binders * one_inductive_impls list
-
- val declare_mutual_inductive_with_eliminations :
- Entries.mutual_inductive_entry -> Universes.universe_binders -> one_inductive_impls list ->
- Names.MutInd.t
-end
-
-module Classes :
-sig
- val set_typeclass_transparency : Names.evaluable_global_reference -> bool -> bool -> unit
- val new_instance :
- ?abstract:bool ->
- ?global:bool ->
- ?refine:bool ->
- Decl_kinds.polymorphic ->
- Constrexpr.local_binder_expr list ->
- Vernacexpr.typeclass_constraint ->
- (bool * Constrexpr.constr_expr) option ->
- ?generalize:bool ->
- ?tac:unit Proofview.tactic ->
- ?hook:(Globnames.global_reference -> unit) ->
- Vernacexpr.hint_info_expr ->
- Names.Id.t
-end
-
-module Vernacinterp :
-sig
- type deprecation = bool
-
- type vernac_command = Genarg.raw_generic_argument list -> Loc.t option -> unit
-
- val vinterp_add : deprecation -> Vernacexpr.extend_name ->
- vernac_command -> unit
-
-end
-
-module Mltop :
-sig
- val declare_cache_obj : (unit -> unit) -> string -> unit
- val add_known_plugin : (unit -> unit) -> string -> unit
- val add_known_module : string -> unit
- val module_is_known : string -> bool
-end
-
-module Topfmt :
-sig
- val std_ft : Format.formatter ref
- val with_output_to : out_channel -> Format.formatter
- val get_margin : unit -> int option
-end
-
-module Vernacentries :
-sig
-
- type interp_state = { (* TODO: inline records in OCaml 4.03 *)
- system : States.state; (* summary + libstack *)
- proof : Proof_global.state; (* proof state *)
- shallow : bool (* is the state trimmed down (libstack) *)
- }
-
- val freeze_interp_state : Summary.marshallable -> interp_state
- val unfreeze_interp_state : interp_state -> unit
-
- val dump_global : Libnames.reference Misctypes.or_by_notation -> unit
- val interp_redexp_hook : (Environ.env -> Evd.evar_map -> Genredexpr.raw_red_expr ->
- Evd.evar_map * Redexpr.red_expr) Hook.t
- val command_focus : unit Proof.focus_kind
-end
-
-(************************************************************************)
-(* End of modules from vernac/ *)
-(************************************************************************)
-
-(************************************************************************)
-(* Modules from stm/ *)
-(************************************************************************)
-
-module Vernac_classifier :
-sig
- val declare_vernac_classifier :
- Vernacexpr.extend_name -> (Genarg.raw_generic_argument list -> unit -> Vernacexpr.vernac_classification) -> unit
- val classify_as_proofstep : Vernacexpr.vernac_classification
- val classify_as_query : Vernacexpr.vernac_classification
- val classify_as_sideeff : Vernacexpr.vernac_classification
- val classify_vernac : Vernacexpr.vernac_expr -> Vernacexpr.vernac_classification
-end
-
-module Stm :
-sig
- type doc
-
- val get_doc : Feedback.doc_id -> doc
-
- val state_of_id : doc:doc ->
- Stateid.t -> [ `Valid of Vernacentries.interp_state option | `Expired | `Error of exn ]
-end
-
-(************************************************************************)
-(* End of modules from stm/ *)
-(************************************************************************)
diff --git a/API/API.mllib b/API/API.mllib
deleted file mode 100644
index 25275c704..000000000
--- a/API/API.mllib
+++ /dev/null
@@ -1 +0,0 @@
-API
diff --git a/API/PROPERTIES b/API/PROPERTIES
deleted file mode 100644
index cd942e202..000000000
--- a/API/PROPERTIES
+++ /dev/null
@@ -1,8 +0,0 @@
-0 : All API elements, i.e.:
- - modules
- - module types
- - functions & values
- - types
- are present if and only if are needed for implementing Coq plugins.
-
-1 : Individual API elements are not aliased.
diff --git a/CHANGES b/CHANGES
index 7a326c589..cb4b966b0 100644
--- a/CHANGES
+++ b/CHANGES
@@ -7,6 +7,20 @@ Notations
right (e.g. "( x ; .. ; y ; z )") now supported.
- Notations with a specific level for the leftmost nonterminal,
when printing-only, are supported.
+- When several notations are available for the same expression,
+ priority is given to latest notations defined in the scopes being
+ opened rather than to the latest notations defined independently of
+ whether they are in an opened scope or not.
+
+Specification language
+
+- When printing clauses of a "match", clauses with same right-hand
+ side are factorized and the last most factorized clause with no
+ variables, if it exists, is turned into a default clause.
+ Use "Unset Printing Allow Default Clause" do deactivate printing
+ of a default clause.
+ Use "Unset Printing Factorizable Match Patterns" to deactivate
+ factorization of clauses with same right-hand side.
Tactics
@@ -20,6 +34,63 @@ Tactics
- The tactic "romega" is also aware now of the bodies of context variables.
- Tactic "decide equality" now able to manage constructors which
contain proofs.
+- Added tactics reset ltac profile, show ltac profile (and variants)
+- Added tactics restart_timer, finish_timing, and time_constr as an
+ experimental way of timing Ltac's evaluation phase
+- Added tactic optimize_heap, analogous to the Vernacular Optimize
+ Heap, which performs a major garbage collection and heap compaction
+ in the OCaml run-time system.
+- The tactics "dtauto", "dintuition", "firstorder" now handle inductive types
+ with let bindings in the parameters.
+- The tactic "dtauto" now handles some inductives such as
+ "@sigT A (fun _ => B)" as non-dependent conjunctions.
+
+Focusing
+
+- Focusing bracket `{` now supports single-numbered goal selector,
+ e.g. `2: {` will focus on the second sub-goal. As usual, unfocus
+ with `}` once the sub-goal is fully solved.
+
+Vernacular Commands
+
+- Proofs ending in "Qed exporting ident, .., ident" are not supported
+ anymore. Constants generated during `abstract` are kept private to the
+ local environment.
+- The deprecated Coercion Local, Open Local Scope, Notation Local syntax
+ was removed. Use Local as a prefix instead.
+- For the Extraction Language command, "OCaml" is spelled correctly.
+ The older "Ocaml" is still accepted, but deprecated.
+
+Universes
+
+- Qualified naming of global universes now works like other namespaced
+ objects (e.g. constants), with a separate namespace, inside and across
+ module and library boundaries. Global universe names introduced in an
+ inductive / constant / Let declaration get qualified with the name of
+ the declaration.
+
+Checker
+
+- The checker now accepts filenames in addition to logical paths.
+
+CoqIDE
+
+- Find and Replace All report the number of occurrences found; Find indicates
+ when it wraps.
+
+Documentation
+
+- The Coq FAQ, formerly located at https://coq.inria.fr/faq, has been
+ moved to the GitHub wiki section of this repository; the main entry
+ page is https://github.com/coq/coq/wiki/The-Coq-FAQ.
+
+Changes from 8.7.0 to 8.7.1
+===========================
+
+Compatibility with OCaml 4.06.0.
+
+Many bug fixes, documentation improvements, and user message improvements (for
+details see the 8.7.1 milestone at https://github.com/coq/coq/milestone/10?closed=1).
Changes from 8.7+beta2 to 8.7.0
===============================
@@ -247,7 +318,7 @@ Changes from 8.6 to 8.6.1
- Fix bug 5550: "typeclasses eauto with" does not work with section variables.
- Bug 5546, qualify datatype constructors when needed in Show Match
- Bug #5535, test for Show with -emacs
-- Fix bug #5486, don't reverse ids in tuples
+- Fix bug #5486, don't reverse ids in tuples
- Fixing #5522 (anomaly with free vars of pat)
- Fix bug #5526, don't check for nonlinearity in notation if printing only
- Fix bug #5255
@@ -269,7 +340,7 @@ Changes from 8.6 to 8.6.1
- show unused intro pattern warning
- [future] Be eager when "chaining" already resolved future values.
- Opaque side effects
-- Fix #5132: coq_makefile generates incorrect install goal
+- Fix #5132: coq_makefile generates incorrect install goal
- Run non-tactic comands without resilient_command
- Univs: fix bug #5365, generation of u+k <= v constraints
- make `emit' tail recursive
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index db02f7834..1a769333c 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -28,6 +28,8 @@ Please make pull requests against the `master` branch.
It's helpful to run the Coq test suite with `make test-suite` before submitting your change. Travis CI runs this test suite and a much larger one including external Coq developments on every pull request, but these results take significantly longer to come back (on the order of a few hours). Running the test suite locally will take somewhere around 10-15 minutes. Refer to [`dev/ci/README.md`](/dev/ci/README.md#information-for-developers) for more information on Travis CI tests.
+If your pull request fixes a bug, please consider adding a regression test as well. See [`test-suite/README.md`](/test-suite/README.md) for how to do so.
+
Don't be alarmed if the pull request process takes some time. It can take a few days to get feedback, approval on the final changes, and then a merge. Coq doesn't release new versions very frequently so it can take a few months for your change to land in a released version. That said, you can start using the latest Coq `master` branch to take advantage of all the new features, improvements, and fixes.
Here are a few tags Coq developers may add to your PR and what they mean. In general feedback and requests for you as the pull request author will be in the comments and tags are only used to organize pull requests.
@@ -36,6 +38,10 @@ Here are a few tags Coq developers may add to your PR and what they mean. In gen
- [needs: fixing](https://github.com/coq/coq/pulls?q=is%3Aopen+is%3Apr+label%3A%22needs%3A+fixing%22) indicates the PR needs a fix, as discussed in the comments.
- [needs: testing](https://github.com/coq/coq/pulls?q=is%3Aopen+is%3Apr+label%3A%22needs%3A+testing%22) indicates the PR needs testing. This is often used when testing beyond what the test suite can handle is required. For example, performance benchmarking is currently performed with a different infrastructure. Unless some followup is specifically requested you aren't expected to do this additional testing.
+The release manager uses the following filter to know which PRs seem ready for merge. If you are waiting for a PR to be merged, make sure it appears in this list:
+
+- [Pull requests ready for merge](https://github.com/coq/coq/pulls?utf8=%E2%9C%93&q=is%3Apr%20is%3Aopen%20-label%3A%22needs%3A%20discussion%22%20-label%3A%22needs%3A%20testing%22%20-label%3A%22needs%3A%20fixing%22%20-label%3A%22needs%3A%20progress%22%20-label%3A%22needs%3A%20rebase%22%20-label%3A%22needs%3A%20review%22%20-label%3A%22needs%3A%20help%22%20-label%3A%22needs%3A%20independent%20fix%22%20-label%3A%22needs%3A%20feedback%22%20-label%3A%22help%20wanted%22%20-review%3Achanges_requested%20-status%3Apending%20base%3Amaster%20sort%3Aupdated-asc%20-label%3A%22needs%3A%20squashing%22%20)
+
## Documentation
Currently the process for contributing to the documentation is the same as for changing anything else in Coq, so please submit a pull request as described above.
@@ -44,6 +50,8 @@ Our issue tracker includes a flag to mark bugs related to documentation. You can
The sources for the [Coq reference manual](https://coq.inria.fr/distrib/current/refman/) are at [`doc/refman`](/doc/refman). These are written in LaTeX and compiled to HTML with [HeVeA](http://hevea.inria.fr/).
+You may also contribute to the informal documentation available in [Cocorico](https://github.com/coq/coq/wiki) (the Coq wiki), and the [Coq FAQ](https://github.com/coq/coq/wiki/The-Coq-FAQ). Both of these are editable by anyone with a GitHub account.
+
## Contributing outside this repository
There are many useful ways to contribute to the Coq ecosystem that don't involve the Coq repository.
diff --git a/INSTALL b/INSTALL
index faac79f18..3b3fd8b83 100644
--- a/INSTALL
+++ b/INSTALL
@@ -43,7 +43,7 @@ WHAT DO YOU NEED ?
- a C compiler
- for Coqide, the Lablgtk development files, and the GTK libraries
- incuding gtksourceview, see INSTALL.ide for more details
+ including gtksourceview, see INSTALL.ide for more details
Opam (https://opam.ocaml.org/) is recommended to install ocaml and
the corresponding packages.
diff --git a/INSTALL.ide b/INSTALL.ide
index 513e37c91..26c192baa 100644
--- a/INSTALL.ide
+++ b/INSTALL.ide
@@ -39,7 +39,7 @@ COMPILATION REQUIREMENTS
install GTK+ 2.x, should you need to force it for one reason
or another.)
- The OCaml bindings for GTK+ 2.x, lablgtk2 with support for gtksourceview2.
- You need at least version 2.16.
+ You need at least version 2.18.3.
Your distribution may contain precompiled packages. For example, for
Debian, run
@@ -57,7 +57,7 @@ COMPILATION REQUIREMENTS
./configure && make world && make install
You must have write access to the OCaml standard library path.
- If this fails, read lablgtk-2.14.2/README.
+ If this fails, read the README.
INSTALLATION
diff --git a/META.coq b/META.coq
index 27aeac61b..d180820e8 100644
--- a/META.coq
+++ b/META.coq
@@ -23,20 +23,28 @@ package "config" (
)
+package "clib" (
+ description = "Base General Coq Library"
+ version = "8.7"
+
+ directory = "clib"
+ requires = "str, unix, threads"
+
+ archive(byte) = "clib.cma"
+ archive(native) = "clib.cmxa"
+)
+
package "lib" (
- description = "Base Coq Library"
+ description = "Base Coq-Specific Library"
version = "8.7"
directory = "lib"
- requires = "coq.config"
+ requires = "coq.clib, coq.config"
- archive(byte) = "clib.cma"
- archive(byte) += "lib.cma"
-
- archive(native) = "clib.cmxa"
- archive(native) += "lib.cmxa"
+ archive(byte) = "lib.cma"
+ archive(native) = "lib.cmxa"
)
@@ -47,13 +55,17 @@ package "vm" (
directory = "kernel/byterun"
-# We should generate this file at configure time for local byte builds
-# to work properly.
-
-# Enable this setting for local byte builds, disabling the one below.
+# We could generate this file at configure time for the share byte
+# build path to work properly.
+#
+# Enable this setting for local byte builds if you want dynamic linking:
+#
# linkopts(byte) = "-dllpath path_to_coq/kernel/byterun/ -dllib -lcoqrun"
- linkopts(byte) = "-dllib -lcoqrun"
+# We currently prefer static linking of the VM.
+ archive(byte) = "libcoqrun.a"
+ linkopts(byte) = "-custom"
+
linkopts(native) = "-cclib -lcoqrun"
)
@@ -65,7 +77,7 @@ package "kernel" (
directory = "kernel"
- requires = "coq.lib, coq.vm"
+ requires = "dynlink, coq.lib, coq.vm"
archive(byte) = "kernel.cma"
archive(native) = "kernel.cmxa"
@@ -168,7 +180,7 @@ package "parsing" (
description = "Coq Parsing Engine"
version = "8.7"
- requires = "coq.proofs"
+ requires = "camlp5.gramlib, coq.proofs"
directory = "parsing"
archive(byte) = "parsing.cma"
@@ -228,32 +240,6 @@ package "stm" (
)
-package "API" (
-
- description = "Coq API"
- version = "8.7"
-
- requires = "coq.stm"
- directory = "API"
-
- archive(byte) = "API.cma"
- archive(native) = "API.cmxa"
-
-)
-
-package "ltac" (
-
- description = "Coq LTAC Plugin"
- version = "8.7"
-
- requires = "coq.API"
- directory = "plugins/ltac"
-
- archive(byte) = "ltac_plugin.cmo"
- archive(native) = "ltac_plugin.cmx"
-
-)
-
package "toplevel" (
description = "Coq Toplevel"
@@ -294,3 +280,300 @@ package "ide" (
archive(native) = "ide.cmxa"
)
+
+package "plugins" (
+
+ description = "Coq built-in plugins"
+ version = "8.7"
+
+ directory = "plugins"
+
+ package "ltac" (
+
+ description = "Coq LTAC Plugin"
+ version = "8.7"
+
+ requires = "coq.stm"
+ directory = "ltac"
+
+ archive(byte) = "ltac_plugin.cmo"
+ archive(native) = "ltac_plugin.cmx"
+
+ )
+
+ package "tauto" (
+
+ description = "Coq tauto plugin"
+ version = "8.7"
+
+ requires = "coq.plugins.ltac"
+ directory = "ltac"
+
+ archive(byte) = "tauto_plugin.cmo"
+ archive(native) = "tauto_plugin.cmx"
+ )
+
+ package "omega" (
+
+ description = "Coq omega plugin"
+ version = "8.7"
+
+ requires = "coq.plugins.ltac"
+ directory = "omega"
+
+ archive(byte) = "omega_plugin.cmo"
+ archive(native) = "omega_plugin.cmx"
+ )
+
+ package "romega" (
+
+ description = "Coq romega plugin"
+ version = "8.7"
+
+ requires = "coq.plugins.omega"
+ directory = "romega"
+
+ archive(byte) = "romega_plugin.cmo"
+ archive(native) = "romega_plugin.cmx"
+ )
+
+ package "micromega" (
+
+ description = "Coq micromega plugin"
+ version = "8.7"
+
+ requires = "num,coq.plugins.ltac"
+ directory = "micromega"
+
+ archive(byte) = "micromega_plugin.cmo"
+ archive(native) = "micromega_plugin.cmx"
+ )
+
+ package "quote" (
+
+ description = "Coq quote plugin"
+ version = "8.7"
+
+ requires = "coq.plugins.ltac"
+ directory = "quote"
+
+ archive(byte) = "quote_plugin.cmo"
+ archive(native) = "quote_plugin.cmx"
+ )
+
+ package "newring" (
+
+ description = "Coq newring plugin"
+ version = "8.7"
+
+ requires = "coq.plugins.quote"
+ directory = "setoid_ring"
+
+ archive(byte) = "newring_plugin.cmo"
+ archive(native) = "newring_plugin.cmx"
+ )
+
+ package "fourier" (
+
+ description = "Coq fourier plugin"
+ version = "8.7"
+
+ requires = "coq.plugins.ltac"
+ directory = "fourier"
+
+ archive(byte) = "fourier_plugin.cmo"
+ archive(native) = "fourier_plugin.cmx"
+ )
+
+ package "extraction" (
+
+ description = "Coq extraction plugin"
+ version = "8.7"
+
+ requires = "coq.plugins.ltac"
+ directory = "extraction"
+
+ archive(byte) = "extraction_plugin.cmo"
+ archive(native) = "extraction_plugin.cmx"
+ )
+
+ package "cc" (
+
+ description = "Coq cc plugin"
+ version = "8.7"
+
+ requires = "coq.plugins.ltac"
+ directory = "cc"
+
+ archive(byte) = "cc_plugin.cmo"
+ archive(native) = "cc_plugin.cmx"
+ )
+
+ package "ground" (
+
+ description = "Coq ground plugin"
+ version = "8.7"
+
+ requires = "coq.plugins.ltac"
+ directory = "firstorder"
+
+ archive(byte) = "ground_plugin.cmo"
+ archive(native) = "ground_plugin.cmx"
+ )
+
+ package "rtauto" (
+
+ description = "Coq rtauto plugin"
+ version = "8.7"
+
+ requires = "coq.plugins.ltac"
+ directory = "rtauto"
+
+ archive(byte) = "rtauto_plugin.cmo"
+ archive(native) = "rtauto_plugin.cmx"
+ )
+
+ package "btauto" (
+
+ description = "Coq btauto plugin"
+ version = "8.7"
+
+ requires = "coq.plugins.ltac"
+ directory = "btauto"
+
+ archive(byte) = "btauto_plugin.cmo"
+ archive(native) = "btauto_plugin.cmx"
+ )
+
+ package "recdef" (
+
+ description = "Coq recdef plugin"
+ version = "8.7"
+
+ requires = "coq.plugins.extraction"
+ directory = "funind"
+
+ archive(byte) = "recdef_plugin.cmo"
+ archive(native) = "recdef_plugin.cmx"
+ )
+
+ package "nsatz" (
+
+ description = "Coq nsatz plugin"
+ version = "8.7"
+
+ requires = "num,coq.plugins.ltac"
+ directory = "nsatz"
+
+ archive(byte) = "nsatz_plugin.cmo"
+ archive(native) = "nsatz_plugin.cmx"
+ )
+
+ package "natsyntax" (
+
+ description = "Coq natsyntax plugin"
+ version = "8.7"
+
+ requires = ""
+ directory = "syntax"
+
+ archive(byte) = "nat_syntax_plugin.cmo"
+ archive(native) = "nat_syntax_plugin.cmx"
+ )
+
+ package "zsyntax" (
+
+ description = "Coq zsyntax plugin"
+ version = "8.7"
+
+ requires = ""
+ directory = "syntax"
+
+ archive(byte) = "z_syntax_plugin.cmo"
+ archive(native) = "z_syntax_plugin.cmx"
+ )
+
+ package "rsyntax" (
+
+ description = "Coq rsyntax plugin"
+ version = "8.7"
+
+ requires = ""
+ directory = "syntax"
+
+ archive(byte) = "r_syntax_plugin.cmo"
+ archive(native) = "r_syntax_plugin.cmx"
+ )
+
+ package "int31syntax" (
+
+ description = "Coq int31syntax plugin"
+ version = "8.7"
+
+ requires = ""
+ directory = "syntax"
+
+ archive(byte) = "int31_syntax_plugin.cmo"
+ archive(native) = "int31_syntax_plugin.cmx"
+ )
+
+ package "asciisyntax" (
+
+ description = "Coq asciisyntax plugin"
+ version = "8.7"
+
+ requires = ""
+ directory = "syntax"
+
+ archive(byte) = "ascii_syntax_plugin.cmo"
+ archive(native) = "ascii_syntax_plugin.cmx"
+ )
+
+ package "stringsyntax" (
+
+ description = "Coq stringsyntax plugin"
+ version = "8.7"
+
+ requires = "coq.plugins.asciisyntax"
+ directory = "syntax"
+
+ archive(byte) = "string_syntax_plugin.cmo"
+ archive(native) = "string_syntax_plugin.cmx"
+ )
+
+ package "derive" (
+
+ description = "Coq derive plugin"
+ version = "8.7"
+
+ requires = ""
+ directory = "derive"
+
+ archive(byte) = "derive_plugin.cmo"
+ archive(native) = "derive_plugin.cmx"
+ )
+
+ package "ssrmatching" (
+
+ description = "Coq ssrmatching plugin"
+ version = "8.7"
+
+ requires = "coq.plugins.ltac"
+ directory = "ssrmatching"
+
+ archive(byte) = "ssrmatching_plugin.cmo"
+ archive(native) = "ssrmatching_plugin.cmx"
+ )
+
+ package "ssreflect" (
+
+ description = "Coq ssreflect plugin"
+ version = "8.7"
+
+ requires = "coq.plugins.ssrmatching"
+ directory = "ssr"
+
+ archive(byte) = "ssreflect_plugin.cmo"
+ archive(native) = "ssreflect_plugin.cmx"
+ )
+)
diff --git a/Makefile b/Makefile
index 4786e0f7c..3e8e49c31 100644
--- a/Makefile
+++ b/Makefile
@@ -15,7 +15,7 @@
# You won't find Makefiles in sub-directories and this is done on purpose.
# If you are not yet convinced of the advantages of a single Makefile, please
# read
-# http://miller.emu.id.au/pmiller/books/rmch/
+# http://aegis.sourceforge.net/auug97.pdf
# before complaining.
#
# When you are working in a subdir, you can compile without moving to the
@@ -87,7 +87,7 @@ EXISTINGMLI := $(call find, '*.mli')
## Files that will be generated
GENML4FILES:= $(ML4FILES:.ml4=.ml)
-export GENMLFILES:=$(LEXFILES:.mll=.ml) tools/tolink.ml kernel/copcodes.ml
+export GENMLFILES:=$(LEXFILES:.mll=.ml) kernel/copcodes.ml
export GENHFILES:=kernel/byterun/coq_jumptbl.h
export GENFILES:=$(GENMLFILES) $(GENMLIFILES) $(GENHFILES)
@@ -139,19 +139,10 @@ endif
# This should help preventing weird compilation failures caused by leftover
# compiled files after deleting or moving some source files.
-ifeq (,$(findstring clean,$(MAKECMDGOALS))) # Skip this for 'make clean' and alii
-ifndef ACCEPT_ALIEN_VO
EXISTINGVO:=$(call find, '*.vo')
KNOWNVO:=$(patsubst %.v,%.vo,$(call find, '*.v'))
ALIENVO:=$(filter-out $(KNOWNVO),$(EXISTINGVO))
-ifdef ALIENVO
-$(error Leftover compiled Coq files without known sources: $(ALIENVO); \
-remove them first, for instance via 'make voclean' \
-(or skip this check via 'make ACCEPT_ALIEN_VO=1'))
-endif
-endif
-ifndef ACCEPT_ALIEN_OBJ
EXISTINGOBJS:=$(call find, '*.cm[oxia]' -o -name '*.cmxa')
KNOWNML:=$(EXISTINGML) $(GENMLFILES) $(GENML4FILES) $(MLPACKFILES:.mlpack=.ml) \
$(patsubst %.mlp,%.ml,$(wildcard grammar/*.mlp))
@@ -159,9 +150,20 @@ KNOWNOBJS:=$(KNOWNML:.ml=.cmo) $(KNOWNML:.ml=.cmx) $(KNOWNML:.ml=.cmi) \
$(MLIFILES:.mli=.cmi) \
$(MLLIBFILES:.mllib=.cma) $(MLLIBFILES:.mllib=.cmxa) grammar/grammar.cma
ALIENOBJS:=$(filter-out $(KNOWNOBJS),$(EXISTINGOBJS))
+
+ifeq (,$(findstring clean,$(MAKECMDGOALS))) # Skip this for 'make clean' and alii
+ifndef ACCEPT_ALIEN_VO
+ifdef ALIENVO
+$(error Leftover compiled Coq files without known sources: $(ALIENVO); \
+remove them first, for instance via 'make voclean' or 'make alienclean' \
+(or skip this check via 'make ACCEPT_ALIEN_VO=1'))
+endif
+endif
+
+ifndef ACCEPT_ALIEN_OBJ
ifdef ALIENOBJS
$(error Leftover compiled OCaml files without known sources: $(ALIENOBJS); \
-remove them first, for instance via 'make clean' \
+remove them first, for instance via 'make clean' or 'make alienclean' \
(or skip this check via 'make ACCEPT_ALIEN_OBJ=1'))
endif
endif
@@ -196,7 +198,7 @@ Makefile $(wildcard Makefile.*) config/Makefile : ;
# Cleaning
###########################################################################
-.PHONY: clean cleankeepvo objclean cruftclean indepclean docclean archclean optclean clean-ide ml4clean depclean cleanconfig distclean voclean timingclean devdocclean
+.PHONY: clean cleankeepvo objclean cruftclean indepclean docclean archclean optclean clean-ide ml4clean depclean cleanconfig distclean voclean timingclean devdocclean alienclean
clean: objclean cruftclean depclean docclean devdocclean
@@ -231,8 +233,7 @@ docclean:
doc/stdlib/*Library.coqdoc.tex doc/stdlib/library.files \
doc/stdlib/library.files.ls doc/stdlib/FullLibrary.tex
rm -f doc/*/*.ps doc/*/*.pdf doc/*/*.eps doc/*/*.pdf_t doc/*/*.eps_t
- rm -f doc/faq/axioms.png
- rm -rf doc/refman/html doc/stdlib/html doc/faq/html doc/tutorial/tutorial.v.html
+ rm -rf doc/refman/html doc/stdlib/html doc/tutorial/tutorial.v.html
rm -f doc/refman/euclid.ml doc/refman/euclid.mli
rm -f doc/refman/heapsort.ml doc/refman/heapsort.mli
rm -f doc/common/version.tex
@@ -244,7 +245,7 @@ archclean: clean-ide optclean voclean
rm -f $(ALLSTDLIB).*
optclean:
- rm -f $(COQTOPEXE) $(COQMKTOP) $(CHICKEN)
+ rm -f $(COQTOPEXE) $(CHICKEN)
rm -f $(TOOLS) $(PRIVATEBINARIES) $(CSDPCERT)
find . -name '*.cmx' -o -name '*.cmx[as]' -o -name '*.[soa]' -o -name '*.so' | xargs rm -f
@@ -282,6 +283,9 @@ devdocclean:
rm -f $(OCAMLDOCDIR)/ocamldoc.sty $(OCAMLDOCDIR)/coq.tex
rm -f $(OCAMLDOCDIR)/html/*.html
+alienclean:
+ rm -f $(ALIENOBJS) $(ALIENVO)
+
###########################################################################
# Continuous Intregration Tests
###########################################################################
diff --git a/Makefile.build b/Makefile.build
index 991942bf0..f0dd46b0f 100644
--- a/Makefile.build
+++ b/Makefile.build
@@ -147,8 +147,14 @@ endif
# For creating the missing .d, make will recursively build things like
# coqdep_boot (for the .v.d files) or grammar.cma (for .ml4 -> .ml -> .ml.d).
+VDFILE := .vfiles
+MLDFILE := .mlfiles
+PLUGMLDFILE := plugins/.mlfiles
+MLLIBDFILE := .mllibfiles
+PLUGMLLIBDFILE := plugins/.mllibfiles
+
DEPENDENCIES := \
- $(addsuffix .d, $(MLFILES) $(MLIFILES) $(MLLIBFILES) $(MLPACKFILES) $(CFILES) $(VFILES))
+ $(addsuffix .d, $(MLDFILE) $(MLLIBDFILE) $(PLUGMLDFILE) $(PLUGMLLIBDFILE) $(CFILES) $(VDFILE))
-include $(DEPENDENCIES)
@@ -189,7 +195,7 @@ TIMER=$(if $(TIMED), $(STDTIME), $(TIMECMD))
COQOPTS=$(NATIVECOMPUTE)
BOOTCOQC=$(TIMER) $(COQTOPBEST) -boot $(COQOPTS) -compile
-LOCALINCLUDES=$(if $(filter plugins/%,$<),-I lib -I API -open API $(addprefix -I plugins/,$(PLUGINDIRS)),$(addprefix -I ,$(SRCDIRS)))
+LOCALINCLUDES=$(addprefix -I ,$(SRCDIRS))
MLINCLUDES=$(LOCALINCLUDES) -I $(MYCAMLP4LIB)
OCAMLC := $(OCAMLFIND) ocamlc $(CAMLFLAGS)
@@ -197,7 +203,7 @@ OCAMLOPT := $(OCAMLFIND) opt $(CAMLFLAGS)
BYTEFLAGS=$(CAMLDEBUG) $(USERFLAGS)
OPTFLAGS=$(CAMLDEBUGOPT) $(CAMLTIMEPROF) $(USERFLAGS) $(FLAMBDA_FLAGS)
-DEPFLAGS=$(LOCALINCLUDES)$(if $(filter plugins/%,$<),, -I ide -I ide/utils)
+DEPFLAGS=$(LOCALINCLUDES)$(if $(filter plugins/%,$@),, -I ide -I ide/utils)
# On MacOS, the binaries are signed, except our private ones
ifeq ($(shell which codesign > /dev/null 2>&1 && echo $(ARCH)),Darwin)
@@ -228,8 +234,8 @@ endef
define bestocaml
$(if $(OPT),\
-$(OCAMLOPT) $(MLINCLUDES) $(OPTFLAGS) $(LINKMETADATA) -o $@ $(1) $(addsuffix .cmxa,$(2)) $^ && $(STRIP) $@ && $(CODESIGN) $@,\
-$(OCAMLC) $(MLINCLUDES) $(BYTEFLAGS) $(CUSTOM) -o $@ $(1) $(addsuffix .cma,$(2)) $^)
+$(OCAMLOPT) $(MLINCLUDES) $(OPTFLAGS) $(LINKMETADATA) -o $@ -linkpkg $(1) $^ && $(STRIP) $@ && $(CODESIGN) $@,\
+$(OCAMLC) $(MLINCLUDES) $(BYTEFLAGS) $(CUSTOM) -o $@ -linkpkg $(1) $^)
endef
# Camlp5 settings
@@ -239,9 +245,8 @@ CAMLP4USE=pa_extend.cmo q_MLast.cmo pa_macro.cmo -D$(CAMLVERSION)
PR_O := $(if $(READABLE_ML4),pr_o.cmo,pr_dump.cmo)
-SYSMOD:=str unix dynlink threads
-SYSCMA:=$(addsuffix .cma,$(SYSMOD))
-SYSCMXA:=$(addsuffix .cmxa,$(SYSMOD))
+# Main packages linked by Coq.
+SYSMOD:=-package num,str,unix,dynlink,threads
# We do not repeat the dependencies already in SYSMOD here
P4CMA:=gramlib.cma
@@ -302,7 +307,7 @@ kernel/byterun/coq_jumptbl.h : kernel/byterun/coq_instruct.h
-e '/^}/q' $< $(TOTARGET)
kernel/copcodes.ml: kernel/byterun/coq_instruct.h
- sed -n -e '/^enum/p' -e 's/,//g' -e '/^ /p' $< | \
+ tr -d "\r" < $< | sed -n -e '/^enum/p' -e 's/,//g' -e '/^ /p' | \
awk -f kernel/make-opcodes $(TOTARGET)
%.o: %.c
@@ -370,19 +375,30 @@ grammar/%.cmi: grammar/%.mli
###########################################################################
-# Main targets (coqmktop, coqtop.opt, coqtop.byte)
+# Main targets (coqtop.opt, coqtop.byte)
###########################################################################
.PHONY: coqbinaries coqbyte
-coqbinaries: $(COQMKTOP) $(COQTOPEXE) $(CHICKEN) $(CSDPCERT) $(FAKEIDE)
+coqbinaries: $(COQTOPEXE) $(CHICKEN) $(CSDPCERT) $(FAKEIDE)
coqbyte: $(COQTOPBYTE) $(CHICKENBYTE)
+COQTOP_OPT_MLTOP=toplevel/coqtop_opt_bin.cmx
+COQTOP_BYTE_MLTOP=toplevel/coqtop_byte_bin.cmo
+
+$(COQTOP_BYTE_MLTOP): toplevel/coqtop_byte_bin.ml
+ $(SHOW)'OCAMLC $<'
+ $(HIDE)$(OCAMLC) $(MLINCLUDES) $(BYTEFLAGS) -package compiler-libs.toplevel -c $<
+
ifeq ($(BEST),opt)
-$(COQTOPEXE): $(COQMKTOP) $(LINKCMX) $(LIBCOQRUN) $(TOPLOOPCMA:.cma=.cmxs)
+$(COQTOPEXE): $(LINKCMX) $(LIBCOQRUN) $(TOPLOOPCMA:.cma=.cmxs) $(COQTOP_OPT_MLTOP)
$(SHOW)'COQMKTOP -o $@'
- $(HIDE)$(COQMKTOP) -boot -opt $(OPTFLAGS) $(LINKMETADATA) -o $@
+ $(HIDE)$(OCAMLOPT) -linkall -linkpkg -I toplevel \
+ -I kernel/byterun/ -cclib -lcoqrun \
+ $(SYSMOD) -package camlp5.gramlib \
+ $(LINKCMX) $(OPTFLAGS) $(LINKMETADATA) \
+ $(COQTOP_OPT_MLTOP) toplevel/coqtop_bin.ml -o $@
$(STRIP) $@
$(CODESIGN) $@
else
@@ -390,31 +406,22 @@ $(COQTOPEXE): $(COQTOPBYTE)
cp $< $@
endif
-$(COQTOPBYTE): $(COQMKTOP) $(LINKCMO) $(LIBCOQRUN) $(TOPLOOPCMA)
+# Are "-cclib lcoqrun -dllib -lcoqrun" necessary?
+$(COQTOPBYTE): $(LINKCMO) $(LIBCOQRUN) $(TOPLOOPCMA) $(COQTOP_BYTE_MLTOP)
$(SHOW)'COQMKTOP -o $@'
- $(HIDE)$(COQMKTOP) -boot -top $(BYTEFLAGS) -o $@
-
-# coqmktop
-
-COQMKTOPCMO:=lib/clib.cma lib/cErrors.cmo tools/tolink.cmo tools/coqmktop.cmo
-
-$(COQMKTOP): $(call bestobj, $(COQMKTOPCMO))
- $(SHOW)'OCAMLBEST -o $@'
- $(HIDE)$(call bestocaml, $(OSDEPLIBS), $(SYSMOD))
-
-tools/tolink.ml: Makefile.build Makefile.common
- $(SHOW)"ECHO... >" $@
- $(HIDE)echo "let copts = \"-cclib -lcoqrun\"" > $@
- $(HIDE)echo "let core_libs = \""$(LINKCMO)"\"" >> $@
- $(HIDE)echo "let core_objs = \""$(OBJSMOD)"\"" >> $@
+ $(HIDE)$(OCAMLC) -linkall -linkpkg -I toplevel \
+ -I kernel/byterun -dllpath $(abspath kernel/byterun) -cclib -lcoqrun -dllib -lcoqrun \
+ $(SYSMOD) -package camlp5.gramlib,compiler-libs.toplevel \
+ $(LINKCMO) $(BYTEFLAGS) \
+ $(COQTOP_BYTE_MLTOP) toplevel/coqtop_bin.ml -o $@
# coqc
-COQCCMO:=lib/clib.cma lib/cErrors.cmo toplevel/usage.cmo tools/coqc.cmo
+COQCCMO:=clib/clib.cma lib/lib.cma toplevel/usage.cmo tools/coqc.cmo
$(COQC): $(call bestobj, $(COQCCMO))
$(SHOW)'OCAMLBEST -o $@'
- $(HIDE)$(call bestocaml, $(OSDEPLIBS), $(SYSMOD))
+ $(HIDE)$(call bestocaml, $(SYSMOD))
###########################################################################
# other tools
@@ -431,100 +438,99 @@ tools: $(TOOLS) $(OCAMLLIBDEP) $(COQDEPBOOT)
# Remember to update the dependencies below when you add files!
COQDEPBOOTSRC := \
- lib/segmenttree.cmo lib/unicodetable.cmo lib/unicode.cmo lib/minisys.cmo \
+ clib/segmenttree.cmo clib/unicodetable.cmo clib/unicode.cmo clib/minisys.cmo \
tools/coqdep_lexer.cmo tools/coqdep_common.cmo tools/coqdep_boot.cmo
-lib/segmenttree.cmo : lib/segmenttree.cmi
-lib/segmenttree.cmx : lib/segmenttree.cmi
-lib/unicodetable.cmo : lib/segmenttree.cmo
-lib/unicodetable.cmx : lib/segmenttree.cmx
-lib/unicode.cmo : lib/unicodetable.cmo lib/unicode.cmi
-lib/unicode.cmx : lib/unicodetable.cmx lib/unicode.cmi
-lib/minisys.cmo : lib/unicode.cmo
-lib/minisys.cmx : lib/unicode.cmx
-tools/coqdep_lexer.cmo : lib/unicode.cmi tools/coqdep_lexer.cmi
-tools/coqdep_lexer.cmx : lib/unicode.cmx tools/coqdep_lexer.cmi
-tools/coqdep_common.cmo : lib/minisys.cmo tools/coqdep_lexer.cmi tools/coqdep_common.cmi
-tools/coqdep_common.cmx : lib/minisys.cmx tools/coqdep_lexer.cmx tools/coqdep_common.cmi
+clib/segmenttree.cmo : clib/segmenttree.cmi
+clib/segmenttree.cmx : clib/segmenttree.cmi
+clib/unicodetable.cmo : clib/segmenttree.cmo
+clib/unicodetable.cmx : clib/segmenttree.cmx
+clib/unicode.cmo : clib/unicodetable.cmo clib/unicode.cmi
+clib/unicode.cmx : clib/unicodetable.cmx clib/unicode.cmi
+clib/minisys.cmo : clib/unicode.cmo
+clib/minisys.cmx : clib/unicode.cmx
+tools/coqdep_lexer.cmo : clib/unicode.cmi tools/coqdep_lexer.cmi
+tools/coqdep_lexer.cmx : clib/unicode.cmx tools/coqdep_lexer.cmi
+tools/coqdep_common.cmo : clib/minisys.cmo tools/coqdep_lexer.cmi tools/coqdep_common.cmi
+tools/coqdep_common.cmx : clib/minisys.cmx tools/coqdep_lexer.cmx tools/coqdep_common.cmi
tools/coqdep_boot.cmo : tools/coqdep_common.cmi
tools/coqdep_boot.cmx : tools/coqdep_common.cmx
$(COQDEPBOOT): $(call bestobj, $(COQDEPBOOTSRC))
$(SHOW)'OCAMLBEST -o $@'
- $(HIDE)$(call bestocaml, -I tools, unix)
+ $(HIDE)$(call bestocaml, -I tools -package unix)
$(OCAMLLIBDEP): $(call bestobj, tools/ocamllibdep.cmo)
$(SHOW)'OCAMLBEST -o $@'
- $(HIDE)$(call bestocaml, -I tools, unix)
+ $(HIDE)$(call bestocaml, -I tools -package unix)
# The full coqdep (unused by this build, but distributed by make install)
-COQDEPCMO:=lib/clib.cma lib/cErrors.cmo lib/cWarnings.cmo \
- lib/segmenttree.cmo lib/unicodetable.cmo lib/unicode.cmo lib/minisys.cmo \
- lib/system.cmo tools/coqdep_lexer.cmo tools/coqdep_common.cmo \
- tools/coqdep.cmo
+COQDEPCMO:=clib/clib.cma lib/lib.cma tools/coqdep_lexer.cmo \
+ tools/coqdep_common.cmo tools/coqdep.cmo
$(COQDEP): $(call bestobj, $(COQDEPCMO))
$(SHOW)'OCAMLBEST -o $@'
- $(HIDE)$(call bestocaml, $(OSDEPLIBS), $(SYSMOD))
+ $(HIDE)$(call bestocaml, $(SYSMOD))
$(GALLINA): $(call bestobj, tools/gallina_lexer.cmo tools/gallina.cmo)
$(SHOW)'OCAMLBEST -o $@'
- $(HIDE)$(call bestocaml,,)
+ $(HIDE)$(call bestocaml,)
-COQMAKEFILECMO:=lib/clib.cma tools/coq_makefile.cmo
+COQMAKEFILECMO:=clib/clib.cma lib/lib.cma tools/coq_makefile.cmo
$(COQMAKEFILE): $(call bestobj,$(COQMAKEFILECMO))
$(SHOW)'OCAMLBEST -o $@'
- $(HIDE)$(call bestocaml,,str unix threads)
+ $(HIDE)$(call bestocaml, -package str,unix,threads)
$(COQTEX): $(call bestobj, tools/coq_tex.cmo)
$(SHOW)'OCAMLBEST -o $@'
- $(HIDE)$(call bestocaml,,str)
+ $(HIDE)$(call bestocaml, -package str)
$(COQWC): $(call bestobj, tools/coqwc.cmo)
$(SHOW)'OCAMLBEST -o $@'
- $(HIDE)$(call bestocaml,,)
+ $(HIDE)$(call bestocaml, -package str)
-COQDOCCMO:=lib/clib.cma $(addprefix tools/coqdoc/, \
+COQDOCCMO:=clib/clib.cma lib/lib.cma $(addprefix tools/coqdoc/, \
cdglobals.cmo alpha.cmo index.cmo tokens.cmo output.cmo cpretty.cmo main.cmo )
$(COQDOC): $(call bestobj, $(COQDOCCMO))
$(SHOW)'OCAMLBEST -o $@'
- $(HIDE)$(call bestocaml,,str unix)
+ $(HIDE)$(call bestocaml, -package str,unix)
-$(COQWORKMGR): $(call bestobj, lib/clib.cma stm/coqworkmgrApi.cmo tools/coqworkmgr.cmo)
+$(COQWORKMGR): $(call bestobj, clib/clib.cma lib/lib.cma stm/spawned.cmo stm/coqworkmgrApi.cmo tools/coqworkmgr.cmo)
$(SHOW)'OCAMLBEST -o $@'
- $(HIDE)$(call bestocaml,, $(SYSMOD))
+ $(HIDE)$(call bestocaml, $(SYSMOD))
# fake_ide : for debugging or test-suite purpose, a fake ide simulating
# a connection to coqtop -ideslave
-FAKEIDECMO:= lib/clib.cma lib/cErrors.cmo lib/spawn.cmo ide/document.cmo \
- ide/serialize.cmo ide/xml_lexer.cmo ide/xml_parser.cmo ide/xml_printer.cmo \
- ide/richpp.cmo ide/xmlprotocol.cmo tools/fake_ide.cmo
+FAKEIDECMO:=clib/clib.cma lib/lib.cma ide/document.cmo \
+ ide/serialize.cmo ide/xml_lexer.cmo ide/xml_parser.cmo \
+ ide/xml_printer.cmo ide/richpp.cmo ide/xmlprotocol.cmo \
+ tools/fake_ide.cmo
$(FAKEIDE): $(call bestobj, $(FAKEIDECMO)) | $(IDETOPLOOPCMA:.cma=$(BESTDYN))
$(SHOW)'OCAMLBEST -o $@'
- $(HIDE)$(call bestocaml,-I ide,str unix threads)
+ $(HIDE)$(call bestocaml, -I ide -package str,unix,threads)
# votour: a small vo explorer (based on the checker)
-bin/votour: $(call bestobj, lib/cObj.cmo checker/analyze.cmo checker/values.cmo checker/votour.cmo)
+bin/votour: $(call bestobj, clib/cObj.cmo checker/analyze.cmo checker/values.cmo checker/votour.cmo)
$(SHOW)'OCAMLBEST -o $@'
- $(HIDE)$(call bestocaml, -I checker,)
+ $(HIDE)$(call bestocaml, -I checker)
###########################################################################
# Csdp to micromega special targets
###########################################################################
-CSDPCERTCMO:=lib/clib.cma $(addprefix plugins/micromega/, \
+CSDPCERTCMO:=clib/clib.cma $(addprefix plugins/micromega/, \
mutils.cmo micromega.cmo \
sos_types.cmo sos_lib.cmo sos.cmo csdpcert.cmo )
$(CSDPCERT): $(call bestobj, $(CSDPCERTCMO))
$(SHOW)'OCAMLBEST -o $@'
- $(HIDE)$(call bestocaml,,nums unix)
+ $(HIDE)$(call bestocaml, -package num,unix)
###########################################################################
# tests
@@ -570,12 +576,6 @@ kernel/kernel.cma: kernel/kernel.mllib
$(SHOW)'OCAMLC -a -o $@'
$(HIDE)$(OCAMLC) $(MLINCLUDES) $(BYTEFLAGS) $(VMBYTEFLAGS) -a -o $@ $(filter-out %.mllib, $^)
-# Specific rule for API/API.cmi
-# Make sure that API/API.mli cannot leak types from the Coq codebase.
-API/API.cmi : API/API.mli
- $(SHOW)'OCAMLC $<'
- $(HIDE)$(OCAMLC) -I lib -I $(MYCAMLP4LIB) -c $<
-
%.cma: %.mllib
$(SHOW)'OCAMLC -a -o $@'
$(HIDE)$(OCAMLC) $(MLINCLUDES) $(BYTEFLAGS) -a -o $@ $(filter-out %.mllib, $^)
@@ -594,16 +594,35 @@ API/API.cmi : API/API.mli
$(SHOW)'OCAMLOPT -pack -o $@'
$(HIDE)$(OCAMLOPT) $(MLINCLUDES) $(OPTFLAGS) -pack -o $@ $(filter-out %.mlpack, $^)
+COND_IDEFLAGS=$(if $(filter tools/fake_ide% tools/coq_makefile%,$<), -I ide,)
+COND_PRINTERFLAGS=$(if $(filter dev/%,$<), -I dev,)
+
COND_BYTEFLAGS= \
- $(if $(filter tools/fake_ide% tools/coq_makefile%,$<), -I ide,) $(MLINCLUDES) $(BYTEFLAGS)
+ $(COND_IDEFLAGS) $(COND_PRINTERFLAGS) $(MLINCLUDES) $(BYTEFLAGS)
COND_OPTFLAGS= \
- $(if $(filter tools/fake_ide% tools/coq_makefile%,$<), -I ide,) $(MLINCLUDES) $(OPTFLAGS)
+ $(COND_IDEFLAGS) $(MLINCLUDES) $(OPTFLAGS)
+
+plugins/micromega/%.cmi: plugins/micromega/%.mli
+ $(SHOW)'OCAMLC $<'
+ $(HIDE)$(OCAMLC) $(COND_BYTEFLAGS) -package unix,num -c $<
+
+plugins/nsatz/%.cmi: plugins/nsatz/%.mli
+ $(SHOW)'OCAMLC $<'
+ $(HIDE)$(OCAMLC) $(COND_BYTEFLAGS) -package unix,num -c $<
%.cmi: %.mli
$(SHOW)'OCAMLC $<'
$(HIDE)$(OCAMLC) $(COND_BYTEFLAGS) -c $<
+plugins/micromega/%.cmo: plugins/micromega/%.ml
+ $(SHOW)'OCAMLC $<'
+ $(HIDE)$(OCAMLC) $(COND_BYTEFLAGS) -package unix,num -c $<
+
+plugins/nsatz/%.cmo: plugins/nsatz/%.ml
+ $(SHOW)'OCAMLC $<'
+ $(HIDE)$(OCAMLC) $(COND_BYTEFLAGS) -package unix,num -c $<
+
%.cmo: %.ml
$(SHOW)'OCAMLC $<'
$(HIDE)$(OCAMLC) $(COND_BYTEFLAGS) -c $<
@@ -637,6 +656,14 @@ plugins/micromega/sos_FORPACK:=
plugins/micromega/sos_print_FORPACK:=
plugins/micromega/csdpcert_FORPACK:=
+plugins/micromega/%.cmx: plugins/micromega/%.ml
+ $(SHOW)'OCAMLOPT $<'
+ $(HIDE)$(OCAMLOPT) $(COND_OPTFLAGS) $(HACKMLI) $($(@:.cmx=_FORPACK)) -package unix,num -c $<
+
+plugins/nsatz/%.cmx: plugins/nsatz/%.ml
+ $(SHOW)'OCAMLOPT $<'
+ $(HIDE)$(OCAMLOPT) $(COND_OPTFLAGS) $(HACKMLI) $($(@:.cmx=_FORPACK)) -package unix,num -c $<
+
plugins/%.cmx: plugins/%.ml
$(SHOW)'OCAMLOPT $<'
$(HIDE)$(OCAMLOPT) $(COND_OPTFLAGS) $(HACKMLI) $($(@:.cmx=_FORPACK)) -c $<
@@ -670,21 +697,24 @@ plugins/%.cmx: plugins/%.ml
# Ocamldep is now used directly again (thanks to -ml-synonym in OCaml >= 3.12)
OCAMLDEP = $(OCAMLFIND) ocamldep -slash -ml-synonym .ml4 -ml-synonym .mlpack
-%.ml.d: $(D_DEPEND_BEFORE_SRC) %.ml $(D_DEPEND_AFTER_SRC) $(GENFILES)
- $(SHOW)'OCAMLDEP $<'
- $(HIDE)$(OCAMLDEP) $(DEPFLAGS) "$<" $(TOTARGET)
+MAINMLFILES := $(filter-out checker/% plugins/%, $(MLFILES) $(MLIFILES))
+MAINMLLIBFILES := $(filter-out checker/% plugins/%, $(MLLIBFILES) $(MLPACKFILES))
-%.mli.d: $(D_DEPEND_BEFORE_SRC) %.mli $(D_DEPEND_AFTER_SRC) $(GENFILES)
- $(SHOW)'OCAMLDEP $<'
- $(HIDE)$(OCAMLDEP) $(DEPFLAGS) "$<" $(TOTARGET)
+$(MLDFILE).d: $(D_DEPEND_BEFORE_SRC) $(MAINMLFILES) $(D_DEPEND_AFTER_SRC) $(GENFILES)
+ $(SHOW)'OCAMLDEP MLFILES MLIFILES'
+ $(HIDE)$(OCAMLDEP) $(DEPFLAGS) $(MAINMLFILES) $(TOTARGET)
-%.mllib.d: $(D_DEPEND_BEFORE_SRC) %.mllib $(D_DEPEND_AFTER_SRC) $(OCAMLLIBDEP) $(GENFILES)
- $(SHOW)'OCAMLLIBDEP $<'
- $(HIDE)$(OCAMLLIBDEP) $(DEPFLAGS) "$<" $(TOTARGET)
+$(MLLIBDFILE).d: $(D_DEPEND_BEFORE_SRC) $(MAINMLLIBFILES) $(D_DEPEND_AFTER_SRC) $(OCAMLLIBDEP) $(GENFILES)
+ $(SHOW)'OCAMLLIBDEP MLLIBFILES MLPACKFILES'
+ $(HIDE)$(OCAMLLIBDEP) $(DEPFLAGS) $(MAINMLLIBFILES) $(TOTARGET)
-%.mlpack.d: $(D_DEPEND_BEFORE_SRC) %.mlpack $(D_DEPEND_AFTER_SRC) $(OCAMLLIBDEP) $(GENFILES)
- $(SHOW)'OCAMLLIBDEP $<'
- $(HIDE)$(OCAMLLIBDEP) $(DEPFLAGS) "$<" $(TOTARGET)
+$(PLUGMLDFILE).d: $(D_DEPEND_BEFORE_SRC) $(filter plugins/%, $(MLFILES) $(MLIFILES)) $(D_DEPEND_AFTER_SRC) $(GENFILES)
+ $(SHOW)'OCAMLDEP plugins/MLFILES plugins/MLIFILES'
+ $(HIDE)$(OCAMLDEP) $(DEPFLAGS) $(filter plugins/%, $(MLFILES) $(MLIFILES)) $(TOTARGET)
+
+$(PLUGMLLIBDFILE).d: $(D_DEPEND_BEFORE_SRC) $(filter plugins/%, $(MLLIBFILES) $(MLPACKFILES)) $(D_DEPEND_AFTER_SRC) $(OCAMLLIBDEP) $(GENFILES)
+ $(SHOW)'OCAMLLIBDEP plugins/MLLIBFILES plugins/MLPACKFILES'
+ $(HIDE)$(OCAMLLIBDEP) $(DEPFLAGS) $(filter plugins/%, $(MLLIBFILES) $(MLPACKFILES)) $(TOTARGET)
###########################################################################
# Compilation of .v files
@@ -717,26 +747,6 @@ theories/Init/%.vo theories/Init/%.glob: theories/Init/%.v $(VO_TOOLS_DEP)
$(HIDE)rm -f theories/Init/$*.glob
$(HIDE)$(BOOTCOQC) $< -noinit -R theories Coq $(TIMING_ARG) $(TIMING_EXTRA)
-# MExtraction.v generates the ml core file of the micromega tactic.
-# We check that this generated code is still in sync with the version
-# of micromega.ml in the archive.
-
-# Note: we now dump to stdout there via "Recursive Extraction" for better
-# control on the name of the generated file, and avoid a .ml that
-# would end in our $(MLFILES). The "sed" below is to kill the final
-# blank line printed by Recursive Extraction (unlike Extraction "foo").
-
-MICROMEGAV:=plugins/micromega/MExtraction.v
-MICROMEGAML:=plugins/micromega/micromega.ml
-MICROMEGAGEN:=plugins/micromega/.micromega.ml.generated
-
-$(MICROMEGAV:.v=.vo) $(MICROMEGAV:.v=.glob) : $(MICROMEGAV) theories/Init/Prelude.vo $(VO_TOOLS_DEP)
- $(SHOW)'COQC $<'
- $(HIDE)rm -f $*.glob
- $(HIDE)$(BOOTCOQC) $< | sed -e '$$d' > $(MICROMEGAGEN)
- $(HIDE)cmp -s $(MICROMEGAML) $(MICROMEGAGEN) || \
- echo "Warning: $(MICROMEGAML) and the code generated by $(MICROMEGAV) differ !"
-
# The general rule for building .vo files :
%.vo %.glob: %.v theories/Init/Prelude.vo $(VO_TOOLS_DEP)
@@ -756,9 +766,9 @@ endif
# Dependencies of .v files
-%.v.d: $(D_DEPEND_BEFORE_SRC) %.v $(D_DEPEND_AFTER_SRC) $(COQDEPBOOT)
- $(SHOW)'COQDEP $<'
- $(HIDE)$(COQDEPBOOT) -boot $(DYNDEP) "$<" $(TOTARGET)
+$(VDFILE).d: $(D_DEPEND_BEFORE_SRC) $(VFILES) $(D_DEPEND_AFTER_SRC) $(COQDEPBOOT)
+ $(SHOW)'COQDEP VFILES'
+ $(HIDE)$(COQDEPBOOT) -boot $(DYNDEP) $(VFILES) $(TOTARGET)
###########################################################################
diff --git a/Makefile.checker b/Makefile.checker
index 435d8e8f6..0e429fe86 100644
--- a/Makefile.checker
+++ b/Makefile.checker
@@ -20,16 +20,22 @@ CHICKEN:=bin/coqchk$(EXE)
# The sources
-CHKLIBS:= -I config -I lib -I checker
+CHKLIBS:= -I config -I clib -I lib -I checker
## NB: currently, both $(OPTFLAGS) and $(BYTEFLAGS) contain -thread
# The rules
+CHECKMLDFILE := checker/.mlfiles
+CHECKMLLIBFILE := checker/.mllibfiles
+
+CHECKERDEPS := $(addsuffix .d, $(CHECKMLDFILE) $(CHECKMLLIBFILE))
+-include $(CHECKERDEPS)
+
ifeq ($(BEST),opt)
-$(CHICKEN): checker/check.cmxa checker/main.ml
+$(CHICKEN): checker/check.cmxa checker/main.mli checker/main.ml
$(SHOW)'OCAMLOPT -o $@'
- $(HIDE)$(OCAMLOPT) $(SYSCMXA) $(CHKLIBS) $(OPTFLAGS) $(LINKMETADATA) -o $@ $^
+ $(HIDE)$(OCAMLOPT) -linkpkg $(SYSMOD) $(CHKLIBS) $(OPTFLAGS) $(LINKMETADATA) -o $@ $^
$(STRIP) $@
$(CODESIGN) $@
else
@@ -37,9 +43,9 @@ $(CHICKEN): $(CHICKENBYTE)
cp $< $@
endif
-$(CHICKENBYTE): checker/check.cma checker/main.ml
+$(CHICKENBYTE): checker/check.cma checker/main.mli checker/main.ml
$(SHOW)'OCAMLC -o $@'
- $(HIDE)$(OCAMLC) $(SYSCMA) $(CHKLIBS) $(BYTEFLAGS) $(CUSTOM) -o $@ $^
+ $(HIDE)$(OCAMLC) -linkpkg $(SYSMOD) $(CHKLIBS) $(BYTEFLAGS) $(CUSTOM) -o $@ $^
checker/check.cma: checker/check.mllib | md5chk
$(SHOW)'OCAMLC -a -o $@'
@@ -49,17 +55,13 @@ checker/check.cmxa: checker/check.mllib | md5chk
$(SHOW)'OCAMLOPT -a -o $@'
$(HIDE)$(OCAMLOPT) $(CHKLIBS) $(OPTFLAGS) -a -o $@ $(filter-out %.mllib, $^)
-checker/%.ml.d: checker/%.ml
- $(SHOW)'OCAMLDEP $<'
- $(HIDE)$(OCAMLFIND) ocamldep -slash $(CHKLIBS) "$<" $(TOTARGET)
-
-checker/%.mli.d: checker/%.mli
- $(SHOW)'OCAMLDEP $<'
- $(HIDE)$(OCAMLFIND) ocamldep -slash $(CHKLIBS) "$<" $(TOTARGET)
+$(CHECKMLDFILE).d: $(filter checker/%, $(MLFILES) $(MLIFILES))
+ $(SHOW)'OCAMLDEP checker/MLFILES checker/MLIFILES'
+ $(HIDE)$(OCAMLFIND) ocamldep -slash $(CHKLIBS) $(filter checker/%, $(MLFILES) $(MLIFILES)) $(TOTARGET)
-checker/%.mllib.d: checker/%.mllib | $(OCAMLLIBDEP)
- $(SHOW)'OCAMLLIBDEP $<'
- $(HIDE)$(OCAMLLIBDEP) $(CHKLIBS) "$<" $(TOTARGET)
+$(CHECKMLLIBFILE).d: $(filter checker/%, $(MLLIBFILES) $(MLPACKFILES)) | $(OCAMLLIBDEP)
+ $(SHOW)'OCAMLLIBDEP checker/MLLIBFILES checker/MLPACKFILES'
+ $(HIDE)$(OCAMLLIBDEP) $(CHKLIBS) $(filter checker/%, $(MLLIBFILES) $(MLPACKFILES)) $(TOTARGET)
checker/%.cmi: checker/%.mli
$(SHOW)'OCAMLC $<'
@@ -75,8 +77,8 @@ checker/%.cmx: checker/%.ml
md5chk:
$(SHOW)'MD5SUM cic.mli'
- $(HIDE)if grep -q `$(MD5SUM) checker/cic.mli` checker/values.ml; \
- then true; else echo "Error: outdated checker/values.ml"; false; fi
+ $(HIDE)if grep -q "^MD5 $$($(OCAML) tools/md5sum.ml checker/cic.mli)$$" checker/values.ml; \
+ then true; else echo "Error: outdated checker/values.ml" >&2; false; fi
.PHONY: md5chk
diff --git a/Makefile.ci b/Makefile.ci
index 54ebf211f..334827a93 100644
--- a/Makefile.ci
+++ b/Makefile.ci
@@ -4,7 +4,9 @@ CI_TARGETS=ci-all \
ci-compcert \
ci-coq-dpdgraph \
ci-coquelicot \
+ ci-corn \
ci-cpdt \
+ ci-equations \
ci-fiat-crypto \
ci-fiat-parsers \
ci-flocq \
@@ -12,6 +14,7 @@ CI_TARGETS=ci-all \
ci-geocoq \
ci-hott \
ci-iris-lambda-rust \
+ ci-ltac2 \
ci-math-classes \
ci-math-comp \
ci-metacoq \
@@ -22,6 +25,19 @@ CI_TARGETS=ci-all \
.PHONY: $(CI_TARGETS)
+ci-color: ci-bignums
+
+ci-math-classes: ci-bignums
+
+ci-corn: ci-math-classes
+
+ci-formal-topology: ci-corn
+
# Generic rule, we use make to ease travis integration with mixed rules
$(CI_TARGETS): ci-%:
- +./dev/ci/ci-wrapper.sh ci-$*.sh
+ +./dev/ci/ci-wrapper.sh $*
+
+# For emacs:
+# Local Variables:
+# mode: makefile
+# End:
diff --git a/Makefile.common b/Makefile.common
index 4d63b08e2..d3a9b0b96 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -12,8 +12,6 @@
# Executables
###########################################################################
-COQMKTOP:=bin/coqmktop$(EXE)
-
COQTOPBYTE:=bin/coqtop.byte$(EXE)
COQTOPEXE:=bin/coqtop$(EXE)
@@ -75,9 +73,9 @@ INSTALLSH:=./install.sh
MKDIR:=install -d
CORESRCDIRS:=\
- config lib kernel intf kernel/byterun library \
+ config clib lib kernel intf kernel/byterun library \
engine pretyping interp proofs parsing printing \
- tactics vernac stm toplevel API
+ tactics vernac stm toplevel
PLUGINDIRS:=\
omega romega micromega quote \
@@ -102,10 +100,10 @@ BYTERUN:=$(addprefix kernel/byterun/, \
# respecting this order is useful for developers that want to load or link
# the libraries directly
-CORECMA:=lib/clib.cma lib/lib.cma kernel/kernel.cma intf/intf.cma library/library.cma \
+CORECMA:=clib/clib.cma lib/lib.cma kernel/kernel.cma intf/intf.cma library/library.cma \
engine/engine.cma pretyping/pretyping.cma interp/interp.cma proofs/proofs.cma \
parsing/parsing.cma printing/printing.cma tactics/tactics.cma vernac/vernac.cma \
- stm/stm.cma toplevel/toplevel.cma API/API.cma
+ stm/stm.cma toplevel/toplevel.cma
TOPLOOPCMA:=stm/proofworkertop.cma stm/tacworkertop.cma stm/queryworkertop.cma
diff --git a/Makefile.dev b/Makefile.dev
index dc4ded397..db83be369 100644
--- a/Makefile.dev
+++ b/Makefile.dev
@@ -98,7 +98,7 @@ pluginsopt: $(PLUGINSOPT)
pluginsbyte: $(PLUGINS)
# This should build all the ocaml code but not (most of) the .v files
-coqocaml: tools coqbinaries pluginsopt coqide printers bin/votour
+coqocaml: tools coqbinaries $(PLUGINSCMO:.cmo=$(DYNOBJ)) coqide printers bin/votour
.PHONY: coqlight states miniopt minibyte pluginsopt pluginsbyte coqocaml
@@ -119,7 +119,7 @@ pretyping: pretyping/pretyping.cma
stm: stm/stm.cma
toplevel: toplevel/toplevel.cma
-.PHONY: lib kernel byterun library proofs tactics interp parsing pretyping API
+.PHONY: lib kernel byterun library proofs tactics interp parsing pretyping
.PHONY: engine stm toplevel
######################
diff --git a/Makefile.doc b/Makefile.doc
index faa9c879c..8cb9c9f0f 100644
--- a/Makefile.doc
+++ b/Makefile.doc
@@ -77,23 +77,23 @@ REFMANPNGFILES:=$(REFMANEPSFILES:.eps=.png)
######################################################################
.PHONY: doc doc-html doc-pdf doc-ps refman refman-quick tutorial
-.PHONY: stdlib full-stdlib faq rectutorial refman-html-dir
+.PHONY: stdlib full-stdlib rectutorial refman-html-dir
INDEXURLS:=doc/refman/html/index_urls.txt
-doc: refman faq tutorial rectutorial stdlib $(INDEXURLS)
+doc: refman tutorial rectutorial stdlib $(INDEXURLS)
doc-html:\
doc/tutorial/Tutorial.v.html doc/refman/html/index.html \
- doc/faq/html/index.html doc/stdlib/html/index.html doc/RecTutorial/RecTutorial.html
+ doc/stdlib/html/index.html doc/RecTutorial/RecTutorial.html
doc-pdf:\
doc/tutorial/Tutorial.v.pdf doc/refman/Reference-Manual.pdf \
- doc/faq/FAQ.v.pdf doc/stdlib/Library.pdf doc/RecTutorial/RecTutorial.pdf
+ doc/stdlib/Library.pdf doc/RecTutorial/RecTutorial.pdf
doc-ps:\
doc/tutorial/Tutorial.v.ps doc/refman/Reference-Manual.ps \
- doc/faq/FAQ.v.ps doc/stdlib/Library.ps doc/RecTutorial/RecTutorial.ps
+ doc/stdlib/Library.ps doc/RecTutorial/RecTutorial.ps
refman: \
doc/refman/html/index.html doc/refman/Reference-Manual.ps doc/refman/Reference-Manual.pdf
@@ -107,8 +107,6 @@ stdlib: \
full-stdlib: \
doc/stdlib/html/index.html doc/stdlib/FullLibrary.ps doc/stdlib/FullLibrary.pdf
-faq: doc/faq/html/index.html doc/faq/FAQ.v.ps doc/faq/FAQ.v.pdf
-
rectutorial: doc/RecTutorial/RecTutorial.html \
doc/RecTutorial/RecTutorial.ps doc/RecTutorial/RecTutorial.pdf
@@ -148,9 +146,6 @@ endif
HIDEBIBTEXINFO=| grep -v "^A level-1 auxiliary file"
SHOWMAKEINDEXERROR=egrep '^!! Input index error|^\*\* Input style error|^ --'
-# Empty subsection levels in faq are on purpose
-HEVEAFAQFILTER=2>&1 | grep -v "^Warning: List with no item"
-
######################################################################
# Common
######################################################################
@@ -253,33 +248,6 @@ doc/tutorial/Tutorial.v.pdf: $(DOCCOMMON) doc/tutorial/Tutorial.v.tex
doc/tutorial/Tutorial.v.html: $(DOCCOMMON) doc/tutorial/Tutorial.v.tex
(cd doc/tutorial; $(HEVEA) $(HEVEAOPTS) Tutorial.v)
-
-######################################################################
-# FAQ
-######################################################################
-
-doc/faq/FAQ.v.dvi: doc/common/version.tex doc/common/title.tex doc/faq/FAQ.v.tex doc/faq/axioms.eps
- (cd doc/faq;\
- $(LATEX) -interaction=batchmode FAQ.v;\
- $(BIBTEX) -terse FAQ.v;\
- $(LATEX) -interaction=batchmode FAQ.v > /dev/null;\
- $(LATEX) -interaction=batchmode FAQ.v > /dev/null;\
- ../tools/show_latex_messages FAQ.v.log)
-
-doc/faq/FAQ.v.pdf: doc/common/version.tex doc/common/title.tex doc/faq/FAQ.v.dvi doc/faq/axioms.pdf
- (cd doc/faq;\
- $(PDFLATEX) -interaction=batchmode FAQ.v.tex;\
- ../tools/show_latex_messages FAQ.v.log)
-
-doc/faq/FAQ.v.html: doc/faq/FAQ.v.dvi doc/faq/axioms.png # to ensure FAQ.v.bbl
- (cd doc/faq; ($(HEVEA) $(HEVEAOPTS) FAQ.v.tex $(HEVEAFAQFILTER)))
-
-doc/faq/html/index.html: doc/faq/FAQ.v.html
- - rm -rf doc/faq/html
- $(MKDIR) doc/faq/html
- $(INSTALLLIB) doc/faq/interval_discr.v doc/faq/axioms.png doc/faq/html
- $(INSTALLLIB) doc/faq/FAQ.v.html doc/faq/html/index.html
-
######################################################################
# Standard library
######################################################################
@@ -386,14 +354,13 @@ install-doc-meta:
$(INSTALLLIB) doc/LICENSE $(FULLDOCDIR)/LICENSE.doc
install-doc-html:
- $(MKDIR) $(addprefix $(FULLDOCDIR)/html/, refman stdlib faq)
+ $(MKDIR) $(addprefix $(FULLDOCDIR)/html/, refman stdlib)
(for f in `cd doc/refman/html; find . -type f`; do \
$(MKDIR) $$(dirname $(FULLDOCDIR)/html/refman/$$f);\
$(INSTALLLIB) doc/refman/html/$$f $(FULLDOCDIR)/html/refman/$$f;\
done)
$(INSTALLLIB) doc/stdlib/html/* $(FULLDOCDIR)/html/stdlib
$(INSTALLLIB) doc/RecTutorial/RecTutorial.html $(FULLDOCDIR)/html/RecTutorial.html
- $(INSTALLLIB) doc/faq/html/* $(FULLDOCDIR)/html/faq
$(INSTALLLIB) doc/tutorial/Tutorial.v.html $(FULLDOCDIR)/html/Tutorial.html
install-doc-printable:
@@ -404,10 +371,8 @@ install-doc-printable:
doc/stdlib/Library.ps $(FULLDOCDIR)/ps
$(INSTALLLIB) doc/tutorial/Tutorial.v.pdf $(FULLDOCDIR)/pdf/Tutorial.pdf
$(INSTALLLIB) doc/RecTutorial/RecTutorial.pdf $(FULLDOCDIR)/pdf/RecTutorial.pdf
- $(INSTALLLIB) doc/faq/FAQ.v.pdf $(FULLDOCDIR)/pdf/FAQ.pdf
$(INSTALLLIB) doc/tutorial/Tutorial.v.ps $(FULLDOCDIR)/ps/Tutorial.ps
$(INSTALLLIB) doc/RecTutorial/RecTutorial.ps $(FULLDOCDIR)/ps/RecTutorial.ps
- $(INSTALLLIB) doc/faq/FAQ.v.ps $(FULLDOCDIR)/ps/FAQ.ps
install-doc-index-urls:
$(MKDIR) $(FULLDATADIR)
@@ -422,7 +387,7 @@ OCAMLDOCDIR=dev/ocamldoc
DOCMLIS=$(wildcard ./lib/*.mli ./intf/*.mli ./kernel/*.mli ./library/*.mli \
./engine/*.mli ./pretyping/*.mli ./interp/*.mli printing/*.mli \
- ./parsing/*.mli ./proofs/*.mli API/API.mli \
+ ./parsing/*.mli ./proofs/*.mli \
./tactics/*.mli ./stm/*.mli ./toplevel/*.mli ./ltac/*.mli)
# Defining options to generate dependencies graphs
diff --git a/Makefile.ide b/Makefile.ide
index 7593a9f2e..09eef1f6b 100644
--- a/Makefile.ide
+++ b/Makefile.ide
@@ -41,12 +41,12 @@ IDESRCDIRS:= $(CORESRCDIRS) ide ide/utils
COQIDEFLAGS=$(addprefix -I , $(IDESRCDIRS)) $(COQIDEINCLUDES)
-IDEDEPS:=lib/clib.cma lib/cErrors.cmo lib/spawn.cmo
+IDEDEPS:=clib/clib.cma lib/lib.cma
IDECMA:=ide/ide.cma
IDETOPLOOPCMA=ide/coqidetop.cma
-LINKIDE:=$(IDEDEPS) $(IDECDEPS) $(IDECMA) ide/coqide_main.ml
-LINKIDEOPT:=$(IDEOPTCDEPS) $(patsubst %.cma,%.cmxa,$(IDEDEPS:.cmo=.cmx)) $(IDECMA:.cma=.cmxa) ide/coqide_main.ml
+LINKIDE:=$(IDEDEPS) $(IDECDEPS) $(IDECMA) ide/coqide_main.mli ide/coqide_main.ml
+LINKIDEOPT:=$(IDEOPTCDEPS) $(patsubst %.cma,%.cmxa,$(IDEDEPS:.cmo=.cmx)) $(IDECMA:.cma=.cmxa) ide/coqide_main.mli ide/coqide_main.ml
IDEFILES=$(wildcard ide/*.lang) ide/coq_style.xml ide/coq.png ide/MacOS/default_accel_map
@@ -123,6 +123,15 @@ ide/%.cmx: ide/%.ml
$(SHOW)'OCAMLOPT $<'
$(HIDE)$(OCAMLOPT) $(COQIDEFLAGS) $(OPTFLAGS) -c $<
+# We need to compile this file without -safe-string due mess with
+# lablgtk API. Other option is to require lablgtk >= 2.8.16
+ide/ideutils.cmo: ide/ideutils.ml
+ $(SHOW)'OCAMLC $<'
+ $(HIDE)$(filter-out -safe-string,$(OCAMLC)) $(COQIDEFLAGS) $(BYTEFLAGS) -c $<
+
+ide/ideutils.cmx: ide/ideutils.ml
+ $(SHOW)'OCAMLOPT $<'
+ $(HIDE)$(filter-out -safe-string,$(OCAMLOPT)) $(COQIDEFLAGS) $(filter-out -safe-string,$(OPTFLAGS)) -c $<
####################
## Install targets
diff --git a/Makefile.install b/Makefile.install
index 55229deb9..9a7229d52 100644
--- a/Makefile.install
+++ b/Makefile.install
@@ -101,12 +101,16 @@ INSTALLCMI = $(sort \
$(foreach lib,$(CORECMA), $(addsuffix .cmi,$($(lib:.cma=_MLLIB_DEPENDENCIES))))) \
$(PLUGINS:.cmo=.cmi)
+INSTALLCMX = $(sort $(filter-out checker/% ide/% tools/% dev/% configure.cmx, $(MLFILES:.ml=.cmx)))
+
install-devfiles:
$(MKDIR) $(FULLBINDIR)
- $(INSTALLBIN) $(COQMKTOP) $(FULLBINDIR)
$(MKDIR) $(FULLCOQLIB)
$(INSTALLSH) $(FULLCOQLIB) $(GRAMMARCMA)
- $(INSTALLSH) $(FULLCOQLIB) $(INSTALLCMI)
+ $(INSTALLSH) $(FULLCOQLIB) $(INSTALLCMI) # Regular CMI files
+ $(INSTALLSH) $(FULLCOQLIB) $(INSTALLCMX) # To avoid warning 58 "-opaque"
+ $(INSTALLSH) $(FULLCOQLIB) $(PLUGINSCMO:.cmo=.cmx) # For static linking of plugins
+ $(INSTALLSH) $(FULLCOQLIB) $(PLUGINSCMO:.cmo=.o) # For static linking of plugins
$(INSTALLSH) $(FULLCOQLIB) $(TOOLS_HELPERS)
ifeq ($(BEST),opt)
$(INSTALLSH) $(FULLCOQLIB) $(LINKCMX) $(CORECMA:.cma=.a) $(STATICPLUGINS:.cma=.a)
@@ -136,7 +140,7 @@ install-coq-info: install-coq-manpages install-emacs install-latex
MANPAGES:=man/coq-tex.1 man/coqdep.1 man/gallina.1 \
man/coqc.1 man/coqtop.1 man/coqtop.byte.1 man/coqtop.opt.1 \
man/coqwc.1 man/coqdoc.1 man/coqide.1 \
- man/coq_makefile.1 man/coqmktop.1 man/coqchk.1
+ man/coq_makefile.1 man/coqchk.1
install-coq-manpages:
$(MKDIR) $(FULLMANDIR)/man1
@@ -144,7 +148,7 @@ install-coq-manpages:
install-emacs:
$(MKDIR) $(FULLEMACSLIB)
- $(INSTALLLIB) tools/gallina-db.el tools/coq-font-lock.el tools/gallina-syntax.el tools/gallina.el tools/coq-inferior.el $(FULLEMACSLIB)
+ $(INSTALLLIB) tools/gallina-db.el tools/coq-font-lock.el tools/gallina-syntax.el tools/gallina.el tools/inferior-coq.el $(FULLEMACSLIB)
# command to update TeX' kpathsea database
#UPDATETEX = $(MKTEXLSR) /usr/share/texmf /var/spool/texmf $(BASETEXDIR) > /dev/null
diff --git a/README.doc b/README.doc
deleted file mode 100644
index 4e72c894b..000000000
--- a/README.doc
+++ /dev/null
@@ -1,18 +0,0 @@
- The Coq documentation
- =====================
-
-The Coq documentation includes:
-
-- a reference manual;
-- a generic tutorial on Coq;
-- a tutorial on recursive types;
-- a document presenting the Coq standard library;
-- a list of questions/answers in the FAQ style
-
-All these documents are available online from the Coq official site
-(http://coq.inria.fr), either as PS/PDF files or as HTML documents.
-
-The sources of the documentation are available along with the sources
-of the Coq proof assistant. It is released under the Open Publication
-License (see file doc/LICENSE in the sources of Coq)
-
diff --git a/README.md b/README.md
index 2ad512215..883630acf 100644
--- a/README.md
+++ b/README.md
@@ -1,29 +1,34 @@
# Coq
-[![Travis](https://travis-ci.org/coq/coq.svg?branch=master)](https://travis-ci.org/coq/coq/builds) [![Build status](https://ci.appveyor.com/api/projects/status/eln43k05pa2vm908/branch/master?svg=true)](https://ci.appveyor.com/project/coq/coq/branch/master) [![Gitter](https://badges.gitter.im/coq/coq.svg)](https://gitter.im/coq/coq)
+[![Travis](https://travis-ci.org/coq/coq.svg?branch=master)](https://travis-ci.org/coq/coq/builds)
+[![Appveyor](https://ci.appveyor.com/api/projects/status/eln43k05pa2vm908/branch/master?svg=true)](https://ci.appveyor.com/project/coq/coq/branch/master)
+[![Circle CI](https://circleci.com/gh/coq/coq/tree/master.svg?style=shield)](https://circleci.com/gh/coq/workflows/coq/tree/master)
+[![Gitter](https://badges.gitter.im/coq/coq.svg)](https://gitter.im/coq/coq)
+[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1003420.svg)](https://doi.org/10.5281/zenodo.1003420)
Coq is a formal proof management system. It provides a formal language to write
mathematical definitions, executable algorithms and theorems together with an
environment for semi-interactive development of machine-checked proofs.
## Installation
-Go to the [download page](https://coq.inria.fr/download) for Windows and MacOS packages;
+Download the pre-built packages of the [latest release](https://github.com/coq/coq/releases/latest) for Windows and MacOS;
read the [help page](https://coq.inria.fr/opam/www/using.html) on how to install Coq with OPAM;
or refer to the [`INSTALL` file](/INSTALL) for the procedure to install from source.
## Documentation
-The documentation is part of the archive in directory doc. The
+
+The sources of the documentation can be found in directory [`doc`](/doc). The
documentation of the last released version is available on the Coq
web site at [coq.inria.fr/documentation](http://coq.inria.fr/documentation).
+See also [Cocorico](https://github.com/coq/coq/wiki) (the Coq wiki),
+and the [Coq FAQ](https://github.com/coq/coq/wiki/The-Coq-FAQ),
+for additional user-contributed documentation.
## Changes
There is a file named [`CHANGES`](/CHANGES) that explains the differences and the
incompatibilities since last versions. If you upgrade Coq, please read
it carefully.
-## Availability
-Coq is available from [coq.inria.fr](http://coq.inria.fr).
-
## The Coq Club
The Coq Club moderated mailing list is meant to be a standard way
to discuss questions about the Coq system and related topics. The
@@ -38,11 +43,8 @@ The topics to be discussed in the club should include:
* theoretical questions about typed lambda-calculi which are
closely related to Coq.
-For any questions/suggestions about the Coq Club, please write to
-`coq-club-request@inria.fr`.
-
## Bugs report
-Please report any bug in [our issue tracker](https://github.com/coq/coq/issues).
+Please report any bug / feature request in [our issue tracker](https://github.com/coq/coq/issues).
To be effective, bug reports should mention the OCaml version used
to compile and run Coq, the Coq version (`coqtop -v`), the configuration
diff --git a/checker/analyze.ml b/checker/analyze.ml
index df75d5b93..7047d8a14 100644
--- a/checker/analyze.ml
+++ b/checker/analyze.ml
@@ -55,6 +55,55 @@ let magic_number = "\132\149\166\190"
(** Memory reification *)
+module LargeArray :
+sig
+ type 'a t
+ val empty : 'a t
+ val length : 'a t -> int
+ val make : int -> 'a -> 'a t
+ val get : 'a t -> int -> 'a
+ val set : 'a t -> int -> 'a -> unit
+end =
+struct
+
+ let max_length = Sys.max_array_length
+
+ type 'a t = 'a array array * 'a array
+ (** Invariants:
+ - All subarrays of the left array have length [max_length].
+ - The right array has length < [max_length].
+ *)
+
+ let empty = [||], [||]
+
+ let length (vl, vr) =
+ (max_length * Array.length vl) + Array.length vr
+
+ let make n x =
+ let k = n / max_length in
+ let r = n mod max_length in
+ let vl = Array.init k (fun _ -> Array.make max_length x) in
+ let vr = Array.make r x in
+ (vl, vr)
+
+ let get (vl, vr) n =
+ let k = n / max_length in
+ let r = n mod max_length in
+ let len = Array.length vl in
+ if k < len then vl.(k).(r)
+ else if k == len then vr.(r)
+ else invalid_arg "index out of bounds"
+
+ let set (vl, vr) n x =
+ let k = n / max_length in
+ let r = n mod max_length in
+ let len = Array.length vl in
+ if k < len then vl.(k).(r) <- x
+ else if k == len then vr.(r) <- x
+ else invalid_arg "index out of bounds"
+
+end
+
type repr =
| RInt of int
| RBlock of (int * int) (* tag × len *)
@@ -82,7 +131,7 @@ end
module type S =
sig
type input
- val parse : input -> (data * obj array)
+ val parse : input -> (data * obj LargeArray.t)
end
module Make(M : Input) =
@@ -261,7 +310,7 @@ let parse_object chan =
let parse chan =
let (magic, len, _, _, size) = parse_header chan in
let () = assert (magic = magic_number) in
- let memory = Array.make size (Struct ((-1), [||])) in
+ let memory = LargeArray.make size (Struct ((-1), [||])) in
let current_object = ref 0 in
let fill_obj = function
| RPointer n ->
@@ -272,7 +321,7 @@ let parse chan =
data, None
| RString s ->
let data = Ptr !current_object in
- let () = memory.(!current_object) <- String s in
+ let () = LargeArray.set memory !current_object (String s) in
let () = incr current_object in
data, None
| RBlock (tag, 0) ->
@@ -282,7 +331,7 @@ let parse chan =
| RBlock (tag, len) ->
let data = Ptr !current_object in
let nblock = Array.make len (Atm (-1)) in
- let () = memory.(!current_object) <- Struct (tag, nblock) in
+ let () = LargeArray.set memory !current_object (Struct (tag, nblock)) in
let () = incr current_object in
data, Some nblock
| RCode addr ->
@@ -343,3 +392,32 @@ module PString = Make(IString)
let parse_channel = PChannel.parse
let parse_string s = PString.parse (s, ref 0)
+
+let instantiate (p, mem) =
+ let len = LargeArray.length mem in
+ let ans = LargeArray.make len (Obj.repr 0) in
+ (** First pass: initialize the subobjects *)
+ for i = 0 to len - 1 do
+ let obj = match LargeArray.get mem i with
+ | Struct (tag, blk) -> Obj.new_block tag (Array.length blk)
+ | String str -> Obj.repr str
+ in
+ LargeArray.set ans i obj
+ done;
+ let get_data = function
+ | Int n -> Obj.repr n
+ | Ptr p -> LargeArray.get ans p
+ | Atm tag -> Obj.new_block tag 0
+ | Fun _ -> assert false (** We shouldn't serialize closures *)
+ in
+ (** Second pass: set the pointers *)
+ for i = 0 to len - 1 do
+ match LargeArray.get mem i with
+ | Struct (_, blk) ->
+ let obj = LargeArray.get ans i in
+ for k = 0 to Array.length blk - 1 do
+ Obj.set_field obj k (get_data blk.(k))
+ done
+ | String _ -> ()
+ done;
+ get_data p
diff --git a/checker/analyze.mli b/checker/analyze.mli
index 42efcf01d..9c837643f 100644
--- a/checker/analyze.mli
+++ b/checker/analyze.mli
@@ -8,8 +8,20 @@ type obj =
| Struct of int * data array (* tag × data *)
| String of string
-val parse_channel : in_channel -> (data * obj array)
-val parse_string : string -> (data * obj array)
+module LargeArray :
+sig
+ type 'a t
+ val empty : 'a t
+ val length : 'a t -> int
+ val make : int -> 'a -> 'a t
+ val get : 'a t -> int -> 'a
+ val set : 'a t -> int -> 'a -> unit
+end
+(** A data structure similar to arrays but allowing to overcome the 2^22 length
+ limitation on 32-bit architecture. *)
+
+val parse_channel : in_channel -> (data * obj LargeArray.t)
+val parse_string : string -> (data * obj LargeArray.t)
(** {6 Functorized version} *)
@@ -26,10 +38,13 @@ end
module type S =
sig
type input
- val parse : input -> (data * obj array)
+ val parse : input -> (data * obj LargeArray.t)
(** Return the entry point and the reification of the memory out of a
marshalled structure. *)
end
module Make (M : Input) : S with type input = M.t
(** Functorized version of the previous code. *)
+
+val instantiate : data * obj LargeArray.t -> Obj.t
+(** Create the OCaml object out of the reified representation. *)
diff --git a/checker/check.ml b/checker/check.ml
index 180ca1ece..82341ad9b 100644
--- a/checker/check.ml
+++ b/checker/check.ml
@@ -22,6 +22,11 @@ let extend_dirpath p id = DirPath.make (id :: DirPath.repr p)
type section_path = {
dirpath : string list ;
basename : string }
+
+type object_file =
+| PhysicalFile of CUnix.physical_path
+| LogicalFile of section_path
+
let dir_of_path p =
DirPath.make (List.map Id.of_string p.dirpath)
let path_of_dirpath dir =
@@ -69,11 +74,6 @@ let libraries_table = ref LibraryMap.empty
let find_library dir =
LibraryMap.find dir !libraries_table
-let try_find_library dir =
- try find_library dir
- with Not_found ->
- user_err Pp.(str ("Unknown library " ^ (DirPath.to_string dir)))
-
let library_full_filename dir = (find_library dir).library_filename
(* If a library is loaded several time, then the first occurrence must
@@ -129,8 +129,6 @@ type logical_path = DirPath.t
let load_paths = ref ([],[] : CUnix.physical_path list * logical_path list)
-let get_load_paths () = fst !load_paths
-
(* Hints to partially detects if two paths refer to the same repertory *)
let rec remove_path_dot p =
let curdir = Filename.concat Filename.current_dir_name "" in (* Unix: "./" *)
@@ -227,13 +225,8 @@ let locate_absolute_library dir =
let locate_qualified_library qid =
try
- let loadpath =
- (* Search library in loadpath *)
- if qid.dirpath=[] then get_load_paths ()
- else
- (* we assume qid is an absolute dirpath *)
- load_paths_of_dir_path (dir_of_path qid)
- in
+ (* we assume qid is an absolute dirpath *)
+ let loadpath = load_paths_of_dir_path (dir_of_path qid) in
if loadpath = [] then raise LibUnmappedDir;
let name = qid.basename^".vo" in
let path, file = System.where_in_path loadpath name in
@@ -263,7 +256,17 @@ let try_locate_absolute_library dir =
| LibUnmappedDir -> error_unmapped_dir (path_of_dirpath dir)
| LibNotFound -> error_lib_not_found (path_of_dirpath dir)
-let try_locate_qualified_library qid =
+let try_locate_qualified_library lib = match lib with
+| PhysicalFile f ->
+ let () =
+ if not (System.file_exists_respecting_case "" f) then
+ error_lib_not_found { dirpath = []; basename = f; }
+ in
+ let dir = Filename.dirname f in
+ let base = Filename.chop_extension (Filename.basename f) in
+ let dir = extend_dirpath (find_logical_path dir) (Id.of_string base) in
+ (dir, f)
+| LogicalFile qid ->
try
locate_qualified_library qid
with
@@ -298,18 +301,27 @@ let name_clash_message dir mdir f =
(* Dependency graph *)
let depgraph = ref LibraryMap.empty
+let marshal_in_segment f ch =
+ try
+ let stop = input_binary_int ch in
+ let v = Analyze.instantiate (Analyze.parse_channel ch) in
+ let digest = Digest.input ch in
+ Obj.obj v, stop, digest
+ with _ ->
+ user_err (str "Corrupted file " ++ quote (str f))
+
let intern_from_file (dir, f) =
Flags.if_verbose chk_pp (str"[intern "++str f++str" ...");
let (sd,md,table,opaque_csts,digest) =
try
let ch = System.with_magic_number_check raw_intern_library f in
- let (sd:Cic.summary_disk), _, digest = System.marshal_in_segment f ch in
- let (md:Cic.library_disk), _, digest = System.marshal_in_segment f ch in
- let (opaque_csts:'a option), _, udg = System.marshal_in_segment f ch in
- let (discharging:'a option), _, _ = System.marshal_in_segment f ch in
- let (tasks:'a option), _, _ = System.marshal_in_segment f ch in
+ let (sd:Cic.summary_disk), _, digest = marshal_in_segment f ch in
+ let (md:Cic.library_disk), _, digest = marshal_in_segment f ch in
+ let (opaque_csts:'a option), _, udg = marshal_in_segment f ch in
+ let (discharging:'a option), _, _ = marshal_in_segment f ch in
+ let (tasks:'a option), _, _ = marshal_in_segment f ch in
let (table:Cic.opaque_table), pos, checksum =
- System.marshal_in_segment f ch in
+ marshal_in_segment f ch in
(* Verification of the final checksum *)
let () = close_in ch in
let ch = open_in_bin f in
@@ -412,9 +424,3 @@ let recheck_library ~norec ~admit ~check =
(fun (dir,_) -> pr_dirpath dir ++ fnl()) needed));
List.iter (check_one_lib nochk) needed;
Flags.if_verbose Feedback.msg_notice (str"Modules were successfully checked")
-
-open Printf
-
-let mem s =
- let m = try_find_library s in
- h 0 (str (sprintf "%dk" (CObj.size_kb m)))
diff --git a/checker/check.mli b/checker/check.mli
new file mode 100644
index 000000000..28ae385b5
--- /dev/null
+++ b/checker/check.mli
@@ -0,0 +1,30 @@
+(************************************************************************)
+(* v * The Coq Proof Assistant / The Coq Development Team *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(************************************************************************)
+
+open CUnix
+open Names
+
+type section_path = {
+ dirpath : string list;
+ basename : string;
+}
+
+type object_file =
+| PhysicalFile of physical_path
+| LogicalFile of section_path
+
+type logical_path = DirPath.t
+
+val default_root_prefix : DirPath.t
+
+val add_load_path : physical_path * logical_path -> unit
+
+val recheck_library :
+ norec:object_file list ->
+ admit:object_file list ->
+ check:object_file list -> unit
diff --git a/checker/check.mllib b/checker/check.mllib
index 488507a13..f79ba66e3 100644
--- a/checker/check.mllib
+++ b/checker/check.mllib
@@ -1,5 +1,6 @@
Coq_config
+Analyze
Hook
Terminal
Canary
diff --git a/checker/checker.ml b/checker/checker.ml
index e960a55fd..b8b4d5dc2 100644
--- a/checker/checker.ml
+++ b/checker/checker.ml
@@ -40,9 +40,10 @@ let dirpath_of_string s =
[] -> Check.default_root_prefix
| dir -> DirPath.make (List.map Id.of_string dir)
let path_of_string s =
- match parse_dir s with
+ if Filename.check_suffix s ".vo" then PhysicalFile s
+ else match parse_dir s with
[] -> invalid_arg "path_of_string"
- | l::dir -> {dirpath=dir; basename=l}
+ | l::dir -> LogicalFile {dirpath=dir; basename=l}
let ( / ) = Filename.concat
@@ -95,17 +96,13 @@ let add_rec_path ~unix_path ~coq_root =
(* By the option -include -I or -R of the command line *)
let includes = ref []
-let push_include (s, alias) = includes := (s,alias,false) :: !includes
-let push_rec_include (s, alias) = includes := (s,alias,true) :: !includes
+let push_include (s, alias) = includes := (s,alias) :: !includes
let set_default_include d =
push_include (d, Check.default_root_prefix)
let set_include d p =
let p = dirpath_of_string p in
push_include (d,p)
-let set_rec_include d p =
- let p = dirpath_of_string p in
- push_rec_include(d,p)
(* Initializes the LoadPath *)
let init_load_path () =
@@ -131,8 +128,7 @@ let init_load_path () =
add_path ~unix_path:"." ~coq_root:Check.default_root_prefix;
(* additional loadpath, given with -I -include -R options *)
List.iter
- (fun (unix_path, coq_root, reci) ->
- if reci then add_rec_path ~unix_path ~coq_root else add_path ~unix_path ~coq_root)
+ (fun (unix_path, coq_root) -> add_rec_path ~unix_path ~coq_root)
(List.rev !includes);
includes := []
@@ -144,15 +140,15 @@ let set_impredicative_set () = impredicative_set := Cic.ImpredicativeSet
let engage () = Safe_typing.set_engagement (!impredicative_set)
-let admit_list = ref ([] : section_path list)
+let admit_list = ref ([] : object_file list)
let add_admit s =
admit_list := path_of_string s :: !admit_list
-let norec_list = ref ([] : section_path list)
+let norec_list = ref ([] : object_file list)
let add_norec s =
norec_list := path_of_string s :: !norec_list
-let compile_list = ref ([] : section_path list)
+let compile_list = ref ([] : object_file list)
let add_compile s =
compile_list := path_of_string s :: !compile_list
@@ -178,7 +174,9 @@ let print_usage_channel co command =
output_string co command;
output_string co "coqchk options are:\n";
output_string co
-" -R dir coqdir map physical dir to logical coqdir\
+" -Q dir coqdir map physical dir to logical coqdir\
+\n -R dir coqdir synonymous for -Q\
+\n\
\n\
\n -admit module load module and dependencies without checking\
\n -norec module check module but admit dependencies without checking\
@@ -210,8 +208,7 @@ let usage () =
open Type_errors
let anomaly_string () = str "Anomaly: "
-let report () = (str "." ++ spc () ++ str "Please report" ++
- strbrk "at " ++ str Coq_config.wwwbugtracker ++ str ".")
+let report () = strbrk (". Please report at " ^ Coq_config.wwwbugtracker ^ ".")
let guill s = str "\"" ++ str s ++ str "\""
@@ -310,6 +307,9 @@ let explain_exn = function
report ())
| e -> CErrors.print e (* for anomalies and other uncaught exceptions *)
+let deprecated flag =
+ Feedback.msg_warning (str "Deprecated flag " ++ quote (str flag))
+
let parse_args argv =
let rec parse = function
| [] -> ()
@@ -323,12 +323,15 @@ let parse_args argv =
Flags.coqlib_spec := true;
parse rem
- | ("-I"|"-include") :: d :: "-as" :: p :: rem -> set_include d p; parse rem
+ | ("-I"|"-include") :: d :: "-as" :: p :: rem -> deprecated "-I"; set_include d p; parse rem
| ("-I"|"-include") :: d :: "-as" :: [] -> usage ()
- | ("-I"|"-include") :: d :: rem -> set_default_include d; parse rem
+ | ("-I"|"-include") :: d :: rem -> deprecated "-I"; set_default_include d; parse rem
| ("-I"|"-include") :: [] -> usage ()
- | "-R" :: d :: p :: rem -> set_rec_include d p;parse rem
+ | "-Q" :: d :: p :: rem -> set_include d p;parse rem
+ | "-Q" :: ([] | [_]) -> usage ()
+
+ | "-R" :: d :: p :: rem -> set_include d p;parse rem
| "-R" :: ([] | [_]) -> usage ()
| "-debug" :: rem -> set_debug (); parse rem
diff --git a/checker/checker.mli b/checker/checker.mli
new file mode 100644
index 000000000..ceab13774
--- /dev/null
+++ b/checker/checker.mli
@@ -0,0 +1,9 @@
+(************************************************************************)
+(* v * The Coq Proof Assistant / The Coq Development Team *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(************************************************************************)
+
+val start : unit -> unit
diff --git a/checker/cic.mli b/checker/cic.mli
index 753fd0fc0..95dd18f5f 100644
--- a/checker/cic.mli
+++ b/checker/cic.mli
@@ -81,7 +81,7 @@ type 'constr pfixpoint =
type 'constr pcofixpoint =
int * 'constr prec_declaration
type 'a puniverses = 'a Univ.puniverses
-type pconstant = constant puniverses
+type pconstant = Constant.t puniverses
type pinductive = inductive puniverses
type pconstructor = constructor puniverses
@@ -127,12 +127,12 @@ type section_context = unit
type delta_hint =
| Inline of int * constr option
- | Equiv of kernel_name
+ | Equiv of KerName.t
-type delta_resolver = module_path MPmap.t * delta_hint KNmap.t
+type delta_resolver = ModPath.t MPmap.t * delta_hint KNmap.t
type 'a umap_t = 'a MPmap.t * 'a MBImap.t
-type substitution = (module_path * delta_resolver) umap_t
+type substitution = (ModPath.t * delta_resolver) umap_t
(** {6 Delayed constr} *)
@@ -170,6 +170,17 @@ type set_predicativity = ImpredicativeSet | PredicativeSet
type engagement = set_predicativity
+(** {6 Conversion oracle} *)
+
+type level = Expand | Level of int | Opaque
+
+type oracle = {
+ var_opacity : level Id.Map.t;
+ cst_opacity : level Cmap.t;
+ var_trstate : Id.Pred.t;
+ cst_trstate : Cpred.t;
+}
+
(** {6 Representation of constants (Definition/Axiom) } *)
@@ -194,7 +205,7 @@ type inline = int option
always transparent. *)
type projection_body = {
- proj_ind : mutual_inductive;
+ proj_ind : MutInd.t;
proj_npars : int;
proj_arg : int;
proj_type : constr; (* Type under params *)
@@ -208,7 +219,7 @@ type constant_def =
| OpaqueDef of lazy_constr
type constant_universes =
- | Monomorphic_const of Univ.universe_context
+ | Monomorphic_const of Univ.ContextSet.t
| Polymorphic_const of Univ.abstract_universe_context
(** The [typing_flags] are instructions to the type-checker which
@@ -219,6 +230,7 @@ type typing_flags = {
check_guarded : bool; (** If [false] then fixed points and co-fixed
points are assumed to be total. *)
check_universes : bool; (** If [false] universe constraints are not checked *)
+ conv_oracle : oracle; (** Unfolding strategies for conversion *)
}
type constant_body = {
@@ -241,7 +253,7 @@ type recarg =
type wf_paths = recarg Rtree.t
-type record_body = (Id.t * constant array * projection_body array) option
+type record_body = (Id.t * Constant.t array * projection_body array) option
(* The body is empty for non-primitive records, otherwise we get its
binder name in projections and list of projections if it is primitive. *)
@@ -303,7 +315,7 @@ type one_inductive_body = {
}
type abstract_inductive_universes =
- | Monomorphic_ind of Univ.universe_context
+ | Monomorphic_ind of Univ.ContextSet.t
| Polymorphic_ind of Univ.abstract_universe_context
| Cumulative_ind of Univ.abstract_cumulativity_info
@@ -347,12 +359,12 @@ type ('ty,'a) functorize =
only for short module printing and for extraction. *)
type with_declaration =
- | WithMod of Id.t list * module_path
+ | WithMod of Id.t list * ModPath.t
| WithDef of Id.t list * (constr * Univ.universe_context)
type module_alg_expr =
- | MEident of module_path
- | MEapply of module_alg_expr * module_path
+ | MEident of ModPath.t
+ | MEapply of module_alg_expr * ModPath.t
| MEwith of module_alg_expr * with_declaration
(** A component of a module structure *)
@@ -386,7 +398,7 @@ and module_implementation =
| FullStruct (** special case of [Struct] : the body is exactly [mod_type] *)
and 'a generic_module_body =
- { mod_mp : module_path; (** absolute path of the module *)
+ { mod_mp : ModPath.t; (** absolute path of the module *)
mod_expr : 'a; (** implementation *)
mod_type : module_signature; (** expanded type *)
(** algebraic type, kept if it's relevant for extraction *)
diff --git a/checker/closure.ml b/checker/closure.ml
index 70718bfdc..14b31e09d 100644
--- a/checker/closure.ml
+++ b/checker/closure.ml
@@ -49,13 +49,6 @@ let with_stats c =
end else
Lazy.force c
-type transparent_state = Id.Pred.t * Cpred.t
-let all_opaque = (Id.Pred.empty, Cpred.empty)
-let all_transparent = (Id.Pred.full, Cpred.full)
-
-let is_transparent_variable (ids, _) id = Id.Pred.mem id ids
-let is_transparent_constant (_, csts) cst = Cpred.mem cst csts
-
module type RedFlagsSig = sig
type reds
type red_kind
@@ -63,8 +56,6 @@ module type RedFlagsSig = sig
val fDELTA : red_kind
val fIOTA : red_kind
val fZETA : red_kind
- val fCONST : constant -> red_kind
- val fVAR : Id.t -> red_kind
val no_red : reds
val red_add : reds -> red_kind -> reds
val mkflags : red_kind list -> reds
@@ -80,51 +71,33 @@ module RedFlags = (struct
type reds = {
r_beta : bool;
r_delta : bool;
- r_const : transparent_state;
r_zeta : bool;
r_evar : bool;
r_iota : bool }
type red_kind = BETA | DELTA | IOTA | ZETA
- | CONST of constant | VAR of Id.t
+
let fBETA = BETA
let fDELTA = DELTA
let fIOTA = IOTA
let fZETA = ZETA
- let fCONST kn = CONST kn
- let fVAR id = VAR id
let no_red = {
r_beta = false;
r_delta = false;
- r_const = all_opaque;
r_zeta = false;
r_evar = false;
r_iota = false }
let red_add red = function
| BETA -> { red with r_beta = true }
- | DELTA -> { red with r_delta = true; r_const = all_transparent }
- | CONST kn ->
- let (l1,l2) = red.r_const in
- { red with r_const = l1, Cpred.add kn l2 }
+ | DELTA -> { red with r_delta = true}
| IOTA -> { red with r_iota = true }
| ZETA -> { red with r_zeta = true }
- | VAR id ->
- let (l1,l2) = red.r_const in
- { red with r_const = Id.Pred.add id l1, l2 }
let mkflags = List.fold_left red_add no_red
let red_set red = function
| BETA -> incr_cnt red.r_beta beta
- | CONST kn ->
- let (_,l) = red.r_const in
- let c = Cpred.mem kn l in
- incr_cnt c delta
- | VAR id -> (* En attendant d'avoir des kn pour les Var *)
- let (l,_) = red.r_const in
- let c = Id.Pred.mem id l in
- incr_cnt c delta
| ZETA -> incr_cnt red.r_zeta zeta
| IOTA -> incr_cnt red.r_iota iota
| DELTA -> (* Used for Rel/Var defined in context *)
@@ -165,7 +138,7 @@ type 'a tableKey =
| VarKey of Id.t
| RelKey of int
-type table_key = constant puniverses tableKey
+type table_key = Constant.t puniverses tableKey
module KeyHash =
struct
@@ -279,11 +252,10 @@ and fterm =
| FProj of projection * fconstr
| FFix of fixpoint * fconstr subs
| FCoFix of cofixpoint * fconstr subs
- | FCase of case_info * fconstr * fconstr * fconstr array
| FCaseT of case_info * constr * fconstr * constr array * fconstr subs (* predicate and branches are closures *)
- | FLambda of int * (name * constr) list * constr * fconstr subs
- | FProd of name * fconstr * fconstr
- | FLetIn of name * fconstr * fconstr * constr * fconstr subs
+ | FLambda of int * (Name.t * constr) list * constr * fconstr subs
+ | FProd of Name.t * fconstr * fconstr
+ | FLetIn of Name.t * fconstr * fconstr * constr * fconstr subs
| FEvar of existential_key * fconstr array (* why diff from kernel/closure? *)
| FLIFT of int * fconstr
| FCLOS of constr * fconstr subs
@@ -306,7 +278,6 @@ let update v1 (no,t) =
type stack_member =
| Zapp of fconstr array
- | Zcase of case_info * fconstr * fconstr array
| ZcaseT of case_info * constr * constr array * fconstr subs
| Zproj of int * int * projection
| Zfix of fconstr * stack
@@ -456,13 +427,10 @@ let rec to_constr constr_fun lfts v =
| FFlex (ConstKey op) -> Const op
| FInd op -> Ind op
| FConstruct op -> Construct op
- | FCase (ci,p,c,ve) ->
- Case (ci, constr_fun lfts p,
- constr_fun lfts c,
- Array.map (constr_fun lfts) ve)
- | FCaseT (ci,p,c,ve,e) -> (* TODO: enable sharing, cf FCLOS below ? *)
- to_constr constr_fun lfts
- {norm=Red;term=FCase(ci,mk_clos2 e p,c,mk_clos_vect e ve)}
+ | FCaseT (ci,p,c,ve,e) ->
+ let fp = mk_clos2 e p in
+ let fve = mk_clos_vect e ve in
+ Case (ci, constr_fun lfts fp, constr_fun lfts c, Array.map (constr_fun lfts) fve)
| FFix ((op,(lna,tys,bds)),e) ->
let n = Array.length bds in
let ftys = Array.map (mk_clos e) tys in
@@ -532,9 +500,6 @@ let rec zip m stk =
match stk with
| [] -> m
| Zapp args :: s -> zip {norm=neutr m.norm; term=FApp(m, args)} s
- | Zcase(ci,p,br)::s ->
- let t = FCase(ci, p, m, br) in
- zip {norm=neutr m.norm; term=t} s
| ZcaseT(ci,p,br,e)::s ->
let t = FCaseT(ci, p, m, br, e) in
zip {norm=neutr m.norm; term=t} s
@@ -616,7 +581,7 @@ let rec get_args n tys f e stk =
(* Eta expansion: add a reference to implicit surrounding lambda at end of stack *)
let rec eta_expand_stack = function
- | (Zapp _ | Zfix _ | Zcase _ | ZcaseT _ | Zproj _
+ | (Zapp _ | Zfix _ | ZcaseT _ | Zproj _
| Zshift _ | Zupdate _ as e) :: s ->
e :: eta_expand_stack s
| [] ->
@@ -708,6 +673,9 @@ let contract_fix_vect fix =
in
(subs_cons(Array.init nfix make_body, env), thisbody)
+let unfold_projection env p =
+ let pb = lookup_projection p env in
+ Zproj (pb.proj_npars, pb.proj_arg, p)
(*********************************************************************)
(* A machine that inspects the head of a term until it finds an
@@ -720,7 +688,6 @@ let rec knh info m stk =
| FCLOS(t,e) -> knht info e t (zupdate m stk)
| FLOCKED -> assert false
| FApp(a,b) -> knh info a (append_stack b (zupdate m stk))
- | FCase(ci,p,t,br) -> knh info t (Zcase(ci,p,br)::zupdate m stk)
| FCaseT(ci,p,t,br,env) -> knh info t (ZcaseT(ci,p,br,env)::zupdate m stk)
| FFix(((ri,n),(_,_,_)),_) ->
(match get_nth_arg m ri.(n) stk with
@@ -729,10 +696,9 @@ let rec knh info m stk =
| FCast(t,_,_) -> knh info t stk
| FProj (p,c) ->
- if red_set info.i_flags (fCONST (Projection.constant p)) then
- (let pb = lookup_projection p (info.i_env) in
- knh info c (Zproj (pb.proj_npars, pb.proj_arg, p)
- :: zupdate m stk))
+ if red_set info.i_flags fDELTA then
+ let s = unfold_projection info.i_env p in
+ knh info c (s :: zupdate m stk)
else (m,stk)
(* cases where knh stops *)
@@ -764,11 +730,11 @@ let rec knr info m stk =
(match get_args n tys f e stk with
Inl e', s -> knit info e' f s
| Inr lam, s -> (lam,s))
- | FFlex(ConstKey kn) when red_set info.i_flags (fCONST (fst kn)) ->
+ | FFlex(ConstKey kn) when red_set info.i_flags fDELTA ->
(match ref_value_cache info (ConstKey kn) with
Some v -> kni info v stk
| None -> (set_norm m; (m,stk)))
- | FFlex(VarKey id) when red_set info.i_flags (fVAR id) ->
+ | FFlex(VarKey id) when red_set info.i_flags fDELTA ->
(match ref_value_cache info (VarKey id) with
Some v -> kni info v stk
| None -> (set_norm m; (m,stk)))
@@ -778,10 +744,6 @@ let rec knr info m stk =
| None -> (set_norm m; (m,stk)))
| FConstruct((ind,c),u) when red_set info.i_flags fIOTA ->
(match strip_update_shift_app m stk with
- (depth, args, Zcase(ci,_,br)::s) ->
- assert (ci.ci_npar>=0);
- let rargs = drop_parameters depth ci.ci_npar args in
- kni info br.(c-1) (rargs@s)
| (depth, args, ZcaseT(ci,_,br,env)::s) ->
assert (ci.ci_npar>=0);
let rargs = drop_parameters depth ci.ci_npar args in
@@ -798,7 +760,7 @@ let rec knr info m stk =
| (_,args,s) -> (m,args@s))
| FCoFix _ when red_set info.i_flags fIOTA ->
(match strip_update_shift_app m stk with
- (_, args, (((Zcase _|ZcaseT _)::_) as stk')) ->
+ (_, args, (((ZcaseT _)::_) as stk')) ->
let (fxe,fxbd) = contract_fix_vect m.term in
knit info fxe fxbd (args@stk')
| (_,args,s) -> (m,args@s))
@@ -835,6 +797,7 @@ type clos_infos = fconstr infos
let infos_env x = x.i_env
let infos_flags x = x.i_flags
+let oracle_of_infos x = x.i_env.env_conv_oracle
let create_clos_infos flgs env =
create (fun _ -> inject) flgs env
diff --git a/checker/closure.mli b/checker/closure.mli
index ed5bb3d09..7bdc21b60 100644
--- a/checker/closure.mli
+++ b/checker/closure.mli
@@ -24,14 +24,6 @@ val with_stats: 'a Lazy.t -> 'a
Rem: reduction of a Rel/Var bound to a term is Delta, but reduction of
a LetIn expression is Letin reduction *)
-type transparent_state = Id.Pred.t * Cpred.t
-
-val all_opaque : transparent_state
-val all_transparent : transparent_state
-
-val is_transparent_variable : transparent_state -> variable -> bool
-val is_transparent_constant : transparent_state -> constant -> bool
-
(* Sets of reduction kinds. *)
module type RedFlagsSig = sig
type reds
@@ -42,8 +34,6 @@ module type RedFlagsSig = sig
val fDELTA : red_kind
val fIOTA : red_kind
val fZETA : red_kind
- val fCONST : constant -> red_kind
- val fVAR : Id.t -> red_kind
(* No reduction at all *)
val no_red : reds
@@ -71,7 +61,7 @@ type 'a tableKey =
| VarKey of Id.t
| RelKey of int
-type table_key = constant puniverses tableKey
+type table_key = Constant.t puniverses tableKey
type 'a infos
val ref_value_cache: 'a infos -> table_key -> 'a option
@@ -98,11 +88,10 @@ type fterm =
| FProj of projection * fconstr
| FFix of fixpoint * fconstr subs
| FCoFix of cofixpoint * fconstr subs
- | FCase of case_info * fconstr * fconstr * fconstr array
| FCaseT of case_info * constr * fconstr * constr array * fconstr subs (* predicate and branches are closures *)
- | FLambda of int * (name * constr) list * constr * fconstr subs
- | FProd of name * fconstr * fconstr
- | FLetIn of name * fconstr * fconstr * constr * fconstr subs
+ | FLambda of int * (Name.t * constr) list * constr * fconstr subs
+ | FProd of Name.t * fconstr * fconstr
+ | FLetIn of Name.t * fconstr * fconstr * constr * fconstr subs
| FEvar of existential_key * fconstr array
| FLIFT of int * fconstr
| FCLOS of constr * fconstr subs
@@ -115,7 +104,6 @@ type fterm =
type stack_member =
| Zapp of fconstr array
- | Zcase of case_info * fconstr * fconstr array
| ZcaseT of case_info * constr * constr array * fconstr subs
| Zproj of int * int * projection
| Zfix of fconstr * stack
@@ -133,6 +121,8 @@ val eta_expand_stack : stack -> stack
val eta_expand_ind_stack : env -> inductive -> fconstr -> stack ->
(fconstr * stack) -> stack * stack
+val unfold_projection : env -> Projection.t -> stack_member
+
(* To lazy reduce a constr, create a [clos_infos] with
[create_clos_infos], inject the term to reduce with [inject]; then use
a reduction function *)
@@ -142,13 +132,15 @@ val inject : constr -> fconstr
val fterm_of : fconstr -> fterm
val term_of_fconstr : fconstr -> constr
val destFLambda :
- (fconstr subs -> constr -> fconstr) -> fconstr -> name * fconstr * fconstr
+ (fconstr subs -> constr -> fconstr) -> fconstr -> Name.t * fconstr * fconstr
(* Global and local constant cache *)
type clos_infos
val create_clos_infos : reds -> env -> clos_infos
val infos_env : clos_infos -> env
val infos_flags : clos_infos -> reds
+val oracle_of_infos : clos_infos -> oracle
+
(* Reduction function *)
diff --git a/checker/declarations.ml b/checker/declarations.ml
index 884a1ef18..15b1f0a0c 100644
--- a/checker/declarations.ml
+++ b/checker/declarations.ml
@@ -484,8 +484,8 @@ let subst_wf_paths sub p = Rtree.smartmap (subst_recarg sub) p
let eq_recarg r1 r2 = match r1, r2 with
| Norec, Norec -> true
- | Mrec i1, Mrec i2 -> Names.eq_ind i1 i2
- | Imbr i1, Imbr i2 -> Names.eq_ind i1 i2
+ | Mrec i1, Mrec i2 -> Names.eq_ind_chk i1 i2
+ | Imbr i1, Imbr i2 -> Names.eq_ind_chk i1 i2
| _ -> false
let eq_wf_paths = Rtree.equal eq_recarg
diff --git a/checker/declarations.mli b/checker/declarations.mli
index 6fc71bb94..7458b3e0b 100644
--- a/checker/declarations.mli
+++ b/checker/declarations.mli
@@ -34,12 +34,12 @@ val empty_delta_resolver : delta_resolver
type 'a subst_fun = substitution -> 'a -> 'a
val empty_subst : substitution
-val add_mbid : MBId.t -> module_path -> substitution -> substitution
-val add_mp : module_path -> module_path -> substitution -> substitution
-val map_mbid : MBId.t -> module_path -> substitution
-val map_mp : module_path -> module_path -> substitution
-val mp_in_delta : module_path -> delta_resolver -> bool
-val mind_of_delta : delta_resolver -> mutual_inductive -> mutual_inductive
+val add_mbid : MBId.t -> ModPath.t -> substitution -> substitution
+val add_mp : ModPath.t -> ModPath.t -> substitution -> substitution
+val map_mbid : MBId.t -> ModPath.t -> substitution
+val map_mp : ModPath.t -> ModPath.t -> substitution
+val mp_in_delta : ModPath.t -> delta_resolver -> bool
+val mind_of_delta : delta_resolver -> MutInd.t -> MutInd.t
val subst_const_body : constant_body subst_fun
val subst_mind : mutual_inductive_body subst_fun
diff --git a/checker/environ.ml b/checker/environ.ml
index a0818012c..bbd043c8e 100644
--- a/checker/environ.ml
+++ b/checker/environ.ml
@@ -8,7 +8,7 @@ open Declarations
type globals = {
env_constants : constant_body Cmap_env.t;
env_inductives : mutual_inductive_body Mindmap_env.t;
- env_inductives_eq : kernel_name KNmap.t;
+ env_inductives_eq : KerName.t KNmap.t;
env_modules : module_body MPmap.t;
env_modtypes : module_type_body MPmap.t}
@@ -21,7 +21,15 @@ type env = {
env_globals : globals;
env_rel_context : rel_context;
env_stratification : stratification;
- env_imports : Cic.vodigest MPmap.t }
+ env_imports : Cic.vodigest MPmap.t;
+ env_conv_oracle : oracle; }
+
+let empty_oracle = {
+ var_opacity = Id.Map.empty;
+ cst_opacity = Cmap.empty;
+ var_trstate = Id.Pred.empty;
+ cst_trstate = Cpred.empty;
+}
let empty_env = {
env_globals =
@@ -34,7 +42,8 @@ let empty_env = {
env_stratification =
{ env_universes = Univ.initial_universes;
env_engagement = PredicativeSet };
- env_imports = MPmap.empty }
+ env_imports = MPmap.empty;
+ env_conv_oracle = empty_oracle }
let engagement env = env.env_stratification.env_engagement
let universes env = env.env_stratification.env_universes
@@ -51,6 +60,8 @@ let set_engagement (impr_set as c) env =
{ env with env_stratification =
{ env.env_stratification with env_engagement = c } }
+let set_oracle env oracle = { env with env_conv_oracle = oracle }
+
(* Digests *)
let add_digest env dp digest =
@@ -115,7 +126,7 @@ let add_constant kn cs env =
env_constants = new_constants } in
{ env with env_globals = new_globals }
-type const_evaluation_result = NoBody | Opaque | IsProj
+type const_evaluation_result = NoBody | Opaque
(* Constant types *)
@@ -137,18 +148,16 @@ exception NotEvaluableConst of const_evaluation_result
let constant_value env (kn,u) =
let cb = lookup_constant kn env in
- if cb.const_proj = None then
- match cb.const_body with
- | Def l_body ->
- let b = force_constr l_body in
- begin
- match cb.const_universes with
- | Monomorphic_const _ -> b
- | Polymorphic_const _ -> subst_instance_constr u (force_constr l_body)
- end
- | OpaqueDef _ -> raise (NotEvaluableConst Opaque)
- | Undef _ -> raise (NotEvaluableConst NoBody)
- else raise (NotEvaluableConst IsProj)
+ match cb.const_body with
+ | Def l_body ->
+ let b = force_constr l_body in
+ begin
+ match cb.const_universes with
+ | Monomorphic_const _ -> b
+ | Polymorphic_const _ -> subst_instance_constr u (force_constr l_body)
+ end
+ | OpaqueDef _ -> raise (NotEvaluableConst Opaque)
+ | Undef _ -> raise (NotEvaluableConst NoBody)
(* A global const is evaluable if it is defined and not opaque *)
let evaluable_constant cst env =
diff --git a/checker/environ.mli b/checker/environ.mli
index 8e8d0fd49..36e0ea027 100644
--- a/checker/environ.mli
+++ b/checker/environ.mli
@@ -6,7 +6,7 @@ open Cic
type globals = {
env_constants : constant_body Cmap_env.t;
env_inductives : mutual_inductive_body Mindmap_env.t;
- env_inductives_eq : kernel_name KNmap.t;
+ env_inductives_eq : KerName.t KNmap.t;
env_modules : module_body MPmap.t;
env_modtypes : module_type_body MPmap.t}
type stratification = {
@@ -18,6 +18,7 @@ type env = {
env_rel_context : rel_context;
env_stratification : stratification;
env_imports : Cic.vodigest MPmap.t;
+ env_conv_oracle : Cic.oracle;
}
val empty_env : env
@@ -25,6 +26,10 @@ val empty_env : env
val engagement : env -> Cic.engagement
val set_engagement : Cic.engagement -> env -> env
+(** Oracle *)
+
+val set_oracle : env -> Cic.oracle -> env
+
(* Digests *)
val add_digest : env -> DirPath.t -> Cic.vodigest -> env
val lookup_digest : env -> DirPath.t -> Cic.vodigest
@@ -34,7 +39,7 @@ val rel_context : env -> rel_context
val lookup_rel : int -> env -> rel_declaration
val push_rel : rel_declaration -> env -> env
val push_rel_context : rel_context -> env -> env
-val push_rec_types : name array * constr array * 'a -> env -> env
+val push_rec_types : Name.t array * constr array * 'a -> env -> env
(* Universes *)
val universes : env -> Univ.universes
@@ -44,31 +49,31 @@ val push_context_set : ?strict:bool -> Univ.universe_context_set -> env -> env
val check_constraints : Univ.constraints -> env -> bool
(* Constants *)
-val lookup_constant : constant -> env -> Cic.constant_body
-val add_constant : constant -> Cic.constant_body -> env -> env
-val constant_type : env -> constant puniverses -> constr Univ.constrained
-type const_evaluation_result = NoBody | Opaque | IsProj
+val lookup_constant : Constant.t -> env -> Cic.constant_body
+val add_constant : Constant.t -> Cic.constant_body -> env -> env
+val constant_type : env -> Constant.t puniverses -> constr Univ.constrained
+type const_evaluation_result = NoBody | Opaque
exception NotEvaluableConst of const_evaluation_result
-val constant_value : env -> constant puniverses -> constr
-val evaluable_constant : constant -> env -> bool
+val constant_value : env -> Constant.t puniverses -> constr
+val evaluable_constant : Constant.t -> env -> bool
-val is_projection : constant -> env -> bool
+val is_projection : Constant.t -> env -> bool
val lookup_projection : projection -> env -> projection_body
(* Inductives *)
val mind_equiv : env -> inductive -> inductive -> bool
val lookup_mind :
- mutual_inductive -> env -> Cic.mutual_inductive_body
+ MutInd.t -> env -> Cic.mutual_inductive_body
val add_mind :
- mutual_inductive -> Cic.mutual_inductive_body -> env -> env
+ MutInd.t -> Cic.mutual_inductive_body -> env -> env
(* Modules *)
val add_modtype :
- module_path -> Cic.module_type_body -> env -> env
+ ModPath.t -> Cic.module_type_body -> env -> env
val shallow_add_module :
- module_path -> Cic.module_body -> env -> env
-val shallow_remove_module : module_path -> env -> env
-val lookup_module : module_path -> env -> Cic.module_body
-val lookup_modtype : module_path -> env -> Cic.module_type_body
+ ModPath.t -> Cic.module_body -> env -> env
+val shallow_remove_module : ModPath.t -> env -> env
+val lookup_module : ModPath.t -> env -> Cic.module_body
+val lookup_modtype : ModPath.t -> env -> Cic.module_type_body
diff --git a/checker/indtypes.ml b/checker/indtypes.ml
index 22c843812..4de597766 100644
--- a/checker/indtypes.ml
+++ b/checker/indtypes.ml
@@ -502,10 +502,19 @@ let check_positivity_one (env, _,ntypes,_ as ienv) hyps nrecp (_,i as ind) indlc
indlc
in mk_paths (Mrec ind) irecargs
+let prrecarg = function
+ | Norec -> str "Norec"
+ | Mrec (mind,i) ->
+ str "Mrec[" ++ MutInd.debug_print mind ++ pr_comma () ++ int i ++ str "]"
+ | Imbr (mind,i) ->
+ str "Imbr[" ++ MutInd.debug_print mind ++ pr_comma () ++ int i ++ str "]"
+
let check_subtree t1 t2 =
let cmp_labels l1 l2 = l1 == Norec || eq_recarg l1 l2 in
if not (Rtree.equiv eq_recarg cmp_labels t1 t2)
- then failwith "bad recursive trees"
+ then user_err Pp.(str "Bad recursive tree: found " ++ fnl ()
+ ++ Rtree.pp_tree prrecarg t1 ++ fnl () ++ str " when expected " ++ fnl ()
+ ++ Rtree.pp_tree prrecarg t2)
(* if t1=t2 then () else msg_warning (str"TODO: check recursive positions")*)
let check_positivity env_ar mind params nrecp inds =
@@ -586,6 +595,8 @@ let check_inductive env kn mib =
Univ.AUContext.repr (Univ.ACumulativityInfo.univ_context cumi)
in
let env = Environ.push_context ind_ctx env in
+ (** Locally set the oracle for further typechecking *)
+ let env0 = Environ.set_oracle env mib.mind_typing_flags.conv_oracle in
(* check mind_record : TODO ? check #constructor = 1 ? *)
(* check mind_finite : always OK *)
(* check mind_ntypes *)
@@ -593,13 +604,13 @@ let check_inductive env kn mib =
user_err Pp.(str "not the right number of packets");
(* check mind_params_ctxt *)
let params = mib.mind_params_ctxt in
- let _ = check_ctxt env params in
+ let _ = check_ctxt env0 params in
(* check mind_nparams *)
if rel_context_nhyps params <> mib.mind_nparams then
user_err Pp.(str "number the right number of parameters");
(* mind_packets *)
(* - check arities *)
- let env_ar = typecheck_arity env params mib.mind_packets in
+ let env_ar = typecheck_arity env0 params mib.mind_packets in
(* - check constructor types *)
Array.iter (typecheck_one_inductive env_ar params mib) mib.mind_packets;
(* check the inferred subtyping relation *)
diff --git a/checker/indtypes.mli b/checker/indtypes.mli
index b0554989e..5d4c3ee99 100644
--- a/checker/indtypes.mli
+++ b/checker/indtypes.mli
@@ -12,8 +12,8 @@ open Cic
open Environ
(*i*)
-val prkn : kernel_name -> Pp.t
-val prcon : constant -> Pp.t
+val prkn : KerName.t -> Pp.t
+val prcon : Constant.t -> Pp.t
(*s The different kinds of errors that may result of a malformed inductive
definition. *)
@@ -34,4 +34,4 @@ exception InductiveError of inductive_error
(*s The following function does checks on inductive declarations. *)
-val check_inductive : env -> mutual_inductive -> mutual_inductive_body -> env
+val check_inductive : env -> MutInd.t -> mutual_inductive_body -> env
diff --git a/checker/inductive.ml b/checker/inductive.ml
index 1271a02b0..8d426a3c0 100644
--- a/checker/inductive.ml
+++ b/checker/inductive.ml
@@ -381,7 +381,7 @@ let type_case_branches env (pind,largs) (p,pj) c =
let check_case_info env indsp ci =
let (mib,mip) = lookup_mind_specif env indsp in
if
- not (eq_ind indsp ci.ci_ind) ||
+ not (eq_ind_chk indsp ci.ci_ind) ||
(mib.mind_nparams <> ci.ci_npar) ||
(mip.mind_consnrealdecls <> ci.ci_cstr_ndecls) ||
(mip.mind_consnrealargs <> ci.ci_cstr_nargs)
@@ -435,20 +435,14 @@ type subterm_spec =
| Dead_code
| Not_subterm
-let eq_recarg r1 r2 = match r1, r2 with
-| Norec, Norec -> true
-| Mrec i1, Mrec i2 -> Names.eq_ind i1 i2
-| Imbr i1, Imbr i2 -> Names.eq_ind i1 i2
-| _ -> false
-
let eq_wf_paths = Rtree.equal eq_recarg
let inter_recarg r1 r2 = match r1, r2 with
| Norec, Norec -> Some r1
| Mrec i1, Mrec i2
| Imbr i1, Imbr i2
-| Mrec i1, Imbr i2 -> if Names.eq_ind i1 i2 then Some r1 else None
-| Imbr i1, Mrec i2 -> if Names.eq_ind i1 i2 then Some r2 else None
+| Mrec i1, Imbr i2 -> if Names.eq_ind_chk i1 i2 then Some r1 else None
+| Imbr i1, Mrec i2 -> if Names.eq_ind_chk i1 i2 then Some r2 else None
| _ -> None
let inter_wf_paths = Rtree.inter eq_recarg inter_recarg Norec
@@ -544,7 +538,7 @@ let lookup_subterms env ind =
let match_inductive ind ra =
match ra with
- | (Mrec i | Imbr i) -> eq_ind ind i
+ | (Mrec i | Imbr i) -> eq_ind_chk ind i
| Norec -> false
(* In {match c as z in ci y_s return P with |C_i x_s => t end}
@@ -645,7 +639,7 @@ let get_recargs_approx env tree ind args =
(* When the inferred tree allows it, we consider that we have a potential
nested inductive type *)
begin match dest_recarg tree with
- | Imbr kn' | Mrec kn' when eq_ind (fst ind_kn) kn' ->
+ | Imbr kn' | Mrec kn' when eq_ind_chk (fst ind_kn) kn' ->
build_recargs_nested ienv tree (ind_kn, largs)
| _ -> mk_norec
end
@@ -1070,8 +1064,8 @@ let check_fix env ((nvect,_),(names,_,bodies as _recdef) as fix) =
done
(*
-let cfkey = Profile.declare_profile "check_fix";;
-let check_fix env fix = Profile.profile3 cfkey check_fix env fix;;
+let cfkey = CProfile.declare_profile "check_fix";;
+let check_fix env fix = CProfile.profile3 cfkey check_fix env fix;;
*)
(************************************************************************)
diff --git a/checker/inductive.mli b/checker/inductive.mli
index 8f605935d..0170bbc94 100644
--- a/checker/inductive.mli
+++ b/checker/inductive.mli
@@ -31,7 +31,7 @@ val type_of_inductive : env -> mind_specif puniverses -> constr
(* Return type as quoted by the user *)
val type_of_constructor : pconstructor -> mind_specif -> constr
-val arities_of_specif : mutual_inductive puniverses -> mind_specif -> constr array
+val arities_of_specif : MutInd.t puniverses -> mind_specif -> constr array
(* [type_case_branches env (I,args) (p:A) c] computes useful types
about the following Cases expression:
diff --git a/checker/main.mli b/checker/main.mli
new file mode 100644
index 000000000..e1555ba2e
--- /dev/null
+++ b/checker/main.mli
@@ -0,0 +1,10 @@
+(************************************************************************)
+(* v * The Coq Proof Assistant / The Coq Development Team *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(************************************************************************)
+
+(* This empty file avoids a race condition that occurs when compiling a .ml file
+ that does not have a corresponding .mli file *)
diff --git a/checker/mod_checking.ml b/checker/mod_checking.ml
index 63e28448f..7685863ea 100644
--- a/checker/mod_checking.ml
+++ b/checker/mod_checking.ml
@@ -26,10 +26,13 @@ let refresh_arity ar =
let check_constant_declaration env kn cb =
Flags.if_verbose Feedback.msg_notice (str " checking cst:" ++ prcon kn);
+ (** Locally set the oracle for further typechecking *)
+ let oracle = env.env_conv_oracle in
+ let env = Environ.set_oracle env cb.const_typing_flags.conv_oracle in
(** [env'] contains De Bruijn universe variables *)
let env' =
match cb.const_universes with
- | Monomorphic_const ctx -> push_context ~strict:true ctx env
+ | Monomorphic_const ctx -> push_context_set ~strict:true ctx env
| Polymorphic_const auctx ->
let ctx = Univ.AUContext.repr auctx in
push_context ~strict:false ctx env
@@ -53,8 +56,12 @@ let check_constant_declaration env kn cb =
conv_leq envty j ty)
| None -> ()
in
- if constant_is_polymorphic cb then add_constant kn cb env
- else add_constant kn cb env'
+ let env =
+ if constant_is_polymorphic cb then add_constant kn cb env
+ else add_constant kn cb env'
+ in
+ (** Reset the value of the oracle *)
+ Environ.set_oracle env oracle
(** {6 Checking modules } *)
diff --git a/checker/mod_checking.mli b/checker/mod_checking.mli
index 16a3792aa..c7af8b286 100644
--- a/checker/mod_checking.mli
+++ b/checker/mod_checking.mli
@@ -6,4 +6,4 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-val check_module : Environ.env -> Names.module_path -> Cic.module_body -> unit
+val check_module : Environ.env -> Names.ModPath.t -> Cic.module_body -> unit
diff --git a/checker/modops.mli b/checker/modops.mli
index 0efff63c8..b73557d92 100644
--- a/checker/modops.mli
+++ b/checker/modops.mli
@@ -15,7 +15,7 @@ open Environ
(* Various operations on modules and module types *)
val module_type_of_module :
- module_path option -> module_body -> module_type_body
+ ModPath.t option -> module_body -> module_type_body
val is_functor : ('ty,'a) functorize -> bool
@@ -24,24 +24,24 @@ val destr_functor : ('ty,'a) functorize -> MBId.t * 'ty * ('ty,'a) functorize
(* adds a module and its components, but not the constraints *)
val add_module : module_body -> env -> env
-val add_module_type : module_path -> module_type_body -> env -> env
+val add_module_type : ModPath.t -> module_type_body -> env -> env
-val strengthen : module_type_body -> module_path -> module_type_body
+val strengthen : module_type_body -> ModPath.t -> module_type_body
-val subst_and_strengthen : module_body -> module_path -> module_body
+val subst_and_strengthen : module_body -> ModPath.t -> module_body
val error_incompatible_modtypes :
module_type_body -> module_type_body -> 'a
-val error_not_match : label -> structure_field_body -> 'a
+val error_not_match : Label.t -> structure_field_body -> 'a
val error_with_module : unit -> 'a
-val error_no_such_label : label -> 'a
+val error_no_such_label : Label.t -> 'a
val error_no_such_label_sub :
- label -> module_path -> 'a
+ Label.t -> ModPath.t -> 'a
-val error_not_a_constant : label -> 'a
+val error_not_a_constant : Label.t -> 'a
-val error_not_a_module : label -> 'a
+val error_not_a_module : Label.t -> 'a
diff --git a/checker/print.mli b/checker/print.mli
new file mode 100644
index 000000000..3b2715de9
--- /dev/null
+++ b/checker/print.mli
@@ -0,0 +1,11 @@
+(************************************************************************)
+(* v * The Coq Proof Assistant / The Coq Development Team *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(************************************************************************)
+
+open Cic
+
+val print_pure_constr : constr -> unit
diff --git a/checker/reduction.ml b/checker/reduction.ml
index 6d8783d7e..29bb8901e 100644
--- a/checker/reduction.ml
+++ b/checker/reduction.ml
@@ -42,8 +42,8 @@ let compare_stack_shape stk1 stk2 =
| (_, Zapp l2::s2) -> compare_rec (bal-Array.length l2) stk1 s2
| (Zproj (n1,m1,p1)::s1, Zproj (n2,m2,p2)::s2) ->
Int.equal bal 0 && compare_rec 0 s1 s2
- | ((Zcase(c1,_,_)|ZcaseT(c1,_,_,_))::s1,
- (Zcase(c2,_,_)|ZcaseT(c2,_,_,_))::s2) ->
+ | ((ZcaseT(c1,_,_,_))::s1,
+ (ZcaseT(c2,_,_,_))::s2) ->
bal=0 (* && c1.ci_ind = c2.ci_ind *) && compare_rec 0 s1 s2
| (Zfix(_,a1)::s1, Zfix(_,a2)::s2) ->
bal=0 && compare_rec 0 a1 a2 && compare_rec 0 s1 s2
@@ -78,8 +78,7 @@ let pure_stack lfts stk =
(l, Zlfix((lfx,fx),pa)::pstk)
| (ZcaseT(ci,p,br,env),(l,pstk)) ->
(l,Zlcase(ci,l,mk_clos env p,mk_clos_vect env br)::pstk)
- | (Zcase(ci,p,br),(l,pstk)) ->
- (l,Zlcase(ci,l,p,br)::pstk)) in
+ ) in
snd (pure_rec lfts stk)
(****************************************************************************)
@@ -243,7 +242,6 @@ let rec no_arg_available = function
| Zshift _ :: stk -> no_arg_available stk
| Zapp v :: stk -> Array.length v = 0 && no_arg_available stk
| Zproj _ :: _ -> true
- | Zcase _ :: _ -> true
| ZcaseT _ :: _ -> true
| Zfix _ :: _ -> true
@@ -256,7 +254,6 @@ let rec no_nth_arg_available n = function
if n >= k then no_nth_arg_available (n-k) stk
else false
| Zproj _ :: _ -> true
- | Zcase _ :: _ -> true
| ZcaseT _ :: _ -> true
| Zfix _ :: _ -> true
@@ -266,13 +263,12 @@ let rec no_case_available = function
| Zshift _ :: stk -> no_case_available stk
| Zapp _ :: stk -> no_case_available stk
| Zproj (_,_,_) :: _ -> false
- | Zcase _ :: _ -> false
| ZcaseT _ :: _ -> false
| Zfix _ :: _ -> true
let in_whnf (t,stk) =
match fterm_of t with
- | (FLetIn _ | FCase _ | FCaseT _ | FApp _ | FCLOS _ | FLIFT _ | FCast _) -> false
+ | (FLetIn _ | FCaseT _ | FApp _ | FCLOS _ | FLIFT _ | FCast _) -> false
| FLambda _ -> no_arg_available stk
| FConstruct _ -> no_case_available stk
| FCoFix _ -> no_case_available stk
@@ -280,16 +276,29 @@ let in_whnf (t,stk) =
| (FFlex _ | FProd _ | FEvar _ | FInd _ | FAtom _ | FRel _ | FProj _) -> true
| FLOCKED -> assert false
-let oracle_order fl1 fl2 =
- match fl1,fl2 with
- ConstKey c1, ConstKey c2 -> (*height c1 > height c2*)false
- | _, ConstKey _ -> true
- | _ -> false
-
-let unfold_projection infos p c =
- let pb = lookup_projection p (infos_env infos) in
- let s = Zproj (pb.proj_npars, pb.proj_arg, p) in
- (c, s)
+let default_level = Level 0
+
+let get_strategy { var_opacity; cst_opacity } = function
+ | VarKey id ->
+ (try Names.Id.Map.find id var_opacity
+ with Not_found -> default_level)
+ | ConstKey (c, _) ->
+ (try Names.Cmap.find c cst_opacity
+ with Not_found -> default_level)
+ | RelKey _ -> Expand
+
+let oracle_order infos l2r k1 k2 =
+ let o = Closure.oracle_of_infos infos in
+ match get_strategy o k1, get_strategy o k2 with
+ | Expand, Expand -> l2r
+ | Expand, (Opaque | Level _) -> true
+ | (Opaque | Level _), Expand -> false
+ | Opaque, Opaque -> l2r
+ | Level _, Opaque -> true
+ | Opaque, Level _ -> false
+ | Level n1, Level n2 ->
+ if Int.equal n1 n2 then l2r
+ else n1 < n2
(* Conversion between [lft1]term1 and [lft2]term2 *)
let rec ccnv univ cv_pb infos lft1 lft2 term1 term2 =
@@ -343,7 +352,7 @@ and eqappr univ cv_pb infos (lft1,st1) (lft2,st2) =
with NotConvertible ->
(* else the oracle tells which constant is to be expanded *)
let (app1,app2) =
- if oracle_order fl1 fl2 then
+ if oracle_order infos false fl1 fl2 then
match unfold_reference infos fl1 with
| Some def1 -> ((lft1, whd_stack infos def1 v1), appr2)
| None ->
@@ -360,12 +369,12 @@ and eqappr univ cv_pb infos (lft1,st1) (lft2,st2) =
eqappr univ cv_pb infos app1 app2)
| (FProj (p1,c1), _) ->
- let (def1, s1) = unfold_projection infos p1 c1 in
- eqappr univ cv_pb infos (lft1, whd_stack infos def1 (s1 :: v1)) appr2
+ let s1 = unfold_projection (infos_env infos) p1 in
+ eqappr univ cv_pb infos (lft1, whd_stack infos c1 (s1 :: v1)) appr2
| (_, FProj (p2,c2)) ->
- let (def2, s2) = unfold_projection infos p2 c2 in
- eqappr univ cv_pb infos appr1 (lft2, whd_stack infos def2 (s2 :: v2))
+ let s2 = unfold_projection (infos_env infos) p2 in
+ eqappr univ cv_pb infos appr1 (lft2, whd_stack infos c2 (s2 :: v2))
(* other constructors *)
| (FLambda _, FLambda _) ->
@@ -504,8 +513,8 @@ and eqappr univ cv_pb infos (lft1,st1) (lft2,st2) =
else raise NotConvertible
(* Should not happen because both (hd1,v1) and (hd2,v2) are in whnf *)
- | ( (FLetIn _, _) | (FCase _,_) | (FCaseT _,_) | (FApp _,_) | (FCLOS _,_) | (FLIFT _,_)
- | (_, FLetIn _) | (_,FCase _) | (_,FCaseT _) | (_,FApp _) | (_,FCLOS _) | (_,FLIFT _)
+ | ( (FLetIn _, _) | (FCaseT _,_) | (FApp _,_) | (FCLOS _,_) | (FLIFT _,_)
+ | (_, FLetIn _) | (_,FCaseT _) | (_,FApp _) | (_,FCLOS _) | (_,FLIFT _)
| (FLOCKED,_) | (_,FLOCKED) ) -> assert false
(* In all other cases, terms are not convertible *)
diff --git a/checker/term.mli b/checker/term.mli
index 679a56ee4..2524dff18 100644
--- a/checker/term.mli
+++ b/checker/term.mli
@@ -38,8 +38,8 @@ val fold_rel_context_outside :
val map_rel_decl : (constr -> constr) -> rel_declaration -> rel_declaration
val map_rel_context : (constr -> constr) -> rel_context -> rel_context
val extended_rel_list : int -> rel_context -> constr list
-val compose_lam : (name * constr) list -> constr -> constr
-val decompose_lam : constr -> (name * constr) list * constr
+val compose_lam : (Name.t * constr) list -> constr -> constr
+val decompose_lam : constr -> (Name.t * constr) list * constr
val decompose_lam_n_assum : int -> constr -> rel_context * constr
val mkProd_or_LetIn : rel_declaration -> constr -> constr
val it_mkProd_or_LetIn : constr -> rel_context -> constr
diff --git a/checker/type_errors.ml b/checker/type_errors.ml
index c5a69efdc..5794d8713 100644
--- a/checker/type_errors.ml
+++ b/checker/type_errors.ml
@@ -52,14 +52,14 @@ type type_error =
| WrongCaseInfo of inductive * case_info
| NumberBranches of unsafe_judgment * int
| IllFormedBranch of constr * int * constr * constr
- | Generalization of (name * constr) * unsafe_judgment
+ | Generalization of (Name.t * constr) * unsafe_judgment
| ActualType of unsafe_judgment * constr
| CantApplyBadType of
(int * constr * constr) * unsafe_judgment * unsafe_judgment array
| CantApplyNonFunctional of unsafe_judgment * unsafe_judgment array
- | IllFormedRecBody of guard_error * name array * int
+ | IllFormedRecBody of guard_error * Name.t array * int
| IllTypedRecBody of
- int * name array * unsafe_judgment array * constr array
+ int * Name.t array * unsafe_judgment array * constr array
| UnsatisfiedConstraints of Univ.constraints
exception TypeError of env * type_error
diff --git a/checker/type_errors.mli b/checker/type_errors.mli
index b5f14c718..f45144c23 100644
--- a/checker/type_errors.mli
+++ b/checker/type_errors.mli
@@ -54,14 +54,14 @@ type type_error =
| WrongCaseInfo of inductive * case_info
| NumberBranches of unsafe_judgment * int
| IllFormedBranch of constr * int * constr * constr
- | Generalization of (name * constr) * unsafe_judgment
+ | Generalization of (Name.t * constr) * unsafe_judgment
| ActualType of unsafe_judgment * constr
| CantApplyBadType of
(int * constr * constr) * unsafe_judgment * unsafe_judgment array
| CantApplyNonFunctional of unsafe_judgment * unsafe_judgment array
- | IllFormedRecBody of guard_error * name array * int
+ | IllFormedRecBody of guard_error * Name.t array * int
| IllTypedRecBody of
- int * name array * unsafe_judgment array * constr array
+ int * Name.t array * unsafe_judgment array * constr array
| UnsatisfiedConstraints of Univ.constraints
exception TypeError of env * type_error
@@ -96,9 +96,9 @@ val error_cant_apply_bad_type :
unsafe_judgment -> unsafe_judgment array -> 'a
val error_ill_formed_rec_body :
- env -> guard_error -> name array -> int -> 'a
+ env -> guard_error -> Name.t array -> int -> 'a
val error_ill_typed_rec_body :
- env -> int -> name array -> unsafe_judgment array -> constr array -> 'a
+ env -> int -> Name.t array -> unsafe_judgment array -> constr array -> 'a
val error_unsatisfied_constraints : env -> Univ.constraints -> 'a
diff --git a/checker/univ.ml b/checker/univ.ml
index 4f3131813..7d01657df 100644
--- a/checker/univ.ml
+++ b/checker/univ.ml
@@ -881,14 +881,6 @@ type universe_level_subst = universe_level universe_map
(** A full substitution might involve algebraic universes *)
type universe_subst = universe universe_map
-let level_subst_of f =
- fun l ->
- try let u = f l in
- match Universe.level u with
- | None -> l
- | Some l -> l
- with Not_found -> l
-
module Instance : sig
type t = Level.t array
diff --git a/checker/univ.mli b/checker/univ.mli
index 0eadc6801..21c94d952 100644
--- a/checker/univ.mli
+++ b/checker/univ.mli
@@ -150,8 +150,6 @@ type universe_level_subst_fn = universe_level -> universe_level
type universe_subst = universe universe_map
type universe_level_subst = universe_level universe_map
-val level_subst_of : universe_subst_fn -> universe_level_subst_fn
-
(** {6 Universe instances} *)
module Instance :
diff --git a/checker/validate.ml b/checker/validate.ml
index 820040587..2624e6d49 100644
--- a/checker/validate.ml
+++ b/checker/validate.ml
@@ -49,8 +49,6 @@ let (/) (ctx:error_context) s : error_context = s::ctx
exception ValidObjError of string * error_context * Obj.t
let fail ctx o s = raise (ValidObjError(s,ctx,o))
-type func = error_context -> Obj.t -> unit
-
(* Check that object o is a block with tag t *)
let val_tag t ctx o =
if Obj.is_block o && Obj.tag o = t then ()
diff --git a/checker/validate.mli b/checker/validate.mli
new file mode 100644
index 000000000..7eed692a0
--- /dev/null
+++ b/checker/validate.mli
@@ -0,0 +1,9 @@
+(************************************************************************)
+(* v * The Coq Proof Assistant / The Coq Development Team *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(************************************************************************)
+
+val validate : bool -> Values.value -> 'a -> unit
diff --git a/checker/values.ml b/checker/values.ml
index 86634fbd8..313067cb6 100644
--- a/checker/values.ml
+++ b/checker/values.ml
@@ -13,7 +13,7 @@
To ensure this file is up-to-date, 'make' now compares the md5 of cic.mli
with a copy we maintain here:
-MD5 62a4037e9e584d508909d631c5e8a759 checker/cic.mli
+MD5 483493b20fe91cc1bea4350a2db2f82d checker/cic.mli
*)
@@ -70,6 +70,8 @@ let v_map vk vd =
let v_hset v = v_map Int (v_set v)
let v_hmap vk vd = v_map Int (v_map vk vd)
+let v_pred v = v_pair v_bool (v_set v)
+
(* lib/future *)
let v_computation f =
Annot ("Future.computation",
@@ -199,6 +201,17 @@ let v_lazy_constr =
let v_impredicative_set = v_enum "impr-set" 2
let v_engagement = v_impredicative_set
+let v_conv_level =
+ v_sum "conv_level" 2 [|[|Int|]|]
+
+let v_oracle =
+ v_tuple "oracle" [|
+ v_map v_id v_conv_level;
+ v_hmap v_cst v_conv_level;
+ v_pred v_id;
+ v_pred v_cst;
+ |]
+
let v_pol_arity =
v_tuple "polymorphic_arity" [|List(Opt v_level);v_univ|]
@@ -213,9 +226,9 @@ let v_projbody =
v_constr|]
let v_typing_flags =
- v_tuple "typing_flags" [|v_bool; v_bool|]
+ v_tuple "typing_flags" [|v_bool; v_bool; v_oracle|]
-let v_const_univs = v_sum "constant_universes" 0 [|[|v_context|]; [|v_abs_context|]|]
+let v_const_univs = v_sum "constant_universes" 0 [|[|v_context_set|]; [|v_abs_context|]|]
let v_cb = v_tuple "constant_body"
[|v_section_ctxt;
@@ -265,7 +278,7 @@ let v_mind_record = Annot ("mind_record",
let v_ind_pack_univs =
v_sum "abstract_inductive_universes" 0
- [|[|v_context|]; [|v_abs_context|]; [|v_abs_cum_info|]|]
+ [|[|v_context_set|]; [|v_abs_context|]; [|v_abs_cum_info|]|]
let v_ind_pack = v_tuple "mutual_inductive_body"
[|Array v_one_ind;
@@ -372,22 +385,3 @@ let v_lib =
let v_opaques = Array (v_computation v_constr)
let v_univopaques =
Opt (Tuple ("univopaques",[|Array (v_computation v_context_set);v_context_set;v_bool|]))
-
-(** Registering dynamic values *)
-
-module IntOrd =
-struct
- type t = int
- let compare (x : t) (y : t) = compare x y
-end
-
-module IntMap = Map.Make(IntOrd)
-
-let dyn_table : value IntMap.t ref = ref IntMap.empty
-
-let register_dyn name t =
- dyn_table := IntMap.add name t !dyn_table
-
-let find_dyn name =
- try IntMap.find name !dyn_table
- with Not_found -> Any
diff --git a/checker/values.mli b/checker/values.mli
new file mode 100644
index 000000000..aad8fd5f4
--- /dev/null
+++ b/checker/values.mli
@@ -0,0 +1,26 @@
+(************************************************************************)
+(* v * The Coq Proof Assistant / The Coq Development Team *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(************************************************************************)
+
+type value =
+ | Any
+ | Fail of string
+ | Tuple of string * value array
+ | Sum of string * int * value array array
+ | Array of value
+ | List of value
+ | Opt of value
+ | Int
+ | String
+ | Annot of string * value
+ | Dyn
+
+val v_univopaques : value
+val v_libsum : value
+val v_lib : value
+val v_opaques : value
+val v_stm_seg : value
diff --git a/checker/votour.ml b/checker/votour.ml
index 0998bb94b..8cb97a2b1 100644
--- a/checker/votour.ml
+++ b/checker/votour.ml
@@ -10,6 +10,8 @@ open Values
(** {6 Interactive visit of a vo} *)
+let max_string_length = 1024
+
let rec read_num max =
let quit () =
Printf.printf "\nGoodbye!\n%!";
@@ -75,48 +77,51 @@ struct
type obj = data
- let memory = ref [||]
- let sizes = ref [||]
+ let memory = ref LargeArray.empty
+ let sizes = ref LargeArray.empty
(** size, in words *)
let ws = Sys.word_size / 8
- let rec init_size seen = function
- | Int _ | Atm _ | Fun _ -> 0
+ let rec init_size seen k = function
+ | Int _ | Atm _ | Fun _ -> k 0
| Ptr p ->
- if seen.(p) then 0
+ if LargeArray.get seen p then k 0
else
- let () = seen.(p) <- true in
- match (!memory).(p) with
+ let () = LargeArray.set seen p true in
+ match LargeArray.get !memory p with
| Struct (tag, os) ->
- let fold accu o = accu + 1 + init_size seen o in
- let size = Array.fold_left fold 1 os in
- let () = (!sizes).(p) <- size in
- size
+ let len = Array.length os in
+ let rec fold i accu k =
+ if i == len then k accu
+ else
+ init_size seen (fun n -> fold (succ i) (accu + 1 + n) k) os.(i)
+ in
+ fold 0 1 (fun size -> let () = LargeArray.set !sizes p size in k size)
| String s ->
let size = 2 + (String.length s / ws) in
- let () = (!sizes).(p) <- size in
- size
+ let () = LargeArray.set !sizes p size in
+ k size
let size = function
| Int _ | Atm _ | Fun _ -> 0
- | Ptr p -> (!sizes).(p)
+ | Ptr p -> LargeArray.get !sizes p
let repr = function
| Int i -> INT i
| Atm t -> BLOCK (t, [||])
| Fun _ -> OTHER
| Ptr p ->
- match (!memory).(p) with
+ match LargeArray.get !memory p with
| Struct (tag, os) -> BLOCK (tag, os)
| String s -> STRING s
let input ch =
let obj, mem = parse_channel ch in
let () = memory := mem in
- let () = sizes := Array.make (Array.length mem) (-1) in
- let seen = Array.make (Array.length mem) false in
- let _ = init_size seen obj in
+ let () = sizes := LargeArray.make (LargeArray.length mem) (-1) in
+ let seen = LargeArray.make (LargeArray.length mem) false in
+ let () = init_size seen ignore obj in
obj
let oid = function
@@ -155,7 +160,8 @@ let get_string_in_tuple o =
for i = 0 to Array.length o - 1 do
match Repr.repr o.(i) with
| STRING s ->
- raise (TupleString (Printf.sprintf " [..%s..]" s))
+ let len = min max_string_length (String.length s) in
+ raise (TupleString (Printf.sprintf " [..%s..]" (String.sub s 0 len)))
| _ -> ()
done;
""
@@ -165,7 +171,8 @@ let get_string_in_tuple o =
let rec get_details v o = match v, Repr.repr o with
| (String | Any), STRING s ->
- Printf.sprintf " [%s]" (String.escaped s)
+ let len = min max_string_length (String.length s) in
+ Printf.sprintf " [%s]" (String.escaped (String.sub s 0 len))
|Tuple (_,v), BLOCK (_, o) -> get_string_in_tuple o
|(Sum _|Any), BLOCK (tag, _) ->
Printf.sprintf " [tag=%i]" tag
@@ -192,18 +199,17 @@ let access_children vs os pos =
else raise Exit
let access_list v o pos =
- let rec loop o pos = match Repr.repr o with
- | INT 0 -> []
+ let rec loop o pos accu = match Repr.repr o with
+ | INT 0 -> List.rev accu
| BLOCK (0, [|hd; tl|]) ->
- (v, hd, 0 :: pos) :: loop tl (1 :: pos)
+ loop tl (1 :: pos) ((v, hd, 0 :: pos) :: accu)
| _ -> raise Exit
in
- Array.of_list (loop o pos)
+ Array.of_list (loop o pos [])
let access_block o = match Repr.repr o with
| BLOCK (tag, os) -> (tag, os)
| _ -> raise Exit
-let access_int o = match Repr.repr o with INT i -> i | _ -> raise Exit
(** raises Exit if the object has not the expected structure *)
exception Forbidden
@@ -227,14 +233,22 @@ let rec get_children v o pos = match v with
| BLOCK (0, [|x|]) -> [|(v, x, 0 :: pos)|]
| _ -> raise Exit
end
- |String | Int -> [||]
+ | String ->
+ begin match Repr.repr o with
+ | STRING _ -> [||]
+ | _ -> raise Exit
+ end
+ | Int ->
+ begin match Repr.repr o with
+ | INT _ -> [||]
+ | _ -> raise Exit
+ end
|Annot (s,v) -> get_children v o pos
|Any -> raise Exit
|Dyn ->
begin match Repr.repr o with
| BLOCK (0, [|id; o|]) ->
- let n = access_int id in
- let tpe = find_dyn n in
+ let tpe = Any in
[|(Int, id, 0 :: pos); (tpe, o, 1 :: pos)|]
| _ -> raise Exit
end
@@ -379,7 +393,7 @@ let visit_vo f =
| None -> ()
done
-let main =
+let () =
if not !Sys.interactive then
Arg.parse [] visit_vo
("votour: guided tour of a Coq .vo or .vi file\n"^
diff --git a/checker/votour.mli b/checker/votour.mli
new file mode 100644
index 000000000..e1555ba2e
--- /dev/null
+++ b/checker/votour.mli
@@ -0,0 +1,10 @@
+(************************************************************************)
+(* v * The Coq Proof Assistant / The Coq Development Team *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(************************************************************************)
+
+(* This empty file avoids a race condition that occurs when compiling a .ml file
+ that does not have a corresponding .mli file *)
diff --git a/lib/backtrace.ml b/clib/backtrace.ml
index be9f40c1f..be9f40c1f 100644
--- a/lib/backtrace.ml
+++ b/clib/backtrace.ml
diff --git a/lib/backtrace.mli b/clib/backtrace.mli
index dd82165b6..dd82165b6 100644
--- a/lib/backtrace.mli
+++ b/clib/backtrace.mli
diff --git a/lib/bigint.ml b/clib/bigint.ml
index 4f8b95d59..4f8b95d59 100644
--- a/lib/bigint.ml
+++ b/clib/bigint.ml
diff --git a/lib/bigint.mli b/clib/bigint.mli
index 2a5a5f122..2a5a5f122 100644
--- a/lib/bigint.mli
+++ b/clib/bigint.mli
diff --git a/lib/cArray.ml b/clib/cArray.ml
index 013585735..013585735 100644
--- a/lib/cArray.ml
+++ b/clib/cArray.ml
diff --git a/lib/cArray.mli b/clib/cArray.mli
index 325ff8edc..325ff8edc 100644
--- a/lib/cArray.mli
+++ b/clib/cArray.mli
diff --git a/lib/cEphemeron.ml b/clib/cEphemeron.ml
index 8b253a790..8b253a790 100644
--- a/lib/cEphemeron.ml
+++ b/clib/cEphemeron.ml
diff --git a/lib/cEphemeron.mli b/clib/cEphemeron.mli
index d8a1f2757..d8a1f2757 100644
--- a/lib/cEphemeron.mli
+++ b/clib/cEphemeron.mli
diff --git a/lib/cList.ml b/clib/cList.ml
index ca69628af..0ef7c3d8b 100644
--- a/lib/cList.ml
+++ b/clib/cList.ml
@@ -96,6 +96,8 @@ sig
val fold_right_map : ('b -> 'a -> 'c * 'a) -> 'b list -> 'a -> 'c list * 'a
val fold_left2_map : ('a -> 'b -> 'c -> 'a * 'd) -> 'a -> 'b list -> 'c list -> 'a * 'd list
val fold_right2_map : ('b -> 'c -> 'a -> 'd * 'a) -> 'b list -> 'c list -> 'a -> 'd list * 'a
+ val fold_left3_map : ('a -> 'b -> 'c -> 'd -> 'a * 'e) -> 'a -> 'b list -> 'c list -> 'd list -> 'a * 'e list
+ val fold_left4_map : ('a -> 'b -> 'c -> 'd -> 'e -> 'a * 'r) -> 'a -> 'b list -> 'c list -> 'd list -> 'e list -> 'a * 'r list
val fold_map : ('a -> 'b -> 'a * 'c) -> 'a -> 'b list -> 'a * 'c list
val fold_map' : ('b -> 'a -> 'c * 'a) -> 'b list -> 'a -> 'c list * 'a
val map_assoc : ('a -> 'b) -> ('c * 'a) list -> ('c * 'b) list
@@ -446,6 +448,12 @@ let rec fold_left3 f accu l1 l2 l3 =
| (a1::l1, a2::l2, a3::l3) -> fold_left3 f (f accu a1 a2 a3) l1 l2 l3
| (_, _, _) -> invalid_arg "List.fold_left3"
+let rec fold_left4 f accu l1 l2 l3 l4 =
+ match (l1, l2, l3, l4) with
+ ([], [], [], []) -> accu
+ | (a1::l1, a2::l2, a3::l3, a4::l4) -> fold_left4 f (f accu a1 a2 a3 a4) l1 l2 l3 l4
+ | (_,_, _, _) -> invalid_arg "List.fold_left4"
+
(* [fold_right_and_left f [a1;...;an] hd =
f (f (... (f (f hd
an
@@ -765,12 +773,13 @@ let share_tails l1 l2 =
in
shr_rev [] (List.rev l1, List.rev l2)
+(* Poor man's monadic map *)
let rec fold_left_map f e = function
- | [] -> (e,[])
- | h::t ->
- let e',h' = f e h in
- let e'',t' = fold_left_map f e' t in
- e'',h'::t'
+ | [] -> (e,[])
+ | h::t ->
+ let e',h' = f e h in
+ let e'',t' = fold_left_map f e' t in
+ e'',h'::t'
let fold_map = fold_left_map
@@ -790,12 +799,26 @@ let fold_right_map f l e =
let fold_map' = fold_right_map
+let on_snd f (x,y) = (x,f y)
+
let fold_left2_map f e l l' =
- List.fold_left2 (fun (e,l) x x' -> let (e,y) = f e x x' in (e,y::l)) (e,[]) l l'
+ on_snd List.rev @@
+ List.fold_left2 (fun (e,l) x x' ->
+ let (e,y) = f e x x' in
+ (e, y::l)
+ ) (e, []) l l'
let fold_right2_map f l l' e =
List.fold_right2 (fun x x' (l,e) -> let (y,e) = f x x' e in (y::l,e)) l l' ([],e)
+let fold_left3_map f e l l' l'' =
+ on_snd List.rev @@
+ fold_left3 (fun (e,l) x x' x'' -> let (e,y) = f e x x' x'' in (e,y::l)) (e,[]) l l' l''
+
+let fold_left4_map f e l1 l2 l3 l4 =
+ on_snd List.rev @@
+ fold_left4 (fun (e,l) x1 x2 x3 x4 -> let (e,y) = f e x1 x2 x3 x4 in (e,y::l)) (e,[]) l1 l2 l3 l4
+
let map_assoc f = List.map (fun (x,a) -> (x,f a))
let rec assoc_f f a = function
diff --git a/lib/cList.mli b/clib/cList.mli
index 8cb07da79..f87db04cf 100644
--- a/lib/cList.mli
+++ b/clib/cList.mli
@@ -211,7 +211,14 @@ sig
val fold_right2_map : ('b -> 'c -> 'a -> 'd * 'a) -> 'b list -> 'c list -> 'a -> 'd list * 'a
(** Same with two lists, folding on the right *)
+ val fold_left3_map : ('a -> 'b -> 'c -> 'd -> 'a * 'e) -> 'a -> 'b list -> 'c list -> 'd list -> 'a * 'e list
+ (** Same with three lists, folding on the left *)
+
+ val fold_left4_map : ('a -> 'b -> 'c -> 'd -> 'e -> 'a * 'r) -> 'a -> 'b list -> 'c list -> 'd list -> 'e list -> 'a * 'r list
+ (** Same with four lists, folding on the left *)
+
val fold_map : ('a -> 'b -> 'a * 'c) -> 'a -> 'b list -> 'a * 'c list
+ (* [@@ocaml.deprecated "Same as [fold_left_map]"] *)
(** @deprecated Same as [fold_left_map] *)
val fold_map' : ('b -> 'a -> 'c * 'a) -> 'b list -> 'a -> 'c list * 'a
diff --git a/lib/cMap.ml b/clib/cMap.ml
index 0ecb40209..b4c4aedd0 100644
--- a/lib/cMap.ml
+++ b/clib/cMap.ml
@@ -26,7 +26,7 @@ sig
include CSig.MapS
module Set : CSig.SetS with type elt = key
val get : key -> 'a t -> 'a
- val update : key -> 'a -> 'a t -> 'a t
+ val set : key -> 'a -> 'a t -> 'a t
val modify : key -> (key -> 'a -> 'a) -> 'a t -> 'a t
val domain : 'a t -> Set.t
val bind : (key -> 'a) -> Set.t -> 'a t
@@ -50,7 +50,7 @@ end
module MapExt (M : Map.OrderedType) :
sig
type 'a map = 'a Map.Make(M).t
- val update : M.t -> 'a -> 'a map -> 'a map
+ val set : M.t -> 'a -> 'a map -> 'a map
val modify : M.t -> (M.t -> 'a -> 'a) -> 'a map -> 'a map
val domain : 'a map -> Set.Make(M).t
val bind : (M.t -> 'a) -> Set.Make(M).t -> 'a map
@@ -93,19 +93,19 @@ struct
let set_prj : set -> _set = Obj.magic
let set_inj : _set -> set = Obj.magic
- let rec update k v (s : 'a map) : 'a map = match map_prj s with
+ let rec set k v (s : 'a map) : 'a map = match map_prj s with
| MEmpty -> raise Not_found
| MNode (l, k', v', r, h) ->
let c = M.compare k k' in
if c < 0 then
- let l' = update k v l in
+ let l' = set k v l in
if l == l' then s
else map_inj (MNode (l', k', v', r, h))
else if c = 0 then
if v' == v then s
else map_inj (MNode (l, k', v, r, h))
else
- let r' = update k v r in
+ let r' = set k v r in
if r == r' then s
else map_inj (MNode (l, k', v', r', h))
diff --git a/lib/cMap.mli b/clib/cMap.mli
index f65036139..5e65bd200 100644
--- a/lib/cMap.mli
+++ b/clib/cMap.mli
@@ -34,7 +34,7 @@ sig
val get : key -> 'a t -> 'a
(** Same as {!find} but fails an assertion instead of raising [Not_found] *)
- val update : key -> 'a -> 'a t -> 'a t
+ val set : key -> 'a -> 'a t -> 'a t
(** Same as [add], but expects the key to be present, and thus faster.
@raise Not_found when the key is unbound in the map. *)
diff --git a/lib/cObj.ml b/clib/cObj.ml
index 7f3ee1855..7f3ee1855 100644
--- a/lib/cObj.ml
+++ b/clib/cObj.ml
diff --git a/lib/cObj.mli b/clib/cObj.mli
index 16933a4aa..16933a4aa 100644
--- a/lib/cObj.mli
+++ b/clib/cObj.mli
diff --git a/lib/cSet.ml b/clib/cSet.ml
index ed65edf16..ed65edf16 100644
--- a/lib/cSet.ml
+++ b/clib/cSet.ml
diff --git a/lib/cSet.mli b/clib/cSet.mli
index 2eb9bce86..2eb9bce86 100644
--- a/lib/cSet.mli
+++ b/clib/cSet.mli
diff --git a/lib/cSig.mli b/clib/cSig.mli
index 6910cbbf0..32e9d2af0 100644
--- a/lib/cSig.mli
+++ b/clib/cSig.mli
@@ -56,6 +56,12 @@ sig
val is_empty: 'a t -> bool
val mem: key -> 'a t -> bool
val add: key -> 'a -> 'a t -> 'a t
+ (* when Coq requires OCaml 4.06 or later, can add:
+
+ val update : key -> ('a option -> 'a option) -> 'a t -> 'a t
+
+ allowing Coq to use OCaml's "update"
+ *)
val singleton: key -> 'a -> 'a t
val remove: key -> 'a t -> 'a t
val merge:
diff --git a/lib/cStack.ml b/clib/cStack.ml
index 4acb2930c..4acb2930c 100644
--- a/lib/cStack.ml
+++ b/clib/cStack.ml
diff --git a/lib/cStack.mli b/clib/cStack.mli
index 8dde1d1a1..8dde1d1a1 100644
--- a/lib/cStack.mli
+++ b/clib/cStack.mli
diff --git a/lib/cString.ml b/clib/cString.ml
index f2242460e..f2242460e 100644
--- a/lib/cString.ml
+++ b/clib/cString.ml
diff --git a/lib/cString.mli b/clib/cString.mli
index 29d3a4499..29d3a4499 100644
--- a/lib/cString.mli
+++ b/clib/cString.mli
diff --git a/lib/cThread.ml b/clib/cThread.ml
index 0221e690e..0221e690e 100644
--- a/lib/cThread.ml
+++ b/clib/cThread.ml
diff --git a/lib/cThread.mli b/clib/cThread.mli
index 66f039bb5..66f039bb5 100644
--- a/lib/cThread.mli
+++ b/clib/cThread.mli
diff --git a/lib/cUnix.ml b/clib/cUnix.ml
index 867f86a74..34fb660db 100644
--- a/lib/cUnix.ml
+++ b/clib/cUnix.ml
@@ -14,6 +14,11 @@ type load_path = physical_path list
let physical_path_of_string s = s
let string_of_physical_path p = p
+let escaped_string_of_physical_path p =
+ (* We assume a reasonable-enough path (typically utf8) and prevents
+ the presence of space; other escapings might be useful... *)
+ if String.contains p ' ' then "\"" ^ p ^ "\"" else p
+
let path_to_list p =
let sep = Str.regexp (if Sys.os_type = "Win32" then ";" else ":") in
Str.split sep p
diff --git a/lib/cUnix.mli b/clib/cUnix.mli
index a39481404..d08dc4c40 100644
--- a/lib/cUnix.mli
+++ b/clib/cUnix.mli
@@ -14,9 +14,12 @@ type load_path = physical_path list
val physical_path_of_string : string -> physical_path
val string_of_physical_path : physical_path -> string
+(** Escape what has to be escaped (e.g. surround with quotes if with spaces) *)
+val escaped_string_of_physical_path : physical_path -> string
+
val canonical_path_name : string -> string
-(** remove all initial "./" in a path *)
+(** Remove all initial "./" in a path *)
val remove_path_dot : string -> string
(** If a path [p] starts with the current directory $PWD then
@@ -61,6 +64,6 @@ val sys_command : string -> string list -> Unix.process_status
val waitpid_non_intr : int -> Unix.process_status
-(** checks if two file names refer to the same (existing) file *)
+(** Check if two file names refer to the same (existing) file *)
val same_file : string -> string -> bool
diff --git a/lib/canary.ml b/clib/canary.ml
index 0ed1d28f3..0ed1d28f3 100644
--- a/lib/canary.ml
+++ b/clib/canary.ml
diff --git a/lib/canary.mli b/clib/canary.mli
index 904b88213..904b88213 100644
--- a/lib/canary.mli
+++ b/clib/canary.mli
diff --git a/lib/clib.mllib b/clib/clib.mllib
index 5c1f7d9af..0b5d9826f 100644
--- a/lib/clib.mllib
+++ b/clib/clib.mllib
@@ -1,37 +1,39 @@
-Coq_config
-
-Terminal
Canary
-Hook
+CObj
+CEphemeron
+
Hashset
Hashcons
+
CSet
CMap
+CList
+CString
+CStack
+
Int
-Dyn
+Range
HMap
+Bigint
+
+CArray
Option
+CUnix
+
+Segmenttree
+Unicodetable
+Unicode
+Minisys
+CThread
+Trie
+Predicate
+Heap
+Unionfind
+
+Dyn
Store
Exninfo
Backtrace
IStream
-Flags
-Control
-Loc
-CAst
-DAst
-CList
-CString
-Deque
-CObj
-CArray
-CStack
-Util
-Stateid
-Pp
-Feedback
-CUnix
-Envars
-Aux_file
+Terminal
Monad
-CoqProject_file
diff --git a/lib/deque.ml b/clib/deque.ml
index 373269b4f..373269b4f 100644
--- a/lib/deque.ml
+++ b/clib/deque.ml
diff --git a/lib/deque.mli b/clib/deque.mli
index 23cb1e491..23cb1e491 100644
--- a/lib/deque.mli
+++ b/clib/deque.mli
diff --git a/lib/dyn.ml b/clib/dyn.ml
index 83e673d2c..64535d35f 100644
--- a/lib/dyn.ml
+++ b/clib/dyn.ml
@@ -55,6 +55,8 @@ sig
include PreS
module Easy : sig
+
+ val make_dyn_tag : string -> ('a -> t) * (t -> 'a) * 'a tag
val make_dyn : string -> ('a -> t) * (t -> 'a)
val inj : 'a -> 'a tag -> t
val prj : t -> 'a tag -> 'a option
@@ -129,8 +131,9 @@ end
include Self
module Easy = struct
+
(* now tags are opaque, we can do the trick *)
-let make_dyn (s : string) =
+let make_dyn_tag (s : string) =
(fun (type a) (tag : a tag) ->
let infun : (a -> t) = fun x -> Dyn (tag, x) in
let outfun : (t -> a) = fun (Dyn (t, x)) ->
@@ -138,9 +141,12 @@ let make_dyn (s : string) =
| None -> assert false
| Some CSig.Refl -> x
in
- (infun, outfun))
+ infun, outfun, tag)
(create s)
+let make_dyn (s : string) =
+ let inf, outf, _ = make_dyn_tag s in inf, outf
+
let inj x tag = Dyn(tag,x)
let prj : type a. t -> a tag -> a option =
fun (Dyn(tag',x)) tag ->
diff --git a/lib/dyn.mli b/clib/dyn.mli
index e0e1a9d14..2206394e2 100644
--- a/lib/dyn.mli
+++ b/clib/dyn.mli
@@ -53,6 +53,7 @@ val dump : unit -> (int * string) list
module Easy : sig
(* To create a dynamic type on the fly *)
+ val make_dyn_tag : string -> ('a -> t) * (t -> 'a) * 'a tag
val make_dyn : string -> ('a -> t) * (t -> 'a)
(* For types declared with the [create] function above *)
diff --git a/lib/exninfo.ml b/clib/exninfo.ml
index 167d3d6dc..167d3d6dc 100644
--- a/lib/exninfo.ml
+++ b/clib/exninfo.ml
diff --git a/lib/exninfo.mli b/clib/exninfo.mli
index c960ac7c0..c960ac7c0 100644
--- a/lib/exninfo.mli
+++ b/clib/exninfo.mli
diff --git a/lib/hMap.ml b/clib/hMap.ml
index c69efdb71..37079af78 100644
--- a/lib/hMap.ml
+++ b/clib/hMap.ml
@@ -47,7 +47,7 @@ struct
try
let m = Int.Map.find h s in
let m = Set.add x m in
- Int.Map.update h m s
+ Int.Map.set h m s
with Not_found ->
let m = Set.singleton x in
Int.Map.add h m s
@@ -65,7 +65,7 @@ struct
if Set.is_empty m then
Int.Map.remove h s
else
- Int.Map.update h m s
+ Int.Map.set h m s
with Not_found -> s
let height s = Int.Map.height s
@@ -135,7 +135,7 @@ struct
let s' = Int.Map.find h accu in
let si = Set.filter (fun e -> not (Set.mem e s)) s' in
if Set.is_empty si then Int.Map.remove h accu
- else Int.Map.update h si accu
+ else Int.Map.set h si accu
with Not_found -> accu
in
Int.Map.fold fold s2 s1
@@ -242,11 +242,19 @@ struct
try
let m = Int.Map.find h s in
let m = Map.add k x m in
- Int.Map.update h m s
+ Int.Map.set h m s
with Not_found ->
let m = Map.singleton k x in
Int.Map.add h m s
+ (* when Coq requires OCaml 4.06 or later, the module type
+ CSig.MapS may include the signature of OCaml's "update",
+ requiring an implementation here, which could be just:
+
+ let update k f s = assert false (* not implemented *)
+
+ *)
+
let singleton k x =
let h = M.hash k in
Int.Map.singleton h (Map.singleton k x)
@@ -259,7 +267,7 @@ struct
if Map.is_empty m then
Int.Map.remove h s
else
- Int.Map.update h m s
+ Int.Map.set h m s
with Not_found -> s
let merge f s1 s2 =
@@ -359,7 +367,7 @@ struct
let h = M.hash k in
let m = Int.Map.find h s in
let m = Map.modify k f m in
- Int.Map.update h m s
+ Int.Map.set h m s
let bind f s =
let fb m = Map.bind f m in
@@ -367,11 +375,11 @@ struct
let domain s = Int.Map.map Map.domain s
- let update k x s =
+ let set k x s =
let h = M.hash k in
let m = Int.Map.find h s in
- let m = Map.update k x m in
- Int.Map.update h m s
+ let m = Map.set k x m in
+ Int.Map.set h m s
let smartmap f s =
let fs m = Map.smartmap f m in
diff --git a/lib/hMap.mli b/clib/hMap.mli
index c77bfced8..c77bfced8 100644
--- a/lib/hMap.mli
+++ b/clib/hMap.mli
diff --git a/lib/hashcons.ml b/clib/hashcons.ml
index ee2232581..ee2232581 100644
--- a/lib/hashcons.ml
+++ b/clib/hashcons.ml
diff --git a/lib/hashcons.mli b/clib/hashcons.mli
index fbd2ebcf9..fbd2ebcf9 100644
--- a/lib/hashcons.mli
+++ b/clib/hashcons.mli
diff --git a/lib/hashset.ml b/clib/hashset.ml
index 7f96627a6..7f96627a6 100644
--- a/lib/hashset.ml
+++ b/clib/hashset.ml
diff --git a/lib/hashset.mli b/clib/hashset.mli
index ec79205a5..ec79205a5 100644
--- a/lib/hashset.mli
+++ b/clib/hashset.mli
diff --git a/lib/heap.ml b/clib/heap.ml
index a6109972d..a6109972d 100644
--- a/lib/heap.ml
+++ b/clib/heap.ml
diff --git a/lib/heap.mli b/clib/heap.mli
index 93d504c5a..93d504c5a 100644
--- a/lib/heap.mli
+++ b/clib/heap.mli
diff --git a/lib/iStream.ml b/clib/iStream.ml
index d3a54332a..d3a54332a 100644
--- a/lib/iStream.ml
+++ b/clib/iStream.ml
diff --git a/lib/iStream.mli b/clib/iStream.mli
index cd7940e8d..cd7940e8d 100644
--- a/lib/iStream.mli
+++ b/clib/iStream.mli
diff --git a/lib/int.ml b/clib/int.ml
index 63f62154d..63f62154d 100644
--- a/lib/int.ml
+++ b/clib/int.ml
diff --git a/lib/int.mli b/clib/int.mli
index b65367f7d..b65367f7d 100644
--- a/lib/int.mli
+++ b/clib/int.mli
diff --git a/lib/minisys.ml b/clib/minisys.ml
index 389b18ad4..389b18ad4 100644
--- a/lib/minisys.ml
+++ b/clib/minisys.ml
diff --git a/lib/monad.ml b/clib/monad.ml
index 2e55e9698..2e55e9698 100644
--- a/lib/monad.ml
+++ b/clib/monad.ml
diff --git a/lib/monad.mli b/clib/monad.mli
index 7b0a3e600..7b0a3e600 100644
--- a/lib/monad.mli
+++ b/clib/monad.mli
diff --git a/lib/option.ml b/clib/option.ml
index 98b168035..98b168035 100644
--- a/lib/option.ml
+++ b/clib/option.ml
diff --git a/lib/option.mli b/clib/option.mli
index 66f05023f..66f05023f 100644
--- a/lib/option.mli
+++ b/clib/option.mli
diff --git a/lib/predicate.ml b/clib/predicate.ml
index 1aa7db6af..1aa7db6af 100644
--- a/lib/predicate.ml
+++ b/clib/predicate.ml
diff --git a/lib/predicate.mli b/clib/predicate.mli
index cee3b0bd3..cee3b0bd3 100644
--- a/lib/predicate.mli
+++ b/clib/predicate.mli
diff --git a/clib/range.ml b/clib/range.ml
new file mode 100644
index 000000000..86a078633
--- /dev/null
+++ b/clib/range.ml
@@ -0,0 +1,91 @@
+(************************************************************************)
+(* v * The Coq Proof Assistant / The Coq Development Team *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2016 *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(************************************************************************)
+
+type 'a tree =
+| Leaf of 'a
+| Node of 'a * 'a tree * 'a tree
+
+type 'a t = Nil | Cons of int * 'a tree * 'a t
+
+let oob () = invalid_arg "index out of bounds"
+
+let empty = Nil
+
+let cons x l = match l with
+| Cons (h1, t1, Cons (h2, t2, rem)) ->
+ if Int.equal h1 h2 then Cons (1 + h1 + h2, Node (x, t1, t2), rem)
+ else Cons (1, Leaf x, l)
+| _ -> Cons (1, Leaf x, l)
+
+let is_empty = function
+| Nil -> true
+| _ -> false
+
+let rec tree_get h t i = match t with
+| Leaf x ->
+ if i = 0 then x else oob ()
+| Node (x, t1, t2) ->
+ if i = 0 then x
+ else
+ let h = h / 2 in
+ if i <= h then tree_get h t1 (i - 1) else tree_get h t2 (i - h - 1)
+
+let rec get l i = match l with
+| Nil -> oob ()
+| Cons (h, t, rem) ->
+ if i < h then tree_get h t i else get rem (i - h)
+
+let length l =
+ let rec length accu = function
+ | Nil -> accu
+ | Cons (h, _, l) -> length (h + accu) l
+ in
+ length 0 l
+
+let rec tree_map f = function
+| Leaf x -> Leaf (f x)
+| Node (x, t1, t2) -> Node (f x, tree_map f t1, tree_map f t2)
+
+let rec map f = function
+| Nil -> Nil
+| Cons (h, t, l) -> Cons (h, tree_map f t, map f l)
+
+let rec tree_fold_left f accu = function
+| Leaf x -> f accu x
+| Node (x, t1, t2) ->
+ tree_fold_left f (tree_fold_left f (f accu x) t1) t2
+
+let rec fold_left f accu = function
+| Nil -> accu
+| Cons (_, t, l) -> fold_left f (tree_fold_left f accu t) l
+
+let rec tree_fold_right f t accu = match t with
+| Leaf x -> f x accu
+| Node (x, t1, t2) ->
+ f x (tree_fold_right f t1 (tree_fold_right f t2 accu))
+
+let rec fold_right f l accu = match l with
+| Nil -> accu
+| Cons (_, t, l) -> tree_fold_right f t (fold_right f l accu)
+
+let hd = function
+| Nil -> failwith "hd"
+| Cons (_, Leaf x, _) -> x
+| Cons (_, Node (x, _, _), _) -> x
+
+let tl = function
+| Nil -> failwith "tl"
+| Cons (_, Leaf _, l) -> l
+| Cons (h, Node (_, t1, t2), l) ->
+ let h = h / 2 in
+ Cons (h, t1, Cons (h, t2, l))
+
+let rec skipn n l =
+ if n = 0 then l
+ else if is_empty l then failwith "List.skipn"
+ else skipn (pred n) (tl l)
diff --git a/clib/range.mli b/clib/range.mli
new file mode 100644
index 000000000..ae7684ffa
--- /dev/null
+++ b/clib/range.mli
@@ -0,0 +1,37 @@
+(************************************************************************)
+(* v * The Coq Proof Assistant / The Coq Development Team *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2016 *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(************************************************************************)
+
+(** Skewed lists
+
+ This is a purely functional datastructure isomorphic to usual lists, except
+ that it features a O(log n) lookup while preserving the O(1) cons operation.
+
+*)
+
+(** {5 Constructors} *)
+
+type +'a t
+
+val empty : 'a t
+val cons : 'a -> 'a t -> 'a t
+
+(** {5 List operations} *)
+
+val is_empty : 'a t -> bool
+val length : 'a t -> int
+val map : ('a -> 'b) -> 'a t -> 'b t
+val fold_left : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'a
+val fold_right : ('a -> 'b -> 'b) -> 'a t -> 'b -> 'b
+val hd : 'a t -> 'a
+val tl : 'a t -> 'a t
+
+val skipn : int -> 'a t -> 'a t
+
+(** {5 Indexing operations} *)
+
+val get : 'a t -> int -> 'a
diff --git a/lib/segmenttree.ml b/clib/segmenttree.ml
index d0ded4cb5..d0ded4cb5 100644
--- a/lib/segmenttree.ml
+++ b/clib/segmenttree.ml
diff --git a/lib/segmenttree.mli b/clib/segmenttree.mli
index e274a6fdc..e274a6fdc 100644
--- a/lib/segmenttree.mli
+++ b/clib/segmenttree.mli
diff --git a/lib/store.ml b/clib/store.ml
index 97a8fea08..97a8fea08 100644
--- a/lib/store.ml
+++ b/clib/store.ml
diff --git a/lib/store.mli b/clib/store.mli
index 5cc5bb859..5cc5bb859 100644
--- a/lib/store.mli
+++ b/clib/store.mli
diff --git a/lib/terminal.ml b/clib/terminal.ml
index 34efddfbc..34efddfbc 100644
--- a/lib/terminal.ml
+++ b/clib/terminal.ml
diff --git a/lib/terminal.mli b/clib/terminal.mli
index b1b76e6e2..b1b76e6e2 100644
--- a/lib/terminal.mli
+++ b/clib/terminal.mli
diff --git a/lib/trie.ml b/clib/trie.ml
index 0b0ba2761..0b0ba2761 100644
--- a/lib/trie.ml
+++ b/clib/trie.ml
diff --git a/lib/trie.mli b/clib/trie.mli
index a87acc8a6..a87acc8a6 100644
--- a/lib/trie.mli
+++ b/clib/trie.mli
diff --git a/lib/unicode.ml b/clib/unicode.ml
index f193c4e0f..f193c4e0f 100644
--- a/lib/unicode.ml
+++ b/clib/unicode.ml
diff --git a/lib/unicode.mli b/clib/unicode.mli
index 32ffbb8e9..32ffbb8e9 100644
--- a/lib/unicode.mli
+++ b/clib/unicode.mli
diff --git a/lib/unicodetable.ml b/clib/unicodetable.ml
index b607058c6..b607058c6 100644
--- a/lib/unicodetable.ml
+++ b/clib/unicodetable.ml
diff --git a/lib/unionfind.ml b/clib/unionfind.ml
index f9c92d6a8..f9c92d6a8 100644
--- a/lib/unionfind.ml
+++ b/clib/unionfind.ml
diff --git a/lib/unionfind.mli b/clib/unionfind.mli
index b242232ed..b242232ed 100644
--- a/lib/unionfind.mli
+++ b/clib/unionfind.mli
diff --git a/config/coq_config.mli b/config/coq_config.mli
index 6a834a304..e2d9d0d01 100644
--- a/config/coq_config.mli
+++ b/config/coq_config.mli
@@ -41,12 +41,8 @@ val caml_flags : string (* arguments passed to ocamlc (ie. CAMLFLAGS) *)
val best : string (* byte/opt *)
val arch : string (* architecture *)
val arch_is_win32 : bool
-val osdeplibs : string (* OS dependent link options for ocamlc *)
val vmbyteflags : string list (* -custom/-dllib -lcoqrun *)
-
-(* val defined : string list (* options for lib/ocamlpp *) *)
-
val version : string (* version number of Coq *)
val caml_version : string (* OCaml version used to compile Coq *)
val caml_version_nums : int list (* OCaml version used to compile Coq by components *)
@@ -56,7 +52,6 @@ val vo_magic_number : int
val state_magic_number : int
val core_src_dirs : string list
-val api_dirs : string list
val plugins_dirs : string list
val all_src_dirs : string list
@@ -80,4 +75,5 @@ val wwwbugtracker : string
val wwwstdlib : string
val localwwwrefman : string
-val no_native_compiler : bool
+val bytecode_compiler : bool
+val native_compiler : bool
diff --git a/configure.ml b/configure.ml
index 0952b15f5..06a7dd822 100644
--- a/configure.ml
+++ b/configure.ml
@@ -16,7 +16,7 @@ let coq_macos_version = "8.7.90" (** "[...] should be a string comprised of
three non-negative, period-separated integers [...]" *)
let vo_magic = 8791
let state_magic = 58791
-let distributed_exec = ["coqtop";"coqc";"coqchk";"coqdoc";"coqmktop";"coqworkmgr";
+let distributed_exec = ["coqtop";"coqc";"coqchk";"coqdoc";"coqworkmgr";
"coqdoc";"coq_makefile";"coq-tex";"gallina";"coqwc";"csdpcert";"coqdep"]
let verbose = ref false (* for debugging this script *)
@@ -178,6 +178,20 @@ let which prog =
let program_in_path prog =
try let _ = which prog in true with Not_found -> false
+(** Choose a command among a list of candidates
+ (command name, mandatory arguments, arguments for this test).
+ Chooses the first one whose execution outputs a non-empty (first) line.
+ Dies with message [msg] if none is found. *)
+
+let select_command msg candidates =
+ let rec search = function
+ | [] -> die msg
+ | (p, x, y) :: tl ->
+ if fst (tryrun p (x @ y)) <> ""
+ then List.fold_left (Printf.sprintf "%s %s") p x
+ else search tl
+ in search candidates
+
(** As per bug #4828, ocamlfind on Windows/Cygwin barfs if you pass it
a quoted path to camlpXo via -pp. So we only quote camlpXo on not
Windows, and warn on Windows if the path contains spaces *)
@@ -262,10 +276,13 @@ module Prefs = struct
let flambda_flags = ref []
let debug = ref true
let profile = ref false
- let annotate = ref false
+ let bin_annot = ref false
+ let annot = ref false
+ let bytecodecompiler = ref true
let nativecompiler = ref (not (os_type_win32 || os_type_cygwin))
let coqwebsite = ref "http://coq.inria.fr/"
let force_caml_version = ref false
+ let force_findlib_version = ref false
let warn_error = ref false
end
@@ -326,14 +343,22 @@ let args_options = Arg.align [
" Do not add debugging information in the Coq executables";
"-profile", Arg.Set Prefs.profile,
" Add profiling information in the Coq executables";
- "-annotate", Arg.Set Prefs.annotate,
- " Dumps ml annotation files while compiling Coq";
+ "-annotate", Arg.Unit (fun () -> printf "*Warning* -annotate is deprecated. Please use -annot or -bin-annot instead.\n"),
+ " Deprecated. Please use -annot or -bin-annot instead";
+ "-annot", Arg.Set Prefs.annot,
+ " Dumps ml text annotation files while compiling Coq (e.g. for Tuareg)";
+ "-bin-annot", Arg.Set Prefs.bin_annot,
+ " Dumps ml binary annotation files while compiling Coq (e.g. for Merlin)";
+ "-bytecode-compiler", arg_bool Prefs.bytecodecompiler,
+ "(yes|no) Enable Coq's bytecode reduction machine (VM)";
"-native-compiler", arg_bool Prefs.nativecompiler,
"(yes|no) Compilation to native code for conversion and normalization";
"-coqwebsite", Arg.Set_string Prefs.coqwebsite,
" URL of the coq website";
"-force-caml-version", Arg.Set Prefs.force_caml_version,
" Force OCaml version";
+ "-force-findlib-version", Arg.Set Prefs.force_findlib_version,
+ " Force findlib version";
"-warn-error", Arg.Set Prefs.warn_error,
" Make OCaml warnings into errors";
"-camldir", Arg.String (fun _ -> ()),
@@ -368,10 +393,8 @@ let reset_caml_find c o = c.find <- o
let coq_debug_flag = if !Prefs.debug then "-g" else ""
let coq_profile_flag = if !Prefs.profile then "-p" else ""
-let coq_annotate_flag =
- if !Prefs.annotate
- then if program_in_path "ocamlmerlin" then "-bin-annot" else "-annot"
- 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
care. *)
@@ -439,7 +462,7 @@ let browser =
(** * OCaml programs *)
-let camlbin, caml_version, camllib =
+let camlbin, caml_version, camllib, findlib_version =
let () = match !Prefs.ocamlfindcmd with
| Some cmd -> reset_caml_find camlexec cmd
| None ->
@@ -451,6 +474,7 @@ let camlbin, caml_version, camllib =
if not (is_executable camlexec.find)
then die ("Error: cannot find the executable '"^camlexec.find^"'.")
else
+ let findlib_version, _ = run camlexec.find ["query"; "findlib"; "-format"; "%v"] in
let caml_version, _ = run camlexec.find ["ocamlc";"-version"] in
let camllib, _ = run camlexec.find ["printconf";"stdlib"] in
let camlbin = (* TODO beurk beurk beurk *)
@@ -461,7 +485,7 @@ let camlbin, caml_version, camllib =
let () =
if is_executable (camlbin / "ocaml")
then reset_caml_top camlexec (camlbin / "ocaml") in
- camlbin, caml_version, camllib
+ camlbin, caml_version, camllib, findlib_version
let camlp4compat = "-loc loc"
@@ -491,8 +515,27 @@ let check_caml_version () =
let _ = check_caml_version ()
-let coq_debug_flag_opt =
- if caml_version_nums >= [3;10] then coq_debug_flag else ""
+let findlib_version_list = numeric_prefix_list findlib_version
+
+let findlib_version_nums =
+ try
+ if List.length findlib_version_list < 2 then failwith "bad version";
+ List.map s2i findlib_version_list
+ with _ ->
+ die ("I found ocamlfind but cannot read its version number!\n" ^
+ "Is it installed properly?")
+
+let check_findlib_version () =
+ if findlib_version_nums >= [1;4;1] then
+ printf "You have OCamlfind %s. Good!\n" findlib_version
+ else
+ let () = printf "Your version of OCamlfind is %s.\n" findlib_version in
+ if !Prefs.force_findlib_version then
+ printf "*Warning* Your version of OCamlfind is outdated.\n"
+ else
+ die "You need OCamlfind 1.4.1 or later."
+
+let _ = check_findlib_version ()
let camltag = match caml_version_list with
| x::y::_ -> "OCAML"^x^y
@@ -521,7 +564,7 @@ let coq_warn_error =
(* Flags used to compile Coq and plugins (via coq_makefile) *)
let caml_flags =
- Printf.sprintf "-thread -rectypes %s %s %s" coq_warnings coq_annotate_flag coq_safe_string
+ Printf.sprintf "-thread -rectypes %s %s %s %s" coq_warnings coq_annot_flag coq_bin_annot_flag coq_safe_string
(* Flags used to compile Coq but _not_ plugins (via coq_makefile) *)
let coq_caml_flags =
@@ -643,18 +686,32 @@ let natdynlinkflag =
(** * OS dependent libraries *)
-let osdeplibs = "-cclib -lunix"
-
-let operating_system, osdeplibs =
+let operating_system =
if starts_with arch "sun4" then
let os, _ = run "uname" ["-r"] in
if starts_with os "5" then
- "Sun Solaris "^os, osdeplibs^" -cclib -lnsl -cclib -lsocket"
+ "Sun Solaris "^os
else
- "Sun OS "^os, osdeplibs
+ "Sun OS "^os
else
- (try Sys.getenv "OS" with Not_found -> ""), osdeplibs
+ (try Sys.getenv "OS" with Not_found -> "")
+(** Num library *)
+
+(* since 4.06, the Num library is no longer distributed with OCaml (replaced
+ by Zarith)
+*)
+
+let check_for_numlib () =
+ if caml_version_nums >= [4;6;0] then
+ let numlib,_ = tryrun camlexec.find ["query";"num"] in
+ match numlib with
+ | "" ->
+ die "Num library not installed, required for OCaml 4.06 or later"
+ | _ -> printf "You have the Num library installed. Good!\n"
+
+let numlib =
+ check_for_numlib ()
(** * lablgtk2 and CoqIDE *)
@@ -688,11 +745,11 @@ let get_lablgtkdir () =
else "", msg
| None ->
let msg = OCamlFind in
- let d1,_ = tryrun "ocamlfind" ["query";"lablgtk2.sourceview2"] in
+ let d1,_ = tryrun camlexec.find ["query";"lablgtk2.sourceview2"] in
if d1 <> "" && check_lablgtkdir msg d1 then d1, msg
else
(* In debian wheezy, ocamlfind knows only of lablgtk2 *)
- let d2,_ = tryrun "ocamlfind" ["query";"lablgtk2"] in
+ let d2,_ = tryrun camlexec.find ["query";"lablgtk2"] in
if d2 <> "" && d2 <> d1 && check_lablgtkdir msg d2 then d2, msg
else
let msg = Stdlib in
@@ -704,24 +761,22 @@ let get_lablgtkdir () =
let check_lablgtk_version src dir = match src with
| Manual | Stdlib ->
- let test accu f =
- if accu then
- let test = sprintf "grep -q -w %s %S/glib.mli" f dir in
- Sys.command test = 0
- else false
- in
- let heuristics = [
- "convert_with_fallback";
- "wrap_poll_func"; (** Introduced in lablgtk 2.16 *)
- ] in
- let ans = List.fold_left test true heuristics in
- if ans then printf "Warning: could not check the version of lablgtk2.\n";
- (ans, "an unknown version")
+ printf "Warning: could not check the version of lablgtk2.\nMake sure your version is at least 2.18.3.\n";
+ (true, "an unknown version")
| OCamlFind ->
- let v, _ = tryrun "ocamlfind" ["query"; "-format"; "%v"; "lablgtk2"] in
+ let v, _ = tryrun camlexec.find ["query"; "-format"; "%v"; "lablgtk2"] in
try
let vi = List.map s2i (numeric_prefix_list v) in
- ([2; 16] <= vi, v)
+ if vi < [2; 16; 0] then
+ (false, v)
+ else if vi < [2; 18; 3] then
+ begin
+ (* Version 2.18.3 is known to report incorrectly as 2.18.0, and Launchpad packages report as version 2.16.0 due to a misconfigured META file; see https://bugs.launchpad.net/ubuntu/+source/lablgtk2/+bug/1577236 *)
+ printf "Warning: Your installed lablgtk reports as %s.\n It is possible that the installed version is actually more recent\n but reports an incorrect version. If the installed version is\n actually more recent than 2.18.3, that's fine; if it is not,\n CoqIDE will compile but may be very unstable.\n" v;
+ (true, "an unknown version")
+ end
+ else
+ (true, v)
with _ -> (false, v)
let pr_ide = function No -> "no" | Byte -> "only bytecode" | Opt -> "native"
@@ -748,7 +803,7 @@ let check_coqide () =
if dir = "" then set_ide No "LablGtk2 not found";
let (ok, version) = check_lablgtk_version via dir in
let found = sprintf "LablGtk2 found (%s, %s)" (get_source via) version in
- if not ok then set_ide No (found^", but too old (required >= 2.16, found " ^ version ^ ")");
+ if not ok then set_ide No (found^", but too old (required >= 2.18.3, found " ^ version ^ ")");
(* We're now sure to produce at least one kind of coqide *)
lablgtkdir := shorten_camllib dir;
if !Prefs.coqide = Some Byte then set_ide Byte (found^", bytecode requested");
@@ -775,7 +830,7 @@ let coqide_flags () =
if !lablgtkdir <> "" then lablgtkincludes := sprintf "-I %S" !lablgtkdir;
match coqide, arch with
| "opt", "Darwin" when !Prefs.macintegration ->
- let osxdir,_ = tryrun "ocamlfind" ["query";"lablgtkosx"] in
+ let osxdir,_ = tryrun camlexec.find ["query";"lablgtkosx"] in
if osxdir <> "" then begin
lablgtkincludes := sprintf "%s -I %S" !lablgtkincludes osxdir;
idearchflags := "lablgtkosx.cma";
@@ -811,12 +866,6 @@ let strip =
if strip = "" then "strip" else strip
end
-(** * md5sum command *)
-
-let md5sum =
- if List.mem arch ["Darwin"; "FreeBSD"; "OpenBSD"]
- then "md5 -q" else "md5sum"
-
(** * Documentation : do we have latex, hevea, ... *)
@@ -950,6 +999,8 @@ let config_runtime () =
let vmbyteflags = config_runtime ()
+let esc s = if String.contains s ' ' then "\"" ^ s ^ "\"" else s
+
(** * Summary of the configuration *)
let print_summary () =
@@ -960,33 +1011,32 @@ let print_summary () =
pr " Operating system : %s\n" operating_system;
pr " Coq VM bytecode link flags : %s\n" (String.concat " " vmbyteflags);
pr " Other bytecode link flags : %s\n" custom_flag;
- pr " OS dependent libraries : %s\n" osdeplibs;
pr " OCaml version : %s\n" caml_version;
- pr " OCaml binaries in : %s\n" camlbin;
- pr " OCaml library in : %s\n" camllib;
+ pr " OCaml binaries in : %s\n" (esc camlbin);
+ pr " OCaml library in : %s\n" (esc camllib);
pr " OCaml flambda flags : %s\n" (String.concat " " !Prefs.flambda_flags);
pr " %s version : %s\n" capitalized_camlpX camlpX_version;
- pr " %s binaries in : %s\n" capitalized_camlpX camlpXbindir;
- pr " %s library in : %s\n" capitalized_camlpX camlpXlibdir;
+ pr " %s binaries in : %s\n" capitalized_camlpX (esc camlpXbindir);
+ pr " %s library in : %s\n" capitalized_camlpX (esc camlpXlibdir);
if best_compiler = "opt" then
pr " Native dynamic link support : %B\n" hasnatdynlink;
if coqide <> "no" then
- pr " Lablgtk2 library in : %s\n" !lablgtkdir;
+ pr " Lablgtk2 library in : %s\n" (esc !lablgtkdir);
if !idearchdef = "QUARTZ" then
pr " Mac OS integration is on\n";
pr " CoqIde : %s\n" coqide;
pr " Documentation : %s\n"
(if withdoc then "All" else "None");
pr " Web browser : %s\n" browser;
- pr " Coq web site : %s\n\n" !Prefs.coqwebsite;
- if not !Prefs.nativecompiler then
- pr " Native compiler for conversion and normalization disabled\n\n";
+ pr " Coq web site : %s\n" !Prefs.coqwebsite;
+ pr " Bytecode VM enabled : %B\n" !Prefs.bytecodecompiler;
+ pr " Native Compiler enabled : %B\n\n" !Prefs.nativecompiler;
if !Prefs.local then
pr " Local build, no installation...\n"
else
(pr " Paths for true installation:\n";
List.iter
- (fun (_,msg,dir,_) -> pr " - %s will be copied in %s\n" msg dir)
+ (fun (_,msg,dir,_) -> pr " - %s will be copied in %s\n" msg (esc dir))
install_dirs);
pr "\n";
pr "If anything is wrong above, please restart './configure'.\n\n";
@@ -1000,7 +1050,7 @@ let _ = print_summary ()
let write_dbg_wrapper f =
safe_remove f;
- let o = open_out f in
+ let o = open_out_bin f in (* _bin to avoid adding \r on Cygwin/Windows *)
let pr s = fprintf o s in
pr "#!/bin/sh\n\n";
pr "###### ocamldebug-coq : a wrapper around ocamldebug for Coq ######\n\n";
@@ -1053,7 +1103,6 @@ let write_configml f =
pr_s "cflags" cflags;
pr_s "caml_flags" caml_flags;
pr_s "best" best_compiler;
- pr_s "osdeplibs" osdeplibs;
pr_s "version" coq_version;
pr_s "caml_version" caml_version;
pr_li "caml_version_nums" caml_version_nums;
@@ -1076,9 +1125,10 @@ let write_configml f =
pr_s "wwwrefman" (!Prefs.coqwebsite ^ "distrib/" ^ coq_version ^ "/refman/");
pr_s "wwwstdlib" (!Prefs.coqwebsite ^ "distrib/" ^ coq_version ^ "/stdlib/");
pr_s "localwwwrefman" ("file:/" ^ docdir ^ "/html/refman");
- pr_b "no_native_compiler" (not !Prefs.nativecompiler);
+ pr_b "bytecode_compiler" !Prefs.bytecodecompiler;
+ pr_b "native_compiler" !Prefs.nativecompiler;
- let core_src_dirs = [ "config"; "dev"; "kernel"; "library";
+ let core_src_dirs = [ "config"; "dev"; "lib"; "clib"; "kernel"; "library";
"engine"; "pretyping"; "interp"; "parsing"; "proofs";
"tactics"; "toplevel"; "printing"; "intf";
"grammar"; "ide"; "stm"; "vernac" ] in
@@ -1087,7 +1137,6 @@ let write_configml f =
core_src_dirs in
pr "\nlet core_src_dirs = [\n%s]\n" core_src_dirs;
- pr "\nlet api_dirs = [\"API\"; \"lib\"]\n";
pr "\nlet plugins_dirs = [\n";
let plugins = Sys.readdir "plugins" in
@@ -1099,7 +1148,7 @@ let write_configml f =
plugins;
pr "]\n";
- pr "\nlet all_src_dirs = core_src_dirs @ api_dirs @ plugins_dirs\n";
+ pr "\nlet all_src_dirs = core_src_dirs @ plugins_dirs\n";
close_out o;
Unix.chmod f 0o444
@@ -1168,7 +1217,7 @@ let write_makefile f =
pr "CFLAGS=%s\n\n" cflags;
pr "# Compilation debug flags\n";
pr "CAMLDEBUG=%s\n" coq_debug_flag;
- pr "CAMLDEBUGOPT=%s\n\n" coq_debug_flag_opt;
+ pr "CAMLDEBUGOPT=%s\n\n" coq_debug_flag;
pr "# Compilation profile flag\n";
pr "CAMLTIMEPROF=%s\n\n" coq_profile_flag;
pr "# Camlp4 : flavor, binaries, libraries ...\n";
@@ -1184,7 +1233,6 @@ let write_makefile f =
pr "# Supplementary libs for some systems, currently:\n";
pr "# . Sun Solaris: -cclib -lunix -cclib -lnsl -cclib -lsocket\n";
pr "# . others : -cclib -lunix\n";
- pr "OSDEPLIBS=%s\n\n" osdeplibs;
pr "# executable files extension, currently:\n";
pr "# Unix systems:\n";
pr "# Win32 systems : .exe\n";
@@ -1196,8 +1244,6 @@ let write_makefile f =
pr "# Unix systems and profiling: true\n";
pr "# Unix systems and no profiling: strip\n";
pr "STRIP=%s\n\n" strip;
- pr "#the command md5sum\n";
- pr "MD5SUM=%s\n\n" md5sum;
pr "# LablGTK\n";
pr "COQIDEINCLUDES=%s\n\n" !lablgtkincludes;
pr "# CoqIde (no/byte/opt)\n";
diff --git a/default.nix b/default.nix
new file mode 100644
index 000000000..af2a13a84
--- /dev/null
+++ b/default.nix
@@ -0,0 +1,73 @@
+# How to use?
+
+# If you have Nix installed, you can get in an environment with everything
+# needed to compile Coq and CoqIDE by running:
+# $ nix-shell
+# at the root of the Coq repository.
+
+# How to tweak default arguments?
+
+# nix-shell supports the --arg option (see Nix doc) that allows you for
+# instance to do this:
+# $ nix-shell --arg ocamlPackages "(import <nixpkgs> {}).ocamlPackages_latest" --arg buildIde false
+
+# You can also compile Coq and "install" it by running:
+# $ make clean # (only needed if you have left-over compilation files)
+# $ nix-build
+# at the root of the Coq repository.
+# nix-build also supports the --arg option, so you will be able to do:
+# $ nix-build --arg doCheck false
+# if you want to speed up things by not running the test-suite.
+# Once the build is finished, you will find, in the current directory,
+# a symlink to where Coq was installed.
+
+{ pkgs ? (import <nixpkgs> {}), ocamlPackages ? pkgs.ocamlPackages,
+ buildIde ? true, doCheck ? true }:
+
+with pkgs;
+
+stdenv.mkDerivation rec {
+
+ name = "coq";
+
+ buildInputs = (with ocamlPackages; [
+
+ # Coq dependencies
+ ocaml
+ findlib
+ camlp5_strict
+ num
+
+ ]) ++ (if buildIde then [
+
+ # CoqIDE dependencies
+ ocamlPackages.lablgtk
+
+ ] else []) ++ (if doCheck then
+
+ # Test-suite dependencies
+ let inherit (stdenv.lib) versionAtLeast optional; in
+ /* ncurses is required to build an OCaml REPL */
+ optional (!versionAtLeast ocaml.version "4.07") ncurses
+ ++ [
+ python
+ rsync
+ which
+
+ ] else []) ++ (if lib.inNixShell then [
+ ocamlPackages.merlin
+ ocamlPackages.ocpIndent
+ ocamlPackages.ocp-index
+ ] else []);
+
+ src =
+ if lib.inNixShell then null
+ else
+ with builtins; filterSource
+ (path: _: !elem (baseNameOf path) [".git" "result" "bin"]) ./.;
+
+ prefixKey = "-prefix ";
+
+ inherit doCheck;
+
+}
diff --git a/dev/README b/dev/README
index b446c3e97..6b83579de 100644
--- a/dev/README
+++ b/dev/README
@@ -1,4 +1,4 @@
-This directory contains informations and tools to help developing the
+This directory contains information and tools to help develop the
Coq system
======================
@@ -6,30 +6,30 @@ This directory contains informations and tools to help developing the
Debugging and profiling (in current directory - see doc/debugging.txt)
-----------------------
-ocamldebug-coq: to launch ocaml debugger
+ocamldebug-coq: to launch ocaml debugger (generated by the configure script)
-db: to install pretty-printers from ocaml debugger
-base_db: to install raw pretty-printers from ocaml debugger
+db: to install pretty-printers from ocaml debugger
+base_db: to install raw pretty-printers from ocaml debugger
-include: to install pretty-printers from ocaml toplevel
+include: to install pretty-printers from ocaml toplevel (use with the coq Drop command)
base_include: to install raw pretty-printers from ocaml toplevel
-vm_printers.ml, dev_printers.ml: ML pretty-printers for debugging
+vm_printers.ml, top_printers.ml: ML pretty-printers for debugging
-Miscellaneous informations about the code (directory doc)
+Miscellaneous information about the code (directory doc)
-----------------------------------------
-changes.txt: (partial) per-version summary of the evolutions of Coq ML source
-style.txt: a few style recommendations for writing Coq ML files
-debugging.txt: help for debugging or profiling
-universes.txt: help to debug universes
-translate.txt: help to use coq translator
+changes.md: (partial) per-version summary of the evolution of Coq ML source
+style.txt: a few style recommendations for writing Coq ML files
+debugging.md: help for debugging or profiling
+universes.txt: help for debugging universes
+translate.txt: help for using coq translator
extensions.txt: some help about TACTIC EXTEND
-header: standard header for Coq ML files
-perf-analysis: analysis of perfs measured on the compilation of user contribs
-cic.dtd: official dtd of the calc. of ind. constr. for im/ex-portation
+header: standard header for Coq ML files
+perf-analysis: analysis of perfs measured on the compilation of user contribs
+cic.dtd: official dtd of the calc. of ind. constr. for im/ex-portation
Documentation of ML interfaces using ocamldoc (directory ocamldoc/html)
diff --git a/dev/base_include b/dev/base_include
index f2912e112..472c0c605 100644
--- a/dev/base_include
+++ b/dev/base_include
@@ -18,12 +18,10 @@
#directory "intf";;
#directory "stm";;
#directory "vernac";;
-#directory "../API";;
#directory "+camlp4";; (* lazy solution: add both of camlp4/5 so that *)
#directory "+camlp5";; (* Gramext is found in top_printers.ml *)
-#load "API.cma";;
#use "top_printers.ml";;
#use "vm_printers.ml";;
@@ -54,7 +52,7 @@
#install_printer ppvblock;;
#install_printer (* bigint *) ppbigint;;
#install_printer (* loc *) pploc;;
-#install_printer (* substitution *) prsubst;;
+#install_printer (* substitution *) ppsubst;;
(* Open main files *)
@@ -130,7 +128,6 @@ open Reserve
open Syntax_def
open Constrexpr
open Constrexpr_ops
-open Topconstr
open Notation_term
open Notation_ops
open Prettyp
@@ -171,7 +168,7 @@ open Eqschemes
open ExplainErr
open Class
-open Command
+open ComDefinition
open Indschemes
open Ind_tables
open Auto_ind_decl
@@ -194,8 +191,8 @@ let qid = Libnames.qualid_of_string;;
(* parsing of terms *)
let parse_constr = Pcoq.parse_string Pcoq.Constr.constr;;
-let parse_vernac = Pcoq.parse_string Pcoq.Vernac_.vernac;;
-let parse_tac = API.Pcoq.parse_string Ltac_plugin.Pltac.tactic;;
+let parse_vernac = Pcoq.parse_string Pcoq.Vernac_.vernac_control;;
+let parse_tac = Pcoq.parse_string Ltac_plugin.Pltac.tactic;;
(* build a term of type glob_constr without type-checking or resolution of
implicit syntax *)
@@ -231,7 +228,7 @@ let pf_e gl s =
let _ = Flags.in_debugger := false
let _ = Flags.in_toplevel := true
let _ = Constrextern.set_extern_reference
- (fun ?loc _ r -> Libnames.Qualid (loc,Nametab.shortest_qualid_of_global Idset.empty r));;
+ (fun ?loc _ r -> Libnames.Qualid (loc,Nametab.shortest_qualid_of_global Id.Set.empty r));;
let go () = Coqloop.loop Option.(get !Coqtop.drop_last_doc)
diff --git a/dev/build/osx/make-macos-dmg.sh b/dev/build/osx/make-macos-dmg.sh
index cfcc09b32..dc33838f1 100755
--- a/dev/build/osx/make-macos-dmg.sh
+++ b/dev/build/osx/make-macos-dmg.sh
@@ -25,4 +25,4 @@ mkdir -p _build
# Temporary countermeasure to hdiutil error 5341
# head -c9703424 /dev/urandom > $DMGDIR/.padding
-hdiutil create -imagekey zlib-level=9 -volname CoqIDE_$VERSION -srcfolder $DMGDIR -ov -format UDZO _build/CoqIDE_$VERSION.dmg
+hdiutil create -imagekey zlib-level=9 -volname coq-$VERSION-installer-macos -srcfolder $DMGDIR -ov -format UDZO _build/coq-$VERSION-installer-macos.dmg
diff --git a/dev/build/windows/MakeCoq_MinGW.bat b/dev/build/windows/MakeCoq_MinGW.bat
index f91b301b8..665d54176 100644
--- a/dev/build/windows/MakeCoq_MinGW.bat
+++ b/dev/build/windows/MakeCoq_MinGW.bat
@@ -345,7 +345,7 @@ IF "%COQREGTESTING%" == "Y" (
SET "EXTRAPACKAGES= "
IF NOT "%APPVEYOR%" == "True" (
- SET EXTRAPACKAGES="-P wget,curl,git,gcc-core,gcc-g++,automake1.5"
+ SET EXTRAPACKAGES=-P wget,curl,git,gcc-core,gcc-g++,automake1.5
)
IF "%RUNSETUP%"=="Y" (
diff --git a/dev/build/windows/ReadMe.txt b/dev/build/windows/ReadMe.txt
index a6d8e4462..7e80e33c6 100644
--- a/dev/build/windows/ReadMe.txt
+++ b/dev/build/windows/ReadMe.txt
@@ -418,7 +418,6 @@ Binary file ./bin/coqchk.exe matches
Binary file ./bin/coqdep.exe matches
Binary file ./bin/coqdoc.exe matches
Binary file ./bin/coqide.exe matches
-Binary file ./bin/coqmktop.exe matches
Binary file ./bin/coqtop.byte.exe matches
Binary file ./bin/coqtop.exe matches
Binary file ./bin/coqworkmgr.exe matches
@@ -438,7 +437,6 @@ Binary file ./bin/ocamldoc.exe matches
Binary file ./bin/ocamldoc.opt.exe matches
Binary file ./bin/ocamlfind.exe matches
Binary file ./bin/ocamlmklib.exe matches
-Binary file ./bin/ocamlmktop.exe matches
Binary file ./bin/ocamlobjinfo.exe matches
Binary file ./bin/ocamlopt.exe matches
Binary file ./bin/ocamlopt.opt.exe matches
diff --git a/dev/build/windows/makecoq_mingw.sh b/dev/build/windows/makecoq_mingw.sh
index f12cbe0a7..c46767821 100644
--- a/dev/build/windows/makecoq_mingw.sh
+++ b/dev/build/windows/makecoq_mingw.sh
@@ -1087,7 +1087,7 @@ function copy_coq_license {
install -D README "$PREFIXCOQ/license_readme/coq/ReadMe.txt" || true
install -D README.md "$PREFIXCOQ/license_readme/coq/ReadMe.md" || true
install -D README.win "$PREFIXCOQ/license_readme/coq/ReadMeWindows.txt" || true
- install -D README.doc "$PREFIXCOQ/license_readme/coq/ReadMeDoc.txt"
+ install -D README.doc "$PREFIXCOQ/license_readme/coq/ReadMeDoc.txt" || true
install -D CHANGES "$PREFIXCOQ/license_readme/coq/Changes.txt"
install -D INSTALL "$PREFIXCOQ/license_readme/coq/Install.txt"
install -D INSTALL.doc "$PREFIXCOQ/license_readme/coq/InstallDoc.txt"
@@ -1174,7 +1174,7 @@ function make_mingw_make {
if build_prep http://ftp.gnu.org/gnu/make make-4.2 tar.bz2 ; then
# The config.h.win32 file is fine - don't edit it
# We need to copy the mingw gcc here as "gcc" - then the batch file will use it
- cp /usr/bin/${ARCH}-w64-mingw32-gcc-5.4.0.exe ./gcc.exe
+ cp /usr/bin/${ARCH}-w64-mingw32-gcc-6.4.0.exe ./gcc.exe
# By some magic cygwin bash can run batch files
logn build ./build_w32.bat gcc
# Copy make to Coq folder
diff --git a/dev/build/windows/patches_coq/coq_new.nsi b/dev/build/windows/patches_coq/coq_new.nsi
index b88aa066d..2c2f0fa47 100644
--- a/dev/build/windows/patches_coq/coq_new.nsi
+++ b/dev/build/windows/patches_coq/coq_new.nsi
@@ -15,7 +15,7 @@
SetCompressor lzma
!define MY_PRODUCT "Coq" ;Define your own software name here
-!define OUTFILE "coq-installer-${VERSION}-${ARCH}.exe"
+!define OUTFILE "coq-${VERSION}-installer-windows-${ARCH}.exe"
!include "MUI2.nsh"
!include "FileAssociation.nsh"
@@ -188,7 +188,7 @@ SectionEnd
Section "Uninstall"
; Files and folders
RMDir /r "$INSTDIR\bin"
- RMDir /r "$INSTDIR\dev"
+ RMDir /r "$INSTDIR\doc"
RMDir /r "$INSTDIR\etc"
RMDir /r "$INSTDIR\lib"
RMDir /r "$INSTDIR\libocaml"
diff --git a/dev/ci/README.md b/dev/ci/README.md
index f4423558c..bb13587e9 100644
--- a/dev/ci/README.md
+++ b/dev/ci/README.md
@@ -103,6 +103,8 @@ The process to merge your PR is then to submit PRs to the external
development repositories, merge the latter first (if the fixes are
backward-compatible), drop the overlay commit and merge the PR on Coq then.
+See also [`test-suite/README.md`](/test-suite/README.md) for information about adding new tests to the test-suite.
+
Travis specific information
---------------------------
diff --git a/dev/ci/appveyor.bat b/dev/ci/appveyor.bat
index e2fbf1f6d..dec6f0d18 100644
--- a/dev/ci/appveyor.bat
+++ b/dev/ci/appveyor.bat
@@ -25,7 +25,7 @@ if %USEOPAM% == false (
-destcyg=%CYGROOT% -destcoq=%DESTCOQ% -cygcache=%CYGCACHE% ^
-setup %CYGROOT%\%SETUP% || GOTO ErrorExit
copy "%CYGROOT%\build\coq-local\dev\nsis\*.exe" dev\nsis || GOTO ErrorExit
- 7z a coq-opensource-archive-%ARCHLONG%.zip %CYGROOT%\build\tarballs\* || GOTO ErrorExit
+ 7z a coq-opensource-archive-windows-%ARCHLONG%.zip %CYGROOT%\build\tarballs\* || GOTO ErrorExit
)
if %USEOPAM% == true (
@@ -37,5 +37,5 @@ if %USEOPAM% == true (
GOTO :EOF
:ErrorExit
- ECHO ERROR MakeCoq_MinGW.bat failed
+ ECHO ERROR %0 failed
EXIT /b 1
diff --git a/dev/ci/ci-basic-overlay.sh b/dev/ci/ci-basic-overlay.sh
index 59a71b608..784da6f97 100644
--- a/dev/ci/ci-basic-overlay.sh
+++ b/dev/ci/ci-basic-overlay.sh
@@ -4,128 +4,143 @@
# Maybe we should just use Ruby to have real objects...
+# : "${foo:=bar}" sets foo to "bar" if it is unset or null
+
########################################################################
# MathComp
########################################################################
-: ${mathcomp_CI_BRANCH:=master}
-: ${mathcomp_CI_GITURL:=https://github.com/math-comp/math-comp.git}
+: "${mathcomp_CI_BRANCH:=master}"
+: "${mathcomp_CI_GITURL:=https://github.com/math-comp/math-comp.git}"
########################################################################
# UniMath
########################################################################
-: ${UniMath_CI_BRANCH:=master}
-: ${UniMath_CI_GITURL:=https://github.com/UniMath/UniMath.git}
+: "${UniMath_CI_BRANCH:=master}"
+: "${UniMath_CI_GITURL:=https://github.com/UniMath/UniMath.git}"
########################################################################
# Unicoq + Metacoq
########################################################################
-: ${unicoq_CI_BRANCH:=master}
-: ${unicoq_CI_GITURL:=https://github.com/unicoq/unicoq.git}
+: "${unicoq_CI_BRANCH:=master}"
+: "${unicoq_CI_GITURL:=https://github.com/unicoq/unicoq.git}"
-: ${metacoq_CI_BRANCH:=master}
-: ${metacoq_CI_GITURL:=https://github.com/MetaCoq/MetaCoq.git}
+: "${metacoq_CI_BRANCH:=master}"
+: "${metacoq_CI_GITURL:=https://github.com/MetaCoq/MetaCoq.git}"
########################################################################
# Mathclasses + Corn
########################################################################
-: ${math_classes_CI_BRANCH:=master}
-: ${math_classes_CI_GITURL:=https://github.com/math-classes/math-classes.git}
+: "${math_classes_CI_BRANCH:=master}"
+: "${math_classes_CI_GITURL:=https://github.com/math-classes/math-classes.git}"
-: ${Corn_CI_BRANCH:=master}
-: ${Corn_CI_GITURL:=https://github.com/c-corn/corn.git}
+: "${Corn_CI_BRANCH:=master}"
+: "${Corn_CI_GITURL:=https://github.com/c-corn/corn.git}"
########################################################################
# Iris
########################################################################
-: ${stdpp_CI_BRANCH:=master}
-: ${stdpp_CI_GITURL:=https://gitlab.mpi-sws.org/robbertkrebbers/coq-stdpp.git}
+: "${stdpp_CI_BRANCH:=master}"
+: "${stdpp_CI_GITURL:=https://gitlab.mpi-sws.org/robbertkrebbers/coq-stdpp.git}"
-: ${Iris_CI_BRANCH:=master}
-: ${Iris_CI_GITURL:=https://gitlab.mpi-sws.org/FP/iris-coq.git}
+: "${Iris_CI_BRANCH:=master}"
+: "${Iris_CI_GITURL:=https://gitlab.mpi-sws.org/FP/iris-coq.git}"
-: ${lambdaRust_CI_BRANCH:=master}
-: ${lambdaRust_CI_GITURL:=https://gitlab.mpi-sws.org/FP/LambdaRust-coq.git}
+: "${lambdaRust_CI_BRANCH:=master}"
+: "${lambdaRust_CI_GITURL:=https://gitlab.mpi-sws.org/FP/LambdaRust-coq.git}"
########################################################################
# HoTT
########################################################################
-: ${HoTT_CI_BRANCH:=master}
-: ${HoTT_CI_GITURL:=https://github.com/HoTT/HoTT.git}
+: "${HoTT_CI_BRANCH:=master}"
+: "${HoTT_CI_GITURL:=https://github.com/HoTT/HoTT.git}"
+
+########################################################################
+# Ltac2
+########################################################################
+: "${ltac2_CI_BRANCH:=master}"
+: "${ltac2_CI_GITURL:=https://github.com/ppedrot/ltac2.git}"
########################################################################
# GeoCoq
########################################################################
-: ${GeoCoq_CI_BRANCH:=master}
-: ${GeoCoq_CI_GITURL:=https://github.com/GeoCoq/GeoCoq.git}
+: "${GeoCoq_CI_BRANCH:=master}"
+: "${GeoCoq_CI_GITURL:=https://github.com/GeoCoq/GeoCoq.git}"
########################################################################
# Flocq
########################################################################
-: ${Flocq_CI_BRANCH:=master}
-: ${Flocq_CI_GITURL:=https://scm.gforge.inria.fr/anonscm/git/flocq/flocq.git}
+: "${Flocq_CI_BRANCH:=master}"
+: "${Flocq_CI_GITURL:=https://gitlab.inria.fr/flocq/flocq.git}"
########################################################################
# Coquelicot
########################################################################
-: ${Coquelicot_CI_BRANCH:=master}
-: ${Coquelicot_CI_GITURL:=https://scm.gforge.inria.fr/anonscm/git/coquelicot/coquelicot.git}
+: "${Coquelicot_CI_BRANCH:=master}"
+: "${Coquelicot_CI_GITURL:=https://scm.gforge.inria.fr/anonscm/git/coquelicot/coquelicot.git}"
########################################################################
# CompCert
########################################################################
-: ${CompCert_CI_BRANCH:=master}
-: ${CompCert_CI_GITURL:=https://github.com/AbsInt/CompCert.git}
+: "${CompCert_CI_BRANCH:=master}"
+: "${CompCert_CI_GITURL:=https://github.com/AbsInt/CompCert.git}"
########################################################################
# VST
########################################################################
-: ${VST_CI_BRANCH:=master}
-: ${VST_CI_GITURL:=https://github.com/PrincetonUniversity/VST.git}
+: "${VST_CI_BRANCH:=master}"
+: "${VST_CI_GITURL:=https://github.com/PrincetonUniversity/VST.git}"
########################################################################
# fiat_parsers
########################################################################
-: ${fiat_parsers_CI_BRANCH:=master}
-: ${fiat_parsers_CI_GITURL:=https://github.com/mit-plv/fiat.git}
+: "${fiat_parsers_CI_BRANCH:=master}"
+: "${fiat_parsers_CI_GITURL:=https://github.com/mit-plv/fiat.git}"
########################################################################
# fiat_crypto
########################################################################
-: ${fiat_crypto_CI_BRANCH:=master}
-: ${fiat_crypto_CI_GITURL:=https://github.com/mit-plv/fiat-crypto.git}
+: "${fiat_crypto_CI_BRANCH:=master}"
+: "${fiat_crypto_CI_GITURL:=https://github.com/mit-plv/fiat-crypto.git}"
########################################################################
# formal-topology
########################################################################
-: ${formal_topology_CI_BRANCH:=ci}
-: ${formal_topology_CI_GITURL:=https://github.com/bmsherman/topology.git}
+: "${formal_topology_CI_BRANCH:=ci}"
+: "${formal_topology_CI_GITURL:=https://github.com/bmsherman/topology.git}"
########################################################################
# coq-dpdgraph
########################################################################
-: ${coq_dpdgraph_CI_BRANCH:=coq-trunk}
-: ${coq_dpdgraph_CI_GITURL:=https://github.com/Karmaki/coq-dpdgraph.git}
+: "${coq_dpdgraph_CI_BRANCH:=coq-trunk}"
+: "${coq_dpdgraph_CI_GITURL:=https://github.com/Karmaki/coq-dpdgraph.git}"
########################################################################
# CoLoR
########################################################################
-: ${Color_CI_SVNURL:=https://scm.gforge.inria.fr/anonscm/svn/color/trunk/color}
+: "${CoLoR_CI_BRANCH:=master}"
+: "${CoLoR_CI_GITURL:=https://github.com/fblanqui/color.git}"
########################################################################
# SF
########################################################################
-: ${sf_lf_CI_TARURL:=https://www.cis.upenn.edu/~bcpierce/sf/lf-current/lf.tgz}
-: ${sf_plf_CI_TARURL:=https://www.cis.upenn.edu/~bcpierce/sf/plf-current/plf.tgz}
-: ${sf_vfa_CI_TARURL:=https://www.cis.upenn.edu/~bcpierce/sf/vfa-current/vfa.tgz}
+: "${sf_lf_CI_TARURL:=https://www.cis.upenn.edu/~bcpierce/sf/lf-current/lf.tgz}"
+: "${sf_plf_CI_TARURL:=https://www.cis.upenn.edu/~bcpierce/sf/plf-current/plf.tgz}"
+: "${sf_vfa_CI_TARURL:=https://www.cis.upenn.edu/~bcpierce/sf/vfa-current/vfa.tgz}"
########################################################################
# TLC
########################################################################
-: ${tlc_CI_BRANCH:=master}
-: ${tlc_CI_GITURL:=https://gforge.inria.fr/git/tlc/tlc.git}
+: "${tlc_CI_BRANCH:=master}"
+: "${tlc_CI_GITURL:=https://gforge.inria.fr/git/tlc/tlc.git}"
########################################################################
# Bignums
########################################################################
-: ${bignums_CI_BRANCH:=master}
-: ${bignums_CI_GITURL:=https://github.com/coq/bignums.git}
+: "${bignums_CI_BRANCH:=master}"
+: "${bignums_CI_GITURL:=https://github.com/coq/bignums.git}"
+
+########################################################################
+# Equations
+########################################################################
+: "${Equations_CI_BRANCH:=8.8+alpha}"
+: "${Equations_CI_GITURL:=https://github.com/mattam82/Coq-Equations.git}"
diff --git a/dev/ci/ci-bignums.sh b/dev/ci/ci-bignums.sh
index ff5935d4c..c90e516ae 100755
--- a/dev/ci/ci-bignums.sh
+++ b/dev/ci/ci-bignums.sh
@@ -4,7 +4,7 @@ ci_dir="$(dirname "$0")"
# This script could be included inside other ones
# Let's avoid to source ci-common twice in this case
-if [ -z "${CI_BUILD_DIR}"];
+if [ -z "${CI_BUILD_DIR}" ];
then
source ${ci_dir}/ci-common.sh
fi
@@ -13,4 +13,4 @@ bignums_CI_DIR=${CI_BUILD_DIR}/Bignums
git_checkout ${bignums_CI_BRANCH} ${bignums_CI_GITURL} ${bignums_CI_DIR}
-( cd ${bignums_CI_DIR} && make -j ${NJOBS} && make install)
+( cd ${bignums_CI_DIR} && make && make install)
diff --git a/dev/ci/ci-color.sh b/dev/ci/ci-color.sh
index 309050057..558e8cbb8 100755
--- a/dev/ci/ci-color.sh
+++ b/dev/ci/ci-color.sh
@@ -3,33 +3,8 @@
ci_dir="$(dirname "$0")"
source ${ci_dir}/ci-common.sh
-Color_CI_DIR=${CI_BUILD_DIR}/color
+CoLoR_CI_DIR=${CI_BUILD_DIR}/color
-# Setup Bignums
-
-source ${ci_dir}/ci-bignums.sh
-
-# Compiles CoLoR
-
-svn checkout ${Color_CI_SVNURL} ${Color_CI_DIR}
-
-sed -i -e "s/From Coq Require Import BigN/From Bignums Require Import BigN/" ${Color_CI_DIR}/Util/*/*.v
-sed -i -e "s/From Coq Require Export BigN/From Bignums Require Export BigN/" ${Color_CI_DIR}/Util/*/*.v
-sed -i -e "s/From Coq Require Import BigZ/From Bignums Require Import BigZ/" ${Color_CI_DIR}/Util/*/*.v
-sed -i -e "s/From Coq Require Export BigZ/From Bignums Require Export BigZ/" ${Color_CI_DIR}/Util/*/*.v
-
-# Adapt to PR #220 (FunInd not loaded in Prelude anymore)
-sed -i -e "15i From Coq Require Import FunInd." ${Color_CI_DIR}/Coccinelle/basis/ordered_set.v
-sed -i -e "8i From Coq Require Import FunInd." ${Color_CI_DIR}/Coccinelle/examples/cime_trace/equational_extension.v
-sed -i -e "6i From Coq Require Import FunInd." ${Color_CI_DIR}/Coccinelle/examples/cime_trace/more_list_extention.v
-sed -i -e "6i From Coq Require Import FunInd." ${Color_CI_DIR}/Coccinelle/examples/cime_trace/ring_extention.v
-sed -i -e "27i From Coq Require Import FunInd." ${Color_CI_DIR}/Coccinelle/list_extensions/dickson.v
-sed -i -e "26i From Coq Require Import FunInd." ${Color_CI_DIR}/Coccinelle/list_extensions/list_permut.v
-sed -i -e "23i From Coq Require Import FunInd." ${Color_CI_DIR}/Coccinelle/list_extensions/list_set.v
-sed -i -e "25i From Coq Require Import FunInd." ${Color_CI_DIR}/Coccinelle/list_extensions/list_sort.v
-sed -i -e "21i From Coq Require Import FunInd." ${Color_CI_DIR}/Coccinelle/list_extensions/more_list.v
-sed -i -e "21i From Coq Require Import FunInd." ${Color_CI_DIR}/Util/List/ListUtil.v
-sed -i -e "17i From Coq Require Import FunInd." ${Color_CI_DIR}/Util/Multiset/MultisetOrder.v
-sed -i -e "13i From Coq Require Import FunInd." ${Color_CI_DIR}/Util/Set/SetUtil.v
-
-( cd ${Color_CI_DIR} && make )
+# Compile CoLoR
+git_checkout ${CoLoR_CI_BRANCH} ${CoLoR_CI_GITURL} ${CoLoR_CI_DIR}
+( cd ${CoLoR_CI_DIR} && make )
diff --git a/dev/ci/ci-common.sh b/dev/ci/ci-common.sh
index 1bfdf7dfb..d7a356930 100644
--- a/dev/ci/ci-common.sh
+++ b/dev/ci/ci-common.sh
@@ -2,12 +2,27 @@
set -xe
+# default value for NJOBS
+: "${NJOBS:=1}"
+export NJOBS
+
if [ -n "${GITLAB_CI}" ];
then
- export COQBIN=`pwd`/_install_ci/bin
- export TRAVIS_BRANCH="$CI_COMMIT_REF_NAME"
+ export COQBIN="$PWD/_install_ci/bin"
+ export CI_BRANCH="$CI_COMMIT_REF_NAME"
else
- export COQBIN=`pwd`/bin
+ if [ -n "${TRAVIS}" ];
+ then
+ export CI_PULL_REQUEST="$TRAVIS_PULL_REQUEST"
+ export CI_BRANCH="$TRAVIS_BRANCH"
+ elif [ -n "${CIRCLECI}" ];
+ then
+ export CI_PULL_REQUEST="$CIRCLE_PR_NUMBER"
+ export CI_BRANCH="$CIRCLE_BRANCH"
+ else # assume local
+ export CI_BRANCH="$(git rev-parse --abbrev-ref HEAD)"
+ fi
+ export COQBIN="$PWD/bin"
fi
export PATH="$COQBIN:$PATH"
@@ -17,14 +32,16 @@ export COQBIN="$COQBIN/"
ls "$COQBIN"
# Where we clone and build external developments
-CI_BUILD_DIR=`pwd`/_build_ci
+CI_BUILD_DIR="$PWD/_build_ci"
-for overlay in ${ci_dir}/user-overlays/*.sh; do
- source ${overlay}
+# shellcheck source=ci-basic-overlay.sh
+source "${ci_dir}/ci-basic-overlay.sh"
+for overlay in "${ci_dir}"/user-overlays/*.sh; do
+ # shellcheck source=/dev/null
+ source "${overlay}"
done
-source ${ci_dir}/ci-basic-overlay.sh
-mathcomp_CI_DIR=${CI_BUILD_DIR}/math-comp
+mathcomp_CI_DIR="${CI_BUILD_DIR}/math-comp"
# git_checkout branch url dest will create a git repository
# in <dest> (if it does not exist already) and checkout the
@@ -37,15 +54,16 @@ git_checkout()
# Allow an optional 4th argument for the commit
local _COMMIT=${4:-FETCH_HEAD}
- local _DEPTH=$(if [ -z "${4}" ]; then echo "--depth 1"; fi)
-
- mkdir -p ${_DEST}
- ( cd ${_DEST} && \
- if [ ! -d .git ] ; then git clone ${_DEPTH} ${_URL} . ; fi && \
- echo "Checking out ${_DEST}" && \
- git fetch ${_URL} ${_BRANCH} && \
- git checkout ${_COMMIT} && \
- echo "${_DEST}: `git log -1 --format='%s | %H | %cd | %aN'`" )
+ local _DEPTH=()
+ if [ -z "${4}" ]; then _DEPTH=(--depth 1); fi
+
+ mkdir -p "${_DEST}"
+ ( cd "${_DEST}" && \
+ if [ ! -d .git ] ; then git clone "${_DEPTH[@]}" "${_URL}" . ; fi && \
+ echo "Checking out ${_DEST}" && \
+ git fetch "${_URL}" "${_BRANCH}" && \
+ git checkout "${_COMMIT}" && \
+ echo "${_DEST}: $(git log -1 --format='%s | %H | %cd | %aN')" )
}
checkout_mathcomp()
@@ -53,13 +71,25 @@ checkout_mathcomp()
git_checkout ${mathcomp_CI_BRANCH} ${mathcomp_CI_GITURL} ${1}
}
+make()
+{
+ # +x: add x only if defined
+ if [ -z "${MAKEFLAGS+x}" ] && [ -n "${NJOBS}" ];
+ then
+ # Not submake and parallel make requested
+ command make -j "$NJOBS" "$@"
+ else
+ command make "$@"
+ fi
+}
+
# this installs just the ssreflect library of math-comp
install_ssreflect()
{
echo 'Installing ssreflect' && echo -en 'travis_fold:start:ssr.install\\r'
- checkout_mathcomp ${mathcomp_CI_DIR}
- ( cd ${mathcomp_CI_DIR}/mathcomp && \
+ checkout_mathcomp "${mathcomp_CI_DIR}"
+ ( cd "${mathcomp_CI_DIR}/mathcomp" && \
sed -i.bak '/ssrtest/d' Make && \
sed -i.bak '/odd_order/d' Make && \
sed -i.bak '/all\/all.v/d' Make && \
diff --git a/dev/ci/ci-compcert.sh b/dev/ci/ci-compcert.sh
index 4cfe0911b..6a0ce2aef 100755
--- a/dev/ci/ci-compcert.sh
+++ b/dev/ci/ci-compcert.sh
@@ -5,9 +5,7 @@ source ${ci_dir}/ci-common.sh
CompCert_CI_DIR=${CI_BUILD_DIR}/CompCert
-opam install -j ${NJOBS} -y menhir
+opam install -j "$NJOBS" -y menhir
git_checkout ${CompCert_CI_BRANCH} ${CompCert_CI_GITURL} ${CompCert_CI_DIR}
-# Patch to avoid the upper version limit
-( cd ${CompCert_CI_DIR} && ./configure -ignore-coq-version x86_32-linux && make )
-
+( cd ${CompCert_CI_DIR} && ./configure -ignore-coq-version x86_32-linux && make && make check-proof )
diff --git a/dev/ci/ci-coq-dpdgraph.sh b/dev/ci/ci-coq-dpdgraph.sh
index b610f7000..5d6bd6a36 100755
--- a/dev/ci/ci-coq-dpdgraph.sh
+++ b/dev/ci/ci-coq-dpdgraph.sh
@@ -7,4 +7,4 @@ coq_dpdgraph_CI_DIR=${CI_BUILD_DIR}/coq-dpdgraph
git_checkout ${coq_dpdgraph_CI_BRANCH} ${coq_dpdgraph_CI_GITURL} ${coq_dpdgraph_CI_DIR}
-( cd ${coq_dpdgraph_CI_DIR} && autoconf && ./configure && make -j ${NJOBS} && make test-suite )
+( cd ${coq_dpdgraph_CI_DIR} && autoconf && ./configure && make && make test-suite )
diff --git a/dev/ci/ci-corn.sh b/dev/ci/ci-corn.sh
new file mode 100755
index 000000000..54cad5df4
--- /dev/null
+++ b/dev/ci/ci-corn.sh
@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+
+ci_dir="$(dirname "$0")"
+source ${ci_dir}/ci-common.sh
+
+Corn_CI_DIR=${CI_BUILD_DIR}/corn
+
+git_checkout ${Corn_CI_BRANCH} ${Corn_CI_GITURL} ${Corn_CI_DIR}
+
+( cd ${Corn_CI_DIR} && make && make install )
diff --git a/dev/ci/ci-equations.sh b/dev/ci/ci-equations.sh
new file mode 100755
index 000000000..62854afac
--- /dev/null
+++ b/dev/ci/ci-equations.sh
@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+
+ci_dir="$(dirname "$0")"
+source ${ci_dir}/ci-common.sh
+
+Equations_CI_DIR=${CI_BUILD_DIR}/Equations
+
+git_checkout ${Equations_CI_BRANCH} ${Equations_CI_GITURL} ${Equations_CI_DIR}
+
+( cd ${Equations_CI_DIR} && coq_makefile -f _CoqProject -o Makefile && make && make test-suite && make examples && make install)
diff --git a/dev/ci/ci-formal-topology.sh b/dev/ci/ci-formal-topology.sh
index 2556f84a5..53eb55fc4 100755
--- a/dev/ci/ci-formal-topology.sh
+++ b/dev/ci/ci-formal-topology.sh
@@ -3,30 +3,8 @@
ci_dir="$(dirname "$0")"
source ${ci_dir}/ci-common.sh
-math_classes_CI_DIR=${CI_BUILD_DIR}/math-classes
-
-Corn_CI_DIR=${CI_BUILD_DIR}/corn
-
formal_topology_CI_DIR=${CI_BUILD_DIR}/formal-topology
-# Setup Bignums
-
-source ${ci_dir}/ci-bignums.sh
-
-# Setup Math-Classes
-
-git_checkout ${math_classes_CI_BRANCH} ${math_classes_CI_GITURL} ${math_classes_CI_DIR}
-
-( cd ${math_classes_CI_DIR} && make && make install )
-
-# Setup Corn
-
-git_checkout ${Corn_CI_BRANCH} ${Corn_CI_GITURL} ${Corn_CI_DIR}
-
-( cd ${Corn_CI_DIR} && make && make install )
-
-# Setup formal-topology
-
git_checkout ${formal_topology_CI_BRANCH} ${formal_topology_CI_GITURL} ${formal_topology_CI_DIR}
( cd ${formal_topology_CI_DIR} && make )
diff --git a/dev/ci/ci-hott.sh b/dev/ci/ci-hott.sh
index 1bf6e9a87..693135a4c 100755
--- a/dev/ci/ci-hott.sh
+++ b/dev/ci/ci-hott.sh
@@ -7,4 +7,4 @@ HoTT_CI_DIR=${CI_BUILD_DIR}/HoTT
git_checkout ${HoTT_CI_BRANCH} ${HoTT_CI_GITURL} ${HoTT_CI_DIR}
-( cd ${HoTT_CI_DIR} && ./autogen.sh && ./configure && make -j ${NJOBS} )
+( cd ${HoTT_CI_DIR} && ./autogen.sh && ./configure && make )
diff --git a/dev/ci/ci-iris-lambda-rust.sh b/dev/ci/ci-iris-lambda-rust.sh
index cf24d202d..267e13359 100755
--- a/dev/ci/ci-iris-lambda-rust.sh
+++ b/dev/ci/ci-iris-lambda-rust.sh
@@ -34,8 +34,8 @@ git_checkout ${stdpp_CI_BRANCH} ${stdpp_URL_PARTS[0]} ${stdpp_CI_DIR} ${stdpp_UR
# Build std++
( cd ${stdpp_CI_DIR} && make && make install )
-# Build iris
-( cd ${Iris_CI_DIR} && make && make install )
+# Build and validate (except on Travis, i.e., skip if TRAVIS is non-empty) Iris
+( cd ${Iris_CI_DIR} && make && (test -n "${TRAVIS}" || make validate) && make install )
# Build lambdaRust
( cd ${lambdaRust_CI_DIR} && make && make install )
diff --git a/dev/ci/ci-ltac2.sh b/dev/ci/ci-ltac2.sh
new file mode 100755
index 000000000..820ff89ee
--- /dev/null
+++ b/dev/ci/ci-ltac2.sh
@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+
+ci_dir="$(dirname "$0")"
+source ${ci_dir}/ci-common.sh
+
+ltac2_CI_DIR=${CI_BUILD_DIR}/ltac2
+
+git_checkout ${ltac2_CI_BRANCH} ${ltac2_CI_GITURL} ${ltac2_CI_DIR}
+
+( cd ${ltac2_CI_DIR} && make && make tests && make install )
diff --git a/dev/ci/ci-math-classes.sh b/dev/ci/ci-math-classes.sh
index 2837dee96..db4a31e54 100755
--- a/dev/ci/ci-math-classes.sh
+++ b/dev/ci/ci-math-classes.sh
@@ -5,20 +5,6 @@ source ${ci_dir}/ci-common.sh
math_classes_CI_DIR=${CI_BUILD_DIR}/math-classes
-Corn_CI_DIR=${CI_BUILD_DIR}/corn
-
-# Setup Bignums
-
-source ${ci_dir}/ci-bignums.sh
-
-# Setup Math-Classes
-
git_checkout ${math_classes_CI_BRANCH} ${math_classes_CI_GITURL} ${math_classes_CI_DIR}
( cd ${math_classes_CI_DIR} && make && make install )
-
-# Setup Corn
-
-git_checkout ${Corn_CI_BRANCH} ${Corn_CI_GITURL} ${Corn_CI_DIR}
-
-( cd ${Corn_CI_DIR} && make )
diff --git a/dev/ci/ci-sf.sh b/dev/ci/ci-sf.sh
index 272041205..4e8c7e145 100755
--- a/dev/ci/ci-sf.sh
+++ b/dev/ci/ci-sf.sh
@@ -3,17 +3,33 @@
ci_dir="$(dirname "$0")"
source ${ci_dir}/ci-common.sh
-# XXX: Needs fixing to properly set the build directory.
-wget ${sf_lf_CI_TARURL}
-wget ${sf_plf_CI_TARURL}
-wget ${sf_vfa_CI_TARURL}
-tar xvfz lf.tgz
-tar xvfz plf.tgz
-tar xvfz vfa.tgz
+mkdir -p ${CI_BUILD_DIR} && cd ${CI_BUILD_DIR}
+wget -qO- ${sf_lf_CI_TARURL} | tar xvz
+wget -qO- ${sf_plf_CI_TARURL} | tar xvz
+wget -qO- ${sf_vfa_CI_TARURL} | tar xvz
sed -i.bak '1i From Coq Require Extraction.' lf/Extraction.v
sed -i.bak '1i From Coq Require Extraction.' vfa/Extract.v
+# Delete useless calls to try omega; unfold
+patch vfa/SearchTree.v <<EOF
+*** SearchTree.v.bak 2017-09-06 19:12:59.000000000 +0200
+--- SearchTree.v 2017-11-21 16:34:41.000000000 +0100
+***************
+*** 674,683 ****
+ forall i j : key, ~ (i > j) -> ~ (i < j) -> i=j.
+ Proof.
+ intros.
+- try omega. (* Oops! [omega] cannot solve this one.
+- The problem is that [i] and [j] have type [key] instead of type [nat].
+- The solution is easy enough: *)
+- unfold key in *.
+ omega.
+
+ (** So, if you get stuck on an [omega] that ought to work,
+--- 674,679 ----
+EOF
+
( cd lf && make clean && make )
( cd plf && sed -i.bak 's/(K,N)/((K,N))/' LibTactics.v && make clean && make )
diff --git a/dev/ci/ci-vst.sh b/dev/ci/ci-vst.sh
index 5bfc408e9..5760fbafb 100755
--- a/dev/ci/ci-vst.sh
+++ b/dev/ci/ci-vst.sh
@@ -8,6 +8,6 @@ VST_CI_DIR=${CI_BUILD_DIR}/VST
# opam install -j ${NJOBS} -y menhir
git_checkout ${VST_CI_BRANCH} ${VST_CI_GITURL} ${VST_CI_DIR}
-# Targets are: msl veric floyd
+# Targets are: msl veric floyd progs , we remove progs to save time
# Patch to avoid the upper version limit
-( cd ${VST_CI_DIR} && make IGNORECOQVERSION=true )
+( cd ${VST_CI_DIR} && make IGNORECOQVERSION=true .loadpath version.vo msl veric floyd )
diff --git a/dev/ci/ci-wrapper.sh b/dev/ci/ci-wrapper.sh
index 96acc5a11..12a70176c 100755
--- a/dev/ci/ci-wrapper.sh
+++ b/dev/ci/ci-wrapper.sh
@@ -13,11 +13,14 @@ function travis_fold {
fi
}
-CI_SCRIPT="$1"
+CI_NAME="$1"
+CI_SCRIPT="ci-${CI_NAME}.sh"
+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# assume this script is in dev/ci/, cd to the root Coq directory
cd "${DIR}/../.."
+export TIMED=1
"${DIR}/${CI_SCRIPT}" 2>&1 | tee time-of-build.log
travis_fold 'start' 'coq.test.timing' && echo 'Aggregating timing log...'
python ./tools/make-one-time-file.py time-of-build.log
diff --git a/dev/ci/user-overlays/00669-maximedenes-ssr-merge.sh b/dev/ci/user-overlays/00669-maximedenes-ssr-merge.sh
index af4a96f4a..7716bcb59 100644
--- a/dev/ci/user-overlays/00669-maximedenes-ssr-merge.sh
+++ b/dev/ci/user-overlays/00669-maximedenes-ssr-merge.sh
@@ -1,4 +1,4 @@
-if [ "$TRAVIS_PULL_REQUEST" = "669" ] || [ "$TRAVIS_BRANCH" = "ssr-merge" ]; then
+if [ "$CI_PULL_REQUEST" = "669" ] || [ "$CI_BRANCH" = "ssr-merge" ]; then
mathcomp_CI_BRANCH=ssr-merge
mathcomp_CI_GITURL=https://github.com/maximedenes/math-comp.git
fi
diff --git a/dev/ci/user-overlays/06405-maximedenes-rm-local-polymorphic-flag.sh b/dev/ci/user-overlays/06405-maximedenes-rm-local-polymorphic-flag.sh
new file mode 100644
index 000000000..c2e367038
--- /dev/null
+++ b/dev/ci/user-overlays/06405-maximedenes-rm-local-polymorphic-flag.sh
@@ -0,0 +1,4 @@
+if [ "$CI_PULL_REQUEST" = "6405" ] || [ "$CI_BRANCH" = "rm-local-polymorphic-flag" ]; then
+ Equations_CI_BRANCH=rm-local-polymorphic-flag
+ Equations_CI_GITURL=https://github.com/maximedenes/Coq-Equations
+fi
diff --git a/dev/ci/user-overlays/06482-ppedrot-check-poly-effects.sh b/dev/ci/user-overlays/06482-ppedrot-check-poly-effects.sh
new file mode 100644
index 000000000..78789a6fc
--- /dev/null
+++ b/dev/ci/user-overlays/06482-ppedrot-check-poly-effects.sh
@@ -0,0 +1,4 @@
+if [ "$TRAVIS_PULL_REQUEST" = "6483" ] || [ "$TRAVIS_BRANCH" = "check-poly-effects" ]; then
+ HoTT_CI_BRANCH=check-poly-effects
+ HoTT_CI_GITURL=https://github.com/ppedrot/HoTT.git
+fi
diff --git a/dev/ci/user-overlays/06493-gares-API-remove-big-file.sh b/dev/ci/user-overlays/06493-gares-API-remove-big-file.sh
new file mode 100644
index 000000000..9677b3525
--- /dev/null
+++ b/dev/ci/user-overlays/06493-gares-API-remove-big-file.sh
@@ -0,0 +1,8 @@
+if [ "$CI_PULL_REQUEST" = "6493" ] || [ "$CI_BRANCH" = "API/remove-big-file" ]; then
+ Equations_CI_BRANCH=API-removal
+ Equations_CI_GITURL=https://github.com/gares/Coq-Equations.git
+ coq_dpdgraph_CI_BRANCH=API-removal
+ coq_dpdgraph_CI_GITURL=https://github.com/gares/coq-dpdgraph.git
+ ltac2_CI_BRANCH=API-removal
+ ltac2_CI_GITURL=https://github.com/gares/ltac2.git
+fi
diff --git a/dev/ci/user-overlays/06535-fix-push-rel-to-named.sh b/dev/ci/user-overlays/06535-fix-push-rel-to-named.sh
new file mode 100644
index 000000000..8a50fb111
--- /dev/null
+++ b/dev/ci/user-overlays/06535-fix-push-rel-to-named.sh
@@ -0,0 +1,4 @@
+if [ "$CI_PULL_REQUEST" = "6535" ] || [ "$CI_BRANCH" = "fix-push-rel-to-named" ]; then
+ Equations_CI_BRANCH=fix-6535
+ Equations_CI_GITURL=https://github.com/ppedrot/Coq-Equations
+fi
diff --git a/dev/ci/user-overlays/06686-ccnv-no-proj.sh b/dev/ci/user-overlays/06686-ccnv-no-proj.sh
new file mode 100644
index 000000000..3a3ab44e0
--- /dev/null
+++ b/dev/ci/user-overlays/06686-ccnv-no-proj.sh
@@ -0,0 +1,4 @@
+if [ "$CI_PULL_REQUEST" = "6686" ] || [ "$CI_BRANCH" = "ccnv-no-proj" ]; then
+ Equations_CI_BRANCH=ccnv-fixes
+ Equations_CI_GITURL=https://github.com/SkySkimmer/Coq-Equations
+fi
diff --git a/dev/ci/user-overlays/README.md b/dev/ci/user-overlays/README.md
index 9146d3d52..9f0377cee 100644
--- a/dev/ci/user-overlays/README.md
+++ b/dev/ci/user-overlays/README.md
@@ -7,8 +7,10 @@ The name of your overlay file should be of the form `five_digit_PR_number-GitHub
Example: `00669-maximedenes-ssr-merge.sh` containing
```
-if [ "$TRAVIS_PULL_REQUEST" = "669" ] || [ "$TRAVIS_BRANCH" = "ssr-merge" ]; then
+if [ "$CI_PULL_REQUEST" = "669" ] || [ "$CI_BRANCH" = "ssr-merge" ]; then
mathcomp_CI_BRANCH=ssr-merge
mathcomp_CI_GITURL=https://github.com/maximedenes/math-comp.git
fi
```
+
+(`CI_PULL_REQUEST` and `CI_BRANCH` are set in [`ci-common.sh`](/dev/ci/ci-common.sh))
diff --git a/dev/core.dbg b/dev/core.dbg
index 18e82c352..00a4355a4 100644
--- a/dev/core.dbg
+++ b/dev/core.dbg
@@ -17,5 +17,4 @@ load_printer vernac.cma
load_printer stm.cma
load_printer toplevel.cma
load_printer intf.cma
-load_printer API.cma
load_printer ltac_plugin.cmo
diff --git a/dev/db b/dev/db
index a5518e3c4..2f8c13485 100644
--- a/dev/db
+++ b/dev/db
@@ -1,37 +1,67 @@
source core.dbg
load_printer top_printers.cmo
+install_printer Top_printers.pP
install_printer Top_printers.ppfuture
-
install_printer Top_printers.ppid
-install_printer Top_printers.ppidset
-install_printer Top_printers.ppevar
-install_printer Top_printers.ppevarsubst
-install_printer Top_printers.ppexistentialfilter
-install_printer Top_printers.ppexistentialset
-install_printer Top_printers.ppintset
install_printer Top_printers.pplab
-install_printer Top_printers.ppdir
install_printer Top_printers.ppmbid
+install_printer Top_printers.ppdir
install_printer Top_printers.ppmp
-install_printer Top_printers.ppkn
install_printer Top_printers.ppcon
-install_printer Top_printers.ppwf_paths
+install_printer Top_printers.ppproj
+install_printer Top_printers.ppkn
install_printer Top_printers.ppmind
+install_printer Top_printers.ppind
install_printer Top_printers.ppsp
install_printer Top_printers.ppqualid
install_printer Top_printers.ppclindex
-install_printer Top_printers.ppbigint
-install_printer Top_printers.pp_transparent_state
-
-install_printer Top_printers.pppattern
-install_printer Top_printers.ppglob_constr
-
+install_printer Top_printers.ppscheme
+install_printer Top_printers.ppwf_paths
+install_printer Top_printers.ppevar
install_printer Top_printers.ppconstr
+install_printer Top_printers.ppsconstr
install_printer Top_printers.ppeconstr
+install_printer Top_printers.ppconstr_expr
+install_printer Top_printers.ppglob_constr
+install_printer Top_printers.pppattern
+install_printer Top_printers.ppfconstr
+install_printer Top_printers.ppbigint
+install_printer Top_printers.ppintset
+install_printer Top_printers.ppidset
+install_printer Top_printers.ppidmapgen
+install_printer Top_printers.ppididmap
+install_printer Top_printers.ppconstrunderbindersidmap
+install_printer Top_printers.ppevarsubst
+install_printer Top_printers.ppunbound_ltac_var_map
+install_printer Top_printers.ppclosure
+install_printer Top_printers.ppclosedglobconstr
+install_printer Top_printers.ppclosedglobconstridmap
+install_printer Top_printers.ppglobal
+install_printer Top_printers.ppconst
+install_printer Top_printers.ppvar
+install_printer Top_printers.ppj
+install_printer Top_printers.ppsubst
+install_printer Top_printers.ppdelta
+install_printer Top_printers.pp_idpred
+install_printer Top_printers.pp_cpred
+install_printer Top_printers.pp_transparent_state
+install_printer Top_printers.pp_stack_t
+install_printer Top_printers.pp_cst_stack_t
+install_printer Top_printers.pp_state_t
+install_printer Top_printers.ppmetas
+install_printer Top_printers.ppevm
+install_printer Top_printers.ppexistentialset
+install_printer Top_printers.ppexistentialfilter
+install_printer Top_printers.ppclenv
+install_printer Top_printers.ppgoalgoal
+install_printer Top_printers.ppgoal
+install_printer Top_printers.pphintdb
+install_printer Top_printers.ppproofview
+install_printer Top_printers.ppopenconstr
+install_printer Top_printers.pproof
install_printer Top_printers.ppuni
-install_printer Top_printers.ppuniverses
-install_printer Top_printers.ppconstraints
+install_printer Top_printers.ppuni_level
install_printer Top_printers.ppuniverse_set
install_printer Top_printers.ppuniverse_instance
install_printer Top_printers.ppuniverse_context
@@ -40,33 +70,19 @@ install_printer Top_printers.ppuniverse_subst
install_printer Top_printers.ppuniverse_opt_subst
install_printer Top_printers.ppuniverse_level_subst
install_printer Top_printers.ppevar_universe_context
+install_printer Top_printers.ppconstraints
+install_printer Top_printers.ppuniverseconstraints
+install_printer Top_printers.ppuniverse_context_future
install_printer Top_printers.ppcumulativity_info
install_printer Top_printers.ppabstract_cumulativity_info
-install_printer Top_printers.pptype
-install_printer Top_printers.ppj
-install_printer Top_printers.ppenv
+install_printer Top_printers.ppuniverses
install_printer Top_printers.ppnamedcontextval
-install_printer Top_printers.pp_stack_t
-install_printer Top_printers.pp_cst_stack_t
-
-install_printer Top_printers.ppmetas
-install_printer Top_printers.ppevm
-install_printer Top_printers.ppgoalgoal
-install_printer Top_printers.ppgoal
-install_printer Top_printers.ppproofview
-install_printer Top_printers.pphintdb
-
+install_printer Top_printers.ppenv
install_printer Top_printers.pptac
install_printer Top_printers.ppobj
install_printer Top_printers.pploc
-install_printer Top_printers.prsubst
-install_printer Top_printers.prdelta
-install_printer Top_printers.ppfconstr
+install_printer Top_printers.pp_argument_type
+install_printer Top_printers.pp_generic_argument
install_printer Top_printers.ppgenarginfo
install_printer Top_printers.ppgenargargt
install_printer Top_printers.ppist
-install_printer Top_printers.ppconstrunderbindersidmap
-install_printer Top_printers.ppunbound_ltac_var_map
-install_printer Top_printers.ppididmap
-install_printer Top_printers.ppclosure
-install_printer Top_printers.ppclosedglobconstr
diff --git a/COMPATIBILITY b/dev/doc/COMPATIBILITY
index b5fed7f01..a81afca32 100644
--- a/COMPATIBILITY
+++ b/dev/doc/COMPATIBILITY
@@ -1,3 +1,6 @@
+Note: this file isn't used anymore. Incompatibilities are documented
+as part of CHANGES.
+
Potential sources of incompatibilities between Coq V8.6 and V8.7
----------------------------------------------------------------
@@ -5,10 +8,6 @@ Potential sources of incompatibilities between Coq V8.6 and V8.7
error rather than a warning when the superfluous name is already in
use. The easy fix is to remove the superfluous name.
-- Proofs ending in "Qed exporting ident, .., ident" are not supported
- anymore. Constants generated during `abstract` are kept private to the
- local environment.
-
Potential sources of incompatibilities between Coq V8.5 and V8.6
----------------------------------------------------------------
diff --git a/dev/doc/changes.md b/dev/doc/changes.md
index 707adce30..aef62b009 100644
--- a/dev/doc/changes.md
+++ b/dev/doc/changes.md
@@ -12,16 +12,6 @@ All the bugs with a number below 1154 had to be renumbered, you can find
a correspondence table [here](/dev/bugzilla2github_stripped.csv).
All the other bugs kept their number.
-### Plugin API
-
-Coq 8.8 offers a new module overlay containing a proposed plugin API
-in `API/API.ml`; this overlay is enabled by adding the `-open API`
-flag to the OCaml compiler; this happens automatically for
-developments in the `plugin` folder and `coq_makefile`.
-
-However, `coq_makefile` can be instructed not to enable this flag by
-passing `-bypass-API`.
-
### ML API
General deprecation
@@ -46,9 +36,14 @@ We changed the type of the following functions:
- `Global.body_of_constant`: same as above.
-We renamed the following datatypes:
+- `Constrinterp.*` generally, many functions that used to take an
+ `evar_map ref` have been now switched to functions that will work in
+ a functional way. The old style of passing `evar_map`s as references
+ is not supported anymore.
-- `Pp.std_ppcmds` -> `Pp.t`
+We have changed the representation of the following types:
+
+- `Lib.object_prefix` is now a record instead of a nested tuple.
Some tactics and related functions now support static configurability, e.g.:
@@ -63,6 +58,24 @@ Declaration of printers for arguments used only in vernac command
happen. An alternative is to register the corresponding argument as
a value, using "Geninterp.register_val0 wit None".
+### STM API
+
+The STM API has seen a general overhaul. The main change is the
+introduction of a "Coq document" type, which all operations now take
+as a parameter. This effectively functionalize the STM API and will
+allow in the future to handle several documents simultaneously.
+
+The main remarkable point is that key implicit global parameters such
+as load-paths and required modules are now arguments to the document
+creation function. This helps enforcing some key invariants.
+
+### XML IDE Protocol
+
+- Before 8.8, `Query` only executed the first command present in the
+ `query` string; starting with 8.8, the caller may include several
+ statements. This is useful for instance for temporarily setting an
+ option and then executing a command.
+
## Changes between Coq 8.6 and Coq 8.7
### Ocaml
diff --git a/dev/doc/debugging.md b/dev/doc/debugging.md
index 7e9373b29..fd3cbd1bc 100644
--- a/dev/doc/debugging.md
+++ b/dev/doc/debugging.md
@@ -22,8 +22,8 @@ Debugging from Coq toplevel using Caml trace mechanism
printers too.
-Debugging from Caml debugger
-============================
+Debugging with ocamldebug from Emacs
+====================================
Requires [Tuareg mode](https://github.com/ocaml/tuareg) in Emacs.\
Coq must be configured with `-local` (`./configure -local`) and the
@@ -54,9 +54,33 @@ Debugging from Caml debugger
of each of error* functions or anomaly* functions in lib/util.ml
- If "source db" fails, do a "make printers" and try again (it should build
top_printers.cmo and the core cma files).
- - If you have the OCAMLRUNPARAM environment variable set, Coq may hang on
- startup when run from the debugger. If this happens, unset the variable,
- re-start Emacs, and run the debugger again.
+ - If you build Coq with an OCaml version earlier than 4.06, and have the
+ OCAMLRUNPARAM environment variable set, Coq may hang on startup when run
+ from the debugger. If this happens, unset the variable, re-start Emacs, and
+ run the debugger again.
+
+Debugging with ocamldebug from the command line
+===============================================
+
+In the `coq` directory:
+1. (on Cygwin/Windows) Pass the `-no-custom` option to the `configure` script before building Coq.
+2. Run `make` (to compile the .v files)
+3. Run `make byte`
+4. (on Cygwin/Windows) Add the full pathname of the directory `.../kernel/byterun` to your bash PATH.
+ Alternatively, copy the file `kernel/byterun/dllcoqrun.dll` to a directory that is in the PATH. (The
+ CAML_LD_LIBRARY_PATH mechanism described at the end of INSTALL isn't working.)
+5. Run `dev/ocamldebug-coq bin/coqtop.byte` (on Cygwin/Windows, use `... bin/coqtop.byte.exe`)
+6. Enter `source db` to load printers
+7. Enter `set arguments -coqlib .` so Coq can find plugins, theories, etc.
+8. See the ocamldebug manual for more information. A few points:
+ - use `break @ Printer 501` to set a breakpoint on line 501 in the Printer module (printer.ml).
+ `break` can be abbreviated as `b`.
+ - `backtrace` or `bt` to see the call stack
+ - `step` or `s` goes into called functions; `next` or `n` skips over them
+ - `list` or `li` shows the code just before and after the current stack frame
+ - `print <var>` or `p <var>` to see the value of a variable
+Note that `make byte` doesn't recompile .v files. `make` recompiles all of them if there
+are changes in any .ml file--safer but much slower.
Global gprof-based profiling
============================
@@ -72,8 +96,8 @@ Per function profiling
To profile function foo in file bar.ml, add the following lines, just
after the definition of the function:
- let fookey = Profile.declare_profile "foo";;
- let foo a b c = Profile.profile3 fookey foo a b c;;
+ let fookey = CProfile.declare_profile "foo";;
+ let foo a b c = CProfile.profile3 fookey foo a b c;;
where foo is assumed to have three arguments (adapt using
Profile.profile1, Profile. profile2, etc).
diff --git a/dev/doc/setup.txt b/dev/doc/setup.txt
index 0c6d3ee80..0003a2c21 100644
--- a/dev/doc/setup.txt
+++ b/dev/doc/setup.txt
@@ -58,30 +58,12 @@ behave as expected.
A note about rlwrap
-------------------
-Running "coqtop" under "rlwrap" is possible, but (on Debian) there is a catch. If you try:
-
- cd ~/git/coq
- rlwrap bin/coqtop
-
-you will get an error:
+When using "rlwrap coqtop" make sure the version of rlwrap is at least
+0.42, otherwise you will get
rlwrap: error: Couldn't read completions from /usr/share/rlwrap/completions/coqtop: No such file or directory
-This is a known issue:
-
- https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=779692
-
-It was fixed upstream in version 0.42, and in a Debian package that, at the time of writing, is not part of Debian stable/testing/sid archives but only of Debian experimental.
-
- https://packages.debian.org/experimental/rlwrap
-
-The quick solution is to grab it from there, since it installs fine on Debian stable (jessie).
-
- cd /tmp
- wget http://ftp.us.debian.org/debian/pool/main/r/rlwrap/rlwrap_0.42-1_amd64.deb
- sudo dpkg -i rlwrap_0.42-1_amd64.deb
-
-After that, "rlwrap" works fine with "coqtop".
+If this happens either update or use an alternate readline wrapper like "ledit".
How to install and configure Merlin (for Emacs)
@@ -279,7 +261,7 @@ You can load them by switching to the window holding the "ocamldebug" shell and
Some of the functions were you might want to set a breakpoint and see what happens next
---------------------------------------------------------------------------------------
-- Coqtop.start : This function is called by the code produced by "coqmktop".
+- Coqtop.start : This function is the main entry point of coqtop.
- Coqtop.parse_args : This function is responsible for parsing command-line arguments.
- Coqloop.loop : This function implements the read-eval-print loop.
- Vernacentries.interp : This function is called to execute the Vernacular command user have typed.\
diff --git a/dev/doc/univpoly.txt b/dev/doc/univpoly.txt
index 6a69c5793..ca3d520c7 100644
--- a/dev/doc/univpoly.txt
+++ b/dev/doc/univpoly.txt
@@ -12,7 +12,7 @@ type pinductive = inductive puniverses
type pconstructor = constructor puniverses
type constr = ...
- | Const of puniversess
+ | Const of puniverses
| Ind of pinductive
| Constr of pconstructor
| Proj of constant * constr
diff --git a/dev/doc/xml-protocol.md b/dev/doc/xml-protocol.md
index 18f6288f6..b35571e9c 100644
--- a/dev/doc/xml-protocol.md
+++ b/dev/doc/xml-protocol.md
@@ -330,6 +330,12 @@ the STM API, `force` triggers a `Join`.
<string>${message}</string>
</value>
```
+
+Before 8.8, `Query` only executed the first command present in the
+`query` string; starting with 8.8, the caller may include several
+statements. This is useful for instance for temporarily setting an
+option and then executing a command.
+
-------------------------------
diff --git a/dev/include b/dev/include
index 0d34595f4..b982f4c9f 100644
--- a/dev/include
+++ b/dev/include
@@ -36,7 +36,6 @@
#install_printer (* constraints *) ppconstraints;;
#install_printer (* univ constraints *) ppuniverseconstraints;;
#install_printer (* universe *) ppuni;;
-#install_printer (* universes *) ppuniverse;;
#install_printer (* universes *) ppuniverses;;
#install_printer (* univ level *) ppuni_level;;
#install_printer (* univ context *) ppuniverse_context;;
diff --git a/dev/lint-repository.sh b/dev/lint-repository.sh
index ecf7880e2..ee9c8777a 100755
--- a/dev/lint-repository.sh
+++ b/dev/lint-repository.sh
@@ -9,20 +9,26 @@
CODE=0
-if [ "(" "-n" "${TRAVIS_PULL_REQUEST}" ")" "-a" "(" "${TRAVIS_PULL_REQUEST}" "!=" "false" ")" ];
+if [ -n "${TRAVIS_PULL_REQUEST}" ] && [ "${TRAVIS_PULL_REQUEST}" != false ];
then
+ # skip PRs from before the linter existed
+ if [ -z "$(git ls-tree --name-only "${TRAVIS_PULL_REQUEST_SHA}" dev/lint-commits.sh)" ];
+ then
+ 1>&2 echo "Linting skipped: pull request older than the linter."
+ exit 0
+ fi
+
# Some problems are too widespread to fix in one commit, but we
# can still check that they don't worsen.
CUR_HEAD=${TRAVIS_COMMIT_RANGE%%...*}
PR_HEAD=${TRAVIS_COMMIT_RANGE##*...}
- MERGE_BASE=$(git merge-base $CUR_HEAD $PR_HEAD)
- dev/lint-commits.sh $MERGE_BASE $PR_HEAD || CODE=1
+ MERGE_BASE=$(git merge-base "$CUR_HEAD" "$PR_HEAD")
+ dev/lint-commits.sh "$MERGE_BASE" "$PR_HEAD" || CODE=1
fi
# Check that the files with 'whitespace' gitattribute end in a newline.
# xargs exit status is 123 if any file failed the test
-find . "(" -path ./.git -prune ")" -type f \
--o "(" -exec dev/tools/should-check-whitespace.sh '{}' ';' ")" \
--print0 | xargs -0 -L 1 dev/tools/check-eof-newline.sh || CODE=1
+find . "(" -path ./.git -prune ")" -o -type f -print0 |
+ xargs -0 dev/tools/check-eof-newline.sh || CODE=1
exit $CODE
diff --git a/dev/nsis/coq.nsi b/dev/nsis/coq.nsi
index 80da84517..f48013cf2 100755
--- a/dev/nsis/coq.nsi
+++ b/dev/nsis/coq.nsi
@@ -13,7 +13,7 @@ SetCompressor lzma
!define MY_PRODUCT "Coq" ;Define your own software name here
!define COQ_SRC_PATH "..\.."
-!define OUTFILE "coq-installer-${VERSION}-${ARCH}.exe"
+!define OUTFILE "coq-${VERSION}-installer-windows-${ARCH}.exe"
!include "MUI2.nsh"
!include "FileAssociation.nsh"
diff --git a/dev/ocamldebug-coq.run b/dev/ocamldebug-coq.run
index f4799f7b2..3cbccab44 100644
--- a/dev/ocamldebug-coq.run
+++ b/dev/ocamldebug-coq.run
@@ -17,13 +17,12 @@ export CAML_LD_LIBRARY_PATH=$COQTOP/kernel/byterun:$CAML_LD_LIBRARY_PATH
exec $OCAMLDEBUG \
-I $CAMLP4LIB -I +threads \
-I $COQTOP \
- -I $COQTOP/config -I $COQTOP/printing -I $COQTOP/grammar \
+ -I $COQTOP/config -I $COQTOP/printing -I $COQTOP/grammar -I $COQTOP/clib \
-I $COQTOP/lib -I $COQTOP/intf -I $COQTOP/kernel -I $COQTOP/kernel/byterun \
-I $COQTOP/library -I $COQTOP/engine \
-I $COQTOP/pretyping -I $COQTOP/parsing -I $COQTOP/vernac \
-I $COQTOP/interp -I $COQTOP/proofs -I $COQTOP/tactics -I $COQTOP/stm \
-I $COQTOP/toplevel -I $COQTOP/dev -I $COQTOP/config -I $COQTOP/ltac \
- -I $COQTOP/API \
-I $COQTOP/plugins/cc -I $COQTOP/plugins/dp \
-I $COQTOP/plugins/extraction -I $COQTOP/plugins/field \
-I $COQTOP/plugins/firstorder -I $COQTOP/plugins/fourier \
diff --git a/dev/set_raw_db b/dev/set_raw_db
deleted file mode 100644
index 5caff7e5d..000000000
--- a/dev/set_raw_db
+++ /dev/null
@@ -1 +0,0 @@
-install_printer Top_printers.ppconstrdb
diff --git a/dev/tools/backport-pr.sh b/dev/tools/backport-pr.sh
new file mode 100755
index 000000000..d7acf01f1
--- /dev/null
+++ b/dev/tools/backport-pr.sh
@@ -0,0 +1,65 @@
+#!/usr/bin/env bash
+
+# Usage: dev/tools/backport-pr.sh <PR number> [--stop-before-merging]
+
+set -e
+
+PRNUM=$1
+OPTION=$2
+
+if ! git log master --grep "Merge PR #${PRNUM}" | grep "." > /dev/null; then
+ echo "PR #${PRNUM} does not exist."
+ exit 1
+fi
+
+SIGNATURE_STATUS=$(git log master --grep "Merge PR #${PRNUM}" --format="%G?")
+git log master --grep "Merge PR #${PRNUM}" --format="%GG"
+if [[ "${SIGNATURE_STATUS}" != "G" ]]; then
+ echo
+ read -p "Merge commit does not have a good (valid) signature. Bypass? [y/N] " -n 1 -r
+ echo
+ if [[ ! $REPLY =~ ^[Yy]$ ]]; then
+ exit 1
+ fi
+fi
+
+BRANCH=backport-pr-${PRNUM}
+RANGE=$(git log master --grep "Merge PR #${PRNUM}" --format="%P" | sed 's/ /../')
+MESSAGE=$(git log master --grep "Merge PR #${PRNUM}" --format="%s" | sed 's/Merge/Backport/')
+
+if git checkout -b ${BRANCH}; then
+
+ if ! git cherry-pick -x ${RANGE}; then
+ echo "Please fix the conflicts, then exit."
+ bash
+ while ! git cherry-pick --continue; do
+ echo "Please fix the conflicts, then exit."
+ bash
+ done
+ fi
+ git checkout -
+
+else
+
+ echo
+ read -p "Skip directly to merging phase? [y/N] " -n 1 -r
+ echo
+ if [[ ! $REPLY =~ ^[Yy]$ ]]; then
+ exit 1
+ fi
+
+fi
+
+if [[ "${OPTION}" == "--stop-before-merging" ]]; then
+ exit 0
+fi
+
+git merge -S --no-ff ${BRANCH} -m "${MESSAGE}"
+git branch -d ${BRANCH}
+
+# To-Do:
+# - Support for backporting a PR before it is merged
+# - Automatically backport all PRs in the "Waiting to be backported" column using a command like:
+# $ curl -s -H "Authorization: token ${GITHUB_TOKEN}" -H "Accept: application/vnd.github.inertia-preview+json" https://api.github.com/projects/columns/1358120/cards | jq -r '.[].content_url' | grep issue | sed 's/^.*issues\/\([0-9]*\)$/\1/' | tac
+# (The ID of the column must first be obtained through https://api.github.com/repos/coq/coq/projects then https://api.github.com/projects/819866/columns.)
+# - Then move each of the backported PR to the subsequent columns automatically as well...
diff --git a/dev/tools/check-eof-newline.sh b/dev/tools/check-eof-newline.sh
index 1c578c05c..9e4c8661d 100755
--- a/dev/tools/check-eof-newline.sh
+++ b/dev/tools/check-eof-newline.sh
@@ -1,9 +1,14 @@
#!/usr/bin/env bash
-if [ -z "$(tail -c 1 "$1")" ]
-then
- exit 0
-else
- echo "No newline at end of file $1!"
- exit 1
-fi
+CODE=0
+for f in "$@"; do
+ if git ls-files --error-unmatch "$f" >/dev/null 2>&1 && \
+ git check-attr whitespace -- "$f" | grep -q -v -e 'unset$' -e 'unspecified$' && \
+ [ -n "$(tail -c 1 "$f")" ]
+ then
+ echo "No newline at end of file $f!"
+ CODE=1
+ fi
+done
+
+exit "$CODE"
diff --git a/dev/tools/github-check-prs.py b/dev/tools/github-check-prs.py
new file mode 100755
index 000000000..beb26d910
--- /dev/null
+++ b/dev/tools/github-check-prs.py
@@ -0,0 +1,47 @@
+#!/usr/bin/env python3
+
+# Requires PyGithub https://pypi.python.org/pypi/PyGithub, for instance
+# debian package: python3-github
+# nix: nix-shell -p python3 python3Packages.PyGithub --run ./github-check-rebase.py
+from github import Github
+import argparse
+
+REPO = "coq/coq"
+REBASE_LABEL="needs: rebase"
+
+parser = argparse.ArgumentParser()
+parser.add_argument("--token-file", type=argparse.FileType('r'))
+args = parser.parse_args()
+
+if args.token_file is None:
+ token = input("Github access token: ").strip()
+else:
+ token = args.token_file.read().rstrip("\n")
+ args.token_file.close()
+
+if token == "":
+ print ("Warning: using the GitHub API without a token")
+ print ("We may run into rate limit issues")
+ g = Github()
+else:
+ g = Github(token)
+
+repo = g.get_repo(REPO)
+
+for pull in repo.get_pulls():
+ # if conflicts then dirty
+ # otherwise blocked (because I have no rights)
+ dirty = pull.mergeable_state == "dirty"
+ labelled = False
+ for label in repo.get_issue(pull.number).get_labels():
+ if label.name == REBASE_LABEL:
+ labelled = True
+ if labelled and not dirty:
+ print ("PR #" + str(pull.number) + " is not dirty but is labelled")
+ print ("("+ pull.html_url +")")
+ elif dirty and not labelled:
+ print ("PR #" + str(pull.number) + " is dirty and not labelled")
+ print ("("+ pull.html_url +")")
+ else:
+ # give some feedback so the user can see we didn't crash
+ print ("PR #" + str(pull.number) + " OK")
diff --git a/dev/tools/merge-pr.sh b/dev/tools/merge-pr.sh
new file mode 100755
index 000000000..9f24960ff
--- /dev/null
+++ b/dev/tools/merge-pr.sh
@@ -0,0 +1,50 @@
+#!/usr/bin/env bash
+
+set -e
+
+# This script depends (at least) on git and jq.
+# It should be used like this: dev/tools/merge-pr.sh /PR number/
+
+#TODO: check arguments and show usage if relevant
+
+PR=$1
+
+CURRENT_LOCAL_BRANCH=$(git rev-parse --abbrev-ref HEAD)
+REMOTE=$(git config --get "branch.$CURRENT_LOCAL_BRANCH.remote")
+git fetch "$REMOTE" "refs/pull/$PR/head"
+
+API=https://api.github.com/repos/coq/coq
+
+BASE_BRANCH=$(curl -s "$API/pulls/$PR" | jq -r '.base.label')
+
+COMMIT=$(git rev-parse FETCH_HEAD)
+STATUS=$(curl -s "$API/commits/$COMMIT/status" | jq -r '.state')
+
+if [ "$BASE_BRANCH" != "coq:$CURRENT_LOCAL_BRANCH" ]; then
+ echo "Wrong base branch"
+ read -p "Bypass? [y/N] " -n 1 -r
+ echo
+ if [[ ! $REPLY =~ ^[Yy]$ ]]
+ then
+ exit 1
+ fi
+fi;
+
+if [ "$STATUS" != "success" ]; then
+ echo "CI status is \"$STATUS\""
+ read -p "Bypass? [y/N] " -n 1 -r
+ echo
+ if [[ ! $REPLY =~ ^[Yy]$ ]]
+ then
+ exit 1
+ fi
+fi;
+
+git merge -S --no-ff FETCH_HEAD -m "Merge PR #$PR: $(curl -s "$API/pulls/$PR" | jq -r '.title')" -e
+
+# TODO: improve this check
+if ! git diff --quiet "$REMOTE/$CURRENT_LOCAL_BRANCH" -- dev/ci; then
+ echo "******************************************"
+ echo "** WARNING: does this PR have overlays? **"
+ echo "******************************************"
+fi
diff --git a/dev/tools/should-check-whitespace.sh b/dev/tools/should-check-whitespace.sh
deleted file mode 100755
index 8159506b4..000000000
--- a/dev/tools/should-check-whitespace.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/usr/bin/env bash
-
-# determine if a file has whitespace checking enabled in .gitattributes
-
-git check-attr whitespace -- "$1" | grep -q -v 'unspecified$'
diff --git a/dev/tools/sudo-apt-get-update.sh b/dev/tools/sudo-apt-get-update.sh
new file mode 100755
index 000000000..f8bf6bed4
--- /dev/null
+++ b/dev/tools/sudo-apt-get-update.sh
@@ -0,0 +1,4 @@
+#!/usr/bin/env bash
+
+(sudo apt-get update "$@" 2>&1 || echo 'E: update failed') | tee /tmp/apt.err
+! grep -q '^\(E:\|W: Failed to fetch\)' /tmp/apt.err || exit $?
diff --git a/dev/top_printers.ml b/dev/top_printers.ml
index 35956477d..af38ce4b8 100644
--- a/dev/top_printers.ml
+++ b/dev/top_printers.ml
@@ -8,17 +8,16 @@
(* Printers for the ocaml toplevel. *)
+open Sorts
open Util
open Pp
open Names
open Libnames
open Globnames
-open Nameops
open Univ
open Environ
open Printer
-open Term
-open Evd
+open Constr
open Goptions
open Genarg
open Clenv
@@ -37,41 +36,40 @@ let ppfuture kx = pp (Future.print (fun _ -> str "_") kx)
(* name printers *)
let ppid id = pp (Id.print id)
-let pplab l = pp (pr_lab l)
+let pplab l = pp (Label.print l)
let ppmbid mbid = pp (str (MBId.debug_to_string mbid))
-let ppdir dir = pp (pr_dirpath dir)
+let ppdir dir = pp (DirPath.print dir)
let ppmp mp = pp(str (ModPath.debug_to_string mp))
-let ppcon con = pp(debug_pr_con con)
-let ppproj con = pp(debug_pr_con (Projection.constant con))
+let ppcon con = pp(Constant.debug_print con)
+let ppproj con = pp(Constant.debug_print (Projection.constant con))
let ppkn kn = pp(str (KerName.to_string kn))
-let ppmind kn = pp(debug_pr_mind kn)
-let ppind (kn,i) = pp(debug_pr_mind kn ++ str"," ++int i)
+let ppmind kn = pp(MutInd.debug_print kn)
+let ppind (kn,i) = pp(MutInd.debug_print kn ++ str"," ++int i)
let ppsp sp = pp(pr_path sp)
let ppqualid qid = pp(pr_qualid qid)
let ppclindex cl = pp(Classops.pr_cl_index cl)
let ppscheme k = pp (Ind_tables.pr_scheme_kind k)
-let pprecarg = function
+let prrecarg = function
| Declarations.Norec -> str "Norec"
| Declarations.Mrec (mind,i) ->
str "Mrec[" ++ MutInd.print mind ++ pr_comma () ++ int i ++ str "]"
| Declarations.Imbr (mind,i) ->
str "Imbr[" ++ MutInd.print mind ++ pr_comma () ++ int i ++ str "]"
-let ppwf_paths x = pp (Rtree.pp_tree pprecarg x)
+let ppwf_paths x = pp (Rtree.pp_tree prrecarg x)
(* term printers *)
+let envpp pp = let sigma,env = Pfedit.get_current_context () in pp env sigma
let rawdebug = ref false
-let ppevar evk = pp (str (Evd.string_of_existential evk))
+let ppevar evk = pp (Evar.print evk)
let ppconstr x = pp (Termops.print_constr (EConstr.of_constr x))
let ppeconstr x = pp (Termops.print_constr x)
let ppconstr_expr x = pp (Ppconstr.pr_constr_expr x)
-let ppconstrdb x = pp(Flags.with_option rawdebug Termops.print_constr (EConstr.of_constr x))
-let ppterm = ppconstr
let ppsconstr x = ppconstr (Mod_subst.force_constr x)
let ppconstr_univ x = Constrextern.with_universes ppconstr x
-let ppglob_constr = (fun x -> pp(pr_lglob_constr x))
-let pppattern = (fun x -> pp(pr_constr_pattern x))
-let pptype = (fun x -> try pp(pr_ltype x) with e -> pp (str (Printexc.to_string e)))
+let ppglob_constr = (fun x -> pp(pr_lglob_constr_env (Global.env()) x))
+let pppattern = (fun x -> pp(envpp pr_constr_pattern_env x))
+let pptype = (fun x -> try pp(envpp pr_ltype_env x) with e -> pp (str (Printexc.to_string e)))
let ppfconstr c = ppconstr (CClosure.term_of_fconstr c)
let ppbigint n = pp (str (Bigint.to_string n));;
@@ -85,9 +83,14 @@ let prset' pr l = str "[" ++ hov 0 (prlist_with_sep pr_comma pr l) ++ str "]"
let pridmap pr l =
let pr (id,b) = Id.print id ++ str "=>" ++ pr id b in
prset' pr (Id.Map.fold (fun a b l -> (a,b)::l) l [])
-
let ppidmap pr l = pp (pridmap pr l)
+let pridmapgen l =
+ let dom = Id.Set.elements (Id.Map.domain l) in
+ if dom = [] then str "[]" else
+ str "[domain= " ++ hov 0 (prlist_with_sep spc Id.print dom) ++ str "]"
+let ppidmapgen l = pp (pridmapgen l)
+
let ppevarsubst = ppidmap (fun id0 -> prset (fun (c,copt,id) ->
hov 0
(Termops.print_constr (EConstr.of_constr c) ++
@@ -106,7 +109,7 @@ let prconstrunderbindersidmap = pridmap (fun _ (l,c) ->
let ppconstrunderbindersidmap l = pp (prconstrunderbindersidmap l)
let ppunbound_ltac_var_map l = ppidmap (fun _ arg ->
- str"<genarg:" ++ pr_argument_type(genarg_tag arg) ++ str">")
+ str"<genarg:" ++ pr_argument_type(genarg_tag arg) ++ str">") l
open Ltac_pretype
let rec pr_closure {idents=idents;typed=typed;untyped=untyped} =
@@ -116,7 +119,7 @@ let rec pr_closure {idents=idents;typed=typed;untyped=untyped} =
and pr_closed_glob_constr_idmap x =
pridmap (fun _ -> pr_closed_glob_constr) x
and pr_closed_glob_constr {closure=closure;term=term} =
- pr_closure closure ++ pr_lglob_constr term
+ pr_closure closure ++ (pr_lglob_constr_env Global.(env ())) term
let ppclosure x = pp (pr_closure x)
let ppclosedglobconstr x = pp (pr_closed_glob_constr x)
@@ -125,27 +128,27 @@ let ppclosedglobconstridmap x = pp (pr_closed_glob_constr_idmap x)
let pP s = pp (hov 0 s)
let safe_pr_global = function
- | ConstRef kn -> pp (str "CONSTREF(" ++ debug_pr_con kn ++ str ")")
- | IndRef (kn,i) -> pp (str "INDREF(" ++ debug_pr_mind kn ++ str "," ++
+ | ConstRef kn -> pp (str "CONSTREF(" ++ Constant.debug_print kn ++ str ")")
+ | IndRef (kn,i) -> pp (str "INDREF(" ++ MutInd.debug_print kn ++ str "," ++
int i ++ str ")")
- | ConstructRef ((kn,i),j) -> pp (str "INDREF(" ++ debug_pr_mind kn ++ str "," ++
+ | ConstructRef ((kn,i),j) -> pp (str "INDREF(" ++ MutInd.debug_print kn ++ str "," ++
int i ++ str "," ++ int j ++ str ")")
| VarRef id -> pp (str "VARREF(" ++ Id.print id ++ str ")")
let ppglobal x = try pp(pr_global x) with _ -> safe_pr_global x
let ppconst (sp,j) =
- pp (str"#" ++ KerName.print sp ++ str"=" ++ pr_lconstr j.uj_val)
+ pp (str"#" ++ KerName.print sp ++ str"=" ++ envpp pr_lconstr_env j.uj_val)
let ppvar ((id,a)) =
- pp (str"#" ++ Id.print id ++ str":" ++ pr_lconstr a)
+ pp (str"#" ++ Id.print id ++ str":" ++ envpp pr_lconstr_env a)
let genppj f j = let (c,t) = f j in (c ++ str " : " ++ t)
-let ppj j = pp (genppj pr_ljudge j)
+let ppj j = pp (genppj (envpp pr_ljudge_env) j)
-let prsubst s = pp (Mod_subst.debug_pr_subst s)
-let prdelta s = pp (Mod_subst.debug_pr_delta s)
+let ppsubst s = pp (Mod_subst.debug_pr_subst s)
+let ppdelta s = pp (Mod_subst.debug_pr_delta s)
let pp_idpred s = pp (pr_idpred s)
let pp_cpred s = pp (pr_cpred s)
@@ -170,13 +173,13 @@ let ppclenv clenv = pp(pr_clenv clenv)
let ppgoalgoal gl = pp(Goal.pr_goal gl)
let ppgoal g = pp(Printer.pr_goal g)
let ppgoalsigma g = pp(Printer.pr_goal g ++ Termops.pr_evar_map None (Refiner.project g))
-let pphintdb db = pp(Hints.pr_hint_db db)
+let pphintdb db = pp(envpp Hints.pr_hint_db_env db)
let ppproofview p =
let gls,sigma = Proofview.proofview p in
pp(pr_enum Goal.pr_goal gls ++ fnl () ++ Termops.pr_evar_map (Some 1) sigma)
let ppopenconstr (x : Evd.open_constr) =
- let (evd,c) = x in pp (Termops.pr_evar_map (Some 2) evd ++ pr_constr c)
+ let (evd,c) = x in pp (Termops.pr_evar_map (Some 2) evd ++ envpp pr_constr_env c)
(* spiwack: deactivated until a replacement is found
let pppftreestate p = pp(print_pftreestate p)
*)
@@ -195,9 +198,8 @@ let pppftreestate p = pp(print_pftreestate p)
let pproof p = pp(Proof.pr_proof p)
-let ppuni u = pp(pr_uni u)
+let ppuni u = pp(Universe.pr u)
let ppuni_level u = pp (Level.pr u)
-let ppuniverse u = pp (str"[" ++ Universe.pr u ++ str"]")
let prlev = Universes.pr_with_global_universes
let ppuniverse_set l = pp (LSet.pr prlev l)
@@ -226,9 +228,9 @@ let ppenv e = pp
let ppenvwithcst e = pp
(str "[" ++ pr_named_context_of e Evd.empty ++ str "]" ++ spc() ++
str "[" ++ pr_rel_context e Evd.empty (rel_context e) ++ str "]" ++ spc() ++
- str "{" ++ Cmap_env.fold (fun a _ s -> pr_con a ++ spc () ++ s) (Obj.magic e).Pre_env.env_globals.Pre_env.env_constants (mt ()) ++ str "}")
+ str "{" ++ Cmap_env.fold (fun a _ s -> Constant.print a ++ spc () ++ s) (Obj.magic e).Pre_env.env_globals.Pre_env.env_constants (mt ()) ++ str "}")
-let pptac = (fun x -> pp(Ltac_plugin.Pptactic.pr_glob_tactic (API.Global.env()) x))
+let pptac = (fun x -> pp(Ltac_plugin.Pptactic.pr_glob_tactic (Global.env()) x))
let ppobj obj = Format.print_string (Libobject.object_tag obj)
@@ -242,7 +244,7 @@ let cast_kind_display k =
| NATIVEcast -> "NATIVEcast"
let constr_display csr =
- let rec term_display c = match kind_of_term c with
+ let rec term_display c = match kind c with
| Rel n -> "Rel("^(string_of_int n)^")"
| Meta n -> "Meta("^(string_of_int n)^")"
| Var id -> "Var("^(Id.to_string id)^")"
@@ -257,14 +259,14 @@ let constr_display csr =
"LetIn("^(name_display na)^","^(term_display b)^","
^(term_display t)^","^(term_display c)^")"
| App (c,l) -> "App("^(term_display c)^","^(array_display l)^")\n"
- | Evar (e,l) -> "Evar("^(string_of_existential e)^","^(array_display l)^")"
- | Const (c,u) -> "Const("^(string_of_con c)^","^(universes_display u)^")"
+ | Evar (e,l) -> "Evar("^(Pp.string_of_ppcmds (Evar.print e))^","^(array_display l)^")"
+ | Const (c,u) -> "Const("^(Constant.to_string c)^","^(universes_display u)^")"
| Ind ((sp,i),u) ->
- "MutInd("^(string_of_mind sp)^","^(string_of_int i)^","^(universes_display u)^")"
+ "MutInd("^(MutInd.to_string sp)^","^(string_of_int i)^","^(universes_display u)^")"
| Construct (((sp,i),j),u) ->
- "MutConstruct(("^(string_of_mind sp)^","^(string_of_int i)^"),"
+ "MutConstruct(("^(MutInd.to_string sp)^","^(string_of_int i)^"),"
^","^(universes_display u)^(string_of_int j)^")"
- | Proj (p, c) -> "Proj("^(string_of_con (Projection.constant p))^","^term_display c ^")"
+ | Proj (p, c) -> "Proj("^(Constant.to_string (Projection.constant p))^","^term_display c ^")"
| Case (ci,p,c,bl) ->
"MutCase(<abs>,"^(term_display p)^","^(term_display c)^","
^(array_display bl)^")"
@@ -314,7 +316,7 @@ let constr_display csr =
open Format;;
let print_pure_constr csr =
- let rec term_display c = match kind_of_term c with
+ let rec term_display c = match Constr.kind c with
| Rel n -> print_string "#"; print_int n
| Meta n -> print_string "Meta("; print_int n; print_string ")"
| Var id -> print_string (Id.to_string id)
@@ -432,7 +434,7 @@ let print_pure_constr csr =
| ("Coq"::_::l) -> l
| l -> l
in List.iter (fun x -> print_string x; print_string ".") ls;*)
- print_string (debug_string_of_mind sp)
+ print_string (MutInd.debug_to_string sp)
and sp_con_display sp =
(* let dir,l = decode_kn sp in
let ls =
@@ -441,7 +443,7 @@ let print_pure_constr csr =
| ("Coq"::_::l) -> l
| l -> l
in List.iter (fun x -> print_string x; print_string ".") ls;*)
- print_string (debug_string_of_con sp)
+ print_string (Constant.debug_to_string sp)
in
try
@@ -503,7 +505,7 @@ let _ =
(function
[c] when genarg_tag c = unquote (topwit wit_constr) && true ->
let c = out_gen (rawwit wit_constr) c in
- (fun _ -> in_current_context constr_display c)
+ (fun ~atts ~st -> in_current_context constr_display c; st)
| _ -> failwith "Vernac extension: cannot occur")
with
e -> pp (CErrors.print e)
@@ -519,7 +521,7 @@ let _ =
(function
[c] when genarg_tag c = unquote (topwit wit_constr) && true ->
let c = out_gen (rawwit wit_constr) c in
- (fun _ -> in_current_context print_pure_constr c)
+ (fun ~atts ~st -> in_current_context print_pure_constr c; st)
| _ -> failwith "Vernac extension: cannot occur")
with
e -> pp (CErrors.print e)
diff --git a/dev/top_printers.mli b/dev/top_printers.mli
new file mode 100644
index 000000000..7b5e4a0b6
--- /dev/null
+++ b/dev/top_printers.mli
@@ -0,0 +1,173 @@
+(************************************************************************)
+(* v * The Coq Proof Assistant / The Coq Development Team *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(************************************************************************)
+
+(** Printers for the ocaml toplevel. *)
+
+val pp : Pp.t -> unit
+val pP : Pp.t -> unit (* with surrounding box *)
+
+val ppfuture : 'a Future.computation -> unit
+
+val ppid : Names.Id.t -> unit
+val pplab : Names.Label.t -> unit
+val ppmbid : Names.MBId.t -> unit
+val ppdir : Names.DirPath.t -> unit
+val ppmp : Names.ModPath.t -> unit
+val ppcon : Names.Constant.t -> unit
+val ppproj : Names.Projection.t -> unit
+val ppkn : Names.KerName.t -> unit
+val ppmind : Names.MutInd.t -> unit
+val ppind : Names.inductive -> unit
+
+val ppsp : Libnames.full_path -> unit
+val ppqualid : Libnames.qualid -> unit
+
+val ppclindex : Classops.cl_index -> unit
+
+val ppscheme : 'a Ind_tables.scheme_kind -> unit
+
+val prrecarg : Declarations.recarg -> Pp.t
+val ppwf_paths : Declarations.recarg Rtree.t -> unit
+
+val pr_evar : Evar.t -> Pp.t
+val ppevar : Evar.t -> unit
+
+(* Multiple printers for Constr.t *)
+val ppconstr : Constr.t -> unit (* by Termops printer *)
+val ppconstr_univ : Constr.t -> unit
+
+(* Extern as type *)
+val pptype : Constr.types -> unit
+
+val ppsconstr : Constr.constr Mod_subst.substituted -> unit
+val ppeconstr : EConstr.constr -> unit (* Termops printer *)
+val ppconstr_expr : Constrexpr.constr_expr -> unit
+val ppglob_constr : 'a Glob_term.glob_constr_g -> unit
+val pppattern : Pattern.constr_pattern -> unit
+val ppfconstr : CClosure.fconstr -> unit
+
+val ppbigint : Bigint.bigint -> unit
+
+val ppintset : Int.Set.t -> unit
+val ppidset : Names.Id.Set.t -> unit
+
+val pridmap : (Names.Id.Map.key -> 'a -> Pp.t) -> 'a Names.Id.Map.t -> Pp.t
+val ppidmap : (Names.Id.Map.key -> 'a -> Pp.t) -> 'a Names.Id.Map.t -> unit
+
+val pridmapgen : 'a Names.Id.Map.t -> Pp.t
+val ppidmapgen : 'a Names.Id.Map.t -> unit
+
+val prididmap : Names.Id.t Names.Id.Map.t -> Pp.t
+val ppididmap : Names.Id.t Names.Id.Map.t -> unit
+
+val prconstrunderbindersidmap :
+ (Names.Id.t list * EConstr.constr) Names.Id.Map.t -> Pp.t
+val ppconstrunderbindersidmap :
+ (Names.Id.t list * EConstr.constr) Names.Id.Map.t -> unit
+
+val ppevarsubst :
+ (Constr.t * Constr.t option * Names.Id.Map.key) list Names.Id.Map.t -> unit
+
+val ppunbound_ltac_var_map :
+ 'a Genarg.generic_argument Names.Id.Map.t -> unit
+
+val pr_closure : Ltac_pretype.closure -> Pp.t
+val pr_closed_glob_constr_idmap :
+ Ltac_pretype.closed_glob_constr Names.Id.Map.t -> Pp.t
+val pr_closed_glob_constr : Ltac_pretype.closed_glob_constr -> Pp.t
+val ppclosure : Ltac_pretype.closure -> unit
+val ppclosedglobconstr : Ltac_pretype.closed_glob_constr -> unit
+val ppclosedglobconstridmap :
+ Ltac_pretype.closed_glob_constr Names.Id.Map.t -> unit
+
+val ppglobal : Globnames.global_reference -> unit
+
+val ppconst :
+ Names.KerName.t * (Constr.constr, 'a) Environ.punsafe_judgment -> unit
+val ppvar : Names.Id.t * Constr.constr -> unit
+
+val genppj : ('a -> Pp.t * Pp.t) -> 'a -> Pp.t
+val ppj : EConstr.unsafe_judgment -> unit
+
+val ppsubst : Mod_subst.substitution -> unit
+val ppdelta : Mod_subst.delta_resolver -> unit
+
+val pp_idpred : Names.Id.Pred.t -> unit
+val pp_cpred : Names.Cpred.t -> unit
+val pp_transparent_state : Names.transparent_state -> unit
+
+val pp_stack_t : Constr.t Reductionops.Stack.t -> unit
+val pp_cst_stack_t : Reductionops.Cst_stack.t -> unit
+val pp_state_t : Reductionops.state -> unit
+
+val ppmetas : Evd.Metaset.t -> unit
+val ppevm : Evd.evar_map -> unit
+val ppevmall : Evd.evar_map -> unit
+
+val pr_existentialset : Evar.Set.t -> Pp.t
+val ppexistentialset : Evar.Set.t -> unit
+
+val ppexistentialfilter : Evd.Filter.t -> unit
+
+val ppclenv : Clenv.clausenv -> unit
+
+val ppgoalgoal : Goal.goal -> unit
+
+val ppgoal : Proof_type.goal Evd.sigma -> unit
+(* also print evar map *)
+val ppgoalsigma : Proof_type.goal Evd.sigma -> unit
+
+val pphintdb : Hints.Hint_db.t -> unit
+val ppproofview : Proofview.proofview -> unit
+val ppopenconstr : Evd.open_constr -> unit
+
+val pproof : Proof.t -> unit
+
+(* Universes *)
+val ppuni : Univ.Universe.t -> unit
+val ppuni_level : Univ.Level.t -> unit (* raw *)
+val prlev : Univ.Level.t -> Pp.t (* with global names (does this work?) *)
+val ppuniverse_set : Univ.LSet.t -> unit
+val ppuniverse_instance : Univ.Instance.t -> unit
+val ppuniverse_context : Univ.UContext.t -> unit
+val ppuniverse_context_set : Univ.ContextSet.t -> unit
+val ppuniverse_subst : Univ.universe_subst -> unit
+val ppuniverse_opt_subst : Universes.universe_opt_subst -> unit
+val ppuniverse_level_subst : Univ.universe_level_subst -> unit
+val ppevar_universe_context : UState.t -> unit
+val ppconstraints : Univ.Constraint.t -> unit
+val ppuniverseconstraints : Universes.Constraints.t -> unit
+val ppuniverse_context_future : Univ.UContext.t Future.computation -> unit
+val ppcumulativity_info : Univ.CumulativityInfo.t -> unit
+val ppabstract_cumulativity_info : Univ.ACumulativityInfo.t -> unit
+val ppuniverses : UGraph.t -> unit
+
+val ppnamedcontextval : Environ.named_context_val -> unit
+val ppenv : Environ.env -> unit
+val ppenvwithcst : Environ.env -> unit
+
+val pptac : Tacexpr.glob_tactic_expr -> unit
+
+val ppobj : Libobject.obj -> unit
+
+(* Some super raw printers *)
+val cast_kind_display : Constr.cast_kind -> string
+val constr_display : Constr.constr -> unit
+val print_pure_constr : Constr.types -> unit
+
+val pploc : Loc.t -> unit
+
+val pp_argument_type : Genarg.argument_type -> unit
+val pp_generic_argument : 'a Genarg.generic_argument -> unit
+
+val prgenarginfo : Geninterp.Val.t -> Pp.t
+val ppgenarginfo : Geninterp.Val.t -> unit
+
+val ppgenargargt : ('a, 'b, 'c) Genarg.ArgT.tag -> unit
+
+val ppist : Geninterp.interp_sign -> unit
diff --git a/dev/vm_printers.ml b/dev/vm_printers.ml
index afa94a63e..f819d2e6a 100644
--- a/dev/vm_printers.ml
+++ b/dev/vm_printers.ml
@@ -3,18 +3,18 @@ open Term
open Names
open Cbytecodes
open Cemitcodes
-open Vm
+open Vmvalues
let ppripos (ri,pos) =
(match ri with
| Reloc_annot a ->
let sp,i = a.ci.ci_ind in
print_string
- ("annot : MutInd("^(string_of_mind sp)^","^(string_of_int i)^")\n")
+ ("annot : MutInd("^(MutInd.to_string sp)^","^(string_of_int i)^")\n")
| Reloc_const _ ->
print_string "structured constant\n"
| Reloc_getglobal kn ->
- print_string ("getglob "^(string_of_con kn)^"\n"));
+ print_string ("getglob "^(Constant.to_string kn)^"\n"));
print_flush ()
let print_vfix () = print_string "vfix"
@@ -32,7 +32,7 @@ let print_idkey idk =
match idk with
| ConstKey sp ->
print_string "Cons(";
- print_string (string_of_con sp);
+ print_string (Constant.to_string sp);
print_string ")"
| VarKey id -> print_string (Id.to_string id)
| RelKey i -> print_string "~";print_int i
@@ -63,7 +63,7 @@ and ppatom a =
| Aid idk -> print_idkey idk
| Atype u -> print_string "Type(...)"
| Aind(sp,i) -> print_string "Ind(";
- print_string (string_of_mind sp);
+ print_string (MutInd.to_string sp);
print_string ","; print_int i;
print_string ")"
diff --git a/doc/common/macros.tex b/doc/common/macros.tex
index 0a4251a37..81def1674 100644
--- a/doc/common/macros.tex
+++ b/doc/common/macros.tex
@@ -94,8 +94,8 @@
\newcommand{\gallina}{\textsc{Gallina}}
\newcommand{\Gallina}{\textsc{Gallina}}
\newcommand{\CoqIDE}{\textsc{CoqIDE}}
-\newcommand{\ocaml}{\textsc{Objective Caml}}
-\newcommand{\camlpppp}{\textsc{Camlp4}}
+\newcommand{\ocaml}{\textsc{OCaml}}
+\newcommand{\camlpppp}{\textsc{Camlp5}}
\newcommand{\emacs}{\textsc{GNU Emacs}}
\newcommand{\ProofGeneral}{\textsc{Proof General}}
\newcommand{\CIC}{\textsc{Cic}}
diff --git a/doc/faq/FAQ.tex b/doc/faq/FAQ.tex
deleted file mode 100644
index 541d39501..000000000
--- a/doc/faq/FAQ.tex
+++ /dev/null
@@ -1,2713 +0,0 @@
-\RequirePackage{ifpdf}
-\ifpdf % si on est en pdflatex
-\documentclass[a4paper,pdftex]{article}
-\else
-\documentclass[a4paper]{article}
-\fi
-\pagestyle{plain}
-
-% yay les symboles
-\usepackage{textcomp}
-\usepackage{stmaryrd}
-\usepackage{amssymb}
-\usepackage{url}
-%\usepackage{multicol}
-\usepackage{hevea}
-\usepackage{fullpage}
-\usepackage[utf8]{inputenc}
-\usepackage[english]{babel}
-
-\ifpdf % si on est en pdflatex
- \usepackage[pdftex]{graphicx}
-\else
- \usepackage[dvips]{graphicx}
-\fi
-
-%\input{../macros.tex}
-
-% Making hevea happy
-%HEVEA \renewcommand{\textbar}{|}
-%HEVEA \renewcommand{\textunderscore}{\_}
-
-\def\Question#1{\stepcounter{question}\subsubsection{#1}}
-
-% version et date
-\def\faqversion{0.1}
-
-% les macros d'amour
-\def\Coq{\textsc{Coq}}
-\def\Why{\textsc{Why}}
-\def\Framac{\textsc{Frama-c}}
-\def\Krakatoa{\textsc{Krakatoa}}
-\def\Ltac{\textsc{Ltac}}
-\def\CoqIde{\textsc{CoqIde}}
-
-\newcommand{\coqtt}[1]{{\tt #1}}
-\newcommand{\coqimp}{{\mbox{\tt ->}}}
-\newcommand{\coqequiv}{{\mbox{\tt <->}}}
-
-
-% macro pour les tactics
-\def\split{{\tt split}}
-\def\assumption{{\tt assumption}}
-\def\auto{{\tt auto}}
-\def\trivial{{\tt trivial}}
-\def\tauto{{\tt tauto}}
-\def\left{{\tt left}}
-\def\right{{\tt right}}
-\def\decompose{{\tt decompose}}
-\def\intro{{\tt intro}}
-\def\intros{{\tt intros}}
-\def\field{{\tt field}}
-\def\ring{{\tt ring}}
-\def\apply{{\tt apply}}
-\def\exact{{\tt exact}}
-\def\cut{{\tt cut}}
-\def\assert{{\tt assert}}
-\def\solve{{\tt solve}}
-\def\idtac{{\tt idtac}}
-\def\fail{{\tt fail}}
-\def\existstac{{\tt exists}}
-\def\firstorder{{\tt firstorder}}
-\def\congruence{{\tt congruence}}
-\def\gb{{\tt gb}}
-\def\generalize{{\tt generalize}}
-\def\abstracttac{{\tt abstract}}
-\def\eapply{{\tt eapply}}
-\def\unfold{{\tt unfold}}
-\def\rewrite{{\tt rewrite}}
-\def\replace{{\tt replace}}
-\def\simpl{{\tt simpl}}
-\def\elim{{\tt elim}}
-\def\set{{\tt set}}
-\def\pose{{\tt pose}}
-\def\case{{\tt case}}
-\def\destruct{{\tt destruct}}
-\def\reflexivity{{\tt reflexivity}}
-\def\transitivity{{\tt transitivity}}
-\def\symmetry{{\tt symmetry}}
-\def\Focus{{\tt Focus}}
-\def\discriminate{{\tt discriminate}}
-\def\contradiction{{\tt contradiction}}
-\def\intuition{{\tt intuition}}
-\def\try{{\tt try}}
-\def\repeat{{\tt repeat}}
-\def\eauto{{\tt eauto}}
-\def\subst{{\tt subst}}
-\def\symmetryin{{\tt symmetryin}}
-\def\instantiate{{\tt instantiate}}
-\def\inversion{{\tt inversion}}
-\def\specialize{{\tt specialize}}
-\def\Defined{{\tt Defined}}
-\def\Qed{{\tt Qed}}
-\def\pattern{{\tt pattern}}
-\def\Type{{\tt Type}}
-\def\Prop{{\tt Prop}}
-\def\Set{{\tt Set}}
-
-
-\newcommand\vfile[2]{\ahref{#1}{\tt {#2}.v}}
-\urldef{\InitWf}\url
- {http://coq.inria.fr/library/Coq.Init.Wf.html}
-\urldef{\LogicBerardi}\url
- {http://coq.inria.fr/library/Coq.Logic.Berardi.html}
-\urldef{\LogicClassical}\url
- {http://coq.inria.fr/library/Coq.Logic.Classical.html}
-\urldef{\LogicClassicalFacts}\url
- {http://coq.inria.fr/library/Coq.Logic.ClassicalFacts.html}
-\urldef{\LogicClassicalDescription}\url
- {http://coq.inria.fr/library/Coq.Logic.ClassicalDescription.html}
-\urldef{\LogicProofIrrelevance}\url
- {http://coq.inria.fr/library/Coq.Logic.ProofIrrelevance.html}
-\urldef{\LogicEqdep}\url
- {http://coq.inria.fr/library/Coq.Logic.Eqdep.html}
-\urldef{\LogicEqdepDec}\url
- {http://coq.inria.fr/library/Coq.Logic.Eqdep_dec.html}
-
-
-
-
-\begin{document}
-\bibliographystyle{plain}
-\newcounter{question}
-\renewcommand{\thesubsubsection}{\arabic{question}}
-
-%%%%%%% Coq pour les nuls %%%%%%%
-
-\title{Coq Version 8.4 for the Clueless\\
- \large(\protect\ref{lastquestion}
- \ Hints)
-}
-\author{Pierre Castéran \and Hugo Herbelin \and Florent Kirchner \and Benjamin Monate \and Julien Narboux}
-\maketitle
-
-%%%%%%%
-
-\begin{abstract}
-This note intends to provide an easy way to get acquainted with the
-{\Coq} theorem prover. It tries to formulate appropriate answers
-to some of the questions any newcomers will face, and to give
-pointers to other references when possible.
-\end{abstract}
-
-%%%%%%%
-
-%\begin{multicols}{2}
-\tableofcontents
-%\end{multicols}
-
-%%%%%%%
-
-\newpage
-
-\section{Introduction}
-This FAQ is the sum of the questions that came to mind as we developed
-proofs in \Coq. Since we are singularly short-minded, we wrote the
-answers we found on bits of papers to have them at hand whenever the
-situation occurs again. This is pretty much the result of that: a
-collection of tips one can refer to when proofs become intricate. Yes,
-it means we won't take the blame for the shortcomings of this
-FAQ. But if you want to contribute and send in your own question and
-answers, feel free to write to us\ldots
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-\section{Presentation}
-
-\Question{What is {\Coq}?}\label{whatiscoq}
-The {\Coq} tool is a formal proof management system: a proof done with {\Coq} is mechanically checked by the machine.
-In particular, {\Coq} allows:
-\begin{itemize}
- \item the definition of mathematical objects and programming objects,
- \item to state mathematical theorems and software specifications,
- \item to interactively develop formal proofs of these theorems,
- \item to check these proofs by a small certification ``kernel''.
-\end{itemize}
-{\Coq} is based on a logical framework called ``Calculus of Inductive
-Constructions'' extended by a modular development system for theories.
-
-\Question{Did you really need to name it like that?}
-Some French computer scientists have a tradition of naming their
-software as animal species: Caml, Elan, Foc or Phox are examples
-of this tacit convention. In French, ``coq'' means rooster, and it
-sounds like the initials of the Calculus of Constructions CoC on which
-it is based.
-
-\Question{Is {\Coq} a theorem prover?}
-
-{\Coq} comes with decision and semi-decision procedures (
-propositional calculus, Presburger's arithmetic, ring and field
-simplification, resolution, ...) but the main style for proving
-theorems is interactively by using LCF-style tactics.
-
-
-\Question{What are the other theorem provers?}
-Many other theorem provers are available for use nowadays.
-Isabelle, HOL, HOL Light, Lego, Nuprl, PVS are examples of provers that are fairly similar
-to {\Coq} by the way they interact with the user. Other relatives of
-{\Coq} are ACL2, Agda/Alfa, Twelf, Kiv, Mizar, NqThm,
-\begin{htmlonly}%
-Omega\ldots
-\end{htmlonly}
-\begin{latexonly}%
-{$\Omega$}mega\ldots
-\end{latexonly}
-
-\Question{What do I have to trust when I see a proof checked by Coq?}
-
-You have to trust:
-
-\begin{description}
-\item[The theory behind Coq] The theory of {\Coq} version 8.0 is
-generally admitted to be consistent wrt Zermelo-Fraenkel set theory +
-inaccessible cardinals. Proofs of consistency of subsystems of the
-theory of Coq can be found in the literature.
-\item[The Coq kernel implementation] You have to trust that the
-implementation of the {\Coq} kernel mirrors the theory behind {\Coq}. The
-kernel is intentionally small to limit the risk of conceptual or
-accidental implementation bugs.
-\item[The Objective Caml compiler] The {\Coq} kernel is written using the
-Objective Caml language but it uses only the most standard features
-(no object, no label ...), so that it is highly improbable that an
-Objective Caml bug breaks the consistency of {\Coq} without breaking all
-other kinds of features of {\Coq} or of other software compiled with
-Objective Caml.
-\item[Your hardware] In theory, if your hardware does not work
-properly, it can accidentally be the case that False becomes
-provable. But it is more likely the case that the whole {\Coq} system
-will be unusable. You can check your proof using different computers
-if you feel the need to.
-\item[Your axioms] Your axioms must be consistent with the theory
-behind {\Coq}.
-\end{description}
-
-
-\Question{Where can I find information about the theory behind {\Coq}?}
-\begin{description}
-\item[The Calculus of Inductive Constructions] The
-\ahref{http://coq.inria.fr/doc/Reference-Manual006.html}{corresponding}
-chapter and the chapter on
-\ahref{http://coq.inria.fr/doc/Reference-Manual007.html}{modules} in
-the {\Coq} Reference Manual.
-\item[Type theory] A book~\cite{ProofsTypes} or some lecture
-notes~\cite{Types:Dowek}.
-\item[Inductive types]
-Christine Paulin-Mohring's habilitation thesis~\cite{Pau96b}.
-\item[Co-Inductive types]
-Eduardo Giménez' thesis~\cite{EGThese}.
-\item[Miscellaneous] A
-\ahref{http://coq.inria.fr/doc/biblio.html}{bibliography} about Coq
-\end{description}
-
-
-\Question{How can I use {\Coq} to prove programs?}
-
-You can either extract a program from a proof by using the extraction
-mechanism or use dedicated tools, such as
-\ahref{http://why3.lri.fr}{\Why},
-\ahref{http://krakatoa.lri.fr}{\Krakatoa},
-\ahref{http://frama-c.com}{\Framac}, to prove
-annotated programs written in other languages.
-
-%\Question{How many {\Coq} users are there?}
-%
-%An estimation is about 100 regular users.
-
-\Question{How old is {\Coq}?}
-
-The first implementation is from 1985 (it was named {\sf CoC} which is
-the acronym of the name of the logic it implemented: the Calculus of
-Constructions). The first official release of {\Coq} (version 4.10)
-was distributed in 1989.
-
-\Question{What are the \Coq-related tools?}
-
-There are graphical user interfaces:
-\begin{description}
-\item[Coqide] A GTK based GUI for \Coq.
-\item[Pcoq] A GUI for {\Coq} with proof by pointing and pretty printing.
-\item[coqwc] A tool similar to {\tt wc} to count lines in {\Coq} files.
-\item[Proof General] A emacs mode for {\Coq} and many other proof assistants.
-\item[ProofWeb] The ProofWeb online web interface for {\Coq} (and other proof assistants), with a focus on teaching.
-\item[ProverEditor] is an experimental Eclipse plugin with support for {\Coq}.
-\end{description}
-
-There are documentation and browsing tools:
-
-\begin{description}
-\item[coq-tex] A tool to insert {\Coq} examples within .tex files.
-\item[coqdoc] A documentation tool for \Coq.
-\item[coqgraph] A tool to generate a dependency graph from {\Coq} sources.
-\end{description}
-
-There are front-ends for specific languages:
-
-\begin{description}
-\item[Why] A back-end generator of verification conditions.
-\item[Krakatoa] A Java code certification tool that uses both {\Coq} and {\Why} to verify the soundness of implementations with regards to the specifications.
-\item[Caduceus] A C code certification tool that uses both {\Coq} and \Why.
-\item[Zenon] A first-order theorem prover.
-\item[Focal] The \ahref{http://focal.inria.fr}{Focal} project aims at building an environment to develop certified computer algebra libraries.
-\item[Concoqtion] is a dependently-typed extension of Objective Caml (and of MetaOCaml) with specifications expressed and proved in Coq.
-\item[Ynot] is an extension of Coq providing a "Hoare Type Theory" for specifying higher-order, imperative and concurrent programs.
-\item[Ott]is a tool to translate the descriptions of the syntax and semantics of programming languages to the syntax of Coq, or of other provers.
-\end{description}
-
-\Question{What are the high-level tactics of \Coq}
-
-\begin{itemize}
-\item Decision of quantifier-free Presburger's Arithmetic
-\item Simplification of expressions on rings and fields
-\item Decision of closed systems of equations
-\item Semi-decision of first-order logic
-\item Prolog-style proof search, possibly involving equalities
-\end{itemize}
-
-\Question{What are the main libraries available for \Coq}
-
-\begin{itemize}
-\item Basic Peano's arithmetic, binary integer numbers, rational numbers,
-\item Real analysis,
-\item Libraries for lists, boolean, maps, floating-point numbers,
-\item Libraries for relations, sets and constructive algebra,
-\item Geometry
-\end{itemize}
-
-
-\Question{What are the mathematical applications for {\Coq}?}
-
-{\Coq} is used for formalizing mathematical theories, for teaching,
-and for proving properties of algorithms or programs libraries.
-
-The largest mathematical formalization has been done at the University
-of Nijmegen (see the
-\ahref{http://c-corn.cs.ru.nl}{Constructive Coq
-Repository at Nijmegen}).
-
-A symbolic step has also been obtained by formalizing in full a proof
-of the Four Color Theorem.
-
-\Question{What are the industrial applications for {\Coq}?}
-
-{\Coq} is used e.g. to prove properties of the JavaCard system
-(especially by Schlumberger and Trusted Logic). It has
-also been used to formalize the semantics of the Lucid-Synchrone
-data-flow synchronous calculus used by Esterel-Technologies.
-
-\iffalse
-todo christine compilo lustre?
-\fi
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-\section{Documentation}
-
-\Question{Where can I find documentation about {\Coq}?}
-All the documentation about \Coq, from the reference manual~\cite{Coq:manual} to
-friendly tutorials~\cite{Coq:Tutorial} and documentation of the standard library, is available
-\ahref{http://coq.inria.fr/doc-eng.html}{online}.
-All these documents are viewable either in browsable HTML, or as
-downloadable postscripts.
-
-\Question{Where can I find this FAQ on the web?}
-
-This FAQ is available online at \ahref{http://coq.inria.fr/faq}{\url{http://coq.inria.fr/faq}}.
-
-\Question{How can I submit suggestions / improvements / additions for this FAQ?}
-
-This FAQ is unfinished (in the sense that there are some obvious
-sections that are missing). Please send contributions to Coq-Club.
-
-\Question{Is there any mailing list about {\Coq}?}
-The main {\Coq} mailing list is \url{coq-club@inria.fr}, which
-broadcasts questions and suggestions about the implementation, the
-logical formalism or proof developments. See
-\ahref{http://sympa.inria.fr/sympa/info/coq-club}{\url{http://sympa.inria.fr/sympa/info/coq-club}} for
-subscription. For bugs reports see question \ref{coqbug}.
-
-\Question{Where can I find an archive of the list?}
-The archives of the {\Coq} mailing list are available at
-\ahref{http://sympa.inria.fr/sympa/arc/coq-club}{\url{http://sympa.inria.fr/sympa/arc/coq-club}}.
-
-
-\Question{How can I be kept informed of new releases of {\Coq}?}
-
-New versions of {\Coq} are announced on the coq-club mailing list. If you only want to receive information about new releases, you can subscribe to {\Coq} on \ahref{http://freshmeat.net/projects/coq/}{\url{http://freshmeat.net/projects/coq/}}.
-
-
-\Question{Is there any book about {\Coq}?}
-
-The first book on \Coq, Yves Bertot and Pierre Castéran's Coq'Art has been published by Springer-Verlag in 2004:
-\begin{quote}
-``This book provides a pragmatic introduction to the development of
-proofs and certified programs using \Coq. With its large collection of
-examples and exercises it is an invaluable tool for researchers,
-students, and engineers interested in formal methods and the
-development of zero-default software.''
-\end{quote}
-
-\Question{Where can I find some {\Coq} examples?}
-
-There are examples in the manual~\cite{Coq:manual} and in the
-Coq'Art~\cite{Coq:coqart} exercises \ahref{\url{http://www.labri.fr/Perso/~casteran/CoqArt/index.html}}{\url{http://www.labri.fr/Perso/~casteran/CoqArt/index.html}}.
-You can also find large developments using
-{\Coq} in the {\Coq} user contributions:
-\ahref{http://coq.inria.fr/contribs}{\url{http://coq.inria.fr/contribs}}.
-
-\Question{How can I report a bug?}\label{coqbug}
-
-You can use the web interface accessible at \ahref{http://coq.inria.fr}{\url{http://coq.inria.fr}}, link ``contacts''.
-
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-\section{Installation}
-
-\Question{What is the license of {\Coq}?}
-{\Coq} is distributed under the GNU Lesser General License
-(LGPL).
-
-\Question{Where can I find the sources of {\Coq}?}
-The sources of {\Coq} can be found online in the tar.gz'ed packages
-(\ahref{http://coq.inria.fr}{\url{http://coq.inria.fr}}, link
-``download''). Development sources can be accessed at
-\ahref{http://coq.gforge.inria.fr/}{\url{http://coq.gforge.inria.fr/}}
-
-\Question{On which platform is {\Coq} available?}
-Compiled binaries are available for Linux, MacOS X, and Windows. The
-sources can be easily compiled on all platforms supporting Objective
-Caml.
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-\section{The logic of {\Coq}}
-
-\subsection{General}
-
-\Question{What is the logic of \Coq?}
-
-{\Coq} is based on an axiom-free type theory called
-the Calculus of Inductive Constructions (see Coquand \cite{CoHu86},
-Luo~\cite{Luo90}
-and Coquand--Paulin-Mohring \cite{CoPa89}). It includes higher-order
-functions and predicates, inductive and co-inductive datatypes and
-predicates, and a stratified hierarchy of sets.
-
-\Question{Is \Coq's logic intuitionistic or classical?}
-
-{\Coq}'s logic is modular. The core logic is intuitionistic
-(i.e. excluded-middle $A\vee\neg A$ is not granted by default). It can
-be extended to classical logic on demand by requiring an
-optional module stating $A\vee\neg A$.
-
-\Question{Can I define non-terminating programs in \Coq?}
-
-All programs in {\Coq} are terminating. Especially, loops
-must come with an evidence of their termination.
-
-Non-terminating programs can be simulated by passing around a
-bound on how long the program is allowed to run before dying.
-
-\Question{How is equational reasoning working in {\Coq}?}
-
- {\Coq} comes with an internal notion of computation called
-{\em conversion} (e.g. $(x+1)+y$ is internally equivalent to
-$(x+y)+1$; similarly applying argument $a$ to a function mapping $x$
-to some expression $t$ converts to the expression $t$ where $x$ is
-replaced by $a$). This notion of conversion (which is decidable
-because {\Coq} programs are terminating) covers a certain part of
-equational reasoning but is limited to sequential evaluation of
-expressions of (not necessarily closed) programs. Besides conversion,
-equations have to be treated by hand or using specialised tactics.
-
-\subsection{Axioms}
-
-\Question{What axioms can be safely added to {\Coq}?}
-
-There are a few typical useful axioms that are independent from the
-Calculus of Inductive Constructions and that are considered consistent with
-the theory of {\Coq}.
-Most of these axioms are stated in the directory {\tt Logic} of the
-standard library of {\Coq}. The most interesting ones are
-
-\begin{itemize}
-\item Excluded-middle: $\forall A:Prop, A \vee \neg A$
-\item Proof-irrelevance: $\forall A:Prop \forall p_1 p_2:A, p_1=p_2$
-\item Unicity of equality proofs (or equivalently Streicher's axiom $K$):
-$\forall A \forall x y:A \forall p_1 p_2:x=y, p_1=p_2$
-\item Hilbert's $\epsilon$ operator: if $A \neq \emptyset$, then there is $\epsilon_P$ such that $\exists x P(x) \rightarrow P(\epsilon_P)$
-\item Church's $\iota$ operator: if $A \neq \emptyset$, then there is $\iota_P$ such that $\exists! x P(x) \rightarrow P(\iota_P)$
-\item The axiom of unique choice: $\forall x \exists! y R(x,y) \rightarrow \exists f \forall x R(x,f(x))$
-\item The functional axiom of choice: $\forall x \exists y R(x,y) \rightarrow \exists f \forall x R(x,f(x))$
-\item Extensionality of predicates: $\forall P Q:A\rightarrow Prop, (\forall x, P(x) \leftrightarrow Q(x)) \rightarrow P=Q$
-\item Extensionality of functions: $\forall f g:A\rightarrow B, (\forall x, f(x)=g(x)) \rightarrow f=g$
-\end{itemize}
-
-Figure~\ref{fig:axioms} is a summary of the relative strength of these
-axioms, most proofs can be found in directory {\tt Logic} of the standard
-library. (Statements in boldface are the most ``interesting'' ones for
-Coq.) The justification of their validity relies on the interpretability
-in set theory.
-
-\begin{figure}[htbp]
-%HEVEA\imgsrc{axioms.png}
-%BEGIN LATEX
-\begin{center}
-\ifpdf % si on est en pdflatex
-\scalebox{0.65}{\input{axioms.pdf_t}}
-\else
-\scalebox{0.65}{\input{axioms.eps_t}}
-\fi
-\end{center}
-%END LATEX
-\caption{The dependency graph of axioms in the Calculus of Inductive Constructions}
-\label{fig:axioms}
-\end{figure}
-
-\Question{What standard axioms are inconsistent with {\Coq}?}
-
-The axiom of unique choice together with classical logic
-(e.g. excluded-middle) are inconsistent in the variant of the Calculus
-of Inductive Constructions where {\Set} is impredicative.
-
-As a consequence, the functional form of the axiom of choice and
-excluded-middle, or any form of the axiom of choice together with
-predicate extensionality are inconsistent in the {\Set}-impredicative
-version of the Calculus of Inductive Constructions.
-
-The main purpose of the \Set-predicative restriction of the Calculus
-of Inductive Constructions is precisely to accommodate these axioms
-which are quite standard in mathematical usage.
-
-The $\Set$-predicative system is commonly considered consistent by
-interpreting it in a standard set-theoretic boolean model, even with
-classical logic, axiom of choice and predicate extensionality added.
-
-\Question{What is Streicher's axiom $K$}
-\label{Streicher}
-
-Streicher's axiom $K$~\cite{HofStr98} is an axiom that asserts
-dependent elimination of reflexive equality proofs.
-
-\begin{coq_example*}
-Axiom Streicher_K :
- forall (A:Type) (x:A) (P: x=x -> Prop),
- P (eq_refl x) -> forall p: x=x, P p.
-\end{coq_example*}
-
-In the general case, axiom $K$ is an independent statement of the
-Calculus of Inductive Constructions. However, it is true on decidable
-domains (see file \vfile{\LogicEqdepDec}{Eqdep\_dec}). It is also
-trivially a consequence of proof-irrelevance (see
-\ref{proof-irrelevance}) hence of classical logic.
-
-Axiom $K$ is equivalent to {\em Uniqueness of Identity Proofs} \cite{HofStr98}
-
-\begin{coq_example*}
-Axiom UIP : forall (A:Set) (x y:A) (p1 p2: x=y), p1 = p2.
-\end{coq_example*}
-
-Axiom $K$ is also equivalent to {\em Uniqueness of Reflexive Identity Proofs} \cite{HofStr98}
-
-\begin{coq_example*}
-Axiom UIP_refl : forall (A:Set) (x:A) (p: x=x), p = eq_refl x.
-\end{coq_example*}
-
-Axiom $K$ is also equivalent to
-
-\begin{coq_example*}
-Axiom
- eq_rec_eq :
- forall (A:Set) (x:A) (P: A->Set) (p:P x) (h: x=x),
- p = eq_rect x P p x h.
-\end{coq_example*}
-
-It is also equivalent to the injectivity of dependent equality (dependent equality is itself equivalent to equality of dependent pairs).
-
-\begin{coq_example*}
-Inductive eq_dep (U:Set) (P:U -> Set) (p:U) (x:P p) :
-forall q:U, P q -> Prop :=
- eq_dep_intro : eq_dep U P p x p x.
-Axiom
- eq_dep_eq :
- forall (U:Set) (u:U) (P:U -> Set) (p1 p2:P u),
- eq_dep U P u p1 u p2 -> p1 = p2.
-\end{coq_example*}
-
-\Question{What is proof-irrelevance}
-\label{proof-irrelevance}
-
-A specificity of the Calculus of Inductive Constructions is to permit
-statements about proofs. This leads to the question of comparing two
-proofs of the same proposition. Identifying all proofs of the same
-proposition is called {\em proof-irrelevance}:
-$$
-\forall A:\Prop, \forall p q:A, p=q
-$$
-
-Proof-irrelevance (in {\Prop}) can be assumed without contradiction in
-{\Coq}. It expresses that only provability matters, whatever the exact
-form of the proof is. This is in harmony with the common purely
-logical interpretation of {\Prop}. Contrastingly, proof-irrelevance is
-inconsistent in {\Set} since there are types in {\Set}, such as the
-type of booleans, that provably have at least two distinct elements.
-
-Proof-irrelevance (in {\Prop}) is a consequence of classical logic
-(see proofs in file \vfile{\LogicClassical}{Classical} and
-\vfile{\LogicBerardi}{Berardi}). Proof-irrelevance is also a
-consequence of propositional extensionality (i.e. \coqtt{(A {\coqequiv} B)
-{\coqimp} A=B}, see the proof in file
-\vfile{\LogicClassicalFacts}{ClassicalFacts}).
-
-Proof-irrelevance directly implies Streicher's axiom $K$.
-
-\Question{What about functional extensionality?}
-
-Extensionality of functions is admittedly consistent with the
-Set-predicative Calculus of Inductive Constructions.
-
-%\begin{coq_example*}
-% Axiom extensionality : (A,B:Set)(f,g:(A->B))(x:A)(f x)=(g x)->f=g.
-%\end{coq_example*}
-
-Let {\tt A}, {\tt B} be types. To deal with extensionality on
-\verb=A->B= without relying on a general extensionality axiom,
-a possible approach is to define one's own extensional equality on
-\verb=A->B=.
-
-\begin{coq_eval}
-Variables A B : Set.
-\end{coq_eval}
-
-\begin{coq_example*}
-Definition ext_eq (f g: A->B) := forall x:A, f x = g x.
-\end{coq_example*}
-
-and to reason on \verb=A->B= as a setoid (see the Chapter on
-Setoids in the Reference Manual).
-
-\Question{Is {\Prop} impredicative?}
-
-Yes, the sort {\Prop} of propositions is {\em
-impredicative}. Otherwise said, a statement of the form $\forall
-A:Prop, P(A)$ can be instantiated by itself: if $\forall A:\Prop, P(A)$
-is provable, then $P(\forall A:\Prop, P(A))$ is.
-
-\Question{Is {\Set} impredicative?}
-
-No, the sort {\Set} lying at the bottom of the hierarchy of
-computational types is {\em predicative} in the basic {\Coq} system.
-This means that a family of types in {\Set}, e.g. $\forall A:\Set, A
-\rightarrow A$, is not a type in {\Set} and it cannot be applied on
-itself.
-
-However, the sort {\Set} was impredicative in the original versions of
-{\Coq}. For backward compatibility, or for experiments by
-knowledgeable users, the logic of {\Coq} can be set impredicative for
-{\Set} by calling {\Coq} with the option {\tt -impredicative-set}.
-
-{\Set} has been made predicative from version 8.0 of {\Coq}. The main
-reason is to interact smoothly with a classical mathematical world
-where both excluded-middle and the axiom of description are valid (see
-file \vfile{\LogicClassicalDescription}{ClassicalDescription} for a
-proof that excluded-middle and description implies the double negation
-of excluded-middle in {\Set} and file {\tt Hurkens\_Set.v} from the
-user contribution {\tt Paradoxes} at
-\ahref{http://coq.inria.fr/contribs}{\url{http://coq.inria.fr/contribs}}
-for a proof that impredicativity of {\Set} implies the simple negation
-of excluded-middle in {\Set}).
-
-\Question{Is {\Type} impredicative?}
-
-No, {\Type} is stratified. This is hidden for the
-user, but {\Coq} internally maintains a set of constraints ensuring
-stratification.
-
-If {\Type} were impredicative then it would be possible to encode
-Girard's systems $U-$ and $U$ in {\Coq} and it is known from Girard,
-Coquand, Hurkens and Miquel that systems $U-$ and $U$ are inconsistent
-[Girard 1972, Coquand 1991, Hurkens 1993, Miquel 2001]. This encoding
-can be found in file {\tt Logic/Hurkens.v} of {\Coq} standard library.
-
-For instance, when the user see {\tt $\forall$ X:Type, X->X : Type}, each
-occurrence of {\Type} is implicitly bound to a different level, say
-$\alpha$ and $\beta$ and the actual statement is {\tt
-forall X:Type($\alpha$), X->X : Type($\beta$)} with the constraint
-$\alpha<\beta$.
-
-When a statement violates a constraint, the message {\tt Universe
-inconsistency} appears. Example: {\tt fun (x:Type) (y:$\forall$ X:Type, X
-{\coqimp} X) => y x x}.
-
-\Question{I have two proofs of the same proposition. Can I prove they are equal?}
-
-In the base {\Coq} system, the answer is generally no. However, if
-classical logic is set, the answer is yes for propositions in {\Prop}.
-The answer is also yes if proof irrelevance holds (see question
-\ref{proof-irrelevance}).
-
-There are also ``simple enough'' propositions for which you can prove
-the equality without requiring any extra axioms. This is typically
-the case for propositions defined deterministically as a first-order
-inductive predicate on decidable sets. See for instance in question
-\ref{le-uniqueness} an axiom-free proof of the uniqueness of the proofs of
-the proposition {\tt le m n} (less or equal on {\tt nat}).
-
-% It is an ongoing work of research to natively include proof
-% irrelevance in {\Coq}.
-
-\Question{I have two proofs of an equality statement. Can I prove they are
-equal?}
-
- Yes, if equality is decidable on the domain considered (which
-is the case for {\tt nat}, {\tt bool}, etc): see {\Coq} file
-\verb=Eqdep_dec.v=). No otherwise, unless
-assuming Streicher's axiom $K$ (see \cite{HofStr98}) or a more general
-assumption such as proof-irrelevance (see \ref{proof-irrelevance}) or
-classical logic.
-
-All of these statements can be found in file \vfile{\LogicEqdep}{Eqdep}.
-
-\Question{Can I prove that the second components of equal dependent
-pairs are equal?}
-
- The answer is the same as for proofs of equality
-statements. It is provable if equality on the domain of the first
-component is decidable (look at \verb=inj_right_pair= from file
-\vfile{\LogicEqdepDec}{Eqdep\_dec}), but not provable in the general
-case. However, it is consistent (with the Calculus of Constructions)
-to assume it is true. The file \vfile{\LogicEqdep}{Eqdep} actually
-provides an axiom (equivalent to Streicher's axiom $K$) which entails
-the result (look at \verb=inj_pair2= in \vfile{\LogicEqdep}{Eqdep}).
-
-\subsection{Impredicativity}
-
-\Question{Why {\tt injection} does not work on impredicative {\tt Set}?}
-
- E.g. in this case (this occurs only in the {\tt Set}-impredicative
- variant of \Coq):
-
-\begin{coq_example*}
-Inductive I : Type :=
- intro : forall k:Set, k -> I.
-Lemma eq_jdef :
- forall x y:nat, intro _ x = intro _ y -> x = y.
-Proof.
- intros x y H; injection H.
-\end{coq_example*}
-
-\begin{coq_eval}
-Reset Initial.
-\end{coq_eval}
-
- Injectivity of constructors is restricted to predicative types. If
-injectivity on large inductive types were not restricted, we would be
-allowed to derive an inconsistency (e.g. following the lines of
-Burali-Forti paradox). The question remains open whether injectivity
-is consistent on some large inductive types not expressive enough to
-encode known paradoxes (such as type I above).
-
-
-\Question{What is a ``large inductive definition''?}
-
-An inductive definition in {\Prop} or {\Set} is called large
-if its constructors embed sets or propositions. As an example, here is
-a large inductive type:
-
-\begin{coq_example*}
-Inductive sigST (P:Set -> Set) : Type :=
- existST : forall X:Set, P X -> sigST P.
-\end{coq_example*}
-
-In the {\tt Set} impredicative variant of {\Coq}, large inductive
-definitions in {\tt Set} have restricted elimination schemes to
-prevent inconsistencies. Especially, projecting the set or the
-proposition content of a large inductive definition is forbidden. If
-it were allowed, it would be possible to encode e.g. Burali-Forti
-paradox \cite{Gir70,Coq85}.
-
-
-\Question{Is Coq's logic conservative over Coquand's Calculus of
-Constructions?}
-
-In the {\Set}-impredicative version of the Calculus of Inductive
-Constructions (CIC), there are two ways to interpret the Calculus of
-Constructions (CC) since the impredicative sort of CC can be
-interpreted either as {\Prop} or as {\Set}. In the {\Set}-predicative
-CIC, the impredicative sort of CC can only be interpreted as {\Prop}.
-
-If the impredicative sort of CC is interpreted as {\Set}, there is no
-conservativity of CIC over CC as the discrimination of
-constructors of inductive types in {\Set} transports to a
-discrimination of constructors of inductive types encoded
-impredicatively. Concretely, considering the impredicative encoding of
-Boolean, equality and falsity, we can prove the following CC statement
-DISCR in CIC which is not provable in CC, as CC has a
-``term-irrelevant'' model.
-
-\begin{coq_example*}
-Definition BOOL := forall X:Set, X -> X -> X.
-Definition TRUE : BOOL := fun X x1 x2 => x1.
-Definition FALSE : BOOL := fun X x1 x2 => x2.
-Definition EQBOOL (x1 x2:BOOL) := forall P:BOOL->Set, P x1 -> P x2.
-Definition BOT := forall X:Set, X.
-
-Definition BOOL2bool : BOOL -> bool := fun b => b bool true false.
-
-Theorem DISCR : EQBOOL TRUE FALSE -> BOT.
-intro X.
-assert (H : BOOL2bool TRUE = BOOL2bool FALSE).
-{ apply X. trivial. }
-discriminate H.
-Qed.
-\end{coq_example*}
-
-If the impredicative sort of CC is interpreted as {\Prop}, CIC is
-presumably conservative over CC. The general idea is that no
-proof-relevant information can flow from {\Prop} to {\Set}, even
-though singleton elimination can be used. Hence types in {\Set} should
-be smashable to the unit type and {\Set} and {\Type} themselves be
-mapped to {\Prop}.
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\section{Talkin' with the Rooster}
-
-
-%%%%%%%
-\subsection{My goal is ..., how can I prove it?}
-
-
-\Question{My goal is a conjunction, how can I prove it?}
-
-Use some theorem or assumption or use the {\split} tactic.
-\begin{coq_example}
-Goal forall A B:Prop, A -> B -> A/\B.
-intros.
-split.
-assumption.
-assumption.
-\end{coq_example}
-\begin{coq_example*}
-Qed.
-\end{coq_example*}
-
-\Question{My goal contains a conjunction as an hypothesis, how can I use it?}
-
-If you want to decompose a hypothesis into several hypotheses, you can
-use the {\destruct} tactic:
-
-\begin{coq_example}
-Goal forall A B:Prop, A/\B -> B.
-intros.
-destruct H as [H1 H2].
-assumption.
-\end{coq_example}
-\begin{coq_example*}
-Qed.
-\end{coq_example*}
-
-You can also perform the destruction at the time of introduction:
-
-\begin{coq_example}
-Goal forall A B:Prop, A/\B -> B.
-intros A B [H1 H2].
-assumption.
-\end{coq_example}
-\begin{coq_example*}
-Qed.
-\end{coq_example*}
-
-\Question{My goal is a disjunction, how can I prove it?}
-
-You can prove the left part or the right part of the disjunction using
-{\left} or {\right} tactics. If you want to do a classical
-reasoning step, use the {\tt classic} axiom to prove the right part with the assumption
-that the left part of the disjunction is false.
-
-\begin{coq_example}
-Goal forall A B:Prop, A -> A\/B.
-intros.
-left.
-assumption.
-\end{coq_example}
-\begin{coq_example*}
-Qed.
-\end{coq_example*}
-
-An example using classical reasoning:
-
-\begin{coq_example}
-Require Import Classical.
-
-Ltac classical_right :=
-match goal with
-| _:_ |- ?X1 \/ _ => (elim (classic X1);intro;[left;trivial|right])
-end.
-
-Ltac classical_left :=
-match goal with
-| _:_ |- _ \/ ?X1 => (elim (classic X1);intro;[right;trivial|left])
-end.
-
-
-Goal forall A B:Prop, (~A -> B) -> A\/B.
-intros.
-classical_right.
-auto.
-\end{coq_example}
-\begin{coq_example*}
-Qed.
-\end{coq_example*}
-
-\Question{My goal is an universally quantified statement, how can I prove it?}
-
-Use some theorem or assumption or introduce the quantified variable in
-the context using the {\intro} tactic. If there are several
-variables you can use the {\intros} tactic. A good habit is to
-provide names for these variables: {\Coq} will do it anyway, but such
-automatic naming decreases legibility and robustness.
-
-
-\Question{My goal contains an universally quantified statement, how can I use it?}
-
-If the universally quantified assumption matches the goal you can
-use the {\apply} tactic. If it is an equation you can use the
-{\rewrite} tactic. Otherwise you can use the {\specialize} tactic
-to instantiate the quantified variables with terms. The variant
-{\tt assert(Ht := H t)} makes a copy of assumption {\tt H} before
-instantiating it.
-
-
-\Question{My goal is an existential, how can I prove it?}
-
-Use some theorem or assumption or exhibit the witness using the {\existstac} tactic.
-\begin{coq_example}
-Goal exists x:nat, forall y, x+y=y.
-exists 0.
-intros.
-auto.
-\end{coq_example}
-\begin{coq_example*}
-Qed.
-\end{coq_example*}
-
-
-\Question{My goal is solvable by some lemma, how can I prove it?}
-
-Just use the {\apply} tactic.
-
-\begin{coq_eval}
-Reset Initial.
-\end{coq_eval}
-
-\begin{coq_example}
-Lemma mylemma : forall x, x+0 = x.
-auto.
-Qed.
-
-Goal 3+0 = 3.
-apply mylemma.
-\end{coq_example}
-\begin{coq_example*}
-Qed.
-\end{coq_example*}
-
-
-
-\Question{My goal contains False as an hypothesis, how can I prove it?}
-
-You can use the {\contradiction} or {\intuition} tactics.
-
-
-\Question{My goal is an equality of two convertible terms, how can I prove it?}
-
-Just use the {\reflexivity} tactic.
-
-\begin{coq_example}
-Goal forall x, 0+x = x.
-intros.
-reflexivity.
-\end{coq_example}
-\begin{coq_example*}
-Qed.
-\end{coq_example*}
-
-\Question{My goal is a {\tt let x := a in ...}, how can I prove it?}
-
-Just use the {\intro} tactic.
-
-
-\Question{My goal is a {\tt let (a, ..., b) := c in}, how can I prove it?}
-
-Just use the {\destruct} c as (a,...,b) tactic.
-
-
-\Question{My goal contains some existential hypotheses, how can I use it?}
-
-As with conjunctive hypotheses, you can use the {\destruct} tactic or
-the {\intros} tactic to decompose them into several hypotheses.
-
-\begin{coq_example*}
-Require Import Arith.
-\end{coq_example*}
-\begin{coq_example}
-Goal forall x, (exists y, x * y = 1) -> x = 1.
-intros x [y H].
-apply mult_is_one in H.
-easy.
-\end{coq_example}
-\begin{coq_example*}
-Qed.
-\end{coq_example*}
-
-
-\Question{My goal is an equality, how can I swap the left and right hand terms?}
-
-Just use the {\symmetry} tactic.
-\begin{coq_example}
-Goal forall x y : nat, x=y -> y=x.
-intros.
-symmetry.
-assumption.
-\end{coq_example}
-\begin{coq_example*}
-Qed.
-\end{coq_example*}
-
-\Question{My hypothesis is an equality, how can I swap the left and right hand terms?}
-
-Just use the {\symmetryin} tactic.
-
-\begin{coq_example}
-Goal forall x y : nat, x=y -> y=x.
-intros.
-symmetry in H.
-assumption.
-\end{coq_example}
-\begin{coq_example*}
-Qed.
-\end{coq_example*}
-
-
-\Question{My goal is an equality, how can I prove it by transitivity?}
-
-Just use the {\transitivity} tactic.
-\begin{coq_example}
-Goal forall x y z : nat, x=y -> y=z -> x=z.
-intros.
-transitivity y.
-assumption.
-assumption.
-\end{coq_example}
-\begin{coq_example*}
-Qed.
-\end{coq_example*}
-
-
-\Question{My goal would be solvable using {\tt apply;assumption} if it would not create meta-variables, how can I prove it?}
-
-You can use {\tt eapply yourtheorem;eauto} but it won't work in all cases ! (for example if more than one hypothesis match one of the subgoals generated by \eapply) so you should rather use {\tt try solve [eapply yourtheorem;eauto]}, otherwise some metavariables may be incorrectly instantiated.
-
-\begin{coq_example}
-Lemma trans : forall x y z : nat, x=y -> y=z -> x=z.
-intros.
-transitivity y;assumption.
-Qed.
-
-Goal forall x y z : nat, x=y -> y=z -> x=z.
-intros.
-eapply trans;eauto.
-Qed.
-
-Goal forall x y z t : nat, x=y -> x=t -> y=z -> x=z.
-intros.
-eapply trans;eauto.
-Undo.
-eapply trans.
-apply H.
-auto.
-Qed.
-
-Goal forall x y z t : nat, x=y -> x=t -> y=z -> x=z.
-intros.
-eapply trans;eauto.
-Undo.
-try solve [eapply trans;eauto].
-eapply trans.
-apply H.
-auto.
-Qed.
-\end{coq_example}
-
-\Question{My goal is solvable by some lemma within a set of lemmas and I don't want to remember which one, how can I prove it?}
-
-You can use a what is called a hints' base.
-
-\begin{coq_example}
-Require Import ZArith.
-Require Ring.
-Local Open Scope Z_scope.
-Lemma toto1 : 1+1 = 2.
-ring.
-Qed.
-Lemma toto2 : 2+2 = 4.
-ring.
-Qed.
-Lemma toto3 : 2+1 = 3.
-ring.
-Qed.
-
-Hint Resolve toto1 toto2 toto3 : mybase.
-
-Goal 2+(1+1)=4.
-auto with mybase.
-Qed.
-\end{coq_example}
-
-
-\Question{My goal is one of the hypotheses, how can I prove it?}
-
-Use the {\assumption} tactic.
-
-\begin{coq_example}
-Goal 1=1 -> 1=1.
-intro.
-assumption.
-\end{coq_example}
-\begin{coq_example*}
-Qed.
-\end{coq_example*}
-
-
-\Question{My goal appears twice in the hypotheses and I want to choose which one is used, how can I do it?}
-
-Use the {\exact} tactic.
-\begin{coq_example}
-Goal 1=1 -> 1=1 -> 1=1.
-intros.
-exact H0.
-\end{coq_example}
-\begin{coq_example*}
-Qed.
-\end{coq_example*}
-
-\Question{What can be the difference between applying one hypothesis or another in the context of the last question?}
-
-From a proof point of view it is equivalent but if you want to extract
-a program from your proof, the two hypotheses can lead to different
-programs.
-
-
-\Question{My goal is a propositional tautology, how can I prove it?}
-
-Just use the {\tauto} tactic.
-\begin{coq_example}
-Goal forall A B:Prop, A-> (A\/B) /\ A.
-intros.
-tauto.
-\end{coq_example}
-\begin{coq_example*}
-Qed.
-\end{coq_example*}
-
-\Question{My goal is a first order formula, how can I prove it?}
-
-Just use the semi-decision tactic: \firstorder.
-
-\iffalse
-todo: demander un exemple à Pierre
-\fi
-
-\Question{My goal is solvable by a sequence of rewrites, how can I prove it?}
-
-Just use the {\congruence} tactic.
-\begin{coq_example}
-Goal forall a b c d e, a=d -> b=e -> c+b=d -> c+e=a.
-intros.
-congruence.
-\end{coq_example}
-\begin{coq_example*}
-Qed.
-\end{coq_example*}
-
-
-\Question{My goal is a disequality solvable by a sequence of rewrites, how can I prove it?}
-
-Just use the {\congruence} tactic.
-
-\begin{coq_example}
-Goal forall a b c d, a<>d -> b=a -> d=c+b -> b<>c+b.
-intros.
-congruence.
-\end{coq_example}
-\begin{coq_example*}
-Qed.
-\end{coq_example*}
-
-
-\Question{My goal is an equality on some ring (e.g. natural numbers), how can I prove it?}
-
-Just use the {\ring} tactic.
-
-\begin{coq_example}
-Require Import ZArith.
-Require Ring.
-Local Open Scope Z_scope.
-Goal forall a b : Z, (a+b)*(a+b) = a*a + 2*a*b + b*b.
-intros.
-ring.
-\end{coq_example}
-\begin{coq_example*}
-Qed.
-\end{coq_example*}
-
-\Question{My goal is an equality on some field (e.g. real numbers), how can I prove it?}
-
-Just use the {\field} tactic.
-
-\begin{coq_example}
-Require Import Reals.
-Require Ring.
-Local Open Scope R_scope.
-Goal forall a b : R, b*a<>0 -> (a/b) * (b/a) = 1.
-intros.
-field.
-split ; auto with real.
-\end{coq_example}
-\begin{coq_example*}
-Qed.
-\end{coq_example*}
-
-
-\Question{My goal is an inequality on integers in Presburger's arithmetic (an expression build from $+$, $-$, constants, and variables), how can I prove it?}
-
-
-\begin{coq_example}
-Require Import ZArith.
-Require Omega.
-Local Open Scope Z_scope.
-Goal forall a : Z, a>0 -> a+a > a.
-intros.
-omega.
-\end{coq_example}
-\begin{coq_example*}
-Qed.
-\end{coq_example*}
-
-
-\Question{My goal is an equation solvable using equational hypothesis on some ring (e.g. natural numbers), how can I prove it?}
-
-You need the {\gb} tactic (see Loïc Pottier's homepage).
-
-\subsection{Tactics usage}
-
-\Question{I want to state a fact that I will use later as an hypothesis, how can I do it?}
-
-If you want to use forward reasoning (first proving the fact and then
-using it) you just need to use the {\assert} tactic. If you want to use
-backward reasoning (proving your goal using an assumption and then
-proving the assumption) use the {\cut} tactic.
-
-\begin{coq_example}
-Goal forall A B C D : Prop, (A -> B) -> (B->C) -> A -> C.
-intros.
-assert (A->C).
-intro;apply H0;apply H;assumption.
-apply H2.
-assumption.
-\end{coq_example}
-\begin{coq_example*}
-Qed.
-\end{coq_example*}
-
-\begin{coq_example}
-Goal forall A B C D : Prop, (A -> B) -> (B->C) -> A -> C.
-intros.
-cut (A->C).
-intro.
-apply H2;assumption.
-intro;apply H0;apply H;assumption.
-\end{coq_example}
-\begin{coq_example*}
-Qed.
-\end{coq_example*}
-
-
-
-
-\Question{I want to state a fact that I will use later as an hypothesis and prove it later, how can I do it?}
-
-You can use {\cut} followed by {\intro} or you can use the following {\Ltac} command:
-\begin{verbatim}
-Ltac assert_later t := cut t;[intro|idtac].
-\end{verbatim}
-
-\Question{What is the difference between {\Qed} and {\Defined}?}
-
-These two commands perform type checking, but when {\Defined} is used the new definition is set as transparent, otherwise it is defined as opaque (see \ref{opaque}).
-
-
-\Question{How can I know what an automation tactic does in my example?}
-
-You can use its {\tt info} variant: info\_auto, info\_trivial, info\_eauto.
-
-\Question{Why {\auto} does not work? How can I fix it?}
-
-You can increase the depth of the proof search or add some lemmas in the base of hints.
-Perhaps you may need to use \eauto.
-
-\Question{What is {\eauto}?}
-
-This is the same tactic as \auto, but it relies on {\eapply} instead of \apply.
-
-\Question{How can I speed up {\auto}?}
-
-You can use \texttt{info\_}{\auto} to replace {\auto} by the tactics it generates.
-You can split your hint bases into smaller ones.
-
-
-\Question{What is the equivalent of {\tauto} for classical logic?}
-
-Currently there are no equivalent tactic for classical logic. You can use Gödel's ``not not'' translation.
-
-
-\Question{I want to replace some term with another in the goal, how can I do it?}
-
-If one of your hypothesis (say {\tt H}) states that the terms are equal you can use the {\rewrite} tactic. Otherwise you can use the {\replace} {\tt with} tactic.
-
-\Question{I want to replace some term with another in an hypothesis, how can I do it?}
-
-You can use the {\rewrite} {\tt in} tactic.
-
-\Question{I want to replace some symbol with its definition, how can I do it?}
-
-You can use the {\unfold} tactic.
-
-\Question{How can I reduce some term?}
-
-You can use the {\simpl} tactic.
-
-\Question{How can I declare a shortcut for some term?}
-
-You can use the {\set} or {\pose} tactics.
-
-\Question{How can I perform case analysis?}
-
-You can use the {\case} or {\destruct} tactics.
-
-\Question{How can I prevent the case tactic from losing information ?}
-
-You may want to use the (now standard) {\tt case\_eq} tactic. See the Coq'Art page 159.
-
-\Question{Why should I name my intros?}
-
-When you use the {\intro} tactic you don't have to give a name to your
-hypothesis. If you do so the name will be generated by {\Coq} but your
-scripts may be less robust. If you add some hypothesis to your theorem
-(or change their order), you will have to change your proof to adapt
-to the new names.
-
-\Question{How can I automatize the naming?}
-
-You can use the {\tt Show Intro.} or {\tt Show Intros.} commands to generate the names and use your editor to generate a fully named {\intro} tactic.
-This can be automatized within {\tt xemacs}.
-
-\begin{coq_example}
-Goal forall A B C : Prop, A -> B -> C -> A/\B/\C.
-Show Intros.
-(*
-A B C H H0
-H1
-*)
-intros A B C H H0 H1.
-repeat split;assumption.
-\end{coq_example}
-\begin{coq_example*}
-Qed.
-\end{coq_example*}
-
-\Question{I want to automatize the use of some tactic, how can I do it?}
-
-You need to use the {\tt proof with T} command and add {\ldots} at the
-end of your sentences.
-
-For instance:
-\begin{coq_example}
-Goal forall A B C : Prop, A -> B/\C -> A/\B/\C.
-Proof with assumption.
-intros.
-split...
-\end{coq_example}
-\begin{coq_example*}
-Qed.
-\end{coq_example*}
-
-\Question{I want to execute the {\texttt proof with} tactic only if it solves the goal, how can I do it?}
-
-You need to use the {\try} and {\solve} tactics. For instance:
-\begin{coq_example}
-Require Import ZArith.
-Require Ring.
-Local Open Scope Z_scope.
-Goal forall a b c : Z, a+b=b+a.
-Proof with try solve [ring].
-intros...
-\end{coq_example}
-\begin{coq_example*}
-Qed.
-\end{coq_example*}
-
-\Question{How can I do the opposite of the {\intro} tactic?}
-
-You can use the {\generalize} tactic.
-
-\begin{coq_example}
-Goal forall A B : Prop, A->B-> A/\B.
-intros.
-generalize H.
-intro.
-auto.
-\end{coq_example}
-\begin{coq_example*}
-Qed.
-\end{coq_example*}
-
-\Question{One of the hypothesis is an equality between a variable and some term, I want to get rid of this variable, how can I do it?}
-
-You can use the {\subst} tactic. This will rewrite the equality everywhere and clear the assumption.
-
-\Question{What can I do if I get ``{\tt generated subgoal term has metavariables in it }''?}
-
-You should use the {\eapply} tactic, this will generate some goals containing metavariables.
-
-\Question{How can I instantiate some metavariable?}
-
-Just use the {\instantiate} tactic.
-
-
-\Question{What is the use of the {\pattern} tactic?}
-
-The {\pattern} tactic transforms the current goal, performing
-beta-expansion on all the applications featuring this tactic's
-argument. For instance, if the current goal includes a subterm {\tt
-phi(t)}, then {\tt pattern t} transforms the subterm into {\tt (fun
-x:A => phi(x)) t}. This can be useful when {\apply} fails on matching,
-to abstract the appropriate terms.
-
-\Question{What is the difference between assert, cut and generalize?}
-
-PS: Notice for people that are interested in proof rendering that \assert
-and {\pose} (and \cut) are not rendered the same as {\generalize} (see the
-HELM experimental rendering tool at \ahref{http://helm.cs.unibo.it/library.html}{\url{http://helm.cs.unibo.it}}, link
-HELM, link COQ Online). Indeed {\generalize} builds a beta-expanded term
-while \assert, {\pose} and {\cut} uses a let-in.
-
-\begin{verbatim}
- (* Goal is T *)
- generalize (H1 H2).
- (* Goal is A->T *)
- ... a proof of A->T ...
-\end{verbatim}
-
-is rendered into something like
-\begin{verbatim}
- (h) ... the proof of A->T ...
- we proved A->T
- (h0) by (H1 H2) we proved A
- by (h h0) we proved T
-\end{verbatim}
-while
-\begin{verbatim}
- (* Goal is T *)
- assert q := (H1 H2).
- (* Goal is A *)
- ... a proof of A ...
- (* Goal is A |- T *)
- ... a proof of T ...
-\end{verbatim}
-is rendered into something like
-\begin{verbatim}
- (q) ... the proof of A ...
- we proved A
- ... the proof of T ...
- we proved T
-\end{verbatim}
-Otherwise said, {\generalize} is not rendered in a forward-reasoning way,
-while {\assert} is.
-
-\Question{What can I do if \Coq can not infer some implicit argument ?}
-
-You can state explicitly what this implicit argument is. See \ref{implicit}.
-
-\Question{How can I explicit some implicit argument ?}\label{implicit}
-
-Just use \texttt{A:=term} where \texttt{A} is the argument.
-
-For instance if you want to use the existence of ``nil'' on nat*nat lists:
-\begin{verbatim}
-exists (nil (A:=(nat*nat))).
-\end{verbatim}
-
-\iffalse
-\Question{Is there anyway to do pattern matching with dependent types?}
-
-todo
-\fi
-
-\subsection{Proof management}
-
-
-\Question{How can I change the order of the subgoals?}
-
-You can use the {\Focus} command to concentrate on some goal. When the goal is proved you will see the remaining goals.
-
-\Question{How can I change the order of the hypothesis?}
-
-You can use the {\tt Move ... after} command.
-
-\Question{How can I change the name of an hypothesis?}
-
-You can use the {\tt Rename ... into} command.
-
-\Question{How can I delete some hypothesis?}
-
-You can use the {\tt Clear} command.
-
-\Question{How can use a proof which is not finished?}
-
-You can use the {\tt Admitted} command to state your current proof as an axiom.
-You can use the {\tt give\_up} tactic to omit a portion of a proof.
-
-\Question{How can I state a conjecture?}
-
-You can use the {\tt Admitted} command to state your current proof as an axiom.
-
-\Question{What is the difference between a lemma, a fact and a theorem?}
-
-From {\Coq} point of view there are no difference. But some tools can
-have a different behavior when you use a lemma rather than a
-theorem. For instance {\tt coqdoc} will not generate documentation for
-the lemmas within your development.
-
-\Question{How can I organize my proofs?}
-
-You can organize your proofs using the section mechanism of \Coq. Have
-a look at the manual for further information.
-
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\section{Inductive and Co-inductive types}
-
-\subsection{General}
-
-\Question{How can I prove that two constructors are different?}
-
-You can use the {\discriminate} tactic.
-
-\begin{coq_example}
-Inductive toto : Set := | C1 : toto | C2 : toto.
-Goal C1 <> C2.
-discriminate.
-\end{coq_example}
-\begin{coq_example*}
-Qed.
-\end{coq_example*}
-
-\Question{During an inductive proof, how to get rid of impossible cases of an inductive definition?}
-
-Use the {\inversion} tactic.
-
-
-\Question{How can I prove that 2 terms in an inductive set are equal? Or different?}
-
-Have a look at \coqtt{decide equality} and \coqtt{discriminate} in the \ahref{http://coq.inria.fr/doc/main.html}{Reference Manual}.
-
-\Question{Why is the proof of \coqtt{0+n=n} on natural numbers
-trivial but the proof of \coqtt{n+0=n} is not?}
-
- Since \coqtt{+} (\coqtt{plus}) on natural numbers is defined by analysis on its first argument
-
-\begin{coq_example}
-Print plus.
-\end{coq_example}
-
-{\noindent} The expression \coqtt{0+n} evaluates to \coqtt{n}. As {\Coq} reasons
-modulo evaluation of expressions, \coqtt{0+n} and \coqtt{n} are
-considered equal and the theorem \coqtt{0+n=n} is an instance of the
-reflexivity of equality. On the other side, \coqtt{n+0} does not
-evaluate to \coqtt{n} and a proof by induction on \coqtt{n} is
-necessary to trigger the evaluation of \coqtt{+}.
-
-\Question{Why is dependent elimination in Prop not
-available by default?}
-
-
-This is just because most of the time it is not needed. To derive a
-dependent elimination principle in {\tt Prop}, use the command {\tt Scheme} and
-apply the elimination scheme using the \verb=using= option of
-\verb=elim=, \verb=destruct= or \verb=induction=.
-
-
-\Question{Argh! I cannot write expressions like ``~{\tt if n <= p then p else n}~'', as in any programming language}
-\label{minmax}
-
-The short answer : You should use {\texttt le\_lt\_dec n p} instead.\\
-
-The long answer: That's right, you can't.
-If you type for instance the following ``definition'':
-\begin{coq_eval}
-Reset Initial.
-\end{coq_eval}
-\begin{coq_example}
-Fail Definition max (n p : nat) := if n <= p then p else n.
-\end{coq_example}
-
-As \Coq~ says, the term ``~\texttt{n <= p}~'' is a proposition, i.e. a
-statement that belongs to the mathematical world. There are many ways to
-prove such a proposition, either by some computation, or using some already
-proven theorems. For instance, proving $3-2 \leq 2^{45503}$ is very easy,
-using some theorems on arithmetical operations. If you compute both numbers
-before comparing them, you risk to use a lot of time and space.
-
-
-On the contrary, a function for computing the greatest of two natural numbers
-is an algorithm which, called on two natural numbers
-$n$ and $p$, determines whether $n\leq p$ or $p < n$.
-Such a function is a \emph{decision procedure} for the inequality of
- \texttt{nat}. The possibility of writing such a procedure comes
-directly from de decidability of the order $\leq$ on natural numbers.
-
-
-When you write a piece of code like
-``~\texttt{if n <= p then \dots{} else \dots}~''
-in a
-programming language like \emph{ML} or \emph{Java}, a call to such a
-decision procedure is generated. The decision procedure is in general
-a primitive function, written in a low-level language, in the correctness
-of which you have to trust.
-
-The standard Library of the system \emph{Coq} contains a
-(constructive) proof of decidability of the order $\leq$ on
-\texttt{nat} : the function \texttt{le\_lt\_dec} of
-the module \texttt{Compare\_dec} of library \texttt{Arith}.
-
-The following code shows how to define correctly \texttt{min} and
-\texttt{max}, and prove some properties of these functions.
-
-\begin{coq_example}
-Require Import Compare_dec.
-
-Definition max (n p : nat) := if le_lt_dec n p then p else n.
-
-Definition min (n p : nat) := if le_lt_dec n p then n else p.
-
-Eval compute in (min 4 7).
-
-Theorem min_plus_max : forall n p, min n p + max n p = n + p.
-Proof.
- intros n p;
- unfold min, max;
- case (le_lt_dec n p);
- simpl; auto with arith.
-Qed.
-
-Theorem max_equiv : forall n p, max n p = p <-> n <= p.
-Proof.
- unfold max; intros n p; case (le_lt_dec n p);simpl; auto.
- intuition auto with arith.
- split.
- intro e; rewrite e; auto with arith.
- intro H; absurd (p < p); eauto with arith.
-Qed.
-\end{coq_example}
-
-\Question{I wrote my own decision procedure for $\leq$, which
-is much faster than yours, but proving such theorems as
- \texttt{max\_equiv} seems to be quite difficult}
-
-Your code is probably the following one:
-
-\begin{coq_example}
-Fixpoint my_le_lt_dec (n p :nat) {struct n}: bool :=
- match n, p with 0, _ => true
- | S n', S p' => my_le_lt_dec n' p'
- | _ , _ => false
- end.
-
-Definition my_max (n p:nat) := if my_le_lt_dec n p then p else n.
-
-Definition my_min (n p:nat) := if my_le_lt_dec n p then n else p.
-\end{coq_example}
-
-
-For instance, the computation of \texttt{my\_max 567 321} is almost
-immediate, whereas one can't wait for the result of
-\texttt{max 56 32}, using \emph{Coq's} \texttt{le\_lt\_dec}.
-
-This is normal. Your definition is a simple recursive function which
-returns a boolean value. Coq's \texttt{le\_lt\_dec} is a \emph{certified
-function}, i.e. a complex object, able not only to tell whether $n\leq p$
-or $p<n$, but also of building a complete proof of the correct inequality.
-What make \texttt{le\_lt\_dec} inefficient for computing \texttt{min}
-and \texttt{max} is the building of a huge proof term.
-
-Nevertheless, \texttt{le\_lt\_dec} is very useful. Its type
-is a strong specification, using the
-\texttt{sumbool} type (look at the reference manual or chapter 9 of
-\cite{coqart}). Eliminations of the form
-``~\texttt{case (le\_lt\_dec n p)}~'' provide proofs of
-either $n \leq p$ or $p < n$, allowing easy proofs of some theorems as in
-question~\ref{minmax}. Unfortunately, this not the case of your
-\texttt{my\_le\_lt\_dec}, which returns a quite non-informative boolean
-value.
-
-
-\begin{coq_example}
-Check le_lt_dec.
-\end{coq_example}
-
-You should keep in mind that \texttt{le\_lt\_dec} is useful to build
-certified programs which need to compare natural numbers, and is not
-designed to compare quickly two numbers.
-
-Nevertheless, the \emph{extraction} of \texttt{le\_lt\_dec} towards
-\emph{OCaml} or \emph{Haskell}, is a reasonable program for comparing two
-natural numbers in Peano form in linear time.
-
-It is also possible to keep your boolean function as a decision procedure,
-but you have to establish yourself the relationship between \texttt{my\_le\_lt\_dec} and the propositions $n\leq p$ and $p<n$:
-
-\begin{coq_example*}
-Theorem my_le_lt_dec_true :
- forall n p, my_le_lt_dec n p = true <-> n <= p.
-
-Theorem my_le_lt_dec_false :
- forall n p, my_le_lt_dec n p = false <-> p < n.
-\end{coq_example*}
-
-
-\subsection{Recursion}
-
-\Question{Why can't I define a non terminating program?}
-
- Because otherwise the decidability of the type-checking
-algorithm (which involves evaluation of programs) is not ensured. On
-another side, if non terminating proofs were allowed, we could get a
-proof of {\tt False}:
-
-\begin{coq_example*}
-(* This is fortunately not allowed! *)
-Fixpoint InfiniteProof (n:nat) : False := InfiniteProof n.
-Theorem Paradox : False.
-Proof (InfiniteProof O).
-\end{coq_example*}
-
-
-\Question{Why only structurally well-founded loops are allowed?}
-
- The structural order on inductive types is a simple and
-powerful notion of termination. The consistency of the Calculus of
-Inductive Constructions relies on it and another consistency proof
-would have to be made for stronger termination arguments (such
-as the termination of the evaluation of CIC programs themselves!).
-
-In spite of this, all non-pathological termination orders can be mapped
-to a structural order. Tools to do this are provided in the file
-\vfile{\InitWf}{Wf} of the standard library of {\Coq}.
-
-\Question{How to define loops based on non structurally smaller
-recursive calls?}
-
- The procedure is as follows (we consider the definition of {\tt
-mergesort} as an example).
-
-\begin{itemize}
-
-\item Define the termination order, say {\tt R} on the type {\tt A} of
-the arguments of the loop.
-
-\begin{coq_eval}
-Reset Initial.
-Require Import List.
-\end{coq_eval}
-
-\begin{coq_example*}
-Definition R (a b:list nat) := length a < length b.
-\end{coq_example*}
-
-\item Prove that this order is well-founded (in fact that all elements in {\tt A} are accessible along {\tt R}).
-
-\begin{coq_example*}
-Lemma Rwf : well_founded R.
-\end{coq_example*}
-\begin{coq_eval}
-Admitted.
-\end{coq_eval}
-
-\item Define the step function (which needs proofs that recursive
-calls are on smaller arguments).
-
-\begin{coq_example*}
-Definition split (l : list nat)
- : {l1: list nat | R l1 l} * {l2 : list nat | R l2 l}.
-Admitted.
-Definition concat (l1 l2 : list nat) : list nat.
-Admitted.
-Definition merge_step (l : list nat) (f: forall l':list nat, R l' l -> list nat) :=
- let (lH1,lH2) := (split l) in
- let (l1,H1) := lH1 in
- let (l2,H2) := lH2 in
- concat (f l1 H1) (f l2 H2).
-\end{coq_example*}
-
-\item Define the recursive function by fixpoint on the step function.
-
-\begin{coq_example*}
-Definition merge := Fix Rwf (fun _ => list nat) merge_step.
-\end{coq_example*}
-
-\end{itemize}
-
-\Question{What is behind the accessibility and well-foundedness proofs?}
-
- Well-foundedness of some relation {\tt R} on some type {\tt A}
-is defined as the accessibility of all elements of {\tt A} along {\tt R}.
-
-\begin{coq_example}
-Print well_founded.
-Print Acc.
-\end{coq_example}
-
-The structure of the accessibility predicate is a well-founded tree
-branching at each node {\tt x} in {\tt A} along all the nodes {\tt x'}
-less than {\tt x} along {\tt R}. Any sequence of elements of {\tt A}
-decreasing along the order {\tt R} are branches in the accessibility
-tree. Hence any decreasing along {\tt R} is mapped into a structural
-decreasing in the accessibility tree of {\tt R}. This is emphasised in
-the definition of {\tt fix} which recurs not on its argument {\tt x:A}
-but on the accessibility of this argument along {\tt R}.
-
-See file \vfile{\InitWf}{Wf}.
-
-\Question{How to perform simultaneous double induction?}
-
- In general a (simultaneous) double induction is simply solved by an
-induction on the first hypothesis followed by an inversion over the
-second hypothesis. Here is an example
-
-\begin{coq_eval}
-Reset Initial.
-\end{coq_eval}
-
-\begin{coq_example}
-Inductive even : nat -> Prop :=
- | even_O : even 0
- | even_S : forall n:nat, even n -> even (S (S n)).
-
-Inductive odd : nat -> Prop :=
- | odd_SO : odd 1
- | odd_S : forall n:nat, odd n -> odd (S (S n)).
-
-Lemma not_even_and_odd : forall n:nat, even n -> odd n -> False.
-induction 1.
- inversion 1.
- inversion 1. apply IHeven; trivial.
-\end{coq_example}
-\begin{coq_example*}
-Qed.
-\end{coq_example*}
-
-In case the type of the second induction hypothesis is not
-dependent, {\tt inversion} can just be replaced by {\tt destruct}.
-
-\Question{How to define a function by simultaneous double recursion?}
-
- The same trick applies, you can even use the pattern-matching
-compilation algorithm to do the work for you. Here is an example:
-
-\begin{coq_example}
-Fixpoint minus (n m:nat) {struct n} : nat :=
- match n, m with
- | O, _ => 0
- | S k, O => S k
- | S k, S l => minus k l
- end.
-Print minus.
-\end{coq_example}
-
-In case of dependencies in the type of the induction objects
-$t_1$ and $t_2$, an extra argument stating $t_1=t_2$ must be given to
-the fixpoint definition
-
-\Question{How to perform nested and double induction?}
-
- To reason by nested (i.e. lexicographic) induction, just reason by
-induction on the successive components.
-
-\smallskip
-
-Double induction (or induction on pairs) is a restriction of the
-lexicographic induction. Here is an example of double induction.
-
-\begin{coq_example}
-Lemma nat_double_ind :
-forall P : nat -> nat -> Prop, P 0 0 ->
- (forall m n, P m n -> P m (S n)) ->
- (forall m n, P m n -> P (S m) n) ->
- forall m n, P m n.
-intros P H00 HmS HSn; induction m.
-(* case 0 *)
-induction n; [assumption | apply HmS; apply IHn].
-(* case Sm *)
-intro n; apply HSn; apply IHm.
-\end{coq_example}
-\begin{coq_example*}
-Qed.
-\end{coq_example*}
-
-\Question{How to define a function by nested recursion?}
-
- The same trick applies. Here is the example of Ackermann
-function.
-
-\begin{coq_example}
-Fixpoint ack (n:nat) : nat -> nat :=
- match n with
- | O => S
- | S n' =>
- (fix ack' (m:nat) : nat :=
- match m with
- | O => ack n' 1
- | S m' => ack n' (ack' m')
- end)
- end.
-\end{coq_example}
-
-
-\subsection{Co-inductive types}
-
-\Question{I have a cofixpoint $t:=F(t)$ and I want to prove $t=F(t)$. How to do it?}
-
-Just case-expand $F({\tt t})$ then complete by a trivial case analysis.
-Here is what it gives on e.g. the type of streams on naturals
-
-\begin{coq_eval}
-Set Implicit Arguments.
-\end{coq_eval}
-\begin{coq_example}
-CoInductive Stream (A:Set) : Set :=
- Cons : A -> Stream A -> Stream A.
-CoFixpoint nats (n:nat) : Stream nat := Cons n (nats (S n)).
-Lemma Stream_unfold :
- forall n:nat, nats n = Cons n (nats (S n)).
-Proof.
- intro;
- change (nats n = match nats n with
- | Cons x s => Cons x s
- end).
- case (nats n); reflexivity.
-\end{coq_example}
-\begin{coq_example*}
-Qed.
-\end{coq_example*}
-
-
-
-\section{Syntax and notations}
-
-\Question{I do not want to type ``forall'' because it is too long, what can I do?}
-
-You can define your own notation for forall:
-\begin{verbatim}
-Notation "fa x : t, P" := (forall x:t, P) (at level 200, x ident).
-\end{verbatim}
-or if your are using {\CoqIde} you can define a pretty symbol for for all and an input method (see \ref{forallcoqide}).
-
-
-
-\Question{How can I define a notation for square?}
-
-You can use for instance:
-\begin{verbatim}
-Notation "x ^2" := (Rmult x x) (at level 20).
-\end{verbatim}
-Note that you can not use:
-\begin{tt}
-Notation "x $^2$" := (Rmult x x) (at level 20).
-\end{tt}
-because ``$^2$'' is an iso-latin character. If you really want this kind of notation you should use UTF-8.
-
-
-\Question{Why ``no associativity'' and ``left associativity'' at the same level does not work?}
-
-Because we relie on Camlp4 for syntactical analysis and Camlp4 does not really
-implement no associativity. By default, non associative operators are defined
-as right associative.
-
-
-
-\Question{How can I know the associativity associated with a level?}
-
-You can do ``Print Grammar constr'', and decode the output from Camlp4, good luck !
-
-\section{Modules}
-
-
-
-
-%%%%%%%
-\section{\Ltac}
-
-\Question{What is {\Ltac}?}
-
-{\Ltac} is the tactic language for \Coq. It provides the user with a
-high-level ``toolbox'' for tactic creation.
-
-\Question{Is there any printing command in {\Ltac}?}
-
-You can use the {\idtac} tactic with a string argument. This string
-will be printed out. The same applies to the {\fail} tactic
-
-\Question{What is the syntax for let in {\Ltac}?}
-
-If $x_i$ are identifiers and $e_i$ and $expr$ are tactic expressions, then let reads:
-\begin{center}
-{\tt let $x_1$:=$e_1$ with $x_2$:=$e_2$\ldots with $x_n$:=$e_n$ in
-$expr$}.
-\end{center}
-Beware that if $expr$ is complex (i.e. features at least a sequence) parenthesis
-should be added around it. For example:
-\begin{coq_example}
-Ltac twoIntro := let x:=intro in (x;x).
-\end{coq_example}
-
-\Question{What is the syntax for pattern matching in {\Ltac}?}
-
-Pattern matching on a term $expr$ (non-linear first order unification)
-with patterns $p_i$ and tactic expressions $e_i$ reads:
-\begin{center}
-\hspace{10ex}
-{\tt match $expr$ with
-\hspace*{2ex}$p_1$ => $e_1$
-\hspace*{1ex}\textbar$p_2$ => $e_2$
-\hspace*{1ex}\ldots
-\hspace*{1ex}\textbar$p_n$ => $e_n$
-\hspace*{1ex}\textbar\ \textunderscore\ => $e_{n+1}$
-end.
-}
-\end{center}
-Underscore matches all terms.
-
-\Question{What is the semantics for ``match goal''?}
-
-The semantics of {\tt match goal} depends on whether it returns
-tactics or not. The {\tt match goal} expression matches the current
-goal against a series of patterns: {$hyp_1 {\ldots} hyp_n$ \textbar-
-$ccl$}. It uses a first-order unification algorithm and in case of
-success, if the right-hand-side is an expression, it tries to type it
-while if the right-hand-side is a tactic, it tries to apply it. If the
-typing or the tactic application fails, the {\tt match goal} tries all
-the possible combinations of $hyp_i$ before dropping the branch and
-moving to the next one. Underscore matches all terms.
-
-\Question{Why can't I use a ``match goal'' returning a tactic in a non
-tail-recursive position?}
-
-This is precisely because the semantics of {\tt match goal} is to
-apply the tactic on the right as soon as a pattern unifies what is
-meaningful only in tail-recursive uses.
-
-The semantics in non tail-recursive call could have been the one used
-for terms (i.e. fail if the tactic expression is not typable, but
-don't try to apply it). For uniformity of semantics though, this has
-been rejected.
-
-\Question{How can I generate a new name?}
-
-You can use the following syntax:
-{\tt let id:=fresh in \ldots}\\
-For example:
-\begin{coq_example}
-Ltac introIdGen := let id:=fresh in intro id.
-\end{coq_example}
-
-
-\iffalse
-\Question{How can I access the type of a term?}
-
-You can use typeof.
-todo
-\fi
-
-\iffalse
-\Question{How can I define static and dynamic code?}
-\fi
-
-\section{Tactics written in OCaml}
-
-\Question{Can you show me an example of a tactic written in OCaml?}
-
-Have a look at the skeleton ``Hello World'' tactic from the next question.
-You also have some examples of tactics written in OCaml in the ``plugins'' directory of {\Coq} sources.
-
-\Question{Is there a skeleton of OCaml tactic I can reuse somewhere?}
-
-The following steps describe how to write a simplistic ``Hello world'' OCaml
-tactic. This takes the form of a dynamically loadable OCaml module, which will
-be invoked from the Coq toplevel.
-\begin{enumerate}
-\item In the \verb+plugins+ directory of the Coq source location, create a
-directory \verb+hello+. Proceed to create a grammar and OCaml file, respectively
-\verb+plugins/hello/g_hello.ml4+ and \verb+plugins/hello/coq_hello.ml+,
-containing:
- \begin{itemize}
- \item in \verb+g_hello.ml4+:
-\begin{verbatim}
-(*i camlp4deps: "grammar/grammar.cma" i*)
-TACTIC EXTEND Hello
-| [ "hello" ] -> [ Coq_hello.printHello ]
-END
-\end{verbatim}
- \item in \verb+coq_hello.ml+:
-\begin{verbatim}
-let printHello gl =
-Tacticals.tclIDTAC_MESSAGE (Pp.str "Hello world") gl
- \end{verbatim}
- \end{itemize}
-\item Create a file \verb+plugins/hello/hello_plugin.mllib+, containing the
-names of the OCaml modules bundled in the dynamic library:
-\begin{verbatim}
-Coq_hello
-G_hello
-\end{verbatim}
-\item Append the following lines in \verb+plugins/plugins{byte,opt}.itarget+:
-\begin{itemize}
- \item in \verb+pluginsopt.itarget+:
-\begin{verbatim}
-hello/hello_plugin.cmxa
-\end{verbatim}
- \item in \verb+pluginsbyte.itarget+:
-\begin{verbatim}
-hello/hello_plugin.cma
-\end{verbatim}
-\end{itemize}
-\item In the root directory of the Coq source location, modify the file
-\verb+Makefile.common+:
- \begin{itemize}
- \item add \verb+hello+ to the \verb+SRCDIR+ definition (second argument of the
- \verb+addprefix+ function);
- \item in the section ``Object and Source files'', add \verb+HELLOCMA:=plugins/hello/hello_plugin.cma+;
- \item add \verb+$(HELLOCMA)+ to the \verb+PLUGINSCMA+ definition.
- \end{itemize}
-\item Modify the file \verb+Makefile.build+, adding in section ``3) plugins'' the
-line:
-\begin{verbatim}
-hello: $(HELLOCMA)
-\end{verbatim}
-\item From the command line, run \verb+make hello+, then \verb+make plugins/hello/hello_plugin.cmxs+.
-\end{enumerate}
-The call to the tactic \verb+hello+ from a Coq script has to be preceded by
-\verb+Declare ML Module "hello_plugin"+, which will load the dynamic object
-\verb+hello_plugin.cmxs+. For instance:
-\begin{verbatim}
-Declare ML Module "hello_plugin".
-Variable A:Prop.
-Goal A-> A.
-Proof.
-hello.
-auto.
-Qed.
-\end{verbatim}
-
-
-\section{Case studies}
-
-\iffalse
-\Question{How can I define vectors or lists of size n?}
-\fi
-
-
-\Question{How to prove that 2 sets are different?}
-
- You need to find a property true on one set and false on the
-other one. As an example we show how to prove that {\tt bool} and {\tt
-nat} are discriminable. As discrimination property we take the
-property to have no more than 2 elements.
-
-\begin{coq_example*}
-Theorem nat_bool_discr : bool <> nat.
-Proof.
- pose (discr :=
- fun X:Set =>
- ~ (forall a b:X, ~ (forall x:X, x <> a -> x <> b -> False))).
- intro Heq; assert (H: discr bool).
- intro H; apply (H true false); destruct x; auto.
- rewrite Heq in H; apply H; clear H.
- destruct a; destruct b as [|n]; intro H0; eauto.
- destruct n; [ apply (H0 2); discriminate | eauto ].
-Qed.
-\end{coq_example*}
-
-\Question{Is there an axiom-free proof of Streicher's axiom $K$ for
-the equality on {\tt nat}?}
-\label{K-nat}
-
-Yes, because equality is decidable on {\tt nat}. Here is the proof.
-
-\begin{coq_example*}
-Require Import Eqdep_dec.
-Require Import Peano_dec.
-Theorem K_nat :
- forall (x:nat) (P:x = x -> Prop), P (eq_refl x) -> forall p:x = x, P p.
-Proof.
-intros; apply K_dec_set with (p := p).
-apply eq_nat_dec.
-assumption.
-Qed.
-\end{coq_example*}
-
-Similarly, we have
-
-\begin{coq_example*}
-Theorem eq_rect_eq_nat :
- forall (p:nat) (Q:nat->Type) (x:Q p) (h:p=p), x = eq_rect p Q x p h.
-Proof.
-intros; apply K_nat with (p := h); reflexivity.
-Qed.
-\end{coq_example*}
-
-\Question{How to prove that two proofs of {\tt n<=m} on {\tt nat} are equal?}
-\label{le-uniqueness}
-
-This is provable without requiring any axiom because axiom $K$
-directly holds on {\tt nat}. Here is a proof using question \ref{K-nat}.
-
-\begin{coq_example*}
-Require Import Arith.
-Scheme le_ind' := Induction for le Sort Prop.
-Theorem le_uniqueness_proof : forall (n m : nat) (p q : n <= m), p = q.
-Proof.
-induction p using le_ind'; intro q.
- replace (le_n n) with
- (eq_rect _ (fun n0 => n <= n0) (le_n n) _ eq_refl).
- 2:reflexivity.
- generalize (eq_refl n).
- pattern n at 2 4 6 10, q; case q; [intro | intros m l e].
- rewrite <- eq_rect_eq_nat; trivial.
- contradiction (le_Sn_n m); rewrite <- e; assumption.
- replace (le_S n m p) with
- (eq_rect _ (fun n0 => n <= n0) (le_S n m p) _ eq_refl).
- 2:reflexivity.
- generalize (eq_refl (S m)).
- pattern (S m) at 1 3 4 6, q; case q; [intro Heq | intros m0 l HeqS].
- contradiction (le_Sn_n m); rewrite Heq; assumption.
- injection HeqS; intro Heq; generalize l HeqS.
- rewrite <- Heq; intros; rewrite <- eq_rect_eq_nat.
- rewrite (IHp l0); reflexivity.
-Qed.
-\end{coq_example*}
-
-\Question{How to exploit equalities on sets}
-
-To extract information from an equality on sets, you need to
-find a predicate of sets satisfied by the elements of the sets. As an
-example, let's consider the following theorem.
-
-\begin{coq_example*}
-Theorem interval_discr :
- forall m n:nat,
- {x : nat | x <= m} = {x : nat | x <= n} -> m = n.
-\end{coq_example*}
-
-We have a proof requiring the axiom of proof-irrelevance. We
-conjecture that proof-irrelevance can be circumvented by introducing a
-primitive definition of discrimination of the proofs of
-\verb!{x : nat | x <= m}!.
-
-\begin{latexonly}%
-The proof can be found in file {\tt interval$\_$discr.v} in this directory.
-%Here is the proof
-%\begin{small}
-%\begin{flushleft}
-%\begin{texttt}
-%\def_{\ifmmode\sb\else\subscr\fi}
-%\include{interval_discr.v}
-%%% WARNING semantics of \_ has changed !
-%\end{texttt}
-%$a\_b\_c$
-%\end{flushleft}
-%\end{small}
-\end{latexonly}%
-\begin{htmlonly}%
-\ahref{./interval_discr.v}{Here} is the proof.
-\end{htmlonly}
-
-\Question{I have a problem of dependent elimination on
-proofs, how to solve it?}
-
-\begin{coq_eval}
-Reset Initial.
-\end{coq_eval}
-
-\begin{coq_example*}
-Inductive Def1 : Set := c1 : Def1.
-Inductive DefProp : Def1 -> Prop :=
- c2 : forall d:Def1, DefProp d.
-Inductive Comb : Set :=
- c3 : forall d:Def1, DefProp d -> Comb.
-Lemma eq_comb :
- forall (d1 d1':Def1) (d2:DefProp d1) (d2':DefProp d1'),
- d1 = d1' -> c3 d1 d2 = c3 d1' d2'.
-\end{coq_example*}
-
- You need to derive the dependent elimination
-scheme for DefProp by hand using {\coqtt Scheme}.
-
-\begin{coq_eval}
-Abort.
-\end{coq_eval}
-
-\begin{coq_example*}
-Scheme DefProp_elim := Induction for DefProp Sort Prop.
-Lemma eq_comb :
- forall d1 d1':Def1,
- d1 = d1' ->
- forall (d2:DefProp d1) (d2':DefProp d1'), c3 d1 d2 = c3 d1' d2'.
-intros.
-destruct H.
-destruct d2 using DefProp_elim.
-destruct d2' using DefProp_elim.
-reflexivity.
-Qed.
-\end{coq_example*}
-
-
-\Question{And what if I want to prove the following?}
-
-\begin{coq_example*}
-Inductive natProp : nat -> Prop :=
- | p0 : natProp 0
- | pS : forall n:nat, natProp n -> natProp (S n).
-Inductive package : Set :=
- pack : forall n:nat, natProp n -> package.
-Lemma eq_pack :
- forall n n':nat,
- n = n' ->
- forall (np:natProp n) (np':natProp n'), pack n np = pack n' np'.
-\end{coq_example*}
-
-
-
-\begin{coq_eval}
-Abort.
-\end{coq_eval}
-\begin{coq_example*}
-Scheme natProp_elim := Induction for natProp Sort Prop.
-Definition pack_S : package -> package.
-destruct 1.
-apply (pack (S n)).
-apply pS; assumption.
-Defined.
-Lemma eq_pack :
- forall n n':nat,
- n = n' ->
- forall (np:natProp n) (np':natProp n'), pack n np = pack n' np'.
-intros n n' Heq np np'.
-generalize dependent n'.
-induction np using natProp_elim.
-induction np' using natProp_elim; intros; auto.
- discriminate Heq.
-induction np' using natProp_elim; intros; auto.
- discriminate Heq.
-change (pack_S (pack n np) = pack_S (pack n0 np')).
-apply (f_equal (A:=package)).
-apply IHnp.
-auto.
-Qed.
-\end{coq_example*}
-
-
-
-
-
-
-
-\section{Publishing tools}
-
-\Question{How can I generate some latex from my development?}
-
-You can use {\tt coqdoc}.
-
-\Question{How can I generate some HTML from my development?}
-
-You can use {\tt coqdoc}.
-
-\Question{How can I generate some dependency graph from my development?}
-
-You can use the tool \verb|coqgraph| developed by Philippe Audebaud in 2002.
-This tool transforms dependencies generated by \verb|coqdep| into 'dot' files which can be visualized using the Graphviz software (http://www.graphviz.org/).
-
-\Question{How can I cite some {\Coq} in my latex document?}
-
-You can use {\tt coq\_tex}.
-
-\Question{How can I cite the {\Coq} reference manual?}
-
-You can use this bibtex entry (to adapt to the appropriate version):
-\begin{verbatim}
-@manual{Coq:manual,
- author = {{Coq} {Development} {Team}, The},
- title = {The {Coq} Proof Assistant Reference Manual, version 8.7},
- month = Oct,
- year = {2017},
- url = {http://coq.inria.fr}
-}
-\end{verbatim}
-
-\Question{Where can I publish my developments in {\Coq}?}
-
-You can submit your developments as a user contribution to the {\Coq}
-development team. This ensures its liveness along the evolution and
-possible changes of {\Coq}.
-
-You can also submit your developments to the HELM/MoWGLI repository at
-the University of Bologna (see
-\ahref{http://mowgli.cs.unibo.it}{\url{http://mowgli.cs.unibo.it}}). For
-developments submitted in this database, it is possible to visualize
-the developments in natural language and execute various retrieving
-requests.
-
-\Question{How can I read my proof in natural language?}
-
-You can submit your proof to the HELM/MoWGLI repository and use the
-rendering tool provided by the server (see
-\ahref{http://mowgli.cs.unibo.it}{\url{http://mowgli.cs.unibo.it}}).
-
-\section{\CoqIde}
-
-\Question{What is {\CoqIde}?}
-
-{\CoqIde} is a gtk based GUI for \Coq.
-
-\Question{How to enable Emacs keybindings?}
-
-If in Gnome, run the gnome configuration editor (\texttt{gconf-editor})
-and set key \texttt{gtk-key-theme} to \texttt{Emacs} in the category
-\texttt{desktop/gnome/interface}.
-
-Otherwise, you need to find where the \verb#gtk-key-theme-name# option is located in
-your configuration, and set it to \texttt{Emacs}. Usually, it is in the
-\verb#$(HOME)/.gtkrc-2.0# file.
-
-
-%$ juste pour que la coloration emacs marche
-
-\Question{How to enable antialiased fonts?}
-
- Set the \verb#GDK_USE_XFT# variable to \verb#1#. This is by default
- with \verb#Gtk >= 2.2#. If some of your fonts are not available,
- set \verb#GDK_USE_XFT# to \verb#0#.
-
-\Question{How to use those Forall and Exists pretty symbols?}\label{forallcoqide}
- Thanks to the notation features in \Coq, you just need to insert these
-lines in your {\Coq} buffer:\\
-\begin{tt}
-Notation "$\forall$ x : t, P" := (forall x:t, P) (at level 200, x ident).
-\end{tt}\\
-\begin{tt}
-Notation "$\exists$ x : t, P" := (exists x:t, P) (at level 200, x ident).
-\end{tt}
-
-Copy/Paste of these lines from this file will not work outside of \CoqIde.
-You need to load a file containing these lines or to enter the $\forall$
-using an input method (see \ref{inputmeth}). To try it just use \verb#Require Import utf8# from inside
-\CoqIde.
-To enable these notations automatically start coqide with
-\begin{verbatim}
- coqide -l utf8
-\end{verbatim}
-In the ide subdir of {\Coq} library, you will find a sample utf8.v with some
-pretty simple notations.
-
-\Question{How to define an input method for non ASCII symbols?}\label{inputmeth}
-
-\begin{itemize}
-\item First solution: type \verb#<CONTROL><SHIFT>2200# to enter a forall in the script widow.
- 2200 is the hexadecimal code for forall in unicode charts and is encoded as
- in UTF-8.
- 2203 is for exists. See \ahref{http://www.unicode.org}{\url{http://www.unicode.org}} for more codes.
-\item Second solution: rebind \verb#<AltGr>a# to forall and \verb#<AltGr>e# to exists.
-
- Under X11, one can add those lines in the file ~/.xmodmaprc :
-
-\begin{verbatim}
-! forall
-keycode 24 = a A a A U2200 NoSymbol U2200 NoSymbol
-! exists
-keycode 26 = e E e E U2203 NoSymbol U2203 NoSymbol
-\end{verbatim}
-and then run xmodmap ~/.xmodmaprc.
-\end{itemize}
-
- Alternatively, you may use an input method editor such as SCIM or iBus.
-The latter offers a \LaTeX-like input method.
-
-\Question{How to customize the shortcuts for menus?}
- Two solutions are offered:
-\begin{itemize}
-\item Edit \verb+$XDG_CONFIG_HOME/coq/coqide.keys+ (which is usually \verb+$HOME/.config/coq/coqide.keys+) by hand or
-\item If your system supports it, from \CoqIde, you may select a menu entry and press the desired
- shortcut.
-\end{itemize}
-
-\Question{What encoding should I use? What is this $\backslash$x\{iiii\} in my file?}
- The encoding option is related to the way files are saved.
- Keep it as UTF-8 until it becomes important for you to exchange files
- with non UTF-8 aware applications.
- If you choose something else than UTF-8, then missing characters will
- be encoded by $\backslash$x\{....\} or $\backslash$x\{........\}
- where each dot is an hex. digit.
- The number between braces is the hexadecimal UNICODE index for the
- missing character.
-
-\Question{How to get rid of annoying unwanted automatic templates?}
-
-Some users may experiment problems with unwanted automatic
-templates while using Coqide. This is due to a change in the
-modifiers keys available through GTK. The straightest way to get
-rid of the problem is to edit by hand your coqiderc (either
-\verb|/home/<user>/.config/coq/coqiderc| under Linux, or \\
-\verb|C:\Documents and Settings\<user>\.config\coq\coqiderc| under Windows)
-and replace any occurrence of \texttt{MOD4} by \texttt{MOD1}.
-
-
-
-\section{Extraction}
-
-\Question{What is program extraction?}
-
-Program extraction consist in generating a program from a constructive proof.
-
-\Question{Which language can I extract to?}
-
-You can extract your programs to Objective Caml and Haskell.
-
-\Question{How can I extract an incomplete proof?}
-
-You can provide programs for your axioms.
-
-
-
-%%%%%%%
-\section{Glossary}
-
-\Question{Can you explain me what an evaluable constant is?}
-
-An evaluable constant is a constant which is unfoldable.
-
-\Question{What is a goal?}
-
-The goal is the statement to be proved.
-
-\Question{What is a meta variable?}
-
-A meta variable in {\Coq} represents a ``hole'', i.e. a part of a proof
-that is still unknown.
-
-\Question{What is Gallina?}
-
-Gallina is the specification language of \Coq. Complete documentation
-of this language can be found in the Reference Manual.
-
-\Question{What is The Vernacular?}
-
-It is the language of commands of Gallina i.e. definitions, lemmas, {\ldots}
-
-
-\Question{What is a dependent type?}
-
-A dependent type is a type which depends on some term. For instance
-``vector of size n'' is a dependent type representing all the vectors
-of size $n$. Its type depends on $n$
-
-\Question{What is a proof by reflection?}
-
-This is a proof generated by some computation which is done using the
-internal reduction of {\Coq} (not using the tactic language of {\Coq}
-(\Ltac) nor the implementation language for \Coq). An example of
-tactic using the reflection mechanism is the {\ring} tactic. The
-reflection method consist in reflecting a subset of {\Coq} language (for
-example the arithmetical expressions) into an object of the {\Coq}
-language itself (in this case an inductive type denoting arithmetical
-expressions). For more information see~\cite{howe,harrison,boutin}
-and the last chapter of the Coq'Art.
-
-\Question{What is intuitionistic logic?}
-
-This is any logic which does not assume that ``A or not A''.
-
-
-\Question{What is proof-irrelevance?}
-
-See question \ref{proof-irrelevance}
-
-
-\Question{What is the difference between opaque and transparent?}{\label{opaque}}
-
-Opaque definitions can not be unfolded but transparent ones can.
-
-
-\section{Troubleshooting}
-
-\Question{What can I do when {\tt Qed.} is slow?}
-
-Sometime you can use the {\abstracttac} tactic, which makes as if you had
-stated some local lemma, this speeds up the typing process.
-
-\Question{Why \texttt{Reset Initial.} does not work when using \texttt{coqc}?}
-
-The initial state corresponds to the state of \texttt{coqtop} when the interactive
-session began. It does not make sense in files to compile.
-
-
-\Question{What can I do if I get ``No more subgoals but non-instantiated existential variables''?}
-
-This means that {\eauto} or {\eapply} didn't instantiate an
-existential variable which eventually got erased by some computation.
-You may backtrack to the faulty occurrence of {\eauto} or {\eapply}
-and give the missing argument an explicit value. Alternatively, you
-can use the commands \texttt{Show Existentials.} and
-\texttt{Existential.} to display and instantiate the remaining
-existential variables.
-
-
-\begin{coq_example}
-Lemma example_show_existentials : forall a b c:nat, a=b -> b=c -> a=c.
-Proof.
-intros.
-eapply eq_trans.
-Show Existentials.
-eassumption.
-assumption.
-\end{coq_example}
-\begin{coq_example*}
-Qed.
-\end{coq_example*}
-
-
-\Question{What can I do if I get ``Cannot solve a second-order unification problem''?}
-
-You can help {\Coq} using the {\pattern} tactic.
-
-
-\Question{I copy-paste a term and {\Coq} says it is not convertible
- to the original term. Sometimes it even says the copied term is not
-well-typed.}
-
- This is probably due to invisible implicit information (implicit
-arguments, coercions and Cases annotations) in the printed term, which
-is not re-synthesised from the copied-pasted term in the same way as
-it is in the original term.
-
- Consider for instance {\tt (@eq Type True True)}. This term is
-printed as {\tt True=True} and re-parsed as {\tt (@eq Prop True
-True)}. The two terms are not convertible (hence they fool tactics
-like {\tt pattern}).
-
- There is currently no satisfactory answer to the problem. However,
-the command {\tt Set Printing All} is useful for diagnosing the
-problem.
-
- Due to coercions, one may even face type-checking errors. In some
-rare cases, the criterion to hide coercions is a bit too loose, which
-may result in a typing error message if the parser is not able to find
-again the missing coercion.
-
-
-
-\section{Conclusion and Farewell.}
-\label{ccl}
-
-\Question{What if my question isn't answered here?}
-\label{lastquestion}
-
-Don't panic \verb+:-)+. You can try the {\Coq} manual~\cite{Coq:manual} for a technical
-description of the prover. The Coq'Art~\cite{Coq:coqart} is the first
-book written on {\Coq} and provides a comprehensive review of the
-theorem prover as well as a number of example and exercises. Finally,
-the tutorial~\cite{Coq:Tutorial} provides a smooth introduction to
-theorem proving in \Coq.
-
-
-%%%%%%%
-\newpage
-\nocite{LaTeX:intro}
-\nocite{LaTeX:symb}
-\bibliography{fk}
-
-%%%%%%%
-\typeout{*********************************************}
-\typeout{********* That makes {\thequestion} questions **********}
-\typeout{*********************************************}
-
-\end{document}
diff --git a/doc/faq/axioms.fig b/doc/faq/axioms.fig
deleted file mode 100644
index 963178503..000000000
--- a/doc/faq/axioms.fig
+++ /dev/null
@@ -1,131 +0,0 @@
-#FIG 3.2 Produced by xfig version 3.2.5c
-Landscape
-Center
-Inches
-Letter
-100.00
-Single
--2
-1200 2
-5 1 0 1 0 7 50 -1 -1 0.000 0 1 1 0 14032.500 7222.500 4725 3825 4425 4800 4200 6000
- 1 1 1.00 60.00 120.00
-5 1 0 1 0 7 50 -1 -1 0.000 0 0 0 1 3600.000 8925.000 3600 9075 3450 8925 3600 8775
- 1 1 1.00 60.00 120.00
-5 1 0 1 0 7 50 -1 -1 0.000 0 0 0 1 3600.000 8625.000 3600 8775 3450 8625 3600 8475
- 1 1 1.00 60.00 120.00
-5 1 0 1 0 7 50 -1 -1 0.000 0 0 1 1 3600.000 8325.000 3600 8475 3450 8325 3600 8175
- 1 1 1.00 60.00 120.00
- 1 1 1.00 60.00 120.00
-5 1 0 1 0 7 50 -1 -1 0.000 0 0 1 1 3600.000 8625.000 3600 8775 3450 8625 3600 8475
- 1 1 1.00 60.00 120.00
- 1 1 1.00 60.00 120.00
-5 1 0 1 0 7 50 -1 -1 0.000 0 0 1 1 3600.000 8925.000 3600 9075 3450 8925 3600 8775
- 1 1 1.00 60.00 120.00
- 1 1 1.00 60.00 120.00
-5 1 0 1 0 7 50 -1 -1 0.000 0 0 1 1 3600.000 9225.000 3600 9375 3450 9225 3600 9075
- 1 1 1.00 60.00 120.00
- 1 1 1.00 60.00 120.00
-5 1 0 1 0 7 50 -1 -1 0.000 0 1 1 0 6309.515 5767.724 4200 3825 3450 5550 3825 7200
- 1 1 1.00 60.00 120.00
-2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
- 1 1 1.00 60.00 120.00
- 7725 3900 7200 6000
-2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
- 1 1 1.00 60.00 120.00
- 7200 6225 7200 7050
-2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 1 2
- 1 1 1.00 60.00 120.00
- 1 1 1.00 60.00 120.00
- 5550 5625 5550 6000
-2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 1 2
- 1 1 1.00 60.00 120.00
- 1 1 1.00 60.00 120.00
- 3375 3225 3375 3600
-2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
- 1 1 1.00 60.00 120.00
- 3373 1950 3376 2250
-2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 1 2
- 1 1 1.00 60.00 120.00
- 1 1 1.00 60.00 120.00
- 3375 2625 3375 3000
-2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
- 2175 3600 3750 3600
-2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
- 1 1 1.00 60.00 120.00
- 3075 2475 2475 2475
-2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
- 1 1 1.00 60.00 120.00
- 3374 1125 3377 1425
-2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
- 1 1 1.00 60.00 120.00
- 3075 975 1575 975
-2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
- 1 1 1.00 60.00 120.00
- 3075 1725 2025 1725
-2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 4
- 8025 5925 8250 5925 9000 4950 9150 4950
-2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
- 1 1 1.00 60.00 120.00
- 8625 5400 8250 3900
-2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
- 1 1 1.00 60.00 120.00
- 7050 7350 4575 7950
-2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
- 1 1 1.00 60.00 120.00
- 4200 7500 4200 7950
-2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 1 2
- 1 1 1.00 60.00 120.00
- 1 1 1.00 60.00 120.00
- 1139 2771 1364 3521
-2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
- 4425 4875 7350 3825
-2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
- 1 1 1.00 60.00 120.00
- 1048 1125 1051 1425
-2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
- 1 1 1.00 60.00 120.00
- 1049 1950 1052 2250
-2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
- 1 1 1.00 60.00 120.00
- 1500 3900 2175 6000
-2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
- 4575 6000 6450 6000
-2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
- 1 1 1.00 60.00 120.00
- 4714 6255 7039 7080
-2 1 0 1 -1 7 50 -1 -1 0.000 0 0 -1 1 0 2
- 1 1 1.00 60.00 120.00
- 4200 6225 4200 7200
-3 0 0 1 0 7 50 -1 -1 0.000 0 0 0 4
- 6450 7050 4050 6675 3750 6825 3750 7050
- 0.000 1.000 1.000 0.000
-4 0 -1 50 -1 2 12 0.0000 2 135 1440 3675 6225 Excluded-middle\001
-4 0 -1 50 -1 0 12 0.0000 2 180 1065 450 1050 Operator iota\001
-4 0 -1 50 -1 0 12 0.0000 2 180 2850 3150 2400 Constructive indefinite description\001
-4 0 -1 50 -1 0 12 0.0000 2 180 1965 3150 2625 in propositional context\001
-4 0 -1 50 -1 0 12 0.0000 2 135 2235 450 2400 Constructive definite descr.\001
-4 0 -1 50 -1 0 12 0.0000 2 180 1965 450 2625 in propositional context\001
-4 0 -1 50 -1 0 12 0.0000 2 135 1995 3825 3750 Relational choice axiom\001
-4 0 -1 50 -1 0 12 0.0000 2 180 1965 6900 3750 Predicate extensionality\001
-4 0 -1 50 -1 0 12 0.0000 2 180 1710 1275 5025 (if Set impredicative)\001
-4 0 -1 50 -1 0 12 0.0000 2 165 1065 3750 5250 (Diaconescu)\001
-4 0 -1 50 -1 0 12 0.0000 2 180 2070 4950 5550 Propositional degeneracy\001
-4 0 -1 50 -1 0 12 0.0000 2 180 2310 6150 6150 Propositional extensionality\001
-4 0 -1 50 -1 0 12 0.0000 2 180 2325 4950 6525 (needs Prop-impredicativity)\001
-4 0 -1 50 -1 0 12 0.0000 2 165 720 6000 6750 (Berardi)\001
-4 0 -1 50 -1 0 12 0.0000 2 135 1725 1575 6225 Not excluded-middle\001
-4 0 -1 50 -1 0 12 0.0000 2 180 2730 3375 7425 Decidability of equality on any A\001
-4 0 -1 50 -1 0 12 0.0000 2 135 1170 3600 8175 Axiom K on A\001
-4 0 -1 50 -1 0 12 0.0000 2 180 4035 3600 8475 Uniqueness of reflexivity proofs for equality on A\001
-4 0 -1 50 -1 0 12 0.0000 2 180 2865 3600 8775 Uniqueness of equality proofs on A\001
-4 0 -1 50 -1 0 12 0.0000 2 180 5220 3600 9375 Invariance by substitution of reflexivity proofs for equality on A\001
-4 0 -1 50 -1 2 12 0.0000 2 180 2145 9000 5175 Functional extensionality\001
-4 0 -1 50 -1 2 12 0.0000 2 180 3585 3600 9075 Injectivity of equality on Sigma-types on A\001
-4 0 -1 50 -1 2 12 0.0000 2 135 1515 6450 7275 Proof-irrelevance\001
-4 0 -1 50 -1 2 12 0.0000 2 180 1440 3150 1050 Operator epsilon\001
-4 0 -1 50 -1 2 12 0.0000 2 135 1080 3150 1650 Constructive\001
-4 0 -1 50 -1 2 12 0.0000 2 180 1785 3150 1875 indefinite description\001
-4 0 -1 50 -1 2 12 0.0000 2 135 2085 3150 3150 Functional choice axiom\001
-4 0 -1 50 -1 2 12 0.0000 2 135 1080 450 1650 Constructive\001
-4 0 -1 50 -1 2 12 0.0000 2 180 1620 450 1875 definite description\001
-4 0 -1 50 -1 2 12 0.0000 2 180 1980 450 3750 Axiom of unique choice\001
diff --git a/doc/faq/fk.bib b/doc/faq/fk.bib
deleted file mode 100644
index 3410427de..000000000
--- a/doc/faq/fk.bib
+++ /dev/null
@@ -1,2221 +0,0 @@
-%%%%%%% FAQ %%%%%%%
-
-@book{ProofsTypes,
- Author="Girard, Jean-Yves and Yves Lafont and Paul Taylor",
- Title="Proofs and Types",
- Publisher="Cambrige Tracts in Theoretical Computer Science, Cambridge University Press",
- Year="1989"
-}
-
-@misc{Types:Dowek,
- author = "Gilles Dowek",
- title = "Th{\'e}orie des types",
- year = 2002,
- howpublished = "Lecture notes",
- url= "http://www.lix.polytechnique.fr/~dowek/Cours/theories_des_types.ps.gz"
-}
-
-@PHDTHESIS{EGThese,
- author = {Eduardo Giménez},
- title = {Un Calcul de Constructions Infinies et son application
-a la vérification de systèmes communicants},
- type = {thèse d'Université},
- school = {Ecole Normale Supérieure de Lyon},
- month = {December},
- year = {1996},
-}
-
-
-%%%%%%% Semantique %%%%%%%
-
-@misc{Sem:cours,
- author = "François Pottier",
- title = "{Typage et Programmation}",
- year = "2002",
- howpublished = "Lecture notes",
- note = "DEA PSPL"
-}
-
-@inproceedings{Sem:Dubois,
- author = {Catherine Dubois},
- editor = {Mark Aagaard and
- John Harrison},
- title = "{Proving ML Type Soundness Within Coq}",
- pages = {126-144},
- booktitle = {TPHOLs},
- publisher = {Springer},
- series = {Lecture Notes in Computer Science},
- volume = {1869},
- year = {2000},
- isbn = {3-540-67863-8},
- bibsource = {DBLP, http://dblp.uni-trier.de}
-}
-
-@techreport{Sem:Plotkin,
-author = {Gordon D. Plotkin},
-institution = {Aarhus University},
-number = {{DAIMI FN-19}},
-title = {{A structural approach to operational semantics}},
-year = {1981}
-}
-
-@article{Sem:RemyV98,
- author = "Didier R{\'e}my and J{\'e}r{\^o}me Vouillon",
- title = "Objective {ML}:
- An effective object-oriented extension to {ML}",
- journal = "Theory And Practice of Object Systems",
- year = 1998,
- volume = "4",
- number = "1",
- pages = "27--50",
- note = {A preliminary version appeared in the proceedings
- of the 24th ACM Conference on Principles
- of Programming Languages, 1997}
-}
-
-@book{Sem:Winskel,
- AUTHOR = {Winskel, Glynn},
- TITLE = {The Formal Semantics of Programming Languages},
- NOTE = {WIN g2 93:1 P-Ex},
- YEAR = {1993},
- PUBLISHER = {The MIT Press},
- SERIES = {Foundations of Computing},
- }
-
-@Article{Sem:WrightFelleisen,
- refkey = "C1210",
- title = "A Syntactic Approach to Type Soundness",
- author = "Andrew K. Wright and Matthias Felleisen",
- pages = "38--94",
- journal = "Information and Computation",
- month = "15~" # nov,
- year = "1994",
- volume = "115",
- number = "1"
-}
-
-@inproceedings{Sem:Nipkow-MOD,
- author={Tobias Nipkow},
- title={Jinja: Towards a Comprehensive Formal Semantics for a
- {J}ava-like Language},
- booktitle={Proc.\ Marktobderdorf Summer School 2003},
- publisher={IOS Press},editor={H. Schwichtenberg and K. Spies},
- year=2003,
- note={To appear}
-}
-
-%%%%%%% Coq %%%%%%%
-
-@book{Coq:coqart,
- title = "Interactive Theorem Proving and Program Development,
- Coq'Art: The Calculus of Inductive Constructions",
- author = "Yves Bertot and Pierre Castéran",
- publisher = "Springer Verlag",
- series = "Texts in Theoretical Computer Science. An
- EATCS series",
- year = 2004
-}
-
-@phdthesis{Coq:Del01,
- AUTHOR = "David Delahaye",
- TITLE = "Conception de langages pour décrire les preuves et les
- automatisations dans les outils d'aide à la preuve",
- SCHOOL = {Universit\'e Paris~6},
- YEAR = "2001",
- Type = {Th\`ese de Doctorat}
-}
-
-@techreport{Coq:gimenez-tut,
- author = "Eduardo Gim\'enez",
- title = "A Tutorial on Recursive Types in Coq",
- number = "RT-0221",
- pages = "42 p.",
- url = "citeseer.nj.nec.com/gimenez98tutorial.html" }
-
-@phdthesis{Coq:Mun97,
- AUTHOR = "César Mu{\~{n}}oz",
- TITLE = "Un calcul de substitutions pour la repr\'esentation
- de preuves partielles en th\'eorie de types",
- SCHOOL = {Universit\'e Paris~7},
- Number = {Unit\'e de recherche INRIA-Rocquencourt, TU-0488},
- YEAR = "1997",
- Note = {English version available as INRIA research report RR-3309},
- Type = {Th\`ese de Doctorat}
-}
-
-@PHDTHESIS{Coq:Filliatre99,
- AUTHOR = {J.-C. Filli\^atre},
- TITLE = {{Preuve de programmes imp\'eratifs en th\'eorie des types}},
- TYPE = {Th{\`e}se de Doctorat},
- SCHOOL = {Universit\'e Paris-Sud},
- YEAR = 1999,
- MONTH = {July},
-}
-
-@manual{Coq:Tutorial,
- AUTHOR = {G\'erard Huet and Gilles Kahn and Christine Paulin-Mohring},
- TITLE = {{The Coq Proof Assistant A Tutorial}},
- YEAR = 2004
-}
-
-%%%%%%% PVS %%%%%%%
-
-@manual{PVS:prover,
- title = "{PVS} Prover Guide",
- author = "N. Shankar and S. Owre and J. M. Rushby and D. W. J.
- Stringer-Calvert",
- month = sep,
- year = "1999",
- organization = "Computer Science Laboratory, SRI International",
- address = "Menlo Park, CA",
-}
-
-@techreport{PVS-Semantics:TR,
- TITLE = {The Formal Semantics of {PVS}},
- AUTHOR = {Sam Owre and Natarajan Shankar},
- NUMBER = {CR-1999-209321},
- INSTITUTION = {Computer Science Laboratory, SRI International},
- ADDRESS = {Menlo Park, CA},
- MONTH = may,
- YEAR = 1999,
-}
-
-@techreport{PVS-Tactics:DiVito,
- TITLE = {A {PVS} Prover Strategy Package for Common Manipulations},
- AUTHOR = {Ben L. Di Vito},
- NUMBER = {TM-2002-211647},
- INSTITUTION = {Langley Research Center},
- ADDRESS = {Hampton, VA},
- MONTH = apr,
- YEAR = 2002,
-}
-
-@misc{PVS-Tactics:cours,
- author = "César Muñoz",
- title = "Strategies in {PVS}",
- howpublished = "Lecture notes",
- note = "National Institute of Aerospace",
- year = 2002
-}
-
-@techreport{PVS-Tactics:field,
- author = "C. Mu{\~n}oz and M. Mayero",
- title = "Real Automation in the Field",
- institution = "ICASE-NASA Langley",
- number = "NASA/CR-2001-211271 Interim ICASE Report No. 39",
- month = "dec",
- year = "2001"
-}
-
-%%%%%%% Autres Prouveurs %%%%%%%
-
-@misc{ACL2:repNuPrl,
- author = "James L. Caldwell and John Cowles",
- title = "{Representing Nuprl Proof Objects in ACL2: toward a proof checker for Nuprl}",
- url = "http://www.cs.uwyo.edu/~jlc/papers/proof_checking.ps" }
-
-@inproceedings{Elan:ckl-strat,
- author = {H. Cirstea and C. Kirchner and L. Liquori},
- title = "{Rewrite Strategies in the Rewriting Calculus}",
- booktitle = {WRLA'02},
- publisher = "{Elsevier Science B.V.}",
- series = {Electronic Notes in Theoretical Computer Science},
- volume = {71},
- year = {2003},
-}
-
-@book{LCF:GMW,
- author = {M. Gordon and R. Milner and C. Wadsworth},
- publisher = {sv},
- series = {lncs},
- volume = 78,
- title = {Edinburgh {LCF}: A Mechanized Logic of Computation},
- year = 1979
-}
-
-%%%%%%% LaTeX %%%%%%%
-
-@manual{LaTeX:symb,
- title = "The Great, Big List of \LaTeX\ Symbols",
- author = "David Carlisle and Scott Pakin and Alexander Holt",
- month = feb,
- year = 2001,
-}
-
-@manual{LaTeX:intro,
- title = "The Not So Short Introduction to \LaTeX2e",
- author = "Tobias Oetiker",
- month = jan,
- year = 1999,
-}
-
-@MANUAL{CoqManualV7,
- AUTHOR = {{The {Coq} Development Team}},
- TITLE = {{The Coq Proof Assistant Reference Manual -- Version
- V7.1}},
- YEAR = {2001},
- MONTH = OCT,
- NOTE = {http://coq.inria.fr}
-}
-
-@MANUAL{CoqManual96,
- TITLE = {The {Coq Proof Assistant Reference Manual} Version 6.1},
- AUTHOR = {B. Barras and S. Boutin and C. Cornes and J. Courant and
- J.-C. Filli\^atre and
- H. Herbelin and G. Huet and P. Manoury and C. Mu{\~{n}}oz and
- C. Murthy and C. Parent and C. Paulin-Mohring and
- A. Sa{\"\i}bi and B. Werner},
- ORGANIZATION = {{INRIA-Rocquencourt}-{CNRS-ENS Lyon}},
- URL = {ftp://ftp.inria.fr/INRIA/coq/V6.1/doc/Reference-Manual.dvi.gz},
- YEAR = 1996,
- MONTH = DEC
-}
-
-@MANUAL{CoqTutorial99,
- AUTHOR = {G.~Huet and G.~Kahn and Ch.~Paulin-Mohring},
- TITLE = {The {\sf Coq} Proof Assistant - A tutorial - Version 6.3},
- MONTH = JUL,
- YEAR = {1999},
- ABSTRACT = {http://coq.inria.fr/doc/tutorial.html}
-}
-
-@MANUAL{CoqTutorialV7,
- AUTHOR = {G.~Huet and G.~Kahn and Ch.~Paulin-Mohring},
- TITLE = {The {\sf Coq} Proof Assistant - A tutorial - Version 7.1},
- MONTH = OCT,
- YEAR = {2001},
- NOTE = {http://coq.inria.fr}
-}
-
-@TECHREPORT{modelpa2000,
- AUTHOR = {B. Bérard and P. Castéran and E. Fleury and L. Fribourg
- and J.-F. Monin and C. Paulin and A. Petit and D. Rouillard},
- TITLE = {Automates temporisés CALIFE},
- INSTITUTION = {Calife},
- YEAR = 2000,
- URL = {http://www.loria.fr/projets/calife/WebCalifePublic/FOURNITURES/F1.1.ps.gz},
- TYPE = {Fourniture {F1.1}}
-}
-
-@TECHREPORT{CaFrPaRo2000,
- AUTHOR = {P. Castéran and E. Freund and C. Paulin and D. Rouillard},
- TITLE = {Bibliothèques Coq et Isabelle-HOL pour les systèmes de transitions et les p-automates},
- INSTITUTION = {Calife},
- YEAR = 2000,
- URL = {http://www.loria.fr/projets/calife/WebCalifePublic/FOURNITURES/F5.4.ps.gz},
- TYPE = {Fourniture {F5.4}}
-}
-
-@PROCEEDINGS{TPHOLs99,
- TITLE = {International Conference on
- Theorem Proving in Higher Order Logics (TPHOLs'99)},
- YEAR = 1999,
- EDITOR = {Y. Bertot and G. Dowek and C. Paulin-Mohring and L. Th{\'e}ry},
- SERIES = {Lecture Notes in Computer Science},
- MONTH = SEP,
- PUBLISHER = {{Sprin\-ger-Verlag}},
- ADDRESS = {Nice},
- TYPE_PUBLI = {editeur}
-}
-
-@INPROCEEDINGS{Pau01,
- AUTHOR = {Christine Paulin-Mohring},
- TITLE = {Modelisation of Timed Automata in {Coq}},
- BOOKTITLE = {Theoretical Aspects of Computer Software (TACS'2001)},
- PAGES = {298--315},
- YEAR = 2001,
- EDITOR = {N. Kobayashi and B. Pierce},
- VOLUME = 2215,
- SERIES = {Lecture Notes in Computer Science},
- PUBLISHER = {Springer-Verlag}
-}
-
-@PHDTHESIS{Moh89b,
- AUTHOR = {C. Paulin-Mohring},
- MONTH = JAN,
- SCHOOL = {{Paris 7}},
- TITLE = {Extraction de programmes dans le {Calcul des Constructions}},
- TYPE = {Thèse d'université},
- YEAR = {1989},
- URL = {http://www.lri.fr/~paulin/these.ps.gz}
-}
-
-@ARTICLE{HuMo92,
- AUTHOR = {G. Huet and C. Paulin-Mohring},
- EDITION = {INRIA},
- JOURNAL = {Courrier du CNRS - Informatique},
- TITLE = {Preuves et Construction de Programmes},
- YEAR = {1992},
- CATEGORY = {national}
-}
-
-@INPROCEEDINGS{LePa94,
- AUTHOR = {F. Leclerc and C. Paulin-Mohring},
- TITLE = {Programming with Streams in {Coq}. A case study : The Sieve of Eratosthenes},
- EDITOR = {H. Barendregt and T. Nipkow},
- VOLUME = 806,
- SERIES = {Lecture Notes in Computer Science},
- BOOKTITLE = {{Types for Proofs and Programs, Types' 93}},
- YEAR = 1994,
- PUBLISHER = {Springer-Verlag}
-}
-
-@INPROCEEDINGS{Moh86,
- AUTHOR = {C. Mohring},
- ADDRESS = {Cambridge, MA},
- BOOKTITLE = {Symposium on Logic in Computer Science},
- PUBLISHER = {IEEE Computer Society Press},
- TITLE = {Algorithm Development in the {Calculus of Constructions}},
- YEAR = {1986}
-}
-
-@INPROCEEDINGS{Moh89a,
- AUTHOR = {C. Paulin-Mohring},
- ADDRESS = {Austin},
- BOOKTITLE = {Sixteenth Annual ACM Symposium on Principles of Programming Languages},
- MONTH = JAN,
- PUBLISHER = {ACM},
- TITLE = {Extracting ${F}_{\omega}$'s programs from proofs in the {Calculus of Constructions}},
- YEAR = {1989}
-}
-
-@INCOLLECTION{Moh89c,
- AUTHOR = {C. Paulin-Mohring},
- TITLE = {{R\'ealisabilit\'e et extraction de programmes}},
- BOOKTITLE = {Logique et Informatique : une introduction},
- PUBLISHER = {INRIA},
- YEAR = 1991,
- EDITOR = {B. Courcelle},
- VOLUME = 8,
- SERIES = {Collection Didactique},
- PAGES = {163-180},
- CATEGORY = {national}
-}
-
-@INPROCEEDINGS{Moh93,
- AUTHOR = {C. Paulin-Mohring},
- BOOKTITLE = {Proceedings of the conference Typed Lambda Calculi a
-nd Applications},
- EDITOR = {M. Bezem and J.-F. Groote},
- INSTITUTION = {LIP-ENS Lyon},
- NOTE = {LIP research report 92-49},
- NUMBER = 664,
- SERIES = {Lecture Notes in Computer Science},
- TITLE = {{Inductive Definitions in the System {Coq} - Rules and Properties}},
- TYPE = {research report},
- YEAR = 1993
-}
-
-@ARTICLE{PaWe92,
- AUTHOR = {C. Paulin-Mohring and B. Werner},
- JOURNAL = {Journal of Symbolic Computation},
- TITLE = {{Synthesis of ML programs in the system Coq}},
- VOLUME = {15},
- YEAR = {1993},
- PAGES = {607--640}
-}
-
-@INPROCEEDINGS{Pau96,
- AUTHOR = {C. Paulin-Mohring},
- TITLE = {Circuits as streams in {Coq} : Verification of a sequential multiplier},
- BOOKTITLE = {Types for Proofs and Programs, TYPES'95},
- EDITOR = {S. Berardi and M. Coppo},
- SERIES = {Lecture Notes in Computer Science},
- YEAR = 1996,
- VOLUME = 1158
-}
-
-@PHDTHESIS{Pau96b,
- AUTHOR = {Christine Paulin-Mohring},
- TITLE = {Définitions Inductives en Théorie des Types d'Ordre Supérieur},
- SCHOOL = {Université Claude Bernard Lyon I},
- YEAR = 1996,
- MONTH = DEC,
- TYPE = {Habilitation à diriger les recherches},
- URL = {http://www.lri.fr/~paulin/habilitation.ps.gz}
-}
-
-@INPROCEEDINGS{PfPa89,
- AUTHOR = {F. Pfenning and C. Paulin-Mohring},
- BOOKTITLE = {Proceedings of Mathematical Foundations of Programming Semantics},
- NOTE = {technical report CMU-CS-89-209},
- PUBLISHER = {Springer-Verlag},
- SERIES = {Lecture Notes in Computer Science},
- VOLUME = 442,
- TITLE = {Inductively defined types in the {Calculus of Constructions}},
- YEAR = {1990}
-}
-
-@MISC{krakatoa02,
- AUTHOR = {Claude March\'e and Christine Paulin and Xavier Urbain},
- TITLE = {The \textsc{Krakatoa} proof tool},
- YEAR = 2002,
- NOTE = {\url{http://krakatoa.lri.fr/}}
-}
-
-@ARTICLE{marche03jlap,
- AUTHOR = {Claude March{\'e} and Christine Paulin-Mohring and Xavier Urbain},
- TITLE = {The \textsc{Krakatoa} Tool for Certification of \textsc{Java/JavaCard} Programs annotated in \textsc{JML}},
- JOURNAL = {Journal of Logic and Algebraic Programming},
- YEAR = 2003,
- NOTE = {To appear},
- URL = {http://krakatoa.lri.fr},
- TOPICS = {team}
-}
-@ARTICLE{marche04jlap,
- AUTHOR = {Claude March{\'e} and Christine Paulin-Mohring and Xavier Urbain},
- TITLE = {The \textsc{Krakatoa} Tool for Certification of \textsc{Java/JavaCard} Programs annotated in \textsc{JML}},
- JOURNAL = {Journal of Logic and Algebraic Programming},
- YEAR = 2004,
- VOLUME = 58,
- NUMBER = {1--2},
- PAGES = {89--106},
- URL = {http://krakatoa.lri.fr},
- TOPICS = {team}
-}
-
-@TECHREPORT{catano03deliv,
- AUTHOR = {N{\'e}stor Cata{\~n}o and Marek Gawkowski and
-Marieke Huisman and Bart Jacobs and Claude March{\'e} and Christine Paulin
-and Erik Poll and Nicole Rauch and Xavier Urbain},
- TITLE = {Logical Techniques for Applet Verification},
- INSTITUTION = {VerifiCard Project},
- YEAR = 2003,
- TYPE = {Deliverable},
- NUMBER = {5.2},
- TOPICS = {team},
- NOTE = {Available from \url{http://www.verificard.org}}
-}
-
-@TECHREPORT{kmu2002rr,
- AUTHOR = {Keiichirou Kusakari and Claude Marché and Xavier Urbain},
- TITLE = {Termination of Associative-Commutative Rewriting using Dependency Pairs Criteria},
- INSTITUTION = {LRI},
- YEAR = 2002,
- TYPE = {Research Report},
- NUMBER = 1304,
- TYPE_PUBLI = {interne},
- TOPICS = {team},
- NOTE = {\url{http://www.lri.fr/~urbain/textes/rr1304.ps.gz}},
- URL = {http://www.lri.fr/~urbain/textes/rr1304.ps.gz}
-}
-
-@ARTICLE{marche2004jsc,
- AUTHOR = {Claude March\'e and Xavier Urbain},
- TITLE = {Modular {\&} Incremental Proofs of {AC}-Termination},
- JOURNAL = {Journal of Symbolic Computation},
- YEAR = 2004,
- TOPICS = {team}
-}
-
-@INPROCEEDINGS{contejean03wst,
- AUTHOR = {Evelyne Contejean and Claude Marché and Benjamin Monate and Xavier Urbain},
- TITLE = {{Proving Termination of Rewriting with {\sc C\textit{i}ME}}},
- CROSSREF = {wst03},
- PAGES = {71--73},
- NOTE = {\url{http://cime.lri.fr/}},
- URL = {http://cime.lri.fr/},
- YEAR = 2003,
- TYPE_PUBLI = {icolcomlec},
- TOPICS = {team}
-}
-
-@TECHREPORT{contejean04rr,
- AUTHOR = {Evelyne Contejean and Claude March{\'e} and Ana-Paula Tom{\'a}s and Xavier Urbain},
- TITLE = {Mechanically proving termination using polynomial interpretations},
- INSTITUTION = {LRI},
- YEAR = {2004},
- TYPE = {Research Report},
- NUMBER = {1382},
- TYPE_PUBLI = {interne},
- TOPICS = {team},
- URL = {http://www.lri.fr/~urbain/textes/rr1382.ps.gz}
-}
-
-@UNPUBLISHED{duran_sub,
- AUTHOR = {Francisco Duran and Salvador Lucas and
- Claude {March\'e} and {Jos\'e} Meseguer and Xavier Urbain},
- TITLE = {Termination of Membership Equational Programs},
- NOTE = {Submitted}
-}
-
-@PROCEEDINGS{comon95lncs,
- TITLE = {Term Rewriting},
- BOOKTITLE = {Term Rewriting},
- TOPICS = {team, cclserver},
- YEAR = 1995,
- EDITOR = {Hubert Comon and Jean-Pierre Jouannaud},
- SERIES = {Lecture Notes in Computer Science},
- VOLUME = {909},
- PUBLISHER = {{Sprin\-ger-Verlag}},
- ORGANIZATION = {French Spring School of Theoretical Computer
- Science},
- TYPE_PUBLI = {editeur},
- CLEF_LABO = {CJ95}
-}
-
-@PROCEEDINGS{lics94,
- TITLE = {Proceedings of the Ninth Annual IEEE Symposium on Logic
- in Computer Science},
- BOOKTITLE = {Proceedings of the Ninth Annual IEEE Symposium on Logic
- in Computer Science},
- YEAR = 1994,
- MONTH = JUL,
- ADDRESS = {Paris, France},
- ORGANIZATION = {{IEEE} Comp. Soc. Press}
-}
-
-@PROCEEDINGS{rta91,
- TITLE = {4th International Conference on Rewriting Techniques and
- Applications},
- BOOKTITLE = {4th International Conference on Rewriting Techniques and
- Applications},
- EDITOR = {Ronald. V. Book},
- YEAR = 1991,
- MONTH = APR,
- ADDRESS = {Como, Italy},
- PUBLISHER = {{Sprin\-ger-Verlag}},
- SERIES = {Lecture Notes in Computer Science},
- VOLUME = 488
-}
-
-@PROCEEDINGS{rta96,
- TITLE = {7th International Conference on Rewriting Techniques and
- Applications},
- BOOKTITLE = {7th International Conference on Rewriting Techniques and
- Applications},
- EDITOR = {Harald Ganzinger},
- PUBLISHER = {{Sprin\-ger-Verlag}},
- YEAR = 1996,
- MONTH = JUL,
- ADDRESS = {New Brunswick, NJ, USA},
- SERIES = {Lecture Notes in Computer Science},
- VOLUME = 1103
-}
-
-@PROCEEDINGS{rta97,
- TITLE = {8th International Conference on Rewriting Techniques and
- Applications},
- BOOKTITLE = {8th International Conference on Rewriting Techniques and
- Applications},
- EDITOR = {Hubert Comon},
- PUBLISHER = {{Sprin\-ger-Verlag}},
- YEAR = 1997,
- MONTH = JUN,
- ADDRESS = {Barcelona, Spain},
- SERIES = {Lecture Notes in Computer Science},
- VOLUME = {1232}
-}
-
-@PROCEEDINGS{rta98,
- TITLE = {9th International Conference on Rewriting Techniques and
- Applications},
- BOOKTITLE = {9th International Conference on Rewriting Techniques and
- Applications},
- EDITOR = {Tobias Nipkow},
- PUBLISHER = {{Sprin\-ger-Verlag}},
- YEAR = 1998,
- MONTH = APR,
- ADDRESS = {Tsukuba, Japan},
- SERIES = {Lecture Notes in Computer Science},
- VOLUME = {1379}
-}
-
-@PROCEEDINGS{rta00,
- TITLE = {11th International Conference on Rewriting Techniques and Applications},
- BOOKTITLE = {11th International Conference on Rewriting Techniques and Applications},
- EDITOR = {Leo Bachmair},
- PUBLISHER = {{Sprin\-ger-Verlag}},
- SERIES = {Lecture Notes in Computer Science},
- VOLUME = 1833,
- MONTH = JUL,
- YEAR = 2000,
- ADDRESS = {Norwich, UK}
-}
-
-@PROCEEDINGS{srt95,
- TITLE = {Proceedings of the Conference on Symbolic Rewriting
- Techniques},
- BOOKTITLE = {Proceedings of the Conference on Symbolic Rewriting
- Techniques},
- YEAR = 1995,
- EDITOR = {Manuel Bronstein and Volker Weispfenning},
- ADDRESS = {Monte Verita, Switzerland}
-}
-
-@BOOK{comon01cclbook,
- BOOKTITLE = {Constraints in Computational Logics},
- TITLE = {Constraints in Computational Logics},
- EDITOR = {Hubert Comon and Claude March{\'e} and Ralf Treinen},
- YEAR = 2001,
- PUBLISHER = {{Sprin\-ger-Verlag}},
- SERIES = {Lecture Notes in Computer Science},
- VOLUME = 2002,
- TOPICS = {team},
- TYPE_PUBLI = {editeur}
-}
-
-@PROCEEDINGS{wst03,
- BOOKTITLE = {{Extended Abstracts of the 6th International Workshop on Termination, WST'03}},
- TITLE = {{Extended Abstracts of the 6th International Workshop on Termination, WST'03}},
- YEAR = {2003},
- EDITOR = {Albert Rubio},
- MONTH = JUN,
- NOTE = {Technical Report DSIC II/15/03, Universidad Politécnica de Valencia, Spain}
-}
-
-@INPROCEEDINGS{FilliatreLetouzey03,
- AUTHOR = {J.-C. Filli\^atre and P. Letouzey},
- TITLE = {{Functors for Proofs and Programs}},
- BOOKTITLE = {Proceedings of The European Symposium on Programming},
- YEAR = 2004,
- ADDRESS = {Barcelona, Spain},
- MONTH = {March 29-April 2},
- NOTE = {To appear},
- URL = {http://www.lri.fr/~filliatr/ftp/publis/fpp.ps.gz}
-}
-
-@TECHREPORT{Filliatre03,
- AUTHOR = {J.-C. Filli\^atre},
- TITLE = {{Why: a multi-language multi-prover verification tool}},
- INSTITUTION = {{LRI, Universit\'e Paris Sud}},
- TYPE = {{Research Report}},
- NUMBER = {1366},
- MONTH = {March},
- YEAR = 2003,
- URL = {http://www.lri.fr/~filliatr/ftp/publis/why-tool.ps.gz}
-}
-
-@ARTICLE{FilliatrePottier02,
- AUTHOR = {J.-C. Filli{\^a}tre and F. Pottier},
- TITLE = {{Producing All Ideals of a Forest, Functionally}},
- JOURNAL = {Journal of Functional Programming},
- VOLUME = 13,
- NUMBER = 5,
- PAGES = {945--956},
- MONTH = {September},
- YEAR = 2003,
- URL = {http://www.lri.fr/~filliatr/ftp/publis/kr-fp.ps.gz},
- ABSTRACT = {
- We present a functional implementation of Koda and Ruskey's
- algorithm for generating all ideals of a forest poset as a Gray
- code. Using a continuation-based approach, we give an extremely
- concise formulation of the algorithm's core. Then, in a number of
- steps, we derive a first-order version whose efficiency is
- comparable to a C implementation given by Knuth.}
-}
-
-@UNPUBLISHED{FORS01,
- AUTHOR = {J.-C. Filli{\^a}tre and S. Owre and H. Rue{\ss} and N. Shankar},
- TITLE = {Deciding Propositional Combinations of Equalities and Inequalities},
- NOTE = {Unpublished},
- MONTH = OCT,
- YEAR = 2001,
- URL = {http://www.lri.fr/~filliatr/ftp/publis/ics.ps},
- ABSTRACT = {
- We address the problem of combining individual decision procedures
- into a single decision procedure. Our combination approach is based
- on using the canonizer obtained from Shostak's combination algorithm
- for equality. We illustrate our approach with a combination
- algorithm for equality, disequality, arithmetic inequality, and
- propositional logic. Unlike the Nelson--Oppen combination where the
- processing of equalities is distributed across different closed
- decision procedures, our combination involves the centralized
- processing of equalities in a single procedure. The termination
- argument for the combination is based on that for Shostak's
- algorithm. We also give soundness and completeness arguments.}
-}
-
-@INPROCEEDINGS{ICS,
- AUTHOR = {J.-C. Filli{\^a}tre and S. Owre and H. Rue{\ss} and N. Shankar},
- TITLE = {{ICS: Integrated Canonization and Solving (Tool presentation)}},
- BOOKTITLE = {Proceedings of CAV'2001},
- EDITOR = {G. Berry and H. Comon and A. Finkel},
- PUBLISHER = {Springer-Verlag},
- SERIES = {Lecture Notes in Computer Science},
- VOLUME = 2102,
- PAGES = {246--249},
- YEAR = 2001
-}
-
-@INPROCEEDINGS{Filliatre01a,
- AUTHOR = {J.-C. Filli\^atre},
- TITLE = {La supériorité de l'ordre supérieur},
- BOOKTITLE = {Journées Francophones des Langages Applicatifs},
- PAGES = {15--26},
- MONTH = {Janvier},
- YEAR = 2002,
- ADDRESS = {Anglet, France},
- URL = {http://www.lri.fr/~filliatr/ftp/publis/sos.ps.gz},
- CODE = {http://www.lri.fr/~filliatr/ftp/ocaml/misc/koda-ruskey.ps},
- ABSTRACT = {
- Nous présentons ici une écriture fonctionnelle de l'algorithme de
- Koda-Ruskey, un algorithme pour engendrer une large famille
- de codes de Gray. En s'inspirant de techniques de programmation par
- continuation, nous aboutissons à un code de neuf lignes seulement,
- bien plus élégant que les implantations purement impératives
- proposées jusqu'ici, notamment par Knuth. Dans un second temps,
- nous montrons comment notre code peut être légèrement modifié pour
- aboutir à une version de complexité optimale.
- Notre implantation en Objective Caml rivalise d'efficacité avec les
- meilleurs codes C. Nous détaillons les calculs de complexité,
- un exercice intéressant en présence d'ordre supérieur et d'effets de
- bord combinés.}
-}
-
-@TECHREPORT{Filliatre00c,
- AUTHOR = {J.-C. Filli\^atre},
- TITLE = {{Design of a proof assistant: Coq version 7}},
- INSTITUTION = {{LRI, Universit\'e Paris Sud}},
- TYPE = {{Research Report}},
- NUMBER = {1369},
- MONTH = {October},
- YEAR = 2000,
- URL = {http://www.lri.fr/~filliatr/ftp/publis/coqv7.ps.gz},
- ABSTRACT = {
- We present the design and implementation of the new version of the
- Coq proof assistant. The main novelty is the isolation of the
- critical part of the system, which consists in a type checker for
- the Calculus of Inductive Constructions. This kernel is now
- completely independent of the rest of the system and has been
- rewritten in a purely functional way. This leads to greater clarity
- and safety, without compromising efficiency. It also opens the way to
- the ``bootstrap'' of the Coq system, where the kernel will be
- certified using Coq itself.}
-}
-
-@TECHREPORT{Filliatre00b,
- AUTHOR = {J.-C. Filli\^atre},
- TITLE = {{Hash consing in an ML framework}},
- INSTITUTION = {{LRI, Universit\'e Paris Sud}},
- TYPE = {{Research Report}},
- NUMBER = {1368},
- MONTH = {September},
- YEAR = 2000,
- URL = {http://www.lri.fr/~filliatr/ftp/publis/hash-consing.ps.gz},
- ABSTRACT = {
- Hash consing is a technique to share values that are structurally
- equal. Beyond the obvious advantage of saving memory blocks, hash
- consing may also be used to gain speed in several operations (like
- equality test) and data structures (like sets or maps) when sharing is
- maximal. However, physical adresses cannot be used directly for this
- purpose when the garbage collector is likely to move blocks
- underneath. We present an easy solution in such a framework, with
- many practical benefits.}
-}
-
-@MISC{ocamlweb,
- AUTHOR = {J.-C. Filli\^atre and C. March\'e},
- TITLE = {{ocamlweb, a literate programming tool for Objective Caml}},
- NOTE = {Available at \url{http://www.lri.fr/~filliatr/ocamlweb/}},
- URL = {http://www.lri.fr/~filliatr/ocamlweb/}
-}
-
-@ARTICLE{Filliatre00a,
- AUTHOR = {J.-C. Filli\^atre},
- TITLE = {{Verification of Non-Functional Programs
- using Interpretations in Type Theory}},
- JOURNAL = {Journal of Functional Programming},
- VOLUME = 13,
- NUMBER = 4,
- PAGES = {709--745},
- MONTH = {July},
- YEAR = 2003,
- NOTE = {English translation of~\cite{Filliatre99}.},
- URL = {http://www.lri.fr/~filliatr/ftp/publis/jphd.ps.gz},
- ABSTRACT = {We study the problem of certifying programs combining imperative and
- functional features within the general framework of type theory.
-
- Type theory constitutes a powerful specification language, which is
- naturally suited for the proof of purely functional programs. To
- deal with imperative programs, we propose a logical interpretation
- of an annotated program as a partial proof of its specification. The
- construction of the corresponding partial proof term is based on a
- static analysis of the effects of the program, and on the use of
- monads. The usual notion of monads is refined in order to account
- for the notion of effect. The missing subterms in the partial proof
- term are seen as proof obligations, whose actual proofs are left to
- the user. We show that the validity of those proof obligations
- implies the total correctness of the program.
- We also establish a result of partial completeness.
-
- This work has been implemented in the Coq proof assistant.
- It appears as a tactic taking an annotated program as argument and
- generating a set of proof obligations. Several nontrivial
- algorithms have been certified using this tactic.}
-}
-
-@ARTICLE{Filliatre99c,
- AUTHOR = {J.-C. Filli\^atre},
- TITLE = {{Formal Proof of a Program: Find}},
- JOURNAL = {Science of Computer Programming},
- YEAR = 2001,
- NOTE = {To appear},
- URL = {http://www.lri.fr/~filliatr/ftp/publis/find.ps.gz},
- ABSTRACT = {In 1971, C.~A.~R.~Hoare gave the proof of correctness and termination of a
- rather complex algorithm, in a paper entitled \emph{Proof of a
- program: Find}. It is a hand-made proof, where the
- program is given together with its formal specification and where
- each step is fully
- justified by a mathematical reasoning. We present here a formal
- proof of the same program in the system Coq, using the
- recent tactic of the system developed to establishing the total
- correctness of
- imperative programs. We follow Hoare's paper as close as
- possible, keeping the same program and the same specification. We
- show that we get exactly the same proof obligations, which are
- proved in a straightforward way, following the original paper.
- We also explain how more informal reasonings of Hoare's proof are
- formalized in the system Coq.
- This demonstrates the adequacy of the system Coq in the
- process of certifying imperative programs.}
-}
-
-@TECHREPORT{Filliatre99b,
- AUTHOR = {J.-C. Filli\^atre},
- TITLE = {{A theory of monads parameterized by effects}},
- INSTITUTION = {{LRI, Universit\'e Paris Sud}},
- TYPE = {{Research Report}},
- NUMBER = {1367},
- MONTH = {November},
- YEAR = 1999,
- URL = {http://www.lri.fr/~filliatr/ftp/publis/monads.ps.gz},
- ABSTRACT = {Monads were introduced in computer science to express the semantics
- of programs with computational effects, while type and effect
- inference was introduced to mark out those effects.
- In this article, we propose a combination of the notions of effects
- and monads, where the monadic operators are parameterized by effects.
- We establish some relationships between those generalized monads and
- the classical ones.
- Then we use a generalized monad to translate imperative programs
- into purely functional ones. We establish the correctness of that
- translation. This work has been put into practice in the Coq proof
- assistant to establish the correctness of imperative programs.}
-}
-
-@PHDTHESIS{Filliatre99,
- AUTHOR = {J.-C. Filli\^atre},
- TITLE = {{Preuve de programmes imp\'eratifs en th\'eorie des types}},
- TYPE = {Th{\`e}se de Doctorat},
- SCHOOL = {Universit\'e Paris-Sud},
- YEAR = 1999,
- MONTH = {July},
- URL = {http://www.lri.fr/~filliatr/ftp/publis/these.ps.gz},
- ABSTRACT = {Nous étudions le problème de la certification de programmes mêlant
- traits impératifs et fonctionnels dans le cadre de la théorie des
- types.
-
- La théorie des types constitue un puissant langage de spécification,
- naturellement adapté à la preuve de programmes purement
- fonctionnels. Pour y certifier également des programmes impératifs,
- nous commençons par exprimer leur sémantique de manière purement
- fonctionnelle. Cette traduction repose sur une analyse statique des
- effets de bord des programmes, et sur l'utilisation de la notion de
- monade, notion que nous raffinons en l'associant à la notion d'effet
- de manière générale. Nous montrons que cette traduction est
- sémantiquement correcte.
-
- Puis, à partir d'un programme annoté, nous construisons une preuve
- de sa spécification, traduite de manière fonctionnelle. Cette preuve
- est bâtie sur la traduction fonctionnelle précédemment
- introduite. Elle est presque toujours incomplète, les parties
- manquantes étant autant d'obligations de preuve qui seront laissées
- à la charge de l'utilisateur. Nous montrons que la validité de ces
- obligations entraîne la correction totale du programme.
-
- Nous avons implanté notre travail dans l'assistant de preuve
- Coq, avec lequel il est dès à présent distribué. Cette
- implantation se présente sous la forme d'une tactique prenant en
- argument un programme annoté et engendrant les obligations de
- preuve. Plusieurs algorithmes non triviaux ont été certifiés à
- l'aide de cet outil (Find, Quicksort, Heapsort, algorithme de
- Knuth-Morris-Pratt).}
-}
-
-@INPROCEEDINGS{FilliatreMagaud99,
- AUTHOR = {J.-C. Filli\^atre and N. Magaud},
- TITLE = {{Certification of sorting algorithms in the system Coq}},
- BOOKTITLE = {Theorem Proving in Higher Order Logics:
- Emerging Trends},
- YEAR = 1999,
- ABSTRACT = {We present the formal proofs of total correctness of three sorting
- algorithms in the system Coq, namely \textit{insertion sort},
- \textit{quicksort} and \textit{heapsort}. The implementations are
- imperative programs working in-place on a given array. Those
- developments demonstrate the usefulness of inductive types and higher-order
- logic in the process of software certification. They also
- show that the proof of rather complex algorithms may be done in a
- small amount of time --- only a few days for each development ---
- and without great difficulty.},
- URL = {http://www.lri.fr/~filliatr/ftp/publis/Filliatre-Magaud.ps.gz}
-}
-
-@INPROCEEDINGS{Filliatre98,
- AUTHOR = {J.-C. Filli\^atre},
- TITLE = {{Proof of Imperative Programs in Type Theory}},
- BOOKTITLE = {International Workshop, TYPES '98, Kloster Irsee, Germany},
- PUBLISHER = {Springer-Verlag},
- VOLUME = 1657,
- SERIES = {Lecture Notes in Computer Science},
- MONTH = MAR,
- YEAR = {1998},
- ABSTRACT = {We present a new approach to certifying imperative programs,
- in the context of Type Theory.
- The key is a functional translation of imperative programs, which is
- made possible by an analysis of their effects.
- On sequential imperative programs, we get the same proof
- obligations as those given by Floyd-Hoare logic,
- but our approach also includes functional constructions.
- As a side-effect, we propose a way to eradicate the use of auxiliary
- variables in specifications.
- This work has been implemented in the Coq Proof Assistant and applied
- on non-trivial examples.},
- URL = {http://www.lri.fr/~filliatr/ftp/publis/types98.ps.gz}
-}
-
-@TECHREPORT{Filliatre97,
- AUTHOR = {J.-C. Filli\^atre},
- INSTITUTION = {LIP - ENS Lyon},
- NUMBER = {97--04},
- TITLE = {{Finite Automata Theory in Coq:
- A constructive proof of Kleene's theorem}},
- TYPE = {Research Report},
- MONTH = {February},
- YEAR = {1997},
- ABSTRACT = {We describe here a development in the system Coq
- of a piece of Finite Automata Theory. The main result is the Kleene's
- theorem, expressing that regular expressions and finite automata
- define the same languages. From a constructive proof of this result,
- we automatically obtain a functional program that compiles any
- regular expression into a finite automata, which constitutes the main
- part of the implementation of {\tt grep}-like programs. This
- functional program is obtained by the automatic method of {\em
- extraction} which removes the logical parts of the proof to keep only
- its informative contents. Starting with an idea of what we would
- have written in ML, we write the specification and do the proofs in
- such a way that we obtain the expected program, which is therefore
- efficient.},
- URL = {ftp://ftp.ens-lyon.fr/pub/LIP/Rapports/RR/RR97/RR97-04.ps.Z}
-}
-
-@TECHREPORT{Filliatre95,
- AUTHOR = {J.-C. Filli\^atre},
- INSTITUTION = {LIP - ENS Lyon},
- NUMBER = {96--25},
- TITLE = {{A decision procedure for Direct Predicate
- Calculus: study and implementation in
- the Coq system}},
- TYPE = {Research Report},
- MONTH = {February},
- YEAR = {1995},
- ABSTRACT = {The paper of J. Ketonen and R. Weyhrauch \emph{A
- decidable fragment of Predicate Calculus} defines a decidable
- fragment of first-order predicate logic - Direct Predicate Calculus
- - as the subset which is provable in Gentzen sequent calculus
- without the contraction rule, and gives an effective decision
- procedure for it. This report is a detailed study of this
- procedure. We extend the decidability to non-prenex formulas. We
- prove that the intuitionnistic fragment is still decidable, with a
- refinement of the same procedure. An intuitionnistic version has
- been implemented in the Coq system using a translation into
- natural deduction.},
- URL = {ftp://ftp.ens-lyon.fr/pub/LIP/Rapports/RR/RR96/RR96-25.ps.Z}
-}
-
-@TECHREPORT{Filliatre94,
- AUTHOR = {J.-C. Filli\^atre},
- MONTH = {Juillet},
- INSTITUTION = {Ecole Normale Sup\'erieure},
- TITLE = {{Une proc\'edure de d\'ecision pour le Calcul des Pr\'edicats Direct~: \'etude et impl\'ementation dans le syst\`eme Coq}},
- TYPE = {Rapport de {DEA}},
- YEAR = {1994},
- URL = {ftp://ftp.lri.fr/LRI/articles/filliatr/memoire.dvi.gz}
-}
-
-@TECHREPORT{CourantFilliatre93,
- AUTHOR = {J. Courant et J.-C. Filli\^atre},
- MONTH = {Septembre},
- INSTITUTION = {Ecole Normale Sup\'erieure},
- TITLE = {{Formalisation de la th\'eorie des langages
- formels en Coq}},
- TYPE = {Rapport de ma\^{\i}trise},
- YEAR = {1993},
- URL = {http://www.ens-lyon.fr/~jcourant/stage_maitrise.dvi.gz},
- URL2 = {http://www.ens-lyon.fr/~jcourant/stage_maitrise.ps.gz}
-}
-
-@INPROCEEDINGS{tphols2000-Letouzey,
- crossref = "tphols2000",
- title = "Formalizing {S}t{\aa}lmarck's algorithm in {C}oq",
- author = "Pierre Letouzey and Laurent Th{\'e}ry",
- pages = "387--404"}
-
-@PROCEEDINGS{tphols2000,
- editor = "J. Harrison and M. Aagaard",
- booktitle = "Theorem Proving in Higher Order Logics:
- 13th International Conference, TPHOLs 2000",
- series = "Lecture Notes in Computer Science",
- volume = 1869,
- year = 2000,
- publisher = "Springer-Verlag"}
-
-@InCollection{howe,
- author = {Doug Howe},
- title = {Computation Meta theory in Nuprl},
- booktitle = {The Proceedings of the Ninth International Conference of Autom
-ated Deduction},
- volume = {310},
- editor = {E. Lusk and R. Overbeek},
- publisher = {Springer-Verlag},
- pages = {238--257},
- year = {1988}
-}
-
-@TechReport{harrison,
- author = {John Harrison},
- title = {Meta theory and Reflection in Theorem Proving:a Survey and Cri
-tique},
- institution = {SRI International Cambridge Computer Science Research Center},
- year = {1995},
- number = {CRC-053}
-}
-
-@InCollection{cc,
- author = {Thierry Coquand and Gérard Huet},
- title = {The Calculus of Constructions},
- booktitle = {Information and Computation},
- year = {1988},
- volume = {76},
- number = {2/3}
-}
-
-
-@InProceedings{coquandcci,
- author = {Thierry Coquand and Christine Paulin-Mohring},
- title = {Inductively defined types},
- booktitle = {Proceedings of Colog'88},
- year = {1990},
- editor = {P. Martin-Löf and G. Mints},
- volume = {417},
- series = {LNCS},
- publisher = {Springer-Verlag}
-}
-
-
-@InProceedings{boutin,
- author = {Samuel Boutin},
- title = {Using reflection to build efficient and certified decision pro
-cedures.},
- booktitle = {Proceedings of TACS'97},
- year = {1997},
- editor = {M. Abadi and T. Ito},
- volume = {1281},
- series = {LNCS},
- publisher = {Springer-Verlag}
-}
-
-@Manual{Coq:manual,
- title = {The Coq proof assistant reference manual},
- author = {\mbox{The Coq development team}},
- organization = {LogiCal Project},
- note = {Version 8.0},
- year = {2004},
- url = "http://coq.inria.fr"
-}
-
-@string{jfp = "Journal of Functional Programming"}
-@STRING{lncs="Lecture Notes in Computer Science"}
-@STRING{lnai="Lecture Notes in Artificial Intelligence"}
-@string{SV = "{Sprin\-ger-Verlag}"}
-
-@INPROCEEDINGS{Aud91,
- AUTHOR = {Ph. Audebaud},
- BOOKTITLE = {Proceedings of the sixth Conf. on Logic in Computer Science.},
- PUBLISHER = {IEEE},
- TITLE = {Partial {Objects} in the {Calculus of Constructions}},
- YEAR = {1991}
-}
-
-@PHDTHESIS{Aud92,
- AUTHOR = {Ph. Audebaud},
- SCHOOL = {{Universit\'e} Bordeaux I},
- TITLE = {Extension du Calcul des Constructions par Points fixes},
- YEAR = {1992}
-}
-
-@INPROCEEDINGS{Audebaud92b,
- AUTHOR = {Ph. Audebaud},
- BOOKTITLE = {{Proceedings of the 1992 Workshop on Types for Proofs and Programs}},
- EDITOR = {{B. Nordstr\"om and K. Petersson and G. Plotkin}},
- NOTE = {Also Research Report LIP-ENS-Lyon},
- PAGES = {pp 21--34},
- TITLE = {{CC+ : an extension of the Calculus of Constructions with fixpoints}},
- YEAR = {1992}
-}
-
-@INPROCEEDINGS{Augustsson85,
- AUTHOR = {L. Augustsson},
- TITLE = {{Compiling Pattern Matching}},
- BOOKTITLE = {Conference Functional Programming and
-Computer Architecture},
- YEAR = {1985}
-}
-
-@ARTICLE{BaCo85,
- AUTHOR = {J.L. Bates and R.L. Constable},
- JOURNAL = {ACM transactions on Programming Languages and Systems},
- TITLE = {Proofs as {Programs}},
- VOLUME = {7},
- YEAR = {1985}
-}
-
-@BOOK{Bar81,
- AUTHOR = {H.P. Barendregt},
- PUBLISHER = {North-Holland},
- TITLE = {The Lambda Calculus its Syntax and Semantics},
- YEAR = {1981}
-}
-
-@TECHREPORT{Bar91,
- AUTHOR = {H. Barendregt},
- INSTITUTION = {Catholic University Nijmegen},
- NOTE = {In Handbook of Logic in Computer Science, Vol II},
- NUMBER = {91-19},
- TITLE = {Lambda {Calculi with Types}},
- YEAR = {1991}
-}
-
-@ARTICLE{BeKe92,
- AUTHOR = {G. Bellin and J. Ketonen},
- JOURNAL = {Theoretical Computer Science},
- PAGES = {115--142},
- TITLE = {A decision procedure revisited : Notes on direct logic, linear logic and its implementation},
- VOLUME = {95},
- YEAR = {1992}
-}
-
-@BOOK{Bee85,
- AUTHOR = {M.J. Beeson},
- PUBLISHER = SV,
- TITLE = {Foundations of Constructive Mathematics, Metamathematical Studies},
- YEAR = {1985}
-}
-
-@BOOK{Bis67,
- AUTHOR = {E. Bishop},
- PUBLISHER = {McGraw-Hill},
- TITLE = {Foundations of Constructive Analysis},
- YEAR = {1967}
-}
-
-@BOOK{BoMo79,
- AUTHOR = {R.S. Boyer and J.S. Moore},
- KEY = {BoMo79},
- PUBLISHER = {Academic Press},
- SERIES = {ACM Monograph},
- TITLE = {A computational logic},
- YEAR = {1979}
-}
-
-@MASTERSTHESIS{Bou92,
- AUTHOR = {S. Boutin},
- MONTH = sep,
- SCHOOL = {{Universit\'e Paris 7}},
- TITLE = {Certification d'un compilateur {ML en Coq}},
- YEAR = {1992}
-}
-
-@inproceedings{Bou97,
- title = {Using reflection to build efficient and certified decision procedure
-s},
- author = {S. Boutin},
- booktitle = {TACS'97},
- editor = {Martin Abadi and Takahashi Ito},
- publisher = SV,
- series = lncs,
- volume=1281,
- PS={http://pauillac.inria.fr/~boutin/public_w/submitTACS97.ps.gz},
- year = {1997}
-}
-
-@PhdThesis{Bou97These,
- author = {S. Boutin},
- title = {R\'eflexions sur les quotients},
- school = {Paris 7},
- year = 1997,
- type = {th\`ese d'Universit\'e},
- month = apr
-}
-
-@ARTICLE{Bru72,
- AUTHOR = {N.J. de Bruijn},
- JOURNAL = {Indag. Math.},
- TITLE = {{Lambda-Calculus Notation with Nameless Dummies, a Tool for Automatic Formula Manipulation, with Application to the Church-Rosser Theorem}},
- VOLUME = {34},
- YEAR = {1972}
-}
-
-
-@INCOLLECTION{Bru80,
- AUTHOR = {N.J. de Bruijn},
- BOOKTITLE = {to H.B. Curry : Essays on Combinatory Logic, Lambda Calculus and Formalism.},
- EDITOR = {J.P. Seldin and J.R. Hindley},
- PUBLISHER = {Academic Press},
- TITLE = {A survey of the project {Automath}},
- YEAR = {1980}
-}
-
-@TECHREPORT{COQ93,
- AUTHOR = {G. Dowek and A. Felty and H. Herbelin and G. Huet and C. Murthy and C. Parent and C. Paulin-Mohring and B. Werner},
- INSTITUTION = {INRIA},
- MONTH = may,
- NUMBER = {154},
- TITLE = {{The Coq Proof Assistant User's Guide Version 5.8}},
- YEAR = {1993}
-}
-
-@TECHREPORT{CPar93,
- AUTHOR = {C. Parent},
- INSTITUTION = {Ecole {Normale} {Sup\'erieure} de {Lyon}},
- MONTH = oct,
- NOTE = {Also in~\cite{Nijmegen93}},
- NUMBER = {93-29},
- TITLE = {Developing certified programs in the system {Coq}- {The} {Program} tactic},
- YEAR = {1993}
-}
-
-@PHDTHESIS{CPar95,
- AUTHOR = {C. Parent},
- SCHOOL = {Ecole {Normale} {Sup\'erieure} de {Lyon}},
- TITLE = {{Synth\`ese de preuves de programmes dans le Calcul des Constructions Inductives}},
- YEAR = {1995}
-}
-
-@BOOK{Caml,
- AUTHOR = {P. Weis and X. Leroy},
- PUBLISHER = {InterEditions},
- TITLE = {Le langage Caml},
- YEAR = {1993}
-}
-
-@INPROCEEDINGS{ChiPotSimp03,
- AUTHOR = {Laurent Chicli and Lo\"{\i}c Pottier and Carlos Simpson},
- ADDRESS = {Berg en Dal, The Netherlands},
- TITLE = {Mathematical Quotients and Quotient Types in Coq},
- BOOKTITLE = {TYPES'02},
- PUBLISHER = SV,
- SERIES = LNCS,
- VOLUME = {2646},
- YEAR = {2003}
-}
-
-@TECHREPORT{CoC89,
- AUTHOR = {Projet Formel},
- INSTITUTION = {INRIA},
- NUMBER = {110},
- TITLE = {{The Calculus of Constructions. Documentation and user's guide, Version 4.10}},
- YEAR = {1989}
-}
-
-@INPROCEEDINGS{CoHu85a,
- AUTHOR = {Thierry Coquand and Gérard Huet},
- ADDRESS = {Linz},
- BOOKTITLE = {EUROCAL'85},
- PUBLISHER = SV,
- SERIES = LNCS,
- TITLE = {{Constructions : A Higher Order Proof System for Mechanizing Mathematics}},
- VOLUME = {203},
- YEAR = {1985}
-}
-
-@INPROCEEDINGS{CoHu85b,
- AUTHOR = {Thierry Coquand and Gérard Huet},
- BOOKTITLE = {Logic Colloquium'85},
- EDITOR = {The Paris Logic Group},
- PUBLISHER = {North-Holland},
- TITLE = {{Concepts Math\'ematiques et Informatiques formalis\'es dans le Calcul des Constructions}},
- YEAR = {1987}
-}
-
-@ARTICLE{CoHu86,
- AUTHOR = {Thierry Coquand and Gérard Huet},
- JOURNAL = {Information and Computation},
- NUMBER = {2/3},
- TITLE = {The {Calculus of Constructions}},
- VOLUME = {76},
- YEAR = {1988}
-}
-
-@INPROCEEDINGS{CoPa89,
- AUTHOR = {Thierry Coquand and Christine Paulin-Mohring},
- BOOKTITLE = {Proceedings of Colog'88},
- EDITOR = {P. Martin-L\"of and G. Mints},
- PUBLISHER = SV,
- SERIES = LNCS,
- TITLE = {Inductively defined types},
- VOLUME = {417},
- YEAR = {1990}
-}
-
-@BOOK{Con86,
- AUTHOR = {R.L. {Constable et al.}},
- PUBLISHER = {Prentice-Hall},
- TITLE = {{Implementing Mathematics with the Nuprl Proof Development System}},
- YEAR = {1986}
-}
-
-@PHDTHESIS{Coq85,
- AUTHOR = {Thierry Coquand},
- MONTH = jan,
- SCHOOL = {Universit\'e Paris~7},
- TITLE = {Une Th\'eorie des Constructions},
- YEAR = {1985}
-}
-
-@INPROCEEDINGS{Coq86,
- AUTHOR = {Thierry Coquand},
- ADDRESS = {Cambridge, MA},
- BOOKTITLE = {Symposium on Logic in Computer Science},
- PUBLISHER = {IEEE Computer Society Press},
- TITLE = {{An Analysis of Girard's Paradox}},
- YEAR = {1986}
-}
-
-@INPROCEEDINGS{Coq90,
- AUTHOR = {Thierry Coquand},
- BOOKTITLE = {Logic and Computer Science},
- EDITOR = {P. Oddifredi},
- NOTE = {INRIA Research Report 1088, also in~\cite{CoC89}},
- PUBLISHER = {Academic Press},
- TITLE = {{Metamathematical Investigations of a Calculus of Constructions}},
- YEAR = {1990}
-}
-
-@INPROCEEDINGS{Coq91,
- AUTHOR = {Thierry Coquand},
- BOOKTITLE = {Proceedings 9th Int. Congress of Logic, Methodology and Philosophy of Science},
- TITLE = {{A New Paradox in Type Theory}},
- MONTH = {August},
- YEAR = {1991}
-}
-
-@INPROCEEDINGS{Coq92,
- AUTHOR = {Thierry Coquand},
- TITLE = {{Pattern Matching with Dependent Types}},
- YEAR = {1992},
- crossref = {Bastad92}
-}
-
-@INPROCEEDINGS{Coquand93,
- AUTHOR = {Thierry Coquand},
- TITLE = {{Infinite Objects in Type Theory}},
- YEAR = {1993},
- crossref = {Nijmegen93}
-}
-
-@MASTERSTHESIS{Cou94a,
- AUTHOR = {J. Courant},
- MONTH = sep,
- SCHOOL = {DEA d'Informatique, ENS Lyon},
- TITLE = {Explicitation de preuves par r\'ecurrence implicite},
- YEAR = {1994}
-}
-
-@INPROCEEDINGS{Del99,
- author = "Delahaye, D.",
- title = "Information Retrieval in a Coq Proof Library using
- Type Isomorphisms",
- booktitle = {Proceedings of TYPES'99, L\"okeberg},
- publisher = SV,
- series = lncs,
- year = "1999",
- url =
- "\\{\sf ftp://ftp.inria.fr/INRIA/Projects/coq/David.Delahaye/papers/}"#
- "{\sf TYPES99-SIsos.ps.gz}"
-}
-
-@INPROCEEDINGS{Del00,
- author = "Delahaye, D.",
- title = "A {T}actic {L}anguage for the {S}ystem {{\sf Coq}}",
- booktitle = "Proceedings of Logic for Programming and Automated Reasoning
- (LPAR), Reunion Island",
- publisher = SV,
- series = LNCS,
- volume = "1955",
- pages = "85--95",
- month = "November",
- year = "2000",
- url =
- "{\sf ftp://ftp.inria.fr/INRIA/Projects/coq/David.Delahaye/papers/}"#
- "{\sf LPAR2000-ltac.ps.gz}"
-}
-
-@INPROCEEDINGS{DelMay01,
- author = "Delahaye, D. and Mayero, M.",
- title = {{\tt Field}: une proc\'edure de d\'ecision pour les nombres r\'eels
- en {\Coq}},
- booktitle = "Journ\'ees Francophones des Langages Applicatifs, Pontarlier",
- publisher = "INRIA",
- month = "Janvier",
- year = "2001",
- url =
- "\\{\sf ftp://ftp.inria.fr/INRIA/Projects/coq/David.Delahaye/papers/}"#
- "{\sf JFLA2000-Field.ps.gz}"
-}
-
-@TECHREPORT{Dow90,
- AUTHOR = {G. Dowek},
- INSTITUTION = {INRIA},
- NUMBER = {1283},
- TITLE = {Naming and Scoping in a Mathematical Vernacular},
- TYPE = {Research Report},
- YEAR = {1990}
-}
-
-@ARTICLE{Dow91a,
- AUTHOR = {G. Dowek},
- JOURNAL = {Compte-Rendus de l'Acad\'emie des Sciences},
- NOTE = {The undecidability of Third Order Pattern Matching in Calculi with Dependent Types or Type Constructors},
- NUMBER = {12},
- PAGES = {951--956},
- TITLE = {L'Ind\'ecidabilit\'e du Filtrage du Troisi\`eme Ordre dans les Calculs avec Types D\'ependants ou Constructeurs de Types},
- VOLUME = {I, 312},
- YEAR = {1991}
-}
-
-@INPROCEEDINGS{Dow91b,
- AUTHOR = {G. Dowek},
- BOOKTITLE = {Proceedings of Mathematical Foundation of Computer Science},
- NOTE = {Also INRIA Research Report},
- PAGES = {151--160},
- PUBLISHER = SV,
- SERIES = LNCS,
- TITLE = {A Second Order Pattern Matching Algorithm in the Cube of Typed $\lambda$-calculi},
- VOLUME = {520},
- YEAR = {1991}
-}
-
-@PHDTHESIS{Dow91c,
- AUTHOR = {G. Dowek},
- MONTH = dec,
- SCHOOL = {Universit\'e Paris 7},
- TITLE = {D\'emonstration automatique dans le Calcul des Constructions},
- YEAR = {1991}
-}
-
-@article{Dow92a,
- AUTHOR = {G. Dowek},
- TITLE = {The Undecidability of Pattern Matching in Calculi where Primitive Recursive Functions are Representable},
- YEAR = 1993,
- journal = tcs,
- volume = 107,
- number = 2,
- pages = {349-356}
-}
-
-
-@ARTICLE{Dow94a,
- AUTHOR = {G. Dowek},
- JOURNAL = {Annals of Pure and Applied Logic},
- VOLUME = {69},
- PAGES = {135--155},
- TITLE = {Third order matching is decidable},
- YEAR = {1994}
-}
-
-@INPROCEEDINGS{Dow94b,
- AUTHOR = {G. Dowek},
- BOOKTITLE = {Proceedings of the second international conference on typed lambda calculus and applications},
- TITLE = {Lambda-calculus, Combinators and the Comprehension Schema},
- YEAR = {1995}
-}
-
-@INPROCEEDINGS{Dyb91,
- AUTHOR = {P. Dybjer},
- BOOKTITLE = {Logical Frameworks},
- EDITOR = {G. Huet and G. Plotkin},
- PAGES = {59--79},
- PUBLISHER = {Cambridge University Press},
- TITLE = {Inductive sets and families in {Martin-L{\"o}f's}
- Type Theory and their set-theoretic semantics: An inversion principle for {Martin-L\"of's} type theory},
- VOLUME = {14},
- YEAR = {1991}
-}
-
-@ARTICLE{Dyc92,
- AUTHOR = {Roy Dyckhoff},
- JOURNAL = {The Journal of Symbolic Logic},
- MONTH = sep,
- NUMBER = {3},
- TITLE = {Contraction-free sequent calculi for intuitionistic logic},
- VOLUME = {57},
- YEAR = {1992}
-}
-
-@MASTERSTHESIS{Fil94,
- AUTHOR = {J.-C. Filli\^atre},
- MONTH = sep,
- SCHOOL = {DEA d'Informatique, ENS Lyon},
- TITLE = {Une proc\'edure de d\'ecision pour le Calcul des Pr\'edicats Direct. {\'E}tude et impl\'ementation dans le syst\`eme {\Coq}},
- YEAR = {1994}
-}
-
-@TECHREPORT{Filliatre95,
- AUTHOR = {J.-C. Filli\^atre},
- INSTITUTION = {LIP-ENS-Lyon},
- TITLE = {A decision procedure for Direct Predicate Calculus},
- TYPE = {Research report},
- NUMBER = {96--25},
- YEAR = {1995}
-}
-
-@Article{Filliatre03jfp,
- author = {J.-C. Filli{\^a}tre},
- title = {Verification of Non-Functional Programs
- using Interpretations in Type Theory},
- journal = jfp,
- volume = 13,
- number = 4,
- pages = {709--745},
- month = jul,
- year = 2003,
- note = {[English translation of \cite{Filliatre99}]},
- url = {http://www.lri.fr/~filliatr/ftp/publis/jphd.ps.gz},
- topics = "team, lri",
- type_publi = "irevcomlec"
-}
-
-
-@PhdThesis{Filliatre99,
- author = {J.-C. Filli\^atre},
- title = {Preuve de programmes imp\'eratifs en th\'eorie des types},
- type = {Th{\`e}se de Doctorat},
- school = {Universit\'e Paris-Sud},
- year = 1999,
- month = {July},
- url = {\url{http://www.lri.fr/~filliatr/ftp/publis/these.ps.gz}}
-}
-
-@Unpublished{Filliatre99c,
- author = {J.-C. Filli\^atre},
- title = {{Formal Proof of a Program: Find}},
- month = {January},
- year = 2000,
- note = {Submitted to \emph{Science of Computer Programming}},
- url = {\url{http://www.lri.fr/~filliatr/ftp/publis/find.ps.gz}}
-}
-
-@InProceedings{FilliatreMagaud99,
- author = {J.-C. Filli\^atre and N. Magaud},
- title = {Certification of sorting algorithms in the system {\Coq}},
- booktitle = {Theorem Proving in Higher Order Logics:
- Emerging Trends},
- year = 1999,
- url = {\url{http://www.lri.fr/~filliatr/ftp/publis/Filliatre-Magaud.ps.gz}}
-}
-
-@UNPUBLISHED{Fle90,
- AUTHOR = {E. Fleury},
- MONTH = jul,
- NOTE = {Rapport de Stage},
- TITLE = {Implantation des algorithmes de {Floyd et de Dijkstra} dans le {Calcul des Constructions}},
- YEAR = {1990}
-}
-
-@BOOK{Fourier,
- AUTHOR = {Jean-Baptiste-Joseph Fourier},
- PUBLISHER = {Gauthier-Villars},
- TITLE = {Fourier's method to solve linear
- inequations/equations systems.},
- YEAR = {1890}
-}
-
-@INPROCEEDINGS{Gim94,
- AUTHOR = {Eduardo Gim\'enez},
- BOOKTITLE = {Types'94 : Types for Proofs and Programs},
- NOTE = {Extended version in LIP research report 95-07, ENS Lyon},
- PUBLISHER = SV,
- SERIES = LNCS,
- TITLE = {Codifying guarded definitions with recursive schemes},
- VOLUME = {996},
- YEAR = {1994}
-}
-
-@TechReport{Gim98,
- author = {E. Gim\'enez},
- title = {A Tutorial on Recursive Types in Coq},
- institution = {INRIA},
- year = 1998,
- month = mar
-}
-
-@INPROCEEDINGS{Gimenez95b,
- AUTHOR = {E. Gim\'enez},
- BOOKTITLE = {Workshop on Types for Proofs and Programs},
- SERIES = LNCS,
- NUMBER = {1158},
- PAGES = {135-152},
- TITLE = {An application of co-Inductive types in Coq:
- verification of the Alternating Bit Protocol},
- EDITORS = {S. Berardi and M. Coppo},
- PUBLISHER = SV,
- YEAR = {1995}
-}
-
-@INPROCEEDINGS{Gir70,
- AUTHOR = {Jean-Yves Girard},
- BOOKTITLE = {Proceedings of the 2nd Scandinavian Logic Symposium},
- PUBLISHER = {North-Holland},
- TITLE = {Une extension de l'interpr\'etation de {G\"odel} \`a l'analyse, et son application \`a l'\'elimination des coupures dans l'analyse et la th\'eorie des types},
- YEAR = {1970}
-}
-
-@PHDTHESIS{Gir72,
- AUTHOR = {Jean-Yves Girard},
- SCHOOL = {Universit\'e Paris~7},
- TITLE = {Interpr\'etation fonctionnelle et \'elimination des coupures de l'arithm\'etique d'ordre sup\'erieur},
- YEAR = {1972}
-}
-
-
-
-@BOOK{Gir89,
- AUTHOR = {Jean-Yves Girard and Yves Lafont and Paul Taylor},
- PUBLISHER = {Cambridge University Press},
- SERIES = {Cambridge Tracts in Theoretical Computer Science 7},
- TITLE = {Proofs and Types},
- YEAR = {1989}
-}
-
-@TechReport{Har95,
- author = {John Harrison},
- title = {Metatheory and Reflection in Theorem Proving: A Survey and Critique},
- institution = {SRI International Cambridge Computer Science Research Centre,},
- year = 1995,
- type = {Technical Report},
- number = {CRC-053},
- abstract = {http://www.cl.cam.ac.uk/users/jrh/papers.html}
-}
-
-@MASTERSTHESIS{Hir94,
- AUTHOR = {Daniel Hirschkoff},
- MONTH = sep,
- SCHOOL = {DEA IARFA, Ecole des Ponts et Chauss\'ees, Paris},
- TITLE = {{\'E}criture d'une tactique arithm\'etique pour le syst\`eme {\Coq}},
- YEAR = {1994}
-}
-
-@INPROCEEDINGS{HofStr98,
- AUTHOR = {Martin Hofmann and Thomas Streicher},
- TITLE = {The groupoid interpretation of type theory},
- BOOKTITLE = {Proceedings of the meeting Twenty-five years of constructive type theory},
- PUBLISHER = {Oxford University Press},
- YEAR = {1998}
-}
-
-@INCOLLECTION{How80,
- AUTHOR = {W.A. Howard},
- BOOKTITLE = {to H.B. Curry : Essays on Combinatory Logic, Lambda Calculus and Formalism.},
- EDITOR = {J.P. Seldin and J.R. Hindley},
- NOTE = {Unpublished 1969 Manuscript},
- PUBLISHER = {Academic Press},
- TITLE = {The Formulae-as-Types Notion of Constructions},
- YEAR = {1980}
-}
-
-
-
-@InProceedings{Hue87tapsoft,
- author = {G. Huet},
- title = {Programming of Future Generation Computers},
- booktitle = {Proceedings of TAPSOFT87},
- series = LNCS,
- volume = 249,
- pages = {276--286},
- year = 1987,
- publisher = SV
-}
-
-@INPROCEEDINGS{Hue87,
- AUTHOR = {G. Huet},
- BOOKTITLE = {Programming of Future Generation Computers},
- EDITOR = {K. Fuchi and M. Nivat},
- NOTE = {Also in \cite{Hue87tapsoft}},
- PUBLISHER = {Elsevier Science},
- TITLE = {Induction Principles Formalized in the {Calculus of Constructions}},
- YEAR = {1988}
-}
-
-
-
-@INPROCEEDINGS{Hue88,
- AUTHOR = {G. Huet},
- BOOKTITLE = {A perspective in Theoretical Computer Science. Commemorative Volume for Gift Siromoney},
- EDITOR = {R. Narasimhan},
- NOTE = {Also in~\cite{CoC89}},
- PUBLISHER = {World Scientific Publishing},
- TITLE = {{The Constructive Engine}},
- YEAR = {1989}
-}
-
-@BOOK{Hue89,
- EDITOR = {G. Huet},
- PUBLISHER = {Addison-Wesley},
- SERIES = {The UT Year of Programming Series},
- TITLE = {Logical Foundations of Functional Programming},
- YEAR = {1989}
-}
-
-@INPROCEEDINGS{Hue92,
- AUTHOR = {G. Huet},
- BOOKTITLE = {Proceedings of 12th FST/TCS Conference, New Delhi},
- PAGES = {229--240},
- PUBLISHER = SV,
- SERIES = LNCS,
- TITLE = {The Gallina Specification Language : A case study},
- VOLUME = {652},
- YEAR = {1992}
-}
-
-@ARTICLE{Hue94,
- AUTHOR = {G. Huet},
- JOURNAL = {J. Functional Programming},
- PAGES = {371--394},
- PUBLISHER = {Cambridge University Press},
- TITLE = {Residual theory in $\lambda$-calculus: a formal development},
- VOLUME = {4,3},
- YEAR = {1994}
-}
-
-@INCOLLECTION{HuetLevy79,
- AUTHOR = {G. Huet and J.-J. L\'{e}vy},
- TITLE = {Call by Need Computations in Non-Ambigous
-Linear Term Rewriting Systems},
- NOTE = {Also research report 359, INRIA, 1979},
- BOOKTITLE = {Computational Logic, Essays in Honor of
-Alan Robinson},
- EDITOR = {J.-L. Lassez and G. Plotkin},
- PUBLISHER = {The MIT press},
- YEAR = {1991}
-}
-
-@ARTICLE{KeWe84,
- AUTHOR = {J. Ketonen and R. Weyhrauch},
- JOURNAL = {Theoretical Computer Science},
- PAGES = {297--307},
- TITLE = {A decidable fragment of {P}redicate {C}alculus},
- VOLUME = {32},
- YEAR = {1984}
-}
-
-@BOOK{Kle52,
- AUTHOR = {S.C. Kleene},
- PUBLISHER = {North-Holland},
- SERIES = {Bibliotheca Mathematica},
- TITLE = {Introduction to Metamathematics},
- YEAR = {1952}
-}
-
-@BOOK{Kri90,
- AUTHOR = {J.-L. Krivine},
- PUBLISHER = {Masson},
- SERIES = {Etudes et recherche en informatique},
- TITLE = {Lambda-calcul {types et mod\`eles}},
- YEAR = {1990}
-}
-
-@BOOK{LE92,
- EDITOR = {G. Huet and G. Plotkin},
- PUBLISHER = {Cambridge University Press},
- TITLE = {Logical Environments},
- YEAR = {1992}
-}
-
-@BOOK{LF91,
- EDITOR = {G. Huet and G. Plotkin},
- PUBLISHER = {Cambridge University Press},
- TITLE = {Logical Frameworks},
- YEAR = {1991}
-}
-
-@ARTICLE{Laville91,
- AUTHOR = {A. Laville},
- TITLE = {Comparison of Priority Rules in Pattern
-Matching and Term Rewriting},
- JOURNAL = {Journal of Symbolic Computation},
- VOLUME = {11},
- PAGES = {321--347},
- YEAR = {1991}
-}
-
-@INPROCEEDINGS{LePa94,
- AUTHOR = {F. Leclerc and C. Paulin-Mohring},
- BOOKTITLE = {{Types for Proofs and Programs, Types' 93}},
- EDITOR = {H. Barendregt and T. Nipkow},
- PUBLISHER = SV,
- SERIES = {LNCS},
- TITLE = {{Programming with Streams in Coq. A case study : The Sieve of Eratosthenes}},
- VOLUME = {806},
- YEAR = {1994}
-}
-
-@TECHREPORT{Leroy90,
- AUTHOR = {X. Leroy},
- TITLE = {The {ZINC} experiment: an economical implementation
-of the {ML} language},
- INSTITUTION = {INRIA},
- NUMBER = {117},
- YEAR = {1990}
-}
-
-@INPROCEEDINGS{Let02,
- author = {P. Letouzey},
- title = {A New Extraction for Coq},
- booktitle = {Proceedings of the TYPES'2002 workshop},
- year = 2002,
- note = {to appear},
- url = {draft at \url{http://www.lri.fr/~letouzey/download/extraction2002.ps.gz}}
-}
-
-@BOOK{MaL84,
- AUTHOR = {{P. Martin-L\"of}},
- PUBLISHER = {Bibliopolis},
- SERIES = {Studies in Proof Theory},
- TITLE = {Intuitionistic Type Theory},
- YEAR = {1984}
-}
-
-@ARTICLE{MaSi94,
- AUTHOR = {P. Manoury and M. Simonot},
- JOURNAL = {TCS},
- TITLE = {Automatizing termination proof of recursively defined function},
- YEAR = {To appear}
-}
-
-@INPROCEEDINGS{Moh89a,
- AUTHOR = {Christine Paulin-Mohring},
- ADDRESS = {Austin},
- BOOKTITLE = {Sixteenth Annual ACM Symposium on Principles of Programming Languages},
- MONTH = jan,
- PUBLISHER = {ACM},
- TITLE = {Extracting ${F}_{\omega}$'s programs from proofs in the {Calculus of Constructions}},
- YEAR = {1989}
-}
-
-@PHDTHESIS{Moh89b,
- AUTHOR = {Christine Paulin-Mohring},
- MONTH = jan,
- SCHOOL = {{Universit\'e Paris 7}},
- TITLE = {Extraction de programmes dans le {Calcul des Constructions}},
- YEAR = {1989}
-}
-
-@INPROCEEDINGS{Moh93,
- AUTHOR = {Christine Paulin-Mohring},
- BOOKTITLE = {Proceedings of the conference Typed Lambda Calculi and Applications},
- EDITOR = {M. Bezem and J.-F. Groote},
- NOTE = {Also LIP research report 92-49, ENS Lyon},
- NUMBER = {664},
- PUBLISHER = SV,
- SERIES = {LNCS},
- TITLE = {{Inductive Definitions in the System Coq - Rules and Properties}},
- YEAR = {1993}
-}
-
-@BOOK{Moh97,
- AUTHOR = {Christine Paulin-Mohring},
- MONTH = jan,
- PUBLISHER = {{ENS Lyon}},
- TITLE = {{Le syst\`eme Coq. \mbox{Th\`ese d'habilitation}}},
- YEAR = {1997}
-}
-
-@MASTERSTHESIS{Mun94,
- AUTHOR = {C. Mu{\~n}oz},
- MONTH = sep,
- SCHOOL = {DEA d'Informatique Fondamentale, Universit\'e Paris 7},
- TITLE = {D\'emonstration automatique dans la logique propositionnelle intuitionniste},
- YEAR = {1994}
-}
-
-@PHDTHESIS{Mun97d,
- AUTHOR = "C. Mu{\~{n}}oz",
- TITLE = "Un calcul de substitutions pour la repr\'esentation
- de preuves partielles en th\'eorie de types",
- SCHOOL = {Universit\'e Paris 7},
- YEAR = "1997",
- Note = {Version en anglais disponible comme rapport de
- recherche INRIA RR-3309},
- Type = {Th\`ese de Doctorat}
-}
-
-@BOOK{NoPS90,
- AUTHOR = {B. {Nordstr\"om} and K. Peterson and J. Smith},
- BOOKTITLE = {Information Processing 83},
- PUBLISHER = {Oxford Science Publications},
- SERIES = {International Series of Monographs on Computer Science},
- TITLE = {Programming in {Martin-L\"of's} Type Theory},
- YEAR = {1990}
-}
-
-@ARTICLE{Nor88,
- AUTHOR = {B. {Nordstr\"om}},
- JOURNAL = {BIT},
- TITLE = {Terminating General Recursion},
- VOLUME = {28},
- YEAR = {1988}
-}
-
-@BOOK{Odi90,
- EDITOR = {P. Odifreddi},
- PUBLISHER = {Academic Press},
- TITLE = {Logic and Computer Science},
- YEAR = {1990}
-}
-
-@INPROCEEDINGS{PaMS92,
- AUTHOR = {M. Parigot and P. Manoury and M. Simonot},
- ADDRESS = {St. Petersburg, Russia},
- BOOKTITLE = {Logic Programming and automated reasoning},
- EDITOR = {A. Voronkov},
- MONTH = jul,
- NUMBER = {624},
- PUBLISHER = SV,
- SERIES = {LNCS},
- TITLE = {{ProPre : A Programming language with proofs}},
- YEAR = {1992}
-}
-
-@ARTICLE{PaWe92,
- AUTHOR = {Christine Paulin-Mohring and Benjamin Werner},
- JOURNAL = {Journal of Symbolic Computation},
- PAGES = {607--640},
- TITLE = {{Synthesis of ML programs in the system Coq}},
- VOLUME = {15},
- YEAR = {1993}
-}
-
-@ARTICLE{Par92,
- AUTHOR = {M. Parigot},
- JOURNAL = {Theoretical Computer Science},
- NUMBER = {2},
- PAGES = {335--356},
- TITLE = {{Recursive Programming with Proofs}},
- VOLUME = {94},
- YEAR = {1992}
-}
-
-@INPROCEEDINGS{Parent95b,
- AUTHOR = {C. Parent},
- BOOKTITLE = {{Mathematics of Program Construction'95}},
- PUBLISHER = SV,
- SERIES = {LNCS},
- TITLE = {{Synthesizing proofs from programs in
-the Calculus of Inductive Constructions}},
- VOLUME = {947},
- YEAR = {1995}
-}
-
-@INPROCEEDINGS{Prasad93,
- AUTHOR = {K.V. Prasad},
- BOOKTITLE = {{Proceedings of CONCUR'93}},
- PUBLISHER = SV,
- SERIES = {LNCS},
- TITLE = {{Programming with broadcasts}},
- VOLUME = {715},
- YEAR = {1993}
-}
-
-@BOOK{RC95,
- author = "di~Cosmo, R.",
- title = "Isomorphisms of Types: from $\lambda$-calculus to information
- retrieval and language design",
- series = "Progress in Theoretical Computer Science",
- publisher = "Birkhauser",
- year = "1995",
- note = "ISBN-0-8176-3763-X"
-}
-
-@TECHREPORT{Rou92,
- AUTHOR = {J. Rouyer},
- INSTITUTION = {INRIA},
- MONTH = nov,
- NUMBER = {1795},
- TITLE = {{D{\'e}veloppement de l'Algorithme d'Unification dans le Calcul des Constructions}},
- YEAR = {1992}
-}
-
-@TECHREPORT{Saibi94,
- AUTHOR = {A. Sa\"{\i}bi},
- INSTITUTION = {INRIA},
- MONTH = dec,
- NUMBER = {2345},
- TITLE = {{Axiomatization of a lambda-calculus with explicit-substitutions in the Coq System}},
- YEAR = {1994}
-}
-
-
-@MASTERSTHESIS{Ter92,
- AUTHOR = {D. Terrasse},
- MONTH = sep,
- SCHOOL = {IARFA},
- TITLE = {{Traduction de TYPOL en COQ. Application \`a Mini ML}},
- YEAR = {1992}
-}
-
-@TECHREPORT{ThBeKa92,
- AUTHOR = {L. Th\'ery and Y. Bertot and G. Kahn},
- INSTITUTION = {INRIA Sophia},
- MONTH = may,
- NUMBER = {1684},
- TITLE = {Real theorem provers deserve real user-interfaces},
- TYPE = {Research Report},
- YEAR = {1992}
-}
-
-@BOOK{TrDa89,
- AUTHOR = {A.S. Troelstra and D. van Dalen},
- PUBLISHER = {North-Holland},
- SERIES = {Studies in Logic and the foundations of Mathematics, volumes 121 and 123},
- TITLE = {Constructivism in Mathematics, an introduction},
- YEAR = {1988}
-}
-
-@PHDTHESIS{Wer94,
- AUTHOR = {B. Werner},
- SCHOOL = {Universit\'e Paris 7},
- TITLE = {Une th\'eorie des constructions inductives},
- TYPE = {Th\`ese de Doctorat},
- YEAR = {1994}
-}
-
-@PHDTHESIS{Bar99,
- AUTHOR = {B. Barras},
- SCHOOL = {Universit\'e Paris 7},
- TITLE = {Auto-validation d'un système de preuves avec familles inductives},
- TYPE = {Th\`ese de Doctorat},
- YEAR = {1999}
-}
-
-@UNPUBLISHED{ddr98,
- AUTHOR = {D. de Rauglaudre},
- TITLE = {Camlp4 version 1.07.2},
- YEAR = {1998},
- NOTE = {In Camlp4 distribution}
-}
-
-@ARTICLE{dowek93,
- AUTHOR = {G. Dowek},
- TITLE = {{A Complete Proof Synthesis Method for the Cube of Type Systems}},
- JOURNAL = {Journal Logic Computation},
- VOLUME = {3},
- NUMBER = {3},
- PAGES = {287--315},
- MONTH = {June},
- YEAR = {1993}
-}
-
-@INPROCEEDINGS{manoury94,
- AUTHOR = {P. Manoury},
- TITLE = {{A User's Friendly Syntax to Define
-Recursive Functions as Typed $\lambda-$Terms}},
- BOOKTITLE = {{Types for Proofs and Programs, TYPES'94}},
- SERIES = {LNCS},
- VOLUME = {996},
- MONTH = jun,
- YEAR = {1994}
-}
-
-@TECHREPORT{maranget94,
- AUTHOR = {L. Maranget},
- INSTITUTION = {INRIA},
- NUMBER = {2385},
- TITLE = {{Two Techniques for Compiling Lazy Pattern Matching}},
- YEAR = {1994}
-}
-
-@INPROCEEDINGS{puel-suarez90,
- AUTHOR = {L.Puel and A. Su\'arez},
- BOOKTITLE = {{Conference Lisp and Functional Programming}},
- SERIES = {ACM},
- PUBLISHER = SV,
- TITLE = {{Compiling Pattern Matching by Term
-Decomposition}},
- YEAR = {1990}
-}
-
-@MASTERSTHESIS{saidi94,
- AUTHOR = {H. Saidi},
- MONTH = sep,
- SCHOOL = {DEA d'Informatique Fondamentale, Universit\'e Paris 7},
- TITLE = {R\'esolution d'\'equations dans le syst\`eme T
- de G\"odel},
- YEAR = {1994}
-}
-
-@misc{streicher93semantical,
- author = "T. Streicher",
- title = "Semantical Investigations into Intensional Type Theory",
- note = "Habilitationsschrift, LMU Munchen.",
- year = "1993" }
-
-
-
-@Misc{Pcoq,
- author = {Lemme Team},
- title = {Pcoq a graphical user-interface for {Coq}},
- note = {\url{http://www-sop.inria.fr/lemme/pcoq/}}
-}
-
-
-@Misc{ProofGeneral,
- author = {David Aspinall},
- title = {Proof General},
- note = {\url{https://proofgeneral.github.io/}}
-}
-
-
-
-@Book{CoqArt,
- author = {Yves bertot and Pierre Castéran},
- title = {Coq'Art},
- publisher = {Springer-Verlag},
- year = 2004,
- note = {To appear}
-}
-
-@INCOLLECTION{wadler87,
- AUTHOR = {P. Wadler},
- TITLE = {Efficient Compilation of Pattern Matching},
- BOOKTITLE = {The Implementation of Functional Programming
-Languages},
- EDITOR = {S.L. Peyton Jones},
- PUBLISHER = {Prentice-Hall},
- YEAR = {1987}
-}
-
-
-@COMMENT{cross-references, must be at end}
-
-@BOOK{Bastad92,
- EDITOR = {B. Nordstr\"om and K. Petersson and G. Plotkin},
- PUBLISHER = {Available by ftp at site ftp.inria.fr},
- TITLE = {Proceedings of the 1992 Workshop on Types for Proofs and Programs},
- YEAR = {1992}
-}
-
-@BOOK{Nijmegen93,
- EDITOR = {H. Barendregt and T. Nipkow},
- PUBLISHER = SV,
- SERIES = LNCS,
- TITLE = {Types for Proofs and Programs},
- VOLUME = {806},
- YEAR = {1994}
-}
-
-@PHDTHESIS{Luo90,
- AUTHOR = {Z. Luo},
- TITLE = {An Extended Calculus of Constructions},
- SCHOOL = {University of Edinburgh},
- YEAR = {1990}
-}
diff --git a/doc/faq/hevea.sty b/doc/faq/hevea.sty
deleted file mode 100644
index 6d49aa8ce..000000000
--- a/doc/faq/hevea.sty
+++ /dev/null
@@ -1,78 +0,0 @@
-% hevea : hevea.sty
-% This is a very basic style file for latex document to be processed
-% with hevea. It contains definitions of LaTeX environment which are
-% processed in a special way by the translator.
-% Mostly :
-% - latexonly, not processed by hevea, processed by latex.
-% - htmlonly , the reverse.
-% - rawhtml, to include raw HTML in hevea output.
-% - toimage, to send text to the image file.
-% The package also provides hevea logos, html related commands (ahref
-% etc.), void cutting and image commands.
-\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{hevea}[2002/01/11]
-\RequirePackage{comment}
-\newif\ifhevea\heveafalse
-\@ifundefined{ifimagen}{\newif\ifimagen\imagenfalse}
-\makeatletter%
-\newcommand{\heveasmup}[2]{%
-\raise #1\hbox{$\m@th$%
- \csname S@\f@size\endcsname
- \fontsize\sf@size 0%
- \math@fontsfalse\selectfont
-#2%
-}}%
-\DeclareRobustCommand{\hevea}{H\kern-.15em\heveasmup{.2ex}{E}\kern-.15emV\kern-.15em\heveasmup{.2ex}{E}\kern-.15emA}%
-\DeclareRobustCommand{\hacha}{H\kern-.15em\heveasmup{.2ex}{A}\kern-.15emC\kern-.1em\heveasmup{.2ex}{H}\kern-.15emA}%
-\DeclareRobustCommand{\html}{\protect\heveasmup{0.ex}{HTML}}
-%%%%%%%%% Hyperlinks hevea style
-\newcommand{\ahref}[2]{{#2}}
-\newcommand{\ahrefloc}[2]{{#2}}
-\newcommand{\aname}[2]{{#2}}
-\newcommand{\ahrefurl}[1]{\texttt{#1}}
-\newcommand{\footahref}[2]{#2\footnote{\texttt{#1}}}
-\newcommand{\mailto}[1]{\texttt{#1}}
-\newcommand{\imgsrc}[2][]{}
-\newcommand{\home}[1]{\protect\raisebox{-.75ex}{\char126}#1}
-\AtBeginDocument
-{\@ifundefined{url}
-{%url package is not loaded
-\let\url\ahref\let\oneurl\ahrefurl\let\footurl\footahref}
-{}}
-%% Void cutting instructions
-\newcounter{cuttingdepth}
-\newcommand{\tocnumber}{}
-\newcommand{\notocnumber}{}
-\newcommand{\cuttingunit}{}
-\newcommand{\cutdef}[2][]{}
-\newcommand{\cuthere}[2]{}
-\newcommand{\cutend}{}
-\newcommand{\htmlhead}[1]{}
-\newcommand{\htmlfoot}[1]{}
-\newcommand{\htmlprefix}[1]{}
-\newenvironment{cutflow}[1]{}{}
-\newcommand{\cutname}[1]{}
-\newcommand{\toplinks}[3]{}
-%%%% Html only
-\excludecomment{rawhtml}
-\newcommand{\rawhtmlinput}[1]{}
-\excludecomment{htmlonly}
-%%%% Latex only
-\newenvironment{latexonly}{}{}
-\newenvironment{verblatex}{}{}
-%%%% Image file stuff
-\def\toimage{\endgroup}
-\def\endtoimage{\begingroup\def\@currenvir{toimage}}
-\def\verbimage{\endgroup}
-\def\endverbimage{\begingroup\def\@currenvir{verbimage}}
-\newcommand{\imageflush}[1][]{}
-%%% Bgcolor definition
-\newsavebox{\@bgcolorbin}
-\newenvironment{bgcolor}[2][]
- {\newcommand{\@mycolor}{#2}\begin{lrbox}{\@bgcolorbin}\vbox\bgroup}
- {\egroup\end{lrbox}%
- \begin{flushleft}%
- \colorbox{\@mycolor}{\usebox{\@bgcolorbin}}%
- \end{flushleft}}
-%%% Postlude
-\makeatother
diff --git a/doc/faq/interval_discr.v b/doc/faq/interval_discr.v
deleted file mode 100644
index 671dc988a..000000000
--- a/doc/faq/interval_discr.v
+++ /dev/null
@@ -1,419 +0,0 @@
-(** Sketch of the proof of {p:nat|p<=n} = {p:nat|p<=m} -> n=m
-
- - preliminary results on the irrelevance of boundedness proofs
- - introduce the notion of finite cardinal |A|
- - prove that |{p:nat|p<=n}| = n
- - prove that |A| = n /\ |A| = m -> n = m if equality is decidable on A
- - prove that equality is decidable on A
- - conclude
-*)
-
-(** * Preliminary results on [nat] and [le] *)
-
-(** Proving axiom K on [nat] *)
-
-Require Import Eqdep_dec.
-Require Import Arith.
-
-Theorem eq_rect_eq_nat :
- forall (p:nat) (Q:nat->Type) (x:Q p) (h:p=p), x = eq_rect p Q x p h.
-Proof.
-intros.
-apply K_dec_set with (p := h).
-apply eq_nat_dec.
-reflexivity.
-Qed.
-
-(** Proving unicity of proofs of [(n<=m)%nat] *)
-
-Scheme le_ind' := Induction for le Sort Prop.
-
-Theorem le_uniqueness_proof : forall (n m : nat) (p q : n <= m), p = q.
-Proof.
-induction p using le_ind'; intro q.
- replace (le_n n) with
- (eq_rect _ (fun n0 => n <= n0) (le_n n) _ eq_refl).
- 2:reflexivity.
- generalize (eq_refl n).
- pattern n at 2 4 6 10, q; case q; [intro | intros m l e].
- rewrite <- eq_rect_eq_nat; trivial.
- contradiction (le_Sn_n m); rewrite <- e; assumption.
- replace (le_S n m p) with
- (eq_rect _ (fun n0 => n <= n0) (le_S n m p) _ eq_refl).
- 2:reflexivity.
- generalize (eq_refl (S m)).
- pattern (S m) at 1 3 4 6, q; case q; [intro Heq | intros m0 l HeqS].
- contradiction (le_Sn_n m); rewrite Heq; assumption.
- injection HeqS; intro Heq; generalize l HeqS.
- rewrite <- Heq; intros; rewrite <- eq_rect_eq_nat.
- rewrite (IHp l0); reflexivity.
-Qed.
-
-(** Proving irrelevance of boundedness proofs while building
- elements of interval *)
-
-Lemma dep_pair_intro :
- forall (n x y:nat) (Hx : x<=n) (Hy : y<=n), x=y ->
- exist (fun x => x <= n) x Hx = exist (fun x => x <= n) y Hy.
-Proof.
-intros n x y Hx Hy Heq.
-generalize Hy.
-rewrite <- Heq.
-intros.
-rewrite (le_uniqueness_proof x n Hx Hy0).
-reflexivity.
-Qed.
-
-(** * Proving that {p:nat|p<=n} = {p:nat|p<=m} -> n=m *)
-
-(** Definition of having finite cardinality [n+1] for a set [A] *)
-
-Definition card (A:Set) n :=
- exists f,
- (forall x:A, f x <= n) /\
- (forall x y:A, f x = f y -> x = y) /\
- (forall m, m <= n -> exists x:A, f x = m).
-
-Require Import Arith.
-
-(** Showing that the interval [0;n] has cardinality [n+1] *)
-
-Theorem card_interval : forall n, card {x:nat|x<=n} n.
-Proof.
-intro n.
-exists (fun x:{x:nat|x<=n} => proj1_sig x).
-split.
-(* bounded *)
-intro x; apply (proj2_sig x).
-split.
-(* injectivity *)
-intros (p,Hp) (q,Hq).
-simpl.
-intro Hpq.
-apply dep_pair_intro; assumption.
-(* surjectivity *)
-intros m Hmn.
-exists (exist (fun x : nat => x <= n) m Hmn).
-reflexivity.
-Qed.
-
-(** Showing that equality on the interval [0;n] is decidable *)
-
-Lemma interval_dec :
- forall n (x y : {m:nat|m<=n}), {x=y}+{x<>y}.
-Proof.
-intros n (p,Hp).
-induction p; intros ([|q],Hq).
-left.
- apply dep_pair_intro.
- reflexivity.
-right.
- intro H; discriminate H.
-right.
- intro H; discriminate H.
-assert (Hp' : p <= n).
- apply le_Sn_le; assumption.
-assert (Hq' : q <= n).
- apply le_Sn_le; assumption.
-destruct (IHp Hp' (exist (fun m => m <= n) q Hq'))
- as [Heq|Hneq].
-left.
- injection Heq; intro Heq'.
- apply dep_pair_intro.
- apply eq_S.
- assumption.
-right.
- intro HeqS.
- injection HeqS; intro Heq.
- apply Hneq.
- apply dep_pair_intro.
- assumption.
-Qed.
-
-(** Showing that the cardinality relation is functional on decidable sets *)
-
-Lemma card_inj_aux :
- forall (A:Type) f g n,
- (forall x:A, f x <= 0) ->
- (forall x y:A, f x = f y -> x = y) ->
- (forall m, m <= S n -> exists x:A, g x = m)
- -> False.
-Proof.
-intros A f g n Hfbound Hfinj Hgsurj.
-destruct (Hgsurj (S n) (le_n _)) as (x,Hx).
-destruct (Hgsurj n (le_S _ _ (le_n _))) as (x',Hx').
-assert (Hfx : 0 = f x).
-apply le_n_O_eq.
-apply Hfbound.
-assert (Hfx' : 0 = f x').
-apply le_n_O_eq.
-apply Hfbound.
-assert (x=x').
-apply Hfinj.
-rewrite <- Hfx.
-rewrite <- Hfx'.
-reflexivity.
-rewrite H in Hx.
-rewrite Hx' in Hx.
-apply (n_Sn _ Hx).
-Qed.
-
-(** For [dec_restrict], we use a lemma on the negation of equality
-that requires proof-irrelevance. It should be possible to avoid this
-lemma by generalizing over a first-order definition of [x<>y], say
-[neq] such that [{x=y}+{neq x y}] and [~(x=y /\ neq x y)]; for such
-[neq], unicity of proofs could be proven *)
-
- Require Import Classical.
- Lemma neq_dep_intro :
- forall (A:Set) (z x y:A) (p:x<>z) (q:y<>z), x=y ->
- exist (fun x => x <> z) x p = exist (fun x => x <> z) y q.
- Proof.
- intros A z x y p q Heq.
- generalize q; clear q; rewrite <- Heq; intro q.
- rewrite (proof_irrelevance _ p q); reflexivity.
- Qed.
-
-Lemma dec_restrict :
- forall (A:Set),
- (forall x y :A, {x=y}+{x<>y}) ->
- forall z (x y :{a:A|a<>z}), {x=y}+{x<>y}.
-Proof.
-intros A Hdec z (x,Hx) (y,Hy).
-destruct (Hdec x y) as [Heq|Hneq].
-left; apply neq_dep_intro; assumption.
-right; intro Heq; injection Heq; exact Hneq.
-Qed.
-
-Lemma pred_inj : forall n m,
- 0 <> n -> 0 <> m -> pred m = pred n -> m = n.
-Proof.
-destruct n.
-intros m H; destruct H; reflexivity.
-destruct m.
-intros _ H; destruct H; reflexivity.
-simpl; intros _ _ H.
-rewrite H.
-reflexivity.
-Qed.
-
-Lemma le_neq_lt : forall n m, n <= m -> n<>m -> n < m.
-Proof.
-intros n m Hle Hneq.
-destruct (le_lt_eq_dec n m Hle).
-assumption.
-contradiction.
-Qed.
-
-Lemma inj_restrict :
- forall (A:Set) (f:A->nat) x y z,
- (forall x y : A, f x = f y -> x = y)
- -> x <> z -> f y < f z -> f z <= f x
- -> pred (f x) = f y
- -> False.
-
-(* Search error sans le type de f !! *)
-Proof.
-intros A f x y z Hfinj Hneqx Hfy Hfx Heq.
-assert (f z <> f x).
- apply not_eq_sym.
- intro Heqf.
- apply Hneqx.
- apply Hfinj.
- assumption.
-assert (f x = S (f y)).
- assert (0 < f x).
- apply le_lt_trans with (f z).
- apply le_O_n.
- apply le_neq_lt; assumption.
- apply pred_inj.
- apply O_S.
- apply lt_O_neq; assumption.
- exact Heq.
-assert (f z <= f y).
-destruct (le_lt_or_eq _ _ Hfx).
- apply lt_n_Sm_le.
- rewrite <- H0.
- assumption.
- contradiction Hneqx.
- symmetry.
- apply Hfinj.
- assumption.
-contradiction (lt_not_le (f y) (f z)).
-Qed.
-
-Theorem card_inj : forall m n (A:Set),
- (forall x y :A, {x=y}+{x<>y}) ->
- card A m -> card A n -> m = n.
-Proof.
-induction m; destruct n;
-intros A Hdec
- (f,(Hfbound,(Hfinj,Hfsurj)))
- (g,(Hgbound,(Hginj,Hgsurj))).
-(* 0/0 *)
-reflexivity.
-(* 0/Sm *)
-destruct (card_inj_aux _ _ _ _ Hfbound Hfinj Hgsurj).
-(* Sn/0 *)
-destruct (card_inj_aux _ _ _ _ Hgbound Hginj Hfsurj).
-(* Sn/Sm *)
-destruct (Hgsurj (S n) (le_n _)) as (xSn,HSnx).
-rewrite IHm with (n:=n) (A := {x:A|x<>xSn}).
-reflexivity.
-(* decidability of eq on {x:A|x<>xSm} *)
-apply dec_restrict.
-assumption.
-(* cardinality of {x:A|x<>xSn} is m *)
-pose (f' := fun x' : {x:A|x<>xSn} =>
- let (x,Hneq) := x' in
- if le_lt_dec (f xSn) (f x)
- then pred (f x)
- else f x).
-exists f'.
-split.
-(* f' is bounded *)
-unfold f'.
-intros (x,_).
-destruct (le_lt_dec (f xSn) (f x)) as [Hle|Hge].
-change m with (pred (S m)).
-apply le_pred.
-apply Hfbound.
-apply le_S_n.
-apply le_trans with (f xSn).
-exact Hge.
-apply Hfbound.
-split.
-(* f' is injective *)
-unfold f'.
-intros (x,Hneqx) (y,Hneqy) Heqf'.
-destruct (le_lt_dec (f xSn) (f x)) as [Hlefx|Hgefx];
-destruct (le_lt_dec (f xSn) (f y)) as [Hlefy|Hgefy].
-(* f xSn <= f x et f xSn <= f y *)
-assert (Heq : x = y).
- apply Hfinj.
- assert (f xSn <> f y).
- apply not_eq_sym.
- intro Heqf.
- apply Hneqy.
- apply Hfinj.
- assumption.
- assert (0 < f y).
- apply le_lt_trans with (f xSn).
- apply le_O_n.
- apply le_neq_lt; assumption.
- assert (f xSn <> f x).
- apply not_eq_sym.
- intro Heqf.
- apply Hneqx.
- apply Hfinj.
- assumption.
- assert (0 < f x).
- apply le_lt_trans with (f xSn).
- apply le_O_n.
- apply le_neq_lt; assumption.
- apply pred_inj.
- apply lt_O_neq; assumption.
- apply lt_O_neq; assumption.
- assumption.
-apply neq_dep_intro; assumption.
-(* f y < f xSn <= f x *)
-destruct (inj_restrict A f x y xSn); assumption.
-(* f x < f xSn <= f y *)
-symmetry in Heqf'.
-destruct (inj_restrict A f y x xSn); assumption.
-(* f x < f xSn et f y < f xSn *)
-assert (Heq : x=y).
- apply Hfinj; assumption.
-apply neq_dep_intro; assumption.
-(* f' is surjective *)
-intros p Hlep.
-destruct (le_lt_dec (f xSn) p) as [Hle|Hlt].
-(* case f xSn <= p *)
-destruct (Hfsurj (S p) (le_n_S _ _ Hlep)) as (x,Hx).
-assert (Hneq : x <> xSn).
- intro Heqx.
- rewrite Heqx in Hx.
- rewrite Hx in Hle.
- apply le_Sn_n with p; assumption.
-exists (exist (fun a => a<>xSn) x Hneq).
-unfold f'.
-destruct (le_lt_dec (f xSn) (f x)) as [Hle'|Hlt'].
-rewrite Hx; reflexivity.
-rewrite Hx in Hlt'.
-contradiction (le_not_lt (f xSn) p).
-apply lt_trans with (S p).
-apply lt_n_Sn.
-assumption.
-(* case p < f xSn *)
-destruct (Hfsurj p (le_S _ _ Hlep)) as (x,Hx).
-assert (Hneq : x <> xSn).
- intro Heqx.
- rewrite Heqx in Hx.
- rewrite Hx in Hlt.
- apply (lt_irrefl p).
- assumption.
-exists (exist (fun a => a<>xSn) x Hneq).
-unfold f'.
-destruct (le_lt_dec (f xSn) (f x)) as [Hle'|Hlt'].
- rewrite Hx in Hle'.
- contradiction (lt_irrefl p).
- apply lt_le_trans with (f xSn); assumption.
- assumption.
-(* cardinality of {x:A|x<>xSn} is n *)
-pose (g' := fun x' : {x:A|x<>xSn} =>
- let (x,Hneq) := x' in
- if Hdec x xSn then 0 else g x).
-exists g'.
-split.
-(* g is bounded *)
-unfold g'.
-intros (x,_).
-destruct (Hdec x xSn) as [_|Hneq].
-apply le_O_n.
-assert (Hle_gx:=Hgbound x).
-destruct (le_lt_or_eq _ _ Hle_gx).
-apply lt_n_Sm_le.
-assumption.
-contradiction Hneq.
-apply Hginj.
-rewrite HSnx.
-assumption.
-split.
-(* g is injective *)
-unfold g'.
-intros (x,Hneqx) (y,Hneqy) Heqg'.
-destruct (Hdec x xSn) as [Heqx|_].
-contradiction Hneqx.
-destruct (Hdec y xSn) as [Heqy|_].
-contradiction Hneqy.
-assert (Heq : x=y).
- apply Hginj; assumption.
-apply neq_dep_intro; assumption.
-(* g is surjective *)
-intros p Hlep.
-destruct (Hgsurj p (le_S _ _ Hlep)) as (x,Hx).
-assert (Hneq : x<>xSn).
- intro Heq.
- rewrite Heq in Hx.
- rewrite Hx in HSnx.
- rewrite HSnx in Hlep.
- contradiction (le_Sn_n _ Hlep).
-exists (exist (fun a => a<>xSn) x Hneq).
-simpl.
-destruct (Hdec x xSn) as [Heqx|_].
-contradiction Hneq.
-assumption.
-Qed.
-
-(** Conclusion *)
-
-Theorem interval_discr :
- forall n m, {p:nat|p<=n} = {p:nat|p<=m} -> n=m.
-Proof.
-intros n m Heq.
-apply card_inj with (A := {p:nat|p<=n}).
-apply interval_dec.
-apply card_interval.
-rewrite Heq.
-apply card_interval.
-Qed.
diff --git a/doc/refman/AsyncProofs.tex b/doc/refman/AsyncProofs.tex
index 30039d489..8f9d876cb 100644
--- a/doc/refman/AsyncProofs.tex
+++ b/doc/refman/AsyncProofs.tex
@@ -1,4 +1,4 @@
-\achapter{Asynchronous and Parallel Proof Processing}
+\achapter{Asynchronous and Parallel Proof Processing\label{Asyncprocessing}}
%HEVEA\cutname{async-proofs.html}
\aauthor{Enrico Tassi}
diff --git a/doc/refman/Cases.tex b/doc/refman/Cases.tex
index 7ad895f9d..376ef031d 100644
--- a/doc/refman/Cases.tex
+++ b/doc/refman/Cases.tex
@@ -280,6 +280,18 @@ Fail Check
end).
\end{coq_example}
+The option {\tt Set Asymmetric Patterns} \optindex{Asymmetric Patterns}
+(off by default) removes parameters from constructors in patterns:
+\begin{coq_example}
+ Set Asymmetric Patterns.
+ Check (fun l:List nat =>
+ match l with
+ | nil => nil
+ | cons _ l' => l'
+ end)
+ Unset Asymmetric Patterns.
+\end{coq_example}
+
\paragraph{Implicit arguments in patterns}
By default, implicit arguments are omitted in patterns. So we write:
diff --git a/doc/refman/Classes.tex b/doc/refman/Classes.tex
index 22c75b4fc..6e76d04e7 100644
--- a/doc/refman/Classes.tex
+++ b/doc/refman/Classes.tex
@@ -462,11 +462,18 @@ abbreviate a type, like {\tt relation A := A -> A -> Prop}.
This is equivalent to {\tt Hint Transparent,Opaque} {\ident} {\tt: typeclass\_instances}.
+\subsection{\tt Set Typeclasses Axioms Are Instances}
+\optindex{Typeclasses Axioms Are Instances}
+
+This option (off by default since 8.8) automatically declares axioms
+whose type is a typeclass at declaration time as instances of that
+class.
+
\subsection{\tt Set Typeclasses Dependency Order}
\optindex{Typeclasses Dependency Order}
This option (on by default since 8.6) respects the dependency order between
-subgoals, meaning that subgoals which are depended on by other subgoals
+subgoals, meaning that subgoals which are depended on by other subgoals
come first, while the non-dependent subgoals were put before the
dependent ones previously (Coq v8.5 and below). This can result in quite
different performance behaviors of proof search.
@@ -519,14 +526,14 @@ potentially more expensive proof-search (i.e. more useless
backtracking).
\subsection{\tt Set Typeclass Resolution After Apply}
-\optindex{Typeclasses Resolution After Apply}
+\optindex{Typeclass Resolution After Apply}
\emph{Deprecated since 8.6}
This option (off by default in Coq 8.6 and 8.5) controls the resolution
of typeclass subgoals generated by the {\tt apply} tactic.
\subsection{\tt Set Typeclass Resolution For Conversion}
-\optindex{Typeclasses Resolution For Conversion}
+\optindex{Typeclass Resolution For Conversion}
This option (on by default) controls the use of typeclass resolution
when a unification problem cannot be solved during
diff --git a/doc/refman/Extraction.tex b/doc/refman/Extraction.tex
index 83e866e9f..cff7be3e9 100644
--- a/doc/refman/Extraction.tex
+++ b/doc/refman/Extraction.tex
@@ -1,4 +1,4 @@
-\achapter{Extraction of programs in Objective Caml and Haskell}
+\achapter{Extraction of programs in OCaml and Haskell}
%HEVEA\cutname{extraction.html}
\label{Extraction}
\aauthor{Jean-Christophe Filliâtre and Pierre Letouzey}
@@ -95,12 +95,12 @@ one monolithic file or one file per \Coq\ library.
\begin{description}
\item {\tt Extraction TestCompile} \qualid$_1$ \dots\ \qualid$_n$. ~\par
All the globals (or modules) \qualid$_1$ \dots\ \qualid$_n$ and all
- their dependencies are extracted to a temporary Ocaml file, just as in
+ their dependencies are extracted to a temporary {\ocaml} file, just as in
{\tt Extraction "{\em file}"}. Then this temporary file and its
- signature are compiled with the same Ocaml compiler used to built
- \Coq. This command succeeds only if the extraction and the Ocaml
+ signature are compiled with the same {\ocaml} compiler used to built
+ \Coq. This command succeeds only if the extraction and the {\ocaml}
compilation succeed (and it fails if the current target language
- of the extraction is not Ocaml).
+ of the extraction is not {\ocaml}).
\end{description}
\asection{Extraction options}
@@ -109,26 +109,26 @@ one monolithic file or one file per \Coq\ library.
\comindex{Extraction Language}
The ability to fix target language is the first and more important
-of the extraction options. Default is Ocaml.
+of the extraction options. Default is {\ocaml}.
\begin{description}
-\item {\tt Extraction Language Ocaml}.
+\item {\tt Extraction Language OCaml}.
\item {\tt Extraction Language Haskell}.
\item {\tt Extraction Language Scheme}.
\end{description}
\asubsection{Inlining and optimizations}
-Since Objective Caml is a strict language, the extracted code has to
+Since {\ocaml} is a strict language, the extracted code has to
be optimized in order to be efficient (for instance, when using
induction principles we do not want to compute all the recursive calls
but only the needed ones). So the extraction mechanism provides an
automatic optimization routine that will be called each time the user
-want to generate Ocaml programs. The optimizations can be split in two
+want to generate {\ocaml} programs. The optimizations can be split in two
groups: the type-preserving ones -- essentially constant inlining and
reductions -- and the non type-preserving ones -- some function
abstractions of dummy types are removed when it is deemed safe in order
to have more elegant types. Therefore some constants may not appear in the
-resulting monolithic Ocaml program. In the case of modular extraction,
+resulting monolithic {\ocaml} program. In the case of modular extraction,
even if some inlining is done, the inlined constant are nevertheless
printed, to ensure session-independent programs.
@@ -367,15 +367,15 @@ As for {\tt Extract Inductive}, this command should be used with care:
\item Extracting an inductive type to a pre-existing ML inductive type
is quite sound. But extracting to a general type (by providing an
ad-hoc pattern-matching) will often \emph{not} be fully rigorously
-correct. For instance, when extracting {\tt nat} to Ocaml's {\tt
+correct. For instance, when extracting {\tt nat} to {\ocaml}'s {\tt
int}, it is theoretically possible to build {\tt nat} values that are
-larger than Ocaml's {\tt max\_int}. It is the user's responsibility to
+larger than {\ocaml}'s {\tt max\_int}. It is the user's responsibility to
be sure that no overflow or other bad events occur in practice.
\item Translating an inductive type to an ML type does \emph{not}
magically improve the asymptotic complexity of functions, even if the
ML type is an efficient representation. For instance, when extracting
-{\tt nat} to Ocaml's {\tt int}, the function {\tt mult} stays
+{\tt nat} to {\ocaml}'s {\tt int}, the function {\tt mult} stays
quadratic. It might be interesting to associate this translation with
some specific {\tt Extract Constant} when primitive counterparts exist.
\end{itemize}
@@ -391,16 +391,18 @@ Extract Inductive bool => "bool" [ "true" "false" ].
Extract Inductive sumbool => "bool" [ "true" "false" ].
\end{coq_example}
-\noindent If an inductive constructor or type has arity 2 and the corresponding
-string is enclosed by parenthesis, then the rest of the string is used
-as infix constructor or type.
+\noindent When extracting to {\ocaml}, if an inductive constructor or type
+has arity 2 and the corresponding string is enclosed by parentheses,
+and the string meets {\ocaml}'s lexical criteria for an infix symbol,
+then the rest of the string is used as infix constructor or type.
+
\begin{coq_example}
Extract Inductive list => "list" [ "[]" "(::)" ].
Extract Inductive prod => "(*)" [ "(,)" ].
\end{coq_example}
\noindent As an example of translation to a non-inductive datatype, let's turn
-{\tt nat} into Ocaml's {\tt int} (see caveat above):
+{\tt nat} into {\ocaml}'s {\tt int} (see caveat above):
\begin{coq_example}
Extract Inductive nat => int [ "0" "succ" ]
"(fun fO fS n -> if n=0 then fO () else fS (n-1))".
@@ -415,7 +417,7 @@ directly depends from the names of the \Coq\ files. It may happen that
these filenames are in conflict with already existing files,
either in the standard library of the target language or in other
code that is meant to be linked with the extracted code.
-For instance the module {\tt List} exists both in \Coq\ and in Ocaml.
+For instance the module {\tt List} exists both in \Coq\ and in {\ocaml}.
It is possible to instruct the extraction not to use particular filenames.
\begin{description}
@@ -428,7 +430,7 @@ It is possible to instruct the extraction not to use particular filenames.
Allow the extraction to use any filename.
\end{description}
-\noindent For Ocaml, a typical use of these commands is
+\noindent For {\ocaml}, a typical use of these commands is
{\tt Extraction Blacklist String List}.
\asection{Differences between \Coq\ and ML type systems}
@@ -436,7 +438,7 @@ It is possible to instruct the extraction not to use particular filenames.
Due to differences between \Coq\ and ML type systems,
some extracted programs are not directly typable in ML.
-We now solve this problem (at least in Ocaml) by adding
+We now solve this problem (at least in {\ocaml}) by adding
when needed some unsafe casting {\tt Obj.magic}, which give
a generic type {\tt 'a} to any term.
@@ -453,7 +455,7 @@ Definition dp :=
fun (A B:Set)(x:A)(y:B)(f:forall C:Set, C->C) => (f A x, f B y).
\end{verbatim}
-In Ocaml, for instance, the direct extracted term would be
+In {\ocaml}, for instance, the direct extracted term would be
\begin{verbatim}
let dp x y f = Pair((f () x),(f () y))
\end{verbatim}
@@ -478,13 +480,13 @@ Inductive anything : Type := dummy : forall A:Set, A -> anything.
\end{verbatim}
which corresponds to the definition of an ML dynamic type.
-In Ocaml, we must cast any argument of the constructor dummy.
+In {\ocaml}, we must cast any argument of the constructor dummy.
\end{itemize}
\noindent Even with those unsafe castings, you should never get error like
``segmentation fault''. In fact even if your program may seem
-ill-typed to the Ocaml type-checker, it can't go wrong: it comes
+ill-typed to the {\ocaml} type-checker, it can't go wrong: it comes
from a Coq well-typed terms, so for example inductives will always
have the correct number of arguments, etc.
diff --git a/doc/refman/Omega.tex b/doc/refman/Omega.tex
index 8025fbe29..82765da6e 100644
--- a/doc/refman/Omega.tex
+++ b/doc/refman/Omega.tex
@@ -149,6 +149,32 @@ intro; omega.
% Other examples can be found in \verb+$COQLIB/theories/DEMOS/OMEGA+.
+\section{Options}
+
+\begin{quote}
+ \optindex{Stable Omega}
+ {\tt Unset Stable Omega}
+\end{quote}
+This deprecated option (on by default) is for compatibility with Coq
+pre 8.5. It resets internal name counters to make executions of
+{\tt omega} independent.
+
+\begin{quote}
+ \optindex{Omega UseLocalDefs}
+ {\tt Unset Omega UseLocalDefs}
+\end{quote}
+This option (on by default) allows {\tt omega} to use the bodies of
+local variables.
+
+\begin{quote}
+ \optindex{Omega System}
+ {\tt Set Omega System}
+ \optindex{Omega Action}
+ {\tt Set Omega Action}
+\end{quote}
+These two options (off by default) activate the printing of debug
+information.
+
\asection{Technical data}
\label{technical}
diff --git a/doc/refman/RefMan-com.tex b/doc/refman/RefMan-com.tex
index 8b1fc7c8f..04a8a25c1 100644
--- a/doc/refman/RefMan-com.tex
+++ b/doc/refman/RefMan-com.tex
@@ -299,8 +299,9 @@ The following command-line options are recognized by the commands {\tt
\section{Compiled libraries checker ({\tt coqchk})}
-The {\tt coqchk} command takes a list of library paths as argument.
-The corresponding compiled libraries (.vo files) are searched in the
+The {\tt coqchk} command takes a list of library paths as argument, described
+either by their logical name or by their physical filename, which must end in
+{\tt .vo}. The corresponding compiled libraries (.vo files) are searched in the
path, recursively processing the libraries they depend on. The content
of all these libraries is then type-checked. The effect of {\tt
coqchk} is only to return with normal exit code in case of success,
@@ -330,9 +331,12 @@ code, it cannot be guaranteed that the produced compiled libraries are
correct. {\tt coqchk} is a standalone verifier, and thus it cannot be
tainted by such malicious code.
-Command-line options {\tt -I}, {\tt -R}, {\tt -where} and
+Command-line options {\tt -Q}, {\tt -R}, {\tt -where} and
{\tt -impredicative-set} are supported by {\tt coqchk} and have the
-same meaning as for {\tt coqtop}. Extra options are:
+same meaning as for {\tt coqtop}. As there is no notion of relative paths in
+object files {\tt -Q} and {\tt -R} have exactly the same meaning.
+
+Extra options are:
\begin{description}
\item[{\tt -norec} {\em module}]\ %
diff --git a/doc/refman/RefMan-ext.tex b/doc/refman/RefMan-ext.tex
index 5c519e46e..a1950d136 100644
--- a/doc/refman/RefMan-ext.tex
+++ b/doc/refman/RefMan-ext.tex
@@ -550,6 +550,60 @@ the same way as the {\Coq} kernel handles them.
This tells if the printing matching mode is on or off. The default is
on.
+\subsubsection{Factorization of clauses with same right-hand side}
+\label{SetPrintingFactorizableMatchPatterns}
+\optindex{Printing Factorizable Match Patterns}
+
+When several patterns share the same right-hand side, it is
+additionally possible to share the clauses using disjunctive patterns.
+Assuming that the printing matching mode is on, whether {\Coq}'s
+printer shall try to do this kind of factorization is governed by the
+following commands:
+
+\begin{quote}
+{\tt Set Printing Factorizable Match Patterns.}
+\end{quote}
+This tells {\Coq}'s printer to try to use disjunctive patterns. This is the default
+behavior.
+
+\begin{quote}
+{\tt Unset Printing Factorizable Match Patterns.}
+\end{quote}
+This tells {\Coq}'s printer not to try to use disjunctive patterns.
+
+\begin{quote}
+{\tt Test Printing Factorizable Match Patterns.}
+\end{quote}
+This tells if the factorization of clauses with same right-hand side is
+on or off.
+
+\subsubsection{Use of a default clause}
+\label{SetPrintingAllowDefaultClause}
+\optindex{Printing Allow Default Clause}
+
+When several patterns share the same right-hand side which do not
+depend on the arguments of the patterns, yet an extra factorization is
+possible: the disjunction of patterns can be replaced with a ``{\tt
+ \_}'' default clause. Assuming that the printing matching mode and
+the factorization mode are on, whether {\Coq}'s printer shall try to
+use a default clause is governed by the following commands:
+
+\begin{quote}
+{\tt Set Printing Allow Default Clause.}
+\end{quote}
+This tells {\Coq}'s printer to use a default clause when relevant. This is the default
+behavior.
+
+\begin{quote}
+{\tt Unset Printing Allow Default Clause.}
+\end{quote}
+This tells {\Coq}'s printer not to use a default clause.
+
+\begin{quote}
+{\tt Test Printing Allow Default Clause.}
+\end{quote}
+This tells if the use of a default clause is allowed.
+
\subsubsection{Printing of wildcard pattern
\optindex{Printing Wildcard}}
diff --git a/doc/refman/RefMan-ide.tex b/doc/refman/RefMan-ide.tex
index 436099e74..2d9853430 100644
--- a/doc/refman/RefMan-ide.tex
+++ b/doc/refman/RefMan-ide.tex
@@ -44,9 +44,10 @@ bottom is the status bar.
In the script window, you may open arbitrarily many buffers to
edit. The \emph{File} menu allows you to open files or create some,
save them, print or export them into various formats. Among all these
-buffers, there is always one which is the current \emph{running
- buffer}, whose name is displayed on a green background, which is the
-one where Coq commands are currently executed.
+buffers, there is always one which is the current
+\emph{running buffer}, whose name is displayed on a background in the
+\emph{processed} color (green by default), which is the one where Coq commands
+are currently executed.
Buffers may be edited as in any text editor, and classical basic
editing commands (Copy/Paste, \ldots) are available in the \emph{Edit}
@@ -58,12 +59,13 @@ menu.
\section{Interactive navigation into \Coq{} scripts}
The running buffer is the one where navigation takes place. The
-toolbar proposes five basic commands for this. The first one,
+toolbar offers five basic navigation commands. The first one,
represented by a down arrow icon, is for going forward executing one
command. If that command is successful, the part of the script that
-has been executed is displayed on a green background. If that command
-fails, the error message is displayed in the message window, and the
-location of the error is emphasized by a red underline.
+has been executed is displayed on a background with the
+processed color. If that command fails, the error message is
+displayed in the message window, and the location of the error is
+emphasized by an underline in the error foreground color (red by default).
On Figure~\ref{fig:coqide}, the running buffer is \verb|Fermat.v|, all
commands until the \verb|Theorem| have been already executed, and the
@@ -71,23 +73,41 @@ user tried to go forward executing \verb|Induction n|. That command
failed because no such tactic exist (tactics are now in
lowercase\ldots), and the wrong word is underlined.
-Notice that the green part of the running buffer is not editable. If
+Notice that the processed part of the running buffer is not editable. If
you ever want to modify something you have to go backward using the up
arrow tool, or even better, put the cursor where you want to go back
and use the \textsf{goto} button. Unlike with \verb|coqtop|, you
should never use \verb|Undo| to go backward.
-Two additional tool buttons exist, one to go directly to the end and
-one to go back to the beginning. If you try to go to the end, or in
-general to run several commands using the \textsf{goto} button, the
- execution will stop whenever an error is found.
+There are two additional buttons for navigation within the running buffer.
+The ``down'' button with a line goes directly to the end; the ``up'' button
+with a line goes back to the beginning. The handling of errors when using the
+go-to-the-end button depends on whether \Coq{} is running in asynchronous mode or not
+(see Chapter~\ref{Asyncprocessing}). If it is not running in that mode, execution stops
+as soon as an error is found. Otherwise, execution continues, and the
+error is marked with an underline in the error foreground color, with a background in
+the error background color (pink by default). The same characterization of
+error-handling applies when running several commands using the \textsf{goto} button.
If you ever try to execute a command which happens to run during a
long time, and would like to abort it before its
termination, you may use the interrupt button (the white cross on a red circle).
-Finally, notice that these navigation buttons are also available in
-the menu, where their keyboard shortcuts are given.
+There are other buttons on the \CoqIDE{} toolbar: a button to save the running
+buffer; a button to close the current buffer (an ``X''); buttons to switch among
+buffers (left and right arrows); an ``information'' button; and a ``gears'' button.
+
+The ``information'' button is described in Section~\ref{sec:trytactics}.
+
+The ``gears'' button submits proof terms to the \Coq{} kernel for type-checking.
+When \Coq{} uses asynchronous processing (see Chapter~\ref{Asyncprocessing}), proofs may
+have been completed without kernel-checking of generated proof terms. The presence of
+unchecked proof terms is indicated by \texttt{Qed} statements
+that have a subdued \emph{being-processed} color (light blue by default),
+rather than the processed color, though their preceding proofs have the processed color.
+
+Notice that for all these buttons, except for the ``gears'' button, their operations
+are also available in the menu, where their keyboard shortcuts are given.
\section[Try tactics automatically]{Try tactics automatically\label{sec:trytactics}}
@@ -96,8 +116,8 @@ trying to solve the current goal using simple tactics. If such a
tactic succeeds in solving the goal, then its text is automatically
inserted into the script. There is finally a combination of these
tactics, called the \emph{proof wizard} which will try each of them in
-turn. This wizard is also available as a tool button (the light
-bulb). The set of tactics tried by the wizard is customizable in
+turn. This wizard is also available as a tool button (the ``information''
+button). The set of tactics tried by the wizard is customizable in
the preferences.
These tactics are general ones, in particular they do not refer to
@@ -132,7 +152,7 @@ arguments.
\begin{figure}[t]
\begin{center}
-%HEVEA\imgsrc[alt="coqide query window"]{coqide-queries.png}
+%HEVEA\imgsrc[alt="coqide query"]{coqide-queries.png}
%BEGIN LATEX
\ifpdf % si on est en pdflatex
\includegraphics[width=1.0\textwidth]{coqide-queries.png}
@@ -141,27 +161,21 @@ arguments.
\fi
%END LATEX
\end{center}
-\caption{\CoqIDE{}: the query window}
-\label{fig:querywindow}
+\caption{\CoqIDE{}: a Print query on a selected phrase}
+\label{fig:queryselected}
\end{figure}
-
-We call \emph{query} any vernacular command that do not change the
-current state, such as \verb|Check|, \verb|Search|, etc. Those
-commands are of course useless during compilation of a file, hence
-should not be included in scripts. To run such commands without
-writing them in the script, \CoqIDE{} offers another input window
-called the \emph{query window}. This window can be displayed on
-demand, either by using the \texttt{Window} menu, or directly using
-shortcuts given in the \texttt{Queries} menu. Indeed, with \CoqIDE{}
-the simplest way to perform a \texttt{Search} on some identifier
-is to select it using the mouse, and pressing \verb|F2|. This will
-both make appear the query window and run the \texttt{Search} in
-it, displaying the result. Shortcuts \verb|F3| and \verb|F4| are for
-\verb|Check| and \verb|Print| respectively.
-Figure~\ref{fig:querywindow} displays the query window after selection
-of the word ``mult'' in the script windows, and pressing \verb|F4| to
-print its definition.
+We call \emph{query} any vernacular command that does not change the
+current state, such as \verb|Check|, \verb|Search|, etc.
+To run such commands interactively, without writing them in scripts,
+\CoqIDE{} offers a \emph{query pane}.
+The query pane can be displayed on demand by using the \texttt{View} menu,
+or using the shortcut \verb|F1|. Queries can also be performed by
+selecting a particular phrase, then choosing an item from the
+\texttt{Queries} menu. The response then appears in the message window.
+Figure~\ref{fig:queryselected} shows the result after selecting
+of the phrase \verb|Nat.mul| in the script window, and choosing \verb|Print|
+from the \texttt{Queries} menu.
\section{Compilation}
diff --git a/doc/refman/RefMan-ltac.tex b/doc/refman/RefMan-ltac.tex
index 5fb458588..c4c0435c5 100644
--- a/doc/refman/RefMan-ltac.tex
+++ b/doc/refman/RefMan-ltac.tex
@@ -198,8 +198,6 @@ is understood as
{\cpattern} {\tt =>} {\tacexpr}\\
& $|$ & {\tt context} {\zeroone{\ident}} {\tt [} {\cpattern} {\tt ]}
{\tt =>} {\tacexpr}\\
-& $|$ & {\tt appcontext} {\zeroone{\ident}} {\tt [} {\cpattern} {\tt ]}
- {\tt =>} {\tacexpr}\\
& $|$ & {\tt \_ =>} {\tacexpr}\\
\\
{\it test} & ::= &
@@ -311,10 +309,11 @@ A sequence is an expression of the following form:
\begin{quote}
{\tacexpr}$_1$ {\tt ;} {\tacexpr}$_2$
\end{quote}
-The expressions {\tacexpr}$_1$ and {\tacexpr}$_2$ are evaluated
-to $v_1$ and $v_2$ which have to be tactic values. The tactic $v_1$ is
-then applied and $v_2$ is applied to the goals generated by the
-application of $v_1$. Sequence is left-associative.
+The expression {\tacexpr}$_1$ is evaluated to $v_1$, which must be
+a tactic value. The tactic $v_1$ is applied to the current goal,
+possibly producing more goals. Then {\tacexpr}$_2$ is evaluated to
+produce $v_2$, which must be a tactic value. The tactic $v_2$ is applied to
+all the goals produced by the prior application. Sequence is associative.
\subsubsection[Local application of tactics]{Local application of tactics\tacindex{[>\ldots$\mid$\ldots$\mid$\ldots]}\tacindex{;[\ldots$\mid$\ldots$\mid$\ldots]}\index{Tacticals![> \mid ]@{\tt {\tac$_0$};[{\tac$_1$}$\mid$\ldots$\mid$\tac$_n$]}}\index{Tacticals!; [ \mid ]@{\tt {\tac$_0$};[{\tac$_1$}$\mid$\ldots$\mid$\tac$_n$]}}}
%\tacindex{; [ | ]}
@@ -710,6 +709,55 @@ runs is displayed. Time is in seconds and is machine-dependent. The
{\qstring} argument is optional. When provided, it is used to identify
this particular occurrence of {\tt time}.
+\subsubsection{Timing a tactic that evaluates to a term\tacindex{time\_constr}\tacindex{restart\_timer}\tacindex{finish\_timing}
+\index{Tacticals!time\_constr@{\tt time\_constr}}}
+\index{Tacticals!restart\_timer@{\tt restart\_timer}}
+\index{Tacticals!finish\_timing@{\tt finish\_timing}}
+
+Tactic expressions that produce terms can be timed with the experimental tactic
+\begin{quote}
+ {\tt time\_constr} {\tacexpr}
+\end{quote}
+which evaluates {\tacexpr\tt{ ()}}
+and displays the time the tactic expression evaluated, assuming successful evaluation.
+Time is in seconds and is machine-dependent.
+
+This tactic currently does not support nesting, and will report times based on the innermost execution.
+This is due to the fact that it is implemented using the tactics
+\begin{quote}
+ {\tt restart\_timer} {\qstring}
+\end{quote}
+and
+\begin{quote}
+ {\tt finish\_timing} ({\qstring}) {\qstring}
+\end{quote}
+which (re)set and display an optionally named timer, respectively.
+The parenthesized {\qstring} argument to {\tt finish\_timing} is also
+optional, and determines the label associated with the timer for
+printing.
+
+By copying the definition of {\tt time\_constr} from the standard
+library, users can achive support for a fixed pattern of nesting by
+passing different {\qstring} parameters to {\tt restart\_timer} and
+{\tt finish\_timing} at each level of nesting. For example:
+
+\begin{coq_example}
+Ltac time_constr1 tac :=
+ let eval_early := match goal with _ => restart_timer "(depth 1)" end in
+ let ret := tac () in
+ let eval_early := match goal with _ => finish_timing ( "Tactic evaluation" ) "(depth 1)" end in
+ ret.
+
+Goal True.
+ let v := time_constr
+ ltac:(fun _ =>
+ let x := time_constr1 ltac:(fun _ => constr:(10 * 10)) in
+ let y := time_constr1 ltac:(fun _ => eval compute in x) in
+ y) in
+ pose v.
+Abort.
+\end{coq_example}
+
\subsubsection[Local definitions]{Local definitions\index{Ltac!let@\texttt{let}}
\index{Ltac!let rec@\texttt{let rec}}
\index{let@\texttt{let}!in Ltac}
@@ -875,21 +923,6 @@ Goal True.
f (3+4).
\end{coq_example}
-\item \index{appcontext@\texttt{appcontext}!in pattern}
- \optindex{Tactic Compat Context}
-For historical reasons, {\tt context} used to consider $n$-ary applications
-such as {\tt (f 1 2)} as a whole, and not as a sequence of unary
-applications {\tt ((f 1) 2)}. Hence {\tt context [f ?x]} would fail
-to find a matching subterm in {\tt (f 1 2)}: if the pattern was a partial
-application, the matched subterms would have necessarily been
-applications with exactly the same number of arguments.
-As a workaround, one could use the following variant of {\tt context}:
-\begin{quote}
-{\tt appcontext} {\ident} {\tt [} {\cpattern} {\tt ]}
-\end{quote}
-This syntax is now deprecated, as {\tt context} behaves as intended. The former
-behavior can be retrieved with the {\tt Tactic Compat Context} flag.
-
\end{Variants}
\subsubsection[Pattern matching on goals]{Pattern matching on goals\index{Ltac!match goal@\texttt{match goal}}\label{ltac-match-goal}
@@ -1374,10 +1407,35 @@ The following two tactics behave like {\tt idtac} but enable and disable the pro
{\tt stop ltac profiling}.
\end{quote}
+\tacindex{reset ltac profile}\tacindex{show ltac profile}
+The following tactics behave like the corresponding vernacular commands and allow displaying and resetting the profile from tactic scripts for benchmarking purposes.
+
+\begin{quote}
+{\tt reset ltac profile}.
+\end{quote}
+
+\begin{quote}
+{\tt show ltac profile}.
+\end{quote}
+
+\begin{quote}
+{\tt show ltac profile} {\qstring}.
+\end{quote}
+
You can also pass the {\tt -profile-ltac} command line option to {\tt coqc}, which performs a {\tt Set Ltac Profiling} at the beginning of each document, and a {\tt Show Ltac Profile} at the end.
Note that the profiler currently does not handle backtracking into multi-success tactics, and issues a warning to this effect in many cases when such backtracking occurs.
+\subsection[Run-time optimization tactic]{Run-time optimization tactic\label{tactic-optimizeheap}}.
+
+The following tactic behaves like {\tt idtac}, and running it compacts the heap in the
+OCaml run-time system. It is analogous to the Vernacular command {\tt Optimize Heap} (see~\ref{vernac-optimizeheap}).
+
+\tacindex{optimize\_heap}
+\begin{quote}
+{\tt optimize\_heap}.
+\end{quote}
+
\endinput
\subsection{Permutation on closed lists}
diff --git a/doc/refman/RefMan-mod.tex b/doc/refman/RefMan-mod.tex
index e56c8fa7f..b4e270e6c 100644
--- a/doc/refman/RefMan-mod.tex
+++ b/doc/refman/RefMan-mod.tex
@@ -403,10 +403,14 @@ Fail Check B.T.
\end{Warnings}
\subsection{\tt Print Module {\ident}
-\comindex{Print Module}}
+\comindex{Print Module} \optindex{Short Module Printing}}
Prints the module type and (optionally) the body of the module {\ident}.
+For this command and {\tt Print Module Type}, the option {\tt Short
+ Module Printing} (off by default) disables the printing of the types of fields,
+leaving only their names.
+
\subsection{\tt Print Module Type {\ident}
\comindex{Print Module Type}}
diff --git a/doc/refman/RefMan-oth.tex b/doc/refman/RefMan-oth.tex
index 60cd8b73a..1cd23c929 100644
--- a/doc/refman/RefMan-oth.tex
+++ b/doc/refman/RefMan-oth.tex
@@ -10,6 +10,8 @@ defined object referred by {\qualid}.
\begin{ErrMsgs}
\item {\qualid} \errindex{not a defined object}
+\item \errindex{Universe instance should have length} $n$.
+\item \errindex{This object does not support universe names.}
\end{ErrMsgs}
\begin{Variants}
@@ -27,6 +29,11 @@ constructor, abbreviation, \ldots), long name, type, implicit
arguments and argument scopes. It does not print the body of
definitions or proofs.
+\item {\tt Print {\qualid}@\{names\}.}\\
+This locally renames the polymorphic universes of {\qualid}.
+An underscore means the raw universe is printed.
+This form can be used with {\tt Print Term} and {\tt About}.
+
%\item {\tt Print Proof {\qualid}.}\comindex{Print Proof}\\
%In case \qualid\ denotes an opaque theorem defined in a section,
%it is stored on a special unprintable form and displayed as
@@ -905,6 +912,15 @@ This command turns off the use of a default timeout.
This command displays whether some default timeout has be set or not.
+\subsection[\tt Fail \textrm{\textsl{command-or-tactic}}.]{\tt Fail \textrm{\textsl{command-or-tactic}}.\comindex{Fail}\label{Fail}}
+
+For debugging {\Coq} scripts, sometimes it is desirable to know
+whether a command or a tactic fails. If the given command or tactic
+fails, the {\tt Fail} statement succeeds, without changing the proof
+state, and in interactive mode, {\Coq} prints a message confirming the failure.
+If the command or tactic succeeds, the statement is an error, and
+{\Coq} prints a message indicating that the failure did not occur.
+
\section{Controlling display}
\subsection[\tt Set Silent.]{\tt Set Silent.\optindex{Silent}
diff --git a/doc/refman/RefMan-pre.tex b/doc/refman/RefMan-pre.tex
index 991c9745e..05775bfbe 100644
--- a/doc/refman/RefMan-pre.tex
+++ b/doc/refman/RefMan-pre.tex
@@ -499,7 +499,7 @@ Claude Marché coordinated the edition of the Reference Manual for
Pierre Letouzey and Jacek Chrz\k{a}szcz respectively maintained the
extraction tool and module system of {\Coq}.
-Jean-Christophe Filliâtre, Pierre Letouzey, Hugo Herbelin ando
+Jean-Christophe Filliâtre, Pierre Letouzey, Hugo Herbelin and other
contributors from Sophia-Antipolis and Nijmegen participated to the
extension of the library.
@@ -659,7 +659,7 @@ Matthieu Sozeau extended the \textsc{Russell} language, ending in an
convenient way to write programs of given specifications, Pierre
Corbineau extended the Mathematical Proof Language and the
automatization tools that accompany it, Pierre Letouzey supervised and
-extended various parts the standard library, Stéphane Glondu
+extended various parts of the standard library, Stéphane Glondu
contributed a few tactics and improvements, Jean-Marc Notin provided
help in debugging, general maintenance and {\tt coqdoc} support,
Vincent Siles contributed extensions of the {\tt Scheme} command and
@@ -680,7 +680,7 @@ Nicolas Tabareau made the adaptation of the interface of the old
the interaction between Coq and its external interfaces. With Samuel
Mimram, he also helped making Coq compatible with recent software
tools. Russell O'Connor, Cezary Kaliscyk, Milad Niqui contributed to
-improved the libraries of integers, rational, and real numbers. We
+improve the libraries of integers, rational, and real numbers. We
also thank many users and partners for suggestions and feedback, in
particular Pierre Castéran and Arthur Charguéraud, the INRIA Marelle
team, Georges Gonthier and the INRIA-Microsoft Mathematical Components team,
@@ -714,7 +714,7 @@ implementation of $\mathbb{N}$, $\mathbb{Z}$ or
$\mathbb{Z}/n\mathbb{Z}$.
The main other evolutions of the library are due to Hugo Herbelin who
-made a revision of the sorting library (includingh a certified
+made a revision of the sorting library (including a certified
merge-sort) and to Guillaume Melquiond who slightly revised and
cleaned up the library of reals.
@@ -723,7 +723,7 @@ some efficiency issues and a more flexible construction of module
types, Élie Soubiran brought a new model of name equivalence, the
$\Delta$-equivalence, which respects as much as possible the names
given by the users. He also designed with Pierre Letouzey a new
-convenient operator \verb!<+! for nesting functor application, what
+convenient operator \verb!<+! for nesting functor application, that
provides a light notation for inheriting the properties of cascading
modules.
diff --git a/doc/refman/RefMan-pro.tex b/doc/refman/RefMan-pro.tex
index 8f659ded3..6b24fdde7 100644
--- a/doc/refman/RefMan-pro.tex
+++ b/doc/refman/RefMan-pro.tex
@@ -320,10 +320,19 @@ Note that when a focused goal is proved a message is displayed
together with a suggestion about the right bullet or {\tt \}} to
unfocus it or focus the next one.
+\begin{Variants}
+
+\item {\tt {\num}: \{}\\
+This focuses on the $\num^{th}$ subgoal to prove.
+
+\end{Variants}
+
\begin{ErrMsgs}
\item \errindex{This proof is focused, but cannot be unfocused
this way} You are trying to use {\tt \}} but the current subproof
has not been fully solved.
+\item \errindex{No such goal}
+\item \errindex{Brackets only support the single numbered goal selector}
\item see also error message about bullets below.
\end{ErrMsgs}
@@ -395,6 +404,8 @@ Proof.
\end{ErrMsgs}
+\subsection[\tt Set Bullet Behavior.]{\tt Set Bullet Behavior.\optindex{Bullet Behavior}}
+
The bullet behavior can be controlled by the following commands.
\begin{quote}
@@ -553,12 +564,12 @@ used to force Coq to optimize some of its internal data structures.
This command forces Coq to shrink the data structure used to represent
the ongoing proof.
-\subsection[\tt Optimize Heap.]{\tt Optimize Heap.}
+\subsection[\tt Optimize Heap.]{\tt Optimize Heap.\label{vernac-optimizeheap}}
This command forces the OCaml runtime to perform a heap compaction.
-This is in general an expensive operation. See:
- \url{http://caml.inria.fr/pub/docs/manual-ocaml/libref/Gc.html#VALcompact}
-
+This is in general an expensive operation. See: \\
+\ \url{http://caml.inria.fr/pub/docs/manual-ocaml/libref/Gc.html#VALcompact} \\
+There is also an analogous tactic {\tt optimize\_heap} (see~\ref{tactic-optimizeheap}).
%%% Local Variables:
%%% mode: latex
diff --git a/doc/refman/RefMan-sch.tex b/doc/refman/RefMan-sch.tex
index 956f30851..30724759d 100644
--- a/doc/refman/RefMan-sch.tex
+++ b/doc/refman/RefMan-sch.tex
@@ -127,8 +127,10 @@ conclusion is {\tt (n:nat)(even n)->(Q n)}.
\optindex{Boolean Equality Schemes}
\optindex{Elimination Schemes}
\optindex{Nonrecursive Elimination Schemes}
+\optindex{Record Elimination Schemes}
\optindex{Case Analysis Schemes}
\optindex{Decidable Equality Schemes}
+\optindex{Rewriting Schemes}
\label{set-nonrecursive-elimination-schemes}
}
@@ -142,6 +144,7 @@ and {\tt Record} (see~\ref{Record}) do not have an automatic
declaration of the induction principles. It can be activated with the
command {\tt Set Nonrecursive Elimination Schemes}. It can be
deactivated again with {\tt Unset Nonrecursive Elimination Schemes}.
+{\tt Record Elimination Schemes} is a deprecated alias of {\tt Nonrecursive Elimination Schemes}.
In addition, the {\tt Case Analysis Schemes} flag governs the generation of
case analysis lemmas for inductive types, i.e. corresponding to the
@@ -156,6 +159,9 @@ However you have to be careful with this option since
\Coq~ may now reject well-defined inductive types because it cannot compute
a Boolean equality for them.
+The {\tt Rewriting Schemes} flag governs generation of equality
+related schemes such as congruence.
+
\subsection{\tt Combined Scheme}
\label{CombinedScheme}
\comindex{Combined Scheme}
diff --git a/doc/refman/RefMan-ssr.tex b/doc/refman/RefMan-ssr.tex
index be199e0b2..31dabcdd4 100644
--- a/doc/refman/RefMan-ssr.tex
+++ b/doc/refman/RefMan-ssr.tex
@@ -3096,10 +3096,10 @@ the tactic \ssrC{rewrite (=~ multi1)} is equivalent to
\end{lstlisting}
except that the constants \ssrC{eqba, eqab, mult1_rev} have not been created.
-Rewriting with multirules
-is useful to implement simplification or transformation
-procedures, to be applied on terms of small to medium size. For
-instance the library \ssrL{ssrnat} provides two implementations for
+Rewriting with multirules is useful to implement simplification or
+transformation procedures, to be applied on terms of small to medium
+size. For instance, the library \ssrL{ssrnat} --- available in the
+external math-comp library --- provides two implementations for
arithmetic operations on natural numbers: an elementary one and a tail
recursive version, less inefficient but also less convenient for
reasoning purposes. The library also provides one lemma per such
diff --git a/doc/refman/RefMan-tac.tex b/doc/refman/RefMan-tac.tex
index 675c2bf17..66a5f107a 100644
--- a/doc/refman/RefMan-tac.tex
+++ b/doc/refman/RefMan-tac.tex
@@ -3334,6 +3334,14 @@ evaluating purely computational expressions (i.e. with little dead code).
\end{Variants}
+\Rem The following option makes {\tt cbv} (and its derivative {\tt
+ compute}) print information about the constants it encounters and
+the unfolding decisions it makes.
+\begin{quote}
+ \optindex{Debug Cbv}
+ {\tt Set Debug Cbv}
+\end{quote}
+
% Obsolete? Anyway not very important message
%\begin{ErrMsgs}
%\item \errindex{Delta must be specified before}
@@ -3507,6 +3515,13 @@ of {\tt cbn} while doing reductions in unification, type inference and
tactic applications. It can result in expensive unifications, as
refolding currently uses a potentially exponential heuristic.
+\begin{quote}
+ \optindex{Debug RAKAM}
+ {\tt Set Debug RAKAM}
+\end{quote}
+This option makes {\tt cbn} print various debugging information.
+{\tt RAKAM} is the Refolding Algebraic Krivine Abstract Machine.
+
\subsection{\tt unfold \qualid}
\tacindex{unfold}
\label{unfold}
@@ -3703,6 +3718,9 @@ hints of the database named {\tt core}.
This variant is very useful for getting a better understanding of automation,
or to know what lemmas/assumptions were used.
+\item {\tt debug auto} Behaves like {\tt auto} but shows the tactics
+ it tries to solve the goal, including failing paths.
+
\item {\tt \zeroone{info\_}auto \zeroone{\num}} \zeroone{{\tt using} \nterm{lemma}$_1$
{\tt ,} {\ldots} {\tt ,} \nterm{lemma}$_n$} \zeroone{{\tt with}
\ident$_1$ {\ldots} \ident$_n$}
@@ -3723,6 +3741,8 @@ hints of the database named {\tt core}.
\item {\tt info\_trivial}
+\item {\tt debug trivial}
+
\item {\tt \zeroone{info\_}trivial} \zeroone{{\tt using} \nterm{lemma}$_1$
{\tt ,} {\ldots} {\tt ,} \nterm{lemma}$_n$} \zeroone{{\tt with}
\ident$_1$ {\ldots} \ident$_n$}
@@ -3732,6 +3752,19 @@ hints of the database named {\tt core}.
\Rem {\tt auto} either solves completely the goal or else leaves it
intact. \texttt{auto} and \texttt{trivial} never fail.
+\Rem The following options enable printing of informative or debug
+information for the {\tt auto} and {\tt trivial} tactics:
+\begin{quote}
+ \optindex{Info Auto}
+ {\tt Set Info Auto}
+ \optindex{Debug Auto}
+ {\tt Set Debug Auto}
+ \optindex{Info Trivial}
+ {\tt Set Info Trivial}
+ \optindex{Debug Trivial}
+ {\tt Set Debug Trivial}
+\end{quote}
+
\SeeAlso Section~\ref{Hints-databases}
\subsection{\tt eauto}
@@ -3768,6 +3801,14 @@ Note that {\tt ex\_intro} should be declared as a hint.
\end{Variants}
+\Rem {\tt eauto} obeys the following options:
+\begin{quote}
+ \optindex{Info Eauto}
+ {\tt Set Info Eauto}
+ \optindex{Debug Eauto}
+ {\tt Set Debug Eauto}
+\end{quote}
+
\SeeAlso Section~\ref{Hints-databases}
\subsection{\tt autounfold with \ident$_1$ \mbox{\dots} \ident$_n$}
@@ -4710,6 +4751,13 @@ congruence.
described above.
\end{ErrMsgs}
+\noindent {\bf Remark: } {\tt congruence} can be made to print debug
+information by setting the following option:
+
+\begin{quote}
+\optindex{Congruence Verbose}
+{\tt Set Congruence Verbose}
+\end{quote}
\section{Checking properties of terms}
diff --git a/doc/refman/RefMan-uti.tex b/doc/refman/RefMan-uti.tex
index ed41e3216..962aa98b6 100644
--- a/doc/refman/RefMan-uti.tex
+++ b/doc/refman/RefMan-uti.tex
@@ -4,53 +4,24 @@
The distribution provides utilities to simplify some tedious works
beside proof development, tactics writing or documentation.
-\section[Building a toplevel extended with user tactics]{Building a toplevel extended with user tactics\label{Coqmktop}\ttindex{coqmktop}}
+\section[Using Coq as a library]{Using Coq as a library}
-The native-code version of \Coq\ cannot dynamically load user tactics
-using {\ocaml} code. It is possible to build a toplevel of \Coq,
-with {\ocaml} code statically linked, with the tool {\tt
- coqmktop}.
-
-For example, one can build a native-code \Coq\ toplevel extended with a tactic
-which source is in {\tt tactic.ml} with the command
-\begin{verbatim}
- % coqmktop -opt -o mytop.out tactic.cmx
-\end{verbatim}
-where {\tt tactic.ml} has been compiled with the native-code
-compiler {\tt ocamlopt}. This command generates an executable
-called {\tt mytop.out}. To use this executable to compile your \Coq\
-files, use {\tt coqc -image mytop.out}.
-
-A basic example is the native-code version of \Coq\ ({\tt coqtop.opt}),
-which can be generated by {\tt coqmktop -opt -o coqopt.opt}.
-
-
-\paragraph[Application: how to use the {\ocaml} debugger with Coq.]{Application: how to use the {\ocaml} debugger with Coq.\index{Debugger}}
-
-One useful application of \texttt{coqmktop} is to build a \Coq\ toplevel in
-order to debug your tactics with the {\ocaml} debugger.
-You need to have configured and compiled \Coq\ for debugging
-(see the file \texttt{INSTALL} included in the distribution).
-Then, you must compile the Caml modules of your tactic with the
-option \texttt{-g} (with the bytecode compiler) and build a stand-alone
-bytecode toplevel with the following command:
+In previous versions, \texttt{coqmktop} was used to build custom
+toplevels --- for example for better debugging or custom static
+linking. Nowadays, the preferred method is to use \texttt{ocamlfind}.
+The most basic custom toplevel is built using:
\begin{quotation}
-\texttt{\% coqmktop -g -o coq-debug}~\emph{<your \texttt{.cmo} files>}
+\texttt{\% ocamlfind ocamlopt -thread -rectypes -linkall -linkpkg
+ -package coq.toplevel toplevel/coqtop\_bin.ml -o my\_toplevel.native}
\end{quotation}
-
-To launch the \ocaml\ debugger with the image you need to execute it in
-an environment which correctly sets the \texttt{COQLIB} variable.
-Moreover, you have to indicate the directories in which
-\texttt{ocamldebug} should search for Caml modules.
-
-A possible solution is to use a wrapper around \texttt{ocamldebug}
-which detects the executables containing the word \texttt{coq}. In
-this case, the debugger is called with the required additional
-arguments. In other cases, the debugger is simply called without additional
-arguments. Such a wrapper can be found in the \texttt{dev/}
-subdirectory of the sources.
+For example, to statically link LTAC, you can just do:
+\begin{quotation}
+\texttt{\% ocamlfind ocamlopt -thread -rectypes -linkall -linkpkg
+ -package coq.toplevel -package coq.ltac toplevel/coqtop\_bin.ml -o my\_toplevel.native}
+\end{quotation}
+and similarly for other plugins.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -134,6 +105,7 @@ The optional file {\tt CoqMakefile.local} is included by the generated file
compiler, like {\tt -bin-annot} or {\tt -w...}.
\item[COQC, COQDEP, COQDOC] can be set in order to use alternative
binaries (e.g. wrappers)
+ \item[COQ\_SRC\_SUBDIRS] can be extended by including other paths in which {\tt *.cm*} files are searched. For example {\tt COQ\_SRC\_SUBDIRS+=user-contrib/Unicoq} lets you build a plugin containing OCaml code that depends on the OCaml code of {\tt Unicoq}.
\end{description}
\item[Rule extension]
The following makefile rules can be extended. For example
@@ -466,7 +438,7 @@ the \Coq\ language, and also a rudimentary indentation facility:
\end{itemize}
An inferior mode to run \Coq\ under Emacs, by Marco Maggesi, is also
-included in the distribution, in file \texttt{coq-inferior.el}.
+included in the distribution, in file \texttt{inferior-coq.el}.
Instructions to use it are contained in this file.
\subsection[{\ProofGeneral}]{{\ProofGeneral}\index{Proof General@{\ProofGeneral}}}
diff --git a/doc/refman/Universes.tex b/doc/refman/Universes.tex
index 75fac9454..a1a6a4391 100644
--- a/doc/refman/Universes.tex
+++ b/doc/refman/Universes.tex
@@ -285,8 +285,10 @@ universes and explicitly instantiate polymorphic definitions.
\label{UniverseCmd}}
In the monorphic case, this command declares a new global universe named
-{\ident}. It supports the polymorphic flag only in sections, meaning the
-universe quantification will be discharged on each section definition
+{\ident}, which can be referred to using its qualified name as
+well. Global universe names live in a separate namespace. The command
+supports the polymorphic flag only in sections, meaning the universe
+quantification will be discharged on each section definition
independently. One cannot mix polymorphic and monomorphic declarations
in the same section.
diff --git a/doc/refman/coqide-queries.png b/doc/refman/coqide-queries.png
index dea5626f8..7a46ac4e6 100644
--- a/doc/refman/coqide-queries.png
+++ b/doc/refman/coqide-queries.png
Binary files differ
diff --git a/doc/refman/coqide.png b/doc/refman/coqide.png
index a6a0f5850..e300401c9 100644
--- a/doc/refman/coqide.png
+++ b/doc/refman/coqide.png
Binary files differ
diff --git a/engine/eConstr.ml b/engine/eConstr.ml
index a54c08297..9ac16b5b4 100644
--- a/engine/eConstr.ml
+++ b/engine/eConstr.ml
@@ -9,7 +9,7 @@
open CErrors
open Util
open Names
-open Term
+open Constr
open Context
open Evd
@@ -34,7 +34,7 @@ end
type t
val kind : Evd.evar_map -> t -> (t, t, ESorts.t, EInstance.t) Constr.kind_of_term
val kind_upto : Evd.evar_map -> constr -> (constr, types, Sorts.t, Univ.Instance.t) Constr.kind_of_term
-val kind_of_type : Evd.evar_map -> t -> (t, t) kind_of_type
+val kind_of_type : Evd.evar_map -> t -> (t, t) Term.kind_of_type
val whd_evar : Evd.evar_map -> t -> t
val of_kind : (t, t, ESorts.t, EInstance.t) Constr.kind_of_term -> t
val of_constr : Constr.t -> t
@@ -54,7 +54,7 @@ struct
type t = Sorts.t
let make s = s
let kind sigma = function
- | Type u -> sort_of_univ (Evd.normalize_universe sigma u)
+ | Sorts.Type u -> Sorts.sort_of_univ (Evd.normalize_universe sigma u)
| s -> s
let unsafe_to_sorts s = s
end
@@ -114,7 +114,7 @@ let rec to_constr sigma c = match Constr.kind c with
| Some c -> to_constr sigma c
| None -> Constr.map (fun c -> to_constr sigma c) c
end
-| Sort (Type u) ->
+| Sort (Sorts.Type u) ->
let u' = Evd.normalize_universe sigma u in
if u' == u then c else mkSort (Sorts.sort_of_univ u')
| Const (c', u) when not (Univ.Instance.is_empty u) ->
@@ -150,6 +150,8 @@ type rel_declaration = (constr, types) Context.Rel.Declaration.pt
type named_context = (constr, types) Context.Named.pt
type rel_context = (constr, types) Context.Rel.pt
+type 'a puniverses = 'a * EInstance.t
+
let in_punivs a = (a, EInstance.empty)
let mkProp = of_kind (Sort (ESorts.make Sorts.prop))
@@ -645,6 +647,37 @@ let eq_constr_universes_proj env sigma m n =
let res = eq_constr' (unsafe_to_constr m) (unsafe_to_constr n) in
if res then Some !cstrs else None
+let universes_of_constr env sigma c =
+ let open Univ in
+ let open Declarations in
+ let rec aux s c =
+ match kind sigma c with
+ | Const (c, u) ->
+ begin match (Environ.lookup_constant c env).const_universes with
+ | Polymorphic_const _ ->
+ LSet.fold LSet.add (Instance.levels (EInstance.kind sigma u)) s
+ | Monomorphic_const (univs, _) ->
+ LSet.union s univs
+ end
+ | Ind ((mind,_), u) | Construct (((mind,_),_), u) ->
+ begin match (Environ.lookup_mind mind env).mind_universes with
+ | Cumulative_ind _ | Polymorphic_ind _ ->
+ LSet.fold LSet.add (Instance.levels (EInstance.kind sigma u)) s
+ | Monomorphic_ind (univs,_) ->
+ LSet.union s univs
+ end
+ | Sort u ->
+ let sort = ESorts.kind sigma u in
+ if Sorts.is_small sort then s
+ else
+ let u = Sorts.univ_of_sort sort in
+ LSet.fold LSet.add (Universe.levels u) s
+ | Evar (k, args) ->
+ let concl = Evd.evar_concl (Evd.find sigma k) in
+ fold sigma aux (aux s (of_constr concl)) c
+ | _ -> fold sigma aux s c
+ in aux LSet.empty c
+
open Context
open Environ
@@ -662,6 +695,10 @@ let cast_rel_context :
type a b. (a,b) eq -> (a, a) Rel.pt -> (b, b) Rel.pt =
fun Refl x -> x
+let cast_rec_decl :
+ type a b. (a,b) eq -> (a, a) Constr.prec_declaration -> (b, b) Constr.prec_declaration =
+ fun Refl x -> x
+
let cast_named_decl :
type a b. (a,b) eq -> (a, a) Named.Declaration.pt -> (b, b) Named.Declaration.pt =
fun Refl x -> x
@@ -737,6 +774,20 @@ let rec isArity sigma c =
| Sort _ -> true
| _ -> false
+type arity = rel_context * ESorts.t
+
+let destArity sigma =
+ let open Context.Rel.Declaration in
+ let rec prodec_rec l c =
+ match kind sigma c with
+ | Prod (x,t,c) -> prodec_rec (LocalAssum (x,t) :: l) c
+ | LetIn (x,b,t,c) -> prodec_rec (LocalDef (x,b,t) :: l) c
+ | Cast (c,_,_) -> prodec_rec l c
+ | Sort s -> l,s
+ | _ -> anomaly ~label:"destArity" (Pp.str "not an arity.")
+ in
+ prodec_rec []
+
let mkProd_or_LetIn decl c =
let open Context.Rel.Declaration in
match decl with
@@ -770,6 +821,7 @@ let it_mkLambda_or_LetIn t ctx = List.fold_left (fun c d -> mkLambda_or_LetIn d
let push_rel d e = push_rel (cast_rel_decl unsafe_eq d) e
let push_rel_context d e = push_rel_context (cast_rel_context unsafe_eq d) e
+let push_rec_types d e = push_rec_types (cast_rec_decl unsafe_eq d) e
let push_named d e = push_named (cast_named_decl unsafe_eq d) e
let push_named_context d e = push_named_context (cast_named_context unsafe_eq d) e
let push_named_context_val d e = push_named_context_val (cast_named_decl unsafe_eq d) e
@@ -784,6 +836,15 @@ let lookup_rel i e = cast_rel_decl (sym unsafe_eq) (lookup_rel i e)
let lookup_named n e = cast_named_decl (sym unsafe_eq) (lookup_named n e)
let lookup_named_val n e = cast_named_decl (sym unsafe_eq) (lookup_named_val n e)
+let map_rel_context_in_env f env sign =
+ let rec aux env acc = function
+ | d::sign ->
+ aux (push_rel d env) (Context.Rel.Declaration.map_constr (f env) d :: acc) sign
+ | [] ->
+ acc
+ in
+ aux env [] (List.rev sign)
+
let fresh_global ?loc ?rigid ?names env sigma reference =
let (evd,t) = Evd.fresh_global ?loc ?rigid ?names env sigma reference in
evd, of_constr t
diff --git a/engine/eConstr.mli b/engine/eConstr.mli
index 4dbf6c18a..6fa338c73 100644
--- a/engine/eConstr.mli
+++ b/engine/eConstr.mli
@@ -56,6 +56,8 @@ sig
val is_empty : t -> bool
end
+type 'a puniverses = 'a * EInstance.t
+
(** {5 Destructors} *)
val kind : Evd.evar_map -> t -> (t, t, ESorts.t, EInstance.t) Constr.kind_of_term
@@ -93,14 +95,14 @@ val mkEvar : t pexistential -> t
val mkSort : Sorts.t -> t
val mkProp : t
val mkSet : t
-val mkType : Univ.universe -> t
+val mkType : Univ.Universe.t -> t
val mkCast : t * cast_kind * t -> t
val mkProd : Name.t * t * t -> t
val mkLambda : Name.t * t * t -> t
val mkLetIn : Name.t * t * t * t -> t
val mkApp : t * t array -> t
-val mkConst : constant -> t
-val mkConstU : constant * EInstance.t -> t
+val mkConst : Constant.t -> t
+val mkConstU : Constant.t * EInstance.t -> t
val mkProj : (projection * t) -> t
val mkInd : inductive -> t
val mkIndU : inductive * EInstance.t -> t
@@ -144,7 +146,11 @@ val isFix : Evd.evar_map -> t -> bool
val isCoFix : Evd.evar_map -> t -> bool
val isCase : Evd.evar_map -> t -> bool
val isProj : Evd.evar_map -> t -> bool
+
+type arity = rel_context * ESorts.t
+val destArity : Evd.evar_map -> types -> arity
val isArity : Evd.evar_map -> t -> bool
+
val isVarId : Evd.evar_map -> Id.t -> t -> bool
val isRelN : Evd.evar_map -> int -> t -> bool
@@ -157,7 +163,7 @@ val destProd : Evd.evar_map -> t -> Name.t * types * types
val destLambda : Evd.evar_map -> t -> Name.t * types * t
val destLetIn : Evd.evar_map -> t -> Name.t * t * types * t
val destApp : Evd.evar_map -> t -> t * t array
-val destConst : Evd.evar_map -> t -> constant * EInstance.t
+val destConst : Evd.evar_map -> t -> Constant.t * EInstance.t
val destEvar : Evd.evar_map -> t -> t pexistential
val destInd : Evd.evar_map -> t -> inductive * EInstance.t
val destConstruct : Evd.evar_map -> t -> constructor * EInstance.t
@@ -187,9 +193,9 @@ val whd_evar : Evd.evar_map -> constr -> constr
val eq_constr : Evd.evar_map -> t -> t -> bool
val eq_constr_nounivs : Evd.evar_map -> t -> t -> bool
-val eq_constr_universes : Evd.evar_map -> t -> t -> Universes.universe_constraints option
-val leq_constr_universes : Evd.evar_map -> t -> t -> Universes.universe_constraints option
-val eq_constr_universes_proj : Environ.env -> Evd.evar_map -> t -> t -> Universes.universe_constraints option
+val eq_constr_universes : Evd.evar_map -> t -> t -> Universes.Constraints.t option
+val leq_constr_universes : Evd.evar_map -> t -> t -> Universes.Constraints.t option
+val eq_constr_universes_proj : Environ.env -> Evd.evar_map -> t -> t -> Universes.Constraints.t option
val compare_constr : Evd.evar_map -> (t -> t -> bool) -> t -> t -> bool
(** {6 Iterators} *)
@@ -201,6 +207,10 @@ val iter_with_binders : Evd.evar_map -> ('a -> 'a) -> ('a -> t -> unit) -> 'a ->
val iter_with_full_binders : Evd.evar_map -> (rel_declaration -> 'a -> 'a) -> ('a -> t -> unit) -> 'a -> t -> unit
val fold : Evd.evar_map -> ('a -> t -> 'a) -> 'a -> t -> 'a
+(** Gather the universes transitively used in the term, including in the
+ type of evars appearing in it. *)
+val universes_of_constr : Environ.env -> Evd.evar_map -> t -> Univ.LSet.t
+
(** {6 Substitutions} *)
module Vars :
@@ -241,6 +251,7 @@ end
val push_rel : rel_declaration -> env -> env
val push_rel_context : rel_context -> env -> env
+val push_rec_types : (t, t) Constr.prec_declaration -> env -> env
val push_named : named_declaration -> env -> env
val push_named_context : named_context -> env -> env
@@ -256,6 +267,9 @@ val lookup_rel : int -> env -> rel_declaration
val lookup_named : variable -> env -> named_declaration
val lookup_named_val : variable -> named_context_val -> named_declaration
+val map_rel_context_in_env :
+ (env -> constr -> constr) -> env -> rel_context -> rel_context
+
(* XXX Missing Sigma proxy *)
val fresh_global :
?loc:Loc.t -> ?rigid:Evd.rigid -> ?names:Univ.Instance.t -> Environ.env ->
diff --git a/engine/engine.mllib b/engine/engine.mllib
index afc02d7f6..a3614f6c4 100644
--- a/engine/engine.mllib
+++ b/engine/engine.mllib
@@ -1,12 +1,13 @@
-Logic_monad
Universes
+Univops
UState
+Nameops
Evd
EConstr
Namegen
Termops
-Proofview_monad
Evarutil
+Logic_monad
+Proofview_monad
Proofview
Ftactic
-Geninterp
diff --git a/engine/evarutil.ml b/engine/evarutil.ml
index 38efcca05..f82ffccdc 100644
--- a/engine/evarutil.ml
+++ b/engine/evarutil.ml
@@ -10,11 +10,12 @@ open CErrors
open Util
open Names
open Term
-open Termops
-open Namegen
+open Constr
open Pre_env
open Environ
open Evd
+open Termops
+open Namegen
module RelDecl = Context.Rel.Declaration
module NamedDecl = Context.Named.Declaration
@@ -53,15 +54,15 @@ let new_global evd x =
(* flush_and_check_evars fails if an existential is undefined *)
-exception Uninstantiated_evar of existential_key
+exception Uninstantiated_evar of Evar.t
let rec flush_and_check_evars sigma c =
- match kind_of_term c with
+ match kind c with
| Evar (evk,_ as ev) ->
(match existential_opt_value sigma ev with
| None -> raise (Uninstantiated_evar evk)
| Some c -> flush_and_check_evars sigma c)
- | _ -> map_constr (flush_and_check_evars sigma) c
+ | _ -> Constr.map (flush_and_check_evars sigma) c
let flush_and_check_evars sigma c =
flush_and_check_evars sigma (EConstr.Unsafe.to_constr c)
@@ -162,7 +163,7 @@ exception NoHeadEvar
let head_evar sigma c =
(** FIXME: this breaks if using evar-insensitive code *)
let c = EConstr.Unsafe.to_constr c in
- let rec hrec c = match kind_of_term c with
+ let rec hrec c = match kind c with
| Evar (evk,_) -> evk
| Case (_,_,c,_) -> hrec c
| App (c,_) -> hrec c
@@ -198,9 +199,10 @@ let whd_head_evar sigma c =
let meta_counter_summary_name = "meta counter"
(* Generator of metavariables *)
-let new_meta =
- let meta_ctr = Summary.ref 0 ~name:meta_counter_summary_name in
- fun () -> incr meta_ctr; !meta_ctr
+let meta_ctr, meta_counter_summary_tag =
+ Summary.ref_tag 0 ~name:meta_counter_summary_name
+
+let new_meta () = incr meta_ctr; !meta_ctr
let mk_new_meta () = EConstr.mkMeta(new_meta())
@@ -255,22 +257,6 @@ let make_pure_subst evi args =
* we have the property that u and phi(t) are convertible in env.
*)
-let csubst_subst (k, s) c =
- (** Safe because this is a substitution *)
- let c = EConstr.Unsafe.to_constr c in
- let rec subst n c = match Constr.kind c with
- | Rel m ->
- if m <= n then c
- else if m - n <= k then EConstr.Unsafe.to_constr (Int.Map.find (k - m + n) s)
- else mkRel (m - k)
- | _ -> Constr.map_with_binders succ subst n c
- in
- let c = if k = 0 then c else subst 0 c in
- EConstr.of_constr c
-
-let subst2 subst vsubst c =
- csubst_subst subst (EConstr.Vars.replace_vars vsubst c)
-
let next_ident_away id avoid =
let avoid id = Id.Set.mem id avoid in
next_ident_away_from id avoid
@@ -280,19 +266,79 @@ let next_name_away na avoid =
let id = match na with Name id -> id | Anonymous -> default_non_dependent_ident in
next_ident_away_from id avoid
-type csubst = int * EConstr.t Int.Map.t
-
-let empty_csubst = (0, Int.Map.empty)
+type subst_val =
+| SRel of int
+| SVar of Id.t
+
+type csubst = {
+ csubst_len : int;
+ (** Cardinal of [csubst_rel] *)
+ csubst_var : Constr.t Id.Map.t;
+ (** A mapping of variables to variables. We use the more general
+ [Constr.t] to share allocations, but all values are of shape [Var _]. *)
+ csubst_rel : Constr.t Int.Map.t;
+ (** A contiguous mapping of integers to variables. Same remark for values. *)
+ csubst_rev : subst_val Id.Map.t;
+ (** Reverse mapping of the substitution *)
+}
+(** This type represent a name substitution for the named and De Bruijn parts of
+ a environment. For efficiency we also store the reverse substitution.
+ Invariant: all identifiers in the codomain of [csubst_var] and [csubst_rel]
+ must be pairwise distinct. *)
+
+let empty_csubst = {
+ csubst_len = 0;
+ csubst_rel = Int.Map.empty;
+ csubst_var = Id.Map.empty;
+ csubst_rev = Id.Map.empty;
+}
+
+let csubst_subst { csubst_len = k; csubst_var = v; csubst_rel = s } c =
+ (** Safe because this is a substitution *)
+ let c = EConstr.Unsafe.to_constr c in
+ let rec subst n c = match Constr.kind c with
+ | Rel m ->
+ if m <= n then c
+ else if m - n <= k then Int.Map.find (k - m + n) s
+ else mkRel (m - k)
+ | Var id ->
+ begin try Id.Map.find id v with Not_found -> c end
+ | _ -> Constr.map_with_binders succ subst n c
+ in
+ let c = if k = 0 && Id.Map.is_empty v then c else subst 0 c in
+ EConstr.of_constr c
type ext_named_context =
- csubst * (Id.t * EConstr.constr) list *
- Id.Set.t * EConstr.named_context
-
-let push_var id (n, s) =
- let s = Int.Map.add n (EConstr.mkVar id) s in
- (succ n, s)
-
-let push_rel_decl_to_named_context sigma decl (subst, vsubst, avoid, nc) =
+ csubst * Id.Set.t * EConstr.named_context
+
+let push_var id { csubst_len = n; csubst_var = v; csubst_rel = s; csubst_rev = r } =
+ let s = Int.Map.add n (Constr.mkVar id) s in
+ let r = Id.Map.add id (SRel n) r in
+ { csubst_len = succ n; csubst_var = v; csubst_rel = s; csubst_rev = r }
+
+(** Post-compose the substitution with the generator [src ↦ tgt] *)
+let update_var src tgt subst =
+ let cur =
+ try Some (Id.Map.find src subst.csubst_rev)
+ with Not_found -> None
+ in
+ match cur with
+ | None ->
+ (** Missing keys stand for identity substitution [src ↦ src] *)
+ let csubst_var = Id.Map.add src (Constr.mkVar tgt) subst.csubst_var in
+ let csubst_rev = Id.Map.add tgt (SVar src) subst.csubst_rev in
+ { subst with csubst_var; csubst_rev }
+ | Some bnd ->
+ let csubst_rev = Id.Map.add tgt bnd (Id.Map.remove src subst.csubst_rev) in
+ match bnd with
+ | SRel m ->
+ let csubst_rel = Int.Map.add m (Constr.mkVar tgt) subst.csubst_rel in
+ { subst with csubst_rel; csubst_rev }
+ | SVar id ->
+ let csubst_var = Id.Map.add id (Constr.mkVar tgt) subst.csubst_var in
+ { subst with csubst_var; csubst_rev }
+
+let push_rel_decl_to_named_context sigma decl (subst, avoid, nc) =
let open EConstr in
let open Vars in
let map_decl f d =
@@ -328,18 +374,17 @@ let push_rel_decl_to_named_context sigma decl (subst, vsubst, avoid, nc) =
binding named [id], we will keep [id0] (the name given
by the user) and rename [id0] into [id] in the named
context. Unless [id] is a section variable. *)
- let subst = (fst subst, Int.Map.map (replace_vars [id0,mkVar id]) (snd subst)) in
- let vsubst = (id0,mkVar id)::vsubst in
- let d = decl |> NamedDecl.of_rel_decl (fun _ -> id0) |> map_decl (subst2 subst vsubst) in
+ let subst = update_var id0 id subst in
+ let d = decl |> NamedDecl.of_rel_decl (fun _ -> id0) |> map_decl (csubst_subst subst) in
let nc = List.map (replace_var_named_declaration id0 id) nc in
- (push_var id0 subst, vsubst, Id.Set.add id avoid, d :: nc)
+ (push_var id0 subst, Id.Set.add id avoid, d :: nc)
| _ ->
(* spiwack: if [id0] is a section variable renaming it is
incorrect. We revert to a less robust behaviour where
the new binder has name [id]. Which amounts to the same
behaviour than when [id=id0]. *)
- let d = decl |> NamedDecl.of_rel_decl (fun _ -> id) |> map_decl (subst2 subst vsubst) in
- (push_var id subst, vsubst, Id.Set.add id avoid, d :: nc)
+ let d = decl |> NamedDecl.of_rel_decl (fun _ -> id) |> map_decl (csubst_subst subst) in
+ (push_var id subst, Id.Set.add id avoid, d :: nc)
let push_rel_context_to_named_context env sigma typ =
(* compute the instances relative to the named context and rel_context *)
@@ -348,17 +393,17 @@ let push_rel_context_to_named_context env sigma typ =
let ids = List.map get_id (named_context env) in
let inst_vars = List.map mkVar ids in
if List.is_empty (Environ.rel_context env) then
- (named_context_val env, typ, inst_vars, empty_csubst, [])
+ (named_context_val env, typ, inst_vars, empty_csubst)
else
let avoid = List.fold_right Id.Set.add ids Id.Set.empty in
let inst_rels = List.rev (rel_list 0 (nb_rel env)) in
(* move the rel context to a named context and extend the named instance *)
(* with vars of the rel context *)
(* We do keep the instances corresponding to local definition (see above) *)
- let (subst, vsubst, _, env) =
+ let (subst, _, env) =
Context.Rel.fold_outside (fun d acc -> push_rel_decl_to_named_context sigma d acc)
- (rel_context env) ~init:(empty_csubst, [], avoid, named_context env) in
- (val_of_named_context env, subst2 subst vsubst typ, inst_rels@inst_vars, subst, vsubst)
+ (rel_context env) ~init:(empty_csubst, avoid, named_context env) in
+ (val_of_named_context env, csubst_subst subst typ, inst_rels@inst_vars, subst)
(*------------------------------------*
* Entry points to define new evars *
@@ -423,8 +468,8 @@ let new_evar_from_context sign evd ?src ?filter ?candidates ?store ?naming ?prin
(* [new_evar] declares a new existential in an env env with type typ *)
(* Converting the env into the sign of the evar to define *)
let new_evar env evd ?src ?filter ?candidates ?store ?naming ?principal typ =
- let sign,typ',instance,subst,vsubst = push_rel_context_to_named_context env evd typ in
- let map c = subst2 subst vsubst c in
+ let sign,typ',instance,subst = push_rel_context_to_named_context env evd typ in
+ let map c = csubst_subst subst c in
let candidates = Option.map (fun l -> List.map map l) candidates in
let instance =
match filter with
@@ -485,7 +530,7 @@ let rec check_and_clear_in_constr env evdref err ids global c =
(ie the hypotheses ids have been removed from the contexts of
evars). [global] should be true iff there is some variable of [ids] which
is a section variable *)
- match kind_of_term c with
+ match kind c with
| Var id' ->
if Id.Set.mem id' ids then raise (ClearDependencyError (id', err)) else c
@@ -552,7 +597,7 @@ let rec check_and_clear_in_constr env evdref err ids global c =
evdref := evd;
Evd.existential_value !evdref ev
- | _ -> map_constr (check_and_clear_in_constr env evdref err ids global) c
+ | _ -> Constr.map (check_and_clear_in_constr env evdref err ids global) c
let clear_hyps_in_evi_main env evdref hyps terms ids =
(* clear_hyps_in_evi erases hypotheses ids in hyps, checking if some
@@ -690,16 +735,65 @@ let undefined_evars_of_evar_info evd evi =
(undefined_evars_of_named_context evd
(named_context_of_val evi.evar_hyps)))
+type undefined_evars_cache = {
+ mutable cache : (EConstr.named_declaration * Evar.Set.t) ref Id.Map.t;
+}
+
+let create_undefined_evars_cache () = { cache = Id.Map.empty; }
+
+let cached_evar_of_hyp cache sigma decl accu = match cache with
+| None ->
+ let fold c acc =
+ let evs = undefined_evars_of_term sigma c in
+ Evar.Set.union evs acc
+ in
+ NamedDecl.fold_constr fold decl accu
+| Some cache ->
+ let id = NamedDecl.get_id decl in
+ let r =
+ try Id.Map.find id cache.cache
+ with Not_found ->
+ (** Dummy value *)
+ let r = ref (NamedDecl.LocalAssum (id, EConstr.mkProp), Evar.Set.empty) in
+ let () = cache.cache <- Id.Map.add id r cache.cache in
+ r
+ in
+ let (decl', evs) = !r in
+ let evs =
+ if NamedDecl.equal (==) decl decl' then snd !r
+ else
+ let fold c acc =
+ let evs = undefined_evars_of_term sigma c in
+ Evar.Set.union evs acc
+ in
+ let evs = NamedDecl.fold_constr fold decl Evar.Set.empty in
+ let () = r := (decl, evs) in
+ evs
+ in
+ Evar.Set.fold Evar.Set.add evs accu
+
+let filtered_undefined_evars_of_evar_info ?cache sigma evi =
+ let evars_of_named_context cache accu nc =
+ let fold decl accu = cached_evar_of_hyp cache sigma (EConstr.of_named_decl decl) accu in
+ Context.Named.fold_outside fold nc ~init:accu
+ in
+ let accu = match evi.evar_body with
+ | Evar_empty -> Evar.Set.empty
+ | Evar_defined b -> evars_of_term b
+ in
+ let accu = Evar.Set.union (undefined_evars_of_term sigma (EConstr.of_constr evi.evar_concl)) accu in
+ evars_of_named_context cache accu (evar_filtered_context evi)
+
(* spiwack: this is a more complete version of
{!Termops.occur_evar}. The latter does not look recursively into an
[evar_map]. If unification only need to check superficially, tactics
do not have this luxury, and need the more complete version. *)
let occur_evar_upto sigma n c =
let c = EConstr.Unsafe.to_constr c in
- let rec occur_rec c = match kind_of_term c with
+ let rec occur_rec c = match kind c with
| Evar (sp,_) when Evar.equal sp n -> raise Occur
| Evar e -> Option.iter occur_rec (existential_opt_value sigma e)
- | _ -> iter_constr occur_rec c
+ | _ -> Constr.iter occur_rec c
in
try occur_rec c; false with Occur -> true
diff --git a/engine/evarutil.mli b/engine/evarutil.mli
index 2f85bc733..923bf49a9 100644
--- a/engine/evarutil.mli
+++ b/engine/evarutil.mli
@@ -7,7 +7,7 @@
(************************************************************************)
open Names
-open Term
+open Constr
open Evd
open Environ
open EConstr
@@ -38,9 +38,9 @@ val new_pure_evar :
named_context_val -> evar_map -> ?src:Evar_kinds.t Loc.located -> ?filter:Filter.t ->
?candidates:constr list -> ?store:Store.t ->
?naming:Misctypes.intro_pattern_naming_expr ->
- ?principal:bool -> types -> evar_map * evar
+ ?principal:bool -> types -> evar_map * Evar.t
-val new_pure_evar_full : evar_map -> evar_info -> evar_map * evar
+val new_pure_evar_full : evar_map -> evar_info -> evar_map * Evar.t
(** the same with side-effects *)
val e_new_evar :
@@ -54,17 +54,17 @@ val e_new_evar :
val new_type_evar :
env -> evar_map -> ?src:Evar_kinds.t Loc.located -> ?filter:Filter.t ->
?naming:Misctypes.intro_pattern_naming_expr -> ?principal:bool -> rigid ->
- evar_map * (constr * sorts)
+ evar_map * (constr * Sorts.t)
val e_new_type_evar : env -> evar_map ref ->
?src:Evar_kinds.t Loc.located -> ?filter:Filter.t ->
- ?naming:Misctypes.intro_pattern_naming_expr -> ?principal:bool -> rigid -> constr * sorts
+ ?naming:Misctypes.intro_pattern_naming_expr -> ?principal:bool -> rigid -> constr * Sorts.t
val new_Type : ?rigid:rigid -> env -> evar_map -> evar_map * constr
val e_new_Type : ?rigid:rigid -> env -> evar_map ref -> constr
-val restrict_evar : evar_map -> existential_key -> Filter.t ->
- ?src:Evar_kinds.t Loc.located -> constr list option -> evar_map * existential_key
+val restrict_evar : evar_map -> Evar.t -> Filter.t ->
+ ?src:Evar_kinds.t Loc.located -> constr list option -> evar_map * Evar.t
(** Polymorphic constants *)
@@ -96,7 +96,7 @@ val non_instantiated : evar_map -> evar_info Evar.Map.t
(** [head_evar c] returns the head evar of [c] if any *)
exception NoHeadEvar
-val head_evar : evar_map -> constr -> existential_key (** may raise NoHeadEvar *)
+val head_evar : evar_map -> constr -> Evar.t (** may raise NoHeadEvar *)
(* Expand head evar if any *)
val whd_head_evar : evar_map -> constr -> constr
@@ -116,13 +116,13 @@ val is_ground_env : evar_map -> env -> bool
associating to each dependent evar [None] if it has no (partial)
definition or [Some s] if [s] is the list of evars appearing in
its (partial) definition. *)
-val gather_dependent_evars : evar_map -> evar list -> (Evar.Set.t option) Evar.Map.t
+val gather_dependent_evars : evar_map -> Evar.t list -> (Evar.Set.t option) Evar.Map.t
(** [advance sigma g] returns [Some g'] if [g'] is undefined and is
the current avatar of [g] (for instance [g] was changed by [clear]
into [g']). It returns [None] if [g] has been (partially)
solved. *)
-val advance : evar_map -> evar -> evar option
+val advance : evar_map -> Evar.t -> Evar.t option
(** The following functions return the set of undefined evars
contained in the object, the defined evars being traversed.
@@ -133,6 +133,12 @@ val undefined_evars_of_term : evar_map -> constr -> Evar.Set.t
val undefined_evars_of_named_context : evar_map -> Context.Named.t -> Evar.Set.t
val undefined_evars_of_evar_info : evar_map -> evar_info -> Evar.Set.t
+type undefined_evars_cache
+
+val create_undefined_evars_cache : unit -> undefined_evars_cache
+
+val filtered_undefined_evars_of_evar_info : ?cache:undefined_evars_cache -> evar_map -> evar_info -> Evar.Set.t
+
(** [occur_evar_upto sigma k c] returns [true] if [k] appears in
[c]. It looks up recursively in [sigma] for the value of existential
variables. *)
@@ -177,7 +183,7 @@ val e_nf_evars_and_universes : evar_map ref -> (Constr.constr -> Constr.constr)
val nf_evar_map_universes : evar_map -> evar_map * (Constr.constr -> Constr.constr)
(** Replacing all evars, possibly raising [Uninstantiated_evar] *)
-exception Uninstantiated_evar of existential_key
+exception Uninstantiated_evar of Evar.t
val flush_and_check_evars : evar_map -> constr -> Constr.constr
(** {6 Term manipulation up to instantiation} *)
@@ -216,14 +222,13 @@ val empty_csubst : csubst
val csubst_subst : csubst -> constr -> constr
type ext_named_context =
- csubst * (Id.t * constr) list *
- Id.Set.t * named_context
+ csubst * Id.Set.t * named_context
val push_rel_decl_to_named_context :
evar_map -> rel_declaration -> ext_named_context -> ext_named_context
val push_rel_context_to_named_context : Environ.env -> evar_map -> types ->
- named_context_val * types * constr list * csubst * (Id.t*constr) list
+ named_context_val * types * constr list * csubst
val generalize_evar_over_rels : evar_map -> existential -> types * constr list
@@ -233,12 +238,13 @@ val evd_comb0 : (evar_map -> evar_map * 'a) -> evar_map ref -> 'a
val evd_comb1 : (evar_map -> 'b -> evar_map * 'a) -> evar_map ref -> 'b -> 'a
val evd_comb2 : (evar_map -> 'b -> 'c -> evar_map * 'a) -> evar_map ref -> 'b -> 'c -> 'a
-val subterm_source : existential_key -> Evar_kinds.t Loc.located ->
+val subterm_source : Evar.t -> Evar_kinds.t Loc.located ->
Evar_kinds.t Loc.located
-val meta_counter_summary_name : string
-
-(** Deprecater *)
+val meta_counter_summary_tag : int Summary.Dyn.tag
+(** Deprecated *)
type type_constraint = types option
+[@@ocaml.deprecated "use the version in Evardefine"]
type val_constraint = constr option
+[@@ocaml.deprecated "use the version in Evardefine"]
diff --git a/engine/evd.ml b/engine/evd.ml
index 86ab2263f..0e9472158 100644
--- a/engine/evd.ml
+++ b/engine/evd.ml
@@ -8,10 +8,11 @@
open Pp
open CErrors
+open Sorts
open Util
open Names
open Nameops
-open Term
+open Constr
open Vars
open Environ
@@ -126,7 +127,7 @@ end
module Store = Store.Make ()
-type evar = Term.existential_key
+type evar = Evar.t
let string_of_existential evk = "?X" ^ string_of_int (Evar.repr evk)
@@ -280,9 +281,9 @@ type 'a freelisted = {
(* Collects all metavars appearing in a constr *)
let metavars_of c =
let rec collrec acc c =
- match kind_of_term c with
+ match kind c with
| Meta mv -> Int.Set.add mv acc
- | _ -> Term.fold_constr collrec acc c
+ | _ -> Constr.fold collrec acc c
in
collrec Int.Set.empty c
@@ -370,7 +371,7 @@ val key : Id.t -> t -> Evar.t
end =
struct
-type t = Id.t EvMap.t * existential_key Id.Map.t
+type t = Id.t EvMap.t * Evar.t Id.Map.t
let empty = (EvMap.empty, Id.Map.empty)
@@ -379,7 +380,7 @@ let add_name_newly_undefined id evk evi (evtoid, idtoev as names) =
| None -> names
| Some id ->
if Id.Map.mem id idtoev then
- user_err (str "Already an existential evar of name " ++ pr_id id);
+ user_err (str "Already an existential evar of name " ++ Id.print id);
(EvMap.add evk id evtoid, Id.Map.add id evk idtoev)
let add_name_undefined naming evk evi (evtoid,idtoev as evar_names) =
@@ -400,7 +401,7 @@ let rename evk id (evtoid, idtoev) =
| None -> (EvMap.add evk id evtoid, Id.Map.add id evk idtoev)
| Some id' ->
if Id.Map.mem id idtoev then anomaly (str "Evar name already in use.");
- (EvMap.update evk id evtoid (* overwrite old name *), Id.Map.add id evk (Id.Map.remove id' idtoev))
+ (EvMap.set evk id evtoid (* overwrite old name *), Id.Map.add id evk (Id.Map.remove id' idtoev))
let reassign_name_defined evk evk' (evtoid, idtoev as names) =
let id = try Some (EvMap.find evk evtoid) with Not_found -> None in
@@ -465,9 +466,8 @@ let add d e i = add_with_name d e i
let evar_counter_summary_name = "evar counter"
(* Generator of existential names *)
-let new_untyped_evar =
- let evar_ctr = Summary.ref 0 ~name:evar_counter_summary_name in
- fun () -> incr evar_ctr; Evar.unsafe_of_int !evar_ctr
+let evar_ctr, evar_counter_summary_tag = Summary.ref_tag 0 ~name:evar_counter_summary_name
+let new_untyped_evar () = incr evar_ctr; Evar.unsafe_of_int !evar_ctr
let new_evar evd ?name evi =
let evk = new_untyped_evar () in
@@ -706,10 +706,10 @@ let extract_all_conv_pbs evd =
extract_conv_pbs evd (fun _ -> true)
let loc_of_conv_pb evd (pbty,env,t1,t2) =
- match kind_of_term (fst (decompose_app t1)) with
+ match kind (fst (decompose_app t1)) with
| Evar (evk1,_) -> fst (evar_source evk1 evd)
| _ ->
- match kind_of_term (fst (decompose_app t2)) with
+ match kind (fst (decompose_app t2)) with
| Evar (evk2,_) -> fst (evar_source evk2 evd)
| _ -> None
@@ -720,9 +720,9 @@ let loc_of_conv_pb evd (pbty,env,t1,t2) =
let evars_of_term c =
let rec evrec acc c =
- match kind_of_term c with
+ match kind c with
| Evar (n, l) -> Evar.Set.add n (Array.fold_left evrec acc l)
- | _ -> Term.fold_constr evrec acc c
+ | _ -> Constr.fold evrec acc c
in
evrec Evar.Set.empty c
@@ -755,10 +755,12 @@ let evar_universe_context d = d.universes
let universe_context_set d = UState.context_set d.universes
-let universe_context ~names ~extensible evd =
- UState.universe_context ~names ~extensible evd.universes
+let to_universe_context evd = UState.context evd.universes
-let check_univ_decl evd decl = UState.check_univ_decl evd.universes decl
+let const_univ_entry ~poly evd = UState.const_univ_entry ~poly evd.universes
+let ind_univ_entry ~poly evd = UState.ind_univ_entry ~poly evd.universes
+
+let check_univ_decl ~poly evd decl = UState.check_univ_decl ~poly evd.universes decl
let restrict_universe_context evd vars =
{ evd with universes = UState.restrict evd.universes vars }
@@ -801,7 +803,7 @@ let make_evar_universe_context e l =
| Some us ->
List.fold_left
(fun uctx (loc,id) ->
- fst (UState.new_univ_variable ?loc univ_rigid (Some (Id.to_string id)) uctx))
+ fst (UState.new_univ_variable ?loc univ_rigid (Some id) uctx))
uctx us
(****************************************)
@@ -853,7 +855,7 @@ let normalize_universe evd =
let normalize_universe_instance evd l =
let vars = ref (UState.subst evd.universes) in
- let normalize = Univ.level_subst_of (Universes.normalize_univ_variable_opt_subst vars) in
+ let normalize = Universes.level_subst_of (Universes.normalize_univ_variable_opt_subst vars) in
Univ.Instance.subst_fn normalize l
let normalize_sort evars s =
@@ -932,8 +934,7 @@ let nf_constraints evd =
let universe_of_name evd s = UState.universe_of_name evd.universes s
-let add_universe_name evd s l =
- { evd with universes = UState.add_universe_name evd.universes s l }
+let universe_binders evd = UState.universe_binders evd.universes
let universes evd = UState.ugraph evd.universes
diff --git a/engine/evd.mli b/engine/evd.mli
index 96e4b6acc..b28ce2a62 100644
--- a/engine/evd.mli
+++ b/engine/evd.mli
@@ -9,7 +9,7 @@
open Util
open Loc
open Names
-open Term
+open Constr
open Environ
(** This file defines the pervasive unification state used everywhere in Coq
@@ -28,12 +28,13 @@ open Environ
(** {5 Existential variables and unification states} *)
-(** {6 Evars} *)
-
-type evar = existential_key
+type evar = Evar.t
+[@@ocaml.deprecated "use Evar.t"]
(** Existential variables. *)
-val string_of_existential : evar -> string
+(** {6 Evars} *)
+val string_of_existential : Evar.t -> string
+[@@ocaml.deprecated "use Evar.print"]
(** {6 Evar filters} *)
@@ -125,6 +126,7 @@ val map_evar_info : (constr -> constr) -> evar_info -> evar_info
(** {6 Unification state} **)
type evar_universe_context = UState.t
+[@@ocaml.deprecated "Alias of UState.t"]
(** The universe context associated to an evar map *)
type evar_map
@@ -138,7 +140,7 @@ val from_env : env -> evar_map
(** The empty evar map with given universe context, taking its initial
universes from env. *)
-val from_ctx : evar_universe_context -> evar_map
+val from_ctx : UState.t -> evar_map
(** The empty evar map with given universe context *)
val is_empty : evar_map -> bool
@@ -149,44 +151,44 @@ val has_undefined : evar_map -> bool
there are uninstantiated evars in [sigma]. *)
val new_evar : evar_map ->
- ?name:Id.t -> evar_info -> evar_map * evar
+ ?name:Id.t -> evar_info -> evar_map * Evar.t
(** Creates a fresh evar mapping to the given information. *)
-val add : evar_map -> evar -> evar_info -> evar_map
+val add : evar_map -> Evar.t -> evar_info -> evar_map
(** [add sigma ev info] adds [ev] with evar info [info] in sigma.
Precondition: ev must not preexist in [sigma]. *)
-val find : evar_map -> evar -> evar_info
+val find : evar_map -> Evar.t -> evar_info
(** Recover the data associated to an evar. *)
-val find_undefined : evar_map -> evar -> evar_info
+val find_undefined : evar_map -> Evar.t -> evar_info
(** Same as {!find} but restricted to undefined evars. For efficiency
reasons. *)
-val remove : evar_map -> evar -> evar_map
+val remove : evar_map -> Evar.t -> evar_map
(** Remove an evar from an evar map. Use with caution. *)
-val mem : evar_map -> evar -> bool
+val mem : evar_map -> Evar.t -> bool
(** Whether an evar is present in an evarmap. *)
-val fold : (evar -> evar_info -> 'a -> 'a) -> evar_map -> 'a -> 'a
+val fold : (Evar.t -> evar_info -> 'a -> 'a) -> evar_map -> 'a -> 'a
(** Apply a function to all evars and their associated info in an evarmap. *)
-val fold_undefined : (evar -> evar_info -> 'a -> 'a) -> evar_map -> 'a -> 'a
+val fold_undefined : (Evar.t -> evar_info -> 'a -> 'a) -> evar_map -> 'a -> 'a
(** Same as {!fold}, but restricted to undefined evars. For efficiency
reasons. *)
-val raw_map : (evar -> evar_info -> evar_info) -> evar_map -> evar_map
+val raw_map : (Evar.t -> evar_info -> evar_info) -> evar_map -> evar_map
(** Apply the given function to all evars in the map. Beware: this function
expects the argument function to preserve the kind of [evar_body], i.e. it
must send [Evar_empty] to [Evar_empty] and [Evar_defined c] to some
[Evar_defined c']. *)
-val raw_map_undefined : (evar -> evar_info -> evar_info) -> evar_map -> evar_map
+val raw_map_undefined : (Evar.t -> evar_info -> evar_info) -> evar_map -> evar_map
(** Same as {!raw_map}, but restricted to undefined evars. For efficiency
reasons. *)
-val define : evar -> constr -> evar_map -> evar_map
+val define : Evar.t-> constr -> evar_map -> evar_map
(** Set the body of an evar to the given constr. It is expected that:
{ul
{- The evar is already present in the evarmap.}
@@ -197,16 +199,16 @@ val define : evar -> constr -> evar_map -> evar_map
val cmap : (constr -> constr) -> evar_map -> evar_map
(** Map the function on all terms in the evar map. *)
-val is_evar : evar_map -> evar -> bool
+val is_evar : evar_map -> Evar.t-> bool
(** Alias for {!mem}. *)
-val is_defined : evar_map -> evar -> bool
+val is_defined : evar_map -> Evar.t-> bool
(** Whether an evar is defined in an evarmap. *)
-val is_undefined : evar_map -> evar -> bool
+val is_undefined : evar_map -> Evar.t-> bool
(** Whether an evar is not defined in an evarmap. *)
-val add_constraints : evar_map -> Univ.constraints -> evar_map
+val add_constraints : evar_map -> Univ.Constraint.t -> evar_map
(** Add universe constraints in an evar map. *)
val undefined_map : evar_map -> evar_info Evar.Map.t
@@ -239,31 +241,31 @@ val evars_reset_evd : ?with_conv_pbs:bool -> ?with_univs:bool ->
(** {6 Misc} *)
-val restrict : evar -> Filter.t -> ?candidates:constr list ->
- ?src:Evar_kinds.t located -> evar_map -> evar_map * evar
+val restrict : Evar.t-> Filter.t -> ?candidates:constr list ->
+ ?src:Evar_kinds.t located -> evar_map -> evar_map * Evar.t
(** Restrict an undefined evar into a new evar by filtering context and
possibly limiting the instances to a set of candidates *)
-val is_restricted_evar : evar_info -> evar option
+val is_restricted_evar : evar_info -> Evar.t option
(** Tell if an evar comes from restriction of another evar, and if yes, which *)
-val downcast : evar -> types -> evar_map -> evar_map
+val downcast : Evar.t-> types -> evar_map -> evar_map
(** Change the type of an undefined evar to a new type assumed to be a
subtype of its current type; subtyping must be ensured by caller *)
-val evar_source : existential_key -> evar_map -> Evar_kinds.t located
+val evar_source : Evar.t -> evar_map -> Evar_kinds.t located
(** Convenience function. Wrapper around {!find} to recover the source of an
evar in a given evar map. *)
-val evar_ident : existential_key -> evar_map -> Id.t option
+val evar_ident : Evar.t -> evar_map -> Id.t option
-val rename : existential_key -> Id.t -> evar_map -> evar_map
+val rename : Evar.t -> Id.t -> evar_map -> evar_map
-val evar_key : Id.t -> evar_map -> existential_key
+val evar_key : Id.t -> evar_map -> Evar.t
val evar_source_of_meta : metavariable -> evar_map -> Evar_kinds.t located
-val dependent_evar_ident : existential_key -> evar_map -> Id.t
+val dependent_evar_ident : Evar.t -> evar_map -> Id.t
(** {5 Side-effects} *)
@@ -314,7 +316,7 @@ val whd_sort_variable : evar_map -> constr -> constr
exception UniversesDiffer
-val add_universe_constraints : evar_map -> Universes.universe_constraints -> evar_map
+val add_universe_constraints : evar_map -> Universes.Constraints.t -> evar_map
(** Add the given universe unification constraints to the evar map.
@raises UniversesDiffer in case a first-order unification fails.
@raises UniverseInconsistency
@@ -486,88 +488,97 @@ val univ_rigid : rigid
val univ_flexible : rigid
val univ_flexible_alg : rigid
-type 'a in_evar_universe_context = 'a * evar_universe_context
+type 'a in_evar_universe_context = 'a * UState.t
+
+val evar_universe_context_set : UState.t -> Univ.ContextSet.t
+val evar_universe_context_constraints : UState.t -> Univ.Constraint.t
+val evar_context_universe_context : UState.t -> Univ.UContext.t
+[@@ocaml.deprecated "alias of UState.context"]
-val evar_universe_context_set : evar_universe_context -> Univ.universe_context_set
-val evar_universe_context_constraints : evar_universe_context -> Univ.constraints
-val evar_context_universe_context : evar_universe_context -> Univ.universe_context
-val evar_universe_context_of : Univ.universe_context_set -> evar_universe_context
-val empty_evar_universe_context : evar_universe_context
-val union_evar_universe_context : evar_universe_context -> evar_universe_context ->
- evar_universe_context
-val evar_universe_context_subst : evar_universe_context -> Universes.universe_opt_subst
-val constrain_variables : Univ.LSet.t -> evar_universe_context -> evar_universe_context
+val evar_universe_context_of : Univ.ContextSet.t -> UState.t
+val empty_evar_universe_context : UState.t
+val union_evar_universe_context : UState.t -> UState.t ->
+ UState.t
+val evar_universe_context_subst : UState.t -> Universes.universe_opt_subst
+val constrain_variables : Univ.LSet.t -> UState.t -> UState.t
val evar_universe_context_of_binders :
- Universes.universe_binders -> evar_universe_context
-
-val make_evar_universe_context : env -> (Id.t located) list option -> evar_universe_context
-val restrict_universe_context : evar_map -> Univ.universe_set -> evar_map
+ Universes.universe_binders -> UState.t
+
+val make_evar_universe_context : env -> (Id.t located) list option -> UState.t
+val restrict_universe_context : evar_map -> Univ.LSet.t -> evar_map
(** Raises Not_found if not a name for a universe in this map. *)
-val universe_of_name : evar_map -> string -> Univ.universe_level
-val add_universe_name : evar_map -> string -> Univ.universe_level -> evar_map
+val universe_of_name : evar_map -> Id.t -> Univ.Level.t
-val add_constraints_context : evar_universe_context ->
- Univ.constraints -> evar_universe_context
+val universe_binders : evar_map -> Universes.universe_binders
+val add_constraints_context : UState.t ->
+ Univ.Constraint.t -> UState.t
-val normalize_evar_universe_context_variables : evar_universe_context ->
+val normalize_evar_universe_context_variables : UState.t ->
Univ.universe_subst in_evar_universe_context
-val normalize_evar_universe_context : evar_universe_context ->
- evar_universe_context
+val normalize_evar_universe_context : UState.t ->
+ UState.t
-val new_univ_level_variable : ?loc:Loc.t -> ?name:string -> rigid -> evar_map -> evar_map * Univ.universe_level
-val new_univ_variable : ?loc:Loc.t -> ?name:string -> rigid -> evar_map -> evar_map * Univ.universe
-val new_sort_variable : ?loc:Loc.t -> ?name:string -> rigid -> evar_map -> evar_map * sorts
+val new_univ_level_variable : ?loc:Loc.t -> ?name:Id.t -> rigid -> evar_map -> evar_map * Univ.Level.t
+val new_univ_variable : ?loc:Loc.t -> ?name:Id.t -> rigid -> evar_map -> evar_map * Univ.Universe.t
+val new_sort_variable : ?loc:Loc.t -> ?name:Id.t -> rigid -> evar_map -> evar_map * Sorts.t
val add_global_univ : evar_map -> Univ.Level.t -> evar_map
val universe_rigidity : evar_map -> Univ.Level.t -> rigid
-val make_flexible_variable : evar_map -> algebraic:bool -> Univ.universe_level -> evar_map
+val make_flexible_variable : evar_map -> algebraic:bool -> Univ.Level.t -> evar_map
(** See [UState.make_flexible_variable] *)
-val is_sort_variable : evar_map -> sorts -> Univ.universe_level option
+val is_sort_variable : evar_map -> Sorts.t -> Univ.Level.t option
(** [is_sort_variable evm s] returns [Some u] or [None] if [s] is
not a local sort variable declared in [evm] *)
val is_flexible_level : evar_map -> Univ.Level.t -> bool
-(* val normalize_universe_level : evar_map -> Univ.universe_level -> Univ.universe_level *)
-val normalize_universe : evar_map -> Univ.universe -> Univ.universe
-val normalize_universe_instance : evar_map -> Univ.universe_instance -> Univ.universe_instance
+(* val normalize_universe_level : evar_map -> Univ.Level.t -> Univ.Level.t *)
+val normalize_universe : evar_map -> Univ.Universe.t -> Univ.Universe.t
+val normalize_universe_instance : evar_map -> Univ.Instance.t -> Univ.Instance.t
-val set_leq_sort : env -> evar_map -> sorts -> sorts -> evar_map
-val set_eq_sort : env -> evar_map -> sorts -> sorts -> evar_map
-val has_lub : evar_map -> Univ.universe -> Univ.universe -> evar_map
-val set_eq_level : evar_map -> Univ.universe_level -> Univ.universe_level -> evar_map
-val set_leq_level : evar_map -> Univ.universe_level -> Univ.universe_level -> evar_map
+val set_leq_sort : env -> evar_map -> Sorts.t -> Sorts.t -> evar_map
+val set_eq_sort : env -> evar_map -> Sorts.t -> Sorts.t -> evar_map
+val has_lub : evar_map -> Univ.Universe.t -> Univ.Universe.t -> evar_map
+val set_eq_level : evar_map -> Univ.Level.t -> Univ.Level.t -> evar_map
+val set_leq_level : evar_map -> Univ.Level.t -> Univ.Level.t -> evar_map
val set_eq_instances : ?flex:bool ->
- evar_map -> Univ.universe_instance -> Univ.universe_instance -> evar_map
+ evar_map -> Univ.Instance.t -> Univ.Instance.t -> evar_map
-val check_eq : evar_map -> Univ.universe -> Univ.universe -> bool
-val check_leq : evar_map -> Univ.universe -> Univ.universe -> bool
+val check_eq : evar_map -> Univ.Universe.t -> Univ.Universe.t -> bool
+val check_leq : evar_map -> Univ.Universe.t -> Univ.Universe.t -> bool
-val evar_universe_context : evar_map -> evar_universe_context
-val universe_context_set : evar_map -> Univ.universe_context_set
-val universe_context : names:(Id.t located) list -> extensible:bool -> evar_map ->
- (Id.t * Univ.Level.t) list * Univ.universe_context
+val evar_universe_context : evar_map -> UState.t
+val universe_context_set : evar_map -> Univ.ContextSet.t
val universe_subst : evar_map -> Universes.universe_opt_subst
val universes : evar_map -> UGraph.t
-val check_univ_decl : evar_map -> UState.universe_decl ->
- Universes.universe_binders * Univ.universe_context
+(** [to_universe_context evm] extracts the local universes and
+ constraints of [evm] and orders the universes the same as
+ [Univ.ContextSet.to_context]. *)
+val to_universe_context : evar_map -> Univ.UContext.t
+
+val const_univ_entry : poly:bool -> evar_map -> Entries.constant_universes_entry
+
+(** NB: [ind_univ_entry] cannot create cumulative entries. *)
+val ind_univ_entry : poly:bool -> evar_map -> Entries.inductive_universes
-val merge_universe_context : evar_map -> evar_universe_context -> evar_map
-val set_universe_context : evar_map -> evar_universe_context -> evar_map
+val check_univ_decl : poly:bool -> evar_map -> UState.universe_decl -> Entries.constant_universes_entry
-val merge_context_set : ?loc:Loc.t -> ?sideff:bool -> rigid -> evar_map -> Univ.universe_context_set -> evar_map
+val merge_universe_context : evar_map -> UState.t -> evar_map
+val set_universe_context : evar_map -> UState.t -> evar_map
+
+val merge_context_set : ?loc:Loc.t -> ?sideff:bool -> rigid -> evar_map -> Univ.ContextSet.t -> evar_map
val merge_universe_subst : evar_map -> Universes.universe_opt_subst -> evar_map
val with_context_set : ?loc:Loc.t -> rigid -> evar_map -> 'a Univ.in_universe_context_set -> evar_map * 'a
val nf_univ_variables : evar_map -> evar_map * Univ.universe_subst
-val abstract_undefined_variables : evar_universe_context -> evar_universe_context
+val abstract_undefined_variables : UState.t -> UState.t
val fix_undefined_variables : evar_map -> evar_map
@@ -579,8 +590,8 @@ val update_sigma_env : evar_map -> env -> evar_map
(** Polymorphic universes *)
-val fresh_sort_in_family : ?loc:Loc.t -> ?rigid:rigid -> env -> evar_map -> sorts_family -> evar_map * sorts
-val fresh_constant_instance : ?loc:Loc.t -> env -> evar_map -> constant -> evar_map * pconstant
+val fresh_sort_in_family : ?loc:Loc.t -> ?rigid:rigid -> env -> evar_map -> Sorts.family -> evar_map * Sorts.t
+val fresh_constant_instance : ?loc:Loc.t -> env -> evar_map -> Constant.t -> evar_map * pconstant
val fresh_inductive_instance : ?loc:Loc.t -> env -> evar_map -> inductive -> evar_map * pinductive
val fresh_constructor_instance : ?loc:Loc.t -> env -> evar_map -> constructor -> evar_map * pconstructor
@@ -598,11 +609,16 @@ type open_constr = evar_map * constr (* Special case when before is empty *)
type unsolvability_explanation = SeveralInstancesFound of int
(** Failure explanation. *)
+(** {5 Summary names} *)
+
+(* This stuff is internal and should not be used. Currently a hack in
+ the STM relies on it. *)
+val evar_counter_summary_tag : int Summary.Dyn.tag
+
(** {5 Deprecated functions} *)
+val create_evar_defs : evar_map -> evar_map
+(* XXX: This is supposed to be deprecated by used by ssrmatching, what
+ should the replacement be? *)
-val create_evar_defs : evar_map -> evar_map
(** Create an [evar_map] with empty meta map: *)
-(** {5 Summary names} *)
-
-val evar_counter_summary_name : string
diff --git a/engine/logic_monad.ml b/engine/logic_monad.ml
index bf1b3e0e8..9dc5d473b 100644
--- a/engine/logic_monad.ml
+++ b/engine/logic_monad.ml
@@ -95,7 +95,7 @@ struct
let print_char = fun c -> (); fun () -> print_char c
let timeout = fun n t -> (); fun () ->
- Control.timeout n t (Exception Timeout)
+ Control.timeout n t () (Exception Timeout)
let make f = (); fun () ->
try f ()
diff --git a/engine/namegen.ml b/engine/namegen.ml
index c548fc4ac..ff0b5a74e 100644
--- a/engine/namegen.ml
+++ b/engine/namegen.ml
@@ -61,9 +61,9 @@ let is_imported_ref = function
| VarRef _ -> false
| IndRef (kn,_)
| ConstructRef ((kn,_),_) ->
- let (mp,_,_) = repr_mind kn in is_imported_modpath mp
+ let (mp,_,_) = MutInd.repr3 kn in is_imported_modpath mp
| ConstRef kn ->
- let (mp,_,_) = repr_con kn in is_imported_modpath mp
+ let (mp,_,_) = Constant.repr3 kn in is_imported_modpath mp
let is_global id =
try
@@ -99,7 +99,7 @@ let head_name sigma c = (* Find the head constant of a constr if any *)
match EConstr.kind sigma c with
| Prod (_,_,c) | Lambda (_,_,c) | LetIn (_,_,_,c)
| Cast (c,_,_) | App (c,_) -> hdrec c
- | Proj (kn,_) -> Some (Label.to_id (con_label (Projection.constant kn)))
+ | Proj (kn,_) -> Some (Label.to_id (Constant.label (Projection.constant kn)))
| Const _ | Ind _ | Construct _ | Var _ as c ->
Some (basename_of_global (global_of_constr c))
| Fix ((_,i),(lna,_,_)) | CoFix (i,(lna,_,_)) ->
@@ -130,8 +130,8 @@ let hdchar env sigma c =
match EConstr.kind sigma c with
| Prod (_,_,c) | Lambda (_,_,c) | LetIn (_,_,_,c) -> hdrec (k+1) c
| Cast (c,_,_) | App (c,_) -> hdrec k c
- | Proj (kn,_) -> lowercase_first_char (Label.to_id (con_label (Projection.constant kn)))
- | Const (kn,_) -> lowercase_first_char (Label.to_id (con_label kn))
+ | Proj (kn,_) -> lowercase_first_char (Label.to_id (Constant.label (Projection.constant kn)))
+ | Const (kn,_) -> lowercase_first_char (Label.to_id (Constant.label kn))
| Ind (x,_) -> (try lowercase_first_char (basename_of_global (IndRef x)) with Not_found when !Flags.in_debugger -> "zz")
| Construct (x,_) -> (try lowercase_first_char (basename_of_global (ConstructRef x)) with Not_found when !Flags.in_debugger -> "zz")
| Var id -> lowercase_first_char id
diff --git a/engine/namegen.mli b/engine/namegen.mli
index d29b69259..abeed9f62 100644
--- a/engine/namegen.mli
+++ b/engine/namegen.mli
@@ -9,7 +9,6 @@
(** This file features facilities to generate fresh names. *)
open Names
-open Term
open Environ
open Evd
open EConstr
@@ -27,7 +26,7 @@ val default_dependent_ident : Id.t (* "x" *)
Generating "intuitive" names from their type *)
val lowercase_first_char : Id.t -> string
-val sort_hdchar : sorts -> string
+val sort_hdchar : Sorts.t -> string
val hdchar : env -> evar_map -> types -> string
val id_of_name_using_hdchar : env -> evar_map -> types -> Name.t -> Id.t
val named_hd : env -> evar_map -> types -> Name.t -> Name.t
diff --git a/library/nameops.ml b/engine/nameops.ml
index d598a63b8..5105d7bec 100644
--- a/library/nameops.ml
+++ b/engine/nameops.ml
@@ -203,13 +203,14 @@ let pr_name = print
let pr_lab l = Label.print l
-let default_library = Names.DirPath.initial (* = ["Top"] *)
-
-(*s Roots of the space of absolute names *)
-let coq_string = "Coq"
-let coq_root = Id.of_string coq_string
-let default_root_prefix = DirPath.empty
-
(* Metavariables *)
let pr_meta = Pp.int
let string_of_meta = string_of_int
+
+(* Deprecated *)
+open Libnames
+let default_library = default_library
+let coq_string = coq_string
+let coq_root = coq_root
+let default_root_prefix = default_root_prefix
+
diff --git a/library/nameops.mli b/engine/nameops.mli
index 58cd6ed4e..0fec8a925 100644
--- a/library/nameops.mli
+++ b/engine/nameops.mli
@@ -89,47 +89,50 @@ module Name : sig
end
+(** Metavariables *)
+val pr_meta : Constr.metavariable -> Pp.t
+val string_of_meta : Constr.metavariable -> string
+
val out_name : Name.t -> Id.t
-(** @deprecated Same as [Name.get_id] *)
+[@@ocaml.deprecated "Same as [Name.get_id]"]
val name_fold : (Id.t -> 'a -> 'a) -> Name.t -> 'a -> 'a
-(** @deprecated Same as [Name.fold_right] *)
+[@@ocaml.deprecated "Same as [Name.fold_right]"]
val name_iter : (Id.t -> unit) -> Name.t -> unit
-(** @deprecated Same as [Name.iter] *)
+[@@ocaml.deprecated "Same as [Name.iter]"]
val name_app : (Id.t -> Id.t) -> Name.t -> Name.t
-(** @deprecated Same as [Name.map] *)
+[@@ocaml.deprecated "Same as [Name.map]"]
val name_fold_map : ('a -> Id.t -> 'a * Id.t) -> 'a -> Name.t -> 'a * Name.t
-(** @deprecated Same as [Name.fold_left_map] *)
+[@@ocaml.deprecated "Same as [Name.fold_left_map]"]
val name_max : Name.t -> Name.t -> Name.t
-(** @deprecated Same as [Name.pick] *)
+[@@ocaml.deprecated "Same as [Name.pick]"]
val name_cons : Name.t -> Id.t list -> Id.t list
-(** @deprecated Same as [Name.cons] *)
+[@@ocaml.deprecated "Same as [Name.cons]"]
val pr_name : Name.t -> Pp.t
-(** @deprecated Same as [Name.print] *)
+[@@ocaml.deprecated "Same as [Name.print]"]
val pr_id : Id.t -> Pp.t
-(** @deprecated Same as [Names.Id.print] *)
+[@@ocaml.deprecated "Same as [Names.Id.print]"]
val pr_lab : Label.t -> Pp.t
+[@@ocaml.deprecated "Same as [Names.Label.print]"]
-(** some preset paths *)
-
+(** Deprecated stuff to libnames *)
val default_library : DirPath.t
+[@@ocaml.deprecated "Same as [Libnames.default_library]"]
-(** This is the root of the standard library of Coq *)
val coq_root : module_ident (** "Coq" *)
+[@@ocaml.deprecated "Same as [Libnames.coq_root]"]
+
val coq_string : string (** "Coq" *)
+[@@ocaml.deprecated "Same as [Libnames.coq_string]"]
-(** This is the default root prefix for developments which doesn't
- mention a root *)
val default_root_prefix : DirPath.t
+[@@ocaml.deprecated "Same as [Libnames.default_root_prefix]"]
-(** Metavariables *)
-val pr_meta : Term.metavariable -> Pp.t
-val string_of_meta : Term.metavariable -> string
diff --git a/engine/proofview.ml b/engine/proofview.ml
index 598358c47..47b9b406d 100644
--- a/engine/proofview.ml
+++ b/engine/proofview.ml
@@ -634,32 +634,42 @@ let shelve_goals l =
InfoL.leaf (Info.Tactic (fun () -> Pp.str"shelve_goals")) >>
Shelf.modify (fun gls -> gls @ l)
-(** [contained_in_info e evi] checks whether the evar [e] appears in
- the hypotheses, the conclusion or the body of the evar_info
- [evi]. Note: since we want to use it on goals, the body is actually
- supposed to be empty. *)
-let contained_in_info sigma e evi =
- Evar.Set.mem e (Evd.evars_of_filtered_evar_info (Evarutil.nf_evar_info sigma evi))
-
(** [depends_on sigma src tgt] checks whether the goal [src] appears
as an existential variable in the definition of the goal [tgt] in
[sigma]. *)
let depends_on sigma src tgt =
let evi = Evd.find sigma tgt in
- contained_in_info sigma src evi
+ Evar.Set.mem src (Evd.evars_of_filtered_evar_info (Evarutil.nf_evar_info sigma evi))
+
+let unifiable_delayed g l =
+ CList.exists (fun (tgt, lazy evs) -> not (Evar.equal g tgt) && Evar.Set.mem g evs) l
+
+let free_evars sigma l =
+ let cache = Evarutil.create_undefined_evars_cache () in
+ let map ev =
+ (** Computes the set of evars appearing in the hypotheses, the conclusion or
+ the body of the evar_info [evi]. Note: since we want to use it on goals,
+ the body is actually supposed to be empty. *)
+ let evi = Evd.find sigma ev in
+ let fevs = lazy (Evarutil.filtered_undefined_evars_of_evar_info ~cache sigma evi) in
+ (ev, fevs)
+ in
+ List.map map l
(** [unifiable sigma g l] checks whether [g] appears in another
subgoal of [l]. The list [l] may contain [g], but it does not
affect the result. *)
let unifiable sigma g l =
- CList.exists (fun tgt -> not (Evar.equal g tgt) && depends_on sigma g tgt) l
+ let l = free_evars sigma l in
+ unifiable_delayed g l
(** [partition_unifiable sigma l] partitions [l] into a pair [(u,n)]
where [u] is composed of the unifiable goals, i.e. the goals on
whose definition other goals of [l] depend, and [n] are the
non-unifiable goals. *)
let partition_unifiable sigma l =
- CList.partition (fun g -> unifiable sigma g l) l
+ let fevs = free_evars sigma l in
+ CList.partition (fun g -> unifiable_delayed g fevs) l
(** Shelves the unifiable goals under focus, i.e. the goals which
appear in other goals under focus (the unfocused goals are not
@@ -1076,7 +1086,7 @@ module Goal = struct
end
end
- let enter_one f =
+ let enter_one ?(__LOC__=__LOC__) f =
let open Proof in
Comb.get >>= function
| [goal] -> begin
@@ -1087,7 +1097,8 @@ module Goal = struct
let (e, info) = CErrors.push e in
tclZERO ~info e
end
- | _ -> assert false (* unsatisfied not-exactly-one-goal precondition *)
+ | _ ->
+ CErrors.anomaly Pp.(str __LOC__ ++ str " enter_one")
let goals =
Pv.get >>= fun step ->
@@ -1200,7 +1211,7 @@ module V82 = struct
{ Evd.it = comb ; sigma = solution }
let top_goals initial { solution=solution; } =
- let goals = CList.map (fun (t,_) -> fst (Term.destEvar (EConstr.Unsafe.to_constr t))) initial in
+ let goals = CList.map (fun (t,_) -> fst (Constr.destEvar (EConstr.Unsafe.to_constr t))) initial in
{ Evd.it = goals ; sigma=solution; }
let top_evars initial =
diff --git a/engine/proofview.mli b/engine/proofview.mli
index d92d0a7d5..b02fde3a8 100644
--- a/engine/proofview.mli
+++ b/engine/proofview.mli
@@ -25,7 +25,7 @@ type proofview
new nearly identical function everytime. Hence the generic name. *)
(* In this version: returns the list of focused goals together with
the [evar_map] context. *)
-val proofview : proofview -> Evd.evar list * Evd.evar_map
+val proofview : proofview -> Evar.t list * Evd.evar_map
(** {6 Starting and querying a proof view} *)
@@ -88,7 +88,7 @@ type focus_context
new nearly identical function everytime. 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 -> Evd.evar list * Evd.evar list
+val focus_context : focus_context -> Evar.t list * Evar.t list
(** [focus i j] focuses a proofview on the goals from index [i] to
index [j] (inclusive, goals are indexed from [1]). I.e. goals
@@ -148,7 +148,7 @@ type +'a tactic
{!Logic_monad.TacticFailure}*)
val apply : Environ.env -> 'a tactic -> proofview -> 'a
* proofview
- * (bool*Evd.evar list*Evd.evar list)
+ * (bool*Evar.t list*Evar.t list)
* Proofview_monad.Info.tree
(** {7 Monadic primitives} *)
@@ -304,12 +304,12 @@ val shelve : unit tactic
(** Shelves the given list of goals, which might include some that are
under focus and some that aren't. All the goals are placed on the
shelf for later use (or being solved by side-effects). *)
-val shelve_goals : Evd.evar list -> unit tactic
+val shelve_goals : Evar.t list -> unit tactic
(** [unifiable sigma g l] checks whether [g] appears in another
subgoal of [l]. The list [l] may contain [g], but it does not
affect the result. Used by [shelve_unifiable]. *)
-val unifiable : Evd.evar_map -> Evd.evar -> Evd.evar list -> bool
+val unifiable : Evd.evar_map -> Evar.t -> Evar.t list -> bool
(** Shelves the unifiable goals under focus, i.e. the goals which
appear in other goals under focus (the unfocused goals are not
@@ -322,15 +322,15 @@ val guard_no_unifiable : Names.Name.t list option tactic
(** [unshelve l p] adds all the goals in [l] at the end of the focused
goals of p *)
-val unshelve : Evd.evar list -> proofview -> proofview
+val unshelve : Evar.t list -> proofview -> proofview
(** [depends_on g1 g2 sigma] checks if g1 occurs in the type/ctx of g2 *)
-val depends_on : Evd.evar_map -> Evd.evar -> Evd.evar -> bool
+val depends_on : Evd.evar_map -> Evar.t -> Evar.t -> bool
(** [with_shelf tac] executes [tac] and returns its result together with
the set of goals shelved by [tac]. The current shelf is unchanged
and the returned list contains only unsolved goals. *)
-val with_shelf : 'a tactic -> (Evd.evar list * 'a) tactic
+val with_shelf : 'a tactic -> (Evar.t list * 'a) tactic
(** If [n] is positive, [cycle n] puts the [n] first goal last. If [n]
is negative, then it puts the [n] last goals first.*)
@@ -416,17 +416,17 @@ module Unsafe : sig
(** [tclNEWGOALS gls] adds the goals [gls] to the ones currently
being proved, appending them to the list of focused goals. If a
goal is already solved, it is not added. *)
- val tclNEWGOALS : Evd.evar list -> unit tactic
+ val tclNEWGOALS : Evar.t list -> unit tactic
(** [tclSETGOALS gls] sets goals [gls] as the goals being under focus. If a
goal is already solved, it is not set. *)
- val tclSETGOALS : Evd.evar list -> unit tactic
+ val tclSETGOALS : Evar.t list -> unit tactic
(** [tclGETGOALS] returns the list of goals under focus. *)
- val tclGETGOALS : Evd.evar list tactic
+ val tclGETGOALS : Evar.t list tactic
(** Sets the evar universe context. *)
- val tclEVARUNIVCONTEXT : Evd.evar_universe_context -> unit tactic
+ val tclEVARUNIVCONTEXT : UState.t -> unit tactic
(** Clears the future goals store in the proof view. *)
val reset_future_goals : proofview -> proofview
@@ -499,7 +499,7 @@ module Goal : sig
(** Like {!enter}, but assumes exactly one goal under focus, raising *)
(** a fatal error otherwise. *)
- val enter_one : ([ `LZ ] t -> 'a tactic) -> 'a tactic
+ val enter_one : ?__LOC__:string -> ([ `LZ ] t -> 'a tactic) -> 'a tactic
(** Recover the list of current goals under focus, without evar-normalization.
FIXME: encapsulate the level in an existential type. *)
@@ -563,11 +563,12 @@ module V82 : sig
(* Returns the open goals of the proofview together with the evar_map to
interpret them. *)
val goals : proofview -> Evar.t list Evd.sigma
+ [@@ocaml.deprecated "Use [Proofview.proofview]"]
val top_goals : entry -> proofview -> Evar.t list Evd.sigma
-
+
(* returns the existential variable used to start the proof *)
- val top_evars : entry -> Evd.evar list
+ val top_evars : entry -> Evar.t list
(* Caution: this function loses quite a bit of information. It
should be avoided as much as possible. It should work as
diff --git a/engine/termops.ml b/engine/termops.ml
index 76f707f94..40b3d0d8b 100644
--- a/engine/termops.ml
+++ b/engine/termops.ml
@@ -12,6 +12,7 @@ open Util
open Names
open Nameops
open Term
+open Constr
open Vars
open Environ
@@ -31,7 +32,7 @@ let pr_sort_family = function
| InProp -> (str "Prop")
| InType -> (str "Type")
-let pr_con sp = str(string_of_con sp)
+let pr_con sp = str(Constant.to_string sp)
let pr_fix pr_constr ((t,i),(lna,tl,bl)) =
let fixl = Array.mapi (fun i na -> (na,t.(i),tl.(i),bl.(i))) lna in
@@ -46,16 +47,16 @@ let pr_puniverses p u =
if Univ.Instance.is_empty u then p
else p ++ str"(*" ++ Univ.Instance.pr Universes.pr_with_global_universes u ++ str"*)"
-let rec pr_constr c = match kind_of_term c with
+let rec pr_constr c = match kind c with
| Rel n -> str "#"++int n
| Meta n -> str "Meta(" ++ int n ++ str ")"
- | Var id -> pr_id id
+ | Var id -> Id.print id
| Sort s -> print_sort s
| Cast (c,_, t) -> hov 1
(str"(" ++ pr_constr c ++ cut() ++
str":" ++ pr_constr t ++ str")")
| Prod (Name(id),t,c) -> hov 1
- (str"forall " ++ pr_id id ++ str":" ++ pr_constr t ++ str"," ++
+ (str"forall " ++ Id.print id ++ str":" ++ pr_constr t ++ str"," ++
spc() ++ pr_constr c)
| Prod (Anonymous,t,c) -> hov 0
(str"(" ++ pr_constr t ++ str " ->" ++ spc() ++
@@ -74,9 +75,9 @@ let rec pr_constr c = match kind_of_term c with
(str"Evar#" ++ int (Evar.repr e) ++ str"{" ++
prlist_with_sep spc pr_constr (Array.to_list l) ++str"}")
| Const (c,u) -> str"Cst(" ++ pr_puniverses (pr_con c) u ++ str")"
- | Ind ((sp,i),u) -> str"Ind(" ++ pr_puniverses (pr_mind sp ++ str"," ++ int i) u ++ str")"
+ | Ind ((sp,i),u) -> str"Ind(" ++ pr_puniverses (MutInd.print sp ++ str"," ++ int i) u ++ str")"
| Construct (((sp,i),j),u) ->
- str"Constr(" ++ pr_puniverses (pr_mind sp ++ str"," ++ int i ++ str"," ++ int j) u ++ str")"
+ str"Constr(" ++ pr_puniverses (MutInd.print sp ++ str"," ++ int i ++ str"," ++ int j) u ++ str")"
| Proj (p,c) -> str"Proj(" ++ pr_con (Projection.constant p) ++ str"," ++ bool (Projection.unfolded p) ++ pr_constr c ++ str")"
| Case (ci,p,c,bl) -> v 0
(hv 0 (str"<"++pr_constr p++str">"++ cut() ++ str"Case " ++
@@ -129,9 +130,9 @@ let pr_existential_key sigma evk =
let open Evd in
match evar_ident evk sigma with
| None ->
- str "?" ++ pr_id (pr_evar_suggested_name evk sigma)
+ str "?" ++ Id.print (pr_evar_suggested_name evk sigma)
| Some id ->
- str "?" ++ pr_id id
+ str "?" ++ Id.print id
let pr_instance_status (sc,typ) =
let open Evd in
@@ -157,7 +158,7 @@ let pr_meta_map evd =
let open Evd in
let print_constr = print_kconstr in
let pr_name = function
- Name id -> str"[" ++ pr_id id ++ str"]"
+ Name id -> str"[" ++ Id.print id ++ str"]"
| _ -> mt() in
let pr_meta_binding = function
| (mv,Cltyp (na,b)) ->
@@ -177,23 +178,23 @@ let pr_decl (decl,ok) =
let open NamedDecl in
let print_constr = print_kconstr in
match decl with
- | LocalAssum (id,_) -> if ok then pr_id id else (str "{" ++ pr_id id ++ str "}")
- | LocalDef (id,c,_) -> str (if ok then "(" else "{") ++ pr_id id ++ str ":=" ++
+ | LocalAssum (id,_) -> if ok then Id.print id else (str "{" ++ Id.print id ++ str "}")
+ | LocalDef (id,c,_) -> str (if ok then "(" else "{") ++ Id.print id ++ str ":=" ++
print_constr c ++ str (if ok then ")" else "}")
let pr_evar_source = function
- | Evar_kinds.NamedHole id -> pr_id id
+ | Evar_kinds.NamedHole id -> Id.print id
| Evar_kinds.QuestionMark _ -> str "underscore"
| Evar_kinds.CasesType false -> str "pattern-matching return predicate"
| Evar_kinds.CasesType true ->
str "subterm of pattern-matching return predicate"
- | Evar_kinds.BinderType (Name id) -> str "type of " ++ Nameops.pr_id id
+ | Evar_kinds.BinderType (Name id) -> str "type of " ++ Id.print id
| Evar_kinds.BinderType Anonymous -> str "type of anonymous binder"
| Evar_kinds.ImplicitArg (c,(n,ido),b) ->
let open Globnames in
let print_constr = print_kconstr in
let id = Option.get ido in
- str "parameter " ++ pr_id id ++ spc () ++ str "of" ++
+ str "parameter " ++ Id.print id ++ spc () ++ str "of" ++
spc () ++ print_constr (printable_constr_of_global c)
| Evar_kinds.InternalHole -> str "internal placeholder"
| Evar_kinds.TomatchTypeParameter (ind,n) ->
@@ -202,10 +203,9 @@ let pr_evar_source = function
| Evar_kinds.GoalEvar -> str "goal evar"
| Evar_kinds.ImpossibleCase -> str "type of impossible pattern-matching clause"
| Evar_kinds.MatchingVar _ -> str "matching variable"
- | Evar_kinds.VarInstance id -> str "instance of " ++ pr_id id
+ | Evar_kinds.VarInstance id -> str "instance of " ++ Id.print id
| Evar_kinds.SubEvar evk ->
- let open Evd in
- str "subterm of " ++ str (string_of_existential evk)
+ str "subterm of " ++ Evar.print evk
let pr_evar_info evi =
let open Evd in
@@ -288,6 +288,7 @@ let has_no_evar sigma =
with Exit -> false
let pr_evd_level evd = UState.pr_uctx_level (Evd.evar_universe_context evd)
+let reference_of_level evd l = UState.reference_of_level (Evd.evar_universe_context evd) l
let pr_evar_universe_context ctx =
let open UState in
@@ -355,7 +356,7 @@ let pr_evar_map_gen with_univs pr_evars sigma =
let pr_evar_list sigma l =
let open Evd in
let pr (ev, evi) =
- h 0 (str (string_of_existential ev) ++
+ h 0 (Evar.print ev ++
str "==" ++ pr_evar_info evi ++
(if evi.evar_body == Evar_empty
then str " {" ++ pr_existential_key sigma ev ++ str "}"
@@ -434,7 +435,7 @@ let pr_var_decl env decl =
(str" := " ++ pb ++ cut () ) in
let pt = print_constr_env env Evd.empty (EConstr.of_constr (get_type decl)) in
let ptyp = (str" : " ++ pt) in
- (pr_id (get_id decl) ++ hov 0 (pbody ++ ptyp))
+ (Id.print (get_id decl) ++ hov 0 (pbody ++ ptyp))
let pr_rel_decl env decl =
let open RelDecl in
@@ -448,7 +449,7 @@ let pr_rel_decl env decl =
let ptyp = print_constr_env env Evd.empty (EConstr.of_constr (get_type decl)) in
match get_name decl with
| Anonymous -> hov 0 (str"<>" ++ spc () ++ pbody ++ str":" ++ spc () ++ ptyp)
- | Name id -> hov 0 (pr_id id ++ spc () ++ pbody ++ str":" ++ spc () ++ ptyp)
+ | Name id -> hov 0 (Id.print id ++ spc () ++ pbody ++ str":" ++ spc () ++ ptyp)
let print_named_context env =
hv 0 (fold_named_context
@@ -798,7 +799,7 @@ let fold_constr_with_binders sigma g f n acc c =
let iter_constr_with_full_binders g f l c =
let open RelDecl in
- match kind_of_term c with
+ match kind c with
| (Rel _ | Meta _ | Var _ | Sort _ | Const _ | Ind _
| Construct _) -> ()
| Cast (c,_, t) -> f l c; f l t
@@ -983,9 +984,9 @@ let isMetaOf sigma mv c =
match EConstr.kind sigma c with Meta mv' -> Int.equal mv mv' | _ -> false
let rec subst_meta bl c =
- match kind_of_term c with
+ match kind c with
| Meta i -> (try Int.List.assoc i bl with Not_found -> c)
- | _ -> map_constr (subst_meta bl) c
+ | _ -> Constr.map (subst_meta bl) c
let rec strip_outer_cast sigma c = match EConstr.kind sigma c with
| Cast (c,_,_) -> strip_outer_cast sigma c
@@ -1462,6 +1463,18 @@ let prod_applist sigma c l =
| _ -> anomaly (Pp.str "Not enough prod's.") in
app [] c l
+let prod_applist_assum sigma n c l =
+ let open EConstr in
+ let rec app n subst c l =
+ if Int.equal n 0 then
+ if l == [] then Vars.substl subst c
+ else anomaly (Pp.str "Not enough arguments.")
+ else match EConstr.kind sigma c, l with
+ | Prod(_,_,c), arg::l -> app (n-1) (arg::subst) c l
+ | LetIn(_,b,_,c), _ -> app (n-1) (Vars.substl subst b::subst) c l
+ | _ -> anomaly (Pp.str "Not enough prod/let's.") in
+ app n [] c l
+
(* Combinators on judgments *)
let on_judgment f j = { uj_val = f j.uj_val; uj_type = f j.uj_type }
diff --git a/engine/termops.mli b/engine/termops.mli
index ef2c52a45..a3559a693 100644
--- a/engine/termops.mli
+++ b/engine/termops.mli
@@ -10,13 +10,13 @@
needed in the kernel. *)
open Names
-open Term
+open Constr
open Environ
open EConstr
(** printers *)
-val print_sort : sorts -> Pp.t
-val pr_sort_family : sorts_family -> Pp.t
+val print_sort : Sorts.t -> Pp.t
+val pr_sort_family : Sorts.family -> Pp.t
val pr_fix : ('a -> Pp.t) -> ('a, 'a) pfixpoint -> Pp.t
(** about contexts *)
@@ -91,7 +91,7 @@ exception Occur
val occur_meta : Evd.evar_map -> constr -> bool
val occur_existential : Evd.evar_map -> constr -> bool
val occur_meta_or_existential : Evd.evar_map -> constr -> bool
-val occur_evar : Evd.evar_map -> existential_key -> constr -> bool
+val occur_evar : Evd.evar_map -> Evar.t -> constr -> bool
val occur_var : env -> Evd.evar_map -> Id.t -> constr -> bool
val occur_var_in_decl :
env -> Evd.evar_map ->
@@ -113,6 +113,7 @@ val collect_metas : Evd.evar_map -> constr -> int list
val collect_vars : Evd.evar_map -> constr -> Id.Set.t (** for visible vars only *)
val vars_of_global_reference : env -> Globnames.global_reference -> Id.Set.t
val occur_term : Evd.evar_map -> constr -> constr -> bool (** Synonymous of dependent *)
+[@@ocaml.deprecated "alias of Termops.dependent"]
(* Substitution of metavariables *)
type meta_value_map = (metavariable * Constr.constr) list
@@ -147,7 +148,7 @@ val subst_term : Evd.evar_map -> constr -> constr -> constr
val replace_term : Evd.evar_map -> constr -> constr -> constr -> constr
(** Alternative term equalities *)
-val base_sort_cmp : Reduction.conv_pb -> sorts -> sorts -> bool
+val base_sort_cmp : Reduction.conv_pb -> Sorts.t -> Sorts.t -> bool
val compare_constr_univ : Evd.evar_map -> (Reduction.conv_pb -> constr -> constr -> bool) ->
Reduction.conv_pb -> constr -> constr -> bool
val constr_cmp : Evd.evar_map -> Reduction.conv_pb -> constr -> constr -> bool
@@ -158,8 +159,18 @@ val eta_reduce_head : Evd.evar_map -> constr -> constr
(** Flattens application lists *)
val collapse_appl : Evd.evar_map -> constr -> constr
+(** [prod_applist] [forall (x1:B1;...;xn:Bn), B] [a1...an] @return [B[a1...an]] *)
val prod_applist : Evd.evar_map -> constr -> constr list -> constr
+(** In [prod_applist_assum n c args], [c] is supposed to have the
+ form [∀Γ.c] with [Γ] of length [m] and possibly with let-ins; it
+ returns [c] with the assumptions of [Γ] instantiated by [args] and
+ the local definitions of [Γ] expanded.
+ Note that [n] counts both let-ins and prods, while the length of [args]
+ only counts prods. In other words, varying [n] changes how many
+ trailing let-ins are expanded. *)
+val prod_applist_assum : Evd.evar_map -> int -> constr -> constr list -> constr
+
(** Remove recursively the casts around a term i.e.
[strip_outer_cast (Cast (Cast ... (Cast c, t) ... ))] is [c]. *)
val strip_outer_cast : Evd.evar_map -> constr -> constr
@@ -270,6 +281,8 @@ val is_Prop : Evd.evar_map -> constr -> bool
val is_Set : Evd.evar_map -> constr -> bool
val is_Type : Evd.evar_map -> constr -> bool
+val reference_of_level : Evd.evar_map -> Univ.Level.t -> Libnames.reference
+
(** Combinators on judgments *)
val on_judgment : ('a -> 'b) -> ('a, 'a) punsafe_judgment -> ('b, 'b) punsafe_judgment
@@ -280,9 +293,9 @@ val on_judgment_type : ('t -> 't) -> ('c, 't) punsafe_judgment -> ('c, 't) puns
open Evd
-val pr_existential_key : evar_map -> evar -> Pp.t
+val pr_existential_key : evar_map -> Evar.t -> Pp.t
-val pr_evar_suggested_name : existential_key -> evar_map -> Id.t
+val pr_evar_suggested_name : Evar.t -> evar_map -> Id.t
val pr_evar_info : evar_info -> Pp.t
val pr_evar_constraints : evar_map -> evar_constraint list -> Pp.t
@@ -290,7 +303,7 @@ val pr_evar_map : ?with_univs:bool -> int option -> evar_map -> Pp.t
val pr_evar_map_filter : ?with_univs:bool -> (Evar.t -> evar_info -> bool) ->
evar_map -> Pp.t
val pr_metaset : Metaset.t -> Pp.t
-val pr_evar_universe_context : evar_universe_context -> Pp.t
+val pr_evar_universe_context : UState.t -> Pp.t
val pr_evd_level : evar_map -> Univ.Level.t -> Pp.t
(** debug printer: do not use to display terms to the casual user... *)
diff --git a/engine/uState.ml b/engine/uState.ml
index 13a9bb373..4b650c9c9 100644
--- a/engine/uState.ml
+++ b/engine/uState.ml
@@ -11,32 +11,21 @@ open CErrors
open Util
open Names
-module StringOrd = struct type t = string let compare = String.compare end
-module UNameMap = struct
+module UNameMap = Names.Id.Map
- include Map.Make(StringOrd)
-
- let union s t =
- if s == t then s
- else
- merge (fun k l r ->
- match l, r with
- | Some _, _ -> l
- | _, _ -> r) s t
-end
-
type uinfo = {
- uname : string option;
+ uname : Id.t option;
uloc : Loc.t option;
}
(* 2nd part used to check consistency on the fly. *)
type t =
- { uctx_names : Univ.Level.t UNameMap.t * uinfo Univ.LMap.t;
- uctx_local : Univ.universe_context_set; (** The local context of variables *)
+ { uctx_names : Universes.universe_binders * uinfo Univ.LMap.t;
+ uctx_local : Univ.ContextSet.t; (** The local context of variables *)
+ uctx_seff_univs : Univ.LSet.t; (** Local universes used through private constants *)
uctx_univ_variables : Universes.universe_opt_subst;
(** The local universes that are unification variables *)
- uctx_univ_algebraic : Univ.universe_set;
+ uctx_univ_algebraic : Univ.LSet.t;
(** The subset of unification variables that can be instantiated with
algebraic universes as they appear in inferred types only. *)
uctx_universes : UGraph.t; (** The current graph extended with the local constraints *)
@@ -46,6 +35,7 @@ type t =
let empty =
{ uctx_names = UNameMap.empty, Univ.LMap.empty;
uctx_local = Univ.ContextSet.empty;
+ uctx_seff_univs = Univ.LSet.empty;
uctx_univ_variables = Univ.LMap.empty;
uctx_univ_algebraic = Univ.LSet.empty;
uctx_universes = UGraph.initial_universes;
@@ -59,12 +49,21 @@ let is_empty ctx =
Univ.ContextSet.is_empty ctx.uctx_local &&
Univ.LMap.is_empty ctx.uctx_univ_variables
+let uname_union s t =
+ if s == t then s
+ else
+ UNameMap.merge (fun k l r ->
+ match l, r with
+ | Some _, _ -> l
+ | _, _ -> r) s t
+
let union ctx ctx' =
if ctx == ctx' then ctx
else if is_empty ctx' then ctx
else
let local = Univ.ContextSet.union ctx.uctx_local ctx'.uctx_local in
- let names = UNameMap.union (fst ctx.uctx_names) (fst ctx'.uctx_names) in
+ let seff = Univ.LSet.union ctx.uctx_seff_univs ctx'.uctx_seff_univs in
+ let names = uname_union (fst ctx.uctx_names) (fst ctx'.uctx_names) in
let newus = Univ.LSet.diff (Univ.ContextSet.levels ctx'.uctx_local)
(Univ.ContextSet.levels ctx.uctx_local) in
let newus = Univ.LSet.diff newus (Univ.LMap.domain ctx.uctx_univ_variables) in
@@ -74,6 +73,7 @@ let union ctx ctx' =
let names_rev = Univ.LMap.union (snd ctx.uctx_names) (snd ctx'.uctx_names) in
{ uctx_names = (names, names_rev);
uctx_local = local;
+ uctx_seff_univs = seff;
uctx_univ_variables =
Univ.LMap.subst_union ctx.uctx_univ_variables ctx'.uctx_univ_variables;
uctx_univ_algebraic =
@@ -91,6 +91,17 @@ let constraints ctx = snd ctx.uctx_local
let context ctx = Univ.ContextSet.to_context ctx.uctx_local
+let const_univ_entry ~poly uctx =
+ let open Entries in
+ if poly then Polymorphic_const_entry (context uctx)
+ else Monomorphic_const_entry (context_set uctx)
+
+(* does not support cumulativity since you need more info *)
+let ind_univ_entry ~poly uctx =
+ let open Entries in
+ if poly then Polymorphic_ind_entry (context uctx)
+ else Monomorphic_ind_entry (context_set uctx)
+
let of_context_set ctx = { empty with uctx_local = ctx }
let subst ctx = ctx.uctx_univ_variables
@@ -102,6 +113,9 @@ let initial_graph ctx = ctx.uctx_initial_universes
let algebraics ctx = ctx.uctx_univ_algebraic
let add_uctx_names ?loc s l (names, names_rev) =
+ if UNameMap.mem s names
+ then user_err ?loc ~hdr:"add_uctx_names"
+ Pp.(str "Universe " ++ Names.Id.print s ++ str" already bound.");
(UNameMap.add s l names, Univ.LMap.add l { uname = Some s; uloc = loc } names_rev)
let add_uctx_loc l loc (names, names_rev) =
@@ -111,13 +125,17 @@ let add_uctx_loc l loc (names, names_rev) =
let of_binders b =
let ctx = empty in
- let names =
- List.fold_left (fun acc (id, l) -> add_uctx_names (Id.to_string id) l acc)
- ctx.uctx_names b
- in { ctx with uctx_names = names }
+ let rmap =
+ UNameMap.fold (fun id l rmap ->
+ Univ.LMap.add l { uname = Some id; uloc = None } rmap)
+ b Univ.LMap.empty
+ in
+ { ctx with uctx_names = b, rmap }
+
+let universe_binders ctx = fst ctx.uctx_names
let instantiate_variable l b v =
- try v := Univ.LMap.update l (Some b) !v
+ try v := Univ.LMap.set l (Some b) !v
with Not_found -> assert false
exception UniversesDiffer
@@ -183,14 +201,18 @@ let process_universe_constraints ctx cstrs =
| None -> user_err Pp.(str "Algebraic universe on the right")
| Some r' ->
if Univ.Level.is_small r' then
- let levels = Univ.Universe.levels l in
- let fold l' local =
- let l = Univ.Universe.make l' in
- if Univ.Level.is_small l' || is_local l' then
- equalize_variables false l l' r r' local
- else raise (Univ.UniverseInconsistency (Univ.Le, l, r, None))
- in
- Univ.LSet.fold fold levels local
+ if not (Univ.Universe.is_levels l)
+ then
+ raise (Univ.UniverseInconsistency (Univ.Le, l, r, None))
+ else
+ let levels = Univ.Universe.levels l in
+ let fold l' local =
+ let l = Univ.Universe.make l' in
+ if Univ.Level.is_small l' || is_local l' then
+ equalize_variables false l l' r r' local
+ else raise (Univ.UniverseInconsistency (Univ.Le, l, r, None))
+ in
+ Univ.LSet.fold fold levels local
else
Univ.enforce_leq l r local
end
@@ -222,8 +244,8 @@ let add_constraints ctx cstrs =
uctx_univ_variables = vars;
uctx_universes = UGraph.merge_constraints local' ctx.uctx_universes }
-(* let addconstrkey = Profile.declare_profile "add_constraints_context";; *)
-(* let add_constraints_context = Profile.profile2 addconstrkey add_constraints_context;; *)
+(* let addconstrkey = CProfile.declare_profile "add_constraints_context";; *)
+(* let add_constraints_context = CProfile.profile2 addconstrkey add_constraints_context;; *)
let add_universe_constraints ctx cstrs =
let univs, local = ctx.uctx_local in
@@ -249,76 +271,123 @@ let constrain_variables diff ctx =
in
{ ctx with uctx_local = (univs, local); uctx_univ_variables = vars }
-
-let pr_uctx_level uctx =
+let reference_of_level uctx =
let map, map_rev = uctx.uctx_names in
fun l ->
- try str (Option.get (Univ.LMap.find l map_rev).uname)
+ try Libnames.Ident (Loc.tag @@ Option.get (Univ.LMap.find l map_rev).uname)
with Not_found | Option.IsNone ->
- Universes.pr_with_global_universes l
+ Universes.reference_of_level l
+
+let pr_uctx_level uctx l =
+ Libnames.pr_reference (reference_of_level uctx l)
type universe_decl =
(Names.Id.t Loc.located list, Univ.Constraint.t) Misctypes.gen_universe_decl
-let universe_context ~names ~extensible ctx =
- let levels = Univ.ContextSet.levels ctx.uctx_local in
+let error_unbound_universes left uctx =
+ let open Univ in
+ let n = LSet.cardinal left in
+ let loc =
+ try
+ let info =
+ LMap.find (LSet.choose left) (snd uctx.uctx_names) in
+ info.uloc
+ with Not_found -> None
+ in
+ user_err ?loc ~hdr:"universe_context"
+ ((str(CString.plural n "Universe") ++ spc () ++
+ LSet.pr (pr_uctx_level uctx) left ++
+ spc () ++ str (CString.conjugate_verb_to_be n) ++
+ str" unbound."))
+
+let universe_context ~names ~extensible uctx =
+ let open Univ in
+ let levels = ContextSet.levels uctx.uctx_local in
let newinst, left =
List.fold_right
(fun (loc,id) (newinst, acc) ->
let l =
- try UNameMap.find (Id.to_string id) (fst ctx.uctx_names)
- with Not_found ->
- user_err ?loc ~hdr:"universe_context"
- (str"Universe " ++ Nameops.pr_id id ++ str" is not bound anymore.")
- in (l :: newinst, Univ.LSet.remove l acc))
+ try UNameMap.find id (fst uctx.uctx_names)
+ with Not_found -> assert false
+ in (l :: newinst, LSet.remove l acc))
names ([], levels)
in
- if not extensible && not (Univ.LSet.is_empty left) then
- let n = Univ.LSet.cardinal left in
- let loc =
- try
- let info =
- Univ.LMap.find (Univ.LSet.choose left) (snd ctx.uctx_names) in
- info.uloc
- with Not_found -> None
- in
- user_err ?loc ~hdr:"universe_context"
- ((str(CString.plural n "Universe") ++ spc () ++
- Univ.LSet.pr (pr_uctx_level ctx) left ++
- spc () ++ str (CString.conjugate_verb_to_be n) ++
- str" unbound."))
+ if not extensible && not (LSet.is_empty left)
+ then error_unbound_universes left uctx
else
- let left = Univ.ContextSet.sort_levels (Array.of_list (Univ.LSet.elements left)) in
+ let left = ContextSet.sort_levels (Array.of_list (LSet.elements left)) in
let inst = Array.append (Array.of_list newinst) left in
- let inst = Univ.Instance.of_array inst in
- let map = List.map (fun (s,l) -> Id.of_string s, l) (UNameMap.bindings (fst ctx.uctx_names)) in
- let ctx = Univ.UContext.make (inst,
- Univ.ContextSet.constraints ctx.uctx_local) in
- map, ctx
+ let inst = Instance.of_array inst in
+ let ctx = UContext.make (inst, ContextSet.constraints uctx.uctx_local) in
+ ctx
-let check_implication uctx cstrs ctx =
+let check_universe_context_set ~names ~extensible uctx =
+ if extensible then ()
+ else
+ let open Univ in
+ let left = List.fold_left (fun left (loc,id) ->
+ let l =
+ try UNameMap.find id (fst uctx.uctx_names)
+ with Not_found -> assert false
+ in LSet.remove l left)
+ (ContextSet.levels uctx.uctx_local) names
+ in
+ if not (LSet.is_empty left)
+ then error_unbound_universes left uctx
+
+let check_implication uctx cstrs cstrs' =
let gr = initial_graph uctx in
let grext = UGraph.merge_constraints cstrs gr in
- let cstrs' = Univ.UContext.constraints ctx in
if UGraph.check_constraints cstrs' grext then ()
else CErrors.user_err ~hdr:"check_univ_decl"
(str "Universe constraints are not implied by the ones declared.")
-let check_univ_decl uctx decl =
+let check_mono_univ_decl uctx decl =
let open Misctypes in
- let pl, ctx = universe_context
- ~names:decl.univdecl_instance
- ~extensible:decl.univdecl_extensible_instance
- uctx
+ let () =
+ let names = decl.univdecl_instance in
+ let extensible = decl.univdecl_extensible_instance in
+ check_universe_context_set ~names ~extensible uctx
in
if not decl.univdecl_extensible_constraints then
- check_implication uctx decl.univdecl_constraints ctx;
- pl, ctx
+ check_implication uctx
+ decl.univdecl_constraints
+ (Univ.ContextSet.constraints uctx.uctx_local);
+ uctx.uctx_local
+
+let check_univ_decl ~poly uctx decl =
+ let open Misctypes in
+ let ctx =
+ let names = decl.univdecl_instance in
+ let extensible = decl.univdecl_extensible_instance in
+ if poly
+ then Entries.Polymorphic_const_entry (universe_context ~names ~extensible uctx)
+ else
+ let () = check_universe_context_set ~names ~extensible uctx in
+ Entries.Monomorphic_const_entry uctx.uctx_local
+ in
+ if not decl.univdecl_extensible_constraints then
+ check_implication uctx
+ decl.univdecl_constraints
+ (Univ.ContextSet.constraints uctx.uctx_local);
+ ctx
let restrict ctx vars =
+ let vars = Univ.LSet.union vars ctx.uctx_seff_univs in
+ let vars = Names.Id.Map.fold (fun na l vars -> Univ.LSet.add l vars)
+ (fst ctx.uctx_names) vars
+ in
let uctx' = Univops.restrict_universe_context ctx.uctx_local vars in
{ ctx with uctx_local = uctx' }
+let demote_seff_univs entry uctx =
+ let open Entries in
+ match entry.const_entry_universes with
+ | Polymorphic_const_entry _ -> uctx
+ | Monomorphic_const_entry (univs, _) ->
+ let seff = Univ.LSet.union uctx.uctx_seff_univs univs in
+ { uctx with uctx_seff_univs = seff }
+
type rigid =
| UnivRigid
| UnivFlexible of bool (** Is substitution by an algebraic ok? *)
@@ -380,7 +449,7 @@ let emit_side_effects eff u =
let new_univ_variable ?loc rigid name
({ uctx_local = ctx; uctx_univ_variables = uvars; uctx_univ_algebraic = avars} as uctx) =
- let u = Universes.new_univ_level (Global.current_dirpath ()) in
+ let u = Universes.new_univ_level () in
let ctx' = Univ.ContextSet.add_universe u ctx in
let uctx', pred =
match rigid with
@@ -437,6 +506,9 @@ let make_flexible_variable ctx ~algebraic u =
{ctx with uctx_univ_variables = uvars';
uctx_univ_algebraic = avars'}
+let make_flexible_nonalgebraic ctx =
+ {ctx with uctx_univ_algebraic = Univ.LSet.empty}
+
let is_sort_variable uctx s =
match s with
| Sorts.Type u ->
@@ -448,7 +520,7 @@ let is_sort_variable uctx s =
| _ -> None
let subst_univs_context_with_def def usubst (ctx, cst) =
- (Univ.LSet.diff ctx def, Univ.subst_univs_constraints usubst cst)
+ (Univ.LSet.diff ctx def, Universes.subst_univs_constraints usubst cst)
let normalize_variables uctx =
let normalized_variables, undef, def, subst =
@@ -497,7 +569,8 @@ let refresh_undefined_univ_variables uctx =
let initial = declare uctx.uctx_initial_universes in
let univs = declare UGraph.initial_universes in
let uctx' = {uctx_names = uctx.uctx_names;
- uctx_local = ctx';
+ uctx_local = ctx';
+ uctx_seff_univs = uctx.uctx_seff_univs;
uctx_univ_variables = vars; uctx_univ_algebraic = alg;
uctx_universes = univs;
uctx_initial_universes = initial } in
@@ -514,7 +587,8 @@ let normalize uctx =
Universes.refresh_constraints uctx.uctx_initial_universes us'
in
{ uctx_names = uctx.uctx_names;
- uctx_local = us';
+ uctx_local = us';
+ uctx_seff_univs = uctx.uctx_seff_univs; (* not sure about this *)
uctx_univ_variables = vars';
uctx_univ_algebraic = algs';
uctx_universes = universes;
@@ -523,10 +597,6 @@ let normalize uctx =
let universe_of_name uctx s =
UNameMap.find s (fst uctx.uctx_names)
-let add_universe_name uctx s l =
- let names' = add_uctx_names s l uctx.uctx_names in
- { uctx with uctx_names = names' }
-
let update_sigma_env uctx env =
let univs = Environ.universes env in
let eunivs =
diff --git a/engine/uState.mli b/engine/uState.mli
index c44f2c1d7..6657d6047 100644
--- a/engine/uState.mli
+++ b/engine/uState.mli
@@ -28,13 +28,15 @@ val is_empty : t -> bool
val union : t -> t -> t
-val of_context_set : Univ.universe_context_set -> t
+val of_context_set : Univ.ContextSet.t -> t
val of_binders : Universes.universe_binders -> t
+val universe_binders : t -> Universes.universe_binders
+
(** {5 Projections} *)
-val context_set : t -> Univ.universe_context_set
+val context_set : t -> Univ.ContextSet.t
(** The local context of the state, i.e. a set of bound variables together
with their associated constraints. *)
@@ -51,35 +53,41 @@ val algebraics : t -> Univ.LSet.t
(** The subset of unification variables that can be instantiated with algebraic
universes as they appear in inferred types only. *)
-val constraints : t -> Univ.constraints
+val constraints : t -> Univ.Constraint.t
(** Shorthand for {!context_set} composed with {!ContextSet.constraints}. *)
-val context : t -> Univ.universe_context
+val context : t -> Univ.UContext.t
(** Shorthand for {!context_set} with {!Context_set.to_context}. *)
+val const_univ_entry : poly:bool -> t -> Entries.constant_universes_entry
+(** Pick from {!context} or {!context_set} based on [poly]. *)
+
+val ind_univ_entry : poly:bool -> t -> Entries.inductive_universes
+(** Pick from {!context} or {!context_set} based on [poly].
+ Cannot create cumulative entries. *)
+
(** {5 Constraints handling} *)
-val add_constraints : t -> Univ.constraints -> t
+val add_constraints : t -> Univ.Constraint.t -> t
(**
@raise UniversesDiffer when universes differ
*)
-val add_universe_constraints : t -> Universes.universe_constraints -> t
+val add_universe_constraints : t -> Universes.Constraints.t -> t
(**
@raise UniversesDiffer when universes differ
*)
(** {5 Names} *)
-val add_universe_name : t -> string -> Univ.Level.t -> t
-(** Associate a human-readable name to a local variable. *)
-
-val universe_of_name : t -> string -> Univ.Level.t
+val universe_of_name : t -> Id.t -> Univ.Level.t
(** Retrieve the universe associated to the name. *)
(** {5 Unification} *)
-val restrict : t -> Univ.universe_set -> t
+val restrict : t -> Univ.LSet.t -> t
+
+val demote_seff_univs : Safe_typing.private_constants Entries.definition_entry -> t -> t
type rigid =
| UnivRigid
@@ -89,11 +97,11 @@ val univ_rigid : rigid
val univ_flexible : rigid
val univ_flexible_alg : rigid
-val merge : ?loc:Loc.t -> bool -> rigid -> t -> Univ.universe_context_set -> t
+val merge : ?loc:Loc.t -> bool -> rigid -> t -> Univ.ContextSet.t -> t
val merge_subst : t -> Universes.universe_opt_subst -> t
val emit_side_effects : Safe_typing.private_constants -> t -> t
-val new_univ_variable : ?loc:Loc.t -> rigid -> string option -> t -> t * Univ.Level.t
+val new_univ_variable : ?loc:Loc.t -> rigid -> Id.t option -> t -> t * Univ.Level.t
val add_global_univ : t -> Univ.Level.t -> t
(** [make_flexible_variable g algebraic l]
@@ -104,6 +112,11 @@ val add_global_univ : t -> Univ.Level.t -> t
universe. Otherwise the variable is just made flexible. *)
val make_flexible_variable : t -> algebraic:bool -> Univ.Level.t -> t
+(** Turn all undefined flexible algebraic variables into simply flexible
+ ones. Can be used in case the variables might appear in universe instances
+ (typically for polymorphic program obligations). *)
+val make_flexible_nonalgebraic : t -> t
+
val is_sort_variable : t -> Sorts.t -> Univ.Level.t option
val normalize_variables : t -> Univ.universe_subst * t
@@ -118,24 +131,23 @@ val refresh_undefined_univ_variables : t -> t * Univ.universe_level_subst
val normalize : t -> t
-(** [universe_context names extensible ctx]
+type universe_decl =
+ (Names.Id.t Loc.located list, Univ.Constraint.t) Misctypes.gen_universe_decl
- Return a universe context containing the local universes of [ctx]
- and their constraints. The universes corresponding to [names] come
- first in the order defined by that list.
+(** [check_univ_decl ctx decl]
- If [extensible] is false, check that the universes of [names] are
- the only local universes.
+ If non extensible in [decl], check that the local universes (resp.
+ universe constraints) in [ctx] are implied by [decl].
- Also return the association list of universe names and universes
- (including those not in [names]). *)
-val universe_context : names:(Id.t Loc.located) list -> extensible:bool -> t ->
- (Id.t * Univ.Level.t) list * Univ.universe_context
+ Return a [Entries.constant_universes_entry] containing the local
+ universes of [ctx] and their constraints.
-type universe_decl =
- (Names.Id.t Loc.located list, Univ.Constraint.t) Misctypes.gen_universe_decl
+ When polymorphic, the universes corresponding to
+ [decl.univdecl_instance] come first in the order defined by that
+ list. *)
+val check_univ_decl : poly:bool -> t -> universe_decl -> Entries.constant_universes_entry
-val check_univ_decl : t -> universe_decl -> Universes.universe_binders * Univ.universe_context
+val check_mono_univ_decl : t -> universe_decl -> Univ.ContextSet.t
(** {5 TODO: Document me} *)
@@ -144,3 +156,4 @@ val update_sigma_env : t -> Environ.env -> t
(** {5 Pretty-printing} *)
val pr_uctx_level : t -> Univ.Level.t -> Pp.t
+val reference_of_level : t -> Univ.Level.t -> Libnames.reference
diff --git a/engine/universes.ml b/engine/universes.ml
index 7f5bf24b7..eaddf98a8 100644
--- a/engine/universes.ml
+++ b/engine/universes.ml
@@ -6,32 +6,107 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
+open Sorts
open Util
open Pp
open Names
-open Term
+open Constr
open Environ
open Univ
open Globnames
-
-let pr_with_global_universes l =
- try Nameops.pr_id (LMap.find l (snd (Global.global_universe_names ())))
- with Not_found -> Level.pr l
+open Nametab
+
+let reference_of_level l =
+ match Level.name l with
+ | Some (d, n as na) ->
+ let qid =
+ try Nametab.shortest_qualid_of_universe na
+ with Not_found ->
+ let name = Id.of_string_soft (string_of_int n) in
+ Libnames.make_qualid d name
+ in Libnames.Qualid (Loc.tag @@ qid)
+ | None -> Libnames.Ident (Loc.tag @@ Id.of_string_soft (Level.to_string l))
+
+let pr_with_global_universes l = Libnames.pr_reference (reference_of_level l)
+
+(** Global universe information outside the kernel, to handle
+ polymorphic universe names in sections that have to be discharged. *)
+
+let universe_map = (Summary.ref UnivIdMap.empty ~name:"global universe info" : bool Nametab.UnivIdMap.t ref)
+
+let add_global_universe u p =
+ match Level.name u with
+ | Some n -> universe_map := Nametab.UnivIdMap.add n p !universe_map
+ | None -> ()
+
+let is_polymorphic l =
+ match Level.name l with
+ | Some n ->
+ (try Nametab.UnivIdMap.find n !universe_map
+ with Not_found -> false)
+ | None -> false
(** Local universe names of polymorphic references *)
-type universe_binders = (Id.t * Univ.universe_level) list
+type universe_binders = Univ.Level.t Names.Id.Map.t
+
+let empty_binders = Id.Map.empty
let universe_binders_table = Summary.ref Refmap.empty ~name:"universe binders"
-let universe_binders_of_global ref =
+let universe_binders_of_global ref : universe_binders =
try
let l = Refmap.find ref !universe_binders_table in l
- with Not_found -> []
+ with Not_found -> Names.Id.Map.empty
-let register_universe_binders ref l =
+let cache_ubinder (_,(ref,l)) =
universe_binders_table := Refmap.add ref l !universe_binders_table
+let subst_ubinder (subst,(ref,l as orig)) =
+ let ref' = fst (Globnames.subst_global subst ref) in
+ if ref == ref' then orig else ref', l
+
+let discharge_ubinder (_,(ref,l)) =
+ Some (Lib.discharge_global ref, l)
+
+let ubinder_obj : Globnames.global_reference * universe_binders -> Libobject.obj =
+ let open Libobject in
+ declare_object { (default_object "universe binder") with
+ cache_function = cache_ubinder;
+ load_function = (fun _ x -> cache_ubinder x);
+ classify_function = (fun x -> Substitute x);
+ subst_function = subst_ubinder;
+ discharge_function = discharge_ubinder;
+ rebuild_function = (fun x -> x); }
+
+let register_universe_binders ref ubinders =
+ let open Names in
+ (* Add the polymorphic (section) universes *)
+ let ubinders = UnivIdMap.fold (fun lvl poly ubinders ->
+ let qid = Nametab.shortest_qualid_of_universe lvl in
+ let level = Level.make (fst lvl) (snd lvl) in
+ if poly then Id.Map.add (snd (Libnames.repr_qualid qid)) level ubinders
+ else ubinders)
+ !universe_map ubinders
+ in
+ if not (Id.Map.is_empty ubinders)
+ then Lib.add_anonymous_leaf (ubinder_obj (ref,ubinders))
+
+type univ_name_list = Name.t Loc.located list
+
+let universe_binders_with_opt_names ref levels = function
+ | None -> universe_binders_of_global ref
+ | Some udecl ->
+ if Int.equal(List.length levels) (List.length udecl)
+ then
+ List.fold_left2 (fun acc (_,na) lvl -> match na with
+ | Anonymous -> acc
+ | Name na -> Names.Id.Map.add na lvl acc)
+ empty_binders udecl levels
+ else
+ CErrors.user_err ~hdr:"universe_binders_with_opt_names"
+ Pp.(str "Universe instance should have length " ++ int (List.length levels))
+
(* To disallow minimization to Set *)
let set_minimization = ref true
@@ -39,7 +114,7 @@ let is_set_minimization () = !set_minimization
type universe_constraint_type = ULe | UEq | ULub
-type universe_constraint = universe * universe_constraint_type * universe
+type universe_constraint = Universe.t * universe_constraint_type * Universe.t
module Constraints = struct
module S = Set.Make(
@@ -106,6 +181,30 @@ let enforce_eq_instances_univs strict x y c =
(fun x y -> Constraints.add (Universe.make x, d, Universe.make y))
ax ay c
+let enforce_univ_constraint (u,d,v) =
+ match d with
+ | Eq -> enforce_eq u v
+ | Le -> enforce_leq u v
+ | Lt -> enforce_leq (super u) v
+
+let subst_univs_level fn l =
+ try Some (fn l)
+ with Not_found -> None
+
+let subst_univs_constraint fn (u,d,v as c) cstrs =
+ let u' = subst_univs_level fn u in
+ let v' = subst_univs_level fn v in
+ match u', v' with
+ | None, None -> Constraint.add c cstrs
+ | Some u, None -> enforce_univ_constraint (u,d,Universe.make v) cstrs
+ | None, Some v -> enforce_univ_constraint (Universe.make u,d,v) cstrs
+ | Some u, Some v -> enforce_univ_constraint (u,d,v) cstrs
+
+let subst_univs_constraints subst csts =
+ Constraint.fold
+ (fun c cstrs -> subst_univs_constraint subst c cstrs)
+ csts Constraint.empty
+
let subst_univs_universe_constraint fn (u,d,v) =
let u' = subst_univs_universe fn u and v' = subst_univs_universe fn v in
if Universe.equal u' v' then None
@@ -157,11 +256,11 @@ let eq_constr_univs_infer_with kind1 kind2 univs fold m n accu =
if res then Some !cstrs else None
let compare_head_gen_proj env equ eqs eqc' m n =
- match kind_of_term m, kind_of_term n with
+ match kind m, kind n with
| Proj (p, c), App (f, args)
| App (f, args), Proj (p, c) ->
- (match kind_of_term f with
- | Const (p', u) when eq_constant (Projection.constant p) p' ->
+ (match kind f with
+ | Const (p', u) when Constant.equal (Projection.constant p) p' ->
let pb = Environ.lookup_projection p env in
let npars = pb.Declarations.proj_npars in
if Array.length args == npars + 1 then
@@ -190,14 +289,17 @@ let eq_constr_universes_proj env m n =
res, !cstrs
(* Generator of levels *)
-let new_univ_level, set_remote_new_univ_level =
+type universe_id = DirPath.t * int
+
+let new_univ_id, set_remote_new_univ_id =
RemoteCounter.new_counter ~name:"Universes" 0 ~incr:((+) 1)
- ~build:(fun n -> Univ.Level.make (Global.current_dirpath ()) n)
+ ~build:(fun n -> Global.current_dirpath (), n)
-let new_univ_level _ = new_univ_level ()
- (* Univ.Level.make db (new_univ_level ()) *)
+let new_univ_level () =
+ let dp, id = new_univ_id () in
+ Univ.Level.make dp id
-let fresh_level () = new_univ_level (Global.current_dirpath ())
+let fresh_level () = new_univ_level ()
(* TODO: remove *)
let new_univ dp = Univ.Universe.make (new_univ_level dp)
@@ -205,7 +307,7 @@ let new_Type dp = mkType (new_univ dp)
let new_Type_sort dp = Type (new_univ dp)
let fresh_universe_instance ctx =
- let init _ = new_univ_level (Global.current_dirpath ()) in
+ let init _ = new_univ_level () in
Instance.of_array (Array.init (AUContext.size ctx) init)
let fresh_instance_from_context ctx =
@@ -216,7 +318,7 @@ let fresh_instance_from_context ctx =
let fresh_instance ctx =
let ctx' = ref LSet.empty in
let init _ =
- let u = new_univ_level (Global.current_dirpath ()) in
+ let u = new_univ_level () in
ctx' := LSet.add u !ctx'; u
in
let inst = Instance.of_array (Array.init (AUContext.size ctx) init)
@@ -328,7 +430,7 @@ let fresh_global_or_constr_instance env = function
| IsGlobal gr -> fresh_global_instance env gr
let global_of_constr c =
- match kind_of_term c with
+ match kind c with
| Const (c, u) -> ConstRef c, u
| Ind (i, u) -> IndRef i, u
| Construct (c, u) -> ConstructRef c, u
@@ -390,8 +492,8 @@ let type_of_reference env r =
let type_of_global t = type_of_reference (Global.env ()) t
let fresh_sort_in_family env = function
- | InProp -> prop_sort, ContextSet.empty
- | InSet -> set_sort, ContextSet.empty
+ | InProp -> Sorts.prop, ContextSet.empty
+ | InSet -> Sorts.set, ContextSet.empty
| InType ->
let u = fresh_level () in
Type (Univ.Universe.make u), ContextSet.singleton u
@@ -413,7 +515,7 @@ module LevelUnionFind = Unionfind.Make (Univ.LSet) (Univ.LMap)
let add_list_map u t map =
try
let l = LMap.find u map in
- LMap.update u (t :: l) map
+ LMap.set u (t :: l) map
with Not_found ->
LMap.add u [t] map
@@ -441,15 +543,62 @@ let choose_canonical ctx flexible algs s =
let canon = LSet.choose algs in
canon, (global, rigid, LSet.remove canon flexible)
+let level_subst_of f =
+ fun l ->
+ try let u = f l in
+ match Universe.level u with
+ | None -> l
+ | Some l -> l
+ with Not_found -> l
+
+let subst_univs_fn_constr f c =
+ let changed = ref false in
+ let fu = Univ.subst_univs_universe f in
+ let fi = Univ.Instance.subst_fn (level_subst_of f) in
+ let rec aux t =
+ match kind t with
+ | Sort (Sorts.Type u) ->
+ let u' = fu u in
+ if u' == u then t else
+ (changed := true; mkSort (Sorts.sort_of_univ u'))
+ | Const (c, u) ->
+ let u' = fi u in
+ if u' == u then t
+ else (changed := true; mkConstU (c, u'))
+ | Ind (i, u) ->
+ let u' = fi u in
+ if u' == u then t
+ else (changed := true; mkIndU (i, u'))
+ | Construct (c, u) ->
+ let u' = fi u in
+ if u' == u then t
+ else (changed := true; mkConstructU (c, u'))
+ | _ -> map aux t
+ in
+ let c' = aux c in
+ if !changed then c' else c
+
+let subst_univs_constr subst c =
+ if Univ.is_empty_subst subst then c
+ else
+ let f = Univ.make_subst subst in
+ subst_univs_fn_constr f c
+
+let subst_univs_constr =
+ if Flags.profile then
+ let subst_univs_constr_key = CProfile.declare_profile "subst_univs_constr" in
+ CProfile.profile2 subst_univs_constr_key subst_univs_constr
+ else subst_univs_constr
+
let subst_univs_fn_puniverses lsubst (c, u as cu) =
let u' = Instance.subst_fn lsubst u in
if u' == u then cu else (c, u')
let nf_evars_and_universes_opt_subst f subst =
let subst = fun l -> match LMap.find l subst with None -> raise Not_found | Some l' -> l' in
- let lsubst = Univ.level_subst_of subst in
+ let lsubst = level_subst_of subst in
let rec aux c =
- match kind_of_term c with
+ match kind c with
| Evar (evk, args) ->
let args = Array.map aux args in
(match try f (evk, args) with Not_found -> None with
@@ -467,7 +616,7 @@ let nf_evars_and_universes_opt_subst f subst =
| Sort (Type u) ->
let u' = Univ.subst_univs_universe subst u in
if u' == u then c else mkSort (sort_of_univ u')
- | _ -> map_constr aux c
+ | _ -> Constr.map aux c
in aux
let fresh_universe_context_set_instance ctx =
@@ -506,7 +655,7 @@ let normalize_univ_variable_subst subst =
let find l = Univ.LMap.find l !subst in
let update l b =
assert (match Universe.level b with Some l' -> not (Level.equal l l') | None -> true);
- try subst := Univ.LMap.update l b !subst; b with Not_found -> assert false in
+ try subst := Univ.LMap.set l b !subst; b with Not_found -> assert false in
normalize_univ_variable ~find ~update
let normalize_universe_opt_subst subst =
@@ -526,8 +675,8 @@ let normalize_opt_subst ctx =
else try ignore(normalize u) with Not_found -> assert(false)) ctx
in !ectx
-type universe_opt_subst = universe option universe_map
-
+type universe_opt_subst = Universe.t option universe_map
+
let make_opt_subst s =
fun x ->
(match Univ.LMap.find x s with
@@ -536,8 +685,7 @@ let make_opt_subst s =
let subst_opt_univs_constr s =
let f = make_opt_subst s in
- Vars.subst_univs_fn_constr f
-
+ subst_univs_fn_constr f
let normalize_univ_variables ctx =
let ctx = normalize_opt_subst ctx in
@@ -788,7 +936,7 @@ let normalize_context_set ctx us algs =
(* We first put constraints in a normal-form: all self-loops are collapsed
to equalities. *)
let g = Univ.LSet.fold (fun v g -> UGraph.add_universe v false g)
- ctx UGraph.empty_universes
+ ctx UGraph.initial_universes
in
let g =
Univ.Constraint.fold
@@ -868,8 +1016,8 @@ let normalize_context_set ctx us algs =
let us = normalize_opt_subst us in
(us, algs), (ctx', Constraint.union noneqs eqs)
-(* let normalize_conkey = Profile.declare_profile "normalize_context_set" *)
-(* let normalize_context_set a b c = Profile.profile3 normalize_conkey normalize_context_set a b c *)
+(* let normalize_conkey = CProfile.declare_profile "normalize_context_set" *)
+(* let normalize_context_set a b c = CProfile.profile3 normalize_conkey normalize_context_set a b c *)
let is_trivial_leq (l,d,r) =
Univ.Level.is_prop l && (d == Univ.Le || (d == Univ.Lt && Univ.Level.is_set r))
diff --git a/engine/universes.mli b/engine/universes.mli
index 8b2217d44..130dcf8bb 100644
--- a/engine/universes.mli
+++ b/engine/universes.mli
@@ -8,7 +8,7 @@
open Util
open Names
-open Term
+open Constr
open Environ
open Univ
@@ -18,29 +18,52 @@ val is_set_minimization : unit -> bool
(** Universes *)
val pr_with_global_universes : Level.t -> Pp.t
+val reference_of_level : Level.t -> Libnames.reference
+
+(** Global universe information outside the kernel, to handle
+ polymorphic universes in sections that have to be discharged. *)
+val add_global_universe : Level.t -> Decl_kinds.polymorphic -> unit
+
+val is_polymorphic : Level.t -> bool
(** Local universe name <-> level mapping *)
-type universe_binders = (Id.t * Univ.universe_level) list
-
+type universe_binders = Univ.Level.t Names.Id.Map.t
+
+val empty_binders : universe_binders
+
val register_universe_binders : Globnames.global_reference -> universe_binders -> unit
val universe_binders_of_global : Globnames.global_reference -> universe_binders
+type univ_name_list = Name.t Loc.located list
+
+(** [universe_binders_with_opt_names ref u l]
+
+ If [l] is [Some univs] return the universe binders naming the levels of [u] by [univs] (skipping Anonymous).
+ May error if the lengths mismatch.
+
+ Otherwise return [universe_binders_of_global ref]. *)
+val universe_binders_with_opt_names : Globnames.global_reference ->
+ Univ.Level.t list -> univ_name_list option -> universe_binders
+
(** The global universe counter *)
-val set_remote_new_univ_level : universe_level RemoteCounter.installer
+type universe_id = DirPath.t * int
+
+val set_remote_new_univ_id : universe_id RemoteCounter.installer
(** Side-effecting functions creating new universe levels. *)
-val new_univ_level : Names.dir_path -> universe_level
-val new_univ : Names.dir_path -> universe
-val new_Type : Names.dir_path -> types
-val new_Type_sort : Names.dir_path -> sorts
+val new_univ_id : unit -> universe_id
+val new_univ_level : unit -> Level.t
+val new_univ : unit -> Universe.t
+val new_Type : unit -> types
+val new_Type_sort : unit -> Sorts.t
-val new_global_univ : unit -> universe in_universe_context_set
-val new_sort_in_family : sorts_family -> sorts
+val new_global_univ : unit -> Universe.t in_universe_context_set
+val new_sort_in_family : Sorts.family -> Sorts.t
(** {6 Constraints for type inference}
-
+
When doing conversion of universes, not only do we have =/<= constraints but
also Lub constraints which correspond to unification of two levels which might
not be necessary if unfolding is performed.
@@ -48,24 +71,26 @@ val new_sort_in_family : sorts_family -> sorts
type universe_constraint_type = ULe | UEq | ULub
-type universe_constraint = universe * universe_constraint_type * universe
+type universe_constraint = Universe.t * universe_constraint_type * Universe.t
module Constraints : sig
include Set.S with type elt = universe_constraint
-
+
val pr : t -> Pp.t
end
type universe_constraints = Constraints.t
-type 'a constraint_accumulator = universe_constraints -> 'a -> 'a option
-type 'a universe_constrained = 'a * universe_constraints
-type 'a universe_constraint_function = 'a -> 'a -> universe_constraints -> universe_constraints
+[@@ocaml.deprecated "Use Constraints.t"]
+
+type 'a constraint_accumulator = Constraints.t -> 'a -> 'a option
+type 'a universe_constrained = 'a * Constraints.t
+type 'a universe_constraint_function = 'a -> 'a -> Constraints.t -> Constraints.t
val subst_univs_universe_constraints : universe_subst_fn ->
- universe_constraints -> universe_constraints
+ Constraints.t -> Constraints.t
-val enforce_eq_instances_univs : bool -> universe_instance universe_constraint_function
+val enforce_eq_instances_univs : bool -> Instance.t universe_constraint_function
-val to_constraints : UGraph.t -> universe_constraints -> constraints
+val to_constraints : UGraph.t -> Constraints.t -> Constraint.t
(** [eq_constr_univs_infer_With kind1 kind2 univs m n] is a variant of
{!eq_constr_univs_infer} taking kind-of-term functions, to expose
@@ -82,15 +107,15 @@ val eq_constr_universes_proj : env -> constr -> constr -> bool universe_constrai
(** Build a fresh instance for a given context, its associated substitution and
the instantiated constraints. *)
-val fresh_instance_from_context : abstract_universe_context ->
- universe_instance constrained
+val fresh_instance_from_context : AUContext.t ->
+ Instance.t constrained
-val fresh_instance_from : abstract_universe_context -> universe_instance option ->
- universe_instance in_universe_context_set
+val fresh_instance_from : AUContext.t -> Instance.t option ->
+ Instance.t in_universe_context_set
-val fresh_sort_in_family : env -> sorts_family ->
- sorts in_universe_context_set
-val fresh_constant_instance : env -> constant ->
+val fresh_sort_in_family : env -> Sorts.family ->
+ Sorts.t in_universe_context_set
+val fresh_constant_instance : env -> Constant.t ->
pconstant in_universe_context_set
val fresh_inductive_instance : env -> inductive ->
pinductive in_universe_context_set
@@ -105,15 +130,15 @@ val fresh_global_or_constr_instance : env -> Globnames.global_reference_or_const
(** Get fresh variables for the universe context.
Useful to make tactics that manipulate constrs in universe contexts polymorphic. *)
-val fresh_universe_context_set_instance : universe_context_set ->
- universe_level_subst * universe_context_set
+val fresh_universe_context_set_instance : ContextSet.t ->
+ universe_level_subst * ContextSet.t
(** Raises [Not_found] if not a global reference. *)
val global_of_constr : constr -> Globnames.global_reference puniverses
val constr_of_global_univ : Globnames.global_reference puniverses -> constr
-val extend_context : 'a in_universe_context_set -> universe_context_set ->
+val extend_context : 'a in_universe_context_set -> ContextSet.t ->
'a in_universe_context_set
(** Simplification and pruning of constraints:
@@ -127,38 +152,43 @@ val extend_context : 'a in_universe_context_set -> universe_context_set ->
(a global one if there is one) and transitively saturate
the constraints w.r.t to the equalities. *)
-module UF : Unionfind.PartitionSig with type elt = universe_level
+module UF : Unionfind.PartitionSig with type elt = Level.t
+
+val level_subst_of : universe_subst_fn -> universe_level_subst_fn
+val subst_univs_constraints : universe_subst_fn -> Constraint.t -> Constraint.t
+
+val subst_univs_constr : universe_subst -> constr -> constr
-type universe_opt_subst = universe option universe_map
+type universe_opt_subst = Universe.t option universe_map
val make_opt_subst : universe_opt_subst -> universe_subst_fn
val subst_opt_univs_constr : universe_opt_subst -> constr -> constr
-val normalize_context_set : universe_context_set ->
+val normalize_context_set : ContextSet.t ->
universe_opt_subst (* The defined and undefined variables *) ->
- universe_set (* univ variables that can be substituted by algebraics *) ->
- (universe_opt_subst * universe_set) in_universe_context_set
+ LSet.t (* univ variables that can be substituted by algebraics *) ->
+ (universe_opt_subst * LSet.t) in_universe_context_set
val normalize_univ_variables : universe_opt_subst ->
- universe_opt_subst * universe_set * universe_set * universe_subst
+ universe_opt_subst * LSet.t * LSet.t * universe_subst
val normalize_univ_variable :
- find:(universe_level -> universe) ->
- update:(universe_level -> universe -> universe) ->
- universe_level -> universe
+ find:(Level.t -> Universe.t) ->
+ update:(Level.t -> Universe.t -> Universe.t) ->
+ Level.t -> Universe.t
val normalize_univ_variable_opt_subst : universe_opt_subst ref ->
- (universe_level -> universe)
+ (Level.t -> Universe.t)
val normalize_univ_variable_subst : universe_subst ref ->
- (universe_level -> universe)
+ (Level.t -> Universe.t)
val normalize_universe_opt_subst : universe_opt_subst ref ->
- (universe -> universe)
+ (Universe.t -> Universe.t)
val normalize_universe_subst : universe_subst ref ->
- (universe -> universe)
+ (Universe.t -> Universe.t)
(** Create a fresh global in the global environment, without side effects.
BEWARE: this raises an ANOMALY on polymorphic constants/inductives:
@@ -169,6 +199,7 @@ val constr_of_global : Globnames.global_reference -> constr
(** ** DEPRECATED ** synonym of [constr_of_global] *)
val constr_of_reference : Globnames.global_reference -> constr
+[@@ocaml.deprecated "synonym of [constr_of_global]"]
(** Returns the type of the global reference, by creating a fresh instance of polymorphic
references and computing their instantiated universe context. (side-effect on the
@@ -180,7 +211,7 @@ val type_of_global : Globnames.global_reference -> types in_universe_context_set
val nf_evars_and_universes_opt_subst : (existential -> constr option) ->
universe_opt_subst -> constr -> constr
-val refresh_constraints : UGraph.t -> universe_context_set -> universe_context_set * UGraph.t
+val refresh_constraints : UGraph.t -> ContextSet.t -> ContextSet.t * UGraph.t
(** Pretty-printing *)
@@ -188,11 +219,11 @@ val pr_universe_opt_subst : universe_opt_subst -> Pp.t
(** {6 Support for template polymorphism } *)
-val solve_constraints_system : universe option array -> universe array -> universe array ->
- universe array
+val solve_constraints_system : Universe.t option array -> Universe.t array -> Universe.t array ->
+ Universe.t array
(** Operations for universe_info_ind *)
(** Given a universe context representing constraints of an inductive
this function produces a UInfoInd.t that with the trivial subtyping relation. *)
-val univ_inf_ind_from_universe_context : universe_context -> cumulativity_info
+val univ_inf_ind_from_universe_context : UContext.t -> CumulativityInfo.t
diff --git a/engine/univops.ml b/engine/univops.ml
new file mode 100644
index 000000000..df25d8725
--- /dev/null
+++ b/engine/univops.ml
@@ -0,0 +1,111 @@
+(************************************************************************)
+(* v * The Coq Proof Assistant / The Coq Development Team *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(************************************************************************)
+
+open Univ
+open Constr
+
+let universes_of_constr env c =
+ let open Declarations in
+ let rec aux s c =
+ match kind c with
+ | Const (c, u) ->
+ begin match (Environ.lookup_constant c env).const_universes with
+ | Polymorphic_const _ ->
+ LSet.fold LSet.add (Instance.levels u) s
+ | Monomorphic_const (univs, _) ->
+ LSet.union s univs
+ end
+ | Ind ((mind,_), u) | Construct (((mind,_),_), u) ->
+ begin match (Environ.lookup_mind mind env).mind_universes with
+ | Cumulative_ind _ | Polymorphic_ind _ ->
+ LSet.fold LSet.add (Instance.levels u) s
+ | Monomorphic_ind (univs,_) ->
+ LSet.union s univs
+ end
+ | Sort u when not (Sorts.is_small u) ->
+ let u = Sorts.univ_of_sort u in
+ LSet.fold LSet.add (Universe.levels u) s
+ | _ -> Constr.fold aux s c
+ in aux LSet.empty c
+
+type graphnode = {
+ mutable up : constraint_type LMap.t;
+ mutable visited : bool
+}
+
+let merge_types d d0 =
+ match d, d0 with
+ | _, Lt | Lt, _ -> Lt
+ | Le, _ | _, Le -> Le
+ | Eq, Eq -> Eq
+
+let merge_up d b up =
+ let find = try Some (LMap.find b up) with Not_found -> None in
+ match find with
+ | Some d0 ->
+ let d = merge_types d d0 in
+ if d == d0 then up else LMap.add b d up
+ | None -> LMap.add b d up
+
+let add_up a d b graph =
+ let node, graph =
+ try LMap.find a graph, graph
+ with Not_found ->
+ let node = { up = LMap.empty; visited = false } in
+ node, LMap.add a node graph
+ in
+ node.up <- merge_up d b node.up;
+ graph
+
+(* for each node transitive close until you find a non removable, discard the rest *)
+let transitive_close removable graph =
+ let rec do_node a node =
+ if not node.visited
+ then
+ let keepup =
+ LMap.fold (fun b d keepup ->
+ if not (LSet.mem b removable)
+ then merge_up d b keepup
+ else
+ begin
+ match LMap.find b graph with
+ | bnode ->
+ do_node b bnode;
+ LMap.fold (fun k d' keepup ->
+ merge_up (merge_types d d') k keepup)
+ bnode.up keepup
+ | exception Not_found -> keepup
+ end
+ )
+ node.up LMap.empty
+ in
+ node.up <- keepup;
+ node.visited <- true
+ in
+ LMap.iter do_node graph
+
+let restrict_universe_context (univs,csts) keep =
+ let removable = LSet.diff univs keep in
+ let (csts, rem) =
+ Constraint.fold (fun (a,d,b as cst) (csts, rem) ->
+ if LSet.mem a removable || LSet.mem b removable
+ then (csts, add_up a d b rem)
+ else (Constraint.add cst csts, rem))
+ csts (Constraint.empty, LMap.empty)
+ in
+ transitive_close removable rem;
+ let csts =
+ LMap.fold (fun a node csts ->
+ if LSet.mem a removable
+ then csts
+ else
+ LMap.fold (fun b d csts -> Constraint.add (a,d,b) csts)
+ node.up csts)
+ rem csts
+ in
+ (LSet.inter univs keep, csts)
diff --git a/library/univops.mli b/engine/univops.mli
index 09147cb41..30fcc4368 100644
--- a/library/univops.mli
+++ b/engine/univops.mli
@@ -6,10 +6,11 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-open Term
+open Constr
open Univ
-(** Shrink a universe context to a restricted set of variables *)
+(** The universes of monomorphic constants appear. *)
+val universes_of_constr : Environ.env -> constr -> LSet.t
-val universes_of_constr : constr -> universe_set
-val restrict_universe_context : universe_context_set -> universe_set -> universe_context_set
+(** Shrink a universe context to a restricted set of variables *)
+val restrict_universe_context : ContextSet.t -> LSet.t -> ContextSet.t
diff --git a/grammar/tacextend.mlp b/grammar/tacextend.mlp
index 0b33dab05..c52a0040b 100644
--- a/grammar/tacextend.mlp
+++ b/grammar/tacextend.mlp
@@ -45,7 +45,7 @@ let rec make_let raw e = function
<:expr< let $lid:p$ = $v$ in $e$ >>
| _::l -> make_let raw e l
-let make_clause (pt,_,e) =
+let make_clause (pt,e) =
(make_patt pt,
ploc_vala None,
make_let false e pt)
@@ -76,7 +76,7 @@ let make_prod_item = function
<:expr< Tacentries.TacNonTerm (Loc.tag ( $mlexpr_of_symbol g$ , $mlexpr_of_option mlexpr_of_ident id$ ) ) >>
let mlexpr_of_clause cl =
- mlexpr_of_list (fun (a,_,_) -> mlexpr_of_list make_prod_item a) cl
+ mlexpr_of_list (fun (a,_) -> mlexpr_of_list make_prod_item a) cl
(** Special treatment of constr entries *)
let is_constr_gram = function
@@ -88,8 +88,8 @@ let make_var = function
| ExtNonTerminal (_, p) -> p
| _ -> assert false
-let declare_tactic loc tacname ~level classification clause = match clause with
-| [(ExtTerminal name) :: rem, _, tac] when List.for_all is_constr_gram rem ->
+let declare_tactic loc tacname ~level clause = match clause with
+| [(ExtTerminal name) :: rem, tac] when List.for_all is_constr_gram rem ->
(** The extension is only made of a name followed by constr entries: we do not
add any grammar nor printing rule and add it as a true Ltac definition. *)
let patt = make_patt rem in
@@ -141,16 +141,14 @@ EXTEND
str_item:
[ [ "TACTIC"; "EXTEND"; s = tac_name;
level = OPT [ "AT"; UIDENT "LEVEL"; level = INT -> level ];
- c = OPT [ "CLASSIFIED"; "BY"; c = LIDENT -> <:expr< $lid:c$ >> ];
OPT "|"; l = LIST1 tacrule SEP "|";
"END" ->
let level = match level with Some i -> int_of_string i | None -> 0 in
- declare_tactic loc s ~level c l ] ]
+ declare_tactic loc s ~level l ] ]
;
tacrule:
[ [ "["; l = LIST1 tacargs; "]";
- c = OPT [ "=>"; "["; c = Pcaml.expr; "]" -> c ];
- "->"; "["; e = Pcaml.expr; "]" -> (l,c,e)
+ "->"; "["; e = Pcaml.expr; "]" -> (l,e)
] ]
;
tacargs:
diff --git a/grammar/vernacextend.mlp b/grammar/vernacextend.mlp
index 874712124..a561ea370 100644
--- a/grammar/vernacextend.mlp
+++ b/grammar/vernacextend.mlp
@@ -82,7 +82,7 @@ let make_clause_classifier cg s { r_patt = pt; r_class = c; } =
"classifiers. Only one classifier is called.") ^ "\n");
(make_patt pt,
ploc_vala None,
- <:expr< fun loc -> (Vernacexpr.VtUnknown, Vernacexpr.VtNow) >>)
+ <:expr< fun () -> ( CErrors.anomaly (Pp.str "No classification given for command " ^ s ) ) >>)
let make_fun_clauses loc s l =
let map c =
@@ -136,6 +136,10 @@ EXTEND
OPT "|"; l = LIST1 rule SEP "|";
"END" ->
declare_command loc s c <:expr<None>> l
+ | "VERNAC"; "COMMAND"; "FUNCTIONAL"; "EXTEND"; s = UIDENT; c = OPT classification;
+ OPT "|"; l = LIST1 fun_rule SEP "|";
+ "END" ->
+ declare_command loc s c <:expr<None>> l
| "VERNAC"; nt = LIDENT ; "EXTEND"; s = UIDENT; c = OPT classification;
OPT "|"; l = LIST1 rule SEP "|";
"END" ->
@@ -158,18 +162,31 @@ EXTEND
deprecation:
[ [ "DEPRECATED" -> () ] ]
;
- (* spiwack: comment-by-guessing: it seems that the isolated string (which
- otherwise could have been another argument) is not passed to the
- VernacExtend interpreter function to discriminate between the clauses. *)
+ (* spiwack: comment-by-guessing: it seems that the isolated string
+ (which otherwise could have been another argument) is not passed
+ to the VernacExtend interpreter function to discriminate between
+ the clauses. *)
rule:
[ [ "["; s = STRING; l = LIST0 args; "]";
d = OPT deprecation; c = OPT classifier; "->"; "["; e = Pcaml.expr; "]" ->
let () = if s = "" then failwith "Command name is empty." in
- let b = <:expr< fun loc -> $e$ >> in
+ let b = <:expr< fun ~{atts} ~{st} -> ( let () = $e$ in st ) >> in
+ { r_head = Some s; r_patt = l; r_class = c; r_branch = b; r_depr = d; }
+ | "[" ; "-" ; l = LIST1 args ; "]" ;
+ d = OPT deprecation; c = OPT classifier; "->"; "["; e = Pcaml.expr; "]" ->
+ let b = <:expr< fun ~{atts} ~{st} -> ( let () = $e$ in st ) >> in
+ { r_head = None; r_patt = l; r_class = c; r_branch = b; r_depr = d; }
+ ] ]
+ ;
+ fun_rule:
+ [ [ "["; s = STRING; l = LIST0 args; "]";
+ d = OPT deprecation; c = OPT classifier; "->"; "["; e = Pcaml.expr; "]" ->
+ let () = if s = "" then failwith "Command name is empty." in
+ let b = <:expr< $e$ >> in
{ r_head = Some s; r_patt = l; r_class = c; r_branch = b; r_depr = d; }
| "[" ; "-" ; l = LIST1 args ; "]" ;
d = OPT deprecation; c = OPT classifier; "->"; "["; e = Pcaml.expr; "]" ->
- let b = <:expr< fun loc -> $e$ >> in
+ let b = <:expr< $e$ >> in
{ r_head = None; r_patt = l; r_class = c; r_branch = b; r_depr = d; }
] ]
;
diff --git a/ide/config_lexer.mli b/ide/config_lexer.mli
new file mode 100644
index 000000000..0c0c5d1e7
--- /dev/null
+++ b/ide/config_lexer.mli
@@ -0,0 +1,10 @@
+(************************************************************************)
+(* v * The Coq Proof Assistant / The Coq Development Team *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(************************************************************************)
+
+val print_file : string -> string list Util.String.Map.t -> unit
+val load_file : string -> string list Util.String.Map.t
diff --git a/ide/coq-ssreflect.lang b/ide/coq-ssreflect.lang
index 7cfc16701..bd9cb4bfa 100644
--- a/ide/coq-ssreflect.lang
+++ b/ide/coq-ssreflect.lang
@@ -228,7 +228,7 @@
<keyword>Implicit\%{space}+Arguments</keyword>
<keyword>(Import)|(Include)</keyword>
<keyword>Require(\%{space}+((Import)|(Export)))?</keyword>
- <keyword>(Recursive\%{space}+)?Extraction(\%{space}+(Language\%{space}+(Ocaml)|(Haskell)|(Scheme)|(Toplevel))|(Library)|((No)?Inline)|(Blacklist))?</keyword>
+ <keyword>(Recursive\%{space}+)?Extraction(\%{space}+(Language\%{space}+(OCaml)|(Haskell)|(Scheme)|(Toplevel))|(Library)|((No)?Inline)|(Blacklist))?</keyword>
<keyword>Extract\%{space}+(Inlined\%{space}+)?(Constant)|(Inductive)</keyword>
<include>
<context sub-pattern="1" style-ref="vernac-keyword"/>
diff --git a/ide/coq.lang b/ide/coq.lang
index 484264ece..e9eab48de 100644
--- a/ide/coq.lang
+++ b/ide/coq.lang
@@ -188,7 +188,7 @@
<keyword>(\%{locality}|(Reserved|Tactic)\%{space})?Notation</keyword>
<keyword>\%{locality}Infix</keyword>
<keyword>Declare\%{space}ML\%{space}Module</keyword>
- <keyword>Extraction\%{space}Language\%{space}(Ocaml|Haskell|Scheme|JSON)</keyword>
+ <keyword>Extraction\%{space}Language\%{space}(OCaml|Haskell|Scheme|JSON)</keyword>
</context>
<context id="hint-command" style-ref="vernac-keyword">
diff --git a/ide/coq_commands.mli b/ide/coq_commands.mli
new file mode 100644
index 000000000..53026be38
--- /dev/null
+++ b/ide/coq_commands.mli
@@ -0,0 +1,11 @@
+(************************************************************************)
+(* v * The Coq Proof Assistant / The Coq Development Team *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(************************************************************************)
+
+val tactics : string list list
+val commands : string list list
+val state_preserving : string list
diff --git a/ide/coq_lex.mli b/ide/coq_lex.mli
new file mode 100644
index 000000000..417e0a76f
--- /dev/null
+++ b/ide/coq_lex.mli
@@ -0,0 +1,11 @@
+(************************************************************************)
+(* v * The Coq Proof Assistant / The Coq Development Team *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(************************************************************************)
+
+val delimit_sentences : (int -> GText.tag -> unit) -> string -> unit
+
+exception Unterminated
diff --git a/ide/coq_lex.mll b/ide/coq_lex.mll
index 8bfd937e3..fcc242e07 100644
--- a/ide/coq_lex.mll
+++ b/ide/coq_lex.mll
@@ -17,7 +17,13 @@
let space = [' ' '\n' '\r' '\t' '\012'] (* '\012' is form-feed *)
-let undotted_sep = '{' | '}' | '-'+ | '+'+ | '*'+
+let number = [ '0'-'9' ]+
+
+let string = "\"" _+ "\""
+
+let undotted_sep = (number space* ':' space*)? '{' | '}' | '-'+ | '+'+ | '*'+
+
+let vernac_control = "Fail" | "Time" | "Redirect" space+ string | "Timeout" space+ number
let dot_sep = '.' (space | eof)
@@ -65,7 +71,7 @@ and sentence initial stamp = parse
stamp (utf8_lexeme_start lexbuf) Tags.Script.sentence;
sentence true stamp lexbuf
}
- | undotted_sep {
+ | (vernac_control space+)* undotted_sep {
(* Separators like { or } and bullets * - + are only active
at the start of a sentence *)
if initial then stamp (utf8_lexeme_start lexbuf + String.length (Lexing.lexeme lexbuf) - 1) Tags.Script.sentence;
diff --git a/ide/coqide.ml b/ide/coqide.ml
index 842d06859..3cc46b6aa 100644
--- a/ide/coqide.ml
+++ b/ide/coqide.ml
@@ -1221,9 +1221,14 @@ let build_ui () =
(* Emacs/PG mode *)
NanoPG.init w notebook all_menus;
- (* Reset on tab switch *)
- let _ = notebook#connect#switch_page ~callback:(fun _ ->
- if reset_on_tab_switch#get then Nav.restart ())
+ (* On tab switch, reset, update location *)
+ let _ = notebook#connect#switch_page ~callback:(fun n ->
+ let _ = if reset_on_tab_switch#get then Nav.restart () in
+ try
+ let session = notebook#get_nth_term n in
+ let ins = session.buffer#get_iter_at_mark `INSERT in
+ Ideutils.display_location ins
+ with _ -> ())
in
(* Vertical Separator between Scripts and Goals *)
diff --git a/ide/coqide_main.ml4 b/ide/coqide_main.ml4
index 8d99cc3e6..6e330c62b 100644
--- a/ide/coqide_main.ml4
+++ b/ide/coqide_main.ml4
@@ -55,6 +55,8 @@ let os_specific_init () = ()
(** Win32 *)
+IFDEF WIN32 THEN
+
(* On win32, we add the directory of coqide to the PATH at launch-time
(this used to be done in a .bat script). *)
@@ -86,7 +88,6 @@ let reroute_stdout_stderr () =
(* We also provide specific kill and interrupt functions. *)
-IFDEF WIN32 THEN
external win32_kill : int -> unit = "win32_kill"
external win32_interrupt : int -> unit = "win32_interrupt"
let () =
diff --git a/ide/coqide_main.mli b/ide/coqide_main.mli
new file mode 100644
index 000000000..e1555ba2e
--- /dev/null
+++ b/ide/coqide_main.mli
@@ -0,0 +1,10 @@
+(************************************************************************)
+(* v * The Coq Proof Assistant / The Coq Development Team *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(************************************************************************)
+
+(* This empty file avoids a race condition that occurs when compiling a .ml file
+ that does not have a corresponding .mli file *)
diff --git a/ide/coqide_ui.mli b/ide/coqide_ui.mli
new file mode 100644
index 000000000..9f6fa5635
--- /dev/null
+++ b/ide/coqide_ui.mli
@@ -0,0 +1,10 @@
+(************************************************************************)
+(* v * The Coq Proof Assistant / The Coq Development Team *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(************************************************************************)
+
+val init : unit -> unit
+val ui_m : GAction.ui_manager
diff --git a/ide/gtk_parsing.ml b/ide/gtk_parsing.ml
index f0575e325..7c0a7495a 100644
--- a/ide/gtk_parsing.ml
+++ b/ide/gtk_parsing.ml
@@ -7,11 +7,7 @@
(************************************************************************)
let underscore = Glib.Utf8.to_unichar "_" ~pos:(ref 0)
-let arobase = Glib.Utf8.to_unichar "@" ~pos:(ref 0)
let prime = Glib.Utf8.to_unichar "'" ~pos:(ref 0)
-let bn = Glib.Utf8.to_unichar "\n" ~pos:(ref 0)
-let space = Glib.Utf8.to_unichar " " ~pos:(ref 0)
-let tab = Glib.Utf8.to_unichar "\t" ~pos:(ref 0)
(* TODO: avoid num and prime at the head of a word *)
@@ -30,17 +26,6 @@ let ends_word (it:GText.iter) =
not (is_word_char c)
)
-
-let inside_word (it:GText.iter) =
- let c = it#char in
- not (starts_word it) &&
- not (ends_word it) &&
- is_word_char c
-
-
-let is_on_word_limit (it:GText.iter) = inside_word it || ends_word it
-
-
let find_word_start (it:GText.iter) =
let rec step_to_start it =
Minilib.log "Find word start";
@@ -72,100 +57,6 @@ let get_word_around (it:GText.iter) =
let stop = find_word_end it in
start,stop
-
-let rec complete_backward w (it:GText.iter) =
- Minilib.log "Complete backward...";
- match it#backward_search w with
- | None -> (Minilib.log "backward_search failed";None)
- | Some (start,stop) ->
- Minilib.log ("complete_backward got a match:"^(string_of_int start#offset)^(string_of_int stop#offset));
- if starts_word start then
- let ne = find_word_end stop in
- if ne#compare stop = 0
- then complete_backward w start
- else Some (start,stop,ne)
- else complete_backward w start
-
-
-let rec complete_forward w (it:GText.iter) =
- Minilib.log "Complete forward...";
- match it#forward_search w with
- | None -> None
- | Some (start,stop) ->
- if starts_word start then
- let ne = find_word_end stop in
- if ne#compare stop = 0 then
- complete_forward w stop
- else Some (stop,stop,ne)
- else complete_forward w stop
-
-
-let find_comment_end (start:GText.iter) =
- let rec find_nested_comment (search_start:GText.iter) (search_end:GText.iter) (comment_end:GText.iter) =
- match (search_start#forward_search ~limit:search_end "(*"),(comment_end#forward_search "*)") with
- | None,_ -> comment_end
- | Some _, None -> raise Not_found
- | Some (_,next_search_start),Some (next_search_end,next_comment_end) ->
- find_nested_comment next_search_start next_search_end next_comment_end
- in
- match start#forward_search "*)" with
- | None -> raise Not_found
- | Some (search_end,comment_end) -> find_nested_comment start search_end comment_end
-
-
-let rec find_string_end (start:GText.iter) =
- let dblquote = int_of_char '"' in
- let rec escaped_dblquote c =
- (c#char = dblquote) && not (escaped_dblquote c#backward_char)
- in
- match start#forward_search "\"" with
- | None -> raise Not_found
- | Some (stop,next_start) ->
- if escaped_dblquote stop#backward_char
- then find_string_end next_start
- else next_start
-
-
-let rec find_next_sentence (from:GText.iter) =
- match (from#forward_search ".") with
- | None -> raise Not_found
- | Some (non_vernac_search_end,next_sentence) ->
- match from#forward_search ~limit:non_vernac_search_end "(*",from#forward_search ~limit:non_vernac_search_end "\"" with
- | None,None ->
- if Glib.Unichar.isspace next_sentence#char || next_sentence#compare next_sentence#forward_char == 0
- then next_sentence else find_next_sentence next_sentence
- | None,Some (_,string_search_start) -> find_next_sentence (find_string_end string_search_start)
- | Some (_,comment_search_start),None -> find_next_sentence (find_comment_end comment_search_start)
- | Some (_,comment_search_start),Some (_,string_search_start) ->
- find_next_sentence (
- if comment_search_start#compare string_search_start < 0
- then find_comment_end comment_search_start
- else find_string_end string_search_start)
-
-
-let find_nearest_forward (cursor:GText.iter) targets =
- let fold_targets acc target =
- match cursor#forward_search target,acc with
- | Some (t_start,_),Some nearest when (t_start#compare nearest < 0) -> Some t_start
- | Some (t_start,_),None -> Some t_start
- | _ -> acc
- in
- match List.fold_left fold_targets None targets with
- | None -> raise Not_found
- | Some nearest -> nearest
-
-
-let find_nearest_backward (cursor:GText.iter) targets =
- let fold_targets acc target =
- match cursor#backward_search target,acc with
- | Some (t_start,_),Some nearest when (t_start#compare nearest > 0) -> Some t_start
- | Some (t_start,_),None -> Some t_start
- | _ -> acc
- in
- match List.fold_left fold_targets None targets with
- | None -> raise Not_found
- | Some nearest -> nearest
-
(** On double-click on a view, select the whole word. This is a workaround for
a deficient word handling in TextView. *)
let fix_double_click self =
diff --git a/ide/gtk_parsing.mli b/ide/gtk_parsing.mli
new file mode 100644
index 000000000..b54f731b3
--- /dev/null
+++ b/ide/gtk_parsing.mli
@@ -0,0 +1,26 @@
+(************************************************************************)
+(* v * The Coq Proof Assistant / The Coq Development Team *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(************************************************************************)
+
+val fix_double_click :
+ < buffer : < get_iter : [> `INSERT ] -> GText.iter;
+ move_mark : [> `INSERT | `SEL_BOUND ] ->
+ where:GText.iter -> unit;
+ .. >;
+ event : < connect :
+ < button_press :
+ callback:([> `TWO_BUTTON_PRESS ] Gdk.event ->
+ bool) ->
+ 'a;
+ .. >;
+ .. >;
+ .. > ->
+ unit
+val starts_word : GText.iter -> bool
+val ends_word : GText.iter -> bool
+val find_word_start : GText.iter -> GText.iter
+val find_word_end : GText.iter -> GText.iter
diff --git a/ide/ide_slave.ml b/ide/ide_slave.ml
index 7cbab56d4..5f40a2242 100644
--- a/ide/ide_slave.ml
+++ b/ide/ide_slave.ml
@@ -13,7 +13,6 @@ open Util
open Pp
open Printer
-module RelDecl = Context.Rel.Declaration
module NamedDecl = Context.Named.Declaration
module CompactedDecl = Context.Compacted.Declaration
@@ -55,7 +54,7 @@ let coqide_known_option table = List.mem table [
["Printing";"Universes"];
["Printing";"Unfocused"]]
-let is_known_option cmd = match cmd with
+let is_known_option cmd = match Vernacprop.under_control cmd with
| VernacSetOption (o,BoolValue true)
| VernacUnsetOption o -> coqide_known_option o
| _ -> false
@@ -70,9 +69,7 @@ let ide_cmd_checks ~id (loc,ast) =
if is_known_option ast then
warn "Set this option from the IDE menu instead";
if is_navigation_vernac ast || is_undo ast then
- warn "Use IDE navigation instead";
- if is_query ast then
- warn "Query commands should not be inserted in scripts"
+ warn "Use IDE navigation instead"
(** Interpretation (cf. [Ide_intf.interp]) *)
@@ -217,7 +214,7 @@ let evars () =
let doc = get_doc () in
set_doc @@ Stm.finish ~doc;
let pfts = Proof_global.give_me_the_proof () in
- let { Evd.it = all_goals ; sigma = sigma } = Proof.V82.subgoals pfts in
+ let all_goals, _, _, _, sigma = Proof.proof pfts in
let exl = Evar.Map.bindings (Evd.undefined_map sigma) in
let map_evar ev = { Interface.evar_info = string_of_ppcmds (pr_evar sigma ev); } in
let el = List.map map_evar exl in
@@ -227,7 +224,7 @@ let evars () =
let hints () =
try
let pfts = Proof_global.give_me_the_proof () in
- let { Evd.it = all_goals ; sigma = sigma } = Proof.V82.subgoals pfts in
+ let all_goals, _, _, _, sigma = Proof.proof pfts in
match all_goals with
| [] -> None
| g :: _ ->
@@ -377,15 +374,8 @@ let init =
match file with
| None -> init_sid
| Some file ->
- let dir = Filename.dirname file in
- let open Loadpath in let open CUnix in
let doc, initial_id, _ =
- let doc = get_doc () in
- if not (is_in_load_paths (physical_path_of_string dir)) then begin
- let pa = Pcoq.Gram.parsable (Stream.of_string (Printf.sprintf "Add LoadPath \"%s\". " dir)) in
- let loc_ast = Stm.parse_sentence ~doc init_sid pa in
- Stm.add false ~doc ~ontop:init_sid loc_ast
- end else doc, init_sid, `NewTip in
+ get_doc (), init_sid, `NewTip in
if Filename.check_suffix file ".v" then
Stm.set_compilation_hints file;
set_doc (Stm.finish ~doc);
@@ -517,7 +507,7 @@ let rec parse = function
let () = Coqtop.toploop_init := (fun args ->
let args = parse args in
Flags.quiet := true;
- CoqworkmgrApi.(init Flags.High);
+ CoqworkmgrApi.(init High);
args)
let () = Coqtop.toploop_run := loop
diff --git a/ide/ide_slave.mli b/ide/ide_slave.mli
new file mode 100644
index 000000000..e1555ba2e
--- /dev/null
+++ b/ide/ide_slave.mli
@@ -0,0 +1,10 @@
+(************************************************************************)
+(* v * The Coq Proof Assistant / The Coq Development Team *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(************************************************************************)
+
+(* This empty file avoids a race condition that occurs when compiling a .ml file
+ that does not have a corresponding .mli file *)
diff --git a/ide/ideutils.ml b/ide/ideutils.ml
index 83e5da950..9c5b06a0d 100644
--- a/ide/ideutils.ml
+++ b/ide/ideutils.ml
@@ -69,6 +69,12 @@ let insert_xml ?(mark = `INSERT) ?(tags = []) (buf : #GText.buffer_skel) msg =
let set_location = ref (function s -> failwith "not ready")
+let display_location ins =
+ let line = ins#line + 1 in
+ let off = ins#line_offset + 1 in
+ let msg = Printf.sprintf "Line: %5d Char: %3d" line off in
+ !set_location msg
+
(** A utf8 char is either a single byte (ascii char, 0xxxxxxx)
or multi-byte (with a leading byte 11xxxxxx and extra bytes 10xxxxxx) *)
@@ -372,8 +378,7 @@ let read_file name buf =
let io_read_all chan =
Buffer.clear read_buffer;
let read_once () =
- (* XXX: Glib.Io must be converted to bytes / -safe-string upstream *)
- let len = Glib.Io.read_chars ~buf:(Bytes.unsafe_to_string read_string) ~pos:0 ~len:maxread chan in
+ let len = Glib.Io.read_chars ~buf:read_string ~pos:0 ~len:maxread chan in
Buffer.add_subbytes read_buffer read_string 0 len
in
begin
@@ -466,4 +471,3 @@ let browse_keyword prerr text =
let u = Lazy.force url_for_keyword text in
browse prerr (doc_url() ^ u)
with Not_found -> prerr ("No documentation found for \""^text^"\".\n")
-
diff --git a/ide/ideutils.mli b/ide/ideutils.mli
index f06a48aeb..99ff763e2 100644
--- a/ide/ideutils.mli
+++ b/ide/ideutils.mli
@@ -56,6 +56,7 @@ val insert_xml : ?mark:GText.mark -> ?tags:GText.tag list ->
#GText.buffer_skel -> Richpp.richpp -> unit
val set_location : (string -> unit) ref
+val display_location : GText.iter -> unit
(* In win32, when a command-line is to be executed via cmd.exe
(i.e. Sys.command, Unix.open_process, ...), it cannot contain several
@@ -95,4 +96,3 @@ val io_read_all : Glib.Io.channel -> string
val run_command :
(string -> unit) -> (Unix.process_status -> unit) -> string -> unit
-
diff --git a/ide/macos_prehook.mli b/ide/macos_prehook.mli
new file mode 100644
index 000000000..e1555ba2e
--- /dev/null
+++ b/ide/macos_prehook.mli
@@ -0,0 +1,10 @@
+(************************************************************************)
+(* v * The Coq Proof Assistant / The Coq Development Team *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(************************************************************************)
+
+(* This empty file avoids a race condition that occurs when compiling a .ml file
+ that does not have a corresponding .mli file *)
diff --git a/ide/nanoPG.mli b/ide/nanoPG.mli
new file mode 100644
index 000000000..3ad8435b5
--- /dev/null
+++ b/ide/nanoPG.mli
@@ -0,0 +1,11 @@
+(************************************************************************)
+(* v * The Coq Proof Assistant / The Coq Development Team *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(************************************************************************)
+
+val get_documentation : unit -> string
+val init : GWindow.window -> Session.session Wg_Notebook.typed_notebook ->
+ GAction.action_group list -> unit
diff --git a/ide/session.ml b/ide/session.ml
index 0a09cc9f5..8dada8ff2 100644
--- a/ide/session.ml
+++ b/ide/session.ml
@@ -209,10 +209,7 @@ let set_buffer_handlers
let mark_set_cb it m =
debug_edit_zone ();
let ins = get_insert () in
- let line = ins#line + 1 in
- let off = ins#line_offset + 1 in
- let msg = Printf.sprintf "Line: %5d Char: %3d" line off in
- let () = !Ideutils.set_location msg in
+ let () = Ideutils.display_location ins in
match GtkText.Mark.get_name m with
| Some "insert" -> ()
| Some s -> Minilib.log (s^" moved")
diff --git a/ide/utf8_convert.mli b/ide/utf8_convert.mli
new file mode 100644
index 000000000..06a131a68
--- /dev/null
+++ b/ide/utf8_convert.mli
@@ -0,0 +1,9 @@
+(************************************************************************)
+(* v * The Coq Proof Assistant / The Coq Development Team *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(************************************************************************)
+
+val f : string -> string
diff --git a/ide/wg_Find.ml b/ide/wg_Find.ml
index a62ff2de5..cb182465a 100644
--- a/ide/wg_Find.ml
+++ b/ide/wg_Find.ml
@@ -84,8 +84,10 @@ class finder name (view : GText.view) =
method private backward_search starti =
let text = view#buffer#start_iter#get_text ~stop:starti in
let regexp = self#regex in
- try
- let i = Str.search_backward regexp text (String.length text - 1) in
+ let offs = (String.length text - 1) in
+ if offs < 0 then None
+ else try
+ let i = Str.search_backward regexp text offs in
let j = Str.match_end () in
Some(view#buffer#start_iter#forward_chars (b2c text i),
view#buffer#start_iter#forward_chars (b2c text j))
@@ -101,24 +103,33 @@ class finder name (view : GText.view) =
with Not_found -> None
method replace_all () =
- let rec replace_at (iter : GText.iter) =
+ let rec replace_at (iter : GText.iter) ct tot =
let found = self#forward_search iter in
match found with
- | None -> ()
+ | None ->
+ let tot_str = if Int.equal ct tot then "" else " of " ^ string_of_int tot in
+ let occ_str = CString.plural tot "occurrence" in
+ let _ = Ideutils.flash_info ("Replaced " ^ string_of_int ct ^ tot_str ^ " " ^ occ_str) in
+ ()
| Some (start, stop) ->
let text = iter#get_text ~stop:view#buffer#end_iter in
let start_mark = view#buffer#create_mark start in
let stop_mark = view#buffer#create_mark ~left_gravity:false stop in
+ let mod_save = view#buffer#modified in
+ let _ = view#buffer#set_modified false in
let _ = view#buffer#delete_interactive ~start ~stop () in
let iter = view#buffer#get_iter_at_mark (`MARK start_mark) in
- let _ = view#buffer#insert_interactive ~iter (self#replacement text)in
+ let _ = view#buffer#insert_interactive ~iter (self#replacement text) in
+ let edited = view#buffer#modified in
+ let _ = view#buffer#set_modified (edited || mod_save) in
let next = view#buffer#get_iter_at_mark (`MARK stop_mark) in
let () = view#buffer#delete_mark (`MARK start_mark) in
let () = view#buffer#delete_mark (`MARK stop_mark) in
- replace_at next
+ let next_ct = if edited then ct + 1 else ct in
+ replace_at next next_ct (tot + 1)
in
let () = view#buffer#begin_user_action () in
- let () = replace_at view#buffer#start_iter in
+ let () = replace_at view#buffer#start_iter 0 0 in
view#buffer#end_user_action ()
method private set_not_found () =
@@ -130,22 +141,52 @@ class finder name (view : GText.view) =
method private set_normal () =
find_entry#misc#modify_base [`NORMAL, `NAME "white"]
- method private find_from backward (starti : GText.iter) =
+ method private find_from backward ?(wrapped=false) (starti : GText.iter) =
let found =
if backward then self#backward_search starti
else self#forward_search starti in
match found with
| None ->
if not backward && not (starti#equal view#buffer#start_iter) then
- self#find_from backward view#buffer#start_iter
+ self#find_from backward ~wrapped:true view#buffer#start_iter
else if backward && not (starti#equal view#buffer#end_iter) then
- self#find_from backward view#buffer#end_iter
+ self#find_from backward ~wrapped:true view#buffer#end_iter
else
+ let _ = Ideutils.flash_info "String not found" in
self#set_not_found ()
| Some (start, stop) ->
+ let text = view#buffer#start_iter#get_text ~stop:view#buffer#end_iter in
+ let rec find_all offs accum =
+ if offs > String.length text then
+ List.rev accum
+ else try
+ let i = Str.search_forward self#regex text offs in
+ let j = Str.match_end () in
+ find_all (j + 1) (i :: accum)
+ with Not_found -> List.rev accum
+ in
+ let occurs = find_all 0 [] in
+ let num_occurs = List.length occurs in
+ (* assoc table of offset, occurrence index pairs *)
+ let occur_tbl = List.mapi (fun ndx occ -> (occ,ndx+1)) occurs in
let _ = view#buffer#select_range start stop in
let scroll = `MARK (view#buffer#create_mark stop) in
let _ = view#scroll_to_mark ~use_align:false scroll in
+ let _ =
+ try
+ let occ_ndx = List.assoc start#offset occur_tbl in
+ let occ_str = CString.plural num_occurs "occurrence" in
+ let wrap_str = if wrapped then
+ if backward then " (wrapped backwards)"
+ else " (wrapped)"
+ else ""
+ in
+ Ideutils.flash_info
+ (string_of_int occ_ndx ^ " of " ^ string_of_int num_occurs ^
+ " " ^ occ_str ^ wrap_str)
+ with Not_found ->
+ CErrors.anomaly (Pp.str "Occurrence of Find string not in table")
+ in
self#set_found ()
method find_forward () =
diff --git a/install.sh b/install.sh
index f8589a3c7..4f60080a1 100755
--- a/install.sh
+++ b/install.sh
@@ -4,13 +4,13 @@ dest="$1"
shift
for f; do
- bn=`basename $f`
- dn=`dirname $f`
+ bn=$(basename "$f")
+ dn=$(dirname "$f")
install -d "$dest/$dn"
case $bn in
- *.cmxs|*.py) install -m 755 $f "$dest/$dn/$bn"
+ *.cmxs|*.py) install -m 755 "$f" "$dest/$dn/$bn"
;;
- *) install -m 644 $f "$dest/$dn/$bn"
+ *) install -m 644 "$f" "$dest/$dn/$bn"
;;
esac
done
diff --git a/interp/constrexpr_ops.ml b/interp/constrexpr_ops.ml
index 771c13734..da04d8786 100644
--- a/interp/constrexpr_ops.ml
+++ b/interp/constrexpr_ops.ml
@@ -9,6 +9,7 @@
open Pp
open Util
open Names
+open Nameops
open Libnames
open Constrexpr
open Misctypes
@@ -72,22 +73,22 @@ let rec cases_pattern_expr_eq p1 p2 =
Option.equal (List.equal cases_pattern_expr_eq) a1 a2 &&
List.equal cases_pattern_expr_eq b1 b2
| CPatAtom(r1), CPatAtom(r2) ->
- Option.equal eq_reference r1 r2
+ Option.equal eq_reference r1 r2
| CPatOr a1, CPatOr a2 ->
- List.equal cases_pattern_expr_eq a1 a2
+ List.equal cases_pattern_expr_eq a1 a2
| CPatNotation (n1, s1, l1), CPatNotation (n2, s2, l2) ->
String.equal n1 n2 &&
cases_pattern_notation_substitution_eq s1 s2 &&
List.equal cases_pattern_expr_eq l1 l2
| CPatPrim i1, CPatPrim i2 ->
- prim_token_eq i1 i2
+ prim_token_eq i1 i2
| CPatRecord l1, CPatRecord l2 ->
- let equal (r1, e1) (r2, e2) =
- eq_reference r1 r2 && cases_pattern_expr_eq e1 e2
- in
- List.equal equal l1 l2
+ let equal (r1, e1) (r2, e2) =
+ eq_reference r1 r2 && cases_pattern_expr_eq e1 e2
+ in
+ List.equal equal l1 l2
| CPatDelimiters(s1,e1), CPatDelimiters(s2,e2) ->
- String.equal s1 s2 && cases_pattern_expr_eq e1 e2
+ String.equal s1 s2 && cases_pattern_expr_eq e1 e2
| _ -> false
and cases_pattern_notation_substitution_eq (s1, n1) (s2, n2) =
@@ -103,79 +104,81 @@ let eq_universes u1 u2 =
let rec constr_expr_eq e1 e2 =
if CAst.(e1.v == e2.v) then true
else match CAst.(e1.v, e2.v) with
- | CRef (r1,u1), CRef (r2,u2) -> eq_reference r1 r2 && eq_universes u1 u2
- | CFix(id1,fl1), CFix(id2,fl2) ->
+ | CRef (r1,u1), CRef (r2,u2) -> eq_reference r1 r2 && eq_universes u1 u2
+ | CFix(id1,fl1), CFix(id2,fl2) ->
eq_located Id.equal id1 id2 &&
List.equal fix_expr_eq fl1 fl2
- | CCoFix(id1,fl1), CCoFix(id2,fl2) ->
+ | CCoFix(id1,fl1), CCoFix(id2,fl2) ->
eq_located Id.equal id1 id2 &&
List.equal cofix_expr_eq fl1 fl2
- | CProdN(bl1,a1), CProdN(bl2,a2) ->
+ | CProdN(bl1,a1), CProdN(bl2,a2) ->
List.equal binder_expr_eq bl1 bl2 &&
constr_expr_eq a1 a2
- | CLambdaN(bl1,a1), CLambdaN(bl2,a2) ->
+ | CLambdaN(bl1,a1), CLambdaN(bl2,a2) ->
List.equal binder_expr_eq bl1 bl2 &&
constr_expr_eq a1 a2
- | CLetIn((_,na1),a1,t1,b1), CLetIn((_,na2),a2,t2,b2) ->
+ | CLetIn((_,na1),a1,t1,b1), CLetIn((_,na2),a2,t2,b2) ->
Name.equal na1 na2 &&
constr_expr_eq a1 a2 &&
Option.equal constr_expr_eq t1 t2 &&
constr_expr_eq b1 b2
- | CAppExpl((proj1,r1,_),al1), CAppExpl((proj2,r2,_),al2) ->
+ | CAppExpl((proj1,r1,_),al1), CAppExpl((proj2,r2,_),al2) ->
Option.equal Int.equal proj1 proj2 &&
eq_reference r1 r2 &&
List.equal constr_expr_eq al1 al2
- | CApp((proj1,e1),al1), CApp((proj2,e2),al2) ->
+ | CApp((proj1,e1),al1), CApp((proj2,e2),al2) ->
Option.equal Int.equal proj1 proj2 &&
constr_expr_eq e1 e2 &&
List.equal args_eq al1 al2
- | CRecord l1, CRecord l2 ->
- let field_eq (r1, e1) (r2, e2) =
- eq_reference r1 r2 && constr_expr_eq e1 e2
- in
- List.equal field_eq l1 l2
- | CCases(_,r1,a1,brl1), CCases(_,r2,a2,brl2) ->
+ | CRecord l1, CRecord l2 ->
+ let field_eq (r1, e1) (r2, e2) =
+ eq_reference r1 r2 && constr_expr_eq e1 e2
+ in
+ List.equal field_eq l1 l2
+ | CCases(_,r1,a1,brl1), CCases(_,r2,a2,brl2) ->
(** Don't care about the case_style *)
Option.equal constr_expr_eq r1 r2 &&
List.equal case_expr_eq a1 a2 &&
List.equal branch_expr_eq brl1 brl2
- | CLetTuple (n1, (m1, e1), t1, b1), CLetTuple (n2, (m2, e2), t2, b2) ->
- List.equal (eq_located Name.equal) n1 n2 &&
- Option.equal (eq_located Name.equal) m1 m2 &&
- Option.equal constr_expr_eq e1 e2 &&
- constr_expr_eq t1 t2 &&
- constr_expr_eq b1 b2
- | CIf (e1, (n1, r1), t1, f1), CIf (e2, (n2, r2), t2, f2) ->
- constr_expr_eq e1 e2 &&
- Option.equal (eq_located Name.equal) n1 n2 &&
- Option.equal constr_expr_eq r1 r2 &&
- constr_expr_eq t1 t2 &&
- constr_expr_eq f1 f2
- | CHole _, CHole _ -> true
- | CPatVar i1, CPatVar i2 ->
- Id.equal i1 i2
- | CEvar (id1, c1), CEvar (id2, c2) ->
- Id.equal id1 id2 && List.equal instance_eq c1 c2
- | CSort s1, CSort s2 ->
- Miscops.glob_sort_eq s1 s2
- | CCast(a1,(CastConv b1|CastVM b1)), CCast(a2,(CastConv b2|CastVM b2)) ->
- constr_expr_eq a1 a2 &&
+ | CLetTuple (n1, (m1, e1), t1, b1), CLetTuple (n2, (m2, e2), t2, b2) ->
+ List.equal (eq_located Name.equal) n1 n2 &&
+ Option.equal (eq_located Name.equal) m1 m2 &&
+ Option.equal constr_expr_eq e1 e2 &&
+ constr_expr_eq t1 t2 &&
constr_expr_eq b1 b2
- | CCast(a1,CastCoerce), CCast(a2, CastCoerce) ->
- constr_expr_eq a1 a2
- | CNotation(n1, s1), CNotation(n2, s2) ->
+ | CIf (e1, (n1, r1), t1, f1), CIf (e2, (n2, r2), t2, f2) ->
+ constr_expr_eq e1 e2 &&
+ Option.equal (eq_located Name.equal) n1 n2 &&
+ Option.equal constr_expr_eq r1 r2 &&
+ constr_expr_eq t1 t2 &&
+ constr_expr_eq f1 f2
+ | CHole _, CHole _ -> true
+ | CPatVar i1, CPatVar i2 ->
+ Id.equal i1 i2
+ | CEvar (id1, c1), CEvar (id2, c2) ->
+ Id.equal id1 id2 && List.equal instance_eq c1 c2
+ | CSort s1, CSort s2 ->
+ Miscops.glob_sort_eq s1 s2
+ | CCast(t1,c1), CCast(t2,c2) ->
+ constr_expr_eq t1 t2 && cast_expr_eq c1 c2
+ | CNotation(n1, s1), CNotation(n2, s2) ->
String.equal n1 n2 &&
constr_notation_substitution_eq s1 s2
- | CPrim i1, CPrim i2 ->
- prim_token_eq i1 i2
- | CGeneralization (bk1, ak1, e1), CGeneralization (bk2, ak2, e2) ->
- binding_kind_eq bk1 bk2 &&
- Option.equal abstraction_kind_eq ak1 ak2 &&
- constr_expr_eq e1 e2
- | CDelimiters(s1,e1), CDelimiters(s2,e2) ->
- String.equal s1 s2 &&
- constr_expr_eq e1 e2
- | _ -> false
+ | CPrim i1, CPrim i2 ->
+ prim_token_eq i1 i2
+ | CGeneralization (bk1, ak1, e1), CGeneralization (bk2, ak2, e2) ->
+ binding_kind_eq bk1 bk2 &&
+ Option.equal abstraction_kind_eq ak1 ak2 &&
+ constr_expr_eq e1 e2
+ | CDelimiters(s1,e1), CDelimiters(s2,e2) ->
+ String.equal s1 s2 &&
+ constr_expr_eq e1 e2
+ | CProj(p1,c1), CProj(p2,c2) ->
+ eq_reference p1 p2 && constr_expr_eq c1 c2
+ | (CRef _ | CFix _ | CCoFix _ | CProdN _ | CLambdaN _ | CLetIn _ | CAppExpl _
+ | CApp _ | CRecord _ | CCases _ | CLetTuple _ | CIf _ | CHole _
+ | CPatVar _ | CEvar _ | CSort _ | CCast _ | CNotation _ | CPrim _
+ | CGeneralization _ | CDelimiters _ | CProj _), _ -> false
and args_eq (a1,e1) (a2,e2) =
Option.equal (eq_located explicitation_eq) e1 e2 &&
@@ -187,7 +190,7 @@ and case_expr_eq (e1, n1, p1) (e2, n2, p2) =
Option.equal cases_pattern_expr_eq p1 p2
and branch_expr_eq (_, (p1, e1)) (_, (p2, e2)) =
- List.equal (eq_located (List.equal cases_pattern_expr_eq)) p1 p2 &&
+ List.equal (List.equal cases_pattern_expr_eq) p1 p2 &&
constr_expr_eq e1 e2
and binder_expr_eq ((n1, _, e1) : binder_expr) (n2, _, e2) =
@@ -209,19 +212,19 @@ and cofix_expr_eq (id1,bl1,a1,b1) (id2,bl2,a2,b2) =
constr_expr_eq b1 b2
and recursion_order_expr_eq r1 r2 = match r1, r2 with
-| CStructRec, CStructRec -> true
-| CWfRec e1, CWfRec e2 -> constr_expr_eq e1 e2
-| CMeasureRec (e1, o1), CMeasureRec (e2, o2) ->
- constr_expr_eq e1 e2 && Option.equal constr_expr_eq o1 o2
-| _ -> false
+ | CStructRec, CStructRec -> true
+ | CWfRec e1, CWfRec e2 -> constr_expr_eq e1 e2
+ | CMeasureRec (e1, o1), CMeasureRec (e2, o2) ->
+ constr_expr_eq e1 e2 && Option.equal constr_expr_eq o1 o2
+ | _ -> false
and local_binder_eq l1 l2 = match l1, l2 with
-| CLocalDef (n1, e1, t1), CLocalDef (n2, e2, t2) ->
- eq_located Name.equal n1 n2 && constr_expr_eq e1 e2 && Option.equal constr_expr_eq t1 t2
-| CLocalAssum (n1, _, e1), CLocalAssum (n2, _, e2) ->
- (** Don't care about the [binder_kind] *)
- List.equal (eq_located Name.equal) n1 n2 && constr_expr_eq e1 e2
-| _ -> false
+ | CLocalDef (n1, e1, t1), CLocalDef (n2, e2, t2) ->
+ eq_located Name.equal n1 n2 && constr_expr_eq e1 e2 && Option.equal constr_expr_eq t1 t2
+ | CLocalAssum (n1, _, e1), CLocalAssum (n2, _, e2) ->
+ (** Don't care about the [binder_kind] *)
+ List.equal (eq_located Name.equal) n1 n2 && constr_expr_eq e1 e2
+ | _ -> false
and constr_notation_substitution_eq (e1, el1, bl1) (e2, el2, bl2) =
List.equal constr_expr_eq e1 e2 &&
@@ -231,6 +234,16 @@ and constr_notation_substitution_eq (e1, el1, bl1) (e2, el2, bl2) =
and instance_eq (x1,c1) (x2,c2) =
Id.equal x1 x2 && constr_expr_eq c1 c2
+and cast_expr_eq c1 c2 = match c1, c2 with
+| CastConv t1, CastConv t2
+| CastVM t1, CastVM t2
+| CastNative t1, CastNative t2 -> constr_expr_eq t1 t2
+| CastCoerce, CastCoerce -> true
+| CastConv _, _
+| CastVM _, _
+| CastNative _, _
+| CastCoerce, _ -> false
+
let constr_loc c = CAst.(c.loc)
let cases_pattern_expr_loc cp = CAst.(cp.loc)
@@ -245,6 +258,272 @@ let local_binders_loc bll = match bll with
| [] -> None
| h :: l -> Loc.merge_opt (local_binder_loc h) (local_binder_loc (List.last bll))
+(** Folds and maps *)
+
+(* Legacy functions *)
+let down_located f (_l, x) = f x
+
+let is_constructor id =
+ try Globnames.isConstructRef
+ (Smartlocate.global_of_extended_global
+ (Nametab.locate_extended (qualid_of_ident id)))
+ with Not_found -> false
+
+let rec cases_pattern_fold_names f a pt = match CAst.(pt.v) with
+ | CPatRecord l ->
+ List.fold_left (fun acc (r, cp) -> cases_pattern_fold_names f acc cp) a l
+ | CPatAlias (pat,id) -> f id a
+ | CPatOr (patl) ->
+ List.fold_left (cases_pattern_fold_names f) a patl
+ | CPatCstr (_,patl1,patl2) ->
+ List.fold_left (cases_pattern_fold_names f)
+ (Option.fold_left (List.fold_left (cases_pattern_fold_names f)) a patl1) patl2
+ | CPatNotation (_,(patl,patll),patl') ->
+ List.fold_left (cases_pattern_fold_names f)
+ (List.fold_left (cases_pattern_fold_names f) a (patl@List.flatten patll)) patl'
+ | CPatDelimiters (_,pat) -> cases_pattern_fold_names f a pat
+ | CPatAtom (Some (Ident (_,id))) when not (is_constructor id) -> f id a
+ | CPatPrim _ | CPatAtom _ -> a
+ | CPatCast ({CAst.loc},_) ->
+ CErrors.user_err ?loc ~hdr:"cases_pattern_fold_names"
+ (Pp.strbrk "Casts are not supported here.")
+
+let ids_of_pattern =
+ cases_pattern_fold_names Id.Set.add Id.Set.empty
+
+let ids_of_pattern_list =
+ List.fold_left
+ (List.fold_left (cases_pattern_fold_names Id.Set.add))
+ Id.Set.empty
+
+let ids_of_cases_indtype p =
+ cases_pattern_fold_names Id.Set.add Id.Set.empty p
+
+let ids_of_cases_tomatch tms =
+ List.fold_right
+ (fun (_, ona, indnal) l ->
+ Option.fold_right (fun t ids -> cases_pattern_fold_names Id.Set.add ids t)
+ indnal
+ (Option.fold_right (down_located (Name.fold_right Id.Set.add)) ona l))
+ tms Id.Set.empty
+
+let rec fold_constr_expr_binders g f n acc b = function
+ | (nal,bk,t)::l ->
+ let nal = snd (List.split nal) in
+ let n' = List.fold_right (Name.fold_right g) nal n in
+ f n (fold_constr_expr_binders g f n' acc b l) t
+ | [] ->
+ f n acc b
+
+let rec fold_local_binders g f n acc b = function
+ | CLocalAssum (nal,bk,t)::l ->
+ let nal = snd (List.split nal) in
+ let n' = List.fold_right (Name.fold_right g) nal n in
+ f n (fold_local_binders g f n' acc b l) t
+ | CLocalDef ((_,na),c,t)::l ->
+ Option.fold_left (f n) (f n (fold_local_binders g f (Name.fold_right g na n) acc b l) c) t
+ | CLocalPattern (_,(pat,t))::l ->
+ let acc = fold_local_binders g f (cases_pattern_fold_names g n pat) acc b l in
+ Option.fold_left (f n) acc t
+ | [] ->
+ f n acc b
+
+let fold_constr_expr_with_binders g f n acc = CAst.with_val (function
+ | CAppExpl ((_,_,_),l) -> List.fold_left (f n) acc l
+ | CApp ((_,t),l) -> List.fold_left (f n) (f n acc t) (List.map fst l)
+ | CProdN (l,b) | CLambdaN (l,b) -> fold_constr_expr_binders g f n acc b l
+ | CLetIn (na,a,t,b) ->
+ f (Name.fold_right g (snd na) n) (Option.fold_left (f n) (f n acc a) t) b
+ | CCast (a,(CastConv b|CastVM b|CastNative b)) -> f n (f n acc a) b
+ | CCast (a,CastCoerce) -> f n acc a
+ | CNotation (_,(l,ll,bll)) ->
+ (* The following is an approximation: we don't know exactly if
+ an ident is binding nor to which subterms bindings apply *)
+ let acc = List.fold_left (f n) acc (l@List.flatten ll) in
+ List.fold_left (fun acc bl -> fold_local_binders g f n acc (CAst.make @@ CHole (None,IntroAnonymous,None)) bl) acc bll
+ | CGeneralization (_,_,c) -> f n acc c
+ | CDelimiters (_,a) -> f n acc a
+ | CHole _ | CEvar _ | CPatVar _ | CSort _ | CPrim _ | CRef _ ->
+ acc
+ | CRecord l -> List.fold_left (fun acc (id, c) -> f n acc c) acc l
+ | CCases (sty,rtnpo,al,bl) ->
+ let ids = ids_of_cases_tomatch al in
+ let acc = Option.fold_left (f (Id.Set.fold g ids n)) acc rtnpo in
+ let acc = List.fold_left (f n) acc (List.map (fun (fst,_,_) -> fst) al) in
+ List.fold_right (fun (loc,(patl,rhs)) acc ->
+ let ids = ids_of_pattern_list patl in
+ f (Id.Set.fold g ids n) acc rhs) bl acc
+ | CLetTuple (nal,(ona,po),b,c) ->
+ let n' = List.fold_right (down_located (Name.fold_right g)) nal n in
+ f (Option.fold_right (down_located (Name.fold_right g)) ona n') (f n acc b) c
+ | CIf (c,(ona,po),b1,b2) ->
+ let acc = f n (f n (f n acc b1) b2) c in
+ Option.fold_left
+ (f (Option.fold_right (down_located (Name.fold_right g)) ona n)) acc po
+ | CFix (_,l) ->
+ let n' = List.fold_right (fun ((_,id),_,_,_,_) -> g id) l n in
+ List.fold_right (fun (_,(_,o),lb,t,c) acc ->
+ fold_local_binders g f n'
+ (fold_local_binders g f n acc t lb) c lb) l acc
+ | CCoFix (_,_) ->
+ Feedback.msg_warning (strbrk "Capture check in multiple binders not done"); acc
+ | CProj (_,c) ->
+ f n acc c
+ )
+
+let free_vars_of_constr_expr c =
+ let rec aux bdvars l = function
+ | { CAst.v = CRef (Ident (_,id),_) } -> if Id.List.mem id bdvars then l else Id.Set.add id l
+ | c -> fold_constr_expr_with_binders (fun a l -> a::l) aux bdvars l c
+ in aux [] Id.Set.empty c
+
+let occur_var_constr_expr id c = Id.Set.mem id (free_vars_of_constr_expr c)
+
+(* Used in correctness and interface *)
+let map_binder g e nal = List.fold_right (down_located (Name.fold_right g)) nal e
+
+let map_binders f g e bl =
+ (* TODO: avoid variable capture in [t] by some [na] in [List.tl nal] *)
+ let h (e,bl) (nal,bk,t) = (map_binder g e nal,(nal,bk,f e t)::bl) in
+ let (e,rbl) = List.fold_left h (e,[]) bl in
+ (e, List.rev rbl)
+
+let map_local_binders f g e bl =
+ (* TODO: avoid variable capture in [t] by some [na] in [List.tl nal] *)
+ let h (e,bl) = function
+ CLocalAssum(nal,k,ty) ->
+ (map_binder g e nal, CLocalAssum(nal,k,f e ty)::bl)
+ | CLocalDef((loc,na),c,ty) ->
+ (Name.fold_right g na e, CLocalDef((loc,na),f e c,Option.map (f e) ty)::bl)
+ | CLocalPattern (loc,(pat,t)) ->
+ let ids = ids_of_pattern pat in
+ (Id.Set.fold g ids e, CLocalPattern (loc,(pat,Option.map (f e) t))::bl) in
+ let (e,rbl) = List.fold_left h (e,[]) bl in
+ (e, List.rev rbl)
+
+let map_constr_expr_with_binders g f e = CAst.map (function
+ | CAppExpl (r,l) -> CAppExpl (r,List.map (f e) l)
+ | CApp ((p,a),l) ->
+ CApp ((p,f e a),List.map (fun (a,i) -> (f e a,i)) l)
+ | CProdN (bl,b) ->
+ let (e,bl) = map_binders f g e bl in CProdN (bl,f e b)
+ | CLambdaN (bl,b) ->
+ let (e,bl) = map_binders f g e bl in CLambdaN (bl,f e b)
+ | CLetIn (na,a,t,b) ->
+ CLetIn (na,f e a,Option.map (f e) t,f (Name.fold_right g (snd na) e) b)
+ | CCast (a,c) -> CCast (f e a, Miscops.map_cast_type (f e) c)
+ | CNotation (n,(l,ll,bll)) ->
+ (* This is an approximation because we don't know what binds what *)
+ CNotation (n,(List.map (f e) l,List.map (List.map (f e)) ll,
+ List.map (fun bl -> snd (map_local_binders f g e bl)) bll))
+ | CGeneralization (b,a,c) -> CGeneralization (b,a,f e c)
+ | CDelimiters (s,a) -> CDelimiters (s,f e a)
+ | CHole _ | CEvar _ | CPatVar _ | CSort _
+ | CPrim _ | CRef _ as x -> x
+ | CRecord l -> CRecord (List.map (fun (id, c) -> (id, f e c)) l)
+ | CCases (sty,rtnpo,a,bl) ->
+ let bl = List.map (fun (loc,(patl,rhs)) ->
+ let ids = ids_of_pattern_list patl in
+ (loc,(patl,f (Id.Set.fold g ids e) rhs))) bl in
+ let ids = ids_of_cases_tomatch a in
+ let po = Option.map (f (Id.Set.fold g ids e)) rtnpo in
+ CCases (sty, po, List.map (fun (tm,x,y) -> f e tm,x,y) a,bl)
+ | CLetTuple (nal,(ona,po),b,c) ->
+ let e' = List.fold_right (down_located (Name.fold_right g)) nal e in
+ let e'' = Option.fold_right (down_located (Name.fold_right g)) ona e in
+ CLetTuple (nal,(ona,Option.map (f e'') po),f e b,f e' c)
+ | CIf (c,(ona,po),b1,b2) ->
+ let e' = Option.fold_right (down_located (Name.fold_right g)) ona e in
+ CIf (f e c,(ona,Option.map (f e') po),f e b1,f e b2)
+ | CFix (id,dl) ->
+ CFix (id,List.map (fun (id,n,bl,t,d) ->
+ let (e',bl') = map_local_binders f g e bl in
+ let t' = f e' t in
+ (* Note: fix names should be inserted before the arguments... *)
+ let e'' = List.fold_left (fun e ((_,id),_,_,_,_) -> g id e) e' dl in
+ let d' = f e'' d in
+ (id,n,bl',t',d')) dl)
+ | CCoFix (id,dl) ->
+ CCoFix (id,List.map (fun (id,bl,t,d) ->
+ let (e',bl') = map_local_binders f g e bl in
+ let t' = f e' t in
+ let e'' = List.fold_left (fun e ((_,id),_,_,_) -> g id e) e' dl in
+ let d' = f e'' d in
+ (id,bl',t',d')) dl)
+ | CProj (p,c) ->
+ CProj (p, f e c)
+ )
+
+(* Used in constrintern *)
+let rec replace_vars_constr_expr l = function
+ | { CAst.loc; v = CRef (Ident (loc_id,id),us) } as x ->
+ (try CAst.make ?loc @@ CRef (Ident (loc_id,Id.Map.find id l),us) with Not_found -> x)
+ | c -> map_constr_expr_with_binders Id.Map.remove
+ replace_vars_constr_expr l c
+
+(* Returns the ranges of locs of the notation that are not occupied by args *)
+(* and which are then occupied by proper symbols of the notation (or spaces) *)
+
+let locs_of_notation ?loc locs ntn =
+ let unloc loc = Option.cata Loc.unloc (0,0) loc in
+ let (bl, el) = unloc loc in
+ let locs = List.map unloc locs in
+ let rec aux pos = function
+ | [] -> if Int.equal pos el then [] else [(pos,el)]
+ | (ba,ea)::l -> if Int.equal pos ba then aux ea l else (pos,ba)::aux ea l
+ in aux bl (List.sort (fun l1 l2 -> fst l1 - fst l2) locs)
+
+let ntn_loc ?loc (args,argslist,binderslist) =
+ locs_of_notation ?loc
+ (List.map constr_loc (args@List.flatten argslist)@
+ List.map local_binders_loc binderslist)
+
+let patntn_loc ?loc (args,argslist) =
+ locs_of_notation ?loc
+ (List.map cases_pattern_expr_loc (args@List.flatten argslist))
+
+let error_invalid_pattern_notation ?loc () =
+ CErrors.user_err ?loc (str "Invalid notation for pattern.")
+
+(* Interpret the index of a recursion order annotation *)
+let split_at_annot bl na =
+ let names = List.map snd (names_of_local_assums bl) in
+ match na with
+ | None ->
+ begin match names with
+ | [] -> CErrors.user_err (Pp.str "A fixpoint needs at least one parameter.")
+ | _ -> ([], bl)
+ end
+ | Some (loc, id) ->
+ let rec aux acc = function
+ | CLocalAssum (bls, k, t) as x :: rest ->
+ let test (_, na) = match na with
+ | Name id' -> Id.equal id id'
+ | Anonymous -> false
+ in
+ let l, r = List.split_when test bls in
+ begin match r with
+ | [] -> aux (x :: acc) rest
+ | _ ->
+ let ans = match l with
+ | [] -> acc
+ | _ -> CLocalAssum (l, k, t) :: acc
+ in
+ (List.rev ans, CLocalAssum (r, k, t) :: rest)
+ end
+ | CLocalDef ((_,na),_,_) as x :: rest ->
+ if Name.equal (Name id) na then
+ CErrors.user_err ?loc
+ (Id.print id ++ str" must be a proper parameter and not a local definition.")
+ else
+ aux (x :: acc) rest
+ | CLocalPattern (_,_) :: rest ->
+ Loc.raise ?loc (Stream.Error "pattern with quote not allowed after fix")
+ | [] ->
+ CErrors.user_err ?loc
+ (str "No parameter named " ++ Id.print id ++ str".")
+ in aux [] bl
+
(** Pseudo-constructors *)
let mkIdentC id = CAst.make @@ CRef (Ident (Loc.tag id),None)
@@ -265,38 +544,40 @@ let add_name_in_env env n =
| Anonymous -> env
| Name id -> id :: env
-let (fresh_var, fresh_var_hook) = Hook.make ~default:(fun _ _ -> assert false) ()
+let fresh_var env c =
+ Namegen.next_ident_away (Id.of_string "pat")
+ (List.fold_left (fun accu id -> Id.Set.add id accu) (free_vars_of_constr_expr c) env)
let expand_binders ?loc mkC bl c =
let rec loop ?loc bl c =
match bl with
| [] -> ([], c)
| b :: bl ->
- match b with
- | CLocalDef ((loc1,_) as n, oty, b) ->
- let env, c = loop ?loc:(Loc.merge_opt loc1 loc) bl c in
- let env = add_name_in_env env n in
- (env, CAst.make ?loc @@ CLetIn (n,oty,b,c))
- | CLocalAssum ((loc1,_)::_ as nl, bk, t) ->
- let env, c = loop ?loc:(Loc.merge_opt loc1 loc) bl c in
- let env = List.fold_left add_name_in_env env nl in
- (env, mkC ?loc (nl,bk,t) c)
- | CLocalAssum ([],_,_) -> loop ?loc bl c
- | CLocalPattern (loc1, (p, ty)) ->
- let env, c = loop ?loc:(Loc.merge_opt loc1 loc) bl c in
- let ni = Hook.get fresh_var env c in
- let id = (loc1, Name ni) in
- let ty = match ty with
- | Some ty -> ty
- | None -> CAst.make ?loc:loc1 @@ CHole (None, IntroAnonymous, None)
- in
- let e = CAst.make @@ CRef (Libnames.Ident (loc1, ni), None) in
- let c = CAst.make ?loc @@
- CCases
- (LetPatternStyle, None, [(e,None,None)],
- [(Loc.tag ?loc:loc1 ([(loc1,[p])], c))])
- in
- (ni :: env, mkC ?loc ([id],Default Explicit,ty) c)
+ match b with
+ | CLocalDef ((loc1,_) as n, oty, b) ->
+ let env, c = loop ?loc:(Loc.merge_opt loc1 loc) bl c in
+ let env = add_name_in_env env n in
+ (env, CAst.make ?loc @@ CLetIn (n,oty,b,c))
+ | CLocalAssum ((loc1,_)::_ as nl, bk, t) ->
+ let env, c = loop ?loc:(Loc.merge_opt loc1 loc) bl c in
+ let env = List.fold_left add_name_in_env env nl in
+ (env, mkC ?loc (nl,bk,t) c)
+ | CLocalAssum ([],_,_) -> loop ?loc bl c
+ | CLocalPattern (loc1, (p, ty)) ->
+ let env, c = loop ?loc:(Loc.merge_opt loc1 loc) bl c in
+ let ni = fresh_var env c in
+ let id = (loc1, Name ni) in
+ let ty = match ty with
+ | Some ty -> ty
+ | None -> CAst.make ?loc:loc1 @@ CHole (None, IntroAnonymous, None)
+ in
+ let e = CAst.make @@ CRef (Libnames.Ident (loc1, ni), None) in
+ let c = CAst.make ?loc @@
+ CCases
+ (LetPatternStyle, None, [(e,None,None)],
+ [(Loc.tag ?loc:loc1 ([[p]], c))])
+ in
+ (ni :: env, mkC ?loc ([id],Default Explicit,ty) c)
in
let (_, c) = loop ?loc bl c in
c
@@ -309,24 +590,34 @@ let mkCLambdaN ?loc bll c =
let mk ?loc b c = CAst.make ?loc @@ CLambdaN ([b],c) in
expand_binders ?loc mk bll c
-(* Deprecated *)
-let abstract_constr_expr c bl = mkCLambdaN ?loc:(local_binders_loc bl) bl c
-let prod_constr_expr c bl = mkCProdN ?loc:(local_binders_loc bl) bl c
-
let coerce_reference_to_id = function
| Ident (_,id) -> id
| Qualid (loc,_) ->
- CErrors.user_err ?loc ~hdr:"coerce_reference_to_id"
- (str "This expression should be a simple identifier.")
+ CErrors.user_err ?loc ~hdr:"coerce_reference_to_id"
+ (str "This expression should be a simple identifier.")
let coerce_to_id = function
| { CAst.v = CRef (Ident (loc,id),None) } -> (loc,id)
| { CAst.loc; _ } -> CErrors.user_err ?loc
- ~hdr:"coerce_to_id"
- (str "This expression should be a simple identifier.")
+ ~hdr:"coerce_to_id"
+ (str "This expression should be a simple identifier.")
let coerce_to_name = function
| { CAst.v = CRef (Ident (loc,id),None) } -> (loc,Name id)
| { CAst.loc; CAst.v = CHole (None,Misctypes.IntroAnonymous,None) } -> (loc,Anonymous)
| { CAst.loc; _ } -> CErrors.user_err ?loc ~hdr:"coerce_to_name"
(str "This expression should be a name.")
+
+let asymmetric_patterns = ref (false)
+let _ = Goptions.declare_bool_option {
+ Goptions.optdepr = false;
+ Goptions.optname = "no parameters in constructors";
+ Goptions.optkey = ["Asymmetric";"Patterns"];
+ Goptions.optread = (fun () -> !asymmetric_patterns);
+ Goptions.optwrite = (fun a -> asymmetric_patterns:=a);
+}
+
+(************************************************************************)
+(* Deprecated *)
+let abstract_constr_expr c bl = mkCLambdaN ?loc:(local_binders_loc bl) bl c
+let prod_constr_expr c bl = mkCProdN ?loc:(local_binders_loc bl) bl c
diff --git a/interp/constrexpr_ops.mli b/interp/constrexpr_ops.mli
index 7bd275e51..6e5c0f851 100644
--- a/interp/constrexpr_ops.mli
+++ b/interp/constrexpr_ops.mli
@@ -56,11 +56,11 @@ val mkCProdN : ?loc:Loc.t -> local_binder_expr list -> constr_expr -> constr_exp
(** @deprecated variant of mkCLambdaN *)
val abstract_constr_expr : constr_expr -> local_binder_expr list -> constr_expr
+[@@ocaml.deprecated "deprecated variant of mkCLambdaN"]
(** @deprecated variant of mkCProdN *)
val prod_constr_expr : constr_expr -> local_binder_expr list -> constr_expr
-
-val fresh_var_hook : (Names.Id.t list -> Constrexpr.constr_expr -> Names.Id.t) Hook.t
+[@@ocaml.deprecated "deprecated variant of mkCProdN"]
(** {6 Destructors}*)
@@ -83,3 +83,36 @@ val names_of_local_binders : local_binder_expr list -> Name.t located list
val names_of_local_assums : local_binder_expr list -> Name.t located list
(** Same as [names_of_local_binder_exprs], but does not take the [let] bindings into
account. *)
+
+(** {6 Folds and maps} *)
+
+(** Used in typeclasses *)
+val fold_constr_expr_with_binders : (Id.t -> 'a -> 'a) ->
+ ('a -> 'b -> constr_expr -> 'b) -> 'a -> 'b -> constr_expr -> 'b
+
+(** Used in correctness and interface; absence of var capture not guaranteed
+ in pattern-matching clauses and in binders of the form [x,y:T(x)] *)
+
+val map_constr_expr_with_binders :
+ (Id.t -> 'a -> 'a) -> ('a -> constr_expr -> constr_expr) ->
+ 'a -> constr_expr -> constr_expr
+
+val replace_vars_constr_expr :
+ Id.t Id.Map.t -> constr_expr -> constr_expr
+
+(** Specific function for interning "in indtype" syntax of "match" *)
+val ids_of_cases_indtype : cases_pattern_expr -> Id.Set.t
+
+val free_vars_of_constr_expr : constr_expr -> Id.Set.t
+val occur_var_constr_expr : Id.t -> constr_expr -> bool
+
+val split_at_annot : local_binder_expr list -> Id.t located option -> local_binder_expr list * local_binder_expr list
+
+val ntn_loc : ?loc:Loc.t -> constr_notation_substitution -> string -> (int * int) list
+val patntn_loc : ?loc:Loc.t -> cases_pattern_notation_substitution -> string -> (int * int) list
+
+(** For cases pattern parsing errors *)
+val error_invalid_pattern_notation : ?loc:Loc.t -> unit -> 'a
+
+(** Placeholder for global option, should be moved to a parameter *)
+val asymmetric_patterns : bool ref
diff --git a/interp/constrextern.ml b/interp/constrextern.ml
index bd6aa0911..4f7d537d3 100644
--- a/interp/constrextern.ml
+++ b/interp/constrextern.ml
@@ -12,7 +12,7 @@ open CErrors
open Util
open Names
open Nameops
-open Term
+open Constr
open Termops
open Libnames
open Globnames
@@ -21,7 +21,6 @@ open CAst
open Constrexpr
open Constrexpr_ops
open Notation_ops
-open Topconstr
open Glob_term
open Glob_ops
open Pattern
@@ -185,18 +184,8 @@ let with_universes f = Flags.with_option print_universes f
let with_meta_as_hole f = Flags.with_option print_meta_as_hole f
let without_symbols f = Flags.with_option print_no_symbol f
-(* XXX: Where to put this in the library? Util maybe? *)
-let protect_ref r nf f x =
- let old_ref = !r in
- r := nf !r;
- try let res = f x in r := old_ref; res
- with reraise ->
- let reraise = Backtrace.add_backtrace reraise in
- r := old_ref;
- Exninfo.iraise reraise
-
let without_specific_symbols l =
- protect_ref inactive_notations_table
+ Flags.with_modified_ref inactive_notations_table
(fun tbl -> IRuleSet.(union (of_list l) tbl))
(**********************************************************************)
@@ -394,7 +383,7 @@ let rec extern_cases_pattern_in_scope (scopes:local_scopes) vars pat =
try
if !Flags.in_debugger || !Flags.raw_print || !print_no_symbol then raise No_match;
extern_notation_pattern scopes vars pat
- (uninterp_cases_pattern_notations pat)
+ (uninterp_cases_pattern_notations scopes pat)
with No_match ->
lift (fun ?loc -> function
| PatVar (Name id) -> CPatAtom (Some (Ident (loc,id)))
@@ -424,7 +413,7 @@ let rec extern_cases_pattern_in_scope (scopes:local_scopes) vars pat =
with
Not_found | No_match | Exit ->
let c = extern_reference ?loc Id.Set.empty (ConstructRef cstrsp) in
- if !Topconstr.asymmetric_patterns then
+ if !asymmetric_patterns then
if pattern_printable_in_both_syntax cstrsp
then CPatCstr (c, None, args)
else CPatCstr (c, Some (add_patt_for_params (fst cstrsp) args), [])
@@ -456,7 +445,7 @@ and apply_notation_to_pattern ?loc gr ((subst,substlist),(nb_to_drop,more_args))
List.map (extern_cases_pattern_in_scope subscope vars) c)
substlist in
let l2 = List.map (extern_cases_pattern_in_scope allscopes vars) more_args in
- let l2' = if !Topconstr.asymmetric_patterns || not (List.is_empty ll) then l2
+ let l2' = if !asymmetric_patterns || not (List.is_empty ll) then l2
else
match drop_implicits_in_patt gr nb_to_drop l2 with
|Some true_args -> true_args
@@ -472,7 +461,7 @@ and apply_notation_to_pattern ?loc gr ((subst,substlist),(nb_to_drop,more_args))
extern_cases_pattern_in_scope (scopt,scl@scopes) vars c)
subst in
let l2 = List.map (extern_cases_pattern_in_scope allscopes vars) more_args in
- let l2' = if !Topconstr.asymmetric_patterns then l2
+ let l2' = if !asymmetric_patterns then l2
else
match drop_implicits_in_patt gr (nb_to_drop + List.length l1) l2 with
|Some true_args -> true_args
@@ -525,7 +514,7 @@ let extern_ind_pattern_in_scope (scopes:local_scopes) vars ind args =
try
if !Flags.raw_print || !print_no_symbol then raise No_match;
extern_notation_ind_pattern scopes vars ind args
- (uninterp_ind_pattern_notations ind)
+ (uninterp_ind_pattern_notations scopes ind)
with No_match ->
let c = extern_reference vars (IndRef ind) in
let args = List.map (extern_cases_pattern_in_scope scopes vars) args in
@@ -745,7 +734,7 @@ let rec extern inctx scopes vars r =
try
let r'' = flatten_application r' in
if !Flags.raw_print || !print_no_symbol then raise No_match;
- extern_notation scopes vars r'' (uninterp_notations r'')
+ extern_notation scopes vars r'' (uninterp_notations scopes r'')
with No_match -> lift (fun ?loc -> function
| GRef (ref,us) ->
extern_global (select_stronger_impargs (implicits_of_global ref))
@@ -863,7 +852,7 @@ let rec extern inctx scopes vars r =
) x))
tml
in
- let eqns = List.map (extern_eqn inctx scopes vars) eqns in
+ let eqns = List.map (extern_eqn inctx scopes vars) (factorize_eqns eqns) in
CCases (sty,rtntypopt',tml,eqns)
| GLetTuple (nal,(na,typopt),tm,b) ->
@@ -919,6 +908,9 @@ let rec extern inctx scopes vars r =
| GCast (c, c') ->
CCast (sub_extern true scopes vars c,
Miscops.map_cast_type (extern_typ scopes vars) c')
+ | GProj (p, c) ->
+ let pr = extern_reference ?loc Id.Set.empty (ConstRef (Projection.constant p)) in
+ CProj (pr, sub_extern inctx scopes vars c)
) r'
and extern_typ (_,scopes) =
@@ -977,9 +969,9 @@ and extern_local_binder scopes vars = function
let (assums,ids,l) = extern_local_binder scopes vars l in
(assums,ids, CLocalPattern(Loc.tag @@ (p,ty)) :: l)
-and extern_eqn inctx scopes vars (loc,(ids,pl,c)) =
- Loc.tag ?loc ([loc,List.map (extern_cases_pattern_in_scope scopes vars) pl],
- extern inctx scopes vars c)
+and extern_eqn inctx scopes vars (loc,(ids,pll,c)) =
+ let pll = List.map (List.map (extern_cases_pattern_in_scope scopes vars)) pll in
+ Loc.tag ?loc (pll,extern inctx scopes vars c)
and extern_notation (tmp_scope,scopes as allscopes) vars t = function
| [] -> raise No_match
diff --git a/interp/constrextern.mli b/interp/constrextern.mli
index b2df449c5..51b06580e 100644
--- a/interp/constrextern.mli
+++ b/interp/constrextern.mli
@@ -7,7 +7,6 @@
(************************************************************************)
open Names
-open Term
open Termops
open EConstr
open Environ
@@ -41,7 +40,7 @@ val extern_constr : ?lax:bool -> bool -> env -> Evd.evar_map -> constr -> constr
val extern_constr_in_scope : bool -> scope_name -> env -> Evd.evar_map -> constr -> constr_expr
val extern_reference : ?loc:Loc.t -> Id.Set.t -> global_reference -> reference
val extern_type : bool -> env -> Evd.evar_map -> types -> constr_expr
-val extern_sort : Evd.evar_map -> sorts -> glob_sort
+val extern_sort : Evd.evar_map -> Sorts.t -> glob_sort
val extern_rel_context : constr option -> env -> Evd.evar_map ->
rel_context -> local_binder_expr list
@@ -61,6 +60,19 @@ val set_extern_reference :
val get_extern_reference :
unit -> (?loc:Loc.t -> Id.Set.t -> global_reference -> reference)
+(** WARNING: The following functions are evil due to
+ side-effects. Think of the following case as used in the printer:
+
+ without_specific_symbols [SynDefRule kn] (pr_glob_constr_env env) c
+
+ vs
+
+ without_specific_symbols [SynDefRule kn] pr_glob_constr_env env c
+
+ which one is wrong? We should turn this kind of state into an
+ explicit argument.
+*)
+
(** This forces printing universe names of Type\{.\} *)
val with_universes : ('a -> 'b) -> 'a -> 'b
diff --git a/interp/constrintern.ml b/interp/constrintern.ml
index a0a749bfb..8e99435db 100644
--- a/interp/constrintern.ml
+++ b/interp/constrintern.ml
@@ -24,7 +24,6 @@ open Constrexpr
open Constrexpr_ops
open Notation_term
open Notation_ops
-open Topconstr
open Nametab
open Notation
open Inductiveops
@@ -122,7 +121,7 @@ type internalization_error =
exception InternalizationError of internalization_error Loc.located
let explain_variable_capture id id' =
- pr_id id ++ str " is dependent in the type of " ++ pr_id id' ++
+ Id.print id ++ str " is dependent in the type of " ++ Id.print id' ++
strbrk ": cannot interpret both of them with the same type"
let explain_illegal_metavariable =
@@ -132,12 +131,12 @@ let explain_not_a_constructor ref =
str "Unknown constructor: " ++ pr_reference ref
let explain_unbound_fix_name is_cofix id =
- str "The name" ++ spc () ++ pr_id id ++
+ str "The name" ++ spc () ++ Id.print id ++
spc () ++ str "is not bound in the corresponding" ++ spc () ++
str (if is_cofix then "co" else "") ++ str "fixpoint definition"
let explain_non_linear_pattern id =
- str "The variable " ++ pr_id id ++ str " is bound several times in pattern"
+ str "The variable " ++ Id.print id ++ str " is bound several times in pattern"
let explain_bad_patterns_number n1 n2 =
str "Expecting " ++ int n1 ++ str (String.plural n1 " pattern") ++
@@ -163,7 +162,7 @@ let error_parameter_not_implicit ?loc =
"they must be replaced by '_'.")
let error_ldots_var ?loc =
- user_err ?loc (str "Special token " ++ pr_id ldots_var ++
+ user_err ?loc (str "Special token " ++ Id.print ldots_var ++
str " is for use in the Notation command.")
(**********************************************************************)
@@ -263,13 +262,13 @@ let pr_scope_stack = function
let error_inconsistent_scope ?loc id scopes1 scopes2 =
user_err ?loc ~hdr:"set_var_scope"
- (pr_id id ++ str " is here used in " ++
+ (Id.print id ++ str " is here used in " ++
pr_scope_stack scopes2 ++ strbrk " while it was elsewhere used in " ++
pr_scope_stack scopes1)
let error_expect_binder_notation_type ?loc id =
user_err ?loc
- (pr_id id ++
+ (Id.print id ++
str " is expected to occur in binding position in the right-hand side.")
let set_var_scope ?loc id istermvar env ntnvars =
@@ -365,7 +364,7 @@ let check_hidden_implicit_parameters ?loc id impls =
| (Inductive (indparams,check),_,_,_) when check -> Id.List.mem id indparams
| _ -> false) impls
then
- user_err ?loc (pr_id id ++ strbrk " is already used as name of " ++
+ user_err ?loc (Id.print id ++ strbrk " is already used as name of " ++
strbrk "a parameter of the inductive type; bound variables in " ++
strbrk "the type of a constructor shall use a different name.")
@@ -534,8 +533,9 @@ let traverse_binder (terms,_,_ as subst) avoid (renaming,env) = function
| Name id ->
try
(* Binders bound in the notation are considered first-order objects *)
- let _,na = coerce_to_name (fst (Id.Map.find id terms)) in
- (renaming,{env with ids = Name.fold_right Id.Set.add na env.ids}), na
+ let _,na as locna = coerce_to_name (fst (Id.Map.find id terms)) in
+ let env = push_name_env Id.Map.empty (Variable,[],[],[]) env locna in
+ (renaming,env), na
with Not_found ->
(* Binders not bound in the notation do not capture variables *)
(* outside the notation (i.e. in the substitution) *)
@@ -743,11 +743,18 @@ let string_of_ty = function
let gvar (loc, id) us = match us with
| None -> DAst.make ?loc @@ GVar id
| Some _ ->
- user_err ?loc (str "Variable " ++ pr_id id ++
+ user_err ?loc (str "Variable " ++ Id.print id ++
str " cannot have a universe instance")
let intern_var genv (ltacvars,ntnvars) namedctx loc id us =
- (* Is [id] an inductive type potentially with implicit *)
+ (* Is [id] a notation variable *)
+ if Id.Map.mem id ntnvars then
+ begin
+ if not (Id.Map.mem id genv.impls) then set_var_scope ?loc id true genv ntnvars;
+ gvar (loc,id) us, [], [], []
+ end
+ else
+ (* Is [id] registered with implicit arguments *)
try
let ty,expl_impls,impls,argsc = Id.Map.find id genv.impls in
let expl_impls = List.map
@@ -760,19 +767,15 @@ let intern_var genv (ltacvars,ntnvars) namedctx loc id us =
if Id.Set.mem id genv.ids || Id.Set.mem id ltacvars.ltac_vars
then
gvar (loc,id) us, [], [], []
- (* Is [id] a notation variable *)
- else if Id.Map.mem id ntnvars
- then
- (set_var_scope ?loc id true genv ntnvars; gvar (loc,id) us, [], [], [])
- (* Is [id] the special variable for recursive notations *)
else if Id.equal id ldots_var
+ (* Is [id] the special variable for recursive notations? *)
then if Id.Map.is_empty ntnvars
then error_ldots_var ?loc
else gvar (loc,id) us, [], [], []
else if Id.Set.mem id ltacvars.ltac_bound then
(* Is [id] bound to a free name in ltac (this is an ltac error message) *)
user_err ?loc ~hdr:"intern_var"
- (str "variable " ++ pr_id id ++ str " should be bound to a term.")
+ (str "variable " ++ Id.print id ++ str " should be bound to a term.")
else
(* Is [id] a goal or section variable *)
let _ = Context.Named.lookup id namedctx in
@@ -955,8 +958,11 @@ let rec has_duplicate = function
| [] -> None
| x::l -> if Id.List.mem x l then (Some x) else has_duplicate l
+let loc_of_multiple_pattern pl =
+ Loc.merge_opt (cases_pattern_expr_loc (List.hd pl)) (cases_pattern_expr_loc (List.last pl))
+
let loc_of_lhs lhs =
- Loc.merge_opt (fst (List.hd lhs)) (fst (List.last lhs))
+ Loc.merge_opt (loc_of_multiple_pattern (List.hd lhs)) (loc_of_multiple_pattern (List.last lhs))
let check_linearity lhs ids =
match has_duplicate ids with
@@ -1570,9 +1576,9 @@ let extract_explicit_arg imps args =
| ExplByName id ->
if not (exists_implicit_name id imps) then
user_err ?loc
- (str "Wrong argument name: " ++ pr_id id ++ str ".");
+ (str "Wrong argument name: " ++ Id.print id ++ str ".");
if Id.Map.mem id eargs then
- user_err ?loc (str "Argument name " ++ pr_id id
+ user_err ?loc (str "Argument name " ++ Id.print id
++ str " occurs more than once.");
id
| ExplByPos (p,_id) ->
@@ -1863,15 +1869,22 @@ let internalize globalenv env pattern_mode (_, ntnvars as lvar) c =
| CCast (c1, c2) ->
DAst.make ?loc @@
GCast (intern env c1, Miscops.map_cast_type (intern_type env) c2)
- )
+ | CProj (pr, c) ->
+ match intern_reference pr with
+ | ConstRef p ->
+ DAst.make ?loc @@ GProj (Projection.make p false, intern env c)
+ | _ ->
+ raise (InternalizationError (loc,IllegalMetavariable)) (* FIXME *)
+ )
and intern_type env = intern (set_type_scope env)
and intern_local_binder env bind : intern_env * Glob_term.extended_glob_local_binder list =
intern_local_binder_aux intern ntnvars env bind
(* Expands a multiple pattern into a disjunction of multiple patterns *)
- and intern_multiple_pattern env n (loc,pl) =
+ and intern_multiple_pattern env n pl =
let idsl_pll = List.map (intern_cases_pattern globalenv (None,env.scopes) empty_alias) pl in
+ let loc = loc_of_multiple_pattern pl in
check_number_of_pattern loc n pl;
product_of_cases_patterns empty_alias idsl_pll
@@ -1990,7 +2003,7 @@ let internalize globalenv env pattern_mode (_, ntnvars as lvar) c =
(let (id,(loc,_)) = Id.Map.choose eargs in
user_err ?loc (str "Not enough non implicit \
arguments to accept the argument bound to " ++
- pr_id id ++ str"."));
+ Id.print id ++ str"."));
[]
| ([], rargs) ->
assert (Id.Map.is_empty eargs);
@@ -2091,39 +2104,36 @@ let interp_open_constr env sigma c =
(* Not all evars expected to be resolved and computation of implicit args *)
-let interp_constr_evars_gen_impls env evdref
+let interp_constr_evars_gen_impls env sigma
?(impls=empty_internalization_env) expected_type c =
let c = intern_gen expected_type ~impls env c in
let imps = Implicit_quantifiers.implicits_of_glob_constr ~with_products:(expected_type == IsType) c in
- let evd, c = understand_tcc env !evdref ~expected_type c in
- evdref := evd;
- c, imps
+ let sigma, c = understand_tcc env sigma ~expected_type c in
+ sigma, (c, imps)
-let interp_constr_evars_impls env evdref ?(impls=empty_internalization_env) c =
- interp_constr_evars_gen_impls env evdref ~impls WithoutTypeConstraint c
+let interp_constr_evars_impls env sigma ?(impls=empty_internalization_env) c =
+ interp_constr_evars_gen_impls env sigma ~impls WithoutTypeConstraint c
let interp_casted_constr_evars_impls env evdref ?(impls=empty_internalization_env) c typ =
interp_constr_evars_gen_impls env evdref ~impls (OfType typ) c
-let interp_type_evars_impls env evdref ?(impls=empty_internalization_env) c =
- interp_constr_evars_gen_impls env evdref ~impls IsType c
+let interp_type_evars_impls env sigma ?(impls=empty_internalization_env) c =
+ interp_constr_evars_gen_impls env sigma ~impls IsType c
(* Not all evars expected to be resolved, with side-effect on evars *)
-let interp_constr_evars_gen env evdref ?(impls=empty_internalization_env) expected_type c =
+let interp_constr_evars_gen env sigma ?(impls=empty_internalization_env) expected_type c =
let c = intern_gen expected_type ~impls env c in
- let evd, c = understand_tcc env !evdref ~expected_type c in
- evdref := evd;
- c
+ understand_tcc env sigma ~expected_type c
let interp_constr_evars env evdref ?(impls=empty_internalization_env) c =
interp_constr_evars_gen env evdref WithoutTypeConstraint ~impls c
-let interp_casted_constr_evars env evdref ?(impls=empty_internalization_env) c typ =
- interp_constr_evars_gen env evdref ~impls (OfType (EConstr.of_constr typ)) c
+let interp_casted_constr_evars env sigma ?(impls=empty_internalization_env) c typ =
+ interp_constr_evars_gen env sigma ~impls (OfType typ) c
-let interp_type_evars env evdref ?(impls=empty_internalization_env) c =
- interp_constr_evars_gen env evdref IsType ~impls c
+let interp_type_evars env sigma ?(impls=empty_internalization_env) c =
+ interp_constr_evars_gen env sigma IsType ~impls c
(* Miscellaneous *)
@@ -2178,17 +2188,16 @@ let intern_context global_level env impl_env binders =
with InternalizationError (loc,e) ->
user_err ?loc ~hdr:"internalize" (explain_internalization_error e)
-let interp_glob_context_evars env evdref k bl =
+let interp_glob_context_evars env sigma k bl =
let open EConstr in
- let (env, par, _, impls) =
+ let env, sigma, par, _, impls =
List.fold_left
- (fun (env,params,n,impls) (na, k, b, t) ->
+ (fun (env,sigma,params,n,impls) (na, k, b, t) ->
let t' =
if Option.is_empty b then locate_if_hole ?loc:(loc_of_glob_constr t) na t
else t
in
- let (evd,t) = understand_tcc env !evdref ~expected_type:IsType t' in
- evdref := evd;
+ let sigma, t = understand_tcc env sigma ~expected_type:IsType t' in
match b with
None ->
let d = LocalAssum (na,t) in
@@ -2198,16 +2207,15 @@ let interp_glob_context_evars env evdref k bl =
(ExplByPos (n, na), (true, true, true)) :: impls
else impls
in
- (push_rel d env, d::params, succ n, impls)
+ (push_rel d env, sigma, d::params, succ n, impls)
| Some b ->
- let (evd,c) = understand_tcc env !evdref ~expected_type:(OfType t) b in
- evdref := evd;
+ let sigma, c = understand_tcc env sigma ~expected_type:(OfType t) b in
let d = LocalDef (na, c, t) in
- (push_rel d env, d::params, n, impls))
- (env,[],k+1,[]) (List.rev bl)
- in (env, par), impls
+ (push_rel d env, sigma, d::params, n, impls))
+ (env,sigma,[],k+1,[]) (List.rev bl)
+ in sigma, ((env, par), impls)
-let interp_context_evars ?(global_level=false) ?(impl_env=empty_internalization_env) ?(shift=0) env evdref params =
+let interp_context_evars ?(global_level=false) ?(impl_env=empty_internalization_env) ?(shift=0) env sigma params =
let int_env,bl = intern_context global_level env impl_env params in
- let x = interp_glob_context_evars env evdref shift bl in
- int_env, x
+ let sigma, x = interp_glob_context_evars env sigma shift bl in
+ sigma, (int_env, x)
diff --git a/interp/constrintern.mli b/interp/constrintern.mli
index 75e99dd9b..632b423b0 100644
--- a/interp/constrintern.mli
+++ b/interp/constrintern.mli
@@ -7,7 +7,7 @@
(************************************************************************)
open Names
-open Term
+open Constr
open Evd
open Environ
open Libnames
@@ -112,28 +112,28 @@ val interp_open_constr : env -> evar_map -> constr_expr -> evar_map * EConstr.co
(** Accepting unresolved evars *)
-val interp_constr_evars : env -> evar_map ref ->
- ?impls:internalization_env -> constr_expr -> EConstr.constr
+val interp_constr_evars : env -> evar_map ->
+ ?impls:internalization_env -> constr_expr -> evar_map * EConstr.constr
-val interp_casted_constr_evars : env -> evar_map ref ->
- ?impls:internalization_env -> constr_expr -> types -> EConstr.constr
+val interp_casted_constr_evars : env -> evar_map ->
+ ?impls:internalization_env -> constr_expr -> EConstr.types -> evar_map * EConstr.constr
-val interp_type_evars : env -> evar_map ref ->
- ?impls:internalization_env -> constr_expr -> EConstr.types
+val interp_type_evars : env -> evar_map ->
+ ?impls:internalization_env -> constr_expr -> evar_map * EConstr.types
(** Accepting unresolved evars and giving back the manual implicit arguments *)
-val interp_constr_evars_impls : env -> evar_map ref ->
+val interp_constr_evars_impls : env -> evar_map ->
?impls:internalization_env -> constr_expr ->
- EConstr.constr * Impargs.manual_implicits
+ evar_map * (EConstr.constr * Impargs.manual_implicits)
-val interp_casted_constr_evars_impls : env -> evar_map ref ->
+val interp_casted_constr_evars_impls : env -> evar_map ->
?impls:internalization_env -> constr_expr -> EConstr.types ->
- EConstr.constr * Impargs.manual_implicits
+ evar_map * (EConstr.constr * Impargs.manual_implicits)
-val interp_type_evars_impls : env -> evar_map ref ->
+val interp_type_evars_impls : env -> evar_map ->
?impls:internalization_env -> constr_expr ->
- EConstr.types * Impargs.manual_implicits
+ evar_map * (EConstr.types * Impargs.manual_implicits)
(** Interprets constr patterns *)
@@ -158,8 +158,8 @@ val interp_binder_evars : env -> evar_map ref -> Name.t -> constr_expr -> EConst
val interp_context_evars :
?global_level:bool -> ?impl_env:internalization_env -> ?shift:int ->
- env -> evar_map ref -> local_binder_expr list ->
- internalization_env * ((env * EConstr.rel_context) * Impargs.manual_implicits)
+ env -> evar_map -> local_binder_expr list ->
+ evar_map * (internalization_env * ((env * EConstr.rel_context) * Impargs.manual_implicits))
(* val interp_context_gen : (env -> glob_constr -> unsafe_type_judgment Evd.in_evar_universe_context) -> *)
(* (env -> Evarutil.type_constraint -> glob_constr -> unsafe_judgment Evd.in_evar_universe_context) -> *)
diff --git a/interp/declare.ml b/interp/declare.ml
index bd8f3db50..55f825c25 100644
--- a/interp/declare.ml
+++ b/interp/declare.ml
@@ -14,8 +14,7 @@ open Util
open Names
open Libnames
open Globnames
-open Nameops
-open Term
+open Constr
open Declarations
open Entries
open Libobject
@@ -32,64 +31,6 @@ type internal_flag =
| InternalTacticRequest (* kernel action, no message is displayed *)
| UserIndividualRequest (* user action, a message is displayed *)
-(** Declaration of section variables and local definitions *)
-
-type section_variable_entry =
- | SectionLocalDef of Safe_typing.private_constants definition_entry
- | SectionLocalAssum of types Univ.in_universe_context_set * polymorphic * bool (** Implicit status *)
-
-type variable_declaration = DirPath.t * section_variable_entry * logical_kind
-
-let cache_variable ((sp,_),o) =
- match o with
- | Inl ctx -> Global.push_context_set false ctx
- | Inr (id,(p,d,mk)) ->
- (* Constr raisonne sur les noms courts *)
- if variable_exists id then
- alreadydeclared (pr_id id ++ str " already exists");
-
- let impl,opaq,poly,ctx = match d with (* Fails if not well-typed *)
- | SectionLocalAssum ((ty,ctx),poly,impl) ->
- let () = Global.push_named_assum ((id,ty,poly),ctx) in
- let impl = if impl then Implicit else Explicit in
- impl, true, poly, ctx
- | SectionLocalDef (de) ->
- let univs = Global.push_named_def (id,de) in
- let poly = match de.const_entry_universes with
- | Monomorphic_const_entry _ -> false
- | Polymorphic_const_entry _ -> true
- in
- Explicit, de.const_entry_opaque,
- poly, univs in
- Nametab.push (Nametab.Until 1) (restrict_path 0 sp) (VarRef id);
- add_section_variable id impl poly ctx;
- Dischargedhypsmap.set_discharged_hyps sp [];
- add_variable_data id (p,opaq,ctx,poly,mk)
-
-let discharge_variable (_,o) = match o with
- | Inr (id,_) ->
- if variable_polymorphic id then None
- else Some (Inl (variable_context id))
- | Inl _ -> Some o
-
-type variable_obj =
- (Univ.ContextSet.t, Id.t * variable_declaration) union
-
-let inVariable : variable_obj -> obj =
- declare_object { (default_object "VARIABLE") with
- cache_function = cache_variable;
- discharge_function = discharge_variable;
- classify_function = (fun _ -> Dispose) }
-
-(* for initial declaration *)
-let declare_variable id obj =
- let oname = add_leaf id (inVariable (Inr (id,obj))) in
- declare_var_implicits id;
- Notation.declare_ref_arguments_scope (VarRef id);
- Heads.declare_head (EvalVarRef id);
- oname
-
-
(** Declaration of constants and parameters *)
type constant_obj = {
@@ -107,7 +48,7 @@ type constant_declaration = Safe_typing.private_constants constant_entry * logic
(* section (if Remark or Fact) is needed to access a construction *)
let load_constant i ((sp,kn), obj) =
if Nametab.exists_cci sp then
- alreadydeclared (pr_id (basename sp) ++ str " already exists");
+ alreadydeclared (Id.print (basename sp) ++ str " already exists");
let con = Global.constant_of_delta_kn kn in
Nametab.push (Nametab.Until i) sp (ConstRef con);
add_constant_kind con obj.cst_kind
@@ -132,38 +73,38 @@ let exists_name id =
let check_exists sp =
let id = basename sp in
- if exists_name id then alreadydeclared (pr_id id ++ str " already exists")
+ if exists_name id then alreadydeclared (Id.print id ++ str " already exists")
let cache_constant ((sp,kn), obj) =
let id = basename sp in
- let _,dir,_ = repr_kn kn in
+ let _,dir,_ = KerName.repr kn in
let kn' =
match obj.cst_decl with
| None ->
if Global.exists_objlabel (Label.of_id (basename sp))
- then constant_of_kn kn
+ 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 dir id decl
in
- assert (eq_constant kn' (constant_of_kn kn));
- Nametab.push (Nametab.Until 1) sp (ConstRef (constant_of_kn kn));
+ assert (Constant.equal kn' (Constant.make1 kn));
+ Nametab.push (Nametab.Until 1) sp (ConstRef (Constant.make1 kn));
let cst = Global.lookup_constant kn' in
add_section_constant (Declareops.constant_is_polymorphic cst) kn' cst.const_hyps;
Dischargedhypsmap.set_discharged_hyps sp obj.cst_hyps;
- add_constant_kind (constant_of_kn kn) obj.cst_kind
+ add_constant_kind (Constant.make1 kn) obj.cst_kind
let discharged_hyps kn sechyps =
- let (_,dir,_) = repr_kn kn in
+ let (_,dir,_) = KerName.repr kn in
let args = Array.to_list (instance_from_variable_context sechyps) in
List.rev_map (Libnames.make_path dir) args
let discharge_constant ((sp, kn), obj) =
- let con = constant_of_kn kn in
+ let con = Constant.make1 kn in
let from = Global.lookup_constant con in
let modlist = replacement_context () in
- let hyps,subst,uctx = section_segment_of_constant con in
+ let { abstr_ctx = hyps; abstr_subst = subst; abstr_uctx = uctx } = section_segment_of_constant con in
let new_hyps = (discharged_hyps kn hyps) @ obj.cst_hyps in
let abstract = (named_of_variable_context hyps, subst, uctx) in
let new_decl = GlobalRecipe{ from; info = { Opaqueproof.modlist; abstract}} in
@@ -196,6 +137,20 @@ let update_tables c =
Heads.declare_head (EvalConstRef c);
Notation.declare_ref_arguments_scope (ConstRef c)
+let register_side_effect (c, role) =
+ let o = inConstant {
+ cst_decl = None;
+ cst_hyps = [] ;
+ cst_kind = IsProof Theorem;
+ cst_locl = false;
+ } in
+ let id = Label.to_id (pi3 (Constant.repr3 c)) in
+ ignore(add_leaf id o);
+ update_tables c;
+ match role with
+ | Safe_typing.Subproof -> ()
+ | Safe_typing.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
@@ -204,12 +159,9 @@ let declare_constant_common id cst =
update_tables c;
c
+let default_univ_entry = Monomorphic_const_entry Univ.ContextSet.empty
let definition_entry ?fix_exn ?(opaque=false) ?(inline=false) ?types
- ?(poly=false) ?(univs=Univ.UContext.empty) ?(eff=Safe_typing.empty_private_constants) body =
- let univs =
- if poly then Polymorphic_const_entry univs
- else Monomorphic_const_entry univs
- in
+ ?(univs=default_univ_entry) ?(eff=Safe_typing.empty_private_constants) body =
{ const_entry_body = Future.from_val ?fix_exn ((body,Univ.ContextSet.empty), eff);
const_entry_secctx = None;
const_entry_type = types;
@@ -233,25 +185,11 @@ let declare_constant ?(internal = UserIndividualRequest) ?(local = false) id ?(e
(** This globally defines the side-effects in the environment. We mark
exported constants as being side-effect not to redeclare them at
caching time. *)
- let cd, export = Global.export_private_constants ~in_section cd in
- export, ConstantEntry (PureEntry, cd)
+ let de, export = Global.export_private_constants ~in_section de in
+ export, ConstantEntry (PureEntry, DefinitionEntry de)
| _ -> [], ConstantEntry (EffectEntry, cd)
in
- let iter_eff (c, role) =
- let o = inConstant {
- cst_decl = None;
- cst_hyps = [] ;
- cst_kind = IsProof Theorem;
- cst_locl = false;
- } in
- let id = Label.to_id (pi3 (Constant.repr3 c)) in
- ignore(add_leaf id o);
- update_tables c;
- match role with
- | Safe_typing.Subproof -> ()
- | Safe_typing.Schema (ind, kind) -> !declare_scheme kind [|ind,c|]
- in
- let () = List.iter iter_eff export in
+ let () = List.iter register_side_effect export in
let cst = {
cst_decl = Some decl;
cst_hyps = [] ;
@@ -262,13 +200,85 @@ let declare_constant ?(internal = UserIndividualRequest) ?(local = false) id ?(e
let declare_definition ?(internal=UserIndividualRequest)
?(opaque=false) ?(kind=Decl_kinds.Definition) ?(local = false)
- ?(poly=false) id ?types (body,ctx) =
+ id ?types (body,univs) =
let cb =
- definition_entry ?types ~poly ~univs:(Univ.ContextSet.to_context ctx) ~opaque body
+ definition_entry ?types ~univs ~opaque body
in
declare_constant ~internal ~local id
(Entries.DefinitionEntry cb, Decl_kinds.IsDefinition kind)
+(** Declaration of section variables and local definitions *)
+
+type section_variable_entry =
+ | SectionLocalDef of Safe_typing.private_constants definition_entry
+ | SectionLocalAssum of types Univ.in_universe_context_set * polymorphic * bool (** Implicit status *)
+
+type variable_declaration = DirPath.t * section_variable_entry * logical_kind
+
+let cache_variable ((sp,_),o) =
+ match o with
+ | Inl ctx -> Global.push_context_set false ctx
+ | Inr (id,(p,d,mk)) ->
+ (* Constr raisonne sur les noms courts *)
+ if variable_exists id then
+ alreadydeclared (Id.print id ++ str " already exists");
+
+ let impl,opaq,poly,ctx = match d with (* Fails if not well-typed *)
+ | SectionLocalAssum ((ty,ctx),poly,impl) ->
+ let () = Global.push_named_assum ((id,ty,poly),ctx) in
+ let impl = if impl then Implicit else Explicit in
+ impl, true, poly, ctx
+ | SectionLocalDef (de) ->
+ let (de, eff) = Global.export_private_constants ~in_section:true de in
+ let () = List.iter register_side_effect eff in
+ (** The body should already have been forced upstream because it is a
+ section-local definition, but it's not enforced by typing *)
+ let (body, uctx), () = Future.force de.const_entry_body in
+ let poly, univs = match de.const_entry_universes with
+ | Monomorphic_const_entry uctx -> false, uctx
+ | Polymorphic_const_entry uctx -> true, Univ.ContextSet.of_context uctx
+ in
+ let univs = Univ.ContextSet.union uctx univs in
+ (** We must declare the universe constraints before type-checking the
+ term. *)
+ let () = Global.push_context_set (not poly) univs in
+ let se = {
+ secdef_body = body;
+ secdef_secctx = de.const_entry_secctx;
+ secdef_feedback = de.const_entry_feedback;
+ secdef_type = de.const_entry_type;
+ } in
+ let () = Global.push_named_def (id, se) in
+ Explicit, de.const_entry_opaque,
+ poly, univs in
+ Nametab.push (Nametab.Until 1) (restrict_path 0 sp) (VarRef id);
+ add_section_variable id impl poly ctx;
+ Dischargedhypsmap.set_discharged_hyps sp [];
+ add_variable_data id (p,opaq,ctx,poly,mk)
+
+let discharge_variable (_,o) = match o with
+ | Inr (id,_) ->
+ if variable_polymorphic id then None
+ else Some (Inl (variable_context id))
+ | Inl _ -> Some o
+
+type variable_obj =
+ (Univ.ContextSet.t, Id.t * variable_declaration) union
+
+let inVariable : variable_obj -> obj =
+ declare_object { (default_object "VARIABLE") with
+ cache_function = cache_variable;
+ discharge_function = discharge_variable;
+ classify_function = (fun _ -> Dispose) }
+
+(* for initial declaration *)
+let declare_variable id obj =
+ let oname = add_leaf id (inVariable (Inr (id,obj))) in
+ declare_var_implicits id;
+ Notation.declare_ref_arguments_scope (VarRef id);
+ Heads.declare_head (EvalVarRef id);
+ oname
+
(** Declaration of inductive blocks *)
let declare_inductive_argument_scopes kn mie =
@@ -311,9 +321,9 @@ let cache_inductive ((sp,kn),(dhyps,mie)) =
let names = inductive_names sp kn mie in
List.iter check_exists (List.map fst names);
let id = basename sp in
- let _,dir,_ = repr_kn kn in
+ let _,dir,_ = KerName.repr kn in
let kn' = Global.add_mind dir id mie in
- assert (eq_mind kn' (mind_of_kn kn));
+ assert (MutInd.equal kn' (MutInd.make1 kn));
let mind = Global.lookup_mind kn' in
add_section_kn (Declareops.inductive_is_polymorphic mind) kn' mind.mind_hyps;
Dischargedhypsmap.set_discharged_hyps sp dhyps;
@@ -323,7 +333,8 @@ let discharge_inductive ((sp,kn),(dhyps,mie)) =
let mind = Global.mind_of_delta_kn kn in
let mie = Global.lookup_mind mind in
let repl = replacement_context () in
- let sechyps, _, _ as info = section_segment_of_mutual_inductive mind in
+ let info = section_segment_of_mutual_inductive mind in
+ let sechyps = info.Lib.abstr_ctx in
Some (discharged_hyps kn sechyps,
Discharge.process_inductive info repl mie)
@@ -339,9 +350,9 @@ let dummy_one_inductive_entry mie = {
let dummy_inductive_entry (_,m) = ([],{
mind_entry_params = [];
mind_entry_record = None;
- mind_entry_finite = Decl_kinds.BiFinite;
+ mind_entry_finite = Declarations.BiFinite;
mind_entry_inds = List.map dummy_one_inductive_entry m.mind_entry_inds;
- mind_entry_universes = Monomorphic_ind_entry Univ.UContext.empty;
+ mind_entry_universes = Monomorphic_ind_entry Univ.ContextSet.empty;
mind_entry_private = None;
})
@@ -384,7 +395,7 @@ let declare_projections mind =
let kn' = declare_constant id (ProjectionEntry entry,
IsDefinition StructureComponent)
in
- assert(eq_constant kn kn')) kns; true,true
+ assert(Constant.equal kn kn')) kns; true,true
| Some None -> true,false
| None -> false,false
@@ -407,11 +418,11 @@ let pr_rank i = pr_nth (i+1)
let fixpoint_message indexes l =
Flags.if_verbose Feedback.msg_info (match l with
| [] -> anomaly (Pp.str "no recursive definition.")
- | [id] -> pr_id id ++ str " is recursively defined" ++
+ | [id] -> Id.print id ++ str " is recursively defined" ++
(match indexes with
| Some [|i|] -> str " (decreasing on "++pr_rank i++str " argument)"
| _ -> mt ())
- | l -> hov 0 (prlist_with_sep pr_comma pr_id l ++
+ | l -> hov 0 (prlist_with_sep pr_comma Id.print l ++
spc () ++ str "are recursively defined" ++
match indexes with
| Some a -> spc () ++ str "(decreasing respectively on " ++
@@ -422,25 +433,25 @@ let fixpoint_message indexes l =
let cofixpoint_message l =
Flags.if_verbose Feedback.msg_info (match l with
| [] -> anomaly (Pp.str "No corecursive definition.")
- | [id] -> pr_id id ++ str " is corecursively defined"
- | l -> hov 0 (prlist_with_sep pr_comma pr_id l ++
+ | [id] -> Id.print id ++ str " is corecursively defined"
+ | l -> hov 0 (prlist_with_sep pr_comma Id.print l ++
spc () ++ str "are corecursively defined"))
let recursive_message isfix i l =
(if isfix then fixpoint_message i else cofixpoint_message) l
let definition_message id =
- Flags.if_verbose Feedback.msg_info (pr_id id ++ str " is defined")
+ Flags.if_verbose Feedback.msg_info (Id.print id ++ str " is defined")
let assumption_message id =
(* Changing "assumed" to "declared", "assuming" referring more to
the type of the object than to the name of the object (see
discussion on coqdev: "Chapter 4 of the Reference Manual", 8/10/2015) *)
- Flags.if_verbose Feedback.msg_info (pr_id id ++ str " is declared")
+ Flags.if_verbose Feedback.msg_info (Id.print id ++ str " is declared")
(** Global universe names, in a different summary *)
-type universe_context_decl = polymorphic * Univ.universe_context_set
+type universe_context_decl = polymorphic * Univ.ContextSet.t
let cache_universe_context (p, ctx) =
Global.push_context_set p ctx;
@@ -457,28 +468,95 @@ let input_universe_context : universe_context_decl -> Libobject.obj =
let declare_universe_context poly ctx =
Lib.add_anonymous_leaf (input_universe_context (poly, ctx))
-(* Discharged or not *)
-type universe_decl = polymorphic * (Id.t * Univ.universe_level) list
-
-let cache_universes (p, l) =
- let glob = Global.global_universe_names () in
- let glob', ctx =
- List.fold_left (fun ((idl,lid),ctx) (id, lev) ->
- ((Id.Map.add id (p, lev) idl,
- Univ.LMap.add lev id lid),
- Univ.ContextSet.add_universe lev ctx))
- (glob, Univ.ContextSet.empty) l
+(** Global universes are not substitutive objects but global objects
+ bound at the *library* or *module* level. The polymorphic flag is
+ used to distinguish universes declared in polymorphic sections, which
+ are discharged and do not remain in scope. *)
+
+type universe_source =
+ | BoundUniv (* polymorphic universe, bound in a function (this will go away someday) *)
+ | QualifiedUniv of Id.t (* global universe introduced by some global value *)
+ | UnqualifiedUniv (* other global universe *)
+
+type universe_decl = universe_source * Nametab.universe_id
+
+let add_universe src (dp, i) =
+ let level = Univ.Level.make dp i in
+ let optpoly = match src with
+ | BoundUniv -> Some true
+ | UnqualifiedUniv -> Some false
+ | QualifiedUniv _ -> None
in
- cache_universe_context (p, ctx);
- Global.set_global_universe_names glob'
+ Option.iter (fun poly ->
+ let ctx = Univ.ContextSet.add_universe level Univ.ContextSet.empty in
+ Global.push_context_set poly ctx;
+ Universes.add_global_universe level poly;
+ if poly then Lib.add_section_context ctx)
+ optpoly
-let input_universes : universe_decl -> Libobject.obj =
+let check_exists sp =
+ let depth = sections_depth () in
+ let sp = Libnames.make_path (pop_dirpath_n depth (dirpath sp)) (basename sp) in
+ if Nametab.exists_universe sp then
+ alreadydeclared (str "Universe " ++ Id.print (basename sp) ++ str " already exists")
+ else ()
+
+let qualify_univ src (sp,i as orig) =
+ match src with
+ | BoundUniv | UnqualifiedUniv -> orig
+ | QualifiedUniv l ->
+ let sp0, id = Libnames.repr_path sp in
+ let sp0 = DirPath.repr sp0 in
+ Libnames.make_path (DirPath.make (l::sp0)) id, i+1
+
+let cache_universe ((sp, _), (src, id)) =
+ let sp, i = qualify_univ src (sp,1) in
+ let () = check_exists sp in
+ let () = Nametab.push_universe (Nametab.Until i) sp id in
+ add_universe src id
+
+let load_universe i ((sp, _), (src, id)) =
+ let sp, i = qualify_univ src (sp,i) in
+ let () = Nametab.push_universe (Nametab.Until i) sp id in
+ add_universe src id
+
+let open_universe i ((sp, _), (src, id)) =
+ let sp, i = qualify_univ src (sp,i) in
+ let () = Nametab.push_universe (Nametab.Exactly i) sp id in
+ ()
+
+let discharge_universe = function
+ | _, (BoundUniv, _) -> None
+ | _, ((QualifiedUniv _ | UnqualifiedUniv), _ as x) -> Some x
+
+let input_universe : universe_decl -> Libobject.obj =
declare_object
{ (default_object "Global universe name state") with
- cache_function = (fun (na, pi) -> cache_universes pi);
- load_function = (fun _ (_, pi) -> cache_universes pi);
- discharge_function = (fun (_, (p, _ as x)) -> if p then None else Some x);
- classify_function = (fun a -> Keep a) }
+ cache_function = cache_universe;
+ load_function = load_universe;
+ open_function = open_universe;
+ discharge_function = discharge_universe;
+ subst_function = (fun (subst, a) -> (** Actually the name is generated once and for all. *) a);
+ classify_function = (fun a -> Substitute a) }
+
+let declare_univ_binders gr pl =
+ if Global.is_polymorphic gr then
+ Universes.register_universe_binders gr pl
+ else
+ let l = match gr with
+ | ConstRef c -> Label.to_id @@ Constant.label c
+ | IndRef (c, _) -> Label.to_id @@ MutInd.label c
+ | VarRef id -> id
+ | ConstructRef _ ->
+ anomaly ~label:"declare_univ_binders"
+ Pp.(str "declare_univ_binders on an constructor reference")
+ in
+ Id.Map.iter (fun id lvl ->
+ match Univ.Level.name lvl with
+ | None -> ()
+ | Some na ->
+ ignore (Lib.add_leaf id (input_universe (QualifiedUniv l, na))))
+ pl
let do_universe poly l =
let in_section = Lib.sections_are_opened () in
@@ -489,12 +567,15 @@ let do_universe poly l =
in
let l =
List.map (fun (l, id) ->
- let lev = Universes.new_univ_level (Global.current_dirpath ()) in
- (id, lev)) l
+ let lev = Universes.new_univ_id () in
+ (id, lev)) l
in
- Lib.add_anonymous_leaf (input_universes (poly, l))
+ let src = if poly then BoundUniv else UnqualifiedUniv in
+ List.iter (fun (id,lev) ->
+ ignore(Lib.add_leaf id (input_universe (src, lev))))
+ l
-type constraint_decl = polymorphic * Univ.constraints
+type constraint_decl = polymorphic * Univ.Constraint.t
let cache_constraints (na, (p, c)) =
let ctx =
@@ -514,20 +595,15 @@ let input_constraints : constraint_decl -> Libobject.obj =
discharge_function = discharge_constraints;
classify_function = (fun a -> Keep a) }
+let loc_of_glob_level = function
+ | Misctypes.GType (Misctypes.UNamed n) -> Libnames.loc_of_reference n
+ | _ -> None
+
let do_constraint poly l =
- let open Misctypes in
let u_of_id x =
- match x with
- | GProp -> Loc.tag (false, Univ.Level.prop)
- | GSet -> Loc.tag (false, Univ.Level.set)
- | GType None | GType (Some (_, Anonymous)) ->
- user_err ~hdr:"Constraint"
- (str "Cannot declare constraints on anonymous universes")
- | GType (Some (loc, Name id)) ->
- let names, _ = Global.global_universe_names () in
- try loc, Id.Map.find id names
- with Not_found ->
- user_err ?loc ~hdr:"Constraint" (str "Undeclared universe " ++ pr_id id)
+ let level = Pretyping.interp_known_glob_level (Evd.from_env (Global.env ())) x in
+ let loc = loc_of_glob_level x in
+ loc, Universes.is_polymorphic level, level
in
let in_section = Lib.sections_are_opened () in
let () =
@@ -545,7 +621,7 @@ let do_constraint poly l =
++ str "Polymorphic Constraint instead")
in
let constraints = List.fold_left (fun acc (l, d, r) ->
- let ploc, (p, lu) = u_of_id l and rloc, (p', ru) = u_of_id r in
+ let ploc, p, lu = u_of_id l and rloc, p', ru = u_of_id r in
check_poly ?loc:ploc p rloc p';
Univ.Constraint.add (lu, d, ru) acc)
Univ.Constraint.empty l
diff --git a/interp/declare.mli b/interp/declare.mli
index ccd7d28bb..f368d164e 100644
--- a/interp/declare.mli
+++ b/interp/declare.mli
@@ -8,7 +8,7 @@
open Names
open Libnames
-open Term
+open Constr
open Entries
open Decl_kinds
@@ -42,7 +42,7 @@ type internal_flag =
(* Defaut definition entries, transparent with no secctx or proj information *)
val definition_entry : ?fix_exn:Future.fix_exn ->
?opaque:bool -> ?inline:bool -> ?types:types ->
- ?poly:polymorphic -> ?univs:Univ.universe_context ->
+ ?univs:Entries.constant_universes_entry ->
?eff:Safe_typing.private_constants -> constr -> Safe_typing.private_constants definition_entry
(** [declare_constant id cd] declares a global declaration
@@ -52,17 +52,17 @@ val definition_entry : ?fix_exn:Future.fix_exn ->
internal specify if the constant has been created by the kernel or by the
user, and in the former case, if its errors should be silent *)
val declare_constant :
- ?internal:internal_flag -> ?local:bool -> Id.t -> ?export_seff:bool -> constant_declaration -> constant
+ ?internal:internal_flag -> ?local:bool -> Id.t -> ?export_seff:bool -> constant_declaration -> Constant.t
val declare_definition :
?internal:internal_flag -> ?opaque:bool -> ?kind:definition_object_kind ->
- ?local:bool -> ?poly:polymorphic -> Id.t -> ?types:constr ->
- constr Univ.in_universe_context_set -> constant
+ ?local:bool -> Id.t -> ?types:constr ->
+ constr Entries.in_constant_universes_entry -> Constant.t
(** Since transparent constants' side effects are globally declared, we
* need that *)
val set_declare_scheme :
- (string -> (inductive * constant) array -> unit) -> unit
+ (string -> (inductive * Constant.t) array -> unit) -> unit
(** [declare_mind me] declares a block of inductive types with
their constructors in the current section; it returns the path of
@@ -80,13 +80,11 @@ val recursive_message : bool (** true = fixpoint *) ->
val exists_name : Id.t -> bool
-
-
(** Global universe contexts, names and constraints *)
+val declare_univ_binders : Globnames.global_reference -> Universes.universe_binders -> unit
-val declare_universe_context : polymorphic -> Univ.universe_context_set -> unit
+val declare_universe_context : polymorphic -> Univ.ContextSet.t -> unit
val do_universe : polymorphic -> Id.t Loc.located list -> unit
-val do_constraint : polymorphic ->
- (Misctypes.glob_level * Univ.constraint_type * Misctypes.glob_level) list ->
- unit
+val do_constraint : polymorphic -> (Misctypes.glob_level * Univ.constraint_type * Misctypes.glob_level) list ->
+ unit
diff --git a/interp/discharge.ml b/interp/discharge.ml
index 0e4bbd299..75bfca307 100644
--- a/interp/discharge.ml
+++ b/interp/discharge.ml
@@ -10,6 +10,7 @@ open Names
open CErrors
open Util
open Term
+open Constr
open Vars
open Declarations
open Cooking
@@ -77,8 +78,8 @@ let refresh_polymorphic_type_of_inductive (_,mip) =
let ctx = List.rev mip.mind_arity_ctxt in
mkArity (List.rev ctx, Type ar.template_level), true
-let process_inductive (section_decls,_,_ as info) modlist mib =
- let section_decls = Lib.named_of_variable_context section_decls in
+let process_inductive info modlist mib =
+ let section_decls = Lib.named_of_variable_context info.Lib.abstr_ctx in
let nparamdecls = Context.Rel.length mib.mind_params_ctxt in
let subst, ind_univs =
match mib.mind_universes with
diff --git a/interp/dumpglob.ml b/interp/dumpglob.ml
index 561b0078a..d7962e29a 100644
--- a/interp/dumpglob.ml
+++ b/interp/dumpglob.ml
@@ -68,11 +68,12 @@ let pause () = previous_state := !glob_output; glob_output := NoGlob
let continue () = glob_output := !previous_state
open Decl_kinds
+open Declarations
let type_of_logical_kind = function
| IsDefinition def ->
(match def with
- | Definition -> "def"
+ | Definition | Let -> "def"
| Coercion -> "coe"
| SubClass -> "subclass"
| CanonicalStructure -> "canonstruc"
@@ -111,14 +112,12 @@ let type_of_global_ref gr =
| Globnames.IndRef ind ->
let (mib,oib) = Inductive.lookup_mind_specif (Global.env ()) ind in
if mib.Declarations.mind_record <> None then
- let open Decl_kinds in
begin match mib.Declarations.mind_finite with
| Finite -> "indrec"
| BiFinite -> "rec"
| CoFinite -> "corec"
end
else
- let open Decl_kinds in
begin match mib.Declarations.mind_finite with
| Finite -> "ind"
| BiFinite -> "variant"
@@ -231,7 +230,7 @@ let add_glob ?loc ref =
add_glob_gen ?loc sp lib_dp ty
let mp_of_kn kn =
- let mp,sec,l = Names.repr_kn kn in
+ let mp,sec,l = Names.KerName.repr kn in
Names.MPdot (mp,l)
let add_glob_kn ?loc kn =
diff --git a/interp/dumpglob.mli b/interp/dumpglob.mli
index afcd7a2ed..f3ad50f28 100644
--- a/interp/dumpglob.mli
+++ b/interp/dumpglob.mli
@@ -23,11 +23,11 @@ val pause : unit -> unit
val continue : unit -> unit
val add_glob : ?loc:Loc.t -> Globnames.global_reference -> unit
-val add_glob_kn : ?loc:Loc.t -> Names.kernel_name -> unit
+val add_glob_kn : ?loc:Loc.t -> Names.KerName.t -> unit
val dump_definition : Names.Id.t Loc.located -> bool -> string -> unit
-val dump_moddef : ?loc:Loc.t -> Names.module_path -> string -> unit
-val dump_modref : ?loc:Loc.t -> Names.module_path -> string -> unit
+val dump_moddef : ?loc:Loc.t -> Names.ModPath.t -> string -> unit
+val dump_modref : ?loc:Loc.t -> Names.ModPath.t -> string -> unit
val dump_reference : ?loc:Loc.t -> string -> string -> string -> unit
val dump_libref : ?loc:Loc.t -> Names.DirPath.t -> string -> unit
val dump_notation_location : (int * int) list -> Constrexpr.notation ->
diff --git a/interp/impargs.ml b/interp/impargs.ml
index 09a0ba83c..ed1cd5276 100644
--- a/interp/impargs.ml
+++ b/interp/impargs.ml
@@ -10,8 +10,7 @@ open CErrors
open Util
open Names
open Globnames
-open Nameops
-open Term
+open Constr
open Reduction
open Declarations
open Environ
@@ -167,7 +166,7 @@ let update pos rig (na,st) =
(* modified is_rigid_reference with a truncated env *)
let is_flexible_reference env bound depth f =
- match kind_of_term f with
+ match kind f with
| Rel n when n >= bound+depth -> (* inductive type *) false
| Rel n when n >= depth -> (* previous argument *) true
| Rel n -> (* since local definitions have been expanded *) false
@@ -191,7 +190,7 @@ let add_free_rels_until strict strongly_strict revpat bound env m pos acc =
let rec frec rig (env,depth as ed) c =
let hd = if strict then whd_all env c else c in
let c = if strongly_strict then hd else c in
- match kind_of_term hd with
+ match kind hd with
| Rel n when (n < bound+depth) && (n >= depth) ->
let i = bound + depth - n - 1 in
acc.(i) <- update pos rig acc.(i)
@@ -214,13 +213,13 @@ let add_free_rels_until strict strongly_strict revpat bound env m pos acc =
let () = if not (Vars.noccur_between 1 bound m) then frec true (env,1) m in
acc
-let rec is_rigid_head t = match kind_of_term t with
+let rec is_rigid_head t = match kind t with
| Rel _ | Evar _ -> false
| Ind _ | Const _ | Var _ | Sort _ -> true
| Case (_,_,f,_) -> is_rigid_head f
| Proj (p,c) -> true
| App (f,args) ->
- (match kind_of_term f with
+ (match kind f with
| Fix ((fi,i),_) -> is_rigid_head (args.(fi.(i)))
| _ -> is_rigid_head f)
| Lambda _ | LetIn _ | Construct _ | CoFix _ | Fix _
@@ -240,7 +239,7 @@ let compute_implicits_gen strict strongly_strict revpat contextual all env t =
let open Context.Rel.Declaration in
let rec aux env avoid n names t =
let t = whd_all env t in
- match kind_of_term t with
+ match kind t with
| Prod (na,a,b) ->
let na',avoid' = find_displayed_name_in all avoid na (names,b) in
add_free_rels_until strict strongly_strict revpat n env a (Hyp (n+1))
@@ -253,7 +252,7 @@ let compute_implicits_gen strict strongly_strict revpat contextual all env t =
add_free_rels_until strict strongly_strict revpat n env t Conclusion v
else v
in
- match kind_of_term (whd_all env t) with
+ match kind (whd_all env t) with
| Prod (na,a,b) ->
let na',avoid = find_displayed_name_in all Id.Set.empty na ([],b) in
let v = aux (push_rel (LocalAssum (na',a)) env) avoid 1 [na'] b in
@@ -343,7 +342,7 @@ let check_correct_manual_implicits autoimps l =
| ExplByName id,(b,fi,forced) ->
if not forced then
user_err
- (str "Wrong or non-dependent implicit argument name: " ++ pr_id id ++ str ".")
+ (str "Wrong or non-dependent implicit argument name: " ++ Id.print id ++ str ".")
| ExplByPos (i,_id),_t ->
if i<1 || i>List.length autoimps then
user_err
@@ -483,8 +482,8 @@ type implicit_interactive_request =
type implicit_discharge_request =
| ImplLocal
- | ImplConstant of constant * implicits_flags
- | ImplMutualInductive of mutual_inductive * implicits_flags
+ | ImplConstant of Constant.t * implicits_flags
+ | ImplMutualInductive of MutInd.t * implicits_flags
| ImplInteractive of global_reference * implicits_flags *
implicit_interactive_request
@@ -549,7 +548,7 @@ let discharge_implicits (_,(req,l)) =
| ImplConstant (con,flags) ->
(try
let con' = pop_con con in
- let vars,_,_ = section_segment_of_constant con in
+ let vars = variable_section_segment_of_reference (ConstRef con) in
let extra_impls = impls_of_context vars in
let newimpls = List.map (add_section_impls vars extra_impls) (snd (List.hd l)) in
let l' = [ConstRef con',newimpls] in
diff --git a/interp/impargs.mli b/interp/impargs.mli
index 4b78f54ea..40fa4cb26 100644
--- a/interp/impargs.mli
+++ b/interp/impargs.mli
@@ -7,8 +7,8 @@
(************************************************************************)
open Names
+open Constr
open Globnames
-open Term
open Environ
(** {6 Implicit Arguments } *)
@@ -98,8 +98,8 @@ val compute_implicits_names : env -> types -> Name.t list
(** {6 Computation of implicits (done using the global environment). } *)
val declare_var_implicits : variable -> unit
-val declare_constant_implicits : constant -> unit
-val declare_mib_implicits : mutual_inductive -> unit
+val declare_constant_implicits : Constant.t -> unit
+val declare_mib_implicits : MutInd.t -> unit
val declare_implicits : bool -> global_reference -> unit
diff --git a/interp/implicit_quantifiers.ml b/interp/implicit_quantifiers.ml
index cae67c3e7..519f2480b 100644
--- a/interp/implicit_quantifiers.ml
+++ b/interp/implicit_quantifiers.ml
@@ -29,11 +29,11 @@ let generalizable_table = Summary.ref Id.Pred.empty ~name:"generalizable-ident"
let declare_generalizable_ident table (loc,id) =
if not (Id.equal id (root_of_id id)) then
user_err ?loc ~hdr:"declare_generalizable_ident"
- ((pr_id id ++ str
+ ((Id.print id ++ str
" is not declarable as generalizable identifier: it must have no trailing digits, quote, or _"));
if Id.Pred.mem id table then
user_err ?loc ~hdr:"declare_generalizable_ident"
- ((pr_id id++str" is already declared as a generalizable identifier"))
+ ((Id.print id++str" is already declared as a generalizable identifier"))
else Id.Pred.add id table
let add_generalizable gen table =
@@ -80,7 +80,7 @@ let is_freevar ids env x =
let ungeneralizable loc id =
user_err ?loc ~hdr:"Generalization"
- (str "Unbound and ungeneralizable variable " ++ pr_id id)
+ (str "Unbound and ungeneralizable variable " ++ Id.print id)
let free_vars_of_constr_expr c ?(bound=Id.Set.empty) l =
let found loc id bdvars l =
@@ -94,8 +94,8 @@ let free_vars_of_constr_expr c ?(bound=Id.Set.empty) l =
let rec aux bdvars l c = match CAst.(c.v) with
| CRef (Ident (loc,id),_) -> found loc id bdvars l
| CNotation ("{ _ : _ | _ }", ({ CAst.v = CRef (Ident (_, id),_) } :: _, [], [])) when not (Id.Set.mem id bdvars) ->
- Topconstr.fold_constr_expr_with_binders (fun a l -> Id.Set.add a l) aux (Id.Set.add id bdvars) l c
- | _ -> Topconstr.fold_constr_expr_with_binders (fun a l -> Id.Set.add a l) aux bdvars l c
+ Constrexpr_ops.fold_constr_expr_with_binders (fun a l -> Id.Set.add a l) aux (Id.Set.add id bdvars) l c
+ | _ -> Constrexpr_ops.fold_constr_expr_with_binders (fun a l -> Id.Set.add a l) aux bdvars l c
in aux bound l c
let ids_of_names l =
@@ -152,7 +152,7 @@ let combine_params avoid fn applied needed =
| Anonymous -> false
in
if not (List.exists is_id needed) then
- user_err ?loc (str "Wrong argument name: " ++ Nameops.pr_id id);
+ user_err ?loc (str "Wrong argument name: " ++ Id.print id);
true
| _ -> false) applied
in
diff --git a/interp/implicit_quantifiers.mli b/interp/implicit_quantifiers.mli
index f7c36c4e5..bfe73160b 100644
--- a/interp/implicit_quantifiers.mli
+++ b/interp/implicit_quantifiers.mli
@@ -38,10 +38,10 @@ val make_fresh : Id.Set.t -> Environ.env -> Id.t -> Id.t
val implicits_of_glob_constr : ?with_products:bool -> Glob_term.glob_constr -> Impargs.manual_implicits
val combine_params_freevar :
- Id.Set.t -> (global_reference * bool) option * Context.Rel.Declaration.t ->
+ Id.Set.t -> global_reference option * Context.Rel.Declaration.t ->
Constrexpr.constr_expr * Id.Set.t
val implicit_application : Id.Set.t -> ?allow_partial:bool ->
- (Id.Set.t -> (global_reference * bool) option * Context.Rel.Declaration.t ->
+ (Id.Set.t -> global_reference option * Context.Rel.Declaration.t ->
Constrexpr.constr_expr * Id.Set.t) ->
constr_expr -> constr_expr * Id.Set.t
diff --git a/interp/interp.mllib b/interp/interp.mllib
index 6d290a325..bb22cf468 100644
--- a/interp/interp.mllib
+++ b/interp/interp.mllib
@@ -1,12 +1,13 @@
+Tactypes
Stdarg
Genintern
-Constrexpr_ops
Notation_ops
-Ppextend
Notation
-Dumpglob
Syntax_def
Smartlocate
+Constrexpr_ops
+Ppextend
+Dumpglob
Topconstr
Reserve
Impargs
diff --git a/interp/modintern.ml b/interp/modintern.ml
index 08657936e..3eb91d8cd 100644
--- a/interp/modintern.ml
+++ b/interp/modintern.ml
@@ -62,7 +62,7 @@ let transl_with_decl env = function
WithMod (fqid,lookup_module qid)
| CWith_Definition ((_,fqid),c) ->
let c, ectx = interp_constr env (Evd.from_env env) c in
- let ctx = Evd.evar_context_universe_context ectx in
+ let ctx = UState.context ectx in
WithDef (fqid,(c,ctx))
let loc_of_module l = l.CAst.loc
diff --git a/interp/notation.ml b/interp/notation.ml
index d3cac1e3e..94ce2a6c8 100644
--- a/interp/notation.ml
+++ b/interp/notation.ml
@@ -11,7 +11,7 @@ open CErrors
open Util
open Pp
open Names
-open Term
+open Constr
open Libnames
open Globnames
open Constrexpr
@@ -234,7 +234,7 @@ let find_delimiters_scope ?loc key =
type interp_rule =
| NotationRule of scope_name option * notation
- | SynDefRule of kernel_name
+ | SynDefRule of KerName.t
(* We define keys for glob_constr and aconstr to split the syntax entries
according to the key of the pattern (adapted from Chet Murthy by HH) *)
@@ -526,15 +526,38 @@ let interp_notation ?loc ntn local_scopes =
user_err ?loc
(str "Unknown interpretation for notation \"" ++ str ntn ++ str "\".")
-let uninterp_notations c =
- List.map_append (fun key -> keymap_find key !notations_key_table)
- (glob_constr_keys c)
-
-let uninterp_cases_pattern_notations c =
- keymap_find (cases_pattern_key c) !notations_key_table
-
-let uninterp_ind_pattern_notations ind =
- keymap_find (RefKey (canonical_gr (IndRef ind))) !notations_key_table
+let sort_notations scopes l =
+ let extract_scope l = function
+ | Scope sc -> List.partitioni (fun _i x ->
+ match x with
+ | NotationRule (Some sc',_),_,_ -> String.equal sc sc'
+ | _ -> false) l
+ | SingleNotation ntn -> List.partitioni (fun _i x ->
+ match x with
+ | NotationRule (None,ntn'),_,_ -> String.equal ntn ntn'
+ | _ -> false) l in
+ let rec aux l scopes =
+ if l == [] then [] (* shortcut *) else
+ match scopes with
+ | sc :: scopes -> let ntn_in_sc,l = extract_scope l sc in ntn_in_sc @ aux l scopes
+ | [] -> l in
+ aux l scopes
+
+let uninterp_notations scopes c =
+ let scopes = make_current_scopes scopes in
+ let keys = glob_constr_keys c in
+ let maps = List.map_append (fun key -> keymap_find key !notations_key_table) keys in
+ sort_notations scopes maps
+
+let uninterp_cases_pattern_notations scopes c =
+ let scopes = make_current_scopes scopes in
+ let maps = keymap_find (cases_pattern_key c) !notations_key_table in
+ sort_notations scopes maps
+
+let uninterp_ind_pattern_notations scopes ind =
+ let scopes = make_current_scopes scopes in
+ let maps = keymap_find (RefKey (canonical_gr (IndRef ind))) !notations_key_table in
+ sort_notations scopes maps
let availability_of_notation (ntn_scope,ntn) scopes =
let f scope =
@@ -653,7 +676,7 @@ let find_scope_class_opt = function
(* Special scopes associated to arguments of a global reference *)
let rec compute_arguments_classes t =
- match kind_of_term (EConstr.Unsafe.to_constr (Reductionops.whd_betaiotazeta Evd.empty (EConstr.of_constr t))) with
+ match Constr.kind (EConstr.Unsafe.to_constr (Reductionops.whd_betaiotazeta Evd.empty (EConstr.of_constr t))) with
| Prod (_,t,u) ->
let cl = try Some (compute_scope_class t) with Not_found -> None in
cl :: compute_arguments_classes u
diff --git a/interp/notation.mli b/interp/notation.mli
index 75c8d5aa5..7d055571c 100644
--- a/interp/notation.mli
+++ b/interp/notation.mli
@@ -110,7 +110,7 @@ val availability_of_prim_token :
(** Binds a notation in a given scope to an interpretation *)
type interp_rule =
| NotationRule of scope_name option * notation
- | SynDefRule of kernel_name
+ | SynDefRule of KerName.t
val declare_notation_interpretation : notation -> scope_name option ->
interpretation -> notation_location -> onlyprint:bool -> unit
@@ -124,9 +124,9 @@ val interp_notation : ?loc:Loc.t -> notation -> local_scopes ->
type notation_rule = interp_rule * interpretation * int option
(** Return the possible notations for a given term *)
-val uninterp_notations : 'a glob_constr_g -> notation_rule list
-val uninterp_cases_pattern_notations : 'a cases_pattern_g -> notation_rule list
-val uninterp_ind_pattern_notations : inductive -> notation_rule list
+val uninterp_notations : local_scopes -> 'a glob_constr_g -> notation_rule list
+val uninterp_cases_pattern_notations : local_scopes -> 'a cases_pattern_g -> notation_rule list
+val uninterp_ind_pattern_notations : local_scopes -> inductive -> notation_rule list
(** Test if a notation is available in the scopes
context [scopes]; if available, the result is not None; the first
@@ -165,8 +165,8 @@ val subst_scope_class :
val declare_scope_class : scope_name -> scope_class -> unit
val declare_ref_arguments_scope : global_reference -> unit
-val compute_arguments_scope : Term.types -> scope_name option list
-val compute_type_scope : Term.types -> scope_name option
+val compute_arguments_scope : Constr.types -> scope_name option list
+val compute_type_scope : Constr.types -> scope_name option
(** Get the current scope bound to Sortclass, if it exists *)
val current_type_scope_name : unit -> scope_name option
diff --git a/interp/notation_ops.ml b/interp/notation_ops.ml
index 0967d21f0..326d05cba 100644
--- a/interp/notation_ops.ml
+++ b/interp/notation_ops.ml
@@ -86,9 +86,11 @@ let rec eq_notation_constr (vars1,vars2 as vars) t1 t2 = match t1, t2 with
Miscops.glob_sort_eq s1 s2
| NCast (t1, c1), NCast (t2, c2) ->
(eq_notation_constr vars) t1 t2 && cast_type_eq (eq_notation_constr vars) c1 c2
+| NProj (p1, c1), NProj (p2, c2) ->
+ Projection.equal p1 p2 && eq_notation_constr vars c1 c2
| (NRef _ | NVar _ | NApp _ | NHole _ | NList _ | NLambda _ | NProd _
| NBinderList _ | NLetIn _ | NCases _ | NLetTuple _ | NIf _
- | NRec _ | NSort _ | NCast _), _ -> false
+ | NRec _ | NSort _ | NCast _ | NProj _), _ -> false
(**********************************************************************)
(* Re-interpret a notation as a glob_constr, taking care of binders *)
@@ -189,6 +191,7 @@ let glob_constr_of_notation_constr_with_binders ?loc g f e nc =
| NSort x -> GSort x
| NHole (x, naming, arg) -> GHole (x, naming, arg)
| NRef x -> GRef (x,None)
+ | NProj (p,c) -> GProj (p, f e c)
let glob_constr_of_notation_constr ?loc x =
let rec aux () x =
@@ -239,7 +242,7 @@ let subtract_loc loc1 loc2 =
let check_is_hole id t = match DAst.get t with GHole _ -> () | _ ->
user_err ?loc:(loc_of_glob_constr t)
- (strbrk "In recursive notation with binders, " ++ pr_id id ++
+ (strbrk "In recursive notation with binders, " ++ Id.print id ++
strbrk " is expected to come without type.")
let pair_equal eq1 eq2 (a,b) (a',b') = eq1 a a' && eq2 b b'
@@ -383,6 +386,7 @@ let notation_constr_and_vars_of_glob_constr a =
if arg != None then has_ltac := true;
NHole (w, naming, arg)
| GRef (r,_) -> NRef r
+ | GProj (p, c) -> NProj (p, aux c)
| GEvar _ | GPatVar _ ->
user_err Pp.(str "Existential variables not allowed in notations.")
) x
@@ -400,7 +404,7 @@ let check_variables_and_reversibility nenv (found,foundrec,foundrecbinding) =
let vars = Id.Map.filter filter nenv.ninterp_var_type in
let check_recvar x =
if Id.List.mem x found then
- user_err (pr_id x ++
+ user_err (Id.print x ++
strbrk " should only be used in the recursive part of a pattern.") in
let check (x, y) = check_recvar x; check_recvar y in
let () = List.iter check foundrec in
@@ -419,8 +423,8 @@ let check_variables_and_reversibility nenv (found,foundrec,foundrecbinding) =
in
let check_pair s x y where =
if not (List.mem_f (pair_equal Id.equal Id.equal) (x,y) where) then
- user_err (strbrk "in the right-hand side, " ++ pr_id x ++
- str " and " ++ pr_id y ++ strbrk " should appear in " ++ str s ++
+ user_err (strbrk "in the right-hand side, " ++ Id.print x ++
+ str " and " ++ Id.print y ++ strbrk " should appear in " ++ str s ++
str " position as part of a recursive pattern.") in
let check_type x typ =
match typ with
@@ -576,6 +580,14 @@ let rec subst_notation_constr subst bound raw =
let k' = Miscops.smartmap_cast_type (subst_notation_constr subst bound) k in
if r1' == r1 && k' == k then raw else NCast(r1',k')
+ | NProj (p, c) ->
+ let kn = Projection.constant p in
+ let b = Projection.unfolded p in
+ let kn' = subst_constant subst kn in
+ let c' = subst_notation_constr subst bound c in
+ if kn' == kn && c' == c then raw else NProj(Projection.make kn' b, c')
+
+
let subst_interpretation subst (metas,pat) =
let bound = List.fold_left (fun accu (id, _) -> Id.Set.add id accu) Id.Set.empty metas in
(metas,subst_notation_constr subst bound pat)
@@ -838,7 +850,7 @@ let bind_bindinglist_as_term_env alp (terms,onlybinders,termlists,binderlists) v
| Name id' ->
if Id.equal (rename_var (snd alp) id) id' then na' else raise No_match in
let unify_pat p p' =
- if cases_pattern_eq (map_cases_pattern_name_left (name_app (rename_var (snd alp))) p) p' then p'
+ if cases_pattern_eq (map_cases_pattern_name_left (Name.map (rename_var (snd alp))) p) p' then p'
else raise No_match in
let unify_term_binder c = DAst.(map (fun b' ->
match DAst.get c, b' with
@@ -980,6 +992,19 @@ let match_termlist match_fun alp metas sigma rest x y iter termin lassoc =
else
bind_termlist_env alp sigma x l
+let match_cast match_fun sigma c1 c2 =
+ match c1, c2 with
+ | CastConv t1, CastConv t2
+ | CastVM t1, CastVM t2
+ | CastNative t1, CastNative t2 ->
+ match_fun sigma t1 t2
+ | CastCoerce, CastCoerce ->
+ sigma
+ | CastConv _, _
+ | CastVM _, _
+ | CastNative _, _
+ | CastCoerce, _ -> raise No_match
+
let does_not_come_from_already_eta_expanded_var glob =
(* This is hack to avoid looping on a rule with rhs of the form *)
(* "?f (fun ?x => ?g)" since otherwise, matching "F H" expands in *)
@@ -1125,11 +1150,8 @@ let rec match_ inner u alp metas sigma a1 a2 =
let alp,sigma = Array.fold_right2 (fun id1 id2 alsig ->
match_names metas alsig (Name id1) (Name id2)) idl1 idl2 (alp,sigma) in
Array.fold_left2 (match_in u alp metas) sigma bl1 bl2
- | GCast(c1,CastConv t1), NCast (c2,CastConv t2)
- | GCast(c1,CastVM t1), NCast (c2,CastVM t2) ->
- match_in u alp metas (match_in u alp metas sigma c1 c2) t1 t2
- | GCast(c1, CastCoerce), NCast(c2, CastCoerce) ->
- match_in u alp metas sigma c1 c2
+ | GCast(t1, c1), NCast(t2, c2) ->
+ match_cast (match_in u alp metas) (match_in u alp metas sigma t1 t2) c1 c2
| GSort (GType _), NSort (GType _) when not u -> sigma
| GSort s1, NSort s2 when Miscops.glob_sort_eq s1 s2 -> sigma
| GPatVar _, NHole _ -> (*Don't hide Metas, they bind in ltac*) raise No_match
@@ -1157,8 +1179,12 @@ let rec match_ inner u alp metas sigma a1 a2 =
match_names metas (alp,sigma) (Name id') na in
match_in u alp metas sigma (mkGApp a1 (DAst.make @@ GVar id')) b2
- | (GRec _ | GEvar _), _
- | _,_ -> raise No_match
+ | GProj(p1, t1), NProj(p2, t2) when Projection.equal p1 p2 ->
+ match_in u alp metas sigma t1 t2
+
+ | (GRef _ | GVar _ | GEvar _ | GPatVar _ | GApp _ | GLambda _ | GProd _
+ | GLetIn _ | GCases _ | GLetTuple _ | GIf _ | GRec _ | GSort _ | GHole _
+ | GCast _ | GProj _ ), _ -> raise No_match
and match_in u = match_ true u
diff --git a/interp/reserve.ml b/interp/reserve.ml
index dc0f60dcf..22c5a2f5e 100644
--- a/interp/reserve.ml
+++ b/interp/reserve.ml
@@ -87,12 +87,12 @@ let in_reserved : Id.t * notation_constr -> obj =
let declare_reserved_type_binding (loc,id) t =
if not (Id.equal id (root_of_id id)) then
user_err ?loc ~hdr:"declare_reserved_type"
- ((pr_id id ++ str
+ ((Id.print id ++ str
" is not reservable: it must have no trailing digits, quote, or _"));
begin try
let _ = Id.Map.find id !reserve_table in
user_err ?loc ~hdr:"declare_reserved_type"
- ((pr_id id++str" is already bound to a type"))
+ ((Id.print id++str" is already bound to a type"))
with Not_found -> () end;
add_anonymous_leaf (in_reserved (id,t))
@@ -102,7 +102,7 @@ let declare_reserved_type idl t =
let find_reserved_type id = Id.Map.find (root_of_id id) !reserve_table
let constr_key c =
- try RefKey (canonical_gr (global_of_constr (fst (Term.decompose_app c))))
+ try RefKey (canonical_gr (global_of_constr (fst (Constr.decompose_app c))))
with Not_found -> Oth
let revert_reserved_type t =
diff --git a/interp/syntax_def.ml b/interp/syntax_def.ml
index 84c6f4ef3..98e507309 100644
--- a/interp/syntax_def.ml
+++ b/interp/syntax_def.ml
@@ -6,16 +6,15 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-open CErrors
open Util
open Pp
+open CErrors
open Names
open Libnames
-open Notation_term
open Libobject
open Lib
-open Nameops
open Nametab
+open Notation_term
(* Syntactic definitions. *)
@@ -31,7 +30,7 @@ let add_syntax_constant kn c onlyparse =
let load_syntax_constant i ((sp,kn),(_,pat,onlyparse)) =
if Nametab.exists_cci sp then
user_err ~hdr:"cache_syntax_constant"
- (pr_id (basename sp) ++ str " already exists");
+ (Id.print (basename sp) ++ str " already exists");
add_syntax_constant kn pat onlyparse;
Nametab.push_syndef (Nametab.Until i) sp kn
diff --git a/interp/syntax_def.mli b/interp/syntax_def.mli
index 36a3986b5..4d2cb5b74 100644
--- a/interp/syntax_def.mli
+++ b/interp/syntax_def.mli
@@ -16,4 +16,4 @@ type syndef_interpretation = (Id.t * subscopes) list * notation_constr
val declare_syntactic_definition : bool -> Id.t ->
Flags.compat_version option -> syndef_interpretation -> unit
-val search_syntactic_definition : kernel_name -> syndef_interpretation
+val search_syntactic_definition : KerName.t -> syndef_interpretation
diff --git a/intf/tactypes.ml b/interp/tactypes.ml
index 2c42e1311..2c42e1311 100644
--- a/intf/tactypes.ml
+++ b/interp/tactypes.ml
diff --git a/interp/topconstr.ml b/interp/topconstr.ml
index 7a3c83ff9..ecfb766ff 100644
--- a/interp/topconstr.ml
+++ b/interp/topconstr.ml
@@ -6,294 +6,16 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-(*i*)
-open Pp
-open CErrors
-open Util
-open Names
-open Nameops
-open Libnames
-open Misctypes
-open Constrexpr
open Constrexpr_ops
-(*i*)
-
-let asymmetric_patterns = ref (false)
-let _ = Goptions.declare_bool_option {
- Goptions.optdepr = false;
- Goptions.optname = "no parameters in constructors";
- Goptions.optkey = ["Asymmetric";"Patterns"];
- Goptions.optread = (fun () -> !asymmetric_patterns);
- Goptions.optwrite = (fun a -> asymmetric_patterns:=a);
-}
-
-(**********************************************************************)
-(* Miscellaneous *)
-
-let error_invalid_pattern_notation ?loc () =
- user_err ?loc (str "Invalid notation for pattern.")
-
-(* Legacy functions *)
-let down_located f (_l, x) = f x
-let located_fold_left f x (_l, y) = f x y
-
-(**********************************************************************)
-(* Functions on constr_expr *)
-
-let is_constructor id =
- try Globnames.isConstructRef
- (Smartlocate.global_of_extended_global
- (Nametab.locate_extended (qualid_of_ident id)))
- with Not_found -> false
-
-let rec cases_pattern_fold_names f a pt = match CAst.(pt.v) with
- | CPatRecord l ->
- List.fold_left (fun acc (r, cp) -> cases_pattern_fold_names f acc cp) a l
- | CPatAlias (pat,id) -> f id a
- | CPatOr (patl) ->
- List.fold_left (cases_pattern_fold_names f) a patl
- | CPatCstr (_,patl1,patl2) ->
- List.fold_left (cases_pattern_fold_names f)
- (Option.fold_left (List.fold_left (cases_pattern_fold_names f)) a patl1) patl2
- | CPatNotation (_,(patl,patll),patl') ->
- List.fold_left (cases_pattern_fold_names f)
- (List.fold_left (cases_pattern_fold_names f) a (patl@List.flatten patll)) patl'
- | CPatDelimiters (_,pat) -> cases_pattern_fold_names f a pat
- | CPatAtom (Some (Ident (_,id))) when not (is_constructor id) -> f id a
- | CPatPrim _ | CPatAtom _ -> a
- | CPatCast ({CAst.loc},_) ->
- CErrors.user_err ?loc ~hdr:"cases_pattern_fold_names"
- (Pp.strbrk "Casts are not supported here.")
-
-let ids_of_pattern =
- cases_pattern_fold_names Id.Set.add Id.Set.empty
-
-let ids_of_pattern_list =
- List.fold_left
- (located_fold_left
- (List.fold_left (cases_pattern_fold_names Id.Set.add)))
- Id.Set.empty
-
-let ids_of_cases_indtype p =
- cases_pattern_fold_names Id.Set.add Id.Set.empty p
-
-let ids_of_cases_tomatch tms =
- List.fold_right
- (fun (_, ona, indnal) l ->
- Option.fold_right (fun t ids -> cases_pattern_fold_names Id.Set.add ids t)
- indnal
- (Option.fold_right (down_located (Name.fold_right Id.Set.add)) ona l))
- tms Id.Set.empty
-
-let rec fold_constr_expr_binders g f n acc b = function
- | (nal,bk,t)::l ->
- let nal = snd (List.split nal) in
- let n' = List.fold_right (Name.fold_right g) nal n in
- f n (fold_constr_expr_binders g f n' acc b l) t
- | [] ->
- f n acc b
-
-let rec fold_local_binders g f n acc b = function
- | CLocalAssum (nal,bk,t)::l ->
- let nal = snd (List.split nal) in
- let n' = List.fold_right (Name.fold_right g) nal n in
- f n (fold_local_binders g f n' acc b l) t
- | CLocalDef ((_,na),c,t)::l ->
- Option.fold_left (f n) (f n (fold_local_binders g f (Name.fold_right g na n) acc b l) c) t
- | CLocalPattern (_,(pat,t))::l ->
- let acc = fold_local_binders g f (cases_pattern_fold_names g n pat) acc b l in
- Option.fold_left (f n) acc t
- | [] ->
- f n acc b
-
-let fold_constr_expr_with_binders g f n acc = CAst.with_val (function
- | CAppExpl ((_,_,_),l) -> List.fold_left (f n) acc l
- | CApp ((_,t),l) -> List.fold_left (f n) (f n acc t) (List.map fst l)
- | CProdN (l,b) | CLambdaN (l,b) -> fold_constr_expr_binders g f n acc b l
- | CLetIn (na,a,t,b) ->
- f (Name.fold_right g (snd na) n) (Option.fold_left (f n) (f n acc a) t) b
- | CCast (a,(CastConv b|CastVM b|CastNative b)) -> f n (f n acc a) b
- | CCast (a,CastCoerce) -> f n acc a
- | CNotation (_,(l,ll,bll)) ->
- (* The following is an approximation: we don't know exactly if
- an ident is binding nor to which subterms bindings apply *)
- let acc = List.fold_left (f n) acc (l@List.flatten ll) in
- List.fold_left (fun acc bl -> fold_local_binders g f n acc (CAst.make @@ CHole (None,IntroAnonymous,None)) bl) acc bll
- | CGeneralization (_,_,c) -> f n acc c
- | CDelimiters (_,a) -> f n acc a
- | CHole _ | CEvar _ | CPatVar _ | CSort _ | CPrim _ | CRef _ ->
- acc
- | CRecord l -> List.fold_left (fun acc (id, c) -> f n acc c) acc l
- | CCases (sty,rtnpo,al,bl) ->
- let ids = ids_of_cases_tomatch al in
- let acc = Option.fold_left (f (Id.Set.fold g ids n)) acc rtnpo in
- let acc = List.fold_left (f n) acc (List.map (fun (fst,_,_) -> fst) al) in
- List.fold_right (fun (loc,(patl,rhs)) acc ->
- let ids = ids_of_pattern_list patl in
- f (Id.Set.fold g ids n) acc rhs) bl acc
- | CLetTuple (nal,(ona,po),b,c) ->
- let n' = List.fold_right (down_located (Name.fold_right g)) nal n in
- f (Option.fold_right (down_located (Name.fold_right g)) ona n') (f n acc b) c
- | CIf (c,(ona,po),b1,b2) ->
- let acc = f n (f n (f n acc b1) b2) c in
- Option.fold_left
- (f (Option.fold_right (down_located (Name.fold_right g)) ona n)) acc po
- | CFix (_,l) ->
- let n' = List.fold_right (fun ((_,id),_,_,_,_) -> g id) l n in
- List.fold_right (fun (_,(_,o),lb,t,c) acc ->
- fold_local_binders g f n'
- (fold_local_binders g f n acc t lb) c lb) l acc
- | CCoFix (_,_) ->
- Feedback.msg_warning (strbrk "Capture check in multiple binders not done"); acc
- )
-
-let free_vars_of_constr_expr c =
- let rec aux bdvars l = function
- | { CAst.v = CRef (Ident (_,id),_) } -> if Id.List.mem id bdvars then l else Id.Set.add id l
- | c -> fold_constr_expr_with_binders (fun a l -> a::l) aux bdvars l c
- in aux [] Id.Set.empty c
-
-let occur_var_constr_expr id c = Id.Set.mem id (free_vars_of_constr_expr c)
-
-(* Interpret the index of a recursion order annotation *)
-
-let split_at_annot bl na =
- let names = List.map snd (names_of_local_assums bl) in
- match na with
- | None ->
- begin match names with
- | [] -> user_err (Pp.str "A fixpoint needs at least one parameter.")
- | _ -> ([], bl)
- end
- | Some (loc, id) ->
- let rec aux acc = function
- | CLocalAssum (bls, k, t) as x :: rest ->
- let test (_, na) = match na with
- | Name id' -> Id.equal id id'
- | Anonymous -> false
- in
- let l, r = List.split_when test bls in
- begin match r with
- | [] -> aux (x :: acc) rest
- | _ ->
- let ans = match l with
- | [] -> acc
- | _ -> CLocalAssum (l, k, t) :: acc
- in
- (List.rev ans, CLocalAssum (r, k, t) :: rest)
- end
- | CLocalDef ((_,na),_,_) as x :: rest ->
- if Name.equal (Name id) na then
- user_err ?loc
- (Nameops.pr_id id ++ str" must be a proper parameter and not a local definition.")
- else
- aux (x :: acc) rest
- | CLocalPattern (_,_) :: rest ->
- Loc.raise ?loc (Stream.Error "pattern with quote not allowed after fix")
- | [] ->
- user_err ?loc
- (str "No parameter named " ++ Nameops.pr_id id ++ str".")
- in aux [] bl
-
-(* Used in correctness and interface *)
-
-let map_binder g e nal = List.fold_right (down_located (Name.fold_right g)) nal e
-
-let map_binders f g e bl =
- (* TODO: avoid variable capture in [t] by some [na] in [List.tl nal] *)
- let h (e,bl) (nal,bk,t) = (map_binder g e nal,(nal,bk,f e t)::bl) in
- let (e,rbl) = List.fold_left h (e,[]) bl in
- (e, List.rev rbl)
-
-let map_local_binders f g e bl =
- (* TODO: avoid variable capture in [t] by some [na] in [List.tl nal] *)
- let h (e,bl) = function
- CLocalAssum(nal,k,ty) ->
- (map_binder g e nal, CLocalAssum(nal,k,f e ty)::bl)
- | CLocalDef((loc,na),c,ty) ->
- (Name.fold_right g na e, CLocalDef((loc,na),f e c,Option.map (f e) ty)::bl)
- | CLocalPattern (loc,(pat,t)) ->
- let ids = ids_of_pattern pat in
- (Id.Set.fold g ids e, CLocalPattern (loc,(pat,Option.map (f e) t))::bl) in
- let (e,rbl) = List.fold_left h (e,[]) bl in
- (e, List.rev rbl)
-
-let map_constr_expr_with_binders g f e = CAst.map (function
- | CAppExpl (r,l) -> CAppExpl (r,List.map (f e) l)
- | CApp ((p,a),l) ->
- CApp ((p,f e a),List.map (fun (a,i) -> (f e a,i)) l)
- | CProdN (bl,b) ->
- let (e,bl) = map_binders f g e bl in CProdN (bl,f e b)
- | CLambdaN (bl,b) ->
- let (e,bl) = map_binders f g e bl in CLambdaN (bl,f e b)
- | CLetIn (na,a,t,b) ->
- CLetIn (na,f e a,Option.map (f e) t,f (Name.fold_right g (snd na) e) b)
- | CCast (a,c) -> CCast (f e a, Miscops.map_cast_type (f e) c)
- | CNotation (n,(l,ll,bll)) ->
- (* This is an approximation because we don't know what binds what *)
- CNotation (n,(List.map (f e) l,List.map (List.map (f e)) ll,
- List.map (fun bl -> snd (map_local_binders f g e bl)) bll))
- | CGeneralization (b,a,c) -> CGeneralization (b,a,f e c)
- | CDelimiters (s,a) -> CDelimiters (s,f e a)
- | CHole _ | CEvar _ | CPatVar _ | CSort _
- | CPrim _ | CRef _ as x -> x
- | CRecord l -> CRecord (List.map (fun (id, c) -> (id, f e c)) l)
- | CCases (sty,rtnpo,a,bl) ->
- let bl = List.map (fun (loc,(patl,rhs)) ->
- let ids = ids_of_pattern_list patl in
- (loc,(patl,f (Id.Set.fold g ids e) rhs))) bl in
- let ids = ids_of_cases_tomatch a in
- let po = Option.map (f (Id.Set.fold g ids e)) rtnpo in
- CCases (sty, po, List.map (fun (tm,x,y) -> f e tm,x,y) a,bl)
- | CLetTuple (nal,(ona,po),b,c) ->
- let e' = List.fold_right (down_located (Name.fold_right g)) nal e in
- let e'' = Option.fold_right (down_located (Name.fold_right g)) ona e in
- CLetTuple (nal,(ona,Option.map (f e'') po),f e b,f e' c)
- | CIf (c,(ona,po),b1,b2) ->
- let e' = Option.fold_right (down_located (Name.fold_right g)) ona e in
- CIf (f e c,(ona,Option.map (f e') po),f e b1,f e b2)
- | CFix (id,dl) ->
- CFix (id,List.map (fun (id,n,bl,t,d) ->
- let (e',bl') = map_local_binders f g e bl in
- let t' = f e' t in
- (* Note: fix names should be inserted before the arguments... *)
- let e'' = List.fold_left (fun e ((_,id),_,_,_,_) -> g id e) e' dl in
- let d' = f e'' d in
- (id,n,bl',t',d')) dl)
- | CCoFix (id,dl) ->
- CCoFix (id,List.map (fun (id,bl,t,d) ->
- let (e',bl') = map_local_binders f g e bl in
- let t' = f e' t in
- let e'' = List.fold_left (fun e ((_,id),_,_,_) -> g id e) e' dl in
- let d' = f e'' d in
- (id,bl',t',d')) dl)
- )
-
-(* Used in constrintern *)
-let rec replace_vars_constr_expr l = function
- | { CAst.loc; v = CRef (Ident (loc_id,id),us) } as x ->
- (try CAst.make ?loc @@ CRef (Ident (loc_id,Id.Map.find id l),us) with Not_found -> x)
- | c -> map_constr_expr_with_binders Id.Map.remove
- replace_vars_constr_expr l c
-
-(* Returns the ranges of locs of the notation that are not occupied by args *)
-(* and which are then occupied by proper symbols of the notation (or spaces) *)
-
-let locs_of_notation ?loc locs ntn =
- let unloc loc = Option.cata Loc.unloc (0,0) loc in
- let (bl, el) = unloc loc in
- let locs = List.map unloc locs in
- let rec aux pos = function
- | [] -> if Int.equal pos el then [] else [(pos,el)]
- | (ba,ea)::l -> if Int.equal pos ba then aux ea l else (pos,ba)::aux ea l
- in aux bl (List.sort (fun l1 l2 -> fst l1 - fst l2) locs)
-
-let ntn_loc ?loc (args,argslist,binderslist) =
- locs_of_notation ?loc
- (List.map constr_loc (args@List.flatten argslist)@
- List.map local_binders_loc binderslist)
-
-let patntn_loc ?loc (args,argslist) =
- locs_of_notation ?loc
- (List.map cases_pattern_expr_loc (args@List.flatten argslist))
+let asymmetric_patterns = asymmetric_patterns
+let error_invalid_pattern_notation = error_invalid_pattern_notation
+let split_at_annot = split_at_annot
+let ntn_loc = ntn_loc
+let patntn_loc = patntn_loc
+let map_constr_expr_with_binders = map_constr_expr_with_binders
+let fold_constr_expr_with_binders = fold_constr_expr_with_binders
+let ids_of_cases_indtype = ids_of_cases_indtype
+let occur_var_constr_expr = occur_var_constr_expr
+let free_vars_of_constr_expr = free_vars_of_constr_expr
+let replace_vars_constr_expr = replace_vars_constr_expr
diff --git a/interp/topconstr.mli b/interp/topconstr.mli
index 922f87955..9fc02461e 100644
--- a/interp/topconstr.mli
+++ b/interp/topconstr.mli
@@ -10,40 +10,43 @@ open Loc
open Names
open Constrexpr
-(** Topconstr *)
-
+(** Topconstr: This whole module is deprecated in favor of Constrexpr_ops *)
val asymmetric_patterns : bool ref
+[@@ocaml.deprecated "use Constrexpr_ops.asymmetric_patterns"]
(** Utilities on constr_expr *)
+val split_at_annot : local_binder_expr list -> Id.t located option -> local_binder_expr list * local_binder_expr list
+[@@ocaml.deprecated "use Constrexpr_ops.split_at_annot"]
+
+val ntn_loc : ?loc:Loc.t -> constr_notation_substitution -> string -> (int * int) list
+[@@ocaml.deprecated "use Constrexpr_ops.ntn_loc"]
+val patntn_loc : ?loc:Loc.t -> cases_pattern_notation_substitution -> string -> (int * int) list
+[@@ocaml.deprecated "use Constrexpr_ops.patntn_loc"]
+
+(** For cases pattern parsing errors *)
+val error_invalid_pattern_notation : ?loc:Loc.t -> unit -> 'a
+[@@ocaml.deprecated "use Constrexpr_ops.error_invalid_pattern_notation"]
-val replace_vars_constr_expr :
- Id.t Id.Map.t -> constr_expr -> constr_expr
+(*************************************************************************)
+val replace_vars_constr_expr : Id.t Id.Map.t -> constr_expr -> constr_expr
+[@@ocaml.deprecated "use Constrexpr_ops.free_vars_of_constr_expr"]
val free_vars_of_constr_expr : constr_expr -> Id.Set.t
+[@@ocaml.deprecated "use Constrexpr_ops.free_vars_of_constr_expr"]
+
val occur_var_constr_expr : Id.t -> constr_expr -> bool
+[@@ocaml.deprecated "use Constrexpr_ops.occur_var_constr_expr"]
(** Specific function for interning "in indtype" syntax of "match" *)
val ids_of_cases_indtype : cases_pattern_expr -> Id.Set.t
-
-val split_at_annot : local_binder_expr list -> Id.t located option -> local_binder_expr list * local_binder_expr list
+[@@ocaml.deprecated "use Constrexpr_ops.ids_of_cases_indtype"]
(** Used in typeclasses *)
-
val fold_constr_expr_with_binders : (Id.t -> 'a -> 'a) ->
('a -> 'b -> constr_expr -> 'b) -> 'a -> 'b -> constr_expr -> 'b
-
-(** Used in correctness and interface; absence of var capture not guaranteed
- in pattern-matching clauses and in binders of the form [x,y:T(x)] *)
+[@@ocaml.deprecated "use Constrexpr_ops.fold_constr_expr_with_binders"]
val map_constr_expr_with_binders :
(Id.t -> 'a -> 'a) -> ('a -> constr_expr -> constr_expr) ->
'a -> constr_expr -> constr_expr
-
-val ntn_loc :
- ?loc:Loc.t -> constr_notation_substitution -> string -> (int * int) list
-val patntn_loc :
- ?loc:Loc.t -> cases_pattern_notation_substitution -> string -> (int * int) list
-
-(** For cases pattern parsing errors *)
-
-val error_invalid_pattern_notation : ?loc:Loc.t -> unit -> 'a
+[@@ocaml.deprecated "use Constrexpr_ops.map_constr_expr_with_binders"]
diff --git a/intf/constrexpr.ml b/intf/constrexpr.ml
index 8eadafe66..fbf9e248a 100644
--- a/intf/constrexpr.ml
+++ b/intf/constrexpr.ml
@@ -79,7 +79,7 @@ and constr_expr_r =
| CRecord of (reference * constr_expr) list
(* representation of the "let" and "match" constructs *)
- | CCases of case_style (* determines whether this value represents "let" or "match" construct *)
+ | CCases of Constr.case_style (* determines whether this value represents "let" or "match" construct *)
* constr_expr option (* return-clause *)
* case_expr list
* branch_expr list (* branches *)
@@ -97,6 +97,7 @@ and constr_expr_r =
| CGeneralization of binding_kind * abstraction_kind option * constr_expr
| CPrim of prim_token
| CDelimiters of string * constr_expr
+ | CProj of reference * constr_expr
and constr_expr = constr_expr_r CAst.t
and case_expr = constr_expr (* expression that is being matched *)
@@ -104,7 +105,7 @@ and case_expr = constr_expr (* expression that is being matched
* cases_pattern_expr option (* in-clause *)
and branch_expr =
- (cases_pattern_expr list Loc.located list * constr_expr) Loc.located
+ (cases_pattern_expr list list * constr_expr) Loc.located
and binder_expr =
Name.t Loc.located list * binder_kind * constr_expr
diff --git a/intf/decl_kinds.ml b/intf/decl_kinds.ml
index a97758833..b9a3f0c21 100644
--- a/intf/decl_kinds.ml
+++ b/intf/decl_kinds.ml
@@ -8,6 +8,8 @@
(** Informal mathematical status of declarations *)
+type discharge = DoDischarge | NoDischarge
+
type locality = Discharge | Local | Global
type binding_kind = Explicit | Implicit
@@ -40,6 +42,7 @@ type definition_object_kind =
| IdentityCoercion
| Instance
| Method
+ | Let
type assumption_object_kind = Definitional | Logical | Conjectural
@@ -72,7 +75,11 @@ type logical_kind =
(** Recursive power of type declarations *)
-type recursivity_kind =
+type recursivity_kind = Declarations.recursivity_kind =
| Finite (** = inductive *)
+ [@ocaml.deprecated "Please use [Declarations.Finite"]
| CoFinite (** = coinductive *)
+ [@ocaml.deprecated "Please use [Declarations.CoFinite"]
| BiFinite (** = non-recursive, like in "Record" definitions *)
+ [@ocaml.deprecated "Please use [Declarations.BiFinite"]
+[@@ocaml.deprecated "Please use [Declarations.recursivity_kind"]
diff --git a/intf/evar_kinds.ml b/intf/evar_kinds.ml
index 36c421c6c..428d6b678 100644
--- a/intf/evar_kinds.ml
+++ b/intf/evar_kinds.ml
@@ -32,4 +32,4 @@ type t =
| ImpossibleCase
| MatchingVar of matching_var_kind
| VarInstance of Id.t
- | SubEvar of Constr.existential_key
+ | SubEvar of Evar.t
diff --git a/intf/glob_term.ml b/intf/glob_term.ml
index 508990a58..61bbe2c26 100644
--- a/intf/glob_term.ml
+++ b/intf/glob_term.ml
@@ -46,7 +46,7 @@ type 'a glob_constr_r =
| GLambda of Name.t * binding_kind * 'a glob_constr_g * 'a glob_constr_g
| GProd of Name.t * binding_kind * 'a glob_constr_g * 'a glob_constr_g
| GLetIn of Name.t * 'a glob_constr_g * 'a glob_constr_g option * 'a glob_constr_g
- | GCases of case_style * 'a glob_constr_g option * 'a tomatch_tuples_g * 'a cases_clauses_g
+ | GCases of Constr.case_style * 'a glob_constr_g option * 'a tomatch_tuples_g * 'a cases_clauses_g
(** [GCases(style,r,tur,cc)] = "match 'tur' return 'r' with 'cc'" (in [MatchStyle]) *)
| GLetTuple of Name.t list * (Name.t * 'a glob_constr_g option) * 'a glob_constr_g * 'a glob_constr_g
| GIf of 'a glob_constr_g * (Name.t * 'a glob_constr_g option) * 'a glob_constr_g * 'a glob_constr_g
@@ -55,6 +55,7 @@ type 'a glob_constr_r =
| GSort of glob_sort
| GHole of Evar_kinds.t * intro_pattern_naming_expr * Genarg.glob_generic_argument option
| GCast of 'a glob_constr_g * 'a glob_constr_g cast_type
+ | GProj of Projection.t * 'a glob_constr_g
and 'a glob_constr_g = ('a glob_constr_r, 'a) DAst.t
and 'a glob_decl_g = Name.t * binding_kind * 'a glob_constr_g option * 'a glob_constr_g
@@ -93,6 +94,14 @@ type fix_recursion_order = [ `any ] fix_recursion_order_g
type any_glob_constr = AnyGlobConstr : 'r glob_constr_g -> any_glob_constr
+type 'a disjunctive_cases_clause_g = (Id.t list * 'a cases_pattern_g list list * 'a glob_constr_g) Loc.located
+type 'a disjunctive_cases_clauses_g = 'a disjunctive_cases_clause_g list
+type 'a cases_pattern_disjunction_g = 'a cases_pattern_g list
+
+type disjunctive_cases_clause = [ `any ] disjunctive_cases_clause_g
+type disjunctive_cases_clauses = [ `any ] disjunctive_cases_clauses_g
+type cases_pattern_disjunction = [ `any ] cases_pattern_disjunction_g
+
type 'a extended_glob_local_binder_r =
| GLocalAssum of Name.t * binding_kind * 'a glob_constr_g
| GLocalDef of Name.t * binding_kind * 'a glob_constr_g * 'a glob_constr_g option
diff --git a/intf/intf.mllib b/intf/intf.mllib
index 523e4b265..38a2a71cc 100644
--- a/intf/intf.mllib
+++ b/intf/intf.mllib
@@ -3,7 +3,6 @@ Evar_kinds
Genredexpr
Locus
Notation_term
-Tactypes
Decl_kinds
Extend
Glob_term
diff --git a/intf/misctypes.ml b/intf/misctypes.ml
index 8b7073143..33e961419 100644
--- a/intf/misctypes.ml
+++ b/intf/misctypes.ml
@@ -48,25 +48,32 @@ type 'a glob_sort_gen =
| GProp (** representation of [Prop] literal *)
| GSet (** representation of [Set] literal *)
| GType of 'a (** representation of [Type] literal *)
-type sort_info = Name.t Loc.located list
-type level_info = Name.t Loc.located option
-type glob_sort = sort_info glob_sort_gen
+type 'a universe_kind =
+ | UAnonymous
+ | UUnknown
+ | UNamed of 'a
+
+type level_info = Libnames.reference universe_kind
type glob_level = level_info glob_sort_gen
type glob_constraint = glob_level * Univ.constraint_type * glob_level
+type sort_info = (Libnames.reference * int) option list
+type glob_sort = sort_info glob_sort_gen
+
(** A synonym of [Evar.t], also defined in Term *)
type existential_key = Evar.t
(** Case style, shared with Term *)
-type case_style = Term.case_style =
+type case_style = Constr.case_style =
| LetStyle
| IfStyle
| LetPatternStyle
| MatchStyle
| RegularStyle (** infer printing form from number of constructor *)
+[@@ocaml.deprecated "Alias for Constr.case_style"]
(** Casts *)
diff --git a/intf/notation_term.ml b/intf/notation_term.ml
index c342da3dc..cad6f4b82 100644
--- a/intf/notation_term.ml
+++ b/intf/notation_term.ml
@@ -31,7 +31,7 @@ type notation_constr =
| NProd of Name.t * notation_constr * notation_constr
| NBinderList of Id.t * Id.t * notation_constr * notation_constr
| NLetIn of Name.t * notation_constr * notation_constr option * notation_constr
- | NCases of case_style * notation_constr option *
+ | NCases of Constr.case_style * notation_constr option *
(notation_constr * (Name.t * (inductive * Name.t list) option)) list *
(cases_pattern list * notation_constr) list
| NLetTuple of Name.t list * (Name.t * notation_constr option) *
@@ -43,6 +43,7 @@ type notation_constr =
notation_constr array * notation_constr array
| NSort of glob_sort
| NCast of notation_constr * notation_constr cast_type
+ | NProj of Projection.t * notation_constr
(** Note concerning NList: first constr is iterator, second is terminator;
first id is where each argument of the list has to be substituted
diff --git a/intf/pattern.ml b/intf/pattern.ml
index 16c480735..64873a039 100644
--- a/intf/pattern.ml
+++ b/intf/pattern.ml
@@ -8,13 +8,13 @@
open Names
open Globnames
-open Term
+open Constr
open Misctypes
(** {5 Patterns} *)
type case_info_pattern =
- { cip_style : case_style;
+ { cip_style : Constr.case_style;
cip_ind : inductive option;
cip_ind_tags : bool list option; (** indicates LetIn/Lambda in arity *)
cip_extensible : bool (** does this match end with _ => _ ? *) }
@@ -26,7 +26,7 @@ type constr_pattern =
| PRel of int
| PApp of constr_pattern * constr_pattern array
| PSoApp of patvar * constr_pattern list
- | PProj of projection * constr_pattern
+ | PProj of Projection.t * constr_pattern
| PLambda of Name.t * constr_pattern * constr_pattern
| PProd of Name.t * constr_pattern * constr_pattern
| PLetIn of Name.t * constr_pattern * constr_pattern option * constr_pattern
diff --git a/intf/vernacexpr.ml b/intf/vernacexpr.ml
index 9aef4b131..8e0fe54c5 100644
--- a/intf/vernacexpr.ml
+++ b/intf/vernacexpr.ml
@@ -40,6 +40,8 @@ type goal_reference =
| NthGoal of int
| GoalId of Id.t
+type univ_name_list = Name.t Loc.located list
+
type printable =
| PrintTables
| PrintFullContext
@@ -54,7 +56,7 @@ type printable =
| PrintMLLoadPath
| PrintMLModules
| PrintDebugGC
- | PrintName of reference or_by_notation
+ | PrintName of reference or_by_notation * univ_name_list option
| PrintGraph
| PrintClasses
| PrintTypeClasses
@@ -70,7 +72,7 @@ type printable =
| PrintScopes
| PrintScope of string
| PrintVisibility of string option
- | PrintAbout of reference or_by_notation * goal_selector option
+ | PrintAbout of reference or_by_notation * univ_name_list option * goal_selector option
| PrintImplicit of reference or_by_notation
| PrintAssumptions of bool * bool * reference or_by_notation
| PrintStrategy of reference or_by_notation option
@@ -143,16 +145,12 @@ type coercion_flag = bool (* true = AddCoercion false = NoCoercion *)
type instance_flag = bool option
(* Some true = Backward instance; Some false = Forward instance, None = NoInstance *)
type export_flag = bool (* true = Export; false = Import *)
-type inductive_flag = Decl_kinds.recursivity_kind
+type inductive_flag = Declarations.recursivity_kind
type onlyparsing_flag = Flags.compat_version option
(* Some v = Parse only; None = Print also.
If v<>Current, it contains the name of the coq version
which this notation is trying to be compatible with *)
type locality_flag = bool (* true = Local *)
-type obsolete_locality = bool
-(* Some grammar entries use obsolete_locality. This bool is to be backward
- * compatible. If the grammar is fixed removing deprecated syntax, this
- * bool should go away too *)
type option_value = Goptions.option_value =
| BoolValue of bool
@@ -169,6 +167,7 @@ type option_ref_value =
type universe_decl_expr = (Id.t Loc.located list, glob_constraint list) gen_universe_decl
type ident_decl = lident * universe_decl_expr option
+type name_decl = lname * universe_decl_expr option
type sort_expr = Sorts.family
@@ -206,12 +205,12 @@ type inductive_expr =
type one_inductive_expr =
ident_decl * local_binder_expr list * constr_expr option * constructor_expr list
-type typeclass_constraint = (Name.t Loc.located * universe_decl_expr option) * binding_kind * constr_expr
+type typeclass_constraint = name_decl * binding_kind * constr_expr
and typeclass_context = typeclass_constraint list
type proof_expr =
- ident_decl option * (local_binder_expr list * constr_expr)
+ ident_decl * (local_binder_expr list * constr_expr)
type syntax_modifier =
| SetItemLevel of string list * Extend.production_level
@@ -316,40 +315,40 @@ type cumulative_inductive_parsing_flag =
(** {6 The type of vernacular expressions} *)
-type vernac_expr =
- (* Control *)
- | VernacLoad of verbose_flag * string
- | VernacTime of vernac_expr located
- | VernacRedirect of string * vernac_expr located
- | VernacTimeout of int * vernac_expr
- | VernacFail of vernac_expr
+type vernac_implicit_status = Implicit | MaximallyImplicit | NotImplicit
+
+type vernac_argument_status = {
+ name : Name.t;
+ recarg_like : bool;
+ notation_scope : string Loc.located option;
+ implicit_status : vernac_implicit_status;
+}
+type nonrec vernac_expr =
+
+ | VernacLoad of verbose_flag * string
(* Syntax *)
- | VernacSyntaxExtension of
- bool * obsolete_locality * (lstring * syntax_modifier list)
- | VernacOpenCloseScope of obsolete_locality * (bool * scope_name)
+ | VernacSyntaxExtension of bool * (lstring * syntax_modifier list)
+ | VernacOpenCloseScope of bool * scope_name
| VernacDelimiters of scope_name * string option
| VernacBindScope of scope_name * class_rawexpr list
- | VernacInfix of obsolete_locality * (lstring * syntax_modifier list) *
+ | VernacInfix of (lstring * syntax_modifier list) *
constr_expr * scope_name option
| VernacNotation of
- obsolete_locality * constr_expr * (lstring * syntax_modifier list) *
+ constr_expr * (lstring * syntax_modifier list) *
scope_name option
| VernacNotationAddFormat of string * string * string
(* Gallina *)
- | VernacDefinition of
- (locality option * definition_object_kind) * ident_decl * definition_expr
+ | VernacDefinition of (discharge * definition_object_kind) * name_decl * definition_expr
| VernacStartTheoremProof of theorem_kind * proof_expr list
| VernacEndProof of proof_end
| VernacExactProof of constr_expr
- | VernacAssumption of (locality option * assumption_object_kind) *
+ | VernacAssumption of (discharge * assumption_object_kind) *
inline * (ident_decl list * constr_expr) with_coercion list
| VernacInductive of cumulative_inductive_parsing_flag * private_flag * inductive_flag * (inductive_expr * decl_notation list) list
- | VernacFixpoint of
- locality option * (fixpoint_expr * decl_notation list) list
- | VernacCoFixpoint of
- locality option * (cofixpoint_expr * decl_notation list) list
+ | VernacFixpoint of discharge * (fixpoint_expr * decl_notation list) list
+ | VernacCoFixpoint of discharge * (cofixpoint_expr * decl_notation list) list
| VernacScheme of (lident option * scheme) list
| VernacCombinedScheme of lident * lident list
| VernacUniverse of lident list
@@ -362,10 +361,9 @@ type vernac_expr =
reference option * export_flag option * reference list
| VernacImport of export_flag * reference list
| VernacCanonical of reference or_by_notation
- | VernacCoercion of obsolete_locality * reference or_by_notation *
- class_rawexpr * class_rawexpr
- | VernacIdentityCoercion of obsolete_locality * lident *
+ | VernacCoercion of reference or_by_notation *
class_rawexpr * class_rawexpr
+ | VernacIdentityCoercion of lident * class_rawexpr * class_rawexpr
| VernacNameSectionHypSet of lident * section_subset_expr
(* Type classes *)
@@ -416,9 +414,9 @@ type vernac_expr =
(* Commands *)
| VernacCreateHintDb of string * bool
| VernacRemoveHints of string list * reference list
- | VernacHints of obsolete_locality * string list * hints_expr
+ | VernacHints of string list * hints_expr
| VernacSyntacticDefinition of Id.t located * (Id.t list * constr_expr) *
- obsolete_locality * onlyparsing_flag
+ onlyparsing_flag
| VernacDeclareImplicits of reference or_by_notation *
(explicitation * bool * bool) list list
| VernacArguments of reference or_by_notation *
@@ -452,7 +450,6 @@ type vernac_expr =
| VernacComments of comment list
(* Proof management *)
- | VernacGoal of constr_expr
| VernacAbort of lident option
| VernacAbortAll
| VernacRestart
@@ -463,7 +460,7 @@ type vernac_expr =
| VernacUnfocus
| VernacUnfocused
| VernacBullet of bullet
- | VernacSubproof of int option
+ | VernacSubproof of goal_selector option
| VernacEndSubproof
| VernacShow of showable
| VernacCheckGuard
@@ -475,32 +472,53 @@ type vernac_expr =
(* For extension *)
| VernacExtend of extend_name * Genarg.raw_generic_argument list
- (* Flags *)
- | VernacProgram of vernac_expr
- | VernacPolymorphic of bool * vernac_expr
- | VernacLocal of bool * vernac_expr
+type nonrec vernac_flag =
+ | VernacProgram
+ | VernacPolymorphic of bool
+ | VernacLocal of bool
-and vernac_implicit_status = Implicit | MaximallyImplicit | NotImplicit
+type vernac_control =
+ | VernacExpr of vernac_flag list * vernac_expr
+ (* boolean is true when the `-time` batch-mode command line flag was set.
+ the flag is used to print differently in `-time` vs `Time foo` *)
+ | VernacTime of bool * vernac_control located
+ | VernacRedirect of string * vernac_control located
+ | VernacTimeout of int * vernac_control
+ | VernacFail of vernac_control
-and vernac_argument_status = {
- name : Name.t;
- recarg_like : bool;
- notation_scope : string Loc.located option;
- implicit_status : vernac_implicit_status;
-}
+(* A vernac classifier provides information about the exectuion of a
+ command:
+
+ - vernac_when: encodes if the vernac may alter the parser [thus
+ forcing immediate execution], or if indeed it is pure and parsing
+ can continue without its execution.
-(* A vernac classifier has to tell if a command:
- vernac_when: has to be executed now (alters the parser) or later
- vernac_type: if it is starts, ends, continues a proof or
+ - vernac_type: if it is starts, ends, continues a proof or
alters the global state or is a control command like BackTo or is
- a query like Check *)
+ a query like Check.
+
+ The classification works on the assumption that we have 3 states:
+ parsing, execution (global enviroment, etc...), and proof
+ state. For example, commands that only alter the proof state are
+ considered safe to delegate to a worker.
+
+*)
type vernac_type =
+ (* Start of a proof *)
| VtStartProof of vernac_start
+ (* Command altering the global state, bad for parallel
+ processing. *)
| VtSideff of vernac_sideff_type
+ (* End of a proof *)
| VtQed of vernac_qed_type
+ (* A proof step *)
| VtProofStep of proof_step
+ (* To be removed *)
| VtProofMode of string
+ (* Queries are commands assumed to be "pure", that is to say, they
+ don't modify the interpretation state. *)
| VtQuery of vernac_part_of_script * Feedback.route_id
+ (* To be removed *)
| VtMeta
| VtUnknown
and vernac_qed_type = VtKeep | VtKeepAsAxiom | VtDrop (* Qed/Admitted, Abort *)
diff --git a/kernel/cClosure.ml b/kernel/cClosure.ml
index 7e193ef82..219ea5b24 100644
--- a/kernel/cClosure.ml
+++ b/kernel/cClosure.ml
@@ -23,7 +23,7 @@ open CErrors
open Util
open Pp
open Names
-open Term
+open Constr
open Vars
open Environ
open Esubst
@@ -85,12 +85,13 @@ module type RedFlagsSig = sig
val fFIX : red_kind
val fCOFIX : red_kind
val fZETA : red_kind
- val fCONST : constant -> red_kind
+ val fCONST : Constant.t -> red_kind
val fVAR : Id.t -> red_kind
val no_red : reds
val red_add : reds -> red_kind -> reds
val red_sub : reds -> red_kind -> reds
val red_add_transparent : reds -> transparent_state -> reds
+ val red_transparent : reds -> transparent_state
val mkflags : red_kind list -> reds
val red_set : reds -> red_kind -> bool
val red_projection : reds -> projection -> bool
@@ -114,7 +115,7 @@ module RedFlags = (struct
type red_kind = BETA | DELTA | ETA | MATCH | FIX
| COFIX | ZETA
- | CONST of constant | VAR of Id.t
+ | CONST of Constant.t | VAR of Id.t
let fBETA = BETA
let fDELTA = DELTA
let fETA = ETA
@@ -164,6 +165,8 @@ module RedFlags = (struct
let (l1,l2) = red.r_const in
{ red with r_const = Id.Pred.remove id l1, l2 }
+ let red_transparent red = red.r_const
+
let red_add_transparent red tr =
{ red with r_const = tr }
@@ -234,7 +237,7 @@ let unfold_red kn =
* instantiations (cbv or lazy) are.
*)
-type table_key = constant puniverses tableKey
+type table_key = Constant.t Univ.puniverses tableKey
let eq_pconstant_key (c,u) (c',u') =
eq_constant_key c c' && Univ.Instance.equal u u'
@@ -258,7 +261,7 @@ type 'a infos_cache = {
i_repr : 'a infos -> constr -> 'a;
i_env : env;
i_sigma : existential -> constr option;
- i_rels : constr option array;
+ i_rels : (Context.Rel.Declaration.t * Pre_env.lazy_val) Range.t;
i_tab : 'a KeyTable.t }
and 'a infos = {
@@ -282,13 +285,16 @@ let ref_value_cache ({i_cache = cache} as infos) ref =
let body =
match ref with
| RelKey n ->
- let len = Array.length cache.i_rels in
- let i = n - 1 in
- let () = if i < 0 || len <= i then raise Not_found in
- begin match Array.unsafe_get cache.i_rels i with
- | None -> raise Not_found
- | Some t -> lift n t
- end
+ let open Context.Rel.Declaration in
+ let i = n - 1 in
+ let (d, _) =
+ try Range.get cache.i_rels i
+ with Invalid_argument _ -> raise Not_found
+ in
+ begin match d with
+ | LocalAssum _ -> raise Not_found
+ | LocalDef (_, t, _) -> lift n t
+ end
| VarKey id -> assoc_defined id cache.i_env
| ConstKey cst -> constant_value_in cache.i_env cst
in
@@ -303,26 +309,13 @@ let ref_value_cache ({i_cache = cache} as infos) ref =
let evar_value cache ev =
cache.i_sigma ev
-let defined_rels flags env =
-(* if red_local_const (snd flags) then*)
- let ctx = rel_context env in
- let len = List.length ctx in
- let ans = Array.make len None in
- let open Context.Rel.Declaration in
- let iter i = function
- | LocalAssum _ -> ()
- | LocalDef (_,b,_) -> Array.unsafe_set ans i (Some b)
- in
- let () = List.iteri iter ctx in
- ans
-(* else (0,[])*)
-
let create mk_cl flgs env evars =
+ let open Pre_env in
let cache =
{ i_repr = mk_cl;
i_env = env;
i_sigma = evars;
- i_rels = defined_rels flgs env;
+ i_rels = (Environ.pre_env env).env_rel_context.env_rel_map;
i_tab = KeyTable.create 17 }
in { i_flags = flgs; i_cache = cache }
@@ -401,7 +394,7 @@ let update v1 no t =
type stack_member =
| Zapp of fconstr array
| ZcaseT of case_info * constr * constr array * fconstr subs
- | Zproj of int * int * constant
+ | Zproj of int * int * Constant.t
| Zfix of fconstr * stack
| Zshift of int
| Zupdate of fconstr
@@ -480,7 +473,8 @@ let rec lft_fconstr n ft =
| FCoFix(cfx,e) -> {norm=Cstr; term=FCoFix(cfx,subs_shft(n,e))}
| FLIFT(k,m) -> lft_fconstr (n+k) m
| FLOCKED -> assert false
- | _ -> {norm=ft.norm; term=FLIFT(n,ft)}
+ | FFlex _ | FAtom _ | FCast _ | FApp _ | FProj _ | FCaseT _ | FProd _
+ | FLetIn _ | FEvar _ | FCLOS _ -> {norm=ft.norm; term=FLIFT(n,ft)}
let lift_fconstr k f =
if Int.equal k 0 then f else lft_fconstr k f
let lift_fconstr_vect k v =
@@ -516,7 +510,7 @@ let zupdate m s =
else s
let mk_lambda env t =
- let (rvars,t') = decompose_lam t in
+ let (rvars,t') = Term.decompose_lam t in
FLambda(List.length rvars, List.rev rvars, t', env)
let destFLambda clos_fun t =
@@ -530,7 +524,7 @@ let destFLambda clos_fun t =
(* Optimization: do not enclose variables in a closure.
Makes variable access much faster *)
let mk_clos e t =
- match kind_of_term t with
+ match kind t with
| Rel i -> clos_rel e i
| Var x -> { norm = Red; term = FFlex (VarKey x) }
| Const c -> { norm = Red; term = FFlex (ConstKey c) }
@@ -556,7 +550,7 @@ let mk_clos_vect env v = match v with
subterms.
Could be used insted of mk_clos. *)
let mk_clos_deep clos_fun env t =
- match kind_of_term t with
+ match kind t with
| (Rel _|Ind _|Const _|Construct _|Var _|Meta _ | Sort _) ->
mk_clos env t
| Cast (a,k,b) ->
@@ -655,7 +649,7 @@ let term_of_fconstr =
match v.term with
| FCLOS(t,env) when is_subs_id env && is_lift_id lfts -> t
| FLambda(_,tys,f,e) when is_subs_id e && is_lift_id lfts ->
- compose_lam (List.rev tys) f
+ Term.compose_lam (List.rev tys) f
| FFix(fx,e) when is_subs_id e && is_lift_id lfts -> mkFix fx
| FCoFix(cfx,e) when is_subs_id e && is_lift_id lfts -> mkCoFix cfx
| _ -> to_constr term_of_fconstr_lift lfts v in
@@ -809,7 +803,7 @@ let eta_expand_ind_stack env ind m s (f, s') =
let mib = lookup_mind (fst ind) env in
match mib.Declarations.mind_record with
| Some (Some (_,projs,pbs)) when
- mib.Declarations.mind_finite == Decl_kinds.BiFinite ->
+ mib.Declarations.mind_finite == Declarations.BiFinite ->
(* (Construct, pars1 .. parsm :: arg1...argn :: []) ~= (f, s') ->
arg1..argn ~= (proj1 t...projn t) where t = zip (f,s') *)
let pars = mib.Declarations.mind_nparams in
@@ -856,6 +850,14 @@ let contract_fix_vect fix =
in
(subs_cons(Array.init nfix make_body, env), thisbody)
+let unfold_projection info p =
+ if red_projection info.i_flags p
+ then
+ let open Declarations in
+ let pb = lookup_projection p (info_env info) in
+ Some (Zproj (pb.proj_npars, pb.proj_arg, Projection.constant p))
+ else None
+
(*********************************************************************)
(* A machine that inspects the head of a term until it finds an
atom or a subterm that may produce a redex (abstraction,
@@ -874,15 +876,9 @@ let rec knh info m stk =
| (None, stk') -> (m,stk'))
| FCast(t,_,_) -> knh info t stk
| FProj (p,c) ->
- let unf = Projection.unfolded p in
- if unf || red_set info.i_flags (fCONST (Projection.constant p)) then
- (match try Some (lookup_projection p (info_env info)) with Not_found -> None with
- | None -> (m, stk)
- | Some pb ->
- knh info c (Zproj (pb.Declarations.proj_npars, pb.Declarations.proj_arg,
- Projection.constant p)
- :: zupdate m stk))
- else (m,stk)
+ (match unfold_projection info p with
+ | None -> (m, stk)
+ | Some s -> knh info c (s :: zupdate m stk))
(* cases where knh stops *)
| (FFlex _|FLetIn _|FConstruct _|FEvar _|
@@ -891,7 +887,7 @@ let rec knh info m stk =
(* The same for pure terms *)
and knht info e t stk =
- match kind_of_term t with
+ match kind t with
| App(a,b) ->
knht info e a (append_stack (mk_clos_vect e b) stk)
| Case(ci,p,t,br) ->
@@ -958,7 +954,10 @@ let rec knr info m stk =
(match evar_value info.i_cache ev with
Some c -> knit info env c stk
| None -> (m,stk))
- | _ -> (m,stk)
+ | FLOCKED | FRel _ | FAtom _ | FCast _ | FFlex _ | FInd _ | FApp _ | FProj _
+ | FFix _ | FCoFix _ | FCaseT _ | FLambda _ | FProd _ | FLetIn _ | FLIFT _
+ | FCLOS _ -> (m, stk)
+
(* Computes the weak head normal form of a term *)
and kni info m stk =
@@ -1034,7 +1033,8 @@ and norm_head info m =
mkEvar(i, Array.map (fun a -> kl info (mk_clos env a)) args)
| FProj (p,c) ->
mkProj (p, kl info c)
- | t -> term_of_fconstr m
+ | FLOCKED | FRel _ | FAtom _ | FCast _ | FFlex _ | FInd _ | FConstruct _
+ | FApp _ | FCaseT _ | FLIFT _ | FCLOS _ -> term_of_fconstr m
(* Initialization and then normalization *)
diff --git a/kernel/cClosure.mli b/kernel/cClosure.mli
index 9e5cb48a4..c43fc4623 100644
--- a/kernel/cClosure.mli
+++ b/kernel/cClosure.mli
@@ -7,7 +7,7 @@
(************************************************************************)
open Names
-open Term
+open Constr
open Environ
open Esubst
@@ -29,7 +29,7 @@ val all_opaque : transparent_state
val all_transparent : transparent_state
val is_transparent_variable : transparent_state -> variable -> bool
-val is_transparent_constant : transparent_state -> constant -> bool
+val is_transparent_constant : transparent_state -> Constant.t -> bool
(** Sets of reduction kinds. *)
module type RedFlagsSig = sig
@@ -46,7 +46,7 @@ module type RedFlagsSig = sig
val fFIX : red_kind
val fCOFIX : red_kind
val fZETA : red_kind
- val fCONST : constant -> red_kind
+ val fCONST : Constant.t -> red_kind
val fVAR : Id.t -> red_kind
(** No reduction at all *)
@@ -61,6 +61,9 @@ module type RedFlagsSig = sig
(** Adds a reduction kind to a set *)
val red_add_transparent : reds -> transparent_state -> reds
+ (** Retrieve the transparent state of the reduction flags *)
+ val red_transparent : reds -> transparent_state
+
(** Build a reduction set from scratch = iter [red_add] on [no_red] *)
val mkflags : red_kind list -> reds
@@ -92,7 +95,7 @@ val unfold_side_red : reds
val unfold_red : evaluable_global_reference -> reds
(***********************************************************************)
-type table_key = constant puniverses tableKey
+type table_key = Constant.t Univ.puniverses tableKey
type 'a infos_cache
type 'a infos = {
@@ -122,8 +125,8 @@ type fterm =
| FAtom of constr (** Metas and Sorts *)
| FCast of fconstr * cast_kind * fconstr
| FFlex of table_key
- | FInd of inductive puniverses
- | FConstruct of constructor puniverses
+ | FInd of inductive Univ.puniverses
+ | FConstruct of constructor Univ.puniverses
| FApp of fconstr * fconstr array
| FProj of projection * fconstr
| FFix of fixpoint * fconstr subs
@@ -145,7 +148,7 @@ type fterm =
type stack_member =
| Zapp of fconstr array
| ZcaseT of case_info * constr * constr array * fconstr subs
- | Zproj of int * int * constant
+ | Zproj of int * int * Constant.t
| Zfix of fconstr * stack
| Zshift of int
| Zupdate of fconstr
@@ -163,6 +166,7 @@ val stack_tail : int -> stack -> stack
val stack_nth : stack -> int -> fconstr
val zip_term : (fconstr -> constr) -> constr -> stack -> constr
val eta_expand_stack : stack -> stack
+val unfold_projection : 'a infos -> Projection.t -> stack_member option
(** To lazy reduce a constr, create a [clos_infos] with
[create_clos_infos], inject the term to reduce with [inject]; then use
diff --git a/kernel/cbytecodes.ml b/kernel/cbytecodes.ml
index 25f61c7aa..9febc6449 100644
--- a/kernel/cbytecodes.ml
+++ b/kernel/cbytecodes.ml
@@ -13,7 +13,7 @@
(* This file defines the type of bytecode instructions *)
open Names
-open Term
+open Constr
type tag = int
@@ -32,13 +32,13 @@ let cofix_evaluated_tag = 7
let last_variant_tag = 245
type structured_constant =
- | Const_sorts of sorts
+ | Const_sorts of Sorts.t
| Const_ind of inductive
| Const_proj of Constant.t
| Const_b0 of tag
| Const_bn of tag * structured_constant array
- | Const_univ_level of Univ.universe_level
- | Const_type of Univ.universe
+ | Const_univ_level of Univ.Level.t
+ | Const_type of Univ.Universe.t
type reloc_table = (tag * int) array
@@ -74,7 +74,7 @@ type instruction =
| Kclosurerec of int * int * Label.t array * Label.t array
| Kclosurecofix of int * int * Label.t array * Label.t array
(* nb fv, init, lbl types, lbl bodies *)
- | Kgetglobal of constant
+ | Kgetglobal of Constant.t
| Kconst of structured_constant
| Kmakeblock of int * tag
| Kmakeprod
@@ -186,14 +186,15 @@ open Pp
open Util
let pp_sort s =
- match family_of_sort s with
+ let open Sorts in
+ match family s with
| InSet -> str "Set"
| InProp -> str "Prop"
| InType -> str "Type"
let rec pp_struct_const = function
| Const_sorts s -> pp_sort s
- | Const_ind (mind, i) -> pr_mind mind ++ str"#" ++ int i
+ | Const_ind (mind, i) -> MutInd.print mind ++ str"#" ++ int i
| Const_proj p -> Constant.print p
| Const_b0 i -> int i
| Const_bn (i,t) ->
@@ -241,7 +242,7 @@ let rec pp_instr i =
prlist_with_sep spc pp_lbl (Array.to_list lblt) ++
str " bodies = " ++
prlist_with_sep spc pp_lbl (Array.to_list lblb))
- | Kgetglobal idu -> str "getglobal " ++ pr_con idu
+ | Kgetglobal idu -> str "getglobal " ++ Constant.print idu
| Kconst sc ->
str "const " ++ pp_struct_const sc
| Kmakeblock(n, m) ->
diff --git a/kernel/cbytecodes.mli b/kernel/cbytecodes.mli
index 718917ab3..5d37a5840 100644
--- a/kernel/cbytecodes.mli
+++ b/kernel/cbytecodes.mli
@@ -9,7 +9,7 @@
(* $Id$ *)
open Names
-open Term
+open Constr
type tag = int
@@ -26,13 +26,13 @@ val cofix_evaluated_tag : tag
val last_variant_tag : tag
type structured_constant =
- | Const_sorts of sorts
+ | Const_sorts of Sorts.t
| Const_ind of inductive
| Const_proj of Constant.t
| Const_b0 of tag
| Const_bn of tag * structured_constant array
- | Const_univ_level of Univ.universe_level
- | Const_type of Univ.universe
+ | Const_univ_level of Univ.Level.t
+ | Const_type of Univ.Universe.t
val pp_struct_const : structured_constant -> Pp.t
@@ -69,7 +69,7 @@ type instruction =
(** nb fv, init, lbl types, lbl bodies *)
| Kclosurecofix of int * int * Label.t array * Label.t array
(** nb fv, init, lbl types, lbl bodies *)
- | Kgetglobal of constant
+ | Kgetglobal of Constant.t
| Kconst of structured_constant
| Kmakeblock of (* size: *) int * tag (** allocate an ocaml block. Index 0
** is accu, all others are popped from
diff --git a/kernel/cbytegen.ml b/kernel/cbytegen.ml
index d63fcffa2..5dab2932d 100644
--- a/kernel/cbytegen.ml
+++ b/kernel/cbytegen.ml
@@ -14,7 +14,7 @@ open Util
open Names
open Cbytecodes
open Cemitcodes
-open Term
+open Constr
open Declarations
open Pre_env
@@ -438,12 +438,12 @@ let get_strcst = function
| _ -> raise Not_found
let rec str_const c =
- match kind_of_term c with
+ match kind c with
| Sort s -> Bstrconst (Const_sorts s)
| Cast(c,_,_) -> str_const c
| App(f,args) ->
begin
- match kind_of_term f with
+ match kind f with
| Construct(((kn,j),i),u) ->
begin
let oib = lookup_mind kn !global_env in
@@ -596,7 +596,7 @@ let rec get_alias env kn =
(* sz is the size of the local stack *)
let rec compile_constr reloc c sz cont =
set_max_stack_size sz;
- match kind_of_term c with
+ match kind c with
| Meta _ -> invalid_arg "Cbytegen.compile_constr : Meta"
| Evar _ -> invalid_arg "Cbytegen.compile_constr : Evar"
| Proj (p,c) ->
@@ -621,9 +621,9 @@ let rec compile_constr reloc c sz cont =
(Univ.Instance.to_array u)
sz
cont
- | Sort (Prop _) | Construct _ ->
+ | Sort (Sorts.Prop _) | Construct _ ->
compile_str_cst reloc (str_const c) sz cont
- | Sort (Type u) ->
+ | Sort (Sorts.Type u) ->
(* We separate global and local universes in [u]. The former will be part
of the structured constant, while the later (if any) will be applied as
arguments. *)
@@ -641,7 +641,7 @@ let rec compile_constr reloc c sz cont =
LSet.fold (fun lvl u -> Universe.sup u (Universe.make lvl)) global_levels Universe.type0m
in
if local_levels = [] then
- compile_str_cst reloc (Bstrconst (Const_sorts (Type uglob))) sz cont
+ compile_str_cst reloc (Bstrconst (Const_sorts (Sorts.Type uglob))) sz cont
else
let compile_get_univ reloc idx sz cont =
set_max_stack_size sz;
@@ -659,7 +659,7 @@ let rec compile_constr reloc c sz cont =
Kpush :: compile_constr reloc dom (sz+1) (Kmakeprod :: cont) in
compile_constr reloc (mkLambda(id,dom,codom)) sz cont1
| Lambda _ ->
- let params, body = decompose_lam c in
+ let params, body = Term.decompose_lam c in
let arity = List.length params in
let r_fun = comp_env_fun arity in
let lbl_fun = Label.create() in
@@ -672,7 +672,7 @@ let rec compile_constr reloc c sz cont =
| App(f,args) ->
begin
- match kind_of_term f with
+ match kind f with
| Construct _ -> compile_str_cst reloc (str_const c) sz cont
| Const (kn,u) -> compile_const reloc kn u args sz cont
| _ -> comp_app compile_constr compile_constr reloc f args sz cont
@@ -694,7 +694,7 @@ let rec compile_constr reloc c sz cont =
done;
(* Compiling bodies *)
for i = 0 to ndef - 1 do
- let params,body = decompose_lam rec_bodies.(i) in
+ let params,body = Term.decompose_lam rec_bodies.(i) in
let arity = List.length params in
let env_body = comp_env_fix ndef i arity rfv in
let cont1 =
@@ -726,7 +726,7 @@ let rec compile_constr reloc c sz cont =
done;
(* Compiling bodies *)
for i = 0 to ndef - 1 do
- let params,body = decompose_lam rec_bodies.(i) in
+ let params,body = Term.decompose_lam rec_bodies.(i) in
let arity = List.length params in
let env_body = comp_env_cofix ndef arity rfv in
let lbl = Label.create () in
@@ -792,7 +792,7 @@ let rec compile_constr reloc c sz cont =
lbl_consts.(tag) <- lbl_b;
c := code_b
else
- let args, body = decompose_lam branchs.(i) in
+ let args, body = Term.decompose_lam branchs.(i) in
let nargs = List.length args in
let code_b =
@@ -953,9 +953,9 @@ let compile fail_on_error ?universes:(universes=0) env c =
*)
let reloc = empty_comp_env () in
let arity , body =
- match kind_of_term c with
+ match kind c with
| Lambda _ ->
- let params, body = decompose_lam c in
+ let params, body = Term.decompose_lam c in
List.length params , body
| _ -> 0 , c
in
@@ -995,10 +995,10 @@ let compile_constant_body fail_on_error env univs = function
| Monomorphic_const _ -> 0
| Polymorphic_const univ -> Univ.AUContext.size univ
in
- match kind_of_term body with
+ match kind body with
| Const (kn',u) when is_univ_copy instance_size u ->
(* we use the canonical name of the constant*)
- let con= constant_of_kn (canonical_con kn') in
+ let con= Constant.make1 (Constant.canonical kn') in
Some (BCalias (get_alias env con))
| _ ->
let res = compile fail_on_error ~universes:instance_size env body in
@@ -1006,7 +1006,7 @@ let compile_constant_body fail_on_error env univs = function
(* Shortcut of the previous function used during module strengthening *)
-let compile_alias kn = BCalias (constant_of_kn (canonical_con kn))
+let compile_alias kn = BCalias (Constant.make1 (Constant.canonical kn))
(* spiwack: additional function which allow different part of compilation of the
31-bit integers *)
@@ -1024,7 +1024,7 @@ let compile_structured_int31 fc args =
if not fc then raise Not_found else
Const_b0
(Array.fold_left
- (fun temp_i -> fun t -> match kind_of_term t with
+ (fun temp_i -> fun t -> match kind t with
| Construct ((_,d),_) -> 2*temp_i+d-1
| _ -> raise NotClosed)
0 args
diff --git a/kernel/cbytegen.mli b/kernel/cbytegen.mli
index 48c2e4533..c117d3fb5 100644
--- a/kernel/cbytegen.mli
+++ b/kernel/cbytegen.mli
@@ -1,6 +1,14 @@
+(************************************************************************)
+(* v * The Coq Proof Assistant / The Coq Development Team *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(************************************************************************)
+
open Cbytecodes
open Cemitcodes
-open Term
+open Constr
open Declarations
open Pre_env
@@ -14,7 +22,7 @@ val compile_constant_body : bool ->
(** Shortcut of the previous function used during module strengthening *)
-val compile_alias : Names.constant -> body_code
+val compile_alias : Names.Constant.t -> body_code
(** spiwack: this function contains the information needed to perform
the static compilation of int31 (trying and obtaining
diff --git a/kernel/cemitcodes.ml b/kernel/cemitcodes.ml
index 092bcecc3..eeea19c12 100644
--- a/kernel/cemitcodes.ml
+++ b/kernel/cemitcodes.ml
@@ -19,7 +19,7 @@ open Mod_subst
type reloc_info =
| Reloc_annot of annot_switch
| Reloc_const of structured_constant
- | Reloc_getglobal of Names.constant
+ | Reloc_getglobal of Names.Constant.t
type patch = reloc_info * int
@@ -348,12 +348,12 @@ let subst_to_patch s (code,pl,fv) =
type body_code =
| BCdefined of to_patch
- | BCalias of Names.constant
+ | BCalias of Names.Constant.t
| BCconstant
type to_patch_substituted =
| PBCdefined of to_patch substituted
-| PBCalias of Names.constant substituted
+| PBCalias of Names.Constant.t substituted
| PBCconstant
let from_val = function
diff --git a/kernel/cemitcodes.mli b/kernel/cemitcodes.mli
index c80edd596..fee45aafd 100644
--- a/kernel/cemitcodes.mli
+++ b/kernel/cemitcodes.mli
@@ -4,7 +4,7 @@ open Cbytecodes
type reloc_info =
| Reloc_annot of annot_switch
| Reloc_const of structured_constant
- | Reloc_getglobal of constant
+ | Reloc_getglobal of Constant.t
type patch = reloc_info * int
@@ -23,7 +23,7 @@ val subst_to_patch : Mod_subst.substitution -> to_patch -> to_patch
type body_code =
| BCdefined of to_patch
- | BCalias of constant
+ | BCalias of Constant.t
| BCconstant
diff --git a/kernel/constr.ml b/kernel/constr.ml
index c3e609536..1ff1fcc4c 100644
--- a/kernel/constr.ml
+++ b/kernel/constr.ml
@@ -75,7 +75,7 @@ type ('constr, 'types) pfixpoint =
type ('constr, 'types) pcofixpoint =
int * ('constr, 'types) prec_declaration
type 'a puniverses = 'a Univ.puniverses
-type pconstant = constant puniverses
+type pconstant = Constant.t puniverses
type pinductive = inductive puniverses
type pconstructor = constructor puniverses
@@ -92,7 +92,7 @@ type ('constr, 'types, 'sort, 'univs) kind_of_term =
| Lambda of Name.t * 'types * 'constr
| LetIn of Name.t * 'constr * 'types * 'constr
| App of 'constr * 'constr array
- | Const of (constant * 'univs)
+ | Const of (Constant.t * 'univs)
| Ind of (inductive * 'univs)
| Construct of (constructor * 'univs)
| Case of case_info * 'constr * 'constr * 'constr array
@@ -233,7 +233,6 @@ let mkMeta n = Meta n
(* Constructs a Variable named id *)
let mkVar id = Var id
-
(************************************************************************)
(* kind_of_term = constructions as seen by the user *)
(************************************************************************)
@@ -250,6 +249,168 @@ let of_kind = function
| Cast (c, knd, t) -> mkCast (c, knd, t)
| k -> k
+(**********************************************************************)
+(* Non primitive term destructors *)
+(**********************************************************************)
+
+(* Destructor operations : partial functions
+ Raise [DestKO] if the const has not the expected form *)
+
+exception DestKO
+
+let isMeta c = match kind c with Meta _ -> true | _ -> false
+
+(* Destructs a type *)
+let isSort c = match kind c with
+ | Sort _ -> true
+ | _ -> false
+
+let rec isprop c = match kind c with
+ | Sort (Sorts.Prop _) -> true
+ | Cast (c,_,_) -> isprop c
+ | _ -> false
+
+let rec is_Prop c = match kind c with
+ | Sort (Sorts.Prop Sorts.Null) -> true
+ | Cast (c,_,_) -> is_Prop c
+ | _ -> false
+
+let rec is_Set c = match kind c with
+ | Sort (Sorts.Prop Sorts.Pos) -> true
+ | Cast (c,_,_) -> is_Set c
+ | _ -> false
+
+let rec is_Type c = match kind c with
+ | Sort (Sorts.Type _) -> true
+ | Cast (c,_,_) -> is_Type c
+ | _ -> false
+
+let is_small = Sorts.is_small
+let iskind c = isprop c || is_Type c
+
+(* Tests if an evar *)
+let isEvar c = match kind c with Evar _ -> true | _ -> false
+let isEvar_or_Meta c = match kind c with
+ | Evar _ | Meta _ -> true
+ | _ -> false
+
+let isCast c = match kind c with Cast _ -> true | _ -> false
+(* Tests if a de Bruijn index *)
+let isRel c = match kind c with Rel _ -> true | _ -> false
+let isRelN n c =
+ match kind c with Rel n' -> Int.equal n n' | _ -> false
+(* Tests if a variable *)
+let isVar c = match kind c with Var _ -> true | _ -> false
+let isVarId id c = match kind c with Var id' -> Id.equal id id' | _ -> false
+(* Tests if an inductive *)
+let isInd c = match kind c with Ind _ -> true | _ -> false
+let isProd c = match kind c with | Prod _ -> true | _ -> false
+let isLambda c = match kind c with | Lambda _ -> true | _ -> false
+let isLetIn c = match kind c with LetIn _ -> true | _ -> false
+let isApp c = match kind c with App _ -> true | _ -> false
+let isConst c = match kind c with Const _ -> true | _ -> false
+let isConstruct c = match kind c with Construct _ -> true | _ -> false
+let isCase c = match kind c with Case _ -> true | _ -> false
+let isProj c = match kind c with Proj _ -> true | _ -> false
+let isFix c = match kind c with Fix _ -> true | _ -> false
+let isCoFix c = match kind c with CoFix _ -> true | _ -> false
+
+(* Destructs a de Bruijn index *)
+let destRel c = match kind c with
+ | Rel n -> n
+ | _ -> raise DestKO
+
+(* Destructs an existential variable *)
+let destMeta c = match kind c with
+ | Meta n -> n
+ | _ -> raise DestKO
+
+(* Destructs a variable *)
+let destVar c = match kind c with
+ | Var id -> id
+ | _ -> raise DestKO
+
+let destSort c = match kind c with
+ | Sort s -> s
+ | _ -> raise DestKO
+
+(* Destructs a casted term *)
+let destCast c = match kind c with
+ | Cast (t1,k,t2) -> (t1,k,t2)
+ | _ -> raise DestKO
+
+(* Destructs the product (x:t1)t2 *)
+let destProd c = match kind c with
+ | Prod (x,t1,t2) -> (x,t1,t2)
+ | _ -> raise DestKO
+
+(* Destructs the abstraction [x:t1]t2 *)
+let destLambda c = match kind c with
+ | Lambda (x,t1,t2) -> (x,t1,t2)
+ | _ -> raise DestKO
+
+(* Destructs the let [x:=b:t1]t2 *)
+let destLetIn c = match kind c with
+ | LetIn (x,b,t1,t2) -> (x,b,t1,t2)
+ | _ -> raise DestKO
+
+(* Destructs an application *)
+let destApp c = match kind c with
+ | App (f,a) -> (f, a)
+ | _ -> raise DestKO
+
+(* Destructs a constant *)
+let destConst c = match kind c with
+ | Const kn -> kn
+ | _ -> raise DestKO
+
+(* Destructs an existential variable *)
+let destEvar c = match kind c with
+ | Evar (kn, a as r) -> r
+ | _ -> raise DestKO
+
+(* Destructs a (co)inductive type named kn *)
+let destInd c = match kind c with
+ | Ind (kn, a as r) -> r
+ | _ -> raise DestKO
+
+(* Destructs a constructor *)
+let destConstruct c = match kind c with
+ | Construct (kn, a as r) -> r
+ | _ -> raise DestKO
+
+(* Destructs a term <p>Case c of lc1 | lc2 .. | lcn end *)
+let destCase c = match kind c with
+ | Case (ci,p,c,v) -> (ci,p,c,v)
+ | _ -> raise DestKO
+
+let destProj c = match kind c with
+ | Proj (p, c) -> (p, c)
+ | _ -> raise DestKO
+
+let destFix c = match kind c with
+ | Fix fix -> fix
+ | _ -> raise DestKO
+
+let destCoFix c = match kind c with
+ | CoFix cofix -> cofix
+ | _ -> raise DestKO
+
+
+(******************************************************************)
+(* Flattening and unflattening of embedded applications and casts *)
+(******************************************************************)
+
+let decompose_app c =
+ match kind c with
+ | App (f,cl) -> (f, Array.to_list cl)
+ | _ -> (c,[])
+
+let decompose_appvect c =
+ match kind c with
+ | App (f,cl) -> (f, cl)
+ | _ -> (c,[||])
+
(****************************************************************************)
(* Functions to recur through subterms *)
(****************************************************************************)
@@ -513,6 +674,7 @@ let compare_head_gen_leq_with kind1 kind2 eq_universes leq_sorts eq leq t1 t2 =
| Prod (_,t1,c1), Prod (_,t2,c2) -> eq t1 t2 && leq c1 c2
| Lambda (_,t1,c1), Lambda (_,t2,c2) -> eq t1 t2 && eq c1 c2
| LetIn (_,b1,t1,c1), LetIn (_,b2,t2,c2) -> eq b1 b2 && eq t1 t2 && leq c1 c2
+ (* Why do we suddenly make a special case for Cast here? *)
| App (Cast(c1, _, _),l1), _ -> leq (mkApp (c1,l1)) t2
| _, App (Cast (c2, _, _),l2) -> leq t1 (mkApp (c2,l2))
| App (c1,l1), App (c2,l2) ->
@@ -520,7 +682,7 @@ let compare_head_gen_leq_with kind1 kind2 eq_universes leq_sorts eq leq t1 t2 =
eq c1 c2 && Array.equal_norefl eq l1 l2
| Proj (p1,c1), Proj (p2,c2) -> Projection.equal p1 p2 && eq c1 c2
| Evar (e1,l1), Evar (e2,l2) -> Evar.equal e1 e2 && Array.equal eq l1 l2
- | Const (c1,u1), Const (c2,u2) -> eq_constant c1 c2 && eq_universes true u1 u2
+ | Const (c1,u1), Const (c2,u2) -> Constant.equal c1 c2 && eq_universes true u1 u2
| Ind (c1,u1), Ind (c2,u2) -> eq_ind c1 c2 && eq_universes false u1 u2
| Construct (c1,u1), Construct (c2,u2) -> eq_constructor c1 c2 && eq_universes false u1 u2
| Case (_,p1,c1,bl1), Case (_,p2,c2,bl2) ->
@@ -530,7 +692,9 @@ let compare_head_gen_leq_with kind1 kind2 eq_universes leq_sorts eq leq t1 t2 =
&& Array.equal_norefl eq tl1 tl2 && Array.equal_norefl eq bl1 bl2
| CoFix(ln1,(_,tl1,bl1)), CoFix(ln2,(_,tl2,bl2)) ->
Int.equal ln1 ln2 && Array.equal_norefl eq tl1 tl2 && Array.equal_norefl eq bl1 bl2
- | _ -> false
+ | (Rel _ | Meta _ | Var _ | Sort _ | Prod _ | Lambda _ | LetIn _ | App _
+ | Proj _ | Evar _ | Const _ | Ind _ | Construct _ | Case _ | Fix _
+ | CoFix _), _ -> false
(* [compare_head_gen_leq u s eq leq c1 c2] compare [c1] and [c2] using [eq] to compare
the immediate subterms of [c1] of [c2] for conversion if needed, [leq] for cumulativity,
@@ -650,9 +814,6 @@ let always_true _ _ = true
let rec eq_constr_nounivs m n =
(m == n) || compare_head_gen (fun _ -> always_true) always_true eq_constr_nounivs m n
-(** We only use this function over blocks! *)
-let tag t = Obj.tag (Obj.repr t)
-
let constr_ord_int f t1 t2 =
let (=?) f g i1 i2 j1 j2=
let c = f i1 i2 in
@@ -664,35 +825,50 @@ let constr_ord_int f t1 t2 =
((Array.compare Int.compare) =? Int.compare) a1 a2 i1 i2
in
match kind t1, kind t2 with
+ | Cast (c1,_,_), _ -> f c1 t2
+ | _, Cast (c2,_,_) -> f t1 c2
+ (* Why this special case? *)
+ | App (Cast(c1,_,_),l1), _ -> f (mkApp (c1,l1)) t2
+ | _, App (Cast(c2, _,_),l2) -> f t1 (mkApp (c2,l2))
| Rel n1, Rel n2 -> Int.compare n1 n2
- | Meta m1, Meta m2 -> Int.compare m1 m2
+ | Rel _, _ -> -1 | _, Rel _ -> 1
| Var id1, Var id2 -> Id.compare id1 id2
+ | Var _, _ -> -1 | _, Var _ -> 1
+ | Meta m1, Meta m2 -> Int.compare m1 m2
+ | Meta _, _ -> -1 | _, Meta _ -> 1
+ | Evar (e1,l1), Evar (e2,l2) ->
+ (Evar.compare =? (Array.compare f)) e1 e2 l1 l2
+ | Evar _, _ -> -1 | _, Evar _ -> 1
| Sort s1, Sort s2 -> Sorts.compare s1 s2
- | Cast (c1,_,_), _ -> f c1 t2
- | _, Cast (c2,_,_) -> f t1 c2
+ | Sort _, _ -> -1 | _, Sort _ -> 1
| Prod (_,t1,c1), Prod (_,t2,c2)
| Lambda (_,t1,c1), Lambda (_,t2,c2) ->
(f =? f) t1 t2 c1 c2
+ | Prod _, _ -> -1 | _, Prod _ -> 1
+ | Lambda _, _ -> -1 | _, Lambda _ -> 1
| LetIn (_,b1,t1,c1), LetIn (_,b2,t2,c2) ->
((f =? f) ==? f) b1 b2 t1 t2 c1 c2
- | App (Cast(c1,_,_),l1), _ -> f (mkApp (c1,l1)) t2
- | _, App (Cast(c2, _,_),l2) -> f t1 (mkApp (c2,l2))
+ | LetIn _, _ -> -1 | _, LetIn _ -> 1
| App (c1,l1), App (c2,l2) -> (f =? (Array.compare f)) c1 c2 l1 l2
- | Proj (p1,c1), Proj (p2,c2) -> (Projection.compare =? f) p1 p2 c1 c2
- | Evar (e1,l1), Evar (e2,l2) ->
- (Evar.compare =? (Array.compare f)) e1 e2 l1 l2
- | Const (c1,u1), Const (c2,u2) -> con_ord c1 c2
+ | App _, _ -> -1 | _, App _ -> 1
+ | Const (c1,u1), Const (c2,u2) -> Constant.CanOrd.compare c1 c2
+ | Const _, _ -> -1 | _, Const _ -> 1
| Ind (ind1, u1), Ind (ind2, u2) -> ind_ord ind1 ind2
+ | Ind _, _ -> -1 | _, Ind _ -> 1
| Construct (ct1,u1), Construct (ct2,u2) -> constructor_ord ct1 ct2
+ | Construct _, _ -> -1 | _, Construct _ -> 1
| Case (_,p1,c1,bl1), Case (_,p2,c2,bl2) ->
((f =? f) ==? (Array.compare f)) p1 p2 c1 c2 bl1 bl2
+ | Case _, _ -> -1 | _, Case _ -> 1
| Fix (ln1,(_,tl1,bl1)), Fix (ln2,(_,tl2,bl2)) ->
((fix_cmp =? (Array.compare f)) ==? (Array.compare f))
ln1 ln2 tl1 tl2 bl1 bl2
+ | Fix _, _ -> -1 | _, Fix _ -> 1
| CoFix(ln1,(_,tl1,bl1)), CoFix(ln2,(_,tl2,bl2)) ->
((Int.compare =? (Array.compare f)) ==? (Array.compare f))
ln1 ln2 tl1 tl2 bl1 bl2
- | t1, t2 -> Int.compare (tag t1) (tag t2)
+ | CoFix _, _ -> -1 | _, CoFix _ -> 1
+ | Proj (p1,c1), Proj (p2,c2) -> (Projection.compare =? f) p1 p2 c1 c2
let rec compare m n=
constr_ord_int compare m n
@@ -776,7 +952,9 @@ let hasheq t1 t2 =
&& array_eqeq lna1 lna2
&& array_eqeq tl1 tl2
&& array_eqeq bl1 bl2
- | _ -> false
+ | (Rel _ | Meta _ | Var _ | Sort _ | Cast _ | Prod _ | Lambda _ | LetIn _
+ | App _ | Proj _ | Evar _ | Const _ | Ind _ | Construct _ | Case _
+ | Fix _ | CoFix _), _ -> false
(** Note that the following Make has the side effect of creating
once and for all the table we'll use for hash-consing all constr *)
@@ -1000,8 +1178,3 @@ let hcons =
Id.hcons)
(* let hcons_types = hcons_constr *)
-
-(*******)
-(* Type of abstract machine values *)
-(** FIXME: nothing to do there *)
-type values
diff --git a/kernel/constr.mli b/kernel/constr.mli
index 76dbf5530..19ffa8fe3 100644
--- a/kernel/constr.mli
+++ b/kernel/constr.mli
@@ -13,20 +13,22 @@ open Names
(** {6 Value under universe substitution } *)
type 'a puniverses = 'a Univ.puniverses
+[@@ocaml.deprecated "use Univ.puniverses"]
(** {6 Simply type aliases } *)
-type pconstant = constant puniverses
-type pinductive = inductive puniverses
-type pconstructor = constructor puniverses
+type pconstant = Constant.t Univ.puniverses
+type pinductive = inductive Univ.puniverses
+type pconstructor = constructor Univ.puniverses
(** {6 Existential variables } *)
type existential_key = Evar.t
+[@@ocaml.deprecated "use Evar.t"]
(** {6 Existential variables } *)
type metavariable = int
(** {6 Case annotation } *)
-type case_style = LetStyle | IfStyle | LetPatternStyle | MatchStyle
+type case_style = LetStyle | IfStyle | LetPatternStyle | MatchStyle
| RegularStyle (** infer printing form from number of constructor *)
type case_printing =
{ ind_tags : bool list; (** tell whether letin or lambda in the arity of the inductive type *)
@@ -80,14 +82,14 @@ val mkVar : Id.t -> constr
val mkMeta : metavariable -> constr
(** Constructs an existential variable *)
-type existential = existential_key * constr array
+type existential = Evar.t * constr array
val mkEvar : existential -> constr
(** Construct a sort *)
val mkSort : Sorts.t -> types
val mkProp : types
val mkSet : types
-val mkType : Univ.universe -> types
+val mkType : Univ.Universe.t -> types
(** This defines the strategy to use for verifiying a Cast *)
@@ -111,10 +113,10 @@ val mkLetIn : Name.t * constr * types * constr -> constr
{%latex:$(f~t_1\dots f_n)$%}. *)
val mkApp : constr * constr array -> constr
-val map_puniverses : ('a -> 'b) -> 'a puniverses -> 'b puniverses
+val map_puniverses : ('a -> 'b) -> 'a Univ.puniverses -> 'b Univ.puniverses
-(** Constructs a constant *)
-val mkConst : constant -> constr
+(** Constructs a Constant.t *)
+val mkConst : Constant.t -> constr
val mkConstU : pconstant -> constr
(** Constructs a projection application *)
@@ -180,7 +182,7 @@ val mkCoFix : cofixpoint -> constr
(** [constr array] is an instance matching definitional [named_context] in
the same order (i.e. last argument first) *)
-type 'constr pexistential = existential_key * 'constr array
+type 'constr pexistential = Evar.t * 'constr array
type ('constr, 'types) prec_declaration =
Name.t array * 'types array * 'constr array
type ('constr, 'types) pfixpoint =
@@ -201,14 +203,14 @@ type ('constr, 'types, 'sort, 'univs) kind_of_term =
| Cast of 'constr * cast_kind * 'types
| Prod of Name.t * 'types * 'types (** Concrete syntax ["forall A:B,C"] is represented as [Prod (A,B,C)]. *)
| Lambda of Name.t * 'types * 'constr (** Concrete syntax ["fun A:B => C"] is represented as [Lambda (A,B,C)]. *)
- | LetIn of Name.t * 'constr * 'types * 'constr (** Concrete syntax ["let A:B := C in D"] is represented as [LetIn (A,B,C,D)]. *)
+ | LetIn of Name.t * 'constr * 'types * 'constr (** Concrete syntax ["let A:C := B in D"] is represented as [LetIn (A,B,C,D)]. *)
| App of 'constr * 'constr array (** Concrete syntax ["(F P1 P2 ... Pn)"] is represented as [App (F, [|P1; P2; ...; Pn|])].
The {!mkApp} constructor also enforces the following invariant:
- [F] itself is not {!App}
- and [[|P1;..;Pn|]] is not empty. *)
- | Const of (constant * 'univs) (** Gallina-variable that was introduced by Vernacular-command that extends the global environment
+ | Const of (Constant.t * 'univs) (** Gallina-variable that was introduced by Vernacular-command that extends the global environment
(i.e. [Parameter], or [Axiom], or [Definition], or [Theorem] etc.) *)
| Ind of (inductive * 'univs) (** A name of an inductive type defined by [Variant], [Inductive] or [Record] Vernacular-commands. *)
@@ -225,6 +227,110 @@ type ('constr, 'types, 'sort, 'univs) kind_of_term =
val kind : constr -> (constr, types, Sorts.t, Univ.Instance.t) kind_of_term
val of_kind : (constr, types, Sorts.t, Univ.Instance.t) kind_of_term -> constr
+(** {6 Simple case analysis} *)
+val isRel : constr -> bool
+val isRelN : int -> constr -> bool
+val isVar : constr -> bool
+val isVarId : Id.t -> constr -> bool
+val isInd : constr -> bool
+val isEvar : constr -> bool
+val isMeta : constr -> bool
+val isEvar_or_Meta : constr -> bool
+val isSort : constr -> bool
+val isCast : constr -> bool
+val isApp : constr -> bool
+val isLambda : constr -> bool
+val isLetIn : constr -> bool
+val isProd : constr -> bool
+val isConst : constr -> bool
+val isConstruct : constr -> bool
+val isFix : constr -> bool
+val isCoFix : constr -> bool
+val isCase : constr -> bool
+val isProj : constr -> bool
+
+val is_Prop : constr -> bool
+val is_Set : constr -> bool
+val isprop : constr -> bool
+val is_Type : constr -> bool
+val iskind : constr -> bool
+val is_small : Sorts.t -> bool
+
+(** {6 Term destructors } *)
+(** Destructor operations are partial functions and
+ @raise DestKO if the term has not the expected form. *)
+
+exception DestKO
+
+(** Destructs a de Bruijn index *)
+val destRel : constr -> int
+
+(** Destructs an existential variable *)
+val destMeta : constr -> metavariable
+
+(** Destructs a variable *)
+val destVar : constr -> Id.t
+
+(** Destructs a sort. [is_Prop] recognizes the sort {% \textsf{%}Prop{% }%}, whether
+ [isprop] recognizes both {% \textsf{%}Prop{% }%} and {% \textsf{%}Set{% }%}. *)
+val destSort : constr -> Sorts.t
+
+(** Destructs a casted term *)
+val destCast : constr -> constr * cast_kind * constr
+
+(** Destructs the product {% $ %}(x:t_1)t_2{% $ %} *)
+val destProd : types -> Name.t * types * types
+
+(** Destructs the abstraction {% $ %}[x:t_1]t_2{% $ %} *)
+val destLambda : constr -> Name.t * types * constr
+
+(** Destructs the let {% $ %}[x:=b:t_1]t_2{% $ %} *)
+val destLetIn : constr -> Name.t * constr * types * constr
+
+(** Destructs an application *)
+val destApp : constr -> constr * constr array
+
+(** Decompose any term as an applicative term; the list of args can be empty *)
+val decompose_app : constr -> constr * constr list
+
+(** Same as [decompose_app], but returns an array. *)
+val decompose_appvect : constr -> constr * constr array
+
+(** Destructs a constant *)
+val destConst : constr -> Constant.t Univ.puniverses
+
+(** Destructs an existential variable *)
+val destEvar : constr -> existential
+
+(** Destructs a (co)inductive type *)
+val destInd : constr -> inductive Univ.puniverses
+
+(** Destructs a constructor *)
+val destConstruct : constr -> constructor Univ.puniverses
+
+(** Destructs a [match c as x in I args return P with ... |
+Ci(...yij...) => ti | ... end] (or [let (..y1i..) := c as x in I args
+return P in t1], or [if c then t1 else t2])
+@return [(info,c,fun args x => P,[|...|fun yij => ti| ...|])]
+where [info] is pretty-printing information *)
+val destCase : constr -> case_info * constr * constr * constr array
+
+(** Destructs a projection *)
+val destProj : constr -> projection * constr
+
+(** Destructs the {% $ %}i{% $ %}th function of the block
+ [Fixpoint f{_ 1} ctx{_ 1} = b{_ 1}
+ with f{_ 2} ctx{_ 2} = b{_ 2}
+ ...
+ with f{_ n} ctx{_ n} = b{_ n}],
+ where the length of the {% $ %}j{% $ %}th context is {% $ %}ij{% $ %}.
+*)
+val destFix : constr -> fixpoint
+
+val destCoFix : constr -> cofixpoint
+
+(** {6 Equality} *)
+
(** [equal a b] is true if [a] equals [b] modulo alpha, casts,
and application grouping *)
val equal : constr -> constr -> bool
@@ -302,7 +408,7 @@ val compare_head : (constr -> constr -> bool) -> constr -> constr -> bool
(** [compare_head_gen u s f c1 c2] compare [c1] and [c2] using [f] to compare
the immediate subterms of [c1] of [c2] if needed, [u] to compare universe
- instances (the first boolean tells if they belong to a constant), [s] to
+ instances (the first boolean tells if they belong to a Constant.t), [s] to
compare sorts; Cast's, binders name and Cases annotations are not taken
into account *)
@@ -335,7 +441,7 @@ val compare_head_gen_with :
(** [compare_head_gen_leq u s f fle c1 c2] compare [c1] and [c2] using
[f] to compare the immediate subterms of [c1] of [c2] for
conversion, [fle] for cumulativity, [u] to compare universe
- instances (the first boolean tells if they belong to a constant),
+ instances (the first boolean tells if they belong to a Constant.t),
[s] to compare sorts for for subtyping; Cast's, binders name and
Cases annotations are not taken into account *)
@@ -344,7 +450,7 @@ val compare_head_gen_leq : (bool -> Univ.Instance.t -> Univ.Instance.t -> bool)
(constr -> constr -> bool) ->
(constr -> constr -> bool) ->
constr -> constr -> bool
-
+
(** {6 Hashconsing} *)
val hash : constr -> int
@@ -353,7 +459,3 @@ val case_info_hash : case_info -> int
(*********************************************************************)
val hcons : constr -> constr
-
-(**************************************)
-
-type values
diff --git a/kernel/conv_oracle.mli b/kernel/conv_oracle.mli
index 248cd2b30..02c179ab6 100644
--- a/kernel/conv_oracle.mli
+++ b/kernel/conv_oracle.mli
@@ -16,7 +16,7 @@ val empty : oracle
If [oracle_order kn1 kn2] is true, then unfold kn1 first.
Note: the oracle does not introduce incompleteness, it only
tries to postpone unfolding of "opaque" constants. *)
-val oracle_order : ('a -> constant) -> oracle -> bool ->
+val oracle_order : ('a -> Constant.t) -> oracle -> bool ->
'a tableKey -> 'a tableKey -> bool
(** Priority for the expansion of constant in the conversion test.
@@ -30,14 +30,14 @@ val transparent : level
(** Check whether a level is transparent *)
val is_transparent : level -> bool
-val get_strategy : oracle -> constant tableKey -> level
+val get_strategy : oracle -> Constant.t tableKey -> level
(** Sets the level of a constant.
* Level of RelKey constant cannot be set. *)
-val set_strategy : oracle -> constant tableKey -> level -> oracle
+val set_strategy : oracle -> Constant.t tableKey -> level -> oracle
(** Fold over the non-transparent levels of the oracle. Order unspecified. *)
-val fold_strategy : (constant tableKey -> level -> 'a -> 'a) -> oracle -> 'a -> 'a
+val fold_strategy : (Constant.t tableKey -> level -> 'a -> 'a) -> oracle -> 'a -> 'a
val get_transp_state : oracle -> transparent_state
diff --git a/kernel/cooking.ml b/kernel/cooking.ml
index 80d41847c..23a578d99 100644
--- a/kernel/cooking.ml
+++ b/kernel/cooking.ml
@@ -17,6 +17,7 @@ open CErrors
open Util
open Names
open Term
+open Constr
open Declarations
open Univ
@@ -29,15 +30,15 @@ let pop_dirpath p = match DirPath.repr p with
| _::l -> DirPath.make l
let pop_mind kn =
- let (mp,dir,l) = Names.repr_mind kn in
- Names.make_mind mp (pop_dirpath dir) l
+ let (mp,dir,l) = MutInd.repr3 kn in
+ MutInd.make3 mp (pop_dirpath dir) l
let pop_con con =
- let (mp,dir,l) = Names.repr_con con in
- Names.make_con mp (pop_dirpath dir) l
+ let (mp,dir,l) = Constant.repr3 con in
+ Constant.make3 mp (pop_dirpath dir) l
type my_global_reference =
- | ConstRef of constant
+ | ConstRef of Constant.t
| IndRef of inductive
| ConstructRef of constructor
@@ -100,42 +101,42 @@ let expmod_constr cache modlist c =
let share_univs = share_univs cache in
let update_case_info = update_case_info cache in
let rec substrec c =
- match kind_of_term c with
+ match kind c with
| Case (ci,p,t,br) ->
- map_constr substrec (mkCase (update_case_info ci modlist,p,t,br))
+ Constr.map substrec (mkCase (update_case_info ci modlist,p,t,br))
| Ind (ind,u) ->
(try
share_univs (IndRef ind) u modlist
with
- | Not_found -> map_constr substrec c)
+ | Not_found -> Constr.map substrec c)
| Construct (cstr,u) ->
(try
share_univs (ConstructRef cstr) u modlist
with
- | Not_found -> map_constr substrec c)
+ | Not_found -> Constr.map substrec c)
| Const (cst,u) ->
(try
share_univs (ConstRef cst) u modlist
with
- | Not_found -> map_constr substrec c)
+ | Not_found -> Constr.map substrec c)
| Proj (p, c') ->
(try
let p' = share_univs (ConstRef (Projection.constant p)) Univ.Instance.empty modlist in
let make c = Projection.make c (Projection.unfolded p) in
- match kind_of_term p' with
+ match kind p' with
| Const (p',_) -> mkProj (make p', substrec c')
| App (f, args) ->
- (match kind_of_term f with
+ (match kind f with
| Const (p', _) -> mkProj (make p', substrec c')
| _ -> assert false)
| _ -> assert false
- with Not_found -> map_constr substrec c)
+ with Not_found -> Constr.map substrec c)
- | _ -> map_constr substrec c
+ | _ -> Constr.map substrec c
in
if is_empty_modlist modlist then c
@@ -167,43 +168,52 @@ let on_body ml hy f = function
{ Opaqueproof.modlist = ml; abstract = hy } o)
let expmod_constr_subst cache modlist subst c =
+ let subst = Univ.make_instance_subst subst in
let c = expmod_constr cache modlist c in
Vars.subst_univs_level_constr subst c
-let cook_constr { Opaqueproof.modlist ; abstract } c =
+let cook_constr { Opaqueproof.modlist ; abstract = (vars, subst, _) } c =
let cache = RefTable.create 13 in
- let expmod = expmod_constr_subst cache modlist (pi2 abstract) in
- let hyps = Context.Named.map expmod (pi1 abstract) in
+ let expmod = expmod_constr_subst cache modlist subst in
+ let hyps = Context.Named.map expmod vars in
abstract_constant_body (expmod c) hyps
-let lift_univs cb subst =
+let lift_univs cb subst auctx0 =
match cb.const_universes with
- | Monomorphic_const ctx -> subst, (Monomorphic_const ctx)
- | Polymorphic_const auctx ->
- if (Univ.LMap.is_empty subst) then
- subst, (Polymorphic_const auctx)
+ | Monomorphic_const ctx ->
+ assert (AUContext.is_empty auctx0);
+ subst, (Monomorphic_const ctx)
+ | Polymorphic_const auctx ->
+ (** Given a named instance [subst := uâ‚€ ... uₙ₋â‚] together with an abstract
+ context [auctx0 := 0 ... n - 1 |= C{0, ..., n - 1}] of the same length,
+ and another abstract context relative to the former context
+ [auctx := 0 ... m - 1 |= C'{uâ‚€, ..., uₙ₋â‚, 0, ..., m - 1}],
+ construct the lifted abstract universe context
+ [0 ... n - 1 n ... n + m - 1 |=
+ C{0, ... n - 1} ∪
+ C'{0, ..., n - 1, n, ..., n + m - 1} ]
+ together with the instance
+ [u₀ ... uₙ₋₠Var(0) ... Var (m - 1)].
+ *)
+ if (Univ.Instance.is_empty subst) then
+ (** Still need to take the union for the constraints between globals *)
+ subst, (Polymorphic_const (AUContext.union auctx0 auctx))
else
- let len = Univ.LMap.cardinal subst in
- let rec gen_subst i acc =
- if i < 0 then acc
- else
- let acc = Univ.LMap.add (Level.var i) (Level.var (i + len)) acc in
- gen_subst (pred i) acc
- in
- let subst = gen_subst (Univ.AUContext.size auctx - 1) subst in
- let auctx' = Univ.subst_univs_level_abstract_universe_context subst auctx in
- subst, (Polymorphic_const auctx')
+ let ainst = Univ.make_abstract_instance auctx in
+ let subst = Instance.append subst ainst in
+ let auctx' = Univ.subst_univs_level_abstract_universe_context (Univ.make_instance_subst subst) auctx in
+ subst, (Polymorphic_const (AUContext.union auctx0 auctx'))
let cook_constant ~hcons env { from = cb; info } =
let { Opaqueproof.modlist; abstract } = info in
let cache = RefTable.create 13 in
let abstract, usubst, abs_ctx = abstract in
- let usubst, univs = lift_univs cb usubst in
+ let usubst, univs = lift_univs cb usubst abs_ctx in
let expmod = expmod_constr_subst cache modlist usubst in
let hyps = Context.Named.map expmod abstract in
let map c =
let c = abstract_constant_body (expmod c) hyps in
- if hcons then hcons_constr c else c
+ if hcons then Constr.hcons c else c
in
let body = on_body modlist (hyps, usubst, abs_ctx)
map
@@ -222,7 +232,7 @@ let cook_constant ~hcons env { from = cb; info } =
let ((mind, _), _), n' =
try
let c' = share_univs cache (IndRef (pb.proj_ind,0)) Univ.Instance.empty modlist in
- match kind_of_term c' with
+ match kind c' with
| App (f,l) -> (destInd f, Array.length l)
| Ind ind -> ind, 0
| _ -> assert false
@@ -233,13 +243,6 @@ let cook_constant ~hcons env { from = cb; info } =
proj_eta = etab, etat;
proj_type = ty'; proj_body = c' }
in
- let univs =
- match univs with
- | Monomorphic_const ctx ->
- assert (AUContext.is_empty abs_ctx); univs
- | Polymorphic_const auctx ->
- Polymorphic_const (AUContext.union abs_ctx auctx)
- in
{
cook_body = body;
cook_type = typ;
@@ -249,7 +252,7 @@ let cook_constant ~hcons env { from = cb; info } =
cook_context = Some const_hyps;
}
-(* let cook_constant_key = Profile.declare_profile "cook_constant" *)
-(* let cook_constant = Profile.profile2 cook_constant_key cook_constant *)
+(* let cook_constant_key = CProfile.declare_profile "cook_constant" *)
+(* let cook_constant = CProfile.profile2 cook_constant_key cook_constant *)
let expmod_constr modlist c = expmod_constr (RefTable.create 13) modlist c
diff --git a/kernel/cooking.mli b/kernel/cooking.mli
index 6d1b776c0..7696d7545 100644
--- a/kernel/cooking.mli
+++ b/kernel/cooking.mli
@@ -6,7 +6,7 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-open Term
+open Constr
open Declarations
open Environ
@@ -26,7 +26,7 @@ type result = {
}
val cook_constant : hcons:bool -> env -> recipe -> result
-val cook_constr : Opaqueproof.cooking_info -> Term.constr -> Term.constr
+val cook_constr : Opaqueproof.cooking_info -> constr -> constr
(** {6 Utility functions used in module [Discharge]. } *)
diff --git a/kernel/csymtable.ml b/kernel/csymtable.ml
index d21ea9670..2bbb867cd 100644
--- a/kernel/csymtable.ml
+++ b/kernel/csymtable.ml
@@ -14,8 +14,8 @@
open Util
open Names
-open Term
-open Vm
+open Constr
+open Vmvalues
open Cemitcodes
open Cbytecodes
open Declarations
@@ -68,7 +68,7 @@ let rec eq_structured_constant c1 c2 = match c1, c2 with
| Const_bn (t1, a1), Const_bn (t2, a2) ->
Int.equal t1 t2 && Array.equal eq_structured_constant a1 a2
| Const_bn _, _ -> false
-| Const_univ_level l1 , Const_univ_level l2 -> Univ.eq_levels l1 l2
+| Const_univ_level l1 , Const_univ_level l2 -> Univ.Level.equal l1 l2
| Const_univ_level _ , _ -> false
| Const_type u1 , Const_type u2 -> Univ.Universe.equal u1 u2
| Const_type _ , _ -> false
@@ -198,7 +198,7 @@ and slot_for_fv env fv =
let rv = Pre_env.lookup_rel_val i env in
begin match force_lazy_val rv with
| None ->
- env.env_rel_context |> Context.Rel.lookup i |> RelDecl.get_value |> fill_fv_cache rv i val_of_rel env_of_rel
+ env |> Pre_env.lookup_rel i |> RelDecl.get_value |> fill_fv_cache rv i val_of_rel env_of_rel
| Some (v, _) -> v
end
| FVuniv_var idu ->
diff --git a/kernel/csymtable.mli b/kernel/csymtable.mli
index 633cf0abd..fc935f6ee 100644
--- a/kernel/csymtable.mli
+++ b/kernel/csymtable.mli
@@ -9,10 +9,10 @@
(* $Id$ *)
open Names
-open Term
+open Constr
open Pre_env
-val val_of_constr : env -> constr -> values
+val val_of_constr : env -> constr -> Vmvalues.values
-val set_opaque_const : constant -> unit
-val set_transparent_const : constant -> unit
+val set_opaque_const : Constant.t -> unit
+val set_transparent_const : Constant.t -> unit
diff --git a/kernel/declarations.ml b/kernel/declarations.ml
index e17fb1c38..5b9e1a141 100644
--- a/kernel/declarations.ml
+++ b/kernel/declarations.ml
@@ -7,7 +7,7 @@
(************************************************************************)
open Names
-open Term
+open Constr
(** This module defines the internal representation of global
declarations. This includes global constants/axioms, mutual
@@ -28,8 +28,8 @@ type engagement = set_predicativity
*)
type template_arity = {
- template_param_levels : Univ.universe_level option list;
- template_level : Univ.universe;
+ template_param_levels : Univ.Level.t option list;
+ template_level : Univ.Universe.t;
}
type ('a, 'b) declaration_arity =
@@ -48,7 +48,7 @@ type inline = int option
always transparent. *)
type projection_body = {
- proj_ind : mutual_inductive;
+ proj_ind : MutInd.t;
proj_npars : int;
proj_arg : int;
proj_type : types; (* Type under params *)
@@ -63,8 +63,8 @@ type constant_def =
| OpaqueDef of Opaqueproof.opaque (** or an opaque global definition *)
type constant_universes =
- | Monomorphic_const of Univ.universe_context
- | Polymorphic_const of Univ.abstract_universe_context
+ | Monomorphic_const of Univ.ContextSet.t
+ | Polymorphic_const of Univ.AUContext.t
(** The [typing_flags] are instructions to the type-checker which
modify its behaviour. The typing flags used in the type-checking
@@ -74,6 +74,7 @@ type typing_flags = {
check_guarded : bool; (** If [false] then fixed points and co-fixed
points are assumed to be total. *)
check_universes : bool; (** If [false] universe constraints are not checked *)
+ conv_oracle : Conv_oracle.oracle; (** Unfolding strategies for conversion *)
}
(* some contraints are in constant_constraints, some other may be in
@@ -115,11 +116,11 @@ v}
- The constants associated to each projection.
- The checked projection bodies. *)
-type record_body = (Id.t * constant array * projection_body array) option
+type record_body = (Id.t * Constant.t array * projection_body array) option
type regular_inductive_arity = {
mind_user_arity : types;
- mind_sort : sorts;
+ mind_sort : Sorts.t;
}
type inductive_arity = (regular_inductive_arity, template_arity) declaration_arity
@@ -146,7 +147,7 @@ type one_inductive_body = {
mind_nrealdecls : int; (** Length of realargs context (with let, no params) *)
- mind_kelim : sorts_family list; (** List of allowed elimination sorts *)
+ mind_kelim : Sorts.family list; (** List of allowed elimination sorts *)
mind_nf_lc : types array; (** Head normalized constructor types so that their conclusion exposes the inductive type *)
@@ -168,9 +169,14 @@ type one_inductive_body = {
}
type abstract_inductive_universes =
- | Monomorphic_ind of Univ.universe_context
- | Polymorphic_ind of Univ.abstract_universe_context
- | Cumulative_ind of Univ.abstract_cumulativity_info
+ | Monomorphic_ind of Univ.ContextSet.t
+ | Polymorphic_ind of Univ.AUContext.t
+ | Cumulative_ind of Univ.ACumulativityInfo.t
+
+type recursivity_kind =
+ | Finite (** = inductive *)
+ | CoFinite (** = coinductive *)
+ | BiFinite (** = non-recursive, like in "Record" definitions *)
type mutual_inductive_body = {
@@ -178,7 +184,7 @@ type mutual_inductive_body = {
mind_record : record_body option; (** The record information *)
- mind_finite : Decl_kinds.recursivity_kind; (** Whether the type is inductive or coinductive *)
+ mind_finite : recursivity_kind; (** Whether the type is inductive or coinductive *)
mind_ntypes : int; (** Number of types in the block *)
@@ -212,12 +218,12 @@ type ('ty,'a) functorize =
only for short module printing and for extraction. *)
type with_declaration =
- | WithMod of Id.t list * module_path
+ | WithMod of Id.t list * ModPath.t
| WithDef of Id.t list * constr Univ.in_universe_context
type module_alg_expr =
- | MEident of module_path
- | MEapply of module_alg_expr * module_path
+ | MEident of ModPath.t
+ | MEapply of module_alg_expr * ModPath.t
| MEwith of module_alg_expr * with_declaration
(** A component of a module structure *)
@@ -251,7 +257,7 @@ and module_implementation =
| FullStruct (** special case of [Struct] : the body is exactly [mod_type] *)
and 'a generic_module_body =
- { mod_mp : module_path; (** absolute path of the module *)
+ { mod_mp : ModPath.t; (** absolute path of the module *)
mod_expr : 'a; (** implementation *)
mod_type : module_signature; (** expanded type *)
mod_type_alg : module_expression option; (** algebraic type *)
@@ -290,5 +296,5 @@ and _ module_retroknowledge =
- A module application is atomic, for instance ((M N) P) :
* the head of [MEapply] can only be another [MEapply] or a [MEident]
- * the argument of [MEapply] is now directly forced to be a [module_path].
+ * the argument of [MEapply] is now directly forced to be a [ModPath.t].
*)
diff --git a/kernel/declareops.ml b/kernel/declareops.ml
index 66d66c7d0..9eed9efcb 100644
--- a/kernel/declareops.ml
+++ b/kernel/declareops.ml
@@ -15,9 +15,10 @@ module RelDecl = Context.Rel.Declaration
(** Operations concernings types in [Declarations] :
[constant_body], [mutual_inductive_body], [module_body] ... *)
-let safe_flags = {
+let safe_flags oracle = {
check_guarded = true;
check_universes = true;
+ conv_oracle = oracle;
}
(** {6 Arities } *)
@@ -112,7 +113,7 @@ let subst_const_body sub cb =
themselves. But would it really bring substantial gains ? *)
let hcons_rel_decl =
- RelDecl.map_name Names.Name.hcons %> RelDecl.map_value Term.hcons_constr %> RelDecl.map_type Term.hcons_types
+ RelDecl.map_name Names.Name.hcons %> RelDecl.map_value Constr.hcons %> RelDecl.map_type Constr.hcons
let hcons_rel_context l = List.smartmap hcons_rel_decl l
@@ -120,20 +121,20 @@ let hcons_const_def = function
| Undef inl -> Undef inl
| Def l_constr ->
let constr = force_constr l_constr in
- Def (from_val (Term.hcons_constr constr))
+ Def (from_val (Constr.hcons constr))
| OpaqueDef _ as x -> x (* hashconsed when turned indirect *)
let hcons_const_universes cbu =
match cbu with
| Monomorphic_const ctx ->
- Monomorphic_const (Univ.hcons_universe_context ctx)
+ Monomorphic_const (Univ.hcons_universe_context_set ctx)
| Polymorphic_const ctx ->
Polymorphic_const (Univ.hcons_abstract_universe_context ctx)
let hcons_const_body cb =
{ cb with
const_body = hcons_const_def cb.const_body;
- const_type = Term.hcons_constr cb.const_type;
+ const_type = Constr.hcons cb.const_type;
const_universes = hcons_const_universes cb.const_universes }
(** {6 Inductive types } *)
@@ -249,8 +250,8 @@ let inductive_is_cumulative mib =
(** {6 Hash-consing of inductive declarations } *)
let hcons_regular_ind_arity a =
- { mind_user_arity = Term.hcons_constr a.mind_user_arity;
- mind_sort = Term.hcons_sorts a.mind_sort }
+ { mind_user_arity = Constr.hcons a.mind_user_arity;
+ mind_sort = Sorts.hcons a.mind_sort }
(** Just as for constants, this hash-consing is quite partial *)
@@ -260,8 +261,8 @@ let hcons_ind_arity =
(** Substitution of inductive declarations *)
let hcons_mind_packet oib =
- let user = Array.smartmap Term.hcons_types oib.mind_user_lc in
- let nf = Array.smartmap Term.hcons_types oib.mind_nf_lc in
+ let user = Array.smartmap Constr.hcons oib.mind_user_lc in
+ let nf = Array.smartmap Constr.hcons oib.mind_nf_lc in
(* Special optim : merge [mind_user_lc] and [mind_nf_lc] if possible *)
let nf = if Array.equal (==) user nf then user else nf in
{ oib with
@@ -274,7 +275,7 @@ let hcons_mind_packet oib =
let hcons_mind_universes miu =
match miu with
- | Monomorphic_ind ctx -> Monomorphic_ind (Univ.hcons_universe_context ctx)
+ | Monomorphic_ind ctx -> Monomorphic_ind (Univ.hcons_universe_context_set ctx)
| Polymorphic_ind ctx -> Polymorphic_ind (Univ.hcons_abstract_universe_context ctx)
| Cumulative_ind cui -> Cumulative_ind (Univ.hcons_abstract_cumulativity_info cui)
@@ -287,9 +288,9 @@ let hcons_mind mib =
(** {6 Stm machinery } *)
let string_of_side_effect { Entries.eff } = match eff with
- | Entries.SEsubproof (c,_,_) -> "P(" ^ Names.string_of_con c ^ ")"
+ | Entries.SEsubproof (c,_,_) -> "P(" ^ Names.Constant.to_string c ^ ")"
| Entries.SEscheme (cl,_) ->
- "S(" ^ String.concat ", " (List.map (fun (_,c,_,_) -> Names.string_of_con c) cl) ^ ")"
+ "S(" ^ String.concat ", " (List.map (fun (_,c,_,_) -> Names.Constant.to_string c) cl) ^ ")"
(** Hashconsing of modules *)
diff --git a/kernel/declareops.mli b/kernel/declareops.mli
index b2d29759d..0eed11f49 100644
--- a/kernel/declareops.mli
+++ b/kernel/declareops.mli
@@ -27,7 +27,7 @@ val subst_const_body : substitution -> constant_body -> constant_body
val constant_has_body : constant_body -> bool
-val constant_polymorphic_context : constant_body -> abstract_universe_context
+val constant_polymorphic_context : constant_body -> AUContext.t
(** Is the constant polymorphic? *)
val constant_is_polymorphic : constant_body -> bool
@@ -57,7 +57,7 @@ val subst_wf_paths : substitution -> wf_paths -> wf_paths
val subst_mind_body : substitution -> mutual_inductive_body -> mutual_inductive_body
-val inductive_polymorphic_context : mutual_inductive_body -> abstract_universe_context
+val inductive_polymorphic_context : mutual_inductive_body -> AUContext.t
(** Is the inductive polymorphic? *)
val inductive_is_polymorphic : mutual_inductive_body -> bool
@@ -67,7 +67,7 @@ val inductive_is_cumulative : mutual_inductive_body -> bool
(** {6 Kernel flags} *)
(** A default, safe set of flags for kernel type-checking *)
-val safe_flags : typing_flags
+val safe_flags : Conv_oracle.oracle -> typing_flags
(** {6 Hash-consing} *)
diff --git a/kernel/entries.ml b/kernel/entries.ml
index a1ccbdbc1..36b75668b 100644
--- a/kernel/entries.ml
+++ b/kernel/entries.ml
@@ -7,7 +7,7 @@
(************************************************************************)
open Names
-open Term
+open Constr
(** This module defines the entry types for global declarations. This
information is entered in the environments. This includes global
@@ -35,9 +35,9 @@ then, in i{^ th} block, [mind_entry_params] is [xn:Xn;...;x1:X1];
*)
type inductive_universes =
- | Monomorphic_ind_entry of Univ.universe_context
- | Polymorphic_ind_entry of Univ.universe_context
- | Cumulative_ind_entry of Univ.cumulativity_info
+ | Monomorphic_ind_entry of Univ.ContextSet.t
+ | Polymorphic_ind_entry of Univ.UContext.t
+ | Cumulative_ind_entry of Univ.CumulativityInfo.t
type one_inductive_entry = {
mind_entry_typename : Id.t;
@@ -51,7 +51,7 @@ type mutual_inductive_entry = {
(** Some (Some id): primitive record with id the binder name of the record
in projections.
Some None: non-primitive record *)
- mind_entry_finite : Decl_kinds.recursivity_kind;
+ mind_entry_finite : Declarations.recursivity_kind;
mind_entry_params : (Id.t * local_entry) list;
mind_entry_inds : one_inductive_entry list;
mind_entry_universes : inductive_universes;
@@ -65,8 +65,10 @@ type 'a proof_output = constr Univ.in_universe_context_set * 'a
type 'a const_entry_body = 'a proof_output Future.computation
type constant_universes_entry =
- | Monomorphic_const_entry of Univ.universe_context
- | Polymorphic_const_entry of Univ.universe_context
+ | Monomorphic_const_entry of Univ.ContextSet.t
+ | Polymorphic_const_entry of Univ.UContext.t
+
+type 'a in_constant_universes_entry = 'a * constant_universes_entry
type 'a definition_entry = {
const_entry_body : 'a const_entry_body;
@@ -79,13 +81,20 @@ type 'a definition_entry = {
const_entry_opaque : bool;
const_entry_inline_code : bool }
+type section_def_entry = {
+ secdef_body : constr;
+ secdef_secctx : Context.Named.t option;
+ secdef_feedback : Stateid.t option;
+ secdef_type : types option;
+}
+
type inline = int option (* inlining level, None for no inlining *)
type parameter_entry =
- Context.Named.t option * bool * types Univ.in_universe_context * inline
+ Context.Named.t option * types in_constant_universes_entry * inline
type projection_entry = {
- proj_entry_ind : mutual_inductive;
+ proj_entry_ind : MutInd.t;
proj_entry_arg : int }
type 'a constant_entry =
@@ -112,11 +121,11 @@ 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.universe_context_set ]
+ | `Opaque of Constr.t * Univ.ContextSet.t ]
type side_eff =
- | SEsubproof of constant * Declarations.constant_body * seff_env
- | SEscheme of (inductive * constant * Declarations.constant_body * seff_env) list * string
+ | SEsubproof of Constant.t * Declarations.constant_body * seff_env
+ | SEscheme of (inductive * Constant.t * Declarations.constant_body * seff_env) list * string
type side_effect = {
from_env : Declarations.structure_body CEphemeron.key;
diff --git a/kernel/environ.ml b/kernel/environ.ml
index c3fd8962e..738ecc6e1 100644
--- a/kernel/environ.ml
+++ b/kernel/environ.ml
@@ -23,7 +23,7 @@
open CErrors
open Util
open Names
-open Term
+open Constr
open Vars
open Declarations
open Pre_env
@@ -37,8 +37,10 @@ type env = Pre_env.env
let pre_env env = env
let env_of_pre_env env = env
-let oracle env = env.env_conv_oracle
-let set_oracle env o = { env with env_conv_oracle = o }
+let oracle env = env.env_typing_flags.conv_oracle
+let set_oracle env o =
+ let env_typing_flags = { env.env_typing_flags with conv_oracle = o } in
+ { env with env_typing_flags }
let empty_named_context_val = empty_named_context_val
@@ -58,18 +60,17 @@ let deactivated_guard env = not (typing_flags env).check_guarded
let universes env = env.env_stratification.env_universes
let named_context env = env.env_named_context.env_named_ctx
let named_context_val env = env.env_named_context
-let rel_context env = env.env_rel_context
+let rel_context env = env.env_rel_context.env_rel_ctx
let opaque_tables env = env.indirect_pterms
let set_opaque_tables env indirect_pterms = { env with indirect_pterms }
let empty_context env =
- match env.env_rel_context, env.env_named_context.env_named_ctx with
+ match env.env_rel_context.env_rel_ctx, env.env_named_context.env_named_ctx with
| [], [] -> true
| _ -> false
(* Rel context *)
-let lookup_rel n env =
- Context.Rel.lookup n env.env_rel_context
+let lookup_rel = lookup_rel
let evaluable_rel n env =
is_local_def (lookup_rel n env)
@@ -86,13 +87,12 @@ let push_rec_types (lna,typarray,_) env =
let fold_rel_context f env ~init =
let rec fold_right env =
- match env.env_rel_context with
- | [] -> init
- | rd::rc ->
+ match match_rel_context_val env.env_rel_context with
+ | None -> init
+ | Some (rd, _, rc) ->
let env =
{ env with
env_rel_context = rc;
- env_rel_val = List.tl env.env_rel_val;
env_nb_rel = env.env_nb_rel - 1 } in
f env rd (fold_right env)
in fold_right env
@@ -142,16 +142,21 @@ let evaluable_named id env =
let reset_with_named_context ctxt env =
{ env with
env_named_context = ctxt;
- env_rel_context = Context.Rel.empty;
- env_rel_val = [];
+ env_rel_context = empty_rel_context_val;
env_nb_rel = 0 }
let reset_context = reset_with_named_context empty_named_context_val
let pop_rel_context n env =
+ let rec skip n ctx =
+ if Int.equal n 0 then ctx
+ else match match_rel_context_val ctx with
+ | None -> invalid_arg "List.skipn"
+ | Some (_, _, ctx) -> skip (pred n) ctx
+ in
let ctxt = env.env_rel_context in
{ env with
- env_rel_context = List.skipn n ctxt;
+ env_rel_context = skip n ctxt;
env_nb_rel = env.env_nb_rel - n }
let fold_named_context f env ~init =
@@ -249,31 +254,10 @@ let constant_context env kn =
| Monomorphic_const _ -> Univ.AUContext.empty
| Polymorphic_const ctx -> ctx
-type const_evaluation_result = NoBody | Opaque | IsProj
+type const_evaluation_result = NoBody | Opaque
exception NotEvaluableConst of const_evaluation_result
-let constant_value env (kn,u) =
- let cb = lookup_constant kn env in
- if cb.const_proj = None then
- match cb.const_body with
- | Def l_body ->
- begin
- match cb.const_universes with
- | Monomorphic_const _ ->
- (Mod_subst.force_constr l_body, Univ.Constraint.empty)
- | Polymorphic_const _ ->
- let csts = constraints_of cb u in
- (subst_instance_constr u (Mod_subst.force_constr l_body), csts)
- end
- | OpaqueDef _ -> raise (NotEvaluableConst Opaque)
- | Undef _ -> raise (NotEvaluableConst NoBody)
- else raise (NotEvaluableConst IsProj)
-
-let constant_opt_value env cst =
- try Some (constant_value env cst)
- with NotEvaluableConst _ -> None
-
let constant_value_and_type env (kn, u) =
let cb = lookup_constant kn env in
if Declareops.constant_is_polymorphic cb then
@@ -391,7 +375,7 @@ let lookup_constructor_variables (ind,_) env =
(* Returns the list of global variables in a term *)
let vars_of_global env constr =
- match kind_of_term constr with
+ match kind constr with
Var id -> Id.Set.singleton id
| Const (kn, _) -> lookup_constant_variables kn env
| Ind (ind, _) -> lookup_inductive_variables ind env
@@ -402,12 +386,12 @@ let vars_of_global env constr =
let global_vars_set env constr =
let rec filtrec acc c =
let acc =
- match kind_of_term c with
+ match kind c with
| Var _ | Const _ | Ind _ | Construct _ ->
Id.Set.union (vars_of_global env c) acc
| _ ->
acc in
- Term.fold_constr filtrec acc c
+ Constr.fold filtrec acc c
in
filtrec Id.Set.empty constr
@@ -478,7 +462,7 @@ let j_type j = j.uj_type
type 'types punsafe_type_judgment = {
utj_val : 'types;
- utj_type : sorts }
+ utj_type : Sorts.t }
type unsafe_type_judgment = types punsafe_type_judgment
@@ -538,7 +522,7 @@ let register_one env field entry =
let register env field entry =
match field with
| KInt31 (grp, Int31Type) ->
- let i31c = match kind_of_term entry with
+ let i31c = match kind entry with
| Ind i31t -> mkConstructUi (i31t, 1)
| _ -> anomaly ~label:"Environ.register" (Pp.str "should be an inductive type.")
in
@@ -584,7 +568,7 @@ let dispatch =
fun rk value field ->
(* subfunction which shortens the (very common) dispatch of operations *)
let int31_op_from_const n op prim =
- match kind_of_term value with
+ match kind value with
| Const kn -> int31_op n op prim kn
| _ -> anomaly ~label:"Environ.register" (Pp.str "should be a constant.")
in
@@ -601,13 +585,13 @@ fun rk value field ->
(Pp.str "add_int31_decompilation_from_type called with an abnormal field.")
in
let i31bit_type =
- match kind_of_term int31bit with
+ match kind int31bit with
| Ind (i31bit_type,_) -> i31bit_type
| _ -> anomaly ~label:"Environ.register"
(Pp.str "Int31Bits should be an inductive type.")
in
let int31_decompilation =
- match kind_of_term value with
+ match kind value with
| Ind (i31t,_) ->
constr_of_int31 i31t i31bit_type
| _ -> anomaly ~label:"Environ.register"
diff --git a/kernel/environ.mli b/kernel/environ.mli
index 2667ad7ca..69d811a64 100644
--- a/kernel/environ.mli
+++ b/kernel/environ.mli
@@ -7,9 +7,9 @@
(************************************************************************)
open Names
-open Term
-open Declarations
+open Constr
open Univ
+open Declarations
(** Unsafe environments. We define here a datatype for environments.
Since typing is not yet defined, it is not possible to check the
@@ -126,19 +126,19 @@ val pop_rel_context : int -> env -> env
(** {5 Global constants }
{6 Add entries to global environment } *)
-val add_constant : constant -> constant_body -> env -> env
-val add_constant_key : constant -> constant_body -> Pre_env.link_info ->
+val add_constant : Constant.t -> constant_body -> env -> env
+val add_constant_key : Constant.t -> constant_body -> Pre_env.link_info ->
env -> env
(** Looks up in the context of global constant names
raises [Not_found] if the required path is not found *)
-val lookup_constant : constant -> env -> constant_body
-val evaluable_constant : constant -> env -> bool
+val lookup_constant : Constant.t -> env -> constant_body
+val evaluable_constant : Constant.t -> env -> bool
(** New-style polymorphism *)
-val polymorphic_constant : constant -> env -> bool
+val polymorphic_constant : Constant.t -> env -> bool
val polymorphic_pconstant : pconstant -> env -> bool
-val type_in_type_constant : constant -> env -> bool
+val type_in_type_constant : Constant.t -> env -> bool
(** {6 ... } *)
(** [constant_value env c] raises [NotEvaluableConst Opaque] if
@@ -146,38 +146,36 @@ val type_in_type_constant : constant -> env -> bool
body and [NotEvaluableConst IsProj] if [c] is a projection
and [Not_found] if it does not exist in [env] *)
-type const_evaluation_result = NoBody | Opaque | IsProj
+type const_evaluation_result = NoBody | Opaque
exception NotEvaluableConst of const_evaluation_result
-val constant_value : env -> constant puniverses -> constr constrained
-val constant_type : env -> constant puniverses -> types constrained
+val constant_type : env -> Constant.t puniverses -> types constrained
-val constant_opt_value : env -> constant puniverses -> (constr * Univ.constraints) option
-val constant_value_and_type : env -> constant puniverses ->
- constr option * types * Univ.constraints
+val constant_value_and_type : env -> Constant.t puniverses ->
+ constr option * types * Univ.Constraint.t
(** The universe context associated to the constant, empty if not
polymorphic *)
-val constant_context : env -> constant -> Univ.abstract_universe_context
+val constant_context : env -> Constant.t -> Univ.AUContext.t
(* These functions should be called under the invariant that [env]
already contains the constraints corresponding to the constant
application. *)
-val constant_value_in : env -> constant puniverses -> constr
-val constant_type_in : env -> constant puniverses -> types
-val constant_opt_value_in : env -> constant puniverses -> constr option
+val constant_value_in : env -> Constant.t puniverses -> constr
+val constant_type_in : env -> Constant.t puniverses -> types
+val constant_opt_value_in : env -> Constant.t puniverses -> constr option
(** {6 Primitive projections} *)
val lookup_projection : Names.projection -> env -> projection_body
-val is_projection : constant -> env -> bool
+val is_projection : Constant.t -> env -> bool
(** {5 Inductive types } *)
-val add_mind_key : mutual_inductive -> Pre_env.mind_key -> env -> env
-val add_mind : mutual_inductive -> mutual_inductive_body -> env -> env
+val add_mind_key : MutInd.t -> Pre_env.mind_key -> env -> env
+val add_mind : MutInd.t -> mutual_inductive_body -> env -> env
(** Looks up in the context of global inductive names
raises [Not_found] if the required path is not found *)
-val lookup_mind : mutual_inductive -> env -> mutual_inductive_body
+val lookup_mind : MutInd.t -> env -> mutual_inductive_body
(** New-style polymorphism *)
val polymorphic_ind : inductive -> env -> bool
@@ -195,20 +193,20 @@ val add_modtype : module_type_body -> env -> env
(** [shallow_add_module] does not add module components *)
val shallow_add_module : module_body -> env -> env
-val lookup_module : module_path -> env -> module_body
-val lookup_modtype : module_path -> env -> module_type_body
+val lookup_module : ModPath.t -> env -> module_body
+val lookup_modtype : ModPath.t -> env -> module_type_body
(** {5 Universe constraints } *)
(** Add universe constraints to the environment.
@raises UniverseInconsistency
*)
-val add_constraints : Univ.constraints -> env -> env
+val add_constraints : Univ.Constraint.t -> env -> env
(** Check constraints are satifiable in the environment. *)
-val check_constraints : Univ.constraints -> env -> bool
-val push_context : ?strict:bool -> Univ.universe_context -> env -> env
-val push_context_set : ?strict:bool -> Univ.universe_context_set -> env -> env
+val check_constraints : Univ.Constraint.t -> env -> bool
+val push_context : ?strict:bool -> Univ.UContext.t -> env -> env
+val push_context_set : ?strict:bool -> Univ.ContextSet.t -> env -> env
val push_constraints_to_env : 'a Univ.constrained -> env -> env
val set_engagement : engagement -> env -> env
@@ -247,7 +245,7 @@ val j_type : ('constr, 'types) punsafe_judgment -> 'types
type 'types punsafe_type_judgment = {
utj_val : 'types;
- utj_type : sorts }
+ utj_type : Sorts.t }
type unsafe_type_judgment = types punsafe_type_judgment
diff --git a/kernel/evar.ml b/kernel/evar.ml
index e63665f51..dcd2e12a0 100644
--- a/kernel/evar.ml
+++ b/kernel/evar.ml
@@ -13,6 +13,7 @@ let unsafe_of_int x = x
let compare = Int.compare
let equal = Int.equal
let hash = Int.hash
+let print x = Pp.(str "?X" ++ int x)
module Set = Int.Set
module Map = Int.Map
diff --git a/kernel/evar.mli b/kernel/evar.mli
index eee6680fb..6a058207f 100644
--- a/kernel/evar.mli
+++ b/kernel/evar.mli
@@ -30,5 +30,8 @@ val compare : t -> t -> int
val hash : t -> int
(** Hash over existential variables. *)
+val print : t -> Pp.t
+(** Printing representation *)
+
module Set : Set.S with type elt = t
module Map : CMap.ExtS with type key = t and module Set := Set
diff --git a/kernel/indtypes.ml b/kernel/indtypes.ml
index e248436ec..b117f8714 100644
--- a/kernel/indtypes.ml
+++ b/kernel/indtypes.ml
@@ -11,6 +11,7 @@ open Util
open Names
open Univ
open Term
+open Constr
open Vars
open Declarations
open Declareops
@@ -130,11 +131,11 @@ let is_unit constrsinfos =
let infos_and_sort env t =
let rec aux env t max =
let t = whd_all env t in
- match kind_of_term t with
+ match kind t with
| Prod (name,c1,c2) ->
let varj = infer_type env c1 in
let env1 = Environ.push_rel (LocalAssum (name,varj.utj_val)) env in
- let max = Universe.sup max (univ_of_sort varj.utj_type) in
+ let max = Universe.sup max (Sorts.univ_of_sort varj.utj_type) in
aux env1 c2 max
| _ when is_constructor_head t -> max
| _ -> (* don't fail if not positive, it is tested later *) max
@@ -168,7 +169,7 @@ let infer_constructor_packet env_ar_par params lc =
let jlc = List.map (infer_type env_ar_par) lc in
let jlc = Array.of_list jlc in
(* generalize the constructor over the parameters *)
- let lc'' = Array.map (fun j -> it_mkProd_or_LetIn j.utj_val params) jlc in
+ let lc'' = Array.map (fun j -> Term.it_mkProd_or_LetIn j.utj_val params) jlc in
(* compute the max of the sorts of the products of the constructors types *)
let levels = List.map (infos_and_sort env_ar_par) lc in
let isunit = is_unit levels in
@@ -183,7 +184,7 @@ let cumulate_arity_large_levels env sign =
match d with
| LocalAssum (_,t) ->
let tj = infer_type env t in
- let u = univ_of_sort tj.utj_type in
+ let u = Sorts.univ_of_sort tj.utj_type in
(Universe.sup u lev, push_rel d env)
| LocalDef _ ->
lev, push_rel d env)
@@ -199,8 +200,8 @@ let is_impredicative env u =
let param_ccls paramsctxt =
let fold acc = function
| (LocalAssum (_, p)) ->
- (let c = strip_prod_assum p in
- match kind_of_term c with
+ (let c = Term.strip_prod_assum p in
+ match kind c with
| Sort (Type u) -> Univ.Universe.level u
| _ -> None) :: acc
| LocalDef _ -> acc
@@ -208,7 +209,7 @@ let param_ccls paramsctxt =
List.fold_left fold [] paramsctxt
(* Check arities and constructors *)
-let check_subtyping_arity_constructor env (subst : constr -> constr) (arcn : Term.types) numparams is_arity =
+let check_subtyping_arity_constructor env (subst : constr -> constr) (arcn : types) numparams is_arity =
let numchecked = ref 0 in
let basic_check ev tp =
if !numchecked < numparams then () else conv_leq ev tp (subst tp);
@@ -264,13 +265,12 @@ let typecheck_inductive env mie =
(* Check unicity of names *)
mind_check_names mie;
(* Params are typed-checked here *)
- let univctx =
+ let env' =
match mie.mind_entry_universes with
- | Monomorphic_ind_entry ctx -> ctx
- | Polymorphic_ind_entry ctx -> ctx
- | Cumulative_ind_entry cumi -> Univ.CumulativityInfo.univ_context cumi
+ | Monomorphic_ind_entry ctx -> push_context_set ctx env
+ | Polymorphic_ind_entry ctx -> push_context ctx env
+ | Cumulative_ind_entry cumi -> push_context (Univ.CumulativityInfo.univ_context cumi) env
in
- let env' = push_context univctx env in
let (env_params,paramsctxt) = infer_local_decls env' mie.mind_entry_params in
(* We first type arity of each inductive definition *)
(* This allows building the environment of arities and to share *)
@@ -288,7 +288,7 @@ let typecheck_inductive env mie =
(** We have an algebraic universe as the conclusion of the arity,
typecheck the dummy Π ctx, Prop and do a special case for the conclusion.
*)
- let proparity = infer_type env_params (mkArity (ctx, prop_sort)) in
+ let proparity = infer_type env_params (mkArity (ctx, Sorts.prop)) in
let (cctx, _) = destArity proparity.utj_val in
(* Any universe is well-formed, we don't need to check [s] here *)
mkArity (cctx, s)
@@ -350,7 +350,7 @@ let typecheck_inductive env mie =
| None -> clev
in
let full_polymorphic () =
- let defu = Term.univ_of_sort def_level in
+ let defu = Sorts.univ_of_sort def_level in
let is_natural =
type_in_type env || (UGraph.check_leq (universes env') infu defu)
in
@@ -468,7 +468,7 @@ let check_correct_par (env,n,ntypes,_) paramdecls ind_index args =
| LocalDef _ :: paramdecls ->
check param_index (paramdecl_index+1) paramdecls
| _::paramdecls ->
- match kind_of_term (whd_all env params.(param_index)) with
+ match kind (whd_all env params.(param_index)) with
| Rel w when Int.equal w paramdecl_index ->
check (param_index-1) (paramdecl_index+1) paramdecls
| _ ->
@@ -495,7 +495,7 @@ if Int.equal nmr 0 then 0 else
| (_,[]) -> assert false (* |paramsctxt|>=nmr *)
| (lp, LocalDef _ :: paramsctxt) -> find k (index-1) (lp,paramsctxt)
| (p::lp,_::paramsctxt) ->
- ( match kind_of_term (whd_all env p) with
+ ( match kind (whd_all env p) with
| Rel w when Int.equal w index -> find (k+1) (index-1) (lp,paramsctxt)
| _ -> k)
in find 0 (n-1) (lpar,List.rev paramsctxt)
@@ -526,7 +526,7 @@ let ienv_push_inductive (env, n, ntypes, ra_env) ((mi,u),lrecparams) =
let rec ienv_decompose_prod (env,_,_,_ as ienv) n c =
if Int.equal n 0 then (ienv,c) else
let c' = whd_all env c in
- match kind_of_term c' with
+ match kind c' with
Prod(na,a,b) ->
let ienv' = ienv_push_var ienv (na,a,mk_norec) in
ienv_decompose_prod ienv' (n-1) b
@@ -555,7 +555,7 @@ let check_positivity_one ~chkpos recursive (env,_,ntypes,_ as ienv) paramsctxt (
more generally, the arrows may be dependent). *)
let rec check_pos (env, n, ntypes, ra_env as ienv) nmr c =
let x,largs = decompose_app (whd_all env c) in
- match kind_of_term x with
+ match kind x with
| Prod (na,b,d) ->
let () = assert (List.is_empty largs) in
(** If one of the inductives of the mutually inductive
@@ -663,7 +663,7 @@ let check_positivity_one ~chkpos recursive (env,_,ntypes,_ as ienv) paramsctxt (
and check_constructors ienv check_head nmr c =
let rec check_constr_rec (env,n,ntypes,ra_env as ienv) nmr lrec c =
let x,largs = decompose_app (whd_all env c) in
- match kind_of_term x with
+ match kind x with
| Prod (na,b,d) ->
let () = assert (List.is_empty largs) in
@@ -710,7 +710,7 @@ let check_positivity_one ~chkpos recursive (env,_,ntypes,_ as ienv) paramsctxt (
best-effort fashion. *)
let check_positivity ~chkpos kn env_ar_par paramsctxt finite inds =
let ntypes = Array.length inds in
- let recursive = finite != Decl_kinds.BiFinite in
+ let recursive = finite != BiFinite in
let rc = Array.mapi (fun j t -> (Mrec (kn,j),t)) (Rtree.mk_rec_calls ntypes) in
let ra_env_ar = Array.rev_to_list rc in
let nparamsctxt = Context.Rel.length paramsctxt in
@@ -746,7 +746,7 @@ let allowed_sorts is_smashed s =
as well. *)
all_sorts
else
- match family_of_sort s with
+ match Sorts.family s with
(* Type: all elimination allowed: above and below *)
| InType -> all_sorts
(* Smashed Set is necessarily impredicative: forbids large elimination *)
@@ -787,7 +787,7 @@ exception UndefinableExpansion
a substitution of the form [params, x : ind params] *)
let compute_projections ((kn, _ as ind), u as indu) n x nparamargs params
mind_consnrealdecls mind_consnrealargs paramslet ctx =
- let mp, dp, l = repr_mind kn in
+ let mp, dp, l = MutInd.repr3 kn in
(** We build a substitution smashing the lets in the record parameters so
that typechecking projections requires just a substitution and not
matching with a parameter context. *)
@@ -879,9 +879,13 @@ let abstract_inductive_universes iu =
match iu with
| Monomorphic_ind_entry ctx -> (Univ.empty_level_subst, Monomorphic_ind ctx)
| Polymorphic_ind_entry ctx ->
- let (inst, auctx) = Univ.abstract_universes ctx in (inst, Polymorphic_ind auctx)
+ let (inst, auctx) = Univ.abstract_universes ctx in
+ let inst = Univ.make_instance_subst inst in
+ (inst, Polymorphic_ind auctx)
| Cumulative_ind_entry cumi ->
- let (inst, acumi) = Univ.abstract_cumulativity_info cumi in (inst, Cumulative_ind acumi)
+ let (inst, acumi) = Univ.abstract_cumulativity_info cumi in
+ let inst = Univ.make_instance_subst inst in
+ (inst, Cumulative_ind acumi)
let build_inductive env prv iu env_ar paramsctxt kn isrecord isfinite inds nmr recargs =
let ntypes = Array.length inds in
@@ -915,11 +919,11 @@ let build_inductive env prv iu env_ar paramsctxt kn isrecord isfinite inds nmr r
let ar = {template_param_levels = paramlevs; template_level = lev} in
TemplateArity ar, all_sorts
| RegularArity (info,ar,defs) ->
- let s = sort_of_univ defs in
+ let s = Sorts.sort_of_univ defs in
let kelim = allowed_sorts info s in
let ar = RegularArity
{ mind_user_arity = Vars.subst_univs_level_constr substunivs ar;
- mind_sort = sort_of_univ (Univ.subst_univs_level_universe substunivs defs); } in
+ mind_sort = Sorts.sort_of_univ (Univ.subst_univs_level_universe substunivs defs); } in
ar, kelim in
(* Assigning VM tags to constructors *)
let nconst, nblock = ref 0, ref 0 in
diff --git a/kernel/indtypes.mli b/kernel/indtypes.mli
index e4b7c086a..9a9380adb 100644
--- a/kernel/indtypes.mli
+++ b/kernel/indtypes.mli
@@ -7,7 +7,7 @@
(************************************************************************)
open Names
-open Term
+open Constr
open Declarations
open Environ
open Entries
@@ -34,7 +34,7 @@ exception InductiveError of inductive_error
(** The following function does checks on inductive declarations. *)
-val check_inductive : env -> mutual_inductive -> mutual_inductive_entry -> mutual_inductive_body
+val check_inductive : env -> MutInd.t -> mutual_inductive_entry -> mutual_inductive_body
(** The following enforces a system compatible with the univalent model *)
@@ -44,4 +44,4 @@ val is_indices_matter : unit -> bool
val compute_projections : pinductive -> Id.t -> Id.t ->
int -> Context.Rel.t -> int array -> int array ->
Context.Rel.t -> Context.Rel.t ->
- (constant array * projection_body array)
+ (Constant.t array * projection_body array)
diff --git a/kernel/inductive.ml b/kernel/inductive.ml
index a39307368..722705bd7 100644
--- a/kernel/inductive.ml
+++ b/kernel/inductive.ml
@@ -10,7 +10,7 @@ open CErrors
open Util
open Names
open Univ
-open Term
+open Constr
open Vars
open Declarations
open Declareops
@@ -30,22 +30,22 @@ let lookup_mind_specif env (kn,tyi) =
let find_rectype env c =
let (t, l) = decompose_app (whd_all env c) in
- match kind_of_term t with
+ match kind t with
| Ind ind -> (ind, l)
| _ -> raise Not_found
let find_inductive env c =
let (t, l) = decompose_app (whd_all env c) in
- match kind_of_term t with
+ match kind t with
| Ind ind
- when (fst (lookup_mind_specif env (out_punivs ind))).mind_finite <> Decl_kinds.CoFinite -> (ind, l)
+ when (fst (lookup_mind_specif env (out_punivs ind))).mind_finite <> CoFinite -> (ind, l)
| _ -> raise Not_found
let find_coinductive env c =
let (t, l) = decompose_app (whd_all env c) in
- match kind_of_term t with
+ match kind t with
| Ind ind
- when (fst (lookup_mind_specif env (out_punivs ind))).mind_finite == Decl_kinds.CoFinite -> (ind, l)
+ when (fst (lookup_mind_specif env (out_punivs ind))).mind_finite == CoFinite -> (ind, l)
| _ -> raise Not_found
let inductive_params (mib,_) = mib.mind_nparams
@@ -81,7 +81,7 @@ let instantiate_params full t u args sign =
let (rem_args, subs, ty) =
Context.Rel.fold_outside
(fun decl (largs,subs,ty) ->
- match (decl, largs, kind_of_term ty) with
+ match (decl, largs, kind ty) with
| (LocalAssum _, a::args, Prod(_,_,t)) -> (args, a::subs, t)
| (LocalDef (_,b,_), _, LetIn(_,_,_,t)) ->
(largs, (substl subs (subst_instance_constr u b))::subs, t)
@@ -94,9 +94,9 @@ let instantiate_params full t u args sign =
substl subs ty
let full_inductive_instantiate mib u params sign =
- let dummy = prop_sort in
- let t = mkArity (Vars.subst_instance_context u sign,dummy) in
- fst (destArity (instantiate_params true t u params mib.mind_params_ctxt))
+ let dummy = Sorts.prop in
+ let t = Term.mkArity (Vars.subst_instance_context u sign,dummy) in
+ fst (Term.destArity (instantiate_params true t u params mib.mind_params_ctxt))
let full_constructor_instantiate ((mind,_),u,(mib,_),params) t =
let inst_ind = constructor_instantiate mind u mib t in
@@ -128,7 +128,7 @@ where
Remark: Set (predicative) is encoded as Type(0)
*)
-let sort_as_univ = function
+let sort_as_univ = let open Sorts in function
| Type u -> u
| Prop Null -> Universe.type0m
| Prop Pos -> Universe.type0
@@ -192,11 +192,11 @@ let instantiate_universes env ctx ar argsorts =
let level = Univ.subst_univs_universe (Univ.make_subst subst) ar.template_level in
let ty =
(* Singleton type not containing types are interpretable in Prop *)
- if is_type0m_univ level then prop_sort
+ if is_type0m_univ level then Sorts.prop
(* Non singleton type not containing types are interpretable in Set *)
- else if is_type0_univ level then set_sort
+ else if is_type0_univ level then Sorts.set
(* This is a Type with constraints *)
- else Type level
+ else Sorts.Type level
in
(ctx, ty)
@@ -211,9 +211,9 @@ let type_of_inductive_gen ?(polyprop=true) env ((mib,mip),u) paramtyps =
(* The Ocaml extraction cannot handle (yet?) "Prop-polymorphism", i.e.
the situation where a non-Prop singleton inductive becomes Prop
when applied to Prop params *)
- if not polyprop && not (is_type0m_univ ar.template_level) && is_prop_sort s
+ if not polyprop && not (is_type0m_univ ar.template_level) && Sorts.is_prop s
then raise (SingletonInductiveBecomesProp mip.mind_typename);
- mkArity (List.rev ctx,s)
+ Term.mkArity (List.rev ctx,s)
let type_of_inductive env pind =
type_of_inductive_gen env pind [||]
@@ -233,7 +233,7 @@ let type_of_inductive_knowing_parameters env ?(polyprop=true) mip args =
(* The max of an array of universes *)
-let cumulate_constructor_univ u = function
+let cumulate_constructor_univ u = let open Sorts in function
| Prop Null -> u
| Prop Pos -> Universe.sup Universe.type0 u
| Type u' -> Universe.sup u u'
@@ -276,8 +276,8 @@ let type_of_constructors (ind,u) (mib,mip) =
let inductive_sort_family mip =
match mip.mind_arity with
- | RegularArity s -> family_of_sort s.mind_sort
- | TemplateArity _ -> InType
+ | RegularArity s -> Sorts.family s.mind_sort
+ | TemplateArity _ -> Sorts.InType
let mind_arity mip =
mip.mind_arity_ctxt, inductive_sort_family mip
@@ -296,19 +296,20 @@ let is_primitive_record (mib,_) =
let build_dependent_inductive ind (_,mip) params =
let realargs,_ = List.chop mip.mind_nrealdecls mip.mind_arity_ctxt in
- applist
+ Term.applist
(mkIndU ind,
List.map (lift mip.mind_nrealdecls) params
@ Context.Rel.to_extended_list mkRel 0 realargs)
(* This exception is local *)
-exception LocalArity of (sorts_family * sorts_family * arity_error) option
+exception LocalArity of (Sorts.family * Sorts.family * arity_error) option
let check_allowed_sort ksort specif =
+ let open Sorts in
let eq_ksort s = match ksort, s with
| InProp, InProp | InSet, InSet | InType, InType -> true
| _ -> false in
- if not (List.exists eq_ksort (elim_sorts specif)) then
+ if not (CList.exists eq_ksort (elim_sorts specif)) then
let s = inductive_sort_family (snd specif) in
raise (LocalArity (Some(ksort,s,error_elim_explain ksort s)))
@@ -316,7 +317,7 @@ let is_correct_arity env c pj ind specif params =
let arsign,_ = get_instantiated_arity ind specif params in
let rec srec env pt ar =
let pt' = whd_all env pt in
- match kind_of_term pt', ar with
+ match kind pt', ar with
| Prod (na1,a1,t), (LocalAssum (_,a1'))::ar' ->
let () =
try conv env a1 a1'
@@ -325,8 +326,8 @@ let is_correct_arity env c pj ind specif params =
(* The last Prod domain is the type of the scrutinee *)
| Prod (na1,a1,a2), [] -> (* whnf of t was not needed here! *)
let env' = push_rel (LocalAssum (na1,a1)) env in
- let ksort = match kind_of_term (whd_all env' a2) with
- | Sort s -> family_of_sort s
+ let ksort = match kind (whd_all env' a2) with
+ | Sort s -> Sorts.family s
| _ -> raise (LocalArity None) in
let dep_ind = build_dependent_inductive ind specif params in
let _ =
@@ -351,22 +352,22 @@ let is_correct_arity env c pj ind specif params =
let build_branches_type (ind,u) (_,mip as specif) params p =
let build_one_branch i cty =
let typi = full_constructor_instantiate (ind,u,specif,params) cty in
- let (cstrsign,ccl) = decompose_prod_assum typi in
+ let (cstrsign,ccl) = Term.decompose_prod_assum typi in
let nargs = Context.Rel.length cstrsign in
let (_,allargs) = decompose_app ccl in
let (lparams,vargs) = List.chop (inductive_params specif) allargs in
let cargs =
let cstr = ith_constructor_of_inductive ind (i+1) in
- let dep_cstr = applist (mkConstructU (cstr,u),lparams@(Context.Rel.to_extended_list mkRel 0 cstrsign)) in
+ let dep_cstr = Term.applist (mkConstructU (cstr,u),lparams@(Context.Rel.to_extended_list mkRel 0 cstrsign)) in
vargs @ [dep_cstr] in
- let base = lambda_appvect_assum (mip.mind_nrealdecls+1) (lift nargs p) (Array.of_list cargs) in
- it_mkProd_or_LetIn base cstrsign in
+ let base = Term.lambda_appvect_assum (mip.mind_nrealdecls+1) (lift nargs p) (Array.of_list cargs) in
+ Term.it_mkProd_or_LetIn base cstrsign in
Array.mapi build_one_branch mip.mind_nf_lc
(* [p] is the predicate, [c] is the match object, [realargs] is the
list of real args of the inductive type *)
let build_case_type env n p c realargs =
- whd_betaiota env (lambda_appvect_assum (n+1) p (Array.of_list (realargs@[c])))
+ whd_betaiota env (Term.lambda_appvect_assum (n+1) p (Array.of_list (realargs@[c])))
let type_case_branches env (pind,largs) pj c =
let specif = lookup_mind_specif env (fst pind) in
@@ -589,7 +590,7 @@ let ienv_push_inductive (env, ra_env) ((mind,u),lpar) =
let rec ienv_decompose_prod (env,_ as ienv) n c =
if Int.equal n 0 then (ienv,c) else
let c' = whd_all env c in
- match kind_of_term c' with
+ match kind c' with
Prod(na,a,b) ->
let ienv' = ienv_push_var ienv (na,a,mk_norec) in
ienv_decompose_prod ienv' (n-1) b
@@ -621,7 +622,7 @@ compute the number of recursive arguments. *)
let get_recargs_approx env tree ind args =
let rec build_recargs (env, ra_env as ienv) tree c =
let x,largs = decompose_app (whd_all env c) in
- match kind_of_term x with
+ match kind x with
| Prod (na,b,d) ->
assert (List.is_empty largs);
build_recargs (ienv_push_var ienv (na, b, mk_norec)) tree d
@@ -680,7 +681,7 @@ let get_recargs_approx env tree ind args =
and build_recargs_constructors ienv trees c =
let rec recargs_constr_rec (env,ra_env as ienv) trees lrec c =
let x,largs = decompose_app (whd_all env c) in
- match kind_of_term x with
+ match kind x with
| Prod (na,b,d) ->
let () = assert (List.is_empty largs) in
@@ -709,7 +710,7 @@ let restrict_spec env spec p =
let arctx, s = dest_prod_assum env ar in
let env = push_rel_context arctx env in
let i,args = decompose_app (whd_all env s) in
- match kind_of_term i with
+ match kind i with
| Ind i ->
begin match spec with
| Dead_code -> spec
@@ -730,7 +731,7 @@ let restrict_spec env spec p =
let rec subterm_specif renv stack t =
(* maybe reduction is not always necessary! *)
let f,l = decompose_app (whd_all renv.env t) in
- match kind_of_term f with
+ match kind f with
| Rel k -> subterm_var k renv
| Case (ci,p,c,lbr) ->
let stack' = push_stack_closures renv l stack in
@@ -773,7 +774,7 @@ let rec subterm_specif renv stack t =
let decrArg = recindxs.(i) in
let theBody = bodies.(i) in
let nbOfAbst = decrArg+1 in
- let sign,strippedBody = decompose_lam_n_assum nbOfAbst theBody in
+ let sign,strippedBody = Term.decompose_lam_n_assum nbOfAbst theBody in
(* pushing the fix parameters *)
let stack' = push_stack_closures renv l stack in
let renv'' = push_ctxt_renv renv' sign in
@@ -795,21 +796,24 @@ let rec subterm_specif renv stack t =
| Proj (p, c) ->
let subt = subterm_specif renv stack c in
- (match subt with
- | Subterm (s, wf) ->
- (* We take the subterm specs of the constructor of the record *)
- let wf_args = (dest_subterms wf).(0) in
- (* We extract the tree of the projected argument *)
- let kn = Projection.constant p in
- let cb = lookup_constant kn renv.env in
- let pb = Option.get cb.const_proj in
- let n = pb.proj_arg in
- Subterm (Strict, List.nth wf_args n)
- | Dead_code -> Dead_code
- | Not_subterm -> Not_subterm)
+ (match subt with
+ | Subterm (s, wf) ->
+ (* We take the subterm specs of the constructor of the record *)
+ let wf_args = (dest_subterms wf).(0) in
+ (* We extract the tree of the projected argument *)
+ let kn = Projection.constant p in
+ let cb = lookup_constant kn renv.env in
+ let pb = Option.get cb.const_proj in
+ let n = pb.proj_arg in
+ spec_of_tree (List.nth wf_args n)
+ | Dead_code -> Dead_code
+ | Not_subterm -> Not_subterm)
+
+ | Var _ | Sort _ | Cast _ | Prod _ | LetIn _ | App _ | Const _ | Ind _
+ | Construct _ | CoFix _ -> Not_subterm
+
(* Other terms are not subterms *)
- | _ -> Not_subterm
and lazy_subterm_specif renv stack t =
lazy (subterm_specif renv stack t)
@@ -857,13 +861,13 @@ let filter_stack_domain env ci p stack =
else let env = push_rel_context absctx env in
let rec filter_stack env ar stack =
let t = whd_all env ar in
- match stack, kind_of_term t with
+ match stack, kind t with
| elt :: stack', Prod (n,a,c0) ->
let d = LocalAssum (n,a) in
let ctx, a = dest_prod_assum env a in
let env = push_rel_context ctx env in
let ty, args = decompose_app (whd_all env a) in
- let elt = match kind_of_term ty with
+ let elt = match kind ty with
| Ind ind ->
let spec' = stack_element_specif elt in
(match (Lazy.force spec') with
@@ -894,7 +898,7 @@ let check_one_fix renv recpos trees def =
if noccur_with_meta renv.rel_min nfi t then ()
else
let (f,l) = decompose_app (whd_betaiotazeta renv.env t) in
- match kind_of_term f with
+ match kind f with
| Rel p ->
(* Test if [p] is a fixpoint (recursive call) *)
if renv.rel_min <= p && p < renv.rel_min+nfi then
@@ -924,7 +928,7 @@ let check_one_fix renv recpos trees def =
| LocalDef (_,c,_) ->
try List.iter (check_rec_call renv []) l
with FixGuardError _ ->
- check_rec_call renv stack (applist(lift p c,l))
+ check_rec_call renv stack (Term.applist(lift p c,l))
end
| Case (ci,p,c_0,lrest) ->
@@ -970,7 +974,7 @@ let check_one_fix renv recpos trees def =
if evaluable_constant kn renv.env then
try List.iter (check_rec_call renv []) l
with (FixGuardError _ ) ->
- let value = (applist(constant_value_in renv.env cu, l)) in
+ let value = (Term.applist(constant_value_in renv.env cu, l)) in
check_rec_call renv stack value
else List.iter (check_rec_call renv []) l
@@ -1007,7 +1011,7 @@ let check_one_fix renv recpos trees def =
| LocalDef (_,c,_) ->
try List.iter (check_rec_call renv []) l
with (FixGuardError _) ->
- check_rec_call renv stack (applist(c,l))
+ check_rec_call renv stack (Term.applist(c,l))
end
| Sort _ ->
@@ -1022,7 +1026,7 @@ let check_one_fix renv recpos trees def =
if Int.equal decr 0 then
check_rec_call (assign_var_spec renv (1,recArgsDecrArg)) [] body
else
- match kind_of_term body with
+ match kind body with
| Lambda (x,a,b) ->
check_rec_call renv [] a;
let renv' = push_var_renv renv (x,a) in
@@ -1053,7 +1057,7 @@ let inductive_of_mutfix env ((nvect,bodynum),(names,types,bodies as recdef)) =
(* check fi does not appear in the k+1 first abstractions,
gives the type of the k+1-eme abstraction (must be an inductive) *)
let rec check_occur env n def =
- match kind_of_term (whd_all env def) with
+ match kind (whd_all env def) with
| Lambda (x,a,b) ->
if noccur_with_meta n nbfix a then
let env' = push_rel (LocalAssum (x,a)) env in
@@ -1094,8 +1098,8 @@ let check_fix env ((nvect,_),(names,_,bodies as recdef) as fix) =
()
(*
-let cfkey = Profile.declare_profile "check_fix";;
-let check_fix env fix = Profile.profile3 cfkey check_fix env fix;;
+let cfkey = CProfile.declare_profile "check_fix";;
+let check_fix env fix = CProfile.profile3 cfkey check_fix env fix;;
*)
(************************************************************************)
@@ -1108,7 +1112,7 @@ let anomaly_ill_typed () =
let rec codomain_is_coind env c =
let b = whd_all env c in
- match kind_of_term b with
+ match kind b with
| Prod (x,a,b) ->
codomain_is_coind (push_rel (LocalAssum (x,a)) env) b
| _ ->
@@ -1120,7 +1124,7 @@ let check_one_cofix env nbfix def deftype =
let rec check_rec_call env alreadygrd n tree vlra t =
if not (noccur_with_meta n nbfix t) then
let c,args = decompose_app (whd_all env t) in
- match kind_of_term c with
+ match kind c with
| Rel p when n <= p && p < n+nbfix ->
(* recursive call: must be guarded and no nested recursive
call allowed *)
@@ -1192,8 +1196,8 @@ let check_one_cofix env nbfix def deftype =
| Meta _ -> ()
| Evar _ ->
List.iter (check_rec_call env alreadygrd n tree vlra) args
-
- | _ -> raise (CoFixGuardError (env,NotGuardedForm t)) in
+ | Rel _ | Var _ | Sort _ | Cast _ | Prod _ | LetIn _ | App _ | Const _
+ | Ind _ | Fix _ | Proj _ -> raise (CoFixGuardError (env,NotGuardedForm t)) in
let ((mind, _),_) = codomain_is_coind env deftype in
let vlra = lookup_subterms env mind in
diff --git a/kernel/inductive.mli b/kernel/inductive.mli
index 0dfa8db00..8aaeee831 100644
--- a/kernel/inductive.mli
+++ b/kernel/inductive.mli
@@ -7,7 +7,7 @@
(************************************************************************)
open Names
-open Term
+open Constr
open Univ
open Declarations
open Environ
@@ -32,23 +32,23 @@ type mind_specif = mutual_inductive_body * one_inductive_body
val lookup_mind_specif : env -> inductive -> mind_specif
(** {6 Functions to build standard types related to inductive } *)
-val ind_subst : mutual_inductive -> mutual_inductive_body -> universe_instance -> constr list
+val ind_subst : MutInd.t -> mutual_inductive_body -> Instance.t -> constr list
val inductive_paramdecls : mutual_inductive_body puniverses -> Context.Rel.t
-val instantiate_inductive_constraints :
- mutual_inductive_body -> universe_instance -> constraints
+val instantiate_inductive_constraints :
+ mutual_inductive_body -> Instance.t -> Constraint.t
val constrained_type_of_inductive : env -> mind_specif puniverses -> types constrained
-val constrained_type_of_inductive_knowing_parameters :
+val constrained_type_of_inductive_knowing_parameters :
env -> mind_specif puniverses -> types Lazy.t array -> types constrained
val type_of_inductive : env -> mind_specif puniverses -> types
-val type_of_inductive_knowing_parameters :
+val type_of_inductive_knowing_parameters :
env -> ?polyprop:bool -> mind_specif puniverses -> types Lazy.t array -> types
-val elim_sorts : mind_specif -> sorts_family list
+val elim_sorts : mind_specif -> Sorts.family list
val is_private : mind_specif -> bool
val is_primitive_record : mind_specif -> bool
@@ -65,7 +65,7 @@ val arities_of_constructors : pinductive -> mind_specif -> types array
val type_of_constructors : pinductive -> mind_specif -> types array
(** Transforms inductive specification into types (in nf) *)
-val arities_of_specif : mutual_inductive puniverses -> mind_specif -> types array
+val arities_of_specif : MutInd.t puniverses -> mind_specif -> types array
val inductive_params : mind_specif -> int
@@ -85,9 +85,9 @@ val build_branches_type :
constr list -> constr -> types array
(** Return the arity of an inductive type *)
-val mind_arity : one_inductive_body -> Context.Rel.t * sorts_family
+val mind_arity : one_inductive_body -> Context.Rel.t * Sorts.family
-val inductive_sort_family : one_inductive_body -> sorts_family
+val inductive_sort_family : one_inductive_body -> Sorts.family
(** Check a [case_info] actually correspond to a Case expression on the
given inductive type. *)
@@ -111,10 +111,10 @@ val check_cofix : env -> cofixpoint -> unit
exception SingletonInductiveBecomesProp of Id.t
-val max_inductive_sort : sorts array -> universe
+val max_inductive_sort : Sorts.t array -> Universe.t
val instantiate_universes : env -> Context.Rel.t ->
- template_arity -> constr Lazy.t array -> Context.Rel.t * sorts
+ template_arity -> constr Lazy.t array -> Context.Rel.t * Sorts.t
(** {6 Debug} *)
@@ -135,6 +135,6 @@ type stack_element = |SClosure of guard_env*constr |SArg of subterm_spec Lazy.t
val subterm_specif : guard_env -> stack_element list -> constr -> subterm_spec
-val lambda_implicit_lift : int -> Constr.constr -> Term.constr
+val lambda_implicit_lift : int -> constr -> constr
-val abstract_mind_lc : int -> Int.t -> Constr.constr array -> Constr.constr array
+val abstract_mind_lc : int -> Int.t -> constr array -> constr array
diff --git a/kernel/kernel.mllib b/kernel/kernel.mllib
index 917e4f6f1..749854b8c 100644
--- a/kernel/kernel.mllib
+++ b/kernel/kernel.mllib
@@ -16,6 +16,7 @@ Cemitcodes
Opaqueproof
Declarations
Entries
+Vmvalues
Nativevalues
CPrimitives
Declareops
diff --git a/kernel/mod_subst.ml b/kernel/mod_subst.ml
index 7b660939b..2c8ef477f 100644
--- a/kernel/mod_subst.ml
+++ b/kernel/mod_subst.ml
@@ -16,20 +16,20 @@
open Pp
open Util
open Names
-open Term
+open Constr
(* For Inline, the int is an inlining level, and the constr (if present)
is the term into which we should inline. *)
type delta_hint =
| Inline of int * constr option
- | Equiv of kernel_name
+ | Equiv of KerName.t
-(* NB: earlier constructor Prefix_equiv of module_path
+(* NB: earlier constructor Prefix_equiv of ModPath.t
is now stored in a separate table, see Deltamap.t below *)
module Deltamap = struct
- type t = module_path MPmap.t * delta_hint KNmap.t
+ type t = ModPath.t MPmap.t * delta_hint KNmap.t
let empty = MPmap.empty, KNmap.empty
let is_empty (mm, km) =
MPmap.is_empty mm && KNmap.is_empty km
@@ -45,7 +45,7 @@ module Deltamap = struct
end
(* Invariant: in the [delta_hint] map, an [Equiv] should only
- relate [kernel_name] with the same label (and section dirpath). *)
+ relate [KerName.t] with the same label (and section dirpath). *)
type delta_resolver = Deltamap.t
@@ -65,7 +65,7 @@ module Umap = struct
let join map1 map2 = fold add_mp add_mbi map1 map2
end
-type substitution = (module_path * delta_resolver) Umap.t
+type substitution = (ModPath.t * delta_resolver) Umap.t
let empty_subst = Umap.empty
@@ -76,21 +76,21 @@ let is_empty_subst = Umap.is_empty
let string_of_hint = function
| Inline (_,Some _) -> "inline(Some _)"
| Inline _ -> "inline()"
- | Equiv kn -> string_of_kn kn
+ | Equiv kn -> KerName.to_string kn
let debug_string_of_delta resolve =
let kn_to_string kn hint l =
- (string_of_kn kn ^ "=>" ^ string_of_hint hint) :: l
+ (KerName.to_string kn ^ "=>" ^ string_of_hint hint) :: l
in
let mp_to_string mp mp' l =
- (string_of_mp mp ^ "=>" ^ string_of_mp mp') :: l
+ (ModPath.to_string mp ^ "=>" ^ ModPath.to_string mp') :: l
in
let l = Deltamap.fold mp_to_string kn_to_string resolve [] in
String.concat ", " (List.rev l)
let list_contents sub =
- let one_pair (mp,reso) = (string_of_mp mp,debug_string_of_delta reso) in
- let mp_one_pair mp0 p l = (string_of_mp mp0, one_pair p)::l in
+ let one_pair (mp,reso) = (ModPath.to_string mp,debug_string_of_delta reso) in
+ let mp_one_pair mp0 p l = (ModPath.to_string mp0, one_pair p)::l in
let mbi_one_pair mbi p l = (MBId.debug_to_string mbi, one_pair p)::l in
Umap.fold mp_one_pair mbi_one_pair sub []
@@ -117,7 +117,7 @@ let debug_pr_subst sub =
let add_inline_delta_resolver kn (lev,oc) = Deltamap.add_kn kn (Inline (lev,oc))
let add_kn_delta_resolver kn kn' =
- assert (Label.equal (label kn) (label kn'));
+ assert (Label.equal (KerName.label kn) (KerName.label kn'));
Deltamap.add_kn kn (Equiv kn')
let add_mp_delta_resolver mp1 mp2 = Deltamap.add_mp mp1 mp2
@@ -165,12 +165,12 @@ let solve_delta_kn resolve kn =
| Inline (lev, Some c) -> raise (Change_equiv_to_inline (lev,c))
| Inline (_, None) -> raise Not_found
with Not_found ->
- let mp,dir,l = repr_kn kn in
+ let mp,dir,l = KerName.repr kn in
let new_mp = find_prefix resolve mp in
if mp == new_mp then
kn
else
- make_kn new_mp dir l
+ KerName.make new_mp dir l
let kn_of_delta resolve kn =
try solve_delta_kn resolve kn
@@ -242,18 +242,18 @@ let subst_mp sub mp =
| Some (mp',_) -> mp'
let subst_kn_delta sub kn =
- let mp,dir,l = repr_kn kn in
+ let mp,dir,l = KerName.repr kn in
match subst_mp0 sub mp with
Some (mp',resolve) ->
- solve_delta_kn resolve (make_kn mp' dir l)
+ solve_delta_kn resolve (KerName.make mp' dir l)
| None -> kn
let subst_kn sub kn =
- let mp,dir,l = repr_kn kn in
+ let mp,dir,l = KerName.repr kn in
match subst_mp0 sub mp with
Some (mp',_) ->
- (make_kn mp' dir l)
+ (KerName.make mp' dir l)
| None -> kn
exception No_subst
@@ -340,7 +340,7 @@ let subst_evaluable_reference subst = function
let rec map_kn f f' c =
let func = map_kn f f' in
- match kind_of_term c with
+ match kind c with
| Const kn -> (try snd (f' kn) with No_subst -> c)
| Proj (p,t) ->
let p' =
@@ -419,7 +419,7 @@ let subst_mps sub c =
let rec replace_mp_in_mp mpfrom mpto mp =
match mp with
- | _ when mp_eq mp mpfrom -> mpto
+ | _ when ModPath.equal mp mpfrom -> mpto
| MPdot (mp1,l) ->
let mp1' = replace_mp_in_mp mpfrom mpto mp1 in
if mp1 == mp1' then mp
@@ -427,14 +427,14 @@ let rec replace_mp_in_mp mpfrom mpto mp =
| _ -> mp
let replace_mp_in_kn mpfrom mpto kn =
- let mp,dir,l = repr_kn kn in
+ let mp,dir,l = KerName.repr kn in
let mp'' = replace_mp_in_mp mpfrom mpto mp in
if mp==mp'' then kn
- else make_kn mp'' dir l
+ else KerName.make mp'' dir l
let rec mp_in_mp mp mp1 =
match mp1 with
- | _ when mp_eq mp1 mp -> true
+ | _ when ModPath.equal mp1 mp -> true
| MPdot (mp2,l) -> mp_in_mp mp mp2
| _ -> false
@@ -446,7 +446,7 @@ let subset_prefixed_by mp resolver =
match hint with
| Inline _ -> rslv
| Equiv _ ->
- if mp_in_mp mp (modpath kn) then Deltamap.add_kn kn hint rslv else rslv
+ if mp_in_mp mp (KerName.modpath kn) then Deltamap.add_kn kn hint rslv else rslv
in
Deltamap.fold mp_prefix kn_prefix resolver empty_delta_resolver
@@ -515,7 +515,7 @@ let add_delta_resolver resolver1 resolver2 =
let substition_prefixed_by k mp subst =
let mp_prefixmp kmp (mp_to,reso) sub =
- if mp_in_mp mp kmp && not (mp_eq mp kmp) then
+ if mp_in_mp mp kmp && not (ModPath.equal mp kmp) then
let new_key = replace_mp_in_mp mp k kmp in
Umap.add_mp new_key (mp_to,reso) sub
else sub
diff --git a/kernel/mod_subst.mli b/kernel/mod_subst.mli
index f1d0e4279..1aa7ba519 100644
--- a/kernel/mod_subst.mli
+++ b/kernel/mod_subst.mli
@@ -9,7 +9,7 @@
(** {6 [Mod_subst] } *)
open Names
-open Term
+open Constr
(** {6 Delta resolver} *)
@@ -20,44 +20,44 @@ type delta_resolver
val empty_delta_resolver : delta_resolver
val add_mp_delta_resolver :
- module_path -> module_path -> delta_resolver -> delta_resolver
+ ModPath.t -> ModPath.t -> delta_resolver -> delta_resolver
val add_kn_delta_resolver :
- kernel_name -> kernel_name -> delta_resolver -> delta_resolver
+ KerName.t -> KerName.t -> delta_resolver -> delta_resolver
val add_inline_delta_resolver :
- kernel_name -> (int * constr option) -> delta_resolver -> delta_resolver
+ KerName.t -> (int * constr option) -> delta_resolver -> delta_resolver
val add_delta_resolver : delta_resolver -> delta_resolver -> delta_resolver
(** Effect of a [delta_resolver] on a module path, on a kernel name *)
-val mp_of_delta : delta_resolver -> module_path -> module_path
-val kn_of_delta : delta_resolver -> kernel_name -> kernel_name
+val mp_of_delta : delta_resolver -> ModPath.t -> ModPath.t
+val kn_of_delta : delta_resolver -> KerName.t -> KerName.t
(** Build a constant whose canonical part is obtained via a resolver *)
-val constant_of_delta_kn : delta_resolver -> kernel_name -> constant
+val constant_of_delta_kn : delta_resolver -> KerName.t -> Constant.t
(** Same, but a 2nd resolver is tried if the 1st one had no effect *)
val constant_of_deltas_kn :
- delta_resolver -> delta_resolver -> kernel_name -> constant
+ delta_resolver -> delta_resolver -> KerName.t -> Constant.t
(** Same for inductive names *)
-val mind_of_delta_kn : delta_resolver -> kernel_name -> mutual_inductive
+val mind_of_delta_kn : delta_resolver -> KerName.t -> MutInd.t
val mind_of_deltas_kn :
- delta_resolver -> delta_resolver -> kernel_name -> mutual_inductive
+ delta_resolver -> delta_resolver -> KerName.t -> MutInd.t
(** Extract the set of inlined constant in the resolver *)
-val inline_of_delta : int option -> delta_resolver -> (int * kernel_name) list
+val inline_of_delta : int option -> delta_resolver -> (int * KerName.t) list
(** Does a [delta_resolver] contains a [mp], a constant, an inductive ? *)
-val mp_in_delta : module_path -> delta_resolver -> bool
-val con_in_delta : constant -> delta_resolver -> bool
-val mind_in_delta : mutual_inductive -> delta_resolver -> bool
+val mp_in_delta : ModPath.t -> delta_resolver -> bool
+val con_in_delta : Constant.t -> delta_resolver -> bool
+val mind_in_delta : MutInd.t -> delta_resolver -> bool
(** {6 Substitution} *)
@@ -72,15 +72,15 @@ val is_empty_subst : substitution -> bool
composition. Most often this is not what you want. For sequential
composition, try [join (map_mbid mp delta) subs] **)
val add_mbid :
- MBId.t -> module_path -> delta_resolver -> substitution -> substitution
+ MBId.t -> ModPath.t -> delta_resolver -> substitution -> substitution
val add_mp :
- module_path -> module_path -> delta_resolver -> substitution -> substitution
+ ModPath.t -> ModPath.t -> delta_resolver -> substitution -> substitution
(** map_* create a new substitution [arg2/arg1]\{arg3\} *)
val map_mbid :
- MBId.t -> module_path -> delta_resolver -> substitution
+ MBId.t -> ModPath.t -> delta_resolver -> substitution
val map_mp :
- module_path -> module_path -> delta_resolver -> substitution
+ ModPath.t -> ModPath.t -> delta_resolver -> substitution
(** sequential composition:
[substitute (join sub1 sub2) t = substitute sub2 (substitute sub1 t)]
@@ -117,10 +117,10 @@ val debug_pr_delta : delta_resolver -> Pp.t
as well [==] *)
val subst_mp :
- substitution -> module_path -> module_path
+ substitution -> ModPath.t -> ModPath.t
val subst_mind :
- substitution -> mutual_inductive -> mutual_inductive
+ substitution -> MutInd.t -> MutInd.t
val subst_ind :
substitution -> inductive -> inductive
@@ -128,10 +128,10 @@ val subst_ind :
val subst_pind : substitution -> pinductive -> pinductive
val subst_kn :
- substitution -> kernel_name -> kernel_name
+ substitution -> KerName.t -> KerName.t
val subst_con :
- substitution -> pconstant -> constant * constr
+ substitution -> pconstant -> Constant.t * constr
val subst_pcon :
substitution -> pconstant -> pconstant
@@ -140,10 +140,10 @@ val subst_pcon_term :
substitution -> pconstant -> pconstant * constr
val subst_con_kn :
- substitution -> constant -> constant * constr
+ substitution -> Constant.t -> Constant.t * constr
-val subst_constant :
- substitution -> constant -> constant
+val subst_constant :
+ substitution -> Constant.t -> Constant.t
(** Here the semantics is completely unclear.
What does "Hint Unfold t" means when "t" is a parameter?
@@ -154,7 +154,7 @@ val subst_evaluable_reference :
substitution -> evaluable_global_reference -> evaluable_global_reference
(** [replace_mp_in_con mp mp' con] replaces [mp] with [mp'] in [con] *)
-val replace_mp_in_kn : module_path -> module_path -> kernel_name -> kernel_name
+val replace_mp_in_kn : ModPath.t -> ModPath.t -> KerName.t -> KerName.t
(** [subst_mps sub c] performs the substitution [sub] on all kernel
names appearing in [c] *)
@@ -171,6 +171,5 @@ val occur_mbid : MBId.t -> substitution -> bool
val repr_substituted : 'a substituted -> substitution list option * 'a
-val force_constr : Term.constr substituted -> Term.constr
-val subst_constr :
- substitution -> Term.constr substituted -> Term.constr substituted
+val force_constr : constr substituted -> constr
+val subst_constr : substitution -> constr substituted -> constr substituted
diff --git a/kernel/mod_typing.ml b/kernel/mod_typing.ml
index 8568bf14b..b7eb481ee 100644
--- a/kernel/mod_typing.ml
+++ b/kernel/mod_typing.ml
@@ -79,21 +79,23 @@ let rec check_with_def env struc (idl,(c,ctx)) mp equiv =
environment, because they do not appear in the type of the
definition. Any inconsistency will be raised at a later stage
when joining the environment. *)
- let env' = Environ.push_context ~strict:true ctx env' in
- let c',cst = match cb.const_body with
- | Undef _ | OpaqueDef _ ->
- let j = Typeops.infer env' c in
- let typ = cb.const_type in
- let cst' = Reduction.infer_conv_leq env' (Environ.universes env')
- j.uj_type typ in
- j.uj_val, cst'
- | Def cs ->
- let c' = Mod_subst.force_constr cs in
- c, Reduction.infer_conv env' (Environ.universes env') c c'
- in c', Monomorphic_const ctx, Univ.ContextSet.add_constraints cst (Univ.ContextSet.of_context ctx)
+ let env' = Environ.push_context ~strict:true ctx env' in
+ let c',cst = match cb.const_body with
+ | Undef _ | OpaqueDef _ ->
+ let j = Typeops.infer env' c in
+ let typ = cb.const_type in
+ let cst' = Reduction.infer_conv_leq env' (Environ.universes env')
+ j.uj_type typ in
+ j.uj_val, cst'
+ | Def cs ->
+ let c' = Mod_subst.force_constr cs in
+ c, Reduction.infer_conv env' (Environ.universes env') c c'
+ in
+ let ctx = Univ.ContextSet.of_context ctx in
+ c', Monomorphic_const ctx, Univ.ContextSet.add_constraints cst ctx
| Polymorphic_const uctx ->
- let subst, ctx = Univ.abstract_universes ctx in
- let c = Vars.subst_univs_level_constr subst c in
+ let inst, ctx = Univ.abstract_universes ctx in
+ let c = Vars.subst_univs_level_constr (Univ.make_instance_subst inst) c in
let () =
if not (UGraph.check_subtype (Environ.universes env) uctx ctx) then
error_incorrect_with_constraint lab
diff --git a/kernel/mod_typing.mli b/kernel/mod_typing.mli
index dcabb1334..1225c3e1e 100644
--- a/kernel/mod_typing.mli
+++ b/kernel/mod_typing.mli
@@ -21,16 +21,16 @@ open Names
*)
val translate_module :
- env -> module_path -> inline -> module_entry -> module_body
+ env -> ModPath.t -> inline -> module_entry -> module_body
(** [translate_modtype] produces a [module_type_body] whose [mod_type_alg]
cannot be [None] (and of course [mod_expr] is [Abstract]). *)
val translate_modtype :
- env -> module_path -> inline -> module_type_entry -> module_type_body
+ env -> ModPath.t -> inline -> module_type_entry -> module_type_body
(** Low-level function for translating a module struct entry :
- - We translate to a module when a [module_path] is given,
+ - We translate to a module when a [ModPath.t] is given,
otherwise to a module type.
- The first output is the expanded signature
- The second output is the algebraic expression, kept mostly for
@@ -40,14 +40,14 @@ type 'alg translation =
module_signature * 'alg * delta_resolver * Univ.ContextSet.t
val translate_mse :
- env -> module_path option -> inline -> module_struct_entry ->
+ env -> ModPath.t option -> inline -> module_struct_entry ->
module_alg_expr translation
(** From an already-translated (or interactive) implementation and
an (optional) signature entry, produces a final [module_body] *)
val finalize_module :
- env -> module_path -> (module_expression option) translation ->
+ env -> ModPath.t -> (module_expression option) translation ->
(module_type_entry * inline) option ->
module_body
@@ -55,5 +55,5 @@ val finalize_module :
module type given to an Include *)
val translate_mse_incl :
- bool -> env -> module_path -> inline -> module_struct_entry ->
+ bool -> env -> ModPath.t -> inline -> module_struct_entry ->
unit translation
diff --git a/kernel/modops.ml b/kernel/modops.ml
index 76915e917..11e6be659 100644
--- a/kernel/modops.ml
+++ b/kernel/modops.ml
@@ -17,7 +17,7 @@
open Util
open Names
-open Term
+open Constr
open Declarations
open Declareops
open Environ
@@ -59,7 +59,7 @@ type module_typing_error =
| NotAFunctor
| IsAFunctor
| IncompatibleModuleTypes of module_type_body * module_type_body
- | NotEqualModulePaths of module_path * module_path
+ | NotEqualModulePaths of ModPath.t * ModPath.t
| NoSuchLabel of Label.t
| IncompatibleLabels of Label.t * Label.t
| NotAModule of string
@@ -68,7 +68,7 @@ type module_typing_error =
| IncorrectWithConstraint of Label.t
| GenerativeModuleExpected of Label.t
| LabelMissing of Label.t * string
- | IncludeRestrictedFunctor of module_path
+ | IncludeRestrictedFunctor of ModPath.t
exception ModuleTypingError of module_typing_error
@@ -266,9 +266,9 @@ let subst_structure subst = subst_structure subst do_delta_codom
(* lclrk : retroknowledge_action list, rkaction : retroknowledge action *)
let add_retroknowledge mp =
let perform rkaction env = match rkaction with
- |Retroknowledge.RKRegister (f, e) when (isConst e || isInd e) ->
+ | Retroknowledge.RKRegister (f, e) when (isConst e || isInd e) ->
Environ.register env f e
- |_ ->
+ | _ ->
CErrors.anomaly ~label:"Modops.add_retroknowledge"
(Pp.str "had to import an unsupported kind of term.")
in
@@ -403,8 +403,8 @@ let inline_delta_resolver env inl mp mbid mtb delta =
let constr = Mod_subst.force_constr body in
add_inline_delta_resolver kn (lev, Some constr) l
with Not_found ->
- error_no_such_label_sub (con_label con)
- (string_of_mp (con_modpath con))
+ error_no_such_label_sub (Constant.label con)
+ (ModPath.to_string (Constant.modpath con))
in
make_inline delta constants
diff --git a/kernel/modops.mli b/kernel/modops.mli
index e2a94b691..bbb4c918c 100644
--- a/kernel/modops.mli
+++ b/kernel/modops.mli
@@ -7,7 +7,7 @@
(************************************************************************)
open Names
-open Term
+open Constr
open Environ
open Declarations
open Entries
@@ -26,9 +26,9 @@ val destr_nofunctor : ('ty,'a) functorize -> 'a
(** Conversions between [module_body] and [module_type_body] *)
val module_type_of_module : module_body -> module_type_body
-val module_body_of_type : module_path -> module_type_body -> module_body
+val module_body_of_type : ModPath.t -> module_type_body -> module_body
-val check_modpath_equiv : env -> module_path -> module_path -> unit
+val check_modpath_equiv : env -> ModPath.t -> ModPath.t -> unit
val implem_smartmap :
(module_signature -> module_signature) ->
@@ -43,7 +43,7 @@ val subst_structure : substitution -> structure_body -> structure_body
(** {6 Adding to an environment } *)
val add_structure :
- module_path -> structure_body -> delta_resolver -> env -> env
+ ModPath.t -> structure_body -> delta_resolver -> env -> env
(** adds a module and its components, but not the constraints *)
val add_module : module_body -> env -> env
@@ -53,19 +53,19 @@ the native compiler. The linking information is updated. *)
val add_linked_module : module_body -> Pre_env.link_info -> env -> env
(** same, for a module type *)
-val add_module_type : module_path -> module_type_body -> env -> env
+val add_module_type : ModPath.t -> module_type_body -> env -> env
(** {6 Strengthening } *)
-val strengthen : module_type_body -> module_path -> module_type_body
+val strengthen : module_type_body -> ModPath.t -> module_type_body
val inline_delta_resolver :
- env -> inline -> module_path -> MBId.t -> module_type_body ->
+ env -> inline -> ModPath.t -> MBId.t -> module_type_body ->
delta_resolver -> delta_resolver
-val strengthen_and_subst_mb : module_body -> module_path -> bool -> module_body
+val strengthen_and_subst_mb : module_body -> ModPath.t -> bool -> module_body
-val subst_modtype_and_resolver : module_type_body -> module_path ->
+val subst_modtype_and_resolver : module_type_body -> ModPath.t ->
module_type_body
(** {6 Cleaning a module expression from bounded parts }
@@ -118,7 +118,7 @@ type module_typing_error =
| NotAFunctor
| IsAFunctor
| IncompatibleModuleTypes of module_type_body * module_type_body
- | NotEqualModulePaths of module_path * module_path
+ | NotEqualModulePaths of ModPath.t * ModPath.t
| NoSuchLabel of Label.t
| IncompatibleLabels of Label.t * Label.t
| NotAModule of string
@@ -127,7 +127,7 @@ type module_typing_error =
| IncorrectWithConstraint of Label.t
| GenerativeModuleExpected of Label.t
| LabelMissing of Label.t * string
- | IncludeRestrictedFunctor of module_path
+ | IncludeRestrictedFunctor of ModPath.t
exception ModuleTypingError of module_typing_error
@@ -153,4 +153,4 @@ val error_generative_module_expected : Label.t -> 'a
val error_no_such_label_sub : Label.t->string->'a
-val error_include_restricted_functor : module_path -> 'a
+val error_include_restricted_functor : ModPath.t -> 'a
diff --git a/kernel/names.ml b/kernel/names.ml
index cb27104d1..b02c0b840 100644
--- a/kernel/names.ml
+++ b/kernel/names.ml
@@ -179,6 +179,8 @@ struct
| [] -> "<>"
| sl -> String.concat "." (List.rev_map Id.to_string sl)
+ let print dp = str (to_string dp)
+
let initial = [default_module_name]
module Hdir = Hashcons.Hlist(Id)
diff --git a/kernel/names.mli b/kernel/names.mli
index d97fd2b3a..b1e8efd8d 100644
--- a/kernel/names.mli
+++ b/kernel/names.mli
@@ -40,19 +40,16 @@ sig
(** Hash over identifiers. *)
val is_valid : string -> bool
- (** Check that a string may be converted to an identifier.
- @raise Unicode.Unsupported if the provided string contains unsupported UTF-8 characters. *)
+ (** Check that a string may be converted to an identifier. *)
val of_bytes : bytes -> t
val of_string : string -> t
(** Converts a string into an identifier.
- @raise UserError if the string is invalid as an identifier.
- @raise Unicode.Unsupported if the provided string contains unsupported UTF-8 characters. *)
+ @raise UserError if the string is invalid as an identifier. *)
val of_string_soft : string -> t
(** Same as {!of_string} except that any string made of supported UTF-8 characters is accepted.
- @raise UserError if the string is invalid as an UTF-8 string.
- @raise Unicode.Unsupported if the provided string contains unsupported UTF-8 characters. *)
+ @raise UserError if the string is invalid as an UTF-8 string. *)
val to_string : t -> string
(** Converts a identifier into an string. *)
@@ -113,6 +110,8 @@ end
(** {6 Type aliases} *)
type name = Name.t = Anonymous | Name of Id.t
+[@@ocaml.deprecated "Use Name.t"]
+
type variable = Id.t
type module_ident = Id.t
@@ -157,6 +156,7 @@ sig
val hcons : t -> t
(** Hashconsing of directory paths. *)
+ val print : t -> Pp.t
end
(** {6 Names of structure elements } *)
@@ -298,7 +298,6 @@ module KNset : CSig.SetS with type elt = KerName.t
module KNpred : Predicate.S with type elt = KerName.t
module KNmap : Map.ExtS with type key = KerName.t and module Set := KNset
-
(** {6 Constant Names } *)
module Constant:
@@ -572,54 +571,55 @@ module Idmap : module type of Id.Map
(** {5 Directory paths} *)
type dir_path = DirPath.t
-(** @deprecated Alias for [DirPath.t]. *)
+[@@ocaml.deprecated "Alias for [DirPath.t]."]
-val dir_path_ord : dir_path -> dir_path -> int
-(** @deprecated Same as [DirPath.compare]. *)
+val dir_path_ord : DirPath.t -> DirPath.t -> int
+[@@ocaml.deprecated "Same as [DirPath.compare]."]
-val dir_path_eq : dir_path -> dir_path -> bool
-(** @deprecated Same as [DirPath.equal]. *)
+val dir_path_eq : DirPath.t -> DirPath.t -> bool
+[@@ocaml.deprecated "Same as [DirPath.equal]."]
-val make_dirpath : module_ident list -> dir_path
-(** @deprecated Same as [DirPath.make]. *)
+val make_dirpath : module_ident list -> DirPath.t
+[@@ocaml.deprecated "Same as [DirPath.make]."]
-val repr_dirpath : dir_path -> module_ident list
-(** @deprecated Same as [DirPath.repr]. *)
+val repr_dirpath : DirPath.t -> module_ident list
+[@@ocaml.deprecated "Same as [DirPath.repr]."]
-val empty_dirpath : dir_path
-(** @deprecated Same as [DirPath.empty]. *)
+val empty_dirpath : DirPath.t
+[@@ocaml.deprecated "Same as [DirPath.empty]."]
-val is_empty_dirpath : dir_path -> bool
-(** @deprecated Same as [DirPath.is_empty]. *)
+val is_empty_dirpath : DirPath.t -> bool
+[@@ocaml.deprecated "Same as [DirPath.is_empty]."]
-val string_of_dirpath : dir_path -> string
-(** @deprecated Same as [DirPath.to_string]. *)
+val string_of_dirpath : DirPath.t -> string
+[@@ocaml.deprecated "Same as [DirPath.to_string]."]
val initial_dir : DirPath.t
-(** @deprecated Same as [DirPath.initial]. *)
+[@@ocaml.deprecated "Same as [DirPath.initial]."]
(** {5 Labels} *)
type label = Label.t
+[@@ocaml.deprecated "Same as [Label.t]."]
(** Alias type *)
-val mk_label : string -> label
-(** @deprecated Same as [Label.make]. *)
+val mk_label : string -> Label.t
+[@@ocaml.deprecated "Same as [Label.make]."]
-val string_of_label : label -> string
-(** @deprecated Same as [Label.to_string]. *)
+val string_of_label : Label.t -> string
+[@@ocaml.deprecated "Same as [Label.to_string]."]
-val pr_label : label -> Pp.t
-(** @deprecated Same as [Label.print]. *)
+val pr_label : Label.t -> Pp.t
+[@@ocaml.deprecated "Same as [Label.print]."]
-val label_of_id : Id.t -> label
-(** @deprecated Same as [Label.of_id]. *)
+val label_of_id : Id.t -> Label.t
+[@@ocaml.deprecated "Same as [Label.of_id]."]
-val id_of_label : label -> Id.t
-(** @deprecated Same as [Label.to_id]. *)
+val id_of_label : Label.t -> Id.t
+[@@ocaml.deprecated "Same as [Label.to_id]."]
-val eq_label : label -> label -> bool
-(** @deprecated Same as [Label.equal]. *)
+val eq_label : Label.t -> Label.t -> bool
+[@@ocaml.deprecated "Same as [Label.equal]."]
(** {5 Unique bound module names} *)
@@ -627,89 +627,89 @@ type mod_bound_id = MBId.t
(** Alias type. *)
val mod_bound_id_ord : mod_bound_id -> mod_bound_id -> int
-(** @deprecated Same as [MBId.compare]. *)
+[@@ocaml.deprecated "Same as [MBId.compare]."]
val mod_bound_id_eq : mod_bound_id -> mod_bound_id -> bool
-(** @deprecated Same as [MBId.equal]. *)
+[@@ocaml.deprecated "Same as [MBId.equal]."]
val make_mbid : DirPath.t -> Id.t -> mod_bound_id
-(** @deprecated Same as [MBId.make]. *)
+[@@ocaml.deprecated "Same as [MBId.make]."]
val repr_mbid : mod_bound_id -> int * Id.t * DirPath.t
-(** @deprecated Same as [MBId.repr]. *)
+[@@ocaml.deprecated "Same as [MBId.repr]."]
val id_of_mbid : mod_bound_id -> Id.t
-(** @deprecated Same as [MBId.to_id]. *)
+[@@ocaml.deprecated "Same as [MBId.to_id]."]
val string_of_mbid : mod_bound_id -> string
-(** @deprecated Same as [MBId.to_string]. *)
+[@@ocaml.deprecated "Same as [MBId.to_string]."]
val debug_string_of_mbid : mod_bound_id -> string
-(** @deprecated Same as [MBId.debug_to_string]. *)
+[@@ocaml.deprecated "Same as [MBId.debug_to_string]."]
(** {5 Names} *)
-val name_eq : name -> name -> bool
-(** @deprecated Same as [Name.equal]. *)
+val name_eq : Name.t -> Name.t -> bool
+[@@ocaml.deprecated "Same as [Name.equal]."]
(** {5 Module paths} *)
type module_path = ModPath.t =
| MPfile of DirPath.t
| MPbound of MBId.t
- | MPdot of module_path * Label.t
-(** @deprecated Alias type *)
+ | MPdot of ModPath.t * Label.t
+[@@ocaml.deprecated "Alias type"]
-val mp_ord : module_path -> module_path -> int
-(** @deprecated Same as [ModPath.compare]. *)
+val mp_ord : ModPath.t -> ModPath.t -> int
+[@@ocaml.deprecated "Same as [ModPath.compare]."]
-val mp_eq : module_path -> module_path -> bool
-(** @deprecated Same as [ModPath.equal]. *)
+val mp_eq : ModPath.t -> ModPath.t -> bool
+[@@ocaml.deprecated "Same as [ModPath.equal]."]
-val check_bound_mp : module_path -> bool
-(** @deprecated Same as [ModPath.is_bound]. *)
+val check_bound_mp : ModPath.t -> bool
+[@@ocaml.deprecated "Same as [ModPath.is_bound]."]
-val string_of_mp : module_path -> string
-(** @deprecated Same as [ModPath.to_string]. *)
+val string_of_mp : ModPath.t -> string
+[@@ocaml.deprecated "Same as [ModPath.to_string]."]
-val initial_path : module_path
-(** @deprecated Same as [ModPath.initial]. *)
+val initial_path : ModPath.t
+[@@ocaml.deprecated "Same as [ModPath.initial]."]
(** {5 Kernel names} *)
type kernel_name = KerName.t
-(** @deprecated Alias type *)
+[@@ocaml.deprecated "Alias type"]
-val make_kn : ModPath.t -> DirPath.t -> Label.t -> kernel_name
-(** @deprecated Same as [KerName.make]. *)
+val make_kn : ModPath.t -> DirPath.t -> Label.t -> KerName.t
+[@@ocaml.deprecated "Same as [KerName.make]."]
-val repr_kn : kernel_name -> module_path * DirPath.t * Label.t
-(** @deprecated Same as [KerName.repr]. *)
+val repr_kn : KerName.t -> ModPath.t * DirPath.t * Label.t
+[@@ocaml.deprecated "Same as [KerName.repr]."]
-val modpath : kernel_name -> module_path
-(** @deprecated Same as [KerName.modpath]. *)
+val modpath : KerName.t -> ModPath.t
+[@@ocaml.deprecated "Same as [KerName.modpath]."]
-val label : kernel_name -> Label.t
-(** @deprecated Same as [KerName.label]. *)
+val label : KerName.t -> Label.t
+[@@ocaml.deprecated "Same as [KerName.label]."]
-val string_of_kn : kernel_name -> string
-(** @deprecated Same as [KerName.to_string]. *)
+val string_of_kn : KerName.t -> string
+[@@ocaml.deprecated "Same as [KerName.to_string]."]
-val pr_kn : kernel_name -> Pp.t
-(** @deprecated Same as [KerName.print]. *)
+val pr_kn : KerName.t -> Pp.t
+[@@ocaml.deprecated "Same as [KerName.print]."]
-val kn_ord : kernel_name -> kernel_name -> int
-(** @deprecated Same as [KerName.compare]. *)
+val kn_ord : KerName.t -> KerName.t -> int
+[@@ocaml.deprecated "Same as [KerName.compare]."]
(** {5 Constant names} *)
type constant = Constant.t
-(** @deprecated Alias type *)
+[@@ocaml.deprecated "Alias type"]
module Projection : sig
type t
-
- val make : constant -> bool -> t
+
+ val make : Constant.t -> bool -> t
module SyntacticOrd : sig
val compare : t -> t -> int
@@ -717,7 +717,7 @@ module Projection : sig
val hash : t -> int
end
- val constant : t -> constant
+ val constant : t -> Constant.t
val unfolded : t -> bool
val unfold : t -> t
@@ -727,8 +727,8 @@ module Projection : sig
(** Hashconsing of projections. *)
val compare : t -> t -> int
-
- val map : (constant -> constant) -> t -> t
+
+ val map : (Constant.t -> Constant.t) -> t -> t
val to_string : t -> string
val print : t -> Pp.t
@@ -737,100 +737,100 @@ end
type projection = Projection.t
-val constant_of_kn_equiv : KerName.t -> KerName.t -> constant
-(** @deprecated Same as [Constant.make] *)
+val constant_of_kn_equiv : KerName.t -> KerName.t -> Constant.t
+[@@ocaml.deprecated "Same as [Constant.make]"]
-val constant_of_kn : KerName.t -> constant
-(** @deprecated Same as [Constant.make1] *)
+val constant_of_kn : KerName.t -> Constant.t
+[@@ocaml.deprecated "Same as [Constant.make1]"]
-val make_con : ModPath.t -> DirPath.t -> Label.t -> constant
-(** @deprecated Same as [Constant.make3] *)
+val make_con : ModPath.t -> DirPath.t -> Label.t -> Constant.t
+[@@ocaml.deprecated "Same as [Constant.make3]"]
-val repr_con : constant -> ModPath.t * DirPath.t * Label.t
-(** @deprecated Same as [Constant.repr3] *)
+val repr_con : Constant.t -> ModPath.t * DirPath.t * Label.t
+[@@ocaml.deprecated "Same as [Constant.repr3]"]
-val user_con : constant -> KerName.t
-(** @deprecated Same as [Constant.user] *)
+val user_con : Constant.t -> KerName.t
+[@@ocaml.deprecated "Same as [Constant.user]"]
-val canonical_con : constant -> KerName.t
-(** @deprecated Same as [Constant.canonical] *)
+val canonical_con : Constant.t -> KerName.t
+[@@ocaml.deprecated "Same as [Constant.canonical]"]
-val con_modpath : constant -> ModPath.t
-(** @deprecated Same as [Constant.modpath] *)
+val con_modpath : Constant.t -> ModPath.t
+[@@ocaml.deprecated "Same as [Constant.modpath]"]
-val con_label : constant -> Label.t
-(** @deprecated Same as [Constant.label] *)
+val con_label : Constant.t -> Label.t
+[@@ocaml.deprecated "Same as [Constant.label]"]
-val eq_constant : constant -> constant -> bool
-(** @deprecated Same as [Constant.equal] *)
+val eq_constant : Constant.t -> Constant.t -> bool
+[@@ocaml.deprecated "Same as [Constant.equal]"]
-val con_ord : constant -> constant -> int
-(** @deprecated Same as [Constant.CanOrd.compare] *)
+val con_ord : Constant.t -> Constant.t -> int
+[@@ocaml.deprecated "Same as [Constant.CanOrd.compare]"]
-val con_user_ord : constant -> constant -> int
-(** @deprecated Same as [Constant.UserOrd.compare] *)
+val con_user_ord : Constant.t -> Constant.t -> int
+[@@ocaml.deprecated "Same as [Constant.UserOrd.compare]"]
-val con_with_label : constant -> Label.t -> constant
-(** @deprecated Same as [Constant.change_label] *)
+val con_with_label : Constant.t -> Label.t -> Constant.t
+[@@ocaml.deprecated "Same as [Constant.change_label]"]
-val string_of_con : constant -> string
-(** @deprecated Same as [Constant.to_string] *)
+val string_of_con : Constant.t -> string
+[@@ocaml.deprecated "Same as [Constant.to_string]"]
-val pr_con : constant -> Pp.t
-(** @deprecated Same as [Constant.print] *)
+val pr_con : Constant.t -> Pp.t
+[@@ocaml.deprecated "Same as [Constant.print]"]
-val debug_pr_con : constant -> Pp.t
-(** @deprecated Same as [Constant.debug_print] *)
+val debug_pr_con : Constant.t -> Pp.t
+[@@ocaml.deprecated "Same as [Constant.debug_print]"]
-val debug_string_of_con : constant -> string
-(** @deprecated Same as [Constant.debug_to_string] *)
+val debug_string_of_con : Constant.t -> string
+[@@ocaml.deprecated "Same as [Constant.debug_to_string]"]
(** {5 Mutual Inductive names} *)
type mutual_inductive = MutInd.t
-(** @deprecated Alias type *)
+[@@ocaml.deprecated "Alias type"]
-val mind_of_kn : KerName.t -> mutual_inductive
-(** @deprecated Same as [MutInd.make1] *)
+val mind_of_kn : KerName.t -> MutInd.t
+[@@ocaml.deprecated "Same as [MutInd.make1]"]
-val mind_of_kn_equiv : KerName.t -> KerName.t -> mutual_inductive
-(** @deprecated Same as [MutInd.make] *)
+val mind_of_kn_equiv : KerName.t -> KerName.t -> MutInd.t
+[@@ocaml.deprecated "Same as [MutInd.make]"]
-val make_mind : ModPath.t -> DirPath.t -> Label.t -> mutual_inductive
-(** @deprecated Same as [MutInd.make3] *)
+val make_mind : ModPath.t -> DirPath.t -> Label.t -> MutInd.t
+[@@ocaml.deprecated "Same as [MutInd.make3]"]
-val user_mind : mutual_inductive -> KerName.t
-(** @deprecated Same as [MutInd.user] *)
+val user_mind : MutInd.t -> KerName.t
+[@@ocaml.deprecated "Same as [MutInd.user]"]
-val canonical_mind : mutual_inductive -> KerName.t
-(** @deprecated Same as [MutInd.canonical] *)
+val canonical_mind : MutInd.t -> KerName.t
+[@@ocaml.deprecated "Same as [MutInd.canonical]"]
-val repr_mind : mutual_inductive -> ModPath.t * DirPath.t * Label.t
-(** @deprecated Same as [MutInd.repr3] *)
+val repr_mind : MutInd.t -> ModPath.t * DirPath.t * Label.t
+[@@ocaml.deprecated "Same as [MutInd.repr3]"]
-val eq_mind : mutual_inductive -> mutual_inductive -> bool
-(** @deprecated Same as [MutInd.equal] *)
+val eq_mind : MutInd.t -> MutInd.t -> bool
+[@@ocaml.deprecated "Same as [MutInd.equal]"]
-val mind_ord : mutual_inductive -> mutual_inductive -> int
-(** @deprecated Same as [MutInd.CanOrd.compare] *)
+val mind_ord : MutInd.t -> MutInd.t -> int
+[@@ocaml.deprecated "Same as [MutInd.CanOrd.compare]"]
-val mind_user_ord : mutual_inductive -> mutual_inductive -> int
-(** @deprecated Same as [MutInd.UserOrd.compare] *)
+val mind_user_ord : MutInd.t -> MutInd.t -> int
+[@@ocaml.deprecated "Same as [MutInd.UserOrd.compare]"]
-val mind_label : mutual_inductive -> Label.t
-(** @deprecated Same as [MutInd.label] *)
+val mind_label : MutInd.t -> Label.t
+[@@ocaml.deprecated "Same as [MutInd.label]"]
-val mind_modpath : mutual_inductive -> ModPath.t
-(** @deprecated Same as [MutInd.modpath] *)
+val mind_modpath : MutInd.t -> ModPath.t
+[@@ocaml.deprecated "Same as [MutInd.modpath]"]
-val string_of_mind : mutual_inductive -> string
-(** @deprecated Same as [MutInd.to_string] *)
+val string_of_mind : MutInd.t -> string
+[@@ocaml.deprecated "Same as [MutInd.to_string]"]
-val pr_mind : mutual_inductive -> Pp.t
-(** @deprecated Same as [MutInd.print] *)
+val pr_mind : MutInd.t -> Pp.t
+[@@ocaml.deprecated "Same as [MutInd.print]"]
-val debug_pr_mind : mutual_inductive -> Pp.t
-(** @deprecated Same as [MutInd.debug_print] *)
+val debug_pr_mind : MutInd.t -> Pp.t
+[@@ocaml.deprecated "Same as [MutInd.debug_print]"]
-val debug_string_of_mind : mutual_inductive -> string
-(** @deprecated Same as [MutInd.debug_to_string] *)
+val debug_string_of_mind : MutInd.t -> string
+[@@ocaml.deprecated "Same as [MutInd.debug_to_string]"]
diff --git a/kernel/nativecode.ml b/kernel/nativecode.ml
index 6e9991ac5..8fa254053 100644
--- a/kernel/nativecode.ml
+++ b/kernel/nativecode.ml
@@ -8,7 +8,7 @@
open CErrors
open Names
-open Term
+open Constr
open Declarations
open Util
open Nativevalues
@@ -25,7 +25,7 @@ to OCaml code. *)
(** Local names **)
(* The first component is there for debugging purposes only *)
-type lname = { lname : name; luid : int }
+type lname = { lname : Name.t; luid : int }
let eq_lname ln1 ln2 =
Int.equal ln1.luid ln2.luid
@@ -50,13 +50,13 @@ let fresh_lname n =
type gname =
| Gind of string * inductive (* prefix, inductive name *)
| Gconstruct of string * constructor (* prefix, constructor name *)
- | Gconstant of string * constant (* prefix, constant name *)
- | Gproj of string * constant (* prefix, constant name *)
- | Gcase of label option * int
- | Gpred of label option * int
- | Gfixtype of label option * int
- | Gnorm of label option * int
- | Gnormtbl of label option * int
+ | Gconstant of string * Constant.t (* prefix, constant name *)
+ | Gproj of string * Constant.t (* prefix, constant name *)
+ | Gcase of Label.t option * int
+ | Gpred of Label.t option * int
+ | Gfixtype of Label.t option * int
+ | Gnorm of Label.t option * int
+ | Gnormtbl of Label.t option * int
| Ginternal of string
| Grel of int
| Gnamed of Id.t
@@ -142,13 +142,13 @@ let fresh_gnormtbl l =
type symbol =
| SymbValue of Nativevalues.t
- | SymbSort of sorts
- | SymbName of name
- | SymbConst of constant
+ | SymbSort of Sorts.t
+ | SymbName of Name.t
+ | SymbConst of Constant.t
| SymbMatch of annot_sw
| SymbInd of inductive
| SymbMeta of metavariable
- | SymbEvar of existential
+ | SymbEvar of Evar.t
| SymbLevel of Univ.Level.t
let dummy_symb = SymbValue (dummy_value ())
@@ -162,8 +162,7 @@ let eq_symbol sy1 sy2 =
| SymbMatch sw1, SymbMatch sw2 -> eq_annot_sw sw1 sw2
| SymbInd ind1, SymbInd ind2 -> eq_ind ind1 ind2
| SymbMeta m1, SymbMeta m2 -> Int.equal m1 m2
- | SymbEvar (evk1,args1), SymbEvar (evk2,args2) ->
- Evar.equal evk1 evk2 && Array.for_all2 eq_constr args1 args2
+ | SymbEvar evk1, SymbEvar evk2 -> Evar.equal evk1 evk2
| SymbLevel l1, SymbLevel l2 -> Univ.Level.equal l1 l2
| _, _ -> false
@@ -176,10 +175,7 @@ let hash_symbol symb =
| SymbMatch sw -> combinesmall 5 (hash_annot_sw sw)
| SymbInd ind -> combinesmall 6 (ind_hash ind)
| SymbMeta m -> combinesmall 7 m
- | SymbEvar (evk,args) ->
- let evh = Evar.hash evk in
- let hl = Array.fold_left (fun h t -> combine h (Constr.hash t)) evh args in
- combinesmall 8 hl
+ | SymbEvar evk -> combinesmall 8 (Evar.hash evk)
| SymbLevel l -> combinesmall 9 (Univ.Level.hash l)
module HashedTypeSymbol = struct
@@ -296,7 +292,7 @@ type primitive =
| MLmagic
| MLarrayget
| Mk_empty_instance
- | Coq_primitive of CPrimitives.t * (prefix * constant) option
+ | Coq_primitive of CPrimitives.t * (prefix * Constant.t) option
let eq_primitive p1 p2 =
match p1, p2 with
@@ -921,7 +917,7 @@ let merge_branches t =
type prim_aux =
- | PAprim of string * constant * CPrimitives.t * prim_aux array
+ | PAprim of string * Constant.t * CPrimitives.t * prim_aux array
| PAml of mllambda
let add_check cond args =
@@ -1047,11 +1043,12 @@ let ml_of_instance instance u =
let tyn = fresh_lname Anonymous in
let i = push_symbol (SymbMeta mv) in
MLapp(MLprimitive Mk_meta, [|get_meta_code i; MLlocal tyn|])
- | Levar(ev,ty) ->
+ | Levar(evk,ty,args) ->
let tyn = fresh_lname Anonymous in
- let i = push_symbol (SymbEvar ev) in
+ let i = push_symbol (SymbEvar evk) in
+ let args = MLarray(Array.map (ml_of_lam env l) args) in
MLlet(tyn, ml_of_lam env l ty,
- MLapp(MLprimitive Mk_evar, [|get_evar_code i;MLlocal tyn|]))
+ MLapp(MLprimitive Mk_evar, [|get_evar_code i;MLlocal tyn; args|]))
| Lprod(dom,codom) ->
let dom = ml_of_lam env l dom in
let codom = ml_of_lam env l codom in
@@ -1504,7 +1501,7 @@ let string_of_dirpath = function
(* OCaml as a module identifier. *)
let string_of_dirpath s = "N"^string_of_dirpath s
-let mod_uid_of_dirpath dir = string_of_dirpath (repr_dirpath dir)
+let mod_uid_of_dirpath dir = string_of_dirpath (DirPath.repr dir)
let link_info_of_dirpath dir =
Linked (mod_uid_of_dirpath dir ^ ".")
@@ -1523,19 +1520,19 @@ let string_of_label_def l =
let rec list_of_mp acc = function
| MPdot (mp,l) -> list_of_mp (string_of_label l::acc) mp
| MPfile dp ->
- let dp = repr_dirpath dp in
+ let dp = DirPath.repr dp in
string_of_dirpath dp :: acc
- | MPbound mbid -> ("X"^string_of_id (id_of_mbid mbid))::acc
+ | MPbound mbid -> ("X"^string_of_id (MBId.to_id mbid))::acc
let list_of_mp mp = list_of_mp [] mp
let string_of_kn kn =
- let (mp,dp,l) = repr_kn kn in
+ let (mp,dp,l) = KerName.repr kn in
let mp = list_of_mp mp in
String.concat "_" mp ^ "_" ^ string_of_label l
-let string_of_con c = string_of_kn (user_con c)
-let string_of_mind mind = string_of_kn (user_mind mind)
+let string_of_con c = string_of_kn (Constant.user c)
+let string_of_mind mind = string_of_kn (MutInd.user mind)
let string_of_gname g =
match g with
@@ -1830,7 +1827,7 @@ and apply_fv env sigma univ (fv_named,fv_rel) auxdefs ml =
in
let auxdefs = List.fold_right get_rel_val fv_rel auxdefs in
let auxdefs = List.fold_right get_named_val fv_named auxdefs in
- let lvl = Context.Rel.length env.env_rel_context in
+ let lvl = Context.Rel.length env.env_rel_context.env_rel_ctx in
let fv_rel = List.map (fun (n,_) -> MLglobal (Grel (lvl-n))) fv_rel in
let fv_named = List.map (fun (id,_) -> MLglobal (Gnamed id)) fv_named in
let aux_name = fresh_lname Anonymous in
@@ -1838,8 +1835,8 @@ and apply_fv env sigma univ (fv_named,fv_rel) auxdefs ml =
and compile_rel env sigma univ auxdefs n =
let open Context.Rel.Declaration in
- let decl = Context.Rel.lookup n env.env_rel_context in
- let n = Context.Rel.length env.env_rel_context - n in
+ let decl = Pre_env.lookup_rel n env in
+ let n = List.length env.env_rel_context.env_rel_ctx - n in
match decl with
| LocalDef (_,t,_) ->
let code = lambda_of_constr env sigma t in
@@ -1877,7 +1874,7 @@ let compile_constant env sigma prefix ~interactive con cb =
if interactive then LinkedInteractive prefix
else Linked prefix
in
- let l = con_label con in
+ let l = Constant.label con in
let auxdefs,code =
if no_univs then compile_with_fv env sigma None [] (Some l) code
else
@@ -1919,15 +1916,17 @@ let compile_constant env sigma prefix ~interactive con cb =
let asw = { asw_ind = ind; asw_prefix = prefix; asw_ci = ci;
asw_reloc = tbl; asw_finite = true } in
let c_uid = fresh_lname Anonymous in
+ let cf_uid = fresh_lname Anonymous in
let _, arity = tbl.(0) in
let ci_uid = fresh_lname Anonymous in
let cargs = Array.init arity
(fun i -> if Int.equal i pb.proj_arg then Some ci_uid else None)
in
let i = push_symbol (SymbConst con) in
- let accu = MLapp (MLprimitive Cast_accu, [|MLlocal c_uid|]) in
+ let accu = MLapp (MLprimitive Cast_accu, [|MLlocal cf_uid|]) in
let accu_br = MLapp (MLprimitive Mk_proj, [|get_const_code i;accu|]) in
- let code = MLmatch(asw,MLlocal c_uid,accu_br,[|[((ind,1),cargs)],MLlocal ci_uid|]) in
+ let code = MLmatch(asw,MLlocal cf_uid,accu_br,[|[((ind,1),cargs)],MLlocal ci_uid|]) in
+ let code = MLlet(cf_uid, MLapp (MLprimitive Force_cofix, [|MLlocal c_uid|]), code) in
let gn = Gproj ("",con) in
let fargs = Array.init (pb.proj_npars + 1) (fun _ -> fresh_lname Anonymous) in
let arg = fargs.(pb.proj_npars) in
@@ -2016,7 +2015,7 @@ let compile_mind_deps env prefix ~interactive
(* This function compiles all necessary dependencies of t, and generates code in
reverse order, as well as linking information updates *)
let rec compile_deps env sigma prefix ~interactive init t =
- match kind_of_term t with
+ match kind t with
| Ind ((mind,_),u) -> compile_mind_deps env prefix ~interactive init mind
| Const c ->
let c,u = get_alias env c in
@@ -2048,8 +2047,8 @@ let rec compile_deps env sigma prefix ~interactive init t =
| Case (ci, p, c, ac) ->
let mind = fst ci.ci_ind in
let init = compile_mind_deps env prefix ~interactive init mind in
- fold_constr (compile_deps env sigma prefix ~interactive) init t
- | _ -> fold_constr (compile_deps env sigma prefix ~interactive) init t
+ Constr.fold (compile_deps env sigma prefix ~interactive) init t
+ | _ -> Constr.fold (compile_deps env sigma prefix ~interactive) init t
let compile_constant_field env prefix con acc cb =
let (gl, _) =
diff --git a/kernel/nativecode.mli b/kernel/nativecode.mli
index ae6fb1bd6..7d20054f7 100644
--- a/kernel/nativecode.mli
+++ b/kernel/nativecode.mli
@@ -5,8 +5,8 @@
(* // * This file is distributed under the terms of the *)
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-open Term
open Names
+open Constr
open Declarations
open Pre_env
open Nativelambda
@@ -32,11 +32,11 @@ val clear_symbols : unit -> unit
val get_value : symbols -> int -> Nativevalues.t
-val get_sort : symbols -> int -> sorts
+val get_sort : symbols -> int -> Sorts.t
-val get_name : symbols -> int -> name
+val get_name : symbols -> int -> Name.t
-val get_const : symbols -> int -> constant
+val get_const : symbols -> int -> Constant.t
val get_match : symbols -> int -> Nativevalues.annot_sw
@@ -44,7 +44,7 @@ val get_ind : symbols -> int -> inductive
val get_meta : symbols -> int -> metavariable
-val get_evar : symbols -> int -> existential
+val get_evar : symbols -> int -> Evar.t
val get_level : symbols -> int -> Univ.Level.t
@@ -60,20 +60,20 @@ val empty_updates : code_location_updates
val register_native_file : string -> unit
-val compile_constant_field : env -> string -> constant ->
+val compile_constant_field : env -> string -> Constant.t ->
global list -> constant_body -> global list
-val compile_mind_field : string -> module_path -> label ->
+val compile_mind_field : string -> ModPath.t -> Label.t ->
global list -> mutual_inductive_body -> global list
val mk_conv_code : env -> evars -> string -> constr -> constr -> linkable_code
val mk_norm_code : env -> evars -> string -> constr -> linkable_code
-val mk_library_header : dir_path -> global list
+val mk_library_header : DirPath.t -> global list
-val mod_uid_of_dirpath : dir_path -> string
+val mod_uid_of_dirpath : DirPath.t -> string
-val link_info_of_dirpath : dir_path -> link_info
+val link_info_of_dirpath : DirPath.t -> link_info
val update_locations : code_location_updates -> unit
diff --git a/kernel/nativeconv.ml b/kernel/nativeconv.ml
index a62a079da..bfa982136 100644
--- a/kernel/nativeconv.ml
+++ b/kernel/nativeconv.ml
@@ -54,13 +54,18 @@ and conv_accu env pb lvl k1 k2 cu =
conv_atom env pb lvl (atom_of_accu k1) (atom_of_accu k2) cu
else
let cu = conv_atom env pb lvl (atom_of_accu k1) (atom_of_accu k2) cu in
- List.fold_right2 (conv_val env CONV lvl) (args_of_accu k1) (args_of_accu k2) cu
+ Array.fold_right2 (conv_val env CONV lvl) (args_of_accu k1) (args_of_accu k2) cu
and conv_atom env pb lvl a1 a2 cu =
if a1 == a2 then cu
else
match a1, a2 with
- | Ameta _, _ | _, Ameta _ | Aevar _, _ | _, Aevar _ -> assert false
+ | Ameta (m1,_), Ameta (m2,_) ->
+ if Int.equal m1 m2 then cu else raise NotConvertible
+ | Aevar (ev1,_,args1), Aevar (ev2,_,args2) ->
+ if Evar.equal ev1 ev2 then
+ Array.fold_right2 (conv_val env CONV lvl) args1 args2 cu
+ else raise NotConvertible
| Arel i1, Arel i2 ->
if Int.equal i1 i2 then cu else raise NotConvertible
| Aind (ind1,u1), Aind (ind2,u2) ->
@@ -112,7 +117,7 @@ and conv_atom env pb lvl a1 a2 cu =
else conv_accu env CONV lvl ac1 ac2 cu
| Arel _, _ | Aind _, _ | Aconstant _, _ | Asort _, _ | Avar _, _
| Acase _, _ | Afix _, _ | Acofix _, _ | Acofixe _, _ | Aprod _, _
- | Aproj _, _ -> raise NotConvertible
+ | Aproj _, _ | Ameta _, _ | Aevar _, _ -> raise NotConvertible
(* Precondition length t1 = length f1 = length f2 = length t2 *)
and conv_fix env lvl t1 f1 t2 f2 cu =
@@ -154,7 +159,7 @@ let warn_no_native_compiler =
(* Wrapper for [native_conv] above *)
let native_conv cv_pb sigma env t1 t2 =
- if Coq_config.no_native_compiler then begin
+ if not Coq_config.native_compiler then begin
warn_no_native_compiler ();
vm_conv cv_pb env t1 t2
end
diff --git a/kernel/nativeconv.mli b/kernel/nativeconv.mli
index fbbcce744..769deacae 100644
--- a/kernel/nativeconv.mli
+++ b/kernel/nativeconv.mli
@@ -5,7 +5,7 @@
(* // * This file is distributed under the terms of the *)
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-open Term
+open Constr
open Reduction
open Nativelambda
diff --git a/kernel/nativeinstr.mli b/kernel/nativeinstr.mli
index 73f18f7a7..48ad88444 100644
--- a/kernel/nativeinstr.mli
+++ b/kernel/nativeinstr.mli
@@ -6,7 +6,7 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
open Names
-open Term
+open Constr
open Nativevalues
(** This file defines the lambda code for the native compiler. It has been
@@ -20,17 +20,17 @@ type uint =
| UintDecomp of prefix * constructor * lambda
and lambda =
- | Lrel of name * int
+ | Lrel of Name.t * int
| Lvar of Id.t
| Lmeta of metavariable * lambda (* type *)
- | Levar of existential * lambda (* type *)
+ | Levar of Evar.t * lambda (* type *) * lambda array (* arguments *)
| Lprod of lambda * lambda
- | Llam of name array * lambda
- | Llet of name * lambda * lambda
+ | Llam of Name.t array * lambda
+ | Llet of Name.t * lambda * lambda
| Lapp of lambda * lambda array
| Lconst of prefix * pconstant
- | Lproj of prefix * constant (* prefix, projection name *)
- | Lprim of prefix * constant * CPrimitives.t * lambda array
+ | Lproj of prefix * Constant.t (* prefix, projection name *)
+ | Lprim of prefix * Constant.t * CPrimitives.t * lambda array
| Lcase of annot_sw * lambda * lambda * lam_branches
(* annotations, term being matched, accu, branches *)
| Lif of lambda * lambda * lambda
@@ -43,11 +43,11 @@ and lambda =
(* A partially applied constructor *)
| Luint of uint
| Lval of Nativevalues.t
- | Lsort of sorts
+ | Lsort of Sorts.t
| Lind of prefix * pinductive
| Llazy
| Lforce
-and lam_branches = (constructor * name array * lambda) array
+and lam_branches = (constructor * Name.t array * lambda) array
-and fix_decl = name array * lambda array * lambda array
+and fix_decl = Name.t array * lambda array * lambda array
diff --git a/kernel/nativelambda.ml b/kernel/nativelambda.ml
index 508112b35..29b3e59da 100644
--- a/kernel/nativelambda.ml
+++ b/kernel/nativelambda.ml
@@ -8,7 +8,7 @@
open Util
open Names
open Esubst
-open Term
+open Constr
open Declarations
open Pre_env
open Nativevalues
@@ -378,7 +378,7 @@ module Renv =
type constructor_info = tag * int * int (* nparam nrealargs *)
type t = {
- name_rel : name Vect.t;
+ name_rel : Name.t Vect.t;
construct_tbl : constructor_info ConstrTable.t;
}
@@ -417,9 +417,9 @@ module Renv =
(* What about pattern matching ?*)
let is_lazy prefix t =
- match kind_of_term t with
+ match kind t with
| App (f,args) ->
- begin match kind_of_term f with
+ begin match kind f with
| Construct (c,_) ->
let entry = mkInd (fst c) in
(try
@@ -448,16 +448,17 @@ let empty_evars =
let empty_ids = [||]
let rec lambda_of_constr env sigma c =
- match kind_of_term c with
+ match kind c with
| Meta mv ->
let ty = meta_type sigma mv in
Lmeta (mv, lambda_of_constr env sigma ty)
- | Evar ev ->
+ | Evar (evk,args as ev) ->
(match evar_value sigma ev with
| None ->
let ty = evar_type sigma ev in
- Levar(ev, lambda_of_constr env sigma ty)
+ let args = Array.map (lambda_of_constr env sigma) args in
+ Levar(evk, lambda_of_constr env sigma ty, args)
| Some t -> lambda_of_constr env sigma t)
| Cast (c, _, _) -> lambda_of_constr env sigma c
@@ -480,7 +481,7 @@ let rec lambda_of_constr env sigma c =
Lprod(ld, Llam([|id|], lc))
| Lambda _ ->
- let params, body = decompose_lam c in
+ let params, body = Term.decompose_lam c in
let ids = get_names (List.rev params) in
Renv.push_rels env ids;
let lb = lambda_of_constr env sigma body in
@@ -515,7 +516,7 @@ let rec lambda_of_constr env sigma c =
{ asw_ind = ind;
asw_ci = ci;
asw_reloc = tbl;
- asw_finite = mib.mind_finite <> Decl_kinds.CoFinite;
+ asw_finite = mib.mind_finite <> CoFinite;
asw_prefix = prefix}
in
(* translation of the argument *)
@@ -561,7 +562,7 @@ let rec lambda_of_constr env sigma c =
Lcofix(init, (names, ltypes, lbodies))
and lambda_of_app env sigma f args =
- match kind_of_term f with
+ match kind f with
| Const (kn,u as c) ->
let kn,u = get_alias !global_env c in
let cb = lookup_constant kn !global_env in
@@ -639,7 +640,7 @@ let optimize lam =
let lambda_of_constr env sigma c =
set_global_env env;
let env = Renv.make () in
- let ids = List.rev_map RelDecl.get_name !global_env.env_rel_context in
+ let ids = List.rev_map RelDecl.get_name !global_env.env_rel_context.env_rel_ctx in
Renv.push_rels env (Array.of_list ids);
let lam = lambda_of_constr env sigma c in
(* if Flags.vm_draw_opt () then begin
@@ -656,7 +657,7 @@ let compile_static_int31 fc args =
if not fc then raise Not_found else
Luint (UintVal
(Uint31.of_int (Array.fold_left
- (fun temp_i -> fun t -> match kind_of_term t with
+ (fun temp_i -> fun t -> match kind t with
| Construct ((_,d),_) -> 2*temp_i+d-1
| _ -> raise NotClosed)
0 args)))
diff --git a/kernel/nativelambda.mli b/kernel/nativelambda.mli
index 156e4f834..933fbc660 100644
--- a/kernel/nativelambda.mli
+++ b/kernel/nativelambda.mli
@@ -6,7 +6,7 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
open Names
-open Term
+open Constr
open Pre_env
open Nativeinstr
@@ -18,13 +18,13 @@ type evars =
val empty_evars : evars
-val decompose_Llam : lambda -> Names.name array * lambda
-val decompose_Llam_Llet : lambda -> (Names.name * lambda option) array * lambda
+val decompose_Llam : lambda -> Name.t array * lambda
+val decompose_Llam_Llet : lambda -> (Name.t * lambda option) array * lambda
val is_lazy : prefix -> constr -> bool
val mk_lazy : lambda -> lambda
-val get_mind_prefix : env -> mutual_inductive -> string
+val get_mind_prefix : env -> MutInd.t -> string
val get_alias : env -> pconstant -> pconstant
@@ -38,5 +38,5 @@ val compile_dynamic_int31 : bool -> prefix -> constructor -> lambda array ->
val before_match_int31 : inductive -> bool -> prefix -> constructor -> lambda ->
lambda
-val compile_prim : CPrimitives.t -> constant -> bool -> prefix -> lambda array ->
+val compile_prim : CPrimitives.t -> Constant.t -> bool -> prefix -> lambda array ->
lambda
diff --git a/kernel/nativelib.ml b/kernel/nativelib.ml
index e9c0e171a..4e7d6b218 100644
--- a/kernel/nativelib.ml
+++ b/kernel/nativelib.ml
@@ -87,7 +87,7 @@ let call_compiler ?profile:(profile=false) ml_filename =
[]
in
let flambda_args =
- if Coq_config.caml_version_nums >= [4;3;0] then
+ if Coq_config.caml_version_nums >= [4;3;0] && Dynlink.is_native then
(* We play safe for now, and use the native compiler
with -Oclassic, however it is likely that `native_compute`
users can benefit from tweaking here.
diff --git a/kernel/nativelib.mli b/kernel/nativelib.mli
index a262a9f58..b74d4fdd0 100644
--- a/kernel/nativelib.mli
+++ b/kernel/nativelib.mli
@@ -21,7 +21,7 @@ val get_ml_filename : unit -> string * string
val compile : string -> global list -> profile:bool -> bool * string
-val compile_library : Names.dir_path -> global list -> string -> bool
+val compile_library : Names.DirPath.t -> global list -> string -> bool
val call_linker :
?fatal:bool -> string -> string -> code_location_updates option -> unit
diff --git a/kernel/nativelibrary.ml b/kernel/nativelibrary.ml
index 3e273dde2..c68f78121 100644
--- a/kernel/nativelibrary.ml
+++ b/kernel/nativelibrary.ml
@@ -26,7 +26,7 @@ let rec translate_mod prefix mp env mod_expr acc =
and translate_field prefix mp env acc (l,x) =
match x with
| SFBconst cb ->
- let con = make_con mp empty_dirpath l in
+ let con = Constant.make3 mp DirPath.empty l in
(if !Flags.debug then
let msg = Printf.sprintf "Compiling constant %s..." (Constant.to_string con) in
Feedback.msg_debug (Pp.str msg));
diff --git a/kernel/nativelibrary.mli b/kernel/nativelibrary.mli
index f327ba224..72e3d8041 100644
--- a/kernel/nativelibrary.mli
+++ b/kernel/nativelibrary.mli
@@ -13,5 +13,5 @@ open Nativecode
(** This file implements separate compilation for libraries in the native
compiler *)
-val dump_library : module_path -> dir_path -> env -> module_signature ->
+val dump_library : ModPath.t -> DirPath.t -> env -> module_signature ->
global list * symbols
diff --git a/kernel/nativevalues.ml b/kernel/nativevalues.ml
index 1c9996d89..3d47b1672 100644
--- a/kernel/nativevalues.ml
+++ b/kernel/nativevalues.ml
@@ -5,10 +5,11 @@
(* // * This file is distributed under the terms of the *)
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-open Term
-open Names
-open CErrors
+
open Util
+open CErrors
+open Names
+open Constr
(** This module defines the representation of values internally used by
the native compiler *)
@@ -51,17 +52,17 @@ type atom =
| Arel of int
| Aconstant of pconstant
| Aind of pinductive
- | Asort of sorts
+ | Asort of Sorts.t
| Avar of Id.t
| Acase of annot_sw * accumulator * t * (t -> t)
| Afix of t array * t array * rec_pos * int
(* types, bodies, rec_pos, pos *)
| Acofix of t array * t array * int * t
| Acofixe of t array * t array * int * t
- | Aprod of name * t * (t -> t)
+ | Aprod of Name.t * t * (t -> t)
| Ameta of metavariable * t
- | Aevar of existential * t
- | Aproj of constant * accumulator
+ | Aevar of Evar.t * t * t array
+ | Aproj of Constant.t * accumulator
let accumulate_tag = 0
@@ -111,6 +112,7 @@ let mk_ind_accu ind u =
mk_accu (Aind (ind,Univ.Instance.of_array u))
let mk_sort_accu s u =
+ let open Sorts in
match s with
| Prop _ -> mk_accu (Asort s)
| Type s ->
@@ -130,8 +132,8 @@ let mk_prod_accu s dom codom =
let mk_meta_accu mv ty =
mk_accu (Ameta (mv,ty))
-let mk_evar_accu ev ty =
- mk_accu (Aevar (ev,ty))
+let mk_evar_accu ev ty args =
+ mk_accu (Aevar (ev,ty,args))
let mk_proj_accu kn c =
mk_accu (Aproj (kn,c))
@@ -151,8 +153,7 @@ let accu_nargs (k:accumulator) =
let args_of_accu (k:accumulator) =
let nargs = accu_nargs k in
let f i = (Obj.magic (Obj.field (Obj.magic k) (nargs-i+2)) : t) in
- let t = Array.init nargs f in
- Array.to_list t
+ Array.init nargs f
let is_accu x =
let o = Obj.repr x in
@@ -177,11 +178,10 @@ let force_cofix (cofix : t) =
let atom = atom_of_accu accu in
match atom with
| Acofix(typ,norm,pos,f) ->
- let f = ref f in
- let args = List.rev (args_of_accu accu) in
- List.iter (fun x -> f := !f x) args;
- let v = !f (Obj.magic ()) in
- set_atom_of_accu accu (Acofixe(typ,norm,pos,v));
+ let args = args_of_accu accu in
+ let f = Array.fold_right (fun arg f -> f arg) args f in
+ let v = f (Obj.magic ()) in
+ set_atom_of_accu accu (Acofixe(typ,norm,pos,v));
v
| Acofixe(_,_,_,v) -> v
| _ -> cofix
diff --git a/kernel/nativevalues.mli b/kernel/nativevalues.mli
index 0e2db8486..993842740 100644
--- a/kernel/nativevalues.mli
+++ b/kernel/nativevalues.mli
@@ -5,7 +5,7 @@
(* // * This file is distributed under the terms of the *)
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-open Term
+open Constr
open Names
(** This modules defines the representation of values internally used by
@@ -43,33 +43,33 @@ type atom =
| Arel of int
| Aconstant of pconstant
| Aind of pinductive
- | Asort of sorts
+ | Asort of Sorts.t
| Avar of Id.t
| Acase of annot_sw * accumulator * t * (t -> t)
| Afix of t array * t array * rec_pos * int
| Acofix of t array * t array * int * t
| Acofixe of t array * t array * int * t
- | Aprod of name * t * (t -> t)
+ | Aprod of Name.t * t * (t -> t)
| Ameta of metavariable * t
- | Aevar of existential * t
- | Aproj of constant * accumulator
+ | Aevar of Evar.t * t (* type *) * t array (* arguments *)
+ | Aproj of Constant.t * accumulator
(* Constructors *)
val mk_accu : atom -> t
val mk_rel_accu : int -> t
val mk_rels_accu : int -> int -> t array
-val mk_constant_accu : constant -> Univ.Level.t array -> t
+val mk_constant_accu : Constant.t -> Univ.Level.t array -> t
val mk_ind_accu : inductive -> Univ.Level.t array -> t
-val mk_sort_accu : sorts -> Univ.Level.t array -> t
+val mk_sort_accu : Sorts.t -> Univ.Level.t array -> t
val mk_var_accu : Id.t -> t
val mk_sw_accu : annot_sw -> accumulator -> t -> (t -> t)
-val mk_prod_accu : name -> t -> t -> t
+val mk_prod_accu : Name.t -> t -> t -> t
val mk_fix_accu : rec_pos -> int -> t array -> t array -> t
val mk_cofix_accu : int -> t array -> t array -> t
val mk_meta_accu : metavariable -> t
-val mk_evar_accu : existential -> t -> t
-val mk_proj_accu : constant -> accumulator -> t
+val mk_evar_accu : Evar.t -> t -> t array -> t
+val mk_proj_accu : Constant.t -> accumulator -> t
val upd_cofix : t -> t -> unit
val force_cofix : t -> t
val mk_const : tag -> t
@@ -84,7 +84,7 @@ val napply : t -> t array -> t
val dummy_value : unit -> t
val atom_of_accu : accumulator -> atom
-val args_of_accu : accumulator -> t list
+val args_of_accu : accumulator -> t array
val accu_nargs : accumulator -> int
val cast_accu : t -> accumulator
diff --git a/kernel/opaqueproof.ml b/kernel/opaqueproof.ml
index 400f9feee..c2fcfbfd6 100644
--- a/kernel/opaqueproof.ml
+++ b/kernel/opaqueproof.ml
@@ -8,7 +8,7 @@
open Names
open Univ
-open Term
+open Constr
open Mod_subst
type work_list = (Instance.t * Id.t array) Cmap.t *
@@ -16,8 +16,8 @@ type work_list = (Instance.t * Id.t array) Cmap.t *
type cooking_info = {
modlist : work_list;
- abstract : Context.Named.t * Univ.universe_level_subst * Univ.AUContext.t }
-type proofterm = (constr * Univ.universe_context_set) Future.computation
+ abstract : Context.Named.t * Univ.Instance.t * Univ.AUContext.t }
+type proofterm = (constr * Univ.ContextSet.t) Future.computation
type opaque =
| Indirect of substitution list * DirPath.t * int (* subst, lib, index *)
| Direct of cooking_info list * proofterm
@@ -138,7 +138,7 @@ let get_proof { opaque_val = prfs; opaque_dir = odp } = function
module FMap = Future.UUIDMap
-let a_constr = Future.from_val (Term.mkRel 1)
+let a_constr = Future.from_val (mkRel 1)
let a_univ = Future.from_val Univ.ContextSet.empty
let a_discharge : cooking_info list = []
diff --git a/kernel/opaqueproof.mli b/kernel/opaqueproof.mli
index a0418a022..c8339e6eb 100644
--- a/kernel/opaqueproof.mli
+++ b/kernel/opaqueproof.mli
@@ -7,7 +7,7 @@
(************************************************************************)
open Names
-open Term
+open Constr
open Mod_subst
(** This module implements the handling of opaque proof terms.
@@ -19,7 +19,7 @@ open Mod_subst
When it is [turn_indirect] the data is relocated to an opaque table
and the [opaque] is turned into an index. *)
-type proofterm = (constr * Univ.universe_context_set) Future.computation
+type proofterm = (constr * Univ.ContextSet.t) Future.computation
type opaquetab
type opaque
@@ -36,10 +36,10 @@ val turn_indirect : DirPath.t -> opaque -> opaquetab -> opaque * opaquetab
(** From a [opaque] back to a [constr]. This might use the
indirect opaque accessor configured below. *)
val force_proof : opaquetab -> opaque -> constr
-val force_constraints : opaquetab -> opaque -> Univ.universe_context_set
-val get_proof : opaquetab -> opaque -> Term.constr Future.computation
+val force_constraints : opaquetab -> opaque -> Univ.ContextSet.t
+val get_proof : opaquetab -> opaque -> constr Future.computation
val get_constraints :
- opaquetab -> opaque -> Univ.universe_context_set Future.computation option
+ opaquetab -> opaque -> Univ.ContextSet.t Future.computation option
val subst_opaque : substitution -> opaque -> opaque
val iter_direct_opaque : (constr -> unit) -> opaque -> opaque
@@ -49,7 +49,7 @@ type work_list = (Univ.Instance.t * Id.t array) Cmap.t *
type cooking_info = {
modlist : work_list;
- abstract : Context.Named.t * Univ.universe_level_subst * Univ.AUContext.t }
+ abstract : Context.Named.t * Univ.Instance.t * Univ.AUContext.t }
(* The type has two caveats:
1) cook_constr is defined after
@@ -63,7 +63,7 @@ val join_opaque : opaquetab -> opaque -> unit
val dump : opaquetab ->
Constr.t Future.computation array *
- Univ.universe_context_set Future.computation array *
+ Univ.ContextSet.t Future.computation array *
cooking_info list array *
int Future.UUIDMap.t
@@ -75,7 +75,7 @@ val dump : opaquetab ->
*)
val set_indirect_opaque_accessor :
- (DirPath.t -> int -> Term.constr Future.computation) -> unit
+ (DirPath.t -> int -> constr Future.computation) -> unit
val set_indirect_univ_accessor :
- (DirPath.t -> int -> Univ.universe_context_set Future.computation option) -> unit
+ (DirPath.t -> int -> Univ.ContextSet.t Future.computation option) -> unit
diff --git a/kernel/pre_env.ml b/kernel/pre_env.ml
index 94738d618..6c5e1cde5 100644
--- a/kernel/pre_env.ml
+++ b/kernel/pre_env.ml
@@ -15,7 +15,6 @@
open Util
open Names
-open Term
open Declarations
module NamedDecl = Context.Named.Declaration
@@ -50,7 +49,7 @@ type stratification = {
}
type val_kind =
- | VKvalue of (values * Id.Set.t) CEphemeron.key
+ | VKvalue of (Vmvalues.values * Id.Set.t) CEphemeron.key
| VKnone
type lazy_val = val_kind ref
@@ -67,15 +66,18 @@ type named_context_val = {
env_named_map : (Context.Named.Declaration.t * lazy_val) Id.Map.t;
}
+type rel_context_val = {
+ env_rel_ctx : Context.Rel.t;
+ env_rel_map : (Context.Rel.Declaration.t * lazy_val) Range.t;
+}
+
type env = {
env_globals : globals; (* globals = constants + inductive types + modules + module-types *)
env_named_context : named_context_val; (* section variables *)
- env_rel_context : Context.Rel.t;
- env_rel_val : lazy_val list;
+ env_rel_context : rel_context_val;
env_nb_rel : int;
env_stratification : stratification;
env_typing_flags : typing_flags;
- env_conv_oracle : Conv_oracle.oracle;
retroknowledge : Retroknowledge.retroknowledge;
indirect_pterms : Opaqueproof.opaquetab;
}
@@ -85,6 +87,11 @@ let empty_named_context_val = {
env_named_map = Id.Map.empty;
}
+let empty_rel_context_val = {
+ env_rel_ctx = [];
+ env_rel_map = Range.empty;
+}
+
let empty_env = {
env_globals = {
env_constants = Cmap_env.empty;
@@ -92,14 +99,12 @@ let empty_env = {
env_modules = MPmap.empty;
env_modtypes = MPmap.empty};
env_named_context = empty_named_context_val;
- env_rel_context = Context.Rel.empty;
- env_rel_val = [];
+ env_rel_context = empty_rel_context_val;
env_nb_rel = 0;
env_stratification = {
env_universes = UGraph.initial_universes;
env_engagement = PredicativeSet };
- env_typing_flags = Declareops.safe_flags;
- env_conv_oracle = Conv_oracle.empty;
+ env_typing_flags = Declareops.safe_flags Conv_oracle.empty;
retroknowledge = Retroknowledge.initial_retroknowledge;
indirect_pterms = Opaqueproof.empty_opaquetab }
@@ -108,21 +113,39 @@ let empty_env = {
let nb_rel env = env.env_nb_rel
+let push_rel_context_val d ctx = {
+ env_rel_ctx = Context.Rel.add d ctx.env_rel_ctx;
+ env_rel_map = Range.cons (d, ref VKnone) ctx.env_rel_map;
+}
+
+let match_rel_context_val ctx = match ctx.env_rel_ctx with
+| [] -> None
+| decl :: rem ->
+ let (_, lval) = Range.hd ctx.env_rel_map in
+ let ctx = { env_rel_ctx = rem; env_rel_map = Range.tl ctx.env_rel_map } in
+ Some (decl, lval, ctx)
+
let push_rel d env =
- let rval = ref VKnone in
{ env with
- env_rel_context = Context.Rel.add d env.env_rel_context;
- env_rel_val = rval :: env.env_rel_val;
+ env_rel_context = push_rel_context_val d env.env_rel_context;
env_nb_rel = env.env_nb_rel + 1 }
+let lookup_rel n env =
+ try fst (Range.get env.env_rel_context.env_rel_map (n - 1))
+ with Invalid_argument _ -> raise Not_found
+
let lookup_rel_val n env =
- try List.nth env.env_rel_val (n - 1)
- with Failure _ -> raise Not_found
+ try snd (Range.get env.env_rel_context.env_rel_map (n - 1))
+ with Invalid_argument _ -> raise Not_found
+
+let rel_skipn n ctx = {
+ env_rel_ctx = Util.List.skipn n ctx.env_rel_ctx;
+ env_rel_map = Range.skipn n ctx.env_rel_map;
+}
let env_of_rel n env =
{ env with
- env_rel_context = Util.List.skipn n env.env_rel_context;
- env_rel_val = Util.List.skipn n env.env_rel_val;
+ env_rel_context = rel_skipn n env.env_rel_context;
env_nb_rel = env.env_nb_rel - n
}
diff --git a/kernel/pre_env.mli b/kernel/pre_env.mli
index f2a009b86..a6b57bd1b 100644
--- a/kernel/pre_env.mli
+++ b/kernel/pre_env.mli
@@ -7,7 +7,7 @@
(************************************************************************)
open Names
-open Term
+open Constr
open Declarations
(** The type of environments. *)
@@ -36,24 +36,27 @@ type stratification = {
type lazy_val
-val force_lazy_val : lazy_val -> (values * Id.Set.t) option
+val force_lazy_val : lazy_val -> (Vmvalues.values * Id.Set.t) option
val dummy_lazy_val : unit -> lazy_val
-val build_lazy_val : lazy_val -> (values * Id.Set.t) -> unit
+val build_lazy_val : lazy_val -> (Vmvalues.values * Id.Set.t) -> unit
type named_context_val = private {
env_named_ctx : Context.Named.t;
env_named_map : (Context.Named.Declaration.t * lazy_val) Id.Map.t;
}
+type rel_context_val = private {
+ env_rel_ctx : Context.Rel.t;
+ env_rel_map : (Context.Rel.Declaration.t * lazy_val) Range.t;
+}
+
type env = {
env_globals : globals;
env_named_context : named_context_val;
- env_rel_context : Context.Rel.t;
- env_rel_val : lazy_val list;
+ env_rel_context : rel_context_val;
env_nb_rel : int;
env_stratification : stratification;
env_typing_flags : typing_flags;
- env_conv_oracle : Conv_oracle.oracle;
retroknowledge : Retroknowledge.retroknowledge;
indirect_pterms : Opaqueproof.opaquetab;
}
@@ -64,8 +67,15 @@ val empty_env : env
(** Rel context *)
+val empty_rel_context_val : rel_context_val
+val push_rel_context_val :
+ Context.Rel.Declaration.t -> rel_context_val -> rel_context_val
+val match_rel_context_val :
+ rel_context_val -> (Context.Rel.Declaration.t * lazy_val * rel_context_val) option
+
val nb_rel : env -> int
val push_rel : Context.Rel.Declaration.t -> env -> env
+val lookup_rel : int -> env -> Context.Rel.Declaration.t
val lookup_rel_val : int -> env -> lazy_val
val env_of_rel : int -> env -> env
@@ -88,9 +98,9 @@ val env_of_named : Id.t -> env -> env
(** Global constants *)
-val lookup_constant_key : constant -> env -> constant_key
-val lookup_constant : constant -> env -> constant_body
+val lookup_constant_key : Constant.t -> env -> constant_key
+val lookup_constant : Constant.t -> env -> constant_body
(** Mutual Inductives *)
-val lookup_mind_key : mutual_inductive -> env -> mind_key
-val lookup_mind : mutual_inductive -> env -> mutual_inductive_body
+val lookup_mind_key : MutInd.t -> env -> mind_key
+val lookup_mind : MutInd.t -> env -> mutual_inductive_body
diff --git a/kernel/reduction.ml b/kernel/reduction.ml
index 2bf9f43a5..6e42764a4 100644
--- a/kernel/reduction.ml
+++ b/kernel/reduction.ml
@@ -18,7 +18,7 @@
open CErrors
open Util
open Names
-open Term
+open Constr
open Vars
open Environ
open CClosure
@@ -57,12 +57,14 @@ let compare_stack_shape stk1 stk2 =
Int.equal bal 0 (* && c1.ci_ind = c2.ci_ind *) && compare_rec 0 s1 s2
| (Zfix(_,a1)::s1, Zfix(_,a2)::s2) ->
Int.equal bal 0 && compare_rec 0 a1 a2 && compare_rec 0 s1 s2
- | (_,_) -> false in
+ | [], _ :: _
+ | (Zproj _ | ZcaseT _ | Zfix _) :: _, _ -> false
+ in
compare_rec 0 stk1 stk2
type lft_constr_stack_elt =
Zlapp of (lift * fconstr) array
- | Zlproj of constant * lift
+ | Zlproj of Constant.t * lift
| Zlfix of (lift * fconstr) * lft_constr_stack
| Zlcase of case_info * lift * fconstr * fconstr array
and lft_constr_stack = lft_constr_stack_elt list
@@ -107,11 +109,11 @@ let pure_stack lfts stk =
(****************************************************************************)
let whd_betaiota env t =
- match kind_of_term t with
+ match kind t with
| (Sort _|Var _|Meta _|Evar _|Const _|Ind _|Construct _|
Prod _|Lambda _|Fix _|CoFix _) -> t
| App (c, _) ->
- begin match kind_of_term c with
+ begin match kind c with
| Ind _ | Construct _ | Evar _ | Meta _ | Const _ | LetIn _ -> t
| _ -> whd_val (create_clos_infos betaiota env) (inject t)
end
@@ -121,37 +123,46 @@ let nf_betaiota env t =
norm_val (create_clos_infos betaiota env) (inject t)
let whd_betaiotazeta env x =
- match kind_of_term x with
- | (Sort _|Var _|Meta _|Evar _|Const _|Ind _|Construct _|
+ match kind x with
+ | (Sort _|Var _|Meta _|Evar _|Const _|Ind _|Construct _|
Prod _|Lambda _|Fix _|CoFix _) -> x
| App (c, _) ->
- begin match kind_of_term c with
+ begin match kind c with
| Ind _ | Construct _ | Evar _ | Meta _ | Const _ -> x
- | _ -> whd_val (create_clos_infos betaiotazeta env) (inject x)
+ | Sort _ | Rel _ | Var _ | Cast _ | Prod _ | Lambda _ | LetIn _ | App _
+ | Case _ | Fix _ | CoFix _ | Proj _ ->
+ whd_val (create_clos_infos betaiotazeta env) (inject x)
end
- | _ -> whd_val (create_clos_infos betaiotazeta env) (inject x)
+ | Rel _ | Cast _ | LetIn _ | Case _ | Proj _ ->
+ whd_val (create_clos_infos betaiotazeta env) (inject x)
let whd_all env t =
- match kind_of_term t with
+ match kind t with
| (Sort _|Meta _|Evar _|Ind _|Construct _|
Prod _|Lambda _|Fix _|CoFix _) -> t
| App (c, _) ->
- begin match kind_of_term c with
+ begin match kind c with
| Ind _ | Construct _ | Evar _ | Meta _ -> t
- | _ -> whd_val (create_clos_infos all env) (inject t)
+ | Sort _ | Rel _ | Var _ | Cast _ | Prod _ | Lambda _ | LetIn _ | App _
+ | Const _ |Case _ | Fix _ | CoFix _ | Proj _ ->
+ whd_val (create_clos_infos all env) (inject t)
end
- | _ -> whd_val (create_clos_infos all env) (inject t)
+ | Rel _ | Cast _ | LetIn _ | Case _ | Proj _ | Const _ | Var _ ->
+ whd_val (create_clos_infos all env) (inject t)
let whd_allnolet env t =
- match kind_of_term t with
+ match kind t with
| (Sort _|Meta _|Evar _|Ind _|Construct _|
Prod _|Lambda _|Fix _|CoFix _|LetIn _) -> t
| App (c, _) ->
- begin match kind_of_term c with
+ begin match kind c with
| Ind _ | Construct _ | Evar _ | Meta _ | LetIn _ -> t
- | _ -> whd_val (create_clos_infos allnolet env) (inject t)
+ | Sort _ | Rel _ | Var _ | Cast _ | Prod _ | Lambda _ | App _
+ | Const _ | Case _ | Fix _ | CoFix _ | Proj _ ->
+ whd_val (create_clos_infos allnolet env) (inject t)
end
- | _ -> whd_val (create_clos_infos allnolet env) (inject t)
+ | Rel _ | Cast _ | Case _ | Proj _ | Const _ | Var _ ->
+ whd_val (create_clos_infos allnolet env) (inject t)
(********************************************************************)
(* Conversion *)
@@ -189,7 +200,7 @@ let is_cumul = function CUMUL -> true | CONV -> false
type 'a universe_compare =
{ (* Might raise NotConvertible *)
- compare : env -> conv_pb -> sorts -> sorts -> 'a -> 'a;
+ compare : env -> conv_pb -> Sorts.t -> Sorts.t -> 'a -> 'a;
compare_instances: flex:bool -> Univ.Instance.t -> Univ.Instance.t -> 'a -> 'a;
conv_inductives : conv_pb -> (Declarations.mutual_inductive_body * int) -> Univ.Instance.t -> int ->
Univ.Instance.t -> int -> 'a -> 'a;
@@ -201,7 +212,7 @@ type 'a universe_state = 'a * 'a universe_compare
type ('a,'b) generic_conversion_function = env -> 'b universe_state -> 'a -> 'a -> 'b
-type 'a infer_conversion_function = env -> UGraph.t -> 'a -> 'a -> Univ.constraints
+type 'a infer_conversion_function = env -> UGraph.t -> 'a -> 'a -> Univ.Constraint.t
let sort_cmp_universes env pb s0 s1 (u, check) =
(check.compare env pb s0 s1 u, check)
@@ -239,7 +250,7 @@ let compare_stacks f fmind lft1 stk1 lft2 stk2 cuniv =
| (Zlapp a1,Zlapp a2) ->
Array.fold_right2 f a1 a2 cu1
| (Zlproj (c1,l1),Zlproj (c2,l2)) ->
- if not (eq_constant c1 c2) then
+ if not (Constant.equal c1 c2) then
raise NotConvertible
else cu1
| (Zlfix(fx1,a1),Zlfix(fx2,a2)) ->
@@ -297,23 +308,12 @@ let in_whnf (t,stk) =
| (FFlex _ | FProd _ | FEvar _ | FInd _ | FAtom _ | FRel _ | FProj _) -> true
| FLOCKED -> assert false
-let unfold_projection infos p c =
- let unf = Projection.unfolded p in
- if unf || RedFlags.red_set infos.i_flags (RedFlags.fCONST (Projection.constant p)) then
- (match try Some (lookup_projection p (info_env infos)) with Not_found -> None with
- | Some pb ->
- let s = Zproj (pb.Declarations.proj_npars, pb.Declarations.proj_arg,
- Projection.constant p) in
- Some (c, s)
- | None -> None)
- else None
-
(* Conversion between [lft1]term1 and [lft2]term2 *)
-let rec ccnv env cv_pb l2r infos lft1 lft2 term1 term2 cuniv =
- eqappr env cv_pb l2r infos (lft1, (term1,[])) (lft2, (term2,[])) cuniv
+let rec ccnv cv_pb l2r infos lft1 lft2 term1 term2 cuniv =
+ eqappr cv_pb l2r infos (lft1, (term1,[])) (lft2, (term2,[])) cuniv
(* Conversion between [lft1](hd1 v1) and [lft2](hd2 v2) *)
-and eqappr env cv_pb l2r infos (lft1,st1) (lft2,st2) cuniv =
+and eqappr cv_pb l2r infos (lft1,st1) (lft2,st2) cuniv =
Control.check_for_interrupt ();
(* First head reduce both terms *)
let whd = whd_stack (infos_with_reds infos betaiotazeta) in
@@ -325,41 +325,44 @@ and eqappr env cv_pb l2r infos (lft1,st1) (lft2,st2) cuniv =
if in_whnf st1' then (st1',st2') else whd_both st1' st2' in
let ((hd1,v1),(hd2,v2)) = whd_both st1 st2 in
let appr1 = (lft1,(hd1,v1)) and appr2 = (lft2,(hd2,v2)) in
- (* compute the lifts that apply to the head of the term (hd1 and hd2) *)
- let el1 = el_stack lft1 v1 in
- let el2 = el_stack lft2 v2 in
+ (** We delay the computation of the lifts that apply to the head of the term
+ with [el_stack] inside the branches where they are actually used. *)
match (fterm_of hd1, fterm_of hd2) with
(* case of leaves *)
| (FAtom a1, FAtom a2) ->
- (match kind_of_term a1, kind_of_term a2 with
+ (match kind a1, kind a2 with
| (Sort s1, Sort s2) ->
if not (is_empty_stack v1 && is_empty_stack v2) then
anomaly (Pp.str "conversion was given ill-typed terms (Sort).");
sort_cmp_universes (env_of_infos infos) cv_pb s1 s2 cuniv
| (Meta n, Meta m) ->
if Int.equal n m
- then convert_stacks env l2r infos lft1 lft2 v1 v2 cuniv
+ then convert_stacks l2r infos lft1 lft2 v1 v2 cuniv
else raise NotConvertible
| _ -> raise NotConvertible)
| (FEvar ((ev1,args1),env1), FEvar ((ev2,args2),env2)) ->
if Evar.equal ev1 ev2 then
- let cuniv = convert_stacks env l2r infos lft1 lft2 v1 v2 cuniv in
- convert_vect env l2r infos el1 el2
+ let el1 = el_stack lft1 v1 in
+ let el2 = el_stack lft2 v2 in
+ let cuniv = convert_stacks l2r infos lft1 lft2 v1 v2 cuniv in
+ convert_vect l2r infos el1 el2
(Array.map (mk_clos env1) args1)
(Array.map (mk_clos env2) args2) cuniv
else raise NotConvertible
(* 2 index known to be bound to no constant *)
| (FRel n, FRel m) ->
+ let el1 = el_stack lft1 v1 in
+ let el2 = el_stack lft2 v2 in
if Int.equal (reloc_rel n el1) (reloc_rel m el2)
- then convert_stacks env l2r infos lft1 lft2 v1 v2 cuniv
+ then convert_stacks l2r infos lft1 lft2 v1 v2 cuniv
else raise NotConvertible
(* 2 constants, 2 local defined vars or 2 defined rels *)
| (FFlex fl1, FFlex fl2) ->
(try
let cuniv = conv_table_key infos fl1 fl2 cuniv in
- convert_stacks env l2r infos lft1 lft2 v1 v2 cuniv
+ convert_stacks l2r infos lft1 lft2 v1 v2 cuniv
with NotConvertible | Univ.UniverseInconsistency _ ->
(* else the oracle tells which constant is to be expanded *)
let oracle = CClosure.oracle_of_infos infos in
@@ -379,50 +382,52 @@ and eqappr env cv_pb l2r infos (lft1,st1) (lft2,st2) cuniv =
| Some def1 -> ((lft1, (def1, v1)), appr2)
| None -> raise NotConvertible)
in
- eqappr env cv_pb l2r infos app1 app2 cuniv)
+ eqappr cv_pb l2r infos app1 app2 cuniv)
| (FProj (p1,c1), FProj (p2, c2)) ->
(* Projections: prefer unfolding to first-order unification,
which will happen naturally if the terms c1, c2 are not in constructor
form *)
- (match unfold_projection infos p1 c1 with
- | Some (def1,s1) ->
- eqappr env cv_pb l2r infos (lft1, (def1, (s1 :: v1))) appr2 cuniv
+ (match unfold_projection infos p1 with
+ | Some s1 ->
+ eqappr cv_pb l2r infos (lft1, (c1, (s1 :: v1))) appr2 cuniv
| None ->
- match unfold_projection infos p2 c2 with
- | Some (def2,s2) ->
- eqappr env cv_pb l2r infos appr1 (lft2, (def2, (s2 :: v2))) cuniv
+ match unfold_projection infos p2 with
+ | Some s2 ->
+ eqappr cv_pb l2r infos appr1 (lft2, (c2, (s2 :: v2))) cuniv
| None ->
if Constant.equal (Projection.constant p1) (Projection.constant p2)
&& compare_stack_shape v1 v2 then
- let u1 = ccnv env CONV l2r infos el1 el2 c1 c2 cuniv in
- convert_stacks env l2r infos lft1 lft2 v1 v2 u1
+ let el1 = el_stack lft1 v1 in
+ let el2 = el_stack lft2 v2 in
+ let u1 = ccnv CONV l2r infos el1 el2 c1 c2 cuniv in
+ convert_stacks l2r infos lft1 lft2 v1 v2 u1
else (* Two projections in WHNF: unfold *)
raise NotConvertible)
| (FProj (p1,c1), t2) ->
- (match unfold_projection infos p1 c1 with
- | Some (def1,s1) ->
- eqappr env cv_pb l2r infos (lft1, (def1, (s1 :: v1))) appr2 cuniv
+ (match unfold_projection infos p1 with
+ | Some s1 ->
+ eqappr cv_pb l2r infos (lft1, (c1, (s1 :: v1))) appr2 cuniv
| None ->
(match t2 with
| FFlex fl2 ->
(match unfold_reference infos fl2 with
| Some def2 ->
- eqappr env cv_pb l2r infos appr1 (lft2, (def2, v2)) cuniv
+ eqappr cv_pb l2r infos appr1 (lft2, (def2, v2)) cuniv
| None -> raise NotConvertible)
| _ -> raise NotConvertible))
| (t1, FProj (p2,c2)) ->
- (match unfold_projection infos p2 c2 with
- | Some (def2,s2) ->
- eqappr env cv_pb l2r infos appr1 (lft2, (def2, (s2 :: v2))) cuniv
+ (match unfold_projection infos p2 with
+ | Some s2 ->
+ eqappr cv_pb l2r infos appr1 (lft2, (c2, (s2 :: v2))) cuniv
| None ->
(match t1 with
| FFlex fl1 ->
(match unfold_reference infos fl1 with
| Some def1 ->
- eqappr env cv_pb l2r infos (lft1, (def1, v1)) appr2 cuniv
+ eqappr cv_pb l2r infos (lft1, (def1, v1)) appr2 cuniv
| None -> raise NotConvertible)
| _ -> raise NotConvertible))
@@ -434,15 +439,19 @@ and eqappr env cv_pb l2r infos (lft1,st1) (lft2,st2) cuniv =
anomaly (Pp.str "conversion was given ill-typed terms (FLambda).");
let (_,ty1,bd1) = destFLambda mk_clos hd1 in
let (_,ty2,bd2) = destFLambda mk_clos hd2 in
- let cuniv = ccnv env CONV l2r infos el1 el2 ty1 ty2 cuniv in
- ccnv env CONV l2r infos (el_lift el1) (el_lift el2) bd1 bd2 cuniv
+ let el1 = el_stack lft1 v1 in
+ let el2 = el_stack lft2 v2 in
+ let cuniv = ccnv CONV l2r infos el1 el2 ty1 ty2 cuniv in
+ ccnv CONV l2r infos (el_lift el1) (el_lift el2) bd1 bd2 cuniv
| (FProd (_,c1,c2), FProd (_,c'1,c'2)) ->
if not (is_empty_stack v1 && is_empty_stack v2) then
anomaly (Pp.str "conversion was given ill-typed terms (FProd).");
(* Luo's system *)
- let cuniv = ccnv env CONV l2r infos el1 el2 c1 c'1 cuniv in
- ccnv env cv_pb l2r infos (el_lift el1) (el_lift el2) c2 c'2 cuniv
+ let el1 = el_stack lft1 v1 in
+ let el2 = el_stack lft2 v2 in
+ let cuniv = ccnv CONV l2r infos el1 el2 c1 c'1 cuniv in
+ ccnv cv_pb l2r infos (el_lift el1) (el_lift el2) c2 c'2 cuniv
(* Eta-expansion on the fly *)
| (FLambda _, _) ->
@@ -452,7 +461,7 @@ and eqappr env cv_pb l2r infos (lft1,st1) (lft2,st2) cuniv =
anomaly (Pp.str "conversion was given unreduced term (FLambda).")
in
let (_,_ty1,bd1) = destFLambda mk_clos hd1 in
- eqappr env CONV l2r infos
+ eqappr CONV l2r infos
(el_lift lft1, (bd1, [])) (el_lift lft2, (hd2, eta_expand_stack v2)) cuniv
| (_, FLambda _) ->
let () = match v2 with
@@ -461,34 +470,43 @@ and eqappr env cv_pb l2r infos (lft1,st1) (lft2,st2) cuniv =
anomaly (Pp.str "conversion was given unreduced term (FLambda).")
in
let (_,_ty2,bd2) = destFLambda mk_clos hd2 in
- eqappr env CONV l2r infos
+ eqappr CONV l2r infos
(el_lift lft1, (hd1, eta_expand_stack v1)) (el_lift lft2, (bd2, [])) cuniv
(* only one constant, defined var or defined rel *)
| (FFlex fl1, c2) ->
(match unfold_reference infos fl1 with
| Some def1 ->
- eqappr env cv_pb l2r infos (lft1, (def1, v1)) appr2 cuniv
+ (** By virtue of the previous case analyses, we know [c2] is rigid.
+ Conversion check to rigid terms eventually implies full weak-head
+ reduction, so instead of repeatedly performing small-step
+ unfoldings, we perform reduction with all flags on. *)
+ let all = RedFlags.red_add_transparent all (RedFlags.red_transparent (info_flags infos)) in
+ let r1 = whd_stack (infos_with_reds infos all) def1 v1 in
+ eqappr cv_pb l2r infos (lft1, r1) appr2 cuniv
| None ->
match c2 with
| FConstruct ((ind2,j2),u2) ->
(try
let v2, v1 =
eta_expand_ind_stack (info_env infos) ind2 hd2 v2 (snd appr1)
- in convert_stacks env l2r infos lft1 lft2 v1 v2 cuniv
+ in convert_stacks l2r infos lft1 lft2 v1 v2 cuniv
with Not_found -> raise NotConvertible)
| _ -> raise NotConvertible)
| (c1, FFlex fl2) ->
(match unfold_reference infos fl2 with
| Some def2 ->
- eqappr env cv_pb l2r infos appr1 (lft2, (def2, v2)) cuniv
+ (** Symmetrical case of above. *)
+ let all = RedFlags.red_add_transparent all (RedFlags.red_transparent (info_flags infos)) in
+ let r2 = whd_stack (infos_with_reds infos all) def2 v2 in
+ eqappr cv_pb l2r infos appr1 (lft2, r2) cuniv
| None ->
match c1 with
| FConstruct ((ind1,j1),u1) ->
(try let v1, v2 =
eta_expand_ind_stack (info_env infos) ind1 hd1 v1 (snd appr2)
- in convert_stacks env l2r infos lft1 lft2 v1 v2 cuniv
+ in convert_stacks l2r infos lft1 lft2 v1 v2 cuniv
with Not_found -> raise NotConvertible)
| _ -> raise NotConvertible)
@@ -497,9 +515,9 @@ and eqappr env cv_pb l2r infos (lft1,st1) (lft2,st2) cuniv =
if eq_ind ind1 ind2 then
if Univ.Instance.length u1 = 0 || Univ.Instance.length u2 = 0 then
let cuniv = convert_instances ~flex:false u1 u2 cuniv in
- convert_stacks env l2r infos lft1 lft2 v1 v2 cuniv
+ convert_stacks l2r infos lft1 lft2 v1 v2 cuniv
else
- let mind = Environ.lookup_mind (fst ind1) env in
+ let mind = Environ.lookup_mind (fst ind1) (info_env infos) in
let cuniv =
match mind.Declarations.mind_universes with
| Declarations.Monomorphic_ind _ | Declarations.Polymorphic_ind _ ->
@@ -508,16 +526,16 @@ and eqappr env cv_pb l2r infos (lft1,st1) (lft2,st2) cuniv =
convert_inductives cv_pb (mind, snd ind1) u1 (CClosure.stack_args_size v1)
u2 (CClosure.stack_args_size v2) cuniv
in
- convert_stacks env l2r infos lft1 lft2 v1 v2 cuniv
+ convert_stacks l2r infos lft1 lft2 v1 v2 cuniv
else raise NotConvertible
| (FConstruct ((ind1,j1),u1), FConstruct ((ind2,j2),u2)) ->
if Int.equal j1 j2 && eq_ind ind1 ind2 then
if Univ.Instance.length u1 = 0 || Univ.Instance.length u2 = 0 then
let cuniv = convert_instances ~flex:false u1 u2 cuniv in
- convert_stacks env l2r infos lft1 lft2 v1 v2 cuniv
+ convert_stacks l2r infos lft1 lft2 v1 v2 cuniv
else
- let mind = Environ.lookup_mind (fst ind1) env in
+ let mind = Environ.lookup_mind (fst ind1) (info_env infos) in
let cuniv =
match mind.Declarations.mind_universes with
| Declarations.Monomorphic_ind _ | Declarations.Polymorphic_ind _ ->
@@ -527,7 +545,7 @@ and eqappr env cv_pb l2r infos (lft1,st1) (lft2,st2) cuniv =
(mind, snd ind1, j1) u1 (CClosure.stack_args_size v1)
u2 (CClosure.stack_args_size v2) cuniv
in
- convert_stacks env l2r infos lft1 lft2 v1 v2 cuniv
+ convert_stacks l2r infos lft1 lft2 v1 v2 cuniv
else raise NotConvertible
(* Eta expansion of records *)
@@ -535,14 +553,14 @@ and eqappr env cv_pb l2r infos (lft1,st1) (lft2,st2) cuniv =
(try
let v1, v2 =
eta_expand_ind_stack (info_env infos) ind1 hd1 v1 (snd appr2)
- in convert_stacks env l2r infos lft1 lft2 v1 v2 cuniv
+ in convert_stacks l2r infos lft1 lft2 v1 v2 cuniv
with Not_found -> raise NotConvertible)
| (_, FConstruct ((ind2,j2),u2)) ->
(try
let v2, v1 =
eta_expand_ind_stack (info_env infos) ind2 hd2 v2 (snd appr1)
- in convert_stacks env l2r infos lft1 lft2 v1 v2 cuniv
+ in convert_stacks l2r infos lft1 lft2 v1 v2 cuniv
with Not_found -> raise NotConvertible)
| (FFix (((op1, i1),(_,tys1,cl1)),e1), FFix(((op2, i2),(_,tys2,cl2)),e2)) ->
@@ -553,11 +571,13 @@ and eqappr env cv_pb l2r infos (lft1,st1) (lft2,st2) cuniv =
let fty2 = Array.map (mk_clos e2) tys2 in
let fcl1 = Array.map (mk_clos (subs_liftn n e1)) cl1 in
let fcl2 = Array.map (mk_clos (subs_liftn n e2)) cl2 in
- let cuniv = convert_vect env l2r infos el1 el2 fty1 fty2 cuniv in
+ let el1 = el_stack lft1 v1 in
+ let el2 = el_stack lft2 v2 in
+ let cuniv = convert_vect l2r infos el1 el2 fty1 fty2 cuniv in
let cuniv =
- convert_vect env l2r infos
+ convert_vect l2r infos
(el_liftn n el1) (el_liftn n el2) fcl1 fcl2 cuniv in
- convert_stacks env l2r infos lft1 lft2 v1 v2 cuniv
+ convert_stacks l2r infos lft1 lft2 v1 v2 cuniv
else raise NotConvertible
| (FCoFix ((op1,(_,tys1,cl1)),e1), FCoFix((op2,(_,tys2,cl2)),e2)) ->
@@ -568,28 +588,30 @@ and eqappr env cv_pb l2r infos (lft1,st1) (lft2,st2) cuniv =
let fty2 = Array.map (mk_clos e2) tys2 in
let fcl1 = Array.map (mk_clos (subs_liftn n e1)) cl1 in
let fcl2 = Array.map (mk_clos (subs_liftn n e2)) cl2 in
- let cuniv = convert_vect env l2r infos el1 el2 fty1 fty2 cuniv in
+ let el1 = el_stack lft1 v1 in
+ let el2 = el_stack lft2 v2 in
+ let cuniv = convert_vect l2r infos el1 el2 fty1 fty2 cuniv in
let cuniv =
- convert_vect env l2r infos
+ convert_vect l2r infos
(el_liftn n el1) (el_liftn n el2) fcl1 fcl2 cuniv in
- convert_stacks env l2r infos lft1 lft2 v1 v2 cuniv
+ convert_stacks l2r infos lft1 lft2 v1 v2 cuniv
else raise NotConvertible
(* Should not happen because both (hd1,v1) and (hd2,v2) are in whnf *)
| ( (FLetIn _, _) | (FCaseT _,_) | (FApp _,_) | (FCLOS _,_) | (FLIFT _,_)
| (_, FLetIn _) | (_,FCaseT _) | (_,FApp _) | (_,FCLOS _) | (_,FLIFT _)
- | (FLOCKED,_) | (_,FLOCKED) ) -> assert false
+ | (FLOCKED,_) | (_,FLOCKED) ) | (FCast _, _) | (_, FCast _) -> assert false
- (* In all other cases, terms are not convertible *)
- | _ -> raise NotConvertible
+ | (FRel _ | FAtom _ | FInd _ | FFix _ | FCoFix _
+ | FProd _ | FEvar _), _ -> raise NotConvertible
-and convert_stacks env l2r infos lft1 lft2 stk1 stk2 cuniv =
+and convert_stacks l2r infos lft1 lft2 stk1 stk2 cuniv =
compare_stacks
- (fun (l1,t1) (l2,t2) cuniv -> ccnv env CONV l2r infos l1 l2 t1 t2 cuniv)
+ (fun (l1,t1) (l2,t2) cuniv -> ccnv CONV l2r infos l1 l2 t1 t2 cuniv)
(eq_ind)
lft1 stk1 lft2 stk2 cuniv
-and convert_vect env l2r infos lft1 lft2 v1 v2 cuniv =
+and convert_vect l2r infos lft1 lft2 v1 v2 cuniv =
let lv1 = Array.length v1 in
let lv2 = Array.length v2 in
if Int.equal lv1 lv2
@@ -597,7 +619,7 @@ and convert_vect env l2r infos lft1 lft2 v1 v2 cuniv =
let rec fold n cuniv =
if n >= lv1 then cuniv
else
- let cuniv = ccnv env CONV l2r infos lft1 lft2 v1.(n) v2.(n) cuniv in
+ let cuniv = ccnv CONV l2r infos lft1 lft2 v1.(n) v2.(n) cuniv in
fold (n+1) cuniv in
fold 0 cuniv
else raise NotConvertible
@@ -605,7 +627,7 @@ and convert_vect env l2r infos lft1 lft2 v1 v2 cuniv =
let clos_gen_conv trans cv_pb l2r evars env univs t1 t2 =
let reds = CClosure.RedFlags.red_add_transparent betaiotazeta trans in
let infos = create_clos_infos ~evars reds env in
- ccnv env cv_pb l2r infos el_id el_id (inject t1) (inject t2) univs
+ ccnv cv_pb l2r infos el_id el_id (inject t1) (inject t2) univs
let check_eq univs u u' =
@@ -615,6 +637,7 @@ let check_leq univs u u' =
if not (UGraph.check_leq univs u u') then raise NotConvertible
let check_sort_cmp_universes env pb s0 s1 univs =
+ let open Sorts in
match (s0,s1) with
| (Prop c1, Prop c2) when is_cumul pb ->
begin match c1, c2 with
@@ -734,6 +757,7 @@ let infer_leq (univs, cstrs as cuniv) u u' =
univs, cstrs'
let infer_cmp_universes env pb s0 s1 univs =
+ let open Sorts in
match (s0,s1) with
| (Prop c1, Prop c2) when is_cumul pb ->
begin match c1, c2 with
@@ -820,8 +844,8 @@ let gen_conv cv_pb l2r reds env evars univs t1 t2 =
let gen_conv cv_pb ?(l2r=false) ?(reds=full_transparent_state) env ?(evars=(fun _->None), universes env) =
let evars, univs = evars in
if Flags.profile then
- let fconv_universes_key = Profile.declare_profile "trans_fconv_universes" in
- Profile.profile8 fconv_universes_key gen_conv cv_pb l2r reds env evars univs
+ let fconv_universes_key = CProfile.declare_profile "trans_fconv_universes" in
+ CProfile.profile8 fconv_universes_key gen_conv cv_pb l2r reds env evars univs
else gen_conv cv_pb l2r reds env evars univs
let conv = gen_conv CONV
@@ -847,8 +871,8 @@ let infer_conv_universes cv_pb l2r evars reds env univs t1 t2 =
(* Profiling *)
let infer_conv_universes =
if Flags.profile then
- let infer_conv_universes_key = Profile.declare_profile "infer_conv_universes" in
- Profile.profile8 infer_conv_universes_key infer_conv_universes
+ let infer_conv_universes_key = CProfile.declare_profile "infer_conv_universes" in
+ CProfile.profile8 infer_conv_universes_key infer_conv_universes
else infer_conv_universes
let infer_conv ?(l2r=false) ?(evars=fun _ -> None) ?(ts=full_transparent_state)
@@ -869,7 +893,7 @@ let warn_bytecode_compiler_failed =
(fun () -> strbrk "Bytecode compiler failed, " ++
strbrk "falling back to standard conversion")
-let set_vm_conv (f:conv_pb -> Term.types kernel_conversion_function) = vm_conv := f
+let set_vm_conv (f:conv_pb -> types kernel_conversion_function) = vm_conv := f
let vm_conv cv_pb env t1 t2 =
try
!vm_conv cv_pb env t1 t2
@@ -882,22 +906,22 @@ let default_conv cv_pb ?(l2r=false) env t1 t2 =
let default_conv_leq = default_conv CUMUL
(*
-let convleqkey = Profile.declare_profile "Kernel_reduction.conv_leq";;
+let convleqkey = CProfile.declare_profile "Kernel_reduction.conv_leq";;
let conv_leq env t1 t2 =
- Profile.profile4 convleqkey conv_leq env t1 t2;;
+ CProfile.profile4 convleqkey conv_leq env t1 t2;;
-let convkey = Profile.declare_profile "Kernel_reduction.conv";;
+let convkey = CProfile.declare_profile "Kernel_reduction.conv";;
let conv env t1 t2 =
- Profile.profile4 convleqkey conv env t1 t2;;
+ CProfile.profile4 convleqkey conv env t1 t2;;
*)
(* Application with on-the-fly reduction *)
let beta_applist c l =
let rec app subst c l =
- match kind_of_term c, l with
+ match kind c, l with
| Lambda(_,_,c), arg::l -> app (arg::subst) c l
- | _ -> applist (substl subst c, l) in
+ | _ -> Term.applist (substl subst c, l) in
app [] c l
let beta_appvect c v = beta_applist c (Array.to_list v)
@@ -905,7 +929,7 @@ let beta_appvect c v = beta_applist c (Array.to_list v)
let beta_app c a = beta_applist c [a]
(* Compatibility *)
-let betazeta_appvect = lambda_appvect_assum
+let betazeta_appvect = Term.lambda_appvect_assum
(********************************************************************)
(* Special-Purpose Reduction *)
@@ -918,7 +942,7 @@ let betazeta_appvect = lambda_appvect_assum
* error message. *)
let hnf_prod_app env t n =
- match kind_of_term (whd_all env t) with
+ match kind (whd_all env t) with
| Prod (_,_,b) -> subst1 n b
| _ -> anomaly ~label:"hnf_prod_app" (Pp.str "Need a product.")
@@ -930,7 +954,7 @@ let hnf_prod_applist env t nl =
let dest_prod env =
let rec decrec env m c =
let t = whd_all env c in
- match kind_of_term t with
+ match kind t with
| Prod (n,a,c0) ->
let d = LocalAssum (n,a) in
decrec (push_rel d env) (Context.Rel.add d m) c0
@@ -942,7 +966,7 @@ let dest_prod env =
let dest_prod_assum env =
let rec prodec_rec env l ty =
let rty = whd_allnolet env ty in
- match kind_of_term rty with
+ match kind rty with
| Prod (x,t,c) ->
let d = LocalAssum (x,t) in
prodec_rec (push_rel d env) (Context.Rel.add d l) c
@@ -952,7 +976,7 @@ let dest_prod_assum env =
| Cast (c,_,_) -> prodec_rec env l c
| _ ->
let rty' = whd_all env rty in
- if Term.eq_constr rty' rty then l, rty
+ if Constr.equal rty' rty then l, rty
else prodec_rec env l rty'
in
prodec_rec env Context.Rel.empty
@@ -960,7 +984,7 @@ let dest_prod_assum env =
let dest_lam_assum env =
let rec lamec_rec env l ty =
let rty = whd_allnolet env ty in
- match kind_of_term rty with
+ match kind rty with
| Lambda (x,t,c) ->
let d = LocalAssum (x,t) in
lamec_rec (push_rel d env) (Context.Rel.add d l) c
@@ -976,7 +1000,7 @@ exception NotArity
let dest_arity env c =
let l, c = dest_prod_assum env c in
- match kind_of_term c with
+ match kind c with
| Sort s -> l,s
| _ -> raise NotArity
diff --git a/kernel/reduction.mli b/kernel/reduction.mli
index 253c0874f..573e4c8bd 100644
--- a/kernel/reduction.mli
+++ b/kernel/reduction.mli
@@ -6,7 +6,7 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-open Term
+open Constr
open Environ
(***********************************************************************
@@ -37,7 +37,7 @@ type conv_pb = CONV | CUMUL
type 'a universe_compare =
{ (* Might raise NotConvertible *)
- compare : env -> conv_pb -> sorts -> sorts -> 'a -> 'a;
+ compare : env -> conv_pb -> Sorts.t -> Sorts.t -> 'a -> 'a;
compare_instances: flex:bool -> Univ.Instance.t -> Univ.Instance.t -> 'a -> 'a;
conv_inductives : conv_pb -> (Declarations.mutual_inductive_body * int) -> Univ.Instance.t -> int ->
Univ.Instance.t -> int -> 'a -> 'a;
@@ -49,9 +49,9 @@ type 'a universe_state = 'a * 'a universe_compare
type ('a,'b) generic_conversion_function = env -> 'b universe_state -> 'a -> 'a -> 'b
-type 'a infer_conversion_function = env -> UGraph.t -> 'a -> 'a -> Univ.constraints
+type 'a infer_conversion_function = env -> UGraph.t -> 'a -> 'a -> Univ.Constraint.t
-val sort_cmp_universes : env -> conv_pb -> sorts -> sorts ->
+val sort_cmp_universes : env -> conv_pb -> Sorts.t -> Sorts.t ->
'a * 'a universe_compare -> 'a * 'a universe_compare
(* [flex] should be true for constants, false for inductive types and
@@ -115,7 +115,7 @@ val dest_lam_assum : env -> types -> Context.Rel.t * types
exception NotArity
-val dest_arity : env -> types -> arity (* raises NotArity if not an arity *)
+val dest_arity : env -> types -> Term.arity (* raises NotArity if not an arity *)
val is_arity : env -> types -> bool
val warn_bytecode_compiler_failed : ?loc:Loc.t -> unit -> unit
diff --git a/kernel/retroknowledge.ml b/kernel/retroknowledge.ml
index 5fbd914f3..88cf93acc 100644
--- a/kernel/retroknowledge.ml
+++ b/kernel/retroknowledge.ml
@@ -14,7 +14,7 @@
for evaluation in the bytecode virtual machine *)
open Names
-open Term
+open Constr
(* The retroknowledge defines a bijective correspondance between some
[entry]-s (which are, in fact, merely terms) and [field]-s which
@@ -102,7 +102,7 @@ module Reactive = Map.Make (EntryOrd)
type reactive_info = {(*information required by the compiler of the VM *)
vm_compiling :
(*fastcomputation flag -> continuation -> result *)
- (bool->Cbytecodes.comp_env->constr array ->
+ (bool -> Cbytecodes.comp_env -> constr array ->
int->Cbytecodes.bytecodes->Cbytecodes.bytecodes)
option;
vm_constant_static :
@@ -117,7 +117,7 @@ type reactive_info = {(*information required by the compiler of the VM *)
(* fastcomputation flag -> cont -> result *)
vm_before_match : (bool -> Cbytecodes.bytecodes -> Cbytecodes.bytecodes) option;
(* tag (= compiled int for instance) -> result *)
- vm_decompile_const : (int -> Term.constr) option;
+ vm_decompile_const : (int -> constr) option;
native_compiling :
(bool -> Nativeinstr.prefix -> Nativeinstr.lambda array ->
diff --git a/kernel/retroknowledge.mli b/kernel/retroknowledge.mli
index 18a12a4ef..e4d78ba14 100644
--- a/kernel/retroknowledge.mli
+++ b/kernel/retroknowledge.mli
@@ -7,7 +7,7 @@
(************************************************************************)
open Names
-open Term
+open Constr
type retroknowledge
@@ -117,7 +117,7 @@ val get_vm_before_match_info : retroknowledge -> entry -> Cbytecodes.bytecodes
recover the elements of that type from their compiled form if it's non
standard (it is used (and can be used) only when the compiled form
is not a block *)
-val get_vm_decompile_constant_info : retroknowledge -> entry -> int -> Term.constr
+val get_vm_decompile_constant_info : retroknowledge -> entry -> int -> constr
val get_native_compiling_info : retroknowledge -> entry -> Nativeinstr.prefix ->
@@ -163,7 +163,7 @@ type reactive_info = {(*information required by the compiler of the VM *)
(* fastcomputation flag -> cont -> result *)
vm_before_match : (bool -> Cbytecodes.bytecodes -> Cbytecodes.bytecodes) option;
(* tag (= compiled int for instance) -> result *)
- vm_decompile_const : (int -> Term.constr) option;
+ vm_decompile_const : (int -> constr) option;
native_compiling :
(bool -> Nativeinstr.prefix -> Nativeinstr.lambda array ->
diff --git a/kernel/safe_typing.ml b/kernel/safe_typing.ml
index fd024b215..93b8e278f 100644
--- a/kernel/safe_typing.ml
+++ b/kernel/safe_typing.ml
@@ -114,7 +114,7 @@ module DPMap = Map.Make(DirPath)
type safe_environment =
{ env : Environ.env;
- modpath : module_path;
+ modpath : ModPath.t;
modvariant : modvariant;
modresolver : Mod_subst.delta_resolver;
paramresolver : Mod_subst.delta_resolver;
@@ -125,7 +125,7 @@ type safe_environment =
future_cst : Univ.ContextSet.t Future.computation list;
engagement : engagement option;
required : vodigest DPMap.t;
- loads : (module_path * module_body) list;
+ loads : (ModPath.t * module_body) list;
local_retroknowledge : Retroknowledge.action list;
native_symbols : Nativecode.symbols DPMap.t }
@@ -143,7 +143,7 @@ let rec library_dp_of_senv senv =
let empty_environment =
{ env = Environ.empty_env;
- modpath = initial_path;
+ modpath = ModPath.initial;
modvariant = NONE;
modresolver = Mod_subst.empty_delta_resolver;
paramresolver = Mod_subst.empty_delta_resolver;
@@ -160,7 +160,7 @@ let empty_environment =
let is_initial senv =
match senv.revstruct, senv.modvariant with
- | [], NONE -> ModPath.equal senv.modpath initial_path
+ | [], NONE -> ModPath.equal senv.modpath ModPath.initial
| _ -> false
let delta_of_senv senv = senv.modresolver,senv.paramresolver
@@ -249,14 +249,14 @@ let universes_of_private eff =
in
match cb.const_universes with
| Monomorphic_const ctx ->
- (Univ.ContextSet.of_context ctx) :: acc
+ ctx :: acc
| Polymorphic_const _ -> acc
)
acc l
| Entries.SEsubproof (c, cb, e) ->
match cb.const_universes with
| Monomorphic_const ctx ->
- (Univ.ContextSet.of_context ctx) :: acc
+ ctx :: acc
| Polymorphic_const _ -> acc
)
[] (Term_typing.uniq_seff eff)
@@ -382,24 +382,9 @@ let safe_push_named d env =
let push_named_def (id,de) senv =
- let open Entries in
- let trust = Term_typing.SideEffects senv.revstruct in
- let c,typ,univs = Term_typing.translate_local_def trust senv.env id de in
- let poly = match de.Entries.const_entry_universes with
- | Monomorphic_const_entry _ -> false
- | Polymorphic_const_entry _ -> true
- in
- let univs = Univ.ContextSet.of_context univs in
- let c, univs = match c with
- | Def c -> Mod_subst.force_constr c, univs
- | OpaqueDef o ->
- Opaqueproof.force_proof (Environ.opaque_tables senv.env) o,
- Univ.ContextSet.union univs
- (Opaqueproof.force_constraints (Environ.opaque_tables senv.env) o)
- | _ -> assert false in
- let senv' = push_context_set poly univs senv in
- let env'' = safe_push_named (LocalDef (id,c,typ)) senv'.env in
- univs, {senv' with env=env''}
+ let c, typ = Term_typing.translate_local_def senv.env id de in
+ let env'' = safe_push_named (LocalDef (id, c, typ)) senv.env in
+ { senv with env = env'' }
let push_named_assum ((id,t,poly),ctx) senv =
let senv' = push_context_set poly ctx senv in
@@ -425,9 +410,8 @@ let labels_of_mib mib =
let globalize_constant_universes env cb =
match cb.const_universes with
- | Monomorphic_const ctx ->
- let cstrs = Univ.ContextSet.of_context ctx in
- Now (false, cstrs) ::
+ | Monomorphic_const cstrs ->
+ Now (false, cstrs) ::
(match cb.const_body with
| (Undef _ | Def _) -> []
| OpaqueDef lc ->
@@ -443,7 +427,7 @@ let globalize_constant_universes env cb =
let globalize_mind_universes mb =
match mb.mind_universes with
| Monomorphic_ind ctx ->
- [Now (false, Univ.ContextSet.of_context ctx)]
+ [Now (false, ctx)]
| Polymorphic_ind _ -> [Now (true, Univ.ContextSet.empty)]
| Cumulative_ind _ -> [Now (true, Univ.ContextSet.empty)]
@@ -458,8 +442,8 @@ let constraints_of_sfb env sfb =
It also performs the corresponding [add_constraints]. *)
type generic_name =
- | C of constant
- | I of mutual_inductive
+ | C of Constant.t
+ | I of MutInd.t
| M (** name already known, cf the mod_mp field *)
| MT (** name already known, cf the mod_mp field *)
@@ -502,7 +486,7 @@ type global_declaration =
| GlobalRecipe of Cooking.recipe
type exported_private_constant =
- constant * private_constant_role
+ Constant.t * private_constant_role
let add_constant_aux no_section senv (kn, cb) =
let l = pi3 (Constant.repr3 kn) in
@@ -521,7 +505,7 @@ let add_constant_aux no_section senv (kn, cb) =
let senv'' = match cb.const_body with
| Undef (Some lev) ->
update_resolver
- (Mod_subst.add_inline_delta_resolver (user_con kn) (lev,None)) senv'
+ (Mod_subst.add_inline_delta_resolver (Constant.user kn) (lev,None)) senv'
| _ -> senv'
in
senv''
@@ -535,7 +519,7 @@ let export_private_constants ~in_section ce senv =
(ce, exported), senv
let add_constant dir l decl senv =
- let kn = make_con senv.modpath dir l in
+ let kn = Constant.make3 senv.modpath dir l in
let no_section = DirPath.is_empty dir in
let senv =
let cb =
@@ -562,7 +546,7 @@ let check_mind mie lab =
let add_mind dir l mie senv =
let () = check_mind mie l in
- let kn = make_mind senv.modpath dir l in
+ let kn = MutInd.make3 senv.modpath dir l in
let mib = Term_typing.translate_mind senv.env kn mie in
let mib =
match mib.mind_hyps with [] -> Declareops.hcons_mind mib | _ -> mib
@@ -860,7 +844,7 @@ let export ?except senv dir =
}
in
let ast, symbols =
- if !Flags.native_compiler then
+ if !Flags.output_native_objects then
Nativelibrary.dump_library mp dir senv.env str
else [], Nativecode.empty_symbols
in
diff --git a/kernel/safe_typing.mli b/kernel/safe_typing.mli
index f0f273f35..757b803a3 100644
--- a/kernel/safe_typing.mli
+++ b/kernel/safe_typing.mli
@@ -60,8 +60,8 @@ 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_con_of_con : safe_environment -> constant -> private_constant
-val private_con_of_scheme : kind:string -> safe_environment -> (inductive * constant) list -> private_constant
+val private_con_of_con : safe_environment -> Constant.t -> private_constant
+val private_con_of_scheme : kind:string -> safe_environment -> (inductive * Constant.t) list -> private_constant
val mk_pure_proof : Constr.constr -> private_constants Entries.proof_output
val inline_private_constants_in_constr :
@@ -69,7 +69,7 @@ val inline_private_constants_in_constr :
val inline_private_constants_in_definition_entry :
Environ.env -> private_constants Entries.definition_entry -> unit Entries.definition_entry
-val universes_of_private : private_constants -> Univ.universe_context_set list
+val universes_of_private : private_constants -> Univ.ContextSet.t list
val is_curmod_library : safe_environment -> bool
@@ -84,13 +84,13 @@ val is_joined_environment : safe_environment -> bool
(** Insertion of local declarations (Local or Variables) *)
val push_named_assum :
- (Id.t * Term.types * bool (* polymorphic *))
+ (Id.t * Constr.types * bool (* polymorphic *))
Univ.in_universe_context_set -> safe_transformer0
(** Returns the full universe context necessary to typecheck the definition
(futures are forced) *)
val push_named_def :
- Id.t * private_constants Entries.definition_entry -> Univ.universe_context_set safe_transformer
+ Id.t * Entries.section_def_entry -> safe_transformer0
(** Insertion of global axioms or definitions *)
@@ -103,43 +103,43 @@ type global_declaration =
| GlobalRecipe of Cooking.recipe
type exported_private_constant =
- constant * private_constant_role
+ Constant.t * private_constant_role
val export_private_constants : in_section:bool ->
- private_constants Entries.constant_entry ->
- (unit Entries.constant_entry * exported_private_constant list) safe_transformer
+ private_constants Entries.definition_entry ->
+ (unit Entries.definition_entry * exported_private_constant list) safe_transformer
(** returns the main constant plus a list of auxiliary constants (empty
unless one requires the side effects to be exported) *)
val add_constant :
DirPath.t -> Label.t -> global_declaration ->
- constant safe_transformer
+ Constant.t safe_transformer
(** Adding an inductive type *)
val add_mind :
DirPath.t -> Label.t -> Entries.mutual_inductive_entry ->
- mutual_inductive safe_transformer
+ MutInd.t safe_transformer
(** Adding a module or a module type *)
val add_module :
Label.t -> Entries.module_entry -> Declarations.inline ->
- (module_path * Mod_subst.delta_resolver) safe_transformer
+ (ModPath.t * Mod_subst.delta_resolver) safe_transformer
val add_modtype :
Label.t -> Entries.module_type_entry -> Declarations.inline ->
- module_path safe_transformer
+ ModPath.t safe_transformer
(** Adding universe constraints *)
val push_context_set :
- bool -> Univ.universe_context_set -> safe_transformer0
+ bool -> Univ.ContextSet.t -> safe_transformer0
val push_context :
- bool -> Univ.universe_context -> safe_transformer0
+ bool -> Univ.UContext.t -> safe_transformer0
val add_constraints :
- Univ.constraints -> safe_transformer0
+ Univ.Constraint.t -> safe_transformer0
(* (\** Generator of universes *\) *)
(* val next_universe : int safe_transformer *)
@@ -150,9 +150,9 @@ val set_typing_flags : Declarations.typing_flags -> safe_transformer0
(** {6 Interactive module functions } *)
-val start_module : Label.t -> module_path safe_transformer
+val start_module : Label.t -> ModPath.t safe_transformer
-val start_modtype : Label.t -> module_path safe_transformer
+val start_modtype : Label.t -> ModPath.t safe_transformer
val add_module_parameter :
MBId.t -> Entries.module_struct_entry -> Declarations.inline ->
@@ -166,17 +166,17 @@ val allow_delayed_constants : bool ref
val end_module :
Label.t -> (Entries.module_struct_entry * Declarations.inline) option ->
- (module_path * MBId.t list * Mod_subst.delta_resolver) safe_transformer
+ (ModPath.t * MBId.t list * Mod_subst.delta_resolver) safe_transformer
-val end_modtype : Label.t -> (module_path * MBId.t list) safe_transformer
+val end_modtype : Label.t -> (ModPath.t * MBId.t list) safe_transformer
val add_include :
Entries.module_struct_entry -> bool -> Declarations.inline ->
Mod_subst.delta_resolver safe_transformer
-val current_modpath : safe_environment -> module_path
+val current_modpath : safe_environment -> ModPath.t
-val current_dirpath : safe_environment -> dir_path
+val current_dirpath : safe_environment -> DirPath.t
(** {6 Libraries : loading and saving compilation units } *)
@@ -186,26 +186,26 @@ type native_library = Nativecode.global list
val get_library_native_symbols : safe_environment -> DirPath.t -> Nativecode.symbols
-val start_library : DirPath.t -> module_path safe_transformer
+val start_library : DirPath.t -> ModPath.t safe_transformer
val export :
?except:Future.UUIDSet.t ->
safe_environment -> DirPath.t ->
- module_path * compiled_library * native_library
+ ModPath.t * compiled_library * native_library
(* Constraints are non empty iff the file is a vi2vo *)
-val import : compiled_library -> Univ.universe_context_set -> vodigest ->
- module_path safe_transformer
+val import : compiled_library -> Univ.ContextSet.t -> vodigest ->
+ ModPath.t safe_transformer
(** {6 Safe typing judgments } *)
type judgment
-val j_val : judgment -> Term.constr
-val j_type : judgment -> Term.constr
+val j_val : judgment -> Constr.constr
+val j_type : judgment -> Constr.constr
(** The safe typing of a term returns a typing judgment. *)
-val typing : safe_environment -> Term.constr -> judgment
+val typing : safe_environment -> Constr.constr -> judgment
(** {6 Queries } *)
@@ -221,9 +221,9 @@ open Retroknowledge
val retroknowledge : (retroknowledge-> 'a) -> safe_environment -> 'a
val register :
- field -> Retroknowledge.entry -> Term.constr -> safe_transformer0
+ field -> Retroknowledge.entry -> Constr.constr -> safe_transformer0
-val register_inline : constant -> safe_transformer0
+val register_inline : Constant.t -> safe_transformer0
val set_strategy :
- safe_environment -> Names.constant Names.tableKey -> Conv_oracle.level -> safe_environment
+ safe_environment -> Names.Constant.t Names.tableKey -> Conv_oracle.level -> safe_environment
diff --git a/kernel/sorts.ml b/kernel/sorts.ml
index cf5207e8d..07688840d 100644
--- a/kernel/sorts.ml
+++ b/kernel/sorts.ml
@@ -14,7 +14,7 @@ type family = InProp | InSet | InType
type t =
| Prop of contents (* proposition types *)
- | Type of universe
+ | Type of Universe.t
let prop = Prop Null
let set = Prop Pos
@@ -91,7 +91,7 @@ module Hsorts =
struct
type _t = t
type t = _t
- type u = universe -> universe
+ type u = Universe.t -> Universe.t
let hashcons huniv = function
| Type u as c ->
diff --git a/kernel/sorts.mli b/kernel/sorts.mli
index 3426d6fd3..65ea75138 100644
--- a/kernel/sorts.mli
+++ b/kernel/sorts.mli
@@ -14,7 +14,7 @@ type family = InProp | InSet | InType
type t =
| Prop of contents (** Prop and Set *)
-| Type of Univ.universe (** Type *)
+| Type of Univ.Universe.t (** Type *)
val set : t
val prop : t
@@ -38,5 +38,5 @@ module List : sig
val intersect : family list -> family list -> family list
end
-val univ_of_sort : t -> Univ.universe
-val sort_of_univ : Univ.universe -> t
+val univ_of_sort : t -> Univ.Universe.t
+val sort_of_univ : Univ.Universe.t -> t
diff --git a/kernel/subtyping.ml b/kernel/subtyping.ml
index b564b2a8c..d0d5cb1d5 100644
--- a/kernel/subtyping.ml
+++ b/kernel/subtyping.ml
@@ -12,10 +12,11 @@
(* This module checks subtyping of module types *)
(*i*)
-open Util
open Names
open Univ
+open Util
open Term
+open Constr
open Declarations
open Declareops
open Reduction
@@ -63,11 +64,11 @@ let empty_labmap = { objs = Label.Map.empty; mods = Label.Map.empty }
let get_obj mp map l =
try Label.Map.find l map.objs
- with Not_found -> error_no_such_label_sub l (string_of_mp mp)
+ with Not_found -> error_no_such_label_sub l (ModPath.to_string mp)
let get_mod mp map l =
try Label.Map.find l map.mods
- with Not_found -> error_no_such_label_sub l (string_of_mp mp)
+ with Not_found -> error_no_such_label_sub l (ModPath.to_string mp)
let make_labmap mp list =
let add_one (l,e) map =
@@ -77,7 +78,7 @@ let make_labmap mp list =
| SFBmodule mb -> { map with mods = Label.Map.add l (Module mb) map.mods }
| SFBmodtype mtb -> { map with mods = Label.Map.add l (Modtype mtb) map.mods }
in
- List.fold_right add_one list empty_labmap
+ CList.fold_right add_one list empty_labmap
let check_conv_error error why cst poly f env a1 a2 =
@@ -153,7 +154,7 @@ let check_inductive cst env mp1 l info1 mp2 mib2 spec2 subst1 subst2 reso1 reso2
let (ctx2,s2) = dest_arity env t2 in
let s1,s2 =
match s1, s2 with
- | Type _, Type _ -> (* shortcut here *) prop_sort, prop_sort
+ | Type _, Type _ -> (* shortcut here *) Sorts.prop, Sorts.prop
| (Prop _, Type _) | (Type _,Prop _) ->
error (NotConvertibleInductiveField name)
| _ -> (s1, s2) in
@@ -181,7 +182,7 @@ let check_inductive cst env mp1 l info1 mp2 mib2 spec2 subst1 subst2 reso1 reso2
let cst = check_inductive_type cst p2.mind_typename ty1 ty2 in
cst
in
- let mind = mind_of_kn kn1 in
+ let mind = MutInd.make1 kn1 in
let check_cons_types i cst p1 p2 =
Array.fold_left3
(fun cst id t1 t2 -> check_conv (NotConvertibleConstructorField id) cst
@@ -192,7 +193,7 @@ let check_inductive cst env mp1 l info1 mp2 mib2 spec2 subst1 subst2 reso1 reso2
(arities_of_specif (mind, inst) (mib2, p2))
in
let check f test why = if not (test (f mib1) (f mib2)) then error (why (f mib2)) in
- check (fun mib -> mib.mind_finite<>Decl_kinds.CoFinite) (==) (fun x -> FiniteInductiveFieldExpected x);
+ check (fun mib -> mib.mind_finite<>CoFinite) (==) (fun x -> FiniteInductiveFieldExpected x);
check (fun mib -> mib.mind_ntypes) Int.equal (fun x -> InductiveNumbersFieldExpected x);
assert (List.is_empty mib1.mind_hyps && List.is_empty mib2.mind_hyps);
assert (Array.length mib1.mind_packets >= 1
@@ -216,7 +217,7 @@ let check_inductive cst env mp1 l info1 mp2 mib2 spec2 subst1 subst2 reso1 reso2
(* we check that records and their field names are preserved. *)
check (fun mib -> mib.mind_record <> None) (==) (fun x -> RecordFieldExpected x);
if mib1.mind_record <> None then begin
- let rec names_prod_letin t = match kind_of_term t with
+ let rec names_prod_letin t = match kind t with
| Prod(n,_,t) -> n::(names_prod_letin t)
| LetIn(n,_,_,t) -> n::(names_prod_letin t)
| Cast(t,_,_) -> names_prod_letin t
@@ -272,13 +273,13 @@ let check_constant cst env mp1 l info1 cb2 spec2 subst1 subst2 =
| Type u when not (is_univ_variable u) ->
(* Both types are inferred, no need to recheck them. We
cheat and collapse the types to Prop *)
- mkArity (ctx1,prop_sort), mkArity (ctx2,prop_sort)
+ mkArity (ctx1,Sorts.prop), mkArity (ctx2,Sorts.prop)
| Prop _ ->
(* The type in the interface is inferred, it may be the case
that the type in the implementation is smaller because
the body is more reduced. We safely collapse the upper
type to Prop *)
- mkArity (ctx1,prop_sort), mkArity (ctx2,prop_sort)
+ mkArity (ctx1,Sorts.prop), mkArity (ctx2,Sorts.prop)
| Type _ ->
(* The type in the interface is inferred and the type in the
implementation is not inferred or is inferred but from a
diff --git a/kernel/subtyping.mli b/kernel/subtyping.mli
index b24c20aa0..67df3759e 100644
--- a/kernel/subtyping.mli
+++ b/kernel/subtyping.mli
@@ -10,4 +10,4 @@ open Univ
open Declarations
open Environ
-val check_subtypes : env -> module_type_body -> module_type_body -> constraints
+val check_subtypes : env -> module_type_body -> module_type_body -> Constraint.t
diff --git a/kernel/term.ml b/kernel/term.ml
index 0e0af2f59..fae990d45 100644
--- a/kernel/term.ml
+++ b/kernel/term.ml
@@ -11,6 +11,7 @@ open Pp
open CErrors
open Names
open Vars
+open Constr
(**********************************************************************)
(** Redeclaration of types from module Constr *)
@@ -20,7 +21,7 @@ type contents = Sorts.contents = Pos | Null
type sorts = Sorts.t =
| Prop of contents (** Prop and Set *)
- | Type of Univ.universe (** Type *)
+ | Type of Univ.Universe.t (** Type *)
type sorts_family = Sorts.family = InProp | InSet | InType
@@ -30,7 +31,7 @@ type constr = Constr.t
type types = Constr.t
(** Same as [constr], for documentation purposes. *)
-type existential_key = Constr.existential_key
+type existential_key = Evar.t
type existential = Constr.existential
type metavariable = Constr.metavariable
@@ -67,7 +68,7 @@ type ('constr, 'types) pcofixpoint = ('constr, 'types) Constr.pcofixpoint
type 'a puniverses = 'a Univ.puniverses
(** Simply type aliases *)
-type pconstant = constant puniverses
+type pconstant = Constant.t puniverses
type pinductive = inductive puniverses
type pconstructor = constructor puniverses
@@ -83,7 +84,7 @@ type ('constr, 'types, 'sort, 'univs) kind_of_term =
| Lambda of Name.t * 'types * 'constr
| LetIn of Name.t * 'constr * 'types * 'constr
| App of 'constr * 'constr array
- | Const of (constant * 'univs)
+ | Const of (Constant.t * 'univs)
| Ind of (inductive * 'univs)
| Construct of (constructor * 'univs)
| Case of case_info * 'constr * 'constr * 'constr array
@@ -91,7 +92,7 @@ type ('constr, 'types, 'sort, 'univs) kind_of_term =
| CoFix of ('constr, 'types) pcofixpoint
| Proj of projection * 'constr
-type values = Constr.values
+type values = Vmvalues.values
(**********************************************************************)
(** Redeclaration of functions from module Constr *)
@@ -165,167 +166,52 @@ let hcons_types = Constr.hcons
(* Non primitive term destructors *)
(**********************************************************************)
-(* Destructor operations : partial functions
- Raise [DestKO] if the const has not the expected form *)
-
-exception DestKO
-
+exception DestKO = DestKO
(* Destructs a de Bruijn index *)
-let destRel c = match kind_of_term c with
- | Rel n -> n
- | _ -> raise DestKO
-
-(* Destructs an existential variable *)
-let destMeta c = match kind_of_term c with
- | Meta n -> n
- | _ -> raise DestKO
-
-let isMeta c = match kind_of_term c with Meta _ -> true | _ -> false
-
-(* Destructs a variable *)
-let destVar c = match kind_of_term c with
- | Var id -> id
- | _ -> raise DestKO
-
-(* Destructs a type *)
-let isSort c = match kind_of_term c with
- | Sort _ -> true
- | _ -> false
-
-let destSort c = match kind_of_term c with
- | Sort s -> s
- | _ -> raise DestKO
-
-let rec isprop c = match kind_of_term c with
- | Sort (Prop _) -> true
- | Cast (c,_,_) -> isprop c
- | _ -> false
-
-let rec is_Prop c = match kind_of_term c with
- | Sort (Prop Null) -> true
- | Cast (c,_,_) -> is_Prop c
- | _ -> false
-
-let rec is_Set c = match kind_of_term c with
- | Sort (Prop Pos) -> true
- | Cast (c,_,_) -> is_Set c
- | _ -> false
-
-let rec is_Type c = match kind_of_term c with
- | Sort (Type _) -> true
- | Cast (c,_,_) -> is_Type c
- | _ -> false
-
-let is_small = Sorts.is_small
-
-let iskind c = isprop c || is_Type c
-
-(* Tests if an evar *)
-let isEvar c = match kind_of_term c with Evar _ -> true | _ -> false
-
-let isEvar_or_Meta c = match kind_of_term c with
- | Evar _ | Meta _ -> true
- | _ -> false
-
-(* Destructs a casted term *)
-let destCast c = match kind_of_term c with
- | Cast (t1,k,t2) -> (t1,k,t2)
- | _ -> raise DestKO
-
-let isCast c = match kind_of_term c with Cast _ -> true | _ -> false
-
-
-(* Tests if a de Bruijn index *)
-let isRel c = match kind_of_term c with Rel _ -> true | _ -> false
-let isRelN n c =
- match kind_of_term c with Rel n' -> Int.equal n n' | _ -> false
-
-(* Tests if a variable *)
-let isVar c = match kind_of_term c with Var _ -> true | _ -> false
-let isVarId id c =
- match kind_of_term c with Var id' -> Id.equal id id' | _ -> false
-
-(* Tests if an inductive *)
-let isInd c = match kind_of_term c with Ind _ -> true | _ -> false
-
-(* Destructs the product (x:t1)t2 *)
-let destProd c = match kind_of_term c with
- | Prod (x,t1,t2) -> (x,t1,t2)
- | _ -> raise DestKO
-
-let isProd c = match kind_of_term c with | Prod _ -> true | _ -> false
-
-(* Destructs the abstraction [x:t1]t2 *)
-let destLambda c = match kind_of_term c with
- | Lambda (x,t1,t2) -> (x,t1,t2)
- | _ -> raise DestKO
-
-let isLambda c = match kind_of_term c with | Lambda _ -> true | _ -> false
-
-(* Destructs the let [x:=b:t1]t2 *)
-let destLetIn c = match kind_of_term c with
- | LetIn (x,b,t1,t2) -> (x,b,t1,t2)
- | _ -> raise DestKO
-
-let isLetIn c = match kind_of_term c with LetIn _ -> true | _ -> false
-
-(* Destructs an application *)
-let destApp c = match kind_of_term c with
- | App (f,a) -> (f, a)
- | _ -> raise DestKO
-
+let destRel = destRel
+let destMeta = destRel
+let isMeta = isMeta
+let destVar = destVar
+let isSort = isSort
+let destSort = destSort
+let isprop = isprop
+let is_Prop = is_Prop
+let is_Set = is_Set
+let is_Type = is_Type
+let is_small = is_small
+let iskind = iskind
+let isEvar = isEvar
+let isEvar_or_Meta = isEvar_or_Meta
+let destCast = destCast
+let isCast = isCast
+let isRel = isRel
+let isRelN = isRelN
+let isVar = isVar
+let isVarId = isVarId
+let isInd = isInd
+let destProd = destProd
+let isProd = isProd
+let destLambda = destLambda
+let isLambda = isLambda
+let destLetIn = destLetIn
+let isLetIn = isLetIn
+let destApp = destApp
let destApplication = destApp
-
-let isApp c = match kind_of_term c with App _ -> true | _ -> false
-
-(* Destructs a constant *)
-let destConst c = match kind_of_term c with
- | Const kn -> kn
- | _ -> raise DestKO
-
-let isConst c = match kind_of_term c with Const _ -> true | _ -> false
-
-(* Destructs an existential variable *)
-let destEvar c = match kind_of_term c with
- | Evar (kn, a as r) -> r
- | _ -> raise DestKO
-
-(* Destructs a (co)inductive type named kn *)
-let destInd c = match kind_of_term c with
- | Ind (kn, a as r) -> r
- | _ -> raise DestKO
-
-(* Destructs a constructor *)
-let destConstruct c = match kind_of_term c with
- | Construct (kn, a as r) -> r
- | _ -> raise DestKO
-
-let isConstruct c = match kind_of_term c with Construct _ -> true | _ -> false
-
-(* Destructs a term <p>Case c of lc1 | lc2 .. | lcn end *)
-let destCase c = match kind_of_term c with
- | Case (ci,p,c,v) -> (ci,p,c,v)
- | _ -> raise DestKO
-
-let isCase c = match kind_of_term c with Case _ -> true | _ -> false
-
-let isProj c = match kind_of_term c with Proj _ -> true | _ -> false
-
-let destProj c = match kind_of_term c with
- | Proj (p, c) -> (p, c)
- | _ -> raise DestKO
-
-let destFix c = match kind_of_term c with
- | Fix fix -> fix
- | _ -> raise DestKO
-
-let isFix c = match kind_of_term c with Fix _ -> true | _ -> false
-
-let destCoFix c = match kind_of_term c with
- | CoFix cofix -> cofix
- | _ -> raise DestKO
-
-let isCoFix c = match kind_of_term c with CoFix _ -> true | _ -> false
+let isApp = isApp
+let destConst = destConst
+let isConst = isConst
+let destEvar = destEvar
+let destInd = destInd
+let destConstruct = destConstruct
+let isConstruct = isConstruct
+let destCase = destCase
+let isCase = isCase
+let isProj = isProj
+let destProj = destProj
+let destFix = destFix
+let isFix = isFix
+let destCoFix = destCoFix
+let isCoFix = isCoFix
(******************************************************************)
(* Flattening and unflattening of embedded applications and casts *)
diff --git a/kernel/term.mli b/kernel/term.mli
index d5aaf6ad0..c9a8cf6e1 100644
--- a/kernel/term.mli
+++ b/kernel/term.mli
@@ -7,6 +7,7 @@
(************************************************************************)
open Names
+open Constr
(** {5 Redeclaration of types from module Constr and Sorts}
@@ -15,166 +16,133 @@ open Names
*)
-type contents = Sorts.contents = Pos | Null
-
-type sorts = Sorts.t =
- | Prop of contents (** Prop and Set *)
- | Type of Univ.universe (** Type *)
-
-type sorts_family = Sorts.family = InProp | InSet | InType
-
-type 'a puniverses = 'a Univ.puniverses
-
-(** Simply type aliases *)
-type pconstant = constant puniverses
-type pinductive = inductive puniverses
-type pconstructor = constructor puniverses
-
-type constr = Constr.constr
-(** Alias types, for compatibility. *)
-
-type types = Constr.types
-(** Same as [constr], for documentation purposes. *)
-
-type existential_key = Constr.existential_key
-
-type existential = Constr.existential
-
-type metavariable = Constr.metavariable
-
-type case_style = Constr.case_style =
- LetStyle | IfStyle | LetPatternStyle | MatchStyle | RegularStyle
-
-type case_printing = Constr.case_printing =
- { ind_tags : bool list; cstr_tags : bool list array; style : case_style }
-
-type case_info = Constr.case_info =
- { ci_ind : inductive;
- ci_npar : int;
- ci_cstr_ndecls : int array;
- ci_cstr_nargs : int array;
- ci_pp_info : case_printing
- }
-
-type cast_kind = Constr.cast_kind =
- VMcast | NATIVEcast | DEFAULTcast | REVERTcast
-
-type rec_declaration = Constr.rec_declaration
-type fixpoint = Constr.fixpoint
-type cofixpoint = Constr.cofixpoint
-type 'constr pexistential = 'constr Constr.pexistential
-type ('constr, 'types) prec_declaration =
- ('constr, 'types) Constr.prec_declaration
-type ('constr, 'types) pfixpoint = ('constr, 'types) Constr.pfixpoint
-type ('constr, 'types) pcofixpoint = ('constr, 'types) Constr.pcofixpoint
-
-type ('constr, 'types, 'sort, 'univs) kind_of_term =
- ('constr, 'types, 'sort, 'univs) Constr.kind_of_term =
- | Rel of int
- | Var of Id.t
- | Meta of metavariable
- | Evar of 'constr pexistential
- | Sort of 'sort
- | Cast of 'constr * cast_kind * 'types
- | Prod of Name.t * 'types * 'types
- | Lambda of Name.t * 'types * 'constr
- | LetIn of Name.t * 'constr * 'types * 'constr
- | App of 'constr * 'constr array
- | Const of (constant * 'univs)
- | Ind of (inductive * 'univs)
- | Construct of (constructor * 'univs)
- | Case of case_info * 'constr * 'constr * 'constr array
- | Fix of ('constr, 'types) pfixpoint
- | CoFix of ('constr, 'types) pcofixpoint
- | Proj of projection * 'constr
-
-type values = Constr.values
+exception DestKO
+[@@ocaml.deprecated "Alias for [Constr.DestKO]"]
(** {5 Simple term case analysis. } *)
-
val isRel : constr -> bool
+[@@ocaml.deprecated "Alias for [Constr.isRel]"]
val isRelN : int -> constr -> bool
+[@@ocaml.deprecated "Alias for [Constr.isRelN]"]
val isVar : constr -> bool
+[@@ocaml.deprecated "Alias for [Constr.isVar]"]
val isVarId : Id.t -> constr -> bool
+[@@ocaml.deprecated "Alias for [Constr.isVarId]"]
val isInd : constr -> bool
+[@@ocaml.deprecated "Alias for [Constr.isInd]"]
val isEvar : constr -> bool
+[@@ocaml.deprecated "Alias for [Constr.isEvar]"]
val isMeta : constr -> bool
+[@@ocaml.deprecated "Alias for [Constr.isMeta]"]
val isEvar_or_Meta : constr -> bool
+[@@ocaml.deprecated "Alias for [Constr.isEvar_or_Meta]"]
val isSort : constr -> bool
+[@@ocaml.deprecated "Alias for [Constr.isSort]"]
val isCast : constr -> bool
+[@@ocaml.deprecated "Alias for [Constr.isCast]"]
val isApp : constr -> bool
+[@@ocaml.deprecated "Alias for [Constr.isApp]"]
val isLambda : constr -> bool
+[@@ocaml.deprecated "Alias for [Constr.isLambda]"]
val isLetIn : constr -> bool
+[@@ocaml.deprecated "Alias for [Constr.isletIn]"]
val isProd : constr -> bool
+[@@ocaml.deprecated "Alias for [Constr.isProp]"]
val isConst : constr -> bool
+[@@ocaml.deprecated "Alias for [Constr.isConst]"]
val isConstruct : constr -> bool
+[@@ocaml.deprecated "Alias for [Constr.isConstruct]"]
val isFix : constr -> bool
+[@@ocaml.deprecated "Alias for [Constr.isFix]"]
val isCoFix : constr -> bool
+[@@ocaml.deprecated "Alias for [Constr.isCoFix]"]
val isCase : constr -> bool
+[@@ocaml.deprecated "Alias for [Constr.isCase]"]
val isProj : constr -> bool
+[@@ocaml.deprecated "Alias for [Constr.isProj]"]
val is_Prop : constr -> bool
+[@@ocaml.deprecated "Alias for [Constr.is_Prop]"]
val is_Set : constr -> bool
+[@@ocaml.deprecated "Alias for [Constr.is_Set]"]
val isprop : constr -> bool
+[@@ocaml.deprecated "Alias for [Constr.isprop]"]
val is_Type : constr -> bool
+[@@ocaml.deprecated "Alias for [Constr.is_Type]"]
val iskind : constr -> bool
-val is_small : sorts -> bool
+[@@ocaml.deprecated "Alias for [Constr.is_kind]"]
+val is_small : Sorts.t -> bool
+[@@ocaml.deprecated "Alias for [Constr.is_small]"]
(** {5 Term destructors } *)
(** Destructor operations are partial functions and
@raise DestKO if the term has not the expected form. *)
-exception DestKO
-
(** Destructs a de Bruijn index *)
val destRel : constr -> int
+[@@ocaml.deprecated "Alias for [Constr.destRel]"]
(** Destructs an existential variable *)
val destMeta : constr -> metavariable
+[@@ocaml.deprecated "Alias for [Constr.destMeta]"]
(** Destructs a variable *)
val destVar : constr -> Id.t
+[@@ocaml.deprecated "Alias for [Constr.destVar]"]
(** Destructs a sort. [is_Prop] recognizes the sort {% \textsf{%}Prop{% }%}, whether
[isprop] recognizes both {% \textsf{%}Prop{% }%} and {% \textsf{%}Set{% }%}. *)
-val destSort : constr -> sorts
+val destSort : constr -> Sorts.t
+[@@ocaml.deprecated "Alias for [Constr.destSort]"]
(** Destructs a casted term *)
val destCast : constr -> constr * cast_kind * constr
+[@@ocaml.deprecated "Alias for [Constr.destCast]"]
(** Destructs the product {% $ %}(x:t_1)t_2{% $ %} *)
val destProd : types -> Name.t * types * types
+[@@ocaml.deprecated "Alias for [Constr.destProd]"]
(** Destructs the abstraction {% $ %}[x:t_1]t_2{% $ %} *)
val destLambda : constr -> Name.t * types * constr
+[@@ocaml.deprecated "Alias for [Constr.destLambda]"]
(** Destructs the let {% $ %}[x:=b:t_1]t_2{% $ %} *)
val destLetIn : constr -> Name.t * constr * types * constr
+[@@ocaml.deprecated "Alias for [Constr.destLetIn]"]
(** Destructs an application *)
val destApp : constr -> constr * constr array
+[@@ocaml.deprecated "Alias for [Constr.destApp]"]
(** Obsolete synonym of destApp *)
val destApplication : constr -> constr * constr array
+[@@ocaml.deprecated "Alias for [Constr.destApplication]"]
(** Decompose any term as an applicative term; the list of args can be empty *)
val decompose_app : constr -> constr * constr list
+[@@ocaml.deprecated "Alias for [Constr.decompose_app]"]
(** Same as [decompose_app], but returns an array. *)
val decompose_appvect : constr -> constr * constr array
+[@@ocaml.deprecated "Alias for [Constr.decompose_appvect]"]
(** Destructs a constant *)
-val destConst : constr -> constant puniverses
+val destConst : constr -> Constant.t Univ.puniverses
+[@@ocaml.deprecated "Alias for [Constr.destConst]"]
(** Destructs an existential variable *)
val destEvar : constr -> existential
+[@@ocaml.deprecated "Alias for [Constr.destEvar]"]
(** Destructs a (co)inductive type *)
-val destInd : constr -> inductive puniverses
+val destInd : constr -> inductive Univ.puniverses
+[@@ocaml.deprecated "Alias for [Constr.destInd]"]
(** Destructs a constructor *)
-val destConstruct : constr -> constructor puniverses
+val destConstruct : constr -> constructor Univ.puniverses
+[@@ocaml.deprecated "Alias for [Constr.destConstruct]"]
(** Destructs a [match c as x in I args return P with ... |
Ci(...yij...) => ti | ... end] (or [let (..y1i..) := c as x in I args
@@ -182,9 +150,11 @@ return P in t1], or [if c then t1 else t2])
@return [(info,c,fun args x => P,[|...|fun yij => ti| ...|])]
where [info] is pretty-printing information *)
val destCase : constr -> case_info * constr * constr * constr array
+[@@ocaml.deprecated "Alias for [Constr.destCase]"]
(** Destructs a projection *)
val destProj : constr -> projection * constr
+[@@ocaml.deprecated "Alias for [Constr.destProj]"]
(** Destructs the {% $ %}i{% $ %}th function of the block
[Fixpoint f{_ 1} ctx{_ 1} = b{_ 1}
@@ -194,9 +164,10 @@ val destProj : constr -> projection * constr
where the length of the {% $ %}j{% $ %}th context is {% $ %}ij{% $ %}.
*)
val destFix : constr -> fixpoint
+[@@ocaml.deprecated "Alias for [Constr.destFix]"]
val destCoFix : constr -> cofixpoint
-
+[@@ocaml.deprecated "Alias for [Constr.destCoFix]"]
(** {5 Derived constructors} *)
@@ -354,7 +325,7 @@ val strip_lam_assum : constr -> constr
Such a term can canonically be seen as the pair of a context of types
and of a sort *)
-type arity = Context.Rel.t * sorts
+type arity = Context.Rel.t * Sorts.t
(** Build an "arity" from its canonical form *)
val mkArity : arity -> types
@@ -368,7 +339,7 @@ val isArity : types -> bool
(** {5 Kind of type} *)
type ('constr, 'types) kind_of_type =
- | SortType of sorts
+ | SortType of Sorts.t
| CastType of 'types * 'types
| ProdType of Name.t * 'types * 'types
| LetInType of Name.t * 'constr * 'types * 'types
@@ -378,23 +349,23 @@ val kind_of_type : types -> (constr, types) kind_of_type
(** {5 Redeclaration of stuff from module [Sorts]} *)
-val set_sort : sorts
-(** Alias for Sorts.set *)
+val set_sort : Sorts.t
+[@@ocaml.deprecated "Alias for Sorts.set"]
-val prop_sort : sorts
-(** Alias for Sorts.prop *)
+val prop_sort : Sorts.t
+[@@ocaml.deprecated "Alias for Sorts.prop"]
-val type1_sort : sorts
-(** Alias for Sorts.type1 *)
+val type1_sort : Sorts.t
+[@@ocaml.deprecated "Alias for Sorts.type1"]
-val sorts_ord : sorts -> sorts -> int
-(** Alias for Sorts.compare *)
+val sorts_ord : Sorts.t -> Sorts.t -> int
+[@@ocaml.deprecated "Alias for Sorts.compare"]
-val is_prop_sort : sorts -> bool
-(** Alias for Sorts.is_prop *)
+val is_prop_sort : Sorts.t -> bool
+[@@ocaml.deprecated "Alias for Sorts.is_prop"]
-val family_of_sort : sorts -> sorts_family
-(** Alias for Sorts.family *)
+val family_of_sort : Sorts.t -> Sorts.family
+[@@ocaml.deprecated "Alias for Sorts.family"]
(** {5 Redeclaration of stuff from module [Constr]}
@@ -403,90 +374,215 @@ val family_of_sort : sorts -> sorts_family
(** {6 Term constructors. } *)
val mkRel : int -> constr
+[@@ocaml.deprecated "Alias for Constr.mkRel"]
val mkVar : Id.t -> constr
+[@@ocaml.deprecated "Alias for Constr.mkVar"]
val mkMeta : metavariable -> constr
+[@@ocaml.deprecated "Alias for Constr.mkMeta"]
val mkEvar : existential -> constr
-val mkSort : sorts -> types
+[@@ocaml.deprecated "Alias for Constr.mkEvar"]
+val mkSort : Sorts.t -> types
+[@@ocaml.deprecated "Alias for Constr.mkSort"]
val mkProp : types
+[@@ocaml.deprecated "Alias for Constr.mkProp"]
val mkSet : types
-val mkType : Univ.universe -> types
+[@@ocaml.deprecated "Alias for Constr.mkSet"]
+val mkType : Univ.Universe.t -> types
+[@@ocaml.deprecated "Alias for Constr.mkType"]
val mkCast : constr * cast_kind * constr -> constr
+[@@ocaml.deprecated "Alias for Constr"]
val mkProd : Name.t * types * types -> types
+[@@ocaml.deprecated "Alias for Constr"]
val mkLambda : Name.t * types * constr -> constr
+[@@ocaml.deprecated "Alias for Constr"]
val mkLetIn : Name.t * constr * types * constr -> constr
+[@@ocaml.deprecated "Alias for Constr"]
val mkApp : constr * constr array -> constr
-val mkConst : constant -> constr
+[@@ocaml.deprecated "Alias for Constr"]
+val mkConst : Constant.t -> constr
+[@@ocaml.deprecated "Alias for Constr"]
val mkProj : projection * constr -> constr
+[@@ocaml.deprecated "Alias for Constr"]
val mkInd : inductive -> constr
+[@@ocaml.deprecated "Alias for Constr"]
val mkConstruct : constructor -> constr
-val mkConstU : constant puniverses -> constr
-val mkIndU : inductive puniverses -> constr
-val mkConstructU : constructor puniverses -> constr
+[@@ocaml.deprecated "Alias for Constr"]
+val mkConstU : Constant.t Univ.puniverses -> constr
+[@@ocaml.deprecated "Alias for Constr"]
+val mkIndU : inductive Univ.puniverses -> constr
+[@@ocaml.deprecated "Alias for Constr"]
+val mkConstructU : constructor Univ.puniverses -> constr
+[@@ocaml.deprecated "Alias for Constr"]
val mkConstructUi : (pinductive * int) -> constr
+[@@ocaml.deprecated "Alias for Constr"]
val mkCase : case_info * constr * constr * constr array -> constr
+[@@ocaml.deprecated "Alias for Constr.mkCase"]
val mkFix : fixpoint -> constr
+[@@ocaml.deprecated "Alias for Constr.mkFix"]
val mkCoFix : cofixpoint -> constr
+[@@ocaml.deprecated "Alias for Constr.mkCoFix"]
(** {6 Aliases} *)
val eq_constr : constr -> constr -> bool
-(** Alias for [Constr.equal] *)
+[@@ocaml.deprecated "Alias for Constr.equal"]
(** [eq_constr_univs u a b] is [true] if [a] equals [b] modulo alpha, casts,
application grouping and the universe constraints in [u]. *)
val eq_constr_univs : constr UGraph.check_function
+[@@ocaml.deprecated "Alias for Constr.eq_constr_univs"]
(** [leq_constr_univs u a b] is [true] if [a] is convertible to [b] modulo
alpha, casts, application grouping and the universe constraints in [u]. *)
val leq_constr_univs : constr UGraph.check_function
+[@@ocaml.deprecated "Alias for Constr.leq_constr_univs"]
(** [eq_constr_univs a b] [true, c] if [a] equals [b] modulo alpha, casts,
application grouping and ignoring universe instances. *)
val eq_constr_nounivs : constr -> constr -> bool
+[@@ocaml.deprecated "Alias for Constr.qe_constr_nounivs"]
val kind_of_term : constr -> (constr, types, Sorts.t, Univ.Instance.t) kind_of_term
-(** Alias for [Constr.kind] *)
+[@@ocaml.deprecated "Alias for Constr.kind"]
val compare : constr -> constr -> int
-(** Alias for [Constr.compare] *)
+[@@ocaml.deprecated "Alias for [Constr.compare]"]
val constr_ord : constr -> constr -> int
-(** Alias for [Term.compare] *)
+[@@ocaml.deprecated "Alias for [Term.compare]"]
val fold_constr : ('a -> constr -> 'a) -> 'a -> constr -> 'a
-(** Alias for [Constr.fold] *)
+[@@ocaml.deprecated "Alias for [Constr.fold]"]
val map_constr : (constr -> constr) -> constr -> constr
-(** Alias for [Constr.map] *)
+[@@ocaml.deprecated "Alias for [Constr.map]"]
val map_constr_with_binders :
('a -> 'a) -> ('a -> constr -> constr) -> 'a -> constr -> constr
-(** Alias for [Constr.map_with_binders] *)
+[@@ocaml.deprecated "Alias for [Constr.map_with_binders]"]
-val map_puniverses : ('a -> 'b) -> 'a puniverses -> 'b puniverses
-val univ_of_sort : sorts -> Univ.universe
-val sort_of_univ : Univ.universe -> sorts
+val map_puniverses : ('a -> 'b) -> 'a Univ.puniverses -> 'b Univ.puniverses
+[@@ocaml.deprecated "Alias for [Constr.map_puniverses]"]
+val univ_of_sort : Sorts.t -> Univ.Universe.t
+[@@ocaml.deprecated "Alias for [Sorts.univ_of_sort]"]
+val sort_of_univ : Univ.Universe.t -> Sorts.t
+[@@ocaml.deprecated "Alias for [Sorts.sort_of_univ]"]
val iter_constr : (constr -> unit) -> constr -> unit
-(** Alias for [Constr.iter] *)
+[@@ocaml.deprecated "Alias for [Constr.iter]"]
val iter_constr_with_binders :
('a -> 'a) -> ('a -> constr -> unit) -> 'a -> constr -> unit
-(** Alias for [Constr.iter_with_binders] *)
+[@@ocaml.deprecated "Alias for [Constr.iter_with_binders]"]
val compare_constr : (constr -> constr -> bool) -> constr -> constr -> bool
-(** Alias for [Constr.compare_head] *)
+[@@ocaml.deprecated "Alias for [Constr.compare_head]"]
+
+type constr = Constr.constr
+[@@ocaml.deprecated "Alias for Constr.t"]
+
+(** Alias types, for compatibility. *)
+
+type types = Constr.types
+[@@ocaml.deprecated "Alias for Constr.types"]
+
+type contents = Sorts.contents = Pos | Null
+[@@ocaml.deprecated "Alias for Sorts.contents"]
+
+type sorts = Sorts.t =
+ | Prop of Sorts.contents (** Prop and Set *)
+ | Type of Univ.Universe.t (** Type *)
+[@@ocaml.deprecated "Alias for Sorts.t"]
+
+type sorts_family = Sorts.family = InProp | InSet | InType
+[@@ocaml.deprecated "Alias for Sorts.family"]
+
+type 'a puniverses = 'a Univ.puniverses
+[@@ocaml.deprecated "Alias for Constr.puniverses"]
+
+(** Simply type aliases *)
+type pconstant = Constr.pconstant
+[@@ocaml.deprecated "Alias for Constr.pconstant"]
+type pinductive = Constr.pinductive
+[@@ocaml.deprecated "Alias for Constr.pinductive"]
+type pconstructor = Constr.pconstructor
+[@@ocaml.deprecated "Alias for Constr.pconstructor"]
+type existential_key = Evar.t
+[@@ocaml.deprecated "Alias for Evar.t"]
+type existential = Constr.existential
+[@@ocaml.deprecated "Alias for Constr.existential"]
+type metavariable = Constr.metavariable
+[@@ocaml.deprecated "Alias for Constr.metavariable"]
+
+type case_style = Constr.case_style =
+ LetStyle | IfStyle | LetPatternStyle | MatchStyle | RegularStyle
+[@@ocaml.deprecated "Alias for Constr.case_style"]
+
+type case_printing = Constr.case_printing =
+ { ind_tags : bool list; cstr_tags : bool list array; style : Constr.case_style }
+[@@ocaml.deprecated "Alias for Constr.case_printing"]
+
+type case_info = Constr.case_info =
+ { ci_ind : inductive;
+ ci_npar : int;
+ ci_cstr_ndecls : int array;
+ ci_cstr_nargs : int array;
+ ci_pp_info : Constr.case_printing
+ }
+[@@ocaml.deprecated "Alias for Constr.case_info"]
+
+type cast_kind = Constr.cast_kind =
+ VMcast | NATIVEcast | DEFAULTcast | REVERTcast
+[@@ocaml.deprecated "Alias for Constr.cast_kind"]
+
+type rec_declaration = Constr.rec_declaration
+[@@ocaml.deprecated "Alias for Constr.rec_declaration"]
+type fixpoint = Constr.fixpoint
+[@@ocaml.deprecated "Alias for Constr.fixpoint"]
+type cofixpoint = Constr.cofixpoint
+[@@ocaml.deprecated "Alias for Constr.cofixpoint"]
+type 'constr pexistential = 'constr Constr.pexistential
+[@@ocaml.deprecated "Alias for Constr.pexistential"]
+type ('constr, 'types) prec_declaration =
+ ('constr, 'types) Constr.prec_declaration
+[@@ocaml.deprecated "Alias for Constr.prec_declaration"]
+type ('constr, 'types) pfixpoint = ('constr, 'types) Constr.pfixpoint
+[@@ocaml.deprecated "Alias for Constr.pfixpoint"]
+type ('constr, 'types) pcofixpoint = ('constr, 'types) Constr.pcofixpoint
+[@@ocaml.deprecated "Alias for Constr.pcofixpoint"]
+
+type ('constr, 'types, 'sort, 'univs) kind_of_term =
+ ('constr, 'types, 'sort, 'univs) Constr.kind_of_term =
+ | Rel of int
+ | Var of Id.t
+ | Meta of Constr.metavariable
+ | Evar of 'constr Constr.pexistential
+ | Sort of 'sort
+ | Cast of 'constr * Constr.cast_kind * 'types
+ | Prod of Name.t * 'types * 'types
+ | Lambda of Name.t * 'types * 'constr
+ | LetIn of Name.t * 'constr * 'types * 'constr
+ | App of 'constr * 'constr array
+ | Const of (Constant.t * 'univs)
+ | Ind of (inductive * 'univs)
+ | Construct of (constructor * 'univs)
+ | Case of Constr.case_info * 'constr * 'constr * 'constr array
+ | Fix of ('constr, 'types) Constr.pfixpoint
+ | CoFix of ('constr, 'types) Constr.pcofixpoint
+ | Proj of projection * 'constr
+[@@ocaml.deprecated "Alias for Constr.kind_of_term"]
-val hash_constr : constr -> int
-(** Alias for [Constr.hash] *)
+type values = Vmvalues.values
+[@@ocaml.deprecated "Alias for Vmvalues.values"]
-(*********************************************************************)
+val hash_constr : Constr.constr -> int
+[@@ocaml.deprecated "Alias for Constr.hash"]
-val hcons_sorts : sorts -> sorts
-(** Alias for [Constr.hashcons_sorts] *)
+val hcons_sorts : Sorts.t -> Sorts.t
+[@@ocaml.deprecated "Alias for [Sorts.hcons]"]
-val hcons_constr : constr -> constr
-(** Alias for [Constr.hashcons] *)
+val hcons_constr : Constr.constr -> Constr.constr
+[@@ocaml.deprecated "Alias for [Constr.hcons]"]
-val hcons_types : types -> types
-(** Alias for [Constr.hashcons] *)
+val hcons_types : Constr.types -> Constr.types
+[@@ocaml.deprecated "Alias for [Constr.hcons]"]
diff --git a/kernel/term_typing.ml b/kernel/term_typing.ml
index e28c8e826..5f501bff1 100644
--- a/kernel/term_typing.ml
+++ b/kernel/term_typing.ml
@@ -15,7 +15,7 @@
open CErrors
open Util
open Names
-open Term
+open Constr
open Declarations
open Environ
open Entries
@@ -125,11 +125,10 @@ let inline_side_effects env body ctx side_eff =
| _ -> assert false
in
match cb.const_universes with
- | Monomorphic_const cnstctx ->
+ | Monomorphic_const univs ->
(** Abstract over the term at the top of the proof *)
let ty = cb.const_type in
let subst = Cmap_env.add c (Inr var) subst in
- let univs = Univ.ContextSet.of_context cnstctx in
let ctx = Univ.ContextSet.union ctx univs in
(subst, var + 1, ctx, (cname c, b, ty, opaque) :: args)
| Polymorphic_const auctx ->
@@ -154,7 +153,7 @@ let inline_side_effects env body ctx side_eff =
(** Lift free rel variables *)
if n <= k then t
else mkRel (n + len - i - 1)
- | _ -> map_constr_with_binders ((+) 1) (fun k t -> subst_const i k t) k t
+ | _ -> Constr.map_with_binders ((+) 1) (fun k t -> subst_const i k t) k t
in
let map_args i (na, b, ty, opaque) =
(** Both the type and the body may mention other constants *)
@@ -199,13 +198,13 @@ let check_signatures curmb sl =
let skip_trusted_seff sl b e =
let rec aux sl b e acc =
let open Context.Rel.Declaration in
- match sl, kind_of_term b with
+ match sl, kind b with
| (None|Some 0), _ -> b, e, acc
| Some sl, LetIn (n,c,ty,bo) ->
aux (Some (sl-1)) bo
(Environ.push_rel (LocalDef (n,c,ty)) e) (`Let(n,c,ty)::acc)
| Some sl, App(hd,arg) ->
- begin match kind_of_term hd with
+ begin match kind hd with
| Lambda (n,ty,bo) ->
aux (Some (sl-1)) bo
(Environ.push_rel (LocalAssum (n,ty)) e) (`Cut(n,ty,arg)::acc)
@@ -228,24 +227,25 @@ let feedback_completion_typecheck =
Option.iter (fun state_id ->
feedback ~id:state_id Feedback.Complete)
-let abstract_constant_universes abstract uctx =
- if not abstract then
+let abstract_constant_universes = function
+ | Monomorphic_const_entry uctx ->
Univ.empty_level_subst, Monomorphic_const uctx
- else
+ | Polymorphic_const_entry uctx ->
let sbst, auctx = Univ.abstract_universes uctx in
+ let sbst = Univ.make_instance_subst sbst in
sbst, Polymorphic_const auctx
-let infer_declaration (type a) ~(trust : a trust) env kn (dcl : a constant_entry) =
+let infer_declaration (type a) ~(trust : a trust) env (dcl : a constant_entry) =
match dcl with
- | ParameterEntry (ctx,poly,(t,uctx),nl) ->
- let env = push_context ~strict:(not poly) uctx env in
- let j = infer env t in
- let abstract = poly && not (Option.is_empty kn) in
- let usubst, univs =
- abstract_constant_universes abstract uctx
+ | ParameterEntry (ctx,(t,uctx),nl) ->
+ let env = match uctx with
+ | Monomorphic_const_entry uctx -> push_context_set ~strict:true uctx env
+ | Polymorphic_const_entry uctx -> push_context ~strict:false uctx env
in
+ let j = infer env t in
+ let usubst, univs = abstract_constant_universes uctx in
let c = Typeops.assumption_of_judgment env j in
- let t = hcons_constr (Vars.subst_univs_level_constr usubst c) in
+ let t = Constr.hcons (Vars.subst_univs_level_constr usubst c) in
{
Cooking.cook_body = Undef nl;
cook_type = t;
@@ -262,7 +262,7 @@ let infer_declaration (type a) ~(trust : a trust) env kn (dcl : a constant_entry
| DefinitionEntry ({ const_entry_type = Some typ;
const_entry_opaque = true;
const_entry_universes = Monomorphic_const_entry univs } as c) ->
- let env = push_context ~strict:true univs env in
+ let env = push_context_set ~strict:true univs env in
let { const_entry_body = body; const_entry_feedback = feedback_id } = c in
let tyj = infer_type env typ in
let proofterm =
@@ -283,7 +283,7 @@ let infer_declaration (type a) ~(trust : a trust) env kn (dcl : a constant_entry
let _ = judge_of_cast env j DEFAULTcast tyj in
j, uctx
in
- let c = hcons_constr j.uj_val in
+ let c = Constr.hcons j.uj_val in
feedback_completion_typecheck feedback_id;
c, uctx) in
let def = OpaqueDef (Opaqueproof.create proofterm) in
@@ -301,21 +301,29 @@ let infer_declaration (type a) ~(trust : a trust) env kn (dcl : a constant_entry
let { const_entry_type = typ; const_entry_opaque = opaque } = c in
let { const_entry_body = body; const_entry_feedback = feedback_id } = c in
let (body, ctx), side_eff = Future.join body in
- let poly, univs = match c.const_entry_universes with
- | Monomorphic_const_entry univs -> false, univs
- | Polymorphic_const_entry univs -> true, univs
- in
- let univsctx = Univ.ContextSet.of_context univs in
- let ctx = Univ.ContextSet.union univsctx ctx in
let body, ctx, _ = match trust with
| Pure -> body, ctx, []
| SideEffects _ -> inline_side_effects env body ctx side_eff
in
- let env = push_context_set ~strict:(not poly) ctx env in
- let abstract = poly && not (Option.is_empty kn) in
- let usubst, univs =
- abstract_constant_universes abstract (Univ.ContextSet.to_context ctx)
- in
+ let env, usubst, univs = match c.const_entry_universes with
+ | Monomorphic_const_entry univs ->
+ let ctx = Univ.ContextSet.union univs ctx in
+ let env = push_context_set ~strict:true ctx env in
+ env, Univ.empty_level_subst, Monomorphic_const ctx
+ | Polymorphic_const_entry uctx ->
+ (** Ensure not to generate internal constraints in polymorphic mode.
+ The only way for this to happen would be that either the body
+ contained deferred universes, or that it contains monomorphic
+ side-effects. The first property is ruled out by upper layers,
+ and the second one is ensured by the fact we currently
+ unconditionally export side-effects from polymorphic definitions,
+ i.e. [trust] is always [Pure]. *)
+ let () = assert (Univ.ContextSet.is_empty ctx) in
+ let env = push_context ~strict:false uctx env in
+ let sbst, auctx = Univ.abstract_universes uctx in
+ let sbst = Univ.make_instance_subst sbst in
+ env, sbst, Polymorphic_const auctx
+ in
let j = infer env body in
let typ = match typ with
| None ->
@@ -325,7 +333,7 @@ let infer_declaration (type a) ~(trust : a trust) env kn (dcl : a constant_entry
let _ = judge_of_cast env j DEFAULTcast tj in
Vars.subst_univs_level_constr usubst t
in
- let def = hcons_constr (Vars.subst_univs_level_constr usubst j.uj_val) 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)))
else Def (Mod_subst.from_val def)
@@ -359,7 +367,7 @@ let infer_declaration (type a) ~(trust : a trust) env kn (dcl : a constant_entry
in
let term, typ = pb.proj_eta in
{
- Cooking.cook_body = Def (Mod_subst.from_val (hcons_constr term));
+ Cooking.cook_body = Def (Mod_subst.from_val (Constr.hcons term));
cook_type = typ;
cook_proj = Some pb;
cook_universes = univs;
@@ -487,7 +495,7 @@ let build_constant_declaration kn env result =
let translate_constant mb env kn ce =
build_constant_declaration kn env
- (infer_declaration ~trust:mb env (Some kn) ce)
+ (infer_declaration ~trust:mb env ce)
let constant_entry_of_side_effect cb u =
let univs =
@@ -525,16 +533,12 @@ type side_effect_role =
| Schema of inductive * string
type exported_side_effect =
- constant * constant_body * side_effect_role
+ Constant.t * constant_body * side_effect_role
-let export_side_effects mb env ce =
- match ce with
- | ParameterEntry e -> [], ParameterEntry e
- | ProjectionEntry e -> [], ProjectionEntry e
- | DefinitionEntry c ->
+let export_side_effects mb env c =
let { const_entry_body = body } = c in
let _, eff = Future.force body in
- let ce = DefinitionEntry { c with
+ let ce = { c with
const_entry_body = Future.chain body
(fun (b_ctx, _) -> b_ctx, ()) } in
let not_exists (c,_,_,_) =
@@ -556,7 +560,7 @@ let export_side_effects mb env ce =
let env = Environ.add_constant kn cb env in
match cb.const_universes with
| Monomorphic_const ctx ->
- Environ.push_context ~strict:true ctx env
+ Environ.push_context_set ~strict:true ctx env
| Polymorphic_const _ -> env
end
| kn, cb, `Opaque(_, ctx), _ ->
@@ -564,7 +568,7 @@ let export_side_effects mb env ce =
let env = Environ.add_constant kn cb env in
match cb.const_universes with
| Monomorphic_const cstctx ->
- let env = Environ.push_context ~strict:true cstctx env in
+ let env = Environ.push_context_set ~strict:true cstctx env in
Environ.push_context_set ~strict:true ctx env
| Polymorphic_const _ -> env
end
@@ -603,9 +607,19 @@ let translate_recipe env kn r =
let hcons = DirPath.is_empty dir in
build_constant_declaration kn env (Cooking.cook_constant ~hcons env r)
-let translate_local_def mb env id centry =
+let translate_local_def env id centry =
let open Cooking in
- let decl = infer_declaration ~trust:mb env None (DefinitionEntry centry) in
+ let body = Future.from_val ((centry.secdef_body, Univ.ContextSet.empty), ()) in
+ let centry = {
+ const_entry_body = body;
+ const_entry_secctx = centry.secdef_secctx;
+ const_entry_feedback = centry.secdef_feedback;
+ const_entry_type = centry.secdef_type;
+ const_entry_universes = Monomorphic_const_entry Univ.ContextSet.empty;
+ const_entry_opaque = false;
+ const_entry_inline_code = false;
+ } in
+ let decl = infer_declaration ~trust:Pure env (DefinitionEntry centry) in
let typ = decl.cook_type in
if Option.is_empty decl.cook_context && !Flags.record_aux_file then begin
match decl.cook_body with
@@ -617,11 +631,22 @@ let translate_local_def mb env id centry =
(Opaqueproof.force_proof (opaque_tables env) lc) in
record_aux env ids_typ ids_def
end;
- let univs = match decl.cook_universes with
- | Monomorphic_const ctx -> ctx
+ let () = match decl.cook_universes with
+ | Monomorphic_const ctx -> assert (Univ.ContextSet.is_empty ctx)
| Polymorphic_const _ -> assert false
in
- decl.cook_body, typ, univs
+ 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 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
+ p
+ | Undef _ -> assert false
+ in
+ c, typ
(* Insertion of inductive types. *)
diff --git a/kernel/term_typing.mli b/kernel/term_typing.mli
index b16f81c5a..7bc029010 100644
--- a/kernel/term_typing.mli
+++ b/kernel/term_typing.mli
@@ -7,7 +7,7 @@
(************************************************************************)
open Names
-open Term
+open Constr
open Environ
open Declarations
open Entries
@@ -18,8 +18,8 @@ type _ trust =
| Pure : unit trust
| SideEffects : structure_body -> side_effects trust
-val translate_local_def : 'a trust -> env -> Id.t -> 'a definition_entry ->
- constant_def * types * Univ.universe_context
+val translate_local_def : env -> Id.t -> section_def_entry ->
+ constr * types
val translate_local_assum : env -> types -> types
@@ -47,7 +47,7 @@ val uniq_seff : side_effects -> side_effect list
val equal_eff : side_effect -> side_effect -> bool
val translate_constant :
- 'a trust -> env -> constant -> 'a constant_entry ->
+ 'a trust -> env -> Constant.t -> 'a constant_entry ->
constant_body
type side_effect_role =
@@ -55,25 +55,25 @@ type side_effect_role =
| Schema of inductive * string
type exported_side_effect =
- constant * constant_body * side_effect_role
+ Constant.t * constant_body * side_effect_role
(* Given a constant entry containing side effects it exports them (either
* by re-checking them or trusting them). Returns the constant bodies to
* be pushed in the safe_env by safe typing. The main constant entry
* needs to be translated as usual after this step. *)
val export_side_effects :
- structure_body -> env -> side_effects constant_entry ->
- exported_side_effect list * unit constant_entry
+ structure_body -> env -> side_effects definition_entry ->
+ exported_side_effect list * unit definition_entry
val translate_mind :
- env -> mutual_inductive -> mutual_inductive_entry -> mutual_inductive_body
+ env -> MutInd.t -> mutual_inductive_entry -> mutual_inductive_body
-val translate_recipe : env -> constant -> Cooking.recipe -> constant_body
+val translate_recipe : env -> Constant.t -> Cooking.recipe -> constant_body
(** Internal functions, mentioned here for debug purpose only *)
-val infer_declaration : trust:'a trust -> env -> constant option ->
+val infer_declaration : trust:'a trust -> env ->
'a constant_entry -> Cooking.result
val build_constant_declaration :
- constant -> env -> Cooking.result -> constant_body
+ Constant.t -> env -> Cooking.result -> constant_body
diff --git a/kernel/type_errors.ml b/kernel/type_errors.ml
index 9813fc566..781c6bfbc 100644
--- a/kernel/type_errors.ml
+++ b/kernel/type_errors.ml
@@ -7,7 +7,7 @@
(************************************************************************)
open Names
-open Term
+open Constr
open Environ
open Reduction
@@ -45,8 +45,8 @@ type ('constr, 'types) ptype_error =
| NotAType of ('constr, 'types) punsafe_judgment
| BadAssumption of ('constr, 'types) punsafe_judgment
| ReferenceVariables of Id.t * 'constr
- | ElimArity of pinductive * sorts_family list * 'constr * ('constr, 'types) punsafe_judgment
- * (sorts_family * sorts_family * arity_error) option
+ | ElimArity of pinductive * Sorts.family list * 'constr * ('constr, 'types) punsafe_judgment
+ * (Sorts.family * Sorts.family * arity_error) option
| CaseNotInductive of ('constr, 'types) punsafe_judgment
| WrongCaseInfo of pinductive * case_info
| NumberBranches of ('constr, 'types) punsafe_judgment * int
@@ -59,7 +59,7 @@ type ('constr, 'types) ptype_error =
| IllFormedRecBody of 'constr pguard_error * Name.t array * int * env * ('constr, 'types) punsafe_judgment array
| IllTypedRecBody of
int * Name.t array * ('constr, 'types) punsafe_judgment array * 'types array
- | UnsatisfiedConstraints of Univ.constraints
+ | UnsatisfiedConstraints of Univ.Constraint.t
type type_error = (constr, types) ptype_error
@@ -115,6 +115,7 @@ let error_ill_typed_rec_body env i lna vdefj vargs =
raise (TypeError (env, IllTypedRecBody (i,lna,vdefj,vargs)))
let error_elim_explain kp ki =
+ let open Sorts in
match kp,ki with
| (InType | InSet), InProp -> NonInformativeToInformative
| InType, InSet -> StrongEliminationOnNonSmallType (* if Set impredicative *)
diff --git a/kernel/type_errors.mli b/kernel/type_errors.mli
index 95a963da2..72861f6e4 100644
--- a/kernel/type_errors.mli
+++ b/kernel/type_errors.mli
@@ -7,7 +7,7 @@
(************************************************************************)
open Names
-open Term
+open Constr
open Environ
(** Type errors. {% \label{%}typeerrors{% }%} *)
@@ -46,8 +46,8 @@ type ('constr, 'types) ptype_error =
| NotAType of ('constr, 'types) punsafe_judgment
| BadAssumption of ('constr, 'types) punsafe_judgment
| ReferenceVariables of Id.t * 'constr
- | ElimArity of pinductive * sorts_family list * 'constr * ('constr, 'types) punsafe_judgment
- * (sorts_family * sorts_family * arity_error) option
+ | ElimArity of pinductive * Sorts.family list * 'constr * ('constr, 'types) punsafe_judgment
+ * (Sorts.family * Sorts.family * arity_error) option
| CaseNotInductive of ('constr, 'types) punsafe_judgment
| WrongCaseInfo of pinductive * case_info
| NumberBranches of ('constr, 'types) punsafe_judgment * int
@@ -60,7 +60,7 @@ type ('constr, 'types) ptype_error =
| IllFormedRecBody of 'constr pguard_error * Name.t array * int * env * ('constr, 'types) punsafe_judgment array
| IllTypedRecBody of
int * Name.t array * ('constr, 'types) punsafe_judgment array * 'types array
- | UnsatisfiedConstraints of Univ.constraints
+ | UnsatisfiedConstraints of Univ.Constraint.t
type type_error = (constr, types) ptype_error
@@ -77,8 +77,8 @@ val error_assumption : env -> unsafe_judgment -> 'a
val error_reference_variables : env -> Id.t -> constr -> 'a
val error_elim_arity :
- env -> pinductive -> sorts_family list -> constr -> unsafe_judgment ->
- (sorts_family * sorts_family * arity_error) option -> 'a
+ env -> pinductive -> Sorts.family list -> constr -> unsafe_judgment ->
+ (Sorts.family * Sorts.family * arity_error) option -> 'a
val error_case_not_inductive : env -> unsafe_judgment -> 'a
@@ -103,6 +103,6 @@ val error_ill_formed_rec_body :
val error_ill_typed_rec_body :
env -> int -> Name.t array -> unsafe_judgment array -> types array -> 'a
-val error_elim_explain : sorts_family -> sorts_family -> arity_error
+val error_elim_explain : Sorts.family -> Sorts.family -> arity_error
-val error_unsatisfied_constraints : env -> Univ.constraints -> 'a
+val error_unsatisfied_constraints : env -> Univ.Constraint.t -> 'a
diff --git a/kernel/typeops.ml b/kernel/typeops.ml
index b40badd7c..4a935f581 100644
--- a/kernel/typeops.ml
+++ b/kernel/typeops.ml
@@ -10,7 +10,8 @@ open CErrors
open Util
open Names
open Univ
-open Term
+open Sorts
+open Constr
open Vars
open Declarations
open Environ
@@ -38,7 +39,7 @@ let check_constraints cst env =
(* This should be a type (a priori without intention to be an assumption) *)
let check_type env c t =
- match kind_of_term(whd_all env t) with
+ match kind(whd_all env t) with
| Sort s -> s
| _ -> error_not_type env (make_judge c t)
@@ -57,7 +58,7 @@ let check_assumption env t ty =
(* Prop and Set *)
-let type1 = mkSort type1_sort
+let type1 = mkSort Sorts.type1
(* Type of Type(i). *)
@@ -152,7 +153,7 @@ let type_of_apply env func funt argsv argstv =
let rec apply_rec i typ =
if Int.equal i len then typ
else
- (match kind_of_term (whd_all env typ) with
+ (match kind (whd_all env typ) with
| Prod (_,c1,c2) ->
let arg = argsv.(i) and argt = argstv.(i) in
(try
@@ -298,9 +299,9 @@ let type_of_projection env p c ct =
try find_rectype env ct
with Not_found -> error_case_not_inductive env (make_judge c ct)
in
- assert(eq_mind pb.proj_ind (fst ind));
+ assert(MutInd.equal pb.proj_ind (fst ind));
let ty = Vars.subst_instance_constr u pb.Declarations.proj_type in
- substl (c :: List.rev args) ty
+ substl (c :: CList.rev args) ty
(* Fixpoints. *)
@@ -325,7 +326,7 @@ let check_fixpoint env lna lar vdef vdeft =
arbitraires et non plus des variables *)
let rec execute env cstr =
let open Context.Rel.Declaration in
- match kind_of_term cstr with
+ match kind cstr with
(* Atomic terms *)
| Sort s -> type_of_sort s
@@ -346,7 +347,7 @@ let rec execute env cstr =
| App (f,args) ->
let argst = execute_array env args in
let ft =
- match kind_of_term f with
+ match kind f with
| Ind ind when Environ.template_polymorphic_pind ind env ->
let args = Array.map (fun t -> lazy t) argst in
type_of_inductive_knowing_parameters env ind args
@@ -434,8 +435,8 @@ let infer env constr =
let infer =
if Flags.profile then
- let infer_key = Profile.declare_profile "Fast_infer" in
- Profile.profile2 infer_key (fun b c -> infer b c)
+ let infer_key = CProfile.declare_profile "Fast_infer" in
+ CProfile.profile2 infer_key (fun b c -> infer b c)
else (fun b c -> infer b c)
let assumption_of_judgment env {uj_val=c; uj_type=t} =
diff --git a/kernel/typeops.mli b/kernel/typeops.mli
index 96be6c14a..5584b6ab4 100644
--- a/kernel/typeops.mli
+++ b/kernel/typeops.mli
@@ -7,8 +7,8 @@
(************************************************************************)
open Names
+open Constr
open Univ
-open Term
open Environ
open Entries
@@ -41,8 +41,8 @@ val type1 : types
val type_of_sort : Sorts.t -> types
val judge_of_prop : unsafe_judgment
val judge_of_set : unsafe_judgment
-val judge_of_prop_contents : contents -> unsafe_judgment
-val judge_of_type : universe -> unsafe_judgment
+val judge_of_prop_contents : Sorts.contents -> unsafe_judgment
+val judge_of_type : Universe.t -> unsafe_judgment
(** {6 Type of a bound variable. } *)
val type_of_relative : env -> int -> types
@@ -71,8 +71,8 @@ val judge_of_abstraction :
-> unsafe_judgment
(** {6 Type of a product. } *)
-val sort_of_product : env -> sorts -> sorts -> sorts
-val type_of_product : env -> Name.t -> sorts -> sorts -> types
+val sort_of_product : env -> Sorts.t -> Sorts.t -> Sorts.t
+val type_of_product : env -> Name.t -> Sorts.t -> Sorts.t -> types
val judge_of_product :
env -> Name.t -> unsafe_type_judgment -> unsafe_type_judgment
-> unsafe_judgment
diff --git a/kernel/uGraph.ml b/kernel/uGraph.ml
index 9793dd881..f1e8d1031 100644
--- a/kernel/uGraph.ml
+++ b/kernel/uGraph.ml
@@ -890,23 +890,24 @@ let dump_universes output g =
let merge_constraints =
if Flags.profile then
- let key = Profile.declare_profile "merge_constraints" in
- Profile.profile2 key merge_constraints
+ let key = CProfile.declare_profile "merge_constraints" in
+ CProfile.profile2 key merge_constraints
else merge_constraints
let check_constraints =
if Flags.profile then
- let key = Profile.declare_profile "check_constraints" in
- Profile.profile2 key check_constraints
+ let key = CProfile.declare_profile "check_constraints" in
+ CProfile.profile2 key check_constraints
else check_constraints
let check_eq =
if Flags.profile then
- let check_eq_key = Profile.declare_profile "check_eq" in
- Profile.profile3 check_eq_key check_eq
+ let check_eq_key = CProfile.declare_profile "check_eq" in
+ CProfile.profile3 check_eq_key check_eq
else check_eq
let check_leq =
if Flags.profile then
- let check_leq_key = Profile.declare_profile "check_leq" in
- Profile.profile3 check_leq_key check_leq
+ let check_leq_key = CProfile.declare_profile "check_leq" in
+ CProfile.profile3 check_leq_key check_leq
else check_leq
+
diff --git a/kernel/uGraph.mli b/kernel/uGraph.mli
index 2fe555018..f71d83d85 100644
--- a/kernel/uGraph.mli
+++ b/kernel/uGraph.mli
@@ -9,63 +9,64 @@
open Univ
(** {6 Graphs of universes. } *)
-
type t
-
type universes = t
+[@@ocaml.deprecated "Use UGraph.t"]
-type 'a check_function = universes -> 'a -> 'a -> bool
-val check_leq : universe check_function
-val check_eq : universe check_function
-val check_eq_level : universe_level check_function
+type 'a check_function = t -> 'a -> 'a -> bool
-(** The empty graph of universes *)
-val empty_universes : universes
+val check_leq : Universe.t check_function
+val check_eq : Universe.t check_function
+val check_eq_level : Level.t check_function
(** The initial graph of universes: Prop < Set *)
-val initial_universes : universes
+val initial_universes : t
+
+(** Check if we are in the initial case *)
+val is_initial_universes : t -> bool
+
+(** Check equality of instances w.r.t. a universe graph *)
+val check_eq_instances : Instance.t check_function
+
+(** {6 ... } *)
+(** Merge of constraints in a universes graph.
+ The function [merge_constraints] merges a set of constraints in a given
+ universes graph. It raises the exception [UniverseInconsistency] if the
+ constraints are not satisfiable. *)
-val is_initial_universes : universes -> bool
+val enforce_constraint : univ_constraint -> t -> t
+val merge_constraints : Constraint.t -> t -> t
-val sort_universes : universes -> universes
+val check_constraint : t -> univ_constraint -> bool
+val check_constraints : Constraint.t -> t -> bool
(** Adds a universe to the graph, ensuring it is >= or > Set.
@raises AlreadyDeclared if the level is already declared in the graph. *)
exception AlreadyDeclared
-val add_universe : universe_level -> bool -> universes -> universes
+val add_universe : Level.t -> bool -> t -> t
-(** {6 ... } *)
-(** Merge of constraints in a universes graph.
- The function [merge_constraints] merges a set of constraints in a given
- universes graph. It raises the exception [UniverseInconsistency] if the
- constraints are not satisfiable. *)
+(** {6 Pretty-printing of universes. } *)
-val enforce_constraint : univ_constraint -> universes -> universes
-val merge_constraints : constraints -> universes -> universes
+val pr_universes : (Level.t -> Pp.t) -> t -> Pp.t
-val constraints_of_universes : universes -> constraints
+(** The empty graph of universes *)
+val empty_universes : t
+[@@ocaml.deprecated "Use UGraph.initial_universes"]
-val check_constraint : universes -> univ_constraint -> bool
-val check_constraints : constraints -> universes -> bool
+val sort_universes : t -> t
-val check_eq_instances : Instance.t check_function
-(** Check equality of instances w.r.t. a universe graph *)
+val constraints_of_universes : t -> Constraint.t
val check_subtype : AUContext.t check_function
(** [check_subtype univ ctx1 ctx2] checks whether [ctx2] is an instance of
[ctx1]. *)
-(** {6 Pretty-printing of universes. } *)
-
-val pr_universes : (Level.t -> Pp.t) -> universes -> Pp.t
-
(** {6 Dumping to a file } *)
val dump_universes :
- (constraint_type -> string -> string -> unit) ->
- universes -> unit
+ (constraint_type -> string -> string -> unit) -> t -> unit
(** {6 Debugging} *)
-val check_universes_invariants : universes -> unit
+val check_universes_invariants : t -> unit
diff --git a/kernel/univ.ml b/kernel/univ.ml
index 7fe4f8274..f72f6f26a 100644
--- a/kernel/univ.ml
+++ b/kernel/univ.ml
@@ -192,6 +192,10 @@ module Level = struct
let make m n = make (Level (n, Names.DirPath.hcons m))
+ let name u =
+ match data u with
+ | Level (n, d) -> Some (d, n)
+ | _ -> None
end
(** Level maps *)
@@ -337,19 +341,16 @@ struct
returning [SuperSame] if they refer to the same level at potentially different
increments or [SuperDiff] if they are different. The booleans indicate if the
left expression is "smaller" than the right one in both cases. *)
- let super (u,n as x) (v,n' as y) =
+ let super (u,n) (v,n') =
let cmp = Level.compare u v in
if Int.equal cmp 0 then SuperSame (n < n')
else
- match x, y with
- | (l,0), (l',0) ->
- let open RawLevel in
- (match Level.data l, Level.data l' with
- | Prop, Prop -> SuperSame false
- | Prop, _ -> SuperSame true
- | _, Prop -> SuperSame false
- | _, _ -> SuperDiff cmp)
- | _, _ -> SuperDiff cmp
+ let open RawLevel in
+ match Level.data u, n, Level.data v, n' with
+ | Prop, _, Prop, _ -> SuperSame (n < n')
+ | Prop, 0, _, _ -> SuperSame true
+ | _, _, Prop, 0 -> SuperSame false
+ | _, _, _, _ -> SuperDiff cmp
let to_string (v, n) =
if Int.equal n 0 then Level.to_string v
@@ -499,6 +500,7 @@ struct
let smartmap = List.smartmap
+ let map = List.map
end
type universe = Universe.t
@@ -684,12 +686,6 @@ let enforce_leq u v c =
let enforce_leq_level u v c =
if Level.equal u v then c else Constraint.add (u,Le,v) c
-let enforce_univ_constraint (u,d,v) =
- match d with
- | Eq -> enforce_eq u v
- | Le -> enforce_leq u v
- | Lt -> enforce_leq (super u) v
-
(* Miscellaneous functions to remove or test local univ assumed to
occur in a universe *)
@@ -716,14 +712,6 @@ type universe_level_subst = universe_level universe_map
(** A full substitution might involve algebraic universes *)
type universe_subst = universe universe_map
-let level_subst_of f =
- fun l ->
- try let u = f l in
- match Universe.level u with
- | None -> l
- | Some l -> l
- with Not_found -> l
-
module Instance : sig
type t = Level.t array
@@ -1053,6 +1041,7 @@ struct
let constraints (univs, cst) = cst
let levels (univs, cst) = univs
+ let size (univs,_) = LSet.cardinal univs
end
type universe_context_set = ContextSet.t
@@ -1125,24 +1114,6 @@ let subst_univs_universe fn ul =
List.fold_left (fun acc u -> Universe.merge_univs acc (Universe.tip u))
substs nosubst
-let subst_univs_level fn l =
- try Some (fn l)
- with Not_found -> None
-
-let subst_univs_constraint fn (u,d,v as c) cstrs =
- let u' = subst_univs_level fn u in
- let v' = subst_univs_level fn v in
- match u', v' with
- | None, None -> Constraint.add c cstrs
- | Some u, None -> enforce_univ_constraint (u,d,make v) cstrs
- | None, Some v -> enforce_univ_constraint (make u,d,v) cstrs
- | Some u, Some v -> enforce_univ_constraint (u,d,v) cstrs
-
-let subst_univs_constraints subst csts =
- Constraint.fold
- (fun c cstrs -> subst_univs_constraint subst c cstrs)
- csts Constraint.empty
-
let make_instance_subst i =
let arr = Instance.to_array i in
Array.fold_left_i (fun i acc l ->
@@ -1165,7 +1136,7 @@ let abstract_universes ctx =
(UContext.constraints ctx)
in
let ctx = UContext.make (instance, cstrs) in
- subst, ctx
+ instance, ctx
let abstract_cumulativity_info (univcst, substcst) =
let instance, univcst = abstract_universes univcst in
diff --git a/kernel/univ.mli b/kernel/univ.mli
index 94116e473..63bef1b81 100644
--- a/kernel/univ.mli
+++ b/kernel/univ.mli
@@ -7,7 +7,6 @@
(************************************************************************)
(** Universes. *)
-
module Level :
sig
type t
@@ -20,11 +19,11 @@ sig
val is_small : t -> bool
(** Is the universe set or prop? *)
-
+
val is_prop : t -> bool
val is_set : t -> bool
(** Is it specifically Prop or Set *)
-
+
val compare : t -> t -> int
(** Comparison function *)
@@ -46,21 +45,24 @@ sig
val var : int -> t
val var_index : t -> int option
+
+ val name : t -> (Names.DirPath.t * int) option
end
type universe_level = Level.t
-(** Alias name. *)
+[@@ocaml.deprecated "Use Level.t"]
(** Sets of universe levels *)
-module LSet :
-sig
- include CSig.SetS with type elt = universe_level
-
+module LSet :
+sig
+ include CSig.SetS with type elt = Level.t
+
val pr : (Level.t -> Pp.t) -> t -> Pp.t
(** Pretty-printing *)
end
type universe_set = LSet.t
+[@@ocaml.deprecated "Use LSet.t"]
module Universe :
sig
@@ -106,83 +108,86 @@ sig
val super : t -> t
(** The universe strictly above *)
-
+
val sup : t -> t -> t
(** The l.u.b. of 2 universes *)
- val type0m : t
+ val type0m : t
(** image of Prop in the universes hierarchy *)
-
- val type0 : t
+
+ val type0 : t
(** image of Set in the universes hierarchy *)
-
- val type1 : t
+
+ val type1 : t
(** the universe of the type of Prop/Set *)
val exists : (Level.t * int -> bool) -> t -> bool
val for_all : (Level.t * int -> bool) -> t -> bool
+
+ val map : (Level.t * int -> 'a) -> t -> 'a list
end
type universe = Universe.t
+[@@ocaml.deprecated "Use Universe.t"]
(** Alias name. *)
-val pr_uni : universe -> Pp.t
-
-(** The universes hierarchy: Type 0- = Prop <= Type 0 = Set <= Type 1 <= ...
+val pr_uni : Universe.t -> Pp.t
+
+(** The universes hierarchy: Type 0- = Prop <= Type 0 = Set <= Type 1 <= ...
Typing of universes: Type 0-, Type 0 : Type 1; Type i : Type (i+1) if i>0 *)
-val type0m_univ : universe
-val type0_univ : universe
-val type1_univ : universe
+val type0m_univ : Universe.t
+val type0_univ : Universe.t
+val type1_univ : Universe.t
-val is_type0_univ : universe -> bool
-val is_type0m_univ : universe -> bool
-val is_univ_variable : universe -> bool
-val is_small_univ : universe -> bool
+val is_type0_univ : Universe.t -> bool
+val is_type0m_univ : Universe.t -> bool
+val is_univ_variable : Universe.t -> bool
+val is_small_univ : Universe.t -> bool
-val sup : universe -> universe -> universe
-val super : universe -> universe
+val sup : Universe.t -> Universe.t -> Universe.t
+val super : Universe.t -> Universe.t
-val universe_level : universe -> universe_level option
+val universe_level : Universe.t -> Level.t option
(** [univ_level_mem l u] Is l is mentionned in u ? *)
-val univ_level_mem : universe_level -> universe -> bool
+val univ_level_mem : Level.t -> Universe.t -> bool
(** [univ_level_rem u v min] removes [u] from [v], resulting in [min]
if [v] was exactly [u]. *)
-val univ_level_rem : universe_level -> universe -> universe -> universe
+val univ_level_rem : Level.t -> Universe.t -> Universe.t -> Universe.t
(** {6 Constraints. } *)
type constraint_type = Lt | Le | Eq
-type univ_constraint = universe_level * constraint_type * universe_level
+type univ_constraint = Level.t * constraint_type * Level.t
module Constraint : sig
include Set.S with type elt = univ_constraint
end
type constraints = Constraint.t
+[@@ocaml.deprecated "Use Constraint.t"]
-val empty_constraint : constraints
-val union_constraint : constraints -> constraints -> constraints
-val eq_constraint : constraints -> constraints -> bool
+val empty_constraint : Constraint.t
+val union_constraint : Constraint.t -> Constraint.t -> Constraint.t
+val eq_constraint : Constraint.t -> Constraint.t -> bool
-(** A value with universe constraints. *)
-type 'a constrained = 'a * constraints
+(** A value with universe Constraint.t. *)
+type 'a constrained = 'a * Constraint.t
(** Constrained *)
-val constraints_of : 'a constrained -> constraints
-
-(** Enforcing constraints. *)
+val constraints_of : 'a constrained -> Constraint.t
-type 'a constraint_function = 'a -> 'a -> constraints -> constraints
+(** Enforcing Constraint.t. *)
+type 'a constraint_function = 'a -> 'a -> Constraint.t -> Constraint.t
-val enforce_eq : universe constraint_function
-val enforce_leq : universe constraint_function
-val enforce_eq_level : universe_level constraint_function
-val enforce_leq_level : universe_level constraint_function
+val enforce_eq : Universe.t constraint_function
+val enforce_leq : Universe.t constraint_function
+val enforce_eq_level : Level.t constraint_function
+val enforce_leq_level : Level.t constraint_function
(** Type explanation is used to decorate error messages to provide
useful explanation why a given constraint is rejected. It is composed
@@ -194,19 +199,19 @@ val enforce_leq_level : universe_level constraint_function
universes in the path are canonical. Note that each step does not
necessarily correspond to an actual constraint, but reflect how the
system stores the graph and may result from combination of several
- constraints...
+ Constraint.t...
*)
-type explanation = (constraint_type * universe) list
-type univ_inconsistency = constraint_type * universe * universe * explanation option
+type explanation = (constraint_type * Universe.t) list
+type univ_inconsistency = constraint_type * Universe.t * Universe.t * explanation option
exception UniverseInconsistency of univ_inconsistency
(** {6 Support for universe polymorphism } *)
(** Polymorphic maps from universe levels to 'a *)
-module LMap :
+module LMap :
sig
- include CMap.ExtS with type key = universe_level and module Set := LSet
+ include CMap.ExtS with type key = Level.t and module Set := LSet
val union : 'a t -> 'a t -> 'a t
(** [union x y] favors the bindings in the first map. *)
@@ -226,18 +231,16 @@ type 'a universe_map = 'a LMap.t
(** {6 Substitution} *)
-type universe_subst_fn = universe_level -> universe
-type universe_level_subst_fn = universe_level -> universe_level
+type universe_subst_fn = Level.t -> Universe.t
+type universe_level_subst_fn = Level.t -> Level.t
(** A full substitution, might involve algebraic universes *)
-type universe_subst = universe universe_map
-type universe_level_subst = universe_level universe_map
-
-val level_subst_of : universe_subst_fn -> universe_level_subst_fn
+type universe_subst = Universe.t universe_map
+type universe_level_subst = Level.t universe_map
(** {6 Universe instances} *)
-module Instance :
+module Instance :
sig
type t
(** A universe instance represents a vector of argument universes
@@ -279,49 +282,51 @@ sig
end
type universe_instance = Instance.t
+[@@ocaml.deprecated "Use Instance.t"]
-val enforce_eq_instances : universe_instance constraint_function
+val enforce_eq_instances : Instance.t constraint_function
-type 'a puniverses = 'a * universe_instance
+type 'a puniverses = 'a * Instance.t
val out_punivs : 'a puniverses -> 'a
val in_punivs : 'a -> 'a puniverses
val eq_puniverses : ('a -> 'a -> bool) -> 'a puniverses -> 'a puniverses -> bool
-(** A vector of universe levels with universe constraints,
- representiong local universe variables and associated constraints *)
+(** A vector of universe levels with universe Constraint.t,
+ representiong local universe variables and associated Constraint.t *)
module UContext :
-sig
+sig
type t
val make : Instance.t constrained -> t
val empty : t
val is_empty : t -> bool
-
+
val instance : t -> Instance.t
- val constraints : t -> constraints
+ val constraints : t -> Constraint.t
- val dest : t -> Instance.t * constraints
+ val dest : t -> Instance.t * Constraint.t
(** Keeps the order of the instances *)
val union : t -> t -> t
- (* the number of universes in the context *)
+ (** the number of universes in the context *)
val size : t -> int
end
type universe_context = UContext.t
+[@@ocaml.deprecated "Use UContext.t"]
module AUContext :
-sig
+sig
type t
val repr : t -> UContext.t
(** [repr ctx] is [(Var(0), ... Var(n-1) |= cstr] where [n] is the length of
- the context and [cstr] the abstracted constraints. *)
+ the context and [cstr] the abstracted Constraint.t. *)
val empty : t
val is_empty : t -> bool
@@ -335,68 +340,71 @@ sig
val union : t -> t -> t
val instantiate : Instance.t -> t -> Constraint.t
- (** Generate the set of instantiated constraints **)
+ (** Generate the set of instantiated Constraint.t **)
end
type abstract_universe_context = AUContext.t
+[@@ocaml.deprecated "Use AUContext.t"]
(** Universe info for inductive types: A context of universe levels
- with universe constraints, representing local universe variables
- and constraints, together with a context of universe levels with
- universe constraints, representing conditions for subtyping used
+ with universe Constraint.t, representing local universe variables
+ and Constraint.t, together with a context of universe levels with
+ universe Constraint.t, representing conditions for subtyping used
for inductive types.
This data structure maintains the invariant that the context for
- subtyping constraints is exactly twice as big as the context for
- universe constraints. *)
+ subtyping Constraint.t is exactly twice as big as the context for
+ universe Constraint.t. *)
module CumulativityInfo :
sig
type t
- val make : universe_context * universe_context -> t
+ val make : UContext.t * UContext.t -> t
val empty : t
val is_empty : t -> bool
- val univ_context : t -> universe_context
- val subtyp_context : t -> universe_context
+ val univ_context : t -> UContext.t
+ val subtyp_context : t -> UContext.t
- (** This function takes a universe context representing constraints
+ (** This function takes a universe context representing Constraint.t
of an inductive and a Instance.t of fresh universe names for the
subtyping (with the same length as the context in the given
universe context) and produces a UInfoInd.t that with the
trivial subtyping relation. *)
- val from_universe_context : universe_context -> universe_instance -> t
+ val from_universe_context : UContext.t -> Instance.t -> t
val subtyping_susbst : t -> universe_level_subst
end
type cumulativity_info = CumulativityInfo.t
+[@@ocaml.deprecated "Use CumulativityInfo.t"]
module ACumulativityInfo :
sig
type t
- val univ_context : t -> abstract_universe_context
- val subtyp_context : t -> abstract_universe_context
+ val univ_context : t -> AUContext.t
+ val subtyp_context : t -> AUContext.t
end
type abstract_cumulativity_info = ACumulativityInfo.t
+[@@ocaml.deprecated "Use ACumulativityInfo.t"]
(** Universe contexts (as sets) *)
module ContextSet :
-sig
- type t = universe_set constrained
+sig
+ type t = LSet.t constrained
val empty : t
val is_empty : t -> bool
- val singleton : universe_level -> t
+ val singleton : Level.t -> t
val of_instance : Instance.t -> t
- val of_set : universe_set -> t
+ val of_set : LSet.t -> t
val equal : t -> t -> bool
val union : t -> t -> t
@@ -406,39 +414,43 @@ sig
much smaller than the right one. *)
val diff : t -> t -> t
- val add_universe : universe_level -> t -> t
- val add_constraints : constraints -> t -> t
+ val add_universe : Level.t -> t -> t
+ val add_constraints : Constraint.t -> t -> t
val add_instance : Instance.t -> t -> t
(** Arbitrary choice of linear order of the variables *)
val sort_levels : Level.t array -> Level.t array
- val to_context : t -> universe_context
- val of_context : universe_context -> t
+ val to_context : t -> UContext.t
+ val of_context : UContext.t -> t
+
+ val constraints : t -> Constraint.t
+ val levels : t -> LSet.t
- val constraints : t -> constraints
- val levels : t -> universe_set
+ (** the number of universes in the context *)
+ val size : t -> int
end
-(** A set of universes with universe constraints.
- We linearize the set to a list after typechecking.
+(** A set of universes with universe Constraint.t.
+ We linearize the set to a list after typechecking.
Beware, representation could change.
*)
type universe_context_set = ContextSet.t
+[@@ocaml.deprecated "Use ContextSet.t"]
(** A value in a universe context (resp. context set). *)
-type 'a in_universe_context = 'a * universe_context
-type 'a in_universe_context_set = 'a * universe_context_set
+type 'a in_universe_context = 'a * UContext.t
+type 'a in_universe_context_set = 'a * ContextSet.t
val empty_level_subst : universe_level_subst
val is_empty_level_subst : universe_level_subst -> bool
(** Substitution of universes. *)
-val subst_univs_level_level : universe_level_subst -> universe_level -> universe_level
-val subst_univs_level_universe : universe_level_subst -> universe -> universe
-val subst_univs_level_constraints : universe_level_subst -> constraints -> constraints
+val subst_univs_level_level : universe_level_subst -> Level.t -> Level.t
+val subst_univs_level_universe : universe_level_subst -> Universe.t -> Universe.t
+val subst_univs_level_constraints : universe_level_subst -> Constraint.t -> Constraint.t
val subst_univs_level_abstract_universe_context :
- universe_level_subst -> abstract_universe_context -> abstract_universe_context
-val subst_univs_level_instance : universe_level_subst -> universe_instance -> universe_instance
+ universe_level_subst -> AUContext.t -> AUContext.t
+val subst_univs_level_instance : universe_level_subst -> Instance.t -> Instance.t
(** Level to universe substitutions. *)
@@ -446,32 +458,35 @@ val empty_subst : universe_subst
val is_empty_subst : universe_subst -> bool
val make_subst : universe_subst -> universe_subst_fn
-val subst_univs_universe : universe_subst_fn -> universe -> universe
-val subst_univs_constraints : universe_subst_fn -> constraints -> constraints
+val subst_univs_universe : universe_subst_fn -> Universe.t -> Universe.t
+(** Only user in the kernel is template polymorphism. Ideally we get rid of
+ this code if it goes away. *)
(** Substitution of instances *)
-val subst_instance_instance : universe_instance -> universe_instance -> universe_instance
-val subst_instance_universe : universe_instance -> universe -> universe
+val subst_instance_instance : Instance.t -> Instance.t -> Instance.t
+val subst_instance_universe : Instance.t -> Universe.t -> Universe.t
-val make_instance_subst : universe_instance -> universe_level_subst
-val make_inverse_instance_subst : universe_instance -> universe_level_subst
+val make_instance_subst : Instance.t -> universe_level_subst
+(** Creates [u(0) ↦ 0; ...; u(n-1) ↦ n - 1] out of [u(0); ...; u(n - 1)] *)
-val abstract_universes : universe_context -> universe_level_subst * abstract_universe_context
+val make_inverse_instance_subst : Instance.t -> universe_level_subst
-val abstract_cumulativity_info : cumulativity_info -> universe_level_subst * abstract_cumulativity_info
+val abstract_universes : UContext.t -> Instance.t * AUContext.t
+val abstract_cumulativity_info : CumulativityInfo.t -> Instance.t * ACumulativityInfo.t
+(** TODO: move universe abstraction out of the kernel *)
-val make_abstract_instance : abstract_universe_context -> universe_instance
+val make_abstract_instance : AUContext.t -> Instance.t
(** {6 Pretty-printing of universes. } *)
val pr_constraint_type : constraint_type -> Pp.t
-val pr_constraints : (Level.t -> Pp.t) -> constraints -> Pp.t
-val pr_universe_context : (Level.t -> Pp.t) -> universe_context -> Pp.t
-val pr_cumulativity_info : (Level.t -> Pp.t) -> cumulativity_info -> Pp.t
-val pr_abstract_universe_context : (Level.t -> Pp.t) -> abstract_universe_context -> Pp.t
-val pr_abstract_cumulativity_info : (Level.t -> Pp.t) -> abstract_cumulativity_info -> Pp.t
-val pr_universe_context_set : (Level.t -> Pp.t) -> universe_context_set -> Pp.t
-val explain_universe_inconsistency : (Level.t -> Pp.t) ->
+val pr_constraints : (Level.t -> Pp.t) -> Constraint.t -> Pp.t
+val pr_universe_context : (Level.t -> Pp.t) -> UContext.t -> Pp.t
+val pr_cumulativity_info : (Level.t -> Pp.t) -> CumulativityInfo.t -> Pp.t
+val pr_abstract_universe_context : (Level.t -> Pp.t) -> AUContext.t -> Pp.t
+val pr_abstract_cumulativity_info : (Level.t -> Pp.t) -> ACumulativityInfo.t -> Pp.t
+val pr_universe_context_set : (Level.t -> Pp.t) -> ContextSet.t -> Pp.t
+val explain_universe_inconsistency : (Level.t -> Pp.t) ->
univ_inconsistency -> Pp.t
val pr_universe_level_subst : universe_level_subst -> Pp.t
@@ -479,23 +494,28 @@ val pr_universe_subst : universe_subst -> Pp.t
(** {6 Hash-consing } *)
-val hcons_univ : universe -> universe
-val hcons_constraints : constraints -> constraints
-val hcons_universe_set : universe_set -> universe_set
-val hcons_universe_context : universe_context -> universe_context
-val hcons_abstract_universe_context : abstract_universe_context -> abstract_universe_context
-val hcons_universe_context_set : universe_context_set -> universe_context_set
-val hcons_cumulativity_info : cumulativity_info -> cumulativity_info
-val hcons_abstract_cumulativity_info : abstract_cumulativity_info -> abstract_cumulativity_info
+val hcons_univ : Universe.t -> Universe.t
+val hcons_constraints : Constraint.t -> Constraint.t
+val hcons_universe_set : LSet.t -> LSet.t
+val hcons_universe_context : UContext.t -> UContext.t
+val hcons_abstract_universe_context : AUContext.t -> AUContext.t
+val hcons_universe_context_set : ContextSet.t -> ContextSet.t
+val hcons_cumulativity_info : CumulativityInfo.t -> CumulativityInfo.t
+val hcons_abstract_cumulativity_info : ACumulativityInfo.t -> ACumulativityInfo.t
(******)
(* deprecated: use qualified names instead *)
-val compare_levels : universe_level -> universe_level -> int
-val eq_levels : universe_level -> universe_level -> bool
+val compare_levels : Level.t -> Level.t -> int
+[@@ocaml.deprecated "Use Level.compare"]
+
+val eq_levels : Level.t -> Level.t -> bool
+[@@ocaml.deprecated "Use Level.equal"]
(** deprecated: Equality of formal universe expressions. *)
-val equal_universes : universe -> universe -> bool
+val equal_universes : Universe.t -> Universe.t -> bool
+[@@ocaml.deprecated "Use Universe.equal"]
-(** Universes of constraints *)
-val universes_of_constraints : constraints -> universe_set
+(** Universes of Constraint.t *)
+val universes_of_constraints : Constraint.t -> LSet.t
+[@@ocaml.deprecated "Use Constraint.universes_of"]
diff --git a/kernel/vars.ml b/kernel/vars.ml
index d0dad02ec..b3b3eff62 100644
--- a/kernel/vars.ml
+++ b/kernel/vars.ml
@@ -133,8 +133,8 @@ let substn_many lamv n c =
substrec n c
(*
-let substkey = Profile.declare_profile "substn_many";;
-let substn_many lamv n c = Profile.profile3 substkey substn_many lamv n c;;
+let substkey = CProfile.declare_profile "substn_many";;
+let substn_many lamv n c = CProfile.profile3 substkey substn_many lamv n c;;
*)
let make_subst = function
@@ -235,49 +235,6 @@ let subst_vars subst c = substn_vars 1 subst c
(** Universe substitutions *)
open Constr
-let subst_univs_fn_puniverses fn =
- let f = Univ.Instance.subst_fn fn in
- fun ((c, u) as x) -> let u' = f u in if u' == u then x else (c, u')
-
-let subst_univs_fn_constr f c =
- let changed = ref false in
- let fu = Univ.subst_univs_universe f in
- let fi = Univ.Instance.subst_fn (Univ.level_subst_of f) in
- let rec aux t =
- match kind t with
- | Sort (Sorts.Type u) ->
- let u' = fu u in
- if u' == u then t else
- (changed := true; mkSort (Sorts.sort_of_univ u'))
- | Const (c, u) ->
- let u' = fi u in
- if u' == u then t
- else (changed := true; mkConstU (c, u'))
- | Ind (i, u) ->
- let u' = fi u in
- if u' == u then t
- else (changed := true; mkIndU (i, u'))
- | Construct (c, u) ->
- let u' = fi u in
- if u' == u then t
- else (changed := true; mkConstructU (c, u'))
- | _ -> map aux t
- in
- let c' = aux c in
- if !changed then c' else c
-
-let subst_univs_constr subst c =
- if Univ.is_empty_subst subst then c
- else
- let f = Univ.make_subst subst in
- subst_univs_fn_constr f c
-
-let subst_univs_constr =
- if Flags.profile then
- let subst_univs_constr_key = Profile.declare_profile "subst_univs_constr" in
- Profile.profile2 subst_univs_constr_key subst_univs_constr
- else subst_univs_constr
-
let subst_univs_level_constr subst c =
if Univ.is_empty_level_subst subst then c
else
@@ -347,12 +304,12 @@ let subst_instance_constr subst c =
in
aux c
-(* let substkey = Profile.declare_profile "subst_instance_constr";; *)
-(* let subst_instance_constr inst c = Profile.profile2 substkey subst_instance_constr inst c;; *)
+(* let substkey = CProfile.declare_profile "subst_instance_constr";; *)
+(* let subst_instance_constr inst c = CProfile.profile2 substkey subst_instance_constr inst c;; *)
let subst_instance_context s ctx =
if Univ.Instance.is_empty s then ctx
else Context.Rel.map (fun x -> subst_instance_constr s x) ctx
-type id_key = constant tableKey
+type id_key = Constant.t tableKey
let eq_id_key x y = Names.eq_table_key Constant.equal x y
diff --git a/kernel/vars.mli b/kernel/vars.mli
index 59dc09a75..b74d25260 100644
--- a/kernel/vars.mli
+++ b/kernel/vars.mli
@@ -129,20 +129,14 @@ val subst_var : Id.t -> constr -> constr
open Univ
-val subst_univs_fn_constr : universe_subst_fn -> constr -> constr
-val subst_univs_fn_puniverses : universe_level_subst_fn ->
- 'a puniverses -> 'a puniverses
-
-val subst_univs_constr : universe_subst -> constr -> constr
-
(** Level substitutions for polymorphism. *)
val subst_univs_level_constr : universe_level_subst -> constr -> constr
val subst_univs_level_context : Univ.universe_level_subst -> Context.Rel.t -> Context.Rel.t
(** Instance substitution for polymorphism. *)
-val subst_instance_constr : universe_instance -> constr -> constr
-val subst_instance_context : universe_instance -> Context.Rel.t -> Context.Rel.t
+val subst_instance_constr : Instance.t -> constr -> constr
+val subst_instance_context : Instance.t -> Context.Rel.t -> Context.Rel.t
-type id_key = constant tableKey
+type id_key = Constant.t tableKey
val eq_id_key : id_key -> id_key -> bool
diff --git a/kernel/vconv.ml b/kernel/vconv.ml
index 0e452621c..8c7658147 100644
--- a/kernel/vconv.ml
+++ b/kernel/vconv.ml
@@ -3,6 +3,7 @@ open Names
open Environ
open Reduction
open Vm
+open Vmvalues
open Csymtable
let val_of_constr env c =
@@ -93,7 +94,7 @@ and conv_atom env pb k a1 stk1 a2 stk2 cu =
let mib = Environ.lookup_mind mi env in
let ulen =
match mib.Declarations.mind_universes with
- | Declarations.Monomorphic_ind ctx -> Univ.UContext.size ctx
+ | Declarations.Monomorphic_ind ctx -> Univ.ContextSet.size ctx
| Declarations.Polymorphic_ind auctx -> Univ.AUContext.size auctx
| Declarations.Cumulative_ind cumi ->
Univ.AUContext.size (Univ.ACumulativityInfo.univ_context cumi)
@@ -204,4 +205,4 @@ let vm_conv cv_pb env t1 t2 =
let univs = (univs, checked_universes) in
let _ = vm_conv_gen cv_pb env univs t1 t2 in ()
-let _ = Reduction.set_vm_conv vm_conv
+let _ = if Coq_config.bytecode_compiler then Reduction.set_vm_conv vm_conv
diff --git a/kernel/vconv.mli b/kernel/vconv.mli
index f4e680c69..c3c9636e8 100644
--- a/kernel/vconv.mli
+++ b/kernel/vconv.mli
@@ -6,7 +6,7 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-open Term
+open Constr
open Environ
open Reduction
@@ -19,4 +19,4 @@ val vm_conv : conv_pb -> types kernel_conversion_function
val vm_conv_gen : conv_pb -> (types, 'a) generic_conversion_function
(** Precompute a VM value from a constr *)
-val val_of_constr : env -> constr -> values
+val val_of_constr : env -> constr -> Vmvalues.values
diff --git a/kernel/vm.ml b/kernel/vm.ml
index 6b7a86d6f..352ea74a4 100644
--- a/kernel/vm.ml
+++ b/kernel/vm.ml
@@ -6,46 +6,13 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-open Names
-open Term
open Cbytecodes
+open Vmvalues
external set_drawinstr : unit -> unit = "coq_set_drawinstr"
-(******************************************)
-(* Utility Functions about Obj ************)
-(******************************************)
-
-external offset_closure : Obj.t -> int -> Obj.t = "coq_offset_closure"
-external offset : Obj.t -> int = "coq_offset"
-
-(*******************************************)
-(* Initalization of the abstract machine ***)
-(*******************************************)
-
-external init_vm : unit -> unit = "init_coq_vm"
-
-let _ = init_vm ()
-
-(*******************************************)
-(* Machine code *** ************************)
-(*******************************************)
-
-type tcode
-let tcode_of_obj v = ((Obj.obj v):tcode)
-let fun_code v = tcode_of_obj (Obj.field (Obj.repr v) 0)
-
-external mkAccuCode : int -> tcode = "coq_makeaccu"
external mkPopStopCode : int -> tcode = "coq_pushpop"
-external offset_tcode : tcode -> int -> tcode = "coq_offset_tcode"
-external int_tcode : tcode -> int -> int = "coq_int_tcode"
-
-external accumulate : unit -> tcode = "accumulate_code"
-let accumulate = accumulate ()
-
-external is_accumulate : tcode -> bool = "coq_is_accumulate_code"
-
let popstop_tbl = ref (Array.init 30 mkPopStopCode)
let popstop_code i =
@@ -61,106 +28,6 @@ let popstop_code i =
let stop = popstop_code 0
-(******************************************************)
-(* Abstract data types and utility functions **********)
-(******************************************************)
-
-(* Values of the abstract machine *)
-let val_of_obj v = ((Obj.obj v):values)
-let crazy_val = (val_of_obj (Obj.repr 0))
-
-(* Abstract data *)
-type vprod
-type vfun
-type vfix
-type vcofix
-type vblock
-type arguments
-
-type vm_env
-type vstack = values array
-
-type vswitch = {
- sw_type_code : tcode;
- sw_code : tcode;
- sw_annot : annot_switch;
- sw_stk : vstack;
- sw_env : vm_env
- }
-
-(* Representation of values *)
-(* + Products : *)
-(* - vprod = 0_[ dom | codom] *)
-(* dom : values, codom : vfun *)
-(* *)
-(* + Functions have two representations : *)
-(* - unapplied fun : vf = Ct_[ C | fv1 | ... | fvn] *)
-(* C:tcode, fvi : values *)
-(* Remark : a function and its environment is the same value. *)
-(* - partially applied fun : Ct_[Restart:C| vf | arg1 | ... argn] *)
-(* *)
-(* + Fixpoints : *)
-(* - Ct_[C1|Infix_t|C2|...|Infix_t|Cn|fv1|...|fvn] *)
-(* One single block to represent all of the fixpoints, each fixpoint *)
-(* is the pointer to the field holding the pointer to its code, and *)
-(* the infix tag is used to know where the block starts. *)
-(* - Partial application follows the scheme of partially applied *)
-(* functions. Note: only fixpoints not having been applied to its *)
-(* recursive argument are coded this way. When the rec. arg. is *)
-(* applied, either it's a constructor and the fix reduces, or it's *)
-(* and the fix is coded as an accumulator. *)
-(* *)
-(* + Cofixpoints : see cbytegen.ml *)
-(* *)
-(* + vblock's encode (non constant) constructors as in Ocaml, but *)
-(* starting from 0 up. tag 0 ( = accu_tag) is reserved for *)
-(* accumulators. *)
-(* *)
-(* + vm_env is the type of the machine environments (i.e. a function or *)
-(* a fixpoint) *)
-(* *)
-(* + Accumulators : At_[accumulate| accu | arg1 | ... | argn ] *)
-(* - representation of [accu] : tag_[....] *)
-(* -- tag <= 3 : encoding atom type (sorts, free vars, etc.) *)
-(* -- 10_[accu|proj name] : a projection blocked by an accu *)
-(* -- 11_[accu|fix_app] : a fixpoint blocked by an accu *)
-(* -- 12_[accu|vswitch] : a match blocked by an accu *)
-(* -- 13_[fcofix] : a cofix function *)
-(* -- 14_[fcofix|val] : a cofix function, val represent the value *)
-(* of the function applied to arg1 ... argn *)
-(* The [arguments] type, which is abstracted as an array, represents : *)
-(* tag[ _ | _ |v1|... | vn] *)
-(* Generally the first field is a code pointer. *)
-
-(* Do not edit this type without editing C code, especially "coq_values.h" *)
-
-type atom =
- | Aid of Vars.id_key
- | Aind of inductive
- | Atype of Univ.universe
-
-(* Zippers *)
-
-type zipper =
- | Zapp of arguments
- | Zfix of vfix*arguments (* Possibly empty *)
- | Zswitch of vswitch
- | Zproj of Constant.t (* name of the projection *)
-
-type stack = zipper list
-
-type to_up = values
-
-type whd =
- | Vsort of sorts
- | Vprod of vprod
- | Vfun of vfun
- | Vfix of vfix * arguments option
- | Vcofix of vcofix * to_up * arguments option
- | Vconstr_const of int
- | Vconstr_block of vblock
- | Vatom_stk of atom * stack
- | Vuniv_level of Univ.universe_level
(************************************************)
(* Abstract machine *****************************)
@@ -177,389 +44,72 @@ external push_vstack : vstack -> int -> unit = "coq_push_vstack"
external interprete : tcode -> values -> vm_env -> int -> values =
"coq_interprete_ml"
-
-
(* Functions over arguments *)
-let nargs : arguments -> int = fun args -> (Obj.size (Obj.repr args)) - 2
-let arg args i =
- if 0 <= i && i < (nargs args) then
- val_of_obj (Obj.field (Obj.repr args) (i+2))
- else invalid_arg
- ("Vm.arg size = "^(string_of_int (nargs args))^
- " acces "^(string_of_int i))
(* Apply a value to arguments contained in [vargs] *)
let apply_arguments vf vargs =
let n = nargs vargs in
- if Int.equal n 0 then vf
+ if Int.equal n 0 then fun_val vf
else
begin
push_ra stop;
push_arguments vargs;
- interprete (fun_code vf) vf (Obj.magic vf) (n - 1)
+ interprete (fun_code vf) (fun_val vf) (fun_env vf) (n - 1)
end
(* Apply value [vf] to an array of argument values [varray] *)
let apply_varray vf varray =
let n = Array.length varray in
- if Int.equal n 0 then vf
+ if Int.equal n 0 then fun_val vf
else
begin
push_ra stop;
(* The fun code of [vf] will make sure we have enough stack, so we put 0
here. *)
push_vstack varray 0;
- interprete (fun_code vf) vf (Obj.magic vf) (n - 1)
+ interprete (fun_code vf) (fun_val vf) (fun_env vf) (n - 1)
end
-(*************************************************)
-(* Destructors ***********************************)
-(*************************************************)
-
-let uni_lvl_val (v : values) : Univ.universe_level =
- let whd = Obj.magic v in
- match whd with
- | Vuniv_level lvl -> lvl
- | _ ->
- let pr =
- let open Pp in
- match whd with
- | Vsort _ -> str "Vsort"
- | Vprod _ -> str "Vprod"
- | Vfun _ -> str "Vfun"
- | Vfix _ -> str "Vfix"
- | Vcofix _ -> str "Vcofix"
- | Vconstr_const i -> str "Vconstr_const"
- | Vconstr_block b -> str "Vconstr_block"
- | Vatom_stk (a,stk) -> str "Vatom_stk"
- | _ -> assert false
- in
- CErrors.anomaly
- Pp.( strbrk "Parsing virtual machine value expected universe level, got "
- ++ pr ++ str ".")
-
-let rec whd_accu a stk =
- let stk =
- if Int.equal (Obj.size a) 2 then stk
- else Zapp (Obj.obj a) :: stk in
- let at = Obj.field a 1 in
- match Obj.tag at with
- | i when Int.equal i type_atom_tag ->
- begin match stk with
- | [Zapp args] ->
- let u = ref (Obj.obj (Obj.field at 0)) in
- for i = 0 to nargs args - 1 do
- u := Univ.Universe.sup !u (Univ.Universe.make (uni_lvl_val (arg args i)))
- done;
- Vsort (Type !u)
- | _ -> assert false
- end
- | i when i <= max_atom_tag ->
- Vatom_stk(Obj.magic at, stk)
- | i when Int.equal i proj_tag ->
- let zproj = Zproj (Obj.obj (Obj.field at 0)) in
- whd_accu (Obj.field at 1) (zproj :: stk)
- | i when Int.equal i fix_app_tag ->
- let fa = Obj.field at 1 in
- let zfix =
- Zfix (Obj.obj (Obj.field fa 1), Obj.obj fa) in
- whd_accu (Obj.field at 0) (zfix :: stk)
- | i when Int.equal i switch_tag ->
- let zswitch = Zswitch (Obj.obj (Obj.field at 1)) in
- whd_accu (Obj.field at 0) (zswitch :: stk)
- | i when Int.equal i cofix_tag ->
- let vcfx = Obj.obj (Obj.field at 0) in
- let to_up = Obj.obj a in
- begin match stk with
- | [] -> Vcofix(vcfx, to_up, None)
- | [Zapp args] -> Vcofix(vcfx, to_up, Some args)
- | _ -> assert false
- end
- | i when Int.equal i cofix_evaluated_tag ->
- let vcofix = Obj.obj (Obj.field at 0) in
- let res = Obj.obj a in
- begin match stk with
- | [] -> Vcofix(vcofix, res, None)
- | [Zapp args] -> Vcofix(vcofix, res, Some args)
- | _ -> assert false
- end
- | tg ->
- CErrors.anomaly
- Pp.(strbrk "Failed to parse VM value. Tag = " ++ int tg ++ str ".")
-
-external kind_of_closure : Obj.t -> int = "coq_kind_of_closure"
-
-let whd_val : values -> whd =
- fun v ->
- let o = Obj.repr v in
- if Obj.is_int o then Vconstr_const (Obj.obj o)
- else
- let tag = Obj.tag o in
- if tag = accu_tag then
- (
- if Int.equal (Obj.size o) 1 then Obj.obj o (* sort *)
- else
- if is_accumulate (fun_code o) then whd_accu o []
- else Vprod(Obj.obj o))
- else
- if tag = Obj.closure_tag || tag = Obj.infix_tag then
- (match kind_of_closure o with
- | 0 -> Vfun(Obj.obj o)
- | 1 -> Vfix(Obj.obj o, None)
- | 2 -> Vfix(Obj.obj (Obj.field o 1), Some (Obj.obj o))
- | 3 -> Vatom_stk(Aid(RelKey(int_tcode (fun_code o) 1)), [])
- | _ -> CErrors.anomaly ~label:"Vm.whd " (Pp.str "kind_of_closure does not work."))
- else
- Vconstr_block(Obj.obj o)
-
-(**********************************************)
-(* Constructors *******************************)
-(**********************************************)
-
-let obj_of_atom : atom -> Obj.t =
- fun a ->
- let res = Obj.new_block accu_tag 2 in
- Obj.set_field res 0 (Obj.repr accumulate);
- Obj.set_field res 1 (Obj.repr a);
- res
-
-(* obj_of_str_const : structured_constant -> Obj.t *)
-let rec obj_of_str_const str =
- match str with
- | Const_sorts s -> Obj.repr (Vsort s)
- | Const_ind ind -> obj_of_atom (Aind ind)
- | Const_proj p -> Obj.repr p
- | Const_b0 tag -> Obj.repr tag
- | Const_bn(tag, args) ->
- let len = Array.length args in
- let res = Obj.new_block tag len in
- for i = 0 to len - 1 do
- Obj.set_field res i (obj_of_str_const args.(i))
- done;
- res
- | Const_univ_level l -> Obj.repr (Vuniv_level l)
- | Const_type u -> obj_of_atom (Atype u)
-
-let val_of_obj o = ((Obj.obj o) : values)
-
-let val_of_str_const str = val_of_obj (obj_of_str_const str)
-
-let val_of_atom a = val_of_obj (obj_of_atom a)
-
-let atom_of_proj kn v =
- let r = Obj.new_block proj_tag 2 in
- Obj.set_field r 0 (Obj.repr kn);
- Obj.set_field r 1 (Obj.repr v);
- ((Obj.obj r) : atom)
-
-let val_of_proj kn v =
- val_of_atom (atom_of_proj kn v)
-
-module IdKeyHash =
-struct
- type t = constant tableKey
- let equal = Names.eq_table_key Constant.equal
- open Hashset.Combine
- let hash = function
- | ConstKey c -> combinesmall 1 (Constant.hash c)
- | VarKey id -> combinesmall 2 (Id.hash id)
- | RelKey i -> combinesmall 3 (Int.hash i)
-end
-
-module KeyTable = Hashtbl.Make(IdKeyHash)
-
-let idkey_tbl = KeyTable.create 31
-
-let val_of_idkey key =
- try KeyTable.find idkey_tbl key
- with Not_found ->
- let v = val_of_atom (Aid key) in
- KeyTable.add idkey_tbl key v;
- v
-
-let val_of_rel k = val_of_idkey (RelKey k)
-
-let val_of_named id = val_of_idkey (VarKey id)
-
-let val_of_constant c = val_of_idkey (ConstKey c)
-
-external val_of_annot_switch : annot_switch -> values = "%identity"
-
+(* Functions over vfun *)
let mkrel_vstack k arity =
let max = k + arity - 1 in
Array.init arity (fun i -> val_of_rel (max - i))
-
-(*************************************************)
-(** Operations manipulating data types ***********)
-(*************************************************)
-
-(* Functions over products *)
-
-let dom : vprod -> values = fun p -> val_of_obj (Obj.field (Obj.repr p) 0)
-let codom : vprod -> vfun = fun p -> (Obj.obj (Obj.field (Obj.repr p) 1))
-
-(* Functions over vfun *)
-
-external closure_arity : vfun -> int = "coq_closure_arity"
-
-let body_of_vfun k vf =
+let reduce_fun k vf =
let vargs = mkrel_vstack k 1 in
- apply_varray (Obj.magic vf) vargs
+ apply_varray vf vargs
let decompose_vfun2 k vf1 vf2 =
let arity = min (closure_arity vf1) (closure_arity vf2) in
assert (0 < arity && arity < Sys.max_array_length);
let vargs = mkrel_vstack k arity in
- let v1 = apply_varray (Obj.magic vf1) vargs in
- let v2 = apply_varray (Obj.magic vf2) vargs in
+ let v1 = apply_varray vf1 vargs in
+ let v2 = apply_varray vf2 vargs in
arity, v1, v2
-(* Functions over fixpoint *)
-
-let first o = (offset_closure o (offset o))
-let last o = (Obj.field o (Obj.size o - 1))
-
-let current_fix vf = - (offset (Obj.repr vf) / 2)
-
-let unsafe_fb_code fb i = tcode_of_obj (Obj.field (Obj.repr fb) (2 * i))
-
-let unsafe_rec_arg fb i = int_tcode (unsafe_fb_code fb i) 1
-
-let rec_args vf =
- let fb = first (Obj.repr vf) in
- let size = Obj.size (last fb) in
- Array.init size (unsafe_rec_arg fb)
-
-exception FALSE
-
-let check_fix f1 f2 =
- let i1, i2 = current_fix f1, current_fix f2 in
- (* Checking starting point *)
- if i1 = i2 then
- let fb1,fb2 = first (Obj.repr f1), first (Obj.repr f2) in
- let n = Obj.size (last fb1) in
- (* Checking number of definitions *)
- if n = Obj.size (last fb2) then
- (* Checking recursive arguments *)
- try
- for i = 0 to n - 1 do
- if unsafe_rec_arg fb1 i <> unsafe_rec_arg fb2 i
- then raise FALSE
- done;
- true
- with FALSE -> false
- else false
- else false
-
(* Functions over vfix *)
-external atom_rel : unit -> atom array = "get_coq_atom_tbl"
-external realloc_atom_rel : int -> unit = "realloc_coq_atom_tbl"
-
-let relaccu_tbl =
- let atom_rel = atom_rel() in
- let len = Array.length atom_rel in
- for i = 0 to len - 1 do atom_rel.(i) <- Aid (RelKey i) done;
- ref (Array.init len mkAccuCode)
-
-let relaccu_code i =
- let len = Array.length !relaccu_tbl in
- if i < len then !relaccu_tbl.(i)
- else
- begin
- realloc_atom_rel i;
- let atom_rel = atom_rel () in
- let nl = Array.length atom_rel in
- for j = len to nl - 1 do atom_rel.(j) <- Aid(RelKey j) done;
- relaccu_tbl :=
- Array.init nl
- (fun j -> if j < len then !relaccu_tbl.(j) else mkAccuCode j);
- !relaccu_tbl.(i)
- end
let reduce_fix k vf =
- let fb = first (Obj.repr vf) in
+ let fb = first_fix vf in
(* computing types *)
- let fc_typ = ((Obj.obj (last fb)) : tcode array) in
+ let fc_typ = fix_types fb in
let ndef = Array.length fc_typ in
- let et = offset_closure fb (2*(ndef - 1)) in
+ let et = offset_closure_fix fb (2*(ndef - 1)) in
let ftyp =
Array.map
- (fun c -> interprete c crazy_val (Obj.magic et) 0) fc_typ in
+ (fun c -> interprete c crazy_val et 0) fc_typ in
(* Construction of the environment of fix bodies *)
- let e = Obj.dup fb in
- for i = 0 to ndef - 1 do
- Obj.set_field e (2 * i) (Obj.repr (relaccu_code (k + i)))
- done;
- let fix_body i =
- let jump_grabrec c = offset_tcode c 2 in
- let c = jump_grabrec (unsafe_fb_code fb i) in
- let res = Obj.new_block Obj.closure_tag 2 in
- Obj.set_field res 0 (Obj.repr c);
- Obj.set_field res 1 (offset_closure e (2*i));
- ((Obj.obj res) : vfun) in
- (Array.init ndef fix_body, ftyp)
-
-(* Functions over vcofix *)
-
-let get_fcofix vcf i =
- match whd_val (Obj.obj (Obj.field (Obj.repr vcf) (i+1))) with
- | Vcofix(vcfi, _, _) -> vcfi
- | _ -> assert false
-
-let current_cofix vcf =
- let ndef = Obj.size (last (Obj.repr vcf)) in
- let rec find_cofix pos =
- if pos < ndef then
- if get_fcofix vcf pos == vcf then pos
- else find_cofix (pos+1)
- else raise Not_found in
- try find_cofix 0
- with Not_found -> assert false
-
-let check_cofix vcf1 vcf2 =
- (current_cofix vcf1 = current_cofix vcf2) &&
- (Obj.size (last (Obj.repr vcf1)) = Obj.size (last (Obj.repr vcf2)))
+ (mk_fix_body k ndef fb, ftyp)
let reduce_cofix k vcf =
- let fc_typ = ((Obj.obj (last (Obj.repr vcf))) : tcode array) in
+ let fc_typ = cofix_types vcf in
let ndef = Array.length fc_typ in
let ftyp =
(* Evaluate types *)
- Array.map (fun c -> interprete c crazy_val (Obj.magic vcf) 0) fc_typ in
+ Array.map (fun c -> interprete c crazy_val (cofix_env vcf) 0) fc_typ in
(* Construction of the environment of cofix bodies *)
- let e = Obj.dup (Obj.repr vcf) in
- for i = 0 to ndef - 1 do
- Obj.set_field e (i+1) (Obj.repr (val_of_rel (k+i)))
- done;
-
- let cofix_body i =
- let vcfi = get_fcofix vcf i in
- let c = Obj.field (Obj.repr vcfi) 0 in
- Obj.set_field e 0 c;
- let atom = Obj.new_block cofix_tag 1 in
- let self = Obj.new_block accu_tag 2 in
- Obj.set_field self 0 (Obj.repr accumulate);
- Obj.set_field self 1 (Obj.repr atom);
- apply_varray (Obj.obj e) [|Obj.obj self|] in
- (Array.init ndef cofix_body, ftyp)
-
-
-(* Functions over vblock *)
-
-let btag : vblock -> int = fun b -> Obj.tag (Obj.repr b)
-let bsize : vblock -> int = fun b -> Obj.size (Obj.repr b)
-let bfield b i =
- if 0 <= i && i < (bsize b) then val_of_obj (Obj.field (Obj.repr b) i)
- else invalid_arg "Vm.bfield"
-
-
-(* Functions over vswitch *)
-
-let check_switch sw1 sw2 = sw1.sw_annot.rtbl = sw2.sw_annot.rtbl
-
-let case_info sw = sw.sw_annot.ci
+ (mk_cofix_body apply_varray k ndef vcf, ftyp)
let type_of_switch sw =
(* The fun code of types will make sure we have enough stack, so we put 0
@@ -567,20 +117,6 @@ let type_of_switch sw =
push_vstack sw.sw_stk 0;
interprete sw.sw_type_code crazy_val sw.sw_env 0
-let branch_arg k (tag,arity) =
- if Int.equal arity 0 then ((Obj.magic tag):values)
- else
- let b, ofs =
- if tag < last_variant_tag then Obj.new_block tag arity, 0
- else
- let b = Obj.new_block last_variant_tag (arity+1) in
- Obj.set_field b 0 (Obj.repr (tag-last_variant_tag));
- b,1 in
- for i = ofs to ofs + arity - 1 do
- Obj.set_field b i (Obj.repr (val_of_rel (k+i)))
- done;
- val_of_obj b
-
let apply_switch sw arg =
let tc = sw.sw_annot.tailcall in
if tc then
@@ -602,8 +138,8 @@ let branch_of_switch k sw =
(* t = a stk --> t v *)
let rec apply_stack a stk v =
match stk with
- | [] -> apply_varray a [|v|]
- | Zapp args :: stk -> apply_stack (apply_arguments a args) stk v
+ | [] -> apply_varray (fun_of_val a) [|v|]
+ | Zapp args :: stk -> apply_stack (apply_arguments (fun_of_val a) args) stk v
| Zproj kn :: stk -> apply_stack (val_of_proj kn a) stk v
| Zfix(f,args) :: stk ->
let a,stk =
@@ -614,7 +150,7 @@ let rec apply_stack a stk v =
push_val a;
push_arguments args;
let a =
- interprete (fun_code f) (Obj.magic f) (Obj.magic f)
+ interprete (fix_code f) (fix_val f) (fix_env f)
(nargs args+ nargs args') in
a, stk
| _ ->
@@ -622,7 +158,7 @@ let rec apply_stack a stk v =
push_val a;
push_arguments args;
let a =
- interprete (fun_code f) (Obj.magic f) (Obj.magic f)
+ interprete (fix_code f) (fix_val f) (fix_env f)
(nargs args) in
a, stk in
apply_stack a stk v
@@ -633,50 +169,21 @@ let apply_whd k whd =
let v = val_of_rel k in
match whd with
| Vsort _ | Vprod _ | Vconstr_const _ | Vconstr_block _ -> assert false
- | Vfun f -> body_of_vfun k f
+ | Vfun f -> reduce_fun k f
| Vfix(f, None) ->
push_ra stop;
push_val v;
- interprete (fun_code f) (Obj.magic f) (Obj.magic f) 0
+ interprete (fix_code f) (fix_val f) (fix_env f) 0
| Vfix(f, Some args) ->
push_ra stop;
push_val v;
push_arguments args;
- interprete (fun_code f) (Obj.magic f) (Obj.magic f) (nargs args)
+ interprete (fix_code f) (fix_val f) (fix_env f) (nargs args)
| Vcofix(_,to_up,_) ->
push_ra stop;
push_val v;
- interprete (fun_code to_up) (Obj.magic to_up) (Obj.magic to_up) 0
+ interprete (cofix_upd_code to_up) (cofix_upd_val to_up) (cofix_upd_env to_up) 0
| Vatom_stk(a,stk) ->
apply_stack (val_of_atom a) stk v
| Vuniv_level lvl -> assert false
-let rec pr_atom a =
- Pp.(match a with
- | Aid c -> str "Aid(" ++ (match c with
- | ConstKey c -> Names.pr_con c
- | RelKey i -> str "#" ++ int i
- | _ -> str "...") ++ str ")"
- | Aind (mi,i) -> str "Aind(" ++ Names.pr_mind mi ++ str "#" ++ int i ++ str ")"
- | Atype _ -> str "Atype(")
-and pr_whd w =
- Pp.(match w with
- | Vsort _ -> str "Vsort"
- | Vprod _ -> str "Vprod"
- | Vfun _ -> str "Vfun"
- | Vfix _ -> str "Vfix"
- | Vcofix _ -> str "Vcofix"
- | Vconstr_const i -> str "Vconstr_const(" ++ int i ++ str ")"
- | Vconstr_block b -> str "Vconstr_block"
- | Vatom_stk (a,stk) -> str "Vatom_stk(" ++ pr_atom a ++ str ", " ++ pr_stack stk ++ str ")"
- | Vuniv_level _ -> assert false)
-and pr_stack stk =
- Pp.(match stk with
- | [] -> str "[]"
- | s :: stk -> pr_zipper s ++ str " :: " ++ pr_stack stk)
-and pr_zipper z =
- Pp.(match z with
- | Zapp args -> str "Zapp(len = " ++ int (nargs args) ++ str ")"
- | Zfix (f,args) -> str "Zfix(..., len=" ++ int (nargs args) ++ str ")"
- | Zswitch s -> str "Zswitch(...)"
- | Zproj c -> str "Zproj(" ++ Names.pr_con c ++ str ")")
diff --git a/kernel/vm.mli b/kernel/vm.mli
index df638acc1..c6d92ba26 100644
--- a/kernel/vm.mli
+++ b/kernel/vm.mli
@@ -1,115 +1,33 @@
-open Names
-open Term
-open Cbytecodes
+(************************************************************************)
+(* v * The Coq Proof Assistant / The Coq Development Team *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(************************************************************************)
+
+open Vmvalues
(** Debug printing *)
val set_drawinstr : unit -> unit
-(** Machine code *)
-
-type tcode
-
-(** Values *)
-
-type vprod
-type vfun
-type vfix
-type vcofix
-type vblock
-type vswitch
-type arguments
-
-type atom =
- | Aid of Vars.id_key
- | Aind of inductive
- | Atype of Univ.universe
-
-(** Zippers *)
-
-type zipper =
- | Zapp of arguments
- | Zfix of vfix * arguments (** might be empty *)
- | Zswitch of vswitch
- | Zproj of Constant.t (* name of the projection *)
-
-type stack = zipper list
-
-type to_up
-
-type whd =
- | Vsort of sorts
- | Vprod of vprod
- | Vfun of vfun
- | Vfix of vfix * arguments option
- | Vcofix of vcofix * to_up * arguments option
- | Vconstr_const of int
- | Vconstr_block of vblock
- | Vatom_stk of atom * stack
- | Vuniv_level of Univ.universe_level
-
-(** For debugging purposes only *)
-
-val pr_atom : atom -> Pp.t
-val pr_whd : whd -> Pp.t
-val pr_stack : stack -> Pp.t
-
-(** Constructors *)
-
-val val_of_str_const : structured_constant -> values
-val val_of_rel : int -> values
-val val_of_named : Id.t -> values
-val val_of_constant : constant -> values
-
-external val_of_annot_switch : annot_switch -> values = "%identity"
-
-(** Destructors *)
-
-val whd_val : values -> whd
-val uni_lvl_val : values -> Univ.universe_level
-
-(** Arguments *)
-
-val nargs : arguments -> int
-val arg : arguments -> int -> values
-
-(** Product *)
-
-val dom : vprod -> values
-val codom : vprod -> vfun
-
-(** Function *)
-
-val body_of_vfun : int -> vfun -> values
-val decompose_vfun2 : int -> vfun -> vfun -> int * values * values
-
-(** Fix *)
-
-val current_fix : vfix -> int
-val check_fix : vfix -> vfix -> bool
-val rec_args : vfix -> int array
val reduce_fix : int -> vfix -> vfun array * values array
(** bodies , types *)
-(** CoFix *)
-
-val current_cofix : vcofix -> int
-val check_cofix : vcofix -> vcofix -> bool
val reduce_cofix : int -> vcofix -> values array * values array
(** bodies , types *)
-(** Block *)
+val type_of_switch : vswitch -> values
-val btag : vblock -> int
-val bsize : vblock -> int
-val bfield : vblock -> int -> values
+val branch_of_switch : int -> vswitch -> (int * values) array
-(** Switch *)
+val reduce_fun : int -> vfun -> values
-val check_switch : vswitch -> vswitch -> bool
-val case_info : vswitch -> case_info
-val type_of_switch : vswitch -> values
-val branch_of_switch : int -> vswitch -> (int * values) array
+(** [decompose_vfun2 k f1 f2] takes two functions [f1] and [f2] at current
+ DeBruijn level [k], with [n] lambdas in common, returns [n] and the reduced
+ bodies under those lambdas. *)
+val decompose_vfun2 : int -> vfun -> vfun -> int * values * values
(** Apply a value *)
diff --git a/kernel/vmvalues.ml b/kernel/vmvalues.ml
new file mode 100644
index 000000000..1102cdec1
--- /dev/null
+++ b/kernel/vmvalues.ml
@@ -0,0 +1,525 @@
+(************************************************************************)
+(* v * The Coq Proof Assistant / The Coq Development Team *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(************************************************************************)
+open Names
+open Sorts
+open Cbytecodes
+
+(*******************************************)
+(* Initalization of the abstract machine ***)
+(* Necessary for [relaccu_tbl] *)
+(*******************************************)
+
+external init_vm : unit -> unit = "init_coq_vm"
+
+let _ = init_vm ()
+
+(******************************************************)
+(* Abstract data types and utility functions **********)
+(******************************************************)
+
+(* Values of the abstract machine *)
+type values
+let val_of_obj v = ((Obj.obj v):values)
+let crazy_val = (val_of_obj (Obj.repr 0))
+
+(* Abstract data *)
+type vprod
+type vfun
+type vfix
+type vcofix
+type vblock
+type arguments
+
+let fun_val v = (Obj.magic v : values)
+let fix_val v = (Obj.magic v : values)
+let cofix_upd_val v = (Obj.magic v : values)
+
+type vm_env
+let fun_env v = (Obj.magic v : vm_env)
+let fix_env v = (Obj.magic v : vm_env)
+let cofix_env v = (Obj.magic v : vm_env)
+let cofix_upd_env v = (Obj.magic v : vm_env)
+type vstack = values array
+
+let fun_of_val v = (Obj.magic v : vfun)
+
+(*******************************************)
+(* Machine code *** ************************)
+(*******************************************)
+
+type tcode
+
+external mkAccuCode : int -> tcode = "coq_makeaccu"
+external offset_tcode : tcode -> int -> tcode = "coq_offset_tcode"
+
+let tcode_of_obj v = ((Obj.obj v):tcode)
+let fun_code v = tcode_of_obj (Obj.field (Obj.repr v) 0)
+let fix_code v = fun_code v
+let cofix_upd_code v = fun_code v
+
+
+type vswitch = {
+ sw_type_code : tcode;
+ sw_code : tcode;
+ sw_annot : annot_switch;
+ sw_stk : vstack;
+ sw_env : vm_env
+ }
+
+(* Representation of values *)
+(* + Products : *)
+(* - vprod = 0_[ dom | codom] *)
+(* dom : values, codom : vfun *)
+(* *)
+(* + Functions have two representations : *)
+(* - unapplied fun : vf = Ct_[ C | fv1 | ... | fvn] *)
+(* C:tcode, fvi : values *)
+(* Remark : a function and its environment is the same value. *)
+(* - partially applied fun : Ct_[Restart:C| vf | arg1 | ... argn] *)
+(* *)
+(* + Fixpoints : *)
+(* - Ct_[C1|Infix_t|C2|...|Infix_t|Cn|fv1|...|fvn] *)
+(* One single block to represent all of the fixpoints, each fixpoint *)
+(* is the pointer to the field holding the pointer to its code, and *)
+(* the infix tag is used to know where the block starts. *)
+(* - Partial application follows the scheme of partially applied *)
+(* functions. Note: only fixpoints not having been applied to its *)
+(* recursive argument are coded this way. When the rec. arg. is *)
+(* applied, either it's a constructor and the fix reduces, or it's *)
+(* and the fix is coded as an accumulator. *)
+(* *)
+(* + Cofixpoints : see cbytegen.ml *)
+(* *)
+(* + vblock's encode (non constant) constructors as in Ocaml, but *)
+(* starting from 0 up. tag 0 ( = accu_tag) is reserved for *)
+(* accumulators. *)
+(* *)
+(* + vm_env is the type of the machine environments (i.e. a function or *)
+(* a fixpoint) *)
+(* *)
+(* + Accumulators : At_[accumulate| accu | arg1 | ... | argn ] *)
+(* - representation of [accu] : tag_[....] *)
+(* -- tag <= 3 : encoding atom type (sorts, free vars, etc.) *)
+(* -- 10_[accu|proj name] : a projection blocked by an accu *)
+(* -- 11_[accu|fix_app] : a fixpoint blocked by an accu *)
+(* -- 12_[accu|vswitch] : a match blocked by an accu *)
+(* -- 13_[fcofix] : a cofix function *)
+(* -- 14_[fcofix|val] : a cofix function, val represent the value *)
+(* of the function applied to arg1 ... argn *)
+(* The [arguments] type, which is abstracted as an array, represents : *)
+(* tag[ _ | _ |v1|... | vn] *)
+(* Generally the first field is a code pointer. *)
+
+(* Do not edit this type without editing C code, especially "coq_values.h" *)
+
+type atom =
+ | Aid of Vars.id_key
+ | Aind of inductive
+ | Atype of Univ.Universe.t
+
+(* Zippers *)
+
+type zipper =
+ | Zapp of arguments
+ | Zfix of vfix*arguments (* Possibly empty *)
+ | Zswitch of vswitch
+ | Zproj of Constant.t (* name of the projection *)
+
+type stack = zipper list
+
+type to_update = values
+
+type whd =
+ | Vsort of Sorts.t
+ | Vprod of vprod
+ | Vfun of vfun
+ | Vfix of vfix * arguments option
+ | Vcofix of vcofix * to_update * arguments option
+ | Vconstr_const of int
+ | Vconstr_block of vblock
+ | Vatom_stk of atom * stack
+ | Vuniv_level of Univ.Level.t
+
+(* Functions over arguments *)
+let nargs : arguments -> int = fun args -> (Obj.size (Obj.repr args)) - 2
+let arg args i =
+ if 0 <= i && i < (nargs args) then
+ val_of_obj (Obj.field (Obj.repr args) (i+2))
+ else invalid_arg
+ ("Vm.arg size = "^(string_of_int (nargs args))^
+ " acces "^(string_of_int i))
+
+(*************************************************)
+(* Destructors ***********************************)
+(*************************************************)
+
+let uni_lvl_val (v : values) : Univ.Level.t =
+ let whd = Obj.magic v in
+ match whd with
+ | Vuniv_level lvl -> lvl
+ | _ ->
+ let pr =
+ let open Pp in
+ match whd with
+ | Vsort _ -> str "Vsort"
+ | Vprod _ -> str "Vprod"
+ | Vfun _ -> str "Vfun"
+ | Vfix _ -> str "Vfix"
+ | Vcofix _ -> str "Vcofix"
+ | Vconstr_const i -> str "Vconstr_const"
+ | Vconstr_block b -> str "Vconstr_block"
+ | Vatom_stk (a,stk) -> str "Vatom_stk"
+ | _ -> assert false
+ in
+ CErrors.anomaly
+ Pp.( strbrk "Parsing virtual machine value expected universe level, got "
+ ++ pr ++ str ".")
+
+let rec whd_accu a stk =
+ let stk =
+ if Int.equal (Obj.size a) 2 then stk
+ else Zapp (Obj.obj a) :: stk in
+ let at = Obj.field a 1 in
+ match Obj.tag at with
+ | i when Int.equal i type_atom_tag ->
+ begin match stk with
+ | [Zapp args] ->
+ let u = ref (Obj.obj (Obj.field at 0)) in
+ for i = 0 to nargs args - 1 do
+ u := Univ.Universe.sup !u (Univ.Universe.make (uni_lvl_val (arg args i)))
+ done;
+ Vsort (Type !u)
+ | _ -> assert false
+ end
+ | i when i <= max_atom_tag ->
+ Vatom_stk(Obj.magic at, stk)
+ | i when Int.equal i proj_tag ->
+ let zproj = Zproj (Obj.obj (Obj.field at 0)) in
+ whd_accu (Obj.field at 1) (zproj :: stk)
+ | i when Int.equal i fix_app_tag ->
+ let fa = Obj.field at 1 in
+ let zfix =
+ Zfix (Obj.obj (Obj.field fa 1), Obj.obj fa) in
+ whd_accu (Obj.field at 0) (zfix :: stk)
+ | i when Int.equal i switch_tag ->
+ let zswitch = Zswitch (Obj.obj (Obj.field at 1)) in
+ whd_accu (Obj.field at 0) (zswitch :: stk)
+ | i when Int.equal i cofix_tag ->
+ let vcfx = Obj.obj (Obj.field at 0) in
+ let to_up = Obj.obj a in
+ begin match stk with
+ | [] -> Vcofix(vcfx, to_up, None)
+ | [Zapp args] -> Vcofix(vcfx, to_up, Some args)
+ | _ -> assert false
+ end
+ | i when Int.equal i cofix_evaluated_tag ->
+ let vcofix = Obj.obj (Obj.field at 0) in
+ let res = Obj.obj a in
+ begin match stk with
+ | [] -> Vcofix(vcofix, res, None)
+ | [Zapp args] -> Vcofix(vcofix, res, Some args)
+ | _ -> assert false
+ end
+ | tg ->
+ CErrors.anomaly
+ Pp.(strbrk "Failed to parse VM value. Tag = " ++ int tg ++ str ".")
+
+external kind_of_closure : Obj.t -> int = "coq_kind_of_closure"
+external is_accumulate : tcode -> bool = "coq_is_accumulate_code"
+external int_tcode : tcode -> int -> int = "coq_int_tcode"
+external accumulate : unit -> tcode = "accumulate_code"
+let accumulate = accumulate ()
+
+let whd_val : values -> whd =
+ fun v ->
+ let o = Obj.repr v in
+ if Obj.is_int o then Vconstr_const (Obj.obj o)
+ else
+ let tag = Obj.tag o in
+ if tag = accu_tag then
+ (
+ if Int.equal (Obj.size o) 1 then Obj.obj o (* sort *)
+ else
+ if is_accumulate (fun_code o) then whd_accu o []
+ else Vprod(Obj.obj o))
+ else
+ if tag = Obj.closure_tag || tag = Obj.infix_tag then
+ (match kind_of_closure o with
+ | 0 -> Vfun(Obj.obj o)
+ | 1 -> Vfix(Obj.obj o, None)
+ | 2 -> Vfix(Obj.obj (Obj.field o 1), Some (Obj.obj o))
+ | 3 -> Vatom_stk(Aid(RelKey(int_tcode (fun_code o) 1)), [])
+ | _ -> CErrors.anomaly ~label:"Vm.whd " (Pp.str "kind_of_closure does not work."))
+ else
+ Vconstr_block(Obj.obj o)
+
+(**********************************************)
+(* Constructors *******************************)
+(**********************************************)
+
+let obj_of_atom : atom -> Obj.t =
+ fun a ->
+ let res = Obj.new_block accu_tag 2 in
+ Obj.set_field res 0 (Obj.repr accumulate);
+ Obj.set_field res 1 (Obj.repr a);
+ res
+
+(* obj_of_str_const : structured_constant -> Obj.t *)
+let rec obj_of_str_const str =
+ match str with
+ | Const_sorts s -> Obj.repr (Vsort s)
+ | Const_ind ind -> obj_of_atom (Aind ind)
+ | Const_proj p -> Obj.repr p
+ | Const_b0 tag -> Obj.repr tag
+ | Const_bn(tag, args) ->
+ let len = Array.length args in
+ let res = Obj.new_block tag len in
+ for i = 0 to len - 1 do
+ Obj.set_field res i (obj_of_str_const args.(i))
+ done;
+ res
+ | Const_univ_level l -> Obj.repr (Vuniv_level l)
+ | Const_type u -> obj_of_atom (Atype u)
+
+let val_of_obj o = ((Obj.obj o) : values)
+
+let val_of_str_const str = val_of_obj (obj_of_str_const str)
+
+let val_of_atom a = val_of_obj (obj_of_atom a)
+
+let atom_of_proj kn v =
+ let r = Obj.new_block proj_tag 2 in
+ Obj.set_field r 0 (Obj.repr kn);
+ Obj.set_field r 1 (Obj.repr v);
+ ((Obj.obj r) : atom)
+
+let val_of_proj kn v =
+ val_of_atom (atom_of_proj kn v)
+
+module IdKeyHash =
+struct
+ type t = Constant.t tableKey
+ let equal = Names.eq_table_key Constant.equal
+ open Hashset.Combine
+ let hash = function
+ | ConstKey c -> combinesmall 1 (Constant.hash c)
+ | VarKey id -> combinesmall 2 (Id.hash id)
+ | RelKey i -> combinesmall 3 (Int.hash i)
+end
+
+module KeyTable = Hashtbl.Make(IdKeyHash)
+
+let idkey_tbl = KeyTable.create 31
+
+let val_of_idkey key =
+ try KeyTable.find idkey_tbl key
+ with Not_found ->
+ let v = val_of_atom (Aid key) in
+ KeyTable.add idkey_tbl key v;
+ v
+
+let val_of_rel k = val_of_idkey (RelKey k)
+
+let val_of_named id = val_of_idkey (VarKey id)
+
+let val_of_constant c = val_of_idkey (ConstKey c)
+
+external val_of_annot_switch : annot_switch -> values = "%identity"
+
+(*************************************************)
+(** Operations manipulating data types ***********)
+(*************************************************)
+
+(* Functions over products *)
+
+let dom : vprod -> values = fun p -> val_of_obj (Obj.field (Obj.repr p) 0)
+let codom : vprod -> vfun = fun p -> (Obj.obj (Obj.field (Obj.repr p) 1))
+
+(* Functions over vfun *)
+
+external closure_arity : vfun -> int = "coq_closure_arity"
+
+(* Functions over fixpoint *)
+
+external offset : Obj.t -> int = "coq_offset"
+external offset_closure : Obj.t -> int -> Obj.t = "coq_offset_closure"
+external offset_closure_fix : vfix -> int -> vm_env = "coq_offset_closure"
+
+let first o = (offset_closure o (offset o))
+let first_fix (v:vfix) = (Obj.magic (first (Obj.repr v)) : vfix)
+
+let last o = (Obj.field o (Obj.size o - 1))
+let fix_types (v:vfix) = (Obj.magic (last (Obj.repr v)) : tcode array)
+let cofix_types (v:vcofix) = (Obj.magic (last (Obj.repr v)) : tcode array)
+
+let current_fix vf = - (offset (Obj.repr vf) / 2)
+
+let unsafe_fb_code fb i = tcode_of_obj (Obj.field (Obj.repr fb) (2 * i))
+
+let unsafe_rec_arg fb i = int_tcode (unsafe_fb_code fb i) 1
+
+let rec_args vf =
+ let fb = first (Obj.repr vf) in
+ let size = Obj.size (last fb) in
+ Array.init size (unsafe_rec_arg fb)
+
+exception FALSE
+
+let check_fix f1 f2 =
+ let i1, i2 = current_fix f1, current_fix f2 in
+ (* Checking starting point *)
+ if i1 = i2 then
+ let fb1,fb2 = first (Obj.repr f1), first (Obj.repr f2) in
+ let n = Obj.size (last fb1) in
+ (* Checking number of definitions *)
+ if n = Obj.size (last fb2) then
+ (* Checking recursive arguments *)
+ try
+ for i = 0 to n - 1 do
+ if unsafe_rec_arg fb1 i <> unsafe_rec_arg fb2 i
+ then raise FALSE
+ done;
+ true
+ with FALSE -> false
+ else false
+ else false
+
+external atom_rel : unit -> atom array = "get_coq_atom_tbl"
+external realloc_atom_rel : int -> unit = "realloc_coq_atom_tbl"
+
+let relaccu_tbl =
+ let atom_rel = atom_rel() in
+ let len = Array.length atom_rel in
+ for i = 0 to len - 1 do atom_rel.(i) <- Aid (RelKey i) done;
+ ref (Array.init len mkAccuCode)
+
+let relaccu_code i =
+ let len = Array.length !relaccu_tbl in
+ if i < len then !relaccu_tbl.(i)
+ else
+ begin
+ realloc_atom_rel i;
+ let atom_rel = atom_rel () in
+ let nl = Array.length atom_rel in
+ for j = len to nl - 1 do atom_rel.(j) <- Aid(RelKey j) done;
+ relaccu_tbl :=
+ Array.init nl
+ (fun j -> if j < len then !relaccu_tbl.(j) else mkAccuCode j);
+ !relaccu_tbl.(i)
+ end
+
+let mk_fix_body k ndef fb =
+ let e = Obj.dup (Obj.repr fb) in
+ for i = 0 to ndef - 1 do
+ Obj.set_field e (2 * i) (Obj.repr (relaccu_code (k + i)))
+ done;
+ let fix_body i =
+ let jump_grabrec c = offset_tcode c 2 in
+ let c = jump_grabrec (unsafe_fb_code fb i) in
+ let res = Obj.new_block Obj.closure_tag 2 in
+ Obj.set_field res 0 (Obj.repr c);
+ Obj.set_field res 1 (offset_closure e (2*i));
+ ((Obj.obj res) : vfun) in
+ Array.init ndef fix_body
+
+(* Functions over vcofix *)
+
+let get_fcofix vcf i =
+ match whd_val (Obj.obj (Obj.field (Obj.repr vcf) (i+1))) with
+ | Vcofix(vcfi, _, _) -> vcfi
+ | _ -> assert false
+
+let current_cofix vcf =
+ let ndef = Obj.size (last (Obj.repr vcf)) in
+ let rec find_cofix pos =
+ if pos < ndef then
+ if get_fcofix vcf pos == vcf then pos
+ else find_cofix (pos+1)
+ else raise Not_found in
+ try find_cofix 0
+ with Not_found -> assert false
+
+let check_cofix vcf1 vcf2 =
+ (current_cofix vcf1 = current_cofix vcf2) &&
+ (Obj.size (last (Obj.repr vcf1)) = Obj.size (last (Obj.repr vcf2)))
+
+let mk_cofix_body apply_varray k ndef vcf =
+ let e = Obj.dup (Obj.repr vcf) in
+ for i = 0 to ndef - 1 do
+ Obj.set_field e (i+1) (Obj.repr (val_of_rel (k+i)))
+ done;
+
+ let cofix_body i =
+ let vcfi = get_fcofix vcf i in
+ let c = Obj.field (Obj.repr vcfi) 0 in
+ Obj.set_field e 0 c;
+ let atom = Obj.new_block cofix_tag 1 in
+ let self = Obj.new_block accu_tag 2 in
+ Obj.set_field self 0 (Obj.repr accumulate);
+ Obj.set_field self 1 (Obj.repr atom);
+ apply_varray (Obj.obj e) [|Obj.obj self|] in
+ Array.init ndef cofix_body
+
+(* Functions over vblock *)
+
+let btag : vblock -> int = fun b -> Obj.tag (Obj.repr b)
+let bsize : vblock -> int = fun b -> Obj.size (Obj.repr b)
+let bfield b i =
+ if 0 <= i && i < (bsize b) then val_of_obj (Obj.field (Obj.repr b) i)
+ else invalid_arg "Vm.bfield"
+
+
+(* Functions over vswitch *)
+
+let check_switch sw1 sw2 = sw1.sw_annot.rtbl = sw2.sw_annot.rtbl
+
+let branch_arg k (tag,arity) =
+ if Int.equal arity 0 then ((Obj.magic tag):values)
+ else
+ let b, ofs =
+ if tag < last_variant_tag then Obj.new_block tag arity, 0
+ else
+ let b = Obj.new_block last_variant_tag (arity+1) in
+ Obj.set_field b 0 (Obj.repr (tag-last_variant_tag));
+ b,1 in
+ for i = ofs to ofs + arity - 1 do
+ Obj.set_field b i (Obj.repr (val_of_rel (k+i)))
+ done;
+ val_of_obj b
+
+(* Printing *)
+
+let rec pr_atom a =
+ Pp.(match a with
+ | Aid c -> str "Aid(" ++ (match c with
+ | ConstKey c -> Constant.print c
+ | RelKey i -> str "#" ++ int i
+ | _ -> str "...") ++ str ")"
+ | Aind (mi,i) -> str "Aind(" ++ MutInd.print mi ++ str "#" ++ int i ++ str ")"
+ | Atype _ -> str "Atype(")
+and pr_whd w =
+ Pp.(match w with
+ | Vsort _ -> str "Vsort"
+ | Vprod _ -> str "Vprod"
+ | Vfun _ -> str "Vfun"
+ | Vfix _ -> str "Vfix"
+ | Vcofix _ -> str "Vcofix"
+ | Vconstr_const i -> str "Vconstr_const(" ++ int i ++ str ")"
+ | Vconstr_block b -> str "Vconstr_block"
+ | Vatom_stk (a,stk) -> str "Vatom_stk(" ++ pr_atom a ++ str ", " ++ pr_stack stk ++ str ")"
+ | Vuniv_level _ -> assert false)
+and pr_stack stk =
+ Pp.(match stk with
+ | [] -> str "[]"
+ | s :: stk -> pr_zipper s ++ str " :: " ++ pr_stack stk)
+and pr_zipper z =
+ Pp.(match z with
+ | Zapp args -> str "Zapp(len = " ++ int (nargs args) ++ str ")"
+ | Zfix (f,args) -> str "Zfix(..., len=" ++ int (nargs args) ++ str ")"
+ | Zswitch s -> str "Zswitch(...)"
+ | Zproj c -> str "Zproj(" ++ Constant.print c ++ str ")")
diff --git a/kernel/vmvalues.mli b/kernel/vmvalues.mli
new file mode 100644
index 000000000..350f71372
--- /dev/null
+++ b/kernel/vmvalues.mli
@@ -0,0 +1,144 @@
+(************************************************************************)
+(* v * The Coq Proof Assistant / The Coq Development Team *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(************************************************************************)
+
+open Names
+open Cbytecodes
+
+(** Values *)
+
+type values
+type vm_env
+type vprod
+type vfun
+type vfix
+type vcofix
+type vblock
+type arguments
+type vstack = values array
+type to_update
+
+val fun_val : vfun -> values
+val fix_val : vfix -> values
+val cofix_upd_val : to_update -> values
+
+val fun_env : vfun -> vm_env
+val fix_env : vfix -> vm_env
+val cofix_env : vcofix -> vm_env
+val cofix_upd_env : to_update -> vm_env
+
+(** Cast a value known to be a function, unsafe in general *)
+val fun_of_val : values -> vfun
+
+val crazy_val : values
+
+(** Machine code *)
+
+type tcode
+
+type vswitch = {
+ sw_type_code : tcode;
+ sw_code : tcode;
+ sw_annot : annot_switch;
+ sw_stk : vstack;
+ sw_env : vm_env
+ }
+
+external mkAccuCode : int -> tcode = "coq_makeaccu"
+
+val fun_code : vfun -> tcode
+val fix_code : vfix -> tcode
+val cofix_upd_code : to_update -> tcode
+
+type atom =
+ | Aid of Vars.id_key
+ | Aind of inductive
+ | Atype of Univ.Universe.t
+
+(** Zippers *)
+
+type zipper =
+ | Zapp of arguments
+ | Zfix of vfix * arguments (** might be empty *)
+ | Zswitch of vswitch
+ | Zproj of Constant.t (* name of the projection *)
+
+type stack = zipper list
+
+type whd =
+ | Vsort of Sorts.t
+ | Vprod of vprod
+ | Vfun of vfun
+ | Vfix of vfix * arguments option
+ | Vcofix of vcofix * to_update * arguments option
+ | Vconstr_const of int
+ | Vconstr_block of vblock
+ | Vatom_stk of atom * stack
+ | Vuniv_level of Univ.Level.t
+
+(** For debugging purposes only *)
+
+val pr_atom : atom -> Pp.t
+val pr_whd : whd -> Pp.t
+val pr_stack : stack -> Pp.t
+
+(** Constructors *)
+
+val val_of_str_const : structured_constant -> values
+val val_of_rel : int -> values
+val val_of_named : Id.t -> values
+val val_of_constant : Constant.t -> values
+val val_of_proj : Constant.t -> values -> values
+val val_of_atom : atom -> values
+
+external val_of_annot_switch : annot_switch -> values = "%identity"
+
+(** Destructors *)
+
+val whd_val : values -> whd
+val uni_lvl_val : values -> Univ.Level.t
+
+(** Arguments *)
+
+val nargs : arguments -> int
+val arg : arguments -> int -> values
+
+(** Product *)
+
+val dom : vprod -> values
+val codom : vprod -> vfun
+
+(** Fun *)
+external closure_arity : vfun -> int = "coq_closure_arity"
+
+(** Fix *)
+
+val current_fix : vfix -> int
+val check_fix : vfix -> vfix -> bool
+val rec_args : vfix -> int array
+val first_fix : vfix -> vfix
+val fix_types : vfix -> tcode array
+val cofix_types : vcofix -> tcode array
+external offset_closure_fix : vfix -> int -> vm_env = "coq_offset_closure"
+val mk_fix_body : int -> int -> vfix -> vfun array
+
+(** CoFix *)
+
+val current_cofix : vcofix -> int
+val check_cofix : vcofix -> vcofix -> bool
+val mk_cofix_body : (vfun -> vstack -> values) -> int -> int -> vcofix -> values array
+
+(** Block *)
+
+val btag : vblock -> int
+val bsize : vblock -> int
+val bfield : vblock -> int -> values
+
+(** Switch *)
+
+val check_switch : vswitch -> vswitch -> bool
+val branch_arg : int -> Cbytecodes.tag * int -> values
diff --git a/lib/cErrors.ml b/lib/cErrors.ml
index 94357aad3..eaffc28ac 100644
--- a/lib/cErrors.ml
+++ b/lib/cErrors.ml
@@ -91,7 +91,7 @@ let print_backtrace e = match Backtrace.get_backtrace e with
let print_anomaly askreport e =
if askreport then
- hov 0 (str "Anomaly" ++ spc () ++ quote (raw_anomaly e) ++ spc ()) ++
+ hov 0 (str "Anomaly" ++ spc () ++ quote (raw_anomaly e)) ++ spc () ++
hov 0 (str "Please report at " ++ str Coq_config.wwwbugtracker ++ str ".")
else
hov 0 (raw_anomaly e)
diff --git a/lib/profile.ml b/lib/cProfile.ml
index 0bc226a45..0bc226a45 100644
--- a/lib/profile.ml
+++ b/lib/cProfile.ml
diff --git a/lib/profile.mli b/lib/cProfile.mli
index cae4397a1..cae4397a1 100644
--- a/lib/profile.mli
+++ b/lib/cProfile.mli
diff --git a/lib/control.ml b/lib/control.ml
index f5d7df204..c6489938e 100644
--- a/lib/control.ml
+++ b/lib/control.ml
@@ -12,21 +12,18 @@ let interrupt = ref false
let steps = ref 0
-let are_we_threading = lazy (
- match !Flags.async_proofs_mode with
- | Flags.APon -> true
- | _ -> false)
+let enable_thread_delay = ref false
let check_for_interrupt () =
if !interrupt then begin interrupt := false; raise Sys.Break end;
incr steps;
- if !steps = 1000 && Lazy.force are_we_threading then begin
+ if !enable_thread_delay && !steps = 1000 then begin
Thread.delay 0.001;
steps := 0;
end
(** This function does not work on windows, sigh... *)
-let unix_timeout n f e =
+let unix_timeout n f x e =
let timeout_handler _ = raise e in
let psh = Sys.signal Sys.sigalrm (Sys.Signal_handle timeout_handler) in
let _ = Unix.alarm n in
@@ -35,7 +32,7 @@ let unix_timeout n f e =
Sys.set_signal Sys.sigalrm psh
in
try
- let res = f () in
+ let res = f x in
restore_timeout ();
res
with e ->
@@ -43,7 +40,7 @@ let unix_timeout n f e =
restore_timeout ();
Exninfo.iraise e
-let windows_timeout n f e =
+let windows_timeout n f x e =
let killed = ref false in
let exited = ref false in
let thread init =
@@ -60,7 +57,7 @@ let windows_timeout n f e =
let init = Unix.gettimeofday () in
let _id = Thread.create thread init in
try
- let res = f () in
+ let res = f x in
let () = killed := true in
let cur = Unix.gettimeofday () in
(** The thread did not interrupt, but the computation took longer than
@@ -80,12 +77,10 @@ let windows_timeout n f e =
let e = Backtrace.add_backtrace e in
Exninfo.iraise e
-type timeout = { timeout : 'a. int -> (unit -> 'a) -> exn -> 'a }
+type timeout = { timeout : 'a 'b. int -> ('a -> 'b) -> 'a -> exn -> 'b }
let timeout_fun = match Sys.os_type with
-| "Unix" | "Cygwin" -> ref { timeout = unix_timeout }
-| _ -> ref { timeout = windows_timeout }
+| "Unix" | "Cygwin" -> { timeout = unix_timeout }
+| _ -> { timeout = windows_timeout }
-let set_timeout f = timeout_fun := f
-
-let timeout n f e = !timeout_fun.timeout n f e
+let timeout n f e = timeout_fun.timeout n f e
diff --git a/lib/control.mli b/lib/control.mli
index 337cdf67b..261b07693 100644
--- a/lib/control.mli
+++ b/lib/control.mli
@@ -8,6 +8,9 @@
(** Global control of Coq. *)
+(** Will periodically call [Thread.delay] if set to true *)
+val enable_thread_delay : bool ref
+
val interrupt : bool ref
(** Coq interruption: set the following boolean reference to interrupt Coq
(it eventually raises [Break], simulating a Ctrl-C) *)
@@ -16,11 +19,6 @@ val check_for_interrupt : unit -> unit
(** Use this function as a potential yield function. If {!interrupt} has been
set, il will raise [Sys.Break]. *)
-val timeout : int -> (unit -> 'a) -> exn -> 'a
-(** [timeout n f e] tries to compute [f], and if it fails to do so before [n]
- seconds, it raises [e] instead. *)
-
-type timeout = { timeout : 'a. int -> (unit -> 'a) -> exn -> 'a }
-
-val set_timeout : timeout -> unit
-(** Set a particular timeout function. *)
+val timeout : int -> ('a -> 'b) -> 'a -> exn -> 'b
+(** [timeout n f x e] tries to compute [f x], and if it fails to do so
+ before [n] seconds, it raises [e] instead. *)
diff --git a/lib/coqProject_file.ml4 b/lib/coqProject_file.ml4
index 970666638..1e52af0be 100644
--- a/lib/coqProject_file.ml4
+++ b/lib/coqProject_file.ml4
@@ -11,7 +11,6 @@ type project = {
makefile : string option;
install_kind : install option;
use_ocamlopt : bool;
- bypass_API : bool;
v_files : string list;
mli_files : string list;
@@ -43,12 +42,11 @@ and install =
| UserInstall
(* TODO generate with PPX *)
-let mk_project project_file makefile install_kind use_ocamlopt bypass_API = {
+let mk_project project_file makefile install_kind use_ocamlopt = {
project_file;
makefile;
install_kind;
use_ocamlopt;
- bypass_API;
v_files = [];
mli_files = [];
@@ -113,6 +111,7 @@ let exists_dir dir =
let process_cmd_line orig_dir proj args =
+ let parsing_project_file = ref (proj.project_file <> None) in
let orig_dir = (* avoids turning foo.v in ./foo.v *)
if orig_dir = "." then "" else orig_dir in
let error s = Feedback.msg_error (Pp.str (s^".")); exit 1 in
@@ -155,16 +154,22 @@ let process_cmd_line orig_dir proj args =
aux { proj with r_includes = proj.r_includes @ [mk_path d,lp] } r
| "-f" :: file :: r ->
+ if !parsing_project_file then
+ raise (Parsing_error ("Invalid option -f in project file " ^ Option.get proj.project_file));
let file = CUnix.remove_path_dot (CUnix.correct_path file orig_dir) in
let () = match proj.project_file with
| None -> ()
| Some _ -> Feedback.msg_warning (Pp.str
"Multiple project files are deprecated.")
in
+ parsing_project_file := true;
let proj = aux { proj with project_file = Some file } (parse file) in
+ parsing_project_file := false;
aux proj r
| "-o" :: file :: r ->
+ if !parsing_project_file then
+ raise (Parsing_error ("Invalid option -o in project file " ^ Option.get proj.project_file));
if String.contains file '/' then
error "Output file must be in the current directory";
if proj.makefile <> None then
@@ -174,8 +179,6 @@ let process_cmd_line orig_dir proj args =
aux { proj with defs = proj.defs @ [v,def] } r
| "-arg" :: a :: r ->
aux { proj with extra_args = proj.extra_args @ [a] } r
- | "-bypass-API" :: r ->
- aux { proj with bypass_API = true } r
| f :: r ->
let f = CUnix.correct_path f orig_dir in
let proj =
@@ -195,11 +198,11 @@ let process_cmd_line orig_dir proj args =
(******************************* API ************************************)
let cmdline_args_to_project ~curdir args =
- process_cmd_line curdir (mk_project None None None true false) args
+ process_cmd_line curdir (mk_project None None None true) args
let read_project_file f =
process_cmd_line (Filename.dirname f)
- (mk_project (Some f) None (Some NoInstall) true false) (parse f)
+ (mk_project (Some f) None (Some NoInstall) true) (parse f)
let rec find_project_file ~from ~projfile_name =
let fname = Filename.concat from projfile_name in
diff --git a/lib/coqProject_file.mli b/lib/coqProject_file.mli
index 23a27a54a..810189450 100644
--- a/lib/coqProject_file.mli
+++ b/lib/coqProject_file.mli
@@ -13,7 +13,6 @@ type project = {
makefile : string option;
install_kind : install option;
use_ocamlopt : bool;
- bypass_API : bool;
v_files : string list;
mli_files : string list;
diff --git a/lib/envars.ml b/lib/envars.ml
index 206d75033..8ebf84057 100644
--- a/lib/envars.ml
+++ b/lib/envars.ml
@@ -153,19 +153,17 @@ let coqpath =
let exe s = s ^ Coq_config.exec_extension
-let ocamlfind () =
- if !Flags.ocamlfind_spec then !Flags.ocamlfind else Coq_config.ocamlfind
+let ocamlfind () = Coq_config.ocamlfind
(** {2 Camlp4 paths} *)
let guess_camlp4bin () = which (user_path ()) (exe Coq_config.camlp4)
let camlp4bin () =
- if !Flags.camlp4bin_spec then !Flags.camlp4bin else
- if !Flags.boot then Coq_config.camlp4bin else
- try guess_camlp4bin ()
- with Not_found ->
- Coq_config.camlp4bin
+ if !Flags.boot then Coq_config.camlp4bin else
+ try guess_camlp4bin ()
+ with Not_found ->
+ Coq_config.camlp4bin
let camlp4 () = camlp4bin () / exe Coq_config.camlp4
diff --git a/lib/flags.ml b/lib/flags.ml
index 323b5492d..01361dad5 100644
--- a/lib/flags.ml
+++ b/lib/flags.ml
@@ -6,13 +6,27 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-let with_option o f x =
- let old = !o in o:=true;
- try let r = f x in if !o = true then o := old; r
- with reraise ->
- let reraise = Backtrace.add_backtrace reraise in
- let () = o := old in
- Exninfo.iraise reraise
+(* If [restore] is false, whenever [f] modifies the ref, we will
+ preserve the modification. *)
+let with_modified_ref ?(restore=true) r nf f x =
+ let old_ref = !r in r := nf !r;
+ try
+ let pre = !r in
+ let res = f x in
+ (* If r was modified don't restore its old value *)
+ if restore || pre == !r then r := old_ref;
+ res
+ with reraise ->
+ let reraise = Backtrace.add_backtrace reraise in
+ r := old_ref;
+ Exninfo.iraise reraise
+
+let with_option o f x = with_modified_ref ~restore:false o (fun _ -> true) f x
+let without_option o f x = with_modified_ref ~restore:false o (fun _ -> false) f x
+let with_extra_values o l f x = with_modified_ref o (fun ol -> ol@l) f x
+
+(* hide the [restore] option as internal *)
+let with_modified_ref r nf f x = with_modified_ref r nf f x
let with_options ol f x =
let vl = List.map (!) ol in
@@ -25,58 +39,16 @@ let with_options ol f x =
let () = List.iter2 (:=) ol vl in
Exninfo.iraise reraise
-let without_option o f x =
- let old = !o in o:=false;
- try let r = f x in if !o = false then o := old; r
- with reraise ->
- let reraise = Backtrace.add_backtrace reraise in
- let () = o := old in
- Exninfo.iraise reraise
-
-let with_extra_values o l f x =
- let old = !o in o:=old@l;
- try let r = f x in o := old; r
- with reraise ->
- let reraise = Backtrace.add_backtrace reraise in
- let () = o := old in
- Exninfo.iraise reraise
-
let boot = ref false
let record_aux_file = ref false
let test_mode = ref false
-type async_proofs = APoff | APonLazy | APon
-let async_proofs_mode = ref APoff
-type cache = Force
-let async_proofs_cache = ref None
-let async_proofs_n_workers = ref 1
-let async_proofs_n_tacworkers = ref 2
-let async_proofs_private_flags = ref None
-let async_proofs_full = ref false
-let async_proofs_never_reopen_branch = ref false
-let async_proofs_flags_for_workers = ref []
let async_proofs_worker_id = ref "master"
-type priority = Low | High
-let async_proofs_worker_priority = ref Low
-let string_of_priority = function Low -> "low" | High -> "high"
-let priority_of_string = function
- | "low" -> Low
- | "high" -> High
- | _ -> raise (Invalid_argument "priority_of_string")
-type tac_error_filter = [ `None | `Only of string list | `All ]
-let async_proofs_tac_error_resilience = ref (`Only [ "curly" ])
-let async_proofs_cmd_error_resilience = ref true
-
-let async_proofs_is_worker () =
- !async_proofs_worker_id <> "master"
-let async_proofs_is_master () =
- !async_proofs_mode = APon && !async_proofs_worker_id = "master"
-let async_proofs_delegation_threshold = ref 0.03
+let async_proofs_is_worker () = !async_proofs_worker_id <> "master"
let debug = ref false
-let stm_debug = ref false
let in_debugger = ref false
let in_toplevel = ref false
@@ -86,8 +58,6 @@ let profile = false
let ide_slave = ref false
let ideslave_coqtop_flags = ref None
-let time = ref false
-
let raw_print = ref false
let univ_print = ref false
@@ -148,14 +118,6 @@ let universe_polymorphism = ref false
let make_universe_polymorphism b = universe_polymorphism := b
let is_universe_polymorphism () = !universe_polymorphism
-let local_polymorphic_flag = ref None
-let use_polymorphic_flag () =
- match !local_polymorphic_flag with
- | Some p -> local_polymorphic_flag := None; p
- | None -> is_universe_polymorphism ()
-let make_polymorphic_flag b =
- local_polymorphic_flag := Some b
-
let polymorphic_inductive_cumulativity = ref false
let make_polymorphic_inductive_cumulativity b = polymorphic_inductive_cumulativity := b
let is_polymorphic_inductive_cumulativity () = !polymorphic_inductive_cumulativity
@@ -191,14 +153,6 @@ let is_standard_doc_url url =
let coqlib_spec = ref false
let coqlib = ref "(not initialized yet)"
-(* Options for changing ocamlfind (used by coqmktop) *)
-let ocamlfind_spec = ref false
-let ocamlfind = ref Coq_config.camlbin
-
-(* Options for changing camlp4bin (used by coqmktop) *)
-let camlp4bin_spec = ref false
-let camlp4bin = ref Coq_config.camlp4bin
-
(* Level of inlining during a functor application *)
let default_inline_level = 100
@@ -207,12 +161,11 @@ let set_inline_level = (:=) inline_level
let get_inline_level () = !inline_level
(* Native code compilation for conversion and normalization *)
-let native_compiler = ref false
+let output_native_objects = ref false
(* Print the mod uid associated to a vo file by the native compiler *)
let print_mod_uid = ref false
-let tactic_context_compat = ref false
let profile_ltac = ref false
let profile_ltac_cutoff = ref 2.0
diff --git a/lib/flags.mli b/lib/flags.mli
index 0ff3e0a81..33d281798 100644
--- a/lib/flags.mli
+++ b/lib/flags.mli
@@ -21,44 +21,20 @@ val record_aux_file : bool ref
val test_mode : bool ref
(** Async-related flags *)
-type async_proofs = APoff | APonLazy | APon
-val async_proofs_mode : async_proofs ref
-type cache = Force
-val async_proofs_cache : cache option ref
-val async_proofs_n_workers : int ref
-val async_proofs_n_tacworkers : int ref
-val async_proofs_private_flags : string option ref
-val async_proofs_is_worker : unit -> bool
-val async_proofs_is_master : unit -> bool
-val async_proofs_full : bool ref
-val async_proofs_never_reopen_branch : bool ref
-val async_proofs_flags_for_workers : string list ref
val async_proofs_worker_id : string ref
-type priority = Low | High
-val async_proofs_worker_priority : priority ref
-val string_of_priority : priority -> string
-val priority_of_string : string -> priority
-type tac_error_filter = [ `None | `Only of string list | `All ]
-val async_proofs_tac_error_resilience : tac_error_filter ref
-val async_proofs_cmd_error_resilience : bool ref
-val async_proofs_delegation_threshold : float ref
+val async_proofs_is_worker : unit -> bool
+(** Debug flags *)
val debug : bool ref
val in_debugger : bool ref
val in_toplevel : bool ref
-(** Enable STM debugging *)
-val stm_debug : bool ref
-
val profile : bool
(* -ide_slave: printing will be more verbose, will affect stm caching *)
val ide_slave : bool ref
val ideslave_coqtop_flags : string option ref
-(* -time option: every command will be wrapped with `Time` *)
-val time : bool ref
-
(* development flag to detect race conditions, it should go away. *)
val we_are_parsing : bool ref
@@ -98,10 +74,6 @@ val is_program_mode : unit -> bool
val make_universe_polymorphism : bool -> unit
val is_universe_polymorphism : unit -> bool
-(** Local universe polymorphism flag. *)
-val make_polymorphic_flag : bool -> unit
-val use_polymorphic_flag : unit -> bool
-
(** Global polymorphic inductive cumulativity flag. *)
val make_polymorphic_inductive_cumulativity : bool -> unit
val is_polymorphic_inductive_cumulativity : unit -> bool
@@ -110,6 +82,15 @@ val warn : bool ref
val make_warn : bool -> unit
val if_warn : ('a -> unit) -> 'a -> unit
+(** [with_modified_ref r nf f x] Temporarily modify a reference in the
+ call to [f x] . Be very careful with these functions, it is very
+ easy to fall in the typical problem with effects:
+
+ with_modified_ref r nf f x y != with_modified_ref r nf (f x) y
+
+*)
+val with_modified_ref : 'c ref -> ('c -> 'c) -> ('a -> 'b) -> 'a -> 'b
+
(** Temporarily activate an option (to activate option [o] on [f x y z],
use [with_option o (f x y) z]) *)
val with_option : bool ref -> ('a -> 'b) -> 'a -> 'b
@@ -134,27 +115,17 @@ val is_standard_doc_url : string -> bool
val coqlib_spec : bool ref
val coqlib : string ref
-(** Options for specifying where OCaml binaries reside *)
-val ocamlfind_spec : bool ref
-val ocamlfind : string ref
-val camlp4bin_spec : bool ref
-val camlp4bin : string ref
-
(** Level of inlining during a functor application *)
val set_inline_level : int -> unit
val get_inline_level : unit -> int
val default_inline_level : int
-(** Native code compilation for conversion and normalization *)
-val native_compiler : bool ref
+(** When producing vo objects, also compile the native-code version *)
+val output_native_objects : bool ref
(** Print the mod uid associated to a vo file by the native compiler *)
val print_mod_uid : bool ref
-val tactic_context_compat : bool ref
-(** Set to [true] to trigger the compatibility bugged context matching (old
- context vs. appcontext) is set. *)
-
val profile_ltac : bool ref
val profile_ltac_cutoff : float ref
diff --git a/lib/lib.mllib b/lib/lib.mllib
index 8791f0741..b2260ba09 100644
--- a/lib/lib.mllib
+++ b/lib/lib.mllib
@@ -1,21 +1,30 @@
+Coq_config
+
+Hook
+Flags
+Control
+Util
+
+Pp
+Stateid
+Loc
+Feedback
CErrors
CWarnings
-Bigint
-Segmenttree
-Unicodetable
-Unicode
-Minisys
+
+Rtree
System
-CThread
-Spawn
-Trie
-Profile
Explore
-Predicate
-Rtree
-Heap
-Unionfind
-Genarg
-CEphemeron
+RTree
+CProfile
Future
+Spawn
+
+CAst
+DAst
+Genarg
+
RemoteCounter
+Aux_file
+Envars
+CoqProject_file
diff --git a/lib/pp.ml b/lib/pp.ml
index c3338688d..770e650cb 100644
--- a/lib/pp.ml
+++ b/lib/pp.ml
@@ -208,6 +208,7 @@ let string_of_ppcmds c =
let pr_comma () = str "," ++ spc ()
let pr_semicolon () = str ";" ++ spc ()
let pr_bar () = str "|" ++ spc ()
+let pr_spcbar () = str " |" ++ spc ()
let pr_arg pr x = spc () ++ pr x
let pr_non_empty_arg pr x = let pp = pr x in if ismt pp then mt () else spc () ++ pr x
let pr_opt pr = function None -> mt () | Some x -> pr_arg pr x
diff --git a/lib/pp.mli b/lib/pp.mli
index 2d11cad86..d9be1c5ce 100644
--- a/lib/pp.mli
+++ b/lib/pp.mli
@@ -120,6 +120,9 @@ val pr_semicolon : unit -> t
val pr_bar : unit -> t
(** Well-spaced pipe bar. *)
+val pr_spcbar : unit -> t
+(** Pipe bar with space before and after. *)
+
val pr_arg : ('a -> t) -> 'a -> t
(** Adds a space in front of its argument. *)
diff --git a/lib/system.ml b/lib/system.ml
index 4b5066ef4..e56736eb1 100644
--- a/lib/system.ml
+++ b/lib/system.ml
@@ -294,24 +294,18 @@ let fmt_time_difference (startreal,ustart,sstart) (stopreal,ustop,sstop) =
real (round (sstop -. sstart)) ++ str "s" ++
str ")"
-let with_time time f x =
+let with_time ~batch f x =
let tstart = get_time() in
- let msg = if time then "" else "Finished transaction in " in
+ let msg = if batch then "" else "Finished transaction in " in
try
let y = f x in
let tend = get_time() in
- let msg2 = if time then "" else " (successful)" in
+ let msg2 = if batch then "" else " (successful)" in
Feedback.msg_info (str msg ++ fmt_time_difference tstart tend ++ str msg2);
y
with e ->
let tend = get_time() in
- let msg = if time then "" else "Finished failing transaction in " in
- let msg2 = if time then "" else " (failure)" in
+ let msg = if batch then "" else "Finished failing transaction in " in
+ let msg2 = if batch then "" else " (failure)" in
Feedback.msg_info (str msg ++ fmt_time_difference tstart tend ++ str msg2);
raise e
-
-let process_id () =
- Printf.sprintf "%d:%s:%d" (Unix.getpid ())
- (if Flags.async_proofs_is_worker () then !Flags.async_proofs_worker_id
- else "master")
- (Thread.id (Thread.self ()))
diff --git a/lib/system.mli b/lib/system.mli
index aa964abeb..0c0cc9fae 100644
--- a/lib/system.mli
+++ b/lib/system.mli
@@ -104,7 +104,4 @@ val get_time : unit -> time
val time_difference : time -> time -> float (** in seconds *)
val fmt_time_difference : time -> time -> Pp.t
-val with_time : bool -> ('a -> 'b) -> 'a -> 'b
-
-(** {6 Name of current process.} *)
-val process_id : unit -> string
+val with_time : batch:bool -> ('a -> 'b) -> 'a -> 'b
diff --git a/library/coqlib.ml b/library/coqlib.ml
index 141fff033..4a2390985 100644
--- a/library/coqlib.ml
+++ b/library/coqlib.ml
@@ -14,7 +14,7 @@ open Libnames
open Globnames
open Nametab
-let coq = Nameops.coq_string (* "Coq" *)
+let coq = Libnames.coq_string (* "Coq" *)
(************************************************************************)
(* Generic functions to find Coq objects *)
@@ -32,7 +32,7 @@ let find_reference locstr dir s =
of not found errors here *)
user_err ~hdr:locstr
Pp.(str "cannot find " ++ Libnames.pr_path sp ++
- str "; maybe library " ++ Libnames.pr_dirpath dp ++
+ str "; maybe library " ++ DirPath.print dp ++
str " has to be required first.")
let coq_reference locstr dir s = find_reference locstr (coq::dir) s
@@ -52,14 +52,14 @@ let gen_reference_in_modules locstr dirs s =
| [] ->
anomaly ~label:locstr (str "cannot find " ++ str s ++
str " in module" ++ str (if List.length dirs > 1 then "s " else " ") ++
- prlist_with_sep pr_comma pr_dirpath dirs ++ str ".")
+ prlist_with_sep pr_comma DirPath.print dirs ++ str ".")
| l ->
anomaly ~label:locstr
(str "ambiguous name " ++ str s ++ str " can represent " ++
prlist_with_sep pr_comma
(fun x -> Libnames.pr_path (Nametab.path_of_global x)) l ++
str " in module" ++ str (if List.length dirs > 1 then "s " else " ") ++
- prlist_with_sep pr_comma pr_dirpath dirs ++ str ".")
+ prlist_with_sep pr_comma DirPath.print dirs ++ str ".")
(* For tactics/commands requiring vernacular libraries *)
@@ -79,7 +79,7 @@ let check_required_library d =
*)
(* or failing ...*)
user_err ~hdr:"Coqlib.check_required_library"
- (str "Library " ++ pr_dirpath dir ++ str " has to be required first.")
+ (str "Library " ++ DirPath.print dir ++ str " has to be required first.")
(************************************************************************)
(* Specific Coq objects *)
diff --git a/library/coqlib.mli b/library/coqlib.mli
index b560cabb6..cc22f1635 100644
--- a/library/coqlib.mli
+++ b/library/coqlib.mli
@@ -71,8 +71,8 @@ val jmeq_module_name : string list
val datatypes_module_name : string list
(** Identity *)
-val id : constant
-val type_of_id : constant
+val id : Constant.t
+val type_of_id : Constant.t
(** Natural numbers *)
val nat_path : full_path
diff --git a/library/declaremods.ml b/library/declaremods.ml
index 6d9295bde..41e00a41c 100644
--- a/library/declaremods.ml
+++ b/library/declaremods.ml
@@ -39,7 +39,7 @@ let inl2intopt = function
type algebraic_objects =
| Objs of Lib.lib_objects
- | Ref of module_path * substitution
+ | Ref of ModPath.t * substitution
type substitutive_objects = MBId.t list * algebraic_objects
@@ -62,9 +62,9 @@ type substitutive_objects = MBId.t list * algebraic_objects
module ModSubstObjs :
sig
- val set : module_path -> substitutive_objects -> unit
- val get : module_path -> substitutive_objects
- val set_missing_handler : (module_path -> substitutive_objects) -> unit
+ val set : ModPath.t -> substitutive_objects -> unit
+ val get : ModPath.t -> substitutive_objects
+ val set_missing_handler : (ModPath.t -> substitutive_objects) -> unit
end =
struct
let table =
@@ -126,8 +126,8 @@ type module_objects = object_prefix * Lib.lib_objects * Lib.lib_objects
module ModObjs :
sig
- val set : module_path -> module_objects -> unit
- val get : module_path -> module_objects (* may raise Not_found *)
+ val set : ModPath.t -> module_objects -> unit
+ val get : ModPath.t -> module_objects (* may raise Not_found *)
val all : unit -> module_objects MPmap.t
end =
struct
@@ -143,11 +143,11 @@ module ModObjs :
(** {6 Name management}
Auxiliary functions to transform full_path and kernel_name given
- by Lib into module_path and DirPath.t needed for modules
+ by Lib into ModPath.t and DirPath.t needed for modules
*)
let mp_of_kn kn =
- let mp,sec,l = repr_kn kn in
+ let mp,sec,l = KerName.repr kn in
assert (DirPath.is_empty sec);
MPdot (mp,l)
@@ -167,29 +167,29 @@ let consistency_checks exists dir dirinfo =
try Nametab.locate_dir (qualid_of_dirpath dir)
with Not_found ->
user_err ~hdr:"consistency_checks"
- (pr_dirpath dir ++ str " should already exist!")
+ (DirPath.print dir ++ str " should already exist!")
in
assert (eq_global_dir_reference globref dirinfo)
else
if Nametab.exists_dir dir then
user_err ~hdr:"consistency_checks"
- (pr_dirpath dir ++ str " already exists")
+ (DirPath.print dir ++ str " already exists")
let compute_visibility exists i =
if exists then Nametab.Exactly i else Nametab.Until i
(** Iterate some function [iter_objects] on all components of a module *)
-let do_module exists iter_objects i dir mp sobjs kobjs =
- let prefix = (dir,(mp,DirPath.empty)) in
+let do_module exists iter_objects i obj_dir obj_mp sobjs kobjs =
+ let prefix = { obj_dir ; obj_mp; obj_sec = DirPath.empty } in
let dirinfo = DirModule prefix in
- consistency_checks exists dir dirinfo;
- Nametab.push_dir (compute_visibility exists i) dir dirinfo;
- ModSubstObjs.set mp sobjs;
+ consistency_checks exists obj_dir dirinfo;
+ Nametab.push_dir (compute_visibility exists i) obj_dir dirinfo;
+ ModSubstObjs.set obj_mp sobjs;
(* If we're not a functor, let's iter on the internal components *)
if sobjs_no_functor sobjs then begin
let objs = expand_sobjs sobjs in
- ModObjs.set mp (prefix,objs,kobjs);
+ ModObjs.set obj_mp (prefix,objs,kobjs);
iter_objects (i+1) prefix objs;
iter_objects (i+1) prefix kobjs
end
@@ -222,20 +222,20 @@ let cache_keep _ = anomaly (Pp.str "This module should not be cached!")
let load_keep i ((sp,kn),kobjs) =
(* Invariant : seg isn't empty *)
- let dir = dir_of_sp sp and mp = mp_of_kn kn in
- let prefix = (dir,(mp,DirPath.empty)) in
+ let obj_dir = dir_of_sp sp and obj_mp = mp_of_kn kn in
+ let prefix = { obj_dir ; obj_mp; obj_sec = DirPath.empty } in
let prefix',sobjs,kobjs0 =
- try ModObjs.get mp
+ try ModObjs.get obj_mp
with Not_found -> assert false (* a substobjs should already be loaded *)
in
assert (eq_op prefix' prefix);
assert (List.is_empty kobjs0);
- ModObjs.set mp (prefix,sobjs,kobjs);
+ ModObjs.set obj_mp (prefix,sobjs,kobjs);
Lib.load_objects i prefix kobjs
let open_keep i ((sp,kn),kobjs) =
- let dir = dir_of_sp sp and mp = mp_of_kn kn in
- let prefix = (dir,(mp,DirPath.empty)) in
+ let obj_dir = dir_of_sp sp and obj_mp = mp_of_kn kn in
+ let prefix = { obj_dir; obj_mp; obj_sec = DirPath.empty } in
Lib.open_objects i prefix kobjs
let in_modkeep : Lib.lib_objects -> obj =
@@ -284,9 +284,9 @@ let (in_modtype : substitutive_objects -> obj),
(** {6 Declaration of substitutive objects for Include} *)
let do_include do_load do_open i ((sp,kn),aobjs) =
- let dir = Libnames.dirpath sp in
- let mp = KerName.modpath kn in
- let prefix = (dir,(mp,DirPath.empty)) in
+ let obj_dir = Libnames.dirpath sp in
+ let obj_mp = KerName.modpath kn in
+ let prefix = { obj_dir; obj_mp; obj_sec = DirPath.empty } in
let o = expand_aobjs aobjs in
if do_load then Lib.load_objects i prefix o;
if do_open then Lib.open_objects i prefix o
@@ -336,8 +336,8 @@ let () = ModSubstObjs.set_missing_handler handle_missing_substobjs
(** {6 From module expression to substitutive objects} *)
-(** Turn a chain of [MSEapply] into the head module_path and the
- list of module_path parameters (deepest param coming first).
+(** Turn a chain of [MSEapply] into the head ModPath.t and the
+ list of ModPath.t parameters (deepest param coming first).
The left part of a [MSEapply] must be either [MSEident] or
another [MSEapply]. *)
@@ -577,7 +577,7 @@ let start_module interp_modast export id args res fs =
in
openmod_info := { cur_typ = res_entry_o; cur_typs = subtyps };
let prefix = Lib.start_module export id mp fs in
- Nametab.push_dir (Nametab.Until 1) (fst prefix) (DirOpenModule prefix);
+ Nametab.push_dir (Nametab.Until 1) (prefix.obj_dir) (DirOpenModule prefix);
mp
let end_module () =
@@ -684,7 +684,7 @@ let start_modtype interp_modast id args mtys fs =
let sub_mty_l = build_subtypes interp_modast env mp arg_entries_r mtys in
openmodtype_info := sub_mty_l;
let prefix = Lib.start_modtype id mp fs in
- Nametab.push_dir (Nametab.Until 1) (fst prefix) (DirOpenModtype prefix);
+ Nametab.push_dir (Nametab.Until 1) (prefix.obj_dir) (DirOpenModtype prefix);
mp
let end_modtype () =
@@ -911,7 +911,7 @@ let subst_import (subst,(export,mp as obj)) =
let mp' = subst_mp subst mp in
if mp'==mp then obj else (export,mp')
-let in_import : bool * module_path -> obj =
+let in_import : bool * ModPath.t -> obj =
declare_object {(default_object "IMPORT MODULE") with
cache_function = cache_import;
open_function = open_import;
@@ -961,7 +961,7 @@ let debug_print_modtab _ =
| l -> str "[." ++ int (List.length l) ++ str ".]"
in
let pr_modinfo mp (prefix,substobjs,keepobjs) s =
- s ++ str (string_of_mp mp) ++ (spc ())
+ s ++ str (ModPath.to_string mp) ++ (spc ())
++ (pr_seg (Lib.segment_of_objects prefix (substobjs@keepobjs)))
in
let modules = MPmap.fold pr_modinfo (ModObjs.all ()) (mt ()) in
diff --git a/library/declaremods.mli b/library/declaremods.mli
index 9d750b616..42e5f4b13 100644
--- a/library/declaremods.mli
+++ b/library/declaremods.mli
@@ -30,15 +30,15 @@ val declare_module :
Id.t ->
'modast module_params ->
('modast * inline) module_signature ->
- ('modast * inline) list -> module_path
+ ('modast * inline) list -> ModPath.t
val start_module :
'modast module_interpretor ->
bool option -> Id.t ->
'modast module_params ->
- ('modast * inline) module_signature -> module_path
+ ('modast * inline) module_signature -> ModPath.t
-val end_module : unit -> module_path
+val end_module : unit -> ModPath.t
@@ -53,15 +53,15 @@ val declare_modtype :
'modast module_params ->
('modast * inline) list ->
('modast * inline) list ->
- module_path
+ ModPath.t
val start_modtype :
'modast module_interpretor ->
Id.t ->
'modast module_params ->
- ('modast * inline) list -> module_path
+ ('modast * inline) list -> ModPath.t
-val end_modtype : unit -> module_path
+val end_modtype : unit -> ModPath.t
(** {6 Libraries i.e. modules on disk } *)
@@ -72,7 +72,7 @@ type library_objects
val register_library :
library_name ->
Safe_typing.compiled_library -> library_objects -> Safe_typing.vodigest ->
- Univ.universe_context_set -> unit
+ Univ.ContextSet.t -> unit
val get_library_native_symbols : library_name -> Nativecode.symbols
@@ -90,13 +90,13 @@ val append_end_library_hook : (unit -> unit) -> unit
every object of the module. Raises [Not_found] when [mp] is unknown
or when [mp] corresponds to a functor. *)
-val really_import_module : module_path -> unit
+val really_import_module : ModPath.t -> unit
(** [import_module export mp] is a synchronous version of
[really_import_module]. If [export] is [true], the module is also
opened every time the module containing it is. *)
-val import_module : bool -> module_path -> unit
+val import_module : bool -> ModPath.t -> unit
(** Include *)
diff --git a/library/decls.ml b/library/decls.ml
index 973fe144d..a4259f6ca 100644
--- a/library/decls.ml
+++ b/library/decls.ml
@@ -19,7 +19,7 @@ module NamedDecl = Context.Named.Declaration
(** Datas associated to section variables and local definitions *)
type variable_data =
- DirPath.t * bool (* opacity *) * Univ.universe_context_set * polymorphic * logical_kind
+ DirPath.t * bool (* opacity *) * Univ.ContextSet.t * polymorphic * logical_kind
let vartab =
Summary.ref (Id.Map.empty : variable_data Id.Map.t) ~name:"VARIABLE"
diff --git a/library/decls.mli b/library/decls.mli
index 478f0bca0..1b7f137a4 100644
--- a/library/decls.mli
+++ b/library/decls.mli
@@ -17,21 +17,21 @@ open Decl_kinds
(** Registration and access to the table of variable *)
type variable_data =
- DirPath.t * bool (** opacity *) * Univ.universe_context_set * polymorphic * logical_kind
+ DirPath.t * bool (** opacity *) * Univ.ContextSet.t * polymorphic * logical_kind
val add_variable_data : variable -> variable_data -> unit
val variable_path : variable -> DirPath.t
val variable_secpath : variable -> qualid
val variable_kind : variable -> logical_kind
val variable_opacity : variable -> bool
-val variable_context : variable -> Univ.universe_context_set
+val variable_context : variable -> Univ.ContextSet.t
val variable_polymorphic : variable -> polymorphic
val variable_exists : variable -> bool
(** Registration and access to the table of constants *)
-val add_constant_kind : constant -> logical_kind -> unit
-val constant_kind : constant -> logical_kind
+val add_constant_kind : Constant.t -> logical_kind -> unit
+val constant_kind : Constant.t -> logical_kind
(* Prepare global named context for proof session: remove proofs of
opaque section definitions and remove vm-compiled code *)
diff --git a/library/global.ml b/library/global.ml
index 28b9e66f8..ed847b7cd 100644
--- a/library/global.ml
+++ b/library/global.ml
@@ -8,7 +8,6 @@
open Names
open Environ
-open Decl_kinds
(** We introduce here the global environment of the system,
and we declare it as a synchronized table. *)
@@ -21,6 +20,7 @@ module GlobalSafeEnv : sig
val set_safe_env : Safe_typing.safe_environment -> unit
val join_safe_environment : ?except:Future.UUIDSet.t -> unit -> unit
val is_joined_environment : unit -> bool
+ val global_env_summary_tag : Safe_typing.safe_environment Summary.Dyn.tag
end = struct
@@ -31,9 +31,9 @@ let join_safe_environment ?except () =
let is_joined_environment () =
Safe_typing.is_joined_environment !global_env
-
-let () =
- Summary.declare_summary global_env_summary_name
+
+let global_env_summary_tag =
+ Summary.declare_summary_tag global_env_summary_name
{ Summary.freeze_function = (function
| `Yes -> join_safe_environment (); !global_env
| `No -> !global_env
@@ -52,6 +52,8 @@ let set_safe_env e = global_env := e
end
+let global_env_summary_tag = GlobalSafeEnv.global_env_summary_tag
+
let safe_env = GlobalSafeEnv.safe_env
let join_safe_environment ?except () =
GlobalSafeEnv.join_safe_environment ?except ()
@@ -79,7 +81,7 @@ let globalize_with_summary fs f =
let i2l = Label.of_id
let push_named_assum a = globalize0 (Safe_typing.push_named_assum a)
-let push_named_def d = globalize (Safe_typing.push_named_def d)
+let push_named_def d = globalize0 (Safe_typing.push_named_def d)
let add_constraints c = globalize0 (Safe_typing.add_constraints c)
let push_context_set b c = globalize0 (Safe_typing.push_context_set b c)
let push_context b c = globalize0 (Safe_typing.push_context b c)
@@ -231,18 +233,7 @@ let universes_of_global env r =
let universes_of_global gr =
universes_of_global (env ()) gr
-(** Global universe names *)
-type universe_names =
- (polymorphic * Univ.universe_level) Id.Map.t * Id.t Univ.LMap.t
-
-let global_universes =
- Summary.ref ~name:"Global universe names"
- ((Id.Map.empty, Univ.LMap.empty) : universe_names)
-
-let global_universe_names () = !global_universes
-let set_global_universe_names s = global_universes := s
-
-let is_polymorphic r =
+let is_polymorphic r =
let env = env() in
match r with
| VarRef id -> false
diff --git a/library/global.mli b/library/global.mli
index 15bf58f82..03bc945da 100644
--- a/library/global.mli
+++ b/library/global.mli
@@ -32,44 +32,44 @@ val set_typing_flags : Declarations.typing_flags -> unit
(** Variables, Local definitions, constants, inductive types *)
val push_named_assum : (Id.t * Constr.types * bool) Univ.in_universe_context_set -> unit
-val push_named_def : (Id.t * Safe_typing.private_constants Entries.definition_entry) -> Univ.universe_context_set
+val push_named_def : (Id.t * Entries.section_def_entry) -> unit
val export_private_constants : in_section:bool ->
- Safe_typing.private_constants Entries.constant_entry ->
- unit Entries.constant_entry * Safe_typing.exported_private_constant list
+ Safe_typing.private_constants Entries.definition_entry ->
+ unit Entries.definition_entry * Safe_typing.exported_private_constant list
val add_constant :
- DirPath.t -> Id.t -> Safe_typing.global_declaration -> constant
+ DirPath.t -> Id.t -> Safe_typing.global_declaration -> Constant.t
val add_mind :
- DirPath.t -> Id.t -> Entries.mutual_inductive_entry -> mutual_inductive
+ DirPath.t -> Id.t -> Entries.mutual_inductive_entry -> MutInd.t
(** Extra universe constraints *)
-val add_constraints : Univ.constraints -> unit
+val add_constraints : Univ.Constraint.t -> unit
-val push_context : bool -> Univ.universe_context -> unit
-val push_context_set : bool -> Univ.universe_context_set -> unit
+val push_context : bool -> Univ.UContext.t -> unit
+val push_context_set : bool -> Univ.ContextSet.t -> unit
(** Non-interactive modules and module types *)
val add_module :
Id.t -> Entries.module_entry -> Declarations.inline ->
- module_path * Mod_subst.delta_resolver
+ ModPath.t * Mod_subst.delta_resolver
val add_modtype :
- Id.t -> Entries.module_type_entry -> Declarations.inline -> module_path
+ Id.t -> Entries.module_type_entry -> Declarations.inline -> ModPath.t
val add_include :
Entries.module_struct_entry -> bool -> Declarations.inline ->
Mod_subst.delta_resolver
(** Interactive modules and module types *)
-val start_module : Id.t -> module_path
-val start_modtype : Id.t -> module_path
+val start_module : Id.t -> ModPath.t
+val start_modtype : Id.t -> ModPath.t
val end_module : Summary.frozen -> Id.t ->
(Entries.module_struct_entry * Declarations.inline) option ->
- module_path * MBId.t list * Mod_subst.delta_resolver
+ ModPath.t * MBId.t list * Mod_subst.delta_resolver
-val end_modtype : Summary.frozen -> Id.t -> module_path * MBId.t list
+val end_modtype : Summary.frozen -> Id.t -> ModPath.t * MBId.t list
val add_module_parameter :
MBId.t -> Entries.module_struct_entry -> Declarations.inline ->
@@ -78,45 +78,38 @@ val add_module_parameter :
(** {6 Queries in the global environment } *)
val lookup_named : variable -> Context.Named.Declaration.t
-val lookup_constant : constant -> Declarations.constant_body
+val lookup_constant : Constant.t -> Declarations.constant_body
val lookup_inductive : inductive ->
Declarations.mutual_inductive_body * Declarations.one_inductive_body
val lookup_pinductive : Constr.pinductive ->
Declarations.mutual_inductive_body * Declarations.one_inductive_body
-val lookup_mind : mutual_inductive -> Declarations.mutual_inductive_body
-val lookup_module : module_path -> Declarations.module_body
-val lookup_modtype : module_path -> Declarations.module_type_body
+val lookup_mind : MutInd.t -> Declarations.mutual_inductive_body
+val lookup_module : ModPath.t -> Declarations.module_body
+val lookup_modtype : ModPath.t -> Declarations.module_type_body
val exists_objlabel : Label.t -> bool
-val constant_of_delta_kn : kernel_name -> constant
-val mind_of_delta_kn : kernel_name -> mutual_inductive
+val constant_of_delta_kn : KerName.t -> Constant.t
+val mind_of_delta_kn : KerName.t -> MutInd.t
val opaque_tables : unit -> Opaqueproof.opaquetab
-val body_of_constant : constant -> (Term.constr * Univ.AUContext.t) option
+val body_of_constant : Constant.t -> (Constr.constr * Univ.AUContext.t) option
(** Returns the body of the constant if it has any, and the polymorphic context
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 : Declarations.constant_body -> (Term.constr * Univ.AUContext.t) option
+val body_of_constant_body : Declarations.constant_body -> (Constr.constr * Univ.AUContext.t) option
(** Same as {!body_of_constant} but on {!Declarations.constant_body}. *)
-(** Global universe name <-> level mapping *)
-type universe_names =
- (Decl_kinds.polymorphic * Univ.universe_level) Id.Map.t * Id.t Univ.LMap.t
-
-val global_universe_names : unit -> universe_names
-val set_global_universe_names : universe_names -> unit
-
(** {6 Compiled libraries } *)
-val start_library : DirPath.t -> module_path
+val start_library : DirPath.t -> ModPath.t
val export : ?except:Future.UUIDSet.t -> DirPath.t ->
- module_path * Safe_typing.compiled_library * Safe_typing.native_library
+ ModPath.t * Safe_typing.compiled_library * Safe_typing.native_library
val import :
- Safe_typing.compiled_library -> Univ.universe_context_set -> Safe_typing.vodigest ->
- module_path
+ Safe_typing.compiled_library -> Univ.ContextSet.t -> Safe_typing.vodigest ->
+ ModPath.t
(** {6 Misc } *)
@@ -147,23 +140,23 @@ val type_of_global_in_context : Environ.env ->
constants, it does not matter. *)
(** Returns the universe context of the global reference (whatever its polymorphic status is). *)
-val universes_of_global : Globnames.global_reference -> Univ.abstract_universe_context
+val universes_of_global : Globnames.global_reference -> Univ.AUContext.t
(** {6 Retroknowledge } *)
val register :
- Retroknowledge.field -> Term.constr -> Term.constr -> unit
+ Retroknowledge.field -> Constr.constr -> Constr.constr -> unit
-val register_inline : constant -> unit
+val register_inline : Constant.t -> unit
(** {6 Oracle } *)
-val set_strategy : Names.constant Names.tableKey -> Conv_oracle.level -> unit
+val set_strategy : Constant.t Names.tableKey -> Conv_oracle.level -> unit
(* Modifies the global state, registering new universes *)
-val current_dirpath : unit -> Names.dir_path
+val current_dirpath : unit -> DirPath.t
-val with_global : (Environ.env -> Names.dir_path -> 'a Univ.in_universe_context_set) -> 'a
+val with_global : (Environ.env -> DirPath.t -> 'a Univ.in_universe_context_set) -> 'a
-val global_env_summary_name : string
+val global_env_summary_tag : Safe_typing.safe_environment Summary.Dyn.tag
diff --git a/library/globnames.ml b/library/globnames.ml
index 5c75994dd..a6e75fdb6 100644
--- a/library/globnames.ml
+++ b/library/globnames.ml
@@ -8,14 +8,14 @@
open CErrors
open Names
-open Term
+open Constr
open Mod_subst
open Libnames
(*s Global reference is a kernel side type for all references together *)
type global_reference =
| VarRef of variable (** A reference to the section-context. *)
- | ConstRef of constant (** A reference to the environment. *)
+ | ConstRef of Constant.t (** A reference to the environment. *)
| IndRef of inductive (** A reference to an inductive type. *)
| ConstructRef of constructor (** A reference to a constructor of an inductive type. *)
@@ -26,11 +26,11 @@ let isConstructRef = function ConstructRef _ -> true | _ -> false
let eq_gr gr1 gr2 =
gr1 == gr2 || match gr1,gr2 with
- | ConstRef con1, ConstRef con2 -> eq_constant con1 con2
+ | ConstRef con1, ConstRef con2 -> Constant.equal con1 con2
| IndRef kn1, IndRef kn2 -> eq_ind kn1 kn2
| ConstructRef kn1, ConstructRef kn2 -> eq_constructor kn1 kn2
| VarRef v1, VarRef v2 -> Id.equal v1 v2
- | _ -> false
+ | (ConstRef _ | IndRef _ | ConstructRef _ | VarRef _), _ -> false
let destVarRef = function VarRef ind -> ind | _ -> failwith "destVarRef"
let destConstRef = function ConstRef ind -> ind | _ -> failwith "destConstRef"
@@ -67,12 +67,12 @@ let subst_global subst ref = match ref with
if c'==c then ref,t else ConstructRef c', t
let canonical_gr = function
- | ConstRef con -> ConstRef(constant_of_kn(canonical_con con))
- | IndRef (kn,i) -> IndRef(mind_of_kn(canonical_mind kn),i)
- | ConstructRef ((kn,i),j )-> ConstructRef((mind_of_kn(canonical_mind kn),i),j)
+ | ConstRef con -> ConstRef(Constant.make1 (Constant.canonical con))
+ | IndRef (kn,i) -> IndRef(MutInd.make1(MutInd.canonical kn),i)
+ | ConstructRef ((kn,i),j )-> ConstructRef((MutInd.make1(MutInd.canonical kn),i),j)
| VarRef id -> VarRef id
-let global_of_constr c = match kind_of_term c with
+let global_of_constr c = match kind c with
| Const (sp,u) -> ConstRef sp
| Ind (ind_sp,u) -> IndRef ind_sp
| Construct (cstr_cp,u) -> ConstructRef cstr_cp
@@ -80,8 +80,8 @@ let global_of_constr c = match kind_of_term c with
| _ -> raise Not_found
let is_global c t =
- match c, kind_of_term t with
- | ConstRef c, Const (c', _) -> eq_constant c c'
+ match c, kind t with
+ | ConstRef c, Const (c', _) -> Constant.equal c c'
| IndRef i, Ind (i', _) -> eq_ind i i'
| ConstructRef i, Construct (i', _) -> eq_constructor i i'
| VarRef id, Var id' -> Id.equal id id'
@@ -157,7 +157,7 @@ module Refset_env = Refmap_env.Set
(* Extended global references *)
-type syndef_name = kernel_name
+type syndef_name = KerName.t
type extended_global_reference =
| TrueGlobal of global_reference
@@ -180,7 +180,7 @@ module ExtRefOrdered = struct
if x == y then 0
else match x, y with
| TrueGlobal rx, TrueGlobal ry -> RefOrdered_env.compare rx ry
- | SynDef knx, SynDef kny -> kn_ord knx kny
+ | SynDef knx, SynDef kny -> KerName.compare knx kny
| TrueGlobal _, SynDef _ -> -1
| SynDef _, TrueGlobal _ -> 1
@@ -215,12 +215,12 @@ let decode_mind kn =
id::(DirPath.repr dp)
| MPdot(mp,l) -> (Label.to_id l)::(dir_of_mp mp)
in
- let mp,sec_dir,l = repr_mind kn in
+ let mp,sec_dir,l = MutInd.repr3 kn in
check_empty_section sec_dir;
(DirPath.make (dir_of_mp mp)),Label.to_id l
let decode_con kn =
- let mp,sec_dir,l = repr_con kn in
+ let mp,sec_dir,l = Constant.repr3 kn in
check_empty_section sec_dir;
match mp with
| MPfile dir -> (dir,Label.to_id l)
@@ -231,12 +231,12 @@ let decode_con kn =
user and canonical kernel names must be equal. *)
let pop_con con =
- let (mp,dir,l) = repr_con con in
- Names.make_con mp (pop_dirpath dir) l
+ let (mp,dir,l) = Constant.repr3 con in
+ Constant.make3 mp (pop_dirpath dir) l
let pop_kn kn =
- let (mp,dir,l) = repr_mind kn in
- Names.make_mind mp (pop_dirpath dir) l
+ let (mp,dir,l) = MutInd.repr3 kn in
+ MutInd.make3 mp (pop_dirpath dir) l
let pop_global_reference = function
| ConstRef con -> ConstRef (pop_con con)
diff --git a/library/globnames.mli b/library/globnames.mli
index 0b5971b6e..2e0cd62db 100644
--- a/library/globnames.mli
+++ b/library/globnames.mli
@@ -8,13 +8,13 @@
open Util
open Names
-open Term
+open Constr
open Mod_subst
(** {6 Global reference is a kernel side type for all references together } *)
type global_reference =
| VarRef of variable (** A reference to the section-context. *)
- | ConstRef of constant (** A reference to the environment. *)
+ | ConstRef of Constant.t (** A reference to the environment. *)
| IndRef of inductive (** A reference to an inductive type. *)
| ConstructRef of constructor (** A reference to a constructor of an inductive type. *)
@@ -27,7 +27,7 @@ val eq_gr : global_reference -> global_reference -> bool
val canonical_gr : global_reference -> global_reference
val destVarRef : global_reference -> variable
-val destConstRef : global_reference -> constant
+val destConstRef : global_reference -> Constant.t
val destIndRef : global_reference -> inductive
val destConstructRef : global_reference -> constructor
@@ -47,6 +47,7 @@ val global_of_constr : constr -> global_reference
(** Obsolete synonyms for constr_of_global and global_of_constr *)
val reference_of_constr : constr -> global_reference
+[@@ocaml.deprecated "Alias of Globnames.global_of_constr"]
module RefOrdered : sig
type t = global_reference
@@ -72,7 +73,7 @@ module Refmap_env : Map.ExtS
(** {6 Extended global references } *)
-type syndef_name = kernel_name
+type syndef_name = KerName.t
type extended_global_reference =
| TrueGlobal of global_reference
@@ -91,13 +92,13 @@ type global_reference_or_constr =
(** {6 Temporary function to brutally form kernel names from section paths } *)
-val encode_mind : DirPath.t -> Id.t -> mutual_inductive
-val decode_mind : mutual_inductive -> DirPath.t * Id.t
-val encode_con : DirPath.t -> Id.t -> constant
-val decode_con : constant -> DirPath.t * Id.t
+val encode_mind : DirPath.t -> Id.t -> MutInd.t
+val decode_mind : MutInd.t -> DirPath.t * Id.t
+val encode_con : DirPath.t -> Id.t -> Constant.t
+val decode_con : Constant.t -> DirPath.t * Id.t
(** {6 Popping one level of section in global names } *)
-val pop_con : constant -> constant
-val pop_kn : mutual_inductive-> mutual_inductive
+val pop_con : Constant.t -> Constant.t
+val pop_kn : MutInd.t-> MutInd.t
val pop_global_reference : global_reference -> global_reference
diff --git a/library/heads.ml b/library/heads.ml
index c12fa9479..ee3bfe1bd 100644
--- a/library/heads.ml
+++ b/library/heads.ml
@@ -8,7 +8,7 @@
open Util
open Names
-open Term
+open Constr
open Vars
open Mod_subst
open Environ
@@ -25,7 +25,7 @@ open Context.Named.Declaration
the evaluation of [phi(0)] and the head of [h] is declared unknown). *)
type rigid_head_kind =
-| RigidParameter of constant (* a Const without body *)
+| RigidParameter of Constant.t (* a Const without body *)
| RigidVar of variable (* a Var without body *)
| RigidType (* an inductive, a product or a sort *)
@@ -57,7 +57,7 @@ let variable_head id = Evalrefmap.find (EvalVarRef id) !head_map
let constant_head cst = Evalrefmap.find (EvalConstRef cst) !head_map
let kind_of_head env t =
- let rec aux k l t b = match kind_of_term (Reduction.whd_betaiotazeta env t) with
+ let rec aux k l t b = match kind (Reduction.whd_betaiotazeta env t) with
| Rel n when n > k -> NotImmediatelyComputableHead
| Rel n -> FlexibleHead (k,k+1-n,List.length l,b)
| Var id ->
@@ -156,7 +156,7 @@ let cache_head o =
let subst_head_approximation subst = function
| RigidHead (RigidParameter cst) as k ->
let cst,c = subst_con_kn subst cst in
- if isConst c && eq_constant (fst (destConst c)) cst then
+ if isConst c && Constant.equal (fst (destConst c)) cst then
(* A change of the prefix of the constant *)
k
else
diff --git a/library/heads.mli b/library/heads.mli
index 1ce66c841..8ad5c0f14 100644
--- a/library/heads.mli
+++ b/library/heads.mli
@@ -7,7 +7,7 @@
(************************************************************************)
open Names
-open Term
+open Constr
open Environ
(** This module is about the computation of an approximation of the
diff --git a/library/kindops.ml b/library/kindops.ml
index 882f62086..83985ce97 100644
--- a/library/kindops.ml
+++ b/library/kindops.ml
@@ -23,45 +23,13 @@ let string_of_theorem_kind = function
| Proposition -> "Proposition"
| Corollary -> "Corollary"
-let string_of_definition_kind def =
- let (locality, poly, kind) = def in
- let error () = CErrors.anomaly (Pp.str "Internal definition kind.") in
- match kind with
- | Definition ->
- begin match locality with
- | Discharge -> "Let"
- | Local -> "Local Definition"
- | Global -> "Definition"
- end
- | Example ->
- begin match locality with
- | Discharge -> error ()
- | Local -> "Local Example"
- | Global -> "Example"
- end
- | Coercion ->
- begin match locality with
- | Discharge -> error ()
- | Local -> "Local Coercion"
- | Global -> "Coercion"
- end
- | SubClass ->
- begin match locality with
- | Discharge -> error ()
- | Local -> "Local SubClass"
- | Global -> "SubClass"
- end
- | CanonicalStructure ->
- begin match locality with
- | Discharge -> error ()
- | Local -> error ()
- | Global -> "Canonical Structure"
- end
- | Instance ->
- begin match locality with
- | Discharge -> error ()
- | Local -> "Instance"
- | Global -> "Global Instance"
- end
+let string_of_definition_object_kind = function
+ | Definition -> "Definition"
+ | Example -> "Example"
+ | Coercion -> "Coercion"
+ | SubClass -> "SubClass"
+ | CanonicalStructure -> "Canonical Structure"
+ | Instance -> "Instance"
+ | Let -> "Let"
| (StructureComponent|Scheme|CoFixpoint|Fixpoint|IdentityCoercion|Method) ->
CErrors.anomaly (Pp.str "Internal definition kind.")
diff --git a/library/kindops.mli b/library/kindops.mli
index 77979c915..06f873e85 100644
--- a/library/kindops.mli
+++ b/library/kindops.mli
@@ -12,4 +12,4 @@ open Decl_kinds
val logical_kind_of_goal_kind : goal_object_kind -> logical_kind
val string_of_theorem_kind : theorem_kind -> string
-val string_of_definition_kind : definition_kind -> string
+val string_of_definition_object_kind : definition_object_kind -> string
diff --git a/library/lib.ml b/library/lib.ml
index e95bb47f2..971089c17 100644
--- a/library/lib.ml
+++ b/library/lib.ml
@@ -9,9 +9,9 @@
open Pp
open CErrors
open Util
+open Names
open Libnames
open Globnames
-open Nameops
open Libobject
open Context.Named.Declaration
@@ -62,7 +62,7 @@ let classify_segment seg =
let rec clean ((substl,keepl,anticipl) as acc) = function
| (_,CompilingLibrary _) :: _ | [] -> acc
| ((sp,kn),Leaf o) :: stk ->
- let id = Names.Label.to_id (Names.label kn) in
+ let id = Names.Label.to_id (Names.KerName.label kn) in
(match classify_object o with
| Dispose -> clean acc stk
| Keep o' ->
@@ -93,12 +93,16 @@ let segment_of_objects prefix =
sections, but on the contrary there are many constructions of section
paths based on the library path. *)
-let initial_prefix = default_library,(Names.initial_path,Names.DirPath.empty)
+let initial_prefix = {
+ obj_dir = default_library;
+ obj_mp = ModPath.initial;
+ obj_sec = DirPath.empty;
+}
type lib_state = {
- comp_name : Names.DirPath.t option;
+ comp_name : DirPath.t option;
lib_stk : library_segment;
- path_prefix : Names.DirPath.t * (Names.module_path * Names.DirPath.t);
+ path_prefix : object_prefix;
}
let initial_lib_state = {
@@ -115,10 +119,9 @@ let library_dp () =
(* [path_prefix] is a pair of absolute dirpath and a pair of current
module path and relative section path *)
-let cwd () = fst !lib_state.path_prefix
-let current_prefix () = snd !lib_state.path_prefix
-let current_mp () = fst (snd !lib_state.path_prefix)
-let current_sections () = snd (snd !lib_state.path_prefix)
+let cwd () = !lib_state.path_prefix.obj_dir
+let current_mp () = !lib_state.path_prefix.obj_mp
+let current_sections () = !lib_state.path_prefix.obj_sec
let sections_depth () = List.length (Names.DirPath.repr (current_sections ()))
let sections_are_opened () = not (Names.DirPath.is_empty (current_sections ()))
@@ -136,8 +139,8 @@ let make_path_except_section id =
Libnames.make_path (cwd_except_section ()) id
let make_kn id =
- let mp,dir = current_prefix () in
- Names.make_kn mp dir (Names.Label.of_id id)
+ let mp, dir = current_mp (), current_sections () in
+ Names.KerName.make mp dir (Names.Label.of_id id)
let make_oname id = Libnames.make_oname !lib_state.path_prefix id
@@ -152,8 +155,11 @@ let recalc_path_prefix () =
lib_state := { !lib_state with path_prefix = recalc !lib_state.lib_stk }
let pop_path_prefix () =
- let dir,(mp,sec) = !lib_state.path_prefix in
- lib_state := { !lib_state with path_prefix = pop_dirpath dir, (mp, pop_dirpath sec)}
+ let op = !lib_state.path_prefix in
+ lib_state := { !lib_state
+ with path_prefix = { op with obj_dir = pop_dirpath op.obj_dir;
+ obj_sec = pop_dirpath op.obj_sec;
+ } }
let find_entry_p p =
let rec find = function
@@ -226,7 +232,7 @@ let add_anonymous_entry node =
add_entry (make_oname (anonymous_id ())) node
let add_leaf id obj =
- if Names.ModPath.equal (current_mp ()) Names.initial_path then
+ if ModPath.equal (current_mp ()) ModPath.initial then
user_err Pp.(str "No session module started (use -top dir)");
let oname = make_oname id in
cache_object (oname,obj);
@@ -278,14 +284,14 @@ let current_mod_id () =
let start_mod is_type export id mp fs =
- let dir = add_dirpath_suffix (cwd ()) id in
- let prefix = dir,(mp,Names.DirPath.empty) in
+ let dir = add_dirpath_suffix (!lib_state.path_prefix.obj_dir) id in
+ let prefix = { obj_dir = dir; obj_mp = mp; obj_sec = Names.DirPath.empty } in
let exists =
if is_type then Nametab.exists_cci (make_path id)
else Nametab.exists_module dir
in
if exists then
- user_err ~hdr:"open_module" (pr_id id ++ str " already exists");
+ user_err ~hdr:"open_module" (Id.print id ++ str " already exists");
add_entry (make_oname id) (OpenedModule (is_type,export,prefix,fs));
lib_state := { !lib_state with path_prefix = prefix} ;
prefix
@@ -296,7 +302,7 @@ let start_modtype = start_mod true None
let error_still_opened string oname =
let id = basename (fst oname) in
user_err
- (str "The " ++ str string ++ str " " ++ pr_id id ++ str " is still opened.")
+ (str "The " ++ str string ++ str " " ++ Id.print id ++ str " is still opened.")
let end_mod is_type =
let oname,fs =
@@ -328,17 +334,17 @@ let contents_after sp = let (after,_,_) = split_lib sp in after
let start_compilation s mp =
if !lib_state.comp_name != None then
user_err Pp.(str "compilation unit is already started");
- if not (Names.DirPath.is_empty (current_sections ())) then
+ if not (Names.DirPath.is_empty (!lib_state.path_prefix.obj_sec)) then
user_err Pp.(str "some sections are already opened");
- let prefix = s, (mp, Names.DirPath.empty) in
- let () = add_anonymous_entry (CompilingLibrary prefix) in
+ let prefix = Libnames.{ obj_dir = s; obj_mp = mp; obj_sec = DirPath.empty } in
+ add_anonymous_entry (CompilingLibrary prefix);
lib_state := { !lib_state with comp_name = Some s;
path_prefix = prefix }
let open_blocks_message es =
let open_block_name = function
- | oname, OpenedSection _ -> str "section " ++ pr_id (basename (fst oname))
- | oname, OpenedModule (ty,_,_,_) -> str (module_kind ty) ++ spc () ++ pr_id (basename (fst oname))
+ | oname, OpenedSection _ -> str "section " ++ Id.print (basename (fst oname))
+ | oname, OpenedModule (ty,_,_,_) -> str (module_kind ty) ++ spc () ++ Id.print (basename (fst oname))
| _ -> assert false in
str "The " ++ pr_enum open_block_name es ++ spc () ++
str "need" ++ str (if List.length es == 1 then "s" else "") ++ str " to be closed."
@@ -360,8 +366,8 @@ let end_compilation_checks dir =
| None -> anomaly (Pp.str "There should be a module name...")
| Some m ->
if not (Names.DirPath.equal m dir) then anomaly
- (str "The current open module has name" ++ spc () ++ pr_dirpath m ++
- spc () ++ str "and not" ++ spc () ++ pr_dirpath m ++ str ".");
+ (str "The current open module has name" ++ spc () ++ DirPath.print m ++
+ spc () ++ str "and not" ++ spc () ++ DirPath.print m ++ str ".");
in
oname
@@ -395,7 +401,7 @@ let find_opening_node id =
let id' = basename (fst oname) in
if not (Names.Id.equal id id') then
user_err ~hdr:"Lib.find_opening_node"
- (str "Last block to end has name " ++ pr_id id' ++ str ".");
+ (str "Last block to end has name " ++ Id.print id' ++ str ".");
entry
with Not_found -> user_err Pp.(str "There is nothing to end.")
@@ -411,14 +417,17 @@ let find_opening_node id =
type variable_info = Context.Named.Declaration.t * Decl_kinds.binding_kind
type variable_context = variable_info list
-type abstr_info = variable_context * Univ.universe_level_subst * Univ.AUContext.t
-
+type abstr_info = {
+ abstr_ctx : variable_context;
+ abstr_subst : Univ.Instance.t;
+ abstr_uctx : Univ.AUContext.t;
+}
type abstr_list = abstr_info Names.Cmap.t * abstr_info Names.Mindmap.t
type secentry =
| Variable of (Names.Id.t * Decl_kinds.binding_kind *
- Decl_kinds.polymorphic * Univ.universe_context_set)
- | Context of Univ.universe_context_set
+ Decl_kinds.polymorphic * Univ.ContextSet.t)
+ | Context of Univ.ContextSet.t
let sectab =
Summary.ref ([] : (secentry list * Opaqueproof.work_list * abstr_list) list)
@@ -477,8 +486,12 @@ let add_section_replacement f g poly hyps =
let inst = Univ.UContext.instance ctx in
let subst, ctx = Univ.abstract_universes ctx in
let args = instance_from_variable_context (List.rev sechyps) in
- sectab := (vars,f (inst,args) exps,
- g (sechyps,subst,ctx) abs)::sl
+ let info = {
+ abstr_ctx = sechyps;
+ abstr_subst = subst;
+ abstr_uctx = ctx;
+ } in
+ sectab := (vars,f (inst,args) exps, g info abs) :: sl
let add_section_kn poly kn =
let f x (l1,l2) = (l1,Names.Mindmap.add kn x l2) in
@@ -496,12 +509,21 @@ let section_segment_of_constant con =
let section_segment_of_mutual_inductive kn =
Names.Mindmap.find kn (snd (pi3 (List.hd !sectab)))
-let variable_section_segment_of_reference = function
- | ConstRef con -> pi1 (section_segment_of_constant con)
- | IndRef (kn,_) | ConstructRef ((kn,_),_) ->
- pi1 (section_segment_of_mutual_inductive kn)
- | _ -> []
-
+let empty_segment = {
+ abstr_ctx = [];
+ abstr_subst = Univ.Instance.empty;
+ abstr_uctx = Univ.AUContext.empty;
+}
+
+let section_segment_of_reference = function
+| ConstRef c -> section_segment_of_constant c
+| IndRef (kn,_) | ConstructRef ((kn,_),_) ->
+ section_segment_of_mutual_inductive kn
+| VarRef _ -> empty_segment
+
+let variable_section_segment_of_reference gr =
+ (section_segment_of_reference gr).abstr_ctx
+
let section_instance = function
| VarRef id ->
let eq = function
@@ -522,15 +544,15 @@ let is_in_section ref =
(*************)
(* Sections. *)
let open_section id =
- let olddir,(mp,oldsec) = !lib_state.path_prefix in
- let dir = add_dirpath_suffix olddir id in
- let prefix = dir, (mp, add_dirpath_suffix oldsec id) in
- if Nametab.exists_section dir then
- user_err ~hdr:"open_section" (pr_id id ++ str " already exists.");
+ let opp = !lib_state.path_prefix in
+ let obj_dir = add_dirpath_suffix opp.obj_dir id in
+ let prefix = { obj_dir; obj_mp = opp.obj_mp; obj_sec = add_dirpath_suffix opp.obj_sec id } in
+ if Nametab.exists_section obj_dir then
+ user_err ~hdr:"open_section" (Id.print id ++ str " already exists.");
let fs = Summary.freeze_summaries ~marshallable:`No in
add_entry (make_oname id) (OpenedSection (prefix, fs));
(*Pushed for the lifetime of the section: removed by unfrozing the summary*)
- Nametab.push_dir (Nametab.Until 1) dir (DirOpenSection prefix);
+ Nametab.push_dir (Nametab.Until 1) obj_dir (DirOpenSection prefix);
lib_state := { !lib_state with path_prefix = prefix };
add_section ()
@@ -556,7 +578,7 @@ let close_section () =
in
let (secdecls,mark,before) = split_lib_at_opening oname in
lib_state := { !lib_state with lib_stk = before };
- let full_olddir = fst !lib_state.path_prefix in
+ let full_olddir = !lib_state.path_prefix.obj_dir in
pop_path_prefix ();
add_entry oname (ClosedSection (List.rev (mark::secdecls)));
let newdecls = List.map discharge_item secdecls in
@@ -596,10 +618,10 @@ let init () =
(* Misc *)
let mp_of_global = function
- |VarRef id -> current_mp ()
- |ConstRef cst -> Names.con_modpath cst
- |IndRef ind -> Names.ind_modpath ind
- |ConstructRef constr -> Names.constr_modpath constr
+ | VarRef id -> !lib_state.path_prefix.obj_mp
+ | ConstRef cst -> Names.Constant.modpath cst
+ | IndRef ind -> Names.ind_modpath ind
+ | ConstructRef constr -> Names.constr_modpath constr
let rec dp_of_mp = function
|Names.MPfile dp -> dp
@@ -621,12 +643,12 @@ let library_part = function
(* Discharging names *)
let con_defined_in_sec kn =
- let _,dir,_ = Names.repr_con kn in
+ let _,dir,_ = Names.Constant.repr3 kn in
not (Names.DirPath.is_empty dir) &&
Names.DirPath.equal (pop_dirpath dir) (current_sections ())
let defined_in_sec kn =
- let _,dir,_ = Names.repr_mind kn in
+ let _,dir,_ = Names.MutInd.repr3 kn in
not (Names.DirPath.is_empty dir) &&
Names.DirPath.equal (pop_dirpath dir) (current_sections ())
@@ -648,15 +670,10 @@ let discharge_con cst =
let discharge_inductive (kn,i) =
(discharge_kn kn,i)
-let discharge_abstract_universe_context (_, subst, abs_ctx) auctx =
+let discharge_abstract_universe_context { abstr_subst = subst; abstr_uctx = abs_ctx } auctx =
let open Univ in
- let len = LMap.cardinal subst in
- let rec gen_subst i acc =
- if i < 0 then acc
- else
- let acc = LMap.add (Level.var i) (Level.var (i + len)) acc in
- gen_subst (pred i) acc
- in
- let subst = gen_subst (AUContext.size auctx - 1) subst in
+ let ainst = make_abstract_instance auctx in
+ let subst = Instance.append subst ainst in
+ let subst = make_instance_subst subst in
let auctx = Univ.subst_univs_level_abstract_universe_context subst auctx in
subst, AUContext.union abs_ctx auctx
diff --git a/library/lib.mli b/library/lib.mli
index 3dcec1d53..cf75d5f8c 100644
--- a/library/lib.mli
+++ b/library/lib.mli
@@ -81,8 +81,8 @@ val make_path : Names.Id.t -> Libnames.full_path
val make_path_except_section : Names.Id.t -> Libnames.full_path
(** Kernel-side names *)
-val current_mp : unit -> Names.module_path
-val make_kn : Names.Id.t -> Names.kernel_name
+val current_mp : unit -> Names.ModPath.t
+val make_kn : Names.Id.t -> Names.KerName.t
(** Are we inside an opened section *)
val sections_are_opened : unit -> bool
@@ -103,11 +103,11 @@ val find_opening_node : Names.Id.t -> node
(** {6 Modules and module types } *)
val start_module :
- export -> Names.module_ident -> Names.module_path ->
+ export -> Names.module_ident -> Names.ModPath.t ->
Summary.frozen -> Libnames.object_prefix
val start_modtype :
- Names.module_ident -> Names.module_path ->
+ Names.module_ident -> Names.ModPath.t ->
Summary.frozen -> Libnames.object_prefix
val end_module :
@@ -122,7 +122,7 @@ val end_modtype :
(** {6 Compilation units } *)
-val start_compilation : Names.DirPath.t -> Names.module_path -> unit
+val start_compilation : Names.DirPath.t -> Names.ModPath.t -> unit
val end_compilation_checks : Names.DirPath.t -> Libnames.object_name
val end_compilation :
Libnames.object_name-> Libnames.object_prefix * library_segment
@@ -132,8 +132,8 @@ val end_compilation :
val library_dp : unit -> Names.DirPath.t
(** Extract the library part of a name even if in a section *)
-val dp_of_mp : Names.module_path -> Names.DirPath.t
-val split_modpath : Names.module_path -> Names.DirPath.t * Names.Id.t list
+val dp_of_mp : Names.ModPath.t -> Names.DirPath.t
+val split_modpath : Names.ModPath.t -> Names.DirPath.t * Names.Id.t list
val library_part : Globnames.global_reference -> Names.DirPath.t
(** {6 Sections } *)
@@ -153,30 +153,39 @@ val init : unit -> unit
(** {6 Section management for discharge } *)
type variable_info = Context.Named.Declaration.t * Decl_kinds.binding_kind
type variable_context = variable_info list
-type abstr_info = variable_context * Univ.universe_level_subst * Univ.AUContext.t
+type abstr_info = private {
+ abstr_ctx : variable_context;
+ (** Section variables of this prefix *)
+ abstr_subst : Univ.Instance.t;
+ (** Actual names of the abstracted variables *)
+ abstr_uctx : Univ.AUContext.t;
+ (** Universe quantification, same length as the substitution *)
+}
val instance_from_variable_context : variable_context -> Names.Id.t array
val named_of_variable_context : variable_context -> Context.Named.t
-val section_segment_of_constant : Names.constant -> abstr_info
-val section_segment_of_mutual_inductive: Names.mutual_inductive -> abstr_info
+val section_segment_of_constant : Names.Constant.t -> abstr_info
+val section_segment_of_mutual_inductive: Names.MutInd.t -> abstr_info
+val section_segment_of_reference : Globnames.global_reference -> abstr_info
+
val variable_section_segment_of_reference : Globnames.global_reference -> variable_context
-val section_instance : Globnames.global_reference -> Univ.universe_instance * Names.Id.t array
+val section_instance : Globnames.global_reference -> Univ.Instance.t * Names.Id.t array
val is_in_section : Globnames.global_reference -> bool
-val add_section_variable : Names.Id.t -> Decl_kinds.binding_kind -> Decl_kinds.polymorphic -> Univ.universe_context_set -> unit
-val add_section_context : Univ.universe_context_set -> unit
+val add_section_variable : Names.Id.t -> Decl_kinds.binding_kind -> Decl_kinds.polymorphic -> Univ.ContextSet.t -> unit
+val add_section_context : Univ.ContextSet.t -> unit
val add_section_constant : Decl_kinds.polymorphic ->
- Names.constant -> Context.Named.t -> unit
+ Names.Constant.t -> Context.Named.t -> unit
val add_section_kn : Decl_kinds.polymorphic ->
- Names.mutual_inductive -> Context.Named.t -> unit
+ Names.MutInd.t -> Context.Named.t -> unit
val replacement_context : unit -> Opaqueproof.work_list
(** {6 Discharge: decrease the section level if in the current section } *)
-val discharge_kn : Names.mutual_inductive -> Names.mutual_inductive
-val discharge_con : Names.constant -> Names.constant
+val discharge_kn : Names.MutInd.t -> Names.MutInd.t
+val discharge_con : Names.Constant.t -> Names.Constant.t
val discharge_global : Globnames.global_reference -> Globnames.global_reference
val discharge_inductive : Names.inductive -> Names.inductive
val discharge_abstract_universe_context :
diff --git a/library/libnames.ml b/library/libnames.ml
index 0453f15e8..a471d8396 100644
--- a/library/libnames.ml
+++ b/library/libnames.ml
@@ -13,7 +13,7 @@ open Names
(**********************************************)
-let pr_dirpath sl = str (DirPath.to_string sl)
+let pr_dirpath sl = DirPath.print sl
(*s Operations on dirpaths *)
@@ -154,12 +154,17 @@ let qualid_of_dirpath dir =
let (l,a) = split_dirpath dir in
make_qualid l a
-type object_name = full_path * kernel_name
+type object_name = full_path * KerName.t
-type object_prefix = DirPath.t * (module_path * DirPath.t)
+type object_prefix = {
+ obj_dir : DirPath.t;
+ obj_mp : ModPath.t;
+ obj_sec : DirPath.t;
+}
-let make_oname (dirpath,(mp,dir)) id =
- make_path dirpath id, make_kn mp dir (Label.of_id id)
+(* let make_oname (dirpath,(mp,dir)) id = *)
+let make_oname { obj_dir; obj_mp; obj_sec } id =
+ make_path obj_dir id, KerName.make obj_mp obj_sec (Label.of_id id)
(* to this type are mapped DirPath.t's in the nametab *)
type global_dir_reference =
@@ -170,10 +175,10 @@ type global_dir_reference =
| DirClosedSection of DirPath.t
(* this won't last long I hope! *)
-let eq_op (d1, (mp1, p1)) (d2, (mp2, p2)) =
- DirPath.equal d1 d2 &&
- DirPath.equal p1 p2 &&
- mp_eq mp1 mp2
+let eq_op op1 op2 =
+ DirPath.equal op1.obj_dir op2.obj_dir &&
+ DirPath.equal op1.obj_sec op2.obj_sec &&
+ ModPath.equal op1.obj_mp op2.obj_mp
let eq_global_dir_reference r1 r2 = match r1, r2 with
| DirOpenModule op1, DirOpenModule op2 -> eq_op op1 op2
@@ -232,6 +237,14 @@ let join_reference ns r =
Qualid (loc, make_qualid
(dirpath_of_string (Names.Id.to_string id1)) id2)
+(* Default paths *)
+let default_library = Names.DirPath.initial (* = ["Top"] *)
+
+(*s Roots of the space of absolute names *)
+let coq_string = "Coq"
+let coq_root = Id.of_string coq_string
+let default_root_prefix = DirPath.empty
+
(* Deprecated synonyms *)
let make_short_qualid = qualid_of_ident
diff --git a/library/libnames.mli b/library/libnames.mli
index 1b351290a..71f542240 100644
--- a/library/libnames.mli
+++ b/library/libnames.mli
@@ -11,12 +11,13 @@ open Loc
open Names
(** {6 Dirpaths } *)
-(** FIXME: ought to be in Names.dir_path *)
+val dirpath_of_string : string -> DirPath.t
val pr_dirpath : DirPath.t -> Pp.t
+[@@ocaml.deprecated "Alias for DirPath.print"]
-val dirpath_of_string : string -> DirPath.t
val string_of_dirpath : DirPath.t -> string
+[@@ocaml.deprecated "Alias for DirPath.to_string"]
(** Pop the suffix of a [DirPath.t]. Raises a [Failure] for an empty path *)
val pop_dirpath : DirPath.t -> DirPath.t
@@ -91,9 +92,27 @@ val qualid_of_ident : Id.t -> qualid
can be substituted and a "syntactic" [full_path] which can be printed
*)
-type object_name = full_path * kernel_name
+type object_name = full_path * KerName.t
+
+(** Object prefix morally contains the "prefix" naming of an object to
+ be stored by [library], where [obj_dir] is the "absolute" path,
+ [obj_mp] is the current "module" prefix and [obj_sec] is the
+ "section" prefix.
+
+ Thus, for an object living inside [Module A. Section B.] the
+ prefix would be:
+
+ [ { obj_dir = "A.B"; obj_mp = "A"; obj_sec = "B" } ]
+
+ Note that both [obj_dir] and [obj_sec] are "paths" that is to say,
+ as opposed to [obj_mp] which is a single module name.
-type object_prefix = DirPath.t * (module_path * DirPath.t)
+ *)
+type object_prefix = {
+ obj_dir : DirPath.t;
+ obj_mp : ModPath.t;
+ obj_sec : DirPath.t;
+}
val eq_op : object_prefix -> object_prefix -> bool
@@ -127,7 +146,20 @@ val pr_reference : reference -> Pp.t
val loc_of_reference : reference -> Loc.t option
val join_reference : reference -> reference -> reference
-(** Deprecated synonyms *)
+(** some preset paths *)
+val default_library : DirPath.t
+
+(** This is the root of the standard library of Coq *)
+val coq_root : module_ident (** "Coq" *)
+val coq_string : string (** "Coq" *)
+
+(** This is the default root prefix for developments which doesn't
+ mention a root *)
+val default_root_prefix : DirPath.t
+(** Deprecated synonyms *)
val make_short_qualid : Id.t -> qualid (** = qualid_of_ident *)
+[@@ocaml.deprecated "Alias for qualid_of_ident"]
+
val qualid_of_sp : full_path -> qualid (** = qualid_of_path *)
+[@@ocaml.deprecated "Alias for qualid_of_sp"]
diff --git a/library/library.ml b/library/library.ml
index e2832ecdc..868e26684 100644
--- a/library/library.ml
+++ b/library/library.ml
@@ -12,9 +12,8 @@ open Util
open Names
open Libnames
-open Nameops
-open Libobject
open Lib
+open Libobject
(************************************************************************)
(*s Low-level interning/externing of libraries to files *)
@@ -97,7 +96,7 @@ type library_t = {
library_deps : (compilation_unit_name * Safe_typing.vodigest) array;
library_imports : compilation_unit_name array;
library_digests : Safe_typing.vodigest;
- library_extra_univs : Univ.universe_context_set;
+ library_extra_univs : Univ.ContextSet.t;
}
type library_summary = {
@@ -132,7 +131,7 @@ let try_find_library dir =
try find_library dir
with Not_found ->
user_err ~hdr:"Library.find_library"
- (str "Unknown library " ++ pr_dirpath dir)
+ (str "Unknown library " ++ DirPath.print dir)
let register_library_filename dir f =
(* Not synchronized: overwrite the previous binding if one existed *)
@@ -171,7 +170,7 @@ let register_loaded_library m =
let prefix = Nativecode.mod_uid_of_dirpath libname ^ "." in
let f = prefix ^ "cmo" in
let f = Dynlink.adapt_filename f in
- if not Coq_config.no_native_compiler then
+ if Coq_config.native_compiler then
Nativelib.link_library ~prefix ~dirname ~basename:f
in
let rec aux = function
@@ -331,7 +330,7 @@ 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 () ++ pr_dirpath prefix ++ fnl ())
+ str "no physical path bound to" ++ spc () ++ DirPath.print prefix ++ fnl ())
let error_lib_not_found qid =
user_err ~hdr:"load_absolute_library_from"
@@ -360,9 +359,9 @@ type 'a table_status =
| Fetched of 'a Future.computation array
let opaque_tables =
- ref (LibraryMap.empty : (Term.constr table_status) LibraryMap.t)
+ ref (LibraryMap.empty : (Constr.constr table_status) LibraryMap.t)
let univ_tables =
- ref (LibraryMap.empty : (Univ.universe_context_set table_status) LibraryMap.t)
+ ref (LibraryMap.empty : (Univ.ContextSet.t table_status) LibraryMap.t)
let add_opaque_table dp st =
opaque_tables := LibraryMap.add dp st !opaque_tables
@@ -408,9 +407,9 @@ let () =
type seg_sum = summary_disk
type seg_lib = library_disk
type seg_univ = (* true = vivo, false = vi *)
- Univ.universe_context_set Future.computation array * Univ.universe_context_set * bool
+ Univ.ContextSet.t Future.computation array * Univ.ContextSet.t * bool
type seg_discharge = Opaqueproof.cooking_info list array
-type seg_proofs = Term.constr Future.computation array
+type seg_proofs = Constr.constr Future.computation array
let mk_library sd md digests univs =
{
@@ -465,8 +464,8 @@ let rec intern_library (needed, contents) (dir, f) from =
if not (DirPath.equal dir m.library_name) then
user_err ~hdr:"load_physical_library"
(str "The file " ++ str f ++ str " contains library" ++ spc () ++
- pr_dirpath m.library_name ++ spc () ++ str "and not library" ++
- spc() ++ pr_dirpath dir);
+ 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
@@ -477,9 +476,9 @@ and intern_library_deps libs dir m from =
and intern_mandatory_library caller from libs (dir,d) =
let digest, libs = intern_library libs (dir, None) (Some from) in
if not (Safe_typing.digest_match ~actual:digest ~required:d) then
- user_err (str "Compiled library " ++ pr_dirpath caller ++
+ user_err (str "Compiled library " ++ DirPath.print caller ++
str " (in file " ++ str from ++ str ") makes inconsistent assumptions \
- over library " ++ pr_dirpath dir);
+ over library " ++ DirPath.print dir);
libs
let rec_intern_library libs (dir, f) =
@@ -617,7 +616,7 @@ let check_coq_overwriting p id =
let is_empty = match l with [] -> true | _ -> false in
if not !Flags.boot && not is_empty && Id.equal (List.last l) coq_root then
user_err
- (str "Cannot build module " ++ pr_dirpath p ++ str "." ++ pr_id id ++ str "." ++ spc () ++
+ (str "Cannot build module " ++ DirPath.print p ++ str "." ++ Id.print id ++ str "." ++ spc () ++
str "it starts with prefix \"Coq\" which is reserved for the Coq library.")
let start_library fo =
@@ -625,7 +624,7 @@ let start_library fo =
try
let lp = Loadpath.find_load_path (Filename.dirname fo) in
Loadpath.logical lp
- with Not_found -> Nameops.default_root_prefix
+ with Not_found -> Libnames.default_root_prefix
in
let file = Filename.chop_extension (Filename.basename fo) in
let id = Id.of_string file in
@@ -665,7 +664,7 @@ let current_reexports () = !libraries_exports_list
let error_recursively_dependent_library dir =
user_err
- (strbrk "Unable to use logical name " ++ pr_dirpath dir ++
+ (strbrk "Unable to use logical name " ++ DirPath.print dir ++
strbrk " to save current library because" ++
strbrk " it already depends on a library of this name.")
@@ -739,7 +738,7 @@ let save_library_to ?todo dir f otab =
System.marshal_out_segment f' ch (opaque_table : seg_proofs);
close_out ch;
(* Writing native code files *)
- if !Flags.native_compiler then
+ if !Flags.output_native_objects then
let fn = Filename.dirname f'^"/"^Nativecode.mod_uid_of_dirpath dir in
if not (Nativelib.compile_library dir ast fn) then
user_err Pp.(str "Could not compile the library to native code.")
diff --git a/library/library.mli b/library/library.mli
index 6c624ce52..63e7b95bb 100644
--- a/library/library.mli
+++ b/library/library.mli
@@ -29,9 +29,9 @@ val require_library_from_dirpath : (DirPath.t * string) list -> bool option -> u
type seg_sum
type seg_lib
type seg_univ = (* cst, all_cst, finished? *)
- Univ.universe_context_set Future.computation array * Univ.universe_context_set * bool
+ Univ.ContextSet.t Future.computation array * Univ.ContextSet.t * bool
type seg_discharge = Opaqueproof.cooking_info list array
-type seg_proofs = Term.constr Future.computation array
+type seg_proofs = Constr.constr Future.computation array
(** Open a module (or a library); if the boolean is true then it's also
an export otherwise just a simple import *)
diff --git a/library/library.mllib b/library/library.mllib
index d94fc2291..e43bfb5a1 100644
--- a/library/library.mllib
+++ b/library/library.mllib
@@ -1,5 +1,3 @@
-Univops
-Nameops
Libnames
Globnames
Libobject
diff --git a/library/loadpath.ml b/library/loadpath.ml
index 757e972b1..eb6dae84a 100644
--- a/library/loadpath.ml
+++ b/library/loadpath.ml
@@ -54,8 +54,8 @@ 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 " ++
- pr_dirpath old_path ++ strbrk "; it is remapped to " ++
- pr_dirpath coq_path)
+ 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
@@ -75,7 +75,7 @@ let add_load_path phys_path coq_path ~implicit =
else
let () =
(* Do not warn when overriding the default "-I ." path *)
- if not (DirPath.equal old_path Nameops.default_root_prefix) then
+ if not (DirPath.equal old_path Libnames.default_root_prefix) then
warn_overriding_logical_loadpath (phys_path, old_path, coq_path)
in
true in
diff --git a/library/nametab.ml b/library/nametab.ml
index 0ec4a37cd..08881d6d7 100644
--- a/library/nametab.ml
+++ b/library/nametab.ml
@@ -81,8 +81,9 @@ struct
Module F (X : S). Module X.
The argument X of the functor F is masked by the inner module X.
*)
- let masking_absolute n =
- Flags.if_verbose Feedback.msg_info (str ("Trying to mask the absolute name \"" ^ U.to_string n ^ "\"!"))
+ let warn_masking_absolute =
+ CWarnings.create ~name:"masking-absolute-name" ~category:"deprecated"
+ (fun n -> str ("Trying to mask the absolute name \"" ^ U.to_string n ^ "\"!"))
type user_name = U.t
@@ -121,7 +122,7 @@ struct
| Absolute (n,_) ->
(* This is an absolute name, we must keep it
otherwise it may become unaccessible forever *)
- masking_absolute n; tree.path
+ warn_masking_absolute n; tree.path
| Nothing
| Relative _ -> Relative (uname,o)
else tree.path
@@ -154,7 +155,7 @@ let rec push_exactly uname o level tree = function
| Absolute (n,_) ->
(* This is an absolute name, we must keep it
otherwise it may become unaccessible forever *)
- masking_absolute n; tree.path
+ warn_masking_absolute n; tree.path
| Nothing
| Relative _ -> Relative (uname,o)
in
@@ -302,6 +303,16 @@ module DirTab = Make(DirPath')(GlobDir)
type dirtab = DirTab.t
let the_dirtab = ref (DirTab.empty : dirtab)
+type universe_id = DirPath.t * int
+
+module UnivIdEqual =
+struct
+ type t = universe_id
+ let equal (d, i) (d', i') = DirPath.equal d d' && Int.equal i i'
+end
+module UnivTab = Make(FullPath)(UnivIdEqual)
+type univtab = UnivTab.t
+let the_univtab = ref (UnivTab.empty : univtab)
(* Reversed name tables ***************************************************)
@@ -318,6 +329,21 @@ let the_modrevtab = ref (MPmap.empty : mprevtab)
type mptrevtab = full_path MPmap.t
let the_modtyperevtab = ref (MPmap.empty : mptrevtab)
+module UnivIdOrdered =
+struct
+ type t = universe_id
+ let hash (d, i) = i + DirPath.hash d
+ let compare (d, i) (d', i') =
+ let c = Int.compare i i' in
+ if Int.equal c 0 then DirPath.compare d d'
+ else c
+end
+
+module UnivIdMap = HMap.Make(UnivIdOrdered)
+
+type univrevtab = full_path UnivIdMap.t
+let the_univrevtab = ref (UnivIdMap.empty : univrevtab)
+
(* Push functions *********************************************************)
(* This is for permanent constructions (never discharged -- but with
@@ -359,9 +385,14 @@ let push_modtype vis sp kn =
let push_dir vis dir dir_ref =
the_dirtab := DirTab.push vis dir dir_ref !the_dirtab;
match dir_ref with
- DirModule (_,(mp,_)) -> the_modrevtab := MPmap.add mp dir !the_modrevtab
- | _ -> ()
+ | DirModule { obj_mp; _ } -> the_modrevtab := MPmap.add obj_mp dir !the_modrevtab
+ | _ -> ()
+
+(* This is for global universe names *)
+let push_universe vis sp univ =
+ the_univtab := UnivTab.push vis sp univ !the_univtab;
+ the_univrevtab := UnivIdMap.add univ sp !the_univrevtab
(* Locate functions *******************************************************)
@@ -382,21 +413,23 @@ let locate_syndef qid = match locate_extended qid with
let locate_modtype qid = MPTab.locate qid !the_modtypetab
let full_name_modtype qid = MPTab.user_name qid !the_modtypetab
+let locate_universe qid = UnivTab.locate qid !the_univtab
+
let locate_dir qid = DirTab.locate qid !the_dirtab
let locate_module qid =
match locate_dir qid with
- | DirModule (_,(mp,_)) -> mp
+ | DirModule { obj_mp ; _} -> obj_mp
| _ -> raise Not_found
let full_name_module qid =
match locate_dir qid with
- | DirModule (dir,_) -> dir
+ | DirModule { obj_dir ; _} -> obj_dir
| _ -> raise Not_found
let locate_section qid =
match locate_dir qid with
- | DirOpenSection (dir, _)
+ | DirOpenSection { obj_dir; _ } -> obj_dir
| DirClosedSection dir -> dir
| _ -> raise Not_found
@@ -447,6 +480,8 @@ let exists_module = exists_dir
let exists_modtype sp = MPTab.exists sp !the_modtypetab
+let exists_universe kn = UnivTab.exists kn !the_univtab
+
(* Reverse locate functions ***********************************************)
let path_of_global ref =
@@ -469,6 +504,9 @@ let dirpath_of_module mp =
let path_of_modtype mp =
MPmap.find mp !the_modtyperevtab
+let path_of_universe mp =
+ UnivIdMap.find mp !the_univrevtab
+
(* Shortest qualid functions **********************************************)
let shortest_qualid_of_global ctx ref =
@@ -490,6 +528,10 @@ let shortest_qualid_of_modtype kn =
let sp = MPmap.find kn !the_modtyperevtab in
MPTab.shortest_qualid Id.Set.empty sp !the_modtypetab
+let shortest_qualid_of_universe kn =
+ let sp = UnivIdMap.find kn !the_univrevtab in
+ UnivTab.shortest_qualid Id.Set.empty sp !the_univtab
+
let pr_global_env env ref =
try pr_qualid (shortest_qualid_of_global env ref)
with Not_found as e ->
@@ -508,24 +550,28 @@ let global_inductive r =
(********************************************************************)
(* Registration of tables as a global table and rollback *)
-type frozen = ccitab * dirtab * mptab
- * globrevtab * mprevtab * mptrevtab
+type frozen = ccitab * dirtab * mptab * univtab
+ * globrevtab * mprevtab * mptrevtab * univrevtab
let freeze _ : frozen =
!the_ccitab,
!the_dirtab,
!the_modtypetab,
+ !the_univtab,
!the_globrevtab,
!the_modrevtab,
- !the_modtyperevtab
+ !the_modtyperevtab,
+ !the_univrevtab
-let unfreeze (ccit,dirt,mtyt,globr,modr,mtyr) =
+let unfreeze (ccit,dirt,mtyt,univt,globr,modr,mtyr,univr) =
the_ccitab := ccit;
the_dirtab := dirt;
the_modtypetab := mtyt;
+ the_univtab := univt;
the_globrevtab := globr;
the_modrevtab := modr;
- the_modtyperevtab := mtyr
+ the_modtyperevtab := mtyr;
+ the_univrevtab := univr
let _ =
Summary.declare_summary "names"
diff --git a/library/nametab.mli b/library/nametab.mli
index 3a380637c..77fafa100 100644
--- a/library/nametab.mli
+++ b/library/nametab.mli
@@ -74,10 +74,16 @@ val error_global_not_found : ?loc:Loc.t -> qualid -> 'a
type visibility = Until of int | Exactly of int
val push : visibility -> full_path -> global_reference -> unit
-val push_modtype : visibility -> full_path -> module_path -> unit
+val push_modtype : visibility -> full_path -> ModPath.t -> unit
val push_dir : visibility -> DirPath.t -> global_dir_reference -> unit
val push_syndef : visibility -> full_path -> syndef_name -> unit
+type universe_id = DirPath.t * int
+
+module UnivIdMap : CMap.ExtS with type key = universe_id
+
+val push_universe : visibility -> full_path -> universe_id -> unit
+
(** {6 The following functions perform globalization of qualified names } *)
(** These functions globalize a (partially) qualified name or fail with
@@ -85,12 +91,13 @@ val push_syndef : visibility -> full_path -> syndef_name -> unit
val locate : qualid -> global_reference
val locate_extended : qualid -> extended_global_reference
-val locate_constant : qualid -> constant
+val locate_constant : qualid -> Constant.t
val locate_syndef : qualid -> syndef_name
-val locate_modtype : qualid -> module_path
+val locate_modtype : qualid -> ModPath.t
val locate_dir : qualid -> global_dir_reference
-val locate_module : qualid -> module_path
+val locate_module : qualid -> ModPath.t
val locate_section : qualid -> DirPath.t
+val locate_universe : qualid -> universe_id
(** These functions globalize user-level references into global
references, like [locate] and co, but raise a nice error message
@@ -105,7 +112,7 @@ val global_inductive : reference -> inductive
val locate_all : qualid -> global_reference list
val locate_extended_all : qualid -> extended_global_reference list
val locate_extended_all_dir : qualid -> global_dir_reference list
-val locate_extended_all_modtype : qualid -> module_path list
+val locate_extended_all_modtype : qualid -> ModPath.t list
(** Mapping a full path to a global reference *)
@@ -119,6 +126,7 @@ val exists_modtype : full_path -> bool
val exists_dir : DirPath.t -> bool
val exists_section : DirPath.t -> bool (** deprecated synonym of [exists_dir] *)
val exists_module : DirPath.t -> bool (** deprecated synonym of [exists_dir] *)
+val exists_universe : full_path -> bool
(** {6 These functions locate qualids into full user names } *)
@@ -135,8 +143,12 @@ val full_name_module : qualid -> DirPath.t
val path_of_syndef : syndef_name -> full_path
val path_of_global : global_reference -> full_path
-val dirpath_of_module : module_path -> DirPath.t
-val path_of_modtype : module_path -> full_path
+val dirpath_of_module : ModPath.t -> DirPath.t
+val path_of_modtype : ModPath.t -> full_path
+
+(** A universe_id might not be registered with a corresponding user name.
+ @raise Not_found if the universe was not introduced by the user. *)
+val path_of_universe : universe_id -> full_path
(** Returns in particular the dirpath or the basename of the full path
associated to global reference *)
@@ -156,8 +168,9 @@ val pr_global_env : Id.Set.t -> global_reference -> Pp.t
val shortest_qualid_of_global : Id.Set.t -> global_reference -> qualid
val shortest_qualid_of_syndef : Id.Set.t -> syndef_name -> qualid
-val shortest_qualid_of_modtype : module_path -> qualid
-val shortest_qualid_of_module : module_path -> qualid
+val shortest_qualid_of_modtype : ModPath.t -> qualid
+val shortest_qualid_of_module : ModPath.t -> qualid
+val shortest_qualid_of_universe : universe_id -> qualid
(** Deprecated synonyms *)
diff --git a/library/summary.ml b/library/summary.ml
index 9f49d1f83..6df17476b 100644
--- a/library/summary.ml
+++ b/library/summary.ml
@@ -13,17 +13,22 @@ open Util
module Dyn = Dyn.Make ()
type marshallable = [ `Yes | `No | `Shallow ]
+
type 'a summary_declaration = {
freeze_function : marshallable -> 'a;
unfreeze_function : 'a -> unit;
init_function : unit -> unit }
-let summaries = ref Int.Map.empty
+let sum_mod = ref None
+let sum_map = ref String.Map.empty
let mangle id = id ^ "-SUMMARY"
+let unmangle id = String.(sub id 0 (length id - 8))
+
+let ml_modules = "ML-MODULES"
-let internal_declare_summary hash sumname sdecl =
- let (infun, outfun) = Dyn.Easy.make_dyn (mangle sumname) in
+let internal_declare_summary fadd sumname sdecl =
+ let infun, outfun, tag = Dyn.Easy.make_dyn_tag (mangle sumname) in
let dyn_freeze b = infun (sdecl.freeze_function b)
and dyn_unfreeze sum = sdecl.unfreeze_function (outfun sum)
and dyn_init = sdecl.init_function in
@@ -32,140 +37,116 @@ let internal_declare_summary hash sumname sdecl =
unfreeze_function = dyn_unfreeze;
init_function = dyn_init }
in
- summaries := Int.Map.add hash (sumname, ddecl) !summaries
+ fadd sumname ddecl;
+ tag
-let all_declared_summaries = ref Int.Set.empty
+let declare_ml_modules_summary decl =
+ let ml_add _ ddecl = sum_mod := Some ddecl in
+ internal_declare_summary ml_add ml_modules decl
-let summary_names = ref []
-let name_of_summary name =
- try List.assoc name !summary_names
- with Not_found -> "summary name not found"
+let declare_ml_modules_summary decl =
+ ignore(declare_ml_modules_summary decl)
-let declare_summary sumname decl =
- let hash = String.hash sumname in
- let () = if Int.Map.mem hash !summaries then
- let (name, _) = Int.Map.find hash !summaries in
- anomaly ~label:"Summary.declare_summary"
- (str "Colliding summary names: " ++ str sumname ++ str " vs. " ++ str name ++ str ".")
+let declare_summary_tag sumname decl =
+ let fadd name ddecl = sum_map := String.Map.add name ddecl !sum_map in
+ let () = if String.Map.mem sumname !sum_map then
+ anomaly ~label:"Summary.declare_summary"
+ (str "Colliding summary names: " ++ str sumname ++ str " vs. " ++ str sumname ++ str ".")
in
- all_declared_summaries := Int.Set.add hash !all_declared_summaries;
- summary_names := (hash, sumname) :: !summary_names;
- internal_declare_summary hash sumname decl
+ internal_declare_summary fadd sumname decl
+
+let declare_summary sumname decl =
+ ignore(declare_summary_tag sumname decl)
type frozen = {
- summaries : (int * Dyn.t) list;
+ summaries : Dyn.t String.Map.t;
(** Ordered list w.r.t. the first component. *)
ml_module : Dyn.t option;
(** Special handling of the ml_module summary. *)
}
-let empty_frozen = { summaries = []; ml_module = None; }
-
-let ml_modules = "ML-MODULES"
-let ml_modules_summary = String.hash ml_modules
+let empty_frozen = { summaries = String.Map.empty; ml_module = None }
let freeze_summaries ~marshallable : frozen =
- let fold id (_, decl) accu =
- (* to debug missing Lazy.force
- if marshallable <> `No then begin
- let id, _ = Int.Map.find id !summaries in
- prerr_endline ("begin marshalling " ^ id);
- ignore(Marshal.to_string (decl.freeze_function marshallable) []);
- prerr_endline ("end marshalling " ^ id);
- end;
- /debug *)
- let state = decl.freeze_function marshallable in
- if Int.equal id ml_modules_summary then { accu with ml_module = Some state }
- else { accu with summaries = (id, state) :: accu.summaries }
+ let smap decl = decl.freeze_function marshallable in
+ { summaries = String.Map.map smap !sum_map;
+ ml_module = Option.map (fun decl -> decl.freeze_function marshallable) !sum_mod;
+ }
+
+let unfreeze_single name state =
+ let decl =
+ try String.Map.find name !sum_map
+ with
+ | Not_found ->
+ CErrors.anomaly Pp.(str "trying to unfreeze unregistered summary " ++ str name)
in
- Int.Map.fold_right fold !summaries empty_frozen
-
-let unfreeze_summaries fs =
+ try decl.unfreeze_function state
+ with e when CErrors.noncritical e ->
+ let e = CErrors.push e in
+ Feedback.msg_warning
+ Pp.(seq [str "Error unfreezing summary "; str name; fnl (); CErrors.iprint e]);
+ iraise e
+
+let unfreeze_summaries ?(partial=false) { summaries; ml_module } =
(* The unfreezing of [ml_modules_summary] has to be anticipated since it
- * may modify the content of [summaries] ny loading new ML modules *)
- let (_, decl) =
- try Int.Map.find ml_modules_summary !summaries
- with Not_found -> anomaly (str "Undeclared summary " ++ str ml_modules ++ str ".")
- in
- let () = match fs.ml_module with
+ * may modify the content of [summaries] by loading new ML modules *)
+ begin match !sum_mod with
| None -> anomaly (str "Undeclared summary " ++ str ml_modules ++ str ".")
- | Some state -> decl.unfreeze_function state
- in
- let fold id (_, decl) states =
- if Int.equal id ml_modules_summary then states
- else match states with
- | [] ->
- let () = decl.init_function () in
- []
- | (nid, state) :: rstates ->
- if Int.equal id nid then
- let () = decl.unfreeze_function state in rstates
- else
- let () = decl.init_function () in states
+ | Some decl -> Option.iter (fun state -> decl.unfreeze_function state) ml_module
+ end;
+ (** We must be independent on the order of the map! *)
+ let ufz name decl =
+ try decl.unfreeze_function String.Map.(find name summaries)
+ with Not_found ->
+ if not partial then begin
+ Feedback.msg_warning Pp.(str "Summary was captured out of module scope for entry " ++ str name);
+ decl.init_function ()
+ end;
in
- let fold id decl state =
- try fold id decl state
- with e when CErrors.noncritical e ->
- let e = CErrors.push e in
- Feedback.msg_error
- Pp.(seq [str "Error unfreezing summary %s\n%s\n%!";
- str (name_of_summary id);
- CErrors.iprint e]);
- iraise e
- in
- (** We rely on the order of the frozen list, and the order of folding *)
- ignore (Int.Map.fold_left fold !summaries fs.summaries)
+ (* String.Map.iter unfreeze_single !sum_map *)
+ String.Map.iter ufz !sum_map
let init_summaries () =
- Int.Map.iter (fun _ (_, decl) -> decl.init_function ()) !summaries
+ String.Map.iter (fun _ decl -> decl.init_function ()) !sum_map
(** For global tables registered statically before the end of coqtop
launch, the following empty [init_function] could be used. *)
let nop () = ()
-(** Selective freeze *)
+(** Summary projection *)
+let project_from_summary { summaries } tag =
+ let id = unmangle (Dyn.repr tag) in
+ let state = String.Map.find id summaries in
+ Option.get (Dyn.Easy.prj state tag)
+
+let modify_summary st tag v =
+ let id = unmangle (Dyn.repr tag) in
+ let summaries = String.Map.set id (Dyn.Easy.inj v tag) st.summaries in
+ {st with summaries}
-type frozen_bits = (int * Dyn.t) list
+let remove_from_summary st tag =
+ let id = unmangle (Dyn.repr tag) in
+ let summaries = String.Map.remove id st.summaries in
+ {st with summaries}
+
+(** Selective freeze *)
-let ids_of_string_list complement ids =
- if not complement then List.map String.hash ids
- else
- let fold accu id =
- let id = String.hash id in
- Int.Set.remove id accu
- in
- let ids = List.fold_left fold !all_declared_summaries ids in
- Int.Set.elements ids
+type frozen_bits = Dyn.t String.Map.t
let freeze_summary ~marshallable ?(complement=false) ids =
- let ids = ids_of_string_list complement ids in
- List.map (fun id ->
- let (_, summary) = Int.Map.find id !summaries in
- id, summary.freeze_function marshallable)
- ids
-
-let unfreeze_summary datas =
- List.iter
- (fun (id, data) ->
- let (name, summary) = Int.Map.find id !summaries in
- try summary.unfreeze_function data
- with e ->
- let e = CErrors.push e in
- prerr_endline ("Exception unfreezing " ^ name);
- iraise e)
- datas
+ let sub_map = String.Map.filter (fun id _ -> complement <> List.(mem id ids)) !sum_map in
+ String.Map.map (fun decl -> decl.freeze_function marshallable) sub_map
+
+let unfreeze_summary = String.Map.iter unfreeze_single
let surgery_summary { summaries; ml_module } bits =
- let summaries = List.map (fun (id, _ as orig) ->
- try id, List.assoc id bits
- with Not_found -> orig)
- summaries in
+ let summaries =
+ String.Map.fold (fun hash state sum -> String.Map.set hash state sum ) summaries bits in
{ summaries; ml_module }
let project_summary { summaries; ml_module } ?(complement=false) ids =
- let ids = ids_of_string_list complement ids in
- List.filter (fun (id, _) -> List.mem id ids) summaries
+ String.Map.filter (fun name _ -> complement <> List.(mem name ids)) summaries
let pointer_equal l1 l2 =
let ptr_equal d1 d2 =
@@ -174,19 +155,22 @@ let pointer_equal l1 l2 =
match Dyn.eq t1 t2 with
| None -> false
| Some Refl -> x1 == x2
- in
+ in
+ let l1, l2 = String.Map.bindings l1, String.Map.bindings l2 in
CList.for_all2eq
(fun (id1,v1) (id2,v2) -> id1 = id2 && ptr_equal v1 v2) l1 l2
(** All-in-one reference declaration + registration *)
-let ref ?(freeze=fun _ r -> r) ~name x =
+let ref_tag ?(freeze=fun _ r -> r) ~name x =
let r = ref x in
- declare_summary name
+ let tag = declare_summary_tag name
{ freeze_function = (fun b -> freeze b !r);
unfreeze_function = ((:=) r);
- init_function = (fun () -> r := x) };
- r
+ init_function = (fun () -> r := x) } in
+ r, tag
+
+let ref ?freeze ~name x = fst @@ ref_tag ?freeze ~name x
module Local = struct
@@ -198,8 +182,7 @@ let (!) r =
let key, name = !r in
try CEphemeron.get key
with CEphemeron.InvalidKey ->
- let _, { init_function } =
- Int.Map.find (String.hash (mangle name)) !summaries in
+ let { init_function } = String.Map.find name !sum_map in
init_function ();
CEphemeron.get (fst !r)
diff --git a/library/summary.mli b/library/summary.mli
index d093d95f2..09447199e 100644
--- a/library/summary.mli
+++ b/library/summary.mli
@@ -36,6 +36,12 @@ type 'a summary_declaration = {
val declare_summary : string -> 'a summary_declaration -> unit
+(** We provide safe projection from the summary to the types stored in
+ it.*)
+module Dyn : Dyn.S
+
+val declare_summary_tag : string -> 'a summary_declaration -> 'a Dyn.tag
+
(** All-in-one reference declaration + summary registration.
It behaves just as OCaml's standard [ref] function, except
that a [declare_summary] is done, with [name] as string.
@@ -43,6 +49,7 @@ val declare_summary : string -> 'a summary_declaration -> unit
The [freeze_function] can be overridden *)
val ref : ?freeze:(marshallable -> 'a -> 'a) -> name:string -> 'a -> 'a ref
+val ref_tag : ?freeze:(marshallable -> 'a -> 'a) -> name:string -> 'a -> 'a ref * 'a Dyn.tag
(* As [ref] but the value is local to a process, i.e. not sent to, say, proof
* workers. It is useful to implement a local cache for example. *)
@@ -55,10 +62,11 @@ module Local : sig
end
-(** Special name for the summary of ML modules. This summary entry is
- special because its unfreeze may load ML code and hence add summary
- entries. Thus is has to be recognizable, and handled appropriately *)
-val ml_modules : string
+(** Special summary for ML modules. This summary entry is special
+ because its unfreeze may load ML code and hence add summary
+ entries. Thus is has to be recognizable, and handled properly.
+ *)
+val declare_ml_modules_summary : 'a summary_declaration -> unit
(** For global tables registered statically before the end of coqtop
launch, the following empty [init_function] could be used. *)
@@ -72,19 +80,34 @@ type frozen
val empty_frozen : frozen
val freeze_summaries : marshallable:marshallable -> frozen
-val unfreeze_summaries : frozen -> unit
+val unfreeze_summaries : ?partial:bool -> frozen -> unit
val init_summaries : unit -> unit
-(** The type [frozen_bits] is a snapshot of some of the registered tables *)
+(** Typed projection of the summary. Experimental API, use with CARE *)
+
+val modify_summary : frozen -> 'a Dyn.tag -> 'a -> frozen
+val project_from_summary : frozen -> 'a Dyn.tag -> 'a
+val remove_from_summary : frozen -> 'a Dyn.tag -> frozen
+
+(** The type [frozen_bits] is a snapshot of some of the registered
+ tables. It is DEPRECATED in favor of the typed projection
+ version. *)
+
type frozen_bits
+[@@ocaml.deprecated "Please use the typed version of summary projection"]
-val freeze_summary :
- marshallable:marshallable -> ?complement:bool -> string list -> frozen_bits
+[@@@ocaml.warning "-3"]
+val freeze_summary : marshallable:marshallable -> ?complement:bool -> string list -> frozen_bits
+[@@ocaml.deprecated "Please use the typed version of summary projection"]
val unfreeze_summary : frozen_bits -> unit
+[@@ocaml.deprecated "Please use the typed version of summary projection"]
val surgery_summary : frozen -> frozen_bits -> frozen
+[@@ocaml.deprecated "Please use the typed version of summary projection"]
val project_summary : frozen -> ?complement:bool -> string list -> frozen_bits
+[@@ocaml.deprecated "Please use the typed version of summary projection"]
val pointer_equal : frozen_bits -> frozen_bits -> bool
+[@@ocaml.deprecated "Please use the typed version of summary projection"]
+[@@@ocaml.warning "+3"]
(** {6 Debug} *)
-
val dump : unit -> (int * string) list
diff --git a/library/univops.ml b/library/univops.ml
deleted file mode 100644
index 3bafb824d..000000000
--- a/library/univops.ml
+++ /dev/null
@@ -1,40 +0,0 @@
-(************************************************************************)
-(* v * The Coq Proof Assistant / The Coq Development Team *)
-(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *)
-(* \VV/ **************************************************************)
-(* // * This file is distributed under the terms of the *)
-(* * GNU Lesser General Public License Version 2.1 *)
-(************************************************************************)
-
-open Term
-open Univ
-
-let universes_of_constr c =
- let rec aux s c =
- match kind_of_term c with
- | Const (_, u) | Ind (_, u) | Construct (_, u) ->
- LSet.fold LSet.add (Instance.levels u) s
- | Sort u when not (Sorts.is_small u) ->
- let u = univ_of_sort u in
- LSet.fold LSet.add (Universe.levels u) s
- | _ -> fold_constr aux s c
- in aux LSet.empty c
-
-let restrict_universe_context (univs,csts) s =
- (* Universes that are not necessary to typecheck the term.
- E.g. univs introduced by tactics and not used in the proof term. *)
- let diff = LSet.diff univs s in
- let rec aux diff candid univs ness =
- let (diff', candid', univs', ness') =
- Constraint.fold
- (fun (l, d, r as c) (diff, candid, univs, csts) ->
- if not (LSet.mem l diff) then
- (LSet.remove r diff, candid, univs, Constraint.add c csts)
- else if not (LSet.mem r diff) then
- (LSet.remove l diff, candid, univs, Constraint.add c csts)
- else (diff, Constraint.add c candid, univs, csts))
- candid (diff, Constraint.empty, univs, ness)
- in
- if ness' == ness then (LSet.diff univs diff', ness)
- else aux diff' candid' univs' ness'
- in aux diff csts univs Constraint.empty
diff --git a/man/coqchk.1 b/man/coqchk.1
index 76a7cfc5d..f9241c0d4 100644
--- a/man/coqchk.1
+++ b/man/coqchk.1
@@ -23,7 +23,7 @@ library was not found, corrupted content, type-checking failure, etc.
.IR modules \&
is a list of modules to be checked. Modules can be referred to by a
-short or qualified name.
+short or qualified logical name, or by their filename.
.SH OPTIONS
@@ -34,13 +34,17 @@ add directory
in the include path
.TP
-.BI \-R \ dir\ coqdir
-recursively map physical
+.BI \-Q \ dir\ coqdir
+map physical
.I dir
to logical
.I coqdir
.TP
+.BI \-R \ dir\ coqdir
+synonymous for -Q
+
+.TP
.BI \-silent
makes coqchk less verbose.
diff --git a/man/coqmktop.1 b/man/coqmktop.1
deleted file mode 100644
index 810df782c..000000000
--- a/man/coqmktop.1
+++ /dev/null
@@ -1,71 +0,0 @@
-.TH COQ 1 "April 25, 2001"
-
-.SH NAME
-coqmktop \- The Coq Proof Assistant user-tactics linker
-
-
-.SH SYNOPSIS
-.B coqmktop
-[
-.I options
-]
-.I files
-
-
-.SH DESCRIPTION
-
-.B coqmktop
-builds a new Coq toplevel extended with user-tactics.
-.IR files \&
-are the Objective Caml object or library files
-(i.e. with suffix .cmo, .cmx, .cma or .cmxa) to link with the Coq system.
-The linker produces an executable Coq toplevel which can be called
-directly or through coqc(1), using the \-image option.
-
-.SH OPTIONS
-
-.TP
-.BI \-h
-Help. List the available options.
-
-.TP
-.BI \-srcdir \ dir
-Specify where the Coq source files are
-
-.TP
-.BI \-o \ exec\-file
-Specify the name of the resulting toplevel
-
-.TP
-.B \-opt
-Compile in native code
-
-.TP
-.B \-full
-Link high level tactics
-
-.TP
-.B \-top
-Build Coq on a ocaml toplevel (incompatible with
-.BR \-opt )
-
-.TP
-.BI \-R \ dir
-Specify recursively directories for Ocaml
-
-.TP
-.B \-v8
-Link with V8 grammar
-
-
-.SH SEE ALSO
-
-.BR coqtop (1),
-.BR ocamlmktop (1).
-.BR ocamlc (1).
-.BR ocamlopt (1).
-.br
-.I
-The Coq Reference Manual.
-.I
-The Coq web site: http://coq.inria.fr
diff --git a/parsing/egramcoq.ml b/parsing/egramcoq.ml
index d51b8b54e..9c2766187 100644
--- a/parsing/egramcoq.ml
+++ b/parsing/egramcoq.ml
@@ -35,7 +35,7 @@ let default_levels =
100,Extend.RightA,false;
99,Extend.RightA,true;
90,Extend.RightA,true;
- 10,Extend.RightA,false;
+ 10,Extend.LeftA,false;
9,Extend.RightA,false;
8,Extend.RightA,true;
1,Extend.LeftA,false;
@@ -46,8 +46,7 @@ let default_pattern_levels =
100,Extend.RightA,false;
99,Extend.RightA,true;
90,Extend.RightA,true;
- 11,Extend.LeftA,false;
- 10,Extend.RightA,false;
+ 10,Extend.LeftA,false;
1,Extend.LeftA,false;
0,Extend.RightA,false]
@@ -259,9 +258,11 @@ let is_binder_level from e = match e with
| (NumLevel 200, (BorderProd (Right, _) | InternalProd)) -> from = 200
| _ -> false
-let make_sep_rules tkl =
- let rec mkrule : Tok.t list -> unit rules = function
- | [] -> Rules ({ norec_rule = Stop }, ignore)
+let make_sep_rules = function
+ | [tk] -> Atoken tk
+ | tkl ->
+ let rec mkrule : Tok.t list -> string rules = function
+ | [] -> Rules ({ norec_rule = Stop }, fun _ -> (* dropped anyway: *) "")
| tkn :: rem ->
let Rules ({ norec_rule = r }, f) = mkrule rem in
let r = { norec_rule = Next (r, Atoken tkn) } in
@@ -440,7 +441,7 @@ let make_act : type r. r target -> _ -> r gen_eval = function
CAst.make ~loc @@ CNotation (notation , env)
| ForPattern -> fun notation loc env ->
let invalid = List.exists (fun (_, b) -> not b) env.binders in
- let () = if invalid then Topconstr.error_invalid_pattern_notation ~loc () in
+ let () = if invalid then Constrexpr_ops.error_invalid_pattern_notation ~loc () in
let env = (env.constrs, env.constrlists) in
CAst.make ~loc @@ CPatNotation (notation, env, [])
diff --git a/parsing/g_constr.ml4 b/parsing/g_constr.ml4
index 844c040fd..db68a75e0 100644
--- a/parsing/g_constr.ml4
+++ b/parsing/g_constr.ml4
@@ -155,9 +155,15 @@ GEXTEND Gram
| "Type" -> Sorts.InType
] ]
;
+ universe_expr:
+ [ [ id = global; "+"; n = natural -> Some (id,n)
+ | id = global -> Some (id,0)
+ | "_" -> None
+ ] ]
+ ;
universe:
- [ [ IDENT "max"; "("; ids = LIST1 name SEP ","; ")" -> ids
- | id = name -> [id]
+ [ [ IDENT "max"; "("; ids = LIST1 universe_expr SEP ","; ")" -> ids
+ | u = universe_expr -> [u]
] ]
;
lconstr:
@@ -261,17 +267,17 @@ GEXTEND Gram
| "let"; "'"; p=pattern; ":="; c1 = operconstr LEVEL "200";
"in"; c2 = operconstr LEVEL "200" ->
CAst.make ~loc:!@loc @@
- CCases (LetPatternStyle, None, [c1, None, None], [Loc.tag ~loc:!@loc ([(Loc.tag ~loc:!@loc [p])], c2)])
+ CCases (LetPatternStyle, None, [c1, None, None], [Loc.tag ~loc:!@loc ([[p]], c2)])
| "let"; "'"; p=pattern; ":="; c1 = operconstr LEVEL "200";
rt = case_type; "in"; c2 = operconstr LEVEL "200" ->
CAst.make ~loc:!@loc @@
- CCases (LetPatternStyle, Some rt, [c1, aliasvar p, None], [Loc.tag ~loc:!@loc ([(Loc.tag ~loc:!@loc [p])], c2)])
+ CCases (LetPatternStyle, Some rt, [c1, aliasvar p, None], [Loc.tag ~loc:!@loc ([[p]], c2)])
| "let"; "'"; p=pattern; "in"; t = pattern LEVEL "200";
":="; c1 = operconstr LEVEL "200"; rt = case_type;
"in"; c2 = operconstr LEVEL "200" ->
CAst.make ~loc:!@loc @@
- CCases (LetPatternStyle, Some rt, [c1, aliasvar p, Some t], [Loc.tag ~loc:!@loc ([(Loc.tag ~loc:!@loc [p])], c2)])
+ CCases (LetPatternStyle, Some rt, [c1, aliasvar p, Some t], [Loc.tag ~loc:!@loc ([[p]], c2)])
| "if"; c=operconstr LEVEL "200"; po = return_type;
"then"; b1=operconstr LEVEL "200";
"else"; b2=operconstr LEVEL "200" ->
@@ -307,8 +313,9 @@ GEXTEND Gram
universe_level:
[ [ "Set" -> GSet
| "Prop" -> GProp
- | "Type" -> GType None
- | id = name -> GType (Some id)
+ | "Type" -> GType UUnknown
+ | "_" -> GType UAnonymous
+ | id = global -> GType (UNamed id)
] ]
;
fix_constr:
@@ -355,7 +362,7 @@ GEXTEND Gram
[ [ OPT"|"; br=LIST0 eqn SEP "|" -> br ] ]
;
mult_pattern:
- [ [ pl = LIST1 pattern LEVEL "99" SEP "," -> (Loc.tag ~loc:!@loc pl) ] ]
+ [ [ pl = LIST1 pattern LEVEL "99" SEP "," -> pl ] ]
;
eqn:
[ [ pll = LIST1 mult_pattern SEP "|";
@@ -377,11 +384,10 @@ GEXTEND Gram
[ p = pattern; "|"; pl = LIST1 pattern SEP "|" -> CAst.make ~loc:!@loc @@ CPatOr (p::pl) ]
| "99" RIGHTA [ ]
| "90" RIGHTA [ ]
- | "11" LEFTA
+ | "10" LEFTA
[ p = pattern; "as"; id = ident ->
- CAst.make ~loc:!@loc @@ CPatAlias (p, id) ]
- | "10" RIGHTA
- [ p = pattern; lp = LIST1 NEXT ->
+ CAst.make ~loc:!@loc @@ CPatAlias (p, id)
+ | p = pattern; lp = LIST1 NEXT ->
(let open CAst in match p with
| { v = CPatAtom (Some r) } -> CAst.make ~loc:!@loc @@ CPatCstr (r, None, lp)
| { v = CPatCstr (r, None, l2); loc } ->
@@ -392,7 +398,7 @@ GEXTEND Gram
| _ -> CErrors.user_err
?loc:(cases_pattern_expr_loc p) ~hdr:"compound_pattern"
(Pp.str "Such pattern cannot have arguments."))
- |"@"; r = Prim.reference; lp = LIST0 NEXT ->
+ | "@"; r = Prim.reference; lp = LIST0 NEXT ->
CAst.make ~loc:!@loc @@ CPatCstr (r, Some lp, []) ]
| "1" LEFTA
[ c = pattern; "%"; key=IDENT -> CAst.make ~loc:!@loc @@ CPatDelimiters (key,c) ]
diff --git a/parsing/g_proofs.ml4 b/parsing/g_proofs.ml4
index f10d74677..1c3ba7837 100644
--- a/parsing/g_proofs.ml4
+++ b/parsing/g_proofs.ml4
@@ -28,7 +28,8 @@ GEXTEND Gram
| ":"; l = LIST1 [id = IDENT -> id ] -> l ] ]
;
command:
- [ [ IDENT "Goal"; c = lconstr -> VernacGoal c
+ [ [ IDENT "Goal"; c = lconstr ->
+ VernacDefinition (Decl_kinds.(NoDischarge, Definition), ((Loc.tag ~loc:!@loc Names.Anonymous), None), ProveBody ([], c))
| IDENT "Proof" -> VernacProof (None,None)
| IDENT "Proof" ; IDENT "Mode" ; mn = string -> VernacProofMode mn
| IDENT "Proof"; c = lconstr -> VernacExactProof c
@@ -70,19 +71,16 @@ GEXTEND Gram
VernacCreateHintDb (id, b)
| IDENT "Remove"; IDENT "Hints"; ids = LIST1 global; dbnames = opt_hintbases ->
VernacRemoveHints (dbnames, ids)
- | IDENT "Hint"; local = obsolete_locality; h = hint;
+ | IDENT "Hint"; h = hint;
dbnames = opt_hintbases ->
- VernacHints (local,dbnames, h)
+ VernacHints (dbnames, h)
(* Declare "Resolve" explicitly so as to be able to later extend with
"Resolve ->" and "Resolve <-" *)
| IDENT "Hint"; IDENT "Resolve"; lc = LIST1 reference_or_constr;
info = hint_info; dbnames = opt_hintbases ->
- VernacHints (false,dbnames,
+ VernacHints (dbnames,
HintsResolve (List.map (fun x -> (info, true, x)) lc))
] ];
- obsolete_locality:
- [ [ IDENT "Local" -> true | -> false ] ]
- ;
reference_or_constr:
[ [ r = global -> HintsReference r
| c = constr -> HintsConstr c ] ]
diff --git a/parsing/g_vernac.ml4 b/parsing/g_vernac.ml4
index a5b58b855..3244b0ff2 100644
--- a/parsing/g_vernac.ml4
+++ b/parsing/g_vernac.ml4
@@ -15,6 +15,7 @@ open Constrexpr_ops
open Extend
open Vernacexpr
open Decl_kinds
+open Declarations
open Misctypes
open Tok (* necessary for camlp4 *)
@@ -65,39 +66,42 @@ let parse_compat_version ?(allow_old = true) = let open Flags in function
Pp.(str "Unknown compatibility version \"" ++ str s ++ str "\".")
GEXTEND Gram
- GLOBAL: vernac gallina_ext noedit_mode subprf;
- vernac: FIRST
- [ [ IDENT "Time"; c = located_vernac -> VernacTime c
+ GLOBAL: vernac_control gallina_ext noedit_mode subprf;
+ vernac_control: FIRST
+ [ [ IDENT "Time"; c = located_vernac -> VernacTime (false,c)
| IDENT "Redirect"; s = ne_string; c = located_vernac -> VernacRedirect (s, c)
- | IDENT "Timeout"; n = natural; v = vernac -> VernacTimeout(n,v)
- | IDENT "Fail"; v = vernac -> VernacFail v
-
- | IDENT "Local"; v = vernac_poly -> VernacLocal (true, v)
- | IDENT "Global"; v = vernac_poly -> VernacLocal (false, v)
+ | IDENT "Timeout"; n = natural; v = vernac_control -> VernacTimeout(n,v)
+ | IDENT "Fail"; v = vernac_control -> VernacFail v
+ | (f, v) = vernac -> VernacExpr(f, v) ]
+ ]
+ ;
+ vernac:
+ [ [ IDENT "Local"; (f, v) = vernac_poly -> (VernacLocal true :: f, v)
+ | IDENT "Global"; (f, v) = vernac_poly -> (VernacLocal false :: f, v)
| v = vernac_poly -> v ]
]
;
vernac_poly:
- [ [ IDENT "Polymorphic"; v = vernac_aux -> VernacPolymorphic (true, v)
- | IDENT "Monomorphic"; v = vernac_aux -> VernacPolymorphic (false, v)
+ [ [ IDENT "Polymorphic"; (f, v) = vernac_aux -> (VernacPolymorphic true :: f, v)
+ | IDENT "Monomorphic"; (f, v) = vernac_aux -> (VernacPolymorphic false :: f, v)
| v = vernac_aux -> v ]
]
;
vernac_aux:
(* Better to parse "." here: in case of failure (e.g. in coerce_to_var), *)
(* "." is still in the stream and discard_to_dot works correctly *)
- [ [ IDENT "Program"; g = gallina; "." -> VernacProgram g
- | IDENT "Program"; g = gallina_ext; "." -> VernacProgram g
- | g = gallina; "." -> g
- | g = gallina_ext; "." -> g
- | c = command; "." -> c
- | c = syntax; "." -> c
- | c = subprf -> c
+ [ [ IDENT "Program"; g = gallina; "." -> ([VernacProgram], g)
+ | IDENT "Program"; g = gallina_ext; "." -> ([VernacProgram], g)
+ | g = gallina; "." -> ([], g)
+ | g = gallina_ext; "." -> ([], g)
+ | c = command; "." -> ([], c)
+ | c = syntax; "." -> ([], c)
+ | c = subprf -> ([], c)
] ]
;
vernac_aux: LAST
- [ [ prfcom = command_entry -> prfcom ] ]
+ [ [ prfcom = command_entry -> ([], prfcom) ] ]
;
noedit_mode:
[ [ c = query_command -> c None] ]
@@ -111,7 +115,7 @@ GEXTEND Gram
;
located_vernac:
- [ [ v = vernac -> Loc.tag ~loc:!@loc v ] ]
+ [ [ v = vernac_control -> Loc.tag ~loc:!@loc v ] ]
;
END
@@ -129,33 +133,33 @@ let test_plural_form_types loc kwd = function
warn_plural_command ~loc:!@loc kwd
| _ -> ()
-let fresh_var env c =
- Namegen.next_ident_away (Id.of_string "pat")
- (List.fold_left (fun accu id -> Id.Set.add id accu) (Topconstr.free_vars_of_constr_expr c) env)
+let lname_of_lident : lident -> lname =
+ Loc.map (fun s -> Name s)
-let _ = Hook.set Constrexpr_ops.fresh_var_hook fresh_var
+let name_of_ident_decl : ident_decl -> name_decl =
+ on_fst lname_of_lident
(* Gallina declarations *)
GEXTEND Gram
GLOBAL: gallina gallina_ext thm_token def_body of_type_with_opt_coercion
- record_field decl_notation rec_definition pidentref ident_decl;
+ record_field decl_notation rec_definition ident_decl;
gallina:
(* Definition, Theorem, Variable, Axiom, ... *)
[ [ thm = thm_token; id = ident_decl; bl = binders; ":"; c = lconstr;
l = LIST0
[ "with"; id = ident_decl; bl = binders; ":"; c = lconstr ->
- (Some id,(bl,c)) ] ->
- VernacStartTheoremProof (thm, (Some id,(bl,c))::l)
+ (id,(bl,c)) ] ->
+ VernacStartTheoremProof (thm, (id,(bl,c))::l)
| stre = assumption_token; nl = inline; bl = assum_list ->
VernacAssumption (stre, nl, bl)
| (kwd,stre) = assumptions_token; nl = inline; bl = assum_list ->
test_plural_form loc kwd bl;
VernacAssumption (stre, nl, bl)
| d = def_token; id = ident_decl; b = def_body ->
- VernacDefinition (d, id, b)
+ VernacDefinition (d, name_of_ident_decl id, b)
| IDENT "Let"; id = identref; b = def_body ->
- VernacDefinition ((Some Discharge, Definition), (id, None), b)
+ VernacDefinition ((DoDischarge, Let), (lname_of_lident id, None), b)
(* Gallina inductive declarations *)
| cum = cumulativity_token; priv = private_token; f = finite_token;
indl = LIST1 inductive_definition SEP "with" ->
@@ -173,13 +177,13 @@ GEXTEND Gram
in
VernacInductive (cum, priv,f,indl)
| "Fixpoint"; recs = LIST1 rec_definition SEP "with" ->
- VernacFixpoint (None, recs)
+ VernacFixpoint (NoDischarge, recs)
| IDENT "Let"; "Fixpoint"; recs = LIST1 rec_definition SEP "with" ->
- VernacFixpoint (Some Discharge, recs)
+ VernacFixpoint (DoDischarge, recs)
| "CoFixpoint"; corecs = LIST1 corec_definition SEP "with" ->
- VernacCoFixpoint (None, corecs)
+ VernacCoFixpoint (NoDischarge, corecs)
| IDENT "Let"; "CoFixpoint"; corecs = LIST1 corec_definition SEP "with" ->
- VernacCoFixpoint (Some Discharge, corecs)
+ VernacCoFixpoint (DoDischarge, corecs)
| IDENT "Scheme"; l = LIST1 scheme SEP "with" -> VernacScheme l
| IDENT "Combined"; IDENT "Scheme"; id = identref; IDENT "from";
l = LIST1 identref SEP "," -> VernacCombinedScheme (id, l)
@@ -201,23 +205,23 @@ GEXTEND Gram
| IDENT "Property" -> Property ] ]
;
def_token:
- [ [ "Definition" -> (None, Definition)
- | IDENT "Example" -> (None, Example)
- | IDENT "SubClass" -> (None, SubClass) ] ]
+ [ [ "Definition" -> (NoDischarge,Definition)
+ | IDENT "Example" -> (NoDischarge,Example)
+ | IDENT "SubClass" -> (NoDischarge,SubClass) ] ]
;
assumption_token:
- [ [ "Hypothesis" -> (Some Discharge, Logical)
- | "Variable" -> (Some Discharge, Definitional)
- | "Axiom" -> (None, Logical)
- | "Parameter" -> (None, Definitional)
- | IDENT "Conjecture" -> (None, Conjectural) ] ]
+ [ [ "Hypothesis" -> (DoDischarge, Logical)
+ | "Variable" -> (DoDischarge, Definitional)
+ | "Axiom" -> (NoDischarge, Logical)
+ | "Parameter" -> (NoDischarge, Definitional)
+ | IDENT "Conjecture" -> (NoDischarge, Conjectural) ] ]
;
assumptions_token:
- [ [ IDENT "Hypotheses" -> ("Hypotheses", (Some Discharge, Logical))
- | IDENT "Variables" -> ("Variables", (Some Discharge, Definitional))
- | IDENT "Axioms" -> ("Axioms", (None, Logical))
- | IDENT "Parameters" -> ("Parameters", (None, Definitional))
- | IDENT "Conjectures" -> ("Conjectures", (None, Conjectural)) ] ]
+ [ [ IDENT "Hypotheses" -> ("Hypotheses", (DoDischarge, Logical))
+ | IDENT "Variables" -> ("Variables", (DoDischarge, Definitional))
+ | IDENT "Axioms" -> ("Axioms", (NoDischarge, Logical))
+ | IDENT "Parameters" -> ("Parameters", (NoDischarge, Definitional))
+ | IDENT "Conjectures" -> ("Conjectures", (NoDischarge, Conjectural)) ] ]
;
inline:
[ [ IDENT "Inline"; "("; i = INT; ")" -> InlineAt (int_of_string i)
@@ -228,9 +232,6 @@ GEXTEND Gram
[ [ l = universe_level; ord = [ "<" -> Univ.Lt | "=" -> Univ.Eq | "<=" -> Univ.Le ];
r = universe_level -> (l, ord, r) ] ]
;
- pidentref:
- [ [ i = identref; l = OPT [ "@{" ; l = LIST0 identref; "}" -> l ] -> (i,l) ] ]
- ;
univ_decl :
[ [ "@{" ; l = LIST0 identref; ext = [ "+" -> true | -> false ];
cs = [ "|"; l' = LIST0 univ_constraint SEP ",";
@@ -626,37 +627,23 @@ GEXTEND Gram
VernacCanonical (AN qid)
| IDENT "Canonical"; IDENT "Structure"; ntn = by_notation ->
VernacCanonical (ByNotation ntn)
- | IDENT "Canonical"; IDENT "Structure"; qid = global;
- d = def_body ->
+ | IDENT "Canonical"; IDENT "Structure"; qid = global; d = def_body ->
let s = coerce_reference_to_id qid in
- VernacDefinition
- ((Some Global,CanonicalStructure),((Loc.tag s),None),d)
+ VernacDefinition ((NoDischarge,CanonicalStructure),((Loc.tag (Name s)),None),d)
(* Coercions *)
| IDENT "Coercion"; qid = global; d = def_body ->
let s = coerce_reference_to_id qid in
- VernacDefinition ((None,Coercion),((Loc.tag s),None),d)
- | IDENT "Coercion"; IDENT "Local"; qid = global; d = def_body ->
- let s = coerce_reference_to_id qid in
- VernacDefinition ((Some Decl_kinds.Local,Coercion),((Loc.tag s),None),d)
- | IDENT "Identity"; IDENT "Coercion"; IDENT "Local"; f = identref;
- ":"; s = class_rawexpr; ">->"; t = class_rawexpr ->
- VernacIdentityCoercion (true, f, s, t)
+ VernacDefinition ((NoDischarge,Coercion),((Loc.tag (Name s)),None),d)
| IDENT "Identity"; IDENT "Coercion"; f = identref; ":";
s = class_rawexpr; ">->"; t = class_rawexpr ->
- VernacIdentityCoercion (false, f, s, t)
- | IDENT "Coercion"; IDENT "Local"; qid = global; ":";
- s = class_rawexpr; ">->"; t = class_rawexpr ->
- VernacCoercion (true, AN qid, s, t)
- | IDENT "Coercion"; IDENT "Local"; ntn = by_notation; ":";
- s = class_rawexpr; ">->"; t = class_rawexpr ->
- VernacCoercion (true, ByNotation ntn, s, t)
+ VernacIdentityCoercion (f, s, t)
| IDENT "Coercion"; qid = global; ":"; s = class_rawexpr; ">->";
t = class_rawexpr ->
- VernacCoercion (false, AN qid, s, t)
+ VernacCoercion (AN qid, s, t)
| IDENT "Coercion"; ntn = by_notation; ":"; s = class_rawexpr; ">->";
t = class_rawexpr ->
- VernacCoercion (false, ByNotation ntn, s, t)
+ VernacCoercion (ByNotation ntn, s, t)
| IDENT "Context"; c = binders ->
VernacContext c
@@ -884,7 +871,7 @@ GEXTEND Gram
(* Printing (careful factorization of entries) *)
| IDENT "Print"; p = printable -> VernacPrint p
- | IDENT "Print"; qid = smart_global -> VernacPrint (PrintName qid)
+ | IDENT "Print"; qid = smart_global; l = OPT univ_name_list -> VernacPrint (PrintName (qid,l))
| IDENT "Print"; IDENT "Module"; "Type"; qid = global ->
VernacPrint (PrintModuleType qid)
| IDENT "Print"; IDENT "Module"; qid = global ->
@@ -949,8 +936,8 @@ GEXTEND Gram
| IDENT "Check"; c = lconstr; "." ->
fun g -> VernacCheckMayEval (None, g, c)
(* Searching the environment *)
- | IDENT "About"; qid = smart_global; "." ->
- fun g -> VernacPrint (PrintAbout (qid,g))
+ | IDENT "About"; qid = smart_global; l = OPT univ_name_list; "." ->
+ fun g -> VernacPrint (PrintAbout (qid,l,g))
| IDENT "SearchHead"; c = constr_pattern; l = in_or_out_modules; "." ->
fun g -> VernacSearch (SearchHead c,g, l)
| IDENT "SearchPattern"; c = constr_pattern; l = in_or_out_modules; "." ->
@@ -969,7 +956,7 @@ GEXTEND Gram
] ]
;
printable:
- [ [ IDENT "Term"; qid = smart_global -> PrintName qid
+ [ [ IDENT "Term"; qid = smart_global; l = OPT univ_name_list -> PrintName (qid,l)
| IDENT "All" -> PrintFullContext
| IDENT "Section"; s = global -> PrintSectionContext s
| IDENT "Grammar"; ent = IDENT ->
@@ -1069,6 +1056,9 @@ GEXTEND Gram
| -> ([],SearchOutside [])
] ]
;
+ univ_name_list:
+ [ [ "@{" ; l = LIST0 name; "}" -> l ] ]
+ ;
END;
GEXTEND Gram
@@ -1112,11 +1102,11 @@ GEXTEND Gram
GLOBAL: syntax;
syntax:
- [ [ IDENT "Open"; local = obsolete_locality; IDENT "Scope"; sc = IDENT ->
- VernacOpenCloseScope (local,(true,sc))
+ [ [ IDENT "Open"; IDENT "Scope"; sc = IDENT ->
+ VernacOpenCloseScope (true,sc)
- | IDENT "Close"; local = obsolete_locality; IDENT "Scope"; sc = IDENT ->
- VernacOpenCloseScope (local,(false,sc))
+ | IDENT "Close"; IDENT "Scope"; sc = IDENT ->
+ VernacOpenCloseScope (false,sc)
| IDENT "Delimit"; IDENT "Scope"; sc = IDENT; "with"; key = IDENT ->
VernacDelimiters (sc, Some key)
@@ -1126,32 +1116,31 @@ GEXTEND Gram
| IDENT "Bind"; IDENT "Scope"; sc = IDENT; "with";
refl = LIST1 class_rawexpr -> VernacBindScope (sc,refl)
- | IDENT "Infix"; local = obsolete_locality;
- op = ne_lstring; ":="; p = constr;
+ | IDENT "Infix"; op = ne_lstring; ":="; p = constr;
modl = [ "("; l = LIST1 syntax_modifier SEP ","; ")" -> l | -> [] ];
sc = OPT [ ":"; sc = IDENT -> sc ] ->
- VernacInfix (local,(op,modl),p,sc)
- | IDENT "Notation"; local = obsolete_locality; id = identref;
+ VernacInfix ((op,modl),p,sc)
+ | IDENT "Notation"; id = identref;
idl = LIST0 ident; ":="; c = constr; b = only_parsing ->
VernacSyntacticDefinition
- (id,(idl,c),local,b)
- | IDENT "Notation"; local = obsolete_locality; s = lstring; ":=";
+ (id,(idl,c),b)
+ | IDENT "Notation"; s = lstring; ":=";
c = constr;
modl = [ "("; l = LIST1 syntax_modifier SEP ","; ")" -> l | -> [] ];
sc = OPT [ ":"; sc = IDENT -> sc ] ->
- VernacNotation (local,c,(s,modl),sc)
+ VernacNotation (c,(s,modl),sc)
| IDENT "Format"; IDENT "Notation"; n = STRING; s = STRING; fmt = STRING ->
VernacNotationAddFormat (n,s,fmt)
| IDENT "Reserved"; IDENT "Infix"; s = ne_lstring;
l = [ "("; l = LIST1 syntax_modifier SEP ","; ")" -> l | -> [] ] ->
let (loc,s) = s in
- VernacSyntaxExtension (true, false,((loc,"x '"^s^"' y"),l))
+ VernacSyntaxExtension (true,((loc,"x '"^s^"' y"),l))
- | IDENT "Reserved"; IDENT "Notation"; local = obsolete_locality;
+ | IDENT "Reserved"; IDENT "Notation";
s = ne_lstring;
l = [ "("; l = LIST1 syntax_modifier SEP ","; ")" -> l | -> [] ]
- -> VernacSyntaxExtension (false, local,(s,l))
+ -> VernacSyntaxExtension (false, (s,l))
(* "Print" "Grammar" should be here but is in "command" entry in order
to factorize with other "Print"-based vernac entries *)
@@ -1164,9 +1153,6 @@ GEXTEND Gram
Some (parse_compat_version s)
| -> None ] ]
;
- obsolete_locality:
- [ [ IDENT "Local" -> true | -> false ] ]
- ;
level:
[ [ IDENT "level"; n = natural -> NumLevel n
| IDENT "next"; IDENT "level" -> NextLevel ] ]
diff --git a/parsing/pcoq.ml b/parsing/pcoq.ml
index d34da159e..c934d38a2 100644
--- a/parsing/pcoq.ml
+++ b/parsing/pcoq.ml
@@ -444,7 +444,6 @@ module Prim =
let name = Gram.entry_create "Prim.name"
let identref = Gram.entry_create "Prim.identref"
- let pidentref = Gram.entry_create "Prim.pidentref"
let ident_decl = Gram.entry_create "Prim.ident_decl"
let pattern_ident = Gram.entry_create "pattern_ident"
let pattern_identref = Gram.entry_create "pattern_identref"
@@ -504,8 +503,7 @@ module Vernac_ =
let gallina_ext = gec_vernac "gallina_ext"
let command = gec_vernac "command"
let syntax = gec_vernac "syntax_command"
- let vernac = gec_vernac "Vernac.vernac"
- let vernac_eoi = eoi_entry vernac
+ let vernac_control = gec_vernac "Vernac.vernac_control"
let rec_definition = gec_vernac "Vernac.rec_definition"
let red_expr = make_gen_entry utactic "red_expr"
let hint_info = gec_vernac "hint_info"
@@ -518,7 +516,7 @@ module Vernac_ =
let act_eoi = Gram.action (fun _ loc -> None) in
let rule = [
([ Symbols.stoken Tok.EOI ], act_eoi);
- ([ Symbols.snterm (Gram.Entry.obj vernac) ], act_vernac );
+ ([ Symbols.snterm (Gram.Entry.obj vernac_control) ], act_vernac );
] in
uncurry (Gram.extend main_entry) (None, make_rule rule)
@@ -612,8 +610,8 @@ let unfreeze (grams, lex) =
the lexer state should not be resetted, since it contains
keywords declared in g_*.ml4 *)
-let _ =
- Summary.declare_summary "GRAMMAR_LEXER"
+let parser_summary_tag =
+ Summary.declare_summary_tag "GRAMMAR_LEXER"
{ Summary.freeze_function = freeze;
Summary.unfreeze_function = unfreeze;
Summary.init_function = Summary.nop }
diff --git a/parsing/pcoq.mli b/parsing/pcoq.mli
index 2f0375419..756d9487d 100644
--- a/parsing/pcoq.mli
+++ b/parsing/pcoq.mli
@@ -194,7 +194,6 @@ module Prim :
val ident : Id.t Gram.entry
val name : Name.t located Gram.entry
val identref : Id.t located Gram.entry
- val pidentref : (Id.t located * (Id.t located list) option) Gram.entry
val ident_decl : ident_decl Gram.entry
val pattern_ident : Id.t Gram.entry
val pattern_identref : Id.t located Gram.entry
@@ -252,9 +251,8 @@ module Vernac_ :
val gallina_ext : vernac_expr Gram.entry
val command : vernac_expr Gram.entry
val syntax : vernac_expr Gram.entry
- val vernac : vernac_expr Gram.entry
+ val vernac_control : vernac_control Gram.entry
val rec_definition : (fixpoint_expr * decl_notation list) Gram.entry
- val vernac_eoi : vernac_expr Gram.entry
val noedit_mode : vernac_expr Gram.entry
val command_entry : vernac_expr Gram.entry
val red_expr : raw_red_expr Gram.entry
@@ -262,7 +260,7 @@ module Vernac_ :
end
(** The main entry: reads an optional vernac command *)
-val main_entry : (Loc.t * vernac_expr) option Gram.entry
+val main_entry : (Loc.t * vernac_control) option Gram.entry
(** Handling of the proof mode entry *)
val get_command_entry : unit -> vernac_expr Gram.entry
@@ -314,3 +312,6 @@ val with_grammar_rule_protection : ('a -> 'b) -> 'a -> 'b
(** Location Utils *)
val to_coqloc : Ploc.t -> Loc.t
val (!@) : Ploc.t -> Loc.t
+
+type frozen_t
+val parser_summary_tag : frozen_t Summary.Dyn.tag
diff --git a/plugins/.merlin b/plugins/.merlin
index dd6678ba0..2ba616962 100644
--- a/plugins/.merlin
+++ b/plugins/.merlin
@@ -1,2 +1 @@
REC
-FLG -open API
diff --git a/plugins/btauto/refl_btauto.ml b/plugins/btauto/refl_btauto.ml
index 6281b2675..a09abfa19 100644
--- a/plugins/btauto/refl_btauto.ml
+++ b/plugins/btauto/refl_btauto.ml
@@ -12,12 +12,12 @@ let get_inductive dir s =
let glob_ref () = Coqlib.find_reference contrib_name ("Coq" :: dir) s in
Lazy.from_fun (fun () -> Globnames.destIndRef (glob_ref ()))
-let decomp_term sigma (c : Term.constr) =
- Term.kind_of_term (EConstr.Unsafe.to_constr (Termops.strip_outer_cast sigma (EConstr.of_constr c)))
+let decomp_term sigma (c : Constr.t) =
+ Constr.kind (EConstr.Unsafe.to_constr (Termops.strip_outer_cast sigma (EConstr.of_constr c)))
-let lapp c v = Term.mkApp (Lazy.force c, v)
+let lapp c v = Constr.mkApp (Lazy.force c, v)
-let (===) = Term.eq_constr
+let (===) = Constr.equal
module CoqList = struct
let path = ["Init"; "Datatypes"]
@@ -53,17 +53,11 @@ end
module Env = struct
- module ConstrHashed = struct
- type t = Term.constr
- let equal = Term.eq_constr
- let hash = Term.hash_constr
- end
-
- module ConstrHashtbl = Hashtbl.Make (ConstrHashed)
+ module ConstrHashtbl = Hashtbl.Make (Constr)
type t = (int ConstrHashtbl.t * int ref)
- let add (tbl, off) (t : Term.constr) =
+ let add (tbl, off) (t : Constr.t) =
try ConstrHashtbl.find tbl t
with
| Not_found ->
@@ -103,7 +97,7 @@ module Bool = struct
| Negb of t
| Ifb of t * t * t
- let quote (env : Env.t) sigma (c : Term.constr) : t =
+ let quote (env : Env.t) sigma (c : Constr.t) : t =
let trueb = Lazy.force trueb in
let falseb = Lazy.force falseb in
let andb = Lazy.force andb in
@@ -170,7 +164,7 @@ module Btauto = struct
| Bool.Xorb (b1, b2) -> lapp f_xor [|convert b1; convert b2|]
| Bool.Ifb (b1, b2, b3) -> lapp f_ifb [|convert b1; convert b2; convert b3|]
- let convert_env env : Term.constr =
+ let convert_env env : Constr.t =
CoqList.of_list (Lazy.force Bool.typ) env
let reify env t = lapp eval [|convert_env env; convert t|]
@@ -206,7 +200,8 @@ module Btauto = struct
let assign = List.combine env var in
let map_msg (key, v) =
let b = if v then str "true" else str "false" in
- let term = Printer.pr_constr key in
+ let sigma, env = Pfedit.get_current_context () in
+ let term = Printer.pr_constr_env env sigma key in
term ++ spc () ++ str ":=" ++ spc () ++ b
in
let assign = List.map map_msg assign in
@@ -249,7 +244,7 @@ module Btauto = struct
let env = Env.to_list env in
let fl = reify env fl in
let fr = reify env fr in
- let changed_gl = Term.mkApp (c, [|typ; fl; fr|]) in
+ let changed_gl = Constr.mkApp (c, [|typ; fl; fr|]) in
let changed_gl = EConstr.of_constr changed_gl in
Tacticals.New.tclTHENLIST [
Tactics.change_concl changed_gl;
diff --git a/plugins/cc/ccalgo.ml b/plugins/cc/ccalgo.ml
index 182821322..ccef9ab96 100644
--- a/plugins/cc/ccalgo.ml
+++ b/plugins/cc/ccalgo.ml
@@ -11,14 +11,15 @@
(* Plus some e-matching and constructor handling by P. Corbineau *)
open CErrors
-open Util
open Pp
-open Goptions
open Names
-open Term
+open Sorts
+open Constr
open Vars
-open Tacmach
open Evd
+open Goptions
+open Tacmach
+open Util
let init_size=5
@@ -154,7 +155,7 @@ let rec term_equal t1 t2 =
open Hashset.Combine
let rec hash_term = function
- | Symb c -> combine 1 (hash_constr c)
+ | Symb c -> combine 1 (Constr.hash c)
| Product (s1, s2) -> combine3 2 (Sorts.hash s1) (Sorts.hash s2)
| Eps i -> combine 3 (Id.hash i)
| Appli (t1, t2) -> combine3 4 (hash_term t1) (hash_term t2)
@@ -215,7 +216,7 @@ type representative=
mutable lfathers:Int.Set.t;
mutable fathers:Int.Set.t;
mutable inductive_status: inductive_status;
- class_type : Term.types;
+ class_type : types;
mutable functions: Int.Set.t PafMap.t} (*pac -> term = app(constr,t) *)
type cl = Rep of representative| Eqto of int*equality
@@ -232,7 +233,7 @@ type node =
module Constrhash = Hashtbl.Make
(struct type t = constr
let equal = eq_constr_nounivs
- let hash = hash_constr
+ let hash = Constr.hash
end)
module Typehash = Constrhash
@@ -436,9 +437,9 @@ and make_app l=function
and applist_proj c l =
match c with
| Symb s -> applist_projection s l
- | _ -> applistc (constr_of_term c) l
+ | _ -> Term.applistc (constr_of_term c) l
and applist_projection c l =
- match kind_of_term c with
+ match Constr.kind c with
| Const c when Environ.is_projection (fst c) (Global.env()) ->
let p = Projection.make (fst c) false in
(match l with
@@ -446,15 +447,15 @@ and applist_projection c l =
let ty = Typeops.type_of_constant_in (Global.env ()) c in (* FIXME constraints *)
let pb = Environ.lookup_projection p (Global.env()) in
let ctx,_ = Term.decompose_prod_n_assum (pb.Declarations.proj_npars + 1) ty in
- it_mkLambda_or_LetIn (mkProj(p,mkRel 1)) ctx
+ Term.it_mkLambda_or_LetIn (mkProj(p,mkRel 1)) ctx
| hd :: tl ->
- applistc (mkProj (p, hd)) tl)
- | _ -> applistc c l
+ Term.applistc (mkProj (p, hd)) tl)
+ | _ -> Term.applistc c l
let rec canonize_name sigma c =
let c = EConstr.Unsafe.to_constr c in
let func c = canonize_name sigma (EConstr.of_constr c) in
- match kind_of_term c with
+ match Constr.kind c with
| Const (kn,u) ->
let canon_const = Constant.make1 (Constant.canonical kn) in
(mkConstU (canon_const,u))
@@ -837,7 +838,7 @@ let complete_one_class state i=
let _args =
List.map (fun i -> constr_of_term (term state.uf i))
pac.args in
- let typ = prod_applist _c (List.rev _args) in
+ let typ = Term.prod_applist _c (List.rev _args) in
let ct = app (term state.uf i) typ pac.arity in
state.uf.epsilons <- pac :: state.uf.epsilons;
ignore (add_term state ct)
diff --git a/plugins/cc/ccalgo.mli b/plugins/cc/ccalgo.mli
index f904aa3e6..23cd2161d 100644
--- a/plugins/cc/ccalgo.mli
+++ b/plugins/cc/ccalgo.mli
@@ -7,7 +7,7 @@
(************************************************************************)
open Util
-open Term
+open Constr
open Names
type pa_constructor =
@@ -85,7 +85,7 @@ type representative=
mutable lfathers:Int.Set.t;
mutable fathers:Int.Set.t;
mutable inductive_status: inductive_status;
- class_type : Term.types;
+ class_type : types;
mutable functions: Int.Set.t PafMap.t} (*pac -> term = app(constr,t) *)
type cl = Rep of representative| Eqto of int*equality
diff --git a/plugins/cc/ccproof.ml b/plugins/cc/ccproof.ml
index a43a167e8..97efaced8 100644
--- a/plugins/cc/ccproof.ml
+++ b/plugins/cc/ccproof.ml
@@ -10,7 +10,7 @@
(* proof-trees that will be transformed into proof-terms in cctac.ml4 *)
open CErrors
-open Term
+open Constr
open Ccalgo
open Pp
diff --git a/plugins/cc/ccproof.mli b/plugins/cc/ccproof.mli
index 9f53123db..a3e450134 100644
--- a/plugins/cc/ccproof.mli
+++ b/plugins/cc/ccproof.mli
@@ -7,7 +7,7 @@
(************************************************************************)
open Ccalgo
-open Term
+open Constr
type rule=
Ax of constr
diff --git a/plugins/cc/cctac.ml b/plugins/cc/cctac.ml
index 150319f6b..8642df684 100644
--- a/plugins/cc/cctac.ml
+++ b/plugins/cc/cctac.ml
@@ -12,7 +12,7 @@ open Evd
open Names
open Inductiveops
open Declarations
-open Term
+open Constr
open EConstr
open Vars
open Tactics
@@ -76,11 +76,11 @@ let rec decompose_term env sigma t=
let (mind,i_ind),u = c in
let u = EInstance.kind sigma u in
let canon_mind = MutInd.make1 (MutInd.canonical mind) in
- let canon_ind = canon_mind,i_ind in (Symb (Term.mkIndU (canon_ind,u)))
+ let canon_ind = canon_mind,i_ind in (Symb (Constr.mkIndU (canon_ind,u)))
| Const (c,u) ->
let u = EInstance.kind sigma u in
let canon_const = Constant.make1 (Constant.canonical c) in
- (Symb (Term.mkConstU (canon_const,u)))
+ (Symb (Constr.mkConstU (canon_const,u)))
| Proj (p, c) ->
let canon_const kn = Constant.make1 (Constant.canonical kn) in
let p' = Projection.map canon_const p in
@@ -198,7 +198,7 @@ let make_prb gls depth additionnal_terms =
(fun decl ->
let id = NamedDecl.get_id decl in
begin
- let cid=Term.mkVar id in
+ let cid=Constr.mkVar id in
match litteral_of_constr env sigma (NamedDecl.get_type decl) with
`Eq (t,a,b) -> add_equality state cid a b
| `Neq (t,a,b) -> add_disequality state (Hyp cid) a b
diff --git a/plugins/derive/derive.ml b/plugins/derive/derive.ml
index 6d3d4b743..c8c4c2dad 100644
--- a/plugins/derive/derive.ml
+++ b/plugins/derive/derive.ml
@@ -6,9 +6,10 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
+open Constr
open Context.Named.Declaration
-let map_const_entry_body (f:Term.constr->Term.constr) (x:Safe_typing.private_constants Entries.const_entry_body)
+let map_const_entry_body (f:constr->constr) (x:Safe_typing.private_constants Entries.const_entry_body)
: Safe_typing.private_constants Entries.const_entry_body =
Future.chain x begin fun ((b,ctx),fx) ->
(f b , ctx) , fx
@@ -37,9 +38,8 @@ let start_deriving f suchthat lemma =
let f_type = EConstr.Unsafe.to_constr f_type in
let ef = EConstr.Unsafe.to_constr ef in
let env' = Environ.push_named (LocalDef (f, ef, f_type)) env in
- let evdref = ref sigma in
- let suchthat = Constrintern.interp_type_evars env' evdref suchthat in
- TCons ( env' , !evdref , suchthat , (fun sigma _ ->
+ let sigma, suchthat = Constrintern.interp_type_evars env' sigma suchthat in
+ TCons ( env' , sigma , suchthat , (fun sigma _ ->
TNil sigma))))))
in
@@ -67,7 +67,7 @@ let start_deriving f suchthat lemma =
let f_def = { f_def with Entries.const_entry_opaque = false } in
let f_def = Entries.DefinitionEntry f_def , Decl_kinds.(IsDefinition Definition) in
let f_kn = Declare.declare_constant f f_def in
- let f_kn_term = Term.mkConst f_kn in
+ let f_kn_term = mkConst f_kn in
(** In the type and body of the proof of [suchthat] there can be
references to the variable [f]. It needs to be replaced by
references to the constant [f] declared above. This substitution
diff --git a/plugins/extraction/extract_env.ml b/plugins/extraction/extract_env.ml
index 3c46d5c43..bc84df76b 100644
--- a/plugins/extraction/extract_env.ml
+++ b/plugins/extraction/extract_env.ml
@@ -7,7 +7,7 @@
(************************************************************************)
open Miniml
-open Term
+open Constr
open Declarations
open Names
open ModPath
@@ -138,7 +138,7 @@ let check_arity env cb =
let check_fix env cb i =
match cb.const_body with
| Def lbody ->
- (match kind_of_term (Mod_subst.force_constr lbody) with
+ (match Constr.kind (Mod_subst.force_constr lbody) with
| Fix ((_,j),recd) when Int.equal i j -> check_arity env cb; (true,recd)
| CoFix (j,recd) when Int.equal i j -> check_arity env cb; (false,recd)
| _ -> raise Impossible)
@@ -146,8 +146,8 @@ let check_fix env cb i =
let prec_declaration_equal (na1, ca1, ta1) (na2, ca2, ta2) =
Array.equal Name.equal na1 na2 &&
- Array.equal eq_constr ca1 ca2 &&
- Array.equal eq_constr ta1 ta2
+ Array.equal Constr.equal ca1 ca2 &&
+ Array.equal Constr.equal ta1 ta2
let factor_fix env l cb msb =
let _,recd as check = check_fix env cb 0 in
diff --git a/plugins/extraction/extract_env.mli b/plugins/extraction/extract_env.mli
index 7bbb825b1..dd8617738 100644
--- a/plugins/extraction/extract_env.mli
+++ b/plugins/extraction/extract_env.mli
@@ -34,4 +34,4 @@ val print_one_decl :
(* Used by Extraction Compute *)
val structure_for_compute :
- Term.constr -> (Miniml.ml_decl list) * Miniml.ml_ast * Miniml.ml_type
+ Constr.t -> (Miniml.ml_decl list) * Miniml.ml_ast * Miniml.ml_type
diff --git a/plugins/extraction/extraction.ml b/plugins/extraction/extraction.ml
index a227478d0..c169b7b50 100644
--- a/plugins/extraction/extraction.ml
+++ b/plugins/extraction/extraction.ml
@@ -10,6 +10,7 @@
open Util
open Names
open Term
+open Constr
open Vars
open Declarations
open Declareops
@@ -81,7 +82,7 @@ let whd_betaiotazeta t =
let rec flag_of_type env t : flag =
let t = whd_all env t in
- match kind_of_term t with
+ match Constr.kind t with
| Prod (x,t,c) -> flag_of_type (push_rel (LocalAssum (x,t)) env) c
| Sort s when Sorts.is_prop s -> (Logic,TypeScheme)
| Sort _ -> (Info,TypeScheme)
@@ -111,14 +112,14 @@ let push_rel_assum (n, t) env =
(*s [type_sign] gernerates a signature aimed at treating a type application. *)
let rec type_sign env c =
- match kind_of_term (whd_all env c) with
+ match Constr.kind (whd_all env c) with
| Prod (n,t,d) ->
(if is_info_scheme env t then Keep else Kill Kprop)
:: (type_sign (push_rel_assum (n,t) env) d)
| _ -> []
let rec type_scheme_nb_args env c =
- match kind_of_term (whd_all env c) with
+ match Constr.kind (whd_all env c) with
| Prod (n,t,d) ->
let n = type_scheme_nb_args (push_rel_assum (n,t) env) d in
if is_info_scheme env t then n+1 else n
@@ -145,7 +146,7 @@ let make_typvar n vl =
next_ident_away id' vl
let rec type_sign_vl env c =
- match kind_of_term (whd_all env c) with
+ match Constr.kind (whd_all env c) with
| Prod (n,t,d) ->
let s,vl = type_sign_vl (push_rel_assum (n,t) env) d in
if not (is_info_scheme env t) then Kill Kprop::s, vl
@@ -153,7 +154,7 @@ let rec type_sign_vl env c =
| _ -> [],[]
let rec nb_default_params env c =
- match kind_of_term (whd_all env c) with
+ match Constr.kind (whd_all env c) with
| Prod (n,t,d) ->
let n = nb_default_params (push_rel_assum (n,t) env) d in
if is_default env t then n+1 else n
@@ -207,7 +208,7 @@ let parse_ind_args si args relmax =
| [] -> Int.Map.empty
| Kill _ :: s -> parse (i+1) j s
| Keep :: s ->
- (match kind_of_term args.(i-1) with
+ (match Constr.kind args.(i-1) with
| Rel k -> Int.Map.add (relmax+1-k) j (parse (i+1) (j+1) s)
| _ -> parse (i+1) (j+1) s)
in parse 1 1 si
@@ -224,7 +225,7 @@ let parse_ind_args si args relmax =
let rec extract_type env db j c args =
- match kind_of_term (whd_betaiotazeta c) with
+ match Constr.kind (whd_betaiotazeta c) with
| App (d, args') ->
(* We just accumulate the arguments. *)
extract_type env db j d (Array.to_list args' @ args)
@@ -299,9 +300,9 @@ let rec extract_type env db j c args =
| Proj (p,t) ->
(* Let's try to reduce, if it hasn't already been done. *)
if Projection.unfolded p then Tunknown
- else extract_type env db j (Term.mkProj (Projection.unfold p, t)) args
+ else extract_type env db j (mkProj (Projection.unfold p, t)) args
| Case _ | Fix _ | CoFix _ -> Tunknown
- | _ -> assert false
+ | Var _ | Meta _ | Evar _ | Cast _ | LetIn _ | Construct _ -> assert false
(*s Auxiliary function dealing with type application.
Precondition: [r] is a type scheme represented by the signature [s],
@@ -331,7 +332,7 @@ and extract_type_scheme env db c p =
if Int.equal p 0 then extract_type env db 0 c []
else
let c = whd_betaiotazeta c in
- match kind_of_term c with
+ match Constr.kind c with
| Lambda (n,t,d) ->
extract_type_scheme (push_rel_assum (n,t) env) db d (p-1)
| _ ->
@@ -415,8 +416,8 @@ and extract_really_ind env kn mib =
let t = snd (decompose_prod_n npar types.(j)) in
let prods,head = dest_prod epar t in
let nprods = List.length prods in
- let args = match kind_of_term head with
- | App (f,args) -> args (* [kind_of_term f = Ind ip] *)
+ let args = match Constr.kind head with
+ | App (f,args) -> args (* [Constr.kind f = Ind ip] *)
| _ -> [||]
in
let dbmap = parse_ind_args p.ip_sign args (nprods + npar) in
@@ -430,7 +431,7 @@ and extract_really_ind env kn mib =
let ip = (kn, 0) in
let r = IndRef ip in
if is_custom r then raise (I Standard);
- if mib.mind_finite == Decl_kinds.CoFinite then raise (I Coinductive);
+ if mib.mind_finite == CoFinite then raise (I Coinductive);
if not (Int.equal mib.mind_ntypes 1) then raise (I Standard);
let p,u = packets.(0) in
if p.ip_logical then raise (I Standard);
@@ -444,7 +445,7 @@ and extract_really_ind env kn mib =
if Option.is_empty mib.mind_record then raise (I Standard);
(* Now we're sure it's a record. *)
(* First, we find its field names. *)
- let rec names_prod t = match kind_of_term t with
+ let rec names_prod t = match Constr.kind t with
| Prod(n,_,t) -> n::(names_prod t)
| LetIn(_,_,_,t) -> names_prod t
| Cast(t,_,_) -> names_prod t
@@ -503,7 +504,7 @@ and extract_really_ind env kn mib =
*)
and extract_type_cons env db dbmap c i =
- match kind_of_term (whd_all env c) with
+ match Constr.kind (whd_all env c) with
| Prod (n,t,d) ->
let env' = push_rel_assum (n,t) env in
let db' = (try Int.Map.find i dbmap with Not_found -> 0) :: db in
@@ -564,7 +565,7 @@ let record_constant_type env kn opt_typ =
(* [mlt] is the ML type we want our extraction of [(c args)] to have. *)
let rec extract_term env mle mlt c args =
- match kind_of_term c with
+ match Constr.kind c with
| App (f,a) ->
extract_term env mle mlt f (Array.to_list a @ args)
| Lambda (n, t, d) ->
@@ -874,7 +875,7 @@ let decomp_lams_eta_n n m env c t =
(* Let's try to identify some situation where extracted code
will allow generalisation of type variables *)
-let rec gentypvar_ok c = match kind_of_term c with
+let rec gentypvar_ok c = match Constr.kind c with
| Lambda _ | Const _ -> true
| App (c,v) ->
(* if all arguments are variables, these variables will
diff --git a/plugins/extraction/extraction.mli b/plugins/extraction/extraction.mli
index e1d43f340..b15b88ed2 100644
--- a/plugins/extraction/extraction.mli
+++ b/plugins/extraction/extraction.mli
@@ -9,7 +9,7 @@
(*s Extraction from Coq terms to Miniml. *)
open Names
-open Term
+open Constr
open Declarations
open Environ
open Miniml
diff --git a/plugins/extraction/g_extraction.ml4 b/plugins/extraction/g_extraction.ml4
index 23452febd..24c70bccf 100644
--- a/plugins/extraction/g_extraction.ml4
+++ b/plugins/extraction/g_extraction.ml4
@@ -42,14 +42,20 @@ ARGUMENT EXTEND int_or_id
END
let pr_language = function
- | Ocaml -> str "Ocaml"
+ | Ocaml -> str "OCaml"
| Haskell -> str "Haskell"
| Scheme -> str "Scheme"
| JSON -> str "JSON"
+let warn_deprecated_ocaml_spelling =
+ CWarnings.create ~name:"deprecated-ocaml-spelling" ~category:"deprecated"
+ (fun () ->
+ strbrk ("The spelling \"OCaml\" should be used instead of \"Ocaml\"."))
+
VERNAC ARGUMENT EXTEND language
PRINTED BY pr_language
-| [ "Ocaml" ] -> [ Ocaml ]
+| [ "Ocaml" ] -> [ let _ = warn_deprecated_ocaml_spelling () in Ocaml ]
+| [ "OCaml" ] -> [ Ocaml ]
| [ "Haskell" ] -> [ Haskell ]
| [ "Scheme" ] -> [ Scheme ]
| [ "JSON" ] -> [ JSON ]
diff --git a/plugins/extraction/haskell.ml b/plugins/extraction/haskell.ml
index f708307c3..28abb7f57 100644
--- a/plugins/extraction/haskell.ml
+++ b/plugins/extraction/haskell.ml
@@ -58,7 +58,6 @@ let preamble mod_name comment used_modules usf =
else
str "#ifdef __GLASGOW_HASKELL__" ++ fnl () ++
str "import qualified GHC.Base" ++ fnl () ++
- str "import qualified GHC.Prim" ++ fnl () ++
str "#else" ++ fnl () ++
str "-- HUGS" ++ fnl () ++
str "import qualified IOExts" ++ fnl () ++
@@ -78,7 +77,7 @@ let preamble mod_name comment used_modules usf =
(if not usf.tunknown then mt ()
else
str "#ifdef __GLASGOW_HASKELL__" ++ fnl () ++
- str "type Any = GHC.Prim.Any" ++ fnl () ++
+ str "type Any = GHC.Base.Any" ++ fnl () ++
str "#else" ++ fnl () ++
str "-- HUGS" ++ fnl () ++
str "type Any = ()" ++ fnl () ++
diff --git a/plugins/extraction/ocaml.ml b/plugins/extraction/ocaml.ml
index 9cbc3fd71..5d0f9c167 100644
--- a/plugins/extraction/ocaml.ml
+++ b/plugins/extraction/ocaml.ml
@@ -100,11 +100,41 @@ let pp_global k r = str (str_global k r)
let pp_modname mp = str (Common.pp_module mp)
+(* grammar from OCaml 4.06 manual, "Prefix and infix symbols" *)
+
+let infix_symbols =
+ ['=' ; '<' ; '>' ; '@' ; '^' ; ';' ; '&' ; '+' ; '-' ; '*' ; '/' ; '$' ; '%' ]
+let operator_chars =
+ [ '!' ; '$' ; '%' ; '&' ; '*' ; '+' ; '-' ; '.' ; '/' ; ':' ; '<' ; '=' ; '>' ; '?' ; '@' ; '^' ; '|' ; '~' ]
+
+(* infix ops in OCaml, but disallowed by preceding grammar *)
+
+let builtin_infixes =
+ [ "::" ; "," ]
+
+let substring_all_opchars s start stop =
+ let rec check_char i =
+ if i >= stop then true
+ else
+ List.mem s.[i] operator_chars && check_char (i+1)
+ in
+ check_char start
+
let is_infix r =
is_inline_custom r &&
(let s = find_custom r in
- let l = String.length s in
- l >= 2 && s.[0] == '(' && s.[l-1] == ')')
+ let len = String.length s in
+ len >= 3 &&
+ (* parenthesized *)
+ (s.[0] == '(' && s.[len-1] == ')' &&
+ let inparens = String.trim (String.sub s 1 (len - 2)) in
+ let inparens_len = String.length inparens in
+ (* either, begins with infix symbol, any remainder is all operator chars *)
+ (List.mem inparens.[0] infix_symbols && substring_all_opchars inparens 1 inparens_len) ||
+ (* or, starts with #, at least one more char, all are operator chars *)
+ (inparens.[0] == '#' && inparens_len >= 2 && substring_all_opchars inparens 1 inparens_len) ||
+ (* or, is an OCaml built-in infix *)
+ (List.mem inparens builtin_infixes)))
let get_infix r =
let s = find_custom r in
diff --git a/plugins/extraction/table.ml b/plugins/extraction/table.ml
index 995d5fd19..5903733a6 100644
--- a/plugins/extraction/table.ml
+++ b/plugins/extraction/table.ml
@@ -486,7 +486,7 @@ let check_loaded_modfile mp = match base_mp mp with
if not (Library.library_is_loaded dp) then begin
match base_mp (Lib.current_mp ()) with
| MPfile dp' when not (DirPath.equal dp dp') ->
- err (str "Please load library " ++ pr_dirpath dp ++ str " first.")
+ err (str "Please load library " ++ DirPath.print dp ++ str " first.")
| _ -> ()
end
| _ -> ()
diff --git a/plugins/extraction/table.mli b/plugins/extraction/table.mli
index cc93f294b..e52e419fd 100644
--- a/plugins/extraction/table.mli
+++ b/plugins/extraction/table.mli
@@ -180,7 +180,7 @@ val implicits_of_global : global_reference -> Int.Set.t
(*s Table for user-given custom ML extractions. *)
(* UGLY HACK: registration of a function defined in [extraction.ml] *)
-val type_scheme_nb_args_hook : (Environ.env -> Term.constr -> int) Hook.t
+val type_scheme_nb_args_hook : (Environ.env -> Constr.t -> int) Hook.t
val is_custom : global_reference -> bool
val is_inline_custom : global_reference -> bool
diff --git a/plugins/firstorder/formula.ml b/plugins/firstorder/formula.ml
index db1a46a03..4c59996aa 100644
--- a/plugins/firstorder/formula.ml
+++ b/plugins/firstorder/formula.ml
@@ -8,7 +8,7 @@
open Hipattern
open Names
-open Term
+open Constr
open EConstr
open Vars
open Termops
@@ -39,7 +39,7 @@ exception Is_atom of constr
let meta_succ m = m+1
let rec nb_prod_after n c=
- match kind_of_term c with
+ match Constr.kind c with
| Prod (_,_,b) ->if n>0 then nb_prod_after (n-1) b else
1+(nb_prod_after 0 b)
| _ -> 0
@@ -55,7 +55,8 @@ let ind_hyps env sigma nevar ind largs =
let types= Inductiveops.arities_of_constructors env ind in
let myhyps t =
let t = EConstr.of_constr t in
- let t1=Termops.prod_applist sigma t largs in
+ let nparam_decls = Context.Rel.length (fst (Global.lookup_inductive (fst ind))).mind_params_ctxt in
+ let t1=Termops.prod_applist_assum sigma nparam_decls t largs in
let t2=snd (decompose_prod_n_assum sigma nevar t1) in
fst (decompose_prod_assum sigma t2) in
Array.map myhyps types
diff --git a/plugins/firstorder/formula.mli b/plugins/firstorder/formula.mli
index 106c469c6..3b6b711c0 100644
--- a/plugins/firstorder/formula.mli
+++ b/plugins/firstorder/formula.mli
@@ -6,7 +6,7 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-open Term
+open Constr
open EConstr
open Globnames
diff --git a/plugins/firstorder/g_ground.ml4 b/plugins/firstorder/g_ground.ml4
index 1e7da3250..b81010c7b 100644
--- a/plugins/firstorder/g_ground.ml4
+++ b/plugins/firstorder/g_ground.ml4
@@ -40,17 +40,17 @@ let _=
in
declare_int_option gdopt
-let congruence_depth=ref 100
let _=
+ let congruence_depth=ref 100 in
let gdopt=
- { optdepr=false;
+ { optdepr=true; (* noop *)
optname="Congruence Depth";
optkey=["Congruence";"Depth"];
optread=(fun ()->Some !congruence_depth);
optwrite=
(function
- None->congruence_depth:=0
+ None->congruence_depth:=0
| Some i->congruence_depth:=(max i 0))}
in
declare_int_option gdopt
@@ -65,11 +65,14 @@ let default_intuition_tac =
let (set_default_solver, default_solver, print_default_solver) =
Tactic_option.declare_tactic_option ~default:default_intuition_tac "Firstorder default solver"
-VERNAC COMMAND EXTEND Firstorder_Set_Solver CLASSIFIED AS SIDEFF
+VERNAC COMMAND FUNCTIONAL EXTEND Firstorder_Set_Solver CLASSIFIED AS SIDEFF
| [ "Set" "Firstorder" "Solver" tactic(t) ] -> [
- set_default_solver
- (Locality.make_section_locality (Locality.LocalityFixme.consume ()))
- (Tacintern.glob_tactic t) ]
+ fun ~atts ~st -> let open Vernacinterp in
+ set_default_solver
+ (Locality.make_section_locality atts.locality)
+ (Tacintern.glob_tactic t);
+ st
+ ]
END
VERNAC COMMAND EXTEND Firstorder_Print_Solver CLASSIFIED AS QUERY
diff --git a/plugins/firstorder/ground.ml b/plugins/firstorder/ground.ml
index f660ba734..d46201335 100644
--- a/plugins/firstorder/ground.ml
+++ b/plugins/firstorder/ground.ml
@@ -11,7 +11,7 @@ open Formula
open Sequent
open Rules
open Instances
-open Term
+open Constr
open Tacmach.New
open Tacticals.New
diff --git a/plugins/firstorder/instances.ml b/plugins/firstorder/instances.ml
index c2606dbe8..3409471a7 100644
--- a/plugins/firstorder/instances.ml
+++ b/plugins/firstorder/instances.ml
@@ -24,7 +24,7 @@ open Misctypes
open Context.Rel.Declaration
let compare_instance inst1 inst2=
- let cmp c1 c2 = OrderedConstr.compare (EConstr.Unsafe.to_constr c1) (EConstr.Unsafe.to_constr c2) in
+ let cmp c1 c2 = Constr.compare (EConstr.Unsafe.to_constr c1) (EConstr.Unsafe.to_constr c2) in
match inst1,inst2 with
Phantom(d1),Phantom(d2)->
(cmp d1 d2)
diff --git a/plugins/firstorder/rules.ml b/plugins/firstorder/rules.ml
index d6309b057..1a6eba8c6 100644
--- a/plugins/firstorder/rules.ml
+++ b/plugins/firstorder/rules.ml
@@ -235,8 +235,8 @@ let constant str = Universes.constr_of_global
@@ Coqlib.coq_reference "User" ["Init";"Logic"] str
let defined_connectives=lazy
- [AllOccurrences,EvalConstRef (fst (Term.destConst (constant "not")));
- AllOccurrences,EvalConstRef (fst (Term.destConst (constant "iff")))]
+ [AllOccurrences,EvalConstRef (fst (Constr.destConst (constant "not")));
+ AllOccurrences,EvalConstRef (fst (Constr.destConst (constant "iff")))]
let normalize_evaluables=
Proofview.Goal.enter begin fun gl ->
diff --git a/plugins/firstorder/rules.mli b/plugins/firstorder/rules.mli
index d8d4c1a38..5c46f4cec 100644
--- a/plugins/firstorder/rules.mli
+++ b/plugins/firstorder/rules.mli
@@ -6,9 +6,9 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-open Term
-open EConstr
open Names
+open Constr
+open EConstr
open Globnames
type tactic = unit Proofview.tactic
diff --git a/plugins/firstorder/sequent.ml b/plugins/firstorder/sequent.ml
index 05194164b..ea2d076ed 100644
--- a/plugins/firstorder/sequent.ml
+++ b/plugins/firstorder/sequent.ml
@@ -54,13 +54,7 @@ struct
(priority e1.pat) - (priority e2.pat)
end
-module OrderedConstr=
-struct
- type t=Term.constr
- let compare=Term.compare
-end
-
-type h_item = global_reference * (int*Term.constr) option
+type h_item = global_reference * (int*Constr.t) option
module Hitem=
struct
@@ -70,13 +64,13 @@ struct
if c = 0 then
let cmp (i1, c1) (i2, c2) =
let c = Int.compare i1 i2 in
- if c = 0 then OrderedConstr.compare c1 c2 else c
+ if c = 0 then Constr.compare c1 c2 else c
in
Option.compare cmp co1 co2
else c
end
-module CM=Map.Make(OrderedConstr)
+module CM=Map.Make(Constr)
module History=Set.Make(Hitem)
diff --git a/plugins/firstorder/sequent.mli b/plugins/firstorder/sequent.mli
index ca6079c8b..7f4a6dd86 100644
--- a/plugins/firstorder/sequent.mli
+++ b/plugins/firstorder/sequent.mli
@@ -10,11 +10,9 @@ open EConstr
open Formula
open Globnames
-module OrderedConstr: Set.OrderedType with type t=Term.constr
+module CM: CSig.MapS with type key=Constr.t
-module CM: CSig.MapS with type key=Term.constr
-
-type h_item = global_reference * (int*Term.constr) option
+type h_item = global_reference * (int*Constr.t) option
module History: Set.S with type elt = h_item
diff --git a/plugins/firstorder/unify.mli b/plugins/firstorder/unify.mli
index d3e8aeee8..390aa8c85 100644
--- a/plugins/firstorder/unify.mli
+++ b/plugins/firstorder/unify.mli
@@ -6,7 +6,7 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-open Term
+open Constr
open EConstr
exception UFAIL of constr*constr
diff --git a/plugins/fourier/fourierR.ml b/plugins/fourier/fourierR.ml
index 68af1b3b6..d9e9375c0 100644
--- a/plugins/fourier/fourierR.ml
+++ b/plugins/fourier/fourierR.ml
@@ -12,7 +12,7 @@
des inéquations et équations sont entiers. En attendant la tactique Field.
*)
-open Term
+open Constr
open Tactics
open Names
open Globnames
@@ -27,11 +27,7 @@ qui donne le coefficient d'un terme du calcul des constructions,
qui est zéro si le terme n'y est pas.
*)
-module Constrhash = Hashtbl.Make
- (struct type t = constr
- let equal = eq_constr
- let hash = hash_constr
- end)
+module Constrhash = Hashtbl.Make(Constr)
type flin = {fhom: rational Constrhash.t;
fcste:rational};;
@@ -84,7 +80,7 @@ let string_of_R_constant kn =
| _ -> "constant_not_of_R"
let rec string_of_R_constr c =
- match kind_of_term c with
+ match Constr.kind c with
Cast (c,_,_) -> string_of_R_constr c
|Const (c,_) -> string_of_R_constant c
| _ -> "not_of_constant"
@@ -92,7 +88,7 @@ let rec string_of_R_constr c =
exception NoRational
let rec rational_of_constr c =
- match kind_of_term c with
+ match Constr.kind c with
| Cast (c,_,_) -> (rational_of_constr c)
| App (c,args) ->
(match (string_of_R_constr c) with
@@ -125,7 +121,7 @@ exception NoLinear
let rec flin_of_constr c =
try(
- match kind_of_term c with
+ match Constr.kind c with
| Cast (c,_,_) -> (flin_of_constr c)
| App (c,args) ->
(match (string_of_R_constr c) with
@@ -192,9 +188,9 @@ exception NoIneq
let ineq1_of_constr (h,t) =
let h = EConstr.Unsafe.to_constr h in
let t = EConstr.Unsafe.to_constr t in
- match (kind_of_term t) with
+ match (Constr.kind t) with
| App (f,args) ->
- (match kind_of_term f with
+ (match Constr.kind f with
| Const (c,_) when Array.length args = 2 ->
let t1= args.(0) in
let t2= args.(1) in
@@ -233,7 +229,7 @@ let ineq1_of_constr (h,t) =
let t0= args.(0) in
let t1= args.(1) in
let t2= args.(2) in
- (match (kind_of_term t0) with
+ (match (Constr.kind t0) with
| Const (c,_) ->
(match (string_of_R_constant c) with
| "R"->
@@ -438,7 +434,7 @@ let tac_use h =
(*
let is_ineq (h,t) =
- match (kind_of_term t) with
+ match (Constr.kind t) with
App (f,args) ->
(match (string_of_R_constr f) with
"Rlt" -> true
@@ -479,7 +475,7 @@ let rec fourier () =
(* si le but est une inéquation, on introduit son contraire,
et le but à prouver devient False *)
try
- match (kind_of_term goal) with
+ match (Constr.kind goal) with
App (f,args) ->
let get = eget in
(match (string_of_R_constr f) with
diff --git a/plugins/funind/functional_principles_proofs.ml b/plugins/funind/functional_principles_proofs.ml
index bd5fb1d92..d04887a48 100644
--- a/plugins/funind/functional_principles_proofs.ml
+++ b/plugins/funind/functional_principles_proofs.ml
@@ -1,7 +1,7 @@
open Printer
open CErrors
open Util
-open Term
+open Constr
open EConstr
open Vars
open Namegen
@@ -44,6 +44,10 @@ let observe_tac s tac g = observe_tac_stream (str s) tac g
*)
+let pr_leconstr_fp =
+ let sigma, env = Pfedit.get_current_context () in
+ Printer.pr_leconstr_env env sigma
+
let debug_queue = Stack.create ()
let rec print_debug_queue e =
@@ -172,7 +176,7 @@ let is_incompatible_eq sigma t =
| _ -> false
with e when CErrors.noncritical e -> false
in
- if res then observe (str "is_incompatible_eq " ++ Printer.pr_leconstr t);
+ if res then observe (str "is_incompatible_eq " ++ pr_leconstr_fp t);
res
let change_hyp_with_using msg hyp_id t tac : tactic =
@@ -220,7 +224,8 @@ let find_rectype env sigma c =
let isAppConstruct ?(env=Global.env ()) sigma t =
try
let t',l = find_rectype env sigma t in
- observe (str "isAppConstruct : " ++ Printer.pr_leconstr t ++ str " -> " ++ Printer.pr_leconstr (applist (t',l)));
+ observe (str "isAppConstruct : " ++ Printer.pr_leconstr_env env sigma t ++ str " -> " ++
+ Printer.pr_leconstr_env env sigma (applist (t',l)));
true
with Not_found -> false
@@ -233,7 +238,8 @@ exception NoChange
let change_eq env sigma hyp_id (context:rel_context) x t end_of_type =
let nochange ?t' msg =
begin
- observe (str ("Not treating ( "^msg^" )") ++ pr_leconstr t ++ str " " ++ match t' with None -> str "" | Some t -> Printer.pr_leconstr t );
+ observe (str ("Not treating ( "^msg^" )") ++ pr_leconstr_env env sigma t ++ str " " ++
+ match t' with None -> str "" | Some t -> Printer.pr_leconstr_env env sigma t );
raise NoChange;
end
in
@@ -318,7 +324,7 @@ let change_eq env sigma hyp_id (context:rel_context) x t end_of_type =
context
in
let new_type_of_hyp =
- Reductionops.nf_betaiota sigma new_type_of_hyp in
+ Reductionops.nf_betaiota env sigma new_type_of_hyp in
let new_ctxt,new_end_of_type =
decompose_prod_n_assum sigma ctxt_size new_type_of_hyp
in
@@ -692,6 +698,7 @@ let build_proof
: tactic =
let rec build_proof_aux do_finalize dyn_infos : tactic =
fun g ->
+ let env = pf_env g in
let sigma = project g in
(* observe (str "proving on " ++ Printer.pr_lconstr_env (pf_env g) term);*)
match EConstr.kind sigma dyn_infos.info with
@@ -788,7 +795,7 @@ let build_proof
do_finalize dyn_infos g
| Lambda _ ->
let new_term =
- Reductionops.nf_beta sigma dyn_infos.info in
+ Reductionops.nf_beta env sigma dyn_infos.info in
build_proof do_finalize {dyn_infos with info = new_term}
g
| LetIn _ ->
@@ -841,7 +848,7 @@ let build_proof
| Rel _ -> anomaly (Pp.str "Free var in goal conclusion!")
and build_proof do_finalize dyn_infos g =
(* observe (str "proving with "++Printer.pr_lconstr dyn_infos.info++ str " on goal " ++ pr_gls g); *)
- observe_tac_stream (str "build_proof with " ++ Printer.pr_leconstr dyn_infos.info ) (build_proof_aux do_finalize dyn_infos) g
+ observe_tac_stream (str "build_proof with " ++ pr_leconstr_fp dyn_infos.info ) (build_proof_aux do_finalize dyn_infos) g
and build_proof_args do_finalize dyn_infos (* f_args' args *) :tactic =
fun g ->
let (f_args',args) = dyn_infos.info in
@@ -1135,7 +1142,7 @@ let prove_princ_for_struct (evd:Evd.evar_map ref) interactive_proof fun_num fnam
princ_params
);
observe (str "fbody_with_full_params := " ++
- pr_leconstr fbody_with_full_params
+ pr_leconstr_env (Global.env ()) !evd fbody_with_full_params
);
let all_funs_with_full_params =
Array.map (fun f -> applist(f, List.rev_map var_of_decl full_params)) all_funs
@@ -1147,7 +1154,7 @@ let prove_princ_for_struct (evd:Evd.evar_map ref) interactive_proof fun_num fnam
let bodies_with_all_params =
Array.map
(fun body ->
- Reductionops.nf_betaiota (project g)
+ Reductionops.nf_betaiota (pf_env g) (project g)
(applist(substl (List.rev (Array.to_list all_funs_with_full_params)) body,
List.rev_map var_of_decl princ_params))
)
@@ -1185,12 +1192,12 @@ let prove_princ_for_struct (evd:Evd.evar_map ref) interactive_proof fun_num fnam
let body_with_param,num =
let body = get_body fnames.(i) in
let body_with_full_params =
- Reductionops.nf_betaiota (project g) (
+ Reductionops.nf_betaiota (pf_env g) (project g) (
applist(body,List.rev_map var_of_decl full_params))
in
match EConstr.kind (project g) body_with_full_params with
| Fix((_,num),(_,_,bs)) ->
- Reductionops.nf_betaiota (project g)
+ Reductionops.nf_betaiota (pf_env g) (project g)
(
(applist
(substl
@@ -1273,7 +1280,7 @@ let prove_princ_for_struct (evd:Evd.evar_map ref) interactive_proof fun_num fnam
nb_rec_hyps = -100;
rec_hyps = [];
info =
- Reductionops.nf_betaiota (project g)
+ Reductionops.nf_betaiota (pf_env g) (project g)
(applist(fix_body,List.rev_map mkVar args_id));
eq_hyps = []
}
@@ -1333,7 +1340,7 @@ let prove_princ_for_struct (evd:Evd.evar_map ref) interactive_proof fun_num fnam
nb_rec_hyps = -100;
rec_hyps = [];
info =
- Reductionops.nf_betaiota Evd.empty
+ Reductionops.nf_betaiota (pf_env g) Evd.empty
(applist(fbody_with_full_params,
(List.rev_map var_of_decl princ_params)@
(List.rev_map mkVar args_id)
diff --git a/plugins/funind/functional_principles_types.ml b/plugins/funind/functional_principles_types.ml
index 018b51517..7a9bbd92c 100644
--- a/plugins/funind/functional_principles_types.ml
+++ b/plugins/funind/functional_principles_types.ml
@@ -1,7 +1,9 @@
open Printer
open CErrors
-open Util
open Term
+open Sorts
+open Util
+open Constr
open Vars
open Namegen
open Names
@@ -80,7 +82,7 @@ let compute_new_princ_type_from_rel rel_to_fun sorts princ_type =
let is_pte =
let set = List.fold_right Id.Set.add ptes_vars Id.Set.empty in
fun t ->
- match kind_of_term t with
+ match Constr.kind t with
| Var id -> Id.Set.mem id set
| _ -> false
in
@@ -100,13 +102,13 @@ let compute_new_princ_type_from_rel rel_to_fun sorts princ_type =
let pre_princ = EConstr.Unsafe.to_constr pre_princ in
let pre_princ = substl (List.map mkVar ptes_vars) pre_princ in
let is_dom c =
- match kind_of_term c with
+ match Constr.kind c with
| Ind((u,_),_) -> MutInd.equal u rel_as_kn
| Construct(((u,_),_),_) -> MutInd.equal u rel_as_kn
| _ -> false
in
let get_fun_num c =
- match kind_of_term c with
+ match Constr.kind c with
| Ind((_,num),_) -> num
| Construct(((_,num),_),_) -> num
| _ -> assert false
@@ -114,12 +116,14 @@ let compute_new_princ_type_from_rel rel_to_fun sorts princ_type =
let dummy_var = mkVar (Id.of_string "________") in
let mk_replacement c i args =
let res = mkApp(rel_to_fun.(i), Array.map pop (array_get_start args)) in
- observe (str "replacing " ++ pr_lconstr c ++ str " by " ++ pr_lconstr res);
+ observe (str "replacing " ++
+ pr_lconstr_env env Evd.empty c ++ str " by " ++
+ pr_lconstr_env env Evd.empty res);
res
in
let rec compute_new_princ_type remove env pre_princ : types*(constr list) =
let (new_princ_type,_) as res =
- match kind_of_term pre_princ with
+ match Constr.kind pre_princ with
| Rel n ->
begin
try match Environ.lookup_rel n env with
@@ -149,12 +153,12 @@ let compute_new_princ_type_from_rel rel_to_fun sorts princ_type =
in
let new_f,binders_to_remove_from_f = compute_new_princ_type remove env f in
applistc new_f new_args,
- list_union_eq eq_constr binders_to_remove_from_f binders_to_remove
+ list_union_eq Constr.equal binders_to_remove_from_f binders_to_remove
| LetIn(x,v,t,b) ->
compute_new_princ_type_for_letin remove env x v t b
| _ -> pre_princ,[]
in
-(* let _ = match kind_of_term pre_princ with *)
+(* let _ = match Constr.kind pre_princ with *)
(* | Prod _ -> *)
(* observe(str "compute_new_princ_type for "++ *)
(* pr_lconstr_env env pre_princ ++ *)
@@ -170,13 +174,13 @@ let compute_new_princ_type_from_rel rel_to_fun sorts princ_type =
let new_x : Name.t = get_name (Termops.ids_of_context env) x in
let new_env = Environ.push_rel (LocalAssum (x,t)) env in
let new_b,binders_to_remove_from_b = compute_new_princ_type remove new_env b in
- if List.exists (eq_constr (mkRel 1)) binders_to_remove_from_b
- then (pop new_b), filter_map (eq_constr (mkRel 1)) pop binders_to_remove_from_b
+ if List.exists (Constr.equal (mkRel 1)) binders_to_remove_from_b
+ then (pop new_b), filter_map (Constr.equal (mkRel 1)) pop binders_to_remove_from_b
else
(
bind_fun(new_x,new_t,new_b),
list_union_eq
- eq_constr
+ Constr.equal
binders_to_remove_from_t
(List.map pop binders_to_remove_from_b)
)
@@ -189,7 +193,7 @@ let compute_new_princ_type_from_rel rel_to_fun sorts princ_type =
| Toberemoved_with_rel (n,c) ->
(* observe (str "Decl of "++Ppconstr.Name.print x ++ str " is removed "); *)
let new_b,binders_to_remove_from_b = compute_new_princ_type remove env (substnl [c] n b) in
- new_b, list_add_set_eq eq_constr (mkRel n) (List.map pop binders_to_remove_from_b)
+ new_b, list_add_set_eq Constr.equal (mkRel n) (List.map pop binders_to_remove_from_b)
end
and compute_new_princ_type_for_letin remove env x v t b =
begin
@@ -199,14 +203,14 @@ let compute_new_princ_type_from_rel rel_to_fun sorts princ_type =
let new_x : Name.t = get_name (Termops.ids_of_context env) x in
let new_env = Environ.push_rel (LocalDef (x,v,t)) env in
let new_b,binders_to_remove_from_b = compute_new_princ_type remove new_env b in
- if List.exists (eq_constr (mkRel 1)) binders_to_remove_from_b
- then (pop new_b),filter_map (eq_constr (mkRel 1)) pop binders_to_remove_from_b
+ if List.exists (Constr.equal (mkRel 1)) binders_to_remove_from_b
+ then (pop new_b),filter_map (Constr.equal (mkRel 1)) pop binders_to_remove_from_b
else
(
mkLetIn(new_x,new_v,new_t,new_b),
list_union_eq
- eq_constr
- (list_union_eq eq_constr binders_to_remove_from_t binders_to_remove_from_v)
+ Constr.equal
+ (list_union_eq Constr.equal binders_to_remove_from_t binders_to_remove_from_v)
(List.map pop binders_to_remove_from_b)
)
@@ -218,12 +222,12 @@ let compute_new_princ_type_from_rel rel_to_fun sorts princ_type =
| Toberemoved_with_rel (n,c) ->
(* observe (str "Decl of "++Ppconstr.Name.print x ++ str " is removed "); *)
let new_b,binders_to_remove_from_b = compute_new_princ_type remove env (substnl [c] n b) in
- new_b, list_add_set_eq eq_constr (mkRel n) (List.map pop binders_to_remove_from_b)
+ new_b, list_add_set_eq Constr.equal (mkRel n) (List.map pop binders_to_remove_from_b)
end
and compute_new_princ_type_with_acc remove env e (c_acc,to_remove_acc) =
let new_e,to_remove_from_e = compute_new_princ_type remove env e
in
- new_e::c_acc,list_union_eq eq_constr to_remove_from_e to_remove_acc
+ new_e::c_acc,list_union_eq Constr.equal to_remove_from_e to_remove_acc
in
(* observe (str "Computing new principe from " ++ pr_lconstr_env env_with_params_and_predicates pre_princ); *)
let pre_res,_ =
@@ -329,7 +333,7 @@ let generate_functional_principle (evd: Evd.evar_map ref)
| Some (id) -> id,id
| None ->
let id_of_f = Label.to_id (Constant.label (fst f)) in
- id_of_f,Indrec.make_elimination_ident id_of_f (family_of_sort type_sort)
+ id_of_f,Indrec.make_elimination_ident id_of_f (Sorts.family type_sort)
in
let names = ref [new_princ_name] in
let hook =
@@ -344,8 +348,11 @@ let generate_functional_principle (evd: Evd.evar_map ref)
let evd',value = change_property_sort evd' s new_principle_type new_princ_name in
let evd' = fst (Typing.type_of ~refresh:true (Global.env ()) evd' (EConstr.of_constr value)) in
(* Pp.msgnl (str "new principle := " ++ pr_lconstr value); *)
- let univs = (snd (Evd.universe_context ~names:[] ~extensible:true evd')) in
- let ce = Declare.definition_entry ~poly:(Flags.is_universe_polymorphism ()) ~univs value in
+ let univs =
+ let poly = Flags.is_universe_polymorphism () in
+ Evd.const_univ_entry ~poly evd'
+ in
+ let ce = Declare.definition_entry ~univs value in
ignore(
Declare.declare_constant
name
@@ -389,7 +396,7 @@ exception Not_Rec
let get_funs_constant mp dp =
let get_funs_constant const e : (Names.Constant.t*int) array =
- match kind_of_term ((strip_lam e)) with
+ match Constr.kind ((strip_lam e)) with
| Fix((_,(na,_,_))) ->
Array.mapi
(fun i na ->
@@ -430,7 +437,7 @@ let get_funs_constant mp dp =
let first_params = List.hd l_params in
List.iter
(fun params ->
- if not (List.equal (fun (n1, c1) (n2, c2) -> Name.equal n1 n2 && eq_constr c1 c2) first_params params)
+ if not (List.equal (fun (n1, c1) (n2, c2) -> Name.equal n1 n2 && Constr.equal c1 c2) first_params params)
then user_err Pp.(str "Not a mutal recursive block")
)
l_params
@@ -439,7 +446,7 @@ let get_funs_constant mp dp =
let _check_bodies =
try
let extract_info is_first body =
- match kind_of_term body with
+ match Constr.kind body with
| Fix((idxs,_),(na,ta,ca)) -> (idxs,na,ta,ca)
| _ ->
if is_first && Int.equal (List.length l_bodies) 1
@@ -450,7 +457,7 @@ let get_funs_constant mp dp =
let check body = (* Hope this is correct *)
let eq_infos (ia1, na1, ta1, ca1) (ia2, na2, ta2, ca2) =
Array.equal Int.equal ia1 ia2 && Array.equal Name.equal na1 na2 &&
- Array.equal eq_constr ta1 ta2 && Array.equal eq_constr ca1 ca2
+ Array.equal Constr.equal ta1 ta2 && Array.equal Constr.equal ca1 ca2
in
if not (eq_infos first_infos (extract_info false body))
then user_err Pp.(str "Not a mutal recursive block")
@@ -564,7 +571,7 @@ let make_scheme evd (fas : (pconstant*Sorts.family) list) : Safe_typing.private_
List.map (* we can now compute the other principles *)
(fun scheme_type ->
incr i;
- observe (Printer.pr_lconstr scheme_type);
+ observe (Printer.pr_lconstr_env env sigma scheme_type);
let type_concl = (strip_prod_assum scheme_type) in
let applied_f = List.hd (List.rev (snd (decompose_app type_concl))) in
let f = fst (decompose_app applied_f) in
@@ -574,10 +581,10 @@ let make_scheme evd (fas : (pconstant*Sorts.family) list) : Safe_typing.private_
let t = (strip_prod_assum t) in
let applied_g = List.hd (List.rev (snd (decompose_app t))) in
let g = fst (decompose_app applied_g) in
- if eq_constr f g
+ if Constr.equal f g
then raise (Found_type j);
- observe (Printer.pr_lconstr f ++ str " <> " ++
- Printer.pr_lconstr g)
+ observe (Printer.pr_lconstr_env env sigma f ++ str " <> " ++
+ Printer.pr_lconstr_env env sigma g)
)
ta;
diff --git a/plugins/funind/functional_principles_types.mli b/plugins/funind/functional_principles_types.mli
index 2eb1b7935..ad396a2cb 100644
--- a/plugins/funind/functional_principles_types.mli
+++ b/plugins/funind/functional_principles_types.mli
@@ -7,7 +7,7 @@
(************************************************************************)
open Names
-open Term
+open Constr
val generate_functional_principle :
Evd.evar_map ref ->
@@ -29,10 +29,6 @@ val generate_functional_principle :
(EConstr.constr array -> int -> Tacmach.tactic) ->
unit
-val compute_new_princ_type_from_rel : constr array -> Sorts.t array ->
- types -> types
-
-
exception No_graph_found
val make_scheme : Evd.evar_map ref ->
diff --git a/plugins/funind/g_indfun.ml4 b/plugins/funind/g_indfun.ml4
index 829556a71..4b828a702 100644
--- a/plugins/funind/g_indfun.ml4
+++ b/plugins/funind/g_indfun.ml4
@@ -154,7 +154,7 @@ VERNAC COMMAND EXTEND Function
| _,((_,(_,CStructRec),_,_,_),_) -> false) recsl in
match
Vernac_classifier.classify_vernac
- (Vernacexpr.VernacFixpoint(None, List.map snd recsl))
+ (Vernacexpr.(VernacExpr([], VernacFixpoint(Decl_kinds.NoDischarge, List.map snd recsl))))
with
| Vernacexpr.VtSideff ids, _ when hard ->
Vernacexpr.(VtStartProof ("Classic", GuaranteesOpacity, ids), VtLater)
diff --git a/plugins/funind/glob_term_to_relation.ml b/plugins/funind/glob_term_to_relation.ml
index e8e5bfccc..f7639d22d 100644
--- a/plugins/funind/glob_term_to_relation.ml
+++ b/plugins/funind/glob_term_to_relation.ml
@@ -1,7 +1,7 @@
open Printer
open Pp
open Names
-open Term
+open Constr
open Vars
open Glob_term
open Glob_ops
@@ -378,29 +378,30 @@ let add_pat_variables pat typ env : Environ.env =
fst (
Context.Rel.fold_outside
(fun decl (env,ctxt) ->
- let open Context.Rel.Declaration in
- match decl with
+ let open Context.Rel.Declaration in
+ let sigma, _ = Pfedit.get_current_context () in
+ match decl with
| LocalAssum (Anonymous,_) | LocalDef (Anonymous,_,_) -> assert false
| LocalAssum (Name id, t) ->
- let new_t = substl ctxt t in
- observe (str "for variable " ++ Ppconstr.pr_id id ++ fnl () ++
- str "old type := " ++ Printer.pr_lconstr t ++ fnl () ++
- str "new type := " ++ Printer.pr_lconstr new_t ++ fnl ()
- );
- let open Context.Named.Declaration in
- (Environ.push_named (LocalAssum (id,new_t)) env,mkVar id::ctxt)
- | LocalDef (Name id, v, t) ->
- let new_t = substl ctxt t in
- let new_v = substl ctxt v in
- observe (str "for variable " ++ Ppconstr.pr_id id ++ fnl () ++
- str "old type := " ++ Printer.pr_lconstr t ++ fnl () ++
- str "new type := " ++ Printer.pr_lconstr new_t ++ fnl () ++
- str "old value := " ++ Printer.pr_lconstr v ++ fnl () ++
- str "new value := " ++ Printer.pr_lconstr new_v ++ fnl ()
- );
- let open Context.Named.Declaration in
- (Environ.push_named (LocalDef (id,new_v,new_t)) env,mkVar id::ctxt)
- )
+ let new_t = substl ctxt t in
+ observe (str "for variable " ++ Ppconstr.pr_id id ++ fnl () ++
+ str "old type := " ++ Printer.pr_lconstr_env env sigma t ++ fnl () ++
+ str "new type := " ++ Printer.pr_lconstr_env env sigma new_t ++ fnl ()
+ );
+ let open Context.Named.Declaration in
+ (Environ.push_named (LocalAssum (id,new_t)) env,mkVar id::ctxt)
+ | LocalDef (Name id, v, t) ->
+ let new_t = substl ctxt t in
+ let new_v = substl ctxt v in
+ observe (str "for variable " ++ Ppconstr.pr_id id ++ fnl () ++
+ str "old type := " ++ Printer.pr_lconstr_env env sigma t ++ fnl () ++
+ str "new type := " ++ Printer.pr_lconstr_env env sigma new_t ++ fnl () ++
+ str "old value := " ++ Printer.pr_lconstr_env env sigma v ++ fnl () ++
+ str "new value := " ++ Printer.pr_lconstr_env env sigma new_v ++ fnl ()
+ );
+ let open Context.Named.Declaration in
+ (Environ.push_named (LocalDef (id,new_v,new_t)) env,mkVar id::ctxt)
+ )
(Environ.rel_context new_env)
~init:(env,[])
)
@@ -478,7 +479,7 @@ let rec pattern_to_term_and_type env typ = DAst.with_val (function
let rec build_entry_lc env funnames avoid rt : glob_constr build_entry_return =
- observe (str " Entering : " ++ Printer.pr_glob_constr rt);
+ observe (str " Entering : " ++ Printer.pr_glob_constr_env env rt);
let open CAst in
match DAst.get rt with
| GRef _ | GVar _ | GEvar _ | GPatVar _ | GSort _ | GHole _ ->
@@ -590,6 +591,7 @@ let rec build_entry_lc env funnames avoid rt : glob_constr build_entry_return =
*)
build_entry_lc env funnames avoid (mkGApp(b,args))
| GRec _ -> user_err Pp.(str "Not handled GRec")
+ | GProj _ -> user_err Pp.(str "Funind does not support primitive projections")
| GProd _ -> user_err Pp.(str "Cannot apply a type")
end (* end of the application treatement *)
@@ -651,8 +653,8 @@ let rec build_entry_lc env funnames avoid rt : glob_constr build_entry_return =
try Inductiveops.find_inductive env (Evd.from_env env) b_typ
with Not_found ->
user_err (str "Cannot find the inductive associated to " ++
- Printer.pr_glob_constr b ++ str " in " ++
- Printer.pr_glob_constr rt ++ str ". try again with a cast")
+ Printer.pr_glob_constr_env env b ++ str " in " ++
+ Printer.pr_glob_constr_env env rt ++ str ". try again with a cast")
in
let case_pats = build_constructors_of_type (fst ind) [] in
assert (Int.equal (Array.length case_pats) 2);
@@ -683,8 +685,8 @@ let rec build_entry_lc env funnames avoid rt : glob_constr build_entry_return =
try Inductiveops.find_inductive env (Evd.from_env env) b_typ
with Not_found ->
user_err (str "Cannot find the inductive associated to " ++
- Printer.pr_glob_constr b ++ str " in " ++
- Printer.pr_glob_constr rt ++ str ". try again with a cast")
+ Printer.pr_glob_constr_env env b ++ str " in " ++
+ Printer.pr_glob_constr_env env rt ++ str ". try again with a cast")
in
let case_pats = build_constructors_of_type (fst ind) nal_as_glob_constr in
assert (Int.equal (Array.length case_pats) 1);
@@ -696,6 +698,7 @@ let rec build_entry_lc env funnames avoid rt : glob_constr build_entry_return =
| GRec _ -> user_err Pp.(str "Not handled GRec")
| GCast(b,_) ->
build_entry_lc env funnames avoid b
+ | GProj(_,_) -> user_err Pp.(str "Funind does not support primitive projections")
and build_entry_lc_from_case env funname make_discr
(el:tomatch_tuples)
(brl:Glob_term.cases_clauses) avoid :
@@ -896,24 +899,24 @@ let same_raw_term rt1 rt2 =
| GHole _, GHole _ -> true
| _ -> false
let decompose_raw_eq lhs rhs =
- let rec decompose_raw_eq lhs rhs acc =
- observe (str "decomposing eq for " ++ pr_glob_constr lhs ++ str " " ++ pr_glob_constr rhs);
- let (rhd,lrhs) = glob_decompose_app rhs in
- let (lhd,llhs) = glob_decompose_app lhs in
- observe (str "lhd := " ++ pr_glob_constr lhd);
- observe (str "rhd := " ++ pr_glob_constr rhd);
+ let _, env = Pfedit.get_current_context () in
+ let rec decompose_raw_eq lhs rhs acc =
+ observe (str "decomposing eq for " ++ pr_glob_constr_env env lhs ++ str " " ++ pr_glob_constr_env env rhs);
+ let (rhd,lrhs) = glob_decompose_app rhs in
+ let (lhd,llhs) = glob_decompose_app lhs in
+ observe (str "lhd := " ++ pr_glob_constr_env env lhd);
+ observe (str "rhd := " ++ pr_glob_constr_env env rhd);
observe (str "llhs := " ++ int (List.length llhs));
observe (str "lrhs := " ++ int (List.length lrhs));
- let sllhs = List.length llhs in
- let slrhs = List.length lrhs in
- if same_raw_term lhd rhd && Int.equal sllhs slrhs
+ let sllhs = List.length llhs in
+ let slrhs = List.length lrhs in
+ if same_raw_term lhd rhd && Int.equal sllhs slrhs
then
(* let _ = assert false in *)
List.fold_right2 decompose_raw_eq llhs lrhs acc
else (lhs,rhs)::acc
in
decompose_raw_eq lhs rhs []
-
exception Continue
(*
@@ -922,7 +925,7 @@ exception Continue
eliminates some meaningless equalities, applies some rewrites......
*)
let rec rebuild_cons env nb_args relname args crossed_types depth rt =
- observe (str "rebuilding : " ++ pr_glob_constr rt);
+ observe (str "rebuilding : " ++ pr_glob_constr_env env rt);
let open Context.Rel.Declaration in
let open CAst in
match DAst.get rt with
@@ -966,7 +969,7 @@ let rec rebuild_cons env nb_args relname args crossed_types depth rt =
let id = match DAst.get id with GVar id -> id | _ -> assert false in
begin
try
- observe (str "computing new type for eq : " ++ pr_glob_constr rt);
+ observe (str "computing new type for eq : " ++ pr_glob_constr_env env rt);
let t' =
try fst (Pretyping.understand env (Evd.from_env env) t)(*FIXME*)
with e when CErrors.noncritical e -> raise Continue
@@ -1011,11 +1014,11 @@ let rec rebuild_cons env nb_args relname args crossed_types depth rt =
let eq' =
DAst.make ?loc:loc1 @@ GApp(DAst.make ?loc:loc2 @@GRef(jmeq,None),[ty;DAst.make ?loc:loc3 @@ GVar id;rt_typ;rt])
in
- observe (str "computing new type for jmeq : " ++ pr_glob_constr eq');
+ observe (str "computing new type for jmeq : " ++ pr_glob_constr_env env eq');
let eq'_as_constr,ctx = Pretyping.understand env (Evd.from_env env) eq' in
observe (str " computing new type for jmeq : done") ;
let new_args =
- match kind_of_term eq'_as_constr with
+ match Constr.kind eq'_as_constr with
| App(_,[|_;_;ty;_|]) ->
let ty = Array.to_list (snd (destApp ty)) in
let ty' = snd (Util.List.chop nparam ty) in
@@ -1098,7 +1101,7 @@ let rec rebuild_cons env nb_args relname args crossed_types depth rt =
rebuild_cons env nb_args relname args crossed_types depth new_rt
else raise Continue
with Continue ->
- observe (str "computing new type for prod : " ++ pr_glob_constr rt);
+ observe (str "computing new type for prod : " ++ pr_glob_constr_env env rt);
let t',ctx = Pretyping.understand env (Evd.from_env env) t in
let new_env = Environ.push_rel (LocalAssum (n,t')) env in
let new_b,id_to_exclude =
@@ -1114,7 +1117,7 @@ let rec rebuild_cons env nb_args relname args crossed_types depth rt =
| _ -> mkGProd(n,t,new_b),Id.Set.filter not_free_in_t id_to_exclude
end
| _ ->
- observe (str "computing new type for prod : " ++ pr_glob_constr rt);
+ observe (str "computing new type for prod : " ++ pr_glob_constr_env env rt);
let t',ctx = Pretyping.understand env (Evd.from_env env) t in
let new_env = Environ.push_rel (LocalAssum (n,t')) env in
let new_b,id_to_exclude =
@@ -1133,7 +1136,7 @@ let rec rebuild_cons env nb_args relname args crossed_types depth rt =
begin
let not_free_in_t id = not (is_free_in id t) in
let new_crossed_types = t :: crossed_types in
- observe (str "computing new type for lambda : " ++ pr_glob_constr rt);
+ observe (str "computing new type for lambda : " ++ pr_glob_constr_env env rt);
let t',ctx = Pretyping.understand env (Evd.from_env env) t in
match n with
| Name id ->
@@ -1244,7 +1247,7 @@ let rec compute_cst_params relnames params gt = DAst.with_val (function
discrimination ones *)
| GSort _ -> params
| GHole _ -> params
- | GIf _ | GRec _ | GCast _ ->
+ | GIf _ | GRec _ | GCast _ | GProj _ ->
raise (UserError(Some "compute_cst_params", str "Not handled case"))
) gt
and compute_cst_params_from_app acc (params,rtl) =
@@ -1297,7 +1300,7 @@ let rec rebuild_return_type rt =
CAst.make @@ Constrexpr.CSort(GType []))
let do_build_inductive
- evd (funconstants: Term.pconstant list) (funsargs: (Name.t * glob_constr * glob_constr option) list list)
+ evd (funconstants: pconstant list) (funsargs: (Name.t * glob_constr * glob_constr option) list list)
returned_types
(rtl:glob_constr list) =
let _time1 = System.get_time () in
@@ -1496,8 +1499,8 @@ let do_build_inductive
let _time2 = System.get_time () in
try
with_full_print
- (Flags.silently (Command.do_mutual_inductive rel_inds (Flags.is_universe_polymorphism ()) false false))
- Decl_kinds.Finite
+ (Flags.silently (ComInductive.do_mutual_inductive rel_inds (Flags.is_universe_polymorphism ()) false false))
+ Declarations.Finite
with
| UserError(s,msg) as e ->
let _time3 = System.get_time () in
@@ -1508,7 +1511,7 @@ let do_build_inductive
in
let msg =
str "while trying to define"++ spc () ++
- Ppvernac.pr_vernac (Vernacexpr.VernacInductive(Vernacexpr.GlobalNonCumulativity,false,Decl_kinds.Finite,repacked_rel_inds))
+ Ppvernac.pr_vernac Vernacexpr.(VernacExpr([], VernacInductive(GlobalNonCumulativity,false,Declarations.Finite,repacked_rel_inds)))
++ fnl () ++
msg
in
@@ -1523,7 +1526,7 @@ let do_build_inductive
in
let msg =
str "while trying to define"++ spc () ++
- Ppvernac.pr_vernac (Vernacexpr.VernacInductive(Vernacexpr.GlobalNonCumulativity,false,Decl_kinds.Finite,repacked_rel_inds))
+ Ppvernac.pr_vernac Vernacexpr.(VernacExpr([], VernacInductive(GlobalNonCumulativity,false,Declarations.Finite,repacked_rel_inds)))
++ fnl () ++
CErrors.print reraise
in
diff --git a/plugins/funind/glob_term_to_relation.mli b/plugins/funind/glob_term_to_relation.mli
index 0cab5a6d3..ff0e98d00 100644
--- a/plugins/funind/glob_term_to_relation.mli
+++ b/plugins/funind/glob_term_to_relation.mli
@@ -11,7 +11,7 @@ val build_inductive :
Id.t list -> (* The list of function name *)
*)
Evd.evar_map ->
- Term.pconstant list ->
+ Constr.pconstant list ->
(Name.t*Glob_term.glob_constr*Glob_term.glob_constr option) list list -> (* The list of function args *)
Constrexpr.constr_expr list -> (* The list of function returned type *)
Glob_term.glob_constr list -> (* the list of body *)
diff --git a/plugins/funind/glob_termops.ml b/plugins/funind/glob_termops.ml
index 0666ab4f1..b4ca1073c 100644
--- a/plugins/funind/glob_termops.ml
+++ b/plugins/funind/glob_termops.ml
@@ -17,69 +17,12 @@ let mkGLambda(n,t,b) = DAst.make @@ GLambda(n,Explicit,t,b)
let mkGProd(n,t,b) = DAst.make @@ GProd(n,Explicit,t,b)
let mkGLetIn(n,b,t,c) = DAst.make @@ GLetIn(n,b,t,c)
let mkGCases(rto,l,brl) = DAst.make @@ GCases(Term.RegularStyle,rto,l,brl)
-let mkGSort s = DAst.make @@ GSort(s)
let mkGHole () = DAst.make @@ GHole(Evar_kinds.BinderType Anonymous,Misctypes.IntroAnonymous,None)
-let mkGCast(b,t) = DAst.make @@ GCast(b,CastConv t)
(*
Some basic functions to decompose glob_constrs
These are analogous to the ones constrs
*)
-let glob_decompose_prod =
- let rec glob_decompose_prod args c = match DAst.get c with
- | GProd(n,k,t,b) ->
- glob_decompose_prod ((n,t)::args) b
- | _ -> args,c
- in
- glob_decompose_prod []
-
-let glob_decompose_prod_or_letin =
- let rec glob_decompose_prod args rt = match DAst.get rt with
- | GProd(n,k,t,b) ->
- glob_decompose_prod ((n,None,Some t)::args) b
- | GLetIn(n,b,t,c) ->
- glob_decompose_prod ((n,Some b,t)::args) c
- | _ -> args,rt
- in
- glob_decompose_prod []
-
-let glob_compose_prod =
- List.fold_left (fun b (n,t) -> mkGProd(n,t,b))
-
-let glob_compose_prod_or_letin =
- List.fold_left (
- fun concl decl ->
- match decl with
- | (n,None,Some t) -> mkGProd(n,t,concl)
- | (n,Some bdy,t) -> mkGLetIn(n,bdy,t,concl)
- | _ -> assert false)
-
-let glob_decompose_prod_n n =
- let rec glob_decompose_prod i args c =
- if i<=0 then args,c
- else
- match DAst.get c with
- | GProd(n,_,t,b) ->
- glob_decompose_prod (i-1) ((n,t)::args) b
- | _ -> args,c
- in
- glob_decompose_prod n []
-
-
-let glob_decompose_prod_or_letin_n n =
- let rec glob_decompose_prod i args c =
- if i<=0 then args,c
- else
- match DAst.get c with
- | GProd(n,_,t,b) ->
- glob_decompose_prod (i-1) ((n,None,Some t)::args) b
- | GLetIn(n,b,t,c) ->
- glob_decompose_prod (i-1) ((n,Some b,t)::args) c
- | _ -> args,c
- in
- glob_decompose_prod n []
-
-
let glob_decompose_app =
let rec decompose_rapp acc rt =
(* msgnl (str "glob_decompose_app on : "++ Printer.pr_glob_constr rt); *)
@@ -101,18 +44,6 @@ let glob_make_eq ?(typ= mkGHole ()) t1 t2 =
let glob_make_neq t1 t2 =
mkGApp(mkGRef (Lazy.force Coqlib.coq_not_ref),[glob_make_eq t1 t2])
-(* [glob_make_or P1 P2] build the glob_constr corresponding to [P1 \/ P2] *)
-let glob_make_or t1 t2 = mkGApp (mkGRef(Lazy.force Coqlib.coq_or_ref),[t1;t2])
-
-(* [glob_make_or_list [P1;...;Pn]] build the glob_constr corresponding
- to [P1 \/ ( .... \/ Pn)]
-*)
-let rec glob_make_or_list = function
- | [] -> invalid_arg "mk_or"
- | [e] -> e
- | e::l -> glob_make_or e (glob_make_or_list l)
-
-
let remove_name_from_mapping mapping na =
match na with
| Anonymous -> mapping
@@ -178,6 +109,7 @@ let change_vars =
| GCast(b,c) ->
GCast(change_vars mapping b,
Miscops.map_cast_type (change_vars mapping) c)
+ | GProj(p,c) -> GProj(p, change_vars mapping c)
) rt
and change_vars_br mapping ((loc,(idl,patl,res)) as br) =
let new_mapping = List.fold_right Id.Map.remove idl mapping in
@@ -362,6 +294,7 @@ let rec alpha_rt excluded rt =
GApp(alpha_rt excluded f,
List.map (alpha_rt excluded) args
)
+ | GProj(p,c) -> GProj(p, alpha_rt excluded c)
in
new_rt
@@ -413,6 +346,7 @@ let is_free_in id =
| GHole _ -> false
| GCast (b,(CastConv t|CastVM t|CastNative t)) -> is_free_in b || is_free_in t
| GCast (b,CastCoerce) -> is_free_in b
+ | GProj (_,c) -> is_free_in c
) x
and is_free_in_br (_,(ids,_,rt)) =
(not (Id.List.mem id ids)) && is_free_in rt
@@ -506,6 +440,8 @@ let replace_var_by_term x_id term =
| GCast(b,c) ->
GCast(replace_var_by_pattern b,
Miscops.map_cast_type replace_var_by_pattern c)
+ | GProj(p,c) ->
+ GProj(p,replace_var_by_pattern c)
) x
and replace_var_by_pattern_br ((loc,(idl,patl,res)) as br) =
if List.exists (fun id -> Id.compare id x_id == 0) idl
@@ -575,97 +511,6 @@ let ids_of_pat =
in
ids_of_pat Id.Set.empty
-let id_of_name = function
- | Anonymous -> Id.of_string "x"
- | Name x -> x
-
-(* TODO: finish Rec caes *)
-let ids_of_glob_constr c =
- let rec ids_of_glob_constr acc c =
- let idof = id_of_name in
- match DAst.get c with
- | GVar id -> id::acc
- | GApp (g,args) ->
- ids_of_glob_constr [] g @ List.flatten (List.map (ids_of_glob_constr []) args) @ acc
- | GLambda (na,k,ty,c) -> idof na :: ids_of_glob_constr [] ty @ ids_of_glob_constr [] c @ acc
- | GProd (na,k,ty,c) -> idof na :: ids_of_glob_constr [] ty @ ids_of_glob_constr [] c @ acc
- | GLetIn (na,b,t,c) -> idof na :: ids_of_glob_constr [] b @ Option.cata (ids_of_glob_constr []) [] t @ ids_of_glob_constr [] c @ acc
- | GCast (c,(CastConv t|CastVM t|CastNative t)) -> ids_of_glob_constr [] c @ ids_of_glob_constr [] t @ acc
- | GCast (c,CastCoerce) -> ids_of_glob_constr [] c @ acc
- | GIf (c,(na,po),b1,b2) -> ids_of_glob_constr [] c @ ids_of_glob_constr [] b1 @ ids_of_glob_constr [] b2 @ acc
- | GLetTuple (nal,(na,po),b,c) ->
- List.map idof nal @ ids_of_glob_constr [] b @ ids_of_glob_constr [] c @ acc
- | GCases (sty,rtntypopt,tml,brchl) ->
- List.flatten (List.map (fun (_,(idl,patl,c)) -> idl @ ids_of_glob_constr [] c) brchl)
- | GRec _ -> failwith "Fix inside a constructor branch"
- | (GSort _ | GHole _ | GRef _ | GEvar _ | GPatVar _) -> []
- in
- (* build the set *)
- List.fold_left (fun acc x -> Id.Set.add x acc) Id.Set.empty (ids_of_glob_constr [] c)
-
-
-
-
-
-let zeta_normalize =
- let rec zeta_normalize_term x = DAst.map (function
- | GRef _
- | GVar _
- | GEvar _
- | GPatVar _ as rt -> rt
- | GApp(rt',rtl) ->
- GApp(zeta_normalize_term rt',
- List.map zeta_normalize_term rtl
- )
- | GLambda(name,k,t,b) ->
- GLambda(name,
- k,
- zeta_normalize_term t,
- zeta_normalize_term b
- )
- | GProd(name,k,t,b) ->
- GProd(name,
- k,
- zeta_normalize_term t,
- zeta_normalize_term b
- )
- | GLetIn(Name id,def,typ,b) ->
- DAst.get (zeta_normalize_term (replace_var_by_term id def b))
- | GLetIn(Anonymous,def,typ,b) ->
- DAst.get (zeta_normalize_term b)
- | GLetTuple(nal,(na,rto),def,b) ->
- GLetTuple(nal,
- (na,Option.map zeta_normalize_term rto),
- zeta_normalize_term def,
- zeta_normalize_term b
- )
- | GCases(sty,infos,el,brl) ->
- GCases(sty,
- infos,
- List.map (fun (e,x) -> (zeta_normalize_term e,x)) el,
- List.map zeta_normalize_br brl
- )
- | GIf(b,(na,e_option),lhs,rhs) ->
- GIf(zeta_normalize_term b,
- (na,Option.map zeta_normalize_term e_option),
- zeta_normalize_term lhs,
- zeta_normalize_term rhs
- )
- | GRec _ -> raise (UserError(None,str "Not handled GRec"))
- | GSort _
- | GHole _ as rt -> rt
- | GCast(b,c) ->
- GCast(zeta_normalize_term b,
- Miscops.map_cast_type zeta_normalize_term c)
- ) x
- and zeta_normalize_br (loc,(idl,patl,res)) =
- (loc,(idl,patl,zeta_normalize_term res))
- in
- zeta_normalize_term
-
-
-
-
let expand_as =
let rec add_as map rt =
@@ -700,6 +545,7 @@ let expand_as =
| GCases(sty,po,el,brl) ->
GCases(sty, Option.map (expand_as map) po, List.map (fun (rt,t) -> expand_as map rt,t) el,
List.map (expand_as_br map) brl)
+ | GProj(p,c) -> GProj(p, expand_as map c)
)
and expand_as_br map (loc,(idl,cpl,rt)) =
(loc,(idl,cpl, expand_as (List.fold_left add_as map cpl) rt))
diff --git a/plugins/funind/glob_termops.mli b/plugins/funind/glob_termops.mli
index 99a258de9..7088ae596 100644
--- a/plugins/funind/glob_termops.mli
+++ b/plugins/funind/glob_termops.mli
@@ -1,6 +1,5 @@
open Names
open Glob_term
-open Misctypes
(* [get_pattern_id pat] returns a list of all the variable appearing in [pat] *)
val get_pattern_id : cases_pattern -> Id.t list
@@ -21,22 +20,11 @@ val mkGLambda : Name.t * glob_constr * glob_constr -> glob_constr
val mkGProd : Name.t * glob_constr * glob_constr -> glob_constr
val mkGLetIn : Name.t * glob_constr * glob_constr option * glob_constr -> glob_constr
val mkGCases : glob_constr option * tomatch_tuples * cases_clauses -> glob_constr
-val mkGSort : glob_sort -> glob_constr
val mkGHole : unit -> glob_constr (* we only build Evd.BinderType Anonymous holes *)
-val mkGCast : glob_constr* glob_constr -> glob_constr
(*
Some basic functions to decompose glob_constrs
These are analogous to the ones constrs
*)
-val glob_decompose_prod : glob_constr -> (Name.t*glob_constr) list * glob_constr
-val glob_decompose_prod_or_letin :
- glob_constr -> (Name.t*glob_constr option*glob_constr option) list * glob_constr
-val glob_decompose_prod_n : int -> glob_constr -> (Name.t*glob_constr) list * glob_constr
-val glob_decompose_prod_or_letin_n : int -> glob_constr ->
- (Name.t*glob_constr option*glob_constr option) list * glob_constr
-val glob_compose_prod : glob_constr -> (Name.t*glob_constr) list -> glob_constr
-val glob_compose_prod_or_letin: glob_constr ->
- (Name.t*glob_constr option*glob_constr option) list -> glob_constr
val glob_decompose_app : glob_constr -> glob_constr*(glob_constr list)
@@ -44,14 +32,6 @@ val glob_decompose_app : glob_constr -> glob_constr*(glob_constr list)
val glob_make_eq : ?typ:glob_constr -> glob_constr -> glob_constr -> glob_constr
(* [glob_make_neq t1 t2] build the glob_constr corresponding to [t1 <> t2] *)
val glob_make_neq : glob_constr -> glob_constr -> glob_constr
-(* [glob_make_or P1 P2] build the glob_constr corresponding to [P1 \/ P2] *)
-val glob_make_or : glob_constr -> glob_constr -> glob_constr
-
-(* [glob_make_or_list [P1;...;Pn]] build the glob_constr corresponding
- to [P1 \/ ( .... \/ Pn)]
-*)
-val glob_make_or_list : glob_constr list -> glob_constr
-
(* alpha_conversion functions *)
@@ -109,18 +89,8 @@ val eq_cases_pattern : cases_pattern -> cases_pattern -> bool
*)
val ids_of_pat : cases_pattern -> Id.Set.t
-(* TODO: finish this function (Fix not treated) *)
-val ids_of_glob_constr: glob_constr -> Id.Set.t
-
-(*
- removing let_in construction in a glob_constr
-*)
-val zeta_normalize : Glob_term.glob_constr -> Glob_term.glob_constr
-
-
val expand_as : glob_constr -> glob_constr
-
(* [resolve_and_replace_implicits ?expected_type env sigma rt] solves implicits of [rt] w.r.t. [env] and [sigma] and then replace them by their solution
*)
val resolve_and_replace_implicits :
diff --git a/plugins/funind/indfun.ml b/plugins/funind/indfun.ml
index dab094f91..58154d310 100644
--- a/plugins/funind/indfun.ml
+++ b/plugins/funind/indfun.ml
@@ -1,7 +1,8 @@
open CErrors
+open Sorts
open Util
open Names
-open Term
+open Constr
open EConstr
open Pp
open Indfun_common
@@ -46,7 +47,7 @@ let functional_induction with_clean c princl pat =
try find_Function_infos c'
with Not_found ->
user_err (str "Cannot find induction information on "++
- Printer.pr_leconstr (mkConst c') )
+ Printer.pr_leconstr_env (Tacmach.pf_env g) sigma (mkConst c') )
in
match Tacticals.elimination_sort_of_goal g with
| InProp -> finfo.prop_lemma
@@ -74,7 +75,7 @@ let functional_induction with_clean c princl pat =
(* mkConst(const_of_id princ_name ),g (\* FIXME *\) *)
with Not_found -> (* This one is neither defined ! *)
user_err (str "Cannot find induction principle for "
- ++Printer.pr_leconstr (mkConst c') )
+ ++ Printer.pr_leconstr_env (Tacmach.pf_env g) sigma (mkConst c') )
in
let princ = EConstr.of_constr princ in
(princ,NoBindings,Tacmach.pf_unsafe_type_of g' princ,g')
@@ -157,8 +158,8 @@ let build_newrecursive
(fun (env,impls) (((_,recname),_),bl,arityc,_) ->
let arityc = Constrexpr_ops.mkCProdN bl arityc in
let arity,ctx = Constrintern.interp_type env0 sigma arityc in
- let evdref = ref (Evd.from_env env0) in
- let _, (_, impls') = Constrintern.interp_context_evars env evdref bl in
+ let evd = Evd.from_env env0 in
+ let evd, (_, (_, impls')) = Constrintern.interp_context_evars env evd bl in
let impl = Constrintern.compute_internalization_data env0 Constrintern.Recursive arity impls' in
let open Context.Named.Declaration in
(Environ.push_named (LocalAssum (recname,arity)) env, Id.Map.add recname impl impls))
@@ -214,6 +215,7 @@ let is_rec names =
| GCases(_,_,el,brl) ->
List.exists (fun (e,_) -> lookup names e) el ||
List.exists (lookup_br names) brl
+ | GProj(_,c) -> lookup names c
and lookup_br names (_,(idl,_,rt)) =
let new_names = List.fold_right Id.Set.remove idl names in
lookup new_names rt
@@ -281,7 +283,6 @@ let derive_inversion fix_names =
in
Invfun.derive_correctness
Functional_principles_types.make_scheme
- functional_induction
fix_names_as_constant
lind;
with e when CErrors.noncritical e ->
@@ -405,7 +406,8 @@ let register_struct is_rec (fixpoint_exprl:(Vernacexpr.fixpoint_expr * Vernacexp
match fixpoint_exprl with
| [(((_,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
- Command.do_definition
+ ComDefinition.do_definition
+ ~program_mode:false
fname
(Decl_kinds.Global,(Flags.is_universe_polymorphism ()),Decl_kinds.Definition) pl
bl None body (Some ret_type) (Lemmas.mk_hook (fun _ _ -> ()));
@@ -425,7 +427,7 @@ let register_struct is_rec (fixpoint_exprl:(Vernacexpr.fixpoint_expr * Vernacexp
in
evd,List.rev rev_pconstants
| _ ->
- Command.do_fixpoint Global (Flags.is_universe_polymorphism ()) fixpoint_exprl;
+ ComFixpoint.do_fixpoint Global (Flags.is_universe_polymorphism ()) fixpoint_exprl;
let evd,rev_pconstants =
List.fold_left
(fun (evd,l) ((((_,fname),_),_,_,_,_),_) ->
@@ -615,8 +617,8 @@ and rebuild_nal aux bk bl' nal typ =
let rebuild_bl aux bl typ = rebuild_bl aux bl typ
let recompute_binder_list (fixpoint_exprl : (Vernacexpr.fixpoint_expr * Vernacexpr.decl_notation list) list) =
- let fixl,ntns = Command.extract_fixpoint_components false fixpoint_exprl in
- let ((_,_,typel),_,ctx,_) = Command.interp_fixpoint fixl ntns in
+ let fixl,ntns = ComFixpoint.extract_fixpoint_components false fixpoint_exprl in
+ let ((_,_,typel),_,ctx,_) = ComFixpoint.interp_fixpoint ~cofix:false fixl ntns in
let constr_expr_typel =
with_full_print (List.map (fun c -> Constrextern.extern_constr false (Global.env ()) (Evd.from_ctx ctx) (EConstr.of_constr c))) typel in
let fixpoint_exprl_with_new_bl =
@@ -778,6 +780,7 @@ let rec add_args id new_args = CAst.map (function
| CNotation _ -> anomaly ~label:"add_args " (Pp.str "CNotation.")
| CGeneralization _ -> anomaly ~label:"add_args " (Pp.str "CGeneralization.")
| CDelimiters _ -> anomaly ~label:"add_args " (Pp.str "CDelimiters.")
+ | CProj _ -> user_err Pp.(str "Funind does not support primitive projections")
)
exception Stop of Constrexpr.constr_expr
@@ -841,12 +844,13 @@ let rec get_args b t : Constrexpr.local_binder_expr list *
let make_graph (f_ref:global_reference) =
let c,c_body =
match f_ref with
- | ConstRef c ->
- begin try c,Global.lookup_constant c
- with Not_found ->
- raise (UserError (None,str "Cannot find " ++ Printer.pr_leconstr (mkConst c)) )
- end
- | _ -> raise (UserError (None, str "Not a function reference") )
+ | ConstRef c ->
+ begin try c,Global.lookup_constant c
+ with Not_found ->
+ let sigma, env = Pfedit.get_current_context () in
+ raise (UserError (None,str "Cannot find " ++ Printer.pr_leconstr_env env sigma (mkConst c)) )
+ end
+ | _ -> raise (UserError (None, str "Not a function reference") )
in
(match Global.body_of_constant_body c_body with
| None -> error "Cannot build a graph over an axiom!"
diff --git a/plugins/funind/indfun_common.ml b/plugins/funind/indfun_common.ml
index 76fcd5ec8..d6fd2f2a0 100644
--- a/plugins/funind/indfun_common.ml
+++ b/plugins/funind/indfun_common.ml
@@ -1,8 +1,10 @@
open Names
open Pp
+open Constr
open Libnames
open Globnames
open Refiner
+
let mk_prefix pre id = Id.of_string (pre^(Id.to_string id))
let mk_rel_id = mk_prefix "R_"
let mk_correct_id id = Nameops.add_suffix (mk_rel_id id) "_correct"
@@ -111,7 +113,7 @@ let const_of_id id =
(str "cannot find " ++ Id.print id)
let def_of_const t =
- match (Term.kind_of_term t) with
+ match Constr.kind t with
Term.Const sp ->
(try (match Environ.constant_opt_value_in (Global.env()) sp with
| Some c -> c
@@ -181,12 +183,13 @@ let with_full_print f a =
and old_contextual_implicit_args = Impargs.is_contextual_implicit_args () in
let old_rawprint = !Flags.raw_print in
let old_printuniverses = !Constrextern.print_universes in
+ let old_printallowmatchdefaultclause = !Detyping.print_allow_match_default_clause in
Constrextern.print_universes := true;
+ Detyping.print_allow_match_default_clause := false;
Flags.raw_print := true;
Impargs.make_implicit_args false;
Impargs.make_strict_implicit_args false;
Impargs.make_contextual_implicit_args false;
- Impargs.make_contextual_implicit_args false;
Dumpglob.pause ();
try
let res = f a in
@@ -195,6 +198,7 @@ let with_full_print f a =
Impargs.make_contextual_implicit_args old_contextual_implicit_args;
Flags.raw_print := old_rawprint;
Constrextern.print_universes := old_printuniverses;
+ Detyping.print_allow_match_default_clause := old_printallowmatchdefaultclause;
Dumpglob.continue ();
res
with
@@ -204,6 +208,7 @@ let with_full_print f a =
Impargs.make_contextual_implicit_args old_contextual_implicit_args;
Flags.raw_print := old_rawprint;
Constrextern.print_universes := old_printuniverses;
+ Detyping.print_allow_match_default_clause := old_printallowmatchdefaultclause;
Dumpglob.continue ();
raise reraise
@@ -330,18 +335,18 @@ let discharge_Function (_,finfos) =
is_general = finfos.is_general
}
-open Term
-
let pr_ocst c =
- Option.fold_right (fun v acc -> Printer.pr_lconstr (mkConst v)) c (mt ())
+ let sigma, env = Pfedit.get_current_context () in
+ Option.fold_right (fun v acc -> Printer.pr_lconstr_env env sigma (mkConst v)) c (mt ())
let pr_info f_info =
+ let sigma, env = Pfedit.get_current_context () in
str "function_constant := " ++
- Printer.pr_lconstr (mkConst f_info.function_constant)++ fnl () ++
+ Printer.pr_lconstr_env env sigma (mkConst f_info.function_constant)++ fnl () ++
str "function_constant_type := " ++
(try
- Printer.pr_lconstr
- (fst (Global.type_of_global_in_context (Global.env ()) (ConstRef f_info.function_constant)))
+ Printer.pr_lconstr_env env sigma
+ (fst (Global.type_of_global_in_context env (ConstRef f_info.function_constant)))
with e when CErrors.noncritical e -> mt ()) ++ fnl () ++
str "equation_lemma := " ++ pr_ocst f_info.equation_lemma ++ fnl () ++
str "completeness_lemma :=" ++ pr_ocst f_info.completeness_lemma ++ fnl () ++
@@ -349,7 +354,7 @@ let pr_info f_info =
str "rect_lemma := " ++ pr_ocst f_info.rect_lemma ++ fnl () ++
str "rec_lemma := " ++ pr_ocst f_info.rec_lemma ++ fnl () ++
str "prop_lemma := " ++ pr_ocst f_info.prop_lemma ++ fnl () ++
- str "graph_ind := " ++ Printer.pr_lconstr (mkInd f_info.graph_ind) ++ fnl ()
+ str "graph_ind := " ++ Printer.pr_lconstr_env env sigma (mkInd f_info.graph_ind) ++ fnl ()
let pr_table tb =
let l = Cmap_env.fold (fun k v acc -> v::acc) tb [] in
@@ -545,16 +550,16 @@ let prodn n env b =
(* compose_prod [xn:Tn;..;x1:T1] b = (x1:T1)..(xn:Tn)b *)
let compose_prod l b = prodn (List.length l) l b
-type tcc_lemma_value =
+type tcc_lemma_value =
| Undefined
- | Value of Term.constr
+ | Value of constr
| Not_needed
-(* We only "purify" on exceptions *)
+(* We only "purify" on exceptions. XXX: What is this doing here? *)
let funind_purify f x =
- let st = Vernacentries.freeze_interp_state `No in
+ let st = Vernacstate.freeze_interp_state `No in
try f x
with e ->
let e = CErrors.push e in
- Vernacentries.unfreeze_interp_state st;
+ Vernacstate.unfreeze_interp_state st;
Exninfo.iraise e
diff --git a/plugins/funind/indfun_common.mli b/plugins/funind/indfun_common.mli
index d41abee87..5cc7163aa 100644
--- a/plugins/funind/indfun_common.mli
+++ b/plugins/funind/indfun_common.mli
@@ -38,7 +38,7 @@ val chop_rlambda_n : int -> Glob_term.glob_constr ->
val chop_rprod_n : int -> Glob_term.glob_constr ->
(Name.t*Glob_term.glob_constr) list * Glob_term.glob_constr
-val def_of_const : Term.constr -> Term.constr
+val def_of_const : Constr.t -> Constr.t
val eq : EConstr.constr Lazy.t
val refl_equal : EConstr.constr Lazy.t
val const_of_id: Id.t -> Globnames.global_reference(* constantyes *)
@@ -118,10 +118,10 @@ val decompose_lam_n : Evd.evar_map -> int -> EConstr.t ->
(Names.Name.t * EConstr.t) list * EConstr.t
val compose_lam : (Names.Name.t * EConstr.t) list -> EConstr.t -> EConstr.t
val compose_prod : (Names.Name.t * EConstr.t) list -> EConstr.t -> EConstr.t
-
-type tcc_lemma_value =
+
+type tcc_lemma_value =
| Undefined
- | Value of Term.constr
+ | Value of Constr.t
| Not_needed
val funind_purify : ('a -> 'b) -> ('a -> 'b)
diff --git a/plugins/funind/invfun.ml b/plugins/funind/invfun.ml
index 93317fce1..4acf82d00 100644
--- a/plugins/funind/invfun.ml
+++ b/plugins/funind/invfun.ml
@@ -12,6 +12,7 @@ open CErrors
open Util
open Names
open Term
+open Constr
open EConstr
open Vars
open Pp
@@ -55,12 +56,6 @@ let do_observe_tac s tac g =
CErrors.iprint e ++ str " on goal" ++ fnl() ++ goal ));
iraise reraise;;
-
-let observe_tac_strm s tac g =
- if do_observe ()
- then do_observe_tac s tac g
- else tac g
-
let observe_tac s tac g =
if do_observe ()
then do_observe_tac (str s) tac g
@@ -86,10 +81,6 @@ let make_eq () =
try
EConstr.of_constr (Universes.constr_of_global (Coqlib.build_coq_eq ()))
with _ -> assert false
-let make_eq_refl () =
- try
- EConstr.of_constr (Universes.constr_of_global (Coqlib.build_coq_eq_refl ()))
- with _ -> assert false
(* [generate_type g_to_f f graph i] build the completeness (resp. correctness) lemma type if [g_to_f = true]
@@ -193,10 +184,9 @@ let rec generate_fresh_id x avoid i =
id::(generate_fresh_id x (id::avoid) (pred i))
-(* [prove_fun_correct functional_induction funs_constr graphs_constr schemes lemmas_types_infos i ]
+(* [prove_fun_correct funs_constr graphs_constr schemes lemmas_types_infos i ]
is the tactic used to prove correctness lemma.
- [functional_induction] is the tactic defined in [indfun] (dependency problem)
[funs_constr], [graphs_constr] [schemes] [lemmas_types_infos] are the mutually recursive functions
(resp. graphs of the functions and principles and correctness lemma types) to prove correct.
@@ -217,7 +207,7 @@ let rec generate_fresh_id x avoid i =
\end{enumerate}
*)
-let prove_fun_correct evd functional_induction funs_constr graphs_constr schemes lemmas_types_infos i : Tacmach.tactic =
+let prove_fun_correct evd funs_constr graphs_constr schemes lemmas_types_infos i : Tacmach.tactic =
fun g ->
(* first of all we recreate the lemmas types to be used as predicates of the induction principle
that is~:
@@ -751,14 +741,13 @@ let prove_fun_complete funcs graphs schemes lemmas_types_infos i : Tacmach.tacti
g
-(* [derive_correctness make_scheme functional_induction funs graphs] create correctness and completeness
+(* [derive_correctness make_scheme funs graphs] create correctness and completeness
lemmas for each function in [funs] w.r.t. [graphs]
[make_scheme] is Functional_principle_types.make_scheme (dependency pb) and
- [functional_induction] is Indfun.functional_induction (same pb)
*)
-let derive_correctness make_scheme functional_induction (funs: pconstant list) (graphs:inductive list) =
+let derive_correctness make_scheme (funs: pconstant list) (graphs:inductive list) =
assert (funs <> []);
assert (graphs <> []);
let funs = Array.of_list funs and graphs = Array.of_list graphs in
@@ -808,7 +797,7 @@ let derive_correctness make_scheme functional_induction (funs: pconstant list) (
)
in
let proving_tac =
- prove_fun_correct !evd functional_induction funs_constr graphs_constr schemes lemmas_types_infos
+ prove_fun_correct !evd funs_constr graphs_constr schemes lemmas_types_infos
in
Array.iteri
(fun i f_as_constant ->
@@ -850,7 +839,7 @@ let derive_correctness make_scheme functional_induction (funs: pconstant list) (
EConstr.it_mkProd_or_LetIn type_of_lemma_concl type_of_lemma_ctxt
in
let type_of_lemma = nf_zeta type_of_lemma in
- observe (str "type_of_lemma := " ++ Printer.pr_leconstr type_of_lemma);
+ observe (str "type_of_lemma := " ++ Printer.pr_leconstr_env env !evd type_of_lemma);
type_of_lemma,type_info
)
funs_constr
diff --git a/plugins/funind/invfun.mli b/plugins/funind/invfun.mli
new file mode 100644
index 000000000..e07138596
--- /dev/null
+++ b/plugins/funind/invfun.mli
@@ -0,0 +1,17 @@
+(************************************************************************)
+(* v * The Coq Proof Assistant / The Coq Development Team *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(************************************************************************)
+
+val invfun :
+ Misctypes.quantified_hypothesis ->
+ Globnames.global_reference option ->
+ Evar.t Evd.sigma -> Evar.t list Evd.sigma
+val derive_correctness :
+ (Evd.evar_map ref ->
+ (Constr.pconstant * Sorts.family) list ->
+ 'a Entries.definition_entry list) ->
+ Constr.pconstant list -> Names.inductive list -> unit
diff --git a/plugins/funind/merge.ml b/plugins/funind/merge.ml
deleted file mode 100644
index 77c26f8ce..000000000
--- a/plugins/funind/merge.ml
+++ /dev/null
@@ -1,1004 +0,0 @@
-(************************************************************************)
-(* v * The Coq Proof Assistant / The Coq Development Team *)
-(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *)
-(* \VV/ **************************************************************)
-(* // * This file is distributed under the terms of the *)
-(* * GNU Lesser General Public License Version 2.1 *)
-(************************************************************************)
-
-(* Merging of induction principles. *)
-
-open Globnames
-open Tactics
-open Indfun_common
-open CErrors
-open Util
-open Constrexpr
-open Vernacexpr
-open Pp
-open Names
-open Term
-open Vars
-open Declarations
-open Glob_term
-open Glob_termops
-open Decl_kinds
-open Context.Rel.Declaration
-
-module RelDecl = Context.Rel.Declaration
-
-(** {1 Utilities} *)
-
-(** {2 Useful operations on constr and glob_constr} *)
-
-let pop c = Vars.lift (-1) c
-let rec popn i c = if i<=0 then c else pop (popn (i-1) c)
-
-(** Substitutions in constr *)
-let compare_constr_nosub t1 t2 =
- if compare_constr (fun _ _ -> false) t1 t2
- then true
- else false
-
-let rec compare_constr' t1 t2 =
- if compare_constr_nosub t1 t2
- then true
- else (compare_constr (compare_constr') t1 t2)
-
-let rec substitterm prof t by_t in_u =
- if (compare_constr' (lift prof t) in_u)
- then (lift prof by_t)
- else map_constr_with_binders succ
- (fun i -> substitterm i t by_t) prof in_u
-
-let lift_ldecl n ldecl = List.map (fun (x,y) -> x,lift n y) ldecl
-
-let understand = Pretyping.understand (Global.env()) Evd.empty
-
-(** Operations on names and identifiers *)
-let id_of_name = function
- Anonymous -> Id.of_string "H"
- | Name id -> id;;
-let name_of_string = Id.of_string %> Name.mk_name
-let string_of_name = id_of_name %> Id.to_string
-
-(** [isVarf f x] returns [true] if term [x] is of the form [(Var f)]. *)
-let isVarf f x =
- match DAst.get x with
- | GVar x -> Id.equal x f
- | _ -> false
-
-(** [ident_global_exist id] returns true if identifier [id] is linked
- in global environment. *)
-let ident_global_exist id =
- try
- let ans = CAst.make @@ CRef (Libnames.Ident (Loc.tag id), None) in
- let _ = ignore (Constrintern.intern_constr (Global.env()) ans) in
- true
- with e when CErrors.noncritical e -> false
-
-(** [next_ident_fresh id] returns a fresh identifier (ie not linked in
- global env) with base [id]. *)
-let next_ident_fresh (id:Id.t) =
- let res = ref id in
- while ident_global_exist !res do res := Nameops.increment_subscript !res done;
- !res
-
-
-(** {2 Debugging} *)
-(* comment this line to see debug msgs *)
-let msg x = () ;; let pr_lconstr c = str ""
-(* uncomment this to see debugging *)
-let prconstr c = msg (str" " ++ Printer.pr_lconstr c)
-let prconstrnl c = msg (str" " ++ Printer.pr_lconstr c ++ str"\n")
-let prlistconstr lc = List.iter prconstr lc
-let prstr s = msg(str s)
-let prNamedConstr s c =
- begin
- msg(str "");
- msg(str(s^" {§ ") ++ Printer.pr_lconstr c ++ str " §} ");
- msg(str "");
- end
-let prNamedRConstr s c =
- begin
- msg(str "");
- msg(str(s^" {§ ") ++ Printer.pr_glob_constr c ++ str " §} ");
- msg(str "");
- end
-let prNamedLConstr_aux lc = List.iter (prNamedConstr "\n") lc
-let prNamedLConstr s lc =
- begin
- prstr "[§§§ ";
- prstr s;
- prNamedLConstr_aux lc;
- prstr " §§§]\n";
- end
-let prNamedLDecl s lc =
- begin
- prstr s; prstr "\n";
- List.iter (fun (nm,_,tp) -> prNamedConstr (string_of_name nm) tp) lc;
- prstr "\n";
- end
-let prNamedRLDecl s lc =
- begin
- prstr s; prstr "\n"; prstr "{§§ ";
- List.iter
- (fun x ->
- match x with
- | (nm,None,Some tp) -> prNamedRConstr (string_of_name nm) tp
- | (nm,Some bdy,None) -> prNamedRConstr ("(letin) "^string_of_name nm) bdy
- | _ -> assert false
- ) lc;
- prstr " §§}\n";
- prstr "\n";
- end
-
-(** {2 Misc} *)
-
-exception Found of int
-
-(* Array scanning *)
-
-let array_prfx (arr: 'a array) (pred: int -> 'a -> bool): int =
-match Array.findi pred arr with
-| None -> Array.length arr (* all elt are positive *)
-| Some i -> i
-
-(* Like List.chop but except that [i] is the size of the suffix of [l]. *)
-let list_chop_end i l =
- let size_prefix = List.length l -i in
- if size_prefix < 0 then failwith "list_chop_end"
- else List.chop size_prefix l
-
-let list_fold_lefti (f: int -> 'a -> 'b -> 'a) (acc:'a) (arr:'b list): 'a =
- let i = ref 0 in
- List.fold_left
- (fun acc x ->
- let res = f !i acc x in i := !i + 1; res)
- acc arr
-
-let list_filteri (f: int -> 'a -> bool) (l:'a list):'a list =
- let i = ref 0 in
- List.filter (fun x -> let res = f !i x in i := !i + 1; res) l
-
-
-(** Iteration module *)
-module For =
-struct
- let rec map i j (f: int -> 'a) = if i>j then [] else f i :: (map (i+1) j f)
- let rec foldup i j (f: 'a -> int -> 'a) acc =
- if i>j then acc else let newacc = f acc i in foldup (i+1) j f newacc
- let rec folddown i j (f: 'a -> int -> 'a) acc =
- if i>j then acc else let newacc = f acc j in folddown i (j-1) f newacc
- let fold i j = if i<j then foldup i j else folddown i j
-end
-
-
-(** {1 Parameters shifting and linking information} *)
-
-(** This type is used to deal with debruijn linked indices. When a
- variable is linked to a previous one, we will ignore it and refer
- to previous one. *)
-type linked_var =
- | Linked of int
- | Unlinked
- | Funres
-
-(** When merging two graphs, parameters may become regular arguments,
- and thus be shifted. This type describes the result of computing
- the changes. *)
-type 'a shifted_params =
- {
- nprm1:'a;
- nprm2:'a;
- prm2_unlinked:'a list; (* ranks of unlinked params in nprms2 *)
- nuprm1:'a;
- nuprm2:'a;
- nargs1:'a;
- nargs2:'a;
- }
-
-
-let prlinked x =
- match x with
- | Linked i -> Printf.sprintf "Linked %d" i
- | Unlinked -> Printf.sprintf "Unlinked"
- | Funres -> Printf.sprintf "Funres"
-
-let linkmonad f lnkvar =
- match lnkvar with
- | Linked i -> Linked (f i)
- | Unlinked -> Unlinked
- | Funres -> Funres
-
-let linklift lnkvar i = linkmonad (fun x -> x+i) lnkvar
-
-(* This map is used to deal with debruijn linked indices. *)
-module Link = Map.Make (Int)
-
-let pr_links l =
- Printf.printf "links:\n";
- Link.iter (fun k e -> Printf.printf "%d : %s\n" k (prlinked e)) l;
- Printf.printf "_____________\n"
-
-type 'a merged_arg =
- | Prm_stable of 'a
- | Prm_linked of 'a
- | Prm_arg of 'a
- | Arg_stable of 'a
- | Arg_linked of 'a
- | Arg_funres
-
-(** Information about graph merging of two inductives.
- All rel_decl list are IN REVERSE ORDER (ie well suited for compose) *)
-
-type merge_infos =
- {
- ident:Id.t; (** new inductive name *)
- mib1: mutual_inductive_body;
- oib1: one_inductive_body;
- mib2: mutual_inductive_body;
- oib2: one_inductive_body;
-
- (** Array of links of the first inductive (should be all stable) *)
- lnk1: int merged_arg array;
-
- (** Array of links of the second inductive (point to the first ind param/args) *)
- lnk2: int merged_arg array;
-
- (** rec params which remain rec param (ie not linked) *)
- recprms1: Context.Rel.Declaration.t list;
- recprms2: Context.Rel.Declaration.t list;
- nrecprms1: int;
- nrecprms2: int;
-
- (** rec parms which became non parm (either linked to something
- or because after a rec parm that became non parm) *)
- otherprms1: Context.Rel.Declaration.t list;
- otherprms2: Context.Rel.Declaration.t list;
- notherprms1:int;
- notherprms2:int;
-
- (** args which remain args in merge *)
- args1:Context.Rel.Declaration.t list;
- args2:Context.Rel.Declaration.t list;
- nargs1:int;
- nargs2:int;
-
- (** functional result args *)
- funresprms1: Context.Rel.Declaration.t list;
- funresprms2: Context.Rel.Declaration.t list;
- nfunresprms1:int;
- nfunresprms2:int;
- }
-
-
-let pr_merginfo x =
- let i,s=
- match x with
- | Prm_linked i -> Some i,"Prm_linked"
- | Arg_linked i -> Some i,"Arg_linked"
- | Prm_stable i -> Some i,"Prm_stable"
- | Prm_arg i -> Some i,"Prm_arg"
- | Arg_stable i -> Some i,"Arg_stable"
- | Arg_funres -> None , "Arg_funres" in
- match i with
- | Some i -> Printf.sprintf "%s(%d)" s i
- | None -> Printf.sprintf "%s" s
-
-let isPrm_stable x = match x with Prm_stable _ -> true | _ -> false
-
-(* ?? prm_linked?? *)
-let isArg_stable x = match x with Arg_stable _ | Prm_arg _ -> true | _ -> false
-
-let is_stable x =
- match x with Arg_stable _ | Prm_stable _ | Prm_arg _ -> true | _ -> false
-
-let isArg_funres x = match x with Arg_funres -> true | _ -> false
-
-let filter_shift_stable (lnk:int merged_arg array) (l:'a list): 'a list =
- let prms = list_filteri (fun i _ -> isPrm_stable lnk.(i)) l in
- let args = list_filteri (fun i _ -> isArg_stable lnk.(i)) l in
- let fres = list_filteri (fun i _ -> isArg_funres lnk.(i)) l in
- prms@args@fres
-
-(** Reverse the link map, keeping only linked vars, elements are list
- of int as several vars may be linked to the same var. *)
-let revlinked lnk =
- For.fold 0 (Array.length lnk - 1)
- (fun acc k ->
- match lnk.(k) with
- | Unlinked | Funres -> acc
- | Linked i ->
- let old = try Link.find i acc with Not_found -> [] in
- Link.add i (k::old) acc)
- Link.empty
-
-let array_switch arr i j =
- let aux = arr.(j) in arr.(j) <- arr.(i); arr.(i) <- aux
-
-let filter_shift_stable_right (lnk:int merged_arg array) (l:'a list): 'a list =
- let larr = Array.of_list l in
- let _ =
- Array.iteri
- (fun j x ->
- match x with
- | Prm_linked i -> array_switch larr i j
- | Arg_linked i -> array_switch larr i j
- | Prm_stable i -> ()
- | Prm_arg i -> ()
- | Arg_stable i -> ()
- | Arg_funres -> ()
- ) lnk in
- filter_shift_stable lnk (Array.to_list larr)
-
-
-let error msg = user_err Pp.(str msg)
-
-(** {1 Utilities for merging} *)
-
-let ind1name = Id.of_string "__ind1"
-let ind2name = Id.of_string "__ind2"
-
-(** Performs verifications on two graphs before merging: they must not
- be co-inductive, and for the moment they must not be mutual
- either. *)
-let verify_inds mib1 mib2 =
- if mib1.mind_finite == Decl_kinds.CoFinite then error "First argument is coinductive";
- if mib2.mind_finite == Decl_kinds.CoFinite then error "Second argument is coinductive";
- if not (Int.equal mib1.mind_ntypes 1) then error "First argument is mutual";
- if not (Int.equal mib2.mind_ntypes 1) then error "Second argument is mutual";
- ()
-
-(*
-(** [build_raw_params prms_decl avoid] returns a list of variables
- attributed to the list of decl [prms_decl], avoiding names in
- [avoid]. *)
-let build_raw_params prms_decl avoid =
- let dummy_constr = compose_prod (List.map (fun (x,_,z) -> x,z) prms_decl) (mkRel 1) in
- let _ = prNamedConstr "DUMMY" dummy_constr in
- let dummy_glob_constr = Detyping.detype false avoid [] dummy_constr in
- let _ = prNamedRConstr "RAWDUMMY" dummy_glob_constr in
- let res,_ = glob_decompose_prod dummy_glob_constr in
- let comblist = List.combine prms_decl res in
- comblist, res , (avoid @ (Id.Set.elements (ids_of_glob_constr dummy_glob_constr)))
-*)
-
-let ids_of_rawlist avoid rawl =
- List.fold_left Id.Set.union avoid (List.map ids_of_glob_constr rawl)
-
-
-
-(** {1 Merging function graphs} *)
-
-(** [shift_linked_params mib1 mib2 lnk] Computes which parameters (rec
- uniform and ordinary ones) of mutual inductives [mib1] and [mib2]
- remain uniform when linked by [lnk]. All parameters are
- considered, ie we take parameters of the first inductive body of
- [mib1] and [mib2].
-
- Explanation: The two inductives have parameters, some of the first
- are recursively uniform, some of the last are functional result of
- the functional graph.
-
- (I x1 x2 ... xk ... xk' ... xn)
- (J y1 y2 ... xl ... yl' ... ym)
-
- Problem is, if some rec unif params are linked to non rec unif
- ones, they become non rec (and the following too). And functinal
- argument have to be shifted at the end *)
-let shift_linked_params mib1 mib2 (lnk1:linked_var array) (lnk2:linked_var array) id =
- let _ = prstr "\nYOUHOU shift\n" in
- let linked_targets = revlinked lnk2 in
- let is_param_of_mib1 x = x < mib1.mind_nparams_rec in
- let is_param_of_mib2 x = x < mib2.mind_nparams_rec in
- let is_targetted_by_non_recparam_lnk1 i =
- try
- let targets = Link.find i linked_targets in
- List.exists (fun x -> not (is_param_of_mib2 x)) targets
- with Not_found -> false in
- let mlnk1 =
- Array.mapi
- (fun i lkv ->
- let isprm = is_param_of_mib1 i in
- let prmlost = is_targetted_by_non_recparam_lnk1 i in
- match isprm , prmlost, lnk1.(i) with
- | true , true , _ -> Prm_arg i (* recparam becoming ordinary *)
- | true , false , _-> Prm_stable i (* recparam remains recparam*)
- | false , false , Funres -> Arg_funres
- | _ , _ , Funres -> assert false (* fun res cannot be a rec param or lost *)
- | false , _ , _ -> Arg_stable i) (* Args of lnk1 are not linked *)
- lnk1 in
- let mlnk2 =
- Array.mapi
- (fun i lkv ->
- (* Is this correct if some param of ind2 is lost? *)
- let isprm = is_param_of_mib2 i in
- match isprm , lnk2.(i) with
- | true , Linked j when not (is_param_of_mib1 j) ->
- Prm_arg j (* recparam becoming ordinary *)
- | true , Linked j -> Prm_linked j (*recparam linked to recparam*)
- | true , Unlinked -> Prm_stable i (* recparam remains recparam*)
- | false , Linked j -> Arg_linked j (* Args of lnk2 lost *)
- | false , Unlinked -> Arg_stable i (* Args of lnk2 remains *)
- | false , Funres -> Arg_funres
- | true , Funres -> assert false (* fun res cannot be a rec param *)
- )
- lnk2 in
- let oib1 = mib1.mind_packets.(0) in
- let oib2 = mib2.mind_packets.(0) in
- (* count params remaining params *)
- let n_params1 = array_prfx mlnk1 (fun i x -> not (isPrm_stable x)) in
- let n_params2 = array_prfx mlnk2 (fun i x -> not (isPrm_stable x)) in
- let bldprms arity_ctxt mlnk =
- list_fold_lefti
- (fun i (acc1,acc2,acc3,acc4) x ->
- prstr (pr_merginfo mlnk.(i));prstr "\n";
- match mlnk.(i) with
- | Prm_stable _ -> x::acc1 , acc2 , acc3, acc4
- | Prm_arg _ -> acc1 , x::acc2 , acc3, acc4
- | Arg_stable _ -> acc1 , acc2 , x::acc3, acc4
- | Arg_funres -> acc1 , acc2 , acc3, x::acc4
- | _ -> acc1 , acc2 , acc3, acc4)
- ([],[],[],[]) arity_ctxt in
-(* let arity_ctxt2 =
- build_raw_params oib2.mind_arity_ctxt
- (Id.Set.elements (ids_of_glob_constr oib1.mind_arity_ctxt)) in*)
- let recprms1,otherprms1,args1,funresprms1 = bldprms (List.rev oib1.mind_arity_ctxt) mlnk1 in
- let _ = prstr "\n\n\n" in
- let recprms2,otherprms2,args2,funresprms2 = bldprms (List.rev oib2.mind_arity_ctxt) mlnk2 in
- let _ = prstr "\notherprms1:\n" in
- let _ =
- List.iter (fun decl -> prstr (string_of_name (RelDecl.get_name decl) ^ " : ");
- prconstr (RelDecl.get_type decl); prstr "\n")
- otherprms1 in
- let _ = prstr "\notherprms2:\n" in
- let _ =
- List.iter (fun decl -> prstr (string_of_name (RelDecl.get_name decl) ^ " : "); prconstr (RelDecl.get_type decl); prstr "\n")
- otherprms2 in
- {
- ident=id;
- mib1=mib1;
- oib1 = oib1;
- mib2=mib2;
- oib2 = oib2;
- lnk1 = mlnk1;
- lnk2 = mlnk2;
- nrecprms1 = n_params1;
- recprms1 = recprms1;
- otherprms1 = otherprms1;
- args1 = args1;
- funresprms1 = funresprms1;
- notherprms1 = Array.length mlnk1 - n_params1;
- nfunresprms1 = List.length funresprms1;
- nargs1 = List.length args1;
- nrecprms2 = n_params2;
- recprms2 = recprms2;
- otherprms2 = otherprms2;
- args2 = args2;
- funresprms2 = funresprms2;
- notherprms2 = Array.length mlnk2 - n_params2;
- nargs2 = List.length args2;
- nfunresprms2 = List.length funresprms2;
- }
-
-
-
-
-(** {1 Merging functions} *)
-
-exception NoMerge
-
-let rec merge_app c1 c2 id1 id2 shift filter_shift_stable =
- let lnk = Array.append shift.lnk1 shift.lnk2 in
- match DAst.get c1, DAst.get c2 with
- | GApp(f1, arr1), GApp(f2,arr2) when isVarf id1 f1 && isVarf id2 f2 ->
- let _ = prstr "\nICI1!\n" in
- let args = filter_shift_stable lnk (arr1 @ arr2) in
- DAst.make @@ GApp ((DAst.make @@ GVar shift.ident) , args)
- | GApp(f1, arr1), GApp(f2,arr2) -> raise NoMerge
- | GLetIn(nme,bdy,typ,trm) , _ ->
- let _ = prstr "\nICI2!\n" in
- let newtrm = merge_app trm c2 id1 id2 shift filter_shift_stable in
- DAst.make @@ GLetIn(nme,bdy,typ,newtrm)
- | _, GLetIn(nme,bdy,typ,trm) ->
- let _ = prstr "\nICI3!\n" in
- let newtrm = merge_app c1 trm id1 id2 shift filter_shift_stable in
- DAst.make @@ GLetIn(nme,bdy,typ,newtrm)
- | _ -> let _ = prstr "\nICI4!\n" in
- raise NoMerge
-
-let rec merge_app_unsafe c1 c2 shift filter_shift_stable =
- let lnk = Array.append shift.lnk1 shift.lnk2 in
- match DAst.get c1, DAst.get c2 with
- | GApp(f1, arr1), GApp(f2,arr2) ->
- let args = filter_shift_stable lnk (arr1 @ arr2) in
- DAst.make @@ GApp (DAst.make @@ GVar shift.ident, args)
- (* FIXME: what if the function appears in the body of the let? *)
- | GLetIn(nme,bdy,typ,trm) , _ ->
- let _ = prstr "\nICI2 '!\n" in
- let newtrm = merge_app_unsafe trm c2 shift filter_shift_stable in
- DAst.make @@ GLetIn(nme,bdy,typ,newtrm)
- | _, GLetIn(nme,bdy,typ,trm) ->
- let _ = prstr "\nICI3 '!\n" in
- let newtrm = merge_app_unsafe c1 trm shift filter_shift_stable in
- DAst.make @@ GLetIn(nme,bdy,typ,newtrm)
- | _ -> let _ = prstr "\nICI4 '!\n" in raise NoMerge
-
-
-
-(* Heuristic when merging two lists of hypothesis: merge every rec
- calls of branch 1 with all rec calls of branch 2. *)
-(* TODO: reecrire cette heuristique (jusqu'a merge_types) *)
-let rec merge_rec_hyps shift accrec
- (ltyp:(Name.t * glob_constr option * glob_constr option) list)
- filter_shift_stable : (Name.t * glob_constr option * glob_constr option) list =
- let is_app c = match DAst.get c with GApp _ -> true | _ -> false in
- let mergeonehyp t reldecl =
- match reldecl with
- | (nme,x,Some ind) when is_app ind
- -> nme,x, Some (merge_app_unsafe ind t shift filter_shift_stable)
- | (nme,Some _,None) -> error "letins with recursive calls not treated yet"
- | (nme,None,Some _) -> assert false
- | (nme,None,None) | (nme,Some _,Some _) -> assert false in
- let is_app c = match DAst.get c with GApp (f, _) -> isVarf ind2name f | _ -> false in
- match ltyp with
- | [] -> []
- | (nme,None,Some t) :: lt when is_app t ->
- let rechyps = List.map (mergeonehyp t) accrec in
- rechyps @ merge_rec_hyps shift accrec lt filter_shift_stable
- | e::lt -> e :: merge_rec_hyps shift accrec lt filter_shift_stable
-
-
-let build_suppl_reccall (accrec:(Name.t * glob_constr) list) concl2 shift =
- List.map (fun (nm,tp) -> (nm,merge_app_unsafe tp concl2 shift)) accrec
-
-
-let find_app (nme:Id.t) ltyp =
- let is_app c = match DAst.get c with GApp (f, _) -> isVarf nme f | _ -> false in
- try
- ignore
- (List.map
- (fun x ->
- match x with
- | _,None,Some c when is_app c -> raise (Found 0)
- | _ -> ())
- ltyp);
- false
- with Found _ -> true
-
-let prnt_prod_or_letin nm letbdy typ =
- match letbdy , typ with
- | Some lbdy , None -> prNamedRConstr ("(letin) " ^ string_of_name nm) lbdy
- | None , Some tp -> prNamedRConstr (string_of_name nm) tp
- | _ , _ -> assert false
-
-
-let rec merge_types shift accrec1
- (ltyp1:(Name.t * glob_constr option * glob_constr option) list)
- (concl1:glob_constr) (ltyp2:(Name.t * glob_constr option * glob_constr option) list) concl2
- : (Name.t * glob_constr option * glob_constr option) list * glob_constr =
- let _ = prstr "MERGE_TYPES\n" in
- let _ = prstr "ltyp 1 : " in
- let _ = List.iter (fun (nm,lbdy,tp) -> prnt_prod_or_letin nm lbdy tp) ltyp1 in
- let _ = prstr "\nltyp 2 : " in
- let _ = List.iter (fun (nm,lbdy,tp) -> prnt_prod_or_letin nm lbdy tp) ltyp2 in
- let _ = prstr "\n" in
- let res =
- match ltyp1 with
- | [] ->
- let isrec1 = not (List.is_empty accrec1) in
- let isrec2 = find_app ind2name ltyp2 in
- let rechyps =
- if isrec1 && isrec2
- then (* merge_rec_hyps shift accrec1 ltyp2 filter_shift_stable *)
- merge_rec_hyps shift [name_of_string "concl1",None,Some concl1] ltyp2
- filter_shift_stable_right
- @ merge_rec_hyps shift accrec1 [name_of_string "concl2",None, Some concl2]
- filter_shift_stable
- else if isrec1
- (* if rec calls in accrec1 and not in ltyp2, add one to ltyp2 *)
- then
- merge_rec_hyps shift accrec1
- (ltyp2@[name_of_string "concl2",None,Some concl2]) filter_shift_stable
- else if isrec2
- then merge_rec_hyps shift [name_of_string "concl1",None,Some concl1] ltyp2
- filter_shift_stable_right
- else ltyp2 in
- let _ = prstr"\nrechyps : " in
- let _ = List.iter(fun (nm,lbdy,tp)-> prnt_prod_or_letin nm lbdy tp) rechyps in
- let _ = prstr "MERGE CONCL : " in
- let _ = prNamedRConstr "concl1" concl1 in
- let _ = prstr " with " in
- let _ = prNamedRConstr "concl2" concl2 in
- let _ = prstr "\n" in
- let concl =
- merge_app concl1 concl2 ind1name ind2name shift filter_shift_stable in
- let _ = prstr "FIN " in
- let _ = prNamedRConstr "concl" concl in
- let _ = prstr "\n" in
-
- rechyps , concl
- | (nme,None, Some t1)as e ::lt1 ->
- (match DAst.get t1 with
- | GApp(f,carr) when isVarf ind1name f ->
- merge_types shift (e::accrec1) lt1 concl1 ltyp2 concl2
- | _ ->
- let recres, recconcl2 =
- merge_types shift accrec1 lt1 concl1 ltyp2 concl2 in
- ((nme,None,Some t1) :: recres) , recconcl2)
- | (nme,Some bd, None) ::lt1 ->
- (* FIXME: what if ind1name appears in bd? *)
- let recres, recconcl2 =
- merge_types shift accrec1 lt1 concl1 ltyp2 concl2 in
- ((nme,Some bd,None) :: recres) , recconcl2
- | (_,None,None)::_ | (_,Some _,Some _)::_ -> assert false
- in
- res
-
-
-(** [build_link_map_aux allargs1 allargs2 shift] returns the mapping of
- linked args [allargs2] to target args of [allargs1] as specified
- in [shift]. [allargs1] and [allargs2] are in reverse order. Also
- returns the list of unlinked vars of [allargs2]. *)
-let build_link_map_aux (allargs1:Id.t array) (allargs2:Id.t array)
- (lnk:int merged_arg array) =
- Array.fold_left_i
- (fun i acc e ->
- if Int.equal i (Array.length lnk - 1) then acc (* functional arg, not in allargs *)
- else
- match e with
- | Prm_linked j | Arg_linked j -> Id.Map.add allargs2.(i) allargs1.(j) acc
- | _ -> acc)
- Id.Map.empty lnk
-
-let build_link_map allargs1 allargs2 lnk =
- let allargs1 =
- Array.of_list (List.rev_map (fun (x,_,_) -> id_of_name x) allargs1) in
- let allargs2 =
- Array.of_list (List.rev_map (fun (x,_,_) -> id_of_name x) allargs2) in
- build_link_map_aux allargs1 allargs2 lnk
-
-
-(** [merge_one_constructor lnk shift typcstr1 typcstr2] merges the two
- constructor rawtypes [typcstr1] and [typcstr2]. [typcstr1] and
- [typcstr2] contain all parameters (including rec. unif. ones) of
- their inductive.
-
- if [typcstr1] and [typcstr2] are of the form:
-
- forall recparams1, forall ordparams1, H1a -> H2a... (I1 x1 y1 ... z1)
- forall recparams2, forall ordparams2, H2b -> H2b... (I2 x2 y2 ... z2)
-
- we build:
-
- forall recparams1 (recparams2 without linked params),
- forall ordparams1 (ordparams2 without linked params),
- H1a' -> H2a' -> ... -> H2a' -> H2b'(shifted) -> ...
- -> (newI x1 ... z1 x2 y2 ...z2 without linked params)
-
- where Hix' have been adapted, ie:
- - linked vars have been changed,
- - rec calls to I1 and I2 have been replaced by rec calls to
- newI. More precisely calls to I1 and I2 have been merge by an
- experimental heuristic (in particular if n o rec calls for I1
- or I2 is found, we use the conclusion as a rec call). See
- [merge_types] above.
-
- Precond: vars sets of [typcstr1] and [typcstr2] must be disjoint.
-
- TODO: return nothing if equalities (after linking) are contradictory. *)
-let merge_one_constructor (shift:merge_infos) (typcstr1:glob_constr)
- (typcstr2:glob_constr) : glob_constr =
- (* FIXME: les noms des parametres corerspondent en principe au
- parametres du niveau mib, mais il faudrait s'en assurer *)
- (* shift.nfunresprmsx last args are functional result *)
- let nargs1 =
- shift.mib1.mind_nparams + shift.oib1.mind_nrealargs - shift.nfunresprms1 in
- let nargs2 =
- shift.mib2.mind_nparams + shift.oib2.mind_nrealargs - shift.nfunresprms2 in
- let allargs1,rest1 = glob_decompose_prod_or_letin_n nargs1 typcstr1 in
- let allargs2,rest2 = glob_decompose_prod_or_letin_n nargs2 typcstr2 in
- (* Build map of linked args of [typcstr2], and apply it to [typcstr2]. *)
- let linked_map = build_link_map allargs1 allargs2 shift.lnk2 in
- let rest2 = change_vars linked_map rest2 in
- let hyps1,concl1 = glob_decompose_prod_or_letin rest1 in
- let hyps2,concl2' = glob_decompose_prod_or_letin rest2 in
- let ltyp,concl2 =
- merge_types shift [] (List.rev hyps1) concl1 (List.rev hyps2) concl2' in
- let _ = prNamedRLDecl "ltyp result:" ltyp in
- let typ = glob_compose_prod_or_letin concl2 (List.rev ltyp) in
- let revargs1 =
- list_filteri (fun i _ -> isArg_stable shift.lnk1.(i)) (List.rev allargs1) in
- let _ = prNamedRLDecl "ltyp allargs1" allargs1 in
- let _ = prNamedRLDecl "ltyp revargs1" revargs1 in
- let revargs2 =
- list_filteri (fun i _ -> isArg_stable shift.lnk2.(i)) (List.rev allargs2) in
- let _ = prNamedRLDecl "ltyp allargs2" allargs2 in
- let _ = prNamedRLDecl "ltyp revargs2" revargs2 in
- let typwithprms =
- glob_compose_prod_or_letin typ (List.rev revargs2 @ List.rev revargs1) in
- typwithprms
-
-
-(** constructor numbering *)
-let fresh_cstror_suffix , cstror_suffix_init =
- let cstror_num = ref 0 in
- (fun () ->
- let res = string_of_int !cstror_num in
- cstror_num := !cstror_num + 1;
- res) ,
- (fun () -> cstror_num := 0)
-
-(** [merge_constructor_id id1 id2 shift] returns the identifier of the
- new constructor from the id of the two merged constructor and
- the merging info. *)
-let merge_constructor_id id1 id2 shift:Id.t =
- let id = Id.to_string shift.ident ^ "_" ^ fresh_cstror_suffix () in
- next_ident_fresh (Id.of_string id)
-
-
-
-(** [merge_constructors lnk shift avoid] merges the two list of
- constructor [(name*type)]. These are translated to glob_constr
- first, each of them having distinct var names. *)
-let merge_constructors (shift:merge_infos) (avoid:Id.Set.t)
- (typcstr1:(Id.t * glob_constr) list)
- (typcstr2:(Id.t * glob_constr) list) : (Id.t * glob_constr) list =
- List.flatten
- (List.map
- (fun (id1,rawtyp1) ->
- List.map
- (fun (id2,rawtyp2) ->
- let typ = merge_one_constructor shift rawtyp1 rawtyp2 in
- let newcstror_id = merge_constructor_id id1 id2 shift in
- let _ = prstr "\n**************\n" in
- newcstror_id , typ)
- typcstr2)
- typcstr1)
-
-(** [merge_inductive_body lnk shift avoid oib1 oib2] merges two
- inductive bodies [oib1] and [oib2], linking with [lnk], params
- info in [shift], avoiding identifiers in [avoid]. *)
-let merge_inductive_body (shift:merge_infos) avoid (oib1:one_inductive_body)
- (oib2:one_inductive_body) =
- (* building glob_constr type of constructors *)
- let mkrawcor nme avoid typ =
- (* first replace rel 1 by a varname *)
- let substindtyp = substitterm 0 (mkRel 1) (mkVar nme) typ in
- let substindtyp = EConstr.of_constr substindtyp in
- Detyping.detype Detyping.Now false avoid (Global.env()) Evd.empty substindtyp in
- let lcstr1: glob_constr list =
- Array.to_list (Array.map (mkrawcor ind1name avoid) oib1.mind_user_lc) in
- (* add to avoid all indentifiers of lcstr1 *)
- let avoid2 = Id.Set.union avoid (ids_of_rawlist avoid lcstr1) in
- let lcstr2 =
- Array.to_list (Array.map (mkrawcor ind2name avoid2) oib2.mind_user_lc) in
- let avoid3 = Id.Set.union avoid (ids_of_rawlist avoid lcstr2) in
-
- let params1 =
- try fst (glob_decompose_prod_n shift.nrecprms1 (List.hd lcstr1))
- with e when CErrors.noncritical e -> [] in
- let params2 =
- try fst (glob_decompose_prod_n shift.nrecprms2 (List.hd lcstr2))
- with e when CErrors.noncritical e -> [] in
-
- let lcstr1 = List.combine (Array.to_list oib1.mind_consnames) lcstr1 in
- let lcstr2 = List.combine (Array.to_list oib2.mind_consnames) lcstr2 in
-
- cstror_suffix_init();
- params1,params2,merge_constructors shift avoid3 lcstr1 lcstr2
-
-
-(** [merge_mutual_inductive_body lnk mib1 mib2 shift] merge mutual
- inductive bodies [mib1] and [mib2] linking vars with
- [lnk]. [shift] information on parameters of the new inductive.
- For the moment, inductives are supposed to be non mutual.
-*)
-let merge_mutual_inductive_body
- (mib1:mutual_inductive_body) (mib2:mutual_inductive_body) (shift:merge_infos) =
- (* Mutual not treated, we take first ind body of each. *)
- merge_inductive_body shift Id.Set.empty mib1.mind_packets.(0) mib2.mind_packets.(0)
-
-
-let glob_constr_to_constr_expr x = (* build a constr_expr from a glob_constr *)
- Flags.with_option Flags.raw_print (Constrextern.extern_glob_type Id.Set.empty) x
-
-let merge_rec_params_and_arity prms1 prms2 shift (concl:constr) =
- let params = prms2 @ prms1 in
- let resparams =
- List.fold_left
- (fun acc (nme,tp) ->
- let _ = prstr "param :" in
- let _ = prNamedRConstr (string_of_name nme) tp in
- let _ = prstr " ; " in
- let typ = glob_constr_to_constr_expr tp in
- CLocalAssum ([(Loc.tag nme)], Constrexpr_ops.default_binder_kind, typ) :: acc)
- [] params in
- let concl = Constrextern.extern_constr false (Global.env()) Evd.empty (EConstr.of_constr concl) in
- let arity,_ =
- List.fold_left
- (fun (acc,env) decl ->
- let nm = Context.Rel.Declaration.get_name decl in
- let c = RelDecl.get_type decl in
- let typ = Constrextern.extern_constr false env Evd.empty (EConstr.of_constr c) in
- let newenv = Environ.push_rel (LocalAssum (nm,c)) env in
- CAst.make @@ CProdN ([[(Loc.tag nm)],Constrexpr_ops.default_binder_kind,typ] , acc) , newenv)
- (concl,Global.env())
- (shift.funresprms2 @ shift.funresprms1
- @ shift.args2 @ shift.args1 @ shift.otherprms2 @ shift.otherprms1) in
- resparams,arity
-
-
-
-(** [glob_constr_list_to_inductive_expr ident rawlist] returns the
- induct_expr corresponding to the the list of constructor types
- [rawlist], named ident.
- FIXME: params et cstr_expr (arity) *)
-let glob_constr_list_to_inductive_expr prms1 prms2 mib1 mib2 shift
- (rawlist:(Id.t * glob_constr) list) =
- let lident = (Loc.tag shift.ident), None in
- let bindlist , cstr_expr = (* params , arities *)
- merge_rec_params_and_arity prms1 prms2 shift mkSet in
- let lcstor_expr : (bool * (lident * constr_expr)) list =
- List.map (* zeta_normalize t ? *)
- (fun (id,t) -> false, ((Loc.tag id),glob_constr_to_constr_expr t))
- rawlist in
- lident , bindlist , Some cstr_expr , lcstor_expr
-
-
-let mkProd_reldecl (rdecl:Context.Rel.Declaration.t) (t2:glob_constr) =
- match rdecl with
- | LocalAssum (nme,t) ->
- let t = EConstr.of_constr t in
- let traw = Detyping.detype Detyping.Now false Id.Set.empty (Global.env()) Evd.empty t in
- DAst.make @@ GProd (nme,Explicit,traw,t2)
- | LocalDef _ -> assert false
-
-
-(** [merge_inductive ind1 ind2 lnk] merges two graphs, linking
- variables specified in [lnk]. Graphs are not supposed to be mutual
- inductives for the moment. *)
-let merge_inductive (ind1: inductive) (ind2: inductive)
- (lnk1: linked_var array) (lnk2: linked_var array) id =
- let env = Global.env() in
- let mib1,_ = Inductive.lookup_mind_specif env ind1 in
- let mib2,_ = Inductive.lookup_mind_specif env ind2 in
- let _ = verify_inds mib1 mib2 in (* raises an exception if something wrong *)
- (* compute params that become ordinary args (because linked to ord. args) *)
- let shift_prm = shift_linked_params mib1 mib2 lnk1 lnk2 id in
- let prms1,prms2, rawlist = merge_mutual_inductive_body mib1 mib2 shift_prm in
- let _ = prstr "\nrawlist : " in
- let _ =
- List.iter (fun (nm,tp) -> prNamedRConstr (Id.to_string nm) tp;prstr "\n") rawlist in
- let _ = prstr "\nend rawlist\n" in
-(* FIX: retransformer en constr ici
- let shift_prm =
- { shift_prm with
- recprms1=prms1;
- recprms1=prms1;
- } in *)
- let indexpr = glob_constr_list_to_inductive_expr prms1 prms2 mib1 mib2 shift_prm rawlist in
- (* Declare inductive *)
- let indl,_,_ = Command.extract_mutual_inductive_declaration_components [(indexpr,[])] in
- let mie,pl,impls = Command.interp_mutual_inductive indl []
- false (* non-cumulative *) false (*FIXMEnon-poly *) false (* means not private *) Decl_kinds.Finite (* means: not coinductive *) in
- (* Declare the mutual inductive block with its associated schemes *)
- ignore (Command.declare_mutual_inductive_with_eliminations mie pl impls)
-
-
-(* Find infos on identifier id. *)
-let find_Function_infos_safe (id:Id.t): Indfun_common.function_info =
- let kn_of_id x =
- let f_ref = Libnames.Ident (Loc.tag x) in
- locate_with_msg (str "Don't know what to do with " ++ Libnames.pr_reference f_ref)
- locate_constant f_ref in
- try find_Function_infos (kn_of_id id)
- with Not_found ->
- user_err ~hdr:"indfun" (Id.print id ++ str " has no functional scheme")
-
-(** [merge id1 id2 args1 args2 id] builds and declares a new inductive
- type called [id], representing the merged graphs of both graphs
- [ind1] and [ind2]. identifiers occurring in both arrays [args1] and
- [args2] are considered linked (i.e. are the same variable) in the
- new graph.
-
- Warning: For the moment, repetitions of an id in [args1] or
- [args2] are not supported. *)
-let merge (id1:Id.t) (id2:Id.t) (args1:Id.t array)
- (args2:Id.t array) id : unit =
- let finfo1 = find_Function_infos_safe id1 in
- let finfo2 = find_Function_infos_safe id2 in
- (* FIXME? args1 are supposed unlinked. mergescheme (G x x) ?? *)
- (* We add one arg (functional arg of the graph) *)
- let lnk1 = Array.make (Array.length args1 + 1) Unlinked in
- let lnk2' = (* args2 may be linked to args1 members. FIXME: same
- as above: vars may be linked inside args2?? *)
- Array.mapi
- (fun i c ->
- match Array.findi (fun i x -> Id.equal x c) args1 with
- | Some j -> Linked j
- | None -> Unlinked)
- args2 in
- (* We add one arg (functional arg of the graph) *)
- let lnk2 = Array.append lnk2' (Array.make 1 Unlinked) in
- (* setting functional results *)
- let _ = lnk1.(Array.length lnk1 - 1) <- Funres in
- let _ = lnk2.(Array.length lnk2 - 1) <- Funres in
- merge_inductive finfo1.graph_ind finfo2.graph_ind lnk1 lnk2 id
-
-
-let remove_last_arg c =
- let (x,y) = decompose_prod c in
- let xnolast = List.rev (List.tl (List.rev x)) in
- compose_prod xnolast y
-
-let rec remove_n_fst_list n l = if Int.equal n 0 then l else remove_n_fst_list (n-1) (List.tl l)
-let remove_n_last_list n l = List.rev (remove_n_fst_list n (List.rev l))
-
-let remove_last_n_arg n c =
- let (x,y) = decompose_prod c in
- let xnolast = remove_n_last_list n x in
- compose_prod xnolast y
-
-(* [funify_branches relinfo nfuns branch] returns the branch [branch]
- of the relinfo [relinfo] modified to fit in a functional principle.
- Things to do:
- - remove indargs from rel applications
- - replace *variables only* corresponding to function (recursive)
- results by the actual function application. *)
-let funify_branches relinfo nfuns branch =
- let mut_induct, induct =
- match relinfo.indref with
- | None -> assert false
- | Some (IndRef ((mutual_ind,i) as ind)) -> mutual_ind,ind
- | _ -> assert false in
- let is_dom c =
- match kind_of_term c with
- | Ind(((u,_),_)) | Construct(((u,_),_),_) -> MutInd.equal u mut_induct
- | _ -> false in
- let _dom_i c =
- assert (is_dom c);
- match kind_of_term c with
- | Ind((u,i)) | Construct((u,_),i) -> i
- | _ -> assert false in
- let _is_pred c shift =
- match kind_of_term c with
- | Rel i -> let reali = i-shift in (reali>=0 && reali<relinfo.nbranches)
- | _ -> false in
- (* FIXME: *)
- LocalDef (Anonymous,EConstr.mkProp,EConstr.mkProp)
-
-
-let relprinctype_to_funprinctype relprinctype nfuns =
- let relprinctype = EConstr.of_constr relprinctype in
- let relinfo = compute_elim_sig Evd.empty (** FIXME*) relprinctype in
- assert (not relinfo.farg_in_concl);
- assert (relinfo.indarg_in_concl);
- (* first remove indarg and indarg_in_concl *)
- let relinfo_noindarg = { relinfo with
- indarg_in_concl = false; indarg = None;
- concl = EConstr.of_constr (remove_last_arg (pop (EConstr.Unsafe.to_constr relinfo.concl))); } in
- (* the nfuns last induction arguments are functional ones: remove them *)
- let relinfo_argsok = { relinfo_noindarg with
- nargs = relinfo_noindarg.nargs - nfuns;
- (* args is in reverse order, so remove fst *)
- args = remove_n_fst_list nfuns relinfo_noindarg.args;
- concl = EConstr.of_constr (popn nfuns (EConstr.Unsafe.to_constr relinfo_noindarg.concl));
- } in
- let new_branches =
- List.map (funify_branches relinfo_argsok nfuns) relinfo_argsok.branches in
- let relinfo_branches = { relinfo_argsok with branches = new_branches } in
- relinfo_branches
-
-(* @article{ bundy93rippling,
- author = "Alan Bundy and Andrew Stevens and Frank van Harmelen and Andrew Ireland and Alan Smaill",
- title = "Rippling: A Heuristic for Guiding Inductive Proofs",
- journal = "Artificial Intelligence",
- volume = "62",
- number = "2",
- pages = "185-253",
- year = "1993",
- url = "citeseer.ist.psu.edu/bundy93rippling.html" }
-
- *)
diff --git a/plugins/funind/recdef.ml b/plugins/funind/recdef.ml
index 76f859ed7..8fe05b497 100644
--- a/plugins/funind/recdef.ml
+++ b/plugins/funind/recdef.ml
@@ -9,7 +9,7 @@
module CVars = Vars
-open Term
+open Constr
open EConstr
open Vars
open Namegen
@@ -53,6 +53,10 @@ let coq_constant m s = EConstr.of_constr @@ Universes.constr_of_global @@
let arith_Nat = ["Arith";"PeanoNat";"Nat"]
let arith_Lt = ["Arith";"Lt"]
+let pr_leconstr_rd =
+ let sigma, env = Pfedit.get_current_context () in
+ Printer.pr_leconstr_env env sigma
+
let coq_init_constant s =
EConstr.of_constr (
Universes.constr_of_global @@
@@ -62,14 +66,14 @@ let find_reference sl s =
let dp = Names.DirPath.make (List.rev_map Id.of_string sl) in
locate (make_qualid dp (Id.of_string s))
-let declare_fun f_id kind ?(ctx=Univ.UContext.empty) value =
- let ce = definition_entry ~univs:ctx value (*FIXME *) in
+let declare_fun f_id kind ?univs value =
+ let ce = definition_entry ?univs value (*FIXME *) in
ConstRef(declare_constant f_id (DefinitionEntry ce, kind));;
let defined () = Lemmas.save_proof (Vernacexpr.(Proved (Transparent,None)))
let def_of_const t =
- match (kind_of_term t) with
+ match (Constr.kind t) with
Const sp ->
(try (match constant_opt_value_in (Global.env ()) sp with
| Some c -> c
@@ -137,13 +141,13 @@ let def_id = Id.of_string "def"
let p_id = Id.of_string "p"
let rec_res_id = Id.of_string "rec_res";;
let lt = function () -> (coq_init_constant "lt")
-let le = function () -> (coq_init_constant "le")
+let le = function () -> (Coqlib.gen_reference_in_modules "RecursiveDefinition" Coqlib.init_modules "le")
let ex = function () -> (coq_init_constant "ex")
let nat = function () -> (coq_init_constant "nat")
let iter_ref () =
try find_reference ["Recdef"] "iter"
with Not_found -> user_err Pp.(str "module Recdef not loaded")
-let iter = function () -> (constr_of_global (delayed_force iter_ref))
+let iter_rd = function () -> (constr_of_global (delayed_force iter_ref))
let eq = function () -> (coq_init_constant "eq")
let le_lt_SS = function () -> (constant ["Recdef"] "le_lt_SS")
let le_lt_n_Sm = function () -> (coq_constant arith_Lt "le_lt_n_Sm")
@@ -175,8 +179,9 @@ let simpl_iter clause =
clause
(* Others ugly things ... *)
-let (value_f:Term.constr list -> global_reference -> Term.constr) =
+let (value_f: Constr.t list -> global_reference -> Constr.t) =
let open Term in
+ let open Constr in
fun al fterm ->
let rev_x_id_l =
(
@@ -207,7 +212,7 @@ let (value_f:Term.constr list -> global_reference -> Term.constr) =
let body = fst (understand env (Evd.from_env env) glob_body)(*FIXME*) in
it_mkLambda_or_LetIn body context
-let (declare_f : Id.t -> logical_kind -> Term.constr list -> global_reference -> global_reference) =
+let (declare_f : Id.t -> logical_kind -> Constr.t list -> global_reference -> global_reference) =
fun f_id kind input_type fterm_ref ->
declare_fun f_id kind (value_f input_type fterm_ref);;
@@ -335,7 +340,8 @@ let check_not_nested sigma forbidden e =
try
check_not_nested e
with UserError(_,p) ->
- user_err ~hdr:"_" (str "on expr : " ++ Printer.pr_leconstr e ++ str " " ++ p)
+ let _, env = Pfedit.get_current_context () in
+ user_err ~hdr:"_" (str "on expr : " ++ Printer.pr_leconstr_env env sigma e ++ str " " ++ p)
(* ['a info] contains the local information for traveling *)
type 'a infos =
@@ -453,7 +459,7 @@ let rec travel_aux jinfo continuation_tac (expr_info:constr infos) g =
check_not_nested sigma (expr_info.f_id::expr_info.forbidden_ids) expr_info.info;
jinfo.otherS () expr_info continuation_tac expr_info g
with e when CErrors.noncritical e ->
- user_err ~hdr:"Recdef.travel" (str "the term " ++ Printer.pr_leconstr expr_info.info ++ str " can not contain a recursive call to " ++ Id.print expr_info.f_id)
+ user_err ~hdr:"Recdef.travel" (str "the term " ++ Printer.pr_leconstr_env (pf_env g) sigma expr_info.info ++ str " can not contain a recursive call to " ++ Id.print expr_info.f_id)
end
| Lambda(n,t,b) ->
begin
@@ -461,7 +467,7 @@ let rec travel_aux jinfo continuation_tac (expr_info:constr infos) g =
check_not_nested sigma (expr_info.f_id::expr_info.forbidden_ids) expr_info.info;
jinfo.otherS () expr_info continuation_tac expr_info g
with e when CErrors.noncritical e ->
- user_err ~hdr:"Recdef.travel" (str "the term " ++ Printer.pr_leconstr expr_info.info ++ str " can not contain a recursive call to " ++ Id.print expr_info.f_id)
+ user_err ~hdr:"Recdef.travel" (str "the term " ++ Printer.pr_leconstr_env (pf_env g) sigma expr_info.info ++ str " can not contain a recursive call to " ++ Id.print expr_info.f_id)
end
| Case(ci,t,a,l) ->
begin
@@ -489,8 +495,8 @@ let rec travel_aux jinfo continuation_tac (expr_info:constr infos) g =
jinfo.apP (f,args) expr_info continuation_tac in
travel_args jinfo
expr_info.is_main_branch new_continuation_tac new_infos g
- | Case _ -> user_err ~hdr:"Recdef.travel" (str "the term " ++ Printer.pr_leconstr expr_info.info ++ str " can not contain an applied match (See Limitation in Section 2.3 of refman)")
- | _ -> anomaly (Pp.str "travel_aux : unexpected "++ Printer.pr_leconstr expr_info.info ++ Pp.str ".")
+ | Case _ -> user_err ~hdr:"Recdef.travel" (str "the term " ++ Printer.pr_leconstr_env (pf_env g) sigma expr_info.info ++ str " can not contain an applied match (See Limitation in Section 2.3 of refman)")
+ | _ -> anomaly (Pp.str "travel_aux : unexpected "++ Printer.pr_leconstr_env (pf_env g) sigma expr_info.info ++ Pp.str ".")
end
| Cast(t,_,_) -> travel jinfo continuation_tac {expr_info with info=t} g
| Const _ | Var _ | Meta _ | Evar _ | Sort _ | Construct _ | Ind _ ->
@@ -513,7 +519,7 @@ and travel_args jinfo is_final continuation_tac infos =
{infos with info=arg;is_final=false}
and travel jinfo continuation_tac expr_info =
observe_tac
- (str jinfo.message ++ Printer.pr_leconstr expr_info.info)
+ (str jinfo.message ++ pr_leconstr_rd expr_info.info)
(travel_aux jinfo continuation_tac expr_info)
(* Termination proof *)
@@ -729,7 +735,7 @@ let terminate_case next_step (ci,a,t,l) expr_info continuation_tac infos g =
let destruct_tac,rev_to_thin_intro =
mkDestructEq [expr_info.rec_arg_id] a' g in
let to_thin_intro = List.rev rev_to_thin_intro in
- observe_tac (str "treating cases (" ++ int (Array.length l) ++ str")" ++ spc () ++ Printer.pr_leconstr a')
+ observe_tac (str "treating cases (" ++ int (Array.length l) ++ str")" ++ spc () ++ Printer.pr_leconstr_env (pf_env g) sigma a')
(try
(tclTHENS
destruct_tac
@@ -738,7 +744,7 @@ let terminate_case next_step (ci,a,t,l) expr_info continuation_tac infos g =
with
| UserError(Some "Refiner.thensn_tac3",_)
| UserError(Some "Refiner.tclFAIL_s",_) ->
- (observe_tac (str "is computable " ++ Printer.pr_leconstr new_info.info) (next_step continuation_tac {new_info with info = nf_betaiotazeta new_info.info} )
+ (observe_tac (str "is computable " ++ Printer.pr_leconstr_env (pf_env g) sigma new_info.info) (next_step continuation_tac {new_info with info = nf_betaiotazeta new_info.info} )
))
g
@@ -851,9 +857,13 @@ let rec prove_le g =
Proofview.V82.of_tactic (apply (delayed_force le_n));
begin
try
- let matching_fun =
- pf_is_matching g
- (Pattern.PApp(Pattern.PRef (Globnames.global_of_constr (EConstr.Unsafe.to_constr (le ()))),[|Pattern.PVar (destVar sigma x);Pattern.PMeta None|])) in
+ let matching_fun c = match EConstr.kind sigma c with
+ | App (c, [| x0 ; _ |]) ->
+ EConstr.isVar sigma x0 &&
+ Id.equal (destVar sigma x0) (destVar sigma x) &&
+ EConstr.is_global sigma (le ()) c
+ | _ -> false
+ in
let (h,t) = List.find (fun (_,t) -> matching_fun t) (pf_hyps_types g)
in
let y =
@@ -989,11 +999,11 @@ let rec intros_values_eq expr_info acc =
let equation_others _ expr_info continuation_tac infos =
if expr_info.is_final && expr_info.is_main_branch
then
- observe_tac (str "equation_others (cont_tac +intros) " ++ Printer.pr_leconstr expr_info.info)
+ observe_tac (str "equation_others (cont_tac +intros) " ++ pr_leconstr_rd expr_info.info)
(tclTHEN
(continuation_tac infos)
- (observe_tac (str "intros_values_eq equation_others " ++ Printer.pr_leconstr expr_info.info) (intros_values_eq expr_info [])))
- else observe_tac (str "equation_others (cont_tac) " ++ Printer.pr_leconstr expr_info.info) (continuation_tac infos)
+ (observe_tac (str "intros_values_eq equation_others " ++ pr_leconstr_rd expr_info.info) (intros_values_eq expr_info [])))
+ else observe_tac (str "equation_others (cont_tac) " ++ pr_leconstr_rd expr_info.info) (continuation_tac infos)
let equation_app f_and_args expr_info continuation_tac infos =
if expr_info.is_final && expr_info.is_main_branch
@@ -1039,11 +1049,12 @@ let prove_eq = travel equation_info
*)
let compute_terminate_type nb_args func =
let open Term in
+ let open Constr in
let open CVars in
let _,a_arrow_b,_ = destLambda(def_of_const (constr_of_global func)) in
let rev_args,b = decompose_prod_n nb_args a_arrow_b in
let left =
- mkApp(delayed_force iter,
+ mkApp(delayed_force iter_rd,
Array.of_list
(lift 5 a_arrow_b:: mkRel 3::
constr_of_global func::mkRel 1::
@@ -1222,8 +1233,8 @@ let whole_start (concl_tac:tactic) nb_args is_mes func input_type relation rec_a
let get_current_subgoals_types () =
let p = Proof_global.give_me_the_proof () in
- let { Evd.it=sgs ; sigma=sigma } = Proof.V82.subgoals p in
- sigma, List.map (Goal.V82.abstract_type sigma) sgs
+ let sgs,_,_,_,sigma = Proof.proof p in
+ sigma, List.map (Goal.V82.abstract_type sigma) sgs
exception EmptySubgoals
let build_and_l sigma l =
@@ -1416,7 +1427,7 @@ let com_terminate
nb_args ctx
hook =
let start_proof ctx (tac_start:tactic) (tac_end:tactic) =
- let (evmap, env) = Lemmas.get_current_context() in
+ let evd, env = Pfedit.get_current_context () in
Lemmas.start_proof thm_name
(Global, false (* FIXME *), Proof Lemma) ~sign:(Environ.named_context_val env)
ctx (EConstr.of_constr (compute_terminate_type nb_args fonctional_ref)) hook;
@@ -1460,7 +1471,7 @@ let start_equation (f:global_reference) (term_f:global_reference)
let (com_eqn : int -> Id.t ->
global_reference -> global_reference -> global_reference
- -> Term.constr -> unit) =
+ -> Constr.t -> unit) =
fun nb_arg eq_name functional_ref f_ref terminate_ref equation_lemma_type ->
let open CVars in
let opacity =
@@ -1468,13 +1479,13 @@ let (com_eqn : int -> Id.t ->
| ConstRef c -> is_opaque_constant c
| _ -> anomaly ~label:"terminate_lemma" (Pp.str "not a constant.")
in
- let (evmap, env) = Lemmas.get_current_context() in
- let evmap = Evd.from_ctx (Evd.evar_universe_context evmap) in
+ let evd, env = Pfedit.get_current_context () in
+ let evd = Evd.from_ctx (Evd.evar_universe_context evd) in
let f_constr = constr_of_global f_ref in
let equation_lemma_type = subst1 f_constr equation_lemma_type in
(Lemmas.start_proof eq_name (Global, false, Proof Lemma)
~sign:(Environ.named_context_val env)
- evmap
+ evd
(EConstr.of_constr equation_lemma_type)
(Lemmas.mk_hook (fun _ _ -> ()));
ignore (by
@@ -1514,16 +1525,17 @@ let (com_eqn : int -> Id.t ->
let recursive_definition is_mes function_name rec_impls type_of_f r rec_arg_num eq
generate_induction_principle using_lemmas : unit =
let open Term in
+ let open Constr in
let open CVars in
let env = Global.env() in
- let evd = ref (Evd.from_env env) in
- let function_type = interp_type_evars env evd type_of_f in
+ let evd = Evd.from_env env in
+ let evd, function_type = interp_type_evars env evd type_of_f in
let function_type = EConstr.Unsafe.to_constr function_type in
let env = push_named (Context.Named.Declaration.LocalAssum (function_name,function_type)) env in
(* Pp.msgnl (str "function type := " ++ Printer.pr_lconstr function_type); *)
- let ty = interp_type_evars env evd ~impls:rec_impls eq in
+ let evd, ty = interp_type_evars env evd ~impls:rec_impls eq in
let ty = EConstr.Unsafe.to_constr ty in
- let evm, nf = Evarutil.nf_evars_and_universes !evd in
+ let evd, nf = Evarutil.nf_evars_and_universes evd in
let equation_lemma_type = nf_betaiotazeta (EConstr.of_constr (nf ty)) in
let function_type = nf function_type in
let equation_lemma_type = EConstr.Unsafe.to_constr equation_lemma_type in
@@ -1536,7 +1548,7 @@ let recursive_definition is_mes function_name rec_impls type_of_f r rec_arg_num
(* Pp.msgnl (str "res_var :=" ++ Printer.pr_lconstr_env (push_rel_context (List.map (function (x,t) -> (x,None,t)) res_vars) env) eq'); *)
(* Pp.msgnl (str "rec_arg_num := " ++ str (string_of_int rec_arg_num)); *)
(* Pp.msgnl (str "eq' := " ++ str (string_of_int rec_arg_num)); *)
- match kind_of_term eq' with
+ match Constr.kind eq' with
| App(e,[|_;_;eq_fix|]) ->
mkLambda (Name function_name,function_type,subst_var function_name (compose_lam res_vars eq_fix))
| _ -> failwith "Recursive Definition (res not eq)"
@@ -1548,16 +1560,16 @@ let recursive_definition is_mes function_name rec_impls type_of_f r rec_arg_num
let functional_id = add_suffix function_name "_F" in
let term_id = add_suffix function_name "_terminate" in
let functional_ref =
- let ctx = (snd (Evd.universe_context ~names:[] ~extensible:true evm)) in
- declare_fun functional_id (IsDefinition Decl_kinds.Definition) ~ctx res
+ let univs = Entries.Monomorphic_const_entry (Evd.universe_context_set evd) in
+ declare_fun functional_id (IsDefinition Decl_kinds.Definition) ~univs res
in
(* Refresh the global universes, now including those of _F *)
- let evm = Evd.from_env (Global.env ()) in
+ let evd = Evd.from_env (Global.env ()) in
let env_with_pre_rec_args = push_rel_context(List.map (function (x,t) -> LocalAssum (x,t)) pre_rec_args) env in
let relation, evuctx =
- interp_constr env_with_pre_rec_args evm r
+ interp_constr env_with_pre_rec_args evd r
in
- let evm = Evd.from_ctx evuctx in
+ let evd = Evd.from_ctx evuctx in
let tcc_lemma_name = add_suffix function_name "_tcc" in
let tcc_lemma_constr = ref Undefined in
(* let _ = Pp.msgnl (str "relation := " ++ Printer.pr_lconstr_env env_with_pre_rec_args relation) in *)
@@ -1587,7 +1599,7 @@ let recursive_definition is_mes function_name rec_impls type_of_f r rec_arg_num
and functional_ref = destConst (constr_of_global functional_ref)
and eq_ref = destConst (constr_of_global eq_ref) in
generate_induction_principle f_ref tcc_lemma_constr
- functional_ref eq_ref rec_arg_num (EConstr.of_constr rec_arg_type) (nb_prod evm (EConstr.of_constr res)) (EConstr.of_constr relation);
+ functional_ref eq_ref rec_arg_num (EConstr.of_constr rec_arg_type) (nb_prod evd (EConstr.of_constr res)) (EConstr.of_constr relation);
Flags.if_verbose
msgnl (h 1 (Ppconstr.pr_id function_name ++
spc () ++ str"is defined" )++ fnl () ++
@@ -1606,5 +1618,5 @@ let recursive_definition is_mes function_name rec_impls type_of_f r rec_arg_num
term_id
using_lemmas
(List.length res_vars)
- evm (Lemmas.mk_hook hook))
+ evd (Lemmas.mk_hook hook))
()
diff --git a/plugins/funind/recdef.mli b/plugins/funind/recdef.mli
index 63bbdbe7e..b95d64ce9 100644
--- a/plugins/funind/recdef.mli
+++ b/plugins/funind/recdef.mli
@@ -1,5 +1,5 @@
+open Constr
-(* val evaluable_of_global_reference : Libnames.global_reference -> Names.evaluable_global_reference *)
val tclUSER_if_not_mes :
Tacmach.tactic ->
bool ->
@@ -11,9 +11,9 @@ bool ->
Constrintern.internalization_env ->
Constrexpr.constr_expr ->
Constrexpr.constr_expr ->
- int -> Constrexpr.constr_expr -> (Term.pconstant ->
+ int -> Constrexpr.constr_expr -> (pconstant ->
Indfun_common.tcc_lemma_value ref ->
- Term.pconstant ->
- Term.pconstant -> int -> EConstr.types -> int -> EConstr.constr -> 'a) -> Constrexpr.constr_expr list -> unit
+ pconstant ->
+ pconstant -> int -> EConstr.types -> int -> EConstr.constr -> 'a) -> Constrexpr.constr_expr list -> unit
diff --git a/plugins/funind/recdef_plugin.mlpack b/plugins/funind/recdef_plugin.mlpack
index 2b443f2a1..755fa4f87 100644
--- a/plugins/funind/recdef_plugin.mlpack
+++ b/plugins/funind/recdef_plugin.mlpack
@@ -6,5 +6,4 @@ Functional_principles_proofs
Functional_principles_types
Invfun
Indfun
-Merge
G_indfun
diff --git a/plugins/ltac/extraargs.ml4 b/plugins/ltac/extraargs.ml4
index 89feea8dc..bb01aca55 100644
--- a/plugins/ltac/extraargs.ml4
+++ b/plugins/ltac/extraargs.ml4
@@ -133,7 +133,9 @@ let pr_occurrences = pr_occurrences () () ()
let pr_gen prc _prlc _prtac c = prc c
-let pr_globc _prc _prlc _prtac (_,glob) = Printer.pr_glob_constr glob
+let pr_globc _prc _prlc _prtac (_,glob) =
+ let _, env = Pfedit.get_current_context () in
+ Printer.pr_glob_constr_env env glob
let interp_glob ist gl (t,_) = Tacmach.project gl , (ist,t)
diff --git a/plugins/ltac/extratactics.ml4 b/plugins/ltac/extratactics.ml4
index 65c186a41..3e3965b94 100644
--- a/plugins/ltac/extratactics.ml4
+++ b/plugins/ltac/extratactics.ml4
@@ -25,6 +25,7 @@ open Termops
open Equality
open Misctypes
open Proofview.Notations
+open Vernacinterp
DECLARE PLUGIN "ltac_plugin"
@@ -249,11 +250,10 @@ TACTIC EXTEND rewrite_star
(**********************************************************************)
(* Hint Rewrite *)
-let add_rewrite_hint bases ort t lcsr =
+let add_rewrite_hint ~poly bases ort t lcsr =
let env = Global.env() in
let sigma = Evd.from_env env in
- let poly = Flags.use_polymorphic_flag () in
- let f ce =
+ let f ce =
let c, ctx = Constrintern.interp_constr env sigma ce in
let ctx =
let ctx = UState.context_set ctx in
@@ -270,16 +270,16 @@ let add_rewrite_hint bases ort t lcsr =
let classify_hint _ = Vernacexpr.VtSideff [], Vernacexpr.VtLater
-VERNAC COMMAND EXTEND HintRewrite CLASSIFIED BY classify_hint
+VERNAC COMMAND FUNCTIONAL EXTEND HintRewrite CLASSIFIED BY classify_hint
[ "Hint" "Rewrite" orient(o) ne_constr_list(l) ":" preident_list(bl) ] ->
- [ add_rewrite_hint bl o None l ]
+ [ fun ~atts ~st -> add_rewrite_hint ~poly:atts.polymorphic bl o None l; st ]
| [ "Hint" "Rewrite" orient(o) ne_constr_list(l) "using" tactic(t)
":" preident_list(bl) ] ->
- [ add_rewrite_hint bl o (Some t) l ]
+ [ fun ~atts ~st -> add_rewrite_hint ~poly:atts.polymorphic bl o (Some t) l; st ]
| [ "Hint" "Rewrite" orient(o) ne_constr_list(l) ] ->
- [ add_rewrite_hint ["core"] o None l ]
+ [ fun ~atts ~st -> add_rewrite_hint ~poly:atts.polymorphic ["core"] o None l; st ]
| [ "Hint" "Rewrite" orient(o) ne_constr_list(l) "using" tactic(t) ] ->
- [ add_rewrite_hint ["core"] o (Some t) l ]
+ [ fun ~atts ~st -> add_rewrite_hint ~poly:atts.polymorphic ["core"] o (Some t) l; st ]
END
(**********************************************************************)
@@ -290,7 +290,7 @@ open EConstr
open Vars
open Coqlib
-let project_hint pri l2r r =
+let project_hint ~poly pri l2r r =
let gr = Smartlocate.global_with_alias r in
let env = Global.env() in
let sigma = Evd.from_env env in
@@ -313,30 +313,47 @@ let project_hint pri l2r r =
let id =
Nameops.add_suffix (Nametab.basename_of_global gr) ("_proj_" ^ (if l2r then "l2r" else "r2l"))
in
- let ctx = Evd.universe_context_set sigma in
+ let ctx = Evd.const_univ_entry ~poly sigma in
let c = EConstr.to_constr sigma c in
let c = Declare.declare_definition ~internal:Declare.InternalTacticRequest id (c,ctx) in
let info = {Vernacexpr.hint_priority = pri; hint_pattern = None} in
(info,false,true,Hints.PathAny, Hints.IsGlobRef (Globnames.ConstRef c))
-let add_hints_iff l2r lc n bl =
- let l = Locality.LocalityFixme.consume () in
- Hints.add_hints (Locality.make_module_locality l) bl
- (Hints.HintsResolveEntry (List.map (project_hint n l2r) lc))
+let add_hints_iff ~atts l2r lc n bl =
+ let open Vernacinterp in
+ Hints.add_hints (Locality.make_module_locality atts.locality) bl
+ (Hints.HintsResolveEntry (List.map (project_hint ~poly:atts.polymorphic n l2r) lc))
-VERNAC COMMAND EXTEND HintResolveIffLR CLASSIFIED AS SIDEFF
+VERNAC COMMAND FUNCTIONAL EXTEND HintResolveIffLR CLASSIFIED AS SIDEFF
[ "Hint" "Resolve" "->" ne_global_list(lc) natural_opt(n)
":" preident_list(bl) ] ->
- [ add_hints_iff true lc n bl ]
+ [ fun ~atts ~st -> begin
+ add_hints_iff ~atts true lc n bl;
+ st
+ end
+ ]
| [ "Hint" "Resolve" "->" ne_global_list(lc) natural_opt(n) ] ->
- [ add_hints_iff true lc n ["core"] ]
+ [ fun ~atts ~st -> begin
+ add_hints_iff ~atts true lc n ["core"];
+ st
+ end
+ ]
END
-VERNAC COMMAND EXTEND HintResolveIffRL CLASSIFIED AS SIDEFF
+
+VERNAC COMMAND FUNCTIONAL EXTEND HintResolveIffRL CLASSIFIED AS SIDEFF
[ "Hint" "Resolve" "<-" ne_global_list(lc) natural_opt(n)
":" preident_list(bl) ] ->
- [ add_hints_iff false lc n bl ]
+ [ fun ~atts ~st -> begin
+ add_hints_iff ~atts false lc n bl;
+ st
+ end
+ ]
| [ "Hint" "Resolve" "<-" ne_global_list(lc) natural_opt(n) ] ->
- [ add_hints_iff false lc n ["core"] ]
+ [ fun ~atts ~st -> begin
+ add_hints_iff ~atts false lc n ["core"];
+ st
+ end
+ ]
END
(**********************************************************************)
@@ -409,34 +426,46 @@ let seff id = Vernacexpr.VtSideff [id], Vernacexpr.VtLater
| [ "Type" ] -> [ InType ]
END*)
-VERNAC COMMAND EXTEND DeriveInversionClear
+VERNAC COMMAND FUNCTIONAL EXTEND DeriveInversionClear
| [ "Derive" "Inversion_clear" ident(na) "with" constr(c) "Sort" sort_family(s) ]
=> [ seff na ]
- -> [ add_inversion_lemma_exn na c s false inv_clear_tac ]
+ -> [ fun ~atts ~st ->
+ let open Vernacinterp in
+ add_inversion_lemma_exn ~poly:atts.polymorphic na c s false inv_clear_tac; st ]
| [ "Derive" "Inversion_clear" ident(na) "with" constr(c) ] => [ seff na ]
- -> [ add_inversion_lemma_exn na c InProp false inv_clear_tac ]
+ -> [ fun ~atts ~st ->
+ let open Vernacinterp in
+ add_inversion_lemma_exn ~poly:atts.polymorphic na c Sorts.InProp false inv_clear_tac; st ]
END
-VERNAC COMMAND EXTEND DeriveInversion
+VERNAC COMMAND FUNCTIONAL EXTEND DeriveInversion
| [ "Derive" "Inversion" ident(na) "with" constr(c) "Sort" sort_family(s) ]
=> [ seff na ]
- -> [ add_inversion_lemma_exn na c s false inv_tac ]
+ -> [ fun ~atts ~st ->
+ let open Vernacinterp in
+ add_inversion_lemma_exn ~poly:atts.polymorphic na c s false inv_tac; st ]
| [ "Derive" "Inversion" ident(na) "with" constr(c) ] => [ seff na ]
- -> [ add_inversion_lemma_exn na c InProp false inv_tac ]
+ -> [ fun ~atts ~st ->
+ let open Vernacinterp in
+ add_inversion_lemma_exn ~poly:atts.polymorphic na c Sorts.InProp false inv_tac; st ]
END
-VERNAC COMMAND EXTEND DeriveDependentInversion
+VERNAC COMMAND FUNCTIONAL EXTEND DeriveDependentInversion
| [ "Derive" "Dependent" "Inversion" ident(na) "with" constr(c) "Sort" sort_family(s) ]
=> [ seff na ]
- -> [ add_inversion_lemma_exn na c s true dinv_tac ]
+ -> [ fun ~atts ~st ->
+ let open Vernacinterp in
+ add_inversion_lemma_exn ~poly:atts.polymorphic na c s true dinv_tac; st ]
END
-VERNAC COMMAND EXTEND DeriveDependentInversionClear
+VERNAC COMMAND FUNCTIONAL EXTEND DeriveDependentInversionClear
| [ "Derive" "Dependent" "Inversion_clear" ident(na) "with" constr(c) "Sort" sort_family(s) ]
=> [ seff na ]
- -> [ add_inversion_lemma_exn na c s true dinv_clear_tac ]
+ -> [ fun ~atts ~st ->
+ let open Vernacinterp in
+ add_inversion_lemma_exn ~poly:atts.polymorphic na c s true dinv_clear_tac; st ]
END
(**********************************************************************)
@@ -514,7 +543,7 @@ let cache_transitivity_lemma (_,(left,lem)) =
let subst_transitivity_lemma (subst,(b,ref)) = (b,subst_mps subst ref)
-let inTransitivity : bool * Term.constr -> obj =
+let inTransitivity : bool * Constr.t -> obj =
declare_object {(default_object "TRANSITIVITY-STEPS") with
cache_function = cache_transitivity_lemma;
open_function = (fun i o -> if Int.equal i 1 then cache_transitivity_lemma o);
@@ -852,34 +881,12 @@ TACTIC EXTEND is_evar
]
END
-let has_evar sigma c =
-let rec has_evar x =
- match EConstr.kind sigma x with
- | Evar _ -> true
- | Rel _ | Var _ | Meta _ | Sort _ | Const _ | Ind _ | Construct _ ->
- false
- | Cast (t1, _, t2) | Prod (_, t1, t2) | Lambda (_, t1, t2) ->
- has_evar t1 || has_evar t2
- | LetIn (_, t1, t2, t3) ->
- has_evar t1 || has_evar t2 || has_evar t3
- | App (t1, ts) ->
- has_evar t1 || has_evar_array ts
- | Case (_, t1, t2, ts) ->
- has_evar t1 || has_evar t2 || has_evar_array ts
- | Fix ((_, tr)) | CoFix ((_, tr)) ->
- has_evar_prec tr
- | Proj (p, c) -> has_evar c
-and has_evar_array x =
- Array.exists has_evar x
-and has_evar_prec (_, ts1, ts2) =
- Array.exists has_evar ts1 || Array.exists has_evar ts2
-in
-has_evar c
-
TACTIC EXTEND has_evar
| [ "has_evar" constr(x) ] -> [
Proofview.tclEVARMAP >>= fun sigma ->
- if has_evar sigma x then Proofview.tclUNIT () else Tacticals.New.tclFAIL 0 (str "No evars")
+ if Evarutil.has_undefined_evars sigma x
+ then Proofview.tclUNIT ()
+ else Tacticals.New.tclFAIL 0 (str "No evars")
]
END
@@ -1118,3 +1125,12 @@ VERNAC COMMAND EXTEND OptimizeProof
| [ "Optimize" "Heap" ] => [ Vernac_classifier.classify_as_proofstep ] ->
[ Gc.compact () ]
END
+
+(** tactic analogous to "OPTIMIZE HEAP" *)
+
+let tclOPTIMIZE_HEAP =
+ Proofview.tclLIFT (Proofview.NonLogical.make (fun () -> Gc.compact ()))
+
+TACTIC EXTEND optimize_heap
+| [ "optimize_heap" ] -> [ tclOPTIMIZE_HEAP ]
+END
diff --git a/plugins/ltac/g_auto.ml4 b/plugins/ltac/g_auto.ml4
index 5baa0d5c1..90a44708f 100644
--- a/plugins/ltac/g_auto.ml4
+++ b/plugins/ltac/g_auto.ml4
@@ -51,8 +51,12 @@ let eval_uconstrs ist cs =
List.map (fun c -> map (Tacinterp.type_uconstr ~flags ist c)) cs
let pr_auto_using_raw _ _ _ = Pptactic.pr_auto_using Ppconstr.pr_constr_expr
-let pr_auto_using_glob _ _ _ = Pptactic.pr_auto_using (fun (c,_) -> Printer.pr_glob_constr c)
-let pr_auto_using _ _ _ = Pptactic.pr_auto_using Printer.pr_closed_glob
+let pr_auto_using_glob _ _ _ = Pptactic.pr_auto_using (fun (c,_) ->
+ let _, env = Pfedit.get_current_context () in
+ Printer.pr_glob_constr_env env c)
+let pr_auto_using _ _ _ = Pptactic.pr_auto_using
+ (let sigma, env = Pfedit.get_current_context () in
+ Printer.pr_closed_glob_env env sigma)
ARGUMENT EXTEND auto_using
TYPED AS uconstr_list
@@ -186,7 +190,7 @@ END
let pr_hints_path prc prx pry c = Hints.pp_hints_path c
let pr_pre_hints_path prc prx pry c = Hints.pp_hints_path_gen Libnames.pr_reference c
let glob_hints_path ist = Hints.glob_hints_path
-
+
ARGUMENT EXTEND hints_path
PRINTED BY pr_hints_path
@@ -210,10 +214,15 @@ ARGUMENT EXTEND opthints
| [ ] -> [ None ]
END
-VERNAC COMMAND EXTEND HintCut CLASSIFIED AS SIDEFF
+VERNAC COMMAND FUNCTIONAL EXTEND HintCut CLASSIFIED AS SIDEFF
| [ "Hint" "Cut" "[" hints_path(p) "]" opthints(dbnames) ] -> [
- let entry = Hints.HintsCutEntry (Hints.glob_hints_path p) in
- Hints.add_hints (Locality.make_section_locality (Locality.LocalityFixme.consume ()))
- (match dbnames with None -> ["core"] | Some l -> l) entry ]
+ fun ~atts ~st -> begin
+ let open Vernacinterp in
+ let entry = Hints.HintsCutEntry (Hints.glob_hints_path p) in
+ Hints.add_hints (Locality.make_section_locality atts.locality)
+ (match dbnames with None -> ["core"] | Some l -> l) entry;
+ st
+ end
+ ]
END
diff --git a/plugins/ltac/g_class.ml4 b/plugins/ltac/g_class.ml4
index 104977aef..ed2d9da63 100644
--- a/plugins/ltac/g_class.ml4
+++ b/plugins/ltac/g_class.ml4
@@ -91,7 +91,7 @@ END
(** TODO: DEPRECATE *)
(* A progress test that allows to see if the evars have changed *)
-open Term
+open Constr
open Proofview.Notations
let rec eq_constr_mod_evars sigma x y =
diff --git a/plugins/ltac/g_ltac.ml4 b/plugins/ltac/g_ltac.ml4
index c577cb219..cc7ce339b 100644
--- a/plugins/ltac/g_ltac.ml4
+++ b/plugins/ltac/g_ltac.ml4
@@ -78,11 +78,6 @@ let test_bracket_ident =
let hint = G_proofs.hint
-let warn_deprecated_appcontext =
- CWarnings.create ~name:"deprecated-appcontext" ~category:"deprecated"
- (fun () -> strbrk "appcontext is deprecated and will be removed " ++
- strbrk "in a future version")
-
GEXTEND Gram
GLOBAL: tactic tacdef_body tactic_expr binder_tactic tactic_arg command hint
tactic_mode constr_may_eval constr_eval toplevel_selector
@@ -232,20 +227,17 @@ GEXTEND Gram
| l = ident -> Name.Name l ] ]
;
let_clause:
- [ [ id = identref; ":="; te = tactic_expr ->
- (id, arg_of_expr te)
- | id = identref; args = LIST1 input_fun; ":="; te = tactic_expr ->
- (id, arg_of_expr (TacFun(args,te))) ] ]
+ [ [ (l,id) = identref; ":="; te = tactic_expr ->
+ ((l,Name id), arg_of_expr te)
+ | na = ["_" -> (Some !@loc,Anonymous)]; ":="; te = tactic_expr ->
+ (na, arg_of_expr te)
+ | (l,id) = identref; args = LIST1 input_fun; ":="; te = tactic_expr ->
+ ((l,Name id), arg_of_expr (TacFun(args,te))) ] ]
;
match_pattern:
[ [ IDENT "context"; oid = OPT Constr.ident;
"["; pc = Constr.lconstr_pattern; "]" ->
- let mode = not (!Flags.tactic_context_compat) in
- Subterm (mode, oid, pc)
- | IDENT "appcontext"; oid = OPT Constr.ident;
- "["; pc = Constr.lconstr_pattern; "]" ->
- warn_deprecated_appcontext ~loc:!@loc ();
- Subterm (true,oid, pc)
+ Subterm (oid, pc)
| pc = Constr.lconstr_pattern -> Term pc ] ]
;
match_hyps:
@@ -335,7 +327,8 @@ GEXTEND Gram
| IDENT "all"; ":" -> SelectAll ] ]
;
tactic_mode:
- [ [ g = OPT toplevel_selector; tac = G_vernac.query_command -> tac g ] ]
+ [ [ g = OPT toplevel_selector; tac = G_vernac.query_command -> tac g
+ | g = OPT toplevel_selector; "{" -> Vernacexpr.VernacSubproof g ] ]
;
command:
[ [ IDENT "Proof"; "with"; ta = Pltac.tactic;
@@ -467,13 +460,13 @@ VERNAC ARGUMENT EXTEND ltac_production_item PRINTED BY pr_ltac_production_item
[ Tacentries.TacNonTerm (Loc.tag ~loc ((Id.to_string nt, None), None)) ]
END
-VERNAC COMMAND EXTEND VernacTacticNotation
+VERNAC COMMAND FUNCTIONAL EXTEND VernacTacticNotation
| [ "Tactic" "Notation" ltac_tactic_level_opt(n) ne_ltac_production_item_list(r) ":=" tactic(e) ] =>
- [ VtUnknown, VtNow ] ->
- [
- let l = Locality.LocalityFixme.consume () in
- let n = Option.default 0 n in
- Tacentries.add_tactic_notation (Locality.make_module_locality l) n r e
+ [ VtSideff [], VtNow ] ->
+ [ fun ~atts ~st -> let open Vernacinterp in
+ let n = Option.default 0 n in
+ Tacentries.add_tactic_notation (Locality.make_module_locality atts.locality) n r e;
+ st
]
END
@@ -510,15 +503,15 @@ PRINTED BY pr_tacdef_body
| [ tacdef_body(t) ] -> [ t ]
END
-VERNAC COMMAND EXTEND VernacDeclareTacticDefinition
+VERNAC COMMAND FUNCTIONAL EXTEND VernacDeclareTacticDefinition
| [ "Ltac" ne_ltac_tacdef_body_list_sep(l, "with") ] => [
VtSideff (List.map (function
| TacticDefinition ((_,r),_) -> r
| TacticRedefinition (Ident (_,r),_) -> r
| TacticRedefinition (Qualid (_,q),_) -> snd(repr_qualid q)) l), VtLater
- ] -> [
- let lc = Locality.LocalityFixme.consume () in
- Tacentries.register_ltac (Locality.make_module_locality lc) l
+ ] -> [ fun ~atts ~st -> let open Vernacinterp in
+ Tacentries.register_ltac (Locality.make_module_locality atts.locality) l;
+ st
]
END
diff --git a/plugins/ltac/g_obligations.ml4 b/plugins/ltac/g_obligations.ml4
index fea9e837b..f6cc3833a 100644
--- a/plugins/ltac/g_obligations.ml4
+++ b/plugins/ltac/g_obligations.ml4
@@ -123,11 +123,15 @@ VERNAC COMMAND EXTEND Admit_Obligations CLASSIFIED AS SIDEFF
| [ "Admit" "Obligations" ] -> [ admit_obligations None ]
END
-VERNAC COMMAND EXTEND Set_Solver CLASSIFIED AS SIDEFF
+VERNAC COMMAND FUNCTIONAL EXTEND Set_Solver CLASSIFIED AS SIDEFF
| [ "Obligation" "Tactic" ":=" tactic(t) ] -> [
- set_default_tactic
- (Locality.make_section_locality (Locality.LocalityFixme.consume ()))
- (Tacintern.glob_tactic t) ]
+ fun ~atts ~st -> begin
+ let open Vernacinterp in
+ set_default_tactic
+ (Locality.make_section_locality atts.locality)
+ (Tacintern.glob_tactic t);
+ st
+ end]
END
open Pp
diff --git a/plugins/ltac/g_rewrite.ml4 b/plugins/ltac/g_rewrite.ml4
index b148d962e..ea1808a25 100644
--- a/plugins/ltac/g_rewrite.ml4
+++ b/plugins/ltac/g_rewrite.ml4
@@ -31,8 +31,12 @@ type constr_expr_with_bindings = constr_expr with_bindings
type glob_constr_with_bindings = Tacexpr.glob_constr_and_expr with_bindings
type glob_constr_with_bindings_sign = interp_sign * Tacexpr.glob_constr_and_expr with_bindings
-let pr_glob_constr_with_bindings_sign _ _ _ (ge : glob_constr_with_bindings_sign) = Printer.pr_glob_constr (fst (fst (snd ge)))
-let pr_glob_constr_with_bindings _ _ _ (ge : glob_constr_with_bindings) = Printer.pr_glob_constr (fst (fst ge))
+let pr_glob_constr_with_bindings_sign _ _ _ (ge : glob_constr_with_bindings_sign) =
+ let _, env = Pfedit.get_current_context () in
+ Printer.pr_glob_constr_env env (fst (fst (snd ge)))
+let pr_glob_constr_with_bindings _ _ _ (ge : glob_constr_with_bindings) =
+ let _, env = Pfedit.get_current_context () in
+ Printer.pr_glob_constr_env env (fst (fst ge))
let pr_constr_expr_with_bindings prc _ _ (ge : constr_expr_with_bindings) = prc (fst ge)
let interp_glob_constr_with_bindings ist gl c = Tacmach.project gl , (ist, c)
let glob_glob_constr_with_bindings ist l = Tacintern.intern_constr_with_bindings ist l
@@ -239,22 +243,37 @@ VERNAC COMMAND EXTEND AddParametricRelation3 CLASSIFIED AS SIDEFF
[ declare_relation ~binders:b a aeq n None None (Some lemma3) ]
END
-VERNAC COMMAND EXTEND AddSetoid1 CLASSIFIED AS SIDEFF
+VERNAC COMMAND FUNCTIONAL EXTEND AddSetoid1 CLASSIFIED AS SIDEFF
[ "Add" "Setoid" constr(a) constr(aeq) constr(t) "as" ident(n) ] ->
- [ add_setoid (not (Locality.make_section_locality (Locality.LocalityFixme.consume ()))) [] a aeq t n ]
+ [ fun ~atts ~st -> let open Vernacinterp in
+ add_setoid (not (Locality.make_section_locality atts.locality)) [] a aeq t n;
+ st
+ ]
| [ "Add" "Parametric" "Setoid" binders(binders) ":" constr(a) constr(aeq) constr(t) "as" ident(n) ] ->
- [ add_setoid (not (Locality.make_section_locality (Locality.LocalityFixme.consume ()))) binders a aeq t n ]
+ [ fun ~atts ~st -> let open Vernacinterp in
+ add_setoid (not (Locality.make_section_locality atts.locality)) binders a aeq t n;
+ st
+ ]
| [ "Add" "Morphism" constr(m) ":" ident(n) ]
(* This command may or may not open a goal *)
=> [ Vernacexpr.VtUnknown, Vernacexpr.VtNow ]
- -> [ add_morphism_infer (not (Locality.make_section_locality (Locality.LocalityFixme.consume ()))) m n ]
+ -> [ fun ~atts ~st -> let open Vernacinterp in
+ add_morphism_infer (not (Locality.make_section_locality atts.locality)) m n;
+ st
+ ]
| [ "Add" "Morphism" constr(m) "with" "signature" lconstr(s) "as" ident(n) ]
=> [ Vernacexpr.(VtStartProof("Classic",GuaranteesOpacity,[n]), VtLater) ]
- -> [ add_morphism (not (Locality.make_section_locality (Locality.LocalityFixme.consume ()))) [] m s n ]
+ -> [ fun ~atts ~st -> let open Vernacinterp in
+ add_morphism (not (Locality.make_section_locality atts.locality)) [] m s n;
+ st
+ ]
| [ "Add" "Parametric" "Morphism" binders(binders) ":" constr(m)
"with" "signature" lconstr(s) "as" ident(n) ]
=> [ Vernacexpr.(VtStartProof("Classic",GuaranteesOpacity,[n]), VtLater) ]
- -> [ add_morphism (not (Locality.make_section_locality (Locality.LocalityFixme.consume ()))) binders m s n ]
+ -> [ fun ~atts ~st -> let open Vernacinterp in
+ add_morphism (not (Locality.make_section_locality atts.locality)) binders m s n;
+ st
+ ]
END
TACTIC EXTEND setoid_symmetry
@@ -272,5 +291,7 @@ TACTIC EXTEND setoid_transitivity
END
VERNAC COMMAND EXTEND PrintRewriteHintDb CLASSIFIED AS QUERY
- [ "Print" "Rewrite" "HintDb" preident(s) ] -> [ Feedback.msg_notice (Autorewrite.print_rewrite_hintdb s) ]
+ [ "Print" "Rewrite" "HintDb" preident(s) ] ->
+ [ let sigma, env = Pfedit.get_current_context () in
+ Feedback.msg_notice (Autorewrite.print_rewrite_hintdb env sigma s) ]
END
diff --git a/plugins/ltac/pptactic.ml b/plugins/ltac/pptactic.ml
index e467d3e2c..e5ff47356 100644
--- a/plugins/ltac/pptactic.ml
+++ b/plugins/ltac/pptactic.ml
@@ -84,6 +84,32 @@ type 'a extra_genarg_printer =
(tolerability -> Val.t -> Pp.t) ->
'a -> Pp.t
+type 'a raw_extra_genarg_printer_with_level =
+ (constr_expr -> Pp.t) ->
+ (constr_expr -> Pp.t) ->
+ (tolerability -> raw_tactic_expr -> Pp.t) ->
+ tolerability -> 'a -> Pp.t
+
+type 'a glob_extra_genarg_printer_with_level =
+ (glob_constr_and_expr -> Pp.t) ->
+ (glob_constr_and_expr -> Pp.t) ->
+ (tolerability -> glob_tactic_expr -> Pp.t) ->
+ tolerability -> 'a -> Pp.t
+
+type 'a extra_genarg_printer_with_level =
+ (EConstr.constr -> Pp.t) ->
+ (EConstr.constr -> Pp.t) ->
+ (tolerability -> Val.t -> Pp.t) ->
+ tolerability -> 'a -> Pp.t
+
+let string_of_genarg_arg (ArgumentType arg) =
+ let rec aux : type a b c. (a, b, c) genarg_type -> string = function
+ | ListArg t -> aux t ^ "_list"
+ | OptArg t -> aux t ^ "_opt"
+ | PairArg (t1, t2) -> assert false (* No parsing/printing rule for it *)
+ | ExtraArg s -> ArgT.repr s in
+ aux arg
+
let keyword x = tag_keyword (str x)
let primitive x = tag_primitive (str x)
@@ -119,9 +145,9 @@ type 'a extra_genarg_printer =
| Some Refl ->
let open Genprint in
match generic_top_print (in_gen (Topwit wit) x) with
- | PrinterBasic pr -> pr ()
- | PrinterNeedsContext pr -> pr (Global.env()) Evd.empty
- | PrinterNeedsContextAndLevel { default_ensure_surrounded; printer } ->
+ | TopPrinterBasic pr -> pr ()
+ | TopPrinterNeedsContext pr -> pr (Global.env()) Evd.empty
+ | TopPrinterNeedsContextAndLevel { default_ensure_surrounded; printer } ->
printer (Global.env()) Evd.empty default_ensure_surrounded
end
| _ -> default
@@ -500,11 +526,9 @@ let pr_goal_selector ~toplevel s =
let pr_match_pattern pr_pat = function
| Term a -> pr_pat a
- | Subterm (b,None,a) ->
- (** ppedrot: we don't make difference between [appcontext] and [context]
- anymore, and the interpretation is governed by a flag instead. *)
+ | Subterm (None,a) ->
keyword "context" ++ str" [ " ++ pr_pat a ++ str " ]"
- | Subterm (b,Some id,a) ->
+ | Subterm (Some id,a) ->
keyword "context" ++ spc () ++ pr_id id ++ str "[ " ++ pr_pat a ++ str " ]"
let pr_match_hyps pr_pat = function
@@ -536,15 +560,24 @@ let pr_goal_selector ~toplevel s =
let pr_funvar n = spc () ++ Name.print n
- let pr_let_clause k pr (id,(bl,t)) =
- hov 0 (keyword k ++ spc () ++ pr_lident id ++ prlist pr_funvar bl ++
- str " :=" ++ brk (1,1) ++ pr (TacArg (Loc.tag t)))
-
- let pr_let_clauses recflag pr = function
+ let pr_let_clause k pr_gen pr_arg (na,(bl,t)) =
+ let pr = function
+ | TacGeneric arg ->
+ let name = string_of_genarg_arg (genarg_tag arg) in
+ if name = "unit" || name = "int" then
+ (* Hard-wired parsing rules *)
+ pr_gen arg
+ else
+ str name ++ str ":" ++ surround (pr_gen arg)
+ | _ -> pr_arg (TacArg (Loc.tag t)) in
+ hov 0 (keyword k ++ spc () ++ pr_lname na ++ prlist pr_funvar bl ++
+ str " :=" ++ brk (1,1) ++ pr t)
+
+ let pr_let_clauses recflag pr_gen pr = function
| hd::tl ->
hv 0
- (pr_let_clause (if recflag then "let rec" else "let") pr hd ++
- prlist (fun t -> spc () ++ pr_let_clause "with" pr t) tl)
+ (pr_let_clause (if recflag then "let rec" else "let") pr_gen pr hd ++
+ prlist (fun t -> spc () ++ pr_let_clause "with" pr_gen pr t) tl)
| [] -> anomaly (Pp.str "LetIn must declare at least one binding.")
let pr_seq_body pr tl =
@@ -706,8 +739,10 @@ let pr_goal_selector ~toplevel s =
| TacIntroPattern (ev,[]) as t ->
pr_atom0 t
| TacIntroPattern (ev,(_::_ as p)) ->
- hov 1 (primitive (if ev then "eintros" else "intros") ++ spc () ++
- prlist_with_sep spc (Miscprint.pr_intro_pattern pr.pr_dconstr) p)
+ hov 1 (primitive (if ev then "eintros" else "intros") ++
+ (match p with
+ | [_,Misctypes.IntroForthcoming false] -> mt ()
+ | _ -> spc () ++ prlist_with_sep spc (Miscprint.pr_intro_pattern pr.pr_dconstr) p))
| TacApply (a,ev,cb,inhyp) ->
hov 1 (
(if a then mt() else primitive "simple ") ++
@@ -858,7 +893,7 @@ let pr_goal_selector ~toplevel s =
let llc = List.map (fun (id,t) -> (id,extract_binders t)) llc in
v 0
(hv 0 (
- pr_let_clauses recflag (pr_tac ltop) llc
+ pr_let_clauses recflag pr.pr_generic (pr_tac ltop) llc
++ spc () ++ keyword "in"
) ++ fnl () ++ pr_tac (llet,E) u),
llet
@@ -1003,7 +1038,7 @@ let pr_goal_selector ~toplevel s =
| TacAtom (loc,t) ->
pr_with_comments ?loc (hov 1 (pr_atom pr strip_prod_binders tag_atom t)), ltatom
| TacArg(_,Tacexp e) ->
- pr.pr_tactic (latom,E) e, latom
+ pr_tac inherited e, latom
| TacArg(_,ConstrMayEval (ConstrTerm c)) ->
keyword "constr:" ++ pr.pr_constr c, latom
| TacArg(_,ConstrMayEval c) ->
@@ -1120,10 +1155,10 @@ let pr_goal_selector ~toplevel s =
let ty = EConstr.Unsafe.to_constr ty in
let rec strip_ty acc n ty =
if n=0 then (List.rev acc, EConstr.of_constr ty) else
- match Term.kind_of_term ty with
- Term.Prod(na,a,b) ->
- strip_ty (([Loc.tag na],EConstr.of_constr a)::acc) (n-1) b
- | _ -> user_err Pp.(str "Cannot translate fix tactic: not enough products") in
+ match Constr.kind ty with
+ | Constr.Prod(na,a,b) ->
+ strip_ty (([Loc.tag na],EConstr.of_constr a)::acc) (n-1) b
+ | _ -> user_err Pp.(str "Cannot translate fix tactic: not enough products") in
strip_ty [] n ty
let pr_atomic_tactic_level env sigma n t =
@@ -1175,42 +1210,77 @@ let declare_extra_genarg_pprule wit
| ExtraArg s -> ()
| _ -> user_err Pp.(str "Can declare a pretty-printing rule only for extra argument types.")
end;
- let f x = f pr_constr_expr pr_lconstr_expr pr_raw_tactic_level x in
+ let f x =
+ Genprint.PrinterBasic (fun () ->
+ f pr_constr_expr pr_lconstr_expr pr_raw_tactic_level x) in
let g x =
+ Genprint.PrinterBasic (fun () ->
let env = Global.env () in
- g (pr_and_constr_expr (pr_glob_constr_env env)) (pr_and_constr_expr (pr_lglob_constr_env env)) (pr_glob_tactic_level env) x
+ g (pr_and_constr_expr (pr_glob_constr_env env)) (pr_and_constr_expr (pr_lglob_constr_env env)) (pr_glob_tactic_level env) x)
in
let h x =
- Genprint.PrinterNeedsContext (fun env sigma ->
+ Genprint.TopPrinterNeedsContext (fun env sigma ->
h (pr_econstr_env env sigma) (pr_leconstr_env env sigma) (fun _ _ -> str "<tactic>") x)
in
Genprint.register_print0 wit f g h
+let declare_extra_genarg_pprule_with_level wit
+ (f : 'a raw_extra_genarg_printer_with_level)
+ (g : 'b glob_extra_genarg_printer_with_level)
+ (h : 'c extra_genarg_printer_with_level) default_surrounded default_non_surrounded =
+ begin match wit with
+ | ExtraArg s -> ()
+ | _ -> user_err Pp.(str "Can declare a pretty-printing rule only for extra argument types.")
+ end;
+ let open Genprint in
+ let f x =
+ PrinterNeedsLevel {
+ default_already_surrounded = default_surrounded;
+ default_ensure_surrounded = default_non_surrounded;
+ printer = (fun n ->
+ f pr_constr_expr pr_lconstr_expr pr_raw_tactic_level n x) } in
+ let g x =
+ let env = Global.env () in
+ PrinterNeedsLevel {
+ default_already_surrounded = default_surrounded;
+ default_ensure_surrounded = default_non_surrounded;
+ printer = (fun n ->
+ g (pr_and_constr_expr (pr_glob_constr_env env)) (pr_and_constr_expr (pr_lglob_constr_env env)) (pr_glob_tactic_level env) n x) }
+ in
+ let h x =
+ TopPrinterNeedsContextAndLevel {
+ default_already_surrounded = default_surrounded;
+ default_ensure_surrounded = default_non_surrounded;
+ printer = (fun env sigma n ->
+ h (pr_econstr_env env sigma) (pr_leconstr_env env sigma) (fun _ _ -> str "<tactic>") n x) }
+ in
+ Genprint.register_print0 wit f g h
+
let declare_extra_vernac_genarg_pprule wit f =
- let f x = f pr_constr_expr pr_lconstr_expr pr_raw_tactic_level x in
+ let f x = Genprint.PrinterBasic (fun () -> f pr_constr_expr pr_lconstr_expr pr_raw_tactic_level x) in
Genprint.register_vernac_print0 wit f
(** Registering *)
-let pr_intro_pattern_env p = Genprint.PrinterNeedsContext (fun env sigma ->
+let pr_intro_pattern_env p = Genprint.TopPrinterNeedsContext (fun env sigma ->
let print_constr c = let (sigma, c) = c env sigma in pr_econstr_env env sigma c in
Miscprint.pr_intro_pattern print_constr p)
-let pr_red_expr_env r = Genprint.PrinterNeedsContext (fun env sigma ->
+let pr_red_expr_env r = Genprint.TopPrinterNeedsContext (fun env sigma ->
pr_red_expr (pr_econstr_env env sigma, pr_leconstr_env env sigma,
pr_evaluable_reference_env env, pr_constr_pattern_env env sigma) r)
-let pr_bindings_env bl = Genprint.PrinterNeedsContext (fun env sigma ->
+let pr_bindings_env bl = Genprint.TopPrinterNeedsContext (fun env sigma ->
let sigma, bl = bl env sigma in
Miscprint.pr_bindings
(pr_econstr_env env sigma) (pr_leconstr_env env sigma) bl)
-let pr_with_bindings_env bl = Genprint.PrinterNeedsContext (fun env sigma ->
+let pr_with_bindings_env bl = Genprint.TopPrinterNeedsContext (fun env sigma ->
let sigma, bl = bl env sigma in
pr_with_bindings
(pr_econstr_env env sigma) (pr_leconstr_env env sigma) bl)
-let pr_destruction_arg_env c = Genprint.PrinterNeedsContext (fun env sigma ->
+let pr_destruction_arg_env c = Genprint.TopPrinterNeedsContext (fun env sigma ->
let sigma, c = match c with
| clear_flag,ElimOnConstr g -> let sigma,c = g env sigma in sigma,(clear_flag,ElimOnConstr c)
| clear_flag,ElimOnAnonHyp n as x -> sigma, x
@@ -1219,90 +1289,104 @@ let pr_destruction_arg_env c = Genprint.PrinterNeedsContext (fun env sigma ->
(pr_econstr_env env sigma) (pr_leconstr_env env sigma) c)
let make_constr_printer f c =
- Genprint.PrinterNeedsContextAndLevel {
+ Genprint.TopPrinterNeedsContextAndLevel {
Genprint.default_already_surrounded = Ppconstr.ltop;
Genprint.default_ensure_surrounded = Ppconstr.lsimpleconstr;
Genprint.printer = (fun env sigma n -> f env sigma n c)}
let lift f a = Genprint.PrinterBasic (fun () -> f a)
+let lift_top f a = Genprint.TopPrinterBasic (fun () -> f a)
+
+let register_basic_print0 wit f g h =
+ Genprint.register_print0 wit (lift f) (lift g) (lift_top h)
+
+
+let pr_glob_constr_pptac c =
+ let _, env = Pfedit.get_current_context () in
+ pr_glob_constr_env env c
+
+let pr_lglob_constr_pptac c =
+ let _, env = Pfedit.get_current_context () in
+ pr_lglob_constr_env env c
let () =
let pr_bool b = if b then str "true" else str "false" in
let pr_unit _ = str "()" in
- Genprint.register_print0 wit_int_or_var
- (pr_or_var int) (pr_or_var int) (lift int);
- Genprint.register_print0 wit_ref
- pr_reference (pr_or_var (pr_located pr_global)) (lift pr_global);
- Genprint.register_print0 wit_ident
- pr_id pr_id (lift pr_id);
- Genprint.register_print0 wit_var
- (pr_located pr_id) (pr_located pr_id) (lift pr_id);
- Genprint.register_print0
+ let open Genprint in
+ register_basic_print0 wit_int_or_var (pr_or_var int) (pr_or_var int) int;
+ register_basic_print0 wit_ref
+ pr_reference (pr_or_var (pr_located pr_global)) pr_global;
+ register_basic_print0 wit_ident pr_id pr_id pr_id;
+ register_basic_print0 wit_var (pr_located pr_id) (pr_located pr_id) pr_id;
+ register_print0
wit_intro_pattern
- (Miscprint.pr_intro_pattern pr_constr_expr)
- (Miscprint.pr_intro_pattern (fun (c,_) -> pr_glob_constr c))
+ (lift (Miscprint.pr_intro_pattern pr_constr_expr))
+ (lift (Miscprint.pr_intro_pattern (fun (c,_) -> pr_glob_constr_pptac c)))
pr_intro_pattern_env;
Genprint.register_print0
wit_clause_dft_concl
- (pr_clauses (Some true) pr_lident)
- (pr_clauses (Some true) pr_lident)
- (fun c -> Genprint.PrinterBasic (fun () -> pr_clauses (Some true) (fun id -> pr_lident (Loc.tag id)) c))
+ (lift (pr_clauses (Some true) pr_lident))
+ (lift (pr_clauses (Some true) pr_lident))
+ (fun c -> Genprint.TopPrinterBasic (fun () -> pr_clauses (Some true) (fun id -> pr_lident (Loc.tag id)) c))
;
Genprint.register_print0
wit_constr
- Ppconstr.pr_constr_expr
- (fun (c, _) -> Printer.pr_glob_constr c)
+ (lift Ppconstr.pr_lconstr_expr)
+ (lift (fun (c, _) -> pr_lglob_constr_pptac c))
(make_constr_printer Printer.pr_econstr_n_env)
;
Genprint.register_print0
wit_uconstr
- Ppconstr.pr_constr_expr
- (fun (c,_) -> Printer.pr_glob_constr c)
+ (lift Ppconstr.pr_constr_expr)
+ (lift (fun (c,_) -> pr_glob_constr_pptac c))
(make_constr_printer Printer.pr_closed_glob_n_env)
;
Genprint.register_print0
wit_open_constr
- Ppconstr.pr_constr_expr
- (fun (c, _) -> Printer.pr_glob_constr c)
+ (lift Ppconstr.pr_constr_expr)
+ (lift (fun (c, _) -> pr_glob_constr_pptac c))
(make_constr_printer Printer.pr_econstr_n_env)
;
- Genprint.register_print0 wit_red_expr
- (pr_red_expr (pr_constr_expr, pr_lconstr_expr, pr_or_by_notation pr_reference, pr_constr_pattern_expr))
- (pr_red_expr (pr_and_constr_expr pr_glob_constr, pr_and_constr_expr pr_lglob_constr, pr_or_var (pr_and_short_name pr_evaluable_reference), pr_pat_and_constr_expr pr_glob_constr))
+ Genprint.register_print0
+ wit_red_expr
+ (lift (pr_red_expr (pr_constr_expr, pr_lconstr_expr, pr_or_by_notation pr_reference, pr_constr_pattern_expr)))
+ (lift (pr_red_expr (pr_and_constr_expr pr_glob_constr_pptac, pr_and_constr_expr pr_lglob_constr_pptac, pr_or_var (pr_and_short_name pr_evaluable_reference), pr_pat_and_constr_expr pr_glob_constr_pptac)))
pr_red_expr_env
;
- Genprint.register_print0 wit_quant_hyp pr_quantified_hypothesis pr_quantified_hypothesis (lift pr_quantified_hypothesis);
- Genprint.register_print0 wit_bindings
- (Miscprint.pr_bindings_no_with pr_constr_expr pr_lconstr_expr)
- (Miscprint.pr_bindings_no_with (pr_and_constr_expr pr_glob_constr) (pr_and_constr_expr pr_lglob_constr))
+ register_basic_print0 wit_quant_hyp pr_quantified_hypothesis pr_quantified_hypothesis pr_quantified_hypothesis;
+ register_print0 wit_bindings
+ (lift (Miscprint.pr_bindings_no_with pr_constr_expr pr_lconstr_expr))
+ (lift (Miscprint.pr_bindings_no_with (pr_and_constr_expr pr_glob_constr_pptac) (pr_and_constr_expr pr_lglob_constr_pptac)))
pr_bindings_env
;
- Genprint.register_print0 wit_constr_with_bindings
- (pr_with_bindings pr_constr_expr pr_lconstr_expr)
- (pr_with_bindings (pr_and_constr_expr pr_glob_constr) (pr_and_constr_expr pr_lglob_constr))
+ register_print0 wit_constr_with_bindings
+ (lift (pr_with_bindings pr_constr_expr pr_lconstr_expr))
+ (lift (pr_with_bindings (pr_and_constr_expr pr_glob_constr_pptac) (pr_and_constr_expr pr_lglob_constr_pptac)))
pr_with_bindings_env
;
- Genprint.register_print0 wit_open_constr_with_bindings
- (pr_with_bindings pr_constr_expr pr_lconstr_expr)
- (pr_with_bindings (pr_and_constr_expr pr_glob_constr) (pr_and_constr_expr pr_lglob_constr))
+ register_print0 wit_open_constr_with_bindings
+ (lift (pr_with_bindings pr_constr_expr pr_lconstr_expr))
+ (lift (pr_with_bindings (pr_and_constr_expr pr_glob_constr_pptac) (pr_and_constr_expr pr_lglob_constr_pptac)))
pr_with_bindings_env
;
- Genprint.register_print0 Tacarg.wit_destruction_arg
- (pr_destruction_arg pr_constr_expr pr_lconstr_expr)
- (pr_destruction_arg (pr_and_constr_expr pr_glob_constr) (pr_and_constr_expr pr_lglob_constr))
+ register_print0 Tacarg.wit_destruction_arg
+ (lift (pr_destruction_arg pr_constr_expr pr_lconstr_expr))
+ (lift (pr_destruction_arg (pr_and_constr_expr pr_glob_constr_pptac) (pr_and_constr_expr pr_lglob_constr_pptac)))
pr_destruction_arg_env
;
- Genprint.register_print0 Stdarg.wit_int int int (lift int);
- Genprint.register_print0 Stdarg.wit_bool pr_bool pr_bool (lift pr_bool);
- Genprint.register_print0 Stdarg.wit_unit pr_unit pr_unit (lift pr_unit);
- Genprint.register_print0 Stdarg.wit_pre_ident str str (lift str);
- Genprint.register_print0 Stdarg.wit_string qstring qstring (lift qstring)
+ register_basic_print0 Stdarg.wit_int int int int;
+ register_basic_print0 Stdarg.wit_bool pr_bool pr_bool pr_bool;
+ register_basic_print0 Stdarg.wit_unit pr_unit pr_unit pr_unit;
+ register_basic_print0 Stdarg.wit_pre_ident str str str;
+ register_basic_print0 Stdarg.wit_string qstring qstring qstring
let () =
- let printer _ _ prtac = prtac (0, E) in
- declare_extra_genarg_pprule wit_tactic printer printer printer
+ let printer _ _ prtac = prtac in
+ declare_extra_genarg_pprule_with_level wit_tactic printer printer printer
+ ltop (0,E)
let () =
- let pr_unit _ _ _ () = str "()" in
- let printer _ _ prtac = prtac (0, E) in
- declare_extra_genarg_pprule wit_ltac printer printer pr_unit
+ let pr_unit _ _ _ _ () = str "()" in
+ let printer _ _ prtac = prtac in
+ declare_extra_genarg_pprule_with_level wit_ltac printer printer pr_unit
+ ltop (0,E)
diff --git a/plugins/ltac/pptactic.mli b/plugins/ltac/pptactic.mli
index 5ecfaf590..bda5774ab 100644
--- a/plugins/ltac/pptactic.mli
+++ b/plugins/ltac/pptactic.mli
@@ -40,12 +40,37 @@ type 'a extra_genarg_printer =
(tolerability -> Val.t -> Pp.t) ->
'a -> Pp.t
+type 'a raw_extra_genarg_printer_with_level =
+ (constr_expr -> Pp.t) ->
+ (constr_expr -> Pp.t) ->
+ (tolerability -> raw_tactic_expr -> Pp.t) ->
+ tolerability -> 'a -> Pp.t
+
+type 'a glob_extra_genarg_printer_with_level =
+ (glob_constr_and_expr -> Pp.t) ->
+ (glob_constr_and_expr -> Pp.t) ->
+ (tolerability -> glob_tactic_expr -> Pp.t) ->
+ tolerability -> 'a -> Pp.t
+
+type 'a extra_genarg_printer_with_level =
+ (EConstr.constr -> Pp.t) ->
+ (EConstr.constr -> Pp.t) ->
+ (tolerability -> Val.t -> Pp.t) ->
+ tolerability -> 'a -> Pp.t
+
val declare_extra_genarg_pprule :
('a, 'b, 'c) genarg_type ->
'a raw_extra_genarg_printer ->
'b glob_extra_genarg_printer ->
'c extra_genarg_printer -> unit
+val declare_extra_genarg_pprule_with_level :
+ ('a, 'b, 'c) genarg_type ->
+ 'a raw_extra_genarg_printer_with_level ->
+ 'b glob_extra_genarg_printer_with_level ->
+ 'c extra_genarg_printer_with_level ->
+ (* surroounded *) tolerability -> (* non-surroounded *) tolerability -> unit
+
val declare_extra_vernac_genarg_pprule :
('a, 'b, 'c) genarg_type ->
'a raw_extra_genarg_printer -> unit
diff --git a/plugins/ltac/profile_ltac.ml b/plugins/ltac/profile_ltac.ml
index 9ae8bfe65..161546528 100644
--- a/plugins/ltac/profile_ltac.ml
+++ b/plugins/ltac/profile_ltac.ml
@@ -289,7 +289,7 @@ let rec find_in_stack what acc = function
| { name } as x :: rest when String.equal name what -> Some(acc, x, rest)
| { name } as x :: rest -> find_in_stack what (x :: acc) rest
-let exit_tactic start_time c =
+let exit_tactic ~count_call start_time c =
let diff = time () -. start_time in
match Local.(!stack) with
| [] | [_] ->
@@ -304,7 +304,7 @@ let exit_tactic start_time c =
let node = { node with
total = node.total +. diff;
local = node.local +. diff;
- ncalls = node.ncalls + 1;
+ ncalls = node.ncalls + (if count_call then 1 else 0);
max_total = max node.max_total diff;
} in
(* updating the stack *)
@@ -341,7 +341,7 @@ let tclFINALLY tac (finally : unit Proofview.tactic) =
(fun v -> finally <*> Proofview.tclUNIT v)
(fun (exn, info) -> finally <*> Proofview.tclZERO ~info exn)
-let do_profile s call_trace tac =
+let do_profile s call_trace ?(count_call=true) tac =
let open Proofview.Notations in
Proofview.tclLIFT (Proofview.NonLogical.make (fun () ->
if !is_profiling then
@@ -359,7 +359,7 @@ let do_profile s call_trace tac =
tac
(Proofview.tclLIFT (Proofview.NonLogical.make (fun () ->
(match call_trace with
- | (_, c) :: _ -> exit_tactic start_time c
+ | (_, c) :: _ -> exit_tactic ~count_call start_time c
| [] -> ()))))
| None -> tac
@@ -397,6 +397,27 @@ let reset_profile () =
reset_profile_tmp ();
data := SM.empty
+(* ****************************** Named timers ****************************** *)
+
+let timer_data = ref M.empty
+
+let timer_name = function
+ | Some v -> v
+ | None -> ""
+
+let restart_timer name =
+ timer_data := M.add (timer_name name) (System.get_time ()) !timer_data
+
+let get_timer name =
+ try M.find (timer_name name) !timer_data
+ with Not_found -> System.get_time ()
+
+let finish_timing ~prefix name =
+ let tend = System.get_time () in
+ let tstart = get_timer name in
+ Feedback.msg_info(str prefix ++ pr_opt str name ++ str " ran for " ++
+ System.fmt_time_difference tstart tend)
+
(* ******************** *)
let print_results_filter ~cutoff ~filter =
@@ -408,7 +429,7 @@ let print_results_filter ~cutoff ~filter =
let results =
SM.fold (fun _ -> merge_roots ~disjoint:true) !data (empty_treenode root) in
let results = merge_roots results Local.(CList.last !stack) in
- Feedback.msg_notice (to_string ~cutoff ~filter results)
+ Feedback.msg_info (to_string ~cutoff ~filter results)
;;
let print_results ~cutoff =
diff --git a/plugins/ltac/profile_ltac.mli b/plugins/ltac/profile_ltac.mli
index 52827cb36..adedf7ee9 100644
--- a/plugins/ltac/profile_ltac.mli
+++ b/plugins/ltac/profile_ltac.mli
@@ -9,9 +9,39 @@
(** Ltac profiling primitives *)
+(* Note(JasonGross): Ltac semantics are a bit insane. There isn't
+ really a good notion of how many times a tactic has been "called",
+ because tactics can be partially evaluated, and it's unclear
+ whether the number of "calls" should be the number of times the
+ body is fetched and unfolded, or the number of times the code is
+ executed to a value, etc. The logic in [Tacinterp.eval_tactic]
+ gives a decent approximation, which I believe roughly corresponds
+ to the number of times that the engine runs the tactic value which
+ results from evaluating the tactic expression bound to the name
+ we're considering. However, this is a poor approximation of the
+ time spent in the tactic; we want to consider time spent evaluating
+ a tactic expression to a tactic value to be time spent in the
+ expression, not just time spent in the caller of the expression.
+ So we need to wrap some nodes in additional profiling calls which
+ don't count towards to total call count. Whether or not a call
+ "counts" is indicated by the [count_call] boolean argument.
+
+ Unfortunately, at present, we can get very strange call graphs when
+ a named tactic expression never runs as a tactic value: if we have
+ [Ltac t0 := t.] and [Ltac t1 := t0.], then [t1] is considered to
+ run 0(!) times. It evaluates to [t] during tactic expression
+ evaluation, and although the call trace records the fact that it
+ was called by [t0] which was called by [t1], the tactic running
+ phase never sees this. Thus we get one call tree (from expression
+ evaluation) that has [t1] calls [t0] calls [t], and another call
+ tree which says that the caller of [t1] calls [t] directly; the
+ expression evaluation time goes in the first tree, and the call
+ count and tactic running time goes in the second tree. Alas, I
+ suspect that fixing this requires a redesign of how the profiler
+ hooks into the tactic engine. *)
val do_profile :
string -> ('a * Tacexpr.ltac_call_kind) list ->
- 'b Proofview.tactic -> 'b Proofview.tactic
+ ?count_call:bool -> 'b Proofview.tactic -> 'b Proofview.tactic
val set_profiling : bool -> unit
@@ -22,6 +52,10 @@ val print_results_tactic : string -> unit
val reset_profile : unit -> unit
+val restart_timer : string option -> unit
+
+val finish_timing : prefix:string -> string option -> unit
+
val do_print_results_at_close : unit -> unit
(* The collected statistics for a tactic. The timing data is collected over all
@@ -46,4 +80,3 @@ type treenode = {
(* Returns the profiling results known by the current process *)
val get_local_profiling_results : unit -> treenode
val feedback_results : treenode -> unit
-
diff --git a/plugins/ltac/profile_ltac_tactics.ml4 b/plugins/ltac/profile_ltac_tactics.ml4
index 2b1106ee2..9864ffeb6 100644
--- a/plugins/ltac/profile_ltac_tactics.ml4
+++ b/plugins/ltac/profile_ltac_tactics.ml4
@@ -13,21 +13,55 @@
open Profile_ltac
open Stdarg
-DECLARE PLUGIN "profile_ltac_plugin"
+DECLARE PLUGIN "ltac_plugin"
let tclSET_PROFILING b =
Proofview.tclLIFT (Proofview.NonLogical.make (fun () -> set_profiling b))
+let tclRESET_PROFILE =
+ Proofview.tclLIFT (Proofview.NonLogical.make reset_profile)
+
+let tclSHOW_PROFILE ~cutoff =
+ Proofview.tclLIFT (Proofview.NonLogical.make (fun () -> print_results ~cutoff))
+
+let tclSHOW_PROFILE_TACTIC s =
+ Proofview.tclLIFT (Proofview.NonLogical.make (fun () -> print_results_tactic s))
+
+let tclRESTART_TIMER s =
+ Proofview.tclLIFT (Proofview.NonLogical.make (fun () -> restart_timer s))
+
+let tclFINISH_TIMING ?(prefix="Timer") (s : string option) =
+ Proofview.tclLIFT (Proofview.NonLogical.make (fun () -> finish_timing ~prefix s))
+
TACTIC EXTEND start_ltac_profiling
| [ "start" "ltac" "profiling" ] -> [ tclSET_PROFILING true ]
END
-TACTIC EXTEND stop_profiling
+TACTIC EXTEND stop_ltac_profiling
| [ "stop" "ltac" "profiling" ] -> [ tclSET_PROFILING false ]
END
+TACTIC EXTEND reset_ltac_profile
+| [ "reset" "ltac" "profile" ] -> [ tclRESET_PROFILE ]
+END
+
+TACTIC EXTEND show_ltac_profile
+| [ "show" "ltac" "profile" ] -> [ tclSHOW_PROFILE ~cutoff:!Flags.profile_ltac_cutoff ]
+| [ "show" "ltac" "profile" "cutoff" int(n) ] -> [ tclSHOW_PROFILE ~cutoff:(float_of_int n) ]
+| [ "show" "ltac" "profile" string(s) ] -> [ tclSHOW_PROFILE_TACTIC s ]
+END
+
+TACTIC EXTEND restart_timer
+| [ "restart_timer" string_opt(s) ] -> [ tclRESTART_TIMER s ]
+END
+
+TACTIC EXTEND finish_timing
+| [ "finish_timing" string_opt(s) ] -> [ tclFINISH_TIMING ~prefix:"Timer" s ]
+| [ "finish_timing" "(" string(prefix) ")" string_opt(s) ] -> [ tclFINISH_TIMING ~prefix s ]
+END
+
VERNAC COMMAND EXTEND ResetLtacProfiling CLASSIFIED AS SIDEFF
- [ "Reset" "Ltac" "Profile" ] -> [ reset_profile() ]
+ [ "Reset" "Ltac" "Profile" ] -> [ reset_profile () ]
END
VERNAC COMMAND EXTEND ShowLtacProfile CLASSIFIED AS QUERY
diff --git a/plugins/ltac/rewrite.ml b/plugins/ltac/rewrite.ml
index 1809f0fcd..acd7a30c4 100644
--- a/plugins/ltac/rewrite.ml
+++ b/plugins/ltac/rewrite.ml
@@ -6,13 +6,13 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-open Names
open Pp
open CErrors
open Util
+open Names
open Nameops
open Namegen
-open Term
+open Constr
open EConstr
open Vars
open Reduction
@@ -210,9 +210,9 @@ end) = struct
let t = Reductionops.whd_all env (goalevars evars) ty in
match EConstr.kind (goalevars evars) t, l with
| Prod (na, ty, b), obj :: cstrs ->
- let b = Reductionops.nf_betaiota (goalevars evars) b in
+ let b = Reductionops.nf_betaiota env (goalevars evars) b in
if noccurn (goalevars evars) 1 b (* non-dependent product *) then
- let ty = Reductionops.nf_betaiota (goalevars evars) ty in
+ let ty = Reductionops.nf_betaiota env (goalevars evars) ty in
let (evars, b', arg, cstrs) = aux env evars (subst1 mkProp b) cstrs in
let evars, relty = mk_relty evars env ty obj in
let evars, newarg = app_poly env evars respectful [| ty ; b' ; relty ; arg |] in
@@ -221,7 +221,7 @@ end) = struct
let (evars, b, arg, cstrs) =
aux (push_rel (LocalAssum (na, ty)) env) evars b cstrs
in
- let ty = Reductionops.nf_betaiota (goalevars evars) ty in
+ let ty = Reductionops.nf_betaiota env (goalevars evars) ty in
let pred = mkLambda (na, ty, b) in
let liftarg = mkLambda (na, ty, arg) in
let evars, arg' = app_poly env evars forall_relation [| ty ; pred ; liftarg |] in
@@ -231,7 +231,7 @@ end) = struct
| _, [] ->
(match finalcstr with
| None | Some (_, None) ->
- let t = Reductionops.nf_betaiota (fst evars) ty in
+ let t = Reductionops.nf_betaiota env (fst evars) ty in
let evars, rel = mk_relty evars env t None in
evars, t, rel, [t, Some rel]
| Some (t, Some rel) -> evars, t, rel, [t, Some rel])
@@ -361,8 +361,8 @@ end) = struct
end
(* let my_type_of env evars c = Typing.e_type_of env evars c *)
-(* let mytypeofkey = Profile.declare_profile "my_type_of";; *)
-(* let my_type_of = Profile.profile3 mytypeofkey my_type_of *)
+(* let mytypeofkey = CProfile.declare_profile "my_type_of";; *)
+(* let my_type_of = CProfile.profile3 mytypeofkey my_type_of *)
let type_app_poly env env evd f args =
@@ -426,7 +426,7 @@ let split_head = function
| [] -> assert(false)
let eq_pb (ty, env, x, y as pb) (ty', env', x', y' as pb') =
- pb == pb' || (ty == ty' && Term.eq_constr x x' && Term.eq_constr y y')
+ pb == pb' || (ty == ty' && Constr.equal x x' && Constr.equal y y')
let problem_inclusion x y =
List.for_all (fun pb -> List.exists (fun pb' -> eq_pb pb pb') y) x
@@ -928,8 +928,8 @@ let fold_match ?(force=false) env sigma c =
it_mkProd_or_LetIn (subst1 mkProp body) (List.tl ctx)
in
let sk =
- if sortp == InProp then
- if sortc == InProp then
+ if sortp == Sorts.InProp then
+ if sortc == Sorts.InProp then
if dep then case_dep_scheme_kind_from_prop
else case_scheme_kind_from_prop
else (
@@ -1143,7 +1143,7 @@ let subterm all flags (s : 'a pure_strategy) : 'a pure_strategy =
(* | _ -> b') *)
| Lambda (n, t, b) when flags.under_lambdas ->
- let n' = name_app (fun id -> Tactics.fresh_id_in_env unfresh id env) n in
+ let n' = Nameops.Name.map (fun id -> Tactics.fresh_id_in_env unfresh id env) n in
let open Context.Rel.Declaration in
let env' = EConstr.push_rel (LocalAssum (n', t)) env in
let bty = Retyping.get_type_of env' (goalevars evars) b in
@@ -1557,9 +1557,8 @@ let newfail n s =
let cl_rewrite_clause_newtac ?abs ?origsigma ~progress strat clause =
let open Proofview.Notations in
(** For compatibility *)
- let beta_red _ sigma c = Reductionops.nf_betaiota sigma c in
- let beta = Tactics.reduct_in_concl (beta_red, DEFAULTcast) in
- let beta_hyp id = Tactics.reduct_in_hyp beta_red (id, InHyp) in
+ let beta = Tactics.reduct_in_concl (Reductionops.nf_betaiota, DEFAULTcast) in
+ let beta_hyp id = Tactics.reduct_in_hyp Reductionops.nf_betaiota (id, InHyp) in
let treat sigma res =
match res with
| None -> newfail 0 (str "Nothing to rewrite")
@@ -1781,7 +1780,9 @@ let declare_an_instance n s args =
let declare_instance a aeq n s = declare_an_instance n s [a;aeq]
let anew_instance global binders instance fields =
- new_instance (Flags.is_universe_polymorphism ())
+ let program_mode = Flags.is_program_mode () in
+ let poly = Flags.is_universe_polymorphism () in
+ new_instance ~program_mode poly
binders instance (Some (true, CAst.make @@ CRecord (fields)))
~global ~generalize:false ~refine:false Hints.empty_hint_info
@@ -1800,9 +1801,9 @@ let declare_instance_trans global binders a aeq n lemma =
in anew_instance global binders instance
[(Ident (Loc.tag @@ Id.of_string "transitivity"),lemma)]
-let declare_relation ?(binders=[]) a aeq n refl symm trans =
+let declare_relation ?locality ?(binders=[]) a aeq n refl symm trans =
init_setoid ();
- let global = not (Locality.make_section_locality (Locality.LocalityFixme.consume ())) in
+ let global = not (Locality.make_section_locality locality) in
let instance = declare_instance a aeq (add_suffix n "_relation") "Coq.Classes.RelationClasses.RewriteRelation"
in ignore(anew_instance global binders instance []);
match (refl,symm,trans) with
@@ -1884,11 +1885,11 @@ let declare_projection n instance_id r =
in it_mkProd_or_LetIn ccl ctx
in
let typ = it_mkProd_or_LetIn typ ctx in
- let pl, ctx = Evd.universe_context ~names:[] ~extensible:true sigma in
+ let univs = Evd.const_univ_entry ~poly sigma in
let typ = EConstr.to_constr sigma typ in
let term = EConstr.to_constr sigma term in
let cst =
- Declare.definition_entry ~types:typ ~poly ~univs:ctx term
+ Declare.definition_entry ~types:typ ~univs term
in
ignore(Declare.declare_constant n
(Entries.DefinitionEntry cst, Decl_kinds.IsDefinition Decl_kinds.Definition))
@@ -1972,14 +1973,14 @@ let add_morphism_infer glob m n =
let evd = Evd.from_env env in
let uctx, instance = build_morphism_signature env evd m in
if Lib.is_modtype () then
+ let uctx = UState.const_univ_entry ~poly uctx in
let cst = Declare.declare_constant ~internal:Declare.InternalTacticRequest instance_id
(Entries.ParameterEntry
- (None,poly,(instance,UState.context uctx),None),
+ (None,(instance,uctx),None),
Decl_kinds.IsAssumption Decl_kinds.Logical)
in
add_instance (Typeclasses.new_instance
- (Lazy.force PropGlobal.proper_class) Hints.empty_hint_info glob
- poly (ConstRef cst));
+ (Lazy.force PropGlobal.proper_class) Hints.empty_hint_info glob (ConstRef cst));
declare_projection n instance_id (ConstRef cst)
else
let kind = Decl_kinds.Global, poly,
@@ -1990,7 +1991,7 @@ let add_morphism_infer glob m n =
| Globnames.ConstRef cst ->
add_instance (Typeclasses.new_instance
(Lazy.force PropGlobal.proper_class) Hints.empty_hint_info
- glob poly (ConstRef cst));
+ glob (ConstRef cst));
declare_projection n instance_id (ConstRef cst)
| _ -> assert false
in
@@ -2011,23 +2012,26 @@ let add_morphism glob binders m s n =
[cHole; s; m]))
in
let tac = Tacinterp.interp (make_tactic "add_morphism_tactic") in
- ignore(new_instance ~global:glob poly binders instance
- (Some (true, CAst.make @@ CRecord []))
- ~generalize:false ~tac ~hook:(declare_projection n instance_id) Hints.empty_hint_info)
+ let program_mode = Flags.is_program_mode () in
+ ignore(new_instance ~program_mode ~global:glob poly binders instance
+ (Some (true, CAst.make @@ CRecord []))
+ ~generalize:false ~tac ~hook:(declare_projection n instance_id) Hints.empty_hint_info)
(** Bind to "rewrite" too *)
(** Taken from original setoid_replace, to emulate the old rewrite semantics where
lemmas are first instantiated and then rewrite proceeds. *)
-let check_evar_map_of_evars_defs evd =
+let check_evar_map_of_evars_defs env evd =
let metas = Evd.meta_list evd in
let check_freemetas_is_empty rebus =
Evd.Metaset.iter
(fun m ->
- if Evd.meta_defined evd m then () else
- raise
- (Logic.RefinerError (Logic.UnresolvedBindings [Evd.meta_name evd m])))
+ if Evd.meta_defined evd m then ()
+ else begin
+ raise
+ (Logic.RefinerError (env, evd, Logic.UnresolvedBindings [Evd.meta_name evd m]))
+ end)
in
List.iter
(fun (_,binding) ->
@@ -2062,7 +2066,7 @@ let unification_rewrite l2r c1 c2 sigma prf car rel but env =
let c1 = if l2r then nf c' else nf c1
and c2 = if l2r then nf c2 else nf c'
and car = nf car and rel = nf rel in
- check_evar_map_of_evars_defs sigma;
+ check_evar_map_of_evars_defs env sigma;
let prf = nf prf in
let prfty = nf (Retyping.get_type_of env sigma prf) in
let sort = sort_of_rel env sigma but in
@@ -2083,8 +2087,8 @@ let get_hyp gl (c,l) clause l2r =
let general_rewrite_flags = { under_lambdas = false; on_morphisms = true }
-(* let rewriteclaustac_key = Profile.declare_profile "cl_rewrite_clause_tac";; *)
-(* let cl_rewrite_clause_tac = Profile.profile5 rewriteclaustac_key cl_rewrite_clause_tac *)
+(* let rewriteclaustac_key = CProfile.declare_profile "cl_rewrite_clause_tac";; *)
+(* let cl_rewrite_clause_tac = CProfile.profile5 rewriteclaustac_key cl_rewrite_clause_tac *)
(** Setoid rewriting when called with "rewrite" *)
let general_s_rewrite cl l2r occs (c,l) ~new_goals =
diff --git a/plugins/ltac/rewrite.mli b/plugins/ltac/rewrite.mli
index 63e891b45..17e7244b3 100644
--- a/plugins/ltac/rewrite.mli
+++ b/plugins/ltac/rewrite.mli
@@ -37,7 +37,7 @@ type ('constr,'redexpr) strategy_ast =
type rewrite_proof =
| RewPrf of constr * constr
- | RewCast of Term.cast_kind
+ | RewCast of Constr.cast_kind
type evars = evar_map * Evar.Set.t (* goal evars, constraint evars *)
@@ -75,7 +75,7 @@ val cl_rewrite_clause :
val is_applied_rewrite_relation :
env -> evar_map -> rel_context -> constr -> types option
-val declare_relation :
+val declare_relation : ?locality:bool ->
?binders:local_binder_expr list -> constr_expr -> constr_expr -> Id.t ->
constr_expr option -> constr_expr option -> constr_expr option -> unit
diff --git a/plugins/ltac/taccoerce.ml b/plugins/ltac/taccoerce.ml
index 4d171ecbc..e5933de2a 100644
--- a/plugins/ltac/taccoerce.ml
+++ b/plugins/ltac/taccoerce.ml
@@ -8,7 +8,7 @@
open Util
open Names
-open Term
+open Constr
open EConstr
open Misctypes
open Genarg
@@ -33,7 +33,7 @@ let (wit_constr_under_binders : (Empty.t, Empty.t, Ltac_pretype.constr_under_bin
let () = register_val0 wit None in
let () = Genprint.register_val_print0 (base_val_typ wit)
(fun c ->
- Genprint.PrinterNeedsContext (fun env sigma -> Printer.pr_constr_under_binders_env env sigma c)) in
+ Genprint.TopPrinterNeedsContext (fun env sigma -> Printer.pr_constr_under_binders_env env sigma c)) in
wit
(** All the types considered here are base types *)
@@ -61,12 +61,9 @@ struct
type t = Val.t
-let normalize v = v
-
let of_constr c = in_gen (topwit wit_constr) c
let to_constr v =
- let v = normalize v in
if has_type v (topwit wit_constr) then
let c = out_gen (topwit wit_constr) v in
Some c
@@ -78,7 +75,6 @@ let to_constr v =
let of_uconstr c = in_gen (topwit wit_uconstr) c
let to_uconstr v =
- let v = normalize v in
if has_type v (topwit wit_uconstr) then
Some (out_gen (topwit wit_uconstr) v)
else None
@@ -86,7 +82,6 @@ let to_uconstr v =
let of_int i = in_gen (topwit wit_int) i
let to_int v =
- let v = normalize v in
if has_type v (topwit wit_int) then
Some (out_gen (topwit wit_int) v)
else None
@@ -108,14 +103,12 @@ let constr_of_id env id =
(* Gives the constr corresponding to a Constr_context tactic_arg *)
let coerce_to_constr_context v =
- let v = Value.normalize v in
if has_type v (topwit wit_constr_context) then
out_gen (topwit wit_constr_context) v
else raise (CannotCoerceTo "a term context")
(* Interprets an identifier which must be fresh *)
let coerce_var_to_ident fresh env sigma v =
- let v = Value.normalize v in
let fail () = raise (CannotCoerceTo "a fresh identifier") in
if has_type v (topwit wit_intro_pattern) then
match out_gen (topwit wit_intro_pattern) v with
@@ -140,7 +133,6 @@ let g = sigma in
let id_of_name = function
| Name.Anonymous -> Id.of_string "x"
| Name.Name x -> x in
- let v = Value.normalize v in
let fail () = raise (CannotCoerceTo "an identifier") in
if has_type v (topwit wit_intro_pattern) then
match out_gen (topwit wit_intro_pattern) v with
@@ -172,14 +164,13 @@ let id_of_name = function
| Sort s ->
begin
match ESorts.kind sigma s with
- | Prop _ -> Label.to_id (Label.make "Prop")
- | Type _ -> Label.to_id (Label.make "Type")
+ | Sorts.Prop _ -> Label.to_id (Label.make "Prop")
+ | Sorts.Type _ -> Label.to_id (Label.make "Type")
end
| _ -> fail()
let coerce_to_intro_pattern env sigma v =
- let v = Value.normalize v in
if has_type v (topwit wit_intro_pattern) then
snd (out_gen (topwit wit_intro_pattern) v)
else if has_type v (topwit wit_var) then
@@ -198,7 +189,6 @@ let coerce_to_intro_pattern_naming env sigma v =
| _ -> raise (CannotCoerceTo "a naming introduction pattern")
let coerce_to_hint_base v =
- let v = Value.normalize v in
if has_type v (topwit wit_intro_pattern) then
match out_gen (topwit wit_intro_pattern) v with
| _, IntroNaming (IntroIdentifier id) -> Id.to_string id
@@ -206,13 +196,11 @@ let coerce_to_hint_base v =
else raise (CannotCoerceTo "a hint base name")
let coerce_to_int v =
- let v = Value.normalize v in
if has_type v (topwit wit_int) then
out_gen (topwit wit_int) v
else raise (CannotCoerceTo "an integer")
let coerce_to_constr env v =
- let v = Value.normalize v in
let fail () = raise (CannotCoerceTo "a term") in
if has_type v (topwit wit_intro_pattern) then
match out_gen (topwit wit_intro_pattern) v with
@@ -230,7 +218,6 @@ let coerce_to_constr env v =
else fail ()
let coerce_to_uconstr env v =
- let v = Value.normalize v in
if has_type v (topwit wit_uconstr) then
out_gen (topwit wit_uconstr) v
else
@@ -243,7 +230,6 @@ let coerce_to_closed_constr env v =
let coerce_to_evaluable_ref env sigma v =
let fail () = raise (CannotCoerceTo "an evaluable reference") in
- let v = Value.normalize v in
let ev =
if has_type v (topwit wit_intro_pattern) then
match out_gen (topwit wit_intro_pattern) v with
@@ -284,7 +270,6 @@ let coerce_to_intro_pattern_list ?loc env sigma v =
let coerce_to_hyp env sigma v =
let fail () = raise (CannotCoerceTo "a variable") in
- let v = Value.normalize v in
if has_type v (topwit wit_intro_pattern) then
match out_gen (topwit wit_intro_pattern) v with
| _, IntroNaming (IntroIdentifier id) when is_variable env id -> id
@@ -306,7 +291,6 @@ let coerce_to_hyp_list env sigma v =
(* Interprets a qualified name *)
let coerce_to_reference env sigma v =
- let v = Value.normalize v in
match Value.to_constr v with
| Some c ->
begin
@@ -318,7 +302,6 @@ let coerce_to_reference env sigma v =
(* Quantified named or numbered hypothesis or hypothesis in context *)
(* (as in Inversion) *)
let coerce_to_quantified_hypothesis sigma v =
- let v = Value.normalize v in
if has_type v (topwit wit_intro_pattern) then
let v = out_gen (topwit wit_intro_pattern) v in
match v with
@@ -336,7 +319,6 @@ let coerce_to_quantified_hypothesis sigma v =
(* Quantified named or numbered hypothesis or hypothesis in context *)
(* (as in Inversion) *)
let coerce_to_decl_or_quant_hyp env sigma v =
- let v = Value.normalize v in
if has_type v (topwit wit_int) then
AnonHyp (out_gen (topwit wit_int) v)
else
diff --git a/plugins/ltac/taccoerce.mli b/plugins/ltac/taccoerce.mli
index d7b253a68..dce16b733 100644
--- a/plugins/ltac/taccoerce.mli
+++ b/plugins/ltac/taccoerce.mli
@@ -31,9 +31,6 @@ module Value :
sig
type t = Val.t
- val normalize : t -> t
- (** Eliminated the leading dynamic type casts. *)
-
val of_constr : constr -> t
val to_constr : t -> constr option
val of_uconstr : Ltac_pretype.closed_glob_constr -> t
diff --git a/plugins/ltac/tacexpr.mli b/plugins/ltac/tacexpr.mli
index 163973688..ccd555b61 100644
--- a/plugins/ltac/tacexpr.mli
+++ b/plugins/ltac/tacexpr.mli
@@ -81,7 +81,7 @@ type 'a with_bindings_arg = clear_flag * 'a with_bindings
(* Type of patterns *)
type 'a match_pattern =
| Term of 'a
- | Subterm of bool * Id.t option * 'a
+ | Subterm of Id.t option * 'a
(* Type of hypotheses for a Match Context rule *)
type 'a match_context_hyps =
@@ -254,7 +254,7 @@ and 'a gen_tactic_expr =
| TacFail of global_flag * int or_var * 'n message_token list
| TacInfo of 'a gen_tactic_expr
| TacLetIn of rec_flag *
- (Id.t located * 'a gen_tactic_arg) list *
+ (Name.t located * 'a gen_tactic_arg) list *
'a gen_tactic_expr
| TacMatch of lazy_flag *
'a gen_tactic_expr *
diff --git a/plugins/ltac/tacintern.ml b/plugins/ltac/tacintern.ml
index f171fd07d..ebffde441 100644
--- a/plugins/ltac/tacintern.ml
+++ b/plugins/ltac/tacintern.ml
@@ -428,9 +428,9 @@ let intern_hyp_location ist ((occs,id),hl) =
(* Reads a pattern *)
let intern_pattern ist ?(as_type=false) ltacvars = function
- | Subterm (b,ido,pc) ->
+ | Subterm (ido,pc) ->
let (metas,pc) = intern_constr_pattern ist ~as_type:false ~ltacvars pc in
- ido, metas, Subterm (b,ido,pc)
+ ido, metas, Subterm (ido,pc)
| Term pc ->
let (metas,pc) = intern_constr_pattern ist ~as_type ~ltacvars pc in
None, metas, Term pc
@@ -468,9 +468,10 @@ let rec intern_match_goal_hyps ist ?(as_type=false) lfun = function
(* Utilities *)
let extract_let_names lrc =
let fold accu ((loc, name), _) =
- if Id.Set.mem name accu then user_err ?loc
+ Nameops.Name.fold_right (fun id accu ->
+ if Id.Set.mem id accu then user_err ?loc
~hdr:"glob_tactic" (str "This variable is bound several times.")
- else Id.Set.add name accu
+ else Id.Set.add id accu) name accu
in
List.fold_left fold Id.Set.empty lrc
@@ -812,7 +813,7 @@ let notation_subst bindings tac =
let fold id c accu =
let loc = Glob_ops.loc_of_glob_constr (fst c) in
let c = ConstrMayEval (ConstrTerm c) in
- ((loc, id), c) :: accu
+ ((loc, Name id), c) :: accu
in
let bindings = Id.Map.fold fold bindings [] in
(** This is theoretically not correct due to potential variable capture, but
diff --git a/plugins/ltac/tacinterp.ml b/plugins/ltac/tacinterp.ml
index fd75862c6..f2720954d 100644
--- a/plugins/ltac/tacinterp.ml
+++ b/plugins/ltac/tacinterp.ml
@@ -128,7 +128,7 @@ let (wit_tacvalue : (Empty.t, tacvalue, tacvalue) Genarg.genarg_type) =
let wit = Genarg.create_arg "tacvalue" in
let () = register_val0 wit None in
let () = Genprint.register_val_print0 (base_val_typ wit)
- (fun _ -> Genprint.PrinterBasic (fun () -> str "<tactic closure>")) in
+ (fun _ -> Genprint.TopPrinterBasic (fun () -> str "<tactic closure>")) in
wit
let of_tacvalue v = in_gen (topwit wit_tacvalue) v
@@ -136,7 +136,6 @@ let to_tacvalue v = out_gen (topwit wit_tacvalue) v
(** More naming applications *)
let name_vfun appl vle =
- let vle = Value.normalize vle in
if has_type vle (topwit wit_tacvalue) then
match to_tacvalue vle with
| VFun (appl0,trace,lfun,vars,t) -> of_tacvalue (VFun (combine_appl appl0 appl,trace,lfun,vars,t))
@@ -235,16 +234,15 @@ let curr_debug ist = match TacStore.get ist.extra f_debug with
(* Displays a value *)
let pr_value env v =
- let v = Value.normalize v in
let pr_with_env pr =
match env with
| Some (env,sigma) -> pr env sigma
| None -> str "a value of type" ++ spc () ++ pr_argument_type v in
let open Genprint in
match generic_val_print v with
- | PrinterBasic pr -> pr ()
- | PrinterNeedsContext pr -> pr_with_env pr
- | PrinterNeedsContextAndLevel { default_already_surrounded; printer } ->
+ | TopPrinterBasic pr -> pr ()
+ | TopPrinterNeedsContext pr -> pr_with_env pr
+ | TopPrinterNeedsContextAndLevel { default_already_surrounded; printer } ->
pr_with_env (fun env sigma -> printer env sigma default_already_surrounded)
let pr_closure env ist body =
@@ -285,7 +283,6 @@ let push_trace call ist = match TacStore.get ist.extra f_trace with
| Some trace -> Proofview.tclUNIT (call :: trace)
let propagate_trace ist loc id v =
- let v = Value.normalize v in
if has_type v (topwit wit_tacvalue) then
let tacv = to_tacvalue v in
match tacv with
@@ -298,7 +295,6 @@ let propagate_trace ist loc id v =
else Proofview.tclUNIT v
let append_trace trace v =
- let v = Value.normalize v in
if has_type v (topwit wit_tacvalue) then
match to_tacvalue v with
| VFun (appl,trace',lfun,it,b) -> of_tacvalue (VFun (appl,trace'@trace,lfun,it,b))
@@ -307,11 +303,9 @@ let append_trace trace v =
(* Dynamically check that an argument is a tactic *)
let coerce_to_tactic loc id v =
- let v = Value.normalize v in
let fail () = user_err ?loc
(str "Variable " ++ Id.print id ++ str " should be bound to a tactic.")
in
- let v = Value.normalize v in
if has_type v (topwit wit_tacvalue) then
let tacv = to_tacvalue v in
match tacv with
@@ -420,7 +414,7 @@ let interp_hyp ist env sigma (loc,id as locid) =
with Not_found ->
(* Then look if bound in the proof context at calling time *)
if is_variable env id then id
- else Loc.raise ?loc (Logic.RefinerError (Logic.NoSuchHyp id))
+ else Loc.raise ?loc (Logic.RefinerError (env, sigma, Logic.NoSuchHyp id))
let interp_hyp_list_as_list ist env sigma (loc,id as x) =
try coerce_to_hyp_list env sigma (Id.Map.find id ist.lfun)
@@ -514,7 +508,6 @@ let rec intropattern_ids accu (loc,pat) = match pat with
let extract_ids ids lfun accu =
let fold id v accu =
- let v = Value.normalize v in
if has_type v (topwit wit_intro_pattern) then
let (_, ipat) = out_gen (topwit wit_intro_pattern) v in
if Id.List.mem id ids then accu
@@ -816,14 +809,13 @@ let interp_constr_may_eval ist env sigma c =
(** TODO: should use dedicated printers *)
let message_of_value v =
- let v = Value.normalize v in
let pr_with_env pr =
Ftactic.enter begin fun gl -> Ftactic.return (pr (pf_env gl) (project gl)) end in
let open Genprint in
match generic_val_print v with
- | PrinterBasic pr -> Ftactic.return (pr ())
- | PrinterNeedsContext pr -> pr_with_env pr
- | PrinterNeedsContextAndLevel { default_ensure_surrounded; printer } ->
+ | TopPrinterBasic pr -> Ftactic.return (pr ())
+ | TopPrinterNeedsContext pr -> pr_with_env pr
+ | TopPrinterNeedsContextAndLevel { default_ensure_surrounded; printer } ->
pr_with_env (fun env sigma -> printer env sigma default_ensure_surrounded)
let interp_message_token ist = function
@@ -890,7 +882,7 @@ let interp_intro_pattern_naming_option ist env sigma = function
let interp_or_and_intro_pattern_option ist env sigma = function
| None -> sigma, None
| Some (ArgVar (loc,id)) ->
- (match coerce_to_intro_pattern env sigma (Id.Map.find id ist.lfun) with
+ (match interp_intro_pattern_var loc ist env sigma id with
| IntroAction (IntroOrAndPattern l) -> sigma, Some (loc,l)
| _ ->
user_err ?loc (str "Cannot coerce to a disjunctive/conjunctive pattern."))
@@ -986,7 +978,6 @@ let interp_destruction_arg ist gl arg =
try
(** FIXME: should be moved to taccoerce *)
let v = Id.Map.find id ist.lfun in
- let v = Value.normalize v in
if has_type v (topwit wit_intro_pattern) then
let v = out_gen (topwit wit_intro_pattern) v in
match v with
@@ -1040,7 +1031,7 @@ let eval_pattern lfun ist env sigma (bvars,(glob,_),pat as c) =
(bvars,instantiate_pattern env sigma lfun pat)
let read_pattern lfun ist env sigma = function
- | Subterm (b,ido,c) -> Subterm (b,ido,eval_pattern lfun ist env sigma c)
+ | Subterm (ido,c) -> Subterm (ido,eval_pattern lfun ist env sigma c)
| Term c -> Term (eval_pattern lfun ist env sigma c)
(* Reads the hypotheses of a Match Context rule *)
@@ -1158,10 +1149,14 @@ and eval_tactic ist tac : unit Proofview.tactic = match tac with
Proofview.V82.tactic begin
tclSHOWHYPS (Proofview.V82.of_tactic (interp_tactic ist tac))
end
- | TacAbstract (tac,ido) ->
+ | TacAbstract (t,ido) ->
+ let call = LtacMLCall tac in
+ push_trace(None,call) ist >>= fun trace ->
+ Profile_ltac.do_profile "eval_tactic:TacAbstract" trace
+ (catch_error_tac trace begin
Proofview.Goal.enter begin fun gl -> Tactics.tclABSTRACT
- (Option.map (interp_ident ist (pf_env gl) (project gl)) ido) (interp_tactic ist tac)
- end
+ (Option.map (interp_ident ist (pf_env gl) (project gl)) ido) (interp_tactic ist t)
+ end end)
| TacThen (t1,t) ->
Tacticals.New.tclTHEN (interp_tactic ist t1) (interp_tactic ist t)
| TacDispatch tl ->
@@ -1244,7 +1239,6 @@ and eval_tactic ist tac : unit Proofview.tactic = match tac with
Ftactic.run args tac
and force_vrec ist v : Val.t Ftactic.t =
- let v = Value.normalize v in
if has_type v (topwit wit_tacvalue) then
let v = to_tacvalue v in
match v with
@@ -1272,7 +1266,8 @@ and interp_ltac_reference ?loc' mustbetac ist r : Val.t Ftactic.t =
let extra = TacStore.set extra f_trace trace in
let ist = { lfun = Id.Map.empty; extra = extra; } in
let appl = GlbAppl[r,[]] in
- val_interp ~appl ist (Tacenv.interp_ltac r)
+ Profile_ltac.do_profile "interp_ltac_reference" trace ~count_call:false
+ (val_interp ~appl ist (Tacenv.interp_ltac r))
and interp_tacarg ist arg : Val.t Ftactic.t =
match arg with
@@ -1319,7 +1314,6 @@ and interp_tacarg ist arg : Val.t Ftactic.t =
and interp_app loc ist fv largs : Val.t Ftactic.t =
let (>>=) = Ftactic.bind in
let fail = Tacticals.New.tclZEROMSG (str "Illegal tactic application.") in
- let fv = Value.normalize fv in
if has_type fv (topwit wit_tacvalue) then
match to_tacvalue fv with
(* if var=[] and body has been delayed by val_interp, then body
@@ -1338,7 +1332,8 @@ and interp_app loc ist fv largs : Val.t Ftactic.t =
let ist = {
lfun = newlfun;
extra = TacStore.set ist.extra f_trace []; } in
- catch_error_tac trace (val_interp ist body) >>= fun v ->
+ Profile_ltac.do_profile "interp_app" trace ~count_call:false
+ (catch_error_tac trace (val_interp ist body)) >>= fun v ->
Ftactic.return (name_vfun (push_appl appl largs) v)
end
begin fun (e, info) ->
@@ -1353,8 +1348,8 @@ and interp_app loc ist fv largs : Val.t Ftactic.t =
begin
let open Genprint in
match generic_val_print v with
- | PrinterBasic _ -> call_debug None
- | PrinterNeedsContext _ | PrinterNeedsContextAndLevel _ ->
+ | TopPrinterBasic _ -> call_debug None
+ | TopPrinterNeedsContext _ | TopPrinterNeedsContextAndLevel _ ->
Proofview.Goal.enter (fun gl -> call_debug (Some (pf_env gl,project gl)))
end <*>
if List.is_empty lval then Ftactic.return v else interp_app loc ist v lval
@@ -1371,7 +1366,6 @@ and interp_app loc ist fv largs : Val.t Ftactic.t =
(* Gives the tactic corresponding to the tactic value *)
and tactic_of_value ist vle =
- let vle = Value.normalize vle in
if has_type vle (topwit wit_tacvalue) then
match to_tacvalue vle with
| VFun (appl,trace,lfun,[],t) ->
@@ -1380,13 +1374,38 @@ and tactic_of_value ist vle =
extra = TacStore.set ist.extra f_trace []; } in
let tac = name_if_glob appl (eval_tactic ist t) in
Profile_ltac.do_profile "tactic_of_value" trace (catch_error_tac trace tac)
- | VFun (_, _, _,vars,_) ->
- let numargs = List.length vars in
- Tacticals.New.tclZEROMSG
- (str "A fully applied tactic is expected:" ++ spc() ++ Pp.str "missing " ++
- Pp.str (String.plural numargs "argument") ++ Pp.str " for " ++
- Pp.str (String.plural numargs "variable") ++ Pp.str " " ++
- pr_enum Name.print vars ++ Pp.str ".")
+ | VFun (appl,_,vmap,vars,_) ->
+ let tactic_nm =
+ match appl with
+ UnnamedAppl -> "An unnamed user-defined tactic"
+ | GlbAppl apps ->
+ let nms = List.map (fun (kn,_) -> Names.KerName.to_string kn) apps in
+ match nms with
+ [] -> assert false
+ | kn::_ -> "The user-defined tactic \"" ^ kn ^ "\"" (* TODO: when do we not have a singleton? *)
+ in
+ let numargs = List.length vars in
+ let givenargs =
+ List.map (fun (arg,_) -> Names.Id.to_string arg) (Names.Id.Map.bindings vmap) in
+ let numgiven = List.length givenargs in
+ Tacticals.New.tclZEROMSG
+ (Pp.str tactic_nm ++ Pp.str " was not fully applied:" ++ spc() ++
+ (match numargs with
+ 0 -> assert false
+ | 1 ->
+ Pp.str "There is a missing argument for variable " ++
+ (Name.print (List.hd vars))
+ | _ -> Pp.str "There are missing arguments for variables " ++
+ pr_enum Name.print vars) ++ Pp.pr_comma () ++
+ match numgiven with
+ 0 ->
+ Pp.str "no arguments at all were provided."
+ | 1 ->
+ Pp.str "an argument was provided for variable " ++
+ Pp.str (List.hd givenargs) ++ Pp.str "."
+ | _ ->
+ Pp.str "arguments were provided for variables " ++
+ pr_enum Pp.str givenargs ++ Pp.str ".")
| VRec _ -> Tacticals.New.tclZEROMSG (str "A fully applied tactic is expected.")
else if has_type vle (topwit wit_tactic) then
let tac = out_gen (topwit wit_tactic) vle in
@@ -1397,9 +1416,9 @@ and tactic_of_value ist vle =
and interp_letrec ist llc u =
Proofview.tclUNIT () >>= fun () -> (* delay for the effects of [lref], just in case. *)
let lref = ref ist.lfun in
- let fold accu ((_, id), b) =
+ let fold accu ((_, na), b) =
let v = of_tacvalue (VRec (lref, TacArg (Loc.tag b))) in
- Id.Map.add id v accu
+ Name.fold_right (fun id -> Id.Map.add id v) na accu
in
let lfun = List.fold_left fold ist.lfun llc in
let () = lref := lfun in
@@ -1412,9 +1431,9 @@ and interp_letin ist llc u =
| [] ->
let ist = { ist with lfun } in
val_interp ist u
- | ((_, id), body) :: defs ->
+ | ((_, na), body) :: defs ->
Ftactic.bind (interp_tacarg ist body) (fun v ->
- fold (Id.Map.add id v lfun) defs)
+ fold (Name.fold_right (fun id -> Id.Map.add id v) na lfun) defs)
in
fold ist.lfun llc
@@ -1573,7 +1592,6 @@ and interp_ltac_constr ist e : EConstr.t Ftactic.t =
Ftactic.enter begin fun gl ->
let env = Proofview.Goal.env gl in
let sigma = project gl in
- let result = Value.normalize result in
try
let cresult = coerce_to_closed_constr env result in
Proofview.tclLIFT begin
diff --git a/plugins/ltac/tacsubst.ml b/plugins/ltac/tacsubst.ml
index 180fb2db4..79bf3685e 100644
--- a/plugins/ltac/tacsubst.ml
+++ b/plugins/ltac/tacsubst.ml
@@ -91,9 +91,10 @@ let subst_global_reference subst =
let subst_global ref =
let ref',t' = subst_global subst ref in
if not (is_global ref' t') then
- Feedback.msg_warning (strbrk "The reference " ++ pr_global ref ++ str " is not " ++
- str " expanded to \"" ++ pr_lconstr t' ++ str "\", but to " ++
- pr_global ref') ;
+ (let sigma, env = Pfedit.get_current_context () in
+ Feedback.msg_warning (strbrk "The reference " ++ pr_global ref ++ str " is not " ++
+ str " expanded to \"" ++ pr_lconstr_env env sigma t' ++ str "\", but to " ++
+ pr_global ref'));
ref'
in
subst_or_var (subst_located subst_global)
@@ -120,7 +121,7 @@ let subst_raw_may_eval subst = function
| ConstrTerm c -> ConstrTerm (subst_glob_constr subst c)
let subst_match_pattern subst = function
- | Subterm (b,ido,pc) -> Subterm (b,ido,(subst_glob_constr_or_pattern subst pc))
+ | Subterm (ido,pc) -> Subterm (ido,(subst_glob_constr_or_pattern subst pc))
| Term pc -> Term (subst_glob_constr_or_pattern subst pc)
let rec subst_match_goal_hyps subst = function
diff --git a/plugins/ltac/tactic_debug.ml b/plugins/ltac/tactic_debug.ml
index a669692fc..2dd7c9a74 100644
--- a/plugins/ltac/tactic_debug.ml
+++ b/plugins/ltac/tactic_debug.ml
@@ -20,7 +20,9 @@ let prmatchpatt env sigma hyp =
Pptactic.pr_match_pattern (Printer.pr_constr_pattern_env env sigma) hyp
let prmatchrl rl =
Pptactic.pr_match_rule false (Pptactic.pr_glob_tactic (Global.env()))
- (fun (_,p) -> Printer.pr_constr_pattern p) rl
+ (fun (_,p) ->
+ let sigma, env = Pfedit.get_current_context () in
+ Printer.pr_constr_pattern_env env sigma p) rl
(* This module intends to be a beginning of debugger for tactic expressions.
Currently, it is quite simple and we can hope to have, in the future, a more
@@ -369,7 +371,8 @@ let explain_ltac_call_trace last trace loc =
strbrk " (with " ++
prlist_with_sep pr_comma
(fun (id,c) ->
- Id.print id ++ str ":=" ++ Printer.pr_lconstr_under_binders c)
+ let sigma, env = Pfedit.get_current_context () in
+ Id.print id ++ str ":=" ++ Printer.pr_lconstr_under_binders_env env sigma c)
(List.rev (Id.Map.bindings vars)) ++ str ")"
else mt())
in
diff --git a/plugins/ltac/tactic_matching.ml b/plugins/ltac/tactic_matching.ml
index 89b78e590..e87951dd7 100644
--- a/plugins/ltac/tactic_matching.ml
+++ b/plugins/ltac/tactic_matching.ml
@@ -237,7 +237,7 @@ module PatternMatching (E:StaticEnvironment) = struct
return lhs
with Constr_matching.PatternMatchingFailure -> fail
end
- | Subterm (with_app_context,id_ctxt,p) ->
+ | Subterm (id_ctxt,p) ->
let rec map s (e, info) =
{ stream = fun k ctx -> match IStream.peek s with
@@ -252,7 +252,7 @@ module PatternMatching (E:StaticEnvironment) = struct
| Some nctx -> Proofview.tclOR (k lhs nctx) (fun e -> (map s e).stream k ctx)
}
in
- map (Constr_matching.match_subterm_gen E.env E.sigma with_app_context p term) imatching_error
+ map (Constr_matching.match_subterm E.env E.sigma p term) imatching_error
(** [rule_match_term term rule] matches the term [term] with the
diff --git a/plugins/micromega/MExtraction.v b/plugins/micromega/MExtraction.v
index e5b5854f0..362cc3a59 100644
--- a/plugins/micromega/MExtraction.v
+++ b/plugins/micromega/MExtraction.v
@@ -49,16 +49,13 @@ Extract Constant Rmult => "( * )".
Extract Constant Ropp => "fun x -> - x".
Extract Constant Rinv => "fun x -> 1 / x".
-(** We now extract to stdout, see comment in Makefile.build *)
-
-(*Extraction "plugins/micromega/micromega.ml" *)
-Recursive Extraction
- List.map simpl_cone (*map_cone indexes*)
- denorm Qpower vm_add
- n_of_Z N.of_nat ZTautoChecker ZWeakChecker QTautoChecker RTautoChecker find.
-
-
-
+(** In order to avoid annoying build dependencies the actual
+ extraction is only performed as a test in the test suite. *)
+(* Extraction "plugins/micromega/micromega.ml" *)
+(* Recursive Extraction *)
+(* List.map simpl_cone (*map_cone indexes*) *)
+(* denorm Qpower vm_add *)
+(* n_of_Z N.of_nat ZTautoChecker ZWeakChecker QTautoChecker RTautoChecker find. *)
(* Local Variables: *)
(* coding: utf-8 *)
diff --git a/plugins/micromega/coq_micromega.ml b/plugins/micromega/coq_micromega.ml
index fc6781b06..cb54cac3f 100644
--- a/plugins/micromega/coq_micromega.ml
+++ b/plugins/micromega/coq_micromega.ml
@@ -20,6 +20,7 @@ open Pp
open Mutils
open Goptions
open Names
+open Constr
(**
* Debug flag
@@ -580,9 +581,9 @@ struct
| Ukn
| BadStr of string
| BadNum of int
- | BadTerm of Term.constr
+ | BadTerm of constr
| Msg of string
- | Goal of (Term.constr list ) * Term.constr * parse_error
+ | Goal of (constr list ) * constr * parse_error
let string_of_error = function
| Ukn -> "ukn"
@@ -983,7 +984,9 @@ struct
let parse_expr sigma parse_constant parse_exp ops_spec env term =
if debug
- then Feedback.msg_debug (Pp.str "parse_expr: " ++ Printer.pr_leconstr term);
+ then (
+ let _, env = Pfedit.get_current_context () in
+ Feedback.msg_debug (Pp.str "parse_expr: " ++ Printer.pr_leconstr_env env sigma term));
(*
let constant_or_variable env term =
@@ -1102,9 +1105,10 @@ struct
| _ -> raise ParseError
- let rconstant sigma term =
+ let rconstant sigma term =
+ let _, env = Pfedit.get_current_context () in
if debug
- then Feedback.msg_debug (Pp.str "rconstant: " ++ Printer.pr_leconstr term ++ fnl ());
+ then Feedback.msg_debug (Pp.str "rconstant: " ++ Printer.pr_leconstr_env env sigma term ++ fnl ());
let res = rconstant sigma term in
if debug then
(Printf.printf "rconstant -> %a\n" pp_Rcst res ; flush stdout) ;
@@ -1144,9 +1148,9 @@ struct
let parse_arith parse_op parse_expr env cstr gl =
let sigma = gl.sigma in
- if debug
- then Feedback.msg_debug (Pp.str "parse_arith: " ++ Printer.pr_leconstr cstr ++ fnl ());
- match EConstr.kind sigma cstr with
+ if debug
+ then Feedback.msg_debug (Pp.str "parse_arith: " ++ Printer.pr_leconstr_env gl.env sigma cstr ++ fnl ());
+ match EConstr.kind sigma cstr with
| Term.App(op,args) ->
let (op,lhs,rhs) = parse_op gl (op,args) in
let (e1,env) = parse_expr sigma env lhs in
@@ -1521,7 +1525,7 @@ let rec witness prover l1 l2 =
let rec apply_ids t ids =
match ids with
| [] -> t
- | i::ids -> apply_ids (Term.mkApp(t,[| Term.mkVar i |])) ids
+ | i::ids -> apply_ids (mkApp(t,[| mkVar i |])) ids
let coq_Node =
lazy (gen_constant_in_modules "VarMap"
@@ -1907,7 +1911,7 @@ let micromega_tauto negate normalise unsat deduce spec prover env polys1 polys2
let formula_typ = (EConstr.mkApp(Lazy.force coq_Cstr, [|spec.coeff|])) in
let ff = dump_formula formula_typ
(dump_cstr spec.typ spec.dump_coeff) ff in
- Feedback.msg_notice (Printer.pr_leconstr ff);
+ Feedback.msg_notice (Printer.pr_leconstr_env gl.env gl.sigma ff);
Printf.fprintf stdout "cnf : %a\n" (pp_cnf (fun o _ -> ())) cnf_ff
end;
@@ -1931,9 +1935,9 @@ let micromega_tauto negate normalise unsat deduce spec prover env polys1 polys2
Feedback.msg_notice (Pp.str "\nAFormula\n") ;
let formula_typ = (EConstr.mkApp( Lazy.force coq_Cstr,[| spec.coeff|])) in
let ff' = dump_formula formula_typ
- (dump_cstr spec.typ spec.dump_coeff) ff' in
- Feedback.msg_notice (Printer.pr_leconstr ff');
- Printf.fprintf stdout "cnf : %a\n" (pp_cnf (fun o _ -> ())) cnf_ff'
+ (dump_cstr spec.typ spec.dump_coeff) ff' in
+ Feedback.msg_notice (Printer.pr_leconstr_env gl.env gl.sigma ff');
+ Printf.fprintf stdout "cnf : %a\n" (pp_cnf (fun o _ -> ())) cnf_ff'
end;
(* Even if it does not work, this does not mean it is not provable
diff --git a/plugins/micromega/micromega.ml b/plugins/micromega/micromega.ml
index 7da4a3b82..52c6ef983 100644
--- a/plugins/micromega/micromega.ml
+++ b/plugins/micromega/micromega.ml
@@ -981,8 +981,8 @@ let rec or_cnf unsat deduce f f' =
(** val and_cnf : 'a1 cnf -> 'a1 cnf -> 'a1 cnf **)
-let and_cnf f1 f2 =
- app f1 f2
+let and_cnf =
+ app
(** val xcnf :
('a2 -> bool) -> ('a2 -> 'a2 -> 'a2 option) -> ('a1 -> 'a2 cnf) -> ('a1
@@ -1204,22 +1204,22 @@ type 't formula = { flhs : 't pExpr; fop : op2; frhs : 't pExpr }
'a1 -> 'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1
-> 'a1) -> ('a1 -> 'a1) -> ('a1 -> 'a1 -> bool) -> 'a1 pExpr -> 'a1 pol **)
-let norm cO cI cplus ctimes cminus copp ceqb =
- norm_aux cO cI cplus ctimes cminus copp ceqb
+let norm =
+ norm_aux
(** val psub0 :
'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1) -> ('a1
-> 'a1 -> bool) -> 'a1 pol -> 'a1 pol -> 'a1 pol **)
-let psub0 cO cplus cminus copp ceqb =
- psub cO cplus cminus copp ceqb
+let psub0 =
+ psub
(** val padd0 :
'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> bool) -> 'a1 pol -> 'a1 pol
-> 'a1 pol **)
-let padd0 cO cplus ceqb =
- padd cO cplus ceqb
+let padd0 =
+ padd
(** val xnormalise :
'a1 -> 'a1 -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1 -> 'a1) -> ('a1 -> 'a1
diff --git a/plugins/micromega/persistent_cache.ml b/plugins/micromega/persistent_cache.ml
index 49ccb468c..387a52514 100644
--- a/plugins/micromega/persistent_cache.ml
+++ b/plugins/micromega/persistent_cache.ml
@@ -149,7 +149,7 @@ let open_in f =
match read_key_elem inch with
| None -> ()
| Some (key,elem) ->
- Table.add htbl key elem ;
+ Table.replace htbl key elem ;
xload () in
try
(* Locking of the (whole) file while reading *)
@@ -195,7 +195,7 @@ let add t k e =
else
let fd = descr_of_out_channel outch in
begin
- Table.add tbl k e ;
+ Table.replace tbl k e ;
do_under_lock Write fd
(fun _ ->
Marshal.to_channel outch (k,e) [Marshal.No_sharing] ;
diff --git a/plugins/nsatz/nsatz.ml b/plugins/nsatz/nsatz.ml
index 72934a15d..559dfab52 100644
--- a/plugins/nsatz/nsatz.ml
+++ b/plugins/nsatz/nsatz.ml
@@ -8,7 +8,7 @@
open CErrors
open Util
-open Term
+open Constr
open Tactics
open Coqlib
@@ -204,42 +204,42 @@ else
mkt_app ttpow [Lazy.force tz; mkt_term t1; mkt_n (num_of_int n)]
let rec parse_pos p =
- match kind_of_term p with
+ match Constr.kind p with
| App (a,[|p2|]) ->
- if eq_constr a (Lazy.force pxO) then num_2 */ (parse_pos p2)
+ if Constr.equal a (Lazy.force pxO) then num_2 */ (parse_pos p2)
else num_1 +/ (num_2 */ (parse_pos p2))
| _ -> num_1
let parse_z z =
- match kind_of_term z with
+ match Constr.kind z with
| App (a,[|p2|]) ->
- if eq_constr a (Lazy.force zpos) then parse_pos p2 else (num_0 -/ (parse_pos p2))
+ if Constr.equal a (Lazy.force zpos) then parse_pos p2 else (num_0 -/ (parse_pos p2))
| _ -> num_0
let parse_n z =
- match kind_of_term z with
+ match Constr.kind z with
| App (a,[|p2|]) ->
parse_pos p2
| _ -> num_0
let rec parse_term p =
- match kind_of_term p with
+ match Constr.kind p with
| App (a,[|_;p2|]) ->
- if eq_constr a (Lazy.force ttvar) then Var (string_of_num (parse_pos p2))
- else if eq_constr a (Lazy.force ttconst) then Const (parse_z p2)
- else if eq_constr a (Lazy.force ttopp) then Opp (parse_term p2)
+ if Constr.equal a (Lazy.force ttvar) then Var (string_of_num (parse_pos p2))
+ else if Constr.equal a (Lazy.force ttconst) then Const (parse_z p2)
+ else if Constr.equal a (Lazy.force ttopp) then Opp (parse_term p2)
else Zero
| App (a,[|_;p2;p3|]) ->
- if eq_constr a (Lazy.force ttadd) then Add (parse_term p2, parse_term p3)
- else if eq_constr a (Lazy.force ttsub) then Sub (parse_term p2, parse_term p3)
- else if eq_constr a (Lazy.force ttmul) then Mul (parse_term p2, parse_term p3)
- else if eq_constr a (Lazy.force ttpow) then
+ if Constr.equal a (Lazy.force ttadd) then Add (parse_term p2, parse_term p3)
+ else if Constr.equal a (Lazy.force ttsub) then Sub (parse_term p2, parse_term p3)
+ else if Constr.equal a (Lazy.force ttmul) then Mul (parse_term p2, parse_term p3)
+ else if Constr.equal a (Lazy.force ttpow) then
Pow (parse_term p2, int_of_num (parse_n p3))
else Zero
| _ -> Zero
let rec parse_request lp =
- match kind_of_term lp with
+ match Constr.kind lp with
| App (_,[|_|]) -> []
| App (_,[|_;p;lp1|]) ->
(parse_term p)::(parse_request lp1)
diff --git a/plugins/nsatz/nsatz.mli b/plugins/nsatz/nsatz.mli
index d6e3071aa..e50a12a50 100644
--- a/plugins/nsatz/nsatz.mli
+++ b/plugins/nsatz/nsatz.mli
@@ -6,4 +6,4 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-val nsatz_compute : Term.constr -> unit Proofview.tactic
+val nsatz_compute : Constr.t -> unit Proofview.tactic
diff --git a/plugins/omega/coq_omega.ml b/plugins/omega/coq_omega.ml
index ff69ddefb..4271c80cd 100644
--- a/plugins/omega/coq_omega.ml
+++ b/plugins/omega/coq_omega.ml
@@ -466,12 +466,14 @@ let destructurate_prop sigma t =
| Prod (Name _,_,_),[] -> CErrors.user_err Pp.(str "Omega: Not a quantifier-free goal")
| _ -> Kufo
-let destructurate_type sigma t =
- let eq_constr c1 c2 = eq_constr sigma c1 c2 in
- let c, args = decompose_app sigma t in
+let nf = Tacred.simpl
+
+let destructurate_type env sigma t =
+ let is_conv = Reductionops.is_conv env sigma in
+ let c, args = decompose_app sigma (nf env sigma t) in
match EConstr.kind sigma c, args with
- | _, [] when eq_constr c (Lazy.force coq_Z) -> Kapp (Z,args)
- | _, [] when eq_constr c (Lazy.force coq_nat) -> Kapp (Nat,args)
+ | _, [] when is_conv c (Lazy.force coq_Z) -> Kapp (Z,args)
+ | _, [] when is_conv c (Lazy.force coq_nat) -> Kapp (Nat,args)
| _ -> Kufo
let destructurate_term sigma t =
@@ -650,7 +652,7 @@ let decompile af =
(** Backward compat to emulate the old Refine: normalize the goal conclusion *)
let new_hole env sigma c =
- let c = Reductionops.nf_betaiota sigma c in
+ let c = Reductionops.nf_betaiota env sigma c in
Evarutil.new_evar env sigma c
let clever_rewrite_base_poly typ p result theorem =
@@ -1459,17 +1461,13 @@ let normalize_equation sigma id flag theorem pos t t1 t2 (tactic,defs) =
else
(tactic,defs)
-let pf_nf gl c = Tacmach.New.pf_apply Tacred.simpl gl c
-
-let destructure_omega gl tac_def (id,c) =
- let open Tacmach.New in
- let sigma = project gl in
+let destructure_omega env sigma tac_def (id,c) =
if String.equal (atompart_of_id id) "State" then
tac_def
else
try match destructurate_prop sigma c with
| Kapp(Eq,[typ;t1;t2])
- when begin match destructurate_type sigma (pf_nf gl typ) with Kapp(Z,[]) -> true | _ -> false end ->
+ when begin match destructurate_type env sigma typ with Kapp(Z,[]) -> true | _ -> false end ->
let t = mk_plus t1 (mk_inv t2) in
normalize_equation sigma
id EQUA (Lazy.force coq_Zegal_left) 2 t t1 t2 tac_def
@@ -1507,7 +1505,7 @@ let coq_omega =
Proofview.Goal.enter begin fun gl ->
clear_constr_tables ();
let hyps_types = Tacmach.New.pf_hyps_types gl in
- let destructure_omega = destructure_omega gl in
+ let destructure_omega = Tacmach.New.pf_apply destructure_omega gl in
let tactic_normalisation, system =
List.fold_left destructure_omega ([],[]) hyps_types in
let prelude,sys =
@@ -1727,27 +1725,26 @@ let not_binop = function
exception Undecidable
-let rec decidability gl t =
- let open Tacmach.New in
- match destructurate_prop (project gl) t with
+let rec decidability env sigma t =
+ match destructurate_prop sigma t with
| Kapp(Or,[t1;t2]) ->
mkApp (Lazy.force coq_dec_or, [| t1; t2;
- decidability gl t1; decidability gl t2 |])
+ decidability env sigma t1; decidability env sigma t2 |])
| Kapp(And,[t1;t2]) ->
mkApp (Lazy.force coq_dec_and, [| t1; t2;
- decidability gl t1; decidability gl t2 |])
+ decidability env sigma t1; decidability env sigma t2 |])
| Kapp(Iff,[t1;t2]) ->
mkApp (Lazy.force coq_dec_iff, [| t1; t2;
- decidability gl t1; decidability gl t2 |])
+ decidability env sigma t1; decidability env sigma t2 |])
| Kimp(t1,t2) ->
(* This is the only situation where it's not obvious that [t]
is in Prop. The recursive call on [t2] will ensure that. *)
mkApp (Lazy.force coq_dec_imp,
- [| t1; t2; decidability gl t1; decidability gl t2 |])
+ [| t1; t2; decidability env sigma t1; decidability env sigma t2 |])
| Kapp(Not,[t1]) ->
- mkApp (Lazy.force coq_dec_not, [| t1; decidability gl t1 |])
+ mkApp (Lazy.force coq_dec_not, [| t1; decidability env sigma t1 |])
| Kapp(Eq,[typ;t1;t2]) ->
- begin match destructurate_type (project gl) (pf_nf gl typ) with
+ begin match destructurate_type env sigma typ with
| Kapp(Z,[]) -> mkApp (Lazy.force coq_dec_eq, [| t1;t2 |])
| Kapp(Nat,[]) -> mkApp (Lazy.force coq_dec_eq_nat, [| t1;t2 |])
| _ -> raise Undecidable
@@ -1784,15 +1781,16 @@ let onClearedName2 id tac =
let destructure_hyps =
Proofview.Goal.enter begin fun gl ->
let type_of = Tacmach.New.pf_unsafe_type_of gl in
- let decidability = decidability gl in
- let pf_nf = pf_nf gl in
+ let env = Proofview.Goal.env gl in
+ let sigma = Proofview.Goal.sigma gl in
+ let decidability = decidability env sigma in
let rec loop = function
| [] -> (tclTHEN nat_inject coq_omega)
| LocalDef (i,body,typ) :: lit when !letin_flag ->
Proofview.tclEVARMAP >>= fun sigma ->
begin
try
- match destructurate_type sigma (pf_nf typ) with
+ match destructurate_type env sigma typ with
| Kapp(Nat,_) | Kapp(Z,_) ->
let hid = fresh_id Id.Set.empty (add_suffix i "_eqn") gl in
let hty = mk_gen_eq typ (mkVar i) body in
@@ -1895,7 +1893,7 @@ let destructure_hyps =
with Not_found -> loop lit)
| Kapp(Eq,[typ;t1;t2]) ->
if !old_style_flag then begin
- match destructurate_type sigma (pf_nf typ) with
+ match destructurate_type env sigma typ with
| Kapp(Nat,_) ->
tclTHENLIST [
(simplest_elim
@@ -1912,7 +1910,7 @@ let destructure_hyps =
]
| _ -> loop lit
end else begin
- match destructurate_type sigma (pf_nf typ) with
+ match destructurate_type env sigma typ with
| Kapp(Nat,_) ->
(tclTHEN
(convert_hyp_no_check (NamedDecl.set_type (mkApp (Lazy.force coq_neq, [| t1;t2|]))
@@ -1940,7 +1938,9 @@ let destructure_hyps =
let destructure_goal =
Proofview.Goal.enter begin fun gl ->
let concl = Proofview.Goal.concl gl in
- let decidability = decidability gl in
+ let env = Proofview.Goal.env gl in
+ let sigma = Proofview.Goal.sigma gl in
+ let decidability = decidability env sigma in
let rec loop t =
Proofview.tclEVARMAP >>= fun sigma ->
let prop () = Proofview.tclUNIT (destructurate_prop sigma t) in
diff --git a/plugins/quote/quote.ml b/plugins/quote/quote.ml
index e1e73b1c3..0ea8904f2 100644
--- a/plugins/quote/quote.ml
+++ b/plugins/quote/quote.ml
@@ -104,7 +104,7 @@
open CErrors
open Util
open Names
-open Term
+open Constr
open EConstr
open Pattern
open Patternops
@@ -166,11 +166,7 @@ exchange ?1 and ?2 in the example above)
*)
-module ConstrSet = Set.Make(
- struct
- type t = Term.constr
- let compare = Term.compare
- end)
+module ConstrSet = Set.Make(Constr)
type inversion_scheme = {
normal_lhs_rhs : (constr * constr_pattern) list;
@@ -385,11 +381,7 @@ let rec sort_subterm gl l =
| [] -> []
| h::t -> insert h (sort_subterm gl t)
-module Constrhash = Hashtbl.Make
- (struct type t = Term.constr
- let equal = Term.eq_constr
- let hash = Term.hash_constr
- end)
+module Constrhash = Hashtbl.Make(Constr)
let subst_meta subst c =
let subst = List.map (fun (i, c) -> i, EConstr.Unsafe.to_constr c) subst in
diff --git a/plugins/romega/const_omega.ml b/plugins/romega/const_omega.ml
index c27ac2ea4..0d491d92b 100644
--- a/plugins/romega/const_omega.ml
+++ b/plugins/romega/const_omega.ml
@@ -7,14 +7,15 @@
*************************************************************************)
open Names
+open Constr
let module_refl_name = "ReflOmegaCore"
let module_refl_path = ["Coq"; "romega"; module_refl_name]
type result =
| Kvar of string
- | Kapp of string * Term.constr list
- | Kimp of Term.constr * Term.constr
+ | Kapp of string * constr list
+ | Kimp of constr * constr
| Kufo
let meaningful_submodule = [ "Z"; "N"; "Pos" ]
@@ -30,27 +31,27 @@ let string_of_global r =
prefix^(Names.Id.to_string (Nametab.basename_of_global r))
let destructurate t =
- let c, args = Term.decompose_app t in
- match Term.kind_of_term c, args with
- | Term.Const (sp,_), args ->
+ let c, args = decompose_app t in
+ match Constr.kind c, args with
+ | Const (sp,_), args ->
Kapp (string_of_global (Globnames.ConstRef sp), args)
- | Term.Construct (csp,_) , args ->
+ | Construct (csp,_) , args ->
Kapp (string_of_global (Globnames.ConstructRef csp), args)
- | Term.Ind (isp,_), args ->
+ | Ind (isp,_), args ->
Kapp (string_of_global (Globnames.IndRef isp), args)
- | Term.Var id, [] -> Kvar(Names.Id.to_string id)
- | Term.Prod (Anonymous,typ,body), [] -> Kimp(typ,body)
+ | Var id, [] -> Kvar(Names.Id.to_string id)
+ | Prod (Anonymous,typ,body), [] -> Kimp(typ,body)
| _ -> Kufo
exception DestConstApp
let dest_const_apply t =
- let f,args = Term.decompose_app t in
+ let f,args = decompose_app t in
let ref =
- match Term.kind_of_term f with
- | Term.Const (sp,_) -> Globnames.ConstRef sp
- | Term.Construct (csp,_) -> Globnames.ConstructRef csp
- | Term.Ind (isp,_) -> Globnames.IndRef isp
+ match Constr.kind f with
+ | Const (sp,_) -> Globnames.ConstRef sp
+ | Construct (csp,_) -> Globnames.ConstructRef csp
+ | Ind (isp,_) -> Globnames.IndRef isp
| _ -> raise DestConstApp
in Nametab.basename_of_global ref, args
@@ -129,7 +130,7 @@ let coq_O = lazy(init_constant "O")
let rec mk_nat = function
| 0 -> Lazy.force coq_O
- | n -> Term.mkApp (Lazy.force coq_S, [| mk_nat (n-1) |])
+ | n -> mkApp (Lazy.force coq_S, [| mk_nat (n-1) |])
(* Lists *)
@@ -141,47 +142,47 @@ let mkListConst c =
if Global.is_polymorphic r then fun u -> Univ.Instance.of_array [|u|]
else fun _ -> Univ.Instance.empty
in
- fun u -> Term.mkConstructU (Globnames.destConstructRef r, inst u)
+ fun u -> mkConstructU (Globnames.destConstructRef r, inst u)
-let coq_cons univ typ = Term.mkApp (mkListConst "cons" univ, [|typ|])
-let coq_nil univ typ = Term.mkApp (mkListConst "nil" univ, [|typ|])
+let coq_cons univ typ = mkApp (mkListConst "cons" univ, [|typ|])
+let coq_nil univ typ = mkApp (mkListConst "nil" univ, [|typ|])
let mk_list univ typ l =
let rec loop = function
| [] -> coq_nil univ typ
| (step :: l) ->
- Term.mkApp (coq_cons univ typ, [| step; loop l |]) in
+ mkApp (coq_cons univ typ, [| step; loop l |]) in
loop l
let mk_plist =
- let type1lev = Universes.new_univ_level (Global.current_dirpath ()) in
- fun l -> mk_list type1lev Term.mkProp l
+ let type1lev = Universes.new_univ_level () in
+ fun l -> mk_list type1lev mkProp l
let mk_list = mk_list Univ.Level.set
type parse_term =
- | Tplus of Term.constr * Term.constr
- | Tmult of Term.constr * Term.constr
- | Tminus of Term.constr * Term.constr
- | Topp of Term.constr
- | Tsucc of Term.constr
+ | Tplus of constr * constr
+ | Tmult of constr * constr
+ | Tminus of constr * constr
+ | Topp of constr
+ | Tsucc of constr
| Tnum of Bigint.bigint
| Tother
type parse_rel =
- | Req of Term.constr * Term.constr
- | Rne of Term.constr * Term.constr
- | Rlt of Term.constr * Term.constr
- | Rle of Term.constr * Term.constr
- | Rgt of Term.constr * Term.constr
- | Rge of Term.constr * Term.constr
+ | Req of constr * constr
+ | Rne of constr * constr
+ | Rlt of constr * constr
+ | Rle of constr * constr
+ | Rgt of constr * constr
+ | Rge of constr * constr
| Rtrue
| Rfalse
- | Rnot of Term.constr
- | Ror of Term.constr * Term.constr
- | Rand of Term.constr * Term.constr
- | Rimp of Term.constr * Term.constr
- | Riff of Term.constr * Term.constr
+ | Rnot of constr
+ | Ror of constr * constr
+ | Rand of constr * constr
+ | Rimp of constr * constr
+ | Riff of constr * constr
| Rother
let parse_logic_rel c = match destructurate c with
@@ -196,6 +197,7 @@ let parse_logic_rel c = match destructurate c with
(* Binary numbers *)
+let coq_Z = lazy (bin_constant "Z")
let coq_xH = lazy (bin_constant "xH")
let coq_xO = lazy (bin_constant "xO")
let coq_xI = lazy (bin_constant "xI")
@@ -209,34 +211,34 @@ let rec mk_positive n =
if Bigint.equal n Bigint.one then Lazy.force coq_xH
else
let (q,r) = Bigint.euclid n Bigint.two in
- Term.mkApp
+ mkApp
((if Bigint.equal r Bigint.zero
then Lazy.force coq_xO else Lazy.force coq_xI),
[| mk_positive q |])
let mk_N = function
| 0 -> Lazy.force coq_N0
- | n -> Term.mkApp (Lazy.force coq_Npos,
+ | n -> mkApp (Lazy.force coq_Npos,
[| mk_positive (Bigint.of_int n) |])
module type Int = sig
- val typ : Term.constr Lazy.t
- val is_int_typ : [ `NF ] Proofview.Goal.t -> Term.constr -> bool
- val plus : Term.constr Lazy.t
- val mult : Term.constr Lazy.t
- val opp : Term.constr Lazy.t
- val minus : Term.constr Lazy.t
-
- val mk : Bigint.bigint -> Term.constr
- val parse_term : Term.constr -> parse_term
- val parse_rel : [ `NF ] Proofview.Goal.t -> Term.constr -> parse_rel
+ val typ : constr Lazy.t
+ val is_int_typ : [ `NF ] Proofview.Goal.t -> constr -> bool
+ val plus : constr Lazy.t
+ val mult : constr Lazy.t
+ val opp : constr Lazy.t
+ val minus : constr Lazy.t
+
+ val mk : Bigint.bigint -> constr
+ val parse_term : constr -> parse_term
+ val parse_rel : [ `NF ] Proofview.Goal.t -> constr -> parse_rel
(* check whether t is built only with numbers and + * - *)
- val get_scalar : Term.constr -> Bigint.bigint option
+ val get_scalar : constr -> Bigint.bigint option
end
module Z : Int = struct
-let typ = lazy (bin_constant "Z")
+let typ = coq_Z
let plus = lazy (z_constant "Z.add")
let mult = lazy (z_constant "Z.mul")
let opp = lazy (z_constant "Z.opp")
@@ -266,9 +268,9 @@ let recognize_Z t =
let mk_Z n =
if Bigint.equal n Bigint.zero then Lazy.force coq_Z0
else if Bigint.is_strictly_pos n then
- Term.mkApp (Lazy.force coq_Zpos, [| mk_positive n |])
+ mkApp (Lazy.force coq_Zpos, [| mk_positive n |])
else
- Term.mkApp (Lazy.force coq_Zneg, [| mk_positive (Bigint.neg n) |])
+ mkApp (Lazy.force coq_Zneg, [| mk_positive (Bigint.neg n) |])
let mk = mk_Z
@@ -284,14 +286,9 @@ let parse_term t =
(match recognize_Z t with Some t -> Tnum t | None -> Tother)
| _ -> Tother
-let pf_nf gl c =
- EConstr.Unsafe.to_constr
- (Tacmach.New.pf_apply Tacred.simpl gl (EConstr.of_constr c))
-
let is_int_typ gl t =
- match destructurate (pf_nf gl t) with
- | Kapp("Z",[]) -> true
- | _ -> false
+ Tacmach.New.pf_apply Reductionops.is_conv gl
+ (EConstr.of_constr t) (EConstr.of_constr (Lazy.force coq_Z))
let parse_rel gl t =
match destructurate t with
diff --git a/plugins/romega/const_omega.mli b/plugins/romega/const_omega.mli
index 80e00e4e1..5ba063d9d 100644
--- a/plugins/romega/const_omega.mli
+++ b/plugins/romega/const_omega.mli
@@ -8,116 +8,117 @@
(** Coq objects used in romega *)
+open Constr
(* from Logic *)
-val coq_refl_equal : Term.constr lazy_t
-val coq_and : Term.constr lazy_t
-val coq_not : Term.constr lazy_t
-val coq_or : Term.constr lazy_t
-val coq_True : Term.constr lazy_t
-val coq_False : Term.constr lazy_t
-val coq_I : Term.constr lazy_t
+val coq_refl_equal : constr lazy_t
+val coq_and : constr lazy_t
+val coq_not : constr lazy_t
+val coq_or : constr lazy_t
+val coq_True : constr lazy_t
+val coq_False : constr lazy_t
+val coq_I : constr lazy_t
(* from ReflOmegaCore/ZOmega *)
-val coq_t_int : Term.constr lazy_t
-val coq_t_plus : Term.constr lazy_t
-val coq_t_mult : Term.constr lazy_t
-val coq_t_opp : Term.constr lazy_t
-val coq_t_minus : Term.constr lazy_t
-val coq_t_var : Term.constr lazy_t
-
-val coq_proposition : Term.constr lazy_t
-val coq_p_eq : Term.constr lazy_t
-val coq_p_leq : Term.constr lazy_t
-val coq_p_geq : Term.constr lazy_t
-val coq_p_lt : Term.constr lazy_t
-val coq_p_gt : Term.constr lazy_t
-val coq_p_neq : Term.constr lazy_t
-val coq_p_true : Term.constr lazy_t
-val coq_p_false : Term.constr lazy_t
-val coq_p_not : Term.constr lazy_t
-val coq_p_or : Term.constr lazy_t
-val coq_p_and : Term.constr lazy_t
-val coq_p_imp : Term.constr lazy_t
-val coq_p_prop : Term.constr lazy_t
-
-val coq_s_bad_constant : Term.constr lazy_t
-val coq_s_divide : Term.constr lazy_t
-val coq_s_not_exact_divide : Term.constr lazy_t
-val coq_s_sum : Term.constr lazy_t
-val coq_s_merge_eq : Term.constr lazy_t
-val coq_s_split_ineq : Term.constr lazy_t
-
-val coq_direction : Term.constr lazy_t
-val coq_d_left : Term.constr lazy_t
-val coq_d_right : Term.constr lazy_t
-
-val coq_e_split : Term.constr lazy_t
-val coq_e_extract : Term.constr lazy_t
-val coq_e_solve : Term.constr lazy_t
-
-val coq_interp_sequent : Term.constr lazy_t
-val coq_do_omega : Term.constr lazy_t
-
-val mk_nat : int -> Term.constr
-val mk_N : int -> Term.constr
+val coq_t_int : constr lazy_t
+val coq_t_plus : constr lazy_t
+val coq_t_mult : constr lazy_t
+val coq_t_opp : constr lazy_t
+val coq_t_minus : constr lazy_t
+val coq_t_var : constr lazy_t
+
+val coq_proposition : constr lazy_t
+val coq_p_eq : constr lazy_t
+val coq_p_leq : constr lazy_t
+val coq_p_geq : constr lazy_t
+val coq_p_lt : constr lazy_t
+val coq_p_gt : constr lazy_t
+val coq_p_neq : constr lazy_t
+val coq_p_true : constr lazy_t
+val coq_p_false : constr lazy_t
+val coq_p_not : constr lazy_t
+val coq_p_or : constr lazy_t
+val coq_p_and : constr lazy_t
+val coq_p_imp : constr lazy_t
+val coq_p_prop : constr lazy_t
+
+val coq_s_bad_constant : constr lazy_t
+val coq_s_divide : constr lazy_t
+val coq_s_not_exact_divide : constr lazy_t
+val coq_s_sum : constr lazy_t
+val coq_s_merge_eq : constr lazy_t
+val coq_s_split_ineq : constr lazy_t
+
+val coq_direction : constr lazy_t
+val coq_d_left : constr lazy_t
+val coq_d_right : constr lazy_t
+
+val coq_e_split : constr lazy_t
+val coq_e_extract : constr lazy_t
+val coq_e_solve : constr lazy_t
+
+val coq_interp_sequent : constr lazy_t
+val coq_do_omega : constr lazy_t
+
+val mk_nat : int -> constr
+val mk_N : int -> constr
(** Precondition: the type of the list is in Set *)
-val mk_list : Term.constr -> Term.constr list -> Term.constr
-val mk_plist : Term.types list -> Term.types
+val mk_list : constr -> constr list -> constr
+val mk_plist : types list -> types
(** Analyzing a coq term *)
(* The generic result shape of the analysis of a term.
One-level depth, except when a number is found *)
type parse_term =
- Tplus of Term.constr * Term.constr
- | Tmult of Term.constr * Term.constr
- | Tminus of Term.constr * Term.constr
- | Topp of Term.constr
- | Tsucc of Term.constr
+ Tplus of constr * constr
+ | Tmult of constr * constr
+ | Tminus of constr * constr
+ | Topp of constr
+ | Tsucc of constr
| Tnum of Bigint.bigint
| Tother
(* The generic result shape of the analysis of a relation.
One-level depth. *)
type parse_rel =
- Req of Term.constr * Term.constr
- | Rne of Term.constr * Term.constr
- | Rlt of Term.constr * Term.constr
- | Rle of Term.constr * Term.constr
- | Rgt of Term.constr * Term.constr
- | Rge of Term.constr * Term.constr
+ Req of constr * constr
+ | Rne of constr * constr
+ | Rlt of constr * constr
+ | Rle of constr * constr
+ | Rgt of constr * constr
+ | Rge of constr * constr
| Rtrue
| Rfalse
- | Rnot of Term.constr
- | Ror of Term.constr * Term.constr
- | Rand of Term.constr * Term.constr
- | Rimp of Term.constr * Term.constr
- | Riff of Term.constr * Term.constr
+ | Rnot of constr
+ | Ror of constr * constr
+ | Rand of constr * constr
+ | Rimp of constr * constr
+ | Riff of constr * constr
| Rother
(* A module factorizing what we should now about the number representation *)
module type Int =
sig
(* the coq type of the numbers *)
- val typ : Term.constr Lazy.t
+ val typ : constr Lazy.t
(* Is a constr expands to the type of these numbers *)
- val is_int_typ : [ `NF ] Proofview.Goal.t -> Term.constr -> bool
+ val is_int_typ : [ `NF ] Proofview.Goal.t -> constr -> bool
(* the operations on the numbers *)
- val plus : Term.constr Lazy.t
- val mult : Term.constr Lazy.t
- val opp : Term.constr Lazy.t
- val minus : Term.constr Lazy.t
+ val plus : constr Lazy.t
+ val mult : constr Lazy.t
+ val opp : constr Lazy.t
+ val minus : constr Lazy.t
(* building a coq number *)
- val mk : Bigint.bigint -> Term.constr
+ val mk : Bigint.bigint -> constr
(* parsing a term (one level, except if a number is found) *)
- val parse_term : Term.constr -> parse_term
+ val parse_term : constr -> parse_term
(* parsing a relation expression, including = < <= >= > *)
- val parse_rel : [ `NF ] Proofview.Goal.t -> Term.constr -> parse_rel
+ val parse_rel : [ `NF ] Proofview.Goal.t -> constr -> parse_rel
(* Is a particular term only made of numbers and + * - ? *)
- val get_scalar : Term.constr -> Bigint.bigint option
+ val get_scalar : constr -> Bigint.bigint option
end
(* Currently, we only use Z numbers *)
diff --git a/plugins/romega/refl_omega.ml b/plugins/romega/refl_omega.ml
index 661485aee..54ff44fbd 100644
--- a/plugins/romega/refl_omega.ml
+++ b/plugins/romega/refl_omega.ml
@@ -8,6 +8,7 @@
open Pp
open Util
+open Constr
open Const_omega
module OmegaSolver = Omega_plugin.Omega.MakeOmegaSolver (Bigint)
open OmegaSolver
@@ -27,8 +28,6 @@ let pp i = print_int i; print_newline (); flush stdout
(* More readable than the prefix notation *)
let (>>) = Tacticals.New.tclTHEN
-let mkApp = Term.mkApp
-
(* \section{Types}
\subsection{How to walk in a term}
To represent how to get to a proposition. Only choice points are
@@ -68,14 +67,14 @@ type comparaison = Eq | Leq | Geq | Gt | Lt | Neq
(it could contains some [Term.Var] but no [Term.Rel]). So no need to
lift when breaking or creating arrows. *)
type oproposition =
- Pequa of Term.constr * oequation (* constr = copy of the Coq formula *)
+ Pequa of constr * oequation (* constr = copy of the Coq formula *)
| Ptrue
| Pfalse
| Pnot of oproposition
| Por of int * oproposition * oproposition
| Pand of int * oproposition * oproposition
| Pimp of int * oproposition * oproposition
- | Pprop of Term.constr
+ | Pprop of constr
(* The equations *)
and oequation = {
@@ -102,9 +101,9 @@ and oequation = {
type environment = {
(* La liste des termes non reifies constituant l'environnement global *)
- mutable terms : Term.constr list;
+ mutable terms : constr list;
(* La meme chose pour les propositions *)
- mutable props : Term.constr list;
+ mutable props : constr list;
(* Traduction des indices utilisés ici en les indices finaux utilisés par
* la tactique Omega après dénombrement des variables utiles *)
real_indices : int IntHtbl.t;
@@ -184,8 +183,9 @@ let print_env_reification env =
let rec loop c i = function
[] -> str " ===============================\n\n"
| t :: l ->
+ let sigma, env = Pfedit.get_current_context () in
let s = Printf.sprintf "(%c%02d)" c i in
- spc () ++ str s ++ str " := " ++ Printer.pr_lconstr t ++ fnl () ++
+ spc () ++ str s ++ str " := " ++ Printer.pr_lconstr_env env sigma t ++ fnl () ++
loop c (succ i) l
in
let prop_info = str "ENVIRONMENT OF PROPOSITIONS :" ++ fnl () ++ loop 'P' 0 env.props in
@@ -219,7 +219,7 @@ let display_omega_var i = Printf.sprintf "OV%d" i
calcul des variables utiles. *)
let add_reified_atom t env =
- try List.index0 Term.eq_constr t env.terms
+ try List.index0 Constr.equal t env.terms
with Not_found ->
let i = List.length env.terms in
env.terms <- env.terms @ [t]; i
@@ -237,7 +237,7 @@ let set_reified_atom v t env =
(* \subsection{Gestion de l'environnement de proposition pour Omega} *)
(* ajout d'une proposition *)
let add_prop env t =
- try List.index0 Term.eq_constr t env.props
+ try List.index0 Constr.equal t env.props
with Not_found ->
let i = List.length env.props in env.props <- env.props @ [t]; i
@@ -560,7 +560,7 @@ let reify_hyp env gl i =
| LocalDef (_,d,t) when Z.is_int_typ gl (EConstr.Unsafe.to_constr t) ->
let d = EConstr.Unsafe.to_constr d in
let dummy = Lazy.force coq_True in
- let p = mk_equation env ctxt dummy Eq (Term.mkVar i) d in
+ let p = mk_equation env ctxt dummy Eq (mkVar i) d in
i,Defined,p
| LocalDef (_,_,t) | LocalAssum (_,t) ->
let t = EConstr.Unsafe.to_constr t in
@@ -1012,7 +1012,7 @@ let resolution unsafe env (reified_concl,reified_hyps) systems_list =
(fun id ->
match Id.Map.find id reified_hyps with
| Defined,p ->
- reified_of_proposition env p, mk_refl (Term.mkVar id)
+ reified_of_proposition env p, mk_refl (mkVar id)
| Assumed,p ->
reified_of_proposition env (maximize_prop useful_equa_ids p),
EConstr.mkVar id
diff --git a/plugins/rtauto/refl_tauto.ml b/plugins/rtauto/refl_tauto.ml
index 9f02388c3..150c253a7 100644
--- a/plugins/rtauto/refl_tauto.ml
+++ b/plugins/rtauto/refl_tauto.ml
@@ -13,6 +13,7 @@ open Ltac_plugin
open CErrors
open Util
open Term
+open Constr
open Tacmach
open Proof_search
open Context.Named.Declaration
@@ -82,7 +83,7 @@ let make_atom atom_env term=
let term = EConstr.Unsafe.to_constr term in
try
let (_,i)=
- List.find (fun (t,_)-> eq_constr term t) atom_env.env
+ List.find (fun (t,_)-> Constr.equal term t) atom_env.env
in Atom i
with Not_found ->
let i=atom_env.next in
diff --git a/plugins/rtauto/refl_tauto.mli b/plugins/rtauto/refl_tauto.mli
index bec18f6df..b2285a4a1 100644
--- a/plugins/rtauto/refl_tauto.mli
+++ b/plugins/rtauto/refl_tauto.mli
@@ -10,7 +10,7 @@
type atom_env=
{mutable next:int;
- mutable env:(Term.constr*int) list}
+ mutable env:(Constr.t*int) list}
val make_form : atom_env ->
Goal.goal Evd.sigma -> EConstr.types -> Proof_search.form
diff --git a/plugins/setoid_ring/ArithRing.v b/plugins/setoid_ring/ArithRing.v
index 447acb905..8e4d8b0d3 100644
--- a/plugins/setoid_ring/ArithRing.v
+++ b/plugins/setoid_ring/ArithRing.v
@@ -41,9 +41,12 @@ Ltac Ss_to_add f acc :=
| _ => constr:((acc + f)%nat)
end.
+(* For internal use only *)
+Local Definition protected_to_nat := N.to_nat.
+
Ltac natprering :=
match goal with
- |- context C [S ?p] =>
+ |- context C [S ?p] =>
match p with
O => fail 1 (* avoid replacing 1 with 1+0 ! *)
| p => match isnatcst p with
@@ -52,9 +55,19 @@ Ltac natprering :=
fold v; natprering
end
end
- | _ => idtac
+ | _ => change N.to_nat with protected_to_nat
+ end.
+
+Ltac natpostring :=
+ match goal with
+ | |- context [N.to_nat ?x] =>
+ let v := eval cbv in (N.to_nat x) in
+ change (N.to_nat x) with v;
+ natpostring
+ | _ => change protected_to_nat with N.to_nat
end.
Add Ring natr : natSRth
- (morphism nat_morph_N, constants [natcst], preprocess [natprering]).
+ (morphism nat_morph_N, constants [natcst],
+ preprocess [natprering], postprocess [natpostring]).
diff --git a/plugins/setoid_ring/g_newring.ml4 b/plugins/setoid_ring/g_newring.ml4
index 05ab8ab32..a7d6d5bb2 100644
--- a/plugins/setoid_ring/g_newring.ml4
+++ b/plugins/setoid_ring/g_newring.ml4
@@ -82,10 +82,11 @@ VERNAC COMMAND EXTEND AddSetoidRing CLASSIFIED AS SIDEFF
| [ "Print" "Rings" ] => [Vernac_classifier.classify_as_query] -> [
Feedback.msg_notice (strbrk "The following ring structures have been declared:");
Spmap.iter (fun fn fi ->
+ let sigma, env = Pfedit.get_current_context () in
Feedback.msg_notice (hov 2
(Ppconstr.pr_id (Libnames.basename fn)++spc()++
- str"with carrier "++ pr_constr fi.ring_carrier++spc()++
- str"and equivalence relation "++ pr_constr fi.ring_req))
+ str"with carrier "++ pr_constr_env env sigma fi.ring_carrier++spc()++
+ str"and equivalence relation "++ pr_constr_env env sigma fi.ring_req))
) !from_name ]
END
@@ -117,10 +118,11 @@ VERNAC COMMAND EXTEND AddSetoidField CLASSIFIED AS SIDEFF
| [ "Print" "Fields" ] => [Vernac_classifier.classify_as_query] -> [
Feedback.msg_notice (strbrk "The following field structures have been declared:");
Spmap.iter (fun fn fi ->
+ let sigma, env = Pfedit.get_current_context () in
Feedback.msg_notice (hov 2
(Ppconstr.pr_id (Libnames.basename fn)++spc()++
- str"with carrier "++ pr_constr fi.field_carrier++spc()++
- str"and equivalence relation "++ pr_constr fi.field_req))
+ str"with carrier "++ pr_constr_env env sigma fi.field_carrier++spc()++
+ str"and equivalence relation "++ pr_constr_env env sigma fi.field_req))
) !field_from_name ]
END
diff --git a/plugins/setoid_ring/newring.ml b/plugins/setoid_ring/newring.ml
index b8fae2494..e3e749b75 100644
--- a/plugins/setoid_ring/newring.ml
+++ b/plugins/setoid_ring/newring.ml
@@ -10,7 +10,7 @@ open Ltac_plugin
open Pp
open Util
open Names
-open Term
+open Constr
open EConstr
open Vars
open CClosure
@@ -58,13 +58,13 @@ let rec mk_clos_but f_map subs t =
match f_map (global_of_constr_nofail t) with
| Some map -> tag_arg (mk_clos_but f_map subs) map subs (-1) t
| None ->
- (match kind_of_term t with
+ (match Constr.kind t with
App(f,args) -> mk_clos_app_but f_map subs f args 0
| Prod _ -> mk_clos_deep (mk_clos_but f_map) subs t
| _ -> mk_atom t)
and mk_clos_app_but f_map subs f args n =
- let open Term in
+ let open Constr in
if n >= Array.length args then mk_atom(mkApp(f, args))
else
let fargs, args' = Array.chop n args in
@@ -150,13 +150,14 @@ let ic_unsafe c = (*FIXME remove *)
let sigma = Evd.from_env env in
EConstr.of_constr (fst (Constrintern.interp_constr env sigma c))
-let decl_constant na ctx c =
- let open Term in
- let vars = Univops.universes_of_constr c in
- let ctx = Univops.restrict_universe_context (Univ.ContextSet.of_context ctx) vars in
+let decl_constant na univs c =
+ let open Constr in
+ let env = Global.env () in
+ let vars = Univops.universes_of_constr env c in
+ let univs = Univops.restrict_universe_context univs vars in
+ let univs = Monomorphic_const_entry univs in
mkConst(declare_constant (Id.of_string na)
- (DefinitionEntry (definition_entry ~opaque:true
- ~univs:(Univ.ContextSet.to_context ctx) c),
+ (DefinitionEntry (definition_entry ~opaque:true ~univs c),
IsProof Lemma))
(* Calling a global tactic *)
@@ -220,7 +221,7 @@ let exec_tactic env evd n f args =
let gls = Proofview.V82.of_tactic (Tacinterp.eval_tactic_ist ist (ltac_call f (args@[getter]))) gl in
let evd, nf = Evarutil.nf_evars_and_universes (Refiner.project gls) in
let nf c = nf (constr_of c) in
- Array.map nf !tactic_res, snd (Evd.universe_context ~names:[] ~extensible:true evd)
+ Array.map nf !tactic_res, Evd.universe_context_set evd
let stdlib_modules =
[["Coq";"Setoids";"Setoid"];
@@ -344,13 +345,7 @@ let _ = add_map "ring"
(****************************************************************************)
(* Ring database *)
-let pr_constr c = pr_econstr c
-
-module M = struct
- type t = Term.constr
- let compare = Term.compare
-end
-module Cmap = Map.Make(M)
+module Cmap = Map.Make(Constr)
let from_carrier = Summary.ref Cmap.empty ~name:"ring-tac-carrier-table"
let from_name = Summary.ref Spmap.empty ~name:"ring-tac-name-table"
@@ -372,7 +367,7 @@ let find_ring_structure env sigma l =
with Not_found ->
CErrors.user_err ~hdr:"ring"
(str"cannot find a declared ring structure over"++
- spc()++str"\""++pr_constr ty++str"\""))
+ spc() ++ str"\"" ++ pr_econstr_env env sigma ty ++ str"\""))
| [] -> assert false
let add_entry (sp,_kn) e =
@@ -395,7 +390,7 @@ let subst_th (subst,th) =
let posttac'= Tacsubst.subst_tactic subst th.ring_post_tac in
if c' == th.ring_carrier &&
eq' == th.ring_req &&
- Term.eq_constr set' th.ring_setoid &&
+ Constr.equal set' th.ring_setoid &&
ext' == th.ring_ext &&
morph' == th.ring_morph &&
th' == th.ring_th &&
@@ -533,19 +528,19 @@ let ring_equality env evd (r,add,mul,opp,req) =
op_morph r add mul opp req add_m_lem mul_m_lem opp_m_lem in
Flags.if_verbose
Feedback.msg_info
- (str"Using setoid \""++pr_constr req++str"\""++spc()++
- str"and morphisms \""++pr_constr add_m_lem ++
- str"\","++spc()++ str"\""++pr_constr mul_m_lem++
- str"\""++spc()++str"and \""++pr_constr opp_m_lem++
+ (str"Using setoid \""++ pr_econstr_env env !evd req++str"\""++spc()++
+ str"and morphisms \""++pr_econstr_env env !evd add_m_lem ++
+ str"\","++spc()++ str"\""++pr_econstr_env env !evd mul_m_lem++
+ str"\""++spc()++str"and \""++pr_econstr_env env !evd opp_m_lem++
str"\"");
op_morph)
| None ->
(Flags.if_verbose
Feedback.msg_info
- (str"Using setoid \""++pr_constr req ++str"\"" ++ spc() ++
- str"and morphisms \""++pr_constr add_m_lem ++
+ (str"Using setoid \""++pr_econstr_env env !evd req ++str"\"" ++ spc() ++
+ str"and morphisms \""++pr_econstr_env env !evd add_m_lem ++
str"\""++spc()++str"and \""++
- pr_constr mul_m_lem++str"\"");
+ pr_econstr_env env !evd mul_m_lem++str"\"");
op_smorph r add mul req add_m_lem mul_m_lem) in
(setoid,op_morph)
@@ -865,7 +860,7 @@ let find_field_structure env sigma l =
with Not_found ->
CErrors.user_err ~hdr:"field"
(str"cannot find a declared field structure over"++
- spc()++str"\""++pr_constr ty++str"\""))
+ spc()++str"\""++pr_econstr_env env sigma ty++str"\""))
| [] -> assert false
let add_field_entry (sp,_kn) e =
@@ -933,7 +928,7 @@ let field_equality evd r inv req =
inv_m_lem
let add_field_theory0 name fth eqth morphth cst_tac inj (pre,post) power sign odiv =
- let open Term in
+ let open Constr in
check_required_library (cdir@["Field_tac"]);
let (sigma,fth) = ic fth in
let env = Global.env() in
diff --git a/plugins/setoid_ring/newring_ast.mli b/plugins/setoid_ring/newring_ast.mli
index d37582bd7..c26fcc8d1 100644
--- a/plugins/setoid_ring/newring_ast.mli
+++ b/plugins/setoid_ring/newring_ast.mli
@@ -6,7 +6,7 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-open Term
+open Constr
open Libnames
open Constrexpr
open Tacexpr
diff --git a/plugins/ssr/ssrcommon.ml b/plugins/ssr/ssrcommon.ml
index 1f2d02093..7cdf05117 100644
--- a/plugins/ssr/ssrcommon.ml
+++ b/plugins/ssr/ssrcommon.ml
@@ -12,6 +12,7 @@ open Util
open Names
open Evd
open Term
+open Constr
open Termops
open Printer
open Locusops
@@ -239,7 +240,7 @@ let interp_refine ist gl rc =
in
let sigma, c = Pretyping.understand_ltac flags (pf_env gl) (project gl) vars kind rc in
(* ppdebug(lazy(str"sigma@interp_refine=" ++ pr_evar_map None sigma)); *)
- ppdebug(lazy(str"c@interp_refine=" ++ Printer.pr_econstr c));
+ ppdebug(lazy(str"c@interp_refine=" ++ Printer.pr_econstr_env (pf_env gl) sigma c));
(sigma, (sigma, c))
@@ -465,7 +466,6 @@ let ssrevaltac ist gtac =
(* but stripping global ones. We use the variable names to encode the *)
(* the number of dependencies, so that the transformation is reversible. *)
-open Term
let env_size env = List.length (Environ.named_context env)
let pf_concl gl = EConstr.Unsafe.to_constr (pf_concl gl)
@@ -491,23 +491,23 @@ let pf_abs_evars2 gl rigid (sigma, c0) =
| NamedDecl.LocalAssum (x,t) -> mkNamedProd x t c in
let t = Context.Named.fold_inside abs_dc ~init:evi.evar_concl dc in
nf_evar sigma t in
- let rec put evlist c = match kind_of_term c with
+ let rec put evlist c = match Constr.kind c with
| Evar (k, a) ->
if List.mem_assoc k evlist || Evd.mem sigma0 k || List.mem k rigid then evlist else
let n = max 0 (Array.length a - nenv) in
let t = abs_evar n k in (k, (n, t)) :: put evlist t
- | _ -> fold_constr put evlist c in
+ | _ -> Constr.fold put evlist c in
let evlist = put [] c0 in
if evlist = [] then 0, EConstr.of_constr c0,[], ucst else
let rec lookup k i = function
| [] -> 0, 0
| (k', (n, _)) :: evl -> if k = k' then i, n else lookup k (i + 1) evl in
- let rec get i c = match kind_of_term c with
+ let rec get i c = match Constr.kind c with
| Evar (ev, a) ->
let j, n = lookup ev i evlist in
- if j = 0 then map_constr (get i) c else if n = 0 then mkRel j else
+ if j = 0 then Constr.map (get i) c else if n = 0 then mkRel j else
mkApp (mkRel j, Array.init n (fun k -> get i a.(n - 1 - k)))
- | _ -> map_constr_with_binders ((+) 1) get i c in
+ | _ -> Constr.map_with_binders ((+) 1) get i c in
let rec loop c i = function
| (_, (n, t)) :: evl ->
loop (mkLambda (mk_evar_name n, get (i - 1) t, c)) (i - 1) evl
@@ -539,7 +539,7 @@ module Intset = Evar.Set
let pf_abs_evars_pirrel gl (sigma, c0) =
pp(lazy(str"==PF_ABS_EVARS_PIRREL=="));
- pp(lazy(str"c0= " ++ Printer.pr_constr c0));
+ pp(lazy(str"c0= " ++ Printer.pr_constr_env (pf_env gl) sigma c0));
let sigma0 = project gl in
let c0 = nf_evar sigma0 (nf_evar sigma c0) in
let nenv = env_size (pf_env gl) in
@@ -551,7 +551,7 @@ let pf_abs_evars_pirrel gl (sigma, c0) =
| NamedDecl.LocalAssum (x,t) -> mkNamedProd x t c in
let t = Context.Named.fold_inside abs_dc ~init:evi.evar_concl dc in
nf_evar sigma0 (nf_evar sigma t) in
- let rec put evlist c = match kind_of_term c with
+ let rec put evlist c = match Constr.kind c with
| Evar (k, a) ->
if List.mem_assoc k evlist || Evd.mem sigma0 k then evlist else
let n = max 0 (Array.length a - nenv) in
@@ -560,12 +560,12 @@ let pf_abs_evars_pirrel gl (sigma, c0) =
(pf_env gl) sigma (EConstr.of_constr (Evd.evar_concl (Evd.find sigma k))) in
let is_prop = k_ty = InProp in
let t = abs_evar n k in (k, (n, t, is_prop)) :: put evlist t
- | _ -> fold_constr put evlist c in
+ | _ -> Constr.fold put evlist c in
let evlist = put [] c0 in
if evlist = [] then 0, c0 else
- let pr_constr t = Printer.pr_econstr (Reductionops.nf_beta (project gl) (EConstr.of_constr t)) in
+ let pr_constr t = Printer.pr_econstr_env (pf_env gl) sigma (Reductionops.nf_beta (pf_env gl) (project gl) (EConstr.of_constr t)) in
pp(lazy(str"evlist=" ++ pr_list (fun () -> str";")
- (fun (k,_) -> str(Evd.string_of_existential k)) evlist));
+ (fun (k,_) -> Evar.print k) evlist));
let evplist =
let depev = List.fold_left (fun evs (_,(_,t,_)) ->
let t = EConstr.of_constr t in
@@ -588,17 +588,17 @@ let pf_abs_evars_pirrel gl (sigma, c0) =
let rec lookup k i = function
| [] -> 0, 0
| (k', (n,_,_)) :: evl -> if k = k' then i,n else lookup k (i + 1) evl in
- let rec get evlist i c = match kind_of_term c with
+ let rec get evlist i c = match Constr.kind c with
| Evar (ev, a) ->
let j, n = lookup ev i evlist in
- if j = 0 then map_constr (get evlist i) c else if n = 0 then mkRel j else
+ if j = 0 then Constr.map (get evlist i) c else if n = 0 then mkRel j else
mkApp (mkRel j, Array.init n (fun k -> get evlist i a.(n - 1 - k)))
- | _ -> map_constr_with_binders ((+) 1) (get evlist) i c in
+ | _ -> Constr.map_with_binders ((+) 1) (get evlist) i c in
let rec app extra_args i c = match decompose_app c with
| hd, args when isRel hd && destRel hd = i ->
let j = destRel hd in
mkApp (mkRel j, Array.of_list (List.map (Vars.lift (i-1)) extra_args @ args))
- | _ -> map_constr_with_binders ((+) 1) (app extra_args) i c in
+ | _ -> Constr.map_with_binders ((+) 1) (app extra_args) i c in
let rec loopP evlist c i = function
| (_, (n, t, _)) :: evl ->
let t = get evlist (i - 1) t in
@@ -645,7 +645,7 @@ let pf_abs_cterm gl n c0 =
let c0 = EConstr.Unsafe.to_constr c0 in
let noargs = [|0|] in
let eva = Array.make n noargs in
- let rec strip i c = match kind_of_term c with
+ let rec strip i c = match Constr.kind c with
| App (f, a) when isRel f ->
let j = i - destRel f in
if j >= n || eva.(j) = noargs then mkApp (f, Array.map (strip i) a) else
@@ -653,8 +653,8 @@ let pf_abs_cterm gl n c0 =
let nd = Array.length dp - 1 in
let mkarg k = strip i a.(if k < nd then dp.(k + 1) - j else k + dp.(0)) in
mkApp (f, Array.init (Array.length a - dp.(0)) mkarg)
- | _ -> map_constr_with_binders ((+) 1) strip i c in
- let rec strip_ndeps j i c = match kind_of_term c with
+ | _ -> Constr.map_with_binders ((+) 1) strip i c in
+ let rec strip_ndeps j i c = match Constr.kind c with
| Prod (x, t, c1) when i < j ->
let dl, c2 = strip_ndeps j (i + 1) c1 in
if Vars.noccurn 1 c2 then dl, Vars.lift (-1) c2 else
@@ -665,7 +665,7 @@ let pf_abs_cterm gl n c0 =
if Vars.noccurn 1 c2 then dl, Vars.lift (-1) c2 else
i :: dl, mkLetIn (x, strip i b, strip i t, c2)
| _ -> [], strip i c in
- let rec strip_evars i c = match kind_of_term c with
+ let rec strip_evars i c = match Constr.kind c with
| Lambda (x, t1, c1) when i < n ->
let na = nb_evar_deps x in
let dl, t2 = strip_ndeps (i + na) i t1 in
@@ -760,7 +760,7 @@ let clear_with_wilds wilds clr0 gl =
let id = NamedDecl.get_id nd in
if List.mem id clr || not (List.mem id wilds) then clr else
let vars = Termops.global_vars_set_of_decl (pf_env gl) (project gl) nd in
- let occurs id' = Idset.mem id' vars in
+ let occurs id' = Id.Set.mem id' vars in
if List.exists occurs clr then id :: clr else clr in
Proofview.V82.of_tactic (Tactics.clear (Context.Named.fold_inside extend_clr ~init:clr0 (Tacmach.pf_hyps gl))) gl
@@ -894,7 +894,7 @@ let saturate ?(beta=false) ?(bi_types=false) env sigma c ?(ty=Retyping.get_type_
let sigma = create_evar_defs sigma in
let (sigma, x) =
Evarutil.new_evar env sigma
- (if bi_types then Reductionops.nf_betaiota sigma src else src) in
+ (if bi_types then Reductionops.nf_betaiota env sigma src else src) in
loop (EConstr.Vars.subst1 x tgt) ((m - n,x) :: args) sigma (n-1)
| CastType (t, _) -> loop t args sigma n
| LetInType (_, v, _, t) -> loop (EConstr.Vars.subst1 v t) args sigma n
@@ -959,7 +959,7 @@ let applyn ~with_evars ?beta ?(with_shelve=false) n t gl =
loop (meta_declare m (EConstr.Unsafe.to_constr ty) sigma) bo ((EConstr.mkMeta m)::args) (n-1)
| _ -> assert false
in loop sigma t [] n in
- pp(lazy(str"Refiner.refiner " ++ Printer.pr_econstr t));
+ pp(lazy(str"Refiner.refiner " ++ Printer.pr_econstr_env (pf_env gl) (project gl) t));
Tacmach.refine_no_check t gl
let refine_with ?(first_goes_last=false) ?beta ?(with_evars=true) oc gl =
@@ -973,7 +973,7 @@ let refine_with ?(first_goes_last=false) ?beta ?(with_evars=true) oc gl =
compose_lam (let xs,y = List.chop (n-1) l in y @ xs)
(mkApp (compose_lam l c, Array.of_list (mkRel 1 :: mkRels n)))
in
- pp(lazy(str"after: " ++ Printer.pr_constr oc));
+ pp(lazy(str"after: " ++ Printer.pr_constr_env (pf_env gl) (project gl) oc));
try applyn ~with_evars ~with_shelve:true ?beta n (EConstr.of_constr oc) gl
with e when CErrors.noncritical e -> raise dependent_apply_error
@@ -1159,6 +1159,7 @@ let pf_interp_gen_aux ist gl to_ind ((oclr, occ), t) =
let (c, ucst), cl =
try fill_occ_pattern ~raise_NoMatch:true env sigma (EConstr.Unsafe.to_constr cl) pat occ 1
with NoMatch -> redex_of_pattern env pat, (EConstr.Unsafe.to_constr cl) in
+ let gl = pf_merge_uc ucst gl in
let c = EConstr.of_constr c in
let cl = EConstr.of_constr cl in
let clr = interp_clr sigma (oclr, (tag_of_cpattern t, c)) in
@@ -1202,7 +1203,7 @@ let genclrtac cl cs clr =
let gentac ist gen gl =
(* ppdebug(lazy(str"sigma@gentac=" ++ pr_evar_map None (project gl))); *)
let conv, _, cl, c, clr, ucst,gl = pf_interp_gen_aux ist gl false gen in
- ppdebug(lazy(str"c@gentac=" ++ pr_econstr c));
+ ppdebug(lazy(str"c@gentac=" ++ pr_econstr_env (pf_env gl) (project gl) c));
let gl = pf_merge_uc ucst gl in
if conv
then tclTHEN (Proofview.V82.of_tactic (convert_concl cl)) (cleartac clr) gl
diff --git a/plugins/ssr/ssrcommon.mli b/plugins/ssr/ssrcommon.mli
index 2eadd5f26..c39945194 100644
--- a/plugins/ssr/ssrcommon.mli
+++ b/plugins/ssr/ssrcommon.mli
@@ -190,7 +190,7 @@ val pf_merge_uc_of :
val constr_name : evar_map -> EConstr.t -> Name.t
val pf_type_of :
Goal.goal Evd.sigma ->
- Term.constr -> Goal.goal Evd.sigma * Term.types
+ Constr.constr -> Goal.goal Evd.sigma * Constr.types
val pfe_type_of :
Goal.goal Evd.sigma ->
EConstr.t -> Goal.goal Evd.sigma * EConstr.types
@@ -220,7 +220,7 @@ val new_wild_id : tac_ctx -> Names.Id.t * tac_ctx
val pf_fresh_global :
Globnames.global_reference ->
Goal.goal Evd.sigma ->
- Term.constr * Goal.goal Evd.sigma
+ Constr.constr * Goal.goal Evd.sigma
val is_discharged_id : Id.t -> bool
val mk_discharged_id : Id.t -> Id.t
@@ -232,7 +232,7 @@ val new_tmp_id :
val mk_anon_id : string -> Goal.goal Evd.sigma -> Id.t
val pf_abs_evars_pirrel :
Goal.goal Evd.sigma ->
- evar_map * Term.constr -> int * Term.constr
+ evar_map * Constr.constr -> int * Constr.constr
val pf_nbargs : Goal.goal Evd.sigma -> EConstr.t -> int
val gen_tmp_ids :
?ist:Geninterp.interp_sign ->
diff --git a/plugins/ssr/ssrelim.ml b/plugins/ssr/ssrelim.ml
index 26b5c5767..4e0b44a44 100644
--- a/plugins/ssr/ssrelim.ml
+++ b/plugins/ssr/ssrelim.ml
@@ -46,7 +46,7 @@ let analyze_eliminator elimty env sigma =
if not (EConstr.eq_constr sigma t t') then loop ctx t' else
errorstrm Pp.(str"The eliminator has the wrong shape."++spc()++
str"A (applied) bound variable was expected as the conclusion of "++
- str"the eliminator's"++Pp.cut()++str"type:"++spc()++pr_econstr elimty) in
+ str"the eliminator's"++Pp.cut()++str"type:"++spc()++pr_econstr_env env' sigma elimty) in
let ctx, pred_id, elim_is_dep, n_pred_args,concl = loop [] elimty in
let n_elim_args = Context.Rel.nhyps ctx in
let is_rec_elim =
@@ -126,7 +126,7 @@ let ssrelim ?(ind=ref None) ?(is_case=false) ?ist deps what ?elim eqid elim_intr
ppdebug(lazy Pp.(str"matching: " ++ pr_occ occ ++ pp_pattern p));
let (c,ucst), cl =
fill_occ_pattern ~raise_NoMatch:true env sigma0 (EConstr.Unsafe.to_constr cl) p occ h in
- ppdebug(lazy Pp.(str" got: " ++ pr_constr c));
+ ppdebug(lazy Pp.(str" got: " ++ pr_constr_env env sigma0 c));
c, EConstr.of_constr cl, ucst in
let mkTpat gl t = (* takes a term, refreshes it and makes a T pattern *)
let n, t, _, ucst = pf_abs_evars orig_gl (project gl, fire_subst gl t) in
@@ -239,8 +239,8 @@ let ssrelim ?(ind=ref None) ?(is_case=false) ?ist deps what ?elim eqid elim_intr
| Some (c, _, _,gl) -> true, gl
| None ->
errorstrm Pp.(str"Unable to apply the eliminator to the term"++
- spc()++pr_econstr c++spc()++str"or to unify it's type with"++
- pr_econstr inf_arg_ty) in
+ spc()++pr_econstr_env env (project gl) c++spc()++str"or to unify it's type with"++
+ pr_econstr_env env (project gl) inf_arg_ty) in
ppdebug(lazy Pp.(str"c_is_head_p= " ++ bool c_is_head_p));
let gl, predty = pfe_type_of gl pred in
(* Patterns for the inductive types indexes to be bound in pred are computed
diff --git a/plugins/ssr/ssrequality.ml b/plugins/ssr/ssrequality.ml
index 95ca6f49a..6032ed2af 100644
--- a/plugins/ssr/ssrequality.ml
+++ b/plugins/ssr/ssrequality.ml
@@ -11,13 +11,14 @@
open Ltac_plugin
open Util
open Names
+open Term
+open Constr
open Vars
open Locus
open Printer
open Globnames
open Termops
open Tacinterp
-open Term
open Ssrmatching_plugin
open Ssrmatching
@@ -76,7 +77,7 @@ let interp_congrarg_at ist gl n rf ty m =
if i + n > m then None else
try
let rt = mkRApp congrn (args1 @ mkRApp rf (mkRHoles i) :: args2) in
- ppdebug(lazy Pp.(str"rt=" ++ Printer.pr_glob_constr rt));
+ ppdebug(lazy Pp.(str"rt=" ++ Printer.pr_glob_constr_env (pf_env gl) rt));
Some (interp_refine ist gl rt)
with _ -> loop (i + 1) in
loop 0
@@ -85,7 +86,7 @@ let pattern_id = mk_internal_id "pattern value"
let congrtac ((n, t), ty) ist gl =
ppdebug(lazy (Pp.str"===congr==="));
- ppdebug(lazy Pp.(str"concl=" ++ Printer.pr_econstr (Tacmach.pf_concl gl)));
+ ppdebug(lazy Pp.(str"concl=" ++ Printer.pr_econstr_env (pf_env gl) (project gl) (Tacmach.pf_concl gl)));
let sigma, _ as it = interp_term ist gl t in
let gl = pf_merge_uc_of sigma gl in
let _, f, _, _ucst = pf_abs_evars gl it in
@@ -108,7 +109,7 @@ let congrtac ((n, t), ty) ist gl =
let newssrcongrtac arg ist gl =
ppdebug(lazy Pp.(str"===newcongr==="));
- ppdebug(lazy Pp.(str"concl=" ++ Printer.pr_econstr (pf_concl gl)));
+ ppdebug(lazy Pp.(str"concl=" ++ Printer.pr_econstr_env (pf_env gl) (project gl) (pf_concl gl)));
(* utils *)
let fs gl t = Reductionops.nf_evar (project gl) t in
let tclMATCH_GOAL (c, gl_c) proj t_ok t_fail gl =
@@ -142,14 +143,14 @@ let newssrcongrtac arg ist gl =
(** Coq rewrite compatibility flag *)
-let ssr_strict_match = ref false
let _ =
- Goptions.declare_bool_option
+ let ssr_strict_match = ref false in
+ Goptions.declare_bool_option
{ Goptions.optname = "strict redex matching";
Goptions.optkey = ["Match"; "Strict"];
Goptions.optread = (fun () -> !ssr_strict_match);
- Goptions.optdepr = false;
+ Goptions.optdepr = true; (* noop *)
Goptions.optwrite = (fun b -> ssr_strict_match := b) }
(** Rewrite rules *)
@@ -246,7 +247,7 @@ let unfoldintac occ rdx t (kt,_) gl =
try find_T env c h ~k:(fun env c _ _ -> EConstr.Unsafe.to_constr (body env t (EConstr.of_constr c)))
with NoMatch when easy -> c
| NoMatch | NoProgress -> errorstrm Pp.(str"No occurrence of "
- ++ pr_constr_pat (EConstr.Unsafe.to_constr t) ++ spc() ++ str "in " ++ Printer.pr_constr c)),
+ ++ pr_constr_pat (EConstr.Unsafe.to_constr t) ++ spc() ++ str "in " ++ Printer.pr_constr_env env sigma c)),
(fun () -> try end_T () with
| NoMatch when easy -> fake_pmatcher_end ()
| NoMatch -> anomaly "unfoldintac")
@@ -266,13 +267,13 @@ let unfoldintac occ rdx t (kt,_) gl =
| Proj _ when same_proj sigma0 c t -> body env t c
| Const f -> aux (body env c c)
| App (f, a) -> aux (EConstr.mkApp (body env f f, a))
- | _ -> errorstrm Pp.(str "The term "++pr_constr orig_c++
- str" contains no " ++ pr_econstr t ++ str" even after unfolding")
+ | _ -> errorstrm Pp.(str "The term "++ pr_constr_env env sigma orig_c++
+ str" contains no " ++ pr_econstr_env env sigma t ++ str" even after unfolding")
in EConstr.Unsafe.to_constr @@ aux (EConstr.of_constr c)
else
try EConstr.Unsafe.to_constr @@ body env t (fs (unify_HO env sigma (EConstr.of_constr c) t) t)
with _ -> errorstrm Pp.(str "The term " ++
- pr_constr c ++spc()++ str "does not unify with " ++ pr_constr_pat (EConstr.Unsafe.to_constr t))),
+ pr_constr_env env sigma c ++spc()++ str "does not unify with " ++ pr_constr_pat (EConstr.Unsafe.to_constr t))),
fake_pmatcher_end in
let concl =
let concl0 = EConstr.Unsafe.to_constr concl0 in
@@ -316,7 +317,7 @@ let rw_progress rhs lhs ise = not (EConstr.eq_constr ise lhs (Evarutil.nf_evar i
(* such a generic Leibnitz equation -- short of inspecting the type *)
(* of the elimination lemmas. *)
-let rec strip_prod_assum c = match Term.kind_of_term c with
+let rec strip_prod_assum c = match Constr.kind c with
| Prod (_, _, c') -> strip_prod_assum c'
| LetIn (_, v, _, c') -> strip_prod_assum (subst1 v c)
| Cast (c', _, _) -> strip_prod_assum c'
@@ -341,7 +342,7 @@ let pirrel_rewrite pred rdx rdx_ty new_rdx dir (sigma, c) c_ty gl =
let sort = elimination_sort_of_goal gl in
let elim, gl = pf_fresh_global (Indrec.lookup_eliminator ind sort) gl in
if dir = R2L then elim, gl else (* taken from Coq's rewrite *)
- let elim, _ = Term.destConst elim in
+ let elim, _ = destConst elim in
let mp,dp,l = Constant.repr3 (Constant.make1 (Constant.canonical elim)) in
let l' = Label.of_id (Nameops.add_suffix (Label.to_id l) "_r") in
let c1' = Global.constant_of_delta_kn (Constant.canonical (Constant.make3 mp dp l')) in
@@ -351,7 +352,7 @@ let pirrel_rewrite pred rdx rdx_ty new_rdx dir (sigma, c) c_ty gl =
(* We check the proof is well typed *)
let sigma, proof_ty =
try Typing.type_of env sigma proof with _ -> raise PRtype_error in
- ppdebug(lazy Pp.(str"pirrel_rewrite proof term of type: " ++ pr_econstr proof_ty));
+ ppdebug(lazy Pp.(str"pirrel_rewrite proof term of type: " ++ pr_econstr_env env sigma proof_ty));
try refine_with
~first_goes_last:(not !ssroldreworder) ~with_evars:false (sigma, proof) gl
with _ ->
@@ -373,8 +374,8 @@ let pirrel_rewrite pred rdx rdx_ty new_rdx dir (sigma, c) c_ty gl =
if open_evs <> [] then Some name else None)
(List.combine (Array.to_list args) names)
| _ -> anomaly "rewrite rule not an application" in
- errorstrm Pp.(Himsg.explain_refiner_error (Logic.UnresolvedBindings miss)++
- (Pp.fnl()++str"Rule's type:" ++ spc() ++ pr_econstr hd_ty))
+ errorstrm Pp.(Himsg.explain_refiner_error env sigma (Logic.UnresolvedBindings miss)++
+ (Pp.fnl()++str"Rule's type:" ++ spc() ++ pr_econstr_env env sigma hd_ty))
;;
let is_construct_ref sigma c r =
@@ -390,12 +391,12 @@ let rwcltac cl rdx dir sr gl =
let gl = pf_unsafe_merge_uc ucst gl in
let rdxt = Retyping.get_type_of (pf_env gl) (fst sr) rdx in
(* ppdebug(lazy(str"sigma@rwcltac=" ++ pr_evar_map None (fst sr))); *)
- ppdebug(lazy Pp.(str"r@rwcltac=" ++ pr_econstr (snd sr)));
+ ppdebug(lazy Pp.(str"r@rwcltac=" ++ pr_econstr_env (pf_env gl) (project gl) (snd sr)));
let cvtac, rwtac, gl =
if EConstr.Vars.closed0 (project gl) r' then
let env, sigma, c, c_eq = pf_env gl, fst sr, snd sr, Coqlib.build_coq_eq () in
let sigma, c_ty = Typing.type_of env sigma c in
- ppdebug(lazy Pp.(str"c_ty@rwcltac=" ++ pr_econstr c_ty));
+ ppdebug(lazy Pp.(str"c_ty@rwcltac=" ++ pr_econstr_env env sigma c_ty));
match EConstr.kind_of_type sigma (Reductionops.whd_all env sigma c_ty) with
| AtomicType(e, a) when is_ind_ref sigma e c_eq ->
let new_rdx = if dir = L2R then a.(2) else a.(1) in
@@ -410,7 +411,7 @@ let rwcltac cl rdx dir sr gl =
let r3, _, r3t =
try EConstr.destCast (project gl) r2 with _ ->
errorstrm Pp.(str "no cast from " ++ pr_constr_pat (EConstr.Unsafe.to_constr (snd sr))
- ++ str " to " ++ pr_econstr r2) in
+ ++ str " to " ++ pr_econstr_env (pf_env gl) (project gl) r2) in
let cl' = EConstr.mkNamedProd rule_id (EConstr.it_mkProd_or_LetIn r3t dc) (EConstr.Vars.lift 1 cl) in
let cl'' = EConstr.mkNamedProd pattern_id rdxt cl' in
let itacs = [introid pattern_id; introid rule_id] in
@@ -604,7 +605,7 @@ let ssrinstancesofrule ist dir arg gl =
sigma, pats @ [pat] in
let rpats = List.fold_left (rpat env0 sigma0) (r_sigma,[]) rules in
mk_tpattern_matcher ~all_instances:true ~raise_NoMatch:true sigma0 None ~upats_origin rpats in
- let print env p c _ = Feedback.msg_info Pp.(hov 1 (str"instance:" ++ spc() ++ pr_constr p ++ spc() ++ str "matches:" ++ spc() ++ pr_constr c)); c in
+ let print env p c _ = Feedback.msg_info Pp.(hov 1 (str"instance:" ++ spc() ++ pr_constr_env env r_sigma p ++ spc() ++ str "matches:" ++ spc() ++ pr_constr_env env r_sigma c)); c in
Feedback.msg_info Pp.(str"BEGIN INSTANCES");
try
while true do
diff --git a/plugins/ssr/ssrfwd.ml b/plugins/ssr/ssrfwd.ml
index d01bdc1b9..5c1b399a8 100644
--- a/plugins/ssr/ssrfwd.ml
+++ b/plugins/ssr/ssrfwd.ml
@@ -8,11 +8,12 @@
(* This file is (C) Copyright 2006-2015 Microsoft Corporation and Inria. *)
+open Pp
open Names
+open Constr
open Tacmach
open Ssrmatching_plugin.Ssrmatching
-
open Ssrprinters
open Ssrcommon
open Ssrtacticals
@@ -30,9 +31,6 @@ let ssrposetac ist (id, (_, t)) gl =
let sigma, t, ucst, _ = pf_abs_ssrterm ist gl t in
posetac id t (pf_merge_uc ucst gl)
-open Pp
-open Term
-
let ssrsettac ist id ((_, (pat, pty)), (_, occ)) gl =
let pat = interp_cpattern ist gl pat (Option.map snd pty) in
let cl, sigma, env = pf_concl gl, project gl, pf_env gl in
@@ -59,10 +57,10 @@ let rec is_Evar_or_CastedMeta sigma x =
(EConstr.isCast sigma x && is_Evar_or_CastedMeta sigma (pi1 (EConstr.destCast sigma x)))
let occur_existential_or_casted_meta c =
- let rec occrec c = match kind_of_term c with
+ let rec occrec c = match Constr.kind c with
| Evar _ -> raise Not_found
| Cast (m,_,_) when isMeta m -> raise Not_found
- | _ -> iter_constr occrec c
+ | _ -> Constr.iter occrec c
in try occrec c; false with Not_found -> true
open Printer
@@ -71,29 +69,30 @@ let examine_abstract id gl =
let gl, tid = pfe_type_of gl id in
let abstract, gl = pf_mkSsrConst "abstract" gl in
let sigma = project gl in
+ let env = pf_env gl in
if not (EConstr.isApp sigma tid) || not (EConstr.eq_constr sigma (fst(EConstr.destApp sigma tid)) abstract) then
- errorstrm(strbrk"not an abstract constant: "++pr_econstr id);
+ errorstrm(strbrk"not an abstract constant: "++ pr_econstr_env env sigma id);
let _, args_id = EConstr.destApp sigma tid in
if Array.length args_id <> 3 then
- errorstrm(strbrk"not a proper abstract constant: "++pr_econstr id);
+ errorstrm(strbrk"not a proper abstract constant: "++ pr_econstr_env env sigma id);
if not (is_Evar_or_CastedMeta sigma args_id.(2)) then
- errorstrm(strbrk"abstract constant "++pr_econstr id++str" already used");
+ errorstrm(strbrk"abstract constant "++ pr_econstr_env env sigma id++str" already used");
tid, args_id
let pf_find_abstract_proof check_lock gl abstract_n =
let fire gl t = EConstr.Unsafe.to_constr (Reductionops.nf_evar (project gl) (EConstr.of_constr t)) in
let abstract, gl = pf_mkSsrConst "abstract" gl in
let l = Evd.fold_undefined (fun e ei l ->
- match kind_of_term ei.Evd.evar_concl with
+ match Constr.kind ei.Evd.evar_concl with
| App(hd, [|ty; n; lock|])
when (not check_lock ||
(occur_existential_or_casted_meta (fire gl ty) &&
is_Evar_or_CastedMeta (project gl) (EConstr.of_constr @@ fire gl lock))) &&
- Term.eq_constr hd (EConstr.Unsafe.to_constr abstract) && Term.eq_constr n abstract_n -> e::l
+ Constr.equal hd (EConstr.Unsafe.to_constr abstract) && Constr.equal n abstract_n -> e::l
| _ -> l) (project gl) [] in
match l with
| [e] -> e
- | _ -> errorstrm(strbrk"abstract constant "++pr_constr abstract_n++
+ | _ -> errorstrm(strbrk"abstract constant "++ pr_constr_env (pf_env gl) (project gl) abstract_n ++
strbrk" not found in the evar map exactly once. "++
strbrk"Did you tamper with it?")
@@ -204,7 +203,7 @@ let havetac ist
let assert_is_conv gl =
try Proofview.V82.of_tactic (convert_concl (EConstr.it_mkProd_or_LetIn concl ctx)) gl
with _ -> errorstrm (str "Given proof term is not of type " ++
- pr_econstr (EConstr.mkArrow (EConstr.mkVar (Id.of_string "_")) concl)) in
+ pr_econstr_env (pf_env gl) (project gl) (EConstr.mkArrow (EConstr.mkVar (Id.of_string "_")) concl)) in
gl, ty, Tacticals.tclTHEN assert_is_conv (Proofview.V82.of_tactic (Tactics.apply t)), id, itac_c
| FwdHave, false, false ->
let skols = List.flatten (List.map (function
@@ -270,7 +269,7 @@ let ssrabstract ist gens (*last*) gl =
let gl, proof =
let pf_unify_HO gl a b =
try pf_unify_HO gl a b
- with _ -> errorstrm(strbrk"The abstract variable "++pr_econstr id++
+ with _ -> errorstrm(strbrk"The abstract variable "++ pr_econstr_env env (project gl) id++
strbrk" cannot abstract this goal. Did you generalize it?") in
let find_hole p t =
match EConstr.kind (project gl) t with
@@ -286,10 +285,10 @@ let ssrabstract ist gens (*last*) gl =
let p = mkApp (proj2,[|ty;concl;p|]) in
let concl = mkApp(prod,[|ty; concl|]) in
pf_unify_HO gl concl t, p
- | App(hd, [|left; right|]) when Term.eq_constr hd prod ->
+ | App(hd, [|left; right|]) when Term.Constr.equal hd prod ->
find_hole (mkApp (proj1,[|left;right;p|])) left
*)
- | _ -> errorstrm(strbrk"abstract constant "++pr_econstr abstract_n++
+ | _ -> errorstrm(strbrk"abstract constant "++ pr_econstr_env env (project gl) abstract_n++
strbrk" has an unexpected shape. Did you tamper with it?")
in
find_hole
@@ -360,14 +359,14 @@ let wlogtac ist (((clr0, pats),_),_) (gens, ((_, ct))) hint suff ghave gl =
| Sort _, [] -> EConstr.Vars.subst_vars s ct
| LetIn(Name id as n,b,ty,c), _::g -> EConstr.mkLetIn (n,b,ty,var2rel c g (id::s))
| Prod(Name id as n,ty,c), _::g -> EConstr.mkProd (n,ty,var2rel c g (id::s))
- | _ -> CErrors.anomaly(str"SSR: wlog: var2rel: " ++ pr_econstr c) in
+ | _ -> CErrors.anomaly(str"SSR: wlog: var2rel: " ++ pr_econstr_env env sigma c) in
let c = var2rel c gens [] in
let rec pired c = function
| [] -> c
| t::ts as args -> match EConstr.kind sigma c with
| Prod(_,_,c) -> pired (EConstr.Vars.subst1 t c) ts
| LetIn(id,b,ty,c) -> EConstr.mkLetIn (id,b,ty,pired c args)
- | _ -> CErrors.anomaly(str"SSR: wlog: pired: " ++ pr_econstr c) in
+ | _ -> CErrors.anomaly(str"SSR: wlog: pired: " ++ pr_econstr_env env sigma c) in
c, args, pired c args, pf_merge_uc uc gl in
let tacipat pats = introstac ~ist pats in
let tacigens =
@@ -395,8 +394,8 @@ let wlogtac ist (((clr0, pats),_),_) (gens, ((_, ct))) hint suff ghave gl =
| Some id ->
if pats = [] then Tacticals.tclIDTAC else
let args = Array.of_list args in
- ppdebug(lazy(str"specialized="++pr_econstr EConstr.(mkApp (mkVar id,args))));
- ppdebug(lazy(str"specialized_ty="++pr_econstr ct));
+ ppdebug(lazy(str"specialized="++ pr_econstr_env (pf_env gl) (project gl) EConstr.(mkApp (mkVar id,args))));
+ ppdebug(lazy(str"specialized_ty="++ pr_econstr_env (pf_env gl) (project gl) ct));
Tacticals.tclTHENS (basecuttac "ssr_have" ct)
[Proofview.V82.of_tactic (Tactics.apply EConstr.(mkApp (mkVar id,args))); Tacticals.tclIDTAC] in
"ssr_have",
diff --git a/plugins/ssr/ssripats.ml b/plugins/ssr/ssripats.ml
index 023778fdb..6c325cce4 100644
--- a/plugins/ssr/ssripats.ml
+++ b/plugins/ssr/ssripats.ml
@@ -272,7 +272,7 @@ let (introstac : ?ist:Tacinterp.interp_sign -> ssripats -> Tacmach.tactic),
let elim_intro_tac ipats ?ist what eqid ssrelim is_rec clr gl =
(* Utils of local interest only *)
let iD s ?t gl = let t = match t with None -> pf_concl gl | Some x -> x in
- ppdebug(lazy Pp.(str s ++ pr_econstr t)); Tacticals.tclIDTAC gl in
+ ppdebug(lazy Pp.(str s ++ pr_econstr_env (pf_env gl) (project gl) t)); Tacticals.tclIDTAC gl in
let protectC, gl = pf_mkSsrConst "protect_term" gl in
let eq, gl = pf_fresh_global (Coqlib.build_coq_eq ()) gl in
let eq = EConstr.of_constr eq in
diff --git a/plugins/ssr/ssrparser.ml4 b/plugins/ssr/ssrparser.ml4
index 7b591fead..46403aef3 100644
--- a/plugins/ssr/ssrparser.ml4
+++ b/plugins/ssr/ssrparser.ml4
@@ -1131,7 +1131,7 @@ let pr_fwd_guarded prval prval' = function
| (fk, h), (_, (_, Some c)) ->
pr_gen_fwd prval pr_constr_expr prl_constr_expr fk (format_constr_expr h c)
| (fk, h), (_, (c, None)) ->
- pr_gen_fwd prval' pr_glob_constr prl_glob_constr fk (format_glob_constr h c)
+ pr_gen_fwd prval' pr_glob_constr_env prl_glob_constr fk (format_glob_constr h c)
let pr_unguarded prc prlc = prlc
diff --git a/plugins/ssr/ssrprinters.ml b/plugins/ssr/ssrprinters.ml
index e865ef706..4b2fab6d1 100644
--- a/plugins/ssr/ssrprinters.ml
+++ b/plugins/ssr/ssrprinters.ml
@@ -24,7 +24,7 @@ let pp_concat hd ?(sep=str", ") = function [] -> hd | x :: xs ->
hd ++ List.fold_left (fun acc x -> acc ++ sep ++ x) x xs
let pp_term gl t =
- let t = Reductionops.nf_evar (project gl) t in pr_econstr t
+ let t = Reductionops.nf_evar (project gl) t in pr_econstr_env (pf_env gl) (project gl) t
(* FIXME *)
(* terms are pre constr, the kind is parsing/printing flag to distinguish
diff --git a/plugins/ssr/ssrvernac.ml4 b/plugins/ssr/ssrvernac.ml4
index 507b4631b..d74ad06b3 100644
--- a/plugins/ssr/ssrvernac.ml4
+++ b/plugins/ssr/ssrvernac.ml4
@@ -9,7 +9,8 @@
(* This file is (C) Copyright 2006-2015 Microsoft Corporation and Inria. *)
open Names
-open Term
+module CoqConstr = Constr
+open CoqConstr
open Termops
open Constrexpr
open Constrexpr_ops
@@ -73,7 +74,7 @@ let frozen_lexer = CLexer.get_keyword_state () ;;
let no_ct = None, None and no_rt = None in
let aliasvar = function
- | [_, [{ CAst.v = CPatAlias (_, id); loc }]] -> Some (loc,Name id)
+ | [[{ CAst.v = CPatAlias (_, id); loc }]] -> Some (loc,Name id)
| _ -> None in
let mk_cnotype mp = aliasvar mp, None in
let mk_ctype mp t = aliasvar mp, Some t in
@@ -85,14 +86,14 @@ let mk_pat c (na, t) = (c, na, t) in
GEXTEND Gram
GLOBAL: binder_constr;
ssr_rtype: [[ "return"; t = operconstr LEVEL "100" -> mk_rtype t ]];
- ssr_mpat: [[ p = pattern -> [Loc.tag ~loc:!@loc [p]] ]];
+ ssr_mpat: [[ p = pattern -> [[p]] ]];
ssr_dpat: [
[ mp = ssr_mpat; "in"; t = pattern; rt = ssr_rtype -> mp, mk_ctype mp t, rt
| mp = ssr_mpat; rt = ssr_rtype -> mp, mk_cnotype mp, rt
| mp = ssr_mpat -> mp, no_ct, no_rt
] ];
ssr_dthen: [[ dp = ssr_dpat; "then"; c = lconstr -> mk_dthen ~loc:!@loc dp c ]];
- ssr_elsepat: [[ "else" -> [Loc.tag ~loc:!@loc [CAst.make ~loc:!@loc @@ CPatAtom None]] ]];
+ ssr_elsepat: [[ "else" -> [[CAst.make ~loc:!@loc @@ CPatAtom None]] ]];
ssr_else: [[ mp = ssr_elsepat; c = lconstr -> Loc.tag ~loc:!@loc (mp, c) ]];
binder_constr: [
[ "if"; c = operconstr LEVEL "200"; "is"; db1 = ssr_dthen; b2 = ssr_else ->
@@ -157,11 +158,14 @@ let declare_one_prenex_implicit locality f =
| impls ->
Impargs.declare_manual_implicits locality fref ~enriching:false [impls]
-VERNAC COMMAND EXTEND Ssrpreneximplicits CLASSIFIED AS SIDEFF
+VERNAC COMMAND FUNCTIONAL EXTEND Ssrpreneximplicits CLASSIFIED AS SIDEFF
| [ "Prenex" "Implicits" ne_global_list(fl) ]
- -> [ let locality =
- Locality.make_section_locality (Locality.LocalityFixme.consume ()) in
- List.iter (declare_one_prenex_implicit locality) fl ]
+ -> [ fun ~atts ~st ->
+ let open Vernacinterp in
+ let locality = Locality.make_section_locality atts.locality in
+ List.iter (declare_one_prenex_implicit locality) fl;
+ st
+ ]
END
(* Vernac grammar visibility patch *)
@@ -342,7 +346,7 @@ let coerce_search_pattern_to_sort hpat =
let hpat' = if np = na then hpat else mkPApp hpat (np - na) [||] in
let warn () =
Feedback.msg_warning (str "Listing only lemmas with conclusion matching " ++
- pr_constr_pattern hpat') in
+ pr_constr_pattern_env env sigma hpat') in
if EConstr.isSort sigma ht then begin warn (); true, hpat' end else
let filter_head, coe_path =
try
@@ -358,13 +362,13 @@ let coerce_search_pattern_to_sort hpat =
let n_imps = Option.get (Classops.hide_coercion coe_ref) in
mkPApp (Pattern.PRef coe_ref) n_imps [|hp|]
with _ ->
- errorstrm (str "need explicit coercion " ++ pr_constr coe ++ spc ()
+ errorstrm (str "need explicit coercion " ++ pr_constr_env env sigma coe ++ spc ()
++ str "to interpret head search pattern as type") in
filter_head, List.fold_left coerce hpat' coe_path
let interp_head_pat hpat =
let filter_head, p = coerce_search_pattern_to_sort hpat in
- let rec loop c = match kind_of_term c with
+ let rec loop c = match CoqConstr.kind c with
| Cast (c', _, _) -> loop c'
| Prod (_, _, c') -> loop c'
| LetIn (_, _, _, c') -> loop c'
@@ -467,10 +471,12 @@ let pr_raw_ssrhintref prc _ _ = let open CAst in function
prc c ++ str "|" ++ int (List.length args)
| c -> prc c
-let pr_rawhintref c = match DAst.get c with
+let pr_rawhintref c =
+ let _, env = Pfedit.get_current_context () in
+ match DAst.get c with
| GApp (f, args) when isRHoles args ->
- pr_glob_constr f ++ str "|" ++ int (List.length args)
- | _ -> pr_glob_constr c
+ pr_glob_constr_env env f ++ str "|" ++ int (List.length args)
+ | _ -> pr_glob_constr_env env c
let pr_glob_ssrhintref _ _ _ (c, _) = pr_rawhintref c
@@ -545,9 +551,9 @@ GEXTEND Gram
| IDENT "Canonical"; qid = Constr.global;
d = G_vernac.def_body ->
let s = coerce_reference_to_id qid in
- Vernacexpr.VernacDefinition
- ((Some Decl_kinds.Global,Decl_kinds.CanonicalStructure),
- ((Loc.tag s),None),(d ))
+ Vernacexpr.VernacDefinition
+ ((Decl_kinds.NoDischarge,Decl_kinds.CanonicalStructure),
+ ((Loc.tag (Name s)),None), d)
]];
END
diff --git a/plugins/ssrmatching/ssrmatching.ml4 b/plugins/ssrmatching/ssrmatching.ml4
index e3e34616b..d6dbad7a9 100644
--- a/plugins/ssrmatching/ssrmatching.ml4
+++ b/plugins/ssrmatching/ssrmatching.ml4
@@ -18,10 +18,13 @@ let frozen_lexer = CLexer.get_keyword_state () ;;
open Ltac_plugin
open Names
open Pp
-open Pcoq
open Genarg
open Stdarg
open Term
+module CoqConstr = Constr
+open CoqConstr
+open Pcoq
+open Pcoq.Constr
open Vars
open Libnames
open Tactics
@@ -35,10 +38,8 @@ open Evd
open Tacexpr
open Tacinterp
open Pretyping
-open Constr
open Ppconstr
open Printer
-
open Globnames
open Misctypes
open Decl_kinds
@@ -73,7 +74,7 @@ let pp s = !pp_ref s
(** Utils {{{ *****************************************************************)
let env_size env = List.length (Environ.named_context env)
let safeDestApp c =
- match kind_of_term c with App (f, a) -> f, a | _ -> c, [| |]
+ match kind c with App (f, a) -> f, a | _ -> c, [| |]
(* Toplevel constr must be globalized twice ! *)
let glob_constr ist genv = function
| _, Some ce ->
@@ -99,7 +100,6 @@ let pr_guarded guard prc c =
let s = Pp.string_of_ppcmds (prc c) ^ "$" in
if guard s (skip_wschars s 0) then pr_paren prc c else prc c
(* More sensible names for constr printers *)
-let pr_constr = pr_constr
let prl_glob_constr c = pr_lglob_constr_env (Global.env ()) c
let pr_glob_constr c = pr_glob_constr_env (Global.env ()) c
let prl_constr_expr = pr_lconstr_expr
@@ -325,7 +325,7 @@ let unif_FO env ise p c =
let nf_open_term sigma0 ise c =
let c = EConstr.Unsafe.to_constr c in
let s = ise and s' = ref sigma0 in
- let rec nf c' = match kind_of_term c' with
+ let rec nf c' = match kind c' with
| Evar ex ->
begin try nf (existential_value s ex) with _ ->
let k, a = ex in let a' = Array.map nf a in
@@ -333,7 +333,7 @@ let nf_open_term sigma0 ise c =
s' := Evd.add !s' k (Evarutil.nf_evar_info s (Evd.find s k));
mkEvar (k, a')
end
- | _ -> map_constr nf c' in
+ | _ -> map nf c' in
let copy_def k evi () =
if evar_body evi != Evd.Evar_empty then () else
match Evd.evar_body (Evd.find s k) with
@@ -365,7 +365,7 @@ let pf_unify_HO gl t1 t2 =
re_sig si sigma
(* This is what the definition of iter_constr should be... *)
-let iter_constr_LR f c = match kind_of_term c with
+let iter_constr_LR f c = match kind c with
| Evar (k, a) -> Array.iter f a
| Cast (cc, _, t) -> f cc; f t
| Prod (_, t, b) | Lambda (_, t, b) -> f t; f b
@@ -396,7 +396,7 @@ let inv_dir = function L2R -> R2L | R2L -> L2R
type pattern_class =
| KpatFixed
| KpatConst
- | KpatEvar of existential_key
+ | KpatEvar of Evar.t
| KpatLet
| KpatLam
| KpatRigid
@@ -418,26 +418,27 @@ let all_ok _ _ = true
let proj_nparams c =
try 1 + Recordops.find_projection_nparams (ConstRef c) with _ -> 0
-let isRigid c = match kind_of_term c with
+let isRigid c = match kind c with
| Prod _ | Sort _ | Lambda _ | Case _ | Fix _ | CoFix _ -> true
| _ -> false
let hole_var = mkVar (Id.of_string "_")
let pr_constr_pat c0 =
let rec wipe_evar c =
- if isEvar c then hole_var else map_constr wipe_evar c in
- pr_constr (wipe_evar c0)
+ if isEvar c then hole_var else map wipe_evar c in
+ let sigma, env = Pfedit.get_current_context () in
+ pr_constr_env env sigma (wipe_evar c0)
(* Turn (new) evars into metas *)
let evars_for_FO ~hack env sigma0 (ise0:evar_map) c0 =
let ise = ref ise0 in
let sigma = ref ise0 in
let nenv = env_size env + if hack then 1 else 0 in
- let rec put c = match kind_of_term c with
+ let rec put c = match kind c with
| Evar (k, a as ex) ->
begin try put (existential_value !sigma ex)
with NotInstantiatedEvar ->
- if Evd.mem sigma0 k then map_constr put c else
+ if Evd.mem sigma0 k then map put c else
let evi = Evd.find !sigma k in
let dc = List.firstn (max 0 (Array.length a - nenv)) (evar_filtered_context evi) in
let abs_dc (d, c) = function
@@ -452,7 +453,7 @@ let evars_for_FO ~hack env sigma0 (ise0:evar_map) c0 =
sigma := Evd.define k (applistc (mkMeta m) a) !sigma;
put (existential_value !sigma ex)
end
- | _ -> map_constr put c in
+ | _ -> map put c in
let c1 = put c0 in !ise, c1
(* Compile a match pattern from a term; t is the term to fill. *)
@@ -462,7 +463,7 @@ let mk_tpattern ?p_origin ?(hack=false) env sigma0 (ise, t) ok dir p =
let f, a = Reductionops.whd_betaiota_stack ise (EConstr.of_constr p) in
let f = EConstr.Unsafe.to_constr f in
let a = List.map EConstr.Unsafe.to_constr a in
- match kind_of_term f with
+ match kind f with
| Const (p,_) ->
let np = proj_nparams p in
if np = 0 || np > List.length a then KpatConst, f, a else
@@ -490,7 +491,7 @@ let mk_tpattern ?p_origin ?(hack=false) env sigma0 (ise, t) ok dir p =
(* kind and arity for Proj and Flex patterns. *)
let ungen_upat lhs (sigma, uc, t) u =
let f, a = safeDestApp lhs in
- let k = match kind_of_term f with
+ let k = match kind f with
| Var _ | Ind _ | Construct _ -> KpatFixed
| Const _ -> KpatConst
| Evar (k, _) -> if is_defined sigma k then raise NoMatch else KpatEvar k
@@ -502,14 +503,14 @@ let ungen_upat lhs (sigma, uc, t) u =
let nb_cs_proj_args pc f u =
let na k =
List.length (snd (lookup_canonical_conversion (ConstRef pc, k))).o_TCOMPS in
- let nargs_of_proj t = match kind_of_term t with
+ let nargs_of_proj t = match kind t with
| App(_,args) -> Array.length args
| Proj _ -> 0 (* if splay_app calls expand_projection, this has to be
the number of arguments including the projected *)
| _ -> assert false in
- try match kind_of_term f with
+ try match kind f with
| Prod _ -> na Prod_cs
- | Sort s -> na (Sort_cs (family_of_sort s))
+ | Sort s -> na (Sort_cs (Sorts.family s))
| Const (c',_) when Constant.equal c' pc -> nargs_of_proj u.up_f
| Proj (c',_) when Constant.equal (Projection.constant c') pc -> nargs_of_proj u.up_f
| Var _ | Ind _ | Construct _ | Const _ -> na (Const_cs (global_of_constr f))
@@ -517,22 +518,22 @@ let nb_cs_proj_args pc f u =
with Not_found -> -1
let isEvar_k k f =
- match kind_of_term f with Evar (k', _) -> k = k' | _ -> false
+ match kind f with Evar (k', _) -> k = k' | _ -> false
let nb_args c =
- match kind_of_term c with App (_, a) -> Array.length a | _ -> 0
+ match kind c with App (_, a) -> Array.length a | _ -> 0
let mkSubArg i a = if i = Array.length a then a else Array.sub a 0 i
let mkSubApp f i a = if i = 0 then f else mkApp (f, mkSubArg i a)
let splay_app ise =
- let rec loop c a = match kind_of_term c with
+ let rec loop c a = match kind c with
| App (f, a') -> loop f (Array.append a' a)
| Cast (c', _, _) -> loop c' a
| Evar ex ->
(try loop (existential_value ise ex) a with _ -> c, a)
| _ -> c, a in
- fun c -> match kind_of_term c with
+ fun c -> match kind c with
| App (f, a) -> loop f a
| Cast _ | Evar _ -> loop c [| |]
| _ -> c, [| |]
@@ -541,8 +542,8 @@ let filter_upat i0 f n u fpats =
let na = Array.length u.up_a in
if n < na then fpats else
let np = match u.up_k with
- | KpatConst when Term.eq_constr u.up_f f -> na
- | KpatFixed when Term.eq_constr u.up_f f -> na
+ | KpatConst when equal u.up_f f -> na
+ | KpatFixed when equal u.up_f f -> na
| KpatEvar k when isEvar_k k f -> na
| KpatLet when isLetIn f -> na
| KpatLam when isLambda f -> na
@@ -554,7 +555,7 @@ let filter_upat i0 f n u fpats =
if np < na then fpats else
let () = if !i0 < np then i0 := n in (u, np) :: fpats
-let eq_prim_proj c t = match kind_of_term t with
+let eq_prim_proj c t = match kind t with
| Proj(p,_) -> Constant.equal (Projection.constant p) c
| _ -> false
@@ -562,13 +563,13 @@ let filter_upat_FO i0 f n u fpats =
let np = nb_args u.up_FO in
if n < np then fpats else
let ok = match u.up_k with
- | KpatConst -> Term.eq_constr u.up_f f
- | KpatFixed -> Term.eq_constr u.up_f f
+ | KpatConst -> equal u.up_f f
+ | KpatFixed -> equal u.up_f f
| KpatEvar k -> isEvar_k k f
| KpatLet -> isLetIn f
| KpatLam -> isLambda f
| KpatRigid -> isRigid f
- | KpatProj pc -> Term.eq_constr f (mkConst pc) || eq_prim_proj pc f
+ | KpatProj pc -> equal f (mkConst pc) || eq_prim_proj pc f
| KpatFlex -> i0 := n; true in
if ok then begin if !i0 < np then i0 := np; (u, np) :: fpats end else fpats
@@ -741,13 +742,13 @@ let mk_tpattern_matcher ?(all_instances=false)
let x, pv, t, pb = destLetIn u.up_f in
let env' =
Environ.push_rel (Context.Rel.Declaration.LocalAssum(x, t)) env in
- let match_let f = match kind_of_term f with
+ let match_let f = match kind f with
| LetIn (_, v, _, b) -> unif_EQ env sigma pv v && unif_EQ env' sigma pb b
| _ -> false in match_let
- | KpatFixed -> Term.eq_constr u.up_f
- | KpatConst -> Term.eq_constr u.up_f
+ | KpatFixed -> equal u.up_f
+ | KpatConst -> equal u.up_f
| KpatLam -> fun c ->
- (match kind_of_term c with
+ (match kind c with
| Lambda _ -> unif_EQ env sigma u.up_f c
| _ -> false)
| _ -> unif_EQ env sigma u.up_f in
@@ -778,8 +779,8 @@ let rec uniquize = function
let t1 = nf_evar sigma1 t1 in
let f1 = nf_evar sigma1 f1 in
let a1 = Array.map (nf_evar sigma1) a1 in
- not (Term.eq_constr t t1 &&
- Term.eq_constr f f1 && CArray.for_all2 Term.eq_constr a a1) in
+ not (equal t t1 &&
+ equal f f1 && CArray.for_all2 equal a a1) in
x :: uniquize (List.filter neq xs) in
((fun env c h ~k ->
@@ -1018,7 +1019,7 @@ let input_ssrtermkind strm = match stream_nth 0 strm with
| Tok.KEYWORD "(" -> '('
| Tok.KEYWORD "@" -> '@'
| _ -> ' '
-let ssrtermkind = Gram.Entry.of_parser "ssrtermkind" input_ssrtermkind
+let ssrtermkind = Pcoq.Gram.Entry.of_parser "ssrtermkind" input_ssrtermkind
let interp_ssrterm _ gl t = Tacmach.project gl, t
@@ -1100,7 +1101,7 @@ let interp_pattern ?wit_ssrpatternarg ist gl red redty =
let decodeG t f g = decode ist (mkG t) f g in
let bad_enc id _ = CErrors.anomaly (str"bad encoding for pattern "++str id++str".") in
let cleanup_XinE h x rp sigma =
- let h_k = match kind_of_term h with Evar (k,_) -> k | _ -> assert false in
+ let h_k = match kind h with Evar (k,_) -> k | _ -> assert false in
let to_clean, update = (* handle rename if x is already used *)
let ctx = pf_hyps gl in
let len = Context.Named.length ctx in
@@ -1115,11 +1116,11 @@ let interp_pattern ?wit_ssrpatternarg ist gl red redty =
with Not_found -> ref (Some x), fun _ -> () in
let sigma0 = project gl in
let new_evars =
- let rec aux acc t = match kind_of_term t with
+ let rec aux acc t = match kind t with
| Evar (k,_) ->
if k = h_k || List.mem k acc || Evd.mem sigma0 k then acc else
(update k; k::acc)
- | _ -> fold_constr aux acc t in
+ | _ -> CoqConstr.fold aux acc t in
aux [] (nf_evar sigma rp) in
let sigma =
List.fold_left (fun sigma e ->
@@ -1202,7 +1203,7 @@ let interp_cpattern ist gl red redty = interp_pattern ist gl (T red) redty;;
let interp_rpattern ~wit_ssrpatternarg ist gl red = interp_pattern ~wit_ssrpatternarg ist gl red None;;
let id_of_pattern = function
- | _, T t -> (match kind_of_term t with Var id -> Some id | _ -> None)
+ | _, T t -> (match kind t with Var id -> Some id | _ -> None)
| _ -> None
(* The full occurrence set *)
@@ -1214,7 +1215,7 @@ let eval_pattern ?raise_NoMatch env0 sigma0 concl0 pattern occ do_subst =
let pop_evar sigma e p =
let { Evd.evar_body = e_body } as e_def = Evd.find sigma e in
let e_body = match e_body with Evar_defined c -> c
- | _ -> errorstrm (str "Matching the pattern " ++ pr_constr p ++
+ | _ -> errorstrm (str "Matching the pattern " ++ pr_constr_env env0 sigma0 p ++
str " did not instantiate ?" ++ int (Evar.repr e) ++ spc () ++
str "Does the variable bound by the \"in\" construct occur "++
str "in the pattern?") in
@@ -1222,12 +1223,12 @@ let eval_pattern ?raise_NoMatch env0 sigma0 concl0 pattern occ do_subst =
Evd.add (Evd.remove sigma e) e {e_def with Evd.evar_body = Evar_empty} in
sigma, e_body in
let ex_value hole =
- match kind_of_term hole with Evar (e,_) -> e | _ -> assert false in
+ match kind hole with Evar (e,_) -> e | _ -> assert false in
let mk_upat_for ?hack env sigma0 (sigma, t) ?(p=t) ok =
let sigma,pat= mk_tpattern ?hack env sigma0 (sigma,p) ok L2R (fs sigma t) in
sigma, [pat] in
match pattern with
- | None -> do_subst env0 concl0 concl0 1
+ | None -> do_subst env0 concl0 concl0 1, Evd.empty_evar_universe_context
| Some (sigma, (T rp | In_T rp)) ->
let rp = fs sigma rp in
let ise = create_evar_defs sigma in
@@ -1235,8 +1236,8 @@ let eval_pattern ?raise_NoMatch env0 sigma0 concl0 pattern occ do_subst =
let rp = mk_upat_for env0 sigma0 (ise, rp) all_ok in
let find_T, end_T = mk_tpattern_matcher ?raise_NoMatch sigma0 occ rp in
let concl = find_T env0 concl0 1 ~k:do_subst in
- let _ = end_T () in
- concl
+ let _, _, (_, us, _) = end_T () in
+ concl, us
| Some (sigma, (X_In_T (hole, p) | In_X_In_T (hole, p))) ->
let p = fs sigma p in
let occ = match pattern with Some (_, X_In_T _) -> occ | _ -> noindex in
@@ -1251,8 +1252,8 @@ let eval_pattern ?raise_NoMatch env0 sigma0 concl0 pattern occ do_subst =
let sigma, e_body = pop_evar p_sigma ex p in
fs p_sigma (find_X env (fs sigma p) h
~k:(fun env _ -> do_subst env e_body))) in
- let _ = end_X () in let _ = end_T () in
- concl
+ let _ = end_X () in let _, _, (_, us, _) = end_T () in
+ concl, us
| Some (sigma, E_In_X_In_T (e, hole, p)) ->
let p, e = fs sigma p, fs sigma e in
let ex = ex_value hole in
@@ -1267,8 +1268,9 @@ let eval_pattern ?raise_NoMatch env0 sigma0 concl0 pattern occ do_subst =
let sigma, e_body = pop_evar p_sigma ex p in
fs p_sigma (find_X env (fs sigma p) h ~k:(fun env c _ h ->
find_E env e_body h ~k:do_subst))) in
- let _ = end_E () in let _ = end_X () in let _ = end_T () in
- concl
+ let _,_,(_,us,_) = end_E () in
+ let _ = end_X () in let _ = end_T () in
+ concl, us
| Some (sigma, E_As_X_In_T (e, hole, p)) ->
let p, e = fs sigma p, fs sigma e in
let ex = ex_value hole in
@@ -1286,8 +1288,8 @@ let eval_pattern ?raise_NoMatch env0 sigma0 concl0 pattern occ do_subst =
let e_sigma = unify_HO env sigma (EConstr.of_constr e_body) (EConstr.of_constr e) in
let e_body = fs e_sigma e in
do_subst env e_body e_body h))) in
- let _ = end_X () in let _ = end_TE () in
- concl
+ let _ = end_X () in let _,_,(_,us,_) = end_TE () in
+ concl, us
;;
let redex_of_pattern ?(resolve_typeclasses=false) env (sigma, p) =
@@ -1305,12 +1307,14 @@ let fill_occ_pattern ?raise_NoMatch env sigma cl pat occ h =
let find_R, conclude =
let r = ref None in
(fun env c _ h' ->
- do_once r (fun () -> c, Evd.empty_evar_universe_context);
+ do_once r (fun () -> c);
if do_make_rel then mkRel (h'+h-1) else c),
- (fun _ -> if !r = None then redex_of_pattern env pat else assert_done r) in
- let cl = eval_pattern ?raise_NoMatch env sigma cl (Some pat) occ find_R in
+ (fun _ -> if !r = None then fst(redex_of_pattern env pat)
+ else assert_done r) in
+ let cl, us =
+ eval_pattern ?raise_NoMatch env sigma cl (Some pat) occ find_R in
let e = conclude cl in
- e, cl
+ (e, us), cl
;;
(* clenup interface for external use *)
@@ -1318,6 +1322,10 @@ let mk_tpattern ?p_origin env sigma0 sigma_t f dir c =
mk_tpattern ?p_origin env sigma0 sigma_t f dir c
;;
+let eval_pattern ?raise_NoMatch env0 sigma0 concl0 pattern occ do_subst =
+ fst (eval_pattern ?raise_NoMatch env0 sigma0 concl0 pattern occ do_subst)
+;;
+
let pf_fill_occ env concl occ sigma0 p (sigma, t) ok h =
let p = EConstr.Unsafe.to_constr p in
let concl = EConstr.Unsafe.to_constr concl in
@@ -1407,7 +1415,7 @@ let () =
let ssrinstancesof ist arg gl =
let ok rhs lhs ise = true in
-(* not (Term.eq_constr lhs (Evarutil.nf_evar ise rhs)) in *)
+(* not (equal lhs (Evarutil.nf_evar ise rhs)) in *)
let env, sigma, concl = pf_env gl, project gl, pf_concl gl in
let concl = EConstr.Unsafe.to_constr concl in
let sigma0, cpat = interp_cpattern ist gl arg None in
@@ -1416,7 +1424,8 @@ let ssrinstancesof ist arg gl =
let find, conclude =
mk_tpattern_matcher ~all_instances:true ~raise_NoMatch:true
sigma None (etpat,[tpat]) in
- let print env p c _ = ppnl (hov 1 (str"instance:" ++ spc() ++ pr_constr p ++ spc() ++ str "matches:" ++ spc() ++ pr_constr c)); c in
+ let print env p c _ = ppnl (hov 1 (str"instance:" ++ spc() ++ pr_constr_env (pf_env gl) (gl.sigma) p ++ spc()
+ ++ str "matches:" ++ spc() ++ pr_constr_env (pf_env gl) (gl.sigma) c)); c in
ppnl (str"BEGIN INSTANCES");
try
while true do
diff --git a/plugins/ssrmatching/ssrmatching.mli b/plugins/ssrmatching/ssrmatching.mli
index 8e2a1a717..8ab666f7e 100644
--- a/plugins/ssrmatching/ssrmatching.mli
+++ b/plugins/ssrmatching/ssrmatching.mli
@@ -6,7 +6,7 @@ open Genarg
open Tacexpr
open Environ
open Evd
-open Term
+open Constr
(** ******** Small Scale Reflection pattern matching facilities ************* *)
diff --git a/pretyping/arguments_renaming.ml b/pretyping/arguments_renaming.ml
index ea33f1c0d..8ac471404 100644
--- a/pretyping/arguments_renaming.ml
+++ b/pretyping/arguments_renaming.ml
@@ -10,6 +10,7 @@
open Names
open Globnames
open Term
+open Constr
open Environ
open Util
open Libobject
@@ -39,16 +40,10 @@ let subst_rename_args (subst, (_, (r, names as orig))) =
let r' = fst (subst_global subst r) in
if r==r' then orig else (r', names)
-let section_segment_of_reference = function
- | ConstRef con -> Lib.section_segment_of_constant con
- | IndRef (kn,_) | ConstructRef ((kn,_),_) ->
- Lib.section_segment_of_mutual_inductive kn
- | _ -> [], Univ.LMap.empty, Univ.AUContext.empty
-
let discharge_rename_args = function
| _, (ReqGlobal (c, names), _ as req) ->
(try
- let vars,_,_ = section_segment_of_reference c in
+ let vars = Lib.variable_section_segment_of_reference c in
let c' = pop_global_reference c in
let var_names = List.map (fst %> NamedDecl.get_id %> Name.mk_name) vars in
let names' = var_names @ names in
@@ -103,7 +98,7 @@ let rename_type_of_constructor env cstruct =
let rename_typing env c =
let j = Typeops.infer env c in
let j' =
- match kind_of_term c with
+ match kind c with
| Const (c,u) -> { j with uj_type = rename_type j.uj_type (ConstRef c) }
| Ind (i,u) -> { j with uj_type = rename_type j.uj_type (IndRef i) }
| Construct (k,u) -> { j with uj_type = rename_type j.uj_type (ConstructRef k) }
diff --git a/pretyping/arguments_renaming.mli b/pretyping/arguments_renaming.mli
index 804e38216..b499da3ab 100644
--- a/pretyping/arguments_renaming.mli
+++ b/pretyping/arguments_renaming.mli
@@ -9,7 +9,7 @@
open Names
open Globnames
open Environ
-open Term
+open Constr
val rename_arguments : bool -> global_reference -> Name.t list -> unit
diff --git a/pretyping/cases.ml b/pretyping/cases.ml
index aefa09dbe..311c1c09e 100644
--- a/pretyping/cases.ml
+++ b/pretyping/cases.ml
@@ -13,7 +13,7 @@ open CErrors
open Util
open Names
open Nameops
-open Term
+open Constr
open Termops
open Environ
open EConstr
@@ -1014,7 +1014,7 @@ let adjust_impossible_cases pb pred tomatch submat =
this means that the Evd.define below may redefine an already defined
evar. See e.g. first definition of test for bug #3388. *)
let pred = EConstr.Unsafe.to_constr pred in
- begin match kind_of_term pred with
+ begin match Constr.kind pred with
| Evar (evk,_) when snd (evar_source evk !(pb.evdref)) == Evar_kinds.ImpossibleCase ->
if not (Evd.is_defined !(pb.evdref) evk) then begin
let evd, default = use_unit_judge !(pb.evdref) in
@@ -1276,7 +1276,7 @@ let build_branch initial current realargs deps (realnames,curname) pb arsign eqn
(* This is a bit too strong I think, in the sense that what we would *)
(* really like is to have beta-iota reduction only at the positions where *)
(* parameters are substituted *)
- let typs = List.map (map_type (nf_betaiota !(pb.evdref))) typs in
+ let typs = List.map (map_type (nf_betaiota pb.env !(pb.evdref))) typs in
(* We build the matrix obtained by expanding the matching on *)
(* "C x1..xn as x" followed by a residual matching on eqn into *)
@@ -1426,7 +1426,7 @@ and match_current pb (initial,tomatch) =
find_predicate pb.caseloc pb.env pb.evdref
pred current indt (names,dep) tomatch in
let ci = make_case_info pb.env (fst mind) pb.casestyle in
- let pred = nf_betaiota !(pb.evdref) pred in
+ let pred = nf_betaiota pb.env !(pb.evdref) pred in
let case =
make_case_or_project pb.env !(pb.evdref) indf ci pred current brvals
in
@@ -1566,11 +1566,9 @@ substituer après par les initiaux *)
(* builds the matrix of equations testing that each eqn has n patterns
* and linearizing the _ patterns.
- * Syntactic correctness has already been done in astterm *)
+ * Syntactic correctness has already been done in constrintern *)
let matx_of_eqns env eqns =
- let build_eqn (loc,(ids,lpat,rhs)) =
- let initial_lpat,initial_rhs = lpat,rhs in
- let initial_rhs = rhs in
+ let build_eqn (loc,(ids,initial_lpat,initial_rhs)) =
let avoid = ids_of_named_context_val (named_context_val env) in
let avoid = List.fold_left (fun accu id -> Id.Set.add id accu) avoid ids in
let rhs =
@@ -1665,7 +1663,7 @@ let rec list_assoc_in_triple x = function
*)
let abstract_tycon ?loc env evdref subst tycon extenv t =
- let t = nf_betaiota !evdref t in (* it helps in some cases to remove K-redex*)
+ let t = nf_betaiota env !evdref t in (* it helps in some cases to remove K-redex*)
let src = match EConstr.kind !evdref t with
| Evar (evk,_) -> (Loc.tag ?loc @@ Evar_kinds.SubEvar evk)
| _ -> (Loc.tag ?loc @@ Evar_kinds.CasesType true) in
diff --git a/pretyping/cases.mli b/pretyping/cases.mli
index cbf5788e4..43dbc3105 100644
--- a/pretyping/cases.mli
+++ b/pretyping/cases.mli
@@ -7,14 +7,14 @@
(************************************************************************)
open Names
-open Term
+open Constr
open Evd
open Environ
open EConstr
open Inductiveops
open Glob_term
-open Evarutil
open Ltac_pretype
+open Evardefine
(** {5 Compilation of pattern-matching } *)
@@ -116,7 +116,7 @@ type 'a pattern_matching_problem =
val compile : 'a pattern_matching_problem -> unsafe_judgment
val prepare_predicate : ?loc:Loc.t ->
- (Evarutil.type_constraint ->
+ (type_constraint ->
Environ.env -> Evd.evar_map ref -> ltac_var_map -> glob_constr -> unsafe_judgment) ->
Environ.env ->
Evd.evar_map ->
@@ -124,7 +124,7 @@ val prepare_predicate : ?loc:Loc.t ->
(types * tomatch_type) list ->
(rel_context * rel_context) list ->
constr option ->
- glob_constr option -> (Evd.evar_map * Names.name list * constr) list
+ glob_constr option -> (Evd.evar_map * Name.t list * constr) list
-val make_return_predicate_ltac_lvar : Evd.evar_map -> Names.name ->
+val make_return_predicate_ltac_lvar : Evd.evar_map -> Name.t ->
Glob_term.glob_constr -> constr -> Ltac_pretype.ltac_var_map -> ltac_var_map
diff --git a/pretyping/cbv.ml b/pretyping/cbv.ml
index 19d61a64d..e42576d95 100644
--- a/pretyping/cbv.ml
+++ b/pretyping/cbv.ml
@@ -8,7 +8,7 @@
open Util
open Names
-open Term
+open Constr
open Vars
open CClosure
open Esubst
@@ -45,7 +45,7 @@ type cbv_value =
| LAM of int * (Name.t * constr) list * constr * cbv_value subs
| FIXP of fixpoint * cbv_value subs * cbv_value array
| COFIXP of cofixpoint * cbv_value subs * cbv_value array
- | CONSTR of constructor puniverses * cbv_value array
+ | CONSTR of constructor Univ.puniverses * cbv_value array
(* type of terms with a hole. This hole can appear only under App or Case.
* TOP means the term is considered without context
@@ -171,7 +171,7 @@ let fixp_reducible flgs ((reci,i),_) stk =
let cofixp_reducible flgs _ stk =
if red_set flgs fCOFIX then
match stk with
- | (CASE _ | APP(_,CASE _)) -> true
+ | (CASE _ | PROJ _ | APP(_,CASE _) | APP(_,PROJ _)) -> true
| _ -> false
else
false
@@ -208,25 +208,32 @@ and reify_value = function (* reduction under binders *)
| STACK (n,v,stk) ->
lift n (reify_stack (reify_value v) stk)
| CBN(t,env) ->
- t
- (* map_constr_with_binders subs_lift (cbv_norm_term) env t *)
- | LAM (n,ctxt,b,env) ->
- List.fold_left (fun c (n,t) -> Term.mkLambda (n, t, c)) b ctxt
+ apply_env env t
+ | LAM (k,ctxt,b,env) ->
+ apply_env env @@
+ List.fold_left (fun c (n,t) ->
+ mkLambda (n, t, c)) b ctxt
| FIXP ((lij,(names,lty,bds)),env,args) ->
- mkApp
- (mkFix (lij,
- (names,
- lty,
- bds)),
- Array.map reify_value args)
+ let fix = mkFix (lij, (names, lty, bds)) in
+ mkApp (apply_env env fix, Array.map reify_value args)
| COFIXP ((j,(names,lty,bds)),env,args) ->
- mkApp
- (mkCoFix (j,
- (names,lty,bds)),
- Array.map reify_value args)
+ let cofix = mkCoFix (j, (names,lty,bds)) in
+ mkApp (apply_env env cofix, Array.map reify_value args)
| CONSTR (c,args) ->
mkApp(mkConstructU c, Array.map reify_value args)
+and apply_env env t =
+ match kind t with
+ | Rel i ->
+ begin match expand_rel i env with
+ | Inl (k, v) ->
+ reify_value (shift_value k v)
+ | Inr (k,_) ->
+ mkRel k
+ end
+ | _ ->
+ map_with_binders subs_lift apply_env env t
+
(* The main recursive functions
*
* Go under applications and cases/projections (pushed in the stack),
@@ -240,7 +247,7 @@ and reify_value = function (* reduction under binders *)
let rec norm_head info env t stack =
(* no reduction under binders *)
- match kind_of_term t with
+ match kind t with
(* stack grows (remove casts) *)
| App (head,args) -> (* Applied terms are normalized immediately;
they could be computed when getting out of the stack *)
@@ -290,11 +297,14 @@ let rec norm_head info env t stack =
| Evar ev ->
(match evar_value info.infos.i_cache ev with
Some c -> norm_head info env c stack
- | None -> (VAL(0, t), stack))
+ | None ->
+ let e, xs = ev in
+ let xs' = Array.map (apply_env env) xs in
+ (VAL(0, mkEvar (e,xs')), stack))
(* non-neutral cases *)
| Lambda _ ->
- let ctxt,b = decompose_lam t in
+ let ctxt,b = Term.decompose_lam t in
(LAM(List.length ctxt, List.rev ctxt,b,env), stack)
| Fix fix -> (FIXP(fix,env,[||]), stack)
| CoFix cofix -> (COFIXP(cofix,env,[||]), stack)
@@ -411,12 +421,12 @@ and cbv_norm_value info = function (* reduction under binders *)
| STACK (n,v,stk) ->
lift n (apply_stack info (cbv_norm_value info v) stk)
| CBN(t,env) ->
- map_constr_with_binders subs_lift (cbv_norm_term info) env t
+ Constr.map_with_binders subs_lift (cbv_norm_term info) env t
| LAM (n,ctxt,b,env) ->
let nctxt =
List.map_i (fun i (x,ty) ->
(x,cbv_norm_term info (subs_liftn i env) ty)) 0 ctxt in
- compose_lam (List.rev nctxt) (cbv_norm_term info (subs_liftn n env) b)
+ Term.compose_lam (List.rev nctxt) (cbv_norm_term info (subs_liftn n env) b)
| FIXP ((lij,(names,lty,bds)),env,args) ->
mkApp
(mkFix (lij,
diff --git a/pretyping/cbv.mli b/pretyping/cbv.mli
index 3ee7bebf0..1d4c88ea2 100644
--- a/pretyping/cbv.mli
+++ b/pretyping/cbv.mli
@@ -24,7 +24,7 @@ val cbv_norm : cbv_infos -> constr -> constr
(***********************************************************************
i This is for cbv debug *)
-open Term
+open Constr
type cbv_value =
| VAL of int * constr
@@ -33,7 +33,7 @@ type cbv_value =
| LAM of int * (Name.t * constr) list * constr * cbv_value subs
| FIXP of fixpoint * cbv_value subs * cbv_value array
| COFIXP of cofixpoint * cbv_value subs * cbv_value array
- | CONSTR of constructor puniverses * cbv_value array
+ | CONSTR of constructor Univ.puniverses * cbv_value array
and cbv_stack =
| TOP
diff --git a/pretyping/classops.ml b/pretyping/classops.ml
index 260cd0444..6d5ee504e 100644
--- a/pretyping/classops.ml
+++ b/pretyping/classops.ml
@@ -10,12 +10,12 @@ open CErrors
open Util
open Pp
open Names
+open Constr
open Libnames
open Globnames
open Nametab
open Environ
open Libobject
-open Term
open Mod_subst
(* usage qque peu general: utilise aussi dans record *)
@@ -27,9 +27,9 @@ type cl_typ =
| CL_SORT
| CL_FUN
| CL_SECVAR of variable
- | CL_CONST of constant
+ | CL_CONST of Constant.t
| CL_IND of inductive
- | CL_PROJ of constant
+ | CL_PROJ of Constant.t
type cl_info_typ = {
cl_param : int
@@ -43,7 +43,7 @@ type coe_info_typ = {
coe_value : constr;
coe_type : types;
coe_local : bool;
- coe_context : Univ.universe_context_set;
+ coe_context : Univ.ContextSet.t;
coe_is_identity : bool;
coe_is_projection : bool;
coe_param : int }
@@ -59,8 +59,8 @@ let coe_info_typ_equal c1 c2 =
let cl_typ_ord t1 t2 = match t1, t2 with
| CL_SECVAR v1, CL_SECVAR v2 -> Id.compare v1 v2
- | CL_CONST c1, CL_CONST c2 -> con_ord c1 c2
- | CL_PROJ c1, CL_PROJ c2 -> con_ord c1 c2
+ | CL_CONST c1, CL_CONST c2 -> Constant.CanOrd.compare c1 c2
+ | CL_PROJ c1, CL_PROJ c2 -> Constant.CanOrd.compare c1 c2
| CL_IND i1, CL_IND i2 -> ind_ord i1 i2
| _ -> Pervasives.compare t1 t2 (** OK *)
@@ -322,16 +322,16 @@ let coercion_value { coe_value = c; coe_type = t; coe_context = ctx;
(* pretty-print functions are now in Pretty *)
(* rajouter une coercion dans le graphe *)
-let path_printer = ref (fun _ -> str "<a class path>"
- : (Bijint.Index.t * Bijint.Index.t) * inheritance_path -> Pp.t)
+let path_printer : (env -> Evd.evar_map -> (Bijint.Index.t * Bijint.Index.t) * inheritance_path -> Pp.t) ref =
+ ref (fun _ _ _ -> str "<a class path>")
let install_path_printer f = path_printer := f
-let print_path x = !path_printer x
+let print_path env sigma x = !path_printer env sigma x
-let message_ambig l =
- (str"Ambiguous paths:" ++ spc () ++
- prlist_with_sep fnl (fun ijp -> print_path ijp) l)
+let message_ambig env sigma l =
+ str"Ambiguous paths:" ++ spc () ++
+ prlist_with_sep fnl (fun ijp -> print_path env sigma ijp) l
(* add_coercion_in_graph : coe_index * cl_index * cl_index -> unit
coercion,source,target *)
@@ -344,8 +344,8 @@ let different_class_params i =
| CL_IND i -> Global.is_polymorphic (IndRef i)
| CL_CONST c -> Global.is_polymorphic (ConstRef c)
| _ -> false
-
-let add_coercion_in_graph (ic,source,target) =
+
+let add_coercion_in_graph env sigma (ic,source,target) =
let old_inheritance_graph = !inheritance_graph in
let ambig_paths =
(ref [] : ((cl_index * cl_index) * inheritance_path) list ref) in
@@ -387,7 +387,7 @@ let add_coercion_in_graph (ic,source,target) =
end;
let is_ambig = match !ambig_paths with [] -> false | _ -> true in
if is_ambig && not !Flags.quiet then
- Feedback.msg_info (message_ambig !ambig_paths)
+ Feedback.msg_info (message_ambig env sigma !ambig_paths)
type coercion = {
coercion_type : coe_typ;
@@ -433,13 +433,13 @@ let _ =
optread = (fun () -> !automatically_import_coercions);
optwrite = (:=) automatically_import_coercions }
-let cache_coercion (_, c) =
+let cache_coercion env sigma (_, c) =
let () = add_class c.coercion_source in
let () = add_class c.coercion_target in
let is, _ = class_info c.coercion_source in
let it, _ = class_info c.coercion_target in
- let value, ctx = Universes.fresh_global_instance (Global.env()) c.coercion_type in
- let typ = Retyping.get_type_of (Global.env ()) Evd.empty (EConstr.of_constr value) in
+ let value, ctx = Universes.fresh_global_instance env c.coercion_type in
+ let typ = Retyping.get_type_of env sigma (EConstr.of_constr value) in
let typ = EConstr.Unsafe.to_constr typ in
let xf =
{ coe_value = value;
@@ -450,15 +450,15 @@ let cache_coercion (_, c) =
coe_is_projection = c.coercion_is_proj;
coe_param = c.coercion_params } in
let () = add_new_coercion c.coercion_type xf in
- add_coercion_in_graph (xf,is,it)
+ add_coercion_in_graph env sigma (xf,is,it)
let load_coercion _ o =
if !automatically_import_coercions then
- cache_coercion o
+ cache_coercion (Global.env ()) Evd.empty o
let open_coercion i o =
if Int.equal i 1 && not !automatically_import_coercions then
- cache_coercion o
+ cache_coercion (Global.env ()) Evd.empty o
let subst_coercion (subst, c) =
let coe = subst_coe_typ subst c.coercion_type in
@@ -497,7 +497,9 @@ let inCoercion : coercion -> obj =
declare_object {(default_object "COERCION") with
open_function = open_coercion;
load_function = load_coercion;
- cache_function = cache_coercion;
+ cache_function = (fun objn ->
+ let env = Global.env () in cache_coercion env Evd.empty objn
+ );
subst_function = subst_coercion;
classify_function = classify_coercion;
discharge_function = discharge_coercion }
diff --git a/pretyping/classops.mli b/pretyping/classops.mli
index 8707078b5..47b41f17b 100644
--- a/pretyping/classops.mli
+++ b/pretyping/classops.mli
@@ -17,9 +17,9 @@ type cl_typ =
| CL_SORT
| CL_FUN
| CL_SECVAR of variable
- | CL_CONST of constant
+ | CL_CONST of Constant.t
| CL_IND of inductive
- | CL_PROJ of constant
+ | CL_PROJ of Constant.t
(** Equality over [cl_typ] *)
val cl_typ_eq : cl_typ -> cl_typ -> bool
@@ -96,7 +96,7 @@ val lookup_pattern_path_between :
(**/**)
(* Crade *)
val install_path_printer :
- ((cl_index * cl_index) * inheritance_path -> Pp.t) -> unit
+ (env -> evar_map -> (cl_index * cl_index) * inheritance_path -> Pp.t) -> unit
(**/**)
(** {6 This is for printing purpose } *)
diff --git a/pretyping/constr_matching.ml b/pretyping/constr_matching.ml
index ddef1cee9..c3a221944 100644
--- a/pretyping/constr_matching.ml
+++ b/pretyping/constr_matching.ml
@@ -12,9 +12,7 @@ open CErrors
open Util
open Names
open Globnames
-open Nameops
open Termops
-open Reductionops
open Term
open EConstr
open Vars
@@ -55,7 +53,7 @@ exception PatternMatchingFailure
let warn_meta_collision =
CWarnings.create ~name:"meta-collision" ~category:"ltac"
(fun name ->
- strbrk "Collision between bound variable " ++ pr_id name ++
+ strbrk "Collision between bound variable " ++ Id.print name ++
strbrk " and a metavariable of same name.")
@@ -208,20 +206,16 @@ let merge_binding sigma allow_bound_rels ctx n cT subst =
in
constrain sigma n c subst
-let matches_core env sigma convert allow_partial_app allow_bound_rels
+let matches_core env sigma allow_bound_rels
(binding_vars,pat) c =
let open EConstr in
let convref ref c =
match ref, EConstr.kind sigma c with
| VarRef id, Var id' -> Names.Id.equal id id'
- | ConstRef c, Const (c',_) -> Names.eq_constant c c'
+ | ConstRef c, Const (c',_) -> Constant.equal c c'
| IndRef i, Ind (i', _) -> Names.eq_ind i i'
| ConstructRef c, Construct (c',u) -> Names.eq_constructor c c'
- | _, _ ->
- (if convert then
- let sigma,c' = Evd.fresh_global env sigma ref in
- is_conv env sigma (EConstr.of_constr c') c
- else false)
+ | _, _ -> false
in
let rec sorec ctx env subst p t =
let cT = strip_outer_cast sigma t in
@@ -266,7 +260,7 @@ let matches_core env sigma convert allow_partial_app allow_bound_rels
| PApp (PApp (h, a1), a2), _ ->
sorec ctx env subst (PApp(h,Array.append a1 a2)) t
- | PApp (PMeta meta,args1), App (c2,args2) when allow_partial_app ->
+ | PApp (PMeta meta,args1), App (c2,args2) ->
(let diff = Array.length args2 - Array.length args1 in
if diff >= 0 then
let args21, args22 = Array.chop diff args2 in
@@ -286,7 +280,7 @@ let matches_core env sigma convert allow_partial_app allow_bound_rels
| PApp (c1,arg1), App (c2,arg2) ->
(match c1, EConstr.kind sigma c2 with
- | PRef (ConstRef r), Proj (pr,c) when not (eq_constant r (Projection.constant pr))
+ | PRef (ConstRef r), Proj (pr,c) when not (Constant.equal r (Projection.constant pr))
|| Projection.unfolded pr ->
raise PatternMatchingFailure
| PProj (pr1,c1), Proj (pr,c) ->
@@ -303,7 +297,7 @@ let matches_core env sigma convert allow_partial_app allow_bound_rels
with Invalid_argument _ -> raise PatternMatchingFailure)
| PApp (PRef (ConstRef c1), _), Proj (pr, c2)
- when Projection.unfolded pr || not (eq_constant c1 (Projection.constant pr)) ->
+ when Projection.unfolded pr || not (Constant.equal c1 (Projection.constant pr)) ->
raise PatternMatchingFailure
| PApp (c, args), Proj (pr, c2) ->
@@ -372,19 +366,21 @@ let matches_core env sigma convert allow_partial_app allow_bound_rels
| PCoFix c1, CoFix _ when eq_constr sigma (mkCoFix (to_fix c1)) cT -> subst
| PEvar (c1,args1), Evar (c2,args2) when Evar.equal c1 c2 ->
Array.fold_left2 (sorec ctx env) subst args1 args2
- | _ -> raise PatternMatchingFailure
+ | (PRef _ | PVar _ | PRel _ | PApp _ | PProj _ | PLambda _
+ | PProd _ | PLetIn _ | PSort _ | PIf _ | PCase _
+ | PFix _ | PCoFix _| PEvar _), _ -> raise PatternMatchingFailure
in
sorec [] env (Id.Map.empty, Id.Map.empty) pat c
-let matches_core_closed env sigma convert allow_partial_app pat c =
- let names, subst = matches_core env sigma convert allow_partial_app false pat c in
+let matches_core_closed env sigma pat c =
+ let names, subst = matches_core env sigma false pat c in
(names, Id.Map.map snd subst)
-let extended_matches env sigma = matches_core env sigma false true true
+let extended_matches env sigma = matches_core env sigma true
let matches env sigma pat c =
- snd (matches_core_closed env sigma false true (Id.Set.empty,pat) c)
+ snd (matches_core_closed env sigma (Id.Set.empty,pat) c)
let special_meta = (-1)
@@ -409,9 +405,9 @@ let matches_head env sigma pat c =
matches env sigma pat head
(* Tells if it is an authorized occurrence and if the instance is closed *)
-let authorized_occ env sigma partial_app closed pat c mk_ctx =
+let authorized_occ env sigma closed pat c mk_ctx =
try
- let subst = matches_core_closed env sigma false partial_app pat c in
+ let subst = matches_core_closed env sigma pat c in
if closed && Id.Map.exists (fun _ c -> not (closed0 sigma c)) (snd subst)
then (fun next -> next ())
else (fun next -> mkresult subst (mk_ctx (mkMeta special_meta)) next)
@@ -420,10 +416,10 @@ let authorized_occ env sigma partial_app closed pat c mk_ctx =
let subargs env v = Array.map_to_list (fun c -> (env, c)) v
(* Tries to match a subterm of [c] with [pat] *)
-let sub_match ?(partial_app=false) ?(closed=true) env sigma pat c =
+let sub_match ?(closed=true) env sigma pat c =
let open EConstr in
let rec aux env c mk_ctx next =
- let here = authorized_occ env sigma partial_app closed pat c mk_ctx in
+ let here = authorized_occ env sigma closed pat c mk_ctx in
let next () = match EConstr.kind sigma c with
| Cast (c1,k,c2) ->
let next_mk_ctx = function
@@ -453,34 +449,12 @@ let sub_match ?(partial_app=false) ?(closed=true) env sigma pat c =
let env' = EConstr.push_rel (LocalDef (x,c1,t)) env in
try_aux [(env, c1); (env', c2)] next_mk_ctx next
| App (c1,lc) ->
- let topdown = true in
- if partial_app then
- if topdown then
- let lc1 = Array.sub lc 0 (Array.length lc - 1) in
- let app = mkApp (c1,lc1) in
- let mk_ctx = function
- | [app';c] -> mk_ctx (mkApp (app',[|c|]))
- | _ -> assert false in
- try_aux [(env, app); (env, Array.last lc)] mk_ctx next
- else
- let rec aux2 app args next =
- match args with
- | [] ->
- let mk_ctx le =
- mk_ctx (mkApp (List.hd le, Array.of_list (List.tl le))) in
- let sub = (env, c1) :: subargs env lc in
- try_aux sub mk_ctx next
- | arg :: args ->
- let app = mkApp (app,[|arg|]) in
- let next () = aux2 app args next in
- let mk_ctx ce = mk_ctx (mkApp (ce, Array.of_list args)) in
- aux env app mk_ctx next in
- aux2 c1 (Array.to_list lc) next
- else
- let mk_ctx le =
- mk_ctx (mkApp (List.hd le, Array.of_list (List.tl le))) in
- let sub = (env, c1) :: subargs env lc in
- try_aux sub mk_ctx next
+ let lc1 = Array.sub lc 0 (Array.length lc - 1) in
+ let app = mkApp (c1,lc1) in
+ let mk_ctx = function
+ | [app';c] -> mk_ctx (mkApp (app',[|c|]))
+ | _ -> assert false in
+ try_aux [(env, app); (env, Array.last lc)] mk_ctx next
| Case (ci,hd,c1,lc) ->
let next_mk_ctx = function
| c1 :: hd :: lc -> mk_ctx (mkCase (ci,hd,c1,Array.of_list lc))
@@ -488,29 +462,28 @@ let sub_match ?(partial_app=false) ?(closed=true) env sigma pat c =
in
let sub = (env, c1) :: (env, hd) :: subargs env lc in
try_aux sub next_mk_ctx next
- | Fix (indx,(names,types,bodies)) ->
+ | Fix (indx,(names,types,bodies as recdefs)) ->
let nb_fix = Array.length types in
let next_mk_ctx le =
let (ntypes,nbodies) = CList.chop nb_fix le in
mk_ctx (mkFix (indx,(names, Array.of_list ntypes, Array.of_list nbodies))) in
- let sub = subargs env types @ subargs env bodies in
+ let env' = push_rec_types recdefs env in
+ let sub = subargs env types @ subargs env' bodies in
try_aux sub next_mk_ctx next
- | CoFix (i,(names,types,bodies)) ->
+ | CoFix (i,(names,types,bodies as recdefs)) ->
let nb_fix = Array.length types in
let next_mk_ctx le =
let (ntypes,nbodies) = CList.chop nb_fix le in
mk_ctx (mkCoFix (i,(names, Array.of_list ntypes, Array.of_list nbodies))) in
- let sub = subargs env types @ subargs env bodies in
+ let env' = push_rec_types recdefs env in
+ let sub = subargs env types @ subargs env' bodies in
try_aux sub next_mk_ctx next
| Proj (p,c') ->
- let next_mk_ctx le = mk_ctx (mkProj (p,List.hd le)) in
- if partial_app then
- try
- let term = Retyping.expand_projection env sigma p c' [] in
- aux env term mk_ctx next
- with Retyping.RetypeError _ -> next ()
- else
- try_aux [env, c'] next_mk_ctx next
+ begin try
+ let term = Retyping.expand_projection env sigma p c' [] in
+ aux env term mk_ctx next
+ with Retyping.RetypeError _ -> next ()
+ end
| Construct _| Ind _|Evar _|Const _ | Rel _|Meta _|Var _|Sort _ ->
next ()
in
@@ -531,13 +504,7 @@ let sub_match ?(partial_app=false) ?(closed=true) env sigma pat c =
let result () = aux env c (fun x -> x) lempty in
IStream.thunk result
-let match_subterm env sigma pat c = sub_match env sigma (Id.Set.empty,pat) c
-
-let match_appsubterm env sigma pat c =
- sub_match ~partial_app:true env sigma (Id.Set.empty,pat) c
-
-let match_subterm_gen env sigma app pat c =
- sub_match ~partial_app:app env sigma pat c
+let match_subterm env sigma pat c = sub_match env sigma pat c
let is_matching env sigma pat c =
try let _ = matches env sigma pat c in true
@@ -549,12 +516,5 @@ let is_matching_head env sigma pat c =
let is_matching_appsubterm ?(closed=true) env sigma pat c =
let pat = (Id.Set.empty,pat) in
- let results = sub_match ~partial_app:true ~closed env sigma pat c in
+ let results = sub_match ~closed env sigma pat c in
not (IStream.is_empty results)
-
-let matches_conv env sigma p c =
- snd (matches_core_closed env sigma true false (Id.Set.empty,p) c)
-
-let is_matching_conv env sigma pat n =
- try let _ = matches_conv env sigma pat n in true
- with PatternMatchingFailure -> false
diff --git a/pretyping/constr_matching.mli b/pretyping/constr_matching.mli
index 34c62043e..e4d9ff9e1 100644
--- a/pretyping/constr_matching.mli
+++ b/pretyping/constr_matching.mli
@@ -9,7 +9,7 @@
(** This module implements pattern-matching on terms *)
open Names
-open Term
+open Constr
open EConstr
open Environ
open Pattern
@@ -55,38 +55,19 @@ val is_matching : env -> Evd.evar_map -> constr_pattern -> constr -> bool
prefix of it matches against [pat] *)
val is_matching_head : env -> Evd.evar_map -> constr_pattern -> constr -> bool
-(** [matches_conv env sigma] matches up to conversion in environment
- [(env,sigma)] when constants in pattern are concerned; it raises
- [PatternMatchingFailure] if not matchable; bindings are given in
- increasing order based on the numbers given in the pattern *)
-val matches_conv : env -> Evd.evar_map -> constr_pattern -> constr -> patvar_map
-
(** The type of subterm matching results: a substitution + a context
(whose hole is denoted here with [special_meta]) *)
type matching_result =
{ m_sub : bound_ident_map * patvar_map;
m_ctx : EConstr.t }
-(** [match_subterm n pat c] returns the substitution and the context
- corresponding to each **closed** subterm of [c] matching [pat]. *)
-val match_subterm : env -> Evd.evar_map -> constr_pattern -> constr -> matching_result IStream.t
-
-(** [match_appsubterm pat c] returns the substitution and the context
+(** [match_subterm pat c] returns the substitution and the context
corresponding to each **closed** subterm of [c] matching [pat],
considering application contexts as well. *)
-val match_appsubterm : env -> Evd.evar_map -> constr_pattern -> constr -> matching_result IStream.t
-
-(** [match_subterm_gen] calls either [match_subterm] or [match_appsubterm] *)
-val match_subterm_gen : env -> Evd.evar_map ->
- bool (** true = with app context *) ->
+val match_subterm : env -> Evd.evar_map ->
binding_bound_vars * constr_pattern -> constr ->
matching_result IStream.t
(** [is_matching_appsubterm pat c] tells if a subterm of [c] matches
against [pat] taking partial subterms into consideration *)
val is_matching_appsubterm : ?closed:bool -> env -> Evd.evar_map -> constr_pattern -> constr -> bool
-
-(** [is_matching_conv env sigma pat c] tells if [c] matches against [pat]
- up to conversion for constants in patterns *)
-val is_matching_conv :
- env -> Evd.evar_map -> constr_pattern -> constr -> bool
diff --git a/pretyping/detyping.ml b/pretyping/detyping.ml
index c02fc5aaf..754e88139 100644
--- a/pretyping/detyping.ml
+++ b/pretyping/detyping.ml
@@ -252,6 +252,89 @@ let lookup_index_as_renamed env sigma t n =
in lookup n 1 t
(**********************************************************************)
+(* Factorization of match patterns *)
+
+let print_factorize_match_patterns = ref true
+
+let _ =
+ let open Goptions in
+ declare_bool_option
+ { optdepr = false;
+ optname = "factorization of \"match\" patterns in printing";
+ optkey = ["Printing";"Factorizable";"Match";"Patterns"];
+ optread = (fun () -> !print_factorize_match_patterns);
+ optwrite = (fun b -> print_factorize_match_patterns := b) }
+
+let print_allow_match_default_clause = ref true
+
+let _ =
+ let open Goptions in
+ declare_bool_option
+ { optdepr = false;
+ optname = "possible use of \"match\" default pattern in printing";
+ optkey = ["Printing";"Allow";"Match";"Default";"Clause"];
+ optread = (fun () -> !print_allow_match_default_clause);
+ optwrite = (fun b -> print_allow_match_default_clause := b) }
+
+let rec join_eqns (ids,rhs as x) patll = function
+ | (loc,(ids',patl',rhs') as eqn')::rest ->
+ if not !Flags.raw_print && !print_factorize_match_patterns &&
+ List.eq_set Id.equal ids ids' && glob_constr_eq rhs rhs'
+ then
+ join_eqns x (patl'::patll) rest
+ else
+ let eqn,rest = join_eqns x patll rest in
+ eqn, eqn'::rest
+ | [] ->
+ patll, []
+
+let number_of_patterns (_gloc,(_ids,patll,_rhs)) = List.length patll
+
+let is_default_candidate (_gloc,(ids,_patll,_rhs) ) = ids = []
+
+let rec move_more_factorized_default_candidate_to_end eqn n = function
+ | eqn' :: eqns ->
+ let set,get = set_temporary_memory () in
+ if is_default_candidate eqn' && set (number_of_patterns eqn') >= n then
+ let isbest, dft, eqns = move_more_factorized_default_candidate_to_end eqn' (get ()) eqns in
+ if isbest then false, dft, eqns else false, dft, eqn' :: eqns
+ else
+ let isbest, dft, eqns = move_more_factorized_default_candidate_to_end eqn n eqns in
+ isbest, dft, eqn' :: eqns
+ | [] -> true, Some eqn, []
+
+let rec select_default_clause = function
+ | eqn :: eqns ->
+ let set,get = set_temporary_memory () in
+ if is_default_candidate eqn && set (number_of_patterns eqn) > 1 then
+ let isbest, dft, eqns = move_more_factorized_default_candidate_to_end eqn (get ()) eqns in
+ if isbest then dft, eqns else dft, eqn :: eqns
+ else
+ let dft, eqns = select_default_clause eqns in dft, eqn :: eqns
+ | [] -> None, []
+
+let factorize_eqns eqns =
+ let rec aux found = function
+ | (loc,(ids,patl,rhs))::rest ->
+ let patll,rest = join_eqns (ids,rhs) [patl] rest in
+ aux ((loc,(ids,patll,rhs))::found) rest
+ | [] ->
+ found in
+ let eqns = aux [] (List.rev eqns) in
+ let mk_anon patl = List.map (fun _ -> DAst.make @@ PatVar Anonymous) patl in
+ if not !Flags.raw_print && !print_allow_match_default_clause && eqns <> [] then
+ match select_default_clause eqns with
+ (* At least two clauses and the last one is disjunctive with no variables *)
+ | Some (gloc,([],patl::_::_,rhs)), (_::_ as eqns) -> eqns@[gloc,([],[mk_anon patl],rhs)]
+ (* Only one clause which is disjunctive with no variables: we keep at least one constructor *)
+ (* so that it is not interpreted as a dummy "match" *)
+ | Some (gloc,([],patl::patl'::_,rhs)), [] -> [gloc,([],[patl;mk_anon patl'],rhs)]
+ | Some (_,((_::_,_,_ | _,([]|[_]),_))), _ -> assert false
+ | None, eqns -> eqns
+ else
+ eqns
+
+(**********************************************************************)
(* Fragile algorithm to reverse pattern-matching compilation *)
let update_name sigma na ((_,(e,_)),c) =
@@ -284,13 +367,12 @@ let rec decomp_branch tags nal b (avoid,env as e) sigma c =
let rec build_tree na isgoal e sigma ci cl =
let mkpat n rhs pl = DAst.make @@ PatCstr((ci.ci_ind,n+1),pl,update_name sigma na rhs) in
let cnl = ci.ci_pp_info.cstr_tags in
- let cna = ci.ci_cstr_nargs in
List.flatten
(List.init (Array.length cl)
- (fun i -> contract_branch isgoal e sigma (cnl.(i),cna.(i),mkpat i,cl.(i))))
+ (fun i -> contract_branch isgoal e sigma (cnl.(i),mkpat i,cl.(i))))
and align_tree nal isgoal (e,c as rhs) sigma = match nal with
- | [] -> [[],rhs]
+ | [] -> [Id.Set.empty,[],rhs]
| na::nal ->
match EConstr.kind sigma c with
| Case (ci,p,c,cl) when
@@ -300,19 +382,20 @@ and align_tree nal isgoal (e,c as rhs) sigma = match nal with
computable sigma p (List.length ci.ci_pp_info.ind_tags) (* FIXME: can do better *) ->
let clauses = build_tree na isgoal e sigma ci cl in
List.flatten
- (List.map (fun (pat,rhs) ->
+ (List.map (fun (ids,pat,rhs) ->
let lines = align_tree nal isgoal rhs sigma in
- List.map (fun (hd,rest) -> pat::hd,rest) lines)
+ List.map (fun (ids',hd,rest) -> Id.Set.fold Id.Set.add ids ids',pat::hd,rest) lines)
clauses)
| _ ->
- let pat = DAst.make @@ PatVar(update_name sigma na rhs) in
- let mat = align_tree nal isgoal rhs sigma in
- List.map (fun (hd,rest) -> pat::hd,rest) mat
+ let na = update_name sigma na rhs in
+ let pat = DAst.make @@ PatVar na in
+ let mat = align_tree nal isgoal rhs sigma in
+ List.map (fun (ids,hd,rest) -> Nameops.Name.fold_right Id.Set.add na ids,pat::hd,rest) mat
-and contract_branch isgoal e sigma (cdn,can,mkpat,b) =
- let nal,rhs = decomp_branch cdn [] isgoal e sigma b in
+and contract_branch isgoal e sigma (cdn,mkpat,rhs) =
+ let nal,rhs = decomp_branch cdn [] isgoal e sigma rhs in
let mat = align_tree nal isgoal rhs sigma in
- List.map (fun (hd,rhs) -> (mkpat rhs hd,rhs)) mat
+ List.map (fun (ids,hd,rhs) -> ids,mkpat rhs hd,rhs) mat
(**********************************************************************)
(* Transform internal representation of pattern-matching into list of *)
@@ -414,15 +497,17 @@ let detype_case computable detype detype_eqns testdep avoid data p c bl =
let eqnl = detype_eqns constructs constagsl bl in
GCases (tag,pred,[tomatch,(alias,aliastyp)],eqnl)
+let detype_universe sigma u =
+ let fn (l, n) = Some (Termops.reference_of_level sigma l, n) in
+ Univ.Universe.map fn u
+
let detype_sort sigma = function
| Prop Null -> GProp
| Prop Pos -> GSet
| Type u ->
GType
(if !print_universes
- then
- let u = Pp.string_of_ppcmds (Univ.Universe.pr_with (Termops.pr_evd_level sigma) u) in
- [Loc.tag @@ Name.mk_name (Id.of_string_soft u)]
+ then detype_universe sigma u
else [])
type binder_kind = BProd | BLambda | BLetIn
@@ -434,8 +519,8 @@ let detype_anonymous = ref (fun ?loc n -> anomaly ~label:"detype" (Pp.str "index
let set_detype_anonymous f = detype_anonymous := f
let detype_level sigma l =
- let l = Pp.string_of_ppcmds (Termops.pr_evd_level sigma l) in
- GType (Some (Loc.tag @@ Name.mk_name (Id.of_string_soft l)))
+ let l = Termops.reference_of_level sigma l in
+ GType (UNamed l)
let detype_instance sigma l =
let l = EInstance.kind sigma l in
@@ -496,12 +581,7 @@ and detype_r d flags avoid env sigma t =
| Const (sp,u) -> GRef (ConstRef sp, detype_instance sigma u)
| Proj (p,c) ->
let noparams () =
- let pb = Environ.lookup_projection p (snd env) in
- let pars = pb.Declarations.proj_npars in
- let hole = DAst.make @@ GHole(Evar_kinds.InternalHole,Misctypes.IntroAnonymous,None) in
- let args = List.make pars hole in
- GApp (DAst.make @@ GRef (ConstRef (Projection.constant p), None),
- (args @ [detype d flags avoid env sigma c]))
+ GProj (p, detype d flags avoid env sigma c)
in
if fst flags || !Flags.in_debugger || !Flags.in_toplevel then
try noparams ()
@@ -554,7 +634,7 @@ and detype_r d flags avoid env sigma t =
let l = Evd.evar_instance_array (fun d c -> not !print_evar_arguments && (bound_to_itself_or_letin d c && not (isRel sigma c && Int.Set.mem (destRel sigma c) rels || isVar sigma c && (Id.Set.mem (destVar sigma c) fvs)))) (Evd.find sigma evk) cl in
id,l
with Not_found ->
- Id.of_string ("X" ^ string_of_int (Evar.repr evk)),
+ Id.of_string ("X" ^ string_of_int (Evar.repr evk)),
(Array.map_to_list (fun c -> (Id.of_string "__",c)) cl)
in
GEvar (id,
@@ -646,7 +726,7 @@ and detype_eqns d flags avoid env sigma ci computable constructs consnargsl bl =
try
if !Flags.raw_print || not (reverse_matching ()) then raise Exit;
let mat = build_tree Anonymous (snd flags) (avoid,env) sigma ci bl in
- List.map (fun (pat,((avoid,env),c)) -> Loc.tag ([],[pat],detype d flags avoid env sigma c))
+ List.map (fun (ids,pat,((avoid,env),c)) -> Loc.tag (Id.Set.elements ids,[pat],detype d flags avoid env sigma c))
mat
with e when CErrors.noncritical e ->
Array.to_list
@@ -917,6 +997,13 @@ let rec subst_glob_constr subst = DAst.map (function
let r1' = subst_glob_constr subst r1 in
let k' = Miscops.smartmap_cast_type (subst_glob_constr subst) k in
if r1' == r1 && k' == k then raw else GCast (r1',k')
+
+ | GProj (p,c) as raw ->
+ let kn = Projection.constant p in
+ let b = Projection.unfolded p in
+ let kn' = subst_constant subst kn in
+ let c' = subst_glob_constr subst c in
+ if kn' == kn && c' == c then raw else GProj(Projection.make kn' b, c')
)
(* Utilities to transform kernel cases to simple pattern-matching problem *)
diff --git a/pretyping/detyping.mli b/pretyping/detyping.mli
index f03bde68e..f150cb195 100644
--- a/pretyping/detyping.mli
+++ b/pretyping/detyping.mli
@@ -7,7 +7,6 @@
(************************************************************************)
open Names
-open Term
open Environ
open EConstr
open Glob_term
@@ -27,10 +26,20 @@ val print_universes : bool ref
(** If true, prints full local context of evars *)
val print_evar_arguments : bool ref
+(** If true, contract branches with same r.h.s. and same matching
+ variables in a disjunctive pattern *)
+val print_factorize_match_patterns : bool ref
+
+(** If true and the last non unique clause of a "match" is a
+ variable-free disjunctive pattern, turn it into a catch-call case *)
+val print_allow_match_default_clause : bool ref
+
val subst_cases_pattern : substitution -> cases_pattern -> cases_pattern
val subst_glob_constr : substitution -> glob_constr -> glob_constr
+val factorize_eqns : 'a cases_clauses_g -> 'a disjunctive_cases_clauses_g
+
(** [detype isgoal avoid ctx c] turns a closed [c], into a glob_constr
de Bruijn indexes are turned to bound names, avoiding names in [avoid]
[isgoal] tells if naming must avoid global-level synonyms as intro does
@@ -40,7 +49,7 @@ val detype_names : bool -> Id.Set.t -> names_context -> env -> evar_map -> const
val detype : 'a delay -> ?lax:bool -> bool -> Id.Set.t -> env -> evar_map -> constr -> 'a glob_constr_g
-val detype_sort : evar_map -> sorts -> glob_sort
+val detype_sort : evar_map -> Sorts.t -> glob_sort
val detype_rel_context : 'a delay -> ?lax:bool -> constr option -> Id.Set.t -> (names_context * env) ->
evar_map -> rel_context -> 'a glob_decl_g list
diff --git a/pretyping/evarconv.ml b/pretyping/evarconv.ml
index 0f1a508c8..41c4616f7 100644
--- a/pretyping/evarconv.ml
+++ b/pretyping/evarconv.ml
@@ -9,7 +9,7 @@
open CErrors
open Util
open Names
-open Term
+open Constr
open Termops
open Environ
open EConstr
@@ -48,8 +48,8 @@ let _ = Goptions.declare_bool_option {
"data.id.type" etc... *)
let impossible_default_case () =
let c, ctx = Universes.fresh_global_instance (Global.env()) (Globnames.ConstRef Coqlib.id) in
- let (_, u) = Term.destConst c in
- Some (c, Term.mkConstU (Coqlib.type_of_id, u), ctx)
+ let (_, u) = Constr.destConst c in
+ Some (c, Constr.mkConstU (Coqlib.type_of_id, u), ctx)
let coq_unit_judge =
let open Environ in
@@ -175,7 +175,7 @@ let check_conv_record env sigma (t1,sk1) (t2,sk2) =
| Sort s ->
let s = ESorts.kind sigma s in
lookup_canonical_conversion
- (proji, Sort_cs (family_of_sort s)),[]
+ (proji, Sort_cs (Sorts.family s)),[]
| Proj (p, c) ->
let c2 = Globnames.ConstRef (Projection.constant p) in
let c = Retyping.expand_projection env sigma p c [] in
@@ -218,6 +218,8 @@ let check_conv_record env sigma (t1,sk1) (t2,sk2) =
let t' = EConstr.of_constr t' in
let t' = subst_univs_level_constr subst t' in
let bs' = List.map (EConstr.of_constr %> subst_univs_level_constr subst) bs in
+ let params = List.map (fun c -> subst_univs_level_constr subst c) params in
+ let us = List.map (fun c -> subst_univs_level_constr subst c) us in
let h, _ = decompose_app_vect sigma t' in
ctx',(h, t2),c',bs',(Stack.append_app_list params Stack.empty,params1),
(Stack.append_app_list us Stack.empty,us2),(extra_args1,extra_args2),c1,
@@ -274,11 +276,6 @@ let rec ise_app_stack2 env f evd sk1 sk2 =
end
| _, _ -> (sk1,sk2), Success evd
-let push_rec_types pfix env =
- let (i, c, t) = pfix in
- let inj c = EConstr.Unsafe.to_constr c in
- push_rec_types (i, Array.map inj c, Array.map inj t) env
-
(* This function tries to unify 2 stacks element by element. It works
from the end to the beginning. If it unifies a non empty suffix of
stacks but not the entire stacks, the first part of the answer is
@@ -297,7 +294,7 @@ let ise_stack2 no_app env evd f sk1 sk2 =
| UnifFailure _ as x -> fail x)
| UnifFailure _ as x -> fail x)
| Stack.Proj (n1,a1,p1,_)::q1, Stack.Proj (n2,a2,p2,_)::q2 ->
- if eq_constant (Projection.constant p1) (Projection.constant p2)
+ if Constant.equal (Projection.constant p1) (Projection.constant p2)
then ise_stack2 true i q1 q2
else fail (UnifFailure (i, NotSameHead))
| Stack.Fix (((li1, i1),(_,tys1,bds1 as recdef1)),a1,_)::q1,
@@ -310,8 +307,6 @@ let ise_stack2 no_app env evd f sk1 sk2 =
| Success i' -> ise_stack2 true i' q1 q2
| UnifFailure _ as x -> fail x
else fail (UnifFailure (i,NotSameHead))
- | Stack.Update _ :: _, _ | Stack.Shift _ :: _, _
- | _, Stack.Update _ :: _ | _, Stack.Shift _ :: _ -> assert false
| Stack.App _ :: _, Stack.App _ :: _ ->
if no_app && deep then fail ((*dummy*)UnifFailure(i,NotSameHead)) else
begin match ise_app_stack2 env f i sk1 sk2 with
@@ -341,11 +336,9 @@ let exact_ise_stack2 env evd f sk1 sk2 =
(fun i -> ise_stack2 i a1 a2)]
else UnifFailure (i,NotSameHead)
| Stack.Proj (n1,a1,p1,_)::q1, Stack.Proj (n2,a2,p2,_)::q2 ->
- if eq_constant (Projection.constant p1) (Projection.constant p2)
+ if Constant.equal (Projection.constant p1) (Projection.constant p2)
then ise_stack2 i q1 q2
else (UnifFailure (i, NotSameHead))
- | Stack.Update _ :: _, _ | Stack.Shift _ :: _, _
- | _, Stack.Update _ :: _ | _, Stack.Shift _ :: _ -> assert false
| Stack.App _ :: _, Stack.App _ :: _ ->
begin match ise_app_stack2 env f i sk1 sk2 with
|_,(UnifFailure _ as x) -> x
@@ -457,7 +450,7 @@ and evar_eqappr_x ?(rhs_is_already_stuck = false) ts env evd pbty
let out1 = whd_betaiota_deltazeta_for_iota_state
(fst ts) env' evd Cst_stack.empty (c'1, Stack.empty) in
let out2 = whd_nored_state evd
- (Stack.zip evd (term', sk' @ [Stack.Shift 1]), Stack.append_app [|EConstr.mkRel 1|] Stack.empty),
+ (lift 1 (Stack.zip evd (term', sk')), Stack.append_app [|EConstr.mkRel 1|] Stack.empty),
Cst_stack.empty in
if onleft then evar_eqappr_x ts env' evd CONV out1 out2
else evar_eqappr_x ts env' evd CONV out2 out1
@@ -771,7 +764,7 @@ and evar_eqappr_x ?(rhs_is_already_stuck = false) ts env evd pbty
ise_try evd [f1; f2]
(* Catch the p.c ~= p c' cases *)
- | Proj (p,c), Const (p',u) when eq_constant (Projection.constant p) p' ->
+ | Proj (p,c), Const (p',u) when Constant.equal (Projection.constant p) p' ->
let res =
try Some (destApp evd (Retyping.expand_projection env evd p c []))
with Retyping.RetypeError _ -> None
@@ -782,7 +775,7 @@ and evar_eqappr_x ?(rhs_is_already_stuck = false) ts env evd pbty
(appr2,csts2)
| None -> UnifFailure (evd,NotSameHead))
- | Const (p,u), Proj (p',c') when eq_constant p (Projection.constant p') ->
+ | Const (p,u), Proj (p',c') when Constant.equal p (Projection.constant p') ->
let res =
try Some (destApp evd (Retyping.expand_projection env evd p' c' []))
with Retyping.RetypeError _ -> None
@@ -1046,7 +1039,7 @@ and conv_record trs env evd (ctx,(h,h2),c,bs,(params,params1),(us,us2),(sk1,sk2)
and eta_constructor ts env evd sk1 ((ind, i), u) sk2 term2 =
let mib = lookup_mind (fst ind) env in
match mib.Declarations.mind_record with
- | Some (Some (id, projs, pbs)) when mib.Declarations.mind_finite == Decl_kinds.BiFinite ->
+ | Some (Some (id, projs, pbs)) when mib.Declarations.mind_finite == Declarations.BiFinite ->
let pars = mib.Declarations.mind_nparams in
(try
let l1' = Stack.tail pars sk1 in
@@ -1067,8 +1060,8 @@ let evar_conv_x ts = evar_conv_x (ts, true)
(* Profiling *)
let evar_conv_x =
if Flags.profile then
- let evar_conv_xkey = Profile.declare_profile "evar_conv_x" in
- Profile.profile6 evar_conv_xkey evar_conv_x
+ let evar_conv_xkey = CProfile.declare_profile "evar_conv_x" in
+ CProfile.profile6 evar_conv_xkey evar_conv_x
else evar_conv_x
let evar_conv_hook_get, evar_conv_hook_set = Hook.make ~default:evar_conv_x ()
diff --git a/pretyping/evarconv.mli b/pretyping/evarconv.mli
index c30d1d26b..d793b06d3 100644
--- a/pretyping/evarconv.mli
+++ b/pretyping/evarconv.mli
@@ -47,7 +47,7 @@ val check_problems_are_solved : env -> evar_map -> unit
val check_conv_record : env -> evar_map ->
state -> state ->
- Univ.universe_context_set * (constr * constr)
+ Univ.ContextSet.t * (constr * constr)
* constr * constr list * (constr Stack.t * constr Stack.t) *
(constr Stack.t * constr Stack.t) *
(constr Stack.t * constr Stack.t) * constr *
diff --git a/pretyping/evardefine.ml b/pretyping/evardefine.ml
index 5f12f360b..fd83795f5 100644
--- a/pretyping/evardefine.ml
+++ b/pretyping/evardefine.ml
@@ -6,10 +6,11 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
+open Sorts
open Util
open Pp
open Names
-open Term
+open Constr
open Termops
open EConstr
open Vars
@@ -27,8 +28,8 @@ let env_nf_evar sigma env =
let env_nf_betaiotaevar sigma env =
process_rel_context
- (fun d e ->
- push_rel (RelDecl.map_constr (fun c -> Reductionops.nf_betaiota sigma c) d) e) env
+ (fun d env ->
+ push_rel (RelDecl.map_constr (fun c -> Reductionops.nf_betaiota env sigma c) d) env) env
(****************************************)
(* Operations on value/type constraints *)
@@ -82,7 +83,7 @@ let define_pure_evar_as_product evd evk =
let newenv = push_named (LocalAssum (id, dom)) evenv in
let src = evar_source evk evd1 in
let filter = Filter.extend 1 (evar_filter evi) in
- if is_prop_sort (ESorts.kind evd1 s) then
+ if Sorts.is_prop (ESorts.kind evd1 s) then
(* Impredicative product, conclusion must fall in [Prop]. *)
new_evar newenv evd1 concl ~src ~filter
else
diff --git a/pretyping/evardefine.mli b/pretyping/evardefine.mli
index 5477c5c99..869e3adbf 100644
--- a/pretyping/evardefine.mli
+++ b/pretyping/evardefine.mli
@@ -7,7 +7,6 @@
(************************************************************************)
open Names
-open Term
open EConstr
open Evd
open Environ
@@ -39,7 +38,7 @@ val lift_tycon : int -> type_constraint -> type_constraint
val define_evar_as_product : evar_map -> existential -> evar_map * types
val define_evar_as_lambda : env -> evar_map -> existential -> evar_map * types
-val define_evar_as_sort : env -> evar_map -> existential -> evar_map * sorts
+val define_evar_as_sort : env -> evar_map -> existential -> evar_map * Sorts.t
(** {6 debug pretty-printer:} *)
diff --git a/pretyping/evarsolve.ml b/pretyping/evarsolve.ml
index b906c3b59..e6d1e59b3 100644
--- a/pretyping/evarsolve.ml
+++ b/pretyping/evarsolve.ml
@@ -6,10 +6,11 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
+open Sorts
open Util
open CErrors
open Names
-open Term
+open Constr
open Environ
open Termops
open Evd
@@ -1391,7 +1392,7 @@ let occur_evar_upto_types sigma n c =
let c = EConstr.Unsafe.to_constr c in
let seen = ref Evar.Set.empty in
(** FIXME: Is that supposed to be evar-insensitive? *)
- let rec occur_rec c = match kind_of_term c with
+ let rec occur_rec c = match Constr.kind c with
| Evar (sp,_) when Evar.equal sp n -> raise Occur
| Evar (sp,args as e) ->
if Evar.Set.mem sp !seen then
diff --git a/pretyping/evarsolve.mli b/pretyping/evarsolve.mli
index 811b4dc18..703c4616c 100644
--- a/pretyping/evarsolve.mli
+++ b/pretyping/evarsolve.mli
@@ -6,7 +6,6 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-open Term
open EConstr
open Evd
open Environ
@@ -49,7 +48,7 @@ val refresh_universes :
env -> evar_map -> types -> evar_map * types
val solve_refl : ?can_drop:bool -> conv_fun_bool -> env -> evar_map ->
- bool option -> existential_key -> constr array -> constr array -> evar_map
+ bool option -> Evar.t -> constr array -> constr array -> evar_map
val solve_evar_evar : ?force:bool ->
(env -> evar_map -> bool option -> existential -> constr -> evar_map) ->
@@ -78,10 +77,10 @@ exception IllTypedInstance of env * types * types
(* May raise IllTypedInstance if types are not convertible *)
val check_evar_instance :
- evar_map -> existential_key -> constr -> conv_fun -> evar_map
+ evar_map -> Evar.t -> constr -> conv_fun -> evar_map
val remove_instance_local_defs :
- evar_map -> existential_key -> 'a array -> 'a list
+ evar_map -> Evar.t -> 'a array -> 'a list
val get_type_of_refresh :
?polyprop:bool -> ?lax:bool -> env -> evar_map -> constr -> evar_map * types
diff --git a/pretyping/find_subterm.ml b/pretyping/find_subterm.ml
index 9e7652da6..fd6bfe0a2 100644
--- a/pretyping/find_subterm.ml
+++ b/pretyping/find_subterm.ml
@@ -12,7 +12,6 @@ open CErrors
open Names
open Locus
open EConstr
-open Nameops
open Termops
open Pretype_errors
@@ -30,7 +29,7 @@ let explain_invalid_occurrence l =
++ prlist_with_sep spc int l ++ str "."
let explain_incorrect_in_value_occurrence id =
- pr_id id ++ str " has no value."
+ Id.print id ++ str " has no value."
let explain_occurrence_error = function
| InvalidOccurrence l -> explain_invalid_occurrence l
diff --git a/engine/geninterp.ml b/pretyping/geninterp.ml
index 768ef3cfd..768ef3cfd 100644
--- a/engine/geninterp.ml
+++ b/pretyping/geninterp.ml
diff --git a/engine/geninterp.mli b/pretyping/geninterp.mli
index ae0b26e59..ae0b26e59 100644
--- a/engine/geninterp.mli
+++ b/pretyping/geninterp.mli
diff --git a/pretyping/glob_ops.ml b/pretyping/glob_ops.ml
index 055fd68f6..a21137a05 100644
--- a/pretyping/glob_ops.ml
+++ b/pretyping/glob_ops.ml
@@ -133,8 +133,10 @@ let mk_glob_constr_eq f c1 c2 = match DAst.get c1, DAst.get c2 with
Miscops.intro_pattern_naming_eq nam1 nam2
| GCast (c1, t1), GCast (c2, t2) ->
f c1 c2 && cast_type_eq f t1 t2
+ | GProj (p1, t1), GProj (p2, t2) ->
+ Projection.equal p1 p2 && f t1 t2
| (GRef _ | GVar _ | GEvar _ | GPatVar _ | GApp _ | GLambda _ | GProd _ | GLetIn _ |
- GCases _ | GLetTuple _ | GIf _ | GRec _ | GSort _ | GHole _ | GCast _), _ -> false
+ GCases _ | GLetTuple _ | GIf _ | GRec _ | GSort _ | GHole _ | GCast _ | GProj _), _ -> false
let rec glob_constr_eq c = mk_glob_constr_eq glob_constr_eq c
@@ -180,6 +182,8 @@ let map_glob_constr_left_to_right f = DAst.map (function
let comp1 = f c in
let comp2 = Miscops.map_cast_type f k in
GCast (comp1,comp2)
+ | GProj (p,c) ->
+ GProj (p, f c)
| (GVar _ | GSort _ | GHole _ | GRef _ | GEvar _ | GPatVar _) as x -> x
)
@@ -212,6 +216,8 @@ let fold_glob_constr f acc = DAst.with_val (function
let acc = match k with
| CastConv t | CastVM t | CastNative t -> f acc t | CastCoerce -> acc in
f acc c
+ | GProj(_,c) ->
+ f acc c
| (GSort _ | GHole _ | GRef _ | GEvar _ | GPatVar _) -> acc
)
@@ -253,6 +259,8 @@ let fold_glob_constr_with_binders g f v acc = DAst.(with_val (function
let acc = match k with
| CastConv t | CastVM t | CastNative t -> f v acc t | CastCoerce -> acc in
f v acc c
+ | GProj(_,c) ->
+ f v acc c
| (GSort _ | GHole _ | GRef _ | GEvar _ | GPatVar _) -> acc))
let iter_glob_constr f = fold_glob_constr (fun () -> f) ()
@@ -290,7 +298,7 @@ let warn_variable_collision =
let open Pp in
CWarnings.create ~name:"variable-collision" ~category:"ltac"
(fun name ->
- strbrk "Collision between bound variables of name " ++ pr_id name)
+ strbrk "Collision between bound variables of name " ++ Id.print name)
let add_and_check_ident id set =
if Id.Set.mem id set then warn_variable_collision id;
@@ -524,7 +532,7 @@ let ltac_interp_name { ltac_idents ; ltac_genargs } = function
try Name (Id.Map.find id ltac_idents)
with Not_found ->
if Id.Map.mem id ltac_genargs then
- user_err (str"Ltac variable"++spc()++ pr_id id ++
+ user_err (str"Ltac variable"++spc()++ Id.print id ++
spc()++str"is not bound to an identifier."++spc()++
str"It cannot be used in a binder.")
else n
diff --git a/pretyping/glob_ops.mli b/pretyping/glob_ops.mli
index f27928662..9dd7068cb 100644
--- a/pretyping/glob_ops.mli
+++ b/pretyping/glob_ops.mli
@@ -64,7 +64,7 @@ val rename_glob_vars : (Id.t * Id.t) list -> 'a glob_constr_g -> 'a glob_constr_
here by its relevant components [m] and [c]. It is used to
interpret Ltac-bound names both in pretyping and printing of
terms. *)
-val map_pattern_binders : (name -> name) ->
+val map_pattern_binders : (Name.t -> Name.t) ->
tomatch_tuples -> cases_clauses -> (tomatch_tuples*cases_clauses)
(** [map_pattern f m c] applies [f] to the return predicate and the
@@ -84,5 +84,5 @@ val glob_constr_of_closed_cases_pattern : 'a cases_pattern_g -> Name.t * 'a glob
val add_patterns_for_params_remove_local_defs : constructor -> 'a cases_pattern_g list -> 'a cases_pattern_g list
-val ltac_interp_name : Ltac_pretype.ltac_var_map -> Names.name -> Names.name
+val ltac_interp_name : Ltac_pretype.ltac_var_map -> Name.t -> Name.t
val empty_lvar : Ltac_pretype.ltac_var_map
diff --git a/pretyping/indrec.ml b/pretyping/indrec.ml
index aced42f83..b7b5b1662 100644
--- a/pretyping/indrec.ml
+++ b/pretyping/indrec.ml
@@ -18,6 +18,7 @@ open Libnames
open Globnames
open Nameops
open Term
+open Constr
open Vars
open Namegen
open Declarations
@@ -33,7 +34,7 @@ type dep_flag = bool
(* Errors related to recursors building *)
type recursion_scheme_error =
- | NotAllowedCaseAnalysis of (*isrec:*) bool * sorts * pinductive
+ | NotAllowedCaseAnalysis of (*isrec:*) bool * Sorts.t * pinductive
| NotMutualInScheme of inductive * inductive
| NotAllowedDependentAnalysis of (*isrec:*) bool * inductive
@@ -168,7 +169,7 @@ let type_rec_branch is_rec dep env sigma (vargs,depPvect,decP) tyi cs recargs =
let p',largs = whd_allnolet_stack env sigma (EConstr.of_constr p) in
let p' = EConstr.Unsafe.to_constr p' in
let largs = List.map EConstr.Unsafe.to_constr largs in
- match kind_of_term p' with
+ match kind p' with
| Prod (n,t,c) ->
let d = LocalAssum (n,t) in
make_prod env (n,t,prec (push_rel d env) (i+1) (d::sign) c)
@@ -186,13 +187,13 @@ let type_rec_branch is_rec dep env sigma (vargs,depPvect,decP) tyi cs recargs =
| _ ->
let t' = whd_all env sigma (EConstr.of_constr p) in
let t' = EConstr.Unsafe.to_constr t' in
- if Term.eq_constr p' t' then assert false
+ if Constr.equal p' t' then assert false
else prec env i sign t'
in
prec env 0 []
in
let rec process_constr env i c recargs nhyps li =
- if nhyps > 0 then match kind_of_term c with
+ if nhyps > 0 then match kind c with
| Prod (n,t,c_0) ->
let (optionpos,rest) =
match recargs with
@@ -247,7 +248,7 @@ let make_rec_branch_arg env sigma (nparrec,fvect,decF) f cstr recargs =
let p',largs = whd_allnolet_stack env sigma (EConstr.of_constr p) in
let p' = EConstr.Unsafe.to_constr p' in
let largs = List.map EConstr.Unsafe.to_constr largs in
- match kind_of_term p' with
+ match kind p' with
| Prod (n,t,c) ->
let d = LocalAssum (n,t) in
mkLambda_name env (n,t,prec (push_rel d env) (i+1) (d::hyps) c)
@@ -261,7 +262,7 @@ let make_rec_branch_arg env sigma (nparrec,fvect,decF) f cstr recargs =
| _ ->
let t' = whd_all env sigma (EConstr.of_constr p) in
let t' = EConstr.Unsafe.to_constr t' in
- if Term.eq_constr t' p' then assert false
+ if Constr.equal t' p' then assert false
else prec env i hyps t'
in
prec env 0 []
@@ -505,7 +506,7 @@ let build_case_analysis_scheme_default env sigma pity kind =
[rec] by [s] *)
let change_sort_arity sort =
- let rec drec a = match kind_of_term a with
+ let rec drec a = match kind a with
| Cast (c,_,_) -> drec c
| Prod (n,t,c) -> let s, c' = drec c in s, mkProd (n, t, c')
| LetIn (n,b,t,c) -> let s, c' = drec c in s, mkLetIn (n,b,t,c')
@@ -519,7 +520,7 @@ let change_sort_arity sort =
let weaken_sort_scheme env evd set sort npars term ty =
let evdref = ref evd in
let rec drec np elim =
- match kind_of_term elim with
+ match kind elim with
| Prod (n,t,c) ->
if Int.equal np 0 then
let osort, t' = change_sort_arity sort t in
@@ -566,7 +567,7 @@ let build_mutual_induction_scheme env sigma = function
(List.map
(function ((mind',u'),dep',s') ->
let (sp',_) = mind' in
- if eq_mind sp sp' then
+ if MutInd.equal sp sp' then
let (mibi',mipi') = lookup_mind_specif env mind' in
((mind',u'),mibi',mipi',dep',s')
else
@@ -605,7 +606,7 @@ let lookup_eliminator ind_sp s =
(* Try first to get an eliminator defined in the same section as the *)
(* inductive type *)
try
- let cst =Global.constant_of_delta_kn (make_kn mp dp (Label.of_id id)) in
+ let cst =Global.constant_of_delta_kn (KerName.make mp dp (Label.of_id id)) in
let _ = Global.lookup_constant cst in
ConstRef cst
with Not_found ->
@@ -615,7 +616,7 @@ let lookup_eliminator ind_sp s =
with Not_found ->
user_err ~hdr:"default_elim"
(strbrk "Cannot find the elimination combinator " ++
- pr_id id ++ strbrk ", the elimination of the inductive definition " ++
+ Id.print id ++ strbrk ", the elimination of the inductive definition " ++
pr_global_env Id.Set.empty (IndRef ind_sp) ++
strbrk " on sort " ++ Termops.pr_sort_family s ++
strbrk " is probably not allowed.")
diff --git a/pretyping/indrec.mli b/pretyping/indrec.mli
index 2825c4d83..a9838cffe 100644
--- a/pretyping/indrec.mli
+++ b/pretyping/indrec.mli
@@ -7,14 +7,14 @@
(************************************************************************)
open Names
-open Term
+open Constr
open Environ
open Evd
(** Errors related to recursors building *)
type recursion_scheme_error =
- | NotAllowedCaseAnalysis of (*isrec:*) bool * sorts * pinductive
+ | NotAllowedCaseAnalysis of (*isrec:*) bool * Sorts.t * pinductive
| NotMutualInScheme of inductive * inductive
| NotAllowedDependentAnalysis of (*isrec:*) bool * inductive
@@ -27,25 +27,25 @@ type dep_flag = bool
(** Build a case analysis elimination scheme in some sort family *)
val build_case_analysis_scheme : env -> Evd.evar_map -> pinductive ->
- dep_flag -> sorts_family -> evar_map * Constr.t
+ dep_flag -> Sorts.family -> evar_map * Constr.t
(** Build a dependent case elimination predicate unless type is in Prop
or is a recursive record with primitive projections. *)
val build_case_analysis_scheme_default : env -> evar_map -> pinductive ->
- sorts_family -> evar_map * Constr.t
+ Sorts.family -> evar_map * Constr.t
(** Builds a recursive induction scheme (Peano-induction style) in the same
sort family as the inductive family; it is dependent if not in Prop
or a recursive record with primitive projections. *)
val build_induction_scheme : env -> evar_map -> pinductive ->
- dep_flag -> sorts_family -> evar_map * constr
+ dep_flag -> Sorts.family -> evar_map * constr
(** Builds mutual (recursive) induction schemes *)
val build_mutual_induction_scheme :
- env -> evar_map -> (pinductive * dep_flag * sorts_family) list -> evar_map * constr list
+ env -> evar_map -> (pinductive * dep_flag * Sorts.family) list -> evar_map * constr list
(** Scheme combinators *)
@@ -54,13 +54,13 @@ val build_mutual_induction_scheme :
scheme quantified on sort [s]. [set] asks for [s] be declared equal to [i],
otherwise just less or equal to [i]. *)
-val weaken_sort_scheme : env -> evar_map -> bool -> sorts -> int -> constr -> types ->
+val weaken_sort_scheme : env -> evar_map -> bool -> Sorts.t -> int -> constr -> types ->
evar_map * types * constr
(** Recursor names utilities *)
-val lookup_eliminator : inductive -> sorts_family -> Globnames.global_reference
-val elimination_suffix : sorts_family -> string
-val make_elimination_ident : Id.t -> sorts_family -> Id.t
+val lookup_eliminator : inductive -> Sorts.family -> Globnames.global_reference
+val elimination_suffix : Sorts.family -> string
+val make_elimination_ident : Id.t -> Sorts.family -> Id.t
val case_suffix : string
diff --git a/pretyping/inductiveops.ml b/pretyping/inductiveops.ml
index b31ee03d8..78e6bc6f1 100644
--- a/pretyping/inductiveops.ml
+++ b/pretyping/inductiveops.ml
@@ -11,6 +11,7 @@ open Util
open Names
open Univ
open Term
+open Constr
open Vars
open Termops
open Declarations
@@ -274,7 +275,7 @@ let projection_nparams p = projection_nparams_env (Global.env ()) p
let has_dependent_elim mib =
match mib.mind_record with
- | Some (Some _) -> mib.mind_finite == Decl_kinds.BiFinite
+ | Some (Some _) -> mib.mind_finite == BiFinite
| _ -> true
(* Annotation for cases *)
@@ -485,7 +486,7 @@ let find_inductive env sigma c =
let (t, l) = decompose_app sigma (whd_all env sigma c) in
match EConstr.kind sigma t with
| Ind ind
- when (fst (Inductive.lookup_mind_specif env (fst ind))).mind_finite <> Decl_kinds.CoFinite ->
+ when (fst (Inductive.lookup_mind_specif env (fst ind))).mind_finite <> CoFinite ->
let l = List.map EConstr.Unsafe.to_constr l in
(ind, l)
| _ -> raise Not_found
@@ -495,7 +496,7 @@ let find_coinductive env sigma c =
let (t, l) = decompose_app sigma (whd_all env sigma c) in
match EConstr.kind sigma t with
| Ind ind
- when (fst (Inductive.lookup_mind_specif env (fst ind))).mind_finite == Decl_kinds.CoFinite ->
+ when (fst (Inductive.lookup_mind_specif env (fst ind))).mind_finite == CoFinite ->
let l = List.map EConstr.Unsafe.to_constr l in
(ind, l)
| _ -> raise Not_found
@@ -643,7 +644,7 @@ let type_of_projection_knowing_arg env sigma p c ty =
syntactic conditions *)
let control_only_guard env c =
- let check_fix_cofix e c = match kind_of_term c with
+ let check_fix_cofix e c = match kind c with
| CoFix (_,(_,_,_) as cofix) ->
Inductive.check_cofix e cofix
| Fix (_,(_,_,_) as fix) ->
@@ -659,7 +660,7 @@ let control_only_guard env c =
(* inference of subtyping condition for inductive types *)
let infer_inductive_subtyping_arity_constructor
- (env, evd, csts) (subst : constr -> constr) (arcn : Term.types) is_arity (params : Context.Rel.t) =
+ (env, evd, csts) (subst : constr -> constr) (arcn : types) is_arity (params : Context.Rel.t) =
let numchecked = ref 0 in
let numparams = Context.Rel.nhyps params in
let update_contexts (env, evd, csts) csts' =
diff --git a/pretyping/inductiveops.mli b/pretyping/inductiveops.mli
index aa38d3b47..58b1ce6c3 100644
--- a/pretyping/inductiveops.mli
+++ b/pretyping/inductiveops.mli
@@ -7,7 +7,7 @@
(************************************************************************)
open Names
-open Term
+open Constr
open Declarations
open Environ
open Evd
@@ -28,8 +28,8 @@ val arities_of_constructors : env -> pinductive -> types array
reasoning either with only recursively uniform parameters or with all
parameters including the recursively non-uniform ones *)
type inductive_family
-val make_ind_family : inductive puniverses * constr list -> inductive_family
-val dest_ind_family : inductive_family -> inductive puniverses * constr list
+val make_ind_family : inductive Univ.puniverses * constr list -> inductive_family
+val dest_ind_family : inductive_family -> inductive Univ.puniverses * constr list
val map_ind_family : (constr -> constr) -> inductive_family -> inductive_family
val liftn_inductive_family : int -> int -> inductive_family -> inductive_family
val lift_inductive_family : int -> inductive_family -> inductive_family
@@ -120,7 +120,7 @@ val constructor_nrealdecls_env : env -> constructor -> int
val constructor_has_local_defs : constructor -> bool
val inductive_has_local_defs : inductive -> bool
-val allowed_sorts : env -> inductive -> sorts_family list
+val allowed_sorts : env -> inductive -> Sorts.family list
(** (Co)Inductive records with primitive projections do not have eta-conversion,
hence no dependent elimination. *)
@@ -147,17 +147,17 @@ val get_constructor :
pinductive * mutual_inductive_body * one_inductive_body * constr list ->
int -> constructor_summary
val get_constructors : env -> inductive_family -> constructor_summary array
-val get_projections : env -> inductive_family -> constant array option
+val get_projections : env -> inductive_family -> Constant.t array option
(** [get_arity] returns the arity of the inductive family instantiated
with the parameters; if recursively non-uniform parameters are not
part of the inductive family, they appears in the arity *)
-val get_arity : env -> inductive_family -> Context.Rel.t * sorts_family
+val get_arity : env -> inductive_family -> Context.Rel.t * Sorts.family
val build_dependent_constructor : constructor_summary -> constr
val build_dependent_inductive : env -> inductive_family -> constr
val make_arity_signature : env -> evar_map -> bool -> inductive_family -> EConstr.rel_context
-val make_arity : env -> evar_map -> bool -> inductive_family -> sorts -> EConstr.types
+val make_arity : env -> evar_map -> bool -> inductive_family -> Sorts.t -> EConstr.types
val build_branch_type : env -> evar_map -> bool -> constr -> constructor_summary -> types
(** Raise [Not_found] if not given a valid inductive type *)
@@ -172,7 +172,7 @@ val find_coinductive : env -> evar_map -> EConstr.types -> (inductive * EConstr.
(** Builds the case predicate arity (dependent or not) *)
val arity_of_case_predicate :
- env -> inductive_family -> bool -> sorts -> types
+ env -> inductive_family -> bool -> Sorts.t -> types
val type_case_branches_with_names :
env -> evar_map -> pinductive * EConstr.constr list -> constr -> constr -> types array * types
@@ -195,7 +195,7 @@ i*)
(********************)
val type_of_inductive_knowing_conclusion :
- env -> evar_map -> Inductive.mind_specif puniverses -> EConstr.types -> evar_map * EConstr.types
+ env -> evar_map -> Inductive.mind_specif Univ.puniverses -> EConstr.types -> evar_map * EConstr.types
(********************)
val control_only_guard : env -> types -> unit
@@ -203,8 +203,8 @@ val control_only_guard : env -> types -> unit
(* inference of subtyping condition for inductive types *)
(* for debugging purposes only to be removed *)
val infer_inductive_subtyping_arity_constructor : Environ.env * Evd.evar_map * Univ.Constraint.t ->
-(Term.constr -> Term.constr) ->
-Term.types -> bool -> Context.Rel.t -> Environ.env * Evd.evar_map * Univ.Constraint.t
+(constr -> constr) ->
+types -> bool -> Context.Rel.t -> Environ.env * Evd.evar_map * Univ.Constraint.t
val infer_inductive_subtyping : Environ.env -> Evd.evar_map -> Entries.mutual_inductive_entry ->
Entries.mutual_inductive_entry
diff --git a/pretyping/miscops.ml b/pretyping/miscops.ml
index bc563b46d..f0cb8fd1f 100644
--- a/pretyping/miscops.ml
+++ b/pretyping/miscops.ml
@@ -30,7 +30,8 @@ let smartmap_cast_type f c =
let glob_sort_eq g1 g2 = match g1, g2 with
| GProp, GProp -> true
| GSet, GSet -> true
-| GType l1, GType l2 -> List.equal (fun x y -> Names.Name.equal (snd x) (snd y)) l1 l2
+| GType l1, GType l2 ->
+ List.equal (Option.equal (fun (x,m) (y,n) -> Libnames.eq_reference x y && Int.equal m n)) l1 l2
| _ -> false
let intro_pattern_naming_eq nam1 nam2 = match nam1, nam2 with
diff --git a/pretyping/nativenorm.ml b/pretyping/nativenorm.ml
index fe134f512..b41e15f5a 100644
--- a/pretyping/nativenorm.ml
+++ b/pretyping/nativenorm.ml
@@ -7,6 +7,7 @@
(************************************************************************)
open CErrors
open Term
+open Constr
open Vars
open Environ
open Reduction
@@ -98,7 +99,7 @@ let app_type env c =
let find_rectype_a env c =
let (t, l) = app_type env c in
- match kind_of_term t with
+ match kind t with
| Ind ind -> (ind, l)
| _ -> raise Not_found
@@ -131,7 +132,7 @@ let construct_of_constr_notnative const env tag (mind, _ as ind) u allargs =
let construct_of_constr const env tag typ =
let t, l = app_type env typ in
- match kind_of_term t with
+ match kind t with
| Ind (ind,u) ->
construct_of_constr_notnative const env tag ind u l
| _ -> assert false
@@ -223,7 +224,7 @@ and nf_accu env sigma accu =
if Int.equal (accu_nargs accu) 0 then nf_atom env sigma atom
else
let a,typ = nf_atom_type env sigma atom in
- let _, args = nf_args env sigma accu typ in
+ let _, args = nf_args env sigma (args_of_accu accu) typ in
mkApp(a,Array.of_list args)
and nf_accu_type env sigma accu =
@@ -231,10 +232,10 @@ and nf_accu_type env sigma accu =
if Int.equal (accu_nargs accu) 0 then nf_atom_type env sigma atom
else
let a,typ = nf_atom_type env sigma atom in
- let t, args = nf_args env sigma accu typ in
+ let t, args = nf_args env sigma (args_of_accu accu) typ in
mkApp(a,Array.of_list args), t
-and nf_args env sigma accu t =
+and nf_args env sigma args t =
let aux arg (t,l) =
let _,dom,codom =
try decompose_prod env t with
@@ -245,7 +246,7 @@ and nf_args env sigma accu t =
let c = nf_val env sigma arg dom in
(subst1 c codom, c::l)
in
- let t,l = List.fold_right aux (args_of_accu accu) (t,[]) in
+ let t,l = Array.fold_right aux args (t,[]) in
t, List.rev l
and nf_bargs env sigma b t =
@@ -276,7 +277,6 @@ and nf_atom env sigma atom =
let codom = nf_type env sigma (codom vn) in
mkProd(n,dom,codom)
| Ameta (mv,_) -> mkMeta mv
- | Aevar (ev,_) -> mkEvar ev
| Aproj(p,c) ->
let c = nf_accu env sigma c in
mkProj(Projection.make p true,c)
@@ -346,9 +346,9 @@ and nf_atom_type env sigma atom =
let env = push_rel (LocalAssum (n,dom)) env in
let codom,s2 = nf_type_sort env sigma (codom vn) in
mkProd(n,dom,codom), Typeops.type_of_product env n s1 s2
- | Aevar(ev,ty) ->
- let ty = nf_type env sigma ty in
- mkEvar ev, ty
+ | Aevar(evk,ty,args) ->
+ let ty = nf_type env sigma ty in
+ nf_evar env sigma evk ty args
| Ameta(mv,ty) ->
let ty = nf_type env sigma ty in
mkMeta mv, ty
@@ -360,7 +360,7 @@ and nf_atom_type env sigma atom =
and nf_predicate env sigma ind mip params v pT =
- match kind_of_value v, kind_of_term pT with
+ match kind_of_value v, kind pT with
| Vfun f, Prod _ ->
let k = nb_rel env in
let vb = f (mk_rel_accu k) in
@@ -385,6 +385,19 @@ and nf_predicate env sigma ind mip params v pT =
true, mkLambda(name,dom,body)
| _, _ -> false, nf_type env sigma v
+and nf_evar env sigma evk ty args =
+ let evi = try Evd.find sigma evk with Not_found -> assert false in
+ let hyps = Environ.named_context_of_val (Evd.evar_filtered_hyps evi) in
+ if List.is_empty hyps then begin
+ assert (Int.equal (Array.length args) 0);
+ mkEvar (evk, [||]), ty
+ end
+ else
+ let fold accu d = Term.mkNamedProd_or_LetIn d accu in
+ let t = List.fold_left fold ty hyps in
+ let ty, args = nf_args env sigma args t in
+ mkEvar (evk, Array.of_list args), ty
+
let evars_of_evar_map sigma =
{ Nativelambda.evars_val = Evd.existential_opt_value sigma;
Nativelambda.evars_typ = Evd.existential_type sigma;
@@ -435,11 +448,11 @@ let stop_profiler m_pid =
match profiler_platform() with
"Unix (Linux)" -> stop_profiler_linux m_pid
| _ -> ()
-
+
let native_norm env sigma c ty =
let c = EConstr.Unsafe.to_constr c in
let ty = EConstr.Unsafe.to_constr ty in
- if Coq_config.no_native_compiler then
+ if not Coq_config.native_compiler then
user_err Pp.(str "Native_compute reduction has been disabled at configure time.")
else
let penv = Environ.pre_env env in
diff --git a/pretyping/patternops.ml b/pretyping/patternops.ml
index aaa946706..1bec4a6f1 100644
--- a/pretyping/patternops.ml
+++ b/pretyping/patternops.ml
@@ -12,6 +12,7 @@ open Names
open Globnames
open Nameops
open Term
+open Constr
open Vars
open Glob_term
open Pp
@@ -58,7 +59,11 @@ let rec constr_pattern_eq p1 p2 = match p1, p2 with
fixpoint_eq f1 f2
| PCoFix f1, PCoFix f2 ->
cofixpoint_eq f1 f2
-| _ -> false
+| PProj (p1, t1), PProj (p2, t2) ->
+ Projection.equal p1 p2 && constr_pattern_eq t1 t2
+| (PRef _ | PVar _ | PEvar _ | PRel _ | PApp _ | PSoApp _
+ | PLambda _ | PProd _ | PLetIn _ | PSort _ | PMeta _
+ | PIf _ | PCase _ | PFix _ | PCoFix _ | PProj _), _ -> false
(** FIXME: fixpoint and cofixpoint should be relativized to pattern *)
and pattern_eq (i1, j1, p1) (i2, j2, p2) =
@@ -75,8 +80,8 @@ and cofixpoint_eq (i1, r1) (i2, r2) =
and rec_declaration_eq (n1, c1, r1) (n2, c2, r2) =
Array.equal Name.equal n1 n2 &&
- Array.equal Term.eq_constr c1 c2 &&
- Array.equal Term.eq_constr r1 r2
+ Array.equal Constr.equal c1 c2 &&
+ Array.equal Constr.equal r1 r2
let rec occur_meta_pattern = function
| PApp (f,args) ->
@@ -132,8 +137,7 @@ let rec head_pattern_bound t =
| PCase (_,p,c,br) -> head_pattern_bound c
| PRef r -> r
| PVar id -> VarRef id
- | PProj (p,c) -> ConstRef (Projection.constant p)
- | PEvar _ | PRel _ | PMeta _ | PSoApp _ | PSort _ | PFix _
+ | PEvar _ | PRel _ | PMeta _ | PSoApp _ | PSort _ | PFix _ | PProj _
-> raise BoundPattern
(* Perhaps they were arguments, but we don't beta-reduce *)
| PLambda _ -> raise BoundPattern
@@ -149,7 +153,7 @@ let head_of_constr_reference sigma c = match EConstr.kind sigma c with
let pattern_of_constr env sigma t =
let rec pattern_of_constr env t =
let open Context.Rel.Declaration in
- match kind_of_term t with
+ match kind t with
| Rel n -> PRel n
| Meta n -> PMeta (Some (Id.of_string ("META" ^ string_of_int n)))
| Var id -> PVar id
@@ -165,7 +169,7 @@ let pattern_of_constr env sigma t =
pattern_of_constr (push_rel (LocalAssum (na, c)) env) b)
| App (f,a) ->
(match
- match kind_of_term f with
+ match kind f with
| Evar (evk,args) ->
(match snd (Evd.evar_source evk sigma) with
Evar_kinds.MatchingVar (Evar_kinds.SecondOrderPatVar id) -> Some id
@@ -174,7 +178,7 @@ let pattern_of_constr env sigma t =
with
| Some n -> PSoApp (n,Array.to_list (Array.map (pattern_of_constr env) a))
| None -> PApp (pattern_of_constr env f,Array.map (pattern_of_constr env) a))
- | Const (sp,u) -> PRef (ConstRef (constant_of_kn(canonical_con sp)))
+ | Const (sp,u) -> PRef (ConstRef (Constant.make1 (Constant.canonical sp)))
| Ind (sp,u) -> PRef (canonical_gr (IndRef sp))
| Construct (sp,u) -> PRef (canonical_gr (ConstructRef sp))
| Proj (p, c) ->
@@ -229,8 +233,8 @@ let error_instantiate_pattern id l =
| [_] -> "is"
| _ -> "are"
in
- user_err (str "Cannot substitute the term bound to " ++ pr_id id
- ++ strbrk " in pattern because the term refers to " ++ pr_enum pr_id l
+ user_err (str "Cannot substitute the term bound to " ++ Id.print id
+ ++ strbrk " in pattern because the term refers to " ++ pr_enum Id.print l
++ strbrk " which " ++ str is ++ strbrk " not bound in the pattern.")
let instantiate_pattern env sigma lvar c =
@@ -441,8 +445,11 @@ let rec pat_of_raw metas vars = DAst.with_loc_val (fun ?loc -> function
one non-trivial branch. These facts are used in [Constrextern]. *)
PCase (info, pred, pat_of_raw metas vars c, brs)
- | r -> err ?loc (Pp.str "Non supported pattern.")
- )
+ | GProj(p,c) ->
+ PProj(p, pat_of_raw metas vars c)
+
+ | GPatVar _ | GIf _ | GLetTuple _ | GCases _ | GEvar _ | GRec _ ->
+ err ?loc (Pp.str "Non supported pattern."))
and pats_of_glob_branches loc metas vars ind brs =
let get_arg p = match DAst.get p with
diff --git a/pretyping/pretype_errors.ml b/pretyping/pretype_errors.ml
index 54b477bed..7149d62a1 100644
--- a/pretyping/pretype_errors.ml
+++ b/pretyping/pretype_errors.ml
@@ -7,20 +7,19 @@
(************************************************************************)
open Names
-open Term
open Environ
open EConstr
open Type_errors
type unification_error =
- | OccurCheck of existential_key * constr
+ | OccurCheck of Evar.t * constr
| NotClean of existential * env * constr (* Constr is a variable not in scope *)
| NotSameArgSize
| NotSameHead
| NoCanonicalStructure
| ConversionFailed of env * constr * constr (* Non convertible closed terms *)
- | MetaOccurInBody of existential_key
- | InstanceNotSameType of existential_key * env * types * types
+ | MetaOccurInBody of Evar.t
+ | InstanceNotSameType of Evar.t * env * types * types
| UnifUnivInconsistency of Univ.univ_inconsistency
| CannotSolveConstraint of Evd.evar_constraint * unification_error
| ProblemBeyondCapabilities
@@ -39,8 +38,8 @@ type pretype_error =
(* Type inference unification *)
| ActualTypeNotCoercible of unsafe_judgment * types * unification_error
(* Tactic unification *)
- | UnifOccurCheck of existential_key * constr
- | UnsolvableImplicit of existential_key * Evd.unsolvability_explanation option
+ | UnifOccurCheck of Evar.t * constr
+ | UnsolvableImplicit of Evar.t * Evd.unsolvability_explanation option
| CannotUnify of constr * constr * unification_error option
| CannotUnifyLocal of constr * constr * constr
| CannotUnifyBindingType of constr * constr
@@ -57,7 +56,7 @@ type pretype_error =
| TypingError of type_error
| CannotUnifyOccurrences of subterm_unification_error
| UnsatisfiableConstraints of
- (existential_key * Evar_kinds.t) option * Evar.Set.t option
+ (Evar.t * Evar_kinds.t) option * Evar.Set.t option
exception PretypeError of env * Evd.evar_map * pretype_error
diff --git a/pretyping/pretype_errors.mli b/pretyping/pretype_errors.mli
index 124fa6e06..430755ea0 100644
--- a/pretyping/pretype_errors.mli
+++ b/pretyping/pretype_errors.mli
@@ -7,7 +7,7 @@
(************************************************************************)
open Names
-open Term
+open Constr
open Environ
open EConstr
open Type_errors
@@ -15,14 +15,14 @@ open Type_errors
(** {6 The type of errors raised by the pretyper } *)
type unification_error =
- | OccurCheck of existential_key * constr
+ | OccurCheck of Evar.t * constr
| NotClean of existential * env * constr
| NotSameArgSize
| NotSameHead
| NoCanonicalStructure
| ConversionFailed of env * constr * constr
- | MetaOccurInBody of existential_key
- | InstanceNotSameType of existential_key * env * types * types
+ | MetaOccurInBody of Evar.t
+ | InstanceNotSameType of Evar.t * env * types * types
| UnifUnivInconsistency of Univ.univ_inconsistency
| CannotSolveConstraint of Evd.evar_constraint * unification_error
| ProblemBeyondCapabilities
@@ -41,8 +41,8 @@ type pretype_error =
(** Type inference unification *)
| ActualTypeNotCoercible of unsafe_judgment * types * unification_error
(** Tactic Unification *)
- | UnifOccurCheck of existential_key * constr
- | UnsolvableImplicit of existential_key * Evd.unsolvability_explanation option
+ | UnifOccurCheck of Evar.t * constr
+ | UnsolvableImplicit of Evar.t * Evd.unsolvability_explanation option
| CannotUnify of constr * constr * unification_error option
| CannotUnifyLocal of constr * constr * constr
| CannotUnifyBindingType of constr * constr
@@ -59,7 +59,7 @@ type pretype_error =
| TypingError of type_error
| CannotUnifyOccurrences of subterm_unification_error
| UnsatisfiableConstraints of
- (existential_key * Evar_kinds.t) option * Evar.Set.t option
+ (Evar.t * Evar_kinds.t) option * Evar.Set.t option
(** unresolvable evar, connex component *)
exception PretypeError of env * Evd.evar_map * pretype_error
@@ -99,8 +99,8 @@ val error_ill_typed_rec_body :
val error_elim_arity :
?loc:Loc.t -> env -> Evd.evar_map ->
- pinductive -> sorts_family list -> constr ->
- unsafe_judgment -> (sorts_family * sorts_family * arity_error) option -> 'b
+ pinductive -> Sorts.family list -> constr ->
+ unsafe_judgment -> (Sorts.family * Sorts.family * arity_error) option -> 'b
val error_not_a_type :
?loc:Loc.t -> env -> Evd.evar_map -> unsafe_judgment -> 'b
@@ -112,10 +112,10 @@ val error_cannot_coerce : env -> Evd.evar_map -> constr * constr -> 'b
(** {6 Implicit arguments synthesis errors } *)
-val error_occur_check : env -> Evd.evar_map -> existential_key -> constr -> 'b
+val error_occur_check : env -> Evd.evar_map -> Evar.t -> constr -> 'b
val error_unsolvable_implicit :
- ?loc:Loc.t -> env -> Evd.evar_map -> existential_key ->
+ ?loc:Loc.t -> env -> Evd.evar_map -> Evar.t ->
Evd.unsolvability_explanation option -> 'b
val error_cannot_unify : ?loc:Loc.t -> env -> Evd.evar_map ->
@@ -154,7 +154,7 @@ val error_var_not_found : ?loc:Loc.t -> Id.t -> 'b
(** {6 Typeclass errors } *)
-val unsatisfiable_constraints : env -> Evd.evar_map -> Evd.evar option ->
+val unsatisfiable_constraints : env -> Evd.evar_map -> Evar.t option ->
Evar.Set.t option -> 'a
val unsatisfiable_exception : exn -> bool
diff --git a/pretyping/pretyping.ml b/pretyping/pretyping.ml
index b2b583ba7..8809558ff 100644
--- a/pretyping/pretyping.ml
+++ b/pretyping/pretyping.ml
@@ -70,7 +70,7 @@ let get_extra env sigma =
let ids = List.map get_id (named_context env) in
let avoid = List.fold_right Id.Set.add ids Id.Set.empty in
Context.Rel.fold_outside (fun d acc -> push_rel_decl_to_named_context sigma d acc)
- (rel_context env) ~init:(empty_csubst, [], avoid, named_context env)
+ (rel_context env) ~init:(empty_csubst, avoid, named_context env)
let make_env env sigma = { env = env; extra = lazy (get_extra env sigma) }
let rel_context env = rel_context env.env
@@ -90,12 +90,11 @@ let push_rel_context sigma ctx env = {
let lookup_named id env = lookup_named id env.env
let e_new_evar env evdref ?src ?naming typ =
- let subst2 subst vsubst c = csubst_subst subst (replace_vars vsubst c) in
let open Context.Named.Declaration in
let inst_vars = List.map (get_id %> mkVar) (named_context env.env) in
let inst_rels = List.rev (rel_list 0 (nb_rel env.env)) in
- let (subst, vsubst, _, nc) = Lazy.force env.extra in
- let typ' = subst2 subst vsubst typ in
+ let (subst, _, nc) = Lazy.force env.extra in
+ let typ' = csubst_subst subst typ in
let instance = inst_rels @ inst_vars in
let sign = val_of_named_context nc in
let sigma = !evdref in
@@ -177,53 +176,79 @@ let _ =
optwrite = (:=) Universes.set_minimization })
(** Miscellaneous interpretation functions *)
-let interp_universe_level_name ~anon_rigidity evd (loc, s) =
- match s with
- | Anonymous ->
- new_univ_level_variable ?loc anon_rigidity evd
- | Name s ->
- let s = Id.to_string s in
- let names, _ = Global.global_universe_names () in
- if CString.string_contains ~where:s ~what:"." then
- match List.rev (CString.split '.' s) with
- | [] -> anomaly (str"Invalid universe name " ++ str s ++ str".")
- | n :: dp ->
- let num = int_of_string n in
- let dp = DirPath.make (List.map Id.of_string dp) in
- let level = Univ.Level.make dp num in
- let evd =
- try Evd.add_global_univ evd level
- with UGraph.AlreadyDeclared -> evd
- in evd, level
- else
- try
- let level = Evd.universe_of_name evd s in
- evd, level
- with Not_found ->
- try
- let id = try Id.of_string s with _ -> raise Not_found in
- evd, snd (Id.Map.find id names)
- with Not_found ->
- if not (is_strict_universe_declarations ()) then
- new_univ_level_variable ?loc ~name:s univ_rigid evd
- else user_err ?loc ~hdr:"interp_universe_level_name"
- (Pp.(str "Undeclared universe: " ++ str s))
+
+let interp_known_universe_level evd r =
+ let loc, qid = Libnames.qualid_of_reference r in
+ try
+ match r with
+ | Libnames.Ident (loc, id) -> Evd.universe_of_name evd id
+ | Libnames.Qualid _ -> raise Not_found
+ with Not_found ->
+ let univ, k = Nametab.locate_universe qid in
+ Univ.Level.make univ k
+
+let interp_universe_level_name ~anon_rigidity evd r =
+ try evd, interp_known_universe_level evd r
+ with Not_found ->
+ match r with (* Qualified generated name *)
+ | Libnames.Qualid (loc, qid) ->
+ let dp, i = Libnames.repr_qualid qid in
+ let num =
+ try int_of_string (Id.to_string i)
+ with Failure _ ->
+ user_err ?loc ~hdr:"interp_universe_level_name"
+ (Pp.(str "Undeclared global universe: " ++ Libnames.pr_reference r))
+ in
+ let level = Univ.Level.make dp num in
+ let evd =
+ try Evd.add_global_univ evd level
+ with UGraph.AlreadyDeclared -> evd
+ in evd, level
+ | Libnames.Ident (loc, id) -> (* Undeclared *)
+ if not (is_strict_universe_declarations ()) then
+ new_univ_level_variable ?loc ~name:id univ_rigid evd
+ else user_err ?loc ~hdr:"interp_universe_level_name"
+ (Pp.(str "Undeclared universe: " ++ Id.print id))
let interp_universe ?loc evd = function
| [] -> let evd, l = new_univ_level_variable ?loc univ_rigid evd in
evd, Univ.Universe.make l
| l ->
- List.fold_left (fun (evd, u) l ->
- (* [univ_flexible_alg] can produce algebraic universes in terms *)
- let evd', l = interp_universe_level_name ~anon_rigidity:univ_flexible evd l in
- (evd', Univ.sup u (Univ.Universe.make l)))
+ List.fold_left (fun (evd, u) l ->
+ let evd', u' =
+ match l with
+ | Some (l,n) ->
+ (* [univ_flexible_alg] can produce algebraic universes in terms *)
+ let anon_rigidity = univ_flexible in
+ let evd', l = interp_universe_level_name ~anon_rigidity evd l in
+ let u' = Univ.Universe.make l in
+ (match n with
+ | 0 -> evd', u'
+ | 1 -> evd', Univ.Universe.super u'
+ | _ ->
+ user_err ?loc ~hdr:"interp_universe"
+ (Pp.(str "Cannot interpret universe increment +" ++ int n)))
+ | None ->
+ let evd, l = new_univ_level_variable ?loc univ_flexible evd in
+ evd, Univ.Universe.make l
+ in (evd', Univ.sup u u'))
(evd, Univ.Universe.type0m) l
+let interp_known_level_info ?loc evd = function
+ | UUnknown | UAnonymous ->
+ user_err ?loc ~hdr:"interp_known_level_info"
+ (str "Anonymous universes not allowed here.")
+ | UNamed ref ->
+ try interp_known_universe_level evd ref
+ with Not_found ->
+ user_err ?loc ~hdr:"interp_known_level_info" (str "Undeclared universe " ++ Libnames.pr_reference ref)
+
let interp_level_info ?loc evd : Misctypes.level_info -> _ = function
- | None -> new_univ_level_variable ?loc univ_rigid evd
- | Some (loc,s) -> interp_universe_level_name ~anon_rigidity:univ_flexible evd (Loc.tag ?loc s)
+ | UUnknown -> new_univ_level_variable ?loc univ_rigid evd
+ | UAnonymous -> new_univ_level_variable ?loc univ_flexible evd
+ | UNamed s -> interp_universe_level_name ~anon_rigidity:univ_flexible evd s
-type inference_hook = env -> evar_map -> evar -> evar_map * constr
+type inference_hook = env -> evar_map -> Evar.t -> evar_map * constr
type inference_flags = {
use_typeclasses : bool;
@@ -382,9 +407,9 @@ let check_instance loc subst = function
| [] -> ()
| (id,_) :: _ ->
if List.mem_assoc id subst then
- user_err ?loc (pr_id id ++ str "appears more than once.")
+ user_err ?loc (Id.print id ++ str "appears more than once.")
else
- user_err ?loc (str "No such variable in the signature of the existential variable: " ++ pr_id id ++ str ".")
+ user_err ?loc (str "No such variable in the signature of the existential variable: " ++ Id.print id ++ str ".")
(* used to enforce a name in Lambda when the type constraints itself
is named, hence possibly dependent *)
@@ -410,8 +435,8 @@ let invert_ltac_bound_name lvar env id0 id =
let id' = Id.Map.find id lvar.ltac_idents in
try mkRel (pi1 (lookup_rel_id id' (rel_context env)))
with Not_found ->
- user_err (str "Ltac variable " ++ pr_id id0 ++
- str " depends on pattern variable name " ++ pr_id id ++
+ user_err (str "Ltac variable " ++ Id.print id0 ++
+ str " depends on pattern variable name " ++ Id.print id ++
str " which is not bound in current context.")
let protected_get_type_of env sigma c =
@@ -454,7 +479,7 @@ let pretype_id pretype k0 loc env evdref lvar id =
if Id.Map.mem id lvar.ltac_genargs then begin
let Geninterp.Val.Dyn (typ, _) = Id.Map.find id lvar.ltac_genargs in
user_err ?loc
- (str "Variable " ++ pr_id id ++ str " should be bound to a term but is \
+ (str "Variable " ++ Id.print id ++ str " should be bound to a term but is \
bound to a " ++ Geninterp.Val.pr typ ++ str ".")
end;
(* Check if [id] is a section or goal variable *)
@@ -467,6 +492,11 @@ let pretype_id pretype k0 loc env evdref lvar id =
(*************************************************************************)
(* Main pretyping function *)
+let interp_known_glob_level ?loc evd = function
+ | GProp -> Univ.Level.prop
+ | GSet -> Univ.Level.set
+ | GType s -> interp_known_level_info ?loc evd s
+
let interp_glob_level ?loc evd : Misctypes.glob_level -> _ = function
| GProp -> evd, Univ.Level.prop
| GSet -> evd, Univ.Level.set
@@ -707,6 +737,11 @@ let rec pretype k0 resolve_tc (tycon : type_constraint) (env : ExtraEnv.t) evdre
let j = pretype_sort ?loc evdref s in
inh_conv_coerce_to_tycon ?loc env evdref j tycon
+ | GProj (p, c) ->
+ (* TODO: once GProj is used as an input syntax, use bidirectional typing here *)
+ let cj = pretype empty_tycon env evdref lvar c in
+ judge_of_projection env.ExtraEnv.env !evdref p cj
+
| GApp (f,args) ->
let fj = pretype empty_tycon env evdref lvar f in
let floc = loc_of_glob_constr f in
@@ -1089,7 +1124,7 @@ and pretype_instance k0 resolve_tc env evdref lvar loc hyps evk update =
with Not_found ->
user_err ?loc (str "Cannot interpret " ++
pr_existential_key !evdref evk ++
- str " in current context: no binding for " ++ pr_id id ++ str ".") in
+ str " in current context: no binding for " ++ Id.print id ++ str ".") in
((id,c)::subst, update) in
let subst,inst = List.fold_right f hyps ([],update) in
check_instance loc subst inst;
diff --git a/pretyping/pretyping.mli b/pretyping/pretyping.mli
index 6537d1ecf..fe10be9e7 100644
--- a/pretyping/pretyping.mli
+++ b/pretyping/pretyping.mli
@@ -12,13 +12,16 @@
into elementary ones, insertion of coercions and resolution of
implicit arguments. *)
-open Term
+open Constr
open Environ
open Evd
open EConstr
open Glob_term
-open Evarutil
open Ltac_pretype
+open Evardefine
+
+val interp_known_glob_level : ?loc:Loc.t -> Evd.evar_map ->
+ Misctypes.glob_level -> Univ.Level.t
(** An auxiliary function for searching for fixpoint guard indexes *)
@@ -27,7 +30,7 @@ val search_guard :
type typing_constraint = OfType of types | IsType | WithoutTypeConstraint
-type inference_hook = env -> evar_map -> evar -> evar_map * constr
+type inference_hook = env -> evar_map -> Evar.t -> evar_map * constr
type inference_flags = {
use_typeclasses : bool;
diff --git a/pretyping/pretyping.mllib b/pretyping/pretyping.mllib
index 9904b7354..1da5b4567 100644
--- a/pretyping/pretyping.mllib
+++ b/pretyping/pretyping.mllib
@@ -1,3 +1,4 @@
+Geninterp
Ltac_pretype
Locusops
Pretype_errors
diff --git a/pretyping/recordops.ml b/pretyping/recordops.ml
index e970a1db9..9ff9a75b3 100644
--- a/pretyping/recordops.ml
+++ b/pretyping/recordops.ml
@@ -19,7 +19,7 @@ open Pp
open Names
open Globnames
open Nametab
-open Term
+open Constr
open Libobject
open Mod_subst
open Reductionops
@@ -37,7 +37,7 @@ type struc_typ = {
s_CONST : constructor;
s_EXPECTEDPARAM : int;
s_PROJKIND : (Name.t * bool) list;
- s_PROJ : constant option list }
+ s_PROJ : Constant.t option list }
let structure_table =
Summary.ref (Indmap.empty : struc_typ Indmap.t) ~name:"record-structs"
@@ -48,7 +48,7 @@ let projection_table =
is the inductive always (fst constructor) ? It seems so... *)
type struc_tuple =
- inductive * constructor * (Name.t * bool) list * constant option list
+ inductive * constructor * (Name.t * bool) list * Constant.t option list
let load_structure i (_,(ind,id,kl,projs)) =
let n = (fst (Global.lookup_inductive ind)).Declarations.mind_nparams in
@@ -144,7 +144,7 @@ type obj_typ = {
type cs_pattern =
Const_cs of global_reference
| Prod_cs
- | Sort_cs of sorts_family
+ | Sort_cs of Sorts.family
| Default_cs
let eq_cs_pattern p1 p2 = match p1, p2 with
@@ -172,7 +172,7 @@ let keep_true_projections projs kinds =
List.map_filter filter (List.combine projs kinds)
let cs_pattern_of_constr env t =
- match kind_of_term t with
+ match kind t with
App (f,vargs) ->
begin
try Const_cs (global_of_constr f) , None, Array.to_list vargs
@@ -184,7 +184,7 @@ let cs_pattern_of_constr env t =
let { Environ.uj_type = ty } = Typeops.infer env c in
let _, params = Inductive.find_rectype env ty in
Const_cs (ConstRef (Projection.constant p)), None, params @ [c]
- | Sort s -> Sort_cs (family_of_sort s), None, []
+ | Sort s -> Sort_cs (Sorts.family s), None, []
| _ ->
begin
try Const_cs (global_of_constr t) , None, []
@@ -286,7 +286,7 @@ let subst_canonical_structure (subst,(cst,ind as obj)) =
let discharge_canonical_structure (_,(cst,ind)) =
Some (Lib.discharge_con cst,Lib.discharge_inductive ind)
-let inCanonStruc : constant * inductive -> obj =
+let inCanonStruc : Constant.t * inductive -> obj =
declare_object {(default_object "CANONICAL-STRUCTURE") with
open_function = open_canonical_structure;
cache_function = cache_canonical_structure;
@@ -300,7 +300,7 @@ let add_canonical_structure x = Lib.add_anonymous_leaf (inCanonStruc x)
let error_not_structure ref =
user_err ~hdr:"object_declare"
- (Nameops.pr_id (basename_of_global ref) ++ str" is not a structure object.")
+ (Id.print (basename_of_global ref) ++ str" is not a structure object.")
let check_and_decompose_canonical_structure ref =
let sp = match ref with ConstRef sp -> sp | _ -> error_not_structure ref in
@@ -311,10 +311,10 @@ let check_and_decompose_canonical_structure ref =
| None -> error_not_structure ref in
let body = snd (splay_lam (Global.env()) Evd.empty (EConstr.of_constr vc)) (** FIXME *) in
let body = EConstr.Unsafe.to_constr body in
- let f,args = match kind_of_term body with
+ let f,args = match kind body with
| App (f,args) -> f,args
| _ -> error_not_structure ref in
- let indsp = match kind_of_term f with
+ let indsp = match kind f with
| Construct ((indsp,1),u) -> indsp
| _ -> error_not_structure ref in
let s = try lookup_structure indsp with Not_found -> error_not_structure ref in
diff --git a/pretyping/recordops.mli b/pretyping/recordops.mli
index 8e2333b34..f15418577 100644
--- a/pretyping/recordops.mli
+++ b/pretyping/recordops.mli
@@ -7,7 +7,7 @@
(************************************************************************)
open Names
-open Term
+open Constr
open Globnames
(** Operations concerning records and canonical structures *)
@@ -20,10 +20,10 @@ type struc_typ = {
s_CONST : constructor;
s_EXPECTEDPARAM : int;
s_PROJKIND : (Name.t * bool) list;
- s_PROJ : constant option list }
+ s_PROJ : Constant.t option list }
type struc_tuple =
- inductive * constructor * (Name.t * bool) list * constant option list
+ inductive * constructor * (Name.t * bool) list * Constant.t option list
val declare_structure : struc_tuple -> unit
@@ -35,7 +35,7 @@ val lookup_structure : inductive -> struc_typ
(** [lookup_projections isp] returns the projections associated to the
inductive path [isp] if it corresponds to a structure, otherwise
it fails with [Not_found] *)
-val lookup_projections : inductive -> constant option list
+val lookup_projections : inductive -> Constant.t option list
(** raise [Not_found] if not a projection *)
val find_projection_nparams : global_reference -> int
@@ -52,7 +52,7 @@ val find_projection : global_reference -> struc_typ
type cs_pattern =
Const_cs of global_reference
| Prod_cs
- | Sort_cs of sorts_family
+ | Sort_cs of Sorts.family
| Default_cs
type obj_typ = {
diff --git a/pretyping/reductionops.ml b/pretyping/reductionops.ml
index 2aa2f9013..1893018a9 100644
--- a/pretyping/reductionops.ml
+++ b/pretyping/reductionops.ml
@@ -9,7 +9,7 @@
open CErrors
open Util
open Names
-open Term
+open Constr
open Termops
open Univ
open Evd
@@ -121,10 +121,10 @@ module ReductionBehaviour = struct
let r' = fst (subst_global subst r) in if r==r' then orig else (r',o)
let discharge = function
- | _,(ReqGlobal (ConstRef c, req), (_, b)) ->
+ | _,(ReqGlobal (ConstRef c as gr, req), (_, b)) ->
let b =
- if Lib.is_in_section (ConstRef c) then
- let vars, _, _ = Lib.section_segment_of_constant c in
+ if Lib.is_in_section gr then
+ let vars = Lib.variable_section_segment_of_reference gr in
let extra = List.length vars in
let nargs' =
if b.b_nargs = max_int then max_int
@@ -284,8 +284,6 @@ sig
| Proj of int * int * projection * Cst_stack.t
| Fix of ('a, 'a) pfixpoint * 'a t * Cst_stack.t
| Cst of cst_member * int * int list * 'a t * Cst_stack.t
- | Shift of int
- | Update of 'a
and 'a t = 'a member list
exception IncompatibleFold2
@@ -296,12 +294,12 @@ sig
val append_app : 'a array -> 'a t -> 'a t
val decomp : 'a t -> ('a * 'a t) option
val decomp_node_last : 'a app_node -> 'a t -> ('a * 'a t)
- val equal : ('a * int -> 'a * int -> bool) -> (('a, 'a) pfixpoint * int -> ('a, 'a) pfixpoint * int -> bool)
- -> 'a t -> 'a t -> (int * int) option
+ val equal : ('a -> 'a -> bool) -> (('a, 'a) pfixpoint -> ('a, 'a) pfixpoint -> bool)
+ -> 'a t -> 'a t -> bool
val compare_shape : 'a t -> 'a t -> bool
val map : ('a -> 'a) -> 'a t -> 'a t
val fold2 : ('a -> constr -> constr -> 'a) -> 'a ->
- constr t -> constr t -> 'a * int * int
+ constr t -> constr t -> 'a
val append_app_list : 'a list -> 'a t -> 'a t
val strip_app : 'a t -> 'a t * 'a t
val strip_n_app : int -> 'a t -> ('a t * 'a * 'a t) option
@@ -339,12 +337,10 @@ struct
type 'a member =
| App of 'a app_node
- | Case of Term.case_info * 'a * 'a array * Cst_stack.t
+ | Case of case_info * 'a * 'a array * Cst_stack.t
| Proj of int * int * projection * Cst_stack.t
| Fix of ('a, 'a) pfixpoint * 'a t * Cst_stack.t
| Cst of cst_member * int * int list * 'a t * Cst_stack.t
- | Shift of int
- | Update of 'a
and 'a t = 'a member list
let rec pr_member pr_c member =
@@ -358,7 +354,7 @@ struct
++ str ")"
| Proj (n,m,p,cst) ->
str "ZProj(" ++ int n ++ pr_comma () ++ int m ++
- pr_comma () ++ pr_con (Projection.constant p) ++ str ")"
+ pr_comma () ++ Constant.print (Projection.constant p) ++ str ")"
| Fix (f,args,cst) ->
str "ZFix(" ++ Termops.pr_fix pr_c f
++ pr_comma () ++ pr pr_c args ++ str ")"
@@ -367,8 +363,6 @@ struct
++ pr_comma () ++
prlist_with_sep pr_semicolon int remains ++
pr_comma () ++ pr pr_c params ++ str ")"
- | Shift i -> str "ZShift(" ++ int i ++ str ")"
- | Update t -> str "ZUpdate(" ++ pr_c t ++ str ")"
and pr pr_c l =
let open Pp in
prlist_with_sep pr_semicolon (fun x -> hov 1 (pr_member pr_c x)) l
@@ -403,54 +397,42 @@ struct
else (l.(j), sk)
let equal f f_fix sk1 sk2 =
- let equal_cst_member x lft1 y lft2 =
+ let equal_cst_member x y =
match x, y with
| Cst_const (c1,u1), Cst_const (c2, u2) ->
- Constant.equal c1 c2 && Univ.Instance.equal u1 u2
+ Constant.equal c1 c2 && Univ.Instance.equal u1 u2
| Cst_proj p1, Cst_proj p2 ->
- Constant.equal (Projection.constant p1) (Projection.constant p2)
+ Constant.equal (Projection.constant p1) (Projection.constant p2)
| _, _ -> false
in
- let rec equal_rec sk1 lft1 sk2 lft2 =
+ let rec equal_rec sk1 sk2 =
match sk1,sk2 with
- | [],[] -> Some (lft1,lft2)
- | (Update _ :: _, _ | _, Update _ :: _) -> assert false
- | Shift k :: s1, _ -> equal_rec s1 (lft1+k) sk2 lft2
- | _, Shift k :: s2 -> equal_rec sk1 lft1 s2 (lft2+k)
+ | [],[] -> true
| App a1 :: s1, App a2 :: s2 ->
- let t1,s1' = decomp_node_last a1 s1 in
- let t2,s2' = decomp_node_last a2 s2 in
- if f (t1,lft1) (t2,lft2) then equal_rec s1' lft1 s2' lft2 else None
+ let t1,s1' = decomp_node_last a1 s1 in
+ let t2,s2' = decomp_node_last a2 s2 in
+ (f t1 t2) && (equal_rec s1' s2')
| Case (_,t1,a1,_) :: s1, Case (_,t2,a2,_) :: s2 ->
- if f (t1,lft1) (t2,lft2) && CArray.equal (fun x y -> f (x,lft1) (y,lft2)) a1 a2
- then equal_rec s1 lft1 s2 lft2
- else None
+ f t1 t2 && CArray.equal (fun x y -> f x y) a1 a2 && equal_rec s1 s2
| (Proj (n1,m1,p,_)::s1, Proj(n2,m2,p2,_)::s2) ->
- if Int.equal n1 n2 && Int.equal m1 m2
- && Constant.equal (Projection.constant p) (Projection.constant p2)
- then equal_rec s1 lft1 s2 lft2
- else None
+ Int.equal n1 n2 && Int.equal m1 m2
+ && Constant.equal (Projection.constant p) (Projection.constant p2)
+ && equal_rec s1 s2
| Fix (f1,s1,_) :: s1', Fix (f2,s2,_) :: s2' ->
- if f_fix (f1,lft1) (f2,lft2) then
- match equal_rec (List.rev s1) lft1 (List.rev s2) lft2 with
- | None -> None
- | Some (lft1',lft2') -> equal_rec s1' lft1' s2' lft2'
- else None
+ f_fix f1 f2
+ && equal_rec (List.rev s1) (List.rev s2)
+ && equal_rec s1' s2'
| Cst (c1,curr1,remains1,params1,_)::s1', Cst (c2,curr2,remains2,params2,_)::s2' ->
- if equal_cst_member c1 lft1 c2 lft2 then
- match equal_rec (List.rev params1) lft1 (List.rev params2) lft2 with
- | Some (lft1',lft2') -> equal_rec s1' lft1' s2' lft2'
- | None -> None
- else None
- | ((App _|Case _|Proj _|Fix _|Cst _)::_|[]), _ -> None
- in equal_rec (List.rev sk1) 0 (List.rev sk2) 0
+ equal_cst_member c1 c2
+ && equal_rec (List.rev params1) (List.rev params2)
+ && equal_rec s1' s2'
+ | ((App _|Case _|Proj _|Fix _|Cst _)::_|[]), _ -> false
+ in equal_rec (List.rev sk1) (List.rev sk2)
let compare_shape stk1 stk2 =
let rec compare_rec bal stk1 stk2 =
match (stk1,stk2) with
([],[]) -> Int.equal bal 0
- | ((Update _|Shift _)::s1, _) -> compare_rec bal s1 stk2
- | (_, (Update _|Shift _)::s2) -> compare_rec bal stk1 s2
| (App (i,_,j)::s1, _) -> compare_rec (bal + j + 1 - i) s1 stk2
| (_, App (i,_,j)::s2) -> compare_rec (bal - j - 1 + i) stk1 s2
| (Case(c1,_,_,_)::s1, Case(c2,_,_,_)::s2) ->
@@ -466,40 +448,29 @@ struct
exception IncompatibleFold2
let fold2 f o sk1 sk2 =
- let rec aux o lft1 sk1 lft2 sk2 =
- let fold_array =
- Array.fold_left2 (fun a x y -> f a (Vars.lift lft1 x) (Vars.lift lft2 y))
- in
+ let rec aux o sk1 sk2 =
match sk1,sk2 with
- | [], [] -> o,lft1,lft2
- | Shift n :: q1, _ -> aux o (lft1+n) q1 lft2 sk2
- | _, Shift n :: q2 -> aux o lft1 sk1 (lft2+n) q2
+ | [], [] -> o
| App n1 :: q1, App n2 :: q2 ->
- let t1,l1 = decomp_node_last n1 q1 in
- let t2,l2 = decomp_node_last n2 q2 in
- aux (f o (Vars.lift lft1 t1) (Vars.lift lft2 t2))
- lft1 l1 lft2 l2
+ let t1,l1 = decomp_node_last n1 q1 in
+ let t2,l2 = decomp_node_last n2 q2 in
+ aux (f o t1 t2) l1 l2
| Case (_,t1,a1,_) :: q1, Case (_,t2,a2,_) :: q2 ->
- aux (fold_array
- (f o (Vars.lift lft1 t1) (Vars.lift lft2 t2))
- a1 a2) lft1 q1 lft2 q2
+ aux (Array.fold_left2 f (f o t1 t2) a1 a2) q1 q2
| Proj (n1,m1,p1,_) :: q1, Proj (n2,m2,p2,_) :: q2 ->
- aux o lft1 q1 lft2 q2
+ aux o q1 q2
| Fix ((_,(_,a1,b1)),s1,_) :: q1, Fix ((_,(_,a2,b2)),s2,_) :: q2 ->
- let (o',lft1',lft2') = aux (fold_array (fold_array o b1 b2) a1 a2)
- lft1 (List.rev s1) lft2 (List.rev s2) in
- aux o' lft1' q1 lft2' q2
+ let o' = aux (Array.fold_left2 f (Array.fold_left2 f o b1 b2) a1 a2) (List.rev s1) (List.rev s2) in
+ aux o' q1 q2
| Cst (cst1,_,_,params1,_) :: q1, Cst (cst2,_,_,params2,_) :: q2 ->
- let (o',lft1',lft2') =
- aux o lft1 (List.rev params1) lft2 (List.rev params2)
- in aux o' lft1' q1 lft2' q2
- | (((Update _|App _|Case _|Proj _|Fix _| Cst _) :: _|[]), _) ->
- raise IncompatibleFold2
- in aux o 0 (List.rev sk1) 0 (List.rev sk2)
+ let o' = aux o (List.rev params1) (List.rev params2) in
+ aux o' q1 q2
+ | (((App _|Case _|Proj _|Fix _| Cst _) :: _|[]), _) ->
+ raise IncompatibleFold2
+ in aux o (List.rev sk1) (List.rev sk2)
let rec map f x = List.map (function
- | Update _ -> assert false
- | (Proj (_,_,_,_) | Shift _) as e -> e
+ | (Proj (_,_,_,_)) as e -> e
| App (i,a,j) ->
let le = j - i + 1 in
App (0,Array.map f (Array.sub a i le), le-1)
@@ -516,18 +487,15 @@ struct
let rec args_size = function
| App (i,_,j)::s -> j + 1 - i + args_size s
- | Shift(_)::s -> args_size s
- | Update(_)::s -> args_size s
| (Case _|Fix _|Proj _|Cst _)::_ | [] -> 0
let strip_app s =
let rec aux out = function
- | ( App _ | Shift _ as e) :: s -> aux (e :: out) s
+ | ( App _ as e) :: s -> aux (e :: out) s
| s -> List.rev out,s
in aux [] s
let strip_n_app n s =
let rec aux n out = function
- | Shift k as e :: s -> aux n (e :: out) s
| App (i,a,j) as e :: s ->
let nb = j - i + 1 in
if n >= nb then
@@ -552,14 +520,12 @@ struct
let list_of_app_stack s =
let rec aux = function
| App (i,a,j) :: s ->
- let (k,(args',s')) = aux s in
- let a' = Array.map (Vars.lift k) (Array.sub a i (j - i + 1)) in
- k,(Array.fold_right (fun x y -> x::y) a' args', s')
- | Shift n :: s ->
- let (k,(args',s')) = aux s in (k+n,(args', s'))
- | s -> (0,([],s)) in
- let (lft,(out,s')) = aux s in
- let init = match s' with [] when Int.equal lft 0 -> true | _ -> false in
+ let (args',s') = aux s in
+ let a' = Array.sub a i (j - i + 1) in
+ (Array.fold_right (fun x y -> x::y) a' args', s')
+ | s -> ([],s) in
+ let (out,s') = aux s in
+ let init = match s' with [] -> true | _ -> false in
Option.init init out
let assign s p c =
@@ -568,20 +534,18 @@ struct
| None -> assert false
let tail n0 s0 =
- let rec aux lft n s =
- let out s = if Int.equal lft 0 then s else Shift lft :: s in
- if Int.equal n 0 then out s else
+ let rec aux n s =
+ if Int.equal n 0 then s else
match s with
| App (i,a,j) :: s ->
let nb = j - i + 1 in
if n >= nb then
- aux lft (n - nb) s
+ aux (n - nb) s
else
let p = i+n in
if j >= p then App(p,a,j)::s else s
- | Shift k :: s' -> aux (lft+k) n s'
| _ -> raise (Invalid_argument "Reductionops.Stack.tail")
- in aux 0 n0 s0
+ in aux n0 s0
let nth s p =
match strip_n_app p s with
@@ -627,11 +591,9 @@ struct
zip (best_state sigma (constr_of_cst_member cst (params @ (append_app [|f|] s))) cst_l)
| f, (Cst (cst,_,_,params,_)::s) ->
zip (constr_of_cst_member cst (params @ (append_app [|f|] s)))
- | f, (Shift n::s) -> zip (lift n f, s)
| f, (Proj (n,m,p,cst_l)::s) when refold ->
zip (best_state sigma (mkProj (p,f),s) cst_l)
| f, (Proj (n,m,p,_)::s) -> zip (mkProj (p,f),s)
- | _, (Update _::_) -> assert false
in
zip s
@@ -868,11 +830,9 @@ let _ = Goptions.declare_bool_option {
}
let equal_stacks sigma (x, l) (y, l') =
- let f_equal (x,lft1) (y,lft2) = eq_constr sigma (Vars.lift lft1 x) (Vars.lift lft2 y) in
- let eq_fix (a,b) (c,d) = f_equal (mkFix a, b) (mkFix c, d) in
- match Stack.equal f_equal eq_fix l l' with
- | None -> false
- | Some (lft1,lft2) -> f_equal (x, lft1) (y, lft2)
+ let f_equal x y = eq_constr sigma x y in
+ let eq_fix a b = f_equal (mkFix a) (mkFix b) in
+ Stack.equal f_equal eq_fix l l' && f_equal x y
let rec whd_state_gen ?csts ~refold ~tactic_mode flags env sigma =
let open Context.Named.Declaration in
@@ -1074,7 +1034,7 @@ let rec whd_state_gen ?csts ~refold ~tactic_mode flags env sigma =
(arg,
Stack.Cst (const,next,remains',s' @ (Stack.append_app [|x'|] bef),cst_l) :: s''')
end
- |_, (Stack.App _|Stack.Update _|Stack.Shift _)::_ -> assert false
+ |_, (Stack.App _)::_ -> assert false
|_, _ -> fold ()
else fold ()
@@ -1155,7 +1115,7 @@ let local_whd_state_gen flags sigma =
|args, (Stack.Fix (f,s',cst)::s'') when use_fix ->
let x' = Stack.zip sigma (x,args) in
whrec (contract_fix sigma f, s' @ (Stack.append_app [|x'|] s''))
- |_, (Stack.App _|Stack.Update _|Stack.Shift _|Stack.Cst _)::_ -> assert false
+ |_, (Stack.App _|Stack.Cst _)::_ -> assert false
|_, _ -> s
else s
@@ -1167,7 +1127,8 @@ let local_whd_state_gen flags sigma =
|_ -> s
else s
- | x -> s
+ | Rel _ | Var _ | Sort _ | Prod _ | LetIn _ | Const _ | Ind _ | Proj _ -> s
+
in
whrec
@@ -1280,9 +1241,9 @@ let clos_whd_flags flgs env sigma t =
(CClosure.inject (EConstr.Unsafe.to_constr t)))
with e when is_anomaly e -> user_err Pp.(str "Tried to normalize ill-typed term")
-let nf_beta = clos_norm_flags CClosure.beta (Global.env ())
-let nf_betaiota = clos_norm_flags CClosure.betaiota (Global.env ())
-let nf_betaiotazeta = clos_norm_flags CClosure.betaiotazeta (Global.env ())
+let nf_beta = clos_norm_flags CClosure.beta
+let nf_betaiota = clos_norm_flags CClosure.betaiota
+let nf_betaiotazeta = clos_norm_flags CClosure.betaiotazeta
let nf_all env sigma =
clos_norm_flags CClosure.all env sigma
@@ -1291,11 +1252,11 @@ let nf_all env sigma =
(* Conversion *)
(********************************************************************)
(*
-let fkey = Profile.declare_profile "fhnf";;
-let fhnf info v = Profile.profile2 fkey fhnf info v;;
+let fkey = CProfile.declare_profile "fhnf";;
+let fhnf info v = CProfile.profile2 fkey fhnf info v;;
-let fakey = Profile.declare_profile "fhnf_apply";;
-let fhnf_apply info k h a = Profile.profile4 fakey fhnf_apply info k h a;;
+let fakey = CProfile.declare_profile "fhnf_apply";;
+let fhnf_apply info k h a = CProfile.profile4 fakey fhnf_apply info k h a;;
*)
let is_transparent e k =
@@ -1305,7 +1266,7 @@ let is_transparent e k =
(* Conversion utility functions *)
-type conversion_test = constraints -> constraints
+type conversion_test = Constraint.t -> Constraint.t
let pb_is_equal pb = pb == Reduction.CONV
@@ -1314,7 +1275,9 @@ let pb_equal = function
| Reduction.CONV -> Reduction.CONV
let report_anomaly e =
- let e = UserError (None, Pp.(str "Conversion test raised an anomaly" ++ print e)) in
+ let msg = Pp.(str "Conversion test raised an anomaly:" ++
+ spc () ++ CErrors.print e) in
+ let e = UserError (None,msg) in
let e = CErrors.push e in
iraise e
@@ -1682,7 +1645,7 @@ let whd_betaiota_deltazeta_for_iota_state ts env sigma csts s =
if isConstruct sigma t_o then
whrec Cst_stack.empty (Stack.nth stack_o (n+m), stack'')
else s,csts'
- |_, ((Stack.App _| Stack.Shift _|Stack.Update _|Stack.Cst _) :: _|[]) -> s,csts'
+ |_, ((Stack.App _|Stack.Cst _) :: _|[]) -> s,csts'
in whrec csts s
let find_conclusion env sigma =
@@ -1769,8 +1732,8 @@ let meta_reducible_instance evd b =
let is_coerce = match s with CoerceToType -> true | _ -> false in
if not is_coerce then irec g else u
with Not_found -> u)
- | Proj (p,c) when isMeta evd c || isCast evd c && isMeta evd (pi1 (destCast evd c)) ->
- let m = try destMeta evd c with _ -> destMeta evd (pi1 (destCast evd c)) in
+ | Proj (p,c) when isMeta evd c || isCast evd c && isMeta evd (pi1 (destCast evd c)) (* What if two nested casts? *) ->
+ let m = try destMeta evd c with _ -> destMeta evd (pi1 (destCast evd c)) (* idem *) in
(match
try
let g, s = Metamap.find m metas in
diff --git a/pretyping/reductionops.mli b/pretyping/reductionops.mli
index 1828196fe..0565baf45 100644
--- a/pretyping/reductionops.mli
+++ b/pretyping/reductionops.mli
@@ -7,7 +7,7 @@
(************************************************************************)
open Names
-open Term
+open Constr
open EConstr
open Univ
open Evd
@@ -82,8 +82,6 @@ module Stack : sig
| Fix of ('a, 'a) pfixpoint * 'a t * Cst_stack.t
| Cst of cst_member * int (** current foccussed arg *) * int list (** remaining args *)
* 'a t * Cst_stack.t
- | Shift of int
- | Update of 'a
and 'a t = 'a member list
val pr : ('a -> Pp.t) -> 'a t -> Pp.t
@@ -102,12 +100,12 @@ module Stack : sig
@return the result and the lifts to apply on the terms
@raise IncompatibleFold2 when [sk1] and [sk2] have incompatible shapes *)
val fold2 : ('a -> constr -> constr -> 'a) -> 'a ->
- constr t -> constr t -> 'a * int * int
+ constr t -> constr t -> 'a
val map : ('a -> 'a) -> 'a t -> 'a t
val append_app_list : 'a list -> 'a t -> 'a t
(** if [strip_app s] = [(a,b)], then [s = a @ b] and [b] does not
- start by App or Shift *)
+ start by App *)
val strip_app : 'a t -> 'a t * 'a t
(** @return (the nth first elements, the (n+1)th element, the remaining stack) *)
val strip_n_app : int -> 'a t -> ('a t * 'a * 'a t) option
@@ -170,9 +168,9 @@ val clos_norm_flags : CClosure.RedFlags.reds -> reduction_function
val clos_whd_flags : CClosure.RedFlags.reds -> reduction_function
(** Same as [(strong whd_beta[delta][iota])], but much faster on big terms *)
-val nf_beta : local_reduction_function
-val nf_betaiota : local_reduction_function
-val nf_betaiotazeta : local_reduction_function
+val nf_beta : reduction_function
+val nf_betaiota : reduction_function
+val nf_betaiotazeta : reduction_function
val nf_all : reduction_function
val nf_evar : evar_map -> constr -> constr
@@ -258,11 +256,11 @@ val contract_fix : ?env:Environ.env -> evar_map -> ?reference:Constant.t -> fixp
val fix_recarg : ('a, 'a) pfixpoint -> 'b Stack.t -> (int * 'b) option
(** {6 Querying the kernel conversion oracle: opaque/transparent constants } *)
-val is_transparent : Environ.env -> constant tableKey -> bool
+val is_transparent : Environ.env -> Constant.t tableKey -> bool
(** {6 Conversion Functions (uses closures, lazy strategy) } *)
-type conversion_test = constraints -> constraints
+type conversion_test = Constraint.t -> Constraint.t
val pb_is_equal : conv_pb -> bool
val pb_equal : conv_pb -> conv_pb
diff --git a/pretyping/retyping.ml b/pretyping/retyping.ml
index 56f8b33e0..00b175c48 100644
--- a/pretyping/retyping.ml
+++ b/pretyping/retyping.ml
@@ -10,6 +10,7 @@ open Pp
open CErrors
open Util
open Term
+open Constr
open Inductive
open Inductiveops
open Names
@@ -146,7 +147,7 @@ let retype ?(polyprop=true) sigma =
| Cast (c,_, s) when isSort sigma s -> destSort sigma s
| Sort s ->
begin match ESorts.kind sigma s with
- | Prop _ -> type1_sort
+ | Prop _ -> Sorts.type1
| Type u -> Type (Univ.super u)
end
| Prod (name,t,c2) ->
@@ -165,23 +166,6 @@ let retype ?(polyprop=true) sigma =
| Lambda _ | Fix _ | Construct _ -> retype_error NotAType
| _ -> decomp_sort env sigma (type_of env t)
- and sort_family_of env t =
- match EConstr.kind sigma t with
- | Cast (c,_, s) when isSort sigma s -> family_of_sort (destSort sigma s)
- | Sort _ -> InType
- | Prod (name,t,c2) ->
- let s2 = sort_family_of (push_rel (LocalAssum (name,t)) env) c2 in
- if not (is_impredicative_set env) &&
- s2 == InSet && sort_family_of env t == InType then InType else s2
- | App(f,args) when is_template_polymorphic env sigma f ->
- let t = type_of_global_reference_knowing_parameters env f args in
- family_of_sort (sort_of_atomic_type env sigma t args)
- | App(f,args) ->
- family_of_sort (sort_of_atomic_type env sigma (type_of env f) args)
- | Lambda _ | Fix _ | Construct _ -> retype_error NotAType
- | _ ->
- family_of_sort (decomp_sort env sigma (type_of env t))
-
and type_of_global_reference_knowing_parameters env c args =
let argtyps =
Array.map (fun c -> lazy (EConstr.to_constr sigma (type_of env c))) args in
@@ -197,15 +181,34 @@ let retype ?(polyprop=true) sigma =
EConstr.of_constr (type_of_constructor env (cstr, u))
| _ -> assert false
- in type_of, sort_of, sort_family_of,
- type_of_global_reference_knowing_parameters
+ in type_of, sort_of, type_of_global_reference_knowing_parameters
+
+let get_sort_family_of ?(truncation_style=false) ?(polyprop=true) env sigma t =
+ let type_of,_,type_of_global_reference_knowing_parameters = retype ~polyprop sigma in
+ let rec sort_family_of env t =
+ match EConstr.kind sigma t with
+ | Cast (c,_, s) when isSort sigma s -> Sorts.family (destSort sigma s)
+ | Sort _ -> InType
+ | Prod (name,t,c2) ->
+ let s2 = sort_family_of (push_rel (LocalAssum (name,t)) env) c2 in
+ if not (is_impredicative_set env) &&
+ s2 == InSet && sort_family_of env t == InType then InType else s2
+ | App(f,args) when is_template_polymorphic env sigma f ->
+ if truncation_style then InType else
+ let t = type_of_global_reference_knowing_parameters env f args in
+ Sorts.family (sort_of_atomic_type env sigma t args)
+ | App(f,args) ->
+ Sorts.family (sort_of_atomic_type env sigma (type_of env f) args)
+ | Lambda _ | Fix _ | Construct _ -> retype_error NotAType
+ | Ind _ when truncation_style && is_template_polymorphic env sigma t -> InType
+ | _ ->
+ Sorts.family (decomp_sort env sigma (type_of env t))
+ in sort_family_of env t
let get_sort_of ?(polyprop=true) env sigma t =
- let _,f,_,_ = retype ~polyprop sigma in anomaly_on_error (f env) t
-let get_sort_family_of ?(polyprop=true) env sigma c =
- let _,_,f,_ = retype ~polyprop sigma in anomaly_on_error (f env) c
+ let _,f,_ = retype ~polyprop sigma in anomaly_on_error (f env) t
let type_of_global_reference_knowing_parameters env sigma c args =
- let _,_,_,f = retype sigma in anomaly_on_error (f env c) args
+ let _,_,f = retype sigma in anomaly_on_error (f env c) args
let type_of_global_reference_knowing_conclusion env sigma c conclty =
match EConstr.kind sigma c with
@@ -224,14 +227,14 @@ let type_of_global_reference_knowing_conclusion env sigma c conclty =
(* let f,_,_,_ = retype ~polyprop sigma in *)
(* if lax then f env c else anomaly_on_error (f env) c *)
-(* let get_type_of_key = Profile.declare_profile "get_type_of" *)
-(* let get_type_of = Profile.profile5 get_type_of_key get_type_of *)
+(* let get_type_of_key = CProfile.declare_profile "get_type_of" *)
+(* let get_type_of = CProfile.profile5 get_type_of_key get_type_of *)
(* let get_type_of ?(polyprop=true) ?(lax=false) env sigma c = *)
(* get_type_of polyprop lax env sigma c *)
let get_type_of ?(polyprop=true) ?(lax=false) env sigma c =
- let f,_,_,_ = retype ~polyprop sigma in
+ let f,_,_ = retype ~polyprop sigma in
if lax then f env c else anomaly_on_error (f env) c
(* Makes an unsafe judgment from a constr *)
diff --git a/pretyping/retyping.mli b/pretyping/retyping.mli
index ed3a9d0f9..6fdde9046 100644
--- a/pretyping/retyping.mli
+++ b/pretyping/retyping.mli
@@ -6,7 +6,6 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-open Term
open Evd
open Environ
open EConstr
@@ -30,10 +29,13 @@ val get_type_of :
?polyprop:bool -> ?lax:bool -> env -> evar_map -> constr -> types
val get_sort_of :
- ?polyprop:bool -> env -> evar_map -> types -> sorts
+ ?polyprop:bool -> env -> evar_map -> types -> Sorts.t
+(* When [truncation_style] is [true], tells if the type has been explicitly
+ truncated to Prop or (impredicative) Set; in particular, singleton type and
+ small inductive types, which have all eliminations to Type, are in Type *)
val get_sort_family_of :
- ?polyprop:bool -> env -> evar_map -> types -> sorts_family
+ ?truncation_style:bool -> ?polyprop:bool -> env -> evar_map -> types -> Sorts.family
(** Makes an unsafe judgment from a constr *)
val get_judgment_of : env -> evar_map -> constr -> unsafe_judgment
@@ -44,7 +46,7 @@ val type_of_global_reference_knowing_parameters : env -> evar_map -> constr ->
val type_of_global_reference_knowing_conclusion :
env -> evar_map -> constr -> types -> evar_map * types
-val sorts_of_context : env -> evar_map -> rel_context -> sorts list
+val sorts_of_context : env -> evar_map -> rel_context -> Sorts.t list
val expand_projection : env -> evar_map -> Names.projection -> constr -> constr list -> constr
diff --git a/pretyping/tacred.ml b/pretyping/tacred.ml
index 9451b0f86..9b9408698 100644
--- a/pretyping/tacred.ml
+++ b/pretyping/tacred.ml
@@ -60,9 +60,7 @@ let value_of_evaluable_ref env evref u =
match evref with
| EvalConstRef con ->
let u = Unsafe.to_instance u in
- EConstr.of_constr (try constant_value_in env (con,u)
- with NotEvaluableConst IsProj ->
- raise (Invalid_argument "value_of_evaluable_ref"))
+ EConstr.of_constr (constant_value_in env (con, u))
| EvalVarRef id -> env |> lookup_named id |> NamedDecl.get_value |> Option.get
let evaluable_of_global_reference env = function
@@ -75,13 +73,13 @@ let global_of_evaluable_reference = function
| EvalVarRef id -> VarRef id
type evaluable_reference =
- | EvalConst of constant
+ | EvalConst of Constant.t
| EvalVar of Id.t
| EvalRel of int
| EvalEvar of EConstr.existential
let evaluable_reference_eq sigma r1 r2 = match r1, r2 with
-| EvalConst c1, EvalConst c2 -> eq_constant c1 c2
+| EvalConst c1, EvalConst c2 -> Constant.equal c1 c2
| EvalVar id1, EvalVar id2 -> Id.equal id1 id2
| EvalRel i1, EvalRel i2 -> Int.equal i1 i2
| EvalEvar (e1, ctx1), EvalEvar (e2, ctx2) ->
@@ -240,7 +238,7 @@ let invert_name labs l na0 env sigma ref = function
| EvalRel _ | EvalEvar _ -> None
| EvalVar id' -> Some (EvalVar id)
| EvalConst kn ->
- Some (EvalConst (con_with_label kn (Label.of_id id))) in
+ Some (EvalConst (Constant.change_label kn (Label.of_id id))) in
match refi with
| None -> None
| Some ref ->
@@ -476,7 +474,7 @@ let contract_fix_use_function env sigma f
let nbodies = Array.length recindices in
let make_Fi j = (mkFix((recindices,j),typedbodies), f j) in
let lbodies = List.init nbodies make_Fi in
- substl_checking_arity env (List.rev lbodies) sigma (nf_beta sigma bodies.(bodynum))
+ substl_checking_arity env (List.rev lbodies) sigma (nf_beta env sigma bodies.(bodynum))
let reduce_fix_use_function env sigma f whfun fix stack =
match fix_recarg fix (Stack.append_app_list stack Stack.empty) with
@@ -500,7 +498,7 @@ let contract_cofix_use_function env sigma f
let make_Fi j = (mkCoFix(j,typedbodies), f j) in
let subbodies = List.init nbodies make_Fi in
substl_checking_arity env (List.rev subbodies)
- sigma (nf_beta sigma bodies.(bodynum))
+ sigma (nf_beta env sigma bodies.(bodynum))
let reduce_mind_case_use_function func env sigma mia =
match EConstr.kind sigma mia.mconstr with
@@ -521,7 +519,7 @@ let reduce_mind_case_use_function func env sigma mia =
the block was indeed initially built as a global
definition *)
let (kn, u) = destConst sigma func in
- let kn = con_with_label kn (Label.of_id id) in
+ let kn = Constant.change_label kn (Label.of_id id) in
let cst = (kn, EInstance.kind sigma u) in
try match constant_opt_value_in env cst with
| None -> None
@@ -697,7 +695,7 @@ let rec red_elim_const env sigma ref u largs =
let whfun = whd_construct_stack env sigma in
(match reduce_fix_use_function env sigma f whfun (destFix sigma d) lrest with
| NotReducible -> raise Redelimination
- | Reduced (c,rest) -> (nf_beta sigma c, rest), nocase)
+ | Reduced (c,rest) -> (nf_beta env sigma c, rest), nocase)
| EliminationMutualFix (min,refgoal,refinfos) when nargs >= min ->
let rec descend (ref,u) args =
let c = reference_value env sigma ref u in
@@ -712,7 +710,7 @@ let rec red_elim_const env sigma ref u largs =
let whfun = whd_construct_stack env sigma in
(match reduce_fix_use_function env sigma f whfun (destFix sigma d) lrest with
| NotReducible -> raise Redelimination
- | Reduced (c,rest) -> (nf_beta sigma c, rest), nocase)
+ | Reduced (c,rest) -> (nf_beta env sigma c, rest), nocase)
| NotAnElimination when unfold_nonelim ->
let c = reference_value env sigma ref u in
(whd_betaiotazeta sigma (applist (c, largs)), []), nocase
@@ -927,8 +925,8 @@ let whd_simpl_orelse_delta_but_fix_old env sigma c =
let whd_simpl_stack =
if Flags.profile then
- let key = Profile.declare_profile "whd_simpl_stack" in
- Profile.profile3 key whd_simpl_stack
+ let key = CProfile.declare_profile "whd_simpl_stack" in
+ CProfile.profile3 key whd_simpl_stack
else whd_simpl_stack
(* Same as [whd_simpl] but also reduces constants that do not hide a
@@ -944,7 +942,7 @@ let whd_simpl_orelse_delta_but_fix env sigma c =
| CoFix _ | Fix _ -> s'
| Proj (p,t) when
(match EConstr.kind sigma constr with
- | Const (c', _) -> eq_constant (Projection.constant p) c'
+ | Const (c', _) -> Constant.equal (Projection.constant p) c'
| _ -> false) ->
let pb = Environ.lookup_projection p env in
if List.length stack <= pb.Declarations.proj_npars then
@@ -1050,7 +1048,7 @@ let contextually byhead occs f env sigma t =
let match_constr_evaluable_ref sigma c evref =
match EConstr.kind sigma c, evref with
- | Const (c,u), EvalConstRef c' when eq_constant c c' -> Some u
+ | Const (c,u), EvalConstRef c' when Constant.equal c c' -> Some u
| Var id, EvalVarRef id' when Id.equal id id' -> Some EInstance.empty
| _, _ -> None
@@ -1103,7 +1101,7 @@ let unfoldoccs env sigma (occs,name) c =
| [] -> ()
| _ -> error_invalid_occurrence rest
in
- nf_betaiotazeta sigma uc
+ nf_betaiotazeta env sigma uc
in
match occs with
| NoOccurrences -> c
@@ -1284,7 +1282,7 @@ let reduce_to_ref_gen allow_product env sigma ref t =
else raise Not_found
with Not_found ->
try
- let t' = nf_betaiota sigma (one_step_reduce env sigma t) in
+ let t' = nf_betaiota env sigma (one_step_reduce env sigma t) in
elimrec env t' l
with NotStepReducible -> error_cannot_recognize ref
in
diff --git a/pretyping/typeclasses.ml b/pretyping/typeclasses.ml
index 375a8a983..3f947fd23 100644
--- a/pretyping/typeclasses.ml
+++ b/pretyping/typeclasses.ml
@@ -11,6 +11,7 @@ open Names
open Globnames
open Decl_kinds
open Term
+open Constr
open Vars
open Evd
open Util
@@ -64,14 +65,14 @@ type typeclass = {
cl_impl : global_reference;
(* Context in which the definitions are typed. Includes both typeclass parameters and superclasses. *)
- cl_context : (global_reference * bool) option list * Context.Rel.t;
+ cl_context : global_reference option list * Context.Rel.t;
(* Context of definitions and properties on defs, will not be shared *)
cl_props : Context.Rel.t;
(* The method implementaions as projections. *)
cl_projs : (Name.t * (direction * Vernacexpr.hint_info_expr) option
- * constant option) list;
+ * Constant.t option) list;
cl_strict : bool;
@@ -86,7 +87,6 @@ type instance = {
(* Sections where the instance should be redeclared,
None for discard, Some 0 for none. *)
is_global: int option;
- is_poly: bool;
is_impl: global_reference;
}
@@ -96,7 +96,7 @@ let instance_impl is = is.is_impl
let hint_priority is = is.is_info.Vernacexpr.hint_priority
-let new_instance cl info glob poly impl =
+let new_instance cl info glob impl =
let global =
if glob then Some (Lib.sections_depth ())
else None
@@ -106,7 +106,6 @@ let new_instance cl info glob poly impl =
{ is_class = cl.cl_impl;
is_info = info ;
is_global = global ;
- is_poly = poly;
is_impl = impl }
(*
@@ -174,7 +173,7 @@ let subst_class (subst,cl) =
and do_subst_gr gr = fst (subst_global subst gr) in
let do_subst_ctx = List.smartmap (RelDecl.map_constr do_subst) in
let do_subst_context (grs,ctx) =
- List.smartmap (Option.smartmap (fun (gr,b) -> do_subst_gr gr, b)) grs,
+ List.smartmap (Option.smartmap do_subst_gr) grs,
do_subst_ctx ctx in
let do_subst_projs projs = List.smartmap (fun (x, y, z) ->
(x, y, Option.smartmap do_subst_con z)) projs in
@@ -212,15 +211,16 @@ let discharge_class (_,cl) =
let newgrs = List.map (fun decl ->
match decl |> RelDecl.get_type |> EConstr.of_constr |> class_of_constr Evd.empty with
| None -> None
- | Some (_, ((tc,_), _)) -> Some (tc.cl_impl, true))
+ | Some (_, ((tc,_), _)) -> Some tc.cl_impl)
ctx'
in
- List.smartmap (Option.smartmap (fun (gr, b) -> Lib.discharge_global gr, b)) grs
+ List.smartmap (Option.smartmap Lib.discharge_global) grs
@ newgrs
in grs', discharge_rel_context subst 1 ctx @ ctx' in
let cl_impl' = Lib.discharge_global cl.cl_impl in
if cl_impl' == cl.cl_impl then cl else
- let ctx, _, _ as info = abs_context cl in
+ let info = abs_context cl in
+ let ctx = info.Lib.abstr_ctx in
let ctx, subst = rel_of_variable_context ctx in
let usubst, cl_univs' = Lib.discharge_abstract_universe_context info cl.cl_univs in
let context = discharge_context ctx (subst, usubst) cl.cl_context in
@@ -419,7 +419,7 @@ let declare_instance info local glob =
match class_of_constr Evd.empty (EConstr.of_constr ty) with
| Some (rels, ((tc,_), args) as _cl) ->
assert (not (isVarRef glob) || local);
- add_instance (new_instance tc info (not local) (Flags.use_polymorphic_flag ()) glob)
+ add_instance (new_instance tc info (not local) glob)
| None -> ()
let add_class cl =
@@ -441,19 +441,20 @@ let add_class cl =
let instance_constructor (cl,u) args =
let lenpars = List.count is_local_assum (snd cl.cl_context) in
+ let open EConstr in
let pars = fst (List.chop lenpars args) in
match cl.cl_impl with
| IndRef ind ->
let ind = ind, u in
- (Some (applistc (mkConstructUi (ind, 1)) args),
- applistc (mkIndU ind) pars)
+ (Some (applist (mkConstructUi (ind, 1), args)),
+ applist (mkIndU ind, pars))
| ConstRef cst ->
let cst = cst, u in
let term = match args with
| [] -> None
| _ -> Some (List.last args)
in
- (term, applistc (mkConstU cst) pars)
+ (term, applist (mkConstU cst, pars))
| _ -> assert false
let typeclasses () = Refmap.fold (fun _ l c -> l :: c) !classes []
@@ -520,7 +521,7 @@ let mark_unresolvable evi = mark_resolvability false evi
let mark_resolvable evi = mark_resolvability true evi
open Evar_kinds
-type evar_filter = existential_key -> Evar_kinds.t -> bool
+type evar_filter = Evar.t -> Evar_kinds.t -> bool
let all_evars _ _ = true
let all_goals _ = function VarInstance _ | GoalEvar -> true | _ -> false
@@ -551,8 +552,8 @@ let solve_all_instances env evd filter unique split fail =
Hook.get get_solve_all_instances env evd filter unique split fail
(** Profiling resolution of typeclasses *)
-(* let solve_classeskey = Profile.declare_profile "solve_typeclasses" *)
-(* let solve_problem = Profile.profile5 solve_classeskey solve_problem *)
+(* let solve_classeskey = CProfile.declare_profile "solve_typeclasses" *)
+(* let solve_problem = CProfile.profile5 solve_classeskey solve_problem *)
let resolve_typeclasses ?(fast_path = true) ?(filter=no_goals) ?(unique=get_typeclasses_unique_solutions ())
?(split=true) ?(fail=true) env evd =
diff --git a/pretyping/typeclasses.mli b/pretyping/typeclasses.mli
index 99cdbd3a3..ee28ec173 100644
--- a/pretyping/typeclasses.mli
+++ b/pretyping/typeclasses.mli
@@ -8,7 +8,7 @@
open Names
open Globnames
-open Term
+open Constr
open Evd
open Environ
@@ -25,9 +25,8 @@ type typeclass = {
cl_impl : global_reference;
(** Context in which the definitions are typed. Includes both typeclass parameters and superclasses.
- The boolean indicates if the typeclass argument is a direct superclass and the global reference
- gives a direct link to the class itself. *)
- cl_context : (global_reference * bool) option list * Context.Rel.t;
+ The global reference gives a direct link to the class itself. *)
+ cl_context : global_reference option list * Context.Rel.t;
(** Context of definitions and properties on defs, will not be shared *)
cl_props : Context.Rel.t;
@@ -36,7 +35,7 @@ type typeclass = {
Some may be undefinable due to sorting restrictions or simply undefined if
no name is provided. The [int option option] indicates subclasses whose hint has
the given priority. *)
- cl_projs : (Name.t * (direction * Vernacexpr.hint_info_expr) option * constant option) list;
+ cl_projs : (Name.t * (direction * Vernacexpr.hint_info_expr) option * Constant.t option) list;
(** Whether we use matching or full unification during resolution *)
cl_strict : bool;
@@ -54,7 +53,7 @@ val all_instances : unit -> instance list
val add_class : typeclass -> unit
-val new_instance : typeclass -> Vernacexpr.hint_info_expr -> bool -> Decl_kinds.polymorphic ->
+val new_instance : typeclass -> Vernacexpr.hint_info_expr -> bool ->
global_reference -> instance
val add_instance : instance -> unit
val remove_instance : instance -> unit
@@ -68,7 +67,7 @@ val class_info : global_reference -> typeclass (** raises a UserError if not a c
val dest_class_app : env -> evar_map -> EConstr.constr -> (typeclass * EConstr.EInstance.t) * constr list
(** Get the instantiated typeclass structure for a given universe instance. *)
-val typeclass_univ_instance : typeclass puniverses -> typeclass
+val typeclass_univ_instance : typeclass Univ.puniverses -> typeclass
(** Just return None if not a class *)
val class_of_constr : evar_map -> EConstr.constr -> (EConstr.rel_context * ((typeclass * EConstr.EInstance.t) * constr list)) option
@@ -83,11 +82,11 @@ val is_instance : global_reference -> bool
(** Returns the term and type for the given instance of the parameters and fields
of the type class. *)
-val instance_constructor : typeclass puniverses -> constr list ->
- constr option * types
+val instance_constructor : typeclass EConstr.puniverses -> EConstr.t list ->
+ EConstr.t option * EConstr.t
(** Filter which evars to consider for resolution. *)
-type evar_filter = existential_key -> Evar_kinds.t -> bool
+type evar_filter = Evar.t -> Evar_kinds.t -> bool
val all_evars : evar_filter
val all_goals : evar_filter
val no_goals : evar_filter
diff --git a/pretyping/typing.ml b/pretyping/typing.ml
index 1f35fa19a..3132d2ad5 100644
--- a/pretyping/typing.ml
+++ b/pretyping/typing.ml
@@ -23,11 +23,6 @@ open Arguments_renaming
open Pretype_errors
open Context.Rel.Declaration
-let push_rec_types pfix env =
- let (i, c, t) = pfix in
- let inj c = EConstr.Unsafe.to_constr c in
- push_rec_types (i, Array.map inj c, Array.map inj t) env
-
let meta_type evd mv =
let ty =
try Evd.meta_ftype evd mv
@@ -160,7 +155,7 @@ let check_type_fixpoint ?loc env evdref lna lar vdefj =
(* FIXME: might depend on the level of actual parameters!*)
let check_allowed_sort env sigma ind c p =
let pj = Retyping.get_judgment_of env sigma p in
- let ksort = family_of_sort (ESorts.kind sigma (sort_of_arity env sigma pj.uj_type)) in
+ let ksort = Sorts.family (ESorts.kind sigma (sort_of_arity env sigma pj.uj_type)) in
let specif = Global.lookup_inductive (fst ind) in
let sorts = elim_sorts specif in
if not (List.exists ((==) ksort) sorts) then
@@ -195,11 +190,11 @@ let check_cofix env sigma pcofix =
let judge_of_prop =
{ uj_val = EConstr.mkProp;
- uj_type = EConstr.mkSort type1_sort }
+ uj_type = EConstr.mkSort Sorts.type1 }
let judge_of_set =
{ uj_val = EConstr.mkSet;
- uj_type = EConstr.mkSort type1_sort }
+ uj_type = EConstr.mkSort Sorts.type1 }
let judge_of_prop_contents = function
| Null -> judge_of_prop
diff --git a/pretyping/typing.mli b/pretyping/typing.mli
index 1e2078826..153a48a71 100644
--- a/pretyping/typing.mli
+++ b/pretyping/typing.mli
@@ -7,7 +7,7 @@
(************************************************************************)
open Names
-open Term
+open Constr
open Environ
open EConstr
open Evd
@@ -26,7 +26,7 @@ val type_of : ?refresh:bool -> env -> evar_map -> constr -> evar_map * types
val e_type_of : ?refresh:bool -> env -> evar_map ref -> constr -> types
(** Typecheck a type and return its sort *)
-val e_sort_of : env -> evar_map ref -> types -> sorts
+val e_sort_of : env -> evar_map ref -> types -> Sorts.t
(** Typecheck a term has a given type (assuming the type is OK) *)
val e_check : env -> evar_map ref -> constr -> types -> unit
@@ -53,3 +53,4 @@ val judge_of_abstraction : Environ.env -> Name.t ->
unsafe_type_judgment -> unsafe_judgment -> unsafe_judgment
val judge_of_product : Environ.env -> Name.t ->
unsafe_type_judgment -> unsafe_type_judgment -> unsafe_judgment
+val judge_of_projection : env -> evar_map -> projection -> unsafe_judgment -> unsafe_judgment
diff --git a/pretyping/unification.ml b/pretyping/unification.ml
index 86ebc1f01..e1720ec95 100644
--- a/pretyping/unification.ml
+++ b/pretyping/unification.ml
@@ -6,13 +6,11 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-module CVars = Vars
-
open CErrors
open Pp
open Util
open Names
-open Term
+open Constr
open Termops
open Environ
open EConstr
@@ -68,10 +66,10 @@ let _ = Goptions.declare_bool_option {
let unsafe_occur_meta_or_existential c =
let c = EConstr.Unsafe.to_constr c in
- let rec occrec c = match kind_of_term c with
+ let rec occrec c = match Constr.kind c with
| Evar _ -> raise Occur
| Meta _ -> raise Occur
- | _ -> iter_constr occrec c
+ | _ -> Constr.iter occrec c
in try occrec c; false with Occur -> true
@@ -79,7 +77,7 @@ let occur_meta_or_undefined_evar evd c =
(** This is performance-critical. Using the evar-insensitive API changes the
resulting heuristic. *)
let c = EConstr.Unsafe.to_constr c in
- let rec occrec c = match kind_of_term c with
+ let rec occrec c = match Constr.kind c with
| Meta _ -> raise Occur
| Evar (ev,args) ->
(match evar_body (Evd.find evd ev) with
@@ -196,7 +194,7 @@ let pose_all_metas_as_evars env evd t =
let ty = if Evd.Metaset.is_empty mvs then ty else aux ty in
let ty =
if Flags.version_strictly_greater Flags.V8_6 || Flags.version_less_or_equal Flags.VOld
- then nf_betaiota evd ty (* How it was in Coq <= 8.4 (but done in logic.ml at this time) *)
+ then nf_betaiota env evd ty (* How it was in Coq <= 8.4 (but done in logic.ml at this time) *)
else ty (* some beta-iota-normalization "regression" in 8.5 and 8.6 *) in
let src = Evd.evar_source_of_meta mv !evdref in
let ev = Evarutil.e_new_evar env evdref ~src ty in
@@ -558,10 +556,10 @@ let oracle_order env cf1 cf2 =
| Some k2 ->
match k1, k2 with
| IsProj (p, _), IsKey (ConstKey (p',_))
- when eq_constant (Projection.constant p) p' ->
+ when Constant.equal (Projection.constant p) p' ->
Some (not (Projection.unfolded p))
| IsKey (ConstKey (p,_)), IsProj (p', _)
- when eq_constant p (Projection.constant p') ->
+ when Constant.equal p (Projection.constant p') ->
Some (Projection.unfolded p')
| _ ->
Some (Conv_oracle.oracle_order (fun x -> x)
@@ -573,7 +571,9 @@ let is_rigid_head sigma flags t =
| Ind (i,u) -> true
| Construct _ -> true
| Fix _ | CoFix _ -> true
- | _ -> false
+ | Rel _ | Var _ | Meta _ | Evar _ | Sort _ | Cast (_, _, _) | Prod (_, _, _)
+ | Lambda (_, _, _) | LetIn (_, _, _, _) | App (_, _) | Case (_, _, _, _)
+ | Proj (_, _) -> false (* Why aren't Prod, Sort rigid heads ? *)
let force_eqs c =
Universes.Constraints.fold
@@ -613,7 +613,7 @@ let subst_defined_metas_evars sigma (bl,el) c =
(** This seems to be performance-critical, and using the evar-insensitive
primitives blow up the time passed in this function. *)
let c = EConstr.Unsafe.to_constr c in
- let rec substrec c = match kind_of_term c with
+ let rec substrec c = match Constr.kind c with
| Meta i ->
let select (j,_,_) = Int.equal i j in
substrec (EConstr.Unsafe.to_constr (pi2 (List.find select bl)))
@@ -654,14 +654,17 @@ let rec is_neutral env sigma ts t =
| Evar _ | Meta _ -> true
| Case (_, p, c, cl) -> is_neutral env sigma ts c
| Proj (p, c) -> is_neutral env sigma ts c
- | _ -> false
+ | Lambda _ | LetIn _ | Construct _ | CoFix _ -> false
+ | Sort _ | Cast (_, _, _) | Prod (_, _, _) | Ind _ -> false (* Really? *)
+ | Fix _ -> false (* This is an approximation *)
+ | App _ -> assert false
let is_eta_constructor_app env sigma ts f l1 term =
match EConstr.kind sigma f with
| Construct (((_, i as ind), j), u) when i == 0 && j == 1 ->
let mib = lookup_mind (fst ind) env in
(match mib.Declarations.mind_record with
- | Some (Some (_,exp,projs)) when mib.Declarations.mind_finite == Decl_kinds.BiFinite &&
+ | Some (Some (_,exp,projs)) when mib.Declarations.mind_finite == Declarations.BiFinite &&
Array.length projs == Array.length l1 - mib.Declarations.mind_nparams ->
(** Check that the other term is neutral *)
is_neutral env sigma ts term
@@ -788,7 +791,7 @@ let rec unify_0_with_initial_metas (sigma,ms,es as subst : subst0) conv_at_top e
| _, LetIn (_,a,_,c) -> unirec_rec curenvnb pb opt substn cM (subst1 a c)
(** Fast path for projections. *)
- | Proj (p1,c1), Proj (p2,c2) when eq_constant
+ | Proj (p1,c1), Proj (p2,c2) when Constant.equal
(Projection.constant p1) (Projection.constant p2) ->
(try unify_same_proj curenvnb cv_pb {opt with at_top = true}
substn c1 c2
@@ -1072,13 +1075,13 @@ let rec unify_0_with_initial_metas (sigma,ms,es as subst : subst0) conv_at_top e
in
try
let opt' = {opt with with_types = false} in
- let (substn,_,_) = Reductionops.Stack.fold2
+ let substn = Reductionops.Stack.fold2
(fun s u1 u -> unirec_rec curenvnb pb opt' s u1 (substl ks u))
(evd,ms,es) us2 us in
- let (substn,_,_) = Reductionops.Stack.fold2
+ let substn = Reductionops.Stack.fold2
(fun s u1 u -> unirec_rec curenvnb pb opt' s u1 (substl ks u))
substn params1 params in
- let (substn,_,_) = Reductionops.Stack.fold2 (fun s u1 u2 -> unirec_rec curenvnb pb opt' s u1 u2) substn ts ts1 in
+ let substn = Reductionops.Stack.fold2 (fun s u1 u2 -> unirec_rec curenvnb pb opt' s u1 u2) substn ts ts1 in
let app = mkApp (c, Array.rev_of_list ks) in
(* let substn = unirec_rec curenvnb pb b false substn t cN in *)
unirec_rec curenvnb pb opt' substn c1 app
@@ -1274,7 +1277,7 @@ let w_coerce env evd mv c =
let unify_to_type env sigma flags c status u =
let sigma, c = refresh_universes (Some false) env sigma c in
let t = get_type_of env sigma (nf_meta sigma c) in
- let t = nf_betaiota sigma (nf_meta sigma t) in
+ let t = nf_betaiota env sigma (nf_meta sigma t) in
unify_0 env sigma CUMUL flags t u
let unify_type env sigma flags mv status c =
@@ -1522,7 +1525,7 @@ let indirectly_dependent sigma c d decls =
let finish_evar_resolution ?(flags=Pretyping.all_and_fail_flags) env current_sigma (pending,c) =
let sigma = Pretyping.solve_remaining_evars flags env current_sigma pending in
let sigma, subst = nf_univ_variables sigma in
- (sigma, EConstr.of_constr (CVars.subst_univs_constr subst (EConstr.Unsafe.to_constr (nf_evar sigma c))))
+ (sigma, EConstr.of_constr (Universes.subst_univs_constr subst (EConstr.Unsafe.to_constr (nf_evar sigma c))))
let default_matching_core_flags sigma =
let ts = Names.full_transparent_state in {
@@ -1612,7 +1615,7 @@ let make_pattern_test from_prefix_of_ind is_correct_type env sigma (pending,c) =
| Some (sigma,_,l) ->
let c = applist (nf_evar sigma (local_strong whd_meta sigma c), l) in
let univs, subst = nf_univ_variables sigma in
- Some (sigma,EConstr.of_constr (CVars.subst_univs_constr subst (EConstr.Unsafe.to_constr c))))
+ Some (sigma,EConstr.of_constr (Universes.subst_univs_constr subst (EConstr.Unsafe.to_constr c))))
let make_eq_test env evd c =
let out cstr =
@@ -1628,7 +1631,7 @@ let make_abstraction_core name (test,out) env sigma c ty occs check_occs concl =
if name == Anonymous then next_ident_away_in_goal x ids else
if mem_named_context_val x (named_context_val env) then
user_err ~hdr:"Unification.make_abstraction_core"
- (str "The variable " ++ Nameops.pr_id x ++ str " is already declared.")
+ (str "The variable " ++ Id.print x ++ str " is already declared.")
else
x
in
@@ -1788,7 +1791,9 @@ let w_unify_to_subterm env evd ?(flags=default_unify_flags ()) (op,cl) =
with ex when precatchable_exception ex ->
matchrec c)
- | _ -> user_err Pp.(str "Match_subterm")))
+ | Cast (_, _, _) (* Is this expected? *)
+ | Rel _ | Var _ | Meta _ | Evar _ | Sort _ | Const _ | Ind _
+ | Construct _ -> user_err Pp.(str "Match_subterm")))
in
try matchrec cl
with ex when precatchable_exception ex ->
@@ -1854,7 +1859,11 @@ let w_unify_to_subterm_all env evd ?(flags=default_unify_flags ()) (op,cl) =
| Lambda (_,t,c) ->
bind (matchrec t) (matchrec c)
- | _ -> fail "Match_subterm"))
+ | Cast (_, _, _) -> fail "Match_subterm" (* Is this expected? *)
+
+ | Rel _ | Var _ | Meta _ | Evar _ | Sort _ | Const _ | Ind _
+ | Construct _ -> fail "Match_subterm"))
+
in
let res = matchrec cl [] in
match res with
@@ -2004,8 +2013,8 @@ let w_unify env evd cv_pb flags ty1 ty2 =
let w_unify =
if Flags.profile then
- let wunifkey = Profile.declare_profile "w_unify" in
- Profile.profile6 wunifkey w_unify
+ let wunifkey = CProfile.declare_profile "w_unify" in
+ CProfile.profile6 wunifkey w_unify
else w_unify
let w_unify env evd cv_pb ?(flags=default_unify_flags ()) ty1 ty2 =
diff --git a/pretyping/unification.mli b/pretyping/unification.mli
index fce17d564..085e8c5b8 100644
--- a/pretyping/unification.mli
+++ b/pretyping/unification.mli
@@ -6,7 +6,7 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-open Term
+open Constr
open EConstr
open Environ
open Evd
diff --git a/pretyping/univdecls.ml b/pretyping/univdecls.ml
index d7c42d03a..3cf32d7ff 100644
--- a/pretyping/univdecls.ml
+++ b/pretyping/univdecls.ml
@@ -7,9 +7,7 @@
(************************************************************************)
open Names
-open Nameops
open CErrors
-open Pp
(** Local universes and constraints declarations *)
type universe_decl =
@@ -23,27 +21,16 @@ let default_univ_decl =
univdecl_extensible_constraints = true }
let interp_univ_constraints env evd cstrs =
- let open Misctypes in
- let u_of_id x =
- match x with
- | Misctypes.GProp -> Loc.tag Univ.Level.prop
- | GSet -> Loc.tag Univ.Level.set
- | GType None | GType (Some (_, Anonymous)) ->
- user_err ~hdr:"interp_constraint"
- (str "Cannot declare constraints on anonymous universes")
- | GType (Some (loc, Name id)) ->
- try loc, Evd.universe_of_name evd (Id.to_string id)
- with Not_found ->
- user_err ?loc ~hdr:"interp_constraint" (str "Undeclared universe " ++ pr_id id)
- in
let interp (evd,cstrs) (u, d, u') =
- let lloc, ul = u_of_id u and rloc, u'l = u_of_id u' in
+ let ul = Pretyping.interp_known_glob_level evd u in
+ let u'l = Pretyping.interp_known_glob_level evd u' in
let cstr = (ul,d,u'l) in
let cstrs' = Univ.Constraint.add cstr cstrs in
try let evd = Evd.add_constraints evd (Univ.Constraint.singleton cstr) in
evd, cstrs'
with Univ.UniverseInconsistency e ->
- user_err ~hdr:"interp_constraint" (str "Universe inconsistency" (* TODO *))
+ user_err ~hdr:"interp_constraint"
+ (Univ.explain_universe_inconsistency (Termops.pr_evd_level evd) e)
in
List.fold_left interp (evd,Univ.Constraint.empty) cstrs
diff --git a/pretyping/vnorm.ml b/pretyping/vnorm.ml
index 66cc42cb6..b21fbf0eb 100644
--- a/pretyping/vnorm.ml
+++ b/pretyping/vnorm.ml
@@ -10,10 +10,12 @@ open Util
open Names
open Declarations
open Term
+open Constr
open Vars
open Environ
open Inductive
open Reduction
+open Vmvalues
open Vm
open Context.Rel.Declaration
@@ -51,7 +53,7 @@ let invert_tag cst tag reloc_tbl =
let find_rectype_a env c =
let (t, l) = decompose_appvect (whd_all env c) in
- match kind_of_term t with
+ match kind t with
| Ind ind -> (ind, l)
| _ -> assert false
@@ -133,7 +135,7 @@ let build_case_type dep p realargs c =
(* La fonction de normalisation *)
-let rec nf_val env sigma v t = nf_whd env sigma (whd_val v) t
+let rec nf_val env sigma v t = nf_whd env sigma (Vmvalues.whd_val v) t
and nf_vtype env sigma v = nf_val env sigma v crazy_type
@@ -143,7 +145,7 @@ and nf_whd env sigma whd typ =
| Vprod p ->
let dom = nf_vtype env sigma (dom p) in
let name = Name (Id.of_string "x") in
- let vc = body_of_vfun (nb_rel env) (codom p) in
+ let vc = reduce_fun (nb_rel env) (codom p) in
let codom = nf_vtype (push_rel (LocalAssum (name,dom)) env) sigma vc in
mkProd(name,dom,codom)
| Vfun f -> nf_fun env sigma f typ
@@ -190,7 +192,7 @@ and nf_univ_args ~nb_univs mk env sigma stk =
else match stk with
| Zapp args :: _ ->
let inst =
- Array.init nb_univs (fun i -> Vm.uni_lvl_val (arg args i))
+ Array.init nb_univs (fun i -> uni_lvl_val (arg args i))
in
Univ.Instance.of_array inst
| _ -> assert false
@@ -253,7 +255,7 @@ and nf_stk ?from:(from=0) env sigma c t stk =
in
let branchs = Array.mapi mkbranch bsw in
let tcase = build_case_type dep p realargs c in
- let ci = case_info sw in
+ let ci = sw.sw_annot.Cbytecodes.ci in
nf_stk env sigma (mkCase(ci, p, c, branchs)) tcase stk
| Zproj p :: stk ->
assert (from = 0) ;
@@ -262,17 +264,17 @@ and nf_stk ?from:(from=0) env sigma c t stk =
nf_stk env sigma (mkProj(p',c)) ty stk
and nf_predicate env sigma ind mip params v pT =
- match whd_val v, kind_of_term pT with
+ match whd_val v, kind pT with
| Vfun f, Prod _ ->
let k = nb_rel env in
- let vb = body_of_vfun k f in
+ let vb = reduce_fun k f in
let name,dom,codom = decompose_prod env pT in
let dep,body =
nf_predicate (push_rel (LocalAssum (name,dom)) env) sigma ind mip params vb codom in
dep, mkLambda(name,dom,body)
| Vfun f, _ ->
let k = nb_rel env in
- let vb = body_of_vfun k f in
+ let vb = reduce_fun k f in
let name = Name (Id.of_string "c") in
let n = mip.mind_nrealargs in
let rargs = Array.init n (fun i -> mkRel (n-i)) in
@@ -306,7 +308,7 @@ and nf_bargs env sigma b ofs t =
and nf_fun env sigma f typ =
let k = nb_rel env in
- let vb = body_of_vfun k f in
+ let vb = reduce_fun k f in
let name,dom,codom =
try decompose_prod env typ
with DestKO ->
@@ -364,4 +366,4 @@ let vm_infer_conv ?(pb=Reduction.CUMUL) env sigma t1 t2 =
Reductionops.infer_conv_gen (fun pb ~l2r sigma ts -> Vconv.vm_conv_gen pb)
~catch_incon:true ~pb env sigma t1 t2
-let _ = Reductionops.set_vm_infer_conv vm_infer_conv
+let _ = if Coq_config.bytecode_compiler then Reductionops.set_vm_infer_conv vm_infer_conv
diff --git a/printing/genprint.ml b/printing/genprint.ml
index 776a212b5..37a94fe21 100644
--- a/printing/genprint.ml
+++ b/printing/genprint.ml
@@ -16,21 +16,27 @@ open Geninterp
(* Printing generic values *)
-type printer_with_level =
+type 'a with_level =
{ default_already_surrounded : Notation_term.tolerability;
default_ensure_surrounded : Notation_term.tolerability;
- printer : Environ.env -> Evd.evar_map -> Notation_term.tolerability -> Pp.t }
+ printer : 'a }
type printer_result =
| PrinterBasic of (unit -> Pp.t)
-| PrinterNeedsContext of (Environ.env -> Evd.evar_map -> Pp.t)
-| PrinterNeedsContextAndLevel of printer_with_level
+| PrinterNeedsLevel of (Notation_term.tolerability -> Pp.t) with_level
-type 'a printer = 'a -> Pp.t
+type printer_fun_with_level = Environ.env -> Evd.evar_map -> Notation_term.tolerability -> Pp.t
-type 'a top_printer = 'a -> printer_result
+type top_printer_result =
+| TopPrinterBasic of (unit -> Pp.t)
+| TopPrinterNeedsContext of (Environ.env -> Evd.evar_map -> Pp.t)
+| TopPrinterNeedsContextAndLevel of printer_fun_with_level with_level
-module ValMap = ValTMap (struct type 'a t = 'a -> printer_result end)
+type 'a printer = 'a -> printer_result
+
+type 'a top_printer = 'a -> top_printer_result
+
+module ValMap = ValTMap (struct type 'a t = 'a -> top_printer_result end)
let print0_val_map = ref ValMap.empty
@@ -48,32 +54,32 @@ let register_val_print0 s pr =
print0_val_map := ValMap.add s pr !print0_val_map
let combine_dont_needs pr_pair pr1 = function
- | PrinterBasic pr2 ->
- PrinterBasic (fun () -> pr_pair (pr1 ()) (pr2 ()))
- | PrinterNeedsContext pr2 ->
- PrinterNeedsContext (fun env sigma ->
+ | TopPrinterBasic pr2 ->
+ TopPrinterBasic (fun () -> pr_pair (pr1 ()) (pr2 ()))
+ | TopPrinterNeedsContext pr2 ->
+ TopPrinterNeedsContext (fun env sigma ->
pr_pair (pr1 ()) (pr2 env sigma))
- | PrinterNeedsContextAndLevel { default_ensure_surrounded; printer } ->
- PrinterNeedsContext (fun env sigma ->
+ | TopPrinterNeedsContextAndLevel { default_ensure_surrounded; printer } ->
+ TopPrinterNeedsContext (fun env sigma ->
pr_pair (pr1 ()) (printer env sigma default_ensure_surrounded))
let combine_needs pr_pair pr1 = function
- | PrinterBasic pr2 ->
- PrinterNeedsContext (fun env sigma -> pr_pair (pr1 env sigma) (pr2 ()))
- | PrinterNeedsContext pr2 ->
- PrinterNeedsContext (fun env sigma ->
+ | TopPrinterBasic pr2 ->
+ TopPrinterNeedsContext (fun env sigma -> pr_pair (pr1 env sigma) (pr2 ()))
+ | TopPrinterNeedsContext pr2 ->
+ TopPrinterNeedsContext (fun env sigma ->
pr_pair (pr1 env sigma) (pr2 env sigma))
- | PrinterNeedsContextAndLevel { default_ensure_surrounded; printer } ->
- PrinterNeedsContext (fun env sigma ->
+ | TopPrinterNeedsContextAndLevel { default_ensure_surrounded; printer } ->
+ TopPrinterNeedsContext (fun env sigma ->
pr_pair (pr1 env sigma) (printer env sigma default_ensure_surrounded))
let combine pr_pair pr1 v2 =
match pr1 with
- | PrinterBasic pr1 ->
+ | TopPrinterBasic pr1 ->
combine_dont_needs pr_pair pr1 (generic_val_print v2)
- | PrinterNeedsContext pr1 ->
+ | TopPrinterNeedsContext pr1 ->
combine_needs pr_pair pr1 (generic_val_print v2)
- | PrinterNeedsContextAndLevel { default_ensure_surrounded; printer } ->
+ | TopPrinterNeedsContextAndLevel { default_ensure_surrounded; printer } ->
combine_needs pr_pair (fun env sigma -> printer env sigma default_ensure_surrounded)
(generic_val_print v2)
@@ -81,14 +87,14 @@ let _ =
let pr_cons a b = Pp.(a ++ spc () ++ b) in
register_val_print0 Val.typ_list
(function
- | [] -> PrinterBasic mt
+ | [] -> TopPrinterBasic mt
| a::l ->
List.fold_left (combine pr_cons) (generic_val_print a) l)
let _ =
register_val_print0 Val.typ_opt
(function
- | None -> PrinterBasic Pp.mt
+ | None -> TopPrinterBasic Pp.mt
| Some v -> generic_val_print v)
let _ =
@@ -99,9 +105,9 @@ let _ =
(* Printing generic arguments *)
type ('raw, 'glb, 'top) genprinter = {
- raw : 'raw printer;
- glb : 'glb printer;
- top : 'top -> printer_result;
+ raw : 'raw -> printer_result;
+ glb : 'glb -> printer_result;
+ top : 'top -> top_printer_result;
}
module PrintObj =
@@ -112,9 +118,9 @@ struct
| ExtraArg tag ->
let name = ArgT.repr tag in
let printer = {
- raw = (fun _ -> str "<genarg:" ++ str name ++ str ">");
- glb = (fun _ -> str "<genarg:" ++ str name ++ str ">");
- top = (fun _ -> PrinterBasic (fun () -> str "<genarg:" ++ str name ++ str ">"));
+ raw = (fun _ -> PrinterBasic (fun () -> str "<genarg:" ++ str name ++ str ">"));
+ glb = (fun _ -> PrinterBasic (fun () -> str "<genarg:" ++ str name ++ str ">"));
+ top = (fun _ -> TopPrinterBasic (fun () -> str "<genarg:" ++ str name ++ str ">"));
} in
Some printer
| _ -> assert false
diff --git a/printing/genprint.mli b/printing/genprint.mli
index 2da9bbc36..baa60fcb2 100644
--- a/printing/genprint.mli
+++ b/printing/genprint.mli
@@ -10,19 +10,25 @@
open Genarg
-type printer_with_level =
+type 'a with_level =
{ default_already_surrounded : Notation_term.tolerability;
default_ensure_surrounded : Notation_term.tolerability;
- printer : Environ.env -> Evd.evar_map -> Notation_term.tolerability -> Pp.t }
+ printer : 'a }
type printer_result =
| PrinterBasic of (unit -> Pp.t)
-| PrinterNeedsContext of (Environ.env -> Evd.evar_map -> Pp.t)
-| PrinterNeedsContextAndLevel of printer_with_level
+| PrinterNeedsLevel of (Notation_term.tolerability -> Pp.t) with_level
-type 'a printer = 'a -> Pp.t
+type printer_fun_with_level = Environ.env -> Evd.evar_map -> Notation_term.tolerability -> Pp.t
-type 'a top_printer = 'a -> printer_result
+type top_printer_result =
+| TopPrinterBasic of (unit -> Pp.t)
+| TopPrinterNeedsContext of (Environ.env -> Evd.evar_map -> Pp.t)
+| TopPrinterNeedsContextAndLevel of printer_fun_with_level with_level
+
+type 'a printer = 'a -> printer_result
+
+type 'a top_printer = 'a -> top_printer_result
val raw_print : ('raw, 'glb, 'top) genarg_type -> 'raw printer
(** Printer for raw level generic arguments. *)
@@ -34,7 +40,7 @@ val top_print : ('raw, 'glb, 'top) genarg_type -> 'top top_printer
(** Printer for top level generic arguments. *)
val register_print0 : ('raw, 'glb, 'top) genarg_type ->
- 'raw printer -> 'glb printer -> ('top -> printer_result) -> unit
+ 'raw printer -> 'glb printer -> 'top top_printer -> unit
val register_val_print0 : 'top Geninterp.Val.typ ->
'top top_printer -> unit
val register_vernac_print0 : ('raw, 'glb, 'top) genarg_type ->
diff --git a/printing/ppconstr.ml b/printing/ppconstr.ml
index 109a40a03..1146b42a0 100644
--- a/printing/ppconstr.ml
+++ b/printing/ppconstr.ml
@@ -150,10 +150,15 @@ let tag_var = tag Tag.variable
let pr_sep_com sep f c = pr_with_comments ?loc:(constr_loc c) (sep() ++ f c)
+ let pr_univ_expr = function
+ | Some (x,n) ->
+ pr_reference x ++ (match n with 0 -> mt () | _ -> str"+" ++ int n)
+ | None -> str"_"
+
let pr_univ l =
match l with
- | [_,x] -> Name.print x
- | l -> str"max(" ++ prlist_with_sep (fun () -> str",") (fun x -> Name.print (snd x)) l ++ str")"
+ | [x] -> pr_univ_expr x
+ | l -> str"max(" ++ prlist_with_sep (fun () -> str",") pr_univ_expr l ++ str")"
let pr_univ_annot pr x = str "@{" ++ pr x ++ str "}"
@@ -166,22 +171,23 @@ let tag_var = tag Tag.variable
let pr_glob_level = function
| GProp -> tag_type (str "Prop")
| GSet -> tag_type (str "Set")
- | GType None -> tag_type (str "Type")
- | GType (Some (_, u)) -> tag_type (Name.print u)
+ | GType UUnknown -> tag_type (str "Type")
+ | GType UAnonymous -> tag_type (str "_")
+ | GType (UNamed u) -> tag_type (pr_reference u)
let pr_qualid sp =
let (sl, id) = repr_qualid sp in
- let id = tag_ref (pr_id id) in
+ let id = tag_ref (Id.print id) in
let sl = match List.rev (DirPath.repr sl) with
| [] -> mt ()
| sl ->
- let pr dir = tag_path (pr_id dir) ++ str "." in
+ let pr dir = tag_path (Id.print dir) ++ str "." in
prlist pr sl
in
sl ++ id
- let pr_id = pr_id
- let pr_name = pr_name
+ let pr_id = Id.print
+ let pr_name = Name.print
let pr_qualid = pr_qualid
let pr_patvar = pr_id
@@ -192,8 +198,9 @@ let tag_var = tag Tag.variable
tag_type (str "Set")
| GType u ->
(match u with
- | Some (_,u) -> Name.print u
- | None -> tag_type (str "Type"))
+ | UNamed u -> pr_reference u
+ | UAnonymous -> tag_type (str "Type")
+ | UUnknown -> tag_type (str "_"))
let pr_universe_instance l =
pr_opt_no_spc (pr_univ_annot (prlist_with_sep spc pr_glob_sort_instance)) l
@@ -279,7 +286,7 @@ let tag_var = tag Tag.variable
pr_reference r, latom
| CPatOr pl ->
- hov 0 (prlist_with_sep pr_bar (pr_patt spc (lpator,L)) pl), lpator
+ hov 0 (prlist_with_sep pr_spcbar (pr_patt mt (lpator,L)) pl), lpator
| CPatNotation ("( _ )",([p],[]),[]) ->
pr_patt (fun()->str"(") (max_int,E) p ++ str")", latom
@@ -304,11 +311,10 @@ let tag_var = tag Tag.variable
let pr_patt = pr_patt mt
let pr_eqn pr (loc,(pl,rhs)) =
- let pl = List.map snd pl in
spc() ++ hov 4
(pr_with_comments ?loc
(str "| " ++
- hov 0 (prlist_with_sep pr_bar (prlist_with_sep sep_v (pr_patt ltop)) pl
+ hov 0 (prlist_with_sep pr_spcbar (prlist_with_sep sep_v (pr_patt ltop)) pl
++ str " =>") ++
pr_sep_com spc (pr ltop) rhs))
@@ -395,8 +401,8 @@ let tag_var = tag Tag.variable
| { v = CProdN ([],c) } ->
extract_prod_binders c
| { loc; v = CProdN ([[_,Name id],bk,t],
- { v = CCases (LetPatternStyle,None, [{ v = CRef (Ident (_,id'),None)},None,None],[(_,([_,[p]],b))])} ) }
- when Id.equal id id' && not (Id.Set.mem id (Topconstr.free_vars_of_constr_expr b)) ->
+ { v = CCases (LetPatternStyle,None, [{ v = CRef (Ident (_,id'),None)},None,None],[(_,([[p]],b))])} ) }
+ when Id.equal id id' && not (Id.Set.mem id (free_vars_of_constr_expr b)) ->
let bl,c = extract_prod_binders b in
CLocalPattern (loc, (p,None)) :: bl, c
| { loc; v = CProdN ((nal,bk,t)::bl,c) } ->
@@ -411,8 +417,8 @@ let tag_var = tag Tag.variable
| CLambdaN ([],c) ->
extract_lam_binders c
| CLambdaN ([[_,Name id],bk,t],
- { v = CCases (LetPatternStyle,None, [{ v = CRef (Ident (_,id'),None)},None,None],[(_,([_,[p]],b))])} )
- when Id.equal id id' && not (Id.Set.mem id (Topconstr.free_vars_of_constr_expr b)) ->
+ { v = CCases (LetPatternStyle,None, [{ v = CRef (Ident (_,id'),None)},None,None],[(_,([[p]],b))])} )
+ when Id.equal id id' && not (Id.Set.mem id (free_vars_of_constr_expr b)) ->
let bl,c = extract_lam_binders b in
CLocalPattern (ce.loc,(p,None)) :: bl, c
| CLambdaN ((nal,bk,t)::bl,c) ->
@@ -430,7 +436,7 @@ let tag_var = tag Tag.variable
let rename na na' t c =
match (na,na') with
| (_,Name id), (_,Name id') ->
- (na',t,Topconstr.replace_vars_constr_expr (Id.Map.singleton id id') c)
+ (na',t,replace_vars_constr_expr (Id.Map.singleton id id') c)
| (_,Name id), (_,Anonymous) -> (na,t,c)
| _ -> (na',t,c)
@@ -643,7 +649,7 @@ let tag_var = tag Tag.variable
hv 0 (str"{|" ++ pr_record_body_gen (pr spc) l ++ str" |}"),
latom
)
- | CCases (LetPatternStyle,rtntypopt,[c,as_clause,in_clause],[(_,([(loc,[p])],b))]) ->
+ | CCases (LetPatternStyle,rtntypopt,[c,as_clause,in_clause],[(_,([[p]],b))]) ->
return (
hv 0 (
keyword "let" ++ spc () ++ str"'" ++
@@ -726,6 +732,9 @@ let tag_var = tag Tag.variable
return (pr_prim_token p, prec_of_prim_token p)
| CDelimiters (sc,a) ->
return (pr_delimiters sc (pr mt (ldelim,E) a), ldelim)
+ | CProj (p,c) ->
+ let p = pr_proj (pr mt) pr_app c (CAst.make (CRef (p,None))) [] in
+ return (p, lproj)
in
let loc = constr_loc a in
pr_with_comments ?loc
diff --git a/printing/ppconstr.mli b/printing/ppconstr.mli
index be96cfce5..1320cce9b 100644
--- a/printing/ppconstr.mli
+++ b/printing/ppconstr.mli
@@ -43,6 +43,8 @@ val pr_sep_com :
val pr_id : Id.t -> Pp.t
val pr_name : Name.t -> Pp.t
+[@@ocaml.deprecated "alias of Names.Name.print"]
+
val pr_qualid : qualid -> Pp.t
val pr_patvar : patvar -> Pp.t
diff --git a/printing/pputils.ml b/printing/pputils.ml
index 9ef9162ae..a544b4762 100644
--- a/printing/pputils.ml
+++ b/printing/pputils.ml
@@ -9,7 +9,6 @@
open Util
open Pp
open Genarg
-open Nameops
open Misctypes
open Locus
open Genredexpr
@@ -27,7 +26,7 @@ let pr_located pr (loc, x) =
let pr_or_var pr = function
| ArgArg x -> pr x
- | ArgVar (_,s) -> pr_id s
+ | ArgVar (_,s) -> Names.Id.print s
let pr_with_occurrences pr keyword (occs,c) =
match occs with
@@ -104,6 +103,9 @@ let pr_red_expr (pr_constr,pr_lconstr,pr_ref,pr_pattern) keyword = function
| CbvNative o ->
keyword "native_compute" ++ pr_opt (pr_with_occurrences (pr_union pr_ref pr_pattern) keyword) o
+let pr_red_expr_env env sigma (pr_constr,pr_lconstr,pr_ref,pr_pattern) =
+ pr_red_expr (pr_constr env sigma, pr_lconstr env sigma, pr_ref, pr_pattern env sigma)
+
let pr_or_by_notation f = function
| AN v -> f v
| ByNotation (_,(s,sc)) -> qs s ++ pr_opt (fun sc -> str "%" ++ str sc) sc
@@ -128,7 +130,10 @@ let rec pr_raw_generic env (GenArg (Rawwit wit, x)) =
let q = in_gen (rawwit wit2) q in
hov_if_not_empty 0 (pr_sequence (pr_raw_generic env) [p; q])
| ExtraArg s ->
- Genprint.generic_raw_print (in_gen (rawwit wit) x)
+ let open Genprint in
+ match generic_raw_print (in_gen (rawwit wit) x) with
+ | PrinterBasic pp -> pp ()
+ | PrinterNeedsLevel { default_ensure_surrounded; printer } -> printer default_ensure_surrounded
let rec pr_glb_generic env (GenArg (Glbwit wit, x)) =
@@ -150,4 +155,7 @@ let rec pr_glb_generic env (GenArg (Glbwit wit, x)) =
let ans = pr_sequence (pr_glb_generic env) [p; q] in
hov_if_not_empty 0 ans
| ExtraArg s ->
- Genprint.generic_glb_print (in_gen (glbwit wit) x)
+ let open Genprint in
+ match generic_glb_print (in_gen (glbwit wit) x) with
+ | PrinterBasic pp -> pp ()
+ | PrinterNeedsLevel { default_ensure_surrounded; printer } -> printer default_ensure_surrounded
diff --git a/printing/pputils.mli b/printing/pputils.mli
index 1f4fa1390..f7f586b77 100644
--- a/printing/pputils.mli
+++ b/printing/pputils.mli
@@ -21,8 +21,16 @@ val pr_with_occurrences :
val pr_short_red_flag : ('a -> Pp.t) -> 'a glob_red_flag -> Pp.t
val pr_red_flag : ('a -> Pp.t) -> 'a glob_red_flag -> Pp.t
+
val pr_red_expr :
('a -> Pp.t) * ('a -> Pp.t) * ('b -> Pp.t) * ('c -> Pp.t) ->
+ (string -> Pp.t) -> ('a,'b,'c) red_expr_gen -> Pp.t
+
+val pr_red_expr_env : Environ.env -> Evd.evar_map ->
+ (Environ.env -> Evd.evar_map -> 'a -> Pp.t) *
+ (Environ.env -> Evd.evar_map -> 'a -> Pp.t) *
+ ('b -> Pp.t) *
+ (Environ.env -> Evd.evar_map -> 'c -> Pp.t) ->
(string -> Pp.t) ->
('a,'b,'c) red_expr_gen -> Pp.t
diff --git a/printing/ppvernac.ml b/printing/ppvernac.ml
index 143f9ddcc..950246c53 100644
--- a/printing/ppvernac.ml
+++ b/printing/ppvernac.ml
@@ -31,16 +31,15 @@ open Decl_kinds
let pr_lconstr = pr_lconstr_expr
let pr_spc_lconstr = pr_sep_com spc pr_lconstr_expr
- let pr_lident (loc,id) =
- match loc with
- | None -> pr_id id
- | Some loc -> let (b,_) = Loc.unloc loc in
- pr_located pr_id @@ Loc.tag ~loc:(Loc.make_loc (b,b + String.length (Id.to_string id))) id
-
let pr_uconstraint (l, d, r) =
pr_glob_level l ++ spc () ++ Univ.pr_constraint_type d ++ spc () ++
pr_glob_level r
+ let pr_univ_name_list = function
+ | None -> mt ()
+ | Some l ->
+ str "@{" ++ prlist_with_sep spc pr_lname l ++ str"}"
+
let pr_univdecl_instance l extensible =
prlist_with_sep spc pr_lident l ++
(if extensible then str"+" else mt ())
@@ -72,9 +71,8 @@ open Decl_kinds
| Some loc -> let (b,_) = Loc.unloc loc in
pr_located pr_fqid @@ Loc.tag ~loc:(Loc.make_loc (b,b + String.length (string_of_fqid fqid))) fqid
- let pr_lname = function
- | (loc,Name id) -> pr_lident (loc,id)
- | lna -> pr_located Name.print lna
+ let pr_lname_decl (n, u) =
+ pr_lname n ++ pr_universe_decl u
let pr_smart_global = Pputils.pr_or_by_notation pr_reference
@@ -86,7 +84,7 @@ open Decl_kinds
let sep_end = function
| VernacBullet _
- | VernacSubproof None
+ | VernacSubproof _
| VernacEndSubproof -> str""
| _ -> str"."
@@ -319,23 +317,18 @@ open Decl_kinds
| SortClass -> keyword "Sortclass"
| RefClass qid -> pr_smart_global qid
- let pr_assumption_token many (l,a) =
- let l = match l with Some x -> x | None -> Decl_kinds.Global in
- match l, a with
- | (Discharge,Logical) ->
- keyword (if many then "Hypotheses" else "Hypothesis")
- | (Discharge,Definitional) ->
- keyword (if many then "Variables" else "Variable")
- | (Global,Logical) ->
+ let pr_assumption_token many discharge kind =
+ match discharge, kind with
+ | (NoDischarge,Logical) ->
keyword (if many then "Axioms" else "Axiom")
- | (Global,Definitional) ->
+ | (NoDischarge,Definitional) ->
keyword (if many then "Parameters" else "Parameter")
- | (Local, Logical) ->
- keyword (if many then "Local Axioms" else "Local Axiom")
- | (Local,Definitional) ->
- keyword (if many then "Local Parameters" else "Local Parameter")
- | (Global,Conjectural) -> str"Conjecture"
- | ((Discharge | Local),Conjectural) ->
+ | (NoDischarge,Conjectural) -> str"Conjecture"
+ | (DoDischarge,Logical) ->
+ keyword (if many then "Hypotheses" else "Hypothesis")
+ | (DoDischarge,Definitional) ->
+ keyword (if many then "Variables" else "Variable")
+ | (DoDischarge,Conjectural) ->
anomaly (Pp.str "Don't know how to beautify a local conjecture.")
let pr_params pr_c (xl,(c,t)) =
@@ -398,8 +391,6 @@ open Decl_kinds
++ prlist (pr_decl_notation pr_constr) ntn
let pr_statement head (idpl,(bl,c)) =
- assert (not (Option.is_empty idpl));
- let idpl = Option.get idpl in
hov 2
(head ++ spc() ++ pr_ident_decl idpl ++ spc() ++
(match bl with [] -> mt() | _ -> pr_binders bl ++ spc()) ++
@@ -447,7 +438,7 @@ open Decl_kinds
| PrintGrammar ent ->
keyword "Print Grammar" ++ spc() ++ str ent
| PrintLoadPath dir ->
- keyword "Print LoadPath" ++ pr_opt pr_dirpath dir
+ keyword "Print LoadPath" ++ pr_opt DirPath.print dir
| PrintModules ->
keyword "Print Modules"
| PrintMLLoadPath ->
@@ -488,8 +479,8 @@ open Decl_kinds
else "Print Universes"
in
keyword cmd ++ pr_opt str fopt
- | PrintName qid ->
- keyword "Print" ++ spc() ++ pr_smart_global qid
+ | PrintName (qid,udecl) ->
+ keyword "Print" ++ spc() ++ pr_smart_global qid ++ pr_univ_name_list udecl
| PrintModuleType qid ->
keyword "Print Module Type" ++ spc() ++ pr_reference qid
| PrintModule qid ->
@@ -502,9 +493,9 @@ open Decl_kinds
keyword "Print Scope" ++ spc() ++ str s
| PrintVisibility s ->
keyword "Print Visibility" ++ pr_opt str s
- | PrintAbout (qid,gopt) ->
+ | PrintAbout (qid,l,gopt) ->
pr_opt (fun g -> Proof_bullet.pr_goal_selector g ++ str ":"++ spc()) gopt
- ++ keyword "About" ++ spc() ++ pr_smart_global qid
+ ++ keyword "About" ++ spc() ++ pr_smart_global qid ++ pr_univ_name_list l
| PrintImplicit qid ->
keyword "Print Implicit" ++ spc() ++ pr_smart_global qid
(* spiwack: command printing all the axioms and section variables used in a
@@ -518,7 +509,7 @@ open Decl_kinds
in
keyword cmd ++ spc() ++ pr_smart_global qid
| PrintNamespace dp ->
- keyword "Print Namespace" ++ pr_dirpath dp
+ keyword "Print Namespace" ++ DirPath.print dp
| PrintStrategy None ->
keyword "Print Strategies"
| PrintStrategy (Some qid) ->
@@ -535,16 +526,33 @@ open Decl_kinds
| SsFwdClose e -> "("^aux e^")*"
in Pp.str (aux e)
- let rec pr_vernac_body v =
+ let pr_extend s cl =
+ let pr_arg a =
+ try pr_gen a
+ with Failure _ -> str "<error in " ++ str (fst s) ++ str ">" in
+ try
+ let rl = Egramml.get_extend_vernac_rule s in
+ let rec aux rl cl =
+ match rl, cl with
+ | Egramml.GramNonTerminal _ :: rl, arg :: cl -> pr_arg arg :: aux rl cl
+ | Egramml.GramTerminal s :: rl, cl -> str s :: aux rl cl
+ | [], [] -> []
+ | _ -> assert false in
+ hov 1 (pr_sequence identity (aux rl cl))
+ with Not_found ->
+ hov 1 (str "TODO(" ++ str (fst s) ++ spc () ++ prlist_with_sep sep pr_arg cl ++ str ")")
+
+ let pr_vernac_expr v =
let return = tag_vernac v in
match v with
- | VernacPolymorphic (poly, v) ->
- let s = if poly then keyword "Polymorphic" else keyword "Monomorphic" in
- return (s ++ spc () ++ pr_vernac_body v)
- | VernacProgram v ->
- return (keyword "Program" ++ spc() ++ pr_vernac_body v)
- | VernacLocal (local, v) ->
- return (pr_locality local ++ spc() ++ pr_vernac_body v)
+ | VernacLoad (f,s) ->
+ return (
+ keyword "Load"
+ ++ if f then
+ (spc() ++ keyword "Verbose" ++ spc())
+ else
+ spc() ++ qs s
+ )
(* Proof management *)
| VernacAbortAll ->
@@ -555,8 +563,6 @@ open Decl_kinds
return (keyword "Unfocus")
| VernacUnfocused ->
return (keyword "Unfocused")
- | VernacGoal c ->
- return (keyword "Goal" ++ pr_lconstrarg c)
| VernacAbort id ->
return (keyword "Abort" ++ pr_opt pr_lident id)
| VernacUndo i ->
@@ -607,26 +613,8 @@ open Decl_kinds
| VernacRestoreState s ->
return (keyword "Restore State" ++ spc() ++ qs s)
- (* Control *)
- | VernacLoad (f,s) ->
- return (
- keyword "Load"
- ++ if f then
- (spc() ++ keyword "Verbose" ++ spc())
- else
- spc() ++ qs s
- )
- | VernacTime (_,v) ->
- return (keyword "Time" ++ spc() ++ pr_vernac_body v)
- | VernacRedirect (s, (_,v)) ->
- return (keyword "Redirect" ++ spc() ++ qs s ++ spc() ++ pr_vernac_body v)
- | VernacTimeout(n,v) ->
- return (keyword "Timeout " ++ int n ++ spc() ++ pr_vernac_body v)
- | VernacFail v ->
- return (keyword "Fail" ++ spc() ++ pr_vernac_body v)
-
(* Syntax *)
- | VernacOpenCloseScope (_,(opening,sc)) ->
+ | VernacOpenCloseScope (opening,sc) ->
return (
keyword (if opening then "Open " else "Close ") ++
keyword "Scope" ++ spc() ++ str sc
@@ -655,7 +643,7 @@ open Decl_kinds
++ spc() ++ pr_smart_global q
++ spc() ++ str"[" ++ prlist_with_sep sep pr_opt_scope scl ++ str"]"
)
- | VernacInfix (_,((_,s),mv),q,sn) -> (* A Verifier *)
+ | VernacInfix (((_,s),mv),q,sn) -> (* A Verifier *)
return (
hov 0 (hov 0 (keyword "Infix "
++ qs s ++ str " :=" ++ pr_constrarg q) ++
@@ -664,7 +652,7 @@ open Decl_kinds
| None -> mt()
| Some sc -> spc() ++ str":" ++ spc() ++ str sc))
)
- | VernacNotation (_,c,((_,s),l),opt) ->
+ | VernacNotation (c,((_,s),l),opt) ->
return (
hov 2 (keyword "Notation" ++ spc() ++ qs s ++
str " :=" ++ Flags.without_option Flags.beautify pr_constrarg c ++ pr_syntax_modifiers l ++
@@ -672,7 +660,7 @@ open Decl_kinds
| None -> mt()
| Some sc -> str" :" ++ spc() ++ str sc))
)
- | VernacSyntaxExtension (_, _,(s,l)) ->
+ | VernacSyntaxExtension (_, (s, l)) ->
return (
keyword "Reserved Notation" ++ spc() ++ pr_located qs s ++
pr_syntax_modifiers l
@@ -683,10 +671,12 @@ open Decl_kinds
)
(* Gallina *)
- | VernacDefinition (d,id,b) -> (* A verifier... *)
- let pr_def_token (l,dk) =
- let l = match l with Some x -> x | None -> Decl_kinds.Global in
- keyword (Kindops.string_of_definition_kind (l,false,dk))
+ | VernacDefinition ((discharge,kind),id,b) -> (* A verifier... *)
+ let pr_def_token dk =
+ keyword (
+ if Name.is_anonymous (snd (fst id))
+ then "Goal"
+ else Kindops.string_of_definition_object_kind dk)
in
let pr_reduce = function
| None -> mt()
@@ -703,12 +693,13 @@ open Decl_kinds
in
(pr_binders_arg bl,ty,Some (pr_reduce red ++ pr_lconstr body))
| ProveBody (bl,t) ->
- (pr_binders_arg bl, str" :" ++ pr_spc_lconstr t, None) in
+ let typ u = if snd (fst id) = Anonymous then (assert (bl = []); u) else (str" :" ++ u) in
+ (pr_binders_arg bl, typ (pr_spc_lconstr t), None) in
let (binds,typ,c) = pr_def_body b in
return (
hov 2 (
- pr_def_token d ++ spc()
- ++ pr_ident_decl id ++ binds ++ typ
+ pr_def_token kind ++ spc()
+ ++ pr_lname_decl id ++ binds ++ typ
++ (match c with
| None -> mt()
| Some cc -> str" :=" ++ spc() ++ cc))
@@ -732,13 +723,13 @@ open Decl_kinds
)
| VernacExactProof c ->
return (hov 2 (keyword "Proof" ++ pr_lconstrarg c))
- | VernacAssumption (stre,t,l) ->
+ | VernacAssumption ((discharge,kind),t,l) ->
let n = List.length (List.flatten (List.map fst (List.map snd l))) in
let pr_params (c, (xl, t)) =
hov 2 (prlist_with_sep sep pr_ident_decl xl ++ spc() ++
(if c then str":>" else str":" ++ spc() ++ pr_lconstr_expr t)) in
let assumptions = prlist_with_sep spc (fun p -> hov 1 (str "(" ++ pr_params p ++ str ")")) l in
- return (hov 2 (pr_assumption_token (n > 1) stre ++
+ return (hov 2 (pr_assumption_token (n > 1) discharge kind ++
pr_non_empty_arg pr_assumption_inline t ++ spc() ++ assumptions))
| VernacInductive (cum, p,f,l) ->
let pr_constructor (coe,(id,c)) =
@@ -788,9 +779,8 @@ open Decl_kinds
| VernacFixpoint (local, recs) ->
let local = match local with
- | Some Discharge -> "Let "
- | Some Local -> "Local "
- | None | Some Global -> ""
+ | DoDischarge -> "Let "
+ | NoDischarge -> ""
in
return (
hov 0 (str local ++ keyword "Fixpoint" ++ spc () ++
@@ -800,9 +790,8 @@ open Decl_kinds
| VernacCoFixpoint (local, corecs) ->
let local = match local with
- | Some Discharge -> keyword "Let" ++ spc ()
- | Some Local -> keyword "Local" ++ spc ()
- | None | Some Global -> str ""
+ | DoDischarge -> keyword "Let" ++ spc ()
+ | NoDischarge -> str ""
in
let pr_onecorec ((iddecl,bl,c,def),ntn) =
pr_ident_decl iddecl ++ spc() ++ pr_binders bl ++ spc() ++ str":" ++
@@ -863,14 +852,14 @@ open Decl_kinds
return (
keyword "Canonical Structure" ++ spc() ++ pr_smart_global q
)
- | VernacCoercion (_,id,c1,c2) ->
+ | VernacCoercion (id,c1,c2) ->
return (
hov 1 (
keyword "Coercion" ++ spc() ++
pr_smart_global id ++ spc() ++ str":" ++ spc() ++ pr_class_rawexpr c1 ++
spc() ++ str">->" ++ spc() ++ pr_class_rawexpr c2)
)
- | VernacIdentityCoercion (_,id,c1,c2) ->
+ | VernacIdentityCoercion (id,c1,c2) ->
return (
hov 1 (
keyword "Identity Coercion" ++ spc() ++ pr_lident id ++
@@ -964,7 +953,7 @@ open Decl_kinds
keyword "LoadPath" ++ spc() ++ qs s ++
(match d with
| None -> mt()
- | Some dir -> spc() ++ keyword "as" ++ spc() ++ pr_dirpath dir))
+ | Some dir -> spc() ++ keyword "as" ++ spc() ++ DirPath.print dir))
)
| VernacRemoveLoadPath s ->
return (keyword "Remove LoadPath" ++ qs s)
@@ -994,9 +983,9 @@ open Decl_kinds
prlist_with_sep spc (fun r -> pr_id (coerce_reference_to_id r)) ids ++
pr_opt_hintbases dbnames)
)
- | VernacHints (_, dbnames,h) ->
+ | VernacHints (dbnames,h) ->
return (pr_hints dbnames h pr_constr pr_constr_pattern_expr)
- | VernacSyntacticDefinition (id,(ids,c),_,compat) ->
+ | VernacSyntacticDefinition (id,(ids,c),compat) ->
return (
hov 2
(keyword "Notation" ++ spc () ++ pr_lident id ++ spc () ++
@@ -1211,26 +1200,34 @@ open Decl_kinds
| VernacSubproof None ->
return (str "{")
| VernacSubproof (Some i) ->
- return (keyword "BeginSubproof" ++ spc () ++ int i)
+ return (Proof_bullet.pr_goal_selector i ++ str ":" ++ spc () ++ str "{")
| VernacEndSubproof ->
return (str "}")
- and pr_extend s cl =
- let pr_arg a =
- try pr_gen a
- with Failure _ -> str "<error in " ++ str (fst s) ++ str ">" in
- try
- let rl = Egramml.get_extend_vernac_rule s in
- let rec aux rl cl =
- match rl, cl with
- | Egramml.GramNonTerminal _ :: rl, arg :: cl -> pr_arg arg :: aux rl cl
- | Egramml.GramTerminal s :: rl, cl -> str s :: aux rl cl
- | [], [] -> []
- | _ -> assert false in
- hov 1 (pr_sequence identity (aux rl cl))
- with Not_found ->
- hov 1 (str "TODO(" ++ str (fst s) ++ spc () ++ prlist_with_sep sep pr_arg cl ++ str ")")
+let pr_vernac_flag =
+ function
+ | VernacPolymorphic true -> keyword "Polymorphic"
+ | VernacPolymorphic false -> keyword "Monomorphic"
+ | VernacProgram -> keyword "Program"
+ | VernacLocal local -> pr_locality local
- let pr_vernac v =
- try pr_vernac_body v ++ sep_end v
- with e -> CErrors.print e
+ let rec pr_vernac_control v =
+ let return = tag_vernac v in
+ match v with
+ | VernacExpr (f, v') ->
+ List.fold_right
+ (fun f a -> pr_vernac_flag f ++ spc() ++ a)
+ f
+ (pr_vernac_expr v' ++ sep_end v')
+ | VernacTime (_,(_,v)) ->
+ return (keyword "Time" ++ spc() ++ pr_vernac_control v)
+ | VernacRedirect (s, (_,v)) ->
+ return (keyword "Redirect" ++ spc() ++ qs s ++ spc() ++ pr_vernac_control v)
+ | VernacTimeout(n,v) ->
+ return (keyword "Timeout " ++ int n ++ spc() ++ pr_vernac_control v)
+ | VernacFail v ->
+ return (keyword "Fail" ++ spc() ++ pr_vernac_control v)
+
+ let pr_vernac v =
+ try pr_vernac_control v
+ with e -> CErrors.print e
diff --git a/printing/ppvernac.mli b/printing/ppvernac.mli
index cf27b413c..34b4fb97f 100644
--- a/printing/ppvernac.mli
+++ b/printing/ppvernac.mli
@@ -12,11 +12,11 @@
(** Prints a fixpoint body *)
val pr_rec_definition : (Vernacexpr.fixpoint_expr * Vernacexpr.decl_notation list) -> Pp.t
-(** Prints a vernac expression *)
-val pr_vernac_body : Vernacexpr.vernac_expr -> Pp.t
+(** Prints a vernac expression without dot *)
+val pr_vernac_expr : Vernacexpr.vernac_expr -> Pp.t
(** Prints a "proof using X" clause. *)
val pr_using : Vernacexpr.section_subset_expr -> Pp.t
(** Prints a vernac expression and closes it with a dot. *)
-val pr_vernac : Vernacexpr.vernac_expr -> Pp.t
+val pr_vernac : Vernacexpr.vernac_control -> Pp.t
diff --git a/printing/prettyp.ml b/printing/prettyp.ml
index fdaeded87..2b7886d11 100644
--- a/printing/prettyp.ml
+++ b/printing/prettyp.ml
@@ -15,7 +15,6 @@ open CErrors
open Util
open Names
open Nameops
-open Term
open Termops
open Declarations
open Environ
@@ -33,15 +32,15 @@ open Context.Rel.Declaration
module NamedDecl = Context.Named.Declaration
type object_pr = {
- print_inductive : mutual_inductive -> Pp.t;
- print_constant_with_infos : constant -> Pp.t;
- print_section_variable : variable -> Pp.t;
- print_syntactic_def : kernel_name -> Pp.t;
- print_module : bool -> Names.module_path -> Pp.t;
- print_modtype : module_path -> Pp.t;
- print_named_decl : Context.Named.Declaration.t -> Pp.t;
- print_library_entry : bool -> (object_name * Lib.node) -> Pp.t option;
- print_context : bool -> int option -> Lib.library_segment -> Pp.t;
+ print_inductive : MutInd.t -> Universes.univ_name_list option -> Pp.t;
+ print_constant_with_infos : Constant.t -> Universes.univ_name_list option -> Pp.t;
+ print_section_variable : env -> Evd.evar_map -> variable -> Pp.t;
+ print_syntactic_def : env -> KerName.t -> Pp.t;
+ print_module : bool -> ModPath.t -> Pp.t;
+ print_modtype : ModPath.t -> Pp.t;
+ print_named_decl : env -> Evd.evar_map -> Context.Named.Declaration.t -> Pp.t;
+ print_library_entry : env -> Evd.evar_map -> bool -> (object_name * Lib.node) -> Pp.t option;
+ print_context : env -> Evd.evar_map -> bool -> int option -> Lib.library_segment -> Pp.t;
print_typed_value_in_env : Environ.env -> Evd.evar_map -> EConstr.constr * EConstr.types -> Pp.t;
print_eval : Reductionops.reduction_function -> env -> Evd.evar_map -> Constrexpr.constr_expr -> EConstr.unsafe_judgment -> Pp.t;
}
@@ -69,7 +68,7 @@ let int_or_no n = if Int.equal n 0 then str "no" else int n
let print_basename sp = pr_global (ConstRef sp)
-let print_ref reduce ref =
+let print_ref reduce ref udecl =
let typ, ctx = Global.type_of_global_in_context (Global.env ()) ref in
let typ = Vars.subst_instance_constr (Univ.AUContext.instance ctx) typ in
let typ = EConstr.of_constr typ in
@@ -82,7 +81,8 @@ let print_ref reduce ref =
let inst = Univ.AUContext.instance univs in
let univs = Univ.UContext.make (inst, Univ.AUContext.instantiate inst univs) in
let env = Global.env () in
- let bl = Universes.universe_binders_of_global ref in
+ let bl = Universes.universe_binders_with_opt_names ref
+ (Array.to_list (Univ.Instance.to_array inst)) udecl in
let sigma = Evd.from_ctx (Evd.evar_universe_context_of_binders bl) in
let inst =
if Global.is_polymorphic ref then Printer.pr_universe_instance sigma univs
@@ -94,7 +94,7 @@ let print_ref reduce ref =
(********************************)
(** Printing implicit arguments *)
-let pr_impl_name imp = pr_id (name_of_implicit imp)
+let pr_impl_name imp = Id.print (name_of_implicit imp)
let print_impargs_by_name max = function
| [] -> []
@@ -139,7 +139,7 @@ let print_renames_list prefix l =
let need_expansion impl ref =
let typ, _ = Global.type_of_global_in_context (Global.env ()) ref in
- let ctx = prod_assum typ in
+ let ctx = Term.prod_assum typ in
let nprods = List.count is_local_assum ctx in
not (List.is_empty impl) && List.length impl >= nprods &&
let _,lastimpl = List.chop nprods impl in
@@ -151,7 +151,7 @@ let print_impargs ref =
let has_impl = not (List.is_empty impl) in
(* Need to reduce since implicits are computed with products flattened *)
pr_infos_list
- ([ print_ref (need_expansion (select_impargs_size 0 impl) ref) ref;
+ ([ print_ref (need_expansion (select_impargs_size 0 impl) ref) ref None;
blankline ] @
(if has_impl then print_impargs_list (mt()) impl
else [str "No implicit arguments"]))
@@ -235,10 +235,10 @@ let print_type_in_type ref =
let print_primitive_record recflag mipv = function
| Some (Some (_, ps,_)) ->
let eta = match recflag with
- | Decl_kinds.CoFinite | Decl_kinds.Finite -> str" without eta conversion"
- | Decl_kinds.BiFinite -> str " with eta conversion"
+ | CoFinite | Finite -> str" without eta conversion"
+ | BiFinite -> str " with eta conversion"
in
- [pr_id mipv.(0).mind_typename ++ str" has primitive projections" ++ eta ++ str"."]
+ [Id.print mipv.(0).mind_typename ++ str" has primitive projections" ++ eta ++ str"."]
| _ -> []
let print_primitive ref =
@@ -257,7 +257,7 @@ let print_name_infos ref =
if need_expansion (select_impargs_size 0 impls) ref then
(* Need to reduce since implicits are computed with products flattened *)
[str "Expanded type for implicit arguments";
- print_ref true ref; blankline]
+ print_ref true ref None; blankline]
else
[] in
print_polymorphism ref @
@@ -271,7 +271,7 @@ let print_name_infos ref =
let print_id_args_data test pr id l =
if List.exists test l then
- pr (str "For " ++ pr_id id) l
+ pr (str "For " ++ Id.print id) l
else
[]
@@ -318,8 +318,8 @@ type locatable = Locatable : 'a locatable_info -> locatable
type logical_name =
| Term of global_reference
| Dir of global_dir_reference
- | Syntactic of kernel_name
- | ModuleType of module_path
+ | Syntactic of KerName.t
+ | ModuleType of ModPath.t
| Other : 'a * 'a locatable_info -> logical_name
| Undefined of qualid
@@ -360,13 +360,13 @@ let pr_located_qualid = function
str "Notation" ++ spc () ++ pr_path (Nametab.path_of_syndef kn)
| Dir dir ->
let s,dir = match dir with
- | DirOpenModule (dir,_) -> "Open Module", dir
- | DirOpenModtype (dir,_) -> "Open Module Type", dir
- | DirOpenSection (dir,_) -> "Open Section", dir
- | DirModule (dir,_) -> "Module", dir
+ | DirOpenModule { obj_dir ; _ } -> "Open Module", obj_dir
+ | DirOpenModtype { obj_dir ; _ } -> "Open Module Type", obj_dir
+ | DirOpenSection { obj_dir ; _ } -> "Open Section", obj_dir
+ | DirModule { obj_dir ; _ } -> "Module", obj_dir
| DirClosedSection dir -> "Closed Section", dir
in
- str s ++ spc () ++ pr_dirpath dir
+ str s ++ spc () ++ DirPath.print dir
| ModuleType mp ->
str "Module Type" ++ spc () ++ pr_path (Nametab.path_of_modtype mp)
| Other (obj, info) -> info.name obj
@@ -410,7 +410,7 @@ let locate_term qid =
let locate_module qid =
let all = Nametab.locate_extended_all_dir qid in
let map dir = match dir with
- | DirModule (_, (mp, _)) -> Some (Dir dir, Nametab.shortest_qualid_of_module mp)
+ | DirModule { obj_mp ; _ } -> Some (Dir dir, Nametab.shortest_qualid_of_module obj_mp)
| DirOpenModule _ -> Some (Dir dir, qid)
| _ -> None
in
@@ -456,7 +456,7 @@ let print_located_qualid name flags ref =
| [] ->
let (dir,id) = repr_qualid qid in
if DirPath.is_empty dir then
- str "No " ++ str name ++ str " of basename" ++ spc () ++ pr_id id
+ str "No " ++ str name ++ str " of basename" ++ spc () ++ Id.print id
else
str "No " ++ str name ++ str " of suffix" ++ spc () ++ pr_qualid qid
| l ->
@@ -487,25 +487,25 @@ let gallina_print_typed_value_in_env env sigma (trm,typ) =
the pretty-print of a proposition (P:(nat->nat)->Prop)(P [u]u)
synthesizes the type nat of the abstraction on u *)
-let print_named_def name body typ =
- let pbody = pr_lconstr body in
- let ptyp = pr_ltype typ in
- let pbody = if isCast body then surround pbody else pbody in
+let print_named_def env sigma name body typ =
+ let pbody = pr_lconstr_env env sigma body in
+ let ptyp = pr_ltype_env env sigma typ in
+ let pbody = if Constr.isCast body then surround pbody else pbody in
(str "*** [" ++ str name ++ str " " ++
hov 0 (str ":=" ++ brk (1,2) ++ pbody ++ spc () ++
str ":" ++ brk (1,2) ++ ptyp) ++
str "]")
-let print_named_assum name typ =
- str "*** [" ++ str name ++ str " : " ++ pr_ltype typ ++ str "]"
+let print_named_assum env sigma name typ =
+ str "*** [" ++ str name ++ str " : " ++ pr_ltype_env env sigma typ ++ str "]"
-let gallina_print_named_decl =
+let gallina_print_named_decl env sigma =
let open Context.Named.Declaration in
function
| LocalAssum (id, typ) ->
- print_named_assum (Id.to_string id) typ
+ print_named_assum env sigma (Id.to_string id) typ
| LocalDef (id, body, typ) ->
- print_named_def (Id.to_string id) body typ
+ print_named_def env sigma (Id.to_string id) body typ
let assumptions_for_print lna =
List.fold_right (fun na env -> add_name na env) lna empty_names_context
@@ -513,22 +513,22 @@ let assumptions_for_print lna =
(*********************)
(* *)
-let gallina_print_inductive sp =
+let gallina_print_inductive sp udecl =
let env = Global.env() in
let mib = Environ.lookup_mind sp env in
let mipv = mib.mind_packets in
- pr_mutual_inductive_body env sp mib ++
+ pr_mutual_inductive_body env sp mib udecl ++
with_line_skip
(print_primitive_record mib.mind_finite mipv mib.mind_record @
print_inductive_renames sp mipv @
print_inductive_implicit_args sp mipv @
print_inductive_argument_scopes sp mipv)
-let print_named_decl id =
- gallina_print_named_decl (Global.lookup_named id) ++ fnl ()
+let print_named_decl env sigma id =
+ gallina_print_named_decl env sigma (Global.lookup_named id) ++ fnl ()
-let gallina_print_section_variable id =
- print_named_decl id ++
+let gallina_print_section_variable env sigma id =
+ print_named_decl env sigma id ++
with_line_skip (print_name_infos (VarRef id))
let print_body env evd = function
@@ -546,7 +546,7 @@ let print_instance sigma cb =
pr_universe_instance sigma univs
else mt()
-let print_constant with_values sep sp =
+let print_constant with_values sep sp udecl =
let cb = Global.lookup_constant sp in
let val_0 = Global.body_of_constant_body cb in
let typ =
@@ -556,31 +556,34 @@ let print_constant with_values sep sp =
let inst = Univ.AUContext.instance univs in
Vars.subst_instance_constr inst cb.const_type
in
- let univs =
+ let univs, ulist =
+ let open Entries in
+ let open Univ in
let otab = Global.opaque_tables () in
match cb.const_body with
| Undef _ | Def _ ->
begin
match cb.const_universes with
- | Monomorphic_const ctx -> ctx
+ | Monomorphic_const ctx -> Monomorphic_const_entry ctx, []
| Polymorphic_const ctx ->
- let inst = Univ.AUContext.instance ctx in
- Univ.UContext.make (inst, Univ.AUContext.instantiate inst ctx)
+ let inst = AUContext.instance ctx in
+ Polymorphic_const_entry (UContext.make (inst, AUContext.instantiate inst ctx)),
+ Array.to_list (Instance.to_array inst)
end
| OpaqueDef o ->
let body_uctxs = Opaqueproof.force_constraints otab o in
match cb.const_universes with
| Monomorphic_const ctx ->
- let uctxs = Univ.ContextSet.of_context ctx in
- Univ.ContextSet.to_context (Univ.ContextSet.union body_uctxs uctxs)
+ Monomorphic_const_entry (ContextSet.union body_uctxs ctx), []
| Polymorphic_const ctx ->
- assert(Univ.ContextSet.is_empty body_uctxs);
- let inst = Univ.AUContext.instance ctx in
- Univ.UContext.make (inst, Univ.AUContext.instantiate inst ctx)
+ assert(ContextSet.is_empty body_uctxs);
+ let inst = AUContext.instance ctx in
+ Polymorphic_const_entry (UContext.make (inst, AUContext.instantiate inst ctx)),
+ Array.to_list (Instance.to_array inst)
in
let ctx =
Evd.evar_universe_context_of_binders
- (Universes.universe_binders_of_global (ConstRef sp))
+ (Universes.universe_binders_with_opt_names (ConstRef sp) ulist udecl)
in
let env = Global.env () and sigma = Evd.from_ctx ctx in
let pr_ltype = pr_ltype_env env sigma in
@@ -590,73 +593,73 @@ let print_constant with_values sep sp =
str"*** [ " ++
print_basename sp ++ print_instance sigma cb ++ str " : " ++ cut () ++ pr_ltype typ ++
str" ]" ++
- Printer.pr_universe_ctx sigma univs
+ Printer.pr_constant_universes sigma univs
| Some (c, ctx) ->
let c = Vars.subst_instance_constr (Univ.AUContext.instance ctx) c in
print_basename sp ++ print_instance sigma cb ++ str sep ++ cut () ++
(if with_values then print_typed_body env sigma (Some c,typ) else pr_ltype typ)++
- Printer.pr_universe_ctx sigma univs)
+ Printer.pr_constant_universes sigma univs)
-let gallina_print_constant_with_infos sp =
- print_constant true " = " sp ++
+let gallina_print_constant_with_infos sp udecl =
+ print_constant true " = " sp udecl ++
with_line_skip (print_name_infos (ConstRef sp))
-let gallina_print_syntactic_def kn =
+let gallina_print_syntactic_def env kn =
let qid = Nametab.shortest_qualid_of_syndef Id.Set.empty kn
and (vars,a) = Syntax_def.search_syntactic_definition kn in
let c = Notation_ops.glob_constr_of_notation_constr a in
hov 2
(hov 4
(str "Notation " ++ pr_qualid qid ++
- prlist (fun id -> spc () ++ pr_id id) (List.map fst vars) ++
+ prlist (fun id -> spc () ++ Id.print id) (List.map fst vars) ++
spc () ++ str ":=") ++
spc () ++
Constrextern.without_specific_symbols
- [Notation.SynDefRule kn] pr_glob_constr c)
+ [Notation.SynDefRule kn] (pr_glob_constr_env env) c)
-let gallina_print_leaf_entry with_values ((sp,kn as oname),lobj) =
+let gallina_print_leaf_entry env sigma with_values ((sp,kn as oname),lobj) =
let sep = if with_values then " = " else " : "
and tag = object_tag lobj in
match (oname,tag) with
| (_,"VARIABLE") ->
(* Outside sections, VARIABLES still exist but only with universes
constraints *)
- (try Some(print_named_decl (basename sp)) with Not_found -> None)
+ (try Some(print_named_decl env sigma (basename sp)) with Not_found -> None)
| (_,"CONSTANT") ->
- Some (print_constant with_values sep (constant_of_kn kn))
+ Some (print_constant with_values sep (Constant.make1 kn) None)
| (_,"INDUCTIVE") ->
- Some (gallina_print_inductive (mind_of_kn kn))
+ Some (gallina_print_inductive (MutInd.make1 kn) None)
| (_,"MODULE") ->
- let (mp,_,l) = repr_kn kn in
+ let (mp,_,l) = KerName.repr kn in
Some (print_module with_values (MPdot (mp,l)))
| (_,"MODULE TYPE") ->
- let (mp,_,l) = repr_kn kn in
+ let (mp,_,l) = KerName.repr kn in
Some (print_modtype (MPdot (mp,l)))
| (_,("AUTOHINT"|"GRAMMAR"|"SYNTAXCONSTANT"|"PPSYNTAX"|"TOKEN"|"CLASS"|
"COERCION"|"REQUIRE"|"END-SECTION"|"STRUCTURE")) -> None
(* To deal with forgotten cases... *)
| (_,s) -> None
-let gallina_print_library_entry with_values ent =
- let pr_name (sp,_) = pr_id (basename sp) in
+let gallina_print_library_entry env sigma with_values ent =
+ let pr_name (sp,_) = Id.print (basename sp) in
match ent with
| (oname,Lib.Leaf lobj) ->
- gallina_print_leaf_entry with_values (oname,lobj)
+ gallina_print_leaf_entry env sigma with_values (oname,lobj)
| (oname,Lib.OpenedSection (dir,_)) ->
Some (str " >>>>>>> Section " ++ pr_name oname)
| (oname,Lib.ClosedSection _) ->
Some (str " >>>>>>> Closed Section " ++ pr_name oname)
- | (_,Lib.CompilingLibrary (dir,_)) ->
- Some (str " >>>>>>> Library " ++ pr_dirpath dir)
+ | (_,Lib.CompilingLibrary { obj_dir; _ }) ->
+ Some (str " >>>>>>> Library " ++ DirPath.print obj_dir)
| (oname,Lib.OpenedModule _) ->
Some (str " >>>>>>> Module " ++ pr_name oname)
| (oname,Lib.ClosedModule _) ->
Some (str " >>>>>>> Closed Module " ++ pr_name oname)
-let gallina_print_context with_values =
+let gallina_print_context env sigma with_values =
let rec prec n = function
| h::rest when Option.is_empty n || Option.get n > 0 ->
- (match gallina_print_library_entry with_values h with
+ (match gallina_print_library_entry env sigma with_values h with
| None -> prec n rest
| Some pp -> prec (Option.map ((+) (-1)) n) rest ++ pp ++ fnl ())
| _ -> mt ()
@@ -718,10 +721,10 @@ let print_safe_judgment env sigma j =
(*********************)
(* *)
-let print_full_context () = print_context true None (Lib.contents ())
-let print_full_context_typ () = print_context false None (Lib.contents ())
+let print_full_context env sigma = print_context env sigma true None (Lib.contents ())
+let print_full_context_typ env sigma = print_context env sigma false None (Lib.contents ())
-let print_full_pure_context () =
+let print_full_pure_context env sigma =
let rec prec = function
| ((_,kn),Lib.Leaf lobj)::rest ->
let pp = match object_tag lobj with
@@ -733,29 +736,29 @@ let print_full_pure_context () =
match cb.const_body with
| Undef _ ->
str "Parameter " ++
- print_basename con ++ str " : " ++ cut () ++ pr_ltype typ
+ print_basename con ++ str " : " ++ cut () ++ pr_ltype_env env sigma typ
| OpaqueDef lc ->
str "Theorem " ++ print_basename con ++ cut () ++
- str " : " ++ pr_ltype typ ++ str "." ++ fnl () ++
- str "Proof " ++ pr_lconstr (Opaqueproof.force_proof (Global.opaque_tables ()) lc)
+ str " : " ++ pr_ltype_env env sigma typ ++ str "." ++ fnl () ++
+ str "Proof " ++ pr_lconstr_env env sigma (Opaqueproof.force_proof (Global.opaque_tables ()) lc)
| Def c ->
str "Definition " ++ print_basename con ++ cut () ++
- str " : " ++ pr_ltype typ ++ cut () ++ str " := " ++
- pr_lconstr (Mod_subst.force_constr c))
+ str " : " ++ pr_ltype_env env sigma typ ++ cut () ++ str " := " ++
+ pr_lconstr_env env sigma (Mod_subst.force_constr c))
++ str "." ++ fnl () ++ fnl ()
| "INDUCTIVE" ->
let mind = Global.mind_of_delta_kn kn in
let mib = Global.lookup_mind mind in
- pr_mutual_inductive_body (Global.env()) mind mib ++
+ pr_mutual_inductive_body (Global.env()) mind mib None ++
str "." ++ fnl () ++ fnl ()
| "MODULE" ->
(* TODO: make it reparsable *)
- let (mp,_,l) = repr_kn kn in
+ let (mp,_,l) = KerName.repr kn in
print_module true (MPdot (mp,l)) ++ str "." ++ fnl () ++ fnl ()
| "MODULE TYPE" ->
(* TODO: make it reparsable *)
(* TODO: make it reparsable *)
- let (mp,_,l) = repr_kn kn in
+ let (mp,_,l) = KerName.repr kn in
print_modtype (MPdot (mp,l)) ++ str "." ++ fnl () ++ fnl ()
| _ -> mt () in
prec rest ++ pp
@@ -776,8 +779,8 @@ let read_sec_context r =
with Not_found ->
user_err ?loc ~hdr:"read_sec_context" (str "Unknown section.") in
let rec get_cxt in_cxt = function
- | (_,Lib.OpenedSection ((dir',_),_) as hd)::rest ->
- if DirPath.equal dir dir' then (hd::in_cxt) else get_cxt (hd::in_cxt) rest
+ | (_,Lib.OpenedSection ({obj_dir;_},_) as hd)::rest ->
+ if DirPath.equal dir obj_dir then (hd::in_cxt) else get_cxt (hd::in_cxt) rest
| (_,Lib.ClosedSection _)::rest ->
user_err Pp.(str "Cannot print the contents of a closed section.")
(* LEM: Actually, we could if we wanted to. *)
@@ -787,19 +790,28 @@ let read_sec_context r =
let cxt = Lib.contents () in
List.rev (get_cxt [] cxt)
-let print_sec_context sec =
- print_context true None (read_sec_context sec)
-
-let print_sec_context_typ sec =
- print_context false None (read_sec_context sec)
-
-let print_any_name = function
- | Term (ConstRef sp) -> print_constant_with_infos sp
- | Term (IndRef (sp,_)) -> print_inductive sp
- | Term (ConstructRef ((sp,_),_)) -> print_inductive sp
- | Term (VarRef sp) -> print_section_variable sp
- | Syntactic kn -> print_syntactic_def kn
- | Dir (DirModule(dirpath,(mp,_))) -> print_module (printable_body dirpath) mp
+let print_sec_context env sigma sec =
+ print_context env sigma true None (read_sec_context sec)
+
+let print_sec_context_typ env sigma sec =
+ print_context env sigma false None (read_sec_context sec)
+
+let maybe_error_reject_univ_decl na udecl =
+ match na, udecl with
+ | _, None | Term (ConstRef _ | IndRef _ | ConstructRef _), Some _ -> ()
+ | (Term (VarRef _) | Syntactic _ | Dir _ | ModuleType _ | Other _ | Undefined _), Some udecl ->
+ (* TODO Print na somehow *)
+ user_err ~hdr:"reject_univ_decl" (str "This object does not support universe names.")
+
+let print_any_name env sigma na udecl =
+ maybe_error_reject_univ_decl na udecl;
+ match na with
+ | Term (ConstRef sp) -> print_constant_with_infos sp udecl
+ | Term (IndRef (sp,_)) -> print_inductive sp udecl
+ | Term (ConstructRef ((sp,_),_)) -> print_inductive sp udecl
+ | Term (VarRef sp) -> print_section_variable env sigma sp
+ | Syntactic kn -> print_syntactic_def env kn
+ | Dir (DirModule { obj_dir; obj_mp; _ } ) -> print_module (printable_body obj_dir) obj_mp
| Dir _ -> mt ()
| ModuleType mp -> print_modtype mp
| Other (obj, info) -> info.print obj
@@ -807,31 +819,32 @@ let print_any_name = function
try (* Var locale de but, pas var de section... donc pas d'implicits *)
let dir,str = repr_qualid qid in
if not (DirPath.is_empty dir) then raise Not_found;
- str |> Global.lookup_named |> print_named_decl
+ str |> Global.lookup_named |> print_named_decl env sigma
with Not_found ->
user_err
~hdr:"print_name" (pr_qualid qid ++ spc () ++ str "not a defined object.")
-let print_name = function
+let print_name env sigma na udecl =
+ match na with
| ByNotation (loc,(ntn,sc)) ->
- print_any_name
+ print_any_name env sigma
(Term (Notation.interp_notation_as_global_reference ?loc (fun _ -> true)
ntn sc))
+ udecl
| AN ref ->
- print_any_name (locate_any_name ref)
+ print_any_name env sigma (locate_any_name ref) udecl
-let print_opaque_name qid =
- let env = Global.env () in
+let print_opaque_name env sigma qid =
match Nametab.global qid with
| ConstRef cst ->
let cb = Global.lookup_constant cst in
if Declareops.constant_has_body cb then
- print_constant_with_infos cst
+ print_constant_with_infos cst None
else
user_err Pp.(str "Not a defined constant.")
| IndRef (sp,_) ->
- print_inductive sp
+ print_inductive sp None
| ConstructRef cstr as gr ->
let ty, ctx = Global.type_of_global_in_context env gr in
let inst = Univ.AUContext.instance ctx in
@@ -840,15 +853,16 @@ let print_opaque_name qid =
let open EConstr in
print_typed_value (mkConstruct cstr, ty)
| VarRef id ->
- env |> lookup_named id |> print_named_decl
+ env |> lookup_named id |> print_named_decl env sigma
-let print_about_any ?loc k =
+let print_about_any ?loc env sigma k udecl =
+ maybe_error_reject_univ_decl k udecl;
match k with
| Term ref ->
let rb = Reductionops.ReductionBehaviour.print ref in
Dumpglob.add_glob ?loc ref;
pr_infos_list
- (print_ref false ref :: blankline ::
+ (print_ref false ref udecl :: blankline ::
print_name_infos ref @
(if Pp.ismt rb then [] else [rb]) @
print_opacity ref @
@@ -858,23 +872,24 @@ let print_about_any ?loc k =
| [],Notation_term.NRef ref -> Dumpglob.add_glob ?loc ref
| _ -> () in
v 0 (
- print_syntactic_def kn ++ fnl () ++
+ print_syntactic_def env kn ++ fnl () ++
hov 0 (str "Expands to: " ++ pr_located_qualid k))
| Dir _ | ModuleType _ | Undefined _ ->
hov 0 (pr_located_qualid k)
| Other (obj, info) -> hov 0 (info.about obj)
-let print_about = function
+let print_about env sigma na udecl =
+ match na with
| ByNotation (loc,(ntn,sc)) ->
- print_about_any ?loc
+ print_about_any ?loc env sigma
(Term (Notation.interp_notation_as_global_reference ?loc (fun _ -> true)
- ntn sc))
+ ntn sc)) udecl
| AN ref ->
- print_about_any ?loc:(loc_of_reference ref) (locate_any_name ref)
+ print_about_any ?loc:(loc_of_reference ref) env sigma (locate_any_name ref) udecl
(* for debug *)
-let inspect depth =
- print_context false (Some depth) (Lib.contents ())
+let inspect env sigma depth =
+ print_context env sigma false (Some depth) (Lib.contents ())
(*************************************************************************)
@@ -882,28 +897,28 @@ let inspect depth =
open Classops
-let print_coercion_value v = pr_lconstr (get_coercion_value v)
+let print_coercion_value env sigma v = pr_lconstr_env env sigma (get_coercion_value v)
let print_class i =
let cl,_ = class_info_from_index i in
pr_class cl
-let print_path ((i,j),p) =
+let print_path env sigma ((i,j),p) =
hov 2 (
- str"[" ++ hov 0 (prlist_with_sep pr_semicolon print_coercion_value p) ++
+ str"[" ++ hov 0 (prlist_with_sep pr_semicolon (print_coercion_value env sigma) p) ++
str"] : ") ++
print_class i ++ str" >-> " ++ print_class j
let _ = Classops.install_path_printer print_path
-let print_graph () =
- prlist_with_sep fnl print_path (inheritance_graph())
+let print_graph env sigma =
+ prlist_with_sep fnl (print_path env sigma) (inheritance_graph())
let print_classes () =
pr_sequence pr_class (classes())
-let print_coercions () =
- pr_sequence print_coercion_value (coercions())
+let print_coercions env sigma =
+ pr_sequence (print_coercion_value env sigma) (coercions())
let index_of_class cl =
try
@@ -912,7 +927,7 @@ let index_of_class cl =
user_err ~hdr:"index_of_class"
(pr_class cl ++ spc() ++ str "not a defined class.")
-let print_path_between cls clt =
+let print_path_between env sigma cls clt =
let i = index_of_class cls in
let j = index_of_class clt in
let p =
@@ -923,13 +938,13 @@ let print_path_between cls clt =
(str"No path between " ++ pr_class cls ++ str" and " ++ pr_class clt
++ str ".")
in
- print_path ((i,j),p)
+ print_path env sigma ((i,j),p)
-let print_canonical_projections () =
+let print_canonical_projections env sigma =
prlist_with_sep fnl
(fun ((r1,r2),o) -> pr_cs_pattern r2 ++
str " <- " ++
- pr_global r1 ++ str " ( " ++ pr_lconstr o.o_DEF ++ str " )")
+ pr_global r1 ++ str " ( " ++ pr_lconstr_env env sigma o.o_DEF ++ str " )")
(canonical_projections ())
(*************************************************************************)
@@ -940,7 +955,7 @@ let print_canonical_projections () =
open Typeclasses
let pr_typeclass env t =
- print_ref false t.cl_impl
+ print_ref false t.cl_impl None
let print_typeclasses () =
let env = Global.env () in
@@ -949,7 +964,7 @@ let print_typeclasses () =
let pr_instance env i =
(* gallina_print_constant_with_infos i.is_impl *)
(* lighter *)
- print_ref false (instance_impl i) ++
+ print_ref false (instance_impl i) None ++
begin match hint_priority i with
| None -> mt ()
| Some i -> spc () ++ str "|" ++ spc () ++ int i
diff --git a/printing/prettyp.mli b/printing/prettyp.mli
index dbd101159..fd7f1f92b 100644
--- a/printing/prettyp.mli
+++ b/printing/prettyp.mli
@@ -12,43 +12,46 @@ open Reductionops
open Libnames
open Globnames
open Misctypes
+open Evd
(** A Pretty-Printer for the Calculus of Inductive Constructions. *)
val assumptions_for_print : Name.t list -> Termops.names_context
val print_closed_sections : bool ref
-val print_context : bool -> int option -> Lib.library_segment -> Pp.t
-val print_library_entry : bool -> (object_name * Lib.node) -> Pp.t option
-val print_full_context : unit -> Pp.t
-val print_full_context_typ : unit -> Pp.t
-val print_full_pure_context : unit -> Pp.t
-val print_sec_context : reference -> Pp.t
-val print_sec_context_typ : reference -> Pp.t
+val print_context : env -> Evd.evar_map -> bool -> int option -> Lib.library_segment -> Pp.t
+val print_library_entry : env -> Evd.evar_map -> bool -> (object_name * Lib.node) -> Pp.t option
+val print_full_context : env -> Evd.evar_map -> Pp.t
+val print_full_context_typ : env -> Evd.evar_map -> Pp.t
+val print_full_pure_context : env -> Evd.evar_map -> Pp.t
+val print_sec_context : env -> Evd.evar_map -> reference -> Pp.t
+val print_sec_context_typ : env -> Evd.evar_map -> reference -> Pp.t
val print_judgment : env -> Evd.evar_map -> EConstr.unsafe_judgment -> Pp.t
val print_safe_judgment : env -> Evd.evar_map -> Safe_typing.judgment -> Pp.t
val print_eval :
reduction_function -> env -> Evd.evar_map ->
Constrexpr.constr_expr -> EConstr.unsafe_judgment -> Pp.t
-val print_name : reference or_by_notation -> Pp.t
-val print_opaque_name : reference -> Pp.t
-val print_about : reference or_by_notation -> Pp.t
+val print_name : env -> Evd.evar_map -> reference or_by_notation ->
+ Vernacexpr.univ_name_list option -> Pp.t
+val print_opaque_name : env -> Evd.evar_map -> reference -> Pp.t
+val print_about : env -> Evd.evar_map -> reference or_by_notation ->
+ Vernacexpr.univ_name_list option -> Pp.t
val print_impargs : reference or_by_notation -> Pp.t
(** Pretty-printing functions for classes and coercions *)
-val print_graph : unit -> Pp.t
+val print_graph : env -> evar_map -> Pp.t
val print_classes : unit -> Pp.t
-val print_coercions : unit -> Pp.t
-val print_path_between : Classops.cl_typ -> Classops.cl_typ -> Pp.t
-val print_canonical_projections : unit -> Pp.t
+val print_coercions : env -> Evd.evar_map -> Pp.t
+val print_path_between : env -> evar_map -> Classops.cl_typ -> Classops.cl_typ -> Pp.t
+val print_canonical_projections : env -> Evd.evar_map -> Pp.t
(** Pretty-printing functions for type classes and instances *)
val print_typeclasses : unit -> Pp.t
val print_instances : global_reference -> Pp.t
val print_all_instances : unit -> Pp.t
-val inspect : int -> Pp.t
+val inspect : env -> Evd.evar_map -> int -> Pp.t
(** {5 Locate} *)
@@ -80,17 +83,17 @@ val print_located_module : reference -> Pp.t
val print_located_other : string -> reference -> Pp.t
type object_pr = {
- print_inductive : mutual_inductive -> Pp.t;
- print_constant_with_infos : constant -> Pp.t;
- print_section_variable : variable -> Pp.t;
- print_syntactic_def : kernel_name -> Pp.t;
- print_module : bool -> Names.module_path -> Pp.t;
- print_modtype : module_path -> Pp.t;
- print_named_decl : Context.Named.Declaration.t -> Pp.t;
- print_library_entry : bool -> (object_name * Lib.node) -> Pp.t option;
- print_context : bool -> int option -> Lib.library_segment -> Pp.t;
+ print_inductive : MutInd.t -> Universes.univ_name_list option -> Pp.t;
+ print_constant_with_infos : Constant.t -> Universes.univ_name_list option -> Pp.t;
+ print_section_variable : env -> Evd.evar_map -> variable -> Pp.t;
+ print_syntactic_def : env -> KerName.t -> Pp.t;
+ print_module : bool -> ModPath.t -> Pp.t;
+ print_modtype : ModPath.t -> Pp.t;
+ print_named_decl : env -> Evd.evar_map -> Context.Named.Declaration.t -> Pp.t;
+ print_library_entry : env -> Evd.evar_map -> bool -> (object_name * Lib.node) -> Pp.t option;
+ print_context : env -> Evd.evar_map -> bool -> int option -> Lib.library_segment -> Pp.t;
print_typed_value_in_env : Environ.env -> Evd.evar_map -> EConstr.constr * EConstr.types -> Pp.t;
- print_eval : reduction_function -> env -> Evd.evar_map -> Constrexpr.constr_expr -> EConstr.unsafe_judgment -> Pp.t
+ print_eval : Reductionops.reduction_function -> env -> Evd.evar_map -> Constrexpr.constr_expr -> EConstr.unsafe_judgment -> Pp.t;
}
val set_object_pr : object_pr -> unit
diff --git a/printing/printer.ml b/printing/printer.ml
index 70e96722d..a63004ceb 100644
--- a/printing/printer.ml
+++ b/printing/printer.ml
@@ -10,7 +10,7 @@ open Pp
open CErrors
open Util
open Names
-open Term
+open Constr
open Environ
open Globnames
open Nametab
@@ -25,9 +25,6 @@ module RelDecl = Context.Rel.Declaration
module NamedDecl = Context.Named.Declaration
module CompactedDecl = Context.Compacted.Declaration
-let get_current_context () =
- Pfedit.get_current_context ()
-
let enable_unfocused_goal_printing = ref false
let enable_goal_tags_printing = ref false
let enable_goal_names_printing = ref false
@@ -103,10 +100,10 @@ let pr_econstr_env env sigma c = pr_econstr_core false env sigma c
(* NB do not remove the eta-redexes! Global.env() has side-effects... *)
let pr_lconstr t =
- let (sigma, env) = get_current_context () in
+ let (sigma, env) = Pfedit.get_current_context () in
pr_lconstr_env env sigma t
let pr_constr t =
- let (sigma, env) = get_current_context () in
+ let (sigma, env) = Pfedit.get_current_context () in
pr_constr_env env sigma t
let pr_open_lconstr (_,c) = pr_lconstr c
@@ -126,10 +123,10 @@ let pr_constr_under_binders_env = pr_constr_under_binders_env_gen pr_econstr_env
let pr_lconstr_under_binders_env = pr_constr_under_binders_env_gen pr_leconstr_env
let pr_constr_under_binders c =
- let (sigma, env) = get_current_context () in
+ let (sigma, env) = Pfedit.get_current_context () in
pr_constr_under_binders_env env sigma c
let pr_lconstr_under_binders c =
- let (sigma, env) = get_current_context () in
+ let (sigma, env) = Pfedit.get_current_context () in
pr_lconstr_under_binders_env env sigma c
let pr_etype_core goal_concl_style env sigma t =
@@ -141,10 +138,10 @@ let pr_ltype_env env sigma c = pr_letype_core false env sigma (EConstr.of_constr
let pr_type_env env sigma c = pr_etype_core false env sigma (EConstr.of_constr c)
let pr_ltype t =
- let (sigma, env) = get_current_context () in
+ let (sigma, env) = Pfedit.get_current_context () in
pr_ltype_env env sigma t
let pr_type t =
- let (sigma, env) = get_current_context () in
+ let (sigma, env) = Pfedit.get_current_context () in
pr_type_env env sigma t
let pr_etype_env env sigma c = pr_etype_core false env sigma c
@@ -155,7 +152,7 @@ let pr_ljudge_env env sigma j =
(pr_leconstr_env env sigma j.uj_val, pr_leconstr_env env sigma j.uj_type)
let pr_ljudge j =
- let (sigma, env) = get_current_context () in
+ let (sigma, env) = Pfedit.get_current_context () in
pr_ljudge_env env sigma j
let pr_lglob_constr_env env c =
@@ -164,10 +161,10 @@ let pr_glob_constr_env env c =
pr_constr_expr (extern_glob_constr (Termops.vars_of_env env) c)
let pr_lglob_constr c =
- let (sigma, env) = get_current_context () in
+ let (sigma, env) = Pfedit.get_current_context () in
pr_lglob_constr_env env c
let pr_glob_constr c =
- let (sigma, env) = get_current_context () in
+ let (sigma, env) = Pfedit.get_current_context () in
pr_glob_constr_env env c
let pr_closed_glob_n_env env sigma n c =
@@ -175,7 +172,7 @@ let pr_closed_glob_n_env env sigma n c =
let pr_closed_glob_env env sigma c =
pr_constr_expr (extern_closed_glob false env sigma c)
let pr_closed_glob c =
- let (sigma, env) = get_current_context () in
+ let (sigma, env) = Pfedit.get_current_context () in
pr_closed_glob_env env sigma c
let pr_lconstr_pattern_env env sigma c =
@@ -187,10 +184,10 @@ let pr_cases_pattern t =
pr_cases_pattern_expr (extern_cases_pattern Names.Id.Set.empty t)
let pr_lconstr_pattern t =
- let (sigma, env) = get_current_context () in
+ let (sigma, env) = Pfedit.get_current_context () in
pr_lconstr_pattern_env env sigma t
let pr_constr_pattern t =
- let (sigma, env) = get_current_context () in
+ let (sigma, env) = Pfedit.get_current_context () in
pr_constr_pattern_env env sigma t
let pr_sort sigma s = pr_glob_sort (extern_sort sigma s)
@@ -252,13 +249,20 @@ let safe_gen f env sigma c =
let safe_pr_lconstr_env = safe_gen pr_lconstr_env
let safe_pr_constr_env = safe_gen pr_constr_env
let safe_pr_lconstr t =
- let (sigma, env) = get_current_context () in
+ let (sigma, env) = Pfedit.get_current_context () in
safe_pr_lconstr_env env sigma t
let safe_pr_constr t =
- let (sigma, env) = get_current_context () in
+ let (sigma, env) = Pfedit.get_current_context () in
safe_pr_constr_env env sigma t
+let pr_universe_ctx_set sigma c =
+ if !Detyping.print_universes && not (Univ.ContextSet.is_empty c) then
+ fnl()++pr_in_comment (fun c -> v 0
+ (Univ.pr_universe_context_set (Termops.pr_evd_level sigma) c)) c
+ else
+ mt()
+
let pr_universe_ctx sigma c =
if !Detyping.print_universes && not (Univ.UContext.is_empty c) then
fnl()++pr_in_comment (fun c -> v 0
@@ -266,6 +270,10 @@ let pr_universe_ctx sigma c =
else
mt()
+let pr_constant_universes sigma = function
+ | Entries.Monomorphic_const_entry ctx -> pr_universe_ctx_set sigma ctx
+ | Entries.Polymorphic_const_entry ctx -> pr_universe_ctx sigma ctx
+
let pr_cumulativity_info sigma cumi =
if !Detyping.print_universes
&& not (Univ.UContext.is_empty (Univ.CumulativityInfo.univ_context cumi)) then
@@ -477,7 +485,7 @@ let pr_predicate pr_elt (b, elts) =
if List.is_empty elts then str"none" else pr_elts
let pr_cpred p = pr_predicate (pr_constant (Global.env())) (Cpred.elements p)
-let pr_idpred p = pr_predicate Nameops.pr_id (Id.Pred.elements p)
+let pr_idpred p = pr_predicate Id.print (Id.Pred.elements p)
let pr_transparent_state (ids, csts) =
hv 0 (str"VARIABLES: " ++ pr_idpred ids ++ fnl () ++
@@ -586,7 +594,7 @@ let default_pr_subgoal n sigma =
in
prrec n
-let pr_internal_existential_key ev = str (string_of_existential ev)
+let pr_internal_existential_key ev = Evar.print ev
let print_evar_constraints gl sigma =
let pr_env =
@@ -765,7 +773,7 @@ let default_pr_subgoals ?(pr_first=true)
type printer_pr = {
- pr_subgoals : ?pr_first:bool -> Pp.t option -> evar_map -> evar list -> Goal.goal list -> int list -> goal list -> goal list -> Pp.t;
+ pr_subgoals : ?pr_first:bool -> Pp.t option -> evar_map -> Evar.t list -> Goal.goal list -> int list -> goal list -> goal list -> Pp.t;
pr_subgoal : int -> evar_map -> goal list -> Pp.t;
pr_goal : goal sigma -> Pp.t;
}
@@ -787,7 +795,7 @@ let pr_goal x = !printer_pr.pr_goal x
(* End abstraction layer *)
(**********************************************************************)
-let pr_open_subgoals ?(proof=Proof_global.give_me_the_proof ()) () =
+let pr_open_subgoals ~proof =
(* spiwack: it shouldn't be the job of the printer to look up stuff
in the [evar_map], I did stuff that way because it was more
straightforward, but seriously, [Proof.proof] should return
@@ -825,15 +833,13 @@ let pr_open_subgoals ?(proof=Proof_global.give_me_the_proof ()) () =
pr_subgoals ~pr_first:true None bsigma seeds shelf [] unfocused_if_needed bgoals_focused
end
-let pr_nth_open_subgoal n =
- let pf = Proof_global.give_me_the_proof () in
- let { it=gls ; sigma=sigma } = Proof.V82.subgoals pf in
+let pr_nth_open_subgoal ~proof n =
+ let gls,_,_,_,sigma = Proof.proof proof in
pr_subgoal n sigma gls
-let pr_goal_by_id id =
- let p = Proof_global.give_me_the_proof () in
+let pr_goal_by_id ~proof id =
try
- Proof.in_proof p (fun sigma ->
+ Proof.in_proof proof (fun sigma ->
let g = Evd.evar_key id sigma in
pr_selected_subgoal (pr_id id) sigma g)
with Not_found -> user_err Pp.(str "No such goal.")
@@ -855,15 +861,15 @@ let prterm = pr_lconstr
It is used primarily by the Print Assumptions command. *)
type axiom =
- | Constant of constant (* An axiom or a constant. *)
+ | Constant of Constant.t (* An axiom or a constant. *)
| Positive of MutInd.t (* A mutually inductive definition which has been assumed positive. *)
- | Guarded of constant (* a constant whose (co)fixpoints have been assumed to be guarded *)
+ | Guarded of Constant.t (* a constant whose (co)fixpoints have been assumed to be guarded *)
type context_object =
| Variable of Id.t (* A section variable or a Let definition *)
| Axiom of axiom * (Label.t * Context.Rel.t * types) list
- | Opaque of constant (* An opaque constant. *)
- | Transparent of constant
+ | Opaque of Constant.t (* An opaque constant. *)
+ | Transparent of Constant.t
(* Defines a set of [assumption] *)
module OrderedContextObject =
@@ -873,11 +879,11 @@ struct
let compare_axiom x y =
match x,y with
| Constant k1 , Constant k2 ->
- con_ord k1 k2
+ Constant.CanOrd.compare k1 k2
| Positive m1 , Positive m2 ->
MutInd.CanOrd.compare m1 m2
| Guarded k1 , Guarded k2 ->
- con_ord k1 k2
+ Constant.CanOrd.compare k1 k2
| _ , Constant _ -> 1
| _ , Positive _ -> 1
| _ -> -1
@@ -890,16 +896,16 @@ struct
| Axiom (k1,_) , Axiom (k2, _) -> compare_axiom k1 k2
| Axiom _ , _ -> -1
| _ , Axiom _ -> 1
- | Opaque k1 , Opaque k2 -> con_ord k1 k2
+ | Opaque k1 , Opaque k2 -> Constant.CanOrd.compare k1 k2
| Opaque _ , _ -> -1
| _ , Opaque _ -> 1
- | Transparent k1 , Transparent k2 -> con_ord k1 k2
+ | Transparent k1 , Transparent k2 -> Constant.CanOrd.compare k1 k2
end
module ContextObjectSet = Set.Make (OrderedContextObject)
module ContextObjectMap = Map.Make (OrderedContextObject)
-let pr_assumptionset env s =
+let pr_assumptionset env sigma s =
if ContextObjectMap.is_empty s &&
engagement env = PredicativeSet then
str "Closed under the global context"
@@ -907,15 +913,14 @@ let pr_assumptionset env s =
let safe_pr_constant env kn =
try pr_constant env kn
with Not_found ->
- let mp,_,lab = repr_con kn in
- str (string_of_mp mp) ++ str "." ++ pr_label lab
+ let mp,_,lab = Constant.repr3 kn in
+ str (ModPath.to_string mp) ++ str "." ++ Label.print lab
in
let safe_pr_ltype typ =
try str " : " ++ pr_ltype typ
with e when CErrors.noncritical e -> mt ()
in
let safe_pr_ltype_relctx (rctx, typ) =
- let sigma, env = get_current_context () in
let env = Environ.push_rel_context rctx env in
try str " " ++ pr_ltype_env env sigma typ
with e when CErrors.noncritical e -> mt ()
@@ -942,7 +947,7 @@ let pr_assumptionset env s =
let ax = pr_axiom env axiom typ ++
cut() ++
prlist_with_sep cut (fun (lbl, ctx, ty) ->
- str " used in " ++ pr_label lbl ++
+ str " used in " ++ Label.print lbl ++
str " to prove:" ++ safe_pr_ltype_relctx (ctx,ty))
l in
(v, ax :: a, o, tr)
diff --git a/printing/printer.mli b/printing/printer.mli
index f55206f0d..804014745 100644
--- a/printing/printer.mli
+++ b/printing/printer.mli
@@ -8,7 +8,7 @@
open Names
open Globnames
-open Term
+open Constr
open Environ
open Pattern
open Evd
@@ -27,10 +27,12 @@ val enable_goal_names_printing : bool ref
val pr_lconstr_env : env -> evar_map -> constr -> Pp.t
val pr_lconstr : constr -> Pp.t
+[@@ocaml.deprecated "The global printing API is deprecated, please use the _env functions"]
val pr_lconstr_goal_style_env : env -> evar_map -> constr -> Pp.t
val pr_constr_env : env -> evar_map -> constr -> Pp.t
val pr_constr : constr -> Pp.t
+[@@ocaml.deprecated "The global printing API is deprecated, please use the _env functions"]
val pr_constr_goal_style_env : env -> evar_map -> constr -> Pp.t
val pr_constr_n_env : env -> evar_map -> Notation_term.tolerability -> constr -> Pp.t
@@ -41,14 +43,18 @@ val pr_constr_n_env : env -> evar_map -> Notation_term.tolerability -> co
val safe_pr_lconstr_env : env -> evar_map -> constr -> Pp.t
val safe_pr_lconstr : constr -> Pp.t
+[@@ocaml.deprecated "The global printing API is deprecated, please use the _env functions"]
val safe_pr_constr_env : env -> evar_map -> constr -> Pp.t
val safe_pr_constr : constr -> Pp.t
+[@@ocaml.deprecated "The global printing API is deprecated, please use the _env functions"]
val pr_econstr_env : env -> evar_map -> EConstr.t -> Pp.t
val pr_econstr : EConstr.t -> Pp.t
+[@@ocaml.deprecated "The global printing API is deprecated, please use the _env functions"]
val pr_leconstr_env : env -> evar_map -> EConstr.t -> Pp.t
val pr_leconstr : EConstr.t -> Pp.t
+[@@ocaml.deprecated "The global printing API is deprecated, please use the _env functions"]
val pr_econstr_n_env : env -> evar_map -> Notation_term.tolerability -> EConstr.t -> Pp.t
@@ -57,61 +63,75 @@ val pr_letype_env : env -> evar_map -> EConstr.types -> Pp.t
val pr_open_constr_env : env -> evar_map -> open_constr -> Pp.t
val pr_open_constr : open_constr -> Pp.t
+[@@ocaml.deprecated "The global printing API is deprecated, please use the _env functions"]
val pr_open_lconstr_env : env -> evar_map -> open_constr -> Pp.t
val pr_open_lconstr : open_constr -> Pp.t
+[@@ocaml.deprecated "The global printing API is deprecated, please use the _env functions"]
val pr_constr_under_binders_env : env -> evar_map -> constr_under_binders -> Pp.t
val pr_constr_under_binders : constr_under_binders -> Pp.t
+[@@ocaml.deprecated "The global printing API is deprecated, please use the _env functions"]
val pr_lconstr_under_binders_env : env -> evar_map -> constr_under_binders -> Pp.t
val pr_lconstr_under_binders : constr_under_binders -> Pp.t
+[@@ocaml.deprecated "The global printing API is deprecated, please use the _env functions"]
val pr_goal_concl_style_env : env -> evar_map -> EConstr.types -> Pp.t
val pr_ltype_env : env -> evar_map -> types -> Pp.t
val pr_ltype : types -> Pp.t
+[@@ocaml.deprecated "The global printing API is deprecated, please use the _env functions"]
val pr_type_env : env -> evar_map -> types -> Pp.t
val pr_type : types -> Pp.t
+[@@ocaml.deprecated "The global printing API is deprecated, please use the _env functions"]
val pr_closed_glob_n_env : env -> evar_map -> Notation_term.tolerability -> closed_glob_constr -> Pp.t
val pr_closed_glob_env : env -> evar_map -> closed_glob_constr -> Pp.t
val pr_closed_glob : closed_glob_constr -> Pp.t
+[@@ocaml.deprecated "The global printing API is deprecated, please use the _env functions"]
val pr_ljudge_env : env -> evar_map -> EConstr.unsafe_judgment -> Pp.t * Pp.t
val pr_ljudge : EConstr.unsafe_judgment -> Pp.t * Pp.t
+[@@ocaml.deprecated "The global printing API is deprecated, please use the _env functions"]
-val pr_lglob_constr_env : env -> glob_constr -> Pp.t
-val pr_lglob_constr : glob_constr -> Pp.t
+val pr_lglob_constr_env : env -> 'a glob_constr_g -> Pp.t
+val pr_lglob_constr : 'a glob_constr_g -> Pp.t
+[@@ocaml.deprecated "The global printing API is deprecated, please use the _env functions"]
-val pr_glob_constr_env : env -> glob_constr -> Pp.t
-val pr_glob_constr : glob_constr -> Pp.t
+val pr_glob_constr_env : env -> 'a glob_constr_g -> Pp.t
+val pr_glob_constr : 'a glob_constr_g -> Pp.t
+[@@ocaml.deprecated "The global printing API is deprecated, please use the _env functions"]
val pr_lconstr_pattern_env : env -> evar_map -> constr_pattern -> Pp.t
val pr_lconstr_pattern : constr_pattern -> Pp.t
+[@@ocaml.deprecated "The global printing API is deprecated, please use the _env functions"]
val pr_constr_pattern_env : env -> evar_map -> constr_pattern -> Pp.t
val pr_constr_pattern : constr_pattern -> Pp.t
+[@@ocaml.deprecated "The global printing API is deprecated, please use the _env functions"]
val pr_cases_pattern : cases_pattern -> Pp.t
-val pr_sort : evar_map -> sorts -> Pp.t
+val pr_sort : evar_map -> Sorts.t -> Pp.t
(** Universe constraints *)
val pr_polymorphic : bool -> Pp.t
val pr_cumulative : bool -> bool -> Pp.t
-val pr_universe_instance : evar_map -> Univ.universe_context -> Pp.t
-val pr_universe_ctx : evar_map -> Univ.universe_context -> Pp.t
-val pr_cumulativity_info : evar_map -> Univ.cumulativity_info -> Pp.t
+val pr_universe_instance : evar_map -> Univ.UContext.t -> Pp.t
+val pr_universe_ctx : evar_map -> Univ.UContext.t -> Pp.t
+val pr_universe_ctx_set : evar_map -> Univ.ContextSet.t -> Pp.t
+val pr_constant_universes : evar_map -> Entries.constant_universes_entry -> Pp.t
+val pr_cumulativity_info : evar_map -> Univ.CumulativityInfo.t -> Pp.t
(** Printing global references using names as short as possible *)
val pr_global_env : Id.Set.t -> global_reference -> Pp.t
val pr_global : global_reference -> Pp.t
-val pr_constant : env -> constant -> Pp.t
-val pr_existential_key : evar_map -> existential_key -> Pp.t
+val pr_constant : env -> Constant.t -> Pp.t
+val pr_existential_key : evar_map -> Evar.t -> Pp.t
val pr_existential : env -> evar_map -> existential -> Pp.t
val pr_constructor : env -> constructor -> Pp.t
val pr_inductive : env -> inductive -> Pp.t
@@ -160,15 +180,15 @@ val pr_goal : goal sigma -> Pp.t
focused goals unless the conrresponding option
[enable_unfocused_goal_printing] is set. [seeds] is for printing
dependent evars (mainly for emacs proof tree mode). *)
-val pr_subgoals : ?pr_first:bool -> Pp.t option -> evar_map -> evar list -> Goal.goal list -> int list
+val pr_subgoals : ?pr_first:bool -> Pp.t option -> evar_map -> Evar.t list -> Goal.goal list -> int list
-> goal list -> goal list -> Pp.t
val pr_subgoal : int -> evar_map -> goal list -> Pp.t
val pr_concl : int -> evar_map -> goal -> Pp.t
-val pr_open_subgoals : ?proof:Proof.proof -> unit -> Pp.t
-val pr_nth_open_subgoal : int -> Pp.t
-val pr_evar : evar_map -> (evar * evar_info) -> Pp.t
+val pr_open_subgoals : proof:Proof.t -> Pp.t
+val pr_nth_open_subgoal : proof:Proof.t -> int -> Pp.t
+val pr_evar : evar_map -> (Evar.t * evar_info) -> Pp.t
val pr_evars_int : evar_map -> int -> evar_info Evar.Map.t -> Pp.t
val pr_evars : evar_map -> evar_info Evar.Map.t -> Pp.t
val pr_ne_evar_set : Pp.t -> Pp.t -> evar_map ->
@@ -183,30 +203,29 @@ val prterm : constr -> Pp.t (** = pr_lconstr *)
(** Declarations for the "Print Assumption" command *)
type axiom =
- | Constant of constant (* An axiom or a constant. *)
+ | Constant of Constant.t (* An axiom or a constant. *)
| Positive of MutInd.t (* A mutually inductive definition which has been assumed positive. *)
- | Guarded of constant (* a constant whose (co)fixpoints have been assumed to be guarded *)
+ | Guarded of Constant.t (* a constant whose (co)fixpoints have been assumed to be guarded *)
type context_object =
| Variable of Id.t (* A section variable or a Let definition *)
| Axiom of axiom * (Label.t * Context.Rel.t * types) list
- | Opaque of constant (* An opaque constant. *)
- | Transparent of constant
+ | Opaque of Constant.t (* An opaque constant. *)
+ | Transparent of Constant.t
module ContextObjectSet : Set.S with type elt = context_object
module ContextObjectMap : CMap.ExtS
with type key = context_object and module Set := ContextObjectSet
-val pr_assumptionset :
- env -> Term.types ContextObjectMap.t -> Pp.t
+val pr_assumptionset : env -> evar_map -> types ContextObjectMap.t -> Pp.t
-val pr_goal_by_id : Id.t -> Pp.t
+val pr_goal_by_id : proof:Proof.t -> Id.t -> Pp.t
type printer_pr = {
- pr_subgoals : ?pr_first:bool -> Pp.t option -> evar_map -> evar list -> Goal.goal list -> int list -> goal list -> goal list -> Pp.t;
+ pr_subgoals : ?pr_first:bool -> Pp.t option -> evar_map -> Evar.t list -> Goal.goal list -> int list -> goal list -> goal list -> Pp.t;
pr_subgoal : int -> evar_map -> goal list -> Pp.t;
pr_goal : goal sigma -> Pp.t;
-};;
+}
val set_printer_pr : printer_pr -> unit
diff --git a/printing/printmod.ml b/printing/printmod.ml
index 755e905a7..fb9d45a79 100644
--- a/printing/printmod.ml
+++ b/printing/printmod.ml
@@ -7,12 +7,11 @@
(************************************************************************)
open Util
-open Term
+open Constr
open Pp
open Names
open Environ
open Declarations
-open Nameops
open Globnames
open Libnames
open Goptions
@@ -80,7 +79,7 @@ let print_params env sigma params =
let print_constructors envpar sigma names types =
let pc =
prlist_with_sep (fun () -> brk(1,0) ++ str "| ")
- (fun (id,c) -> pr_id id ++ str " : " ++ Printer.pr_lconstr_env envpar sigma c)
+ (fun (id,c) -> Id.print id ++ str " : " ++ Printer.pr_lconstr_env envpar sigma c)
(Array.to_list (Array.map2 (fun n t -> (n,t)) names types))
in
hv 0 (str " " ++ pc)
@@ -107,7 +106,7 @@ let print_one_inductive env sigma mib ((_,i) as ind) =
else mt ()
in
hov 0 (
- pr_id mip.mind_typename ++ inst ++ brk(1,4) ++ print_params env sigma params ++
+ Id.print mip.mind_typename ++ inst ++ brk(1,4) ++ print_params env sigma params ++
str ": " ++ Printer.pr_lconstr_env envpar sigma arity ++ str " :=") ++
brk(0,2) ++ print_constructors envpar sigma mip.mind_consnames cstrtypes
@@ -122,17 +121,24 @@ let instantiate_cumulativity_info cumi =
in
CumulativityInfo.make (expose univs, expose subtyp)
-let print_mutual_inductive env mind mib =
+let print_mutual_inductive env mind mib udecl =
let inds = List.init (Array.length mib.mind_packets) (fun x -> (mind, x))
in
let keyword =
- let open Decl_kinds in
+ let open Declarations in
match mib.mind_finite with
| Finite -> "Inductive"
| BiFinite -> "Variant"
| CoFinite -> "CoInductive"
in
- let bl = Universes.universe_binders_of_global (IndRef (mind, 0)) in
+ let univs =
+ let open Univ in
+ if Declareops.inductive_is_polymorphic mib then
+ Array.to_list (Instance.to_array
+ (AUContext.instance (Declareops.inductive_polymorphic_context mib)))
+ else []
+ in
+ let bl = Universes.universe_binders_with_opt_names (IndRef (mind, 0)) univs udecl in
let sigma = Evd.from_ctx (Evd.evar_universe_context_of_binders bl) in
hov 0 (Printer.pr_polymorphic (Declareops.inductive_is_polymorphic mib) ++
Printer.pr_cumulative
@@ -149,7 +155,7 @@ let print_mutual_inductive env mind mib =
let get_fields =
let rec prodec_rec l subst c =
- match kind_of_term c with
+ match kind c with
| Prod (na,t,c) ->
let id = match na with Name id -> id | Anonymous -> Id.of_string "_" in
prodec_rec ((id,true,Vars.substl subst t)::l) (mkVar id::subst) c
@@ -160,7 +166,7 @@ let get_fields =
in
prodec_rec [] []
-let print_record env mind mib =
+let print_record env mind mib udecl =
let u =
if Declareops.inductive_is_polymorphic mib then
Univ.AUContext.instance (Declareops.inductive_polymorphic_context mib)
@@ -174,10 +180,11 @@ let print_record env mind mib =
let cstrtype = hnf_prod_applist env cstrtypes.(0) args in
let fields = get_fields cstrtype in
let envpar = push_rel_context params env in
- let bl = Universes.universe_binders_of_global (IndRef (mind,0)) in
+ let bl = Universes.universe_binders_with_opt_names (IndRef (mind,0))
+ (Array.to_list (Univ.Instance.to_array u)) udecl in
let sigma = Evd.from_ctx (Evd.evar_universe_context_of_binders bl) in
let keyword =
- let open Decl_kinds in
+ let open Declarations in
match mib.mind_finite with
| BiFinite -> "Record"
| Finite -> "Inductive"
@@ -189,15 +196,15 @@ let print_record env mind mib =
Printer.pr_cumulative
(Declareops.inductive_is_polymorphic mib)
(Declareops.inductive_is_cumulative mib) ++
- def keyword ++ spc () ++ pr_id mip.mind_typename ++ brk(1,4) ++
+ def keyword ++ spc () ++ Id.print mip.mind_typename ++ brk(1,4) ++
print_params env sigma params ++
str ": " ++ Printer.pr_lconstr_env envpar sigma arity ++ brk(1,2) ++
- str ":= " ++ pr_id mip.mind_consnames.(0)) ++
+ str ":= " ++ Id.print mip.mind_consnames.(0)) ++
brk(1,2) ++
hv 2 (str "{ " ++
prlist_with_sep (fun () -> str ";" ++ brk(2,0))
(fun (id,b,c) ->
- pr_id id ++ str (if b then " : " else " := ") ++
+ Id.print id ++ str (if b then " : " else " := ") ++
Printer.pr_lconstr_env envpar sigma c) fields) ++ str" }" ++
match mib.mind_universes with
| Monomorphic_ind _ | Polymorphic_ind _ -> str ""
@@ -206,18 +213,18 @@ let print_record env mind mib =
sigma (instantiate_cumulativity_info cumi)
)
-let pr_mutual_inductive_body env mind mib =
+let pr_mutual_inductive_body env mind mib udecl =
if mib.mind_record <> None && not !Flags.raw_print then
- print_record env mind mib
+ print_record env mind mib udecl
else
- print_mutual_inductive env mind mib
+ print_mutual_inductive env mind mib udecl
(** Modpaths *)
let rec print_local_modpath locals = function
- | MPbound mbid -> pr_id (Util.List.assoc_f MBId.equal mbid locals)
+ | MPbound mbid -> Id.print (Util.List.assoc_f MBId.equal mbid locals)
| MPdot(mp,l) ->
- print_local_modpath locals mp ++ str "." ++ pr_lab l
+ print_local_modpath locals mp ++ str "." ++ Label.print l
| MPfile _ -> raise Not_found
let print_modpath locals mp =
@@ -238,10 +245,10 @@ let print_kn locals kn =
with
Not_found -> print_modpath locals kn
-let nametab_register_dir mp =
+let nametab_register_dir obj_mp =
let id = mk_fake_top () in
- let dir = DirPath.make [id] in
- Nametab.push_dir (Nametab.Until 1) dir (DirModule (dir,(mp,DirPath.empty)))
+ let obj_dir = DirPath.make [id] in
+ Nametab.push_dir (Nametab.Until 1) obj_dir (DirModule { obj_dir; obj_mp; obj_sec = DirPath.empty })
(** Nota: the [global_reference] we register in the nametab below
might differ from internal ones, since we cannot recreate here
@@ -301,7 +308,7 @@ let nametab_register_modparam mbid mtb =
id
let print_body is_impl env mp (l,body) =
- let name = pr_label l in
+ let name = Label.print l in
hov 2 (match body with
| SFBmodule _ -> keyword "Module" ++ spc () ++ name
| SFBmodtype _ -> keyword "Module Type" ++ spc () ++ name
@@ -336,10 +343,10 @@ let print_body is_impl env mp (l,body) =
| SFBmind mib ->
try
let env = Option.get env in
- pr_mutual_inductive_body env (MutInd.make2 mp l) mib
+ pr_mutual_inductive_body env (MutInd.make2 mp l) mib None
with e when CErrors.noncritical e ->
let keyword =
- let open Decl_kinds in
+ let open Declarations in
match mib.mind_finite with
| Finite -> def "Inductive"
| BiFinite -> def "Variant"
@@ -375,9 +382,12 @@ let rec print_typ_expr env mp locals mty =
| MEwith(me,WithDef(idl,(c, _)))->
let env' = None in (* TODO: build a proper environment if env <> None *)
let s = String.concat "." (List.map Id.to_string idl) in
+ (* XXX: What should env and sigma be here? *)
+ let env = Global.env () in
+ let sigma = Evd.empty in
hov 2 (print_typ_expr env' mp locals me ++ spc() ++ str "with" ++ spc()
++ def "Definition"++ spc() ++ str s ++ spc() ++ str ":="++ spc()
- ++ Printer.pr_lconstr c)
+ ++ Printer.pr_lconstr_env env sigma c)
| MEwith(me,WithMod(idl,mp'))->
let s = String.concat "." (List.map Id.to_string idl) in
hov 2 (print_typ_expr env mp locals me ++ spc() ++ str "with" ++ spc() ++
@@ -403,7 +413,7 @@ let rec print_functor fty fatom is_type env mp locals = function
let kwd = if is_type then "Funsig" else "Functor" in
hov 2
(keyword kwd ++ spc () ++
- str "(" ++ pr_id id ++ str ":" ++ pr_mtb1 ++ str ")" ++
+ str "(" ++ Id.print id ++ str ":" ++ pr_mtb1 ++ str ")" ++
spc() ++ print_functor fty fatom is_type env' mp locals' me2)
let rec print_expression x =
diff --git a/printing/printmod.mli b/printing/printmod.mli
index 8c3f0149e..97ed063fe 100644
--- a/printing/printmod.mli
+++ b/printing/printmod.mli
@@ -11,6 +11,8 @@ open Names
(** false iff the module is an element of an open module type *)
val printable_body : DirPath.t -> bool
-val pr_mutual_inductive_body : Environ.env -> mutual_inductive -> Declarations.mutual_inductive_body -> Pp.t
-val print_module : bool -> module_path -> Pp.t
-val print_modtype : module_path -> Pp.t
+val pr_mutual_inductive_body : Environ.env ->
+ MutInd.t -> Declarations.mutual_inductive_body ->
+ Vernacexpr.univ_name_list option -> Pp.t
+val print_module : bool -> ModPath.t -> Pp.t
+val print_modtype : ModPath.t -> Pp.t
diff --git a/proofs/clenv.ml b/proofs/clenv.ml
index 5ef7fac81..9e06d913b 100644
--- a/proofs/clenv.ml
+++ b/proofs/clenv.ml
@@ -154,7 +154,7 @@ let error_incompatible_inst clenv mv =
Name id ->
user_err ~hdr:"clenv_assign"
(str "An incompatible instantiation has already been found for " ++
- pr_id id)
+ Id.print id)
| _ ->
anomaly ~label:"clenv_assign" (Pp.str "non dependent metavar already assigned.")
@@ -417,7 +417,7 @@ let check_bindings bl =
match List.duplicates qhyp_eq (List.map (fun x -> fst (snd x)) bl) with
| NamedHyp s :: _ ->
user_err
- (str "The variable " ++ pr_id s ++
+ (str "The variable " ++ Id.print s ++
str " occurs more than once in binding list.");
| AnonHyp n :: _ ->
user_err
@@ -435,12 +435,12 @@ let explain_no_such_bound_variable evd id =
in
let mvl = List.fold_left fold [] (Evd.meta_list evd) in
user_err ~hdr:"Evd.meta_with_name"
- (str"No such bound variable " ++ pr_id id ++
+ (str"No such bound variable " ++ Id.print id ++
(if mvl == [] then str " (no bound variables at all in the expression)."
else
(str" (possible name" ++
str (if List.length mvl == 1 then " is: " else "s are: ") ++
- pr_enum pr_id mvl ++ str").")))
+ pr_enum Id.print mvl ++ str").")))
let meta_with_name evd id =
let na = Name id in
@@ -460,7 +460,7 @@ let meta_with_name evd id =
n
| _ ->
user_err ~hdr:"Evd.meta_with_name"
- (str "Binder name \"" ++ pr_id id ++
+ (str "Binder name \"" ++ Id.print id ++
strbrk "\" occurs more than once in clause.")
let meta_of_binder clause loc mvs = function
@@ -474,7 +474,7 @@ let error_already_defined b =
match b with
| NamedHyp id ->
user_err
- (str "Binder name \"" ++ pr_id id ++
+ (str "Binder name \"" ++ Id.print id ++
str"\" already defined with incompatible value.")
| AnonHyp n ->
anomaly
@@ -498,7 +498,7 @@ let clenv_unify_binding_type clenv c t u =
let clenv_assign_binding clenv k c =
let k_typ = clenv_hnf_constr clenv (clenv_meta_type clenv k) in
- let c_typ = nf_betaiota clenv.evd (clenv_get_type_of clenv c) in
+ let c_typ = nf_betaiota clenv.env clenv.evd (clenv_get_type_of clenv c) in
let status,clenv',c = clenv_unify_binding_type clenv c c_typ k_typ in
let c = EConstr.Unsafe.to_constr c in
{ clenv' with evd = meta_assign k (c,(Conv,status)) clenv'.evd }
@@ -639,10 +639,10 @@ let explain_no_such_bound_variable holes id =
let mvl = List.fold_right fold holes [] in
let expl = match mvl with
| [] -> str " (no bound variables at all in the expression)."
- | [id] -> str "(possible name is: " ++ pr_id id ++ str ")."
- | _ -> str "(possible names are: " ++ pr_enum pr_id mvl ++ str ")."
+ | [id] -> str "(possible name is: " ++ Id.print id ++ str ")."
+ | _ -> str "(possible names are: " ++ pr_enum Id.print mvl ++ str ")."
in
- user_err (str "No such bound variable " ++ pr_id id ++ expl)
+ user_err (str "No such bound variable " ++ Id.print id ++ expl)
let evar_with_name holes id =
let map h = match h.hole_name with
@@ -655,7 +655,7 @@ let evar_with_name holes id =
| [h] -> h.hole_evar
| _ ->
user_err
- (str "Binder name \"" ++ pr_id id ++
+ (str "Binder name \"" ++ Id.print id ++
str "\" occurs more than once in clause.")
let evar_of_binder holes = function
diff --git a/proofs/clenv.mli b/proofs/clenv.mli
index 9c69995f4..9a2026dd3 100644
--- a/proofs/clenv.mli
+++ b/proofs/clenv.mli
@@ -11,7 +11,7 @@
evar-based clauses. *)
open Names
-open Term
+open Constr
open Environ
open Evd
open EConstr
diff --git a/proofs/clenvtac.ml b/proofs/clenvtac.ml
index 4a92c3856..8bd5d98cb 100644
--- a/proofs/clenvtac.ml
+++ b/proofs/clenvtac.ml
@@ -54,9 +54,10 @@ let clenv_value_cast_meta clenv =
let clenv_pose_dependent_evars with_evars clenv =
let dep_mvs = clenv_dependent clenv in
+ let env, sigma = clenv.env, clenv.evd in
if not (List.is_empty dep_mvs) && not with_evars then
raise
- (RefinerError (UnresolvedBindings (List.map (meta_name clenv.evd) dep_mvs)));
+ (RefinerError (env, sigma, UnresolvedBindings (List.map (meta_name clenv.evd) dep_mvs)));
clenv_pose_metas_as_evars clenv dep_mvs
(** Use our own fast path, more informative than from Typeclasses *)
diff --git a/proofs/evar_refiner.mli b/proofs/evar_refiner.mli
index a0e3b718a..d90cff572 100644
--- a/proofs/evar_refiner.mli
+++ b/proofs/evar_refiner.mli
@@ -14,5 +14,5 @@ open Ltac_pretype
type glob_constr_ltac_closure = ltac_var_map * glob_constr
-val w_refine : evar * evar_info ->
+val w_refine : Evar.t * evar_info ->
glob_constr_ltac_closure -> evar_map -> evar_map
diff --git a/proofs/goal.ml b/proofs/goal.ml
index 61f3e4a02..d5bc7e0ce 100644
--- a/proofs/goal.ml
+++ b/proofs/goal.ml
@@ -16,7 +16,7 @@ module NamedDecl = Context.Named.Declaration
evar is defined in the current evar_map, should not be accessed. *)
(* type of the goals *)
-type goal = Evd.evar
+type goal = Evar.t
let pr_goal e = str "GOAL:" ++ Pp.int (Evar.repr e)
@@ -99,7 +99,7 @@ module V82 = struct
let same_goal evars1 gl1 evars2 gl2 =
let evi1 = Evd.find evars1 gl1 in
let evi2 = Evd.find evars2 gl2 in
- Term.eq_constr evi1.Evd.evar_concl evi2.Evd.evar_concl &&
+ Constr.equal evi1.Evd.evar_concl evi2.Evd.evar_concl &&
Environ.eq_named_context_val evi1.Evd.evar_hyps evi2.Evd.evar_hyps
let weak_progress glss gls =
diff --git a/proofs/goal.mli b/proofs/goal.mli
index ad968cdfb..37dd9d3c0 100644
--- a/proofs/goal.mli
+++ b/proofs/goal.mli
@@ -58,7 +58,7 @@ module V82 : sig
(* Principal part of the progress tactical *)
val progress : goal list Evd.sigma -> goal Evd.sigma -> bool
-
+
(* Principal part of tclNOTSAMEGOAL *)
val same_goal : Evd.evar_map -> goal -> Evd.evar_map -> goal -> bool
diff --git a/proofs/logic.ml b/proofs/logic.ml
index 20d075ae1..5ff5fa38a 100644
--- a/proofs/logic.ml
+++ b/proofs/logic.ml
@@ -11,7 +11,7 @@ open CErrors
open Util
open Names
open Nameops
-open Term
+open Constr
open Vars
open Termops
open Environ
@@ -40,7 +40,7 @@ type refiner_error =
| DoesNotOccurIn of constr * Id.t
| NoSuchHyp of Id.t
-exception RefinerError of refiner_error
+exception RefinerError of Environ.env * Evd.evar_map * refiner_error
open Pretype_errors
@@ -69,7 +69,7 @@ let catchable_exception = function
| PretypeError(_,_, e) -> is_unification_error e || is_typing_error e
| _ -> false
-let error_no_such_hypothesis id = raise (RefinerError (NoSuchHyp id))
+let error_no_such_hypothesis env sigma id = raise (RefinerError (env, sigma, NoSuchHyp id))
(* Tells if the refiner should check that the submitted rules do not
produce invalid subgoals *)
@@ -78,10 +78,10 @@ let with_check = Flags.with_option check
(* [apply_to_hyp sign id f] splits [sign] into [tail::[id,_,_]::head] and
returns [tail::(f head (id,_,_) (rev tail))] *)
-let apply_to_hyp check sign id f =
+let apply_to_hyp env sigma check sign id f =
try apply_to_hyp sign id f
with Hyp_not_found ->
- if check then error_no_such_hypothesis id
+ if check then error_no_such_hypothesis env sigma id
else sign
let check_typability env sigma c =
@@ -139,15 +139,15 @@ let reorder_context env sigma sign ord =
let ((d,h),mh) = find_q top moved_hyps in
if occur_vars_in_decl env sigma h d then
user_err ~hdr:"reorder_context"
- (str "Cannot move declaration " ++ pr_id top ++ spc() ++
+ (str "Cannot move declaration " ++ Id.print top ++ spc() ++
str "before " ++
- pr_sequence pr_id
+ pr_sequence Id.print
(Id.Set.elements (Id.Set.inter h
(global_vars_set_of_decl env sigma d))));
step ord' expected ctxt_head mh (d::ctxt_tail)
| _ ->
(match ctxt_head with
- | [] -> error_no_such_hypothesis (List.hd ord)
+ | [] -> error_no_such_hypothesis env sigma (List.hd ord)
| d :: ctxt ->
let x = NamedDecl.get_id d in
if Id.Set.mem x expected then
@@ -172,7 +172,7 @@ let check_decl_position env sigma sign d =
let deps = dependency_closure env sigma (named_context_of_val sign) needed in
if Id.List.mem x deps then
user_err ~hdr:"Logic.check_decl_position"
- (str "Cannot create self-referring hypothesis " ++ pr_id x);
+ (str "Cannot create self-referring hypothesis " ++ Id.print x);
x::deps
(* Auxiliary functions for primitive MOVE tactic
@@ -190,9 +190,9 @@ let move_location_eq m1 m2 = match m1, m2 with
| MoveFirst, MoveFirst -> true
| _ -> false
-let split_sign hfrom hto l =
+let split_sign env sigma hfrom hto l =
let rec splitrec left toleft = function
- | [] -> error_no_such_hypothesis hfrom
+ | [] -> error_no_such_hypothesis env sigma hfrom
| d :: right ->
let hyp = NamedDecl.get_id d in
if Id.equal hyp hfrom then
@@ -222,7 +222,7 @@ let move_hyp sigma toleft (left,declfrom,right) hto =
let rec moverec first middle = function
| [] ->
if match hto with MoveFirst | MoveLast -> false | _ -> true then
- error_no_such_hypothesis (hyp_of_move_location hto);
+ error_no_such_hypothesis env sigma (hyp_of_move_location hto);
List.rev first @ List.rev middle
| d :: _ as right when move_location_eq hto (MoveBefore (NamedDecl.get_id d)) ->
List.rev first @ List.rev middle @ right
@@ -233,10 +233,10 @@ let move_hyp sigma toleft (left,declfrom,right) hto =
if not (move_location_eq hto (MoveAfter hyp)) then
(first, d::middle)
else
- user_err ~hdr:"move_hyp" (str "Cannot move " ++ pr_id (NamedDecl.get_id declfrom) ++
- Miscprint.pr_move_location pr_id hto ++
+ user_err ~hdr:"move_hyp" (str "Cannot move " ++ Id.print (NamedDecl.get_id declfrom) ++
+ Miscprint.pr_move_location Id.print hto ++
str (if toleft then ": it occurs in the type of " else ": it depends on ")
- ++ pr_id hyp ++ str ".")
+ ++ Id.print hyp ++ str ".")
else
(d::first, middle)
in
@@ -258,10 +258,10 @@ let move_hyp sigma toleft (left,declfrom,right) hto =
List.fold_left (fun sign d -> push_named_context_val d sign)
right left
-let move_hyp_in_named_context sigma hfrom hto sign =
+let move_hyp_in_named_context env sigma hfrom hto sign =
let open EConstr in
let (left,right,declfrom,toleft) =
- split_sign hfrom hto (named_context_of_val sign) in
+ split_sign env sigma hfrom hto (named_context_of_val sign) in
move_hyp sigma toleft (left,declfrom,right) hto
let insert_decl_in_named_context sigma decl hto sign =
@@ -284,24 +284,24 @@ let error_unsupported_deep_meta c =
strbrk "supported; try \"refine\" instead.")
let collect_meta_variables c =
- let rec collrec deep acc c = match kind_of_term c with
+ let rec collrec deep acc c = match kind c with
| Meta mv -> if deep then error_unsupported_deep_meta () else mv::acc
| Cast(c,_,_) -> collrec deep acc c
- | (App _| Case _) -> Term.fold_constr (collrec deep) acc c
+ | (App _| Case _) -> Constr.fold (collrec deep) acc c
| Proj (_, c) -> collrec deep acc c
- | _ -> Term.fold_constr (collrec true) acc c
+ | _ -> Constr.fold (collrec true) acc c
in
List.rev (collrec false [] c)
-let check_meta_variables c =
+let check_meta_variables env sigma c =
if not (List.distinct_f Int.compare (collect_meta_variables c)) then
- raise (RefinerError (NonLinearProof c))
+ raise (RefinerError (env, sigma, NonLinearProof c))
let check_conv_leq_goal env sigma arg ty conclty =
if !check then
let evm, b = Reductionops.infer_conv env sigma (EConstr.of_constr ty) (EConstr.of_constr conclty) in
if b then evm
- else raise (RefinerError (BadType (arg,ty,conclty)))
+ else raise (RefinerError (env, sigma, BadType (arg,ty,conclty)))
else sigma
exception Stop of EConstr.t list
@@ -332,11 +332,11 @@ let rec mk_refgoals sigma goal goalacc conclty trm =
let sigma = check_conv_leq_goal env sigma trm t'ty conclty in
(goalacc,t'ty,sigma,trm)
else
- match kind_of_term trm with
+ match kind trm with
| Meta _ ->
- let conclty = nf_betaiota sigma (EConstr.of_constr conclty) in
+ let conclty = nf_betaiota env sigma (EConstr.of_constr conclty) in
if !check && occur_meta sigma conclty then
- raise (RefinerError (MetaInType conclty));
+ raise (RefinerError (env, sigma, MetaInType conclty));
let (gl,ev,sigma) = mk_goal hyps conclty in
let ev = EConstr.Unsafe.to_constr ev in
let conclty = EConstr.Unsafe.to_constr conclty in
@@ -372,7 +372,7 @@ let rec mk_refgoals sigma goal goalacc conclty trm =
in
let ((acc'',conclty',sigma), args) = mk_arggoals sigma goal acc' hdty l in
let sigma = check_conv_leq_goal env sigma trm conclty' conclty in
- let ans = if applicand == f && args == l then trm else Term.mkApp (applicand, args) in
+ let ans = if applicand == f && args == l then trm else mkApp (applicand, args) in
(acc'',conclty',sigma, ans)
| Proj (p,c) ->
@@ -394,7 +394,7 @@ let rec mk_refgoals sigma goal goalacc conclty trm =
let lf' = Array.rev_of_list rbranches in
let ans =
if p' == p && c' == c && Array.equal (==) lf' lf then trm
- else Term.mkCase (ci,p',c',lf')
+ else mkCase (ci,p',c',lf')
in
(acc'',conclty',sigma, ans)
@@ -413,10 +413,10 @@ and mk_hdgoals sigma goal goalacc trm =
let hyps = Goal.V82.hyps sigma goal in
let mk_goal hyps concl =
Goal.V82.mk_goal sigma hyps concl (Goal.V82.extra sigma goal) in
- match kind_of_term trm with
+ match kind trm with
| Cast (c,_, ty) when isMeta c ->
check_typability env sigma ty;
- let (gl,ev,sigma) = mk_goal hyps (nf_betaiota sigma (EConstr.of_constr ty)) in
+ let (gl,ev,sigma) = mk_goal hyps (nf_betaiota env sigma (EConstr.of_constr ty)) in
let ev = EConstr.Unsafe.to_constr ev in
gl::goalacc,ty,sigma,ev
@@ -433,7 +433,7 @@ and mk_hdgoals sigma goal goalacc trm =
else mk_hdgoals sigma goal goalacc f
in
let ((acc'',conclty',sigma), args) = mk_arggoals sigma goal acc' hdty l in
- let ans = if applicand == f && args == l then trm else Term.mkApp (applicand, args) in
+ let ans = if applicand == f && args == l then trm else mkApp (applicand, args) in
(acc'',conclty',sigma, ans)
| Case (ci,p,c,lf) ->
@@ -447,7 +447,7 @@ and mk_hdgoals sigma goal goalacc trm =
let lf' = Array.rev_of_list rbranches in
let ans =
if p' == p && c' == c && Array.equal (==) lf' lf then trm
- else Term.mkCase (ci,p',c',lf')
+ else mkCase (ci,p',c',lf')
in
(acc'',conclty',sigma, ans)
@@ -468,16 +468,18 @@ and mk_arggoals sigma goal goalacc funty allargs =
let foldmap (goalacc, funty, sigma) harg =
let t = whd_all (Goal.V82.env sigma goal) sigma (EConstr.of_constr funty) in
let t = EConstr.Unsafe.to_constr t in
- let rec collapse t = match kind_of_term t with
+ let rec collapse t = match kind t with
| LetIn (_, c1, _, b) -> collapse (subst1 c1 b)
| _ -> t
in
let t = collapse t in
- match kind_of_term t with
+ match kind t with
| Prod (_, c1, b) ->
let (acc, hargty, sigma, arg) = mk_refgoals sigma goal goalacc c1 harg in
(acc, subst1 harg b, sigma), arg
- | _ -> raise (RefinerError (CannotApply (t, harg)))
+ | _ ->
+ let env = Goal.V82.env sigma goal in
+ raise (RefinerError (env,sigma,CannotApply (t, harg)))
in
Array.smartfoldmap foldmap (goalacc, funty, sigma) allargs
@@ -497,36 +499,35 @@ and mk_casegoals sigma goal goalacc p c =
let convert_hyp check sign sigma d =
let id = NamedDecl.get_id d in
let b = NamedDecl.get_value d in
- let env = Global.env() in
+ let env = Global.env () in
let reorder = ref [] in
let sign' =
- apply_to_hyp check sign id
+ apply_to_hyp env sigma check sign id
(fun _ d' _ ->
let c = Option.map EConstr.of_constr (NamedDecl.get_value d') in
let env = Global.env_of_context sign in
if check && not (is_conv env sigma (NamedDecl.get_type d) (EConstr.of_constr (NamedDecl.get_type d'))) then
user_err ~hdr:"Logic.convert_hyp"
- (str "Incorrect change of the type of " ++ pr_id id ++ str ".");
+ (str "Incorrect change of the type of " ++ Id.print id ++ str ".");
if check && not (Option.equal (is_conv env sigma) b c) then
user_err ~hdr:"Logic.convert_hyp"
- (str "Incorrect change of the body of "++ pr_id id ++ str ".");
+ (str "Incorrect change of the body of "++ Id.print id ++ str ".");
if check then reorder := check_decl_position env sigma sign d;
map_named_decl EConstr.Unsafe.to_constr d) in
reorder_val_context env sigma sign' !reorder
-
-
(************************************************************************)
(************************************************************************)
(* Primitive tactics are handled here *)
let prim_refiner r sigma goal =
+ let env = Goal.V82.env sigma goal in
let cl = Goal.V82.concl sigma goal in
match r with
(* Logical rules *)
| Refine c ->
let cl = EConstr.Unsafe.to_constr cl in
- check_meta_variables c;
+ check_meta_variables env sigma c;
let (sgl,cl',sigma,oterm) = mk_refgoals sigma goal [] cl c in
let sgl = List.rev sgl in
let sigma = Goal.V82.partial_solution sigma goal (EConstr.of_constr oterm) in
diff --git a/proofs/logic.mli b/proofs/logic.mli
index 9d0756b33..afd1ecf70 100644
--- a/proofs/logic.mli
+++ b/proofs/logic.mli
@@ -9,7 +9,7 @@
(** Legacy proof engine. Do not use in newly written code. *)
open Names
-open Term
+open Constr
open Evd
open Proof_type
@@ -50,16 +50,16 @@ type refiner_error =
| DoesNotOccurIn of constr * Id.t
| NoSuchHyp of Id.t
-exception RefinerError of refiner_error
+exception RefinerError of Environ.env * evar_map * refiner_error
-val error_no_such_hypothesis : Id.t -> 'a
+val error_no_such_hypothesis : Environ.env -> evar_map -> Id.t -> 'a
val catchable_exception : exn -> bool
val convert_hyp : bool -> Environ.named_context_val -> evar_map ->
EConstr.named_declaration -> Environ.named_context_val
-val move_hyp_in_named_context : Evd.evar_map -> Id.t -> Id.t Misctypes.move_location ->
+val move_hyp_in_named_context : Environ.env -> Evd.evar_map -> Id.t -> Id.t Misctypes.move_location ->
Environ.named_context_val -> Environ.named_context_val
val insert_decl_in_named_context : Evd.evar_map ->
diff --git a/proofs/miscprint.ml b/proofs/miscprint.ml
index 5d37c8a02..92b58b409 100644
--- a/proofs/miscprint.ml
+++ b/proofs/miscprint.ml
@@ -6,8 +6,9 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-open Misctypes
open Pp
+open Names
+open Misctypes
(** Printing of [intro_pattern] *)
@@ -18,8 +19,8 @@ let rec pr_intro_pattern prc (_,pat) = match pat with
| IntroAction p -> pr_intro_pattern_action prc p
and pr_intro_pattern_naming = function
- | IntroIdentifier id -> Nameops.pr_id id
- | IntroFresh id -> str "?" ++ Nameops.pr_id id
+ | IntroIdentifier id -> Id.print id
+ | IntroFresh id -> str "?" ++ Id.print id
| IntroAnonymous -> str "?"
and pr_intro_pattern_action prc = function
diff --git a/proofs/pfedit.ml b/proofs/pfedit.ml
index 2d4aba17c..6b503a011 100644
--- a/proofs/pfedit.ml
+++ b/proofs/pfedit.ml
@@ -51,9 +51,8 @@ end
let get_nth_V82_goal i =
let p = Proof_global.give_me_the_proof () in
- let { it=goals ; sigma = sigma; } = Proof.V82.subgoals p in
- try
- { it=(List.nth goals (i-1)) ; sigma=sigma; }
+ let goals,_,_,_,sigma = Proof.proof p in
+ try { it = List.nth goals (i-1) ; sigma }
with Failure _ -> raise NoSuchGoal
let get_goal_context_gen i =
@@ -141,7 +140,8 @@ let build_constant_by_tactic id ctx sign ?(goal_kind = Global, false, Proof Theo
let status = by tac in
let _,(const,univs,_) = cook_proof () in
Proof_global.discard_current ();
- const, status, fst univs
+ let univs = UState.demote_seff_univs const univs in
+ const, status, univs
with reraise ->
let reraise = CErrors.push reraise in
Proof_global.discard_current ();
diff --git a/proofs/pfedit.mli b/proofs/pfedit.mli
index adfe33786..5a317a956 100644
--- a/proofs/pfedit.mli
+++ b/proofs/pfedit.mli
@@ -9,7 +9,7 @@
(** Global proof state. A quite redundant wrapper on {!Proof_global}. *)
open Names
-open Term
+open Constr
open Environ
open Decl_kinds
@@ -35,11 +35,11 @@ val start_proof :
val cook_this_proof :
Proof_global.proof_object ->
(Id.t *
- (Safe_typing.private_constants Entries.definition_entry * Proof_global.proof_universes * goal_kind))
+ (Safe_typing.private_constants Entries.definition_entry * UState.t * goal_kind))
val cook_proof : unit ->
(Id.t *
- (Safe_typing.private_constants Entries.definition_entry * Proof_global.proof_universes * goal_kind))
+ (Safe_typing.private_constants Entries.definition_entry * UState.t * goal_kind))
(** {6 ... } *)
(** [get_goal_context n] returns the context of the [n]th subgoal of
@@ -74,7 +74,7 @@ val current_proof_statement :
val solve : ?with_end_tac:unit Proofview.tactic ->
Vernacexpr.goal_selector -> int option -> unit Proofview.tactic ->
- Proof.proof -> Proof.proof*bool
+ Proof.t -> Proof.t * bool
(** [by tac] applies tactic [tac] to the 1st subgoal of the current
focused proof or raises a UserError if there is no focused proof or
@@ -95,14 +95,14 @@ val instantiate_nth_evar_com : int -> Constrexpr.constr_expr -> unit
tactic. *)
val build_constant_by_tactic :
- Id.t -> Evd.evar_universe_context -> named_context_val -> ?goal_kind:goal_kind ->
+ Id.t -> UState.t -> named_context_val -> ?goal_kind:goal_kind ->
EConstr.types -> unit Proofview.tactic ->
Safe_typing.private_constants Entries.definition_entry * bool *
- Evd.evar_universe_context
+ UState.t
-val build_by_tactic : ?side_eff:bool -> env -> Evd.evar_universe_context -> ?poly:polymorphic ->
+val build_by_tactic : ?side_eff:bool -> env -> UState.t -> ?poly:polymorphic ->
EConstr.types -> unit Proofview.tactic ->
- constr * bool * Evd.evar_universe_context
+ constr * bool * UState.t
val refine_by_tactic : env -> Evd.evar_map -> EConstr.types -> unit Proofview.tactic ->
constr * Evd.evar_map
diff --git a/proofs/proof.ml b/proofs/proof.ml
index ba4980b66..04e707cd6 100644
--- a/proofs/proof.ml
+++ b/proofs/proof.ml
@@ -98,7 +98,7 @@ let done_cond ?(loose_end=false) k = CondDone (loose_end,k)
(* Subpart of the type of proofs. It contains the parts of the proof which
are under control of the undo mechanism *)
-type proof = {
+type t = {
(* Current focused proofview *)
proofview: Proofview.proofview;
(* Entry for the proofview *)
@@ -112,9 +112,11 @@ type proof = {
(* List of goals that have been given up *)
given_up : Goal.goal list;
(* The initial universe context (for the statement) *)
- initial_euctx : Evd.evar_universe_context
+ initial_euctx : UState.t
}
+type proof = t
+
(*** General proof functions ***)
let proof p =
@@ -163,6 +165,7 @@ let map_structured_proof pfts process_goal: 'a pre_goals =
let rec unroll_focus pv = function
| (_,_,ctx)::stk -> unroll_focus (Proofview.unfocus ctx pv) stk
| [] -> pv
+
(* spiwack: a proof is considered completed even if its still focused, if the focus
doesn't hide any goal.
Unfocusing is handled in {!return}. *)
@@ -391,10 +394,12 @@ let pr_proof p =
(*** Compatibility layer with <=v8.2 ***)
module V82 = struct
let subgoals p =
- Proofview.V82.goals p.proofview
+ let it, sigma = Proofview.proofview p.proofview in
+ Evd.{ it; sigma }
let background_subgoals p =
- Proofview.V82.goals (unroll_focus p.proofview p.focus_stack)
+ let it, sigma = Proofview.proofview (unroll_focus p.proofview p.focus_stack) in
+ Evd.{ it; sigma }
let top_goal p =
let { Evd.it=gls ; sigma=sigma; } =
diff --git a/proofs/proof.mli b/proofs/proof.mli
index 698aa48b0..0b5e771ef 100644
--- a/proofs/proof.mli
+++ b/proofs/proof.mli
@@ -30,7 +30,9 @@
*)
(* Type of a proof. *)
-type proof
+type t
+type proof = t
+[@@ocaml.deprecated "please use [Proof.t]"]
(* Returns a stylised view of a proof for use by, for instance,
ide-s. *)
@@ -42,7 +44,7 @@ type proof
shelf (the list of goals on the shelf), a representation of the
given up goals (the list of the given up goals) and the underlying
evar_map *)
-val proof : proof ->
+val proof : t ->
Goal.goal list
* (Goal.goal list * Goal.goal list) list
* Goal.goal list
@@ -61,27 +63,26 @@ type 'a pre_goals = {
(** List of the goals that have been given up *)
}
-val map_structured_proof : proof -> (Evd.evar_map -> Goal.goal -> 'a) -> ('a pre_goals)
+val map_structured_proof : t -> (Evd.evar_map -> Goal.goal -> 'a) -> ('a pre_goals)
(*** General proof functions ***)
-
-val start : Evd.evar_map -> (Environ.env * EConstr.types) list -> proof
-val dependent_start : Proofview.telescope -> proof
-val initial_goals : proof -> (EConstr.constr * EConstr.types) list
-val initial_euctx : proof -> Evd.evar_universe_context
+val start : Evd.evar_map -> (Environ.env * EConstr.types) list -> t
+val dependent_start : Proofview.telescope -> t
+val initial_goals : t -> (EConstr.constr * EConstr.types) list
+val initial_euctx : t -> UState.t
(* Returns [true] if the considered proof is completed, that is if no goal remain
to be considered (this does not require that all evars have been solved). *)
-val is_done : proof -> bool
+val is_done : t -> bool
(* Like is_done, but this time it really means done (i.e. nothing left to do) *)
-val is_complete : proof -> bool
+val is_complete : t -> bool
(* Returns the list of partial proofs to initial goals. *)
-val partial_proof : proof -> EConstr.constr list
+val partial_proof : t -> EConstr.constr list
-val compact : proof -> proof
+val compact : t -> t
(* Returns the proofs (with their type) of the initial goals.
Raises [UnfinishedProof] is some goals remain to be considered.
@@ -92,7 +93,7 @@ exception UnfinishedProof
exception HasShelvedGoals
exception HasGivenUpGoals
exception HasUnresolvedEvar
-val return : proof -> Evd.evar_map
+val return : t -> Evd.evar_map
(*** Focusing actions ***)
@@ -132,7 +133,7 @@ val done_cond : ?loose_end:bool -> 'a focus_kind -> 'a focus_condition
(* focus command (focuses on the [i]th subgoal) *)
(* spiwack: there could also, easily be a focus-on-a-range tactic, is there
a need for it? *)
-val focus : 'a focus_condition -> 'a -> int -> proof -> proof
+val focus : 'a focus_condition -> 'a -> int -> t -> t
exception FullyUnfocused
exception CannotUnfocusThisWay
@@ -148,58 +149,59 @@ exception NoSuchGoals of int * int
Raises [FullyUnfocused] if the proof is not focused.
Raises [CannotUnfocusThisWay] if the proof the unfocusing condition
is not met. *)
-val unfocus : 'a focus_kind -> proof -> unit -> proof
+val unfocus : 'a focus_kind -> t -> unit -> t
(* [unfocused p] returns [true] when [p] is fully unfocused. *)
-val unfocused : proof -> bool
+val unfocused : t -> bool
(* [get_at_focus k] gets the information stored at the closest focus point
of kind [k].
Raises [NoSuchFocus] if there is no focus point of kind [k]. *)
exception NoSuchFocus
-val get_at_focus : 'a focus_kind -> proof -> 'a
+val get_at_focus : 'a focus_kind -> t -> 'a
(* [is_last_focus k] check if the most recent focus is of kind [k] *)
-val is_last_focus : 'a focus_kind -> proof -> bool
+val is_last_focus : 'a focus_kind -> t -> bool
(* returns [true] if there is no goal under focus. *)
-val no_focused_goal : proof -> bool
+val no_focused_goal : t -> bool
(*** Tactics ***)
(* the returned boolean signal whether an unsafe tactic has been
used. In which case it is [false]. *)
val run_tactic : Environ.env ->
- unit Proofview.tactic -> proof -> proof*(bool*Proofview_monad.Info.tree)
+ unit Proofview.tactic -> t -> t * (bool*Proofview_monad.Info.tree)
-val maximal_unfocus : 'a focus_kind -> proof -> proof
+val maximal_unfocus : 'a focus_kind -> t -> t
(*** Commands ***)
-val in_proof : proof -> (Evd.evar_map -> 'a) -> 'a
+val in_proof : t -> (Evd.evar_map -> 'a) -> 'a
(* Remove all the goals from the shelf and adds them at the end of the
focused goals. *)
-val unshelve : proof -> proof
+val unshelve : t -> t
-val pr_proof : proof -> Pp.t
+val pr_proof : t -> Pp.t
(*** Compatibility layer with <=v8.2 ***)
module V82 : sig
- val subgoals : proof -> Goal.goal list Evd.sigma
+ val subgoals : t -> Goal.goal list Evd.sigma
+ [@@ocaml.deprecated "Use the first and fifth argument of [Proof.proof]"]
(* All the subgoals of the proof, including those which are not focused. *)
- val background_subgoals : proof -> Goal.goal list Evd.sigma
+ val background_subgoals : t -> Goal.goal list Evd.sigma
- val top_goal : proof -> Goal.goal Evd.sigma
+ val top_goal : t -> Goal.goal Evd.sigma
(* returns the existential variable used to start the proof *)
- val top_evars : proof -> Evd.evar list
+ val top_evars : t -> Evar.t list
(* Turns the unresolved evars into goals.
Raises [UnfinishedProof] if there are still unsolved goals. *)
- val grab_evars : proof -> proof
+ val grab_evars : t -> t
(* Implements the Existential command *)
- val instantiate_evar : int -> Constrexpr.constr_expr -> proof -> proof
+ val instantiate_evar : int -> Constrexpr.constr_expr -> t -> t
end
diff --git a/proofs/proof_bullet.ml b/proofs/proof_bullet.ml
index 4f575ab4b..214916331 100644
--- a/proofs/proof_bullet.ml
+++ b/proofs/proof_bullet.ml
@@ -25,8 +25,8 @@ let pr_bullet b =
type behavior = {
name : string;
- put : proof -> t -> proof;
- suggest: proof -> Pp.t
+ put : Proof.t -> t -> Proof.t;
+ suggest: Proof.t -> Pp.t
}
let behaviors = Hashtbl.create 4
@@ -110,7 +110,7 @@ module Strict = struct
let push (b:t) pr =
focus bullet_cond (b::get_bullets pr) 1 pr
- let suggest_bullet (prf : proof): suggestion =
+ let suggest_bullet (prf : Proof.t): suggestion =
if is_done prf then ProofFinished
else if not (no_focused_goal prf)
then (* No suggestion if a bullet is not mandatory, look for an unfinished bullet *)
@@ -137,7 +137,7 @@ module Strict = struct
in
loop prf
- let rec pop_until (prf : proof) bul : proof =
+ let rec pop_until (prf : Proof.t) bul : Proof.t =
let prf', b = pop prf in
if bullet_eq bul b then prf'
else pop_until prf' bul
diff --git a/proofs/proof_bullet.mli b/proofs/proof_bullet.mli
index 9e924fec9..09fcabf50 100644
--- a/proofs/proof_bullet.mli
+++ b/proofs/proof_bullet.mli
@@ -12,8 +12,6 @@
(* *)
(**********************************************************)
-open Proof
-
type t = Vernacexpr.bullet
(** A [behavior] is the data of a put function which
@@ -22,8 +20,8 @@ type t = Vernacexpr.bullet
with a name to identify the behavior. *)
type behavior = {
name : string;
- put : proof -> t -> proof;
- suggest: proof -> Pp.t
+ put : Proof.t -> t -> Proof.t;
+ suggest: Proof.t -> Pp.t
}
(** A registered behavior can then be accessed in Coq
@@ -39,8 +37,8 @@ val register_behavior : behavior -> unit
(** Handles focusing/defocusing with bullets:
*)
-val put : proof -> t -> proof
-val suggest : proof -> Pp.t
+val put : Proof.t -> t -> Proof.t
+val suggest : Proof.t -> Pp.t
(**********************************************************)
(* *)
diff --git a/proofs/proof_global.ml b/proofs/proof_global.ml
index 621178982..fc94a1013 100644
--- a/proofs/proof_global.ml
+++ b/proofs/proof_global.ml
@@ -68,17 +68,16 @@ let _ =
(* Extra info on proofs. *)
type lemma_possible_guards = int list list
-type proof_universes = Evd.evar_universe_context * Universes.universe_binders option
type proof_object = {
id : Names.Id.t;
entries : Safe_typing.private_constants Entries.definition_entry list;
persistence : Decl_kinds.goal_kind;
- universes: proof_universes;
+ universes: UState.t;
}
type proof_ending =
- | Admitted of Names.Id.t * Decl_kinds.goal_kind * Entries.parameter_entry * proof_universes
+ | Admitted of Names.Id.t * Decl_kinds.goal_kind * Entries.parameter_entry * UState.t
| Proved of Vernacexpr.opacity_flag *
Vernacexpr.lident option *
proof_object
@@ -90,12 +89,15 @@ type pstate = {
terminator : proof_terminator CEphemeron.key;
endline_tactic : Genarg.glob_generic_argument option;
section_vars : Context.Named.t option;
- proof : Proof.proof;
+ proof : Proof.t;
strength : Decl_kinds.goal_kind;
mode : proof_mode CEphemeron.key;
universe_decl: Univdecls.universe_decl;
}
+type t = pstate list
+type state = t
+
let make_terminator f = f
let apply_terminator f = f
@@ -185,7 +187,7 @@ let msg_proofs () =
match get_all_proof_names () with
| [] -> (spc () ++ str"(No proof-editing in progress).")
| l -> (str"." ++ fnl () ++ str"Proofs currently edited:" ++ spc () ++
- (pr_sequence Nameops.pr_id l) ++ str".")
+ (pr_sequence Id.print l) ++ str".")
let there_is_a_proof () = not (List.is_empty !pstates)
let there_are_pending_proofs () = there_is_a_proof ()
@@ -316,11 +318,7 @@ let get_open_goals () =
(List.map (fun (l1,l2) -> List.length l1 + List.length l2) gll) +
List.length shelf
-let constrain_variables init uctx =
- let levels = Univ.Instance.levels (Univ.UContext.instance init) in
- UState.constrain_variables levels uctx
-
-type closed_proof_output = (Term.constr * Safe_typing.private_constants) list * Evd.evar_universe_context
+type closed_proof_output = (Constr.t * Safe_typing.private_constants) list * UState.t
let close_proof ~keep_body_ucst_separate ?feedback_id ~now
(fpl : closed_proof_output Future.computation) =
@@ -329,10 +327,11 @@ let close_proof ~keep_body_ucst_separate ?feedback_id ~now
let poly = pi2 strength (* Polymorphic *) in
let initial_goals = Proof.initial_goals proof in
let initial_euctx = Proof.initial_euctx proof in
+ let constrain_variables ctx =
+ UState.constrain_variables (fst (UState.context_set initial_euctx)) ctx
+ in
let fpl, univs = Future.split2 fpl in
let universes = if poly || now then Future.force univs else initial_euctx in
- let binders, univctx = Evd.check_univ_decl (Evd.from_ctx universes) universe_decl in
- let binders = if poly then Some binders else None in
(* Because of dependent subgoals at the beginning of proofs, we could
have existential variables in the initial types of goals, we need to
normalise them for the kernel. *)
@@ -344,24 +343,24 @@ let close_proof ~keep_body_ucst_separate ?feedback_id ~now
if poly || now then
let make_body t (c, eff) =
let body = c in
- let typ =
- if not (keep_body_ucst_separate || not (Safe_typing.empty_private_constants = eff)) then
- nf t
- else t
- in
- let used_univs_body = Univops.universes_of_constr body in
- let used_univs_typ = Univops.universes_of_constr typ in
- if keep_body_ucst_separate ||
- not (Safe_typing.empty_private_constants = eff) then
- let initunivs = Evd.evar_context_universe_context initial_euctx in
- let ctx = constrain_variables initunivs universes in
+ let allow_deferred =
+ not poly && (keep_body_ucst_separate ||
+ not (Safe_typing.empty_private_constants = eff))
+ in
+ let typ = if allow_deferred then t else nf t in
+ let env = Global.env () in
+ let used_univs_body = Univops.universes_of_constr env body in
+ let used_univs_typ = Univops.universes_of_constr env typ in
+ if allow_deferred then
+ let initunivs = UState.const_univ_entry ~poly initial_euctx in
+ let ctx = constrain_variables universes in
(* For vi2vo compilation proofs are computed now but we need to
complement the univ constraints of the typ with the ones of
the body. So we keep the two sets distinct. *)
- let used_univs = Univ.LSet.union used_univs_body used_univs_typ in
+ let used_univs = Univ.LSet.union used_univs_body used_univs_typ in
let ctx_body = UState.restrict ctx used_univs in
- let _, univs = Evd.check_univ_decl (Evd.from_ctx ctx_body) universe_decl in
- (initunivs, typ), ((body, Univ.ContextSet.of_context univs), eff)
+ let univs = UState.check_mono_univ_decl ctx_body universe_decl in
+ (initunivs, typ), ((body, univs), eff)
else
(* Since the proof is computed now, we can simply have 1 set of
constraints in which we merge the ones for the body and the ones
@@ -370,30 +369,28 @@ let close_proof ~keep_body_ucst_separate ?feedback_id ~now
TODO: check if restrict is really necessary now. *)
let used_univs = Univ.LSet.union used_univs_body used_univs_typ in
let ctx = UState.restrict universes used_univs in
- let _, univs = Evd.check_univ_decl (Evd.from_ctx ctx) universe_decl in
+ let univs = UState.check_univ_decl ~poly ctx universe_decl in
(univs, typ), ((body, Univ.ContextSet.empty), eff)
in
fun t p -> Future.split2 (Future.chain p (make_body t))
else
fun t p ->
+ (* Already checked the univ_decl for the type universes when starting the proof. *)
+ let univctx = Entries.Monomorphic_const_entry (UState.context_set universes) in
Future.from_val (univctx, nf t),
Future.chain p (fun (pt,eff) ->
(* Deferred proof, we already checked the universe declaration with
the initial universes, ensure that the final universes respect
the declaration as well. If the declaration is non-extensible,
this will prevent the body from adding universes and constraints. *)
- let bodyunivs = constrain_variables univctx (Future.force univs) in
- let _, univs = Evd.check_univ_decl (Evd.from_ctx bodyunivs) universe_decl in
- (pt,Univ.ContextSet.of_context univs),eff)
+ let bodyunivs = constrain_variables (Future.force univs) in
+ let univs = UState.check_mono_univ_decl bodyunivs universe_decl in
+ (pt,univs),eff)
in
let entry_fn p (_, t) =
let t = EConstr.Unsafe.to_constr t in
let univstyp, body = make_body t p in
let univs, typ = Future.force univstyp in
- let univs =
- if poly then Entries.Polymorphic_const_entry univs
- else Entries.Monomorphic_const_entry univs
- in
{Entries.
const_entry_body = body;
const_entry_secctx = section_vars;
@@ -405,7 +402,7 @@ let close_proof ~keep_body_ucst_separate ?feedback_id ~now
in
let entries = Future.map2 entry_fn fpl initial_goals in
{ id = pid; entries = entries; persistence = strength;
- universes = (universes, binders) },
+ universes },
fun pr_ending -> CEphemeron.get terminator pr_ending
let return_proof ?(allow_partial=false) () =
@@ -466,8 +463,6 @@ module V82 = struct
pid, (goals, strength)
end
-type state = pstate list
-
let freeze ~marshallable =
match marshallable with
| `Yes ->
@@ -490,7 +485,10 @@ let update_global_env () =
(* XXX: Bullet hook, should be really moved elsewhere *)
let _ =
let hook n =
- let prf = give_me_the_proof () in
- (Proof_bullet.suggest prf) in
+ try
+ let prf = give_me_the_proof () in
+ (Proof_bullet.suggest prf)
+ with NoCurrentProof -> mt ()
+ in
Proofview.set_nosuchgoals_hook hook
diff --git a/proofs/proof_global.mli b/proofs/proof_global.mli
index 8c0f6ad85..27e99f218 100644
--- a/proofs/proof_global.mli
+++ b/proofs/proof_global.mli
@@ -10,6 +10,10 @@
toplevel. In particular it defines the global proof
environment. *)
+type t
+type state = t
+[@@ocaml.deprecated "please use [Proof_global.t]"]
+
val there_are_pending_proofs : unit -> bool
val check_no_pending_proof : unit -> unit
@@ -21,7 +25,7 @@ val discard_current : unit -> unit
val discard_all : unit -> unit
exception NoCurrentProof
-val give_me_the_proof : unit -> Proof.proof
+val give_me_the_proof : unit -> Proof.t
(** @raise NoCurrentProof when outside proof mode. *)
val compact_the_proof : unit -> unit
@@ -33,18 +37,17 @@ val compact_the_proof : unit -> unit
(i.e. an proof ending command) and registers the appropriate
values. *)
type lemma_possible_guards = int list list
-type proof_universes = Evd.evar_universe_context * Universes.universe_binders option
type proof_object = {
id : Names.Id.t;
entries : Safe_typing.private_constants Entries.definition_entry list;
persistence : Decl_kinds.goal_kind;
- universes: proof_universes;
+ universes: UState.t;
}
type proof_ending =
| Admitted of Names.Id.t * Decl_kinds.goal_kind * Entries.parameter_entry *
- proof_universes
+ UState.t
| Proved of Vernacexpr.opacity_flag *
Vernacexpr.lident option *
proof_object
@@ -86,7 +89,7 @@ val close_proof : keep_body_ucst_separate:bool -> Future.fix_exn -> closed_proof
* Both access the current proof state. The former is supposed to be
* chained with a computation that completed the proof *)
-type closed_proof_output = (Term.constr * Safe_typing.private_constants) list * Evd.evar_universe_context
+type closed_proof_output = (Constr.t * Safe_typing.private_constants) list * UState.t
(* If allow_partial is set (default no) then an incomplete proof
* is allowed (no error), and a warn is given if the proof is complete. *)
@@ -107,9 +110,9 @@ val get_open_goals : unit -> int
no current proof.
The return boolean is set to [false] if an unsafe tactic has been used. *)
val with_current_proof :
- (unit Proofview.tactic -> Proof.proof -> Proof.proof*'a) -> 'a
+ (unit Proofview.tactic -> Proof.t -> Proof.t * 'a) -> 'a
val simple_with_current_proof :
- (unit Proofview.tactic -> Proof.proof -> Proof.proof) -> unit
+ (unit Proofview.tactic -> Proof.t -> Proof.t) -> unit
(** Sets the tactic to be used when a tactic line is closed with [...] *)
val set_endline_tactic : Genarg.glob_generic_argument -> unit
@@ -129,11 +132,10 @@ module V82 : sig
Decl_kinds.goal_kind)
end
-type state
-val freeze : marshallable:[`Yes | `No | `Shallow] -> state
-val unfreeze : state -> unit
-val proof_of_state : state -> Proof.proof
-val copy_terminators : src:state -> tgt:state -> state
+val freeze : marshallable:[`Yes | `No | `Shallow] -> t
+val unfreeze : t -> unit
+val proof_of_state : t -> Proof.t
+val copy_terminators : src:t -> tgt:t -> t
(**********************************************************)
diff --git a/proofs/proof_type.ml b/proofs/proof_type.ml
index 2ad5f607f..20293cb9b 100644
--- a/proofs/proof_type.ml
+++ b/proofs/proof_type.ml
@@ -9,7 +9,7 @@
(** Legacy proof engine. Do not use in newly written code. *)
open Evd
-open Term
+open Constr
(** This module defines the structure of proof tree and the tactic type. So, it
is used by [Proof_tree] and [Refiner] *)
diff --git a/proofs/redexpr.ml b/proofs/redexpr.ml
index 6052ba367..9a5d4e154 100644
--- a/proofs/redexpr.ml
+++ b/proofs/redexpr.ml
@@ -25,8 +25,11 @@ open Misctypes
(* call by value normalisation function using the virtual machine *)
let cbv_vm env sigma c =
- let ctyp = Retyping.get_type_of env sigma c in
- Vnorm.cbv_vm env sigma c ctyp
+ if Coq_config.bytecode_compiler then
+ let ctyp = Retyping.get_type_of env sigma c in
+ Vnorm.cbv_vm env sigma c ctyp
+ else
+ compute env sigma c
let warn_native_compute_disabled =
CWarnings.create ~name:"native-compute-disabled" ~category:"native-compiler"
@@ -34,12 +37,12 @@ let warn_native_compute_disabled =
strbrk "native_compute disabled at configure time; falling back to vm_compute.")
let cbv_native env sigma c =
- if Coq_config.no_native_compiler then
- (warn_native_compute_disabled ();
- cbv_vm env sigma c)
- else
+ if Coq_config.native_compiler then
let ctyp = Retyping.get_type_of env sigma c in
Nativenorm.native_norm env sigma c ctyp
+ else
+ (warn_native_compute_disabled ();
+ cbv_vm env sigma c)
let whd_cbn flags env sigma t =
let (state,_) =
diff --git a/proofs/redexpr.mli b/proofs/redexpr.mli
index ccc2440a2..43e598773 100644
--- a/proofs/redexpr.mli
+++ b/proofs/redexpr.mli
@@ -9,7 +9,7 @@
(** Interpretation layer of redexprs such as hnf, cbv, etc. *)
open Names
-open Term
+open Constr
open EConstr
open Pattern
open Genredexpr
diff --git a/proofs/refine.mli b/proofs/refine.mli
index 3b0a9e5b6..cfdcde36e 100644
--- a/proofs/refine.mli
+++ b/proofs/refine.mli
@@ -17,7 +17,7 @@ open Proofview
(** Printer used to print the constr which refine refines. *)
val pr_constr :
- (Environ.env -> Evd.evar_map -> Term.constr -> Pp.t) Hook.t
+ (Environ.env -> Evd.evar_map -> Constr.constr -> Pp.t) Hook.t
(** {7 Refinement primitives} *)
diff --git a/proofs/refiner.ml b/proofs/refiner.ml
index 3e3313eb5..cd2b10906 100644
--- a/proofs/refiner.ml
+++ b/proofs/refiner.ml
@@ -30,8 +30,8 @@ let refiner pr goal_sigma =
(* Profiling refiner *)
let refiner =
if Flags.profile then
- let refiner_key = Profile.declare_profile "refiner" in
- Profile.profile2 refiner_key refiner
+ let refiner_key = CProfile.declare_profile "refiner" in
+ CProfile.profile2 refiner_key refiner
else refiner
(*********************)
diff --git a/proofs/refiner.mli b/proofs/refiner.mli
index 3ff010fe3..52dc8bfd8 100644
--- a/proofs/refiner.mli
+++ b/proofs/refiner.mli
@@ -35,12 +35,12 @@ val tclIDTAC_MESSAGE : Pp.t -> tactic
(** [tclEVARS sigma] changes the current evar map *)
val tclEVARS : evar_map -> tactic
-val tclEVARUNIVCONTEXT : Evd.evar_universe_context -> tactic
+val tclEVARUNIVCONTEXT : UState.t -> tactic
-val tclPUSHCONTEXT : Evd.rigid -> Univ.universe_context_set -> tactic -> tactic
-val tclPUSHEVARUNIVCONTEXT : Evd.evar_universe_context -> tactic
+val tclPUSHCONTEXT : Evd.rigid -> Univ.ContextSet.t -> tactic -> tactic
+val tclPUSHEVARUNIVCONTEXT : UState.t -> tactic
-val tclPUSHCONSTRAINTS : Univ.constraints -> tactic
+val tclPUSHCONSTRAINTS : Univ.Constraint.t -> tactic
(** [tclTHEN tac1 tac2 gls] applies the tactic [tac1] to [gls] and applies
[tac2] to every resulting subgoals *)
diff --git a/proofs/tacmach.ml b/proofs/tacmach.ml
index a8ec4d8ca..bdcb4868b 100644
--- a/proofs/tacmach.ml
+++ b/proofs/tacmach.ml
@@ -55,10 +55,11 @@ let pf_nth_hyp_id gls n = List.nth (pf_hyps gls) (n-1) |> NamedDecl.get_id
let pf_last_hyp gl = List.hd (pf_hyps gl)
let pf_get_hyp gls id =
+ let env, sigma = pf_env gls, project gls in
try
Context.Named.lookup id (pf_hyps gls)
with Not_found ->
- raise (RefinerError (NoSuchHyp id))
+ raise (RefinerError (env, sigma, NoSuchHyp id))
let pf_get_hyp_typ gls id =
id |> pf_get_hyp gls |> NamedDecl.get_type
@@ -86,7 +87,7 @@ let pf_e_reduce = pf_apply
let pf_whd_all = pf_reduce whd_all
let pf_hnf_constr = pf_reduce hnf_constr
let pf_nf = pf_reduce simpl
-let pf_nf_betaiota = pf_reduce (fun _ -> nf_betaiota)
+let pf_nf_betaiota = pf_reduce nf_betaiota
let pf_compute = pf_reduce compute
let pf_unfoldn ubinds = pf_reduce (unfoldn ubinds)
let pf_unsafe_type_of = pf_reduce unsafe_type_of
@@ -102,9 +103,6 @@ let pf_reduce_to_atomic_ind = pf_reduce reduce_to_atomic_ind
let pf_hnf_type_of gls = pf_get_type_of gls %> pf_whd_all gls
-let pf_is_matching gl p c = pf_apply Constr_matching.is_matching_conv gl p c
-let pf_matches gl p c = pf_apply Constr_matching.matches_conv gl p c
-
(********************************************)
(* Definition of the most primitive tactics *)
(********************************************)
@@ -185,9 +183,10 @@ module New = struct
let pf_get_hyp id gl =
let hyps = Proofview.Goal.env gl in
+ let sigma = project gl in
let sign =
try EConstr.lookup_named id hyps
- with Not_found -> raise (RefinerError (NoSuchHyp id))
+ with Not_found -> raise (RefinerError (hyps, sigma, NoSuchHyp id))
in
sign
@@ -223,8 +222,6 @@ module New = struct
let pf_hnf_type_of gl t =
pf_whd_all gl (pf_get_type_of gl t)
- let pf_matches gl pat t = pf_apply Constr_matching.matches_conv gl pat t
-
let pf_whd_all gl t = pf_apply whd_all gl t
let pf_compute gl t = pf_apply compute gl t
diff --git a/proofs/tacmach.mli b/proofs/tacmach.mli
index de9f8e700..e0fb8fbc5 100644
--- a/proofs/tacmach.mli
+++ b/proofs/tacmach.mli
@@ -7,19 +7,19 @@
(************************************************************************)
open Names
-open Term
+open Constr
open Environ
open EConstr
-open Evd
open Proof_type
open Redexpr
-open Pattern
open Locus
-open Ltac_pretype
(** Operations for handling terms under a local typing context. *)
-type 'a sigma = 'a Evd.sigma;;
+type 'a sigma = 'a Evd.sigma
+[@@ocaml.deprecated "alias of Evd.sigma"]
+
+open Evd
type tactic = Proof_type.tactic;;
val sig_it : 'a sigma -> 'a
@@ -77,10 +77,6 @@ val pf_const_value : goal sigma -> pconstant -> constr
val pf_conv_x : goal sigma -> constr -> constr -> bool
val pf_conv_x_leq : goal sigma -> constr -> constr -> bool
-val pf_matches : goal sigma -> constr_pattern -> constr -> patvar_map
-val pf_is_matching : goal sigma -> constr_pattern -> constr -> bool
-
-
(** {6 The most primitive tactics. } *)
val refiner : rule -> tactic
@@ -136,8 +132,6 @@ module New : sig
val pf_whd_all : 'a Proofview.Goal.t -> constr -> constr
val pf_compute : 'a Proofview.Goal.t -> constr -> constr
- val pf_matches : 'a Proofview.Goal.t -> constr_pattern -> constr -> patvar_map
-
val pf_nf_evar : 'a Proofview.Goal.t -> constr -> constr
end
diff --git a/stm/asyncTaskQueue.ml b/stm/asyncTaskQueue.ml
index a356f32e9..26aef5355 100644
--- a/stm/asyncTaskQueue.ml
+++ b/stm/asyncTaskQueue.ml
@@ -10,17 +10,19 @@ open CErrors
open Pp
open Util
-let stm_pr_err pp = Format.eprintf "%s] @[%a@]\n%!" (System.process_id ()) Pp.pp_with pp
-
+let stm_pr_err pp = Format.eprintf "%s] @[%a@]\n%!" (Spawned.process_id ()) Pp.pp_with pp
let stm_prerr_endline s = if !Flags.debug then begin stm_pr_err (str s) end else ()
-type 'a worker_status = [ `Fresh | `Old of 'a ]
+type cancel_switch = bool ref
+let async_proofs_flags_for_workers = ref []
module type Task = sig
type task
type competence
+ type worker_status = Fresh | Old of competence
+
(* Marshallable *)
type request
type response
@@ -29,15 +31,14 @@ module type Task = sig
val extra_env : unit -> string array
(* run by the master, on a thread *)
- val request_of_task : competence worker_status -> task -> request option
- val task_match : competence worker_status -> task -> bool
- val use_response :
- competence worker_status -> task -> response ->
- [ `Stay of competence * task list | `End ]
+ val request_of_task : worker_status -> task -> request option
+ val task_match : worker_status -> task -> bool
+ val use_response : worker_status -> task -> response ->
+ [ `Stay of competence * task list | `End ]
val on_marshal_error : string -> task -> unit
val on_task_cancellation_or_expiration_or_slave_death : task option -> unit
val forward_feedback : Feedback.feedback -> unit
-
+
(* run by the worker *)
val perform : request -> response
@@ -47,8 +48,6 @@ module type Task = sig
end
-type expiration = bool ref
-
module Make(T : Task) () = struct
exception Die
@@ -59,45 +58,45 @@ module Make(T : Task) () = struct
type request = Request of T.request
type more_data =
- | MoreDataUnivLevel of Univ.universe_level list
+ | MoreDataUnivLevel of Universes.universe_id list
let slave_respond (Request r) =
let res = T.perform r in
Response res
exception MarshalError of string
-
+
let marshal_to_channel oc data =
Marshal.to_channel oc data [];
flush oc
-
+
let marshal_err s = raise (MarshalError s)
-
+
let marshal_request oc (req : request) =
try marshal_to_channel oc req
with Failure s | Invalid_argument s | Sys_error s ->
marshal_err ("marshal_request: "^s)
-
+
let unmarshal_request ic =
try (CThread.thread_friendly_input_value ic : request)
with Failure s | Invalid_argument s | Sys_error s ->
marshal_err ("unmarshal_request: "^s)
-
+
let marshal_response oc (res : response) =
try marshal_to_channel oc res
with Failure s | Invalid_argument s | Sys_error s ->
marshal_err ("marshal_response: "^s)
-
+
let unmarshal_response ic =
try (CThread.thread_friendly_input_value ic : response)
with Failure s | Invalid_argument s | Sys_error s ->
marshal_err ("unmarshal_response: "^s)
-
+
let marshal_more_data oc (res : more_data) =
try marshal_to_channel oc res
with Failure s | Invalid_argument s | Sys_error s ->
marshal_err ("marshal_more_data: "^s)
-
+
let unmarshal_more_data ic =
try (CThread.thread_friendly_input_value ic : more_data)
with Failure s | Invalid_argument s | Sys_error s ->
@@ -112,18 +111,18 @@ module Make(T : Task) () = struct
module Model = struct
type process = Worker.process
- type extra = (T.task * expiration) TQueue.t
+ type extra = (T.task * cancel_switch) TQueue.t
let spawn id =
let name = Printf.sprintf "%s:%d" !T.name id in
let proc, ic, oc =
let rec set_slave_opt = function
- | [] -> !Flags.async_proofs_flags_for_workers @
+ | [] -> !async_proofs_flags_for_workers @
["-toploop"; !T.name^"top";
"-worker-id"; name;
"-async-proofs-worker-priority";
- Flags.string_of_priority !Flags.async_proofs_worker_priority]
- | ("-ideslave"|"-emacs"|"-batch")::tl -> set_slave_opt tl
+ CoqworkmgrApi.(string_of_priority !WorkerLoop.async_proofs_worker_priority)]
+ | ("-ideslave"|"-emacs"|"-emacs-U"|"-batch")::tl -> set_slave_opt tl
| ("-async-proofs" |"-toploop" |"-vio2vo"
|"-load-vernac-source" |"-l" |"-load-vernac-source-verbose" |"-lv"
|"-compile" |"-compile-verbose"
@@ -140,7 +139,7 @@ module Make(T : Task) () = struct
let { WorkerPool.extra = queue; exit; cancelled } = cpanel in
let exit () = report_status ~id "Dead"; exit () in
let last_task = ref None in
- let worker_age = ref `Fresh in
+ let worker_age = ref T.Fresh in
let got_token = ref false in
let giveback_exec_token () =
if !got_token then (CoqworkmgrApi.giveback 1; got_token := false) in
@@ -170,8 +169,7 @@ module Make(T : Task) () = struct
| Unix.WSIGNALED sno -> Printf.sprintf "signalled(%d)" sno
| Unix.WSTOPPED sno -> Printf.sprintf "stopped(%d)" sno) in
let more_univs n =
- CList.init n (fun _ ->
- Universes.new_univ_level (Global.current_dirpath ())) in
+ CList.init n (fun _ -> Universes.new_univ_id ()) in
let rec kill_if () =
if not (Worker.is_alive proc) then ()
@@ -213,7 +211,7 @@ module Make(T : Task) () = struct
| `Stay(competence, new_tasks) ->
last_task := None;
giveback_exec_token ();
- worker_age := `Old competence;
+ worker_age := T.Old competence;
add_tasks new_tasks
in
continue ()
@@ -236,7 +234,7 @@ module Make(T : Task) () = struct
type queue = {
active : Pool.pool;
- queue : (T.task * expiration) TQueue.t;
+ queue : (T.task * cancel_switch) TQueue.t;
cleaner : Thread.t option;
}
@@ -252,16 +250,16 @@ module Make(T : Task) () = struct
queue;
cleaner = if size > 0 then Some (Thread.create cleaner queue) else None;
}
-
+
let destroy { active; queue } =
Pool.destroy active;
TQueue.destroy queue
let broadcast { queue } = TQueue.broadcast queue
- let enqueue_task { queue; active } (t, _ as item) =
+ let enqueue_task { queue; active } t ~cancel_switch =
stm_prerr_endline ("Enqueue task "^T.name_of_task t);
- TQueue.push queue item
+ TQueue.push queue (t, cancel_switch)
let cancel_worker { active } n = Pool.cancel n active
@@ -297,7 +295,7 @@ module Make(T : Task) () = struct
let slave_handshake () =
Pool.worker_handshake (Option.get !slave_ic) (Option.get !slave_oc)
- let pp_pid pp = Pp.(str (System.process_id () ^ " ") ++ pp)
+ let pp_pid pp = Pp.(str (Spawned.process_id () ^ " ") ++ pp)
let debug_with_pid = Feedback.(function
| { contents = Message(Debug, loc, pp) } as fb ->
@@ -310,7 +308,7 @@ module Make(T : Task) () = struct
Marshal.to_channel oc (RespFeedback (debug_with_pid fb)) []; flush oc in
ignore (Feedback.add_feeder (fun x -> slave_feeder (Option.get !slave_oc) x));
(* We ask master to allocate universe identifiers *)
- Universes.set_remote_new_univ_level (bufferize (fun () ->
+ Universes.set_remote_new_univ_id (bufferize (fun () ->
marshal_response (Option.get !slave_oc) RespGetCounterNewUnivLevel;
match unmarshal_more_data (Option.get !slave_ic) with
| MoreDataUnivLevel l -> l));
@@ -339,14 +337,14 @@ module Make(T : Task) () = struct
let clear { queue; active } =
assert(Pool.is_empty active); (* We allow that only if no slaves *)
TQueue.clear queue
-
+
let snapshot { queue; active } =
List.map fst
(TQueue.wait_until_n_are_waiting_then_snapshot
(Pool.n_workers active) queue)
let with_n_workers n f =
- let q = create n in
+ let q = create n in
try let rc = f q in destroy q; rc
with e -> let e = CErrors.push e in destroy q; iraise e
diff --git a/stm/asyncTaskQueue.mli b/stm/asyncTaskQueue.mli
index 1044e668b..706d36e1d 100644
--- a/stm/asyncTaskQueue.mli
+++ b/stm/asyncTaskQueue.mli
@@ -6,79 +6,214 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-type 'a worker_status = [ `Fresh | `Old of 'a ]
+(* Default flags for workers *)
+val async_proofs_flags_for_workers : string list ref
+(** This file provides an API for defining and managing a queue of
+ tasks to be done by external workers.
+
+ A queue of items of type [task] is maintained, then for each task,
+ a request is generated, then sent to a worker using marshalling.
+
+ The workers will then eventually return a result, using marshalling
+ again:
+ ____ ____ ____ ________
+ | T1 | T2 | T3 | => [request ] => | Worker |
+ |____|____|____| <= [response] <= |________|
+ | Master Proc. |
+ \--------------/
+
+ Thus [request] and [response] must be safely marshallable.
+
+ Operations for managing the task queue are provide, see below
+ for more details.
+
+ *)
+
+(** The [Task] module type defines an abstract message-processing
+ queue. *)
module type Task = sig
+ (** Main description of a task. Elements are stored in the "master"
+ process, and then converted into a request.
+ *)
type task
+
+ (** [competence] stores the information about what kind of work a
+ worker has completed / has available. *)
type competence
- (* Marshallable *)
+ (** A worker_status is:
+
+ - [`Fresh] when a worker is born.
+
+ - [`Old of competence]: When a worker ends a job it can either die
+ (and be replaced by a fresh new worker) or hang there as an [`Old]
+ worker. In such case some data can be carried by the [`Old]
+ constructor, typically used to implement [request_of_task].
+
+ This allows to implement both one-shot workers and "persistent"
+ ones. E.g. par: is implement using workers that don't
+ "reboot". Proof workers do reboot mainly because the vm has some
+ C state that cannot be cleared, so you have a real memory leak if
+ you don't reboot the worker. *)
+ type worker_status = Fresh | Old of competence
+
+ (** Type of input and output data for workers.
+
+ The data must be marshallable as it send through the network
+ using [Marshal] . *)
type request
type response
- val name : string ref (* UID of the task kind, for -toploop *)
+ (** UID of the task kind, for -toploop *)
+ val name : string ref
+ (** Extra arguments of the task kind, for -toploop *)
val extra_env : unit -> string array
- (* run by the master, on a thread *)
- val request_of_task : competence worker_status -> task -> request option
- val task_match : competence worker_status -> task -> bool
- val use_response :
- competence worker_status -> task -> response ->
- [ `Stay of competence * task list | `End ]
+ (** {5 Master API, it is run by the master, on a thread} *)
+
+ (** [request_of_task status t] takes the [status] of the worker
+ and a task [t] and creates the corresponding [Some request] to be
+ sent to the worker or it is not valid anymore [None]. *)
+ val request_of_task : worker_status -> task -> request option
+
+ (** [task_match status tid] Allows to discard tasks based on the
+ worker status. *)
+ val task_match : worker_status -> task -> bool
+
+ (** [use_response status t out]
+
+ For a response [out] to a task [t] with [status] we can choose
+ to end the worker of to keep it alive with some data and
+ immediately inject extra tasks in the queue.
+
+ For example, the proof worker runs a proof and finds an error,
+ the response signals that, e.g.
+
+ [ReponseError {state = 34; msg = "oops"}]
+
+ When the manager uses such a response he can tell the worker to
+ stay there and inject into the queue an extra task requesting
+ state 33 (to implement efficient proof repair). *)
+ val use_response : worker_status -> task -> response ->
+ [ `Stay of competence * task list | `End ]
+
+ (** [on_marshal_error err_msg tid] notifies of marshaling failure. *)
val on_marshal_error : string -> task -> unit
+
+ (** [on_task_cancellation_or_expiration_or_slave_death tid]
+
+ These functions are meant to parametrize the worker manager on
+ the actions to be taken when things go wrong or are cancelled
+ (you can kill a worker in CoqIDE, or using kill -9...)
+
+ E.g. master can decide to inhabit the (delegate) Future.t with a
+ closure (to be run in master), i.e. make the document still
+ checkable. This is what I do for marshaling errors. *)
val on_task_cancellation_or_expiration_or_slave_death : task option -> unit
+
+ (** [forward_feedback fb] sends fb to all the workers. *)
val forward_feedback : Feedback.feedback -> unit
-
- (* run by the worker *)
+
+ (** {5 Worker API, it is run by worker, on a different fresh
+ process} *)
+
+ (** [perform in] synchronously processes a request [in] *)
val perform : request -> response
- (* debugging *)
+ (** debugging *)
val name_of_task : task -> string
val name_of_request : request -> string
end
-type expiration = bool ref
+(** [cancel_switch] to be flipped to true by anyone to signal the task
+ is not relevant anymore. When the STM performs an undo/edit-at, it
+ crawls the document and flips these flags (the Qed node carries a
+ pointer to the flag IIRC).
+*)
+type cancel_switch = bool ref
+(** Client-side functor. [MakeQueue T] creates a task queue for task [T] *)
module MakeQueue(T : Task) () : sig
+ (** [queue] is the abstract queue type. *)
type queue
- (* Number of workers, 0 = lazy local *)
+ (** [create n] will initialize the queue with [n] workers. If [n] is
+ 0, the queue won't spawn any process, working in a lazy local
+ manner. [not imposed by the this API] *)
val create : int -> queue
+
+ (** [destroy q] Deallocates [q], cancelling all pending tasks. *)
val destroy : queue -> unit
+ (** [n_workers q] returns the number of workers of [q] *)
val n_workers : queue -> int
- val enqueue_task : queue -> T.task * expiration -> unit
+ (** [enqueue_task q t ~cancel_switch] schedules [t] for execution in
+ [q]. [cancel_switch] can be flipped to true to cancel the task. *)
+ val enqueue_task : queue -> T.task -> cancel_switch:cancel_switch -> unit
- (* blocking function that waits for the task queue to be empty *)
+ (** [join q] blocks until the task queue is empty *)
val join : queue -> unit
+
+ (** [cancel_all q] Cancels all tasks *)
val cancel_all : queue -> unit
+ (** [cancel_worker q wid] cancels a particular worker [wid] *)
val cancel_worker : queue -> WorkerPool.worker_id -> unit
+ (** [set_order q cmp] reorders [q] using ordering [cmp] *)
val set_order : queue -> (T.task -> T.task -> int) -> unit
+ (** [broadcast q]
+
+ This is nasty. Workers can be picky, e.g. pick tasks only when
+ they are "on screen". Of course the screen is scrolled, and that
+ changes the potential choice of workers to pick up a task or
+ not.
+
+ This function wakes up the workers (the managers) that give a
+ look (again) to the tasks in the queue.
+
+ The STM calls it when the perspective (as in PIDE) changes.
+
+ A problem here is that why task_match has access to the
+ competence data in order to decide if the task is palatable to
+ the worker or not... such data is local to the worker (manager).
+ The perspective is global, so it does not quite fit this
+ picture. This API to make all managers reconsider the tasks in
+ the queue is the best I could came up with.
+
+ This API is crucial to Coqoon (or any other UI that invokes
+ Stm.finish eagerly but wants the workers to "focus" on the visible
+ part of the document).
+ *)
val broadcast : queue -> unit
- (* Take a snapshot (non destructive but waits until all workers are
- * enqueued) *)
+ (** [snapshot q] Takes a snapshot (non destructive but waits until
+ all workers are enqueued) *)
val snapshot : queue -> T.task list
- (* Clears the queue, only if the worker prool is empty *)
- val clear : queue -> unit
-
- (* create a queue, run the function, destroy the queue.
- * the user should call join *)
+ (** [clear q] Clears [q], only if the worker prool is empty *)
+ val clear : queue -> unit
+
+ (** [with_n_workers n f] create a queue, run the function, destroy
+ the queue. The user should call join *)
val with_n_workers : int -> (queue -> 'a) -> 'a
end
+(** Server-side functor. [MakeWorker T] creates the server task
+ dispatcher. *)
module MakeWorker(T : Task) () : sig
- val main_loop : unit -> unit
+ (** [init_stdout ()] is called at [Coqtop.toploop_init] time. *)
val init_stdout : unit -> unit
-
+
+ (** [main_loop ()] is called at [Coqtop.toploop_run] time. *)
+ val main_loop : unit -> unit
+
end
diff --git a/stm/coqworkmgrApi.ml b/stm/coqworkmgrApi.ml
index 6d6a198c5..14fd97a6d 100644
--- a/stm/coqworkmgrApi.ml
+++ b/stm/coqworkmgrApi.ml
@@ -8,8 +8,15 @@
let debug = false
+type priority = Low | High
+let string_of_priority = function Low -> "low" | High -> "high"
+let priority_of_string = function
+ | "low" -> Low
+ | "high" -> High
+ | _ -> raise (Invalid_argument "priority_of_string")
+
type request =
- | Hello of Flags.priority
+ | Hello of priority
| Get of int
| TryGet of int
| GiveBack of int
@@ -36,8 +43,8 @@ let positive_int_of_string n =
let parse_request s =
if debug then Printf.eprintf "parsing '%s'\n" s;
match Str.split (Str.regexp " ") (strip_r s) with
- | [ "HELLO"; "LOW" ] -> Hello Flags.Low
- | [ "HELLO"; "HIGH" ] -> Hello Flags.High
+ | [ "HELLO"; "LOW" ] -> Hello Low
+ | [ "HELLO"; "HIGH" ] -> Hello High
| [ "GET"; n ] -> Get (positive_int_of_string n)
| [ "TRYGET"; n ] -> TryGet (positive_int_of_string n)
| [ "GIVEBACK"; n ] -> GiveBack (positive_int_of_string n)
@@ -57,8 +64,8 @@ let parse_response s =
| _ -> raise ParseError
let print_request = function
- | Hello Flags.Low -> "HELLO LOW\n"
- | Hello Flags.High -> "HELLO HIGH\n"
+ | Hello Low -> "HELLO LOW\n"
+ | Hello High -> "HELLO HIGH\n"
| Get n -> Printf.sprintf "GET %d\n" n
| TryGet n -> Printf.sprintf "TRYGET %d\n" n
| GiveBack n -> Printf.sprintf "GIVEBACK %d\n" n
@@ -106,8 +113,7 @@ let with_manager f g =
let get n =
with_manager
- (fun () ->
- min n (min !Flags.async_proofs_n_workers !Flags.async_proofs_n_tacworkers))
+ (fun () -> n)
(fun cin cout ->
output_string cout (print_request (Get n));
flush cout;
@@ -118,10 +124,7 @@ let get n =
let tryget n =
with_manager
- (fun () ->
- Some
- (min n
- (min !Flags.async_proofs_n_workers !Flags.async_proofs_n_tacworkers)))
+ (fun () -> Some n)
(fun cin cout ->
output_string cout (print_request (TryGet n));
flush cout;
diff --git a/stm/coqworkmgrApi.mli b/stm/coqworkmgrApi.mli
index 70d4173ae..953903810 100644
--- a/stm/coqworkmgrApi.mli
+++ b/stm/coqworkmgrApi.mli
@@ -8,9 +8,13 @@
(* High level api for clients of the service (like coqtop) *)
+type priority = Low | High
+val string_of_priority : priority -> string
+val priority_of_string : string -> priority
+
(* Connects to a work manager if any. If no worker manager, then
-async-proofs-j and -async-proofs-tac-j are used *)
-val init : Flags.priority -> unit
+val init : priority -> unit
(* blocking *)
val get : int -> int
@@ -21,7 +25,7 @@ val giveback : int -> unit
(* Low level *)
type request =
- | Hello of Flags.priority
+ | Hello of priority
| Get of int
| TryGet of int
| GiveBack of int
diff --git a/stm/proofBlockDelimiter.ml b/stm/proofBlockDelimiter.ml
index 01b75e496..bebc4d5d5 100644
--- a/stm/proofBlockDelimiter.ml
+++ b/stm/proofBlockDelimiter.ml
@@ -23,8 +23,8 @@ val crawl :
val unit_val : Stm.DynBlockData.t
val of_bullet_val : Vernacexpr.bullet -> Stm.DynBlockData.t
val to_bullet_val : Stm.DynBlockData.t -> Vernacexpr.bullet
-val of_vernac_expr_val : Vernacexpr.vernac_expr -> Stm.DynBlockData.t
-val to_vernac_expr_val : Stm.DynBlockData.t -> Vernacexpr.vernac_expr
+val of_vernac_control_val : Vernacexpr.vernac_control -> Stm.DynBlockData.t
+val to_vernac_control_val : Stm.DynBlockData.t -> Vernacexpr.vernac_control
end = struct
@@ -32,7 +32,7 @@ let unit_tag = DynBlockData.create "unit"
let unit_val = DynBlockData.Easy.inj () unit_tag
let of_bullet_val, to_bullet_val = DynBlockData.Easy.make_dyn "bullet"
-let of_vernac_expr_val, to_vernac_expr_val = DynBlockData.Easy.make_dyn "vernac_expr"
+let of_vernac_control_val, to_vernac_control_val = DynBlockData.Easy.make_dyn "vernac_control"
let simple_goal sigma g gs =
let open Evar in
@@ -46,7 +46,7 @@ let simple_goal sigma g gs =
let is_focused_goal_simple ~doc id =
match state_of_id ~doc id with
| `Expired | `Error _ | `Valid None -> `Not
- | `Valid (Some { Vernacentries.proof }) ->
+ | `Valid (Some { Vernacstate.proof }) ->
let proof = Proof_global.proof_of_state proof in
let focused, r1, r2, r3, sigma = Proof.proof proof in
let rest = List.(flatten (map (fun (x,y) -> x @ y) r1)) @ r2 @ r3 in
@@ -74,14 +74,16 @@ include Util
(* ****************** - foo - bar - baz *********************************** *)
let static_bullet ({ entry_point; prev_node } as view) =
- match entry_point.ast with
+ assert (not (Vernacprop.has_Fail entry_point.ast));
+ match Vernacprop.under_control entry_point.ast with
| Vernacexpr.VernacBullet b ->
let base = entry_point.indentation in
let last_tac = prev_node entry_point in
crawl view ~init:last_tac (fun prev node ->
if node.indentation < base then `Stop else
if node.indentation > base then `Cont node else
- match node.ast with
+ if Vernacprop.has_Fail node.ast then `Stop
+ else match Vernacprop.under_control node.ast with
| Vernacexpr.VernacBullet b' when b = b' ->
`Found { block_stop = entry_point.id; block_start = prev.id;
dynamic_switch = node.id; carry_on_data = of_bullet_val b }
@@ -94,7 +96,7 @@ let dynamic_bullet doc { dynamic_switch = id; carry_on_data = b } =
`ValidBlock {
base_state = id;
goals_to_admit = focused;
- recovery_command = Some (Vernacexpr.VernacBullet (to_bullet_val b))
+ recovery_command = Some (Vernacexpr.VernacExpr([], Vernacexpr.VernacBullet (to_bullet_val b)))
}
| `Not -> `Leaks
@@ -104,9 +106,10 @@ let () = register_proof_block_delimiter
(* ******************** { block } ***************************************** *)
let static_curly_brace ({ entry_point; prev_node } as view) =
- assert(entry_point.ast = Vernacexpr.VernacEndSubproof);
+ assert(Vernacprop.under_control entry_point.ast = Vernacexpr.VernacEndSubproof);
crawl view (fun (nesting,prev) node ->
- match node.ast with
+ if Vernacprop.has_Fail node.ast then `Cont (nesting,node)
+ else match Vernacprop.under_control node.ast with
| Vernacexpr.VernacSubproof _ when nesting = 0 ->
`Found { block_stop = entry_point.id; block_start = prev.id;
dynamic_switch = node.id; carry_on_data = unit_val }
@@ -122,7 +125,7 @@ let dynamic_curly_brace doc { dynamic_switch = id } =
`ValidBlock {
base_state = id;
goals_to_admit = focused;
- recovery_command = Some Vernacexpr.VernacEndSubproof
+ recovery_command = Some (Vernacexpr.VernacExpr ([], Vernacexpr.VernacEndSubproof))
}
| `Not -> `Leaks
@@ -164,7 +167,7 @@ let static_indent ({ entry_point; prev_node } as view) =
else
`Found { block_stop = entry_point.id; block_start = node.id;
dynamic_switch = node.id;
- carry_on_data = of_vernac_expr_val entry_point.ast }
+ carry_on_data = of_vernac_control_val entry_point.ast }
) last_tac
let dynamic_indent doc { dynamic_switch = id; carry_on_data = e } =
@@ -176,7 +179,7 @@ let dynamic_indent doc { dynamic_switch = id; carry_on_data = e } =
`ValidBlock {
base_state = id;
goals_to_admit = but_last;
- recovery_command = Some (to_vernac_expr_val e);
+ recovery_command = Some (to_vernac_control_val e);
}
| `Not -> `Leaks
diff --git a/stm/spawned.ml b/stm/spawned.ml
index 6ab096abf..fb5708f3a 100644
--- a/stm/spawned.ml
+++ b/stm/spawned.ml
@@ -73,3 +73,9 @@ let get_channels () =
Printf.eprintf "Fatal error: ideslave communication channels not set.\n";
exit 1
| Some(ic, oc) -> ic, oc
+
+let process_id () =
+ Printf.sprintf "%d:%s:%d" (Unix.getpid ())
+ (if Flags.async_proofs_is_worker () then !Flags.async_proofs_worker_id
+ else "master")
+ (Thread.id (Thread.self ()))
diff --git a/stm/spawned.mli b/stm/spawned.mli
index c3cf4d67b..7f463c6a6 100644
--- a/stm/spawned.mli
+++ b/stm/spawned.mli
@@ -20,3 +20,5 @@ val init_channels : unit -> unit
(* Once initialized, these are the channels to talk with our master *)
val get_channels : unit -> CThread.thread_ic * out_channel
+(** {6 Name of current process.} *)
+val process_id : unit -> string
diff --git a/stm/stm.ml b/stm/stm.ml
index 6c22d3771..b5848c662 100644
--- a/stm/stm.ml
+++ b/stm/stm.ml
@@ -8,31 +8,80 @@
(* enable in case of stm problems *)
(* let stm_debug () = !Flags.debug *)
-let stm_debug () = !Flags.stm_debug
+let stm_debug = ref false
-let stm_pr_err s = Format.eprintf "%s] %s\n%!" (System.process_id ()) s
-let stm_pp_err pp = Format.eprintf "%s] @[%a@]\n%!" (System.process_id ()) Pp.pp_with pp
+let stm_pr_err s = Format.eprintf "%s] %s\n%!" (Spawned.process_id ()) s
+let stm_pp_err pp = Format.eprintf "%s] @[%a@]\n%!" (Spawned.process_id ()) Pp.pp_with pp
-let stm_prerr_endline s = if stm_debug () then begin stm_pr_err (s ()) end else ()
-let stm_pperr_endline s = if stm_debug () then begin stm_pp_err (s ()) end else ()
+let stm_prerr_endline s = if !stm_debug then begin stm_pr_err (s ()) end else ()
+let stm_pperr_endline s = if !stm_debug then begin stm_pp_err (s ()) end else ()
let stm_prerr_debug s = if !Flags.debug then begin stm_pr_err (s ()) end else ()
open Pp
open CErrors
+open Names
open Feedback
open Vernacexpr
+module AsyncOpts = struct
+
+ type cache = Force
+ type async_proofs = APoff | APonLazy | APon
+ type tac_error_filter = [ `None | `Only of string list | `All ]
+
+ type stm_opt = {
+ async_proofs_n_workers : int;
+ async_proofs_n_tacworkers : int;
+
+ async_proofs_cache : cache option;
+ async_proofs_mode : async_proofs;
+
+ async_proofs_private_flags : string option;
+ async_proofs_full : bool;
+ async_proofs_never_reopen_branch : bool;
+
+ async_proofs_tac_error_resilience : tac_error_filter;
+ async_proofs_cmd_error_resilience : bool;
+ async_proofs_delegation_threshold : float;
+ }
+
+ let default_opts = {
+ async_proofs_n_workers = 1;
+ async_proofs_n_tacworkers = 2;
+
+ async_proofs_cache = None;
+
+ async_proofs_mode = APoff;
+
+ async_proofs_private_flags = None;
+ async_proofs_full = false;
+ async_proofs_never_reopen_branch = false;
+
+ async_proofs_tac_error_resilience = `Only [ "curly" ];
+ async_proofs_cmd_error_resilience = true;
+ async_proofs_delegation_threshold = 0.03;
+ }
+
+ let cur_opt = ref default_opts
+end
+
+open AsyncOpts
+
+let async_proofs_is_master opt =
+ opt.async_proofs_mode = APon &&
+ !Flags.async_proofs_worker_id = "master"
+
(* Protect against state changes *)
let stm_purify f x =
- let st = Vernacentries.freeze_interp_state `No in
+ let st = Vernacstate.freeze_interp_state `No in
try
let res = f x in
- Vernacentries.unfreeze_interp_state st;
+ Vernacstate.unfreeze_interp_state st;
res
with e ->
let e = CErrors.push e in
- Vernacentries.unfreeze_interp_state st;
+ Vernacstate.unfreeze_interp_state st;
Exninfo.iraise e
let execution_error ?loc state_id msg =
@@ -48,7 +97,7 @@ let state_computed, state_computed_hook = Hook.make
let state_ready, state_ready_hook = Hook.make
~default:(fun state_id -> ()) ()
-let forward_feedback, forward_feedback_hook =
+let forward_feedback, forward_feedback_hook =
let m = Mutex.create () in
Hook.make ~default:(function
| { doc_id = did; span_id = id; route; contents } ->
@@ -82,7 +131,7 @@ type aast = {
loc : Loc.t option;
indentation : int;
strlen : int;
- mutable expr : vernac_expr; (* mutable: Proof using hinted by aux file *)
+ mutable expr : vernac_control; (* mutable: Proof using hinted by aux file *)
}
let pr_ast { expr; indentation } = Pp.(int indentation ++ str " " ++ Ppvernac.pr_vernac expr)
@@ -90,14 +139,14 @@ let default_proof_mode () = Proof_global.get_default_proof_mode_name () [@ocaml.
(* Commands piercing opaque *)
let may_pierce_opaque = function
- | { expr = VernacPrint _ } -> true
- | { expr = VernacExtend (("Extraction",_), _) } -> true
- | { expr = VernacExtend (("SeparateExtraction",_), _) } -> true
- | { expr = VernacExtend (("ExtractionLibrary",_), _) } -> true
- | { expr = VernacExtend (("RecursiveExtractionLibrary",_), _) } -> true
- | { expr = VernacExtend (("ExtractionConstant",_), _) } -> true
- | { expr = VernacExtend (("ExtractionInlinedConstant",_), _) } -> true
- | { expr = VernacExtend (("ExtractionInductive",_), _) } -> true
+ | VernacPrint _
+ | VernacExtend (("Extraction",_), _)
+ | VernacExtend (("SeparateExtraction",_), _)
+ | VernacExtend (("ExtractionLibrary",_), _)
+ | VernacExtend (("RecursiveExtractionLibrary",_), _)
+ | VernacExtend (("ExtractionConstant",_), _)
+ | VernacExtend (("ExtractionInlinedConstant",_), _)
+ | VernacExtend (("ExtractionInductive",_), _) -> true
| _ -> false
let update_global_env () =
@@ -108,7 +157,6 @@ module Vcs_ = Vcs.Make(Stateid.Self)
type future_proof = Proof_global.closed_proof_output Future.computation
type proof_mode = string
type depth = int
-type cancel_switch = bool ref
type branch_type =
[ `Master
| `Proof of proof_mode * depth
@@ -122,14 +170,14 @@ type cmd_t = {
cids : Names.Id.t list;
cblock : proof_block_name option;
cqueue : [ `MainQueue
- | `TacQueue of solving_tac * anon_abstracting_tac * cancel_switch
- | `QueryQueue of cancel_switch
+ | `TacQueue of solving_tac * anon_abstracting_tac * AsyncTaskQueue.cancel_switch
+ | `QueryQueue of AsyncTaskQueue.cancel_switch
| `SkipQueue ] }
type fork_t = aast * Vcs_.Branch.t * Vernacexpr.opacity_guarantee * Names.Id.t list
type qed_t = {
qast : aast;
keep : vernac_qed_type;
- mutable fproof : (future_proof * cancel_switch) option;
+ mutable fproof : (future_proof * AsyncTaskQueue.cancel_switch) option;
brname : Vcs_.Branch.t;
brinfo : branch_type Vcs_.branch_info
}
@@ -159,13 +207,14 @@ let mkTransCmd cast cids ceff cqueue =
Cmd { ctac = false; cast; cblock = None; cqueue; cids; ceff }
(* Parts of the system state that are morally part of the proof state *)
-let summary_pstate = [ Evarutil.meta_counter_summary_name;
- Evd.evar_counter_summary_name;
- "program-tcc-table" ]
+let summary_pstate = Evarutil.meta_counter_summary_tag,
+ Evd.evar_counter_summary_tag,
+ Obligations.program_tcc_summary_tag
+
type cached_state =
| Empty
| Error of Exninfo.iexn
- | Valid of Vernacentries.interp_state
+ | Valid of Vernacstate.t
type branch = Vcs_.Branch.t * branch_type Vcs_.branch_info
type backup = { mine : branch; others : branch list }
@@ -318,7 +367,7 @@ module VCS : sig
(* cuts from start -> stop, raising Expired if some nodes are not there *)
val slice : block_start:id -> block_stop:id -> vcs
val nodes_in_slice : block_start:id -> block_stop:id -> Stateid.t list
-
+
val create_proof_task_box : id list -> qed:id -> block_start:id -> unit
val create_proof_block : static_block_declaration -> string -> unit
val box_of : id -> box list
@@ -353,10 +402,10 @@ end = struct (* {{{ *)
In case you are hitting the race enable stm_debug.
*)
- if stm_debug () then Flags.we_are_parsing := false;
+ if !stm_debug then Flags.we_are_parsing := false;
let fname =
- "stm_" ^ Str.global_replace (Str.regexp " ") "_" (System.process_id ()) in
+ "stm_" ^ Str.global_replace (Str.regexp " ") "_" (Spawned.process_id ()) in
let string_of_transaction = function
| Cmd { cast = t } | Fork (t, _,_,_) ->
(try Pp.string_of_ppcmds (pr_ast t) with _ -> "ERR")
@@ -367,7 +416,7 @@ end = struct (* {{{ *)
| Noop -> " "
| Alias (id,_) -> sprintf "Alias(%s)" (Stateid.to_string id)
| Qed { qast } -> Pp.string_of_ppcmds (pr_ast qast) in
- let is_green id =
+ let is_green id =
match get_info vcs id with
| Some { state = Valid _ } -> true
| _ -> false in
@@ -435,7 +484,7 @@ end = struct (* {{{ *)
let outerboxes boxes =
List.filter (fun b ->
not (List.exists (fun b1 ->
- not (same_box b1 b) && contains b1 b) boxes)
+ not (same_box b1 b) && contains b1 b) boxes)
) boxes in
let rec rec_print b =
boxes := CList.remove same_box b !boxes;
@@ -516,12 +565,10 @@ end = struct (* {{{ *)
vcs := rewrite_merge !vcs id ~ours ~theirs:Noop ~at branch
let reachable id = reachable !vcs id
let mk_branch_name { expr = x } = Branch.make
- (let rec aux x = match x with
- | VernacDefinition (_,((_,i),_),_) -> Names.Id.to_string i
- | VernacStartTheoremProof (_,[Some ((_,i),_),_]) -> Names.Id.to_string i
- | VernacTime (_, e)
- | VernacTimeout (_, e) -> aux e
- | _ -> "branch" in aux x)
+ (match Vernacprop.under_control x with
+ | VernacDefinition (_,((_, Name i),_),_) -> Id.to_string i
+ | VernacStartTheoremProof (_,[((_,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
let get_info id =
@@ -530,7 +577,7 @@ end = struct (* {{{ *)
| None -> raise Vcs_aux.Expired
let set_state id s =
(get_info id).state <- s;
- if Flags.async_proofs_is_master () then Hooks.(call state_ready id)
+ if async_proofs_is_master !cur_opt then Hooks.(call state_ready id)
let get_state id = (get_info id).state
let reached id =
let info = get_info id in
@@ -565,7 +612,7 @@ end = struct (* {{{ *)
let id = new_node () in
merge id ~ours:(Sideff action) ~into:b Branch.master)
(List.filter (fun b -> not (Branch.equal b Branch.master)) (branches ()))
-
+
let visit id = Vcs_aux.visit !vcs id
let nodes_in_slice ~block_start ~block_stop =
@@ -664,7 +711,7 @@ end = struct (* {{{ *)
val command : now:bool -> (unit -> unit) -> unit
end = struct
-
+
let m = Mutex.create ()
let c = Condition.create ()
let job = ref None
@@ -735,16 +782,16 @@ module State : sig
val exn_on : Stateid.t -> valid:Stateid.t -> Exninfo.iexn -> Exninfo.iexn
(* to send states across worker/master *)
- val get_cached : Stateid.t -> Vernacentries.interp_state
- val same_env : Vernacentries.interp_state -> Vernacentries.interp_state -> bool
+ val get_cached : Stateid.t -> Vernacstate.t
+ val same_env : Vernacstate.t -> Vernacstate.t -> bool
type proof_part
type partial_state =
- [ `Full of Vernacentries.interp_state
+ [ `Full of Vernacstate.t
| `ProofOnly of Stateid.t * proof_part ]
- val proof_part_of_frozen : Vernacentries.interp_state -> proof_part
+ val proof_part_of_frozen : Vernacstate.t -> proof_part
val assign : Stateid.t -> partial_state -> unit
(* Handlers for initial state, prior to document creation. *)
@@ -757,26 +804,30 @@ module State : sig
end = struct (* {{{ *)
- open Vernacentries
-
(* cur_id holds Stateid.dummy in case the last attempt to define a state
* failed, so the global state may contain garbage *)
let cur_id = ref Stateid.dummy
let fix_exn_ref = ref (fun x -> x)
type proof_part =
- Proof_global.state * Summary.frozen_bits (* only meta counters *)
+ Proof_global.t *
+ int * (* Evarutil.meta_counter_summary_tag *)
+ int * (* Evd.evar_counter_summary_tag *)
+ Obligations.program_info Names.Id.Map.t (* Obligations.program_tcc_summary_tag *)
type partial_state =
- [ `Full of Vernacentries.interp_state
+ [ `Full of Vernacstate.t
| `ProofOnly of Stateid.t * proof_part ]
- let proof_part_of_frozen { Vernacentries.proof; system } =
+ let proof_part_of_frozen { Vernacstate.proof; system } =
+ let st = States.summary_of_state system in
proof,
- Summary.project_summary (States.summary_of_state system) summary_pstate
+ Summary.project_from_summary st Util.(pi1 summary_pstate),
+ Summary.project_from_summary st Util.(pi2 summary_pstate),
+ Summary.project_from_summary st Util.(pi3 summary_pstate)
let freeze marshallable id =
- VCS.set_state id (Valid (Vernacentries.freeze_interp_state marshallable))
+ VCS.set_state id (Valid (Vernacstate.freeze_interp_state marshallable))
let freeze_invalid id iexn = VCS.set_state id (Error iexn)
@@ -800,7 +851,7 @@ end = struct (* {{{ *)
let install_cached id =
match VCS.get_info id with
| { state = Valid s } ->
- Vernacentries.unfreeze_interp_state s;
+ Vernacstate.unfreeze_interp_state s;
cur_id := id
| { state = Error ie } ->
@@ -819,6 +870,7 @@ end = struct (* {{{ *)
with VCS.Expired -> anomaly Pp.(str "not a cached state (expired).")
let assign id what =
+ let open Vernacstate in
if VCS.get_state id <> Empty then () else
try match what with
| `Full s ->
@@ -826,22 +878,27 @@ end = struct (* {{{ *)
try
let prev = (VCS.visit id).next in
if is_cached_and_valid prev
- then { s with Vernacentries.proof =
+ then { s with proof =
Proof_global.copy_terminators
~src:(get_cached prev).proof ~tgt:s.proof }
else s
with VCS.Expired -> s in
VCS.set_state id (Valid s)
- | `ProofOnly(ontop,(pstate,counters)) ->
+ | `ProofOnly(ontop,(pstate,c1,c2,c3)) ->
if is_cached_and_valid ontop then
let s = get_cached ontop in
let s = { s with proof =
Proof_global.copy_terminators ~src:s.proof ~tgt:pstate } in
let s = { s with system =
States.replace_summary s.system
- (Summary.surgery_summary
- (States.summary_of_state s.system)
- counters) } in
+ begin
+ let st = States.summary_of_state s.system in
+ let st = Summary.modify_summary st Util.(pi1 summary_pstate) c1 in
+ let st = Summary.modify_summary st Util.(pi2 summary_pstate) c2 in
+ let st = Summary.modify_summary st Util.(pi3 summary_pstate) c3 in
+ st
+ end
+ } in
VCS.set_state id (Valid s)
with VCS.Expired -> ()
@@ -854,12 +911,12 @@ end = struct (* {{{ *)
execution_error ?loc id (iprint (e, info));
(e, Stateid.add info ~valid id)
- let same_env { system = s1 } { system = s2 } =
+ let same_env { Vernacstate.system = s1 } { Vernacstate.system = s2 } =
let s1 = States.summary_of_state s1 in
- let e1 = Summary.project_summary s1 [Global.global_env_summary_name] in
+ let e1 = Summary.project_from_summary s1 Global.global_env_summary_tag in
let s2 = States.summary_of_state s2 in
- let e2 = Summary.project_summary s2 [Global.global_env_summary_name] in
- Summary.pointer_equal e1 e2
+ let e2 = Summary.project_from_summary s2 Global.global_env_summary_tag in
+ e1 == e2
let define ?safe_id ?(redefine=false) ?(cache=`No) ?(feedback_processed=true)
f id
@@ -902,11 +959,11 @@ end = struct (* {{{ *)
let init_state = ref None
let register_root_state () =
- init_state := Some (Vernacentries.freeze_interp_state `No)
+ init_state := Some (Vernacstate.freeze_interp_state `No)
let restore_root_state () =
cur_id := Stateid.dummy;
- Vernacentries.unfreeze_interp_state (Option.get !init_state);
+ Vernacstate.unfreeze_interp_state (Option.get !init_state);
end (* }}} *)
@@ -945,7 +1002,7 @@ let indent_script_item ((ng1,ngl1),nl,beginend,ppl) (cmd,ng) =
in
(* Some special handling of bullets and { }, to get a nicer display *)
let pred n = max 0 (n-1) in
- let ind, nl, new_beginend = match cmd with
+ let ind, nl, new_beginend = match Vernacprop.under_control cmd with
| VernacSubproof _ -> pred ind, nl, (pred ind)::beginend
| VernacEndSubproof -> List.hd beginend, false, List.tl beginend
| VernacBullet _ -> pred ind, nl, beginend
@@ -973,7 +1030,7 @@ let get_script prf =
find ((x.expr, (VCS.get_info id).n_goals)::acc) view.next
| `Sideff (CherryPickEnv, id) -> find acc id
| `Cmd {cast = x; ctac} when ctac -> (* skip non-tactics *)
- find ((x.expr, (VCS.get_info id).n_goals)::acc) view.next
+ find ((x.expr, (VCS.get_info id).n_goals)::acc) view.next
| `Cmd _ -> find acc view.next
| `Alias (id,_) -> find acc id
| `Fork _ -> find acc view.next
@@ -1001,7 +1058,7 @@ end
(* Wrapper for Vernacentries.interp to set the feedback id *)
(* It is currently called 19 times, this number should be certainly
reduced... *)
-let stm_vernac_interp ?proof ?route id st { verbose; loc; expr } : Vernacentries.interp_state =
+let stm_vernac_interp ?proof ?route id st { verbose; loc; expr } : Vernacstate.t =
(* The Stm will gain the capability to interpret commmads affecting
the whole document state, such as backtrack, etc... so we start
to design the stm command interpreter now *)
@@ -1010,25 +1067,26 @@ let stm_vernac_interp ?proof ?route id st { verbose; loc; expr } : Vernacentries
(* We need to check if a command should be filtered from
* vernac_entries, as it cannot handle it. This should go away in
* future refactorings.
- *)
- let rec is_filtered_command = function
- | VernacResetName _ | VernacResetInitial | VernacBack _
- | VernacBackTo _ | VernacRestart | VernacUndo _ | VernacUndoTo _
- | VernacBacktrack _ | VernacAbortAll | VernacAbort _ -> true
- | VernacTime (_,e) | VernacTimeout (_,e) | VernacRedirect (_,(_,e)) -> is_filtered_command e
- | _ -> false
+ *)
+ let is_filtered_command = function
+ | VernacResetName _ | VernacResetInitial | VernacBack _
+ | VernacBackTo _ | VernacRestart | VernacUndo _ | VernacUndoTo _
+ | VernacBacktrack _ | VernacAbortAll | VernacAbort _ -> true
+ | _ -> false
in
- let aux_interp st cmd =
- if is_filtered_command cmd then
- (stm_pperr_endline Pp.(fun () -> str "ignoring " ++ Ppvernac.pr_vernac expr); st)
- else match cmd with
- | VernacShow ShowScript -> ShowScript.show_script (); st
- | expr ->
- stm_pperr_endline Pp.(fun () -> str "interpreting " ++ Ppvernac.pr_vernac expr);
- try Vernacentries.interp ?verbosely:(Some verbose) ?proof st (Loc.tag ?loc expr)
- with e ->
- let e = CErrors.push e in
- Exninfo.iraise Hooks.(call_process_error_once e)
+ let aux_interp st expr =
+ let cmd = Vernacprop.under_control expr in
+ if is_filtered_command cmd then
+ (stm_pperr_endline Pp.(fun () -> str "ignoring " ++ Ppvernac.pr_vernac expr); st)
+ else
+ match cmd with
+ | VernacShow ShowScript -> ShowScript.show_script (); st (** XX we are ignoring control here *)
+ | _ ->
+ stm_pperr_endline Pp.(fun () -> str "interpreting " ++ Ppvernac.pr_vernac expr);
+ try Vernacentries.interp ?verbosely:(Some verbose) ?proof ~st (Loc.tag ?loc expr)
+ with e ->
+ let e = CErrors.push e in
+ Exninfo.iraise Hooks.(call_process_error_once e)
in aux_interp st expr
(****************************** CRUFT *****************************************)
@@ -1044,7 +1102,7 @@ module Backtrack : sig
val branches_of : Stateid.t -> backup
(* Returns the state that the command should backtract to *)
- val undo_vernac_classifier : vernac_expr -> Stateid.t * vernac_when
+ val undo_vernac_classifier : vernac_control -> Stateid.t * vernac_when
end = struct (* {{{ *)
@@ -1092,7 +1150,11 @@ end = struct (* {{{ *)
match VCS.visit id with
| { step = `Fork ((_,_,_,l),_) } -> l, false,0
| { step = `Cmd { cids = l; ctac } } -> l, ctac,0
- | { step = `Alias (_,{ expr = VernacUndo n}) } -> [], false, n
+ | { step = `Alias (_,{ expr }) } when not (Vernacprop.has_Fail expr) ->
+ begin match Vernacprop.under_control expr with
+ | VernacUndo n -> [], false, n
+ | _ -> [],false,0
+ end
| _ -> [],false,0 in
match f acc (id, vcs, ids, tactic, undo) with
| `Stop x -> x
@@ -1107,10 +1169,10 @@ end = struct (* {{{ *)
" the \"-async-proofs-cache force\" option to Coq."))
let undo_vernac_classifier v =
- if VCS.is_interactive () = `No && !Flags.async_proofs_cache <> Some Flags.Force
+ if VCS.is_interactive () = `No && !cur_opt.async_proofs_cache <> Some Force
then undo_costly_in_batch_mode v;
try
- match v with
+ match Vernacprop.under_control v with
| VernacResetInitial ->
Stateid.initial, VtNow
| VernacResetName (_,name) ->
@@ -1139,7 +1201,7 @@ end = struct (* {{{ *)
let m = match e with VernacUndoTo m -> m | _ -> 0 in
let id = VCS.get_branch_pos (VCS.current_branch ()) in
let vcs =
- match (VCS.get_info id).vcs_backup with
+ match (VCS.get_info id).vcs_backup with
| None, _ -> anomaly Pp.(str"Backtrack: tip with no vcs_backup.")
| Some vcs, _ -> vcs in
let cb, _ =
@@ -1192,7 +1254,7 @@ let record_pb_time ?loc proof_name time =
Aux_file.record_in_aux_at proof_name proof_build_time;
hints := Aux_file.set !hints proof_name proof_build_time
end
-
+
exception RemoteException of Pp.t
let _ = CErrors.register_handler (function
| RemoteException ppcmd -> ppcmd
@@ -1203,7 +1265,7 @@ let _ = CErrors.register_handler (function
type document_node = {
indentation : int;
- ast : Vernacexpr.vernac_expr;
+ ast : Vernacexpr.vernac_control;
id : Stateid.t;
}
@@ -1218,7 +1280,7 @@ type static_block_detection =
type recovery_action = {
base_state : Stateid.t;
goals_to_admit : Goal.goal list;
- recovery_command : Vernacexpr.vernac_expr option;
+ recovery_command : Vernacexpr.vernac_control option;
}
type dynamic_block_error_recovery =
@@ -1243,15 +1305,15 @@ let prev_node { id } =
let cur_node id = mk_doc_node id (VCS.visit id)
let is_block_name_enabled name =
- match !Flags.async_proofs_tac_error_resilience with
+ match !cur_opt.async_proofs_tac_error_resilience with
| `None -> false
| `All -> true
| `Only l -> List.mem name l
let detect_proof_block id name =
- let name = match name with None -> "indent" | Some x -> x in
+ let name = match name with None -> "indent" | Some x -> x in
if is_block_name_enabled name &&
- (Flags.async_proofs_is_master () || Flags.async_proofs_is_worker ())
+ (async_proofs_is_master !cur_opt || Flags.async_proofs_is_worker ())
then (
match cur_node id with
| None -> ()
@@ -1272,7 +1334,7 @@ let detect_proof_block id name =
(* Unused module warning doesn't understand [module rec] *)
[@@@ocaml.warning "-60"]
module rec ProofTask : sig
-
+
type competence = Stateid.t list
type task_build_proof = {
t_exn_info : Stateid.t * Stateid.t;
@@ -1295,8 +1357,8 @@ module rec ProofTask : sig
include AsyncTaskQueue.Task
with type task := task
- and type competence := competence
- and type request := request
+ and type competence := competence
+ and type request := request
val build_proof_here :
?loc:Loc.t ->
@@ -1305,7 +1367,7 @@ module rec ProofTask : sig
Proof_global.closed_proof_output Future.computation
(* If set, only tasks overlapping with this list are processed *)
- val set_perspective : Stateid.t list -> unit
+ val set_perspective : Stateid.t list -> unit
end = struct (* {{{ *)
@@ -1327,10 +1389,12 @@ end = struct (* {{{ *)
| BuildProof of task_build_proof
| States of Stateid.t list
+ type worker_status = Fresh | Old of competence
+
type request =
| ReqBuildProof of (Future.UUID.t,VCS.vcs) Stateid.request * bool * competence
| ReqStates of Stateid.t list
-
+
type error = {
e_error_at : Stateid.t;
e_safe_id : Stateid.t;
@@ -1350,10 +1414,10 @@ end = struct (* {{{ *)
let task_match age t =
match age, t with
- | `Fresh, BuildProof { t_states } ->
- not !Flags.async_proofs_full ||
+ | Fresh, BuildProof { t_states } ->
+ not !cur_opt.async_proofs_full ||
List.exists (fun x -> CList.mem_f Stateid.equal x !perspective) t_states
- | `Old my_states, States l ->
+ | Old my_states, States l ->
List.for_all (fun x -> CList.mem_f Stateid.equal x my_states) l
| _ -> false
@@ -1369,7 +1433,7 @@ end = struct (* {{{ *)
| BuildProof {
t_exn_info;t_start;t_stop;t_loc;t_uuid;t_name;t_states;t_drop
} ->
- assert(age = `Fresh);
+ assert(age = Fresh);
try Some (ReqBuildProof ({
Stateid.exn_info = t_exn_info;
stop = t_stop;
@@ -1379,19 +1443,19 @@ end = struct (* {{{ *)
name = t_name }, t_drop, t_states))
with VCS.Expired -> None
- let use_response (s : competence AsyncTaskQueue.worker_status) t r =
+ let use_response (s : worker_status) t r =
match s, t, r with
- | `Old c, States _, RespStates l ->
+ | Old c, States _, RespStates l ->
List.iter (fun (id,s) -> State.assign id s) l; `End
- | `Fresh, BuildProof { t_assign; t_loc; t_name; t_states; t_drop },
+ | Fresh, BuildProof { t_assign; t_loc; t_name; t_states; t_drop },
RespBuiltProof (pl, time) ->
feedback (InProgress ~-1);
t_assign (`Val pl);
record_pb_time ?loc:t_loc t_name time;
- if !Flags.async_proofs_full || t_drop
+ if !cur_opt.async_proofs_full || t_drop
then `Stay(t_states,[States t_states])
else `End
- | `Fresh, BuildProof { t_assign; t_loc; t_name; t_states },
+ | Fresh, BuildProof { t_assign; t_loc; t_name; t_states },
RespError { e_error_at; e_safe_id = valid; e_msg; e_safe_states } ->
feedback (InProgress ~-1);
let info = Stateid.add ~valid Exninfo.null e_error_at in
@@ -1437,27 +1501,27 @@ end = struct (* {{{ *)
* a bad fixpoint *)
let fix_exn = Future.fix_exn_of future_proof in
(* STATE: We use the current installed imperative state *)
- let st = Vernacentries.freeze_interp_state `No in
+ let st = Vernacstate.freeze_interp_state `No in
if not drop then begin
let checked_proof = Future.chain future_proof (fun p ->
(* Unfortunately close_future_proof and friends are not pure so we need
to set the state manually here *)
- Vernacentries.unfreeze_interp_state st;
+ Vernacstate.unfreeze_interp_state st;
let pobject, _ =
Proof_global.close_future_proof ~feedback_id:stop (Future.from_val ~fix_exn p) in
let terminator = (* The one sent by master is an InvalidKey *)
Lemmas.(standard_proof_terminator [] (mk_hook (fun _ _ -> ()))) in
- let st = Vernacentries.freeze_interp_state `No in
+ let st = Vernacstate.freeze_interp_state `No in
stm_vernac_interp stop
~proof:(pobject, terminator) st
{ verbose = false; loc; indentation = 0; strlen = 0;
- expr = (VernacEndProof (Proved (Opaque,None))) }) in
+ expr = VernacExpr ([], VernacEndProof (Proved (Opaque,None))) }) in
ignore(Future.join checked_proof);
end;
(* STATE: Restore the state XXX: handle exn *)
- Vernacentries.unfreeze_interp_state st;
+ Vernacstate.unfreeze_interp_state st;
RespBuiltProof(proof,time)
with
| e when CErrors.noncritical e || e = Stack_overflow ->
@@ -1478,7 +1542,7 @@ end = struct (* {{{ *)
| VtProofStep _, _ -> true
| _ -> false
in
- let initial =
+ let initial =
let rec aux id =
try match VCS.visit id with { next } -> aux next
with VCS.Expired -> id in
@@ -1491,7 +1555,7 @@ end = struct (* {{{ *)
then Some (prev, State.get_cached prev, step)
else None
with VCS.Expired -> None in
- let this =
+ let this =
if State.is_cached_and_valid id then Some (State.get_cached id) else None in
match prev, this with
| _, None -> None
@@ -1533,11 +1597,11 @@ and Slaves : sig
val build_proof :
?loc:Loc.t -> drop_pt:bool ->
exn_info:(Stateid.t * Stateid.t) -> block_start:Stateid.t -> block_stop:Stateid.t ->
- name:string -> future_proof * cancel_switch
+ name:string -> future_proof * AsyncTaskQueue.cancel_switch
(* blocking function that waits for the task queue to be empty *)
val wait_all_done : unit -> unit
-
+
(* initialize the whole machinery (optional) *)
val init : unit -> unit
@@ -1559,11 +1623,11 @@ and Slaves : sig
end = struct (* {{{ *)
module TaskQueue = AsyncTaskQueue.MakeQueue(ProofTask) ()
-
+
let queue = ref None
let init () =
- if Flags.async_proofs_is_master () then
- queue := Some (TaskQueue.create !Flags.async_proofs_n_workers)
+ if async_proofs_is_master !cur_opt then
+ queue := Some (TaskQueue.create !cur_opt.async_proofs_n_workers)
else
queue := Some (TaskQueue.create 0)
@@ -1598,10 +1662,10 @@ end = struct (* {{{ *)
* => takes nothing from the itermediate states.
*)
(* STATE We use the state resulting from reaching start. *)
- let st = Vernacentries.freeze_interp_state `No in
+ let st = Vernacstate.freeze_interp_state `No in
ignore(stm_vernac_interp stop ~proof st
{ verbose = false; loc; indentation = 0; strlen = 0;
- expr = (VernacEndProof (Proved (Opaque,None))) });
+ expr = VernacExpr ([], VernacEndProof (Proved (Opaque,None))) });
`OK proof
end
with e ->
@@ -1614,8 +1678,8 @@ end = struct (* {{{ *)
| Some (_, cur) ->
match VCS.visit cur with
| { step = `Cmd { cast = { loc } } }
- | { step = `Fork (( { loc }, _, _, _), _) }
- | { step = `Qed ( { qast = { loc } }, _) }
+ | { step = `Fork (( { loc }, _, _, _), _) }
+ | { step = `Qed ( { qast = { loc } }, _) }
| { step = `Sideff (ReplayCommand { loc }, _) } ->
let start, stop = Option.cata Loc.unloc (0,0) loc in
msg_error Pp.(
@@ -1665,7 +1729,7 @@ end = struct (* {{{ *)
u.(bucket) <- uc;
p.(bucket) <- pr;
u, Univ.ContextSet.union cst extra, false
-
+
let check_task name l i =
match check_task_aux "" name l i with
| `OK _ | `OK_ADMITTED -> true
@@ -1710,11 +1774,11 @@ end = struct (* {{{ *)
t_exn_info; t_start = block_start; t_stop = block_stop; t_drop = drop_pt;
t_assign = assign; t_loc = loc; t_uuid; t_name = pname;
t_states = VCS.nodes_in_slice ~block_start ~block_stop }) in
- TaskQueue.enqueue_task (Option.get !queue) (task,cancel_switch);
+ TaskQueue.enqueue_task (Option.get !queue) task ~cancel_switch;
f, cancel_switch
end else
ProofTask.build_proof_here ?loc ~drop_pt t_exn_info block_stop, cancel_switch
- else
+ else
let f, t_assign = Future.create_delegate ~name:pname (State.exn_on id ~valid) in
let t_uuid = Future.uuid f in
feedback (InProgress 1);
@@ -1722,7 +1786,7 @@ end = struct (* {{{ *)
t_exn_info; t_start = block_start; t_stop = block_stop; t_assign; t_drop = drop_pt;
t_loc = loc; t_uuid; t_name = pname;
t_states = VCS.nodes_in_slice ~block_start ~block_stop }) in
- TaskQueue.enqueue_task (Option.get !queue) (task,cancel_switch);
+ TaskQueue.enqueue_task (Option.get !queue) task ~cancel_switch;
f, cancel_switch
let wait_all_done () = TaskQueue.join (Option.get !queue)
@@ -1736,7 +1800,7 @@ end = struct (* {{{ *)
let reqs =
CList.map_filter
ProofTask.(fun x ->
- match request_of_task `Fresh x with
+ match request_of_task Fresh x with
| Some (ReqBuildProof (r, b, _)) -> Some(r, b)
| _ -> None)
tasks in
@@ -1749,7 +1813,7 @@ end (* }}} *)
and TacTask : sig
- type output = (Constr.constr * Evd.evar_universe_context) option
+ type output = (Constr.constr * UState.t) option
type task = {
t_state : Stateid.t;
t_state_fb : Stateid.t;
@@ -1757,14 +1821,14 @@ and TacTask : sig
t_ast : int * aast;
t_goal : Goal.goal;
t_kill : unit -> unit;
- t_name : string }
+ t_name : string }
include AsyncTaskQueue.Task with type task := task
end = struct (* {{{ *)
- type output = (Constr.constr * Evd.evar_universe_context) option
-
+ type output = (Constr.constr * UState.t) option
+
let forward_feedback msg = Hooks.(call forward_feedback msg)
type task = {
@@ -1774,7 +1838,7 @@ end = struct (* {{{ *)
t_ast : int * aast;
t_goal : Goal.goal;
t_kill : unit -> unit;
- t_name : string }
+ t_name : string }
type request = {
r_state : Stateid.t;
@@ -1785,13 +1849,15 @@ end = struct (* {{{ *)
r_name : string }
type response =
- | RespBuiltSubProof of (Constr.constr * Evd.evar_universe_context)
+ | RespBuiltSubProof of (Constr.constr * UState.t)
| RespError of Pp.t
| RespNoProgress
let name = ref "tacworker"
let extra_env () = [||]
type competence = unit
+ type worker_status = Fresh | Old of competence
+
let task_match _ _ = true
(* run by the master, on a thread *)
@@ -1800,13 +1866,13 @@ end = struct (* {{{ *)
r_state = t_state;
r_state_fb = t_state_fb;
r_document =
- if age <> `Fresh then None
+ if age <> Fresh then None
else Some (VCS.slice ~block_start:t_state ~block_stop:t_state);
r_ast = t_ast;
r_goal = t_goal;
r_name = t_name }
with VCS.Expired -> None
-
+
let use_response _ { t_assign; t_state; t_state_fb; t_kill } resp =
match resp with
| RespBuiltSubProof o -> t_assign (`Val (Some o)); `Stay ((),[])
@@ -1819,7 +1885,7 @@ end = struct (* {{{ *)
t_assign (`Exn e);
t_kill ();
`Stay ((),[])
-
+
let on_marshal_error err { t_name } =
stm_pr_err ("Fatal marshal error: " ^ t_name );
flush_all (); exit 1
@@ -1827,7 +1893,7 @@ end = struct (* {{{ *)
let on_task_cancellation_or_expiration_or_slave_death = function
| Some { t_kill } -> t_kill ()
| _ -> ()
-
+
let command_focus = Proof.new_focus_kind ()
let focus_cond = Proof.no_cond command_focus
@@ -1855,7 +1921,7 @@ end = struct (* {{{ *)
* => captures state id in a future closure, which will
discard execution state but for the proof + univs.
*)
- let st = Vernacentries.freeze_interp_state `No in
+ let st = Vernacstate.freeze_interp_state `No in
ignore(stm_vernac_interp r_state_fb st ast);
let _,_,_,_,sigma = Proof.proof (Proof_global.give_me_the_proof ()) in
match Evd.(evar_body (find sigma r_goal)) with
@@ -1872,32 +1938,32 @@ end = struct (* {{{ *)
let name_of_task { t_name } = t_name
let name_of_request { r_name } = r_name
-
+
end (* }}} *)
and Partac : sig
val vernac_interp :
- solve:bool -> abstract:bool -> cancel_switch ->
- int -> Stateid.t -> Stateid.t -> aast ->
- unit
+ solve:bool -> abstract:bool -> cancel_switch:AsyncTaskQueue.cancel_switch ->
+ int -> Stateid.t -> Stateid.t -> aast -> unit
end = struct (* {{{ *)
-
+
module TaskQueue = AsyncTaskQueue.MakeQueue(TacTask) ()
- let vernac_interp ~solve ~abstract cancel nworkers safe_id id
+ let vernac_interp ~solve ~abstract ~cancel_switch nworkers safe_id id
{ indentation; verbose; loc; expr = e; strlen }
=
- let e, time, fail =
- let rec find ~time ~fail = function
- | VernacTime (_,e) -> find ~time:true ~fail e
- | VernacRedirect (_,(_,e)) -> find ~time ~fail e
- | VernacFail e -> find ~time ~fail:true e
- | e -> e, time, fail in find ~time:false ~fail:false e in
- let st = Vernacentries.freeze_interp_state `No in
+ let e, time, batch, fail =
+ let rec find ~time ~batch ~fail = function
+ | VernacTime (batch,(_,e)) -> find ~time:true ~batch ~fail e
+ | VernacRedirect (_,(_,e)) -> find ~time ~batch ~fail e
+ | VernacFail e -> find ~time ~batch ~fail:true e
+ | e -> e, time, batch, fail in
+ find ~time:false ~batch:false ~fail:false e in
+ let st = Vernacstate.freeze_interp_state `No in
Vernacentries.with_fail st fail (fun () ->
- (if time then System.with_time !Flags.time else (fun x -> x)) (fun () ->
+ (if time then System.with_time ~batch else (fun x -> x)) (fun () ->
ignore(TaskQueue.with_n_workers nworkers (fun queue ->
Proof_global.with_current_proof (fun _ p ->
let goals, _, _, _, _ = Proof.proof p in
@@ -1910,10 +1976,10 @@ end = struct (* {{{ *)
let t_ast = (i, { indentation; verbose; loc; expr = e; strlen }) in
let t_name = Goal.uid g in
TaskQueue.enqueue_task queue
- ({ t_state = safe_id; t_state_fb = id;
+ { t_state = safe_id; t_state_fb = id;
t_assign = assign; t_ast; t_goal = g; t_name;
- t_kill = (fun () -> if solve then TaskQueue.cancel_all queue) },
- cancel);
+ t_kill = (fun () -> if solve then TaskQueue.cancel_all queue) }
+ ~cancel_switch;
g,f)
1 goals in
TaskQueue.join queue;
@@ -1932,9 +1998,10 @@ end = struct (* {{{ *)
let open Notations in
match Future.join f with
| Some (pt, uc) ->
+ let sigma, env = Pfedit.get_current_context () in
stm_pperr_endline (fun () -> hov 0 (
str"g=" ++ int (Evar.repr gid) ++ spc () ++
- str"t=" ++ (Printer.pr_constr pt) ++ spc () ++
+ str"t=" ++ (Printer.pr_constr_env env sigma pt) ++ spc () ++
str"uc=" ++ Termops.pr_evar_universe_context uc));
(if abstract then Tactics.tclABSTRACT None else (fun x -> x))
(V82.tactic (Refiner.tclPUSHEVARUNIVCONTEXT uc) <*>
@@ -1944,7 +2011,7 @@ end = struct (* {{{ *)
end)
in
Proof.run_tactic (Global.env()) assign_tac p)))) ())
-
+
end (* }}} *)
and QueryTask : sig
@@ -1953,10 +2020,10 @@ and QueryTask : sig
include AsyncTaskQueue.Task with type task := task
end = struct (* {{{ *)
-
+
type task =
{ t_where : Stateid.t; t_for : Stateid.t ; t_what : aast }
-
+
type request =
{ r_where : Stateid.t ; r_for : Stateid.t ; r_what : aast; r_doc : VCS.vcs }
type response = unit
@@ -1964,6 +2031,8 @@ end = struct (* {{{ *)
let name = ref "queryworker"
let extra_env _ = [||]
type competence = unit
+ type worker_status = Fresh | Old of competence
+
let task_match _ _ = true
let request_of_task _ { t_where; t_what; t_for } =
@@ -1973,7 +2042,7 @@ end = struct (* {{{ *)
r_doc = VCS.slice ~block_start:t_where ~block_stop:t_where;
r_what = t_what }
with VCS.Expired -> None
-
+
let use_response _ _ _ = `End
let on_marshal_error _ _ =
@@ -1981,7 +2050,7 @@ end = struct (* {{{ *)
flush_all (); exit 1
let on_task_cancellation_or_expiration_or_slave_death _ = ()
-
+
let forward_feedback msg = Hooks.(call forward_feedback msg)
let perform { r_where; r_doc; r_what; r_for } =
@@ -1989,7 +2058,7 @@ end = struct (* {{{ *)
VCS.print ();
Reach.known_state ~cache:`No r_where;
(* STATE *)
- let st = Vernacentries.freeze_interp_state `No in
+ let st = Vernacstate.freeze_interp_state `No in
try
(* STATE SPEC:
* - start: r_where
@@ -2001,16 +2070,16 @@ end = struct (* {{{ *)
let e = CErrors.push e in
let msg = iprint e in
feedback ~id:r_for (Message (Error, None, msg))
-
+
let name_of_task { t_what } = string_of_ppcmds (pr_ast t_what)
let name_of_request { r_what } = string_of_ppcmds (pr_ast r_what)
end (* }}} *)
-and Query : sig
+and Query : sig
val init : unit -> unit
- val vernac_interp : cancel_switch -> Stateid.t -> Stateid.t -> aast -> unit
+ val vernac_interp : cancel_switch:AsyncTaskQueue.cancel_switch -> Stateid.t -> Stateid.t -> aast -> unit
end = struct (* {{{ *)
@@ -2018,13 +2087,13 @@ end = struct (* {{{ *)
let queue = ref None
- let vernac_interp switch prev id q =
+ let vernac_interp ~cancel_switch prev id q =
assert(TaskQueue.n_workers (Option.get !queue) > 0);
TaskQueue.enqueue_task (Option.get !queue)
- QueryTask.({ t_where = prev; t_for = id; t_what = q }, switch)
+ QueryTask.({ t_where = prev; t_for = id; t_what = q }) ~cancel_switch
let init () = queue := Some (TaskQueue.create
- (if !Flags.async_proofs_full then 1 else 0))
+ (if !cur_opt.async_proofs_full then 1 else 0))
end (* }}} *)
@@ -2036,21 +2105,19 @@ and Reach : sig
end = struct (* {{{ *)
-let pstate = summary_pstate
-
let async_policy () =
let open Flags in
if is_universe_polymorphism () then false
else if VCS.is_interactive () = `Yes then
- (async_proofs_is_master () || !async_proofs_mode = APonLazy)
+ (async_proofs_is_master !cur_opt || !cur_opt.async_proofs_mode = APonLazy)
else
- (VCS.is_vio_doc () || !async_proofs_mode <> APoff)
+ (VCS.is_vio_doc () || !cur_opt.async_proofs_mode <> APoff)
let delegate name =
- get_hint_bp_time name >= !Flags.async_proofs_delegation_threshold
+ get_hint_bp_time name >= !cur_opt.async_proofs_delegation_threshold
|| VCS.is_vio_doc ()
- || !Flags.async_proofs_full
-
+ || !cur_opt.async_proofs_full
+
let warn_deprecated_nested_proofs =
CWarnings.create ~name:"deprecated-nested-proofs" ~category:"deprecated"
(fun () ->
@@ -2064,29 +2131,43 @@ let collect_proof keep cur hd brkind id =
| [] -> no_name
| id :: _ -> Names.Id.to_string id in
let loc = (snd cur).loc in
- let rec is_defined_expr = function
- | VernacTime (_, e) -> is_defined_expr e
- | VernacRedirect (_, (_, e)) -> is_defined_expr e
- | VernacTimeout (_, e) -> is_defined_expr e
+ let is_defined_expr = function
+ | VernacEndProof (Proved (Transparent,_)) -> true
| _ -> false in
let is_defined = function
- | _, { expr = e } -> is_defined_expr e in
+ | _, { expr = e } -> is_defined_expr (Vernacprop.under_control e)
+ && (not (Vernacprop.has_Fail e)) in
+ let proof_using_ast = function
+ | VernacProof(_,Some _) -> true
+ | _ -> false
+ in
let proof_using_ast = function
- | Some (_, ({ expr = VernacProof(_,Some _) } as v)) -> Some v
+ | Some (_, v) when proof_using_ast (Vernacprop.under_control v.expr)
+ && (not (Vernacprop.has_Fail v.expr)) -> Some v
| _ -> None in
let has_proof_using x = proof_using_ast x <> None in
let proof_no_using = function
- | Some (_, ({ expr = VernacProof(t,None) } as v)) -> t,v
+ | VernacProof(t,None) -> t
+ | _ -> assert false
+ in
+ let proof_no_using = function
+ | Some (_, v) -> proof_no_using (Vernacprop.under_control v.expr), v
| _ -> assert false in
let has_proof_no_using = function
- | Some (_, { expr = VernacProof(_,None) }) -> true
+ | VernacProof(_,None) -> true
+ | _ -> false
+ in
+ let has_proof_no_using = function
+ | Some (_, v) -> has_proof_no_using (Vernacprop.under_control v.expr)
+ && (not (Vernacprop.has_Fail v.expr))
| _ -> false in
let too_complex_to_delegate = function
- | { expr = (VernacDeclareModule _
- | VernacDefineModule _
- | VernacDeclareModuleType _
- | VernacInclude _) } -> true
- | { expr = (VernacRequire _ | VernacImport _) } -> true
+ | VernacDeclareModule _
+ | VernacDefineModule _
+ | VernacDeclareModuleType _
+ | VernacInclude _
+ | VernacRequire _
+ | VernacImport _ -> true
| ast -> may_pierce_opaque ast in
let parent = function Some (p, _) -> p | None -> assert false in
let is_empty = function `Async(_,[],_,_) | `MaybeASync(_,[],_,_) -> true | _ -> false in
@@ -2094,7 +2175,8 @@ let collect_proof keep cur hd brkind id =
let view = VCS.visit id in
match view.step with
| (`Sideff (ReplayCommand x,_) | `Cmd { cast = x })
- when too_complex_to_delegate x -> `Sync(no_name,`Print)
+ when too_complex_to_delegate (Vernacprop.under_control x.expr) ->
+ `Sync(no_name,`Print)
| `Cmd { cast = x } -> collect (Some (id,x)) (id::accn) view.next
| `Sideff (ReplayCommand x,_) -> collect (Some (id,x)) (id::accn) view.next
(* An Alias could jump everywhere... we hope we can ignore it*)
@@ -2114,7 +2196,7 @@ let collect_proof keep cur hd brkind id =
(try
let name, hint = name ids, get_hint_ctx loc in
let t, v = proof_no_using last in
- v.expr <- VernacProof(t, Some hint);
+ v.expr <- VernacExpr([], VernacProof(t, Some hint));
`ASync (parent last,accn,name,delegate name)
with Not_found ->
let name = name ids in
@@ -2133,9 +2215,13 @@ let collect_proof keep cur hd brkind id =
| `ASync(_,_,name,_) -> `Sync (name,why) in
let check_policy rc = if async_policy () then rc else make_sync `Policy rc in
+ let is_vernac_exact = function
+ | VernacExactProof _ -> true
+ | _ -> false
+ in
match cur, (VCS.visit id).step, brkind with
- | (parent, { expr = VernacExactProof _ }), `Fork _, _
- | (parent, { expr = VernacTime (_, VernacExactProof _) }), `Fork _, _ ->
+ | (parent, x), `Fork _, _ when is_vernac_exact (Vernacprop.under_control x.expr)
+ && (not (Vernacprop.has_Fail x.expr)) ->
`Sync (no_name,`Immediate)
| _, _, { VCS.kind = `Edit _ } -> check_policy (collect (Some cur) [] id)
| _ ->
@@ -2145,7 +2231,7 @@ let collect_proof keep cur hd brkind id =
let rc = collect (Some cur) [] id in
if is_empty rc then make_sync `AlreadyEvaluated rc
else if (keep == VtKeep || keep == VtKeepAsAxiom) &&
- (not(State.is_cached_and_valid id) || !Flags.async_proofs_full)
+ (not(State.is_cached_and_valid id) || !cur_opt.async_proofs_full)
then check_policy rc
else make_sync `AlreadyEvaluated rc
@@ -2175,7 +2261,7 @@ let log_processing_sync id name reason = log_string Printf.(sprintf
let wall_clock_last_fork = ref 0.0
let known_state ?(redefine_qed=false) ~cache id =
-
+
let error_absorbing_tactic id blockname exn =
(* We keep the static/dynamic part of block detection separate, since
the static part could be performed earlier. As of today there is
@@ -2203,7 +2289,7 @@ let known_state ?(redefine_qed=false) ~cache id =
Proofview.give_up else Proofview.tclUNIT ()
end in
match (VCS.get_info base_state).state with
- | Valid { Vernacentries.proof } ->
+ | Valid { Vernacstate.proof } ->
Proof_global.unfreeze proof;
Proof_global.with_current_proof (fun _ p ->
feedback ~id:id Feedback.AddedAxiom;
@@ -2213,7 +2299,7 @@ let known_state ?(redefine_qed=false) ~cache id =
* - end : maybe after recovery command.
*)
(* STATE: We use an updated state with proof *)
- let st = Vernacentries.freeze_interp_state `No in
+ let st = Vernacstate.freeze_interp_state `No in
Option.iter (fun expr -> ignore(stm_vernac_interp id st {
verbose = true; loc = None; expr; indentation = 0;
strlen = 0 } ))
@@ -2227,9 +2313,9 @@ let known_state ?(redefine_qed=false) ~cache id =
(* Absorb tactic errors from f () *)
let resilient_tactic id blockname f =
- if !Flags.async_proofs_tac_error_resilience = `None ||
- (Flags.async_proofs_is_master () &&
- !Flags.async_proofs_mode = Flags.APoff)
+ if !cur_opt.async_proofs_tac_error_resilience = `None ||
+ (async_proofs_is_master !cur_opt &&
+ !cur_opt.async_proofs_mode = APoff)
then f ()
else
try f ()
@@ -2238,9 +2324,9 @@ let known_state ?(redefine_qed=false) ~cache id =
error_absorbing_tactic id blockname ie in
(* Absorb errors from f x *)
let resilient_command f x =
- if not !Flags.async_proofs_cmd_error_resilience ||
- (Flags.async_proofs_is_master () &&
- !Flags.async_proofs_mode = Flags.APoff)
+ if not !cur_opt.async_proofs_cmd_error_resilience ||
+ (async_proofs_is_master !cur_opt &&
+ !cur_opt.async_proofs_mode = APoff)
then f x
else
try f x
@@ -2249,10 +2335,14 @@ let known_state ?(redefine_qed=false) ~cache id =
(* ugly functions to process nested lemmas, i.e. hard to reproduce
* side effects *)
let cherry_pick_non_pstate () =
- Summary.freeze_summary ~marshallable:`No ~complement:true pstate,
- Lib.freeze ~marshallable:`No in
+ let st = Summary.freeze_summaries ~marshallable:`No in
+ let st = Summary.remove_from_summary st Util.(pi1 summary_pstate) in
+ let st = Summary.remove_from_summary st Util.(pi2 summary_pstate) in
+ let st = Summary.remove_from_summary st Util.(pi3 summary_pstate) in
+ st, Lib.freeze ~marshallable:`No in
+
let inject_non_pstate (s,l) =
- Summary.unfreeze_summary s; Lib.unfreeze l; update_global_env ()
+ Summary.unfreeze_summaries ~partial:true s; Lib.unfreeze l; update_global_env ()
in
let rec pure_cherry_pick_non_pstate safe_id id =
stm_purify (fun id ->
@@ -2277,39 +2367,39 @@ let known_state ?(redefine_qed=false) ~cache id =
), cache, true
| `Cmd { cast = x; cqueue = `SkipQueue } -> (fun () ->
reach view.next), cache, true
- | `Cmd { cast = x; cqueue = `TacQueue (solve,abstract,cancel); cblock } ->
+ | `Cmd { cast = x; cqueue = `TacQueue (solve,abstract,cancel_switch); cblock } ->
(fun () ->
resilient_tactic id cblock (fun () ->
reach ~cache:`Shallow view.next;
- Partac.vernac_interp ~solve ~abstract
- cancel !Flags.async_proofs_n_tacworkers view.next id x)
+ Partac.vernac_interp ~solve ~abstract ~cancel_switch
+ !cur_opt.async_proofs_n_tacworkers view.next id x)
), cache, true
- | `Cmd { cast = x; cqueue = `QueryQueue cancel }
- when Flags.async_proofs_is_master () -> (fun () ->
+ | `Cmd { cast = x; cqueue = `QueryQueue cancel_switch }
+ when async_proofs_is_master !cur_opt -> (fun () ->
reach view.next;
- Query.vernac_interp cancel view.next id x
+ Query.vernac_interp ~cancel_switch view.next id x
), cache, false
| `Cmd { cast = x; ceff = eff; ctac = true; cblock } -> (fun () ->
resilient_tactic id cblock (fun () ->
reach view.next;
(* State resulting from reach *)
- let st = Vernacentries.freeze_interp_state `No in
+ let st = Vernacstate.freeze_interp_state `No in
ignore(stm_vernac_interp id st x)
);
if eff then update_global_env ()
), (if eff then `Yes else cache), true
| `Cmd { cast = x; ceff = eff } -> (fun () ->
- (match !Flags.async_proofs_mode with
- | Flags.APon | Flags.APonLazy ->
+ (match !cur_opt.async_proofs_mode with
+ | APon | APonLazy ->
resilient_command reach view.next
- | Flags.APoff -> reach view.next);
- let st = Vernacentries.freeze_interp_state `No in
+ | APoff -> reach view.next);
+ let st = Vernacstate.freeze_interp_state `No in
ignore(stm_vernac_interp id st x);
if eff then update_global_env ()
), (if eff then `Yes else cache), true
| `Fork ((x,_,_,_), None) -> (fun () ->
resilient_command reach view.next;
- let st = Vernacentries.freeze_interp_state `No in
+ let st = Vernacstate.freeze_interp_state `No in
ignore(stm_vernac_interp id st x);
wall_clock_last_fork := Unix.gettimeofday ()
), `Yes, true
@@ -2318,7 +2408,7 @@ let known_state ?(redefine_qed=false) ~cache id =
reach view.next;
(try
- let st = Vernacentries.freeze_interp_state `No in
+ let st = Vernacstate.freeze_interp_state `No in
ignore(stm_vernac_interp id st x);
with e when CErrors.noncritical e ->
let (e, info) = CErrors.push e in
@@ -2369,16 +2459,16 @@ let known_state ?(redefine_qed=false) ~cache id =
Proof_global.close_future_proof ~feedback_id:id fp in
if not delegate then ignore(Future.compute fp);
reach view.next;
- let st = Vernacentries.freeze_interp_state `No in
+ let st = Vernacstate.freeze_interp_state `No in
ignore(stm_vernac_interp id ~proof st x);
feedback ~id:id Incomplete
| { VCS.kind = `Master }, _ -> assert false
end;
Proof_global.discard_all ()
), (if redefine_qed then `No else `Yes), true
- | `Sync (name, `Immediate) -> (fun () ->
+ | `Sync (name, `Immediate) -> (fun () ->
reach eop;
- let st = Vernacentries.freeze_interp_state `No in
+ let st = Vernacstate.freeze_interp_state `No in
ignore(stm_vernac_interp id st x);
Proof_global.discard_all ()
), `Yes, true
@@ -2401,7 +2491,7 @@ let known_state ?(redefine_qed=false) ~cache id =
if keep != VtKeepAsAxiom then
reach view.next;
let wall_clock2 = Unix.gettimeofday () in
- let st = Vernacentries.freeze_interp_state `No in
+ let st = Vernacstate.freeze_interp_state `No in
ignore(stm_vernac_interp id ?proof st x);
let wall_clock3 = Unix.gettimeofday () in
Aux_file.record_in_aux_at ?loc:x.loc "proof_check_time"
@@ -2419,7 +2509,7 @@ let known_state ?(redefine_qed=false) ~cache id =
aux (collect_proof keep (view.next, x) brname brinfo eop)
| `Sideff (ReplayCommand x,_) -> (fun () ->
reach view.next;
- let st = Vernacentries.freeze_interp_state `No in
+ let st = Vernacstate.freeze_interp_state `No in
ignore(stm_vernac_interp id st x);
update_global_env ()
), cache, true
@@ -2429,7 +2519,7 @@ let known_state ?(redefine_qed=false) ~cache id =
), cache, true
in
let cache_step =
- if !Flags.async_proofs_cache = Some Flags.Force then `Yes
+ if !cur_opt.async_proofs_cache = Some Force then `Yes
else cache_step in
State.define ?safe_id
~cache:cache_step ~redefine:redefine_qed ~feedback_processed step id;
@@ -2442,15 +2532,28 @@ end (* }}} *)
(********************************* STM API ************************************)
(******************************************************************************)
+(* Main initalization routine *)
type stm_init_options = {
+ (* The STM will set some internal flags differently depending on the
+ specified [doc_type]. This distinction should dissappear at some
+ some point. *)
doc_type : stm_doc_type;
+
+ (* Initial load path in scope for the document. Usually extracted
+ from -R options / _CoqProject *)
+ iload_path : Mltop.coq_path list;
+
+ (* Require [require_libs] before the initial state is
+ ready. Parameters follow [Library], that is to say,
+ [lib,prefix,import_export] means require library [lib] from
+ optional [prefix] and [import_export] if [Some false/Some true]
+ is used. *)
require_libs : (string * string option * bool option) list;
-(*
- fb_handler : Feedback.feedback -> unit;
- iload_path : (string list * string * bool) list;
- implicit_std : bool;
-*)
+
+ (* STM options that apply to the current document. *)
+ stm_options : AsyncOpts.stm_opt;
}
+(* fb_handler : Feedback.feedback -> unit; *)
(*
let doc_type_module_name (std : stm_doc_type) =
@@ -2460,9 +2563,11 @@ let doc_type_module_name (std : stm_doc_type) =
*)
let init_core () =
+ if !cur_opt.async_proofs_mode = APon then Control.enable_thread_delay := true;
State.register_root_state ()
-let new_doc { doc_type ; require_libs } =
+let new_doc { doc_type ; iload_path; require_libs; stm_options } =
+
let load_objs libs =
let rq_file (dir, from, exp) =
let mp = Libnames.(Qualid (Loc.tag @@ qualid_of_string dir)) in
@@ -2471,33 +2576,47 @@ let new_doc { doc_type ; require_libs } =
List.(iter rq_file (rev libs))
in
+ (* Set the options from the new documents *)
+ AsyncOpts.cur_opt := stm_options;
+
(* We must reset the whole state before creating a document! *)
State.restore_root_state ();
let doc = VCS.init doc_type Stateid.initial in
+ (* 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;
+
begin match doc_type with
| Interactive ln ->
+ Safe_typing.allow_delayed_constants := true;
Declaremods.start_library ln
+
| VoDoc ln ->
let ldir = Flags.verbosely Library.start_library ln in
VCS.set_ldir ldir;
set_compilation_hints ln
+
| VioDoc ln ->
+ Safe_typing.allow_delayed_constants := true;
let ldir = Flags.verbosely Library.start_library ln in
VCS.set_ldir ldir;
set_compilation_hints ln
end;
+
+ (* Import initial libraries. *)
load_objs require_libs;
- (* We record the state here! *)
+ (* We record the state at this point! *)
State.define ~cache:`Yes ~redefine:true (fun () -> ()) Stateid.initial;
Backtrack.record ();
Slaves.init ();
- if Flags.async_proofs_is_master () then begin
+ if async_proofs_is_master !cur_opt then begin
stm_prerr_endline (fun () -> "Initializing workers");
Query.init ();
- let opts = match !Flags.async_proofs_private_flags with
+ let opts = match !cur_opt.async_proofs_private_flags with
| None -> []
| Some s -> Str.split_delim (Str.regexp ",") s in
begin try
@@ -2688,7 +2807,7 @@ let process_transaction ?(newtip=Stateid.fresh ()) ?(part_of_script=true)
| VtQuery (false,route), VtNow ->
let query_sid = VCS.cur_tip () in
(try
- let st = Vernacentries.freeze_interp_state `No in
+ let st = Vernacstate.freeze_interp_state `No in
ignore(stm_vernac_interp ~route query_sid st x)
with e ->
let e = CErrors.push e in
@@ -2696,10 +2815,10 @@ let process_transaction ?(newtip=Stateid.fresh ()) ?(part_of_script=true)
| VtQuery (true, route), w ->
let id = VCS.new_node ~id:newtip () in
let queue =
- if !Flags.async_proofs_full then `QueryQueue (ref false)
+ if !cur_opt.async_proofs_full then `QueryQueue (ref false)
else if VCS.is_vio_doc () &&
VCS.((get_branch head).kind = `Master) &&
- may_pierce_opaque x
+ may_pierce_opaque (Vernacprop.under_control x.expr)
then `SkipQueue
else `MainQueue in
VCS.commit id (mkTransCmd x [] false queue);
@@ -2761,8 +2880,8 @@ let process_transaction ?(newtip=Stateid.fresh ()) ?(part_of_script=true)
rc
(* Side effect on all branches *)
- | VtUnknown, _ when expr = VernacToplevelControl Drop ->
- let st = Vernacentries.freeze_interp_state `No in
+ | VtUnknown, _ when Vernacprop.under_control expr = VernacToplevelControl Drop ->
+ let st = Vernacstate.freeze_interp_state `No in
ignore(stm_vernac_interp (VCS.get_branch_pos head) st x);
`Ok
@@ -2773,7 +2892,7 @@ let process_transaction ?(newtip=Stateid.fresh ()) ?(part_of_script=true)
VCS.commit id (mkTransCmd x l in_proof `MainQueue);
(* We can't replay a Definition since universes may be differently
* inferred. This holds in Coq >= 8.5 *)
- let action = match x.expr with
+ let action = match Vernacprop.under_control x.expr with
| VernacDefinition(_, _, DefineBody _) -> CherryPickEnv
| _ -> ReplayCommand x in
VCS.propagate_sideff ~action;
@@ -2790,18 +2909,17 @@ let process_transaction ?(newtip=Stateid.fresh ()) ?(part_of_script=true)
VCS.checkout VCS.Branch.master;
let mid = VCS.get_branch_pos VCS.Branch.master in
let _st' = Reach.known_state ~cache:(VCS.is_interactive ()) mid in
- let st = Vernacentries.freeze_interp_state `No in
+ let st = Vernacstate.freeze_interp_state `No in
ignore(stm_vernac_interp id st x);
(* Vernac x may or may not start a proof *)
if not in_proof && Proof_global.there_are_pending_proofs () then
begin
let bname = VCS.mk_branch_name x in
- let rec opacity_of_produced_term = function
+ let opacity_of_produced_term = function
(* This AST is ambiguous, hence we check it dynamically *)
| VernacInstance (false, _,_ , None, _) -> GuaranteesOpacity
- | VernacLocal (_,e) -> opacity_of_produced_term e
| _ -> Doesn'tGuaranteeOpacity in
- VCS.commit id (Fork (x,bname,opacity_of_produced_term x.expr,[]));
+ VCS.commit id (Fork (x,bname,opacity_of_produced_term (Vernacprop.under_control x.expr),[]));
let proof_mode = default_proof_mode () in
VCS.branch bname (`Proof (proof_mode, VCS.proof_nesting () + 1));
Proof_global.activate_proof_mode proof_mode [@ocaml.warning "-3"];
@@ -2831,7 +2949,7 @@ let process_transaction ?(newtip=Stateid.fresh ()) ?(part_of_script=true)
let get_ast ~doc id =
match VCS.visit id with
| { step = `Cmd { cast = { loc; expr } } }
- | { step = `Fork (({ loc; expr }, _, _, _), _) }
+ | { step = `Fork (({ loc; expr }, _, _, _), _) }
| { step = `Qed ({ qast = { loc; expr } }, _) } ->
Some (Loc.tag ?loc expr)
| _ -> None
@@ -2861,7 +2979,7 @@ let parse_sentence ~doc sid pa =
(str "Currently, the parsing api only supports parsing at the tip of the document." ++ fnl () ++
str "You wanted to parse at: " ++ str (Stateid.to_string sid) ++
str " but the current tip is: " ++ str (Stateid.to_string cur_tip)) ;
- if not (Stateid.equal sid real_tip) && !Flags.debug && stm_debug () then
+ if not (Stateid.equal sid real_tip) && !Flags.debug && !stm_debug then
Feedback.msg_debug
(str "Warning, the real tip doesn't match the current tip." ++
str "You wanted to parse at: " ++ str (Stateid.to_string sid) ++
@@ -2941,16 +3059,25 @@ let query ~doc ~at ~route s =
stm_purify (fun s ->
if Stateid.equal at Stateid.dummy then ignore(finish ~doc:dummy_doc)
else Reach.known_state ~cache:`Yes at;
- let loc, ast = parse_sentence ~doc at s in
- let indentation, strlen = compute_indentation ?loc at in
- CWarnings.set_current_loc loc;
- let clas = Vernac_classifier.classify_vernac ast in
- let aast = { verbose = true; indentation; strlen; loc; expr = ast } in
- match clas with
- | VtMeta , _ -> (* TODO: can this still happen ? *)
- ignore(process_transaction ~part_of_script:false aast (VtMeta,VtNow))
- | _ ->
- ignore(process_transaction aast (VtQuery (false, route), VtNow)))
+ try
+ while true do
+ let loc, ast = parse_sentence ~doc at s in
+ let indentation, strlen = compute_indentation ?loc at in
+ CWarnings.set_current_loc loc;
+ let clas = Vernac_classifier.classify_vernac ast in
+ let aast = { verbose = true; indentation; strlen; loc; expr = ast } in
+ match clas with
+ | VtMeta , _ -> (* TODO: can this still happen ? *)
+ ignore(process_transaction ~part_of_script:false aast (VtMeta,VtNow))
+ | _ ->
+ ignore(process_transaction aast (VtQuery (false,route), VtNow))
+ done;
+ with
+ | End_of_input -> ()
+ | exn ->
+ let iexn = CErrors.push exn in
+ Exninfo.iraise iexn
+ )
s
let edit_at ~doc id =
@@ -3020,7 +3147,7 @@ let edit_at ~doc id =
VCS.delete_boxes_of id;
VCS.gc ();
VCS.print ();
- if not !Flags.async_proofs_full then
+ if not !cur_opt.async_proofs_full then
Reach.known_state ~cache:(VCS.is_interactive ()) id;
VCS.checkout_shallowest_proof_branch ();
`NewTip in
@@ -3036,7 +3163,7 @@ let edit_at ~doc id =
| _, Some _, None -> assert false
| false, Some { qed = qed_id ; lemma = start }, Some(mode,bn) ->
let tip = VCS.cur_tip () in
- if has_failed qed_id && is_pure qed_id && not !Flags.async_proofs_never_reopen_branch
+ if has_failed qed_id && is_pure qed_id && not !cur_opt.async_proofs_never_reopen_branch
then reopen_branch start id mode qed_id tip bn
else backto id (Some bn)
| true, Some { qed = qed_id }, Some(mode,bn) ->
diff --git a/stm/stm.mli b/stm/stm.mli
index 31f4599d3..8a4de34b4 100644
--- a/stm/stm.mli
+++ b/stm/stm.mli
@@ -10,6 +10,33 @@ open Names
(** state-transaction-machine interface *)
+(* Flags *)
+module AsyncOpts : sig
+
+ type cache = Force
+ type async_proofs = APoff | APonLazy | APon
+ type tac_error_filter = [ `None | `Only of string list | `All ]
+
+ type stm_opt = {
+ async_proofs_n_workers : int;
+ async_proofs_n_tacworkers : int;
+
+ async_proofs_cache : cache option;
+ async_proofs_mode : async_proofs;
+
+ async_proofs_private_flags : string option;
+ async_proofs_full : bool;
+ async_proofs_never_reopen_branch : bool;
+
+ async_proofs_tac_error_resilience : tac_error_filter;
+ async_proofs_cmd_error_resilience : bool;
+ async_proofs_delegation_threshold : float;
+ }
+
+ val default_opts : stm_opt
+
+end
+
(** The STM doc type determines some properties such as what
uncompleted proofs are allowed and recording of aux files. *)
type stm_doc_type =
@@ -19,14 +46,26 @@ type stm_doc_type =
(* Main initalization routine *)
type stm_init_options = {
+ (* The STM will set some internal flags differently depending on the
+ specified [doc_type]. This distinction should dissappear at some
+ some point. *)
doc_type : stm_doc_type;
+
+ (* Initial load path in scope for the document. Usually extracted
+ from -R options / _CoqProject *)
+ iload_path : Mltop.coq_path list;
+
+ (* Require [require_libs] before the initial state is
+ ready. Parameters follow [Library], that is to say,
+ [lib,prefix,import_export] means require library [lib] from
+ optional [prefix] and [import_export] if [Some false/Some true]
+ is used. *)
require_libs : (string * string option * bool option) list;
-(*
- fb_handler : Feedback.feedback -> unit;
- iload_path : (string list * string * bool) list;
- implicit_std : bool;
-*)
+
+ (* STM options that apply to the current document. *)
+ stm_options : AsyncOpts.stm_opt;
}
+(* fb_handler : Feedback.feedback -> unit; *)
(** The type of a STM document *)
type doc
@@ -39,7 +78,7 @@ val new_doc : stm_init_options -> doc * Stateid.t
(* [parse_sentence sid pa] Reads a sentence from [pa] with parsing
state [sid] Returns [End_of_input] if the stream ends *)
val parse_sentence : doc:doc -> Stateid.t -> Pcoq.Gram.coq_parsable ->
- Vernacexpr.vernac_expr Loc.located
+ Vernacexpr.vernac_control Loc.located
(* Reminder: A parsable [pa] is constructed using
[Pcoq.Gram.coq_parsable stream], where [stream : char Stream.t]. *)
@@ -53,7 +92,7 @@ exception End_of_input
If [newtip] is provided, then the returned state id is guaranteed
to be [newtip] *)
val add : doc:doc -> ontop:Stateid.t -> ?newtip:Stateid.t ->
- bool -> Vernacexpr.vernac_expr Loc.located ->
+ bool -> Vernacexpr.vernac_control Loc.located ->
doc * Stateid.t * [ `NewTip | `Unfocus of Stateid.t ]
(* [query at ?report_with cmd] Executes [cmd] at a given state [at],
@@ -111,7 +150,7 @@ val get_current_state : doc:doc -> Stateid.t
val get_ldir : doc:doc -> Names.DirPath.t
(* This returns the node at that position *)
-val get_ast : doc:doc -> Stateid.t -> (Vernacexpr.vernac_expr Loc.located) option
+val get_ast : doc:doc -> Stateid.t -> (Vernacexpr.vernac_control Loc.located) option
(* Filename *)
val set_compilation_hints : string -> unit
@@ -174,7 +213,7 @@ type static_block_declaration = {
type document_node = {
indentation : int;
- ast : Vernacexpr.vernac_expr;
+ ast : Vernacexpr.vernac_control;
id : Stateid.t;
}
@@ -189,7 +228,7 @@ type static_block_detection =
type recovery_action = {
base_state : Stateid.t;
goals_to_admit : Goal.goal list;
- recovery_command : Vernacexpr.vernac_expr option;
+ recovery_command : Vernacexpr.vernac_control option;
}
type dynamic_block_error_recovery =
@@ -220,8 +259,11 @@ val forward_feedback_hook : (Feedback.feedback -> unit) Hook.t
val get_doc : Feedback.doc_id -> doc
val state_of_id : doc:doc ->
- Stateid.t -> [ `Valid of Vernacentries.interp_state option | `Expired | `Error of exn ]
+ Stateid.t -> [ `Valid of Vernacstate.t option | `Expired | `Error of exn ]
(* Queries for backward compatibility *)
val current_proof_depth : doc:doc -> int
val get_all_proof_names : doc:doc -> Id.t list
+
+(** Enable STM debugging *)
+val stm_debug : bool ref
diff --git a/stm/vernac_classifier.ml b/stm/vernac_classifier.ml
index 3aa2cd707..cbbb54e45 100644
--- a/stm/vernac_classifier.ml
+++ b/stm/vernac_classifier.ml
@@ -8,6 +8,7 @@
open Vernacexpr
open CErrors
+open Util
open Pp
let default_proof_mode () = Proof_global.get_default_proof_mode_name () [@ocaml.warning "-3"]
@@ -47,36 +48,19 @@ let declare_vernac_classifier
=
classifiers := !classifiers @ [s,f]
-let make_polymorphic (a, b as x) =
- match a with
- | VtStartProof (x, _, ids) ->
- VtStartProof (x, Doesn'tGuaranteeOpacity, ids), b
- | _ -> x
+let idents_of_name : Names.Name.t -> Names.Id.t list =
+ function
+ | Names.Anonymous -> []
+ | Names.Name n -> [n]
-let rec classify_vernac e =
- let static_classifier e = match e with
+let classify_vernac e =
+ let static_classifier ~poly e = match e with
(* Univ poly compatibility: we run it now, so that we can just
* look at Flags in stm.ml. Would be nicer to have the stm
* look at the entire dag to detect this option. *)
- | VernacSetOption (["Universe"; "Polymorphism"],_)
- | VernacUnsetOption (["Universe"; "Polymorphism"]) -> VtSideff [], VtNow
- (* Nested vernac exprs *)
- | VernacProgram e -> classify_vernac e
- | VernacLocal (_,e) -> classify_vernac e
- | VernacPolymorphic (b, e) ->
- if b || Flags.is_universe_polymorphism () (* Ok or not? *) then
- make_polymorphic (classify_vernac e)
- else classify_vernac e
- | VernacTimeout (_,e) -> classify_vernac e
- | VernacTime (_,e) | VernacRedirect (_, (_,e)) -> classify_vernac e
- | VernacFail e -> (* Fail Qed or Fail Lemma must not join/fork the DAG *)
- (match classify_vernac e with
- | ( VtQuery _ | VtProofStep _ | VtSideff _
- | VtProofMode _ | VtMeta), _ as x -> x
- | VtQed _, _ ->
- VtProofStep { parallel = `No; proof_block_detection = None },
- VtNow
- | (VtStartProof _ | VtUnknown), _ -> VtUnknown, VtNow)
+ | ( VernacSetOption (l,_) | VernacUnsetOption l)
+ when CList.equal String.equal l Vernacentries.universe_polymorphism_option_name ->
+ VtSideff [], VtNow
(* Qed *)
| VernacAbort _ -> VtQed VtDrop, VtLater
| VernacEndProof Admitted -> VtQed VtKeepAsAxiom, VtLater
@@ -103,35 +87,42 @@ let rec classify_vernac e =
| VernacUnsetOption (["Default";"Proof";"Using"])
| VernacSetOption (["Default";"Proof";"Using"],_) -> VtSideff [], VtNow
(* StartProof *)
- | VernacDefinition (
- (Some Decl_kinds.Discharge,Decl_kinds.Definition),((_,i),_),ProveBody _) ->
- VtStartProof(default_proof_mode (),Doesn'tGuaranteeOpacity,[i]), VtLater
+ | VernacDefinition ((Decl_kinds.DoDischarge,_),((_,i),_),ProveBody _) ->
+ VtStartProof(default_proof_mode (),Doesn'tGuaranteeOpacity, idents_of_name i), VtLater
| VernacDefinition (_,((_,i),_),ProveBody _) ->
- VtStartProof(default_proof_mode (),GuaranteesOpacity,[i]), VtLater
+ let guarantee = if poly then Doesn'tGuaranteeOpacity else GuaranteesOpacity in
+ VtStartProof(default_proof_mode (),guarantee, idents_of_name i), VtLater
| VernacStartTheoremProof (_,l) ->
- let ids =
- CList.map_filter (function (Some ((_,i),pl), _) -> Some i | _ -> None) l in
- VtStartProof (default_proof_mode (),GuaranteesOpacity,ids), VtLater
- | VernacGoal _ -> VtStartProof (default_proof_mode (),GuaranteesOpacity,[]), VtLater
- | VernacFixpoint (_,l) ->
+ let ids = List.map (fun (((_, i), _), _) -> i) l in
+ let guarantee = if poly then Doesn'tGuaranteeOpacity else GuaranteesOpacity in
+ VtStartProof (default_proof_mode (),guarantee,ids), VtLater
+ | VernacFixpoint (discharge,l) ->
+ let guarantee =
+ if discharge = Decl_kinds.DoDischarge || poly then Doesn'tGuaranteeOpacity
+ else GuaranteesOpacity
+ in
let ids, open_proof =
List.fold_left (fun (l,b) ((((_,id),_),_,_,_,p),_) ->
id::l, b || p = None) ([],false) l in
if open_proof
- then VtStartProof (default_proof_mode (),GuaranteesOpacity,ids), VtLater
+ then VtStartProof (default_proof_mode (),guarantee,ids), VtLater
else VtSideff ids, VtLater
- | VernacCoFixpoint (_,l) ->
+ | VernacCoFixpoint (discharge,l) ->
+ let guarantee =
+ if discharge = Decl_kinds.DoDischarge || poly then Doesn'tGuaranteeOpacity
+ else GuaranteesOpacity
+ in
let ids, open_proof =
List.fold_left (fun (l,b) ((((_,id),_),_,_,p),_) ->
id::l, b || p = None) ([],false) l in
if open_proof
- then VtStartProof (default_proof_mode (),GuaranteesOpacity,ids), VtLater
+ then VtStartProof (default_proof_mode (),guarantee,ids), VtLater
else VtSideff ids, VtLater
(* Sideff: apply to all open branches. usually run on master only *)
| VernacAssumption (_,_,l) ->
let ids = List.flatten (List.map (fun (_,(l,_)) -> List.map (fun (id, _) -> snd id) l) l) in
VtSideff ids, VtLater
- | VernacDefinition (_,((_,id),_),DefineBody _) -> VtSideff [id], VtLater
+ | VernacDefinition (_,((_,id),_),DefineBody _) -> VtSideff (idents_of_name id), VtLater
| VernacInductive (_, _,_,l) ->
let ids = List.map (fun (((_,((_,id),_)),_,_,_,cl),_) -> id :: match cl with
| Constructors l -> List.map (fun (_,((_,id),_)) -> id) l
@@ -176,12 +167,12 @@ let rec classify_vernac e =
(* These commands alter the parser *)
| VernacOpenCloseScope _ | VernacDelimiters _ | VernacBindScope _
| VernacInfix _ | VernacNotation _ | VernacNotationAddFormat _
- | VernacSyntaxExtension _
+ | VernacSyntaxExtension _
| VernacSyntacticDefinition _
| VernacRequire _ | VernacImport _ | VernacInclude _
| VernacDeclareMLModule _
| VernacContext _ (* TASSI: unsure *)
- | VernacProofMode _
+ | VernacProofMode _ -> VtSideff [], VtNow
(* These are ambiguous *)
| VernacInstance _ -> VtUnknown, VtNow
(* Stm will install a new classifier to handle these *)
@@ -192,16 +183,33 @@ let rec classify_vernac e =
(* What are these? *)
| VernacToplevelControl _
| VernacRestoreState _
- | VernacWriteState _ -> VtUnknown, VtNow
+ | VernacWriteState _ -> VtSideff [], VtNow
(* Plugins should classify their commands *)
| VernacExtend (s,l) ->
try List.assoc s !classifiers l ()
with Not_found -> anomaly(str"No classifier for"++spc()++str (fst s)++str".")
in
- let res = static_classifier e in
- if Flags.is_universe_polymorphism () then
- make_polymorphic res
- else res
+ let rec static_control_classifier ~poly = function
+ | VernacExpr (f, e) ->
+ let poly = List.fold_left (fun poly f ->
+ match f with
+ | VernacPolymorphic b -> b
+ | (VernacProgram | VernacLocal _) -> poly
+ ) poly f in
+ static_classifier ~poly e
+ | VernacTimeout (_,e) -> static_control_classifier ~poly e
+ | VernacTime (_,(_,e)) | VernacRedirect (_, (_,e)) ->
+ static_control_classifier ~poly e
+ | VernacFail e -> (* Fail Qed or Fail Lemma must not join/fork the DAG *)
+ (match static_control_classifier ~poly e with
+ | ( VtQuery _ | VtProofStep _ | VtSideff _
+ | VtProofMode _ | VtMeta), _ as x -> x
+ | VtQed _, _ ->
+ VtProofStep { parallel = `No; proof_block_detection = None },
+ VtNow
+ | (VtStartProof _ | VtUnknown), _ -> VtUnknown, VtNow)
+ in
+ static_control_classifier ~poly:(Flags.is_universe_polymorphism ()) e
let classify_as_query = VtQuery (true,Feedback.default_route), VtLater
let classify_as_sideeff = VtSideff [], VtLater
diff --git a/stm/vernac_classifier.mli b/stm/vernac_classifier.mli
index fe42a03a3..c0571c1d6 100644
--- a/stm/vernac_classifier.mli
+++ b/stm/vernac_classifier.mli
@@ -12,7 +12,7 @@ open Genarg
val string_of_vernac_classification : vernac_classification -> string
(** What does a vernacular do *)
-val classify_vernac : vernac_expr -> vernac_classification
+val classify_vernac : vernac_control -> vernac_classification
(** Install a vernacular classifier for VernacExtend *)
val declare_vernac_classifier :
diff --git a/stm/workerLoop.ml b/stm/workerLoop.ml
index 64121eb3d..704119186 100644
--- a/stm/workerLoop.ml
+++ b/stm/workerLoop.ml
@@ -6,6 +6,10 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
+(* Default priority *)
+open CoqworkmgrApi
+let async_proofs_worker_priority = ref Low
+
let rec parse = function
| "--xml_format=Ppcmds" :: rest -> parse rest
| x :: rest -> x :: parse rest
@@ -15,5 +19,5 @@ let loop init args =
let args = parse args in
Flags.quiet := true;
init ();
- CoqworkmgrApi.init !Flags.async_proofs_worker_priority;
+ CoqworkmgrApi.init !async_proofs_worker_priority;
args
diff --git a/stm/workerLoop.mli b/stm/workerLoop.mli
index 53f745935..da2e6fe0c 100644
--- a/stm/workerLoop.mli
+++ b/stm/workerLoop.mli
@@ -6,4 +6,7 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
+(* Default priority *)
+val async_proofs_worker_priority : CoqworkmgrApi.priority ref
+
val loop : (unit -> unit) -> string list -> string list
diff --git a/tactics/auto.ml b/tactics/auto.ml
index d0424eb89..e7e21b5f4 100644
--- a/tactics/auto.ml
+++ b/tactics/auto.ml
@@ -388,7 +388,7 @@ and tac_of_hint dbg db_list local_db concl (flags, ({pat=p; code=t;poly=poly;db=
Tacticals.New.tclPROGRESS (reduce (Unfold [AllOccurrences,c]) Locusops.onConcl)
else Tacticals.New.tclFAIL 0 (str"Unbound reference")
end
- | Extern tacast ->
+ | Extern tacast ->
conclPattern concl p tacast
in
let pr_hint () =
@@ -396,7 +396,8 @@ and tac_of_hint dbg db_list local_db concl (flags, ({pat=p; code=t;poly=poly;db=
| None -> mt ()
| Some n -> str " (in " ++ str n ++ str ")"
in
- pr_hint t ++ origin
+ let sigma, env = Pfedit.get_current_context () in
+ pr_hint env sigma t ++ origin
in
tclLOG dbg pr_hint (run_hint t tactic)
@@ -513,8 +514,8 @@ let delta_auto debug mod_delta n lems dbnames =
let delta_auto =
if Flags.profile then
- let key = Profile.declare_profile "delta_auto" in
- Profile.profile5 key delta_auto
+ let key = CProfile.declare_profile "delta_auto" in
+ CProfile.profile5 key delta_auto
else delta_auto
let auto ?(debug=Off) n = delta_auto debug false n
diff --git a/tactics/autorewrite.ml b/tactics/autorewrite.ml
index ed612c0fc..de98f6382 100644
--- a/tactics/autorewrite.ml
+++ b/tactics/autorewrite.ml
@@ -9,7 +9,7 @@
open Equality
open Names
open Pp
-open Term
+open Constr
open Termops
open CErrors
open Util
@@ -20,7 +20,7 @@ open Locus
type rew_rule = { rew_lemma: constr;
rew_type: types;
rew_pat: constr;
- rew_ctx: Univ.universe_context_set;
+ rew_ctx: Univ.ContextSet.t;
rew_l2r: bool;
rew_tac: Genarg.glob_generic_argument option }
@@ -73,12 +73,12 @@ let find_matches bas pat =
let res = HintDN.search_pattern base pat in
List.map snd res
-let print_rewrite_hintdb bas =
+let print_rewrite_hintdb env sigma bas =
(str "Database " ++ str bas ++ fnl () ++
prlist_with_sep fnl
(fun h ->
str (if h.rew_l2r then "rewrite -> " else "rewrite <- ") ++
- Printer.pr_lconstr h.rew_lemma ++ str " of type " ++ Printer.pr_lconstr h.rew_type ++
+ Printer.pr_lconstr_env env sigma h.rew_lemma ++ str " of type " ++ Printer.pr_lconstr_env env sigma h.rew_type ++
Option.cata (fun tac -> str " then use tactic " ++
Pputils.pr_glb_generic (Global.env()) tac) (mt ()) h.rew_tac)
(find_rewrites bas))
diff --git a/tactics/autorewrite.mli b/tactics/autorewrite.mli
index edbb7c6b7..44acf3c01 100644
--- a/tactics/autorewrite.mli
+++ b/tactics/autorewrite.mli
@@ -8,7 +8,7 @@
(** This files implements the autorewrite tactic. *)
-open Term
+open Constr
open Equality
(** Rewriting rules before tactic interpretation *)
@@ -28,7 +28,7 @@ val autorewrite_in : ?conds:conditions -> Names.Id.t -> unit Proofview.tactic ->
type rew_rule = { rew_lemma: constr;
rew_type: types;
rew_pat: constr;
- rew_ctx: Univ.universe_context_set;
+ rew_ctx: Univ.ContextSet.t;
rew_l2r: bool;
rew_tac: Genarg.glob_generic_argument option }
@@ -40,7 +40,7 @@ val auto_multi_rewrite : ?conds:conditions -> string list -> Locus.clause -> uni
val auto_multi_rewrite_with : ?conds:conditions -> unit Proofview.tactic -> string list -> Locus.clause -> unit Proofview.tactic
-val print_rewrite_hintdb : string -> Pp.t
+val print_rewrite_hintdb : Environ.env -> Evd.evar_map -> string -> Pp.t
open Clenv
@@ -58,5 +58,5 @@ type hypinfo = {
val find_applied_relation :
?loc:Loc.t -> bool ->
- Environ.env -> Evd.evar_map -> Term.constr -> bool -> hypinfo
+ Environ.env -> Evd.evar_map -> constr -> bool -> hypinfo
diff --git a/tactics/class_tactics.ml b/tactics/class_tactics.ml
index b98b10315..cfadfc535 100644
--- a/tactics/class_tactics.ml
+++ b/tactics/class_tactics.ml
@@ -376,7 +376,7 @@ let rec e_trivial_fail_db only_classes db_list local_db secvars =
Proofview.Goal.enter
begin fun gl ->
let tacs = e_trivial_resolve db_list local_db secvars only_classes
- (project gl) (pf_concl gl) in
+ (pf_env gl) (project gl) (pf_concl gl) in
tclFIRST (List.map (fun (x,_,_,_,_) -> x) tacs)
end
in
@@ -386,7 +386,7 @@ let rec e_trivial_fail_db only_classes db_list local_db secvars =
in
tclFIRST (List.map tclCOMPLETE tacl)
-and e_my_find_search db_list local_db secvars hdc complete only_classes sigma concl =
+and e_my_find_search db_list local_db secvars hdc complete only_classes env sigma concl =
let open Proofview.Notations in
let prods, concl = EConstr.decompose_prod_assum sigma concl in
let nprods = List.length prods in
@@ -467,24 +467,24 @@ and e_my_find_search db_list local_db secvars hdc complete only_classes sigma co
let pp =
match p with
| Some pat when get_typeclasses_filtered_unification () ->
- str " with pattern " ++ Printer.pr_constr_pattern pat
+ str " with pattern " ++ Printer.pr_constr_pattern_env env sigma pat
| _ -> mt ()
in
match repr_hint t with
- | Extern _ -> (tac, b, true, name, lazy (pr_hint t ++ pp))
- | _ -> (tac, b, false, name, lazy (pr_hint t ++ pp))
+ | Extern _ -> (tac, b, true, name, lazy (pr_hint env sigma t ++ pp))
+ | _ -> (tac, b, false, name, lazy (pr_hint env sigma t ++ pp))
in List.map tac_of_hint hintl
-and e_trivial_resolve db_list local_db secvars only_classes sigma concl =
+and e_trivial_resolve db_list local_db secvars only_classes env sigma concl =
let hd = try Some (decompose_app_bound sigma concl) with Bound -> None in
try
- e_my_find_search db_list local_db secvars hd true only_classes sigma concl
+ e_my_find_search db_list local_db secvars hd true only_classes env sigma concl
with Not_found -> []
-let e_possible_resolve db_list local_db secvars only_classes sigma concl =
+let e_possible_resolve db_list local_db secvars only_classes env sigma concl =
let hd = try Some (decompose_app_bound sigma concl) with Bound -> None in
try
- e_my_find_search db_list local_db secvars hd false only_classes sigma concl
+ e_my_find_search db_list local_db secvars hd false only_classes env sigma concl
with Not_found -> []
let cut_of_hints h =
@@ -718,7 +718,7 @@ module V85 = struct
let concl = Goal.V82.concl s gl in
let tacgl = {it = gl; sigma = s;} in
let secvars = secvars_of_hyps (Environ.named_context_of_val (Goal.V82.hyps s gl)) in
- let poss = e_possible_resolve hints info.hints secvars info.only_classes s concl in
+ let poss = e_possible_resolve hints info.hints secvars info.only_classes env s concl in
let unique = is_unique env s concl in
let rec aux i foundone = function
| (tac, _, extern, name, pp) :: tl ->
@@ -1071,7 +1071,7 @@ module Search = struct
else str" without backtracking"));
let secvars = compute_secvars gl in
let poss =
- e_possible_resolve hints info.search_hints secvars info.search_only_classes sigma concl in
+ e_possible_resolve hints info.search_hints secvars info.search_only_classes env sigma concl in
(* If no goal depends on the solution of this one or the
instances are irrelevant/assumed to be unique, then
we don't need to backtrack, as long as no evar appears in the goal
@@ -1569,7 +1569,7 @@ let _ =
Hook.set Typeclasses.solve_all_instances_hook solve_inst
let resolve_one_typeclass env ?(sigma=Evd.empty) gl unique =
- let nc, gl, subst, _, _ = Evarutil.push_rel_context_to_named_context env sigma gl in
+ let nc, gl, subst, _ = Evarutil.push_rel_context_to_named_context env sigma gl in
let (gl,t,sigma) =
Goal.V82.mk_goal sigma nc gl Store.empty in
let (ev, _) = destEvar sigma t in
diff --git a/tactics/eauto.ml b/tactics/eauto.ml
index 9097aebd0..6ea6155e0 100644
--- a/tactics/eauto.ml
+++ b/tactics/eauto.ml
@@ -10,13 +10,13 @@ open Pp
open CErrors
open Util
open Names
-open Nameops
open Term
open Termops
open EConstr
open Proof_type
open Tacticals
open Tacmach
+open Evd
open Tactics
open Clenv
open Auto
@@ -148,12 +148,12 @@ let rec e_trivial_fail_db db_list local_db =
let tacl =
registered_e_assumption ::
(Tacticals.New.tclTHEN Tactics.intro next) ::
- (List.map fst (e_trivial_resolve (Tacmach.New.project gl) db_list local_db secvars (Tacmach.New.pf_concl gl)))
+ (List.map fst (e_trivial_resolve (Tacmach.New.pf_env gl) (Tacmach.New.project gl) db_list local_db secvars (Tacmach.New.pf_concl gl)))
in
Tacticals.New.tclFIRST (List.map Tacticals.New.tclCOMPLETE tacl)
end
-and e_my_find_search sigma db_list local_db secvars hdc concl =
+and e_my_find_search env sigma db_list local_db secvars hdc concl =
let hint_of_db = hintmap_of sigma secvars hdc concl in
let hintl =
List.map_append (fun db ->
@@ -178,19 +178,19 @@ and e_my_find_search sigma db_list local_db secvars hdc concl =
| Extern tacast -> conclPattern concl p tacast
in
let tac = run_hint t tac in
- (tac, lazy (pr_hint t)))
+ (tac, lazy (pr_hint env sigma t)))
in
List.map tac_of_hint hintl
-and e_trivial_resolve sigma db_list local_db secvars gl =
+and e_trivial_resolve env sigma db_list local_db secvars gl =
let hd = try Some (decompose_app_bound sigma gl) with Bound -> None in
- try priority (e_my_find_search sigma db_list local_db secvars hd gl)
+ try priority (e_my_find_search env sigma db_list local_db secvars hd gl)
with Not_found -> []
-let e_possible_resolve sigma db_list local_db secvars gl =
+let e_possible_resolve env sigma db_list local_db secvars gl =
let hd = try Some (decompose_app_bound sigma gl) with Bound -> None in
try List.map (fun (b, (tac, pp)) -> (tac, b, pp))
- (e_my_find_search sigma db_list local_db secvars hd gl)
+ (e_my_find_search env sigma db_list local_db secvars hd gl)
with Not_found -> []
let find_first_goal gls =
@@ -261,7 +261,7 @@ module SearchProblem = struct
let g = find_first_goal lg in
let hyps = pf_ids_of_hyps g in
let secvars = secvars_of_hyps (pf_hyps g) in
- let map_assum id = (e_give_exact (mkVar id), (-1), lazy (str "exact" ++ spc () ++ pr_id id)) in
+ let map_assum id = (e_give_exact (mkVar id), (-1), lazy (str "exact" ++ spc () ++ Id.print id)) in
let assumption_tacs =
let tacs = List.map map_assum hyps in
let l = filter_tactics s.tacres tacs in
@@ -290,7 +290,7 @@ module SearchProblem = struct
let l =
let concl = Reductionops.nf_evar (project g) (pf_concl g) in
filter_tactics s.tacres
- (e_possible_resolve (project g) s.dblist (List.hd s.localdb) secvars concl)
+ (e_possible_resolve (pf_env g) (project g) s.dblist (List.hd s.localdb) secvars concl)
in
List.map
(fun (lgls, cost, pp) ->
@@ -404,8 +404,8 @@ let e_search_auto debug (in_depth,p) lems db_list gl =
pr_info_nop d;
user_err Pp.(str "eauto: search failed")
-(* let e_search_auto_key = Profile.declare_profile "e_search_auto" *)
-(* let e_search_auto = Profile.profile5 e_search_auto_key e_search_auto *)
+(* let e_search_auto_key = CProfile.declare_profile "e_search_auto" *)
+(* let e_search_auto = CProfile.profile5 e_search_auto_key e_search_auto *)
let eauto_with_bases ?(debug=Off) np lems db_list =
tclTRY (e_search_auto debug np lems db_list)
diff --git a/tactics/elimschemes.ml b/tactics/elimschemes.ml
index 2d2a0c1b2..e427adb15 100644
--- a/tactics/elimschemes.ml
+++ b/tactics/elimschemes.ml
@@ -13,7 +13,8 @@
(* This file builds schemes related to case analysis and recursion schemes *)
-open Term
+open Sorts
+open Constr
open Indrec
open Declarations
open Typeops
diff --git a/tactics/elimschemes.mli b/tactics/elimschemes.mli
index e3fe7ddae..50b052f23 100644
--- a/tactics/elimschemes.mli
+++ b/tactics/elimschemes.mli
@@ -13,10 +13,10 @@ open Ind_tables
val optimize_non_type_induction_scheme :
'a Ind_tables.scheme_kind ->
Indrec.dep_flag ->
- Term.sorts_family ->
+ Sorts.family ->
'b ->
Names.inductive ->
- (Constr.constr * Evd.evar_universe_context) * Safe_typing.private_constants
+ (Constr.constr * UState.t) * Safe_typing.private_constants
val rect_scheme_kind_from_prop : individual scheme_kind
val ind_scheme_kind_from_prop : individual scheme_kind
diff --git a/tactics/eqschemes.ml b/tactics/eqschemes.ml
index bfbac7787..d7667668e 100644
--- a/tactics/eqschemes.ml
+++ b/tactics/eqschemes.ml
@@ -48,6 +48,7 @@ open CErrors
open Util
open Names
open Term
+open Constr
open Vars
open Declarations
open Environ
@@ -106,8 +107,8 @@ let get_coq_eq ctx =
let univ_of_eq env eq =
let eq = EConstr.of_constr eq in
- match kind_of_term (EConstr.Unsafe.to_constr (Retyping.get_type_of env Evd.empty eq)) with
- | Prod (_,t,_) -> (match kind_of_term t with Sort (Type u) -> u | _ -> assert false)
+ match Constr.kind (EConstr.Unsafe.to_constr (Retyping.get_type_of env Evd.empty eq)) with
+ | Prod (_,t,_) -> (match Constr.kind t with Sort (Type u) -> u | _ -> assert false)
| _ -> assert false
(**********************************************************************)
@@ -141,7 +142,7 @@ let get_sym_eq_data env (ind,u) =
let paramsctxt = Vars.subst_instance_context u mib.mind_params_ctxt in
let paramsctxt1,_ =
List.chop (mib.mind_nparams-mip.mind_nrealargs) paramsctxt in
- if not (List.equal Term.eq_constr params2 constrargs) then
+ if not (List.equal Constr.equal params2 constrargs) then
error "Constructors arguments must repeat the parameters.";
(* nrealargs_ctxt and nrealargs are the same here *)
(specif,mip.mind_nrealargs,realsign,paramsctxt,paramsctxt1)
diff --git a/tactics/eqschemes.mli b/tactics/eqschemes.mli
index 4acfa7a28..90ae67c6c 100644
--- a/tactics/eqschemes.mli
+++ b/tactics/eqschemes.mli
@@ -9,7 +9,7 @@
(** This file builds schemes relative to equality inductive types *)
open Names
-open Term
+open Constr
open Environ
open Ind_tables
@@ -22,14 +22,14 @@ val rew_l2r_forward_dep_scheme_kind : individual scheme_kind
val rew_r2l_dep_scheme_kind : individual scheme_kind
val rew_r2l_scheme_kind : individual scheme_kind
-val build_r2l_rew_scheme : bool -> env -> inductive -> sorts_family ->
+val build_r2l_rew_scheme : bool -> env -> inductive -> Sorts.family ->
constr Evd.in_evar_universe_context
-val build_l2r_rew_scheme : bool -> env -> inductive -> sorts_family ->
+val build_l2r_rew_scheme : bool -> env -> inductive -> Sorts.family ->
constr Evd.in_evar_universe_context * Safe_typing.private_constants
val build_r2l_forward_rew_scheme :
- bool -> env -> inductive -> sorts_family -> constr Evd.in_evar_universe_context
+ bool -> env -> inductive -> Sorts.family -> constr Evd.in_evar_universe_context
val build_l2r_forward_rew_scheme :
- bool -> env -> inductive -> sorts_family -> constr Evd.in_evar_universe_context
+ bool -> env -> inductive -> Sorts.family -> constr Evd.in_evar_universe_context
(** Builds a symmetry scheme for a symmetrical equality type *)
@@ -43,5 +43,5 @@ val sym_involutive_scheme_kind : individual scheme_kind
(** Builds a congruence scheme for an equality type *)
val congr_scheme_kind : individual scheme_kind
-val build_congr : env -> constr * constr * Univ.universe_context_set -> inductive ->
+val build_congr : env -> constr * constr * Univ.ContextSet.t -> inductive ->
constr Evd.in_evar_universe_context
diff --git a/tactics/equality.ml b/tactics/equality.ml
index 7c03a3ba6..450d68436 100644
--- a/tactics/equality.ml
+++ b/tactics/equality.ml
@@ -374,16 +374,16 @@ let find_elim hdcncl lft2rgt dep cls ot =
| Some true, None
| Some false, Some _ ->
let c1 = destConstRef pr1 in
- let mp,dp,l = repr_con (constant_of_kn (canonical_con c1)) in
+ let mp,dp,l = Constant.repr3 (Constant.make1 (Constant.canonical c1)) in
let l' = Label.of_id (add_suffix (Label.to_id l) "_r") in
- let c1' = Global.constant_of_delta_kn (make_kn mp dp l') in
+ let c1' = Global.constant_of_delta_kn (KerName.make mp dp l') in
begin
try
let _ = Global.lookup_constant c1' in
c1'
with Not_found ->
user_err ~hdr:"Equality.find_elim"
- (str "Cannot find rewrite principle " ++ pr_label l' ++ str ".")
+ (str "Cannot find rewrite principle " ++ Label.print l' ++ str ".")
end
| _ -> destConstRef pr1
end
@@ -739,7 +739,7 @@ let keep_proof_equalities = function
let find_positions env sigma ~keep_proofs ~no_discr t1 t2 =
let project env sorts posn t1 t2 =
let ty1 = get_type_of env sigma t1 in
- let s = get_sort_family_of env sigma ty1 in
+ let s = get_sort_family_of ~truncation_style:true env sigma ty1 in
if Sorts.List.mem s sorts
then [(List.rev posn,t1,t2)] else []
in
@@ -1436,8 +1436,9 @@ let injEqThen keep_proofs tac l2r (eq,_,(t,t1,t2) as u) eq_clause =
(tac (clenv_value eq_clause))
let get_previous_hyp_position id gl =
+ let env, sigma = Proofview.Goal.(env gl, sigma gl) in
let rec aux dest = function
- | [] -> raise (RefinerError (NoSuchHyp id))
+ | [] -> raise (RefinerError (env, sigma, NoSuchHyp id))
| d :: right ->
let hyp = Context.Named.Declaration.get_id d in
if Id.equal hyp id then dest else aux (MoveAfter hyp) right
@@ -1582,7 +1583,7 @@ let subst_tuple_term env sigma dep_pair1 dep_pair2 b =
let body = mkApp (lambda_create env sigma (typ,pred_body),[|dep_pair1|]) in
let expected_goal = beta_applist sigma (abst_B,List.map fst e2_list) in
(* Simulate now the normalisation treatment made by Logic.mk_refgoals *)
- let expected_goal = nf_betaiota sigma expected_goal in
+ let expected_goal = nf_betaiota env sigma expected_goal in
(* Retype to get universes right *)
let sigma, expected_goal_ty = Typing.type_of env sigma expected_goal in
let sigma, _ = Typing.type_of env sigma body in
@@ -1760,7 +1761,7 @@ let subst_one_var dep_proof_ok x =
let test hyp _ = is_eq_x gl x hyp in
Context.Named.fold_outside test ~init:() hyps;
user_err ~hdr:"Subst"
- (str "Cannot find any non-recursive equality over " ++ pr_id x ++
+ (str "Cannot find any non-recursive equality over " ++ Id.print x ++
str".")
with FoundHyp res -> res in
subst_one dep_proof_ok x res
@@ -1824,9 +1825,9 @@ let subst_all ?(flags=default_subst_tactic_flags) () =
(* J.F.: added to prevent failure on goal containing x=x as an hyp *)
if EConstr.eq_constr sigma x y then Proofview.tclUNIT () else
match EConstr.kind sigma x, EConstr.kind sigma y with
- | Var x', _ when not (occur_term sigma x y) && not (is_evaluable env (EvalVarRef x')) ->
+ | Var x', _ when not (dependent sigma x y) && not (is_evaluable env (EvalVarRef x')) ->
subst_one flags.rewrite_dependent_proof x' (hyp,y,true)
- | _, Var y' when not (occur_term sigma y x) && not (is_evaluable env (EvalVarRef y')) ->
+ | _, Var y' when not (dependent sigma y x) && not (is_evaluable env (EvalVarRef y')) ->
subst_one flags.rewrite_dependent_proof y' (hyp,x,false)
| _ ->
Proofview.tclUNIT ()
diff --git a/tactics/hints.ml b/tactics/hints.ml
index 3ccbab874..7f9b5ef34 100644
--- a/tactics/hints.ml
+++ b/tactics/hints.ml
@@ -128,14 +128,14 @@ type hints_path = global_reference hints_path_gen
type hint_term =
| IsGlobRef of global_reference
- | IsConstr of constr * Univ.universe_context_set
+ | IsConstr of constr * Univ.ContextSet.t
type 'a with_uid = {
obj : 'a;
uid : KerName.t;
}
-type raw_hint = constr * types * Univ.universe_context_set
+type raw_hint = constr * types * Univ.ContextSet.t
type hint = (raw_hint * clausenv) hint_ast with_uid
@@ -1392,39 +1392,34 @@ let make_db_list dbnames =
(* Functions for printing the hints *)
(**************************************************************************)
-let pr_hint_elt (c, _, _) = pr_econstr c
+let pr_hint_elt env sigma (c, _, _) = pr_econstr_env env sigma c
-let pr_hint h = match h.obj with
- | Res_pf (c, _) -> (str"simple apply " ++ pr_hint_elt c)
- | ERes_pf (c, _) -> (str"simple eapply " ++ pr_hint_elt c)
- | Give_exact (c, _) -> (str"exact " ++ pr_hint_elt c)
+let pr_hint env sigma h = match h.obj with
+ | Res_pf (c, _) -> (str"simple apply " ++ pr_hint_elt env sigma c)
+ | ERes_pf (c, _) -> (str"simple eapply " ++ pr_hint_elt env sigma c)
+ | Give_exact (c, _) -> (str"exact " ++ pr_hint_elt env sigma c)
| Res_pf_THEN_trivial_fail (c, _) ->
- (str"simple apply " ++ pr_hint_elt c ++ str" ; trivial")
- | Unfold_nth c -> (str"unfold " ++ pr_evaluable_reference c)
+ (str"simple apply " ++ pr_hint_elt env sigma c ++ str" ; trivial")
+ | Unfold_nth c ->
+ str"unfold " ++ pr_evaluable_reference c
| Extern tac ->
- let env =
- try
- let (_, env) = Pfedit.get_current_goal_context () in
- env
- with e when CErrors.noncritical e -> Global.env ()
- in
- (str "(*external*) " ++ Pputils.pr_glb_generic env tac)
+ str "(*external*) " ++ Pputils.pr_glb_generic env tac
-let pr_id_hint (id, v) =
- let pr_pat p = str", pattern " ++ pr_lconstr_pattern p in
- (pr_hint v.code ++ str"(level " ++ int v.pri ++ pr_opt_no_spc pr_pat v.pat
+let pr_id_hint env sigma (id, v) =
+ let pr_pat p = str", pattern " ++ pr_lconstr_pattern_env env sigma p in
+ (pr_hint env sigma v.code ++ str"(level " ++ int v.pri ++ pr_opt_no_spc pr_pat v.pat
++ str", id " ++ int id ++ str ")" ++ spc ())
-let pr_hint_list hintlist =
- (str " " ++ hov 0 (prlist pr_id_hint hintlist) ++ fnl ())
+let pr_hint_list env sigma hintlist =
+ (str " " ++ hov 0 (prlist (pr_id_hint env sigma) hintlist) ++ fnl ())
-let pr_hints_db (name,db,hintlist) =
+let pr_hints_db env sigma (name,db,hintlist) =
(str "In the database " ++ str name ++ str ":" ++
if List.is_empty hintlist then (str " nothing" ++ fnl ())
- else (fnl () ++ pr_hint_list hintlist))
+ else (fnl () ++ pr_hint_list env sigma hintlist))
(* Print all hints associated to head c in any database *)
-let pr_hint_list_for_head c =
+let pr_hint_list_for_head env sigma c =
let dbs = current_db () in
let validate (name, db) =
let hints = List.map (fun v -> 0, v) (Hint_db.map_all ~secvars:Id.Pred.full c db) in
@@ -1436,13 +1431,13 @@ let pr_hint_list_for_head c =
else
hov 0
(str"For " ++ pr_global c ++ str" -> " ++ fnl () ++
- hov 0 (prlist pr_hints_db valid_dbs))
+ hov 0 (prlist (pr_hints_db env sigma) valid_dbs))
let pr_hint_ref ref = pr_hint_list_for_head ref
(* Print all hints associated to head id in any database *)
-let pr_hint_term sigma cl =
+let pr_hint_term env sigma cl =
try
let dbs = current_db () in
let valid_dbs =
@@ -1460,18 +1455,19 @@ let pr_hint_term sigma cl =
(str "No hint applicable for current goal")
else
(str "Applicable Hints :" ++ fnl () ++
- hov 0 (prlist pr_hints_db valid_dbs))
+ hov 0 (prlist (pr_hints_db env sigma) valid_dbs))
with Match_failure _ | Failure _ ->
(str "No hint applicable for current goal")
(* print all hints that apply to the concl of the current goal *)
let pr_applicable_hint () =
+ let env = Global.env () in
let pts = Proof_global.give_me_the_proof () in
- let glss = Proof.V82.subgoals pts in
- match glss.Evd.it with
+ let glss,_,_,_,sigma = Proof.proof pts in
+ match glss with
| [] -> CErrors.user_err Pp.(str "No focused goal.")
| g::_ ->
- pr_hint_term glss.Evd.sigma (Goal.V82.concl glss.Evd.sigma g)
+ pr_hint_term env sigma (Goal.V82.concl sigma g)
let pp_hint_mode = function
| ModeInput -> str"+"
@@ -1479,9 +1475,9 @@ let pp_hint_mode = function
| ModeOutput -> str"-"
(* displays the whole hint database db *)
-let pr_hint_db db =
+let pr_hint_db_env env sigma db =
let pr_mode = prvect_with_sep spc pp_hint_mode in
- let pr_modes l =
+ let pr_modes l =
if List.is_empty l then mt ()
else str" (modes " ++ prlist_with_sep pr_comma pr_mode l ++ str")"
in
@@ -1491,7 +1487,7 @@ let pr_hint_db db =
| None -> str "For any goal"
| Some head -> str "For " ++ pr_global head ++ pr_modes modes
in
- let hints = pr_hint_list (List.map (fun x -> (0, x)) hintlist) in
+ let hints = pr_hint_list env sigma (List.map (fun x -> (0, x)) hintlist) in
let hint_descr = hov 0 (goal_descr ++ str " -> " ++ hints) in
accu ++ hint_descr
in
@@ -1506,17 +1502,22 @@ let pr_hint_db db =
hov 2 (str"Cut: " ++ pp_hints_path (Hint_db.cut db)) ++ fnl () ++
content
-let pr_hint_db_by_name dbname =
+(* Deprecated in the mli *)
+let pr_hint_db db =
+ let sigma, env = Pfedit.get_current_context () in
+ pr_hint_db_env env sigma db
+
+let pr_hint_db_by_name env sigma dbname =
try
- let db = searchtable_map dbname in pr_hint_db db
+ let db = searchtable_map dbname in pr_hint_db_env env sigma db
with Not_found ->
error_no_such_hint_database dbname
(* displays all the hints of all databases *)
-let pr_searchtable () =
+let pr_searchtable env sigma =
let fold name db accu =
accu ++ str "In the database " ++ str name ++ str ":" ++ fnl () ++
- pr_hint_db db ++ fnl ()
+ pr_hint_db_env env sigma db ++ fnl ()
in
Hintdbmap.fold fold !searchtable (mt ())
@@ -1534,10 +1535,13 @@ let warn_non_imported_hint =
strbrk "Hint used but not imported: " ++ hint ++ print_mp mp)
let warn h x =
- let hint = pr_hint h in
- let (mp, _, _) = KerName.repr h.uid in
- warn_non_imported_hint (hint,mp);
- Proofview.tclUNIT x
+ let open Proofview in
+ tclBIND tclENV (fun env ->
+ tclBIND tclEVARMAP (fun sigma ->
+ let hint = pr_hint env sigma h in
+ let (mp, _, _) = KerName.repr h.uid in
+ warn_non_imported_hint (hint,mp);
+ Proofview.tclUNIT x))
let run_hint tac k = match !warn_hint with
| `LAX -> k tac.obj
diff --git a/tactics/hints.mli b/tactics/hints.mli
index 44e5370e9..cbf204981 100644
--- a/tactics/hints.mli
+++ b/tactics/hints.mli
@@ -42,7 +42,7 @@ type 'a hint_ast =
| Extern of Genarg.glob_generic_argument (* Hint Extern *)
type hint
-type raw_hint = constr * types * Univ.universe_context_set
+type raw_hint = constr * types * Univ.ContextSet.t
type 'a hints_path_atom_gen =
| PathHints of 'a list
@@ -146,7 +146,7 @@ type hint_info = (patvar list * constr_pattern) hint_info_gen
type hint_term =
| IsGlobRef of global_reference
- | IsConstr of constr * Univ.universe_context_set
+ | IsConstr of constr * Univ.ContextSet.t
type hints_entry =
| HintsResolveEntry of
@@ -193,7 +193,7 @@ val prepare_hint : bool (* Check no remaining evars *) ->
*)
val make_exact_entry : env -> evar_map -> hint_info -> polymorphic -> ?name:hints_path_atom ->
- (constr * types * Univ.universe_context_set) -> hint_entry
+ (constr * types * Univ.ContextSet.t) -> hint_entry
(** [make_apply_entry (eapply,hnf,verbose) info (c,cty,ctx))].
[eapply] is true if this hint will be used only with EApply;
@@ -211,7 +211,7 @@ val make_exact_entry : env -> evar_map -> hint_info -> polymorphic -> ?name:hint
val make_apply_entry :
env -> evar_map -> bool * bool * bool -> hint_info -> polymorphic -> ?name:hints_path_atom ->
- (constr * types * Univ.universe_context_set) -> hint_entry
+ (constr * types * Univ.ContextSet.t) -> hint_entry
(** A constr which is Hint'ed will be:
- (1) used as an Exact, if it does not start with a product
@@ -260,14 +260,15 @@ val rewrite_db : hint_db_name
(** Printing hints *)
-val pr_searchtable : unit -> Pp.t
+val pr_searchtable : env -> evar_map -> Pp.t
val pr_applicable_hint : unit -> Pp.t
-val pr_hint_ref : global_reference -> Pp.t
-val pr_hint_db_by_name : hint_db_name -> Pp.t
+val pr_hint_ref : env -> evar_map -> global_reference -> Pp.t
+val pr_hint_db_by_name : env -> evar_map -> hint_db_name -> Pp.t
+val pr_hint_db_env : env -> evar_map -> Hint_db.t -> Pp.t
val pr_hint_db : Hint_db.t -> Pp.t
-val pr_hint : hint -> Pp.t
+[@@ocaml.deprecated "please used pr_hint_db_env"]
+val pr_hint : env -> evar_map -> hint -> Pp.t
(** Hook for changing the initialization of auto *)
-
val add_hints_init : (unit -> unit) -> unit
diff --git a/tactics/hipattern.ml b/tactics/hipattern.ml
index 75fae6647..2bb9be66b 100644
--- a/tactics/hipattern.ml
+++ b/tactics/hipattern.ml
@@ -39,7 +39,6 @@ type testing_function = Evd.evar_map -> EConstr.constr -> bool
let mkmeta n = Nameops.make_ident "X" (Some n)
let meta1 = mkmeta 1
let meta2 = mkmeta 2
-let meta3 = mkmeta 3
let op2bool = function Some _ -> true | None -> false
@@ -49,7 +48,7 @@ let match_with_non_recursive_type sigma t =
let (hdapp,args) = decompose_app sigma t in
(match EConstr.kind sigma hdapp with
| Ind (ind,u) ->
- if (Global.lookup_mind (fst ind)).mind_finite == Decl_kinds.CoFinite then
+ if (Global.lookup_mind (fst ind)).mind_finite == CoFinite then
Some (hdapp,args)
else
None
@@ -89,6 +88,12 @@ let is_lax_conjunction = function
let prod_assum sigma t = fst (decompose_prod_assum sigma t)
+(* whd_beta normalize the types of arguments in a product *)
+let rec whd_beta_prod sigma c = match EConstr.kind sigma c with
+ | Prod (n,t,c) -> mkProd (n,Reductionops.whd_beta sigma t,whd_beta_prod sigma c)
+ | LetIn (n,d,t,c) -> mkLetIn (n,d,t,whd_beta_prod sigma c)
+ | _ -> c
+
let match_with_one_constructor sigma style onlybinary allow_rec t =
let (hdapp,args) = decompose_app sigma t in
let res = match EConstr.kind sigma hdapp with
@@ -112,7 +117,9 @@ let match_with_one_constructor sigma style onlybinary allow_rec t =
Some (hdapp,args)
else None
else
- let ctyp = Termops.prod_applist sigma (EConstr.of_constr mip.mind_nf_lc.(0)) args in
+ let ctyp = whd_beta_prod sigma
+ (Termops.prod_applist_assum sigma (Context.Rel.length mib.mind_params_ctxt)
+ (EConstr.of_constr mip.mind_nf_lc.(0)) args) in
let cargs = List.map RelDecl.get_type (prod_assum sigma ctyp) in
if not (is_lax_conjunction style) || has_nodep_prod sigma ctyp then
(* Record or non strict conjunction *)
@@ -160,7 +167,7 @@ let test_strict_disjunction n lc =
let open Term in
Array.for_all_i (fun i c ->
match (prod_assum (snd (decompose_prod_n_assum n c))) with
- | [LocalAssum (_,c)] -> isRel c && Int.equal (destRel c) (n - i)
+ | [LocalAssum (_,c)] -> Constr.isRel c && Int.equal (Constr.destRel c) (n - i)
| _ -> false) 0 lc
let match_with_disjunction ?(strict=false) ?(onlybinary=false) sigma t =
@@ -365,36 +372,39 @@ let is_forall_term sigma c = op2bool (match_with_forall_term sigma c)
let match_with_nodep_ind sigma t =
let (hdapp,args) = decompose_app sigma t in
- match EConstr.kind sigma hdapp with
- | Ind (ind, _) ->
- let (mib,mip) = Global.lookup_inductive ind in
- if Array.length (mib.mind_packets)>1 then None else
- let nodep_constr c = has_nodep_prod_after mib.mind_nparams sigma (EConstr.of_constr c) in
- if Array.for_all nodep_constr mip.mind_nf_lc then
- let params=
- if Int.equal mip.mind_nrealargs 0 then args else
- fst (List.chop mib.mind_nparams args) in
- Some (hdapp,params,mip.mind_nrealargs)
- else
- None
- | _ -> None
+ match EConstr.kind sigma hdapp with
+ | Ind (ind, _) ->
+ let (mib,mip) = Global.lookup_inductive ind in
+ if Array.length (mib.mind_packets)>1 then None else
+ let nodep_constr c =
+ has_nodep_prod_after (Context.Rel.length mib.mind_params_ctxt) sigma (EConstr.of_constr c) in
+ if Array.for_all nodep_constr mip.mind_nf_lc then
+ let params=
+ if Int.equal mip.mind_nrealargs 0 then args else
+ fst (List.chop mib.mind_nparams args) in
+ Some (hdapp,params,mip.mind_nrealargs)
+ else
+ None
+ | _ -> None
let is_nodep_ind sigma t = op2bool (match_with_nodep_ind sigma t)
let match_with_sigma_type sigma t =
let (hdapp,args) = decompose_app sigma t in
match EConstr.kind sigma hdapp with
- | Ind (ind, _) ->
- let (mib,mip) = Global.lookup_inductive ind in
- if Int.equal (Array.length (mib.mind_packets)) 1 &&
- (Int.equal mip.mind_nrealargs 0) &&
- (Int.equal (Array.length mip.mind_consnames)1) &&
- has_nodep_prod_after (mib.mind_nparams+1) sigma (EConstr.of_constr mip.mind_nf_lc.(0)) then
- (*allowing only 1 existential*)
- Some (hdapp,args)
- else
- None
- | _ -> None
+ | Ind (ind, _) ->
+ let (mib,mip) = Global.lookup_inductive ind in
+ if Int.equal (Array.length (mib.mind_packets)) 1
+ && (Int.equal mip.mind_nrealargs 0)
+ && (Int.equal (Array.length mip.mind_consnames)1)
+ && has_nodep_prod_after (Context.Rel.length mib.mind_params_ctxt + 1) sigma
+ (EConstr.of_constr mip.mind_nf_lc.(0))
+ then
+ (*allowing only 1 existential*)
+ Some (hdapp,args)
+ else
+ None
+ | _ -> None
let is_sigma_type sigma t = op2bool (match_with_sigma_type sigma t)
@@ -460,22 +470,6 @@ let find_this_eq_data_decompose gl eqn =
user_err Pp.(str "Don't know what to do with JMeq on arguments not of same type.") in
(lbeq,u,eq_args)
-let match_eq_nf gls eqn (ref, hetero) =
- let n = if hetero then 4 else 3 in
- let args = List.init n (fun i -> mkGPatVar ("X" ^ string_of_int (i + 1))) in
- let pat = mkPattern (mkGAppRef ref args) in
- match Id.Map.bindings (pf_matches gls pat eqn) with
- | [(m1,t);(m2,x);(m3,y)] ->
- assert (Id.equal m1 meta1 && Id.equal m2 meta2 && Id.equal m3 meta3);
- (t,pf_whd_all gls x,pf_whd_all gls y)
- | _ -> anomaly ~label:"match_eq" (Pp.str "an eq pattern should match 3 terms.")
-
-let dest_nf_eq gls eqn =
- try
- snd (first_match (match_eq_nf gls eqn) equalities)
- with PatternMatchingFailure ->
- user_err Pp.(str "Not an equality.")
-
(*** Sigma-types *)
let match_sigma env sigma ex =
diff --git a/tactics/hipattern.mli b/tactics/hipattern.mli
index 8ff6fe95c..237ed42d5 100644
--- a/tactics/hipattern.mli
+++ b/tactics/hipattern.mli
@@ -144,9 +144,6 @@ val is_matching_sigma : Environ.env -> evar_map -> constr -> bool
[t,u,T] and a boolean telling if equality is on the left side *)
val match_eqdec : Environ.env -> evar_map -> constr -> bool * Globnames.global_reference * constr * constr * constr
-(** Match an equality up to conversion; returns [(eq,t1,t2)] in normal form *)
-val dest_nf_eq : 'a Proofview.Goal.t -> constr -> (constr * constr * constr)
-
(** Match a negation *)
val is_matching_not : Environ.env -> evar_map -> constr -> bool
val is_matching_imp_False : Environ.env -> evar_map -> constr -> bool
diff --git a/tactics/ind_tables.ml b/tactics/ind_tables.ml
index 7f087ea01..bc2fea2bd 100644
--- a/tactics/ind_tables.ml
+++ b/tactics/ind_tables.ml
@@ -17,7 +17,7 @@ open Mod_subst
open Libobject
open Nameops
open Declarations
-open Term
+open Constr
open CErrors
open Util
open Declare
@@ -29,7 +29,7 @@ open Pp
(* Registering schemes in the environment *)
type mutual_scheme_object_function =
- internal_flag -> mutual_inductive -> constr array Evd.in_evar_universe_context * Safe_typing.private_constants
+ internal_flag -> MutInd.t -> constr array Evd.in_evar_universe_context * Safe_typing.private_constants
type individual_scheme_object_function =
internal_flag -> inductive -> constr Evd.in_evar_universe_context * Safe_typing.private_constants
@@ -57,7 +57,7 @@ let discharge_scheme (_,(kind,l)) =
Some (kind,Array.map (fun (ind,const) ->
(Lib.discharge_inductive ind,Lib.discharge_con const)) l)
-let inScheme : string * (inductive * constant) array -> obj =
+let inScheme : string * (inductive * Constant.t) array -> obj =
declare_object {(default_object "SCHEME") with
cache_function = cache_scheme;
load_function = (fun _ -> cache_scheme);
@@ -121,12 +121,10 @@ let define internal id c p univs =
let fd = declare_constant ~internal in
let id = compute_name internal id in
let ctx = Evd.normalize_evar_universe_context univs in
- let c = Vars.subst_univs_fn_constr
- (Universes.make_opt_subst (Evd.evar_universe_context_subst ctx)) c in
- let univs = Evd.evar_context_universe_context ctx in
+ let c = Universes.subst_opt_univs_constr (Evd.evar_universe_context_subst ctx) c in
let univs =
- if p then Polymorphic_const_entry univs
- else Monomorphic_const_entry univs
+ if p then Polymorphic_const_entry (UState.context ctx)
+ else Monomorphic_const_entry (UState.context_set ctx)
in
let entry = {
const_entry_body =
diff --git a/tactics/ind_tables.mli b/tactics/ind_tables.mli
index f825c4f4a..d73595a2f 100644
--- a/tactics/ind_tables.mli
+++ b/tactics/ind_tables.mli
@@ -6,8 +6,8 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-open Term
open Names
+open Constr
open Declare
(** This module provides support for registering inductive scheme builders,
@@ -20,7 +20,7 @@ type individual
type 'a scheme_kind
type mutual_scheme_object_function =
- internal_flag -> mutual_inductive -> constr array Evd.in_evar_universe_context * Safe_typing.private_constants
+ internal_flag -> MutInd.t -> constr array Evd.in_evar_universe_context * Safe_typing.private_constants
type individual_scheme_object_function =
internal_flag -> inductive -> constr Evd.in_evar_universe_context * Safe_typing.private_constants
@@ -37,13 +37,13 @@ val declare_individual_scheme_object : string -> ?aux:string ->
val define_individual_scheme : individual scheme_kind ->
internal_flag (** internal *) ->
- Id.t option -> inductive -> constant * Safe_typing.private_constants
+ Id.t option -> inductive -> Constant.t * Safe_typing.private_constants
val define_mutual_scheme : mutual scheme_kind -> internal_flag (** internal *) ->
- (int * Id.t) list -> mutual_inductive -> constant array * Safe_typing.private_constants
+ (int * Id.t) list -> MutInd.t -> Constant.t array * Safe_typing.private_constants
(** Main function to retrieve a scheme in the cache or to generate it *)
-val find_scheme : ?mode:internal_flag -> 'a scheme_kind -> inductive -> constant * Safe_typing.private_constants
+val find_scheme : ?mode:internal_flag -> 'a scheme_kind -> inductive -> Constant.t * Safe_typing.private_constants
val check_scheme : 'a scheme_kind -> inductive -> bool
diff --git a/tactics/inv.ml b/tactics/inv.ml
index c5aa74ba5..cb0bbfd0e 100644
--- a/tactics/inv.ml
+++ b/tactics/inv.ml
@@ -10,7 +10,6 @@ open Pp
open CErrors
open Util
open Names
-open Nameops
open Term
open Termops
open EConstr
@@ -78,7 +77,7 @@ let make_inv_predicate env evd indf realargs id status concl =
| Dep dflt_concl ->
if not (occur_var env !evd id concl) then
user_err ~hdr:"make_inv_predicate"
- (str "Current goal does not depend on " ++ pr_id id ++ str".");
+ (str "Current goal does not depend on " ++ Id.print id ++ str".");
(* We abstract the conclusion of goal with respect to
realargs and c to * be concl in order to rewrite and have
c also rewritten when the case * will be done *)
@@ -283,10 +282,11 @@ let generalizeRewriteIntros as_mode tac depids id =
let error_too_many_names pats =
let loc = Loc.merge_opt (fst (List.hd pats)) (fst (List.last pats)) in
Proofview.tclENV >>= fun env ->
+ Proofview.tclEVARMAP >>= fun sigma ->
tclZEROMSG ?loc (
str "Unexpected " ++
str (String.plural (List.length pats) "introduction pattern") ++
- str ": " ++ pr_enum (Miscprint.pr_intro_pattern (fun c -> Printer.pr_constr (EConstr.Unsafe.to_constr (snd (c env Evd.empty))))) pats ++
+ str ": " ++ pr_enum (Miscprint.pr_intro_pattern (fun c -> Printer.pr_constr_env env sigma (EConstr.Unsafe.to_constr (snd (c env Evd.empty))))) pats ++
str ".")
let get_names (allow_conj,issimple) (loc, pat as x) = match pat with
@@ -334,6 +334,16 @@ let remember_first_eq id x = if !x == MoveLast then x := MoveAfter id
If it can discriminate then the goal is proved, if not tries to use it as
a rewrite rule. It erases the clause which is given as input *)
+let dest_nf_eq env sigma t = match EConstr.kind sigma t with
+| App (r, [| t; x; y |]) ->
+ let open Reductionops in
+ let lazy eq = Coqlib.coq_eq_ref in
+ if EConstr.is_global sigma eq r then
+ (t, whd_all env sigma x, whd_all env sigma y)
+ else user_err Pp.(str "Not an equality.")
+| _ ->
+ user_err Pp.(str "Not an equality.")
+
let projectAndApply as_mode thin avoid id eqname names depids =
let subst_hyp l2r id =
tclTHEN (tclTRY(rewriteInConcl l2r (EConstr.mkVar id)))
@@ -344,7 +354,7 @@ let projectAndApply as_mode thin avoid id eqname names depids =
let sigma = project gl in
(** We only look at the type of hypothesis "id" *)
let hyp = pf_nf_evar gl (pf_get_hyp_typ id (Proofview.Goal.assume gl)) in
- let (t,t1,t2) = Hipattern.dest_nf_eq gl hyp in
+ let (t,t1,t2) = dest_nf_eq (pf_env gl) sigma hyp in
match (EConstr.kind sigma t1, EConstr.kind sigma t2) with
| Var id1, _ -> generalizeRewriteIntros as_mode (subst_hyp true id) depids id1
| _, Var id2 -> generalizeRewriteIntros as_mode (subst_hyp false id) depids id2
@@ -442,7 +452,7 @@ let raw_inversion inv_kind id status names =
let (ind, t) =
try pf_apply Tacred.reduce_to_atomic_ind gl (pf_unsafe_type_of gl c)
with UserError _ ->
- let msg = str "The type of " ++ pr_id id ++ str " is not inductive." in
+ let msg = str "The type of " ++ Id.print id ++ str " is not inductive." in
CErrors.user_err msg
in
let IndType (indf,realargs) = find_rectype env sigma t in
diff --git a/tactics/leminv.ml b/tactics/leminv.ml
index cc9d98f6f..197b3030d 100644
--- a/tactics/leminv.ml
+++ b/tactics/leminv.ml
@@ -215,7 +215,7 @@ let inversion_scheme env sigma t sort dep_option inv_op =
invEnv ~init:Context.Named.empty
end in
let avoid = ref Id.Set.empty in
- let { sigma=sigma } = Proof.V82.subgoals pf in
+ let _,_,_,_,sigma = Proof.proof pf in
let sigma = Evd.nf_constraints sigma in
let rec fill_holes c =
match EConstr.kind sigma c with
@@ -232,25 +232,27 @@ let inversion_scheme env sigma t sort dep_option inv_op =
let invProof = it_mkNamedLambda_or_LetIn c !ownSign in
let invProof = EConstr.Unsafe.to_constr invProof in
let p = Evarutil.nf_evars_universes sigma invProof in
- p, Evd.universe_context ~names:[] ~extensible:true sigma
+ p, sigma
-let add_inversion_lemma name env sigma t sort dep inv_op =
- let invProof, ctx = inversion_scheme env sigma t sort dep inv_op in
- let entry = definition_entry ~poly:(Flags.use_polymorphic_flag ())
- ~univs:(snd ctx) invProof in
+let add_inversion_lemma ~poly name env sigma t sort dep inv_op =
+ let invProof, sigma = inversion_scheme env sigma t sort dep inv_op in
+ let univs =
+ Evd.const_univ_entry ~poly sigma
+ in
+ let entry = definition_entry ~univs invProof in
let _ = declare_constant name (DefinitionEntry entry, IsProof Lemma) in
()
(* inv_op = Inv (derives de complete inv. lemma)
* inv_op = InvNoThining (derives de semi inversion lemma) *)
-let add_inversion_lemma_exn na com comsort bool tac =
+let add_inversion_lemma_exn ~poly na com comsort bool tac =
let env = Global.env () in
- let evd = ref (Evd.from_env env) in
- let c = Constrintern.interp_type_evars env evd com in
- let evd, sort = Evd.fresh_sort_in_family ~rigid:univ_rigid env !evd comsort in
+ let sigma = Evd.from_env env in
+ let sigma, c = Constrintern.interp_type_evars env sigma com in
+ let sigma, sort = Evd.fresh_sort_in_family ~rigid:univ_rigid env sigma comsort in
try
- add_inversion_lemma na env evd c sort bool tac
+ add_inversion_lemma ~poly na env sigma c sort bool tac
with
| UserError (Some "Case analysis",s) -> (* Reference to Indrec *)
user_err ~hdr:"Inv needs Nodep Prop Set" s
diff --git a/tactics/leminv.mli b/tactics/leminv.mli
index 8745ad397..f221b1fd9 100644
--- a/tactics/leminv.mli
+++ b/tactics/leminv.mli
@@ -14,6 +14,6 @@ open Misctypes
val lemInv_clause :
quantified_hypothesis -> constr -> Id.t list -> unit Proofview.tactic
-val add_inversion_lemma_exn :
+val add_inversion_lemma_exn : poly:bool ->
Id.t -> constr_expr -> Sorts.family -> bool -> (Id.t -> unit Proofview.tactic) ->
unit
diff --git a/tactics/tacticals.ml b/tactics/tacticals.ml
index 07eea7b63..cea6ccc30 100644
--- a/tactics/tacticals.ml
+++ b/tactics/tacticals.ml
@@ -10,7 +10,7 @@ open Pp
open CErrors
open Util
open Names
-open Term
+open Constr
open EConstr
open Termops
open Declarations
@@ -224,9 +224,8 @@ let compute_induction_names = compute_induction_names_gen true
(* Compute the let-in signature of case analysis or standard induction scheme *)
let compute_constructor_signatures isrec ((_,k as ity),u) =
- let open Term in
let rec analrec c recargs =
- match kind_of_term c, recargs with
+ match Constr.kind c, recargs with
| Prod (_,_,c), recarg::rest ->
let rest = analrec c rest in
begin match Declareops.dest_recarg recarg with
@@ -242,7 +241,7 @@ let compute_constructor_signatures isrec ((_,k as ity),u) =
let (mib,mip) = Global.lookup_inductive ity in
let n = mib.mind_nparams in
let lc =
- Array.map (fun c -> snd (decompose_prod_n_assum n c)) mip.mind_nf_lc in
+ Array.map (fun c -> snd (Term.decompose_prod_n_assum n c)) mip.mind_nf_lc in
let lrecargs = Declareops.dest_subterms mip.mind_recargs in
Array.map2 analrec lc lrecargs
@@ -472,7 +471,7 @@ module New = struct
let evi = Evd.find sigma evk in
match Evd.evar_body evi with
| Evd.Evar_empty -> Some (evk,evi)
- | Evd.Evar_defined c -> match Term.kind_of_term c with
+ | Evd.Evar_defined c -> match Constr.kind c with
| Term.Evar (evk,l) -> is_undefined_up_to_restriction sigma evk
| _ ->
(* We make the assumption that there is no way to refine an
@@ -622,7 +621,7 @@ module New = struct
| _ ->
let name_elim =
match EConstr.kind sigma elim with
- | Const (kn, _) -> string_of_con kn
+ | Const (kn, _) -> Constant.to_string kn
| Var id -> Id.to_string id
| _ -> "\b"
in
diff --git a/tactics/tacticals.mli b/tactics/tacticals.mli
index 3abd42d46..55c519e24 100644
--- a/tactics/tacticals.mli
+++ b/tactics/tacticals.mli
@@ -7,9 +7,9 @@
(************************************************************************)
open Names
-open Term
+open Constr
open EConstr
-open Tacmach
+open Evd
open Proof_type
open Locus
open Misctypes
@@ -23,6 +23,7 @@ val tclORELSE0 : tactic -> tactic -> tactic
val tclORELSE : tactic -> tactic -> tactic
val tclTHEN : tactic -> tactic -> tactic
val tclTHENSEQ : tactic list -> tactic
+[@@ocaml.deprecated "alias of Tacticals.tclTHENLIST"]
val tclTHENLIST : tactic list -> tactic
val tclTHEN_i : tactic -> (int -> tactic) -> tactic
val tclTHENFIRST : tactic -> tactic -> tactic
@@ -127,9 +128,9 @@ val compute_constructor_signatures : rec_flag -> inductive * 'a -> bool list arr
val compute_induction_names :
bool list array -> or_and_intro_pattern option -> intro_patterns array
-val elimination_sort_of_goal : goal sigma -> sorts_family
-val elimination_sort_of_hyp : Id.t -> goal sigma -> sorts_family
-val elimination_sort_of_clause : Id.t option -> goal sigma -> sorts_family
+val elimination_sort_of_goal : goal sigma -> Sorts.family
+val elimination_sort_of_hyp : Id.t -> goal sigma -> Sorts.family
+val elimination_sort_of_clause : Id.t option -> goal sigma -> Sorts.family
val pf_with_evars : (goal sigma -> Evd.evar_map * 'a) -> ('a -> tactic) -> tactic
val pf_constr_of_global : Globnames.global_reference -> (constr -> tactic) -> tactic
@@ -243,9 +244,9 @@ module New : sig
val tryAllHypsAndConcl : (Id.t option -> unit tactic) -> unit tactic
val onClause : (Id.t option -> unit tactic) -> clause -> unit tactic
- val elimination_sort_of_goal : 'a Proofview.Goal.t -> sorts_family
- val elimination_sort_of_hyp : Id.t -> 'a Proofview.Goal.t -> sorts_family
- val elimination_sort_of_clause : Id.t option -> 'a Proofview.Goal.t -> sorts_family
+ val elimination_sort_of_goal : 'a Proofview.Goal.t -> Sorts.family
+ val elimination_sort_of_hyp : Id.t -> 'a Proofview.Goal.t -> Sorts.family
+ val elimination_sort_of_clause : Id.t option -> 'a Proofview.Goal.t -> Sorts.family
val elimination_then :
(branch_args -> unit Proofview.tactic) ->
diff --git a/tactics/tactics.ml b/tactics/tactics.ml
index 6f67606d2..9fded04db 100644
--- a/tactics/tactics.ml
+++ b/tactics/tactics.ml
@@ -14,6 +14,7 @@ open Util
open Names
open Nameops
open Term
+open Constr
open Termops
open Environ
open EConstr
@@ -58,28 +59,6 @@ let typ_of env sigma c =
open Goptions
-(* Option for 8.2 compatibility *)
-let dependent_propositions_elimination = ref true
-
-let use_dependent_propositions_elimination () =
- !dependent_propositions_elimination
-
-let _ =
- declare_bool_option
- { optdepr = true; (* remove in 8.8 *)
- optname = "dependent-propositions-elimination tactic";
- optkey = ["Dependent";"Propositions";"Elimination"];
- optread = (fun () -> !dependent_propositions_elimination) ;
- optwrite = (fun b -> dependent_propositions_elimination := b) }
-
-let _ =
- declare_bool_option
- { optdepr = true; (* remove in 8.8 *)
- optname = "trigger bugged context matching compatibility";
- optkey = ["Tactic";"Compat";"Context"];
- optread = (fun () -> !Flags.tactic_context_compat) ;
- optwrite = (fun b -> Flags.tactic_context_compat := b) }
-
let apply_solve_class_goals = ref false
let _ =
@@ -180,13 +159,13 @@ let introduction ?(check=true) id =
let env = Proofview.Goal.env gl in
let () = if check && mem_named_context_val id hyps then
user_err ~hdr:"Tactics.introduction"
- (str "Variable " ++ pr_id id ++ str " is already declared.")
+ (str "Variable " ++ Id.print id ++ str " is already declared.")
in
let open Context.Named.Declaration in
match EConstr.kind sigma concl with
| Prod (_, t, b) -> unsafe_intro env store (LocalAssum (id, t)) b
| LetIn (_, c, t, b) -> unsafe_intro env store (LocalDef (id, c, t)) b
- | _ -> raise (RefinerError IntroNeedsProduct)
+ | _ -> raise (RefinerError (env, sigma, IntroNeedsProduct))
end
let refine = Tacmach.refine
@@ -243,11 +222,11 @@ let convert_leq x y = convert_gen Reduction.CUMUL x y
let clear_dependency_msg env sigma id = function
| Evarutil.OccurHypInSimpleClause None ->
- pr_id id ++ str " is used in conclusion."
+ Id.print id ++ str " is used in conclusion."
| Evarutil.OccurHypInSimpleClause (Some id') ->
- pr_id id ++ strbrk " is used in hypothesis " ++ pr_id id' ++ str"."
+ Id.print id ++ strbrk " is used in hypothesis " ++ Id.print id' ++ str"."
| Evarutil.EvarTypingBreak ev ->
- str "Cannot remove " ++ pr_id id ++
+ str "Cannot remove " ++ Id.print id ++
strbrk " without breaking the typing of " ++
Printer.pr_existential env sigma ev ++ str"."
@@ -256,12 +235,12 @@ let error_clear_dependency env sigma id err =
let replacing_dependency_msg env sigma id = function
| Evarutil.OccurHypInSimpleClause None ->
- str "Cannot change " ++ pr_id id ++ str ", it is used in conclusion."
+ str "Cannot change " ++ Id.print id ++ str ", it is used in conclusion."
| Evarutil.OccurHypInSimpleClause (Some id') ->
- str "Cannot change " ++ pr_id id ++
- strbrk ", it is used in hypothesis " ++ pr_id id' ++ str"."
+ str "Cannot change " ++ Id.print id ++
+ strbrk ", it is used in hypothesis " ++ Id.print id' ++ str"."
| Evarutil.EvarTypingBreak ev ->
- str "Cannot change " ++ pr_id id ++
+ str "Cannot change " ++ Id.print id ++
strbrk " without breaking the typing of " ++
Printer.pr_existential env sigma ev ++ str"."
@@ -318,7 +297,7 @@ let move_hyp id dest =
let ty = Proofview.Goal.concl gl in
let store = Proofview.Goal.extra gl in
let sign = named_context_val env in
- let sign' = move_hyp_in_named_context sigma id dest sign in
+ let sign' = move_hyp_in_named_context env sigma id dest sign in
let env = reset_with_named_context sign' env in
Refine.refine ~typecheck:false begin fun sigma ->
Evarutil.new_evar env sigma ~principal:true ~store ty
@@ -347,19 +326,21 @@ let rename_hyp repl =
let hyps = Proofview.Goal.hyps gl in
let concl = Proofview.Goal.concl gl in
let store = Proofview.Goal.extra gl in
+ let env = Proofview.Goal.env gl in
+ let sigma = Proofview.Goal.sigma gl in
(** Check that we do not mess variables *)
let fold accu decl = Id.Set.add (NamedDecl.get_id decl) accu in
let vars = List.fold_left fold Id.Set.empty hyps in
let () =
if not (Id.Set.subset src vars) then
let hyp = Id.Set.choose (Id.Set.diff src vars) in
- raise (RefinerError (NoSuchHyp hyp))
+ raise (RefinerError (env, sigma, NoSuchHyp hyp))
in
let mods = Id.Set.diff vars src in
let () =
try
let elt = Id.Set.choose (Id.Set.inter dst mods) in
- CErrors.user_err (pr_id elt ++ str " is already used")
+ CErrors.user_err (Id.print elt ++ str " is already used")
with Not_found -> ()
in
(** All is well *)
@@ -434,16 +415,16 @@ let find_name mayrepl decl naming gl = match naming with
let ids_of_hyps = Tacmach.New.pf_ids_set_of_hyps gl in
let id' = next_ident_away id ids_of_hyps in
if not mayrepl && not (Id.equal id' id) then
- user_err ?loc (pr_id id ++ str" is already used.");
+ user_err ?loc (Id.print id ++ str" is already used.");
id
(**************************************************************)
(* Computing position of hypotheses for replacing *)
(**************************************************************)
-let get_next_hyp_position id =
+let get_next_hyp_position env sigma id =
let rec aux = function
- | [] -> error_no_such_hypothesis id
+ | [] -> error_no_such_hypothesis env sigma id
| decl :: right ->
if Id.equal (NamedDecl.get_id decl) id then
match right with decl::_ -> MoveBefore (NamedDecl.get_id decl) | [] -> MoveFirst
@@ -452,9 +433,9 @@ let get_next_hyp_position id =
in
aux
-let get_previous_hyp_position id =
+let get_previous_hyp_position env sigma id =
let rec aux dest = function
- | [] -> error_no_such_hypothesis id
+ | [] -> error_no_such_hypothesis env sigma id
| decl :: right ->
let hyp = NamedDecl.get_id decl in
if Id.equal hyp id then dest else aux (MoveAfter hyp) right
@@ -482,15 +463,15 @@ let internal_cut_gen ?(check=true) dir replace id t =
let sign = named_context_val env in
let sign',t,concl,sigma =
if replace then
- let nexthyp = get_next_hyp_position id (named_context_of_val sign) in
+ let nexthyp = get_next_hyp_position env sigma id (named_context_of_val sign) in
let sign',t,concl,sigma = clear_hyps2 env sigma (Id.Set.singleton id) sign t concl in
let sign' = insert_decl_in_named_context sigma (LocalAssum (id,t)) nexthyp sign' in
sign',t,concl,sigma
else
(if check && mem_named_context_val id sign then
- user_err (str "Variable " ++ pr_id id ++ str " is already declared.");
+ user_err (str "Variable " ++ Id.print id ++ str " is already declared.");
push_named_context_val (LocalAssum (id,t)) sign,t,concl,sigma) in
- let nf_t = nf_betaiota sigma t in
+ let nf_t = nf_betaiota env sigma t in
Proofview.tclTHEN
(Proofview.Unsafe.tclEVARS sigma)
(Refine.refine ~typecheck:false begin fun sigma ->
@@ -580,11 +561,11 @@ let mutual_fix f n rest j = Proofview.Goal.enter begin fun gl ->
| (f, n, ar) :: oth ->
let open Context.Named.Declaration in
let (sp', u') = check_mutind env sigma n ar in
- if not (eq_mind sp sp') then
+ if not (MutInd.equal sp sp') then
error "Fixpoints should be on the same mutual inductive declaration.";
if mem_named_context_val f sign then
user_err ~hdr:"Logic.prim_refiner"
- (str "Name " ++ pr_id f ++ str " already used in the environment");
+ (str "Name " ++ Id.print f ++ str " already used in the environment");
mk_sign (push_named_context_val (LocalAssum (f, ar)) sign) oth
in
let nenv = reset_with_named_context (mk_sign (named_context_val env) all) env in
@@ -674,7 +655,7 @@ let pf_reduce_decl redfun where decl gl =
match decl with
| LocalAssum (id,ty) ->
if where == InHypValueOnly then
- user_err (pr_id id ++ str " has no value.");
+ user_err (Id.print id ++ str " has no value.");
LocalAssum (id,redfun' ty)
| LocalDef (id,b,ty) ->
let b' = if where != InHypTypeOnly then redfun' b else b in
@@ -775,7 +756,7 @@ let pf_e_reduce_decl redfun where decl gl =
match decl with
| LocalAssum (id,ty) ->
if where == InHypValueOnly then
- user_err (pr_id id ++ str " has no value.");
+ user_err (Id.print id ++ str " has no value.");
let (sigma, ty') = redfun sigma ty in
(sigma, LocalAssum (id, ty'))
| LocalDef (id,b,ty) ->
@@ -818,7 +799,7 @@ let e_pf_change_decl (redfun : bool -> e_reduction_function) where decl env sigm
match decl with
| LocalAssum (id,ty) ->
if where == InHypValueOnly then
- user_err (pr_id id ++ str " has no value.");
+ user_err (Id.print id ++ str " has no value.");
let (sigma, ty') = redfun false env sigma ty in
(sigma, LocalAssum (id, ty'))
| LocalDef (id,b,ty) ->
@@ -944,10 +925,14 @@ let reduction_clause redexp cl =
(None, bind_red_expr_occurrences occs nbcl redexp)) cl
let reduce redexp cl =
- let trace () =
+ let trace env sigma =
let open Printer in
- let pr = (pr_econstr, pr_leconstr, pr_evaluable_reference, pr_constr_pattern) in
- Pp.(hov 2 (Pputils.pr_red_expr pr str redexp))
+ let pr = (pr_econstr_env, pr_leconstr_env, pr_evaluable_reference, pr_constr_pattern_env) in
+ Pp.(hov 2 (Pputils.pr_red_expr_env env sigma pr str redexp))
+ in
+ let trace () =
+ let sigma, env = Pfedit.get_current_context () in
+ trace env sigma
in
Proofview.Trace.name_tactic trace begin
Proofview.Goal.enter begin fun gl ->
@@ -995,6 +980,7 @@ let rec intro_then_gen name_flag move_flag force_flag dep_flag tac =
let open Context.Rel.Declaration in
Proofview.Goal.enter begin fun gl ->
let sigma = Tacmach.New.project gl in
+ let env = Tacmach.New.pf_env gl in
let concl = Proofview.Goal.concl (Proofview.Goal.assume gl) in
match EConstr.kind sigma concl with
| Prod (name,t,u) when not dep_flag || not (noccurn sigma 1 u) ->
@@ -1004,7 +990,7 @@ let rec intro_then_gen name_flag move_flag force_flag dep_flag tac =
let name = find_name false (LocalDef (name,b,t)) name_flag gl in
build_intro_tac name move_flag tac
| _ ->
- begin if not force_flag then Proofview.tclZERO (RefinerError IntroNeedsProduct)
+ begin if not force_flag then Proofview.tclZERO (RefinerError (env, sigma, IntroNeedsProduct))
(* Note: red_in_concl includes betaiotazeta and this was like *)
(* this since at least V6.3 (a pity *)
(* that intro do betaiotazeta only when reduction is needed; and *)
@@ -1015,7 +1001,7 @@ let rec intro_then_gen name_flag move_flag force_flag dep_flag tac =
(Tacticals.New.tclTHEN hnf_in_concl
(intro_then_gen name_flag move_flag false dep_flag tac))
begin function (e, info) -> match e with
- | RefinerError IntroNeedsProduct ->
+ | RefinerError (env, sigma, IntroNeedsProduct) ->
Tacticals.New.tclZEROMSG (str "No product even after head-reduction.")
| e -> Proofview.tclZERO ~info e
end
@@ -1054,7 +1040,7 @@ let intro_forthcoming_then_gen name_flag move_flag dep_flag n bound tac =
(fun id -> aux (n+1) (id::ids))
end
begin function (e, info) -> match e with
- | RefinerError IntroNeedsProduct ->
+ | RefinerError (env, sigma, IntroNeedsProduct) ->
tac ids
| e -> Proofview.tclZERO ~info e
end
@@ -1065,8 +1051,9 @@ let intro_forthcoming_then_gen name_flag move_flag dep_flag n bound tac =
let intro_replacing id =
Proofview.Goal.enter begin fun gl ->
+ let env, sigma = Proofview.Goal.(env gl, sigma gl) in
let hyps = Proofview.Goal.hyps (Proofview.Goal.assume gl) in
- let next_hyp = get_next_hyp_position id hyps in
+ let next_hyp = get_next_hyp_position env sigma id hyps in
Tacticals.New.tclTHENLIST [
clear_for_replacing [id];
introduction id;
@@ -1085,8 +1072,9 @@ let intro_replacing id =
let intros_possibly_replacing ids =
let suboptimal = true in
Proofview.Goal.enter begin fun gl ->
+ let env, sigma = Proofview.Goal.(env gl, sigma gl) in
let hyps = Proofview.Goal.hyps (Proofview.Goal.assume gl) in
- let posl = List.map (fun id -> (id, get_next_hyp_position id hyps)) ids in
+ let posl = List.map (fun id -> (id, get_next_hyp_position env sigma id hyps)) ids in
Tacticals.New.tclTHEN
(Tacticals.New.tclMAP (fun id ->
Tacticals.New.tclTRY (clear_for_replacing [id]))
@@ -1100,7 +1088,8 @@ let intros_possibly_replacing ids =
let intros_replacing ids =
Proofview.Goal.enter begin fun gl ->
let hyps = Proofview.Goal.hyps (Proofview.Goal.assume gl) in
- let posl = List.map (fun id -> (id, get_next_hyp_position id hyps)) ids in
+ let env, sigma = Proofview.Goal.(env gl, sigma gl) in
+ let posl = List.map (fun id -> (id, get_next_hyp_position env sigma id hyps)) ids in
Tacticals.New.tclTHEN
(clear_for_replacing ids)
(Tacticals.New.tclMAP (fun (id,pos) -> intro_move (Some id) pos) posl)
@@ -1132,7 +1121,7 @@ let is_quantified_hypothesis id gl =
let msg_quantified_hypothesis = function
| NamedHyp id ->
- str "quantified hypothesis named " ++ pr_id id
+ str "quantified hypothesis named " ++ Id.print id
| AnonHyp n ->
pr_nth n ++
str " non dependent hypothesis"
@@ -1283,14 +1272,14 @@ let error_uninstantiated_metas t clenv =
let t = EConstr.Unsafe.to_constr t in
let na = meta_name clenv.evd (List.hd (Metaset.elements (metavars_of t))) in
let id = match na with Name id -> id | _ -> anomaly (Pp.str "unnamed dependent meta.")
- in user_err (str "Cannot find an instance for " ++ pr_id id ++ str".")
+ in user_err (str "Cannot find an instance for " ++ Id.print id ++ str".")
let check_unresolved_evars_of_metas sigma clenv =
(* This checks that Metas turned into Evars by *)
(* Refiner.pose_all_metas_as_evars are resolved *)
List.iter (fun (mv,b) -> match b with
| Clval (_,(c,_),_) ->
- (match kind_of_term c.rebus with
+ (match Constr.kind c.rebus with
| Evar (evk,_) when Evd.is_undefined clenv.evd evk
&& not (Evd.mem sigma evk) ->
error_uninstantiated_metas (mkMeta mv) clenv
@@ -1475,7 +1464,7 @@ let general_case_analysis_in_context with_evars clear_flag (c,lbindc) =
let sort = Tacticals.New.elimination_sort_of_goal gl in
let mind = on_snd (fun u -> EInstance.kind sigma u) mind in
let (sigma, elim) =
- if occur_term sigma c concl then
+ if dependent sigma c concl then
build_case_analysis_scheme env sigma mind true sort
else
build_case_analysis_scheme_default env sigma mind sort in
@@ -1503,7 +1492,7 @@ let simplest_ecase c = general_case_analysis true None (c,NoBindings)
exception IsNonrec
-let is_nonrec mind = (Global.lookup_mind (fst mind)).mind_finite == Decl_kinds.BiFinite
+let is_nonrec mind = (Global.lookup_mind (fst mind)).mind_finite == Declarations.BiFinite
let find_ind_eliminator ind s gl =
let gr = lookup_eliminator ind s in
@@ -1592,7 +1581,7 @@ let elimination_in_clause_scheme with_evars ?(flags=elim_flags ())
let new_hyp_typ = clenv_type elimclause'' in
if EConstr.eq_constr sigma hyp_typ new_hyp_typ then
user_err ~hdr:"general_rewrite_in"
- (str "Nothing to rewrite in " ++ pr_id id ++ str".");
+ (str "Nothing to rewrite in " ++ Id.print id ++ str".");
clenv_refine_in with_evars id id sigma elimclause''
(fun id -> Proofview.tclUNIT ())
end
@@ -1607,7 +1596,7 @@ let general_elim_clause with_evars flags id c e =
(* Apply a tactic below the products of the conclusion of a lemma *)
type conjunction_status =
- | DefinedRecord of constant option list
+ | DefinedRecord of Constant.t option list
| NotADefinedRecordUseScheme of constr
let make_projection env sigma params cstr sign elim i n c u =
@@ -1739,7 +1728,7 @@ let general_apply with_delta with_destruct with_evars clear_flag (loc,(c,lbind :
let env = Proofview.Goal.env gl in
let sigma = Tacmach.New.project gl in
- let thm_ty0 = nf_betaiota sigma (Retyping.get_type_of env sigma c) in
+ let thm_ty0 = nf_betaiota env sigma (Retyping.get_type_of env sigma c) in
let try_apply thm_ty nprod =
try
let n = nb_prod_modulo_zeta sigma thm_ty - nprod in
@@ -1875,7 +1864,7 @@ let explain_unable_to_apply_lemma ?loc env sigma thm innerclause =
str "."))
let apply_in_once_main flags innerclause env sigma (loc,d,lbind) =
- let thm = nf_betaiota sigma (Retyping.get_type_of env sigma d) in
+ let thm = nf_betaiota env sigma (Retyping.get_type_of env sigma d) in
let rec aux clause =
try progress_with_clause flags innerclause clause
with e when CErrors.noncritical e ->
@@ -1971,11 +1960,11 @@ let cut_and_apply c =
(* Exact tactics *)
(********************************************************************)
-(* let convert_leqkey = Profile.declare_profile "convert_leq";; *)
-(* let convert_leq = Profile.profile3 convert_leqkey convert_leq *)
+(* let convert_leqkey = CProfile.declare_profile "convert_leq";; *)
+(* let convert_leq = CProfile.profile3 convert_leqkey convert_leq *)
-(* let refine_no_checkkey = Profile.declare_profile "refine_no_check";; *)
-(* let refine_no_check = Profile.profile2 refine_no_checkkey refine_no_check *)
+(* let refine_no_checkkey = CProfile.declare_profile "refine_no_check";; *)
+(* let refine_no_check = CProfile.profile2 refine_no_checkkey refine_no_check *)
let exact_no_check c =
Refine.refine ~typecheck:false (fun h -> (h,c))
@@ -2045,8 +2034,8 @@ let assumption =
let on_the_bodies = function
| [] -> assert false
-| [id] -> str " depends on the body of " ++ pr_id id
-| l -> str " depends on the bodies of " ++ pr_sequence pr_id l
+| [id] -> str " depends on the body of " ++ Id.print id
+| l -> str " depends on the bodies of " ++ pr_sequence Id.print l
exception DependsOnBody of Id.t option
@@ -2083,7 +2072,7 @@ let clear_body ids =
let map = function
| LocalAssum (id,t) as decl ->
let () = if List.mem_f Id.equal id ids then
- user_err (str "Hypothesis " ++ pr_id id ++ str " is not a local definition")
+ user_err (str "Hypothesis " ++ Id.print id ++ str " is not a local definition")
in
decl
| LocalDef (id,_,t) as decl ->
@@ -2115,7 +2104,7 @@ let clear_body ids =
with DependsOnBody where ->
let msg = match where with
| None -> str "Conclusion" ++ on_the_bodies ids
- | Some id -> str "Hypothesis " ++ pr_id id ++ on_the_bodies ids
+ | Some id -> str "Hypothesis " ++ Id.print id ++ on_the_bodies ids
in
Tacticals.New.tclZEROMSG msg
in
@@ -2173,7 +2162,7 @@ let apply_type newcl args =
let env = Proofview.Goal.env gl in
let store = Proofview.Goal.extra gl in
Refine.refine ~typecheck:false begin fun sigma ->
- let newcl = nf_betaiota sigma newcl (* As in former Logic.refine *) in
+ let newcl = nf_betaiota env sigma newcl (* As in former Logic.refine *) in
let (sigma, ev) =
Evarutil.new_evar env sigma ~principal:true ~store newcl in
(sigma, applist (ev, args))
@@ -2418,10 +2407,10 @@ let rec check_name_unicity env ok seen = function
| (loc, IntroNaming (IntroIdentifier id)) :: l ->
(try
ignore (if List.mem_f Id.equal id ok then raise Not_found else lookup_named id env);
- user_err ?loc (pr_id id ++ str" is already used.")
+ user_err ?loc (Id.print id ++ str" is already used.")
with Not_found ->
if List.mem_f Id.equal id seen then
- user_err ?loc (pr_id id ++ str" is used twice.")
+ user_err ?loc (Id.print id ++ str" is used twice.")
else
check_name_unicity env ok (id::seen) l)
| (_, IntroAction (IntroOrAndPattern l)) :: l' ->
@@ -2628,8 +2617,10 @@ let general_apply_in sidecond_first with_delta with_destruct with_evars
Proofview.Goal.enter begin fun gl ->
let destopt =
if with_evars then MoveLast (* evars would depend on the whole context *)
- else
- get_previous_hyp_position id (Proofview.Goal.hyps (Proofview.Goal.assume gl)) in
+ else (
+ let env, sigma = Proofview.Goal.(env gl, sigma gl) in
+ get_previous_hyp_position env sigma id (Proofview.Goal.hyps (Proofview.Goal.assume gl))
+ ) in
let naming,ipat_tac =
prepare_intros_opt with_evars (IntroIdentifier id) destopt ipat in
let lemmas_target, last_lemma_target =
@@ -2742,7 +2733,7 @@ let mkletin_goal env sigma store with_eq dep (id,lastlhyp,ccl,c) ty =
| IntroFresh heq_base -> fresh_id_in_env (Id.Set.singleton id) heq_base env
| IntroIdentifier id ->
if List.mem id (ids_of_named_context (named_context env)) then
- user_err ?loc (pr_id id ++ str" is already used.");
+ user_err ?loc (Id.print id ++ str" is already used.");
id in
let eqdata = build_coq_eq_data () in
let args = if lr then [t;mkVar id;c] else [t;c;mkVar id]in
@@ -2825,7 +2816,7 @@ let enough_by na t tac = forward false (Some (Some tac)) (ipat_of_name na) t
let generalized_name env sigma c t ids cl = function
| Name id as na ->
if Id.List.mem id ids then
- user_err (pr_id id ++ str " is already used.");
+ user_err (Id.print id ++ str " is already used.");
na
| Anonymous ->
match EConstr.kind sigma c with
@@ -3075,7 +3066,7 @@ let unfold_body x =
let env = Proofview.Goal.env (Proofview.Goal.assume gl) in
let xval = match Environ.lookup_named x env with
| LocalAssum _ -> user_err ~hdr:"unfold_body"
- (pr_id x ++ str" is not a defined hypothesis.")
+ (Id.print x ++ str" is not a defined hypothesis.")
| LocalDef (_,xval,_) -> xval
in
let xval = EConstr.of_constr xval in
@@ -3127,11 +3118,11 @@ let expand_hyp id = Tacticals.New.tclTRY (unfold_body id) <*> clear [id]
let warn_unused_intro_pattern env sigma =
CWarnings.create ~name:"unused-intro-pattern" ~category:"tactics"
- (fun names ->
- strbrk"Unused introduction " ++ str (String.plural (List.length names) "pattern")
- ++ str": " ++ prlist_with_sep spc
- (Miscprint.pr_intro_pattern
- (fun c -> Printer.pr_econstr (snd (c env sigma)))) names)
+ (fun names ->
+ strbrk"Unused introduction " ++ str (String.plural (List.length names) "pattern") ++
+ str": " ++ prlist_with_sep spc
+ (Miscprint.pr_intro_pattern
+ (fun c -> Printer.pr_econstr_env env sigma (snd (c env sigma)))) names)
let check_unused_names env sigma names =
if not (List.is_empty names) then
@@ -3912,7 +3903,7 @@ let specialize_eqs id =
(internal_cut true id ty')
(exact_no_check ((* refresh_universes_strict *) acc'))
else
- Tacticals.New.tclFAIL 0 (str "Nothing to do in hypothesis " ++ pr_id id)
+ Tacticals.New.tclFAIL 0 (str "Nothing to do in hypothesis " ++ Id.print id)
end
let specialize_eqs id = Proofview.Goal.enter begin fun gl ->
@@ -4136,8 +4127,7 @@ let guess_elim isrec dep s hyp0 gl =
let env = Tacmach.New.pf_env gl in
let sigma = Tacmach.New.project gl in
let u = EInstance.kind (Tacmach.New.project gl) u in
- if use_dependent_propositions_elimination () && dep = Some true
- then
+ if dep then
let (sigma, ind) = build_case_analysis_scheme env sigma (mind, u) true s in
let ind = EConstr.of_constr ind in
(sigma, ind)
@@ -4169,11 +4159,10 @@ let find_induction_type isrec elim hyp0 gl =
match elim with
| None ->
let sort = Tacticals.New.elimination_sort_of_goal gl in
- let _, (elimc,elimt),_ =
- guess_elim isrec None sort hyp0 gl in
- let scheme = compute_elim_sig sigma ~elimc elimt in
- (* We drop the scheme waiting to know if it is dependent *)
- scheme, ElimOver (isrec,hyp0)
+ let _, (elimc,elimt),_ = guess_elim isrec false sort hyp0 gl in
+ let scheme = compute_elim_sig sigma ~elimc elimt in
+ (* We drop the scheme waiting to know if it is dependent *)
+ scheme, ElimOver (isrec,hyp0)
| Some e ->
let evd, (elimc,elimt),ind_guess = given_elim hyp0 e gl in
let scheme = compute_elim_sig sigma ~elimc elimt in
@@ -4204,7 +4193,7 @@ let get_eliminator elim dep s gl =
| ElimUsing (elim,indsign) ->
Tacmach.New.project gl, (* bugged, should be computed *) true, elim, indsign
| ElimOver (isrec,id) ->
- let evd, (elimc,elimt),_ as elims = guess_elim isrec (Some dep) s id gl in
+ let evd, (elimc,elimt),_ as elims = guess_elim isrec dep s id gl in
let _, (l, s) = compute_elim_signature elims id in
let branchlengthes = List.map (fun d -> assert (RelDecl.is_local_assum d); pi1 (decompose_prod_letin (Tacmach.New.project gl) (RelDecl.get_type d)))
(List.rev s.branches)
@@ -4368,7 +4357,7 @@ let clear_unselected_context id inhyps cls =
if occur_var (Tacmach.New.pf_env gl) (Tacmach.New.project gl) id (Tacmach.New.pf_concl gl) &&
cls.concl_occs == NoOccurrences
then user_err
- (str "Conclusion must be mentioned: it depends on " ++ pr_id id
+ (str "Conclusion must be mentioned: it depends on " ++ Id.print id
++ str ".");
match cls.onhyps with
| Some hyps ->
@@ -4443,8 +4432,11 @@ let check_enough_applied env sigma elim =
check_expected_type env sigma elimc elimt
let guard_no_unifiable = Proofview.guard_no_unifiable >>= function
-| None -> Proofview.tclUNIT ()
-| Some l -> Proofview.tclZERO (RefinerError (UnresolvedBindings l))
+ | None -> Proofview.tclUNIT ()
+ | Some l ->
+ Proofview.tclENV >>= function env ->
+ Proofview.tclEVARMAP >>= function sigma ->
+ Proofview.tclZERO (RefinerError (env, sigma, UnresolvedBindings l))
let pose_induction_arg_then isrec with_evars (is_arg_pure_hyp,from_prefix) elim
id ((pending,(c0,lbind)),(eqname,names)) t0 inhyps cls tac =
@@ -4643,7 +4635,7 @@ let induction_destruct isrec with_evars (lc,elim) =
(Tacticals.New.tclMAP (fun (a,b,cl) ->
Proofview.Goal.enter begin fun gl ->
let env = Proofview.Goal.env gl in
- let sigma = Tacmach.New.project gl in
+ let sigma = Tacmach.New.project gl in
onOpenInductionArg env sigma (fun clear_flag a ->
induction_gen clear_flag false with_evars None (a,b) cl) a
end) l)
@@ -4668,7 +4660,7 @@ let induction_destruct isrec with_evars (lc,elim) =
end
let induction ev clr c l e =
- induction_gen clr true ev e
+ induction_gen clr true ev e
((Evd.empty,(c,NoBindings)),(None,l)) None
let destruct ev clr c l e =
@@ -4958,7 +4950,7 @@ let interpretable_as_section_decl evd d1 d2 =
let rec decompose len c t accu =
let open Context.Rel.Declaration in
if len = 0 then (c, t, accu)
- else match kind_of_term c, kind_of_term t with
+ else match Constr.kind c, Constr.kind t with
| Lambda (na, u, c), Prod (_, _, t) ->
decompose (pred len) c t (LocalAssum (na, u) :: accu)
| LetIn (na, b, u, c), LetIn (_, _, _, t) ->
@@ -4966,7 +4958,7 @@ let rec decompose len c t accu =
| _ -> assert false
let rec shrink ctx sign c t accu =
- let open Term in
+ let open Constr in
let open CVars in
match ctx, sign with
| [], [] -> (c, t, accu)
@@ -4976,8 +4968,8 @@ let rec shrink ctx sign c t accu =
let t = subst1 mkProp t in
shrink ctx sign c t accu
else
- let c = mkLambda_or_LetIn p c in
- let t = mkProd_or_LetIn p t in
+ let c = Term.mkLambda_or_LetIn p c in
+ let t = Term.mkProd_or_LetIn p t in
let accu = if RelDecl.is_local_assum p
then mkVar (NamedDecl.get_id decl) :: accu
else accu
diff --git a/tactics/tactics.mli b/tactics/tactics.mli
index 98cf1b437..83fc655f1 100644
--- a/tactics/tactics.mli
+++ b/tactics/tactics.mli
@@ -8,7 +8,7 @@
open Loc
open Names
-open Term
+open Constr
open EConstr
open Environ
open Proof_type
diff --git a/tactics/term_dnet.ml b/tactics/term_dnet.ml
index 64ba38a51..7567cfa30 100644
--- a/tactics/term_dnet.ml
+++ b/tactics/term_dnet.ml
@@ -8,7 +8,7 @@
(*i*)
open Util
-open Term
+open Constr
open Names
open Globnames
open Mod_subst
@@ -95,13 +95,20 @@ struct
let compare cmp t1 t2 = match t1, t2 with
| DRel, DRel -> 0
+ | DRel, _ -> -1 | _, DRel -> 1
| DSort, DSort -> 0
+ | DSort, _ -> -1 | _, DSort -> 1
| DRef gr1, DRef gr2 -> RefOrdered.compare gr1 gr2
+ | DRef _, _ -> -1 | _, DRef _ -> 1
+
| DCtx (tl1, tr1), DCtx (tl2, tr2)
| DLambda (tl1, tr1), DLambda (tl2, tr2)
| DApp (tl1, tr1), DApp (tl2, tr2) ->
let c = cmp tl1 tl2 in
if c = 0 then cmp tr1 tr2 else c
+ | DCtx _, _ -> -1 | _, DCtx _ -> 1
+ | DLambda _, _ -> -1 | _, DLambda _ -> 1
+ | DApp _, _ -> -1 | _, DApp _ -> 1
| DCase (ci1, c1, t1, p1), DCase (ci2, c2, t2, p2) ->
let c = cmp c1 c2 in
@@ -113,6 +120,7 @@ struct
else c
else c
else c
+ | DCase _, _ -> -1 | _, DCase _ -> 1
| DFix (i1, j1, tl1, pl1), DFix (i2, j2, tl2, pl2) ->
let c = Int.compare j1 j2 in
@@ -124,6 +132,8 @@ struct
else c
else c
else c
+ | DFix _, _ -> -1 | _, DFix _ -> 1
+
| DCoFix (i1, tl1, pl1), DCoFix (i2, tl2, pl2) ->
let c = Int.compare i1 i2 in
if c = 0 then
@@ -131,7 +141,18 @@ struct
if c = 0 then Array.compare cmp pl1 pl2
else c
else c
- | _ -> Pervasives.compare t1 t2 (** OK **)
+ | DCoFix _, _ -> -1 | _, DCoFix _ -> 1
+
+ | DCons ((t1, ot1), u1), DCons ((t2, ot2), u2) ->
+ let c = cmp t1 t2 in
+ if Int.equal c 0 then
+ let c = Option.compare cmp ot1 ot2 in
+ if Int.equal c 0 then cmp u1 u2
+ else c
+ else c
+ | DCons _, _ -> -1 | _, DCons _ -> 1
+
+ | DNil, DNil -> 0
let fold f acc = function
| (DRel | DNil | DSort | DRef _) -> acc
@@ -174,7 +195,8 @@ struct
Array.fold_left2 f (Array.fold_left2 f acc ta1 ta2) ca1 ca2
| DCons ((t1,topt1),u1), DCons ((t2,topt2),u2) ->
f (Option.fold_left2 f (f acc t1 t2) topt1 topt2) u1 u2
- | _ -> assert false
+ | (DRel | DNil | DSort | DRef _ | DCtx _ | DApp _ | DLambda _ | DCase _
+ | DFix _ | DCoFix _ | DCons _), _ -> assert false
let map2 (f:'a -> 'b -> 'c) (c1:'a t) (c2:'b t) : 'c t =
let head w = map (fun _ -> ()) w in
@@ -194,11 +216,13 @@ struct
DCoFix (i,Array.map2 f ta1 ta2,Array.map2 f ca1 ca2)
| DCons ((t1,topt1),u1), DCons ((t2,topt2),u2) ->
DCons ((f t1 t2,Option.lift2 f topt1 topt2), f u1 u2)
- | _ -> assert false
+ | (DRel | DNil | DSort | DRef _ | DCtx _ | DApp _ | DLambda _ | DCase _
+ | DFix _ | DCoFix _ | DCons _), _ -> assert false
let terminal = function
| (DRel | DSort | DNil | DRef _) -> true
- | _ -> false
+ | DLambda _ | DApp _ | DCase _ | DFix _ | DCoFix _ | DCtx _ | DCons _ ->
+ false
let compare t1 t2 = compare dummy_cmp t1 t2
@@ -257,7 +281,7 @@ struct
let pat_of_constr c : term_pattern =
(** To each evar we associate a unique identifier. *)
let metas = ref Evar.Map.empty in
- let rec pat_of_constr c = match kind_of_term c with
+ let rec pat_of_constr c = match Constr.kind c with
| Rel _ -> Term DRel
| Sort _ -> Term DSort
| Var i -> Term (DRef (VarRef i))
@@ -290,7 +314,7 @@ struct
| Proj (p,c) ->
Term (DApp (Term (DRef (ConstRef (Projection.constant p))), pat_of_constr c))
- and ctx_of_constr ctx c = match kind_of_term c with
+ and ctx_of_constr ctx c = match Constr.kind c with
| Prod (_,t,c) -> ctx_of_constr (Term(DCons((pat_of_constr t,None),ctx))) c
| LetIn(_,d,t,c) -> ctx_of_constr (Term(DCons((pat_of_constr t, Some (pat_of_constr d)),ctx))) c
| _ -> ctx,pat_of_constr c
diff --git a/tactics/term_dnet.mli b/tactics/term_dnet.mli
index 16122fa5e..db7da18ba 100644
--- a/tactics/term_dnet.mli
+++ b/tactics/term_dnet.mli
@@ -6,7 +6,7 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-open Term
+open Constr
open Mod_subst
(** Dnets on constr terms.
diff --git a/test-suite/Makefile b/test-suite/Makefile
index 61e75fa5d..16a56f440 100644
--- a/test-suite/Makefile
+++ b/test-suite/Makefile
@@ -40,6 +40,7 @@ coqtopload := $(coqtop) -top Top -async-proofs-cache force -load-vernac-source
coqtopcompile := $(coqtop) -compile
coqdep := $(BIN)coqdep -coqlib $(LIB)
+VERBOSE?=
SHOW := $(if $(VERBOSE),@true,@echo)
HIDE := $(if $(VERBOSE),,@)
REDIR := $(if $(VERBOSE),,> /dev/null 2>&1)
@@ -95,7 +96,8 @@ VSUBSYSTEMS := prerequisite success failure $(BUGS) output \
SUBSYSTEMS := $(VSUBSYSTEMS) misc bugs ide vio coqchk coqwc coq-makefile
PREREQUISITELOG = prerequisite/admit.v.log \
- prerequisite/make_local.v.log prerequisite/make_notation.v.log
+ prerequisite/make_local.v.log prerequisite/make_notation.v.log \
+ prerequisite/bind_univs.v.log
#######################################################################
# Phony targets
@@ -173,10 +175,20 @@ summary.log:
# if not on travis we can get the log files (they're just there for a
# local build, and downloadable on GitLab)
+PRINT_LOGS?=
+TRAVIS?= # special because we want to print travis_fold directives
+ifdef APPVEYOR
+PRINT_LOGS:=APPVEYOR
+else
+ifdef CIRCLECI
+PRINT_LOGS:=CIRCLECI
+endif #CIRCLECI
+endif #APPVEYOR
+
report: summary.log
- $(HIDE)./save-logs.sh
+ $(HIDE)bash save-logs.sh
$(HIDE)if [ -n "${TRAVIS}" ]; then find logs/ -name '*.log' -not -name 'summary.log' -exec 'bash' '-c' 'echo "travis_fold:start:coq.logs.$$(echo '{}' | sed s,/,.,g)"' ';' -exec cat '{}' ';' -exec 'bash' '-c' 'echo "travis_fold:end:coq.logs.$$(echo '{}' | sed s,/,.,g)"' ';'; fi
- $(HIDE)if [ -n "${APPVEYOR}" ]; then find logs/ -name '*.log' -not -name 'summary.log' -exec 'bash' '-c' 'echo {}' ';' -exec cat '{}' ';' -exec 'bash' '-c' 'echo' ';'; fi
+ $(HIDE)if [ -n "${PRINT_LOGS}" ]; then find logs/ -name '*.log' -not -name 'summary.log' -exec 'bash' '-c' 'echo {}' ';' -exec cat '{}' ';' -exec 'bash' '-c' 'echo' ';'; fi
$(HIDE)if grep -q -F 'Error!' summary.log ; then echo FAILURES; grep -F 'Error!' summary.log; false; else echo NO FAILURES; fi
#######################################################################
@@ -311,6 +323,13 @@ $(addsuffix .log,$(wildcard output/*.v)): %.v.log: %.v %.out $(PREREQUISITELOG)
rm $$tmpoutput; \
} > "$@"
+# the expected output for the MExtraction test is
+# /plugins/micromega/micromega.ml except with additional newline
+output/MExtraction.out: ../plugins/micromega/micromega.ml
+ $(SHOW) GEN $@
+ $(HIDE) cp $< $@
+ $(HIDE) echo >> $@
+
$(addsuffix .log,$(wildcard output-modulo-time/*.v)): %.v.log: %.v %.out
@echo "TEST $< $(call get_coq_prog_args_in_parens,"$<")"
$(HIDE){ \
@@ -528,7 +547,7 @@ coq-makefile/%.log : coq-makefile/%/run.sh
$(HIDE)(\
export COQBIN=$(BIN);\
cd coq-makefile/$* && \
- ./run.sh 2>&1; \
+ bash run.sh 2>&1; \
if [ $$? = 0 ]; then \
echo $(log_success); \
echo " $<...Ok"; \
@@ -549,8 +568,8 @@ $(addsuffix .log,$(wildcard coqdoc/*.v)): %.v.log: %.v %.html.out %.tex.out $(PR
$(coqc) -R coqdoc Coqdoc $* 2>&1; \
cd coqdoc; \
f=`basename $*`; \
- $(coqdoc) -R . Coqdoc -coqlib http://coq.inria.fr/stdlib --html $$f.v; \
- $(coqdoc) -R . Coqdoc -coqlib http://coq.inria.fr/stdlib --latex $$f.v; \
+ $(coqdoc) -utf8 -R . Coqdoc -coqlib http://coq.inria.fr/stdlib --html $$f.v; \
+ $(coqdoc) -utf8 -R . Coqdoc -coqlib http://coq.inria.fr/stdlib --latex $$f.v; \
diff -u --strip-trailing-cr $$f.html.out Coqdoc.$$f.html 2>&1; R=$$?; times; \
grep -v "^%%" Coqdoc.$$f.tex | diff -u --strip-trailing-cr $$f.tex.out - 2>&1; S=$$?; times; \
if [ $$R = 0 -a $$S = 0 ]; then \
diff --git a/test-suite/README.md b/test-suite/README.md
new file mode 100644
index 000000000..1d1195646
--- /dev/null
+++ b/test-suite/README.md
@@ -0,0 +1,75 @@
+# Coq Test Suite
+
+The test suite can be run from the Coq root directory by `make test-suite`.
+This does a clean step first, so if you've already run it, then change something,
+you'll have to do a lot of work again.
+
+If you run `make` from the `test-suite` directory, there is no clean step.
+You can also run `make aaa/bbb/ccc.v.log` to build the log for one test,
+or `make ddd` where `ddd` is on of the sub-directories of `test-suite`
+to just build the logs for that directory.
+In these cases, a summary is not printed, but can be generated by `make summary`.
+
+`make -B` can be used to rerun tests ( -B meaning always remake).
+
+From the `test-suite` directory, `make report` (included in `make
+all`) prints a summary of which tests failed using the produced log
+files (this still works when only some tests are built as described
+above). Setting the `PRINT_LOGS` variable will make it print the logs
+of the failing tests.
+
+For instance, running the following in the `test-suite` directory:
+
+```bash
+$ echo Fail. > success/fail.v # make some failing test
+
+$ make
+TEST prerequisite/make_local.v
+...
+TEST success/fail.v
+...
+BUILDING SUMMARY FILE
+FAILURES
+ success/fail.v...Error! (should be accepted)
+Makefile:189: recipe for target 'all failed
+make: *** [report] Error 1
+
+$ make report PRINT_LOGS=1
+BUILDING SUMMARY FILE
+logs/success/fail.v.log
+==========> TESTING success/fail.v <==========
+Welcome to Coq (version information)
+Skipping rcfile loading.
+File "/path/to/success/fail.v", line 1, characters 4-5:
+Error:
+Syntax error: [vernac:Vernac.vernac_control] expected after 'Fail' (in [vernac:Vernac.vernac_control]).
+
+0m0.000000s 0m0.000000s
+0m0.040000s 0m0.000000s
+==========> FAILURE <==========
+ success/fail.v...Error! (should be accepted)
+
+FAILURES
+ success/fail.v...Error! (should be accepted)
+Makefile:189: recipe for target 'report' failed
+make: *** [report] Error 1
+
+$ echo 'Comments "foo".' > success/fail.v
+
+$ make
+TEST success/fail.v
+BUILDING SUMMARY FILE
+NO FAILURES
+```
+
+See [`test-suite/Makefile`](/test-suite/Makefile) for more information.
+
+## Adding a test
+
+Regression tests for closed bugs should be added to `test-suite/bugs/closed`, as `1234.v` where `1234` is the bug number.
+Files in this directory are tested for successful compilation.
+When you fix a bug, you should usually add a regression test here as well.
+
+The error "(bug seems to be opened, please check)" when running `make test-suite` means that a test in `bugs/closed` failed to compile.
+
+There are also output tests in `test-suite/output` which consist of a `.v` file and a `.out` file with the expected output.
diff --git a/test-suite/bugs/5996.v b/test-suite/bugs/5996.v
new file mode 100644
index 000000000..c9e3292b4
--- /dev/null
+++ b/test-suite/bugs/5996.v
@@ -0,0 +1,8 @@
+Goal Type.
+ let c := constr:(prod nat nat) in
+ let c' := (eval pattern nat in c) in
+ let c' := lazymatch c' with ?f _ => f end in
+ let c'' := lazymatch c' with fun x : Set => ?f => constr:(forall x : Type, f) end in
+ let _ := type of c'' in
+ exact c''.
+Defined.
diff --git a/test-suite/bugs/closed/3125.v b/test-suite/bugs/closed/3125.v
new file mode 100644
index 000000000..797146174
--- /dev/null
+++ b/test-suite/bugs/closed/3125.v
@@ -0,0 +1,27 @@
+(* Not considering singleton template-polymorphic inductive types as
+ propositions for injection/inversion *)
+
+(* This is also #4560 and #6273 *)
+
+Inductive foo := foo_1.
+
+Goal forall (a b : foo), Some a = Some b -> a = b.
+Proof.
+ intros a b H.
+ inversion H.
+ reflexivity.
+Qed.
+
+(* Check that Prop is not concerned *)
+
+Inductive bar : Prop := bar_1.
+
+Goal
+ forall (a b : bar),
+ Some a = Some b ->
+ a = b.
+Proof.
+ intros a b H.
+ inversion H.
+ Fail reflexivity.
+Abort.
diff --git a/test-suite/bugs/closed/3559.v b/test-suite/bugs/closed/3559.v
index da12b6868..5210b2703 100644
--- a/test-suite/bugs/closed/3559.v
+++ b/test-suite/bugs/closed/3559.v
@@ -65,6 +65,7 @@ Axiom path_iff_hprop_uncurried : forall `{IsHProp A, IsHProp B}, (A <-> B) -> A
= B.
Inductive V : Type@{U'} := | set {A : Type@{U}} (f : A -> V) : V.
Axiom is0trunc_V : IsTrunc (trunc_S (trunc_S minus_two)) V.
+Existing Instance is0trunc_V.
Axiom bisimulation : V@{U' U} -> V@{U' U} -> hProp@{U'}.
Axiom bisimulation_refl : forall (v : V), bisimulation v v.
Axiom bisimulation_eq : forall (u v : V), bisimulation u v -> u = v.
diff --git a/test-suite/bugs/closed/3690.v b/test-suite/bugs/closed/3690.v
index fd9640b89..fa30132ab 100644
--- a/test-suite/bugs/closed/3690.v
+++ b/test-suite/bugs/closed/3690.v
@@ -3,49 +3,44 @@ Set Printing Universes.
Set Universe Polymorphism.
Definition foo (a := Type) (b := Type) (c := Type) := Type.
Print foo.
-(* foo =
-let a := Type@{Top.1} in
-let b := Type@{Top.2} in let c := Type@{Top.3} in Type@{Top.4}
- : Type@{Top.4+1}
-(* Top.1
- Top.2
- Top.3
- Top.4 |= *) *)
-Check @foo. (* foo@{Top.5 Top.6 Top.7
-Top.8}
- : Type@{Top.8+1}
-(* Top.5
- Top.6
- Top.7
- Top.8 |= *) *)
+(* foo@{Top.2 Top.3 Top.5 Top.6 Top.8 Top.9 Top.10} =
+let a := Type@{Top.2} in let b := Type@{Top.5} in let c := Type@{Top.8} in Type@{Top.10}
+ : Type@{Top.10+1}
+(* Top.2 Top.3 Top.5 Top.6 Top.8 Top.9 Top.10 |= Top.2 < Top.3
+ Top.5 < Top.6
+ Top.8 < Top.9
+ *)
+ *)
+Check @foo. (* foo@{Top.11 Top.12 Top.13 Top.14 Top.15 Top.16
+Top.17}
+ : Type@{Top.17+1}
+(* Top.11 Top.12 Top.13 Top.14 Top.15 Top.16 Top.17 |= Top.11 < Top.12
+ Top.13 < Top.14
+ Top.15 < Top.16
+ *)
+ *)
Definition bar := ltac:(let t := eval compute in foo in exact t).
-Check @bar. (* bar@{Top.13 Top.14 Top.15
-Top.16}
- : Type@{Top.16+1}
-(* Top.13
- Top.14
- Top.15
- Top.16 |= *) *)
-(* The following should fail, since [bar] should only need one universe. *)
-Check @bar@{i j}.
+Check @bar. (* bar@{Top.27}
+ : Type@{Top.27+1}
+(* Top.27 |= *) *)
+
+Check @bar@{i}.
Definition baz (a := Type) (b := Type : a) (c := Type : b) := a -> c.
Definition qux := Eval compute in baz.
-Check @qux. (* qux@{Top.24 Top.25
-Top.26}
- : Type@{max(Top.24+1, Top.26+1)}
-(* Top.24
- Top.25
- Top.26 |= Top.25 < Top.24
- Top.26 < Top.25
- *) *)
-Print qux. (* qux =
-Type@{Top.21} -> Type@{Top.23}
- : Type@{max(Top.21+1, Top.23+1)}
-(* Top.21
- Top.22
- Top.23 |= Top.22 < Top.21
- Top.23 < Top.22
- *) *)
+Check @qux. (* qux@{Top.38 Top.39 Top.40
+Top.41}
+ : Type@{max(Top.38+1, Top.41+1)}
+(* Top.38 Top.39 Top.40 Top.41 |= Top.38 < Top.39
+ Top.40 < Top.38
+ Top.41 < Top.40
+ *) *)
+Print qux. (* qux@{Top.34 Top.35 Top.36 Top.37} =
+Type@{Top.34} -> Type@{Top.37}
+ : Type@{max(Top.34+1, Top.37+1)}
+(* Top.34 Top.35 Top.36 Top.37 |= Top.34 < Top.35
+ Top.36 < Top.34
+ Top.37 < Top.36
+ *) *)
Fail Check @qux@{Set Set}.
Check @qux@{Type Type Type Type}.
(* [qux] should only need two universes *)
diff --git a/test-suite/bugs/closed/4390.v b/test-suite/bugs/closed/4390.v
index a96a13700..c069b2d9d 100644
--- a/test-suite/bugs/closed/4390.v
+++ b/test-suite/bugs/closed/4390.v
@@ -8,16 +8,16 @@ Universe i.
End foo.
End M.
-Check Type@{i}.
+Check Type@{M.i}.
(* Succeeds *)
Fail Check Type@{j}.
(* Error: Undeclared universe: j *)
-Definition foo@{j} : Type@{i} := Type@{j}.
+Definition foo@{j} : Type@{M.i} := Type@{j}.
(* ok *)
End A.
-
+Import A. Import M.
Set Universe Polymorphism.
Fail Universes j.
Monomorphic Universe j.
diff --git a/test-suite/bugs/closed/4717.v b/test-suite/bugs/closed/4717.v
new file mode 100644
index 000000000..1507fa4bf
--- /dev/null
+++ b/test-suite/bugs/closed/4717.v
@@ -0,0 +1,37 @@
+(* Omega being smarter on recognizing nat and Z *)
+
+Require Import Omega.
+
+Definition nat' := nat.
+
+Theorem le_not_eq_lt : forall (n m:nat),
+ n <= m ->
+ n <> m :> nat' ->
+ n < m.
+Proof.
+ intros.
+ omega.
+Qed.
+
+Goal forall (x n : nat'), x = x + n - n.
+Proof.
+ intros.
+ omega.
+Qed.
+
+Require Import ZArith ROmega.
+
+Open Scope Z_scope.
+
+Definition Z' := Z.
+
+Theorem Zle_not_eq_lt : forall n m,
+ n <= m ->
+ n <> m :> Z' ->
+ n < m.
+Proof.
+ intros.
+ omega.
+ Undo.
+ romega.
+Qed.
diff --git a/test-suite/bugs/closed/5215.v b/test-suite/bugs/closed/5215.v
new file mode 100644
index 000000000..ecf529159
--- /dev/null
+++ b/test-suite/bugs/closed/5215.v
@@ -0,0 +1,286 @@
+Require Import Coq.Logic.FunctionalExtensionality.
+Require Import Coq.Program.Tactics.
+
+Global Set Primitive Projections.
+
+Global Set Universe Polymorphism.
+
+Global Unset Universe Minimization ToSet.
+
+Class Category : Type :=
+{
+ Obj : Type;
+ Hom : Obj -> Obj -> Type;
+ compose : forall {a b c : Obj}, (Hom a b) -> (Hom b c) -> (Hom a c);
+ id : forall {a : Obj}, Hom a a;
+}.
+
+Arguments Obj {_}, _.
+Arguments id {_ _}, {_} _, _ _.
+Arguments Hom {_} _ _, _ _ _.
+Arguments compose {_} {_ _ _} _ _, _ {_ _ _} _ _, _ _ _ _ _ _.
+
+Coercion Obj : Category >-> Sortclass.
+
+Definition Opposite (C : Category) : Category :=
+{|
+
+ Obj := Obj C;
+ Hom := fun a b => Hom b a;
+ compose :=
+ fun a b c (f : Hom b a) (g : Hom c b) => compose C c b a g f;
+ id := fun c => id C c;
+|}.
+
+Record Functor (C C' : Category) : Type :=
+{
+ FO : C -> C';
+ FA : forall {a b}, Hom a b -> Hom (FO a) (FO b);
+}.
+
+Arguments FO {_ _} _ _.
+Arguments FA {_ _} _ {_ _} _, {_ _} _ _ _ _.
+
+Section Opposite_Functor.
+ Context {C D : Category} (F : Functor C D).
+
+ Program Definition Opposite_Functor : (Functor (Opposite C) (Opposite D)) :=
+ {|
+ FO := FO F;
+ FA := fun _ _ h => FA F h;
+ |}.
+
+End Opposite_Functor.
+
+Section Functor_Compose.
+ Context {C C' C'' : Category} (F : Functor C C') (F' : Functor C' C'').
+
+ Program Definition Functor_compose : Functor C C'' :=
+ {|
+ FO := fun c => FO F' (FO F c);
+ FA := fun c d f => FA F' (FA F f)
+ |}.
+
+End Functor_Compose.
+
+Section Algebras.
+ Context {C : Category} (T : Functor C C).
+ Record Algebra : Type :=
+ {
+ Alg_Carrier : C;
+ Constructors : Hom (FO T Alg_Carrier) Alg_Carrier
+ }.
+
+ Record Algebra_Hom (alg alg' : Algebra) : Type :=
+ {
+ Alg_map : Hom (Alg_Carrier alg) (Alg_Carrier alg');
+
+ Alg_map_com : compose (FA T Alg_map) (Constructors alg')
+ = compose (Constructors alg) Alg_map
+ }.
+
+ Arguments Alg_map {_ _} _.
+ Arguments Alg_map_com {_ _} _.
+ Program Definition Algebra_Hom_compose
+ {alg alg' alg'' : Algebra}
+ (h : Algebra_Hom alg alg')
+ (h' : Algebra_Hom alg' alg'')
+ : Algebra_Hom alg alg''
+ :=
+ {|
+ Alg_map := compose (Alg_map h) (Alg_map h')
+ |}.
+
+ Next Obligation. Proof. Admitted.
+
+ Lemma Algebra_Hom_eq_simplify (alg alg' : Algebra)
+ (ah ah' : Algebra_Hom alg alg')
+ : (Alg_map ah) = (Alg_map ah') -> ah = ah'.
+ Proof. Admitted.
+
+ Program Definition Algebra_Hom_id (alg : Algebra) : Algebra_Hom alg alg :=
+ {|
+ Alg_map := id
+ |}.
+
+ Next Obligation. Admitted.
+
+ Definition Algebra_Cat : Category :=
+ {|
+ Obj := Algebra;
+ Hom := Algebra_Hom;
+ compose := @Algebra_Hom_compose;
+ id := Algebra_Hom_id;
+ |}.
+
+End Algebras.
+
+Arguments Alg_Carrier {_ _} _.
+Arguments Constructors {_ _} _.
+Arguments Algebra_Hom {_ _} _ _.
+Arguments Alg_map {_ _ _ _} _.
+Arguments Alg_map_com {_ _ _ _} _.
+Arguments Algebra_Hom_id {_ _} _.
+
+Section CoAlgebras.
+ Context {C : Category}.
+
+ Definition CoAlgebra (T : Functor C C) :=
+ @Algebra (Opposite C) (Opposite_Functor T).
+
+ Definition CoAlgebra_Hom {T : Functor C C} :=
+ @Algebra_Hom (Opposite C) (Opposite_Functor T).
+
+ Definition CoAlgebra_Hom_id {T : Functor C C} :=
+ @Algebra_Hom_id (Opposite C) (Opposite_Functor T).
+
+ Definition CoAlgebra_Cat (T : Functor C C) :=
+ @Algebra_Cat (Opposite C) (Opposite_Functor T).
+
+End CoAlgebras.
+
+Program Definition Type_Cat : Category :=
+{|
+ Obj := Type;
+ Hom := (fun A B => A -> B);
+ compose := fun A B C (g : A -> B) (h : B -> C) => fun (x : A) => h (g x);
+ id := fun A => fun x => x
+|}.
+
+Local Obligation Tactic := idtac.
+
+Program Definition Prod_Cat (C C' : Category) : Category :=
+{|
+ Obj := C * C';
+ Hom :=
+ fun a b =>
+ ((Hom (fst a) (fst b)) * (Hom (snd a) (snd b)))%type;
+ compose :=
+ fun a b c f g =>
+ ((compose (fst f) (fst g)), (compose (snd f)(snd g)));
+ id := fun c => (id, id)
+|}.
+
+Class Terminal (C : Category) : Type :=
+{
+ terminal : C;
+ t_morph : forall (d : Obj), Hom d terminal;
+ t_morph_unique : forall (d : Obj) (f g : (Hom d terminal)), f = g
+}.
+
+Arguments terminal {_} _.
+Arguments t_morph {_} _ _.
+Arguments t_morph_unique {_} _ _ _ _.
+
+Coercion terminal : Terminal >-> Obj.
+
+Definition Initial (C : Category) := Terminal (Opposite C).
+Existing Class Initial.
+
+Record Product {C : Category} (c d : C) : Type :=
+{
+ product : C;
+ Pi_1 : Hom product c;
+ Pi_2 : Hom product d;
+ Prod_morph_ex : forall (p' : Obj) (r1 : Hom p' c) (r2 : Hom p' d), (Hom p' product);
+}.
+
+Arguments Product _ _ _, {_} _ _.
+
+Arguments Pi_1 {_ _ _ _}, {_ _ _} _.
+Arguments Pi_2 {_ _ _ _}, {_ _ _} _.
+Arguments Prod_morph_ex {_ _ _} _ _ _ _.
+
+Coercion product : Product >-> Obj.
+
+Definition Has_Products (C : Category) : Type := forall a b, Product a b.
+
+Existing Class Has_Products.
+
+Program Definition Prod_Func (C : Category) {HP : Has_Products C}
+ : Functor (Prod_Cat C C) C :=
+{|
+ FO := fun x => HP (fst x) (snd x);
+ FA := fun a b f => Prod_morph_ex _ _ (compose Pi_1 (fst f)) (compose Pi_2 (snd f))
+|}.
+
+Arguments Prod_Func _ _, _ {_}.
+
+Definition Sum (C : Category) := @Product (Opposite C).
+
+Arguments Sum _ _ _, {_} _ _.
+
+Definition Has_Sums (C : Category) : Type := forall (a b : C), (Sum a b).
+
+Existing Class Has_Sums.
+
+Program Definition sum_Sum (A B : Type) : (@Sum Type_Cat A B) :=
+{|
+ product := (A + B)%type;
+ Prod_morph_ex :=
+ fun (p' : Type)
+ (r1 : A -> p')
+ (r2 : B -> p')
+ (X : A + B) =>
+ match X return p' with
+ | inl a => r1 a
+ | inr b => r2 b
+ end
+|}.
+Next Obligation. simpl; auto. Defined.
+Next Obligation. simpl; auto. Defined.
+
+Program Instance Type_Cat_Has_Sums : Has_Sums Type_Cat := sum_Sum.
+
+Definition Sum_Func {C : Category} {HS : Has_Sums C} :
+ Functor (Prod_Cat C C) C := Opposite_Functor (Prod_Func (Opposite C) HS).
+
+Arguments Sum_Func _ _, _ {_}.
+
+Program Instance unit_Type_term : Terminal Type_Cat :=
+{
+ terminal := unit;
+ t_morph := fun _ _=> tt
+}.
+
+Next Obligation. Proof. Admitted.
+
+Program Definition term_id : Functor Type_Cat (Prod_Cat Type_Cat Type_Cat) :=
+{|
+ FO := fun a => (@terminal Type_Cat _, a);
+ FA := fun a b f => (@id _ (@terminal Type_Cat _), f)
+|}.
+
+Definition S_nat_func : Functor Type_Cat Type_Cat :=
+ Functor_compose term_id (Sum_Func Type_Cat _).
+
+Definition S_nat_alg_cat := Algebra_Cat S_nat_func.
+
+CoInductive CoNat : Set :=
+ | CoO : CoNat
+ | CoS : CoNat -> CoNat
+.
+
+Definition S_nat_coalg_cat := @CoAlgebra_Cat Type_Cat S_nat_func.
+
+Set Printing Universes.
+Program Definition CoNat_alg_term : Initial S_nat_coalg_cat :=
+{|
+ terminal := _;
+ t_morph := _
+|}.
+
+Next Obligation. Admitted.
+Next Obligation. Admitted.
+
+Axiom Admit : False.
+
+Next Obligation.
+Proof.
+ intros d f g.
+ assert(H1 := (@Alg_map_com _ _ _ _ f)). clear.
+ assert (inl tt = inr tt) by (exfalso; apply Admit).
+ discriminate.
+ all: exfalso; apply Admit.
+ Show Universes.
+Qed.
diff --git a/test-suite/bugs/closed/5215_2.v b/test-suite/bugs/closed/5215_2.v
new file mode 100644
index 000000000..399947f00
--- /dev/null
+++ b/test-suite/bugs/closed/5215_2.v
@@ -0,0 +1,8 @@
+Require Import Coq.Program.Tactics.
+Set Universe Polymorphism.
+Set Printing Universes.
+Definition typ := Type.
+
+Program Definition foo : typ := _ -> _.
+Next Obligation. Admitted.
+Next Obligation. exact typ. Show Proof. Show Universes. Defined.
diff --git a/test-suite/bugs/closed/5286.v b/test-suite/bugs/closed/5286.v
new file mode 100644
index 000000000..98d4e5c96
--- /dev/null
+++ b/test-suite/bugs/closed/5286.v
@@ -0,0 +1,9 @@
+Set Primitive Projections.
+
+CoInductive R := mkR { p : unit }.
+
+CoFixpoint foo := mkR tt.
+
+Check (eq_refl tt : p foo = tt).
+Check (eq_refl tt <: p foo = tt).
+Check (eq_refl tt <<: p foo = tt).
diff --git a/test-suite/bugs/closed/5347.v b/test-suite/bugs/closed/5347.v
new file mode 100644
index 000000000..9267b3eb6
--- /dev/null
+++ b/test-suite/bugs/closed/5347.v
@@ -0,0 +1,10 @@
+Set Universe Polymorphism.
+
+Axiom X : Type.
+(* Used to declare [x0@{u1 u2} : X@{u1}] and [x1@{} : X@{u2}] leaving
+ the type of x1 with undeclared universes. After PR #891 this should
+ error at declaration time. *)
+Axiom xâ‚€ xâ‚ : X.
+Axiom Xáµ¢ : X -> Type.
+
+Check Xáµ¢ xâ‚. (* conversion test raised anomaly universe undefined *)
diff --git a/test-suite/bugs/closed/5368.v b/test-suite/bugs/closed/5368.v
new file mode 100644
index 000000000..410fe1707
--- /dev/null
+++ b/test-suite/bugs/closed/5368.v
@@ -0,0 +1,6 @@
+Set Universe Polymorphism.
+
+Record cantype := {T:Type; op:T -> unit}.
+Canonical Structure test (P:Type) := {| T := P -> Type; op := fun _ => tt|}.
+
+Check (op _ ((fun (_:unit) => Set):_)).
diff --git a/test-suite/bugs/closed/5717.v b/test-suite/bugs/closed/5717.v
new file mode 100644
index 000000000..1bfd917d2
--- /dev/null
+++ b/test-suite/bugs/closed/5717.v
@@ -0,0 +1,5 @@
+Definition foo@{i} (A : Type@{i}) (l : list A) :=
+ match l with
+ | nil => nil
+ | cons _ t => t
+ end.
diff --git a/test-suite/bugs/closed/5761.v b/test-suite/bugs/closed/5761.v
new file mode 100644
index 000000000..6f28d1981
--- /dev/null
+++ b/test-suite/bugs/closed/5761.v
@@ -0,0 +1,126 @@
+Set Primitive Projections.
+Record mix := { a : nat ; b : a = a ; c : nat ; d : a = c ; e : nat ; f : nat }.
+Ltac strip_args T ctor :=
+ lazymatch type of ctor with
+ | context[T]
+ => match eval cbv beta in ctor with
+ | ?ctor _ => strip_args T ctor
+ | _ => ctor
+ end
+ end.
+Ltac get_ctor T :=
+ let full_ctor := constr:(ltac:(let x := fresh in intro x; econstructor; apply
+x) : T -> T) in
+ let ctor := constr:(fun x : T => ltac:(let v := strip_args T (full_ctor x) in
+exact v)) in
+ lazymatch ctor with
+ | fun _ => ?ctor => ctor
+ end.
+Ltac uncurry_domain f :=
+ lazymatch type of f with
+ | forall (a : ?A) (b : @ ?B a), _
+ => uncurry_domain (fun ab : { a : A & B a } => f (projT1 ab) (projT2 ab))
+ | _ => eval cbv beta in f
+ end.
+Ltac get_of_sigma T :=
+ let ctor := get_ctor T in
+ uncurry_domain ctor.
+Ltac repeat_existT :=
+ lazymatch goal with
+ | [ |- sigT _ ] => simple refine (existT _ _ _); [ repeat_existT | shelve ]
+ | _ => shelve
+ end.
+ Ltac prove_to_of_sigma_goal of_sigma :=
+ let v := fresh "v" in
+ simple refine (exist _ _ (fun v => _ : id _ (of_sigma v) = v));
+ try unfold of_sigma;
+ [ intro v; destruct v; repeat_existT
+ | cbv beta;
+ repeat match goal with
+ | [ |- context[projT2 ?k] ]
+ => let x := fresh "x" in
+ is_var k;
+ destruct k as [k x]; cbn [projT1 projT2]
+ end;
+ unfold id; reflexivity ].
+Ltac prove_to_of_sigma of_sigma :=
+ constr:(
+ ltac:(prove_to_of_sigma_goal of_sigma)
+ : { to_sigma : _ | forall v, id to_sigma (of_sigma v) = v }).
+Ltac get_to_sigma_gen of_sigma :=
+ let v := prove_to_of_sigma of_sigma in
+ eval hnf in (proj1_sig v).
+Ltac get_to_sigma T :=
+ let of_sigma := get_of_sigma T in
+ get_to_sigma_gen of_sigma.
+Definition to_sigma := ltac:(let v := get_to_sigma mix in exact v).
+(* Error:
+In nested Ltac calls to "get_to_sigma", "get_to_sigma_gen",
+"prove_to_of_sigma",
+"(_ : {to_sigma : _ | forall v, id to_sigma (of_sigma v) = v})" (with
+of_sigma:=fun
+ ab : {_
+ : {_
+ : {ab : {_ : {a : nat & a = a} & nat} &
+ projT1 (projT1 ab) = projT2 ab} & nat} & nat} =>
+ {|
+ a := projT1 (projT1 (projT1 (projT1 (projT1 ab))));
+ b := projT2 (projT1 (projT1 (projT1 (projT1 ab))));
+ c := projT2 (projT1 (projT1 (projT1 ab)));
+ d := projT2 (projT1 (projT1 ab));
+ e := projT2 (projT1 ab);
+ f := projT2 ab |}) and "prove_to_of_sigma_goal", last call failed.
+Anomaly "Uncaught exception Not_found." Please report at
+http://coq.inria.fr/bugs/.
+frame @ file "toplevel/coqtop.ml", line 640, characters 6-22
+frame @ file "list.ml", line 73, characters 12-15
+frame @ file "toplevel/vernac.ml", line 344, characters 2-13
+frame @ file "toplevel/vernac.ml", line 308, characters 14-75
+raise @ file "lib/exninfo.ml", line 63, characters 8-15
+frame @ file "lib/flags.ml", line 141, characters 19-40
+raise @ file "lib/exninfo.ml", line 63, characters 8-15
+frame @ file "lib/flags.ml", line 11, characters 15-18
+raise @ file "lib/exninfo.ml", line 63, characters 8-15
+frame @ file "toplevel/vernac.ml", line 167, characters 6-16
+frame @ file "toplevel/vernac.ml", line 151, characters 26-39
+frame @ file "stm/stm.ml", line 2365, characters 2-35
+raise @ file "lib/exninfo.ml", line 63, characters 8-15
+frame @ file "stm/stm.ml", line 2355, characters 4-48
+frame @ file "stm/stm.ml", line 2321, characters 4-100
+raise @ file "lib/exninfo.ml", line 63, characters 8-15
+frame @ file "stm/stm.ml", line 832, characters 6-10
+frame @ file "stm/stm.ml", line 2206, characters 10-32
+raise @ file "lib/exninfo.ml", line 63, characters 8-15
+frame @ file "stm/stm.ml", line 975, characters 8-81
+raise @ file "lib/exninfo.ml", line 63, characters 8-15
+frame @ file "vernac/vernacentries.ml", line 2216, characters 10-389
+frame @ file "lib/flags.ml", line 141, characters 19-40
+raise @ file "lib/exninfo.ml", line 63, characters 8-15
+frame @ file "lib/flags.ml", line 11, characters 15-18
+frame @ file "vernac/command.ml", line 150, characters 4-56
+frame @ file "interp/constrintern.ml", line 2046, characters 2-73
+frame @ file "pretyping/pretyping.ml", line 1194, characters 19-77
+frame @ file "pretyping/pretyping.ml", line 1155, characters 8-72
+frame @ file "pretyping/pretyping.ml", line 628, characters 23-65
+frame @ file "plugins/ltac/tacinterp.ml", line 2095, characters 21-61
+frame @ file "proofs/pfedit.ml", line 178, characters 6-22
+raise @ file "lib/exninfo.ml", line 63, characters 8-15
+frame @ file "proofs/pfedit.ml", line 174, characters 8-36
+frame @ file "proofs/proof.ml", line 351, characters 4-30
+raise @ file "lib/exninfo.ml", line 63, characters 8-15
+frame @ file "engine/proofview.ml", line 1222, characters 8-12
+frame @ file "plugins/ltac/tacinterp.ml", line 2020, characters 19-36
+frame @ file "plugins/ltac/tacinterp.ml", line 618, characters 4-70
+raise @ file "lib/exninfo.ml", line 63, characters 8-15
+frame @ file "plugins/ltac/tacinterp.ml", line 214, characters 6-9
+frame @ file "pretyping/pretyping.ml", line 1198, characters 19-62
+frame @ file "pretyping/pretyping.ml", line 1155, characters 8-72
+raise @ unknown
+frame @ file "pretyping/pretyping.ml", line 628, characters 23-65
+frame @ file "plugins/ltac/tacinterp.ml", line 2095, characters 21-61
+frame @ file "proofs/pfedit.ml", line 178, characters 6-22
+raise @ file "lib/exninfo.ml", line 63, characters 8-15
+frame @ file "proofs/pfedit.ml", line 174, characters 8-36
+frame @ file "proofs/proof.ml", line 351, characters 4-30
+raise @ file "lib/exninfo.ml", line 63, characters 8-15
+ *)
diff --git a/test-suite/bugs/closed/5762.v b/test-suite/bugs/closed/5762.v
index edd5c8d73..55d36bd72 100644
--- a/test-suite/bugs/closed/5762.v
+++ b/test-suite/bugs/closed/5762.v
@@ -26,3 +26,9 @@ Reserved Notation "%% a" (at level 70).
Record R :=
{g : forall {A} (a:A), a=a where "%% x" := (g x);
k : %% 0 = eq_refl}.
+
+(* An extra example *)
+
+Module A.
+Inductive I {A:Type} := C : # 0 -> I where "# I" := (I = I) : I_scope.
+End A.
diff --git a/test-suite/bugs/closed/5790.v b/test-suite/bugs/closed/5790.v
new file mode 100644
index 000000000..6c93a3906
--- /dev/null
+++ b/test-suite/bugs/closed/5790.v
@@ -0,0 +1,7 @@
+Set Universe Polymorphism.
+Section foo.
+Context (v : Type).
+Axiom a : True <-> False.
+
+Hint Resolve -> a.
+End foo.
diff --git a/test-suite/bugs/closed/6129.v b/test-suite/bugs/closed/6129.v
new file mode 100644
index 000000000..e4a2a2ba9
--- /dev/null
+++ b/test-suite/bugs/closed/6129.v
@@ -0,0 +1,9 @@
+(* Make definition of coercions compatible with local definitions. *)
+
+Record foo (x : Type) (y:=1) := { foo_nat :> nat }.
+Record foo2 (x : Type) (y:=1) (z t: Type) := { foo_nat2 :> nat }.
+Record foo3 (y:=1) (z t: Type) := { foo_nat3 :> nat }.
+
+Check fun x : foo nat => x + 1.
+Check fun x : foo2 nat nat nat => x + 1.
+Check fun x : foo3 nat nat => x + 1.
diff --git a/test-suite/bugs/closed/6191.v b/test-suite/bugs/closed/6191.v
new file mode 100644
index 000000000..e0d912509
--- /dev/null
+++ b/test-suite/bugs/closed/6191.v
@@ -0,0 +1,16 @@
+(* Check a 8.7.1 regression in ring_simplify *)
+
+Require Import ArithRing BinNat.
+Goal forall f x, (2+x+f (N.to_nat 2)+3=4).
+intros.
+ring_simplify (2+x+f (N.to_nat 2)+3).
+match goal with |- x + f (N.to_nat 2) + 5 = 4 => idtac end.
+Abort.
+
+Require Import ZArithRing BinInt.
+Open Scope Z_scope.
+Goal forall x, (2+x+3=4).
+intros.
+ring_simplify (2+x+3).
+match goal with |- x+5 = 4 => idtac end.
+Abort.
diff --git a/test-suite/bugs/closed/6297.v b/test-suite/bugs/closed/6297.v
new file mode 100644
index 000000000..a28607058
--- /dev/null
+++ b/test-suite/bugs/closed/6297.v
@@ -0,0 +1,8 @@
+Set Printing Universes.
+
+(* Error: Anomaly "Uncaught exception "Anomaly: Incorrect universe Set
+ declared for inductive type, inferred level is max(Prop, Set+1)."."
+ Please report at http://coq.inria.fr/bugs/. *)
+Fail Record LTS: Set :=
+ lts { St: Set;
+ init: St }.
diff --git a/test-suite/bugs/closed/6323.v b/test-suite/bugs/closed/6323.v
new file mode 100644
index 000000000..fdc33befc
--- /dev/null
+++ b/test-suite/bugs/closed/6323.v
@@ -0,0 +1,9 @@
+Goal True.
+ simple refine (let X : Type := _ in _);
+ [ abstract exact Set using Set'
+ | let X' := (eval cbv delta [X] in X) in
+ clear X;
+ simple refine (let id' : { x : X' | True } -> X' := _ in _);
+ [ abstract refine (@proj1_sig _ _) | ]
+ ].
+Abort.
diff --git a/test-suite/bugs/closed/6378.v b/test-suite/bugs/closed/6378.v
new file mode 100644
index 000000000..68ae7961d
--- /dev/null
+++ b/test-suite/bugs/closed/6378.v
@@ -0,0 +1,18 @@
+Require Import Coq.ZArith.ZArith.
+Ltac profile_constr tac :=
+ let dummy := match goal with _ => reset ltac profile; start ltac profiling end in
+ let ret := match goal with _ => tac () end in
+ let dummy := match goal with _ => stop ltac profiling; show ltac profile end in
+ pose 1.
+
+Ltac slow _ := eval vm_compute in (Z.div_eucl, Z.div_eucl, Z.div_eucl, Z.div_eucl, Z.div_eucl).
+
+Goal True.
+ start ltac profiling.
+ reset ltac profile.
+ reset ltac profile.
+ stop ltac profiling.
+ time profile_constr slow.
+ show ltac profile cutoff 0.
+ show ltac profile "slow".
+Abort.
diff --git a/test-suite/bugs/closed/6490.v b/test-suite/bugs/closed/6490.v
new file mode 100644
index 000000000..dcf9ff29e
--- /dev/null
+++ b/test-suite/bugs/closed/6490.v
@@ -0,0 +1,4 @@
+Inductive Foo (A' := I) (B : Type) := foo : Foo B.
+
+Goal Foo True. dtauto. Qed.
+Goal Foo True. firstorder. Qed.
diff --git a/test-suite/bugs/closed/6534.v b/test-suite/bugs/closed/6534.v
new file mode 100644
index 000000000..f5013994c
--- /dev/null
+++ b/test-suite/bugs/closed/6534.v
@@ -0,0 +1,7 @@
+Goal forall x : nat, x = x.
+Proof.
+intros x.
+refine ((fun x x => _ tt) tt tt).
+let t := match goal with [ |- ?P ] => P end in
+let _ := type of t in
+idtac.
diff --git a/test-suite/bugs/closed/6617.v b/test-suite/bugs/closed/6617.v
new file mode 100644
index 000000000..9cabd62d4
--- /dev/null
+++ b/test-suite/bugs/closed/6617.v
@@ -0,0 +1,34 @@
+Definition MR {T M : Type} :=
+fun (R : M -> M -> Prop) (m : T -> M) (x y : T) => R (m x) (m y).
+
+Set Primitive Projections.
+
+Record sigma {A : Type} {B : A -> Type} : Type := sigmaI
+ { pr1 : A; pr2 : B pr1 }.
+
+Axiom F : forall {A : Type} {R : A -> A -> Prop},
+ (forall x, (forall y, R y x -> unit) -> unit) -> forall (x : A), unit.
+
+Definition foo (A : Type) (l : list A) :=
+ let y := {| pr1 := A; pr2 := l |} in
+ let bar := MR lt (fun p : sigma =>
+ (fix Ffix (x : list (pr1 p)) : nat :=
+ match x with
+ | nil => 0
+ | cons _ x1 => S (Ffix x1)
+ end) (pr2 p)) in
+fun (_ : bar y y) =>
+F (fun (r : sigma)
+ (X : forall q : sigma, bar q r -> unit) => tt).
+
+Definition fooT (A : Type) (l : list A) : Type :=
+ ltac:(let ty := type of (foo A l) in exact ty).
+Parameter P : forall A l, fooT A l -> Prop.
+
+Goal forall A l, P A l (foo A l).
+Proof.
+ intros; unfold foo.
+ Fail match goal with
+ | [ |- context [False]] => idtac
+ end.
+Admitted.
diff --git a/test-suite/bugs/closed/HoTT_coq_064.v b/test-suite/bugs/closed/HoTT_coq_064.v
index b4c745375..d02a5f120 100644
--- a/test-suite/bugs/closed/HoTT_coq_064.v
+++ b/test-suite/bugs/closed/HoTT_coq_064.v
@@ -178,6 +178,7 @@ Definition IsColimit `{Funext} C D (F : Functor D C)
Generalizable All Variables.
Axiom fs : Funext.
+Existing Instance fs.
Section bar.
diff --git a/test-suite/bugs/closed/gh6165.v b/test-suite/bugs/closed/gh6165.v
new file mode 100644
index 000000000..b87a7caaf
--- /dev/null
+++ b/test-suite/bugs/closed/gh6165.v
@@ -0,0 +1,5 @@
+(* -*- mode: coq; coq-prog-args: ("-quick") -*- *)
+
+Goal True.
+ abstract exact I.
+Timeout 1 Defined.
diff --git a/test-suite/bugs/closed/gh6384.v b/test-suite/bugs/closed/gh6384.v
new file mode 100644
index 000000000..cec84642f
--- /dev/null
+++ b/test-suite/bugs/closed/gh6384.v
@@ -0,0 +1,5 @@
+Theorem test (A:Prop) : A \/ A -> A.
+ Fail intro H; destruct H as H.
+ (* Error: Disjunctive/conjunctive introduction pattern expected. *)
+ Fail intros H; destruct H as H.
+Abort.
diff --git a/test-suite/bugs/closed/gh6385.v b/test-suite/bugs/closed/gh6385.v
new file mode 100644
index 000000000..3bbb664f4
--- /dev/null
+++ b/test-suite/bugs/closed/gh6385.v
@@ -0,0 +1,5 @@
+Theorem test (A:Prop) : A \/ A -> A.
+ Fail let H := idtac in intros H; destruct H as H'.
+ (* Disjunctive/conjunctive introduction pattern expected. *)
+ Fail let H' := idtac in intros H; destruct H as H'.
+Abort.
diff --git a/test-suite/bugs/opened/4717.v b/test-suite/bugs/opened/4717.v
deleted file mode 100644
index 9ad474672..000000000
--- a/test-suite/bugs/opened/4717.v
+++ /dev/null
@@ -1,19 +0,0 @@
-(*See below. They sometimes work, and sometimes do not. Is this a bug?*)
-
-Require Import Omega Psatz.
-
-Definition foo := nat.
-
-Goal forall (n : foo), 0 = n - n.
-Proof. intros. omega. (* works *) Qed.
-
-Goal forall (x n : foo), x = x + n - n.
-Proof.
- intros.
- Fail omega. (* Omega can't solve this system *)
- Fail lia. (* Cannot find witness. *)
- unfold foo in *.
- omega. (* works *)
-Qed.
-
-(* Guillaume Melquiond: What matters is the equality. In the first case, it is @eq nat. In the second case, it is @eq foo. The same issue exists for ring and field. So it is not a bug, but it is worth fixing.*)
diff --git a/test-suite/bugs/opened/6393.v b/test-suite/bugs/opened/6393.v
new file mode 100644
index 000000000..8d5d09233
--- /dev/null
+++ b/test-suite/bugs/opened/6393.v
@@ -0,0 +1,11 @@
+(* These always worked. *)
+Goal prod True True. firstorder. Qed.
+Goal True -> @sigT True (fun _ => True). firstorder. Qed.
+Goal prod True True. dtauto. Qed.
+Goal prod True True. tauto. Qed.
+
+(* These should work. *)
+Goal @sigT True (fun _ => True). dtauto. Qed.
+(* These should work, but don't *)
+(* Goal @sigT True (fun _ => True). firstorder. Qed. *)
+(* Goal @sigT True (fun _ => True). tauto. Qed. *)
diff --git a/test-suite/coq-makefile/.gitignore b/test-suite/coq-makefile/.gitignore
new file mode 100644
index 000000000..e866161ce
--- /dev/null
+++ b/test-suite/coq-makefile/.gitignore
@@ -0,0 +1 @@
+/*/_test
diff --git a/test-suite/coq-makefile/plugin-reach-outside-API-and-fail/run.sh b/test-suite/coq-makefile/plugin-reach-outside-API-and-fail/run.sh
deleted file mode 100755
index 88606cd47..000000000
--- a/test-suite/coq-makefile/plugin-reach-outside-API-and-fail/run.sh
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/env bash
-
-set -e
-
-git clean -dfx
-
-cat > _CoqProject <<EOT
--I src/
-
-./src/test_plugin.mllib
-./src/test.ml4
-./src/test.mli
-EOT
-
-mkdir src
-
-cat > src/test_plugin.mllib <<EOT
-Test
-EOT
-
-touch src/test.mli
-
-cat > src/test.ml4 <<EOT
-DECLARE PLUGIN "test"
-
-let _ = Pre_env.empty_env
-EOT
-
-${COQBIN}coq_makefile -f _CoqProject -o Makefile
-cat Makefile.conf
-
-if make VERBOSE=1; then
- # make command should have failed (but didn't)
- exit 1
-else
- # make command should have failed (and it indeed did)
- exit 0
-fi
diff --git a/test-suite/coq-makefile/plugin-reach-outside-API-and-succeed-by-bypassing-the-API/run.sh b/test-suite/coq-makefile/plugin-reach-outside-API-and-succeed-by-bypassing-the-API/run.sh
deleted file mode 100755
index 939ef9c7b..000000000
--- a/test-suite/coq-makefile/plugin-reach-outside-API-and-succeed-by-bypassing-the-API/run.sh
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/usr/bin/env bash
-
-set -e
-
-git clean -dfx
-
-cat > _CoqProject <<EOT
--bypass-API
--I src/
-
-./src/test_plugin.mllib
-./src/test.ml4
-./src/test.mli
-EOT
-
-mkdir src
-
-cat > src/test_plugin.mllib <<EOT
-Test
-EOT
-
-touch src/test.mli
-
-cat > src/test.ml4 <<EOT
-DECLARE PLUGIN "test"
-
-let _ = Pre_env.empty_env
-EOT
-
-${COQBIN}coq_makefile -f _CoqProject -o Makefile
-cat Makefile.conf
-
-make VERBOSE=1
diff --git a/test-suite/coq-makefile/template/init.sh b/test-suite/coq-makefile/template/init.sh
index c4bd11c57..e19d168cf 100755
--- a/test-suite/coq-makefile/template/init.sh
+++ b/test-suite/coq-makefile/template/init.sh
@@ -1,19 +1,17 @@
-set -e
-set -o pipefail
+. ../template/path-init.sh
-export PATH=$COQBIN:$PATH
-export LC_ALL=C
-
-rm -rf theories src Makefile Makefile.conf tmp
-git clean -dfx || true
+rm -rf _test
+mkdir _test
+find . -maxdepth 1 -not -name . -not -name _test -exec cp -r '{}' -t _test ';'
+cd _test
mkdir -p src
mkdir -p theories/sub
-cp ../template/theories/sub/testsub.v theories/sub
-cp ../template/theories/test.v theories
-cp ../template/src/test.ml4 src
-cp ../template/src/test_aux.mli src
-cp ../template/src/test.mli src
-cp ../template/src/test_plugin.mlpack src
-cp ../template/src/test_aux.ml src
+cp ../../template/theories/sub/testsub.v theories/sub
+cp ../../template/theories/test.v theories
+cp ../../template/src/test.ml4 src
+cp ../../template/src/test_aux.mli src
+cp ../../template/src/test.mli src
+cp ../../template/src/test_plugin.mlpack src
+cp ../../template/src/test_aux.ml src
diff --git a/test-suite/coq-makefile/template/path-init.sh b/test-suite/coq-makefile/template/path-init.sh
new file mode 100755
index 000000000..dd19ab2b1
--- /dev/null
+++ b/test-suite/coq-makefile/template/path-init.sh
@@ -0,0 +1,5 @@
+set -e
+set -o pipefail
+
+export PATH="$COQBIN:$PATH"
+export LC_ALL=C
diff --git a/test-suite/coq-makefile/template/src/test.ml4 b/test-suite/coq-makefile/template/src/test.ml4
index e7d0bfe1f..72765abe0 100644
--- a/test-suite/coq-makefile/template/src/test.ml4
+++ b/test-suite/coq-makefile/template/src/test.ml4
@@ -1,4 +1,3 @@
-open API
open Ltac_plugin
DECLARE PLUGIN "test_plugin"
let () = Mltop.add_known_plugin (fun () -> ()) "test_plugin";;
diff --git a/test-suite/coq-makefile/template/src/test_aux.ml b/test-suite/coq-makefile/template/src/test_aux.ml
index e134abd84..a01d0865a 100644
--- a/test-suite/coq-makefile/template/src/test_aux.ml
+++ b/test-suite/coq-makefile/template/src/test_aux.ml
@@ -1 +1 @@
-let tac = API.Proofview.tclUNIT ()
+let tac = Proofview.tclUNIT ()
diff --git a/test-suite/coq-makefile/template/src/test_aux.mli b/test-suite/coq-makefile/template/src/test_aux.mli
index 2e7ad1529..10020f27d 100644
--- a/test-suite/coq-makefile/template/src/test_aux.mli
+++ b/test-suite/coq-makefile/template/src/test_aux.mli
@@ -1 +1 @@
-val tac : unit API.Proofview.tactic
+val tac : unit Proofview.tactic
diff --git a/test-suite/coq-makefile/timing/after/time-of-build-after.log.desired b/test-suite/coq-makefile/timing/after/time-of-build-after.log.desired
index 729de2f36..7900c034d 100644
--- a/test-suite/coq-makefile/timing/after/time-of-build-after.log.desired
+++ b/test-suite/coq-makefile/timing/after/time-of-build-after.log.desired
@@ -1,7 +1,6 @@
Makefile:69: warning: undefined variable '*'
Makefile:204: warning: undefined variable 'DSTROOT'
-COQDEP Fast.v
-COQDEP Slow.v
+COQDEP VFILES
Makefile:69: warning: undefined variable '*'
Makefile:204: warning: undefined variable 'DSTROOT'
Makefile:69: warning: undefined variable '*'
diff --git a/test-suite/coq-makefile/timing/after/time-of-build-before.log.desired b/test-suite/coq-makefile/timing/after/time-of-build-before.log.desired
index b25bc3683..7ab0bc75d 100644
--- a/test-suite/coq-makefile/timing/after/time-of-build-before.log.desired
+++ b/test-suite/coq-makefile/timing/after/time-of-build-before.log.desired
@@ -1,7 +1,6 @@
Makefile:69: warning: undefined variable '*'
Makefile:204: warning: undefined variable 'DSTROOT'
-COQDEP Fast.v
-COQDEP Slow.v
+COQDEP VFILES
Makefile:69: warning: undefined variable '*'
Makefile:204: warning: undefined variable 'DSTROOT'
Makefile:69: warning: undefined variable '*'
diff --git a/test-suite/coq-makefile/timing/precomputed-time-tests/.gitattributes b/test-suite/coq-makefile/timing/precomputed-time-tests/.gitattributes
new file mode 100644
index 000000000..e0596e614
--- /dev/null
+++ b/test-suite/coq-makefile/timing/precomputed-time-tests/.gitattributes
@@ -0,0 +1,2 @@
+*.log.in -whitespace
+*.log.expected -whitespace
diff --git a/test-suite/coq-makefile/timing/precomputed-time-tests/001-correct-diff-sorting-order/run.sh b/test-suite/coq-makefile/timing/precomputed-time-tests/001-correct-diff-sorting-order/run.sh
new file mode 100755
index 000000000..4a50759bd
--- /dev/null
+++ b/test-suite/coq-makefile/timing/precomputed-time-tests/001-correct-diff-sorting-order/run.sh
@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+
+set -x
+set -e
+
+cd "$(dirname "${BASH_SOURCE[0]}")"
+
+"$COQLIB"/tools/make-both-time-files.py time-of-build-after.log.in time-of-build-before.log.in time-of-build-both.log
+
+diff -u time-of-build-both.log.expected time-of-build-both.log || exit $?
diff --git a/test-suite/coq-makefile/timing/precomputed-time-tests/001-correct-diff-sorting-order/time-of-build-after.log.in b/test-suite/coq-makefile/timing/precomputed-time-tests/001-correct-diff-sorting-order/time-of-build-after.log.in
new file mode 100644
index 000000000..5757018e9
--- /dev/null
+++ b/test-suite/coq-makefile/timing/precomputed-time-tests/001-correct-diff-sorting-order/time-of-build-after.log.in
@@ -0,0 +1,1760 @@
+COQDEP src/Compilers/Z/Bounds/Pipeline/ReflectiveTactics.v
+COQDEP src/Compilers/Z/Bounds/Pipeline/Definition.v
+/home/jgross/.local64/coq/coq-master/bin/coq_makefile -f _CoqProject INSTALLDEFAULTROOT = Crypto -o Makefile-old
+COQ_MAKEFILE -f _CoqProject > Makefile.coq
+make --no-print-directory -C coqprime
+make[1]: Nothing to be done for 'all'.
+ECHO > _CoqProject
+COQC src/Compilers/Z/Bounds/Pipeline/Definition.v
+src/Compilers/Z/Bounds/Pipeline/Definition (real: 7.33, user: 7.18, sys: 0.14, mem: 574388 ko)
+COQC src/Compilers/Z/Bounds/Pipeline/ReflectiveTactics.v
+src/Compilers/Z/Bounds/Pipeline/ReflectiveTactics (real: 1.93, user: 1.72, sys: 0.20, mem: 544172 ko)
+COQC src/Compilers/Z/Bounds/Pipeline.v
+src/Compilers/Z/Bounds/Pipeline (real: 1.38, user: 1.19, sys: 0.16, mem: 539808 ko)
+COQC src/Specific/Framework/SynthesisFramework.v
+src/Specific/Framework/SynthesisFramework (real: 1.85, user: 1.67, sys: 0.17, mem: 646300 ko)
+COQC src/Specific/X25519/C64/Synthesis.v
+src/Specific/X25519/C64/Synthesis (real: 11.15, user: 10.37, sys: 0.18, mem: 687760 ko)
+COQC src/Specific/NISTP256/AMD64/Synthesis.v
+src/Specific/NISTP256/AMD64/Synthesis (real: 13.45, user: 12.55, sys: 0.19, mem: 668216 ko)
+COQC src/Specific/X25519/C64/feadd.v
+Finished transaction in 2.814 secs (2.624u,0.s) (successful)
+total time: 2.576s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.2% 97.4% 1 2.508s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 66.9% 1 1.724s
+─ReflectiveTactics.solve_side_conditions 0.0% 65.5% 1 1.688s
+─ReflectiveTactics.solve_post_reified_si 1.2% 37.0% 1 0.952s
+─Glue.refine_to_reflective_glue' ------- 0.0% 30.3% 1 0.780s
+─ReflectiveTactics.do_reify ------------ 0.0% 28.6% 1 0.736s
+─Reify.Reify_rhs_gen ------------------- 2.2% 26.6% 1 0.684s
+─UnifyAbstractReflexivity.unify_transfor 20.3% 24.1% 7 0.164s
+─Glue.zrange_to_reflective ------------- 0.0% 20.3% 1 0.524s
+─Glue.zrange_to_reflective_goal -------- 9.5% 15.2% 1 0.392s
+─Reify.do_reify_abs_goal --------------- 13.7% 13.8% 2 0.356s
+─Reify.do_reifyf_goal ------------------ 12.4% 12.6% 16 0.324s
+─ReflectiveTactics.unify_abstract_cbv_in 8.4% 11.2% 1 0.288s
+─unify (constr) (constr) --------------- 5.7% 5.7% 6 0.072s
+─Glue.pattern_sig_sig_assoc ------------ 0.0% 5.4% 1 0.140s
+─assert (H : is_bounded_by' bounds (map' 4.8% 5.1% 2 0.072s
+─Glue.pattern_proj1_sig_in_sig --------- 1.7% 5.1% 1 0.132s
+─pose proof (pf : Interpretation.Bo 3.7% 3.7% 1 0.096s
+─Glue.split_BoundedWordToZ ------------- 0.3% 3.7% 1 0.096s
+─destruct_sig -------------------------- 0.2% 3.3% 4 0.044s
+─destruct x ---------------------------- 3.1% 3.1% 4 0.036s
+─eexact -------------------------------- 3.0% 3.0% 18 0.008s
+─clearbody (ne_var_list) --------------- 3.0% 3.0% 4 0.060s
+─prove_interp_compile_correct ---------- 0.0% 2.8% 1 0.072s
+─synthesize ---------------------------- 0.0% 2.6% 1 0.068s
+─rewrite ?EtaInterp.InterpExprEta ------ 2.5% 2.5% 1 0.064s
+─ClearbodyAll.clearbody_all ------------ 0.0% 2.3% 2 0.060s
+─rewrite H ----------------------------- 2.2% 2.2% 1 0.056s
+─reflexivity --------------------------- 2.2% 2.2% 7 0.032s
+─Reify.transitivity_tt ----------------- 0.0% 2.2% 2 0.032s
+─transitivity -------------------------- 2.0% 2.0% 5 0.024s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.2% 97.4% 1 2.508s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 66.9% 1 1.724s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 65.5% 1 1.688s
+ │ ├─ReflectiveTactics.solve_post_reifie 1.2% 37.0% 1 0.952s
+ │ │ ├─UnifyAbstractReflexivity.unify_tr 20.3% 24.1% 7 0.164s
+ │ │ │└unify (constr) (constr) --------- 3.0% 3.0% 5 0.028s
+ │ │ └─ReflectiveTactics.unify_abstract_ 8.4% 11.2% 1 0.288s
+ │ │ └unify (constr) (constr) --------- 2.8% 2.8% 1 0.072s
+ │ └─ReflectiveTactics.do_reify -------- 0.0% 28.6% 1 0.736s
+ │ └Reify.Reify_rhs_gen --------------- 2.2% 26.6% 1 0.684s
+ │ ├─Reify.do_reify_abs_goal --------- 13.7% 13.8% 2 0.356s
+ │ │└Reify.do_reifyf_goal ------------ 12.4% 12.6% 16 0.324s
+ │ │└eexact -------------------------- 2.6% 2.6% 16 0.008s
+ │ ├─prove_interp_compile_correct ---- 0.0% 2.8% 1 0.072s
+ │ │└rewrite ?EtaInterp.InterpExprEta 2.5% 2.5% 1 0.064s
+ │ ├─rewrite H ----------------------- 2.2% 2.2% 1 0.056s
+ │ └─Reify.transitivity_tt ----------- 0.0% 2.2% 2 0.032s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 30.3% 1 0.780s
+ ├─Glue.zrange_to_reflective --------- 0.0% 20.3% 1 0.524s
+ │ ├─Glue.zrange_to_reflective_goal -- 9.5% 15.2% 1 0.392s
+ │ │└pose proof (pf : Interpretat 3.7% 3.7% 1 0.096s
+ │ └─assert (H : is_bounded_by' bounds 4.8% 5.1% 2 0.072s
+ ├─Glue.pattern_sig_sig_assoc -------- 0.0% 5.4% 1 0.140s
+ │└Glue.pattern_proj1_sig_in_sig ----- 1.7% 5.1% 1 0.132s
+ │└ClearbodyAll.clearbody_all -------- 0.0% 2.3% 2 0.060s
+ │└clearbody (ne_var_list) ----------- 2.3% 2.3% 1 0.060s
+ └─Glue.split_BoundedWordToZ --------- 0.3% 3.7% 1 0.096s
+ â””destruct_sig ---------------------- 0.2% 3.3% 4 0.044s
+ â””destruct x ------------------------ 2.5% 2.5% 2 0.036s
+─synthesize ---------------------------- 0.0% 2.6% 1 0.068s
+
+Finished transaction in 5.021 secs (4.636u,0.s) (successful)
+Closed under the global context
+total time: 2.576s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.2% 97.4% 1 2.508s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 66.9% 1 1.724s
+─ReflectiveTactics.solve_side_conditions 0.0% 65.5% 1 1.688s
+─ReflectiveTactics.solve_post_reified_si 1.2% 37.0% 1 0.952s
+─Glue.refine_to_reflective_glue' ------- 0.0% 30.3% 1 0.780s
+─ReflectiveTactics.do_reify ------------ 0.0% 28.6% 1 0.736s
+─Reify.Reify_rhs_gen ------------------- 2.2% 26.6% 1 0.684s
+─UnifyAbstractReflexivity.unify_transfor 20.3% 24.1% 7 0.164s
+─Glue.zrange_to_reflective ------------- 0.0% 20.3% 1 0.524s
+─Glue.zrange_to_reflective_goal -------- 9.5% 15.2% 1 0.392s
+─Reify.do_reify_abs_goal --------------- 13.7% 13.8% 2 0.356s
+─Reify.do_reifyf_goal ------------------ 12.4% 12.6% 16 0.324s
+─ReflectiveTactics.unify_abstract_cbv_in 8.4% 11.2% 1 0.288s
+─unify (constr) (constr) --------------- 5.7% 5.7% 6 0.072s
+─Glue.pattern_sig_sig_assoc ------------ 0.0% 5.4% 1 0.140s
+─assert (H : is_bounded_by' bounds (map' 4.8% 5.1% 2 0.072s
+─Glue.pattern_proj1_sig_in_sig --------- 1.7% 5.1% 1 0.132s
+─pose proof (pf : Interpretation.Bo 3.7% 3.7% 1 0.096s
+─Glue.split_BoundedWordToZ ------------- 0.3% 3.7% 1 0.096s
+─destruct_sig -------------------------- 0.2% 3.3% 4 0.044s
+─destruct x ---------------------------- 3.1% 3.1% 4 0.036s
+─eexact -------------------------------- 3.0% 3.0% 18 0.008s
+─clearbody (ne_var_list) --------------- 3.0% 3.0% 4 0.060s
+─prove_interp_compile_correct ---------- 0.0% 2.8% 1 0.072s
+─synthesize ---------------------------- 0.0% 2.6% 1 0.068s
+─rewrite ?EtaInterp.InterpExprEta ------ 2.5% 2.5% 1 0.064s
+─ClearbodyAll.clearbody_all ------------ 0.0% 2.3% 2 0.060s
+─rewrite H ----------------------------- 2.2% 2.2% 1 0.056s
+─reflexivity --------------------------- 2.2% 2.2% 7 0.032s
+─Reify.transitivity_tt ----------------- 0.0% 2.2% 2 0.032s
+─transitivity -------------------------- 2.0% 2.0% 5 0.024s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.2% 97.4% 1 2.508s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 66.9% 1 1.724s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 65.5% 1 1.688s
+ │ ├─ReflectiveTactics.solve_post_reifie 1.2% 37.0% 1 0.952s
+ │ │ ├─UnifyAbstractReflexivity.unify_tr 20.3% 24.1% 7 0.164s
+ │ │ │└unify (constr) (constr) --------- 3.0% 3.0% 5 0.028s
+ │ │ └─ReflectiveTactics.unify_abstract_ 8.4% 11.2% 1 0.288s
+ │ │ └unify (constr) (constr) --------- 2.8% 2.8% 1 0.072s
+ │ └─ReflectiveTactics.do_reify -------- 0.0% 28.6% 1 0.736s
+ │ └Reify.Reify_rhs_gen --------------- 2.2% 26.6% 1 0.684s
+ │ ├─Reify.do_reify_abs_goal --------- 13.7% 13.8% 2 0.356s
+ │ │└Reify.do_reifyf_goal ------------ 12.4% 12.6% 16 0.324s
+ │ │└eexact -------------------------- 2.6% 2.6% 16 0.008s
+ │ ├─prove_interp_compile_correct ---- 0.0% 2.8% 1 0.072s
+ │ │└rewrite ?EtaInterp.InterpExprEta 2.5% 2.5% 1 0.064s
+ │ ├─rewrite H ----------------------- 2.2% 2.2% 1 0.056s
+ │ └─Reify.transitivity_tt ----------- 0.0% 2.2% 2 0.032s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 30.3% 1 0.780s
+ ├─Glue.zrange_to_reflective --------- 0.0% 20.3% 1 0.524s
+ │ ├─Glue.zrange_to_reflective_goal -- 9.5% 15.2% 1 0.392s
+ │ │└pose proof (pf : Interpretat 3.7% 3.7% 1 0.096s
+ │ └─assert (H : is_bounded_by' bounds 4.8% 5.1% 2 0.072s
+ ├─Glue.pattern_sig_sig_assoc -------- 0.0% 5.4% 1 0.140s
+ │└Glue.pattern_proj1_sig_in_sig ----- 1.7% 5.1% 1 0.132s
+ │└ClearbodyAll.clearbody_all -------- 0.0% 2.3% 2 0.060s
+ │└clearbody (ne_var_list) ----------- 2.3% 2.3% 1 0.060s
+ └─Glue.split_BoundedWordToZ --------- 0.3% 3.7% 1 0.096s
+ â””destruct_sig ---------------------- 0.2% 3.3% 4 0.044s
+ â””destruct x ------------------------ 2.5% 2.5% 2 0.036s
+─synthesize ---------------------------- 0.0% 2.6% 1 0.068s
+
+src/Specific/X25519/C64/feadd (real: 22.81, user: 20.93, sys: 0.25, mem: 766300 ko)
+COQC src/Specific/X25519/C64/fecarry.v
+Finished transaction in 4.343 secs (4.016u,0.004s) (successful)
+total time: 3.976s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 99.0% 1 3.936s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 87.9% 1 3.496s
+─ReflectiveTactics.solve_side_conditions 0.0% 86.9% 1 3.456s
+─ReflectiveTactics.do_reify ------------ 0.0% 56.9% 1 2.264s
+─Reify.Reify_rhs_gen ------------------- 1.8% 56.2% 1 2.236s
+─Reify.do_reify_abs_goal --------------- 36.1% 36.5% 2 1.452s
+─Reify.do_reifyf_goal ------------------ 34.8% 35.1% 29 1.396s
+─ReflectiveTactics.solve_post_reified_si 0.6% 30.0% 1 1.192s
+─UnifyAbstractReflexivity.unify_transfor 17.7% 21.7% 7 0.240s
+─Glue.refine_to_reflective_glue' ------- 0.0% 11.1% 1 0.440s
+─eexact -------------------------------- 10.9% 10.9% 31 0.024s
+─ReflectiveTactics.unify_abstract_cbv_in 5.2% 7.3% 1 0.292s
+─Glue.zrange_to_reflective ------------- 0.0% 7.1% 1 0.284s
+─prove_interp_compile_correct ---------- 0.0% 5.7% 1 0.228s
+─Glue.zrange_to_reflective_goal -------- 4.3% 5.5% 1 0.220s
+─unify (constr) (constr) --------------- 5.3% 5.3% 6 0.084s
+─rewrite ?EtaInterp.InterpExprEta ------ 5.2% 5.2% 1 0.208s
+─rewrite H ----------------------------- 3.5% 3.5% 1 0.140s
+─tac ----------------------------------- 1.9% 2.6% 2 0.104s
+─reflexivity --------------------------- 2.2% 2.2% 7 0.028s
+─Reify.transitivity_tt ----------------- 0.0% 2.2% 2 0.056s
+─transitivity -------------------------- 2.0% 2.0% 5 0.048s
+─Glue.split_BoundedWordToZ ------------- 0.1% 2.0% 1 0.080s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 99.0% 1 3.936s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 87.9% 1 3.496s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 86.9% 1 3.456s
+ │ ├─ReflectiveTactics.do_reify -------- 0.0% 56.9% 1 2.264s
+ │ │└Reify.Reify_rhs_gen --------------- 1.8% 56.2% 1 2.236s
+ │ │ ├─Reify.do_reify_abs_goal --------- 36.1% 36.5% 2 1.452s
+ │ │ │└Reify.do_reifyf_goal ------------ 34.8% 35.1% 29 1.396s
+ │ │ │└eexact -------------------------- 10.1% 10.1% 29 0.024s
+ │ │ ├─prove_interp_compile_correct ---- 0.0% 5.7% 1 0.228s
+ │ │ │└rewrite ?EtaInterp.InterpExprEta 5.2% 5.2% 1 0.208s
+ │ │ ├─rewrite H ----------------------- 3.5% 3.5% 1 0.140s
+ │ │ ├─tac ----------------------------- 1.9% 2.6% 1 0.104s
+ │ │ └─Reify.transitivity_tt ----------- 0.0% 2.2% 2 0.056s
+ │ │ └transitivity -------------------- 2.0% 2.0% 4 0.048s
+ │ └─ReflectiveTactics.solve_post_reifie 0.6% 30.0% 1 1.192s
+ │ ├─UnifyAbstractReflexivity.unify_tr 17.7% 21.7% 7 0.240s
+ │ │└unify (constr) (constr) --------- 3.2% 3.2% 5 0.048s
+ │ └─ReflectiveTactics.unify_abstract_ 5.2% 7.3% 1 0.292s
+ │ └unify (constr) (constr) --------- 2.1% 2.1% 1 0.084s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 11.1% 1 0.440s
+ ├─Glue.zrange_to_reflective --------- 0.0% 7.1% 1 0.284s
+ │└Glue.zrange_to_reflective_goal ---- 4.3% 5.5% 1 0.220s
+ └─Glue.split_BoundedWordToZ --------- 0.1% 2.0% 1 0.080s
+
+Finished transaction in 7.078 secs (6.728u,0.s) (successful)
+Closed under the global context
+total time: 3.976s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 99.0% 1 3.936s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 87.9% 1 3.496s
+─ReflectiveTactics.solve_side_conditions 0.0% 86.9% 1 3.456s
+─ReflectiveTactics.do_reify ------------ 0.0% 56.9% 1 2.264s
+─Reify.Reify_rhs_gen ------------------- 1.8% 56.2% 1 2.236s
+─Reify.do_reify_abs_goal --------------- 36.1% 36.5% 2 1.452s
+─Reify.do_reifyf_goal ------------------ 34.8% 35.1% 29 1.396s
+─ReflectiveTactics.solve_post_reified_si 0.6% 30.0% 1 1.192s
+─UnifyAbstractReflexivity.unify_transfor 17.7% 21.7% 7 0.240s
+─Glue.refine_to_reflective_glue' ------- 0.0% 11.1% 1 0.440s
+─eexact -------------------------------- 10.9% 10.9% 31 0.024s
+─ReflectiveTactics.unify_abstract_cbv_in 5.2% 7.3% 1 0.292s
+─Glue.zrange_to_reflective ------------- 0.0% 7.1% 1 0.284s
+─prove_interp_compile_correct ---------- 0.0% 5.7% 1 0.228s
+─Glue.zrange_to_reflective_goal -------- 4.3% 5.5% 1 0.220s
+─unify (constr) (constr) --------------- 5.3% 5.3% 6 0.084s
+─rewrite ?EtaInterp.InterpExprEta ------ 5.2% 5.2% 1 0.208s
+─rewrite H ----------------------------- 3.5% 3.5% 1 0.140s
+─tac ----------------------------------- 1.9% 2.6% 2 0.104s
+─reflexivity --------------------------- 2.2% 2.2% 7 0.028s
+─Reify.transitivity_tt ----------------- 0.0% 2.2% 2 0.056s
+─transitivity -------------------------- 2.0% 2.0% 5 0.048s
+─Glue.split_BoundedWordToZ ------------- 0.1% 2.0% 1 0.080s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 99.0% 1 3.936s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 87.9% 1 3.496s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 86.9% 1 3.456s
+ │ ├─ReflectiveTactics.do_reify -------- 0.0% 56.9% 1 2.264s
+ │ │└Reify.Reify_rhs_gen --------------- 1.8% 56.2% 1 2.236s
+ │ │ ├─Reify.do_reify_abs_goal --------- 36.1% 36.5% 2 1.452s
+ │ │ │└Reify.do_reifyf_goal ------------ 34.8% 35.1% 29 1.396s
+ │ │ │└eexact -------------------------- 10.1% 10.1% 29 0.024s
+ │ │ ├─prove_interp_compile_correct ---- 0.0% 5.7% 1 0.228s
+ │ │ │└rewrite ?EtaInterp.InterpExprEta 5.2% 5.2% 1 0.208s
+ │ │ ├─rewrite H ----------------------- 3.5% 3.5% 1 0.140s
+ │ │ ├─tac ----------------------------- 1.9% 2.6% 1 0.104s
+ │ │ └─Reify.transitivity_tt ----------- 0.0% 2.2% 2 0.056s
+ │ │ └transitivity -------------------- 2.0% 2.0% 4 0.048s
+ │ └─ReflectiveTactics.solve_post_reifie 0.6% 30.0% 1 1.192s
+ │ ├─UnifyAbstractReflexivity.unify_tr 17.7% 21.7% 7 0.240s
+ │ │└unify (constr) (constr) --------- 3.2% 3.2% 5 0.048s
+ │ └─ReflectiveTactics.unify_abstract_ 5.2% 7.3% 1 0.292s
+ │ └unify (constr) (constr) --------- 2.1% 2.1% 1 0.084s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 11.1% 1 0.440s
+ ├─Glue.zrange_to_reflective --------- 0.0% 7.1% 1 0.284s
+ │└Glue.zrange_to_reflective_goal ---- 4.3% 5.5% 1 0.220s
+ └─Glue.split_BoundedWordToZ --------- 0.1% 2.0% 1 0.080s
+
+src/Specific/X25519/C64/fecarry (real: 27.11, user: 24.99, sys: 0.21, mem: 786052 ko)
+COQC src/Specific/solinas32_2e255m765_12limbs/Synthesis.v
+src/Specific/solinas32_2e255m765_12limbs/Synthesis (real: 40.13, user: 36.92, sys: 0.26, mem: 728464 ko)
+COQC src/Specific/solinas32_2e255m765_13limbs/Synthesis.v
+src/Specific/solinas32_2e255m765_13limbs/Synthesis (real: 49.44, user: 45.75, sys: 0.18, mem: 744240 ko)
+COQC src/Specific/X25519/C64/femul.v
+Finished transaction in 8.415 secs (7.664u,0.015s) (successful)
+total time: 7.616s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 94.8% 1 7.220s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 85.0% 1 6.476s
+─ReflectiveTactics.solve_side_conditions 0.0% 84.2% 1 6.416s
+─ReflectiveTactics.do_reify ------------ 0.0% 50.3% 1 3.832s
+─Reify.Reify_rhs_gen ------------------- 1.8% 49.4% 1 3.760s
+─ReflectiveTactics.solve_post_reified_si 0.5% 33.9% 1 2.584s
+─Reify.do_reify_abs_goal --------------- 31.1% 31.4% 2 2.392s
+─Reify.do_reifyf_goal ------------------ 30.0% 30.3% 58 1.528s
+─UnifyAbstractReflexivity.unify_transfor 22.1% 27.3% 7 0.600s
+─Glue.refine_to_reflective_glue' ------- 0.0% 9.8% 1 0.744s
+─eexact -------------------------------- 8.2% 8.2% 60 0.024s
+─Glue.zrange_to_reflective ------------- 0.1% 6.8% 1 0.516s
+─unify (constr) (constr) --------------- 5.9% 5.9% 6 0.124s
+─prove_interp_compile_correct ---------- 0.0% 5.8% 1 0.444s
+─ReflectiveTactics.unify_abstract_cbv_in 3.9% 5.7% 1 0.432s
+─rewrite ?EtaInterp.InterpExprEta ------ 5.4% 5.4% 1 0.408s
+─synthesize ---------------------------- 0.0% 5.2% 1 0.396s
+─Glue.zrange_to_reflective_goal -------- 3.0% 5.0% 1 0.384s
+─IntegrationTestTemporaryMiscCommon.do_r 0.1% 4.8% 1 0.364s
+─change G' ----------------------------- 3.9% 3.9% 1 0.300s
+─rewrite H ----------------------------- 3.0% 3.0% 1 0.232s
+─tac ----------------------------------- 1.5% 2.3% 2 0.176s
+─Reify.transitivity_tt ----------------- 0.0% 2.1% 2 0.092s
+─reflexivity --------------------------- 2.0% 2.0% 7 0.052s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 94.8% 1 7.220s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 85.0% 1 6.476s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 84.2% 1 6.416s
+ │ ├─ReflectiveTactics.do_reify -------- 0.0% 50.3% 1 3.832s
+ │ │└Reify.Reify_rhs_gen --------------- 1.8% 49.4% 1 3.760s
+ │ │ ├─Reify.do_reify_abs_goal --------- 31.1% 31.4% 2 2.392s
+ │ │ │└Reify.do_reifyf_goal ------------ 30.0% 30.3% 58 1.528s
+ │ │ │└eexact -------------------------- 7.6% 7.6% 58 0.020s
+ │ │ ├─prove_interp_compile_correct ---- 0.0% 5.8% 1 0.444s
+ │ │ │└rewrite ?EtaInterp.InterpExprEta 5.4% 5.4% 1 0.408s
+ │ │ ├─rewrite H ----------------------- 3.0% 3.0% 1 0.232s
+ │ │ ├─tac ----------------------------- 1.5% 2.3% 1 0.176s
+ │ │ └─Reify.transitivity_tt ----------- 0.0% 2.1% 2 0.092s
+ │ └─ReflectiveTactics.solve_post_reifie 0.5% 33.9% 1 2.584s
+ │ ├─UnifyAbstractReflexivity.unify_tr 22.1% 27.3% 7 0.600s
+ │ │└unify (constr) (constr) --------- 4.3% 4.3% 5 0.096s
+ │ └─ReflectiveTactics.unify_abstract_ 3.9% 5.7% 1 0.432s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 9.8% 1 0.744s
+ â””Glue.zrange_to_reflective ----------- 0.1% 6.8% 1 0.516s
+ â””Glue.zrange_to_reflective_goal ------ 3.0% 5.0% 1 0.384s
+─synthesize ---------------------------- 0.0% 5.2% 1 0.396s
+â””IntegrationTestTemporaryMiscCommon.do_r 0.1% 4.8% 1 0.364s
+â””change G' ----------------------------- 3.9% 3.9% 1 0.300s
+
+Finished transaction in 14.616 secs (13.528u,0.008s) (successful)
+Closed under the global context
+total time: 7.616s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 94.8% 1 7.220s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 85.0% 1 6.476s
+─ReflectiveTactics.solve_side_conditions 0.0% 84.2% 1 6.416s
+─ReflectiveTactics.do_reify ------------ 0.0% 50.3% 1 3.832s
+─Reify.Reify_rhs_gen ------------------- 1.8% 49.4% 1 3.760s
+─ReflectiveTactics.solve_post_reified_si 0.5% 33.9% 1 2.584s
+─Reify.do_reify_abs_goal --------------- 31.1% 31.4% 2 2.392s
+─Reify.do_reifyf_goal ------------------ 30.0% 30.3% 58 1.528s
+─UnifyAbstractReflexivity.unify_transfor 22.1% 27.3% 7 0.600s
+─Glue.refine_to_reflective_glue' ------- 0.0% 9.8% 1 0.744s
+─eexact -------------------------------- 8.2% 8.2% 60 0.024s
+─Glue.zrange_to_reflective ------------- 0.1% 6.8% 1 0.516s
+─unify (constr) (constr) --------------- 5.9% 5.9% 6 0.124s
+─prove_interp_compile_correct ---------- 0.0% 5.8% 1 0.444s
+─ReflectiveTactics.unify_abstract_cbv_in 3.9% 5.7% 1 0.432s
+─rewrite ?EtaInterp.InterpExprEta ------ 5.4% 5.4% 1 0.408s
+─synthesize ---------------------------- 0.0% 5.2% 1 0.396s
+─Glue.zrange_to_reflective_goal -------- 3.0% 5.0% 1 0.384s
+─IntegrationTestTemporaryMiscCommon.do_r 0.1% 4.8% 1 0.364s
+─change G' ----------------------------- 3.9% 3.9% 1 0.300s
+─rewrite H ----------------------------- 3.0% 3.0% 1 0.232s
+─tac ----------------------------------- 1.5% 2.3% 2 0.176s
+─Reify.transitivity_tt ----------------- 0.0% 2.1% 2 0.092s
+─reflexivity --------------------------- 2.0% 2.0% 7 0.052s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 94.8% 1 7.220s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 85.0% 1 6.476s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 84.2% 1 6.416s
+ │ ├─ReflectiveTactics.do_reify -------- 0.0% 50.3% 1 3.832s
+ │ │└Reify.Reify_rhs_gen --------------- 1.8% 49.4% 1 3.760s
+ │ │ ├─Reify.do_reify_abs_goal --------- 31.1% 31.4% 2 2.392s
+ │ │ │└Reify.do_reifyf_goal ------------ 30.0% 30.3% 58 1.528s
+ │ │ │└eexact -------------------------- 7.6% 7.6% 58 0.020s
+ │ │ ├─prove_interp_compile_correct ---- 0.0% 5.8% 1 0.444s
+ │ │ │└rewrite ?EtaInterp.InterpExprEta 5.4% 5.4% 1 0.408s
+ │ │ ├─rewrite H ----------------------- 3.0% 3.0% 1 0.232s
+ │ │ ├─tac ----------------------------- 1.5% 2.3% 1 0.176s
+ │ │ └─Reify.transitivity_tt ----------- 0.0% 2.1% 2 0.092s
+ │ └─ReflectiveTactics.solve_post_reifie 0.5% 33.9% 1 2.584s
+ │ ├─UnifyAbstractReflexivity.unify_tr 22.1% 27.3% 7 0.600s
+ │ │└unify (constr) (constr) --------- 4.3% 4.3% 5 0.096s
+ │ └─ReflectiveTactics.unify_abstract_ 3.9% 5.7% 1 0.432s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 9.8% 1 0.744s
+ â””Glue.zrange_to_reflective ----------- 0.1% 6.8% 1 0.516s
+ â””Glue.zrange_to_reflective_goal ------ 3.0% 5.0% 1 0.384s
+─synthesize ---------------------------- 0.0% 5.2% 1 0.396s
+â””IntegrationTestTemporaryMiscCommon.do_r 0.1% 4.8% 1 0.364s
+â””change G' ----------------------------- 3.9% 3.9% 1 0.300s
+
+src/Specific/X25519/C64/femul (real: 39.72, user: 36.32, sys: 0.26, mem: 825448 ko)
+COQC src/Specific/X25519/C64/feaddDisplay > src/Specific/X25519/C64/feaddDisplay.log
+COQC src/Specific/X25519/C64/fecarryDisplay > src/Specific/X25519/C64/fecarryDisplay.log
+COQC src/Specific/X25519/C64/fesub.v
+Finished transaction in 3.513 secs (3.211u,0.s) (successful)
+total time: 3.164s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 97.6% 1 3.088s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 74.1% 1 2.344s
+─ReflectiveTactics.solve_side_conditions 0.0% 72.9% 1 2.308s
+─ReflectiveTactics.do_reify ------------ 0.0% 38.6% 1 1.220s
+─Reify.Reify_rhs_gen ------------------- 1.5% 37.2% 1 1.176s
+─ReflectiveTactics.solve_post_reified_si 0.9% 34.4% 1 1.088s
+─UnifyAbstractReflexivity.unify_transfor 19.2% 23.9% 7 0.204s
+─Glue.refine_to_reflective_glue' ------- 0.0% 23.5% 1 0.744s
+─Reify.do_reify_abs_goal --------------- 19.2% 19.5% 2 0.616s
+─Reify.do_reifyf_goal ------------------ 18.0% 18.3% 16 0.580s
+─Glue.zrange_to_reflective ------------- 0.1% 15.4% 1 0.488s
+─Glue.zrange_to_reflective_goal -------- 6.8% 11.5% 1 0.364s
+─ReflectiveTactics.unify_abstract_cbv_in 6.2% 9.0% 1 0.284s
+─unify (constr) (constr) --------------- 5.9% 5.9% 6 0.080s
+─Glue.pattern_sig_sig_assoc ------------ 0.0% 4.6% 1 0.144s
+─eexact -------------------------------- 4.4% 4.4% 18 0.012s
+─Glue.pattern_proj1_sig_in_sig --------- 1.4% 4.3% 1 0.136s
+─prove_interp_compile_correct ---------- 0.0% 3.9% 1 0.124s
+─rewrite H ----------------------------- 3.8% 3.8% 1 0.120s
+─assert (H : is_bounded_by' bounds (map' 3.8% 3.8% 2 0.064s
+─rewrite ?EtaInterp.InterpExprEta ------ 3.5% 3.5% 1 0.112s
+─pose proof (pf : Interpretation.Bo 2.9% 2.9% 1 0.092s
+─Glue.split_BoundedWordToZ ------------- 0.1% 2.8% 1 0.088s
+─tac ----------------------------------- 1.9% 2.5% 2 0.080s
+─reflexivity --------------------------- 2.4% 2.4% 7 0.028s
+─synthesize ---------------------------- 0.0% 2.4% 1 0.076s
+─destruct_sig -------------------------- 0.0% 2.4% 4 0.040s
+─destruct x ---------------------------- 2.4% 2.4% 4 0.032s
+─clearbody (ne_var_list) --------------- 2.3% 2.3% 4 0.060s
+─Reify.transitivity_tt ----------------- 0.1% 2.3% 2 0.036s
+─transitivity -------------------------- 2.1% 2.1% 5 0.032s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 97.6% 1 3.088s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 74.1% 1 2.344s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 72.9% 1 2.308s
+ │ ├─ReflectiveTactics.do_reify -------- 0.0% 38.6% 1 1.220s
+ │ │└Reify.Reify_rhs_gen --------------- 1.5% 37.2% 1 1.176s
+ │ │ ├─Reify.do_reify_abs_goal --------- 19.2% 19.5% 2 0.616s
+ │ │ │└Reify.do_reifyf_goal ------------ 18.0% 18.3% 16 0.580s
+ │ │ │└eexact -------------------------- 3.9% 3.9% 16 0.012s
+ │ │ ├─prove_interp_compile_correct ---- 0.0% 3.9% 1 0.124s
+ │ │ │└rewrite ?EtaInterp.InterpExprEta 3.5% 3.5% 1 0.112s
+ │ │ ├─rewrite H ----------------------- 3.8% 3.8% 1 0.120s
+ │ │ ├─tac ----------------------------- 1.9% 2.5% 1 0.080s
+ │ │ └─Reify.transitivity_tt ----------- 0.1% 2.3% 2 0.036s
+ │ │ └transitivity -------------------- 2.0% 2.0% 4 0.032s
+ │ └─ReflectiveTactics.solve_post_reifie 0.9% 34.4% 1 1.088s
+ │ ├─UnifyAbstractReflexivity.unify_tr 19.2% 23.9% 7 0.204s
+ │ │└unify (constr) (constr) --------- 3.4% 3.4% 5 0.036s
+ │ └─ReflectiveTactics.unify_abstract_ 6.2% 9.0% 1 0.284s
+ │ └unify (constr) (constr) --------- 2.5% 2.5% 1 0.080s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 23.5% 1 0.744s
+ ├─Glue.zrange_to_reflective --------- 0.1% 15.4% 1 0.488s
+ │ ├─Glue.zrange_to_reflective_goal -- 6.8% 11.5% 1 0.364s
+ │ │└pose proof (pf : Interpretat 2.9% 2.9% 1 0.092s
+ │ └─assert (H : is_bounded_by' bounds 3.8% 3.8% 2 0.064s
+ ├─Glue.pattern_sig_sig_assoc -------- 0.0% 4.6% 1 0.144s
+ │└Glue.pattern_proj1_sig_in_sig ----- 1.4% 4.3% 1 0.136s
+ └─Glue.split_BoundedWordToZ --------- 0.1% 2.8% 1 0.088s
+ â””destruct_sig ---------------------- 0.0% 2.4% 4 0.040s
+─synthesize ---------------------------- 0.0% 2.4% 1 0.076s
+
+Finished transaction in 6.12 secs (5.64u,0.008s) (successful)
+Closed under the global context
+total time: 3.164s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 97.6% 1 3.088s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 74.1% 1 2.344s
+─ReflectiveTactics.solve_side_conditions 0.0% 72.9% 1 2.308s
+─ReflectiveTactics.do_reify ------------ 0.0% 38.6% 1 1.220s
+─Reify.Reify_rhs_gen ------------------- 1.5% 37.2% 1 1.176s
+─ReflectiveTactics.solve_post_reified_si 0.9% 34.4% 1 1.088s
+─UnifyAbstractReflexivity.unify_transfor 19.2% 23.9% 7 0.204s
+─Glue.refine_to_reflective_glue' ------- 0.0% 23.5% 1 0.744s
+─Reify.do_reify_abs_goal --------------- 19.2% 19.5% 2 0.616s
+─Reify.do_reifyf_goal ------------------ 18.0% 18.3% 16 0.580s
+─Glue.zrange_to_reflective ------------- 0.1% 15.4% 1 0.488s
+─Glue.zrange_to_reflective_goal -------- 6.8% 11.5% 1 0.364s
+─ReflectiveTactics.unify_abstract_cbv_in 6.2% 9.0% 1 0.284s
+─unify (constr) (constr) --------------- 5.9% 5.9% 6 0.080s
+─Glue.pattern_sig_sig_assoc ------------ 0.0% 4.6% 1 0.144s
+─eexact -------------------------------- 4.4% 4.4% 18 0.012s
+─Glue.pattern_proj1_sig_in_sig --------- 1.4% 4.3% 1 0.136s
+─prove_interp_compile_correct ---------- 0.0% 3.9% 1 0.124s
+─rewrite H ----------------------------- 3.8% 3.8% 1 0.120s
+─assert (H : is_bounded_by' bounds (map' 3.8% 3.8% 2 0.064s
+─rewrite ?EtaInterp.InterpExprEta ------ 3.5% 3.5% 1 0.112s
+─pose proof (pf : Interpretation.Bo 2.9% 2.9% 1 0.092s
+─Glue.split_BoundedWordToZ ------------- 0.1% 2.8% 1 0.088s
+─tac ----------------------------------- 1.9% 2.5% 2 0.080s
+─reflexivity --------------------------- 2.4% 2.4% 7 0.028s
+─synthesize ---------------------------- 0.0% 2.4% 1 0.076s
+─destruct_sig -------------------------- 0.0% 2.4% 4 0.040s
+─destruct x ---------------------------- 2.4% 2.4% 4 0.032s
+─clearbody (ne_var_list) --------------- 2.3% 2.3% 4 0.060s
+─Reify.transitivity_tt ----------------- 0.1% 2.3% 2 0.036s
+─transitivity -------------------------- 2.1% 2.1% 5 0.032s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 97.6% 1 3.088s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 74.1% 1 2.344s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 72.9% 1 2.308s
+ │ ├─ReflectiveTactics.do_reify -------- 0.0% 38.6% 1 1.220s
+ │ │└Reify.Reify_rhs_gen --------------- 1.5% 37.2% 1 1.176s
+ │ │ ├─Reify.do_reify_abs_goal --------- 19.2% 19.5% 2 0.616s
+ │ │ │└Reify.do_reifyf_goal ------------ 18.0% 18.3% 16 0.580s
+ │ │ │└eexact -------------------------- 3.9% 3.9% 16 0.012s
+ │ │ ├─prove_interp_compile_correct ---- 0.0% 3.9% 1 0.124s
+ │ │ │└rewrite ?EtaInterp.InterpExprEta 3.5% 3.5% 1 0.112s
+ │ │ ├─rewrite H ----------------------- 3.8% 3.8% 1 0.120s
+ │ │ ├─tac ----------------------------- 1.9% 2.5% 1 0.080s
+ │ │ └─Reify.transitivity_tt ----------- 0.1% 2.3% 2 0.036s
+ │ │ └transitivity -------------------- 2.0% 2.0% 4 0.032s
+ │ └─ReflectiveTactics.solve_post_reifie 0.9% 34.4% 1 1.088s
+ │ ├─UnifyAbstractReflexivity.unify_tr 19.2% 23.9% 7 0.204s
+ │ │└unify (constr) (constr) --------- 3.4% 3.4% 5 0.036s
+ │ └─ReflectiveTactics.unify_abstract_ 6.2% 9.0% 1 0.284s
+ │ └unify (constr) (constr) --------- 2.5% 2.5% 1 0.080s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 23.5% 1 0.744s
+ ├─Glue.zrange_to_reflective --------- 0.1% 15.4% 1 0.488s
+ │ ├─Glue.zrange_to_reflective_goal -- 6.8% 11.5% 1 0.364s
+ │ │└pose proof (pf : Interpretat 2.9% 2.9% 1 0.092s
+ │ └─assert (H : is_bounded_by' bounds 3.8% 3.8% 2 0.064s
+ ├─Glue.pattern_sig_sig_assoc -------- 0.0% 4.6% 1 0.144s
+ │└Glue.pattern_proj1_sig_in_sig ----- 1.4% 4.3% 1 0.136s
+ └─Glue.split_BoundedWordToZ --------- 0.1% 2.8% 1 0.088s
+ â””destruct_sig ---------------------- 0.0% 2.4% 4 0.040s
+─synthesize ---------------------------- 0.0% 2.4% 1 0.076s
+
+src/Specific/X25519/C64/fesub (real: 24.71, user: 22.65, sys: 0.24, mem: 778792 ko)
+COQC src/Specific/X25519/C64/fesquare.v
+Finished transaction in 6.132 secs (5.516u,0.012s) (successful)
+total time: 5.480s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize ---------------------------- -0.0% 100.0% 1 5.480s
+─Pipeline.refine_reflectively_gen ------ 0.0% 95.7% 1 5.244s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 88.6% 1 4.856s
+─ReflectiveTactics.solve_side_conditions 0.0% 87.7% 1 4.804s
+─ReflectiveTactics.do_reify ------------ 0.0% 53.3% 1 2.920s
+─Reify.Reify_rhs_gen ------------------- 2.0% 52.5% 1 2.876s
+─ReflectiveTactics.solve_post_reified_si 0.6% 34.4% 1 1.884s
+─Reify.do_reify_abs_goal --------------- 33.2% 33.6% 2 1.844s
+─Reify.do_reifyf_goal ------------------ 31.5% 32.0% 47 1.392s
+─UnifyAbstractReflexivity.unify_transfor 21.9% 26.6% 7 0.400s
+─eexact -------------------------------- 10.0% 10.0% 49 0.028s
+─Glue.refine_to_reflective_glue' ------- 0.0% 7.1% 1 0.388s
+─ReflectiveTactics.unify_abstract_cbv_in 5.0% 6.9% 1 0.380s
+─unify (constr) (constr) --------------- 5.8% 5.8% 6 0.104s
+─prove_interp_compile_correct ---------- 0.0% 5.8% 1 0.316s
+─rewrite ?EtaInterp.InterpExprEta ------ 5.3% 5.3% 1 0.288s
+─Glue.zrange_to_reflective ------------- 0.1% 5.1% 1 0.280s
+─IntegrationTestTemporaryMiscCommon.do_r 0.1% 4.0% 1 0.220s
+─Glue.zrange_to_reflective_goal -------- 3.1% 3.9% 1 0.212s
+─change G' ----------------------------- 3.4% 3.4% 1 0.184s
+─tac ----------------------------------- 2.0% 2.8% 2 0.156s
+─rewrite H ----------------------------- 2.8% 2.8% 1 0.156s
+─reflexivity --------------------------- 2.8% 2.8% 7 0.064s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize ---------------------------- -0.0% 100.0% 1 5.480s
+ ├─Pipeline.refine_reflectively_gen ---- 0.0% 95.7% 1 5.244s
+ │ ├─ReflectiveTactics.do_reflective_pip 0.0% 88.6% 1 4.856s
+ │ │└ReflectiveTactics.solve_side_condit 0.0% 87.7% 1 4.804s
+ │ │ ├─ReflectiveTactics.do_reify ------ 0.0% 53.3% 1 2.920s
+ │ │ │└Reify.Reify_rhs_gen ------------- 2.0% 52.5% 1 2.876s
+ │ │ │ ├─Reify.do_reify_abs_goal ------- 33.2% 33.6% 2 1.844s
+ │ │ │ │└Reify.do_reifyf_goal ---------- 31.5% 32.0% 47 1.392s
+ │ │ │ │└eexact ------------------------ 9.1% 9.1% 47 0.024s
+ │ │ │ ├─prove_interp_compile_correct -- 0.0% 5.8% 1 0.316s
+ │ │ │ │└rewrite ?EtaInterp.InterpExprEt 5.3% 5.3% 1 0.288s
+ │ │ │ ├─tac --------------------------- 2.0% 2.8% 1 0.156s
+ │ │ │ └─rewrite H --------------------- 2.8% 2.8% 1 0.156s
+ │ │ └─ReflectiveTactics.solve_post_reif 0.6% 34.4% 1 1.884s
+ │ │ ├─UnifyAbstractReflexivity.unify_ 21.9% 26.6% 7 0.400s
+ │ │ │└unify (constr) (constr) ------- 3.9% 3.9% 5 0.072s
+ │ │ └─ReflectiveTactics.unify_abstrac 5.0% 6.9% 1 0.380s
+ │ └─Glue.refine_to_reflective_glue' --- 0.0% 7.1% 1 0.388s
+ │ └Glue.zrange_to_reflective --------- 0.1% 5.1% 1 0.280s
+ │ └Glue.zrange_to_reflective_goal ---- 3.1% 3.9% 1 0.212s
+ └─IntegrationTestTemporaryMiscCommon.do 0.1% 4.0% 1 0.220s
+ â””change G' --------------------------- 3.4% 3.4% 1 0.184s
+
+Finished transaction in 10.475 secs (9.728u,0.007s) (successful)
+Closed under the global context
+total time: 5.480s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize ---------------------------- -0.0% 100.0% 1 5.480s
+─Pipeline.refine_reflectively_gen ------ 0.0% 95.7% 1 5.244s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 88.6% 1 4.856s
+─ReflectiveTactics.solve_side_conditions 0.0% 87.7% 1 4.804s
+─ReflectiveTactics.do_reify ------------ 0.0% 53.3% 1 2.920s
+─Reify.Reify_rhs_gen ------------------- 2.0% 52.5% 1 2.876s
+─ReflectiveTactics.solve_post_reified_si 0.6% 34.4% 1 1.884s
+─Reify.do_reify_abs_goal --------------- 33.2% 33.6% 2 1.844s
+─Reify.do_reifyf_goal ------------------ 31.5% 32.0% 47 1.392s
+─UnifyAbstractReflexivity.unify_transfor 21.9% 26.6% 7 0.400s
+─eexact -------------------------------- 10.0% 10.0% 49 0.028s
+─Glue.refine_to_reflective_glue' ------- 0.0% 7.1% 1 0.388s
+─ReflectiveTactics.unify_abstract_cbv_in 5.0% 6.9% 1 0.380s
+─unify (constr) (constr) --------------- 5.8% 5.8% 6 0.104s
+─prove_interp_compile_correct ---------- 0.0% 5.8% 1 0.316s
+─rewrite ?EtaInterp.InterpExprEta ------ 5.3% 5.3% 1 0.288s
+─Glue.zrange_to_reflective ------------- 0.1% 5.1% 1 0.280s
+─IntegrationTestTemporaryMiscCommon.do_r 0.1% 4.0% 1 0.220s
+─Glue.zrange_to_reflective_goal -------- 3.1% 3.9% 1 0.212s
+─change G' ----------------------------- 3.4% 3.4% 1 0.184s
+─tac ----------------------------------- 2.0% 2.8% 2 0.156s
+─rewrite H ----------------------------- 2.8% 2.8% 1 0.156s
+─reflexivity --------------------------- 2.8% 2.8% 7 0.064s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize ---------------------------- -0.0% 100.0% 1 5.480s
+ ├─Pipeline.refine_reflectively_gen ---- 0.0% 95.7% 1 5.244s
+ │ ├─ReflectiveTactics.do_reflective_pip 0.0% 88.6% 1 4.856s
+ │ │└ReflectiveTactics.solve_side_condit 0.0% 87.7% 1 4.804s
+ │ │ ├─ReflectiveTactics.do_reify ------ 0.0% 53.3% 1 2.920s
+ │ │ │└Reify.Reify_rhs_gen ------------- 2.0% 52.5% 1 2.876s
+ │ │ │ ├─Reify.do_reify_abs_goal ------- 33.2% 33.6% 2 1.844s
+ │ │ │ │└Reify.do_reifyf_goal ---------- 31.5% 32.0% 47 1.392s
+ │ │ │ │└eexact ------------------------ 9.1% 9.1% 47 0.024s
+ │ │ │ ├─prove_interp_compile_correct -- 0.0% 5.8% 1 0.316s
+ │ │ │ │└rewrite ?EtaInterp.InterpExprEt 5.3% 5.3% 1 0.288s
+ │ │ │ ├─tac --------------------------- 2.0% 2.8% 1 0.156s
+ │ │ │ └─rewrite H --------------------- 2.8% 2.8% 1 0.156s
+ │ │ └─ReflectiveTactics.solve_post_reif 0.6% 34.4% 1 1.884s
+ │ │ ├─UnifyAbstractReflexivity.unify_ 21.9% 26.6% 7 0.400s
+ │ │ │└unify (constr) (constr) ------- 3.9% 3.9% 5 0.072s
+ │ │ └─ReflectiveTactics.unify_abstrac 5.0% 6.9% 1 0.380s
+ │ └─Glue.refine_to_reflective_glue' --- 0.0% 7.1% 1 0.388s
+ │ └Glue.zrange_to_reflective --------- 0.1% 5.1% 1 0.280s
+ │ └Glue.zrange_to_reflective_goal ---- 3.1% 3.9% 1 0.212s
+ └─IntegrationTestTemporaryMiscCommon.do 0.1% 4.0% 1 0.220s
+ â””change G' --------------------------- 3.4% 3.4% 1 0.184s
+
+src/Specific/X25519/C64/fesquare (real: 33.08, user: 30.13, sys: 0.24, mem: 799620 ko)
+COQC src/Specific/X25519/C64/femulDisplay > src/Specific/X25519/C64/femulDisplay.log
+COQC src/Specific/X25519/C64/freeze.v
+Finished transaction in 7.307 secs (6.763u,0.011s) (successful)
+total time: 6.732s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_freeze --------------------- 0.0% 100.0% 1 6.732s
+─Pipeline.refine_reflectively_gen ------ 0.0% 99.3% 1 6.684s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 92.8% 1 6.248s
+─ReflectiveTactics.solve_side_conditions 0.0% 92.0% 1 6.192s
+─ReflectiveTactics.do_reify ------------ -0.0% 60.3% 1 4.060s
+─Reify.Reify_rhs_gen ------------------- 1.5% 59.6% 1 4.012s
+─Reify.do_reify_abs_goal --------------- 42.4% 42.7% 2 2.876s
+─Reify.do_reifyf_goal ------------------ 41.3% 41.7% 129 2.804s
+─ReflectiveTactics.solve_post_reified_si 0.6% 31.7% 1 2.132s
+─UnifyAbstractReflexivity.unify_transfor 21.7% 25.8% 7 0.424s
+─eexact -------------------------------- 13.7% 13.7% 131 0.036s
+─Glue.refine_to_reflective_glue' ------- 0.0% 6.5% 1 0.436s
+─prove_interp_compile_correct ---------- 0.0% 5.1% 1 0.344s
+─ReflectiveTactics.unify_abstract_cbv_in 3.4% 5.0% 1 0.336s
+─rewrite ?EtaInterp.InterpExprEta ------ 4.7% 4.7% 1 0.316s
+─unify (constr) (constr) --------------- 4.6% 4.6% 6 0.100s
+─Glue.zrange_to_reflective ------------- 0.0% 4.2% 1 0.280s
+─Glue.zrange_to_reflective_goal -------- 2.4% 3.3% 1 0.220s
+─Reify.transitivity_tt ----------------- 0.1% 2.6% 2 0.116s
+─rewrite H ----------------------------- 2.6% 2.6% 1 0.172s
+─tac ----------------------------------- 1.5% 2.3% 2 0.156s
+─reflexivity --------------------------- 2.3% 2.3% 7 0.052s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_freeze --------------------- 0.0% 100.0% 1 6.732s
+â””Pipeline.refine_reflectively_gen ------ 0.0% 99.3% 1 6.684s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 92.8% 1 6.248s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 92.0% 1 6.192s
+ │ ├─ReflectiveTactics.do_reify -------- -0.0% 60.3% 1 4.060s
+ │ │└Reify.Reify_rhs_gen --------------- 1.5% 59.6% 1 4.012s
+ │ │ ├─Reify.do_reify_abs_goal --------- 42.4% 42.7% 2 2.876s
+ │ │ │└Reify.do_reifyf_goal ------------ 41.3% 41.7% 129 2.804s
+ │ │ │└eexact -------------------------- 13.0% 13.0% 129 0.036s
+ │ │ ├─prove_interp_compile_correct ---- 0.0% 5.1% 1 0.344s
+ │ │ │└rewrite ?EtaInterp.InterpExprEta 4.7% 4.7% 1 0.316s
+ │ │ ├─Reify.transitivity_tt ----------- 0.1% 2.6% 2 0.116s
+ │ │ ├─rewrite H ----------------------- 2.6% 2.6% 1 0.172s
+ │ │ └─tac ----------------------------- 1.5% 2.3% 1 0.156s
+ │ └─ReflectiveTactics.solve_post_reifie 0.6% 31.7% 1 2.132s
+ │ ├─UnifyAbstractReflexivity.unify_tr 21.7% 25.8% 7 0.424s
+ │ │└unify (constr) (constr) --------- 3.1% 3.1% 5 0.084s
+ │ └─ReflectiveTactics.unify_abstract_ 3.4% 5.0% 1 0.336s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 6.5% 1 0.436s
+ â””Glue.zrange_to_reflective ----------- 0.0% 4.2% 1 0.280s
+ â””Glue.zrange_to_reflective_goal ------ 2.4% 3.3% 1 0.220s
+
+Finished transaction in 10.495 secs (9.756u,0.s) (successful)
+Closed under the global context
+total time: 6.732s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_freeze --------------------- 0.0% 100.0% 1 6.732s
+─Pipeline.refine_reflectively_gen ------ 0.0% 99.3% 1 6.684s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 92.8% 1 6.248s
+─ReflectiveTactics.solve_side_conditions 0.0% 92.0% 1 6.192s
+─ReflectiveTactics.do_reify ------------ -0.0% 60.3% 1 4.060s
+─Reify.Reify_rhs_gen ------------------- 1.5% 59.6% 1 4.012s
+─Reify.do_reify_abs_goal --------------- 42.4% 42.7% 2 2.876s
+─Reify.do_reifyf_goal ------------------ 41.3% 41.7% 129 2.804s
+─ReflectiveTactics.solve_post_reified_si 0.6% 31.7% 1 2.132s
+─UnifyAbstractReflexivity.unify_transfor 21.7% 25.8% 7 0.424s
+─eexact -------------------------------- 13.7% 13.7% 131 0.036s
+─Glue.refine_to_reflective_glue' ------- 0.0% 6.5% 1 0.436s
+─prove_interp_compile_correct ---------- 0.0% 5.1% 1 0.344s
+─ReflectiveTactics.unify_abstract_cbv_in 3.4% 5.0% 1 0.336s
+─rewrite ?EtaInterp.InterpExprEta ------ 4.7% 4.7% 1 0.316s
+─unify (constr) (constr) --------------- 4.6% 4.6% 6 0.100s
+─Glue.zrange_to_reflective ------------- 0.0% 4.2% 1 0.280s
+─Glue.zrange_to_reflective_goal -------- 2.4% 3.3% 1 0.220s
+─Reify.transitivity_tt ----------------- 0.1% 2.6% 2 0.116s
+─rewrite H ----------------------------- 2.6% 2.6% 1 0.172s
+─tac ----------------------------------- 1.5% 2.3% 2 0.156s
+─reflexivity --------------------------- 2.3% 2.3% 7 0.052s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_freeze --------------------- 0.0% 100.0% 1 6.732s
+â””Pipeline.refine_reflectively_gen ------ 0.0% 99.3% 1 6.684s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 92.8% 1 6.248s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 92.0% 1 6.192s
+ │ ├─ReflectiveTactics.do_reify -------- -0.0% 60.3% 1 4.060s
+ │ │└Reify.Reify_rhs_gen --------------- 1.5% 59.6% 1 4.012s
+ │ │ ├─Reify.do_reify_abs_goal --------- 42.4% 42.7% 2 2.876s
+ │ │ │└Reify.do_reifyf_goal ------------ 41.3% 41.7% 129 2.804s
+ │ │ │└eexact -------------------------- 13.0% 13.0% 129 0.036s
+ │ │ ├─prove_interp_compile_correct ---- 0.0% 5.1% 1 0.344s
+ │ │ │└rewrite ?EtaInterp.InterpExprEta 4.7% 4.7% 1 0.316s
+ │ │ ├─Reify.transitivity_tt ----------- 0.1% 2.6% 2 0.116s
+ │ │ ├─rewrite H ----------------------- 2.6% 2.6% 1 0.172s
+ │ │ └─tac ----------------------------- 1.5% 2.3% 1 0.156s
+ │ └─ReflectiveTactics.solve_post_reifie 0.6% 31.7% 1 2.132s
+ │ ├─UnifyAbstractReflexivity.unify_tr 21.7% 25.8% 7 0.424s
+ │ │└unify (constr) (constr) --------- 3.1% 3.1% 5 0.084s
+ │ └─ReflectiveTactics.unify_abstract_ 3.4% 5.0% 1 0.336s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 6.5% 1 0.436s
+ â””Glue.zrange_to_reflective ----------- 0.0% 4.2% 1 0.280s
+ â””Glue.zrange_to_reflective_goal ------ 2.4% 3.3% 1 0.220s
+
+src/Specific/X25519/C64/freeze (real: 34.35, user: 31.50, sys: 0.24, mem: 828104 ko)
+COQC src/Specific/NISTP256/AMD64/feadd.v
+Finished transaction in 8.784 secs (8.176u,0.011s) (successful)
+total time: 8.140s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 52.4% 1 4.268s
+─synthesize_montgomery ----------------- 0.0% 47.6% 1 3.872s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 43.8% 1 3.568s
+─ReflectiveTactics.solve_side_conditions 0.0% 43.2% 1 3.520s
+─IntegrationTestTemporaryMiscCommon.fact 1.4% 23.6% 1 1.924s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 22.1% 1 1.796s
+─ReflectiveTactics.do_reify ------------ 0.1% 21.7% 1 1.768s
+─ReflectiveTactics.solve_post_reified_si 0.6% 21.5% 1 1.752s
+─Reify.Reify_rhs_gen ------------------- 1.0% 20.9% 1 1.704s
+─op_sig_side_conditions_t -------------- 0.0% 20.0% 1 1.624s
+─DestructHyps.do_all_matches_then ------ 0.0% 20.0% 8 0.244s
+─DestructHyps.do_one_match_then -------- 0.7% 19.9% 44 0.052s
+─do_tac -------------------------------- 0.0% 19.2% 36 0.052s
+─destruct H ---------------------------- 19.2% 19.2% 36 0.052s
+─rewrite <- (lem : lemT) by by_tac ltac: 0.2% 17.3% 1 1.408s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 17.3% 1 1.408s
+─by_tac -------------------------------- 0.0% 17.1% 4 0.504s
+─rewrite <- (ZRange.is_bounded_by_None_r 16.7% 16.7% 8 0.344s
+─UnifyAbstractReflexivity.unify_transfor 13.3% 16.1% 7 0.360s
+─Reify.do_reify_abs_goal --------------- 9.9% 10.1% 2 0.820s
+─Reify.do_reifyf_goal ------------------ 9.1% 9.3% 93 0.748s
+─Glue.refine_to_reflective_glue' ------- 0.0% 8.6% 1 0.700s
+─Glue.zrange_to_reflective ------------- 0.0% 5.3% 1 0.432s
+─IntegrationTestTemporaryMiscCommon.do_s 0.0% 4.8% 1 0.388s
+─<Crypto.Util.Tactics.MoveLetIn.with_uco 0.9% 4.6% 3 0.368s
+─ReflectiveTactics.unify_abstract_cbv_in 3.3% 4.5% 1 0.368s
+─Glue.zrange_to_reflective_goal -------- 2.6% 4.0% 1 0.324s
+─k ------------------------------------- 3.5% 3.6% 1 0.296s
+─unify (constr) (constr) --------------- 3.3% 3.3% 8 0.092s
+─rewrite H ----------------------------- 2.6% 2.6% 2 0.196s
+─eexact -------------------------------- 2.6% 2.6% 95 0.024s
+─prove_interp_compile_correct ---------- 0.0% 2.5% 1 0.204s
+─apply (fun f => MapProjections.proj2 2.4% 2.4% 2 0.120s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 52.4% 1 4.268s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 43.8% 1 3.568s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 43.2% 1 3.520s
+ │ ├─ReflectiveTactics.do_reify -------- 0.1% 21.7% 1 1.768s
+ │ │└Reify.Reify_rhs_gen --------------- 1.0% 20.9% 1 1.704s
+ │ │ ├─Reify.do_reify_abs_goal --------- 9.9% 10.1% 2 0.820s
+ │ │ │└Reify.do_reifyf_goal ------------ 9.1% 9.3% 93 0.748s
+ │ │ │└eexact -------------------------- 2.3% 2.3% 93 0.024s
+ │ │ ├─prove_interp_compile_correct ---- 0.0% 2.5% 1 0.204s
+ │ │ └─rewrite H ----------------------- 2.4% 2.4% 1 0.196s
+ │ └─ReflectiveTactics.solve_post_reifie 0.6% 21.5% 1 1.752s
+ │ ├─UnifyAbstractReflexivity.unify_tr 13.3% 16.1% 7 0.360s
+ │ │└unify (constr) (constr) --------- 2.2% 2.2% 5 0.064s
+ │ └─ReflectiveTactics.unify_abstract_ 3.3% 4.5% 1 0.368s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 8.6% 1 0.700s
+ â””Glue.zrange_to_reflective ----------- 0.0% 5.3% 1 0.432s
+ â””Glue.zrange_to_reflective_goal ------ 2.6% 4.0% 1 0.324s
+─synthesize_montgomery ----------------- 0.0% 47.6% 1 3.872s
+ ├─IntegrationTestTemporaryMiscCommon.fa 1.4% 23.6% 1 1.924s
+ │└op_sig_side_conditions_t ------------ 0.0% 20.0% 1 1.624s
+ │ ├─DestructHyps.do_all_matches_then -- 0.0% 11.4% 4 0.244s
+ │ │└DestructHyps.do_one_match_then ---- 0.3% 11.4% 24 0.052s
+ │ │└do_tac ---------------------------- 0.0% 11.1% 20 0.052s
+ │ │└destruct H ------------------------ 11.1% 11.1% 20 0.052s
+ │ └─rewrite <- (ZRange.is_bounded_by_No 8.4% 8.4% 4 0.328s
+ └─IntegrationTestTemporaryMiscCommon.do 0.0% 22.1% 1 1.796s
+ ├─IntegrationTestTemporaryMiscCommon. 0.0% 17.3% 1 1.408s
+ │└rewrite <- (lem : lemT) by by_tac l 0.2% 17.3% 1 1.408s
+ │└by_tac ---------------------------- 0.0% 17.1% 4 0.504s
+ │ ├─DestructHyps.do_all_matches_then 0.0% 8.6% 4 0.184s
+ │ │└DestructHyps.do_one_match_then -- 0.3% 8.5% 20 0.052s
+ │ │└do_tac -------------------------- 0.0% 8.2% 16 0.052s
+ │ │└destruct H ---------------------- 8.2% 8.2% 16 0.052s
+ │ └─rewrite <- (ZRange.is_bounded_by_ 8.3% 8.3% 4 0.344s
+ └─IntegrationTestTemporaryMiscCommon. 0.0% 4.8% 1 0.388s
+ â””<Crypto.Util.Tactics.MoveLetIn.with 0.9% 4.6% 3 0.368s
+ â””k --------------------------------- 3.5% 3.6% 1 0.296s
+
+Finished transaction in 13.363 secs (12.516u,0.008s) (successful)
+Closed under the global context
+total time: 8.140s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 52.4% 1 4.268s
+─synthesize_montgomery ----------------- 0.0% 47.6% 1 3.872s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 43.8% 1 3.568s
+─ReflectiveTactics.solve_side_conditions 0.0% 43.2% 1 3.520s
+─IntegrationTestTemporaryMiscCommon.fact 1.4% 23.6% 1 1.924s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 22.1% 1 1.796s
+─ReflectiveTactics.do_reify ------------ 0.1% 21.7% 1 1.768s
+─ReflectiveTactics.solve_post_reified_si 0.6% 21.5% 1 1.752s
+─Reify.Reify_rhs_gen ------------------- 1.0% 20.9% 1 1.704s
+─op_sig_side_conditions_t -------------- 0.0% 20.0% 1 1.624s
+─DestructHyps.do_all_matches_then ------ 0.0% 20.0% 8 0.244s
+─DestructHyps.do_one_match_then -------- 0.7% 19.9% 44 0.052s
+─do_tac -------------------------------- 0.0% 19.2% 36 0.052s
+─destruct H ---------------------------- 19.2% 19.2% 36 0.052s
+─rewrite <- (lem : lemT) by by_tac ltac: 0.2% 17.3% 1 1.408s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 17.3% 1 1.408s
+─by_tac -------------------------------- 0.0% 17.1% 4 0.504s
+─rewrite <- (ZRange.is_bounded_by_None_r 16.7% 16.7% 8 0.344s
+─UnifyAbstractReflexivity.unify_transfor 13.3% 16.1% 7 0.360s
+─Reify.do_reify_abs_goal --------------- 9.9% 10.1% 2 0.820s
+─Reify.do_reifyf_goal ------------------ 9.1% 9.3% 93 0.748s
+─Glue.refine_to_reflective_glue' ------- 0.0% 8.6% 1 0.700s
+─Glue.zrange_to_reflective ------------- 0.0% 5.3% 1 0.432s
+─IntegrationTestTemporaryMiscCommon.do_s 0.0% 4.8% 1 0.388s
+─<Crypto.Util.Tactics.MoveLetIn.with_uco 0.9% 4.6% 3 0.368s
+─ReflectiveTactics.unify_abstract_cbv_in 3.3% 4.5% 1 0.368s
+─Glue.zrange_to_reflective_goal -------- 2.6% 4.0% 1 0.324s
+─k ------------------------------------- 3.5% 3.6% 1 0.296s
+─unify (constr) (constr) --------------- 3.3% 3.3% 8 0.092s
+─rewrite H ----------------------------- 2.6% 2.6% 2 0.196s
+─eexact -------------------------------- 2.6% 2.6% 95 0.024s
+─prove_interp_compile_correct ---------- 0.0% 2.5% 1 0.204s
+─apply (fun f => MapProjections.proj2 2.4% 2.4% 2 0.120s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 52.4% 1 4.268s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 43.8% 1 3.568s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 43.2% 1 3.520s
+ │ ├─ReflectiveTactics.do_reify -------- 0.1% 21.7% 1 1.768s
+ │ │└Reify.Reify_rhs_gen --------------- 1.0% 20.9% 1 1.704s
+ │ │ ├─Reify.do_reify_abs_goal --------- 9.9% 10.1% 2 0.820s
+ │ │ │└Reify.do_reifyf_goal ------------ 9.1% 9.3% 93 0.748s
+ │ │ │└eexact -------------------------- 2.3% 2.3% 93 0.024s
+ │ │ ├─prove_interp_compile_correct ---- 0.0% 2.5% 1 0.204s
+ │ │ └─rewrite H ----------------------- 2.4% 2.4% 1 0.196s
+ │ └─ReflectiveTactics.solve_post_reifie 0.6% 21.5% 1 1.752s
+ │ ├─UnifyAbstractReflexivity.unify_tr 13.3% 16.1% 7 0.360s
+ │ │└unify (constr) (constr) --------- 2.2% 2.2% 5 0.064s
+ │ └─ReflectiveTactics.unify_abstract_ 3.3% 4.5% 1 0.368s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 8.6% 1 0.700s
+ â””Glue.zrange_to_reflective ----------- 0.0% 5.3% 1 0.432s
+ â””Glue.zrange_to_reflective_goal ------ 2.6% 4.0% 1 0.324s
+─synthesize_montgomery ----------------- 0.0% 47.6% 1 3.872s
+ ├─IntegrationTestTemporaryMiscCommon.fa 1.4% 23.6% 1 1.924s
+ │└op_sig_side_conditions_t ------------ 0.0% 20.0% 1 1.624s
+ │ ├─DestructHyps.do_all_matches_then -- 0.0% 11.4% 4 0.244s
+ │ │└DestructHyps.do_one_match_then ---- 0.3% 11.4% 24 0.052s
+ │ │└do_tac ---------------------------- 0.0% 11.1% 20 0.052s
+ │ │└destruct H ------------------------ 11.1% 11.1% 20 0.052s
+ │ └─rewrite <- (ZRange.is_bounded_by_No 8.4% 8.4% 4 0.328s
+ └─IntegrationTestTemporaryMiscCommon.do 0.0% 22.1% 1 1.796s
+ ├─IntegrationTestTemporaryMiscCommon. 0.0% 17.3% 1 1.408s
+ │└rewrite <- (lem : lemT) by by_tac l 0.2% 17.3% 1 1.408s
+ │└by_tac ---------------------------- 0.0% 17.1% 4 0.504s
+ │ ├─DestructHyps.do_all_matches_then 0.0% 8.6% 4 0.184s
+ │ │└DestructHyps.do_one_match_then -- 0.3% 8.5% 20 0.052s
+ │ │└do_tac -------------------------- 0.0% 8.2% 16 0.052s
+ │ │└destruct H ---------------------- 8.2% 8.2% 16 0.052s
+ │ └─rewrite <- (ZRange.is_bounded_by_ 8.3% 8.3% 4 0.344s
+ └─IntegrationTestTemporaryMiscCommon. 0.0% 4.8% 1 0.388s
+ â””<Crypto.Util.Tactics.MoveLetIn.with 0.9% 4.6% 3 0.368s
+ â””k --------------------------------- 3.5% 3.6% 1 0.296s
+
+src/Specific/NISTP256/AMD64/feadd (real: 38.19, user: 35.40, sys: 0.30, mem: 799216 ko)
+COQC src/Specific/NISTP256/AMD64/fenz.v
+Finished transaction in 6.356 secs (5.82u,0.004s) (successful)
+total time: 5.800s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_nonzero -------------------- 0.0% 100.0% 1 5.800s
+─IntegrationTestTemporaryMiscCommon.nonz 0.2% 85.5% 1 4.960s
+─destruct (Decidable.dec x), (Decidable. 37.4% 37.4% 1 2.168s
+─destruct (Decidable.dec x) as [H| H] -- 22.0% 22.0% 1 1.276s
+─Pipeline.refine_reflectively_gen ------ 0.0% 14.5% 1 0.840s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 10.9% 1 0.632s
+─ReflectiveTactics.solve_side_conditions 0.0% 10.6% 1 0.612s
+─ReflectiveTactics.solve_post_reified_si 0.3% 8.5% 1 0.492s
+─IntegrationTestTemporaryMiscCommon.op_s 0.1% 8.1% 2 0.368s
+─rewrite <- (ZRange.is_bounded_by_None_r 5.2% 5.2% 2 0.288s
+─UnifyAbstractReflexivity.unify_transfor 3.4% 4.3% 7 0.076s
+─ReflectiveTactics.unify_abstract_cbv_in 2.8% 3.8% 1 0.220s
+─Glue.refine_to_reflective_glue' ------- 0.1% 3.6% 1 0.208s
+─rewrite H' ---------------------------- 3.4% 3.4% 1 0.200s
+─generalize dependent (constr) --------- 3.0% 3.0% 4 0.060s
+─congruence ---------------------------- 2.8% 2.8% 1 0.160s
+─do_tac -------------------------------- 0.0% 2.6% 4 0.044s
+─destruct H ---------------------------- 2.6% 2.6% 4 0.044s
+─IntegrationTestTemporaryMiscCommon.do_s 0.1% 2.6% 1 0.152s
+─DestructHyps.do_one_match_then -------- 0.0% 2.6% 6 0.044s
+─DestructHyps.do_all_matches_then ------ 0.0% 2.6% 2 0.076s
+─<Crypto.Util.Tactics.MoveLetIn.with_uco 0.4% 2.5% 3 0.140s
+─Glue.zrange_to_reflective ------------- 0.0% 2.2% 1 0.128s
+─rewrite H ----------------------------- 1.9% 2.1% 3 0.112s
+─ReflectiveTactics.do_reify ------------ 0.0% 2.1% 1 0.120s
+─k ------------------------------------- 1.9% 2.0% 1 0.116s
+─Reify.Reify_rhs_gen ------------------- 0.1% 2.0% 1 0.116s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_nonzero -------------------- 0.0% 100.0% 1 5.800s
+ ├─IntegrationTestTemporaryMiscCommon.no 0.2% 85.5% 1 4.960s
+ │ ├─destruct (Decidable.dec x), (Decida 37.4% 37.4% 1 2.168s
+ │ ├─destruct (Decidable.dec x) as [H| H 22.0% 22.0% 1 1.276s
+ │ ├─IntegrationTestTemporaryMiscCommon. 0.1% 8.1% 2 0.368s
+ │ │ ├─rewrite <- (ZRange.is_bounded_by_ 5.2% 5.2% 2 0.288s
+ │ │ └─DestructHyps.do_all_matches_then 0.0% 2.6% 2 0.076s
+ │ │ └DestructHyps.do_one_match_then -- 0.0% 2.6% 6 0.044s
+ │ │ └do_tac -------------------------- 0.0% 2.6% 4 0.044s
+ │ │ └destruct H ---------------------- 2.6% 2.6% 4 0.044s
+ │ ├─rewrite H' ------------------------ 3.4% 3.4% 1 0.200s
+ │ ├─generalize dependent (constr) ----- 3.0% 3.0% 4 0.060s
+ │ ├─congruence ------------------------ 2.8% 2.8% 1 0.160s
+ │ ├─IntegrationTestTemporaryMiscCommon. 0.1% 2.6% 1 0.152s
+ │ │└<Crypto.Util.Tactics.MoveLetIn.with 0.4% 2.5% 3 0.140s
+ │ │└k --------------------------------- 1.9% 2.0% 1 0.116s
+ │ └─rewrite H ------------------------- 1.7% 2.0% 2 0.112s
+ └─Pipeline.refine_reflectively_gen ---- 0.0% 14.5% 1 0.840s
+ ├─ReflectiveTactics.do_reflective_pip 0.0% 10.9% 1 0.632s
+ │└ReflectiveTactics.solve_side_condit 0.0% 10.6% 1 0.612s
+ │ ├─ReflectiveTactics.solve_post_reif 0.3% 8.5% 1 0.492s
+ │ │ ├─UnifyAbstractReflexivity.unify_ 3.4% 4.3% 7 0.076s
+ │ │ └─ReflectiveTactics.unify_abstrac 2.8% 3.8% 1 0.220s
+ │ └─ReflectiveTactics.do_reify ------ 0.0% 2.1% 1 0.120s
+ │ └Reify.Reify_rhs_gen ------------- 0.1% 2.0% 1 0.116s
+ └─Glue.refine_to_reflective_glue' --- 0.1% 3.6% 1 0.208s
+ â””Glue.zrange_to_reflective --------- 0.0% 2.2% 1 0.128s
+
+Finished transaction in 6.657 secs (6.299u,0.s) (successful)
+Closed under the global context
+total time: 5.800s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_nonzero -------------------- 0.0% 100.0% 1 5.800s
+─IntegrationTestTemporaryMiscCommon.nonz 0.2% 85.5% 1 4.960s
+─destruct (Decidable.dec x), (Decidable. 37.4% 37.4% 1 2.168s
+─destruct (Decidable.dec x) as [H| H] -- 22.0% 22.0% 1 1.276s
+─Pipeline.refine_reflectively_gen ------ 0.0% 14.5% 1 0.840s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 10.9% 1 0.632s
+─ReflectiveTactics.solve_side_conditions 0.0% 10.6% 1 0.612s
+─ReflectiveTactics.solve_post_reified_si 0.3% 8.5% 1 0.492s
+─IntegrationTestTemporaryMiscCommon.op_s 0.1% 8.1% 2 0.368s
+─rewrite <- (ZRange.is_bounded_by_None_r 5.2% 5.2% 2 0.288s
+─UnifyAbstractReflexivity.unify_transfor 3.4% 4.3% 7 0.076s
+─ReflectiveTactics.unify_abstract_cbv_in 2.8% 3.8% 1 0.220s
+─Glue.refine_to_reflective_glue' ------- 0.1% 3.6% 1 0.208s
+─rewrite H' ---------------------------- 3.4% 3.4% 1 0.200s
+─generalize dependent (constr) --------- 3.0% 3.0% 4 0.060s
+─congruence ---------------------------- 2.8% 2.8% 1 0.160s
+─do_tac -------------------------------- 0.0% 2.6% 4 0.044s
+─destruct H ---------------------------- 2.6% 2.6% 4 0.044s
+─IntegrationTestTemporaryMiscCommon.do_s 0.1% 2.6% 1 0.152s
+─DestructHyps.do_one_match_then -------- 0.0% 2.6% 6 0.044s
+─DestructHyps.do_all_matches_then ------ 0.0% 2.6% 2 0.076s
+─<Crypto.Util.Tactics.MoveLetIn.with_uco 0.4% 2.5% 3 0.140s
+─Glue.zrange_to_reflective ------------- 0.0% 2.2% 1 0.128s
+─rewrite H ----------------------------- 1.9% 2.1% 3 0.112s
+─ReflectiveTactics.do_reify ------------ 0.0% 2.1% 1 0.120s
+─k ------------------------------------- 1.9% 2.0% 1 0.116s
+─Reify.Reify_rhs_gen ------------------- 0.1% 2.0% 1 0.116s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_nonzero -------------------- 0.0% 100.0% 1 5.800s
+ ├─IntegrationTestTemporaryMiscCommon.no 0.2% 85.5% 1 4.960s
+ │ ├─destruct (Decidable.dec x), (Decida 37.4% 37.4% 1 2.168s
+ │ ├─destruct (Decidable.dec x) as [H| H 22.0% 22.0% 1 1.276s
+ │ ├─IntegrationTestTemporaryMiscCommon. 0.1% 8.1% 2 0.368s
+ │ │ ├─rewrite <- (ZRange.is_bounded_by_ 5.2% 5.2% 2 0.288s
+ │ │ └─DestructHyps.do_all_matches_then 0.0% 2.6% 2 0.076s
+ │ │ └DestructHyps.do_one_match_then -- 0.0% 2.6% 6 0.044s
+ │ │ └do_tac -------------------------- 0.0% 2.6% 4 0.044s
+ │ │ └destruct H ---------------------- 2.6% 2.6% 4 0.044s
+ │ ├─rewrite H' ------------------------ 3.4% 3.4% 1 0.200s
+ │ ├─generalize dependent (constr) ----- 3.0% 3.0% 4 0.060s
+ │ ├─congruence ------------------------ 2.8% 2.8% 1 0.160s
+ │ ├─IntegrationTestTemporaryMiscCommon. 0.1% 2.6% 1 0.152s
+ │ │└<Crypto.Util.Tactics.MoveLetIn.with 0.4% 2.5% 3 0.140s
+ │ │└k --------------------------------- 1.9% 2.0% 1 0.116s
+ │ └─rewrite H ------------------------- 1.7% 2.0% 2 0.112s
+ └─Pipeline.refine_reflectively_gen ---- 0.0% 14.5% 1 0.840s
+ ├─ReflectiveTactics.do_reflective_pip 0.0% 10.9% 1 0.632s
+ │└ReflectiveTactics.solve_side_condit 0.0% 10.6% 1 0.612s
+ │ ├─ReflectiveTactics.solve_post_reif 0.3% 8.5% 1 0.492s
+ │ │ ├─UnifyAbstractReflexivity.unify_ 3.4% 4.3% 7 0.076s
+ │ │ └─ReflectiveTactics.unify_abstrac 2.8% 3.8% 1 0.220s
+ │ └─ReflectiveTactics.do_reify ------ 0.0% 2.1% 1 0.120s
+ │ └Reify.Reify_rhs_gen ------------- 0.1% 2.0% 1 0.116s
+ └─Glue.refine_to_reflective_glue' --- 0.1% 3.6% 1 0.208s
+ â””Glue.zrange_to_reflective --------- 0.0% 2.2% 1 0.128s
+
+src/Specific/NISTP256/AMD64/fenz (real: 27.81, user: 25.50, sys: 0.22, mem: 756080 ko)
+COQC src/Specific/NISTP256/AMD64/feopp.v
+Finished transaction in 7.73 secs (7.112u,0.008s) (successful)
+total time: 7.072s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_montgomery ----------------- 0.0% 62.5% 1 4.420s
+─IntegrationTestTemporaryMiscCommon.fact 18.7% 51.6% 1 3.648s
+─Pipeline.refine_reflectively_gen ------ 0.0% 37.5% 1 2.652s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 32.6% 1 2.308s
+─ReflectiveTactics.solve_side_conditions 0.0% 32.2% 1 2.276s
+─reflexivity --------------------------- 24.8% 24.8% 8 1.700s
+─ReflectiveTactics.solve_post_reified_si 0.5% 18.5% 1 1.308s
+─ReflectiveTactics.do_reify ------------ 0.0% 13.7% 1 0.968s
+─UnifyAbstractReflexivity.unify_transfor 11.2% 13.6% 7 0.284s
+─Reify.Reify_rhs_gen ------------------- 0.6% 13.4% 1 0.948s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 9.7% 1 0.684s
+─rewrite <- (ZRange.is_bounded_by_None_r 9.0% 9.0% 4 0.328s
+─op_sig_side_conditions_t -------------- 0.0% 7.8% 1 0.552s
+─rewrite <- (lem : lemT) by by_tac ltac: 0.1% 7.4% 1 0.520s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 7.4% 1 0.520s
+─by_tac -------------------------------- 0.0% 7.2% 2 0.404s
+─Reify.do_reify_abs_goal --------------- 7.1% 7.2% 2 0.512s
+─Reify.do_reifyf_goal ------------------ 6.6% 6.7% 62 0.472s
+─DestructHyps.do_one_match_then -------- 0.2% 5.8% 14 0.048s
+─DestructHyps.do_all_matches_then ------ 0.0% 5.8% 4 0.124s
+─do_tac -------------------------------- 0.0% 5.6% 10 0.048s
+─destruct H ---------------------------- 5.6% 5.6% 10 0.048s
+─Glue.refine_to_reflective_glue' ------- 0.0% 4.9% 1 0.344s
+─ReflectiveTactics.unify_abstract_cbv_in 2.9% 4.2% 1 0.300s
+─Glue.zrange_to_reflective ------------- 0.0% 3.3% 1 0.232s
+─unify (constr) (constr) --------------- 3.2% 3.2% 7 0.088s
+─Glue.zrange_to_reflective_goal -------- 1.9% 2.6% 1 0.184s
+─IntegrationTestTemporaryMiscCommon.do_s 0.0% 2.3% 1 0.164s
+─<Crypto.Util.Tactics.MoveLetIn.with_uco 0.4% 2.2% 3 0.152s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_montgomery ----------------- 0.0% 62.5% 1 4.420s
+ ├─IntegrationTestTemporaryMiscCommon.fa 18.7% 51.6% 1 3.648s
+ │ ├─reflexivity ----------------------- 24.0% 24.0% 1 1.700s
+ │ └─op_sig_side_conditions_t ---------- 0.0% 7.8% 1 0.552s
+ │ ├─rewrite <- (ZRange.is_bounded_by_ 4.2% 4.2% 2 0.284s
+ │ └─DestructHyps.do_all_matches_then 0.0% 3.5% 2 0.124s
+ │ └DestructHyps.do_one_match_then -- 0.2% 3.5% 8 0.044s
+ │ └do_tac -------------------------- 0.0% 3.3% 6 0.040s
+ │ └destruct H ---------------------- 3.3% 3.3% 6 0.040s
+ └─IntegrationTestTemporaryMiscCommon.do 0.0% 9.7% 1 0.684s
+ ├─IntegrationTestTemporaryMiscCommon. 0.0% 7.4% 1 0.520s
+ │└rewrite <- (lem : lemT) by by_tac l 0.1% 7.4% 1 0.520s
+ │└by_tac ---------------------------- 0.0% 7.2% 2 0.404s
+ │ ├─rewrite <- (ZRange.is_bounded_by_ 4.8% 4.8% 2 0.328s
+ │ └─DestructHyps.do_all_matches_then 0.0% 2.3% 2 0.088s
+ │ └DestructHyps.do_one_match_then -- 0.0% 2.3% 6 0.048s
+ │ └do_tac -------------------------- 0.0% 2.3% 4 0.048s
+ │ └destruct H ---------------------- 2.3% 2.3% 4 0.048s
+ └─IntegrationTestTemporaryMiscCommon. 0.0% 2.3% 1 0.164s
+ â””<Crypto.Util.Tactics.MoveLetIn.with 0.4% 2.2% 3 0.152s
+─Pipeline.refine_reflectively_gen ------ 0.0% 37.5% 1 2.652s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 32.6% 1 2.308s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 32.2% 1 2.276s
+ │ ├─ReflectiveTactics.solve_post_reifie 0.5% 18.5% 1 1.308s
+ │ │ ├─UnifyAbstractReflexivity.unify_tr 11.2% 13.6% 7 0.284s
+ │ │ └─ReflectiveTactics.unify_abstract_ 2.9% 4.2% 1 0.300s
+ │ └─ReflectiveTactics.do_reify -------- 0.0% 13.7% 1 0.968s
+ │ └Reify.Reify_rhs_gen --------------- 0.6% 13.4% 1 0.948s
+ │ └Reify.do_reify_abs_goal ----------- 7.1% 7.2% 2 0.512s
+ │ └Reify.do_reifyf_goal -------------- 6.6% 6.7% 62 0.472s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 4.9% 1 0.344s
+ â””Glue.zrange_to_reflective ----------- 0.0% 3.3% 1 0.232s
+ â””Glue.zrange_to_reflective_goal ------ 1.9% 2.6% 1 0.184s
+
+Finished transaction in 7.732 secs (7.1u,0.003s) (successful)
+Closed under the global context
+total time: 7.072s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_montgomery ----------------- 0.0% 62.5% 1 4.420s
+─IntegrationTestTemporaryMiscCommon.fact 18.7% 51.6% 1 3.648s
+─Pipeline.refine_reflectively_gen ------ 0.0% 37.5% 1 2.652s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 32.6% 1 2.308s
+─ReflectiveTactics.solve_side_conditions 0.0% 32.2% 1 2.276s
+─reflexivity --------------------------- 24.8% 24.8% 8 1.700s
+─ReflectiveTactics.solve_post_reified_si 0.5% 18.5% 1 1.308s
+─ReflectiveTactics.do_reify ------------ 0.0% 13.7% 1 0.968s
+─UnifyAbstractReflexivity.unify_transfor 11.2% 13.6% 7 0.284s
+─Reify.Reify_rhs_gen ------------------- 0.6% 13.4% 1 0.948s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 9.7% 1 0.684s
+─rewrite <- (ZRange.is_bounded_by_None_r 9.0% 9.0% 4 0.328s
+─op_sig_side_conditions_t -------------- 0.0% 7.8% 1 0.552s
+─rewrite <- (lem : lemT) by by_tac ltac: 0.1% 7.4% 1 0.520s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 7.4% 1 0.520s
+─by_tac -------------------------------- 0.0% 7.2% 2 0.404s
+─Reify.do_reify_abs_goal --------------- 7.1% 7.2% 2 0.512s
+─Reify.do_reifyf_goal ------------------ 6.6% 6.7% 62 0.472s
+─DestructHyps.do_one_match_then -------- 0.2% 5.8% 14 0.048s
+─DestructHyps.do_all_matches_then ------ 0.0% 5.8% 4 0.124s
+─do_tac -------------------------------- 0.0% 5.6% 10 0.048s
+─destruct H ---------------------------- 5.6% 5.6% 10 0.048s
+─Glue.refine_to_reflective_glue' ------- 0.0% 4.9% 1 0.344s
+─ReflectiveTactics.unify_abstract_cbv_in 2.9% 4.2% 1 0.300s
+─Glue.zrange_to_reflective ------------- 0.0% 3.3% 1 0.232s
+─unify (constr) (constr) --------------- 3.2% 3.2% 7 0.088s
+─Glue.zrange_to_reflective_goal -------- 1.9% 2.6% 1 0.184s
+─IntegrationTestTemporaryMiscCommon.do_s 0.0% 2.3% 1 0.164s
+─<Crypto.Util.Tactics.MoveLetIn.with_uco 0.4% 2.2% 3 0.152s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_montgomery ----------------- 0.0% 62.5% 1 4.420s
+ ├─IntegrationTestTemporaryMiscCommon.fa 18.7% 51.6% 1 3.648s
+ │ ├─reflexivity ----------------------- 24.0% 24.0% 1 1.700s
+ │ └─op_sig_side_conditions_t ---------- 0.0% 7.8% 1 0.552s
+ │ ├─rewrite <- (ZRange.is_bounded_by_ 4.2% 4.2% 2 0.284s
+ │ └─DestructHyps.do_all_matches_then 0.0% 3.5% 2 0.124s
+ │ └DestructHyps.do_one_match_then -- 0.2% 3.5% 8 0.044s
+ │ └do_tac -------------------------- 0.0% 3.3% 6 0.040s
+ │ └destruct H ---------------------- 3.3% 3.3% 6 0.040s
+ └─IntegrationTestTemporaryMiscCommon.do 0.0% 9.7% 1 0.684s
+ ├─IntegrationTestTemporaryMiscCommon. 0.0% 7.4% 1 0.520s
+ │└rewrite <- (lem : lemT) by by_tac l 0.1% 7.4% 1 0.520s
+ │└by_tac ---------------------------- 0.0% 7.2% 2 0.404s
+ │ ├─rewrite <- (ZRange.is_bounded_by_ 4.8% 4.8% 2 0.328s
+ │ └─DestructHyps.do_all_matches_then 0.0% 2.3% 2 0.088s
+ │ └DestructHyps.do_one_match_then -- 0.0% 2.3% 6 0.048s
+ │ └do_tac -------------------------- 0.0% 2.3% 4 0.048s
+ │ └destruct H ---------------------- 2.3% 2.3% 4 0.048s
+ └─IntegrationTestTemporaryMiscCommon. 0.0% 2.3% 1 0.164s
+ â””<Crypto.Util.Tactics.MoveLetIn.with 0.4% 2.2% 3 0.152s
+─Pipeline.refine_reflectively_gen ------ 0.0% 37.5% 1 2.652s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 32.6% 1 2.308s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 32.2% 1 2.276s
+ │ ├─ReflectiveTactics.solve_post_reifie 0.5% 18.5% 1 1.308s
+ │ │ ├─UnifyAbstractReflexivity.unify_tr 11.2% 13.6% 7 0.284s
+ │ │ └─ReflectiveTactics.unify_abstract_ 2.9% 4.2% 1 0.300s
+ │ └─ReflectiveTactics.do_reify -------- 0.0% 13.7% 1 0.968s
+ │ └Reify.Reify_rhs_gen --------------- 0.6% 13.4% 1 0.948s
+ │ └Reify.do_reify_abs_goal ----------- 7.1% 7.2% 2 0.512s
+ │ └Reify.do_reifyf_goal -------------- 6.6% 6.7% 62 0.472s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 4.9% 1 0.344s
+ â””Glue.zrange_to_reflective ----------- 0.0% 3.3% 1 0.232s
+ â””Glue.zrange_to_reflective_goal ------ 1.9% 2.6% 1 0.184s
+
+src/Specific/NISTP256/AMD64/feopp (real: 31.00, user: 28.51, sys: 0.20, mem: 765208 ko)
+COQC src/Specific/NISTP256/AMD64/fesub.v
+Finished transaction in 12.996 secs (12.091u,0.004s) (successful)
+total time: 12.048s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_montgomery ----------------- 0.0% 66.1% 1 7.964s
+─IntegrationTestTemporaryMiscCommon.fact 16.2% 50.9% 1 6.128s
+─Pipeline.refine_reflectively_gen ------ 0.0% 33.9% 1 4.084s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 28.3% 1 3.404s
+─ReflectiveTactics.solve_side_conditions 0.0% 27.8% 1 3.352s
+─reflexivity --------------------------- 21.7% 21.7% 8 2.480s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 14.1% 1 1.704s
+─ReflectiveTactics.solve_post_reified_si 0.4% 14.1% 1 1.696s
+─ReflectiveTactics.do_reify ------------ 0.0% 13.7% 1 1.656s
+─Reify.Reify_rhs_gen ------------------- 0.9% 13.2% 1 1.592s
+─DestructHyps.do_all_matches_then ------ 0.0% 12.9% 8 0.232s
+─DestructHyps.do_one_match_then -------- 0.6% 12.9% 44 0.052s
+─op_sig_side_conditions_t -------------- 0.0% 12.7% 1 1.528s
+─do_tac -------------------------------- 0.0% 12.3% 36 0.048s
+─destruct H ---------------------------- 12.3% 12.3% 36 0.048s
+─rewrite <- (lem : lemT) by by_tac ltac: 0.1% 11.2% 1 1.352s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 11.2% 1 1.352s
+─by_tac -------------------------------- 0.0% 11.1% 4 0.476s
+─UnifyAbstractReflexivity.unify_transfor 8.8% 10.6% 7 0.344s
+─rewrite <- (ZRange.is_bounded_by_None_r 10.5% 10.5% 8 0.316s
+─Reify.do_reify_abs_goal --------------- 6.0% 6.1% 2 0.732s
+─Glue.refine_to_reflective_glue' ------- 0.0% 5.6% 1 0.680s
+─Reify.do_reifyf_goal ------------------ 5.4% 5.5% 80 0.660s
+─Glue.zrange_to_reflective ------------- 0.0% 3.6% 1 0.428s
+─ReflectiveTactics.unify_abstract_cbv_in 2.2% 3.0% 1 0.360s
+─IntegrationTestTemporaryMiscCommon.do_s 0.0% 2.9% 1 0.348s
+─<Crypto.Util.Tactics.MoveLetIn.with_uco 0.5% 2.8% 3 0.332s
+─Glue.zrange_to_reflective_goal -------- 1.7% 2.6% 1 0.316s
+─k ------------------------------------- 2.1% 2.2% 1 0.268s
+─unify (constr) (constr) --------------- 2.1% 2.1% 8 0.092s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_montgomery ----------------- 0.0% 66.1% 1 7.964s
+ ├─IntegrationTestTemporaryMiscCommon.fa 16.2% 50.9% 1 6.128s
+ │ ├─reflexivity ----------------------- 20.6% 20.6% 1 2.480s
+ │ └─op_sig_side_conditions_t ---------- 0.0% 12.7% 1 1.528s
+ │ ├─DestructHyps.do_all_matches_then 0.0% 7.3% 4 0.232s
+ │ │└DestructHyps.do_one_match_then -- 0.3% 7.3% 24 0.052s
+ │ │└do_tac -------------------------- 0.0% 7.0% 20 0.048s
+ │ │└destruct H ---------------------- 6.9% 6.9% 20 0.048s
+ │ └─rewrite <- (ZRange.is_bounded_by_ 5.2% 5.2% 4 0.300s
+ └─IntegrationTestTemporaryMiscCommon.do 0.0% 14.1% 1 1.704s
+ ├─IntegrationTestTemporaryMiscCommon. 0.0% 11.2% 1 1.352s
+ │└rewrite <- (lem : lemT) by by_tac l 0.1% 11.2% 1 1.352s
+ │└by_tac ---------------------------- 0.0% 11.1% 4 0.476s
+ │ ├─DestructHyps.do_all_matches_then 0.0% 5.6% 4 0.176s
+ │ │└DestructHyps.do_one_match_then -- 0.2% 5.6% 20 0.052s
+ │ │└do_tac -------------------------- 0.0% 5.3% 16 0.048s
+ │ │└destruct H ---------------------- 5.3% 5.3% 16 0.048s
+ │ └─rewrite <- (ZRange.is_bounded_by_ 5.3% 5.3% 4 0.316s
+ └─IntegrationTestTemporaryMiscCommon. 0.0% 2.9% 1 0.348s
+ â””<Crypto.Util.Tactics.MoveLetIn.with 0.5% 2.8% 3 0.332s
+ â””k --------------------------------- 2.1% 2.2% 1 0.268s
+─Pipeline.refine_reflectively_gen ------ 0.0% 33.9% 1 4.084s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 28.3% 1 3.404s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 27.8% 1 3.352s
+ │ ├─ReflectiveTactics.solve_post_reifie 0.4% 14.1% 1 1.696s
+ │ │ ├─UnifyAbstractReflexivity.unify_tr 8.8% 10.6% 7 0.344s
+ │ │ └─ReflectiveTactics.unify_abstract_ 2.2% 3.0% 1 0.360s
+ │ └─ReflectiveTactics.do_reify -------- 0.0% 13.7% 1 1.656s
+ │ └Reify.Reify_rhs_gen --------------- 0.9% 13.2% 1 1.592s
+ │ └Reify.do_reify_abs_goal ----------- 6.0% 6.1% 2 0.732s
+ │ └Reify.do_reifyf_goal -------------- 5.4% 5.5% 80 0.660s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 5.6% 1 0.680s
+ â””Glue.zrange_to_reflective ----------- 0.0% 3.6% 1 0.428s
+ â””Glue.zrange_to_reflective_goal ------ 1.7% 2.6% 1 0.316s
+
+Finished transaction in 13.895 secs (12.78u,0.02s) (successful)
+Closed under the global context
+total time: 12.048s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_montgomery ----------------- 0.0% 66.1% 1 7.964s
+─IntegrationTestTemporaryMiscCommon.fact 16.2% 50.9% 1 6.128s
+─Pipeline.refine_reflectively_gen ------ 0.0% 33.9% 1 4.084s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 28.3% 1 3.404s
+─ReflectiveTactics.solve_side_conditions 0.0% 27.8% 1 3.352s
+─reflexivity --------------------------- 21.7% 21.7% 8 2.480s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 14.1% 1 1.704s
+─ReflectiveTactics.solve_post_reified_si 0.4% 14.1% 1 1.696s
+─ReflectiveTactics.do_reify ------------ 0.0% 13.7% 1 1.656s
+─Reify.Reify_rhs_gen ------------------- 0.9% 13.2% 1 1.592s
+─DestructHyps.do_all_matches_then ------ 0.0% 12.9% 8 0.232s
+─DestructHyps.do_one_match_then -------- 0.6% 12.9% 44 0.052s
+─op_sig_side_conditions_t -------------- 0.0% 12.7% 1 1.528s
+─do_tac -------------------------------- 0.0% 12.3% 36 0.048s
+─destruct H ---------------------------- 12.3% 12.3% 36 0.048s
+─rewrite <- (lem : lemT) by by_tac ltac: 0.1% 11.2% 1 1.352s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 11.2% 1 1.352s
+─by_tac -------------------------------- 0.0% 11.1% 4 0.476s
+─UnifyAbstractReflexivity.unify_transfor 8.8% 10.6% 7 0.344s
+─rewrite <- (ZRange.is_bounded_by_None_r 10.5% 10.5% 8 0.316s
+─Reify.do_reify_abs_goal --------------- 6.0% 6.1% 2 0.732s
+─Glue.refine_to_reflective_glue' ------- 0.0% 5.6% 1 0.680s
+─Reify.do_reifyf_goal ------------------ 5.4% 5.5% 80 0.660s
+─Glue.zrange_to_reflective ------------- 0.0% 3.6% 1 0.428s
+─ReflectiveTactics.unify_abstract_cbv_in 2.2% 3.0% 1 0.360s
+─IntegrationTestTemporaryMiscCommon.do_s 0.0% 2.9% 1 0.348s
+─<Crypto.Util.Tactics.MoveLetIn.with_uco 0.5% 2.8% 3 0.332s
+─Glue.zrange_to_reflective_goal -------- 1.7% 2.6% 1 0.316s
+─k ------------------------------------- 2.1% 2.2% 1 0.268s
+─unify (constr) (constr) --------------- 2.1% 2.1% 8 0.092s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_montgomery ----------------- 0.0% 66.1% 1 7.964s
+ ├─IntegrationTestTemporaryMiscCommon.fa 16.2% 50.9% 1 6.128s
+ │ ├─reflexivity ----------------------- 20.6% 20.6% 1 2.480s
+ │ └─op_sig_side_conditions_t ---------- 0.0% 12.7% 1 1.528s
+ │ ├─DestructHyps.do_all_matches_then 0.0% 7.3% 4 0.232s
+ │ │└DestructHyps.do_one_match_then -- 0.3% 7.3% 24 0.052s
+ │ │└do_tac -------------------------- 0.0% 7.0% 20 0.048s
+ │ │└destruct H ---------------------- 6.9% 6.9% 20 0.048s
+ │ └─rewrite <- (ZRange.is_bounded_by_ 5.2% 5.2% 4 0.300s
+ └─IntegrationTestTemporaryMiscCommon.do 0.0% 14.1% 1 1.704s
+ ├─IntegrationTestTemporaryMiscCommon. 0.0% 11.2% 1 1.352s
+ │└rewrite <- (lem : lemT) by by_tac l 0.1% 11.2% 1 1.352s
+ │└by_tac ---------------------------- 0.0% 11.1% 4 0.476s
+ │ ├─DestructHyps.do_all_matches_then 0.0% 5.6% 4 0.176s
+ │ │└DestructHyps.do_one_match_then -- 0.2% 5.6% 20 0.052s
+ │ │└do_tac -------------------------- 0.0% 5.3% 16 0.048s
+ │ │└destruct H ---------------------- 5.3% 5.3% 16 0.048s
+ │ └─rewrite <- (ZRange.is_bounded_by_ 5.3% 5.3% 4 0.316s
+ └─IntegrationTestTemporaryMiscCommon. 0.0% 2.9% 1 0.348s
+ â””<Crypto.Util.Tactics.MoveLetIn.with 0.5% 2.8% 3 0.332s
+ â””k --------------------------------- 2.1% 2.2% 1 0.268s
+─Pipeline.refine_reflectively_gen ------ 0.0% 33.9% 1 4.084s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 28.3% 1 3.404s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 27.8% 1 3.352s
+ │ ├─ReflectiveTactics.solve_post_reifie 0.4% 14.1% 1 1.696s
+ │ │ ├─UnifyAbstractReflexivity.unify_tr 8.8% 10.6% 7 0.344s
+ │ │ └─ReflectiveTactics.unify_abstract_ 2.2% 3.0% 1 0.360s
+ │ └─ReflectiveTactics.do_reify -------- 0.0% 13.7% 1 1.656s
+ │ └Reify.Reify_rhs_gen --------------- 0.9% 13.2% 1 1.592s
+ │ └Reify.do_reify_abs_goal ----------- 6.0% 6.1% 2 0.732s
+ │ └Reify.do_reifyf_goal -------------- 5.4% 5.5% 80 0.660s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 5.6% 1 0.680s
+ â””Glue.zrange_to_reflective ----------- 0.0% 3.6% 1 0.428s
+ â””Glue.zrange_to_reflective_goal ------ 1.7% 2.6% 1 0.316s
+
+src/Specific/NISTP256/AMD64/fesub (real: 43.34, user: 39.59, sys: 0.26, mem: 793376 ko)
+COQC src/Specific/NISTP256/AMD64/feaddDisplay > src/Specific/NISTP256/AMD64/feaddDisplay.log
+COQC src/Specific/NISTP256/AMD64/fenzDisplay > src/Specific/NISTP256/AMD64/fenzDisplay.log
+COQC src/Specific/solinas32_2e255m765_12limbs/femul.v
+Finished transaction in 50.426 secs (46.528u,0.072s) (successful)
+total time: 46.544s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ -0.0% 94.9% 1 44.164s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 87.1% 1 40.552s
+─ReflectiveTactics.solve_side_conditions 0.0% 86.7% 1 40.372s
+─ReflectiveTactics.do_reify ------------ 0.0% 59.6% 1 27.740s
+─Reify.Reify_rhs_gen ------------------- 1.6% 58.9% 1 27.432s
+─Reify.do_reify_abs_goal --------------- 43.3% 43.6% 2 20.312s
+─Reify.do_reifyf_goal ------------------ 42.5% 42.8% 108 10.328s
+─ReflectiveTactics.solve_post_reified_si 0.1% 27.1% 1 12.632s
+─UnifyAbstractReflexivity.unify_transfor 18.6% 23.5% 7 3.552s
+─eexact -------------------------------- 13.7% 13.7% 110 0.136s
+─Glue.refine_to_reflective_glue' ------- 0.0% 7.8% 1 3.612s
+─Glue.zrange_to_reflective ------------- 0.0% 7.2% 1 3.332s
+─Glue.zrange_to_reflective_goal -------- 1.7% 5.5% 1 2.544s
+─synthesize ---------------------------- 0.0% 5.1% 1 2.380s
+─unify (constr) (constr) --------------- 5.1% 5.1% 6 1.068s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 5.0% 1 2.320s
+─change G' ----------------------------- 4.8% 4.8% 1 2.252s
+─rewrite H ----------------------------- 3.8% 3.8% 1 1.748s
+─pose proof (pf : Interpretation.Bo 3.6% 3.6% 1 1.664s
+─prove_interp_compile_correct ---------- 0.0% 3.5% 1 1.616s
+─rewrite ?EtaInterp.InterpExprEta ------ 3.2% 3.2% 1 1.468s
+─ReflectiveTactics.unify_abstract_cbv_in 1.6% 2.4% 1 1.124s
+─reflexivity --------------------------- 2.1% 2.1% 7 0.396s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ -0.0% 94.9% 1 44.164s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 87.1% 1 40.552s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 86.7% 1 40.372s
+ │ ├─ReflectiveTactics.do_reify -------- 0.0% 59.6% 1 27.740s
+ │ │└Reify.Reify_rhs_gen --------------- 1.6% 58.9% 1 27.432s
+ │ │ ├─Reify.do_reify_abs_goal --------- 43.3% 43.6% 2 20.312s
+ │ │ │└Reify.do_reifyf_goal ------------ 42.5% 42.8% 108 10.328s
+ │ │ │└eexact -------------------------- 13.2% 13.2% 108 0.072s
+ │ │ ├─rewrite H ----------------------- 3.8% 3.8% 1 1.748s
+ │ │ └─prove_interp_compile_correct ---- 0.0% 3.5% 1 1.616s
+ │ │ └rewrite ?EtaInterp.InterpExprEta 3.2% 3.2% 1 1.468s
+ │ └─ReflectiveTactics.solve_post_reifie 0.1% 27.1% 1 12.632s
+ │ ├─UnifyAbstractReflexivity.unify_tr 18.6% 23.5% 7 3.552s
+ │ │└unify (constr) (constr) --------- 4.3% 4.3% 5 1.068s
+ │ └─ReflectiveTactics.unify_abstract_ 1.6% 2.4% 1 1.124s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 7.8% 1 3.612s
+ â””Glue.zrange_to_reflective ----------- 0.0% 7.2% 1 3.332s
+ â””Glue.zrange_to_reflective_goal ------ 1.7% 5.5% 1 2.544s
+ â””pose proof (pf : Interpretation. 3.6% 3.6% 1 1.664s
+─synthesize ---------------------------- 0.0% 5.1% 1 2.380s
+â””IntegrationTestTemporaryMiscCommon.do_r 0.0% 5.0% 1 2.320s
+â””change G' ----------------------------- 4.8% 4.8% 1 2.252s
+
+Finished transaction in 80.129 secs (74.068u,0.024s) (successful)
+Closed under the global context
+total time: 46.544s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ -0.0% 94.9% 1 44.164s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 87.1% 1 40.552s
+─ReflectiveTactics.solve_side_conditions 0.0% 86.7% 1 40.372s
+─ReflectiveTactics.do_reify ------------ 0.0% 59.6% 1 27.740s
+─Reify.Reify_rhs_gen ------------------- 1.6% 58.9% 1 27.432s
+─Reify.do_reify_abs_goal --------------- 43.3% 43.6% 2 20.312s
+─Reify.do_reifyf_goal ------------------ 42.5% 42.8% 108 10.328s
+─ReflectiveTactics.solve_post_reified_si 0.1% 27.1% 1 12.632s
+─UnifyAbstractReflexivity.unify_transfor 18.6% 23.5% 7 3.552s
+─eexact -------------------------------- 13.7% 13.7% 110 0.136s
+─Glue.refine_to_reflective_glue' ------- 0.0% 7.8% 1 3.612s
+─Glue.zrange_to_reflective ------------- 0.0% 7.2% 1 3.332s
+─Glue.zrange_to_reflective_goal -------- 1.7% 5.5% 1 2.544s
+─synthesize ---------------------------- 0.0% 5.1% 1 2.380s
+─unify (constr) (constr) --------------- 5.1% 5.1% 6 1.068s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 5.0% 1 2.320s
+─change G' ----------------------------- 4.8% 4.8% 1 2.252s
+─rewrite H ----------------------------- 3.8% 3.8% 1 1.748s
+─pose proof (pf : Interpretation.Bo 3.6% 3.6% 1 1.664s
+─prove_interp_compile_correct ---------- 0.0% 3.5% 1 1.616s
+─rewrite ?EtaInterp.InterpExprEta ------ 3.2% 3.2% 1 1.468s
+─ReflectiveTactics.unify_abstract_cbv_in 1.6% 2.4% 1 1.124s
+─reflexivity --------------------------- 2.1% 2.1% 7 0.396s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ -0.0% 94.9% 1 44.164s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 87.1% 1 40.552s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 86.7% 1 40.372s
+ │ ├─ReflectiveTactics.do_reify -------- 0.0% 59.6% 1 27.740s
+ │ │└Reify.Reify_rhs_gen --------------- 1.6% 58.9% 1 27.432s
+ │ │ ├─Reify.do_reify_abs_goal --------- 43.3% 43.6% 2 20.312s
+ │ │ │└Reify.do_reifyf_goal ------------ 42.5% 42.8% 108 10.328s
+ │ │ │└eexact -------------------------- 13.2% 13.2% 108 0.072s
+ │ │ ├─rewrite H ----------------------- 3.8% 3.8% 1 1.748s
+ │ │ └─prove_interp_compile_correct ---- 0.0% 3.5% 1 1.616s
+ │ │ └rewrite ?EtaInterp.InterpExprEta 3.2% 3.2% 1 1.468s
+ │ └─ReflectiveTactics.solve_post_reifie 0.1% 27.1% 1 12.632s
+ │ ├─UnifyAbstractReflexivity.unify_tr 18.6% 23.5% 7 3.552s
+ │ │└unify (constr) (constr) --------- 4.3% 4.3% 5 1.068s
+ │ └─ReflectiveTactics.unify_abstract_ 1.6% 2.4% 1 1.124s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 7.8% 1 3.612s
+ â””Glue.zrange_to_reflective ----------- 0.0% 7.2% 1 3.332s
+ â””Glue.zrange_to_reflective_goal ------ 1.7% 5.5% 1 2.544s
+ â””pose proof (pf : Interpretation. 3.6% 3.6% 1 1.664s
+─synthesize ---------------------------- 0.0% 5.1% 1 2.380s
+â””IntegrationTestTemporaryMiscCommon.do_r 0.0% 5.0% 1 2.320s
+â””change G' ----------------------------- 4.8% 4.8% 1 2.252s
+
+src/Specific/solinas32_2e255m765_12limbs/femul (real: 155.79, user: 143.70, sys: 0.32, mem: 1454696 ko)
+COQC src/Specific/NISTP256/AMD64/feoppDisplay > src/Specific/NISTP256/AMD64/feoppDisplay.log
+COQC src/Specific/NISTP256/AMD64/fesubDisplay > src/Specific/NISTP256/AMD64/fesubDisplay.log
+COQC src/Specific/X25519/C64/fesquareDisplay > src/Specific/X25519/C64/fesquareDisplay.log
+COQC src/Specific/X25519/C64/fesubDisplay > src/Specific/X25519/C64/fesubDisplay.log
+COQC src/Specific/X25519/C64/freezeDisplay > src/Specific/X25519/C64/freezeDisplay.log
+COQC src/Specific/solinas32_2e255m765_13limbs/femul.v
+Finished transaction in 61.854 secs (57.328u,0.079s) (successful)
+total time: 57.348s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 94.6% 1 54.224s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 86.2% 1 49.452s
+─ReflectiveTactics.solve_side_conditions 0.0% 85.9% 1 49.264s
+─ReflectiveTactics.do_reify ------------ -0.0% 57.6% 1 33.004s
+─Reify.Reify_rhs_gen ------------------- 1.3% 56.9% 1 32.608s
+─Reify.do_reify_abs_goal --------------- 43.1% 43.3% 2 24.840s
+─Reify.do_reifyf_goal ------------------ 42.3% 42.6% 117 12.704s
+─ReflectiveTactics.solve_post_reified_si 0.1% 28.4% 1 16.260s
+─UnifyAbstractReflexivity.unify_transfor 19.6% 25.0% 7 4.824s
+─eexact -------------------------------- 13.9% 13.9% 119 0.144s
+─Glue.refine_to_reflective_glue' ------- 0.0% 8.3% 1 4.772s
+─Glue.zrange_to_reflective ------------- 0.0% 7.8% 1 4.484s
+─Glue.zrange_to_reflective_goal -------- 1.7% 6.0% 1 3.464s
+─synthesize ---------------------------- 0.0% 5.4% 1 3.124s
+─unify (constr) (constr) --------------- 5.4% 5.4% 6 1.540s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 5.3% 1 3.040s
+─change G' ----------------------------- 5.2% 5.2% 1 2.964s
+─pose proof (pf : Interpretation.Bo 4.2% 4.2% 1 2.416s
+─prove_interp_compile_correct ---------- 0.0% 3.3% 1 1.904s
+─rewrite H ----------------------------- 3.3% 3.3% 1 1.896s
+─rewrite ?EtaInterp.InterpExprEta ------ 3.0% 3.0% 1 1.732s
+─ReflectiveTactics.unify_abstract_cbv_in 1.4% 2.1% 1 1.212s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 94.6% 1 54.224s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 86.2% 1 49.452s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 85.9% 1 49.264s
+ │ ├─ReflectiveTactics.do_reify -------- -0.0% 57.6% 1 33.004s
+ │ │└Reify.Reify_rhs_gen --------------- 1.3% 56.9% 1 32.608s
+ │ │ ├─Reify.do_reify_abs_goal --------- 43.1% 43.3% 2 24.840s
+ │ │ │└Reify.do_reifyf_goal ------------ 42.3% 42.6% 117 12.704s
+ │ │ │└eexact -------------------------- 13.4% 13.4% 117 0.084s
+ │ │ ├─prove_interp_compile_correct ---- 0.0% 3.3% 1 1.904s
+ │ │ │└rewrite ?EtaInterp.InterpExprEta 3.0% 3.0% 1 1.732s
+ │ │ └─rewrite H ----------------------- 3.3% 3.3% 1 1.896s
+ │ └─ReflectiveTactics.solve_post_reifie 0.1% 28.4% 1 16.260s
+ │ ├─UnifyAbstractReflexivity.unify_tr 19.6% 25.0% 7 4.824s
+ │ │└unify (constr) (constr) --------- 4.8% 4.8% 5 1.540s
+ │ └─ReflectiveTactics.unify_abstract_ 1.4% 2.1% 1 1.212s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 8.3% 1 4.772s
+ â””Glue.zrange_to_reflective ----------- 0.0% 7.8% 1 4.484s
+ â””Glue.zrange_to_reflective_goal ------ 1.7% 6.0% 1 3.464s
+ â””pose proof (pf : Interpretation. 4.2% 4.2% 1 2.416s
+─synthesize ---------------------------- 0.0% 5.4% 1 3.124s
+â””IntegrationTestTemporaryMiscCommon.do_r 0.0% 5.3% 1 3.040s
+â””change G' ----------------------------- 5.2% 5.2% 1 2.964s
+
+Finished transaction in 94.432 secs (86.96u,0.02s) (successful)
+Closed under the global context
+total time: 57.348s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 94.6% 1 54.224s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 86.2% 1 49.452s
+─ReflectiveTactics.solve_side_conditions 0.0% 85.9% 1 49.264s
+─ReflectiveTactics.do_reify ------------ -0.0% 57.6% 1 33.004s
+─Reify.Reify_rhs_gen ------------------- 1.3% 56.9% 1 32.608s
+─Reify.do_reify_abs_goal --------------- 43.1% 43.3% 2 24.840s
+─Reify.do_reifyf_goal ------------------ 42.3% 42.6% 117 12.704s
+─ReflectiveTactics.solve_post_reified_si 0.1% 28.4% 1 16.260s
+─UnifyAbstractReflexivity.unify_transfor 19.6% 25.0% 7 4.824s
+─eexact -------------------------------- 13.9% 13.9% 119 0.144s
+─Glue.refine_to_reflective_glue' ------- 0.0% 8.3% 1 4.772s
+─Glue.zrange_to_reflective ------------- 0.0% 7.8% 1 4.484s
+─Glue.zrange_to_reflective_goal -------- 1.7% 6.0% 1 3.464s
+─synthesize ---------------------------- 0.0% 5.4% 1 3.124s
+─unify (constr) (constr) --------------- 5.4% 5.4% 6 1.540s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 5.3% 1 3.040s
+─change G' ----------------------------- 5.2% 5.2% 1 2.964s
+─pose proof (pf : Interpretation.Bo 4.2% 4.2% 1 2.416s
+─prove_interp_compile_correct ---------- 0.0% 3.3% 1 1.904s
+─rewrite H ----------------------------- 3.3% 3.3% 1 1.896s
+─rewrite ?EtaInterp.InterpExprEta ------ 3.0% 3.0% 1 1.732s
+─ReflectiveTactics.unify_abstract_cbv_in 1.4% 2.1% 1 1.212s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 94.6% 1 54.224s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 86.2% 1 49.452s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 85.9% 1 49.264s
+ │ ├─ReflectiveTactics.do_reify -------- -0.0% 57.6% 1 33.004s
+ │ │└Reify.Reify_rhs_gen --------------- 1.3% 56.9% 1 32.608s
+ │ │ ├─Reify.do_reify_abs_goal --------- 43.1% 43.3% 2 24.840s
+ │ │ │└Reify.do_reifyf_goal ------------ 42.3% 42.6% 117 12.704s
+ │ │ │└eexact -------------------------- 13.4% 13.4% 117 0.084s
+ │ │ ├─prove_interp_compile_correct ---- 0.0% 3.3% 1 1.904s
+ │ │ │└rewrite ?EtaInterp.InterpExprEta 3.0% 3.0% 1 1.732s
+ │ │ └─rewrite H ----------------------- 3.3% 3.3% 1 1.896s
+ │ └─ReflectiveTactics.solve_post_reifie 0.1% 28.4% 1 16.260s
+ │ ├─UnifyAbstractReflexivity.unify_tr 19.6% 25.0% 7 4.824s
+ │ │└unify (constr) (constr) --------- 4.8% 4.8% 5 1.540s
+ │ └─ReflectiveTactics.unify_abstract_ 1.4% 2.1% 1 1.212s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 8.3% 1 4.772s
+ â””Glue.zrange_to_reflective ----------- 0.0% 7.8% 1 4.484s
+ â””Glue.zrange_to_reflective_goal ------ 1.7% 6.0% 1 3.464s
+ â””pose proof (pf : Interpretation. 4.2% 4.2% 1 2.416s
+─synthesize ---------------------------- 0.0% 5.4% 1 3.124s
+â””IntegrationTestTemporaryMiscCommon.do_r 0.0% 5.3% 1 3.040s
+â””change G' ----------------------------- 5.2% 5.2% 1 2.964s
+
+src/Specific/solinas32_2e255m765_13limbs/femul (real: 181.77, user: 168.52, sys: 0.40, mem: 1589516 ko)
+COQC src/Specific/NISTP256/AMD64/femul.v
+Finished transaction in 119.257 secs (109.936u,0.256s) (successful)
+total time: 110.140s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 97.1% 1 106.964s
+─ReflectiveTactics.do_reflective_pipelin -0.0% 96.4% 1 106.196s
+─ReflectiveTactics.solve_side_conditions 0.0% 96.2% 1 105.992s
+─ReflectiveTactics.do_reify ------------ -0.0% 83.7% 1 92.208s
+─Reify.Reify_rhs_gen ------------------- 0.7% 83.5% 1 91.960s
+─Reify.do_reify_abs_goal --------------- 77.7% 77.8% 2 85.708s
+─Reify.do_reifyf_goal ------------------ 77.4% 77.5% 901 85.364s
+─eexact -------------------------------- 17.9% 17.9% 903 0.136s
+─ReflectiveTactics.solve_post_reified_si 0.3% 12.5% 1 13.784s
+─UnifyAbstractReflexivity.unify_transfor 9.8% 11.2% 7 3.356s
+─synthesize_montgomery ----------------- 0.0% 2.9% 1 3.176s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 97.1% 1 106.964s
+â””ReflectiveTactics.do_reflective_pipelin -0.0% 96.4% 1 106.196s
+â””ReflectiveTactics.solve_side_conditions 0.0% 96.2% 1 105.992s
+ ├─ReflectiveTactics.do_reify ---------- -0.0% 83.7% 1 92.208s
+ │└Reify.Reify_rhs_gen ----------------- 0.7% 83.5% 1 91.960s
+ │└Reify.do_reify_abs_goal ------------- 77.7% 77.8% 2 85.708s
+ │└Reify.do_reifyf_goal ---------------- 77.4% 77.5% 901 85.364s
+ │└eexact ------------------------------ 17.7% 17.7% 901 0.136s
+ └─ReflectiveTactics.solve_post_reified_ 0.3% 12.5% 1 13.784s
+ â””UnifyAbstractReflexivity.unify_transf 9.8% 11.2% 7 3.356s
+─synthesize_montgomery ----------------- 0.0% 2.9% 1 3.176s
+
+Finished transaction in 61.452 secs (58.503u,0.055s) (successful)
+Closed under the global context
+total time: 110.140s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 97.1% 1 106.964s
+─ReflectiveTactics.do_reflective_pipelin -0.0% 96.4% 1 106.196s
+─ReflectiveTactics.solve_side_conditions 0.0% 96.2% 1 105.992s
+─ReflectiveTactics.do_reify ------------ -0.0% 83.7% 1 92.208s
+─Reify.Reify_rhs_gen ------------------- 0.7% 83.5% 1 91.960s
+─Reify.do_reify_abs_goal --------------- 77.7% 77.8% 2 85.708s
+─Reify.do_reifyf_goal ------------------ 77.4% 77.5% 901 85.364s
+─eexact -------------------------------- 17.9% 17.9% 903 0.136s
+─ReflectiveTactics.solve_post_reified_si 0.3% 12.5% 1 13.784s
+─UnifyAbstractReflexivity.unify_transfor 9.8% 11.2% 7 3.356s
+─synthesize_montgomery ----------------- 0.0% 2.9% 1 3.176s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 97.1% 1 106.964s
+â””ReflectiveTactics.do_reflective_pipelin -0.0% 96.4% 1 106.196s
+â””ReflectiveTactics.solve_side_conditions 0.0% 96.2% 1 105.992s
+ ├─ReflectiveTactics.do_reify ---------- -0.0% 83.7% 1 92.208s
+ │└Reify.Reify_rhs_gen ----------------- 0.7% 83.5% 1 91.960s
+ │└Reify.do_reify_abs_goal ------------- 77.7% 77.8% 2 85.708s
+ │└Reify.do_reifyf_goal ---------------- 77.4% 77.5% 901 85.364s
+ │└eexact ------------------------------ 17.7% 17.7% 901 0.136s
+ └─ReflectiveTactics.solve_post_reified_ 0.3% 12.5% 1 13.784s
+ â””UnifyAbstractReflexivity.unify_transf 9.8% 11.2% 7 3.356s
+─synthesize_montgomery ----------------- 0.0% 2.9% 1 3.176s
+
+src/Specific/NISTP256/AMD64/femul (real: 202.96, user: 189.62, sys: 0.64, mem: 3302508 ko)
+COQC src/Specific/NISTP256/AMD64/femulDisplay > src/Specific/NISTP256/AMD64/femulDisplay.log
+COQC src/Specific/X25519/C64/ladderstep.v
+total time: 52.080s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_xzladderstep --------------- 0.0% 100.0% 1 52.080s
+─Pipeline.refine_reflectively_gen ------ 0.0% 98.5% 1 51.320s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 93.8% 1 48.872s
+─ReflectiveTactics.solve_side_conditions 0.0% 93.7% 1 48.776s
+─ReflectiveTactics.solve_post_reified_si 0.2% 56.5% 1 29.412s
+─UnifyAbstractReflexivity.unify_transfor 44.7% 49.1% 7 6.968s
+─ReflectiveTactics.do_reify ------------ 0.0% 37.2% 1 19.364s
+─Reify.Reify_rhs_gen ------------------- 2.1% 23.4% 1 12.200s
+─Reify.do_reifyf_goal ------------------ 11.2% 11.3% 138 1.884s
+─Compilers.Reify.reify_context_variables 0.1% 9.2% 1 4.808s
+─rewrite H ----------------------------- 7.3% 7.3% 1 3.816s
+─ReflectiveTactics.unify_abstract_cbv_in 4.7% 6.4% 1 3.336s
+─Glue.refine_to_reflective_glue' ------- 0.0% 4.7% 1 2.448s
+─Glue.zrange_to_reflective ------------- 0.0% 4.0% 1 2.068s
+─Reify.transitivity_tt ----------------- 0.1% 3.7% 2 0.984s
+─transitivity -------------------------- 3.5% 3.5% 10 0.880s
+─reflexivity --------------------------- 3.4% 3.4% 11 0.772s
+─Glue.zrange_to_reflective_goal -------- 2.4% 3.3% 1 1.728s
+─eexact -------------------------------- 3.2% 3.2% 140 0.032s
+─unify (constr) (constr) --------------- 3.1% 3.1% 6 0.852s
+─clear (var_list) ---------------------- 3.1% 3.1% 98 0.584s
+─UnfoldArg.unfold_second_arg ----------- 0.4% 3.0% 2 1.576s
+─tac ----------------------------------- 2.1% 3.0% 2 1.564s
+─ClearAll.clear_all -------------------- 0.2% 2.8% 7 0.584s
+─ChangeInAll.change_with_compute_in_all 0.0% 2.6% 221 0.012s
+─change c with c' in * ----------------- 2.5% 2.5% 221 0.012s
+─Reify.do_reify_abs_goal --------------- 2.4% 2.5% 2 1.276s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_xzladderstep --------------- 0.0% 100.0% 1 52.080s
+â””Pipeline.refine_reflectively_gen ------ 0.0% 98.5% 1 51.320s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 93.8% 1 48.872s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 93.7% 1 48.776s
+ │ ├─ReflectiveTactics.solve_post_reifie 0.2% 56.5% 1 29.412s
+ │ │ ├─UnifyAbstractReflexivity.unify_tr 44.7% 49.1% 7 6.968s
+ │ │ │└ClearAll.clear_all -------------- 0.2% 2.8% 7 0.584s
+ │ │ │└clear (var_list) ---------------- 2.7% 2.7% 65 0.584s
+ │ │ └─ReflectiveTactics.unify_abstract_ 4.7% 6.4% 1 3.336s
+ │ └─ReflectiveTactics.do_reify -------- 0.0% 37.2% 1 19.364s
+ │ ├─Reify.Reify_rhs_gen ------------- 2.1% 23.4% 1 12.200s
+ │ │ ├─rewrite H --------------------- 7.3% 7.3% 1 3.816s
+ │ │ ├─Reify.transitivity_tt --------- 0.1% 3.7% 2 0.984s
+ │ │ │└transitivity ------------------ 3.4% 3.4% 4 0.880s
+ │ │ ├─tac --------------------------- 2.1% 3.0% 1 1.564s
+ │ │ └─Reify.do_reify_abs_goal ------- 2.4% 2.5% 2 1.276s
+ │ │ └Reify.do_reifyf_goal ---------- 2.2% 2.2% 25 1.148s
+ │ ├─Compilers.Reify.reify_context_var 0.1% 9.2% 1 4.808s
+ │ │└Reify.do_reifyf_goal ------------ 9.0% 9.1% 113 1.884s
+ │ │└eexact -------------------------- 2.4% 2.4% 113 0.032s
+ │ └─UnfoldArg.unfold_second_arg ----- 0.4% 3.0% 2 1.576s
+ │ └ChangeInAll.change_with_compute_i 0.0% 2.6% 221 0.012s
+ │ └change c with c' in * ----------- 2.5% 2.5% 221 0.012s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 4.7% 1 2.448s
+ â””Glue.zrange_to_reflective ----------- 0.0% 4.0% 1 2.068s
+ â””Glue.zrange_to_reflective_goal ------ 2.4% 3.3% 1 1.728s
+
+Finished transaction in 171.122 secs (161.392u,0.039s) (successful)
+Closed under the global context
+total time: 52.080s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_xzladderstep --------------- 0.0% 100.0% 1 52.080s
+─Pipeline.refine_reflectively_gen ------ 0.0% 98.5% 1 51.320s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 93.8% 1 48.872s
+─ReflectiveTactics.solve_side_conditions 0.0% 93.7% 1 48.776s
+─ReflectiveTactics.solve_post_reified_si 0.2% 56.5% 1 29.412s
+─UnifyAbstractReflexivity.unify_transfor 44.7% 49.1% 7 6.968s
+─ReflectiveTactics.do_reify ------------ 0.0% 37.2% 1 19.364s
+─Reify.Reify_rhs_gen ------------------- 2.1% 23.4% 1 12.200s
+─Reify.do_reifyf_goal ------------------ 11.2% 11.3% 138 1.884s
+─Compilers.Reify.reify_context_variables 0.1% 9.2% 1 4.808s
+─rewrite H ----------------------------- 7.3% 7.3% 1 3.816s
+─ReflectiveTactics.unify_abstract_cbv_in 4.7% 6.4% 1 3.336s
+─Glue.refine_to_reflective_glue' ------- 0.0% 4.7% 1 2.448s
+─Glue.zrange_to_reflective ------------- 0.0% 4.0% 1 2.068s
+─Reify.transitivity_tt ----------------- 0.1% 3.7% 2 0.984s
+─transitivity -------------------------- 3.5% 3.5% 10 0.880s
+─reflexivity --------------------------- 3.4% 3.4% 11 0.772s
+─Glue.zrange_to_reflective_goal -------- 2.4% 3.3% 1 1.728s
+─eexact -------------------------------- 3.2% 3.2% 140 0.032s
+─unify (constr) (constr) --------------- 3.1% 3.1% 6 0.852s
+─clear (var_list) ---------------------- 3.1% 3.1% 98 0.584s
+─UnfoldArg.unfold_second_arg ----------- 0.4% 3.0% 2 1.576s
+─tac ----------------------------------- 2.1% 3.0% 2 1.564s
+─ClearAll.clear_all -------------------- 0.2% 2.8% 7 0.584s
+─ChangeInAll.change_with_compute_in_all 0.0% 2.6% 221 0.012s
+─change c with c' in * ----------------- 2.5% 2.5% 221 0.012s
+─Reify.do_reify_abs_goal --------------- 2.4% 2.5% 2 1.276s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_xzladderstep --------------- 0.0% 100.0% 1 52.080s
+â””Pipeline.refine_reflectively_gen ------ 0.0% 98.5% 1 51.320s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 93.8% 1 48.872s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 93.7% 1 48.776s
+ │ ├─ReflectiveTactics.solve_post_reifie 0.2% 56.5% 1 29.412s
+ │ │ ├─UnifyAbstractReflexivity.unify_tr 44.7% 49.1% 7 6.968s
+ │ │ │└ClearAll.clear_all -------------- 0.2% 2.8% 7 0.584s
+ │ │ │└clear (var_list) ---------------- 2.7% 2.7% 65 0.584s
+ │ │ └─ReflectiveTactics.unify_abstract_ 4.7% 6.4% 1 3.336s
+ │ └─ReflectiveTactics.do_reify -------- 0.0% 37.2% 1 19.364s
+ │ ├─Reify.Reify_rhs_gen ------------- 2.1% 23.4% 1 12.200s
+ │ │ ├─rewrite H --------------------- 7.3% 7.3% 1 3.816s
+ │ │ ├─Reify.transitivity_tt --------- 0.1% 3.7% 2 0.984s
+ │ │ │└transitivity ------------------ 3.4% 3.4% 4 0.880s
+ │ │ ├─tac --------------------------- 2.1% 3.0% 1 1.564s
+ │ │ └─Reify.do_reify_abs_goal ------- 2.4% 2.5% 2 1.276s
+ │ │ └Reify.do_reifyf_goal ---------- 2.2% 2.2% 25 1.148s
+ │ ├─Compilers.Reify.reify_context_var 0.1% 9.2% 1 4.808s
+ │ │└Reify.do_reifyf_goal ------------ 9.0% 9.1% 113 1.884s
+ │ │└eexact -------------------------- 2.4% 2.4% 113 0.032s
+ │ └─UnfoldArg.unfold_second_arg ----- 0.4% 3.0% 2 1.576s
+ │ └ChangeInAll.change_with_compute_i 0.0% 2.6% 221 0.012s
+ │ └change c with c' in * ----------- 2.5% 2.5% 221 0.012s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 4.7% 1 2.448s
+ â””Glue.zrange_to_reflective ----------- 0.0% 4.0% 1 2.068s
+ â””Glue.zrange_to_reflective_goal ------ 2.4% 3.3% 1 1.728s
+
+src/Specific/X25519/C64/ladderstep (real: 256.77, user: 241.34, sys: 0.45, mem: 1617000 ko)
+COQC src/Specific/X25519/C64/ladderstepDisplay > src/Specific/X25519/C64/ladderstepDisplay.log
diff --git a/test-suite/coq-makefile/timing/precomputed-time-tests/001-correct-diff-sorting-order/time-of-build-before.log.in b/test-suite/coq-makefile/timing/precomputed-time-tests/001-correct-diff-sorting-order/time-of-build-before.log.in
new file mode 100644
index 000000000..14102902b
--- /dev/null
+++ b/test-suite/coq-makefile/timing/precomputed-time-tests/001-correct-diff-sorting-order/time-of-build-before.log.in
@@ -0,0 +1,1662 @@
+COQDEP src/Compilers/Z/Bounds/Pipeline/Definition.v
+COQDEP src/Compilers/Z/Bounds/Pipeline/ReflectiveTactics.v
+/home/jgross/.local64/coq/coq-master/bin/coq_makefile -f _CoqProject INSTALLDEFAULTROOT = Crypto -o Makefile-old
+COQ_MAKEFILE -f _CoqProject > Makefile.coq
+make --no-print-directory -C coqprime
+make[1]: Nothing to be done for 'all'.
+ECHO > _CoqProject
+COQC src/Compilers/Z/Bounds/Pipeline/Definition.v
+src/Compilers/Z/Bounds/Pipeline/Definition (real: 7.40, user: 7.22, sys: 0.15, mem: 578344 ko)
+COQC src/Compilers/Z/Bounds/Pipeline/ReflectiveTactics.v
+src/Compilers/Z/Bounds/Pipeline/ReflectiveTactics (real: 1.73, user: 1.58, sys: 0.14, mem: 546112 ko)
+COQC src/Compilers/Z/Bounds/Pipeline.v
+src/Compilers/Z/Bounds/Pipeline (real: 1.18, user: 1.04, sys: 0.14, mem: 539160 ko)
+COQC src/Specific/Framework/SynthesisFramework.v
+src/Specific/Framework/SynthesisFramework (real: 1.95, user: 1.72, sys: 0.22, mem: 648632 ko)
+COQC src/Specific/X25519/C64/Synthesis.v
+src/Specific/X25519/C64/Synthesis (real: 11.23, user: 10.30, sys: 0.19, mem: 687812 ko)
+COQC src/Specific/NISTP256/AMD64/Synthesis.v
+src/Specific/NISTP256/AMD64/Synthesis (real: 13.74, user: 12.54, sys: 0.23, mem: 667664 ko)
+COQC src/Specific/X25519/C64/feadd.v
+Finished transaction in 2.852 secs (2.699u,0.012s) (successful)
+total time: 2.664s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 97.4% 1 2.596s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 70.9% 1 1.888s
+─ReflectiveTactics.solve_side_conditions 0.0% 69.5% 1 1.852s
+─ReflectiveTactics.solve_post_reified_si 1.4% 43.7% 1 1.164s
+─UnifyAbstractReflexivity.unify_transfor 27.0% 31.7% 8 0.256s
+─Glue.refine_to_reflective_glue' ------- 0.0% 26.6% 1 0.708s
+─ReflectiveTactics.do_reify ------------ 0.0% 25.8% 1 0.688s
+─Reify.Reify_rhs_gen ------------------- 2.0% 24.0% 1 0.640s
+─Glue.zrange_to_reflective ------------- 0.0% 17.9% 1 0.476s
+─Glue.zrange_to_reflective_goal -------- 8.1% 13.1% 1 0.348s
+─Reify.do_reify_abs_goal --------------- 12.8% 12.9% 2 0.344s
+─Reify.do_reifyf_goal ------------------ 11.7% 11.9% 16 0.316s
+─ReflectiveTactics.unify_abstract_cbv_in 7.7% 10.2% 1 0.272s
+─unify (constr) (constr) --------------- 6.0% 6.0% 7 0.064s
+─Glue.pattern_sig_sig_assoc ------------ 0.0% 5.0% 1 0.132s
+─assert (H : is_bounded_by' bounds (map' 4.5% 4.7% 2 0.068s
+─Glue.pattern_proj1_sig_in_sig --------- 1.5% 4.7% 1 0.124s
+─pose proof (pf : Interpretation.Bo 3.3% 3.3% 1 0.088s
+─Glue.split_BoundedWordToZ ------------- 0.2% 3.0% 1 0.080s
+─destruct x ---------------------------- 2.7% 2.7% 4 0.032s
+─clearbody (ne_var_list) --------------- 2.7% 2.7% 4 0.056s
+─destruct_sig -------------------------- 0.0% 2.7% 4 0.040s
+─synthesize ---------------------------- 0.0% 2.6% 1 0.068s
+─prove_interp_compile_correct ---------- 0.0% 2.4% 1 0.064s
+─reflexivity --------------------------- 2.3% 2.3% 7 0.028s
+─rewrite ?EtaInterp.InterpExprEta ------ 2.3% 2.3% 1 0.060s
+─ClearbodyAll.clearbody_all ------------ 0.0% 2.1% 2 0.056s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 97.4% 1 2.596s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 70.9% 1 1.888s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 69.5% 1 1.852s
+ │ ├─ReflectiveTactics.solve_post_reifie 1.4% 43.7% 1 1.164s
+ │ │ ├─UnifyAbstractReflexivity.unify_tr 27.0% 31.7% 8 0.256s
+ │ │ │└unify (constr) (constr) --------- 3.6% 3.6% 6 0.028s
+ │ │ └─ReflectiveTactics.unify_abstract_ 7.7% 10.2% 1 0.272s
+ │ │ └unify (constr) (constr) --------- 2.4% 2.4% 1 0.064s
+ │ └─ReflectiveTactics.do_reify -------- 0.0% 25.8% 1 0.688s
+ │ └Reify.Reify_rhs_gen --------------- 2.0% 24.0% 1 0.640s
+ │ ├─Reify.do_reify_abs_goal --------- 12.8% 12.9% 2 0.344s
+ │ │└Reify.do_reifyf_goal ------------ 11.7% 11.9% 16 0.316s
+ │ └─prove_interp_compile_correct ---- 0.0% 2.4% 1 0.064s
+ │ └rewrite ?EtaInterp.InterpExprEta 2.3% 2.3% 1 0.060s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 26.6% 1 0.708s
+ ├─Glue.zrange_to_reflective --------- 0.0% 17.9% 1 0.476s
+ │ ├─Glue.zrange_to_reflective_goal -- 8.1% 13.1% 1 0.348s
+ │ │└pose proof (pf : Interpretat 3.3% 3.3% 1 0.088s
+ │ └─assert (H : is_bounded_by' bounds 4.5% 4.7% 2 0.068s
+ ├─Glue.pattern_sig_sig_assoc -------- 0.0% 5.0% 1 0.132s
+ │└Glue.pattern_proj1_sig_in_sig ----- 1.5% 4.7% 1 0.124s
+ │└ClearbodyAll.clearbody_all -------- 0.0% 2.1% 2 0.056s
+ │└clearbody (ne_var_list) ----------- 2.1% 2.1% 1 0.056s
+ └─Glue.split_BoundedWordToZ --------- 0.2% 3.0% 1 0.080s
+ â””destruct_sig ---------------------- 0.0% 2.7% 4 0.040s
+ â””destruct x ------------------------ 2.1% 2.1% 2 0.032s
+─synthesize ---------------------------- 0.0% 2.6% 1 0.068s
+
+Finished transaction in 5.46 secs (5.068u,0.003s) (successful)
+Closed under the global context
+total time: 2.664s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 97.4% 1 2.596s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 70.9% 1 1.888s
+─ReflectiveTactics.solve_side_conditions 0.0% 69.5% 1 1.852s
+─ReflectiveTactics.solve_post_reified_si 1.4% 43.7% 1 1.164s
+─UnifyAbstractReflexivity.unify_transfor 27.0% 31.7% 8 0.256s
+─Glue.refine_to_reflective_glue' ------- 0.0% 26.6% 1 0.708s
+─ReflectiveTactics.do_reify ------------ 0.0% 25.8% 1 0.688s
+─Reify.Reify_rhs_gen ------------------- 2.0% 24.0% 1 0.640s
+─Glue.zrange_to_reflective ------------- 0.0% 17.9% 1 0.476s
+─Glue.zrange_to_reflective_goal -------- 8.1% 13.1% 1 0.348s
+─Reify.do_reify_abs_goal --------------- 12.8% 12.9% 2 0.344s
+─Reify.do_reifyf_goal ------------------ 11.7% 11.9% 16 0.316s
+─ReflectiveTactics.unify_abstract_cbv_in 7.7% 10.2% 1 0.272s
+─unify (constr) (constr) --------------- 6.0% 6.0% 7 0.064s
+─Glue.pattern_sig_sig_assoc ------------ 0.0% 5.0% 1 0.132s
+─assert (H : is_bounded_by' bounds (map' 4.5% 4.7% 2 0.068s
+─Glue.pattern_proj1_sig_in_sig --------- 1.5% 4.7% 1 0.124s
+─pose proof (pf : Interpretation.Bo 3.3% 3.3% 1 0.088s
+─Glue.split_BoundedWordToZ ------------- 0.2% 3.0% 1 0.080s
+─destruct x ---------------------------- 2.7% 2.7% 4 0.032s
+─clearbody (ne_var_list) --------------- 2.7% 2.7% 4 0.056s
+─destruct_sig -------------------------- 0.0% 2.7% 4 0.040s
+─synthesize ---------------------------- 0.0% 2.6% 1 0.068s
+─prove_interp_compile_correct ---------- 0.0% 2.4% 1 0.064s
+─reflexivity --------------------------- 2.3% 2.3% 7 0.028s
+─rewrite ?EtaInterp.InterpExprEta ------ 2.3% 2.3% 1 0.060s
+─ClearbodyAll.clearbody_all ------------ 0.0% 2.1% 2 0.056s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 97.4% 1 2.596s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 70.9% 1 1.888s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 69.5% 1 1.852s
+ │ ├─ReflectiveTactics.solve_post_reifie 1.4% 43.7% 1 1.164s
+ │ │ ├─UnifyAbstractReflexivity.unify_tr 27.0% 31.7% 8 0.256s
+ │ │ │└unify (constr) (constr) --------- 3.6% 3.6% 6 0.028s
+ │ │ └─ReflectiveTactics.unify_abstract_ 7.7% 10.2% 1 0.272s
+ │ │ └unify (constr) (constr) --------- 2.4% 2.4% 1 0.064s
+ │ └─ReflectiveTactics.do_reify -------- 0.0% 25.8% 1 0.688s
+ │ └Reify.Reify_rhs_gen --------------- 2.0% 24.0% 1 0.640s
+ │ ├─Reify.do_reify_abs_goal --------- 12.8% 12.9% 2 0.344s
+ │ │└Reify.do_reifyf_goal ------------ 11.7% 11.9% 16 0.316s
+ │ └─prove_interp_compile_correct ---- 0.0% 2.4% 1 0.064s
+ │ └rewrite ?EtaInterp.InterpExprEta 2.3% 2.3% 1 0.060s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 26.6% 1 0.708s
+ ├─Glue.zrange_to_reflective --------- 0.0% 17.9% 1 0.476s
+ │ ├─Glue.zrange_to_reflective_goal -- 8.1% 13.1% 1 0.348s
+ │ │└pose proof (pf : Interpretat 3.3% 3.3% 1 0.088s
+ │ └─assert (H : is_bounded_by' bounds 4.5% 4.7% 2 0.068s
+ ├─Glue.pattern_sig_sig_assoc -------- 0.0% 5.0% 1 0.132s
+ │└Glue.pattern_proj1_sig_in_sig ----- 1.5% 4.7% 1 0.124s
+ │└ClearbodyAll.clearbody_all -------- 0.0% 2.1% 2 0.056s
+ │└clearbody (ne_var_list) ----------- 2.1% 2.1% 1 0.056s
+ └─Glue.split_BoundedWordToZ --------- 0.2% 3.0% 1 0.080s
+ â””destruct_sig ---------------------- 0.0% 2.7% 4 0.040s
+ â””destruct x ------------------------ 2.1% 2.1% 2 0.032s
+─synthesize ---------------------------- 0.0% 2.6% 1 0.068s
+
+src/Specific/X25519/C64/feadd (real: 23.43, user: 21.41, sys: 0.26, mem: 766168 ko)
+COQC src/Specific/solinas32_2e255m765_12limbs/Synthesis.v
+src/Specific/solinas32_2e255m765_12limbs/Synthesis (real: 39.53, user: 36.64, sys: 0.21, mem: 729464 ko)
+COQC src/Specific/X25519/C64/fecarry.v
+Finished transaction in 4.798 secs (4.375u,0.003s) (successful)
+total time: 4.332s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.1% 99.0% 1 4.288s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 89.2% 1 3.864s
+─ReflectiveTactics.solve_side_conditions 0.0% 88.1% 1 3.816s
+─ReflectiveTactics.do_reify ------------ 0.0% 53.2% 1 2.304s
+─Reify.Reify_rhs_gen ------------------- 1.8% 52.6% 1 2.280s
+─ReflectiveTactics.solve_post_reified_si 0.6% 34.9% 1 1.512s
+─Reify.do_reify_abs_goal --------------- 33.5% 33.9% 2 1.468s
+─Reify.do_reifyf_goal ------------------ 32.1% 32.5% 29 1.408s
+─UnifyAbstractReflexivity.unify_transfor 22.5% 27.1% 8 0.316s
+─Glue.refine_to_reflective_glue' ------- 0.1% 9.7% 1 0.420s
+─eexact -------------------------------- 9.3% 9.3% 31 0.024s
+─ReflectiveTactics.unify_abstract_cbv_in 5.2% 7.0% 1 0.304s
+─Glue.zrange_to_reflective ------------- 0.1% 6.2% 1 0.268s
+─prove_interp_compile_correct ---------- 0.0% 5.6% 1 0.244s
+─rewrite ?EtaInterp.InterpExprEta ------ 5.3% 5.3% 1 0.228s
+─unify (constr) (constr) --------------- 5.3% 5.3% 7 0.076s
+─Glue.zrange_to_reflective_goal -------- 4.0% 4.9% 1 0.212s
+─rewrite H ----------------------------- 3.4% 3.4% 1 0.148s
+─tac ----------------------------------- 1.8% 2.6% 2 0.112s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.1% 99.0% 1 4.288s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 89.2% 1 3.864s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 88.1% 1 3.816s
+ │ ├─ReflectiveTactics.do_reify -------- 0.0% 53.2% 1 2.304s
+ │ │└Reify.Reify_rhs_gen --------------- 1.8% 52.6% 1 2.280s
+ │ │ ├─Reify.do_reify_abs_goal --------- 33.5% 33.9% 2 1.468s
+ │ │ │└Reify.do_reifyf_goal ------------ 32.1% 32.5% 29 1.408s
+ │ │ │└eexact -------------------------- 8.6% 8.6% 29 0.024s
+ │ │ ├─prove_interp_compile_correct ---- 0.0% 5.6% 1 0.244s
+ │ │ │└rewrite ?EtaInterp.InterpExprEta 5.3% 5.3% 1 0.228s
+ │ │ ├─rewrite H ----------------------- 3.4% 3.4% 1 0.148s
+ │ │ └─tac ----------------------------- 1.8% 2.6% 1 0.112s
+ │ └─ReflectiveTactics.solve_post_reifie 0.6% 34.9% 1 1.512s
+ │ ├─UnifyAbstractReflexivity.unify_tr 22.5% 27.1% 8 0.316s
+ │ │└unify (constr) (constr) --------- 3.5% 3.5% 6 0.044s
+ │ └─ReflectiveTactics.unify_abstract_ 5.2% 7.0% 1 0.304s
+ └─Glue.refine_to_reflective_glue' ----- 0.1% 9.7% 1 0.420s
+ â””Glue.zrange_to_reflective ----------- 0.1% 6.2% 1 0.268s
+ â””Glue.zrange_to_reflective_goal ------ 4.0% 4.9% 1 0.212s
+
+Finished transaction in 8.342 secs (7.604u,0.008s) (successful)
+Closed under the global context
+total time: 4.332s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.1% 99.0% 1 4.288s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 89.2% 1 3.864s
+─ReflectiveTactics.solve_side_conditions 0.0% 88.1% 1 3.816s
+─ReflectiveTactics.do_reify ------------ 0.0% 53.2% 1 2.304s
+─Reify.Reify_rhs_gen ------------------- 1.8% 52.6% 1 2.280s
+─ReflectiveTactics.solve_post_reified_si 0.6% 34.9% 1 1.512s
+─Reify.do_reify_abs_goal --------------- 33.5% 33.9% 2 1.468s
+─Reify.do_reifyf_goal ------------------ 32.1% 32.5% 29 1.408s
+─UnifyAbstractReflexivity.unify_transfor 22.5% 27.1% 8 0.316s
+─Glue.refine_to_reflective_glue' ------- 0.1% 9.7% 1 0.420s
+─eexact -------------------------------- 9.3% 9.3% 31 0.024s
+─ReflectiveTactics.unify_abstract_cbv_in 5.2% 7.0% 1 0.304s
+─Glue.zrange_to_reflective ------------- 0.1% 6.2% 1 0.268s
+─prove_interp_compile_correct ---------- 0.0% 5.6% 1 0.244s
+─rewrite ?EtaInterp.InterpExprEta ------ 5.3% 5.3% 1 0.228s
+─unify (constr) (constr) --------------- 5.3% 5.3% 7 0.076s
+─Glue.zrange_to_reflective_goal -------- 4.0% 4.9% 1 0.212s
+─rewrite H ----------------------------- 3.4% 3.4% 1 0.148s
+─tac ----------------------------------- 1.8% 2.6% 2 0.112s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.1% 99.0% 1 4.288s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 89.2% 1 3.864s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 88.1% 1 3.816s
+ │ ├─ReflectiveTactics.do_reify -------- 0.0% 53.2% 1 2.304s
+ │ │└Reify.Reify_rhs_gen --------------- 1.8% 52.6% 1 2.280s
+ │ │ ├─Reify.do_reify_abs_goal --------- 33.5% 33.9% 2 1.468s
+ │ │ │└Reify.do_reifyf_goal ------------ 32.1% 32.5% 29 1.408s
+ │ │ │└eexact -------------------------- 8.6% 8.6% 29 0.024s
+ │ │ ├─prove_interp_compile_correct ---- 0.0% 5.6% 1 0.244s
+ │ │ │└rewrite ?EtaInterp.InterpExprEta 5.3% 5.3% 1 0.228s
+ │ │ ├─rewrite H ----------------------- 3.4% 3.4% 1 0.148s
+ │ │ └─tac ----------------------------- 1.8% 2.6% 1 0.112s
+ │ └─ReflectiveTactics.solve_post_reifie 0.6% 34.9% 1 1.512s
+ │ ├─UnifyAbstractReflexivity.unify_tr 22.5% 27.1% 8 0.316s
+ │ │└unify (constr) (constr) --------- 3.5% 3.5% 6 0.044s
+ │ └─ReflectiveTactics.unify_abstract_ 5.2% 7.0% 1 0.304s
+ └─Glue.refine_to_reflective_glue' ----- 0.1% 9.7% 1 0.420s
+ â””Glue.zrange_to_reflective ----------- 0.1% 6.2% 1 0.268s
+ â””Glue.zrange_to_reflective_goal ------ 4.0% 4.9% 1 0.212s
+
+src/Specific/X25519/C64/fecarry (real: 28.85, user: 26.31, sys: 0.25, mem: 787148 ko)
+COQC src/Specific/solinas32_2e255m765_13limbs/Synthesis.v
+src/Specific/solinas32_2e255m765_13limbs/Synthesis (real: 49.50, user: 45.58, sys: 0.18, mem: 744472 ko)
+COQC src/Specific/X25519/C64/femul.v
+Finished transaction in 9.325 secs (8.62u,0.016s) (successful)
+total time: 8.576s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 95.8% 1 8.220s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 87.7% 1 7.524s
+─ReflectiveTactics.solve_side_conditions 0.0% 87.0% 1 7.460s
+─ReflectiveTactics.do_reify ------------ 0.0% 43.8% 1 3.760s
+─ReflectiveTactics.solve_post_reified_si 0.6% 43.1% 1 3.700s
+─Reify.Reify_rhs_gen ------------------- 1.4% 43.0% 1 3.688s
+─UnifyAbstractReflexivity.unify_transfor 31.1% 36.7% 8 1.096s
+─Reify.do_reify_abs_goal --------------- 26.3% 26.6% 2 2.284s
+─Reify.do_reifyf_goal ------------------ 25.3% 25.6% 58 1.440s
+─Glue.refine_to_reflective_glue' ------- 0.0% 8.1% 1 0.696s
+─eexact -------------------------------- 7.6% 7.6% 60 0.032s
+─unify (constr) (constr) --------------- 5.8% 5.8% 7 0.128s
+─Glue.zrange_to_reflective ------------- 0.0% 5.7% 1 0.488s
+─ReflectiveTactics.unify_abstract_cbv_in 3.8% 5.5% 1 0.468s
+─prove_interp_compile_correct ---------- 0.0% 5.2% 1 0.448s
+─rewrite ?EtaInterp.InterpExprEta ------ 4.9% 4.9% 1 0.416s
+─Glue.zrange_to_reflective_goal -------- 2.6% 4.2% 1 0.364s
+─synthesize ---------------------------- 0.0% 4.2% 1 0.356s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 3.8% 1 0.328s
+─rewrite H ----------------------------- 3.2% 3.2% 1 0.276s
+─change G' ----------------------------- 3.2% 3.2% 1 0.272s
+─tac ----------------------------------- 1.4% 2.1% 2 0.180s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 95.8% 1 8.220s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 87.7% 1 7.524s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 87.0% 1 7.460s
+ │ ├─ReflectiveTactics.do_reify -------- 0.0% 43.8% 1 3.760s
+ │ │└Reify.Reify_rhs_gen --------------- 1.4% 43.0% 1 3.688s
+ │ │ ├─Reify.do_reify_abs_goal --------- 26.3% 26.6% 2 2.284s
+ │ │ │└Reify.do_reifyf_goal ------------ 25.3% 25.6% 58 1.440s
+ │ │ │└eexact -------------------------- 6.9% 6.9% 58 0.032s
+ │ │ ├─prove_interp_compile_correct ---- 0.0% 5.2% 1 0.448s
+ │ │ │└rewrite ?EtaInterp.InterpExprEta 4.9% 4.9% 1 0.416s
+ │ │ ├─rewrite H ----------------------- 3.2% 3.2% 1 0.276s
+ │ │ └─tac ----------------------------- 1.4% 2.1% 1 0.180s
+ │ └─ReflectiveTactics.solve_post_reifie 0.6% 43.1% 1 3.700s
+ │ ├─UnifyAbstractReflexivity.unify_tr 31.1% 36.7% 8 1.096s
+ │ │└unify (constr) (constr) --------- 4.3% 4.3% 6 0.092s
+ │ └─ReflectiveTactics.unify_abstract_ 3.8% 5.5% 1 0.468s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 8.1% 1 0.696s
+ â””Glue.zrange_to_reflective ----------- 0.0% 5.7% 1 0.488s
+ â””Glue.zrange_to_reflective_goal ------ 2.6% 4.2% 1 0.364s
+─synthesize ---------------------------- 0.0% 4.2% 1 0.356s
+â””IntegrationTestTemporaryMiscCommon.do_r 0.0% 3.8% 1 0.328s
+â””change G' ----------------------------- 3.2% 3.2% 1 0.272s
+
+Finished transaction in 16.611 secs (15.352u,0.s) (successful)
+Closed under the global context
+total time: 8.576s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 95.8% 1 8.220s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 87.7% 1 7.524s
+─ReflectiveTactics.solve_side_conditions 0.0% 87.0% 1 7.460s
+─ReflectiveTactics.do_reify ------------ 0.0% 43.8% 1 3.760s
+─ReflectiveTactics.solve_post_reified_si 0.6% 43.1% 1 3.700s
+─Reify.Reify_rhs_gen ------------------- 1.4% 43.0% 1 3.688s
+─UnifyAbstractReflexivity.unify_transfor 31.1% 36.7% 8 1.096s
+─Reify.do_reify_abs_goal --------------- 26.3% 26.6% 2 2.284s
+─Reify.do_reifyf_goal ------------------ 25.3% 25.6% 58 1.440s
+─Glue.refine_to_reflective_glue' ------- 0.0% 8.1% 1 0.696s
+─eexact -------------------------------- 7.6% 7.6% 60 0.032s
+─unify (constr) (constr) --------------- 5.8% 5.8% 7 0.128s
+─Glue.zrange_to_reflective ------------- 0.0% 5.7% 1 0.488s
+─ReflectiveTactics.unify_abstract_cbv_in 3.8% 5.5% 1 0.468s
+─prove_interp_compile_correct ---------- 0.0% 5.2% 1 0.448s
+─rewrite ?EtaInterp.InterpExprEta ------ 4.9% 4.9% 1 0.416s
+─Glue.zrange_to_reflective_goal -------- 2.6% 4.2% 1 0.364s
+─synthesize ---------------------------- 0.0% 4.2% 1 0.356s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 3.8% 1 0.328s
+─rewrite H ----------------------------- 3.2% 3.2% 1 0.276s
+─change G' ----------------------------- 3.2% 3.2% 1 0.272s
+─tac ----------------------------------- 1.4% 2.1% 2 0.180s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 95.8% 1 8.220s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 87.7% 1 7.524s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 87.0% 1 7.460s
+ │ ├─ReflectiveTactics.do_reify -------- 0.0% 43.8% 1 3.760s
+ │ │└Reify.Reify_rhs_gen --------------- 1.4% 43.0% 1 3.688s
+ │ │ ├─Reify.do_reify_abs_goal --------- 26.3% 26.6% 2 2.284s
+ │ │ │└Reify.do_reifyf_goal ------------ 25.3% 25.6% 58 1.440s
+ │ │ │└eexact -------------------------- 6.9% 6.9% 58 0.032s
+ │ │ ├─prove_interp_compile_correct ---- 0.0% 5.2% 1 0.448s
+ │ │ │└rewrite ?EtaInterp.InterpExprEta 4.9% 4.9% 1 0.416s
+ │ │ ├─rewrite H ----------------------- 3.2% 3.2% 1 0.276s
+ │ │ └─tac ----------------------------- 1.4% 2.1% 1 0.180s
+ │ └─ReflectiveTactics.solve_post_reifie 0.6% 43.1% 1 3.700s
+ │ ├─UnifyAbstractReflexivity.unify_tr 31.1% 36.7% 8 1.096s
+ │ │└unify (constr) (constr) --------- 4.3% 4.3% 6 0.092s
+ │ └─ReflectiveTactics.unify_abstract_ 3.8% 5.5% 1 0.468s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 8.1% 1 0.696s
+ â””Glue.zrange_to_reflective ----------- 0.0% 5.7% 1 0.488s
+ â””Glue.zrange_to_reflective_goal ------ 2.6% 4.2% 1 0.364s
+─synthesize ---------------------------- 0.0% 4.2% 1 0.356s
+â””IntegrationTestTemporaryMiscCommon.do_r 0.0% 3.8% 1 0.328s
+â””change G' ----------------------------- 3.2% 3.2% 1 0.272s
+
+src/Specific/X25519/C64/femul (real: 42.98, user: 39.50, sys: 0.29, mem: 839624 ko)
+COQC src/Specific/X25519/C64/feaddDisplay > src/Specific/X25519/C64/feaddDisplay.log
+COQC src/Specific/X25519/C64/fecarryDisplay > src/Specific/X25519/C64/fecarryDisplay.log
+COQC src/Specific/X25519/C64/fesub.v
+Finished transaction in 3.729 secs (3.48u,0.012s) (successful)
+total time: 3.444s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 98.0% 1 3.376s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 77.1% 1 2.656s
+─ReflectiveTactics.solve_side_conditions 0.0% 75.8% 1 2.612s
+─ReflectiveTactics.solve_post_reified_si 1.2% 40.1% 1 1.380s
+─ReflectiveTactics.do_reify ------------ 0.0% 35.8% 1 1.232s
+─Reify.Reify_rhs_gen ------------------- 1.4% 34.4% 1 1.184s
+─UnifyAbstractReflexivity.unify_transfor 25.7% 30.5% 8 0.324s
+─Glue.refine_to_reflective_glue' ------- 0.0% 20.9% 1 0.720s
+─Reify.do_reify_abs_goal --------------- 18.5% 18.8% 2 0.648s
+─Reify.do_reifyf_goal ------------------ 17.3% 17.5% 16 0.604s
+─Glue.zrange_to_reflective ------------- 0.0% 14.2% 1 0.488s
+─Glue.zrange_to_reflective_goal -------- 6.5% 10.6% 1 0.364s
+─ReflectiveTactics.unify_abstract_cbv_in 5.8% 8.0% 1 0.276s
+─unify (constr) (constr) --------------- 5.8% 5.8% 7 0.076s
+─eexact -------------------------------- 4.4% 4.4% 18 0.012s
+─Glue.pattern_sig_sig_assoc ------------ 0.0% 3.8% 1 0.132s
+─assert (H : is_bounded_by' bounds (map' 3.6% 3.6% 2 0.064s
+─Glue.pattern_proj1_sig_in_sig --------- 1.2% 3.6% 1 0.124s
+─prove_interp_compile_correct ---------- 0.0% 3.5% 1 0.120s
+─rewrite H ----------------------------- 3.4% 3.4% 1 0.116s
+─rewrite ?EtaInterp.InterpExprEta ------ 3.1% 3.1% 1 0.108s
+─pose proof (pf : Interpretation.Bo 2.7% 2.7% 1 0.092s
+─reflexivity --------------------------- 2.6% 2.6% 7 0.032s
+─Glue.split_BoundedWordToZ ------------- 0.2% 2.4% 1 0.084s
+─tac ----------------------------------- 1.7% 2.2% 2 0.076s
+─Reify.transitivity_tt ----------------- 0.1% 2.2% 2 0.040s
+─transitivity -------------------------- 2.1% 2.1% 5 0.032s
+─clearbody (ne_var_list) --------------- 2.1% 2.1% 4 0.056s
+─destruct_sig -------------------------- 0.0% 2.1% 4 0.040s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 98.0% 1 3.376s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 77.1% 1 2.656s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 75.8% 1 2.612s
+ │ ├─ReflectiveTactics.solve_post_reifie 1.2% 40.1% 1 1.380s
+ │ │ ├─UnifyAbstractReflexivity.unify_tr 25.7% 30.5% 8 0.324s
+ │ │ │└unify (constr) (constr) --------- 3.6% 3.6% 6 0.040s
+ │ │ └─ReflectiveTactics.unify_abstract_ 5.8% 8.0% 1 0.276s
+ │ │ └unify (constr) (constr) --------- 2.2% 2.2% 1 0.076s
+ │ └─ReflectiveTactics.do_reify -------- 0.0% 35.8% 1 1.232s
+ │ └Reify.Reify_rhs_gen --------------- 1.4% 34.4% 1 1.184s
+ │ ├─Reify.do_reify_abs_goal --------- 18.5% 18.8% 2 0.648s
+ │ │└Reify.do_reifyf_goal ------------ 17.3% 17.5% 16 0.604s
+ │ │└eexact -------------------------- 3.8% 3.8% 16 0.012s
+ │ ├─prove_interp_compile_correct ---- 0.0% 3.5% 1 0.120s
+ │ │└rewrite ?EtaInterp.InterpExprEta 3.1% 3.1% 1 0.108s
+ │ ├─rewrite H ----------------------- 3.4% 3.4% 1 0.116s
+ │ ├─tac ----------------------------- 1.7% 2.2% 1 0.076s
+ │ └─Reify.transitivity_tt ----------- 0.1% 2.2% 2 0.040s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 20.9% 1 0.720s
+ ├─Glue.zrange_to_reflective --------- 0.0% 14.2% 1 0.488s
+ │ ├─Glue.zrange_to_reflective_goal -- 6.5% 10.6% 1 0.364s
+ │ │└pose proof (pf : Interpretat 2.7% 2.7% 1 0.092s
+ │ └─assert (H : is_bounded_by' bounds 3.6% 3.6% 2 0.064s
+ ├─Glue.pattern_sig_sig_assoc -------- 0.0% 3.8% 1 0.132s
+ │└Glue.pattern_proj1_sig_in_sig ----- 1.2% 3.6% 1 0.124s
+ └─Glue.split_BoundedWordToZ --------- 0.2% 2.4% 1 0.084s
+ â””destruct_sig ---------------------- 0.0% 2.1% 4 0.040s
+
+Finished transaction in 6.763 secs (6.183u,0.s) (successful)
+Closed under the global context
+total time: 3.444s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 98.0% 1 3.376s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 77.1% 1 2.656s
+─ReflectiveTactics.solve_side_conditions 0.0% 75.8% 1 2.612s
+─ReflectiveTactics.solve_post_reified_si 1.2% 40.1% 1 1.380s
+─ReflectiveTactics.do_reify ------------ 0.0% 35.8% 1 1.232s
+─Reify.Reify_rhs_gen ------------------- 1.4% 34.4% 1 1.184s
+─UnifyAbstractReflexivity.unify_transfor 25.7% 30.5% 8 0.324s
+─Glue.refine_to_reflective_glue' ------- 0.0% 20.9% 1 0.720s
+─Reify.do_reify_abs_goal --------------- 18.5% 18.8% 2 0.648s
+─Reify.do_reifyf_goal ------------------ 17.3% 17.5% 16 0.604s
+─Glue.zrange_to_reflective ------------- 0.0% 14.2% 1 0.488s
+─Glue.zrange_to_reflective_goal -------- 6.5% 10.6% 1 0.364s
+─ReflectiveTactics.unify_abstract_cbv_in 5.8% 8.0% 1 0.276s
+─unify (constr) (constr) --------------- 5.8% 5.8% 7 0.076s
+─eexact -------------------------------- 4.4% 4.4% 18 0.012s
+─Glue.pattern_sig_sig_assoc ------------ 0.0% 3.8% 1 0.132s
+─assert (H : is_bounded_by' bounds (map' 3.6% 3.6% 2 0.064s
+─Glue.pattern_proj1_sig_in_sig --------- 1.2% 3.6% 1 0.124s
+─prove_interp_compile_correct ---------- 0.0% 3.5% 1 0.120s
+─rewrite H ----------------------------- 3.4% 3.4% 1 0.116s
+─rewrite ?EtaInterp.InterpExprEta ------ 3.1% 3.1% 1 0.108s
+─pose proof (pf : Interpretation.Bo 2.7% 2.7% 1 0.092s
+─reflexivity --------------------------- 2.6% 2.6% 7 0.032s
+─Glue.split_BoundedWordToZ ------------- 0.2% 2.4% 1 0.084s
+─tac ----------------------------------- 1.7% 2.2% 2 0.076s
+─Reify.transitivity_tt ----------------- 0.1% 2.2% 2 0.040s
+─transitivity -------------------------- 2.1% 2.1% 5 0.032s
+─clearbody (ne_var_list) --------------- 2.1% 2.1% 4 0.056s
+─destruct_sig -------------------------- 0.0% 2.1% 4 0.040s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 98.0% 1 3.376s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 77.1% 1 2.656s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 75.8% 1 2.612s
+ │ ├─ReflectiveTactics.solve_post_reifie 1.2% 40.1% 1 1.380s
+ │ │ ├─UnifyAbstractReflexivity.unify_tr 25.7% 30.5% 8 0.324s
+ │ │ │└unify (constr) (constr) --------- 3.6% 3.6% 6 0.040s
+ │ │ └─ReflectiveTactics.unify_abstract_ 5.8% 8.0% 1 0.276s
+ │ │ └unify (constr) (constr) --------- 2.2% 2.2% 1 0.076s
+ │ └─ReflectiveTactics.do_reify -------- 0.0% 35.8% 1 1.232s
+ │ └Reify.Reify_rhs_gen --------------- 1.4% 34.4% 1 1.184s
+ │ ├─Reify.do_reify_abs_goal --------- 18.5% 18.8% 2 0.648s
+ │ │└Reify.do_reifyf_goal ------------ 17.3% 17.5% 16 0.604s
+ │ │└eexact -------------------------- 3.8% 3.8% 16 0.012s
+ │ ├─prove_interp_compile_correct ---- 0.0% 3.5% 1 0.120s
+ │ │└rewrite ?EtaInterp.InterpExprEta 3.1% 3.1% 1 0.108s
+ │ ├─rewrite H ----------------------- 3.4% 3.4% 1 0.116s
+ │ ├─tac ----------------------------- 1.7% 2.2% 1 0.076s
+ │ └─Reify.transitivity_tt ----------- 0.1% 2.2% 2 0.040s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 20.9% 1 0.720s
+ ├─Glue.zrange_to_reflective --------- 0.0% 14.2% 1 0.488s
+ │ ├─Glue.zrange_to_reflective_goal -- 6.5% 10.6% 1 0.364s
+ │ │└pose proof (pf : Interpretat 2.7% 2.7% 1 0.092s
+ │ └─assert (H : is_bounded_by' bounds 3.6% 3.6% 2 0.064s
+ ├─Glue.pattern_sig_sig_assoc -------- 0.0% 3.8% 1 0.132s
+ │└Glue.pattern_proj1_sig_in_sig ----- 1.2% 3.6% 1 0.124s
+ └─Glue.split_BoundedWordToZ --------- 0.2% 2.4% 1 0.084s
+ â””destruct_sig ---------------------- 0.0% 2.1% 4 0.040s
+
+src/Specific/X25519/C64/fesub (real: 26.11, user: 23.72, sys: 0.24, mem: 781808 ko)
+COQC src/Specific/X25519/C64/fesquare.v
+Finished transaction in 6.477 secs (6.044u,0.008s) (successful)
+total time: 6.012s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize ---------------------------- 0.0% 100.0% 1 6.012s
+─Pipeline.refine_reflectively_gen ------ 0.0% 95.9% 1 5.764s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 89.6% 1 5.388s
+─ReflectiveTactics.solve_side_conditions 0.0% 88.8% 1 5.340s
+─ReflectiveTactics.do_reify ------------ 0.0% 47.0% 1 2.828s
+─Reify.Reify_rhs_gen ------------------- 1.5% 46.3% 1 2.784s
+─ReflectiveTactics.solve_post_reified_si 0.5% 41.8% 1 2.512s
+─UnifyAbstractReflexivity.unify_transfor 28.5% 34.1% 8 0.552s
+─Reify.do_reify_abs_goal --------------- 28.7% 29.1% 2 1.752s
+─Reify.do_reifyf_goal ------------------ 27.6% 27.9% 47 1.320s
+─eexact -------------------------------- 8.4% 8.4% 49 0.024s
+─ReflectiveTactics.unify_abstract_cbv_in 5.0% 6.9% 1 0.412s
+─unify (constr) (constr) --------------- 6.3% 6.3% 7 0.104s
+─Glue.refine_to_reflective_glue' ------- 0.0% 6.3% 1 0.376s
+─prove_interp_compile_correct ---------- 0.0% 5.3% 1 0.316s
+─rewrite ?EtaInterp.InterpExprEta ------ 4.8% 4.8% 1 0.288s
+─Glue.zrange_to_reflective ------------- 0.0% 4.4% 1 0.264s
+─IntegrationTestTemporaryMiscCommon.do_r 0.1% 3.7% 1 0.224s
+─Glue.zrange_to_reflective_goal -------- 2.6% 3.3% 1 0.196s
+─change G' ----------------------------- 3.1% 3.1% 1 0.188s
+─rewrite H ----------------------------- 3.0% 3.0% 1 0.180s
+─tac ----------------------------------- 1.9% 2.7% 2 0.160s
+─reflexivity --------------------------- 2.4% 2.4% 7 0.060s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize ---------------------------- 0.0% 100.0% 1 6.012s
+ ├─Pipeline.refine_reflectively_gen ---- 0.0% 95.9% 1 5.764s
+ │ ├─ReflectiveTactics.do_reflective_pip 0.0% 89.6% 1 5.388s
+ │ │└ReflectiveTactics.solve_side_condit 0.0% 88.8% 1 5.340s
+ │ │ ├─ReflectiveTactics.do_reify ------ 0.0% 47.0% 1 2.828s
+ │ │ │└Reify.Reify_rhs_gen ------------- 1.5% 46.3% 1 2.784s
+ │ │ │ ├─Reify.do_reify_abs_goal ------- 28.7% 29.1% 2 1.752s
+ │ │ │ │└Reify.do_reifyf_goal ---------- 27.6% 27.9% 47 1.320s
+ │ │ │ │└eexact ------------------------ 7.7% 7.7% 47 0.024s
+ │ │ │ ├─prove_interp_compile_correct -- 0.0% 5.3% 1 0.316s
+ │ │ │ │└rewrite ?EtaInterp.InterpExprEt 4.8% 4.8% 1 0.288s
+ │ │ │ ├─rewrite H --------------------- 3.0% 3.0% 1 0.180s
+ │ │ │ └─tac --------------------------- 1.9% 2.7% 1 0.160s
+ │ │ └─ReflectiveTactics.solve_post_reif 0.5% 41.8% 1 2.512s
+ │ │ ├─UnifyAbstractReflexivity.unify_ 28.5% 34.1% 8 0.552s
+ │ │ │└unify (constr) (constr) ------- 4.6% 4.6% 6 0.076s
+ │ │ └─ReflectiveTactics.unify_abstrac 5.0% 6.9% 1 0.412s
+ │ └─Glue.refine_to_reflective_glue' --- 0.0% 6.3% 1 0.376s
+ │ └Glue.zrange_to_reflective --------- 0.0% 4.4% 1 0.264s
+ │ └Glue.zrange_to_reflective_goal ---- 2.6% 3.3% 1 0.196s
+ └─IntegrationTestTemporaryMiscCommon.do 0.1% 3.7% 1 0.224s
+ â””change G' --------------------------- 3.1% 3.1% 1 0.188s
+
+Finished transaction in 12.356 secs (11.331u,0.004s) (successful)
+Closed under the global context
+total time: 6.012s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize ---------------------------- 0.0% 100.0% 1 6.012s
+─Pipeline.refine_reflectively_gen ------ 0.0% 95.9% 1 5.764s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 89.6% 1 5.388s
+─ReflectiveTactics.solve_side_conditions 0.0% 88.8% 1 5.340s
+─ReflectiveTactics.do_reify ------------ 0.0% 47.0% 1 2.828s
+─Reify.Reify_rhs_gen ------------------- 1.5% 46.3% 1 2.784s
+─ReflectiveTactics.solve_post_reified_si 0.5% 41.8% 1 2.512s
+─UnifyAbstractReflexivity.unify_transfor 28.5% 34.1% 8 0.552s
+─Reify.do_reify_abs_goal --------------- 28.7% 29.1% 2 1.752s
+─Reify.do_reifyf_goal ------------------ 27.6% 27.9% 47 1.320s
+─eexact -------------------------------- 8.4% 8.4% 49 0.024s
+─ReflectiveTactics.unify_abstract_cbv_in 5.0% 6.9% 1 0.412s
+─unify (constr) (constr) --------------- 6.3% 6.3% 7 0.104s
+─Glue.refine_to_reflective_glue' ------- 0.0% 6.3% 1 0.376s
+─prove_interp_compile_correct ---------- 0.0% 5.3% 1 0.316s
+─rewrite ?EtaInterp.InterpExprEta ------ 4.8% 4.8% 1 0.288s
+─Glue.zrange_to_reflective ------------- 0.0% 4.4% 1 0.264s
+─IntegrationTestTemporaryMiscCommon.do_r 0.1% 3.7% 1 0.224s
+─Glue.zrange_to_reflective_goal -------- 2.6% 3.3% 1 0.196s
+─change G' ----------------------------- 3.1% 3.1% 1 0.188s
+─rewrite H ----------------------------- 3.0% 3.0% 1 0.180s
+─tac ----------------------------------- 1.9% 2.7% 2 0.160s
+─reflexivity --------------------------- 2.4% 2.4% 7 0.060s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize ---------------------------- 0.0% 100.0% 1 6.012s
+ ├─Pipeline.refine_reflectively_gen ---- 0.0% 95.9% 1 5.764s
+ │ ├─ReflectiveTactics.do_reflective_pip 0.0% 89.6% 1 5.388s
+ │ │└ReflectiveTactics.solve_side_condit 0.0% 88.8% 1 5.340s
+ │ │ ├─ReflectiveTactics.do_reify ------ 0.0% 47.0% 1 2.828s
+ │ │ │└Reify.Reify_rhs_gen ------------- 1.5% 46.3% 1 2.784s
+ │ │ │ ├─Reify.do_reify_abs_goal ------- 28.7% 29.1% 2 1.752s
+ │ │ │ │└Reify.do_reifyf_goal ---------- 27.6% 27.9% 47 1.320s
+ │ │ │ │└eexact ------------------------ 7.7% 7.7% 47 0.024s
+ │ │ │ ├─prove_interp_compile_correct -- 0.0% 5.3% 1 0.316s
+ │ │ │ │└rewrite ?EtaInterp.InterpExprEt 4.8% 4.8% 1 0.288s
+ │ │ │ ├─rewrite H --------------------- 3.0% 3.0% 1 0.180s
+ │ │ │ └─tac --------------------------- 1.9% 2.7% 1 0.160s
+ │ │ └─ReflectiveTactics.solve_post_reif 0.5% 41.8% 1 2.512s
+ │ │ ├─UnifyAbstractReflexivity.unify_ 28.5% 34.1% 8 0.552s
+ │ │ │└unify (constr) (constr) ------- 4.6% 4.6% 6 0.076s
+ │ │ └─ReflectiveTactics.unify_abstrac 5.0% 6.9% 1 0.412s
+ │ └─Glue.refine_to_reflective_glue' --- 0.0% 6.3% 1 0.376s
+ │ └Glue.zrange_to_reflective --------- 0.0% 4.4% 1 0.264s
+ │ └Glue.zrange_to_reflective_goal ---- 2.6% 3.3% 1 0.196s
+ └─IntegrationTestTemporaryMiscCommon.do 0.1% 3.7% 1 0.224s
+ â””change G' --------------------------- 3.1% 3.1% 1 0.188s
+
+src/Specific/X25519/C64/fesquare (real: 35.23, user: 32.24, sys: 0.26, mem: 802776 ko)
+COQC src/Specific/X25519/C64/femulDisplay > src/Specific/X25519/C64/femulDisplay.log
+COQC src/Specific/X25519/C64/freeze.v
+Finished transaction in 7.785 secs (7.139u,0.019s) (successful)
+total time: 7.112s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_freeze --------------------- -0.0% 100.0% 1 7.112s
+─Pipeline.refine_reflectively_gen ------ 0.0% 99.2% 1 7.056s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 92.8% 1 6.600s
+─ReflectiveTactics.solve_side_conditions -0.0% 91.8% 1 6.532s
+─ReflectiveTactics.do_reify ------------ 0.0% 57.1% 1 4.060s
+─Reify.Reify_rhs_gen ------------------- 1.5% 56.4% 1 4.012s
+─Reify.do_reify_abs_goal --------------- 40.1% 40.3% 2 2.868s
+─Reify.do_reifyf_goal ------------------ 39.1% 39.4% 129 2.800s
+─ReflectiveTactics.solve_post_reified_si 0.6% 34.8% 1 2.472s
+─UnifyAbstractReflexivity.unify_transfor 25.2% 29.4% 8 0.428s
+─eexact -------------------------------- 12.9% 12.9% 131 0.028s
+─Glue.refine_to_reflective_glue' ------- 0.1% 6.4% 1 0.456s
+─prove_interp_compile_correct ---------- 0.0% 4.7% 1 0.332s
+─unify (constr) (constr) --------------- 4.6% 4.6% 7 0.096s
+─ReflectiveTactics.unify_abstract_cbv_in 3.1% 4.6% 1 0.324s
+─rewrite ?EtaInterp.InterpExprEta ------ 4.3% 4.3% 1 0.308s
+─Glue.zrange_to_reflective ------------- 0.0% 4.1% 1 0.292s
+─Glue.zrange_to_reflective_goal -------- 2.6% 3.2% 1 0.228s
+─rewrite H ----------------------------- 3.0% 3.0% 1 0.212s
+─reflexivity --------------------------- 2.3% 2.3% 7 0.064s
+─Reify.transitivity_tt ----------------- 0.0% 2.1% 2 0.096s
+─transitivity -------------------------- 2.1% 2.1% 5 0.084s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_freeze --------------------- -0.0% 100.0% 1 7.112s
+â””Pipeline.refine_reflectively_gen ------ 0.0% 99.2% 1 7.056s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 92.8% 1 6.600s
+ │└ReflectiveTactics.solve_side_conditio -0.0% 91.8% 1 6.532s
+ │ ├─ReflectiveTactics.do_reify -------- 0.0% 57.1% 1 4.060s
+ │ │└Reify.Reify_rhs_gen --------------- 1.5% 56.4% 1 4.012s
+ │ │ ├─Reify.do_reify_abs_goal --------- 40.1% 40.3% 2 2.868s
+ │ │ │└Reify.do_reifyf_goal ------------ 39.1% 39.4% 129 2.800s
+ │ │ │└eexact -------------------------- 12.4% 12.4% 129 0.028s
+ │ │ ├─prove_interp_compile_correct ---- 0.0% 4.7% 1 0.332s
+ │ │ │└rewrite ?EtaInterp.InterpExprEta 4.3% 4.3% 1 0.308s
+ │ │ ├─rewrite H ----------------------- 3.0% 3.0% 1 0.212s
+ │ │ └─Reify.transitivity_tt ----------- 0.0% 2.1% 2 0.096s
+ │ │ └transitivity -------------------- 2.0% 2.0% 4 0.084s
+ │ └─ReflectiveTactics.solve_post_reifie 0.6% 34.8% 1 2.472s
+ │ ├─UnifyAbstractReflexivity.unify_tr 25.2% 29.4% 8 0.428s
+ │ │└unify (constr) (constr) --------- 3.2% 3.2% 6 0.068s
+ │ └─ReflectiveTactics.unify_abstract_ 3.1% 4.6% 1 0.324s
+ └─Glue.refine_to_reflective_glue' ----- 0.1% 6.4% 1 0.456s
+ â””Glue.zrange_to_reflective ----------- 0.0% 4.1% 1 0.292s
+ â””Glue.zrange_to_reflective_goal ------ 2.6% 3.2% 1 0.228s
+
+Finished transaction in 12.063 secs (11.036u,0.012s) (successful)
+Closed under the global context
+total time: 7.112s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_freeze --------------------- -0.0% 100.0% 1 7.112s
+─Pipeline.refine_reflectively_gen ------ 0.0% 99.2% 1 7.056s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 92.8% 1 6.600s
+─ReflectiveTactics.solve_side_conditions -0.0% 91.8% 1 6.532s
+─ReflectiveTactics.do_reify ------------ 0.0% 57.1% 1 4.060s
+─Reify.Reify_rhs_gen ------------------- 1.5% 56.4% 1 4.012s
+─Reify.do_reify_abs_goal --------------- 40.1% 40.3% 2 2.868s
+─Reify.do_reifyf_goal ------------------ 39.1% 39.4% 129 2.800s
+─ReflectiveTactics.solve_post_reified_si 0.6% 34.8% 1 2.472s
+─UnifyAbstractReflexivity.unify_transfor 25.2% 29.4% 8 0.428s
+─eexact -------------------------------- 12.9% 12.9% 131 0.028s
+─Glue.refine_to_reflective_glue' ------- 0.1% 6.4% 1 0.456s
+─prove_interp_compile_correct ---------- 0.0% 4.7% 1 0.332s
+─unify (constr) (constr) --------------- 4.6% 4.6% 7 0.096s
+─ReflectiveTactics.unify_abstract_cbv_in 3.1% 4.6% 1 0.324s
+─rewrite ?EtaInterp.InterpExprEta ------ 4.3% 4.3% 1 0.308s
+─Glue.zrange_to_reflective ------------- 0.0% 4.1% 1 0.292s
+─Glue.zrange_to_reflective_goal -------- 2.6% 3.2% 1 0.228s
+─rewrite H ----------------------------- 3.0% 3.0% 1 0.212s
+─reflexivity --------------------------- 2.3% 2.3% 7 0.064s
+─Reify.transitivity_tt ----------------- 0.0% 2.1% 2 0.096s
+─transitivity -------------------------- 2.1% 2.1% 5 0.084s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_freeze --------------------- -0.0% 100.0% 1 7.112s
+â””Pipeline.refine_reflectively_gen ------ 0.0% 99.2% 1 7.056s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 92.8% 1 6.600s
+ │└ReflectiveTactics.solve_side_conditio -0.0% 91.8% 1 6.532s
+ │ ├─ReflectiveTactics.do_reify -------- 0.0% 57.1% 1 4.060s
+ │ │└Reify.Reify_rhs_gen --------------- 1.5% 56.4% 1 4.012s
+ │ │ ├─Reify.do_reify_abs_goal --------- 40.1% 40.3% 2 2.868s
+ │ │ │└Reify.do_reifyf_goal ------------ 39.1% 39.4% 129 2.800s
+ │ │ │└eexact -------------------------- 12.4% 12.4% 129 0.028s
+ │ │ ├─prove_interp_compile_correct ---- 0.0% 4.7% 1 0.332s
+ │ │ │└rewrite ?EtaInterp.InterpExprEta 4.3% 4.3% 1 0.308s
+ │ │ ├─rewrite H ----------------------- 3.0% 3.0% 1 0.212s
+ │ │ └─Reify.transitivity_tt ----------- 0.0% 2.1% 2 0.096s
+ │ │ └transitivity -------------------- 2.0% 2.0% 4 0.084s
+ │ └─ReflectiveTactics.solve_post_reifie 0.6% 34.8% 1 2.472s
+ │ ├─UnifyAbstractReflexivity.unify_tr 25.2% 29.4% 8 0.428s
+ │ │└unify (constr) (constr) --------- 3.2% 3.2% 6 0.068s
+ │ └─ReflectiveTactics.unify_abstract_ 3.1% 4.6% 1 0.324s
+ └─Glue.refine_to_reflective_glue' ----- 0.1% 6.4% 1 0.456s
+ â””Glue.zrange_to_reflective ----------- 0.0% 4.1% 1 0.292s
+ â””Glue.zrange_to_reflective_goal ------ 2.6% 3.2% 1 0.228s
+
+src/Specific/X25519/C64/freeze (real: 36.42, user: 33.24, sys: 0.26, mem: 826476 ko)
+COQC src/Specific/NISTP256/AMD64/feadd.v
+Finished transaction in 9.065 secs (8.452u,0.004s) (successful)
+total time: 8.408s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 56.0% 1 4.712s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 47.7% 1 4.012s
+─ReflectiveTactics.solve_side_conditions 0.0% 47.1% 1 3.960s
+─synthesize_montgomery ----------------- 0.0% 44.0% 1 3.696s
+─ReflectiveTactics.solve_post_reified_si 0.6% 26.4% 1 2.220s
+─UnifyAbstractReflexivity.unify_transfor 18.0% 21.3% 8 0.508s
+─IntegrationTestTemporaryMiscCommon.fact 1.3% 21.3% 1 1.788s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 21.0% 1 1.768s
+─ReflectiveTactics.do_reify ------------ 0.0% 20.7% 1 1.740s
+─Reify.Reify_rhs_gen ------------------- 1.0% 20.0% 1 1.684s
+─DestructHyps.do_all_matches_then ------ 0.1% 18.6% 8 0.220s
+─DestructHyps.do_one_match_then -------- 0.8% 18.5% 44 0.056s
+─op_sig_side_conditions_t -------------- 0.0% 17.9% 1 1.504s
+─do_tac -------------------------------- 0.0% 17.7% 43 0.052s
+─destruct H ---------------------------- 17.7% 17.7% 36 0.052s
+─rewrite <- (lem : lemT) by by_tac ltac: 0.3% 17.3% 1 1.452s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 17.3% 1 1.452s
+─by_tac -------------------------------- 0.0% 17.0% 4 0.532s
+─rewrite <- (ZRange.is_bounded_by_None_r 15.7% 15.8% 8 0.360s
+─Reify.do_reify_abs_goal --------------- 9.1% 9.3% 2 0.780s
+─Reify.do_reifyf_goal ------------------ 8.5% 8.6% 93 0.716s
+─Glue.refine_to_reflective_glue' ------- 0.0% 8.3% 1 0.700s
+─Glue.zrange_to_reflective ------------- 0.0% 5.3% 1 0.444s
+─ReflectiveTactics.unify_abstract_cbv_in 2.9% 4.3% 1 0.360s
+─Glue.zrange_to_reflective_goal -------- 2.5% 4.0% 1 0.336s
+─unify (constr) (constr) --------------- 3.9% 3.9% 9 0.108s
+─IntegrationTestTemporaryMiscCommon.do_s 0.0% 3.8% 1 0.316s
+─<Crypto.Util.Tactics.MoveLetIn.with_uco 0.8% 3.6% 3 0.300s
+─k ------------------------------------- 2.6% 2.8% 1 0.232s
+─rewrite H ----------------------------- 2.4% 2.4% 2 0.192s
+─prove_interp_compile_correct ---------- 0.0% 2.4% 1 0.200s
+─rewrite ?EtaInterp.InterpExprEta ------ 2.2% 2.2% 1 0.188s
+─apply (fun f => MapProjections.proj2 2.1% 2.1% 2 0.108s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 56.0% 1 4.712s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 47.7% 1 4.012s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 47.1% 1 3.960s
+ │ ├─ReflectiveTactics.solve_post_reifie 0.6% 26.4% 1 2.220s
+ │ │ ├─UnifyAbstractReflexivity.unify_tr 18.0% 21.3% 8 0.508s
+ │ │ │└unify (constr) (constr) --------- 2.6% 2.6% 6 0.064s
+ │ │ └─ReflectiveTactics.unify_abstract_ 2.9% 4.3% 1 0.360s
+ │ └─ReflectiveTactics.do_reify -------- 0.0% 20.7% 1 1.740s
+ │ └Reify.Reify_rhs_gen --------------- 1.0% 20.0% 1 1.684s
+ │ ├─Reify.do_reify_abs_goal --------- 9.1% 9.3% 2 0.780s
+ │ │└Reify.do_reifyf_goal ------------ 8.5% 8.6% 93 0.716s
+ │ ├─prove_interp_compile_correct ---- 0.0% 2.4% 1 0.200s
+ │ │└rewrite ?EtaInterp.InterpExprEta 2.2% 2.2% 1 0.188s
+ │ └─rewrite H ----------------------- 2.3% 2.3% 1 0.192s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 8.3% 1 0.700s
+ â””Glue.zrange_to_reflective ----------- 0.0% 5.3% 1 0.444s
+ â””Glue.zrange_to_reflective_goal ------ 2.5% 4.0% 1 0.336s
+─synthesize_montgomery ----------------- 0.0% 44.0% 1 3.696s
+ ├─IntegrationTestTemporaryMiscCommon.fa 1.3% 21.3% 1 1.788s
+ │└op_sig_side_conditions_t ------------ 0.0% 17.9% 1 1.504s
+ │ ├─DestructHyps.do_all_matches_then -- 0.1% 10.1% 4 0.220s
+ │ │└DestructHyps.do_one_match_then ---- 0.4% 10.0% 24 0.052s
+ │ │└do_tac ---------------------------- 0.0% 9.6% 20 0.048s
+ │ │└destruct H ------------------------ 9.6% 9.6% 20 0.048s
+ │ └─rewrite <- (ZRange.is_bounded_by_No 7.5% 7.6% 4 0.308s
+ └─IntegrationTestTemporaryMiscCommon.do 0.0% 21.0% 1 1.768s
+ ├─IntegrationTestTemporaryMiscCommon. 0.0% 17.3% 1 1.452s
+ │└rewrite <- (lem : lemT) by by_tac l 0.3% 17.3% 1 1.452s
+ │└by_tac ---------------------------- 0.0% 17.0% 4 0.532s
+ │ ├─DestructHyps.do_all_matches_then 0.0% 8.5% 4 0.184s
+ │ │└DestructHyps.do_one_match_then -- 0.3% 8.5% 20 0.056s
+ │ │└do_tac -------------------------- 0.0% 8.2% 16 0.052s
+ │ │└destruct H ---------------------- 8.2% 8.2% 16 0.052s
+ │ └─rewrite <- (ZRange.is_bounded_by_ 8.2% 8.3% 4 0.360s
+ └─IntegrationTestTemporaryMiscCommon. 0.0% 3.8% 1 0.316s
+ â””<Crypto.Util.Tactics.MoveLetIn.with 0.8% 3.6% 3 0.300s
+ â””k --------------------------------- 2.6% 2.8% 1 0.232s
+
+Finished transaction in 15.052 secs (13.947u,0.003s) (successful)
+Closed under the global context
+total time: 8.408s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 56.0% 1 4.712s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 47.7% 1 4.012s
+─ReflectiveTactics.solve_side_conditions 0.0% 47.1% 1 3.960s
+─synthesize_montgomery ----------------- 0.0% 44.0% 1 3.696s
+─ReflectiveTactics.solve_post_reified_si 0.6% 26.4% 1 2.220s
+─UnifyAbstractReflexivity.unify_transfor 18.0% 21.3% 8 0.508s
+─IntegrationTestTemporaryMiscCommon.fact 1.3% 21.3% 1 1.788s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 21.0% 1 1.768s
+─ReflectiveTactics.do_reify ------------ 0.0% 20.7% 1 1.740s
+─Reify.Reify_rhs_gen ------------------- 1.0% 20.0% 1 1.684s
+─DestructHyps.do_all_matches_then ------ 0.1% 18.6% 8 0.220s
+─DestructHyps.do_one_match_then -------- 0.8% 18.5% 44 0.056s
+─op_sig_side_conditions_t -------------- 0.0% 17.9% 1 1.504s
+─do_tac -------------------------------- 0.0% 17.7% 43 0.052s
+─destruct H ---------------------------- 17.7% 17.7% 36 0.052s
+─rewrite <- (lem : lemT) by by_tac ltac: 0.3% 17.3% 1 1.452s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 17.3% 1 1.452s
+─by_tac -------------------------------- 0.0% 17.0% 4 0.532s
+─rewrite <- (ZRange.is_bounded_by_None_r 15.7% 15.8% 8 0.360s
+─Reify.do_reify_abs_goal --------------- 9.1% 9.3% 2 0.780s
+─Reify.do_reifyf_goal ------------------ 8.5% 8.6% 93 0.716s
+─Glue.refine_to_reflective_glue' ------- 0.0% 8.3% 1 0.700s
+─Glue.zrange_to_reflective ------------- 0.0% 5.3% 1 0.444s
+─ReflectiveTactics.unify_abstract_cbv_in 2.9% 4.3% 1 0.360s
+─Glue.zrange_to_reflective_goal -------- 2.5% 4.0% 1 0.336s
+─unify (constr) (constr) --------------- 3.9% 3.9% 9 0.108s
+─IntegrationTestTemporaryMiscCommon.do_s 0.0% 3.8% 1 0.316s
+─<Crypto.Util.Tactics.MoveLetIn.with_uco 0.8% 3.6% 3 0.300s
+─k ------------------------------------- 2.6% 2.8% 1 0.232s
+─rewrite H ----------------------------- 2.4% 2.4% 2 0.192s
+─prove_interp_compile_correct ---------- 0.0% 2.4% 1 0.200s
+─rewrite ?EtaInterp.InterpExprEta ------ 2.2% 2.2% 1 0.188s
+─apply (fun f => MapProjections.proj2 2.1% 2.1% 2 0.108s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 56.0% 1 4.712s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 47.7% 1 4.012s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 47.1% 1 3.960s
+ │ ├─ReflectiveTactics.solve_post_reifie 0.6% 26.4% 1 2.220s
+ │ │ ├─UnifyAbstractReflexivity.unify_tr 18.0% 21.3% 8 0.508s
+ │ │ │└unify (constr) (constr) --------- 2.6% 2.6% 6 0.064s
+ │ │ └─ReflectiveTactics.unify_abstract_ 2.9% 4.3% 1 0.360s
+ │ └─ReflectiveTactics.do_reify -------- 0.0% 20.7% 1 1.740s
+ │ └Reify.Reify_rhs_gen --------------- 1.0% 20.0% 1 1.684s
+ │ ├─Reify.do_reify_abs_goal --------- 9.1% 9.3% 2 0.780s
+ │ │└Reify.do_reifyf_goal ------------ 8.5% 8.6% 93 0.716s
+ │ ├─prove_interp_compile_correct ---- 0.0% 2.4% 1 0.200s
+ │ │└rewrite ?EtaInterp.InterpExprEta 2.2% 2.2% 1 0.188s
+ │ └─rewrite H ----------------------- 2.3% 2.3% 1 0.192s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 8.3% 1 0.700s
+ â””Glue.zrange_to_reflective ----------- 0.0% 5.3% 1 0.444s
+ â””Glue.zrange_to_reflective_goal ------ 2.5% 4.0% 1 0.336s
+─synthesize_montgomery ----------------- 0.0% 44.0% 1 3.696s
+ ├─IntegrationTestTemporaryMiscCommon.fa 1.3% 21.3% 1 1.788s
+ │└op_sig_side_conditions_t ------------ 0.0% 17.9% 1 1.504s
+ │ ├─DestructHyps.do_all_matches_then -- 0.1% 10.1% 4 0.220s
+ │ │└DestructHyps.do_one_match_then ---- 0.4% 10.0% 24 0.052s
+ │ │└do_tac ---------------------------- 0.0% 9.6% 20 0.048s
+ │ │└destruct H ------------------------ 9.6% 9.6% 20 0.048s
+ │ └─rewrite <- (ZRange.is_bounded_by_No 7.5% 7.6% 4 0.308s
+ └─IntegrationTestTemporaryMiscCommon.do 0.0% 21.0% 1 1.768s
+ ├─IntegrationTestTemporaryMiscCommon. 0.0% 17.3% 1 1.452s
+ │└rewrite <- (lem : lemT) by by_tac l 0.3% 17.3% 1 1.452s
+ │└by_tac ---------------------------- 0.0% 17.0% 4 0.532s
+ │ ├─DestructHyps.do_all_matches_then 0.0% 8.5% 4 0.184s
+ │ │└DestructHyps.do_one_match_then -- 0.3% 8.5% 20 0.056s
+ │ │└do_tac -------------------------- 0.0% 8.2% 16 0.052s
+ │ │└destruct H ---------------------- 8.2% 8.2% 16 0.052s
+ │ └─rewrite <- (ZRange.is_bounded_by_ 8.2% 8.3% 4 0.360s
+ └─IntegrationTestTemporaryMiscCommon. 0.0% 3.8% 1 0.316s
+ â””<Crypto.Util.Tactics.MoveLetIn.with 0.8% 3.6% 3 0.300s
+ â””k --------------------------------- 2.6% 2.8% 1 0.232s
+
+src/Specific/NISTP256/AMD64/feadd (real: 40.48, user: 37.21, sys: 0.27, mem: 797944 ko)
+COQC src/Specific/NISTP256/AMD64/fenz.v
+Finished transaction in 6.724 secs (6.196u,0.007s) (successful)
+total time: 6.180s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_nonzero -------------------- 0.0% 100.0% 1 6.180s
+─IntegrationTestTemporaryMiscCommon.nonz 0.1% 84.5% 1 5.224s
+─destruct (Decidable.dec x), (Decidable. 36.7% 36.7% 1 2.268s
+─destruct (Decidable.dec x) as [H| H] -- 21.6% 21.6% 1 1.336s
+─Pipeline.refine_reflectively_gen ------ 0.1% 15.5% 1 0.956s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 11.9% 1 0.736s
+─ReflectiveTactics.solve_side_conditions 0.0% 11.6% 1 0.716s
+─ReflectiveTactics.solve_post_reified_si 0.3% 9.6% 1 0.592s
+─IntegrationTestTemporaryMiscCommon.op_s 0.1% 7.9% 2 0.392s
+─rewrite <- (ZRange.is_bounded_by_None_r 5.2% 5.2% 2 0.308s
+─UnifyAbstractReflexivity.unify_transfor 4.2% 5.2% 8 0.076s
+─ReflectiveTactics.unify_abstract_cbv_in 3.0% 4.0% 1 0.248s
+─Glue.refine_to_reflective_glue' ------- 0.0% 3.5% 1 0.216s
+─rewrite H' ---------------------------- 3.4% 3.4% 1 0.208s
+─generalize dependent (constr) --------- 3.1% 3.1% 4 0.068s
+─congruence ---------------------------- 2.8% 2.8% 1 0.176s
+─IntegrationTestTemporaryMiscCommon.do_s 0.0% 2.7% 1 0.164s
+─<Crypto.Util.Tactics.MoveLetIn.with_uco 0.5% 2.6% 3 0.156s
+─DestructHyps.do_one_match_then -------- 0.1% 2.5% 6 0.048s
+─DestructHyps.do_all_matches_then ------ 0.0% 2.5% 2 0.084s
+─do_tac -------------------------------- 0.0% 2.5% 7 0.044s
+─destruct H ---------------------------- 2.5% 2.5% 4 0.044s
+─Glue.zrange_to_reflective ------------- 0.1% 2.1% 1 0.132s
+─rewrite H ----------------------------- 1.9% 2.1% 3 0.116s
+─k ------------------------------------- 1.9% 2.0% 1 0.124s
+─ReflectiveTactics.do_reify ------------ 0.0% 2.0% 1 0.124s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_nonzero -------------------- 0.0% 100.0% 1 6.180s
+ ├─IntegrationTestTemporaryMiscCommon.no 0.1% 84.5% 1 5.224s
+ │ ├─destruct (Decidable.dec x), (Decida 36.7% 36.7% 1 2.268s
+ │ ├─destruct (Decidable.dec x) as [H| H 21.6% 21.6% 1 1.336s
+ │ ├─IntegrationTestTemporaryMiscCommon. 0.1% 7.9% 2 0.392s
+ │ │ ├─rewrite <- (ZRange.is_bounded_by_ 5.2% 5.2% 2 0.308s
+ │ │ └─DestructHyps.do_all_matches_then 0.0% 2.5% 2 0.084s
+ │ │ └DestructHyps.do_one_match_then -- 0.1% 2.5% 6 0.048s
+ │ │ └do_tac -------------------------- 0.0% 2.5% 4 0.044s
+ │ │ └destruct H ---------------------- 2.5% 2.5% 4 0.044s
+ │ ├─rewrite H' ------------------------ 3.4% 3.4% 1 0.208s
+ │ ├─generalize dependent (constr) ----- 3.1% 3.1% 4 0.068s
+ │ ├─congruence ------------------------ 2.8% 2.8% 1 0.176s
+ │ └─IntegrationTestTemporaryMiscCommon. 0.0% 2.7% 1 0.164s
+ │ └<Crypto.Util.Tactics.MoveLetIn.with 0.5% 2.6% 3 0.156s
+ │ └k --------------------------------- 1.9% 2.0% 1 0.124s
+ └─Pipeline.refine_reflectively_gen ---- 0.1% 15.5% 1 0.956s
+ ├─ReflectiveTactics.do_reflective_pip 0.0% 11.9% 1 0.736s
+ │└ReflectiveTactics.solve_side_condit 0.0% 11.6% 1 0.716s
+ │ ├─ReflectiveTactics.solve_post_reif 0.3% 9.6% 1 0.592s
+ │ │ ├─UnifyAbstractReflexivity.unify_ 4.2% 5.2% 8 0.076s
+ │ │ └─ReflectiveTactics.unify_abstrac 3.0% 4.0% 1 0.248s
+ │ └─ReflectiveTactics.do_reify ------ 0.0% 2.0% 1 0.124s
+ └─Glue.refine_to_reflective_glue' --- 0.0% 3.5% 1 0.216s
+ â””Glue.zrange_to_reflective --------- 0.1% 2.1% 1 0.132s
+
+Finished transaction in 7.301 secs (6.731u,0.s) (successful)
+Closed under the global context
+total time: 6.180s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_nonzero -------------------- 0.0% 100.0% 1 6.180s
+─IntegrationTestTemporaryMiscCommon.nonz 0.1% 84.5% 1 5.224s
+─destruct (Decidable.dec x), (Decidable. 36.7% 36.7% 1 2.268s
+─destruct (Decidable.dec x) as [H| H] -- 21.6% 21.6% 1 1.336s
+─Pipeline.refine_reflectively_gen ------ 0.1% 15.5% 1 0.956s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 11.9% 1 0.736s
+─ReflectiveTactics.solve_side_conditions 0.0% 11.6% 1 0.716s
+─ReflectiveTactics.solve_post_reified_si 0.3% 9.6% 1 0.592s
+─IntegrationTestTemporaryMiscCommon.op_s 0.1% 7.9% 2 0.392s
+─rewrite <- (ZRange.is_bounded_by_None_r 5.2% 5.2% 2 0.308s
+─UnifyAbstractReflexivity.unify_transfor 4.2% 5.2% 8 0.076s
+─ReflectiveTactics.unify_abstract_cbv_in 3.0% 4.0% 1 0.248s
+─Glue.refine_to_reflective_glue' ------- 0.0% 3.5% 1 0.216s
+─rewrite H' ---------------------------- 3.4% 3.4% 1 0.208s
+─generalize dependent (constr) --------- 3.1% 3.1% 4 0.068s
+─congruence ---------------------------- 2.8% 2.8% 1 0.176s
+─IntegrationTestTemporaryMiscCommon.do_s 0.0% 2.7% 1 0.164s
+─<Crypto.Util.Tactics.MoveLetIn.with_uco 0.5% 2.6% 3 0.156s
+─DestructHyps.do_one_match_then -------- 0.1% 2.5% 6 0.048s
+─DestructHyps.do_all_matches_then ------ 0.0% 2.5% 2 0.084s
+─do_tac -------------------------------- 0.0% 2.5% 7 0.044s
+─destruct H ---------------------------- 2.5% 2.5% 4 0.044s
+─Glue.zrange_to_reflective ------------- 0.1% 2.1% 1 0.132s
+─rewrite H ----------------------------- 1.9% 2.1% 3 0.116s
+─k ------------------------------------- 1.9% 2.0% 1 0.124s
+─ReflectiveTactics.do_reify ------------ 0.0% 2.0% 1 0.124s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_nonzero -------------------- 0.0% 100.0% 1 6.180s
+ ├─IntegrationTestTemporaryMiscCommon.no 0.1% 84.5% 1 5.224s
+ │ ├─destruct (Decidable.dec x), (Decida 36.7% 36.7% 1 2.268s
+ │ ├─destruct (Decidable.dec x) as [H| H 21.6% 21.6% 1 1.336s
+ │ ├─IntegrationTestTemporaryMiscCommon. 0.1% 7.9% 2 0.392s
+ │ │ ├─rewrite <- (ZRange.is_bounded_by_ 5.2% 5.2% 2 0.308s
+ │ │ └─DestructHyps.do_all_matches_then 0.0% 2.5% 2 0.084s
+ │ │ └DestructHyps.do_one_match_then -- 0.1% 2.5% 6 0.048s
+ │ │ └do_tac -------------------------- 0.0% 2.5% 4 0.044s
+ │ │ └destruct H ---------------------- 2.5% 2.5% 4 0.044s
+ │ ├─rewrite H' ------------------------ 3.4% 3.4% 1 0.208s
+ │ ├─generalize dependent (constr) ----- 3.1% 3.1% 4 0.068s
+ │ ├─congruence ------------------------ 2.8% 2.8% 1 0.176s
+ │ └─IntegrationTestTemporaryMiscCommon. 0.0% 2.7% 1 0.164s
+ │ └<Crypto.Util.Tactics.MoveLetIn.with 0.5% 2.6% 3 0.156s
+ │ └k --------------------------------- 1.9% 2.0% 1 0.124s
+ └─Pipeline.refine_reflectively_gen ---- 0.1% 15.5% 1 0.956s
+ ├─ReflectiveTactics.do_reflective_pip 0.0% 11.9% 1 0.736s
+ │└ReflectiveTactics.solve_side_condit 0.0% 11.6% 1 0.716s
+ │ ├─ReflectiveTactics.solve_post_reif 0.3% 9.6% 1 0.592s
+ │ │ ├─UnifyAbstractReflexivity.unify_ 4.2% 5.2% 8 0.076s
+ │ │ └─ReflectiveTactics.unify_abstrac 3.0% 4.0% 1 0.248s
+ │ └─ReflectiveTactics.do_reify ------ 0.0% 2.0% 1 0.124s
+ └─Glue.refine_to_reflective_glue' --- 0.0% 3.5% 1 0.216s
+ â””Glue.zrange_to_reflective --------- 0.1% 2.1% 1 0.132s
+
+src/Specific/NISTP256/AMD64/fenz (real: 28.91, user: 26.41, sys: 0.19, mem: 756216 ko)
+COQC src/Specific/NISTP256/AMD64/feopp.v
+Finished transaction in 7.716 secs (7.216u,0.s) (successful)
+total time: 7.168s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_montgomery ----------------- 0.0% 59.8% 1 4.284s
+─IntegrationTestTemporaryMiscCommon.fact 17.6% 49.1% 1 3.516s
+─Pipeline.refine_reflectively_gen ------ 0.0% 40.2% 1 2.884s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 35.3% 1 2.528s
+─ReflectiveTactics.solve_side_conditions 0.0% 34.8% 1 2.492s
+─reflexivity --------------------------- 23.8% 23.8% 8 1.660s
+─ReflectiveTactics.solve_post_reified_si 0.4% 21.0% 1 1.504s
+─UnifyAbstractReflexivity.unify_transfor 13.8% 16.4% 8 0.268s
+─ReflectiveTactics.do_reify ------------ 0.1% 13.8% 1 0.988s
+─Reify.Reify_rhs_gen ------------------- 0.8% 13.6% 1 0.972s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 9.5% 1 0.680s
+─rewrite <- (ZRange.is_bounded_by_None_r 8.7% 8.7% 4 0.332s
+─rewrite <- (lem : lemT) by by_tac ltac: 0.1% 7.3% 1 0.520s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 7.3% 1 0.520s
+─op_sig_side_conditions_t -------------- 0.0% 7.2% 1 0.516s
+─by_tac -------------------------------- 0.0% 7.1% 2 0.412s
+─Reify.do_reify_abs_goal --------------- 6.9% 7.0% 2 0.500s
+─Reify.do_reifyf_goal ------------------ 6.3% 6.5% 62 0.460s
+─DestructHyps.do_one_match_then -------- 0.3% 5.4% 14 0.044s
+─DestructHyps.do_all_matches_then ------ 0.0% 5.4% 4 0.116s
+─do_tac -------------------------------- 0.0% 5.1% 13 0.044s
+─destruct H ---------------------------- 5.1% 5.1% 10 0.044s
+─Glue.refine_to_reflective_glue' ------- 0.0% 5.0% 1 0.356s
+─ReflectiveTactics.unify_abstract_cbv_in 3.1% 4.1% 1 0.292s
+─Glue.zrange_to_reflective ------------- 0.0% 3.4% 1 0.244s
+─unify (constr) (constr) --------------- 3.1% 3.1% 8 0.072s
+─Glue.zrange_to_reflective_goal -------- 2.1% 2.7% 1 0.196s
+─IntegrationTestTemporaryMiscCommon.do_s 0.0% 2.2% 1 0.160s
+─<Crypto.Util.Tactics.MoveLetIn.with_uco 0.3% 2.2% 3 0.152s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_montgomery ----------------- 0.0% 59.8% 1 4.284s
+ ├─IntegrationTestTemporaryMiscCommon.fa 17.6% 49.1% 1 3.516s
+ │ ├─reflexivity ----------------------- 23.2% 23.2% 1 1.660s
+ │ └─op_sig_side_conditions_t ---------- 0.0% 7.2% 1 0.516s
+ │ ├─rewrite <- (ZRange.is_bounded_by_ 3.9% 3.9% 2 0.272s
+ │ └─DestructHyps.do_all_matches_then 0.0% 3.2% 2 0.116s
+ │ └DestructHyps.do_one_match_then -- 0.2% 3.2% 8 0.044s
+ │ └do_tac -------------------------- 0.0% 3.0% 6 0.040s
+ │ └destruct H ---------------------- 3.0% 3.0% 6 0.040s
+ └─IntegrationTestTemporaryMiscCommon.do 0.0% 9.5% 1 0.680s
+ ├─IntegrationTestTemporaryMiscCommon. 0.0% 7.3% 1 0.520s
+ │└rewrite <- (lem : lemT) by by_tac l 0.1% 7.3% 1 0.520s
+ │└by_tac ---------------------------- 0.0% 7.1% 2 0.412s
+ │ ├─rewrite <- (ZRange.is_bounded_by_ 4.8% 4.8% 2 0.332s
+ │ └─DestructHyps.do_all_matches_then 0.0% 2.2% 2 0.080s
+ │ └DestructHyps.do_one_match_then -- 0.1% 2.2% 6 0.044s
+ │ └do_tac -------------------------- 0.0% 2.2% 4 0.044s
+ │ └destruct H ---------------------- 2.2% 2.2% 4 0.044s
+ └─IntegrationTestTemporaryMiscCommon. 0.0% 2.2% 1 0.160s
+ â””<Crypto.Util.Tactics.MoveLetIn.with 0.3% 2.2% 3 0.152s
+─Pipeline.refine_reflectively_gen ------ 0.0% 40.2% 1 2.884s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 35.3% 1 2.528s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 34.8% 1 2.492s
+ │ ├─ReflectiveTactics.solve_post_reifie 0.4% 21.0% 1 1.504s
+ │ │ ├─UnifyAbstractReflexivity.unify_tr 13.8% 16.4% 8 0.268s
+ │ │ │└unify (constr) (constr) --------- 2.1% 2.1% 6 0.048s
+ │ │ └─ReflectiveTactics.unify_abstract_ 3.1% 4.1% 1 0.292s
+ │ └─ReflectiveTactics.do_reify -------- 0.1% 13.8% 1 0.988s
+ │ └Reify.Reify_rhs_gen --------------- 0.8% 13.6% 1 0.972s
+ │ └Reify.do_reify_abs_goal ----------- 6.9% 7.0% 2 0.500s
+ │ └Reify.do_reifyf_goal -------------- 6.3% 6.5% 62 0.460s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 5.0% 1 0.356s
+ â””Glue.zrange_to_reflective ----------- 0.0% 3.4% 1 0.244s
+ â””Glue.zrange_to_reflective_goal ------ 2.1% 2.7% 1 0.196s
+
+Finished transaction in 8.918 secs (8.116u,0.004s) (successful)
+Closed under the global context
+total time: 7.168s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_montgomery ----------------- 0.0% 59.8% 1 4.284s
+─IntegrationTestTemporaryMiscCommon.fact 17.6% 49.1% 1 3.516s
+─Pipeline.refine_reflectively_gen ------ 0.0% 40.2% 1 2.884s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 35.3% 1 2.528s
+─ReflectiveTactics.solve_side_conditions 0.0% 34.8% 1 2.492s
+─reflexivity --------------------------- 23.8% 23.8% 8 1.660s
+─ReflectiveTactics.solve_post_reified_si 0.4% 21.0% 1 1.504s
+─UnifyAbstractReflexivity.unify_transfor 13.8% 16.4% 8 0.268s
+─ReflectiveTactics.do_reify ------------ 0.1% 13.8% 1 0.988s
+─Reify.Reify_rhs_gen ------------------- 0.8% 13.6% 1 0.972s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 9.5% 1 0.680s
+─rewrite <- (ZRange.is_bounded_by_None_r 8.7% 8.7% 4 0.332s
+─rewrite <- (lem : lemT) by by_tac ltac: 0.1% 7.3% 1 0.520s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 7.3% 1 0.520s
+─op_sig_side_conditions_t -------------- 0.0% 7.2% 1 0.516s
+─by_tac -------------------------------- 0.0% 7.1% 2 0.412s
+─Reify.do_reify_abs_goal --------------- 6.9% 7.0% 2 0.500s
+─Reify.do_reifyf_goal ------------------ 6.3% 6.5% 62 0.460s
+─DestructHyps.do_one_match_then -------- 0.3% 5.4% 14 0.044s
+─DestructHyps.do_all_matches_then ------ 0.0% 5.4% 4 0.116s
+─do_tac -------------------------------- 0.0% 5.1% 13 0.044s
+─destruct H ---------------------------- 5.1% 5.1% 10 0.044s
+─Glue.refine_to_reflective_glue' ------- 0.0% 5.0% 1 0.356s
+─ReflectiveTactics.unify_abstract_cbv_in 3.1% 4.1% 1 0.292s
+─Glue.zrange_to_reflective ------------- 0.0% 3.4% 1 0.244s
+─unify (constr) (constr) --------------- 3.1% 3.1% 8 0.072s
+─Glue.zrange_to_reflective_goal -------- 2.1% 2.7% 1 0.196s
+─IntegrationTestTemporaryMiscCommon.do_s 0.0% 2.2% 1 0.160s
+─<Crypto.Util.Tactics.MoveLetIn.with_uco 0.3% 2.2% 3 0.152s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_montgomery ----------------- 0.0% 59.8% 1 4.284s
+ ├─IntegrationTestTemporaryMiscCommon.fa 17.6% 49.1% 1 3.516s
+ │ ├─reflexivity ----------------------- 23.2% 23.2% 1 1.660s
+ │ └─op_sig_side_conditions_t ---------- 0.0% 7.2% 1 0.516s
+ │ ├─rewrite <- (ZRange.is_bounded_by_ 3.9% 3.9% 2 0.272s
+ │ └─DestructHyps.do_all_matches_then 0.0% 3.2% 2 0.116s
+ │ └DestructHyps.do_one_match_then -- 0.2% 3.2% 8 0.044s
+ │ └do_tac -------------------------- 0.0% 3.0% 6 0.040s
+ │ └destruct H ---------------------- 3.0% 3.0% 6 0.040s
+ └─IntegrationTestTemporaryMiscCommon.do 0.0% 9.5% 1 0.680s
+ ├─IntegrationTestTemporaryMiscCommon. 0.0% 7.3% 1 0.520s
+ │└rewrite <- (lem : lemT) by by_tac l 0.1% 7.3% 1 0.520s
+ │└by_tac ---------------------------- 0.0% 7.1% 2 0.412s
+ │ ├─rewrite <- (ZRange.is_bounded_by_ 4.8% 4.8% 2 0.332s
+ │ └─DestructHyps.do_all_matches_then 0.0% 2.2% 2 0.080s
+ │ └DestructHyps.do_one_match_then -- 0.1% 2.2% 6 0.044s
+ │ └do_tac -------------------------- 0.0% 2.2% 4 0.044s
+ │ └destruct H ---------------------- 2.2% 2.2% 4 0.044s
+ └─IntegrationTestTemporaryMiscCommon. 0.0% 2.2% 1 0.160s
+ â””<Crypto.Util.Tactics.MoveLetIn.with 0.3% 2.2% 3 0.152s
+─Pipeline.refine_reflectively_gen ------ 0.0% 40.2% 1 2.884s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 35.3% 1 2.528s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 34.8% 1 2.492s
+ │ ├─ReflectiveTactics.solve_post_reifie 0.4% 21.0% 1 1.504s
+ │ │ ├─UnifyAbstractReflexivity.unify_tr 13.8% 16.4% 8 0.268s
+ │ │ │└unify (constr) (constr) --------- 2.1% 2.1% 6 0.048s
+ │ │ └─ReflectiveTactics.unify_abstract_ 3.1% 4.1% 1 0.292s
+ │ └─ReflectiveTactics.do_reify -------- 0.1% 13.8% 1 0.988s
+ │ └Reify.Reify_rhs_gen --------------- 0.8% 13.6% 1 0.972s
+ │ └Reify.do_reify_abs_goal ----------- 6.9% 7.0% 2 0.500s
+ │ └Reify.do_reifyf_goal -------------- 6.3% 6.5% 62 0.460s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 5.0% 1 0.356s
+ â””Glue.zrange_to_reflective ----------- 0.0% 3.4% 1 0.244s
+ â””Glue.zrange_to_reflective_goal ------ 2.1% 2.7% 1 0.196s
+
+src/Specific/NISTP256/AMD64/feopp (real: 32.08, user: 29.46, sys: 0.25, mem: 765212 ko)
+COQC src/Specific/NISTP256/AMD64/fesub.v
+Finished transaction in 12.83 secs (11.988u,0.019s) (successful)
+total time: 11.956s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_montgomery ----------------- 0.0% 63.2% 1 7.560s
+─IntegrationTestTemporaryMiscCommon.fact 15.6% 48.5% 1 5.796s
+─Pipeline.refine_reflectively_gen ------ 0.0% 36.8% 1 4.396s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 31.0% 1 3.712s
+─ReflectiveTactics.solve_side_conditions 0.0% 30.6% 1 3.656s
+─reflexivity --------------------------- 20.3% 20.3% 8 2.312s
+─ReflectiveTactics.solve_post_reified_si 0.5% 17.3% 1 2.064s
+─UnifyAbstractReflexivity.unify_transfor 11.8% 13.9% 8 0.452s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 13.7% 1 1.636s
+─ReflectiveTactics.do_reify ------------ 0.0% 13.3% 1 1.592s
+─Reify.Reify_rhs_gen ------------------- 0.9% 12.8% 1 1.536s
+─DestructHyps.do_all_matches_then ------ 0.1% 12.6% 8 0.224s
+─DestructHyps.do_one_match_then -------- 0.5% 12.5% 44 0.056s
+─op_sig_side_conditions_t -------------- 0.0% 12.2% 1 1.456s
+─do_tac -------------------------------- 0.0% 12.0% 43 0.052s
+─destruct H ---------------------------- 11.9% 11.9% 36 0.052s
+─rewrite <- (lem : lemT) by by_tac ltac: 0.2% 11.1% 1 1.324s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 11.1% 1 1.324s
+─by_tac -------------------------------- 0.0% 10.9% 4 0.488s
+─rewrite <- (ZRange.is_bounded_by_None_r 10.1% 10.2% 8 0.328s
+─Reify.do_reify_abs_goal --------------- 6.0% 6.1% 2 0.724s
+─Glue.refine_to_reflective_glue' ------- 0.0% 5.7% 1 0.680s
+─Reify.do_reifyf_goal ------------------ 5.5% 5.6% 80 0.660s
+─Glue.zrange_to_reflective ------------- 0.0% 3.6% 1 0.432s
+─ReflectiveTactics.unify_abstract_cbv_in 2.0% 2.8% 1 0.340s
+─Glue.zrange_to_reflective_goal -------- 1.7% 2.7% 1 0.324s
+─IntegrationTestTemporaryMiscCommon.do_s 0.0% 2.6% 1 0.312s
+─<Crypto.Util.Tactics.MoveLetIn.with_uco 0.5% 2.5% 3 0.300s
+─unify (constr) (constr) --------------- 2.4% 2.4% 9 0.100s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_montgomery ----------------- 0.0% 63.2% 1 7.560s
+ ├─IntegrationTestTemporaryMiscCommon.fa 15.6% 48.5% 1 5.796s
+ │ ├─reflexivity ----------------------- 19.3% 19.3% 1 2.312s
+ │ └─op_sig_side_conditions_t ---------- 0.0% 12.2% 1 1.456s
+ │ ├─DestructHyps.do_all_matches_then 0.1% 7.1% 4 0.224s
+ │ │└DestructHyps.do_one_match_then -- 0.3% 7.1% 24 0.056s
+ │ │└do_tac -------------------------- 0.0% 6.7% 20 0.052s
+ │ │└destruct H ---------------------- 6.7% 6.7% 20 0.052s
+ │ └─rewrite <- (ZRange.is_bounded_by_ 4.9% 4.9% 4 0.292s
+ └─IntegrationTestTemporaryMiscCommon.do 0.0% 13.7% 1 1.636s
+ ├─IntegrationTestTemporaryMiscCommon. 0.0% 11.1% 1 1.324s
+ │└rewrite <- (lem : lemT) by by_tac l 0.2% 11.1% 1 1.324s
+ │└by_tac ---------------------------- 0.0% 10.9% 4 0.488s
+ │ ├─DestructHyps.do_all_matches_then 0.0% 5.5% 4 0.176s
+ │ │└DestructHyps.do_one_match_then -- 0.2% 5.5% 20 0.048s
+ │ │└do_tac -------------------------- 0.0% 5.3% 16 0.048s
+ │ │└destruct H ---------------------- 5.2% 5.2% 16 0.048s
+ │ └─rewrite <- (ZRange.is_bounded_by_ 5.3% 5.3% 4 0.328s
+ └─IntegrationTestTemporaryMiscCommon. 0.0% 2.6% 1 0.312s
+ â””<Crypto.Util.Tactics.MoveLetIn.with 0.5% 2.5% 3 0.300s
+─Pipeline.refine_reflectively_gen ------ 0.0% 36.8% 1 4.396s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 31.0% 1 3.712s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 30.6% 1 3.656s
+ │ ├─ReflectiveTactics.solve_post_reifie 0.5% 17.3% 1 2.064s
+ │ │ ├─UnifyAbstractReflexivity.unify_tr 11.8% 13.9% 8 0.452s
+ │ │ └─ReflectiveTactics.unify_abstract_ 2.0% 2.8% 1 0.340s
+ │ └─ReflectiveTactics.do_reify -------- 0.0% 13.3% 1 1.592s
+ │ └Reify.Reify_rhs_gen --------------- 0.9% 12.8% 1 1.536s
+ │ └Reify.do_reify_abs_goal ----------- 6.0% 6.1% 2 0.724s
+ │ └Reify.do_reifyf_goal -------------- 5.5% 5.6% 80 0.660s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 5.7% 1 0.680s
+ â””Glue.zrange_to_reflective ----------- 0.0% 3.6% 1 0.432s
+ â””Glue.zrange_to_reflective_goal ------ 1.7% 2.7% 1 0.324s
+
+Finished transaction in 14.576 secs (13.372u,0.004s) (successful)
+Closed under the global context
+total time: 11.956s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_montgomery ----------------- 0.0% 63.2% 1 7.560s
+─IntegrationTestTemporaryMiscCommon.fact 15.6% 48.5% 1 5.796s
+─Pipeline.refine_reflectively_gen ------ 0.0% 36.8% 1 4.396s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 31.0% 1 3.712s
+─ReflectiveTactics.solve_side_conditions 0.0% 30.6% 1 3.656s
+─reflexivity --------------------------- 20.3% 20.3% 8 2.312s
+─ReflectiveTactics.solve_post_reified_si 0.5% 17.3% 1 2.064s
+─UnifyAbstractReflexivity.unify_transfor 11.8% 13.9% 8 0.452s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 13.7% 1 1.636s
+─ReflectiveTactics.do_reify ------------ 0.0% 13.3% 1 1.592s
+─Reify.Reify_rhs_gen ------------------- 0.9% 12.8% 1 1.536s
+─DestructHyps.do_all_matches_then ------ 0.1% 12.6% 8 0.224s
+─DestructHyps.do_one_match_then -------- 0.5% 12.5% 44 0.056s
+─op_sig_side_conditions_t -------------- 0.0% 12.2% 1 1.456s
+─do_tac -------------------------------- 0.0% 12.0% 43 0.052s
+─destruct H ---------------------------- 11.9% 11.9% 36 0.052s
+─rewrite <- (lem : lemT) by by_tac ltac: 0.2% 11.1% 1 1.324s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 11.1% 1 1.324s
+─by_tac -------------------------------- 0.0% 10.9% 4 0.488s
+─rewrite <- (ZRange.is_bounded_by_None_r 10.1% 10.2% 8 0.328s
+─Reify.do_reify_abs_goal --------------- 6.0% 6.1% 2 0.724s
+─Glue.refine_to_reflective_glue' ------- 0.0% 5.7% 1 0.680s
+─Reify.do_reifyf_goal ------------------ 5.5% 5.6% 80 0.660s
+─Glue.zrange_to_reflective ------------- 0.0% 3.6% 1 0.432s
+─ReflectiveTactics.unify_abstract_cbv_in 2.0% 2.8% 1 0.340s
+─Glue.zrange_to_reflective_goal -------- 1.7% 2.7% 1 0.324s
+─IntegrationTestTemporaryMiscCommon.do_s 0.0% 2.6% 1 0.312s
+─<Crypto.Util.Tactics.MoveLetIn.with_uco 0.5% 2.5% 3 0.300s
+─unify (constr) (constr) --------------- 2.4% 2.4% 9 0.100s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_montgomery ----------------- 0.0% 63.2% 1 7.560s
+ ├─IntegrationTestTemporaryMiscCommon.fa 15.6% 48.5% 1 5.796s
+ │ ├─reflexivity ----------------------- 19.3% 19.3% 1 2.312s
+ │ └─op_sig_side_conditions_t ---------- 0.0% 12.2% 1 1.456s
+ │ ├─DestructHyps.do_all_matches_then 0.1% 7.1% 4 0.224s
+ │ │└DestructHyps.do_one_match_then -- 0.3% 7.1% 24 0.056s
+ │ │└do_tac -------------------------- 0.0% 6.7% 20 0.052s
+ │ │└destruct H ---------------------- 6.7% 6.7% 20 0.052s
+ │ └─rewrite <- (ZRange.is_bounded_by_ 4.9% 4.9% 4 0.292s
+ └─IntegrationTestTemporaryMiscCommon.do 0.0% 13.7% 1 1.636s
+ ├─IntegrationTestTemporaryMiscCommon. 0.0% 11.1% 1 1.324s
+ │└rewrite <- (lem : lemT) by by_tac l 0.2% 11.1% 1 1.324s
+ │└by_tac ---------------------------- 0.0% 10.9% 4 0.488s
+ │ ├─DestructHyps.do_all_matches_then 0.0% 5.5% 4 0.176s
+ │ │└DestructHyps.do_one_match_then -- 0.2% 5.5% 20 0.048s
+ │ │└do_tac -------------------------- 0.0% 5.3% 16 0.048s
+ │ │└destruct H ---------------------- 5.2% 5.2% 16 0.048s
+ │ └─rewrite <- (ZRange.is_bounded_by_ 5.3% 5.3% 4 0.328s
+ └─IntegrationTestTemporaryMiscCommon. 0.0% 2.6% 1 0.312s
+ â””<Crypto.Util.Tactics.MoveLetIn.with 0.5% 2.5% 3 0.300s
+─Pipeline.refine_reflectively_gen ------ 0.0% 36.8% 1 4.396s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 31.0% 1 3.712s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 30.6% 1 3.656s
+ │ ├─ReflectiveTactics.solve_post_reifie 0.5% 17.3% 1 2.064s
+ │ │ ├─UnifyAbstractReflexivity.unify_tr 11.8% 13.9% 8 0.452s
+ │ │ └─ReflectiveTactics.unify_abstract_ 2.0% 2.8% 1 0.340s
+ │ └─ReflectiveTactics.do_reify -------- 0.0% 13.3% 1 1.592s
+ │ └Reify.Reify_rhs_gen --------------- 0.9% 12.8% 1 1.536s
+ │ └Reify.do_reify_abs_goal ----------- 6.0% 6.1% 2 0.724s
+ │ └Reify.do_reifyf_goal -------------- 5.5% 5.6% 80 0.660s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 5.7% 1 0.680s
+ â””Glue.zrange_to_reflective ----------- 0.0% 3.6% 1 0.432s
+ â””Glue.zrange_to_reflective_goal ------ 1.7% 2.7% 1 0.324s
+
+src/Specific/NISTP256/AMD64/fesub (real: 43.78, user: 40.09, sys: 0.30, mem: 799668 ko)
+COQC src/Specific/NISTP256/AMD64/feaddDisplay > src/Specific/NISTP256/AMD64/feaddDisplay.log
+COQC src/Specific/NISTP256/AMD64/fenzDisplay > src/Specific/NISTP256/AMD64/fenzDisplay.log
+COQC src/Specific/NISTP256/AMD64/feoppDisplay > src/Specific/NISTP256/AMD64/feoppDisplay.log
+COQC src/Specific/NISTP256/AMD64/fesubDisplay > src/Specific/NISTP256/AMD64/fesubDisplay.log
+COQC src/Specific/X25519/C64/fesquareDisplay > src/Specific/X25519/C64/fesquareDisplay.log
+COQC src/Specific/solinas32_2e255m765_12limbs/femul.v
+Finished transaction in 60.265 secs (55.388u,0.103s) (successful)
+total time: 55.440s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 95.9% 1 53.156s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 89.2% 1 49.464s
+─ReflectiveTactics.solve_side_conditions 0.0% 88.9% 1 49.288s
+─ReflectiveTactics.do_reify ------------ -0.0% 49.9% 1 27.684s
+─Reify.Reify_rhs_gen ------------------- 1.3% 49.3% 1 27.348s
+─ReflectiveTactics.solve_post_reified_si 0.1% 39.0% 1 21.604s
+─Reify.do_reify_abs_goal --------------- 36.3% 36.6% 2 20.272s
+─UnifyAbstractReflexivity.unify_transfor 30.8% 36.1% 8 8.636s
+─Reify.do_reifyf_goal ------------------ 35.7% 35.9% 108 10.356s
+─eexact -------------------------------- 11.5% 11.5% 110 0.128s
+─Glue.refine_to_reflective_glue' ------- 0.0% 6.7% 1 3.692s
+─Glue.zrange_to_reflective ------------- 0.0% 6.2% 1 3.424s
+─unify (constr) (constr) --------------- 4.9% 4.9% 7 1.140s
+─Glue.zrange_to_reflective_goal -------- 1.4% 4.7% 1 2.592s
+─synthesize ---------------------------- 0.0% 4.1% 1 2.284s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 4.0% 1 2.220s
+─change G' ----------------------------- 3.9% 3.9% 1 2.148s
+─pose proof (pf : Interpretation.Bo 3.1% 3.1% 1 1.736s
+─rewrite H ----------------------------- 3.1% 3.1% 1 1.692s
+─prove_interp_compile_correct ---------- 0.0% 3.0% 1 1.636s
+─rewrite ?EtaInterp.InterpExprEta ------ 2.7% 2.7% 1 1.484s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 95.9% 1 53.156s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 89.2% 1 49.464s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 88.9% 1 49.288s
+ │ ├─ReflectiveTactics.do_reify -------- -0.0% 49.9% 1 27.684s
+ │ │└Reify.Reify_rhs_gen --------------- 1.3% 49.3% 1 27.348s
+ │ │ ├─Reify.do_reify_abs_goal --------- 36.3% 36.6% 2 20.272s
+ │ │ │└Reify.do_reifyf_goal ------------ 35.7% 35.9% 108 10.356s
+ │ │ │└eexact -------------------------- 11.1% 11.1% 108 0.072s
+ │ │ ├─rewrite H ----------------------- 3.1% 3.1% 1 1.692s
+ │ │ └─prove_interp_compile_correct ---- 0.0% 3.0% 1 1.636s
+ │ │ └rewrite ?EtaInterp.InterpExprEta 2.7% 2.7% 1 1.484s
+ │ └─ReflectiveTactics.solve_post_reifie 0.1% 39.0% 1 21.604s
+ │ └UnifyAbstractReflexivity.unify_tran 30.8% 36.1% 8 8.636s
+ │ └unify (constr) (constr) ----------- 4.4% 4.4% 6 1.140s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 6.7% 1 3.692s
+ â””Glue.zrange_to_reflective ----------- 0.0% 6.2% 1 3.424s
+ â””Glue.zrange_to_reflective_goal ------ 1.4% 4.7% 1 2.592s
+ â””pose proof (pf : Interpretation. 3.1% 3.1% 1 1.736s
+─synthesize ---------------------------- 0.0% 4.1% 1 2.284s
+â””IntegrationTestTemporaryMiscCommon.do_r 0.0% 4.0% 1 2.220s
+â””change G' ----------------------------- 3.9% 3.9% 1 2.148s
+
+Finished transaction in 92.046 secs (84.315u,0.032s) (successful)
+Closed under the global context
+total time: 55.440s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 95.9% 1 53.156s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 89.2% 1 49.464s
+─ReflectiveTactics.solve_side_conditions 0.0% 88.9% 1 49.288s
+─ReflectiveTactics.do_reify ------------ -0.0% 49.9% 1 27.684s
+─Reify.Reify_rhs_gen ------------------- 1.3% 49.3% 1 27.348s
+─ReflectiveTactics.solve_post_reified_si 0.1% 39.0% 1 21.604s
+─Reify.do_reify_abs_goal --------------- 36.3% 36.6% 2 20.272s
+─UnifyAbstractReflexivity.unify_transfor 30.8% 36.1% 8 8.636s
+─Reify.do_reifyf_goal ------------------ 35.7% 35.9% 108 10.356s
+─eexact -------------------------------- 11.5% 11.5% 110 0.128s
+─Glue.refine_to_reflective_glue' ------- 0.0% 6.7% 1 3.692s
+─Glue.zrange_to_reflective ------------- 0.0% 6.2% 1 3.424s
+─unify (constr) (constr) --------------- 4.9% 4.9% 7 1.140s
+─Glue.zrange_to_reflective_goal -------- 1.4% 4.7% 1 2.592s
+─synthesize ---------------------------- 0.0% 4.1% 1 2.284s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 4.0% 1 2.220s
+─change G' ----------------------------- 3.9% 3.9% 1 2.148s
+─pose proof (pf : Interpretation.Bo 3.1% 3.1% 1 1.736s
+─rewrite H ----------------------------- 3.1% 3.1% 1 1.692s
+─prove_interp_compile_correct ---------- 0.0% 3.0% 1 1.636s
+─rewrite ?EtaInterp.InterpExprEta ------ 2.7% 2.7% 1 1.484s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 95.9% 1 53.156s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 89.2% 1 49.464s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 88.9% 1 49.288s
+ │ ├─ReflectiveTactics.do_reify -------- -0.0% 49.9% 1 27.684s
+ │ │└Reify.Reify_rhs_gen --------------- 1.3% 49.3% 1 27.348s
+ │ │ ├─Reify.do_reify_abs_goal --------- 36.3% 36.6% 2 20.272s
+ │ │ │└Reify.do_reifyf_goal ------------ 35.7% 35.9% 108 10.356s
+ │ │ │└eexact -------------------------- 11.1% 11.1% 108 0.072s
+ │ │ ├─rewrite H ----------------------- 3.1% 3.1% 1 1.692s
+ │ │ └─prove_interp_compile_correct ---- 0.0% 3.0% 1 1.636s
+ │ │ └rewrite ?EtaInterp.InterpExprEta 2.7% 2.7% 1 1.484s
+ │ └─ReflectiveTactics.solve_post_reifie 0.1% 39.0% 1 21.604s
+ │ └UnifyAbstractReflexivity.unify_tran 30.8% 36.1% 8 8.636s
+ │ └unify (constr) (constr) ----------- 4.4% 4.4% 6 1.140s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 6.7% 1 3.692s
+ â””Glue.zrange_to_reflective ----------- 0.0% 6.2% 1 3.424s
+ â””Glue.zrange_to_reflective_goal ------ 1.4% 4.7% 1 2.592s
+ â””pose proof (pf : Interpretation. 3.1% 3.1% 1 1.736s
+─synthesize ---------------------------- 0.0% 4.1% 1 2.284s
+â””IntegrationTestTemporaryMiscCommon.do_r 0.0% 4.0% 1 2.220s
+â””change G' ----------------------------- 3.9% 3.9% 1 2.148s
+
+src/Specific/solinas32_2e255m765_12limbs/femul (real: 179.21, user: 164.11, sys: 0.42, mem: 1549104 ko)
+COQC src/Specific/X25519/C64/fesubDisplay > src/Specific/X25519/C64/fesubDisplay.log
+COQC src/Specific/X25519/C64/freezeDisplay > src/Specific/X25519/C64/freezeDisplay.log
+COQC src/Specific/solinas32_2e255m765_13limbs/femul.v
+Finished transaction in 74.548 secs (68.928u,0.079s) (successful)
+total time: 68.948s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 95.7% 1 65.956s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 88.7% 1 61.172s
+─ReflectiveTactics.solve_side_conditions 0.0% 88.4% 1 60.944s
+─ReflectiveTactics.do_reify ------------ 0.0% 48.5% 1 33.408s
+─Reify.Reify_rhs_gen ------------------- 1.3% 47.9% 1 33.020s
+─ReflectiveTactics.solve_post_reified_si 0.1% 39.9% 1 27.536s
+─UnifyAbstractReflexivity.unify_transfor 32.0% 37.2% 8 11.528s
+─Reify.do_reify_abs_goal --------------- 36.0% 36.2% 2 24.960s
+─Reify.do_reifyf_goal ------------------ 35.3% 35.5% 117 12.840s
+─eexact -------------------------------- 11.4% 11.4% 119 0.160s
+─Glue.refine_to_reflective_glue' ------- 0.0% 6.9% 1 4.784s
+─Glue.zrange_to_reflective ------------- 0.0% 6.5% 1 4.512s
+─Glue.zrange_to_reflective_goal -------- 1.3% 4.9% 1 3.396s
+─unify (constr) (constr) --------------- 4.9% 4.9% 7 1.524s
+─synthesize ---------------------------- 0.0% 4.3% 1 2.992s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 4.2% 1 2.912s
+─change G' ----------------------------- 4.1% 4.1% 1 2.840s
+─pose proof (pf : Interpretation.Bo 3.5% 3.5% 1 2.420s
+─rewrite H ----------------------------- 3.0% 3.0% 1 2.084s
+─prove_interp_compile_correct ---------- 0.0% 2.7% 1 1.856s
+─rewrite ?EtaInterp.InterpExprEta ------ 2.5% 2.5% 1 1.692s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 95.7% 1 65.956s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 88.7% 1 61.172s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 88.4% 1 60.944s
+ │ ├─ReflectiveTactics.do_reify -------- 0.0% 48.5% 1 33.408s
+ │ │└Reify.Reify_rhs_gen --------------- 1.3% 47.9% 1 33.020s
+ │ │ ├─Reify.do_reify_abs_goal --------- 36.0% 36.2% 2 24.960s
+ │ │ │└Reify.do_reifyf_goal ------------ 35.3% 35.5% 117 12.840s
+ │ │ │└eexact -------------------------- 10.9% 10.9% 117 0.088s
+ │ │ ├─rewrite H ----------------------- 3.0% 3.0% 1 2.084s
+ │ │ └─prove_interp_compile_correct ---- 0.0% 2.7% 1 1.856s
+ │ │ └rewrite ?EtaInterp.InterpExprEta 2.5% 2.5% 1 1.692s
+ │ └─ReflectiveTactics.solve_post_reifie 0.1% 39.9% 1 27.536s
+ │ └UnifyAbstractReflexivity.unify_tran 32.0% 37.2% 8 11.528s
+ │ └unify (constr) (constr) ----------- 4.3% 4.3% 6 1.524s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 6.9% 1 4.784s
+ â””Glue.zrange_to_reflective ----------- 0.0% 6.5% 1 4.512s
+ â””Glue.zrange_to_reflective_goal ------ 1.3% 4.9% 1 3.396s
+ â””pose proof (pf : Interpretation. 3.5% 3.5% 1 2.420s
+─synthesize ---------------------------- 0.0% 4.3% 1 2.992s
+â””IntegrationTestTemporaryMiscCommon.do_r 0.0% 4.2% 1 2.912s
+â””change G' ----------------------------- 4.1% 4.1% 1 2.840s
+
+Finished transaction in 105.62 secs (97.6u,0.02s) (successful)
+Closed under the global context
+total time: 68.948s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 95.7% 1 65.956s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 88.7% 1 61.172s
+─ReflectiveTactics.solve_side_conditions 0.0% 88.4% 1 60.944s
+─ReflectiveTactics.do_reify ------------ 0.0% 48.5% 1 33.408s
+─Reify.Reify_rhs_gen ------------------- 1.3% 47.9% 1 33.020s
+─ReflectiveTactics.solve_post_reified_si 0.1% 39.9% 1 27.536s
+─UnifyAbstractReflexivity.unify_transfor 32.0% 37.2% 8 11.528s
+─Reify.do_reify_abs_goal --------------- 36.0% 36.2% 2 24.960s
+─Reify.do_reifyf_goal ------------------ 35.3% 35.5% 117 12.840s
+─eexact -------------------------------- 11.4% 11.4% 119 0.160s
+─Glue.refine_to_reflective_glue' ------- 0.0% 6.9% 1 4.784s
+─Glue.zrange_to_reflective ------------- 0.0% 6.5% 1 4.512s
+─Glue.zrange_to_reflective_goal -------- 1.3% 4.9% 1 3.396s
+─unify (constr) (constr) --------------- 4.9% 4.9% 7 1.524s
+─synthesize ---------------------------- 0.0% 4.3% 1 2.992s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 4.2% 1 2.912s
+─change G' ----------------------------- 4.1% 4.1% 1 2.840s
+─pose proof (pf : Interpretation.Bo 3.5% 3.5% 1 2.420s
+─rewrite H ----------------------------- 3.0% 3.0% 1 2.084s
+─prove_interp_compile_correct ---------- 0.0% 2.7% 1 1.856s
+─rewrite ?EtaInterp.InterpExprEta ------ 2.5% 2.5% 1 1.692s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 95.7% 1 65.956s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 88.7% 1 61.172s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 88.4% 1 60.944s
+ │ ├─ReflectiveTactics.do_reify -------- 0.0% 48.5% 1 33.408s
+ │ │└Reify.Reify_rhs_gen --------------- 1.3% 47.9% 1 33.020s
+ │ │ ├─Reify.do_reify_abs_goal --------- 36.0% 36.2% 2 24.960s
+ │ │ │└Reify.do_reifyf_goal ------------ 35.3% 35.5% 117 12.840s
+ │ │ │└eexact -------------------------- 10.9% 10.9% 117 0.088s
+ │ │ ├─rewrite H ----------------------- 3.0% 3.0% 1 2.084s
+ │ │ └─prove_interp_compile_correct ---- 0.0% 2.7% 1 1.856s
+ │ │ └rewrite ?EtaInterp.InterpExprEta 2.5% 2.5% 1 1.692s
+ │ └─ReflectiveTactics.solve_post_reifie 0.1% 39.9% 1 27.536s
+ │ └UnifyAbstractReflexivity.unify_tran 32.0% 37.2% 8 11.528s
+ │ └unify (constr) (constr) ----------- 4.3% 4.3% 6 1.524s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 6.9% 1 4.784s
+ â””Glue.zrange_to_reflective ----------- 0.0% 6.5% 1 4.512s
+ â””Glue.zrange_to_reflective_goal ------ 1.3% 4.9% 1 3.396s
+ â””pose proof (pf : Interpretation. 3.5% 3.5% 1 2.420s
+─synthesize ---------------------------- 0.0% 4.3% 1 2.992s
+â””IntegrationTestTemporaryMiscCommon.do_r 0.0% 4.2% 1 2.912s
+â””change G' ----------------------------- 4.1% 4.1% 1 2.840s
+
+src/Specific/solinas32_2e255m765_13limbs/femul (real: 207.94, user: 192.95, sys: 0.48, mem: 1656912 ko)
+COQC src/Specific/NISTP256/AMD64/femul.v
+Finished transaction in 122.29 secs (111.972u,0.239s) (successful)
+total time: 112.164s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 97.1% 1 108.944s
+─ReflectiveTactics.do_reflective_pipelin -0.0% 96.5% 1 108.236s
+─ReflectiveTactics.solve_side_conditions 0.0% 96.3% 1 108.000s
+─ReflectiveTactics.do_reify ------------ 0.0% 81.8% 1 91.740s
+─Reify.Reify_rhs_gen ------------------- 0.7% 81.6% 1 91.504s
+─Reify.do_reify_abs_goal --------------- 75.6% 75.7% 2 84.892s
+─Reify.do_reifyf_goal ------------------ 75.2% 75.4% 901 84.532s
+─eexact -------------------------------- 17.1% 17.1% 903 0.140s
+─ReflectiveTactics.solve_post_reified_si 0.2% 14.5% 1 16.260s
+─UnifyAbstractReflexivity.unify_transfor 11.7% 13.3% 8 3.152s
+─synthesize_montgomery ----------------- 0.0% 2.9% 1 3.220s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 97.1% 1 108.944s
+â””ReflectiveTactics.do_reflective_pipelin -0.0% 96.5% 1 108.236s
+â””ReflectiveTactics.solve_side_conditions 0.0% 96.3% 1 108.000s
+ ├─ReflectiveTactics.do_reify ---------- 0.0% 81.8% 1 91.740s
+ │└Reify.Reify_rhs_gen ----------------- 0.7% 81.6% 1 91.504s
+ │└Reify.do_reify_abs_goal ------------- 75.6% 75.7% 2 84.892s
+ │└Reify.do_reifyf_goal ---------------- 75.2% 75.4% 901 84.532s
+ │└eexact ------------------------------ 16.9% 16.9% 901 0.140s
+ └─ReflectiveTactics.solve_post_reified_ 0.2% 14.5% 1 16.260s
+ â””UnifyAbstractReflexivity.unify_transf 11.7% 13.3% 8 3.152s
+─synthesize_montgomery ----------------- 0.0% 2.9% 1 3.220s
+
+Finished transaction in 72.408 secs (68.432u,0.064s) (successful)
+Closed under the global context
+total time: 112.164s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 97.1% 1 108.944s
+─ReflectiveTactics.do_reflective_pipelin -0.0% 96.5% 1 108.236s
+─ReflectiveTactics.solve_side_conditions 0.0% 96.3% 1 108.000s
+─ReflectiveTactics.do_reify ------------ 0.0% 81.8% 1 91.740s
+─Reify.Reify_rhs_gen ------------------- 0.7% 81.6% 1 91.504s
+─Reify.do_reify_abs_goal --------------- 75.6% 75.7% 2 84.892s
+─Reify.do_reifyf_goal ------------------ 75.2% 75.4% 901 84.532s
+─eexact -------------------------------- 17.1% 17.1% 903 0.140s
+─ReflectiveTactics.solve_post_reified_si 0.2% 14.5% 1 16.260s
+─UnifyAbstractReflexivity.unify_transfor 11.7% 13.3% 8 3.152s
+─synthesize_montgomery ----------------- 0.0% 2.9% 1 3.220s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 97.1% 1 108.944s
+â””ReflectiveTactics.do_reflective_pipelin -0.0% 96.5% 1 108.236s
+â””ReflectiveTactics.solve_side_conditions 0.0% 96.3% 1 108.000s
+ ├─ReflectiveTactics.do_reify ---------- 0.0% 81.8% 1 91.740s
+ │└Reify.Reify_rhs_gen ----------------- 0.7% 81.6% 1 91.504s
+ │└Reify.do_reify_abs_goal ------------- 75.6% 75.7% 2 84.892s
+ │└Reify.do_reifyf_goal ---------------- 75.2% 75.4% 901 84.532s
+ │└eexact ------------------------------ 16.9% 16.9% 901 0.140s
+ └─ReflectiveTactics.solve_post_reified_ 0.2% 14.5% 1 16.260s
+ â””UnifyAbstractReflexivity.unify_transf 11.7% 13.3% 8 3.152s
+─synthesize_montgomery ----------------- 0.0% 2.9% 1 3.220s
+
+src/Specific/NISTP256/AMD64/femul (real: 217.80, user: 202.52, sys: 0.53, mem: 3307052 ko)
+COQC src/Specific/NISTP256/AMD64/femulDisplay > src/Specific/NISTP256/AMD64/femulDisplay.log
+COQC src/Specific/X25519/C64/ladderstep.v
+total time: 82.012s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_xzladderstep --------------- 0.0% 100.0% 1 82.012s
+─Pipeline.refine_reflectively_gen ------ 0.0% 99.0% 1 81.228s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 96.1% 1 78.784s
+─ReflectiveTactics.solve_side_conditions 0.0% 95.9% 1 78.684s
+─ReflectiveTactics.solve_post_reified_si 0.1% 72.6% 1 59.540s
+─UnifyAbstractReflexivity.unify_transfor 64.6% 68.0% 8 30.740s
+─ReflectiveTactics.do_reify ------------ 0.0% 23.3% 1 19.144s
+─Reify.Reify_rhs_gen ------------------- 1.2% 14.5% 1 11.860s
+─Reify.do_reifyf_goal ------------------ 7.1% 7.2% 138 1.908s
+─Compilers.Reify.reify_context_variables 0.0% 5.9% 1 4.828s
+─rewrite H ----------------------------- 4.4% 4.4% 1 3.600s
+─ReflectiveTactics.unify_abstract_cbv_in 2.9% 4.0% 1 3.288s
+─Glue.refine_to_reflective_glue' ------- 0.0% 3.0% 1 2.444s
+─Glue.zrange_to_reflective ------------- 0.0% 2.5% 1 2.060s
+─reflexivity --------------------------- 2.3% 2.3% 11 0.816s
+─Reify.transitivity_tt ----------------- 0.0% 2.1% 2 0.968s
+─Glue.zrange_to_reflective_goal -------- 1.4% 2.1% 1 1.720s
+─clear (var_list) ---------------------- 2.0% 2.0% 159 0.584s
+─eexact -------------------------------- 2.0% 2.0% 140 0.032s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_xzladderstep --------------- 0.0% 100.0% 1 82.012s
+â””Pipeline.refine_reflectively_gen ------ 0.0% 99.0% 1 81.228s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 96.1% 1 78.784s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 95.9% 1 78.684s
+ │ ├─ReflectiveTactics.solve_post_reifie 0.1% 72.6% 1 59.540s
+ │ │ ├─UnifyAbstractReflexivity.unify_tr 64.6% 68.0% 8 30.740s
+ │ │ └─ReflectiveTactics.unify_abstract_ 2.9% 4.0% 1 3.288s
+ │ └─ReflectiveTactics.do_reify -------- 0.0% 23.3% 1 19.144s
+ │ ├─Reify.Reify_rhs_gen ------------- 1.2% 14.5% 1 11.860s
+ │ │ ├─rewrite H --------------------- 4.4% 4.4% 1 3.600s
+ │ │ └─Reify.transitivity_tt --------- 0.0% 2.1% 2 0.968s
+ │ └─Compilers.Reify.reify_context_var 0.0% 5.9% 1 4.828s
+ │ └Reify.do_reifyf_goal ------------ 5.7% 5.8% 113 1.908s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 3.0% 1 2.444s
+ â””Glue.zrange_to_reflective ----------- 0.0% 2.5% 1 2.060s
+ â””Glue.zrange_to_reflective_goal ------ 1.4% 2.1% 1 1.720s
+
+Finished transaction in 194.903 secs (185.732u,0.043s) (successful)
+Closed under the global context
+total time: 82.012s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_xzladderstep --------------- 0.0% 100.0% 1 82.012s
+─Pipeline.refine_reflectively_gen ------ 0.0% 99.0% 1 81.228s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 96.1% 1 78.784s
+─ReflectiveTactics.solve_side_conditions 0.0% 95.9% 1 78.684s
+─ReflectiveTactics.solve_post_reified_si 0.1% 72.6% 1 59.540s
+─UnifyAbstractReflexivity.unify_transfor 64.6% 68.0% 8 30.740s
+─ReflectiveTactics.do_reify ------------ 0.0% 23.3% 1 19.144s
+─Reify.Reify_rhs_gen ------------------- 1.2% 14.5% 1 11.860s
+─Reify.do_reifyf_goal ------------------ 7.1% 7.2% 138 1.908s
+─Compilers.Reify.reify_context_variables 0.0% 5.9% 1 4.828s
+─rewrite H ----------------------------- 4.4% 4.4% 1 3.600s
+─ReflectiveTactics.unify_abstract_cbv_in 2.9% 4.0% 1 3.288s
+─Glue.refine_to_reflective_glue' ------- 0.0% 3.0% 1 2.444s
+─Glue.zrange_to_reflective ------------- 0.0% 2.5% 1 2.060s
+─reflexivity --------------------------- 2.3% 2.3% 11 0.816s
+─Reify.transitivity_tt ----------------- 0.0% 2.1% 2 0.968s
+─Glue.zrange_to_reflective_goal -------- 1.4% 2.1% 1 1.720s
+─clear (var_list) ---------------------- 2.0% 2.0% 159 0.584s
+─eexact -------------------------------- 2.0% 2.0% 140 0.032s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_xzladderstep --------------- 0.0% 100.0% 1 82.012s
+â””Pipeline.refine_reflectively_gen ------ 0.0% 99.0% 1 81.228s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 96.1% 1 78.784s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 95.9% 1 78.684s
+ │ ├─ReflectiveTactics.solve_post_reifie 0.1% 72.6% 1 59.540s
+ │ │ ├─UnifyAbstractReflexivity.unify_tr 64.6% 68.0% 8 30.740s
+ │ │ └─ReflectiveTactics.unify_abstract_ 2.9% 4.0% 1 3.288s
+ │ └─ReflectiveTactics.do_reify -------- 0.0% 23.3% 1 19.144s
+ │ ├─Reify.Reify_rhs_gen ------------- 1.2% 14.5% 1 11.860s
+ │ │ ├─rewrite H --------------------- 4.4% 4.4% 1 3.600s
+ │ │ └─Reify.transitivity_tt --------- 0.0% 2.1% 2 0.968s
+ │ └─Compilers.Reify.reify_context_var 0.0% 5.9% 1 4.828s
+ │ └Reify.do_reifyf_goal ------------ 5.7% 5.8% 113 1.908s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 3.0% 1 2.444s
+ â””Glue.zrange_to_reflective ----------- 0.0% 2.5% 1 2.060s
+ â””Glue.zrange_to_reflective_goal ------ 1.4% 2.1% 1 1.720s
+
+src/Specific/X25519/C64/ladderstep (real: 316.83, user: 299.49, sys: 0.52, mem: 1621500 ko)
+COQC src/Specific/X25519/C64/ladderstepDisplay > src/Specific/X25519/C64/ladderstepDisplay.log
diff --git a/test-suite/coq-makefile/timing/precomputed-time-tests/001-correct-diff-sorting-order/time-of-build-both.log.expected b/test-suite/coq-makefile/timing/precomputed-time-tests/001-correct-diff-sorting-order/time-of-build-both.log.expected
new file mode 100644
index 000000000..975e359b7
--- /dev/null
+++ b/test-suite/coq-makefile/timing/precomputed-time-tests/001-correct-diff-sorting-order/time-of-build-both.log.expected
@@ -0,0 +1,26 @@
+After | File Name | Before || Change | % Change
+----------------------------------------------------------------------------------------------
+19m16.05s | Total | 21m25.28s || -2m09.23s | -10.05%
+----------------------------------------------------------------------------------------------
+4m01.34s | Specific/X25519/C64/ladderstep | 4m59.49s || -0m58.15s | -19.41%
+2m48.52s | Specific/solinas32_2e255m765_13limbs/femul | 3m12.95s || -0m24.42s | -12.66%
+2m23.70s | Specific/solinas32_2e255m765_12limbs/femul | 2m44.11s || -0m20.41s | -12.43%
+3m09.62s | Specific/NISTP256/AMD64/femul | 3m22.52s || -0m12.90s | -6.36%
+0m36.32s | Specific/X25519/C64/femul | 0m39.50s || -0m03.17s | -8.05%
+0m30.13s | Specific/X25519/C64/fesquare | 0m32.24s || -0m02.11s | -6.54%
+0m35.40s | Specific/NISTP256/AMD64/feadd | 0m37.21s || -0m01.81s | -4.86%
+0m31.50s | Specific/X25519/C64/freeze | 0m33.24s || -0m01.74s | -5.23%
+0m24.99s | Specific/X25519/C64/fecarry | 0m26.31s || -0m01.32s | -5.01%
+0m22.65s | Specific/X25519/C64/fesub | 0m23.72s || -0m01.07s | -4.51%
+0m45.75s | Specific/solinas32_2e255m765_13limbs/Synthesis | 0m45.58s || +0m00.17s | +0.37%
+0m39.59s | Specific/NISTP256/AMD64/fesub | 0m40.09s || -0m00.50s | -1.24%
+0m36.92s | Specific/solinas32_2e255m765_12limbs/Synthesis | 0m36.64s || +0m00.28s | +0.76%
+0m28.51s | Specific/NISTP256/AMD64/feopp | 0m29.46s || -0m00.94s | -3.22%
+0m25.50s | Specific/NISTP256/AMD64/fenz | 0m26.41s || -0m00.91s | -3.44%
+0m20.93s | Specific/X25519/C64/feadd | 0m21.41s || -0m00.48s | -2.24%
+0m12.55s | Specific/NISTP256/AMD64/Synthesis | 0m12.54s || +0m00.01s | +0.07%
+0m10.37s | Specific/X25519/C64/Synthesis | 0m10.30s || +0m00.06s | +0.67%
+0m07.18s | Compilers/Z/Bounds/Pipeline/Definition | 0m07.22s || -0m00.04s | -0.55%
+0m01.72s | Compilers/Z/Bounds/Pipeline/ReflectiveTactics | 0m01.58s || +0m00.13s | +8.86%
+0m01.67s | Specific/Framework/SynthesisFramework | 0m01.72s || -0m00.05s | -2.90%
+0m01.19s | Compilers/Z/Bounds/Pipeline | 0m01.04s || +0m00.14s | +14.42% \ No newline at end of file
diff --git a/test-suite/coq-makefile/timing/precomputed-time-tests/002-single-file-sorting/run.sh b/test-suite/coq-makefile/timing/precomputed-time-tests/002-single-file-sorting/run.sh
new file mode 100755
index 000000000..4f39b3ce7
--- /dev/null
+++ b/test-suite/coq-makefile/timing/precomputed-time-tests/002-single-file-sorting/run.sh
@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+
+set -x
+set -e
+
+cd "$(dirname "${BASH_SOURCE[0]}")"
+
+"$COQLIB"/tools/make-one-time-file.py time-of-build.log.in time-of-build-pretty.log
+
+diff -u time-of-build-pretty.log.expected time-of-build-pretty.log || exit $?
diff --git a/test-suite/coq-makefile/timing/precomputed-time-tests/002-single-file-sorting/time-of-build-pretty.log.expected b/test-suite/coq-makefile/timing/precomputed-time-tests/002-single-file-sorting/time-of-build-pretty.log.expected
new file mode 100644
index 000000000..fdd5ec21d
--- /dev/null
+++ b/test-suite/coq-makefile/timing/precomputed-time-tests/002-single-file-sorting/time-of-build-pretty.log.expected
@@ -0,0 +1,26 @@
+Time | File Name
+----------------------------------------------------------
+19m16.05s | Total
+----------------------------------------------------------
+4m01.34s | Specific/X25519/C64/ladderstep
+3m09.62s | Specific/NISTP256/AMD64/femul
+2m48.52s | Specific/solinas32_2e255m765_13limbs/femul
+2m23.70s | Specific/solinas32_2e255m765_12limbs/femul
+0m45.75s | Specific/solinas32_2e255m765_13limbs/Synthesis
+0m39.59s | Specific/NISTP256/AMD64/fesub
+0m36.92s | Specific/solinas32_2e255m765_12limbs/Synthesis
+0m36.32s | Specific/X25519/C64/femul
+0m35.40s | Specific/NISTP256/AMD64/feadd
+0m31.50s | Specific/X25519/C64/freeze
+0m30.13s | Specific/X25519/C64/fesquare
+0m28.51s | Specific/NISTP256/AMD64/feopp
+0m25.50s | Specific/NISTP256/AMD64/fenz
+0m24.99s | Specific/X25519/C64/fecarry
+0m22.65s | Specific/X25519/C64/fesub
+0m20.93s | Specific/X25519/C64/feadd
+0m12.55s | Specific/NISTP256/AMD64/Synthesis
+0m10.37s | Specific/X25519/C64/Synthesis
+0m07.18s | Compilers/Z/Bounds/Pipeline/Definition
+0m01.72s | Compilers/Z/Bounds/Pipeline/ReflectiveTactics
+0m01.67s | Specific/Framework/SynthesisFramework
+0m01.19s | Compilers/Z/Bounds/Pipeline \ No newline at end of file
diff --git a/test-suite/coq-makefile/timing/precomputed-time-tests/002-single-file-sorting/time-of-build.log.in b/test-suite/coq-makefile/timing/precomputed-time-tests/002-single-file-sorting/time-of-build.log.in
new file mode 100644
index 000000000..5757018e9
--- /dev/null
+++ b/test-suite/coq-makefile/timing/precomputed-time-tests/002-single-file-sorting/time-of-build.log.in
@@ -0,0 +1,1760 @@
+COQDEP src/Compilers/Z/Bounds/Pipeline/ReflectiveTactics.v
+COQDEP src/Compilers/Z/Bounds/Pipeline/Definition.v
+/home/jgross/.local64/coq/coq-master/bin/coq_makefile -f _CoqProject INSTALLDEFAULTROOT = Crypto -o Makefile-old
+COQ_MAKEFILE -f _CoqProject > Makefile.coq
+make --no-print-directory -C coqprime
+make[1]: Nothing to be done for 'all'.
+ECHO > _CoqProject
+COQC src/Compilers/Z/Bounds/Pipeline/Definition.v
+src/Compilers/Z/Bounds/Pipeline/Definition (real: 7.33, user: 7.18, sys: 0.14, mem: 574388 ko)
+COQC src/Compilers/Z/Bounds/Pipeline/ReflectiveTactics.v
+src/Compilers/Z/Bounds/Pipeline/ReflectiveTactics (real: 1.93, user: 1.72, sys: 0.20, mem: 544172 ko)
+COQC src/Compilers/Z/Bounds/Pipeline.v
+src/Compilers/Z/Bounds/Pipeline (real: 1.38, user: 1.19, sys: 0.16, mem: 539808 ko)
+COQC src/Specific/Framework/SynthesisFramework.v
+src/Specific/Framework/SynthesisFramework (real: 1.85, user: 1.67, sys: 0.17, mem: 646300 ko)
+COQC src/Specific/X25519/C64/Synthesis.v
+src/Specific/X25519/C64/Synthesis (real: 11.15, user: 10.37, sys: 0.18, mem: 687760 ko)
+COQC src/Specific/NISTP256/AMD64/Synthesis.v
+src/Specific/NISTP256/AMD64/Synthesis (real: 13.45, user: 12.55, sys: 0.19, mem: 668216 ko)
+COQC src/Specific/X25519/C64/feadd.v
+Finished transaction in 2.814 secs (2.624u,0.s) (successful)
+total time: 2.576s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.2% 97.4% 1 2.508s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 66.9% 1 1.724s
+─ReflectiveTactics.solve_side_conditions 0.0% 65.5% 1 1.688s
+─ReflectiveTactics.solve_post_reified_si 1.2% 37.0% 1 0.952s
+─Glue.refine_to_reflective_glue' ------- 0.0% 30.3% 1 0.780s
+─ReflectiveTactics.do_reify ------------ 0.0% 28.6% 1 0.736s
+─Reify.Reify_rhs_gen ------------------- 2.2% 26.6% 1 0.684s
+─UnifyAbstractReflexivity.unify_transfor 20.3% 24.1% 7 0.164s
+─Glue.zrange_to_reflective ------------- 0.0% 20.3% 1 0.524s
+─Glue.zrange_to_reflective_goal -------- 9.5% 15.2% 1 0.392s
+─Reify.do_reify_abs_goal --------------- 13.7% 13.8% 2 0.356s
+─Reify.do_reifyf_goal ------------------ 12.4% 12.6% 16 0.324s
+─ReflectiveTactics.unify_abstract_cbv_in 8.4% 11.2% 1 0.288s
+─unify (constr) (constr) --------------- 5.7% 5.7% 6 0.072s
+─Glue.pattern_sig_sig_assoc ------------ 0.0% 5.4% 1 0.140s
+─assert (H : is_bounded_by' bounds (map' 4.8% 5.1% 2 0.072s
+─Glue.pattern_proj1_sig_in_sig --------- 1.7% 5.1% 1 0.132s
+─pose proof (pf : Interpretation.Bo 3.7% 3.7% 1 0.096s
+─Glue.split_BoundedWordToZ ------------- 0.3% 3.7% 1 0.096s
+─destruct_sig -------------------------- 0.2% 3.3% 4 0.044s
+─destruct x ---------------------------- 3.1% 3.1% 4 0.036s
+─eexact -------------------------------- 3.0% 3.0% 18 0.008s
+─clearbody (ne_var_list) --------------- 3.0% 3.0% 4 0.060s
+─prove_interp_compile_correct ---------- 0.0% 2.8% 1 0.072s
+─synthesize ---------------------------- 0.0% 2.6% 1 0.068s
+─rewrite ?EtaInterp.InterpExprEta ------ 2.5% 2.5% 1 0.064s
+─ClearbodyAll.clearbody_all ------------ 0.0% 2.3% 2 0.060s
+─rewrite H ----------------------------- 2.2% 2.2% 1 0.056s
+─reflexivity --------------------------- 2.2% 2.2% 7 0.032s
+─Reify.transitivity_tt ----------------- 0.0% 2.2% 2 0.032s
+─transitivity -------------------------- 2.0% 2.0% 5 0.024s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.2% 97.4% 1 2.508s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 66.9% 1 1.724s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 65.5% 1 1.688s
+ │ ├─ReflectiveTactics.solve_post_reifie 1.2% 37.0% 1 0.952s
+ │ │ ├─UnifyAbstractReflexivity.unify_tr 20.3% 24.1% 7 0.164s
+ │ │ │└unify (constr) (constr) --------- 3.0% 3.0% 5 0.028s
+ │ │ └─ReflectiveTactics.unify_abstract_ 8.4% 11.2% 1 0.288s
+ │ │ └unify (constr) (constr) --------- 2.8% 2.8% 1 0.072s
+ │ └─ReflectiveTactics.do_reify -------- 0.0% 28.6% 1 0.736s
+ │ └Reify.Reify_rhs_gen --------------- 2.2% 26.6% 1 0.684s
+ │ ├─Reify.do_reify_abs_goal --------- 13.7% 13.8% 2 0.356s
+ │ │└Reify.do_reifyf_goal ------------ 12.4% 12.6% 16 0.324s
+ │ │└eexact -------------------------- 2.6% 2.6% 16 0.008s
+ │ ├─prove_interp_compile_correct ---- 0.0% 2.8% 1 0.072s
+ │ │└rewrite ?EtaInterp.InterpExprEta 2.5% 2.5% 1 0.064s
+ │ ├─rewrite H ----------------------- 2.2% 2.2% 1 0.056s
+ │ └─Reify.transitivity_tt ----------- 0.0% 2.2% 2 0.032s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 30.3% 1 0.780s
+ ├─Glue.zrange_to_reflective --------- 0.0% 20.3% 1 0.524s
+ │ ├─Glue.zrange_to_reflective_goal -- 9.5% 15.2% 1 0.392s
+ │ │└pose proof (pf : Interpretat 3.7% 3.7% 1 0.096s
+ │ └─assert (H : is_bounded_by' bounds 4.8% 5.1% 2 0.072s
+ ├─Glue.pattern_sig_sig_assoc -------- 0.0% 5.4% 1 0.140s
+ │└Glue.pattern_proj1_sig_in_sig ----- 1.7% 5.1% 1 0.132s
+ │└ClearbodyAll.clearbody_all -------- 0.0% 2.3% 2 0.060s
+ │└clearbody (ne_var_list) ----------- 2.3% 2.3% 1 0.060s
+ └─Glue.split_BoundedWordToZ --------- 0.3% 3.7% 1 0.096s
+ â””destruct_sig ---------------------- 0.2% 3.3% 4 0.044s
+ â””destruct x ------------------------ 2.5% 2.5% 2 0.036s
+─synthesize ---------------------------- 0.0% 2.6% 1 0.068s
+
+Finished transaction in 5.021 secs (4.636u,0.s) (successful)
+Closed under the global context
+total time: 2.576s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.2% 97.4% 1 2.508s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 66.9% 1 1.724s
+─ReflectiveTactics.solve_side_conditions 0.0% 65.5% 1 1.688s
+─ReflectiveTactics.solve_post_reified_si 1.2% 37.0% 1 0.952s
+─Glue.refine_to_reflective_glue' ------- 0.0% 30.3% 1 0.780s
+─ReflectiveTactics.do_reify ------------ 0.0% 28.6% 1 0.736s
+─Reify.Reify_rhs_gen ------------------- 2.2% 26.6% 1 0.684s
+─UnifyAbstractReflexivity.unify_transfor 20.3% 24.1% 7 0.164s
+─Glue.zrange_to_reflective ------------- 0.0% 20.3% 1 0.524s
+─Glue.zrange_to_reflective_goal -------- 9.5% 15.2% 1 0.392s
+─Reify.do_reify_abs_goal --------------- 13.7% 13.8% 2 0.356s
+─Reify.do_reifyf_goal ------------------ 12.4% 12.6% 16 0.324s
+─ReflectiveTactics.unify_abstract_cbv_in 8.4% 11.2% 1 0.288s
+─unify (constr) (constr) --------------- 5.7% 5.7% 6 0.072s
+─Glue.pattern_sig_sig_assoc ------------ 0.0% 5.4% 1 0.140s
+─assert (H : is_bounded_by' bounds (map' 4.8% 5.1% 2 0.072s
+─Glue.pattern_proj1_sig_in_sig --------- 1.7% 5.1% 1 0.132s
+─pose proof (pf : Interpretation.Bo 3.7% 3.7% 1 0.096s
+─Glue.split_BoundedWordToZ ------------- 0.3% 3.7% 1 0.096s
+─destruct_sig -------------------------- 0.2% 3.3% 4 0.044s
+─destruct x ---------------------------- 3.1% 3.1% 4 0.036s
+─eexact -------------------------------- 3.0% 3.0% 18 0.008s
+─clearbody (ne_var_list) --------------- 3.0% 3.0% 4 0.060s
+─prove_interp_compile_correct ---------- 0.0% 2.8% 1 0.072s
+─synthesize ---------------------------- 0.0% 2.6% 1 0.068s
+─rewrite ?EtaInterp.InterpExprEta ------ 2.5% 2.5% 1 0.064s
+─ClearbodyAll.clearbody_all ------------ 0.0% 2.3% 2 0.060s
+─rewrite H ----------------------------- 2.2% 2.2% 1 0.056s
+─reflexivity --------------------------- 2.2% 2.2% 7 0.032s
+─Reify.transitivity_tt ----------------- 0.0% 2.2% 2 0.032s
+─transitivity -------------------------- 2.0% 2.0% 5 0.024s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.2% 97.4% 1 2.508s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 66.9% 1 1.724s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 65.5% 1 1.688s
+ │ ├─ReflectiveTactics.solve_post_reifie 1.2% 37.0% 1 0.952s
+ │ │ ├─UnifyAbstractReflexivity.unify_tr 20.3% 24.1% 7 0.164s
+ │ │ │└unify (constr) (constr) --------- 3.0% 3.0% 5 0.028s
+ │ │ └─ReflectiveTactics.unify_abstract_ 8.4% 11.2% 1 0.288s
+ │ │ └unify (constr) (constr) --------- 2.8% 2.8% 1 0.072s
+ │ └─ReflectiveTactics.do_reify -------- 0.0% 28.6% 1 0.736s
+ │ └Reify.Reify_rhs_gen --------------- 2.2% 26.6% 1 0.684s
+ │ ├─Reify.do_reify_abs_goal --------- 13.7% 13.8% 2 0.356s
+ │ │└Reify.do_reifyf_goal ------------ 12.4% 12.6% 16 0.324s
+ │ │└eexact -------------------------- 2.6% 2.6% 16 0.008s
+ │ ├─prove_interp_compile_correct ---- 0.0% 2.8% 1 0.072s
+ │ │└rewrite ?EtaInterp.InterpExprEta 2.5% 2.5% 1 0.064s
+ │ ├─rewrite H ----------------------- 2.2% 2.2% 1 0.056s
+ │ └─Reify.transitivity_tt ----------- 0.0% 2.2% 2 0.032s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 30.3% 1 0.780s
+ ├─Glue.zrange_to_reflective --------- 0.0% 20.3% 1 0.524s
+ │ ├─Glue.zrange_to_reflective_goal -- 9.5% 15.2% 1 0.392s
+ │ │└pose proof (pf : Interpretat 3.7% 3.7% 1 0.096s
+ │ └─assert (H : is_bounded_by' bounds 4.8% 5.1% 2 0.072s
+ ├─Glue.pattern_sig_sig_assoc -------- 0.0% 5.4% 1 0.140s
+ │└Glue.pattern_proj1_sig_in_sig ----- 1.7% 5.1% 1 0.132s
+ │└ClearbodyAll.clearbody_all -------- 0.0% 2.3% 2 0.060s
+ │└clearbody (ne_var_list) ----------- 2.3% 2.3% 1 0.060s
+ └─Glue.split_BoundedWordToZ --------- 0.3% 3.7% 1 0.096s
+ â””destruct_sig ---------------------- 0.2% 3.3% 4 0.044s
+ â””destruct x ------------------------ 2.5% 2.5% 2 0.036s
+─synthesize ---------------------------- 0.0% 2.6% 1 0.068s
+
+src/Specific/X25519/C64/feadd (real: 22.81, user: 20.93, sys: 0.25, mem: 766300 ko)
+COQC src/Specific/X25519/C64/fecarry.v
+Finished transaction in 4.343 secs (4.016u,0.004s) (successful)
+total time: 3.976s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 99.0% 1 3.936s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 87.9% 1 3.496s
+─ReflectiveTactics.solve_side_conditions 0.0% 86.9% 1 3.456s
+─ReflectiveTactics.do_reify ------------ 0.0% 56.9% 1 2.264s
+─Reify.Reify_rhs_gen ------------------- 1.8% 56.2% 1 2.236s
+─Reify.do_reify_abs_goal --------------- 36.1% 36.5% 2 1.452s
+─Reify.do_reifyf_goal ------------------ 34.8% 35.1% 29 1.396s
+─ReflectiveTactics.solve_post_reified_si 0.6% 30.0% 1 1.192s
+─UnifyAbstractReflexivity.unify_transfor 17.7% 21.7% 7 0.240s
+─Glue.refine_to_reflective_glue' ------- 0.0% 11.1% 1 0.440s
+─eexact -------------------------------- 10.9% 10.9% 31 0.024s
+─ReflectiveTactics.unify_abstract_cbv_in 5.2% 7.3% 1 0.292s
+─Glue.zrange_to_reflective ------------- 0.0% 7.1% 1 0.284s
+─prove_interp_compile_correct ---------- 0.0% 5.7% 1 0.228s
+─Glue.zrange_to_reflective_goal -------- 4.3% 5.5% 1 0.220s
+─unify (constr) (constr) --------------- 5.3% 5.3% 6 0.084s
+─rewrite ?EtaInterp.InterpExprEta ------ 5.2% 5.2% 1 0.208s
+─rewrite H ----------------------------- 3.5% 3.5% 1 0.140s
+─tac ----------------------------------- 1.9% 2.6% 2 0.104s
+─reflexivity --------------------------- 2.2% 2.2% 7 0.028s
+─Reify.transitivity_tt ----------------- 0.0% 2.2% 2 0.056s
+─transitivity -------------------------- 2.0% 2.0% 5 0.048s
+─Glue.split_BoundedWordToZ ------------- 0.1% 2.0% 1 0.080s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 99.0% 1 3.936s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 87.9% 1 3.496s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 86.9% 1 3.456s
+ │ ├─ReflectiveTactics.do_reify -------- 0.0% 56.9% 1 2.264s
+ │ │└Reify.Reify_rhs_gen --------------- 1.8% 56.2% 1 2.236s
+ │ │ ├─Reify.do_reify_abs_goal --------- 36.1% 36.5% 2 1.452s
+ │ │ │└Reify.do_reifyf_goal ------------ 34.8% 35.1% 29 1.396s
+ │ │ │└eexact -------------------------- 10.1% 10.1% 29 0.024s
+ │ │ ├─prove_interp_compile_correct ---- 0.0% 5.7% 1 0.228s
+ │ │ │└rewrite ?EtaInterp.InterpExprEta 5.2% 5.2% 1 0.208s
+ │ │ ├─rewrite H ----------------------- 3.5% 3.5% 1 0.140s
+ │ │ ├─tac ----------------------------- 1.9% 2.6% 1 0.104s
+ │ │ └─Reify.transitivity_tt ----------- 0.0% 2.2% 2 0.056s
+ │ │ └transitivity -------------------- 2.0% 2.0% 4 0.048s
+ │ └─ReflectiveTactics.solve_post_reifie 0.6% 30.0% 1 1.192s
+ │ ├─UnifyAbstractReflexivity.unify_tr 17.7% 21.7% 7 0.240s
+ │ │└unify (constr) (constr) --------- 3.2% 3.2% 5 0.048s
+ │ └─ReflectiveTactics.unify_abstract_ 5.2% 7.3% 1 0.292s
+ │ └unify (constr) (constr) --------- 2.1% 2.1% 1 0.084s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 11.1% 1 0.440s
+ ├─Glue.zrange_to_reflective --------- 0.0% 7.1% 1 0.284s
+ │└Glue.zrange_to_reflective_goal ---- 4.3% 5.5% 1 0.220s
+ └─Glue.split_BoundedWordToZ --------- 0.1% 2.0% 1 0.080s
+
+Finished transaction in 7.078 secs (6.728u,0.s) (successful)
+Closed under the global context
+total time: 3.976s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 99.0% 1 3.936s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 87.9% 1 3.496s
+─ReflectiveTactics.solve_side_conditions 0.0% 86.9% 1 3.456s
+─ReflectiveTactics.do_reify ------------ 0.0% 56.9% 1 2.264s
+─Reify.Reify_rhs_gen ------------------- 1.8% 56.2% 1 2.236s
+─Reify.do_reify_abs_goal --------------- 36.1% 36.5% 2 1.452s
+─Reify.do_reifyf_goal ------------------ 34.8% 35.1% 29 1.396s
+─ReflectiveTactics.solve_post_reified_si 0.6% 30.0% 1 1.192s
+─UnifyAbstractReflexivity.unify_transfor 17.7% 21.7% 7 0.240s
+─Glue.refine_to_reflective_glue' ------- 0.0% 11.1% 1 0.440s
+─eexact -------------------------------- 10.9% 10.9% 31 0.024s
+─ReflectiveTactics.unify_abstract_cbv_in 5.2% 7.3% 1 0.292s
+─Glue.zrange_to_reflective ------------- 0.0% 7.1% 1 0.284s
+─prove_interp_compile_correct ---------- 0.0% 5.7% 1 0.228s
+─Glue.zrange_to_reflective_goal -------- 4.3% 5.5% 1 0.220s
+─unify (constr) (constr) --------------- 5.3% 5.3% 6 0.084s
+─rewrite ?EtaInterp.InterpExprEta ------ 5.2% 5.2% 1 0.208s
+─rewrite H ----------------------------- 3.5% 3.5% 1 0.140s
+─tac ----------------------------------- 1.9% 2.6% 2 0.104s
+─reflexivity --------------------------- 2.2% 2.2% 7 0.028s
+─Reify.transitivity_tt ----------------- 0.0% 2.2% 2 0.056s
+─transitivity -------------------------- 2.0% 2.0% 5 0.048s
+─Glue.split_BoundedWordToZ ------------- 0.1% 2.0% 1 0.080s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 99.0% 1 3.936s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 87.9% 1 3.496s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 86.9% 1 3.456s
+ │ ├─ReflectiveTactics.do_reify -------- 0.0% 56.9% 1 2.264s
+ │ │└Reify.Reify_rhs_gen --------------- 1.8% 56.2% 1 2.236s
+ │ │ ├─Reify.do_reify_abs_goal --------- 36.1% 36.5% 2 1.452s
+ │ │ │└Reify.do_reifyf_goal ------------ 34.8% 35.1% 29 1.396s
+ │ │ │└eexact -------------------------- 10.1% 10.1% 29 0.024s
+ │ │ ├─prove_interp_compile_correct ---- 0.0% 5.7% 1 0.228s
+ │ │ │└rewrite ?EtaInterp.InterpExprEta 5.2% 5.2% 1 0.208s
+ │ │ ├─rewrite H ----------------------- 3.5% 3.5% 1 0.140s
+ │ │ ├─tac ----------------------------- 1.9% 2.6% 1 0.104s
+ │ │ └─Reify.transitivity_tt ----------- 0.0% 2.2% 2 0.056s
+ │ │ └transitivity -------------------- 2.0% 2.0% 4 0.048s
+ │ └─ReflectiveTactics.solve_post_reifie 0.6% 30.0% 1 1.192s
+ │ ├─UnifyAbstractReflexivity.unify_tr 17.7% 21.7% 7 0.240s
+ │ │└unify (constr) (constr) --------- 3.2% 3.2% 5 0.048s
+ │ └─ReflectiveTactics.unify_abstract_ 5.2% 7.3% 1 0.292s
+ │ └unify (constr) (constr) --------- 2.1% 2.1% 1 0.084s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 11.1% 1 0.440s
+ ├─Glue.zrange_to_reflective --------- 0.0% 7.1% 1 0.284s
+ │└Glue.zrange_to_reflective_goal ---- 4.3% 5.5% 1 0.220s
+ └─Glue.split_BoundedWordToZ --------- 0.1% 2.0% 1 0.080s
+
+src/Specific/X25519/C64/fecarry (real: 27.11, user: 24.99, sys: 0.21, mem: 786052 ko)
+COQC src/Specific/solinas32_2e255m765_12limbs/Synthesis.v
+src/Specific/solinas32_2e255m765_12limbs/Synthesis (real: 40.13, user: 36.92, sys: 0.26, mem: 728464 ko)
+COQC src/Specific/solinas32_2e255m765_13limbs/Synthesis.v
+src/Specific/solinas32_2e255m765_13limbs/Synthesis (real: 49.44, user: 45.75, sys: 0.18, mem: 744240 ko)
+COQC src/Specific/X25519/C64/femul.v
+Finished transaction in 8.415 secs (7.664u,0.015s) (successful)
+total time: 7.616s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 94.8% 1 7.220s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 85.0% 1 6.476s
+─ReflectiveTactics.solve_side_conditions 0.0% 84.2% 1 6.416s
+─ReflectiveTactics.do_reify ------------ 0.0% 50.3% 1 3.832s
+─Reify.Reify_rhs_gen ------------------- 1.8% 49.4% 1 3.760s
+─ReflectiveTactics.solve_post_reified_si 0.5% 33.9% 1 2.584s
+─Reify.do_reify_abs_goal --------------- 31.1% 31.4% 2 2.392s
+─Reify.do_reifyf_goal ------------------ 30.0% 30.3% 58 1.528s
+─UnifyAbstractReflexivity.unify_transfor 22.1% 27.3% 7 0.600s
+─Glue.refine_to_reflective_glue' ------- 0.0% 9.8% 1 0.744s
+─eexact -------------------------------- 8.2% 8.2% 60 0.024s
+─Glue.zrange_to_reflective ------------- 0.1% 6.8% 1 0.516s
+─unify (constr) (constr) --------------- 5.9% 5.9% 6 0.124s
+─prove_interp_compile_correct ---------- 0.0% 5.8% 1 0.444s
+─ReflectiveTactics.unify_abstract_cbv_in 3.9% 5.7% 1 0.432s
+─rewrite ?EtaInterp.InterpExprEta ------ 5.4% 5.4% 1 0.408s
+─synthesize ---------------------------- 0.0% 5.2% 1 0.396s
+─Glue.zrange_to_reflective_goal -------- 3.0% 5.0% 1 0.384s
+─IntegrationTestTemporaryMiscCommon.do_r 0.1% 4.8% 1 0.364s
+─change G' ----------------------------- 3.9% 3.9% 1 0.300s
+─rewrite H ----------------------------- 3.0% 3.0% 1 0.232s
+─tac ----------------------------------- 1.5% 2.3% 2 0.176s
+─Reify.transitivity_tt ----------------- 0.0% 2.1% 2 0.092s
+─reflexivity --------------------------- 2.0% 2.0% 7 0.052s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 94.8% 1 7.220s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 85.0% 1 6.476s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 84.2% 1 6.416s
+ │ ├─ReflectiveTactics.do_reify -------- 0.0% 50.3% 1 3.832s
+ │ │└Reify.Reify_rhs_gen --------------- 1.8% 49.4% 1 3.760s
+ │ │ ├─Reify.do_reify_abs_goal --------- 31.1% 31.4% 2 2.392s
+ │ │ │└Reify.do_reifyf_goal ------------ 30.0% 30.3% 58 1.528s
+ │ │ │└eexact -------------------------- 7.6% 7.6% 58 0.020s
+ │ │ ├─prove_interp_compile_correct ---- 0.0% 5.8% 1 0.444s
+ │ │ │└rewrite ?EtaInterp.InterpExprEta 5.4% 5.4% 1 0.408s
+ │ │ ├─rewrite H ----------------------- 3.0% 3.0% 1 0.232s
+ │ │ ├─tac ----------------------------- 1.5% 2.3% 1 0.176s
+ │ │ └─Reify.transitivity_tt ----------- 0.0% 2.1% 2 0.092s
+ │ └─ReflectiveTactics.solve_post_reifie 0.5% 33.9% 1 2.584s
+ │ ├─UnifyAbstractReflexivity.unify_tr 22.1% 27.3% 7 0.600s
+ │ │└unify (constr) (constr) --------- 4.3% 4.3% 5 0.096s
+ │ └─ReflectiveTactics.unify_abstract_ 3.9% 5.7% 1 0.432s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 9.8% 1 0.744s
+ â””Glue.zrange_to_reflective ----------- 0.1% 6.8% 1 0.516s
+ â””Glue.zrange_to_reflective_goal ------ 3.0% 5.0% 1 0.384s
+─synthesize ---------------------------- 0.0% 5.2% 1 0.396s
+â””IntegrationTestTemporaryMiscCommon.do_r 0.1% 4.8% 1 0.364s
+â””change G' ----------------------------- 3.9% 3.9% 1 0.300s
+
+Finished transaction in 14.616 secs (13.528u,0.008s) (successful)
+Closed under the global context
+total time: 7.616s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 94.8% 1 7.220s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 85.0% 1 6.476s
+─ReflectiveTactics.solve_side_conditions 0.0% 84.2% 1 6.416s
+─ReflectiveTactics.do_reify ------------ 0.0% 50.3% 1 3.832s
+─Reify.Reify_rhs_gen ------------------- 1.8% 49.4% 1 3.760s
+─ReflectiveTactics.solve_post_reified_si 0.5% 33.9% 1 2.584s
+─Reify.do_reify_abs_goal --------------- 31.1% 31.4% 2 2.392s
+─Reify.do_reifyf_goal ------------------ 30.0% 30.3% 58 1.528s
+─UnifyAbstractReflexivity.unify_transfor 22.1% 27.3% 7 0.600s
+─Glue.refine_to_reflective_glue' ------- 0.0% 9.8% 1 0.744s
+─eexact -------------------------------- 8.2% 8.2% 60 0.024s
+─Glue.zrange_to_reflective ------------- 0.1% 6.8% 1 0.516s
+─unify (constr) (constr) --------------- 5.9% 5.9% 6 0.124s
+─prove_interp_compile_correct ---------- 0.0% 5.8% 1 0.444s
+─ReflectiveTactics.unify_abstract_cbv_in 3.9% 5.7% 1 0.432s
+─rewrite ?EtaInterp.InterpExprEta ------ 5.4% 5.4% 1 0.408s
+─synthesize ---------------------------- 0.0% 5.2% 1 0.396s
+─Glue.zrange_to_reflective_goal -------- 3.0% 5.0% 1 0.384s
+─IntegrationTestTemporaryMiscCommon.do_r 0.1% 4.8% 1 0.364s
+─change G' ----------------------------- 3.9% 3.9% 1 0.300s
+─rewrite H ----------------------------- 3.0% 3.0% 1 0.232s
+─tac ----------------------------------- 1.5% 2.3% 2 0.176s
+─Reify.transitivity_tt ----------------- 0.0% 2.1% 2 0.092s
+─reflexivity --------------------------- 2.0% 2.0% 7 0.052s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 94.8% 1 7.220s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 85.0% 1 6.476s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 84.2% 1 6.416s
+ │ ├─ReflectiveTactics.do_reify -------- 0.0% 50.3% 1 3.832s
+ │ │└Reify.Reify_rhs_gen --------------- 1.8% 49.4% 1 3.760s
+ │ │ ├─Reify.do_reify_abs_goal --------- 31.1% 31.4% 2 2.392s
+ │ │ │└Reify.do_reifyf_goal ------------ 30.0% 30.3% 58 1.528s
+ │ │ │└eexact -------------------------- 7.6% 7.6% 58 0.020s
+ │ │ ├─prove_interp_compile_correct ---- 0.0% 5.8% 1 0.444s
+ │ │ │└rewrite ?EtaInterp.InterpExprEta 5.4% 5.4% 1 0.408s
+ │ │ ├─rewrite H ----------------------- 3.0% 3.0% 1 0.232s
+ │ │ ├─tac ----------------------------- 1.5% 2.3% 1 0.176s
+ │ │ └─Reify.transitivity_tt ----------- 0.0% 2.1% 2 0.092s
+ │ └─ReflectiveTactics.solve_post_reifie 0.5% 33.9% 1 2.584s
+ │ ├─UnifyAbstractReflexivity.unify_tr 22.1% 27.3% 7 0.600s
+ │ │└unify (constr) (constr) --------- 4.3% 4.3% 5 0.096s
+ │ └─ReflectiveTactics.unify_abstract_ 3.9% 5.7% 1 0.432s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 9.8% 1 0.744s
+ â””Glue.zrange_to_reflective ----------- 0.1% 6.8% 1 0.516s
+ â””Glue.zrange_to_reflective_goal ------ 3.0% 5.0% 1 0.384s
+─synthesize ---------------------------- 0.0% 5.2% 1 0.396s
+â””IntegrationTestTemporaryMiscCommon.do_r 0.1% 4.8% 1 0.364s
+â””change G' ----------------------------- 3.9% 3.9% 1 0.300s
+
+src/Specific/X25519/C64/femul (real: 39.72, user: 36.32, sys: 0.26, mem: 825448 ko)
+COQC src/Specific/X25519/C64/feaddDisplay > src/Specific/X25519/C64/feaddDisplay.log
+COQC src/Specific/X25519/C64/fecarryDisplay > src/Specific/X25519/C64/fecarryDisplay.log
+COQC src/Specific/X25519/C64/fesub.v
+Finished transaction in 3.513 secs (3.211u,0.s) (successful)
+total time: 3.164s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 97.6% 1 3.088s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 74.1% 1 2.344s
+─ReflectiveTactics.solve_side_conditions 0.0% 72.9% 1 2.308s
+─ReflectiveTactics.do_reify ------------ 0.0% 38.6% 1 1.220s
+─Reify.Reify_rhs_gen ------------------- 1.5% 37.2% 1 1.176s
+─ReflectiveTactics.solve_post_reified_si 0.9% 34.4% 1 1.088s
+─UnifyAbstractReflexivity.unify_transfor 19.2% 23.9% 7 0.204s
+─Glue.refine_to_reflective_glue' ------- 0.0% 23.5% 1 0.744s
+─Reify.do_reify_abs_goal --------------- 19.2% 19.5% 2 0.616s
+─Reify.do_reifyf_goal ------------------ 18.0% 18.3% 16 0.580s
+─Glue.zrange_to_reflective ------------- 0.1% 15.4% 1 0.488s
+─Glue.zrange_to_reflective_goal -------- 6.8% 11.5% 1 0.364s
+─ReflectiveTactics.unify_abstract_cbv_in 6.2% 9.0% 1 0.284s
+─unify (constr) (constr) --------------- 5.9% 5.9% 6 0.080s
+─Glue.pattern_sig_sig_assoc ------------ 0.0% 4.6% 1 0.144s
+─eexact -------------------------------- 4.4% 4.4% 18 0.012s
+─Glue.pattern_proj1_sig_in_sig --------- 1.4% 4.3% 1 0.136s
+─prove_interp_compile_correct ---------- 0.0% 3.9% 1 0.124s
+─rewrite H ----------------------------- 3.8% 3.8% 1 0.120s
+─assert (H : is_bounded_by' bounds (map' 3.8% 3.8% 2 0.064s
+─rewrite ?EtaInterp.InterpExprEta ------ 3.5% 3.5% 1 0.112s
+─pose proof (pf : Interpretation.Bo 2.9% 2.9% 1 0.092s
+─Glue.split_BoundedWordToZ ------------- 0.1% 2.8% 1 0.088s
+─tac ----------------------------------- 1.9% 2.5% 2 0.080s
+─reflexivity --------------------------- 2.4% 2.4% 7 0.028s
+─synthesize ---------------------------- 0.0% 2.4% 1 0.076s
+─destruct_sig -------------------------- 0.0% 2.4% 4 0.040s
+─destruct x ---------------------------- 2.4% 2.4% 4 0.032s
+─clearbody (ne_var_list) --------------- 2.3% 2.3% 4 0.060s
+─Reify.transitivity_tt ----------------- 0.1% 2.3% 2 0.036s
+─transitivity -------------------------- 2.1% 2.1% 5 0.032s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 97.6% 1 3.088s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 74.1% 1 2.344s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 72.9% 1 2.308s
+ │ ├─ReflectiveTactics.do_reify -------- 0.0% 38.6% 1 1.220s
+ │ │└Reify.Reify_rhs_gen --------------- 1.5% 37.2% 1 1.176s
+ │ │ ├─Reify.do_reify_abs_goal --------- 19.2% 19.5% 2 0.616s
+ │ │ │└Reify.do_reifyf_goal ------------ 18.0% 18.3% 16 0.580s
+ │ │ │└eexact -------------------------- 3.9% 3.9% 16 0.012s
+ │ │ ├─prove_interp_compile_correct ---- 0.0% 3.9% 1 0.124s
+ │ │ │└rewrite ?EtaInterp.InterpExprEta 3.5% 3.5% 1 0.112s
+ │ │ ├─rewrite H ----------------------- 3.8% 3.8% 1 0.120s
+ │ │ ├─tac ----------------------------- 1.9% 2.5% 1 0.080s
+ │ │ └─Reify.transitivity_tt ----------- 0.1% 2.3% 2 0.036s
+ │ │ └transitivity -------------------- 2.0% 2.0% 4 0.032s
+ │ └─ReflectiveTactics.solve_post_reifie 0.9% 34.4% 1 1.088s
+ │ ├─UnifyAbstractReflexivity.unify_tr 19.2% 23.9% 7 0.204s
+ │ │└unify (constr) (constr) --------- 3.4% 3.4% 5 0.036s
+ │ └─ReflectiveTactics.unify_abstract_ 6.2% 9.0% 1 0.284s
+ │ └unify (constr) (constr) --------- 2.5% 2.5% 1 0.080s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 23.5% 1 0.744s
+ ├─Glue.zrange_to_reflective --------- 0.1% 15.4% 1 0.488s
+ │ ├─Glue.zrange_to_reflective_goal -- 6.8% 11.5% 1 0.364s
+ │ │└pose proof (pf : Interpretat 2.9% 2.9% 1 0.092s
+ │ └─assert (H : is_bounded_by' bounds 3.8% 3.8% 2 0.064s
+ ├─Glue.pattern_sig_sig_assoc -------- 0.0% 4.6% 1 0.144s
+ │└Glue.pattern_proj1_sig_in_sig ----- 1.4% 4.3% 1 0.136s
+ └─Glue.split_BoundedWordToZ --------- 0.1% 2.8% 1 0.088s
+ â””destruct_sig ---------------------- 0.0% 2.4% 4 0.040s
+─synthesize ---------------------------- 0.0% 2.4% 1 0.076s
+
+Finished transaction in 6.12 secs (5.64u,0.008s) (successful)
+Closed under the global context
+total time: 3.164s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 97.6% 1 3.088s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 74.1% 1 2.344s
+─ReflectiveTactics.solve_side_conditions 0.0% 72.9% 1 2.308s
+─ReflectiveTactics.do_reify ------------ 0.0% 38.6% 1 1.220s
+─Reify.Reify_rhs_gen ------------------- 1.5% 37.2% 1 1.176s
+─ReflectiveTactics.solve_post_reified_si 0.9% 34.4% 1 1.088s
+─UnifyAbstractReflexivity.unify_transfor 19.2% 23.9% 7 0.204s
+─Glue.refine_to_reflective_glue' ------- 0.0% 23.5% 1 0.744s
+─Reify.do_reify_abs_goal --------------- 19.2% 19.5% 2 0.616s
+─Reify.do_reifyf_goal ------------------ 18.0% 18.3% 16 0.580s
+─Glue.zrange_to_reflective ------------- 0.1% 15.4% 1 0.488s
+─Glue.zrange_to_reflective_goal -------- 6.8% 11.5% 1 0.364s
+─ReflectiveTactics.unify_abstract_cbv_in 6.2% 9.0% 1 0.284s
+─unify (constr) (constr) --------------- 5.9% 5.9% 6 0.080s
+─Glue.pattern_sig_sig_assoc ------------ 0.0% 4.6% 1 0.144s
+─eexact -------------------------------- 4.4% 4.4% 18 0.012s
+─Glue.pattern_proj1_sig_in_sig --------- 1.4% 4.3% 1 0.136s
+─prove_interp_compile_correct ---------- 0.0% 3.9% 1 0.124s
+─rewrite H ----------------------------- 3.8% 3.8% 1 0.120s
+─assert (H : is_bounded_by' bounds (map' 3.8% 3.8% 2 0.064s
+─rewrite ?EtaInterp.InterpExprEta ------ 3.5% 3.5% 1 0.112s
+─pose proof (pf : Interpretation.Bo 2.9% 2.9% 1 0.092s
+─Glue.split_BoundedWordToZ ------------- 0.1% 2.8% 1 0.088s
+─tac ----------------------------------- 1.9% 2.5% 2 0.080s
+─reflexivity --------------------------- 2.4% 2.4% 7 0.028s
+─synthesize ---------------------------- 0.0% 2.4% 1 0.076s
+─destruct_sig -------------------------- 0.0% 2.4% 4 0.040s
+─destruct x ---------------------------- 2.4% 2.4% 4 0.032s
+─clearbody (ne_var_list) --------------- 2.3% 2.3% 4 0.060s
+─Reify.transitivity_tt ----------------- 0.1% 2.3% 2 0.036s
+─transitivity -------------------------- 2.1% 2.1% 5 0.032s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 97.6% 1 3.088s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 74.1% 1 2.344s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 72.9% 1 2.308s
+ │ ├─ReflectiveTactics.do_reify -------- 0.0% 38.6% 1 1.220s
+ │ │└Reify.Reify_rhs_gen --------------- 1.5% 37.2% 1 1.176s
+ │ │ ├─Reify.do_reify_abs_goal --------- 19.2% 19.5% 2 0.616s
+ │ │ │└Reify.do_reifyf_goal ------------ 18.0% 18.3% 16 0.580s
+ │ │ │└eexact -------------------------- 3.9% 3.9% 16 0.012s
+ │ │ ├─prove_interp_compile_correct ---- 0.0% 3.9% 1 0.124s
+ │ │ │└rewrite ?EtaInterp.InterpExprEta 3.5% 3.5% 1 0.112s
+ │ │ ├─rewrite H ----------------------- 3.8% 3.8% 1 0.120s
+ │ │ ├─tac ----------------------------- 1.9% 2.5% 1 0.080s
+ │ │ └─Reify.transitivity_tt ----------- 0.1% 2.3% 2 0.036s
+ │ │ └transitivity -------------------- 2.0% 2.0% 4 0.032s
+ │ └─ReflectiveTactics.solve_post_reifie 0.9% 34.4% 1 1.088s
+ │ ├─UnifyAbstractReflexivity.unify_tr 19.2% 23.9% 7 0.204s
+ │ │└unify (constr) (constr) --------- 3.4% 3.4% 5 0.036s
+ │ └─ReflectiveTactics.unify_abstract_ 6.2% 9.0% 1 0.284s
+ │ └unify (constr) (constr) --------- 2.5% 2.5% 1 0.080s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 23.5% 1 0.744s
+ ├─Glue.zrange_to_reflective --------- 0.1% 15.4% 1 0.488s
+ │ ├─Glue.zrange_to_reflective_goal -- 6.8% 11.5% 1 0.364s
+ │ │└pose proof (pf : Interpretat 2.9% 2.9% 1 0.092s
+ │ └─assert (H : is_bounded_by' bounds 3.8% 3.8% 2 0.064s
+ ├─Glue.pattern_sig_sig_assoc -------- 0.0% 4.6% 1 0.144s
+ │└Glue.pattern_proj1_sig_in_sig ----- 1.4% 4.3% 1 0.136s
+ └─Glue.split_BoundedWordToZ --------- 0.1% 2.8% 1 0.088s
+ â””destruct_sig ---------------------- 0.0% 2.4% 4 0.040s
+─synthesize ---------------------------- 0.0% 2.4% 1 0.076s
+
+src/Specific/X25519/C64/fesub (real: 24.71, user: 22.65, sys: 0.24, mem: 778792 ko)
+COQC src/Specific/X25519/C64/fesquare.v
+Finished transaction in 6.132 secs (5.516u,0.012s) (successful)
+total time: 5.480s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize ---------------------------- -0.0% 100.0% 1 5.480s
+─Pipeline.refine_reflectively_gen ------ 0.0% 95.7% 1 5.244s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 88.6% 1 4.856s
+─ReflectiveTactics.solve_side_conditions 0.0% 87.7% 1 4.804s
+─ReflectiveTactics.do_reify ------------ 0.0% 53.3% 1 2.920s
+─Reify.Reify_rhs_gen ------------------- 2.0% 52.5% 1 2.876s
+─ReflectiveTactics.solve_post_reified_si 0.6% 34.4% 1 1.884s
+─Reify.do_reify_abs_goal --------------- 33.2% 33.6% 2 1.844s
+─Reify.do_reifyf_goal ------------------ 31.5% 32.0% 47 1.392s
+─UnifyAbstractReflexivity.unify_transfor 21.9% 26.6% 7 0.400s
+─eexact -------------------------------- 10.0% 10.0% 49 0.028s
+─Glue.refine_to_reflective_glue' ------- 0.0% 7.1% 1 0.388s
+─ReflectiveTactics.unify_abstract_cbv_in 5.0% 6.9% 1 0.380s
+─unify (constr) (constr) --------------- 5.8% 5.8% 6 0.104s
+─prove_interp_compile_correct ---------- 0.0% 5.8% 1 0.316s
+─rewrite ?EtaInterp.InterpExprEta ------ 5.3% 5.3% 1 0.288s
+─Glue.zrange_to_reflective ------------- 0.1% 5.1% 1 0.280s
+─IntegrationTestTemporaryMiscCommon.do_r 0.1% 4.0% 1 0.220s
+─Glue.zrange_to_reflective_goal -------- 3.1% 3.9% 1 0.212s
+─change G' ----------------------------- 3.4% 3.4% 1 0.184s
+─tac ----------------------------------- 2.0% 2.8% 2 0.156s
+─rewrite H ----------------------------- 2.8% 2.8% 1 0.156s
+─reflexivity --------------------------- 2.8% 2.8% 7 0.064s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize ---------------------------- -0.0% 100.0% 1 5.480s
+ ├─Pipeline.refine_reflectively_gen ---- 0.0% 95.7% 1 5.244s
+ │ ├─ReflectiveTactics.do_reflective_pip 0.0% 88.6% 1 4.856s
+ │ │└ReflectiveTactics.solve_side_condit 0.0% 87.7% 1 4.804s
+ │ │ ├─ReflectiveTactics.do_reify ------ 0.0% 53.3% 1 2.920s
+ │ │ │└Reify.Reify_rhs_gen ------------- 2.0% 52.5% 1 2.876s
+ │ │ │ ├─Reify.do_reify_abs_goal ------- 33.2% 33.6% 2 1.844s
+ │ │ │ │└Reify.do_reifyf_goal ---------- 31.5% 32.0% 47 1.392s
+ │ │ │ │└eexact ------------------------ 9.1% 9.1% 47 0.024s
+ │ │ │ ├─prove_interp_compile_correct -- 0.0% 5.8% 1 0.316s
+ │ │ │ │└rewrite ?EtaInterp.InterpExprEt 5.3% 5.3% 1 0.288s
+ │ │ │ ├─tac --------------------------- 2.0% 2.8% 1 0.156s
+ │ │ │ └─rewrite H --------------------- 2.8% 2.8% 1 0.156s
+ │ │ └─ReflectiveTactics.solve_post_reif 0.6% 34.4% 1 1.884s
+ │ │ ├─UnifyAbstractReflexivity.unify_ 21.9% 26.6% 7 0.400s
+ │ │ │└unify (constr) (constr) ------- 3.9% 3.9% 5 0.072s
+ │ │ └─ReflectiveTactics.unify_abstrac 5.0% 6.9% 1 0.380s
+ │ └─Glue.refine_to_reflective_glue' --- 0.0% 7.1% 1 0.388s
+ │ └Glue.zrange_to_reflective --------- 0.1% 5.1% 1 0.280s
+ │ └Glue.zrange_to_reflective_goal ---- 3.1% 3.9% 1 0.212s
+ └─IntegrationTestTemporaryMiscCommon.do 0.1% 4.0% 1 0.220s
+ â””change G' --------------------------- 3.4% 3.4% 1 0.184s
+
+Finished transaction in 10.475 secs (9.728u,0.007s) (successful)
+Closed under the global context
+total time: 5.480s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize ---------------------------- -0.0% 100.0% 1 5.480s
+─Pipeline.refine_reflectively_gen ------ 0.0% 95.7% 1 5.244s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 88.6% 1 4.856s
+─ReflectiveTactics.solve_side_conditions 0.0% 87.7% 1 4.804s
+─ReflectiveTactics.do_reify ------------ 0.0% 53.3% 1 2.920s
+─Reify.Reify_rhs_gen ------------------- 2.0% 52.5% 1 2.876s
+─ReflectiveTactics.solve_post_reified_si 0.6% 34.4% 1 1.884s
+─Reify.do_reify_abs_goal --------------- 33.2% 33.6% 2 1.844s
+─Reify.do_reifyf_goal ------------------ 31.5% 32.0% 47 1.392s
+─UnifyAbstractReflexivity.unify_transfor 21.9% 26.6% 7 0.400s
+─eexact -------------------------------- 10.0% 10.0% 49 0.028s
+─Glue.refine_to_reflective_glue' ------- 0.0% 7.1% 1 0.388s
+─ReflectiveTactics.unify_abstract_cbv_in 5.0% 6.9% 1 0.380s
+─unify (constr) (constr) --------------- 5.8% 5.8% 6 0.104s
+─prove_interp_compile_correct ---------- 0.0% 5.8% 1 0.316s
+─rewrite ?EtaInterp.InterpExprEta ------ 5.3% 5.3% 1 0.288s
+─Glue.zrange_to_reflective ------------- 0.1% 5.1% 1 0.280s
+─IntegrationTestTemporaryMiscCommon.do_r 0.1% 4.0% 1 0.220s
+─Glue.zrange_to_reflective_goal -------- 3.1% 3.9% 1 0.212s
+─change G' ----------------------------- 3.4% 3.4% 1 0.184s
+─tac ----------------------------------- 2.0% 2.8% 2 0.156s
+─rewrite H ----------------------------- 2.8% 2.8% 1 0.156s
+─reflexivity --------------------------- 2.8% 2.8% 7 0.064s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize ---------------------------- -0.0% 100.0% 1 5.480s
+ ├─Pipeline.refine_reflectively_gen ---- 0.0% 95.7% 1 5.244s
+ │ ├─ReflectiveTactics.do_reflective_pip 0.0% 88.6% 1 4.856s
+ │ │└ReflectiveTactics.solve_side_condit 0.0% 87.7% 1 4.804s
+ │ │ ├─ReflectiveTactics.do_reify ------ 0.0% 53.3% 1 2.920s
+ │ │ │└Reify.Reify_rhs_gen ------------- 2.0% 52.5% 1 2.876s
+ │ │ │ ├─Reify.do_reify_abs_goal ------- 33.2% 33.6% 2 1.844s
+ │ │ │ │└Reify.do_reifyf_goal ---------- 31.5% 32.0% 47 1.392s
+ │ │ │ │└eexact ------------------------ 9.1% 9.1% 47 0.024s
+ │ │ │ ├─prove_interp_compile_correct -- 0.0% 5.8% 1 0.316s
+ │ │ │ │└rewrite ?EtaInterp.InterpExprEt 5.3% 5.3% 1 0.288s
+ │ │ │ ├─tac --------------------------- 2.0% 2.8% 1 0.156s
+ │ │ │ └─rewrite H --------------------- 2.8% 2.8% 1 0.156s
+ │ │ └─ReflectiveTactics.solve_post_reif 0.6% 34.4% 1 1.884s
+ │ │ ├─UnifyAbstractReflexivity.unify_ 21.9% 26.6% 7 0.400s
+ │ │ │└unify (constr) (constr) ------- 3.9% 3.9% 5 0.072s
+ │ │ └─ReflectiveTactics.unify_abstrac 5.0% 6.9% 1 0.380s
+ │ └─Glue.refine_to_reflective_glue' --- 0.0% 7.1% 1 0.388s
+ │ └Glue.zrange_to_reflective --------- 0.1% 5.1% 1 0.280s
+ │ └Glue.zrange_to_reflective_goal ---- 3.1% 3.9% 1 0.212s
+ └─IntegrationTestTemporaryMiscCommon.do 0.1% 4.0% 1 0.220s
+ â””change G' --------------------------- 3.4% 3.4% 1 0.184s
+
+src/Specific/X25519/C64/fesquare (real: 33.08, user: 30.13, sys: 0.24, mem: 799620 ko)
+COQC src/Specific/X25519/C64/femulDisplay > src/Specific/X25519/C64/femulDisplay.log
+COQC src/Specific/X25519/C64/freeze.v
+Finished transaction in 7.307 secs (6.763u,0.011s) (successful)
+total time: 6.732s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_freeze --------------------- 0.0% 100.0% 1 6.732s
+─Pipeline.refine_reflectively_gen ------ 0.0% 99.3% 1 6.684s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 92.8% 1 6.248s
+─ReflectiveTactics.solve_side_conditions 0.0% 92.0% 1 6.192s
+─ReflectiveTactics.do_reify ------------ -0.0% 60.3% 1 4.060s
+─Reify.Reify_rhs_gen ------------------- 1.5% 59.6% 1 4.012s
+─Reify.do_reify_abs_goal --------------- 42.4% 42.7% 2 2.876s
+─Reify.do_reifyf_goal ------------------ 41.3% 41.7% 129 2.804s
+─ReflectiveTactics.solve_post_reified_si 0.6% 31.7% 1 2.132s
+─UnifyAbstractReflexivity.unify_transfor 21.7% 25.8% 7 0.424s
+─eexact -------------------------------- 13.7% 13.7% 131 0.036s
+─Glue.refine_to_reflective_glue' ------- 0.0% 6.5% 1 0.436s
+─prove_interp_compile_correct ---------- 0.0% 5.1% 1 0.344s
+─ReflectiveTactics.unify_abstract_cbv_in 3.4% 5.0% 1 0.336s
+─rewrite ?EtaInterp.InterpExprEta ------ 4.7% 4.7% 1 0.316s
+─unify (constr) (constr) --------------- 4.6% 4.6% 6 0.100s
+─Glue.zrange_to_reflective ------------- 0.0% 4.2% 1 0.280s
+─Glue.zrange_to_reflective_goal -------- 2.4% 3.3% 1 0.220s
+─Reify.transitivity_tt ----------------- 0.1% 2.6% 2 0.116s
+─rewrite H ----------------------------- 2.6% 2.6% 1 0.172s
+─tac ----------------------------------- 1.5% 2.3% 2 0.156s
+─reflexivity --------------------------- 2.3% 2.3% 7 0.052s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_freeze --------------------- 0.0% 100.0% 1 6.732s
+â””Pipeline.refine_reflectively_gen ------ 0.0% 99.3% 1 6.684s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 92.8% 1 6.248s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 92.0% 1 6.192s
+ │ ├─ReflectiveTactics.do_reify -------- -0.0% 60.3% 1 4.060s
+ │ │└Reify.Reify_rhs_gen --------------- 1.5% 59.6% 1 4.012s
+ │ │ ├─Reify.do_reify_abs_goal --------- 42.4% 42.7% 2 2.876s
+ │ │ │└Reify.do_reifyf_goal ------------ 41.3% 41.7% 129 2.804s
+ │ │ │└eexact -------------------------- 13.0% 13.0% 129 0.036s
+ │ │ ├─prove_interp_compile_correct ---- 0.0% 5.1% 1 0.344s
+ │ │ │└rewrite ?EtaInterp.InterpExprEta 4.7% 4.7% 1 0.316s
+ │ │ ├─Reify.transitivity_tt ----------- 0.1% 2.6% 2 0.116s
+ │ │ ├─rewrite H ----------------------- 2.6% 2.6% 1 0.172s
+ │ │ └─tac ----------------------------- 1.5% 2.3% 1 0.156s
+ │ └─ReflectiveTactics.solve_post_reifie 0.6% 31.7% 1 2.132s
+ │ ├─UnifyAbstractReflexivity.unify_tr 21.7% 25.8% 7 0.424s
+ │ │└unify (constr) (constr) --------- 3.1% 3.1% 5 0.084s
+ │ └─ReflectiveTactics.unify_abstract_ 3.4% 5.0% 1 0.336s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 6.5% 1 0.436s
+ â””Glue.zrange_to_reflective ----------- 0.0% 4.2% 1 0.280s
+ â””Glue.zrange_to_reflective_goal ------ 2.4% 3.3% 1 0.220s
+
+Finished transaction in 10.495 secs (9.756u,0.s) (successful)
+Closed under the global context
+total time: 6.732s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_freeze --------------------- 0.0% 100.0% 1 6.732s
+─Pipeline.refine_reflectively_gen ------ 0.0% 99.3% 1 6.684s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 92.8% 1 6.248s
+─ReflectiveTactics.solve_side_conditions 0.0% 92.0% 1 6.192s
+─ReflectiveTactics.do_reify ------------ -0.0% 60.3% 1 4.060s
+─Reify.Reify_rhs_gen ------------------- 1.5% 59.6% 1 4.012s
+─Reify.do_reify_abs_goal --------------- 42.4% 42.7% 2 2.876s
+─Reify.do_reifyf_goal ------------------ 41.3% 41.7% 129 2.804s
+─ReflectiveTactics.solve_post_reified_si 0.6% 31.7% 1 2.132s
+─UnifyAbstractReflexivity.unify_transfor 21.7% 25.8% 7 0.424s
+─eexact -------------------------------- 13.7% 13.7% 131 0.036s
+─Glue.refine_to_reflective_glue' ------- 0.0% 6.5% 1 0.436s
+─prove_interp_compile_correct ---------- 0.0% 5.1% 1 0.344s
+─ReflectiveTactics.unify_abstract_cbv_in 3.4% 5.0% 1 0.336s
+─rewrite ?EtaInterp.InterpExprEta ------ 4.7% 4.7% 1 0.316s
+─unify (constr) (constr) --------------- 4.6% 4.6% 6 0.100s
+─Glue.zrange_to_reflective ------------- 0.0% 4.2% 1 0.280s
+─Glue.zrange_to_reflective_goal -------- 2.4% 3.3% 1 0.220s
+─Reify.transitivity_tt ----------------- 0.1% 2.6% 2 0.116s
+─rewrite H ----------------------------- 2.6% 2.6% 1 0.172s
+─tac ----------------------------------- 1.5% 2.3% 2 0.156s
+─reflexivity --------------------------- 2.3% 2.3% 7 0.052s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_freeze --------------------- 0.0% 100.0% 1 6.732s
+â””Pipeline.refine_reflectively_gen ------ 0.0% 99.3% 1 6.684s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 92.8% 1 6.248s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 92.0% 1 6.192s
+ │ ├─ReflectiveTactics.do_reify -------- -0.0% 60.3% 1 4.060s
+ │ │└Reify.Reify_rhs_gen --------------- 1.5% 59.6% 1 4.012s
+ │ │ ├─Reify.do_reify_abs_goal --------- 42.4% 42.7% 2 2.876s
+ │ │ │└Reify.do_reifyf_goal ------------ 41.3% 41.7% 129 2.804s
+ │ │ │└eexact -------------------------- 13.0% 13.0% 129 0.036s
+ │ │ ├─prove_interp_compile_correct ---- 0.0% 5.1% 1 0.344s
+ │ │ │└rewrite ?EtaInterp.InterpExprEta 4.7% 4.7% 1 0.316s
+ │ │ ├─Reify.transitivity_tt ----------- 0.1% 2.6% 2 0.116s
+ │ │ ├─rewrite H ----------------------- 2.6% 2.6% 1 0.172s
+ │ │ └─tac ----------------------------- 1.5% 2.3% 1 0.156s
+ │ └─ReflectiveTactics.solve_post_reifie 0.6% 31.7% 1 2.132s
+ │ ├─UnifyAbstractReflexivity.unify_tr 21.7% 25.8% 7 0.424s
+ │ │└unify (constr) (constr) --------- 3.1% 3.1% 5 0.084s
+ │ └─ReflectiveTactics.unify_abstract_ 3.4% 5.0% 1 0.336s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 6.5% 1 0.436s
+ â””Glue.zrange_to_reflective ----------- 0.0% 4.2% 1 0.280s
+ â””Glue.zrange_to_reflective_goal ------ 2.4% 3.3% 1 0.220s
+
+src/Specific/X25519/C64/freeze (real: 34.35, user: 31.50, sys: 0.24, mem: 828104 ko)
+COQC src/Specific/NISTP256/AMD64/feadd.v
+Finished transaction in 8.784 secs (8.176u,0.011s) (successful)
+total time: 8.140s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 52.4% 1 4.268s
+─synthesize_montgomery ----------------- 0.0% 47.6% 1 3.872s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 43.8% 1 3.568s
+─ReflectiveTactics.solve_side_conditions 0.0% 43.2% 1 3.520s
+─IntegrationTestTemporaryMiscCommon.fact 1.4% 23.6% 1 1.924s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 22.1% 1 1.796s
+─ReflectiveTactics.do_reify ------------ 0.1% 21.7% 1 1.768s
+─ReflectiveTactics.solve_post_reified_si 0.6% 21.5% 1 1.752s
+─Reify.Reify_rhs_gen ------------------- 1.0% 20.9% 1 1.704s
+─op_sig_side_conditions_t -------------- 0.0% 20.0% 1 1.624s
+─DestructHyps.do_all_matches_then ------ 0.0% 20.0% 8 0.244s
+─DestructHyps.do_one_match_then -------- 0.7% 19.9% 44 0.052s
+─do_tac -------------------------------- 0.0% 19.2% 36 0.052s
+─destruct H ---------------------------- 19.2% 19.2% 36 0.052s
+─rewrite <- (lem : lemT) by by_tac ltac: 0.2% 17.3% 1 1.408s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 17.3% 1 1.408s
+─by_tac -------------------------------- 0.0% 17.1% 4 0.504s
+─rewrite <- (ZRange.is_bounded_by_None_r 16.7% 16.7% 8 0.344s
+─UnifyAbstractReflexivity.unify_transfor 13.3% 16.1% 7 0.360s
+─Reify.do_reify_abs_goal --------------- 9.9% 10.1% 2 0.820s
+─Reify.do_reifyf_goal ------------------ 9.1% 9.3% 93 0.748s
+─Glue.refine_to_reflective_glue' ------- 0.0% 8.6% 1 0.700s
+─Glue.zrange_to_reflective ------------- 0.0% 5.3% 1 0.432s
+─IntegrationTestTemporaryMiscCommon.do_s 0.0% 4.8% 1 0.388s
+─<Crypto.Util.Tactics.MoveLetIn.with_uco 0.9% 4.6% 3 0.368s
+─ReflectiveTactics.unify_abstract_cbv_in 3.3% 4.5% 1 0.368s
+─Glue.zrange_to_reflective_goal -------- 2.6% 4.0% 1 0.324s
+─k ------------------------------------- 3.5% 3.6% 1 0.296s
+─unify (constr) (constr) --------------- 3.3% 3.3% 8 0.092s
+─rewrite H ----------------------------- 2.6% 2.6% 2 0.196s
+─eexact -------------------------------- 2.6% 2.6% 95 0.024s
+─prove_interp_compile_correct ---------- 0.0% 2.5% 1 0.204s
+─apply (fun f => MapProjections.proj2 2.4% 2.4% 2 0.120s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 52.4% 1 4.268s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 43.8% 1 3.568s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 43.2% 1 3.520s
+ │ ├─ReflectiveTactics.do_reify -------- 0.1% 21.7% 1 1.768s
+ │ │└Reify.Reify_rhs_gen --------------- 1.0% 20.9% 1 1.704s
+ │ │ ├─Reify.do_reify_abs_goal --------- 9.9% 10.1% 2 0.820s
+ │ │ │└Reify.do_reifyf_goal ------------ 9.1% 9.3% 93 0.748s
+ │ │ │└eexact -------------------------- 2.3% 2.3% 93 0.024s
+ │ │ ├─prove_interp_compile_correct ---- 0.0% 2.5% 1 0.204s
+ │ │ └─rewrite H ----------------------- 2.4% 2.4% 1 0.196s
+ │ └─ReflectiveTactics.solve_post_reifie 0.6% 21.5% 1 1.752s
+ │ ├─UnifyAbstractReflexivity.unify_tr 13.3% 16.1% 7 0.360s
+ │ │└unify (constr) (constr) --------- 2.2% 2.2% 5 0.064s
+ │ └─ReflectiveTactics.unify_abstract_ 3.3% 4.5% 1 0.368s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 8.6% 1 0.700s
+ â””Glue.zrange_to_reflective ----------- 0.0% 5.3% 1 0.432s
+ â””Glue.zrange_to_reflective_goal ------ 2.6% 4.0% 1 0.324s
+─synthesize_montgomery ----------------- 0.0% 47.6% 1 3.872s
+ ├─IntegrationTestTemporaryMiscCommon.fa 1.4% 23.6% 1 1.924s
+ │└op_sig_side_conditions_t ------------ 0.0% 20.0% 1 1.624s
+ │ ├─DestructHyps.do_all_matches_then -- 0.0% 11.4% 4 0.244s
+ │ │└DestructHyps.do_one_match_then ---- 0.3% 11.4% 24 0.052s
+ │ │└do_tac ---------------------------- 0.0% 11.1% 20 0.052s
+ │ │└destruct H ------------------------ 11.1% 11.1% 20 0.052s
+ │ └─rewrite <- (ZRange.is_bounded_by_No 8.4% 8.4% 4 0.328s
+ └─IntegrationTestTemporaryMiscCommon.do 0.0% 22.1% 1 1.796s
+ ├─IntegrationTestTemporaryMiscCommon. 0.0% 17.3% 1 1.408s
+ │└rewrite <- (lem : lemT) by by_tac l 0.2% 17.3% 1 1.408s
+ │└by_tac ---------------------------- 0.0% 17.1% 4 0.504s
+ │ ├─DestructHyps.do_all_matches_then 0.0% 8.6% 4 0.184s
+ │ │└DestructHyps.do_one_match_then -- 0.3% 8.5% 20 0.052s
+ │ │└do_tac -------------------------- 0.0% 8.2% 16 0.052s
+ │ │└destruct H ---------------------- 8.2% 8.2% 16 0.052s
+ │ └─rewrite <- (ZRange.is_bounded_by_ 8.3% 8.3% 4 0.344s
+ └─IntegrationTestTemporaryMiscCommon. 0.0% 4.8% 1 0.388s
+ â””<Crypto.Util.Tactics.MoveLetIn.with 0.9% 4.6% 3 0.368s
+ â””k --------------------------------- 3.5% 3.6% 1 0.296s
+
+Finished transaction in 13.363 secs (12.516u,0.008s) (successful)
+Closed under the global context
+total time: 8.140s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 52.4% 1 4.268s
+─synthesize_montgomery ----------------- 0.0% 47.6% 1 3.872s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 43.8% 1 3.568s
+─ReflectiveTactics.solve_side_conditions 0.0% 43.2% 1 3.520s
+─IntegrationTestTemporaryMiscCommon.fact 1.4% 23.6% 1 1.924s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 22.1% 1 1.796s
+─ReflectiveTactics.do_reify ------------ 0.1% 21.7% 1 1.768s
+─ReflectiveTactics.solve_post_reified_si 0.6% 21.5% 1 1.752s
+─Reify.Reify_rhs_gen ------------------- 1.0% 20.9% 1 1.704s
+─op_sig_side_conditions_t -------------- 0.0% 20.0% 1 1.624s
+─DestructHyps.do_all_matches_then ------ 0.0% 20.0% 8 0.244s
+─DestructHyps.do_one_match_then -------- 0.7% 19.9% 44 0.052s
+─do_tac -------------------------------- 0.0% 19.2% 36 0.052s
+─destruct H ---------------------------- 19.2% 19.2% 36 0.052s
+─rewrite <- (lem : lemT) by by_tac ltac: 0.2% 17.3% 1 1.408s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 17.3% 1 1.408s
+─by_tac -------------------------------- 0.0% 17.1% 4 0.504s
+─rewrite <- (ZRange.is_bounded_by_None_r 16.7% 16.7% 8 0.344s
+─UnifyAbstractReflexivity.unify_transfor 13.3% 16.1% 7 0.360s
+─Reify.do_reify_abs_goal --------------- 9.9% 10.1% 2 0.820s
+─Reify.do_reifyf_goal ------------------ 9.1% 9.3% 93 0.748s
+─Glue.refine_to_reflective_glue' ------- 0.0% 8.6% 1 0.700s
+─Glue.zrange_to_reflective ------------- 0.0% 5.3% 1 0.432s
+─IntegrationTestTemporaryMiscCommon.do_s 0.0% 4.8% 1 0.388s
+─<Crypto.Util.Tactics.MoveLetIn.with_uco 0.9% 4.6% 3 0.368s
+─ReflectiveTactics.unify_abstract_cbv_in 3.3% 4.5% 1 0.368s
+─Glue.zrange_to_reflective_goal -------- 2.6% 4.0% 1 0.324s
+─k ------------------------------------- 3.5% 3.6% 1 0.296s
+─unify (constr) (constr) --------------- 3.3% 3.3% 8 0.092s
+─rewrite H ----------------------------- 2.6% 2.6% 2 0.196s
+─eexact -------------------------------- 2.6% 2.6% 95 0.024s
+─prove_interp_compile_correct ---------- 0.0% 2.5% 1 0.204s
+─apply (fun f => MapProjections.proj2 2.4% 2.4% 2 0.120s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 52.4% 1 4.268s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 43.8% 1 3.568s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 43.2% 1 3.520s
+ │ ├─ReflectiveTactics.do_reify -------- 0.1% 21.7% 1 1.768s
+ │ │└Reify.Reify_rhs_gen --------------- 1.0% 20.9% 1 1.704s
+ │ │ ├─Reify.do_reify_abs_goal --------- 9.9% 10.1% 2 0.820s
+ │ │ │└Reify.do_reifyf_goal ------------ 9.1% 9.3% 93 0.748s
+ │ │ │└eexact -------------------------- 2.3% 2.3% 93 0.024s
+ │ │ ├─prove_interp_compile_correct ---- 0.0% 2.5% 1 0.204s
+ │ │ └─rewrite H ----------------------- 2.4% 2.4% 1 0.196s
+ │ └─ReflectiveTactics.solve_post_reifie 0.6% 21.5% 1 1.752s
+ │ ├─UnifyAbstractReflexivity.unify_tr 13.3% 16.1% 7 0.360s
+ │ │└unify (constr) (constr) --------- 2.2% 2.2% 5 0.064s
+ │ └─ReflectiveTactics.unify_abstract_ 3.3% 4.5% 1 0.368s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 8.6% 1 0.700s
+ â””Glue.zrange_to_reflective ----------- 0.0% 5.3% 1 0.432s
+ â””Glue.zrange_to_reflective_goal ------ 2.6% 4.0% 1 0.324s
+─synthesize_montgomery ----------------- 0.0% 47.6% 1 3.872s
+ ├─IntegrationTestTemporaryMiscCommon.fa 1.4% 23.6% 1 1.924s
+ │└op_sig_side_conditions_t ------------ 0.0% 20.0% 1 1.624s
+ │ ├─DestructHyps.do_all_matches_then -- 0.0% 11.4% 4 0.244s
+ │ │└DestructHyps.do_one_match_then ---- 0.3% 11.4% 24 0.052s
+ │ │└do_tac ---------------------------- 0.0% 11.1% 20 0.052s
+ │ │└destruct H ------------------------ 11.1% 11.1% 20 0.052s
+ │ └─rewrite <- (ZRange.is_bounded_by_No 8.4% 8.4% 4 0.328s
+ └─IntegrationTestTemporaryMiscCommon.do 0.0% 22.1% 1 1.796s
+ ├─IntegrationTestTemporaryMiscCommon. 0.0% 17.3% 1 1.408s
+ │└rewrite <- (lem : lemT) by by_tac l 0.2% 17.3% 1 1.408s
+ │└by_tac ---------------------------- 0.0% 17.1% 4 0.504s
+ │ ├─DestructHyps.do_all_matches_then 0.0% 8.6% 4 0.184s
+ │ │└DestructHyps.do_one_match_then -- 0.3% 8.5% 20 0.052s
+ │ │└do_tac -------------------------- 0.0% 8.2% 16 0.052s
+ │ │└destruct H ---------------------- 8.2% 8.2% 16 0.052s
+ │ └─rewrite <- (ZRange.is_bounded_by_ 8.3% 8.3% 4 0.344s
+ └─IntegrationTestTemporaryMiscCommon. 0.0% 4.8% 1 0.388s
+ â””<Crypto.Util.Tactics.MoveLetIn.with 0.9% 4.6% 3 0.368s
+ â””k --------------------------------- 3.5% 3.6% 1 0.296s
+
+src/Specific/NISTP256/AMD64/feadd (real: 38.19, user: 35.40, sys: 0.30, mem: 799216 ko)
+COQC src/Specific/NISTP256/AMD64/fenz.v
+Finished transaction in 6.356 secs (5.82u,0.004s) (successful)
+total time: 5.800s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_nonzero -------------------- 0.0% 100.0% 1 5.800s
+─IntegrationTestTemporaryMiscCommon.nonz 0.2% 85.5% 1 4.960s
+─destruct (Decidable.dec x), (Decidable. 37.4% 37.4% 1 2.168s
+─destruct (Decidable.dec x) as [H| H] -- 22.0% 22.0% 1 1.276s
+─Pipeline.refine_reflectively_gen ------ 0.0% 14.5% 1 0.840s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 10.9% 1 0.632s
+─ReflectiveTactics.solve_side_conditions 0.0% 10.6% 1 0.612s
+─ReflectiveTactics.solve_post_reified_si 0.3% 8.5% 1 0.492s
+─IntegrationTestTemporaryMiscCommon.op_s 0.1% 8.1% 2 0.368s
+─rewrite <- (ZRange.is_bounded_by_None_r 5.2% 5.2% 2 0.288s
+─UnifyAbstractReflexivity.unify_transfor 3.4% 4.3% 7 0.076s
+─ReflectiveTactics.unify_abstract_cbv_in 2.8% 3.8% 1 0.220s
+─Glue.refine_to_reflective_glue' ------- 0.1% 3.6% 1 0.208s
+─rewrite H' ---------------------------- 3.4% 3.4% 1 0.200s
+─generalize dependent (constr) --------- 3.0% 3.0% 4 0.060s
+─congruence ---------------------------- 2.8% 2.8% 1 0.160s
+─do_tac -------------------------------- 0.0% 2.6% 4 0.044s
+─destruct H ---------------------------- 2.6% 2.6% 4 0.044s
+─IntegrationTestTemporaryMiscCommon.do_s 0.1% 2.6% 1 0.152s
+─DestructHyps.do_one_match_then -------- 0.0% 2.6% 6 0.044s
+─DestructHyps.do_all_matches_then ------ 0.0% 2.6% 2 0.076s
+─<Crypto.Util.Tactics.MoveLetIn.with_uco 0.4% 2.5% 3 0.140s
+─Glue.zrange_to_reflective ------------- 0.0% 2.2% 1 0.128s
+─rewrite H ----------------------------- 1.9% 2.1% 3 0.112s
+─ReflectiveTactics.do_reify ------------ 0.0% 2.1% 1 0.120s
+─k ------------------------------------- 1.9% 2.0% 1 0.116s
+─Reify.Reify_rhs_gen ------------------- 0.1% 2.0% 1 0.116s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_nonzero -------------------- 0.0% 100.0% 1 5.800s
+ ├─IntegrationTestTemporaryMiscCommon.no 0.2% 85.5% 1 4.960s
+ │ ├─destruct (Decidable.dec x), (Decida 37.4% 37.4% 1 2.168s
+ │ ├─destruct (Decidable.dec x) as [H| H 22.0% 22.0% 1 1.276s
+ │ ├─IntegrationTestTemporaryMiscCommon. 0.1% 8.1% 2 0.368s
+ │ │ ├─rewrite <- (ZRange.is_bounded_by_ 5.2% 5.2% 2 0.288s
+ │ │ └─DestructHyps.do_all_matches_then 0.0% 2.6% 2 0.076s
+ │ │ └DestructHyps.do_one_match_then -- 0.0% 2.6% 6 0.044s
+ │ │ └do_tac -------------------------- 0.0% 2.6% 4 0.044s
+ │ │ └destruct H ---------------------- 2.6% 2.6% 4 0.044s
+ │ ├─rewrite H' ------------------------ 3.4% 3.4% 1 0.200s
+ │ ├─generalize dependent (constr) ----- 3.0% 3.0% 4 0.060s
+ │ ├─congruence ------------------------ 2.8% 2.8% 1 0.160s
+ │ ├─IntegrationTestTemporaryMiscCommon. 0.1% 2.6% 1 0.152s
+ │ │└<Crypto.Util.Tactics.MoveLetIn.with 0.4% 2.5% 3 0.140s
+ │ │└k --------------------------------- 1.9% 2.0% 1 0.116s
+ │ └─rewrite H ------------------------- 1.7% 2.0% 2 0.112s
+ └─Pipeline.refine_reflectively_gen ---- 0.0% 14.5% 1 0.840s
+ ├─ReflectiveTactics.do_reflective_pip 0.0% 10.9% 1 0.632s
+ │└ReflectiveTactics.solve_side_condit 0.0% 10.6% 1 0.612s
+ │ ├─ReflectiveTactics.solve_post_reif 0.3% 8.5% 1 0.492s
+ │ │ ├─UnifyAbstractReflexivity.unify_ 3.4% 4.3% 7 0.076s
+ │ │ └─ReflectiveTactics.unify_abstrac 2.8% 3.8% 1 0.220s
+ │ └─ReflectiveTactics.do_reify ------ 0.0% 2.1% 1 0.120s
+ │ └Reify.Reify_rhs_gen ------------- 0.1% 2.0% 1 0.116s
+ └─Glue.refine_to_reflective_glue' --- 0.1% 3.6% 1 0.208s
+ â””Glue.zrange_to_reflective --------- 0.0% 2.2% 1 0.128s
+
+Finished transaction in 6.657 secs (6.299u,0.s) (successful)
+Closed under the global context
+total time: 5.800s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_nonzero -------------------- 0.0% 100.0% 1 5.800s
+─IntegrationTestTemporaryMiscCommon.nonz 0.2% 85.5% 1 4.960s
+─destruct (Decidable.dec x), (Decidable. 37.4% 37.4% 1 2.168s
+─destruct (Decidable.dec x) as [H| H] -- 22.0% 22.0% 1 1.276s
+─Pipeline.refine_reflectively_gen ------ 0.0% 14.5% 1 0.840s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 10.9% 1 0.632s
+─ReflectiveTactics.solve_side_conditions 0.0% 10.6% 1 0.612s
+─ReflectiveTactics.solve_post_reified_si 0.3% 8.5% 1 0.492s
+─IntegrationTestTemporaryMiscCommon.op_s 0.1% 8.1% 2 0.368s
+─rewrite <- (ZRange.is_bounded_by_None_r 5.2% 5.2% 2 0.288s
+─UnifyAbstractReflexivity.unify_transfor 3.4% 4.3% 7 0.076s
+─ReflectiveTactics.unify_abstract_cbv_in 2.8% 3.8% 1 0.220s
+─Glue.refine_to_reflective_glue' ------- 0.1% 3.6% 1 0.208s
+─rewrite H' ---------------------------- 3.4% 3.4% 1 0.200s
+─generalize dependent (constr) --------- 3.0% 3.0% 4 0.060s
+─congruence ---------------------------- 2.8% 2.8% 1 0.160s
+─do_tac -------------------------------- 0.0% 2.6% 4 0.044s
+─destruct H ---------------------------- 2.6% 2.6% 4 0.044s
+─IntegrationTestTemporaryMiscCommon.do_s 0.1% 2.6% 1 0.152s
+─DestructHyps.do_one_match_then -------- 0.0% 2.6% 6 0.044s
+─DestructHyps.do_all_matches_then ------ 0.0% 2.6% 2 0.076s
+─<Crypto.Util.Tactics.MoveLetIn.with_uco 0.4% 2.5% 3 0.140s
+─Glue.zrange_to_reflective ------------- 0.0% 2.2% 1 0.128s
+─rewrite H ----------------------------- 1.9% 2.1% 3 0.112s
+─ReflectiveTactics.do_reify ------------ 0.0% 2.1% 1 0.120s
+─k ------------------------------------- 1.9% 2.0% 1 0.116s
+─Reify.Reify_rhs_gen ------------------- 0.1% 2.0% 1 0.116s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_nonzero -------------------- 0.0% 100.0% 1 5.800s
+ ├─IntegrationTestTemporaryMiscCommon.no 0.2% 85.5% 1 4.960s
+ │ ├─destruct (Decidable.dec x), (Decida 37.4% 37.4% 1 2.168s
+ │ ├─destruct (Decidable.dec x) as [H| H 22.0% 22.0% 1 1.276s
+ │ ├─IntegrationTestTemporaryMiscCommon. 0.1% 8.1% 2 0.368s
+ │ │ ├─rewrite <- (ZRange.is_bounded_by_ 5.2% 5.2% 2 0.288s
+ │ │ └─DestructHyps.do_all_matches_then 0.0% 2.6% 2 0.076s
+ │ │ └DestructHyps.do_one_match_then -- 0.0% 2.6% 6 0.044s
+ │ │ └do_tac -------------------------- 0.0% 2.6% 4 0.044s
+ │ │ └destruct H ---------------------- 2.6% 2.6% 4 0.044s
+ │ ├─rewrite H' ------------------------ 3.4% 3.4% 1 0.200s
+ │ ├─generalize dependent (constr) ----- 3.0% 3.0% 4 0.060s
+ │ ├─congruence ------------------------ 2.8% 2.8% 1 0.160s
+ │ ├─IntegrationTestTemporaryMiscCommon. 0.1% 2.6% 1 0.152s
+ │ │└<Crypto.Util.Tactics.MoveLetIn.with 0.4% 2.5% 3 0.140s
+ │ │└k --------------------------------- 1.9% 2.0% 1 0.116s
+ │ └─rewrite H ------------------------- 1.7% 2.0% 2 0.112s
+ └─Pipeline.refine_reflectively_gen ---- 0.0% 14.5% 1 0.840s
+ ├─ReflectiveTactics.do_reflective_pip 0.0% 10.9% 1 0.632s
+ │└ReflectiveTactics.solve_side_condit 0.0% 10.6% 1 0.612s
+ │ ├─ReflectiveTactics.solve_post_reif 0.3% 8.5% 1 0.492s
+ │ │ ├─UnifyAbstractReflexivity.unify_ 3.4% 4.3% 7 0.076s
+ │ │ └─ReflectiveTactics.unify_abstrac 2.8% 3.8% 1 0.220s
+ │ └─ReflectiveTactics.do_reify ------ 0.0% 2.1% 1 0.120s
+ │ └Reify.Reify_rhs_gen ------------- 0.1% 2.0% 1 0.116s
+ └─Glue.refine_to_reflective_glue' --- 0.1% 3.6% 1 0.208s
+ â””Glue.zrange_to_reflective --------- 0.0% 2.2% 1 0.128s
+
+src/Specific/NISTP256/AMD64/fenz (real: 27.81, user: 25.50, sys: 0.22, mem: 756080 ko)
+COQC src/Specific/NISTP256/AMD64/feopp.v
+Finished transaction in 7.73 secs (7.112u,0.008s) (successful)
+total time: 7.072s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_montgomery ----------------- 0.0% 62.5% 1 4.420s
+─IntegrationTestTemporaryMiscCommon.fact 18.7% 51.6% 1 3.648s
+─Pipeline.refine_reflectively_gen ------ 0.0% 37.5% 1 2.652s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 32.6% 1 2.308s
+─ReflectiveTactics.solve_side_conditions 0.0% 32.2% 1 2.276s
+─reflexivity --------------------------- 24.8% 24.8% 8 1.700s
+─ReflectiveTactics.solve_post_reified_si 0.5% 18.5% 1 1.308s
+─ReflectiveTactics.do_reify ------------ 0.0% 13.7% 1 0.968s
+─UnifyAbstractReflexivity.unify_transfor 11.2% 13.6% 7 0.284s
+─Reify.Reify_rhs_gen ------------------- 0.6% 13.4% 1 0.948s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 9.7% 1 0.684s
+─rewrite <- (ZRange.is_bounded_by_None_r 9.0% 9.0% 4 0.328s
+─op_sig_side_conditions_t -------------- 0.0% 7.8% 1 0.552s
+─rewrite <- (lem : lemT) by by_tac ltac: 0.1% 7.4% 1 0.520s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 7.4% 1 0.520s
+─by_tac -------------------------------- 0.0% 7.2% 2 0.404s
+─Reify.do_reify_abs_goal --------------- 7.1% 7.2% 2 0.512s
+─Reify.do_reifyf_goal ------------------ 6.6% 6.7% 62 0.472s
+─DestructHyps.do_one_match_then -------- 0.2% 5.8% 14 0.048s
+─DestructHyps.do_all_matches_then ------ 0.0% 5.8% 4 0.124s
+─do_tac -------------------------------- 0.0% 5.6% 10 0.048s
+─destruct H ---------------------------- 5.6% 5.6% 10 0.048s
+─Glue.refine_to_reflective_glue' ------- 0.0% 4.9% 1 0.344s
+─ReflectiveTactics.unify_abstract_cbv_in 2.9% 4.2% 1 0.300s
+─Glue.zrange_to_reflective ------------- 0.0% 3.3% 1 0.232s
+─unify (constr) (constr) --------------- 3.2% 3.2% 7 0.088s
+─Glue.zrange_to_reflective_goal -------- 1.9% 2.6% 1 0.184s
+─IntegrationTestTemporaryMiscCommon.do_s 0.0% 2.3% 1 0.164s
+─<Crypto.Util.Tactics.MoveLetIn.with_uco 0.4% 2.2% 3 0.152s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_montgomery ----------------- 0.0% 62.5% 1 4.420s
+ ├─IntegrationTestTemporaryMiscCommon.fa 18.7% 51.6% 1 3.648s
+ │ ├─reflexivity ----------------------- 24.0% 24.0% 1 1.700s
+ │ └─op_sig_side_conditions_t ---------- 0.0% 7.8% 1 0.552s
+ │ ├─rewrite <- (ZRange.is_bounded_by_ 4.2% 4.2% 2 0.284s
+ │ └─DestructHyps.do_all_matches_then 0.0% 3.5% 2 0.124s
+ │ └DestructHyps.do_one_match_then -- 0.2% 3.5% 8 0.044s
+ │ └do_tac -------------------------- 0.0% 3.3% 6 0.040s
+ │ └destruct H ---------------------- 3.3% 3.3% 6 0.040s
+ └─IntegrationTestTemporaryMiscCommon.do 0.0% 9.7% 1 0.684s
+ ├─IntegrationTestTemporaryMiscCommon. 0.0% 7.4% 1 0.520s
+ │└rewrite <- (lem : lemT) by by_tac l 0.1% 7.4% 1 0.520s
+ │└by_tac ---------------------------- 0.0% 7.2% 2 0.404s
+ │ ├─rewrite <- (ZRange.is_bounded_by_ 4.8% 4.8% 2 0.328s
+ │ └─DestructHyps.do_all_matches_then 0.0% 2.3% 2 0.088s
+ │ └DestructHyps.do_one_match_then -- 0.0% 2.3% 6 0.048s
+ │ └do_tac -------------------------- 0.0% 2.3% 4 0.048s
+ │ └destruct H ---------------------- 2.3% 2.3% 4 0.048s
+ └─IntegrationTestTemporaryMiscCommon. 0.0% 2.3% 1 0.164s
+ â””<Crypto.Util.Tactics.MoveLetIn.with 0.4% 2.2% 3 0.152s
+─Pipeline.refine_reflectively_gen ------ 0.0% 37.5% 1 2.652s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 32.6% 1 2.308s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 32.2% 1 2.276s
+ │ ├─ReflectiveTactics.solve_post_reifie 0.5% 18.5% 1 1.308s
+ │ │ ├─UnifyAbstractReflexivity.unify_tr 11.2% 13.6% 7 0.284s
+ │ │ └─ReflectiveTactics.unify_abstract_ 2.9% 4.2% 1 0.300s
+ │ └─ReflectiveTactics.do_reify -------- 0.0% 13.7% 1 0.968s
+ │ └Reify.Reify_rhs_gen --------------- 0.6% 13.4% 1 0.948s
+ │ └Reify.do_reify_abs_goal ----------- 7.1% 7.2% 2 0.512s
+ │ └Reify.do_reifyf_goal -------------- 6.6% 6.7% 62 0.472s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 4.9% 1 0.344s
+ â””Glue.zrange_to_reflective ----------- 0.0% 3.3% 1 0.232s
+ â””Glue.zrange_to_reflective_goal ------ 1.9% 2.6% 1 0.184s
+
+Finished transaction in 7.732 secs (7.1u,0.003s) (successful)
+Closed under the global context
+total time: 7.072s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_montgomery ----------------- 0.0% 62.5% 1 4.420s
+─IntegrationTestTemporaryMiscCommon.fact 18.7% 51.6% 1 3.648s
+─Pipeline.refine_reflectively_gen ------ 0.0% 37.5% 1 2.652s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 32.6% 1 2.308s
+─ReflectiveTactics.solve_side_conditions 0.0% 32.2% 1 2.276s
+─reflexivity --------------------------- 24.8% 24.8% 8 1.700s
+─ReflectiveTactics.solve_post_reified_si 0.5% 18.5% 1 1.308s
+─ReflectiveTactics.do_reify ------------ 0.0% 13.7% 1 0.968s
+─UnifyAbstractReflexivity.unify_transfor 11.2% 13.6% 7 0.284s
+─Reify.Reify_rhs_gen ------------------- 0.6% 13.4% 1 0.948s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 9.7% 1 0.684s
+─rewrite <- (ZRange.is_bounded_by_None_r 9.0% 9.0% 4 0.328s
+─op_sig_side_conditions_t -------------- 0.0% 7.8% 1 0.552s
+─rewrite <- (lem : lemT) by by_tac ltac: 0.1% 7.4% 1 0.520s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 7.4% 1 0.520s
+─by_tac -------------------------------- 0.0% 7.2% 2 0.404s
+─Reify.do_reify_abs_goal --------------- 7.1% 7.2% 2 0.512s
+─Reify.do_reifyf_goal ------------------ 6.6% 6.7% 62 0.472s
+─DestructHyps.do_one_match_then -------- 0.2% 5.8% 14 0.048s
+─DestructHyps.do_all_matches_then ------ 0.0% 5.8% 4 0.124s
+─do_tac -------------------------------- 0.0% 5.6% 10 0.048s
+─destruct H ---------------------------- 5.6% 5.6% 10 0.048s
+─Glue.refine_to_reflective_glue' ------- 0.0% 4.9% 1 0.344s
+─ReflectiveTactics.unify_abstract_cbv_in 2.9% 4.2% 1 0.300s
+─Glue.zrange_to_reflective ------------- 0.0% 3.3% 1 0.232s
+─unify (constr) (constr) --------------- 3.2% 3.2% 7 0.088s
+─Glue.zrange_to_reflective_goal -------- 1.9% 2.6% 1 0.184s
+─IntegrationTestTemporaryMiscCommon.do_s 0.0% 2.3% 1 0.164s
+─<Crypto.Util.Tactics.MoveLetIn.with_uco 0.4% 2.2% 3 0.152s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_montgomery ----------------- 0.0% 62.5% 1 4.420s
+ ├─IntegrationTestTemporaryMiscCommon.fa 18.7% 51.6% 1 3.648s
+ │ ├─reflexivity ----------------------- 24.0% 24.0% 1 1.700s
+ │ └─op_sig_side_conditions_t ---------- 0.0% 7.8% 1 0.552s
+ │ ├─rewrite <- (ZRange.is_bounded_by_ 4.2% 4.2% 2 0.284s
+ │ └─DestructHyps.do_all_matches_then 0.0% 3.5% 2 0.124s
+ │ └DestructHyps.do_one_match_then -- 0.2% 3.5% 8 0.044s
+ │ └do_tac -------------------------- 0.0% 3.3% 6 0.040s
+ │ └destruct H ---------------------- 3.3% 3.3% 6 0.040s
+ └─IntegrationTestTemporaryMiscCommon.do 0.0% 9.7% 1 0.684s
+ ├─IntegrationTestTemporaryMiscCommon. 0.0% 7.4% 1 0.520s
+ │└rewrite <- (lem : lemT) by by_tac l 0.1% 7.4% 1 0.520s
+ │└by_tac ---------------------------- 0.0% 7.2% 2 0.404s
+ │ ├─rewrite <- (ZRange.is_bounded_by_ 4.8% 4.8% 2 0.328s
+ │ └─DestructHyps.do_all_matches_then 0.0% 2.3% 2 0.088s
+ │ └DestructHyps.do_one_match_then -- 0.0% 2.3% 6 0.048s
+ │ └do_tac -------------------------- 0.0% 2.3% 4 0.048s
+ │ └destruct H ---------------------- 2.3% 2.3% 4 0.048s
+ └─IntegrationTestTemporaryMiscCommon. 0.0% 2.3% 1 0.164s
+ â””<Crypto.Util.Tactics.MoveLetIn.with 0.4% 2.2% 3 0.152s
+─Pipeline.refine_reflectively_gen ------ 0.0% 37.5% 1 2.652s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 32.6% 1 2.308s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 32.2% 1 2.276s
+ │ ├─ReflectiveTactics.solve_post_reifie 0.5% 18.5% 1 1.308s
+ │ │ ├─UnifyAbstractReflexivity.unify_tr 11.2% 13.6% 7 0.284s
+ │ │ └─ReflectiveTactics.unify_abstract_ 2.9% 4.2% 1 0.300s
+ │ └─ReflectiveTactics.do_reify -------- 0.0% 13.7% 1 0.968s
+ │ └Reify.Reify_rhs_gen --------------- 0.6% 13.4% 1 0.948s
+ │ └Reify.do_reify_abs_goal ----------- 7.1% 7.2% 2 0.512s
+ │ └Reify.do_reifyf_goal -------------- 6.6% 6.7% 62 0.472s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 4.9% 1 0.344s
+ â””Glue.zrange_to_reflective ----------- 0.0% 3.3% 1 0.232s
+ â””Glue.zrange_to_reflective_goal ------ 1.9% 2.6% 1 0.184s
+
+src/Specific/NISTP256/AMD64/feopp (real: 31.00, user: 28.51, sys: 0.20, mem: 765208 ko)
+COQC src/Specific/NISTP256/AMD64/fesub.v
+Finished transaction in 12.996 secs (12.091u,0.004s) (successful)
+total time: 12.048s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_montgomery ----------------- 0.0% 66.1% 1 7.964s
+─IntegrationTestTemporaryMiscCommon.fact 16.2% 50.9% 1 6.128s
+─Pipeline.refine_reflectively_gen ------ 0.0% 33.9% 1 4.084s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 28.3% 1 3.404s
+─ReflectiveTactics.solve_side_conditions 0.0% 27.8% 1 3.352s
+─reflexivity --------------------------- 21.7% 21.7% 8 2.480s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 14.1% 1 1.704s
+─ReflectiveTactics.solve_post_reified_si 0.4% 14.1% 1 1.696s
+─ReflectiveTactics.do_reify ------------ 0.0% 13.7% 1 1.656s
+─Reify.Reify_rhs_gen ------------------- 0.9% 13.2% 1 1.592s
+─DestructHyps.do_all_matches_then ------ 0.0% 12.9% 8 0.232s
+─DestructHyps.do_one_match_then -------- 0.6% 12.9% 44 0.052s
+─op_sig_side_conditions_t -------------- 0.0% 12.7% 1 1.528s
+─do_tac -------------------------------- 0.0% 12.3% 36 0.048s
+─destruct H ---------------------------- 12.3% 12.3% 36 0.048s
+─rewrite <- (lem : lemT) by by_tac ltac: 0.1% 11.2% 1 1.352s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 11.2% 1 1.352s
+─by_tac -------------------------------- 0.0% 11.1% 4 0.476s
+─UnifyAbstractReflexivity.unify_transfor 8.8% 10.6% 7 0.344s
+─rewrite <- (ZRange.is_bounded_by_None_r 10.5% 10.5% 8 0.316s
+─Reify.do_reify_abs_goal --------------- 6.0% 6.1% 2 0.732s
+─Glue.refine_to_reflective_glue' ------- 0.0% 5.6% 1 0.680s
+─Reify.do_reifyf_goal ------------------ 5.4% 5.5% 80 0.660s
+─Glue.zrange_to_reflective ------------- 0.0% 3.6% 1 0.428s
+─ReflectiveTactics.unify_abstract_cbv_in 2.2% 3.0% 1 0.360s
+─IntegrationTestTemporaryMiscCommon.do_s 0.0% 2.9% 1 0.348s
+─<Crypto.Util.Tactics.MoveLetIn.with_uco 0.5% 2.8% 3 0.332s
+─Glue.zrange_to_reflective_goal -------- 1.7% 2.6% 1 0.316s
+─k ------------------------------------- 2.1% 2.2% 1 0.268s
+─unify (constr) (constr) --------------- 2.1% 2.1% 8 0.092s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_montgomery ----------------- 0.0% 66.1% 1 7.964s
+ ├─IntegrationTestTemporaryMiscCommon.fa 16.2% 50.9% 1 6.128s
+ │ ├─reflexivity ----------------------- 20.6% 20.6% 1 2.480s
+ │ └─op_sig_side_conditions_t ---------- 0.0% 12.7% 1 1.528s
+ │ ├─DestructHyps.do_all_matches_then 0.0% 7.3% 4 0.232s
+ │ │└DestructHyps.do_one_match_then -- 0.3% 7.3% 24 0.052s
+ │ │└do_tac -------------------------- 0.0% 7.0% 20 0.048s
+ │ │└destruct H ---------------------- 6.9% 6.9% 20 0.048s
+ │ └─rewrite <- (ZRange.is_bounded_by_ 5.2% 5.2% 4 0.300s
+ └─IntegrationTestTemporaryMiscCommon.do 0.0% 14.1% 1 1.704s
+ ├─IntegrationTestTemporaryMiscCommon. 0.0% 11.2% 1 1.352s
+ │└rewrite <- (lem : lemT) by by_tac l 0.1% 11.2% 1 1.352s
+ │└by_tac ---------------------------- 0.0% 11.1% 4 0.476s
+ │ ├─DestructHyps.do_all_matches_then 0.0% 5.6% 4 0.176s
+ │ │└DestructHyps.do_one_match_then -- 0.2% 5.6% 20 0.052s
+ │ │└do_tac -------------------------- 0.0% 5.3% 16 0.048s
+ │ │└destruct H ---------------------- 5.3% 5.3% 16 0.048s
+ │ └─rewrite <- (ZRange.is_bounded_by_ 5.3% 5.3% 4 0.316s
+ └─IntegrationTestTemporaryMiscCommon. 0.0% 2.9% 1 0.348s
+ â””<Crypto.Util.Tactics.MoveLetIn.with 0.5% 2.8% 3 0.332s
+ â””k --------------------------------- 2.1% 2.2% 1 0.268s
+─Pipeline.refine_reflectively_gen ------ 0.0% 33.9% 1 4.084s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 28.3% 1 3.404s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 27.8% 1 3.352s
+ │ ├─ReflectiveTactics.solve_post_reifie 0.4% 14.1% 1 1.696s
+ │ │ ├─UnifyAbstractReflexivity.unify_tr 8.8% 10.6% 7 0.344s
+ │ │ └─ReflectiveTactics.unify_abstract_ 2.2% 3.0% 1 0.360s
+ │ └─ReflectiveTactics.do_reify -------- 0.0% 13.7% 1 1.656s
+ │ └Reify.Reify_rhs_gen --------------- 0.9% 13.2% 1 1.592s
+ │ └Reify.do_reify_abs_goal ----------- 6.0% 6.1% 2 0.732s
+ │ └Reify.do_reifyf_goal -------------- 5.4% 5.5% 80 0.660s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 5.6% 1 0.680s
+ â””Glue.zrange_to_reflective ----------- 0.0% 3.6% 1 0.428s
+ â””Glue.zrange_to_reflective_goal ------ 1.7% 2.6% 1 0.316s
+
+Finished transaction in 13.895 secs (12.78u,0.02s) (successful)
+Closed under the global context
+total time: 12.048s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_montgomery ----------------- 0.0% 66.1% 1 7.964s
+─IntegrationTestTemporaryMiscCommon.fact 16.2% 50.9% 1 6.128s
+─Pipeline.refine_reflectively_gen ------ 0.0% 33.9% 1 4.084s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 28.3% 1 3.404s
+─ReflectiveTactics.solve_side_conditions 0.0% 27.8% 1 3.352s
+─reflexivity --------------------------- 21.7% 21.7% 8 2.480s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 14.1% 1 1.704s
+─ReflectiveTactics.solve_post_reified_si 0.4% 14.1% 1 1.696s
+─ReflectiveTactics.do_reify ------------ 0.0% 13.7% 1 1.656s
+─Reify.Reify_rhs_gen ------------------- 0.9% 13.2% 1 1.592s
+─DestructHyps.do_all_matches_then ------ 0.0% 12.9% 8 0.232s
+─DestructHyps.do_one_match_then -------- 0.6% 12.9% 44 0.052s
+─op_sig_side_conditions_t -------------- 0.0% 12.7% 1 1.528s
+─do_tac -------------------------------- 0.0% 12.3% 36 0.048s
+─destruct H ---------------------------- 12.3% 12.3% 36 0.048s
+─rewrite <- (lem : lemT) by by_tac ltac: 0.1% 11.2% 1 1.352s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 11.2% 1 1.352s
+─by_tac -------------------------------- 0.0% 11.1% 4 0.476s
+─UnifyAbstractReflexivity.unify_transfor 8.8% 10.6% 7 0.344s
+─rewrite <- (ZRange.is_bounded_by_None_r 10.5% 10.5% 8 0.316s
+─Reify.do_reify_abs_goal --------------- 6.0% 6.1% 2 0.732s
+─Glue.refine_to_reflective_glue' ------- 0.0% 5.6% 1 0.680s
+─Reify.do_reifyf_goal ------------------ 5.4% 5.5% 80 0.660s
+─Glue.zrange_to_reflective ------------- 0.0% 3.6% 1 0.428s
+─ReflectiveTactics.unify_abstract_cbv_in 2.2% 3.0% 1 0.360s
+─IntegrationTestTemporaryMiscCommon.do_s 0.0% 2.9% 1 0.348s
+─<Crypto.Util.Tactics.MoveLetIn.with_uco 0.5% 2.8% 3 0.332s
+─Glue.zrange_to_reflective_goal -------- 1.7% 2.6% 1 0.316s
+─k ------------------------------------- 2.1% 2.2% 1 0.268s
+─unify (constr) (constr) --------------- 2.1% 2.1% 8 0.092s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_montgomery ----------------- 0.0% 66.1% 1 7.964s
+ ├─IntegrationTestTemporaryMiscCommon.fa 16.2% 50.9% 1 6.128s
+ │ ├─reflexivity ----------------------- 20.6% 20.6% 1 2.480s
+ │ └─op_sig_side_conditions_t ---------- 0.0% 12.7% 1 1.528s
+ │ ├─DestructHyps.do_all_matches_then 0.0% 7.3% 4 0.232s
+ │ │└DestructHyps.do_one_match_then -- 0.3% 7.3% 24 0.052s
+ │ │└do_tac -------------------------- 0.0% 7.0% 20 0.048s
+ │ │└destruct H ---------------------- 6.9% 6.9% 20 0.048s
+ │ └─rewrite <- (ZRange.is_bounded_by_ 5.2% 5.2% 4 0.300s
+ └─IntegrationTestTemporaryMiscCommon.do 0.0% 14.1% 1 1.704s
+ ├─IntegrationTestTemporaryMiscCommon. 0.0% 11.2% 1 1.352s
+ │└rewrite <- (lem : lemT) by by_tac l 0.1% 11.2% 1 1.352s
+ │└by_tac ---------------------------- 0.0% 11.1% 4 0.476s
+ │ ├─DestructHyps.do_all_matches_then 0.0% 5.6% 4 0.176s
+ │ │└DestructHyps.do_one_match_then -- 0.2% 5.6% 20 0.052s
+ │ │└do_tac -------------------------- 0.0% 5.3% 16 0.048s
+ │ │└destruct H ---------------------- 5.3% 5.3% 16 0.048s
+ │ └─rewrite <- (ZRange.is_bounded_by_ 5.3% 5.3% 4 0.316s
+ └─IntegrationTestTemporaryMiscCommon. 0.0% 2.9% 1 0.348s
+ â””<Crypto.Util.Tactics.MoveLetIn.with 0.5% 2.8% 3 0.332s
+ â””k --------------------------------- 2.1% 2.2% 1 0.268s
+─Pipeline.refine_reflectively_gen ------ 0.0% 33.9% 1 4.084s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 28.3% 1 3.404s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 27.8% 1 3.352s
+ │ ├─ReflectiveTactics.solve_post_reifie 0.4% 14.1% 1 1.696s
+ │ │ ├─UnifyAbstractReflexivity.unify_tr 8.8% 10.6% 7 0.344s
+ │ │ └─ReflectiveTactics.unify_abstract_ 2.2% 3.0% 1 0.360s
+ │ └─ReflectiveTactics.do_reify -------- 0.0% 13.7% 1 1.656s
+ │ └Reify.Reify_rhs_gen --------------- 0.9% 13.2% 1 1.592s
+ │ └Reify.do_reify_abs_goal ----------- 6.0% 6.1% 2 0.732s
+ │ └Reify.do_reifyf_goal -------------- 5.4% 5.5% 80 0.660s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 5.6% 1 0.680s
+ â””Glue.zrange_to_reflective ----------- 0.0% 3.6% 1 0.428s
+ â””Glue.zrange_to_reflective_goal ------ 1.7% 2.6% 1 0.316s
+
+src/Specific/NISTP256/AMD64/fesub (real: 43.34, user: 39.59, sys: 0.26, mem: 793376 ko)
+COQC src/Specific/NISTP256/AMD64/feaddDisplay > src/Specific/NISTP256/AMD64/feaddDisplay.log
+COQC src/Specific/NISTP256/AMD64/fenzDisplay > src/Specific/NISTP256/AMD64/fenzDisplay.log
+COQC src/Specific/solinas32_2e255m765_12limbs/femul.v
+Finished transaction in 50.426 secs (46.528u,0.072s) (successful)
+total time: 46.544s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ -0.0% 94.9% 1 44.164s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 87.1% 1 40.552s
+─ReflectiveTactics.solve_side_conditions 0.0% 86.7% 1 40.372s
+─ReflectiveTactics.do_reify ------------ 0.0% 59.6% 1 27.740s
+─Reify.Reify_rhs_gen ------------------- 1.6% 58.9% 1 27.432s
+─Reify.do_reify_abs_goal --------------- 43.3% 43.6% 2 20.312s
+─Reify.do_reifyf_goal ------------------ 42.5% 42.8% 108 10.328s
+─ReflectiveTactics.solve_post_reified_si 0.1% 27.1% 1 12.632s
+─UnifyAbstractReflexivity.unify_transfor 18.6% 23.5% 7 3.552s
+─eexact -------------------------------- 13.7% 13.7% 110 0.136s
+─Glue.refine_to_reflective_glue' ------- 0.0% 7.8% 1 3.612s
+─Glue.zrange_to_reflective ------------- 0.0% 7.2% 1 3.332s
+─Glue.zrange_to_reflective_goal -------- 1.7% 5.5% 1 2.544s
+─synthesize ---------------------------- 0.0% 5.1% 1 2.380s
+─unify (constr) (constr) --------------- 5.1% 5.1% 6 1.068s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 5.0% 1 2.320s
+─change G' ----------------------------- 4.8% 4.8% 1 2.252s
+─rewrite H ----------------------------- 3.8% 3.8% 1 1.748s
+─pose proof (pf : Interpretation.Bo 3.6% 3.6% 1 1.664s
+─prove_interp_compile_correct ---------- 0.0% 3.5% 1 1.616s
+─rewrite ?EtaInterp.InterpExprEta ------ 3.2% 3.2% 1 1.468s
+─ReflectiveTactics.unify_abstract_cbv_in 1.6% 2.4% 1 1.124s
+─reflexivity --------------------------- 2.1% 2.1% 7 0.396s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ -0.0% 94.9% 1 44.164s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 87.1% 1 40.552s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 86.7% 1 40.372s
+ │ ├─ReflectiveTactics.do_reify -------- 0.0% 59.6% 1 27.740s
+ │ │└Reify.Reify_rhs_gen --------------- 1.6% 58.9% 1 27.432s
+ │ │ ├─Reify.do_reify_abs_goal --------- 43.3% 43.6% 2 20.312s
+ │ │ │└Reify.do_reifyf_goal ------------ 42.5% 42.8% 108 10.328s
+ │ │ │└eexact -------------------------- 13.2% 13.2% 108 0.072s
+ │ │ ├─rewrite H ----------------------- 3.8% 3.8% 1 1.748s
+ │ │ └─prove_interp_compile_correct ---- 0.0% 3.5% 1 1.616s
+ │ │ └rewrite ?EtaInterp.InterpExprEta 3.2% 3.2% 1 1.468s
+ │ └─ReflectiveTactics.solve_post_reifie 0.1% 27.1% 1 12.632s
+ │ ├─UnifyAbstractReflexivity.unify_tr 18.6% 23.5% 7 3.552s
+ │ │└unify (constr) (constr) --------- 4.3% 4.3% 5 1.068s
+ │ └─ReflectiveTactics.unify_abstract_ 1.6% 2.4% 1 1.124s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 7.8% 1 3.612s
+ â””Glue.zrange_to_reflective ----------- 0.0% 7.2% 1 3.332s
+ â””Glue.zrange_to_reflective_goal ------ 1.7% 5.5% 1 2.544s
+ â””pose proof (pf : Interpretation. 3.6% 3.6% 1 1.664s
+─synthesize ---------------------------- 0.0% 5.1% 1 2.380s
+â””IntegrationTestTemporaryMiscCommon.do_r 0.0% 5.0% 1 2.320s
+â””change G' ----------------------------- 4.8% 4.8% 1 2.252s
+
+Finished transaction in 80.129 secs (74.068u,0.024s) (successful)
+Closed under the global context
+total time: 46.544s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ -0.0% 94.9% 1 44.164s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 87.1% 1 40.552s
+─ReflectiveTactics.solve_side_conditions 0.0% 86.7% 1 40.372s
+─ReflectiveTactics.do_reify ------------ 0.0% 59.6% 1 27.740s
+─Reify.Reify_rhs_gen ------------------- 1.6% 58.9% 1 27.432s
+─Reify.do_reify_abs_goal --------------- 43.3% 43.6% 2 20.312s
+─Reify.do_reifyf_goal ------------------ 42.5% 42.8% 108 10.328s
+─ReflectiveTactics.solve_post_reified_si 0.1% 27.1% 1 12.632s
+─UnifyAbstractReflexivity.unify_transfor 18.6% 23.5% 7 3.552s
+─eexact -------------------------------- 13.7% 13.7% 110 0.136s
+─Glue.refine_to_reflective_glue' ------- 0.0% 7.8% 1 3.612s
+─Glue.zrange_to_reflective ------------- 0.0% 7.2% 1 3.332s
+─Glue.zrange_to_reflective_goal -------- 1.7% 5.5% 1 2.544s
+─synthesize ---------------------------- 0.0% 5.1% 1 2.380s
+─unify (constr) (constr) --------------- 5.1% 5.1% 6 1.068s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 5.0% 1 2.320s
+─change G' ----------------------------- 4.8% 4.8% 1 2.252s
+─rewrite H ----------------------------- 3.8% 3.8% 1 1.748s
+─pose proof (pf : Interpretation.Bo 3.6% 3.6% 1 1.664s
+─prove_interp_compile_correct ---------- 0.0% 3.5% 1 1.616s
+─rewrite ?EtaInterp.InterpExprEta ------ 3.2% 3.2% 1 1.468s
+─ReflectiveTactics.unify_abstract_cbv_in 1.6% 2.4% 1 1.124s
+─reflexivity --------------------------- 2.1% 2.1% 7 0.396s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ -0.0% 94.9% 1 44.164s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 87.1% 1 40.552s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 86.7% 1 40.372s
+ │ ├─ReflectiveTactics.do_reify -------- 0.0% 59.6% 1 27.740s
+ │ │└Reify.Reify_rhs_gen --------------- 1.6% 58.9% 1 27.432s
+ │ │ ├─Reify.do_reify_abs_goal --------- 43.3% 43.6% 2 20.312s
+ │ │ │└Reify.do_reifyf_goal ------------ 42.5% 42.8% 108 10.328s
+ │ │ │└eexact -------------------------- 13.2% 13.2% 108 0.072s
+ │ │ ├─rewrite H ----------------------- 3.8% 3.8% 1 1.748s
+ │ │ └─prove_interp_compile_correct ---- 0.0% 3.5% 1 1.616s
+ │ │ └rewrite ?EtaInterp.InterpExprEta 3.2% 3.2% 1 1.468s
+ │ └─ReflectiveTactics.solve_post_reifie 0.1% 27.1% 1 12.632s
+ │ ├─UnifyAbstractReflexivity.unify_tr 18.6% 23.5% 7 3.552s
+ │ │└unify (constr) (constr) --------- 4.3% 4.3% 5 1.068s
+ │ └─ReflectiveTactics.unify_abstract_ 1.6% 2.4% 1 1.124s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 7.8% 1 3.612s
+ â””Glue.zrange_to_reflective ----------- 0.0% 7.2% 1 3.332s
+ â””Glue.zrange_to_reflective_goal ------ 1.7% 5.5% 1 2.544s
+ â””pose proof (pf : Interpretation. 3.6% 3.6% 1 1.664s
+─synthesize ---------------------------- 0.0% 5.1% 1 2.380s
+â””IntegrationTestTemporaryMiscCommon.do_r 0.0% 5.0% 1 2.320s
+â””change G' ----------------------------- 4.8% 4.8% 1 2.252s
+
+src/Specific/solinas32_2e255m765_12limbs/femul (real: 155.79, user: 143.70, sys: 0.32, mem: 1454696 ko)
+COQC src/Specific/NISTP256/AMD64/feoppDisplay > src/Specific/NISTP256/AMD64/feoppDisplay.log
+COQC src/Specific/NISTP256/AMD64/fesubDisplay > src/Specific/NISTP256/AMD64/fesubDisplay.log
+COQC src/Specific/X25519/C64/fesquareDisplay > src/Specific/X25519/C64/fesquareDisplay.log
+COQC src/Specific/X25519/C64/fesubDisplay > src/Specific/X25519/C64/fesubDisplay.log
+COQC src/Specific/X25519/C64/freezeDisplay > src/Specific/X25519/C64/freezeDisplay.log
+COQC src/Specific/solinas32_2e255m765_13limbs/femul.v
+Finished transaction in 61.854 secs (57.328u,0.079s) (successful)
+total time: 57.348s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 94.6% 1 54.224s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 86.2% 1 49.452s
+─ReflectiveTactics.solve_side_conditions 0.0% 85.9% 1 49.264s
+─ReflectiveTactics.do_reify ------------ -0.0% 57.6% 1 33.004s
+─Reify.Reify_rhs_gen ------------------- 1.3% 56.9% 1 32.608s
+─Reify.do_reify_abs_goal --------------- 43.1% 43.3% 2 24.840s
+─Reify.do_reifyf_goal ------------------ 42.3% 42.6% 117 12.704s
+─ReflectiveTactics.solve_post_reified_si 0.1% 28.4% 1 16.260s
+─UnifyAbstractReflexivity.unify_transfor 19.6% 25.0% 7 4.824s
+─eexact -------------------------------- 13.9% 13.9% 119 0.144s
+─Glue.refine_to_reflective_glue' ------- 0.0% 8.3% 1 4.772s
+─Glue.zrange_to_reflective ------------- 0.0% 7.8% 1 4.484s
+─Glue.zrange_to_reflective_goal -------- 1.7% 6.0% 1 3.464s
+─synthesize ---------------------------- 0.0% 5.4% 1 3.124s
+─unify (constr) (constr) --------------- 5.4% 5.4% 6 1.540s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 5.3% 1 3.040s
+─change G' ----------------------------- 5.2% 5.2% 1 2.964s
+─pose proof (pf : Interpretation.Bo 4.2% 4.2% 1 2.416s
+─prove_interp_compile_correct ---------- 0.0% 3.3% 1 1.904s
+─rewrite H ----------------------------- 3.3% 3.3% 1 1.896s
+─rewrite ?EtaInterp.InterpExprEta ------ 3.0% 3.0% 1 1.732s
+─ReflectiveTactics.unify_abstract_cbv_in 1.4% 2.1% 1 1.212s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 94.6% 1 54.224s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 86.2% 1 49.452s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 85.9% 1 49.264s
+ │ ├─ReflectiveTactics.do_reify -------- -0.0% 57.6% 1 33.004s
+ │ │└Reify.Reify_rhs_gen --------------- 1.3% 56.9% 1 32.608s
+ │ │ ├─Reify.do_reify_abs_goal --------- 43.1% 43.3% 2 24.840s
+ │ │ │└Reify.do_reifyf_goal ------------ 42.3% 42.6% 117 12.704s
+ │ │ │└eexact -------------------------- 13.4% 13.4% 117 0.084s
+ │ │ ├─prove_interp_compile_correct ---- 0.0% 3.3% 1 1.904s
+ │ │ │└rewrite ?EtaInterp.InterpExprEta 3.0% 3.0% 1 1.732s
+ │ │ └─rewrite H ----------------------- 3.3% 3.3% 1 1.896s
+ │ └─ReflectiveTactics.solve_post_reifie 0.1% 28.4% 1 16.260s
+ │ ├─UnifyAbstractReflexivity.unify_tr 19.6% 25.0% 7 4.824s
+ │ │└unify (constr) (constr) --------- 4.8% 4.8% 5 1.540s
+ │ └─ReflectiveTactics.unify_abstract_ 1.4% 2.1% 1 1.212s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 8.3% 1 4.772s
+ â””Glue.zrange_to_reflective ----------- 0.0% 7.8% 1 4.484s
+ â””Glue.zrange_to_reflective_goal ------ 1.7% 6.0% 1 3.464s
+ â””pose proof (pf : Interpretation. 4.2% 4.2% 1 2.416s
+─synthesize ---------------------------- 0.0% 5.4% 1 3.124s
+â””IntegrationTestTemporaryMiscCommon.do_r 0.0% 5.3% 1 3.040s
+â””change G' ----------------------------- 5.2% 5.2% 1 2.964s
+
+Finished transaction in 94.432 secs (86.96u,0.02s) (successful)
+Closed under the global context
+total time: 57.348s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 94.6% 1 54.224s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 86.2% 1 49.452s
+─ReflectiveTactics.solve_side_conditions 0.0% 85.9% 1 49.264s
+─ReflectiveTactics.do_reify ------------ -0.0% 57.6% 1 33.004s
+─Reify.Reify_rhs_gen ------------------- 1.3% 56.9% 1 32.608s
+─Reify.do_reify_abs_goal --------------- 43.1% 43.3% 2 24.840s
+─Reify.do_reifyf_goal ------------------ 42.3% 42.6% 117 12.704s
+─ReflectiveTactics.solve_post_reified_si 0.1% 28.4% 1 16.260s
+─UnifyAbstractReflexivity.unify_transfor 19.6% 25.0% 7 4.824s
+─eexact -------------------------------- 13.9% 13.9% 119 0.144s
+─Glue.refine_to_reflective_glue' ------- 0.0% 8.3% 1 4.772s
+─Glue.zrange_to_reflective ------------- 0.0% 7.8% 1 4.484s
+─Glue.zrange_to_reflective_goal -------- 1.7% 6.0% 1 3.464s
+─synthesize ---------------------------- 0.0% 5.4% 1 3.124s
+─unify (constr) (constr) --------------- 5.4% 5.4% 6 1.540s
+─IntegrationTestTemporaryMiscCommon.do_r 0.0% 5.3% 1 3.040s
+─change G' ----------------------------- 5.2% 5.2% 1 2.964s
+─pose proof (pf : Interpretation.Bo 4.2% 4.2% 1 2.416s
+─prove_interp_compile_correct ---------- 0.0% 3.3% 1 1.904s
+─rewrite H ----------------------------- 3.3% 3.3% 1 1.896s
+─rewrite ?EtaInterp.InterpExprEta ------ 3.0% 3.0% 1 1.732s
+─ReflectiveTactics.unify_abstract_cbv_in 1.4% 2.1% 1 1.212s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 94.6% 1 54.224s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 86.2% 1 49.452s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 85.9% 1 49.264s
+ │ ├─ReflectiveTactics.do_reify -------- -0.0% 57.6% 1 33.004s
+ │ │└Reify.Reify_rhs_gen --------------- 1.3% 56.9% 1 32.608s
+ │ │ ├─Reify.do_reify_abs_goal --------- 43.1% 43.3% 2 24.840s
+ │ │ │└Reify.do_reifyf_goal ------------ 42.3% 42.6% 117 12.704s
+ │ │ │└eexact -------------------------- 13.4% 13.4% 117 0.084s
+ │ │ ├─prove_interp_compile_correct ---- 0.0% 3.3% 1 1.904s
+ │ │ │└rewrite ?EtaInterp.InterpExprEta 3.0% 3.0% 1 1.732s
+ │ │ └─rewrite H ----------------------- 3.3% 3.3% 1 1.896s
+ │ └─ReflectiveTactics.solve_post_reifie 0.1% 28.4% 1 16.260s
+ │ ├─UnifyAbstractReflexivity.unify_tr 19.6% 25.0% 7 4.824s
+ │ │└unify (constr) (constr) --------- 4.8% 4.8% 5 1.540s
+ │ └─ReflectiveTactics.unify_abstract_ 1.4% 2.1% 1 1.212s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 8.3% 1 4.772s
+ â””Glue.zrange_to_reflective ----------- 0.0% 7.8% 1 4.484s
+ â””Glue.zrange_to_reflective_goal ------ 1.7% 6.0% 1 3.464s
+ â””pose proof (pf : Interpretation. 4.2% 4.2% 1 2.416s
+─synthesize ---------------------------- 0.0% 5.4% 1 3.124s
+â””IntegrationTestTemporaryMiscCommon.do_r 0.0% 5.3% 1 3.040s
+â””change G' ----------------------------- 5.2% 5.2% 1 2.964s
+
+src/Specific/solinas32_2e255m765_13limbs/femul (real: 181.77, user: 168.52, sys: 0.40, mem: 1589516 ko)
+COQC src/Specific/NISTP256/AMD64/femul.v
+Finished transaction in 119.257 secs (109.936u,0.256s) (successful)
+total time: 110.140s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 97.1% 1 106.964s
+─ReflectiveTactics.do_reflective_pipelin -0.0% 96.4% 1 106.196s
+─ReflectiveTactics.solve_side_conditions 0.0% 96.2% 1 105.992s
+─ReflectiveTactics.do_reify ------------ -0.0% 83.7% 1 92.208s
+─Reify.Reify_rhs_gen ------------------- 0.7% 83.5% 1 91.960s
+─Reify.do_reify_abs_goal --------------- 77.7% 77.8% 2 85.708s
+─Reify.do_reifyf_goal ------------------ 77.4% 77.5% 901 85.364s
+─eexact -------------------------------- 17.9% 17.9% 903 0.136s
+─ReflectiveTactics.solve_post_reified_si 0.3% 12.5% 1 13.784s
+─UnifyAbstractReflexivity.unify_transfor 9.8% 11.2% 7 3.356s
+─synthesize_montgomery ----------------- 0.0% 2.9% 1 3.176s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 97.1% 1 106.964s
+â””ReflectiveTactics.do_reflective_pipelin -0.0% 96.4% 1 106.196s
+â””ReflectiveTactics.solve_side_conditions 0.0% 96.2% 1 105.992s
+ ├─ReflectiveTactics.do_reify ---------- -0.0% 83.7% 1 92.208s
+ │└Reify.Reify_rhs_gen ----------------- 0.7% 83.5% 1 91.960s
+ │└Reify.do_reify_abs_goal ------------- 77.7% 77.8% 2 85.708s
+ │└Reify.do_reifyf_goal ---------------- 77.4% 77.5% 901 85.364s
+ │└eexact ------------------------------ 17.7% 17.7% 901 0.136s
+ └─ReflectiveTactics.solve_post_reified_ 0.3% 12.5% 1 13.784s
+ â””UnifyAbstractReflexivity.unify_transf 9.8% 11.2% 7 3.356s
+─synthesize_montgomery ----------------- 0.0% 2.9% 1 3.176s
+
+Finished transaction in 61.452 secs (58.503u,0.055s) (successful)
+Closed under the global context
+total time: 110.140s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 97.1% 1 106.964s
+─ReflectiveTactics.do_reflective_pipelin -0.0% 96.4% 1 106.196s
+─ReflectiveTactics.solve_side_conditions 0.0% 96.2% 1 105.992s
+─ReflectiveTactics.do_reify ------------ -0.0% 83.7% 1 92.208s
+─Reify.Reify_rhs_gen ------------------- 0.7% 83.5% 1 91.960s
+─Reify.do_reify_abs_goal --------------- 77.7% 77.8% 2 85.708s
+─Reify.do_reifyf_goal ------------------ 77.4% 77.5% 901 85.364s
+─eexact -------------------------------- 17.9% 17.9% 903 0.136s
+─ReflectiveTactics.solve_post_reified_si 0.3% 12.5% 1 13.784s
+─UnifyAbstractReflexivity.unify_transfor 9.8% 11.2% 7 3.356s
+─synthesize_montgomery ----------------- 0.0% 2.9% 1 3.176s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─Pipeline.refine_reflectively_gen ------ 0.0% 97.1% 1 106.964s
+â””ReflectiveTactics.do_reflective_pipelin -0.0% 96.4% 1 106.196s
+â””ReflectiveTactics.solve_side_conditions 0.0% 96.2% 1 105.992s
+ ├─ReflectiveTactics.do_reify ---------- -0.0% 83.7% 1 92.208s
+ │└Reify.Reify_rhs_gen ----------------- 0.7% 83.5% 1 91.960s
+ │└Reify.do_reify_abs_goal ------------- 77.7% 77.8% 2 85.708s
+ │└Reify.do_reifyf_goal ---------------- 77.4% 77.5% 901 85.364s
+ │└eexact ------------------------------ 17.7% 17.7% 901 0.136s
+ └─ReflectiveTactics.solve_post_reified_ 0.3% 12.5% 1 13.784s
+ â””UnifyAbstractReflexivity.unify_transf 9.8% 11.2% 7 3.356s
+─synthesize_montgomery ----------------- 0.0% 2.9% 1 3.176s
+
+src/Specific/NISTP256/AMD64/femul (real: 202.96, user: 189.62, sys: 0.64, mem: 3302508 ko)
+COQC src/Specific/NISTP256/AMD64/femulDisplay > src/Specific/NISTP256/AMD64/femulDisplay.log
+COQC src/Specific/X25519/C64/ladderstep.v
+total time: 52.080s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_xzladderstep --------------- 0.0% 100.0% 1 52.080s
+─Pipeline.refine_reflectively_gen ------ 0.0% 98.5% 1 51.320s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 93.8% 1 48.872s
+─ReflectiveTactics.solve_side_conditions 0.0% 93.7% 1 48.776s
+─ReflectiveTactics.solve_post_reified_si 0.2% 56.5% 1 29.412s
+─UnifyAbstractReflexivity.unify_transfor 44.7% 49.1% 7 6.968s
+─ReflectiveTactics.do_reify ------------ 0.0% 37.2% 1 19.364s
+─Reify.Reify_rhs_gen ------------------- 2.1% 23.4% 1 12.200s
+─Reify.do_reifyf_goal ------------------ 11.2% 11.3% 138 1.884s
+─Compilers.Reify.reify_context_variables 0.1% 9.2% 1 4.808s
+─rewrite H ----------------------------- 7.3% 7.3% 1 3.816s
+─ReflectiveTactics.unify_abstract_cbv_in 4.7% 6.4% 1 3.336s
+─Glue.refine_to_reflective_glue' ------- 0.0% 4.7% 1 2.448s
+─Glue.zrange_to_reflective ------------- 0.0% 4.0% 1 2.068s
+─Reify.transitivity_tt ----------------- 0.1% 3.7% 2 0.984s
+─transitivity -------------------------- 3.5% 3.5% 10 0.880s
+─reflexivity --------------------------- 3.4% 3.4% 11 0.772s
+─Glue.zrange_to_reflective_goal -------- 2.4% 3.3% 1 1.728s
+─eexact -------------------------------- 3.2% 3.2% 140 0.032s
+─unify (constr) (constr) --------------- 3.1% 3.1% 6 0.852s
+─clear (var_list) ---------------------- 3.1% 3.1% 98 0.584s
+─UnfoldArg.unfold_second_arg ----------- 0.4% 3.0% 2 1.576s
+─tac ----------------------------------- 2.1% 3.0% 2 1.564s
+─ClearAll.clear_all -------------------- 0.2% 2.8% 7 0.584s
+─ChangeInAll.change_with_compute_in_all 0.0% 2.6% 221 0.012s
+─change c with c' in * ----------------- 2.5% 2.5% 221 0.012s
+─Reify.do_reify_abs_goal --------------- 2.4% 2.5% 2 1.276s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_xzladderstep --------------- 0.0% 100.0% 1 52.080s
+â””Pipeline.refine_reflectively_gen ------ 0.0% 98.5% 1 51.320s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 93.8% 1 48.872s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 93.7% 1 48.776s
+ │ ├─ReflectiveTactics.solve_post_reifie 0.2% 56.5% 1 29.412s
+ │ │ ├─UnifyAbstractReflexivity.unify_tr 44.7% 49.1% 7 6.968s
+ │ │ │└ClearAll.clear_all -------------- 0.2% 2.8% 7 0.584s
+ │ │ │└clear (var_list) ---------------- 2.7% 2.7% 65 0.584s
+ │ │ └─ReflectiveTactics.unify_abstract_ 4.7% 6.4% 1 3.336s
+ │ └─ReflectiveTactics.do_reify -------- 0.0% 37.2% 1 19.364s
+ │ ├─Reify.Reify_rhs_gen ------------- 2.1% 23.4% 1 12.200s
+ │ │ ├─rewrite H --------------------- 7.3% 7.3% 1 3.816s
+ │ │ ├─Reify.transitivity_tt --------- 0.1% 3.7% 2 0.984s
+ │ │ │└transitivity ------------------ 3.4% 3.4% 4 0.880s
+ │ │ ├─tac --------------------------- 2.1% 3.0% 1 1.564s
+ │ │ └─Reify.do_reify_abs_goal ------- 2.4% 2.5% 2 1.276s
+ │ │ └Reify.do_reifyf_goal ---------- 2.2% 2.2% 25 1.148s
+ │ ├─Compilers.Reify.reify_context_var 0.1% 9.2% 1 4.808s
+ │ │└Reify.do_reifyf_goal ------------ 9.0% 9.1% 113 1.884s
+ │ │└eexact -------------------------- 2.4% 2.4% 113 0.032s
+ │ └─UnfoldArg.unfold_second_arg ----- 0.4% 3.0% 2 1.576s
+ │ └ChangeInAll.change_with_compute_i 0.0% 2.6% 221 0.012s
+ │ └change c with c' in * ----------- 2.5% 2.5% 221 0.012s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 4.7% 1 2.448s
+ â””Glue.zrange_to_reflective ----------- 0.0% 4.0% 1 2.068s
+ â””Glue.zrange_to_reflective_goal ------ 2.4% 3.3% 1 1.728s
+
+Finished transaction in 171.122 secs (161.392u,0.039s) (successful)
+Closed under the global context
+total time: 52.080s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_xzladderstep --------------- 0.0% 100.0% 1 52.080s
+─Pipeline.refine_reflectively_gen ------ 0.0% 98.5% 1 51.320s
+─ReflectiveTactics.do_reflective_pipelin 0.0% 93.8% 1 48.872s
+─ReflectiveTactics.solve_side_conditions 0.0% 93.7% 1 48.776s
+─ReflectiveTactics.solve_post_reified_si 0.2% 56.5% 1 29.412s
+─UnifyAbstractReflexivity.unify_transfor 44.7% 49.1% 7 6.968s
+─ReflectiveTactics.do_reify ------------ 0.0% 37.2% 1 19.364s
+─Reify.Reify_rhs_gen ------------------- 2.1% 23.4% 1 12.200s
+─Reify.do_reifyf_goal ------------------ 11.2% 11.3% 138 1.884s
+─Compilers.Reify.reify_context_variables 0.1% 9.2% 1 4.808s
+─rewrite H ----------------------------- 7.3% 7.3% 1 3.816s
+─ReflectiveTactics.unify_abstract_cbv_in 4.7% 6.4% 1 3.336s
+─Glue.refine_to_reflective_glue' ------- 0.0% 4.7% 1 2.448s
+─Glue.zrange_to_reflective ------------- 0.0% 4.0% 1 2.068s
+─Reify.transitivity_tt ----------------- 0.1% 3.7% 2 0.984s
+─transitivity -------------------------- 3.5% 3.5% 10 0.880s
+─reflexivity --------------------------- 3.4% 3.4% 11 0.772s
+─Glue.zrange_to_reflective_goal -------- 2.4% 3.3% 1 1.728s
+─eexact -------------------------------- 3.2% 3.2% 140 0.032s
+─unify (constr) (constr) --------------- 3.1% 3.1% 6 0.852s
+─clear (var_list) ---------------------- 3.1% 3.1% 98 0.584s
+─UnfoldArg.unfold_second_arg ----------- 0.4% 3.0% 2 1.576s
+─tac ----------------------------------- 2.1% 3.0% 2 1.564s
+─ClearAll.clear_all -------------------- 0.2% 2.8% 7 0.584s
+─ChangeInAll.change_with_compute_in_all 0.0% 2.6% 221 0.012s
+─change c with c' in * ----------------- 2.5% 2.5% 221 0.012s
+─Reify.do_reify_abs_goal --------------- 2.4% 2.5% 2 1.276s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─synthesize_xzladderstep --------------- 0.0% 100.0% 1 52.080s
+â””Pipeline.refine_reflectively_gen ------ 0.0% 98.5% 1 51.320s
+ ├─ReflectiveTactics.do_reflective_pipel 0.0% 93.8% 1 48.872s
+ │└ReflectiveTactics.solve_side_conditio 0.0% 93.7% 1 48.776s
+ │ ├─ReflectiveTactics.solve_post_reifie 0.2% 56.5% 1 29.412s
+ │ │ ├─UnifyAbstractReflexivity.unify_tr 44.7% 49.1% 7 6.968s
+ │ │ │└ClearAll.clear_all -------------- 0.2% 2.8% 7 0.584s
+ │ │ │└clear (var_list) ---------------- 2.7% 2.7% 65 0.584s
+ │ │ └─ReflectiveTactics.unify_abstract_ 4.7% 6.4% 1 3.336s
+ │ └─ReflectiveTactics.do_reify -------- 0.0% 37.2% 1 19.364s
+ │ ├─Reify.Reify_rhs_gen ------------- 2.1% 23.4% 1 12.200s
+ │ │ ├─rewrite H --------------------- 7.3% 7.3% 1 3.816s
+ │ │ ├─Reify.transitivity_tt --------- 0.1% 3.7% 2 0.984s
+ │ │ │└transitivity ------------------ 3.4% 3.4% 4 0.880s
+ │ │ ├─tac --------------------------- 2.1% 3.0% 1 1.564s
+ │ │ └─Reify.do_reify_abs_goal ------- 2.4% 2.5% 2 1.276s
+ │ │ └Reify.do_reifyf_goal ---------- 2.2% 2.2% 25 1.148s
+ │ ├─Compilers.Reify.reify_context_var 0.1% 9.2% 1 4.808s
+ │ │└Reify.do_reifyf_goal ------------ 9.0% 9.1% 113 1.884s
+ │ │└eexact -------------------------- 2.4% 2.4% 113 0.032s
+ │ └─UnfoldArg.unfold_second_arg ----- 0.4% 3.0% 2 1.576s
+ │ └ChangeInAll.change_with_compute_i 0.0% 2.6% 221 0.012s
+ │ └change c with c' in * ----------- 2.5% 2.5% 221 0.012s
+ └─Glue.refine_to_reflective_glue' ----- 0.0% 4.7% 1 2.448s
+ â””Glue.zrange_to_reflective ----------- 0.0% 4.0% 1 2.068s
+ â””Glue.zrange_to_reflective_goal ------ 2.4% 3.3% 1 1.728s
+
+src/Specific/X25519/C64/ladderstep (real: 256.77, user: 241.34, sys: 0.45, mem: 1617000 ko)
+COQC src/Specific/X25519/C64/ladderstepDisplay > src/Specific/X25519/C64/ladderstepDisplay.log
diff --git a/test-suite/coq-makefile/timing/precomputed-time-tests/run.sh b/test-suite/coq-makefile/timing/precomputed-time-tests/run.sh
new file mode 100755
index 000000000..a918cceb6
--- /dev/null
+++ b/test-suite/coq-makefile/timing/precomputed-time-tests/run.sh
@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+
+set -x
+set -e
+
+cd "$(dirname "${BASH_SOURCE[0]}")"
+export COQLIB="$(cd ../../../.. && pwd)"
+
+./001-correct-diff-sorting-order/run.sh || exit $?
+./002-single-file-sorting/run.sh || exit $?
diff --git a/test-suite/coq-makefile/timing/run.sh b/test-suite/coq-makefile/timing/run.sh
index 7e0baaa8f..2439d3f37 100755
--- a/test-suite/coq-makefile/timing/run.sh
+++ b/test-suite/coq-makefile/timing/run.sh
@@ -3,9 +3,12 @@
#set -x
set -e
-. ../template/init.sh
+. ../template/path-init.sh
-cd error
+cd precomputed-time-tests
+./run.sh || exit $?
+
+cd ../error
coq_makefile -f _CoqProject -o Makefile
make cleanall
if make pretty-timed TGTS="all" -j1; then
@@ -28,19 +31,22 @@ coq_makefile -f _CoqProject -o Makefile
make cleanall
make make-pretty-timed-after TGTS="all" -j1 || exit $?
rm -f time-of-build-before.log
-make print-pretty-timed-diff TIME_OF_BUILD_BEFORE_FILE=../before/time-of-build-before.log
+make print-pretty-timed-diff TIMING_SORT_BY=diff TIME_OF_BUILD_BEFORE_FILE=../before/time-of-build-before.log
cp ../before/time-of-build-before.log ./
-make print-pretty-timed-diff || exit $?
+make print-pretty-timed-diff TIMING_SORT_BY=diff || exit $?
INFINITY="∞"
INFINITY_REPLACEMENT="+.%" # assume that if the before time is zero, we expected the time to increase
for ext in "" .desired; do
for file in time-of-build-before.log time-of-build-after.log time-of-build-both.log; do
- cat ${file}${ext} | grep -v 'warning: undefined variable' | sed s"/${INFINITY}/${INFINITY_REPLACEMENT}/g" | sed s'/[0-9]//g' | sed s'/ *$//g' | sed s":|\s*N/A\s*$:| ${INFINITY_REPLACEMENT}:g" | sed s'/^-*$/------/g' | sed s'/ */ /g' | sed s'/\(Total.*\)-\(.*\)-/\1+\2+/g' > ${file}${ext}.processed
+ cat ${file}${ext} | grep -v 'warning: undefined variable' | sed s"/${INFINITY}/${INFINITY_REPLACEMENT}/g" | sed s'/[0-9]//g' | sed s'/ *$//g' | sed s":|\s*N/A\s*$:| ${INFINITY_REPLACEMENT}:g" | sed s'/^-*$/------/g' | sed s'/ */ /g' | sed s'/\(Total.*\)-\(.*\)-/\1+\2+/g' > ${file}${ext}.processed
done
done
for file in time-of-build-before.log time-of-build-after.log time-of-build-both.log; do
+ echo "cat $file"
+ cat "$file"
+ echo
diff -u $file.desired.processed $file.processed || exit $?
done
@@ -56,12 +62,19 @@ make all TIMING=after -j2 || exit $?
find ../per-file-before/ -name "*.before-timing" -exec 'cp' '{}' './' ';'
make all.timing.diff -j2 || exit $?
+echo "cat A.v.before-timing"
+cat A.v.before-timing
+echo
+echo "cat A.v.after-timing"
+cat A.v.after-timing
+echo
+echo "cat A.v.timing.diff"
cat A.v.timing.diff
echo
for ext in "" .desired; do
for file in A.v.timing.diff; do
- cat ${file}${ext} | sed s"/${INFINITY}/${INFINITY_REPLACEMENT}/g" | sed s":|\s*N/A\s*$:| ${INFINITY_REPLACEMENT}:g" | sed s'/[0-9]*\.[0-9]*//g' | sed s'/0//g' | sed s'/ */ /g' | sed s'/+/-/g' | sort > ${file}${ext}.processed
+ cat ${file}${ext} | sed s"/${INFINITY}/${INFINITY_REPLACEMENT}/g" | sed s":|\s*N/A\s*$:| ${INFINITY_REPLACEMENT}:g" | sed s'/[0-9]*\.[0-9]*//g' | sed s'/0//g' | sed s'/ */ /g' | sed s'/ *$//g' | sed s'/+/-/g' | sort > ${file}${ext}.processed
done
done
for file in A.v.timing.diff; do
diff --git a/test-suite/coqchk/include.v b/test-suite/coqchk/include.v
new file mode 100644
index 000000000..6232c1b80
--- /dev/null
+++ b/test-suite/coqchk/include.v
@@ -0,0 +1,11 @@
+(* See https://github.com/coq/coq/issues/5747 *)
+Module Type S.
+End S.
+
+Module N.
+Inductive I := .
+End N.
+
+Module M : S.
+ Include N.
+End M.
diff --git a/test-suite/coqchk/primproj2.v b/test-suite/coqchk/primproj2.v
new file mode 100644
index 000000000..f73c627ee
--- /dev/null
+++ b/test-suite/coqchk/primproj2.v
@@ -0,0 +1,10 @@
+Set Primitive Projections.
+
+Record Pack (A : Type) := pack { unpack : A }.
+
+Definition p : Pack bool.
+Proof.
+refine (pack _ true).
+Qed.
+
+Definition boom : unpack bool p = let u := unpack _ in u p := eq_refl.
diff --git a/test-suite/coqdoc/bug5648.html.out b/test-suite/coqdoc/bug5648.html.out
index 06789c1c1..5c5a2dc29 100644
--- a/test-suite/coqdoc/bug5648.html.out
+++ b/test-suite/coqdoc/bug5648.html.out
@@ -2,7 +2,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="coqdoc.css" rel="stylesheet" type="text/css" />
<title>Coqdoc.bug5648</title>
</head>
@@ -31,14 +31,14 @@
<br/>
<span class="id" title="keyword">Definition</span> <a name="d"><span class="id" title="definition">d</span></a> <span class="id" title="var">x</span> :=<br/>
&nbsp;&nbsp;<span class="id" title="keyword">match</span> <a class="idref" href="Coqdoc.bug5648.html#x"><span class="id" title="variable">x</span></a> <span class="id" title="keyword">with</span><br/>
-&nbsp;&nbsp;| <a class="idref" href="Coqdoc.bug5648.html#A"><span class="id" title="constructor">A</span></a> =&gt; 0<br/>
-&nbsp;&nbsp;| <a class="idref" href="Coqdoc.bug5648.html#Add"><span class="id" title="constructor">Add</span></a> =&gt; 1<br/>
-&nbsp;&nbsp;| <a class="idref" href="Coqdoc.bug5648.html#G"><span class="id" title="constructor">G</span></a> =&gt; 2<br/>
-&nbsp;&nbsp;| <a class="idref" href="Coqdoc.bug5648.html#Goal"><span class="id" title="constructor">Goal</span></a> =&gt; 3<br/>
-&nbsp;&nbsp;| <a class="idref" href="Coqdoc.bug5648.html#L"><span class="id" title="constructor">L</span></a> =&gt; 4<br/>
-&nbsp;&nbsp;| <a class="idref" href="Coqdoc.bug5648.html#Lemma"><span class="id" title="constructor">Lemma</span></a> =&gt; 5<br/>
-&nbsp;&nbsp;| <a class="idref" href="Coqdoc.bug5648.html#P"><span class="id" title="constructor">P</span></a> =&gt; 6<br/>
-&nbsp;&nbsp;| <a class="idref" href="Coqdoc.bug5648.html#Proof"><span class="id" title="constructor">Proof</span></a> =&gt; 7<br/>
+&nbsp;&nbsp;| <a class="idref" href="Coqdoc.bug5648.html#A"><span class="id" title="constructor">A</span></a> ⇒ 0<br/>
+&nbsp;&nbsp;| <a class="idref" href="Coqdoc.bug5648.html#Add"><span class="id" title="constructor">Add</span></a> ⇒ 1<br/>
+&nbsp;&nbsp;| <a class="idref" href="Coqdoc.bug5648.html#G"><span class="id" title="constructor">G</span></a> ⇒ 2<br/>
+&nbsp;&nbsp;| <a class="idref" href="Coqdoc.bug5648.html#Goal"><span class="id" title="constructor">Goal</span></a> ⇒ 3<br/>
+&nbsp;&nbsp;| <a class="idref" href="Coqdoc.bug5648.html#L"><span class="id" title="constructor">L</span></a> ⇒ 4<br/>
+&nbsp;&nbsp;| <a class="idref" href="Coqdoc.bug5648.html#Lemma"><span class="id" title="constructor">Lemma</span></a> ⇒ 5<br/>
+&nbsp;&nbsp;| <a class="idref" href="Coqdoc.bug5648.html#P"><span class="id" title="constructor">P</span></a> ⇒ 6<br/>
+&nbsp;&nbsp;| <a class="idref" href="Coqdoc.bug5648.html#Proof"><span class="id" title="constructor">Proof</span></a> ⇒ 7<br/>
&nbsp;&nbsp;<span class="id" title="keyword">end</span>.<br/>
</div>
</div>
diff --git a/test-suite/coqdoc/bug5648.tex.out b/test-suite/coqdoc/bug5648.tex.out
index b0b732eff..82f7da230 100644
--- a/test-suite/coqdoc/bug5648.tex.out
+++ b/test-suite/coqdoc/bug5648.tex.out
@@ -1,5 +1,15 @@
\documentclass[12pt]{report}
-\usepackage[]{inputenc}
+\usepackage[utf8x]{inputenc}
+
+%Warning: tipa declares many non-standard macros used by utf8x to
+%interpret utf8 characters but extra packages might have to be added
+%such as "textgreek" for Greek letters not already in tipa
+%or "stmaryrd" for mathematical symbols.
+%Utf8 codes missing a LaTeX interpretation can be defined by using
+%\DeclareUnicodeCharacter{code}{interpretation}.
+%Use coqdoc's option -p to add new packages or declarations.
+\usepackage{tipa}
+
\usepackage[T1]{fontenc}
\usepackage{fullpage}
\usepackage{coqdoc}
diff --git a/test-suite/coqdoc/bug5700.html.out b/test-suite/coqdoc/bug5700.html.out
index 0e05660d6..b96fc6281 100644
--- a/test-suite/coqdoc/bug5700.html.out
+++ b/test-suite/coqdoc/bug5700.html.out
@@ -2,7 +2,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="coqdoc.css" rel="stylesheet" type="text/css" />
<title>Coqdoc.bug5700</title>
</head>
diff --git a/test-suite/coqdoc/bug5700.tex.out b/test-suite/coqdoc/bug5700.tex.out
index 33990cb89..1a1af5dfd 100644
--- a/test-suite/coqdoc/bug5700.tex.out
+++ b/test-suite/coqdoc/bug5700.tex.out
@@ -1,5 +1,15 @@
\documentclass[12pt]{report}
-\usepackage[]{inputenc}
+\usepackage[utf8x]{inputenc}
+
+%Warning: tipa declares many non-standard macros used by utf8x to
+%interpret utf8 characters but extra packages might have to be added
+%such as "textgreek" for Greek letters not already in tipa
+%or "stmaryrd" for mathematical symbols.
+%Utf8 codes missing a LaTeX interpretation can be defined by using
+%\DeclareUnicodeCharacter{code}{interpretation}.
+%Use coqdoc's option -p to add new packages or declarations.
+\usepackage{tipa}
+
\usepackage[T1]{fontenc}
\usepackage{fullpage}
\usepackage{coqdoc}
diff --git a/test-suite/coqdoc/links.html.out b/test-suite/coqdoc/links.html.out
index e2928f78d..5e4b676c2 100644
--- a/test-suite/coqdoc/links.html.out
+++ b/test-suite/coqdoc/links.html.out
@@ -2,7 +2,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="coqdoc.css" rel="stylesheet" type="text/css" />
<title>Coqdoc.links</title>
</head>
@@ -57,7 +57,7 @@ Various checks for coqdoc
<span class="id" title="keyword">Definition</span> <a name="a"><span class="id" title="definition">a</span></a> (<span class="id" title="var">b</span>: <a class="idref" href="http://coq.inria.fr/stdlib/Coq.Init.Datatypes.html#nat"><span class="id" title="inductive">nat</span></a>) := <a class="idref" href="Coqdoc.links.html#b"><span class="id" title="variable">b</span></a>.<br/>
<br/>
-<span class="id" title="keyword">Definition</span> <a name="f"><span class="id" title="definition">f</span></a> := <span class="id" title="keyword">forall</span> <span class="id" title="var">C</span>:<span class="id" title="keyword">Prop</span>, <a class="idref" href="Coqdoc.links.html#C"><span class="id" title="variable">C</span></a>.<br/>
+<span class="id" title="keyword">Definition</span> <a name="f"><span class="id" title="definition">f</span></a> := <span class="id" title="keyword">∀</span> <span class="id" title="var">C</span>:<span class="id" title="keyword">Prop</span>, <a class="idref" href="Coqdoc.links.html#C"><span class="id" title="variable">C</span></a>.<br/>
<br/>
<span class="id" title="keyword">Notation</span> <a name="1a1c7f13320341c3638e9edcc3e6389d"><span class="id" title="notation">&quot;</span></a>n ++ m" := (<a class="idref" href="http://coq.inria.fr/stdlib/Coq.Init.Peano.html#plus"><span class="id" title="abbreviation">plus</span></a> <span class="id" title="var">n</span> <span class="id" title="var">m</span>).<br/>
@@ -74,9 +74,9 @@ Various checks for coqdoc
<span class="id" title="keyword">Notation</span> <a name="347f39a83bf7d45676cff54fd7e8966f"><span class="id" title="notation">&quot;</span></a>n '_' ++ 'x' m" := (<a class="idref" href="http://coq.inria.fr/stdlib/Coq.Init.Peano.html#plus"><span class="id" title="abbreviation">plus</span></a> <span class="id" title="var">n</span> <span class="id" title="var">m</span>) (<span class="id" title="tactic">at</span> <span class="id" title="keyword">level</span> 3).<br/>
<br/>
-<span class="id" title="keyword">Inductive</span> <a name="eq"><span class="id" title="inductive">eq</span></a> (<span class="id" title="var">A</span>:<span class="id" title="keyword">Type</span>) (<span class="id" title="var">x</span>:<a class="idref" href="Coqdoc.links.html#A"><span class="id" title="variable">A</span></a>) : <span class="id" title="var">A</span> <a class="idref" href="http://coq.inria.fr/stdlib/Coq.Init.Logic.html#d43e996736952df71ebeeae74d10a287"><span class="id" title="notation">-&gt;</span></a> <span class="id" title="keyword">Prop</span> := <a name="eq_refl"><span class="id" title="constructor">eq_refl</span></a> : <a class="idref" href="Coqdoc.links.html#x"><span class="id" title="variable">x</span></a> <a class="idref" href="Coqdoc.links.html#8f9364556521ebb498093f28eea2240f"><span class="id" title="notation">=</span></a> <a class="idref" href="Coqdoc.links.html#x"><span class="id" title="variable">x</span></a> <a class="idref" href="Coqdoc.links.html#8f9364556521ebb498093f28eea2240f"><span class="id" title="notation">:&gt;</span></a><a class="idref" href="Coqdoc.links.html#A"><span class="id" title="variable">A</span></a><br/>
+<span class="id" title="keyword">Inductive</span> <a name="eq"><span class="id" title="inductive">eq</span></a> (<span class="id" title="var">A</span>:<span class="id" title="keyword">Type</span>) (<span class="id" title="var">x</span>:<a class="idref" href="Coqdoc.links.html#A"><span class="id" title="variable">A</span></a>) : <span class="id" title="var">A</span> <a class="idref" href="http://coq.inria.fr/stdlib/Coq.Init.Logic.html#d43e996736952df71ebeeae74d10a287"><span class="id" title="notation">→</span></a> <span class="id" title="keyword">Prop</span> := <a name="eq_refl"><span class="id" title="constructor">eq_refl</span></a> : <a class="idref" href="Coqdoc.links.html#x"><span class="id" title="variable">x</span></a> <a class="idref" href="Coqdoc.links.html#8f9364556521ebb498093f28eea2240f"><span class="id" title="notation">=</span></a> <a class="idref" href="Coqdoc.links.html#x"><span class="id" title="variable">x</span></a> <a class="idref" href="Coqdoc.links.html#8f9364556521ebb498093f28eea2240f"><span class="id" title="notation">:&gt;</span></a><a class="idref" href="Coqdoc.links.html#A"><span class="id" title="variable">A</span></a><br/>
<br/>
-<span class="id" title="keyword">where</span> <a name="8f9364556521ebb498093f28eea2240f"><span class="id" title="notation">&quot;</span></a>x = y :&gt; A" := (@<a class="idref" href="Coqdoc.links.html#eq"><span class="id" title="inductive">eq</span></a> <a class="idref" href="Coqdoc.links.html#A"><span class="id" title="variable">A</span></a> <a class="idref" href="Coqdoc.links.html#x"><span class="id" title="variable">x</span></a> <span class="id" title="var">y</span>) : <span class="id" title="var">type_scope</span>.<br/>
+<span class="id" title="keyword">where</span> <a name="8f9364556521ebb498093f28eea2240f"><span class="id" title="notation">&quot;</span></a>x = y :&gt; A" := (@<a class="idref" href="Coqdoc.links.html#eq"><span class="id" title="inductive">eq</span></a> <span class="id" title="var">A</span> <span class="id" title="var">x</span> <span class="id" title="var">y</span>) : <span class="id" title="var">type_scope</span>.<br/>
<br/>
<span class="id" title="keyword">Definition</span> <a name="eq0"><span class="id" title="definition">eq0</span></a> := 0 <a class="idref" href="Coqdoc.links.html#8f9364556521ebb498093f28eea2240f"><span class="id" title="notation">=</span></a> 0 <a class="idref" href="Coqdoc.links.html#8f9364556521ebb498093f28eea2240f"><span class="id" title="notation">:&gt;</span></a> <a class="idref" href="http://coq.inria.fr/stdlib/Coq.Init.Datatypes.html#nat"><span class="id" title="inductive">nat</span></a>.<br/>
diff --git a/test-suite/coqdoc/links.tex.out b/test-suite/coqdoc/links.tex.out
index de3182d1a..f42db99dc 100644
--- a/test-suite/coqdoc/links.tex.out
+++ b/test-suite/coqdoc/links.tex.out
@@ -1,5 +1,15 @@
\documentclass[12pt]{report}
-\usepackage[]{inputenc}
+\usepackage[utf8x]{inputenc}
+
+%Warning: tipa declares many non-standard macros used by utf8x to
+%interpret utf8 characters but extra packages might have to be added
+%such as "textgreek" for Greek letters not already in tipa
+%or "stmaryrd" for mathematical symbols.
+%Utf8 codes missing a LaTeX interpretation can be defined by using
+%\DeclareUnicodeCharacter{code}{interpretation}.
+%Use coqdoc's option -p to add new packages or declarations.
+\usepackage{tipa}
+
\usepackage[T1]{fontenc}
\usepackage{fullpage}
\usepackage{coqdoc}
@@ -59,7 +69,7 @@ Various checks for coqdoc
\coqdocnoindent
\coqdoceol
\coqdocnoindent
-\coqdockw{where} \coqdef{Coqdoc.links.:type scope:x '=' x ':>' x}{"}{"}x = y :> A" := (@\coqref{Coqdoc.links.eq}{\coqdocinductive{eq}} \coqdocvariable{A} \coqdocvariable{x} \coqdocvar{y}) : \coqdocvar{type\_scope}.\coqdoceol
+\coqdockw{where} \coqdef{Coqdoc.links.:type scope:x '=' x ':>' x}{"}{"}x = y :> A" := (@\coqref{Coqdoc.links.eq}{\coqdocinductive{eq}} \coqdocvar{A} \coqdocvar{x} \coqdocvar{y}) : \coqdocvar{type\_scope}.\coqdoceol
\coqdocemptyline
\coqdocnoindent
\coqdockw{Definition} \coqdef{Coqdoc.links.eq0}{eq0}{\coqdocdefinition{eq0}} := 0 \coqref{Coqdoc.links.:type scope:x '=' x ':>' x}{\coqdocnotation{=}} 0 \coqref{Coqdoc.links.:type scope:x '=' x ':>' x}{\coqdocnotation{:>}} \coqexternalref{nat}{http://coq.inria.fr/stdlib/Coq.Init.Datatypes}{\coqdocinductive{nat}}.\coqdoceol
diff --git a/test-suite/output-modulo-time/ltacprof.out b/test-suite/output-modulo-time/ltacprof.out
index cc04c2c9b..5553e1b38 100644
--- a/test-suite/output-modulo-time/ltacprof.out
+++ b/test-suite/output-modulo-time/ltacprof.out
@@ -1,12 +1,15 @@
-total time: 1.528s
+total time: 1.032s
- tactic local total calls max
+ tactic local total calls max
────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
-─sleep' -------------------------------- 100.0% 100.0% 1 1.528s
+─sleep' -------------------------------- 100.0% 100.0% 1 1.032s
+─sleep --------------------------------- 0.0% 0.0% 0 0.000s
─constructor --------------------------- 0.0% 0.0% 1 0.000s
- tactic local total calls max
+ tactic local total calls max
────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
-─sleep' -------------------------------- 100.0% 100.0% 1 1.528s
+─sleep' -------------------------------- 100.0% 100.0% 1 1.032s
+─sleep --------------------------------- 0.0% 0.0% 0 0.000s
+â””sleep' -------------------------------- 0.0% 0.0% 0 0.000s
─constructor --------------------------- 0.0% 0.0% 1 0.000s
diff --git a/test-suite/output-modulo-time/ltacprof_abstract.out b/test-suite/output-modulo-time/ltacprof_abstract.out
new file mode 100644
index 000000000..fef4fa248
--- /dev/null
+++ b/test-suite/output-modulo-time/ltacprof_abstract.out
@@ -0,0 +1,17 @@
+total time: 0.922s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─abstract (sleep; constructor) --------- 0.0% 100.0% 1 0.922s
+─sleep' -------------------------------- 100.0% 100.0% 1 0.922s
+─constructor --------------------------- 0.0% 0.0% 1 0.000s
+─sleep --------------------------------- 0.0% 0.0% 0 0.000s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─abstract (sleep; constructor) --------- 0.0% 100.0% 1 0.922s
+ ├─sleep' ------------------------------ 100.0% 100.0% 1 0.922s
+ ├─constructor ------------------------- 0.0% 0.0% 1 0.000s
+ └─sleep ------------------------------- 0.0% 0.0% 0 0.000s
+ â””sleep' ------------------------------ 0.0% 0.0% 0 0.000s
+
diff --git a/test-suite/output-modulo-time/ltacprof_abstract.v b/test-suite/output-modulo-time/ltacprof_abstract.v
new file mode 100644
index 000000000..10a76309e
--- /dev/null
+++ b/test-suite/output-modulo-time/ltacprof_abstract.v
@@ -0,0 +1,8 @@
+(* -*- coq-prog-args: ("-profile-ltac-cutoff" "0.0") -*- *)
+Ltac sleep' := do 100 (do 100 (do 100 idtac)).
+Ltac sleep := sleep'.
+
+Theorem x : True.
+Proof.
+ idtac. idtac. abstract (sleep; constructor).
+Defined.
diff --git a/test-suite/output-modulo-time/ltacprof_cutoff.out b/test-suite/output-modulo-time/ltacprof_cutoff.out
index 0cd5777cc..d91a38bb5 100644
--- a/test-suite/output-modulo-time/ltacprof_cutoff.out
+++ b/test-suite/output-modulo-time/ltacprof_cutoff.out
@@ -1,31 +1,37 @@
-total time: 1.584s
+total time: 1.632s
tactic local total calls max
────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
-─foo2 ---------------------------------- 0.0% 100.0% 1 1.584s
-─sleep --------------------------------- 100.0% 100.0% 3 0.572s
-─foo1 ---------------------------------- 0.0% 63.9% 1 1.012s
+─sleep --------------------------------- 100.0% 100.0% 3 0.584s
+─foo2 ---------------------------------- 0.0% 100.0% 1 1.632s
+─foo1 ---------------------------------- 0.0% 64.2% 1 1.048s
tactic local total calls max
────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
-─foo2 ---------------------------------- 0.0% 100.0% 1 1.584s
-â””foo1 ---------------------------------- 0.0% 63.9% 1 1.012s
+─foo2 ---------------------------------- 0.0% 100.0% 1 1.632s
+â””foo1 ---------------------------------- 0.0% 64.2% 1 1.048s
-total time: 1.584s
+total time: 0.520s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─foo2 ---------------------------------- 0.0% 100.0% 1 0.520s
+─sleep --------------------------------- 99.2% 99.2% 52 0.016s
+─foo1 ---------------------------------- 0.0% 97.7% 1 0.508s
+─foo0 ---------------------------------- 0.8% 96.2% 1 0.500s
+
+ tactic local total calls max
+────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
+─foo2 ---------------------------------- 0.0% 100.0% 1 0.520s
+â””foo1 ---------------------------------- 0.0% 97.7% 1 0.508s
+â””foo0 ---------------------------------- 0.8% 96.2% 1 0.500s
+â””sleep --------------------------------- 95.4% 95.4% 50 0.016s
+
+total time: 0.000s
tactic local total calls max
────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
-─sleep --------------------------------- 100.0% 100.0% 3 0.572s
-─foo2 ---------------------------------- 0.0% 100.0% 1 1.584s
-─foo1 ---------------------------------- 0.0% 63.9% 1 1.012s
-─foo0 ---------------------------------- 0.0% 31.3% 1 0.496s
tactic local total calls max
────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
-─foo2 ---------------------------------- 0.0% 100.0% 1 1.584s
- ├─foo1 -------------------------------- 0.0% 63.9% 1 1.012s
- │ ├─sleep ----------------------------- 32.6% 32.6% 1 0.516s
- │ └─foo0 ------------------------------ 0.0% 31.3% 1 0.496s
- │ └sleep ----------------------------- 31.3% 31.3% 1 0.496s
- └─sleep ------------------------------- 36.1% 36.1% 1 0.572s
diff --git a/test-suite/output-modulo-time/ltacprof_cutoff.v b/test-suite/output-modulo-time/ltacprof_cutoff.v
index 3dad6271a..ae5d51bae 100644
--- a/test-suite/output-modulo-time/ltacprof_cutoff.v
+++ b/test-suite/output-modulo-time/ltacprof_cutoff.v
@@ -1,12 +1,28 @@
(* -*- coq-prog-args: ("-profile-ltac") -*- *)
Require Coq.ZArith.BinInt.
-Ltac sleep := do 50 (idtac; let sleep := (eval vm_compute in Coq.ZArith.BinInt.Z.div_eucl) in idtac).
+Module WithIdTac.
+ Ltac sleep := do 50 (idtac; let sleep := (eval vm_compute in Coq.ZArith.BinInt.Z.div_eucl) in idtac).
-Ltac foo0 := idtac; sleep.
-Ltac foo1 := sleep; foo0.
-Ltac foo2 := sleep; foo1.
-Goal True.
- foo2.
- Show Ltac Profile CutOff 47.
- constructor.
-Qed.
+ Ltac foo0 := idtac; sleep.
+ Ltac foo1 := sleep; foo0.
+ Ltac foo2 := sleep; foo1.
+ Goal True.
+ foo2.
+ Show Ltac Profile CutOff 47.
+ constructor.
+ Qed.
+End WithIdTac.
+
+Module TestEval.
+ Ltac sleep := let sleep := (eval vm_compute in Coq.ZArith.BinInt.Z.div_eucl) in idtac.
+
+ Ltac foo0 := idtac; do 50 (idtac; sleep).
+ Ltac foo1 := sleep; foo0.
+ Ltac foo2 := sleep; foo1.
+ Goal True.
+ Reset Ltac Profile.
+ foo2.
+ Show Ltac Profile CutOff 47.
+ constructor.
+ Qed.
+End TestEval.
diff --git a/test-suite/output/Cases.out b/test-suite/output/Cases.out
index 97fa8e254..419dcadb4 100644
--- a/test-suite/output/Cases.out
+++ b/test-suite/output/Cases.out
@@ -95,8 +95,7 @@ fun dd : nat * nat => let (bb, cc) as aa return (aa = aa) := dd in eq_refl
x : nat
n, n0 := match x + 0 with
- | 0 => 0
- | S _ => 0
+ | 0 | S _ => 0
end : nat
e,
e0 := match x + 0 as y return (y = y) with
@@ -104,8 +103,7 @@ fun dd : nat * nat => let (bb, cc) as aa return (aa = aa) := dd in eq_refl
| S n => eq_refl
end : x + 0 = x + 0
n1, n2 := match x with
- | 0 => 0
- | S _ => 0
+ | 0 | S _ => 0
end : nat
e1, e2 := match x return (x = x) with
| 0 => eq_refl
@@ -126,3 +124,48 @@ fun dd : nat * nat => let (bb, cc) as aa return (aa = aa) := dd in eq_refl
end : p = p /\ p = p
============================
eq_refl = eq_refl
+fun x : comparison => match x with
+ | Eq => 1
+ | _ => 0
+ end
+ : comparison -> nat
+fun x : comparison => match x with
+ | Eq => 1
+ | Lt => 0
+ | Gt => 0
+ end
+ : comparison -> nat
+fun x : comparison => match x with
+ | Eq => 1
+ | Lt | Gt => 0
+ end
+ : comparison -> nat
+fun x : comparison =>
+match x return nat with
+| Eq => S O
+| Lt => O
+| Gt => O
+end
+ : forall _ : comparison, nat
+fun x : K => match x with
+ | a3 | a4 => 3
+ | _ => 2
+ end
+ : K -> nat
+fun x : K => match x with
+ | a1 | a2 => 4
+ | a3 => 3
+ | _ => 2
+ end
+ : K -> nat
+fun x : K => match x with
+ | a1 | a2 => 4
+ | a4 => 3
+ | _ => 2
+ end
+ : K -> nat
+fun x : K => match x with
+ | a1 | a3 | a4 => 3
+ | _ => 2
+ end
+ : K -> nat
diff --git a/test-suite/output/Cases.v b/test-suite/output/Cases.v
index 17fee3303..caf3b2870 100644
--- a/test-suite/output/Cases.v
+++ b/test-suite/output/Cases.v
@@ -1,5 +1,7 @@
(* Cases with let-in in constructors types *)
+Unset Printing Allow Match Default Clause.
+
Inductive t : Set :=
k : let x := t in x -> x.
@@ -184,3 +186,33 @@ let p := fresh "p" in
|- eq_refl ?p = _ => pose (match eq_refl p in _ = z return p=p /\ z=z with eq_refl => conj eq_refl eq_refl end)
end.
Show.
+
+Set Printing Allow Match Default Clause.
+
+(***************************************************)
+(* Testing strategy for factorizing cases branches *)
+
+(* Factorization + default clause *)
+Check fun x => match x with Eq => 1 | _ => 0 end.
+
+(* No factorization *)
+Unset Printing Factorizable Match Patterns.
+Check fun x => match x with Eq => 1 | _ => 0 end.
+Set Printing Factorizable Match Patterns.
+
+(* Factorization but no default clause *)
+Unset Printing Allow Match Default Clause.
+Check fun x => match x with Eq => 1 | _ => 0 end.
+Set Printing Allow Match Default Clause.
+
+(* No factorization in printing all mode *)
+Set Printing All.
+Check fun x => match x with Eq => 1 | _ => 0 end.
+Unset Printing All.
+
+(* Several clauses *)
+Inductive K := a1|a2|a3|a4|a5|a6.
+Check fun x => match x with a3 | a4 => 3 | _ => 2 end.
+Check fun x => match x with a3 => 3 | a2 | a1 => 4 | _ => 2 end.
+Check fun x => match x with a4 => 3 | a2 | a1 => 4 | _ => 2 end.
+Check fun x => match x with a3 | a4 | a1 => 3 | _ => 2 end.
diff --git a/test-suite/output/Extraction_infix.out b/test-suite/output/Extraction_infix.out
new file mode 100644
index 000000000..29d50775a
--- /dev/null
+++ b/test-suite/output/Extraction_infix.out
@@ -0,0 +1,20 @@
+(** val test : foo **)
+
+let test =
+ (fun (b, p) -> bar) (True, False)
+(** val test : foo **)
+
+let test =
+ True@@?False
+(** val test : foo **)
+
+let test =
+ True#^^False
+(** val test : foo **)
+
+let test =
+ True@?:::False
+(** val test : foo **)
+
+let test =
+ True @?::: False
diff --git a/test-suite/output/Extraction_infix.v b/test-suite/output/Extraction_infix.v
new file mode 100644
index 000000000..fe5926a36
--- /dev/null
+++ b/test-suite/output/Extraction_infix.v
@@ -0,0 +1,26 @@
+(* @herbelin's example for issue #6212 *)
+
+Require Import Extraction.
+Inductive I := C : bool -> bool -> I.
+Definition test := C true false.
+
+(* the parentheses around the function wrong signalled an infix operator *)
+
+Extract Inductive I => "foo" [ "(fun (b, p) -> bar)" ].
+Extraction test.
+
+(* some bonafide infix operators *)
+
+Extract Inductive I => "foo" [ "(@@?)" ].
+Extraction test.
+
+Extract Inductive I => "foo" [ "(#^^)" ].
+Extraction test.
+
+Extract Inductive I => "foo" [ "(@?:::)" ].
+Extraction test.
+
+(* allow whitespace around infix operator *)
+
+Extract Inductive I => "foo" [ "( @?::: )" ].
+Extraction test.
diff --git a/test-suite/output/InvalidDisjunctiveIntro.out b/test-suite/output/InvalidDisjunctiveIntro.out
new file mode 100644
index 000000000..25a306b45
--- /dev/null
+++ b/test-suite/output/InvalidDisjunctiveIntro.out
@@ -0,0 +1,16 @@
+The command has indeed failed with message:
+Cannot coerce to a disjunctive/conjunctive pattern.
+The command has indeed failed with message:
+Disjunctive/conjunctive introduction pattern expected.
+The command has indeed failed with message:
+Cannot coerce to a disjunctive/conjunctive pattern.
+The command has indeed failed with message:
+Cannot coerce to a disjunctive/conjunctive pattern.
+The command has indeed failed with message:
+Ltac variable H is bound to <tactic closure> which cannot be coerced to
+an introduction pattern.
+The command has indeed failed with message:
+Disjunctive/conjunctive introduction pattern expected.
+The command has indeed failed with message:
+Ltac variable H' is bound to <tactic closure> which cannot be coerced to
+an introduction pattern.
diff --git a/test-suite/output/InvalidDisjunctiveIntro.v b/test-suite/output/InvalidDisjunctiveIntro.v
new file mode 100644
index 000000000..4febdf034
--- /dev/null
+++ b/test-suite/output/InvalidDisjunctiveIntro.v
@@ -0,0 +1,18 @@
+Theorem test (A:Prop) : A \/ A -> A.
+ Fail intros H; destruct H as H.
+ (* Cannot coerce to a disjunctive/conjunctive pattern. *)
+ Fail intro H; destruct H as H.
+ (* Disjunctive/conjunctive introduction pattern expected. *)
+ Fail let H := fresh in intro H; destruct H as H.
+ (* Cannot coerce to a disjunctive/conjunctive pattern. *)
+ Fail let H := fresh in intros H; destruct H as H.
+ (* Cannot coerce to a disjunctive/conjunctive pattern. *)
+ Fail let H := idtac in intros H; destruct H as H.
+ (* Ltac variable H is bound to <tactic closure> which cannot be
+coerced to an introduction pattern. *)
+ Fail let H := idtac in intros H; destruct H as H'.
+ (* Disjunctive/conjunctive introduction pattern expected. *)
+ Fail let H' := idtac in intros H; destruct H as H'.
+(* Ltac variable H' is bound to <tactic closure> which cannot
+be coerced to an introduction pattern. *)
+Abort.
diff --git a/test-suite/output/MExtraction.v b/test-suite/output/MExtraction.v
new file mode 100644
index 000000000..352e422cf
--- /dev/null
+++ b/test-suite/output/MExtraction.v
@@ -0,0 +1,12 @@
+Require Import micromega.MExtraction.
+Require Import RingMicromega.
+Require Import QArith.
+Require Import VarMap.
+Require Import ZMicromega.
+Require Import QMicromega.
+Require Import RMicromega.
+
+Recursive Extraction
+ List.map RingMicromega.simpl_cone (*map_cone indexes*)
+ denorm Qpower vm_add
+ n_of_Z N.of_nat ZTautoChecker ZWeakChecker QTautoChecker RTautoChecker find.
diff --git a/test-suite/output/Notations.out b/test-suite/output/Notations.out
index 7bcd7b041..2f0ee765d 100644
--- a/test-suite/output/Notations.out
+++ b/test-suite/output/Notations.out
@@ -64,7 +64,7 @@ The command has indeed failed with message:
Cannot find where the recursive pattern starts.
The command has indeed failed with message:
Both ends of the recursive pattern are the same.
-SUM (nat * nat) nat
+(nat * nat + nat)%type
: Set
FST (0; 1)
: Z
@@ -72,7 +72,7 @@ Nil
: forall A : Type, list A
NIL : list nat
: list nat
-(false && I 3)%bool /\ I 6
+(false && I 3)%bool /\ (I 6)%bool
: Prop
[|1, 2, 3; 4, 5, 6|]
: Z * Z * Z * (Z * Z * Z)
diff --git a/test-suite/output/Notations.v b/test-suite/output/Notations.v
index fe6c05c39..413812ee1 100644
--- a/test-suite/output/Notations.v
+++ b/test-suite/output/Notations.v
@@ -30,7 +30,7 @@ Check (decomp (true,true) as t, u in (t,u)).
Section A.
-Notation "! A" := (forall _:nat, A) (at level 60).
+Notation "! A" := (forall _:nat, A) (at level 60) : type_scope.
Check ! (0=0).
Check forall n, n=0.
@@ -194,9 +194,9 @@ Open Scope nat_scope.
Coercion is_true := fun b => b=true.
Coercion of_nat n := match n with 0 => true | _ => false end.
-Notation "'I' x" := (of_nat (S x) || true)%bool (at level 10).
+Notation "'I' x" := (of_nat (S x) || true)%bool (at level 10) : bool_scope.
-Check (false && I 3)%bool /\ I 6.
+Check (false && I 3)%bool /\ (I 6)%bool.
(**********************************************************************)
(* Check notations with several recursive patterns *)
diff --git a/test-suite/output/Notations2.out b/test-suite/output/Notations2.out
index 1ec701ae8..121a369a9 100644
--- a/test-suite/output/Notations2.out
+++ b/test-suite/output/Notations2.out
@@ -37,11 +37,22 @@ let' f (x y : nat) (a := 0) (z : nat) (_ : bool) := x + y + z + 1 in f 0 1 2
λ (f : nat -> nat) (x : nat), f(x) + S(x)
: (nat -> nat) -> nat -> nat
Notation plus2 n := (S(S(n)))
+λ n : list(nat), match n with
+ | 1 :: nil => 0
+ | _ => 2
+ end
+ : list(nat) -> nat
+λ n : list(nat),
+match n with
+| 1 :: nil => 0
+| nil | 0 :: _ | 1 :: _ :: _ | plus2 _ :: _ => 2
+end
+ : list(nat) -> nat
λ n : list(nat),
match n with
| nil => 2
| 0 :: _ => 2
-| list1 => 0
+| 1 :: nil => 0
| 1 :: _ :: _ => 2
| plus2 _ :: _ => 2
end
@@ -84,3 +95,9 @@ a≡
: Set
.α
: Set
+# a : .α =>
+# b : .α =>
+let res := 0 in
+for i from 0 to a updating (res)
+{{for j from 0 to b updating (res) {{S res}};; res}};; res
+ : .α -> .α -> .α
diff --git a/test-suite/output/Notations2.v b/test-suite/output/Notations2.v
index ceb29d1b9..531398bb0 100644
--- a/test-suite/output/Notations2.v
+++ b/test-suite/output/Notations2.v
@@ -70,6 +70,7 @@ Check let' f x y (a:=0) z (b:bool) := x+y+z+1 in f 0 1 2.
(* Note: does not work for pattern *)
Module A.
Notation "f ( x )" := (f x) (at level 10, format "f ( x )").
+Open Scope nat_scope.
Check fun f x => f x + S x.
Open Scope list_scope.
@@ -78,6 +79,13 @@ Notation plus2 n := (S (S n)).
(* plus2 was not correctly printed in the two following tests in 8.3pl1 *)
Print plus2.
Check fun n => match n with list1 => 0 | _ => 2 end.
+Unset Printing Allow Match Default Clause.
+Check fun n => match n with list1 => 0 | _ => 2 end.
+Unset Printing Factorizable Match Patterns.
+Check fun n => match n with list1 => 0 | _ => 2 end.
+Set Printing Allow Match Default Clause.
+Set Printing Factorizable Match Patterns.
+
End A.
(* This one is not fully satisfactory because binders in the same type
@@ -145,3 +153,24 @@ Check .a≡.
Notation ".α" := nat.
Check nat.
Check .α.
+
+(* A test for #6304 *)
+
+Module M6304.
+Notation "'for' m 'from' 0 'to' N 'updating' ( s1 ) {{ b }} ;; rest" :=
+ (let s1 :=
+ (fix rec(n: nat) := match n with
+ | 0 => s1
+ | S m => let s1 := rec m in b
+ end) N
+ in rest)
+ (at level 20).
+
+Check fun (a b : nat) =>
+ let res := 0 in
+ for i from 0 to a updating (res) {{
+ for j from 0 to b updating (res) {{ S res }};;
+ res
+ }};; res.
+
+End M6304.
diff --git a/test-suite/output/Notations3.out b/test-suite/output/Notations3.out
index 6ef75dd13..1b5725275 100644
--- a/test-suite/output/Notations3.out
+++ b/test-suite/output/Notations3.out
@@ -128,3 +128,13 @@ return (1, 2, 3, 4)
: nat
*(1.2)
: nat
+[{0; 0}]
+ : list (list nat)
+[{1; 2; 3};
+ {4; 5; 6};
+ {7; 8; 9}]
+ : list (list nat)
+amatch = mmatch 0 (with 0 => 1| 1 => 2 end)
+ : unit
+alist = [0; 1; 2]
+ : list nat
diff --git a/test-suite/output/Notations3.v b/test-suite/output/Notations3.v
index 8c7bbe591..a8d6c97fb 100644
--- a/test-suite/output/Notations3.v
+++ b/test-suite/output/Notations3.v
@@ -59,7 +59,7 @@ Check fun f => CURRYINVLEFT (x:nat) (y:bool), f.
(* Notations with variables bound both as a term and as a binder *)
(* This is #4592 *)
-Notation "{# x | P }" := (ex2 (fun y => x = y) (fun x => P)).
+Notation "{# x | P }" := (ex2 (fun y => x = y) (fun x => P)) : type_scope.
Check forall n:nat, {# n | 1 > n}.
Parameter foo : forall {T}(x : T)(P : T -> Prop), Prop.
@@ -183,9 +183,13 @@ Check letpair x [1] = {0}; return (1,2,3,4).
(* Test spacing in #5569 *)
+Section S1.
+Variable plus : nat -> nat -> nat.
+Infix "+" := plus.
Notation "{ { xL | xR // xcut } }" := (xL+xR+xcut)
(at level 0, xR at level 39, format "{ { xL | xR // xcut } }").
Check 1+1+1.
+End S1.
(* Test presence of notation variables in the recursive parts (introduced in dfdaf4de) *)
Notation "!!! x .. y , b" := ((fun x => b), .. ((fun y => b), True) ..) (at level 200, x binder).
@@ -193,7 +197,59 @@ Check !!! (x y:nat), True.
(* Allow level for leftmost nonterminal when printing-only, BZ#5739 *)
-Notation "* x" := (id x) (only printing, at level 15, format "* x").
-Notation "x . y" := (x + y) (only printing, at level 20, x at level 14, left associativity, format "x . y").
+Section S2.
+Notation "* x" := (id x) (only printing, at level 15, format "* x") : nat_scope.
+Notation "x . y" := (x + y) (only printing, at level 20, x at level 14, left associativity, format "x . y") : nat_scope.
Check (((id 1) + 2) + 3).
Check (id (1 + 2)).
+End S2.
+
+(* Test printing of notations guided by scope *)
+
+Module A.
+
+Delimit Scope line_scope with line.
+Notation "{ }" := nil (format "{ }") : line_scope.
+Notation "{ x }" := (cons x nil) : line_scope.
+Notation "{ x ; y ; .. ; z }" := (cons x (cons y .. (cons z nil) ..)) : line_scope.
+Notation "[ ]" := nil (format "[ ]") : matx_scope.
+Notation "[ l ]" := (cons l%line nil) : matx_scope.
+Notation "[ l ; l' ; .. ; l'' ]" := (cons l%line (cons l'%line .. (cons l''%line nil) ..))
+ (format "[ '[v' l ; '/' l' ; '/' .. ; '/' l'' ']' ]") : matx_scope.
+
+Open Scope matx_scope.
+Check [[0;0]].
+Check [[1;2;3];[4;5;6];[7;8;9]].
+
+End A.
+
+(* Example by Beta Ziliani *)
+
+Require Import Lists.List.
+
+Module B.
+
+Import ListNotations.
+
+Delimit Scope pattern_scope with pattern.
+Delimit Scope patterns_scope with patterns.
+
+Notation "a => b" := (a, b) (at level 201) : pattern_scope.
+Notation "'with' p1 | .. | pn 'end'" :=
+ ((cons p1%pattern (.. (cons pn%pattern nil) ..)))
+ (at level 91, p1 at level 210, pn at level 210) : patterns_scope.
+
+Definition mymatch (n:nat) (l : list (nat * nat)) := tt.
+Arguments mymatch _ _%patterns.
+Notation "'mmatch' n ls" := (mymatch n ls) (at level 0).
+
+Close Scope patterns_scope.
+Close Scope pattern_scope.
+
+Definition amatch := mmatch 0 with 0 => 1 | 1 => 2 end.
+Print amatch. (* Good: amatch = mmatch 0 (with 0 => 1| 1 => 2 end) *)
+
+Definition alist := [0;1;2].
+Print alist.
+
+End B.
diff --git a/test-suite/output/UnivBinders.out b/test-suite/output/UnivBinders.out
index 904ff68aa..668b4e578 100644
--- a/test-suite/output/UnivBinders.out
+++ b/test-suite/output/UnivBinders.out
@@ -1,12 +1,175 @@
+NonCumulative Inductive Empty@{u} : Type@{u} :=
+NonCumulative Record PWrap (A : Type@{u}) : Type@{u} := pwrap { punwrap : A }
+
+PWrap has primitive projections with eta conversion.
+For PWrap: Argument scope is [type_scope]
+For pwrap: Argument scopes are [type_scope _]
+punwrap@{u} =
+fun (A : Type@{u}) (p : PWrap@{u} A) => p.(punwrap)
+ : forall A : Type@{u}, PWrap@{u} A -> A
+(* u |= *)
+
+punwrap is universe polymorphic
+Argument scopes are [type_scope _]
+NonCumulative Record RWrap (A : Type@{u}) : Type@{u} := rwrap { runwrap : A }
+
+For RWrap: Argument scope is [type_scope]
+For rwrap: Argument scopes are [type_scope _]
+runwrap@{u} =
+fun (A : Type@{u}) (r : RWrap@{u} A) => let (runwrap) := r in runwrap
+ : forall A : Type@{u}, RWrap@{u} A -> A
+(* u |= *)
+
+runwrap is universe polymorphic
+Argument scopes are [type_scope _]
+Wrap@{u} = fun A : Type@{u} => A
+ : Type@{u} -> Type@{u}
+(* u |= *)
+
+Wrap is universe polymorphic
+Argument scope is [type_scope]
+wrap@{u} =
+fun (A : Type@{u}) (Wrap : Wrap@{u} A) => Wrap
+ : forall A : Type@{u}, Wrap@{u} A -> A
+(* u |= *)
+
+wrap is universe polymorphic
+Arguments A, Wrap are implicit and maximally inserted
+Argument scopes are [type_scope _]
bar@{u} = nat
: Wrap@{u} Set
(* u |= Set < u
*)
bar is universe polymorphic
-foo@{u Top.8 v} =
-Type@{Top.8} -> Type@{v} -> Type@{u}
- : Type@{max(u+1, Top.8+1, v+1)}
-(* u Top.8 v |= *)
+foo@{u Top.17 v} =
+Type@{Top.17} -> Type@{v} -> Type@{u}
+ : Type@{max(u+1,Top.17+1,v+1)}
+(* u Top.17 v |= *)
foo is universe polymorphic
+Monomorphic mono = Type@{mono.u}
+ : Type@{mono.u+1}
+(* {mono.u} |= *)
+
+mono is not universe polymorphic
+mono
+ : Type@{mono.u+1}
+Type@{mono.u}
+ : Type@{mono.u+1}
+The command has indeed failed with message:
+Universe u already exists.
+monomono
+ : Type@{MONOU+1}
+mono.monomono
+ : Type@{mono.MONOU+1}
+monomono
+ : Type@{MONOU+1}
+mono
+ : Type@{mono.u+1}
+The command has indeed failed with message:
+Universe u already exists.
+bobmorane =
+let tt := Type@{tt.v} in let ff := Type@{ff.v} in tt -> ff
+ : Type@{max(tt.u,ff.u)}
+The command has indeed failed with message:
+Universe u already bound.
+foo@{E M N} =
+Type@{M} -> Type@{N} -> Type@{E}
+ : Type@{max(E+1,M+1,N+1)}
+(* E M N |= *)
+
+foo is universe polymorphic
+foo@{Top.16 Top.17 Top.18} =
+Type@{Top.17} -> Type@{Top.18} -> Type@{Top.16}
+ : Type@{max(Top.16+1,Top.17+1,Top.18+1)}
+(* Top.16 Top.17 Top.18 |= *)
+
+foo is universe polymorphic
+NonCumulative Inductive Empty@{E} : Type@{E} :=
+NonCumulative Record PWrap (A : Type@{E}) : Type@{E} := pwrap { punwrap : A }
+
+PWrap has primitive projections with eta conversion.
+For PWrap: Argument scope is [type_scope]
+For pwrap: Argument scopes are [type_scope _]
+punwrap@{K} : forall A : Type@{K}, PWrap@{K} A -> A
+(* K |= *)
+
+punwrap is universe polymorphic
+Argument scopes are [type_scope _]
+punwrap is transparent
+Expands to: Constant Top.punwrap
+The command has indeed failed with message:
+Universe instance should have length 3
+The command has indeed failed with message:
+Universe instance should have length 0
+The command has indeed failed with message:
+This object does not support universe names.
+The command has indeed failed with message:
+Cannot enforce v < u because u < gU < gV < v
+Monomorphic bind_univs.mono =
+Type@{bind_univs.mono.u}
+ : Type@{bind_univs.mono.u+1}
+(* {bind_univs.mono.u} |= *)
+
+bind_univs.mono is not universe polymorphic
+bind_univs.poly@{u} = Type@{u}
+ : Type@{u+1}
+(* u |= *)
+
+bind_univs.poly is universe polymorphic
+insec@{v} = Type@{u} -> Type@{v}
+ : Type@{max(u+1,v+1)}
+(* v |= *)
+
+insec is universe polymorphic
+insec@{u v} = Type@{u} -> Type@{v}
+ : Type@{max(u+1,v+1)}
+(* u v |= *)
+
+insec is universe polymorphic
+inmod@{u} = Type@{u}
+ : Type@{u+1}
+(* u |= *)
+
+inmod is universe polymorphic
+SomeMod.inmod@{u} = Type@{u}
+ : Type@{u+1}
+(* u |= *)
+
+SomeMod.inmod is universe polymorphic
+inmod@{u} = Type@{u}
+ : Type@{u+1}
+(* u |= *)
+
+inmod is universe polymorphic
+Applied.infunct@{u v} =
+inmod@{u} -> Type@{v}
+ : Type@{max(u+1,v+1)}
+(* u v |= *)
+
+Applied.infunct is universe polymorphic
+axfoo@{i Top.41 Top.42} : Type@{Top.41} -> Type@{i}
+(* i Top.41 Top.42 |= *)
+
+axfoo is universe polymorphic
+Argument scope is [type_scope]
+Expands to: Constant Top.axfoo
+axbar@{i Top.41 Top.42} : Type@{Top.42} -> Type@{i}
+(* i Top.41 Top.42 |= *)
+
+axbar is universe polymorphic
+Argument scope is [type_scope]
+Expands to: Constant Top.axbar
+axfoo' : Type@{Top.44} -> Type@{axbar'.i}
+
+axfoo' is not universe polymorphic
+Argument scope is [type_scope]
+Expands to: Constant Top.axfoo'
+axbar' : Type@{Top.44} -> Type@{axbar'.i}
+
+axbar' is not universe polymorphic
+Argument scope is [type_scope]
+Expands to: Constant Top.axbar'
+The command has indeed failed with message:
+When declaring multiple axioms in one command, only the first is allowed a universe binder (which will be shared by the whole block).
diff --git a/test-suite/output/UnivBinders.v b/test-suite/output/UnivBinders.v
index 8656ff1a3..266d94ad9 100644
--- a/test-suite/output/UnivBinders.v
+++ b/test-suite/output/UnivBinders.v
@@ -1,13 +1,146 @@
Set Universe Polymorphism.
Set Printing Universes.
-Unset Strict Universe Declaration.
+(* Unset Strict Universe Declaration. *)
+
+(* universe binders on inductive types and record projections *)
+Inductive Empty@{u} : Type@{u} := .
+Print Empty.
+
+Set Primitive Projections.
+Record PWrap@{u} (A:Type@{u}) := pwrap { punwrap : A }.
+Print PWrap.
+Print punwrap.
+
+Unset Primitive Projections.
+Record RWrap@{u} (A:Type@{u}) := rwrap { runwrap : A }.
+Print RWrap.
+Print runwrap.
-Class Wrap A := wrap : A.
+(* universe binders also go on the constants for operational typeclasses. *)
+Class Wrap@{u} (A:Type@{u}) := wrap : A.
+Print Wrap.
+Print wrap.
-Instance bar@{u} : Wrap@{u} Set. Proof nat.
+(* Instance in lemma mode used to ignore the binders. *)
+Instance bar@{u} : Wrap@{u} Set. Proof. exact nat. Qed.
Print bar.
+Unset Strict Universe Declaration.
(* The universes in the binder come first, then the extra universes in
order of appearance. *)
Definition foo@{u +} := Type -> Type@{v} -> Type@{u}.
Print foo.
+Set Strict Universe Declaration.
+
+(* Binders even work with monomorphic definitions! *)
+Monomorphic Definition mono@{u} := Type@{u}.
+Print mono.
+Check mono.
+Check Type@{mono.u}.
+
+Module mono.
+ Fail Monomorphic Universe u.
+ Monomorphic Universe MONOU.
+
+ Monomorphic Definition monomono := Type@{MONOU}.
+ Check monomono.
+End mono.
+Check mono.monomono. (* qualified MONOU *)
+Import mono.
+Check monomono. (* unqualified MONOU *)
+Check mono. (* still qualified mono.u *)
+
+Monomorphic Constraint Set < Top.mono.u.
+
+Module mono2.
+ Monomorphic Universe u.
+End mono2.
+
+Fail Monomorphic Definition mono2@{u} := Type@{u}.
+
+Module SecLet.
+ Unset Universe Polymorphism.
+ Section foo.
+ (* Fail Let foo@{} := Type@{u}. (* doesn't parse: Let foo@{...} doesn't exist *) *)
+ Unset Strict Universe Declaration.
+ Let tt : Type@{u} := Type@{v}. (* names disappear in the ether *)
+ Let ff : Type@{u}. Proof. exact Type@{v}. Qed. (* if Set Universe Polymorphism: universes are named ff.u and ff.v. Otherwise names disappear into space *)
+ Definition bobmorane := tt -> ff.
+ End foo.
+ Print bobmorane. (*
+ bobmorane@{Top.15 Top.16 ff.u ff.v} =
+ let tt := Type@{Top.16} in let ff := Type@{ff.v} in tt -> ff
+ : Type@{max(Top.15,ff.u)}
+ (* Top.15 Top.16 ff.u ff.v |= Top.16 < Top.15
+ ff.v < ff.u
+ *)
+
+ bobmorane is universe polymorphic
+ *)
+End SecLet.
+
+(* fun x x => foo is nonsense with local binders *)
+Fail Definition fo@{u u} := Type@{u}.
+
+(* Using local binders for printing. *)
+Print foo@{E M N}.
+(* Underscores discard the name if there's one. *)
+Print foo@{_ _ _}.
+
+(* Also works for inductives and records. *)
+Print Empty@{E}.
+Print PWrap@{E}.
+
+(* Also works for About. *)
+About punwrap@{K}.
+
+(* Instance length check. *)
+Fail Print foo@{E}.
+Fail Print mono@{E}.
+
+(* Not everything can be printed with custom universe names. *)
+Fail Print Coq.Init.Logic@{E}.
+
+(* Nice error when constraints are impossible. *)
+Monomorphic Universes gU gV. Monomorphic Constraint gU < gV.
+Fail Lemma foo@{u v|u < gU, gV < v, v < u} : nat.
+
+(* Universe binders survive through compilation, sections and modules. *)
+Require TestSuite.bind_univs.
+Print bind_univs.mono.
+Print bind_univs.poly.
+
+Section SomeSec.
+ Universe u.
+ Definition insec@{v} := Type@{u} -> Type@{v}.
+ Print insec.
+End SomeSec.
+Print insec.
+
+Module SomeMod.
+ Definition inmod@{u} := Type@{u}.
+ Print inmod.
+End SomeMod.
+Print SomeMod.inmod.
+Import SomeMod.
+Print inmod.
+
+Module Type SomeTyp. Definition inmod := Type. End SomeTyp.
+Module SomeFunct (In : SomeTyp).
+ Definition infunct@{u v} := In.inmod@{u} -> Type@{v}.
+End SomeFunct.
+Module Applied := SomeFunct(SomeMod).
+Print Applied.infunct.
+
+(* Multi-axiom declaration
+
+ In polymorphic mode the domain Type gets separate universes for the
+ different axioms, but all axioms have to declare all universes. In
+ polymorphic mode they get the same universes, ie the type is only
+ interpd once. *)
+Axiom axfoo@{i+} axbar : Type -> Type@{i}.
+Monomorphic Axiom axfoo'@{i+} axbar' : Type -> Type@{i}.
+
+About axfoo. About axbar. About axfoo'. About axbar'.
+
+Fail Axiom failfoo failbar@{i} : Type.
diff --git a/test-suite/output/bug5778.out b/test-suite/output/bug5778.out
new file mode 100644
index 000000000..91ceb1b58
--- /dev/null
+++ b/test-suite/output/bug5778.out
@@ -0,0 +1,4 @@
+The command has indeed failed with message:
+In nested Ltac calls to "c", "abs" and "abstract b ltac:(())", last call
+failed.
+The term "I" has type "True" which should be Set, Prop or Type.
diff --git a/test-suite/output/bug5778.v b/test-suite/output/bug5778.v
new file mode 100644
index 000000000..0dcd76aef
--- /dev/null
+++ b/test-suite/output/bug5778.v
@@ -0,0 +1,7 @@
+Ltac a _ := pose (I : I).
+Ltac b _ := a ().
+Ltac abs _ := abstract b ().
+Ltac c _ := abs ().
+Goal True.
+ Fail c ().
+Abort.
diff --git a/test-suite/output/ltac.out b/test-suite/output/ltac.out
index 35c3057d8..eb9f57102 100644
--- a/test-suite/output/ltac.out
+++ b/test-suite/output/ltac.out
@@ -1,7 +1,7 @@
The command has indeed failed with message:
Ltac variable y depends on pattern variable name z which is not bound in current context.
Ltac f x y z :=
- symmetry in x, y; auto with z; auto; intros **; clearbody x; generalize
+ symmetry in x, y; auto with z; auto; intros; clearbody x; generalize
dependent z
The command has indeed failed with message:
In nested Ltac calls to "g1" and "refine (uconstr)", last call failed.
@@ -31,3 +31,10 @@ nat
nat
0
0
+Ltac foo :=
+ let x := intros in
+ let y := intros -> in
+ let v := constr:(nil) in
+ let w := () in
+ let z := 1 in
+ pose v
diff --git a/test-suite/output/ltac.v b/test-suite/output/ltac.v
index 76c37625a..6adbe95dd 100644
--- a/test-suite/output/ltac.v
+++ b/test-suite/output/ltac.v
@@ -57,3 +57,14 @@ match goal with |- ?x*?y => idtac x end.
match goal with H: context [?x*?y] |- _ => idtac x end.
match goal with |- context [?x*?y] => idtac x end.
Abort.
+
+(* Check printing of let in Ltac and Tactic Notation *)
+
+Ltac foo :=
+ let x := intros in
+ let y := intros -> in
+ let v := constr:(@ nil True) in
+ let w := () in
+ let z := 1 in
+ pose v.
+Print Ltac foo.
diff --git a/test-suite/output/ltac_missing_args.out b/test-suite/output/ltac_missing_args.out
index 172612405..7326f137c 100644
--- a/test-suite/output/ltac_missing_args.out
+++ b/test-suite/output/ltac_missing_args.out
@@ -1,20 +1,40 @@
The command has indeed failed with message:
-A fully applied tactic is expected: missing argument for variable x.
+The user-defined tactic "Top.foo" was not fully applied:
+There is a missing argument for variable x,
+no arguments at all were provided.
The command has indeed failed with message:
-A fully applied tactic is expected: missing argument for variable x.
+The user-defined tactic "Top.bar" was not fully applied:
+There is a missing argument for variable x,
+no arguments at all were provided.
The command has indeed failed with message:
-A fully applied tactic is expected: missing arguments for variables y and _.
+The user-defined tactic "Top.bar" was not fully applied:
+There are missing arguments for variables y and _,
+an argument was provided for variable x.
The command has indeed failed with message:
-A fully applied tactic is expected: missing argument for variable x.
+The user-defined tactic "Top.baz" was not fully applied:
+There is a missing argument for variable x,
+no arguments at all were provided.
The command has indeed failed with message:
-A fully applied tactic is expected: missing argument for variable x.
+The user-defined tactic "Top.qux" was not fully applied:
+There is a missing argument for variable x,
+no arguments at all were provided.
The command has indeed failed with message:
-A fully applied tactic is expected: missing argument for variable _.
+The user-defined tactic "Top.mydo" was not fully applied:
+There is a missing argument for variable _,
+no arguments at all were provided.
The command has indeed failed with message:
-A fully applied tactic is expected: missing argument for variable _.
+An unnamed user-defined tactic was not fully applied:
+There is a missing argument for variable _,
+no arguments at all were provided.
The command has indeed failed with message:
-A fully applied tactic is expected: missing argument for variable _.
+An unnamed user-defined tactic was not fully applied:
+There is a missing argument for variable _,
+no arguments at all were provided.
The command has indeed failed with message:
-A fully applied tactic is expected: missing argument for variable x.
+The user-defined tactic "Top.rec" was not fully applied:
+There is a missing argument for variable x,
+no arguments at all were provided.
The command has indeed failed with message:
-A fully applied tactic is expected: missing argument for variable x.
+An unnamed user-defined tactic was not fully applied:
+There is a missing argument for variable x,
+an argument was provided for variable tac.
diff --git a/test-suite/output/optimize_heap.out b/test-suite/output/optimize_heap.out
new file mode 100644
index 000000000..94a0b1911
--- /dev/null
+++ b/test-suite/output/optimize_heap.out
@@ -0,0 +1,8 @@
+1 subgoal
+
+ ============================
+ True
+1 subgoal
+
+ ============================
+ True
diff --git a/test-suite/output/optimize_heap.v b/test-suite/output/optimize_heap.v
new file mode 100644
index 000000000..e566bd7ba
--- /dev/null
+++ b/test-suite/output/optimize_heap.v
@@ -0,0 +1,7 @@
+(* optimize_heap should not affect the proof state *)
+
+Goal True.
+ idtac.
+ Show.
+ optimize_heap.
+ Show.
diff --git a/test-suite/prerequisite/bind_univs.v b/test-suite/prerequisite/bind_univs.v
new file mode 100644
index 000000000..e834fde11
--- /dev/null
+++ b/test-suite/prerequisite/bind_univs.v
@@ -0,0 +1,7 @@
+(* Used in output/UnivBinders.v *)
+
+Monomorphic Definition mono@{u} := Type@{u}.
+
+Polymorphic Definition poly@{u} := Type@{u}.
+
+Monomorphic Universe reqU.
diff --git a/test-suite/success/BracketsWithGoalSelector.v b/test-suite/success/BracketsWithGoalSelector.v
new file mode 100644
index 000000000..ed035f521
--- /dev/null
+++ b/test-suite/success/BracketsWithGoalSelector.v
@@ -0,0 +1,16 @@
+Goal forall A B, B \/ A -> A \/ B.
+Proof.
+ intros * [HB | HA].
+ 2: {
+ left.
+ exact HA.
+ Fail right. (* No such goal. Try unfocusing with "}". *)
+ }
+ Fail 2: { (* Non-existent goal. *)
+ idtac. (* The idtac is to get a dot, so that IDEs know to stop there. *)
+ 1:{ (* Syntactic test: no space before bracket. *)
+ right.
+ exact HB.
+Fail Qed.
+ }
+Qed.
diff --git a/test-suite/success/Check.v b/test-suite/success/Check.v
index 0f677a849..82b51b1ff 100644
--- a/test-suite/success/Check.v
+++ b/test-suite/success/Check.v
@@ -12,3 +12,5 @@
Check 0.
Check S.
Check nat.
+
+Type Type : Type.
diff --git a/test-suite/success/Notations.v b/test-suite/success/Notations.v
index e3f90f6d9..3c0ad2070 100644
--- a/test-suite/success/Notations.v
+++ b/test-suite/success/Notations.v
@@ -147,3 +147,9 @@ Inductive EQ {A} (x:A) : A -> Prop := REFL : x === x
Fail Check {x@{u},y|x=x}.
Fail Check {?[n],y|0=0}.
+
+(* Check that 10 is well declared left associative *)
+
+Section C.
+Notation "f $$$ x" := (id f x) (at level 10, left associativity).
+End C.
diff --git a/test-suite/success/Notations2.v b/test-suite/success/Notations2.v
index 9505a56e3..2655b651a 100644
--- a/test-suite/success/Notations2.v
+++ b/test-suite/success/Notations2.v
@@ -90,3 +90,18 @@ Check fun A (x :prod' bool A) => match x with #### 0 y 0 => 2 | _ => 1 end.
Notation "##### x" := (pair' x) (at level 0, x at level 1).
Check ##### 0 _ 0%bool 0%bool : prod' bool bool.
Check fun A (x :prod' bool A) => match x with ##### 0 _ y 0%bool => 2 | _ => 1 end.
+
+(* 10. Check computation of binding variable through other notations *)
+(* i should be detected as binding variable and the scopes not being checked *)
+
+Notation "'FUNNAT' i => t" := (fun i : nat => i = t) (at level 200).
+Notation "'Funnat' i => t" := (FUNNAT i => t + i%nat) (at level 200).
+
+(* 11. Notations with needed factorization of a recursive pattern *)
+(* See https://github.com/coq/coq/issues/6078#issuecomment-342287412 *)
+Module A.
+Notation "[:: x1 ; .. ; xn & s ]" := (cons x1 .. (cons xn s) ..).
+Notation "[:: x1 ; .. ; xn ]" := (cons x1 .. (cons xn nil) ..).
+Check [:: 1 ; 2 ; 3 ].
+Check [:: 1 ; 2 ; 3 & nil ]. (* was failing *)
+End A.
diff --git a/test-suite/success/Typeclasses.v b/test-suite/success/Typeclasses.v
index 6b1f0315b..cd6eac35c 100644
--- a/test-suite/success/Typeclasses.v
+++ b/test-suite/success/Typeclasses.v
@@ -240,3 +240,20 @@ Module IterativeDeepening.
Qed.
End IterativeDeepening.
+
+Module AxiomsAreInstances.
+ Set Typeclasses Axioms Are Instances.
+ Class TestClass1 := {}.
+ Axiom testax1 : TestClass1.
+ Definition testdef1 : TestClass1 := _.
+
+ Unset Typeclasses Axioms Are Instances.
+ Class TestClass2 := {}.
+ Axiom testax2 : TestClass2.
+ Fail Definition testdef2 : TestClass2 := _.
+
+ (* we didn't break typeclasses *)
+ Existing Instance testax2.
+ Definition testdef2 : TestClass2 := _.
+
+End AxiomsAreInstances.
diff --git a/test-suite/success/abstract_poly.v b/test-suite/success/abstract_poly.v
index b736b734f..aa8da5336 100644
--- a/test-suite/success/abstract_poly.v
+++ b/test-suite/success/abstract_poly.v
@@ -17,4 +17,4 @@ intros m n P e p.
abstract (rewrite e in p; exact p).
Defined.
-Check bar_subproof@{Set Set Set}.
+Check bar_subproof@{Set Set}.
diff --git a/test-suite/success/bteauto.v b/test-suite/success/bteauto.v
index 3178c6fc1..730b367d6 100644
--- a/test-suite/success/bteauto.v
+++ b/test-suite/success/bteauto.v
@@ -55,6 +55,7 @@ Module Backtracking.
Axiom A : Type.
Existing Class A.
Axioms a b c d e: A.
+ Existing Instances a b c d e.
Ltac get_value H := eval cbv delta [H] in H.
diff --git a/test-suite/success/dtauto-let-deps.v b/test-suite/success/dtauto-let-deps.v
new file mode 100644
index 000000000..094b2f8b3
--- /dev/null
+++ b/test-suite/success/dtauto-let-deps.v
@@ -0,0 +1,24 @@
+(*
+This test is sensitive to changes in which let-ins are expanded when checking
+for dependencies in constructors.
+If the (x := X) is not reduced, Foo1 won't be recognized as a conjunction,
+and if the (y := X) is reduced, Foo2 will be recognized as a conjunction.
+
+This tests the behavior of engine/termops.ml : prod_applist_assum,
+which is currently specified to reduce exactly the parameters.
+
+If dtauto is changed to reduce lets in constructors before checking dependency,
+this test will need to be changed.
+*)
+
+Context (P Q : Type).
+Inductive Foo1 (X : Type) (x := X) := foo1 : let y := X in P -> Q -> Foo1 x.
+Inductive Foo2 (X : Type) (x := X) := foo2 : let y := X in P -> Q -> Foo2 y.
+
+Goal P -> Q -> Foo1 nat.
+solve [dtauto].
+Qed.
+
+Goal P -> Q -> Foo2 nat.
+Fail solve [dtauto].
+Abort.
diff --git a/test-suite/success/extraction.v b/test-suite/success/extraction.v
index 0ee223250..83726bfdc 100644
--- a/test-suite/success/extraction.v
+++ b/test-suite/success/extraction.v
@@ -635,6 +635,6 @@ Recursive Extraction Everything.
Require Import ZArith.
-Extraction Language Ocaml.
+Extraction Language OCaml.
Recursive Extraction Z_modulo_2 Zdiv_eucl_exist.
Extraction TestCompile Z_modulo_2 Zdiv_eucl_exist.
diff --git a/test-suite/success/polymorphism.v b/test-suite/success/polymorphism.v
index 7eaafc354..d76b30791 100644
--- a/test-suite/success/polymorphism.v
+++ b/test-suite/success/polymorphism.v
@@ -190,6 +190,8 @@ Module binders.
Fail Defined.
Abort.
+ Fail Lemma bar@{u v | } : let x := (fun x => x) : Type@{u} -> Type@{v} in nat.
+
Lemma bar@{i j| i < j} : Type@{j}.
Proof.
exact Type@{i}.
@@ -200,6 +202,10 @@ Module binders.
exact Type@{i}.
Qed.
+ Monomorphic Universe M.
+ Fail Definition with_mono@{u|} : Type@{M} := Type@{u}.
+ Definition with_mono@{u|u < M} : Type@{M} := Type@{u}.
+
End binders.
Section cats.
@@ -399,6 +405,31 @@ Module Anonymous.
End Anonymous.
+Module Restrict.
+ (* Universes which don't appear in the term should be pruned, unless they have names *)
+ Set Universe Polymorphism.
+
+ Ltac exact0 := let x := constr:(Type) in exact 0.
+ Definition dummy_pruned@{} : nat := ltac:(exact0).
+
+ Definition named_not_pruned@{u} : nat := 0.
+ Check named_not_pruned@{_}.
+
+ Definition named_not_pruned_nonstrict : nat := ltac:(let x := constr:(Type@{u}) in exact 0).
+ Check named_not_pruned_nonstrict@{_}.
+
+ Lemma lemma_restrict_poly@{} : nat.
+ Proof. exact0. Defined.
+
+ Unset Universe Polymorphism.
+ Lemma lemma_restrict_mono_qed@{} : nat.
+ Proof. exact0. Qed.
+
+ Lemma lemma_restrict_abstract@{} : nat.
+ Proof. abstract exact0. Qed.
+
+End Restrict.
+
Module F.
Context {A B : Type}.
Definition foo : Type := B.
@@ -430,3 +461,10 @@ Section test_letin_subtyping.
Qed.
End test_letin_subtyping.
+
+Module ObligationRegression.
+ (** Test for a regression encountered when fixing obligations for
+ stronger restriction of universe context. *)
+ Require Import CMorphisms.
+ Check trans_co_eq_inv_arrow_morphism@{_ _ _ _ _ _ _ _}.
+End ObligationRegression.
diff --git a/test-suite/success/unidecls.v b/test-suite/success/unidecls.v
new file mode 100644
index 000000000..c4a1d7c28
--- /dev/null
+++ b/test-suite/success/unidecls.v
@@ -0,0 +1,121 @@
+Set Printing Universes.
+
+Module unidecls.
+ Universes a b.
+End unidecls.
+
+Universe a.
+
+Constraint a < unidecls.a.
+
+Print Universes.
+
+(** These are different universes *)
+Check Type@{a}.
+Check Type@{unidecls.a}.
+
+Check Type@{unidecls.b}.
+
+Fail Check Type@{unidecls.c}.
+
+Fail Check Type@{i}.
+Universe foo.
+Module Foo.
+ (** Already declared globaly: but universe names are scoped at the module level *)
+ Universe foo.
+ Universe bar.
+
+ Check Type@{Foo.foo}.
+ Definition bar := 0.
+End Foo.
+
+(** Already declared in the module *)
+Universe bar.
+
+(** Accessible outside the module: universe declarations are global *)
+Check Type@{bar}.
+Check Type@{Foo.bar}.
+
+Check Type@{Foo.foo}.
+(** The same *)
+Check Type@{foo}.
+Check Type@{Top.foo}.
+
+Universe secfoo.
+Section Foo'.
+ Fail Universe secfoo.
+ Universe secfoo2.
+ Check Type@{Foo'.secfoo2}.
+ Constraint secfoo2 < a.
+End Foo'.
+
+Check Type@{secfoo2}.
+Fail Check Type@{Foo'.secfoo2}.
+Fail Check eq_refl : Type@{secfoo2} = Type@{a}.
+
+(** Below, u and v are global, fixed universes *)
+Module Type Arg.
+ Universe u.
+ Parameter T: Type@{u}.
+End Arg.
+
+Module Fn(A : Arg).
+ Universes v.
+
+ Check Type@{A.u}.
+ Constraint A.u < v.
+
+ Definition foo : Type@{v} := nat.
+ Definition bar : Type@{A.u} := nat.
+
+ Fail Definition foo(A : Type@{v}) : Type@{A.u} := A.
+End Fn.
+
+Module ArgImpl : Arg.
+ Definition T := nat.
+End ArgImpl.
+
+Module ArgImpl2 : Arg.
+ Definition T := bool.
+End ArgImpl2.
+
+(** Two applications of the functor result in the exact same universes *)
+Module FnApp := Fn(ArgImpl).
+
+Check Type@{FnApp.v}.
+Check FnApp.foo.
+Check FnApp.bar.
+
+Check (eq_refl : Type@{ArgImpl.u} = Type@{ArgImpl2.u}).
+
+Module FnApp2 := Fn(ArgImpl).
+Check Type@{FnApp2.v}.
+Check FnApp2.foo.
+Check FnApp2.bar.
+
+Import ArgImpl2.
+(** Now u refers to ArgImpl.u and ArgImpl2.u *)
+Check FnApp2.bar.
+
+(** It can be shadowed *)
+Universe u.
+
+(** This refers to the qualified name *)
+Check FnApp2.bar.
+
+Constraint u = ArgImpl.u.
+Print Universes.
+
+Set Universe Polymorphism.
+
+Section PS.
+ Universe poly.
+
+ Definition id (A : Type@{poly}) (a : A) : A := a.
+End PS.
+(** The universe is polymorphic and discharged, does not persist *)
+Fail Check Type@{poly}.
+
+Print Universes.
+Check id nat.
+Check id@{Set}.
diff --git a/theories/Arith/Between.v b/theories/Arith/Between.v
index 9b4071085..ead08b3eb 100644
--- a/theories/Arith/Between.v
+++ b/theories/Arith/Between.v
@@ -16,6 +16,8 @@ Implicit Types k l p q r : nat.
Section Between.
Variables P Q : nat -> Prop.
+ (** The [between] type expresses the concept
+ [forall i: nat, k <= i < l -> P i.]. *)
Inductive between k : nat -> Prop :=
| bet_emp : between k k
| bet_S : forall l, between k l -> P l -> between k (S l).
@@ -47,6 +49,8 @@ Section Between.
induction 1; auto with arith.
Qed.
+ (** The [exists_between] type expresses the concept
+ [exists i: nat, k <= i < l /\ Q i]. *)
Inductive exists_between k : nat -> Prop :=
| exists_S : forall l, exists_between k l -> exists_between k (S l)
| exists_le : forall l, k <= l -> Q l -> exists_between k (S l).
diff --git a/theories/Compat/Coq87.v b/theories/Compat/Coq87.v
index ef1737bf8..aeef9595d 100644
--- a/theories/Compat/Coq87.v
+++ b/theories/Compat/Coq87.v
@@ -15,3 +15,6 @@
and breaks at least fiat-crypto. *)
Declare ML Module "omega_plugin".
Unset Omega UseLocalDefs.
+
+
+Set Typeclasses Axioms Are Instances.
diff --git a/theories/FSets/FSetCompat.v b/theories/FSets/FSetCompat.v
index b1769da3d..31bc1cc31 100644
--- a/theories/FSets/FSetCompat.v
+++ b/theories/FSets/FSetCompat.v
@@ -165,13 +165,13 @@ End Backport_WSets.
(** * From new Sets to new ones *)
Module Backport_Sets
- (E:OrderedType.OrderedType)
- (M:MSetInterface.Sets with Definition E.t := E.t
- with Definition E.eq := E.eq
- with Definition E.lt := E.lt)
- <: FSetInterface.S with Module E:=E.
+ (O:OrderedType.OrderedType)
+ (M:MSetInterface.Sets with Definition E.t := O.t
+ with Definition E.eq := O.eq
+ with Definition E.lt := O.lt)
+ <: FSetInterface.S with Module E:=O.
- Include Backport_WSets E M.
+ Include Backport_WSets O M.
Implicit Type s : t.
Implicit Type x y : elt.
@@ -182,21 +182,21 @@ Module Backport_Sets
Definition min_elt_1 : forall s x, min_elt s = Some x -> In x s
:= M.min_elt_spec1.
Definition min_elt_2 : forall s x y,
- min_elt s = Some x -> In y s -> ~ E.lt y x
+ min_elt s = Some x -> In y s -> ~ O.lt y x
:= M.min_elt_spec2.
Definition min_elt_3 : forall s, min_elt s = None -> Empty s
:= M.min_elt_spec3.
Definition max_elt_1 : forall s x, max_elt s = Some x -> In x s
:= M.max_elt_spec1.
Definition max_elt_2 : forall s x y,
- max_elt s = Some x -> In y s -> ~ E.lt x y
+ max_elt s = Some x -> In y s -> ~ O.lt x y
:= M.max_elt_spec2.
Definition max_elt_3 : forall s, max_elt s = None -> Empty s
:= M.max_elt_spec3.
- Definition elements_3 : forall s, sort E.lt (elements s)
+ Definition elements_3 : forall s, sort O.lt (elements s)
:= M.elements_spec2.
Definition choose_3 : forall s s' x y,
- choose s = Some x -> choose s' = Some y -> Equal s s' -> E.eq x y
+ choose s = Some x -> choose s' = Some y -> Equal s s' -> O.eq x y
:= M.choose_spec3.
Definition lt_trans : forall s s' s'', lt s s' -> lt s' s'' -> lt s s''
:= @StrictOrder_Transitive _ _ M.lt_strorder.
@@ -211,7 +211,7 @@ Module Backport_Sets
[ apply EQ | apply LT | apply GT ]; auto.
Defined.
- Module E := E.
+ Module E := O.
End Backport_Sets.
@@ -342,13 +342,13 @@ End Update_WSets.
(** * From old Sets to new ones. *)
Module Update_Sets
- (E:Orders.OrderedType)
- (M:FSetInterface.S with Definition E.t := E.t
- with Definition E.eq := E.eq
- with Definition E.lt := E.lt)
- <: MSetInterface.Sets with Module E:=E.
+ (O:Orders.OrderedType)
+ (M:FSetInterface.S with Definition E.t := O.t
+ with Definition E.eq := O.eq
+ with Definition E.lt := O.lt)
+ <: MSetInterface.Sets with Module E:=O.
- Include Update_WSets E M.
+ Include Update_WSets O M.
Implicit Type s : t.
Implicit Type x y : elt.
@@ -359,21 +359,21 @@ Module Update_Sets
Definition min_elt_spec1 : forall s x, min_elt s = Some x -> In x s
:= M.min_elt_1.
Definition min_elt_spec2 : forall s x y,
- min_elt s = Some x -> In y s -> ~ E.lt y x
+ min_elt s = Some x -> In y s -> ~ O.lt y x
:= M.min_elt_2.
Definition min_elt_spec3 : forall s, min_elt s = None -> Empty s
:= M.min_elt_3.
Definition max_elt_spec1 : forall s x, max_elt s = Some x -> In x s
:= M.max_elt_1.
Definition max_elt_spec2 : forall s x y,
- max_elt s = Some x -> In y s -> ~ E.lt x y
+ max_elt s = Some x -> In y s -> ~ O.lt x y
:= M.max_elt_2.
Definition max_elt_spec3 : forall s, max_elt s = None -> Empty s
:= M.max_elt_3.
- Definition elements_spec2 : forall s, sort E.lt (elements s)
+ Definition elements_spec2 : forall s, sort O.lt (elements s)
:= M.elements_3.
Definition choose_spec3 : forall s s' x y,
- choose s = Some x -> choose s' = Some y -> Equal s s' -> E.eq x y
+ choose s = Some x -> choose s' = Some y -> Equal s s' -> O.eq x y
:= M.choose_3.
Instance lt_strorder : StrictOrder lt.
@@ -407,6 +407,6 @@ Module Update_Sets
Lemma compare_spec : forall s s', CompSpec eq lt s s' (compare s s').
Proof. intros; unfold compare; destruct M.compare; auto. Qed.
- Module E := E.
+ Module E := O.
End Update_Sets.
diff --git a/theories/Init/Tactics.v b/theories/Init/Tactics.v
index 5d0e7602a..47a971ef0 100644
--- a/theories/Init/Tactics.v
+++ b/theories/Init/Tactics.v
@@ -306,3 +306,10 @@ Ltac inversion_sigma_step :=
=> induction_sigma_in_using H @eq_sigT2_rect
end.
Ltac inversion_sigma := repeat inversion_sigma_step.
+
+(** A version of [time] that works for constrs *)
+Ltac time_constr tac :=
+ let eval_early := match goal with _ => restart_timer end in
+ let ret := tac () in
+ let eval_early := match goal with _ => finish_timing ( "Tactic evaluation" ) end in
+ ret.
diff --git a/theories/Logic/FunctionalExtensionality.v b/theories/Logic/FunctionalExtensionality.v
index ac95ddd0c..82b04d132 100644
--- a/theories/Logic/FunctionalExtensionality.v
+++ b/theories/Logic/FunctionalExtensionality.v
@@ -221,13 +221,12 @@ Tactic Notation "extensionality" "in" hyp(H) :=
(* If we [subst H], things break if we already have another equation of the form [_ = H] *)
destruct Heq; rename H_out into H.
-(** Eta expansion follows from extensionality. *)
+(** Eta expansion is built into Coq. *)
Lemma eta_expansion_dep {A} {B : A -> Type} (f : forall x : A, B x) :
f = fun x => f x.
Proof.
intros.
- extensionality x.
reflexivity.
Qed.
diff --git a/theories/Program/Combinators.v b/theories/Program/Combinators.v
index 90db10ef1..237d878bf 100644
--- a/theories/Program/Combinators.v
+++ b/theories/Program/Combinators.v
@@ -22,15 +22,13 @@ Open Scope program_scope.
Lemma compose_id_left : forall A B (f : A -> B), id ∘ f = f.
Proof.
intros.
- unfold id, compose.
- symmetry. apply eta_expansion.
+ reflexivity.
Qed.
Lemma compose_id_right : forall A B (f : A -> B), f ∘ id = f.
Proof.
intros.
- unfold id, compose.
- symmetry ; apply eta_expansion.
+ reflexivity.
Qed.
Lemma compose_assoc : forall A B C D (f : A -> B) (g : B -> C) (h : C -> D),
@@ -47,9 +45,7 @@ Hint Rewrite <- @compose_assoc : core.
Lemma flip_flip : forall A B C, @flip A B C ∘ flip = id.
Proof.
- unfold flip, compose.
intros.
- extensionality x ; extensionality y ; extensionality z.
reflexivity.
Qed.
@@ -57,9 +53,7 @@ Qed.
Lemma prod_uncurry_curry : forall A B C, @prod_uncurry A B C ∘ prod_curry = id.
Proof.
- simpl ; intros.
- unfold prod_uncurry, prod_curry, compose.
- extensionality x ; extensionality y ; extensionality z.
+ intros.
reflexivity.
Qed.
diff --git a/theories/Sets/Powerset_facts.v b/theories/Sets/Powerset_facts.v
index 2dd559a95..209c22f71 100644
--- a/theories/Sets/Powerset_facts.v
+++ b/theories/Sets/Powerset_facts.v
@@ -40,6 +40,11 @@ Section Sets_as_an_algebra.
auto 6 with sets.
Qed.
+ Theorem Empty_set_zero_right : forall X:Ensemble U, Union U X (Empty_set U) = X.
+ Proof.
+ auto 6 with sets.
+ Qed.
+
Theorem Empty_set_zero' : forall x:U, Add U (Empty_set U) x = Singleton U x.
Proof.
unfold Add at 1; auto using Empty_set_zero with sets.
@@ -131,6 +136,17 @@ Section Sets_as_an_algebra.
elim H'; intros x0 H'0; elim H'0; auto with sets.
Qed.
+ Lemma Distributivity_l
+ : forall (A B C : Ensemble U),
+ Intersection U (Union U A B) C =
+ Union U (Intersection U A C) (Intersection U B C).
+ Proof.
+ intros A B C.
+ rewrite Intersection_commutative.
+ rewrite Distributivity.
+ f_equal; apply Intersection_commutative.
+ Qed.
+
Theorem Distributivity' :
forall A B C:Ensemble U,
Union U A (Intersection U B C) =
@@ -251,6 +267,81 @@ Section Sets_as_an_algebra.
intros; apply Definition_of_covers; auto with sets.
Qed.
+ Lemma Disjoint_Intersection:
+ forall A s1 s2, Disjoint A s1 s2 -> Intersection A s1 s2 = Empty_set A.
+ Proof.
+ intros. apply Extensionality_Ensembles. split.
+ * destruct H.
+ intros x H1. unfold In in *. exfalso. intuition. apply (H _ H1).
+ * intuition.
+ Qed.
+
+ Lemma Intersection_Empty_set_l:
+ forall A s, Intersection A (Empty_set A) s = Empty_set A.
+ Proof.
+ intros. auto with sets.
+ Qed.
+
+ Lemma Intersection_Empty_set_r:
+ forall A s, Intersection A s (Empty_set A) = Empty_set A.
+ Proof.
+ intros. auto with sets.
+ Qed.
+
+ Lemma Seminus_Empty_set_l:
+ forall A s, Setminus A (Empty_set A) s = Empty_set A.
+ Proof.
+ intros. apply Extensionality_Ensembles. split.
+ * intros x H1. destruct H1. unfold In in *. assumption.
+ * intuition.
+ Qed.
+
+ Lemma Seminus_Empty_set_r:
+ forall A s, Setminus A s (Empty_set A) = s.
+ Proof.
+ intros. apply Extensionality_Ensembles. split.
+ * intros x H1. destruct H1. unfold In in *. assumption.
+ * intuition.
+ Qed.
+
+ Lemma Setminus_Union_l:
+ forall A s1 s2 s3,
+ Setminus A (Union A s1 s2) s3 = Union A (Setminus A s1 s3) (Setminus A s2 s3).
+ Proof.
+ intros. apply Extensionality_Ensembles. split.
+ * intros x H. inversion H. inversion H0; intuition.
+ * intros x H. constructor; inversion H; inversion H0; intuition.
+ Qed.
+
+ Lemma Setminus_Union_r:
+ forall A s1 s2 s3,
+ Setminus A s1 (Union A s2 s3) = Setminus A (Setminus A s1 s2) s3.
+ Proof.
+ intros. apply Extensionality_Ensembles. split.
+ * intros x H. inversion H. constructor. intuition. contradict H1. intuition.
+ * intros x H. inversion H. inversion H0. constructor; intuition. inversion H4; intuition.
+ Qed.
+
+ Lemma Setminus_Disjoint_noop:
+ forall A s1 s2,
+ Intersection A s1 s2 = Empty_set A -> Setminus A s1 s2 = s1.
+ Proof.
+ intros. apply Extensionality_Ensembles. split.
+ * intros x H1. inversion_clear H1. intuition.
+ * intros x H1. constructor; intuition. contradict H.
+ apply Inhabited_not_empty.
+ exists x. intuition.
+ Qed.
+
+ Lemma Setminus_Included_empty:
+ forall A s1 s2,
+ Included A s1 s2 -> Setminus A s1 s2 = Empty_set A.
+ Proof.
+ intros. apply Extensionality_Ensembles. split.
+ * intros x H1. inversion_clear H1. contradiction H2. intuition.
+ * intuition.
+ Qed.
+
End Sets_as_an_algebra.
Hint Resolve Empty_set_zero Empty_set_zero' Union_associative Union_add
diff --git a/tools/CoqMakefile.in b/tools/CoqMakefile.in
index 8f79f8a66..ca02c983d 100644
--- a/tools/CoqMakefile.in
+++ b/tools/CoqMakefile.in
@@ -87,7 +87,6 @@ COQCHK ?= "$(COQBIN)coqchk"
COQDEP ?= "$(COQBIN)coqdep"
GALLINA ?= "$(COQBIN)gallina"
COQDOC ?= "$(COQBIN)coqdoc"
-COQMKTOP ?= "$(COQBIN)coqmktop"
COQMKFILE ?= "$(COQBIN)coq_makefile"
# Timing scripts
@@ -120,6 +119,8 @@ CAMLPKGS ?=
# Option for making timing files
TIMING?=
+# Option for changing sorting of timing output file
+TIMING_SORT_BY ?= auto
# Output file names for timed builds
TIME_OF_BUILD_FILE ?= time-of-build.log
TIME_OF_BUILD_BEFORE_FILE ?= time-of-build-before.log
@@ -172,12 +173,15 @@ COQDOCFLAGS?=-interpolate -utf8 $(COQLIBS_NOML)
# The version of Coq being run and the version of coq_makefile that
# generated this makefile
-COQ_VERSION:=$(shell $(COQC) --print-version | cut -d ' ' -f 1)
+COQ_VERSION:=$(shell $(COQC) --print-version | cut -d " " -f 1)
COQMAKEFILE_VERSION:=@COQ_VERSION@
COQSRCLIBS?= $(foreach d,$(COQ_SRC_SUBDIRS), -I "$(COQLIB)$(d)")
-CAMLFLAGS+=$(OCAMLLIBS) $(COQSRCLIBS) -I $(CAMLP4LIB) $(OCAML_API_FLAGS)
+CAMLFLAGS+=$(OCAMLLIBS) $(COQSRCLIBS) -I $(CAMLP4LIB)
+
+# ocamldoc fails with unknown argument otherwise
+CAMLDOCFLAGS=$(filter-out -annot, $(filter-out -bin-annot, $(CAMLFLAGS)))
# FIXME This should be generated by Coq
GRAMMARS:=grammar.cma
@@ -225,8 +229,9 @@ COQTOPINSTALL = $(call concat_path,$(DESTDIR),$(COQLIB)toploop)
# We here define a bunch of variables about the files being part of the
# Coq project in order to ease the writing of build target and build rules
+VDFILE := .coqdeps
+
ALLSRCFILES := \
- $(VFILES) \
$(ML4FILES) \
$(MLFILES) \
$(MLPACKFILES) \
@@ -286,13 +291,15 @@ ALLNATIVEFILES = \
$(OBJFILES:.o=.cmi) \
$(OBJFILES:.o=.cmx) \
$(OBJFILES:.o=.cmxs)
-# trick: wildcard filters out non-existing files
-NATIVEFILESTOINSTALL = $(foreach f, $(ALLNATIVEFILES), $(wildcard $f))
+# trick: wildcard filters out non-existing files, so that `install` doesn't show
+# warnings and `clean` doesn't pass to rm a list of files that is too long for
+# the shell.
+NATIVEFILES = $(wildcard $(ALLNATIVEFILES))
FILESTOINSTALL = \
$(VOFILES) \
$(VFILES) \
$(GLOBFILES) \
- $(NATIVEFILESTOINSTALL) \
+ $(NATIVEFILES) \
$(CMIFILESTOINSTALL)
BYTEFILESTOINSTALL = \
$(CMOFILESTOINSTALL) \
@@ -304,7 +311,7 @@ else
DO_NATDYNLINK =
endif
-ALLDFILES = $(addsuffix .d,$(ALLSRCFILES))
+ALLDFILES = $(addsuffix .d,$(ALLSRCFILES) $(VDFILE))
# Compilation targets #########################################################
@@ -329,7 +336,7 @@ make-pretty-timed make-pretty-timed-before make-pretty-timed-after::
print-pretty-timed::
$(HIDE)$(COQMAKE_ONE_TIME_FILE) $(TIME_OF_BUILD_FILE) $(TIME_OF_PRETTY_BUILD_FILE) $(TIME_OF_PRETTY_BUILD_EXTRA_FILES)
print-pretty-timed-diff::
- $(HIDE)$(COQMAKE_BOTH_TIME_FILES) $(TIME_OF_BUILD_BEFORE_FILE) $(TIME_OF_BUILD_AFTER_FILE) $(TIME_OF_PRETTY_BOTH_BUILD_FILE) $(TIME_OF_PRETTY_BUILD_EXTRA_FILES)
+ $(HIDE)$(COQMAKE_BOTH_TIME_FILES) --sort-by=$(TIMING_SORT_BY) $(TIME_OF_BUILD_BEFORE_FILE) $(TIME_OF_BUILD_AFTER_FILE) $(TIME_OF_PRETTY_BOTH_BUILD_FILE) $(TIME_OF_PRETTY_BUILD_EXTRA_FILES)
ifeq (,$(BEFORE))
print-pretty-single-time-diff::
@echo 'Error: Usage: $(MAKE) print-pretty-single-time-diff BEFORE=path/to/file.v.before-timing AFTER=path/to/file.v.after-timing'
@@ -341,7 +348,7 @@ print-pretty-single-time-diff::
$(HIDE)false
else
print-pretty-single-time-diff::
- $(HIDE)$(COQMAKE_BOTH_SINGLE_TIMING_FILES) $(BEFORE) $(AFTER) $(TIME_OF_PRETTY_BUILD_FILE) $(TIME_OF_PRETTY_BUILD_EXTRA_FILES)
+ $(HIDE)$(COQMAKE_BOTH_SINGLE_TIMING_FILES) --sort-by=$(TIMING_SORT_BY) $(BEFORE) $(AFTER) $(TIME_OF_PRETTY_BUILD_FILE) $(TIME_OF_PRETTY_BUILD_EXTRA_FILES)
endif
endif
pretty-timed:
@@ -389,7 +396,7 @@ checkproofs:
.PHONY: checkproofs
validate: $(VOFILES)
- $(TIMER) $(COQCHK) $(COQCHKFLAGS) $(notdir $(^:.vo=))
+ $(TIMER) $(COQCHK) $(COQCHKFLAGS) $^
.PHONY: validate
only: $(TGTS)
@@ -407,12 +414,12 @@ mlihtml: $(MLIFILES:.mli=.cmi)
$(SHOW)'CAMLDOC -d $@'
$(HIDE)mkdir $@ || rm -rf $@/*
$(HIDE)$(CAMLDOC) -html \
- -d $@ -m A $(CAMLDEBUG) $(CAMLFLAGS) $(MLIFILES)
+ -d $@ -m A $(CAMLDEBUG) $(CAMLDOCFLAGS) $(MLIFILES)
all-mli.tex: $(MLIFILES:.mli=.cmi)
$(SHOW)'CAMLDOC -latex $@'
$(HIDE)$(CAMLDOC) -latex \
- -o $@ -m A $(CAMLDEBUG) $(CAMLFLAGS) $(MLIFILES)
+ -o $@ -m A $(CAMLDEBUG) $(CAMLDOCFLAGS) $(MLIFILES)
gallina: $(GFILES)
@@ -429,7 +436,7 @@ all.pdf: $(VFILES)
-o $@ `$(COQDEP) -sort -suffix .v $(VFILES)`
# FIXME: not quite right, since the output name is different
-gallinahtml: GAL=g
+gallinahtml: GAL=-g
gallinahtml: html
all-gal.ps: GAL=-g
@@ -532,7 +539,7 @@ clean::
$(HIDE)rm -f $(CMOFILES:.cmo=.o)
$(HIDE)rm -f $(CMXAFILES:.cmxa=.a)
$(HIDE)rm -f $(ALLDFILES)
- $(HIDE)rm -f $(ALLNATIVEFILES)
+ $(HIDE)rm -f $(NATIVEFILES)
$(HIDE)find . -name .coq-native -type d -empty -delete
$(HIDE)rm -f $(VOFILES)
$(HIDE)rm -f $(VOFILES:.vo=.vio)
@@ -560,7 +567,7 @@ cleanall:: clean
archclean::
@# Extension point
$(SHOW)'CLEAN *.cmx *.o'
- $(HIDE)rm -f $(ALLNATIVEFILES)
+ $(HIDE)rm -f $(NATIVEFILES)
$(HIDE)rm -f $(CMOFILES:%.cmo=%.cmx)
.PHONY: archclean
@@ -709,9 +716,9 @@ $(addsuffix .d,$(MLPACKFILES)): %.mlpack.d: %.mlpack
$(SHOW)'COQDEP $<'
$(HIDE)$(COQDEP) $(OCAMLLIBS) -c "$<" $(redir_if_ok)
-$(addsuffix .d,$(VFILES)): %.v.d: %.v
- $(SHOW)'COQDEP $<'
- $(HIDE)$(COQDEP) $(COQLIBS) -dyndep var -c "$<" $(redir_if_ok)
+$(VDFILE).d: $(VFILES)
+ $(SHOW)'COQDEP VFILES'
+ $(HIDE)$(COQDEP) $(COQLIBS) -dyndep var -c $(VFILES) $(redir_if_ok)
# Misc ########################################################################
diff --git a/tools/TimeFileMaker.py b/tools/TimeFileMaker.py
index 7298ef5e8..0d24332f1 100644
--- a/tools/TimeFileMaker.py
+++ b/tools/TimeFileMaker.py
@@ -10,6 +10,20 @@ STRIP_REG = re.compile('^(coq/|contrib/|)(?:theories/|src/)?')
STRIP_REP = r'\1'
INFINITY = '\xe2\x88\x9e'
+def parse_args(argv, USAGE, HELP_STRING):
+ sort_by = 'auto'
+ if any(arg.startswith('--sort-by=') for arg in argv[1:]):
+ sort_by = [arg for arg in argv[1:] if arg.startswith('--sort-by=')][-1][len('--sort-by='):]
+ args = [arg for arg in argv if not arg.startswith('--sort-by=')]
+ if len(args) < 3 or '--help' in args[1:] or '-h' in args[1:] or sort_by not in ('auto', 'absolute', 'diff'):
+ print(USAGE)
+ if '--help' in args[1:] or '-h' in args[1:]:
+ print(HELP_STRING)
+ if len(args) == 2: sys.exit(0)
+ sys.exit(1)
+ return sort_by, args
+
+
def reformat_time_string(time):
seconds, milliseconds = time.split('.')
seconds = int(seconds)
@@ -55,12 +69,15 @@ def get_single_file_times(file_name):
FORMAT = 'Chars %%0%dd - %%0%dd %%s' % (longest, longest)
return dict((FORMAT % (int(start), int(stop), name), reformat_time_string(time)) for start, stop, name, time, extra in times)
+def fix_sign_for_sorting(num, descending=True):
+ return -num if descending else num
+
def make_sorting_key(times_dict, descending=True):
def get_key(name):
minutes, seconds = times_dict[name].replace('s', '').split('m')
- def fix_sign(num):
- return -num if descending else num
- return (fix_sign(int(minutes)), fix_sign(float(seconds)), name)
+ return (fix_sign_for_sorting(int(minutes), descending=descending),
+ fix_sign_for_sorting(float(seconds), descending=descending),
+ name)
return get_key
def get_sorted_file_list_from_times_dict(times_dict, descending=True):
@@ -105,6 +122,7 @@ def format_percentage(num, signed=True):
return sign + '%d.%02d%%' % (whole_part, frac_part)
def make_diff_table_string(left_times_dict, right_times_dict,
+ sort_by='auto',
descending=True,
left_tag="After", tag="File Name", right_tag="Before", with_percent=True,
change_tag="Change", percent_change_tag="% Change"):
@@ -122,10 +140,15 @@ def make_diff_table_string(left_times_dict, right_times_dict,
if rseconds != 0 else (INFINITY if lseconds > 0 else 'N/A')))
for name, lseconds, rseconds in prediff_times)
# update to sort by approximate difference, first
- get_key = make_sorting_key(all_names_dict, descending=descending)
- all_names_dict = dict((name, (abs(int(to_seconds(diff_times_dict[name]))), get_key(name)))
- for name in all_names_dict.keys())
- names = sorted(all_names_dict.keys(), key=all_names_dict.get)
+ get_key_abs = make_sorting_key(all_names_dict, descending=descending)
+ get_key_diff = (lambda name: fix_sign_for_sorting(int(abs(to_seconds(diff_times_dict[name]))), descending=descending))
+ if sort_by == 'absolute':
+ get_key = get_key_abs
+ elif sort_by == 'diff':
+ get_key = get_key_diff
+ else: # sort_by == 'auto'
+ get_key = (lambda name: (get_key_diff(name), get_key_abs(name)))
+ names = sorted(all_names_dict.keys(), key=get_key)
#names = get_sorted_file_list_from_times_dict(all_names_dict, descending=descending)
# set the widths of each of the columns by the longest thing to go in that column
left_sum = sum_times(left_times_dict.values())
diff --git a/tools/coq_makefile.ml b/tools/coq_makefile.ml
index 2feaaa04c..091869407 100644
--- a/tools/coq_makefile.ml
+++ b/tools/coq_makefile.ml
@@ -27,16 +27,8 @@ let rec print_prefix_list sep = function
| x :: l -> print sep; print x; print_prefix_list sep l
| [] -> ()
-let usage () =
- output_string stderr "Usage summary:\
-\n\
-\ncoq_makefile .... [file.v] ... [file.ml[i4]?] ... [file.ml{lib,pack}]\
-\n ... [any] ... [-extra[-phony] result dependencies command]\
-\n ... [-I dir] ... [-R physicalpath logicalpath]\
-\n ... [-Q physicalpath logicalpath] ... [VARIABLE = value]\
-\n ... [-arg opt] ... [-opt|-byte] [-no-install] [-f file] [-o file]\
-\n [-h] [--help]\
-\n\
+let usage_common () =
+ output_string stderr "\
\n[file.v]: Coq file to be compiled\
\n[file.ml[i4]?]: Objective Caml file to be compiled\
\n[file.ml{lib,pack}]: ocamlbuild file that describes a Objective Caml\
@@ -65,10 +57,28 @@ let usage () =
\n[-install opt]: where opt is \"user\" to force install into user directory,\
\n \"none\" to build a makefile with no install target or\
\n \"global\" to force install in $COQLIB directory\
+\n"
+
+let usage_coq_project () =
+ output_string stderr "Available arguments:";
+ usage_common ();
+ exit 1
+
+let usage_coq_makefile () =
+ output_string stderr "Usage summary:\
+\n\
+\ncoq_makefile .... [file.v] ... [file.ml[i4]?] ... [file.ml{lib,pack}]\
+\n ... [any] ... [-extra[-phony] result dependencies command]\
+\n ... [-I dir] ... [-R physicalpath logicalpath]\
+\n ... [-Q physicalpath logicalpath] ... [VARIABLE = value]\
+\n ... [-arg opt] ... [-opt|-byte] [-no-install] [-f file] [-o file]\
+\n [-h] [--help]\
+\n";
+ usage_common ();
+ output_string stderr "\
\n[-f file]: take the contents of file as arguments\
-\n[-o file]: output should go in file file\
+\n[-o file]: output should go in file file (recommended)\
\n Output file outside the current directory is forbidden.\
-\n[-bypass-API]: when compiling plugins, bypass Coq API\
\n[-h]: print this usage summary\
\n[--help]: equivalent to [-h]\n";
exit 1
@@ -199,16 +209,10 @@ let windrive s =
else s
;;
-let generate_conf_coq_config oc args bypass_API =
+let generate_conf_coq_config oc args =
section oc "Coq configuration.";
- let src_dirs = if bypass_API
- then Coq_config.all_src_dirs
- else Coq_config.api_dirs @ Coq_config.plugins_dirs in
+ let src_dirs = Coq_config.all_src_dirs in
Envars.print_config ~prefix_var_name:"COQMF_" oc src_dirs;
- if bypass_API then
- Printf.fprintf oc "OCAML_API_FLAGS=\n"
- else
- Printf.fprintf oc "OCAML_API_FLAGS=-open API\n";
fprintf oc "COQMF_WINDRIVE=%s\n" (windrive Coq_config.coqlib)
;;
@@ -267,7 +271,7 @@ let generate_conf oc project args =
fprintf oc "# %s\n\n" (String.concat " " (List.map quote args));
generate_conf_files oc project;
generate_conf_includes oc project;
- generate_conf_coq_config oc args project.bypass_API;
+ generate_conf_coq_config oc args;
generate_conf_defs oc project;
generate_conf_doc oc project;
generate_conf_extra_target oc project.extra_targets;
@@ -380,8 +384,8 @@ let share_prefix s1 s2 =
| _ -> false
let _ =
+ let _fhandle = Feedback.(add_feeder (console_feedback_listener Format.err_formatter)) in
let prog, args =
- if Array.length Sys.argv = 1 then usage ();
let args = Array.to_list Sys.argv in
let prog = List.hd args in
prog, List.tl args in
@@ -392,7 +396,7 @@ let _ =
let project =
try cmdline_args_to_project ~curdir:Filename.current_dir_name args
- with Parsing_error s -> prerr_endline s; usage () in
+ with Parsing_error s -> prerr_endline s; usage_coq_project () in
if only_destination <> None then begin
destination_of project (Option.get only_destination);
diff --git a/tools/coqdep.ml b/tools/coqdep.ml
index fd4be08b1..2433cb1d0 100644
--- a/tools/coqdep.ml
+++ b/tools/coqdep.ml
@@ -455,7 +455,7 @@ let usage () =
eprintf " -coqlib dir : set the coq standard library directory\n";
eprintf " -suffix s : \n";
eprintf " -slash : deprecated, no effect\n";
- eprintf " -dyndep (opt|byte|both|no|var) : set how dependencies over ML modules are printed";
+ eprintf " -dyndep (opt|byte|both|no|var) : set how dependencies over ML modules are printed\n";
exit 1
let split_period = Str.split (Str.regexp (Str.quote "."))
diff --git a/tools/coqmktop.ml b/tools/coqmktop.ml
deleted file mode 100644
index 950ed53cc..000000000
--- a/tools/coqmktop.ml
+++ /dev/null
@@ -1,314 +0,0 @@
-(************************************************************************)
-(* v * The Coq Proof Assistant / The Coq Development Team *)
-(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *)
-(* \VV/ **************************************************************)
-(* // * This file is distributed under the terms of the *)
-(* * GNU Lesser General Public License Version 2.1 *)
-(************************************************************************)
-
-(** {1 Coqmktop} *)
-
-(** coqmktop is a script to link Coq, analogous to ocamlmktop.
- The command line contains options specific to coqmktop, options for the
- Ocaml linker and files to link (in addition to the default Coq files). *)
-
-(** {6 Utilities} *)
-
-(** Split a string at each blank
-*)
-let split_list =
- let spaces = Str.regexp "[ \t\n]+" in
- fun str -> Str.split spaces str
-
-[@@@ocaml.warning "-3"] (* String.uncapitalize_ascii since 4.03.0 GPR#124 *)
-let capitalize = String.capitalize
-[@@@ocaml.warning "+3"]
-
-let (/) = Filename.concat
-
-(** Which user files do we support (and propagate to ocamlopt) ?
-*)
-let supported_suffix f = match CUnix.get_extension f with
- | ".ml" | ".cmx" | ".cmo" | ".cmxa" | ".cma" | ".c" -> true
- | _ -> false
-
-let supported_flambda_option f = List.mem f Coq_config.flambda_flags
-
-(** From bytecode extension to native
-*)
-let native_suffix f = match CUnix.get_extension f with
- | ".cmo" -> (Filename.chop_suffix f ".cmo") ^ ".cmx"
- | ".cma" -> (Filename.chop_suffix f ".cma") ^ ".cmxa"
- | ".a" -> f
- | _ -> failwith ("File "^f^" has not extension .cmo, .cma or .a")
-
-(** Transforms a file name in the corresponding Caml module name.
-*)
-let module_of_file name =
- capitalize (try Filename.chop_extension name with Invalid_argument _ -> name)
-
-(** Run a command [prog] with arguments [args].
- We do not use [Sys.command] anymore, see comment in [CUnix.sys_command].
-*)
-let run_command prog args =
- match CUnix.sys_command prog args with
- | Unix.WEXITED 127 -> failwith ("no such command "^prog)
- | Unix.WEXITED n -> n
- | Unix.WSIGNALED n -> failwith (prog^" killed by signal "^string_of_int n)
- | Unix.WSTOPPED n -> failwith (prog^" stopped by signal "^string_of_int n)
-
-
-
-(** {6 Coqmktop options} *)
-
-let opt = ref false
-let top = ref false
-let echo = ref false
-let no_start = ref false
-
-let is_ocaml4 = Coq_config.caml_version.[0] <> '3'
-
-(** {6 Includes options} *)
-
-(** Since the Coq core .cma are given with their relative paths
- (e.g. "lib/clib.cma"), we only need to include directories mentionned in
- the temp main ml file below (for accessing the corresponding .cmi). *)
-
-let std_includes basedir =
- let rebase d = match basedir with None -> d | Some base -> base / d in
- ["-I"; rebase ".";
- "-I"; rebase "lib";
- "-I"; rebase "vernac"; (* For Mltop *)
- "-I"; rebase "toplevel";
- "-I"; rebase "kernel/byterun";
- "-I"; Envars.camlp4lib () ] @
- (if is_ocaml4 then ["-I"; "+compiler-libs"] else [])
-
-(** For the -R option, visit all directories under [dir] and add
- corresponding -I to the [opts] option list (in reversed order) *)
-let incl_all_subdirs dir opts =
- let l = ref opts in
- let add f = l := f :: "-I" :: !l in
- let rec traverse dir =
- if Sys.file_exists dir && Sys.is_directory dir then
- let () = add dir in
- let subdirs = try Sys.readdir dir with any -> [||] in
- Array.iter (fun f -> traverse (dir/f)) subdirs
- in
- traverse dir; !l
-
-
-(** {6 Objects to link} *)
-
-(** NB: dynlink is now always linked, it is used for loading plugins
- and compiled vm code (see native-compiler). We now reject platforms
- with ocamlopt but no dynlink.cmxa during ./configure, and give
- instructions there about how to build a dummy dynlink.cmxa,
- cf. dev/dynlink.ml. *)
-
-(** OCaml + CamlpX libraries *)
-
-let ocaml_libs = ["str.cma";"unix.cma";"nums.cma";"dynlink.cma";"threads.cma"]
-let camlp4_libs = ["gramlib.cma"]
-let libobjs = ocaml_libs @ camlp4_libs
-
-(** Toplevel objects *)
-
-let ocaml_topobjs =
- if is_ocaml4 then
- ["ocamlcommon.cma";"ocamlbytecomp.cma";"ocamltoplevel.cma"]
- else
- ["toplevellib.cma"]
-
-let camlp4_topobjs = ["camlp5_top.cma"; "pa_o.cmo"; "pa_extend.cmo"]
-
-let topobjs = ocaml_topobjs @ camlp4_topobjs
-
-(** Coq Core objects *)
-
-let copts = (split_list Coq_config.osdeplibs) @ (split_list Tolink.copts)
-let core_objs = split_list Tolink.core_objs
-let core_libs = split_list Tolink.core_libs
-
-(** Build the list of files to link and the list of modules names
-*)
-let files_to_link userfiles =
- let top = if !top then topobjs else [] in
- let modules = List.map module_of_file (top @ core_objs @ userfiles) in
- let objs = libobjs @ top @ core_libs in
- let objs' = (if !opt then List.map native_suffix objs else objs) @ userfiles
- in (modules, objs')
-
-
-(** {6 Parsing of the command-line} *)
-
-let usage () =
- prerr_endline "Usage: coqmktop <options> <ocaml options> files\
-\nFlags are:\
-\n -coqlib dir Specify where the Coq object files are\
-\n -ocamlfind dir Specify where the ocamlfind binary is\
-\n -camlp4bin dir Specify where the Camlp4/5 binaries are\
-\n -o exec-file Specify the name of the resulting toplevel\
-\n -boot Run in boot mode\
-\n -echo Print calls to external commands\
-\n -opt Compile in native code\
-\n -top Build Coq on a OCaml toplevel (incompatible with -opt)\
-\n -R dir Add recursively dir to OCaml search path\
-\n";
- exit 1
-
-let parse_args () =
- let rec parse (op,fl) = function
- | [] -> List.rev op, List.rev fl
-
- (* Directories *)
- | "-coqlib" :: d :: rem ->
- Flags.coqlib_spec := true; Flags.coqlib := d ; parse (op,fl) rem
- | "-ocamlfind" :: d :: rem ->
- Flags.ocamlfind_spec := true; Flags.ocamlfind := d ; parse (op,fl) rem
- | "-camlp4bin" :: d :: rem ->
- Flags.camlp4bin_spec := true; Flags.camlp4bin := d ; parse (op,fl) rem
- | "-R" :: d :: rem -> parse (incl_all_subdirs d op,fl) rem
- | ("-coqlib"|"-camlbin"|"-camlp4bin"|"-R") :: [] -> usage ()
-
- (* Boolean options of coqmktop *)
- | "-boot" :: rem -> Flags.boot := true; parse (op,fl) rem
- | "-opt" :: rem -> opt := true ; parse (op,fl) rem
- | "-top" :: rem -> top := true ; parse (op,fl) rem
- | "-no-start" :: rem -> no_start:=true; parse (op, fl) rem
- | "-echo" :: rem -> echo := true ; parse (op,fl) rem
-
- (* Extra options with arity 0 or 1, directly passed to ocamlc/ocamlopt *)
- | ("-noassert"|"-compact"|"-g"|"-p"|"-thread"|"-dtypes" as o) :: rem ->
- parse (o::op,fl) rem
- | ("-cclib"|"-ccopt"|"-I"|"-o"|"-w" as o) :: rem' ->
- begin
- match rem' with
- | a :: rem -> parse (a::o::op,fl) rem
- | [] -> usage ()
- end
-
- | ("-h"|"-help"|"--help") :: _ -> usage ()
- | f :: rem when supported_flambda_option f -> parse (op,fl) rem
- | f :: rem when supported_suffix f -> parse (op,f::fl) rem
- | f :: _ -> prerr_endline ("Don't know what to do with " ^ f); exit 1
- in
- parse ([],[]) (List.tl (Array.to_list Sys.argv))
-
-
-(** {6 Temporary main file} *)
-
-(** remove the temporary main file
-*)
-let clean file =
- let rm f = if Sys.file_exists f then Sys.remove f in
- let basename = Filename.chop_suffix file ".ml" in
- if not !echo then begin
- rm file;
- rm (basename ^ ".o");
- rm (basename ^ ".cmi");
- rm (basename ^ ".cmo");
- rm (basename ^ ".cmx")
- end
-
-(** Initializes the kind of loading in the main program
-*)
-let declare_loading_string () =
- if not !top then
- "Mltop.remove ();;"
- else
- "begin try\
-\n (* Enable rectypes in the toplevel if it has the directive #rectypes *)\
-\n begin match Hashtbl.find Toploop.directive_table \"rectypes\" with\
-\n | Toploop.Directive_none f -> f ()\
-\n | _ -> ()\
-\n end\
-\n with\
-\n | Not_found -> ()\
-\n end;;\
-\n\
-\n let ppf = Format.std_formatter;;\
-\n Mltop.set_top\
-\n {Mltop.load_obj=\
-\n (fun f -> if not (Topdirs.load_file ppf f)\
-\n then CErrors.user_err Pp.(str (\"Could not load plugin \"^f)));\
-\n Mltop.use_file=Topdirs.dir_use ppf;\
-\n Mltop.add_dir=Topdirs.dir_directory;\
-\n Mltop.ml_loop=(fun () -> Toploop.loop ppf) };;\
-\n"
-
-(** create a temporary main file to link
-*)
-let create_tmp_main_file modules =
- let main_name,oc = Filename.open_temp_file "coqmain" ".ml" in
- try
- (* Add the pre-linked modules *)
- output_string oc "List.iter Mltop.add_known_module [\"";
- output_string oc (String.concat "\";\"" modules);
- output_string oc "\"];;\n";
- (* Initializes the kind of loading *)
- output_string oc (declare_loading_string());
- (* Start the toplevel loop *)
- if not !no_start then output_string oc "Coqtop.start();;\n";
- close_out oc;
- main_name
- with reraise ->
- clean main_name; raise reraise
-
-(* TODO: remove once OCaml 4.04 is adopted *)
-let split_on_char sep s =
- let r = ref [] in
- let j = ref (String.length s) in
- for i = String.length s - 1 downto 0 do
- if s.[i] = sep then begin
- r := String.sub s (i + 1) (!j - i - 1) :: !r;
- j := i
- end
- done;
- String.sub s 0 !j :: !r
-
-(** {6 Main } *)
-
-let main () =
- let (options, userfiles) = parse_args () in
- (* Directories: *)
- let () = Envars.set_coqlib ~fail:(fun x -> CErrors.user_err Pp.(str x)) in
- let basedir = if !Flags.boot then None else Some (Envars.coqlib ()) in
- (* Which ocaml compiler to invoke *)
- let prog = if !opt then "opt" else "ocamlc" in
- (* Which arguments ? *)
- if !opt && !top then failwith "no custom toplevel in native code!";
- let flags = if !opt then Coq_config.flambda_flags else Coq_config.vmbyteflags in
- let topstart = if !top then [ "topstart.cmo" ] else [] in
- let (modules, tolink) = files_to_link userfiles in
- let main_file = create_tmp_main_file modules in
- try
- (* - We add topstart.cmo explicitly because we shunted ocamlmktop wrapper.
- - With the coq .cma, we MUST use the -linkall option. *)
- let coq_camlflags =
- List.filter ((<>) "") (split_on_char ' ' Coq_config.caml_flags) in
- let args =
- coq_camlflags @ "-linkall" :: "-w" :: "-31" :: flags @ copts @ options @
- (std_includes basedir) @ tolink @ [ main_file ] @ topstart
- in
- if !echo then begin
- let command = String.concat " " (Envars.ocamlfind ()::prog::args) in
- print_endline command;
- print_endline
- ("(command length is " ^
- (string_of_int (String.length command)) ^ " characters)");
- flush Pervasives.stdout
- end;
- let exitcode = run_command (Envars.ocamlfind ()) (prog::args) in
- clean main_file;
- exitcode
- with reraise -> clean main_file; raise reraise
-
-let pr_exn = function
- | Failure msg -> msg
- | Unix.Unix_error (err,fn,arg) -> fn^" "^arg^" : "^Unix.error_message err
- | any -> Printexc.to_string any
-
-let _ =
- try exit (main ())
- with any -> Printf.eprintf "Error: %s\n" (pr_exn any); exit 1
diff --git a/tools/coqworkmgr.ml b/tools/coqworkmgr.ml
index e1d1c60d7..f4777c4fb 100644
--- a/tools/coqworkmgr.ml
+++ b/tools/coqworkmgr.ml
@@ -14,7 +14,7 @@ type party = {
sock : Unix.file_descr;
cout : out_channel;
mutable tokens : int;
- priority : Flags.priority;
+ priority : priority;
}
let answer party msg =
@@ -42,10 +42,10 @@ end = struct
let is_empty q = !q = []
let rec split acc = function
| [] -> List.rev acc, []
- | (_, { priority = Flags.Low }) :: _ as l -> List.rev acc, l
+ | (_, { priority = Low }) :: _ as l -> List.rev acc, l
| x :: xs -> split (x :: acc) xs
let push (_,{ priority } as item) q =
- if priority = Flags.Low then q := !q @ [item]
+ if priority = Low then q := !q @ [item]
else
let high, low = split [] !q in
q := high @ (item :: low)
@@ -148,7 +148,7 @@ let check_alive s =
| Some s ->
let cout = Unix.out_channel_of_descr s in
set_binary_mode_out cout true;
- output_string cout (print_request (Hello Flags.Low)); flush cout;
+ output_string cout (print_request (Hello Low)); flush cout;
output_string cout (print_request Ping); flush cout;
begin match Unix.select [s] [] [] 1.0 with
| [s],_,_ ->
diff --git a/tools/coq-inferior.el b/tools/inferior-coq.el
index b79d97d66..b79d97d66 100644
--- a/tools/coq-inferior.el
+++ b/tools/inferior-coq.el
diff --git a/tools/make-both-single-timing-files.py b/tools/make-both-single-timing-files.py
index 2d33503c3..32c52c7a1 100755
--- a/tools/make-both-single-timing-files.py
+++ b/tools/make-both-single-timing-files.py
@@ -3,16 +3,10 @@ import sys
from TimeFileMaker import *
if __name__ == '__main__':
- USAGE = 'Usage: %s AFTER_FILE_NAME BEFORE_FILE_NAME [OUTPUT_FILE_NAME ..]' % sys.argv[0]
+ USAGE = 'Usage: %s [--sort-by=auto|absolute|diff] AFTER_FILE_NAME BEFORE_FILE_NAME [OUTPUT_FILE_NAME ..]' % sys.argv[0]
HELP_STRING = r'''Formats timing information from the output of two invocations of `coqc -time` into a sorted table'''
- if len(sys.argv) < 3 or '--help' in sys.argv[1:] or '-h' in sys.argv[1:]:
- print(USAGE)
- if '--help' in sys.argv[1:] or '-h' in sys.argv[1:]:
- print(HELP_STRING)
- if len(sys.argv) == 2: sys.exit(0)
- sys.exit(1)
- else:
- left_dict = get_single_file_times(sys.argv[1])
- right_dict = get_single_file_times(sys.argv[2])
- table = make_diff_table_string(left_dict, right_dict, tag="Code")
- print_or_write_table(table, sys.argv[3:])
+ sort_by, args = parse_args(sys.argv, USAGE, HELP_STRING)
+ left_dict = get_single_file_times(args[1])
+ right_dict = get_single_file_times(args[2])
+ table = make_diff_table_string(left_dict, right_dict, tag="Code", sort_by=sort_by)
+ print_or_write_table(table, args[3:])
diff --git a/tools/make-both-time-files.py b/tools/make-both-time-files.py
index 69ec5a663..f730a8d6b 100755
--- a/tools/make-both-time-files.py
+++ b/tools/make-both-time-files.py
@@ -3,20 +3,14 @@ import sys
from TimeFileMaker import *
if __name__ == '__main__':
- USAGE = 'Usage: %s AFTER_FILE_NAME BEFORE_FILE_NAME [OUTPUT_FILE_NAME ..]' % sys.argv[0]
+ USAGE = 'Usage: %s [--sort-by=auto|absolute|diff] AFTER_FILE_NAME BEFORE_FILE_NAME [OUTPUT_FILE_NAME ..]' % sys.argv[0]
HELP_STRING = r'''Formats timing information from the output of two invocations of `make TIMED=1` into a sorted table.
The input is expected to contain lines in the format:
FILE_NAME (...user: NUMBER_IN_SECONDS...)
'''
- if len(sys.argv) < 3 or '--help' in sys.argv[1:] or '-h' in sys.argv[1:]:
- print(USAGE)
- if '--help' in sys.argv[1:] or '-h' in sys.argv[1:]:
- print(HELP_STRING)
- if len(sys.argv) == 2: sys.exit(0)
- sys.exit(1)
- else:
- left_dict = get_times(sys.argv[1])
- right_dict = get_times(sys.argv[2])
- table = make_diff_table_string(left_dict, right_dict)
- print_or_write_table(table, sys.argv[3:])
+ sort_by, args = parse_args(sys.argv, USAGE, HELP_STRING)
+ left_dict = get_times(args[1])
+ right_dict = get_times(args[2])
+ table = make_diff_table_string(left_dict, right_dict, sort_by=sort_by)
+ print_or_write_table(table, args[3:])
diff --git a/tools/md5sum.ml b/tools/md5sum.ml
new file mode 100644
index 000000000..2fdcacc83
--- /dev/null
+++ b/tools/md5sum.ml
@@ -0,0 +1,24 @@
+let get_content file =
+ let ic = open_in_bin file in
+ let buf = Buffer.create 2048 in
+ let rec fill () =
+ match input_char ic with
+ | '\r' -> fill () (* NOTE: handles the case on Windows where the
+ git checkout has included return characters.
+ See: https://github.com/coq/coq/pull/6305 *)
+ | c -> Buffer.add_char buf c; fill ()
+ | exception End_of_file -> close_in ic; Buffer.contents buf
+ in
+ fill ()
+
+let () =
+ match Sys.argv with
+ | [|_; file|] ->
+ let content = get_content file in
+ let md5 = Digest.to_hex (Digest.string content) in
+ print_string (md5 ^ " " ^ file)
+ | _ ->
+ prerr_endline "Error: This program needs exactly one parameter.";
+ prerr_endline "Usage: ocaml md5sum.ml <FILE>";
+ prerr_endline "Print MD5 (128-bit) checksum of the file content modulo \\r.";
+ exit 1
diff --git a/toplevel/coqinit.ml b/toplevel/coqinit.ml
index c80899288..10205964a 100644
--- a/toplevel/coqinit.ml
+++ b/toplevel/coqinit.ml
@@ -27,12 +27,12 @@ let set_rcfile s = rcfile := s; rcfile_specified := true
let load_rc = ref true
let no_load_rc () = load_rc := false
-let load_rcfile doc sid =
+let load_rcfile ~time doc sid =
if !load_rc then
try
if !rcfile_specified then
if CUnix.file_readable_p !rcfile then
- Vernac.load_vernac ~verbosely:false ~interactive:false ~check:true doc sid !rcfile
+ Vernac.load_vernac ~time ~verbosely:false ~interactive:false ~check:true doc sid !rcfile
else raise (Sys_error ("Cannot read rcfile: "^ !rcfile))
else
try
@@ -43,7 +43,7 @@ let load_rcfile doc sid =
Envars.home ~warn / "."^rcdefaultname^"."^Coq_config.version;
Envars.home ~warn / "."^rcdefaultname
] in
- Vernac.load_vernac ~verbosely:false ~interactive:false ~check:true doc sid inferedrc
+ Vernac.load_vernac ~time ~verbosely:false ~interactive:false ~check:true doc sid inferedrc
with Not_found -> doc, sid
(*
Flags.if_verbose
@@ -59,13 +59,23 @@ let load_rcfile doc sid =
doc, sid)
(* Recursively puts dir in the LoadPath if -nois was not passed *)
-let add_stdlib_path ~load_init ~unix_path ~coq_root ~with_ml =
- let add_ml = if with_ml then Mltop.AddRecML else Mltop.AddNoML in
- Mltop.add_rec_path add_ml ~unix_path ~coq_root ~implicit:load_init
+let build_stdlib_path ~load_init ~unix_path ~coq_path ~with_ml =
+ let open Mltop 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 add_userlib_path ~unix_path =
- Mltop.add_rec_path Mltop.AddRecML ~unix_path
- ~coq_root:Nameops.default_root_prefix ~implicit:false
+let build_userlib_path ~unix_path =
+ let open Mltop in
+ { recursive = true;
+ path_spec = VoPath {
+ unix_path;
+ coq_path = Libnames.default_root_prefix;
+ has_ml = Mltop.AddRecML;
+ implicit = false;
+ }
+ }
(* Options -I, -I-as, and -R of the command line *)
let includes = ref []
@@ -74,51 +84,69 @@ let push_include s alias implicit =
let ml_includes = ref []
let push_ml_include s = ml_includes := s :: !ml_includes
-(* Initializes the LoadPath *)
-let init_load_path ~load_init =
+let ml_path_if c p =
+ let open Mltop in
+ let f x = { recursive = false; path_spec = MlPath x } in
+ if c then List.map f p else []
+
+(* LoadPath for toploop toplevels *)
+let toplevel_init_load_path () =
+ let coqlib = Envars.coqlib () in
+ (* NOTE: These directories are searched from last to first *)
+ (* first, developer specific directory to open *)
+ ml_path_if Coq_config.local [coqlib/"dev"] @
+
+ (* main loops *)
+ ml_path_if (Coq_config.local || !Flags.boot) [coqlib/"stm"; coqlib/"ide"] @
+ ml_path_if (System.exists_dir (coqlib/"toploop")) [coqlib/"toploop"]
+
+(* LoadPath for Coq user libraries *)
+let libs_init_load_path ~load_init =
+
+ let open Mltop 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
let coqpath = Envars.coqpath in
- let coq_root = Names.DirPath.make [Nameops.coq_root] in
- (* NOTE: These directories are searched from last to first *)
- (* first, developer specific directory to open *)
- if Coq_config.local then
- Mltop.add_ml_dir (coqlib/"dev");
- (* main loops *)
- if Coq_config.local || !Flags.boot then begin
- Mltop.add_ml_dir (coqlib/"stm");
- Mltop.add_ml_dir (coqlib/"ide")
- end;
- if System.exists_dir (coqlib/"toploop") then
- Mltop.add_ml_dir (coqlib/"toploop");
- (* then standard library *)
- add_stdlib_path ~load_init ~unix_path:(coqlib/"theories") ~coq_root ~with_ml:false;
- (* then plugins *)
- add_stdlib_path ~load_init ~unix_path:(coqlib/"plugins") ~coq_root ~with_ml:true;
- (* then user-contrib *)
- if Sys.file_exists user_contrib then
- add_userlib_path ~unix_path:user_contrib;
- (* then directories in XDG_DATA_DIRS and XDG_DATA_HOME *)
- List.iter (fun s -> add_userlib_path ~unix_path:s) xdg_dirs;
- (* then directories in COQPATH *)
- List.iter (fun s -> add_userlib_path ~unix_path:s) coqpath;
- (* then current directory (not recursively!) *)
- Mltop.add_ml_dir ".";
- Loadpath.add_load_path "." Nameops.default_root_prefix ~implicit:false;
- (* additional loadpath, given with options -Q and -R *)
- List.iter
- (fun (unix_path, coq_root, implicit) ->
- Mltop.add_rec_path Mltop.AddNoML ~unix_path ~coq_root ~implicit)
- (List.rev !includes);
- (* additional ml directories, given with option -I *)
- List.iter Mltop.add_ml_dir (List.rev !ml_includes)
+ let coq_path = Names.DirPath.make [Libnames.coq_root] in
+
+ (* then standard library and plugins *)
+ [build_stdlib_path ~load_init ~unix_path:(coqlib/"theories") ~coq_path ~with_ml:false;
+ build_stdlib_path ~load_init ~unix_path:(coqlib/"plugins") ~coq_path ~with_ml:true ] @
+
+ (* then user-contrib *)
+ (if Sys.file_exists user_contrib then
+ [build_userlib_path ~unix_path:user_contrib] else []
+ ) @
+
+ (* then directories in XDG_DATA_DIRS and XDG_DATA_HOME and COQPATH *)
+ List.map (fun s -> build_userlib_path ~unix_path:s) (xdg_dirs @ coqpath) @
+
+ (* then current directory (not recursively!) *)
+ [ { recursive = false;
+ path_spec = VoPath { unix_path = ".";
+ coq_path = Libnames.default_root_prefix;
+ implicit = false;
+ has_ml = AddTopML }
+ } ] @
+
+ (* additional loadpaths, given with options -Q and -R *)
+ List.map
+ (fun (unix_path, coq_path, implicit) ->
+ { recursive = true;
+ path_spec = VoPath { unix_path; coq_path; has_ml = Mltop.AddNoML; implicit } })
+ (List.rev !includes) @
+
+ (* additional ml directories, given with option -I *)
+ List.map (fun s -> {recursive = false; path_spec = MlPath s}) (List.rev !ml_includes)
(* 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 lp s = { recursive = false; path_spec = MlPath s } in
let add_subdir dl =
- Mltop.add_ml_dir (List.fold_left (/) Envars.coqroot [dl])
+ Mltop.add_coq_path (lp (List.fold_left (/) Envars.coqroot [dl]))
in
- Mltop.add_ml_dir (Envars.coqlib ());
+ Mltop.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 60ed698b8..0d2da84bb 100644
--- a/toplevel/coqinit.mli
+++ b/toplevel/coqinit.mli
@@ -13,13 +13,16 @@ val set_debug : unit -> unit
val set_rcfile : string -> unit
val no_load_rc : unit -> unit
-val load_rcfile : Stm.doc -> Stateid.t -> Stm.doc * Stateid.t
+val load_rcfile : time:bool -> Stm.doc -> Stateid.t -> Stm.doc * Stateid.t
val push_include : string -> Names.DirPath.t -> bool -> unit
(** [push_include phys_path log_path implicit] *)
val push_ml_include : string -> unit
-val init_load_path : load_init:bool -> unit
-
val init_ocaml_path : unit -> unit
+
+(* LoadPath for toploop toplevels *)
+val toplevel_init_load_path : unit -> Mltop.coq_path list
+(* LoadPath for Coq user libraries *)
+val libs_init_load_path : load_init:bool -> Mltop.coq_path list
diff --git a/toplevel/coqloop.ml b/toplevel/coqloop.ml
index 910c81381..5c1b27c33 100644
--- a/toplevel/coqloop.ml
+++ b/toplevel/coqloop.ml
@@ -300,13 +300,13 @@ let coqloop_feed (fb : Feedback.feedback) = let open Feedback in
is caught and handled (i.e. not re-raised).
*)
-let do_vernac doc sid =
+let do_vernac ~time doc sid =
top_stderr (fnl());
if !print_emacs then top_stderr (str (top_buffer.prompt doc));
resynch_buffer top_buffer;
try
let input = (top_buffer.tokens, None) in
- Vernac.process_expr doc sid (read_sentence ~doc sid (fst input))
+ Vernac.process_expr ~time doc sid (read_sentence ~doc sid (fst input))
with
| Stm.End_of_input | CErrors.Quit ->
top_stderr (fnl ()); raise CErrors.Quit
@@ -337,13 +337,13 @@ let loop_flush_all () =
Format.pp_print_flush !Topfmt.std_ft ();
Format.pp_print_flush !Topfmt.err_ft ()
-let rec loop doc =
+let rec loop ~time doc =
Sys.catch_break true;
try
reset_input_buffer doc stdin top_buffer;
(* Be careful to keep this loop tail-recursive *)
let rec vernac_loop doc sid =
- let ndoc, nsid = do_vernac doc sid in
+ let ndoc, nsid = do_vernac ~time doc sid in
loop_flush_all ();
vernac_loop ndoc nsid
(* We recover the current stateid, threading from the caller is
@@ -358,4 +358,4 @@ let rec loop doc =
fnl() ++
str"Please report" ++
strbrk" at " ++ str Coq_config.wwwbugtracker ++ str ".");
- loop doc
+ loop ~time doc
diff --git a/toplevel/coqloop.mli b/toplevel/coqloop.mli
index 46934f326..09240ec82 100644
--- a/toplevel/coqloop.mli
+++ b/toplevel/coqloop.mli
@@ -32,8 +32,8 @@ val coqloop_feed : Feedback.feedback -> unit
(** Parse and execute one vernac command. *)
-val do_vernac : Stm.doc -> Stateid.t -> Stm.doc * Stateid.t
+val do_vernac : time:bool -> Stm.doc -> Stateid.t -> Stm.doc * Stateid.t
(** Main entry point of Coq: read and execute vernac commands. *)
-val loop : Stm.doc -> Stm.doc
+val loop : time:bool -> Stm.doc -> Stm.doc
diff --git a/toplevel/coqtop.ml b/toplevel/coqtop.ml
index f3d5d9b85..400f7048d 100644
--- a/toplevel/coqtop.ml
+++ b/toplevel/coqtop.ml
@@ -71,7 +71,7 @@ let init_color () =
let toploop_init = ref begin fun x ->
let () = init_color () in
- let () = CoqworkmgrApi.(init !Flags.async_proofs_worker_priority) in
+ let () = CoqworkmgrApi.init !WorkerLoop.async_proofs_worker_priority in
x
end
@@ -80,6 +80,7 @@ let toploop_init = ref begin fun x ->
bogus. For now we just print to the console too *)
let coqtop_init_feed = Coqloop.coqloop_feed
let drop_last_doc = ref None
+let measure_time = ref false
(* Default toplevel loop *)
let console_toploop_run doc =
@@ -89,7 +90,7 @@ let console_toploop_run doc =
Flags.if_verbose warning "Dumpglob cannot be used in interactive mode.";
Dumpglob.noglob ()
end;
- let doc = Coqloop.loop doc in
+ let doc = Coqloop.loop ~time:!measure_time doc in
(* Initialise and launch the Ocaml toplevel *)
drop_last_doc := Some doc;
Coqinit.init_ocaml_path();
@@ -180,19 +181,19 @@ let load_vernacular_list = ref ([] : (string * bool) list)
let add_load_vernacular verb s =
load_vernacular_list := ((CUnix.make_suffix s ".v"),verb) :: !load_vernacular_list
-let load_vernacular doc sid =
+let load_vernacular ~time doc sid =
List.fold_left
(fun (doc,sid) (f_in, verbosely) ->
let s = Loadpath.locate_file f_in in
if !Flags.beautify then
- Flags.with_option Flags.beautify_file (Vernac.load_vernac ~verbosely ~interactive:false ~check:true doc sid) f_in
+ Flags.with_option Flags.beautify_file (Vernac.load_vernac ~time ~verbosely ~interactive:false ~check:true doc sid) f_in
else
- Vernac.load_vernac ~verbosely ~interactive:false ~check:true doc sid s)
+ Vernac.load_vernac ~time ~verbosely ~interactive:false ~check:true doc sid s)
(doc, sid) (List.rev !load_vernacular_list)
-let load_init_vernaculars doc sid =
- let doc, sid = Coqinit.load_rcfile doc sid in
- load_vernacular doc sid
+let load_init_vernaculars ~time doc sid =
+ let doc, sid = Coqinit.load_rcfile ~time doc sid in
+ load_vernacular ~time doc sid
(******************************************************************************)
(* Required Modules *)
@@ -290,8 +291,10 @@ let ensure_exists f =
if not (Sys.file_exists f) then
compile_error (hov 0 (str "Can't find file" ++ spc () ++ str f))
+let top_stm_options = ref Stm.AsyncOpts.default_opts
+
(* Compile a vernac file *)
-let compile ~verbosely ~f_in ~f_out =
+let compile ~time ~verbosely ~f_in ~f_out =
let check_pending_proofs () =
let pfs = Proof_global.get_all_proof_names () in
if not (CList.is_empty pfs) then
@@ -301,6 +304,9 @@ let compile ~verbosely ~f_in ~f_out =
|> prlist_with_sep pr_comma Names.Id.print)
++ str ".")
in
+ let iload_path = Coqinit.libs_init_load_path ~load_init:!load_init in
+ let require_libs = require_libs () in
+ let stm_options = !top_stm_options in
match !compilation_mode with
| BuildVo ->
Flags.record_aux_file := true;
@@ -313,10 +319,12 @@ let compile ~verbosely ~f_in ~f_out =
let doc, sid = Stm.(new_doc
{ doc_type = VoDoc long_f_dot_vo;
- require_libs = require_libs ()
+ iload_path;
+ require_libs;
+ stm_options;
}) in
- let doc, sid = load_init_vernaculars doc sid in
+ let doc, sid = load_init_vernaculars ~time doc sid in
let ldir = Stm.get_ldir ~doc in
Aux_file.(start_aux_file
~aux_file:(aux_file_name_for long_f_dot_vo)
@@ -324,7 +332,7 @@ let compile ~verbosely ~f_in ~f_out =
Dumpglob.start_dump_glob ~vfile:long_f_dot_v ~vofile:long_f_dot_vo;
Dumpglob.dump_string ("F" ^ Names.DirPath.to_string ldir ^ "\n");
let wall_clock1 = Unix.gettimeofday () in
- let doc, _ = Vernac.load_vernac ~verbosely ~check:true ~interactive:false doc (Stm.get_current_state ~doc) long_f_dot_v in
+ let doc, _ = Vernac.load_vernac ~time ~verbosely ~check:true ~interactive:false doc (Stm.get_current_state ~doc) long_f_dot_v in
let _doc = Stm.join ~doc in
let wall_clock2 = Unix.gettimeofday () in
check_pending_proofs ();
@@ -333,8 +341,8 @@ let compile ~verbosely ~f_in ~f_out =
(Printf.sprintf "%.3f" (wall_clock2 -. wall_clock1));
Aux_file.stop_aux_file ();
Dumpglob.end_dump_glob ()
- | BuildVio ->
+ | BuildVio ->
Flags.record_aux_file := false;
Dumpglob.noglob ();
@@ -348,13 +356,15 @@ let compile ~verbosely ~f_in ~f_out =
let doc, sid = Stm.(new_doc
{ doc_type = VioDoc long_f_dot_vio;
- require_libs = require_libs ()
+ iload_path;
+ require_libs;
+ stm_options;
}) in
- let doc, sid = load_init_vernaculars doc sid in
+ let doc, sid = load_init_vernaculars ~time doc sid in
let ldir = Stm.get_ldir ~doc in
- let doc, _ = Vernac.load_vernac ~verbosely ~check:false ~interactive:false doc (Stm.get_current_state ~doc) long_f_dot_v in
+ let doc, _ = Vernac.load_vernac ~time ~verbosely ~check:false ~interactive:false doc (Stm.get_current_state ~doc) long_f_dot_v in
let doc = Stm.finish ~doc in
check_pending_proofs ();
let _doc = Stm.snapshot_vio ~doc ldir long_f_dot_vio in
@@ -369,9 +379,9 @@ let compile ~verbosely ~f_in ~f_out =
let univs, proofs = Stm.finish_tasks lfdv univs disch proofs tasks in
Library.save_library_raw lfdv sum lib univs proofs
-let compile ~verbosely ~f_in ~f_out =
+let compile ~time ~verbosely ~f_in ~f_out =
ignore(CoqworkmgrApi.get 1);
- compile ~verbosely ~f_in ~f_out;
+ compile ~time ~verbosely ~f_in ~f_out;
CoqworkmgrApi.giveback 1
let compile_file (verbosely,f_in) =
@@ -381,9 +391,9 @@ let compile_file (verbosely,f_in) =
else
compile ~verbosely ~f_in ~f_out:None
-let compile_files doc =
+let compile_files ~time =
if !compile_list == [] then ()
- else List.iter compile_file (List.rev !compile_list)
+ else List.iter (compile_file ~time) (List.rev !compile_list)
(******************************************************************************)
(* VIO Dispatching *)
@@ -419,12 +429,15 @@ let set_vio_checking_j opt j =
prerr_endline "setting the J variable like in 'make vio2vo J=3'";
exit 1
-let schedule_vio_checking () =
- if !vio_files <> [] && !vio_checking then
- Vio_checking.schedule_vio_checking !vio_files_j !vio_files
+let schedule_vio () =
+ (* We must add update the loadpath here as the scheduling process
+ happens outside of the STM *)
+ let iload_path = Coqinit.libs_init_load_path ~load_init:!load_init in
+ List.iter Mltop.add_coq_path iload_path;
-let schedule_vio_compilation () =
- if !vio_files <> [] && not !vio_checking then
+ if !vio_checking then
+ Vio_checking.schedule_vio_checking !vio_files_j !vio_files
+ else
Vio_checking.schedule_vio_compilation !vio_files_j !vio_files
(******************************************************************************)
@@ -488,11 +501,12 @@ exception NoCoqLib
let usage batch =
begin
- try
- Envars.set_coqlib ~fail:(fun x -> raise NoCoqLib);
- Coqinit.init_load_path ~load_init:!load_init;
- with NoCoqLib -> usage_no_coqlib ()
+ try Envars.set_coqlib ~fail:(fun x -> raise NoCoqLib)
+ with NoCoqLib -> usage_no_coqlib ()
end;
+ let lp = Coqinit.toplevel_init_load_path () in
+ (* Necessary for finding the toplevels below *)
+ List.iter Mltop.add_coq_path lp;
if batch then Usage.print_usage_coqc ()
else begin
Mltop.load_ml_objects_raw_rex
@@ -529,18 +543,18 @@ let print_config = ref false
let print_tags = ref false
let get_priority opt s =
- try Flags.priority_of_string s
+ try CoqworkmgrApi.priority_of_string s
with Invalid_argument _ ->
prerr_endline ("Error: low/high expected after "^opt); exit 1
-let get_async_proofs_mode opt = function
- | "no" | "off" -> Flags.APoff
- | "yes" | "on" -> Flags.APon
- | "lazy" -> Flags.APonLazy
+let get_async_proofs_mode opt = let open Stm.AsyncOpts in function
+ | "no" | "off" -> APoff
+ | "yes" | "on" -> APon
+ | "lazy" -> APonLazy
| _ -> prerr_endline ("Error: on/off/lazy expected after "^opt); exit 1
let get_cache opt = function
- | "force" -> Some Flags.Force
+ | "force" -> Some Stm.AsyncOpts.Force
| _ -> prerr_endline ("Error: force expected after "^opt); exit 1
@@ -649,23 +663,47 @@ let parse_args arglist =
(* Options with one arg *)
|"-coqlib" -> Flags.coqlib_spec:=true; Flags.coqlib:=(next ())
|"-async-proofs" ->
- Flags.async_proofs_mode := get_async_proofs_mode opt (next())
+ top_stm_options :=
+ { !top_stm_options with
+ Stm.AsyncOpts.async_proofs_mode = get_async_proofs_mode opt (next())
+ }
|"-async-proofs-j" ->
- Flags.async_proofs_n_workers := (get_int opt (next ()))
+ top_stm_options :=
+ { !top_stm_options with
+ Stm.AsyncOpts.async_proofs_n_workers = (get_int opt (next ()))
+ }
|"-async-proofs-cache" ->
- Flags.async_proofs_cache := get_cache opt (next ())
+ top_stm_options :=
+ { !top_stm_options with
+ Stm.AsyncOpts.async_proofs_cache = get_cache opt (next ())
+ }
|"-async-proofs-tac-j" ->
- Flags.async_proofs_n_tacworkers := (get_int opt (next ()))
+ top_stm_options :=
+ { !top_stm_options with
+ Stm.AsyncOpts.async_proofs_n_tacworkers = (get_int opt (next ()))
+ }
|"-async-proofs-worker-priority" ->
- Flags.async_proofs_worker_priority := get_priority opt (next ())
+ WorkerLoop.async_proofs_worker_priority := get_priority opt (next ())
|"-async-proofs-private-flags" ->
- Flags.async_proofs_private_flags := Some (next ());
+ top_stm_options :=
+ { !top_stm_options with
+ Stm.AsyncOpts.async_proofs_private_flags = Some (next ());
+ }
|"-async-proofs-tactic-error-resilience" ->
- Flags.async_proofs_tac_error_resilience := get_error_resilience opt (next ())
+ top_stm_options :=
+ { !top_stm_options with
+ Stm.AsyncOpts.async_proofs_tac_error_resilience = get_error_resilience opt (next ());
+ }
|"-async-proofs-command-error-resilience" ->
- Flags.async_proofs_cmd_error_resilience := get_bool opt (next ())
+ top_stm_options :=
+ { !top_stm_options with
+ Stm.AsyncOpts.async_proofs_cmd_error_resilience = get_bool opt (next ())
+ }
|"-async-proofs-delegation-threshold" ->
- Flags.async_proofs_delegation_threshold:= get_float opt (next ())
+ top_stm_options :=
+ { !top_stm_options with
+ Stm.AsyncOpts.async_proofs_delegation_threshold = get_float opt (next ())
+ }
|"-worker-id" -> set_worker_id opt (next ())
|"-compat" ->
let v = G_vernac.parse_compat_version ~allow_old:false (next ()) in
@@ -705,9 +743,15 @@ let parse_args arglist =
|"-async-queries-always-delegate"
|"-async-proofs-always-delegate"
|"-async-proofs-full" ->
- Flags.async_proofs_full := true;
+ top_stm_options :=
+ { !top_stm_options with
+ Stm.AsyncOpts.async_proofs_full = true;
+ }
|"-async-proofs-never-reopen-branch" ->
- Flags.async_proofs_never_reopen_branch := true;
+ top_stm_options :=
+ { !top_stm_options with
+ Stm.AsyncOpts.async_proofs_never_reopen_branch = true;
+ }
|"-batch" -> set_batch_mode ()
|"-test-mode" -> Flags.test_mode := true
|"-beautify" -> Flags.beautify := true
@@ -716,7 +760,7 @@ let parse_args arglist =
|"-color" -> set_color (next ())
|"-config"|"--config" -> print_config := true
|"-debug" -> Coqinit.set_debug ()
- |"-stm-debug" -> Flags.stm_debug := true
+ |"-stm-debug" -> Stm.stm_debug := true
|"-emacs" -> set_emacs ()
|"-filteropts" -> filter_opts := true
|"-h"|"-H"|"-?"|"-help"|"--help" -> usage !batch_mode
@@ -727,18 +771,16 @@ let parse_args arglist =
|"-noinit"|"-nois" -> load_init := false
|"-no-glob"|"-noglob" -> Dumpglob.noglob (); glob_opt := true
|"-native-compiler" ->
- if Coq_config.no_native_compiler then
+ if not Coq_config.native_compiler then
warning "Native compilation was disabled at configure time."
- else Flags.native_compiler := true
+ else Flags.output_native_objects := true
|"-output-context" -> output_context := true
|"-profile-ltac" -> Flags.profile_ltac := true
|"-q" -> Coqinit.no_load_rc ()
|"-quiet"|"-silent" -> Flags.quiet := true; Flags.make_warn false
- |"-quick" ->
- Safe_typing.allow_delayed_constants := true;
- compilation_mode := BuildVio
+ |"-quick" -> compilation_mode := BuildVio
|"-list-tags" -> print_tags := true
- |"-time" -> Flags.time := true
+ |"-time" -> measure_time := true
|"-type-in-type" -> set_type_in_type ()
|"-unicode" -> add_require ("Utf8_core", None, Some false)
|"-v"|"--version" -> Usage.version (exitcode ())
@@ -758,7 +800,7 @@ let init_toplevel arglist =
(* Coq's init process, phase 1:
- OCaml parameters, and basic structures and IO
*)
- Profile.init_profile ();
+ CProfile.init_profile ();
init_gc ();
Sys.catch_break false; (* Ctrl-C is fatal during the initialisation *)
let init_feeder = Feedback.add_feeder coqtop_init_feed in
@@ -777,7 +819,8 @@ let init_toplevel arglist =
if !print_config then (Envars.print_config stdout Coq_config.all_src_dirs; exit (exitcode ()));
if !print_tags then (print_style_tags (); exit (exitcode ()));
if !filter_opts then (print_string (String.concat "\n" extras); exit 0);
- Coqinit.init_load_path ~load_init:!load_init;
+ let top_lp = Coqinit.toplevel_init_load_path () in
+ List.iter Mltop.add_coq_path top_lp;
Option.iter Mltop.load_ml_object_raw !toploop;
let extras = !toploop_init extras in
if not (CList.is_empty extras) then begin
@@ -806,22 +849,32 @@ let init_toplevel arglist =
We split the codepath here depending whether coqtop is called
in interactive mode or not. *)
- if (not !batch_mode || CList.is_empty !compile_list)
+ (* The condition for starting the interactive mode is a bit
+ convoluted, we should really refactor batch/compilation_mode
+ more. *)
+ if (not !batch_mode
+ || CList.(is_empty !compile_list && is_empty !vio_files && is_empty !vio_tasks))
(* Interactive *)
then begin
+ let iload_path = Coqinit.libs_init_load_path ~load_init:!load_init in
+ let require_libs = require_libs () in
+ let stm_options = !top_stm_options in
try
let doc, sid = Stm.(new_doc
{ doc_type = Interactive !toplevel_name;
- require_libs = require_libs ()
+ iload_path;
+ require_libs;
+ stm_options;
}) in
- Some (load_init_vernaculars doc sid)
+ Some (load_init_vernaculars ~time:!measure_time doc sid)
with any -> flush_all(); fatal_error any
(* Non interactive *)
end else begin
try
- compile_files ();
- schedule_vio_checking ();
- schedule_vio_compilation ();
+ compile_files ~time:!measure_time;
+ (* Vio compile pass *)
+ if !vio_files <> [] then schedule_vio ();
+ (* Vio task pass *)
check_vio_tasks ();
(* Allow the user to output an arbitrary state *)
outputstate ();
@@ -844,9 +897,9 @@ let start () =
exit 1
| _ ->
flush_all();
- if !output_context then
- Feedback.msg_notice Flags.(with_option raw_print Prettyp.print_full_pure_context () ++ fnl ());
- Profile.print_profile ();
+ if !output_context then begin
+ let sigma, env = Pfedit.get_current_context () in
+ Feedback.msg_notice (Flags.(with_option raw_print (Prettyp.print_full_pure_context env) sigma) ++ fnl ())
+ end;
+ CProfile.print_profile ();
exit 0
-
-(* [Coqtop.start] will be called by the code produced by coqmktop *)
diff --git a/toplevel/coqtop_bin.ml b/toplevel/coqtop_bin.ml
new file mode 100644
index 000000000..56aced92a
--- /dev/null
+++ b/toplevel/coqtop_bin.ml
@@ -0,0 +1,2 @@
+(* Main coqtop initialization *)
+let () = Coqtop.start()
diff --git a/toplevel/coqtop_byte_bin.ml b/toplevel/coqtop_byte_bin.ml
new file mode 100644
index 000000000..7d8354ec3
--- /dev/null
+++ b/toplevel/coqtop_byte_bin.ml
@@ -0,0 +1,21 @@
+let drop_setup () =
+ begin try
+ (* Enable rectypes in the toplevel if it has the directive #rectypes *)
+ begin match Hashtbl.find Toploop.directive_table "rectypes" with
+ | Toploop.Directive_none f -> f ()
+ | _ -> ()
+ end
+ with
+ | Not_found -> ()
+ end;
+ let ppf = Format.std_formatter in
+ Mltop.(set_top
+ { load_obj = (fun f -> if not (Topdirs.load_file ppf f)
+ then CErrors.user_err Pp.(str ("Could not load plugin "^f))
+ );
+ use_file = Topdirs.dir_use ppf;
+ add_dir = Topdirs.dir_directory;
+ ml_loop = (fun () -> Toploop.loop ppf);
+ })
+
+let _ = drop_setup ()
diff --git a/toplevel/coqtop_opt_bin.ml b/toplevel/coqtop_opt_bin.ml
new file mode 100644
index 000000000..410b4679a
--- /dev/null
+++ b/toplevel/coqtop_opt_bin.ml
@@ -0,0 +1,3 @@
+let drop_setup () = Mltop.remove ()
+
+let _ = drop_setup ()
diff --git a/toplevel/vernac.ml b/toplevel/vernac.ml
index cf63fbdc3..6b45a94bc 100644
--- a/toplevel/vernac.ml
+++ b/toplevel/vernac.ml
@@ -100,7 +100,9 @@ let print_cmd_header ?loc com =
Format.pp_print_flush !Topfmt.std_ft ()
let pr_open_cur_subgoals () =
- try Printer.pr_open_subgoals ()
+ try
+ let proof = Proof_global.give_me_the_proof () in
+ Printer.pr_open_subgoals ~proof
with Proof_global.NoCurrentProof -> Pp.str ""
(* Reenable when we get back to feedback printing *)
@@ -108,15 +110,15 @@ let pr_open_cur_subgoals () =
(* Stm.End_of_input -> true *)
(* | _ -> false *)
-let rec interp_vernac ~check ~interactive doc sid (loc,com) =
- let interp = function
+let rec interp_vernac ~time ~check ~interactive doc sid (loc,com) =
+ let interp v =
+ match under_control v with
| VernacLoad (verbosely, fname) ->
- let fname = Envars.expand_path_macros ~warn:(fun x -> Feedback.msg_warning (str x)) fname in
+ let fname = Envars.expand_path_macros ~warn:(fun x -> Feedback.msg_warning (str x)) fname in
let fname = CUnix.make_suffix fname ".v" in
let f = Loadpath.locate_file fname in
- load_vernac ~verbosely ~check ~interactive doc sid f
- | v ->
-
+ load_vernac ~time ~verbosely ~check ~interactive doc sid f
+ | _ ->
(* XXX: We need to run this before add as the classification is
highly dynamic and depends on the structure of the
document. Hopefully this is fixed when VtMeta can be removed
@@ -155,8 +157,8 @@ let rec interp_vernac ~check ~interactive doc sid (loc,com) =
try
(* The -time option is only supported from console-based
clients due to the way it prints. *)
- if !Flags.time then print_cmd_header ?loc com;
- let com = if !Flags.time then VernacTime (loc,com) else com in
+ if time then print_cmd_header ?loc com;
+ let com = if time then VernacTime(time,(loc,com)) else com in
interp com
with reraise ->
(* XXX: In non-interactive mode edit_at seems to do very weird
@@ -170,7 +172,7 @@ let rec interp_vernac ~check ~interactive doc sid (loc,com) =
end in iraise (reraise, info)
(* Load a vernac file. CErrors are annotated with file and location *)
-and load_vernac ~verbosely ~check ~interactive doc sid file =
+and load_vernac ~time ~verbosely ~check ~interactive doc sid file =
let ft_beautify, close_beautify =
if !Flags.beautify_file then
let chan_beautify = open_out (file^beautify_suffix) in
@@ -212,7 +214,7 @@ and load_vernac ~verbosely ~check ~interactive doc sid file =
Option.iter (vernac_echo ?loc) in_echo;
checknav_simple (loc, ast);
- let ndoc, nsid = Flags.silently (interp_vernac ~check ~interactive !rdoc !rsid) (loc, ast) in
+ let ndoc, nsid = Flags.silently (interp_vernac ~time ~check ~interactive !rdoc !rsid) (loc, ast) in
rsid := nsid;
rdoc := ndoc
done;
@@ -239,6 +241,6 @@ and load_vernac ~verbosely ~check ~interactive doc sid file =
of a new state label). An example of state-preserving command is one coming
from the query panel of Coqide. *)
-let process_expr doc sid loc_ast =
+let process_expr ~time doc sid loc_ast =
checknav_deep loc_ast;
- interp_vernac ~interactive:true ~check:true doc sid loc_ast
+ interp_vernac ~time ~interactive:true ~check:true doc sid loc_ast
diff --git a/toplevel/vernac.mli b/toplevel/vernac.mli
index f9a430026..b77b024fa 100644
--- a/toplevel/vernac.mli
+++ b/toplevel/vernac.mli
@@ -12,9 +12,9 @@
expected to handle and print errors in form of exceptions, however
care is taken so the state machine is left in a consistent
state. *)
-val process_expr : Stm.doc -> Stateid.t -> Vernacexpr.vernac_expr Loc.located -> Stm.doc * Stateid.t
+val process_expr : time:bool -> Stm.doc -> Stateid.t -> Vernacexpr.vernac_control Loc.located -> Stm.doc * Stateid.t
(** [load_vernac echo sid file] Loads [file] on top of [sid], will
echo the commands if [echo] is set. Callers are expected to handle
and print errors in form of exceptions. *)
-val load_vernac : verbosely:bool -> check:bool -> interactive:bool -> Stm.doc -> Stateid.t -> string -> Stm.doc * Stateid.t
+val load_vernac : time:bool -> verbosely:bool -> check:bool -> interactive:bool -> Stm.doc -> Stateid.t -> string -> Stm.doc * Stateid.t
diff --git a/vernac/assumptions.ml b/vernac/assumptions.ml
index 6711b14da..d22024568 100644
--- a/vernac/assumptions.ml
+++ b/vernac/assumptions.ml
@@ -18,7 +18,7 @@ open Pp
open CErrors
open Util
open Names
-open Term
+open Constr
open Declarations
open Mod_subst
open Globnames
@@ -89,7 +89,7 @@ and fields_of_mp mp =
let mb = lookup_module_in_impl mp in
let fields,inner_mp,subs = fields_of_mb empty_subst mb [] in
let subs =
- if mp_eq inner_mp mp then subs
+ if ModPath.equal inner_mp mp then subs
else add_mp inner_mp mp mb.mod_delta subs
in
Modops.subst_structure subs fields
@@ -118,7 +118,7 @@ and fields_of_expression x = fields_of_functor fields_of_expr x
let lookup_constant_in_impl cst fallback =
try
- let mp,dp,lab = repr_kn (canonical_con cst) in
+ let mp,dp,lab = KerName.repr (Constant.canonical cst) in
let fields = memoize_fields_of_mp mp in
(* A module found this way is necessarily closed, in particular
our constant cannot be in an opened section : *)
@@ -131,7 +131,7 @@ let lookup_constant_in_impl cst fallback =
- The label has not been found in the structure. This is an error *)
match fallback with
| Some cb -> cb
- | None -> anomaly (str "Print Assumption: unknown constant " ++ pr_con cst ++ str ".")
+ | None -> anomaly (str "Print Assumption: unknown constant " ++ Constant.print cst ++ str ".")
let lookup_constant cst =
try
@@ -142,7 +142,7 @@ let lookup_constant cst =
let lookup_mind_in_impl mind =
try
- let mp,dp,lab = repr_kn (canonical_mind mind) in
+ let mp,dp,lab = KerName.repr (MutInd.canonical mind) in
let fields = memoize_fields_of_mp mp in
search_mind_label lab fields
with Not_found ->
@@ -156,14 +156,14 @@ let lookup_mind mind =
traversed objects *)
let label_of = function
- | ConstRef kn -> pi3 (repr_con kn)
+ | ConstRef kn -> pi3 (Constant.repr3 kn)
| IndRef (kn,_)
- | ConstructRef ((kn,_),_) -> pi3 (repr_mind kn)
+ | ConstructRef ((kn,_),_) -> pi3 (MutInd.repr3 kn)
| VarRef id -> Label.of_id id
let fold_constr_with_full_binders g f n acc c =
let open Context.Rel.Declaration in
- match kind_of_term c with
+ match Constr.kind c with
| Rel _ | Meta _ | Var _ | Sort _ | Const _ | Ind _ | Construct _ -> acc
| Cast (c,_, t) -> f n (f n acc c) t
| Prod (na,t,c) -> f (g (LocalAssum (na,t)) n) (f n acc t) c
@@ -182,7 +182,7 @@ let fold_constr_with_full_binders g f n acc c =
let fd = Array.map2 (fun t b -> (t,b)) tl bl in
Array.fold_left (fun acc (t,b) -> f n' (f n acc t) b) acc fd
-let rec traverse current ctx accu t = match kind_of_term t with
+let rec traverse current ctx accu t = match Constr.kind t with
| Var id ->
let body () = id |> Global.lookup_named |> NamedDecl.get_value in
traverse_object accu body (VarRef id)
diff --git a/vernac/assumptions.mli b/vernac/assumptions.mli
index 46730f824..afe932ead 100644
--- a/vernac/assumptions.mli
+++ b/vernac/assumptions.mli
@@ -7,7 +7,7 @@
(************************************************************************)
open Names
-open Term
+open Constr
open Globnames
open Printer
@@ -21,11 +21,11 @@ open Printer
val traverse :
Label.t -> constr ->
(Refset_env.t * Refset_env.t Refmap_env.t *
- (label * Context.Rel.t * types) list Refmap_env.t)
+ (Label.t * Context.Rel.t * types) list Refmap_env.t)
(** Collects all the assumptions (optionally including opaque definitions)
on which a term relies (together with their type). The above warning of
{!traverse} also applies. *)
val assumptions :
?add_opaque:bool -> ?add_transparent:bool -> transparent_state ->
- global_reference -> constr -> Term.types ContextObjectMap.t
+ global_reference -> constr -> types ContextObjectMap.t
diff --git a/vernac/auto_ind_decl.ml b/vernac/auto_ind_decl.ml
index 66a4a2e49..ec6b62ee2 100644
--- a/vernac/auto_ind_decl.ml
+++ b/vernac/auto_ind_decl.ml
@@ -13,12 +13,12 @@ open CErrors
open Util
open Pp
open Term
+open Constr
open Vars
open Termops
open Declarations
open Names
open Globnames
-open Nameops
open Inductiveops
open Tactics
open Ind_tables
@@ -199,7 +199,7 @@ let build_beq_scheme mode kn =
| Cast (x,_,_) -> aux (EConstr.applist (x,a))
| App _ -> assert false
| Ind ((kn',i as ind'),u) (*FIXME: universes *) ->
- if eq_mind kn kn' then mkRel(eqA-nlist-i+nb_ind-1), Safe_typing.empty_private_constants
+ if MutInd.equal kn kn' then mkRel(eqA-nlist-i+nb_ind-1), Safe_typing.empty_private_constants
else begin
try
let eq, eff =
@@ -317,7 +317,7 @@ let build_beq_scheme mode kn =
let kelim = Inductive.elim_sorts (mib,mib.mind_packets.(i)) in
if not (Sorts.List.mem InSet kelim) then
raise (NonSingletonProp (kn,i));
- if mib.mind_finite = Decl_kinds.CoFinite then
+ if mib.mind_finite = CoFinite then
raise NoDecidabilityCoInductive;
let fix = mkFix (((Array.make nb_ind 0),i),(names,types,cores)) in
create_input fix),
@@ -360,15 +360,15 @@ let do_replace_lb mode lb_scheme_key aavoid narg p q =
if Id.equal avoid.(n-i) s then avoid.(n-i-x)
else (if i<n then find (i+1)
else user_err ~hdr:"AutoIndDecl.do_replace_lb"
- (str "Var " ++ pr_id s ++ str " seems unknown.")
+ (str "Var " ++ Id.print s ++ str " seems unknown.")
)
in mkVar (find 1)
with e when CErrors.noncritical e ->
(* if this happen then the args have to be already declared as a
Parameter*)
(
- let mp,dir,lbl = repr_con (fst (destConst sigma v)) in
- mkConst (make_con mp dir (mk_label (
+ let mp,dir,lbl = Constant.repr3 (fst (destConst sigma v)) in
+ mkConst (Constant.make3 mp dir (Label.make (
if Int.equal offset 1 then ("eq_"^(Label.to_string lbl))
else ((Label.to_string lbl)^"_lb")
)))
@@ -377,6 +377,7 @@ let do_replace_lb mode lb_scheme_key aavoid narg p q =
Proofview.Goal.enter begin fun gl ->
let type_of_pq = Tacmach.New.pf_unsafe_type_of gl p in
let sigma = Tacmach.New.project gl in
+ let env = Tacmach.New.pf_env gl in
let u,v = destruct_ind sigma type_of_pq
in let lb_type_of_p =
try
@@ -389,7 +390,7 @@ let do_replace_lb mode lb_scheme_key aavoid narg p q =
(str "Leibniz->boolean:" ++
str "You have to declare the" ++
str "decidability over " ++
- Printer.pr_econstr type_of_pq ++
+ Printer.pr_econstr_env env sigma type_of_pq ++
str " first.")
in
Tacticals.New.tclZEROMSG err_msg
@@ -421,15 +422,15 @@ let do_replace_bl mode bl_scheme_key (ind,u as indu) aavoid narg lft rgt =
if Id.equal avoid.(n-i) s then avoid.(n-i-x)
else (if i<n then find (i+1)
else user_err ~hdr:"AutoIndDecl.do_replace_bl"
- (str "Var " ++ pr_id s ++ str " seems unknown.")
+ (str "Var " ++ Id.print s ++ str " seems unknown.")
)
in mkVar (find 1)
with e when CErrors.noncritical e ->
(* if this happen then the args have to be already declared as a
Parameter*)
(
- let mp,dir,lbl = repr_con (fst (destConst sigma v)) in
- mkConst (make_con mp dir (mk_label (
+ let mp,dir,lbl = Constant.repr3 (fst (destConst sigma v)) in
+ mkConst (Constant.make3 mp dir (Label.make (
if Int.equal offset 1 then ("eq_"^(Label.to_string lbl))
else ((Label.to_string lbl)^"_bl")
)))
@@ -442,6 +443,7 @@ let do_replace_bl mode bl_scheme_key (ind,u as indu) aavoid narg lft rgt =
Proofview.Goal.enter begin fun gl ->
let tt1 = Tacmach.New.pf_unsafe_type_of gl t1 in
let sigma = Tacmach.New.project gl in
+ let env = Tacmach.New.pf_env gl in
if EConstr.eq_constr sigma t1 t2 then aux q1 q2
else (
let u,v = try destruct_ind sigma tt1
@@ -461,7 +463,7 @@ let do_replace_bl mode bl_scheme_key (ind,u as indu) aavoid narg lft rgt =
(str "boolean->Leibniz:" ++
str "You have to declare the" ++
str "decidability over " ++
- Printer.pr_econstr tt1 ++
+ Printer.pr_econstr_env env sigma tt1 ++
str " first.")
in
user_err err_msg
@@ -504,7 +506,7 @@ let do_replace_bl mode bl_scheme_key (ind,u as indu) aavoid narg lft rgt =
with DestKO -> Tacticals.New.tclZEROMSG (str "The expected type is an inductive one.")
end
end >>= fun (sp2,i2) ->
- if not (eq_mind sp1 sp2) || not (Int.equal i1 i2)
+ if not (MutInd.equal sp1 sp2) || not (Int.equal i1 i2)
then Tacticals.New.tclZEROMSG (str "Eq should be on the same type")
else aux (Array.to_list ca1) (Array.to_list ca2)
@@ -531,8 +533,8 @@ let eqI ind l =
and e, eff =
try let c, eff = find_scheme beq_scheme_kind ind in mkConst c, eff
with Not_found -> user_err ~hdr:"AutoIndDecl.eqI"
- (str "The boolean equality on " ++ pr_mind (fst ind) ++ str " is needed.");
- in (if Array.equal Term.eq_constr eA [||] then e else mkApp(e,eA)), eff
+ (str "The boolean equality on " ++ MutInd.print (fst ind) ++ str " is needed.");
+ in (if Array.equal Constr.equal eA [||] then e else mkApp(e,eA)), eff
(**********************************************************************)
(* Boolean->Leibniz *)
diff --git a/vernac/class.ml b/vernac/class.ml
index 3915148a0..943da8fa8 100644
--- a/vernac/class.ml
+++ b/vernac/class.ml
@@ -11,6 +11,7 @@ open Util
open Pp
open Names
open Term
+open Constr
open Vars
open Termops
open Entries
@@ -83,16 +84,9 @@ let check_target clt = function
(* condition d'heritage uniforme *)
-let uniform_cond sigma nargs lt =
- let open EConstr in
- let rec aux = function
- | (0,[]) -> true
- | (n,t::l) ->
- let t = strip_outer_cast sigma t in
- isRel sigma t && Int.equal (destRel sigma t) n && aux ((n-1),l)
- | _ -> false
- in
- aux (nargs,lt)
+let uniform_cond sigma ctx lt =
+ List.for_all2eq (EConstr.eq_constr sigma)
+ lt (Context.Rel.to_extended_list EConstr.mkRel 0 ctx)
let class_of_global = function
| ConstRef sp ->
@@ -118,24 +112,29 @@ l'indice de la classe source dans la liste lp
*)
let get_source lp source =
+ let open Context.Rel.Declaration in
match source with
| None ->
- let (cl1,u1,lv1) =
- match lp with
- | [] -> raise Not_found
- | t1::_ -> find_class_type Evd.empty (EConstr.of_constr t1)
- in
- (cl1,u1,lv1,1)
+ (* Take the latest non let-in argument *)
+ let rec aux = function
+ | [] -> raise Not_found
+ | LocalDef _ :: lt -> aux lt
+ | LocalAssum (_,t1) :: lt ->
+ let cl1,u1,lv1 = find_class_type Evd.empty (EConstr.of_constr t1) in
+ cl1,lt,lv1,1
+ in aux lp
| Some cl ->
- let rec aux = function
- | [] -> raise Not_found
- | t1::lt ->
- try
- let cl1,u1,lv1 = find_class_type Evd.empty (EConstr.of_constr t1) in
- if cl_typ_eq cl cl1 then cl1,u1,lv1,(List.length lt+1)
- else raise Not_found
- with Not_found -> aux lt
- in aux (List.rev lp)
+ (* Take the first argument that matches *)
+ let rec aux acc = function
+ | [] -> raise Not_found
+ | LocalDef _ as decl :: lt -> aux (decl::acc) lt
+ | LocalAssum (_,t1) as decl :: lt ->
+ try
+ let cl1,u1,lv1 = find_class_type Evd.empty (EConstr.of_constr t1) in
+ if cl_typ_eq cl cl1 then cl1,acc,lv1,Context.Rel.nhyps lt+1
+ else raise Not_found
+ with Not_found -> aux (decl::acc) lt
+ in aux [] (List.rev lp)
let get_target t ind =
if (ind > 1) then
@@ -146,15 +145,6 @@ let get_target t ind =
CL_PROJ p
| x -> x
-
-let prods_of t =
- let rec aux acc d = match kind_of_term d with
- | Prod (_,c1,c2) -> aux (c1::acc) c2
- | Cast (c,_,_) -> aux acc c
- | _ -> (d,acc)
- in
- aux [] t
-
let strength_of_cl = function
| CL_CONST kn -> `GLOBAL
| CL_SECVAR id -> `LOCAL
@@ -173,8 +163,8 @@ let get_strength stre ref cls clt =
let ident_key_of_class = function
| CL_FUN -> "Funclass"
| CL_SORT -> "Sortclass"
- | CL_CONST sp | CL_PROJ sp -> Label.to_string (con_label sp)
- | CL_IND (sp,_) -> Label.to_string (mind_label sp)
+ | CL_CONST sp | CL_PROJ sp -> Label.to_string (Constant.label sp)
+ | CL_IND (sp,_) -> Label.to_string (MutInd.label sp)
| CL_SECVAR id -> Id.to_string id
(* Identity coercion *)
@@ -222,10 +212,10 @@ let build_id_coercion idf_opt source poly =
Id.of_string ("Id_"^(ident_key_of_class source)^"_"^
(ident_key_of_class cl))
in
- let univs = (snd (Evd.universe_context ~names:[] ~extensible:true sigma)) in
+ let univs = Evd.const_univ_entry ~poly sigma in
let constr_entry = (* Cast is necessary to express [val_f] is identity *)
DefinitionEntry
- (definition_entry ~types:typ_f ~poly ~univs
+ (definition_entry ~types:typ_f ~univs
~inline:true (mkCast (val_f, DEFAULTcast, typ_f)))
in
let decl = (constr_entry, IsDefinition IdentityCoercion) in
@@ -257,17 +247,18 @@ let add_new_coercion_core coef stre poly source target isid =
check_source source;
let t, _ = Global.type_of_global_in_context (Global.env ()) coef in
if coercion_exists coef then raise (CoercionError AlreadyExists);
- let tg,lp = prods_of t in
+ let lp,tg = decompose_prod_assum t in
let llp = List.length lp in
if Int.equal llp 0 then raise (CoercionError NotAFunction);
- let (cls,us,lvs,ind) =
+ let (cls,ctx,lvs,ind) =
try
get_source lp source
with Not_found ->
raise (CoercionError (NoSource source))
in
check_source (Some cls);
- if not (uniform_cond Evd.empty (** FIXME *) (llp-ind) lvs) then
+ if not (uniform_cond Evd.empty (** FIXME - for when possibly called with unresolved evars in the future *)
+ ctx lvs) then
warn_uniform_inheritance coef;
let clt =
try
diff --git a/vernac/classes.ml b/vernac/classes.ml
index 0926c93e5..4a2dba859 100644
--- a/vernac/classes.ml
+++ b/vernac/classes.ml
@@ -8,9 +8,7 @@
(*i*)
open Names
-open Term
-open Vars
-open Environ
+open EConstr
open Nametab
open CErrors
open Util
@@ -69,10 +67,9 @@ let existing_instance glob g info =
let c = global g in
let info = Option.default Hints.empty_hint_info info in
let instance, _ = Global.type_of_global_in_context (Global.env ()) c in
- let _, r = decompose_prod_assum instance in
+ let _, r = Term.decompose_prod_assum instance in
match class_of_constr Evd.empty (EConstr.of_constr r) with
- | Some (_, ((tc,u), _)) -> add_instance (new_instance tc info glob
- (*FIXME*) (Flags.use_polymorphic_flag ()) c)
+ | Some (_, ((tc,u), _)) -> add_instance (new_instance tc info glob c)
| None -> user_err ?loc:(loc_of_reference g)
~hdr:"declare_instance"
(Pp.str "Constant does not build instances of a declared type class.")
@@ -82,23 +79,24 @@ let mismatched_props env n m = mismatched_ctx_inst env Properties n m
(* Declare everything in the parameters as implicit, and the class instance as well *)
-let type_ctx_instance evars env ctx inst subst =
- let rec aux (subst, instctx) l = function
+let type_ctx_instance env sigma ctx inst subst =
+ let open Vars in
+ let rec aux (sigma, subst, instctx) l = function
decl :: ctx ->
let t' = substl subst (RelDecl.get_type decl) in
- let c', l =
+ let (sigma, c'), l =
match decl with
- | LocalAssum _ -> EConstr.Unsafe.to_constr (interp_casted_constr_evars env evars (List.hd l) t'), List.tl l
- | LocalDef (_,b,_) -> substl subst b, l
+ | LocalAssum _ -> interp_casted_constr_evars env sigma (List.hd l) t', List.tl l
+ | LocalDef (_,b,_) -> (sigma, substl subst b), l
in
let d = RelDecl.get_name decl, Some c', t' in
- aux (c' :: subst, d :: instctx) l ctx
- | [] -> subst
- in aux (subst, []) inst (List.rev ctx)
+ aux (sigma, c' :: subst, d :: instctx) l ctx
+ | [] -> sigma, subst
+ in aux (sigma, subst, []) inst (List.rev ctx)
let id_of_class cl =
match cl.cl_impl with
- | ConstRef kn -> let _,_,l = repr_con kn in Label.to_id l
+ | ConstRef kn -> let _,_,l = Constant.repr3 kn in Label.to_id l
| IndRef (kn,i) ->
let mip = (Environ.lookup_mind kn (Global.env ())).Declarations.mind_packets in
mip.(0).Declarations.mind_typename
@@ -111,38 +109,38 @@ let instance_hook k info global imps ?hook cst =
Typeclasses.declare_instance (Some info) (not global) cst;
(match hook with Some h -> h cst | None -> ())
-let declare_instance_constant k info global imps ?hook id decl poly evm term termtype =
+let declare_instance_constant k info global imps ?hook id decl poly sigma term termtype =
let kind = IsDefinition Instance in
- let evm =
- let levels = Univ.LSet.union (Univops.universes_of_constr termtype)
- (Univops.universes_of_constr term) in
- Evd.restrict_universe_context evm levels
+ let sigma =
+ let env = Global.env () in
+ let levels = Univ.LSet.union (Univops.universes_of_constr env termtype)
+ (Univops.universes_of_constr env term) in
+ Evd.restrict_universe_context sigma levels
in
- let pl, uctx = Evd.check_univ_decl evm decl in
+ let uctx = Evd.check_univ_decl ~poly sigma decl in
let entry =
- Declare.definition_entry ~types:termtype ~poly ~univs:uctx term
+ Declare.definition_entry ~types:termtype ~univs:uctx term
in
let cdecl = (DefinitionEntry entry, kind) in
let kn = Declare.declare_constant id cdecl in
Declare.definition_message id;
- Universes.register_universe_binders (ConstRef kn) pl;
+ Declare.declare_univ_binders (ConstRef kn) (Evd.universe_binders sigma);
instance_hook k info global imps ?hook (ConstRef kn);
id
let new_instance ?(abstract=false) ?(global=false) ?(refine= !refine_instance)
- poly ctx (instid, bk, cl) props ?(generalize=true)
+ ~program_mode poly ctx (instid, bk, cl) props ?(generalize=true)
?(tac:unit Proofview.tactic option) ?hook pri =
let env = Global.env() in
let ((loc, instid), pl) = instid in
- let evd, decl = Univdecls.interp_univ_decl_opt env pl in
- let evars = ref evd in
+ let sigma, decl = Univdecls.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, b) ->
+ | Some cl ->
let t = CAst.make @@ CHole (None, Misctypes.IntroAnonymous, None) in
t, avoid
| None -> failwith ("new instance: under-applied typeclass"))
@@ -153,42 +151,41 @@ let new_instance ?(abstract=false) ?(global=false) ?(refine= !refine_instance)
if generalize then CAst.make @@ CGeneralization (Implicit, Some AbsPi, tclass)
else tclass
in
- let k, u, cty, ctx', ctx, len, imps, subst =
- let impls, ((env', ctx), imps) = interp_context_evars env evars ctx in
- let ctx = List.map (fun d -> Termops.map_rel_decl EConstr.Unsafe.to_constr d) ctx in
- let c', imps' = interp_type_evars_impls ~impls env' evars tclass in
- let c' = EConstr.Unsafe.to_constr c' in
+ let sigma, k, u, cty, ctx', ctx, len, imps, subst =
+ let sigma, (impls, ((env', ctx), imps)) = interp_context_evars env sigma ctx in
+ let sigma, (c', imps') = interp_type_evars_impls ~impls env' sigma tclass in
let len = List.length ctx in
let imps = imps @ Impargs.lift_implicits len imps' in
- let ctx', c = decompose_prod_assum c' in
+ let ctx', c = decompose_prod_assum sigma c' in
let ctx'' = ctx' @ ctx in
- let (k, u), args = Typeclasses.dest_class_app (push_rel_context ctx'' env) !evars (EConstr.of_constr c) in
- let u = EConstr.EInstance.kind !evars u in
- let cl = Typeclasses.typeclass_univ_instance (k, u) in
- let _, args =
+ let (k, u), args = Typeclasses.dest_class_app (push_rel_context ctx'' env) sigma c in
+ let u_s = EInstance.kind sigma u in
+ let cl = Typeclasses.typeclass_univ_instance (k, u_s) in
+ let args = List.map of_constr args in
+ let cl_context = List.map (Termops.map_rel_decl of_constr) (snd cl.cl_context) in
+ let _, args =
List.fold_right (fun decl (args, args') ->
match decl with
| LocalAssum _ -> (List.tl args, List.hd args :: args')
- | LocalDef (_,b,_) -> (args, substl args' b :: args'))
- (snd cl.cl_context) (args, [])
+ | LocalDef (_,b,_) -> (args, Vars.substl args' b :: args'))
+ cl_context (args, [])
in
- cl, u, c', ctx', ctx, len, imps, args
+ sigma, cl, u, c', ctx', ctx, len, imps, args
in
let id =
match instid with
Name id ->
let sp = Lib.make_path id in
if Nametab.exists_cci sp then
- user_err ~hdr:"new_instance" (Nameops.pr_id id ++ Pp.str " already exists.");
+ user_err ~hdr:"new_instance" (Id.print id ++ Pp.str " already exists.");
id
| Anonymous ->
let i = Nameops.add_suffix (id_of_class k) "_instance_0" in
Namegen.next_global_ident_away i (Termops.vars_of_env env)
in
let env' = push_rel_context ctx env in
- evars := Evarutil.nf_evar_map !evars;
- evars := resolve_typeclasses ~filter:Typeclasses.all_evars ~fail:true env !evars;
- let subst = List.map (fun c -> EConstr.Unsafe.to_constr (Evarutil.nf_evar !evars (EConstr.of_constr c))) subst in
+ let sigma = Evarutil.nf_evar_map sigma in
+ let sigma = resolve_typeclasses ~filter:Typeclasses.all_evars ~fail:true env sigma in
if abstract then
begin
let subst = List.fold_left2
@@ -196,19 +193,17 @@ let new_instance ?(abstract=false) ?(global=false) ?(refine= !refine_instance)
[] subst (snd k.cl_context)
in
let (_, ty_constr) = instance_constructor (k,u) subst in
- let nf, subst = Evarutil.e_nf_evars_and_universes evars in
- let termtype =
- let t = it_mkProd_or_LetIn ty_constr (ctx' @ ctx) in
- nf t
- in
- Pretyping.check_evars env Evd.empty !evars (EConstr.of_constr termtype);
- let pl, ctx = Evd.check_univ_decl !evars decl in
- let cst = Declare.declare_constant ~internal:Declare.InternalTacticRequest id
- (ParameterEntry
- (None,poly,(termtype,ctx),None), Decl_kinds.IsAssumption Decl_kinds.Logical)
- in
- Universes.register_universe_binders (ConstRef cst) pl;
- instance_hook k pri global imps ?hook (ConstRef cst); id
+ let termtype = it_mkProd_or_LetIn ty_constr (ctx' @ ctx) in
+ let sigma,_ = Evarutil.nf_evars_and_universes sigma in
+ Pretyping.check_evars env Evd.empty sigma termtype;
+ let univs = Evd.check_univ_decl ~poly sigma decl in
+ let termtype = to_constr sigma termtype in
+ let cst = Declare.declare_constant ~internal:Declare.InternalTacticRequest id
+ (ParameterEntry
+ (None,(termtype,univs),None), Decl_kinds.IsAssumption Decl_kinds.Logical)
+ in
+ Declare.declare_univ_binders (ConstRef cst) (Evd.universe_binders sigma);
+ instance_hook k pri global imps ?hook (ConstRef cst); id
end
else (
let props =
@@ -219,16 +214,16 @@ let new_instance ?(abstract=false) ?(global=false) ?(refine= !refine_instance)
Some (Inl fs)
| Some (_, t) -> Some (Inr t)
| None ->
- if Flags.is_program_mode () then Some (Inl [])
+ if program_mode then Some (Inl [])
else None
in
- let subst =
+ let subst, sigma =
match props with
- | None -> if List.is_empty k.cl_props then Some (Inl subst) else None
+ | None ->
+ (if List.is_empty k.cl_props then Some (Inl subst) else None), sigma
| Some (Inr term) ->
- let c = interp_casted_constr_evars env' evars term cty in
- let c = EConstr.Unsafe.to_constr c in
- Some (Inr (c, subst))
+ let sigma, c = interp_casted_constr_evars env' sigma term cty in
+ Some (Inr (c, subst)), sigma
| Some (Inl props) ->
let get_id =
function
@@ -265,9 +260,10 @@ let new_instance ?(abstract=false) ?(global=false) ?(refine= !refine_instance)
| (n, _) :: _ ->
unbound_method env' k.cl_impl (get_id n)
| _ ->
- Some (Inl (type_ctx_instance evars (push_rel_context ctx' env')
- k.cl_props props subst))
- in
+ let kcl_props = List.map (Termops.map_rel_decl of_constr) k.cl_props in
+ let sigma, res = type_ctx_instance (push_rel_context ctx' env') sigma kcl_props props subst in
+ Some (Inl res), sigma
+ in
let term, termtype =
match subst with
| None -> let termtype = it_mkProd_or_LetIn cty ctx in
@@ -279,34 +275,30 @@ let new_instance ?(abstract=false) ?(global=false) ?(refine= !refine_instance)
in
let (app, ty_constr) = instance_constructor (k,u) subst in
let termtype = it_mkProd_or_LetIn ty_constr (ctx' @ ctx) in
- let term = Termops.it_mkLambda_or_LetIn (Option.get app) (ctx' @ ctx) in
+ let term = it_mkLambda_or_LetIn (Option.get app) (ctx' @ ctx) in
Some term, termtype
| Some (Inr (def, subst)) ->
let termtype = it_mkProd_or_LetIn cty ctx in
- let term = Termops.it_mkLambda_or_LetIn def ctx in
+ let term = it_mkLambda_or_LetIn def ctx in
Some term, termtype
in
- let _ =
- evars := Evarutil.nf_evar_map !evars;
- evars := Typeclasses.resolve_typeclasses ~filter:Typeclasses.no_goals_or_obligations ~fail:true
- env !evars;
- (* Try resolving fields that are typeclasses automatically. *)
- evars := Typeclasses.resolve_typeclasses ~filter:Typeclasses.all_evars ~fail:false
- env !evars
- in
- let _ = evars := Evarutil.nf_evar_map_undefined !evars in
- let evm, nf = Evarutil.nf_evar_map_universes !evars in
- let termtype = nf termtype in
- let _ = (* Check that the type is free of evars now. *)
- Pretyping.check_evars env Evd.empty evm (EConstr.of_constr termtype)
- in
- let term = Option.map nf term in
- if not (Evd.has_undefined evm) && not (Option.is_empty term) then
+ let sigma = Evarutil.nf_evar_map sigma in
+ let sigma = Typeclasses.resolve_typeclasses ~filter:Typeclasses.no_goals_or_obligations ~fail:true env sigma in
+ (* Try resolving fields that are typeclasses automatically. *)
+ let sigma = Typeclasses.resolve_typeclasses ~filter:Typeclasses.all_evars ~fail:false env sigma in
+ let sigma = Evarutil.nf_evar_map_undefined sigma in
+ (* Beware of this step, it is required as to minimize universes. *)
+ let sigma, _nf = Evarutil.nf_evar_map_universes sigma in
+ (* Check that the type is free of evars now. *)
+ Pretyping.check_evars env Evd.empty sigma termtype;
+ let termtype = to_constr sigma termtype in
+ let term = Option.map (to_constr sigma) term in
+ if not (Evd.has_undefined sigma) && not (Option.is_empty term) then
declare_instance_constant k pri global imps ?hook id decl
- poly evm (Option.get term) termtype
- else if Flags.is_program_mode () || refine || Option.is_empty term then begin
+ poly sigma (Option.get term) termtype
+ else if program_mode || refine || Option.is_empty term then begin
let kind = Decl_kinds.Global, poly, Decl_kinds.DefinitionBody Decl_kinds.Instance in
- if Flags.is_program_mode () then
+ if program_mode then
let hook vis gr _ =
let cst = match gr with ConstRef kn -> kn | _ -> assert false in
Impargs.declare_manual_implicits false gr ~enriching:false [imps];
@@ -316,12 +308,12 @@ let new_instance ?(abstract=false) ?(global=false) ?(refine= !refine_instance)
match term with
| Some t ->
let obls, _, constr, typ =
- Obligations.eterm_obligations env id evm 0 t termtype
+ Obligations.eterm_obligations env id sigma 0 t termtype
in obls, Some constr, typ
| None -> [||], None, termtype
in
let hook = Lemmas.mk_hook hook in
- let ctx = Evd.evar_universe_context evm in
+ let ctx = Evd.evar_universe_context sigma in
ignore (Obligations.add_definition id ?term:constr
~univdecl:decl typ ctx ~kind:(Global,poly,Instance) ~hook obls);
id
@@ -332,16 +324,16 @@ let new_instance ?(abstract=false) ?(global=false) ?(refine= !refine_instance)
the pretyping after the proof has opened. As a
consequence, we use the low-level primitives to code
the refinement manually.*)
- let gls = List.rev (Evd.future_goals evm) in
- let evm = Evd.reset_future_goals evm in
- Lemmas.start_proof id ~pl:decl kind evm (EConstr.of_constr termtype)
+ let gls = List.rev (Evd.future_goals sigma) in
+ let sigma = Evd.reset_future_goals sigma in
+ Lemmas.start_proof id ~pl:decl kind sigma (EConstr.of_constr termtype)
(Lemmas.mk_hook
(fun _ -> instance_hook k pri global imps ?hook));
(* spiwack: I don't know what to do with the status here. *)
if not (Option.is_empty term) then
let init_refine =
Tacticals.New.tclTHENLIST [
- Refine.refine ~typecheck:false (fun evm -> (evm,EConstr.of_constr (Option.get term)));
+ Refine.refine ~typecheck:false (fun sigma -> (sigma,EConstr.of_constr (Option.get term)));
Proofview.Unsafe.tclNEWGOALS gls;
Tactics.New.reduce_after_refine;
]
@@ -355,6 +347,7 @@ let new_instance ?(abstract=false) ?(global=false) ?(refine= !refine_instance)
else CErrors.user_err Pp.(str "Unsolved obligations remaining."))
let named_of_rel_context l =
+ let open Vars in
let acc, ctx =
List.fold_right
(fun decl (subst, ctx) ->
@@ -368,36 +361,38 @@ let named_of_rel_context l =
let context poly l =
let env = Global.env() in
- let evars = ref (Evd.from_env env) in
- let _, ((env', fullctx), impls) = interp_context_evars env evars l in
- let fullctx = List.map (fun d -> Termops.map_rel_decl EConstr.Unsafe.to_constr d) fullctx in
- let subst = Evarutil.evd_comb0 Evarutil.nf_evars_and_universes evars in
- let fullctx = Context.Rel.map subst fullctx in
- let ce t = Pretyping.check_evars env Evd.empty !evars (EConstr.of_constr t) in
+ let sigma = Evd.from_env env in
+ let sigma, (_, ((env', fullctx), impls)) = interp_context_evars env sigma l in
+ (* Note, we must use the normalized evar from now on! *)
+ let sigma,_ = Evarutil.nf_evars_and_universes sigma in
+ let ce t = Pretyping.check_evars env Evd.empty sigma t in
let () = List.iter (fun decl -> Context.Rel.Declaration.iter_constr ce decl) fullctx in
let ctx =
try named_of_rel_context fullctx
with e when CErrors.noncritical e ->
user_err Pp.(str "Anonymous variables not allowed in contexts.")
in
- let uctx = ref (Evd.universe_context_set !evars) in
+ let uctx = ref (Evd.universe_context_set sigma) in
let fn status (id, b, t) =
+ let b, t = Option.map (to_constr sigma) b, to_constr sigma t in
if Lib.is_modtype () && not (Lib.sections_are_opened ()) then
- let ctx = Univ.ContextSet.to_context !uctx in
(* Declare the universe context once *)
+ let univs = if poly
+ then Polymorphic_const_entry (Univ.ContextSet.to_context !uctx)
+ else Monomorphic_const_entry !uctx
+ in
let () = uctx := Univ.ContextSet.empty in
let decl = match b with
| None ->
- (ParameterEntry (None,poly,(t,ctx),None), IsAssumption Logical)
+ (ParameterEntry (None,(t,univs),None), IsAssumption Logical)
| Some b ->
- let entry = Declare.definition_entry ~poly ~univs:ctx ~types:t b in
+ let entry = Declare.definition_entry ~univs ~types:t b in
(DefinitionEntry entry, IsAssumption Logical)
in
let cst = Declare.declare_constant ~internal:Declare.InternalTacticRequest id decl in
- match class_of_constr !evars (EConstr.of_constr t) with
+ match class_of_constr sigma (of_constr t) with
| Some (rels, ((tc,_), args) as _cl) ->
- add_instance (Typeclasses.new_instance tc Hints.empty_hint_info false (*FIXME*)
- poly (ConstRef cst));
+ add_instance (Typeclasses.new_instance tc Hints.empty_hint_info false (ConstRef cst));
status
(* declare_subclasses (ConstRef cst) cl *)
| None -> status
@@ -408,16 +403,19 @@ let context poly l =
in
let impl = List.exists test impls in
let decl = (Discharge, poly, Definitional) in
+ let univs = if poly
+ then Polymorphic_const_entry (Univ.ContextSet.to_context !uctx)
+ else Monomorphic_const_entry !uctx
+ in
let nstatus = match b with
| None ->
- pi3 (Command.declare_assumption false decl (t, !uctx) [] [] impl
+ pi3 (ComAssumption.declare_assumption false decl (t, univs) Universes.empty_binders [] impl
Vernacexpr.NoInline (Loc.tag id))
| Some b ->
- let ctx = Univ.ContextSet.to_context !uctx in
let decl = (Discharge, poly, Definition) in
- let entry = Declare.definition_entry ~poly ~univs:ctx ~types:t b in
+ let entry = Declare.definition_entry ~univs ~types:t b in
let hook = Lemmas.mk_hook (fun _ gr -> gr) in
- let _ = DeclareDef.declare_definition id decl entry [] [] hook in
+ let _ = DeclareDef.declare_definition id decl entry Universes.empty_binders [] hook in
Lib.sections_are_opened () || Lib.is_modtype_strict ()
in
status && nstatus
diff --git a/vernac/classes.mli b/vernac/classes.mli
index fcdb5c3bc..d47c6a6f8 100644
--- a/vernac/classes.mli
+++ b/vernac/classes.mli
@@ -34,13 +34,14 @@ val declare_instance_constant :
bool -> (* polymorphic *)
Evd.evar_map -> (* Universes *)
Constr.t -> (** body *)
- Term.types -> (** type *)
+ Constr.types -> (** type *)
Names.Id.t
val new_instance :
?abstract:bool -> (** Not abstract by default. *)
?global:bool -> (** Not global by default. *)
?refine:bool -> (** Allow refinement *)
+ program_mode:bool ->
Decl_kinds.polymorphic ->
local_binder_expr list ->
Vernacexpr.typeclass_constraint ->
diff --git a/vernac/comAssumption.ml b/vernac/comAssumption.ml
new file mode 100644
index 000000000..5d7adb24a
--- /dev/null
+++ b/vernac/comAssumption.ml
@@ -0,0 +1,182 @@
+(************************************************************************)
+(* v * The Coq Proof Assistant / The Coq Development Team *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(************************************************************************)
+
+open Pp
+open CErrors
+open Util
+open Vars
+open Environ
+open Declare
+open Names
+open Globnames
+open Constrexpr_ops
+open Constrintern
+open Impargs
+open Decl_kinds
+open Pretyping
+open Vernacexpr
+open Entries
+
+(* 2| Variable/Hypothesis/Parameter/Axiom declarations *)
+
+let axiom_into_instance = ref false
+
+let _ =
+ let open Goptions in
+ declare_bool_option
+ { optdepr = false;
+ optname = "automatically declare axioms whose type is a typeclass as instances";
+ optkey = ["Typeclasses";"Axioms";"Are";"Instances"];
+ optread = (fun _ -> !axiom_into_instance);
+ optwrite = (:=) axiom_into_instance; }
+
+let should_axiom_into_instance = function
+ | Discharge ->
+ (* The typeclass behaviour of Variable and Context doesn't depend
+ on section status *)
+ true
+ | Global | Local -> !axiom_into_instance
+
+let declare_assumption is_coe (local,p,kind) (c,ctx) pl imps impl nl (_,ident) =
+match local with
+| Discharge when Lib.sections_are_opened () ->
+ let ctx = match ctx with
+ | Monomorphic_const_entry ctx -> ctx
+ | Polymorphic_const_entry ctx -> Univ.ContextSet.of_context ctx
+ in
+ 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 && Proof_global.there_are_pending_proofs () then
+ Feedback.msg_info (str"Variable" ++ spc () ++ Id.print ident ++
+ strbrk " is not visible from current goals")
+ in
+ let r = VarRef ident in
+ let () = Typeclasses.declare_instance None true r in
+ let () = if is_coe then Class.try_add_new_coercion r ~local:true false in
+ (r,Univ.Instance.empty,true)
+
+| Global | Local | Discharge ->
+ let do_instance = should_axiom_into_instance local in
+ let local = DeclareDef.get_locality ident ~kind:"axiom" local in
+ let inl = match nl with
+ | NoInline -> None
+ | DefaultInline -> Some (Flags.get_inline_level())
+ | InlineAt i -> Some i
+ in
+ let decl = (ParameterEntry (None,(c,ctx),inl), IsAssumption kind) in
+ let kn = declare_constant ident ~local decl in
+ let gr = ConstRef kn in
+ let () = maybe_declare_manual_implicits false gr imps in
+ let () = Declare.declare_univ_binders gr pl in
+ let () = assumption_message ident in
+ let () = if do_instance then Typeclasses.declare_instance None false gr in
+ let () = if is_coe then Class.try_add_new_coercion gr ~local p in
+ let inst = match ctx with
+ | Polymorphic_const_entry ctx -> Univ.UContext.instance ctx
+ | Monomorphic_const_entry _ -> Univ.Instance.empty
+ in
+ (gr,inst,Lib.is_modtype_strict ())
+
+let interp_assumption sigma env impls bl c =
+ let c = mkCProdN ?loc:(local_binders_loc bl) bl c in
+ let sigma, (ty, impls) = interp_type_evars_impls env sigma ~impls c in
+ let ty = EConstr.Unsafe.to_constr ty in
+ sigma, (ty, impls)
+
+(* When monomorphic the universe constraints are declared with the first declaration only. *)
+let next_uctx =
+ let empty_uctx = Monomorphic_const_entry Univ.ContextSet.empty in
+ function
+ | Polymorphic_const_entry _ as uctx -> uctx
+ | Monomorphic_const_entry _ -> empty_uctx
+
+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 is_coe k (c,uctx) pl imps false nl id in
+ (ref',u')::refs, status' && status, next_uctx uctx)
+ ([],true,uctx) idl
+ in
+ List.rev refs, status
+
+
+let maybe_error_many_udecls = function
+ | ((loc,id), Some _) ->
+ user_err ?loc ~hdr:"many_universe_declarations"
+ Pp.(str "When declaring multiple axioms in one command, " ++
+ str "only the first is allowed a universe binder " ++
+ str "(which will be shared by the whole block).")
+ | (_, None) -> ()
+
+let process_assumptions_udecls kind l =
+ let udecl, first_id = match l with
+ | (coe, ((id, udecl)::rest, c))::rest' ->
+ List.iter maybe_error_many_udecls rest;
+ List.iter (fun (coe, (idl, c)) -> List.iter maybe_error_many_udecls idl) rest';
+ udecl, id
+ | (_, ([], _))::_ | [] -> assert false
+ in
+ let () = match kind, udecl with
+ | (Discharge, _, _), Some _ when Lib.sections_are_opened () ->
+ let loc = fst first_id in
+ let msg = Pp.str "Section variables cannot be polymorphic." in
+ user_err ?loc msg
+ | _ -> ()
+ in
+ udecl, List.map (fun (coe, (idl, c)) -> coe, (List.map fst idl, c)) l
+
+let do_assumptions kind nl l =
+ let open Context.Named.Declaration in
+ let env = Global.env () in
+ let udecl, l = process_assumptions_udecls kind l in
+ let sigma, udecl = Univdecls.interp_univ_decl_opt env udecl in
+ let l =
+ if pi2 kind (* poly *) then
+ (* Separate declarations so that A B : Type puts A and B in different levels. *)
+ List.fold_right (fun (is_coe,(idl,c)) acc ->
+ List.fold_right (fun id acc ->
+ (is_coe, ([id], c)) :: acc) idl acc)
+ l []
+ else l
+ in
+ (* We intepret all declarations in the same evar_map, i.e. as a telescope. *)
+ let (sigma,_,_),l = List.fold_left_map (fun (sigma,env,ienv) (is_coe,(idl,c)) ->
+ let sigma,(t,imps) = interp_assumption sigma env ienv [] c in
+ let env =
+ push_named_context (List.map (fun (_,id) -> LocalAssum (id,t)) idl) env in
+ let ienv = List.fold_right (fun (_,id) ienv ->
+ let impls = compute_internalization_data env Variable t imps in
+ Id.Map.add id impls ienv) idl ienv in
+ ((sigma,env,ienv),((is_coe,idl),t,imps)))
+ (sigma,env,empty_internalization_env) l
+ in
+ let sigma = solve_remaining_evars all_and_fail_flags env sigma Evd.empty in
+ (* The universe constraints come from the whole telescope. *)
+ let sigma = Evd.nf_constraints sigma in
+ let nf_evar c = EConstr.to_constr sigma (EConstr.of_constr c) in
+ let uvars, l = List.fold_left_map (fun uvars (coe,t,imps) ->
+ let t = nf_evar t in
+ let uvars = Univ.LSet.union uvars (Univops.universes_of_constr env t) in
+ uvars, (coe,t,imps))
+ Univ.LSet.empty l
+ in
+ 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 idl is_coe kind (t,uctx) ubinders imps nl in
+ let subst' = List.map2
+ (fun (_,id) (c,u) -> (id, Universes.constr_of_global_univ (c,u)))
+ idl refs
+ in
+ subst'@subst, status' && status, next_uctx uctx)
+ ([], true, uctx) l)
diff --git a/vernac/comAssumption.mli b/vernac/comAssumption.mli
new file mode 100644
index 000000000..2fa156abd
--- /dev/null
+++ b/vernac/comAssumption.mli
@@ -0,0 +1,34 @@
+(************************************************************************)
+(* v * The Coq Proof Assistant / The Coq Development Team *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(************************************************************************)
+
+open Names
+open Constr
+open Entries
+open Globnames
+open Vernacexpr
+open Constrexpr
+open Decl_kinds
+
+(** {6 Parameters/Assumptions} *)
+
+val do_assumptions : locality * polymorphic * assumption_object_kind ->
+ Vernacexpr.inline -> (Vernacexpr.ident_decl list * constr_expr) with_coercion list -> bool
+
+(************************************************************************)
+(** Internal API *)
+(************************************************************************)
+
+(** Exported for Classes *)
+
+(** returns [false] if the assumption is neither local to a section,
+ nor in a module type and meant to be instantiated. *)
+val declare_assumption : coercion_flag -> assumption_kind ->
+ types in_constant_universes_entry ->
+ Universes.universe_binders -> Impargs.manual_implicits ->
+ bool (** implicit *) -> Vernacexpr.inline -> variable Loc.located ->
+ global_reference * Univ.Instance.t * bool
diff --git a/vernac/comDefinition.ml b/vernac/comDefinition.ml
new file mode 100644
index 000000000..d376696f7
--- /dev/null
+++ b/vernac/comDefinition.ml
@@ -0,0 +1,132 @@
+(************************************************************************)
+(* v * The Coq Proof Assistant / The Coq Development Team *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2018 *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(************************************************************************)
+
+open Pp
+open Util
+open Constr
+open Environ
+open Entries
+open Redexpr
+open Declare
+open Constrintern
+open Pretyping
+
+open Context.Rel.Declaration
+
+(* Commands of the interface: Constant definitions *)
+
+let rec under_binders env sigma f n c =
+ if Int.equal n 0 then f env sigma (EConstr.of_constr c) else
+ match Constr.kind c with
+ | Lambda (x,t,c) ->
+ mkLambda (x,t,under_binders (push_rel (LocalAssum (x,t)) env) sigma f (n-1) c)
+ | LetIn (x,b,t,c) ->
+ mkLetIn (x,b,t,under_binders (push_rel (LocalDef (x,b,t)) env) sigma f (n-1) c)
+ | _ -> assert false
+
+let red_constant_entry n ce sigma = function
+ | None -> ce
+ | Some red ->
+ let proof_out = ce.const_entry_body in
+ let env = Global.env () in
+ let (redfun, _) = reduction_of_red_expr env red in
+ let redfun env sigma c =
+ let (_, c) = redfun env sigma c in
+ EConstr.Unsafe.to_constr c
+ in
+ { ce with const_entry_body = Future.chain proof_out
+ (fun ((body,ctx),eff) -> (under_binders env sigma redfun n body,ctx),eff) }
+
+let warn_implicits_in_term =
+ CWarnings.create ~name:"implicits-in-term" ~category:"implicits"
+ (fun () ->
+ strbrk "Implicit arguments declaration relies on type." ++ spc () ++
+ strbrk "The term declares more implicits than the type here.")
+
+let check_imps ~impsty ~impsbody =
+ let b =
+ try
+ List.for_all (fun (key, (va:bool*bool*bool)) ->
+ (* Pervasives.(=) is OK for this type *)
+ Pervasives.(=) (List.assoc_f Impargs.explicitation_eq key impsty) va)
+ impsbody
+ with Not_found -> false
+ in
+ if not b then warn_implicits_in_term ()
+
+let interp_definition pl bl poly red_option c ctypopt =
+ let open EConstr in
+ let env = Global.env() in
+ (* Explicitly bound universes and constraints *)
+ let evd, decl = Univdecls.interp_univ_decl_opt env pl in
+ (* Build the parameters *)
+ let evd, (impls, ((env_bl, ctx), imps1)) = interp_context_evars env evd bl in
+ (* Build the type *)
+ let evd, tyopt = Option.fold_left_map
+ (interp_type_evars_impls ~impls env_bl)
+ evd ctypopt
+ in
+ (* Build the body, and merge implicits from parameters and from type/body *)
+ let evd, c, imps, tyopt =
+ match tyopt with
+ | None ->
+ let evd, (c, impsbody) = interp_constr_evars_impls ~impls env_bl evd c in
+ evd, c, imps1@Impargs.lift_implicits (Context.Rel.nhyps ctx) impsbody, None
+ | Some (ty, impsty) ->
+ let evd, (c, impsbody) = interp_casted_constr_evars_impls ~impls env_bl evd c ty in
+ check_imps ~impsty ~impsbody;
+ evd, c, imps1@Impargs.lift_implicits (Context.Rel.nhyps ctx) impsty, Some ty
+ in
+ (* universe minimization *)
+ let evd = Evd.nf_constraints evd in
+ (* Substitute evars and universes, and add parameters.
+ Note: in program mode some evars may remain. *)
+ let ctx = List.map (EConstr.to_rel_decl evd) ctx in
+ let c = Term.it_mkLambda_or_LetIn (EConstr.to_constr evd c) ctx in
+ let tyopt = Option.map (fun ty -> Term.it_mkProd_or_LetIn (EConstr.to_constr evd ty) ctx) tyopt in
+ (* Keep only useful universes. *)
+ let uvars_fold uvars c =
+ Univ.LSet.union uvars (universes_of_constr env evd (of_constr c))
+ in
+ let uvars = List.fold_left uvars_fold Univ.LSet.empty (Option.List.cons tyopt [c]) in
+ let evd = Evd.restrict_universe_context evd uvars in
+ (* Check we conform to declared universes *)
+ let uctx = Evd.check_univ_decl ~poly evd decl in
+ (* We're done! *)
+ let ce = definition_entry ?types:tyopt ~univs:uctx c in
+ (red_constant_entry (Context.Rel.length ctx) ce evd red_option, evd, decl, imps)
+
+let check_definition (ce, evd, _, imps) =
+ check_evars_are_solved (Global.env ()) evd Evd.empty;
+ ce
+
+let do_definition ~program_mode ident k univdecl bl red_option c ctypopt hook =
+ let (ce, evd, univdecl, imps as def) =
+ interp_definition univdecl bl (pi2 k) red_option c ctypopt
+ in
+ if program_mode then
+ let env = Global.env () in
+ let (c,ctx), sideff = Future.force ce.const_entry_body in
+ assert(Safe_typing.empty_private_constants = sideff);
+ assert(Univ.ContextSet.is_empty ctx);
+ let typ = match ce.const_entry_type with
+ | Some t -> t
+ | None -> EConstr.to_constr evd (Retyping.get_type_of env evd (EConstr.of_constr c))
+ in
+ Obligations.check_evars env evd;
+ let obls, _, c, cty =
+ Obligations.eterm_obligations env ident evd 0 c typ
+ in
+ let ctx = Evd.evar_universe_context evd in
+ let hook = Lemmas.mk_hook (fun l r _ -> Lemmas.call_hook (fun exn -> exn) hook l r) in
+ ignore(Obligations.add_definition
+ ident ~term:c cty ctx ~univdecl ~implicits:imps ~kind:k ~hook obls)
+ else let ce = check_definition def in
+ ignore(DeclareDef.declare_definition ident k ce (Evd.universe_binders evd) imps
+ (Lemmas.mk_hook
+ (fun l r -> Lemmas.call_hook (fun exn -> exn) hook l r;r)))
diff --git a/vernac/comDefinition.mli b/vernac/comDefinition.mli
new file mode 100644
index 000000000..4a65c1e91
--- /dev/null
+++ b/vernac/comDefinition.mli
@@ -0,0 +1,30 @@
+(************************************************************************)
+(* v * The Coq Proof Assistant / The Coq Development Team *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2018 *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(************************************************************************)
+
+open Names
+open Entries
+open Decl_kinds
+open Redexpr
+open Constrexpr
+
+(** {6 Definitions/Let} *)
+
+val do_definition : program_mode:bool ->
+ Id.t -> definition_kind -> Vernacexpr.universe_decl_expr option ->
+ local_binder_expr list -> red_expr option -> constr_expr ->
+ constr_expr option -> unit Lemmas.declaration_hook -> unit
+
+(************************************************************************)
+(** Internal API *)
+(************************************************************************)
+
+(** Not used anywhere. *)
+val interp_definition :
+ Vernacexpr.universe_decl_expr option -> local_binder_expr list -> polymorphic -> red_expr option -> constr_expr ->
+ constr_expr option -> Safe_typing.private_constants definition_entry * Evd.evar_map *
+ Univdecls.universe_decl * Impargs.manual_implicits
diff --git a/vernac/comFixpoint.ml b/vernac/comFixpoint.ml
new file mode 100644
index 000000000..d648e293a
--- /dev/null
+++ b/vernac/comFixpoint.ml
@@ -0,0 +1,356 @@
+open Pp
+open CErrors
+open Util
+open Constr
+open Vars
+open Termops
+open Declare
+open Names
+open Constrexpr
+open Constrexpr_ops
+open Constrintern
+open Decl_kinds
+open Pretyping
+open Evarutil
+open Evarconv
+open Misctypes
+open Vernacexpr
+
+module RelDecl = Context.Rel.Declaration
+
+(* 3c| Fixpoints and co-fixpoints *)
+
+(* An (unoptimized) function that maps preorders to partial orders...
+
+ Input: a list of associations (x,[y1;...;yn]), all yi distincts
+ and different of x, meaning x<=y1, ..., x<=yn
+
+ Output: a list of associations (x,Inr [y1;...;yn]), collecting all
+ distincts yi greater than x, _or_, (x, Inl y) meaning that
+ x is in the same class as y (in which case, x occurs
+ nowhere else in the association map)
+
+ partial_order : ('a * 'a list) list -> ('a * ('a,'a list) union) list
+*)
+
+let rec partial_order cmp = function
+ | [] -> []
+ | (x,xge)::rest ->
+ let rec browse res xge' = function
+ | [] ->
+ let res = List.map (function
+ | (z, Inr zge) when List.mem_f cmp x zge ->
+ (z, Inr (List.union cmp zge xge'))
+ | r -> r) res in
+ (x,Inr xge')::res
+ | y::xge ->
+ let rec link y =
+ try match List.assoc_f cmp y res with
+ | Inl z -> link z
+ | Inr yge ->
+ if List.mem_f cmp x yge then
+ let res = List.remove_assoc_f cmp y res in
+ let res = List.map (function
+ | (z, Inl t) ->
+ if cmp t y then (z, Inl x) else (z, Inl t)
+ | (z, Inr zge) ->
+ if List.mem_f cmp y zge then
+ (z, Inr (List.add_set cmp x (List.remove cmp y zge)))
+ else
+ (z, Inr zge)) res in
+ browse ((y,Inl x)::res) xge' (List.union cmp xge (List.remove cmp x yge))
+ else
+ browse res (List.add_set cmp y (List.union cmp xge' yge)) xge
+ with Not_found -> browse res (List.add_set cmp y xge') xge
+ in link y
+ in browse (partial_order cmp rest) [] xge
+
+let non_full_mutual_message x xge y yge isfix rest =
+ let reason =
+ if Id.List.mem x yge then
+ Id.print y ++ str " depends on " ++ Id.print x ++ strbrk " but not conversely"
+ else if Id.List.mem y xge then
+ Id.print x ++ str " depends on " ++ Id.print y ++ strbrk " but not conversely"
+ else
+ Id.print y ++ str " and " ++ Id.print x ++ strbrk " are not mutually dependent" in
+ let e = if List.is_empty rest then reason else strbrk "e.g., " ++ reason in
+ let k = if isfix then "fixpoint" else "cofixpoint" in
+ let w =
+ if isfix
+ then strbrk "Well-foundedness check may fail unexpectedly." ++ fnl()
+ else mt () in
+ strbrk "Not a fully mutually defined " ++ str k ++ fnl () ++
+ str "(" ++ e ++ str ")." ++ fnl () ++ w
+
+let warn_non_full_mutual =
+ CWarnings.create ~name:"non-full-mutual" ~category:"fixpoints"
+ (fun (x,xge,y,yge,isfix,rest) ->
+ non_full_mutual_message x xge y yge isfix rest)
+
+let check_mutuality env evd isfix fixl =
+ let names = List.map fst fixl in
+ let preorder =
+ List.map (fun (id,def) ->
+ (id, List.filter (fun id' -> not (Id.equal id id') && occur_var env evd id' (EConstr.of_constr def)) names))
+ fixl in
+ let po = partial_order Id.equal preorder in
+ match List.filter (function (_,Inr _) -> true | _ -> false) po with
+ | (x,Inr xge)::(y,Inr yge)::rest ->
+ warn_non_full_mutual (x,xge,y,yge,isfix,rest)
+ | _ -> ()
+
+type structured_fixpoint_expr = {
+ fix_name : Id.t;
+ fix_univs : universe_decl_expr option;
+ fix_annot : Id.t Loc.located option;
+ fix_binders : local_binder_expr list;
+ fix_body : constr_expr option;
+ fix_type : constr_expr
+}
+
+let interp_fix_context ~cofix env sigma fix =
+ let before, after = if not cofix then split_at_annot fix.fix_binders fix.fix_annot else [], fix.fix_binders in
+ let sigma, (impl_env, ((env', ctx), imps)) = interp_context_evars env sigma before in
+ let sigma, (impl_env', ((env'', ctx'), imps')) = interp_context_evars ~impl_env ~shift:(Context.Rel.nhyps ctx) env' sigma after in
+ let annot = Option.map (fun _ -> List.length (assums_of_rel_context ctx)) fix.fix_annot in
+ sigma, ((env'', ctx' @ ctx), (impl_env',imps @ imps'), annot)
+
+let interp_fix_ccl sigma impls (env,_) fix =
+ interp_type_evars_impls ~impls env sigma fix.fix_type
+
+let interp_fix_body env_rec sigma impls (_,ctx) fix ccl =
+ let open EConstr in
+ Option.cata (fun body ->
+ let env = push_rel_context ctx env_rec in
+ let sigma, body = interp_casted_constr_evars env sigma ~impls body ccl in
+ sigma, Some (it_mkLambda_or_LetIn body ctx)) (sigma, None) fix.fix_body
+
+let build_fix_type (_,ctx) ccl = EConstr.it_mkProd_or_LetIn ccl ctx
+
+let prepare_recursive_declaration fixnames fixtypes fixdefs =
+ let defs = List.map (subst_vars (List.rev fixnames)) fixdefs in
+ let names = List.map (fun id -> Name id) fixnames in
+ (Array.of_list names, Array.of_list fixtypes, Array.of_list defs)
+
+(* Jump over let-bindings. *)
+
+let compute_possible_guardness_evidences (ctx,_,recindex) =
+ (* A recursive index is characterized by the number of lambdas to
+ skip before finding the relevant inductive argument *)
+ match recindex with
+ | Some i -> [i]
+ | None ->
+ (* If recursive argument was not given by user, we try all args.
+ An earlier approach was to look only for inductive arguments,
+ but doing it properly involves delta-reduction, and it finally
+ doesn't seem to worth the effort (except for huge mutual
+ fixpoints ?) *)
+ List.interval 0 (Context.Rel.nhyps ctx - 1)
+
+type recursive_preentry =
+ Id.t list * constr option list * types list
+
+(* Wellfounded definition *)
+
+let contrib_name = "Program"
+let subtac_dir = [contrib_name]
+let tactics_module = subtac_dir @ ["Tactics"]
+
+let init_constant dir s sigma =
+ Evarutil.new_global sigma (Coqlib.coq_reference "Command" dir s)
+
+let fix_proto = init_constant tactics_module "fix_proto"
+
+let interp_recursive ~program_mode ~cofix fixl notations =
+ let open Context.Named.Declaration in
+ let open EConstr in
+ let env = Global.env() in
+ let fixnames = List.map (fun fix -> fix.fix_name) fixl in
+
+ (* Interp arities allowing for unresolved types *)
+ let all_universes =
+ List.fold_right (fun sfe acc ->
+ match sfe.fix_univs , acc with
+ | None , acc -> acc
+ | x , None -> x
+ | Some ls , Some us ->
+ let lsu = ls.univdecl_instance and usu = us.univdecl_instance in
+ if not (CList.for_all2eq (fun x y -> Id.equal (snd x) (snd y)) lsu usu) then
+ user_err Pp.(str "(co)-recursive definitions should all have the same universe binders");
+ Some us) fixl None in
+ let sigma, decl = Univdecls.interp_univ_decl_opt env all_universes in
+ let sigma, (fixctxs, fiximppairs, fixannots) =
+ on_snd List.split3 @@
+ List.fold_left_map (fun sigma -> interp_fix_context env sigma ~cofix) sigma fixl in
+ let fixctximpenvs, fixctximps = List.split fiximppairs in
+ let sigma, (fixccls,fixcclimps) =
+ on_snd List.split @@
+ List.fold_left3_map interp_fix_ccl sigma fixctximpenvs fixctxs fixl in
+ let fixtypes = List.map2 build_fix_type fixctxs fixccls in
+ let fixtypes = List.map (fun c -> nf_evar sigma c) fixtypes in
+ let fiximps = List.map3
+ (fun ctximps cclimps (_,ctx) -> ctximps@(Impargs.lift_implicits (Context.Rel.nhyps ctx) cclimps))
+ fixctximps fixcclimps fixctxs in
+ let sigma, rec_sign =
+ List.fold_left2
+ (fun (sigma, env') id t ->
+ if program_mode then
+ let sigma, sort = Typing.type_of ~refresh:true env sigma t in
+ let sigma, fixprot =
+ try
+ let sigma, h_term = fix_proto sigma in
+ let app = mkApp (h_term, [|sort; t|]) in
+ let _evd = ref sigma in
+ let res = Typing.e_solve_evars env _evd app in
+ !_evd, res
+ with e when CErrors.noncritical e -> sigma, t
+ in
+ sigma, LocalAssum (id,fixprot) :: env'
+ else sigma, LocalAssum (id,t) :: env')
+ (sigma,[]) fixnames fixtypes
+ in
+ let env_rec = push_named_context rec_sign env in
+
+ (* Get interpretation metadatas *)
+ let fixtypes = List.map EConstr.Unsafe.to_constr fixtypes in
+ let impls = compute_internalization_env env Recursive fixnames fixtypes fiximps in
+
+ (* Interp bodies with rollback because temp use of notations/implicit *)
+ let sigma, fixdefs =
+ Metasyntax.with_syntax_protection (fun () ->
+ List.iter (Metasyntax.set_notation_for_interpretation env_rec impls) notations;
+ List.fold_left4_map
+ (fun sigma fixctximpenv -> interp_fix_body env_rec sigma (Id.Map.fold Id.Map.add fixctximpenv impls))
+ sigma fixctximpenvs fixctxs fixl fixccls)
+ () in
+
+ (* Instantiate evars and check all are resolved *)
+ let sigma = solve_unif_constraints_with_heuristics env_rec sigma in
+ let sigma, nf = nf_evars_and_universes sigma in
+ let fixdefs = List.map (fun c -> Option.map EConstr.Unsafe.to_constr c) fixdefs in
+ let fixdefs = List.map (Option.map nf) fixdefs in
+ let fixtypes = List.map nf fixtypes in
+ let fixctxs = List.map (fun (_,ctx) -> ctx) fixctxs in
+
+ (* Build the fix declaration block *)
+ (env,rec_sign,decl,sigma), (fixnames,fixdefs,fixtypes), List.combine3 fixctxs fiximps fixannots
+
+let check_recursive isfix env evd (fixnames,fixdefs,_) =
+ check_evars_are_solved env evd Evd.empty;
+ if List.for_all Option.has_some fixdefs then begin
+ let fixdefs = List.map Option.get fixdefs in
+ check_mutuality env evd isfix (List.combine fixnames fixdefs)
+ end
+
+let interp_fixpoint ~cofix l ntns =
+ let (env,_,pl,evd),fix,info = interp_recursive ~program_mode:false ~cofix l ntns in
+ check_recursive true env evd fix;
+ (fix,pl,Evd.evar_universe_context evd,info)
+
+let declare_fixpoint local poly ((fixnames,fixdefs,fixtypes),pl,ctx,fiximps) indexes ntns =
+ if List.exists Option.is_empty fixdefs then
+ (* Some bodies to define by proof *)
+ let thms =
+ List.map3 (fun id t (ctx,imps,_) -> (id,(EConstr.of_constr t,(List.map RelDecl.get_name ctx,imps))))
+ fixnames fixtypes fiximps in
+ let init_tac =
+ Some (List.map (Option.cata (EConstr.of_constr %> Tactics.exact_no_check) Tacticals.New.tclIDTAC)
+ fixdefs) in
+ let evd = Evd.from_ctx ctx in
+ Lemmas.start_proof_with_initialization (Global,poly,DefinitionBody Fixpoint)
+ evd pl (Some(false,indexes,init_tac)) thms None (Lemmas.mk_hook (fun _ _ -> ()))
+ else begin
+ (* We shortcut the proof process *)
+ let fixdefs = List.map Option.get fixdefs in
+ let fixdecls = prepare_recursive_declaration fixnames fixtypes fixdefs in
+ let env = Global.env() in
+ let indexes = search_guard env indexes fixdecls in
+ let fiximps = List.map (fun (n,r,p) -> r) fiximps in
+ let vars = Univops.universes_of_constr env (mkFix ((indexes,0),fixdecls)) in
+ let fixdecls =
+ List.map_i (fun i _ -> mkFix ((indexes,i),fixdecls)) 0 fixnames in
+ let evd = Evd.from_ctx ctx in
+ 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
+ let fixdecls = List.map Safe_typing.mk_pure_proof fixdecls in
+ ignore (List.map4 (DeclareDef.declare_fix (local, poly, Fixpoint) pl ctx)
+ fixnames fixdecls fixtypes fiximps);
+ (* Declare the recursive definitions *)
+ fixpoint_message (Some indexes) fixnames;
+ end;
+ (* Declare notations *)
+ List.iter (Metasyntax.add_notation_interpretation (Global.env())) ntns
+
+let declare_cofixpoint local poly ((fixnames,fixdefs,fixtypes),pl,ctx,fiximps) ntns =
+ if List.exists Option.is_empty fixdefs then
+ (* Some bodies to define by proof *)
+ let thms =
+ List.map3 (fun id t (ctx,imps,_) -> (id,(EConstr.of_constr t,(List.map RelDecl.get_name ctx,imps))))
+ fixnames fixtypes fiximps in
+ let init_tac =
+ Some (List.map (Option.cata (EConstr.of_constr %> Tactics.exact_no_check) Tacticals.New.tclIDTAC)
+ fixdefs) in
+ let evd = Evd.from_ctx ctx in
+ Lemmas.start_proof_with_initialization (Global,poly, DefinitionBody CoFixpoint)
+ evd pl (Some(true,[],init_tac)) thms None (Lemmas.mk_hook (fun _ _ -> ()))
+ else begin
+ (* We shortcut the proof process *)
+ let fixdefs = List.map Option.get fixdefs in
+ let fixdecls = prepare_recursive_declaration fixnames fixtypes fixdefs in
+ let fixdecls = List.map_i (fun i _ -> mkCoFix (i,fixdecls)) 0 fixnames in
+ let env = Global.env () in
+ let vars = Univops.universes_of_constr env (List.hd fixdecls) in
+ let fixdecls = List.map Safe_typing.mk_pure_proof fixdecls in
+ let fiximps = List.map (fun (len,imps,idx) -> imps) fiximps in
+ let evd = Evd.from_ctx ctx in
+ 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 (local, poly, CoFixpoint) pl ctx)
+ fixnames fixdecls fixtypes fiximps);
+ (* Declare the recursive definitions *)
+ cofixpoint_message fixnames
+ end;
+ (* Declare notations *)
+ List.iter (Metasyntax.add_notation_interpretation (Global.env())) ntns
+
+let extract_decreasing_argument limit = function
+ | (na,CStructRec) -> na
+ | (na,_) when not limit -> na
+ | _ -> user_err Pp.(str
+ "Only structural decreasing is supported for a non-Program Fixpoint")
+
+let extract_fixpoint_components limit l =
+ let fixl, ntnl = List.split l in
+ let fixl = List.map (fun (((_,id),pl),ann,bl,typ,def) ->
+ let ann = extract_decreasing_argument limit ann in
+ {fix_name = id; fix_annot = ann; fix_univs = pl;
+ fix_binders = bl; fix_body = def; fix_type = typ}) fixl in
+ fixl, List.flatten ntnl
+
+let extract_cofixpoint_components l =
+ let fixl, ntnl = List.split l in
+ List.map (fun (((_,id),pl),bl,typ,def) ->
+ {fix_name = id; fix_annot = None; fix_univs = pl;
+ fix_binders = bl; fix_body = def; fix_type = typ}) fixl,
+ List.flatten ntnl
+
+let check_safe () =
+ let open Declarations in
+ let flags = Environ.typing_flags (Global.env ()) in
+ flags.check_universes && flags.check_guarded
+
+let do_fixpoint local poly l =
+ let fixl, ntns = extract_fixpoint_components true l in
+ let (_, _, _, info as fix) = interp_fixpoint ~cofix:false fixl ntns in
+ let possible_indexes =
+ List.map compute_possible_guardness_evidences info in
+ declare_fixpoint local poly fix possible_indexes ntns;
+ if not (check_safe ()) then Feedback.feedback Feedback.AddedAxiom else ()
+
+let do_cofixpoint local poly l =
+ let fixl,ntns = extract_cofixpoint_components l in
+ let cofix = interp_fixpoint ~cofix:true fixl ntns in
+ declare_cofixpoint local poly cofix ntns;
+ if not (check_safe ()) then Feedback.feedback Feedback.AddedAxiom else ()
diff --git a/vernac/comFixpoint.mli b/vernac/comFixpoint.mli
new file mode 100644
index 000000000..2c84bd84d
--- /dev/null
+++ b/vernac/comFixpoint.mli
@@ -0,0 +1,93 @@
+(************************************************************************)
+(* v * The Coq Proof Assistant / The Coq Development Team *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2018 *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(************************************************************************)
+
+open Names
+open Constr
+open Decl_kinds
+open Constrexpr
+open Vernacexpr
+
+(** {6 Fixpoints and cofixpoints} *)
+
+(** Entry points for the vernacular commands Fixpoint and CoFixpoint *)
+
+val do_fixpoint :
+ (* When [false], assume guarded. *)
+ locality -> polymorphic -> (fixpoint_expr * decl_notation list) list -> unit
+
+val do_cofixpoint :
+ (* When [false], assume guarded. *)
+ locality -> polymorphic -> (cofixpoint_expr * decl_notation list) list -> unit
+
+(************************************************************************)
+(** Internal API *)
+(************************************************************************)
+
+type structured_fixpoint_expr = {
+ fix_name : Id.t;
+ fix_univs : Vernacexpr.universe_decl_expr option;
+ fix_annot : Id.t Loc.located option;
+ fix_binders : local_binder_expr list;
+ fix_body : constr_expr option;
+ fix_type : constr_expr
+}
+
+(** Typing global fixpoints and cofixpoint_expr *)
+
+(** Exported for Program *)
+val interp_recursive :
+ (* Misc arguments *)
+ program_mode:bool -> cofix:bool ->
+ (* Notations of the fixpoint / should that be folded in the previous argument? *)
+ structured_fixpoint_expr list -> decl_notation list ->
+
+ (* env / signature / univs / evar_map *)
+ (Environ.env * EConstr.named_context * Univdecls.universe_decl * Evd.evar_map) *
+ (* names / defs / types *)
+ (Id.t list * Constr.constr option list * Constr.types list) *
+ (* ctx per mutual def / implicits / struct annotations *)
+ (EConstr.rel_context * Impargs.manual_explicitation list * int option) list
+
+(** Exported for Funind *)
+
+(** Extracting the semantical components out of the raw syntax of
+ (co)fixpoints declarations *)
+
+val extract_fixpoint_components : bool ->
+ (fixpoint_expr * decl_notation list) list ->
+ structured_fixpoint_expr list * decl_notation list
+
+val extract_cofixpoint_components :
+ (cofixpoint_expr * decl_notation list) list ->
+ structured_fixpoint_expr list * decl_notation list
+
+type recursive_preentry =
+ Id.t list * constr option list * types list
+
+val interp_fixpoint :
+ cofix:bool ->
+ structured_fixpoint_expr list -> decl_notation list ->
+ recursive_preentry * Univdecls.universe_decl * UState.t *
+ (EConstr.rel_context * Impargs.manual_implicits * int option) list
+
+(** Registering fixpoints and cofixpoints in the environment *)
+(** [Not used so far] *)
+val declare_fixpoint :
+ locality -> polymorphic ->
+ recursive_preentry * Univdecls.universe_decl * UState.t *
+ (Context.Rel.t * Impargs.manual_implicits * int option) list ->
+ Proof_global.lemma_possible_guards -> decl_notation list -> unit
+
+val declare_cofixpoint : locality -> polymorphic ->
+ recursive_preentry * Univdecls.universe_decl * UState.t *
+ (Context.Rel.t * Impargs.manual_implicits * int option) list ->
+ decl_notation list -> unit
+
+(** Very private function, do not use *)
+val compute_possible_guardness_evidences :
+ ('a, 'b) Context.Rel.pt * 'c * int option -> int list
diff --git a/vernac/comInductive.ml b/vernac/comInductive.ml
new file mode 100644
index 000000000..1c8677e9c
--- /dev/null
+++ b/vernac/comInductive.ml
@@ -0,0 +1,455 @@
+(************************************************************************)
+(* v * The Coq Proof Assistant / The Coq Development Team *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(************************************************************************)
+
+open Pp
+open CErrors
+open Sorts
+open Util
+open Constr
+open Termops
+open Environ
+open Declare
+open Names
+open Libnames
+open Globnames
+open Nameops
+open Constrexpr
+open Constrexpr_ops
+open Constrintern
+open Nametab
+open Impargs
+open Reductionops
+open Indtypes
+open Pretyping
+open Evarutil
+open Indschemes
+open Misctypes
+open Context.Rel.Declaration
+open Entries
+
+module RelDecl = Context.Rel.Declaration
+
+(* 3b| Mutual inductive definitions *)
+
+let rec complete_conclusion a cs = CAst.map_with_loc (fun ?loc -> function
+ | CProdN (bl,c) -> CProdN (bl,complete_conclusion a cs c)
+ | CLetIn (na,b,t,c) -> CLetIn (na,b,t,complete_conclusion a cs c)
+ | CHole (k, _, _) ->
+ let (has_no_args,name,params) = a in
+ if not has_no_args then
+ user_err ?loc
+ (strbrk"Cannot infer the non constant arguments of the conclusion of "
+ ++ Id.print cs ++ str ".");
+ let args = List.map (fun id -> CAst.make ?loc @@ CRef(Ident(loc,id),None)) params in
+ CAppExpl ((None,Ident(loc,name),None),List.rev args)
+ | c -> c
+ )
+
+let push_types env idl tl =
+ List.fold_left2 (fun env id t -> Environ.push_rel (LocalAssum (Name id,t)) env)
+ env idl tl
+
+type structured_one_inductive_expr = {
+ ind_name : Id.t;
+ ind_univs : Vernacexpr.universe_decl_expr option;
+ ind_arity : constr_expr;
+ ind_lc : (Id.t * constr_expr) list
+}
+
+type structured_inductive_expr =
+ local_binder_expr list * structured_one_inductive_expr list
+
+let minductive_message warn = function
+ | [] -> user_err Pp.(str "No inductive definition.")
+ | [x] -> (Id.print x ++ str " is defined" ++
+ if warn then str " as a non-primitive record" else mt())
+ | l -> hov 0 (prlist_with_sep pr_comma Id.print l ++
+ spc () ++ str "are defined")
+
+let check_all_names_different indl =
+ let ind_names = List.map (fun ind -> ind.ind_name) indl in
+ let cstr_names = List.map_append (fun ind -> List.map fst ind.ind_lc) indl in
+ let l = List.duplicates Id.equal ind_names in
+ let () = match l with
+ | [] -> ()
+ | t :: _ -> raise (InductiveError (SameNamesTypes t))
+ in
+ let l = List.duplicates Id.equal cstr_names in
+ let () = match l with
+ | [] -> ()
+ | c :: _ -> raise (InductiveError (SameNamesConstructors (List.hd l)))
+ in
+ let l = List.intersect Id.equal ind_names cstr_names in
+ match l with
+ | [] -> ()
+ | _ -> raise (InductiveError (SameNamesOverlap l))
+
+let mk_mltype_data sigma env assums arity indname =
+ let is_ml_type = is_sort env sigma (EConstr.of_constr arity) in
+ (is_ml_type,indname,assums)
+
+let prepare_param = function
+ | LocalAssum (na,t) -> Name.get_id na, LocalAssumEntry t
+ | LocalDef (na,b,_) -> Name.get_id na, LocalDefEntry b
+
+(** Make the arity conclusion flexible to avoid generating an upper bound universe now,
+ only if the universe does not appear anywhere else.
+ This is really a hack to stay compatible with the semantics of template polymorphic
+ inductives which are recognized when a "Type" appears at the end of the conlusion in
+ the source syntax. *)
+
+let rec check_anonymous_type ind =
+ let open Glob_term in
+ match DAst.get ind with
+ | GSort (GType []) -> true
+ | GProd ( _, _, _, e)
+ | GLetIn (_, _, _, e)
+ | GLambda (_, _, _, e)
+ | GApp (e, _)
+ | GCast (e, _) -> check_anonymous_type e
+ | _ -> false
+
+let make_conclusion_flexible sigma ty poly =
+ if poly && Term.isArity ty then
+ let _, concl = Term.destArity ty in
+ match concl with
+ | Type u ->
+ (match Univ.universe_level u with
+ | Some u ->
+ Evd.make_flexible_variable sigma ~algebraic:true u
+ | None -> sigma)
+ | _ -> sigma
+ else sigma
+
+let is_impredicative env u =
+ u = Prop Null || (is_impredicative_set env && u = Prop Pos)
+
+let interp_ind_arity env sigma ind =
+ let c = intern_gen IsType env ind.ind_arity in
+ let impls = Implicit_quantifiers.implicits_of_glob_constr ~with_products:true c in
+ let sigma,t = understand_tcc env sigma ~expected_type:IsType c in
+ let pseudo_poly = check_anonymous_type c in
+ let () = if not (Reductionops.is_arity env sigma t) then
+ user_err ?loc:(constr_loc ind.ind_arity) (str "Not an arity")
+ in
+ let t = EConstr.Unsafe.to_constr t in
+ sigma, (t, pseudo_poly, impls)
+
+let interp_cstrs env sigma impls mldata arity ind =
+ let cnames,ctyps = List.split ind.ind_lc in
+ (* Complete conclusions of constructor types if given in ML-style syntax *)
+ let ctyps' = List.map2 (complete_conclusion mldata) cnames ctyps in
+ (* Interpret the constructor types *)
+ let sigma, (ctyps'', cimpls) =
+ on_snd List.split @@
+ List.fold_left_map (fun sigma l ->
+ on_snd (on_fst EConstr.Unsafe.to_constr) @@
+ interp_type_evars_impls env sigma ~impls l) sigma ctyps' in
+ sigma, (cnames, ctyps'', cimpls)
+
+let sign_level env evd sign =
+ fst (List.fold_right
+ (fun d (lev,env) ->
+ match d with
+ | LocalDef _ -> lev, push_rel d env
+ | LocalAssum _ ->
+ let s = destSort (Reduction.whd_all env
+ (EConstr.Unsafe.to_constr (nf_evar evd (Retyping.get_type_of env evd (EConstr.of_constr (RelDecl.get_type d))))))
+ in
+ let u = univ_of_sort s in
+ (Univ.sup u lev, push_rel d env))
+ sign (Univ.type0m_univ,env))
+
+let sup_list min = List.fold_left Univ.sup min
+
+let extract_level env evd min tys =
+ let sorts = List.map (fun ty ->
+ let ctx, concl = Reduction.dest_prod_assum env ty in
+ sign_level env evd (LocalAssum (Anonymous, concl) :: ctx)) tys
+ in sup_list min sorts
+
+let is_flexible_sort evd u =
+ match Univ.Universe.level u with
+ | Some l -> Evd.is_flexible_level evd l
+ | None -> false
+
+let inductive_levels env evd poly arities inds =
+ let destarities = List.map (fun x -> x, Reduction.dest_arity env x) arities in
+ let levels = List.map (fun (x,(ctx,a)) ->
+ if a = Prop Null then None
+ else Some (univ_of_sort a)) destarities
+ in
+ let cstrs_levels, min_levels, sizes =
+ CList.split3
+ (List.map2 (fun (_,tys,_) (arity,(ctx,du)) ->
+ let len = List.length tys in
+ let minlev = Sorts.univ_of_sort du in
+ let minlev =
+ if len > 1 && not (is_impredicative env du) then
+ Univ.sup minlev Univ.type0_univ
+ else minlev
+ in
+ let minlev =
+ (** Indices contribute. *)
+ if Indtypes.is_indices_matter () && List.length ctx > 0 then (
+ let ilev = sign_level env evd ctx in
+ Univ.sup ilev minlev)
+ else minlev
+ in
+ let clev = extract_level env evd minlev tys in
+ (clev, minlev, len)) inds destarities)
+ in
+ (* Take the transitive closure of the system of constructors *)
+ (* level constraints and remove the recursive dependencies *)
+ let levels' = Universes.solve_constraints_system (Array.of_list levels)
+ (Array.of_list cstrs_levels) (Array.of_list min_levels)
+ in
+ let evd, arities =
+ CList.fold_left3 (fun (evd, arities) cu (arity,(ctx,du)) len ->
+ if is_impredicative env du then
+ (** Any product is allowed here. *)
+ evd, arity :: arities
+ else (** If in a predicative sort, or asked to infer the type,
+ we take the max of:
+ - indices (if in indices-matter mode)
+ - constructors
+ - Type(1) if there is more than 1 constructor
+ *)
+ (** Constructors contribute. *)
+ let evd =
+ if Sorts.is_set du then
+ if not (Evd.check_leq evd cu Univ.type0_univ) then
+ raise (Indtypes.InductiveError Indtypes.LargeNonPropInductiveNotInType)
+ else evd
+ else evd
+ (* Evd.set_leq_sort env evd (Type cu) du *)
+ in
+ let evd =
+ if len >= 2 && Univ.is_type0m_univ cu then
+ (** "Polymorphic" type constraint and more than one constructor,
+ should not land in Prop. Add constraint only if it would
+ land in Prop directly (no informative arguments as well). *)
+ Evd.set_leq_sort env evd (Prop Pos) du
+ else evd
+ in
+ let duu = Sorts.univ_of_sort du in
+ let evd =
+ if not (Univ.is_small_univ duu) && Univ.Universe.equal cu duu then
+ if is_flexible_sort evd duu && not (Evd.check_leq evd Univ.type0_univ duu) then
+ Evd.set_eq_sort env evd (Prop Null) du
+ else evd
+ else Evd.set_eq_sort env evd (Type cu) du
+ in
+ (evd, arity :: arities))
+ (evd,[]) (Array.to_list levels') destarities sizes
+ in evd, List.rev arities
+
+let check_named (loc, na) = match na with
+| Name _ -> ()
+| Anonymous ->
+ let msg = str "Parameters must be named." in
+ user_err ?loc msg
+
+
+let check_param = function
+| CLocalDef (na, _, _) -> check_named na
+| CLocalAssum (nas, Default _, _) -> List.iter check_named nas
+| CLocalAssum (nas, Generalized _, _) -> ()
+| CLocalPattern (loc,_) ->
+ Loc.raise ?loc (Stream.Error "pattern with quote not allowed here.")
+
+let interp_mutual_inductive (paramsl,indl) notations cum poly prv finite =
+ check_all_names_different indl;
+ List.iter check_param paramsl;
+ let env0 = Global.env() in
+ let pl = (List.hd indl).ind_univs in
+ let sigma, decl = Univdecls.interp_univ_decl_opt env0 pl in
+ let sigma, (impls, ((env_params, ctx_params), userimpls)) =
+ interp_context_evars env0 sigma paramsl
+ in
+ let ctx_params = List.map (fun d -> map_rel_decl EConstr.Unsafe.to_constr d) ctx_params in
+ let indnames = List.map (fun ind -> ind.ind_name) indl in
+
+ (* Names of parameters as arguments of the inductive type (defs removed) *)
+ let assums = List.filter is_local_assum ctx_params in
+ let params = List.map (RelDecl.get_name %> Name.get_id) assums in
+
+ (* Interpret the arities *)
+ let sigma, arities = List.fold_left_map (fun sigma -> interp_ind_arity env_params sigma) sigma indl in
+
+ let fullarities = List.map (fun (c, _, _) -> Term.it_mkProd_or_LetIn c ctx_params) arities in
+ let env_ar = push_types env0 indnames fullarities in
+ let env_ar_params = push_rel_context ctx_params env_ar in
+
+ (* Compute interpretation metadatas *)
+ let indimpls = List.map (fun (_, _, impls) -> userimpls @
+ lift_implicits (Context.Rel.nhyps ctx_params) impls) arities in
+ let arities = List.map pi1 arities and aritypoly = List.map pi2 arities in
+ let impls = compute_internalization_env env0 ~impls (Inductive (params,true)) indnames fullarities indimpls in
+ let ntn_impls = compute_internalization_env env0 (Inductive (params,true)) indnames fullarities indimpls in
+ let mldatas = List.map2 (mk_mltype_data sigma env_params params) arities indnames in
+
+ let sigma, constructors =
+ Metasyntax.with_syntax_protection (fun () ->
+ (* Temporary declaration of notations and scopes *)
+ List.iter (Metasyntax.set_notation_for_interpretation env_params ntn_impls) notations;
+ (* Interpret the constructor types *)
+ List.fold_left3_map (fun sigma -> interp_cstrs env_ar_params sigma impls) sigma mldatas arities indl)
+ () in
+
+ (* Try further to solve evars, and instantiate them *)
+ let sigma = solve_remaining_evars all_and_fail_flags env_params sigma Evd.empty in
+ (* Compute renewed arities *)
+ let sigma, nf = nf_evars_and_universes sigma in
+ let arities = List.map nf arities in
+ let constructors = List.map (fun (idl,cl,impsl) -> (idl,List.map nf cl,impsl)) constructors in
+ let sigma = List.fold_left2 (fun sigma ty poly -> make_conclusion_flexible sigma ty poly) sigma arities aritypoly in
+ let sigma, arities = inductive_levels env_ar_params sigma poly arities constructors in
+ let sigma, nf' = nf_evars_and_universes sigma in
+ let nf x = nf' (nf x) in
+ let arities = List.map nf' arities in
+ let constructors = List.map (fun (idl,cl,impsl) -> (idl,List.map nf' cl,impsl)) constructors in
+ let ctx_params = Context.Rel.map nf ctx_params in
+ let uctx = Evd.check_univ_decl ~poly sigma decl in
+ List.iter (fun c -> check_evars env_params Evd.empty sigma (EConstr.of_constr c)) arities;
+ Context.Rel.iter (fun c -> check_evars env0 Evd.empty sigma (EConstr.of_constr c)) ctx_params;
+ List.iter (fun (_,ctyps,_) ->
+ List.iter (fun c -> check_evars env_ar_params Evd.empty sigma (EConstr.of_constr c)) ctyps)
+ constructors;
+
+ (* Build the inductive entries *)
+ let entries = List.map4 (fun ind arity template (cnames,ctypes,cimpls) -> {
+ mind_entry_typename = ind.ind_name;
+ mind_entry_arity = arity;
+ mind_entry_template = template;
+ mind_entry_consnames = cnames;
+ mind_entry_lc = ctypes
+ }) indl arities aritypoly constructors in
+ let impls =
+ let len = Context.Rel.nhyps ctx_params in
+ List.map2 (fun indimpls (_,_,cimpls) ->
+ indimpls, List.map (fun impls ->
+ userimpls @ (lift_implicits len impls)) cimpls) indimpls constructors
+ in
+ let univs =
+ match uctx with
+ | Polymorphic_const_entry uctx ->
+ if cum then
+ Cumulative_ind_entry (Universes.univ_inf_ind_from_universe_context uctx)
+ else Polymorphic_ind_entry uctx
+ | Monomorphic_const_entry uctx ->
+ Monomorphic_ind_entry uctx
+ in
+ (* Build the mutual inductive entry *)
+ let mind_ent =
+ { mind_entry_params = List.map prepare_param ctx_params;
+ mind_entry_record = None;
+ mind_entry_finite = finite;
+ mind_entry_inds = entries;
+ mind_entry_private = if prv then Some false else None;
+ mind_entry_universes = univs;
+ }
+ in
+ (if poly && cum then
+ Inductiveops.infer_inductive_subtyping env_ar sigma mind_ent
+ else mind_ent), Evd.universe_binders sigma, impls
+
+(* Very syntactical equality *)
+let eq_local_binders bl1 bl2 =
+ List.equal local_binder_eq bl1 bl2
+
+let extract_coercions indl =
+ let mkqid (_,((_,id),_)) = qualid_of_ident id in
+ let extract lc = List.filter (fun (iscoe,_) -> iscoe) lc in
+ List.map mkqid (List.flatten(List.map (fun (_,_,_,lc) -> extract lc) indl))
+
+let extract_params indl =
+ let paramsl = List.map (fun (_,params,_,_) -> params) indl in
+ match paramsl with
+ | [] -> anomaly (Pp.str "empty list of inductive types.")
+ | params::paramsl ->
+ if not (List.for_all (eq_local_binders params) paramsl) then user_err Pp.(str
+ "Parameters should be syntactically the same for each inductive type.");
+ params
+
+let extract_inductive indl =
+ List.map (fun (((_,indname),pl),_,ar,lc) -> {
+ ind_name = indname; ind_univs = pl;
+ ind_arity = Option.cata (fun x -> x) (CAst.make @@ CSort (GType [])) ar;
+ ind_lc = List.map (fun (_,((_,id),t)) -> (id,t)) lc
+ }) indl
+
+let extract_mutual_inductive_declaration_components indl =
+ let indl,ntnl = List.split indl in
+ let params = extract_params indl in
+ let coes = extract_coercions indl in
+ let indl = extract_inductive indl in
+ (params,indl), coes, List.flatten ntnl
+
+let is_recursive mie =
+ let rec is_recursive_constructor lift typ =
+ match Constr.kind typ with
+ | Prod (_,arg,rest) ->
+ not (EConstr.Vars.noccurn Evd.empty (** FIXME *) lift (EConstr.of_constr arg)) ||
+ is_recursive_constructor (lift+1) rest
+ | LetIn (na,b,t,rest) -> is_recursive_constructor (lift+1) rest
+ | _ -> false
+ in
+ match mie.mind_entry_inds with
+ | [ind] ->
+ let nparams = List.length mie.mind_entry_params in
+ List.exists (fun t -> is_recursive_constructor (nparams+1) t) ind.mind_entry_lc
+ | _ -> false
+
+let declare_mutual_inductive_with_eliminations mie pl impls =
+ (* spiwack: raises an error if the structure is supposed to be non-recursive,
+ but isn't *)
+ begin match mie.mind_entry_finite with
+ | Declarations.BiFinite when is_recursive mie ->
+ if Option.has_some mie.mind_entry_record then
+ user_err Pp.(str "Records declared with the keywords Record or Structure cannot be recursive. You can, however, define recursive records using the Inductive or CoInductive command.")
+ else
+ user_err Pp.(str ("Types declared with the keyword Variant cannot be recursive. Recursive types are defined with the Inductive and CoInductive command."))
+ | _ -> ()
+ end;
+ let names = List.map (fun e -> e.mind_entry_typename) mie.mind_entry_inds in
+ let (_, kn), prim = declare_mind mie in
+ let mind = Global.mind_of_delta_kn kn in
+ List.iteri (fun i (indimpls, constrimpls) ->
+ let ind = (mind,i) in
+ let gr = IndRef ind in
+ maybe_declare_manual_implicits false gr indimpls;
+ Declare.declare_univ_binders gr pl;
+ List.iteri
+ (fun j impls ->
+ maybe_declare_manual_implicits false
+ (ConstructRef (ind, succ j)) impls)
+ constrimpls)
+ impls;
+ let warn_prim = match mie.mind_entry_record with Some (Some _) -> not prim | _ -> false in
+ Flags.if_verbose Feedback.msg_info (minductive_message warn_prim names);
+ if mie.mind_entry_private == None
+ then declare_default_schemes mind;
+ mind
+
+type one_inductive_impls =
+ Impargs.manual_explicitation list (* for inds *)*
+ Impargs.manual_explicitation list list (* for constrs *)
+
+let do_mutual_inductive indl cum poly prv finite =
+ let indl,coes,ntns = extract_mutual_inductive_declaration_components indl in
+ (* Interpret the types *)
+ let mie,pl,impls = interp_mutual_inductive indl ntns cum poly prv finite in
+ (* Declare the mutual inductive block with its associated schemes *)
+ ignore (declare_mutual_inductive_with_eliminations mie pl impls);
+ (* Declare the possible notations of inductive types *)
+ List.iter (Metasyntax.add_notation_interpretation (Global.env ())) ntns;
+ (* Declare the coercions *)
+ List.iter (fun qid -> Class.try_add_new_coercion (locate qid) ~local:false poly) coes;
+ (* If positivity is assumed declares itself as unsafe. *)
+ if Environ.deactivated_guard (Global.env ()) then Feedback.feedback Feedback.AddedAxiom else ()
diff --git a/vernac/comInductive.mli b/vernac/comInductive.mli
new file mode 100644
index 000000000..82ea131e1
--- /dev/null
+++ b/vernac/comInductive.mli
@@ -0,0 +1,65 @@
+(************************************************************************)
+(* v * The Coq Proof Assistant / The Coq Development Team *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(************************************************************************)
+
+open Names
+open Entries
+open Libnames
+open Vernacexpr
+open Constrexpr
+open Decl_kinds
+
+(** {6 Inductive and coinductive types} *)
+
+(** Entry points for the vernacular commands Inductive and CoInductive *)
+
+val do_mutual_inductive :
+ (one_inductive_expr * decl_notation list) list -> cumulative_inductive_flag ->
+ polymorphic -> private_flag -> Declarations.recursivity_kind -> unit
+
+(************************************************************************)
+(** Internal API *)
+(************************************************************************)
+
+(** Exported for Record and Funind *)
+
+(** Registering a mutual inductive definition together with its
+ associated schemes *)
+
+type one_inductive_impls =
+ Impargs.manual_implicits (** for inds *)*
+ Impargs.manual_implicits list (** for constrs *)
+
+val declare_mutual_inductive_with_eliminations :
+ mutual_inductive_entry -> Universes.universe_binders -> one_inductive_impls list ->
+ MutInd.t
+
+(** Exported for Funind *)
+
+(** Extracting the semantical components out of the raw syntax of mutual
+ inductive declarations *)
+
+type structured_one_inductive_expr = {
+ ind_name : Id.t;
+ ind_univs : Vernacexpr.universe_decl_expr option;
+ ind_arity : constr_expr;
+ ind_lc : (Id.t * constr_expr) list
+}
+
+type structured_inductive_expr =
+ local_binder_expr list * structured_one_inductive_expr list
+
+val extract_mutual_inductive_declaration_components :
+ (one_inductive_expr * decl_notation list) list ->
+ structured_inductive_expr * (*coercions:*) qualid list * decl_notation list
+
+(** Typing mutual inductive definitions *)
+
+val interp_mutual_inductive :
+ structured_inductive_expr -> decl_notation list -> cumulative_inductive_flag ->
+ polymorphic -> private_flag -> Declarations.recursivity_kind ->
+ mutual_inductive_entry * Universes.universe_binders * one_inductive_impls list
diff --git a/vernac/comProgramFixpoint.ml b/vernac/comProgramFixpoint.ml
new file mode 100644
index 000000000..a9a91e304
--- /dev/null
+++ b/vernac/comProgramFixpoint.ml
@@ -0,0 +1,342 @@
+open Pp
+open CErrors
+open Util
+open Constr
+open Entries
+open Vars
+open Declare
+open Names
+open Libnames
+open Globnames
+open Nameops
+open Constrexpr
+open Constrexpr_ops
+open Constrintern
+open Decl_kinds
+open Evarutil
+open Context.Rel.Declaration
+open ComFixpoint
+
+module RelDecl = Context.Rel.Declaration
+
+(* Wellfounded definition *)
+
+open Coqlib
+
+let contrib_name = "Program"
+let subtac_dir = [contrib_name]
+let fixsub_module = subtac_dir @ ["Wf"]
+(* let tactics_module = subtac_dir @ ["Tactics"] *)
+
+let init_reference dir s () = Coqlib.coq_reference "Command" dir s
+let init_constant dir s sigma =
+ Evarutil.new_global sigma (Coqlib.coq_reference "Command" dir s)
+
+let make_ref l s = init_reference l s
+(* let fix_proto = init_constant tactics_module "fix_proto" *)
+let fix_sub_ref = make_ref fixsub_module "Fix_sub"
+let measure_on_R_ref = make_ref fixsub_module "MR"
+let well_founded = init_constant ["Init"; "Wf"] "well_founded"
+let mkSubset sigma name typ prop =
+ let open EConstr in
+ let sigma, app_h = Evarutil.new_global sigma (delayed_force build_sigma).typ in
+ sigma, mkApp (app_h, [| typ; mkLambda (name, typ, prop) |])
+
+let sigT = Lazy.from_fun build_sigma_type
+
+let make_qref s = Qualid (Loc.tag @@ qualid_of_string s)
+let lt_ref = make_qref "Init.Peano.lt"
+
+let rec telescope sigma l =
+ let open EConstr in
+ let open Vars in
+ match l with
+ | [] -> assert false
+ | [LocalAssum (n, t)] ->
+ sigma, t, [LocalDef (n, mkRel 1, t)], mkRel 1
+ | LocalAssum (n, t) :: tl ->
+ let sigma, ty, tys, (k, constr) =
+ List.fold_left
+ (fun (sigma, ty, tys, (k, constr)) decl ->
+ let t = RelDecl.get_type decl in
+ let pred = mkLambda (RelDecl.get_name decl, t, ty) in
+ let sigma, ty = Evarutil.new_global sigma (Lazy.force sigT).typ in
+ let sigma, intro = Evarutil.new_global sigma (Lazy.force sigT).intro in
+ let sigty = mkApp (ty, [|t; pred|]) in
+ let intro = mkApp (intro, [|lift k t; lift k pred; mkRel k; constr|]) in
+ (sigma, sigty, pred :: tys, (succ k, intro)))
+ (sigma, t, [], (2, mkRel 1)) tl
+ in
+ let sigma, last, subst = List.fold_right2
+ (fun pred decl (sigma, prev, subst) ->
+ let t = RelDecl.get_type decl in
+ let sigma, p1 = Evarutil.new_global sigma (Lazy.force sigT).proj1 in
+ let sigma, p2 = Evarutil.new_global sigma (Lazy.force sigT).proj2 in
+ let proj1 = applist (p1, [t; pred; prev]) in
+ let proj2 = applist (p2, [t; pred; prev]) in
+ (sigma, lift 1 proj2, LocalDef (get_name decl, proj1, t) :: subst))
+ (List.rev tys) tl (sigma, mkRel 1, [])
+ in sigma, ty, (LocalDef (n, last, t) :: subst), constr
+
+ | LocalDef (n, b, t) :: tl ->
+ let sigma, ty, subst, term = telescope sigma tl in
+ sigma, ty, (LocalDef (n, b, t) :: subst), lift 1 term
+
+let nf_evar_context sigma ctx =
+ List.map (map_constr (fun c -> Evarutil.nf_evar sigma c)) ctx
+
+let build_wellfounded (recname,pl,n,bl,arityc,body) poly r measure notation =
+ let open EConstr in
+ let open Vars in
+ let lift_rel_context n l = Termops.map_rel_context_with_binders (liftn n) l in
+ Coqlib.check_required_library ["Coq";"Program";"Wf"];
+ let env = Global.env() in
+ let sigma, decl = Univdecls.interp_univ_decl_opt env pl in
+ let sigma, (_, ((env', binders_rel), impls)) = interp_context_evars env sigma bl in
+ let len = List.length binders_rel in
+ let top_env = push_rel_context binders_rel env in
+ let sigma, top_arity = interp_type_evars top_env sigma arityc in
+ let full_arity = it_mkProd_or_LetIn top_arity binders_rel in
+ let sigma, argtyp, letbinders, make = telescope sigma binders_rel in
+ let argname = Id.of_string "recarg" in
+ let arg = LocalAssum (Name argname, argtyp) in
+ let binders = letbinders @ [arg] in
+ let binders_env = push_rel_context binders_rel env in
+ let sigma, (rel, _) = interp_constr_evars_impls env sigma r in
+ let relty = Typing.unsafe_type_of env sigma rel in
+ let relargty =
+ let error () =
+ user_err ?loc:(constr_loc r)
+ ~hdr:"Command.build_wellfounded"
+ (Printer.pr_econstr_env env sigma rel ++ str " is not an homogeneous binary relation.")
+ in
+ try
+ let ctx, ar = Reductionops.splay_prod_n env sigma 2 relty in
+ match ctx, EConstr.kind sigma ar with
+ | [LocalAssum (_,t); LocalAssum (_,u)], Sort s
+ when Sorts.is_prop (ESorts.kind sigma s) && Reductionops.is_conv env sigma t u -> t
+ | _, _ -> error ()
+ with e when CErrors.noncritical e -> error ()
+ in
+ let sigma, measure = interp_casted_constr_evars binders_env sigma measure relargty in
+ let sigma, wf_rel, wf_rel_fun, measure_fn =
+ let measure_body, measure =
+ it_mkLambda_or_LetIn measure letbinders,
+ it_mkLambda_or_LetIn measure binders
+ in
+ let sigma, comb = Evarutil.new_global sigma (delayed_force measure_on_R_ref) in
+ let wf_rel = mkApp (comb, [| argtyp; relargty; rel; measure |]) in
+ let wf_rel_fun x y =
+ mkApp (rel, [| subst1 x measure_body;
+ subst1 y measure_body |])
+ in sigma, wf_rel, wf_rel_fun, measure
+ in
+ let sigma, wf_term = well_founded sigma in
+ let wf_proof = mkApp (wf_term, [| argtyp ; wf_rel |]) in
+ let argid' = Id.of_string (Id.to_string argname ^ "'") in
+ let wfarg sigma len =
+ let sigma, ss_term = mkSubset sigma (Name argid') argtyp (wf_rel_fun (mkRel 1) (mkRel (len + 1))) in
+ sigma, LocalAssum (Name argid', ss_term)
+ in
+ let sigma, intern_bl =
+ let sigma, wfa = wfarg sigma 1 in
+ sigma, wfa :: [arg]
+ in
+ let _intern_env = push_rel_context intern_bl env in
+ let sigma, proj = Evarutil.new_global sigma (delayed_force build_sigma).Coqlib.proj1 in
+ let wfargpred = mkLambda (Name argid', argtyp, wf_rel_fun (mkRel 1) (mkRel 3)) in
+ let projection = (* in wfarg :: arg :: before *)
+ mkApp (proj, [| argtyp ; wfargpred ; mkRel 1 |])
+ in
+ let top_arity_let = it_mkLambda_or_LetIn top_arity letbinders in
+ let intern_arity = substl [projection] top_arity_let in
+ (* substitute the projection of wfarg for something,
+ now intern_arity is in wfarg :: arg *)
+ let sigma, wfa = wfarg sigma 1 in
+ let intern_fun_arity_prod = it_mkProd_or_LetIn intern_arity [wfa] in
+ let intern_fun_binder = LocalAssum (Name (add_suffix recname "'"), intern_fun_arity_prod) in
+ let sigma, curry_fun =
+ let wfpred = mkLambda (Name argid', argtyp, wf_rel_fun (mkRel 1) (mkRel (2 * len + 4))) in
+ let sigma, intro = Evarutil.new_global sigma (delayed_force build_sigma).Coqlib.intro in
+ let arg = mkApp (intro, [| argtyp; wfpred; lift 1 make; mkRel 1 |]) in
+ let app = mkApp (mkRel (2 * len + 2 (* recproof + orig binders + current binders *)), [| arg |]) in
+ let rcurry = mkApp (rel, [| measure; lift len measure |]) in
+ let lam = LocalAssum (Name (Id.of_string "recproof"), rcurry) in
+ let body = it_mkLambda_or_LetIn app (lam :: binders_rel) in
+ let ty = it_mkProd_or_LetIn (lift 1 top_arity) (lam :: binders_rel) in
+ sigma, LocalDef (Name recname, body, ty)
+ in
+ let fun_bl = intern_fun_binder :: [arg] in
+ let lift_lets = lift_rel_context 1 letbinders in
+ let sigma, intern_body =
+ let ctx = LocalAssum (Name recname, get_type curry_fun) :: binders_rel in
+ let (r, l, impls, scopes) =
+ Constrintern.compute_internalization_data env
+ Constrintern.Recursive (EConstr.Unsafe.to_constr full_arity) impls
+ in
+ let newimpls = Id.Map.singleton recname
+ (r, l, impls @ [(Some (Id.of_string "recproof", Impargs.Manual, (true, false)))],
+ scopes @ [None]) in
+ interp_casted_constr_evars (push_rel_context ctx env) sigma
+ ~impls:newimpls body (lift 1 top_arity)
+ in
+ let intern_body_lam = it_mkLambda_or_LetIn intern_body (curry_fun :: lift_lets @ fun_bl) in
+ let prop = mkLambda (Name argname, argtyp, top_arity_let) in
+ (* XXX: Previous code did parallel evdref update, so possible old
+ weak ordering semantics may bite here. *)
+ let sigma, def =
+ let sigma, h_a_term = Evarutil.new_global sigma (delayed_force fix_sub_ref) in
+ let sigma, h_e_term = Evarutil.new_evar env sigma
+ ~src:(Loc.tag @@ Evar_kinds.QuestionMark (Evar_kinds.Define false,Anonymous)) wf_proof in
+ sigma, mkApp (h_a_term, [| argtyp ; wf_rel ; h_e_term; prop |])
+ in
+ let _evd = ref sigma in
+ let def = Typing.e_solve_evars env _evd def in
+ let sigma = !_evd in
+ let sigma = Evarutil.nf_evar_map sigma in
+ let def = mkApp (def, [|intern_body_lam|]) in
+ let binders_rel = nf_evar_context sigma binders_rel in
+ let binders = nf_evar_context sigma binders in
+ let top_arity = Evarutil.nf_evar sigma top_arity in
+ let hook, recname, typ =
+ if List.length binders_rel > 1 then
+ let name = add_suffix recname "_func" in
+ (* XXX: Mutating the evar_map in the hook! *)
+ (* XXX: Likely the sigma is out of date when the hook is called .... *)
+ let hook sigma l gr _ =
+ let sigma, h_body = Evarutil.new_global sigma gr in
+ let body = it_mkLambda_or_LetIn (mkApp (h_body, [|make|])) binders_rel in
+ let ty = it_mkProd_or_LetIn top_arity binders_rel in
+ let ty = EConstr.Unsafe.to_constr ty in
+ let univs = Evd.check_univ_decl ~poly sigma decl in
+ (*FIXME poly? *)
+ let ce = definition_entry ~types:ty ~univs (EConstr.to_constr sigma body) in
+ (** FIXME: include locality *)
+ let c = Declare.declare_constant recname (DefinitionEntry ce, IsDefinition Definition) in
+ let gr = ConstRef c in
+ let () = Universes.register_universe_binders gr (Evd.universe_binders sigma) in
+ if Impargs.is_implicit_args () || not (List.is_empty impls) then
+ Impargs.declare_manual_implicits false gr [impls]
+ in
+ let typ = it_mkProd_or_LetIn top_arity binders in
+ hook, name, typ
+ else
+ let typ = it_mkProd_or_LetIn top_arity binders_rel in
+ let hook sigma l gr _ =
+ if Impargs.is_implicit_args () || not (List.is_empty impls) then
+ Impargs.declare_manual_implicits false gr [impls]
+ in hook, recname, typ
+ in
+ (* XXX: Capturing sigma here... bad bad *)
+ let hook = Lemmas.mk_hook (hook sigma) in
+ let fullcoqc = EConstr.to_constr sigma def in
+ let fullctyp = EConstr.to_constr sigma typ in
+ Obligations.check_evars env sigma;
+ let evars, _, evars_def, evars_typ =
+ Obligations.eterm_obligations env recname sigma 0 fullcoqc fullctyp
+ in
+ let ctx = Evd.evar_universe_context sigma in
+ ignore(Obligations.add_definition recname ~term:evars_def ~univdecl:decl
+ evars_typ ctx evars ~hook)
+
+let out_def = function
+ | Some def -> def
+ | None -> user_err Pp.(str "Program Fixpoint needs defined bodies.")
+
+let collect_evars_of_term evd c ty =
+ let evars = Evar.Set.union (Evd.evars_of_term c) (Evd.evars_of_term ty) in
+ Evar.Set.fold (fun ev acc -> Evd.add acc ev (Evd.find_undefined evd ev))
+ evars (Evd.from_ctx (Evd.evar_universe_context evd))
+
+let do_program_recursive local poly fixkind fixl ntns =
+ let cofix = fixkind = Obligations.IsCoFixpoint in
+ let (env, rec_sign, pl, evd), fix, info =
+ interp_recursive ~cofix ~program_mode:true fixl ntns
+ in
+ (* Program-specific code *)
+ (* Get the interesting evars, those that were not instanciated *)
+ let evd = Typeclasses.resolve_typeclasses ~filter:Typeclasses.no_goals ~fail:true env evd in
+ (* Solve remaining evars *)
+ let evd = nf_evar_map_undefined evd in
+ let collect_evars id def typ imps =
+ (* Generalize by the recursive prototypes *)
+ let def =
+ EConstr.to_constr evd (Termops.it_mkNamedLambda_or_LetIn (EConstr.of_constr def) rec_sign)
+ and typ =
+ EConstr.to_constr evd (Termops.it_mkNamedProd_or_LetIn (EConstr.of_constr typ) rec_sign)
+ in
+ let evm = collect_evars_of_term evd def typ in
+ let evars, _, def, typ =
+ Obligations.eterm_obligations env id evm
+ (List.length rec_sign) def typ
+ in (id, def, typ, imps, evars)
+ in
+ let (fixnames,fixdefs,fixtypes) = fix in
+ let fiximps = List.map pi2 info in
+ let fixdefs = List.map out_def fixdefs in
+ let defs = List.map4 collect_evars fixnames fixdefs fixtypes fiximps in
+ let () = if not cofix then begin
+ let possible_indexes = List.map ComFixpoint.compute_possible_guardness_evidences info in
+ let fixdecls = Array.of_list (List.map (fun x -> Name x) fixnames),
+ Array.of_list fixtypes,
+ Array.of_list (List.map (subst_vars (List.rev fixnames)) fixdefs)
+ in
+ let indexes =
+ Pretyping.search_guard (Global.env ()) possible_indexes fixdecls in
+ List.iteri (fun i _ ->
+ Inductive.check_fix env
+ ((indexes,i),fixdecls))
+ fixl
+ end in
+ let ctx = Evd.evar_universe_context evd in
+ let kind = match fixkind with
+ | Obligations.IsFixpoint _ -> (local, poly, Fixpoint)
+ | Obligations.IsCoFixpoint -> (local, poly, CoFixpoint)
+ in
+ Obligations.add_mutual_definitions defs ~kind ~univdecl:pl ctx ntns fixkind
+
+let do_program_fixpoint local poly l =
+ let g = List.map (fun ((_,wf,_,_,_),_) -> wf) l in
+ match g, l with
+ | [(n, CWfRec r)], [((((_,id),pl),_,bl,typ,def),ntn)] ->
+ let recarg =
+ match n with
+ | Some n -> mkIdentC (snd n)
+ | None ->
+ user_err ~hdr:"do_program_fixpoint"
+ (str "Recursive argument required for well-founded fixpoints")
+ in build_wellfounded (id, pl, n, bl, typ, out_def def) poly r recarg ntn
+
+ | [(n, CMeasureRec (m, r))], [((((_,id),pl),_,bl,typ,def),ntn)] ->
+ build_wellfounded (id, pl, n, bl, typ, out_def def) poly
+ (Option.default (CAst.make @@ CRef (lt_ref,None)) r) m ntn
+
+ | _, _ when List.for_all (fun (n, ro) -> ro == CStructRec) g ->
+ let fixl,ntns = extract_fixpoint_components true l in
+ let fixkind = Obligations.IsFixpoint g in
+ do_program_recursive local poly fixkind fixl ntns
+
+ | _, _ ->
+ user_err ~hdr:"do_program_fixpoint"
+ (str "Well-founded fixpoints not allowed in mutually recursive blocks")
+
+let extract_cofixpoint_components l =
+ let fixl, ntnl = List.split l in
+ List.map (fun (((_,id),pl),bl,typ,def) ->
+ {fix_name = id; fix_annot = None; fix_univs = pl;
+ fix_binders = bl; fix_body = def; fix_type = typ}) fixl,
+ List.flatten ntnl
+
+let check_safe () =
+ let open Declarations in
+ let flags = Environ.typing_flags (Global.env ()) in
+ flags.check_universes && flags.check_guarded
+
+let do_fixpoint local poly l =
+ do_program_fixpoint local poly l;
+ if not (check_safe ()) then Feedback.feedback Feedback.AddedAxiom else ()
+
+let do_cofixpoint local poly l =
+ let fixl,ntns = extract_cofixpoint_components l in
+ do_program_recursive local poly Obligations.IsCoFixpoint fixl ntns;
+ if not (check_safe ()) then Feedback.feedback Feedback.AddedAxiom else ()
diff --git a/vernac/comProgramFixpoint.mli b/vernac/comProgramFixpoint.mli
new file mode 100644
index 000000000..943cb8efe
--- /dev/null
+++ b/vernac/comProgramFixpoint.mli
@@ -0,0 +1,12 @@
+open Decl_kinds
+open Vernacexpr
+
+(** Special Fixpoint handling when command is activated. *)
+
+val do_fixpoint :
+ (* When [false], assume guarded. *)
+ locality -> polymorphic -> (fixpoint_expr * decl_notation list) list -> unit
+
+val do_cofixpoint :
+ (* When [false], assume guarded. *)
+ locality -> polymorphic -> (cofixpoint_expr * decl_notation list) list -> unit
diff --git a/vernac/command.ml b/vernac/command.ml
deleted file mode 100644
index f58ed065c..000000000
--- a/vernac/command.ml
+++ /dev/null
@@ -1,1335 +0,0 @@
-(************************************************************************)
-(* v * The Coq Proof Assistant / The Coq Development Team *)
-(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *)
-(* \VV/ **************************************************************)
-(* // * This file is distributed under the terms of the *)
-(* * GNU Lesser General Public License Version 2.1 *)
-(************************************************************************)
-
-open Pp
-open CErrors
-open Util
-open Term
-open Vars
-open Termops
-open Environ
-open Redexpr
-open Declare
-open Names
-open Libnames
-open Globnames
-open Nameops
-open Constrexpr
-open Constrexpr_ops
-open Topconstr
-open Constrintern
-open Nametab
-open Impargs
-open Reductionops
-open Indtypes
-open Decl_kinds
-open Pretyping
-open Evarutil
-open Evarconv
-open Indschemes
-open Misctypes
-open Vernacexpr
-open Context.Rel.Declaration
-open Entries
-
-module RelDecl = Context.Rel.Declaration
-
-let do_universe poly l = Declare.do_universe poly l
-let do_constraint poly l = Declare.do_constraint poly l
-
-let rec under_binders env sigma f n c =
- if Int.equal n 0 then f env sigma (EConstr.of_constr c) else
- match kind_of_term c with
- | Lambda (x,t,c) ->
- mkLambda (x,t,under_binders (push_rel (LocalAssum (x,t)) env) sigma f (n-1) c)
- | LetIn (x,b,t,c) ->
- mkLetIn (x,b,t,under_binders (push_rel (LocalDef (x,b,t)) env) sigma f (n-1) c)
- | _ -> assert false
-
-let rec complete_conclusion a cs = CAst.map_with_loc (fun ?loc -> function
- | CProdN (bl,c) -> CProdN (bl,complete_conclusion a cs c)
- | CLetIn (na,b,t,c) -> CLetIn (na,b,t,complete_conclusion a cs c)
- | CHole (k, _, _) ->
- let (has_no_args,name,params) = a in
- if not has_no_args then
- user_err ?loc
- (strbrk"Cannot infer the non constant arguments of the conclusion of "
- ++ pr_id cs ++ str ".");
- let args = List.map (fun id -> CAst.make ?loc @@ CRef(Ident(loc,id),None)) params in
- CAppExpl ((None,Ident(loc,name),None),List.rev args)
- | c -> c
- )
-
-(* Commands of the interface *)
-
-(* 1| Constant definitions *)
-
-let red_constant_entry n ce sigma = function
- | None -> ce
- | Some red ->
- let proof_out = ce.const_entry_body in
- let env = Global.env () in
- let (redfun, _) = reduction_of_red_expr env red in
- let redfun env sigma c =
- let (_, c) = redfun env sigma c in
- EConstr.Unsafe.to_constr c
- in
- { ce with const_entry_body = Future.chain proof_out
- (fun ((body,ctx),eff) -> (under_binders env sigma redfun n body,ctx),eff) }
-
-let warn_implicits_in_term =
- CWarnings.create ~name:"implicits-in-term" ~category:"implicits"
- (fun () ->
- strbrk "Implicit arguments declaration relies on type." ++ spc () ++
- strbrk "The term declares more implicits than the type here.")
-
-let interp_definition pl bl p red_option c ctypopt =
- let env = Global.env() in
- let evd, decl = Univdecls.interp_univ_decl_opt env pl in
- let evdref = ref evd in
- let impls, ((env_bl, ctx), imps1) = interp_context_evars env evdref bl in
- let ctx = List.map (fun d -> map_rel_decl EConstr.Unsafe.to_constr d) ctx in
- let nb_args = Context.Rel.nhyps ctx in
- let imps,pl,ce =
- match ctypopt with
- None ->
- let subst = evd_comb0 Evd.nf_univ_variables evdref in
- let ctx = Context.Rel.map (Vars.subst_univs_constr subst) ctx in
- let env_bl = push_rel_context ctx env in
- let c, imps2 = interp_constr_evars_impls ~impls env_bl evdref c in
- let c = EConstr.Unsafe.to_constr c in
- let nf,subst = Evarutil.e_nf_evars_and_universes evdref in
- let body = nf (it_mkLambda_or_LetIn c ctx) in
- let vars = Univops.universes_of_constr body in
- let evd = Evd.restrict_universe_context !evdref vars in
- let pl, uctx = Evd.check_univ_decl evd decl in
- imps1@(Impargs.lift_implicits nb_args imps2), pl,
- definition_entry ~univs:uctx ~poly:p body
- | Some ctyp ->
- let ty, impsty = interp_type_evars_impls ~impls env_bl evdref ctyp in
- let subst = evd_comb0 Evd.nf_univ_variables evdref in
- let ctx = Context.Rel.map (Vars.subst_univs_constr subst) ctx in
- let env_bl = push_rel_context ctx env in
- let c, imps2 = interp_casted_constr_evars_impls ~impls env_bl evdref c ty in
- let c = EConstr.Unsafe.to_constr c in
- let nf, subst = Evarutil.e_nf_evars_and_universes evdref in
- let body = nf (it_mkLambda_or_LetIn c ctx) in
- let ty = EConstr.Unsafe.to_constr ty in
- let typ = nf (Term.it_mkProd_or_LetIn ty ctx) in
- let beq b1 b2 = if b1 then b2 else not b2 in
- let impl_eq (x,y,z) (x',y',z') = beq x x' && beq y y' && beq z z' in
- (* Check that all implicit arguments inferable from the term
- are inferable from the type *)
- let chk (key,va) =
- impl_eq (List.assoc_f Pervasives.(=) key impsty) va (* FIXME *)
- in
- if not (try List.for_all chk imps2 with Not_found -> false)
- then warn_implicits_in_term ();
- let vars = Univ.LSet.union (Univops.universes_of_constr body)
- (Univops.universes_of_constr typ) in
- let ctx = Evd.restrict_universe_context !evdref vars in
- let pl, uctx = Evd.check_univ_decl ctx decl in
- imps1@(Impargs.lift_implicits nb_args impsty), pl,
- definition_entry ~types:typ ~poly:p
- ~univs:uctx body
- in
- red_constant_entry (Context.Rel.length ctx) ce !evdref red_option, !evdref, decl, pl, imps
-
-let check_definition (ce, evd, _, _, imps) =
- check_evars_are_solved (Global.env ()) evd Evd.empty;
- ce
-
-let do_definition ident k univdecl bl red_option c ctypopt hook =
- let (ce, evd, univdecl, pl', imps as def) =
- interp_definition univdecl bl (pi2 k) red_option c ctypopt
- in
- if Flags.is_program_mode () then
- let env = Global.env () in
- let (c,ctx), sideff = Future.force ce.const_entry_body in
- assert(Safe_typing.empty_private_constants = sideff);
- assert(Univ.ContextSet.is_empty ctx);
- let typ = match ce.const_entry_type with
- | Some t -> t
- | None -> EConstr.to_constr evd (Retyping.get_type_of env evd (EConstr.of_constr c))
- in
- Obligations.check_evars env evd;
- let obls, _, c, cty =
- Obligations.eterm_obligations env ident evd 0 c typ
- in
- let ctx = Evd.evar_universe_context evd in
- let hook = Lemmas.mk_hook (fun l r _ -> Lemmas.call_hook (fun exn -> exn) hook l r) in
- ignore(Obligations.add_definition
- ident ~term:c cty ctx ~univdecl ~implicits:imps ~kind:k ~hook obls)
- else let ce = check_definition def in
- ignore(DeclareDef.declare_definition ident k ce pl' imps
- (Lemmas.mk_hook
- (fun l r -> Lemmas.call_hook (fun exn -> exn) hook l r;r)))
-
-(* 2| Variable/Hypothesis/Parameter/Axiom declarations *)
-
-let declare_assumption is_coe (local,p,kind) (c,ctx) pl imps impl nl (_,ident) =
-match local with
-| Discharge when Lib.sections_are_opened () ->
- 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 && Proof_global.there_are_pending_proofs () then
- Feedback.msg_info (str"Variable" ++ spc () ++ pr_id ident ++
- strbrk " is not visible from current goals")
- in
- let r = VarRef ident in
- let () = Typeclasses.declare_instance None true r in
- let () = if is_coe then Class.try_add_new_coercion r ~local:true false in
- (r,Univ.Instance.empty,true)
-
-| Global | Local | Discharge ->
- let local = DeclareDef.get_locality ident ~kind:"axiom" local in
- let inl = match nl with
- | NoInline -> None
- | DefaultInline -> Some (Flags.get_inline_level())
- | InlineAt i -> Some i
- in
- let ctx = Univ.ContextSet.to_context ctx in
- let decl = (ParameterEntry (None,p,(c,ctx),inl), IsAssumption kind) in
- let kn = declare_constant ident ~local decl in
- let gr = ConstRef kn in
- let () = maybe_declare_manual_implicits false gr imps in
- let () = Universes.register_universe_binders gr pl in
- let () = assumption_message ident in
- let () = Typeclasses.declare_instance None false gr in
- let () = if is_coe then Class.try_add_new_coercion gr ~local p in
- let inst =
- if p (* polymorphic *) then Univ.UContext.instance ctx
- else Univ.Instance.empty
- in
- (gr,inst,Lib.is_modtype_strict ())
-
-let interp_assumption evdref env impls bl c =
- let c = mkCProdN ?loc:(local_binders_loc bl) bl c in
- let ty, impls = interp_type_evars_impls env evdref ~impls c in
- let ty = EConstr.Unsafe.to_constr ty in
- (ty, impls)
-
-let declare_assumptions idl is_coe k (c,ctx) pl imps impl_is_on nl =
- let refs, status, _ =
- List.fold_left (fun (refs,status,ctx) id ->
- let ref',u',status' =
- declare_assumption is_coe k (c,ctx) pl imps impl_is_on nl id in
- (ref',u')::refs, status' && status, Univ.ContextSet.empty)
- ([],true,ctx) idl
- in
- List.rev refs, status
-
-let do_assumptions_unbound_univs (_, poly, _ as kind) nl l =
- let open Context.Named.Declaration in
- let env = Global.env () in
- let evdref = ref (Evd.from_env env) in
- let l =
- if poly then
- (* Separate declarations so that A B : Type puts A and B in different levels. *)
- List.fold_right (fun (is_coe,(idl,c)) acc ->
- List.fold_right (fun id acc ->
- (is_coe, ([id], c)) :: acc) idl acc)
- l []
- else l
- in
- (* We intepret all declarations in the same evar_map, i.e. as a telescope. *)
- let _,l = List.fold_left_map (fun (env,ienv) (is_coe,(idl,c)) ->
- let t,imps = interp_assumption evdref env ienv [] c in
- let env =
- push_named_context (List.map (fun (_,id) -> LocalAssum (id,t)) idl) env in
- let ienv = List.fold_right (fun (_,id) ienv ->
- let impls = compute_internalization_data env Variable t imps in
- Id.Map.add id impls ienv) idl ienv in
- ((env,ienv),((is_coe,idl),t,imps)))
- (env,empty_internalization_env) l
- in
- let evd = solve_remaining_evars all_and_fail_flags env !evdref Evd.empty in
- (* The universe constraints come from the whole telescope. *)
- let evd = Evd.nf_constraints evd in
- let ctx = Evd.universe_context_set evd in
- let nf_evar c = EConstr.Unsafe.to_constr (nf_evar evd (EConstr.of_constr c)) in
- let l = List.map (on_pi2 nf_evar) l in
- pi2 (List.fold_left (fun (subst,status,ctx) ((is_coe,idl),t,imps) ->
- let t = replace_vars subst t in
- let (refs,status') = declare_assumptions idl is_coe kind (t,ctx) [] imps false nl in
- let subst' = List.map2
- (fun (_,id) (c,u) -> (id,Universes.constr_of_global_univ (c,u)))
- idl refs
- in
- (subst'@subst, status' && status,
- (* The universe constraints are declared with the first declaration only. *)
- Univ.ContextSet.empty)) ([],true,ctx) l)
-
-let do_assumptions_bound_univs coe kind nl id pl c =
- let env = Global.env () in
- let evd, decl = Univdecls.interp_univ_decl_opt env pl in
- let evdref = ref evd in
- let ty, impls = interp_type_evars_impls env evdref c in
- let nf, subst = Evarutil.e_nf_evars_and_universes evdref in
- let ty = EConstr.Unsafe.to_constr ty in
- let ty = nf ty in
- let vars = Univops.universes_of_constr ty in
- let evd = Evd.restrict_universe_context !evdref vars in
- let pl, uctx = Evd.check_univ_decl evd decl in
- let uctx = Univ.ContextSet.of_context uctx in
- let (_, _, st) = declare_assumption coe kind (ty, uctx) pl impls false nl id in
- st
-
-let do_assumptions kind nl l = match l with
-| [coe, ([id, Some pl], c)] ->
- let () = match kind with
- | (Discharge, _, _) when Lib.sections_are_opened () ->
- let loc = fst id in
- let msg = Pp.str "Section variables cannot be polymorphic." in
- user_err ?loc msg
- | _ -> ()
- in
- do_assumptions_bound_univs coe kind nl id (Some pl) c
-| _ ->
- let map (coe, (idl, c)) =
- let map (id, univs) = match univs with
- | None -> id
- | Some _ ->
- let loc = fst id in
- let msg =
- Pp.str "Assumptions with bound universes can only be defined one at a time." in
- user_err ?loc msg
- in
- (coe, (List.map map idl, c))
- in
- let l = List.map map l in
- do_assumptions_unbound_univs kind nl l
-
-(* 3a| Elimination schemes for mutual inductive definitions *)
-
-(* 3b| Mutual inductive definitions *)
-
-let push_types env idl tl =
- List.fold_left2 (fun env id t -> Environ.push_rel (LocalAssum (Name id,t)) env)
- env idl tl
-
-type structured_one_inductive_expr = {
- ind_name : Id.t;
- ind_univs : Vernacexpr.universe_decl_expr option;
- ind_arity : constr_expr;
- ind_lc : (Id.t * constr_expr) list
-}
-
-type structured_inductive_expr =
- local_binder_expr list * structured_one_inductive_expr list
-
-let minductive_message warn = function
- | [] -> user_err Pp.(str "No inductive definition.")
- | [x] -> (pr_id x ++ str " is defined" ++
- if warn then str " as a non-primitive record" else mt())
- | l -> hov 0 (prlist_with_sep pr_comma pr_id l ++
- spc () ++ str "are defined")
-
-let check_all_names_different indl =
- let ind_names = List.map (fun ind -> ind.ind_name) indl in
- let cstr_names = List.map_append (fun ind -> List.map fst ind.ind_lc) indl in
- let l = List.duplicates Id.equal ind_names in
- let () = match l with
- | [] -> ()
- | t :: _ -> raise (InductiveError (SameNamesTypes t))
- in
- let l = List.duplicates Id.equal cstr_names in
- let () = match l with
- | [] -> ()
- | c :: _ -> raise (InductiveError (SameNamesConstructors (List.hd l)))
- in
- let l = List.intersect Id.equal ind_names cstr_names in
- match l with
- | [] -> ()
- | _ -> raise (InductiveError (SameNamesOverlap l))
-
-let mk_mltype_data evdref env assums arity indname =
- let is_ml_type = is_sort env !evdref (EConstr.of_constr arity) in
- (is_ml_type,indname,assums)
-
-let prepare_param = function
- | LocalAssum (na,t) -> Name.get_id na, LocalAssumEntry t
- | LocalDef (na,b,_) -> Name.get_id na, LocalDefEntry b
-
-(** Make the arity conclusion flexible to avoid generating an upper bound universe now,
- only if the universe does not appear anywhere else.
- This is really a hack to stay compatible with the semantics of template polymorphic
- inductives which are recognized when a "Type" appears at the end of the conlusion in
- the source syntax. *)
-
-let rec check_anonymous_type ind =
- let open Glob_term in
- match DAst.get ind with
- | GSort (GType []) -> true
- | GProd ( _, _, _, e)
- | GLetIn (_, _, _, e)
- | GLambda (_, _, _, e)
- | GApp (e, _)
- | GCast (e, _) -> check_anonymous_type e
- | _ -> false
-
-let make_conclusion_flexible evdref ty poly =
- if poly && isArity ty then
- let _, concl = destArity ty in
- match concl with
- | Type u ->
- (match Univ.universe_level u with
- | Some u ->
- evdref := Evd.make_flexible_variable !evdref ~algebraic:true u
- | None -> ())
- | _ -> ()
- else ()
-
-let is_impredicative env u =
- u = Prop Null || (is_impredicative_set env && u = Prop Pos)
-
-let interp_ind_arity env evdref ind =
- let c = intern_gen IsType env ind.ind_arity in
- let impls = Implicit_quantifiers.implicits_of_glob_constr ~with_products:true c in
- let (evd,t) = understand_tcc env !evdref ~expected_type:IsType c in
- evdref := evd;
- let pseudo_poly = check_anonymous_type c in
- let () = if not (Reductionops.is_arity env !evdref t) then
- user_err ?loc:(constr_loc ind.ind_arity) (str "Not an arity")
- in
- let t = EConstr.Unsafe.to_constr t in
- t, pseudo_poly, impls
-
-let interp_cstrs evdref env impls mldata arity ind =
- let cnames,ctyps = List.split ind.ind_lc in
- (* Complete conclusions of constructor types if given in ML-style syntax *)
- let ctyps' = List.map2 (complete_conclusion mldata) cnames ctyps in
- (* Interpret the constructor types *)
- let ctyps'', cimpls = List.split (List.map (interp_type_evars_impls evdref env ~impls %> on_fst EConstr.Unsafe.to_constr) ctyps') in
- (cnames, ctyps'', cimpls)
-
-let sign_level env evd sign =
- fst (List.fold_right
- (fun d (lev,env) ->
- match d with
- | LocalDef _ -> lev, push_rel d env
- | LocalAssum _ ->
- let s = destSort (Reduction.whd_all env
- (EConstr.Unsafe.to_constr (nf_evar evd (Retyping.get_type_of env evd (EConstr.of_constr (RelDecl.get_type d))))))
- in
- let u = univ_of_sort s in
- (Univ.sup u lev, push_rel d env))
- sign (Univ.type0m_univ,env))
-
-let sup_list min = List.fold_left Univ.sup min
-
-let extract_level env evd min tys =
- let sorts = List.map (fun ty ->
- let ctx, concl = Reduction.dest_prod_assum env ty in
- sign_level env evd (LocalAssum (Anonymous, concl) :: ctx)) tys
- in sup_list min sorts
-
-let is_flexible_sort evd u =
- match Univ.Universe.level u with
- | Some l -> Evd.is_flexible_level evd l
- | None -> false
-
-let inductive_levels env evdref poly arities inds =
- let destarities = List.map (fun x -> x, Reduction.dest_arity env x) arities in
- let levels = List.map (fun (x,(ctx,a)) ->
- if a = Prop Null then None
- else Some (univ_of_sort a)) destarities
- in
- let cstrs_levels, min_levels, sizes =
- CList.split3
- (List.map2 (fun (_,tys,_) (arity,(ctx,du)) ->
- let len = List.length tys in
- let minlev = Sorts.univ_of_sort du in
- let minlev =
- if len > 1 && not (is_impredicative env du) then
- Univ.sup minlev Univ.type0_univ
- else minlev
- in
- let minlev =
- (** Indices contribute. *)
- if Indtypes.is_indices_matter () && List.length ctx > 0 then (
- let ilev = sign_level env !evdref ctx in
- Univ.sup ilev minlev)
- else minlev
- in
- let clev = extract_level env !evdref minlev tys in
- (clev, minlev, len)) inds destarities)
- in
- (* Take the transitive closure of the system of constructors *)
- (* level constraints and remove the recursive dependencies *)
- let levels' = Universes.solve_constraints_system (Array.of_list levels)
- (Array.of_list cstrs_levels) (Array.of_list min_levels)
- in
- let evd, arities =
- CList.fold_left3 (fun (evd, arities) cu (arity,(ctx,du)) len ->
- if is_impredicative env du then
- (** Any product is allowed here. *)
- evd, arity :: arities
- else (** If in a predicative sort, or asked to infer the type,
- we take the max of:
- - indices (if in indices-matter mode)
- - constructors
- - Type(1) if there is more than 1 constructor
- *)
- (** Constructors contribute. *)
- let evd =
- if Sorts.is_set du then
- if not (Evd.check_leq evd cu Univ.type0_univ) then
- raise (Indtypes.InductiveError Indtypes.LargeNonPropInductiveNotInType)
- else evd
- else evd
- (* Evd.set_leq_sort env evd (Type cu) du *)
- in
- let evd =
- if len >= 2 && Univ.is_type0m_univ cu then
- (** "Polymorphic" type constraint and more than one constructor,
- should not land in Prop. Add constraint only if it would
- land in Prop directly (no informative arguments as well). *)
- Evd.set_leq_sort env evd (Prop Pos) du
- else evd
- in
- let duu = Sorts.univ_of_sort du in
- let evd =
- if not (Univ.is_small_univ duu) && Univ.Universe.equal cu duu then
- if is_flexible_sort evd duu && not (Evd.check_leq evd Univ.type0_univ duu) then
- Evd.set_eq_sort env evd (Prop Null) du
- else evd
- else Evd.set_eq_sort env evd (Type cu) du
- in
- (evd, arity :: arities))
- (!evdref,[]) (Array.to_list levels') destarities sizes
- in evdref := evd; List.rev arities
-
-let check_named (loc, na) = match na with
-| Name _ -> ()
-| Anonymous ->
- let msg = str "Parameters must be named." in
- user_err ?loc msg
-
-
-let check_param = function
-| CLocalDef (na, _, _) -> check_named na
-| CLocalAssum (nas, Default _, _) -> List.iter check_named nas
-| CLocalAssum (nas, Generalized _, _) -> ()
-| CLocalPattern (loc,_) ->
- Loc.raise ?loc (Stream.Error "pattern with quote not allowed here.")
-
-let interp_mutual_inductive (paramsl,indl) notations cum poly prv finite =
- check_all_names_different indl;
- List.iter check_param paramsl;
- let env0 = Global.env() in
- let pl = (List.hd indl).ind_univs in
- let evd, decl = Univdecls.interp_univ_decl_opt env0 pl in
- let evdref = ref evd in
- let impls, ((env_params, ctx_params), userimpls) =
- interp_context_evars env0 evdref paramsl
- in
- let ctx_params = List.map (fun d -> map_rel_decl EConstr.Unsafe.to_constr d) ctx_params in
- let indnames = List.map (fun ind -> ind.ind_name) indl in
-
- (* Names of parameters as arguments of the inductive type (defs removed) *)
- let assums = List.filter is_local_assum ctx_params in
- let params = List.map (RelDecl.get_name %> Name.get_id) assums in
-
- (* Interpret the arities *)
- let arities = List.map (interp_ind_arity env_params evdref) indl in
-
- let fullarities = List.map (fun (c, _, _) -> Term.it_mkProd_or_LetIn c ctx_params) arities in
- let env_ar = push_types env0 indnames fullarities in
- let env_ar_params = push_rel_context ctx_params env_ar in
-
- (* Compute interpretation metadatas *)
- let indimpls = List.map (fun (_, _, impls) -> userimpls @
- lift_implicits (Context.Rel.nhyps ctx_params) impls) arities in
- let arities = List.map pi1 arities and aritypoly = List.map pi2 arities in
- let impls = compute_internalization_env env0 ~impls (Inductive (params,true)) indnames fullarities indimpls in
- let mldatas = List.map2 (mk_mltype_data evdref env_params params) arities indnames in
-
- let constructors =
- Metasyntax.with_syntax_protection (fun () ->
- (* Temporary declaration of notations and scopes *)
- List.iter (Metasyntax.set_notation_for_interpretation env_params impls) notations;
- (* Interpret the constructor types *)
- List.map3 (interp_cstrs env_ar_params evdref impls) mldatas arities indl)
- () in
-
- (* Try further to solve evars, and instantiate them *)
- let sigma = solve_remaining_evars all_and_fail_flags env_params !evdref Evd.empty in
- evdref := sigma;
- (* Compute renewed arities *)
- let nf,_ = e_nf_evars_and_universes evdref in
- let arities = List.map nf arities in
- let constructors = List.map (fun (idl,cl,impsl) -> (idl,List.map nf cl,impsl)) constructors in
- let _ = List.iter2 (fun ty poly -> make_conclusion_flexible evdref ty poly) arities aritypoly in
- let arities = inductive_levels env_ar_params evdref poly arities constructors in
- let nf',_ = e_nf_evars_and_universes evdref in
- let nf x = nf' (nf x) in
- let arities = List.map nf' arities in
- let constructors = List.map (fun (idl,cl,impsl) -> (idl,List.map nf' cl,impsl)) constructors in
- let ctx_params = Context.Rel.map nf ctx_params in
- let evd = !evdref in
- let pl, uctx = Evd.check_univ_decl evd decl in
- List.iter (fun c -> check_evars env_params Evd.empty evd (EConstr.of_constr c)) arities;
- Context.Rel.iter (fun c -> check_evars env0 Evd.empty evd (EConstr.of_constr c)) ctx_params;
- List.iter (fun (_,ctyps,_) ->
- List.iter (fun c -> check_evars env_ar_params Evd.empty evd (EConstr.of_constr c)) ctyps)
- constructors;
-
- (* Build the inductive entries *)
- let entries = List.map4 (fun ind arity template (cnames,ctypes,cimpls) -> {
- mind_entry_typename = ind.ind_name;
- mind_entry_arity = arity;
- mind_entry_template = template;
- mind_entry_consnames = cnames;
- mind_entry_lc = ctypes
- }) indl arities aritypoly constructors in
- let impls =
- let len = Context.Rel.nhyps ctx_params in
- List.map2 (fun indimpls (_,_,cimpls) ->
- indimpls, List.map (fun impls ->
- userimpls @ (lift_implicits len impls)) cimpls) indimpls constructors
- in
- let univs =
- if poly then
- if cum then
- Cumulative_ind_entry (Universes.univ_inf_ind_from_universe_context uctx)
- else Polymorphic_ind_entry uctx
- else
- Monomorphic_ind_entry uctx
- in
- (* Build the mutual inductive entry *)
- let mind_ent =
- { mind_entry_params = List.map prepare_param ctx_params;
- mind_entry_record = None;
- mind_entry_finite = finite;
- mind_entry_inds = entries;
- mind_entry_private = if prv then Some false else None;
- mind_entry_universes = univs;
- }
- in
- (if poly && cum then
- Inductiveops.infer_inductive_subtyping env_ar evd mind_ent
- else mind_ent), pl, impls
-
-(* Very syntactical equality *)
-let eq_local_binders bl1 bl2 =
- List.equal local_binder_eq bl1 bl2
-
-let extract_coercions indl =
- let mkqid (_,((_,id),_)) = qualid_of_ident id in
- let extract lc = List.filter (fun (iscoe,_) -> iscoe) lc in
- List.map mkqid (List.flatten(List.map (fun (_,_,_,lc) -> extract lc) indl))
-
-let extract_params indl =
- let paramsl = List.map (fun (_,params,_,_) -> params) indl in
- match paramsl with
- | [] -> anomaly (Pp.str "empty list of inductive types.")
- | params::paramsl ->
- if not (List.for_all (eq_local_binders params) paramsl) then user_err Pp.(str
- "Parameters should be syntactically the same for each inductive type.");
- params
-
-let extract_inductive indl =
- List.map (fun (((_,indname),pl),_,ar,lc) -> {
- ind_name = indname; ind_univs = pl;
- ind_arity = Option.cata (fun x -> x) (CAst.make @@ CSort (GType [])) ar;
- ind_lc = List.map (fun (_,((_,id),t)) -> (id,t)) lc
- }) indl
-
-let extract_mutual_inductive_declaration_components indl =
- let indl,ntnl = List.split indl in
- let params = extract_params indl in
- let coes = extract_coercions indl in
- let indl = extract_inductive indl in
- (params,indl), coes, List.flatten ntnl
-
-let is_recursive mie =
- let rec is_recursive_constructor lift typ =
- match Term.kind_of_term typ with
- | Prod (_,arg,rest) ->
- not (EConstr.Vars.noccurn Evd.empty (** FIXME *) lift (EConstr.of_constr arg)) ||
- is_recursive_constructor (lift+1) rest
- | LetIn (na,b,t,rest) -> is_recursive_constructor (lift+1) rest
- | _ -> false
- in
- match mie.mind_entry_inds with
- | [ind] ->
- let nparams = List.length mie.mind_entry_params in
- List.exists (fun t -> is_recursive_constructor (nparams+1) t) ind.mind_entry_lc
- | _ -> false
-
-let declare_mutual_inductive_with_eliminations mie pl impls =
- (* spiwack: raises an error if the structure is supposed to be non-recursive,
- but isn't *)
- begin match mie.mind_entry_finite with
- | BiFinite when is_recursive mie ->
- if Option.has_some mie.mind_entry_record then
- user_err Pp.(str "Records declared with the keywords Record or Structure cannot be recursive. You can, however, define recursive records using the Inductive or CoInductive command.")
- else
- user_err Pp.(str ("Types declared with the keyword Variant cannot be recursive. Recursive types are defined with the Inductive and CoInductive command."))
- | _ -> ()
- end;
- let names = List.map (fun e -> e.mind_entry_typename) mie.mind_entry_inds in
- let (_, kn), prim = declare_mind mie in
- let mind = Global.mind_of_delta_kn kn in
- List.iteri (fun i (indimpls, constrimpls) ->
- let ind = (mind,i) in
- let gr = IndRef ind in
- maybe_declare_manual_implicits false gr indimpls;
- Universes.register_universe_binders gr pl;
- List.iteri
- (fun j impls ->
- maybe_declare_manual_implicits false
- (ConstructRef (ind, succ j)) impls)
- constrimpls)
- impls;
- let warn_prim = match mie.mind_entry_record with Some (Some _) -> not prim | _ -> false in
- Flags.if_verbose Feedback.msg_info (minductive_message warn_prim names);
- if mie.mind_entry_private == None
- then declare_default_schemes mind;
- mind
-
-type one_inductive_impls =
- Impargs.manual_explicitation list (* for inds *)*
- Impargs.manual_explicitation list list (* for constrs *)
-
-let do_mutual_inductive indl cum poly prv finite =
- let indl,coes,ntns = extract_mutual_inductive_declaration_components indl in
- (* Interpret the types *)
- let mie,pl,impls = interp_mutual_inductive indl ntns cum poly prv finite in
- (* Declare the mutual inductive block with its associated schemes *)
- ignore (declare_mutual_inductive_with_eliminations mie pl impls);
- (* Declare the possible notations of inductive types *)
- List.iter (Metasyntax.add_notation_interpretation (Global.env ())) ntns;
- (* Declare the coercions *)
- List.iter (fun qid -> Class.try_add_new_coercion (locate qid) ~local:false poly) coes;
- (* If positivity is assumed declares itself as unsafe. *)
- if Environ.deactivated_guard (Global.env ()) then Feedback.feedback Feedback.AddedAxiom else ()
-
-(* 3c| Fixpoints and co-fixpoints *)
-
-(* An (unoptimized) function that maps preorders to partial orders...
-
- Input: a list of associations (x,[y1;...;yn]), all yi distincts
- and different of x, meaning x<=y1, ..., x<=yn
-
- Output: a list of associations (x,Inr [y1;...;yn]), collecting all
- distincts yi greater than x, _or_, (x, Inl y) meaning that
- x is in the same class as y (in which case, x occurs
- nowhere else in the association map)
-
- partial_order : ('a * 'a list) list -> ('a * ('a,'a list) union) list
-*)
-
-let rec partial_order cmp = function
- | [] -> []
- | (x,xge)::rest ->
- let rec browse res xge' = function
- | [] ->
- let res = List.map (function
- | (z, Inr zge) when List.mem_f cmp x zge ->
- (z, Inr (List.union cmp zge xge'))
- | r -> r) res in
- (x,Inr xge')::res
- | y::xge ->
- let rec link y =
- try match List.assoc_f cmp y res with
- | Inl z -> link z
- | Inr yge ->
- if List.mem_f cmp x yge then
- let res = List.remove_assoc_f cmp y res in
- let res = List.map (function
- | (z, Inl t) ->
- if cmp t y then (z, Inl x) else (z, Inl t)
- | (z, Inr zge) ->
- if List.mem_f cmp y zge then
- (z, Inr (List.add_set cmp x (List.remove cmp y zge)))
- else
- (z, Inr zge)) res in
- browse ((y,Inl x)::res) xge' (List.union cmp xge (List.remove cmp x yge))
- else
- browse res (List.add_set cmp y (List.union cmp xge' yge)) xge
- with Not_found -> browse res (List.add_set cmp y xge') xge
- in link y
- in browse (partial_order cmp rest) [] xge
-
-let non_full_mutual_message x xge y yge isfix rest =
- let reason =
- if Id.List.mem x yge then
- pr_id y ++ str " depends on " ++ pr_id x ++ strbrk " but not conversely"
- else if Id.List.mem y xge then
- pr_id x ++ str " depends on " ++ pr_id y ++ strbrk " but not conversely"
- else
- pr_id y ++ str " and " ++ pr_id x ++ strbrk " are not mutually dependent" in
- let e = if List.is_empty rest then reason else strbrk "e.g., " ++ reason in
- let k = if isfix then "fixpoint" else "cofixpoint" in
- let w =
- if isfix
- then strbrk "Well-foundedness check may fail unexpectedly." ++ fnl()
- else mt () in
- strbrk "Not a fully mutually defined " ++ str k ++ fnl () ++
- str "(" ++ e ++ str ")." ++ fnl () ++ w
-
-let warn_non_full_mutual =
- CWarnings.create ~name:"non-full-mutual" ~category:"fixpoints"
- (fun (x,xge,y,yge,isfix,rest) ->
- non_full_mutual_message x xge y yge isfix rest)
-
-let check_mutuality env evd isfix fixl =
- let names = List.map fst fixl in
- let preorder =
- List.map (fun (id,def) ->
- (id, List.filter (fun id' -> not (Id.equal id id') && occur_var env evd id' (EConstr.of_constr def)) names))
- fixl in
- let po = partial_order Id.equal preorder in
- match List.filter (function (_,Inr _) -> true | _ -> false) po with
- | (x,Inr xge)::(y,Inr yge)::rest ->
- warn_non_full_mutual (x,xge,y,yge,isfix,rest)
- | _ -> ()
-
-type structured_fixpoint_expr = {
- fix_name : Id.t;
- fix_univs : universe_decl_expr option;
- fix_annot : Id.t Loc.located option;
- fix_binders : local_binder_expr list;
- fix_body : constr_expr option;
- fix_type : constr_expr
-}
-
-let interp_fix_context env evdref isfix fix =
- let before, after = if isfix then split_at_annot fix.fix_binders fix.fix_annot else [], fix.fix_binders in
- let impl_env, ((env', ctx), imps) = interp_context_evars env evdref before in
- let impl_env', ((env'', ctx'), imps') = interp_context_evars ~impl_env ~shift:(Context.Rel.nhyps ctx) env' evdref after in
- let annot = Option.map (fun _ -> List.length (assums_of_rel_context ctx)) fix.fix_annot in
- ((env'', ctx' @ ctx), (impl_env',imps @ imps'), annot)
-
-let interp_fix_ccl evdref impls (env,_) fix =
- let (c, impl) = interp_type_evars_impls ~impls env evdref fix.fix_type in
- (c, impl)
-
-let interp_fix_body env_rec evdref impls (_,ctx) fix ccl =
- let open EConstr in
- Option.map (fun body ->
- let env = push_rel_context ctx env_rec in
- let body = interp_casted_constr_evars env evdref ~impls body ccl in
- it_mkLambda_or_LetIn body ctx) fix.fix_body
-
-let build_fix_type (_,ctx) ccl = EConstr.it_mkProd_or_LetIn ccl ctx
-
-let prepare_recursive_declaration fixnames fixtypes fixdefs =
- let defs = List.map (subst_vars (List.rev fixnames)) fixdefs in
- let names = List.map (fun id -> Name id) fixnames in
- (Array.of_list names, Array.of_list fixtypes, Array.of_list defs)
-
-(* Jump over let-bindings. *)
-
-let compute_possible_guardness_evidences (ctx,_,recindex) =
- (* A recursive index is characterized by the number of lambdas to
- skip before finding the relevant inductive argument *)
- match recindex with
- | Some i -> [i]
- | None ->
- (* If recursive argument was not given by user, we try all args.
- An earlier approach was to look only for inductive arguments,
- but doing it properly involves delta-reduction, and it finally
- doesn't seem to worth the effort (except for huge mutual
- fixpoints ?) *)
- List.interval 0 (Context.Rel.nhyps ctx - 1)
-
-type recursive_preentry =
- Id.t list * constr option list * types list
-
-(* Wellfounded definition *)
-
-open Coqlib
-
-let contrib_name = "Program"
-let subtac_dir = [contrib_name]
-let fixsub_module = subtac_dir @ ["Wf"]
-let tactics_module = subtac_dir @ ["Tactics"]
-
-let init_reference dir s () = Coqlib.coq_reference "Command" dir s
-let init_constant dir s evdref =
- let (sigma, c) = Evarutil.new_global !evdref (Coqlib.coq_reference "Command" dir s)
- in evdref := sigma; c
-
-let make_ref l s = init_reference l s
-let fix_proto = init_constant tactics_module "fix_proto"
-let fix_sub_ref = make_ref fixsub_module "Fix_sub"
-let measure_on_R_ref = make_ref fixsub_module "MR"
-let well_founded = init_constant ["Init"; "Wf"] "well_founded"
-let mkSubset evdref name typ prop =
- let open EConstr in
- mkApp (Evarutil.e_new_global evdref (delayed_force build_sigma).typ,
- [| typ; mkLambda (name, typ, prop) |])
-let sigT = Lazy.from_fun build_sigma_type
-
-let make_qref s = Qualid (Loc.tag @@ qualid_of_string s)
-let lt_ref = make_qref "Init.Peano.lt"
-
-let rec telescope evdref l =
- let open EConstr in
- let open Vars in
- match l with
- | [] -> assert false
- | [LocalAssum (n, t)] -> t, [LocalDef (n, mkRel 1, t)], mkRel 1
- | LocalAssum (n, t) :: tl ->
- let ty, tys, (k, constr) =
- List.fold_left
- (fun (ty, tys, (k, constr)) decl ->
- let t = RelDecl.get_type decl in
- let pred = mkLambda (RelDecl.get_name decl, t, ty) in
- let ty = Evarutil.e_new_global evdref (Lazy.force sigT).typ in
- let intro = Evarutil.e_new_global evdref (Lazy.force sigT).intro in
- let sigty = mkApp (ty, [|t; pred|]) in
- let intro = mkApp (intro, [|lift k t; lift k pred; mkRel k; constr|]) in
- (sigty, pred :: tys, (succ k, intro)))
- (t, [], (2, mkRel 1)) tl
- in
- let (last, subst) = List.fold_right2
- (fun pred decl (prev, subst) ->
- let t = RelDecl.get_type decl in
- let p1 = Evarutil.e_new_global evdref (Lazy.force sigT).proj1 in
- let p2 = Evarutil.e_new_global evdref (Lazy.force sigT).proj2 in
- let proj1 = applist (p1, [t; pred; prev]) in
- let proj2 = applist (p2, [t; pred; prev]) in
- (lift 1 proj2, LocalDef (get_name decl, proj1, t) :: subst))
- (List.rev tys) tl (mkRel 1, [])
- in ty, (LocalDef (n, last, t) :: subst), constr
-
- | LocalDef (n, b, t) :: tl -> let ty, subst, term = telescope evdref tl in
- ty, (LocalDef (n, b, t) :: subst), lift 1 term
-
-let nf_evar_context sigma ctx =
- List.map (map_constr (fun c -> Evarutil.nf_evar sigma c)) ctx
-
-let build_wellfounded (recname,pl,n,bl,arityc,body) poly r measure notation =
- let open EConstr in
- let open Vars in
- let lift_rel_context n l = Termops.map_rel_context_with_binders (liftn n) l in
- Coqlib.check_required_library ["Coq";"Program";"Wf"];
- let env = Global.env() in
- let evd, decl = Univdecls.interp_univ_decl_opt env pl in
- let evdref = ref evd in
- let _, ((env', binders_rel), impls) = interp_context_evars env evdref bl in
- let len = List.length binders_rel in
- let top_env = push_rel_context binders_rel env in
- let top_arity = interp_type_evars top_env evdref arityc in
- let full_arity = it_mkProd_or_LetIn top_arity binders_rel in
- let argtyp, letbinders, make = telescope evdref binders_rel in
- let argname = Id.of_string "recarg" in
- let arg = LocalAssum (Name argname, argtyp) in
- let binders = letbinders @ [arg] in
- let binders_env = push_rel_context binders_rel env in
- let rel, _ = interp_constr_evars_impls env evdref r in
- let relty = Typing.unsafe_type_of env !evdref rel in
- let relargty =
- let error () =
- user_err ?loc:(constr_loc r)
- ~hdr:"Command.build_wellfounded"
- (Printer.pr_econstr_env env !evdref rel ++ str " is not an homogeneous binary relation.")
- in
- try
- let ctx, ar = Reductionops.splay_prod_n env !evdref 2 relty in
- match ctx, EConstr.kind !evdref ar with
- | [LocalAssum (_,t); LocalAssum (_,u)], Sort s
- when Sorts.is_prop (ESorts.kind !evdref s) && Reductionops.is_conv env !evdref t u -> t
- | _, _ -> error ()
- with e when CErrors.noncritical e -> error ()
- in
- let relargty = EConstr.Unsafe.to_constr relargty in
- let measure = interp_casted_constr_evars binders_env evdref measure relargty in
- let wf_rel, wf_rel_fun, measure_fn =
- let measure_body, measure =
- it_mkLambda_or_LetIn measure letbinders,
- it_mkLambda_or_LetIn measure binders
- in
- let comb = Evarutil.e_new_global evdref (delayed_force measure_on_R_ref) in
- let relargty = EConstr.of_constr relargty in
- let wf_rel = mkApp (comb, [| argtyp; relargty; rel; measure |]) in
- let wf_rel_fun x y =
- mkApp (rel, [| subst1 x measure_body;
- subst1 y measure_body |])
- in wf_rel, wf_rel_fun, measure
- in
- let wf_proof = mkApp (well_founded evdref, [| argtyp ; wf_rel |]) in
- let argid' = Id.of_string (Id.to_string argname ^ "'") in
- let wfarg len = LocalAssum (Name argid',
- mkSubset evdref (Name argid') argtyp
- (wf_rel_fun (mkRel 1) (mkRel (len + 1))))
- in
- let intern_bl = wfarg 1 :: [arg] in
- let _intern_env = push_rel_context intern_bl env in
- let proj = Evarutil.e_new_global evdref (delayed_force build_sigma).Coqlib.proj1 in
- let wfargpred = mkLambda (Name argid', argtyp, wf_rel_fun (mkRel 1) (mkRel 3)) in
- let projection = (* in wfarg :: arg :: before *)
- mkApp (proj, [| argtyp ; wfargpred ; mkRel 1 |])
- in
- let top_arity_let = it_mkLambda_or_LetIn top_arity letbinders in
- let intern_arity = substl [projection] top_arity_let in
- (* substitute the projection of wfarg for something,
- now intern_arity is in wfarg :: arg *)
- let intern_fun_arity_prod = it_mkProd_or_LetIn intern_arity [wfarg 1] in
- let intern_fun_binder = LocalAssum (Name (add_suffix recname "'"), intern_fun_arity_prod) in
- let curry_fun =
- let wfpred = mkLambda (Name argid', argtyp, wf_rel_fun (mkRel 1) (mkRel (2 * len + 4))) in
- let intro = Evarutil.e_new_global evdref (delayed_force build_sigma).Coqlib.intro in
- let arg = mkApp (intro, [| argtyp; wfpred; lift 1 make; mkRel 1 |]) in
- let app = mkApp (mkRel (2 * len + 2 (* recproof + orig binders + current binders *)), [| arg |]) in
- let rcurry = mkApp (rel, [| measure; lift len measure |]) in
- let lam = LocalAssum (Name (Id.of_string "recproof"), rcurry) in
- let body = it_mkLambda_or_LetIn app (lam :: binders_rel) in
- let ty = it_mkProd_or_LetIn (lift 1 top_arity) (lam :: binders_rel) in
- LocalDef (Name recname, body, ty)
- in
- let fun_bl = intern_fun_binder :: [arg] in
- let lift_lets = lift_rel_context 1 letbinders in
- let intern_body =
- let ctx = LocalAssum (Name recname, get_type curry_fun) :: binders_rel in
- let (r, l, impls, scopes) =
- Constrintern.compute_internalization_data env
- Constrintern.Recursive (EConstr.Unsafe.to_constr full_arity) impls
- in
- let newimpls = Id.Map.singleton recname
- (r, l, impls @ [(Some (Id.of_string "recproof", Impargs.Manual, (true, false)))],
- scopes @ [None]) in
- interp_casted_constr_evars (push_rel_context ctx env) evdref
- ~impls:newimpls body (EConstr.Unsafe.to_constr (lift 1 top_arity))
- in
- let intern_body_lam = it_mkLambda_or_LetIn intern_body (curry_fun :: lift_lets @ fun_bl) in
- let prop = mkLambda (Name argname, argtyp, top_arity_let) in
- let def =
- mkApp (Evarutil.e_new_global evdref (delayed_force fix_sub_ref),
- [| argtyp ; wf_rel ;
- Evarutil.e_new_evar env evdref
- ~src:(Loc.tag @@ Evar_kinds.QuestionMark (Evar_kinds.Define false,Anonymous)) wf_proof;
- prop |])
- in
- let def = Typing.e_solve_evars env evdref def in
- let _ = evdref := Evarutil.nf_evar_map !evdref in
- let def = mkApp (def, [|intern_body_lam|]) in
- let binders_rel = nf_evar_context !evdref binders_rel in
- let binders = nf_evar_context !evdref binders in
- let top_arity = Evarutil.nf_evar !evdref top_arity in
- let pl, plext = Option.cata
- (fun d -> d.univdecl_instance, d.univdecl_extensible_instance) ([],true) pl in
- let hook, recname, typ =
- if List.length binders_rel > 1 then
- let name = add_suffix recname "_func" in
- let hook l gr _ =
- let body = it_mkLambda_or_LetIn (mkApp (Evarutil.e_new_global evdref gr, [|make|])) binders_rel in
- let ty = it_mkProd_or_LetIn top_arity binders_rel in
- let ty = EConstr.Unsafe.to_constr ty in
- let pl, univs = Evd.universe_context ~names:pl ~extensible:plext !evdref in
- (*FIXME poly? *)
- let ce = definition_entry ~poly ~types:ty ~univs (EConstr.to_constr !evdref body) in
- (** FIXME: include locality *)
- let c = Declare.declare_constant recname (DefinitionEntry ce, IsDefinition Definition) in
- let gr = ConstRef c in
- if Impargs.is_implicit_args () || not (List.is_empty impls) then
- Impargs.declare_manual_implicits false gr [impls]
- in
- let typ = it_mkProd_or_LetIn top_arity binders in
- hook, name, typ
- else
- let typ = it_mkProd_or_LetIn top_arity binders_rel in
- let hook l gr _ =
- if Impargs.is_implicit_args () || not (List.is_empty impls) then
- Impargs.declare_manual_implicits false gr [impls]
- in hook, recname, typ
- in
- let hook = Lemmas.mk_hook hook in
- let fullcoqc = EConstr.to_constr !evdref def in
- let fullctyp = EConstr.to_constr !evdref typ in
- Obligations.check_evars env !evdref;
- let evars, _, evars_def, evars_typ =
- Obligations.eterm_obligations env recname !evdref 0 fullcoqc fullctyp
- in
- let ctx = Evd.evar_universe_context !evdref in
- ignore(Obligations.add_definition recname ~term:evars_def ~univdecl:decl
- evars_typ ctx evars ~hook)
-
-let interp_recursive isfix fixl notations =
- let open Context.Named.Declaration in
- let open EConstr in
- let env = Global.env() in
- let fixnames = List.map (fun fix -> fix.fix_name) fixl in
-
- (* Interp arities allowing for unresolved types *)
- let all_universes =
- List.fold_right (fun sfe acc ->
- match sfe.fix_univs , acc with
- | None , acc -> acc
- | x , None -> x
- | Some ls , Some us ->
- let lsu = ls.univdecl_instance and usu = us.univdecl_instance in
- if not (CList.for_all2eq (fun x y -> Id.equal (snd x) (snd y)) lsu usu) then
- user_err Pp.(str "(co)-recursive definitions should all have the same universe binders");
- Some us) fixl None in
- let evd, decl = Univdecls.interp_univ_decl_opt env all_universes in
- let evdref = ref evd in
- let fixctxs, fiximppairs, fixannots =
- List.split3 (List.map (interp_fix_context env evdref isfix) fixl) in
- let fixctximpenvs, fixctximps = List.split fiximppairs in
- let fixccls,fixcclimps = List.split (List.map3 (interp_fix_ccl evdref) fixctximpenvs fixctxs fixl) in
- let fixtypes = List.map2 build_fix_type fixctxs fixccls in
- let fixtypes = List.map (fun c -> nf_evar !evdref c) fixtypes in
- let fiximps = List.map3
- (fun ctximps cclimps (_,ctx) -> ctximps@(Impargs.lift_implicits (Context.Rel.nhyps ctx) cclimps))
- fixctximps fixcclimps fixctxs in
- let rec_sign =
- List.fold_left2
- (fun env' id t ->
- if Flags.is_program_mode () then
- let sort = Evarutil.evd_comb1 (Typing.type_of ~refresh:true env) evdref t in
- let fixprot =
- try
- let app = mkApp (fix_proto evdref, [|sort; t|]) in
- Typing.e_solve_evars env evdref app
- with e when CErrors.noncritical e -> t
- in
- LocalAssum (id,fixprot) :: env'
- else LocalAssum (id,t) :: env')
- [] fixnames fixtypes
- in
- let env_rec = push_named_context rec_sign env in
-
- (* Get interpretation metadatas *)
- let fixtypes = List.map EConstr.Unsafe.to_constr fixtypes in
- let fixccls = List.map EConstr.Unsafe.to_constr fixccls in
- let impls = compute_internalization_env env Recursive fixnames fixtypes fiximps in
-
- (* Interp bodies with rollback because temp use of notations/implicit *)
- let fixdefs =
- Metasyntax.with_syntax_protection (fun () ->
- List.iter (Metasyntax.set_notation_for_interpretation env_rec impls) notations;
- List.map4
- (fun fixctximpenv -> interp_fix_body env_rec evdref (Id.Map.fold Id.Map.add fixctximpenv impls))
- fixctximpenvs fixctxs fixl fixccls)
- () in
-
- (* Instantiate evars and check all are resolved *)
- let evd = solve_unif_constraints_with_heuristics env_rec !evdref in
- let evd, nf = nf_evars_and_universes evd in
- let fixdefs = List.map (fun c -> Option.map EConstr.Unsafe.to_constr c) fixdefs in
- let fixdefs = List.map (Option.map nf) fixdefs in
- let fixtypes = List.map nf fixtypes in
- let fixctxs = List.map (fun (_,ctx) -> ctx) fixctxs in
-
- (* Build the fix declaration block *)
- (env,rec_sign,decl,evd), (fixnames,fixdefs,fixtypes), List.combine3 fixctxs fiximps fixannots
-
-let check_recursive isfix env evd (fixnames,fixdefs,_) =
- check_evars_are_solved env evd Evd.empty;
- if List.for_all Option.has_some fixdefs then begin
- let fixdefs = List.map Option.get fixdefs in
- check_mutuality env evd isfix (List.combine fixnames fixdefs)
- end
-
-let interp_fixpoint l ntns =
- let (env,_,pl,evd),fix,info = interp_recursive true l ntns in
- check_recursive true env evd fix;
- (fix,pl,Evd.evar_universe_context evd,info)
-
-let interp_cofixpoint l ntns =
- let (env,_,pl,evd),fix,info = interp_recursive false l ntns in
- check_recursive false env evd fix;
- (fix,pl,Evd.evar_universe_context evd,info)
-
-let declare_fixpoint local poly ((fixnames,fixdefs,fixtypes),pl,ctx,fiximps) indexes ntns =
- if List.exists Option.is_empty fixdefs then
- (* Some bodies to define by proof *)
- let thms =
- List.map3 (fun id t (ctx,imps,_) -> (id,(t,(List.map RelDecl.get_name ctx,imps))))
- fixnames fixtypes fiximps in
- let init_tac =
- Some (List.map (Option.cata (EConstr.of_constr %> Tactics.exact_no_check) Tacticals.New.tclIDTAC)
- fixdefs) in
- let evd = Evd.from_ctx ctx in
- Lemmas.start_proof_with_initialization (Global,poly,DefinitionBody Fixpoint)
- evd pl (Some(false,indexes,init_tac)) thms None (Lemmas.mk_hook (fun _ _ -> ()))
- else begin
- (* We shortcut the proof process *)
- let fixdefs = List.map Option.get fixdefs in
- let fixdecls = prepare_recursive_declaration fixnames fixtypes fixdefs in
- let env = Global.env() in
- let indexes = search_guard env indexes fixdecls in
- let fiximps = List.map (fun (n,r,p) -> r) fiximps in
- let vars = Univops.universes_of_constr (mkFix ((indexes,0),fixdecls)) in
- let fixdecls =
- List.map_i (fun i _ -> mkFix ((indexes,i),fixdecls)) 0 fixnames in
- let evd = Evd.from_ctx ctx in
- let evd = Evd.restrict_universe_context evd vars in
- let pl, ctx = Evd.check_univ_decl evd pl in
- let fixdecls = List.map Safe_typing.mk_pure_proof fixdecls in
- ignore (List.map4 (DeclareDef.declare_fix (local, poly, Fixpoint) pl ctx)
- fixnames fixdecls fixtypes fiximps);
- (* Declare the recursive definitions *)
- fixpoint_message (Some indexes) fixnames;
- end;
- (* Declare notations *)
- List.iter (Metasyntax.add_notation_interpretation (Global.env())) ntns
-
-let declare_cofixpoint local poly ((fixnames,fixdefs,fixtypes),pl,ctx,fiximps) ntns =
- if List.exists Option.is_empty fixdefs then
- (* Some bodies to define by proof *)
- let thms =
- List.map3 (fun id t (ctx,imps,_) -> (id,(t,(List.map RelDecl.get_name ctx,imps))))
- fixnames fixtypes fiximps in
- let init_tac =
- Some (List.map (Option.cata (EConstr.of_constr %> Tactics.exact_no_check) Tacticals.New.tclIDTAC)
- fixdefs) in
- let evd = Evd.from_ctx ctx in
- Lemmas.start_proof_with_initialization (Global,poly, DefinitionBody CoFixpoint)
- evd pl (Some(true,[],init_tac)) thms None (Lemmas.mk_hook (fun _ _ -> ()))
- else begin
- (* We shortcut the proof process *)
- let fixdefs = List.map Option.get fixdefs in
- let fixdecls = prepare_recursive_declaration fixnames fixtypes fixdefs in
- let fixdecls = List.map_i (fun i _ -> mkCoFix (i,fixdecls)) 0 fixnames in
- let vars = Univops.universes_of_constr (List.hd fixdecls) in
- let fixdecls = List.map Safe_typing.mk_pure_proof fixdecls in
- let fiximps = List.map (fun (len,imps,idx) -> imps) fiximps in
- let evd = Evd.from_ctx ctx in
- let evd = Evd.restrict_universe_context evd vars in
- let pl, ctx = Evd.check_univ_decl evd pl in
- ignore (List.map4 (DeclareDef.declare_fix (local, poly, CoFixpoint) pl ctx)
- fixnames fixdecls fixtypes fiximps);
- (* Declare the recursive definitions *)
- cofixpoint_message fixnames
- end;
- (* Declare notations *)
- List.iter (Metasyntax.add_notation_interpretation (Global.env())) ntns
-
-let extract_decreasing_argument limit = function
- | (na,CStructRec) -> na
- | (na,_) when not limit -> na
- | _ -> user_err Pp.(str
- "Only structural decreasing is supported for a non-Program Fixpoint")
-
-let extract_fixpoint_components limit l =
- let fixl, ntnl = List.split l in
- let fixl = List.map (fun (((_,id),pl),ann,bl,typ,def) ->
- let ann = extract_decreasing_argument limit ann in
- {fix_name = id; fix_annot = ann; fix_univs = pl;
- fix_binders = bl; fix_body = def; fix_type = typ}) fixl in
- fixl, List.flatten ntnl
-
-let extract_cofixpoint_components l =
- let fixl, ntnl = List.split l in
- List.map (fun (((_,id),pl),bl,typ,def) ->
- {fix_name = id; fix_annot = None; fix_univs = pl;
- fix_binders = bl; fix_body = def; fix_type = typ}) fixl,
- List.flatten ntnl
-
-let out_def = function
- | Some def -> def
- | None -> user_err Pp.(str "Program Fixpoint needs defined bodies.")
-
-let collect_evars_of_term evd c ty =
- let evars = Evar.Set.union (Evd.evars_of_term c) (Evd.evars_of_term ty) in
- Evar.Set.fold (fun ev acc -> Evd.add acc ev (Evd.find_undefined evd ev))
- evars (Evd.from_ctx (Evd.evar_universe_context evd))
-
-let do_program_recursive local p fixkind fixl ntns =
- let isfix = fixkind != Obligations.IsCoFixpoint in
- let (env, rec_sign, pl, evd), fix, info =
- interp_recursive isfix fixl ntns
- in
- (* Program-specific code *)
- (* Get the interesting evars, those that were not instanciated *)
- let evd = Typeclasses.resolve_typeclasses ~filter:Typeclasses.no_goals ~fail:true env evd in
- (* Solve remaining evars *)
- let evd = nf_evar_map_undefined evd in
- let collect_evars id def typ imps =
- (* Generalize by the recursive prototypes *)
- let def =
- EConstr.to_constr evd (Termops.it_mkNamedLambda_or_LetIn (EConstr.of_constr def) rec_sign)
- and typ =
- EConstr.to_constr evd (Termops.it_mkNamedProd_or_LetIn (EConstr.of_constr typ) rec_sign)
- in
- let evm = collect_evars_of_term evd def typ in
- let evars, _, def, typ =
- Obligations.eterm_obligations env id evm
- (List.length rec_sign) def typ
- in (id, def, typ, imps, evars)
- in
- let (fixnames,fixdefs,fixtypes) = fix in
- let fiximps = List.map pi2 info in
- let fixdefs = List.map out_def fixdefs in
- let defs = List.map4 collect_evars fixnames fixdefs fixtypes fiximps in
- let () = if isfix then begin
- let possible_indexes = List.map compute_possible_guardness_evidences info in
- let fixdecls = Array.of_list (List.map (fun x -> Name x) fixnames),
- Array.of_list fixtypes,
- Array.of_list (List.map (subst_vars (List.rev fixnames)) fixdefs)
- in
- let indexes =
- Pretyping.search_guard (Global.env ()) possible_indexes fixdecls in
- List.iteri (fun i _ ->
- Inductive.check_fix env
- ((indexes,i),fixdecls))
- fixl
- end in
- let ctx = Evd.evar_universe_context evd in
- let kind = match fixkind with
- | Obligations.IsFixpoint _ -> (local, p, Fixpoint)
- | Obligations.IsCoFixpoint -> (local, p, CoFixpoint)
- in
- Obligations.add_mutual_definitions defs ~kind ~univdecl:pl ctx ntns fixkind
-
-let do_program_fixpoint local poly l =
- let g = List.map (fun ((_,wf,_,_,_),_) -> wf) l in
- match g, l with
- | [(n, CWfRec r)], [((((_,id),pl),_,bl,typ,def),ntn)] ->
- let recarg =
- match n with
- | Some n -> mkIdentC (snd n)
- | None ->
- user_err ~hdr:"do_program_fixpoint"
- (str "Recursive argument required for well-founded fixpoints")
- in build_wellfounded (id, pl, n, bl, typ, out_def def) poly r recarg ntn
-
- | [(n, CMeasureRec (m, r))], [((((_,id),pl),_,bl,typ,def),ntn)] ->
- build_wellfounded (id, pl, n, bl, typ, out_def def) poly
- (Option.default (CAst.make @@ CRef (lt_ref,None)) r) m ntn
-
- | _, _ when List.for_all (fun (n, ro) -> ro == CStructRec) g ->
- let fixl,ntns = extract_fixpoint_components true l in
- let fixkind = Obligations.IsFixpoint g in
- do_program_recursive local poly fixkind fixl ntns
-
- | _, _ ->
- user_err ~hdr:"do_program_fixpoint"
- (str "Well-founded fixpoints not allowed in mutually recursive blocks")
-
-let check_safe () =
- let open Declarations in
- let flags = Environ.typing_flags (Global.env ()) in
- flags.check_universes && flags.check_guarded
-
-let do_fixpoint local poly l =
- if Flags.is_program_mode () then do_program_fixpoint local poly l
- else
- let fixl, ntns = extract_fixpoint_components true l in
- let (_, _, _, info as fix) = interp_fixpoint fixl ntns in
- let possible_indexes =
- List.map compute_possible_guardness_evidences info in
- declare_fixpoint local poly fix possible_indexes ntns;
- if not (check_safe ()) then Feedback.feedback Feedback.AddedAxiom else ()
-
-let do_cofixpoint local poly l =
- let fixl,ntns = extract_cofixpoint_components l in
- if Flags.is_program_mode () then
- do_program_recursive local poly Obligations.IsCoFixpoint fixl ntns
- else
- let cofix = interp_cofixpoint fixl ntns in
- declare_cofixpoint local poly cofix ntns;
- if not (check_safe ()) then Feedback.feedback Feedback.AddedAxiom else ()
diff --git a/vernac/command.mli b/vernac/command.mli
deleted file mode 100644
index afa97aa24..000000000
--- a/vernac/command.mli
+++ /dev/null
@@ -1,163 +0,0 @@
-(************************************************************************)
-(* v * The Coq Proof Assistant / The Coq Development Team *)
-(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *)
-(* \VV/ **************************************************************)
-(* // * This file is distributed under the terms of the *)
-(* * GNU Lesser General Public License Version 2.1 *)
-(************************************************************************)
-
-open Names
-open Term
-open Entries
-open Libnames
-open Globnames
-open Vernacexpr
-open Constrexpr
-open Decl_kinds
-open Redexpr
-
-(** This file is about the interpretation of raw commands into typed
- ones and top-level declaration of the main Gallina objects *)
-
-val do_universe : polymorphic -> Id.t Loc.located list -> unit
-val do_constraint : polymorphic ->
- (Misctypes.glob_level * Univ.constraint_type * Misctypes.glob_level) list -> unit
-
-(** {6 Definitions/Let} *)
-
-val interp_definition :
- Vernacexpr.universe_decl_expr option -> local_binder_expr list -> polymorphic -> red_expr option -> constr_expr ->
- constr_expr option -> Safe_typing.private_constants definition_entry * Evd.evar_map *
- Univdecls.universe_decl * Universes.universe_binders * Impargs.manual_implicits
-
-val do_definition : Id.t -> definition_kind -> Vernacexpr.universe_decl_expr option ->
- local_binder_expr list -> red_expr option -> constr_expr ->
- constr_expr option -> unit Lemmas.declaration_hook -> unit
-
-(** {6 Parameters/Assumptions} *)
-
-(* val interp_assumption : env -> evar_map ref -> *)
-(* local_binder_expr list -> constr_expr -> *)
-(* types Univ.in_universe_context_set * Impargs.manual_implicits *)
-
-(** returns [false] if the assumption is neither local to a section,
- nor in a module type and meant to be instantiated. *)
-val declare_assumption : coercion_flag -> assumption_kind ->
- types Univ.in_universe_context_set ->
- Universes.universe_binders -> Impargs.manual_implicits ->
- bool (** implicit *) -> Vernacexpr.inline -> variable Loc.located ->
- global_reference * Univ.Instance.t * bool
-
-val do_assumptions : locality * polymorphic * assumption_object_kind ->
- Vernacexpr.inline -> (Vernacexpr.ident_decl list * constr_expr) with_coercion list -> bool
-
-(* val declare_assumptions : variable Loc.located list -> *)
-(* coercion_flag -> assumption_kind -> types Univ.in_universe_context_set -> *)
-(* Impargs.manual_implicits -> bool -> Vernacexpr.inline -> bool *)
-
-(** {6 Inductive and coinductive types} *)
-
-(** Extracting the semantical components out of the raw syntax of mutual
- inductive declarations *)
-
-type structured_one_inductive_expr = {
- ind_name : Id.t;
- ind_univs : Vernacexpr.universe_decl_expr option;
- ind_arity : constr_expr;
- ind_lc : (Id.t * constr_expr) list
-}
-
-type structured_inductive_expr =
- local_binder_expr list * structured_one_inductive_expr list
-
-val extract_mutual_inductive_declaration_components :
- (one_inductive_expr * decl_notation list) list ->
- structured_inductive_expr * (*coercions:*) qualid list * decl_notation list
-
-(** Typing mutual inductive definitions *)
-
-type one_inductive_impls =
- Impargs.manual_implicits (** for inds *)*
- Impargs.manual_implicits list (** for constrs *)
-
-val interp_mutual_inductive :
- structured_inductive_expr -> decl_notation list -> cumulative_inductive_flag ->
- polymorphic -> private_flag -> Decl_kinds.recursivity_kind ->
- mutual_inductive_entry * Universes.universe_binders * one_inductive_impls list
-
-(** Registering a mutual inductive definition together with its
- associated schemes *)
-
-val declare_mutual_inductive_with_eliminations :
- mutual_inductive_entry -> Universes.universe_binders -> one_inductive_impls list ->
- mutual_inductive
-
-(** Entry points for the vernacular commands Inductive and CoInductive *)
-
-val do_mutual_inductive :
- (one_inductive_expr * decl_notation list) list -> cumulative_inductive_flag ->
- polymorphic -> private_flag -> Decl_kinds.recursivity_kind -> unit
-
-(** {6 Fixpoints and cofixpoints} *)
-
-type structured_fixpoint_expr = {
- fix_name : Id.t;
- fix_univs : Vernacexpr.universe_decl_expr option;
- fix_annot : Id.t Loc.located option;
- fix_binders : local_binder_expr list;
- fix_body : constr_expr option;
- fix_type : constr_expr
-}
-
-(** Extracting the semantical components out of the raw syntax of
- (co)fixpoints declarations *)
-
-val extract_fixpoint_components : bool ->
- (fixpoint_expr * decl_notation list) list ->
- structured_fixpoint_expr list * decl_notation list
-
-val extract_cofixpoint_components :
- (cofixpoint_expr * decl_notation list) list ->
- structured_fixpoint_expr list * decl_notation list
-
-(** Typing global fixpoints and cofixpoint_expr *)
-
-type recursive_preentry =
- Id.t list * constr option list * types list
-
-val interp_fixpoint :
- structured_fixpoint_expr list -> decl_notation list ->
- recursive_preentry * Univdecls.universe_decl * Evd.evar_universe_context *
- (EConstr.rel_context * Impargs.manual_implicits * int option) list
-
-val interp_cofixpoint :
- structured_fixpoint_expr list -> decl_notation list ->
- recursive_preentry * Univdecls.universe_decl * Evd.evar_universe_context *
- (EConstr.rel_context * Impargs.manual_implicits * int option) list
-
-(** Registering fixpoints and cofixpoints in the environment *)
-
-val declare_fixpoint :
- locality -> polymorphic ->
- recursive_preentry * Univdecls.universe_decl * Evd.evar_universe_context *
- (Context.Rel.t * Impargs.manual_implicits * int option) list ->
- Proof_global.lemma_possible_guards -> decl_notation list -> unit
-
-val declare_cofixpoint : locality -> polymorphic ->
- recursive_preentry * Univdecls.universe_decl * Evd.evar_universe_context *
- (Context.Rel.t * Impargs.manual_implicits * int option) list ->
- decl_notation list -> unit
-
-(** Entry points for the vernacular commands Fixpoint and CoFixpoint *)
-
-val do_fixpoint :
- (* When [false], assume guarded. *)
- locality -> polymorphic -> (fixpoint_expr * decl_notation list) list -> unit
-
-val do_cofixpoint :
- (* When [false], assume guarded. *)
- locality -> polymorphic -> (cofixpoint_expr * decl_notation list) list -> unit
-
-(** Utils *)
-
-val check_mutuality : Environ.env -> Evd.evar_map -> bool -> (Id.t * types) list -> unit
diff --git a/vernac/declareDef.ml b/vernac/declareDef.ml
index d7a4fcca3..dfac78c04 100644
--- a/vernac/declareDef.ml
+++ b/vernac/declareDef.ml
@@ -11,18 +11,17 @@ open Declare
open Entries
open Globnames
open Impargs
-open Nameops
let warn_definition_not_visible =
CWarnings.create ~name:"definition-not-visible" ~category:"implicits"
Pp.(fun ident ->
strbrk "Section definition " ++
- pr_id ident ++ strbrk " is not visible from current goals")
+ 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) ->
- pr_id id ++ strbrk " is declared as a local " ++ str kind)
+ Names.Id.print id ++ strbrk " is declared as a local " ++ str kind)
let get_locality id ~kind = function
| Discharge ->
@@ -37,7 +36,7 @@ let declare_global_definition ident ce local k pl imps =
let kn = declare_constant ident ~local (DefinitionEntry ce, IsDefinition k) in
let gr = ConstRef kn in
let () = maybe_declare_manual_implicits false gr imps in
- let () = Universes.register_universe_binders gr pl in
+ let () = Declare.declare_univ_binders gr pl in
let () = definition_message ident in
gr
@@ -50,6 +49,7 @@ let declare_definition ident (local, p, k) ce pl imps hook =
let () = definition_message ident in
let gr = VarRef ident in
let () = maybe_declare_manual_implicits false gr imps in
+ let () = Declare.declare_univ_binders gr pl in
let () = if Proof_global.there_are_pending_proofs () then
warn_definition_not_visible ident
in
@@ -58,7 +58,7 @@ let declare_definition ident (local, p, k) ce pl imps hook =
declare_global_definition ident ce local k pl imps in
Lemmas.call_hook fix_exn hook local r
-let declare_fix ?(opaque = false) (_,poly,_ as kind) pl ctx f ((def,_),eff) t imps =
- let ce = definition_entry ~opaque ~types:t ~poly ~univs:ctx ~eff def in
+let declare_fix ?(opaque = false) (_,poly,_ as kind) pl univs f ((def,_),eff) t imps =
+ let ce = definition_entry ~opaque ~types:t ~univs ~eff def in
declare_definition f kind ce pl imps (Lemmas.mk_hook (fun _ r -> r))
diff --git a/vernac/declareDef.mli b/vernac/declareDef.mli
index 5dea0ba27..55f7c7861 100644
--- a/vernac/declareDef.mli
+++ b/vernac/declareDef.mli
@@ -15,5 +15,8 @@ val declare_definition : Id.t -> definition_kind ->
Safe_typing.private_constants Entries.definition_entry -> Universes.universe_binders -> Impargs.manual_implicits ->
Globnames.global_reference Lemmas.declaration_hook -> Globnames.global_reference
-val declare_fix : ?opaque:bool -> definition_kind -> Universes.universe_binders -> Univ.universe_context -> Id.t ->
- Safe_typing.private_constants Entries.proof_output -> Constr.types -> Impargs.manual_implicits -> Globnames.global_reference
+val declare_fix : ?opaque:bool -> definition_kind ->
+ Universes.universe_binders -> Entries.constant_universes_entry ->
+ Id.t -> Safe_typing.private_constants Entries.proof_output ->
+ Constr.types -> Impargs.manual_implicits ->
+ Globnames.global_reference
diff --git a/vernac/explainErr.ml b/vernac/explainErr.ml
index 2178a7caa..d328ad0cf 100644
--- a/vernac/explainErr.ml
+++ b/vernac/explainErr.ml
@@ -75,8 +75,8 @@ let process_vernac_interp_error exn = match fst exn with
wrap_vernac_error exn (Himsg.explain_pattern_matching_error env sigma e)
| Tacred.ReductionTacticError e ->
wrap_vernac_error exn (Himsg.explain_reduction_tactic_error e)
- | Logic.RefinerError e ->
- wrap_vernac_error exn (Himsg.explain_refiner_error e)
+ | Logic.RefinerError (env, sigma, e) ->
+ wrap_vernac_error exn (Himsg.explain_refiner_error env sigma e)
| Nametab.GlobalizationError q ->
wrap_vernac_error exn
(str "The reference" ++ spc () ++ Libnames.pr_qualid q ++
diff --git a/vernac/himsg.ml b/vernac/himsg.ml
index 189c47aab..f00c1e604 100644
--- a/vernac/himsg.ml
+++ b/vernac/himsg.ml
@@ -11,7 +11,7 @@ open Util
open Names
open Nameops
open Namegen
-open Term
+open Constr
open Termops
open Indtypes
open Environ
@@ -83,18 +83,16 @@ let rec contract3' env sigma a b c = function
(** Ad-hoc reductions *)
-let j_nf_betaiotaevar sigma j =
+let j_nf_betaiotaevar env sigma j =
{ uj_val = j.uj_val;
- uj_type = Reductionops.nf_betaiota sigma j.uj_type }
+ uj_type = Reductionops.nf_betaiota env sigma j.uj_type }
-let jv_nf_betaiotaevar sigma jl =
- Array.map (fun j -> j_nf_betaiotaevar sigma j) jl
+let jv_nf_betaiotaevar env sigma jl =
+ Array.map (fun j -> j_nf_betaiotaevar env sigma j) jl
(** Printers *)
-let pr_lconstr c = quote (pr_lconstr c)
let pr_lconstr_env e s c = quote (pr_lconstr_env e s c)
-let pr_leconstr c = quote (pr_leconstr c)
let pr_leconstr_env e s c = quote (pr_leconstr_env e s c)
let pr_ljudge_env e s c = let v,t = pr_ljudge_env e s c in (quote v,quote t)
@@ -159,7 +157,7 @@ let pr_explicit env sigma t1 t2 =
let pr_db env i =
try
match env |> lookup_rel i |> get_name with
- | Name id -> pr_id id
+ | Name id -> Id.print id
| Anonymous -> str "<>"
with Not_found -> str "UNBOUND_REL_" ++ int i
@@ -169,7 +167,7 @@ let explain_unbound_rel env sigma n =
str "The reference " ++ int n ++ str " is free."
let explain_unbound_var env v =
- let var = pr_id v in
+ let var = Id.print v in
str "No such section variable or assumption: " ++ var ++ str "."
let explain_not_type env sigma j =
@@ -189,7 +187,7 @@ let explain_bad_assumption env sigma j =
let explain_reference_variables sigma id c =
(* c is intended to be a global reference *)
let pc = pr_global (fst (Termops.global_of_constr sigma c)) in
- pc ++ strbrk " depends on the variable " ++ pr_id id ++
+ pc ++ strbrk " depends on the variable " ++ Id.print id ++
strbrk " which is not declared in the context."
let rec pr_disjunction pr = function
@@ -260,7 +258,7 @@ let explain_number_branches env sigma cj expn =
str "expects " ++ int expn ++ str " branches."
let explain_ill_formed_branch env sigma c ci actty expty =
- let simp t = Reductionops.nf_betaiota sigma t in
+ let simp t = Reductionops.nf_betaiota env sigma t in
let env = make_all_name_different env sigma in
let pc = pr_leconstr_env env sigma c in
let pa, pe = pr_explicit env sigma (simp actty) (simp expty) in
@@ -297,8 +295,8 @@ let explain_unification_error env sigma p1 p2 = function
| NotSameArgSize | NotSameHead | NoCanonicalStructure ->
(* Error speaks from itself *) []
| ConversionFailed (env,t1,t2) ->
- let t1 = Reductionops.nf_betaiota sigma t1 in
- let t2 = Reductionops.nf_betaiota sigma t2 in
+ let t1 = Reductionops.nf_betaiota env sigma t1 in
+ let t2 = Reductionops.nf_betaiota env sigma t2 in
if EConstr.eq_constr sigma t1 p1 && EConstr.eq_constr sigma t2 p2 then [] else
let env = make_all_name_different env sigma in
if not (EConstr.eq_constr sigma t1 p1) || not (EConstr.eq_constr sigma t2 p2) then
@@ -338,8 +336,8 @@ let explain_unification_error env sigma p1 p2 = function
let explain_actual_type env sigma j t reason =
let env = make_all_name_different env sigma in
- let j = j_nf_betaiotaevar sigma j in
- let t = Reductionops.nf_betaiota sigma t in
+ let j = j_nf_betaiotaevar env sigma j in
+ let t = Reductionops.nf_betaiota env sigma t in
(** Actually print *)
let pe = pr_ne_context_of (str "In environment") env sigma in
let pc = pr_leconstr_env env sigma (Environ.j_val j) in
@@ -353,8 +351,8 @@ let explain_actual_type env sigma j t reason =
ppreason ++ str ".")
let explain_cant_apply_bad_type env sigma (n,exptyp,actualtyp) rator randl =
- let randl = jv_nf_betaiotaevar sigma randl in
- let actualtyp = Reductionops.nf_betaiota sigma actualtyp in
+ let randl = jv_nf_betaiotaevar env sigma randl in
+ let actualtyp = Reductionops.nf_betaiota env sigma actualtyp in
let env = make_all_name_different env sigma in
let actualtyp, exptyp = pr_explicit env sigma actualtyp exptyp in
let nargs = Array.length randl in
@@ -407,7 +405,7 @@ let explain_not_product env sigma c =
let pr = pr_lconstr_env env sigma c in
str "The type of this term is a product" ++ spc () ++
str "while it is expected to be" ++
- (if Term.is_Type c then str " a sort" else (brk(1,1) ++ pr)) ++ str "."
+ (if Constr.is_Type c then str " a sort" else (brk(1,1) ++ pr)) ++ str "."
(* TODO: use the names *)
(* (co)fixpoints *)
@@ -415,7 +413,7 @@ let explain_ill_formed_rec_body env sigma err names i fixenv vdefj =
let pr_lconstr_env env sigma c = pr_leconstr_env env sigma c in
let prt_name i =
match names.(i) with
- Name id -> str "Recursive definition of " ++ pr_id id
+ Name id -> str "Recursive definition of " ++ Id.print id
| Anonymous -> str "The " ++ pr_nth i ++ str " definition" in
let st = match err with
@@ -430,7 +428,7 @@ let explain_ill_formed_rec_body env sigma err names i fixenv vdefj =
let arg_env = make_all_name_different arg_env sigma in
let called =
match names.(j) with
- Name id -> pr_id id
+ Name id -> Id.print id
| Anonymous -> str "the " ++ pr_nth i ++ str " definition" in
let pr_db x = quote (pr_db env x) in
let vars =
@@ -450,7 +448,7 @@ let explain_ill_formed_rec_body env sigma err names i fixenv vdefj =
| NotEnoughArgumentsForFixCall j ->
let called =
match names.(j) with
- Name id -> pr_id id
+ Name id -> Id.print id
| Anonymous -> str "the " ++ pr_nth i ++ str " definition" in
str "Recursive call to " ++ called ++ str " has not enough arguments"
@@ -528,7 +526,7 @@ let pr_trailing_ne_context_of env sigma =
let rec explain_evar_kind env sigma evk ty = function
| Evar_kinds.NamedHole id ->
- strbrk "the existential variable named " ++ pr_id id
+ strbrk "the existential variable named " ++ Id.print id
| Evar_kinds.QuestionMark _ ->
strbrk "this placeholder of type " ++ ty
| Evar_kinds.CasesType false ->
@@ -537,12 +535,12 @@ let rec explain_evar_kind env sigma evk ty = function
strbrk "a subterm of type " ++ ty ++
strbrk " in the type of this pattern-matching problem"
| Evar_kinds.BinderType (Name id) ->
- strbrk "the type of " ++ Nameops.pr_id id
+ strbrk "the type of " ++ Id.print id
| Evar_kinds.BinderType Anonymous ->
strbrk "the type of this anonymous binder"
| Evar_kinds.ImplicitArg (c,(n,ido),b) ->
let id = Option.get ido in
- strbrk "the implicit parameter " ++ pr_id id ++ spc () ++ str "of" ++
+ strbrk "the implicit parameter " ++ Id.print id ++ spc () ++ str "of" ++
spc () ++ Nametab.pr_global_env Id.Set.empty c ++
strbrk " whose type is " ++ ty
| Evar_kinds.InternalHole -> strbrk "an internal placeholder of type " ++ ty
@@ -558,7 +556,7 @@ let rec explain_evar_kind env sigma evk ty = function
assert false
| Evar_kinds.VarInstance id ->
strbrk "an instance of type " ++ ty ++
- str " for the variable " ++ pr_id id
+ str " for the variable " ++ Id.print id
| Evar_kinds.SubEvar evk' ->
let evi = Evd.find sigma evk' in
let pc = match evi.evar_body with
@@ -598,7 +596,7 @@ let explain_unsolvable_implicit env sigma evk explain =
explain_placeholder_kind env sigma evi.evar_concl explain ++ pe
let explain_var_not_found env id =
- str "The variable" ++ spc () ++ pr_id id ++
+ str "The variable" ++ spc () ++ Id.print id ++
spc () ++ str "was not found" ++
spc () ++ str "in the current" ++ spc () ++ str "environment" ++ str "."
@@ -638,7 +636,7 @@ let explain_no_occurrence_found env sigma c id =
str "Found no subterm matching " ++ pr_lconstr_env env sigma c ++
str " in " ++
(match id with
- | Some id -> pr_id id
+ | Some id -> Id.print id
| None -> str"the current goal") ++ str "."
let explain_cannot_unify_binding_type env sigma m n =
@@ -660,7 +658,7 @@ let explain_wrong_abstraction_type env sigma na abs expected result =
let abs = EConstr.to_constr sigma abs in
let expected = EConstr.to_constr sigma expected in
let result = EConstr.to_constr sigma result in
- let ppname = match na with Name id -> pr_id id ++ spc () | _ -> mt () in
+ let ppname = match na with Name id -> Id.print id ++ spc () | _ -> mt () in
str "Cannot instantiate metavariable " ++ ppname ++ strbrk "of type " ++
pr_lconstr_env env sigma expected ++ strbrk " with abstraction " ++
pr_lconstr_env env sigma abs ++ strbrk " of incompatible type " ++
@@ -723,9 +721,9 @@ let explain_type_error env sigma err =
let pr_position (cl,pos) =
let clpos = match cl with
| None -> str " of the goal"
- | Some (id,Locus.InHyp) -> str " of hypothesis " ++ pr_id id
- | Some (id,Locus.InHypTypeOnly) -> str " of the type of hypothesis " ++ pr_id id
- | Some (id,Locus.InHypValueOnly) -> str " of the body of hypothesis " ++ pr_id id in
+ | Some (id,Locus.InHyp) -> str " of hypothesis " ++ Id.print id
+ | Some (id,Locus.InHypTypeOnly) -> str " of the type of hypothesis " ++ Id.print id
+ | Some (id,Locus.InHypValueOnly) -> str " of the body of hypothesis " ++ Id.print id in
int pos ++ clpos
let explain_cannot_unify_occurrences env sigma nested ((cl2,pos2),t2) ((cl1,pos1),t1) e =
@@ -844,7 +842,7 @@ let explain_not_match_error = function
| ModuleTypeFieldExpected ->
strbrk "a module type is expected"
| NotConvertibleInductiveField id | NotConvertibleConstructorField id ->
- str "types given to " ++ pr_id id ++ str " differ"
+ str "types given to " ++ Id.print id ++ str " differ"
| NotConvertibleBodyField ->
str "the body of definitions differs"
| NotConvertibleTypeField (env, typ1, typ2) ->
@@ -869,7 +867,7 @@ let explain_not_match_error = function
| RecordProjectionsExpected nal ->
(if List.length nal >= 2 then str "expected projection names are "
else str "expected projection name is ") ++
- pr_enum (function Name id -> pr_id id | _ -> str "_") nal
+ pr_enum (function Name id -> Id.print id | _ -> str "_") nal
| NotEqualInductiveAliases ->
str "Aliases to inductive types do not match"
| NoTypeConstraintExpected ->
@@ -899,11 +897,11 @@ let explain_not_match_error = function
quote (Univ.pr_constraints (Termops.pr_evd_level Evd.empty) cst)
let explain_signature_mismatch l spec why =
- str "Signature components for label " ++ pr_label l ++
+ str "Signature components for label " ++ Label.print l ++
str " do not match:" ++ spc () ++ explain_not_match_error why ++ str "."
let explain_label_already_declared l =
- str "The label " ++ pr_label l ++ str " is already declared."
+ str "The label " ++ Label.print l ++ str " is already declared."
let explain_application_to_not_path _ =
strbrk "A module cannot be applied to another module application or " ++
@@ -933,11 +931,11 @@ let explain_not_equal_module_paths mp1 mp2 =
str "Non equal modules."
let explain_no_such_label l =
- str "No such label " ++ pr_label l ++ str "."
+ str "No such label " ++ Label.print l ++ str "."
let explain_incompatible_labels l l' =
str "Opening and closing labels are not the same: " ++
- pr_label l ++ str " <> " ++ pr_label l' ++ str "!"
+ Label.print l ++ str " <> " ++ Label.print l' ++ str "!"
let explain_not_a_module s =
quote (str s) ++ str " is not a module."
@@ -946,19 +944,19 @@ let explain_not_a_module_type s =
quote (str s) ++ str " is not a module type."
let explain_not_a_constant l =
- quote (pr_label l) ++ str " is not a constant."
+ quote (Label.print l) ++ str " is not a constant."
let explain_incorrect_label_constraint l =
str "Incorrect constraint for label " ++
- quote (pr_label l) ++ str "."
+ quote (Label.print l) ++ str "."
let explain_generative_module_expected l =
- str "The module " ++ pr_label l ++ str " is not generative." ++
+ str "The module " ++ Label.print l ++ str " is not generative." ++
strbrk " Only components of generative modules can be changed" ++
strbrk " using the \"with\" construct."
let explain_label_missing l s =
- str "The field " ++ pr_label l ++ str " is missing in "
+ str "The field " ++ Label.print l ++ str " is missing in "
++ str s ++ str "."
let explain_include_restricted_functor mp =
@@ -1016,7 +1014,7 @@ let explain_not_a_class env c =
pr_constr_env env Evd.empty c ++ str" is not a declared type class."
let explain_unbound_method env cid id =
- str "Unbound method name " ++ Nameops.pr_id (snd id) ++ spc () ++
+ str "Unbound method name " ++ Id.print (snd id) ++ spc () ++
str"of class" ++ spc () ++ pr_global cid ++ str "."
let pr_constr_exprs exprs =
@@ -1037,52 +1035,52 @@ let explain_typeclass_error env = function
(* Refiner errors *)
-let explain_refiner_bad_type arg ty conclty =
+let explain_refiner_bad_type env sigma arg ty conclty =
str "Refiner was given an argument" ++ brk(1,1) ++
- pr_lconstr arg ++ spc () ++
- str "of type" ++ brk(1,1) ++ pr_lconstr ty ++ spc () ++
- str "instead of" ++ brk(1,1) ++ pr_lconstr conclty ++ str "."
+ pr_lconstr_env env sigma arg ++ spc () ++
+ str "of type" ++ brk(1,1) ++ pr_lconstr_env env sigma ty ++ spc () ++
+ str "instead of" ++ brk(1,1) ++ pr_lconstr_env env sigma conclty ++ str "."
let explain_refiner_unresolved_bindings l =
str "Unable to find an instance for the " ++
str (String.plural (List.length l) "variable") ++ spc () ++
prlist_with_sep pr_comma Name.print l ++ str"."
-let explain_refiner_cannot_apply t harg =
+let explain_refiner_cannot_apply env sigma t harg =
str "In refiner, a term of type" ++ brk(1,1) ++
- pr_lconstr t ++ spc () ++ str "could not be applied to" ++ brk(1,1) ++
- pr_lconstr harg ++ str "."
+ pr_lconstr_env env sigma t ++ spc () ++ str "could not be applied to" ++ brk(1,1) ++
+ pr_lconstr_env env sigma harg ++ str "."
-let explain_refiner_not_well_typed c =
- str "The term " ++ pr_lconstr c ++ str " is not well-typed."
+let explain_refiner_not_well_typed env sigma c =
+ str "The term " ++ pr_lconstr_env env sigma c ++ str " is not well-typed."
let explain_intro_needs_product () =
str "Introduction tactics needs products."
-let explain_does_not_occur_in c hyp =
- str "The term" ++ spc () ++ pr_lconstr c ++ spc () ++
- str "does not occur in" ++ spc () ++ pr_id hyp ++ str "."
+let explain_does_not_occur_in env sigma c hyp =
+ str "The term" ++ spc () ++ pr_lconstr_env env sigma c ++ spc () ++
+ str "does not occur in" ++ spc () ++ Id.print hyp ++ str "."
-let explain_non_linear_proof c =
- str "Cannot refine with term" ++ brk(1,1) ++ pr_lconstr c ++
+let explain_non_linear_proof env sigma c =
+ str "Cannot refine with term" ++ brk(1,1) ++ pr_lconstr_env env sigma c ++
spc () ++ str "because a metavariable has several occurrences."
-let explain_meta_in_type c =
- str "In refiner, a meta appears in the type " ++ brk(1,1) ++ pr_leconstr c ++
+let explain_meta_in_type env sigma c =
+ str "In refiner, a meta appears in the type " ++ brk(1,1) ++ pr_leconstr_env env sigma c ++
str " of another meta"
let explain_no_such_hyp id =
- str "No such hypothesis: " ++ pr_id id
+ str "No such hypothesis: " ++ Id.print id
-let explain_refiner_error = function
- | BadType (arg,ty,conclty) -> explain_refiner_bad_type arg ty conclty
+let explain_refiner_error env sigma = function
+ | BadType (arg,ty,conclty) -> explain_refiner_bad_type env sigma arg ty conclty
| UnresolvedBindings t -> explain_refiner_unresolved_bindings t
- | CannotApply (t,harg) -> explain_refiner_cannot_apply t harg
- | NotWellTyped c -> explain_refiner_not_well_typed c
+ | CannotApply (t,harg) -> explain_refiner_cannot_apply env sigma t harg
+ | NotWellTyped c -> explain_refiner_not_well_typed env sigma c
| IntroNeedsProduct -> explain_intro_needs_product ()
- | DoesNotOccurIn (c,hyp) -> explain_does_not_occur_in c hyp
- | NonLinearProof c -> explain_non_linear_proof c
- | MetaInType c -> explain_meta_in_type c
+ | DoesNotOccurIn (c,hyp) -> explain_does_not_occur_in env sigma c hyp
+ | NonLinearProof c -> explain_non_linear_proof env sigma c
+ | MetaInType c -> explain_meta_in_type env sigma c
| NoSuchHyp id -> explain_no_such_hyp id
(* Inductive errors *)
@@ -1102,7 +1100,7 @@ let error_ill_formed_inductive env c v =
let error_ill_formed_constructor env id c v nparams nargs =
let pv = pr_lconstr_env env Evd.empty v in
let atomic = Int.equal (nb_prod Evd.empty (EConstr.of_constr c)) (** FIXME *) 0 in
- str "The type of constructor" ++ brk(1,1) ++ pr_id id ++ brk(1,1) ++
+ str "The type of constructor" ++ brk(1,1) ++ Id.print id ++ brk(1,1) ++
str "is not valid;" ++ brk(1,1) ++
strbrk (if atomic then "it must be " else "its conclusion must be ") ++
pv ++
@@ -1130,17 +1128,17 @@ let error_bad_ind_parameters env c n v1 v2 =
str " as " ++ pr_nth n ++ str " argument in" ++ brk(1,1) ++ pc ++ str "."
let error_same_names_types id =
- str "The name" ++ spc () ++ pr_id id ++ spc () ++
+ str "The name" ++ spc () ++ Id.print id ++ spc () ++
str "is used more than once."
let error_same_names_constructors id =
- str "The constructor name" ++ spc () ++ pr_id id ++ spc () ++
+ str "The constructor name" ++ spc () ++ Id.print id ++ spc () ++
str "is used more than once."
let error_same_names_overlap idl =
strbrk "The following names are used both as type names and constructor " ++
str "names:" ++ spc () ++
- prlist_with_sep pr_comma pr_id idl ++ str "."
+ prlist_with_sep pr_comma Id.print idl ++ str "."
let error_not_an_arity env c =
str "The type" ++ spc () ++ pr_lconstr_env env Evd.empty c ++ spc () ++
diff --git a/vernac/himsg.mli b/vernac/himsg.mli
index 5b91f9e68..8945ebadb 100644
--- a/vernac/himsg.mli
+++ b/vernac/himsg.mli
@@ -27,7 +27,7 @@ val explain_typeclass_error : env -> typeclass_error -> Pp.t
val explain_recursion_scheme_error : recursion_scheme_error -> Pp.t
-val explain_refiner_error : refiner_error -> Pp.t
+val explain_refiner_error : env -> Evd.evar_map -> refiner_error -> Pp.t
val explain_pattern_matching_error :
env -> Evd.evar_map -> pattern_matching_error -> Pp.t
diff --git a/vernac/indschemes.ml b/vernac/indschemes.ml
index 90168843a..2f4c95aff 100644
--- a/vernac/indschemes.ml
+++ b/vernac/indschemes.ml
@@ -21,6 +21,7 @@ open Names
open Declarations
open Entries
open Term
+open Constr
open Inductive
open Decl_kinds
open Indrec
@@ -108,10 +109,10 @@ let _ =
let define id internal ctx c t =
let f = declare_constant ~internal in
- let _, univs = Evd.universe_context ~names:[] ~extensible:true ctx in
let univs =
- if Flags.is_universe_polymorphism () then Polymorphic_const_entry univs
- else Monomorphic_const_entry univs
+ if Flags.is_universe_polymorphism ()
+ then Polymorphic_const_entry (Evd.to_universe_context ctx)
+ else Monomorphic_const_entry (Evd.universe_context_set ctx)
in
let kn = f id
(DefinitionEntry
@@ -257,7 +258,7 @@ let declare_one_induction_scheme ind =
let declare_induction_schemes kn =
let mib = Global.lookup_mind kn in
- if mib.mind_finite <> Decl_kinds.CoFinite then begin
+ if mib.mind_finite <> Declarations.CoFinite then begin
for i = 0 to Array.length mib.mind_packets - 1 do
declare_one_induction_scheme (kn,i);
done;
@@ -267,7 +268,7 @@ let declare_induction_schemes kn =
let declare_eq_decidability_gen internal names kn =
let mib = Global.lookup_mind kn in
- if mib.mind_finite <> Decl_kinds.CoFinite then
+ if mib.mind_finite <> Declarations.CoFinite then
ignore (define_mutual_scheme eq_dec_scheme_kind internal names kn)
let eq_dec_scheme_msg ind = (* TODO: mutual inductive case *)
@@ -407,7 +408,7 @@ let do_mutual_induction_scheme lnamedepindsort =
let get_common_underlying_mutual_inductive = function
| [] -> assert false
| (id,(mind,i as ind))::l as all ->
- match List.filter (fun (_,(mind',_)) -> not (eq_mind mind mind')) l with
+ match List.filter (fun (_,(mind',_)) -> not (MutInd.equal mind mind')) l with
| (_,ind')::_ ->
raise (RecursionSchemeError (NotMutualInScheme (ind,ind')))
| [] ->
@@ -458,7 +459,7 @@ let build_combined_scheme env schemes =
let find_inductive ty =
let (ctx, arity) = decompose_prod ty in
let (_, last) = List.hd ctx in
- match kind_of_term last with
+ match Constr.kind last with
| App (ind, args) ->
let ind = destInd ind in
let (_,spec) = Inductive.lookup_mind_specif env (fst ind) in
@@ -511,7 +512,7 @@ let map_inductive_block f kn n = for i=0 to n-1 do f (kn,i) done
let declare_default_schemes kn =
let mib = Global.lookup_mind kn in
let n = Array.length mib.mind_packets in
- if !elim_flag && (mib.mind_finite <> BiFinite || !bifinite_elim_flag)
+ if !elim_flag && (mib.mind_finite <> Declarations.BiFinite || !bifinite_elim_flag)
&& mib.mind_typing_flags.check_guarded then
declare_induction_schemes kn;
if !case_flag then map_inductive_block declare_one_case_analysis_scheme kn n;
diff --git a/vernac/indschemes.mli b/vernac/indschemes.mli
index 91c4c5825..4b31389ab 100644
--- a/vernac/indschemes.mli
+++ b/vernac/indschemes.mli
@@ -8,7 +8,7 @@
open Loc
open Names
-open Term
+open Constr
open Environ
open Vernacexpr
@@ -16,9 +16,9 @@ open Vernacexpr
(** Build and register the boolean equalities associated to an inductive type *)
-val declare_beq_scheme : mutual_inductive -> unit
+val declare_beq_scheme : MutInd.t -> unit
-val declare_eq_decidability : mutual_inductive -> unit
+val declare_eq_decidability : MutInd.t -> unit
(** Build and register a congruence scheme for an equality-like inductive type *)
@@ -39,10 +39,10 @@ val do_scheme : (Id.t located option * scheme) list -> unit
(** Combine a list of schemes into a conjunction of them *)
-val build_combined_scheme : env -> constant list -> Evd.evar_map * constr * types
+val build_combined_scheme : env -> Constant.t list -> Evd.evar_map * constr * types
val do_combined_scheme : Id.t located -> Id.t located list -> unit
(** Hook called at each inductive type definition *)
-val declare_default_schemes : mutual_inductive -> unit
+val declare_default_schemes : MutInd.t -> unit
diff --git a/vernac/lemmas.ml b/vernac/lemmas.ml
index dbf7fec66..57436784b 100644
--- a/vernac/lemmas.ml
+++ b/vernac/lemmas.ml
@@ -13,11 +13,10 @@ open CErrors
open Util
open Pp
open Names
-open Term
+open Constr
open Declarations
open Declareops
open Entries
-open Environ
open Nameops
open Globnames
open Decls
@@ -48,7 +47,8 @@ let retrieve_first_recthm uctx = function
(NamedDecl.get_value (Global.lookup_named id),variable_opacity id)
| ConstRef cst ->
let cb = Global.lookup_constant cst in
- let (_, uctx) = UState.universe_context ~names:[] ~extensible:true uctx in
+ (* we get the right order somehow but surely it could be enforced in a better way *)
+ let uctx = UState.context uctx in
let inst = Univ.UContext.instance uctx in
let map (c, ctx) = Vars.subst_instance_constr inst c in
(Option.map map (Global.body_of_constant_body cb), is_opaque cb)
@@ -62,7 +62,7 @@ let adjust_guardness_conditions const = function
{ const with const_entry_body =
Future.chain const.const_entry_body
(fun ((body, ctx), eff) ->
- match kind_of_term body with
+ match Constr.kind body with
| Fix ((nv,0),(_,_,fixdefs as fixdecls)) ->
(* let possible_indexes =
List.map2 (fun i c -> match i with Some i -> i | None ->
@@ -86,37 +86,37 @@ let adjust_guardness_conditions const = function
(mkFix ((indexes,0),fixdecls), ctx), eff
| _ -> (body, ctx), eff) }
-let find_mutually_recursive_statements thms =
+let find_mutually_recursive_statements sigma thms =
let n = List.length thms in
let inds = List.map (fun (id,(t,impls)) ->
- let (hyps,ccl) = decompose_prod_assum t in
+ let (hyps,ccl) = EConstr.decompose_prod_assum sigma t in
let x = (id,(t,impls)) in
- let whnf_hyp_hds = map_rel_context_in_env
- (fun env c -> EConstr.Unsafe.to_constr (fst (whd_all_stack env Evd.empty (EConstr.of_constr c))))
+ let whnf_hyp_hds = EConstr.map_rel_context_in_env
+ (fun env c -> fst (Reductionops.whd_all_stack env sigma c))
(Global.env()) hyps in
let ind_hyps =
List.flatten (List.map_i (fun i decl ->
let t = RelDecl.get_type decl in
- match kind_of_term t with
+ match EConstr.kind sigma t with
| Ind ((kn,_ as ind),u) when
let mind = Global.lookup_mind kn in
- mind.mind_finite <> Decl_kinds.CoFinite ->
+ mind.mind_finite <> Declarations.CoFinite ->
[ind,x,i]
| _ ->
- []) 0 (List.rev (List.filter RelDecl.is_local_assum whnf_hyp_hds))) in
+ []) 0 (List.rev (List.filter Context.Rel.Declaration.is_local_assum whnf_hyp_hds))) in
let ind_ccl =
- let cclenv = push_rel_context hyps (Global.env()) in
- let whnf_ccl,_ = whd_all_stack cclenv Evd.empty (EConstr.of_constr ccl) in
- match kind_of_term (EConstr.Unsafe.to_constr whnf_ccl) with
+ let cclenv = EConstr.push_rel_context hyps (Global.env()) in
+ let whnf_ccl,_ = whd_all_stack cclenv Evd.empty ccl in
+ match EConstr.kind sigma whnf_ccl with
| Ind ((kn,_ as ind),u) when
let mind = Global.lookup_mind kn in
- Int.equal mind.mind_ntypes n && mind.mind_finite == Decl_kinds.CoFinite ->
+ Int.equal mind.mind_ntypes n && mind.mind_finite == Declarations.CoFinite ->
[ind,x,0]
| _ ->
[] in
ind_hyps,ind_ccl) thms in
let inds_hyps,ind_ccls = List.split inds in
- let of_same_mutind ((kn,_),_,_) = function ((kn',_),_,_) -> eq_mind kn kn' in
+ let of_same_mutind ((kn,_),_,_) = function ((kn',_),_,_) -> MutInd.equal kn kn' in
(* Check if all conclusions are coinductive in the same type *)
(* (degenerated cartesian product since there is at most one coind ccl) *)
let same_indccl =
@@ -161,21 +161,21 @@ let find_mutually_recursive_statements thms =
in
(finite,guard,None), ordered_inds
-let look_for_possibly_mutual_statements = function
+let look_for_possibly_mutual_statements sigma = function
| [id,(t,impls)] ->
(* One non recursively proved theorem *)
None,[id,(t,impls)],None
| _::_ as thms ->
(* More than one statement and/or an explicit decreasing mark: *)
(* we look for a common inductive hyp or a common coinductive conclusion *)
- let recguard,ordered_inds = find_mutually_recursive_statements thms in
+ let recguard,ordered_inds = find_mutually_recursive_statements sigma thms in
let thms = List.map pi2 ordered_inds in
Some recguard,thms, Some (List.map (fun (_,_,i) -> succ i) ordered_inds)
| [] -> anomaly (Pp.str "Empty list of theorems.")
(* Saving a goal *)
-let save ?export_seff id const cstrs pl do_guard (locality,poly,kind) hook =
+let save ?export_seff id const uctx do_guard (locality,poly,kind) hook =
let fix_exn = Future.fix_exn_of const.Entries.const_entry_body in
try
let const = adjust_guardness_conditions const do_guard in
@@ -202,7 +202,7 @@ let save ?export_seff id const cstrs pl do_guard (locality,poly,kind) hook =
(locality, ConstRef kn)
in
definition_message id;
- Option.iter (Universes.register_universe_binders r) pl;
+ Declare.declare_univ_binders r (UState.universe_binders uctx);
call_hook (fun exn -> exn) hook l r
with e when CErrors.noncritical e ->
let e = CErrors.push e in
@@ -210,19 +210,18 @@ let save ?export_seff id const cstrs pl do_guard (locality,poly,kind) hook =
let default_thm_id = Id.of_string "Unnamed_thm"
-let compute_proof_name locality = function
- | Some ((loc,id),pl) ->
- (* We check existence here: it's a bit late at Qed time *)
- if Nametab.exists_cci (Lib.make_path id) || is_section_variable id ||
- locality == Global && Nametab.exists_cci (Lib.make_path_except_section id)
- then
- user_err ?loc (pr_id id ++ str " already exists.");
- id
- | None ->
- let avoid = Id.Set.of_list (Proof_global.get_all_proof_names ()) in
- next_global_ident_away default_thm_id avoid
+let fresh_name_for_anonymous_theorem () =
+ let avoid = Id.Set.of_list (Proof_global.get_all_proof_names ()) in
+ next_global_ident_away default_thm_id avoid
+
+let check_name_freshness locality (loc,id) : unit =
+ (* We check existence here: it's a bit late at Qed time *)
+ if Nametab.exists_cci (Lib.make_path id) || is_section_variable id ||
+ locality == Global && Nametab.exists_cci (Lib.make_path_except_section id)
+ then
+ user_err ?loc (Id.print id ++ str " already exists.")
-let save_remaining_recthms (locality,p,kind) norm ctx binders body opaq i (id,(t_i,(_,imps))) =
+let save_remaining_recthms (locality,p,kind) norm univs body opaq i (id,(t_i,(_,imps))) =
let t_i = norm t_i in
match body with
| None ->
@@ -230,7 +229,13 @@ let save_remaining_recthms (locality,p,kind) norm ctx binders body opaq i (id,(t
| Discharge ->
let impl = false in (* copy values from Vernacentries *)
let k = IsAssumption Conjectural in
- let c = SectionLocalAssum ((t_i,Univ.ContextSet.of_context ctx),p,impl) in
+ let univs = match univs with
+ | Polymorphic_const_entry univs ->
+ (* What is going on here? *)
+ Univ.ContextSet.of_context univs
+ | Monomorphic_const_entry univs -> univs
+ in
+ let c = SectionLocalAssum ((t_i, univs),p,impl) in
let _ = declare_variable id (Lib.cwd(),c,k) in
(Discharge, VarRef id,imps)
| Local | Global ->
@@ -240,24 +245,25 @@ let save_remaining_recthms (locality,p,kind) norm ctx binders body opaq i (id,(t
| Global -> false
| Discharge -> assert false
in
- let decl = (ParameterEntry (None,p,(t_i,ctx),None), k) in
+ let decl = (ParameterEntry (None,(t_i,univs),None), k) in
let kn = declare_constant id ~local decl in
(locality,ConstRef kn,imps))
| Some body ->
let body = norm body in
let k = Kindops.logical_kind_of_goal_kind kind in
- let rec body_i t = match kind_of_term t with
+ let rec body_i t = match Constr.kind t with
| Fix ((nv,0),decls) -> mkFix ((nv,i),decls)
| CoFix (0,decls) -> mkCoFix (i,decls)
| LetIn(na,t1,ty,t2) -> mkLetIn (na,t1,ty, body_i t2)
| Lambda(na,ty,t) -> mkLambda(na,ty,body_i t)
| App (t, args) -> mkApp (body_i t, args)
- | _ -> anomaly Pp.(str "Not a proof by induction: " ++ Printer.pr_constr body ++ str ".") in
+ | _ ->
+ let sigma, env = Pfedit.get_current_context () in
+ anomaly Pp.(str "Not a proof by induction: " ++ Printer.pr_constr_env env sigma body ++ str ".") in
let body_i = body_i body in
match locality with
| Discharge ->
- let const = definition_entry ~types:t_i ~opaque:opaq ~poly:p
- ~univs:ctx body_i in
+ let const = definition_entry ~types:t_i ~opaque:opaq ~univs body_i in
let c = SectionLocalDef const in
let _ = declare_variable id (Lib.cwd(), c, k) in
(Discharge,VarRef id,imps)
@@ -268,7 +274,7 @@ let save_remaining_recthms (locality,p,kind) norm ctx binders body opaq i (id,(t
| Discharge -> assert false
in
let const =
- Declare.definition_entry ~types:t_i ~poly:p ~univs:ctx ~opaque:opaq body_i
+ Declare.definition_entry ~types:t_i ~univs ~opaque:opaq body_i
in
let kn = declare_constant id ~local (DefinitionEntry const, k) in
(locality,ConstRef kn,imps)
@@ -277,23 +283,23 @@ let save_hook = ref ignore
let set_save_hook f = save_hook := f
let save_named ?export_seff proof =
- let id,const,(cstrs,pl),do_guard,persistence,hook = proof in
- save ?export_seff id const cstrs pl do_guard persistence hook
+ let id,const,uctx,do_guard,persistence,hook = proof in
+ save ?export_seff id const uctx do_guard persistence hook
let check_anonymity id save_ident =
if not (String.equal (atompart_of_id id) (Id.to_string (default_thm_id))) then
user_err Pp.(str "This command can only be used for unnamed theorem.")
let save_anonymous ?export_seff proof save_ident =
- let id,const,(cstrs,pl),do_guard,persistence,hook = proof in
+ let id,const,uctx,do_guard,persistence,hook = proof in
check_anonymity id save_ident;
- save ?export_seff save_ident const cstrs pl do_guard persistence hook
+ save ?export_seff save_ident const uctx do_guard persistence hook
(* Admitted *)
let warn_let_as_axiom =
CWarnings.create ~name:"let-as-axiom" ~category:"vernacular"
- (fun id -> strbrk "Let definition" ++ spc () ++ pr_id id ++
+ (fun id -> strbrk "Let definition" ++ spc () ++ Id.print id ++
spc () ++ strbrk "declared as an axiom.")
let admit (id,k,e) pl hook () =
@@ -303,7 +309,7 @@ let admit (id,k,e) pl hook () =
| Local, _, _ | Discharge, _, _ -> warn_let_as_axiom id
in
let () = assumption_message id in
- Option.iter (Universes.register_universe_binders (ConstRef kn)) pl;
+ Declare.declare_univ_binders (ConstRef kn) pl;
call_hook (fun exn -> exn) hook Global (ConstRef kn)
(* Starting a goal *)
@@ -321,8 +327,8 @@ let get_proof proof do_guard hook opacity =
let universe_proof_terminator compute_guard hook =
let open Proof_global in
make_terminator begin function
- | Admitted (id,k,pe,(ctx,pl)) ->
- admit (id,k,pe) pl (hook (Some ctx)) ();
+ | Admitted (id,k,pe,ctx) ->
+ admit (id,k,pe) (UState.universe_binders ctx) (hook (Some ctx)) ();
Feedback.feedback Feedback.AddedAxiom
| Proved (opaque,idopt,proof) ->
let is_opaque, export_seff = match opaque with
@@ -330,7 +336,7 @@ let universe_proof_terminator compute_guard hook =
| Vernacexpr.Opaque -> true, false
in
let proof = get_proof proof compute_guard
- (hook (Some (fst proof.Proof_global.universes))) is_opaque in
+ (hook (Some (proof.Proof_global.universes))) is_opaque in
begin match idopt with
| None -> save_named ~export_seff proof
| Some (_,id) -> save_anonymous ~export_seff proof id
@@ -368,7 +374,7 @@ let start_proof_univs id ?pl kind sigma ?terminator ?sign c ?init_tac ?(compute_
let rec_tac_initializer finite guard thms snl =
if finite then
- match List.map (fun (id,(t,_)) -> (id,EConstr.of_constr t)) thms with
+ match List.map (fun (id,(t,_)) -> (id,t)) thms with
| (id,_)::l -> Tactics.mutual_cofix id l 0
| _ -> assert false
else
@@ -376,11 +382,11 @@ let rec_tac_initializer finite guard thms snl =
let nl = match snl with
| None -> List.map succ (List.map List.last guard)
| Some nl -> nl
- in match List.map2 (fun (id,(t,_)) n -> (id,n, EConstr.of_constr t)) thms nl with
+ in match List.map2 (fun (id,(t,_)) n -> (id,n, t)) thms nl with
| (id,n,_)::l -> Tactics.mutual_fix id n l 0
| _ -> assert false
-let start_proof_with_initialization kind ctx decl recguard thms snl hook =
+let start_proof_with_initialization kind sigma decl recguard thms snl hook =
let intro_tac (_, (_, (ids, _))) =
Tacticals.New.tclMAP (function
| Name id -> Tactics.intro_mustbe_force id
@@ -408,51 +414,49 @@ let start_proof_with_initialization kind ctx decl recguard thms snl hook =
| (id,(t,(_,imps)))::other_thms ->
let hook ctx strength ref =
let ctx = match ctx with
- | None -> Evd.empty_evar_universe_context
+ | None -> UState.empty
| Some ctx -> ctx
in
let other_thms_data =
if List.is_empty other_thms then [] else
(* there are several theorems defined mutually *)
let body,opaq = retrieve_first_recthm ctx ref in
- let subst = Evd.evar_universe_context_subst ctx in
- let norm c = Universes.subst_opt_univs_constr subst c in
- let binders, ctx = Evd.check_univ_decl (Evd.from_ctx ctx) decl in
- let body = Option.map norm body in
- List.map_i (save_remaining_recthms kind norm ctx binders body opaq) 1 other_thms in
+ let norm c = EConstr.to_constr (Evd.from_ctx ctx) c in
+ let body = Option.map EConstr.of_constr body in
+ let uctx = UState.check_univ_decl ~poly:(pi2 kind) ctx decl in
+ List.map_i (save_remaining_recthms kind norm uctx body opaq) 1 other_thms in
let thms_data = (strength,ref,imps)::other_thms_data in
List.iter (fun (strength,ref,imps) ->
maybe_declare_manual_implicits false ref imps;
call_hook (fun exn -> exn) hook strength ref) thms_data in
- start_proof_univs id ~pl:decl kind ctx (EConstr.of_constr t) ?init_tac (fun ctx -> mk_hook (hook ctx)) ~compute_guard:guard
+ start_proof_univs id ~pl:decl kind sigma t ?init_tac (fun ctx -> mk_hook (hook ctx)) ~compute_guard:guard
let start_proof_com ?inference_hook kind thms hook =
let env0 = Global.env () in
let decl = fst (List.hd thms) in
- let evd, decl =
- match decl with
- | None -> Evd.from_env env0, Univdecls.default_univ_decl
- | Some decl ->
- Univdecls.interp_univ_decl_opt env0 (snd decl) in
- let evdref = ref evd in
- let thms = List.map (fun (sopt,(bl,t)) ->
- let impls, ((env, ctx), imps) = interp_context_evars env0 evdref bl in
- let t', imps' = interp_type_evars_impls ~impls env evdref t in
+ let evd, decl = Univdecls.interp_univ_decl_opt env0 (snd decl) in
+ let evd, thms = List.fold_left_map (fun evd ((id, _), (bl, t)) ->
+ let evd, (impls, ((env, ctx), imps)) = interp_context_evars env0 evd bl in
+ let evd, (t', imps') = interp_type_evars_impls ~impls env evd t in
let flags = all_and_fail_flags in
let flags = { flags with use_hook = inference_hook } in
- evdref := solve_remaining_evars flags env !evdref Evd.empty;
+ let evd = solve_remaining_evars flags env evd Evd.empty in
let ids = List.map RelDecl.get_name ctx in
- (compute_proof_name (pi1 kind) sopt,
- (EConstr.Unsafe.to_constr (nf_evar !evdref (EConstr.it_mkProd_or_LetIn t' ctx)),
- (ids, imps @ lift_implicits (Context.Rel.nhyps ctx) imps'))))
- thms in
- let recguard,thms,snl = look_for_possibly_mutual_statements thms in
- let evd, nf = Evarutil.nf_evars_and_universes !evdref in
- let thms = List.map (fun (n, (t, info)) -> (n, (nf t, info))) thms in
+ check_name_freshness (pi1 kind) id;
+ (* XXX: The nf_evar is critical !! *)
+ evd, (snd id,
+ (Evarutil.nf_evar evd (EConstr.it_mkProd_or_LetIn t' ctx),
+ (ids, imps @ lift_implicits (Context.Rel.nhyps ctx) imps'))))
+ evd thms in
+ let recguard,thms,snl = look_for_possibly_mutual_statements evd thms in
+ let evd, _nf = Evarutil.nf_evars_and_universes evd in
+ (* XXX: This nf_evar is critical too!! We are normalizing twice if
+ you look at the previous lines... *)
+ let thms = List.map (fun (n, (t, info)) -> (n, (nf_evar evd t, info))) thms in
let () =
- if not decl.Misctypes.univdecl_extensible_instance then
- ignore (Evd.universe_context evd ~names:decl.Misctypes.univdecl_instance ~extensible:false)
- else ()
+ let open Misctypes in
+ if not (decl.univdecl_extensible_instance && decl.univdecl_extensible_constraints) then
+ ignore (Evd.check_univ_decl ~poly:(pi2 kind) evd decl)
in
let evd =
if pi2 kind then evd
@@ -461,7 +465,6 @@ let start_proof_com ?inference_hook kind thms hook =
in
start_proof_with_initialization kind evd decl recguard thms snl hook
-
(* Saving a proof *)
let keep_admitted_vars = ref true
@@ -487,9 +490,9 @@ let save_proof ?proof = function
if const_entry_type = None then
user_err Pp.(str "Admitted requires an explicit statement");
let typ = Option.get const_entry_type in
- let ctx = Evd.evar_context_universe_context (fst universes) in
+ let ctx = UState.const_univ_entry ~poly:(pi2 k) universes in
let sec_vars = if !keep_admitted_vars then const_entry_secctx else None in
- Admitted(id, k, (sec_vars, pi2 k, (typ, ctx), None), universes)
+ Admitted(id, k, (sec_vars, (typ, ctx), None), universes)
| None ->
let pftree = Proof_global.give_me_the_proof () in
let id, k, typ = Pfedit.current_proof_statement () in
@@ -509,12 +512,9 @@ let save_proof ?proof = function
Some (Environ.keep_hyps env (Id.Set.union ids_typ ids_def))
| _ -> None in
let decl = Proof_global.get_universe_decl () in
- let evd = Evd.from_ctx universes in
- let binders, ctx = Evd.check_univ_decl evd decl in
let poly = pi2 k in
- let binders = if poly then Some binders else None in
- Admitted(id,k,(sec_vars, poly, (typ, ctx), None),
- (universes, binders))
+ let ctx = UState.check_univ_decl ~poly universes decl in
+ Admitted(id,k,(sec_vars, (typ, ctx), None), universes)
in
Proof_global.apply_terminator (Proof_global.get_terminator ()) pe
| Vernacexpr.Proved (is_opaque,idopt) ->
@@ -529,7 +529,5 @@ let save_proof ?proof = function
Proof_global.(apply_terminator terminator (Proved (is_opaque,idopt,proof_obj)))
(* Miscellaneous *)
+let get_current_context () = Pfedit.get_current_context ()
-let get_current_context () =
- Pfedit.get_current_context ()
-
diff --git a/vernac/lemmas.mli b/vernac/lemmas.mli
index 1e23c7314..126dcd8b0 100644
--- a/vernac/lemmas.mli
+++ b/vernac/lemmas.mli
@@ -7,7 +7,6 @@
(************************************************************************)
open Names
-open Term
open Decl_kinds
type 'a declaration_hook
@@ -27,36 +26,38 @@ val start_proof : Id.t -> ?pl:Univdecls.universe_decl -> goal_kind -> Evd.evar_m
unit declaration_hook -> unit
val start_proof_univs : Id.t -> ?pl:Univdecls.universe_decl -> goal_kind -> Evd.evar_map ->
- ?terminator:(Proof_global.lemma_possible_guards -> (Evd.evar_universe_context option -> unit declaration_hook) -> Proof_global.proof_terminator) ->
+ ?terminator:(Proof_global.lemma_possible_guards -> (UState.t option -> unit declaration_hook) -> Proof_global.proof_terminator) ->
?sign:Environ.named_context_val -> EConstr.types ->
?init_tac:unit Proofview.tactic -> ?compute_guard:Proof_global.lemma_possible_guards ->
- (Evd.evar_universe_context option -> unit declaration_hook) -> unit
+ (UState.t option -> unit declaration_hook) -> unit
val start_proof_com :
?inference_hook:Pretyping.inference_hook ->
goal_kind -> Vernacexpr.proof_expr list ->
unit declaration_hook -> unit
-val start_proof_with_initialization :
+val start_proof_with_initialization :
goal_kind -> Evd.evar_map -> Univdecls.universe_decl ->
(bool * Proof_global.lemma_possible_guards * unit Proofview.tactic list option) option ->
(Id.t (* name of thm *) *
- (types (* type of thm *) * (Name.t list (* names to pre-introduce *) * Impargs.manual_explicitation list))) list
+ (EConstr.types (* type of thm *) * (Name.t list (* names to pre-introduce *) * Impargs.manual_explicitation list))) list
-> int list option -> unit declaration_hook -> unit
val universe_proof_terminator :
Proof_global.lemma_possible_guards ->
- (Evd.evar_universe_context option -> unit declaration_hook) ->
+ (UState.t option -> unit declaration_hook) ->
Proof_global.proof_terminator
val standard_proof_terminator :
Proof_global.lemma_possible_guards -> unit declaration_hook ->
Proof_global.proof_terminator
+val fresh_name_for_anonymous_theorem : unit -> Id.t
+
(** {6 ... } *)
(** A hook the next three functions pass to cook_proof *)
-val set_save_hook : (Proof.proof -> unit) -> unit
+val set_save_hook : (Proof.t -> unit) -> unit
val save_proof : ?proof:Proof_global.closed_proof -> Vernacexpr.proof_end -> unit
@@ -66,3 +67,4 @@ val save_proof : ?proof:Proof_global.closed_proof -> Vernacexpr.proof_end -> uni
and the current global env *)
val get_current_context : unit -> Evd.evar_map * Environ.env
+[@@ocaml.deprecated "please use [Pfedit.get_current_context]"]
diff --git a/vernac/locality.ml b/vernac/locality.ml
index 054a451a4..87b411625 100644
--- a/vernac/locality.ml
+++ b/vernac/locality.ml
@@ -6,46 +6,14 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-open Pp
+open Decl_kinds
(** * Managing locality *)
let local_of_bool = function
- | true -> Decl_kinds.Local
- | false -> Decl_kinds.Global
-
-let check_locality locality_flag =
- match locality_flag with
- | Some b ->
- let s = if b then "Local" else "Global" in
- CErrors.user_err ~hdr:"Locality.check_locality"
- (str "This command does not support the \"" ++ str s ++ str "\" prefix.")
- | None -> ()
-
-(** Extracting the locality flag *)
-
-(* Commands which supported an inlined Local flag *)
-
-let warn_deprecated_local_syntax =
- CWarnings.create ~name:"deprecated-local-syntax" ~category:"deprecated"
- (fun () ->
- Pp.strbrk "Deprecated syntax: use \"Local\" as a prefix.")
-
-let enforce_locality_full locality_flag local =
- let local =
- match locality_flag with
- | Some false when local ->
- CErrors.user_err Pp.(str "Cannot be simultaneously Local and Global.")
- | Some true when local ->
- CErrors.user_err Pp.(str "Use only prefix \"Local\".")
- | None ->
- if local then begin
- warn_deprecated_local_syntax ();
- Some true
- end else
- None
- | Some b -> Some b in
- local
+ | true -> Local
+ | false -> Global
+
(** Positioning locality for commands supporting discharging and export
outside of modules *)
@@ -58,15 +26,16 @@ let make_non_locality = function Some false -> false | _ -> true
let make_locality = function Some true -> true | _ -> false
-let enforce_locality locality_flag local =
- make_locality (enforce_locality_full locality_flag local)
+let enforce_locality_exp locality_flag discharge =
+ match locality_flag, discharge with
+ | Some b, NoDischarge -> local_of_bool b
+ | None, NoDischarge -> Global
+ | None, DoDischarge -> Discharge
+ | Some true, DoDischarge -> CErrors.user_err Pp.(str "Local not allowed in this case")
+ | Some false, DoDischarge -> CErrors.user_err Pp.(str "Global not allowed in this case")
-let enforce_locality_exp locality_flag local =
- match locality_flag, local with
- | None, Some local -> local
- | Some b, None -> local_of_bool b
- | None, None -> Decl_kinds.Global
- | Some _, Some _ -> CErrors.user_err Pp.(str "Local non allowed in this case")
+let enforce_locality locality_flag =
+ make_locality locality_flag
(* For commands whose default is to not discharge but to export:
Global in sections forces discharge, Global not in section is the default;
@@ -75,8 +44,8 @@ let enforce_locality_exp locality_flag local =
let make_section_locality =
function Some b -> b | None -> Lib.sections_are_opened ()
-let enforce_section_locality locality_flag local =
- make_section_locality (enforce_locality_full locality_flag local)
+let enforce_section_locality locality_flag =
+ make_section_locality locality_flag
(** Positioning locality for commands supporting export but not discharge *)
@@ -93,15 +62,5 @@ let make_module_locality = function
| Some true -> true
| None -> false
-let enforce_module_locality locality_flag local =
- make_module_locality (enforce_locality_full locality_flag local)
-
-module LocalityFixme = struct
- let locality = ref None
- let set l = locality := l
- let consume () =
- let l = !locality in
- locality := None;
- l
- let assert_consumed () = check_locality !locality
-end
+let enforce_module_locality locality_flag =
+ make_module_locality locality_flag
diff --git a/vernac/locality.mli b/vernac/locality.mli
index c1c45d6b0..922538b23 100644
--- a/vernac/locality.mli
+++ b/vernac/locality.mli
@@ -8,10 +8,6 @@
(** * Managing locality *)
-(** Commands which supported an inlined Local flag *)
-
-val enforce_locality_full : bool option -> bool -> bool option
-
(** * Positioning locality for commands supporting discharging and export
outside of modules *)
@@ -22,16 +18,15 @@ val enforce_locality_full : bool option -> bool -> bool option
val make_locality : bool option -> bool
val make_non_locality : bool option -> bool
-val enforce_locality : bool option -> bool -> bool
-val enforce_locality_exp :
- bool option -> Decl_kinds.locality option -> Decl_kinds.locality
+val enforce_locality_exp : bool option -> Decl_kinds.discharge -> Decl_kinds.locality
+val enforce_locality : bool option -> bool
(** For commands whose default is to not discharge but to export:
Global in sections forces discharge, Global not in section is the default;
Local in sections is the default, Local not in section forces non-export *)
val make_section_locality : bool option -> bool
-val enforce_section_locality : bool option -> bool -> bool
+val enforce_section_locality : bool option -> bool
(** * Positioning locality for commands supporting export but not discharge *)
@@ -40,12 +35,4 @@ val enforce_section_locality : bool option -> bool -> bool
Local in sections is the default, Local not in section forces non-export *)
val make_module_locality : bool option -> bool
-val enforce_module_locality : bool option -> bool -> bool
-
-(* This is the old imperative interface that is still used for
- * VernacExtend vernaculars. Time permitting this could be trashed too *)
-module LocalityFixme : sig
- val set : bool option -> unit
- val consume : unit -> bool option
- val assert_consumed : unit -> unit
-end
+val enforce_module_locality : bool option -> bool
diff --git a/vernac/metasyntax.ml b/vernac/metasyntax.ml
index 9376afa8c..1bb9e0da1 100644
--- a/vernac/metasyntax.ml
+++ b/vernac/metasyntax.ml
@@ -80,8 +80,8 @@ let pr_grammar = function
| "pattern" ->
pr_entry Pcoq.Constr.pattern
| "vernac" ->
- str "Entry vernac is" ++ fnl () ++
- pr_entry Pcoq.Vernac_.vernac ++
+ str "Entry vernac_control is" ++ fnl () ++
+ pr_entry Pcoq.Vernac_.vernac_control ++
str "Entry command is" ++ fnl () ++
pr_entry Pcoq.Vernac_.command ++
str "Entry syntax is" ++ fnl () ++
@@ -310,7 +310,7 @@ let rec get_notation_vars onlyprint = function
(* don't check for nonlinearity if printing only, see Bug 5526 *)
if not onlyprint && Id.List.mem id vars then
user_err ~hdr:"Metasyntax.get_notation_vars"
- (str "Variable " ++ pr_id id ++ str " occurs more than once.")
+ (str "Variable " ++ Id.print id ++ str " occurs more than once.")
else id::vars
| (Terminal _ | Break _) :: sl -> get_notation_vars onlyprint sl
| SProdList _ :: _ -> assert false
@@ -323,7 +323,7 @@ let analyze_notation_tokens ~onlyprint l =
let error_not_same_scope x y =
user_err ~hdr:"Metasyntax.error_not_name_scope"
- (str "Variables " ++ pr_id x ++ str " and " ++ pr_id y ++ str " must be in the same scope.")
+ (str "Variables " ++ Id.print x ++ str " and " ++ Id.print y ++ str " must be in the same scope.")
(**********************************************************************)
(* Build pretty-printing rules *)
@@ -398,7 +398,7 @@ let check_open_binder isopen sl m =
| _ -> assert false
in
if isopen && not (List.is_empty sl) then
- user_err (str "as " ++ pr_id m ++
+ user_err (str "as " ++ Id.print m ++
str " is a non-closed binder, no such \"" ++
prlist_with_sep spc pr_token sl
++ strbrk "\" is allowed to occur.")
@@ -865,7 +865,7 @@ let check_useless_entry_types recvars mainvars etyps =
let vars = let (l1,l2) = List.split recvars in l1@l2@mainvars in
match List.filter (fun (x,etyp) -> not (List.mem x vars)) etyps with
| (x,_)::_ -> user_err ~hdr:"Metasyntax.check_useless_entry_types"
- (pr_id x ++ str " is unbound in the notation.")
+ (Id.print x ++ str " is unbound in the notation.")
| _ -> ()
let check_binder_type recvars etyps =
@@ -922,7 +922,7 @@ let join_auxiliary_recursive_types recvars etyps =
| Some xtyp, Some ytyp when Pervasives.(=) xtyp ytyp -> typs (* FIXME *)
| Some xtyp, Some ytyp ->
user_err
- (strbrk "In " ++ pr_id x ++ str " .. " ++ pr_id y ++
+ (strbrk "In " ++ Id.print x ++ str " .. " ++ Id.print y ++
strbrk ", both ends have incompatible types."))
recvars etyps
diff --git a/vernac/mltop.ml b/vernac/mltop.ml
index d3de10235..053b9d070 100644
--- a/vernac/mltop.ml
+++ b/vernac/mltop.ml
@@ -184,10 +184,28 @@ let warn_cannot_open_path =
type add_ml = AddNoML | AddTopML | AddRecML
-let add_rec_path add_ml ~unix_path ~coq_root ~implicit =
+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 = all_subdirs ~unix_path in
- let prefix = Names.DirPath.repr coq_root in
+ 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
@@ -195,17 +213,23 @@ let add_rec_path add_ml ~unix_path ~coq_root ~implicit =
with Exit -> None
in
let dirs = List.map_filter convert_dirs dirs in
- let () = match add_ml with
+ let () = match lp.has_ml with
| AddNoML -> ()
| AddTopML -> add_ml_dir unix_path
| AddRecML -> List.iter (fun (lp,_) -> add_ml_dir lp) dirs 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 coq_root
+ 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
+
(* convertit un nom quelconque en nom de fichier ou de module *)
let mod_of_name name =
if Filename.check_suffix name ".cmo" then
@@ -378,7 +402,7 @@ let unfreeze_ml_modules x =
(fun (name,path) -> trigger_ml_object false false false ?path name) x
let _ =
- Summary.declare_summary Summary.ml_modules
+ Summary.declare_ml_modules_summary
{ Summary.freeze_function = (fun _ -> get_loaded_modules ());
Summary.unfreeze_function = unfreeze_ml_modules;
Summary.init_function = reset_loaded_modules }
diff --git a/vernac/mltop.mli b/vernac/mltop.mli
index 324a66d38..e44a7c243 100644
--- a/vernac/mltop.mli
+++ b/vernac/mltop.mli
@@ -42,14 +42,26 @@ val dir_ml_load : string -> unit
(** Dynamic interpretation of .ml *)
val dir_ml_use : string -> unit
-(** Adds a path to the ML paths *)
-val add_ml_dir : string -> unit
-val add_rec_ml_dir : string -> unit
-
+(** Adds a path to the Coq and ML paths *)
type add_ml = AddNoML | AddTopML | AddRecML
-(** Adds a path to the Coq and ML paths *)
-val add_rec_path : add_ml -> unix_path:string -> coq_root:Names.DirPath.t -> implicit:bool -> unit
+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
diff --git a/vernac/obligations.ml b/vernac/obligations.ml
index 785c842ba..58e4b00fc 100644
--- a/vernac/obligations.ml
+++ b/vernac/obligations.ml
@@ -13,6 +13,7 @@ open Declare
*)
open Term
+open Constr
open Vars
open Names
open Evd
@@ -55,7 +56,7 @@ let subst_evar_constr evs n idf t =
let seen = ref Int.Set.empty in
let transparent = ref Id.Set.empty in
let evar_info id = List.assoc_f Evar.equal id evs in
- let rec substrec (depth, fixrels) c = match kind_of_term c with
+ let rec substrec (depth, fixrels) c = match Constr.kind c with
| Evar (k, args) ->
let { ev_name = (id, idstr) ;
ev_hyps = hyps ; ev_chop = chop } =
@@ -85,15 +86,15 @@ let subst_evar_constr evs n idf t =
in aux hyps args []
in
if List.exists
- (fun x -> match kind_of_term x with
+ (fun x -> match Constr.kind x with
| Rel n -> Int.List.mem n fixrels
| _ -> false) args
then
transparent := Id.Set.add idstr !transparent;
mkApp (idf idstr, Array.of_list args)
| Fix _ ->
- map_constr_with_binders succfix substrec (depth, 1 :: fixrels) c
- | _ -> map_constr_with_binders succfix substrec (depth, fixrels) c
+ Constr.map_with_binders succfix substrec (depth, 1 :: fixrels) c
+ | _ -> Constr.map_with_binders succfix substrec (depth, fixrels) c
in
let t' = substrec (0, []) t in
t', !seen, !transparent
@@ -103,9 +104,9 @@ let subst_evar_constr evs n idf t =
where n binders were passed through. *)
let subst_vars acc n t =
let var_index id = Util.List.index Id.equal id acc in
- let rec substrec depth c = match kind_of_term c with
+ let rec substrec depth c = match Constr.kind c with
| Var v -> (try mkRel (depth + (var_index v)) with Not_found -> c)
- | _ -> map_constr_with_binders succ substrec depth c
+ | _ -> Constr.map_with_binders succ substrec depth c
in
substrec 0 t
@@ -144,7 +145,7 @@ let rec chop_product n t =
let pop t = Vars.lift (-1) t in
if Int.equal n 0 then Some t
else
- match kind_of_term t with
+ match Constr.kind t with
| Prod (_, _, b) -> if noccurn 1 b then chop_product (pred n) (pop b) else None
| _ -> None
@@ -154,7 +155,7 @@ let evar_dependencies evm oev =
let evi = Evd.find evm ev in
let deps' = evars_of_filtered_evar_info evi in
if Evar.Set.mem oev deps' then
- invalid_arg ("Ill-formed evar map: cycle detected for evar " ^ string_of_existential oev)
+ invalid_arg ("Ill-formed evar map: cycle detected for evar " ^ Pp.string_of_ppcmds @@ Evar.print oev)
else Evar.Set.union deps' s)
deps deps
in
@@ -163,7 +164,7 @@ let evar_dependencies evm oev =
if Evar.Set.equal deps deps' then deps
else aux deps'
in aux (Evar.Set.singleton oev)
-
+
let move_after (id, ev, deps as obl) l =
let rec aux restdeps = function
| (id', _, _) as obl' :: tl ->
@@ -273,7 +274,7 @@ let explain_no_obligations = function
| None -> str "No obligations remaining"
type obligation_info =
- (Names.Id.t * Term.types * Evar_kinds.t Loc.located *
+ (Names.Id.t * types * Evar_kinds.t Loc.located *
(bool * Evar_kinds.obligation_definition_status)
* Int.Set.t * unit Proofview.tactic option) array
@@ -303,7 +304,7 @@ type program_info_aux = {
prg_name: Id.t;
prg_body: constr;
prg_type: constr;
- prg_ctx: Evd.evar_universe_context;
+ prg_ctx: UState.t;
prg_univdecl: Univdecls.universe_decl;
prg_obligations: obligations;
prg_deps : Id.t list;
@@ -312,7 +313,7 @@ type program_info_aux = {
prg_notations : notations ;
prg_kind : definition_kind;
prg_reduce : constr -> constr;
- prg_hook : (Evd.evar_universe_context -> unit) Lemmas.declaration_hook;
+ prg_hook : (UState.t -> unit) Lemmas.declaration_hook;
prg_opaque : bool;
prg_sign: named_context_val;
}
@@ -384,7 +385,7 @@ let subst_deps expand obls deps t =
(Vars.replace_vars (List.map (fun (n, (_, b)) -> n, b) osubst) t)
let rec prod_app t n =
- match kind_of_term (EConstr.Unsafe.to_constr (Termops.strip_outer_cast Evd.empty (EConstr.of_constr t))) (** FIXME *) with
+ match Constr.kind (EConstr.Unsafe.to_constr (Termops.strip_outer_cast Evd.empty (EConstr.of_constr t))) (** FIXME *) with
| Prod (_,_,b) -> subst1 n b
| LetIn (_, b, t, b') -> prod_app (subst1 b b') n
| _ ->
@@ -400,13 +401,13 @@ let replace_appvars subst =
let f, l = decompose_app c in
if isVar f then
try
- let c' = List.map (map_constr aux) l in
+ let c' = List.map (Constr.map aux) l in
let (t, b) = Id.List.assoc (destVar f) subst in
mkApp (delayed_force hide_obligation,
[| prod_applist t c'; applistc b c' |])
- with Not_found -> map_constr aux c
- else map_constr aux c
- in map_constr aux
+ with Not_found -> Constr.map aux c
+ else Constr.map aux c
+ in Constr.map aux
let subst_prog expand obls ints prg =
let subst = obl_substitution expand obls ints in
@@ -428,15 +429,15 @@ let map_replace k v m = ProgMap.add k (CEphemeron.create v) (ProgMap.remove k m)
let map_keys m = ProgMap.fold (fun k _ l -> k :: l) m []
-let from_prg : program_info ProgMap.t ref =
- Summary.ref ProgMap.empty ~name:"program-tcc-table"
+let from_prg, program_tcc_summary_tag =
+ Summary.ref_tag ProgMap.empty ~name:"program-tcc-table"
let close sec =
if not (ProgMap.is_empty !from_prg) then
let keys = map_keys !from_prg in
user_err ~hdr:"Program"
(str "Unsolved obligations when closing " ++ str sec ++ str":" ++ spc () ++
- prlist_with_sep spc (fun x -> Nameops.pr_id x) keys ++
+ prlist_with_sep spc (fun x -> Id.print x) keys ++
(str (if Int.equal (List.length keys) 1 then " has " else " have ") ++
str "unsolved obligations"))
@@ -474,23 +475,23 @@ let declare_definition prg =
(Evd.evar_universe_context_subst prg.prg_ctx) in
let opaque = prg.prg_opaque in
let fix_exn = Hook.get get_fix_exn () in
- let pl, ctx = Evd.check_univ_decl (Evd.from_ctx prg.prg_ctx) prg.prg_univdecl in
- let ce =
- definition_entry ~fix_exn
- ~opaque ~types:(nf typ) ~poly:(pi2 prg.prg_kind)
- ~univs:(Evd.evar_context_universe_context prg.prg_ctx) (nf body)
- in
+ let typ = nf typ in
+ let body = nf body in
+ let env = Global.env () in
+ let uvars = Univ.LSet.union
+ (Univops.universes_of_constr env typ)
+ (Univops.universes_of_constr env body) in
+ let uctx = UState.restrict prg.prg_ctx uvars in
+ let univs = UState.check_univ_decl ~poly:(pi2 prg.prg_kind) uctx prg.prg_univdecl in
+ let ce = definition_entry ~fix_exn ~opaque ~types:typ ~univs body in
let () = progmap_remove prg in
- let cst =
- DeclareDef.declare_definition prg.prg_name
- prg.prg_kind ce [] prg.prg_implicits
- (Lemmas.mk_hook (fun l r -> Lemmas.call_hook fix_exn prg.prg_hook l r prg.prg_ctx; r))
- in
- Universes.register_universe_binders cst pl;
- cst
+ let ubinders = UState.universe_binders uctx in
+ DeclareDef.declare_definition prg.prg_name
+ prg.prg_kind ce ubinders prg.prg_implicits
+ (Lemmas.mk_hook (fun l r -> Lemmas.call_hook fix_exn prg.prg_hook l r uctx; r))
let rec lam_index n t acc =
- match kind_of_term t with
+ match Constr.kind t with
| Lambda (Name n', _, _) when Id.equal n n' ->
acc
| Lambda (_, _, b) ->
@@ -551,9 +552,9 @@ let declare_mutual_definition l =
mk_proof (mkCoFix (i,fixdecls))) 0 l
in
(* Declare the recursive definitions *)
- let ctx = Evd.evar_context_universe_context first.prg_ctx in
+ let univs = UState.const_univ_entry ~poly first.prg_ctx in
let fix_exn = Hook.get get_fix_exn () in
- let kns = List.map4 (DeclareDef.declare_fix ~opaque (local, poly, kind) [] ctx)
+ let kns = List.map4 (DeclareDef.declare_fix ~opaque (local, poly, kind) Universes.empty_binders univs)
fixnames fixdecls fixtypes fiximps in
(* Declare notations *)
List.iter (Metasyntax.add_notation_interpretation (Global.env())) first.prg_notations;
@@ -566,9 +567,9 @@ let declare_mutual_definition l =
let decompose_lam_prod c ty =
let open Context.Rel.Declaration in
let rec aux ctx c ty =
- match kind_of_term c, kind_of_term ty with
+ match Constr.kind c, Constr.kind ty with
| LetIn (x, b, t, c), LetIn (x', b', t', ty)
- when eq_constr b b' && eq_constr t t' ->
+ when Constr.equal b b' && Constr.equal t t' ->
let ctx' = Context.Rel.add (LocalDef (x,b',t')) ctx in
aux ctx' c ty
| _, LetIn (x', b', t', ty) ->
@@ -635,12 +636,11 @@ let declare_obligation prg obl body ty uctx =
shrink_body body ty else [], body, ty, [||]
in
let body = ((body,Univ.ContextSet.empty),Safe_typing.empty_private_constants) in
- let univs = if poly then Polymorphic_const_entry uctx else Monomorphic_const_entry uctx in
let ce =
{ const_entry_body = Future.from_val ~fix_exn:(fun x -> x) body;
const_entry_secctx = None;
const_entry_type = ty;
- const_entry_universes = univs;
+ const_entry_universes = uctx;
const_entry_opaque = opaque;
const_entry_inline_code = false;
const_entry_feedback = None;
@@ -649,13 +649,15 @@ let declare_obligation prg obl body ty uctx =
let constant = Declare.declare_constant obl.obl_name ~local:true
(DefinitionEntry ce,IsProof Property)
in
- if not opaque then add_hint (Locality.make_section_locality None) prg constant;
- definition_message obl.obl_name;
- true, { obl with obl_body =
- if poly then
- Some (DefinedObl (constant, Univ.UContext.instance uctx))
- else
- Some (TermObl (it_mkLambda_or_LetIn_or_clean (mkApp (mkConst constant, args)) ctx)) }
+ if not opaque then add_hint (Locality.make_section_locality None) prg constant;
+ definition_message obl.obl_name;
+ let body = match uctx with
+ | Polymorphic_const_entry uctx ->
+ Some (DefinedObl (constant, Univ.UContext.instance uctx))
+ | Monomorphic_const_entry _ ->
+ Some (TermObl (it_mkLambda_or_LetIn_or_clean (mkApp (mkConst constant, args)) ctx))
+ in
+ true, { obl with obl_body = body }
let init_prog_info ?(opaque = false) sign n udecl b t ctx deps fixkind
notations obls impls kind reduce hook =
@@ -677,6 +679,7 @@ let init_prog_info ?(opaque = false) sign n udecl b t ctx deps fixkind
obl_deps = d; obl_tac = tac })
obls, b
in
+ let ctx = UState.make_flexible_nonalgebraic ctx in
{ prg_name = n ; prg_body = b; prg_type = reduce t;
prg_ctx = ctx; prg_univdecl = udecl;
prg_obligations = (obls', Array.length obls');
@@ -715,10 +718,10 @@ let get_prog name =
| _ ->
let progs = Id.Set.elements (ProgMap.domain prg_infos) in
let prog = List.hd progs in
- let progs = prlist_with_sep pr_comma Nameops.pr_id progs in
+ let progs = prlist_with_sep pr_comma Id.print progs in
user_err
(str "More than one program with unsolved obligations: " ++ progs
- ++ str "; use the \"of\" clause to specify, as in \"Obligation 1 of " ++ Nameops.pr_id prog ++ str "\""))
+ ++ str "; use the \"of\" clause to specify, as in \"Obligation 1 of " ++ Id.print prog ++ str "\""))
let get_any_prog () =
let prg_infos = !from_prg in
@@ -828,46 +831,63 @@ let obligation_terminator name num guard hook auto pf =
match pf with
| Admitted _ -> apply_terminator term pf
| Proved (opq, id, proof) ->
- if not !shrink_obligations then apply_terminator term pf
- else
- let (_, (entry, uctx, _)) = Pfedit.cook_this_proof proof in
- let env = Global.env () in
- let entry = Safe_typing.inline_private_constants_in_definition_entry env entry in
- let ty = entry.Entries.const_entry_type in
- let (body, cstr), () = Future.force entry.Entries.const_entry_body in
- let sigma = Evd.from_ctx (fst uctx) in
- let sigma = Evd.merge_context_set ~sideff:true Evd.univ_rigid sigma cstr in
- Inductiveops.control_only_guard (Global.env ()) body;
- (** Declare the obligation ourselves and drop the hook *)
- let prg = get_info (ProgMap.find name !from_prg) in
- let ctx = Evd.evar_universe_context sigma in
- let prg = { prg with prg_ctx = ctx } in
- let obls, rem = prg.prg_obligations in
- let obl = obls.(num) in
- let status =
- match obl.obl_status, opq with
- | (_, Evar_kinds.Expand), Vernacexpr.Opaque -> err_not_transp ()
- | (true, _), Vernacexpr.Opaque -> err_not_transp ()
- | (false, _), Vernacexpr.Opaque -> Evar_kinds.Define true
- | (_, Evar_kinds.Define true), Vernacexpr.Transparent -> Evar_kinds.Define false
- | (_, status), Vernacexpr.Transparent -> status
- in
- let obl = { obl with obl_status = false, status } in
- let uctx = Evd.evar_context_universe_context ctx in
- let (_, obl) = declare_obligation prg obl body ty uctx in
- let obls = Array.copy obls in
- let _ = obls.(num) <- obl in
- try
+ let (_, (entry, uctx, _)) = Pfedit.cook_this_proof proof in
+ let env = Global.env () in
+ let entry = Safe_typing.inline_private_constants_in_definition_entry env entry in
+ let ty = entry.Entries.const_entry_type in
+ let (body, cstr), () = Future.force entry.Entries.const_entry_body in
+ let sigma = Evd.from_ctx uctx in
+ let sigma = Evd.merge_context_set ~sideff:true Evd.univ_rigid sigma cstr in
+ Inductiveops.control_only_guard (Global.env ()) body;
+ (** Declare the obligation ourselves and drop the hook *)
+ let prg = get_info (ProgMap.find name !from_prg) in
+ (** Ensure universes are substituted properly in body and type *)
+ let body = EConstr.to_constr sigma (EConstr.of_constr body) in
+ let ty = Option.map (fun x -> EConstr.to_constr sigma (EConstr.of_constr x)) ty in
+ let ctx = Evd.evar_universe_context sigma in
+ let obls, rem = prg.prg_obligations in
+ let obl = obls.(num) in
+ let status =
+ match obl.obl_status, opq with
+ | (_, Evar_kinds.Expand), Vernacexpr.Opaque -> err_not_transp ()
+ | (true, _), Vernacexpr.Opaque -> err_not_transp ()
+ | (false, _), Vernacexpr.Opaque -> Evar_kinds.Define true
+ | (_, Evar_kinds.Define true), Vernacexpr.Transparent ->
+ Evar_kinds.Define false
+ | (_, status), Vernacexpr.Transparent -> status
+ in
+ let obl = { obl with obl_status = false, status } in
+ let ctx =
+ if pi2 prg.prg_kind then ctx
+ else UState.union prg.prg_ctx ctx
+ in
+ let uctx = UState.const_univ_entry ~poly:(pi2 prg.prg_kind) ctx in
+ let (_, obl) = declare_obligation prg obl body ty uctx in
+ let obls = Array.copy obls in
+ let _ = obls.(num) <- obl in
+ let prg_ctx =
+ if pi2 (prg.prg_kind) then (* Polymorphic *)
+ (** We merge the new universes and constraints of the
+ polymorphic obligation with the existing ones *)
+ UState.union prg.prg_ctx ctx
+ else
+ (** The first obligation declares the univs of the constant,
+ each subsequent obligation declares its own additional
+ universes and constraints if any *)
+ UState.make (Global.universes ())
+ in
+ let prg = { prg with prg_ctx } in
+ try
ignore (update_obls prg obls (pred rem));
if pred rem > 0 then
begin
- let deps = dependencies obls num in
- if not (Int.Set.is_empty deps) then
- ignore (auto (Some name) None deps)
- end
- with e when CErrors.noncritical e ->
- let e = CErrors.push e in
- pperror (CErrors.iprint (ExplainErr.process_vernac_interp_error e))
+ let deps = dependencies obls num in
+ if not (Int.Set.is_empty deps) then
+ ignore (auto (Some name) None deps)
+ end
+ with e when CErrors.noncritical e ->
+ let e = CErrors.push e in
+ pperror (CErrors.iprint (ExplainErr.process_vernac_interp_error e))
let obligation_hook prg obl num auto ctx' _ gr =
let obls, rem = prg.prg_obligations in
@@ -888,7 +908,8 @@ in
let ctx' = Evd.merge_universe_subst evd (Evd.universe_subst (Evd.from_ctx ctx')) in
Univ.Instance.empty, Evd.evar_universe_context ctx'
else
- let (_, uctx) = UState.universe_context ~names:[] ~extensible:true ctx' in
+ (* We get the right order somehow, but surely it could be enforced in a clearer way. *)
+ let uctx = UState.context ctx' in
Univ.UContext.instance uctx, ctx'
in
let obl = { obl with obl_body = Some (DefinedObl (cst, inst)) } in
@@ -964,13 +985,16 @@ and solve_obligation_by_tac prg obls i tac =
let evd = Evd.from_ctx prg.prg_ctx in
let evd = Evd.update_sigma_env evd (Global.env ()) in
let t, ty, ctx =
- solve_by_tac obl.obl_name (evar_of_obligation obl) tac
- (pi2 prg.prg_kind) (Evd.evar_universe_context evd)
- in
- let uctx = Evd.evar_context_universe_context ctx in
- let prg = {prg with prg_ctx = ctx} in
- let def, obl' = declare_obligation prg obl t ty uctx in
- obls.(i) <- obl';
+ solve_by_tac obl.obl_name (evar_of_obligation obl) tac
+ (pi2 prg.prg_kind) (Evd.evar_universe_context evd)
+ in
+ let uctx = if pi2 prg.prg_kind
+ then Polymorphic_const_entry (UState.context ctx)
+ else Monomorphic_const_entry (UState.context_set ctx)
+ in
+ let prg = {prg with prg_ctx = ctx} in
+ let def, obl' = declare_obligation prg obl t ty uctx in
+ obls.(i) <- obl';
if def && not (pi2 prg.prg_kind) then (
(* Declare the term constraints with the first obligation only *)
let evd = Evd.from_env (Global.env ()) in
@@ -1118,9 +1142,9 @@ let admit_prog prg =
match x.obl_body with
| None ->
let x = subst_deps_obl obls x in
- let ctx = Evd.evar_context_universe_context prg.prg_ctx in
+ let ctx = Monomorphic_const_entry (UState.context_set prg.prg_ctx) in
let kn = Declare.declare_constant x.obl_name ~local:true
- (ParameterEntry (None,false,(x.obl_type,ctx),None), IsAssumption Conjectural)
+ (ParameterEntry (None,(x.obl_type,ctx),None), IsAssumption Conjectural)
in
assumption_message x.obl_name;
obls.(i) <- { x with obl_body = Some (DefinedObl (kn, Univ.Instance.empty)) }
@@ -1161,7 +1185,6 @@ let init_program () =
Coqlib.check_required_library ["Coq";"Init";"Specif"];
Coqlib.check_required_library ["Coq";"Program";"Tactics"]
-
let set_program_mode c =
if c then
if !Flags.program_mode then ()
diff --git a/vernac/obligations.mli b/vernac/obligations.mli
index 11c2553ae..bdc97d48c 100644
--- a/vernac/obligations.mli
+++ b/vernac/obligations.mli
@@ -7,7 +7,7 @@
(************************************************************************)
open Environ
-open Term
+open Constr
open Evd
open Names
open Globnames
@@ -32,14 +32,14 @@ val eterm_obligations : env -> Id.t -> evar_map -> int ->
(* Existential key, obl. name, type as product,
location of the original evar, associated tactic,
status and dependencies as indexes into the array *)
- * ((existential_key * Id.t) list * ((Id.t -> constr) -> constr -> constr)) *
+ * ((Evar.t * Id.t) list * ((Id.t -> constr) -> constr -> constr)) *
constr * types
(* Translations from existential identifiers to obligation identifiers
and for terms with existentials to closed terms, given a
translation from obligation identifiers to constrs, new term, new type *)
type obligation_info =
- (Id.t * Term.types * Evar_kinds.t Loc.located *
+ (Id.t * types * Evar_kinds.t Loc.located *
(bool * Evar_kinds.obligation_definition_status) * Int.Set.t * unit Proofview.tactic option) array
(* ident, type, location, (opaque or transparent, expand or define),
dependencies, tactic to solve it *)
@@ -51,14 +51,14 @@ type progress = (* Resolution status of a program *)
val default_tactic : unit Proofview.tactic ref
-val add_definition : Names.Id.t -> ?term:Term.constr -> Term.types ->
- Evd.evar_universe_context ->
+val add_definition : Names.Id.t -> ?term:constr -> types ->
+ UState.t ->
?univdecl:Univdecls.universe_decl -> (* Universe binders and constraints *)
?implicits:(Constrexpr.explicitation * (bool * bool * bool)) list ->
?kind:Decl_kinds.definition_kind ->
?tactic:unit Proofview.tactic ->
- ?reduce:(Term.constr -> Term.constr) ->
- ?hook:(Evd.evar_universe_context -> unit) Lemmas.declaration_hook -> ?opaque:bool -> obligation_info -> progress
+ ?reduce:(constr -> constr) ->
+ ?hook:(UState.t -> unit) Lemmas.declaration_hook -> ?opaque:bool -> obligation_info -> progress
type notations =
(Vernacexpr.lstring * Constrexpr.constr_expr * Notation_term.scope_name option) list
@@ -68,14 +68,14 @@ type fixpoint_kind =
| IsCoFixpoint
val add_mutual_definitions :
- (Names.Id.t * Term.constr * Term.types *
+ (Names.Id.t * constr * types *
(Constrexpr.explicitation * (bool * bool * bool)) list * obligation_info) list ->
- Evd.evar_universe_context ->
+ UState.t ->
?univdecl:Univdecls.universe_decl -> (* Universe binders and constraints *)
?tactic:unit Proofview.tactic ->
?kind:Decl_kinds.definition_kind ->
- ?reduce:(Term.constr -> Term.constr) ->
- ?hook:(Evd.evar_universe_context -> unit) Lemmas.declaration_hook -> ?opaque:bool ->
+ ?reduce:(constr -> constr) ->
+ ?hook:(UState.t -> unit) Lemmas.declaration_hook -> ?opaque:bool ->
notations ->
fixpoint_kind -> unit
@@ -104,3 +104,6 @@ exception NoObligations of Names.Id.t option
val explain_no_obligations : Names.Id.t option -> Pp.t
val set_program_mode : bool -> unit
+
+type program_info
+val program_tcc_summary_tag : program_info Id.Map.t Summary.Dyn.tag
diff --git a/vernac/record.ml b/vernac/record.ml
index 5533fe5b3..1e464eb8b 100644
--- a/vernac/record.ml
+++ b/vernac/record.ml
@@ -8,11 +8,13 @@
open Pp
open CErrors
+open Term
+open Sorts
open Util
open Names
open Globnames
open Nameops
-open Term
+open Constr
open Vars
open Environ
open Declarations
@@ -58,23 +60,25 @@ let _ =
optread = (fun () -> !typeclasses_unique);
optwrite = (fun b -> typeclasses_unique := b); }
-let interp_fields_evars env evars impls_env nots l =
+let interp_fields_evars env sigma impls_env nots l =
List.fold_left2
- (fun (env, uimpls, params, impls) no ((loc, i), b, t) ->
- let t', impl = interp_type_evars_impls env evars ~impls t in
- let b' = Option.map (fun x -> fst (interp_casted_constr_evars_impls env evars ~impls x t')) b in
+ (fun (env, sigma, uimpls, params, impls) no ((loc, i), b, t) ->
+ let sigma, (t', impl) = interp_type_evars_impls env sigma ~impls t in
+ let sigma, b' =
+ Option.cata (fun x -> on_snd (fun x -> Some (fst x)) @@
+ interp_casted_constr_evars_impls env sigma ~impls x t') (sigma,None) b in
let impls =
match i with
| Anonymous -> impls
- | Name id -> Id.Map.add id (compute_internalization_data env Constrintern.Method (EConstr.to_constr !evars t') impl) impls
+ | Name id -> Id.Map.add id (compute_internalization_data env Constrintern.Method (EConstr.to_constr sigma t') impl) impls
in
let d = match b' with
| None -> LocalAssum (i,t')
| Some b' -> LocalDef (i,b',t')
in
List.iter (Metasyntax.set_notation_for_interpretation env impls) no;
- (EConstr.push_rel d env, impl :: uimpls, d::params, impls))
- (env, [], [], impls_env) nots l
+ (EConstr.push_rel d env, sigma, impl :: uimpls, d::params, impls))
+ (env, sigma, [], [], impls_env) nots l
let compute_constructor_level evars env l =
List.fold_right (fun d (env, univ) ->
@@ -93,12 +97,11 @@ let binder_of_decl = function
let binders_of_decls = List.map binder_of_decl
-let typecheck_params_and_fields finite def id pl t ps nots fs =
+let typecheck_params_and_fields finite def id poly pl t ps nots fs =
let env0 = Global.env () in
- let evd, decl = Univdecls.interp_univ_decl_opt env0 pl in
- let evars = ref evd in
- let _ =
- let error bk (loc, name) =
+ let sigma, decl = Univdecls.interp_univ_decl_opt env0 pl in
+ let _ =
+ let error bk (loc, name) =
match bk, name with
| Default _, Anonymous ->
user_err ?loc ~hdr:"record" (str "Record parameters must be named")
@@ -110,65 +113,68 @@ let typecheck_params_and_fields finite def id pl t ps nots fs =
| CLocalPattern (loc,(_,_)) ->
Loc.raise ?loc (Stream.Error "pattern with quote not allowed in record parameters.")) ps
in
- let impls_env, ((env1,newps), imps) = interp_context_evars env0 evars ps in
- let typ, sort, template = match t with
+ let sigma, (impls_env, ((env1,newps), imps)) = interp_context_evars env0 sigma ps in
+ let sigma, typ, sort, template = match t with
| Some t ->
let env = EConstr.push_rel_context newps env0 in
let poly =
match t with
| { CAst.v = CSort (Misctypes.GType []) } -> true | _ -> false in
- let s = interp_type_evars env evars ~impls:empty_internalization_env t in
- let sred = Reductionops.whd_all env !evars s in
- (match EConstr.kind !evars sred with
+ let sigma, s = interp_type_evars env sigma ~impls:empty_internalization_env t in
+ let sred = Reductionops.whd_all env sigma s in
+ (match EConstr.kind sigma sred with
| Sort s' ->
- let s' = EConstr.ESorts.kind !evars s' in
+ let s' = EConstr.ESorts.kind sigma s' in
(if poly then
- match Evd.is_sort_variable !evars s' with
- | Some l -> evars := Evd.make_flexible_variable !evars ~algebraic:true l;
- s, s', true
- | None -> s, s', false
- else s, s', false)
+ match Evd.is_sort_variable sigma s' with
+ | Some l ->
+ let sigma = Evd.make_flexible_variable sigma ~algebraic:true l in
+ sigma, s, s', true
+ | None ->
+ sigma, s, s', false
+ else sigma, s, s', false)
| _ -> user_err ?loc:(constr_loc t) (str"Sort expected."))
| None ->
let uvarkind = Evd.univ_flexible_alg in
- let s = Evarutil.evd_comb0 (Evd.new_sort_variable uvarkind) evars in
- EConstr.mkSort s, s, true
+ let sigma, s = Evd.new_sort_variable uvarkind sigma in
+ sigma, EConstr.mkSort s, s, true
in
let arity = EConstr.it_mkProd_or_LetIn typ newps in
let env_ar = EConstr.push_rel_context newps (EConstr.push_rel (LocalAssum (Name id,arity)) env0) in
let assums = List.filter is_local_assum newps in
- let params = List.map (RelDecl.get_name %> out_name) assums in
- let ty = Inductive (params,(finite != BiFinite)) in
- let impls_env = compute_internalization_env env0 ~impls:impls_env ty [id] [EConstr.to_constr !evars arity] [imps] in
- let env2,impls,newfs,data =
- interp_fields_evars env_ar evars impls_env nots (binders_of_decls fs)
+ let params = List.map (RelDecl.get_name %> Name.get_id) assums in
+ let ty = Inductive (params,(finite != Declarations.BiFinite)) in
+ let impls_env = compute_internalization_env env0 ~impls:impls_env ty [id] [EConstr.to_constr sigma arity] [imps] in
+ let env2,sigma,impls,newfs,data =
+ interp_fields_evars env_ar sigma impls_env nots (binders_of_decls fs)
in
- let evars =
- Pretyping.solve_remaining_evars Pretyping.all_and_fail_flags env_ar !evars Evd.empty in
- let typ, evars =
- let _, univ = compute_constructor_level evars env_ar newfs in
+ let sigma =
+ Pretyping.solve_remaining_evars Pretyping.all_and_fail_flags env_ar sigma Evd.empty in
+ let sigma, typ =
+ let _, univ = compute_constructor_level sigma env_ar newfs in
if not def && (Sorts.is_prop sort ||
(Sorts.is_set sort && is_impredicative_set env0)) then
- typ, evars
+ sigma, typ
else
- let evars = Evd.set_leq_sort env_ar evars (Type univ) sort in
+ let sigma = Evd.set_leq_sort env_ar sigma (Type univ) sort in
if Univ.is_small_univ univ &&
- Option.cata (Evd.is_flexible_level evars) false (Evd.is_sort_variable evars sort) then
+ Option.cata (Evd.is_flexible_level sigma) false (Evd.is_sort_variable sigma sort) then
(* We can assume that the level in aritysort is not constrained
and clear it, if it is flexible *)
- EConstr.mkSort (Sorts.sort_of_univ univ),
- Evd.set_eq_sort env_ar evars (Prop Pos) sort
- else typ, evars
+ Evd.set_eq_sort env_ar sigma (Prop Pos) sort,
+ EConstr.mkSort (Sorts.sort_of_univ univ)
+ else sigma, typ
in
- let evars, nf = Evarutil.nf_evars_and_universes evars in
- let newfs = List.map (EConstr.to_rel_decl evars) newfs in
- let newps = List.map (EConstr.to_rel_decl evars) newps in
- let typ = EConstr.to_constr evars typ in
- let ce t = Pretyping.check_evars env0 Evd.empty evars (EConstr.of_constr t) in
- let univs = Evd.check_univ_decl evars decl in
+ let sigma, _ = Evarutil.nf_evars_and_universes sigma in
+ let newfs = List.map (EConstr.to_rel_decl sigma) newfs in
+ let newps = List.map (EConstr.to_rel_decl sigma) newps in
+ let typ = EConstr.to_constr sigma typ in
+ let ce t = Pretyping.check_evars env0 Evd.empty sigma (EConstr.of_constr t) in
+ let univs = Evd.check_univ_decl ~poly sigma decl in
+ let ubinders = Evd.universe_binders sigma in
List.iter (iter_constr ce) (List.rev newps);
List.iter (iter_constr ce) (List.rev newfs);
- univs, typ, template, imps, newps, impls, newfs
+ ubinders, univs, typ, template, imps, newps, impls, newfs
let degenerate_decl decl =
let id = match RelDecl.get_name decl with
@@ -193,24 +199,24 @@ let warning_or_error coe indsp err =
let st = match err with
| MissingProj (fi,projs) ->
let s,have = if List.length projs > 1 then "s","were" else "","was" in
- (pr_id fi ++
+ (Id.print fi ++
strbrk" cannot be defined because the projection" ++ str s ++ spc () ++
- prlist_with_sep pr_comma pr_id projs ++ spc () ++ str have ++
+ prlist_with_sep pr_comma Id.print projs ++ spc () ++ str have ++
strbrk " not defined.")
| BadTypedProj (fi,ctx,te) ->
match te with
| ElimArity (_,_,_,_,Some (_,_,NonInformativeToInformative)) ->
- (pr_id fi ++
+ (Id.print fi ++
strbrk" cannot be defined because it is informative and " ++
Printer.pr_inductive (Global.env()) indsp ++
strbrk " is not.")
| ElimArity (_,_,_,_,Some (_,_,StrongEliminationOnNonSmallType)) ->
- (pr_id fi ++
+ (Id.print fi ++
strbrk" cannot be defined because it is large and " ++
Printer.pr_inductive (Global.env()) indsp ++
strbrk " is not.")
| _ ->
- (pr_id fi ++ strbrk " cannot be defined because it is not typable.")
+ (Id.print fi ++ strbrk " cannot be defined because it is not typable.")
in
if coe then user_err ~hdr:"structure" st;
warn_cannot_define_projection (hov 0 st)
@@ -229,7 +235,7 @@ exception NotDefinable of record_error
let subst_projection fid l c =
let lv = List.length l in
let bad_projs = ref [] in
- let rec substrec depth c = match kind_of_term c with
+ let rec substrec depth c = match Constr.kind c with
| Rel k ->
(* We are in context [[params;fields;x:ind;...depth...]] *)
if k <= depth+1 then
@@ -239,12 +245,12 @@ let subst_projection fid l c =
| Projection t -> lift depth t
| NoProjection (Name id) -> bad_projs := id :: !bad_projs; mkRel k
| NoProjection Anonymous ->
- user_err (str "Field " ++ pr_id fid ++
+ user_err (str "Field " ++ Id.print fid ++
str " depends on the " ++ pr_nth (k-depth-1) ++ str
" field which has no name.")
else
mkRel (k-lv)
- | _ -> map_constr_with_binders succ substrec depth c
+ | _ -> Constr.map_with_binders succ substrec depth c
in
let c' = lift 1 c in (* to get [c] defined in ctxt [[params;fields;x:ind]] *)
let c'' = substrec 0 c' in
@@ -263,12 +269,14 @@ let warn_non_primitive_record =
strbrk" could not be defined as a primitive record")))
(* We build projections *)
-let declare_projections indsp ?(kind=StructureComponent) binder_name coers fieldimpls fields =
+let declare_projections indsp ctx ?(kind=StructureComponent) binder_name coers ubinders fieldimpls fields =
let env = Global.env() in
let (mib,mip) = Global.lookup_inductive indsp in
let poly = Declareops.inductive_is_polymorphic mib in
- let ctx = Univ.AUContext.repr (Declareops.inductive_polymorphic_context mib) in
- let u = Univ.UContext.instance ctx in
+ let u = match ctx with
+ | Polymorphic_const_entry ctx -> Univ.UContext.instance ctx
+ | Monomorphic_const_entry ctx -> Univ.Instance.empty
+ in
let paramdecls = Inductive.inductive_paramdecls (mib, u) in
let indu = indsp, u in
let r = mkIndU (indsp,u) in
@@ -302,9 +310,11 @@ let declare_projections indsp ?(kind=StructureComponent) binder_name coers field
let kn, term =
if is_local_assum decl && primitive then
(** Already defined in the kernel silently *)
- let kn = destConstRef (Nametab.locate (Libnames.qualid_of_ident fid)) in
- Declare.definition_message fid;
- kn, mkProj (Projection.make kn false,mkRel 1)
+ let gr = Nametab.locate (Libnames.qualid_of_ident fid) in
+ let kn = destConstRef gr in
+ Declare.definition_message fid;
+ Universes.register_universe_binders gr ubinders;
+ kn, mkProj (Projection.make kn false,mkRel 1)
else
let ccl = subst_projection fid subst ti in
let body = match decl with
@@ -323,16 +333,12 @@ let declare_projections indsp ?(kind=StructureComponent) binder_name coers field
let projtyp =
it_mkProd_or_LetIn (mkProd (x,rp,ccl)) paramdecls in
try
- let univs =
- if poly then Polymorphic_const_entry ctx
- else Monomorphic_const_entry ctx
- in
let entry = {
const_entry_body =
Future.from_val (Safe_typing.mk_pure_proof proj);
const_entry_secctx = None;
const_entry_type = Some projtyp;
- const_entry_universes = univs;
+ const_entry_universes = ctx;
const_entry_opaque = false;
const_entry_inline_code = false;
const_entry_feedback = None } in
@@ -341,8 +347,9 @@ let declare_projections indsp ?(kind=StructureComponent) binder_name coers field
let constr_fip =
let proj_args = (*Rel 1 refers to "x"*) paramargs@[mkRel 1] in
applist (mkConstU (kn,u),proj_args)
- in
- Declare.definition_message fid;
+ in
+ Declare.definition_message fid;
+ Universes.register_universe_binders (ConstRef kn) ubinders;
kn, constr_fip
with Type_errors.TypeError (ctx,te) ->
raise (NotDefinable (BadTypedProj (fid,ctx,te)))
@@ -380,17 +387,20 @@ let structure_signature ctx =
open Typeclasses
-let declare_structure finite univs id idbuild paramimpls params arity template
+let declare_structure finite ubinders univs id idbuild paramimpls params arity template
fieldimpls fields ?(kind=StructureComponent) ?name is_coe coers sign =
let nparams = List.length params and nfields = List.length fields in
let args = Context.Rel.to_extended_list mkRel nfields params in
let ind = applist (mkRel (1+nparams+nfields), args) in
let type_constructor = it_mkProd_or_LetIn ind fields in
- let poly, ctx =
+ let template, ctx =
match univs with
- | Monomorphic_ind_entry ctx -> false, ctx
- | Polymorphic_ind_entry ctx -> true, ctx
- | Cumulative_ind_entry cumi -> true, (Univ.CumulativityInfo.univ_context cumi)
+ | Monomorphic_ind_entry ctx ->
+ template, Monomorphic_const_entry Univ.ContextSet.empty
+ | Polymorphic_ind_entry ctx ->
+ false, Polymorphic_const_entry ctx
+ | Cumulative_ind_entry cumi ->
+ false, Polymorphic_const_entry (Univ.CumulativityInfo.univ_context cumi)
in
let binder_name =
match name with
@@ -400,7 +410,7 @@ let declare_structure finite univs id idbuild paramimpls params arity template
let mie_ind =
{ mind_entry_typename = id;
mind_entry_arity = arity;
- mind_entry_template = not poly && template;
+ mind_entry_template = template;
mind_entry_consnames = [idbuild];
mind_entry_lc = [type_constructor] }
in
@@ -414,27 +424,21 @@ let declare_structure finite univs id idbuild paramimpls params arity template
}
in
let mie =
- if poly then
- begin
+ match ctx with
+ | Polymorphic_const_entry ctx ->
let env = Global.env () in
let env' = Environ.push_context ctx env in
let evd = Evd.from_env env' in
Inductiveops.infer_inductive_subtyping env' evd mie
- end
- else
+ | Monomorphic_const_entry _ ->
mie
in
- let kn = Command.declare_mutual_inductive_with_eliminations mie [] [(paramimpls,[])] in
+ let kn = ComInductive.declare_mutual_inductive_with_eliminations mie ubinders [(paramimpls,[])] in
let rsp = (kn,0) in (* This is ind path of idstruc *)
let cstr = (rsp,1) in
- let fields =
- if poly then
- let subst, _ = Univ.abstract_universes ctx in
- Context.Rel.map (fun c -> Vars.subst_univs_level_constr subst c) fields
- else fields
- in
- let kinds,sp_projs = declare_projections rsp ~kind binder_name coers fieldimpls fields in
+ let kinds,sp_projs = declare_projections rsp ctx ~kind binder_name coers ubinders fieldimpls fields in
let build = ConstructRef cstr in
+ let poly = match ctx with | Polymorphic_const_entry _ -> true | Monomorphic_const_entry _ -> false in
let () = if is_coe then Class.try_add_new_coercion build ~local:false poly in
Recordops.declare_structure(rsp,cstr,List.rev kinds,List.rev sp_projs);
rsp
@@ -448,7 +452,7 @@ let implicits_of_context ctx =
in ExplByPos (i, explname), (true, true, true))
1 (List.rev (Anonymous :: (List.map RelDecl.get_name ctx)))
-let declare_class finite def cum poly ctx id idbuild paramimpls params arity
+let declare_class finite def cum ubinders univs id idbuild paramimpls params arity
template fieldimpls fields ?(kind=StructureComponent) is_coe coers priorities sign =
let fieldimpls =
(* Make the class implicit in the projections, and the params if applicable. *)
@@ -463,27 +467,29 @@ let declare_class finite def cum poly ctx id idbuild paramimpls params arity
let class_body = it_mkLambda_or_LetIn field params in
let class_type = it_mkProd_or_LetIn arity params in
let class_entry =
- Declare.definition_entry ~types:class_type ~poly ~univs:ctx class_body in
+ Declare.definition_entry ~types:class_type ~univs class_body in
let cst = Declare.declare_constant (snd id)
(DefinitionEntry class_entry, IsDefinition Definition)
in
- let cstu = (cst, if poly then Univ.UContext.instance ctx else Univ.Instance.empty) in
+ let cstu = (cst, match univs with
+ | Polymorphic_const_entry univs -> Univ.UContext.instance univs
+ | Monomorphic_const_entry _ -> Univ.Instance.empty)
+ in
let inst_type = appvectc (mkConstU cstu)
(Termops.rel_vect 0 (List.length params)) in
let proj_type =
it_mkProd_or_LetIn (mkProd(Name binder_name, inst_type, lift 1 field)) params in
let proj_body =
it_mkLambda_or_LetIn (mkLambda (Name binder_name, inst_type, mkRel 1)) params in
- let proj_entry =
- Declare.definition_entry ~types:proj_type ~poly
- ~univs:(if poly then ctx else Univ.UContext.empty) proj_body
- in
+ let proj_entry = Declare.definition_entry ~types:proj_type ~univs proj_body in
let proj_cst = Declare.declare_constant proj_name
(DefinitionEntry proj_entry, IsDefinition Definition)
in
let cref = ConstRef cst in
Impargs.declare_manual_implicits false cref [paramimpls];
+ Universes.register_universe_binders cref ubinders;
Impargs.declare_manual_implicits false (ConstRef proj_cst) [List.hd fieldimpls];
+ Universes.register_universe_binders (ConstRef proj_cst) ubinders;
Classes.set_typeclass_transparency (EvalConstRef cst) false false;
let sub = match List.hd coers with
| Some b -> Some ((if b then Backward else Forward), List.hd priorities)
@@ -492,15 +498,16 @@ let declare_class finite def cum poly ctx id idbuild paramimpls params arity
cref, [Name proj_name, sub, Some proj_cst]
| _ ->
let univs =
- if poly then
+ match univs with
+ | Polymorphic_const_entry univs ->
if cum then
- Cumulative_ind_entry (Universes.univ_inf_ind_from_universe_context ctx)
+ Cumulative_ind_entry (Universes.univ_inf_ind_from_universe_context univs)
else
- Polymorphic_ind_entry ctx
- else
- Monomorphic_ind_entry ctx
+ Polymorphic_ind_entry univs
+ | Monomorphic_const_entry univs ->
+ Monomorphic_ind_entry univs
in
- let ind = declare_structure BiFinite univs (snd id) idbuild paramimpls
+ let ind = declare_structure Declarations.BiFinite ubinders univs (snd id) idbuild paramimpls
params arity template fieldimpls fields
~kind:Method ~name:binder_name false (List.map (fun _ -> false) fields) sign
in
@@ -516,18 +523,21 @@ let declare_class finite def cum poly ctx id idbuild paramimpls params arity
let ctx_context =
List.map (fun decl ->
match Typeclasses.class_of_constr Evd.empty (EConstr.of_constr (RelDecl.get_type decl)) with
- | Some (_, ((cl,_), _)) -> Some (cl.cl_impl, true)
+ | Some (_, ((cl,_), _)) -> Some cl.cl_impl
| None -> None)
params, params
in
let univs, ctx_context, fields =
- if poly then
- let usubst, auctx = Univ.abstract_universes ctx in
+ match univs with
+ | Polymorphic_const_entry univs ->
+ let usubst, auctx = Univ.abstract_universes univs in
+ let usubst = Univ.make_instance_subst usubst in
let map c = Vars.subst_univs_level_constr usubst c in
let fields = Context.Rel.map map fields in
let ctx_context = on_snd (fun d -> Context.Rel.map map d) ctx_context in
auctx, ctx_context, fields
- else Univ.AUContext.empty, ctx_context, fields
+ | Monomorphic_const_entry _ ->
+ Univ.AUContext.empty, ctx_context, fields
in
let k =
{ cl_univs = univs;
@@ -603,14 +613,14 @@ let definition_structure (kind,cum,poly,finite,(is_coe,((loc,idstruc),pl)),ps,cf
if isnot_class && List.exists (fun opt -> not (Option.is_empty opt)) priorities then
user_err Pp.(str "Priorities only allowed for type class substructures");
(* Now, younger decl in params and fields is on top *)
- let (pl, ctx), arity, template, implpars, params, implfs, fields =
+ let pl, univs, arity, template, implpars, params, implfs, fields =
States.with_state_protection (fun () ->
- typecheck_params_and_fields finite (kind = Class true) idstruc pl s ps notations fs) () in
+ typecheck_params_and_fields finite (kind = Class true) idstruc poly pl s ps notations fs) () in
let sign = structure_signature (fields@params) in
let gr = match kind with
| Class def ->
let priorities = List.map (fun id -> {hint_priority = id; hint_pattern = None}) priorities in
- let gr = declare_class finite def cum poly ctx (loc,idstruc) idbuild
+ let gr = declare_class finite def cum pl univs (loc,idstruc) idbuild
implpars params arity template implfs fields is_coe coers priorities sign in
gr
| _ ->
@@ -619,18 +629,19 @@ let definition_structure (kind,cum,poly,finite,(is_coe,((loc,idstruc),pl)),ps,cf
(succ (List.length params)) impls) implfs
in
let univs =
- if poly then
+ match univs with
+ | Polymorphic_const_entry univs ->
if cum then
- Cumulative_ind_entry (Universes.univ_inf_ind_from_universe_context ctx)
+ Cumulative_ind_entry (Universes.univ_inf_ind_from_universe_context univs)
else
- Polymorphic_ind_entry ctx
- else
- Monomorphic_ind_entry ctx
+ Polymorphic_ind_entry univs
+ | Monomorphic_const_entry univs ->
+ Monomorphic_ind_entry univs
in
- let ind = declare_structure finite univs idstruc
+ let ind = declare_structure finite pl univs idstruc
idbuild implpars params arity template implfs
fields is_coe (List.map (fun coe -> not (Option.is_empty coe)) coers) sign in
IndRef ind
in
- Universes.register_universe_binders gr pl;
+ Declare.declare_univ_binders gr pl;
gr
diff --git a/vernac/record.mli b/vernac/record.mli
index aea474581..e632e7bbf 100644
--- a/vernac/record.mli
+++ b/vernac/record.mli
@@ -7,39 +7,15 @@
(************************************************************************)
open Names
-open Term
open Vernacexpr
open Constrexpr
-open Impargs
open Globnames
val primitive_flag : bool ref
-(** [declare_projections ref name coers params fields] declare projections of
- record [ref] (if allowed) using the given [name] as argument, and put them
- as coercions accordingly to [coers]; it returns the absolute names of projections *)
-
-val declare_projections :
- inductive -> ?kind:Decl_kinds.definition_object_kind -> Id.t ->
- coercion_flag list -> manual_explicitation list list -> Context.Rel.t ->
- (Name.t * bool) list * constant option list
-
-val declare_structure :
- Decl_kinds.recursivity_kind ->
- Entries.inductive_universes ->
- Id.t -> Id.t ->
- manual_explicitation list -> Context.Rel.t -> (** params *) constr -> (** arity *)
- bool (** template arity ? *) ->
- Impargs.manual_explicitation list list -> Context.Rel.t -> (** fields *)
- ?kind:Decl_kinds.definition_object_kind -> ?name:Id.t ->
- bool -> (** coercion? *)
- bool list -> (** field coercions *)
- Evd.evar_map ->
- inductive
-
val definition_structure :
inductive_kind * Decl_kinds.cumulative_inductive_flag * Decl_kinds.polymorphic *
- Decl_kinds.recursivity_kind * ident_decl with_coercion * local_binder_expr list *
+ Declarations.recursivity_kind * ident_decl with_coercion * local_binder_expr list *
(local_decl_expr with_instance with_priority with_notation) list *
Id.t * constr_expr option -> global_reference
diff --git a/vernac/search.ml b/vernac/search.ml
index 0f56f81e7..6da6a0c2d 100644
--- a/vernac/search.ml
+++ b/vernac/search.ml
@@ -9,7 +9,7 @@
open Pp
open Util
open Names
-open Term
+open Constr
open Declarations
open Libobject
open Environ
diff --git a/vernac/search.mli b/vernac/search.mli
index db54d732b..2eda3980a 100644
--- a/vernac/search.mli
+++ b/vernac/search.mli
@@ -7,7 +7,7 @@
(************************************************************************)
open Names
-open Term
+open Constr
open Environ
open Pattern
open Globnames
diff --git a/vernac/topfmt.ml b/vernac/topfmt.ml
index 6a10eb43a..7e96f28de 100644
--- a/vernac/topfmt.ml
+++ b/vernac/topfmt.ml
@@ -288,7 +288,6 @@ let init_terminal_output ~color =
*)
let emacs_logger = gen_logger Emacs.quote_info Emacs.quote_warning
-
(* This is specific to the toplevel *)
let pr_loc loc =
let fname = loc.Loc.fname in
@@ -311,17 +310,23 @@ let print_err_exn ?extra any =
std_logger ~pre_hdr Feedback.Error msg
let with_output_to_file fname func input =
- (* XXX FIXME: redirect std_ft *)
- (* let old_logger = !logger in *)
let channel = open_out (String.concat "." [fname; "out"]) in
- (* logger := ft_logger old_logger (Format.formatter_of_out_channel channel); *)
+ let old_fmt = !std_ft, !err_ft, !deep_ft in
+ let new_ft = Format.formatter_of_out_channel channel in
+ std_ft := new_ft;
+ err_ft := new_ft;
+ deep_ft := new_ft;
try
let output = func input in
- (* logger := old_logger; *)
+ std_ft := Util.pi1 old_fmt;
+ err_ft := Util.pi2 old_fmt;
+ deep_ft := Util.pi3 old_fmt;
close_out channel;
output
with reraise ->
let reraise = Backtrace.add_backtrace reraise in
- (* logger := old_logger; *)
+ std_ft := Util.pi1 old_fmt;
+ err_ft := Util.pi2 old_fmt;
+ deep_ft := Util.pi3 old_fmt;
close_out channel;
Exninfo.iraise reraise
diff --git a/vernac/vernac.mllib b/vernac/vernac.mllib
index 850902d6b..f001b572a 100644
--- a/vernac/vernac.mllib
+++ b/vernac/vernac.mllib
@@ -11,10 +11,15 @@ Search
Indschemes
DeclareDef
Obligations
-Command
+ComDefinition
+ComAssumption
+ComInductive
+ComFixpoint
+ComProgramFixpoint
Classes
Record
Assumptions
+Vernacstate
Vernacinterp
Mltop
Topfmt
diff --git a/vernac/vernacentries.ml b/vernac/vernacentries.ml
index 41f63644d..be09696d1 100644
--- a/vernac/vernacentries.ml
+++ b/vernac/vernacentries.ml
@@ -18,7 +18,6 @@ open Tacmach
open Constrintern
open Prettyp
open Printer
-open Command
open Goptions
open Libnames
open Globnames
@@ -29,6 +28,7 @@ open Redexpr
open Lemmas
open Misctypes
open Locality
+open Vernacinterp
module NamedDecl = Context.Named.Declaration
@@ -56,20 +56,19 @@ let scope_class_of_qualid qid =
let show_proof () =
(* spiwack: this would probably be cooler with a bit of polishing. *)
let p = Proof_global.give_me_the_proof () in
+ let sigma, env = Pfedit.get_current_context () in
let pprf = Proof.partial_proof p in
- Feedback.msg_notice (Pp.prlist_with_sep Pp.fnl Printer.pr_econstr pprf)
+ Feedback.msg_notice (Pp.prlist_with_sep Pp.fnl (Printer.pr_econstr_env env sigma) pprf)
let show_top_evars () =
(* spiwack: new as of Feb. 2010: shows goal evars in addition to non-goal evars. *)
let pfts = Proof_global.give_me_the_proof () in
- let gls = Proof.V82.subgoals pfts in
- let sigma = gls.Evd.sigma in
+ let gls,_,_,_,sigma = Proof.proof pfts in
Feedback.msg_notice (pr_evars_int sigma 1 (Evd.undefined_map sigma))
let show_universes () =
let pfts = Proof_global.give_me_the_proof () in
- let gls = Proof.V82.subgoals pfts in
- let sigma = gls.Evd.sigma in
+ let gls,_,_,_,sigma = Proof.proof pfts in
let ctx = Evd.universe_context_set (Evd.nf_constraints sigma) in
Feedback.msg_notice (Termops.pr_evar_universe_context (Evd.evar_universe_context sigma));
Feedback.msg_notice (str"Normalized constraints: " ++ Univ.pr_universe_context_set (Termops.pr_evd_level sigma) ctx)
@@ -78,16 +77,16 @@ let show_universes () =
let show_intro all =
let open EConstr in
let pf = Proof_global.give_me_the_proof() in
- let {Evd.it=gls ; sigma=sigma; } = Proof.V82.subgoals pf in
+ let gls,_,_,_,sigma = Proof.proof pf in
if not (List.is_empty gls) then begin
let gl = {Evd.it=List.hd gls ; sigma = sigma; } in
let l,_= decompose_prod_assum sigma (Termops.strip_outer_cast sigma (pf_concl gl)) in
if all then
let lid = Tactics.find_intro_names l gl in
- Feedback.msg_notice (hov 0 (prlist_with_sep spc pr_id lid))
+ Feedback.msg_notice (hov 0 (prlist_with_sep spc Id.print lid))
else if not (List.is_empty l) then
let n = List.last l in
- Feedback.msg_notice (pr_id (List.hd (Tactics.find_intro_names [n] gl)))
+ Feedback.msg_notice (Id.print (List.hd (Tactics.find_intro_names [n] gl)))
end
(** Prepare a "match" template for a given inductive type.
@@ -153,8 +152,8 @@ let show_match id =
(* "Print" commands *)
let print_path_entry p =
- let dir = pr_dirpath (Loadpath.logical p) in
- let path = str (Loadpath.physical p) in
+ 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 =
@@ -176,9 +175,9 @@ let print_modules () =
let loaded_opened = List.intersect DirPath.equal opened loaded
and only_loaded = List.subtract DirPath.equal loaded opened in
str"Loaded and imported library files: " ++
- pr_vertical_list pr_dirpath loaded_opened ++ fnl () ++
+ pr_vertical_list DirPath.print loaded_opened ++ fnl () ++
str"Loaded and not imported library files: " ++
- pr_vertical_list pr_dirpath only_loaded
+ pr_vertical_list DirPath.print only_loaded
let print_module r =
@@ -186,8 +185,8 @@ let print_module r =
try
let globdir = Nametab.locate_dir qid in
match globdir with
- DirModule (dirpath,(mp,_)) ->
- Feedback.msg_notice (Printmod.print_module (Printmod.printable_body dirpath) mp)
+ DirModule { obj_dir; obj_mp; _ } ->
+ Feedback.msg_notice (Printmod.print_module (Printmod.printable_body obj_dir) obj_mp)
| _ -> raise Not_found
with
Not_found -> Feedback.msg_error (str"Unknown Module " ++ pr_qualid qid)
@@ -250,14 +249,15 @@ let print_namespace ns =
let print_list pr l = prlist_with_sep (fun () -> str".") pr l in
let print_kn kn =
(* spiwack: I'm ignoring the dirpath, is that bad? *)
- let (mp,_,lbl) = Names.repr_kn kn in
+ let (mp,_,lbl) = Names.KerName.repr kn in
let qn = (qualified_minus (List.length ns) mp)@[Names.Label.to_id lbl] in
- print_list pr_id qn
+ print_list Id.print qn
in
let print_constant k body =
(* FIXME: universes *)
let t = body.Declarations.const_type in
- print_kn k ++ str":" ++ spc() ++ Printer.pr_type t
+ let sigma, env = Pfedit.get_current_context () in
+ print_kn k ++ str":" ++ spc() ++ Printer.pr_type_env env sigma t
in
let matches mp = match match_modulepath ns mp with
| Some [] -> true
@@ -265,14 +265,14 @@ let print_namespace ns =
let constants = (Environ.pre_env (Global.env ())).Pre_env.env_globals.Pre_env.env_constants in
let constants_in_namespace =
Cmap_env.fold (fun c (body,_) acc ->
- let kn = user_con c in
- if matches (modpath kn) then
+ let kn = Constant.user c in
+ if matches (KerName.modpath kn) then
acc++fnl()++hov 2 (print_constant kn body)
else
acc
) constants (str"")
in
- Feedback.msg_notice ((print_list pr_id ns)++str":"++fnl()++constants_in_namespace)
+ Feedback.msg_notice ((print_list Id.print ns)++str":"++fnl()++constants_in_namespace)
let print_strategy r =
let open Conv_oracle in
@@ -361,29 +361,29 @@ let locate_file f =
let msg_found_library = function
| Library.LibLoaded, fulldir, file ->
Feedback.msg_info (hov 0
- (pr_dirpath fulldir ++ strbrk " has been loaded from file " ++
+ (DirPath.print fulldir ++ strbrk " has been loaded from file " ++
str file))
| Library.LibInPath, fulldir, file ->
Feedback.msg_info (hov 0
- (pr_dirpath fulldir ++ strbrk " is bound to file " ++ str file))
+ (DirPath.print fulldir ++ strbrk " is bound to file " ++ str file))
let err_unmapped_library ?loc ?from qid =
let dir = fst (repr_qualid qid) in
let prefix = match from with
| None -> str "."
| Some from ->
- str " and prefix " ++ pr_dirpath from ++ str "."
+ str " and prefix " ++ DirPath.print from ++ str "."
in
user_err ?loc
~hdr:"locate_library"
(strbrk "Cannot find a physical path bound to logical path matching suffix " ++
- pr_dirpath dir ++ prefix)
+ DirPath.print dir ++ prefix)
let err_notfound_library ?loc ?from qid =
let prefix = match from with
| None -> str "."
| Some from ->
- str " with prefix " ++ pr_dirpath from ++ str "."
+ str " with prefix " ++ DirPath.print from ++ str "."
in
user_err ?loc ~hdr:"locate_library"
(strbrk "Unable to locate library " ++ pr_qualid qid ++ prefix)
@@ -408,8 +408,8 @@ let dump_global r =
(**********)
(* Syntax *)
-let vernac_syntax_extension locality local infix l =
- let local = enforce_module_locality locality local in
+let vernac_syntax_extension atts infix l =
+ let local = enforce_module_locality atts.locality in
if infix then Metasyntax.check_infix_modifiers (snd l);
Metasyntax.add_syntax_extension local l
@@ -420,20 +420,20 @@ let vernac_delimiters sc = function
let vernac_bind_scope sc cll =
Metasyntax.add_class_scope sc (List.map scope_class_of_qualid cll)
-let vernac_open_close_scope locality local (b,s) =
- let local = enforce_section_locality locality local in
+let vernac_open_close_scope ~atts (b,s) =
+ let local = enforce_section_locality atts.locality in
Notation.open_close_scope (local,b,s)
-let vernac_arguments_scope locality r scl =
- let local = make_section_locality locality in
+let vernac_arguments_scope ~atts r scl =
+ let local = make_section_locality atts.locality in
Notation.declare_arguments_scope local (smart_global r) scl
-let vernac_infix locality local =
- let local = enforce_module_locality locality local in
+let vernac_infix ~atts =
+ let local = enforce_module_locality atts.locality in
Metasyntax.add_infix local (Global.env())
-let vernac_notation locality local =
- let local = enforce_module_locality locality local in
+let vernac_notation ~atts =
+ let local = enforce_module_locality atts.locality in
Metasyntax.add_notation local (Global.env())
(***********)
@@ -471,33 +471,41 @@ let vernac_definition_hook p = function
| SubClass -> Class.add_subclass_hook p
| _ -> no_hook
-let vernac_definition locality p (local,k) ((loc,id as lid),pl) def =
- let local = enforce_locality_exp locality local in
- let hook = vernac_definition_hook p k in
- let () = match local with
- | Discharge -> Dumpglob.dump_definition lid true "var"
- | Local | Global -> Dumpglob.dump_definition lid false "def"
+let vernac_definition ~atts discharge kind ((loc, id), pl) def =
+ let local = enforce_locality_exp atts.locality discharge in
+ let hook = vernac_definition_hook atts.polymorphic kind in
+ let () =
+ match id with
+ | Anonymous -> ()
+ | Name n -> let lid = (loc, n) in
+ match local with
+ | Discharge -> Dumpglob.dump_definition lid true "var"
+ | Local | Global -> Dumpglob.dump_definition lid false "def"
+ in
+ let program_mode = Flags.is_program_mode () in
+ let name =
+ match id with
+ | Anonymous -> fresh_name_for_anonymous_theorem ()
+ | Name n -> n
in
(match def with
| ProveBody (bl,t) -> (* local binders, typ *)
- start_proof_and_print (local,p,DefinitionBody k)
- [Some (lid,pl), (bl,t)] hook
+ start_proof_and_print (local, atts.polymorphic, DefinitionBody kind)
+ [((loc, name), pl), (bl, t)] hook
| DefineBody (bl,red_option,c,typ_opt) ->
- let red_option = match red_option with
+ let red_option = match red_option with
| None -> None
| Some r ->
- let (evc,env)= get_current_context () in
- Some (snd (Hook.get f_interp_redexp env evc r)) in
- do_definition id (local,p,k) pl bl red_option c typ_opt hook)
+ let sigma, env = Pfedit.get_current_context () in
+ Some (snd (Hook.get f_interp_redexp env sigma r)) in
+ ComDefinition.do_definition ~program_mode name
+ (local, atts.polymorphic, kind) pl bl red_option c typ_opt hook)
-let vernac_start_proof locality p kind l =
- let local = enforce_locality_exp locality None in
+let vernac_start_proof ~atts kind l =
+ let local = enforce_locality_exp atts.locality NoDischarge in
if Dumpglob.dump () then
- List.iter (fun (id, _) ->
- match id with
- | Some (lid,_) -> Dumpglob.dump_definition lid false "prf"
- | None -> ()) l;
- start_proof_and_print (local, p, Proof kind) l no_hook
+ List.iter (fun ((id, _), _) -> Dumpglob.dump_definition id false "prf") l;
+ start_proof_and_print (local, atts.polymorphic, Proof kind) l no_hook
let vernac_end_proof ?proof = function
| Admitted -> save_proof ?proof Admitted
@@ -510,16 +518,16 @@ let vernac_exact_proof c =
save_proof (Vernacexpr.(Proved(Opaque,None)));
if not status then Feedback.feedback Feedback.AddedAxiom
-let vernac_assumption locality poly (local, kind) l nl =
- let local = enforce_locality_exp locality local in
+let vernac_assumption ~atts discharge kind l nl =
+ let local = enforce_locality_exp atts.locality discharge in
let global = local == Global in
- let kind = local, poly, kind in
+ let kind = local, atts.polymorphic, kind in
List.iter (fun (is_coe,(idl,c)) ->
if Dumpglob.dump () then
List.iter (fun (lid, _) ->
if global then Dumpglob.dump_definition lid false "ax"
else Dumpglob.dump_definition lid true "var") idl) l;
- let status = do_assumptions kind nl l in
+ let status = ComAssumption.do_assumptions kind nl l in
if not status then Feedback.feedback Feedback.AddedAxiom
let should_treat_as_cumulative cum poly =
@@ -553,8 +561,8 @@ let vernac_record cum k poly finite struc binders sort nameopt cfs =
then the type is declared private (as per the [Private] keyword). [finite]
indicates whether the type is inductive, co-inductive or
neither. *)
-let vernac_inductive cum poly lo finite indl =
- let is_cumulative = should_treat_as_cumulative cum poly in
+let vernac_inductive ~atts cum lo finite indl =
+ let is_cumulative = should_treat_as_cumulative cum atts.polymorphic in
if Dumpglob.dump () then
List.iter (fun (((coe,(lid,_)), _, _, _, cstrs), _) ->
match cstrs with
@@ -571,13 +579,13 @@ let vernac_inductive cum poly lo finite indl =
user_err Pp.(str "The Variant keyword does not support syntax { ... }.")
| [ ( id , bl , c , b, RecordDecl (oc,fs) ), [] ] ->
vernac_record cum (match b with Class _ -> Class false | _ -> b)
- poly finite id bl c oc fs
+ atts.polymorphic finite id bl c oc fs
| [ ( id , bl , c , Class _, Constructors [l]), [] ] ->
let f =
let (coe, ((loc, id), ce)) = l in
let coe' = if coe then Some true else None in
(((coe', AssumExpr ((loc, Name id), ce)), None), [])
- in vernac_record cum (Class true) poly finite id bl c None [f]
+ in vernac_record cum (Class true) atts.polymorphic finite id bl c None [f]
| [ ( _ , _, _, Class _, Constructors _), [] ] ->
user_err Pp.(str "Inductive classes not supported")
| [ ( id , bl , c , Class _, _), _ :: _ ] ->
@@ -591,19 +599,30 @@ let vernac_inductive cum poly lo finite indl =
| _ -> user_err Pp.(str "Cannot handle mutually (co)inductive records.")
in
let indl = List.map unpack indl in
- do_mutual_inductive indl is_cumulative poly lo finite
+ ComInductive.do_mutual_inductive indl is_cumulative atts.polymorphic lo finite
-let vernac_fixpoint locality poly local l =
- let local = enforce_locality_exp locality local in
+let vernac_fixpoint ~atts discharge l =
+ let local = enforce_locality_exp atts.locality discharge in
if Dumpglob.dump () then
List.iter (fun (((lid,_), _, _, _, _), _) -> Dumpglob.dump_definition lid false "def") l;
- do_fixpoint local poly l
+ (* XXX: Switch to the attribute system and match on ~atts *)
+ let do_fixpoint = if Flags.is_program_mode () then
+ ComProgramFixpoint.do_fixpoint
+ else
+ ComFixpoint.do_fixpoint
+ in
+ do_fixpoint local atts.polymorphic l
-let vernac_cofixpoint locality poly local l =
- let local = enforce_locality_exp locality local in
+let vernac_cofixpoint ~atts discharge l =
+ let local = enforce_locality_exp atts.locality discharge in
if Dumpglob.dump () then
List.iter (fun (((lid,_), _, _, _), _) -> Dumpglob.dump_definition lid false "def") l;
- do_cofixpoint local poly l
+ let do_cofixpoint = if Flags.is_program_mode () then
+ ComProgramFixpoint.do_cofixpoint
+ else
+ ComFixpoint.do_cofixpoint
+ in
+ do_cofixpoint local atts.polymorphic l
let vernac_scheme l =
if Dumpglob.dump () then
@@ -621,19 +640,19 @@ let vernac_combined_scheme lid l =
List.iter (fun lid -> dump_global (Misctypes.AN (Ident lid))) l);
Indschemes.do_combined_scheme lid l
-let vernac_universe loc poly l =
- if poly && not (Lib.sections_are_opened ()) then
- user_err ?loc ~hdr:"vernac_universe"
+let vernac_universe ~atts l =
+ if atts.polymorphic && not (Lib.sections_are_opened ()) then
+ user_err ?loc:atts.loc ~hdr:"vernac_universe"
(str"Polymorphic universes can only be declared inside sections, " ++
str "use Monomorphic Universe instead");
- do_universe poly l
+ Declare.do_universe atts.polymorphic l
-let vernac_constraint loc poly l =
- if poly && not (Lib.sections_are_opened ()) then
- user_err ?loc ~hdr:"vernac_constraint"
+let vernac_constraint ~atts l =
+ if atts.polymorphic && not (Lib.sections_are_opened ()) then
+ user_err ?loc:atts.loc ~hdr:"vernac_constraint"
(str"Polymorphic universe constraints can only be declared"
++ str " inside sections, use Monomorphic Constraint instead");
- do_constraint poly l
+ Declare.do_constraint atts.polymorphic l
(**********************)
(* Modules *)
@@ -656,7 +675,7 @@ let vernac_declare_module export (loc, id) binders_ast mty_ast =
id binders_ast (Enforce mty_ast) []
in
Dumpglob.dump_moddef ?loc mp "mod";
- Flags.if_verbose Feedback.msg_info (str "Module " ++ pr_id id ++ str " is declared");
+ Flags.if_verbose Feedback.msg_info (str "Module " ++ Id.print id ++ str " is declared");
Option.iter (fun export -> vernac_import export [Ident (Loc.tag id)]) export
let vernac_define_module export (loc, id) binders_ast mty_ast_o mexpr_ast_l =
@@ -678,7 +697,7 @@ let vernac_define_module export (loc, id) binders_ast mty_ast_o mexpr_ast_l =
in
Dumpglob.dump_moddef ?loc mp "mod";
Flags.if_verbose Feedback.msg_info
- (str "Interactive Module " ++ pr_id id ++ str " started");
+ (str "Interactive Module " ++ Id.print id ++ str " started");
List.iter
(fun (export,id) ->
Option.iter
@@ -696,14 +715,14 @@ let vernac_define_module export (loc, id) binders_ast mty_ast_o mexpr_ast_l =
in
Dumpglob.dump_moddef ?loc mp "mod";
Flags.if_verbose Feedback.msg_info
- (str "Module " ++ pr_id id ++ str " is defined");
+ (str "Module " ++ Id.print id ++ str " is defined");
Option.iter (fun export -> vernac_import export [Ident (Loc.tag id)])
export
let vernac_end_module export (loc,id as lid) =
let mp = Declaremods.end_module () in
Dumpglob.dump_modref ?loc mp "mod";
- Flags.if_verbose Feedback.msg_info (str "Module " ++ pr_id id ++ str " is defined");
+ Flags.if_verbose Feedback.msg_info (str "Module " ++ Id.print id ++ str " is defined");
Option.iter (fun export -> vernac_import export [Ident lid]) export
let vernac_declare_module_type (loc,id) binders_ast mty_sign mty_ast_l =
@@ -725,7 +744,7 @@ let vernac_declare_module_type (loc,id) binders_ast mty_sign mty_ast_l =
in
Dumpglob.dump_moddef ?loc mp "modtype";
Flags.if_verbose Feedback.msg_info
- (str "Interactive Module Type " ++ pr_id id ++ str " started");
+ (str "Interactive Module Type " ++ Id.print id ++ str " started");
List.iter
(fun (export,id) ->
Option.iter
@@ -744,12 +763,12 @@ let vernac_declare_module_type (loc,id) binders_ast mty_sign mty_ast_l =
in
Dumpglob.dump_moddef ?loc mp "modtype";
Flags.if_verbose Feedback.msg_info
- (str "Module Type " ++ pr_id id ++ str " is defined")
+ (str "Module Type " ++ Id.print id ++ str " is defined")
let vernac_end_modtype (loc,id) =
let mp = Declaremods.end_modtype () in
Dumpglob.dump_modref ?loc mp "modtype";
- Flags.if_verbose Feedback.msg_info (str "Module Type " ++ pr_id id ++ str " is defined")
+ Flags.if_verbose Feedback.msg_info (str "Module Type " ++ Id.print id ++ str " is defined")
let vernac_include l =
Declaremods.declare_include Modintern.interp_module_ast l
@@ -811,32 +830,33 @@ let vernac_require from import qidl =
let vernac_canonical r =
Recordops.declare_canonical_structure (smart_global r)
-let vernac_coercion locality poly local ref qids qidt =
- let local = enforce_locality locality local in
+let vernac_coercion ~atts ref qids qidt =
+ let local = enforce_locality atts.locality in
let target = cl_of_qualid qidt in
let source = cl_of_qualid qids in
let ref' = smart_global ref in
- Class.try_add_new_coercion_with_target ref' ~local poly ~source ~target;
+ Class.try_add_new_coercion_with_target ref' ~local atts.polymorphic ~source ~target;
Flags.if_verbose Feedback.msg_info (pr_global ref' ++ str " is now a coercion")
-let vernac_identity_coercion locality poly local id qids qidt =
- let local = enforce_locality locality local in
+let vernac_identity_coercion ~atts id qids qidt =
+ let local = enforce_locality atts.locality in
let target = cl_of_qualid qidt in
let source = cl_of_qualid qids in
- Class.try_add_new_identity_coercion id ~local poly ~source ~target
+ Class.try_add_new_identity_coercion id ~local atts.polymorphic ~source ~target
(* Type classes *)
-let vernac_instance abst locality poly sup inst props pri =
- let global = not (make_section_locality locality) in
+let vernac_instance ~atts abst sup inst props pri =
+ let global = not (make_section_locality atts.locality) in
Dumpglob.dump_constraint inst false "inst";
- ignore(Classes.new_instance ~abstract:abst ~global poly sup inst props pri)
+ let program_mode = Flags.is_program_mode () in
+ ignore(Classes.new_instance ~program_mode ~abstract:abst ~global atts.polymorphic sup inst props pri)
-let vernac_context poly l =
- if not (Classes.context poly l) then Feedback.feedback Feedback.AddedAxiom
+let vernac_context ~atts l =
+ if not (Classes.context atts.polymorphic l) then Feedback.feedback Feedback.AddedAxiom
-let vernac_declare_instances locality insts =
- let glob = not (make_section_locality locality) in
+let vernac_declare_instances ~atts insts =
+ let glob = not (make_section_locality atts.locality) in
List.iter (fun (id, info) -> Classes.existing_instance glob id (Some info)) insts
let vernac_declare_class id =
@@ -874,7 +894,7 @@ let vernac_set_used_variables e =
List.iter (fun id ->
if not (List.exists (NamedDecl.get_id %> Id.equal id) vars) then
user_err ~hdr:"vernac_set_used_variables"
- (str "Unknown variable: " ++ pr_id id))
+ (str "Unknown variable: " ++ Id.print id))
l;
let _, to_clear = Proof_global.set_used_variables l in
let to_clear = List.map snd to_clear in
@@ -892,9 +912,11 @@ 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 pdir = expand pdir in
- let alias = Option.default Nameops.default_root_prefix ldiropt in
- Mltop.add_rec_path Mltop.AddTopML ~unix_path:pdir ~coq_root:alias ~implicit
+ let alias = Option.default Libnames.default_root_prefix ldiropt in
+ add_coq_path { recursive = true;
+ path_spec = VoPath { unix_path = pdir; coq_path = alias; has_ml = AddTopML; implicit } }
let vernac_remove_loadpath path =
Loadpath.remove_load_path (expand path)
@@ -902,10 +924,11 @@ let vernac_remove_loadpath path =
(* Coq syntax for ML or system commands *)
let vernac_add_ml_path isrec path =
- (if isrec then Mltop.add_rec_ml_dir else Mltop.add_ml_dir) (expand path)
+ let open Mltop in
+ add_coq_path { recursive = isrec; path_spec = MlPath (expand path) }
-let vernac_declare_ml_module locality l =
- let local = make_locality locality in
+let vernac_declare_ml_module ~atts l =
+ let local = make_locality atts.locality in
Mltop.declare_ml_modules local (List.map expand l)
let vernac_chdir = function
@@ -938,25 +961,25 @@ let vernac_restore_state file =
(************)
(* Commands *)
-let vernac_create_hintdb locality id b =
- let local = make_module_locality locality in
+let vernac_create_hintdb ~atts id b =
+ let local = make_module_locality atts.locality in
Hints.create_hint_db local id full_transparent_state b
-let vernac_remove_hints locality dbs ids =
- let local = make_module_locality locality in
+let vernac_remove_hints ~atts dbs ids =
+ let local = make_module_locality atts.locality in
Hints.remove_hints local dbs (List.map Smartlocate.global_with_alias ids)
-let vernac_hints locality poly local lb h =
- let local = enforce_module_locality locality local in
- Hints.add_hints local lb (Hints.interp_hints poly h)
+let vernac_hints ~atts lb h =
+ let local = enforce_module_locality atts.locality in
+ Hints.add_hints local lb (Hints.interp_hints atts.polymorphic h)
-let vernac_syntactic_definition locality lid x local y =
+let vernac_syntactic_definition ~atts lid x y =
Dumpglob.dump_definition lid false "syndef";
- let local = enforce_module_locality locality local in
+ let local = enforce_module_locality atts.locality in
Metasyntax.add_syntactic_definition (Global.env()) (snd lid) x local y
-let vernac_declare_implicits locality r l =
- let local = make_section_locality locality in
+let vernac_declare_implicits ~atts r l =
+ let local = make_section_locality atts.locality in
match l with
| [] ->
Impargs.declare_implicits local (smart_global r)
@@ -976,7 +999,7 @@ let warn_arguments_assert =
(* [nargs_for_red] is the number of arguments required to trigger reduction,
[args] is the main list of arguments statuses,
[more_implicits] is a list of extra lists of implicit statuses *)
-let vernac_arguments locality reference args more_implicits nargs_for_red flags =
+let vernac_arguments ~atts reference args more_implicits nargs_for_red flags =
let assert_flag = List.mem `Assert flags in
let rename_flag = List.mem `Rename flags in
let clear_scopes_flag = List.mem `ClearScopes flags in
@@ -1184,7 +1207,7 @@ let vernac_arguments locality reference args more_implicits nargs_for_red flags
(* Actions *)
if renaming_specified then begin
- let local = make_section_locality locality in
+ let local = make_section_locality atts.locality in
Arguments_renaming.rename_arguments local sr names
end;
@@ -1194,20 +1217,20 @@ let vernac_arguments locality reference args more_implicits nargs_for_red flags
with UserError _ ->
Notation.find_delimiters_scope ?loc k)) scopes
in
- vernac_arguments_scope locality reference scopes
+ vernac_arguments_scope ~atts reference scopes
end;
if implicits_specified || clear_implicits_flag then
- vernac_declare_implicits locality reference implicits;
+ vernac_declare_implicits ~atts reference implicits;
if default_implicits_flag then
- vernac_declare_implicits locality reference [];
+ vernac_declare_implicits ~atts reference [];
if red_modifiers_specified then begin
match sr with
| ConstRef _ as c ->
Reductionops.ReductionBehaviour.set
- (make_section_locality locality) c
+ (make_section_locality atts.locality) c
(rargs, Option.default ~-1 nargs_for_red, red_flags)
| _ -> user_err
(strbrk "Modifiers of the behavior of the simpl tactic "++
@@ -1235,8 +1258,8 @@ let vernac_reserve bl =
Reserve.declare_reserved_type idl t)
in List.iter sb_decl bl
-let vernac_generalizable locality =
- let local = make_non_locality locality in
+let vernac_generalizable ~atts =
+ let local = make_non_locality atts.locality in
Implicit_quantifiers.declare_generalizable local
let _ =
@@ -1367,11 +1390,13 @@ let _ =
optread = (fun () -> !Flags.program_mode);
optwrite = (fun b -> Flags.program_mode:=b) }
+let universe_polymorphism_option_name = ["Universe"; "Polymorphism"]
+
let _ =
declare_bool_option
{ optdepr = false;
optname = "universe polymorphism";
- optkey = ["Universe"; "Polymorphism"];
+ optkey = universe_polymorphism_option_name;
optread = Flags.is_universe_polymorphism;
optwrite = Flags.make_universe_polymorphism }
@@ -1473,8 +1498,8 @@ let _ =
optread = Nativenorm.get_profiling_enabled;
optwrite = Nativenorm.set_profiling_enabled }
-let vernac_set_strategy locality l =
- let local = make_locality locality in
+let vernac_set_strategy ~atts l =
+ let local = make_locality atts.locality in
let glob_ref r =
match smart_global r with
| ConstRef sp -> EvalConstRef sp
@@ -1484,8 +1509,8 @@ let vernac_set_strategy locality l =
let l = List.map (fun (lev,ql) -> (lev,List.map glob_ref ql)) l in
Redexpr.set_strategy local l
-let vernac_set_opacity locality (v,l) =
- let local = make_non_locality locality in
+let vernac_set_opacity ~atts (v,l) =
+ let local = make_non_locality atts.locality in
let glob_ref r =
match smart_global r with
| ConstRef sp -> EvalConstRef sp
@@ -1495,18 +1520,18 @@ let vernac_set_opacity locality (v,l) =
let l = List.map glob_ref l in
Redexpr.set_strategy local [v,l]
-let vernac_set_option locality key = function
- | StringValue s -> set_string_option_value_gen locality key s
- | StringOptValue (Some s) -> set_string_option_value_gen locality key s
- | StringOptValue None -> unset_option_value_gen locality key
- | IntValue n -> set_int_option_value_gen locality key n
- | BoolValue b -> set_bool_option_value_gen locality key b
+let vernac_set_option ~atts key = function
+ | StringValue s -> set_string_option_value_gen atts.locality key s
+ | StringOptValue (Some s) -> set_string_option_value_gen atts.locality key s
+ | StringOptValue None -> unset_option_value_gen atts.locality key
+ | IntValue n -> set_int_option_value_gen atts.locality key n
+ | BoolValue b -> set_bool_option_value_gen atts.locality key b
-let vernac_set_append_option locality key s =
- set_string_option_append_value_gen locality key s
+let vernac_set_append_option ~atts key s =
+ set_string_option_append_value_gen atts.locality key s
-let vernac_unset_option locality key =
- unset_option_value_gen locality key
+let vernac_unset_option ~atts key =
+ unset_option_value_gen atts.locality key
let vernac_add_option key lv =
let f = function
@@ -1539,7 +1564,7 @@ let vernac_print_option key =
let get_current_context_of_args = function
| Some n -> Pfedit.get_goal_context n
- | None -> get_current_context ()
+ | None -> Pfedit.get_current_context ()
let query_command_selector ?loc = function
| None -> None
@@ -1547,16 +1572,16 @@ let query_command_selector ?loc = function
| _ -> user_err ?loc ~hdr:"query_command_selector"
(str "Query commands only support the single numbered goal selector.")
-let vernac_check_may_eval ?loc redexp glopt rc =
- let glopt = query_command_selector ?loc glopt in
+let vernac_check_may_eval ~atts redexp glopt rc =
+ let glopt = query_command_selector ?loc:atts.loc glopt in
let (sigma, env) = get_current_context_of_args glopt in
let sigma', c = interp_open_constr env sigma rc in
let c = EConstr.Unsafe.to_constr c in
let sigma' = Evarconv.solve_unif_constraints_with_heuristics env sigma' in
Evarconv.check_problems_are_solved env sigma';
let sigma',nf = Evarutil.nf_evars_and_universes sigma' in
- let pl, uctx = Evd.universe_context ~names:[] ~extensible:true sigma' in
- let env = Environ.push_context uctx (Evarutil.nf_env_evar sigma' env) in
+ let uctx = Evd.universe_context_set sigma' in
+ let env = Environ.push_context_set uctx (Evarutil.nf_env_evar sigma' env) in
let c = nf c in
let j =
if Evarutil.has_undefined_evars sigma' (EConstr.of_constr c) then
@@ -1569,10 +1594,10 @@ let vernac_check_may_eval ?loc redexp glopt rc =
| None ->
let evars_of_term c = Evarutil.undefined_evars_of_term sigma' c in
let l = Evar.Set.union (evars_of_term j.Environ.uj_val) (evars_of_term j.Environ.uj_type) in
- let j = { j with Environ.uj_type = Reductionops.nf_betaiota sigma' j.Environ.uj_type } in
+ let j = { j with Environ.uj_type = Reductionops.nf_betaiota env sigma' j.Environ.uj_type } in
Feedback.msg_notice (print_judgment env sigma' j ++
pr_ne_evar_set (fnl () ++ str "where" ++ fnl ()) (mt ()) sigma' l ++
- Printer.pr_universe_ctx sigma uctx)
+ Printer.pr_universe_ctx_set sigma uctx)
| Some r ->
let (sigma',r_interp) = Hook.get f_interp_redexp env sigma' r in
let redfun env evm c =
@@ -1582,26 +1607,27 @@ let vernac_check_may_eval ?loc redexp glopt rc =
in
Feedback.msg_notice (print_eval redfun env sigma' rc j)
-let vernac_declare_reduction locality s r =
- let local = make_locality locality in
+let vernac_declare_reduction ~atts s r =
+ let local = make_locality atts.locality in
declare_red_expr local s (snd (Hook.get f_interp_redexp (Global.env()) Evd.empty r))
(* The same but avoiding the current goal context if any *)
let vernac_global_check c =
let env = Global.env() in
let sigma = Evd.from_env env in
- let c,ctx = interp_constr env sigma c in
+ let c,uctx = interp_constr env sigma c in
let senv = Global.safe_env() in
- let cstrs = snd (UState.context_set ctx) in
- let senv = Safe_typing.add_constraints cstrs senv in
+ let uctx = UState.context_set uctx in
+ let senv = Safe_typing.push_context_set false uctx senv in
let j = Safe_typing.typing senv c in
let env = Safe_typing.env_of_safe_env senv in
- Feedback.msg_notice (print_safe_judgment env sigma j)
+ Feedback.msg_notice (print_safe_judgment env sigma j ++
+ pr_universe_ctx_set sigma uctx)
let get_nth_goal n =
let pf = Proof_global.give_me_the_proof() in
- let {Evd.it=gls ; sigma=sigma; } = Proof.V82.subgoals pf in
+ let gls,_,_,_,sigma = Proof.proof pf in
let gl = {Evd.it=List.nth gls (n-1) ; sigma = sigma; } in
gl
@@ -1609,9 +1635,10 @@ exception NoHyp
(* Printing "About" information of a hypothesis of the current goal.
We only print the type and a small statement to this comes from the
goal. Precondition: there must be at least one current goal. *)
-let print_about_hyp_globs ?loc ref_or_by_not glopt =
+let print_about_hyp_globs ?loc ref_or_by_not udecl glopt =
let open Context.Named.Declaration in
try
+ (* FIXME error on non None udecl if we find the hyp. *)
let glnumopt = query_command_selector ?loc glopt in
let gl,id =
match glnumopt,ref_or_by_not with
@@ -1628,17 +1655,22 @@ let print_about_hyp_globs ?loc ref_or_by_not glopt =
let natureofid = match decl with
| LocalAssum _ -> "Hypothesis"
| LocalDef (_,bdy,_) ->"Constant (let in)" in
- v 0 (pr_id id ++ str":" ++ pr_econstr (NamedDecl.get_type decl) ++ fnl() ++ fnl()
+ let sigma, env = Pfedit.get_current_context () in
+ v 0 (Id.print id ++ str":" ++ pr_econstr_env env sigma (NamedDecl.get_type decl) ++ fnl() ++ fnl()
++ str natureofid ++ str " of the goal context.")
with (* fallback to globals *)
- | NoHyp | Not_found -> print_about ref_or_by_not
+ | NoHyp | Not_found ->
+ let sigma, env = Pfedit.get_current_context () in
+ print_about env sigma ref_or_by_not udecl
-
-let vernac_print ?loc = let open Feedback in function
+let vernac_print ~atts env sigma =
+ let open Feedback in
+ let loc = atts.loc in
+ function
| PrintTables -> msg_notice (print_tables ())
- | PrintFullContext-> msg_notice (print_full_context_typ ())
- | PrintSectionContext qid -> msg_notice (print_sec_context_typ qid)
- | PrintInspect n -> msg_notice (inspect n)
+ | PrintFullContext-> msg_notice (print_full_context_typ env sigma)
+ | PrintSectionContext qid -> msg_notice (print_sec_context_typ env sigma qid)
+ | PrintInspect n -> msg_notice (inspect env sigma n)
| PrintGrammar ent -> msg_notice (Metasyntax.pr_grammar ent)
| PrintLoadPath dir -> (* For compatibility ? *) msg_notice (print_loadpath dir)
| PrintModules -> msg_notice (print_modules ())
@@ -1648,15 +1680,15 @@ let vernac_print ?loc = let open Feedback in function
| PrintMLLoadPath -> msg_notice (Mltop.print_ml_path ())
| PrintMLModules -> msg_notice (Mltop.print_ml_modules ())
| PrintDebugGC -> msg_notice (Mltop.print_gc ())
- | PrintName qid -> dump_global qid; msg_notice (print_name qid)
- | PrintGraph -> msg_notice (Prettyp.print_graph())
+ | PrintName (qid,udecl) -> dump_global qid; msg_notice (print_name env sigma qid udecl)
+ | PrintGraph -> msg_notice (Prettyp.print_graph env sigma)
| PrintClasses -> msg_notice (Prettyp.print_classes())
| PrintTypeClasses -> msg_notice (Prettyp.print_typeclasses())
| PrintInstances c -> msg_notice (Prettyp.print_instances (smart_global c))
- | PrintCoercions -> msg_notice (Prettyp.print_coercions())
+ | PrintCoercions -> msg_notice (Prettyp.print_coercions env sigma)
| PrintCoercionPaths (cls,clt) ->
- msg_notice (Prettyp.print_path_between (cl_of_qualid cls) (cl_of_qualid clt))
- | PrintCanonicalConversions -> msg_notice (Prettyp.print_canonical_projections ())
+ msg_notice (Prettyp.print_path_between env sigma (cl_of_qualid cls) (cl_of_qualid clt))
+ | PrintCanonicalConversions -> msg_notice (Prettyp.print_canonical_projections env sigma)
| PrintUniverses (b, dst) ->
let univ = Global.universes () in
let univ = if b then UGraph.sort_universes univ else univ in
@@ -1668,18 +1700,18 @@ let vernac_print ?loc = let open Feedback in function
| None -> msg_notice (UGraph.pr_universes Universes.pr_with_global_universes univ ++ pr_remaining)
| Some s -> dump_universes_gen univ s
end
- | PrintHint r -> msg_notice (Hints.pr_hint_ref (smart_global r))
+ | PrintHint r -> msg_notice (Hints.pr_hint_ref env sigma (smart_global r))
| PrintHintGoal -> msg_notice (Hints.pr_applicable_hint ())
- | PrintHintDbName s -> msg_notice (Hints.pr_hint_db_by_name s)
- | PrintHintDb -> msg_notice (Hints.pr_searchtable ())
+ | PrintHintDbName s -> msg_notice (Hints.pr_hint_db_by_name env sigma s)
+ | PrintHintDb -> msg_notice (Hints.pr_searchtable env sigma)
| PrintScopes ->
- msg_notice (Notation.pr_scopes (Constrextern.without_symbols pr_lglob_constr))
+ msg_notice (Notation.pr_scopes (Constrextern.without_symbols (pr_lglob_constr_env env)))
| PrintScope s ->
- msg_notice (Notation.pr_scope (Constrextern.without_symbols pr_lglob_constr) s)
+ msg_notice (Notation.pr_scope (Constrextern.without_symbols (pr_lglob_constr_env env)) s)
| PrintVisibility s ->
- msg_notice (Notation.pr_visibility (Constrextern.without_symbols pr_lglob_constr) s)
- | PrintAbout (ref_or_by_not,glnumopt) ->
- msg_notice (print_about_hyp_globs ?loc ref_or_by_not glnumopt)
+ msg_notice (Notation.pr_visibility (Constrextern.without_symbols (pr_lglob_constr_env env)) s)
+ | PrintAbout (ref_or_by_not,udecl,glnumopt) ->
+ msg_notice (print_about_hyp_globs ?loc ref_or_by_not udecl glnumopt)
| PrintImplicit qid ->
dump_global qid; msg_notice (print_impargs qid)
| PrintAssumptions (o,t,r) ->
@@ -1689,7 +1721,7 @@ let vernac_print ?loc = let open Feedback in function
let st = Conv_oracle.get_transp_state (Environ.oracle (Global.env())) in
let nassums =
Assumptions.assumptions st ~add_opaque:o ~add_transparent:t gr cstr in
- msg_notice (Printer.pr_assumptionset (Global.env ()) nassums)
+ msg_notice (Printer.pr_assumptionset env sigma nassums)
| PrintStrategy r -> print_strategy r
let global_module r =
@@ -1743,8 +1775,8 @@ let _ =
optread = (fun () -> !search_output_name_only);
optwrite = (:=) search_output_name_only }
-let vernac_search ?loc s gopt r =
- let gopt = query_command_selector ?loc gopt in
+let vernac_search ~atts s gopt r =
+ let gopt = query_command_selector ?loc:atts.loc gopt in
let r = interp_search_restriction r in
let env,gopt =
match gopt with | None ->
@@ -1780,9 +1812,10 @@ let vernac_locate = let open Feedback in function
| LocateTerm (AN qid) -> msg_notice (print_located_term qid)
| LocateAny (ByNotation (_, (ntn, sc))) (** TODO : handle Ltac notations *)
| LocateTerm (ByNotation (_, (ntn, sc))) ->
- msg_notice
- (Notation.locate_notation
- (Constrextern.without_symbols pr_lglob_constr) ntn sc)
+ let _, env = Pfedit.get_current_context () in
+ msg_notice
+ (Notation.locate_notation
+ (Constrextern.without_symbols (pr_lglob_constr_env env)) ntn sc)
| LocateLibrary qid -> print_located_library qid
| LocateModule qid -> msg_notice (print_located_module qid)
| LocateOther (s, qid) -> msg_notice (print_located_other s qid)
@@ -1823,11 +1856,8 @@ let vernac_unfocused () =
user_err Pp.(str "The proof is not fully unfocused.")
-(* BeginSubproof / EndSubproof.
- BeginSubproof (vernac_subproof) focuses on the first goal, or the goal
- given as argument.
- EndSubproof (vernac_end_subproof) unfocuses from a BeginSubproof, provided
- that the proof of the goal has been completed.
+(* "{" focuses on the first goal, "n: {" focuses on the n-th goal
+ "}" unfocuses, provided that the proof of the goal has been completed.
*)
let subproof_kind = Proof.new_focus_kind ()
let subproof_cond = Proof.done_cond subproof_kind
@@ -1836,7 +1866,9 @@ let vernac_subproof gln =
Proof_global.simple_with_current_proof (fun _ p ->
match gln with
| None -> Proof.focus subproof_cond () 1 p
- | Some n -> Proof.focus subproof_cond () n p)
+ | Some (SelectNth n) -> Proof.focus subproof_cond () n p
+ | _ -> user_err ~hdr:"bracket_selector"
+ (str "Brackets only support the single numbered goal selector."))
let vernac_end_subproof () =
Proof_global.simple_with_current_proof (fun _ p ->
@@ -1849,17 +1881,18 @@ let vernac_bullet (bullet : Proof_bullet.t) =
let vernac_show = let open Feedback in function
| ShowScript -> assert false (* Only the stm knows the script *)
| ShowGoal goalref ->
+ let proof = Proof_global.give_me_the_proof () in
let info = match goalref with
- | OpenSubgoals -> pr_open_subgoals ()
- | NthGoal n -> pr_nth_open_subgoal n
- | GoalId id -> pr_goal_by_id id
+ | OpenSubgoals -> pr_open_subgoals ~proof
+ | NthGoal n -> pr_nth_open_subgoal ~proof n
+ | GoalId id -> pr_goal_by_id ~proof id
in
msg_notice info
| ShowProof -> show_proof ()
| ShowExistentials -> show_top_evars ()
| ShowUniverses -> show_universes ()
| ShowProofNames ->
- msg_notice (pr_sequence pr_id (Proof_global.get_all_proof_names()))
+ msg_notice (pr_sequence Id.print (Proof_global.get_all_proof_names()))
| ShowIntros all -> show_intro all
| ShowMatch id -> show_match id
@@ -1909,20 +1942,13 @@ let vernac_load interp fname =
* is the outdated/deprecated "Local" attribute of some vernacular commands
* still parsed as the obsolete_locality grammar entry for retrocompatibility.
* loc is the Loc.t of the vernacular command being interpreted. *)
-let interp ?proof ?loc locality poly c =
- vernac_pperr_endline (fun () -> str "interpreting: " ++ Ppvernac.pr_vernac c);
+let interp ?proof ~atts ~st c =
+ let open Vernacinterp in
+ vernac_pperr_endline (fun () -> str "interpreting: " ++ Ppvernac.pr_vernac_expr c);
match c with
- (* The below vernac are candidates for removal from the main type
- and to be put into a new doc_command datatype: *)
| VernacLoad _ -> assert false
- (* Done later in this file *)
- | VernacFail _ -> assert false
- | VernacTime _ -> assert false
- | VernacRedirect _ -> assert false
- | VernacTimeout _ -> assert false
-
(* The STM should handle that, but LOAD bypasses the STM... *)
| VernacAbortAll -> CErrors.user_err (str "AbortAll cannot be used through the Load command")
| VernacRestart -> CErrors.user_err (str "Restart cannot be used through the Load command")
@@ -1942,37 +1968,34 @@ let interp ?proof ?loc locality poly c =
(* This one is possible to handle here *)
| VernacAbort id -> CErrors.user_err (str "Abort cannot be used through the Load command")
- (* Handled elsewhere *)
- | VernacProgram _
- | VernacPolymorphic _
- | VernacLocal _ -> assert false
-
(* Syntax *)
- | VernacSyntaxExtension (infix, local,sl) ->
- vernac_syntax_extension locality local infix sl
+ | VernacSyntaxExtension (infix, sl) ->
+ vernac_syntax_extension atts infix sl
| VernacDelimiters (sc,lr) -> vernac_delimiters sc lr
| VernacBindScope (sc,rl) -> vernac_bind_scope sc rl
- | VernacOpenCloseScope (local, s) -> vernac_open_close_scope locality local s
- | VernacArgumentsScope (qid,scl) -> vernac_arguments_scope locality qid scl
- | VernacInfix (local,mv,qid,sc) -> vernac_infix locality local mv qid sc
- | VernacNotation (local,c,infpl,sc) ->
- vernac_notation locality local c infpl sc
+ | VernacOpenCloseScope (b, s) -> vernac_open_close_scope ~atts (b,s)
+ | VernacArgumentsScope (qid,scl) -> vernac_arguments_scope ~atts qid scl
+ | VernacInfix (mv,qid,sc) -> vernac_infix ~atts mv qid sc
+ | VernacNotation (c,infpl,sc) ->
+ vernac_notation ~atts c infpl sc
| VernacNotationAddFormat(n,k,v) ->
Metasyntax.add_notation_extra_printing_rule n k v
(* Gallina *)
- | VernacDefinition (k,lid,d) -> vernac_definition locality poly k lid d
- | VernacStartTheoremProof (k,l) -> vernac_start_proof locality poly k l
+ | VernacDefinition ((discharge,kind),lid,d) ->
+ vernac_definition ~atts discharge kind lid d
+ | VernacStartTheoremProof (k,l) -> vernac_start_proof ~atts k l
| VernacEndProof e -> vernac_end_proof ?proof e
| VernacExactProof c -> vernac_exact_proof c
- | VernacAssumption (stre,nl,l) -> vernac_assumption locality poly stre l nl
- | VernacInductive (cum, priv,finite,l) -> vernac_inductive cum poly priv finite l
- | VernacFixpoint (local, l) -> vernac_fixpoint locality poly local l
- | VernacCoFixpoint (local, l) -> vernac_cofixpoint locality poly local l
+ | VernacAssumption ((discharge,kind),nl,l) ->
+ vernac_assumption ~atts discharge kind l nl
+ | VernacInductive (cum, priv,finite,l) -> vernac_inductive ~atts cum priv finite l
+ | VernacFixpoint (discharge, l) -> vernac_fixpoint ~atts discharge l
+ | VernacCoFixpoint (discharge, l) -> vernac_cofixpoint ~atts discharge l
| VernacScheme l -> vernac_scheme l
| VernacCombinedScheme (id, l) -> vernac_combined_scheme id l
- | VernacUniverse l -> vernac_universe loc poly l
- | VernacConstraint l -> vernac_constraint loc poly l
+ | VernacUniverse l -> vernac_universe ~atts l
+ | VernacConstraint l -> vernac_constraint ~atts l
(* Modules *)
| VernacDeclareModule (export,lid,bl,mtyo) ->
@@ -1993,15 +2016,15 @@ let interp ?proof ?loc locality poly c =
| VernacRequire (from, export, qidl) -> vernac_require from export qidl
| VernacImport (export,qidl) -> vernac_import export qidl
| VernacCanonical qid -> vernac_canonical qid
- | VernacCoercion (local,r,s,t) -> vernac_coercion locality poly local r s t
- | VernacIdentityCoercion (local,(_,id),s,t) ->
- vernac_identity_coercion locality poly local id s t
+ | VernacCoercion (r,s,t) -> vernac_coercion ~atts r s t
+ | VernacIdentityCoercion ((_,id),s,t) ->
+ vernac_identity_coercion ~atts id s t
(* Type classes *)
| VernacInstance (abst, sup, inst, props, info) ->
- vernac_instance abst locality poly sup inst props info
- | VernacContext sup -> vernac_context poly sup
- | VernacDeclareInstances insts -> vernac_declare_instances locality insts
+ vernac_instance ~atts abst sup inst props info
+ | VernacContext sup -> vernac_context ~atts sup
+ | VernacDeclareInstances insts -> vernac_declare_instances ~atts insts
| VernacDeclareClass id -> vernac_declare_class id
(* Solving *)
@@ -2011,7 +2034,7 @@ let interp ?proof ?loc locality poly c =
| VernacAddLoadPath (isrec,s,alias) -> vernac_add_loadpath isrec s alias
| VernacRemoveLoadPath s -> vernac_remove_loadpath s
| VernacAddMLPath (isrec,s) -> vernac_add_ml_path isrec s
- | VernacDeclareMLModule l -> vernac_declare_ml_module locality l
+ | VernacDeclareMLModule l -> vernac_declare_ml_module ~atts l
| VernacChdir s -> vernac_chdir s
(* State management *)
@@ -2019,38 +2042,39 @@ let interp ?proof ?loc locality poly c =
| VernacRestoreState s -> vernac_restore_state s
(* Commands *)
- | VernacCreateHintDb (dbname,b) -> vernac_create_hintdb locality dbname b
- | VernacRemoveHints (dbnames,ids) -> vernac_remove_hints locality dbnames ids
- | VernacHints (local,dbnames,hints) ->
- vernac_hints locality poly local dbnames hints
- | VernacSyntacticDefinition (id,c,local,b) ->
- vernac_syntactic_definition locality id c local b
+ | VernacCreateHintDb (dbname,b) -> vernac_create_hintdb ~atts dbname b
+ | VernacRemoveHints (dbnames,ids) -> vernac_remove_hints ~atts dbnames ids
+ | VernacHints (dbnames,hints) ->
+ vernac_hints ~atts dbnames hints
+ | VernacSyntacticDefinition (id,c,b) ->
+ vernac_syntactic_definition ~atts id c b
| VernacDeclareImplicits (qid,l) ->
- vernac_declare_implicits locality qid l
+ vernac_declare_implicits ~atts qid l
| VernacArguments (qid, args, more_implicits, nargs, flags) ->
- vernac_arguments locality qid args more_implicits nargs flags
+ vernac_arguments ~atts qid args more_implicits nargs flags
| VernacReserve bl -> vernac_reserve bl
- | VernacGeneralizable gen -> vernac_generalizable locality gen
- | VernacSetOpacity qidl -> vernac_set_opacity locality qidl
- | VernacSetStrategy l -> vernac_set_strategy locality l
- | VernacSetOption (key,v) -> vernac_set_option locality key v
- | VernacSetAppendOption (key,v) -> vernac_set_append_option locality key v
- | VernacUnsetOption key -> vernac_unset_option locality key
+ | VernacGeneralizable gen -> vernac_generalizable ~atts gen
+ | VernacSetOpacity qidl -> vernac_set_opacity ~atts qidl
+ | VernacSetStrategy l -> vernac_set_strategy ~atts l
+ | VernacSetOption (key,v) -> vernac_set_option ~atts key v
+ | VernacSetAppendOption (key,v) -> vernac_set_append_option ~atts key v
+ | VernacUnsetOption key -> vernac_unset_option ~atts key
| VernacRemoveOption (key,v) -> vernac_remove_option key v
| VernacAddOption (key,v) -> vernac_add_option key v
| VernacMemOption (key,v) -> vernac_mem_option key v
| VernacPrintOption key -> vernac_print_option key
- | VernacCheckMayEval (r,g,c) -> vernac_check_may_eval ?loc r g c
- | VernacDeclareReduction (s,r) -> vernac_declare_reduction locality s r
+ | VernacCheckMayEval (r,g,c) -> vernac_check_may_eval ~atts r g c
+ | VernacDeclareReduction (s,r) -> vernac_declare_reduction ~atts s r
| VernacGlobalCheck c -> vernac_global_check c
- | VernacPrint p -> vernac_print ?loc p
- | VernacSearch (s,g,r) -> vernac_search ?loc s g r
+ | VernacPrint p ->
+ let sigma, env = Pfedit.get_current_context () in
+ vernac_print ~atts env sigma p
+ | VernacSearch (s,g,r) -> vernac_search ~atts s g r
| VernacLocate l -> vernac_locate l
| VernacRegister (id, r) -> vernac_register id r
| VernacComments l -> Flags.if_verbose Feedback.msg_info (str "Comments ok\n")
(* Proof management *)
- | VernacGoal t -> vernac_start_proof locality poly Theorem [None,([],t)]
| VernacFocus n -> vernac_focus n
| VernacUnfocus -> vernac_unfocus ()
| VernacUnfocused -> vernac_unfocused ()
@@ -2063,13 +2087,16 @@ let interp ?proof ?loc locality poly c =
let using = Option.append using (Proof_using.get_default_proof_using ()) in
let tacs = if Option.is_empty tac then "tac:no" else "tac:yes" in
let usings = if Option.is_empty using then "using:no" else "using:yes" in
- Aux_file.record_in_aux_at ?loc "VernacProof" (tacs^" "^usings);
+ Aux_file.record_in_aux_at ?loc:atts.loc "VernacProof" (tacs^" "^usings);
Option.iter vernac_set_end_tac tac;
Option.iter vernac_set_used_variables using
| VernacProofMode mn -> Proof_global.set_proof_mode mn [@ocaml.warning "-3"]
(* Extensions *)
- | VernacExtend (opn,args) -> Vernacinterp.call ?locality ?loc (opn,args)
+ | VernacExtend (opn,args) ->
+ (* XXX: Here we are returning the state! :) *)
+ let _st : Vernacstate.t = Vernacinterp.call ~atts opn args ~st in
+ ()
(* Vernaculars that take a locality flag *)
let check_vernac_supports_locality c l =
@@ -2100,7 +2127,7 @@ let check_vernac_supports_polymorphism c p =
| None, _ -> ()
| Some _, (
VernacDefinition _ | VernacFixpoint _ | VernacCoFixpoint _
- | VernacAssumption _ | VernacInductive _
+ | VernacAssumption _ | VernacInductive _
| VernacStartTheoremProof _
| VernacCoercion _ | VernacIdentityCoercion _
| VernacInstance _ | VernacDeclareInstances _
@@ -2108,10 +2135,6 @@ let check_vernac_supports_polymorphism c p =
| VernacExtend _ | VernacUniverse _ | VernacConstraint _) -> ()
| Some _, _ -> user_err Pp.(str "This command does not support Polymorphism")
-let enforce_polymorphism = function
- | None -> Flags.is_universe_polymorphism ()
- | Some b -> Flags.make_polymorphic_flag b; b
-
(** A global default timeout, controlled by option "Set Default Timeout n".
Use "Unset Default Timeout" to deactivate it (or set it to 0). *)
@@ -2134,7 +2157,7 @@ let vernac_timeout f =
match !current_timeout, !default_timeout with
| Some n, _ | None, Some n ->
let f () = f (); current_timeout := None in
- Control.timeout n f Timeout
+ Control.timeout n f () Timeout
| None, None -> f ()
let restore_timeout () = current_timeout := None
@@ -2147,28 +2170,6 @@ let locate_if_not_already ?loc (e, info) =
exception HasNotFailed
exception HasFailed of Pp.t
-type interp_state = { (* TODO: inline records in OCaml 4.03 *)
- system : States.state; (* summary + libstack *)
- proof : Proof_global.state; (* proof state *)
- shallow : bool (* is the state trimmed down (libstack) *)
-}
-
-let s_cache = ref (States.freeze ~marshallable:`No)
-let s_proof = ref (Proof_global.freeze ~marshallable:`No)
-
-let invalidate_cache () =
- s_cache := Obj.magic 0;
- s_proof := Obj.magic 0
-
-let freeze_interp_state marshallable =
- { system = (s_cache := States.freeze ~marshallable; !s_cache);
- proof = (s_proof := Proof_global.freeze ~marshallable; !s_proof);
- shallow = marshallable = `Shallow }
-
-let unfreeze_interp_state { system; proof } =
- if (!s_cache != system) then (s_cache := system; States.unfreeze system);
- if (!s_proof != proof) then (s_proof := proof; Proof_global.unfreeze proof)
-
(* XXX STATE: this type hints that restoring the state should be the
caller's responsibility *)
let with_fail st b f =
@@ -2187,8 +2188,8 @@ let with_fail st b f =
(ExplainErr.process_vernac_interp_error ~allow_uncaught:false e)))
with e when CErrors.noncritical e ->
(* Restore the previous state XXX Careful here with the cache! *)
- invalidate_cache ();
- unfreeze_interp_state st;
+ Vernacstate.invalidate_cache ();
+ Vernacstate.unfreeze_interp_state st;
let (e, _) = CErrors.push e in
match e with
| HasNotFailed ->
@@ -2199,42 +2200,65 @@ let with_fail st b f =
| _ -> assert false
end
-let interp ?(verbosely=true) ?proof st (loc,c) =
+let interp ?(verbosely=true) ?proof ~st (loc,c) =
+ let orig_univ_poly = Flags.is_universe_polymorphism () in
let orig_program_mode = Flags.is_program_mode () in
- let rec aux ?locality ?polymorphism isprogcmd = function
-
- | VernacProgram c when not isprogcmd -> aux ?locality ?polymorphism true c
- | VernacProgram _ -> user_err Pp.(str "Program mode specified twice")
- | VernacLocal (b, c) when Option.is_empty locality ->
- aux ~locality:b ?polymorphism isprogcmd c
- | VernacPolymorphic (b, c) when polymorphism = None ->
- aux ?locality ~polymorphism:b isprogcmd c
- | VernacPolymorphic (b, c) -> user_err Pp.(str "Polymorphism specified twice")
- | VernacLocal _ -> user_err Pp.(str "Locality specified twice")
- | VernacFail v ->
- with_fail st true (fun () -> aux ?locality ?polymorphism isprogcmd v)
- | VernacTimeout (n,v) ->
- current_timeout := Some n;
- aux ?locality ?polymorphism isprogcmd v
- | VernacRedirect (s, (_,v)) ->
- Topfmt.with_output_to_file s (aux ?locality ?polymorphism isprogcmd) v
- | VernacTime (_,v) ->
- System.with_time !Flags.time
- (aux ?locality ?polymorphism isprogcmd) v;
- | VernacLoad (_,fname) -> vernac_load (aux false) fname
- | c ->
- check_vernac_supports_locality c locality;
- check_vernac_supports_polymorphism c polymorphism;
- let poly = enforce_polymorphism polymorphism in
- Obligations.set_program_mode isprogcmd;
- try
- vernac_timeout begin fun () ->
+ let flags f atts =
+ List.fold_left
+ (fun (polymorphism, atts) f ->
+ match f with
+ | VernacProgram when not atts.program ->
+ (polymorphism, { atts with program = true })
+ | VernacProgram ->
+ user_err Pp.(str "Program mode specified twice")
+ | VernacPolymorphic b when polymorphism = None ->
+ (Some b, atts)
+ | VernacPolymorphic _ ->
+ user_err Pp.(str "Polymorphism specified twice")
+ | VernacLocal b when Option.is_empty atts.locality ->
+ (polymorphism, { atts with locality = Some b })
+ | VernacLocal _ ->
+ user_err Pp.(str "Locality specified twice")
+ )
+ (None, atts)
+ f
+ in
+ let rec control = function
+ | VernacExpr (f, v) ->
+ let (polymorphism, atts) = flags f { loc; locality = None; polymorphic = false; program = orig_program_mode; } in
+ aux ~polymorphism ~atts v
+ | VernacFail v -> with_fail st true (fun () -> control v)
+ | VernacTimeout (n,v) ->
+ current_timeout := Some n;
+ control v
+ | VernacRedirect (s, (_,v)) ->
+ Topfmt.with_output_to_file s control v
+ | VernacTime (batch, (_loc,v)) ->
+ System.with_time ~batch control v;
+
+ and aux ~polymorphism ~atts : _ -> unit =
+ function
+
+ | VernacLoad (_,fname) -> vernac_load control fname
+
+ | c ->
+ check_vernac_supports_locality c atts.locality;
+ check_vernac_supports_polymorphism c polymorphism;
+ let polymorphic = Option.default (Flags.is_universe_polymorphism ()) polymorphism in
+ Flags.make_universe_polymorphism polymorphic;
+ Obligations.set_program_mode atts.program;
+ try
+ vernac_timeout begin fun () ->
+ let atts = { atts with polymorphic } in
if verbosely
- then Flags.verbosely (interp ?proof ?loc locality poly) c
- else Flags.silently (interp ?proof ?loc locality poly) c;
- if orig_program_mode || not !Flags.program_mode || isprogcmd then
+ then Flags.verbosely (interp ?proof ~atts ~st) c
+ else Flags.silently (interp ?proof ~atts ~st) c;
+ (* If the command is `(Un)Set Program Mode` or `(Un)Set Universe Polymorphism`,
+ we should not restore the previous state of the flag... *)
+ if orig_program_mode || not !Flags.program_mode || atts.program then
Flags.program_mode := orig_program_mode;
- ignore (Flags.use_polymorphic_flag ())
+ if (Flags.is_universe_polymorphism() = polymorphic) then
+ Flags.make_universe_polymorphism orig_univ_poly;
end
with
| reraise when
@@ -2245,14 +2269,22 @@ let interp ?(verbosely=true) ?proof st (loc,c) =
let e = CErrors.push reraise in
let e = locate_if_not_already ?loc e in
let () = restore_timeout () in
+ Flags.make_universe_polymorphism orig_univ_poly;
Flags.program_mode := orig_program_mode;
- ignore (Flags.use_polymorphic_flag ());
iraise e
in
- if verbosely then Flags.verbosely (aux false) c
- else aux false c
-
-let interp ?verbosely ?proof st cmd =
- unfreeze_interp_state st;
- interp ?verbosely ?proof st cmd;
- freeze_interp_state `No
+ if verbosely
+ then Flags.verbosely control c
+ else control c
+
+(* XXX: There is a bug here in case of an exception, see @gares
+ comments on the PR *)
+let interp ?verbosely ?proof ~st cmd =
+ Vernacstate.unfreeze_interp_state st;
+ try
+ interp ?verbosely ?proof ~st cmd;
+ Vernacstate.freeze_interp_state `No
+ with exn ->
+ let exn = CErrors.push exn in
+ Vernacstate.invalidate_cache ();
+ iraise exn
diff --git a/vernac/vernacentries.mli b/vernac/vernacentries.mli
index 56635c801..e99a62fe6 100644
--- a/vernac/vernacentries.mli
+++ b/vernac/vernacentries.mli
@@ -14,21 +14,11 @@ val dump_global : Libnames.reference or_by_notation -> unit
val vernac_require :
Libnames.reference option -> bool option -> Libnames.reference list -> unit
-type interp_state = { (* TODO: inline records in OCaml 4.03 *)
- system : States.state; (* summary + libstack *)
- proof : Proof_global.state; (* proof state *)
- shallow : bool (* is the state trimmed down (libstack) *)
-}
-
-val freeze_interp_state : Summary.marshallable -> interp_state
-val unfreeze_interp_state : interp_state -> unit
-
(** The main interpretation function of vernacular expressions *)
val interp :
?verbosely:bool ->
?proof:Proof_global.closed_proof ->
- interp_state ->
- Vernacexpr.vernac_expr Loc.located -> interp_state
+ st:Vernacstate.t -> Vernacexpr.vernac_control Loc.located -> Vernacstate.t
(** Prepare a "match" template for a given inductive type.
For each branch of the match, we list the constructor name
@@ -40,9 +30,11 @@ val make_cases : string -> string list list
(* XXX STATE: this type hints that restoring the state should be the
caller's responsibility *)
-val with_fail : interp_state -> bool -> (unit -> unit) -> unit
+val with_fail : Vernacstate.t -> bool -> (unit -> unit) -> unit
val command_focus : unit Proof.focus_kind
val interp_redexp_hook : (Environ.env -> Evd.evar_map -> Genredexpr.raw_red_expr ->
Evd.evar_map * Redexpr.red_expr) Hook.t
+
+val universe_polymorphism_option_name : string list
diff --git a/vernac/vernacinterp.ml b/vernac/vernacinterp.ml
index 41fee6bd0..c40ca27db 100644
--- a/vernac/vernacinterp.ml
+++ b/vernac/vernacinterp.ml
@@ -11,12 +11,22 @@ open Pp
open CErrors
type deprecation = bool
-type vernac_command = Genarg.raw_generic_argument list -> Loc.t option -> unit
+
+type atts = {
+ loc : Loc.t option;
+ locality : bool option;
+ polymorphic : bool;
+ program : bool;
+}
+
+type 'a vernac_command = 'a -> atts:atts -> st:Vernacstate.t -> Vernacstate.t
+
+type plugin_args = Genarg.raw_generic_argument list
(* Table of vernac entries *)
let vernac_tab =
- (Hashtbl.create 51 :
- (Vernacexpr.extend_name, deprecation * vernac_command) Hashtbl.t)
+ (Hashtbl.create 211 :
+ (Vernacexpr.extend_name, deprecation * plugin_args vernac_command) Hashtbl.t)
let vinterp_add depr s f =
try
@@ -49,7 +59,7 @@ let warn_deprecated_command =
(* Interpretation of a vernac command *)
-let call ?locality ?loc (opn,converted_args) =
+let call opn converted_args ~atts ~st =
let phase = ref "Looking up command" in
try
let depr, callback = vinterp_map opn in
@@ -65,9 +75,7 @@ let call ?locality ?loc (opn,converted_args) =
phase := "Checking arguments";
let hunk = callback converted_args in
phase := "Executing command";
- Locality.LocalityFixme.set locality;
- hunk loc;
- Locality.LocalityFixme.assert_consumed()
+ hunk ~atts ~st
with
| Drop -> raise Drop
| reraise ->
diff --git a/vernac/vernacinterp.mli b/vernac/vernacinterp.mli
index 84370fdc2..c5e610f89 100644
--- a/vernac/vernacinterp.mli
+++ b/vernac/vernacinterp.mli
@@ -9,12 +9,20 @@
(** Interpretation of extended vernac phrases. *)
type deprecation = bool
-type vernac_command = Genarg.raw_generic_argument list -> Loc.t option -> unit
-val vinterp_add : deprecation -> Vernacexpr.extend_name ->
- vernac_command -> unit
-val overwriting_vinterp_add :
- Vernacexpr.extend_name -> vernac_command -> unit
+type atts = {
+ loc : Loc.t option;
+ locality : bool option;
+ polymorphic : bool;
+ program : bool;
+}
+
+type 'a vernac_command = 'a -> atts:atts -> st:Vernacstate.t -> Vernacstate.t
+
+type plugin_args = Genarg.raw_generic_argument list
val vinterp_init : unit -> unit
-val call : ?locality:bool -> ?loc:Loc.t -> Vernacexpr.extend_name * Genarg.raw_generic_argument list -> unit
+val vinterp_add : deprecation -> Vernacexpr.extend_name -> plugin_args vernac_command -> unit
+val overwriting_vinterp_add : Vernacexpr.extend_name -> plugin_args vernac_command -> unit
+
+val call : Vernacexpr.extend_name -> plugin_args -> atts:atts -> st:Vernacstate.t -> Vernacstate.t
diff --git a/vernac/vernacprop.ml b/vernac/vernacprop.ml
index 3cff1f14c..3932d1c7b 100644
--- a/vernac/vernacprop.ml
+++ b/vernac/vernacprop.ml
@@ -11,42 +11,48 @@
open Vernacexpr
+let rec under_control = function
+ | VernacExpr (_, c) -> c
+ | VernacRedirect (_,(_,c))
+ | VernacTime (_,(_,c))
+ | VernacFail c
+ | VernacTimeout (_,c) -> under_control c
+
+let rec has_Fail = function
+ | VernacExpr _ -> false
+ | VernacRedirect (_,(_,c))
+ | VernacTime (_,(_,c))
+ | VernacTimeout (_,c) -> has_Fail c
+ | VernacFail _ -> true
+
(* Navigation commands are allowed in a coqtop session but not in a .v file *)
-let rec is_navigation_vernac = function
+let is_navigation_vernac_expr = function
| VernacResetInitial
| VernacResetName _
| VernacBacktrack _
| VernacBackTo _
| VernacBack _ -> true
- | VernacRedirect (_, (_,c))
- | VernacTime (_,c) ->
- is_navigation_vernac c (* Time Back* is harmless *)
- | c -> is_deep_navigation_vernac c
+ | _ -> false
+
+let is_navigation_vernac c =
+ is_navigation_vernac_expr (under_control c)
-and is_deep_navigation_vernac = function
+let rec is_deep_navigation_vernac = function
+ | VernacTime (_,(_,c)) -> is_deep_navigation_vernac c
+ | VernacRedirect (_, (_,c))
| VernacTimeout (_,c) | VernacFail c -> is_navigation_vernac c
- | _ -> false
+ | VernacExpr _ -> false
(* NB: Reset is now allowed again as asked by A. Chlipala *)
let is_reset = function
- | VernacResetInitial | VernacResetName _ -> true
+ | VernacExpr ( _, VernacResetInitial)
+ | VernacExpr (_, VernacResetName _) -> true
| _ -> false
-let is_debug cmd = match cmd with
+let is_debug cmd = match under_control cmd with
| VernacSetOption (["Ltac";"Debug"], _) -> true
| _ -> false
-let is_query cmd = match cmd with
- | VernacChdir None
- | VernacMemOption _
- | VernacPrintOption _
- | VernacCheckMayEval _
- | VernacGlobalCheck _
- | VernacPrint _
- | VernacSearch _
- | VernacLocate _ -> true
- | _ -> false
-
-let is_undo cmd = match cmd with
+let is_undo cmd = match under_control cmd with
| VernacUndo _ | VernacUndoTo _ -> true
| _ -> false
diff --git a/vernac/vernacprop.mli b/vernac/vernacprop.mli
index fbdba6bac..df739f96a 100644
--- a/vernac/vernacprop.mli
+++ b/vernac/vernacprop.mli
@@ -11,9 +11,16 @@
open Vernacexpr
-val is_navigation_vernac : vernac_expr -> bool
-val is_deep_navigation_vernac : vernac_expr -> bool
-val is_reset : vernac_expr -> bool
-val is_query : vernac_expr -> bool
-val is_debug : vernac_expr -> bool
-val is_undo : vernac_expr -> bool
+(* Return the vernacular command below control (Time, Timeout, Redirect, Fail).
+ Beware that Fail can change many properties of the underlying command, since
+ a success of Fail means the command was backtracked over. *)
+val under_control : vernac_control -> vernac_expr
+
+val has_Fail : vernac_control -> bool
+
+val is_navigation_vernac : vernac_control -> bool
+val is_deep_navigation_vernac : vernac_control -> bool
+val is_reset : vernac_control -> bool
+val is_debug : vernac_control -> bool
+val is_undo : vernac_control -> bool
+
diff --git a/vernac/vernacstate.ml b/vernac/vernacstate.ml
new file mode 100644
index 000000000..4980333b5
--- /dev/null
+++ b/vernac/vernacstate.ml
@@ -0,0 +1,41 @@
+(************************************************************************)
+(* v * The Coq Proof Assistant / The Coq Development Team *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(************************************************************************)
+
+type t = {
+ system : States.state; (* summary + libstack *)
+ proof : Proof_global.t; (* proof state *)
+ shallow : bool (* is the state trimmed down (libstack) *)
+}
+
+let s_cache = ref None
+let s_proof = ref None
+
+let invalidate_cache () =
+ s_cache := None;
+ s_proof := None
+
+let update_cache rf v =
+ rf := Some v; v
+
+let do_if_not_cached rf f v =
+ match !rf with
+ | None ->
+ rf := Some v; f v
+ | Some vc when vc != v ->
+ rf := Some v; f v
+ | Some _ ->
+ ()
+
+let freeze_interp_state marshallable =
+ { system = update_cache s_cache (States.freeze ~marshallable);
+ proof = update_cache s_proof (Proof_global.freeze ~marshallable);
+ shallow = marshallable = `Shallow }
+
+let unfreeze_interp_state { system; proof } =
+ do_if_not_cached s_cache States.unfreeze system;
+ do_if_not_cached s_proof Proof_global.unfreeze proof
diff --git a/vernac/vernacstate.mli b/vernac/vernacstate.mli
new file mode 100644
index 000000000..3ed27ddb7
--- /dev/null
+++ b/vernac/vernacstate.mli
@@ -0,0 +1,19 @@
+(************************************************************************)
+(* v * The Coq Proof Assistant / The Coq Development Team *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(************************************************************************)
+
+type t = {
+ system : States.state; (* summary + libstack *)
+ proof : Proof_global.t; (* proof state *)
+ shallow : bool (* is the state trimmed down (libstack) *)
+}
+
+val freeze_interp_state : Summary.marshallable -> t
+val unfreeze_interp_state : t -> unit
+
+(* WARNING: Do not use, it will go away in future releases *)
+val invalidate_cache : unit -> unit