aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.circleci/config.yml90
-rw-r--r--.github/PULL_REQUEST_TEMPLATE.md16
-rw-r--r--.gitignore3
-rw-r--r--.gitlab-ci.yml1
-rw-r--r--.merlin14
-rw-r--r--.travis.yml102
-rw-r--r--API/API.ml286
-rw-r--r--API/API.mli6239
-rw-r--r--API/API.mllib1
-rw-r--r--API/PROPERTIES8
-rw-r--r--CHANGES27
-rw-r--r--CONTRIBUTING.md4
-rw-r--r--INSTALL.ide4
-rw-r--r--META.coq345
-rw-r--r--Makefile3
-rw-r--r--Makefile.build110
-rw-r--r--Makefile.checker11
-rw-r--r--Makefile.ci6
-rw-r--r--Makefile.common8
-rw-r--r--Makefile.dev2
-rw-r--r--Makefile.doc49
-rw-r--r--Makefile.ide6
-rw-r--r--README.md14
-rw-r--r--appveyor.yml20
-rw-r--r--checker/checker.ml3
-rw-r--r--checker/checker.mli9
-rw-r--r--checker/cic.mli12
-rw-r--r--checker/closure.ml1
-rw-r--r--checker/closure.mli2
-rw-r--r--checker/declarations.ml4
-rw-r--r--checker/environ.ml39
-rw-r--r--checker/environ.mli7
-rw-r--r--checker/indtypes.ml17
-rw-r--r--checker/inductive.ml16
-rw-r--r--checker/main.mli10
-rw-r--r--checker/mod_checking.ml11
-rw-r--r--checker/print.mli11
-rw-r--r--checker/reduction.ml30
-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.ml36
-rw-r--r--checker/values.mli26
-rw-r--r--checker/votour.ml6
-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)0
-rw-r--r--clib/cList.mli (renamed from lib/cList.mli)0
-rw-r--r--clib/cMap.ml (renamed from lib/cMap.ml)0
-rw-r--r--clib/cMap.mli (renamed from lib/cMap.mli)0
-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)0
-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)0
-rw-r--r--clib/cUnix.mli (renamed from lib/cUnix.mli)0
-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)0
-rw-r--r--clib/dyn.mli (renamed from lib/dyn.mli)0
-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)0
-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.mli1
-rw-r--r--configure.ml63
-rw-r--r--default.nix1
-rw-r--r--dev/README30
-rw-r--r--dev/base_include8
-rwxr-xr-xdev/build/osx/make-macos-dmg.sh2
-rw-r--r--dev/build/windows/makecoq_mingw.sh4
-rw-r--r--dev/build/windows/patches_coq/coq_new.nsi2
-rw-r--r--dev/ci/README.md2
-rw-r--r--dev/ci/appveyor.bat4
-rw-r--r--dev/ci/ci-basic-overlay.sh104
-rwxr-xr-xdev/ci/ci-bignums.sh2
-rw-r--r--dev/ci/ci-common.sh66
-rwxr-xr-xdev/ci/ci-compcert.sh2
-rwxr-xr-xdev/ci/ci-coq-dpdgraph.sh2
-rwxr-xr-xdev/ci/ci-equations.sh2
-rwxr-xr-xdev/ci/ci-hott.sh2
-rwxr-xr-xdev/ci/ci-ltac2.sh2
-rwxr-xr-xdev/ci/ci-wrapper.sh4
-rw-r--r--dev/ci/user-overlays/00669-maximedenes-ssr-merge.sh2
-rw-r--r--dev/ci/user-overlays/01033-SkySkimmer-restrict-harder.sh9
-rw-r--r--dev/ci/user-overlays/06158-herbelin-master+fix-pr6158-ltac-value-printer.sh4
-rw-r--r--dev/ci/user-overlays/06169-Zimmi48-clean-up-deprecated-options.sh4
-rw-r--r--dev/ci/user-overlays/06197-ejgallego-plugins+remove_locality_hack.sh4
-rw-r--r--dev/ci/user-overlays/06217-coqdep-at-once.sh3
-rw-r--r--dev/ci/user-overlays/06324-SkySkimmer-abstract-vs-restrict.sh4
-rw-r--r--dev/ci/user-overlays/06392-ejgallego-econstr+fix_class.sh4
-rw-r--r--dev/ci/user-overlays/06405-maximedenes-rm-local-polymorphic-flag.sh4
-rw-r--r--dev/ci/user-overlays/06413-ejgallego-interp+less_impstyle_p2.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/README.md4
-rw-r--r--dev/core.dbg1
-rw-r--r--dev/db95
-rw-r--r--dev/doc/COMPATIBILITY (renamed from COMPATIBILITY)7
-rw-r--r--dev/doc/changes.md17
-rw-r--r--dev/doc/debugging.md27
-rw-r--r--dev/doc/setup.txt24
-rw-r--r--dev/doc/xml-protocol.md6
-rw-r--r--dev/include1
-rwxr-xr-xdev/lint-repository.sh11
-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.sh7
-rwxr-xr-xdev/tools/check-eof-newline.sh19
-rwxr-xr-xdev/tools/github-check-prs.py47
-rwxr-xr-xdev/tools/merge-pr.sh20
-rwxr-xr-xdev/tools/should-check-whitespace.sh6
-rwxr-xr-xdev/tools/sudo-apt-get-update.sh4
-rw-r--r--dev/top_printers.ml17
-rw-r--r--dev/top_printers.mli173
-rw-r--r--dev/vm_printers.ml2
-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/RefMan-ide.tex86
-rw-r--r--doc/refman/RefMan-ltac.tex12
-rw-r--r--doc/refman/RefMan-pre.tex10
-rw-r--r--doc/refman/RefMan-pro.tex17
-rw-r--r--doc/refman/coqide-queries.pngbin27316 -> 66656 bytes
-rw-r--r--doc/refman/coqide.pngbin20953 -> 59662 bytes
-rw-r--r--engine/eConstr.ml5
-rw-r--r--engine/eConstr.mli1
-rw-r--r--engine/evarutil.ml170
-rw-r--r--engine/evarutil.mli11
-rw-r--r--engine/evd.ml2
-rw-r--r--engine/proofview.ml30
-rw-r--r--engine/termops.ml12
-rw-r--r--engine/termops.mli10
-rw-r--r--engine/uState.ml22
-rw-r--r--engine/universes.ml78
-rw-r--r--engine/universes.mli5
-rw-r--r--grammar/tacextend.mlp14
-rw-r--r--ide/config_lexer.mli10
-rw-r--r--ide/coq_commands.mli11
-rw-r--r--ide/coq_lex.mli11
-rw-r--r--ide/coq_lex.mll4
-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.ml6
-rw-r--r--ide/ide_slave.mli10
-rw-r--r--ide/ideutils.ml7
-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.mli2
-rw-r--r--interp/declare.ml171
-rw-r--r--interp/discharge.ml4
-rw-r--r--interp/dumpglob.ml3
-rw-r--r--interp/impargs.ml2
-rw-r--r--interp/implicit_quantifiers.mli4
-rw-r--r--intf/decl_kinds.ml3
-rw-r--r--intf/vernacexpr.ml46
-rw-r--r--kernel/cClosure.ml38
-rw-r--r--kernel/constr.ml5
-rw-r--r--kernel/constr.mli6
-rw-r--r--kernel/cooking.ml54
-rw-r--r--kernel/csymtable.ml4
-rw-r--r--kernel/csymtable.mli2
-rw-r--r--kernel/declarations.ml1
-rw-r--r--kernel/declareops.ml3
-rw-r--r--kernel/declareops.mli2
-rw-r--r--kernel/entries.ml7
-rw-r--r--kernel/environ.ml54
-rw-r--r--kernel/environ.mli4
-rw-r--r--kernel/indtypes.ml10
-rw-r--r--kernel/inductive.ml28
-rw-r--r--kernel/kernel.mllib1
-rw-r--r--kernel/mod_typing.ml4
-rw-r--r--kernel/names.mli9
-rw-r--r--kernel/nativecode.ml12
-rw-r--r--kernel/nativelambda.ml4
-rw-r--r--kernel/opaqueproof.ml2
-rw-r--r--kernel/opaqueproof.mli2
-rw-r--r--kernel/pre_env.ml55
-rw-r--r--kernel/pre_env.mli20
-rw-r--r--kernel/safe_typing.ml20
-rw-r--r--kernel/safe_typing.mli6
-rw-r--r--kernel/subtyping.ml2
-rw-r--r--kernel/term.ml2
-rw-r--r--kernel/term.mli4
-rw-r--r--kernel/term_typing.ml87
-rw-r--r--kernel/term_typing.mli10
-rw-r--r--kernel/univ.ml34
-rw-r--r--kernel/univ.mli13
-rw-r--r--kernel/vars.ml43
-rw-r--r--kernel/vars.mli6
-rw-r--r--kernel/vconv.ml1
-rw-r--r--kernel/vconv.mli2
-rw-r--r--kernel/vm.ml546
-rw-r--r--kernel/vm.mli106
-rw-r--r--kernel/vmvalues.ml525
-rw-r--r--kernel/vmvalues.mli144
-rw-r--r--lib/coqProject_file.ml417
-rw-r--r--lib/coqProject_file.mli1
-rw-r--r--lib/flags.ml10
-rw-r--r--lib/flags.mli7
-rw-r--r--lib/lib.mllib39
-rw-r--r--lib/system.ml10
-rw-r--r--lib/system.mli2
-rw-r--r--library/global.ml2
-rw-r--r--library/global.mli6
-rw-r--r--library/lib.ml49
-rw-r--r--library/lib.mli11
-rw-r--r--parsing/g_vernac.ml448
-rw-r--r--parsing/pcoq.ml5
-rw-r--r--parsing/pcoq.mli5
-rw-r--r--plugins/.merlin1
-rw-r--r--plugins/extraction/extraction.ml2
-rw-r--r--plugins/firstorder/formula.ml3
-rw-r--r--plugins/funind/functional_principles_types.mli4
-rw-r--r--plugins/funind/g_indfun.ml42
-rw-r--r--plugins/funind/glob_term_to_relation.ml6
-rw-r--r--plugins/funind/glob_termops.ml160
-rw-r--r--plugins/funind/glob_termops.mli30
-rw-r--r--plugins/funind/indfun.ml1
-rw-r--r--plugins/funind/invfun.ml22
-rw-r--r--plugins/funind/invfun.mli17
-rw-r--r--plugins/funind/merge.ml1013
-rw-r--r--plugins/funind/recdef.ml2
-rw-r--r--plugins/funind/recdef.mli1
-rw-r--r--plugins/funind/recdef_plugin.mlpack1
-rw-r--r--plugins/ltac/extratactics.ml479
-rw-r--r--plugins/ltac/g_ltac.ml43
-rw-r--r--plugins/ltac/rewrite.ml5
-rw-r--r--plugins/ltac/taccoerce.ml18
-rw-r--r--plugins/ltac/taccoerce.mli3
-rw-r--r--plugins/ltac/tacinterp.ml13
-rw-r--r--plugins/micromega/MExtraction.v17
-rw-r--r--plugins/ssr/ssrvernac.ml44
-rw-r--r--pretyping/arguments_renaming.ml8
-rw-r--r--pretyping/cbv.ml2
-rw-r--r--pretyping/constr_matching.ml10
-rw-r--r--pretyping/evarconv.ml7
-rw-r--r--pretyping/inductiveops.ml6
-rw-r--r--pretyping/pretyping.ml7
-rw-r--r--pretyping/reductionops.ml6
-rw-r--r--pretyping/tacred.ml4
-rw-r--r--pretyping/typeclasses.ml17
-rw-r--r--pretyping/typeclasses.mli7
-rw-r--r--pretyping/typing.ml5
-rw-r--r--pretyping/unification.ml8
-rw-r--r--pretyping/vnorm.ml15
-rw-r--r--printing/ppvernac.ml109
-rw-r--r--printing/ppvernac.mli6
-rw-r--r--printing/prettyp.ml4
-rw-r--r--printing/printmod.ml6
-rw-r--r--proofs/proof_global.ml18
-rw-r--r--stm/asyncTaskQueue.mli6
-rw-r--r--stm/proofBlockDelimiter.ml25
-rw-r--r--stm/stm.ml193
-rw-r--r--stm/stm.mli10
-rw-r--r--stm/vernac_classifier.ml78
-rw-r--r--stm/vernac_classifier.mli2
-rw-r--r--tactics/class_tactics.ml2
-rw-r--r--tactics/hipattern.ml63
-rw-r--r--tactics/ind_tables.ml3
-rw-r--r--tactics/leminv.ml7
-rw-r--r--tactics/leminv.mli2
-rw-r--r--tactics/tacticals.mli2
-rw-r--r--tactics/tactics.ml2
-rw-r--r--test-suite/Makefile20
-rw-r--r--test-suite/README.md75
-rw-r--r--test-suite/bugs/closed/5286.v9
-rw-r--r--test-suite/bugs/closed/6297.v8
-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/opened/6393.v11
-rwxr-xr-xtest-suite/coq-makefile/plugin-reach-outside-API-and-fail/run.sh36
-rwxr-xr-xtest-suite/coq-makefile/plugin-reach-outside-API-and-succeed-by-bypassing-the-API/run.sh31
-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
-rwxr-xr-xtest-suite/coq-makefile/timing/run.sh8
-rw-r--r--test-suite/coqchk/include.v11
-rw-r--r--test-suite/coqchk/primproj2.v10
-rw-r--r--test-suite/output-modulo-time/ltacprof_abstract.out15
-rw-r--r--test-suite/output/MExtraction.v12
-rw-r--r--test-suite/output/optimize_heap.out8
-rw-r--r--test-suite/output/optimize_heap.v7
-rw-r--r--test-suite/success/BracketsWithGoalSelector.v16
-rw-r--r--test-suite/success/abstract_poly.v2
-rw-r--r--test-suite/success/dtauto-let-deps.v24
-rw-r--r--theories/Arith/Between.v4
-rw-r--r--theories/FSets/FSetCompat.v44
-rw-r--r--tools/CoqMakefile.in8
-rw-r--r--tools/TimeFileMaker.py28
-rw-r--r--tools/coq_makefile.ml50
-rw-r--r--tools/coqdep.ml2
-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.ml112
-rw-r--r--toplevel/coqinit.mli6
-rw-r--r--toplevel/coqloop.ml10
-rw-r--r--toplevel/coqloop.mli4
-rw-r--r--toplevel/coqtop.ml50
-rw-r--r--toplevel/vernac.ml24
-rw-r--r--toplevel/vernac.mli4
-rw-r--r--vernac/auto_ind_decl.ml2
-rw-r--r--vernac/classes.ml8
-rw-r--r--vernac/comDefinition.ml91
-rw-r--r--vernac/comInductive.ml3
-rw-r--r--vernac/indschemes.ml6
-rw-r--r--vernac/lemmas.ml4
-rw-r--r--vernac/metasyntax.ml4
-rw-r--r--vernac/mltop.ml34
-rw-r--r--vernac/mltop.mli24
-rw-r--r--vernac/record.ml7
-rw-r--r--vernac/vernacentries.ml126
-rw-r--r--vernac/vernacentries.mli4
-rw-r--r--vernac/vernacinterp.ml1
-rw-r--r--vernac/vernacinterp.mli1
-rw-r--r--vernac/vernacprop.ml48
-rw-r--r--vernac/vernacprop.mli19
383 files changed, 4378 insertions, 16191 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 27519eab2..9b0cc2119 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -173,7 +173,7 @@ opam-switch: &opam-switch
name: Test
command: |
source ~/.profile
- make -f Makefile.ci -j ${NJOBS} TIMED=1 ${CIRCLE_JOB}
+ dev/ci/ci-wrapper.sh ${CIRCLE_JOB}
- persist_to_workspace:
root: *workspace
paths:
@@ -262,85 +262,85 @@ jobs:
COMPILER: *compiler-be
EXTRA_PACKAGES: *timing-packages
- ci-bignums:
+ bignums:
<<: *ci-template
- ci-color:
+ color:
<<: *ci-template
environment:
<<: *ci-template-vars
EXTRA_PACKAGES: *timing-packages
- ci-compcert:
+ compcert:
<<: *ci-template
- ci-coq-dpdgraph:
+ coq-dpdgraph:
<<: *ci-template
environment:
<<: *ci-template-vars
EXTRA_PACKAGES: "time python autoconf automake"
- ci-coquelicot:
+ coquelicot:
<<: *ci-template
environment:
<<: *ci-template-vars
EXTRA_PACKAGES: "time python autoconf automake"
- ci-equations:
+ equations:
<<: *ci-template
- ci-geocoq:
+ geocoq:
<<: *ci-template
- ci-fiat-crypto:
+ fiat-crypto:
<<: *ci-template
- ci-fiat-parsers:
+ fiat-parsers:
<<: *ci-template
environment:
<<: *ci-template-vars
EXTRA_PACKAGES: *timing-packages
- ci-flocq:
+ flocq:
<<: *ci-template
environment:
<<: *ci-template-vars
EXTRA_PACKAGES: "time python autoconf automake"
- ci-math-classes:
+ math-classes:
<<: *ci-template
- ci-corn:
+ corn:
<<: *ci-template
- ci-formal-topology:
+ formal-topology:
<<: *ci-template
- ci-hott:
+ hott:
<<: *ci-template
environment:
<<: *ci-template-vars
EXTRA_PACKAGES: "time python autoconf automake"
- ci-iris-lambda-rust:
+ iris-lambda-rust:
<<: *ci-template
- ci-ltac2:
+ ltac2:
<<: *ci-template
- ci-math-comp:
+ math-comp:
<<: *ci-template
- ci-sf:
+ sf:
<<: *ci-template
environment:
<<: *ci-template-vars
EXTRA_PACKAGES: "time python wget"
- ci-unimath:
+ unimath:
<<: *ci-template
- ci-vst:
+ vst:
<<: *ci-template
workflows:
@@ -361,38 +361,38 @@ workflows:
- test-suite: *req-main
- documentation: *req-main
- - ci-bignums: *req-main
- - ci-color:
+ - bignums: *req-main
+ - color:
requires:
- build
- - ci-bignums
- - ci-compcert: *req-main
- - ci-coq-dpdgraph: *req-main
- - ci-coquelicot: *req-main
- - ci-equations: *req-main
- - ci-geocoq: *req-main
- - ci-fiat-crypto: *req-main
- - ci-fiat-parsers: *req-main
- - ci-flocq: *req-main
- - ci-math-classes:
+ - 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
- - ci-bignums
- - ci-corn:
+ - bignums
+ - corn:
requires:
- build
- - ci-math-classes
- - ci-formal-topology:
+ - math-classes
+ - formal-topology:
requires:
- build
- - ci-corn
- - ci-hott: *req-main
- - ci-iris-lambda-rust: *req-main
- - ci-ltac2: *req-main
- - ci-math-comp: *req-main
- - ci-sf: *req-main
- - ci-unimath: *req-main
- - ci-vst: *req-main
+ - 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:
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 cec51986d..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
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e56693eac..6b52870ce 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -136,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"
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 54e7754f2..19e7075f2 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -20,10 +20,19 @@ 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:
@@ -35,7 +44,7 @@ env:
- CAMLP5_VER_BE="7.03"
- FINDLIB_VER="1.4.1"
- FINDLIB_VER_BE="1.7.3"
- - LABLGTK="lablgtk.2.16.0 lablgtk-extras.1.5"
+ - 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"
@@ -46,33 +55,68 @@ env:
- TEST_TARGET="validate" TW="travis_wait"
- TEST_TARGET="validate" COMPILER="4.02.3+32bit" TW="travis_wait"
- 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}"
- - 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-equations 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-ltac2 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"
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: []
@@ -212,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
diff --git a/API/API.ml b/API/API.ml
deleted file mode 100644
index 081ac2bb2..000000000
--- a/API/API.ml
+++ /dev/null
@@ -1,286 +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 Pattern = Pattern
-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 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 Tactypes = Tactypes
-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 ComDefinition = ComDefinition
-module ComInductive = ComInductive
-module ComFixpoint = ComFixpoint
-module Classes = Classes
-(* module Record *)
-(* module Assumptions *)
-module Vernacstate = Vernacstate
-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 a69766901..000000000
--- a/API/API.mli
+++ /dev/null
@@ -1,6239 +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
- val print : t -> Pp.t
- 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
- [@@ocaml.deprecated "Alias of Names"]
-
- val debug_pr_mind : MutInd.t -> Pp.t
- [@@ocaml.deprecated "Alias of Names"]
-
- val pr_con : Constant.t -> Pp.t
- [@@ocaml.deprecated "Alias of Names"]
-
- val string_of_con : Constant.t -> string
- [@@ocaml.deprecated "Alias of Names"]
-
- val string_of_mind : MutInd.t -> string
- [@@ocaml.deprecated "Alias of Names"]
-
- val debug_string_of_mind : MutInd.t -> string
- [@@ocaml.deprecated "Alias of Names"]
-
- val debug_string_of_con : Constant.t -> string
- [@@ocaml.deprecated "Alias of Names"]
-
- type identifier = Id.t
- [@@ocaml.deprecated "Alias of Names"]
-
- module Idset : Set.S with type elt = Id.t and type t = Id.Set.t
- [@@ocaml.deprecated "Alias of 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
- [@@ocaml.deprecated "Deprecated form, see univ.ml"]
-
- module LSet :
- sig
- include CSig.SetS with type elt = Level.t
- 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
- [@@ocaml.deprecated "Deprecated form, see univ.ml"]
-
- 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 = Level.t * constraint_type * Level.t
-
- 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
- [@@ocaml.deprecated "Deprecated form, see univ.ml"]
-
- module AUContext :
- sig
- type t
- val empty : t
- end
-
- type abstract_universe_context = AUContext.t
- [@@ocaml.deprecated "Deprecated form, see univ.ml"]
-
- module CumulativityInfo :
- sig
- type t
- end
-
- type cumulativity_info = CumulativityInfo.t
- [@@ocaml.deprecated "Deprecated form, see univ.ml"]
-
- module ACumulativityInfo :
- sig
- type t
- end
- type abstract_cumulativity_info = ACumulativityInfo.t
- [@@ocaml.deprecated "Deprecated form, see univ.ml"]
-
- 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
- [@@ocaml.deprecated "Deprecated form, see univ.ml"]
-
- type universe_set = LSet.t
- [@@ocaml.deprecated "Deprecated form, see univ.ml"]
-
- type 'a constraint_function = 'a -> 'a -> Constraint.t -> Constraint.t
-
- module LMap :
- sig
- include CMap.ExtS with type key = Level.t 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.t universe_map
- type universe_level_subst = Level.t 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
- val univ_of_sort : t -> Univ.Universe.t
-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
-
- val print : t -> Pp.t
-
- (** 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
- [@@ocaml.deprecated "use Evar.t"]
-
- type 'constr pexistential = Evar.t * 'constr array
-
- type 'a puniverses = 'a Univ.puniverses
- [@@ocaml.deprecated "use Univ.puniverses"]
-
- type pconstant = Constant.t Univ.puniverses
- type pinductive = inductive Univ.puniverses
- type pconstructor = constructor Univ.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 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
-
- val map_with_binders :
- ('a -> 'a) -> ('a -> constr -> constr) -> 'a -> constr -> constr
- val map : (constr -> constr) -> constr -> constr
-
- val fold : ('a -> constr -> 'a) -> 'a -> constr -> 'a
- val iter : (constr -> unit) -> constr -> unit
- val compare_head : (constr -> constr -> bool) -> constr -> constr -> bool
-
- 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 = Evar.t * 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 Univ.puniverses -> 'b Univ.puniverses
-
- type rec_declaration = Name.t array * types array * constr array
- type fixpoint = (int array * int) * rec_declaration
- val mkFix : fixpoint -> constr
-
- 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
-
- (** {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.t * 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
-
- type cofixpoint = int * rec_declaration
- val destCoFix : constr -> cofixpoint
-
-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
-
- open Constr
- type sorts_family = Sorts.family = InProp | InSet | InType
- [@@ocaml.deprecated "Alias of Sorts.family"]
-
- type contents = Sorts.contents = Pos | Null
- [@@ocaml.deprecated "Alias of Sorts.contents"]
-
- type sorts = Sorts.t =
- | Prop of Sorts.contents
- | Type of Univ.Universe.t
- [@@ocaml.deprecated "alias of API.Sorts.t"]
-
- type metavariable = int
- [@@ocaml.deprecated "Alias of Constr.metavariable"]
-
- type ('constr, 'types) prec_declaration = Names.Name.t array * 'types array * 'constr array
- [@@ocaml.deprecated "Alias of Constr.prec_declaration"]
-
- type 'constr pexistential = 'constr Constr.pexistential
- [@@ocaml.deprecated "Alias of Constr.pexistential"]
-
- type cast_kind = Constr.cast_kind =
- | VMcast
- | NATIVEcast
- | DEFAULTcast
- | REVERTcast
- [@@ocaml.deprecated "Alias of Constr.cast_kind"]
-
- type 'a puniverses = 'a Univ.puniverses
- [@@ocaml.deprecated "Alias of Constr.puniverses"]
- type pconstant = Names.Constant.t Univ.puniverses
- [@@ocaml.deprecated "Alias of Constr.pconstant"]
- type pinductive = Names.inductive Univ.puniverses
- [@@ocaml.deprecated "Alias of Constr.pinductive"]
- type pconstructor = Names.constructor Univ.puniverses
- [@@ocaml.deprecated "Alias of Constr.pconstructor"]
- type case_style = Constr.case_style =
- | LetStyle
- | IfStyle
- | LetPatternStyle
- | MatchStyle
- | RegularStyle
- [@@ocaml.deprecated "Alias of 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 of Constr.case_printing"]
-
- 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 : Constr.case_printing
- }
- [@@ocaml.deprecated "Alias of Constr.case_info"]
-
- type ('constr, 'types) pfixpoint =
- (int array * int) * ('constr, 'types) Constr.prec_declaration
- [@@ocaml.deprecated "Alias of Constr.pfixpoint"]
-
- type ('constr, 'types) pcofixpoint =
- int * ('constr, 'types) Constr.prec_declaration
- [@@ocaml.deprecated "Alias of Constr.pcofixpoint"]
-
- 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 Constr.pexistential
- | Sort of 'sort
- | Cast of 'constr * 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 Constr.case_info * 'constr * 'constr * 'constr array
- | Fix of ('constr, 'types) Constr.pfixpoint
- | CoFix of ('constr, 'types) Constr.pcofixpoint
- | Proj of Names.Projection.t * 'constr
- [@@ocaml.deprecated "Alias of Constr.kind_of_term"]
- type existential = Evar.t * Constr.constr array
- [@@ocaml.deprecated "Alias of Constr.existential"]
- type rec_declaration = Names.Name.t array * Constr.constr array * Constr.constr array
- [@@ocaml.deprecated "Alias of Constr.rec_declaration"]
- val kind_of_term : Constr.constr -> (Constr.constr, Constr.types, Sorts.t, Univ.Instance.t) Constr.kind_of_term
- [@@ocaml.deprecated "Alias of Constr.kind"]
- val applistc : Constr.constr -> Constr.constr list -> Constr.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
- [@@ocaml.deprecated "Alias of similarly named Constr function"]
- val mkVar : Names.Id.t -> constr
- [@@ocaml.deprecated "Alias of similarly named Constr function"]
-
- val mkMeta : Constr.metavariable -> constr
- [@@ocaml.deprecated "Alias of similarly named Constr function"]
-
- val mkEvar : Constr.existential -> constr
- [@@ocaml.deprecated "Alias of similarly named Constr function"]
- val mkSort : Sorts.t -> types
- [@@ocaml.deprecated "Alias of similarly named Constr function"]
- val mkProp : types
- [@@ocaml.deprecated "Alias of similarly named Constr function"]
- val mkSet : types
- [@@ocaml.deprecated "Alias of similarly named Constr function"]
- val mkType : Univ.Universe.t -> types
- [@@ocaml.deprecated "Alias of similarly named Constr function"]
- val mkCast : constr * Constr.cast_kind * constr -> constr
- [@@ocaml.deprecated "Alias of similarly named Constr function"]
- val mkProd : Names.Name.t * types * types -> types
- [@@ocaml.deprecated "Alias of similarly named Constr function"]
- val mkLambda : Names.Name.t * types * constr -> constr
- [@@ocaml.deprecated "Alias of similarly named Constr function"]
- val mkLetIn : Names.Name.t * constr * types * constr -> constr
- [@@ocaml.deprecated "Alias of similarly named Constr function"]
- val mkApp : constr * constr array -> constr
- [@@ocaml.deprecated "Alias of similarly named Constr function"]
- val mkConst : Names.Constant.t -> constr
- [@@ocaml.deprecated "Alias of similarly named Constr function"]
- val mkProj : Names.Projection.t * constr -> constr
- [@@ocaml.deprecated "Alias of similarly named Constr function"]
- val mkInd : Names.inductive -> constr
- [@@ocaml.deprecated "Alias of similarly named Constr function"]
- val mkConstruct : Names.constructor -> constr
- [@@ocaml.deprecated "Alias of similarly named Constr function"]
- val mkConstructU : Names.constructor Univ.puniverses -> constr
- [@@ocaml.deprecated "Alias of similarly named Constr function"]
- val mkConstructUi : (Constr.pinductive * int) -> constr
- [@@ocaml.deprecated "Alias of similarly named Constr function"]
- val mkCase : Constr.case_info * constr * constr * constr array -> constr
- [@@ocaml.deprecated "Alias of similarly named Constr function"]
- val mkFix : fixpoint -> constr
- [@@ocaml.deprecated "Alias of similarly named Constr function"]
- val mkCoFix : cofixpoint -> constr
- [@@ocaml.deprecated "Alias of similarly named Constr function"]
-
- 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
- [@@ocaml.deprecated "Alias for the function in [Constr]"]
-
- 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
- [@@ocaml.deprecated "Alias for the function in [Constr]"]
- val destVar : constr -> Names.Id.t
- [@@ocaml.deprecated "Alias for the function in [Constr]"]
- val destApp : constr -> constr * constr array
- [@@ocaml.deprecated "Alias for the function in [Constr]"]
- val destProd : types -> Names.Name.t * types * types
- [@@ocaml.deprecated "Alias for the function in [Constr]"]
- val destLetIn : constr -> Names.Name.t * constr * types * constr
- [@@ocaml.deprecated "Alias for the function in [Constr]"]
- val destEvar : constr -> Constr.existential
- [@@ocaml.deprecated "Alias for the function in [Constr]"]
- val destRel : constr -> int
- [@@ocaml.deprecated "Alias for the function in [Constr]"]
- val destConst : constr -> Names.Constant.t Univ.puniverses
- [@@ocaml.deprecated "Alias for the function in [Constr]"]
- val destCast : constr -> constr * Constr.cast_kind * constr
- [@@ocaml.deprecated "Alias for the function in [Constr]"]
- val destLambda : constr -> Names.Name.t * types * constr
- [@@ocaml.deprecated "Alias for the function in [Constr]"]
-
- val isRel : constr -> bool
- [@@ocaml.deprecated "Alias for the function in [Constr]"]
- val isVar : constr -> bool
- [@@ocaml.deprecated "Alias for the function in [Constr]"]
- val isEvar : constr -> bool
- [@@ocaml.deprecated "Alias for the function in [Constr]"]
- val isLetIn : constr -> bool
- [@@ocaml.deprecated "Alias for the function in [Constr]"]
- val isLambda : constr -> bool
- [@@ocaml.deprecated "Alias for the function in [Constr]"]
- val isConst : constr -> bool
- [@@ocaml.deprecated "Alias for the function in [Constr]"]
- val isEvar_or_Meta : constr -> bool
- [@@ocaml.deprecated "Alias for the function in [Constr]"]
- val isCast : constr -> bool
- [@@ocaml.deprecated "Alias for the function in [Constr]"]
- val isMeta : constr -> bool
- [@@ocaml.deprecated "Alias for the function in [Constr]"]
- val isApp : constr -> bool
- [@@ocaml.deprecated "Alias for the function in [Constr]"]
-
- val fold_constr : ('a -> constr -> 'a) -> 'a -> constr -> 'a
- [@@ocaml.deprecated "Alias of Constr.fold"]
-
- val eq_constr : constr -> constr -> bool
- [@@ocaml.deprecated "Alias of Constr.equal"]
-
- val hash_constr : constr -> int
- [@@ocaml.deprecated "Alias of Constr.hash"]
-
- 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
-
- val map_constr : (constr -> constr) -> constr -> constr
- [@@ocaml.deprecated "Alias of Constr.map"]
-
- val mkIndU : Constr.pinductive -> constr
- [@@ocaml.deprecated "Alias of Constr.mkIndU"]
- val mkConstU : Constr.pconstant -> constr
- [@@ocaml.deprecated "Alias of Constr.mkConstU"]
- val map_constr_with_binders :
- ('a -> 'a) -> ('a -> constr -> constr) -> 'a -> constr -> constr
- [@@ocaml.deprecated "Alias of Constr.map_with_binders"]
-
- val iter_constr : (constr -> unit) -> constr -> unit
- [@@ocaml.deprecated "Alias of Constr.iter."]
-
- (* 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
- [@@ocaml.deprecated "Alias of Constr.qe_constr_nounivs."]
-
- 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 = Evar.t
- [@@ocaml.deprecated "Alias of Constr.existential_key"]
-
- val family_of_sort : Sorts.t -> Sorts.family
- [@@ocaml.deprecated "Alias of Sorts.family"]
-
- val compare : constr -> constr -> int
- [@@ocaml.deprecated "Alias of Constr.compare."]
-
- val constr_ord : constr -> constr -> int
- [@@ocaml.deprecated "alias of Term.compare"]
-
- val destInd : constr -> Names.inductive Univ.puniverses
- [@@ocaml.deprecated "Alias for the function in [Constr]"]
- val univ_of_sort : Sorts.t -> Univ.Universe.t
- [@@ocaml.deprecated "Alias for the function in [Constr]"]
-
- val strip_lam : constr -> constr
- val strip_prod_assum : types -> types
-
- val decompose_lam_assum : constr -> Context.Rel.t * constr
- val destFix : constr -> fixpoint
- [@@ocaml.deprecated "Alias for the function in [Constr]"]
-
- val compare_constr : (constr -> constr -> bool) -> constr -> constr -> bool
- [@@ocaml.deprecated "Alias of Constr.compare_head."]
-
- type constr = Constr.t
- [@@ocaml.deprecated "Alias of Constr.t"]
- type types = Constr.t
- [@@ocaml.deprecated "Alias of Constr.types"]
-
- type fixpoint = (int array * int) * Constr.rec_declaration
- [@@ocaml.deprecated "Alias of Constr.Constr.fixpoint"]
- type cofixpoint = int * Constr.rec_declaration
- [@@ocaml.deprecated "Alias of Constr.cofixpoint"]
-
-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 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.ContextSet.t
- | Polymorphic_const of Univ.AUContext.t
-
- 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 : Constr.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.ContextSet.t
- | Polymorphic_ind of Univ.AUContext.t
- | Cumulative_ind of Univ.ACumulativityInfo.t
-
- type record_body = (Id.t * Constant.t array * projection_body array) option
-
- type recursivity_kind =
- | Finite
- | CoFinite
- | BiFinite
-
- type mutual_inductive_body = {
- mind_packets : one_inductive_body array;
- mind_record : record_body option;
- mind_finite : 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.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;
- 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 : Declarations.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.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;
- (* 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 * Constr.types in_constant_universes_entry * 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 = Constr.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 : Constr.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 Constr.fixpoint * fconstr Esubst.subs
- | FCoFix of Constr.cofixpoint * fconstr Esubst.subs
- | FCaseT of Constr.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 Constr.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:(Constr.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 -> Constr.types -> bool
-
- val dest_prod : Environ.env -> Constr.types -> Context.Rel.t * Constr.types
-
- type 'a extended_conversion_function =
- ?l2r:bool -> ?reds:Names.transparent_state -> Environ.env ->
- ?evars:((Constr.existential->Constr.t option) * UGraph.t) ->
- 'a -> 'a -> unit
- val conv : Constr.t extended_conversion_function
-end
-
-module Type_errors :
-sig
-
- open Names
- open Constr
- 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 Id.t * '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 -> Constr.types
- exception SingletonInductiveBecomesProp of Names.Id.t
- val lookup_mind_specif : Environ.env -> Names.inductive -> mind_specif
- val find_inductive : Environ.env -> Constr.types -> Constr.pinductive * Constr.t list
-end
-
-module Typeops :
-sig
- val infer_type : Environ.env -> Constr.types -> Environ.unsafe_type_judgment
- val type_of_constant_in : Environ.env -> Constr.pconstant -> Constr.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 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
- [@@ocaml.deprecated "Alias for DirPath.print"]
-
- 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 = {
- obj_dir : DirPath.t;
- obj_mp : ModPath.t;
- obj_sec : 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 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 'a universe_kind =
- | UAnonymous
- | UUnknown
- | UNamed of 'a
-
- type level_info = Libnames.reference universe_kind
- type glob_level = level_info glob_sort_gen
-
- type sort_info = (Libnames.reference * int) option 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 = Constr.case_style =
- | LetStyle
- | IfStyle
- | LetPatternStyle
- | MatchStyle
- | RegularStyle (** infer printing form from number of constructor *)
- [@@ocaml.deprecated "Alias for Constr.case_style."]
-
- 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 : Environ.env -> Constr.constr -> Univ.LSet.t
- val restrict_universe_context : Univ.ContextSet.t -> Univ.LSet.t -> Univ.ContextSet.t
-end
-
-module Nameops :
-sig
-
- open Names
-
- 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"]
-
- module Name : sig
- include module type of struct include Name end
-
- val map : (Id.t -> Id.t) -> Name.t -> t
- val get_id : t -> Names.Id.t
- val fold_right : (Names.Id.t -> 'a -> 'a) -> t -> 'a -> 'a
-
- end
-
- val name_fold : (Id.t -> 'a -> 'a) -> Name.t -> 'a -> 'a
- [@@ocaml.deprecated "alias of API.Names"]
-
- val name_app : (Id.t -> Id.t) -> Name.t -> Name.t
- [@@ocaml.deprecated "alias of API.Names"]
-
- val add_suffix : Id.t -> string -> Id.t
- val increment_subscript : Id.t -> Id.t
- val make_ident : string -> int option -> Id.t
- val out_name : Name.t -> Id.t
- [@@ocaml.deprecated "alias of API.Names"]
- val pr_lab : Label.t -> Pp.t
- [@@ocaml.deprecated "alias of API.Names"]
-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
-
-(******************************************************************************)
-(* XXX: Moved from intf *)
-(******************************************************************************)
-module Pattern :
-sig
-
- type case_info_pattern =
- { cip_style : Constr.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 Constr.fixpoint
- | PCoFix of Constr.cofixpoint
-
-end
-
-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 Evar.t
-end
-
-module Decl_kinds :
-sig
- type polymorphic = bool
- type cumulative_inductive_flag = bool
- type recursivity_kind = Declarations.recursivity_kind =
- | Finite
- | CoFinite
- | BiFinite
- [@@ocaml.deprecated "Please use [Declarations.recursivity_kind"]
-
- type discharge =
- | DoDischarge
- | NoDischarge
-
- type locality =
- | Discharge
- | Local
- | Global
-
- type definition_object_kind =
- | Definition
- | Coercion
- | SubClass
- | CanonicalStructure
- | Example
- | Fixpoint
- | CoFixpoint
- | Scheme
- | StructureComponent
- | IdentityCoercion
- | Instance
- | Method
- | Let
- 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 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 Constr.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 Constr.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 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 Constr.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 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 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 -> Constr.pinductive Univ.in_universe_context_set
- val new_Type : unit -> Constr.types
- val type_of_global : Globnames.global_reference -> Constr.types Univ.in_universe_context_set
- val constr_of_global : Globnames.global_reference -> Constr.t
- val new_univ_level : unit -> 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
- [@@ocaml.deprecated "Use 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
-
- val const_univ_entry : poly:bool -> t -> Entries.constant_universes_entry
- val ind_univ_entry : poly:bool -> t -> Entries.inductive_universes
-
- type rigid =
- | UnivRigid
- | UnivFlexible of bool
-
-end
-
-module Evd :
-sig
-
- type evar = Evar.t
- [@@ocaml.deprecated "use Evar.t"]
-
- val string_of_existential : Evar.t -> string
- [@@ocaml.deprecated "use Evar.print"]
-
- 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.t -> 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 -> Constr.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:Names.Id.t -> 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 * Constr.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.t -> evar_map -> Names.Id.t option
- val extract_all_conv_pbs : evar_map -> evar_map * evar_constraint list
- val universe_binders : evar_map -> Universes.universe_binders
- val nf_constraints : evar_map -> evar_map
- val from_ctx : UState.t -> evar_map
-
- val to_universe_context : evar_map -> Univ.UContext.t
- val const_univ_entry : poly:bool -> evar_map -> Entries.constant_universes_entry
- val ind_univ_entry : poly:bool -> evar_map -> Entries.inductive_universes
-
- 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 -> Constr.existential -> Constr.t option
- val existential_value : evar_map -> Constr.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
-
-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.Constraints.t 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
-
-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 {!Constr.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 * Constr.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 has_undefined_evars : Evd.evar_map -> EConstr.constr -> bool
- 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 -> Constr.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 -> Evar.t 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 * Evar.t list * Evar.t list)
- * Proofview_monad.Info.tree
- val numgoals : int tactic
- val with_shelf : 'a tactic -> (Evar.t list * 'a) tactic
-
- module Unsafe :
- sig
- val tclEVARS : Evd.evar_map -> unit tactic
-
- val tclGETGOALS : Evar.t list tactic
-
- val tclSETGOALS : Evar.t list -> unit tactic
-
- val tclNEWGOALS : Evar.t 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
-
-(************************************************************************)
-(* 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 : Constr.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 -> Constr.pinductive -> Constr.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 -> Constr.pinductive -> Constr.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 Univ.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 -> Constr.pinductive -> Constr.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 : ?truncation_style:bool -> ?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 : Environ.env -> Evd.evar_map ->
- 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 = Declarations.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 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 * (lstring * syntax_modifier list)
- | VernacOpenCloseScope of bool * scope_name
- | VernacDelimiters of scope_name * string option
- | VernacBindScope of scope_name * class_rawexpr list
- | VernacInfix of (lstring * syntax_modifier list) *
- Constrexpr.constr_expr * scope_name option
- | VernacNotation of
- Constrexpr.constr_expr * (lstring * syntax_modifier list) *
- scope_name option
- | VernacNotationAddFormat of string * string * string
- | VernacDefinition of (Decl_kinds.discharge * 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.discharge * 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.discharge * (fixpoint_expr * decl_notation list) list
- | VernacCoFixpoint of
- Decl_kinds.discharge * (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 Libnames.reference Misctypes.or_by_notation *
- class_rawexpr * class_rawexpr
- | VernacIdentityCoercion of 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 string list * hints_expr
- | VernacSyntacticDefinition of Names.Id.t Loc.located * (Names.Id.t list * Constrexpr.constr_expr) *
- 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 of moved from intf *)
-
-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 print_allow_match_default_clause : 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 -> Constr.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 -> (Constr.pinductive * dep_flag * Sorts.family) list -> Evd.evar_map * Constr.t list
- val build_case_analysis_scheme_default : Environ.env -> Evd.evar_map -> Constr.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 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
-
-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
- val replace_vars_constr_expr :
- Names.Id.t Names.Id.Map.t -> 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
- [@@ocaml.deprecated "use Constrexpr_ops.free_vars_of_constr_expr"]
-
-end
-
-module Constrintern :
-sig
-
- open Evd
-
- 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 -> evar_map ->
- ?impls:internalization_env -> Constrexpr.constr_expr -> evar_map * EConstr.constr
-
- val interp_type_evars : Environ.env -> Evd.evar_map ->
- ?impls:internalization_env -> Constrexpr.constr_expr -> evar_map * 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 -> Constr.types Evd.in_evar_universe_context
-
- val interp_context_evars :
- ?global_level:bool -> ?impl_env:internalization_env -> ?shift:int ->
- Environ.env -> Evd.evar_map -> Constrexpr.local_binder_expr list ->
- evar_map * (internalization_env * ((Environ.env * EConstr.rel_context) * Impargs.manual_implicits))
-
- val compute_internalization_data : Environ.env -> var_internalization_type ->
- Constr.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 Constr.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 -> Names.Id.t -> ?types:Constr.t ->
- Constr.t Entries.in_constant_universes_entry -> Names.Constant.t
- val definition_entry : ?fix_exn:Future.fix_exn ->
- ?opaque:bool -> ?inline:bool -> ?types:Constr.types ->
- ?univs:Entries.constant_universes_entry ->
- ?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 Environ.env * Evd.evar_map * 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 t
- type proof = t
- [@@ocaml.deprecated "please use [Proof.t]"]
-
- type 'a focus_kind
- val proof : t ->
- Goal.goal list * (Goal.goal list * Goal.goal list) list *
- Goal.goal list * Goal.goal list * Evd.evar_map
-
- val run_tactic : Environ.env ->
- unit Proofview.tactic -> t -> t * (bool * Proofview_monad.Info.tree)
- val unshelve : t -> t
- val maximal_unfocus : 'a focus_kind -> t -> t
- val pr_proof : t -> Pp.t
-
- module V82 :
- sig
- val grab_evars : t -> t
-
- val subgoals : t -> Goal.goal list Evd.sigma
- [@@ocaml.deprecated "Use the first and fifth argument of [Proof.proof]"]
-
- end
-end
-
-module Proof_bullet :
-sig
- val get_default_goal_selector : unit -> Vernacexpr.goal_selector
-end
-
-module Proof_global :
-sig
-
- type t
- type state = t
- [@@ocaml.deprecated "please use [Proof_global.t]"]
-
- type proof_mode = {
- name : string;
- set : unit -> unit ;
- reset : unit -> unit
- }
- type proof_object = {
- id : Names.Id.t;
- entries : Safe_typing.private_constants Entries.definition_entry list;
- persistence : Decl_kinds.goal_kind;
- universes: UState.t;
- }
-
- type proof_ending =
- | Admitted of Names.Id.t * Decl_kinds.goal_kind * Entries.parameter_entry *
- UState.t
- | 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.t -> Proof.t * 'a) -> 'a
- val simple_with_current_proof :
- (unit Proofview.tactic -> Proof.t -> Proof.t) -> unit
- val compact_the_proof : unit -> unit
- val register_proof_mode : proof_mode -> unit
-
- exception NoCurrentProof
- val give_me_the_proof : unit -> Proof.t
- (** @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_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.t -> Proof.t * bool
- val cook_proof :
- unit -> (Names.Id.t * (Safe_typing.private_constants Entries.definition_entry * UState.t * 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 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 'a with_level =
- { default_already_surrounded : Notation_term.tolerability;
- default_ensure_surrounded : Notation_term.tolerability;
- printer : 'a }
- type printer_result =
-| PrinterBasic of (unit -> Pp.t)
-| PrinterNeedsLevel of (Notation_term.tolerability -> Pp.t) with_level
- type printer_fun_with_level = Environ.env -> Evd.evar_map -> Notation_term.tolerability -> Pp.t
- 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 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
- [@@ocaml.deprecated "The global printing API is deprecated, please use the _env functions"]
-
- val pr_lconstr : Constr.t -> Pp.t
- [@@ocaml.deprecated "The global printing API is deprecated, please use the _env functions"]
-
- val pr_econstr : EConstr.constr -> Pp.t
- [@@ocaml.deprecated "The global printing API is deprecated, please use the _env functions"]
-
- val pr_glob_constr : Glob_term.glob_constr -> Pp.t
- [@@ocaml.deprecated "The global printing API is deprecated, please use the _env functions"]
-
- val pr_constr_pattern : Pattern.constr_pattern -> Pp.t
- [@@ocaml.deprecated "The global printing API is deprecated, please use the _env functions"]
-
- 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
- [@@ocaml.deprecated "The global printing API is deprecated, please use the _env functions"]
- val pr_lglob_constr : Glob_term.glob_constr -> Pp.t
- [@@ocaml.deprecated "The global printing API is deprecated, please use the _env functions"]
- val pr_leconstr_env : Environ.env -> Evd.evar_map -> EConstr.constr -> Pp.t
- val pr_leconstr : EConstr.constr -> Pp.t
- [@@ocaml.deprecated "The global printing API is deprecated, please use the _env functions"]
-
- val pr_global : Globnames.global_reference -> Pp.t
- val pr_lconstr_under_binders : Ltac_pretype.constr_under_binders -> Pp.t
- [@@ocaml.deprecated "The global printing API is deprecated, please use the _env functions"]
-
- 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 : Constr.types -> Pp.t
- [@@ocaml.deprecated "The global printing API is deprecated, please use the _env functions"]
- 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_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.ContextSet.t
-
- 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_env : Environ.env -> Evd.evar_map -> Hint_db.t -> Pp.t
- val pr_hint_db : Hint_db.t -> Pp.t
- [@@ocaml.deprecated "please used pr_hint_db_env"]
-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: Constr.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 : Environ.env -> Evd.evar_map -> 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
- [@@ocaml.deprecated "please use [Pfedit.get_current_context]"]
-end
-
-module Himsg :
-sig
- val explain_refiner_error : Environ.env -> Evd.evar_map -> 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
- 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 ComDefinition :
-sig
- val do_definition :
- program_mode:bool ->
- 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
-end
-
-module ComFixpoint :
-sig
-
- open Names
- open Constrexpr
-
- 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
- }
-
- type recursive_preentry = Names.Id.t list * Constr.t option list * Constr.types list
-
- val interp_fixpoint :
- cofix:bool ->
- 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_fixpoint_components : bool ->
- (Vernacexpr.fixpoint_expr * Vernacexpr.decl_notation list) list ->
- structured_fixpoint_expr list * Vernacexpr.decl_notation list
-
- val do_fixpoint :
- Decl_kinds.locality -> Decl_kinds.polymorphic -> (Vernacexpr.fixpoint_expr * Vernacexpr.decl_notation list) list -> unit
-
-end
-
-module ComInductive :
-sig
- open Names
- open Constrexpr
- open Vernacexpr
-
- 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 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 -> Declarations.recursivity_kind -> unit
-
- 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 -> Declarations.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 ->
- program_mode: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 Vernacstate :
-sig
-
- type t = {
- system : States.state; (* summary + libstack *)
- proof : Proof_global.t; (* proof state *)
- shallow : bool (* is the state trimmed down (libstack) *)
- }
-
- (* XXX: This should not be exported *)
- val freeze_interp_state : Summary.marshallable -> t
- val unfreeze_interp_state : t -> unit
-
-end
-
-module Vernacinterp :
-sig
-
- type deprecation = bool
-
- type atts = {
- loc : Loc.t option;
- locality : bool option;
- polymorphic : bool;
- }
-
- type 'a vernac_command = 'a -> atts:atts -> st:Vernacstate.t -> Vernacstate.t
-
- type plugin_args = Genarg.raw_generic_argument list
-
- val vinterp_add : deprecation -> Vernacexpr.extend_name -> plugin_args 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
-
- 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 Vernacstate.t 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 c155bb52f..cb4b966b0 100644
--- a/CHANGES
+++ b/CHANGES
@@ -37,9 +37,25 @@ Tactics
- 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.
@@ -57,6 +73,17 @@ 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
===========================
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index b4e6a1418..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.
@@ -48,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.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 d31b60cd0..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 = "str, unix, threads, coq.config"
-
- archive(byte) = "clib.cma"
- archive(byte) += "lib.cma"
+ requires = "coq.clib, coq.config"
- archive(native) = "clib.cmxa"
- archive(native) += "lib.cmxa"
+ archive(byte) = "lib.cma"
+ archive(native) = "lib.cmxa"
)
@@ -232,32 +240,6 @@ package "stm" (
)
-package "API" (
-
- description = "Coq API"
- version = "8.7"
-
- requires = "coq.intf, 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"
@@ -298,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 2637996ed..3e8e49c31 100644
--- a/Makefile
+++ b/Makefile
@@ -233,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
diff --git a/Makefile.build b/Makefile.build
index cbc1cbaab..f0dd46b0f 100644
--- a/Makefile.build
+++ b/Makefile.build
@@ -195,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)
@@ -417,7 +417,7 @@ $(COQTOPBYTE): $(LINKCMO) $(LIBCOQRUN) $(TOPLOOPCMA) $(COQTOP_BYTE_MLTOP)
# 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 $@'
@@ -438,21 +438,21 @@ 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
@@ -466,10 +466,8 @@ $(OCAMLLIBDEP): $(call bestobj, tools/ocamllibdep.cmo)
# 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 $@'
@@ -479,7 +477,7 @@ $(GALLINA): $(call bestobj, tools/gallina_lexer.cmo tools/gallina.cmo)
$(SHOW)'OCAMLBEST -o $@'
$(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 $@'
@@ -493,23 +491,24 @@ $(COQWC): $(call bestobj, tools/coqwc.cmo)
$(SHOW)'OCAMLBEST -o $@'
$(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, -package str,unix)
-$(COQWORKMGR): $(call bestobj, lib/clib.cma lib/lib.cma stm/spawned.cmo 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))
# 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 $@'
@@ -517,7 +516,7 @@ $(FAKEIDE): $(call bestobj, $(FAKEIDECMO)) | $(IDETOPLOOPCMA:.cma=$(BESTDYN))
# 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)
@@ -525,7 +524,7 @@ bin/votour: $(call bestobj, lib/cObj.cmo checker/analyze.cmo checker/values.cmo
# 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 )
@@ -577,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, $^)
@@ -601,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 $<
@@ -644,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 $<
@@ -727,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)diff -u --strip-trailing-cr $(MICROMEGAML) $(MICROMEGAGEN) || \
- (2>&1 echo "Error: $(MICROMEGAML) and the code generated by $(MICROMEGAV) differ !" && false)
-
# The general rule for building .vo files :
%.vo %.glob: %.v theories/Init/Prelude.vo $(VO_TOOLS_DEP)
diff --git a/Makefile.checker b/Makefile.checker
index 7e0f58875..0e429fe86 100644
--- a/Makefile.checker
+++ b/Makefile.checker
@@ -20,7 +20,7 @@ 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
@@ -33,7 +33,7 @@ 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) -linkpkg $(SYSMOD) $(CHKLIBS) $(OPTFLAGS) $(LINKMETADATA) -o $@ $^
$(STRIP) $@
@@ -43,7 +43,7 @@ $(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) -linkpkg $(SYSMOD) $(CHKLIBS) $(BYTEFLAGS) $(CUSTOM) -o $@ $^
@@ -77,9 +77,8 @@ checker/%.cmx: checker/%.ml
md5chk:
$(SHOW)'MD5SUM cic.mli'
- $(HIDE)v=`tr -d "\r" < checker/cic.mli | $(MD5SUM) | sed -n -e 's/ .*//' -e '/^/p'`; \
- if grep -q "$$v" checker/values.ml; \
- then true; else echo "Error: outdated checker/values.ml: $$v" >&2; 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 2a6222e22..334827a93 100644
--- a/Makefile.ci
+++ b/Makefile.ci
@@ -25,9 +25,6 @@ CI_TARGETS=ci-all \
.PHONY: $(CI_TARGETS)
-_build_ci/.ci-%.done:
- +./dev/ci/ci-wrapper.sh $*
-
ci-color: ci-bignums
ci-math-classes: ci-bignums
@@ -37,7 +34,8 @@ 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-%: _build_ci/.ci-%.done
+$(CI_TARGETS): ci-%:
+ +./dev/ci/ci-wrapper.sh $*
# For emacs:
# Local Variables:
diff --git a/Makefile.common b/Makefile.common
index f436d3e8f..d3a9b0b96 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -73,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 \
@@ -100,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 d2a1e9235..db83be369 100644
--- a/Makefile.dev
+++ b/Makefile.dev
@@ -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 7d809f67a..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
diff --git a/README.md b/README.md
index 30911e78e..883630acf 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,10 @@
# Coq
-- [![Travis](https://travis-ci.org/coq/coq.svg?branch=master)](https://travis-ci.org/coq/coq/builds) Travis CI
-- [![Appveyor](https://ci.appveyor.com/api/projects/status/eln43k05pa2vm908/branch/master?svg=true)](https://ci.appveyor.com/project/coq/coq/branch/master) Appveyor CI (Windows)
-- [![Circle CI](https://circleci.com/gh/SkySkimmer/coq/tree/circle-ci.svg?style=shield&circle-token=70b9a75b750778d8b252afe18a81de7c4cd0299b)](https://circleci.com/gh/SkySkimmer/workflows/coq) Circle CI
-
+[![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
@@ -16,9 +16,13 @@ read the [help page](https://coq.inria.fr/opam/www/using.html) on how to install
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
diff --git a/appveyor.yml b/appveyor.yml
index 92fc629b3..64c1bedb5 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -12,22 +12,20 @@ environment:
matrix:
- USEOPAM: true
ARCH: 64
-# Comment out until issue #5998 is fixed.
-# - USEOPAM: false
-# ARCH: 32
-# - USEOPAM: false
-# ARCH: 64
+ - USEOPAM: false
+ ARCH: 32
+ - USEOPAM: false
+ ARCH: 64
build_script:
- cmd: 'call %APPVEYOR_BUILD_FOLDER%\dev\ci\appveyor.bat'
test: off
-# Comment out until issue #5998 is fixed.
-#artifacts:
-# - path: 'dev\nsis\*.exe'
-# name: installer
+artifacts:
+ - path: 'dev\nsis\*.exe'
+ name: installer
-# - path: 'coq-opensource-archive-*.zip'
-# name: opensource-archive
+ - path: 'coq-opensource-archive-*.zip'
+ name: opensource-archive
diff --git a/checker/checker.ml b/checker/checker.ml
index fee31b667..b8b4d5dc2 100644
--- a/checker/checker.ml
+++ b/checker/checker.ml
@@ -208,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 "\""
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 4a0e706aa..95dd18f5f 100644
--- a/checker/cic.mli
+++ b/checker/cic.mli
@@ -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) } *)
@@ -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 = {
diff --git a/checker/closure.ml b/checker/closure.ml
index 3a56bba01..98f8c4a82 100644
--- a/checker/closure.ml
+++ b/checker/closure.ml
@@ -822,6 +822,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 02d8b22fa..ce8c64e30 100644
--- a/checker/closure.mli
+++ b/checker/closure.mli
@@ -147,6 +147,8 @@ 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/environ.ml b/checker/environ.ml
index 9db0d60e8..bbd043c8e 100644
--- a/checker/environ.ml
+++ b/checker/environ.ml
@@ -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 6bda838f8..36e0ea027 100644
--- a/checker/environ.mli
+++ b/checker/environ.mli
@@ -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
@@ -47,7 +52,7 @@ val check_constraints : Univ.constraints -> env -> bool
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 | IsProj
+type const_evaluation_result = NoBody | Opaque
exception NotEvaluableConst of const_evaluation_result
val constant_value : env -> Constant.t puniverses -> constr
val evaluable_constant : Constant.t -> env -> bool
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/inductive.ml b/checker/inductive.ml
index 22353ec16..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
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 4357a690e..7685863ea 100644
--- a/checker/mod_checking.ml
+++ b/checker/mod_checking.ml
@@ -26,6 +26,9 @@ 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
@@ -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/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 9b8eac04c..d4b258f58 100644
--- a/checker/reduction.ml
+++ b/checker/reduction.ml
@@ -276,11 +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 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
let unfold_projection infos p c =
let pb = lookup_projection p (infos_env infos) in
@@ -339,7 +357,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 ->
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 5a371164c..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 56ac4cade33eff3d26ed5cdadb580c7e 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,7 +226,7 @@ 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_set|]; [|v_abs_context|]|]
@@ -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 77c9999c4..8cb97a2b1 100644
--- a/checker/votour.ml
+++ b/checker/votour.ml
@@ -210,7 +210,6 @@ let access_list v 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
@@ -249,8 +248,7 @@ let rec get_children v o pos = match v with
|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
@@ -395,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 0ef7c3d8b..0ef7c3d8b 100644
--- a/lib/cList.ml
+++ b/clib/cList.ml
diff --git a/lib/cList.mli b/clib/cList.mli
index f87db04cf..f87db04cf 100644
--- a/lib/cList.mli
+++ b/clib/cList.mli
diff --git a/lib/cMap.ml b/clib/cMap.ml
index b4c4aedd0..b4c4aedd0 100644
--- a/lib/cMap.ml
+++ b/clib/cMap.ml
diff --git a/lib/cMap.mli b/clib/cMap.mli
index 5e65bd200..5e65bd200 100644
--- a/lib/cMap.mli
+++ b/clib/cMap.mli
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 32e9d2af0..32e9d2af0 100644
--- a/lib/cSig.mli
+++ b/clib/cSig.mli
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 34fb660db..34fb660db 100644
--- a/lib/cUnix.ml
+++ b/clib/cUnix.ml
diff --git a/lib/cUnix.mli b/clib/cUnix.mli
index d08dc4c40..d08dc4c40 100644
--- a/lib/cUnix.mli
+++ b/clib/cUnix.mli
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 64535d35f..64535d35f 100644
--- a/lib/dyn.ml
+++ b/clib/dyn.ml
diff --git a/lib/dyn.mli b/clib/dyn.mli
index 2206394e2..2206394e2 100644
--- a/lib/dyn.mli
+++ b/clib/dyn.mli
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 37079af78..37079af78 100644
--- a/lib/hMap.ml
+++ b/clib/hMap.ml
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 1666df0bd..e2d9d0d01 100644
--- a/config/coq_config.mli
+++ b/config/coq_config.mli
@@ -52,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
diff --git a/configure.ml b/configure.ml
index 06aa5e766..06a7dd822 100644
--- a/configure.ml
+++ b/configure.ml
@@ -276,7 +276,8 @@ 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/"
@@ -342,8 +343,12 @@ 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,
@@ -388,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. *)
@@ -561,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 =
@@ -758,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 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"
@@ -802,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");
@@ -865,13 +866,6 @@ let strip =
if strip = "" then "strip" else strip
end
-(** * md5sum command *)
-
-let md5sum =
- select_command "Don’t know how to compute MD5 checksums…" [
- "md5sum", [], [ "--version" ];
- "md5", ["-q"], [ "-s" ; "''" ];
- ]
(** * Documentation : do we have latex, hevea, ... *)
@@ -1056,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";
@@ -1134,7 +1128,7 @@ let write_configml f =
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
@@ -1143,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
@@ -1155,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
@@ -1251,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
index 3dd24bac4..af2a13a84 100644
--- a/default.nix
+++ b/default.nix
@@ -36,6 +36,7 @@ stdenv.mkDerivation rec {
ocaml
findlib
camlp5_strict
+ num
]) ++ (if buildIde then [
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 d7059fe74..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 *)
@@ -193,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 *)
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.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 48f1d3759..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"
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 232b8a56e..628e89291 100644
--- a/dev/ci/ci-basic-overlay.sh
+++ b/dev/ci/ci-basic-overlay.sh
@@ -4,141 +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}
+: "${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://scm.gforge.inria.fr/anonscm/git/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_BRANCH:=master}
-: ${CoLoR_CI_GITURL:=https://github.com/fblanqui/color.git}
+: "${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}
+: "${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 d68674381..c90e516ae 100755
--- a/dev/ci/ci-bignums.sh
+++ b/dev/ci/ci-bignums.sh
@@ -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-common.sh b/dev/ci/ci-common.sh
index 1bfdf7dfb..05fa33e97 100644
--- a/dev/ci/ci-common.sh
+++ b/dev/ci/ci-common.sh
@@ -2,12 +2,25 @@
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"
+ fi
+ export COQBIN="$PWD/bin"
fi
export PATH="$COQBIN:$PATH"
@@ -17,14 +30,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 +52,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 +69,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 fc3cef342..6a0ce2aef 100755
--- a/dev/ci/ci-compcert.sh
+++ b/dev/ci/ci-compcert.sh
@@ -5,7 +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}
( 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-equations.sh b/dev/ci/ci-equations.sh
index f7470463d..62854afac 100755
--- a/dev/ci/ci-equations.sh
+++ b/dev/ci/ci-equations.sh
@@ -7,4 +7,4 @@ 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 -j ${NJOBS} && make -j ${NJOBS} test-suite && make -j ${NJOBS} examples && make install)
+( cd ${Equations_CI_DIR} && coq_makefile -f _CoqProject -o Makefile && make && make test-suite && make examples && make install)
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-ltac2.sh b/dev/ci/ci-ltac2.sh
index ed4003601..820ff89ee 100755
--- a/dev/ci/ci-ltac2.sh
+++ b/dev/ci/ci-ltac2.sh
@@ -7,4 +7,4 @@ ltac2_CI_DIR=${CI_BUILD_DIR}/ltac2
git_checkout ${ltac2_CI_BRANCH} ${ltac2_CI_GITURL} ${ltac2_CI_DIR}
-( cd ${ltac2_CI_DIR} && make -j ${NJOBS} && make tests && make install )
+( cd ${ltac2_CI_DIR} && make && make tests && make install )
diff --git a/dev/ci/ci-wrapper.sh b/dev/ci/ci-wrapper.sh
index a21bf9f38..12a70176c 100755
--- a/dev/ci/ci-wrapper.sh
+++ b/dev/ci/ci-wrapper.sh
@@ -15,13 +15,13 @@ function travis_fold {
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
travis_fold 'end' 'coq.test.timing'
-
-touch "_build_ci/.ci-${CI_NAME}.done"
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/01033-SkySkimmer-restrict-harder.sh b/dev/ci/user-overlays/01033-SkySkimmer-restrict-harder.sh
deleted file mode 100644
index 5c4dd1324..000000000
--- a/dev/ci/user-overlays/01033-SkySkimmer-restrict-harder.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-if [ "$TRAVIS_PULL_REQUEST" = "1033" ] || [ "$TRAVIS_BRANCH" = "restrict-harder" ]; then
- formal_topology_CI_BRANCH=ci
- formal_topology_CI_GITURL=https://github.com/SkySkimmer/topology.git
-
- HoTT_CI_BRANCH=coq-pr-1033
- HoTT_CI_GITURL=https://github.com/SkySkimmer/HoTT.git
-
- Equations_CI_GITURL=https://github.com/SkySkimmer/Coq-Equations.git
-fi
diff --git a/dev/ci/user-overlays/06158-herbelin-master+fix-pr6158-ltac-value-printer.sh b/dev/ci/user-overlays/06158-herbelin-master+fix-pr6158-ltac-value-printer.sh
deleted file mode 100644
index cdca8e525..000000000
--- a/dev/ci/user-overlays/06158-herbelin-master+fix-pr6158-ltac-value-printer.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-if [ "$TRAVIS_PULL_REQUEST" = "6158" ] || [ "$TRAVIS_BRANCH" = "master+some-fix-ltac-printing+refined-printers" ]; then
- ltac2_CI_BRANCH=master+fix-pr6158-ltac-value-printer
- ltac2_CI_GITURL=https://github.com/herbelin/ltac2.git
-fi
diff --git a/dev/ci/user-overlays/06169-Zimmi48-clean-up-deprecated-options.sh b/dev/ci/user-overlays/06169-Zimmi48-clean-up-deprecated-options.sh
deleted file mode 100644
index 6741cf26f..000000000
--- a/dev/ci/user-overlays/06169-Zimmi48-clean-up-deprecated-options.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-if [ "$TRAVIS_PULL_REQUEST" = "6169" ] || [ "$TRAVIS_BRANCH" = "clean-up/deprecated-options" ]; then
- ltac2_CI_BRANCH=master
- ltac2_CI_GITURL=https://github.com/Zimmi48/ltac2
-fi
diff --git a/dev/ci/user-overlays/06197-ejgallego-plugins+remove_locality_hack.sh b/dev/ci/user-overlays/06197-ejgallego-plugins+remove_locality_hack.sh
deleted file mode 100644
index c9f1272be..000000000
--- a/dev/ci/user-overlays/06197-ejgallego-plugins+remove_locality_hack.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-if [ "$TRAVIS_PULL_REQUEST" = "6197" ] || [ "$TRAVIS_BRANCH" = "plugins+remove_locality_hack" ]; then
- ltac2_CI_BRANCH=localityfixyou
- ltac2_CI_GITURL=https://github.com/ejgallego/ltac2.git
-fi
diff --git a/dev/ci/user-overlays/06217-coqdep-at-once.sh b/dev/ci/user-overlays/06217-coqdep-at-once.sh
deleted file mode 100644
index 68e1901f7..000000000
--- a/dev/ci/user-overlays/06217-coqdep-at-once.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-if [ "$TRAVIS_PULL_REQUEST" = "6217" ] || [ "$TRAVIS_BRANCH" = "coqdep-at-once" ]; then
- UniMath_CI_GITURL=https://github.com/SkySkimmer/UniMath.git
-fi
diff --git a/dev/ci/user-overlays/06324-SkySkimmer-abstract-vs-restrict.sh b/dev/ci/user-overlays/06324-SkySkimmer-abstract-vs-restrict.sh
deleted file mode 100644
index 7e9b5febd..000000000
--- a/dev/ci/user-overlays/06324-SkySkimmer-abstract-vs-restrict.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-if [ "$TRAVIS_PULL_REQUEST" = "6324" ] || [ "$TRAVIS_BRANCH" = "fix-6323-restrict+abstract" ]; then
- Equations_CI_BRANCH=fix-coq-6324
- Equations_CI_GITURL=https://github.com/SkySkimmer/Coq-Equations.git
-fi
diff --git a/dev/ci/user-overlays/06392-ejgallego-econstr+fix_class.sh b/dev/ci/user-overlays/06392-ejgallego-econstr+fix_class.sh
deleted file mode 100644
index c0dcf79e1..000000000
--- a/dev/ci/user-overlays/06392-ejgallego-econstr+fix_class.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-if [ "$TRAVIS_PULL_REQUEST" = "6392" ] || [ "$TRAVIS_BRANCH" = "econstr+fix_class" ]; then
- Equations_CI_BRANCH=econstr+fix_class
- Equations_CI_GITURL=https://github.com/ejgallego/Coq-Equations.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/06413-ejgallego-interp+less_impstyle_p2.sh b/dev/ci/user-overlays/06413-ejgallego-interp+less_impstyle_p2.sh
deleted file mode 100644
index 8aea7dee3..000000000
--- a/dev/ci/user-overlays/06413-ejgallego-interp+less_impstyle_p2.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-if [ "$TRAVIS_PULL_REQUEST" = "6413" ] || [ "$TRAVIS_BRANCH" = "interp+less_impstyle_p2" ]; then
- Equations_CI_BRANCH=interp+less_impstyle_p2
- Equations_CI_GITURL=https://github.com/ejgallego/Coq-Equations.git
-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/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 24ae3957e..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,34 +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.ppidmapgen
-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 01aa6b599..e616bd566 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
@@ -68,6 +58,13 @@ 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".
+### 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 fa145d498..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
@@ -59,6 +59,29 @@ Debugging from Caml debugger
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
============================
diff --git a/dev/doc/setup.txt b/dev/doc/setup.txt
index 26f3d0ddc..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)
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 87a829746..e3ec51aeb 100755
--- a/dev/lint-repository.sh
+++ b/dev/lint-repository.sh
@@ -9,7 +9,7 @@
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)" ];
@@ -22,14 +22,13 @@ then
# 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
index 4c4dbe1e9..d7acf01f1 100755
--- a/dev/tools/backport-pr.sh
+++ b/dev/tools/backport-pr.sh
@@ -1,10 +1,11 @@
#!/usr/bin/env bash
-# Usage: dev/tools/backport-pr.sh <PR number>
+# 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."
@@ -49,6 +50,10 @@ else
fi
+if [[ "${OPTION}" == "--stop-before-merging" ]]; then
+ exit 0
+fi
+
git merge -S --no-ff ${BRANCH} -m "${MESSAGE}"
git branch -d ${BRANCH}
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
index 0c4a79bfd..9f24960ff 100755
--- a/dev/tools/merge-pr.sh
+++ b/dev/tools/merge-pr.sh
@@ -9,18 +9,18 @@ set -e
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
+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'`
+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'`
+COMMIT=$(git rev-parse FETCH_HEAD)
+STATUS=$(curl -s "$API/commits/$COMMIT/status" | jq -r '.state')
-if [ $BASE_BRANCH != "coq:$CURRENT_LOCAL_BRANCH" ]; then
+if [ "$BASE_BRANCH" != "coq:$CURRENT_LOCAL_BRANCH" ]; then
echo "Wrong base branch"
read -p "Bypass? [y/N] " -n 1 -r
echo
@@ -30,7 +30,7 @@ if [ $BASE_BRANCH != "coq:$CURRENT_LOCAL_BRANCH" ]; then
fi
fi;
-if [ $STATUS != "success" ]; then
+if [ "$STATUS" != "success" ]; then
echo "CI status is \"$STATUS\""
read -p "Bypass? [y/N] " -n 1 -r
echo
@@ -40,10 +40,10 @@ if [ $STATUS != "success" ]; then
fi
fi;
-git merge -S --no-ff FETCH_HEAD -m "Merge PR #$PR: `curl -s $API/pulls/$PR | jq -r '.title'`" -e
+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 $REMOTE/$CURRENT_LOCAL_BRANCH dev/ci` ]]; then
+if ! git diff --quiet "$REMOTE/$CURRENT_LOCAL_BRANCH" -- dev/ci; then
echo "******************************************"
echo "** WARNING: does this PR have overlays? **"
echo "******************************************"
diff --git a/dev/tools/should-check-whitespace.sh b/dev/tools/should-check-whitespace.sh
deleted file mode 100755
index d85d65107..000000000
--- a/dev/tools/should-check-whitespace.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/usr/bin/env bash
-
-# determine if a file has whitespace checking enabled in .gitattributes
-
-git ls-files --error-unmatch "$1" >/dev/null 2>&1 &&
-git check-attr whitespace -- "$1" | grep -q -v -e 'unset$' -e '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 832040ad2..af38ce4b8 100644
--- a/dev/top_printers.ml
+++ b/dev/top_printers.ml
@@ -50,13 +50,13 @@ 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
@@ -65,8 +65,6 @@ 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_env (Global.env()) x))
@@ -111,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} =
@@ -149,8 +147,8 @@ let genppj f j = let (c,t) = f j in (c ++ str " : " ++ t)
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)
@@ -200,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)
@@ -233,7 +230,7 @@ let ppenvwithcst e = pp
str "[" ++ pr_rel_context e Evd.empty (rel_context e) ++ str "]" ++ spc() ++
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)
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 8e43bf6ed..f819d2e6a 100644
--- a/dev/vm_printers.ml
+++ b/dev/vm_printers.ml
@@ -3,7 +3,7 @@ open Term
open Names
open Cbytecodes
open Cemitcodes
-open Vm
+open Vmvalues
let ppripos (ri,pos) =
(match ri with
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/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 89f0b5ae1..c4c0435c5 100644
--- a/doc/refman/RefMan-ltac.tex
+++ b/doc/refman/RefMan-ltac.tex
@@ -732,7 +732,7 @@ and
{\tt finish\_timing} ({\qstring}) {\qstring}
\end{quote}
which (re)set and display an optionally named timer, respectively.
-The parenthsized {\qstring} argument to {\tt finish\_timing} is also
+The parenthesized {\qstring} argument to {\tt finish\_timing} is also
optional, and determines the label associated with the timer for
printing.
@@ -1426,6 +1426,16 @@ You can also pass the {\tt -profile-ltac} command line option to {\tt coqc}, whi
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-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 1d3311edc..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}
@@ -555,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/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 a65b3941e..9ac16b5b4 100644
--- a/engine/eConstr.ml
+++ b/engine/eConstr.ml
@@ -695,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
@@ -817,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
diff --git a/engine/eConstr.mli b/engine/eConstr.mli
index 30de748a1..6fa338c73 100644
--- a/engine/eConstr.mli
+++ b/engine/eConstr.mli
@@ -251,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
diff --git a/engine/evarutil.ml b/engine/evarutil.ml
index 3445b744a..f82ffccdc 100644
--- a/engine/evarutil.ml
+++ b/engine/evarutil.ml
@@ -257,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
@@ -282,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 =
@@ -330,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 *)
@@ -350,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 *
@@ -425,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
@@ -692,6 +735,55 @@ 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
diff --git a/engine/evarutil.mli b/engine/evarutil.mli
index 9d0b973a7..923bf49a9 100644
--- a/engine/evarutil.mli
+++ b/engine/evarutil.mli
@@ -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. *)
@@ -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
diff --git a/engine/evd.ml b/engine/evd.ml
index e33c851f6..0e9472158 100644
--- a/engine/evd.ml
+++ b/engine/evd.ml
@@ -855,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 =
diff --git a/engine/proofview.ml b/engine/proofview.ml
index 3b945c87f..0a6435195 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
diff --git a/engine/termops.ml b/engine/termops.ml
index a71bdff31..40b3d0d8b 100644
--- a/engine/termops.ml
+++ b/engine/termops.ml
@@ -1463,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 c1600abe8..a3559a693 100644
--- a/engine/termops.mli
+++ b/engine/termops.mli
@@ -159,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
diff --git a/engine/uState.ml b/engine/uState.ml
index 6131f4c03..4b650c9c9 100644
--- a/engine/uState.ml
+++ b/engine/uState.ml
@@ -201,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
@@ -516,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 =
diff --git a/engine/universes.ml b/engine/universes.ml
index 30490ec56..eaddf98a8 100644
--- a/engine/universes.ml
+++ b/engine/universes.ml
@@ -181,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
@@ -519,13 +543,60 @@ 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 c with
| Evar (evk, args) ->
@@ -605,7 +676,7 @@ let normalize_opt_subst ctx =
in !ectx
type universe_opt_subst = Universe.t option universe_map
-
+
let make_opt_subst s =
fun x ->
(match Univ.LMap.find x s with
@@ -614,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
diff --git a/engine/universes.mli b/engine/universes.mli
index 1a98d969b..130dcf8bb 100644
--- a/engine/universes.mli
+++ b/engine/universes.mli
@@ -154,6 +154,11 @@ val extend_context : 'a in_universe_context_set -> ContextSet.t ->
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.t option universe_map
val make_opt_subst : universe_opt_subst -> universe_subst_fn
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/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_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..a7e9003db 100644
--- a/ide/coq_lex.mll
+++ b/ide/coq_lex.mll
@@ -17,7 +17,9 @@
let space = [' ' '\n' '\r' '\t' '\012'] (* '\012' is form-feed *)
-let undotted_sep = '{' | '}' | '-'+ | '+'+ | '*'+
+let number = [ '0'-'9' ]+
+
+let undotted_sep = (number space* ':' space*)? '{' | '}' | '-'+ | '+'+ | '*'+
let dot_sep = '.' (space | eof)
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 58599a14d..5f40a2242 100644
--- a/ide/ide_slave.ml
+++ b/ide/ide_slave.ml
@@ -54,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
@@ -69,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]) *)
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 0977a1890..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) *)
@@ -465,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.mli b/interp/constrexpr_ops.mli
index 3ecb3d321..6e5c0f851 100644
--- a/interp/constrexpr_ops.mli
+++ b/interp/constrexpr_ops.mli
@@ -84,7 +84,7 @@ 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 } *)
+(** {6 Folds and maps} *)
(** Used in typeclasses *)
val fold_constr_expr_with_binders : (Id.t -> 'a -> 'a) ->
diff --git a/interp/declare.ml b/interp/declare.ml
index 0adad1419..55f825c25 100644
--- a/interp/declare.ml
+++ b/interp/declare.ml
@@ -31,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 (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 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 = {
@@ -162,7 +104,7 @@ let discharge_constant ((sp, kn), obj) =
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
@@ -195,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
@@ -229,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 = [] ;
@@ -265,6 +207,78 @@ let declare_definition ?(internal=UserIndividualRequest)
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 =
@@ -319,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)
@@ -335,7 +350,7 @@ 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.ContextSet.empty;
mind_entry_private = None;
diff --git a/interp/discharge.ml b/interp/discharge.ml
index 5b4b5f67b..75bfca307 100644
--- a/interp/discharge.ml
+++ b/interp/discharge.ml
@@ -78,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 0197cf9ae..d7962e29a 100644
--- a/interp/dumpglob.ml
+++ b/interp/dumpglob.ml
@@ -68,6 +68,7 @@ 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 ->
@@ -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"
diff --git a/interp/impargs.ml b/interp/impargs.ml
index 3105214d5..ed1cd5276 100644
--- a/interp/impargs.ml
+++ b/interp/impargs.ml
@@ -548,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/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/intf/decl_kinds.ml b/intf/decl_kinds.ml
index b0c1f6661..b9a3f0c21 100644
--- a/intf/decl_kinds.ml
+++ b/intf/decl_kinds.ml
@@ -77,6 +77,9 @@ type logical_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/vernacexpr.ml b/intf/vernacexpr.ml
index c7a9db1cb..8bd2da2f1 100644
--- a/intf/vernacexpr.ml
+++ b/intf/vernacexpr.ml
@@ -314,14 +314,18 @@ 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 * (lstring * syntax_modifier list)
| VernacOpenCloseScope of bool * scope_name
@@ -456,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
@@ -468,19 +472,19 @@ 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
-
-and vernac_implicit_status = Implicit | MaximallyImplicit | NotImplicit
-
-and vernac_argument_status = {
- name : Name.t;
- recarg_like : bool;
- notation_scope : string Loc.located option;
- implicit_status : vernac_implicit_status;
-}
+type nonrec vernac_flag =
+ | VernacProgram
+ | VernacPolymorphic of bool
+ | VernacLocal of bool
+
+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
(* A vernac classifier provides information about the exectuion of a
command:
diff --git a/kernel/cClosure.ml b/kernel/cClosure.ml
index 31ded9129..b1181157e 100644
--- a/kernel/cClosure.ml
+++ b/kernel/cClosure.ml
@@ -258,7 +258,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 +282,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 +306,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 }
@@ -810,7 +800,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
diff --git a/kernel/constr.ml b/kernel/constr.ml
index 5930cfadc..1ff1fcc4c 100644
--- a/kernel/constr.ml
+++ b/kernel/constr.ml
@@ -1178,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 21c477578..19ffa8fe3 100644
--- a/kernel/constr.mli
+++ b/kernel/constr.mli
@@ -203,7 +203,7 @@ 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:
@@ -459,7 +459,3 @@ val case_info_hash : case_info -> int
(*********************************************************************)
val hcons : constr -> constr
-
-(**************************************)
-
-type values
diff --git a/kernel/cooking.ml b/kernel/cooking.ml
index 7b921d35b..23a578d99 100644
--- a/kernel/cooking.ml
+++ b/kernel/cooking.ml
@@ -168,38 +168,47 @@ 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 =
@@ -234,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;
diff --git a/kernel/csymtable.ml b/kernel/csymtable.ml
index 2ffe36fcf..2bbb867cd 100644
--- a/kernel/csymtable.ml
+++ b/kernel/csymtable.ml
@@ -15,7 +15,7 @@
open Util
open Names
open Constr
-open Vm
+open Vmvalues
open Cemitcodes
open Cbytecodes
open Declarations
@@ -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 91bb30e7e..fc935f6ee 100644
--- a/kernel/csymtable.mli
+++ b/kernel/csymtable.mli
@@ -12,7 +12,7 @@ open Names
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.t -> unit
val set_transparent_const : Constant.t -> unit
diff --git a/kernel/declarations.ml b/kernel/declarations.ml
index 7f4b85fd0..5b9e1a141 100644
--- a/kernel/declarations.ml
+++ b/kernel/declarations.ml
@@ -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
diff --git a/kernel/declareops.ml b/kernel/declareops.ml
index d8768a0fc..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 } *)
diff --git a/kernel/declareops.mli b/kernel/declareops.mli
index 198831848..0eed11f49 100644
--- a/kernel/declareops.mli
+++ b/kernel/declareops.mli
@@ -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 ca79de404..36b75668b 100644
--- a/kernel/entries.ml
+++ b/kernel/entries.ml
@@ -81,6 +81,13 @@ 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 =
diff --git a/kernel/environ.ml b/kernel/environ.ml
index 1afab453a..738ecc6e1 100644
--- a/kernel/environ.ml
+++ b/kernel/environ.ml
@@ -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
diff --git a/kernel/environ.mli b/kernel/environ.mli
index 7cc541258..69d811a64 100644
--- a/kernel/environ.mli
+++ b/kernel/environ.mli
@@ -146,13 +146,11 @@ val type_in_type_constant : Constant.t -> 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.t puniverses -> constr constrained
val constant_type : env -> Constant.t puniverses -> types constrained
-val constant_opt_value : env -> Constant.t puniverses -> (constr * Univ.Constraint.t) option
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
diff --git a/kernel/indtypes.ml b/kernel/indtypes.ml
index 8e9b606a5..b117f8714 100644
--- a/kernel/indtypes.ml
+++ b/kernel/indtypes.ml
@@ -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
@@ -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
diff --git a/kernel/inductive.ml b/kernel/inductive.ml
index 2a629f00a..722705bd7 100644
--- a/kernel/inductive.ml
+++ b/kernel/inductive.ml
@@ -38,14 +38,14 @@ let find_inductive env c =
let (t, l) = decompose_app (whd_all env c) in
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 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
@@ -796,18 +796,18 @@ 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
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_typing.ml b/kernel/mod_typing.ml
index f7e755f00..b7eb481ee 100644
--- a/kernel/mod_typing.ml
+++ b/kernel/mod_typing.ml
@@ -94,8 +94,8 @@ let rec check_with_def env struc (idl,(c,ctx)) mp equiv =
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/names.mli b/kernel/names.mli
index 709ebeb7f..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. *)
diff --git a/kernel/nativecode.ml b/kernel/nativecode.ml
index c558e9ed0..613b2f2ec 100644
--- a/kernel/nativecode.ml
+++ b/kernel/nativecode.ml
@@ -1830,7 +1830,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 +1838,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
@@ -1919,15 +1919,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
diff --git a/kernel/nativelambda.ml b/kernel/nativelambda.ml
index de4dc2107..b333b0fb9 100644
--- a/kernel/nativelambda.ml
+++ b/kernel/nativelambda.ml
@@ -515,7 +515,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 *)
@@ -639,7 +639,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
diff --git a/kernel/opaqueproof.ml b/kernel/opaqueproof.ml
index 45a62d55a..c2fcfbfd6 100644
--- a/kernel/opaqueproof.ml
+++ b/kernel/opaqueproof.ml
@@ -16,7 +16,7 @@ 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 }
+ 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 *)
diff --git a/kernel/opaqueproof.mli b/kernel/opaqueproof.mli
index 20d76ce23..c8339e6eb 100644
--- a/kernel/opaqueproof.mli
+++ b/kernel/opaqueproof.mli
@@ -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
diff --git a/kernel/pre_env.ml b/kernel/pre_env.ml
index c5254b453..6c5e1cde5 100644
--- a/kernel/pre_env.ml
+++ b/kernel/pre_env.ml
@@ -15,7 +15,6 @@
open Util
open Names
-open Constr
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 054ae1743..a6b57bd1b 100644
--- a/kernel/pre_env.mli
+++ b/kernel/pre_env.mli
@@ -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
diff --git a/kernel/safe_typing.ml b/kernel/safe_typing.ml
index 5150ad411..93b8e278f 100644
--- a/kernel/safe_typing.ml
+++ b/kernel/safe_typing.ml
@@ -382,23 +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 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
diff --git a/kernel/safe_typing.mli b/kernel/safe_typing.mli
index a30bb37e6..757b803a3 100644
--- a/kernel/safe_typing.mli
+++ b/kernel/safe_typing.mli
@@ -90,7 +90,7 @@ val push_named_assum :
(** 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.ContextSet.t safe_transformer
+ Id.t * Entries.section_def_entry -> safe_transformer0
(** Insertion of global axioms or definitions *)
@@ -106,8 +106,8 @@ type exported_private_constant =
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) *)
diff --git a/kernel/subtyping.ml b/kernel/subtyping.ml
index 2913c6dfa..d0d5cb1d5 100644
--- a/kernel/subtyping.ml
+++ b/kernel/subtyping.ml
@@ -193,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
diff --git a/kernel/term.ml b/kernel/term.ml
index aa8805952..fae990d45 100644
--- a/kernel/term.ml
+++ b/kernel/term.ml
@@ -92,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 *)
diff --git a/kernel/term.mli b/kernel/term.mli
index f5cb72f4e..c9a8cf6e1 100644
--- a/kernel/term.mli
+++ b/kernel/term.mli
@@ -572,8 +572,8 @@ type ('constr, 'types, 'sort, 'univs) kind_of_term =
| Proj of projection * 'constr
[@@ocaml.deprecated "Alias for Constr.kind_of_term"]
-type values = Constr.values
-[@@ocaml.deprecated "Alias for Constr.values"]
+type values = Vmvalues.values
+[@@ocaml.deprecated "Alias for Vmvalues.values"]
val hash_constr : Constr.constr -> int
[@@ocaml.deprecated "Alias for Constr.hash"]
diff --git a/kernel/term_typing.ml b/kernel/term_typing.ml
index 70dd6438d..5f501bff1 100644
--- a/kernel/term_typing.ml
+++ b/kernel/term_typing.ml
@@ -227,17 +227,15 @@ let feedback_completion_typecheck =
Option.iter (fun state_id ->
feedback ~id:state_id Feedback.Complete)
-let abstract_constant_universes abstract = function
+let abstract_constant_universes = function
| Monomorphic_const_entry uctx ->
Univ.empty_level_subst, Monomorphic_const uctx
| Polymorphic_const_entry uctx ->
- if not abstract then
- Univ.empty_level_subst, Monomorphic_const (Univ.ContextSet.of_context uctx)
- else
- let sbst, auctx = Univ.abstract_universes uctx in
- sbst, Polymorphic_const auctx
+ 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,(t,uctx),nl) ->
let env = match uctx with
@@ -245,10 +243,7 @@ let infer_declaration (type a) ~(trust : a trust) env kn (dcl : a constant_entry
| Polymorphic_const_entry uctx -> push_context ~strict:false uctx env
in
let j = infer env t in
- let abstract = not (Option.is_empty kn) in
- let usubst, univs =
- abstract_constant_universes abstract uctx
- in
+ let usubst, univs = abstract_constant_universes uctx in
let c = Typeops.assumption_of_judgment env j in
let t = Constr.hcons (Vars.subst_univs_level_constr usubst c) in
{
@@ -306,22 +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, univsctx = match c.const_entry_universes with
- | Monomorphic_const_entry univs -> false, univs
- | Polymorphic_const_entry univs -> true, 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 = not (Option.is_empty kn) in
- let ctx = if poly
- then Polymorphic_const_entry (Univ.ContextSet.to_context ctx)
- else Monomorphic_const_entry ctx
+ 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 usubst, univs = abstract_constant_universes abstract ctx in
let j = infer env body in
let typ = match typ with
| None ->
@@ -493,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 =
@@ -533,14 +535,10 @@ type side_effect_role =
type exported_side_effect =
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,_,_,_) =
@@ -609,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
@@ -623,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 55da4197e..7bc029010 100644
--- a/kernel/term_typing.mli
+++ b/kernel/term_typing.mli
@@ -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.ContextSet.t
+val translate_local_def : env -> Id.t -> section_def_entry ->
+ constr * types
val translate_local_assum : env -> types -> types
@@ -62,8 +62,8 @@ type exported_side_effect =
* 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 -> MutInd.t -> mutual_inductive_entry -> mutual_inductive_body
@@ -72,7 +72,7 @@ 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.t option ->
+val infer_declaration : trust:'a trust -> env ->
'a constant_entry -> Cooking.result
val build_constant_declaration :
diff --git a/kernel/univ.ml b/kernel/univ.ml
index 8cf9028fb..f72f6f26a 100644
--- a/kernel/univ.ml
+++ b/kernel/univ.ml
@@ -686,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 *)
@@ -718,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
@@ -1128,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 ->
@@ -1168,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 459394439..63bef1b81 100644
--- a/kernel/univ.mli
+++ b/kernel/univ.mli
@@ -238,8 +238,6 @@ type universe_level_subst_fn = Level.t -> Level.t
type universe_subst = Universe.t universe_map
type universe_level_subst = Level.t universe_map
-val level_subst_of : universe_subst_fn -> universe_level_subst_fn
-
(** {6 Universe instances} *)
module Instance :
@@ -461,18 +459,21 @@ val is_empty_subst : universe_subst -> bool
val make_subst : universe_subst -> universe_subst_fn
val subst_univs_universe : universe_subst_fn -> Universe.t -> Universe.t
-val subst_univs_constraints : universe_subst_fn -> Constraint.t -> Constraint.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 : Instance.t -> Instance.t -> Instance.t
val subst_instance_universe : Instance.t -> Universe.t -> Universe.t
val make_instance_subst : Instance.t -> universe_level_subst
-val make_inverse_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 : UContext.t -> universe_level_subst * AUContext.t
+val make_inverse_instance_subst : Instance.t -> universe_level_subst
-val abstract_cumulativity_info : CumulativityInfo.t -> universe_level_subst * ACumulativityInfo.t
+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 : AUContext.t -> Instance.t
diff --git a/kernel/vars.ml b/kernel/vars.ml
index eae917b5a..b3b3eff62 100644
--- a/kernel/vars.ml
+++ b/kernel/vars.ml
@@ -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 = CProfile.declare_profile "subst_univs_constr" in
- CProfile.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
diff --git a/kernel/vars.mli b/kernel/vars.mli
index 964de4e95..b74d25260 100644
--- a/kernel/vars.mli
+++ b/kernel/vars.mli
@@ -129,12 +129,6 @@ 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
diff --git a/kernel/vconv.ml b/kernel/vconv.ml
index 3ef297b1f..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 =
diff --git a/kernel/vconv.mli b/kernel/vconv.mli
index 7f727df47..c3c9636e8 100644
--- a/kernel/vconv.mli
+++ b/kernel/vconv.mli
@@ -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 51101f88e..352ea74a4 100644
--- a/kernel/vm.ml
+++ b/kernel/vm.ml
@@ -6,47 +6,13 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-open Names
-open Sorts
-open Constr
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 =
@@ -62,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.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_up = values
-
-type whd =
- | Vsort of Sorts.t
- | 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.Level.t
(************************************************)
(* Abstract machine *****************************)
@@ -178,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.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"
-
-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"
-
+(* 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
@@ -568,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
@@ -603,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 =
@@ -615,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
| _ ->
@@ -623,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
@@ -634,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 -> 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/vm.mli b/kernel/vm.mli
index bc38452d4..c6d92ba26 100644
--- a/kernel/vm.mli
+++ b/kernel/vm.mli
@@ -6,118 +6,28 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-open Names
-open Constr
-open Cbytecodes
+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.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 to_up
-
-type whd =
- | Vsort of Sorts.t
- | 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.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
-
-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
-
-(** 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/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/flags.ml b/lib/flags.ml
index 644f66d02..ee4c0734a 100644
--- a/lib/flags.ml
+++ b/lib/flags.ml
@@ -48,8 +48,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
@@ -110,14 +108,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
diff --git a/lib/flags.mli b/lib/flags.mli
index 000862b2c..33d281798 100644
--- a/lib/flags.mli
+++ b/lib/flags.mli
@@ -35,9 +35,6 @@ val profile : bool
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
@@ -77,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
diff --git a/lib/lib.mllib b/lib/lib.mllib
index 66f939a91..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
-CProfile
Explore
-Predicate
-Rtree
-Heap
-Unionfind
-Genarg
-CEphemeron
+RTree
+CProfile
Future
+Spawn
+
+CAst
+DAst
+Genarg
+
RemoteCounter
+Aux_file
+Envars
+CoqProject_file
diff --git a/lib/system.ml b/lib/system.ml
index 2c8dbac7c..e56736eb1 100644
--- a/lib/system.ml
+++ b/lib/system.ml
@@ -294,18 +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
diff --git a/lib/system.mli b/lib/system.mli
index c02bc9c8a..0c0cc9fae 100644
--- a/lib/system.mli
+++ b/lib/system.mli
@@ -104,4 +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
+val with_time : batch:bool -> ('a -> 'b) -> 'a -> 'b
diff --git a/library/global.ml b/library/global.ml
index ce37dfecf..ed847b7cd 100644
--- a/library/global.ml
+++ b/library/global.ml
@@ -81,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)
diff --git a/library/global.mli b/library/global.mli
index 324181e79..03bc945da 100644
--- a/library/global.mli
+++ b/library/global.mli
@@ -32,11 +32,11 @@ 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.ContextSet.t
+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.t
diff --git a/library/lib.ml b/library/lib.ml
index 499e2ae21..971089c17 100644
--- a/library/lib.ml
+++ b/library/lib.ml
@@ -417,8 +417,11 @@ 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 =
@@ -483,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
@@ -502,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
@@ -654,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 721e2896f..cf75d5f8c 100644
--- a/library/lib.mli
+++ b/library/lib.mli
@@ -153,13 +153,22 @@ 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.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.Instance.t * Names.Id.t array
diff --git a/parsing/g_vernac.ml4 b/parsing/g_vernac.ml4
index 444f36833..d498bda34 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
@@ -617,11 +621,9 @@ 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
- VernacLocal(false,
- VernacDefinition ((NoDischarge,CanonicalStructure),((Loc.tag s),None),d))
+ VernacDefinition ((NoDischarge,CanonicalStructure),((Loc.tag s),None),d)
(* Coercions *)
| IDENT "Coercion"; qid = global; d = def_body ->
diff --git a/parsing/pcoq.ml b/parsing/pcoq.ml
index b766f0c6b..c934d38a2 100644
--- a/parsing/pcoq.ml
+++ b/parsing/pcoq.ml
@@ -503,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"
@@ -517,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)
diff --git a/parsing/pcoq.mli b/parsing/pcoq.mli
index 3ca013a96..756d9487d 100644
--- a/parsing/pcoq.mli
+++ b/parsing/pcoq.mli
@@ -251,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
@@ -261,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
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/extraction/extraction.ml b/plugins/extraction/extraction.ml
index 4ae875cd7..c169b7b50 100644
--- a/plugins/extraction/extraction.ml
+++ b/plugins/extraction/extraction.ml
@@ -431,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);
diff --git a/plugins/firstorder/formula.ml b/plugins/firstorder/formula.ml
index c55040df0..4c59996aa 100644
--- a/plugins/firstorder/formula.ml
+++ b/plugins/firstorder/formula.ml
@@ -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/funind/functional_principles_types.mli b/plugins/funind/functional_principles_types.mli
index a3315f22c..ad396a2cb 100644
--- a/plugins/funind/functional_principles_types.mli
+++ b/plugins/funind/functional_principles_types.mli
@@ -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 87609296b..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(Decl_kinds.NoDischarge, 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 889c064b2..0b929b8ca 100644
--- a/plugins/funind/glob_term_to_relation.ml
+++ b/plugins/funind/glob_term_to_relation.ml
@@ -1498,7 +1498,7 @@ let do_build_inductive
try
with_full_print
(Flags.silently (ComInductive.do_mutual_inductive rel_inds (Flags.is_universe_polymorphism ()) false false))
- Decl_kinds.Finite
+ Declarations.Finite
with
| UserError(s,msg) as e ->
let _time3 = System.get_time () in
@@ -1509,7 +1509,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
@@ -1524,7 +1524,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_termops.ml b/plugins/funind/glob_termops.ml
index 0666ab4f1..be8abb92e 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
@@ -575,97 +506,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 =
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 071599d9c..071bab2f3 100644
--- a/plugins/funind/indfun.ml
+++ b/plugins/funind/indfun.ml
@@ -282,7 +282,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 ->
diff --git a/plugins/funind/invfun.ml b/plugins/funind/invfun.ml
index 694c80051..4acf82d00 100644
--- a/plugins/funind/invfun.ml
+++ b/plugins/funind/invfun.ml
@@ -56,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
@@ -87,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]
@@ -194,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.
@@ -218,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~:
@@ -752,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
@@ -809,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 ->
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 9fcb35f89..000000000
--- a/plugins/funind/merge.ml
+++ /dev/null
@@ -1,1013 +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 Constr
-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 Constr.compare_head (fun _ _ -> false) t1 t2
- then true
- else false
-
-let rec compare_constr' t1 t2 =
- if compare_constr_nosub t1 t2
- then true
- else (Constr.compare_head (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 Constr.map_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 =
- let sigma, env = Pfedit.get_current_context () in
- msg (str" " ++ Printer.pr_lconstr_env env sigma c)
-
-let prconstrnl c =
- let sigma, env = Pfedit.get_current_context () in
- msg (str" " ++ Printer.pr_lconstr_env env sigma c ++ str"\n")
-
-let prlistconstr lc = List.iter prconstr lc
-let prstr s = msg(str s)
-let prNamedConstr s c =
- let sigma, env = Pfedit.get_current_context () in
- begin
- msg(str "");
- msg(str(s^" {§ ") ++ Printer.pr_lconstr_env env sigma c ++ str " §} ");
- msg(str "");
- end
-let prNamedRConstr s c =
- let sigma, env = Pfedit.get_current_context () in
- begin
- msg(str "");
- msg(str(s^" {§ ") ++ Printer.pr_glob_constr_env env 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,_,_ = ComInductive.extract_mutual_inductive_declaration_components [(indexpr,[])] in
- let mie,pl,impls = ComInductive.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 (ComInductive.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 Constr.kind c with
- | Ind(((u,_),_)) | Construct(((u,_),_),_) -> MutInd.equal u mut_induct
- | _ -> false in
- let _dom_i c =
- assert (is_dom c);
- match Constr.kind c with
- | Ind((u,i)) | Construct((u,_),i) -> i
- | _ -> assert false in
- let _is_pred c shift =
- match Constr.kind 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 363ad5dfc..8fe05b497 100644
--- a/plugins/funind/recdef.ml
+++ b/plugins/funind/recdef.ml
@@ -861,7 +861,7 @@ let rec prove_le g =
| App (c, [| x0 ; _ |]) ->
EConstr.isVar sigma x0 &&
Id.equal (destVar sigma x0) (destVar sigma x) &&
- is_global sigma (le ()) c
+ EConstr.is_global sigma (le ()) c
| _ -> false
in
let (h,t) = List.find (fun (_,t) -> matching_fun t) (pf_hyps_types g)
diff --git a/plugins/funind/recdef.mli b/plugins/funind/recdef.mli
index 50b84731b..b95d64ce9 100644
--- a/plugins/funind/recdef.mli
+++ b/plugins/funind/recdef.mli
@@ -1,6 +1,5 @@
open Constr
-(* val evaluable_of_global_reference : Libnames.global_reference -> Names.evaluable_global_reference *)
val tclUSER_if_not_mes :
Tacmach.tactic ->
bool ->
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/extratactics.ml4 b/plugins/ltac/extratactics.ml4
index 982fc7cc3..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,28 @@ 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 poly = Flags.use_polymorphic_flag () 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 ?locality l2r lc n bl =
- Hints.add_hints (Locality.make_module_locality locality) 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 FUNCTIONAL EXTEND HintResolveIffLR CLASSIFIED AS SIDEFF
[ "Hint" "Resolve" "->" ne_global_list(lc) natural_opt(n)
":" preident_list(bl) ] ->
[ fun ~atts ~st -> begin
- let open Vernacinterp in
- add_hints_iff ?locality:atts.locality true lc n bl;
+ add_hints_iff ~atts true lc n bl;
st
end
]
| [ "Hint" "Resolve" "->" ne_global_list(lc) natural_opt(n) ] ->
[ fun ~atts ~st -> begin
- let open Vernacinterp in
- add_hints_iff ?locality:atts.locality true lc n ["core"];
+ add_hints_iff ~atts true lc n ["core"];
st
end
]
@@ -346,15 +344,13 @@ VERNAC COMMAND FUNCTIONAL EXTEND HintResolveIffRL CLASSIFIED AS SIDEFF
[ "Hint" "Resolve" "<-" ne_global_list(lc) natural_opt(n)
":" preident_list(bl) ] ->
[ fun ~atts ~st -> begin
- let open Vernacinterp in
- add_hints_iff ?locality:atts.locality false lc n bl;
+ add_hints_iff ~atts false lc n bl;
st
end
]
| [ "Hint" "Resolve" "<-" ne_global_list(lc) natural_opt(n) ] ->
[ fun ~atts ~st -> begin
- let open Vernacinterp in
- add_hints_iff ?locality:atts.locality false lc n ["core"];
+ add_hints_iff ~atts false lc n ["core"];
st
end
]
@@ -430,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 Sorts.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 Sorts.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
(**********************************************************************)
@@ -1117,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_ltac.ml4 b/plugins/ltac/g_ltac.ml4
index ebf6e450b..cc7ce339b 100644
--- a/plugins/ltac/g_ltac.ml4
+++ b/plugins/ltac/g_ltac.ml4
@@ -327,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;
diff --git a/plugins/ltac/rewrite.ml b/plugins/ltac/rewrite.ml
index a698b05dd..3cbb11001 100644
--- a/plugins/ltac/rewrite.ml
+++ b/plugins/ltac/rewrite.ml
@@ -1981,8 +1981,7 @@ let add_morphism_infer glob m n =
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,
@@ -1993,7 +1992,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
diff --git a/plugins/ltac/taccoerce.ml b/plugins/ltac/taccoerce.ml
index 9ae112d37..e5933de2a 100644
--- a/plugins/ltac/taccoerce.ml
+++ b/plugins/ltac/taccoerce.ml
@@ -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
@@ -179,7 +171,6 @@ let id_of_name = function
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/tacinterp.ml b/plugins/ltac/tacinterp.ml
index ccded4417..f2720954d 100644
--- a/plugins/ltac/tacinterp.ml
+++ b/plugins/ltac/tacinterp.ml
@@ -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,7 +234,6 @@ 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
@@ -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
@@ -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,7 +809,6 @@ 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
@@ -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
@@ -1248,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
@@ -1324,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
@@ -1377,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) ->
@@ -1604,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/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/ssr/ssrvernac.ml4 b/plugins/ssr/ssrvernac.ml4
index 4f530a0ae..c0479dd24 100644
--- a/plugins/ssr/ssrvernac.ml4
+++ b/plugins/ssr/ssrvernac.ml4
@@ -551,9 +551,9 @@ GEXTEND Gram
| IDENT "Canonical"; qid = Constr.global;
d = G_vernac.def_body ->
let s = coerce_reference_to_id qid in
- Vernacexpr.VernacLocal(false,Vernacexpr.VernacDefinition
+ Vernacexpr.VernacDefinition
((Decl_kinds.NoDischarge,Decl_kinds.CanonicalStructure),
- ((Loc.tag s),None),(d )))
+ ((Loc.tag s),None), d)
]];
END
diff --git a/pretyping/arguments_renaming.ml b/pretyping/arguments_renaming.ml
index d59102b6c..8ac471404 100644
--- a/pretyping/arguments_renaming.ml
+++ b/pretyping/arguments_renaming.ml
@@ -40,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
diff --git a/pretyping/cbv.ml b/pretyping/cbv.ml
index 192eca63b..e42576d95 100644
--- a/pretyping/cbv.ml
+++ b/pretyping/cbv.ml
@@ -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
diff --git a/pretyping/constr_matching.ml b/pretyping/constr_matching.ml
index ec7c3077f..c3a221944 100644
--- a/pretyping/constr_matching.ml
+++ b/pretyping/constr_matching.ml
@@ -462,19 +462,21 @@ let sub_match ?(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') ->
begin try
diff --git a/pretyping/evarconv.ml b/pretyping/evarconv.ml
index f7a3789a2..41c4616f7 100644
--- a/pretyping/evarconv.ml
+++ b/pretyping/evarconv.ml
@@ -276,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
@@ -1044,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
diff --git a/pretyping/inductiveops.ml b/pretyping/inductiveops.ml
index 34df7d3d7..78e6bc6f1 100644
--- a/pretyping/inductiveops.ml
+++ b/pretyping/inductiveops.ml
@@ -275,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 *)
@@ -486,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
@@ -496,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
diff --git a/pretyping/pretyping.ml b/pretyping/pretyping.ml
index b930c5db8..92dab24e2 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
diff --git a/pretyping/reductionops.ml b/pretyping/reductionops.ml
index ac8846854..78de0437d 100644
--- a/pretyping/reductionops.ml
+++ b/pretyping/reductionops.ml
@@ -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
diff --git a/pretyping/tacred.ml b/pretyping/tacred.ml
index 5a522e06a..f682143f8 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
diff --git a/pretyping/typeclasses.ml b/pretyping/typeclasses.ml
index bbb3a1bb2..3f947fd23 100644
--- a/pretyping/typeclasses.ml
+++ b/pretyping/typeclasses.ml
@@ -65,7 +65,7 @@ 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;
@@ -87,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;
}
@@ -97,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
@@ -107,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 }
(*
@@ -175,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
@@ -213,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
@@ -420,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 =
diff --git a/pretyping/typeclasses.mli b/pretyping/typeclasses.mli
index 8ee061330..ee28ec173 100644
--- a/pretyping/typeclasses.mli
+++ b/pretyping/typeclasses.mli
@@ -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;
@@ -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
diff --git a/pretyping/typing.ml b/pretyping/typing.ml
index 43066c809..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
diff --git a/pretyping/unification.ml b/pretyping/unification.ml
index 30674fee2..8df8f8474 100644
--- a/pretyping/unification.ml
+++ b/pretyping/unification.ml
@@ -6,8 +6,6 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-module CVars = Vars
-
open CErrors
open Pp
open Util
@@ -666,7 +664,7 @@ let is_eta_constructor_app env sigma ts f l1 term =
| 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
@@ -1527,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 {
@@ -1617,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 =
diff --git a/pretyping/vnorm.ml b/pretyping/vnorm.ml
index e395bdbc6..b21fbf0eb 100644
--- a/pretyping/vnorm.ml
+++ b/pretyping/vnorm.ml
@@ -15,6 +15,7 @@ open Vars
open Environ
open Inductive
open Reduction
+open Vmvalues
open Vm
open Context.Rel.Declaration
@@ -134,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
@@ -144,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
@@ -191,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
@@ -254,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) ;
@@ -266,14 +267,14 @@ and nf_predicate env sigma ind mip params v pT =
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
@@ -307,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 ->
diff --git a/printing/ppvernac.ml b/printing/ppvernac.ml
index 46ef2ac03..7e68a97e4 100644
--- a/printing/ppvernac.ml
+++ b/printing/ppvernac.ml
@@ -31,12 +31,6 @@ 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
@@ -77,10 +71,6 @@ 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_smart_global = Pputils.pr_or_by_notation pr_reference
let pr_ltac_ref = Libnames.pr_reference
@@ -91,7 +81,7 @@ open Decl_kinds
let sep_end = function
| VernacBullet _
- | VernacSubproof None
+ | VernacSubproof _
| VernacEndSubproof -> str""
| _ -> str"."
@@ -535,16 +525,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 ->
@@ -607,24 +614,6 @@ 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) ->
return (
@@ -1208,26 +1197,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 647111bbe..2b7886d11 100644
--- a/printing/prettyp.ml
+++ b/printing/prettyp.ml
@@ -235,8 +235,8 @@ 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
[Id.print mipv.(0).mind_typename ++ str" has primitive projections" ++ eta ++ str"."]
| _ -> []
diff --git a/printing/printmod.ml b/printing/printmod.ml
index 05292b06b..fb9d45a79 100644
--- a/printing/printmod.ml
+++ b/printing/printmod.ml
@@ -125,7 +125,7 @@ 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"
@@ -184,7 +184,7 @@ let print_record env mind mib udecl =
(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"
@@ -346,7 +346,7 @@ let print_body is_impl env mp (l,body) =
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"
diff --git a/proofs/proof_global.ml b/proofs/proof_global.ml
index 167d6bda0..fc94a1013 100644
--- a/proofs/proof_global.ml
+++ b/proofs/proof_global.ml
@@ -343,16 +343,15 @@ 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
+ 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 keep_body_ucst_separate ||
- not (Safe_typing.empty_private_constants = eff) then
+ 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
@@ -486,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/stm/asyncTaskQueue.mli b/stm/asyncTaskQueue.mli
index 07689389f..706d36e1d 100644
--- a/stm/asyncTaskQueue.mli
+++ b/stm/asyncTaskQueue.mli
@@ -71,7 +71,7 @@ module type Task = sig
(** Extra arguments of the task kind, for -toploop *)
val extra_env : unit -> string array
- (** {5} Master API, it is run by the master, on a thread *)
+ (** {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
@@ -116,8 +116,8 @@ module type Task = sig
(** [forward_feedback fb] sends fb to all the workers. *)
val forward_feedback : Feedback.feedback -> unit
- (** {5} Worker API, it is run by worker, on a different fresh
- process *)
+ (** {5 Worker API, it is run by worker, on a different fresh
+ process} *)
(** [perform in] synchronously processes a request [in] *)
val perform : request -> response
diff --git a/stm/proofBlockDelimiter.ml b/stm/proofBlockDelimiter.ml
index 77642946c..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
@@ -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/stm.ml b/stm/stm.ml
index 1d46e0833..5f4fe6565 100644
--- a/stm/stm.ml
+++ b/stm/stm.ml
@@ -20,6 +20,7 @@ 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
@@ -111,7 +112,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)
@@ -119,14 +120,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 () =
@@ -545,12 +546,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 (_,((_,i),_),_) -> Id.to_string i
+ | VernacStartTheoremProof (_,[Some ((_,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 =
@@ -984,7 +983,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
@@ -1049,25 +1048,26 @@ let stm_vernac_interp ?proof ?route id st { verbose; loc; expr } : Vernacstate.t
(* 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 *****************************************)
@@ -1083,7 +1083,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 (* {{{ *)
@@ -1131,7 +1131,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
@@ -1149,7 +1153,7 @@ end = struct (* {{{ *)
if VCS.is_interactive () = `No && !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) ->
@@ -1242,7 +1246,7 @@ let _ = CErrors.register_handler (function
type document_node = {
indentation : int;
- ast : Vernacexpr.vernac_expr;
+ ast : Vernacexpr.vernac_control;
id : Stateid.t;
}
@@ -1257,7 +1261,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 =
@@ -1494,7 +1498,7 @@ end = struct (* {{{ *)
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 *)
@@ -1642,7 +1646,7 @@ end = struct (* {{{ *)
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 ->
@@ -1931,15 +1935,16 @@ end = struct (* {{{ *)
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 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
@@ -2107,30 +2112,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
+ let is_defined_expr = function
| VernacEndProof (Proved (Transparent,_)) -> true
- | VernacTime (_, e) -> is_defined_expr e
- | VernacRedirect (_, (_, e)) -> is_defined_expr e
- | VernacTimeout (_, e) -> is_defined_expr e
| _ -> 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
- | Some (_, ({ expr = VernacProof(_,Some _) } as v)) -> Some v
+ | VernacProof(_,Some _) -> true
+ | _ -> false
+ in
+ let proof_using_ast = function
+ | 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
@@ -2138,7 +2156,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*)
@@ -2158,7 +2177,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
@@ -2177,9 +2196,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)
| _ ->
@@ -2752,7 +2775,7 @@ let process_transaction ?(newtip=Stateid.fresh ()) ?(part_of_script=true)
if !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);
@@ -2814,7 +2837,7 @@ let process_transaction ?(newtip=Stateid.fresh ()) ?(part_of_script=true)
rc
(* Side effect on all branches *)
- | VtUnknown, _ when expr = VernacToplevelControl Drop ->
+ | 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
@@ -2826,7 +2849,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;
@@ -2849,12 +2872,11 @@ let process_transaction ?(newtip=Stateid.fresh ()) ?(part_of_script=true)
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"];
@@ -2994,16 +3016,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 =
diff --git a/stm/stm.mli b/stm/stm.mli
index ef95be0e4..587b75642 100644
--- a/stm/stm.mli
+++ b/stm/stm.mli
@@ -39,7 +39,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 +53,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 +111,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 +174,7 @@ type static_block_declaration = {
type document_node = {
indentation : int;
- ast : Vernacexpr.vernac_expr;
+ ast : Vernacexpr.vernac_control;
id : Stateid.t;
}
@@ -189,7 +189,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 =
diff --git a/stm/vernac_classifier.ml b/stm/vernac_classifier.ml
index c5ae27a11..99b56d484 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,14 @@ 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 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
@@ -106,17 +85,20 @@ let rec classify_vernac e =
| VernacDefinition ((Decl_kinds.DoDischarge,_),((_,i),_),ProveBody _) ->
VtStartProof(default_proof_mode (),Doesn'tGuaranteeOpacity,[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,[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
+ let guarantee = if poly then Doesn'tGuaranteeOpacity else GuaranteesOpacity in
+ VtStartProof (default_proof_mode (),guarantee,ids), VtLater
+ | VernacGoal _ ->
+ let guarantee = if poly then Doesn'tGuaranteeOpacity else GuaranteesOpacity in
+ VtStartProof (default_proof_mode (),guarantee,[]), VtLater
| VernacFixpoint (discharge,l) ->
let guarantee =
- match discharge with
- | Decl_kinds.NoDischarge -> GuaranteesOpacity
- | Decl_kinds.DoDischarge -> Doesn'tGuaranteeOpacity
+ if discharge = Decl_kinds.DoDischarge || poly then Doesn'tGuaranteeOpacity
+ else GuaranteesOpacity
in
let ids, open_proof =
List.fold_left (fun (l,b) ((((_,id),_),_,_,_,p),_) ->
@@ -126,9 +108,8 @@ let rec classify_vernac e =
else VtSideff ids, VtLater
| VernacCoFixpoint (discharge,l) ->
let guarantee =
- match discharge with
- | Decl_kinds.NoDischarge -> GuaranteesOpacity
- | Decl_kinds.DoDischarge -> Doesn'tGuaranteeOpacity
+ if discharge = Decl_kinds.DoDischarge || poly then Doesn'tGuaranteeOpacity
+ else GuaranteesOpacity
in
let ids, open_proof =
List.fold_left (fun (l,b) ((((_,id),_),_,_,p),_) ->
@@ -207,10 +188,27 @@ let rec classify_vernac e =
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/tactics/class_tactics.ml b/tactics/class_tactics.ml
index 9e4d132d4..cfadfc535 100644
--- a/tactics/class_tactics.ml
+++ b/tactics/class_tactics.ml
@@ -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/hipattern.ml b/tactics/hipattern.ml
index 2c8ca1972..2bb9be66b 100644
--- a/tactics/hipattern.ml
+++ b/tactics/hipattern.ml
@@ -48,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
@@ -88,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
@@ -111,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 *)
@@ -364,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)
diff --git a/tactics/ind_tables.ml b/tactics/ind_tables.ml
index e1bf32f3c..bc2fea2bd 100644
--- a/tactics/ind_tables.ml
+++ b/tactics/ind_tables.ml
@@ -121,8 +121,7 @@ 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 c = Universes.subst_opt_univs_constr (Evd.evar_universe_context_subst ctx) c in
let univs =
if p then Polymorphic_const_entry (UState.context ctx)
else Monomorphic_const_entry (UState.context_set ctx)
diff --git a/tactics/leminv.ml b/tactics/leminv.ml
index 01065868d..197b3030d 100644
--- a/tactics/leminv.ml
+++ b/tactics/leminv.ml
@@ -234,10 +234,9 @@ let inversion_scheme env sigma t sort dep_option inv_op =
let p = Evarutil.nf_evars_universes sigma invProof in
p, sigma
-let add_inversion_lemma name env sigma t sort dep inv_op =
+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 =
- let poly = Flags.use_polymorphic_flag () in
Evd.const_univ_entry ~poly sigma
in
let entry = definition_entry ~univs invProof in
@@ -247,13 +246,13 @@ let add_inversion_lemma name env sigma t sort dep inv_op =
(* 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 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 sigma 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.mli b/tactics/tacticals.mli
index 169ac5c90..55c519e24 100644
--- a/tactics/tacticals.mli
+++ b/tactics/tacticals.mli
@@ -23,7 +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 API.Tacticals.tclTHENLIST"]
+[@@ocaml.deprecated "alias of Tacticals.tclTHENLIST"]
val tclTHENLIST : tactic list -> tactic
val tclTHEN_i : tactic -> (int -> tactic) -> tactic
val tclTHENFIRST : tactic -> tactic -> tactic
diff --git a/tactics/tactics.ml b/tactics/tactics.ml
index 508040ec1..4ee0a8a7b 100644
--- a/tactics/tactics.ml
+++ b/tactics/tactics.ml
@@ -1492,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
diff --git a/test-suite/Makefile b/test-suite/Makefile
index dbd63a57b..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)
@@ -174,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)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}" ")" -o "(" -n "${CIRCLECI}" ")" ]; 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
#######################################################################
@@ -312,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){ \
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/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/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/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/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/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 e48f704a2..000000000
--- a/test-suite/coq-makefile/plugin-reach-outside-API-and-fail/run.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-
-set -e
-
-cat > _CoqProject <<EOT
--I src/
-
-./src/test_plugin.mllib
-./src/test.ml4
-./src/test.mli
-EOT
-
-mkdir -p 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 4a8f58655..000000000
--- a/test-suite/coq-makefile/plugin-reach-outside-API-and-succeed-by-bypassing-the-API/run.sh
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env bash
-
-set -e
-
-cat > _CoqProject <<EOT
--bypass-API
--I src/
-
-./src/test_plugin.mllib
-./src/test.ml4
-./src/test.mli
-EOT
-
-mkdir -p 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/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/run.sh b/test-suite/coq-makefile/timing/run.sh
index 898af5590..2439d3f37 100755
--- a/test-suite/coq-makefile/timing/run.sh
+++ b/test-suite/coq-makefile/timing/run.sh
@@ -31,16 +31,16 @@ 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
@@ -74,7 +74,7 @@ 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/output-modulo-time/ltacprof_abstract.out b/test-suite/output-modulo-time/ltacprof_abstract.out
index c60c5abdd..fef4fa248 100644
--- a/test-suite/output-modulo-time/ltacprof_abstract.out
+++ b/test-suite/output-modulo-time/ltacprof_abstract.out
@@ -1,14 +1,17 @@
-total time: 0.964s
+total time: 0.922s
tactic local total calls max
────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
-─sleep' -------------------------------- 100.0% 100.0% 1 0.964s
-─abstract (sleep; constructor) --------- 0.0% 100.0% 1 0.964s
+─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.964s
- ├─sleep' ------------------------------ 100.0% 100.0% 1 0.964s
- └─constructor ------------------------- 0.0% 0.0% 1 0.000s
+─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/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/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/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/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/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/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/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/tools/CoqMakefile.in b/tools/CoqMakefile.in
index 33a2f8593..ca02c983d 100644
--- a/tools/CoqMakefile.in
+++ b/tools/CoqMakefile.in
@@ -119,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
@@ -176,7 +178,7 @@ 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)))
@@ -334,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'
@@ -346,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:
diff --git a/tools/TimeFileMaker.py b/tools/TimeFileMaker.py
index a5a5fa8fe..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)
@@ -108,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"):
@@ -125,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, (fix_sign_for_sorting(int(abs(to_seconds(diff_times_dict[name]))), descending=descending), 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/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 3a195c1df..b3b5375bf 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:Libnames.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,65 @@ let push_include s alias implicit =
let ml_includes = ref []
let push_ml_include s = ml_includes := s :: !ml_includes
+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 []
+
(* Initializes the LoadPath *)
let 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 [Libnames.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 "." Libnames.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
+
+ (* 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"] @
+
+ (* 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..089847f5d 100644
--- a/toplevel/coqinit.mli
+++ b/toplevel/coqinit.mli
@@ -13,13 +13,11 @@ 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_load_path : load_init:bool -> Mltop.coq_path list
val init_ocaml_path : unit -> unit
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 437b7b0ac..9719f60bb 100644
--- a/toplevel/coqtop.ml
+++ b/toplevel/coqtop.ml
@@ -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 *)
@@ -291,7 +292,7 @@ let ensure_exists f =
compile_error (hov 0 (str "Can't find file" ++ spc () ++ str f))
(* 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
@@ -316,7 +317,7 @@ let compile ~verbosely ~f_in ~f_out =
require_libs = require_libs ()
}) 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 +325,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 ();
@@ -351,10 +352,10 @@ let compile ~verbosely ~f_in ~f_out =
require_libs = require_libs ()
}) 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 +370,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 +382,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 *)
@@ -488,11 +489,11 @@ 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.init_load_path ~load_init:!load_init in
+ List.iter Mltop.add_coq_path lp;
if batch then Usage.print_usage_coqc ()
else begin
Mltop.load_ml_objects_raw_rex
@@ -736,7 +737,7 @@ let parse_args arglist =
|"-quiet"|"-silent" -> Flags.quiet := true; Flags.make_warn false
|"-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 ())
@@ -775,7 +776,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 lp = Coqinit.init_load_path ~load_init:!load_init in
+ List.iter Mltop.add_coq_path lp;
Option.iter Mltop.load_ml_object_raw !toploop;
let extras = !toploop_init extras in
if not (CList.is_empty extras) then begin
@@ -812,12 +814,12 @@ let init_toplevel arglist =
{ doc_type = Interactive !toplevel_name;
require_libs = require_libs ()
}) 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 ();
+ compile_files ~time:!measure_time;
schedule_vio_checking ();
schedule_vio_compilation ();
check_vio_tasks ();
diff --git a/toplevel/vernac.ml b/toplevel/vernac.ml
index 8fdaedbaf..6b45a94bc 100644
--- a/toplevel/vernac.ml
+++ b/toplevel/vernac.ml
@@ -110,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
@@ -157,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
@@ -172,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
@@ -214,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;
@@ -241,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/auto_ind_decl.ml b/vernac/auto_ind_decl.ml
index 51dd5cd4f..ec6b62ee2 100644
--- a/vernac/auto_ind_decl.ml
+++ b/vernac/auto_ind_decl.ml
@@ -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),
diff --git a/vernac/classes.ml b/vernac/classes.ml
index c2e9a5ab4..4a2dba859 100644
--- a/vernac/classes.ml
+++ b/vernac/classes.ml
@@ -69,8 +69,7 @@ let existing_instance glob g info =
let instance, _ = Global.type_of_global_in_context (Global.env ()) c 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.")
@@ -141,7 +140,7 @@ let new_instance ?(abstract=false) ?(global=false) ?(refine= !refine_instance)
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"))
@@ -393,8 +392,7 @@ let context poly l =
let cst = Declare.declare_constant ~internal:Declare.InternalTacticRequest id decl in
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
diff --git a/vernac/comDefinition.ml b/vernac/comDefinition.ml
index 883121479..d376696f7 100644
--- a/vernac/comDefinition.ml
+++ b/vernac/comDefinition.ml
@@ -11,7 +11,6 @@ open Util
open Constr
open Environ
open Entries
-open Termops
open Redexpr
open Declare
open Constrintern
@@ -49,55 +48,57 @@ let warn_implicits_in_term =
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
- 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 evd,imps,ce =
- match ctypopt with
- None ->
- let evd, subst = Evd.nf_univ_variables evd in
- let ctx = Context.Rel.map (Vars.subst_univs_constr subst) ctx in
- let env_bl = push_rel_context ctx env in
- let evd, (c, imps2) = interp_constr_evars_impls ~impls env_bl evd c in
- let c = EConstr.Unsafe.to_constr c in
- let evd,nf = Evarutil.nf_evars_and_universes evd in
- let body = nf (it_mkLambda_or_LetIn c ctx) in
- let vars = EConstr.universes_of_constr env evd (EConstr.of_constr body) in
- let evd = Evd.restrict_universe_context evd vars in
- let uctx = Evd.check_univ_decl ~poly evd decl in
- evd, imps1@(Impargs.lift_implicits nb_args imps2),
- definition_entry ~univs:uctx body
- | Some ctyp ->
- let evd, (ty, impsty) = interp_type_evars_impls ~impls env_bl evd ctyp in
- let evd, subst = Evd.nf_univ_variables evd in
- let ctx = Context.Rel.map (Vars.subst_univs_constr subst) ctx in
- let env_bl = push_rel_context ctx env in
- let evd, (c, imps2) = interp_casted_constr_evars_impls ~impls env_bl evd c ty in
- let c = EConstr.Unsafe.to_constr c in
- let evd, nf = Evarutil.nf_evars_and_universes evd 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 bodyvars = EConstr.universes_of_constr env evd (EConstr.of_constr body) in
- let tyvars = EConstr.universes_of_constr env evd (EConstr.of_constr ty) in
- let vars = Univ.LSet.union bodyvars tyvars in
- let evd = Evd.restrict_universe_context evd vars in
- let uctx = Evd.check_univ_decl ~poly evd decl in
- evd, imps1@(Impargs.lift_implicits nb_args impsty),
- definition_entry ~types:typ ~univs:uctx body
+ (* 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) =
diff --git a/vernac/comInductive.ml b/vernac/comInductive.ml
index f3f50f41d..1c8677e9c 100644
--- a/vernac/comInductive.ml
+++ b/vernac/comInductive.ml
@@ -25,7 +25,6 @@ open Nametab
open Impargs
open Reductionops
open Indtypes
-open Decl_kinds
open Pretyping
open Evarutil
open Indschemes
@@ -411,7 +410,7 @@ 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 ->
+ | 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
diff --git a/vernac/indschemes.ml b/vernac/indschemes.ml
index e4ca98749..2f4c95aff 100644
--- a/vernac/indschemes.ml
+++ b/vernac/indschemes.ml
@@ -258,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;
@@ -268,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 *)
@@ -512,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/lemmas.ml b/vernac/lemmas.ml
index 27a680b9b..6ef310837 100644
--- a/vernac/lemmas.ml
+++ b/vernac/lemmas.ml
@@ -100,7 +100,7 @@ let find_mutually_recursive_statements sigma thms =
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 Context.Rel.Declaration.is_local_assum whnf_hyp_hds))) in
@@ -110,7 +110,7 @@ let find_mutually_recursive_statements sigma thms =
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
diff --git a/vernac/metasyntax.ml b/vernac/metasyntax.ml
index 6c3dfec7d..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 () ++
diff --git a/vernac/mltop.ml b/vernac/mltop.ml
index 00554e3ba..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
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/record.ml b/vernac/record.ml
index 114b55cb4..1e464eb8b 100644
--- a/vernac/record.ml
+++ b/vernac/record.ml
@@ -143,7 +143,7 @@ let typecheck_params_and_fields finite def id poly pl t ps nots fs =
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 %> Name.get_id) assums in
- let ty = Inductive (params,(finite != BiFinite)) 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)
@@ -507,7 +507,7 @@ let declare_class finite def cum ubinders univs id idbuild paramimpls params ari
| Monomorphic_const_entry univs ->
Monomorphic_ind_entry univs
in
- let ind = declare_structure BiFinite ubinders 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
@@ -523,7 +523,7 @@ let declare_class finite def cum ubinders univs id idbuild paramimpls params ari
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
@@ -531,6 +531,7 @@ let declare_class finite def cum ubinders univs id idbuild paramimpls params ari
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
diff --git a/vernac/vernacentries.ml b/vernac/vernacentries.ml
index a581043ac..1a02a22a5 100644
--- a/vernac/vernacentries.ml
+++ b/vernac/vernacentries.ml
@@ -905,9 +905,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 Libnames.default_root_prefix ldiropt in
- Mltop.add_rec_path Mltop.AddTopML ~unix_path:pdir ~coq_root:alias ~implicit
+ 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)
@@ -915,7 +917,8 @@ 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 ~atts l =
let local = make_locality atts.locality in
@@ -1380,11 +1383,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 }
@@ -1844,11 +1849,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
@@ -1857,7 +1859,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 ->
@@ -1933,19 +1937,11 @@ let vernac_load interp fname =
* loc is the Loc.t of the vernacular command being interpreted. *)
let interp ?proof ~atts ~st c =
let open Vernacinterp in
- vernac_pperr_endline (fun () -> str "interpreting: " ++ Ppvernac.pr_vernac c);
+ 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")
@@ -1965,11 +1961,6 @@ let interp ?proof ~atts ~st 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, sl) ->
vernac_syntax_extension atts infix sl
@@ -2138,10 +2129,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). *)
@@ -2208,56 +2195,64 @@ let with_fail st b f =
end
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 ?polymorphism ~atts isprogcmd = function
-
- | VernacProgram c when not isprogcmd ->
- aux ?polymorphism ~atts true c
-
- | VernacProgram _ ->
- user_err Pp.(str "Program mode specified twice")
-
- | VernacPolymorphic (b, c) when polymorphism = None ->
- aux ~polymorphism:b ~atts:atts isprogcmd c
-
- | VernacPolymorphic (b, c) ->
- user_err Pp.(str "Polymorphism specified twice")
-
- | VernacLocal (b, c) when Option.is_empty atts.locality ->
- aux ?polymorphism ~atts:{atts with locality = Some b} isprogcmd c
-
- | VernacLocal _ ->
- user_err Pp.(str "Locality specified twice")
-
- | VernacFail v ->
- with_fail st true (fun () -> aux ?polymorphism ~atts isprogcmd v)
-
- | VernacTimeout (n,v) ->
+ 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;
- aux ?polymorphism ~atts isprogcmd v
-
- | VernacRedirect (s, (_,v)) ->
- Topfmt.with_output_to_file s (aux ?polymorphism ~atts isprogcmd) v
+ control v
+ | VernacRedirect (s, (_,v)) ->
+ Topfmt.with_output_to_file s control v
+ | VernacTime (batch, (_loc,v)) ->
+ System.with_time ~batch control v;
- | VernacTime (_,v) ->
- System.with_time !Flags.time (aux ?polymorphism ~atts isprogcmd) v;
+ and aux ~polymorphism ~atts : _ -> unit =
+ function
- | VernacLoad (_,fname) -> vernac_load (aux ?polymorphism ~atts false) fname
+ | VernacLoad (_,fname) -> vernac_load control fname
| c ->
check_vernac_supports_locality c atts.locality;
check_vernac_supports_polymorphism c polymorphism;
- let polymorphic = enforce_polymorphism polymorphism in
- Obligations.set_program_mode isprogcmd;
+ 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 ~atts ~st) c
else Flags.silently (interp ?proof ~atts ~st) c;
- if orig_program_mode || not !Flags.program_mode || isprogcmd then
+ (* 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
@@ -2268,14 +2263,13 @@ 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
- let atts = { loc; locality = None; polymorphic = false; } in
if verbosely
- then Flags.verbosely (aux ~atts orig_program_mode) c
- else aux ~atts orig_program_mode c
+ 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 *)
diff --git a/vernac/vernacentries.mli b/vernac/vernacentries.mli
index a559912a0..e99a62fe6 100644
--- a/vernac/vernacentries.mli
+++ b/vernac/vernacentries.mli
@@ -18,7 +18,7 @@ val vernac_require :
val interp :
?verbosely:bool ->
?proof:Proof_global.closed_proof ->
- st:Vernacstate.t -> Vernacexpr.vernac_expr Loc.located -> Vernacstate.t
+ 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
@@ -36,3 +36,5 @@ 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 c0b93c163..c40ca27db 100644
--- a/vernac/vernacinterp.ml
+++ b/vernac/vernacinterp.ml
@@ -16,6 +16,7 @@ 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
diff --git a/vernac/vernacinterp.mli b/vernac/vernacinterp.mli
index ab3d4bfc5..c5e610f89 100644
--- a/vernac/vernacinterp.mli
+++ b/vernac/vernacinterp.mli
@@ -14,6 +14,7 @@ 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
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
+