aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/CODEOWNERS43
-rw-r--r--.gitignore3
-rw-r--r--.gitlab-ci.yml16
-rw-r--r--.merlin.in4
-rw-r--r--.travis.yml5
-rw-r--r--CHANGES.md41
-rw-r--r--INSTALL24
-rw-r--r--META.coq.in28
-rw-r--r--Makefile13
-rw-r--r--Makefile.build153
-rw-r--r--Makefile.ci7
-rw-r--r--Makefile.common5
-rw-r--r--Makefile.ide4
-rw-r--r--Makefile.install2
-rw-r--r--checker/check.ml33
-rw-r--r--checker/checker.ml15
-rw-r--r--checker/dune27
-rw-r--r--checker/include1
-rw-r--r--checker/mod_checking.ml23
-rw-r--r--checker/validate.ml8
-rw-r--r--checker/values.ml26
-rw-r--r--checker/values.mli19
-rw-r--r--clib/dyn.ml22
-rw-r--r--clib/dyn.mli6
-rw-r--r--clib/store.ml83
-rw-r--r--clib/store.mli9
-rw-r--r--config/coq_config.mli5
-rw-r--r--configure.ml120
-rw-r--r--coq.opam1
-rw-r--r--coqpp/coqpp_main.ml14
-rw-r--r--default.nix3
-rw-r--r--dev/base_include4
-rwxr-xr-xdev/build/windows/makecoq_mingw.sh6
-rw-r--r--dev/ci/README-developers.md165
-rw-r--r--dev/ci/README-users.md85
-rw-r--r--dev/ci/README.md216
-rw-r--r--dev/ci/appveyor.sh2
-rwxr-xr-xdev/ci/ci-aac-tactics.sh8
-rwxr-xr-xdev/ci/ci-aac_tactics.sh8
-rwxr-xr-xdev/ci/ci-basic-overlay.sh47
-rwxr-xr-xdev/ci/ci-color.sh4
-rw-r--r--dev/ci/ci-common.sh3
-rwxr-xr-xdev/ci/ci-compcert.sh4
-rwxr-xr-xdev/ci/ci-coq_dpdgraph.sh (renamed from dev/ci/ci-coq-dpdgraph.sh)0
-rwxr-xr-xdev/ci/ci-elpi.sh4
-rwxr-xr-xdev/ci/ci-equations.sh4
-rwxr-xr-xdev/ci/ci-pidetop.sh19
-rwxr-xr-xdev/ci/ci-plugin_tutorial.sh (renamed from dev/ci/ci-plugin-tutorial.sh)0
-rwxr-xr-xdev/ci/ci-vst.sh4
-rw-r--r--dev/ci/docker/bionic_coq/Dockerfile14
-rw-r--r--dev/ci/nix/README.md19
-rw-r--r--dev/ci/nix/unicoq.nix7
-rw-r--r--dev/ci/user-overlays/00669-maximedenes-ssr-merge.sh6
-rw-r--r--dev/ci/user-overlays/07085-ppedrot-pure-sharing-flag.sh8
-rw-r--r--dev/ci/user-overlays/07257-herbelin-master+fix-yet-another-unif-dep-in-alphabet.sh4
-rw-r--r--dev/ci/user-overlays/07288-herbelin-master+new-module-pretyping-id-management.sh6
-rw-r--r--dev/ci/user-overlays/07925-ppedrot-clean-transp-state.sh14
-rw-r--r--dev/ci/user-overlays/08456-fix-6764.sh5
-rwxr-xr-xdev/ci/user-overlays/08515-command-atts.sh12
-rw-r--r--dev/ci/user-overlays/08552-gares-elpi-11.sh5
-rw-r--r--dev/ci/user-overlays/08554-herbelin-master+fix8553-change-under-binders.sh11
-rw-r--r--dev/ci/user-overlays/08555-maximedenes-rm-section-path.sh9
-rw-r--r--dev/ci/user-overlays/08601-name-abstract-univ-context.sh11
-rw-r--r--dev/ci/user-overlays/08671-mattam-plugin-tutorials.sh7
-rw-r--r--dev/ci/user-overlays/08684-maximedenes-cleanup-kernel-entries.sh9
-rw-r--r--dev/ci/user-overlays/08688-herbelin-master+generalizing-evar-map-printer-over-env.sh6
-rw-r--r--dev/ci/user-overlays/08704-ejgallego-vernac+monify_hook.sh15
-rw-r--r--dev/ci/user-overlays/08844-split-tactics.sh12
-rw-r--r--dev/ci/user-overlays/08902-ejgallego-ltac+use_atts_in_ast.sh15
-rw-r--r--dev/ci/user-overlays/08914-ejgallego-lib+better_boot_coqproject.sh6
-rw-r--r--dev/ci/user-overlays/08933-solve-remaining-evars-initial-arg.sh6
-rw-r--r--dev/ci/user-overlays/08985-ejgallego-build+pack_gramlib.sh6
-rw-r--r--dev/ci/user-overlays/08998-ejgallego-legacy_proof_eng_clean.sh6
-rw-r--r--dev/ci/user-overlays/09003-ejgallego-vernac+move_extend_ast.sh6
-rw-r--r--dev/ci/user-overlays/09051-ppedrot-camlp5-safe-api-strikes-back.sh9
-rw-r--r--dev/ci/user-overlays/jasongross-numeral-notation-4.sh5
-rw-r--r--dev/doc/README.md1
-rw-r--r--dev/doc/build-system.dune.md21
-rw-r--r--dev/doc/changes.md14
-rw-r--r--dev/doc/coq-src-description.txt2
-rw-r--r--dev/dune3
-rwxr-xr-xdev/dune-dbg.in2
-rw-r--r--dev/ocamldebug-coq.run4
-rwxr-xr-xdev/tools/create_overlays.sh78
-rwxr-xr-xdev/tools/merge-pr.sh5
-rw-r--r--dev/top_printers.ml8
-rw-r--r--dev/top_printers.mli6
-rw-r--r--doc/sphinx/addendum/extraction.rst11
-rw-r--r--doc/sphinx/addendum/generalized-rewriting.rst18
-rw-r--r--doc/sphinx/addendum/implicit-coercions.rst69
-rw-r--r--doc/sphinx/addendum/micromega.rst14
-rw-r--r--doc/sphinx/addendum/miscellaneous-extensions.rst32
-rw-r--r--doc/sphinx/addendum/omega.rst6
-rw-r--r--doc/sphinx/addendum/program.rst25
-rw-r--r--doc/sphinx/addendum/ring.rst322
-rw-r--r--doc/sphinx/addendum/type-classes.rst26
-rw-r--r--doc/sphinx/addendum/universe-polymorphism.rst2
-rw-r--r--doc/sphinx/language/gallina-extensions.rst259
-rw-r--r--doc/sphinx/proof-engine/ltac.rst40
-rw-r--r--doc/sphinx/proof-engine/proof-handling.rst19
-rw-r--r--doc/sphinx/proof-engine/tactics.rst766
-rw-r--r--doc/sphinx/proof-engine/vernacular-commands.rst89
-rw-r--r--doc/sphinx/user-extensions/proof-schemes.rst43
-rw-r--r--doc/sphinx/user-extensions/syntax-extensions.rst4
-rw-r--r--engine/eConstr.ml175
-rw-r--r--engine/termops.ml37
-rw-r--r--engine/termops.mli1
-rw-r--r--engine/univNames.ml8
-rw-r--r--engine/univNames.mli2
-rw-r--r--gramlib/gramext.ml2
-rw-r--r--gramlib/gramext.mli1
-rw-r--r--gramlib/gramlib.mllib4
-rw-r--r--gramlib/grammar.ml27
-rw-r--r--gramlib/grammar.mli9
-rw-r--r--grammar/argextend.mlp221
-rw-r--r--grammar/dune41
-rw-r--r--grammar/q_util.mli54
-rw-r--r--grammar/q_util.mlp150
-rw-r--r--grammar/tacextend.mlp72
-rw-r--r--grammar/vernacextend.mlp115
-rw-r--r--ide/.merlin.in2
-rw-r--r--ide/configwin.ml4
-rw-r--r--ide/configwin.mli1
-rw-r--r--ide/configwin_ihm.ml42
-rw-r--r--ide/configwin_ihm.mli10
-rw-r--r--ide/coqide.ml83
-rw-r--r--ide/coqide.mli4
-rw-r--r--ide/coqide_main.ml4
-rw-r--r--ide/coqide_ui.ml1
-rw-r--r--ide/dune11
-rw-r--r--ide/fileOps.ml14
-rw-r--r--ide/fileOps.mli4
-rw-r--r--ide/idetop.ml11
-rw-r--r--ide/nanoPG.ml4
-rw-r--r--ide/preferences.ml4
-rw-r--r--ide/preferences.mli2
-rw-r--r--interp/constrextern.ml34
-rw-r--r--interp/declare.ml9
-rw-r--r--interp/impargs.ml9
-rw-r--r--kernel/cClosure.ml54
-rw-r--r--kernel/cClosure.mli14
-rw-r--r--kernel/constr.ml72
-rw-r--r--kernel/constr.mli11
-rw-r--r--kernel/conv_oracle.ml3
-rw-r--r--kernel/conv_oracle.mli2
-rw-r--r--kernel/declarations.ml28
-rw-r--r--kernel/declareops.ml1
-rw-r--r--kernel/environ.ml24
-rw-r--r--kernel/environ.mli1
-rw-r--r--kernel/indtypes.ml10
-rw-r--r--kernel/indtypes.mli5
-rw-r--r--kernel/kernel.mllib1
-rw-r--r--kernel/modops.ml3
-rw-r--r--kernel/modops.mli3
-rw-r--r--kernel/names.ml7
-rw-r--r--kernel/names.mli8
-rw-r--r--kernel/reduction.ml12
-rw-r--r--kernel/reduction.mli8
-rw-r--r--kernel/safe_typing.ml25
-rw-r--r--kernel/safe_typing.mli1
-rw-r--r--kernel/subtyping.ml6
-rw-r--r--kernel/transparentState.ml45
-rw-r--r--kernel/transparentState.mli (renamed from proofs/proof_type.ml)28
-rw-r--r--kernel/typeops.ml51
-rw-r--r--kernel/uGraph.ml16
-rw-r--r--kernel/uGraph.mli2
-rw-r--r--kernel/univ.ml6
-rw-r--r--kernel/vars.ml17
-rw-r--r--kernel/vconv.ml4
-rw-r--r--lib/coqProject_file.ml18
-rw-r--r--lib/coqProject_file.mli4
-rw-r--r--lib/envars.ml4
-rw-r--r--lib/flags.ml4
-rw-r--r--lib/flags.mli3
-rw-r--r--lib/pp_diff.ml2
-rw-r--r--library/global.ml1
-rw-r--r--library/global.mli1
-rw-r--r--parsing/cLexer.ml1
-rw-r--r--parsing/cLexer.mli2
-rw-r--r--parsing/dune1
-rw-r--r--parsing/extend.ml2
-rw-r--r--parsing/g_constr.mlg6
-rw-r--r--parsing/g_prim.mlg1
-rw-r--r--parsing/pcoq.ml162
-rw-r--r--parsing/pcoq.mli15
-rw-r--r--plugins/btauto/Algebra.v12
-rw-r--r--plugins/btauto/Reflect.v8
-rw-r--r--plugins/derive/g_derive.mlg2
-rw-r--r--plugins/firstorder/g_ground.mlg2
-rw-r--r--plugins/firstorder/ground.ml12
-rw-r--r--plugins/funind/functional_principles_proofs.ml5
-rw-r--r--plugins/funind/functional_principles_types.ml12
-rw-r--r--plugins/funind/g_indfun.mlg9
-rw-r--r--plugins/funind/indfun_common.ml11
-rw-r--r--plugins/funind/indfun_common.mli9
-rw-r--r--plugins/funind/plugin_base.dune1
-rw-r--r--plugins/funind/recdef.ml2
-rw-r--r--plugins/ltac/coretactics.mlg8
-rw-r--r--plugins/ltac/extraargs.mlg2
-rw-r--r--plugins/ltac/extratactics.mlg55
-rw-r--r--plugins/ltac/g_auto.mlg1
-rw-r--r--plugins/ltac/g_ltac.mlg15
-rw-r--r--plugins/ltac/g_obligations.mlg3
-rw-r--r--plugins/ltac/g_rewrite.mlg9
-rw-r--r--plugins/ltac/g_tactic.mlg134
-rw-r--r--plugins/ltac/plugin_base.dune1
-rw-r--r--plugins/ltac/pptactic.ml32
-rw-r--r--plugins/ltac/profile_ltac.ml2
-rw-r--r--plugins/ltac/rewrite.ml12
-rw-r--r--plugins/ltac/tacentries.ml12
-rw-r--r--plugins/ltac/tacentries.mli2
-rw-r--r--plugins/ltac/tacexpr.ml10
-rw-r--r--plugins/ltac/tacexpr.mli10
-rw-r--r--plugins/ltac/tacintern.ml26
-rw-r--r--plugins/ltac/tacinterp.ml22
-rw-r--r--plugins/ltac/tacsubst.ml14
-rw-r--r--plugins/ltac/tactic_debug.ml2
-rw-r--r--plugins/ltac/tauto.ml6
-rw-r--r--plugins/setoid_ring/g_newring.mlg4
-rw-r--r--plugins/setoid_ring/newring.ml10
-rw-r--r--plugins/ssr/ssrbool.v2
-rw-r--r--plugins/ssr/ssrbwd.ml3
-rw-r--r--plugins/ssr/ssrcommon.ml84
-rw-r--r--plugins/ssr/ssrcommon.mli9
-rw-r--r--plugins/ssr/ssrelim.ml4
-rw-r--r--plugins/ssr/ssrequality.ml13
-rw-r--r--plugins/ssr/ssrfun.v2
-rw-r--r--plugins/ssr/ssrparser.mlg38
-rw-r--r--plugins/ssrmatching/g_ssrmatching.mlg3
-rw-r--r--plugins/ssrmatching/plugin_base.dune1
-rw-r--r--plugins/ssrmatching/ssrmatching.ml93
-rw-r--r--plugins/ssrmatching/ssrmatching.mli8
-rw-r--r--pretyping/cases.ml2
-rw-r--r--pretyping/evarconv.ml15
-rw-r--r--pretyping/evarconv.mli17
-rw-r--r--pretyping/heads.ml29
-rw-r--r--pretyping/inductiveops.ml2
-rw-r--r--pretyping/inferCumulativity.ml4
-rw-r--r--pretyping/pretyping.ml27
-rw-r--r--pretyping/pretyping.mli7
-rw-r--r--pretyping/recordops.ml12
-rw-r--r--pretyping/recordops.mli2
-rw-r--r--pretyping/reductionops.ml35
-rw-r--r--pretyping/reductionops.mli17
-rw-r--r--pretyping/tacred.ml2
-rw-r--r--pretyping/typeclasses.mli4
-rw-r--r--pretyping/unification.ml62
-rw-r--r--pretyping/unification.mli9
-rw-r--r--printing/dune1
-rw-r--r--printing/prettyp.ml11
-rw-r--r--printing/printer.ml30
-rw-r--r--printing/printer.mli18
-rw-r--r--printing/printmod.ml10
-rw-r--r--printing/proof_diffs.ml65
-rw-r--r--printing/proof_diffs.mli9
-rw-r--r--proofs/clenvtac.ml10
-rw-r--r--proofs/evar_refiner.ml4
-rw-r--r--proofs/logic.ml24
-rw-r--r--proofs/logic.mli19
-rw-r--r--proofs/pfedit.ml68
-rw-r--r--proofs/pfedit.mli38
-rw-r--r--proofs/proof.ml51
-rw-r--r--proofs/proof.mli14
-rw-r--r--proofs/proof_global.ml16
-rw-r--r--proofs/proof_global.mli16
-rw-r--r--proofs/proofs.mllib3
-rw-r--r--proofs/redexpr.ml2
-rw-r--r--proofs/refiner.ml17
-rw-r--r--proofs/refiner.mli8
-rw-r--r--proofs/tacmach.ml18
-rw-r--r--proofs/tacmach.mli87
-rw-r--r--stm/stm.ml5
-rw-r--r--stm/stm.mli2
-rw-r--r--stm/vernac_classifier.ml5
-rw-r--r--stm/vernac_classifier.mli10
-rw-r--r--tactics/auto.ml12
-rw-r--r--tactics/auto.mli2
-rw-r--r--tactics/btermdn.ml14
-rw-r--r--tactics/btermdn.mli9
-rw-r--r--tactics/class_tactics.ml14
-rw-r--r--tactics/class_tactics.mli4
-rw-r--r--tactics/eauto.ml11
-rw-r--r--tactics/eauto.mli2
-rw-r--r--tactics/equality.ml24
-rw-r--r--tactics/hints.ml56
-rw-r--r--tactics/hints.mli10
-rw-r--r--tactics/tacticals.ml2
-rw-r--r--tactics/tacticals.mli27
-rw-r--r--tactics/tactics.ml14
-rw-r--r--tactics/tactics.mli7
-rw-r--r--test-suite/Makefile8
-rw-r--r--test-suite/bugs/closed/bug_2001.v4
-rw-r--r--test-suite/bugs/closed/bug_6165.v (renamed from test-suite/bugs/closed/gh6165.v)0
-rw-r--r--test-suite/bugs/closed/bug_6384.v (renamed from test-suite/bugs/closed/gh6384.v)0
-rw-r--r--test-suite/bugs/closed/bug_6385.v (renamed from test-suite/bugs/closed/gh6385.v)0
-rw-r--r--test-suite/bugs/closed/bug_6661.v2
-rw-r--r--test-suite/coqchk/bug_8937.v21
-rwxr-xr-xtest-suite/misc/quick-include.sh5
-rw-r--r--test-suite/misc/quick-include/file1.v18
-rw-r--r--test-suite/misc/quick-include/file2.v6
-rw-r--r--test-suite/output/Notations4.out4
-rw-r--r--test-suite/output/Notations4.v24
-rw-r--r--test-suite/output/PrintUnivsSubgraph.out5
-rw-r--r--test-suite/output/PrintUnivsSubgraph.v9
-rw-r--r--test-suite/output/UnivBinders.out3
-rwxr-xr-xtest-suite/report.sh5
-rw-r--r--test-suite/success/Fixpoint.v2
-rw-r--r--test-suite/success/Require.v5
-rw-r--r--test-suite/success/autointros.v2
-rw-r--r--test-suite/unit-tests/printing/proof_diffs_test.ml7
-rw-r--r--theories/Bool/Bool.v6
-rw-r--r--theories/Classes/RelationPairs.v4
-rw-r--r--theories/Compat/Coq87.v2
-rw-r--r--theories/Compat/Coq88.v2
-rw-r--r--theories/Compat/Coq89.v1
-rw-r--r--theories/FSets/FMapAVL.v38
-rw-r--r--theories/FSets/FMapFacts.v2
-rw-r--r--theories/FSets/FMapFullAVL.v16
-rw-r--r--theories/FSets/FMapInterface.v2
-rw-r--r--theories/FSets/FMapList.v12
-rw-r--r--theories/FSets/FMapWeakList.v4
-rw-r--r--theories/FSets/FSetBridge.v6
-rw-r--r--theories/FSets/FSetInterface.v2
-rw-r--r--theories/FSets/FSetProperties.v12
-rw-r--r--theories/Init/Datatypes.v8
-rw-r--r--theories/Lists/List.v30
-rw-r--r--theories/Lists/ListSet.v10
-rw-r--r--theories/Lists/SetoidList.v22
-rw-r--r--theories/Lists/SetoidPermutation.v2
-rw-r--r--theories/Logic/JMeq.v4
-rw-r--r--theories/MSets/MSetAVL.v16
-rw-r--r--theories/MSets/MSetGenTree.v22
-rw-r--r--theories/MSets/MSetInterface.v8
-rw-r--r--theories/MSets/MSetList.v18
-rw-r--r--theories/MSets/MSetProperties.v12
-rw-r--r--theories/MSets/MSetRBT.v24
-rw-r--r--theories/MSets/MSetWeakList.v8
-rw-r--r--theories/Numbers/Cyclic/ZModulo/ZModulo.v6
-rw-r--r--theories/Numbers/Natural/Abstract/NDefOps.v2
-rw-r--r--theories/Program/Basics.v2
-rw-r--r--theories/Program/Wf.v2
-rw-r--r--theories/QArith/Qcanon.v2
-rw-r--r--theories/QArith/Qreals.v2
-rw-r--r--theories/Reals/RIneq.v4
-rw-r--r--theories/Sets/Cpo.v2
-rw-r--r--theories/Sets/Infinite_sets.v2
-rw-r--r--theories/Sets/Powerset.v20
-rw-r--r--theories/Sets/Relations_1_facts.v8
-rw-r--r--theories/Sets/Relations_3_facts.v2
-rw-r--r--theories/Sets/Uniset.v22
-rw-r--r--theories/Sorting/Heap.v4
-rw-r--r--theories/Sorting/Permutation.v16
-rw-r--r--theories/Sorting/Sorted.v4
-rw-r--r--theories/Structures/DecidableType.v26
-rw-r--r--theories/Structures/Equalities.v4
-rw-r--r--theories/Structures/EqualitiesFacts.v14
-rw-r--r--theories/Structures/OrderedType.v64
-rw-r--r--theories/Structures/Orders.v2
-rw-r--r--theories/Structures/OrdersLists.v18
-rw-r--r--theories/Vectors/VectorDef.v10
-rw-r--r--theories/Wellfounded/Inclusion.v2
-rw-r--r--theories/Wellfounded/Transitive_Closure.v2
-rw-r--r--theories/ZArith/Zdiv.v2
-rw-r--r--theories/ZArith/Zlogarithm.v2
-rw-r--r--tools/CoqMakefile.in24
-rw-r--r--tools/coq_makefile.ml5
-rw-r--r--tools/coqdep.ml3
-rw-r--r--toplevel/ccompile.ml222
-rw-r--r--toplevel/ccompile.mli19
-rw-r--r--toplevel/coqargs.ml37
-rw-r--r--toplevel/coqargs.mli8
-rw-r--r--toplevel/coqloop.ml31
-rw-r--r--toplevel/coqloop.mli2
-rw-r--r--toplevel/coqtop.ml287
-rw-r--r--toplevel/dune1
-rw-r--r--toplevel/toplevel.mllib1
-rw-r--r--vernac/assumptions.ml3
-rw-r--r--vernac/assumptions.mli2
-rw-r--r--vernac/attributes.ml9
-rw-r--r--vernac/attributes.mli10
-rw-r--r--vernac/classes.ml3
-rw-r--r--vernac/comAssumption.ml4
-rw-r--r--vernac/comDefinition.ml3
-rw-r--r--vernac/comFixpoint.ml2
-rw-r--r--vernac/comInductive.ml4
-rw-r--r--vernac/dune1
-rw-r--r--vernac/egramml.mli4
-rw-r--r--vernac/explainErr.ml2
-rw-r--r--vernac/g_vernac.mlg11
-rw-r--r--vernac/himsg.ml23
-rw-r--r--vernac/lemmas.ml68
-rw-r--r--vernac/lemmas.mli4
-rw-r--r--vernac/metasyntax.ml2
-rw-r--r--vernac/obligations.ml103
-rw-r--r--vernac/ppvernac.ml6
-rw-r--r--vernac/pvernac.ml4
-rw-r--r--vernac/record.ml2
-rw-r--r--vernac/topfmt.ml22
-rw-r--r--vernac/topfmt.mli6
-rw-r--r--vernac/vernacentries.ml86
-rw-r--r--vernac/vernacexpr.ml79
-rw-r--r--vernac/vernacextend.ml69
-rw-r--r--vernac/vernacextend.mli72
403 files changed, 4019 insertions, 4987 deletions
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index 512a9c99eb..98fe2546b5 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -96,16 +96,11 @@
/engine/uState.* @SkySkimmer
# Secondary maintainer @mattam82
-########## Grammar macros ##########
-
-/grammar/ @ppedrot
-# Secondary maintainer @maximedenes
-
########## CoqIDE ##########
/ide/ @ppedrot
/test-suite/ide/ @ppedrot
-# Secondary maintainer @gares
+# Secondary maintainers @gares @herbelin
########## Interpretation ##########
@@ -132,8 +127,9 @@
########## Parser ##########
-/parsing/ @herbelin
-# Secondary maintainer @mattam82
+/coqpp/ @coq/parsing-maintainers
+/gramlib/ @coq/parsing-maintainers
+/parsing/ @coq/parsing-maintainers
########## Plugins ##########
@@ -166,15 +162,11 @@
/plugins/setoid_ring/ @amahboubi
# Secondary maintainer @bgregoir
-/plugins/ssrmatching/ @gares
-# Secondary maintainer @maximedenes
+/plugins/ssrmatching/ @coq/ssreflect-maintainers
+/plugins/ssr/ @coq/ssreflect-maintainers
+/test-suite/ssr/ @coq/ssreflect-maintainers
-/plugins/ssr/ @gares
-/test-suite/ssr/ @gares
-# Secondary maintainer @maximedenes
-
-/plugins/syntax/ @ppedrot
-# Secondary maintainer @maximedenes
+/plugins/syntax/ @coq/parsing-maintainers
/plugins/rtauto/ @PierreCorbineau
# Secondary maintainer @herbelin
@@ -274,16 +266,6 @@
/theories/Vectors/ @herbelin
-########## Dune ##########
-
-/.ocamlinit @ejgallego
-/Makefile.dune @ejgallego
-/tools/coq_dune* @ejgallego
-/dune* @ejgallego
-/coq.opam @ejgallego
-/ide/coqide.opam @ejgallego
-# Secondary maintainer @Zimmi48
-
########## Tools ##########
/tools/coqdoc/ @silene
@@ -320,6 +302,8 @@
/vernac/ @mattam82
# Secondary maintainer @maximedenes
+/vernac/metasyntax.* @coq/parsing-maintainers
+
########## Test suite ##########
/test-suite/Makefile @gares
@@ -358,3 +342,10 @@
/dev/tools/update-compat.py @JasonGross
/test-suite/tools/update-compat/ @JasonGross
# Secondary maintainer @Zimmi48
+
+########## Dune ##########
+
+/.ocamlinit @ejgallego
+*dune* @ejgallego
+*.opam @ejgallego
+# Secondary maintainer @Zimmi48
diff --git a/.gitignore b/.gitignore
index e513837445..da675309e5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -165,6 +165,9 @@ user-contrib
plugins/ssr/ssrparser.ml
plugins/ssr/ssrvernac.ml
+# gramlib__pack
+gramlib__pack
+
# ocaml dev files
.merlin
META.coq
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 1c5c8efc19..2947bfb700 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -9,7 +9,7 @@ stages:
variables:
# Format: $IMAGE-V$DATE [Cache is not used as of today but kept here
# for reference]
- CACHEKEY: "bionic_coq-V2018-10-30-V1"
+ CACHEKEY: "bionic_coq-V2018-11-08-V1"
IMAGE: "$CI_REGISTRY_IMAGE:$CACHEKEY"
# By default, jobs run in the base switch; override to select another switch
OPAM_SWITCH: "base"
@@ -82,7 +82,7 @@ after_script:
- echo 'end:coq:build'
- echo 'start:coq.install'
- - make install
+ - make install install-byte $EXTRA_INSTALL
- make install-byte
- cp bin/fake_ide _install_ci/bin/
- echo 'end:coq.install'
@@ -196,6 +196,7 @@ build:base:
COQ_EXTRA_CONF: "-native-compiler yes -coqide opt"
# coqdoc for stdlib, until we know how to build it from installed Coq
EXTRA_TARGET: "stdlib"
+ EXTRA_INSTALL: "install-doc-stdlib-html install-doc-printable"
# no coqide for 32bit: libgtk installation problems
build:base+32bit:
@@ -228,6 +229,7 @@ windows64:
<<: *windows-template
variables:
ARCH: "64"
+ allow_failure: true
windows32:
<<: *windows-template
@@ -235,6 +237,7 @@ windows32:
ARCH: "32"
except:
- /^pr-.*$/
+ allow_failure: true
pkg:opam:
stage: test
@@ -362,7 +365,7 @@ validate:edge+flambda:
OPAM_SWITCH: edge
OPAM_VARIANT: "+flambda"
-ci-aac-tactics:
+ci-aac_tactics:
<<: *ci-template
ci-bedrock2:
@@ -378,7 +381,7 @@ ci-color:
ci-compcert:
<<: *ci-template-flambda
-ci-coq-dpdgraph:
+ci-coq_dpdgraph:
<<: *ci-template
ci-coquelicot:
@@ -435,10 +438,7 @@ ci-mtac2:
ci-paramcoq:
<<: *ci-template
-ci-pidetop:
- <<: *ci-template
-
-ci-plugin-tutorial:
+ci-plugin_tutorial:
<<: *ci-template
ci-quickchick:
diff --git a/.merlin.in b/.merlin.in
index 404a7e7935..db7259dd6f 100644
--- a/.merlin.in
+++ b/.merlin.in
@@ -40,6 +40,8 @@ S API
B API
S ide
B ide
+S gramlib__pack
+B gramlib__pack
S tools
B tools
@@ -51,4 +53,4 @@ B dev
S plugins/**
B plugins/**
-PKG threads.posix camlp5
+PKG threads.posix
diff --git a/.travis.yml b/.travis.yml
index 6f625b1c75..02b94f4a8e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -20,7 +20,6 @@ env:
- NJOBS=2
- COMPILER="4.07.0"
- DUNE_VER=".1.2.1"
- - CAMLP5_VER=".7.06"
- FINDLIB_VER=".1.8.0"
- LABLGTK="lablgtk.2.18.6 conf-gtksourceview.2"
- NATIVE_COMP="yes"
@@ -56,7 +55,7 @@ matrix:
- opam switch "$COMPILER" && opam update
- eval $(opam config env)
- opam config list
- - opam install -j "$NJOBS" -y num ocamlfind${FINDLIB_VER} dune${DUNE_VER} camlp5${CAMLP5_VER} ${EXTRA_OPAM}
+ - opam install -j "$NJOBS" -y num ocamlfind${FINDLIB_VER} dune${DUNE_VER} ${EXTRA_OPAM}
- opam list
- if: NOT (type = pull_request)
@@ -81,7 +80,7 @@ matrix:
- opam switch "$COMPILER" && opam update
- eval $(opam config env)
- opam config list
- - opam install -j "$NJOBS" -y num ocamlfind${FINDLIB_VER} dune${DUNE_VER} camlp5${CAMLP5_VER} ${EXTRA_OPAM}
+ - opam install -j "$NJOBS" -y num ocamlfind${FINDLIB_VER} dune${DUNE_VER} ${EXTRA_OPAM}
- opam list
before_deploy:
- dev/build/osx/make-macos-dmg.sh
diff --git a/CHANGES.md b/CHANGES.md
index e280cc2fb5..5ff90b5123 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -1,6 +1,20 @@
Changes from 8.9 to 8.10
========================
+OCaml and dependencies
+
+- Coq 8.10 requires OCaml >= 4.05.0, bumped from 4.02.3 See the
+ INSTALL file for more information on dependencies.
+
+- Coq 8.10 doesn't need Camlp5 to build anymore. It now includes a
+ fork of the core parsing library that Coq uses, which is a small
+ subset of the whole Camlp5 distribution. In particular, this subset
+ doesn't depend on the OCaml AST, allowing easier compilation and
+ testing on experimental OCaml versions.
+
+ The Coq developers would like to thank Daniel de Rauglaudre for many
+ years of continued support.
+
Coqide
- CoqIDE now properly sets the module name for a given file based on
@@ -13,11 +27,6 @@ Coqtop
proper -R/-Q options. For example, given -R Foo foolib using
-topfile foolib/bar.v will set the module name to Foo.Bar.
-OCaml
-
-- Coq 8.10 requires OCaml >= 4.05.0, bumped from 4.02.3 See the
- INSTALL file for more information on dependencies.
-
Specification language, type inference
- Fixing a missing check in interpreting instances of existential
@@ -59,6 +68,10 @@ Tactics
(e.g. `?[n]` or `?n` in terms - not in patterns) are now interpreted
the same way as other variable names occurring in Ltac functions.
+- Hint declaration and removal should now specify a database (e.g. `Hint Resolve
+ foo : database`). When the database name is omitted, the hint is added to the
+ core database (as previously), but a deprecation warning is emitted.
+
Vernacular commands
- `Combined Scheme` can now work when inductive schemes are generated in sort
@@ -67,6 +80,11 @@ Vernacular commands
- Binders for an `Instance` now act more like binders for a `Theorem`.
Names may not be repeated, and may not overlap with section variable names.
+- Removed the deprecated `Implicit Tactic` family of commands.
+
+- The `Automatic Introduction` option has been removed and is now the
+ default.
+
Tools
- The `-native-compiler` flag of `coqc` and `coqtop` now takes an argument which can have three values:
@@ -93,6 +111,19 @@ Standard Library
- Added `ByteVector` type that can convert to and from [string].
+- The prelude used to be automatically Exported and is now only
+ Imported. This should be relevant only when importing files which
+ don't use -noinit into files which do.
+
+Universes
+
+- Added `Print Universes Subgraph` variant of `Print Universes`.
+ Try for instance `Print Universes Subgraph(sigT2.u1 sigT_of_sigT2.u1 projT3_eq.u1 eq_sigT2_rect.u1).`
+
+Misc
+
+- Option "Typeclasses Axioms Are Instances" is deprecated. Use Declare Instance for axioms which should be instances.
+
Changes from 8.8.2 to 8.9+beta1
===============================
diff --git a/INSTALL b/INSTALL
index 6201bc9610..8d8efd4d4d 100644
--- a/INSTALL
+++ b/INSTALL
@@ -39,9 +39,6 @@ WHAT DO YOU NEED ?
- Findlib (version >= 1.4.1)
(available at http://projects.camlcity.org/projects/findlib.html)
- - Camlp5 (version >= 7.03)
- (available at https://camlp5.github.io/)
-
- GNU Make version 3.81 or later
- a C compiler
@@ -49,14 +46,14 @@ WHAT DO YOU NEED ?
- for CoqIDE, the lablgtk development files (version >= 2.18.5),
and the GTK 2.x libraries including gtksourceview2.
- Note that num, camlp5 and lablgtk should be properly registered with
+ Note that num and lablgtk should be properly registered with
findlib/ocamlfind as Coq's makefile will use it to locate the
libraries during the build.
Opam (https://opam.ocaml.org/) is recommended to install OCaml and
the corresponding packages.
- $ opam install num ocamlfind camlp5 lablgtk conf-gtksourceview
+ $ opam install num ocamlfind lablgtk conf-gtksourceview
should get you a reasonable OCaml environment to compile Coq.
@@ -96,19 +93,14 @@ INSTALLATION PROCEDURE IN DETAILS (NORMAL USERS).
bigger), you will also need the "ocamlopt" (or its native code version
"ocamlopt.opt") command.
-2- Check that you have Camlp5 installed on your computer and that the
- command "camlp5" lies in a directory which is present in your $PATH
- environment variable path. (You need Camlp5 in both bytecode and
- native versions if your platform supports it).
-
-3- The uncompression and un-tarring of the distribution file gave birth
+2- The uncompression and un-tarring of the distribution file gave birth
to a directory named "coq-8.xx". You can rename this directory and put
it wherever you want. Just keep in mind that you will need some spare
space during the compilation (reckon on about 300 Mb of disk space
for the whole system in native-code compilation). Once installed, the
binaries take about 30 Mb, and the library about 200 Mb.
-4- First you need to configure the system. It is done automatically with
+3- First you need to configure the system. It is done automatically with
the command:
./configure <options>
@@ -171,7 +163,7 @@ INSTALLATION PROCEDURE IN DETAILS (NORMAL USERS).
c.f. https://caml.inria.fr/mantis/view.php?id=7630
-5- Still in the root directory, do
+4- Still in the root directory, do
make
@@ -183,7 +175,7 @@ INSTALLATION PROCEDURE IN DETAILS (NORMAL USERS).
it is recommended to compile in parallel, via make -jN where N is your number
of cores.
-6- You can now install the Coq system. Executables, libraries, manual pages
+5- You can now install the Coq system. Executables, libraries, manual pages
and emacs mode are copied in some standard places of your system, defined at
configuration time (step 3). Just do
@@ -192,7 +184,7 @@ INSTALLATION PROCEDURE IN DETAILS (NORMAL USERS).
Of course, you may need superuser rights to do that.
-7- Optionally, you could build the bytecode version of Coq via:
+6- Optionally, you could build the bytecode version of Coq via:
make byte
@@ -204,7 +196,7 @@ INSTALLATION PROCEDURE IN DETAILS (NORMAL USERS).
be helpful for debugging purposes. In particular, coqtop.byte embeds an OCaml
toplevel accessible via the Drop command.
-8- You can now clean all the sources. (You can even erase them.)
+7- You can now clean all the sources. (You can even erase them.)
make clean
diff --git a/META.coq.in b/META.coq.in
index 16928587cb..181887bc3d 100644
--- a/META.coq.in
+++ b/META.coq.in
@@ -4,19 +4,7 @@ description = "The Coq Proof Assistant Plugin API"
version = "8.10"
directory = ""
-requires = "camlp5"
-
-package "grammar" (
-
- description = "Coq Camlp5 Grammar Extensions for Plugins"
- version = "8.10"
-
- requires = "camlp5.gramlib"
- directory = "grammar"
-
- archive(byte) = "grammar.cma"
- archive(native) = "grammar.cmxa"
-)
+requires = ""
package "config" (
@@ -153,12 +141,24 @@ package "proofs" (
)
+package "gramlib" (
+
+ description = "Coq Grammar Engine"
+ version = "8.10"
+
+ requires = ""
+ directory = "gramlib__pack"
+
+ archive(byte) = "gramlib.cma"
+ archive(native) = "gramlib.cmxa"
+)
+
package "parsing" (
description = "Coq Parsing Engine"
version = "8.10"
- requires = "camlp5.gramlib, coq.proofs"
+ requires = "coq.gramlib, coq.proofs"
directory = "parsing"
archive(byte) = "parsing.cma"
diff --git a/Makefile b/Makefile
index e0ab169eda..330562afb6 100644
--- a/Makefile
+++ b/Makefile
@@ -94,6 +94,10 @@ EXISTINGMLI := $(call find, '*.mli')
## Files that will be generated
GENMLGFILES:= $(MLGFILES:.mlg=.ml)
+# GRAMFILES must be in linking order
+export GRAMFILES=$(addprefix gramlib__pack/gramlib__,Ploc Plexing Gramext Grammar)
+export GRAMMLFILES := $(addsuffix .ml, $(GRAMFILES)) $(addsuffix .mli, $(GRAMFILES))
+export GENGRAMFILES := $(GRAMMLFILES) gramlib__pack/gramlib.ml
export GENMLFILES:=$(LEXFILES:.mll=.ml) $(YACCFILES:.mly=.ml) $(GENMLGFILES) ide/coqide_os_specific.ml kernel/copcodes.ml
export GENHFILES:=kernel/byterun/coq_jumptbl.h
export GENFILES:=$(GENMLFILES) $(GENMLIFILES) $(GENHFILES)
@@ -121,7 +125,6 @@ help:
@echo " make clean"
@echo "or make archclean"
@echo "For make to be verbose, add VERBOSE=1"
- @echo "If you want camlp5 to generate human-readable files, add READABLE_ML4=1"
@echo
@echo "Bytecode compilation is now a separate target:"
@echo " make byte"
@@ -190,12 +193,16 @@ META.coq: META.coq.in
.PHONY: clean cleankeepvo objclean cruftclean indepclean docclean archclean optclean clean-ide mlgclean depclean cleanconfig distclean voclean timingclean alienclean
-clean: objclean cruftclean depclean docclean camldevfilesclean
+clean: objclean cruftclean depclean docclean camldevfilesclean gramlibclean
cleankeepvo: indepclean clean-ide optclean cruftclean depclean docclean
objclean: archclean indepclean
+.PHONY: gramlibclean
+gramlibclean:
+ rm -rf gramlib__pack/
+
cruftclean: mlgclean
find . \( -name '*~' -o -name '*.annot' \) -exec rm -f {} +
rm -f gmon.out core
@@ -284,7 +291,7 @@ KNOWNML:=$(EXISTINGML) $(GENMLFILES) $(MLPACKFILES:.mlpack=.ml) \
$(patsubst %.mlp,%.ml,$(wildcard grammar/*.mlp))
KNOWNOBJS:=$(KNOWNML:.ml=.cmo) $(KNOWNML:.ml=.cmx) $(KNOWNML:.ml=.cmi) \
$(MLIFILES:.mli=.cmi) \
- $(MLLIBFILES:.mllib=.cma) $(MLLIBFILES:.mllib=.cmxa) grammar/grammar.cma
+ gramlib__pack/gramlib.cma gramlib__pack/gramlib.cmxa $(MLLIBFILES:.mllib=.cma) $(MLLIBFILES:.mllib=.cmxa) grammar/grammar.cma
ALIENOBJS:=$(filter-out $(KNOWNOBJS),$(EXISTINGOBJS))
alienclean:
diff --git a/Makefile.build b/Makefile.build
index ee856aae8e..8e4b63c364 100644
--- a/Makefile.build
+++ b/Makefile.build
@@ -22,10 +22,6 @@
# set this variable to 1 (or any non-empty value):
VERBOSE ?=
-# If set to 1 (or non-empty) then *.ml files corresponding to *.ml4 files
-# will be generated in a human-readable format rather than in a binary format.
-READABLE_ML4 ?=
-
# When non-empty, a time command is performed at each .v compilation.
# To collect compilation timings of .v and import them in a spreadsheet,
# you could hence consider: make TIMED=1 2> timings.csv
@@ -199,14 +195,14 @@ COQOPTS=$(NATIVECOMPUTE) $(COQWARNERROR)
BOOTCOQC=$(TIMER) $(COQTOPBEST) -boot $(COQOPTS) -compile
LOCALINCLUDES=$(addprefix -I ,$(SRCDIRS))
-MLINCLUDES=$(LOCALINCLUDES) -I $(MYCAMLP5LIB)
+MLINCLUDES=$(LOCALINCLUDES)
OCAMLC := $(OCAMLFIND) ocamlc $(CAMLFLAGS)
OCAMLOPT := $(OCAMLFIND) opt $(CAMLFLAGS)
BYTEFLAGS=$(CAMLDEBUG) $(USERFLAGS)
OPTFLAGS=$(CAMLDEBUGOPT) $(CAMLTIMEPROF) $(USERFLAGS) $(FLAMBDA_FLAGS)
-DEPFLAGS=$(LOCALINCLUDES)$(if $(filter plugins/%,$@),, -I ide -I ide/protocol)
+DEPFLAGS=$(LOCALINCLUDES) -map gramlib__pack/gramlib.ml $(if $(filter plugins/%,$@),, -I ide -I ide/protocol)
# On MacOS, the binaries are signed, except our private ones
ifeq ($(shell which codesign > /dev/null 2>&1 && echo $(ARCH)),Darwin)
@@ -253,20 +249,9 @@ define ocamlbyte
$(OCAMLC) $(MLINCLUDES) $(BYTEFLAGS) $(CUSTOM) -o $@ -linkpkg $(1) $^
endef
-# Camlp5 settings
-
-CAMLP5DEPS:=grammar/grammar.cma
-CAMLP5USE=pa_extend.cmo q_MLast.cmo pa_macro.cmo -D$(CAMLVERSION)
-
-PR_O := $(if $(READABLE_ML4),pr_o.cmo,pr_dump.cmo)
-# XXX unused but should be used for mlp files
-
# Main packages linked by Coq.
SYSMOD:=-package num,str,unix,dynlink,threads
-# We do not repeat the dependencies already in SYSMOD here
-P4CMA:=gramlib.cma
-
###########################################################################
# Infrastructure for the rest of the Makefile
###########################################################################
@@ -336,70 +321,15 @@ kernel/copcodes.ml: kernel/byterun/coq_instruct.h kernel/make_opcodes.sh kernel/
$(SHOW)'CCDEP $<'
$(HIDE)$(OCAMLC) -ccopt "-MM -MQ $@ -MQ $(<:.c=.o) -isystem $(CAMLHLIB)" $< $(TOTARGET)
-###########################################################################
-# grammar/grammar.cma
-###########################################################################
-
-## In this part, we compile grammar/grammar.cma
-## without relying on .d dependency files, for bootstraping the creation
-## and inclusion of these .d files
-
-## Explicit dependencies for grammar stuff
-
-GRAMBASEDEPS := grammar/q_util.cmi
-GRAMCMO := grammar/q_util.cmo \
- grammar/argextend.cmo grammar/tacextend.cmo grammar/vernacextend.cmo
COQPPCMO := $(addsuffix .cmo, $(addprefix coqpp/, coqpp_parse coqpp_lex))
-grammar/argextend.cmo : $(GRAMBASEDEPS)
-grammar/q_util.cmo : $(GRAMBASEDEPS)
-grammar/tacextend.cmo : $(GRAMBASEDEPS) grammar/argextend.cmo
-grammar/vernacextend.cmo : $(GRAMBASEDEPS) grammar/tacextend.cmo \
- grammar/argextend.cmo
-
coqpp/coqpp_parse.cmi: coqpp/coqpp_ast.cmi
coqpp/coqpp_parse.cmo: coqpp/coqpp_ast.cmi coqpp/coqpp_parse.cmi
coqpp/coqpp_lex.cmo: coqpp/coqpp_ast.cmi coqpp/coqpp_parse.cmo
-## Ocaml compiler with the right options and -I for grammar
-
-GRAMC := $(OCAMLFIND) ocamlc $(CAMLFLAGS) $(CAMLDEBUG) $(USERFLAGS) \
- -I $(MYCAMLP5LIB) -I grammar
-
-## Specific rules for grammar.cma
-
-grammar/grammar.cma : $(GRAMCMO)
- $(SHOW)'Testing $@'
- @touch grammar/test.mlp
- $(HIDE)$(GRAMC) -pp '$(CAMLP5O) $^ -impl' -impl grammar/test.mlp -o grammar/test
- @rm -f grammar/test.* grammar/test
- $(SHOW)'OCAMLC -a $@'
- $(HIDE)$(GRAMC) $^ -linkall -a -o $@
-
$(COQPP): $(COQPPCMO) coqpp/coqpp_main.ml
$(SHOW)'OCAMLC -a $@'
- $(HIDE)$(GRAMC) -I coqpp $^ -linkall -o $@
-
-## Support of Camlp5 and Camlp5
-
-COMPATCMO:=
-GRAMP4USE:=$(COMPATCMO) pa_extend.cmo q_MLast.cmo pa_macro.cmo -D$(CAMLVERSION)
-GRAMPP:=$(CAMLP5O) -I $(MYCAMLP5LIB) $(GRAMP4USE) $(CAMLP5COMPAT) -impl
-
-## Rules for standard .mlp and .mli files in grammar/
-
-grammar/%.cmo: grammar/%.mlp | $(COMPATCMO)
- $(SHOW)'OCAMLC -c -pp $<'
- $(HIDE)$(GRAMC) -c -pp '$(GRAMPP)' -impl $<
-
-grammar/%.cmo: grammar/%.ml | $(COMPATCMO)
- $(SHOW)'OCAMLC -c -pp $<'
- $(HIDE)$(GRAMC) -c $<
-
-grammar/%.cmi: grammar/%.mli
- $(SHOW)'OCAMLC -c $<'
- $(HIDE)$(GRAMC) -c $<
-
+ $(HIDE)$(OCAMLC) -I coqpp $^ -linkall -o $@
###########################################################################
# Main targets (coqtop.opt, coqtop.byte)
@@ -407,7 +337,7 @@ grammar/%.cmi: grammar/%.mli
.PHONY: coqbinaries coqbyte
-coqbinaries: $(TOPBINOPT) $(COQTOPEXE) $(CHICKEN) $(CSDPCERT) $(FAKEIDE) $(GRAMMARCMA)
+coqbinaries: $(TOPBINOPT) $(COQTOPEXE) $(CHICKEN) $(CSDPCERT) $(FAKEIDE)
coqbyte: $(TOPBYTE) $(CHICKENBYTE)
# Special rule for coqtop, we imitate `ocamlopt` can delete the target
@@ -418,7 +348,7 @@ $(COQTOPEXE): $(TOPBINOPT:.opt=.$(BEST))
bin/%.opt$(EXE): topbin/%_bin.ml $(LINKCMX) $(LIBCOQRUN)
$(SHOW)'COQMKTOP -o $@'
$(HIDE)$(OCAMLOPT) -linkall -linkpkg $(MLINCLUDES) \
- $(SYSMOD) -package camlp5.gramlib \
+ $(SYSMOD) \
$(LINKCMX) $(OPTFLAGS) $(LINKMETADATA) $< -o $@
$(STRIP_HIDE) $@
$(CODESIGN_HIDE) $@
@@ -427,7 +357,7 @@ bin/%.byte$(EXE): topbin/%_bin.ml $(LINKCMO) $(LIBCOQRUN)
$(SHOW)'COQMKTOP -o $@'
$(HIDE)$(OCAMLC) -linkall -linkpkg $(MLINCLUDES) \
-I kernel/byterun/ -cclib -lcoqrun $(VMBYTEFLAGS) \
- $(SYSMOD) -package camlp5.gramlib \
+ $(SYSMOD) \
$(LINKCMO) $(BYTEFLAGS) $< -o $@
COQTOP_BYTE=topbin/coqtop_byte_bin.ml
@@ -438,7 +368,7 @@ $(COQTOPBYTE): $(LINKCMO) $(LIBCOQRUN) $(COQTOP_BYTE)
$(SHOW)'COQMKTOP -o $@'
$(HIDE)$(OCAMLC) -linkall -linkpkg -I lib -I vernac -I toplevel \
-I kernel/byterun/ -cclib -lcoqrun $(VMBYTEFLAGS) \
- $(SYSMOD) -package camlp5.gramlib,compiler-libs.toplevel \
+ $(SYSMOD) -package compiler-libs.toplevel \
$(LINKCMO) $(BYTEFLAGS) $(COQTOP_BYTE) -o $@
# For coqc
@@ -612,7 +542,7 @@ VALIDOPTS=$(if $(VERBOSE),,-silent) -o -m
validate: $(CHICKEN) | $(ALLVO)
$(SHOW)'COQCHK <theories & plugins>'
- $(HIDE)$(CHICKEN) -boot -debug $(VALIDOPTS) $(ALLMODS)
+ $(HIDE)$(CHICKEN) -boot $(VALIDOPTS) $(ALLMODS)
$(ALLSTDLIB).v:
$(SHOW)'MAKE $(notdir $@)'
@@ -630,15 +560,40 @@ test-suite: world byte $(ALLSTDLIB).v
# Default rules for compiling ML code
###########################################################################
-# Target for libraries .cma and .cmxa
+gramlib__pack:
+ mkdir -p $@
-# The dependency over the .mllib is somewhat artificial, since
-# ocamlc -a won't use this file, hence the $(filter-out ...) below.
-# But this ensures that the .cm(x)a is rebuilt when needed,
-# (especially when removing a module in the .mllib).
-# We used to have a "order-only" dependency over .mllib.d here,
-# but the -include mechanism should already ensure that we have
-# up-to-date dependencies.
+# gramlib.ml contents
+gramlib__pack/gramlib.ml: | gramlib__pack
+ echo " \
+module Ploc = Gramlib__Ploc \
+module Plexing = Gramlib__Plexing \
+module Gramext = Gramlib__Gramext \
+module Grammar = Gramlib__Grammar" > $@
+
+gramlib__pack/gramlib__P%: gramlib/p% | gramlib__pack
+ cp -a $< $@
+ sed -e "1i # 1 \"$<\"" -i $@
+gramlib__pack/gramlib__G%: gramlib/g% | gramlib__pack
+ cp -a $< $@
+ sed -e "1i # 1 \"$<\"" -i $@
+
+# Specific rules for gramlib to pack it Dune / OCaml 4.08 style
+GRAMOBJS=$(addsuffix .cmo, $(GRAMFILES))
+
+gramlib__pack/%: COND_BYTEFLAGS+=-no-alias-deps -w -49
+gramlib__pack/%: COND_OPTFLAGS+=-no-alias-deps -w -49
+
+gramlib__pack/gramlib.%: COND_OPENFLAGS=
+gramlib__pack/gramlib__%: COND_OPENFLAGS=-open Gramlib
+
+gramlib__pack/gramlib.cma: $(GRAMOBJS) gramlib__pack/gramlib.cmo
+ $(SHOW)'OCAMLC -a -o $@'
+ $(HIDE)$(OCAMLC) $(MLINCLUDES) $(BYTEFLAGS) -a -o $@ $^
+
+gramlib__pack/gramlib.cmxa: $(GRAMOBJS:.cmo=.cmx) gramlib__pack/gramlib.cmx
+ $(SHOW)'OCAMLOPT -a -o $@'
+ $(HIDE)$(OCAMLOPT) $(MLINCLUDES) $(OPTFLAGS) -a -o $@ $^
# Specific rule for kernel.cma, with $(VMBYTEFLAGS).
# This helps loading dllcoqrun.so during an ocamldebug
@@ -651,6 +606,16 @@ kernel/kernel.cmxa: kernel/kernel.mllib
$(SHOW)'OCAMLOPT -a -o $@'
$(HIDE)$(OCAMLOPT) $(MLINCLUDES) $(OPTFLAGS) -I kernel/byterun/ -cclib -lcoqrun -a -o $@ $(filter-out %.mllib, $^)
+# Target for libraries .cma and .cmxa
+
+# The dependency over the .mllib is somewhat artificial, since
+# ocamlc -a won't use this file, hence the $(filter-out ...) below.
+# But this ensures that the .cm(x)a is rebuilt when needed,
+# (especially when removing a module in the .mllib).
+# We used to have a "order-only" dependency over .mllib.d here,
+# but the -include mechanism should already ensure that we have
+# up-to-date dependencies.
+
%.cma: %.mllib
$(SHOW)'OCAMLC -a -o $@'
$(HIDE)$(OCAMLC) $(MLINCLUDES) $(BYTEFLAGS) -a -o $@ $(filter-out %.mllib, $^)
@@ -672,11 +637,14 @@ kernel/kernel.cmxa: kernel/kernel.mllib
COND_IDEFLAGS=$(if $(filter ide/fake_ide% tools/coq_makefile%,$<), -I ide -I ide/protocol,)
COND_PRINTERFLAGS=$(if $(filter dev/%,$<), -I dev,)
+# For module packing
+COND_OPENFLAGS=
+
COND_BYTEFLAGS= \
- $(COND_IDEFLAGS) $(COND_PRINTERFLAGS) $(MLINCLUDES) $(BYTEFLAGS)
+ $(COND_IDEFLAGS) $(COND_PRINTERFLAGS) $(MLINCLUDES) $(BYTEFLAGS) $(COND_OPENFLAGS)
COND_OPTFLAGS= \
- $(COND_IDEFLAGS) $(MLINCLUDES) $(OPTFLAGS)
+ $(COND_IDEFLAGS) $(MLINCLUDES) $(OPTFLAGS) $(COND_OPENFLAGS)
plugins/micromega/%.cmi: plugins/micromega/%.mli
$(SHOW)'OCAMLC $<'
@@ -780,12 +748,13 @@ kernel/%.cmx: COND_OPTFLAGS+=-w +a-4-44-50
# Ocamldep is now used directly again (thanks to -ml-synonym in OCaml >= 3.12)
OCAMLDEP = $(OCAMLFIND) ocamldep -slash -ml-synonym .mlpack
-MAINMLFILES := $(filter-out checker/% plugins/%, $(MLFILES) $(MLIFILES))
-MAINMLLIBFILES := $(filter-out checker/% plugins/%, $(MLLIBFILES) $(MLPACKFILES))
+MAINMLFILES := $(filter-out gramlib__pack/% checker/% plugins/%, $(MLFILES) $(MLIFILES))
+MAINMLLIBFILES := $(filter-out gramlib__pack/% checker/% plugins/%, $(MLLIBFILES) $(MLPACKFILES))
-$(MLDFILE).d: $(D_DEPEND_BEFORE_SRC) $(MAINMLFILES) $(D_DEPEND_AFTER_SRC) $(GENFILES)
+$(MLDFILE).d: $(D_DEPEND_BEFORE_SRC) $(MAINMLFILES) $(D_DEPEND_AFTER_SRC) $(GENFILES) $(GENGRAMFILES)
$(SHOW)'OCAMLDEP MLFILES MLIFILES'
- $(HIDE)$(OCAMLDEP) $(DEPFLAGS) $(MAINMLFILES) $(TOTARGET)
+ $(HIDE)$(OCAMLDEP) $(DEPFLAGS) -passrest $(MAINMLFILES) -open Gramlib $(GRAMMLFILES) $(TOTARGET)
+#NB: -passrest is needed to avoid ocamlfind reordering the -open Gramlib
$(MLLIBDFILE).d: $(D_DEPEND_BEFORE_SRC) $(MAINMLLIBFILES) $(D_DEPEND_AFTER_SRC) $(OCAMLLIBDEP) $(GENFILES)
$(SHOW)'OCAMLLIBDEP MLLIBFILES MLPACKFILES'
diff --git a/Makefile.ci b/Makefile.ci
index e8fea11bdb..d0b87fc58b 100644
--- a/Makefile.ci
+++ b/Makefile.ci
@@ -9,12 +9,12 @@
##########################################################################
CI_TARGETS= \
- ci-aac-tactics \
+ ci-aac_tactics \
ci-bedrock2 \
ci-bignums \
ci-color \
ci-compcert \
- ci-coq-dpdgraph \
+ ci-coq_dpdgraph \
ci-coquelicot \
ci-corn \
ci-cpdt \
@@ -37,8 +37,7 @@ CI_TARGETS= \
ci-math-comp \
ci-mtac2 \
ci-paramcoq \
- ci-pidetop \
- ci-plugin-tutorial \
+ ci-plugin_tutorial \
ci-quickchick \
ci-sf \
ci-simple-io \
diff --git a/Makefile.common b/Makefile.common
index f2a11ee4b4..ca2cb8fee6 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -91,7 +91,7 @@ MKDIR:=install -d
CORESRCDIRS:=\
coqpp \
config clib lib kernel kernel/byterun library \
- engine pretyping interp proofs parsing printing \
+ engine pretyping interp proofs gramlib__pack parsing printing \
tactics vernac stm toplevel
PLUGINDIRS:=\
@@ -119,11 +119,10 @@ BYTERUN:=$(addprefix kernel/byterun/, \
CORECMA:=config/config.cma clib/clib.cma lib/lib.cma kernel/kernel.cma library/library.cma \
engine/engine.cma pretyping/pretyping.cma interp/interp.cma proofs/proofs.cma \
+ gramlib__pack/gramlib.cma \
parsing/parsing.cma printing/printing.cma tactics/tactics.cma vernac/vernac.cma \
stm/stm.cma toplevel/toplevel.cma
-GRAMMARCMA:=grammar/grammar.cma
-
###########################################################################
# plugins object files
###########################################################################
diff --git a/Makefile.ide b/Makefile.ide
index 39af1f8545..cae77ee348 100644
--- a/Makefile.ide
+++ b/Makefile.ide
@@ -147,7 +147,7 @@ $(IDETOPEXE): $(IDETOP:.opt=.$(BEST))
$(IDETOP): ide/idetop.ml $(LINKCMX) $(LIBCOQRUN) $(IDETOPCMX)
$(SHOW)'COQMKTOP -o $@'
$(HIDE)$(OCAMLOPT) -linkall -linkpkg $(MLINCLUDES) -I ide -I ide/protocol/ \
- $(SYSMOD) -package camlp5.gramlib \
+ $(SYSMOD) \
$(LINKCMX) $(IDETOPCMX) $(OPTFLAGS) $(LINKMETADATA) $< -o $@
$(STRIP_HIDE) $@
$(CODESIGN_HIDE) $@
@@ -156,7 +156,7 @@ $(IDETOPBYTE): ide/idetop.ml $(LINKCMO) $(LIBCOQRUN) $(IDETOPCMA)
$(SHOW)'COQMKTOP -o $@'
$(HIDE)$(OCAMLC) -linkall -linkpkg $(MLINCLUDES) -I ide -I ide/protocol/ \
-I kernel/byterun/ -cclib -lcoqrun $(VMBYTEFLAGS) \
- $(SYSMOD) -package camlp5.gramlib \
+ $(SYSMOD) \
$(LINKCMO) $(IDETOPCMA) $(BYTEFLAGS) $< -o $@
####################
diff --git a/Makefile.install b/Makefile.install
index be6fe54933..8233807e03 100644
--- a/Makefile.install
+++ b/Makefile.install
@@ -93,7 +93,7 @@ install-tools:
INSTALLCMI = $(sort \
$(filter-out checker/% ide/% tools/%, $(MLIFILES:.mli=.cmi)) \
$(foreach lib,$(CORECMA), $(addsuffix .cmi,$($(lib:.cma=_MLLIB_DEPENDENCIES))))) \
- $(PLUGINS:.cmo=.cmi)
+ $(PLUGINS:.cmo=.cmi) gramlib__pack/gramlib.cmi
INSTALLCMX = $(sort $(filter-out checker/% ide/% tools/% dev/% \
configure.cmx toplevel/coqtop_byte_bin.cmx plugins/extraction/big.cmx, \
diff --git a/checker/check.ml b/checker/check.ml
index e3a4bda8ec..30437e8bd0 100644
--- a/checker/check.ml
+++ b/checker/check.ml
@@ -136,36 +136,9 @@ type logical_path = DirPath.t
let load_paths = ref ([],[] : CUnix.physical_path list * logical_path list)
-(* Hints to partially detects if two paths refer to the same repertory *)
-let rec remove_path_dot p =
- let curdir = Filename.concat Filename.current_dir_name "" in (* Unix: "./" *)
- let n = String.length curdir in
- if String.length p > n && String.sub p 0 n = curdir then
- remove_path_dot (String.sub p n (String.length p - n))
- else
- p
-
-let strip_path p =
- let cwd = Filename.concat (Sys.getcwd ()) "" in (* Unix: "`pwd`/" *)
- let n = String.length cwd in
- if String.length p > n && String.sub p 0 n = cwd then
- remove_path_dot (String.sub p n (String.length p - n))
- else
- remove_path_dot p
-
-let canonical_path_name p =
- let current = Sys.getcwd () in
- try
- Sys.chdir p;
- let p' = Sys.getcwd () in
- Sys.chdir current;
- p'
- with Sys_error _ ->
- (* We give up to find a canonical name and just simplify it... *)
- strip_path p
let find_logical_path phys_dir =
- let phys_dir = canonical_path_name phys_dir in
+ let phys_dir = CUnix.canonical_path_name phys_dir in
let physical, logical = !load_paths in
match List.filter2 (fun p d -> p = phys_dir) physical logical with
| _,[dir] -> dir
@@ -180,14 +153,14 @@ let add_load_path (phys_path,coq_path) =
if !Flags.debug then
Feedback.msg_notice (str "path: " ++ pr_dirpath coq_path ++ str " ->" ++ spc() ++
str phys_path);
- let phys_path = canonical_path_name phys_path in
+ let phys_path = CUnix.canonical_path_name phys_path in
let physical, logical = !load_paths in
match List.filter2 (fun p d -> p = phys_path) physical logical with
| _,[dir] ->
if coq_path <> dir
(* If this is not the default -I . to coqtop *)
&& not
- (phys_path = canonical_path_name Filename.current_dir_name
+ (phys_path = CUnix.canonical_path_name Filename.current_dir_name
&& coq_path = default_root_prefix)
then
begin
diff --git a/checker/checker.ml b/checker/checker.ml
index 346ae5fffb..da6a61de1c 100644
--- a/checker/checker.ml
+++ b/checker/checker.ml
@@ -138,13 +138,16 @@ let set_debug () = Flags.debug := true
let impredicative_set = ref Declarations.PredicativeSet
let set_impredicative_set () = impredicative_set := Declarations.ImpredicativeSet
-let engage = Safe_typing.set_engagement (!impredicative_set)
-let disable_compilers senv =
+let indices_matter = ref false
+
+let make_senv () =
+ let senv = Safe_typing.empty_environment in
+ let senv = Safe_typing.set_engagement !impredicative_set senv in
+ let senv = Safe_typing.set_indices_matter !indices_matter senv in
let senv = Safe_typing.set_VM false senv in
Safe_typing.set_native_compiler false senv
-
let admit_list = ref ([] : object_file list)
let add_admit s =
admit_list := path_of_string s :: !admit_list
@@ -318,6 +321,9 @@ let parse_args argv =
| "-impredicative-set" :: rem ->
set_impredicative_set (); parse rem
+ | "-indices-matter" :: rem ->
+ indices_matter:=true; parse rem
+
| "-coqlib" :: s :: rem ->
if not (exists_dir s) then
fatal_error (str "Directory '" ++ str s ++ str "' does not exist") false;
@@ -377,8 +383,7 @@ let init_with_argv argv =
Envars.set_coqlib ~fail:(fun x -> CErrors.user_err Pp.(str x));
Flags.if_verbose print_header ();
init_load_path ();
- let senv = Safe_typing.empty_environment in
- disable_compilers (engage senv)
+ make_senv ()
with e ->
fatal_error (str "Error during initialization :" ++ (explain_exn e)) (is_anomaly e)
diff --git a/checker/dune b/checker/dune
index 35a35a1f82..ee427d26c5 100644
--- a/checker/dune
+++ b/checker/dune
@@ -1,26 +1,3 @@
-(copy_files#
- %{project_root}/kernel/{names,esubst,declarations,environ,constr,term,univ,evar,sorts,uGraph,context}.ml{,i})
-
-(copy_files#
- %{project_root}/kernel/{mod_subst,vars,opaqueproof,conv_oracle,reduction,typeops,inductive,indtypes,declareops,type_errors}.ml{,i})
-
-(copy_files#
- %{project_root}/kernel/{modops,mod_typing,}.ml{,i})
-
-(copy_files#
- %{project_root}/kernel/{cClosure,cPrimitives,csymtable,vconv,vm,uint31,cemitcodes,vmvalues,cbytecodes,cinstr,retroknowledge,copcodes}.ml{,i})
-
-(copy_files#
- %{project_root}/kernel/{cbytegen,clambda,nativeinstr,nativevalues,nativeconv,nativecode,nativelib,nativelibrary,nativelambda}.ml{,i})
-
-(copy_files#
- %{project_root}/kernel/{subtyping,term_typing,safe_typing,entries,cooking}.ml{,i})
-
-; VM stuff
-
-(copy_files#
- %{project_root}/kernel/byterun/{*.c,*.h})
-
; Careful with bug https://github.com/ocaml/odoc/issues/148
;
; If we don't pack checker we will have a problem here due to
@@ -30,10 +7,8 @@
(public_name coq.checklib)
(synopsis "Coq's Standalone Proof Checker")
(modules :standard \ coqchk votour)
- (modules_without_implementation cinstr nativeinstr)
- (c_names coq_fix_code coq_memory coq_values coq_interp)
(wrapped true)
- (libraries coq.lib))
+ (libraries coq.kernel))
(executable
(name coqchk)
diff --git a/checker/include b/checker/include
index da0346359b..3ffc301724 100644
--- a/checker/include
+++ b/checker/include
@@ -13,7 +13,6 @@
#directory "kernel";;
#directory "checker";;
#directory "+threads";;
-#directory "+camlp5";;
#load "unix.cma";;
#load"threads.cma";;
diff --git a/checker/mod_checking.ml b/checker/mod_checking.ml
index ed617d73c2..77f4cea0c6 100644
--- a/checker/mod_checking.ml
+++ b/checker/mod_checking.ml
@@ -3,7 +3,6 @@ open Util
open Names
open Reduction
open Typeops
-open Subtyping
open Declarations
open Environ
@@ -65,17 +64,17 @@ let rec check_module env mp mb =
check_signature env mb.mod_type mb.mod_mp mb.mod_delta
in
let optsign = match mb.mod_expr with
- |Struct sign -> Some (check_signature env sign mb.mod_mp mb.mod_delta)
+ |Struct sign -> Some (check_signature env sign mb.mod_mp mb.mod_delta, mb.mod_delta)
|Algebraic me -> Some (check_mexpression env me mb.mod_mp mb.mod_delta)
|Abstract|FullStruct -> None
in
match optsign with
|None -> ()
- |Some sign ->
- let mtb1 = mk_mtb mp sign mb.mod_delta
+ |Some (sign,delta) ->
+ let mtb1 = mk_mtb mp sign delta
and mtb2 = mk_mtb mp mb.mod_type mb.mod_delta in
let env = Modops.add_module_type mp mtb1 env in
- let cu = check_subtypes env mtb1 mtb2 in
+ let cu = Subtyping.check_subtypes env mtb1 mtb2 in
if not (Environ.check_constraints cu env) then
CErrors.user_err Pp.(str "Incorrect universe constraints for module subtyping");
@@ -103,15 +102,17 @@ and check_structure_field env mp lab res = function
and check_mexpr env mse mp_mse res = match mse with
| MEident mp ->
let mb = lookup_module mp env in
- (Modops.strengthen_and_subst_mb mb mp_mse false).mod_type
+ let mb = Modops.strengthen_and_subst_mb mb mp_mse false in
+ mb.mod_type, mb.mod_delta
| MEapply (f,mp) ->
- let sign = check_mexpr env f mp_mse res in
+ let sign, delta = check_mexpr env f mp_mse res in
let farg_id, farg_b, fbody_b = Modops.destr_functor sign in
let mtb = Modops.module_type_of_module (lookup_module mp env) in
- let cu = check_subtypes env mtb farg_b in
+ let cu = Subtyping.check_subtypes env mtb farg_b in
if not (Environ.check_constraints cu env) then
CErrors.user_err Pp.(str "Incorrect universe constraints for module subtyping");
- Modops.subst_signature (Mod_subst.map_mbid farg_id mp Mod_subst.empty_delta_resolver) fbody_b
+ let subst = Mod_subst.map_mbid farg_id mp Mod_subst.empty_delta_resolver in
+ Modops.subst_signature subst fbody_b, Mod_subst.subst_codom_delta_resolver subst delta
| MEwith _ -> CErrors.user_err Pp.(str "Unsupported 'with' constraint in module implementation")
@@ -119,8 +120,8 @@ and check_mexpression env sign mp_mse res = match sign with
| MoreFunctor (arg_id, mtb, body) ->
check_module_type env mtb;
let env' = Modops.add_module_type (MPbound arg_id) mtb env in
- let body = check_mexpression env' body mp_mse res in
- MoreFunctor(arg_id,mtb,body)
+ let body, delta = check_mexpression env' body mp_mse res in
+ MoreFunctor(arg_id,mtb,body), delta
| NoFunctor me -> check_mexpr env me mp_mse res
and check_signature env sign mp_mse res = match sign with
diff --git a/checker/validate.ml b/checker/validate.ml
index c214409a2c..b85944f94f 100644
--- a/checker/validate.ml
+++ b/checker/validate.ml
@@ -143,10 +143,8 @@ let validate debug v x =
let o = Obj.repr x in
try val_gen v mt_ec o
with ValidObjError(msg,ctx,obj) ->
- if debug then begin
+ (if debug then
let ctx = List.rev_map print_frame ctx in
- print_endline ("Validation failed: "^msg);
print_endline ("Context: "^String.concat"/"ctx);
- pr_obj obj
- end;
- failwith "vo structure validation failed"
+ pr_obj obj);
+ failwith ("Validation failed: "^msg^" (in "^(print_frame (List.hd ctx))^")")
diff --git a/checker/values.ml b/checker/values.ml
index e21acd8179..628089433a 100644
--- a/checker/values.ml
+++ b/checker/values.ml
@@ -10,28 +10,15 @@
(** Abstract representations of values in a vo *)
-(** NB: UPDATE THIS FILE EACH TIME cic.mli IS MODIFIED !
+(** NB: This needs updating when the types in declarations.ml and
+ their dependencies are changed. *)
-To ensure this file is up-to-date, 'make' now compares the md5 of cic.mli
-with a copy we maintain here:
-
-MD5 b8f0139f14e3370cd0a45d4cf69882ea checker/cic.mli
-
-*)
-
-(** We reify here the types of values present in a vo (see cic.mli),
+(** We reify here the types of values present in a vo.
in order to validate its structure. Maybe this reification
could become automatically generated someday ?
- - [Any] stands for a value that we won't check,
- - [Fail] means a value that shouldn't be there at all,
- - [Tuple] provides a name and sub-values in this block
- - [Sum] provides a name, a number of constant constructors,
- and sub-values at each position of each possible constructed
- variant
- - [List] and [Opt] could have been defined via [Sum], but
- having them here helps defining some recursive values below
- - [Annot] is a no-op, just there for improving debug messages *)
+ See values.mli for the meaning of each constructor.
+*)
type value =
| Any
@@ -45,6 +32,7 @@ type value =
| String
| Annot of string * value
| Dyn
+
| Proxy of value ref
let fix (f : value -> value) : value =
@@ -229,7 +217,7 @@ let v_cst_def =
[|[|Opt Int|]; [|v_cstr_subst|]; [|v_lazy_constr|]|]
let v_typing_flags =
- v_tuple "typing_flags" [|v_bool; v_bool; v_oracle; v_bool; v_bool; v_bool|]
+ v_tuple "typing_flags" [|v_bool; v_bool; v_oracle; v_bool; v_bool; v_bool; v_bool|]
let v_const_univs = v_sum "constant_universes" 0 [|[|v_context_set|]; [|v_abs_context|]|]
diff --git a/checker/values.mli b/checker/values.mli
index 1b1437a469..616b69907f 100644
--- a/checker/values.mli
+++ b/checker/values.mli
@@ -10,17 +10,36 @@
type value =
| Any
+ (** A value that we won't check, *)
+
| Fail of string
+ (** A value that shouldn't be there at all, *)
+
| Tuple of string * value array
+ (** A debug name and sub-values in this block *)
+
| Sum of string * int * value array array
+ (** A debug name, a number of constant constructors, and sub-values
+ at each position of each possible constructed variant *)
+
| Array of value
| List of value
| Opt of value
| Int
| String
+ (** Builtin Ocaml types. *)
+
| Annot of string * value
+ (** Adds a debug note to the inner value *)
+
| Dyn
+ (** Coq's Dyn.t *)
+
| Proxy of value ref
+ (** Same as the inner value, used to define recursive types *)
+
+(** NB: List and Opt have their own constructors to make it easy to
+ define eg [let rec foo = List foo]. *)
val v_univopaques : value
val v_libsum : value
diff --git a/clib/dyn.ml b/clib/dyn.ml
index 6c45767246..22c49706be 100644
--- a/clib/dyn.ml
+++ b/clib/dyn.ml
@@ -38,6 +38,7 @@ sig
type t = Dyn : 'a tag * 'a -> t
val create : string -> 'a tag
+ val anonymous : int -> 'a tag
val eq : 'a tag -> 'b tag -> ('a, 'b) CSig.eq option
val repr : 'a tag -> string
@@ -81,15 +82,22 @@ module Self : PreS = struct
let create (s : string) =
let hash = Hashtbl.hash s in
- let () =
- if Int.Map.mem hash !dyntab then
- let old = Int.Map.find hash !dyntab in
- let () = Printf.eprintf "Dynamic tag collision: %s vs. %s\n%!" s old in
- assert false
- in
- let () = dyntab := Int.Map.add hash s !dyntab in
+ if Int.Map.mem hash !dyntab then begin
+ let old = Int.Map.find hash !dyntab in
+ Printf.eprintf "Dynamic tag collision: %s vs. %s\n%!" s old;
+ assert false
+ end;
+ dyntab := Int.Map.add hash s !dyntab;
hash
+ let anonymous n =
+ if Int.Map.mem n !dyntab then begin
+ Printf.eprintf "Dynamic tag collision: %d\n%!" n;
+ assert false
+ end;
+ dyntab := Int.Map.add n "<anonymous>" !dyntab;
+ n
+
let eq : 'a 'b. 'a tag -> 'b tag -> ('a, 'b) CSig.eq option =
fun h1 h2 -> if Int.equal h1 h2 then Some (Obj.magic CSig.Refl) else None
diff --git a/clib/dyn.mli b/clib/dyn.mli
index ff9762bd6b..1bd78b2db8 100644
--- a/clib/dyn.mli
+++ b/clib/dyn.mli
@@ -48,6 +48,12 @@ sig
Type names are hashed, so [create] may raise even if no type with
the exact same name was registered due to a collision. *)
+ val anonymous : int -> 'a tag
+ (** [anonymous i] returns a tag describing an [i]-th anonymous type.
+ If [anonymous] is not used together with [create], [max_int] anonymous types
+ are available.
+ [anonymous] raises an exception if [i] is already registered. *)
+
val eq : 'a tag -> 'b tag -> ('a, 'b) CSig.eq option
(** [eq t1 t2] returns [Some witness] if [t1] is the same as [t2], [None] otherwise. *)
diff --git a/clib/store.ml b/clib/store.ml
index 1469358c9d..79e26908d7 100644
--- a/clib/store.ml
+++ b/clib/store.ml
@@ -20,70 +20,37 @@ module type S =
sig
type t
type 'a field
+ val field : unit -> 'a field
val empty : t
val set : t -> 'a field -> 'a -> t
val get : t -> 'a field -> 'a option
val remove : t -> 'a field -> t
val merge : t -> t -> t
- val field : unit -> 'a field
end
-module Make () : S =
+module Make() : S =
struct
-
- let next =
- let count = ref 0 in fun () ->
- let n = !count in
- incr count;
- n
-
- type t = Obj.t option array
- (** Store are represented as arrays. For small values, which is typicial,
- is slightly quicker than other implementations. *)
-
-type 'a field = int
-
-let allocate len : t = Array.make len None
-
-let empty : t = [||]
-
-let set (s : t) (i : 'a field) (v : 'a) : t =
- let len = Array.length s in
- let nlen = if i < len then len else succ i in
- let () = assert (0 <= i) in
- let ans = allocate nlen in
- Array.blit s 0 ans 0 len;
- Array.unsafe_set ans i (Some (Obj.repr v));
- ans
-
-let get (s : t) (i : 'a field) : 'a option =
- let len = Array.length s in
- if len <= i then None
- else Obj.magic (Array.unsafe_get s i)
-
-let remove (s : t) (i : 'a field) =
- let len = Array.length s in
- let () = assert (0 <= i) in
- let ans = allocate len in
- Array.blit s 0 ans 0 len;
- if i < len then Array.unsafe_set ans i None;
- ans
-
-let merge (s1 : t) (s2 : t) : t =
- let len1 = Array.length s1 in
- let len2 = Array.length s2 in
- let nlen = if len1 < len2 then len2 else len1 in
- let ans = allocate nlen in
- (** Important: No more allocation from here. *)
- Array.blit s2 0 ans 0 len2;
- for i = 0 to pred len1 do
- let v = Array.unsafe_get s1 i in
- match v with
- | None -> ()
- | Some _ -> Array.unsafe_set ans i v
- done;
- ans
-
-let field () = next ()
-
+ module Dyn = Dyn.Make()
+ module Map = Dyn.Map(struct type 'a t = 'a end)
+
+ type t = Map.t
+ type 'a field = 'a Dyn.tag
+
+ let next = ref 0
+ let field () =
+ let f = Dyn.anonymous !next in
+ incr next;
+ f
+
+ let empty =
+ Map.empty
+ let set s f v =
+ Map.add f v s
+ let get s f =
+ try Some (Map.find f s)
+ with Not_found -> None
+ let remove s f =
+ Map.remove f s
+ let merge s1 s2 =
+ Map.fold (fun (Map.Any (f, v)) s -> Map.add f v s) s1 s2
end
diff --git a/clib/store.mli b/clib/store.mli
index 0c2b2e0856..7cdd1d3bed 100644
--- a/clib/store.mli
+++ b/clib/store.mli
@@ -19,6 +19,9 @@ sig
type 'a field
(** Type of field of such stores *)
+ val field : unit -> 'a field
+ (** Create a new field *)
+
val empty : t
(** Empty store *)
@@ -33,11 +36,7 @@ sig
val merge : t -> t -> t
(** [merge s1 s2] adds all the fields of [s1] into [s2]. *)
-
- val field : unit -> 'a field
- (** Create a new field *)
-
end
-module Make () : S
+module Make() : S
(** Create a new store type. *)
diff --git a/config/coq_config.mli b/config/coq_config.mli
index 22d8c49fd1..33acceb1f0 100644
--- a/config/coq_config.mli
+++ b/config/coq_config.mli
@@ -25,11 +25,6 @@ val docdirsuffix : string (* doc directory relative to installation prefix *)
val ocamlfind : string
-val camlp5o : string (* name of the camlp5o executable *)
-val camlp5bin : string (* base directory for camlp5 binaries *)
-val camlp5lib : string (* where is the library of camlp5 *)
-val camlp5compat : string (* compatibility argument to camlp5 *)
-
val caml_flags : string (* arguments passed to ocamlc (ie. CAMLFLAGS) *)
val arch : string (* architecture *)
diff --git a/configure.ml b/configure.ml
index 47f7633ae8..ec765acc15 100644
--- a/configure.ml
+++ b/configure.ml
@@ -4,6 +4,7 @@
(**********************************)
+
(** This file should be run via: ocaml configure.ml <opts>
You could also use our wrapper ./configure <opts> *)
@@ -188,34 +189,6 @@ let which prog =
let program_in_path prog =
try let _ = which prog in true with Not_found -> false
-(** Choose a command among a list of candidates
- (command name, mandatory arguments, arguments for this test).
- Chooses the first one whose execution outputs a non-empty (first) line.
- Dies with message [msg] if none is found. *)
-
-let select_command msg candidates =
- let rec search = function
- | [] -> die msg
- | (p, x, y) :: tl ->
- if fst (tryrun p (x @ y)) <> ""
- then List.fold_left (Printf.sprintf "%s %s") p x
- else search tl
- in search candidates
-
-(** As per bug #4828, ocamlfind on Windows/Cygwin barfs if you pass it
- a quoted path to camlp5o via -pp. So we only quote camlp5o on not
- Windows, and warn on Windows if the path contains spaces *)
-let contains_suspicious_characters str =
- List.fold_left (fun b ch -> String.contains str ch || b) false [' '; '\t']
-
-let win_aware_quote_executable str =
- if not (os_type_win32 || os_type_cygwin) then
- sprintf "%S" str
- else
- let _ = if contains_suspicious_characters str then
- warn "The string %S contains suspicious characters; ocamlfind might fail" str in
- Str.global_replace (Str.regexp "\\\\") "/" str
-
(** * Date *)
(** The short one is displayed when starting coqtop,
@@ -254,7 +227,6 @@ type preferences = {
coqdocdir : string option;
ocamlfindcmd : string option;
lablgtkdir : string option;
- camlp5dir : string option;
arch : string option;
natdynlink : bool;
coqide : ide option;
@@ -292,7 +264,6 @@ let default = {
coqdocdir = None;
ocamlfindcmd = None;
lablgtkdir = None;
- camlp5dir = None;
arch = None;
natdynlink = true;
coqide = None;
@@ -399,8 +370,6 @@ let args_options = Arg.align [
"<dir> Specifies the ocamlfind command to use";
"-lablgtkdir", arg_string_option (fun p lablgtkdir -> { p with lablgtkdir }),
"<dir> Specifies the path to the Lablgtk library";
- "-camlp5dir", arg_string_option (fun p camlp5dir -> { p with camlp5dir }),
- "<dir> Specifies where is the Camlp5 library and tells to use it";
"-flambda-opts", arg_string_list ' ' (fun p flambda_flags -> { p with flambda_flags }),
"<flags> Specifies additional flags to be passed to the flambda optimizing compiler";
"-arch", arg_string_option (fun p arch -> { p with arch }),
@@ -580,8 +549,6 @@ let camlbin, caml_version, camllib, findlib_version =
then reset_caml_top camlexec (camlbin / "ocaml") in
camlbin, caml_version, camllib, findlib_version
-let camlp5compat = "-loc loc"
-
(** Caml version as a list of string, e.g. ["4";"00";"1"] *)
let caml_version_list = numeric_prefix_list caml_version
@@ -660,76 +627,12 @@ let caml_flags =
let coq_caml_flags =
coq_warn_error
-(** * Camlp5 configuration *)
-
-(* Convention: we use camldir as a prioritary location for camlp5, if given *)
-(* i.e., in the case of camlp5, we search for a copy of camlp5o which *)
-(* answers the right camlp5 lib dir *)
-
-let strip_slash dir =
- let n = String.length dir in
- if n>0 && dir.[n - 1] = '/' then String.sub dir 0 (n-1) else dir
-
-let which_camlp5o_for camlp5lib =
- let camlp5o = Filename.concat camlbin "camlp5o" in
- let camlp5lib = strip_slash camlp5lib in
- if fst (tryrun camlp5o ["-where"]) = camlp5lib then camlp5o else
- let camlp5o = which "camlp5o" in
- if fst (tryrun camlp5o ["-where"]) = camlp5lib then camlp5o else
- die ("Error: cannot find Camlp5 binaries corresponding to Camlp5 library " ^ camlp5lib)
-
-let which_camlp5 base =
- let file = Filename.concat camlbin base in
- if is_executable file then file else which base
-
-(* TODO: camlp5dir should rather be the *binary* location, just as camldir *)
-(* TODO: remove the late attempts at finding gramlib.cma *)
-
-let check_camlp5 testcma = match !prefs.camlp5dir with
- | Some dir ->
- if Sys.file_exists (dir/testcma) then
- let camlp5o =
- try which_camlp5o_for dir
- with Not_found -> die "Error: cannot find Camlp5 binaries in path.\n" in
- dir, camlp5o
- else
- let msg =
- sprintf "Cannot find camlp5 libraries in '%s' (%s not found)."
- dir testcma
- in die msg
- | None ->
- try
- let camlp5o = which_camlp5 "camlp5o" in
- let dir,_ = tryrun camlp5o ["-where"] in
- dir, camlp5o
- with Not_found ->
- die "No Camlp5 installation found."
-
-let check_camlp5_version camlp5o =
- let version_line, _ = run ~err:StdOut camlp5o ["-v"] in
- let version = List.nth (string_split ' ' version_line) 2 in
- match numeric_prefix_list version with
- | major::minor::_ when s2i major > 6 || (s2i major, s2i minor) >= (6,6) ->
- cprintf "You have Camlp5 %s. Good!" version; version
- | _ -> die "Error: unsupported Camlp5 (version < 6.06 or unrecognized).\n"
-
-let config_camlp5 () =
- let camlp5mod = "gramlib" in
- let camlp5libdir, camlp5o = check_camlp5 (camlp5mod^".cma") in
- let camlp5_version = check_camlp5_version camlp5o in
- camlp5o, Filename.dirname camlp5o, camlp5libdir, camlp5mod, camlp5_version
-
-let camlp5o, camlp5bindir, fullcamlp5libdir,
- camlp5mod, camlp5_version = config_camlp5 ()
-
let shorten_camllib s =
if starts_with s (camllib^"/") then
let l = String.length camllib + 1 in
"+" ^ String.sub s l (String.length s - l)
else s
-let camlp5libdir = shorten_camllib fullcamlp5libdir
-
(** * Native compiler *)
let msg_byteonly =
@@ -738,9 +641,6 @@ let msg_byteonly =
let msg_no_ocamlopt () =
warn "Cannot find the OCaml native-code compiler.\n%s" msg_byteonly
-let msg_no_camlp5_cmxa () =
- warn "Cannot find the native-code library of camlp5.\n%s" msg_byteonly
-
let msg_no_dynlink_cmxa () =
warn "Cannot find native-code dynlink library.\n%s" msg_byteonly;
cprintf "For building a native-code Coq, you may try to first";
@@ -751,8 +651,6 @@ let check_native () =
let () = if !prefs.byteonly then raise Not_found in
let version, _ = tryrun camlexec.find ["opt";"-version"] in
if version = "" then let () = msg_no_ocamlopt () in raise Not_found
- else if not (Sys.file_exists (fullcamlp5libdir/camlp5mod^".cmxa"))
- then let () = msg_no_camlp5_cmxa () in raise Not_found
else if fst (tryrun camlexec.find ["query";"dynlink"]) = ""
then let () = msg_no_dynlink_cmxa () in raise Not_found
else
@@ -771,7 +669,6 @@ let hasnatdynlink = !prefs.natdynlink && best_compiler = "opt"
let natdynlinkflag =
if hasnatdynlink then "true" else "false"
-
(** * OS dependent libraries *)
let operating_system =
@@ -1111,9 +1008,6 @@ let print_summary () =
pr " OCaml binaries in : %s\n" (esc camlbin);
pr " OCaml library in : %s\n" (esc camllib);
pr " OCaml flambda flags : %s\n" (String.concat " " !prefs.flambda_flags);
- pr " Camlp5 version : %s\n" camlp5_version;
- pr " Camlp5 binaries in : %s\n" (esc camlp5bindir);
- pr " Camlp5 library in : %s\n" (esc camlp5libdir);
if best_compiler = "opt" then
pr " Native dynamic link support : %B\n" hasnatdynlink;
if coqide <> "no" then
@@ -1153,7 +1047,6 @@ let write_dbg_wrapper f =
pr "# DO NOT EDIT THIS FILE: automatically generated by ../configure #\n\n";
pr "export COQTOP=%S\n" coqtop;
pr "OCAMLDEBUG=%S\n" (camlbin^"/ocamldebug");
- pr "CAMLP5LIB=%S\n\n" camlp5libdir;
pr ". $COQTOP/dev/ocamldebug-coq.run\n";
close_out o;
Unix.chmod f 0o555
@@ -1185,10 +1078,6 @@ let write_configml f =
pr_p "datadirsuffix" datadirsuffix;
pr_p "docdirsuffix" docdirsuffix;
pr_s "ocamlfind" camlexec.find;
- pr_s "camlp5o" camlp5o;
- pr_s "camlp5bin" camlp5bindir;
- pr_s "camlp5lib" camlp5libdir;
- pr_s "camlp5compat" camlp5compat;
pr_s "caml_flags" caml_flags;
pr_s "version" coq_version;
pr_s "caml_version" caml_version;
@@ -1212,7 +1101,7 @@ let write_configml f =
pr_b "native_compiler" !prefs.nativecompiler;
let core_src_dirs = [ "config"; "lib"; "clib"; "kernel"; "library";
- "engine"; "pretyping"; "interp"; "parsing"; "proofs";
+ "engine"; "pretyping"; "interp"; "gramlib__pack"; "parsing"; "proofs";
"tactics"; "toplevel"; "printing"; "ide"; "stm"; "vernac" ] in
let core_src_dirs = List.fold_left (fun acc core_src_subdir -> acc ^ " \"" ^ core_src_subdir ^ "\";\n")
""
@@ -1295,11 +1184,6 @@ let write_makefile f =
pr "CAMLDEBUGOPT=%s\n\n" coq_debug_flag;
pr "# Compilation profile flag\n";
pr "CAMLTIMEPROF=%s\n\n" coq_profile_flag;
- pr "# Camlp5 : flavor, binaries, libraries ...\n";
- pr "# NB : avoid using CAMLP5LIB (conflict under Windows)\n";
- pr "CAMLP5O=%s\n" (win_aware_quote_executable camlp5o);
- pr "CAMLP5COMPAT=%s\n" camlp5compat;
- pr "MYCAMLP5LIB=%S\n\n" camlp5libdir;
pr "# Your architecture\n";
pr "# Can be obtain by UNIX command arch\n";
pr "ARCH=%s\n" arch;
diff --git a/coq.opam b/coq.opam
index ab18119ac4..ae1f688312 100644
--- a/coq.opam
+++ b/coq.opam
@@ -22,7 +22,6 @@ depends: [
"ocaml" { >= "4.05.0" }
"dune" { build & >= "1.4.0" }
"num"
- "camlp5" { >= "7.03" }
]
build-env: [
diff --git a/coqpp/coqpp_main.ml b/coqpp/coqpp_main.ml
index ba3b9bcbbf..d52bd39d72 100644
--- a/coqpp/coqpp_main.ml
+++ b/coqpp/coqpp_main.ml
@@ -139,7 +139,7 @@ let print_local fmt ext =
match locals with
| [] -> ()
| e :: locals ->
- let mk_e fmt e = fprintf fmt "%s.Entry.create \"%s\"" ext.gramext_name e in
+ let mk_e fmt e = fprintf fmt "Pcoq.Entry.create \"%s\"" e in
let () = fprintf fmt "@[<hv 2>let %s =@ @[%a@]@]@ " e mk_e e in
let iter e = fprintf fmt "@[<hv 2>and %s =@ @[%a@]@]@ " e mk_e e in
let () = List.iter iter locals in
@@ -277,16 +277,16 @@ let print_rule fmt r =
let pr_prd fmt prd = print_list fmt print_prod prd in
fprintf fmt "@[(%a,@ %a,@ %a)@]" pr_lvl r.grule_label pr_asc r.grule_assoc pr_prd (List.rev r.grule_prods)
-let print_entry fmt gram e =
+let print_entry fmt e =
let print_position_opt fmt pos = print_opt fmt print_position pos in
let print_rules fmt rules = print_list fmt print_rule rules in
- fprintf fmt "let () =@ @[%s.gram_extend@ %s@ @[(%a, %a)@]@]@ in@ "
- gram e.gentry_name print_position_opt e.gentry_pos print_rules e.gentry_rules
+ fprintf fmt "let () =@ @[Pcoq.grammar_extend@ %s@ None@ @[(%a, %a)@]@]@ in@ "
+ e.gentry_name print_position_opt e.gentry_pos print_rules e.gentry_rules
let print_ast fmt ext =
let () = fprintf fmt "let _ = @[" in
let () = fprintf fmt "@[<v>%a@]" print_local ext in
- let () = List.iter (fun e -> print_entry fmt ext.gramext_name e) ext.gramext_entries in
+ let () = List.iter (fun e -> print_entry fmt e) ext.gramext_entries in
let () = fprintf fmt "()@]@\n" in
()
@@ -374,9 +374,9 @@ let print_rules fmt rules =
let print_classifier fmt = function
| ClassifDefault -> fprintf fmt ""
| ClassifName "QUERY" ->
- fprintf fmt "~classifier:(fun _ -> Vernac_classifier.classify_as_query)"
+ fprintf fmt "~classifier:(fun _ -> Vernacextend.classify_as_query)"
| ClassifName "SIDEFF" ->
- fprintf fmt "~classifier:(fun _ -> Vernac_classifier.classify_as_sideeff)"
+ fprintf fmt "~classifier:(fun _ -> Vernacextend.classify_as_sideeff)"
| ClassifName s -> fatal (Printf.sprintf "Unknown classifier %s" s)
| ClassifCode c -> fprintf fmt "~classifier:(%s)" c.code
diff --git a/default.nix b/default.nix
index 7c8113c9ab..eeab388cb4 100644
--- a/default.nix
+++ b/default.nix
@@ -48,7 +48,7 @@ stdenv.mkDerivation rec {
python2 time # coq-makefile timing tools
dune
]
- ++ (with ocamlPackages; [ ocaml findlib camlp5 num ])
+ ++ (with ocamlPackages; [ ocaml findlib num ])
++ optional buildIde ocamlPackages.lablgtk
++ optionals buildDoc [
# Sphinx doc dependencies
@@ -67,6 +67,7 @@ stdenv.mkDerivation rec {
++ optionals shell (
[ jq curl gitFull gnupg ] # Dependencies of the merging script
++ (with ocamlPackages; [ merlin ocp-indent ocp-index utop ]) # Dev tools
+ ++ [ graphviz ] # Useful for STM debugging
);
src =
diff --git a/dev/base_include b/dev/base_include
index 0e12b57b36..48feeec147 100644
--- a/dev/base_include
+++ b/dev/base_include
@@ -8,6 +8,7 @@
#directory "toplevel";;
#directory "library";;
#directory "kernel";;
+#directory "gramlib";;
#directory "engine";;
#directory "pretyping";;
#directory "lib";;
@@ -18,8 +19,6 @@
#directory "stm";;
#directory "vernac";;
-#directory "+camlp5";; (* Gramext is found in top_printers.ml *)
-
#use "top_printers.ml";;
#use "vm_printers.ml";;
@@ -135,7 +134,6 @@ open Pfedit
open Proof
open Proof_using
open Proof_global
-open Proof_type
open Redexpr
open Refiner
open Tacmach
diff --git a/dev/build/windows/makecoq_mingw.sh b/dev/build/windows/makecoq_mingw.sh
index 71207bb040..d0b5f4be47 100755
--- a/dev/build/windows/makecoq_mingw.sh
+++ b/dev/build/windows/makecoq_mingw.sh
@@ -1076,7 +1076,7 @@ function make_ocaml {
function make_ocaml_tools {
make_findlib
- make_camlp5
+ # make_camlp5
}
##### OCAML EXTRA LIBRARIES #####
@@ -1386,7 +1386,7 @@ function make_coq {
make_ocaml
make_num
make_findlib
- make_camlp5
+ # make_camlp5
make_lablgtk
if
case $COQ_VERSION in
@@ -1645,7 +1645,7 @@ function make_addon_bignums {
function make_addon_equations {
installer_addon_dependency equations
- if build_prep_overlay Equations; then
+ if build_prep_overlay equations; then
installer_addon_section equations "Equations" "Coq plugin for defining functions by equations" ""
# Note: PATH is automatically saved/restored by build_prep / build_post
PATH=$COQBIN:$PATH
diff --git a/dev/ci/README-developers.md b/dev/ci/README-developers.md
new file mode 100644
index 0000000000..6ca3aa2981
--- /dev/null
+++ b/dev/ci/README-developers.md
@@ -0,0 +1,165 @@
+Information for developers about the CI system
+----------------------------------------------
+
+When you submit a pull request (PR) on the Coq GitHub repository, this will
+automatically launch a battery of CI tests. The PR will not be integrated
+unless these tests pass.
+
+We are currently running tests on the following platforms:
+
+- GitLab CI is the main CI platform. It tests the compilation of Coq,
+ of the documentation, and of CoqIDE on Linux with several versions
+ of OCaml and with warnings as errors; it runs the test-suite and
+ tests the compilation of several external developments.
+
+- Travis CI is used to test the compilation of Coq and run the test-suite on
+ macOS. It also runs a linter that checks whitespace discipline. A
+ [pre-commit hook](../tools/pre-commit) is automatically installed by
+ `./configure`. It should allow complying with this discipline without pain.
+
+- AppVeyor is used to test the compilation of Coq and run the test-suite on
+ Windows.
+
+You can anticipate the results of most of these tests prior to submitting your
+PR by running GitLab CI on your private branches. To do so follow these steps:
+
+1. Log into GitLab CI (the easiest way is to sign in with your GitHub account).
+2. Click on "New Project".
+3. Choose "CI / CD for external repository" then click on "GitHub".
+4. Find your fork of the Coq repository and click on "Connect".
+5. If GitLab did not do so automatically, [enable the Container Registry](https://docs.gitlab.com/ee/user/project/container_registry.html#enable-the-container-registry-for-your-project).
+6. You are encouraged to go to the CI / CD general settings and increase the
+ timeout from 1h to 2h for better reliability.
+
+Now everytime you push (including force-push unless you changed the default
+GitLab setting) to your fork on GitHub, it will be synchronized on GitLab and
+CI will be run. You will receive an e-mail with a report of the failures if
+there are some.
+
+You can also run one CI target locally (using `make ci-somedev`).
+
+See also [`test-suite/README.md`](../../test-suite/README.md) for information about adding new tests to the test-suite.
+
+### Breaking changes
+
+When your PR breaks an external project we test in our CI, you must
+prepare a patch (or ask someone to prepare a patch) to fix the
+project. There is experimental support for an improved workflow, see
+[the next section](#experimental-automatic-overlay-creation-and-building), below
+are the steps to manually prepare a patch:
+
+1. Fork the external project, create a new branch, push a commit adapting
+ the project to your changes.
+2. Test your pull request with your adapted version of the external project by
+ adding an overlay file to your pull request (cf.
+ [`dev/ci/user-overlays/README.md`](user-overlays/README.md)).
+3. Fixes to external libraries (pure Coq projects) *must* be backward
+ compatible (i.e. they should also work with the development version of Coq,
+ and the latest stable version). This will allow you to open a PR on the
+ external project repository to have your changes merged *before* your PR on
+ Coq can be integrated.
+
+ On the other hand, patches to plugins (projects linking to the Coq ML API)
+ can very rarely be made backward compatible and plugins we test will
+ generally have a dedicated branch per Coq version.
+ You can still open a pull request but the merging will be requested by the
+ developer who merges the PR on Coq. There are plans to improve this, cf.
+ [#6724](https://github.com/coq/coq/issues/6724).
+
+Moreover your PR must absolutely update the [`CHANGES.md`](../../CHANGES.md) file.
+
+### Experimental automatic overlay creation and building
+
+If you break external projects that are hosted on GitHub, you can use
+the `create-overlays.sh` script to automatically perform most of the
+above steps. In order to do so, call the script as:
+```
+./dev/tools/create-overlays.sh ejgallego 9873 aac_tactics elpi ltac
+```
+replacing `ejgallego` by your GitHub nickname and `9873` by the actual PR
+number. The script will:
+
+- checkout the contributions and prepare the branch/remote so you can
+ just commit the fixes and push,
+- add the corresponding overlay file in `dev/ci/user-overlays`.
+
+For problems related to ML-plugins, if you use `dune build` to build
+Coq, it will actually be aware of the broken contributions and perform
+a global build. This is very convenient when using `merlin` as you
+will get a coherent view of all the broken plugins, with full
+incremental cross-project rebuild.
+
+Advanced GitLab CI information
+------------------------------
+
+GitLab CI is set up to use the "build artifact" feature to avoid
+rebuilding Coq. In one job, Coq is built with `./configure -prefix _install_ci`
+and `make install` is run, then the `_install_ci` directory
+persists to and is used by the next jobs.
+
+### Artifacts
+
+Build artifacts from GitLab can be linked / downloaded in a systematic
+way, see [GitLab's documentation](https://docs.gitlab.com/ce/user/project/pipelines/job_artifacts.html#downloading-the-latest-job-artifacts)
+for more information. For example, to access the documentation of the
+`master` branch, you can do:
+
+https://gitlab.com/coq/coq/-/jobs/artifacts/master/file/_install_ci/share/doc/coq/sphinx/html/index.html?job=doc:refman
+
+Browsing artifacts is also possible:
+https://gitlab.com/coq/coq/-/jobs/artifacts/master/browse/_install_ci/?job=build:base
+
+Above, you can replace `master` and `job` by the desired GitLab branch and job name.
+
+Currently available artifacts are:
+
+- the Coq executables and stdlib, in four copies varying in
+ architecture and OCaml version used to build Coq:
+ https://gitlab.com/coq/coq/-/jobs/artifacts/master/browse/_install_ci/?job=build:base
+
+ Additionally, an experimental Dune build is provided:
+ https://gitlab.com/coq/coq/-/jobs/artifacts/master/browse/_build/?job=build:edge:dune:dev
+
+- the Coq documentation, built in the `doc:*` jobs. When submitting
+ a documentation PR, this can help reviewers checking the rendered result:
+
+ + Coq's Reference Manual [master branch]
+ https://gitlab.com/coq/coq/-/jobs/artifacts/master/file/_install_ci/share/doc/coq/sphinx/html/index.html?job=doc:refman
+ + Coq's Standard Library Documentation [master branch]
+ https://gitlab.com/coq/coq/-/jobs/artifacts/master/file/_install_ci/share/doc/coq/html/stdlib/index.html?job=build:base
+ + Coq's ML API Documentation [master branch]
+ https://gitlab.com/coq/coq/-/jobs/artifacts/master/file/_build/default/_doc/_html/index.html?job=doc:ml-api:odoc
+
+### GitLab and Windows
+
+If your repository has access to runners tagged `windows`, setting the
+secret variable `WINDOWS` to `enabled` will add jobs building Windows
+versions of Coq (32bit and 64bit).
+
+If the secret variable `WINDOWS` is set to `enabled_all_addons`,
+an extended set of addons will be added to the Windows installer.
+This leads to a considerable runtime in CI so this is not enabled
+by default for pipelines for pull requests.
+
+The Windows jobs are enabled on Coq's repository, where pipelines for
+pull requests run.
+
+### GitLab and Docker
+
+System and opam packages are installed in a Docker image. The image is
+automatically built and uploaded to your GitLab registry, and is
+loaded by subsequent jobs.
+
+**IMPORTANT**: When updating Coq's CI docker image, you must modify
+the `CACHEKEY` variable in [`.gitlab-ci.yml`](../../.gitlab-ci.yml)
+and [`Dockerfile`](docker/bionic_coq/Dockerfile)
+
+The Docker building job reuses the uploaded image if it is available,
+but if you wish to save more time you can skip the job by setting
+`SKIP_DOCKER` to `true`.
+
+This means you will need to change its value when the Docker image
+needs to be updated. You can do so for a single pipeline by starting
+it through the web interface.
+
+See also [`docker/README.md`](docker/README.md).
diff --git a/dev/ci/README-users.md b/dev/ci/README-users.md
new file mode 100644
index 0000000000..01769aeddb
--- /dev/null
+++ b/dev/ci/README-users.md
@@ -0,0 +1,85 @@
+Information for external library / Coq plugin authors
+-----------------------------------------------------
+
+You are encouraged to consider submitting your development for addition to
+Coq's CI. This means that:
+
+- Any time that a proposed change is breaking your development, Coq developers
+ will send you patches to adapt it or, at the very least, will work with you
+ to see how to adapt it.
+
+On the condition that:
+
+- At the time of the submission, your development works with Coq's
+ `master` branch.
+
+- Your development is publicly available in a git repository and we can easily
+ send patches to you (e.g. through pull / merge requests).
+
+- You react in a timely manner to discuss / integrate those patches.
+
+- You do not push, to the branches that we test, commits that haven't been
+ first tested to compile with the corresponding branch(es) of Coq.
+
+ For that, we recommend setting a CI system for you development, see
+ [supported CI images for Coq](#supported-ci-images-for-coq) below.
+
+- You maintain a reasonable build time for your development, or you provide
+ a "lite" target that we can use.
+
+In case you forget to comply with these last three conditions, we would reach
+out to you and give you a 30-day grace period during which your development
+would be moved into our "allow failure" category. At the end of the grace
+period, in the absence of progress, the development would be removed from our
+CI.
+
+### Timely merging of overlays
+
+A pitfall of the current CI setup is that when a breaking change is
+merged in Coq upstream, CI for your contrib will be broken until you
+merge the corresponding pull request with the fix for your contribution.
+
+As of today, you have to worry about synchronizing with Coq upstream
+every once in a while; we hope we will improve this in the future by
+using [coqbot](https://github.com/coq/bot); meanwhile, a workaround is
+to give merge permissions to someone from the Coq team as to help with
+these kind of merges.
+
+### Add your development by submitting a pull request
+
+Add a new `ci-mydev.sh` script to [`dev/ci`](.); set the corresponding
+variables in [`ci-basic-overlay.sh`](ci-basic-overlay.sh); add the
+corresponding target to [`Makefile.ci`](../../Makefile.ci) and a new job to
+[`.gitlab-ci.yml`](../../.gitlab-ci.yml) so that this new target is run.
+Have a look at [#7656](https://github.com/coq/coq/pull/7656/files) for an
+example. **Do not hesitate to submit an incomplete pull request if you need
+help to finish it.**
+
+You may also be interested in having your development tested in our
+performance benchmark. Currently this is done by providing an OPAM package
+in https://github.com/coq/opam-coq-archive and opening an issue at
+https://github.com/coq/coq-bench/issues.
+
+### Recommended branching policy.
+
+It is sometimes the case that you will need to maintain a branch of
+your development for particular Coq versions. This is in fact very
+likely if your development includes a Coq ML plugin.
+
+We thus recommend a branching convention that mirrors Coq's branching
+policy. Then, you would have a `master` branch that follows Coq's
+`master`, a `v8.8` branch that works with Coq's `v8.8` branch and so
+on.
+
+This convention will be supported by tools in the future to make some
+developer commands work more seamlessly.
+
+### Supported CI images for Coq
+
+The Coq developers and contributors provide official Docker and Nix
+images for testing against Coq master. Using these images is highly
+recommended:
+
+- For Docker, see: https://github.com/coq-community/docker-coq
+- For Nix, see the setup at
+ https://github.com/coq-community/manifesto/wiki/Continuous-Integration-with-Nix
diff --git a/dev/ci/README.md b/dev/ci/README.md
index 4709247549..afbfab3ac6 100644
--- a/dev/ci/README.md
+++ b/dev/ci/README.md
@@ -6,213 +6,15 @@ breakage on our Continuous Integration (CI) platforms *before* integration,
so as to ensure better robustness and catch problems as early as possible.
These tests include the compilation of several external libraries / plugins.
-This document contains information for both external library / plugin authors,
-who might be interested in having their development tested, and for Coq
-developers / contributors, who must ensure that they don't break these
-external developments accidentally.
+This README is split into two specific documents:
-*Remark:* the CI policy outlined in this document is susceptible to evolve and
-specific accommodations are of course possible.
+- [README-users.md](./README-users.md) which contains information for
+ authors of external libraries and plugins who might be interested in
+ having their development tested in our CI system.
-Information for external library / plugin authors
--------------------------------------------------
+- [README-developers.md](./README-developers.md) for Coq developers /
+ contributors, who must ensure that they don't break these external
+ developments accidentally.
-You are encouraged to consider submitting your development for addition to
-our CI. This means that:
-
-- Any time that a proposed change is breaking your development, Coq developers
- will send you patches to adapt it or, at the very least, will work with you
- to see how to adapt it.
-
-On the condition that:
-
-- At the time of the submission, your development works with Coq's
- `master` branch.
-
-- Your development is publicly available in a git repository and we can easily
- send patches to you (e.g. through pull / merge requests).
-
-- You react in a timely manner to discuss / integrate those patches.
-
-- You do not push, to the branches that we test, commits that haven't been
- first tested to compile with the corresponding branch(es) of Coq.
-
-- You maintain a reasonable build time for your development, or you provide
- a "lite" target that we can use.
-
-In case you forget to comply with these last three conditions, we would reach
-out to you and give you a 30-day grace period during which your development
-would be moved into our "allow failure" category. At the end of the grace
-period, in the absence of progress, the development would be removed from our
-CI.
-
-### Add your development by submitting a pull request
-
-Add a new `ci-mydev.sh` script to [`dev/ci`](.); set the corresponding
-variables in [`ci-basic-overlay.sh`](ci-basic-overlay.sh); add the
-corresponding target to [`Makefile.ci`](../../Makefile.ci) and a new job to
-[`.gitlab-ci.yml`](../../.gitlab-ci.yml) so that this new target is run.
-Have a look at [#7656](https://github.com/coq/coq/pull/7656/files) for an
-example. **Do not hesitate to submit an incomplete pull request if you need
-help to finish it.**
-
-You may also be interested in having your development tested in our
-performance benchmark. Currently this is done by providing an OPAM package
-in https://github.com/coq/opam-coq-archive and opening an issue at
-https://github.com/coq/coq-bench/issues.
-
-### Recommended branching policy.
-
-It is sometimes the case that you will need to maintain a branch of
-your development for particular Coq versions. This is in fact very
-likely if your development includes a Coq ML plugin.
-
-We thus recommend a branching convention that mirrors Coq's branching
-policy. Then, you would have a `master` branch that follows Coq's
-`master`, a `v8.8` branch that works with Coq's `v8.8` branch and so
-on.
-
-This convention will be supported by tools in the future to make some
-developer commands work more seamlessly.
-
-Information for developers
---------------------------
-
-When you submit a pull request (PR) on Coq GitHub repository, this will
-automatically launch a battery of CI tests. The PR will not be integrated
-unless these tests pass.
-
-We are currently running tests on the following platforms:
-
-- GitLab CI is the main CI platform. It tests the compilation of Coq, of the
- documentation, and of CoqIDE on Linux with several versions of OCaml /
- camlp5, and with warnings as errors; it runs the test-suite and tests the
- compilation of several external developments.
-
-- Travis CI is used to test the compilation of Coq and run the test-suite on
- macOS. It also runs a linter that checks whitespace discipline. A
- [pre-commit hook](../tools/pre-commit) is automatically installed by
- `./configure`. It should allow complying with this discipline without pain.
-
-- AppVeyor is used to test the compilation of Coq and run the test-suite on
- Windows.
-
-You can anticipate the results of most of these tests prior to submitting your
-PR by running GitLab CI on your private branches. To do so follow these steps:
-
-1. Log into GitLab CI (the easiest way is to sign in with your GitHub account).
-2. Click on "New Project".
-3. Choose "CI / CD for external repository" then click on "GitHub".
-4. Find your fork of the Coq repository and click on "Connect".
-5. If GitLab did not do so automatically, [enable the Container Registry](https://docs.gitlab.com/ee/user/project/container_registry.html#enable-the-container-registry-for-your-project).
-6. You are encouraged to go to the CI / CD general settings and increase the
- timeout from 1h to 2h for better reliability.
-
-Now everytime you push (including force-push unless you changed the default
-GitLab setting) to your fork on GitHub, it will be synchronized on GitLab and
-CI will be run. You will receive an e-mail with a report of the failures if
-there are some.
-
-You can also run one CI target locally (using `make ci-somedev`).
-
-See also [`test-suite/README.md`](../../test-suite/README.md) for information about adding new tests to the test-suite.
-
-### Breaking changes
-
-When your PR breaks an external project we test in our CI, you must prepare a
-patch (or ask someone to prepare a patch) to fix the project:
-
-1. Fork the external project, create a new branch, push a commit adapting
- the project to your changes.
-2. Test your pull request with your adapted version of the external project by
- adding an overlay file to your pull request (cf.
- [`dev/ci/user-overlays/README.md`](user-overlays/README.md)).
-3. Fixes to external libraries (pure Coq projects) *must* be backward
- compatible (i.e. they should also work with the development version of Coq,
- and the latest stable version). This will allow you to open a PR on the
- external project repository to have your changes merged *before* your PR on
- Coq can be integrated.
-
- On the other hand, patches to plugins (projects linking to the Coq ML API)
- can very rarely be made backward compatible and plugins we test will
- generally have a dedicated branch per Coq version.
- You can still open a pull request but the merging will be requested by the
- developer who merges the PR on Coq. There are plans to improve this, cf.
- [#6724](https://github.com/coq/coq/issues/6724).
-
-Moreover your PR must absolutely update the [`CHANGES.md`](../../CHANGES.md) file.
-
-Advanced GitLab CI information
-------------------------------
-
-GitLab CI is set up to use the "build artifact" feature to avoid
-rebuilding Coq. In one job, Coq is built with `./configure -prefix _install_ci`
-and `make install` is run, then the `_install_ci` directory
-persists to and is used by the next jobs.
-
-### Artifacts
-
-Build artifacts from GitLab can be linked / downloaded in a systematic
-way, see [GitLab's documentation](https://docs.gitlab.com/ce/user/project/pipelines/job_artifacts.html#downloading-the-latest-job-artifacts)
-for more information. For example, to access the documentation of the
-`master` branch, you can do:
-
-https://gitlab.com/coq/coq/-/jobs/artifacts/master/file/_install_ci/share/doc/coq/sphinx/html/index.html?job=doc:refman
-
-Browsing artifacts is also possible:
-https://gitlab.com/coq/coq/-/jobs/artifacts/master/browse/_install_ci/?job=build:base
-
-Above, you can replace `master` and `job` by the desired GitLab branch and job name.
-
-Currently available artifacts are:
-
-- the Coq executables and stdlib, in four copies varying in
- architecture and OCaml version used to build Coq:
- https://gitlab.com/coq/coq/-/jobs/artifacts/master/browse/_install_ci/?job=build:base
-
- Additionally, an experimental Dune build is provided:
- https://gitlab.com/coq/coq/-/jobs/artifacts/master/browse/_build/?job=build:edge:dune:dev
-
-- the Coq documentation, built in the `doc:*` jobs. When submitting
- a documentation PR, this can help reviewers checking the rendered result:
-
- + Coq's Reference Manual [master branch]
- https://gitlab.com/coq/coq/-/jobs/artifacts/master/file/_install_ci/share/doc/coq/sphinx/html/index.html?job=doc:refman
- + Coq's Standard Library Documentation [master branch]
- https://gitlab.com/coq/coq/-/jobs/artifacts/master/file/_install_ci/share/doc/coq/html/stdlib/index.html?job=doc:refman
- + Coq's ML API Documentation [master branch]
- https://gitlab.com/coq/coq/-/jobs/artifacts/master/file/_build/default/_doc/_html/index.html?job=doc:ml-api:odoc
-
-### GitLab and Windows
-
-If your repository has access to runners tagged `windows`, setting the
-secret variable `WINDOWS` to `enabled` will add jobs building Windows
-versions of Coq (32bit and 64bit).
-
-If the secret variable `WINDOWS` is set to `enabled_all_addons`,
-an extended set of addons will be added to the Windows installer.
-This leads to a considerable runtime in CI so this is not enabled
-by default for pipelines for pull requests.
-
-The Windows jobs are enabled on Coq's repository, where pipelines for
-pull requests run.
-
-### GitLab and Docker
-
-System and opam packages are installed in a Docker image. The image is
-automatically built and uploaded to your GitLab registry, and is
-loaded by subsequent jobs.
-
-**IMPORTANT**: When updating Coq's CI docker image, you must modify
-the `CACHEKEY` variable in [`.gitlab-ci.yml`](../../.gitlab-ci.yml)
-and [`Dockerfile`](docker/bionic_coq/Dockerfile)
-
-The Docker building job reuses the uploaded image if it is available,
-but if you wish to save more time you can skip the job by setting
-`SKIP_DOCKER` to `true`.
-
-This means you will need to change its value when the Docker image
-needs to be updated. You can do so for a single pipeline by starting
-it through the web interface.
-
-See also [`docker/README.md`](docker/README.md).
+*Remark:* the CI policy outlined in these documents is susceptible to
+evolve and specific accommodations are of course possible.
diff --git a/dev/ci/appveyor.sh b/dev/ci/appveyor.sh
index 84fec71f7a..abeb039c0e 100644
--- a/dev/ci/appveyor.sh
+++ b/dev/ci/appveyor.sh
@@ -10,6 +10,6 @@ bash opam64/install.sh
opam init -a mingw https://github.com/fdopen/opam-repository-mingw.git --comp $APPVEYOR_OPAM_SWITCH --switch $APPVEYOR_OPAM_SWITCH
eval "$(opam config env)"
-opam install -y num ocamlfind camlp5 ounit
+opam install -y num ocamlfind ounit
cd "$APPVEYOR_BUILD_FOLDER" && ./configure -local && make && make byte && make -C test-suite all INTERACTIVE= # && make validate
diff --git a/dev/ci/ci-aac-tactics.sh b/dev/ci/ci-aac-tactics.sh
deleted file mode 100755
index 896a0ddf66..0000000000
--- a/dev/ci/ci-aac-tactics.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/usr/bin/env bash
-
-ci_dir="$(dirname "$0")"
-. "${ci_dir}/ci-common.sh"
-
-git_download aactactics
-
-( cd "${CI_BUILD_DIR}/aactactics" && make && make install )
diff --git a/dev/ci/ci-aac_tactics.sh b/dev/ci/ci-aac_tactics.sh
new file mode 100755
index 0000000000..19f1f43746
--- /dev/null
+++ b/dev/ci/ci-aac_tactics.sh
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+
+ci_dir="$(dirname "$0")"
+. "${ci_dir}/ci-common.sh"
+
+git_download aac_tactics
+
+( cd "${CI_BUILD_DIR}/aac_tactics" && make && make install )
diff --git a/dev/ci/ci-basic-overlay.sh b/dev/ci/ci-basic-overlay.sh
index 3137576207..96bc5be7ff 100755
--- a/dev/ci/ci-basic-overlay.sh
+++ b/dev/ci/ci-basic-overlay.sh
@@ -113,16 +113,16 @@
########################################################################
# CompCert
########################################################################
-: "${CompCert_CI_REF:=master}"
-: "${CompCert_CI_GITURL:=https://github.com/AbsInt/CompCert}"
-: "${CompCert_CI_ARCHIVEURL:=${CompCert_CI_GITURL}/archive}"
+: "${compcert_CI_REF:=master}"
+: "${compcert_CI_GITURL:=https://github.com/AbsInt/CompCert}"
+: "${compcert_CI_ARCHIVEURL:=${compcert_CI_GITURL}/archive}"
########################################################################
# VST
########################################################################
-: "${VST_CI_REF:=master}"
-: "${VST_CI_GITURL:=https://github.com/PrincetonUniversity/VST}"
-: "${VST_CI_ARCHIVEURL:=${VST_CI_GITURL}/archive}"
+: "${vst_CI_REF:=master}"
+: "${vst_CI_GITURL:=https://github.com/PrincetonUniversity/VST}"
+: "${vst_CI_ARCHIVEURL:=${vst_CI_GITURL}/archive}"
########################################################################
# cross-crypto
@@ -153,7 +153,7 @@
: "${formal_topology_CI_ARCHIVEURL:=${formal_topology_CI_GITURL}/archive}"
########################################################################
-# coq-dpdgraph
+# coq_dpdgraph
########################################################################
: "${coq_dpdgraph_CI_REF:=coq-master}"
: "${coq_dpdgraph_CI_GITURL:=https://github.com/Karmaki/coq-dpdgraph}"
@@ -162,9 +162,9 @@
########################################################################
# CoLoR
########################################################################
-: "${CoLoR_CI_REF:=master}"
-: "${CoLoR_CI_GITURL:=https://github.com/fblanqui/color}"
-: "${CoLoR_CI_ARCHIVEURL:=${CoLoR_CI_GITURL}/archive}"
+: "${color_CI_REF:=master}"
+: "${color_CI_GITURL:=https://github.com/fblanqui/color}"
+: "${color_CI_ARCHIVEURL:=${color_CI_GITURL}/archive}"
########################################################################
# SF
@@ -196,16 +196,16 @@
########################################################################
# Equations
########################################################################
-: "${Equations_CI_REF:=master}"
-: "${Equations_CI_GITURL:=https://github.com/mattam82/Coq-Equations}"
-: "${Equations_CI_ARCHIVEURL:=${Equations_CI_GITURL}/archive}"
+: "${equations_CI_REF:=master}"
+: "${equations_CI_GITURL:=https://github.com/mattam82/Coq-Equations}"
+: "${equations_CI_ARCHIVEURL:=${equations_CI_GITURL}/archive}"
########################################################################
# Elpi
########################################################################
-: "${Elpi_CI_REF:=coq-master}"
-: "${Elpi_CI_GITURL:=https://github.com/LPCIC/coq-elpi}"
-: "${Elpi_CI_ARCHIVEURL:=${Elpi_CI_GITURL}/archive}"
+: "${elpi_CI_REF:=coq-master}"
+: "${elpi_CI_GITURL:=https://github.com/LPCIC/coq-elpi}"
+: "${elpi_CI_ARCHIVEURL:=${elpi_CI_GITURL}/archive}"
########################################################################
# fcsl-pcm
@@ -215,13 +215,6 @@
: "${fcsl_pcm_CI_ARCHIVEURL:=${fcsl_pcm_CI_GITURL}/archive}"
########################################################################
-# pidetop
-########################################################################
-: "${pidetop_CI_REF:=v8.9}"
-: "${pidetop_CI_GITURL:=https://bitbucket.org/coqpide/pidetop}"
-: "${pidetop_CI_ARCHIVEURL:=${pidetop_CI_GITURL}/get}"
-
-########################################################################
# ext-lib
########################################################################
: "${ext_lib_CI_REF:=master}"
@@ -257,11 +250,11 @@
: "${menhirlib_CI_ARCHIVEURL:=${menhirlib_CI_GITURL}/-/archive}"
########################################################################
-# aac-tactics
+# aac_tactics
########################################################################
-: "${aactactics_CI_REF:=master}"
-: "${aactactics_CI_GITURL:=https://github.com/coq-community/aac-tactics}"
-: "${aactactics_CI_ARCHIVEURL:=${aactactics_CI_GITURL}/archive}"
+: "${aac_tactics_CI_REF:=master}"
+: "${aac_tactics_CI_GITURL:=https://github.com/coq-community/aac-tactics}"
+: "${aac_tactics_CI_ARCHIVEURL:=${aac_tactics_CI_GITURL}/archive}"
########################################################################
# paramcoq
diff --git a/dev/ci/ci-color.sh b/dev/ci/ci-color.sh
index dc696f69d9..a0094b1006 100755
--- a/dev/ci/ci-color.sh
+++ b/dev/ci/ci-color.sh
@@ -3,6 +3,6 @@
ci_dir="$(dirname "$0")"
. "${ci_dir}/ci-common.sh"
-git_download CoLoR
+git_download color
-( cd "${CI_BUILD_DIR}/CoLoR" && make )
+( cd "${CI_BUILD_DIR}/color" && make )
diff --git a/dev/ci/ci-common.sh b/dev/ci/ci-common.sh
index 7a450d0d48..a5aa54144c 100644
--- a/dev/ci/ci-common.sh
+++ b/dev/ci/ci-common.sh
@@ -46,8 +46,11 @@ for overlay in "${ci_dir}"/user-overlays/*.sh; do
# shellcheck source=/dev/null
. "${overlay}"
done
+
+set +x
# shellcheck source=ci-basic-overlay.sh
. "${ci_dir}/ci-basic-overlay.sh"
+set -x
# [git_download project] will download [project] and unpack it
# in [$CI_BUILD_DIR/project] if the folder does not exist already;
diff --git a/dev/ci/ci-compcert.sh b/dev/ci/ci-compcert.sh
index 01c35ceb4a..59a85e4726 100755
--- a/dev/ci/ci-compcert.sh
+++ b/dev/ci/ci-compcert.sh
@@ -3,7 +3,7 @@
ci_dir="$(dirname "$0")"
. "${ci_dir}/ci-common.sh"
-git_download CompCert
+git_download compcert
-( cd "${CI_BUILD_DIR}/CompCert" && \
+( cd "${CI_BUILD_DIR}/compcert" && \
./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 2373ea6c62..2373ea6c62 100755
--- a/dev/ci/ci-coq-dpdgraph.sh
+++ b/dev/ci/ci-coq_dpdgraph.sh
diff --git a/dev/ci/ci-elpi.sh b/dev/ci/ci-elpi.sh
index 9b4a06fd5b..d60bf34ba2 100755
--- a/dev/ci/ci-elpi.sh
+++ b/dev/ci/ci-elpi.sh
@@ -3,6 +3,6 @@
ci_dir="$(dirname "$0")"
. "${ci_dir}/ci-common.sh"
-git_download Elpi
+git_download elpi
-( cd "${CI_BUILD_DIR}/Elpi" && make && make install )
+( cd "${CI_BUILD_DIR}/elpi" && make && make install )
diff --git a/dev/ci/ci-equations.sh b/dev/ci/ci-equations.sh
index 998d50faa7..b58a794da2 100755
--- a/dev/ci/ci-equations.sh
+++ b/dev/ci/ci-equations.sh
@@ -3,7 +3,7 @@
ci_dir="$(dirname "$0")"
. "${ci_dir}/ci-common.sh"
-git_download Equations
+git_download equations
-( cd "${CI_BUILD_DIR}/Equations" && coq_makefile -f _CoqProject -o Makefile && \
+( cd "${CI_BUILD_DIR}/equations" && coq_makefile -f _CoqProject -o Makefile && \
make && make test-suite && make examples && make install)
diff --git a/dev/ci/ci-pidetop.sh b/dev/ci/ci-pidetop.sh
deleted file mode 100755
index 1a9a26843c..0000000000
--- a/dev/ci/ci-pidetop.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/usr/bin/env bash
-
-ci_dir="$(dirname "$0")"
-. "${ci_dir}/ci-common.sh"
-
-git_download pidetop
-
-# Travis / Gitlab have different filesystem layout due to use of
-# `-local`. We need to improve this divergence but if we use Dune this
-# "local" oddity goes away automatically so not bothering...
-if [ -d "$COQBIN/../lib/coq" ]; then
- COQLIB="$COQBIN/../lib/coq/"
-else
- COQLIB="$COQBIN/../"
-fi
-
-( cd "${CI_BUILD_DIR}/pidetop" && dune build -p pidetop @install )
-
-echo -en '4\nexit' | "${CI_BUILD_DIR}/pidetop/_build/install/default/bin/pidetop" -coqlib "$COQLIB" -main-channel stdfds
diff --git a/dev/ci/ci-plugin-tutorial.sh b/dev/ci/ci-plugin_tutorial.sh
index 6c26a71a21..6c26a71a21 100755
--- a/dev/ci/ci-plugin-tutorial.sh
+++ b/dev/ci/ci-plugin_tutorial.sh
diff --git a/dev/ci/ci-vst.sh b/dev/ci/ci-vst.sh
index 0fec19205a..169d1a41db 100755
--- a/dev/ci/ci-vst.sh
+++ b/dev/ci/ci-vst.sh
@@ -3,6 +3,6 @@
ci_dir="$(dirname "$0")"
. "${ci_dir}/ci-common.sh"
-git_download VST
+git_download vst
-( cd "${CI_BUILD_DIR}/VST" && make IGNORECOQVERSION=true )
+( cd "${CI_BUILD_DIR}/vst" && make IGNORECOQVERSION=true )
diff --git a/dev/ci/docker/bionic_coq/Dockerfile b/dev/ci/docker/bionic_coq/Dockerfile
index 4ddb582414..3fc6dce4e5 100644
--- a/dev/ci/docker/bionic_coq/Dockerfile
+++ b/dev/ci/docker/bionic_coq/Dockerfile
@@ -1,4 +1,4 @@
-# CACHEKEY: "bionic_coq-V2018-10-30-V1"
+# CACHEKEY: "bionic_coq-V2018-11-08-V1"
# ^^ Update when modifying this file.
FROM ubuntu:bionic
@@ -41,29 +41,27 @@ ENV BASE_OPAM="num ocamlfind.1.8.0 dune.1.4.0 ounit.2.0.8 odoc.1.3.0" \
CI_OPAM="menhir.20180530 elpi.1.1.0 ocamlgraph.1.8.8"
# BASE switch; CI_OPAM contains Coq's CI dependencies.
-ENV CAMLP5_VER="7.03" \
- COQIDE_OPAM="lablgtk.2.18.5 conf-gtksourceview.2"
+ENV COQIDE_OPAM="lablgtk.2.18.5 conf-gtksourceview.2"
# base switch
RUN opam init -a --disable-sandboxing --compiler="$COMPILER" default https://opam.ocaml.org && eval $(opam env) && opam update && \
- opam install $BASE_OPAM camlp5.$CAMLP5_VER $COQIDE_OPAM $CI_OPAM
+ opam install $BASE_OPAM $COQIDE_OPAM $CI_OPAM
# base+32bit switch
RUN opam switch create "${COMPILER}+32bit" && eval $(opam env) && \
- opam install $BASE_OPAM camlp5.$CAMLP5_VER
+ opam install $BASE_OPAM
# EDGE switch
ENV COMPILER_EDGE="4.07.1" \
- CAMLP5_VER_EDGE="7.06.10-g84ce6cc4" \
COQIDE_OPAM_EDGE="lablgtk.2.18.6 conf-gtksourceview.2" \
BASE_OPAM_EDGE="dune-release.1.1.0"
RUN opam switch create $COMPILER_EDGE && eval $(opam env) && \
- opam install $BASE_OPAM $BASE_OPAM_EDGE camlp5.$CAMLP5_VER_EDGE $COQIDE_OPAM_EDGE
+ opam install $BASE_OPAM $BASE_OPAM_EDGE $COQIDE_OPAM_EDGE
# EDGE+flambda switch, we install CI_OPAM as to be able to use
# `ci-template-flambda` with everything.
RUN opam switch create "${COMPILER_EDGE}+flambda" && eval $(opam env) && \
- opam install $BASE_OPAM $BASE_OPAM_EDGE camlp5.$CAMLP5_VER_EDGE $COQIDE_OPAM_EDGE $CI_OPAM
+ opam install $BASE_OPAM $BASE_OPAM_EDGE $COQIDE_OPAM_EDGE $CI_OPAM
RUN opam clean -a -c
diff --git a/dev/ci/nix/README.md b/dev/ci/nix/README.md
new file mode 100644
index 0000000000..1685b084e9
--- /dev/null
+++ b/dev/ci/nix/README.md
@@ -0,0 +1,19 @@
+# Working on third-party developments with *this* version of Coq
+
+Aim: getting an environment suitable for working on a third-party development
+using the current version of Coq (i.e., built from the current state of this
+repository).
+
+Dive into such an environment, for the project `example` by running, from the
+root of this repository:
+
+ ./dev/ci/nix/shell example
+
+This will build Coq and the other dependencies of the `example` project, then
+open a shell with all these dependencies available (e.g., `coqtop` is in path).
+
+Additionally, three environment variables are set, to abstract over the
+build-system of that project: `configure`, `make`, and `clean`. Therefore, after
+changing the working directory to the root of the sources of that project, the
+contents of these variables can be evaluated to respectively set-up, build, and
+clean the project.
diff --git a/dev/ci/nix/unicoq.nix b/dev/ci/nix/unicoq.nix
index f10afd5680..093c262cde 100644
--- a/dev/ci/nix/unicoq.nix
+++ b/dev/ci/nix/unicoq.nix
@@ -1,11 +1,8 @@
-{ stdenv, fetchzip, coq }:
+{ stdenv, coq }:
stdenv.mkDerivation {
name = "coq${coq.coq-version}-unicoq-0.0-git";
- src = fetchzip {
- url = "https://github.com/vbgl/unicoq/archive/8b33e37700e92bfd404bf8bf9fe03f1be8928d97.tar.gz";
- sha256 = "0s4z0wjxlp56ccgzxgk04z7skw90rdnz39v730ffkgrjl38rr9il";
- };
+ src = fetchTarball https://github.com/unicoq/unicoq/archive/master.tar.gz;
buildInputs = [ coq ] ++ (with coq.ocamlPackages; [ ocaml findlib camlp5 num ]);
diff --git a/dev/ci/user-overlays/00669-maximedenes-ssr-merge.sh b/dev/ci/user-overlays/00669-maximedenes-ssr-merge.sh
deleted file mode 100644
index d812df3ec0..0000000000
--- a/dev/ci/user-overlays/00669-maximedenes-ssr-merge.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-
-if [ "$CI_PULL_REQUEST" = "669" ] || [ "$CI_BRANCH" = "ssr-merge" ]; then
- mathcomp_CI_REF=ssr-merge
- mathcomp_CI_GITURL=https://github.com/maximedenes/math-comp
-fi
diff --git a/dev/ci/user-overlays/07085-ppedrot-pure-sharing-flag.sh b/dev/ci/user-overlays/07085-ppedrot-pure-sharing-flag.sh
deleted file mode 100644
index 575df07425..0000000000
--- a/dev/ci/user-overlays/07085-ppedrot-pure-sharing-flag.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-_OVERLAY_BRANCH=pure-sharing-flag
-
-if [ "$CI_PULL_REQUEST" = "7085" ] || [ "$CI_BRANCH" = "$_OVERLAY_BRANCH" ]; then
-
- mtac2_CI_BRANCH="$_OVERLAY_BRANCH"
- mtac2_CI_GITURL=https://github.com/ppedrot/Mtac2
-
-fi
diff --git a/dev/ci/user-overlays/07257-herbelin-master+fix-yet-another-unif-dep-in-alphabet.sh b/dev/ci/user-overlays/07257-herbelin-master+fix-yet-another-unif-dep-in-alphabet.sh
deleted file mode 100644
index 019cb8054d..0000000000
--- a/dev/ci/user-overlays/07257-herbelin-master+fix-yet-another-unif-dep-in-alphabet.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-if [ "$CI_PULL_REQUEST" = "7257" ] || [ "$CI_BRANCH" = "master+fix-yet-another-unif-dep-in-alphabet" ]; then
- cross_crypto_CI_REF=master+fix-coq7257-ascii-sensitive-unification
- cross_crypto_CI_GITURL=https://github.com/herbelin/cross-crypto
-fi
diff --git a/dev/ci/user-overlays/07288-herbelin-master+new-module-pretyping-id-management.sh b/dev/ci/user-overlays/07288-herbelin-master+new-module-pretyping-id-management.sh
deleted file mode 100644
index 3a6480a5a1..0000000000
--- a/dev/ci/user-overlays/07288-herbelin-master+new-module-pretyping-id-management.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-if [ "$CI_PULL_REQUEST" = "7288" ] || [ "$CI_BRANCH" = "master+new-module-pretyping-id-management" ]; then
-
- ltac2_CI_BRANCH=master+globenv-coq-pr7288
- ltac2_CI_GITURL=https://github.com/herbelin/ltac2
-
-fi
diff --git a/dev/ci/user-overlays/07925-ppedrot-clean-transp-state.sh b/dev/ci/user-overlays/07925-ppedrot-clean-transp-state.sh
new file mode 100644
index 0000000000..b05d02c5be
--- /dev/null
+++ b/dev/ci/user-overlays/07925-ppedrot-clean-transp-state.sh
@@ -0,0 +1,14 @@
+_OVERLAY_BRANCH=clean-transp-state
+
+if [ "$CI_PULL_REQUEST" = "7925" ] || [ "$CI_BRANCH" = "$_OVERLAY_BRANCH" ]; then
+
+ unicoq_CI_REF="$_OVERLAY_BRANCH"
+ unicoq_CI_GITURL=https://github.com/ppedrot/unicoq
+
+ equations_CI_REF="$_OVERLAY_BRANCH"
+ equations_CI_GITURL=https://github.com/ppedrot/Coq-Equations
+
+ mtac2_CI_REF="$_OVERLAY_BRANCH"
+ mtac2_CI_GITURL=https://github.com/ppedrot/Mtac2
+
+fi
diff --git a/dev/ci/user-overlays/08456-fix-6764.sh b/dev/ci/user-overlays/08456-fix-6764.sh
deleted file mode 100644
index 3b951d9c07..0000000000
--- a/dev/ci/user-overlays/08456-fix-6764.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-if [ "$CI_PULL_REQUEST" = "8456" ] || [ "$CI_BRANCH" = "fix-6764" ]; then
- Elpi_CI_REF=overlay/8456
-fi
diff --git a/dev/ci/user-overlays/08515-command-atts.sh b/dev/ci/user-overlays/08515-command-atts.sh
deleted file mode 100755
index 4605255d5e..0000000000
--- a/dev/ci/user-overlays/08515-command-atts.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-
-if [ "$CI_PULL_REQUEST" = "8515" ] || [ "$CI_BRANCH" = "command-atts" ]; then
- ltac2_CI_REF=command-atts
- ltac2_CI_GITURL=https://github.com/SkySkimmer/ltac2
-
- Equations_CI_REF=command-atts
- Equations_CI_GITURL=https://github.com/SkySkimmer/Coq-Equations
-
- plugin_tutorial_CI_REF=command-atts
- plugin_tutorial_CI_GITURL=https://github.com/SkySkimmer/plugin_tutorials
-fi
diff --git a/dev/ci/user-overlays/08552-gares-elpi-11.sh b/dev/ci/user-overlays/08552-gares-elpi-11.sh
deleted file mode 100644
index c08f44fc50..0000000000
--- a/dev/ci/user-overlays/08552-gares-elpi-11.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-if [ "$CI_PULL_REQUEST" = "8552" ] || [ "$CI_BRANCH" = "elpi-1.1" ]; then
- Elpi_CI_REF=coq-master-elpi-1.1
-fi
diff --git a/dev/ci/user-overlays/08554-herbelin-master+fix8553-change-under-binders.sh b/dev/ci/user-overlays/08554-herbelin-master+fix8553-change-under-binders.sh
deleted file mode 100644
index 484ad8f9e6..0000000000
--- a/dev/ci/user-overlays/08554-herbelin-master+fix8553-change-under-binders.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-if [ "$CI_PULL_REQUEST" = "8554" ] || [ "$CI_BRANCH" = "master+fix8553-change-under-binders" ]; then
-
- ltac2_CI_BRANCH=master+fix-pr8554-change-takes-env
- ltac2_CI_REF=master+fix-pr8554-change-takes-env
- ltac2_CI_GITURL=https://github.com/herbelin/ltac2
-
- Equations_CI_BRANCH=master+fix-pr8554-change-takes-env
- Equations_CI_REF=master+fix-pr8554-change-takes-env
- Equations_CI_GITURL=https://github.com/herbelin/Coq-Equations
-
-fi
diff --git a/dev/ci/user-overlays/08555-maximedenes-rm-section-path.sh b/dev/ci/user-overlays/08555-maximedenes-rm-section-path.sh
deleted file mode 100644
index 41c2ad6fef..0000000000
--- a/dev/ci/user-overlays/08555-maximedenes-rm-section-path.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-if [ "$CI_PULL_REQUEST" = "8555" ] || [ "$CI_BRANCH" = "rm-section-path" ]; then
-
- ltac2_CI_REF=rm-section-path
- ltac2_CI_GITURL=https://github.com/maximedenes/ltac2
-
- Equations_CI_REF=rm-section-path
- Equations_CI_GITURL=https://github.com/maximedenes/Coq-Equations
-
-fi
diff --git a/dev/ci/user-overlays/08601-name-abstract-univ-context.sh b/dev/ci/user-overlays/08601-name-abstract-univ-context.sh
deleted file mode 100644
index 9d723dc7f2..0000000000
--- a/dev/ci/user-overlays/08601-name-abstract-univ-context.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-_OVERLAY_BRANCH=name-abstract-univ-context
-
-if [ "$CI_PULL_REQUEST" = "8601" ] || [ "$CI_BRANCH" = "$_OVERLAY_BRANCH" ]; then
-
- Elpi_CI_REF="$_OVERLAY_BRANCH"
- Elpi_CI_GITURL=https://github.com/ppedrot/coq-elpi
-
- Equations_CI_REF="$_OVERLAY_BRANCH"
- Equations_CI_GITURL=https://github.com/ppedrot/Coq-Equations
-
-fi
diff --git a/dev/ci/user-overlays/08671-mattam-plugin-tutorials.sh b/dev/ci/user-overlays/08671-mattam-plugin-tutorials.sh
deleted file mode 100644
index bd3e1bf7ff..0000000000
--- a/dev/ci/user-overlays/08671-mattam-plugin-tutorials.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-if [ "$CI_PULL_REQUEST" = "8741" ] || [ "$CI_BRANCH" = "typeclasses-functional-evar_map" ]; then
- plugin_tutorial_CI_REF=pr8671-fix
- plugin_tutorial_CI_GITURL=https://github.com/mattam82/plugin_tutorials
-
-fi
diff --git a/dev/ci/user-overlays/08684-maximedenes-cleanup-kernel-entries.sh b/dev/ci/user-overlays/08684-maximedenes-cleanup-kernel-entries.sh
deleted file mode 100644
index 98530c825a..0000000000
--- a/dev/ci/user-overlays/08684-maximedenes-cleanup-kernel-entries.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-if [ "$CI_PULL_REQUEST" = "8684" ] || [ "$CI_BRANCH" = "kernel-entries-cleanup" ]; then
-
- Elpi_CI_REF=kernel-entries-cleanup
- Elpi_CI_GITURL=https://github.com/maximedenes/coq-elpi
-
- Equations_CI_REF=kernel-entries-cleanup
- Equations_CI_GITURL=https://github.com/maximedenes/Coq-Equations
-
-fi
diff --git a/dev/ci/user-overlays/08688-herbelin-master+generalizing-evar-map-printer-over-env.sh b/dev/ci/user-overlays/08688-herbelin-master+generalizing-evar-map-printer-over-env.sh
deleted file mode 100644
index 81ed91f52b..0000000000
--- a/dev/ci/user-overlays/08688-herbelin-master+generalizing-evar-map-printer-over-env.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-if [ "$CI_PULL_REQUEST" = "8688" ] || [ "$CI_BRANCH" = "master+generalizing-evar-map-printer-over-env" ]; then
-
- Elpi_CI_REF=master+generalized-evar-printers-pr8688
- Elpi_CI_GITURL=https://github.com/herbelin/coq-elpi
-
-fi
diff --git a/dev/ci/user-overlays/08704-ejgallego-vernac+monify_hook.sh b/dev/ci/user-overlays/08704-ejgallego-vernac+monify_hook.sh
deleted file mode 100644
index b3a9f67e00..0000000000
--- a/dev/ci/user-overlays/08704-ejgallego-vernac+monify_hook.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-if [ "$CI_PULL_REQUEST" = "8704" ] || [ "$CI_BRANCH" = "vernac+monify_hook" ]; then
-
- # ltac2_CI_REF=rm-section-path
- # ltac2_CI_GITURL=https://github.com/maximedenes/ltac2
-
- plugin_tutorial_CI_REF=vernac+monify_hook
- plugin_tutorial_CI_GITURL=https://github.com/ejgallego/plugin_tutorials
-
- Elpi_CI_REF=vernac+monify_hook
- Elpi_CI_GITURL=https://github.com/ejgallego/coq-elpi
-
- Equations_CI_REF=vernac+monify_hook
- Equations_CI_GITURL=https://github.com/ejgallego/Coq-Equations
-
-fi
diff --git a/dev/ci/user-overlays/08844-split-tactics.sh b/dev/ci/user-overlays/08844-split-tactics.sh
deleted file mode 100644
index 8ad8cba243..0000000000
--- a/dev/ci/user-overlays/08844-split-tactics.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-
-if [ "$CI_PULL_REQUEST" = "8844" ] || [ "$CI_BRANCH" = "split-tactics" ]; then
- Equations_CI_REF=split-tactics
- Equations_CI_GITURL=https://github.com/SkySkimmer/Coq-Equations
-
- ltac2_CI_REF=split-tactics
- ltac2_CI_GITURL=https://github.com/SkySkimmer/ltac2
-
- fiat_parsers_CI_REF=split-tactics
- fiat_parsers_CI_GITURL=https://github.com/SkySkimmer/fiat
-fi
diff --git a/dev/ci/user-overlays/08902-ejgallego-ltac+use_atts_in_ast.sh b/dev/ci/user-overlays/08902-ejgallego-ltac+use_atts_in_ast.sh
new file mode 100644
index 0000000000..08112d3054
--- /dev/null
+++ b/dev/ci/user-overlays/08902-ejgallego-ltac+use_atts_in_ast.sh
@@ -0,0 +1,15 @@
+if [ "$CI_PULL_REQUEST" = "8902" ] || [ "$CI_BRANCH" = "ltac+use_atts_in_ast" ]; then
+
+ aactactics_CI_REF=ltac+use_atts_in_ast
+ aactactics_CI_GITURL=https://github.com/ejgallego/aac-tactics
+
+ coqhammer_CI_REF=ltac+use_atts_in_ast
+ coqhammer_CI_GITURL=https://github.com/ejgallego/coqhammer
+
+ Equations_CI_REF=ltac+use_atts_in_ast
+ Equations_CI_GITURL=https://github.com/ejgallego/Coq-Equations
+
+ mtac2_CI_REF=ltac+use_atts_in_ast
+ mtac2_CI_GITURL=https://github.com/ejgallego/Coq-Equations
+
+fi
diff --git a/dev/ci/user-overlays/08914-ejgallego-lib+better_boot_coqproject.sh b/dev/ci/user-overlays/08914-ejgallego-lib+better_boot_coqproject.sh
new file mode 100644
index 0000000000..1c5157ba12
--- /dev/null
+++ b/dev/ci/user-overlays/08914-ejgallego-lib+better_boot_coqproject.sh
@@ -0,0 +1,6 @@
+if [ "$CI_PULL_REQUEST" = "8914" ] || [ "$CI_BRANCH" = "lib+better_boot_coqproject" ]; then
+
+ quickchick_CI_REF=lib+better_boot_coqproject
+ quickchick_CI_GITURL=https://github.com/ejgallego/QuickChick
+
+fi
diff --git a/dev/ci/user-overlays/08933-solve-remaining-evars-initial-arg.sh b/dev/ci/user-overlays/08933-solve-remaining-evars-initial-arg.sh
new file mode 100644
index 0000000000..e74e53fa40
--- /dev/null
+++ b/dev/ci/user-overlays/08933-solve-remaining-evars-initial-arg.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+if [ "$CI_PULL_REQUEST" = "8933" ] || [ "$CI_BRANCH" = "solve-remaining-evars-initial-arg" ]; then
+ plugin_tutorial_CI_REF=solve-remaining-evars-initial-arg
+ plugin_tutorial_CI_GITURL=https://github.com/SkySkimmer/plugin_tutorials
+fi
diff --git a/dev/ci/user-overlays/08985-ejgallego-build+pack_gramlib.sh b/dev/ci/user-overlays/08985-ejgallego-build+pack_gramlib.sh
new file mode 100644
index 0000000000..d7130cc67a
--- /dev/null
+++ b/dev/ci/user-overlays/08985-ejgallego-build+pack_gramlib.sh
@@ -0,0 +1,6 @@
+if [ "$CI_PULL_REQUEST" = "8985" ] || [ "$CI_BRANCH" = "build+pack_gramlib" ]; then
+
+ elpi_CI_REF=use_coq_gramlib
+ elpi_CI_GITURL=https://github.com/ejgallego/coq-elpi
+
+fi
diff --git a/dev/ci/user-overlays/08998-ejgallego-legacy_proof_eng_clean.sh b/dev/ci/user-overlays/08998-ejgallego-legacy_proof_eng_clean.sh
new file mode 100644
index 0000000000..c8bea0c868
--- /dev/null
+++ b/dev/ci/user-overlays/08998-ejgallego-legacy_proof_eng_clean.sh
@@ -0,0 +1,6 @@
+if [ "$CI_PULL_REQUEST" = "8998" ] || [ "$CI_BRANCH" = "legacy_proof_eng_clean" ]; then
+
+ equations_CI_REF=legacy_proof_eng_clean
+ equations_CI_GITURL=https://github.com/ejgallego/Coq-Equations
+
+fi
diff --git a/dev/ci/user-overlays/09003-ejgallego-vernac+move_extend_ast.sh b/dev/ci/user-overlays/09003-ejgallego-vernac+move_extend_ast.sh
new file mode 100644
index 0000000000..61ffa4a197
--- /dev/null
+++ b/dev/ci/user-overlays/09003-ejgallego-vernac+move_extend_ast.sh
@@ -0,0 +1,6 @@
+if [ "$CI_PULL_REQUEST" = "9003" ] || [ "$CI_BRANCH" = "vernac+move_extend_ast" ]; then
+
+ ltac2_CI_REF=vernac+move_extend_ast
+ ltac2_CI_GITURL=https://github.com/ejgallego/ltac2
+
+fi
diff --git a/dev/ci/user-overlays/09051-ppedrot-camlp5-safe-api-strikes-back.sh b/dev/ci/user-overlays/09051-ppedrot-camlp5-safe-api-strikes-back.sh
new file mode 100644
index 0000000000..14e7c0d7f0
--- /dev/null
+++ b/dev/ci/user-overlays/09051-ppedrot-camlp5-safe-api-strikes-back.sh
@@ -0,0 +1,9 @@
+if [ "$CI_PULL_REQUEST" = "9051" ] || [ "$CI_BRANCH" = "camlp5-safe-api-strikes-back" ]; then
+
+ equations_CI_REF=camlp5-safe-api-strikes-back
+ equations_CI_GITURL=https://github.com/ppedrot/Coq-Equations
+
+ ltac2_CI_REF=camlp5-safe-api-strikes-back
+ ltac2_CI_GITURL=https://github.com/ppedrot/ltac2
+
+fi
diff --git a/dev/ci/user-overlays/jasongross-numeral-notation-4.sh b/dev/ci/user-overlays/jasongross-numeral-notation-4.sh
deleted file mode 100644
index 76aa37d380..0000000000
--- a/dev/ci/user-overlays/jasongross-numeral-notation-4.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-if [ "$CI_PULL_REQUEST" = "8064" ] || [ "$CI_BRANCH" = "numeral-notation-4" ]; then
- HoTT_CI_REF=fix-for-numeral-notations
- HoTT_CI_GITURL=https://github.com/JasonGross/HoTT
- HoTT_CI_ARCHIVEURL=${HoTT_CI_GITURL}/archive
-fi
diff --git a/dev/doc/README.md b/dev/doc/README.md
index 223cf6286e..c764455aed 100644
--- a/dev/doc/README.md
+++ b/dev/doc/README.md
@@ -16,7 +16,6 @@ $ opam init --comp <latest-ocaml-version>
~/.bashrc and ~/.ocamlinit files.
$ source ~/.bashrc
-$ opam install camlp5
# needed if you want to build "coqide" target
diff --git a/dev/doc/build-system.dune.md b/dev/doc/build-system.dune.md
index c5ea88aaf6..3609171b82 100644
--- a/dev/doc/build-system.dune.md
+++ b/dev/doc/build-system.dune.md
@@ -10,7 +10,8 @@ Coq can now be built using [Dune](https://github.com/ocaml/dune).
## Quick Start
-You need Dune >= 1.2.1 ; just type `dune build` to build the base Coq
+Dune >= 1.5.0 is recommended, see `dune-project` for the minimum
+required version; type `dune build` to build the base Coq
libraries. No call to `./configure` is needed.
Dune will get confused if it finds leftovers of in-tree compilation,
@@ -49,14 +50,25 @@ The default dune target is `dune build` (or `dune build @install`),
which will scan all sources in the Coq tree and then build the whole
project, creating an "install" overlay in `_build/install/default`.
-You can build some other target by doing `dune build $TARGET`.
+You can build some other target by doing `dune build $TARGET`, where
+`$TARGET` can be a `.cmxa`, a binary, a file that Dune considers a
+target, an alias, etc...
In order to build a single package, you can do `dune build
$PACKAGE.install`.
+A very useful target is `dune build @check`, that will compile all the
+ml files in quick mode.
+
Dune also provides targets for documentation, testing, and release
builds, please see below.
+## Documentation and test targets
+
+Coq's test-suite can be run with `dune runtest`.
+
+The documentation target is not implemented in Dune yet.
+
## Developer shell
You can create a developer shell with `dune utop $library`, where
@@ -139,11 +151,6 @@ Note that due to https://github.com/ocaml/dune/issues/1401 , we must
perform a full rebuild each time as otherwise Dune will remove the
files. We hope to solve this in the future.
-## Documentation and test targets
-
-The documentation and test suite targets for Coq are still not
-implemented in Dune.
-
## Planned and Advanced features
Dune supports or will support extra functionality that may result very
diff --git a/dev/doc/changes.md b/dev/doc/changes.md
index b1fdfafd3a..acb0d80c18 100644
--- a/dev/doc/changes.md
+++ b/dev/doc/changes.md
@@ -1,5 +1,15 @@
## Changes between Coq 8.9 and Coq 8.10
+### ML4 Pre Processing
+
+- Support for `.ml4` files, processed by camlp5 has been removed in
+ favor of `.mlg` files processed by `coqpp`.
+
+ Porting is usually straightforward, and involves renaming the
+ `file.ml4` file to `file.mlg` and adding a few brackets.
+
+ See "Transitioning away from Camlp5" below for update instructions.
+
### ML API
General deprecation
@@ -19,6 +29,10 @@ Names
Constant.make3 has been removed, use Constant.make2
Constant.repr3 has been removed, use Constant.repr2
+- `Names.transparent_state` has been moved to its own module `TransparentState`.
+ This module gathers utility functions that used to be defined in several
+ places.
+
Coqlib:
- Most functions from the `Coqlib` module have been deprecated in favor of
diff --git a/dev/doc/coq-src-description.txt b/dev/doc/coq-src-description.txt
index 764d482957..e5e4f740bd 100644
--- a/dev/doc/coq-src-description.txt
+++ b/dev/doc/coq-src-description.txt
@@ -94,7 +94,7 @@ Tacexpr.glob_tactic_expr
|
| Tacinterp.eval_tactic (?)
V
-Proof_type.tactic
+Proofview.V82.tac
TODO: check with Hugo
diff --git a/dev/dune b/dev/dune
index bfa2d525c9..792da6254a 100644
--- a/dev/dune
+++ b/dev/dune
@@ -4,12 +4,13 @@
(synopsis "Coq's Debug Printers")
(wrapped false)
(modules :standard)
+ (optional)
(libraries coq.toplevel coq.plugins.ltac))
(rule
(targets dune-dbg)
(deps dune-dbg.in
- ../checker/main.bc
+ ../checker/coqchk.bc
../topbin/coqtop_byte_bin.bc
; This is not enough as the call to `ocamlfind` will fail :/
top_printers.cma)
diff --git a/dev/dune-dbg.in b/dev/dune-dbg.in
index 3f3df23fe1..80ad0500e0 100755
--- a/dev/dune-dbg.in
+++ b/dev/dune-dbg.in
@@ -3,7 +3,7 @@
# Run in a proper install dune env.
case $1 in
checker)
- exe=_build/default/checker/main.bc
+ exe=_build/default/checker/coqchk.bc
;;
*)
exe=_build/default/topbin/coqtop_byte_bin.bc
diff --git a/dev/ocamldebug-coq.run b/dev/ocamldebug-coq.run
index d330f517be..c1dcabb743 100644
--- a/dev/ocamldebug-coq.run
+++ b/dev/ocamldebug-coq.run
@@ -8,16 +8,16 @@
# here are some reasonable default values
[ -z "$OCAMLDEBUG" ] && OCAMLDEBUG=ocamldebug
-[ -z "$CAMLP5LIB" ] && CAMLP5LIB=+camlp5
[ -z "$COQTOP" -a -d "$PWD/kernel" ] && COQTOP=$PWD
[ -z "$COQTOP" -a -d "$PWD/../kernel" ] && COQTOP=`dirname $PWD`
export CAML_LD_LIBRARY_PATH=$COQTOP/kernel/byterun:$CAML_LD_LIBRARY_PATH
exec $OCAMLDEBUG \
- -I $CAMLP5LIB -I +threads \
+ -I +threads \
-I $COQTOP \
-I $COQTOP/config -I $COQTOP/printing -I $COQTOP/grammar -I $COQTOP/clib \
+ -I $COQTOP/gramlib__pack \
-I $COQTOP/lib -I $COQTOP/kernel -I $COQTOP/kernel/byterun \
-I $COQTOP/library -I $COQTOP/engine \
-I $COQTOP/pretyping -I $COQTOP/parsing -I $COQTOP/vernac \
diff --git a/dev/tools/create_overlays.sh b/dev/tools/create_overlays.sh
new file mode 100755
index 0000000000..41392be5d7
--- /dev/null
+++ b/dev/tools/create_overlays.sh
@@ -0,0 +1,78 @@
+#!/usr/bin/env bash
+
+# TODO:
+#
+# - Check if the branch already exists in the remote => checkout
+# - Better error handling
+# - Just checkout, don't build
+# - Rebase functionality
+#
+
+set -x
+set -e
+set -o pipefail
+
+# setup_contrib_git("_build_ci/fiat", "https://github.com/ejgallego/fiat-core.git")
+setup_contrib_git() {
+
+ local _DIR=$1
+ local _GITURL=$2
+
+ ( cd $_DIR
+ git checkout -b $OVERLAY_BRANCH || true # allow the branch to exist already
+ git remote add $DEVELOPER_NAME $_GITURL || true # allow the remote to exist already
+ )
+
+}
+
+if [ $# -lt 3 ]; then
+ echo "usage: $0 github_username pr_number contrib1 ... contribN"
+ exit 1
+fi
+
+set +x
+. dev/ci/ci-basic-overlay.sh
+set -x
+
+DEVELOPER_NAME=$1
+shift
+PR_NUMBER=$1
+shift
+OVERLAY_BRANCH=$(git rev-parse --abbrev-ref HEAD)
+OVERLAY_FILE=$(mktemp overlay-XXXX)
+
+# Create the overlay file
+printf 'if [ "$CI_PULL_REQUEST" = "%s" ] || [ "$CI_BRANCH" = "%s" ]; then \n\n' "$PR_NUMBER" "$OVERLAY_BRANCH" > "$OVERLAY_FILE"
+
+# We first try to build the contribs
+while test $# -gt 0
+do
+ _CONTRIB_NAME=$1
+ _CONTRIB_GITURL=${_CONTRIB_NAME}_CI_GITURL
+ _CONTRIB_GITURL=${!_CONTRIB_GITURL}
+ echo "Processing Contrib $_CONTRIB_NAME"
+
+ # check _CONTRIB_GIT exists and it is of the from github...
+
+ _CONTRIB_DIR=_build_ci/$_CONTRIB_NAME
+
+ # extract the relevant part of the repository
+ _CONTRIB_GITSUFFIX=${_CONTRIB_GITURL#https://github.com/*/}
+ _CONTRIB_GITURL="https://github.com/$DEVELOPER_NAME/$_CONTRIB_GITSUFFIX"
+ _CONTRIB_GITPUSHURL="git@github.com:$DEVELOPER_NAME/${_CONTRIB_GITSUFFIX}.git"
+
+ # This should work better: for example we should be able not to
+ # build but just to checkout.
+ make ci-$_CONTRIB_NAME || true
+ setup_contrib_git $_CONTRIB_DIR $_CONTRIB_GITPUSHURL
+
+ echo " ${_CONTRIB_NAME}_CI_REF=$OVERLAY_BRANCH" >> $OVERLAY_FILE
+ echo " ${_CONTRIB_NAME}_CI_GITURL=$_CONTRIB_GITURL" >> $OVERLAY_FILE
+ echo "" >> $OVERLAY_FILE
+ shift
+done
+
+# End the file; copy to overlays folder.
+echo "fi" >> $OVERLAY_FILE
+PR_NUMBER=$(printf '%05d' "$PR_NUMBER")
+mv $OVERLAY_FILE dev/ci/user-overlays/$PR_NUMBER-$DEVELOPER_NAME-${OVERLAY_BRANCH///}.sh
diff --git a/dev/tools/merge-pr.sh b/dev/tools/merge-pr.sh
index 320ef6ed07..5fd8a3b7d9 100755
--- a/dev/tools/merge-pr.sh
+++ b/dev/tools/merge-pr.sh
@@ -202,9 +202,8 @@ info "merging"
git merge -v -S --no-ff FETCH_HEAD -m "Merge PR #$PR: $TITLE" -e
# TODO: improve this check
-if ! git diff --quiet "$REMOTE/$CURRENT_LOCAL_BRANCH" -- dev/ci/user-overlays; then
- warning "this PR may have overlays (sorry the check is not perfect)"
- warning "if it has overlays please check the following:"
+if ! git diff --quiet --diff-filter=A "$REMOTE/$CURRENT_LOCAL_BRANCH" -- dev/ci/user-overlays; then
+ warning "this PR has overlays, please check the following:"
warning "- each overlay has a corresponding open PR on the upstream repo"
warning "- after merging please notify the upstream they can merge the PR"
fi
diff --git a/dev/top_printers.ml b/dev/top_printers.ml
index f94e9acb72..4287702b3a 100644
--- a/dev/top_printers.ml
+++ b/dev/top_printers.ml
@@ -514,18 +514,18 @@ let _ =
let ty_constr = Extend.TUentry (get_arg_tag Stdarg.wit_constr) in
let cmd_sig = TyTerminal("PrintConstr", TyNonTerminal(ty_constr, TyNil)) in
let cmd_fn c ~atts ~st = in_current_context econstr_display c; st in
- let cmd_class _ = Vernacexpr.(VtQuery,VtNow) in
+ let cmd_class _ = VtQuery,VtNow in
let cmd : ty_ml = TyML (false, cmd_sig, cmd_fn, Some cmd_class) in
- Vernacextend.vernac_extend ~command:"PrintConstr" [cmd]
+ vernac_extend ~command:"PrintConstr" [cmd]
let _ =
let open Vernacextend in
let ty_constr = Extend.TUentry (get_arg_tag Stdarg.wit_constr) in
let cmd_sig = TyTerminal("PrintPureConstr", TyNonTerminal(ty_constr, TyNil)) in
let cmd_fn c ~atts ~st = in_current_context print_pure_econstr c; st in
- let cmd_class _ = Vernacexpr.(VtQuery,VtNow) in
+ let cmd_class _ = VtQuery,VtNow in
let cmd : ty_ml = TyML (false, cmd_sig, cmd_fn, Some cmd_class) in
- Vernacextend.vernac_extend ~command:"PrintPureConstr" [cmd]
+ vernac_extend ~command:"PrintPureConstr" [cmd]
(* Setting printer of unbound global reference *)
open Names
diff --git a/dev/top_printers.mli b/dev/top_printers.mli
index 63d7d58053..5eac3e2b9c 100644
--- a/dev/top_printers.mli
+++ b/dev/top_printers.mli
@@ -101,7 +101,7 @@ 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_transparent_state : TransparentState.t -> unit
val pp_stack_t : Constr.t Reductionops.Stack.t -> unit
val pp_cst_stack_t : Reductionops.Cst_stack.t -> unit
@@ -120,9 +120,9 @@ val ppclenv : Clenv.clausenv -> unit
val ppgoalgoal : Goal.goal -> unit
-val ppgoal : Proof_type.goal Evd.sigma -> unit
+val ppgoal : Goal.goal Evd.sigma -> unit
(* also print evar map *)
-val ppgoalsigma : Proof_type.goal Evd.sigma -> unit
+val ppgoalsigma : Goal.goal Evd.sigma -> unit
val pphintdb : Hints.Hint_db.t -> unit
val ppproofview : Proofview.proofview -> unit
diff --git a/doc/sphinx/addendum/extraction.rst b/doc/sphinx/addendum/extraction.rst
index 3d58f522dd..f523a39477 100644
--- a/doc/sphinx/addendum/extraction.rst
+++ b/doc/sphinx/addendum/extraction.rst
@@ -99,12 +99,12 @@ Extraction Options
Setting the target language
~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The ability to fix target language is the first and more important
-of the extraction options. Default is ``OCaml``.
+.. cmd:: Extraction Language ( OCaml | Haskell | Scheme )
+ :name: Extraction Language
+
+ The ability to fix target language is the first and more important
+ of the extraction options. Default is ``OCaml``.
-.. cmd:: Extraction Language OCaml
-.. cmd:: Extraction Language Haskell
-.. cmd:: Extraction Language Scheme
Inlining and optimizations
~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -283,6 +283,7 @@ arity, that is a sequence of product finished by a sort), then some type
variables have to be given (as quoted strings). The syntax is then:
.. cmdv:: Extract Constant @qualid @string ... @string => @string
+ :undocumented:
The number of type variables is checked by the system. For example:
diff --git a/doc/sphinx/addendum/generalized-rewriting.rst b/doc/sphinx/addendum/generalized-rewriting.rst
index 403b163196..e468cc63cd 100644
--- a/doc/sphinx/addendum/generalized-rewriting.rst
+++ b/doc/sphinx/addendum/generalized-rewriting.rst
@@ -530,19 +530,11 @@ Notice, however, that using the prefixed tactics it is possible to
pass additional arguments such as ``using relation``.
.. tacv:: setoid_reflexivity
- :name: setoid_reflexivity
-
-.. tacv:: setoid_symmetry {? in @ident}
- :name: setoid_symmetry
-
-.. tacv:: setoid_transitivity
- :name: setoid_transitivity
-
-.. tacv:: setoid_rewrite {? @orientation} @term {? at @occs} {? in @ident}
- :name: setoid_rewrite
-
-.. tacv:: setoid_replace @term with @term {? using relation @term} {? in @ident} {? by @tactic}
- :name: setoid_replace
+ setoid_symmetry {? in @ident}
+ setoid_transitivity
+ setoid_rewrite {? @orientation} @term {? at @occs} {? in @ident}
+ setoid_replace @term with @term {? using relation @term} {? in @ident} {? by @tactic}
+ :name: setoid_reflexivity; setoid_symmetry; setoid_transitivity; setoid_rewrite; setoid_replace
The ``using relation`` arguments cannot be passed to the unprefixed form.
The latter argument tells the tactic what parametric relation should
diff --git a/doc/sphinx/addendum/implicit-coercions.rst b/doc/sphinx/addendum/implicit-coercions.rst
index fc5a366caf..c8fb4bd00e 100644
--- a/doc/sphinx/addendum/implicit-coercions.rst
+++ b/doc/sphinx/addendum/implicit-coercions.rst
@@ -128,13 +128,28 @@ Declaring Coercions
the two given classes.
.. exn:: @qualid not declared.
+ :undocumented:
+
.. exn:: @qualid is already a coercion.
+ :undocumented:
+
.. exn:: Funclass cannot be a source class.
+ :undocumented:
+
.. exn:: @qualid is not a function.
+ :undocumented:
+
.. exn:: Cannot find the source class of @qualid.
+ :undocumented:
+
.. exn:: Cannot recognize @class as a source class of @qualid.
+ :undocumented:
+
.. exn:: @qualid does not respect the uniform inheritance condition.
+ :undocumented:
+
.. exn:: Found target class ... instead of ...
+ :undocumented:
.. warn:: Ambiguous path.
@@ -202,34 +217,34 @@ declaration, this constructor is declared as a coercion.
.. cmd:: Identity Coercion @ident : @class >-> @class
- If ``C`` is the source `class` and ``D`` the destination, we check
- that ``C`` is a constant with a body of the form
- :g:`fun (x₁:T₁)..(xₙ:Tₙ) => D t₁..tₘ` where `m` is the
- number of parameters of ``D``. Then we define an identity
- function with type :g:`forall (x₁:T₁)..(xₙ:Tₙ)(y:C x₁..xₙ),D t₁..tₘ`,
- and we declare it as an identity coercion between ``C`` and ``D``.
-
- .. exn:: @class must be a transparent constant.
+ If ``C`` is the source `class` and ``D`` the destination, we check
+ that ``C`` is a constant with a body of the form
+ :g:`fun (x₁:T₁)..(xₙ:Tₙ) => D t₁..tₘ` where `m` is the
+ number of parameters of ``D``. Then we define an identity
+ function with type :g:`forall (x₁:T₁)..(xₙ:Tₙ)(y:C x₁..xₙ),D t₁..tₘ`,
+ and we declare it as an identity coercion between ``C`` and ``D``.
- .. cmdv:: Local Identity Coercion @ident : @ident >-> @ident
+ .. exn:: @class must be a transparent constant.
+ :undocumented:
- Same as ``Identity Coercion`` but locally to the current section.
+ .. cmdv:: Local Identity Coercion @ident : @ident >-> @ident
- .. cmdv:: SubClass @ident := @type
- :name: SubClass
+ Same as :cmd:`Identity Coercion` but locally to the current section.
- If `type` is a class `ident'` applied to some arguments then
- `ident` is defined and an identity coercion of name
- `Id_ident_ident'` is
- declared. Otherwise said, this is an abbreviation for
+ .. cmdv:: SubClass @ident := @type
+ :name: SubClass
- ``Definition`` `ident` ``:=`` `type`.
+ If :n:`@type` is a class :n:`@ident'` applied to some arguments then
+ :n:`@ident` is defined and an identity coercion of name
+ :n:`Id_@ident_@ident'` is
+ declared. Otherwise said, this is an abbreviation for
- ``Identity Coercion`` `Id_ident_ident'` : `ident` ``>->`` `ident'`.
+ :n:`Definition @ident := @type.`
+ :n:`Identity Coercion Id_@ident_@ident' : @ident >-> @ident'`.
- .. cmdv:: Local SubClass @ident := @type
+ .. cmdv:: Local SubClass @ident := @type
- Same as before but locally to the current section.
+ Same as before but locally to the current section.
Displaying Available Coercions
@@ -237,19 +252,19 @@ Displaying Available Coercions
.. cmd:: Print Classes
- Print the list of declared classes in the current context.
+ Print the list of declared classes in the current context.
.. cmd:: Print Coercions
- Print the list of declared coercions in the current context.
+ Print the list of declared coercions in the current context.
.. cmd:: Print Graph
- Print the list of valid coercion paths in the current context.
+ Print the list of valid coercion paths in the current context.
.. cmd:: Print Coercion Paths @class @class
- Print the list of valid coercion paths between the two given classes.
+ Print the list of valid coercion paths between the two given classes.
Activating the Printing of Coercions
-------------------------------------
@@ -322,9 +337,9 @@ Coercions and Modules
.. warn:: Coercion used but not in scope: @qualid. If you want to use this coercion, please Import the module that contains it.
- This warning is emitted when typechecking relies on a coercion
- contained in a module that has not been explicitely imported. It helps
- migrating code and stop relying on the option above.
+ This warning is emitted when typechecking relies on a coercion
+ contained in a module that has not been explicitely imported. It helps
+ migrating code and stop relying on the option above.
Examples
--------
diff --git a/doc/sphinx/addendum/micromega.rst b/doc/sphinx/addendum/micromega.rst
index c0a57763b9..5d219ebd0d 100644
--- a/doc/sphinx/addendum/micromega.rst
+++ b/doc/sphinx/addendum/micromega.rst
@@ -35,7 +35,7 @@ rationals ``Require Import Lqa`` and reals ``Require Import Lra``.
The tactics solve propositional formulas parameterized by atomic
-arithmetic expressions interpreted over a domain :math:`D` ∈ {ℤ, ℚ, ℝ}.
+arithmetic expressions interpreted over a domain :math:`D \in \{\mathbb{Z},\mathbb{Q},\mathbb{R}\}`.
The syntax of the formulas is the following:
.. productionlist:: `F`
@@ -46,8 +46,8 @@ The syntax of the formulas is the following:
where :math:`c` is a numeric constant, :math:`x \in D` is a numeric variable, the
operators :math:`−, +, ×` are respectively subtraction, addition, and product;
:math:`p ^ n` is exponentiation by a constant :math:`n`, :math:`P` is an arbitrary proposition.
-For :math:`\mathbb{Q}`, equality is not Leibniz equality = but the equality of
-rationals ==.
+For :math:`\mathbb{Q}`, equality is not Leibniz equality ``=`` but the equality of
+rationals ``==``.
For :math:`\mathbb{Z}` (resp. :math:`\mathbb{Q}`), :math:`c` ranges over integer constants (resp. rational
constants). For :math:`\mathbb{R}`, the tactic recognizes as real constants the
@@ -58,7 +58,7 @@ following expressions:
c ::= R0 | R1 | Rmul(c,c) | Rplus(c,c) | Rminus(c,c) | IZR z | IQR q | Rdiv(c,c) | Rinv c
where :math:`z` is a constant in :math:`\mathbb{Z}` and :math:`q` is a constant in :math:`\mathbb{Q}`.
-This includes integer constants written using the decimal notation, *i.e.*, c%R.
+This includes integer constants written using the decimal notation, *i.e.*, ``c%R``.
*Positivstellensatz* refutations
@@ -94,7 +94,7 @@ general form :math:`(\bigwedge_{j\in S_i} p_j \Join 0) \to \mathit{False}` and
For each conjunct :math:`C_i`, the tactic calls an oracle which searches for
:math:`-1` within the cone. Upon success, the oracle returns a *cone
-expression* that is normalized by the ring tactic (see :ref:`theringandfieldtacticfamilies`)
+expression* that is normalized by the :tacn:`ring` tactic (see :ref:`theringandfieldtacticfamilies`)
and checked to be :math:`-1`.
`lra`: a decision procedure for linear real and rational arithmetic
@@ -245,11 +245,11 @@ proof by abstracting monomials by variables.
As shown, such a goal is solved by ``intro x. psatz Z 2.``. The oracle returns the
cone expression :math:`2 \times (x-1) + (\mathbf{x-1}) \times (\mathbf{x−1}) + -x^2`
(polynomial hypotheses are printed in bold). By construction, this expression
-belongs to :math:`\mathit{Cone}({−x^2,x -1})`. Moreover, by running `ring` we
+belongs to :math:`\mathit{Cone}({−x^2,x -1})`. Moreover, by running :tacn:`ring` we
obtain :math:`-1`. By Theorem :ref:`Psatz <psatz_thm>`, the goal is valid.
.. [#] Support for `nat` and :math:`\mathbb{N}` is obtained by pre-processing the goal with
- the `zify` tactic.
+ the ``zify`` tactic.
.. [#] Sources and binaries can be found at https://projects.coin-or.org/Csdp
.. [#] Variants deal with equalities and strict inequalities.
.. [#] In practice, the oracle might fail to produce such a refutation.
diff --git a/doc/sphinx/addendum/miscellaneous-extensions.rst b/doc/sphinx/addendum/miscellaneous-extensions.rst
index 2cde65dcdc..db8c09d88f 100644
--- a/doc/sphinx/addendum/miscellaneous-extensions.rst
+++ b/doc/sphinx/addendum/miscellaneous-extensions.rst
@@ -12,22 +12,22 @@ of program refinements. To use the Derive extension it must first be
required with ``Require Coq.derive.Derive``. When the extension is loaded,
it provides the following command:
-.. cmd:: Derive @ident SuchThat @term As @ident
-
-The first `ident` can appear in `term`. This command opens a new proof
-presenting the user with a goal for term in which the name `ident` is
-bound to an existential variable `?x` (formally, there are other goals
-standing for the existential variables but they are shelved, as
-described in :tacn:`shelve`).
-
-When the proof ends two constants are defined:
-
-+ The first one is named using the first `ident` and is defined as the proof of the
- shelved goal (which is also the value of `?x`). It is always
- transparent.
-+ The second one is named using the second `ident`. It has type `term`, and its body is
- the proof of the initially visible goal. It is opaque if the proof
- ends with ``Qed``, and transparent if the proof ends with ``Defined``.
+.. cmd:: Derive @ident__1 SuchThat @type As @ident__2
+
+ :n:`@ident__1` can appear in :n:`@type`. This command opens a new proof
+ presenting the user with a goal for :n:`@type` in which the name :n:`@ident__1` is
+ bound to an existential variable :g:`?x` (formally, there are other goals
+ standing for the existential variables but they are shelved, as
+ described in :tacn:`shelve`).
+
+ When the proof ends two constants are defined:
+
+ + The first one is named :n:`@ident__1` and is defined as the proof of the
+ shelved goal (which is also the value of :g:`?x`). It is always
+ transparent.
+ + The second one is named :n:`@ident__2`. It has type :n:`@type`, and its body is
+ the proof of the initially visible goal. It is opaque if the proof
+ ends with :cmd:`Qed`, and transparent if the proof ends with :cmd:`Defined`.
.. example::
diff --git a/doc/sphinx/addendum/omega.rst b/doc/sphinx/addendum/omega.rst
index 03d4f148e3..b008508bbc 100644
--- a/doc/sphinx/addendum/omega.rst
+++ b/doc/sphinx/addendum/omega.rst
@@ -67,16 +67,22 @@ is generated:
:tacn:`intro` as many times as needed.
.. exn:: omega: Unrecognized predicate or connective: @ident.
+ :undocumented:
.. exn:: omega: Unrecognized atomic proposition: ...
+ :undocumented:
.. exn:: omega: Can't solve a goal with proposition variables.
+ :undocumented:
.. exn:: omega: Unrecognized proposition.
+ :undocumented:
.. exn:: omega: Can't solve a goal with non-linear products.
+ :undocumented:
.. exn:: omega: Can't solve a goal with equality on type ...
+ :undocumented:
Using ``omega``
diff --git a/doc/sphinx/addendum/program.rst b/doc/sphinx/addendum/program.rst
index fad45995d2..cc8870e2e4 100644
--- a/doc/sphinx/addendum/program.rst
+++ b/doc/sphinx/addendum/program.rst
@@ -150,6 +150,7 @@ Program Definition
.. exn:: @ident already exists.
:name: @ident already exists. (Program Definition)
+ :undocumented:
.. cmdv:: Program Definition @ident : @type := @term
@@ -162,7 +163,7 @@ Program Definition
and the aforementioned coercion derivation are solved.
.. exn:: In environment … the term: @term does not have type @type. Actually, it has type ...
-
+ :undocumented:
.. cmdv:: Program Definition @ident @binders : @type := @term
@@ -181,21 +182,21 @@ Program Fixpoint
.. cmd:: Program Fixpoint @ident @params {? {@order}} : @type := @term
-The optional order annotation follows the grammar:
+ The optional order annotation follows the grammar:
-.. productionlist:: orderannot
- order : measure `term` (`term`)? | wf `term` `term`
+ .. productionlist:: orderannot
+ order : measure `term` (`term`)? | wf `term` `term`
-+ :g:`measure f ( R )` where :g:`f` is a value of type :g:`X` computed on
- any subset of the arguments and the optional (parenthesised) term
- ``(R)`` is a relation on ``X``. By default ``X`` defaults to ``nat`` and ``R``
- to ``lt``.
+ + :g:`measure f ( R )` where :g:`f` is a value of type :g:`X` computed on
+ any subset of the arguments and the optional (parenthesised) term
+ ``(R)`` is a relation on ``X``. By default ``X`` defaults to ``nat`` and ``R``
+ to ``lt``.
-+ :g:`wf R x` which is equivalent to :g:`measure x (R)`.
+ + :g:`wf R x` which is equivalent to :g:`measure x (R)`.
-The structural fixpoint operator behaves just like the one of |Coq| (see
-:cmd:`Fixpoint`), except it may also generate obligations. It works
-with mutually recursive definitions too.
+ The structural fixpoint operator behaves just like the one of |Coq| (see
+ :cmd:`Fixpoint`), except it may also generate obligations. It works
+ with mutually recursive definitions too.
.. coqtop:: reset in
diff --git a/doc/sphinx/addendum/ring.rst b/doc/sphinx/addendum/ring.rst
index 58617916c0..5bab63f6d0 100644
--- a/doc/sphinx/addendum/ring.rst
+++ b/doc/sphinx/addendum/ring.rst
@@ -100,26 +100,26 @@ Concrete usage in Coq
.. tacn:: ring
-The ``ring`` tactic solves equations upon polynomial expressions of a ring
-(or semiring) structure. It proceeds by normalizing both sides
-of the equation (w.r.t. associativity, commutativity and
-distributivity, constant propagation, rewriting of monomials) and
-comparing syntactically the results.
+ This tactic solves equations upon polynomial expressions of a ring
+ (or semiring) structure. It proceeds by normalizing both sides
+ of the equation (w.r.t. associativity, commutativity and
+ distributivity, constant propagation, rewriting of monomials) and
+ comparing syntactically the results.
.. tacn:: ring_simplify
-``ring_simplify`` applies the normalization procedure described above to
-the given terms. The tactic then replaces all occurrences of the terms
-given in the conclusion of the goal by their normal forms. If no term
-is given, then the conclusion should be an equation and both
-sides are normalized. The tactic can also be applied in a hypothesis.
+ This tactic applies the normalization procedure described above to
+ the given terms. The tactic then replaces all occurrences of the terms
+ given in the conclusion of the goal by their normal forms. If no term
+ is given, then the conclusion should be an equation and both
+ sides are normalized. The tactic can also be applied in a hypothesis.
-The tactic must be loaded by ``Require Import Ring``. The ring structures
-must be declared with the ``Add Ring`` command (see below). The ring of
-booleans is predefined; if one wants to use the tactic on |nat| one must
-first require the module ``ArithRing`` exported by ``Arith``); for |Z|, do
-``Require Import ZArithRing`` or simply ``Require Import ZArith``; for |N|, do
-``Require Import NArithRing`` or ``Require Import NArith``.
+ The tactic must be loaded by ``Require Import Ring``. The ring structures
+ must be declared with the ``Add Ring`` command (see below). The ring of
+ booleans is predefined; if one wants to use the tactic on |nat| one must
+ first require the module ``ArithRing`` exported by ``Arith``); for |Z|, do
+ ``Require Import ZArithRing`` or simply ``Require Import ZArith``; for |N|, do
+ ``Require Import NArithRing`` or ``Require Import NArith``.
.. example::
@@ -141,25 +141,24 @@ first require the module ``ArithRing`` exported by ``Arith``); for |Z|, do
.. tacv:: ring [{* @term }]
-decides the equality of two terms modulo ring operations and
-the equalities defined by the :n:`@term`\ s.
-Each :n:`@term` has to be a proof of some equality `m = p`, where `m` is a monomial (after “abstraction”), `p` a polynomial and `=` the corresponding equality of the ring structure.
+ This tactic decides the equality of two terms modulo ring operations and
+ the equalities defined by the :token:`term`\ s.
+ Each :token:`term` has to be a proof of some equality :g:`m = p`, where :g:`m`
+ is a monomial (after “abstraction”), :g:`p` a polynomial and :g:`=` the
+ corresponding equality of the ring structure.
.. tacv:: ring_simplify [{* @term }] {* @term } in @ident
-performs the simplification in the hypothesis named :n:`@ident`.
+ This tactic performs the simplification in the hypothesis named :token:`ident`.
.. note::
- .. tacn:: ring_simplify @term1; ring_simplify @term2
+ :n:`ring_simplify @term__1; ring_simplify @term__2` is not equivalent to
+ :n:`ring_simplify @term__1 @term__2`.
- is not equivalent to
-
- .. tacn:: ring_simplify @term1 @term2
-
- In the latter case the variables map
- is shared between the two terms, and common subterm `t` of :n:`@term1` and :n:`@term2`
+ In the latter case the variables map is shared between the two terms, and
+ common subterm :g:`t` of :n:`@term__1` and :n:`@term__2`
will have the same associated variable number. So the first
alternative should be avoided for terms belonging to the same ring
theory.
@@ -174,17 +173,17 @@ Error messages:
.. exn:: Arguments of ring_simplify do not have all the same type.
- ``ring_simplify`` cannot simplify terms of several rings at the same
+ :tacn:`ring_simplify` cannot simplify terms of several rings at the same
time. Invoke the tactic once per ring structure.
.. exn:: Cannot find a declared ring structure over @term.
No ring has been declared for the type of the terms to be simplified.
- Use ``Add Ring`` first.
+ Use :cmd:`Add Ring` first.
.. exn:: Cannot find a declared ring structure for equality @term.
- Same as above in the case of the ``ring`` tactic.
+ Same as above in the case of the :tacn:`ring` tactic.
Adding a ring structure
@@ -302,93 +301,93 @@ The syntax for adding a new ring is
.. cmd:: Add Ring @ident : @term {? ( @ring_mod {* , @ring_mod } )}
-The :n:`@ident` is not relevant. It is used just for error messages. The
-:n:`@term` is a proof that the ring signature satisfies the (semi-)ring
-axioms. The optional list of modifiers is used to tailor the behavior
-of the tactic. The following list describes their syntax and effects:
-
-.. productionlist:: coq
- ring_mod : abstract | decidable `term` | morphism `term`
- : | setoid `term` `term`
- : | constants [`ltac`]
- : | preprocess [`ltac`]
- : | postprocess [`ltac`]
- : | power_tac `term` [`ltac`]
- : | sign `term`
- : | div `term`
-
-abstract
- declares the ring as abstract. This is the default.
-
-decidable :n:`@term`
- declares the ring as computational. The expression
- :n:`@term` is the correctness proof of an equality test ``?=!``
- (which hould be evaluable). Its type should be of the form
- ``forall x y, x ?=! y = true → x == y``.
-
-morphism :n:`@term`
- declares the ring as a customized one. The expression
- :n:`@term` is a proof that there exists a morphism between a set of
- coefficient and the ring carrier (see ``Ring_theory.ring_morph`` and
- ``Ring_theory.semi_morph``).
-
-setoid :n:`@term` :n:`@term`
- forces the use of given setoid. The first
- :n:`@term` is a proof that the equality is indeed a setoid (see
- ``Setoid.Setoid_Theory``), and the second :n:`@term` a proof that the
- ring operations are morphisms (see ``Ring_theory.ring_eq_ext`` and
- ``Ring_theory.sring_eq_ext``).
- This modifier needs not be used if the setoid and morphisms have been
- declared.
-
-constants [:n:`@ltac`]
- specifies a tactic expression :n:`@ltac` that, given a
- term, returns either an object of the coefficient set that is mapped
- to the expression via the morphism, or returns
- ``InitialRing.NotConstant``. The default behavior is to map only 0 and 1
- to their counterpart in the coefficient set. This is generally not
- desirable for non trivial computational rings.
-
-preprocess [:n:`@ltac`]
- specifies a tactic :n:`@ltac` that is applied as a
- preliminary step for ``ring`` and ``ring_simplify``. It can be used to
- transform a goal so that it is better recognized. For instance, ``S n``
- can be changed to ``plus 1 n``.
-
-postprocess [:n:`@ltac`]
- specifies a tactic :n:`@ltac` that is applied as a final
- step for ``ring_simplify``. For instance, it can be used to undo
- modifications of the preprocessor.
-
-power_tac :n:`@term` [:n:`@ltac`]
- allows ``ring`` and ``ring_simplify`` to recognize
- power expressions with a constant positive integer exponent (example:
- ::math:`x^2` ). The term :n:`@term` is a proof that a given power function satisfies
- the specification of a power function (term has to be a proof of
- ``Ring_theory.power_theory``) and :n:`@ltac` specifies a tactic expression
- that, given a term, “abstracts” it into an object of type |N| whose
- interpretation via ``Cp_phi`` (the evaluation function of power
- coefficient) is the original term, or returns ``InitialRing.NotConstant``
- if not a constant coefficient (i.e. |L_tac| is the inverse function of
- ``Cp_phi``). See files ``plugins/setoid_ring/ZArithRing.v``
- and ``plugins/setoid_ring/RealField.v`` for examples. By default the tactic
- does not recognize power expressions as ring expressions.
-
-sign :n:`@term`
- allows ``ring_simplify`` to use a minus operation when
- outputting its normal form, i.e writing ``x − y`` instead of ``x + (− y)``. The
- term `:n:`@term` is a proof that a given sign function indicates expressions
- that are signed (`term` has to be a proof of ``Ring_theory.get_sign``). See
- ``plugins/setoid_ring/InitialRing.v`` for examples of sign function.
-
-div :n:`@term`
- allows ``ring`` and ``ring_simplify`` to use monomials with
- coefficients other than 1 in the rewriting. The term :n:`@term` is a proof
- that a given division function satisfies the specification of an
- euclidean division function (:n:`@term` has to be a proof of
- ``Ring_theory.div_theory``). For example, this function is called when
- trying to rewrite :math:`7x` by :math:`2x = z` to tell that :math:`7 = 3 \times 2 + 1`. See
- ``plugins/setoid_ring/InitialRing.v`` for examples of div function.
+ The :token:`ident` is not relevant. It is used just for error messages. The
+ :token:`term` is a proof that the ring signature satisfies the (semi-)ring
+ axioms. The optional list of modifiers is used to tailor the behavior
+ of the tactic. The following list describes their syntax and effects:
+
+ .. productionlist:: coq
+ ring_mod : abstract | decidable `term` | morphism `term`
+ : | setoid `term` `term`
+ : | constants [`ltac`]
+ : | preprocess [`ltac`]
+ : | postprocess [`ltac`]
+ : | power_tac `term` [`ltac`]
+ : | sign `term`
+ : | div `term`
+
+ abstract
+ declares the ring as abstract. This is the default.
+
+ decidable :n:`@term`
+ declares the ring as computational. The expression
+ :n:`@term` is the correctness proof of an equality test ``?=!``
+ (which hould be evaluable). Its type should be of the form
+ ``forall x y, x ?=! y = true → x == y``.
+
+ morphism :n:`@term`
+ declares the ring as a customized one. The expression
+ :n:`@term` is a proof that there exists a morphism between a set of
+ coefficient and the ring carrier (see ``Ring_theory.ring_morph`` and
+ ``Ring_theory.semi_morph``).
+
+ setoid :n:`@term` :n:`@term`
+ forces the use of given setoid. The first
+ :n:`@term` is a proof that the equality is indeed a setoid (see
+ ``Setoid.Setoid_Theory``), and the second :n:`@term` a proof that the
+ ring operations are morphisms (see ``Ring_theory.ring_eq_ext`` and
+ ``Ring_theory.sring_eq_ext``).
+ This modifier needs not be used if the setoid and morphisms have been
+ declared.
+
+ constants [ :n:`@ltac` ]
+ specifies a tactic expression :n:`@ltac` that, given a
+ term, returns either an object of the coefficient set that is mapped
+ to the expression via the morphism, or returns
+ ``InitialRing.NotConstant``. The default behavior is to map only 0 and 1
+ to their counterpart in the coefficient set. This is generally not
+ desirable for non trivial computational rings.
+
+ preprocess [ :n:`@ltac` ]
+ specifies a tactic :n:`@ltac` that is applied as a
+ preliminary step for :tacn:`ring` and :tacn:`ring_simplify`. It can be used to
+ transform a goal so that it is better recognized. For instance, ``S n``
+ can be changed to ``plus 1 n``.
+
+ postprocess [ :n:`@ltac` ]
+ specifies a tactic :n:`@ltac` that is applied as a final
+ step for :tacn:`ring_simplify`. For instance, it can be used to undo
+ modifications of the preprocessor.
+
+ power_tac :n:`@term` [ :n:`@ltac` ]
+ allows :tacn:`ring` and :tacn:`ring_simplify` to recognize
+ power expressions with a constant positive integer exponent (example:
+ :math:`x^2` ). The term :n:`@term` is a proof that a given power function satisfies
+ the specification of a power function (term has to be a proof of
+ ``Ring_theory.power_theory``) and :n:`@ltac` specifies a tactic expression
+ that, given a term, “abstracts” it into an object of type |N| whose
+ interpretation via ``Cp_phi`` (the evaluation function of power
+ coefficient) is the original term, or returns ``InitialRing.NotConstant``
+ if not a constant coefficient (i.e. |L_tac| is the inverse function of
+ ``Cp_phi``). See files ``plugins/setoid_ring/ZArithRing.v``
+ and ``plugins/setoid_ring/RealField.v`` for examples. By default the tactic
+ does not recognize power expressions as ring expressions.
+
+ sign :n:`@term`
+ allows :tacn:`ring_simplify` to use a minus operation when
+ outputting its normal form, i.e writing ``x − y`` instead of ``x + (− y)``. The
+ term `:n:`@term` is a proof that a given sign function indicates expressions
+ that are signed (`term` has to be a proof of ``Ring_theory.get_sign``). See
+ ``plugins/setoid_ring/InitialRing.v`` for examples of sign function.
+
+ div :n:`@term`
+ allows :tacn:`ring` and :tacn:`ring_simplify` to use monomials with
+ coefficients other than 1 in the rewriting. The term :n:`@term` is a proof
+ that a given division function satisfies the specification of an
+ euclidean division function (:n:`@term` has to be a proof of
+ ``Ring_theory.div_theory``). For example, this function is called when
+ trying to rewrite :math:`7x` by :math:`2x = z` to tell that :math:`7 = 3 \times 2 + 1`. See
+ ``plugins/setoid_ring/InitialRing.v`` for examples of div function.
Error messages:
@@ -497,30 +496,31 @@ Dealing with fields
.. tacn:: field
-The ``field`` tactic is an extension of the ``ring`` tactic that deals with rational
-expressions. Given a rational expression :math:`F = 0`. It first reduces the
-expression `F` to a common denominator :math:`N/D = 0` where `N` and `D`
-are two ring expressions. For example, if we take :math:`F = (1 − 1/x) x − x + 1`, this
-gives :math:`N = (x − 1) x − x^2 + x` and :math:`D = x`. It then calls ring to solve
-:math:`N = 0`.
-Note that ``field`` also generates nonzero conditions for all the
-denominators it encounters in the reduction. In our example, it
-generates the condition :math:`x \neq 0`. These conditions appear as one subgoal
-which is a conjunction if there are several denominators. Nonzero
-conditions are always polynomial expressions. For example when
-reducing the expression :math:`1/(1 + 1/x)`, two side conditions are
-generated: :math:`x \neq 0` and :math:`x + 1 \neq 0`. Factorized expressions are broken since
-a field is an integral domain, and when the equality test on
-coefficients is complete w.r.t. the equality of the target field,
-constants can be proven different from zero automatically.
-
-The tactic must be loaded by ``Require Import Field``. New field
-structures can be declared to the system with the ``Add Field`` command
-(see below). The field of real numbers is defined in module ``RealField``
-(in ``plugins/setoid_ring``). It is exported by module ``Rbase``, so
-that requiring ``Rbase`` or ``Reals`` is enough to use the field tactics on
-real numbers. Rational numbers in canonical form are also declared as
-a field in the module ``Qcanon``.
+ This tactic is an extension of the :tacn:`ring` tactic that deals with rational
+ expressions. Given a rational expression :math:`F = 0`. It first reduces the
+ expression `F` to a common denominator :math:`N/D = 0` where `N` and `D`
+ are two ring expressions. For example, if we take :math:`F = (1 − 1/x) x − x + 1`, this
+ gives :math:`N = (x − 1) x − x^2 + x` and :math:`D = x`. It then calls ring to solve
+ :math:`N = 0`.
+
+ Note that :n:`field` also generates nonzero conditions for all the
+ denominators it encounters in the reduction. In our example, it
+ generates the condition :math:`x \neq 0`. These conditions appear as one subgoal
+ which is a conjunction if there are several denominators. Nonzero
+ conditions are always polynomial expressions. For example when
+ reducing the expression :math:`1/(1 + 1/x)`, two side conditions are
+ generated: :math:`x \neq 0` and :math:`x + 1 \neq 0`. Factorized expressions are broken since
+ a field is an integral domain, and when the equality test on
+ coefficients is complete w.r.t. the equality of the target field,
+ constants can be proven different from zero automatically.
+
+ The tactic must be loaded by ``Require Import Field``. New field
+ structures can be declared to the system with the ``Add Field`` command
+ (see below). The field of real numbers is defined in module ``RealField``
+ (in ``plugins/setoid_ring``). It is exported by module ``Rbase``, so
+ that requiring ``Rbase`` or ``Reals`` is enough to use the field tactics on
+ real numbers. Rational numbers in canonical form are also declared as
+ a field in the module ``Qcanon``.
.. example::
@@ -654,27 +654,25 @@ The syntax for adding a new field is
.. cmd:: Add Field @ident : @term {? ( @field_mod {* , @field_mod } )}
-The :n:`@ident` is not relevant. It is used just for error
-messages. :n:`@term` is a proof that the field signature satisfies the
-(semi-)field axioms. The optional list of modifiers is used to tailor
-the behavior of the tactic.
-
-.. productionlist:: coq
- field_mod : `ring_mod` | completeness `term`
-
-Since field tactics are built upon ``ring``
-tactics, all modifiers of the ``Add Ring`` apply. There is only one
-specific modifier:
-
-completeness :n:`@term`
- allows the field tactic to prove automatically
- that the image of nonzero coefficients are mapped to nonzero
- elements of the field. :n:`@term` is a proof of
-
- ``forall x y, [x] == [y] -> x ?=! y = true``,
-
- which is the completeness of equality on coefficients
- w.r.t. the field equality.
+ The :n:`@ident` is not relevant. It is used just for error
+ messages. :n:`@term` is a proof that the field signature satisfies the
+ (semi-)field axioms. The optional list of modifiers is used to tailor
+ the behavior of the tactic.
+
+ .. productionlist:: coq
+ field_mod : `ring_mod` | completeness `term`
+
+ Since field tactics are built upon ``ring``
+ tactics, all modifiers of the ``Add Ring`` apply. There is only one
+ specific modifier:
+
+ completeness :n:`@term`
+ allows the field tactic to prove automatically
+ that the image of nonzero coefficients are mapped to nonzero
+ elements of the field. :n:`@term` is a proof of
+ :g:`forall x y, [x] == [y] -> x ?=! y = true`,
+ which is the completeness of equality on coefficients
+ w.r.t. the field equality.
History of ring
diff --git a/doc/sphinx/addendum/type-classes.rst b/doc/sphinx/addendum/type-classes.rst
index 369dae0ead..15a55d9e72 100644
--- a/doc/sphinx/addendum/type-classes.rst
+++ b/doc/sphinx/addendum/type-classes.rst
@@ -298,24 +298,24 @@ Variants:
This command has no effect when used on a typeclass.
-.. cmd:: Instance @ident {? @binders} : Class t1 … tn [| priority] := { field1 := b1 ; …; fieldi := bi }
+.. cmd:: Instance @ident {? @binders} : @class t1 … tn [| priority] := { field1 := b1 ; …; fieldi := bi }
-The :cmd:`Instance` command is used to declare a typeclass instance named
-``ident`` of the class :cmd:`Class` with parameters ``t1`` to ``tn`` and
-fields ``b1`` to ``bi``, where each field must be a declared field of
-the class. Missing fields must be filled in interactive proof mode.
+ This command is used to declare a typeclass instance named
+ :token:`ident` of the class :token:`class` with parameters ``t1`` to ``tn`` and
+ fields ``b1`` to ``bi``, where each field must be a declared field of
+ the class. Missing fields must be filled in interactive proof mode.
-An arbitrary context of ``binders`` can be put after the name of the
-instance and before the colon to declare a parameterized instance. An
-optional priority can be declared, 0 being the highest priority as for
-:tacn:`auto` hints. If the priority is not specified, it defaults to the number
-of non-dependent binders of the instance.
+ An arbitrary context of :token:`binders` can be put after the name of the
+ instance and before the colon to declare a parameterized instance. An
+ optional priority can be declared, 0 being the highest priority as for
+ :tacn:`auto` hints. If the priority is not specified, it defaults to the number
+ of non-dependent binders of the instance.
-.. cmdv:: Instance @ident {? @binders} : forall {? @binders}, Class t1 … tn [| priority] := @term
+.. cmdv:: Instance @ident {? @binders} : forall {? @binders}, @class @term__1 … @term__n [| priority] := @term
This syntax is used for declaration of singleton class instances or
- for directly giving an explicit term of type ``forall binders, Class
- t1 … tn``. One need not even mention the unique field name for
+ for directly giving an explicit term of type :n:`forall @binders, @class
+ @term__1 … @term__n`. One need not even mention the unique field name for
singleton classes.
.. cmdv:: Global Instance
diff --git a/doc/sphinx/addendum/universe-polymorphism.rst b/doc/sphinx/addendum/universe-polymorphism.rst
index 41afe3c312..99b883d23c 100644
--- a/doc/sphinx/addendum/universe-polymorphism.rst
+++ b/doc/sphinx/addendum/universe-polymorphism.rst
@@ -386,8 +386,10 @@ to universes and explicitly instantiate polymorphic definitions.
global constraint on polymorphic universes.
.. exn:: Undeclared universe @ident.
+ :undocumented:
.. exn:: Universe inconsistency.
+ :undocumented:
Polymorphic definitions
diff --git a/doc/sphinx/language/gallina-extensions.rst b/doc/sphinx/language/gallina-extensions.rst
index 9dae7fd102..562ed48171 100644
--- a/doc/sphinx/language/gallina-extensions.rst
+++ b/doc/sphinx/language/gallina-extensions.rst
@@ -27,22 +27,20 @@ expressions. In this sense, the :cmd:`Record` construction allows defining
field : `ident` [ `binders` ] : `type` [ where `notation` ]
: | `ident` [ `binders` ] [: `type` ] := `term`
-In the expression:
-
.. cmd:: Record @ident @binders {? : @sort} := {? @ident} { {*; @ident @binders : @type } }
-the first identifier :token:`ident` is the name of the defined record and :token:`sort` is its
-type. The optional identifier following ``:=`` is the name of its constructor. If it is omitted,
-the default name ``Build_``\ :token:`ident`, where :token:`ident` is the record name, is used. If :token:`sort` is
-omitted, the default sort is `\Type`. The identifiers inside the brackets are the names of
-fields. For a given field :token:`ident`, its type is :g:`forall binders, type`.
-Remark that the type of a particular identifier may depend on a previously-given identifier. Thus the
-order of the fields is important. Finally, :token:`binders` are parameters of the record.
+ The first identifier :token:`ident` is the name of the defined record and :token:`sort` is its
+ type. The optional identifier following ``:=`` is the name of its constructor. If it is omitted,
+ the default name :n:`Build_@ident`, where :token:`ident` is the record name, is used. If :token:`sort` is
+ omitted, the default sort is :math:`\Type`. The identifiers inside the brackets are the names of
+ fields. For a given field :token:`ident`, its type is :n:`forall @binders, @type`.
+ Remark that the type of a particular identifier may depend on a previously-given identifier. Thus the
+ order of the fields is important. Finally, :token:`binders` are parameters of the record.
More generally, a record may have explicitly defined (a.k.a. manifest)
fields. For instance, we might have:
-:n:`Record @ident @binders : @sort := { @ident₁ : @type₁ ; @ident₂ := @term₂ ; @ident₃ : @type₃ }`.
-in which case the correctness of :n:`@type₃` may rely on the instance :n:`@term₂` of :n:`@ident₂` and :n:`@term₂` may in turn depend on :n:`@ident₁`.
+:n:`Record @ident @binders : @sort := { @ident__1 : @type__1 ; @ident__2 := @term__2 ; @ident__3 : @type__3 }`.
+in which case the correctness of :n:`@type__3` may rely on the instance :n:`@term__2` of :n:`@ident__2` and :n:`@term__2` may in turn depend on :n:`@ident__1`.
.. example::
@@ -149,16 +147,16 @@ available:
Eval compute in half.(top).
-It can be activated for printing with
-
.. flag:: Printing Projections
-.. example::
+ This flag activates the dot notation for printing.
- .. coqtop:: all
+ .. example::
+
+ .. coqtop:: all
- Set Printing Projections.
- Check top half.
+ Set Printing Projections.
+ Check top half.
.. FIXME: move this to the main grammar in the spec chapter
@@ -601,17 +599,17 @@ The following experimental command is available when the ``FunInd`` library has
.. cmd:: Function @ident {* @binder} { @decrease_annot } : @type := @term
-This command can be seen as a generalization of ``Fixpoint``. It is actually a wrapper
-for several ways of defining a function *and other useful related
-objects*, namely: an induction principle that reflects the recursive
-structure of the function (see :tacn:`function induction`) and its fixpoint equality.
-The meaning of this declaration is to define a function ident,
-similarly to ``Fixpoint``. Like in ``Fixpoint``, the decreasing argument must
-be given (unless the function is not recursive), but it might not
-necessarily be *structurally* decreasing. The point of the {} annotation
-is to name the decreasing argument *and* to describe which kind of
-decreasing criteria must be used to ensure termination of recursive
-calls.
+ This command can be seen as a generalization of ``Fixpoint``. It is actually a wrapper
+ for several ways of defining a function *and other useful related
+ objects*, namely: an induction principle that reflects the recursive
+ structure of the function (see :tacn:`function induction`) and its fixpoint equality.
+ The meaning of this declaration is to define a function ident,
+ similarly to ``Fixpoint``. Like in ``Fixpoint``, the decreasing argument must
+ be given (unless the function is not recursive), but it might not
+ necessarily be *structurally* decreasing. The point of the {} annotation
+ is to name the decreasing argument *and* to describe which kind of
+ decreasing criteria must be used to ensure termination of recursive
+ calls.
The ``Function`` construction also enjoys the ``with`` extension to define
mutually recursive definitions. However, this feature does not work
@@ -667,27 +665,32 @@ For now, dependent cases are not treated for non structurally
terminating functions.
.. exn:: The recursive argument must be specified.
+ :undocumented:
+
.. exn:: No argument name @ident.
+ :undocumented:
+
.. exn:: Cannot use mutual definition with well-founded recursion or measure.
+ :undocumented:
.. warn:: Cannot define graph for @ident.
- The generation of the graph relation (`R_ident`) used to compute the induction scheme of ident
- raised a typing error. Only `ident` is defined; the induction scheme
- will not be generated. This error happens generally when:
+ The generation of the graph relation (:n:`R_@ident`) used to compute the induction scheme of ident
+ raised a typing error. Only :token:`ident` is defined; the induction scheme
+ will not be generated. This error happens generally when:
- - the definition uses pattern matching on dependent types,
- which ``Function`` cannot deal with yet.
- - the definition is not a *pattern matching tree* as explained above.
+ - the definition uses pattern matching on dependent types,
+ which ``Function`` cannot deal with yet.
+ - the definition is not a *pattern matching tree* as explained above.
.. warn:: Cannot define principle(s) for @ident.
- The generation of the graph relation (`R_ident`) succeeded but the induction principle
- could not be built. Only `ident` is defined. Please report.
+ The generation of the graph relation (:n:`R_@ident`) succeeded but the induction principle
+ could not be built. Only :token:`ident` is defined. Please report.
.. warn:: Cannot build functional inversion principle.
- `functional inversion` will not be available for the function.
+ :tacn:`functional inversion` will not be available for the function.
.. seealso:: :ref:`functional-scheme` and :tacn:`function induction`
@@ -713,7 +716,7 @@ used by ``Function``. A more precise description is given below.
+ The fixpoint equation of `ident`: `ident_equation`.
.. cmdv:: Function @ident {* @binder } { measure @term @ident } : @type := @term
-.. cmdv:: Function @ident {* @binder } { wf @term @ident } : @type := @term
+ Function @ident {* @binder } { wf @term @ident } : @type := @term
Defines a recursive function by well-founded recursion. The module ``Recdef``
of the standard library must be loaded for this feature. The ``{}``
@@ -799,10 +802,10 @@ Section :ref:`gallina-definitions`).
`s1` and outside.
.. exn:: This is not the last opened section.
+ :undocumented:
-**Remarks:**
-
-#. Most commands, like ``Hint``, ``Notation``, option management, … which
+.. note::
+ Most commands, like ``Hint``, ``Notation``, option management, … which
appear inside a section are canceled when the section is closed.
@@ -874,52 +877,55 @@ Reserved commands inside an interactive module
.. cmd:: Include {+<+ @module}
- is a shortcut for the commands ``Include`` `module` for each `module`.
+ is a shortcut for the commands :n:`Include @module` for each :token:`module`.
.. cmd:: End @ident
- This command closes the interactive module `ident`. If the module type
+ This command closes the interactive module :token:`ident`. If the module type
was given the content of the module is matched against it and an error
is signaled if the matching fails. If the module is basic (is not a
functor) its components (constants, inductive types, submodules etc.)
are now available through the dot notation.
.. exn:: No such label @ident.
+ :undocumented:
.. exn:: Signature components for label @ident do not match.
+ :undocumented:
.. exn:: This is not the last opened module.
+ :undocumented:
.. cmd:: Module @ident := @module_expression
- This command defines the module identifier `ident` to be equal
- to `module_expression`.
+ This command defines the module identifier :token:`ident` to be equal
+ to :token:`module_expression`.
.. cmdv:: Module @ident {* @module_binding} := @module_expression
- Defines a functor with parameters given by the list of `module_binding` and body `module_expression`.
+ Defines a functor with parameters given by the list of :token:`module_binding` and body :token:`module_expression`.
.. cmdv:: Module @ident {* @module_binding} : @module_type := @module_expression
- Defines a functor with parameters given by the list of `module_binding` (possibly none), and output module type `module_type`,
- with body `module_expression`.
+ Defines a functor with parameters given by the list of :token:`module_binding` (possibly none), and output module type :token:`module_type`,
+ with body :token:`module_expression`.
.. cmdv:: Module @ident {* @module_binding} <: {+<: @module_type} := @module_expression
- Defines a functor with parameters given by module_bindings (possibly none) with body `module_expression`.
+ Defines a functor with parameters given by module_bindings (possibly none) with body :token:`module_expression`.
The body is checked against each |module_type_i|.
.. cmdv:: Module @ident {* @module_binding} := {+<+ @module_expression}
- is equivalent to an interactive module where each `module_expression` is included.
+ is equivalent to an interactive module where each :token:`module_expression` is included.
.. cmd:: Module Type @ident
-This command is used to start an interactive module type `ident`.
+ This command is used to start an interactive module type :token:`ident`.
- .. cmdv:: Module Type @ident {* @module_binding}
+ .. cmdv:: Module Type @ident {* @module_binding}
- Starts an interactive functor type with parameters given by `module_bindings`.
+ Starts an interactive functor type with parameters given by :token:`module_bindings`.
Reserved commands inside an interactive module type:
@@ -931,7 +937,7 @@ Reserved commands inside an interactive module type:
.. cmd:: Include {+<+ @module}
- is a shortcut for the command ``Include`` `module` for each `module`.
+ This is a shortcut for the command :n:`Include @module` for each :token:`module`.
.. cmd:: @assumption_keyword Inline @assums
:name: Inline
@@ -941,31 +947,32 @@ Reserved commands inside an interactive module type:
.. cmd:: End @ident
- This command closes the interactive module type `ident`.
+ This command closes the interactive module type :token:`ident`.
.. exn:: This is not the last opened module type.
+ :undocumented:
.. cmd:: Module Type @ident := @module_type
- Defines a module type `ident` equal to `module_type`.
+ Defines a module type :token:`ident` equal to :token:`module_type`.
.. cmdv:: Module Type @ident {* @module_binding} := @module_type
- Defines a functor type `ident` specifying functors taking arguments `module_bindings` and
- returning `module_type`.
+ Defines a functor type :token:`ident` specifying functors taking arguments :token:`module_bindings` and
+ returning :token:`module_type`.
.. cmdv:: Module Type @ident {* @module_binding} := {+<+ @module_type }
- is equivalent to an interactive module type were each `module_type` is included.
+ is equivalent to an interactive module type were each :token:`module_type` is included.
.. cmd:: Declare Module @ident : @module_type
- Declares a module `ident` of type `module_type`.
+ Declares a module :token:`ident` of type :token:`module_type`.
.. cmdv:: Declare Module @ident {* @module_binding} : @module_type
- Declares a functor with parameters given by the list of `module_binding` and output module type
- `module_type`.
+ Declares a functor with parameters given by the list of :token:`module_binding` and output module type
+ :token:`module_type`.
.. example::
@@ -1205,8 +1212,10 @@ component is equal ``nat`` and hence ``M1.T`` as specified.
is imported, qualid is imported as well.
.. exn:: @qualid is not a module.
+ :undocumented:
.. warn:: Trying to mask the absolute name @qualid!
+ :undocumented:
.. cmd:: Print Module @ident
@@ -1506,6 +1515,7 @@ possible, the correct argument will be automatically generated.
.. exn:: Cannot infer a term for this placeholder.
:name: Cannot infer a term for this placeholder. (Casual use of implicit arguments)
+ :undocumented:
|Coq| was not able to deduce an instantiation of a “_”.
@@ -1566,38 +1576,39 @@ usual implicit arguments disambiguation syntax.
Declaring Implicit Arguments
++++++++++++++++++++++++++++
-To set implicit arguments *a posteriori*, one can use the command:
-.. cmd:: Arguments @qualid {* @possibly_bracketed_ident }
- :name: Arguments (implicits)
-where the list of `possibly_bracketed_ident` is a prefix of the list of
-arguments of `qualid` where the ones to be declared implicit are
-surrounded by square brackets and the ones to be declared as maximally
-inserted implicits are surrounded by curly braces.
+.. cmd:: Arguments @qualid {* [ @ident ] | @ident }
+ :name: Arguments (implicits)
-After the above declaration is issued, implicit arguments can just
-(and have to) be skipped in any expression involving an application
-of `qualid`.
+ This command is used to set implicit arguments *a posteriori*,
+ where the list of possibly bracketed :token:`ident` is a prefix of the list of
+ arguments of :token:`qualid` where the ones to be declared implicit are
+ surrounded by square brackets and the ones to be declared as maximally
+ inserted implicits are surrounded by curly braces.
-Implicit arguments can be cleared with the following syntax:
+ After the above declaration is issued, implicit arguments can just
+ (and have to) be skipped in any expression involving an application
+ of :token:`qualid`.
.. cmd:: Arguments @qualid : clear implicits
-.. cmdv:: Global Arguments @qualid {* @possibly_bracketed_ident }
+ This command clears implicit arguments.
+
+.. cmdv:: Global Arguments @qualid {* [ @ident ] | @ident }
- Says to recompute the implicit arguments of
- `qualid` after ending of the current section if any, enforcing the
+ This command is used to recompute the implicit arguments of
+ :token:`qualid` after ending of the current section if any, enforcing the
implicit arguments known from inside the section to be the ones
declared by the command.
-.. cmdv:: Local Arguments @qualid {* @possibly_bracketed_ident }
+.. cmdv:: Local Arguments @qualid {* [ @ident ] | @ident }
When in a module, tell not to activate the
- implicit arguments ofqualid declared by this command to contexts that
+ implicit arguments of :token:`qualid` declared by this command to contexts that
require the module.
-.. cmdv:: {? Global | Local } Arguments @qualid {*, {+ @possibly_bracketed_ident } }
+.. cmdv:: {? Global | Local } Arguments @qualid {*, {+ [ @ident ] | @ident } }
For names of constants, inductive types,
constructors, lemmas which can only be applied to a fixed number of
@@ -1639,33 +1650,34 @@ Implicit arguments can be cleared with the following syntax:
Check (fun l => map length l = map (list nat) nat length l).
-Remark: To know which are the implicit arguments of an object, use the
-command ``Print Implicit`` (see :ref:`displaying-implicit-args`).
+.. note::
+ To know which are the implicit arguments of an object, use the
+ command :cmd:`Print Implicit` (see :ref:`displaying-implicit-args`).
Automatic declaration of implicit arguments
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-|Coq| can also automatically detect what are the implicit arguments of a
-defined object. The command is just
-
.. cmd:: Arguments @qualid : default implicits
-The auto-detection is governed by options telling if strict,
-contextual, or reversible-pattern implicit arguments must be
-considered or not (see :ref:`controlling-strict-implicit-args`, :ref:`controlling-strict-implicit-args`,
-:ref:`controlling-rev-pattern-implicit-args`, and also :ref:`controlling-insertion-implicit-args`).
+ This command tells |Coq| to automatically detect what are the implicit arguments of a
+ defined object.
-.. cmdv:: Global Arguments @qualid : default implicits
+ The auto-detection is governed by options telling if strict,
+ contextual, or reversible-pattern implicit arguments must be
+ considered or not (see :ref:`controlling-strict-implicit-args`, :ref:`controlling-strict-implicit-args`,
+ :ref:`controlling-rev-pattern-implicit-args`, and also :ref:`controlling-insertion-implicit-args`).
- Tell to recompute the
- implicit arguments of qualid after ending of the current section if
- any.
+ .. cmdv:: Global Arguments @qualid : default implicits
-.. cmdv:: Local Arguments @qualid : default implicits
+ Tell to recompute the
+ implicit arguments of qualid after ending of the current section if
+ any.
- When in a module, tell not to activate the implicit arguments of `qualid` computed by this
- declaration to contexts that requires the module.
+ .. cmdv:: Local Arguments @qualid : default implicits
+
+ When in a module, tell not to activate the implicit arguments of :token:`qualid` computed by this
+ declaration to contexts that requires the module.
.. example::
@@ -1820,10 +1832,10 @@ This syntax extension is given in the following grammar:
Renaming implicit arguments
~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Implicit arguments names can be redefined using the following syntax:
-
.. cmd:: Arguments @qualid {* @name} : @rename
+ This command is used to redefine the names of implicit arguments.
+
With the assert flag, ``Arguments`` can be used to assert that a given
object has the expected number of arguments and that these arguments
are named as expected.
@@ -1845,11 +1857,12 @@ are named as expected.
Displaying what the implicit arguments are
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-To display the implicit arguments associated to an object, and to know
-if each of them is to be used maximally or not, use the command
-
.. cmd:: Print Implicit @qualid
+ Use this command to display the implicit arguments associated to an object,
+ and to know if each of them is to be used maximally or not.
+
+
Explicit displaying of implicit arguments for pretty-printing
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1984,16 +1997,16 @@ Implicit types of variables
~~~~~~~~~~~~~~~~~~~~~~~~~~~
It is possible to bind variable names to a given type (e.g. in a
-development using arithmetic, it may be convenient to bind the names `n`
-or `m` to the type ``nat`` of natural numbers). The command for that is
+development using arithmetic, it may be convenient to bind the names :g:`n`
+or :g:`m` to the type :g:`nat` of natural numbers).
.. cmd:: Implicit Types {+ @ident } : @type
-The effect of the command is to automatically set the type of bound
-variables starting with `ident` (either `ident` itself or `ident` followed by
-one or more single quotes, underscore or digits) to be `type` (unless
-the bound variable is already declared with an explicit type in which
-case, this latter type is considered).
+ The effect of the command is to automatically set the type of bound
+ variables starting with :token:`ident` (either :token:`ident` itself or
+ :token:`ident` followed by one or more single quotes, underscore or
+ digits) to be :token:`type` (unless the bound variable is already declared
+ with an explicit type in which case, this latter type is considered).
.. example::
@@ -2137,23 +2150,29 @@ Printing universes
terms apparently identical but internally different in the Calculus of Inductive
Constructions.
-The constraints on the internal level of the occurrences of Type
-(see :ref:`Sorts`) can be printed using the command
-
.. cmd:: Print {? Sorted} Universes
:name: Print Universes
-If the optional ``Sorted`` option is given, each universe will be made
-equivalent to a numbered label reflecting its level (with a linear
-ordering) in the universe hierarchy.
+ This command can be used to print the constraints on the internal level
+ of the occurrences of :math:`\Type` (see :ref:`Sorts`).
+
+ If the optional ``Sorted`` option is given, each universe will be made
+ equivalent to a numbered label reflecting its level (with a linear
+ ordering) in the universe hierarchy.
-This command also accepts an optional output filename:
+ .. cmdv:: Print {? Sorted} Universes @string
-.. cmdv:: Print {? Sorted} Universes @string
+ This variant accepts an optional output filename.
-If `string` ends in ``.dot`` or ``.gv``, the constraints are printed in the DOT
-language, and can be processed by Graphviz tools. The format is
-unspecified if `string` doesn’t end in ``.dot`` or ``.gv``.
+ If :token:`string` ends in ``.dot`` or ``.gv``, the constraints are printed in the DOT
+ language, and can be processed by Graphviz tools. The format is
+ unspecified if `string` doesn’t end in ``.dot`` or ``.gv``.
+
+.. cmdv:: Print Universes Subgraph(@names)
+
+ Prints the graph restricted to the requested names (adjusting
+ constraints to preserve the implied transitive constraints between
+ kept universes).
.. _existential-variables:
@@ -2247,7 +2266,3 @@ expression as described in :ref:`ltac`.
This construction is useful when one wants to define complicated terms
using highly automated tactics without resorting to writing the proof-term
by means of the interactive proof engine.
-
-This mechanism is comparable to the ``Declare Implicit Tactic`` command
-defined at :ref:`tactics-implicit-automation`, except that the used
-tactic is local to each hole instead of being declared globally.
diff --git a/doc/sphinx/proof-engine/ltac.rst b/doc/sphinx/proof-engine/ltac.rst
index edd83b7cee..0ea8c7be2d 100644
--- a/doc/sphinx/proof-engine/ltac.rst
+++ b/doc/sphinx/proof-engine/ltac.rst
@@ -292,6 +292,7 @@ focused goals with:
.. exn:: No such goal.
:name: No such goal. (Goal selector)
+ :undocumented:
.. TODO change error message index entry
@@ -351,6 +352,7 @@ We can check if a tactic made progress with:
goals (up to syntactical equality), then an error of level 0 is raised.
.. exn:: Failed to progress.
+ :undocumented:
Backtracking branching
~~~~~~~~~~~~~~~~~~~~~~
@@ -393,6 +395,7 @@ tactic to work (i.e. which does not fail) among a panel of tactics:
:n:`v__i` to have *at least* one success.
.. exn:: No applicable tactic.
+ :undocumented:
.. tacv:: first @expr
@@ -482,6 +485,7 @@ one* success:
immediately.
.. exn:: This tactic has more than one success.
+ :undocumented:
Checking the failure
~~~~~~~~~~~~~~~~~~~~
@@ -521,6 +525,7 @@ among a panel of tactics:
apply :n:`v__2` and so on. It fails if there is no solving tactic.
.. exn:: Cannot solve the goal.
+ :undocumented:
.. tacv:: solve @expr
@@ -576,8 +581,7 @@ Failing
goals left. See the example for clarification.
.. tacv:: gfail {* message_token}
-
- .. tacv:: gfail @num {* message_token}
+ gfail @num {* message_token}
These variants fail with an error message or an error level even if
there are no goals left. Be careful however if Coq terms have to be
@@ -586,9 +590,11 @@ Failing
evaluated, a tactic call like :n:`let x := H in fail 0 x` will succeed.
.. exn:: Tactic Failure message (level @num).
+ :undocumented:
.. exn:: No such goal.
:name: No such goal. (fail)
+ :undocumented:
.. example::
@@ -670,24 +676,24 @@ tactic
This tactic currently does not support nesting, and will report times
based on the innermost execution. This is due to the fact that it is
- implemented using the tactics
+ implemented using the following internal tactics:
.. tacn:: restart_timer @string
:name: restart_timer
- and
+ Reset a timer
- .. tacn:: finish_timing {? @string} @string
+ .. tacn:: finish_timing {? (@string)} @string
:name: finish_timing
- which (re)set and display an optionally named timer, respectively. The
- parenthesized string argument to :n:`finish_timing` is also optional, and
- determines the label associated with the timer for printing.
+ Display an optionally named timer. The parenthesized string argument
+ is also optional, and determines the label associated with the timer
+ for printing.
- By copying the definition of :n:`time_constr` from the standard library,
+ By copying the definition of :tacn:`time_constr` from the standard library,
users can achive support for a fixed pattern of nesting by passing
- different :n:`@string` parameters to :n:`restart_timer` and :n:`finish_timing`
- at each level of nesting.
+ different :token:`string` parameters to :tacn:`restart_timer` and
+ :tacn:`finish_timing` at each level of nesting.
.. example::
@@ -967,10 +973,10 @@ Evaluation of a term can be performed with:
Recovering the type of a term
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The following returns the type of term:
-
.. tacn:: type of @term
+ This tactic returns the type of :token:`term`.
+
Manipulating untyped terms
~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1041,6 +1047,7 @@ Testing boolean expressions
Fail all:let n:= numgoals in guard n=2.
.. exn:: Condition not satisfied.
+ :undocumented:
Proving a subgoal as a separate lemma
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1092,6 +1099,7 @@ Proving a subgoal as a separate lemma
.. exn:: Proof is not complete.
:name: Proof is not complete. (abstract)
+ :undocumented:
Tactic toplevel definitions
---------------------------
@@ -1348,6 +1356,6 @@ Run-time optimization tactic
.. tacn:: optimize_heap
:name: optimize_heap
-This tactic behaves like :n:`idtac`, except that running it compacts the
-heap in the OCaml run-time system. It is analogous to the Vernacular
-command :cmd:`Optimize Heap`.
+ This tactic behaves like :n:`idtac`, except that running it compacts the
+ heap in the OCaml run-time system. It is analogous to the Vernacular
+ command :cmd:`Optimize Heap`.
diff --git a/doc/sphinx/proof-engine/proof-handling.rst b/doc/sphinx/proof-engine/proof-handling.rst
index 741f9fe5b0..590d71b5f3 100644
--- a/doc/sphinx/proof-engine/proof-handling.rst
+++ b/doc/sphinx/proof-engine/proof-handling.rst
@@ -67,6 +67,7 @@ list of assertion commands is given in :ref:`Assertions`. The command
added to the environment as an opaque constant.
.. exn:: Attempt to save an incomplete proof.
+ :undocumented:
.. note::
@@ -106,6 +107,7 @@ list of assertion commands is given in :ref:`Assertions`. The command
proof was edited.
.. exn:: No focused proof (No proof-editing in progress).
+ :undocumented:
.. cmdv:: Abort @ident
@@ -282,6 +284,7 @@ Navigation in the proof tree
This command restores the proof editing process to the original goal.
.. exn:: No focused proof to restart.
+ :undocumented:
.. cmd:: Focus
@@ -473,13 +476,14 @@ Requesting information
This command displays the current goals.
.. exn:: No focused proof.
+ :undocumented:
.. cmdv:: Show @num
Displays only the :token:`num`\-th subgoal.
.. exn:: No such goal.
-
+ :undocumented:
.. cmdv:: Show @ident
@@ -565,6 +569,7 @@ Requesting information
Show Match nat.
.. exn:: Unknown inductive type.
+ :undocumented:
.. cmdv:: Show Universes
:name: Show Universes
@@ -758,18 +763,6 @@ Controlling the effect of proof editing commands
available hypotheses.
-.. flag:: Automatic Introduction
-
- This option controls the way binders are handled
- in assertion commands such as :n:`Theorem @ident {? @binders} : @term`. When the
- option is on, which is the default, binders are automatically put in
- the local context of the goal to prove.
-
- When the option is off, binders are discharged on the statement to be
- proved and a tactic such as :tacn:`intro` (see Section :ref:`managingthelocalcontext`)
- has to be used to move the assumptions to the local context.
-
-
.. flag:: Nested Proofs Allowed
When turned on (it is off by default), this option enables support for nested
diff --git a/doc/sphinx/proof-engine/tactics.rst b/doc/sphinx/proof-engine/tactics.rst
index 457f9b2efa..150aadc15a 100644
--- a/doc/sphinx/proof-engine/tactics.rst
+++ b/doc/sphinx/proof-engine/tactics.rst
@@ -91,6 +91,7 @@ bindings_list`` where ``bindings_list`` may be of two different forms:
of ``term``.
.. exn:: No such binder.
+ :undocumented:
+ A bindings list can also be a simple list of terms :n:`{* term}`.
In that case the references to which these terms correspond are
@@ -102,6 +103,7 @@ bindings_list`` where ``bindings_list`` may be of two different forms:
are required.
.. exn:: Not the right number of missing arguments.
+ :undocumented:
.. _occurrencessets:
@@ -589,6 +591,7 @@ Applying theorems
:n:`constructor 2 {? with @bindings_list }`.
.. exn:: Not an inductive goal with 2 constructors.
+ :undocumented:
.. tacv:: econstructor
eexists
@@ -1081,8 +1084,8 @@ Managing the local context
generated by Coq.
.. tacv:: epose (@ident {? @binders} := @term)
- .. tacv:: epose term
- :name: epose
+ epose @term
+ :name: epose; _
While the different variants of :tacn:`pose` expect that no
existential variables are generated by the tactic, :tacn:`epose`
@@ -1124,7 +1127,7 @@ Managing the local context
Controlling the proof flow
------------------------------
-.. tacn:: assert (@ident : form)
+.. tacn:: assert (@ident : @type)
:name: assert
This tactic applies to any goal. :n:`assert (H : U)` adds a new hypothesis
@@ -1132,106 +1135,104 @@ Controlling the proof flow
:g:`U` [2]_. The subgoal :g:`U` comes first in the list of subgoals remaining to
prove.
-.. exn:: Not a proposition or a type.
+ .. exn:: Not a proposition or a type.
- Arises when the argument form is neither of type :g:`Prop`, :g:`Set` nor
- :g:`Type`.
+ Arises when the argument :token:`type` is neither of type :g:`Prop`,
+ :g:`Set` nor :g:`Type`.
-.. tacv:: assert form
+ .. tacv:: assert @type
- This behaves as :n:`assert (@ident : form)` but :n:`@ident` is generated by
- Coq.
+ This behaves as :n:`assert (@ident : @type)` but :n:`@ident` is
+ generated by Coq.
-.. tacv:: assert @form by @tactic
+ .. tacv:: assert @type by @tactic
- This tactic behaves like :n:`assert` but applies tactic to solve the subgoals
- generated by assert.
+ This tactic behaves like :tacn:`assert` but applies tactic to solve the
+ subgoals generated by assert.
- .. exn:: Proof is not complete.
- :name: Proof is not complete. (assert)
+ .. exn:: Proof is not complete.
+ :name: Proof is not complete. (assert)
+ :undocumented:
-.. tacv:: assert @form as @intro_pattern
+ .. tacv:: assert @type as @intro_pattern
- If :n:`intro_pattern` is a naming introduction pattern (see :tacn:`intro`),
- the hypothesis is named after this introduction pattern (in particular, if
- :n:`intro_pattern` is :n:`@ident`, the tactic behaves like
- :n:`assert (@ident : form)`). If :n:`intro_pattern` is an action
- introduction pattern, the tactic behaves like :n:`assert form` followed by
- the action done by this introduction pattern.
+ If :n:`intro_pattern` is a naming introduction pattern (see :tacn:`intro`),
+ the hypothesis is named after this introduction pattern (in particular, if
+ :n:`intro_pattern` is :n:`@ident`, the tactic behaves like
+ :n:`assert (@ident : @type)`). If :n:`intro_pattern` is an action
+ introduction pattern, the tactic behaves like :n:`assert @type` followed by
+ the action done by this introduction pattern.
-.. tacv:: assert @form as @intro_pattern by @tactic
+ .. tacv:: assert @type as @intro_pattern by @tactic
- This combines the two previous variants of :n:`assert`.
+ This combines the two previous variants of :tacn:`assert`.
-.. tacv:: assert (@ident := @term )
+ .. tacv:: assert (@ident := @term)
- This behaves as :n:`assert (@ident : type) by exact @term` where :g:`type` is
- the type of :g:`term`. This is deprecated in favor of :n:`pose proof`. If the
- head of term is :n:`@ident`, the tactic behaves as :n:`specialize @term`.
+ This behaves as :n:`assert (@ident : @type) by exact @term` where
+ :token:`type` is the type of :token:`term`. This is equivalent to using
+ :tacn:`pose proof`. If the head of term is :token:`ident`, the tactic
+ behaves as :tacn:`specialize`.
- .. exn:: Variable @ident is already declared.
+ .. exn:: Variable @ident is already declared.
+ :undocumented:
-.. tacv:: eassert form as intro_pattern by tactic
+.. tacv:: eassert @type as @intro_pattern by @tactic
:name: eassert
-.. tacv:: assert (@ident := @term)
-
- While the different variants of :n:`assert` expect that no existential
- variables are generated by the tactic, :n:`eassert` removes this constraint.
+ While the different variants of :tacn:`assert` expect that no existential
+ variables are generated by the tactic, :tacn:`eassert` removes this constraint.
This allows not to specify the asserted statement completeley before starting
to prove it.
-.. tacv:: pose proof @term {? as intro_pattern}
+.. tacv:: pose proof @term {? as @intro_pattern}
:name: pose proof
- This tactic behaves like :n:`assert T {? as intro_pattern} by exact @term`
- where :g:`T` is the type of :g:`term`. In particular,
+ This tactic behaves like :n:`assert @type {? as @intro_pattern} by exact @term`
+ where :token:`type` is the type of :token:`term`. In particular,
:n:`pose proof @term as @ident` behaves as :n:`assert (@ident := @term)`
- and :n:`pose proof @term as intro_pattern` is the same as applying the
- intro_pattern to :n:`@term`.
+ and :n:`pose proof @term as @intro_pattern` is the same as applying the
+ :token:`intro_pattern` to :token:`term`.
-.. tacv:: epose proof term {? as intro_pattern}
+.. tacv:: epose proof @term {? as @intro_pattern}
+ :name: epose proof
- While :n:`pose proof` expects that no existential variables are generated by
- the tactic, :n:`epose proof` removes this constraint.
+ While :tacn:`pose proof` expects that no existential variables are generated by
+ the tactic, :tacn:`epose proof` removes this constraint.
-.. tacv:: enough (@ident : form)
+.. tacv:: enough (@ident : @type)
:name: enough
- This adds a new hypothesis of name :n:`@ident` asserting :n:`form` to the
- goal the tactic :n:`enough` is applied to. A new subgoal stating :n:`form` is
- inserted after the initial goal rather than before it as :n:`assert` would do.
+ This adds a new hypothesis of name :token:`ident` asserting :token:`type` to the
+ goal the tactic :tacn:`enough` is applied to. A new subgoal stating :token:`type` is
+ inserted after the initial goal rather than before it as :tacn:`assert` would do.
-.. tacv:: enough form
+.. tacv:: enough @type
- This behaves like :n:`enough (@ident : form)` with the name :n:`@ident` of
+ This behaves like :n:`enough (@ident : @type)` with the name :token:`ident` of
the hypothesis generated by Coq.
-.. tacv:: enough form as intro_pattern
+.. tacv:: enough @type as @intro_pattern
- This behaves like :n:`enough form` using :n:`intro_pattern` to name or
+ This behaves like :n:`enough @type` using :token:`intro_pattern` to name or
destruct the new hypothesis.
-.. tacv:: enough (@ident : @form) by @tactic
-.. tacv:: enough @form by @tactic
-.. tacv:: enough @form as @intro_pattern by @tactic
+.. tacv:: enough (@ident : @type) by @tactic
+ enough @type {? as @intro_pattern } by @tactic
- This behaves as above but with :n:`tactic` expected to solve the initial goal
- after the extra assumption :n:`form` is added and possibly destructed. If the
- :n:`as intro_pattern` clause generates more than one subgoal, :n:`tactic` is
+ This behaves as above but with :token:`tactic` expected to solve the initial goal
+ after the extra assumption :token:`type` is added and possibly destructed. If the
+ :n:`as @intro_pattern` clause generates more than one subgoal, :token:`tactic` is
applied to all of them.
-.. tacv:: eenough (@ident : form) by tactic
- :name: eenough
-
-.. tacv:: eenough form by tactic
-
-.. tacv:: eenough form as intro_pattern by tactic
+.. tacv:: eenough @type {? as @intro_pattern } {? by @tactic }
+ eenough (@ident : @type) {? by @tactic }
+ :name: eenough; _
- While the different variants of :n:`enough` expect that no existential
- variables are generated by the tactic, :n:`eenough` removes this constraint.
+ While the different variants of :tacn:`enough` expect that no existential
+ variables are generated by the tactic, :tacn:`eenough` removes this constraint.
-.. tacv:: cut @form
+.. tacv:: cut @type
:name: cut
This tactic applies to any goal. It implements the non-dependent case of
@@ -1240,11 +1241,11 @@ Controlling the proof flow
subgoals: :g:`U -> T` and :g:`U`. The subgoal :g:`U -> T` comes first in the
list of remaining subgoal to prove.
-.. tacv:: specialize (ident {* @term}) {? as intro_pattern}
-.. tacv:: specialize ident with @bindings_list {? as intro_pattern}
- :name: specialize
+.. tacv:: specialize (@ident {* @term}) {? as @intro_pattern}
+ specialize @ident with @bindings_list {? as @intro_pattern}
+ :name: specialize; _
- The tactic :n:`specialize` works on local hypothesis :n:`@ident`. The
+ This tactic works on local hypothesis :n:`@ident`. The
premises of this hypothesis (either universal quantifications or
non-dependent implications) are instantiated by concrete terms coming either
from arguments :n:`{* @term}` or from a :ref:`bindings list <bindingslist>`.
@@ -1254,15 +1255,18 @@ Controlling the proof flow
uninstantiated arguments are inferred by unification if possible or left
quantified in the hypothesis otherwise. With the :n:`as` clause, the local
hypothesis :n:`@ident` is left unchanged and instead, the modified hypothesis
- is introduced as specified by the :n:`intro_pattern`. The name :n:`@ident`
+ is introduced as specified by the :token:`intro_pattern`. The name :n:`@ident`
can also refer to a global lemma or hypothesis. In this case, for
- compatibility reasons, the behavior of :n:`specialize` is close to that of
- :n:`generalize`: the instantiated statement becomes an additional premise of
- the goal. The :n:`as` clause is especially useful in this case to immediately
+ compatibility reasons, the behavior of :tacn:`specialize` is close to that of
+ :tacn:`generalize`: the instantiated statement becomes an additional premise of
+ the goal. The ``as`` clause is especially useful in this case to immediately
introduce the instantiated statement as a local hypothesis.
.. exn:: @ident is used in hypothesis @ident.
+ :undocumented:
+
.. exn:: @ident is used in conclusion.
+ :undocumented:
.. tacn:: generalize @term
:name: generalize
@@ -1343,8 +1347,8 @@ name of the variable (here :g:`n`) is chosen based on :g:`T`.
changes in the goal, its use is strongly discouraged.
.. tacv:: instantiate ( @num := @term ) in @ident
-.. tacv:: instantiate ( @num := @term ) in ( value of @ident )
-.. tacv:: instantiate ( @num := @term ) in ( type of @ident )
+ instantiate ( @num := @term ) in ( value of @ident )
+ instantiate ( @num := @term ) in ( type of @ident )
These allow to refer respectively to existential variables occurring in a
hypothesis or in the body or the type of a local definition.
@@ -1360,13 +1364,13 @@ name of the variable (here :g:`n`) is chosen based on :g:`T`.
.. tacn:: admit
:name: admit
-The admit tactic allows temporarily skipping a subgoal so as to
-progress further in the rest of the proof. A proof containing admitted
-goals cannot be closed with :g:`Qed` but only with :g:`Admitted`.
+ This tactic allows temporarily skipping a subgoal so as to
+ progress further in the rest of the proof. A proof containing admitted
+ goals cannot be closed with :cmd:`Qed` but only with :cmd:`Admitted`.
.. tacv:: give_up
- Synonym of :n:`admit`.
+ Synonym of :tacn:`admit`.
.. tacn:: absurd @term
:name: absurd
@@ -1387,7 +1391,8 @@ goals cannot be closed with :g:`Qed` but only with :g:`Admitted`.
a singleton inductive type (e.g. :g:`True` or :g:`x=x`), or two contradictory
hypotheses.
-.. exn:: No such assumption.
+ .. exn:: No such assumption.
+ :undocumented:
.. tacv:: contradiction @ident
@@ -1602,6 +1607,7 @@ analysis on inductive or co-inductive objects (see :ref:`inductive-definitions`)
induction n.
.. exn:: Not an inductive product.
+ :undocumented:
.. exn:: Unable to find an instance for the variables @ident ... @ident.
@@ -1672,10 +1678,9 @@ analysis on inductive or co-inductive objects (see :ref:`inductive-definitions`)
Show 2.
.. tacv:: induction @term with @bindings_list as @disj_conj_intro_pattern using @term with @bindings_list in @goal_occurrences
+ einduction @term with @bindings_list as @disj_conj_intro_pattern using @term with @bindings_list in @goal_occurrences
-.. tacv:: einduction @term with @bindings_list as @disj_conj_intro_pattern using @term with @bindings_list in @goal_occurrences
-
- These are the most general forms of ``induction`` and ``einduction``. It combines the
+ These are the most general forms of :tacn:`induction` and :tacn:`einduction`. It combines the
effects of the with, as, using, and in clauses.
.. tacv:: elim @term
@@ -1709,7 +1714,7 @@ analysis on inductive or co-inductive objects (see :ref:`inductive-definitions`)
existential variables to be resolved later on.
.. tacv:: elim @term using @term
-.. tacv:: elim @term using @term with @bindings_list
+ elim @term using @term with @bindings_list
Allows the user to give explicitly an induction principle :n:`@term` that
is not the standard one for the underlying inductive type of :n:`@term`. The
@@ -1717,15 +1722,15 @@ analysis on inductive or co-inductive objects (see :ref:`inductive-definitions`)
:n:`@term`.
.. tacv:: elim @term with @bindings_list using @term with @bindings_list
-.. tacv:: eelim @term with @bindings_list using @term with @bindings_list
+ eelim @term with @bindings_list using @term with @bindings_list
- These are the most general forms of ``elim`` and ``eelim``. It combines the
+ These are the most general forms of :tacn:`elim` and :tacn:`eelim`. It combines the
effects of the ``using`` clause and of the two uses of the ``with`` clause.
-.. tacv:: elimtype @form
+.. tacv:: elimtype @type
:name: elimtype
- The argument :n:`form` must be inductively defined. :n:`elimtype I` is
+ The argument :token:`type` must be inductively defined. :n:`elimtype I` is
equivalent to :n:`cut I. intro Hn; elim Hn; clear Hn.` Therefore the
hypothesis :g:`Hn` will not appear in the context(s) of the subgoal(s).
Conversely, if :g:`t` is a :n:`@term` of (inductive) type :g:`I` that does
@@ -1879,7 +1884,10 @@ and an explanation of the underlying technique.
.. seealso:: :ref:`advanced-recursive-functions`, :ref:`functional-scheme` and :tacn:`inversion`
.. exn:: Cannot find induction information on @qualid.
+ :undocumented:
+
.. exn:: Not the right number of induction arguments.
+ :undocumented:
.. tacv:: functional induction (@qualid {+ @term}) as @disj_conj_intro_pattern using @term with @bindings_list
@@ -1913,7 +1921,10 @@ and an explanation of the underlying technique.
:n:`intros until @ident`.
.. exn:: No primitive equality found.
+ :undocumented:
+
.. exn:: Not a discriminable equality.
+ :undocumented:
.. tacv:: discriminate @num
@@ -1927,11 +1938,11 @@ and an explanation of the underlying technique.
bindings to instantiate parameters or hypotheses of :n:`@term`.
.. tacv:: ediscriminate @num
-.. tacv:: ediscriminate @term {? with @bindings_list}
- :name: ediscriminate
+ ediscriminate @term {? with @bindings_list}
+ :name: ediscriminate; _
- This works the same as ``discriminate`` but if the type of :n:`@term`, or the
- type of the hypothesis referred to by :n:`@num`, has uninstantiated
+ This works the same as :tacn:`discriminate` but if the type of :token:`term`, or the
+ type of the hypothesis referred to by :token:`num`, has uninstantiated
parameters, these parameters are left as existential variables.
.. tacv:: discriminate
@@ -1942,6 +1953,7 @@ and an explanation of the underlying technique.
:n:`intro @ident; discriminate @ident`.
.. exn:: No discriminable equalities.
+ :undocumented:
.. tacn:: injection @term
:name: injection
@@ -1994,9 +2006,16 @@ and an explanation of the underlying technique.
context using :n:`intros until @ident`.
.. exn:: Not a projectable equality but a discriminable one.
- .. exn:: Nothing to do, it is an equality between convertible @terms.
+ :undocumented:
+
+ .. exn:: Nothing to do, it is an equality between convertible terms.
+ :undocumented:
+
.. exn:: Not a primitive equality.
+ :undocumented:
+
.. exn:: Nothing to inject.
+ :undocumented:
.. tacv:: injection @num
@@ -2010,8 +2029,8 @@ and an explanation of the underlying technique.
instantiate parameters or hypotheses of :n:`@term`.
.. tacv:: einjection @num
- :name: einjection
- .. tacv:: einjection @term {? with @bindings_list}
+ einjection @term {? with @bindings_list}
+ :name: einjection; _
This works the same as :n:`injection` but if the type of :n:`@term`, or the
type of the hypothesis referred to by :n:`@num`, has uninstantiated
@@ -2023,21 +2042,22 @@ and an explanation of the underlying technique.
:n:`intro @ident; injection @ident`.
.. exn:: goal does not satisfy the expected preconditions.
+ :undocumented:
.. tacv:: injection @term {? with @bindings_list} as {+ @intro_pattern}
- .. tacv:: injection @num as {+ intro_pattern}
- .. tacv:: injection as {+ intro_pattern}
- .. tacv:: einjection @term {? with @bindings_list} as {+ intro_pattern}
- .. tacv:: einjection @num as {+ intro_pattern}
- .. tacv:: einjection as {+ intro_pattern}
-
- These variants apply :n:`intros {+ @intro_pattern}` after the call to
- :tacn:`injection` or :tacn:`einjection` so that all equalities generated are moved in
- the context of hypotheses. The number of :n:`@intro_pattern` must not exceed
- the number of equalities newly generated. If it is smaller, fresh
- names are automatically generated to adjust the list of :n:`@intro_pattern`
- to the number of new equalities. The original equality is erased if it
- corresponds to a hypothesis.
+ injection @num as {+ intro_pattern}
+ injection as {+ intro_pattern}
+ einjection @term {? with @bindings_list} as {+ intro_pattern}
+ einjection @num as {+ intro_pattern}
+ einjection as {+ intro_pattern}
+
+ These variants apply :n:`intros {+ @intro_pattern}` after the call to
+ :tacn:`injection` or :tacn:`einjection` so that all equalities generated are moved in
+ the context of hypotheses. The number of :n:`@intro_pattern` must not exceed
+ the number of equalities newly generated. If it is smaller, fresh
+ names are automatically generated to adjust the list of :n:`@intro_pattern`
+ to the number of new equalities. The original equality is erased if it
+ corresponds to a hypothesis.
.. flag:: Structural Injection
@@ -2444,8 +2464,10 @@ simply :g:`t=u` dropping the implicit type of :g:`t` and :g:`u`.
subgoals.
.. exn:: The @term provided does not end with an equation.
+ :undocumented:
.. exn:: Tactic generated a subgoal identical to the original goal. This happens if @term does not occur in the goal.
+ :undocumented:
.. tacv:: rewrite -> @term
@@ -2522,6 +2544,7 @@ simply :g:`t=u` dropping the implicit type of :g:`t` and :g:`u`.
:n:`cut @term = @term’; [intro H`:sub:`n` :n:`; rewrite <- H`:sub:`n` :n:`; clear H`:sub:`n`:n:`|| assumption || symmetry; try assumption]`.
.. exn:: Terms do not have convertible types.
+ :undocumented:
.. tacv:: replace @term with @term’ by @tactic
@@ -2544,8 +2567,8 @@ simply :g:`t=u` dropping the implicit type of :g:`t` and :g:`u`.
the form :n:`@term’ = @term`
.. tacv:: replace @term {? with @term} in clause {? by @tactic}
- .. tacv:: replace -> @term in clause
- .. tacv:: replace <- @term in clause
+ replace -> @term in clause
+ replace <- @term in clause
Acts as before but the replacements take place in the specified clause (see
:ref:`performingcomputations`) and not only in the conclusion of the goal. The
@@ -2658,6 +2681,7 @@ simply :g:`t=u` dropping the implicit type of :g:`t` and :g:`u`.
convertible.
.. exn:: Not convertible.
+ :undocumented:
.. tacv:: change @term with @term’
@@ -2670,6 +2694,7 @@ simply :g:`t=u` dropping the implicit type of :g:`t` and :g:`u`.
in the current goal. The terms :n:`@term` and :n:`@term’` must be convertible.
.. exn:: Too few occurrences.
+ :undocumented:
.. tacv:: change @term {? {? at {+ @num}} with @term} in @ident
@@ -2712,12 +2737,9 @@ following:
For backward compatibility, the notation :n:`in {+ @ident}` performs
the conversion in hypotheses :n:`{+ @ident}`.
-.. tacn:: cbv {* flag}
- :name: cbv
-.. tacn:: lazy {* flag}
- :name: lazy
-.. tacn:: compute
- :name: compute
+.. tacn:: cbv {* @flag}
+ lazy {* @flag}
+ :name: cbv; lazy
These parameterized reduction tactics apply to any goal and perform
the normalization of the goal according to the specified flags. In
@@ -2765,7 +2787,8 @@ the conversion in hypotheses :n:`{+ @ident}`.
evaluating purely computational expressions (i.e. with little dead code).
.. tacv:: compute
-.. tacv:: cbv
+ cbv
+ :name: compute; _
These are synonyms for ``cbv beta delta iota zeta``.
@@ -2774,17 +2797,17 @@ the conversion in hypotheses :n:`{+ @ident}`.
This is a synonym for ``lazy beta delta iota zeta``.
.. tacv:: compute {+ @qualid}
-.. tacv:: cbv {+ @qualid}
+ cbv {+ @qualid}
These are synonyms of :n:`cbv beta delta {+ @qualid} iota zeta`.
.. tacv:: compute -{+ @qualid}
-.. tacv:: cbv -{+ @qualid}
+ cbv -{+ @qualid}
These are synonyms of :n:`cbv beta delta -{+ @qualid} iota zeta`.
.. tacv:: lazy {+ @qualid}
-.. tacv:: lazy -{+ @qualid}
+ lazy -{+ @qualid}
These are respectively synonyms of :n:`lazy beta delta {+ @qualid} iota zeta`
and :n:`lazy beta delta -{+ @qualid} iota zeta`.
@@ -2864,9 +2887,8 @@ the conversion in hypotheses :n:`{+ @ident}`.
on transparency and opacity).
.. tacn:: cbn
- :name: cbn
-.. tacn:: simpl
- :name: simpl
+ simpl
+ :name: cbn; simpl
These tactics apply to any goal. They try to reduce a term to
something still readable instead of fully normalizing it. They perform
@@ -2962,7 +2984,7 @@ the conversion in hypotheses :n:`{+ @ident}`.
:g:`succ t` is reduced to :g:`S t`.
.. tacv:: cbn {+ @qualid}
-.. tacv:: cbn -{+ @qualid}
+ cbn -{+ @qualid}
These are respectively synonyms of :n:`cbn beta delta {+ @qualid} iota zeta`
and :n:`cbn beta delta -{+ @qualid} iota zeta` (see :tacn:`cbn`).
@@ -2978,16 +3000,17 @@ the conversion in hypotheses :n:`{+ @ident}`.
matching :n:`@pattern` in the current goal.
.. exn:: Too few occurrences.
+ :undocumented:
.. tacv:: simpl @qualid
-.. tacv:: simpl @string
+ simpl @string
- This applies ``simpl`` only to the applicative subterms whose head occurrence
+ This applies :tacn:`simpl` only to the applicative subterms whose head occurrence
is the unfoldable constant :n:`@qualid` (the constant can be referred to by
its notation using :n:`@string` if such a notation exists).
.. tacv:: simpl @qualid at {+ @num}
-.. tacv:: simpl @string at {+ @num}
+ simpl @string at {+ @num}
This applies ``simpl`` only to the :n:`{+ @num}` applicative subterms whose
head occurrence is :n:`@qualid` (or :n:`@string`).
@@ -3008,6 +3031,7 @@ the conversion in hypotheses :n:`{+ @ident}`.
:math:`\beta`:math:`\iota`-normal form.
.. exn:: @qualid does not denote an evaluable constant.
+ :undocumented:
.. tacv:: unfold @qualid in @ident
@@ -3025,8 +3049,10 @@ the conversion in hypotheses :n:`{+ @ident}`.
unfolded. Occurrences are located from left to right.
.. exn:: Bad occurrence number of @qualid.
+ :undocumented:
.. exn:: @qualid does not occur.
+ :undocumented:
.. tacv:: unfold @string
@@ -3117,6 +3143,7 @@ Conversion tactics applied to hypotheses
Example: :n:`unfold not in (type of H1) (type of H3)`.
.. exn:: No such hypothesis: @ident.
+ :undocumented:
.. _automation:
@@ -3127,38 +3154,41 @@ Automation
.. tacn:: auto
:name: auto
-This tactic implements a Prolog-like resolution procedure to solve the
-current goal. It first tries to solve the goal using the assumption
-tactic, then it reduces the goal to an atomic one using intros and
-introduces the newly generated hypotheses as hints. Then it looks at
-the list of tactics associated to the head symbol of the goal and
-tries to apply one of them (starting from the tactics with lower
-cost). This process is recursively applied to the generated subgoals.
+ This tactic implements a Prolog-like resolution procedure to solve the
+ current goal. It first tries to solve the goal using the assumption
+ tactic, then it reduces the goal to an atomic one using intros and
+ introduces the newly generated hypotheses as hints. Then it looks at
+ the list of tactics associated to the head symbol of the goal and
+ tries to apply one of them (starting from the tactics with lower
+ cost). This process is recursively applied to the generated subgoals.
-By default, auto only uses the hypotheses of the current goal and the
-hints of the database named core.
+ By default, auto only uses the hypotheses of the current goal and the
+ hints of the database named core.
.. tacv:: auto @num
- Forces the search depth to be :n:`@num`. The maximal search depth
- is `5` by default.
+ Forces the search depth to be :token:`num`. The maximal search depth
+ is 5 by default.
.. tacv:: auto with {+ @ident}
- Uses the hint databases :n:`{+ @ident}` in addition to the database core. See
- :ref:`The Hints Databases for auto and eauto <thehintsdatabasesforautoandeauto>` for the list of
- pre-defined databases and the way to create or extend a database.
+ Uses the hint databases :n:`{+ @ident}` in addition to the database core.
+
+ .. seealso::
+ :ref:`The Hints Databases for auto and eauto <thehintsdatabasesforautoandeauto>` for the list of
+ pre-defined databases and the way to create or extend a database.
.. tacv:: auto with *
- Uses all existing hint databases. See
- :ref:`The Hints Databases for auto and eauto <thehintsdatabasesforautoandeauto>`
+ Uses all existing hint databases.
-.. tacv:: auto using {+ @lemma}
+ .. seealso:: :ref:`The Hints Databases for auto and eauto <thehintsdatabasesforautoandeauto>`
- Uses :n:`{+ @lemma}` in addition to hints (can be combined with the with
- :n:`@ident` option). If :n:`@lemma` is an inductive type, it is the
- collection of its constructors which is added as hints.
+.. tacv:: auto using {+ @ident__i} {? with {+ @ident } }
+
+ Uses lemmas :n:`@ident__i` in addition to hints. If :n:`@ident` is an
+ inductive type, it is the collection of its constructors which are added
+ as hints.
.. tacv:: info_auto
@@ -3184,13 +3214,24 @@ hints of the database named core.
equalities like :g:`X=X`.
.. tacv:: trivial with {+ @ident}
+ :undocumented:
+
.. tacv:: trivial with *
+ :undocumented:
+
.. tacv:: trivial using {+ @lemma}
+ :undocumented:
+
.. tacv:: debug trivial
:name: debug trivial
+ :undocumented:
+
.. tacv:: info_trivial
:name: info_trivial
+ :undocumented:
+
.. tacv:: {? info_}trivial {? using {+ @lemma}} {? with {+ @ident}}
+ :undocumented:
.. note::
:tacn:`auto` either solves completely the goal or else leaves it
@@ -3210,26 +3251,26 @@ the :tacn:`auto` and :tacn:`trivial` tactics:
.. tacn:: eauto
:name: eauto
-This tactic generalizes :tacn:`auto`. While :tacn:`auto` does not try
-resolution hints which would leave existential variables in the goal,
-:tacn:`eauto` does try them (informally speaking, it usessimple :tacn:`eapply`
-where :tacn:`auto` uses simple :tacn:`apply`). As a consequence, :tacn:`eauto`
-can solve such a goal:
+ This tactic generalizes :tacn:`auto`. While :tacn:`auto` does not try
+ resolution hints which would leave existential variables in the goal,
+ :tacn:`eauto` does try them (informally speaking, it usessimple :tacn:`eapply`
+ where :tacn:`auto` uses simple :tacn:`apply`). As a consequence, :tacn:`eauto`
+ can solve such a goal:
-.. example::
+ .. example::
- .. coqtop:: all
+ .. coqtop:: all
- Hint Resolve ex_intro.
- Goal forall P:nat -> Prop, P 0 -> exists n, P n.
- eauto.
+ Hint Resolve ex_intro.
+ Goal forall P:nat -> Prop, P 0 -> exists n, P n.
+ eauto.
-Note that ``ex_intro`` should be declared as a hint.
+ Note that ``ex_intro`` should be declared as a hint.
.. tacv:: {? info_}eauto {? @num} {? using {+ @lemma}} {? with {+ @ident}}
- The various options for eauto are the same as for auto.
+ The various options for :tacn:`eauto` are the same as for :tacn:`auto`.
:tacn:`eauto` also obeys the following options:
@@ -3243,13 +3284,12 @@ Note that ``ex_intro`` should be declared as a hint.
.. tacn:: autounfold with {+ @ident}
:name: autounfold
-
-This tactic unfolds constants that were declared through a ``Hint Unfold``
-in the given databases.
+ This tactic unfolds constants that were declared through a :cmd:`Hint Unfold`
+ in the given databases.
.. tacv:: autounfold with {+ @ident} in clause
- Performs the unfolding in the given clause.
+ Performs the unfolding in the given clause.
.. tacv:: autounfold with *
@@ -3258,18 +3298,18 @@ in the given databases.
.. tacn:: autorewrite with {+ @ident}
:name: autorewrite
-This tactic [4]_ carries out rewritings according to the rewriting rule
-bases :n:`{+ @ident}`.
+ This tactic [4]_ carries out rewritings according to the rewriting rule
+ bases :n:`{+ @ident}`.
-Each rewriting rule from the base :n:`@ident` is applied to the main subgoal until
-it fails. Once all the rules have been processed, if the main subgoal has
-progressed (e.g., if it is distinct from the initial main goal) then the rules
-of this base are processed again. If the main subgoal has not progressed then
-the next base is processed. For the bases, the behavior is exactly similar to
-the processing of the rewriting rules.
+ Each rewriting rule from the base :n:`@ident` is applied to the main subgoal until
+ it fails. Once all the rules have been processed, if the main subgoal has
+ progressed (e.g., if it is distinct from the initial main goal) then the rules
+ of this base are processed again. If the main subgoal has not progressed then
+ the next base is processed. For the bases, the behavior is exactly similar to
+ the processing of the rewriting rules.
-The rewriting rule bases are built with the ``Hint Rewrite vernacular``
-command.
+ The rewriting rule bases are built with the :cmd:`Hint Rewrite`
+ command.
.. warning::
@@ -3435,6 +3475,7 @@ The general command to add a hint to some databases :n:`{+ @ident}` is
itself.
.. exn:: @term cannot be used as a hint
+ :undocumented:
.. cmdv:: Immediate {+ @term}
@@ -3448,6 +3489,7 @@ The general command to add a hint to some databases :n:`{+ @ident}` is
:n:`(@ident ...)`, :tacn:`auto` will try to apply each constructor.
.. exn:: @ident is not an inductive type
+ :undocumented:
.. cmdv:: Hint Constructors {+ @ident}
@@ -3616,16 +3658,16 @@ use one or several databases specific to your development.
.. cmd:: Remove Hints {+ @term} : {+ @ident}
-This command removes the hints associated to terms :n:`{+ @term}` in databases
-:n:`{+ @ident}`.
+ This command removes the hints associated to terms :n:`{+ @term}` in databases
+ :n:`{+ @ident}`.
.. _printhint:
.. cmd:: Print Hint
-This command displays all hints that apply to the current goal. It
-fails if no proof is being edited, while the two variants can be used
-at every moment.
+ This command displays all hints that apply to the current goal. It
+ fails if no proof is being edited, while the two variants can be used
+ at every moment.
**Variants:**
@@ -3745,32 +3787,6 @@ Setting implicit automation tactics
Combines in a single line ``Proof with`` and ``Proof using``, see :ref:`proof-editing-mode`
- .. cmd:: Declare Implicit Tactic @tactic
-
- This command declares a tactic to be used to solve implicit arguments
- that Coq does not know how to solve by unification. It is used every
- time the term argument of a tactic has one of its holes not fully
- resolved.
-
- .. deprecated:: 8.9
-
- This command is deprecated. Use :ref:`typeclasses <typeclasses>` or
- :ref:`tactics-in-terms <tactics-in-terms>` instead.
-
- .. example::
-
- .. coqtop:: all
-
- Parameter quo : nat -> forall n:nat, n<>0 -> nat.
- Notation "x // y" := (quo x y _) (at level 40).
- Declare Implicit Tactic assumption.
- Goal forall n m, m<>0 -> { q:nat & { r | q * m + r = n } }.
- intros.
- exists (n // m).
-
- The tactic ``exists (n // m)`` did not fail. The hole was solved
- by ``assumption`` so that it behaved as ``exists (quo n m H)``.
-
.. _decisionprocedures:
Decision procedures
@@ -3779,17 +3795,17 @@ Decision procedures
.. tacn:: tauto
:name: tauto
-This tactic implements a decision procedure for intuitionistic propositional
-calculus based on the contraction-free sequent calculi LJT* of Roy Dyckhoff
-:cite:`Dyc92`. Note that :tacn:`tauto` succeeds on any instance of an
-intuitionistic tautological proposition. :tacn:`tauto` unfolds negations and
-logical equivalence but does not unfold any other definition.
-
-The following goal can be proved by :tacn:`tauto` whereas :tacn:`auto` would
-fail:
+ This tactic implements a decision procedure for intuitionistic propositional
+ calculus based on the contraction-free sequent calculi LJT* of Roy Dyckhoff
+ :cite:`Dyc92`. Note that :tacn:`tauto` succeeds on any instance of an
+ intuitionistic tautological proposition. :tacn:`tauto` unfolds negations and
+ logical equivalence but does not unfold any other definition.
.. example::
+ The following goal can be proved by :tacn:`tauto` whereas :tacn:`auto` would
+ fail:
+
.. coqtop:: reset all
Goal forall (x:nat) (P:nat -> Prop), x = 0 \/ P x -> x <> 0 -> P x.
@@ -3825,27 +3841,24 @@ Therefore, the use of :tacn:`intros` in the previous proof is unnecessary.
.. tacn:: intuition @tactic
:name: intuition
-The tactic :tacn:`intuition` takes advantage of the search-tree built by the
-decision procedure involved in the tactic :tacn:`tauto`. It uses this
-information to generate a set of subgoals equivalent to the original one (but
-simpler than it) and applies the tactic :n:`@tactic` to them :cite:`Mun94`. If
-this tactic fails on some goals then :tacn:`intuition` fails. In fact,
-:tacn:`tauto` is simply :g:`intuition fail`.
+ The tactic :tacn:`intuition` takes advantage of the search-tree built by the
+ decision procedure involved in the tactic :tacn:`tauto`. It uses this
+ information to generate a set of subgoals equivalent to the original one (but
+ simpler than it) and applies the tactic :n:`@tactic` to them :cite:`Mun94`. If
+ this tactic fails on some goals then :tacn:`intuition` fails. In fact,
+ :tacn:`tauto` is simply :g:`intuition fail`.
-For instance, the tactic :g:`intuition auto` applied to the goal
-
-::
-
- (forall (x:nat), P x) /\ B -> (forall (y:nat), P y) /\ P O \/ B /\ P O
+ .. example::
+ For instance, the tactic :g:`intuition auto` applied to the goal::
-internally replaces it by the equivalent one:
-::
+ (forall (x:nat), P x) /\ B -> (forall (y:nat), P y) /\ P O \/ B /\ P O
- (forall (x:nat), P x), B |- P O
+ internally replaces it by the equivalent one::
+ (forall (x:nat), P x), B |- P O
-and then uses :tacn:`auto` which completes the proof.
+ and then uses :tacn:`auto` which completes the proof.
Originally due to César Muñoz, these tactics (:tacn:`tauto` and
:tacn:`intuition`) have been completely re-engineered by David Delahaye using
@@ -3875,25 +3888,25 @@ some incompatibilities.
.. tacn:: rtauto
:name: rtauto
-The :tacn:`rtauto` tactic solves propositional tautologies similarly to what
-:tacn:`tauto` does. The main difference is that the proof term is built using a
-reflection scheme applied to a sequent calculus proof of the goal. The search
-procedure is also implemented using a different technique.
+ The :tacn:`rtauto` tactic solves propositional tautologies similarly to what
+ :tacn:`tauto` does. The main difference is that the proof term is built using a
+ reflection scheme applied to a sequent calculus proof of the goal. The search
+ procedure is also implemented using a different technique.
-Users should be aware that this difference may result in faster proof-search
-but slower proof-checking, and :tacn:`rtauto` might not solve goals that
-:tacn:`tauto` would be able to solve (e.g. goals involving universal
-quantifiers).
+ Users should be aware that this difference may result in faster proof-search
+ but slower proof-checking, and :tacn:`rtauto` might not solve goals that
+ :tacn:`tauto` would be able to solve (e.g. goals involving universal
+ quantifiers).
-Note that this tactic is only available after a ``Require Import Rtauto``.
+ Note that this tactic is only available after a ``Require Import Rtauto``.
.. tacn:: firstorder
:name: firstorder
-The tactic :tacn:`firstorder` is an experimental extension of :tacn:`tauto` to
-first- order reasoning, written by Pierre Corbineau. It is not restricted to
-usual logical connectives but instead may reason about any first-order class
-inductive definition.
+ The tactic :tacn:`firstorder` is an experimental extension of :tacn:`tauto` to
+ first- order reasoning, written by Pierre Corbineau. It is not restricted to
+ usual logical connectives but instead may reason about any first-order class
+ inductive definition.
.. opt:: Firstorder Solver @tactic
:name: Firstorder Solver
@@ -3932,20 +3945,20 @@ inductive definition.
.. tacn:: congruence
:name: congruence
-The tactic :tacn:`congruence`, by Pierre Corbineau, implements the standard
-Nelson and Oppen congruence closure algorithm, which is a decision procedure
-for ground equalities with uninterpreted symbols. It also includes
-constructor theory (see :tacn:`injection` and :tacn:`discriminate`). If the goal
-is a non-quantified equality, congruence tries to prove it with non-quantified
-equalities in the context. Otherwise it tries to infer a discriminable equality
-from those in the context. Alternatively, congruence tries to prove that a
-hypothesis is equal to the goal or to the negation of another hypothesis.
-
-:tacn:`congruence` is also able to take advantage of hypotheses stating
-quantified equalities, but you have to provide a bound for the number of extra
-equalities generated that way. Please note that one of the sides of the
-equality must contain all the quantified variables in order for congruence to
-match against it.
+ The tactic :tacn:`congruence`, by Pierre Corbineau, implements the standard
+ Nelson and Oppen congruence closure algorithm, which is a decision procedure
+ for ground equalities with uninterpreted symbols. It also includes
+ constructor theory (see :tacn:`injection` and :tacn:`discriminate`). If the goal
+ is a non-quantified equality, congruence tries to prove it with non-quantified
+ equalities in the context. Otherwise it tries to infer a discriminable equality
+ from those in the context. Alternatively, congruence tries to prove that a
+ hypothesis is equal to the goal or to the negation of another hypothesis.
+
+ :tacn:`congruence` is also able to take advantage of hypotheses stating
+ quantified equalities, but you have to provide a bound for the number of extra
+ equalities generated that way. Please note that one of the sides of the
+ equality must contain all the quantified variables in order for congruence to
+ match against it.
.. example::
@@ -4006,7 +4019,10 @@ succeeds, and results in an error otherwise.
conversion, casts and universe constraints. It may unify universes.
.. exn:: Not equal.
+ :undocumented:
+
.. exn:: Not equal (due to universes).
+ :undocumented:
.. tacn:: constr_eq_strict @term @term
:name: constr_eq_strict
@@ -4016,7 +4032,10 @@ succeeds, and results in an error otherwise.
constraints.
.. exn:: Not equal.
+ :undocumented:
+
.. exn:: Not equal (due to universes).
+ :undocumented:
.. tacn:: unify @term @term
:name: unify
@@ -4025,6 +4044,7 @@ succeeds, and results in an error otherwise.
instantiating existential variables.
.. exn:: Unable to unify @term with @term.
+ :undocumented:
.. tacv:: unify @term @term with @ident
@@ -4039,6 +4059,7 @@ succeeds, and results in an error otherwise.
by :tacn:`eapply` and some other tactics.
.. exn:: Not an evar.
+ :undocumented:
.. tacn:: has_evar @term
:name: has_evar
@@ -4048,6 +4069,7 @@ succeeds, and results in an error otherwise.
scans all subterms, including those under binders.
.. exn:: No evars.
+ :undocumented:
.. tacn:: is_var @term
:name: is_var
@@ -4056,6 +4078,7 @@ succeeds, and results in an error otherwise.
the current goal context or in the opened sections.
.. exn:: Not a variable or hypothesis.
+ :undocumented:
.. _equality:
@@ -4067,45 +4090,46 @@ Equality
.. tacn:: f_equal
:name: f_equal
-This tactic applies to a goal of the form :g:`f a`:sub:`1` :g:`... a`:sub:`n`
-:g:`= f′a′`:sub:`1` :g:`... a′`:sub:`n`. Using :tacn:`f_equal` on such a goal
-leads to subgoals :g:`f=f′` and :g:`a`:sub:`1` = :g:`a′`:sub:`1` and so on up
-to :g:`a`:sub:`n` :g:`= a′`:sub:`n`. Amongst these subgoals, the simple ones
-(e.g. provable by :tacn:`reflexivity` or :tacn:`congruence`) are automatically
-solved by :tacn:`f_equal`.
+ This tactic applies to a goal of the form :g:`f a`:sub:`1` :g:`... a`:sub:`n`
+ :g:`= f′a′`:sub:`1` :g:`... a′`:sub:`n`. Using :tacn:`f_equal` on such a goal
+ leads to subgoals :g:`f=f′` and :g:`a`:sub:`1` = :g:`a′`:sub:`1` and so on up
+ to :g:`a`:sub:`n` :g:`= a′`:sub:`n`. Amongst these subgoals, the simple ones
+ (e.g. provable by :tacn:`reflexivity` or :tacn:`congruence`) are automatically
+ solved by :tacn:`f_equal`.
.. tacn:: reflexivity
:name: reflexivity
-This tactic applies to a goal that has the form :g:`t=u`. It checks that `t`
-and `u` are convertible and then solves the goal. It is equivalent to
-``apply refl_equal``.
+ This tactic applies to a goal that has the form :g:`t=u`. It checks that `t`
+ and `u` are convertible and then solves the goal. It is equivalent to
+ ``apply refl_equal``.
-.. exn:: The conclusion is not a substitutive equation.
+ .. exn:: The conclusion is not a substitutive equation.
+ :undocumented:
-.. exn:: Unable to unify ... with ...
+ .. exn:: Unable to unify ... with ...
+ :undocumented:
.. tacn:: symmetry
:name: symmetry
-This tactic applies to a goal that has the form :g:`t=u` and changes it into
-:g:`u=t`.
+ This tactic applies to a goal that has the form :g:`t=u` and changes it into
+ :g:`u=t`.
.. tacv:: symmetry in @ident
- If the statement of the hypothesis ident has the form :g:`t=u`, the tactic
- changes it to :g:`u=t`.
-
+ If the statement of the hypothesis ident has the form :g:`t=u`, the tactic
+ changes it to :g:`u=t`.
.. tacn:: transitivity @term
:name: transitivity
-This tactic applies to a goal that has the form :g:`t=u` and transforms it
-into the two subgoals :n:`t=@term` and :n:`@term=u`.
+ This tactic applies to a goal that has the form :g:`t=u` and transforms it
+ into the two subgoals :n:`t=@term` and :n:`@term=u`.
Equality and inductive sets
@@ -4159,10 +4183,10 @@ symbol :g:`=`.
instantiate parameters or hypotheses of :n:`@term`.
.. tacv:: esimplify_eq @num
-.. tacv:: esimplify_eq @term {? with @bindings_list}
- :name: esimplify_eq
+ esimplify_eq @term {? with @bindings_list}
+ :name: esimplify_eq; _
- This works the same as ``simplify_eq`` but if the type of :n:`@term`, or the
+ This works the same as :tacn:`simplify_eq` but if the type of :n:`@term`, or the
type of the hypothesis referred to by :n:`@num`, has uninstantiated
parameters, these parameters are left as existential variables.
@@ -4194,35 +4218,35 @@ Inversion
.. tacn:: functional inversion @ident
:name: functional inversion
-:tacn:`functional inversion` is a tactic that performs inversion on hypothesis
-:n:`@ident` of the form :n:`@qualid {+ @term} = @term` or :n:`@term = @qualid
-{+ @term}` where :n:`@qualid` must have been defined using Function (see
-:ref:`advanced-recursive-functions`). Note that this tactic is only
-available after a ``Require Import FunInd``.
+ :tacn:`functional inversion` is a tactic that performs inversion on hypothesis
+ :n:`@ident` of the form :n:`@qualid {+ @term} = @term` or :n:`@term = @qualid
+ {+ @term}` where :n:`@qualid` must have been defined using Function (see
+ :ref:`advanced-recursive-functions`). Note that this tactic is only
+ available after a ``Require Import FunInd``.
+ .. exn:: Hypothesis @ident must contain at least one Function.
+ :undocumented:
-.. exn:: Hypothesis @ident must contain at least one Function.
-.. exn:: Cannot find inversion information for hypothesis @ident.
+ .. exn:: Cannot find inversion information for hypothesis @ident.
- This error may be raised when some inversion lemma failed to be generated by
- Function.
+ This error may be raised when some inversion lemma failed to be generated by
+ Function.
-.. tacv:: functional inversion @num
+ .. tacv:: functional inversion @num
- This does the same thing as :n:`intros until @num` folowed by
- :n:`functional inversion @ident` where :token:`ident` is the
- identifier for the last introduced hypothesis.
+ This does the same thing as :n:`intros until @num` folowed by
+ :n:`functional inversion @ident` where :token:`ident` is the
+ identifier for the last introduced hypothesis.
-.. tacv:: functional inversion ident qualid
-.. tacv:: functional inversion num qualid
+ .. tacv:: functional inversion @ident @qualid
+ functional inversion @num @qualid
- If the hypothesis :n:`@ident` (or :n:`@num`) has a type of the form
- :n:`@qualid`:sub:`1` :n:`@term`:sub:`1` ... :n:`@term`:sub:`n` :n:`=
- @qualid`:sub:`2` :n:`@term`:sub:`n+1` ... :n:`@term`:sub:`n+m` where
- :n:`@qualid`:sub:`1` and :n:`@qualid`:sub:`2` are valid candidates to
- functional inversion, this variant allows choosing which :n:`@qualid` is
- inverted.
+ If the hypothesis :token:`ident` (or :token:`num`) has a type of the form
+ :n:`@qualid__1 {+ @term__i } = @qualid__2 {+ @term__j }` where
+ :n:`@qualid__1` and :n:`@qualid__2` are valid candidates to
+ functional inversion, this variant allows choosing which :token:`qualid`
+ is inverted.
Classical tactics
-----------------
@@ -4232,15 +4256,14 @@ loaded. A few more tactics are available. Make sure to load the module
using the ``Require Import`` command.
.. tacn:: classical_left
- :name: classical_left
-.. tacv:: classical_right
- :name: classical_right
+ classical_right
+ :name: classical_left; classical_right
- The tactics ``classical_left`` and ``classical_right`` are the analog of the
- left and right but using classical logic. They can only be used for
- disjunctions. Use ``classical_left`` to prove the left part of the
+ These tactics are the analog of :tacn:`left` and :tacn:`right`
+ but using classical logic. They can only be used for
+ disjunctions. Use :tacn:`classical_left` to prove the left part of the
disjunction with the assumption that the negation of right part holds.
- Use ``classical_right`` to prove the right part of the disjunction with
+ Use :tacn:`classical_right` to prove the right part of the disjunction with
the assumption that the negation of left part holds.
.. _tactics-automating:
@@ -4252,93 +4275,92 @@ Automating
.. tacn:: btauto
:name: btauto
-The tactic :tacn:`btauto` implements a reflexive solver for boolean
-tautologies. It solves goals of the form :g:`t = u` where `t` and `u` are
-constructed over the following grammar:
+ The tactic :tacn:`btauto` implements a reflexive solver for boolean
+ tautologies. It solves goals of the form :g:`t = u` where `t` and `u` are
+ constructed over the following grammar:
-.. _btauto_grammar:
+ .. _btauto_grammar:
- .. productionlist:: `sentence`
- t : x
- :∣ true
- :∣ false
- :∣ orb t1 t2
- :∣ andb t1 t2
- :∣ xorb t1 t2
- :∣ negb t
- :∣ if t1 then t2 else t3
+ .. productionlist:: `sentence`
+ t : x
+ :∣ true
+ :∣ false
+ :∣ orb t1 t2
+ :∣ andb t1 t2
+ :∣ xorb t1 t2
+ :∣ negb t
+ :∣ if t1 then t2 else t3
- Whenever the formula supplied is not a tautology, it also provides a
- counter-example.
+ Whenever the formula supplied is not a tautology, it also provides a
+ counter-example.
- Internally, it uses a system very similar to the one of the ring
- tactic.
+ Internally, it uses a system very similar to the one of the ring
+ tactic.
- Note that this tactic is only available after a ``Require Import Btauto``.
+ Note that this tactic is only available after a ``Require Import Btauto``.
-.. exn:: Cannot recognize a boolean equality.
+ .. exn:: Cannot recognize a boolean equality.
- The goal is not of the form :g:`t = u`. Especially note that :tacn:`btauto`
- doesn't introduce variables into the context on its own.
+ The goal is not of the form :g:`t = u`. Especially note that :tacn:`btauto`
+ doesn't introduce variables into the context on its own.
.. tacn:: omega
:name: omega
-The tactic :tacn:`omega`, due to Pierre Crégut, is an automatic decision
-procedure for Presburger arithmetic. It solves quantifier-free
-formulas built with `~`, `\/`, `/\`, `->` on top of equalities,
-inequalities and disequalities on both the type :g:`nat` of natural numbers
-and :g:`Z` of binary integers. This tactic must be loaded by the command
-``Require Import Omega``. See the additional documentation about omega
-(see Chapter :ref:`omega`).
+ The tactic :tacn:`omega`, due to Pierre Crégut, is an automatic decision
+ procedure for Presburger arithmetic. It solves quantifier-free
+ formulas built with `~`, `\/`, `/\`, `->` on top of equalities,
+ inequalities and disequalities on both the type :g:`nat` of natural numbers
+ and :g:`Z` of binary integers. This tactic must be loaded by the command
+ ``Require Import Omega``. See the additional documentation about omega
+ (see Chapter :ref:`omega`).
.. tacn:: ring
:name: ring
+
+ This tactic solves equations upon polynomial expressions of a ring
+ (or semiring) structure. It proceeds by normalizing both hand sides
+ of the equation (w.r.t. associativity, commutativity and
+ distributivity, constant propagation) and comparing syntactically the
+ results.
+
.. tacn:: ring_simplify {+ @term}
:name: ring_simplify
-The :n:`ring` tactic solves equations upon polynomial expressions of a ring
-(or semiring) structure. It proceeds by normalizing both hand sides
-of the equation (w.r.t. associativity, commutativity and
-distributivity, constant propagation) and comparing syntactically the
-results.
-
-:n:`ring_simplify` applies the normalization procedure described above to
-the given terms. The tactic then replaces all occurrences of the terms
-given in the conclusion of the goal by their normal forms. If no term
-is given, then the conclusion should be an equation and both hand
-sides are normalized.
+ This tactic applies the normalization procedure described above to
+ the given terms. The tactic then replaces all occurrences of the terms
+ given in the conclusion of the goal by their normal forms. If no term
+ is given, then the conclusion should be an equation and both hand
+ sides are normalized.
See :ref:`Theringandfieldtacticfamilies` for more information on
the tactic and how to declare new ring structures. All declared field structures
can be printed with the ``Print Rings`` command.
.. tacn:: field
- :name: field
-.. tacn:: field_simplify {+ @term}
- :name: field_simplify
-.. tacn:: field_simplify_eq
- :name: field_simplify_eq
-
-The field tactic is built on the same ideas as ring: this is a
-reflexive tactic that solves or simplifies equations in a field
-structure. The main idea is to reduce a field expression (which is an
-extension of ring expressions with the inverse and division
-operations) to a fraction made of two polynomial expressions.
-
-Tactic :n:`field` is used to solve subgoals, whereas :n:`field_simplify {+ @term}`
-replaces the provided terms by their reduced fraction.
-:n:`field_simplify_eq` applies when the conclusion is an equation: it
-simplifies both hand sides and multiplies so as to cancel
-denominators. So it produces an equation without division nor inverse.
-
-All of these 3 tactics may generate a subgoal in order to prove that
-denominators are different from zero.
-
-See :ref:`Theringandfieldtacticfamilies` for more information on the tactic and how to
-declare new field structures. All declared field structures can be
-printed with the Print Fields command.
+ field_simplify {+ @term}
+ field_simplify_eq
+ :name: field; field_simplify; field_simplify_eq
+
+ The field tactic is built on the same ideas as ring: this is a
+ reflexive tactic that solves or simplifies equations in a field
+ structure. The main idea is to reduce a field expression (which is an
+ extension of ring expressions with the inverse and division
+ operations) to a fraction made of two polynomial expressions.
+
+ Tactic :n:`field` is used to solve subgoals, whereas :n:`field_simplify {+ @term}`
+ replaces the provided terms by their reduced fraction.
+ :n:`field_simplify_eq` applies when the conclusion is an equation: it
+ simplifies both hand sides and multiplies so as to cancel
+ denominators. So it produces an equation without division nor inverse.
+
+ All of these 3 tactics may generate a subgoal in order to prove that
+ denominators are different from zero.
+
+ See :ref:`Theringandfieldtacticfamilies` for more information on the tactic and how to
+ declare new field structures. All declared field structures can be
+ printed with the Print Fields command.
.. example::
@@ -4399,16 +4421,16 @@ Non-logical tactics
.. tacn:: revgoals
:name: revgoals
-This tactics reverses the list of the focused goals.
+ This tactics reverses the list of the focused goals.
-.. example::
+ .. example::
- .. coqtop:: all reset
+ .. coqtop:: all reset
- Parameter P : nat -> Prop.
- Goal P 1 /\ P 2 /\ P 3 /\ P 4 /\ P 5.
- repeat split.
- all: revgoals.
+ Parameter P : nat -> Prop.
+ Goal P 1 /\ P 2 /\ P 3 /\ P 4 /\ P 5.
+ repeat split.
+ all: revgoals.
.. tacn:: shelve
:name: shelve
diff --git a/doc/sphinx/proof-engine/vernacular-commands.rst b/doc/sphinx/proof-engine/vernacular-commands.rst
index a69cf209c7..4bc85f386d 100644
--- a/doc/sphinx/proof-engine/vernacular-commands.rst
+++ b/doc/sphinx/proof-engine/vernacular-commands.rst
@@ -20,10 +20,13 @@ Displaying
Error messages:
.. exn:: @qualid not a defined object.
+ :undocumented:
.. exn:: Universe instance should have length @num.
+ :undocumented:
.. exn:: This object does not support universe names.
+ :undocumented:
.. cmdv:: Print Term @qualid
@@ -81,9 +84,9 @@ and tables:
* A :production:`flag` has a boolean value, such as :flag:`Asymmetric Patterns`.
* An :production:`option` generally has a numeric or string value, such as :opt:`Firstorder Depth`.
* A :production:`table` contains a set of strings or qualids.
-* In addition, some commands provide settings, such as :cmd:`Extraction Language OCaml`.
+* In addition, some commands provide settings, such as :cmd:`Extraction Language`.
-.. FIXME Convert `Extraction Language OCaml` to an option.
+.. FIXME Convert "Extraction Language" to an option.
Flags, options and tables are identified by a series of identifiers, each with an initial
capital letter.
@@ -538,8 +541,7 @@ toplevel. This kind of file is called a *script* for |Coq|. The standard
will use the default extension ``.v``.
.. cmdv:: Load Verbose @ident
-
- .. cmdv:: Load Verbose @string
+ Load Verbose @string
Display, while loading,
the answers of |Coq| to each command (including tactics) contained in
@@ -548,10 +550,13 @@ toplevel. This kind of file is called a *script* for |Coq|. The standard
.. seealso:: Section :ref:`controlling-display`.
.. exn:: Can’t find file @ident on loadpath.
+ :undocumented:
.. exn:: Load is not supported inside proofs.
+ :undocumented:
.. exn:: Files processed by Load cannot leave open proofs.
+ :undocumented:
.. _compiled-files:
@@ -620,6 +625,7 @@ file is a particular case of module called *library file*.
comes from a given package by making explicit its absolute root.
.. exn:: Cannot load qualid: no physical path bound to dirpath.
+ :undocumented:
.. exn:: Cannot find library foo in loadpath.
@@ -684,8 +690,10 @@ file is a particular case of module called *library file*.
where they occur, even if outside a section.
.. exn:: File not found on loadpath: @string.
+ :undocumented:
.. exn:: Loading of ML object file forbidden in a native Coq.
+ :undocumented:
.. cmd:: Print ML Modules
@@ -812,6 +820,7 @@ interactively, they cannot be part of a vernacular file loaded via
over the name of a module or of an object inside a module.
.. exn:: @ident: no such entry.
+ :undocumented:
.. cmdv:: Reset Initial
@@ -953,6 +962,7 @@ Quitting and debugging
it prints a message indicating that the failure did not occur.
.. exn:: The command has not failed!
+ :undocumented:
.. _controlling-display:
@@ -1136,6 +1146,7 @@ described first.
variable nor a constant.
.. exn:: The reference is not unfoldable.
+ :undocumented:
.. cmdv:: Print Strategies
@@ -1166,41 +1177,41 @@ Controlling the locality of commands
.. cmd:: Local @command
-.. cmd:: Global @command
-
-Some commands support a Local or Global prefix modifier to control the
-scope of their effect. There are four kinds of commands:
-
-
-+ Commands whose default is to extend their effect both outside the
- section and the module or library file they occur in. For these
- commands, the Local modifier limits the effect of the command to the
- current section or module it occurs in. As an example, the :cmd:`Coercion`
- and :cmd:`Strategy` commands belong to this category.
-+ Commands whose default behavior is to stop their effect at the end
- of the section they occur in but to extend their effect outside the module or
- library file they occur in. For these commands, the Local modifier limits the
- effect of the command to the current module if the command does not occur in a
- section and the Global modifier extends the effect outside the current
- sections and current module if the command occurs in a section. As an example,
- the :cmd:`Arguments`, :cmd:`Ltac` or :cmd:`Notation` commands belong
- to this category. Notice that a subclass of these commands do not support
- extension of their scope outside sections at all and the Global modifier is not
- applicable to them.
-+ Commands whose default behavior is to stop their effect at the end
- of the section or module they occur in. For these commands, the ``Global``
- modifier extends their effect outside the sections and modules they
- occur in. The :cmd:`Transparent` and :cmd:`Opaque`
- (see Section :ref:`vernac-controlling-the-reduction-strategies`) commands
- belong to this category.
-+ Commands whose default behavior is to extend their effect outside
- sections but not outside modules when they occur in a section and to
- extend their effect outside the module or library file they occur in
- when no section contains them.For these commands, the Local modifier
- limits the effect to the current section or module while the Global
- modifier extends the effect outside the module even when the command
- occurs in a section. The :cmd:`Set` and :cmd:`Unset` commands belong to this
- category.
+ Global @command
+
+ Some commands support a Local or Global prefix modifier to control the
+ scope of their effect. There are four kinds of commands:
+
+
+ + Commands whose default is to extend their effect both outside the
+ section and the module or library file they occur in. For these
+ commands, the Local modifier limits the effect of the command to the
+ current section or module it occurs in. As an example, the :cmd:`Coercion`
+ and :cmd:`Strategy` commands belong to this category.
+ + Commands whose default behavior is to stop their effect at the end
+ of the section they occur in but to extend their effect outside the module or
+ library file they occur in. For these commands, the Local modifier limits the
+ effect of the command to the current module if the command does not occur in a
+ section and the Global modifier extends the effect outside the current
+ sections and current module if the command occurs in a section. As an example,
+ the :cmd:`Arguments`, :cmd:`Ltac` or :cmd:`Notation` commands belong
+ to this category. Notice that a subclass of these commands do not support
+ extension of their scope outside sections at all and the Global modifier is not
+ applicable to them.
+ + Commands whose default behavior is to stop their effect at the end
+ of the section or module they occur in. For these commands, the ``Global``
+ modifier extends their effect outside the sections and modules they
+ occur in. The :cmd:`Transparent` and :cmd:`Opaque`
+ (see Section :ref:`vernac-controlling-the-reduction-strategies`) commands
+ belong to this category.
+ + Commands whose default behavior is to extend their effect outside
+ sections but not outside modules when they occur in a section and to
+ extend their effect outside the module or library file they occur in
+ when no section contains them.For these commands, the Local modifier
+ limits the effect to the current section or module while the Global
+ modifier extends the effect outside the module even when the command
+ occurs in a section. The :cmd:`Set` and :cmd:`Unset` commands belong to this
+ category.
.. _exposing-constants-to-ocaml-libraries:
diff --git a/doc/sphinx/user-extensions/proof-schemes.rst b/doc/sphinx/user-extensions/proof-schemes.rst
index eacd7b4676..418922e9b3 100644
--- a/doc/sphinx/user-extensions/proof-schemes.rst
+++ b/doc/sphinx/user-extensions/proof-schemes.rst
@@ -12,7 +12,7 @@ The ``Scheme`` command is a high-level tool for generating automatically
(possibly mutual) induction principles for given types and sorts. Its
syntax follows the schema:
-.. cmd:: Scheme @ident__1 := Induction for @ident__2 Sort sort {* with @ident__i := Induction for @ident__j Sort sort}
+.. cmd:: Scheme @ident__1 := Induction for @ident__2 Sort @sort {* with @ident__i := Induction for @ident__j Sort @sort}
This command is a high-level tool for generating automatically
(possibly mutual) induction principles for given types and sorts.
@@ -22,10 +22,10 @@ syntax follows the schema:
definitions. Each term :n:`@ident__i` proves a general principle of mutual
induction for objects in type :n:`@ident__j`.
-.. cmdv:: Scheme @ident := Minimality for @ident Sort sort {* with @ident := Minimality for @ident' Sort sort}
+.. cmdv:: Scheme @ident := Minimality for @ident Sort @sort {* with @ident := Minimality for @ident' Sort @sort}
- Same as before but defines a non-dependent elimination principle more
- natural in case of inductively defined relations.
+ Same as before but defines a non-dependent elimination principle more
+ natural in case of inductively defined relations.
.. cmdv:: Scheme Equality for @ident
:name: Scheme Equality
@@ -33,7 +33,7 @@ syntax follows the schema:
Tries to generate a Boolean equality and a proof of the decidability of the usual equality. If `ident`
involves some other inductive types, their equality has to be defined first.
-.. cmdv:: Scheme Induction for @ident Sort sort {* with Induction for @ident Sort sort}
+.. cmdv:: Scheme Induction for @ident Sort @sort {* with Induction for @ident Sort @sort}
If you do not provide the name of the schemes, they will be automatically computed from the
sorts involved (works also with Minimality).
@@ -167,7 +167,7 @@ Combined Scheme
Combined Scheme tree_forest_mutind from tree_forest_ind,forest_tree_ind.
- The type of tree_forest_mutrec will be:
+ The type of tree_forest_mutind will be:
.. coqtop:: all
@@ -195,19 +195,18 @@ Combined Scheme
Generation of induction principles with ``Functional`` ``Scheme``
-----------------------------------------------------------------
-The ``Functional Scheme`` command is a high-level experimental tool for
-generating automatically induction principles corresponding to
-(possibly mutually recursive) functions. First, it must be made
-available via ``Require Import FunInd``. Its syntax then follows the
-schema:
-.. cmd:: Functional Scheme @ident := Induction for ident' Sort sort {* with @ident := Induction for @ident Sort sort}
+.. cmd:: Functional Scheme @ident__0 := Induction for @ident' Sort @sort {* with @ident__i := Induction for @ident__i' Sort @sort}
-where each `ident'ᵢ` is a different mutually defined function
-name (the names must be in the same order as when they were defined). This
-command generates the induction principle for each `identᵢ`, following
-the recursive structure and case analyses of the corresponding function
-identᵢ’.
+ This command is a high-level experimental tool for
+ generating automatically induction principles corresponding to
+ (possibly mutually recursive) functions. First, it must be made
+ available via ``Require Import FunInd``.
+ Each :n:`@ident__i` is a different mutually defined function
+ name (the names must be in the same order as when they were defined). This
+ command generates the induction principle for each :n:`@ident__i`, following
+ the recursive structure and case analyses of the corresponding function
+ :n:`@ident__i'`.
.. warning::
@@ -349,17 +348,17 @@ Generation of inversion principles with ``Derive`` ``Inversion``
:g:`inversion`.
-.. cmdv:: Derive Inversion_clear @ident with forall (x:T), I t Sort sort
+.. cmdv:: Derive Inversion_clear @ident with forall (x:T), I t Sort @sort
When applied, it is equivalent to having inverted the instance with the
tactic inversion replaced by the tactic `inversion_clear`.
-.. cmdv:: Derive Dependent Inversion @ident with forall (x:T), I t Sort sort
+.. cmdv:: Derive Dependent Inversion @ident with forall (x:T), I t Sort @sort
When applied, it is equivalent to having inverted the instance with
the tactic `dependent inversion`.
-.. cmdv:: Derive Dependent Inversion_clear @ident with forall(x:T), I t Sort sort
+.. cmdv:: Derive Dependent Inversion_clear @ident with forall(x:T), I t Sort @sort
When applied, it is equivalent to having inverted the instance
with the tactic `dependent inversion_clear`.
@@ -377,8 +376,8 @@ Generation of inversion principles with ``Derive`` ``Inversion``
Parameter P : nat -> nat -> Prop.
- To generate the inversion lemma for the instance `(Le (S n) m)` and the
- sort `Prop`, we do:
+ To generate the inversion lemma for the instance :g:`(Le (S n) m)` and the
+ sort :g:`Prop`, we do:
.. coqtop:: all
diff --git a/doc/sphinx/user-extensions/syntax-extensions.rst b/doc/sphinx/user-extensions/syntax-extensions.rst
index 2214cbfb34..65df89da6c 100644
--- a/doc/sphinx/user-extensions/syntax-extensions.rst
+++ b/doc/sphinx/user-extensions/syntax-extensions.rst
@@ -31,8 +31,8 @@ Basic notations
.. cmd:: Notation
-A *notation* is a symbolic expression denoting some term or term
-pattern.
+ A *notation* is a symbolic expression denoting some term or term
+ pattern.
A typical notation is the use of the infix symbol ``/\`` to denote the
logical conjunction (and). Such a notation is declared by
diff --git a/engine/eConstr.ml b/engine/eConstr.ml
index cfc4bea85f..96f1ce5e60 100644
--- a/engine/eConstr.ml
+++ b/engine/eConstr.ml
@@ -296,6 +296,8 @@ let decompose_prod_n_assum sigma n c =
let existential_type = Evd.existential_type
+let lift n c = of_constr (Vars.lift n (unsafe_to_constr c))
+
let map_under_context f n c =
let f c = unsafe_to_constr (f (of_constr c)) in
of_constr (Constr.map_under_context f n (unsafe_to_constr c))
@@ -306,137 +308,21 @@ let map_return_predicate f ci p =
let f c = unsafe_to_constr (f (of_constr c)) in
of_constr (Constr.map_return_predicate f ci (unsafe_to_constr p))
-let map_gen userview sigma f c = match kind sigma c with
- | (Rel _ | Meta _ | Var _ | Sort _ | Const _ | Ind _
- | Construct _) -> c
- | Cast (b,k,t) ->
- let b' = f b in
- let t' = f t in
- if b'==b && t' == t then c
- else mkCast (b', k, t')
- | Prod (na,t,b) ->
- let b' = f b in
- let t' = f t in
- if b'==b && t' == t then c
- else mkProd (na, t', b')
- | Lambda (na,t,b) ->
- let b' = f b in
- let t' = f t in
- if b'==b && t' == t then c
- else mkLambda (na, t', b')
- | LetIn (na,b,t,k) ->
- let b' = f b in
- let t' = f t in
- let k' = f k in
- if b'==b && t' == t && k'==k then c
- else mkLetIn (na, b', t', k')
- | App (b,l) ->
- let b' = f b in
- let l' = Array.Smart.map f l in
- if b'==b && l'==l then c
- else mkApp (b', l')
- | Proj (p,t) ->
- let t' = f t in
- if t' == t then c
- else mkProj (p, t')
- | Evar (e,l) ->
- let l' = Array.Smart.map f l in
- if l'==l then c
- else mkEvar (e, l')
- | Case (ci,p,b,bl) when userview ->
- let b' = f b in
- let p' = map_return_predicate f ci p in
- let bl' = map_branches f ci bl in
- if b'==b && p'==p && bl'==bl then c
- else mkCase (ci, p', b', bl')
- | Case (ci,p,b,bl) ->
- let b' = f b in
- let p' = f p in
- let bl' = Array.Smart.map f bl in
- if b'==b && p'==p && bl'==bl then c
- else mkCase (ci, p', b', bl')
- | Fix (ln,(lna,tl,bl)) ->
- let tl' = Array.Smart.map f tl in
- let bl' = Array.Smart.map f bl in
- if tl'==tl && bl'==bl then c
- else mkFix (ln,(lna,tl',bl'))
- | CoFix(ln,(lna,tl,bl)) ->
- let tl' = Array.Smart.map f tl in
- let bl' = Array.Smart.map f bl in
- if tl'==tl && bl'==bl then c
- else mkCoFix (ln,(lna,tl',bl'))
-
-let map_user_view = map_gen true
-let map = map_gen false
-
-let map_with_binders sigma g f l c0 = match kind sigma c0 with
- | (Rel _ | Meta _ | Var _ | Sort _ | Const _ | Ind _
- | Construct _) -> c0
- | Cast (c, k, t) ->
- let c' = f l c in
- let t' = f l t in
- if c' == c && t' == t then c0
- else mkCast (c', k, t')
- | Prod (na, t, c) ->
- let t' = f l t in
- let c' = f (g l) c in
- if t' == t && c' == c then c0
- else mkProd (na, t', c')
- | Lambda (na, t, c) ->
- let t' = f l t in
- let c' = f (g l) c in
- if t' == t && c' == c then c0
- else mkLambda (na, t', c')
- | LetIn (na, b, t, c) ->
- let b' = f l b in
- let t' = f l t in
- let c' = f (g l) c in
- if b' == b && t' == t && c' == c then c0
- else mkLetIn (na, b', t', c')
- | App (c, al) ->
- let c' = f l c in
- let al' = Array.Fun1.Smart.map f l al in
- if c' == c && al' == al then c0
- else mkApp (c', al')
- | Proj (p, t) ->
- let t' = f l t in
- if t' == t then c0
- else mkProj (p, t')
- | Evar (e, al) ->
- let al' = Array.Fun1.Smart.map f l al in
- if al' == al then c0
- else mkEvar (e, al')
- | Case (ci, p, c, bl) ->
- let p' = f l p in
- let c' = f l c in
- let bl' = Array.Fun1.Smart.map f l bl in
- if p' == p && c' == c && bl' == bl then c0
- else mkCase (ci, p', c', bl')
- | Fix (ln, (lna, tl, bl)) ->
- let tl' = Array.Fun1.Smart.map f l tl in
- let l' = iterate g (Array.length tl) l in
- let bl' = Array.Fun1.Smart.map f l' bl in
- if tl' == tl && bl' == bl then c0
- else mkFix (ln,(lna,tl',bl'))
- | CoFix(ln,(lna,tl,bl)) ->
- let tl' = Array.Fun1.Smart.map f l tl in
- let l' = iterate g (Array.length tl) l in
- let bl' = Array.Fun1.Smart.map f l' bl in
- mkCoFix (ln,(lna,tl',bl'))
-
-let iter sigma f c = match kind sigma c with
- | (Rel _ | Meta _ | Var _ | Sort _ | Const _ | Ind _
- | Construct _) -> ()
- | Cast (c,_,t) -> f c; f t
- | Prod (_,t,c) -> f t; f c
- | Lambda (_,t,c) -> f t; f c
- | LetIn (_,b,t,c) -> f b; f t; f c
- | App (c,l) -> f c; Array.iter f l
- | Proj (p,c) -> f c
- | Evar (_,l) -> Array.iter f l
- | Case (_,p,c,bl) -> f p; f c; Array.iter f bl
- | Fix (_,(_,tl,bl)) -> Array.iter f tl; Array.iter f bl
- | CoFix (_,(_,tl,bl)) -> Array.iter f tl; Array.iter f bl
+let map_user_view sigma f c =
+ let f c = unsafe_to_constr (f (of_constr c)) in
+ of_constr (Constr.map_user_view f (unsafe_to_constr (whd_evar sigma c)))
+
+let map sigma f c =
+ let f c = unsafe_to_constr (f (of_constr c)) in
+ of_constr (Constr.map f (unsafe_to_constr (whd_evar sigma c)))
+
+let map_with_binders sigma g f l c =
+ let f l c = unsafe_to_constr (f l (of_constr c)) in
+ of_constr (Constr.map_with_binders g f l (unsafe_to_constr (whd_evar sigma c)))
+
+let iter sigma f c =
+ let f c = f (of_constr c) in
+ Constr.iter f (unsafe_to_constr (whd_evar sigma c))
let iter_with_full_binders sigma g f n c =
let open Context.Rel.Declaration in
@@ -453,31 +339,20 @@ let iter_with_full_binders sigma g f n c =
| Proj (p,c) -> f n c
| Fix (_,(lna,tl,bl)) ->
Array.iter (f n) tl;
- let n' = Array.fold_left2 (fun n na t -> g (LocalAssum (na,t)) n) n lna tl in
+ let n' = Array.fold_left2_i (fun i n na t -> g (LocalAssum (na, lift i t)) n) n lna tl in
Array.iter (f n') bl
| CoFix (_,(lna,tl,bl)) ->
Array.iter (f n) tl;
- let n' = Array.fold_left2 (fun n na t -> g (LocalAssum (na,t)) n) n lna tl in
+ let n' = Array.fold_left2_i (fun i n na t -> g (LocalAssum (na,lift i t)) n) n lna tl in
Array.iter (f n') bl
let iter_with_binders sigma g f n c =
- iter_with_full_binders sigma (fun _ acc -> g acc) f n c
+ let f l c = f l (of_constr c) in
+ Constr.iter_with_binders g f n (unsafe_to_constr (whd_evar sigma c))
-let fold sigma f acc c = match kind sigma c with
- | (Rel _ | Meta _ | Var _ | Sort _ | Const _ | Ind _
- | Construct _) -> acc
- | Cast (c,_,t) -> f (f acc c) t
- | Prod (_,t,c) -> f (f acc t) c
- | Lambda (_,t,c) -> f (f acc t) c
- | LetIn (_,b,t,c) -> f (f (f acc b) t) c
- | App (c,l) -> Array.fold_left f (f acc c) l
- | Proj (p,c) -> f acc c
- | Evar (_,l) -> Array.fold_left f acc l
- | Case (_,p,c,bl) -> Array.fold_left f (f (f acc p) c) bl
- | Fix (_,(lna,tl,bl)) ->
- Array.fold_left2 (fun acc t b -> f (f acc t) b) acc tl bl
- | CoFix (_,(lna,tl,bl)) ->
- Array.fold_left2 (fun acc t b -> f (f acc t) b) acc tl bl
+let fold sigma f acc c =
+ let f acc c = f acc (of_constr c) in
+ Constr.fold f acc (unsafe_to_constr (whd_evar sigma c))
let compare_gen k eq_inst eq_sort eq_constr nargs c1 c2 =
(c1 == c2) || Constr.compare_head_gen_with k k eq_inst eq_sort eq_constr nargs c1 c2
@@ -712,7 +587,7 @@ let to_rel_decl = unsafe_to_rel_decl
type substl = t list
(** Operations that commute with evar-normalization *)
-let lift n c = of_constr (Vars.lift n (to_constr c))
+let lift = lift
let liftn n m c = of_constr (Vars.liftn n m (to_constr c))
let substnl subst n c = of_constr (Vars.substnl (cast_list unsafe_eq subst) n (to_constr c))
diff --git a/engine/termops.ml b/engine/termops.ml
index ada6311067..98300764df 100644
--- a/engine/termops.ml
+++ b/engine/termops.ml
@@ -721,18 +721,16 @@ let map_constr_with_full_binders_gen userview sigma g f l cstr =
let bl' = Array.map (f l) bl in
if p==p' && c==c' && Array.for_all2 (==) bl bl' then cstr else
mkCase (ci, p', c', bl')
- | Fix (ln,(lna,tl,bl)) ->
+ | Fix (ln,(lna,tl,bl as fx)) ->
let tl' = Array.map (f l) tl in
- let l' =
- Array.fold_left2 (fun l na t -> g (RelDecl.LocalAssum (na, t)) l) l lna tl in
+ let l' = fold_rec_types g fx l in
let bl' = Array.map (f l') bl in
if Array.for_all2 (==) tl tl' && Array.for_all2 (==) bl bl'
then cstr
else mkFix (ln,(lna,tl',bl'))
- | CoFix(ln,(lna,tl,bl)) ->
+ | CoFix(ln,(lna,tl,bl as fx)) ->
let tl' = Array.map (f l) tl in
- let l' =
- Array.fold_left2 (fun l na t -> g (RelDecl.LocalAssum (na, t)) l) l lna tl in
+ let l' = fold_rec_types g fx l in
let bl' = Array.map (f l') bl in
if Array.for_all2 (==) tl tl' && Array.for_all2 (==) bl bl'
then cstr
@@ -759,34 +757,17 @@ let fold_constr_with_full_binders sigma g f n acc c =
Constr.fold_with_full_binders g f n acc c
let fold_constr_with_binders sigma g f n acc c =
- fold_constr_with_full_binders sigma (fun _ x -> g x) f n acc c
+ let open EConstr in
+ let f l acc c = f l acc (of_constr c) in
+ let c = Unsafe.to_constr (whd_evar sigma c) in
+ Constr.fold_constr_with_binders g f n acc c
(* [iter_constr_with_full_binders g f acc c] iters [f acc] on the immediate
subterms of [c]; it carries an extra data [acc] which is processed by [g] at
each binder traversal; it is not recursive and the order with which
subterms are processed is not specified *)
-let iter_constr_with_full_binders sigma g f l c =
- let open RelDecl in
- match EConstr.kind sigma c with
- | (Rel _ | Meta _ | Var _ | Sort _ | Const _ | Ind _
- | Construct _) -> ()
- | Cast (c,_, t) -> f l c; f l t
- | Prod (na,t,c) -> f l t; f (g (LocalAssum (na,t)) l) c
- | Lambda (na,t,c) -> f l t; f (g (LocalAssum (na,t)) l) c
- | LetIn (na,b,t,c) -> f l b; f l t; f (g (LocalDef (na,b,t)) l) c
- | App (c,args) -> f l c; Array.iter (f l) args
- | Proj (p,c) -> f l c
- | Evar (_,args) -> Array.iter (f l) args
- | Case (_,p,c,bl) -> f l p; f l c; Array.iter (f l) bl
- | Fix (_,(lna,tl,bl)) ->
- let l' = Array.fold_left2 (fun l na t -> g (LocalAssum (na,t)) l) l lna tl in
- Array.iter (f l) tl;
- Array.iter (f l') bl
- | CoFix (_,(lna,tl,bl)) ->
- let l' = Array.fold_left2 (fun l na t -> g (LocalAssum (na,t)) l) l lna tl in
- Array.iter (f l) tl;
- Array.iter (f l') bl
+let iter_constr_with_full_binders = EConstr.iter_with_full_binders
(***************************)
(* occurs check functions *)
diff --git a/engine/termops.mli b/engine/termops.mli
index 6c3d4fa612..eef8452e64 100644
--- a/engine/termops.mli
+++ b/engine/termops.mli
@@ -88,6 +88,7 @@ val iter_constr_with_full_binders : Evd.evar_map ->
(rel_declaration -> 'a -> 'a) ->
('a -> constr -> unit) -> 'a ->
constr -> unit
+[@@ocaml.deprecated "Use [EConstr.iter_with_full_binders]."]
(**********************************************************************)
diff --git a/engine/univNames.ml b/engine/univNames.ml
index ad91d31f87..1019f8f0c2 100644
--- a/engine/univNames.ml
+++ b/engine/univNames.ml
@@ -36,10 +36,6 @@ type universe_binders = Univ.Level.t Names.Id.Map.t
let empty_binders = Id.Map.empty
-let universe_binders_of_global ref : Name.t array =
- try AUContext.names (Environ.universes_of_global (Global.env ()) ref)
- with Not_found -> [||]
-
let name_universe lvl =
(** Best-effort naming from the string representation of the level. This is
completely hackish and should be solved in upper layers instead. *)
@@ -55,8 +51,8 @@ let compute_instance_binders inst ubinders =
type univ_name_list = Names.lname list
-let universe_binders_with_opt_names ref names =
- let orig = universe_binders_of_global ref in
+let universe_binders_with_opt_names orig names =
+ let orig = AUContext.names orig in
let orig = Array.to_list orig in
let udecl = match names with
| None -> orig
diff --git a/engine/univNames.mli b/engine/univNames.mli
index dc669f45d6..6e68153ac2 100644
--- a/engine/univNames.mli
+++ b/engine/univNames.mli
@@ -29,5 +29,5 @@ type univ_name_list = Names.lname list
of [ref] by [univs] (skipping Anonymous). May error if the lengths mismatch.
Otherwise return the bound universe names registered for [ref]. *)
-val universe_binders_with_opt_names : Names.GlobRef.t ->
+val universe_binders_with_opt_names : AUContext.t ->
univ_name_list option -> universe_binders
diff --git a/gramlib/gramext.ml b/gramlib/gramext.ml
index 72468b540e..43a70ca13b 100644
--- a/gramlib/gramext.ml
+++ b/gramlib/gramext.ml
@@ -149,8 +149,6 @@ let srules rl =
in
Stree t
-external action : 'a -> g_action = "%identity"
-
let is_level_labelled n lev =
match lev.lname with
Some n1 -> n = n1
diff --git a/gramlib/gramext.mli b/gramlib/gramext.mli
index e888508277..8361e21645 100644
--- a/gramlib/gramext.mli
+++ b/gramlib/gramext.mli
@@ -59,7 +59,6 @@ val levels_of_rules :
list ->
'te g_level list
val srules : ('te g_symbol list * g_action) list -> 'te g_symbol
-external action : 'a -> g_action = "%identity"
val eq_symbol : 'a g_symbol -> 'a g_symbol -> bool
val delete_rule_in_level_list :
diff --git a/gramlib/gramlib.mllib b/gramlib/gramlib.mllib
new file mode 100644
index 0000000000..4c915b2b05
--- /dev/null
+++ b/gramlib/gramlib.mllib
@@ -0,0 +1,4 @@
+Ploc
+Plexing
+Gramext
+Grammar
diff --git a/gramlib/grammar.ml b/gramlib/grammar.ml
index 760410894a..dfce26a33a 100644
--- a/gramlib/grammar.ml
+++ b/gramlib/grammar.ml
@@ -5,6 +5,8 @@
open Gramext
open Format
+external gramext_action : 'a -> g_action = "%identity"
+
let rec flatten_tree =
function
DeadEnd -> []
@@ -350,7 +352,7 @@ let top_tree entry =
| LocAct (_, _) | DeadEnd -> raise Stream.Failure
let skip_if_empty bp p strm =
- if Stream.count strm == bp then Gramext.action (fun a -> p strm)
+ if Stream.count strm == bp then gramext_action (fun a -> p strm)
else raise Stream.Failure
let continue entry bp a s son p1 (strm__ : _ Stream.t) =
@@ -359,7 +361,7 @@ let continue entry bp a s son p1 (strm__ : _ Stream.t) =
try p1 strm__ with
Stream.Failure -> raise (Stream.Error (tree_failed entry a s son))
in
- Gramext.action (fun _ -> app act a)
+ gramext_action (fun _ -> app act a)
let do_recover parser_of_tree entry nlevn alevn bp a s son
(strm__ : _ Stream.t) =
@@ -861,8 +863,6 @@ module type S =
val of_parser : string -> (te Stream.t -> 'a) -> 'a e
val parse_token_stream : 'a e -> te Stream.t -> 'a
val print : Format.formatter -> 'a e -> unit
- external obj : 'a e -> te Gramext.g_entry = "%identity"
- val parse_token : 'a e -> te Stream.t -> 'a
end
type ('self, 'a) ty_symbol
type ('self, 'f, 'r) ty_rule
@@ -892,18 +892,11 @@ module type S =
val gram_reinit : te Plexing.lexer -> unit
val clear_entry : 'a Entry.e -> unit
end
- val extend :
- 'a Entry.e -> Gramext.position option ->
- (string option * Gramext.g_assoc option *
- (te Gramext.g_symbol list * Gramext.g_action) list)
- list ->
- unit
val safe_extend :
'a Entry.e -> Gramext.position option ->
(string option * Gramext.g_assoc option * 'a ty_production list)
list ->
unit
- val delete_rule : 'a Entry.e -> te Gramext.g_symbol list -> unit
val safe_delete_rule : 'a Entry.e -> ('a, 'r, 'f) ty_rule -> unit
end
@@ -930,18 +923,6 @@ module GMake (L : GLexerType) =
Obj.magic (parse_parsable e p : Obj.t)
let parse_token_stream (e : 'a e) ts : 'a =
Obj.magic (e.estart 0 ts : Obj.t)
- let _warned_using_parse_token = ref false
- let parse_token (entry : 'a e) ts : 'a =
- (* commented: too often warned in Coq...
- if not warned_using_parse_token.val then do {
- eprintf "<W> use of Entry.parse_token ";
- eprintf "deprecated since 2017-06-16\n%!";
- eprintf "use Entry.parse_token_stream instead\n%! ";
- warned_using_parse_token.val := True
- }
- else ();
- *)
- parse_token_stream entry ts
let name e = e.ename
let of_parser n (p : te Stream.t -> 'a) : 'a e =
{egram = gram; ename = n; elocal = false;
diff --git a/gramlib/grammar.mli b/gramlib/grammar.mli
index 244ab710dc..1e14e557bc 100644
--- a/gramlib/grammar.mli
+++ b/gramlib/grammar.mli
@@ -35,8 +35,6 @@ module type S =
val of_parser : string -> (te Stream.t -> 'a) -> 'a e
val parse_token_stream : 'a e -> te Stream.t -> 'a
val print : Format.formatter -> 'a e -> unit
- external obj : 'a e -> te Gramext.g_entry = "%identity"
- val parse_token : 'a e -> te Stream.t -> 'a
end
type ('self, 'a) ty_symbol
type ('self, 'f, 'r) ty_rule
@@ -67,18 +65,11 @@ module type S =
val gram_reinit : te Plexing.lexer -> unit
val clear_entry : 'a Entry.e -> unit
end
- val extend :
- 'a Entry.e -> Gramext.position option ->
- (string option * Gramext.g_assoc option *
- (te Gramext.g_symbol list * Gramext.g_action) list)
- list ->
- unit
val safe_extend :
'a Entry.e -> Gramext.position option ->
(string option * Gramext.g_assoc option * 'a ty_production list)
list ->
unit
- val delete_rule : 'a Entry.e -> te Gramext.g_symbol list -> unit
val safe_delete_rule : 'a Entry.e -> ('a, 'f, 'r) ty_rule -> unit
end
(** Signature type of the functor [Grammar.GMake]. The types and
diff --git a/grammar/argextend.mlp b/grammar/argextend.mlp
deleted file mode 100644
index 715b8cd23f..0000000000
--- a/grammar/argextend.mlp
+++ /dev/null
@@ -1,221 +0,0 @@
-(************************************************************************)
-(* * The Coq Proof Assistant / The Coq Development Team *)
-(* v * INRIA, CNRS and contributors - Copyright 1999-2018 *)
-(* <O___,, * (see CREDITS file for the list of authors) *)
-(* \VV/ **************************************************************)
-(* // * This file is distributed under the terms of the *)
-(* * GNU Lesser General Public License Version 2.1 *)
-(* * (see LICENSE file for the text of the license) *)
-(************************************************************************)
-
-open Q_util
-
-let loc = Ploc.dummy
-
-IFDEF STRICT THEN
- let ploc_vala x = Ploc.VaVal x
-ELSE
- let ploc_vala x = x
-END
-
-let declare_str_items loc l =
- MLast.StDcl (loc, ploc_vala l) (* correspond to <:str_item< declare $list:l'$ end >> *)
-
-let declare_arg loc s e =
- declare_str_items loc [
- <:str_item< value ($lid:"wit_"^s$, $lid:s$) = $e$ >>;
- (** Prevent the unused variable warning *)
- <:str_item< value _ = ($lid:"wit_"^s$, $lid:s$) >>;
- ]
-
-let mk_extraarg loc s = <:expr< $lid:"wit_"^s$ >>
-
-let rec make_wit loc = function
- | ListArgType t -> <:expr< Genarg.wit_list $make_wit loc t$ >>
- | OptArgType t -> <:expr< Genarg.wit_opt $make_wit loc t$ >>
- | PairArgType (t1,t2) ->
- <:expr< Genarg.wit_pair $make_wit loc t1$ $make_wit loc t2$ >>
- | ExtraArgType s -> mk_extraarg loc s
-
-let is_self s = function
-| ExtraArgType s' -> s = s'
-| _ -> false
-
-let make_rawwit loc arg = <:expr< Genarg.rawwit $make_wit loc arg$ >>
-let make_globwit loc arg = <:expr< Genarg.glbwit $make_wit loc arg$ >>
-let make_topwit loc arg = <:expr< Genarg.topwit $make_wit loc arg$ >>
-
-let make_act loc act pil =
- let rec make = function
- | [] -> <:expr< (fun loc -> $act$) >>
- | ExtNonTerminal (_, None) :: tl -> <:expr< (fun $lid:"_"$ -> $make tl$) >>
- | ExtNonTerminal (_, Some p) :: tl -> <:expr< (fun $lid:p$ -> $make tl$) >>
- | ExtTerminal _ :: tl ->
- <:expr< (fun _ -> $make tl$) >> in
- make (List.rev pil)
-
-let make_prod_item self = function
- | ExtTerminal s -> <:expr< Extend.Atoken (CLexer.terminal $mlexpr_of_string s$) >>
- | ExtNonTerminal (Uentry e, _) when e = self -> <:expr< Extend.Aself >>
- | ExtNonTerminal (g, _) ->
- let base s = <:expr< $lid:s$ >> in
- mlexpr_of_prod_entry_key base g
-
-let rec make_prod self = function
-| [] -> <:expr< Extend.Stop >>
-| item :: prods -> <:expr< Extend.Next $make_prod self prods$ $make_prod_item self item$ >>
-
-let make_rule loc self (prods,act) =
- <:expr< Extend.Rule $make_prod self (List.rev prods)$ $make_act loc act prods$ >>
-
-let is_ident x = function
-| <:expr< $lid:s$ >> -> (s : string) = x
-| _ -> false
-
-let make_extend loc self cl = match cl with
-| [[ExtNonTerminal (Uentry e, Some id)], act] when is_ident id act ->
- (** Special handling of identity arguments by not redeclaring an entry *)
- <:expr< Vernacextend.Arg_alias $lid:e$ >>
-| _ ->
- <:expr< Vernacextend.Arg_rules $mlexpr_of_list (make_rule loc self) (List.rev cl)$ >>
-
-let warning_deprecated prefix s = function
-| None -> ()
-| Some _ ->
- Printf.eprintf "Deprecated [%sTYPED AS] clause in [ARGUMENT EXTEND %s]. \
- Use [TYPED AS] instead.\n%!" prefix s
-
-let get_type s = function
-| None -> None
-| Some typ ->
- if is_self s typ then
- let () = Printf.eprintf "Redundant [TYPED AS] clause in [ARGUMENT EXTEND %s].\n%!" s in
- None
- else Some typ
-
-let declare_tactic_argument loc s (typ, f, g, h) cl =
- let se = mlexpr_of_string s in
- let typ, pr = match typ with
- | `Uniform (typ, pr) ->
- let typ = get_type s typ in
- typ, <:expr< ($lid:pr$, $lid:pr$, $lid:pr$) >>
- | `Specialized (a, rpr, c, gpr, e, tpr) ->
- let () = warning_deprecated "RAW_" s a in
- let () = warning_deprecated "GLOB_" s c in
- let typ = get_type s e in
- typ, <:expr< ($lid:rpr$, $lid:gpr$, $lid:tpr$) >>
- in
- let glob = match g, typ with
- | Some f, (None | Some _) ->
- <:expr< Tacentries.ArgInternFun (fun ist v -> (ist, $lid:f$ ist v)) >>
- | None, Some typ ->
- <:expr< Tacentries.ArgInternWit $make_wit loc typ$ >>
- | None, None ->
- <:expr< Tacentries.ArgInternFun (fun ist v -> (ist, v)) >>
- in
- let interp = match f, typ with
- | Some f, (None | Some _) ->
- <:expr< Tacentries.ArgInterpLegacy $lid:f$ >>
- | None, Some typ ->
- <:expr< Tacentries.ArgInterpWit $make_wit loc typ$ >>
- | None, None ->
- <:expr< Tacentries.ArgInterpRet >>
- in
- let subst = match h, typ with
- | Some f, (None | Some _) ->
- <:expr< Tacentries.ArgSubstFun $lid:f$ >>
- | None, Some typ ->
- <:expr< Tacentries.ArgSubstWit $make_wit loc typ$ >>
- | None, None ->
- <:expr< Tacentries.ArgSubstFun (fun s v -> v) >>
- in
- let dyn = mlexpr_of_option (fun typ -> <:expr< Geninterp.val_tag $make_topwit loc typ$ >>) typ in
- declare_arg loc s <:expr< Tacentries.argument_extend ~{ name = $se$ } {
- Tacentries.arg_parsing = $make_extend loc s cl$;
- Tacentries.arg_tag = $dyn$;
- Tacentries.arg_intern = $glob$;
- Tacentries.arg_subst = $subst$;
- Tacentries.arg_interp = $interp$;
- Tacentries.arg_printer = $pr$
- } >>
-
-let declare_vernac_argument loc s pr cl =
- let se = mlexpr_of_string s in
- let pr_rules = match pr with
- | None -> <:expr< fun _ -> Pp.str $str:"[No printer for "^s^"]"$ >>
- | Some pr -> <:expr< $lid:pr$ >> in
- declare_arg loc s <:expr< Vernacextend.vernac_argument_extend ~{ name = $se$ } {
- Vernacextend.arg_printer = $pr_rules$;
- Vernacextend.arg_parsing = $make_extend loc s cl$
- } >>
-
-open Pcaml
-
-EXTEND
- GLOBAL: str_item;
- str_item:
- [ [ "ARGUMENT"; "EXTEND"; s = entry_name;
- header = argextend_header;
- OPT "|"; l = LIST1 argrule SEP "|";
- "END" ->
- declare_tactic_argument loc s header l
- | "VERNAC"; "ARGUMENT"; "EXTEND"; s = entry_name;
- pr = OPT ["PRINTED"; "BY"; pr = LIDENT -> pr];
- OPT "|"; l = LIST1 argrule SEP "|";
- "END" ->
- declare_vernac_argument loc s pr l ] ]
- ;
- argextend_specialized:
- [ [ rawtyp = OPT [ "RAW_TYPED"; "AS"; rawtyp = argtype -> rawtyp ];
- "RAW_PRINTED"; "BY"; rawpr = LIDENT;
- globtyp = OPT [ "GLOB_TYPED"; "AS"; globtyp = argtype -> globtyp ];
- "GLOB_PRINTED"; "BY"; globpr = LIDENT ->
- (rawtyp, rawpr, globtyp, globpr) ] ]
- ;
- argextend_header:
- [ [ typ = OPT [ "TYPED"; "AS"; typ = argtype -> typ ];
- "PRINTED"; "BY"; pr = LIDENT;
- f = OPT [ "INTERPRETED"; "BY"; f = LIDENT -> f ];
- g = OPT [ "GLOBALIZED"; "BY"; f = LIDENT -> f ];
- h = OPT [ "SUBSTITUTED"; "BY"; f = LIDENT -> f ];
- special = OPT argextend_specialized ->
- let repr = match special with
- | None -> `Uniform (typ, pr)
- | Some (rtyp, rpr, gtyp, gpr) -> `Specialized (rtyp, rpr, gtyp, gpr, typ, pr)
- in
- (repr, f, g, h) ] ]
- ;
- argtype:
- [ "2"
- [ e1 = argtype; "*"; e2 = argtype -> PairArgType (e1, e2) ]
- | "1"
- [ e = argtype; LIDENT "list" -> ListArgType e
- | e = argtype; LIDENT "option" -> OptArgType e ]
- | "0"
- [ e = LIDENT ->
- let e = parse_user_entry e "" in
- type_of_user_symbol e
- | "("; e = argtype; ")" -> e ] ]
- ;
- argrule:
- [ [ "["; l = LIST0 genarg; "]"; "->"; "["; e = Pcaml.expr; "]" -> (l,e) ] ]
- ;
- genarg:
- [ [ e = LIDENT; "("; s = LIDENT; ")" ->
- let e = parse_user_entry e "" in
- ExtNonTerminal (e, Some s)
- | e = LIDENT; "("; s = LIDENT; ","; sep = STRING; ")" ->
- let e = parse_user_entry e sep in
- ExtNonTerminal (e, Some s)
- | e = LIDENT ->
- let e = parse_user_entry e "" in
- ExtNonTerminal (e, None)
- | s = STRING -> ExtTerminal s
- ] ]
- ;
- entry_name:
- [ [ s = LIDENT -> s
- | UIDENT -> failwith "Argument entry names must be lowercase"
- ] ]
- ;
- END
diff --git a/grammar/dune b/grammar/dune
deleted file mode 100644
index 78df2826d6..0000000000
--- a/grammar/dune
+++ /dev/null
@@ -1,41 +0,0 @@
-(library
- (name grammar5)
- (synopsis "Coq Camlp5 Grammar Extensions for Plugins")
- (public_name coq.grammar)
- (flags (:standard -w -58))
- (libraries camlp5))
-
-; Custom camlp5! This is a net speedup, and a preparation for using
-; Dune's preprocessor abilities.
-(rule
- (targets coqmlp5)
- (action (run mkcamlp5.opt pa_o.cmx pa_op.cmx pr_dump.cmx pa_extend.cmx q_MLast.cmx pa_macro.cmx pr_o.cmx -o coqmlp5)))
-
-(rule
- (targets coqp5)
- (action (run mkcamlp5.opt pa_o.cmx pa_op.cmx pr_dump.cmx pa_extend.cmx q_MLast.cmx pa_macro.cmx pr_o.cmx %{dep:grammar5.cmxa} -o coqp5)))
-
-(install
- (section bin)
- (package coq)
- (files coqp5 coqmlp5))
-
-(rule
- (targets q_util.ml)
- (deps (:mlp-file q_util.mlp))
- (action (run coqmlp5 -loc loc -impl %{mlp-file} -o %{targets})))
-
-(rule
- (targets argextend.ml)
- (deps (:mlp-file argextend.mlp))
- (action (run coqmlp5 -loc loc -impl %{mlp-file} -o %{targets})))
-
-(rule
- (targets tacextend.ml)
- (deps (:mlp-file tacextend.mlp))
- (action (run coqmlp5 -loc loc -impl %{mlp-file} -o %{targets})))
-
-(rule
- (targets vernacextend.ml)
- (deps (:mlp-file vernacextend.mlp))
- (action (run coqmlp5 -loc loc -impl %{mlp-file} -o %{targets})))
diff --git a/grammar/q_util.mli b/grammar/q_util.mli
deleted file mode 100644
index b163100fc3..0000000000
--- a/grammar/q_util.mli
+++ /dev/null
@@ -1,54 +0,0 @@
-(************************************************************************)
-(* * The Coq Proof Assistant / The Coq Development Team *)
-(* v * INRIA, CNRS and contributors - Copyright 1999-2018 *)
-(* <O___,, * (see CREDITS file for the list of authors) *)
-(* \VV/ **************************************************************)
-(* // * This file is distributed under the terms of the *)
-(* * GNU Lesser General Public License Version 2.1 *)
-(* * (see LICENSE file for the text of the license) *)
-(************************************************************************)
-
-type argument_type =
-| ListArgType of argument_type
-| OptArgType of argument_type
-| PairArgType of argument_type * argument_type
-| ExtraArgType of string
-
-type user_symbol =
-| Ulist1 of user_symbol
-| Ulist1sep of user_symbol * string
-| Ulist0 of user_symbol
-| Ulist0sep of user_symbol * string
-| Uopt of user_symbol
-| Uentry of string
-| Uentryl of string * int
-
-type extend_token =
-| ExtTerminal of string
-| ExtNonTerminal of user_symbol * string option
-
-val mlexpr_of_list : ('a -> MLast.expr) -> 'a list -> MLast.expr
-
-val mlexpr_of_pair :
- ('a -> MLast.expr) -> ('b -> MLast.expr)
- -> 'a * 'b -> MLast.expr
-
-val mlexpr_of_bool : bool -> MLast.expr
-
-val mlexpr_of_int : int -> MLast.expr
-
-val mlexpr_of_string : string -> MLast.expr
-
-val mlexpr_of_option : ('a -> MLast.expr) -> 'a option -> MLast.expr
-
-val mlexpr_of_name : ('a -> MLast.expr) -> 'a option -> MLast.expr
-
-val mlexpr_of_prod_entry_key : (string -> MLast.expr) -> user_symbol -> MLast.expr
-
-val type_of_user_symbol : user_symbol -> argument_type
-
-val parse_user_entry : string -> string -> user_symbol
-
-val mlexpr_of_symbol : user_symbol -> MLast.expr
-
-val binders_of_tokens : MLast.expr -> extend_token list -> MLast.expr
diff --git a/grammar/q_util.mlp b/grammar/q_util.mlp
deleted file mode 100644
index a2007d258c..0000000000
--- a/grammar/q_util.mlp
+++ /dev/null
@@ -1,150 +0,0 @@
-(************************************************************************)
-(* * The Coq Proof Assistant / The Coq Development Team *)
-(* v * INRIA, CNRS and contributors - Copyright 1999-2018 *)
-(* <O___,, * (see CREDITS file for the list of authors) *)
-(* \VV/ **************************************************************)
-(* // * This file is distributed under the terms of the *)
-(* * GNU Lesser General Public License Version 2.1 *)
-(* * (see LICENSE file for the text of the license) *)
-(************************************************************************)
-
-(* This file defines standard combinators to build ml expressions *)
-
-type argument_type =
-| ListArgType of argument_type
-| OptArgType of argument_type
-| PairArgType of argument_type * argument_type
-| ExtraArgType of string
-
-type user_symbol =
-| Ulist1 of user_symbol
-| Ulist1sep of user_symbol * string
-| Ulist0 of user_symbol
-| Ulist0sep of user_symbol * string
-| Uopt of user_symbol
-| Uentry of string
-| Uentryl of string * int
-
-type extend_token =
-| ExtTerminal of string
-| ExtNonTerminal of user_symbol * string option
-
-let mlexpr_of_list f l =
- List.fold_right
- (fun e1 e2 ->
- let e1 = f e1 in
- let loc = Ploc.encl (MLast.loc_of_expr e1) (MLast.loc_of_expr e2) in
- <:expr< [$e1$ :: $e2$] >>)
- l (let loc = Ploc.dummy in <:expr< [] >>)
-
-let mlexpr_of_pair m1 m2 (a1,a2) =
- let e1 = m1 a1 and e2 = m2 a2 in
- let loc = Ploc.encl (MLast.loc_of_expr e1) (MLast.loc_of_expr e2) in
- <:expr< ($e1$, $e2$) >>
-
-(* We don't give location for tactic quotation! *)
-let loc = Ploc.dummy
-
-
-let mlexpr_of_bool = function
- | true -> <:expr< True >>
- | false -> <:expr< False >>
-
-let mlexpr_of_int n = <:expr< $int:string_of_int n$ >>
-
-let mlexpr_of_string s = <:expr< $str:s$ >>
-
-let mlexpr_of_option f = function
- | None -> <:expr< None >>
- | Some e -> <:expr< Some $f e$ >>
-
-let mlexpr_of_name f = function
- | None -> <:expr< Names.Name.Anonymous >>
- | Some e -> <:expr< Names.Name.Name $f e$ >>
-
-let symbol_of_string s = <:expr< Extend.Atoken (CLexer.terminal $str:s$) >>
-
-let rec mlexpr_of_prod_entry_key f = function
- | Ulist1 s -> <:expr< Extend.Alist1 $mlexpr_of_prod_entry_key f s$ >>
- | Ulist1sep (s,sep) -> <:expr< Extend.Alist1sep $mlexpr_of_prod_entry_key f s$ $symbol_of_string sep$ >>
- | Ulist0 s -> <:expr< Extend.Alist0 $mlexpr_of_prod_entry_key f s$ >>
- | Ulist0sep (s,sep) -> <:expr< Extend.Alist0sep $mlexpr_of_prod_entry_key f s$ $symbol_of_string sep$ >>
- | Uopt s -> <:expr< Extend.Aopt $mlexpr_of_prod_entry_key f s$ >>
- | Uentry e -> <:expr< Extend.Aentry ($f e$) >>
- | Uentryl (e, l) ->
- (** Keep in sync with Pcoq! *)
- assert (e = "tactic");
- if l = 5 then <:expr< Extend.Aentry Pltac.binder_tactic >>
- else <:expr< Extend.Aentryl (Pltac.tactic_expr) $mlexpr_of_string (string_of_int l)$ >>
-
-let rec type_of_user_symbol = function
-| Ulist1 s | Ulist1sep (s, _) | Ulist0 s | Ulist0sep (s, _) ->
- ListArgType (type_of_user_symbol s)
-| Uopt s ->
- OptArgType (type_of_user_symbol s)
-| Uentry e | Uentryl (e, _) -> ExtraArgType e
-
-let coincide s pat off =
- let len = String.length pat in
- let break = ref true in
- let i = ref 0 in
- while !break && !i < len do
- let c = Char.code s.[off + !i] in
- let d = Char.code pat.[!i] in
- break := c = d;
- incr i
- done;
- !break
-
-let check_separator sep =
- if sep <> "" then failwith "Separator is only for arguments with suffix _list_sep."
-
-let rec parse_user_entry s sep =
- let l = String.length s in
- if l > 8 && coincide s "ne_" 0 && coincide s "_list" (l - 5) then
- let entry = parse_user_entry (String.sub s 3 (l-8)) "" in
- check_separator sep;
- Ulist1 entry
- else if l > 12 && coincide s "ne_" 0 &&
- coincide s "_list_sep" (l-9) then
- let entry = parse_user_entry (String.sub s 3 (l-12)) "" in
- Ulist1sep (entry, sep)
- else if l > 5 && coincide s "_list" (l-5) then
- let entry = parse_user_entry (String.sub s 0 (l-5)) "" in
- check_separator sep;
- Ulist0 entry
- else if l > 9 && coincide s "_list_sep" (l-9) then
- let entry = parse_user_entry (String.sub s 0 (l-9)) "" in
- Ulist0sep (entry, sep)
- else if l > 4 && coincide s "_opt" (l-4) then
- let entry = parse_user_entry (String.sub s 0 (l-4)) "" in
- check_separator sep;
- Uopt entry
- else if l = 7 && coincide s "tactic" 0 && '5' >= s.[6] && s.[6] >= '0' then
- let n = Char.code s.[6] - 48 in
- check_separator sep;
- Uentryl ("tactic", n)
- else
- let s = match s with "hyp" -> "var" | _ -> s in
- check_separator sep;
- Uentry s
-
-let rec mlexpr_of_symbol = function
-| Ulist1 s -> <:expr< Extend.TUlist1 $mlexpr_of_symbol s$ >>
-| Ulist1sep (s,sep) -> <:expr< Extend.TUlist1sep $mlexpr_of_symbol s$ $str:sep$ >>
-| Ulist0 s -> <:expr< Extend.TUlist0 $mlexpr_of_symbol s$ >>
-| Ulist0sep (s,sep) -> <:expr< Extend.TUlist0sep $mlexpr_of_symbol s$ $str:sep$ >>
-| Uopt s -> <:expr< Extend.TUopt $mlexpr_of_symbol s$ >>
-| Uentry e ->
- let wit = <:expr< $lid:"wit_"^e$ >> in
- <:expr< Extend.TUentry (Genarg.get_arg_tag $wit$) >>
-| Uentryl (e, l) ->
- assert (e = "tactic");
- let wit = <:expr< $lid:"wit_"^e$ >> in
- <:expr< Extend.TUentryl (Genarg.get_arg_tag $wit$) $mlexpr_of_int l$>>
-
-let rec binders_of_tokens e = function
-| [] -> e
-| ExtNonTerminal(_,None) :: cl -> <:expr< fun _ -> $binders_of_tokens e cl$ >>
-| ExtNonTerminal(_,Some id) :: cl -> <:expr< fun $lid:id$ -> $binders_of_tokens e cl$ >>
-| ExtTerminal _ :: cl -> binders_of_tokens e cl
diff --git a/grammar/tacextend.mlp b/grammar/tacextend.mlp
deleted file mode 100644
index a093f78388..0000000000
--- a/grammar/tacextend.mlp
+++ /dev/null
@@ -1,72 +0,0 @@
-(************************************************************************)
-(* * The Coq Proof Assistant / The Coq Development Team *)
-(* v * INRIA, CNRS and contributors - Copyright 1999-2018 *)
-(* <O___,, * (see CREDITS file for the list of authors) *)
-(* \VV/ **************************************************************)
-(* // * This file is distributed under the terms of the *)
-(* * GNU Lesser General Public License Version 2.1 *)
-(* * (see LICENSE file for the text of the license) *)
-(************************************************************************)
-
-(** WARNING: this file is deprecated; consider modifying coqpp instead. *)
-
-(** Implementation of the TACTIC EXTEND macro. *)
-
-open Q_util
-open Argextend
-
-let plugin_name = <:expr< __coq_plugin_name >>
-
-let rec mlexpr_of_clause = function
-| [] -> <:expr< TyNil >>
-| ExtTerminal s :: cl -> <:expr< TyIdent($str:s$, $mlexpr_of_clause cl$) >>
-| ExtNonTerminal (g, _) :: cl ->
- <:expr< TyArg($mlexpr_of_symbol g$, $mlexpr_of_clause cl$) >>
-
-open Pcaml
-
-EXTEND
- GLOBAL: str_item;
- str_item:
- [ [ "TACTIC"; "EXTEND"; s = tac_name;
- depr = OPT [ "DEPRECATED"; depr = LIDENT -> depr ];
- level = OPT [ "AT"; UIDENT "LEVEL"; level = INT -> level ];
- OPT "|"; l = LIST1 tacrule SEP "|";
- "END" ->
- let level = match level with Some i -> int_of_string i | None -> 0 in
- let level = mlexpr_of_int level in
- let depr = mlexpr_of_option (fun l -> <:expr< $lid:l$ >>) depr in
- let l = <:expr< Tacentries.($mlexpr_of_list (fun x -> x) l$) >> in
- declare_str_items loc [ <:str_item< Tacentries.tactic_extend
- $plugin_name$ $str:s$ ~{ level = $level$ } ?{ deprecation =
- $depr$ } $l$ >> ] ] ]
- ;
- tacrule:
- [ [ "["; l = LIST1 tacargs; "]";
- "->"; "["; e = Pcaml.expr; "]" ->
- let e = <:expr< fun ist -> $e$ >> in
- <:expr< TyML($mlexpr_of_clause l$, $binders_of_tokens e l$) >>
- ] ]
- ;
-
- tacargs:
- [ [ e = LIDENT; "("; s = LIDENT; ")" ->
- let e = parse_user_entry e "" in
- ExtNonTerminal (e, Some s)
- | e = LIDENT; "("; s = LIDENT; ","; sep = STRING; ")" ->
- let e = parse_user_entry e sep in
- ExtNonTerminal (e, Some s)
- | e = LIDENT ->
- let e = parse_user_entry e "" in
- ExtNonTerminal (e, None)
- | s = STRING ->
- let () = if s = "" then failwith "Empty terminal." in
- ExtTerminal s
- ] ]
- ;
- tac_name:
- [ [ s = LIDENT -> s
- | s = UIDENT -> s
- ] ]
- ;
- END
diff --git a/grammar/vernacextend.mlp b/grammar/vernacextend.mlp
deleted file mode 100644
index d44eeef670..0000000000
--- a/grammar/vernacextend.mlp
+++ /dev/null
@@ -1,115 +0,0 @@
-(************************************************************************)
-(* * The Coq Proof Assistant / The Coq Development Team *)
-(* v * INRIA, CNRS and contributors - Copyright 1999-2018 *)
-(* <O___,, * (see CREDITS file for the list of authors) *)
-(* \VV/ **************************************************************)
-(* // * This file is distributed under the terms of the *)
-(* * GNU Lesser General Public License Version 2.1 *)
-(* * (see LICENSE file for the text of the license) *)
-(************************************************************************)
-
-(** Implementation of the VERNAC EXTEND macro. *)
-
-open Q_util
-open Argextend
-
-type rule = {
- r_patt : extend_token list;
- (** The remaining tokens of the parsing rule *)
- r_class : MLast.expr option;
- (** An optional classifier for the STM *)
- r_branch : MLast.expr;
- (** The action performed by this rule. *)
- r_depr : bool;
- (** Whether this entry is deprecated *)
-}
-
-let rec mlexpr_of_clause = function
-| [] -> <:expr< Vernacextend.TyNil >>
-| ExtTerminal s :: cl -> <:expr< Vernacextend.TyTerminal ($str:s$, $mlexpr_of_clause cl$) >>
-| ExtNonTerminal (g, id) :: cl ->
- <:expr< Vernacextend.TyNonTerminal ($mlexpr_of_symbol g$, $mlexpr_of_clause cl$) >>
-
-let make_rule r =
- let ty = mlexpr_of_clause r.r_patt in
- let cmd = binders_of_tokens r.r_branch r.r_patt in
- let make_classifier c = binders_of_tokens c r.r_patt in
- let classif = mlexpr_of_option make_classifier r.r_class in
- <:expr< Vernacextend.TyML ($mlexpr_of_bool r.r_depr$, $ty$, $cmd$, $classif$) >>
-
-let declare_command loc s c nt cl =
- let se = mlexpr_of_string s in
- let c = mlexpr_of_option (fun x -> x) c in
- let rules = mlexpr_of_list make_rule cl in
- declare_str_items loc
- [ <:str_item< Vernacextend.vernac_extend ?{ classifier = $c$ } ~{ command = $se$ } ?{ entry = $nt$ } $rules$ >> ]
-
-open Pcaml
-
-EXTEND
- GLOBAL: str_item;
- str_item:
- [ [ "VERNAC"; "COMMAND"; "EXTEND"; s = UIDENT; c = OPT classification;
- OPT "|"; l = LIST1 rule SEP "|";
- "END" ->
- declare_command loc s c <:expr<None>> l
- | "VERNAC"; "COMMAND"; "FUNCTIONAL"; "EXTEND"; s = UIDENT; c = OPT classification;
- OPT "|"; l = LIST1 fun_rule SEP "|";
- "END" ->
- declare_command loc s c <:expr<None>> l
- | "VERNAC"; nt = LIDENT ; "EXTEND"; s = UIDENT; c = OPT classification;
- OPT "|"; l = LIST1 rule SEP "|";
- "END" ->
- declare_command loc s c <:expr<Some $lid:nt$>> l
- | "DECLARE"; "PLUGIN"; name = STRING ->
- declare_str_items loc [
- <:str_item< value __coq_plugin_name = $str:name$ >>;
- <:str_item< value _ = Mltop.add_known_module __coq_plugin_name >>;
- ]
- ] ]
- ;
- classification:
- [ [ "CLASSIFIED"; "BY"; c = LIDENT -> <:expr< $lid:c$ >>
- | "CLASSIFIED"; "AS"; "SIDEFF" ->
- <:expr< fun _ -> Vernac_classifier.classify_as_sideeff >>
- | "CLASSIFIED"; "AS"; "QUERY" ->
- <:expr< fun _ -> Vernac_classifier.classify_as_query >>
- ] ]
- ;
- deprecation:
- [ [ -> false | "DEPRECATED" -> true ] ]
- ;
- rule:
- [ [ "["; OPT "-"; l = LIST1 args; "]";
- d = deprecation; c = OPT classifier; "->"; "["; e = Pcaml.expr; "]" ->
- let b = <:expr< fun ~{atts} ~{st} -> ( let () = $e$ in st ) >> in
- { r_patt = l; r_class = c; r_branch = b; r_depr = d; }
- ] ]
- ;
- (** The [OPT "-"] argument serves no purpose nowadays, it is left here for
- backward compatibility. *)
- fun_rule:
- [ [ "["; OPT "-"; l = LIST1 args; "]";
- d = deprecation; c = OPT classifier; "->"; "["; e = Pcaml.expr; "]" ->
- { r_patt = l; r_class = c; r_branch = e; r_depr = d; }
- ] ]
- ;
- classifier:
- [ [ "=>"; "["; c = Pcaml.expr; "]" -> <:expr< $c$>> ] ]
- ;
- args:
- [ [ e = LIDENT; "("; s = LIDENT; ")" ->
- let e = parse_user_entry e "" in
- ExtNonTerminal (e, Some s)
- | e = LIDENT; "("; s = LIDENT; ","; sep = STRING; ")" ->
- let e = parse_user_entry e sep in
- ExtNonTerminal (e, Some s)
- | e = LIDENT ->
- let e = parse_user_entry e "" in
- ExtNonTerminal (e, None)
- | s = STRING ->
- ExtTerminal s
- ] ]
- ;
- END
-;;
diff --git a/ide/.merlin.in b/ide/.merlin.in
index 953b5dce4c..4dc6f45550 100644
--- a/ide/.merlin.in
+++ b/ide/.merlin.in
@@ -2,5 +2,7 @@ PKG unix laglgtk2 lablgtk2.sourceview2
S utils
B utils
+S protocol
+B protocol
REC
diff --git a/ide/configwin.ml b/ide/configwin.ml
index 69e8b647ae..24be721631 100644
--- a/ide/configwin.ml
+++ b/ide/configwin.ml
@@ -46,6 +46,6 @@ let modifiers = Configwin_ihm.modifiers
let edit
?(apply=(fun () -> ()))
- title ?width ?height
+ title ?parent ?width ?height
conf_struct_list =
- Configwin_ihm.edit ~with_apply: true ~apply title ?width ?height conf_struct_list
+ Configwin_ihm.edit ~with_apply: true ~apply title ?parent ?width ?height conf_struct_list
diff --git a/ide/configwin.mli b/ide/configwin.mli
index 7616e471db..0ee77d69b5 100644
--- a/ide/configwin.mli
+++ b/ide/configwin.mli
@@ -158,6 +158,7 @@ val custom : ?label: string -> GPack.box -> (unit -> unit) -> bool -> parameter_
val edit :
?apply: (unit -> unit) ->
string ->
+ ?parent:GWindow.window ->
?width:int ->
?height:int ->
configuration_structure list ->
diff --git a/ide/configwin_ihm.ml b/ide/configwin_ihm.ml
index d16efa603d..91695e944e 100644
--- a/ide/configwin_ihm.ml
+++ b/ide/configwin_ihm.ml
@@ -662,12 +662,13 @@ class configuration_box (tt : GData.tooltips) conf_struct =
to configure the various parameters. *)
let edit ?(with_apply=true)
?(apply=(fun () -> ()))
- title ?width ?height
+ title ?parent ?width ?height
conf_struct =
let dialog = GWindow.dialog
~position:`CENTER
~modal: true ~title: title
- ?height ?width
+ ~type_hint:`DIALOG
+ ?parent ?height ?width
()
in
let tooltips = GData.tooltips () in
@@ -807,3 +808,40 @@ let custom ?label box f expand =
custom_expand = expand ;
custom_framed = label ;
}
+
+(* Copying lablgtk question_box + forbidding hiding *)
+
+let question_box ~title ~buttons ?(default=1) ?icon ?parent message =
+ let button_nb = ref 0 in
+ let window = GWindow.dialog ~position:`CENTER ~modal:true ?parent ~type_hint:`DIALOG ~title () in
+ let hbox = GPack.hbox ~border_width:10 ~packing:window#vbox#add () in
+ let bbox = window#action_area in
+ begin match icon with
+ None -> ()
+ | Some i -> hbox#pack i#coerce ~padding:4
+ end;
+ ignore (GMisc.label ~text: message ~packing: hbox#add ());
+ (* the function called to create each button by iterating *)
+ let rec iter_buttons n = function
+ [] ->
+ ()
+ | button_label :: q ->
+ let b = GButton.button ~label: button_label
+ ~packing:(bbox#pack ~expand:true ~padding:4) ()
+ in
+ ignore (b#connect#clicked ~callback:
+ (fun () -> button_nb := n; window#destroy ()));
+ (* If it's the first button then give it the focus *)
+ if n = default then b#grab_default () else ();
+
+ iter_buttons (n+1) q
+ in
+ iter_buttons 1 buttons;
+ ignore (window#connect#destroy ~callback: GMain.Main.quit);
+ window#set_position `CENTER;
+ window#show ();
+ GMain.Main.main ();
+ !button_nb
+
+let message_box ~title ?icon ?parent ?(ok="Ok") message =
+ ignore (question_box ?icon ?parent ~title message ~buttons:[ ok ])
diff --git a/ide/configwin_ihm.mli b/ide/configwin_ihm.mli
index c867ad9127..772a0958ff 100644
--- a/ide/configwin_ihm.mli
+++ b/ide/configwin_ihm.mli
@@ -60,7 +60,17 @@ val edit :
?with_apply:bool ->
?apply:(unit -> unit) ->
string ->
+ ?parent:GWindow.window ->
?width:int ->
?height:int ->
configuration_structure list ->
return_button
+
+val question_box : title:string ->
+ buttons:string list ->
+ ?default:int -> ?icon:#GObj.widget ->
+ ?parent:GWindow.window -> string -> int
+
+val message_box :
+ title:string -> ?icon:#GObj.widget ->
+ ?parent:GWindow.window -> ?ok:string -> string -> unit
diff --git a/ide/coqide.ml b/ide/coqide.ml
index a26f7d1b94..40b8d2f484 100644
--- a/ide/coqide.ml
+++ b/ide/coqide.ml
@@ -103,7 +103,8 @@ let make_coqtop_args fname =
with
| None -> "", base_args
| Some proj ->
- proj, coqtop_args_from_project (read_project_file proj) @ base_args
+ let warning_fn x = Feedback.msg_warning Pp.(str x) in
+ proj, coqtop_args_from_project (read_project_file ~warning_fn proj) @ base_args
in
let args = match fname with
| None -> args
@@ -112,7 +113,6 @@ let make_coqtop_args fname =
else "-topfile"::fname::args
in
proj, args
-;;
(** Setting drag & drop on widgets *)
@@ -190,8 +190,8 @@ let load_file ?(maycreate=false) f =
let confirm_save ok =
if ok then flash_info "Saved" else warning "Save Failed"
-let select_and_save ~saveas ?filename sn =
- let do_save = if saveas then sn.fileops#saveas else sn.fileops#save in
+let select_and_save ?parent ~saveas ?filename sn =
+ let do_save = if saveas then sn.fileops#saveas ?parent else sn.fileops#save in
let title = if saveas then "Save file as" else "Save file" in
match select_file_for_save ~title ?filename () with
|None -> false
@@ -201,9 +201,9 @@ let select_and_save ~saveas ?filename sn =
if ok then sn.tab_label#set_text (Filename.basename f);
ok
-let check_save ~saveas sn =
+let check_save ?parent ~saveas sn =
try match sn.fileops#filename with
- |None -> select_and_save ~saveas sn
+ |None -> select_and_save ?parent ~saveas sn
|Some f ->
let ok = sn.fileops#save f in
confirm_save ok;
@@ -212,16 +212,17 @@ let check_save ~saveas sn =
exception DontQuit
-let check_quit saveall =
+let check_quit ?parent saveall =
(try save_pref () with _ -> flash_info "Cannot save preferences");
let is_modified sn = sn.buffer#modified in
if List.exists is_modified notebook#pages then begin
- let answ = GToolbox.question_box ~title:"Quit"
+ let answ = Configwin_ihm.question_box ~title:"Quit"
~buttons:["Save Named Buffers and Quit";
"Quit without Saving";
"Don't Quit"]
~default:0
~icon:(warn_image ())#coerce
+ ?parent
"There are unsaved buffers"
in
match answ with
@@ -278,15 +279,15 @@ let load _ =
| None -> ()
| Some f -> FileAux.load_file f
-let save _ = on_current_term (FileAux.check_save ~saveas:false)
+let save ?parent _ = on_current_term (FileAux.check_save ?parent ~saveas:false)
-let saveas sn =
+let saveas ?parent sn =
try
let filename = sn.fileops#filename in
- ignore (FileAux.select_and_save ~saveas:true ?filename sn)
+ ignore (FileAux.select_and_save ?parent ~saveas:true ?filename sn)
with _ -> warning "Save Failed"
-let saveas = cb_on_current_term saveas
+let saveas ?parent = cb_on_current_term (saveas ?parent)
let saveall _ =
List.iter
@@ -297,33 +298,34 @@ let saveall _ =
let () = Coq.save_all := saveall
-let revert_all _ =
+let revert_all ?parent _ =
List.iter
- (fun sn -> if sn.fileops#changed_on_disk then sn.fileops#revert)
+ (fun sn -> if sn.fileops#changed_on_disk then sn.fileops#revert ?parent ())
notebook#pages
-let quit _ =
- try FileAux.check_quit saveall; exit 0
+let quit ?parent _ =
+ try FileAux.check_quit ?parent saveall; exit 0
with FileAux.DontQuit -> ()
-let close_buffer sn =
+let close_buffer ?parent sn =
let do_remove () = notebook#remove_page notebook#current_page in
if not sn.buffer#modified then do_remove ()
else
- let answ = GToolbox.question_box ~title:"Close"
+ let answ = Configwin_ihm.question_box ~title:"Close"
~buttons:["Save Buffer and Close";
"Close without Saving";
"Don't Close"]
~default:0
~icon:(warn_image ())#coerce
+ ?parent
"This buffer has unsaved modifications"
in
match answ with
- | 1 when FileAux.check_save ~saveas:true sn -> do_remove ()
+ | 1 when FileAux.check_save ?parent ~saveas:true sn -> do_remove ()
| 2 -> do_remove ()
| _ -> ()
-let close_buffer = cb_on_current_term close_buffer
+let close_buffer ?parent = cb_on_current_term (close_buffer ?parent)
let export kind sn =
match sn.fileops#filename with
@@ -434,16 +436,16 @@ let coq_makefile sn =
let coq_makefile = cb_on_current_term coq_makefile
-let editor sn =
+let editor ?parent sn =
match sn.fileops#filename with
|None -> warning "Call to external editor available only on named files"
|Some f ->
File.save ();
let f = Filename.quote f in
let cmd = Util.subst_command_placeholder cmd_editor#get f in
- run_command ignore (fun _ -> sn.fileops#revert) cmd
+ run_command ignore (fun _ -> sn.fileops#revert ?parent ()) cmd
-let editor = cb_on_current_term editor
+let editor ?parent = cb_on_current_term (editor ?parent)
let compile sn =
File.save ();
@@ -945,7 +947,7 @@ let build_ui () =
try w#set_icon (Some (GdkPixbuf.from_file (MiscMenu.coq_icon ())))
with _ -> ()
in
- let _ = w#event#connect#delete ~callback:(fun _ -> File.quit (); true) in
+ let _ = w#event#connect#delete ~callback:(fun _ -> File.quit ~parent:w (); true) in
let _ = set_drag w#drag in
let vbox = GPack.vbox ~homogeneous:false ~packing:w#add () in
@@ -971,18 +973,18 @@ let build_ui () =
item "File" ~label:"_File";
item "New" ~callback:File.newfile ~stock:`NEW;
item "Open" ~callback:File.load ~stock:`OPEN;
- item "Save" ~callback:File.save ~stock:`SAVE ~tooltip:"Save current buffer";
- item "Save as" ~label:"S_ave as" ~stock:`SAVE_AS ~callback:File.saveas;
+ item "Save" ~callback:(File.save ~parent:w) ~stock:`SAVE ~tooltip:"Save current buffer";
+ item "Save as" ~label:"S_ave as" ~stock:`SAVE_AS ~callback:(File.saveas ~parent:w);
item "Save all" ~label:"Sa_ve all" ~callback:File.saveall;
item "Revert all buffers" ~label:"_Revert all buffers"
- ~callback:File.revert_all ~stock:`REVERT_TO_SAVED;
+ ~callback:(File.revert_all ~parent:w) ~stock:`REVERT_TO_SAVED;
item "Close buffer" ~label:"_Close buffer" ~stock:`CLOSE
- ~callback:File.close_buffer ~tooltip:"Close current buffer";
+ ~callback:(File.close_buffer ~parent:w) ~tooltip:"Close current buffer";
item "Print..." ~label:"_Print..."
~callback:File.print ~stock:`PRINT ~accel:"<Ctrl>p";
item "Rehighlight" ~label:"Reh_ighlight" ~accel:"<Ctrl>l"
~callback:File.highlight ~stock:`REFRESH;
- item "Quit" ~stock:`QUIT ~callback:File.quit;
+ item "Quit" ~stock:`QUIT ~callback:(File.quit ~parent:w);
];
menu export_menu [
@@ -1013,14 +1015,12 @@ let build_ui () =
item "Find Previous" ~label:"Find _Previous" ~stock:`GO_UP
~accel:"<Shift>F3"
~callback:(cb_on_current_term (fun t -> t.finder#find_backward ()));
- item "Complete Word" ~label:"Complete Word" ~accel:"<Ctrl>slash"
- ~callback:(fun _ -> ());
item "External editor" ~label:"External editor" ~stock:`EDIT
- ~callback:External.editor;
+ ~callback:(External.editor ~parent:w);
item "Preferences" ~accel:"<Ctrl>comma" ~stock:`PREFERENCES
~callback:(fun _ ->
begin
- try Preferences.configure ~apply:refresh_notebook_pos ()
+ try Preferences.configure ~apply:refresh_notebook_pos w
with _ -> flash_info "Cannot save preferences"
end;
reset_revert_timer ());
@@ -1309,8 +1309,8 @@ let build_ui () =
(Gdk.Bitmap.create_from_data ~width:2 ~height:2 "\x01\x02"));
(* Showtime ! *)
- w#show ()
-
+ w#show ();
+ w
(** {2 Coqide main function } *)
@@ -1325,7 +1325,7 @@ let make_scratch_buffer () =
()
let main files =
- build_ui ();
+ let w = build_ui () in
reset_revert_timer ();
reset_autosave_timer ();
(match files with
@@ -1334,8 +1334,8 @@ let main files =
notebook#goto_page 0;
MiscMenu.initial_about ();
on_current_term (fun t -> t.script#misc#grab_focus ());
- Minilib.log "End of Coqide.main"
-
+ Minilib.log "End of Coqide.main";
+ w
(** {2 Argument parsing } *)
@@ -1355,7 +1355,8 @@ let read_coqide_args argv =
if project_files <> None then
(output_string stderr "Error: multiple -f options"; exit 1);
let d = CUnix.canonical_path_name (Filename.dirname file) in
- let p = CoqProject_file.read_project_file file in
+ let warning_fn x = Format.eprintf "%s@\n%!" x in
+ let p = CoqProject_file.read_project_file ~warning_fn file in
filter_coqtop coqtop (Some (d,p)) out args
|"-f" :: [] ->
output_string stderr "Error: missing project file name"; exit 1
@@ -1391,9 +1392,9 @@ let signals_to_crash =
[Sys.sigabrt; Sys.sigalrm; Sys.sigfpe; Sys.sighup;
Sys.sigill; Sys.sigpipe; Sys.sigquit; Sys.sigusr1; Sys.sigusr2]
-let set_signal_handlers () =
+let set_signal_handlers ?parent () =
try
- Sys.set_signal Sys.sigint (Sys.Signal_handle File.quit);
+ Sys.set_signal Sys.sigint (Sys.Signal_handle (File.quit ?parent));
List.iter
(fun i -> Sys.set_signal i (Sys.Signal_handle FileAux.crash_save))
signals_to_crash
diff --git a/ide/coqide.mli b/ide/coqide.mli
index 03e8545377..1d438ec381 100644
--- a/ide/coqide.mli
+++ b/ide/coqide.mli
@@ -22,7 +22,7 @@ val logfile : string option ref
val read_coqide_args : string list -> string list
(** Prepare the widgets, load the given files in tabs *)
-val main : string list -> unit
+val main : string list -> GWindow.window
(** Function to save anything and kill all coqtops
@return [false] if you're allowed to quit. *)
@@ -37,7 +37,7 @@ val do_load : string -> unit
(** Set coqide to perform a clean quit at Ctrl-C, while launching
[crash_save] and exiting for others received signals *)
-val set_signal_handlers : unit -> unit
+val set_signal_handlers : ?parent:GWindow.window -> unit -> unit
(** Emergency saving of opened files as "foo.v.crashcoqide",
and exit (if the integer isn't 127). *)
diff --git a/ide/coqide_main.ml b/ide/coqide_main.ml
index 91e8be875a..21f513b8f4 100644
--- a/ide/coqide_main.ml
+++ b/ide/coqide_main.ml
@@ -8,7 +8,6 @@
(* * (see LICENSE file for the text of the license) *)
(************************************************************************)
-let _ = Coqide.set_signal_handlers ()
let _ = GtkMain.Main.init ()
(* We handle Gtk warning messages ourselves :
@@ -62,7 +61,8 @@ let () =
let args = List.filter (fun x -> not (List.mem x files)) argl in
Coq.check_connection args;
Coqide.sup_args := args;
- Coqide.main files;
+ let w = Coqide.main files in
+ Coqide.set_signal_handlers ~parent:w ();
Coqide_os_specific.init ();
try
GMain.main ();
diff --git a/ide/coqide_ui.ml b/ide/coqide_ui.ml
index 91c529932f..c994898a4f 100644
--- a/ide/coqide_ui.ml
+++ b/ide/coqide_ui.ml
@@ -60,7 +60,6 @@ let init () =
\n <menuitem action='Find' />\
\n <menuitem action='Find Next' />\
\n <menuitem action='Find Previous' />\
-\n <menuitem action='Complete Word' />\
\n <separator />\
\n <menuitem action='External editor' />\
\n <separator />\
diff --git a/ide/dune b/ide/dune
index aeb5424aff..5e3886624c 100644
--- a/ide/dune
+++ b/ide/dune
@@ -43,3 +43,14 @@
(package coqide)
(modules coqide_main)
(libraries coqide.gui))
+
+; FIXME: we should install those in share/coqide. We better do this
+; once the make-based system has been phased out.
+(install
+ (section share_root)
+ (package coqide)
+ (files
+ (coq.png as coq/coq.png)
+ (coq_style.xml as coq/coq_style.xml)
+ (coq.lang as coq/coq.lang)
+ (coq-ssreflect.lang as coq/coq-ssreflect.lang)))
diff --git a/ide/fileOps.ml b/ide/fileOps.ml
index 7acd2c37a9..e4c8942cf1 100644
--- a/ide/fileOps.ml
+++ b/ide/fileOps.ml
@@ -18,10 +18,10 @@ object
method filename : string option
method update_stats : unit
method changed_on_disk : bool
- method revert : unit
+ method revert : ?parent:GWindow.window -> unit -> unit
method auto_save : unit
method save : string -> bool
- method saveas : string -> bool
+ method saveas : ?parent:GWindow.window -> string -> bool
end
class fileops (buffer:GText.buffer) _fn (reset_handler:unit->unit) =
@@ -48,7 +48,7 @@ object(self)
false
|_ -> false
- method revert =
+ method revert ?parent () =
let do_revert f =
push_info "Reverting buffer";
try
@@ -72,13 +72,14 @@ object(self)
| Some f ->
if not buffer#modified then do_revert f
else
- let answ = GToolbox.question_box
+ let answ = Configwin_ihm.question_box
~title:"Modified buffer changed on disk"
~buttons:["Revert from File";
"Overwrite File";
"Disable Auto Revert"]
~default:0
~icon:(stock_to_widget `DIALOG_WARNING)
+ ?parent
"Some unsaved buffers changed on disk"
in
match answ with
@@ -102,13 +103,14 @@ object(self)
end
else false
- method saveas f =
+ method saveas ?parent f =
if not (Sys.file_exists f) then self#save f
else
- let answ = GToolbox.question_box ~title:"File exists on disk"
+ let answ = Configwin_ihm.question_box ~title:"File exists on disk"
~buttons:["Overwrite"; "Cancel";]
~default:1
~icon:(warn_image ())#coerce
+ ?parent
("File "^f^" already exists")
in
match answ with
diff --git a/ide/fileOps.mli b/ide/fileOps.mli
index 9a1f0cb738..44a19f9981 100644
--- a/ide/fileOps.mli
+++ b/ide/fileOps.mli
@@ -16,10 +16,10 @@ object
method filename : string option
method update_stats : unit
method changed_on_disk : bool
- method revert : unit
+ method revert : ?parent:GWindow.window -> unit -> unit
method auto_save : unit
method save : string -> bool
- method saveas : string -> bool
+ method saveas : ?parent:GWindow.window -> string -> bool
end
class fileops : GText.buffer -> string option -> (unit -> unit) -> ops
diff --git a/ide/idetop.ml b/ide/idetop.ml
index 8a221a93e9..8cb02190e6 100644
--- a/ide/idetop.ml
+++ b/ide/idetop.ml
@@ -212,25 +212,20 @@ let goals () =
if Proof_diffs.show_diffs () then begin
let oldp = Stm.get_prev_proof ~doc (Stm.get_current_state ~doc) in
let diff_goal_map = Proof_diffs.make_goal_map oldp newp in
- let map_goal_for_diff ng = (* todo: move to proof_diffs.ml *)
- try Evar.Map.find ng diff_goal_map with Not_found -> ng
- in
let process_goal_diffs nsigma ng =
let open Evd in
- let og = map_goal_for_diff ng in
let og_s = match oldp with
| Some oldp ->
let (_,_,_,_,osigma) = Proof.proof oldp in
- Some { it = og; sigma = osigma }
+ (try Some { it = Evar.Map.find ng diff_goal_map; sigma = osigma }
+ with Not_found -> raise (Pp_diff.Diff_Failure "Unable to match goals between old and new proof states (6)"))
| None -> None
in
let (hyps_pp_list, concl_pp) = Proof_diffs.diff_goal_ide og_s ng nsigma in
{ Interface.goal_hyp = hyps_pp_list; Interface.goal_ccl = concl_pp; Interface.goal_id = Goal.uid ng }
in
- try
- Some (export_pre_goals (Proof.map_structured_proof newp process_goal_diffs))
- with Pp_diff.Diff_Failure _ -> Some (export_pre_goals (Proof.map_structured_proof newp process_goal))
+ Some (export_pre_goals (Proof.map_structured_proof newp process_goal_diffs))
end else
Some (export_pre_goals (Proof.map_structured_proof newp process_goal))
with Proof_global.NoCurrentProof -> None;;
diff --git a/ide/nanoPG.ml b/ide/nanoPG.ml
index 002722ace9..f2913b1d1d 100644
--- a/ide/nanoPG.ml
+++ b/ide/nanoPG.ml
@@ -153,13 +153,13 @@ let emacs = insert emacs "Emacs" [] [
i#forward_sentence_end, { s with move = None }));
mkE ~mods:mM _a "a" "Move to beginning of sentence" (Motion(fun s i ->
i#backward_sentence_start, { s with move = None }));
- mkE _n "n" "Move to next line" ~alias:[[],_Down,"DOWN"] (Motion(fun s i ->
+ mkE _n "n" "Move to next line" (Motion(fun s i ->
let orig_off = Option.default i#line_offset s.move in
let i = i#forward_line in
let new_off = min (i#chars_in_line - 1) orig_off in
(if new_off > 0 then i#set_line_offset new_off else i),
{ s with move = Some orig_off }));
- mkE _p "p" "Move to previous line" ~alias:[[],_Up,"UP"] (Motion(fun s i ->
+ mkE _p "p" "Move to previous line" (Motion(fun s i ->
let orig_off = Option.default i#line_offset s.move in
let i = i#backward_line in
let new_off = min (i#chars_in_line - 1) orig_off in
diff --git a/ide/preferences.ml b/ide/preferences.ml
index 6dc922c225..045d650c1c 100644
--- a/ide/preferences.ml
+++ b/ide/preferences.ml
@@ -688,7 +688,7 @@ let pmodifiers ?(all = false) name p = modifiers
name
(str_to_mod_list p#get)
-let configure ?(apply=(fun () -> ())) () =
+let configure ?(apply=(fun () -> ())) parent =
let cmd_coqtop =
string
~f:(fun s -> cmd_coqtop#set (if s = "AUTO" then None else Some s))
@@ -1068,7 +1068,7 @@ let configure ?(apply=(fun () -> ())) () =
(*
Format.printf "before edit: current.text_font = %s@." (Pango.Font.to_string current.text_font);
*)
- let x = edit ~apply "Customizations" cmds in
+ let x = edit ~apply "Customizations" ~parent cmds in
(*
Format.printf "after edit: current.text_font = %s@." (Pango.Font.to_string current.text_font);
*)
diff --git a/ide/preferences.mli b/ide/preferences.mli
index dd2976efc2..7ed6a40bdb 100644
--- a/ide/preferences.mli
+++ b/ide/preferences.mli
@@ -107,7 +107,7 @@ val diffs : string preference
val save_pref : unit -> unit
val load_pref : unit -> unit
-val configure : ?apply:(unit -> unit) -> unit -> unit
+val configure : ?apply:(unit -> unit) -> GWindow.window -> unit
val stick : 'a preference ->
(#GObj.widget as 'obj) -> ('a -> unit) -> unit
diff --git a/interp/constrextern.ml b/interp/constrextern.ml
index 838ef40545..70ce6cef19 100644
--- a/interp/constrextern.ml
+++ b/interp/constrextern.ml
@@ -716,20 +716,20 @@ let rec flatten_application c = match DAst.get c with
(* one with no delimiter if possible) *)
let extern_possible_prim_token (custom,scopes) r =
- try
- let (sc,n) = uninterp_prim_token r in
- match availability_of_entry_coercion custom InConstrEntrySomeLevel with
- | None -> raise No_match
- | Some coercion ->
- match availability_of_prim_token n sc scopes with
- | None -> None
- | Some key -> Some (insert_coercion coercion (insert_delimiters (CAst.make ?loc:(loc_of_glob_constr r) @@ CPrim n) key))
- with No_match ->
- None
-
-let extern_optimal_prim_token scopes r r' =
- let c = extern_possible_prim_token scopes r in
- let c' = if r==r' then None else extern_possible_prim_token scopes r' in
+ let (sc,n) = uninterp_prim_token r in
+ match availability_of_entry_coercion custom InConstrEntrySomeLevel with
+ | None -> raise No_match
+ | Some coercion ->
+ match availability_of_prim_token n sc scopes with
+ | None -> raise No_match
+ | Some key -> insert_coercion coercion (insert_delimiters (CAst.make ?loc:(loc_of_glob_constr r) @@ CPrim n) key)
+
+let extern_possible extern r =
+ try Some (extern r) with No_match -> None
+
+let extern_optimal extern r r' =
+ let c = extern_possible extern r in
+ let c' = if r==r' then None else extern_possible extern r' in
match c,c' with
| Some n, (Some ({ CAst.v = CDelimiters _}) | None) | _, Some n -> n
| _ -> raise No_match
@@ -769,12 +769,14 @@ let rec extern inctx scopes vars r =
let r' = remove_coercions inctx r in
try
if !Flags.raw_print || !print_no_symbol then raise No_match;
- extern_optimal_prim_token scopes r r'
+ extern_optimal (extern_possible_prim_token scopes) r r'
with No_match ->
try
let r'' = flatten_application r' in
if !Flags.raw_print || !print_no_symbol then raise No_match;
- extern_notation scopes vars r'' (uninterp_notations r'')
+ extern_optimal
+ (fun r -> extern_notation scopes vars r (uninterp_notations r))
+ r r''
with No_match ->
let loc = r'.CAst.loc in
match DAst.get r' with
diff --git a/interp/declare.ml b/interp/declare.ml
index a9bfe8cabb..1e972d3e35 100644
--- a/interp/declare.ml
+++ b/interp/declare.ml
@@ -358,10 +358,6 @@ let inInductive : mutual_inductive_entry -> obj =
let declare_one_projection univs (mind,_ as ind) ~proj_npars proj_arg label (term,types) =
let id = Label.to_id label in
- let p = Projection.Repr.make ind ~proj_npars ~proj_arg label in
- Recordops.declare_primitive_projection p;
- (* ^ needs to happen before declaring the constant, otherwise
- Heads gets confused. *)
let univs = match univs with
| Monomorphic_ind_entry _ ->
(** Global constraints already defined through the inductive *)
@@ -378,7 +374,10 @@ let declare_one_projection univs (mind,_ as ind) ~proj_npars proj_arg label (ter
Vars.subst_instance_constr u term, Vars.subst_instance_constr u types
in
let entry = definition_entry ~types ~univs term in
- ignore(declare_constant id (DefinitionEntry entry, IsDefinition StructureComponent))
+ let cst = declare_constant id (DefinitionEntry entry, IsDefinition StructureComponent) in
+ let p = Projection.Repr.make ind ~proj_npars ~proj_arg label in
+ Recordops.declare_primitive_projection p cst
+
let declare_projections univs mind =
let env = Global.env () in
diff --git a/interp/impargs.ml b/interp/impargs.ml
index d8582d856e..d024a9e808 100644
--- a/interp/impargs.ml
+++ b/interp/impargs.ml
@@ -19,7 +19,6 @@ open Decl_kinds
open Lib
open Libobject
open EConstr
-open Termops
open Reductionops
open Constrexpr
open Namegen
@@ -200,16 +199,16 @@ let add_free_rels_until strict strongly_strict revpat bound env sigma m pos acc
acc.(i) <- update pos rig acc.(i)
| App (f,_) when rig && is_flexible_reference env sigma bound depth f ->
if strict then () else
- iter_constr_with_full_binders sigma push_lift (frec false) ed c
+ iter_with_full_binders sigma push_lift (frec false) ed c
| Proj (p,c) when rig ->
if strict then () else
- iter_constr_with_full_binders sigma push_lift (frec false) ed c
+ iter_with_full_binders sigma push_lift (frec false) ed c
| Case _ when rig ->
if strict then () else
- iter_constr_with_full_binders sigma push_lift (frec false) ed c
+ iter_with_full_binders sigma push_lift (frec false) ed c
| Evar _ -> ()
| _ ->
- iter_constr_with_full_binders sigma push_lift (frec rig) ed c
+ iter_with_full_binders sigma push_lift (frec rig) ed c
in
let () = if not (Vars.noccur_between sigma 1 bound m) then frec true (env,1) m in
acc
diff --git a/kernel/cClosure.ml b/kernel/cClosure.ml
index 95546a83e1..1f61bcae2e 100644
--- a/kernel/cClosure.ml
+++ b/kernel/cClosure.ml
@@ -72,11 +72,8 @@ let with_stats c =
end else
Lazy.force c
-let all_opaque = (Id.Pred.empty, Cpred.empty)
-let all_transparent = (Id.Pred.full, Cpred.full)
-
-let is_transparent_variable (ids, _) id = Id.Pred.mem id ids
-let is_transparent_constant (_, csts) cst = Cpred.mem cst csts
+let all_opaque = TransparentState.empty
+let all_transparent = TransparentState.full
module type RedFlagsSig = sig
type reds
@@ -93,8 +90,8 @@ module type RedFlagsSig = sig
val no_red : reds
val red_add : reds -> red_kind -> reds
val red_sub : reds -> red_kind -> reds
- val red_add_transparent : reds -> transparent_state -> reds
- val red_transparent : reds -> transparent_state
+ val red_add_transparent : reds -> TransparentState.t -> reds
+ val red_transparent : reds -> TransparentState.t
val mkflags : red_kind list -> reds
val red_set : reds -> red_kind -> bool
val red_projection : reds -> Projection.t -> bool
@@ -106,11 +103,13 @@ module RedFlags = (struct
(* [r_const=(false,cl)] means only those in [cl] *)
(* [r_delta=true] just mean [r_const=(true,[])] *)
+ open TransparentState
+
type reds = {
r_beta : bool;
r_delta : bool;
r_eta : bool;
- r_const : transparent_state;
+ r_const : TransparentState.t;
r_zeta : bool;
r_match : bool;
r_fix : bool;
@@ -143,30 +142,30 @@ module RedFlags = (struct
| ETA -> { red with r_eta = true }
| DELTA -> { red with r_delta = true; r_const = all_transparent }
| CONST kn ->
- let (l1,l2) = red.r_const in
- { red with r_const = l1, Cpred.add kn l2 }
+ let r = red.r_const in
+ { red with r_const = { r with tr_cst = Cpred.add kn r.tr_cst } }
| MATCH -> { red with r_match = true }
| FIX -> { red with r_fix = true }
| COFIX -> { red with r_cofix = true }
| ZETA -> { red with r_zeta = true }
| VAR id ->
- let (l1,l2) = red.r_const in
- { red with r_const = Id.Pred.add id l1, l2 }
+ let r = red.r_const in
+ { red with r_const = { r with tr_var = Id.Pred.add id r.tr_var } }
let red_sub red = function
| BETA -> { red with r_beta = false }
| ETA -> { red with r_eta = false }
| DELTA -> { red with r_delta = false }
| CONST kn ->
- let (l1,l2) = red.r_const in
- { red with r_const = l1, Cpred.remove kn l2 }
+ let r = red.r_const in
+ { red with r_const = { r with tr_cst = Cpred.remove kn r.tr_cst } }
| MATCH -> { red with r_match = false }
| FIX -> { red with r_fix = false }
| COFIX -> { red with r_cofix = false }
| ZETA -> { red with r_zeta = false }
| VAR id ->
- let (l1,l2) = red.r_const in
- { red with r_const = Id.Pred.remove id l1, l2 }
+ let r = red.r_const in
+ { red with r_const = { r with tr_var = Id.Pred.remove id r.tr_var } }
let red_transparent red = red.r_const
@@ -179,12 +178,10 @@ module RedFlags = (struct
| BETA -> incr_cnt red.r_beta beta
| ETA -> incr_cnt red.r_eta eta
| CONST kn ->
- let (_,l) = red.r_const in
- let c = Cpred.mem kn l in
+ let c = is_transparent_constant red.r_const kn in
incr_cnt c delta
| VAR id -> (* En attendant d'avoir des kn pour les Var *)
- let (l,_) = red.r_const in
- let c = Id.Pred.mem id l in
+ let c = is_transparent_variable red.r_const id in
incr_cnt c delta
| ZETA -> incr_cnt red.r_zeta zeta
| MATCH -> incr_cnt red.r_match nb_match
@@ -303,7 +300,7 @@ and fterm =
| FCoFix of cofixpoint * fconstr subs
| FCaseT of case_info * constr * fconstr * constr array * fconstr subs (* predicate and branches are closures *)
| FLambda of int * (Name.t * constr) list * constr * fconstr subs
- | FProd of Name.t * fconstr * fconstr
+ | FProd of Name.t * fconstr * constr * fconstr subs
| FLetIn of Name.t * fconstr * fconstr * constr * fconstr subs
| FEvar of existential * fconstr subs
| FLIFT of int * fconstr
@@ -587,9 +584,12 @@ let rec to_constr lfts v =
let tys = List.mapi (fun i (na, c) -> na, subst_constr (subs_liftn i subs) c) tys in
let f = subst_constr (subs_liftn len subs) f in
Term.compose_lam (List.rev tys) f
- | FProd (n,t,c) ->
- mkProd (n, to_constr lfts t,
- to_constr (el_lift lfts) c)
+ | FProd (n, t, c, e) ->
+ if is_subs_id e && is_lift_id lfts then
+ mkProd (n, to_constr lfts t, c)
+ else
+ let subs' = comp_subs lfts e in
+ mkProd (n, to_constr lfts t, subst_constr (subs_lift subs') c)
| FLetIn (n,b,t,f,e) ->
let subs = comp_subs (el_lift lfts) (subs_lift e) in
mkLetIn (n, to_constr lfts b,
@@ -872,7 +872,7 @@ and knht info e t stk =
| CoFix cfx -> { norm = Cstr; term = FCoFix (cfx,e) }, stk
| Lambda _ -> { norm = Cstr; term = mk_lambda e t }, stk
| Prod (n, t, c) ->
- { norm = Whnf; term = FProd (n, mk_clos e t, mk_clos (subs_lift e) c) }, stk
+ { norm = Whnf; term = FProd (n, mk_clos e t, c, e) }, stk
| LetIn (n,b,t,c) ->
{ norm = Red; term = FLetIn (n, mk_clos e b, mk_clos e t, c, e) }, stk
| Evar ev -> { norm = Red; term = FEvar (ev, e) }, stk
@@ -995,8 +995,8 @@ and norm_head info tab m =
| FLetIn(na,a,b,f,e) ->
let c = mk_clos (subs_lift e) f in
mkLetIn(na, kl info tab a, kl info tab b, kl info tab c)
- | FProd(na,dom,rng) ->
- mkProd(na, kl info tab dom, kl info tab rng)
+ | FProd(na,dom,rng,e) ->
+ mkProd(na, kl info tab dom, kl info tab (mk_clos (subs_lift e) rng))
| FCoFix((n,(na,tys,bds)),e) ->
let ftys = Array.Fun1.map mk_clos e tys in
let fbds =
diff --git a/kernel/cClosure.mli b/kernel/cClosure.mli
index 1ee4bccc25..c2d53eed47 100644
--- a/kernel/cClosure.mli
+++ b/kernel/cClosure.mli
@@ -24,14 +24,6 @@ val with_stats: 'a Lazy.t -> 'a
Rem: reduction of a Rel/Var bound to a term is Delta, but reduction of
a LetIn expression is Letin reduction *)
-
-
-val all_opaque : transparent_state
-val all_transparent : transparent_state
-
-val is_transparent_variable : transparent_state -> variable -> bool
-val is_transparent_constant : transparent_state -> Constant.t -> bool
-
(** Sets of reduction kinds. *)
module type RedFlagsSig = sig
type reds
@@ -60,10 +52,10 @@ module type RedFlagsSig = sig
val red_sub : reds -> red_kind -> reds
(** Adds a reduction kind to a set *)
- val red_add_transparent : reds -> transparent_state -> reds
+ val red_add_transparent : reds -> TransparentState.t -> reds
(** Retrieve the transparent state of the reduction flags *)
- val red_transparent : reds -> transparent_state
+ val red_transparent : reds -> TransparentState.t
(** Build a reduction set from scratch = iter [red_add] on [no_red] *)
val mkflags : red_kind list -> reds
@@ -122,7 +114,7 @@ type fterm =
| FCoFix of cofixpoint * fconstr subs
| FCaseT of case_info * constr * fconstr * constr array * fconstr subs (* predicate and branches are closures *)
| FLambda of int * (Name.t * constr) list * constr * fconstr subs
- | FProd of Name.t * fconstr * fconstr
+ | FProd of Name.t * fconstr * constr * fconstr subs
| FLetIn of Name.t * fconstr * fconstr * constr * fconstr subs
| FEvar of existential * fconstr subs
| FLIFT of int * fconstr
diff --git a/kernel/constr.ml b/kernel/constr.ml
index 704e6de6b8..8e5d15dd2d 100644
--- a/kernel/constr.ml
+++ b/kernel/constr.ml
@@ -452,27 +452,6 @@ let fold f acc c = match kind c with
| CoFix (_,(_lna,tl,bl)) ->
Array.fold_left2 (fun acc t b -> f (f acc t) b) acc tl bl
-let fold_with_full_binders g f n acc c =
- let open Context.Rel.Declaration in
- match kind c with
- | Rel _ | Meta _ | Var _ | Sort _ | Const _ | Ind _ | Construct _ -> acc
- | Cast (c,_, t) -> f n (f n acc c) t
- | Prod (na,t,c) -> f (g (LocalAssum (na,t)) n) (f n acc t) c
- | Lambda (na,t,c) -> f (g (LocalAssum (na,t)) n) (f n acc t) c
- | LetIn (na,b,t,c) -> f (g (LocalDef (na,b,t)) n) (f n (f n acc b) t) c
- | App (c,l) -> Array.fold_left (f n) (f n acc c) l
- | Proj (_,c) -> f n acc c
- | Evar (_,l) -> Array.fold_left (f n) acc l
- | Case (_,p,c,bl) -> Array.fold_left (f n) (f n (f n acc p) c) bl
- | Fix (_,(lna,tl,bl)) ->
- let n' = CArray.fold_left2 (fun c n t -> g (LocalAssum (n,t)) c) n lna tl in
- let fd = Array.map2 (fun t b -> (t,b)) tl bl in
- Array.fold_left (fun acc (t,b) -> f n' (f n acc t) b) acc fd
- | CoFix (_,(lna,tl,bl)) ->
- let n' = CArray.fold_left2 (fun c n t -> g (LocalAssum (n,t)) c) n lna tl in
- let fd = Array.map2 (fun t b -> (t,b)) tl bl in
- Array.fold_left (fun acc (t,b) -> f n' (f n acc t) b) acc fd
-
(* [iter f c] iters [f] on the immediate subterms of [c]; it is
not recursive and the order with which subterms are processed is
not specified *)
@@ -534,12 +513,12 @@ let fold_constr_with_binders g f n acc c =
| Proj (_p,c) -> f n acc c
| Evar (_,l) -> Array.fold_left (f n) acc l
| Case (_,p,c,bl) -> Array.fold_left (f n) (f n (f n acc p) c) bl
- | Fix (_,(lna,tl,bl)) ->
- let n' = CArray.fold_left2 (fun c _n _t -> g c) n lna tl in
+ | Fix (_,(_,tl,bl)) ->
+ let n' = iterate g (Array.length tl) n in
let fd = Array.map2 (fun t b -> (t,b)) tl bl in
Array.fold_left (fun acc (t,b) -> f n' (f n acc t) b) acc fd
- | CoFix (_,(lna,tl,bl)) ->
- let n' = CArray.fold_left2 (fun c _n _t -> g c) n lna tl in
+ | CoFix (_,(_,tl,bl)) ->
+ let n' = iterate g (Array.length tl) n in
let fd = Array.map2 (fun t b -> (t,b)) tl bl in
Array.fold_left (fun acc (t,b) -> f n' (f n acc t) b) acc fd
@@ -799,6 +778,49 @@ let map_with_binders g f l c0 = match kind c0 with
let bl' = Array.Fun1.Smart.map f l' bl in
mkCoFix (ln,(lna,tl',bl'))
+(*********************)
+(* Lifting *)
+(*********************)
+
+(* The generic lifting function *)
+let rec exliftn el c =
+ let open Esubst in
+ match kind c with
+ | Rel i -> mkRel(reloc_rel i el)
+ | _ -> map_with_binders el_lift exliftn el c
+
+(* Lifting the binding depth across k bindings *)
+
+let liftn n k c =
+ let open Esubst in
+ match el_liftn (pred k) (el_shft n el_id) with
+ | ELID -> c
+ | el -> exliftn el c
+
+let lift n = liftn n 1
+
+let fold_with_full_binders g f n acc c =
+ let open Context.Rel.Declaration in
+ match kind c with
+ | Rel _ | Meta _ | Var _ | Sort _ | Const _ | Ind _ | Construct _ -> acc
+ | Cast (c,_, t) -> f n (f n acc c) t
+ | Prod (na,t,c) -> f (g (LocalAssum (na,t)) n) (f n acc t) c
+ | Lambda (na,t,c) -> f (g (LocalAssum (na,t)) n) (f n acc t) c
+ | LetIn (na,b,t,c) -> f (g (LocalDef (na,b,t)) n) (f n (f n acc b) t) c
+ | App (c,l) -> Array.fold_left (f n) (f n acc c) l
+ | Proj (_,c) -> f n acc c
+ | Evar (_,l) -> Array.fold_left (f n) acc l
+ | Case (_,p,c,bl) -> Array.fold_left (f n) (f n (f n acc p) c) bl
+ | Fix (_,(lna,tl,bl)) ->
+ let n' = CArray.fold_left2_i (fun i c n t -> g (LocalAssum (n,lift i t)) c) n lna tl in
+ let fd = Array.map2 (fun t b -> (t,b)) tl bl in
+ Array.fold_left (fun acc (t,b) -> f n' (f n acc t) b) acc fd
+ | CoFix (_,(lna,tl,bl)) ->
+ let n' = CArray.fold_left2_i (fun i c n t -> g (LocalAssum (n,lift i t)) c) n lna tl in
+ let fd = Array.map2 (fun t b -> (t,b)) tl bl in
+ Array.fold_left (fun acc (t,b) -> f n' (f n acc t) b) acc fd
+
+
type 'univs instance_compare_fn = GlobRef.t -> int ->
'univs -> 'univs -> bool
diff --git a/kernel/constr.mli b/kernel/constr.mli
index 1be1f63ff7..f2cedcdabb 100644
--- a/kernel/constr.mli
+++ b/kernel/constr.mli
@@ -383,6 +383,17 @@ type rel_context = rel_declaration list
type named_context = named_declaration list
type compacted_context = compacted_declaration list
+(** {6 Relocation and substitution } *)
+
+(** [exliftn el c] lifts [c] with lifting [el] *)
+val exliftn : Esubst.lift -> constr -> constr
+
+(** [liftn n k c] lifts by [n] indexes above or equal to [k] in [c] *)
+val liftn : int -> int -> constr -> constr
+
+(** [lift n c] lifts by [n] the positive indexes in [c] *)
+val lift : int -> constr -> constr
+
(** {6 Functionals working on expressions canonically abstracted over
a local context (possibly with let-ins)} *)
diff --git a/kernel/conv_oracle.ml b/kernel/conv_oracle.ml
index ac78064235..fe82353b70 100644
--- a/kernel/conv_oracle.ml
+++ b/kernel/conv_oracle.ml
@@ -81,7 +81,8 @@ let fold_strategy f { var_opacity; cst_opacity; _ } accu =
let accu = Id.Map.fold fvar var_opacity accu in
Cmap.fold fcst cst_opacity accu
-let get_transp_state { var_trstate; cst_trstate; _ } = (var_trstate, cst_trstate)
+let get_transp_state { var_trstate; cst_trstate; _ } =
+ { TransparentState.tr_var = var_trstate; tr_cst = cst_trstate }
let dep_order l2r k1 k2 = match k1, k2 with
| RelKey _, RelKey _ -> l2r
diff --git a/kernel/conv_oracle.mli b/kernel/conv_oracle.mli
index 67add5dd35..bc06cc21b6 100644
--- a/kernel/conv_oracle.mli
+++ b/kernel/conv_oracle.mli
@@ -41,5 +41,5 @@ val set_strategy : oracle -> Constant.t tableKey -> level -> oracle
(** Fold over the non-transparent levels of the oracle. Order unspecified. *)
val fold_strategy : (Constant.t tableKey -> level -> 'a -> 'a) -> oracle -> 'a -> 'a
-val get_transp_state : oracle -> transparent_state
+val get_transp_state : oracle -> TransparentState.t
diff --git a/kernel/declarations.ml b/kernel/declarations.ml
index c1b38b4156..94832726fe 100644
--- a/kernel/declarations.ml
+++ b/kernel/declarations.ml
@@ -61,13 +61,27 @@ type constant_universes =
of a constant are tracked in their {!constant_body} so that they
can be displayed to the user. *)
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 *)
- share_reduction : bool; (** Use by-need reduction algorithm *)
- enable_VM : bool; (** If [false], all VM conversions fall back to interpreted ones *)
- enable_native_compiler : bool; (** If [false], all native conversions fall back to VM ones *)
+ 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 *)
+
+ share_reduction : bool;
+ (** Use by-need reduction algorithm *)
+
+ enable_VM : bool;
+ (** If [false], all VM conversions fall back to interpreted ones *)
+
+ enable_native_compiler : bool;
+ (** If [false], all native conversions fall back to VM ones *)
+
+ indices_matter: bool;
+ (** The universe of an inductive type must be above that of its indices. *)
}
(* some contraints are in constant_constraints, some other may be in
diff --git a/kernel/declareops.ml b/kernel/declareops.ml
index 3ed599c538..d1d184df69 100644
--- a/kernel/declareops.ml
+++ b/kernel/declareops.ml
@@ -24,6 +24,7 @@ let safe_flags oracle = {
share_reduction = true;
enable_VM = true;
enable_native_compiler = true;
+ indices_matter = true;
}
(** {6 Arities } *)
diff --git a/kernel/environ.ml b/kernel/environ.ml
index f61dd0c101..7835a807ba 100644
--- a/kernel/environ.ml
+++ b/kernel/environ.ml
@@ -241,6 +241,8 @@ let is_impredicative_set env =
let type_in_type env = not (typing_flags env).check_universes
let deactivated_guard env = not (typing_flags env).check_guarded
+let indices_matter env = env.env_typing_flags.indices_matter
+
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
@@ -384,8 +386,28 @@ let set_engagement c env = (* Unsafe *)
{ env with env_stratification =
{ env.env_stratification with env_engagement = c } }
+(* It's convenient to use [{flags with foo = bar}] so we're smart wrt to it. *)
+let same_flags {
+ check_guarded;
+ check_universes;
+ conv_oracle;
+ indices_matter;
+ share_reduction;
+ enable_VM;
+ enable_native_compiler;
+ } alt =
+ check_guarded == alt.check_guarded &&
+ check_universes == alt.check_universes &&
+ conv_oracle == alt.conv_oracle &&
+ indices_matter == alt.indices_matter &&
+ share_reduction == alt.share_reduction &&
+ enable_VM == alt.enable_VM &&
+ enable_native_compiler == alt.enable_native_compiler
+[@warning "+9"]
+
let set_typing_flags c env = (* Unsafe *)
- { env with env_typing_flags = c }
+ if same_flags env.env_typing_flags c then env
+ else { env with env_typing_flags = c }
(* Global constants *)
diff --git a/kernel/environ.mli b/kernel/environ.mli
index c285f907fc..91b28bfcbc 100644
--- a/kernel/environ.mli
+++ b/kernel/environ.mli
@@ -96,6 +96,7 @@ val typing_flags : env -> typing_flags
val is_impredicative_set : env -> bool
val type_in_type : env -> bool
val deactivated_guard : env -> bool
+val indices_matter : env -> bool
(** is the local context empty *)
val empty_context : env -> bool
diff --git a/kernel/indtypes.ml b/kernel/indtypes.ml
index 20c90bc05a..a4a02791b4 100644
--- a/kernel/indtypes.ml
+++ b/kernel/indtypes.ml
@@ -35,14 +35,6 @@ env_ar_par = env_ar + declaration of parameters
nmr = ongoing computation of recursive parameters
*)
-(* Tell if indices (aka real arguments) contribute to size of inductive type *)
-(* If yes, this is compatible with the univalent model *)
-
-let indices_matter = ref false
-
-let enforce_indices_matter () = indices_matter := true
-let is_indices_matter () = !indices_matter
-
(* [weaker_noccur_between env n nvars t] (defined above), checks that
no de Bruijn indices between [n] and [n+nvars] occur in [t]. If
some such occurrences are found, then reduction is performed
@@ -303,7 +295,7 @@ let typecheck_inductive env mie =
let inflev =
(* The level of the inductive includes levels of indices if
in indices_matter mode *)
- if !indices_matter
+ if indices_matter env
then Some (cumulate_arity_large_levels env_params sign)
else None
in
diff --git a/kernel/indtypes.mli b/kernel/indtypes.mli
index a827c17683..840e23ed69 100644
--- a/kernel/indtypes.mli
+++ b/kernel/indtypes.mli
@@ -50,8 +50,3 @@ val check_positivity : chkpos:bool ->
(** The following function does checks on inductive declarations. *)
val check_inductive : env -> MutInd.t -> mutual_inductive_entry -> mutual_inductive_body
-
-(** The following enforces a system compatible with the univalent model *)
-
-val enforce_indices_matter : unit -> unit
-val is_indices_matter : unit -> bool
diff --git a/kernel/kernel.mllib b/kernel/kernel.mllib
index a18c5d1e20..54c239349d 100644
--- a/kernel/kernel.mllib
+++ b/kernel/kernel.mllib
@@ -1,4 +1,5 @@
Names
+TransparentState
Uint31
Univ
UGraph
diff --git a/kernel/modops.ml b/kernel/modops.ml
index bab2eae3df..0dde1c7e75 100644
--- a/kernel/modops.ml
+++ b/kernel/modops.ml
@@ -47,10 +47,9 @@ type signature_mismatch_error =
| RecordFieldExpected of bool
| RecordProjectionsExpected of Name.t list
| NotEqualInductiveAliases
- | IncompatibleInstances
| IncompatibleUniverses of Univ.univ_inconsistency
| IncompatiblePolymorphism of env * types * types
- | IncompatibleConstraints of Univ.AUContext.t
+ | IncompatibleConstraints of { got : Univ.AUContext.t; expect : Univ.AUContext.t }
type module_typing_error =
| SignatureMismatch of
diff --git a/kernel/modops.mli b/kernel/modops.mli
index 8e7e618fcd..0acd09fb12 100644
--- a/kernel/modops.mli
+++ b/kernel/modops.mli
@@ -106,10 +106,9 @@ type signature_mismatch_error =
| RecordFieldExpected of bool
| RecordProjectionsExpected of Name.t list
| NotEqualInductiveAliases
- | IncompatibleInstances
| IncompatibleUniverses of Univ.univ_inconsistency
| IncompatiblePolymorphism of env * types * types
- | IncompatibleConstraints of Univ.AUContext.t
+ | IncompatibleConstraints of { got : Univ.AUContext.t; expect : Univ.AUContext.t }
type module_typing_error =
| SignatureMismatch of
diff --git a/kernel/names.ml b/kernel/names.ml
index 18560d5f8d..b2d6a489a6 100644
--- a/kernel/names.ml
+++ b/kernel/names.ml
@@ -715,13 +715,6 @@ let hcons_construct = Hashcons.simple_hcons Hconstruct.generate Hconstruct.hcons
(*****************)
-type transparent_state = Id.Pred.t * Cpred.t
-
-let empty_transparent_state = (Id.Pred.empty, Cpred.empty)
-let full_transparent_state = (Id.Pred.full, Cpred.full)
-let var_full_transparent_state = (Id.Pred.full, Cpred.empty)
-let cst_full_transparent_state = (Id.Pred.empty, Cpred.full)
-
type 'a tableKey =
| ConstKey of 'a
| VarKey of Id.t
diff --git a/kernel/names.mli b/kernel/names.mli
index 98995752a2..350db871d5 100644
--- a/kernel/names.mli
+++ b/kernel/names.mli
@@ -510,14 +510,6 @@ type 'a tableKey =
| VarKey of Id.t
| RelKey of Int.t
-(** Sets of names *)
-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
-
type inv_rel_key = int (** index in the [rel_context] part of environment
starting by the end, {e inverse}
of de Bruijn indice *)
diff --git a/kernel/reduction.ml b/kernel/reduction.ml
index 5515ff9767..97cd4c00d7 100644
--- a/kernel/reduction.ml
+++ b/kernel/reduction.ml
@@ -177,7 +177,7 @@ type 'a kernel_conversion_function = env -> 'a -> 'a -> unit
(* functions of this type can be called from outside the kernel *)
type 'a extended_conversion_function =
- ?l2r:bool -> ?reds:Names.transparent_state -> env ->
+ ?l2r:bool -> ?reds:TransparentState.t -> env ->
?evars:((existential->constr option) * UGraph.t) ->
'a -> 'a -> unit
@@ -438,14 +438,14 @@ and eqappr cv_pb l2r infos (lft1,st1) (lft2,st2) cuniv =
let cuniv = ccnv CONV l2r infos el1 el2 ty1 ty2 cuniv in
ccnv CONV l2r infos (el_lift el1) (el_lift el2) bd1 bd2 cuniv
- | (FProd (_,c1,c2), FProd (_,c'1,c'2)) ->
+ | (FProd (_, c1, c2, e), FProd (_, c'1, c'2, e')) ->
if not (is_empty_stack v1 && is_empty_stack v2) then
anomaly (Pp.str "conversion was given ill-typed terms (FProd).");
(* Luo's system *)
let el1 = el_stack lft1 v1 in
let el2 = el_stack lft2 v2 in
let cuniv = ccnv CONV l2r infos el1 el2 c1 c'1 cuniv in
- ccnv cv_pb l2r infos (el_lift el1) (el_lift el2) c2 c'2 cuniv
+ ccnv cv_pb l2r infos (el_lift el1) (el_lift el2) (mk_clos (subs_lift e) c2) (mk_clos (subs_lift e') c'2) cuniv
(* Eta-expansion on the fly *)
| (FLambda _, _) ->
@@ -758,7 +758,7 @@ let gen_conv cv_pb l2r reds env evars univs t1 t2 =
()
(* Profiling *)
-let gen_conv cv_pb ?(l2r=false) ?(reds=full_transparent_state) env ?(evars=(fun _->None), universes env) =
+let gen_conv cv_pb ?(l2r=false) ?(reds=TransparentState.full) env ?(evars=(fun _->None), universes env) =
let evars, univs = evars in
if Flags.profile then
let fconv_universes_key = CProfile.declare_profile "trans_fconv_universes" in
@@ -792,11 +792,11 @@ let infer_conv_universes =
CProfile.profile8 infer_conv_universes_key infer_conv_universes
else infer_conv_universes
-let infer_conv ?(l2r=false) ?(evars=fun _ -> None) ?(ts=full_transparent_state)
+let infer_conv ?(l2r=false) ?(evars=fun _ -> None) ?(ts=TransparentState.full)
env univs t1 t2 =
infer_conv_universes CONV l2r evars ts env univs t1 t2
-let infer_conv_leq ?(l2r=false) ?(evars=fun _ -> None) ?(ts=full_transparent_state)
+let infer_conv_leq ?(l2r=false) ?(evars=fun _ -> None) ?(ts=TransparentState.full)
env univs t1 t2 =
infer_conv_universes CUMUL l2r evars ts env univs t1 t2
diff --git a/kernel/reduction.mli b/kernel/reduction.mli
index 581e8bd88a..0408dbf057 100644
--- a/kernel/reduction.mli
+++ b/kernel/reduction.mli
@@ -31,7 +31,7 @@ exception NotConvertibleVect of int
type 'a kernel_conversion_function = env -> 'a -> 'a -> unit
type 'a extended_conversion_function =
- ?l2r:bool -> ?reds:Names.transparent_state -> env ->
+ ?l2r:bool -> ?reds:TransparentState.t -> env ->
?evars:((existential->constr option) * UGraph.t) ->
'a -> 'a -> unit
@@ -77,15 +77,15 @@ val conv_leq : types extended_conversion_function
(** These conversion functions are used by module subtyping, which needs to infer
universe constraints inside the kernel *)
val infer_conv : ?l2r:bool -> ?evars:(existential->constr option) ->
- ?ts:Names.transparent_state -> constr infer_conversion_function
+ ?ts:TransparentState.t -> constr infer_conversion_function
val infer_conv_leq : ?l2r:bool -> ?evars:(existential->constr option) ->
- ?ts:Names.transparent_state -> types infer_conversion_function
+ ?ts:TransparentState.t -> types infer_conversion_function
(** Depending on the universe state functions, this might raise
[UniverseInconsistency] in addition to [NotConvertible] (for better error
messages). *)
val generic_conv : conv_pb -> l2r:bool -> (existential->constr option) ->
- Names.transparent_state -> (constr,'a) generic_conversion_function
+ TransparentState.t -> (constr,'a) generic_conversion_function
val default_conv : conv_pb -> ?l2r:bool -> types kernel_conversion_function
val default_conv_leq : ?l2r:bool -> types kernel_conversion_function
diff --git a/kernel/safe_typing.ml b/kernel/safe_typing.ml
index df10398b2f..b7f1e93062 100644
--- a/kernel/safe_typing.ml
+++ b/kernel/safe_typing.ml
@@ -192,7 +192,12 @@ let set_engagement c senv =
engagement = Some c }
let set_typing_flags c senv =
- { senv with env = Environ.set_typing_flags c senv.env }
+ let env = Environ.set_typing_flags c senv.env in
+ if env == senv.env then senv
+ else { senv with env }
+
+let set_indices_matter indices_matter senv =
+ set_typing_flags { (Environ.typing_flags senv.env) with indices_matter } senv
let set_share_reduction b senv =
let flags = Environ.typing_flags senv.env in
@@ -496,7 +501,7 @@ type generic_name =
| M (** name already known, cf the mod_mp field *)
| MT (** name already known, cf the mod_mp field *)
-let add_field ((l,sfb) as field) gn senv =
+let add_field ?(is_include=false) ((l,sfb) as field) gn senv =
let mlabs,olabs = match sfb with
| SFBmind mib ->
let l = labels_of_mib mib in
@@ -506,8 +511,18 @@ let add_field ((l,sfb) as field) gn senv =
| SFBmodule _ | SFBmodtype _ ->
check_modlabel l senv; (Label.Set.singleton l, Label.Set.empty)
in
- let cst = constraints_of_sfb senv.env sfb in
- let senv = add_constraints_list cst senv in
+ let senv =
+ if is_include then
+ (* Universes and constraints were added when the included module
+ was defined eg in [Include F X.] (one of the trickier
+ versions of Include) the constraints on the fields are
+ exactly those of the fields of F which was defined
+ separately. *)
+ senv
+ else
+ let cst = constraints_of_sfb senv.env sfb in
+ add_constraints_list cst senv
+ in
let env' = match sfb, gn with
| SFBconst cb, C con -> Environ.add_constant con cb senv.env
| SFBmind mib, I mind -> Environ.add_mind mind mib senv.env
@@ -1047,7 +1062,7 @@ let add_include me is_module inl senv =
| SFBmodule _ -> M
| SFBmodtype _ -> MT
in
- add_field field new_name senv
+ add_field ~is_include:true field new_name senv
in
resolver, List.fold_left add senv str
diff --git a/kernel/safe_typing.mli b/kernel/safe_typing.mli
index 7af773e3bc..57b01f15e3 100644
--- a/kernel/safe_typing.mli
+++ b/kernel/safe_typing.mli
@@ -136,6 +136,7 @@ val add_constraints :
(** Setting the type theory flavor *)
val set_engagement : Declarations.engagement -> safe_transformer0
+val set_indices_matter : bool -> safe_transformer0
val set_typing_flags : Declarations.typing_flags -> safe_transformer0
val set_share_reduction : bool -> safe_transformer0
val set_VM : bool -> safe_transformer0
diff --git a/kernel/subtyping.ml b/kernel/subtyping.ml
index d64342dbb0..347c30dd64 100644
--- a/kernel/subtyping.ml
+++ b/kernel/subtyping.ml
@@ -93,10 +93,8 @@ let check_conv_error error why cst poly f env a1 a2 =
| Univ.UniverseInconsistency e -> error (IncompatibleUniverses e)
let check_polymorphic_instance error env auctx1 auctx2 =
- if not (Univ.AUContext.size auctx1 == Univ.AUContext.size auctx2) then
- error IncompatibleInstances
- else if not (UGraph.check_subtype (Environ.universes env) auctx2 auctx1) then
- error (IncompatibleConstraints auctx1)
+ if not (UGraph.check_subtype (Environ.universes env) auctx2 auctx1) then
+ error (IncompatibleConstraints { got = auctx1; expect = auctx2; } )
else
Environ.push_context ~strict:false (Univ.AUContext.repr auctx2) env
diff --git a/kernel/transparentState.ml b/kernel/transparentState.ml
new file mode 100644
index 0000000000..9661dace6a
--- /dev/null
+++ b/kernel/transparentState.ml
@@ -0,0 +1,45 @@
+(************************************************************************)
+(* * The Coq Proof Assistant / The Coq Development Team *)
+(* v * INRIA, CNRS and contributors - Copyright 1999-2018 *)
+(* <O___,, * (see CREDITS file for the list of authors) *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(* * (see LICENSE file for the text of the license) *)
+(************************************************************************)
+
+open Names
+
+type t = {
+ tr_var : Id.Pred.t;
+ tr_cst : Cpred.t;
+}
+
+let empty = {
+ tr_var = Id.Pred.empty;
+ tr_cst = Cpred.empty;
+}
+
+let full = {
+ tr_var = Id.Pred.full;
+ tr_cst = Cpred.full;
+}
+
+let var_full = {
+ tr_var = Id.Pred.full;
+ tr_cst = Cpred.empty;
+}
+
+let cst_full = {
+ tr_var = Id.Pred.empty;
+ tr_cst = Cpred.full;
+}
+
+let is_empty ts =
+ Id.Pred.is_empty ts.tr_var && Cpred.is_empty ts.tr_cst
+
+let is_transparent_variable ts id =
+ Id.Pred.mem id ts.tr_var
+
+let is_transparent_constant ts cst =
+ Cpred.mem cst ts.tr_cst
diff --git a/proofs/proof_type.ml b/kernel/transparentState.mli
index 149f30c673..f2999c6869 100644
--- a/proofs/proof_type.ml
+++ b/kernel/transparentState.mli
@@ -8,21 +8,27 @@
(* * (see LICENSE file for the text of the license) *)
(************************************************************************)
-(** Legacy proof engine. Do not use in newly written code. *)
+open Names
-open Evd
-open Constr
+(** Sets of names *)
+type t = {
+ tr_var : Id.Pred.t;
+ tr_cst : Cpred.t;
+}
-(** This module defines the structure of proof tree and the tactic type. So, it
- is used by [Proof_tree] and [Refiner] *)
+val empty : t
+(** Everything opaque *)
-type prim_rule =
- | Refine of constr
+val full : t
+(** Everything transparent *)
-(** Nowadays, the only rules we'll consider are the primitive rules *)
+val var_full : t
+(** All variables transparent *)
-type rule = prim_rule
+val cst_full : t
+(** All constant transparent *)
-type goal = Goal.goal
+val is_empty : t -> bool
-type tactic = goal sigma -> goal list sigma
+val is_transparent_variable : t -> Id.t -> bool
+val is_transparent_constant : t -> Constant.t -> bool
diff --git a/kernel/typeops.ml b/kernel/typeops.ml
index c8fd83c8a9..c9acd168e8 100644
--- a/kernel/typeops.ml
+++ b/kernel/typeops.ml
@@ -151,28 +151,41 @@ let type_of_abstraction _env name var ty =
let make_judgev c t =
Array.map2 make_judge c t
+let rec check_empty_stack = function
+| [] -> true
+| CClosure.Zupdate _ :: s -> check_empty_stack s
+| _ -> false
+
let type_of_apply env func funt argsv argstv =
+ let open CClosure in
let len = Array.length argsv in
- let rec apply_rec i typ =
- if Int.equal i len then typ
- else
- (match kind (whd_all env typ) with
- | Prod (_,c1,c2) ->
- let arg = argsv.(i) and argt = argstv.(i) in
- (try
- let () = conv_leq false env argt c1 in
- apply_rec (i+1) (subst1 arg c2)
- with NotConvertible ->
- error_cant_apply_bad_type env
- (i+1,c1,argt)
- (make_judge func funt)
- (make_judgev argsv argstv))
-
+ let infos = create_clos_infos all env in
+ let tab = create_tab () in
+ let rec apply_rec i typ =
+ if Int.equal i len then term_of_fconstr typ
+ else
+ let typ, stk = whd_stack infos tab typ [] in
+ (** The return stack is known to be empty *)
+ let () = assert (check_empty_stack stk) in
+ match fterm_of typ with
+ | FProd (_, c1, c2, e) ->
+ let arg = argsv.(i) in
+ let argt = argstv.(i) in
+ let c1 = term_of_fconstr c1 in
+ begin match conv_leq false env argt c1 with
+ | () -> apply_rec (i+1) (mk_clos (Esubst.subs_cons ([| inject arg |], e)) c2)
+ | exception NotConvertible ->
+ error_cant_apply_bad_type env
+ (i+1,c1,argt)
+ (make_judge func funt)
+ (make_judgev argsv argstv)
+ end
| _ ->
- error_cant_apply_not_functional env
- (make_judge func funt)
- (make_judgev argsv argstv))
- in apply_rec 0 funt
+ error_cant_apply_not_functional env
+ (make_judge func funt)
+ (make_judgev argsv argstv)
+ in
+ apply_rec 0 (inject funt)
(* Type of product *)
diff --git a/kernel/uGraph.ml b/kernel/uGraph.ml
index 9ff51fca55..9083156745 100644
--- a/kernel/uGraph.ml
+++ b/kernel/uGraph.ml
@@ -942,34 +942,36 @@ let check_eq_instances g t1 t2 =
(** Pretty-printing *)
+let pr_umap sep pr map =
+ let cmp (u,_) (v,_) = Level.compare u v in
+ Pp.prlist_with_sep sep pr (List.sort cmp (UMap.bindings map))
+
let pr_arc prl = function
| _, Canonical {univ=u; ltle; _} ->
if UMap.is_empty ltle then mt ()
else
prl u ++ str " " ++
v 0
- (pr_sequence (fun (v, strict) ->
+ (pr_umap Pp.spc (fun (v, strict) ->
(if strict then str "< " else str "<= ") ++ prl v)
- (UMap.bindings ltle)) ++
+ ltle) ++
fnl ()
| u, Equiv v ->
prl u ++ str " = " ++ prl v ++ fnl ()
let pr_universes prl g =
- let graph = UMap.fold (fun u a l -> (u,a)::l) g.entries [] in
- prlist (pr_arc prl) graph
+ pr_umap mt (pr_arc prl) g.entries
(* Dumping constraints to a file *)
let dump_universes output g =
let dump_arc u = function
| Canonical {univ=u; ltle; _} ->
- let u_str = Level.to_string u in
UMap.iter (fun v strict ->
let typ = if strict then Lt else Le in
- output typ u_str (Level.to_string v)) ltle;
+ output typ u v) ltle;
| Equiv v ->
- output Eq (Level.to_string u) (Level.to_string v)
+ output Eq u v
in
UMap.iter dump_arc g.entries
diff --git a/kernel/uGraph.mli b/kernel/uGraph.mli
index 4336a22b8c..a2cc5b3116 100644
--- a/kernel/uGraph.mli
+++ b/kernel/uGraph.mli
@@ -86,7 +86,7 @@ val check_subtype : AUContext.t check_function
(** {6 Dumping to a file } *)
val dump_universes :
- (constraint_type -> string -> string -> unit) -> t -> unit
+ (constraint_type -> Level.t -> Level.t -> unit) -> t -> unit
(** {6 Debugging} *)
val check_universes_invariants : t -> unit
diff --git a/kernel/univ.ml b/kernel/univ.ml
index 0edf750997..2b3b4f9486 100644
--- a/kernel/univ.ml
+++ b/kernel/univ.ml
@@ -570,9 +570,9 @@ struct
include S
let pr prl c =
- fold (fun (u1,op,u2) pp_std ->
- pp_std ++ prl u1 ++ pr_constraint_type op ++
- prl u2 ++ fnl () ) c (str "")
+ v 0 (prlist_with_sep spc (fun (u1,op,u2) ->
+ hov 0 (prl u1 ++ pr_constraint_type op ++ prl u2))
+ (elements c))
end
diff --git a/kernel/vars.ml b/kernel/vars.ml
index 7380a860dd..f9c576ca4a 100644
--- a/kernel/vars.ml
+++ b/kernel/vars.ml
@@ -9,7 +9,6 @@
(************************************************************************)
open Names
-open Esubst
module RelDecl = Context.Rel.Declaration
@@ -80,19 +79,9 @@ let noccur_with_meta n m term =
(* Lifting *)
(*********************)
-(* The generic lifting function *)
-let rec exliftn el c = match Constr.kind c with
- | Constr.Rel i -> Constr.mkRel(reloc_rel i el)
- | _ -> Constr.map_with_binders el_lift exliftn el c
-
-(* Lifting the binding depth across k bindings *)
-
-let liftn n k c =
- match el_liftn (pred k) (el_shft n el_id) with
- | ELID -> c
- | el -> exliftn el c
-
-let lift n = liftn n 1
+let exliftn = Constr.exliftn
+let liftn = Constr.liftn
+let lift = Constr.lift
(*********************)
(* Substituting *)
diff --git a/kernel/vconv.ml b/kernel/vconv.ml
index c1130e62c9..246c90c09d 100644
--- a/kernel/vconv.ml
+++ b/kernel/vconv.ml
@@ -191,7 +191,7 @@ let warn_bytecode_compiler_failed =
let vm_conv_gen cv_pb env univs t1 t2 =
if not (typing_flags env).Declarations.enable_VM then
Reduction.generic_conv cv_pb ~l2r:false (fun _ -> None)
- full_transparent_state env univs t1 t2
+ TransparentState.full env univs t1 t2
else
try
let v1 = val_of_constr env t1 in
@@ -200,7 +200,7 @@ let vm_conv_gen cv_pb env univs t1 t2 =
with Not_found | Invalid_argument _ ->
warn_bytecode_compiler_failed ();
Reduction.generic_conv cv_pb ~l2r:false (fun _ -> None)
- full_transparent_state env univs t1 t2
+ TransparentState.full env univs t1 t2
let vm_conv cv_pb env t1 t2 =
let univs = Environ.universes env in
diff --git a/lib/coqProject_file.ml b/lib/coqProject_file.ml
index 7395654022..868042303d 100644
--- a/lib/coqProject_file.ml
+++ b/lib/coqProject_file.ml
@@ -12,10 +12,6 @@
ideally we would like to make this independent so it can be
bootstrapped. *)
-(* Note the problem with the error invokation below calling exit... *)
-(* let error msg = Feedback.msg_error msg *)
-let warning msg = Feedback.msg_warning Pp.(str msg)
-
type arg_source = CmdLine | ProjectFile
type 'a sourced = { thing : 'a; source : arg_source }
@@ -147,7 +143,7 @@ let exists_dir dir =
try Sys.is_directory (strip_trailing_slash dir) with Sys_error _ -> false
-let process_cmd_line orig_dir proj args =
+let process_cmd_line ~warning_fn orig_dir proj args =
let parsing_project_file = ref (proj.project_file <> None) in
let sourced x = { thing = x; source = if !parsing_project_file then ProjectFile else CmdLine } in
let orig_dir = (* avoids turning foo.v in ./foo.v *)
@@ -170,7 +166,7 @@ let process_cmd_line orig_dir proj args =
| ("-full"|"-opt") :: r -> aux { proj with use_ocamlopt = true } r
| "-install" :: d :: r ->
if proj.install_kind <> None then
- (warning "-install set more than once.@\n%!");
+ (warning_fn "-install set more than once.");
let install = match d with
| "user" -> UserInstall
| "none" -> NoInstall
@@ -197,7 +193,7 @@ let process_cmd_line orig_dir proj args =
let file = CUnix.remove_path_dot (CUnix.correct_path file orig_dir) in
let () = match proj.project_file with
| None -> ()
- | Some _ -> warning "Multiple project files are deprecated.@\n%!"
+ | Some _ -> warning_fn "Multiple project files are deprecated."
in
parsing_project_file := true;
let proj = aux { proj with project_file = Some file } (parse file) in
@@ -236,11 +232,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) args
+let cmdline_args_to_project ~warning_fn ~curdir args =
+ process_cmd_line ~warning_fn curdir (mk_project None None None true) args
-let read_project_file f =
- process_cmd_line (Filename.dirname f)
+let read_project_file ~warning_fn f =
+ process_cmd_line ~warning_fn (Filename.dirname f)
(mk_project (Some f) None (Some NoInstall) true) (parse f)
let rec find_project_file ~from ~projfile_name =
diff --git a/lib/coqProject_file.mli b/lib/coqProject_file.mli
index 2a6a09a9a0..20b276ce8c 100644
--- a/lib/coqProject_file.mli
+++ b/lib/coqProject_file.mli
@@ -51,8 +51,8 @@ and install =
| TraditionalInstall
| UserInstall
-val cmdline_args_to_project : curdir:string -> string list -> project
-val read_project_file : string -> project
+val cmdline_args_to_project : warning_fn:(string -> unit) -> curdir:string -> string list -> project
+val read_project_file : warning_fn:(string -> unit) -> string -> project
val coqtop_args_from_project : project -> string list
val find_project_file : from:string -> projfile_name:string -> string option
diff --git a/lib/envars.ml b/lib/envars.ml
index 724a3dddc7..b5036e7340 100644
--- a/lib/envars.ml
+++ b/lib/envars.ml
@@ -177,10 +177,6 @@ let print_config ?(prefix_var_name="") f coq_src_subdirs =
fprintf f "%sCOQLIB=%s/\n" prefix_var_name (coqlib ());
fprintf f "%sDOCDIR=%s/\n" prefix_var_name (docdir ());
fprintf f "%sOCAMLFIND=%s\n" prefix_var_name (ocamlfind ());
- fprintf f "%sCAMLP5O=%s\n" prefix_var_name Coq_config.camlp5o;
- fprintf f "%sCAMLP5BIN=%s/\n" prefix_var_name Coq_config.camlp5bin;
- fprintf f "%sCAMLP5LIB=%s\n" prefix_var_name Coq_config.camlp5lib;
- fprintf f "%sCAMLP5OPTIONS=%s\n" prefix_var_name Coq_config.camlp5compat;
fprintf f "%sCAMLFLAGS=%s\n" prefix_var_name Coq_config.caml_flags;
fprintf f "%sHASNATDYNLINK=%s\n" prefix_var_name
(if Coq_config.has_natdynlink then "true" else "false");
diff --git a/lib/flags.ml b/lib/flags.ml
index 582506f3a8..3aef5a7b2c 100644
--- a/lib/flags.ml
+++ b/lib/flags.ml
@@ -99,10 +99,6 @@ let verbosely f x = without_option quiet f x
let if_silent f x = if !quiet then f x
let if_verbose f x = if not !quiet then f x
-let auto_intros = ref true
-let make_auto_intros flag = auto_intros := flag
-let is_auto_intros () = !auto_intros
-
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 b667235678..e282d4ca8c 100644
--- a/lib/flags.mli
+++ b/lib/flags.mli
@@ -78,9 +78,6 @@ val if_silent : ('a -> unit) -> 'a -> unit
val if_verbose : ('a -> unit) -> 'a -> unit
(* Miscellaneus flags for vernac *)
-val make_auto_intros : bool -> unit
-val is_auto_intros : unit -> bool
-
val program_mode : bool ref
val is_program_mode : unit -> bool
diff --git a/lib/pp_diff.ml b/lib/pp_diff.ml
index 7b4b1eab73..a485bf31c0 100644
--- a/lib/pp_diff.ml
+++ b/lib/pp_diff.ml
@@ -86,7 +86,7 @@ let shorten_diff_span dtype diff_list =
if (get_variant !src) = dtype then begin
if (lt !dst !src) then
dst := !src;
- while (lt !dst len) && (get_variant !dst) <> `Common do
+ while (lt !dst len) && (get_variant !dst) = dtype do
dst := !dst + incr;
done;
if (lt !dst len) && (get_str !src) = (get_str !dst) then begin
diff --git a/library/global.ml b/library/global.ml
index 4ea5969a6f..67b00cf411 100644
--- a/library/global.ml
+++ b/library/global.ml
@@ -88,6 +88,7 @@ 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 set_engagement c = globalize0 (Safe_typing.set_engagement c)
+let set_indices_matter b = globalize0 (Safe_typing.set_indices_matter b)
let set_typing_flags c = globalize0 (Safe_typing.set_typing_flags c)
let typing_flags () = Environ.typing_flags (env ())
let export_private_constants ~in_section cd = globalize (Safe_typing.export_private_constants ~in_section cd)
diff --git a/library/global.mli b/library/global.mli
index 01ee695c49..40962e21af 100644
--- a/library/global.mli
+++ b/library/global.mli
@@ -29,6 +29,7 @@ val named_context : unit -> Constr.named_context
(** Changing the (im)predicativity of the system *)
val set_engagement : Declarations.engagement -> unit
+val set_indices_matter : bool -> unit
val set_typing_flags : Declarations.typing_flags -> unit
val typing_flags : unit -> Declarations.typing_flags
diff --git a/parsing/cLexer.ml b/parsing/cLexer.ml
index 619718f723..d81ee475b5 100644
--- a/parsing/cLexer.ml
+++ b/parsing/cLexer.ml
@@ -11,6 +11,7 @@
open Pp
open Util
open Tok
+open Gramlib
(** Location utilities *)
let ploc_file_of_coq_file = function
diff --git a/parsing/cLexer.mli b/parsing/cLexer.mli
index e4aa8debc1..c0ebdd45ef 100644
--- a/parsing/cLexer.mli
+++ b/parsing/cLexer.mli
@@ -40,7 +40,7 @@ where
tok_text : pattern -> string;
tok_comm : mutable option (list location) }
*)
-include Grammar.GLexerType with type te = Tok.t
+include Gramlib.Grammar.GLexerType with type te = Tok.t
module Error : sig
type t
diff --git a/parsing/dune b/parsing/dune
index 0669e3a3c2..e91740650f 100644
--- a/parsing/dune
+++ b/parsing/dune
@@ -2,7 +2,6 @@
(name parsing)
(public_name coq.parsing)
(wrapped false)
- (flags :standard -open Gramlib)
(libraries coq.gramlib proofs))
(rule
diff --git a/parsing/extend.ml b/parsing/extend.ml
index 6fe2956643..5caeab535a 100644
--- a/parsing/extend.ml
+++ b/parsing/extend.ml
@@ -10,7 +10,7 @@
(** Entry keys for constr notations *)
-type 'a entry = 'a Grammar.GMake(CLexer).Entry.e
+type 'a entry = 'a Gramlib.Grammar.GMake(CLexer).Entry.e
type side = Left | Right
diff --git a/parsing/g_constr.mlg b/parsing/g_constr.mlg
index e25f7aa54f..b3ae24e941 100644
--- a/parsing/g_constr.mlg
+++ b/parsing/g_constr.mlg
@@ -81,7 +81,7 @@ let err () = raise Stream.Failure
(* Hack to parse "(x:=t)" as an explicit argument without conflicts with the *)
(* admissible notation "(x t)" *)
let lpar_id_coloneq =
- Gram.Entry.of_parser "test_lpar_id_coloneq"
+ Pcoq.Entry.of_parser "test_lpar_id_coloneq"
(fun strm ->
match stream_nth 0 strm with
| KEYWORD "(" ->
@@ -96,7 +96,7 @@ let lpar_id_coloneq =
| _ -> err ())
let impl_ident_head =
- Gram.Entry.of_parser "impl_ident_head"
+ Pcoq.Entry.of_parser "impl_ident_head"
(fun strm ->
match stream_nth 0 strm with
| KEYWORD "{" ->
@@ -109,7 +109,7 @@ let impl_ident_head =
| _ -> err ())
let name_colon =
- Gram.Entry.of_parser "name_colon"
+ Pcoq.Entry.of_parser "name_colon"
(fun strm ->
match stream_nth 0 strm with
| IDENT s ->
diff --git a/parsing/g_prim.mlg b/parsing/g_prim.mlg
index dfb788907e..6247a12640 100644
--- a/parsing/g_prim.mlg
+++ b/parsing/g_prim.mlg
@@ -13,7 +13,6 @@
open Names
open Libnames
-open Pcoq
open Pcoq.Prim
let prim_kw = ["{"; "}"; "["; "]"; "("; ")"; "'"]
diff --git a/parsing/pcoq.ml b/parsing/pcoq.ml
index eb3e633892..170df6ad09 100644
--- a/parsing/pcoq.ml
+++ b/parsing/pcoq.ml
@@ -12,8 +12,8 @@ open CErrors
open Util
open Extend
open Genarg
+open Gramlib
-let curry f x y = f (x, y)
let uncurry f (x,y) = f x y
(** Location Utils *)
@@ -59,7 +59,7 @@ module type S =
type e 'a = 'y;
value create : string -> e 'a;
value parse : e 'a -> parsable -> 'a;
- value parse_token : e 'a -> Stream.t te -> 'a;
+ value parse_token_stream : e 'a -> Stream.t te -> 'a;
value name : e 'a -> string;
value of_parser : string -> (Stream.t te -> 'a) -> e 'a;
value print : Format.formatter -> e 'a -> unit;
@@ -83,13 +83,9 @@ module type S =
*)
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 coq_parsable
val coq_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
@@ -100,9 +96,6 @@ end with type 'a Entry.e = 'a Grammar.GMake(CLexer).Entry.e = struct
include Grammar.GMake(CLexer)
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 coq_parsable = parsable * CLexer.lexer_state ref
@@ -113,7 +106,6 @@ end with type 'a Entry.e = 'a Grammar.GMake(CLexer).Entry.e = struct
state := CLexer.get_lexer_state ();
(a,state)
- let action = Gramext.action
let entry_create = Entry.create
let entry_parse e (p,state) =
@@ -148,6 +140,9 @@ struct
let create = G.Entry.create
let parse = G.entry_parse
let print = G.Entry.print
+ let of_parser = G.Entry.of_parser
+ let name = G.Entry.name
+ let parse_token_stream = G.Entry.parse_token_stream
end
@@ -166,16 +161,9 @@ let of_coq_position = function
| Extend.Level s -> Gramext.Level s
module Symbols : sig
- val stoken : Tok.t -> G.symbol
- val sself : G.symbol
- val snext : G.symbol
- val slist0 : G.symbol -> G.symbol
- val slist0sep : G.symbol * G.symbol -> G.symbol
- val slist1 : G.symbol -> G.symbol
- val slist1sep : G.symbol * G.symbol -> G.symbol
- val sopt : G.symbol -> G.symbol
- val snterml : G.internal_entry * string -> G.symbol
- val snterm : G.internal_entry -> G.symbol
+ val stoken : Tok.t -> ('s, string) G.ty_symbol
+ val slist0sep : ('s, 'a) G.ty_symbol -> ('s, 'b) G.ty_symbol -> ('s, 'a list) G.ty_symbol
+ val slist1sep : ('s, 'a) G.ty_symbol -> ('s, 'b) G.ty_symbol -> ('s, 'a list) G.ty_symbol
end = struct
let stoken tok =
@@ -190,19 +178,10 @@ end = struct
| Tok.BULLET s -> "BULLET", s
| Tok.EOI -> "EOI", ""
in
- Gramext.Stoken pattern
-
- let slist0sep (x, y) = Gramext.Slist0sep (x, y, false)
- let slist1sep (x, y) = Gramext.Slist1sep (x, y, false)
-
- let snterml (x, y) = Gramext.Snterml (x, y)
- let snterm x = Gramext.Snterm x
- let sself = Gramext.Sself
- let snext = Gramext.Snext
- let slist0 x = Gramext.Slist0 x
- let slist1 x = Gramext.Slist1 x
- let sopt x = Gramext.Sopt x
+ G.s_token pattern
+ let slist0sep x y = G.s_list0sep x y false
+ let slist1sep x y = G.s_list1sep x y false
end
let camlp5_verbosity silent f x =
@@ -224,40 +203,41 @@ let camlp5_verbosity silent f x =
(** Binding general entry keys to symbol *)
-let rec of_coq_action : type a r. (r, a, Loc.t -> r) Extend.rule -> a -> G.action = function
-| Stop -> fun f -> G.action (fun loc -> f (!@ loc))
-| Next (r, _) -> fun f -> G.action (fun x -> of_coq_action r (f x))
-
-let rec symbol_of_prod_entry_key : type s a. (s, a) symbol -> _ = function
- | Atoken t -> Symbols.stoken t
- | Alist1 s -> Symbols.slist1 (symbol_of_prod_entry_key s)
- | Alist1sep (s,sep) ->
- Symbols.slist1sep (symbol_of_prod_entry_key s, symbol_of_prod_entry_key sep)
- | Alist0 s -> Symbols.slist0 (symbol_of_prod_entry_key s)
- | Alist0sep (s,sep) ->
- Symbols.slist0sep (symbol_of_prod_entry_key s, symbol_of_prod_entry_key sep)
- | Aopt s -> Symbols.sopt (symbol_of_prod_entry_key s)
- | Aself -> Symbols.sself
- | Anext -> Symbols.snext
- | Aentry e ->
- Symbols.snterm (G.Entry.obj e)
- | Aentryl (e, n) ->
- Symbols.snterml (G.Entry.obj e, n)
- | Arules rs ->
- Gramext.srules (List.map symbol_of_rules rs)
-
-and symbol_of_rule : type s a r. (s, a, r) Extend.rule -> _ = function
-| Stop -> fun accu -> accu
-| Next (r, s) -> fun accu -> symbol_of_rule r (symbol_of_prod_entry_key s :: accu)
-
-and symbol_of_rules : type a. a Extend.rules -> _ = function
+type ('s, 'a, 'r) casted_rule = Casted : ('s, 'b, 'r) G.ty_rule * ('a -> 'b) -> ('s, 'a, 'r) casted_rule
+
+let rec symbol_of_prod_entry_key : type s a. (s, a) symbol -> (s, a) G.ty_symbol = function
+| Atoken t -> Symbols.stoken t
+| Alist1 s -> G.s_list1 (symbol_of_prod_entry_key s)
+| Alist1sep (s,sep) ->
+ Symbols.slist1sep (symbol_of_prod_entry_key s) (symbol_of_prod_entry_key sep)
+| Alist0 s -> G.s_list0 (symbol_of_prod_entry_key s)
+| Alist0sep (s,sep) ->
+ Symbols.slist0sep (symbol_of_prod_entry_key s) (symbol_of_prod_entry_key sep)
+| Aopt s -> G.s_opt (symbol_of_prod_entry_key s)
+| Aself -> G.s_self
+| Anext -> G.s_next
+| Aentry e -> G.s_nterm e
+| Aentryl (e, n) -> G.s_nterml e n
+| Arules rs -> G.s_rules (List.map symbol_of_rules rs)
+
+and symbol_of_rule : type s a r. (s, a, Loc.t -> r) Extend.rule -> (s, a, Ploc.t -> r) casted_rule = function
+| Stop -> Casted (G.r_stop, fun act loc -> act (!@loc))
+| Next (r, s) ->
+ let Casted (r, cast) = symbol_of_rule r in
+ Casted (G.r_next r (symbol_of_prod_entry_key s), (fun act x -> cast (act x)))
+
+and symbol_of_rules : type a. a Extend.rules -> a G.ty_production = function
| Rules (r, act) ->
- let symb = symbol_of_rule r.norec_rule [] in
- let act = of_coq_action r.norec_rule act in
- (symb, act)
+ let Casted (symb, cast) = symbol_of_rule r.norec_rule in
+ G.production (symb, cast act)
+
+(** FIXME: This is a hack around a deficient camlp5 API *)
+type 'a any_production = AnyProduction : ('a, 'f, Ploc.t -> 'a) G.ty_rule * 'f -> 'a any_production
-let of_coq_production_rule : type a. a Extend.production_rule -> _ = function
-| Rule (toks, act) -> (symbol_of_rule toks [], of_coq_action toks act)
+let of_coq_production_rule : type a. a Extend.production_rule -> a any_production = function
+| Rule (toks, act) ->
+ let Casted (symb, cast) = symbol_of_rule toks in
+ AnyProduction (symb, cast act)
let of_coq_single_extend_statement (lvl, assoc, rule) =
(lvl, Option.map of_coq_assoc assoc, List.map of_coq_production_rule rule)
@@ -265,6 +245,13 @@ let of_coq_single_extend_statement (lvl, assoc, rule) =
let of_coq_extend_statement (pos, st) =
(Option.map of_coq_position pos, List.map of_coq_single_extend_statement st)
+let fix_extend_statement (pos, st) =
+ let fix_single_extend_statement (lvl, assoc, rules) =
+ let fix_production_rule (AnyProduction (s, act)) = G.production (s, act) in
+ (lvl, assoc, List.map fix_production_rule rules)
+ in
+ (pos, List.map fix_single_extend_statement st)
+
(** Type of reinitialization data *)
type gram_reinit = gram_assoc * gram_position
@@ -291,7 +278,7 @@ let camlp5_entries = ref EntryDataMap.empty
let grammar_delete e reinit (pos,rls) =
List.iter
(fun (n,ass,lev) ->
- List.iter (fun (pil,_) -> G.delete_rule e pil) (List.rev lev))
+ List.iter (fun (AnyProduction (pil,_)) -> G.safe_delete_rule e pil) (List.rev lev))
(List.rev rls);
match reinit with
| Some (a,ext) ->
@@ -301,7 +288,7 @@ let grammar_delete e reinit (pos,rls) =
| Some (Gramext.Level n) -> n
| _ -> assert false
in
- (G.extend e) (Some ext) [Some lev,Some a,[]]
+ (G.safe_extend e) (Some ext) [Some lev,Some a,[]]
| None -> ()
(** Extension *)
@@ -309,13 +296,15 @@ let grammar_delete e reinit (pos,rls) =
let grammar_extend e reinit ext =
let ext = of_coq_extend_statement ext in
let undo () = grammar_delete e reinit ext in
- let redo () = camlp5_verbosity false (uncurry (G.extend e)) ext in
+ let ext = fix_extend_statement ext in
+ let redo () = camlp5_verbosity false (uncurry (G.safe_extend e)) ext in
camlp5_state := ByEXTEND (undo, redo) :: !camlp5_state;
redo ()
let grammar_extend_sync e reinit ext =
camlp5_state := ByGrammar (ExtendRule (e, reinit, ext)) :: !camlp5_state;
- camlp5_verbosity false (uncurry (G.extend e)) (of_coq_extend_statement ext)
+ let ext = fix_extend_statement (of_coq_extend_statement ext) in
+ camlp5_verbosity false (uncurry (G.safe_extend e)) ext
(** The apparent parser of Coq; encapsulate G to keep track
of the extensions. *)
@@ -323,25 +312,6 @@ let grammar_extend_sync e reinit ext =
module Gram =
struct
include G
- let extend e =
- curry
- (fun ext ->
- camlp5_state :=
- (ByEXTEND ((fun () -> grammar_delete e None ext),
- (fun () -> uncurry (G.extend e) ext)))
- :: !camlp5_state;
- uncurry (G.extend e) ext)
- let delete_rule e pil =
- (* spiwack: if you use load an ML module which contains GDELETE_RULE
- in a section, God kills a kitty. As it would corrupt remove_grammars.
- There does not seem to be a good way to undo a delete rule. As deleting
- takes fewer arguments than extending. The production rule isn't returned
- by delete_rule. If we could retrieve the necessary information, then
- ByEXTEND provides just the framework we need to allow this in section.
- I'm not entirely sure it makes sense, but at least it would be more correct.
- *)
- G.delete_rule e pil
- let gram_extend e ext = grammar_extend e None ext
end
(** Remove extensions
@@ -380,16 +350,16 @@ let make_rule r = [None, None, r]
let eoi_entry en =
let e = Entry.create ((Gram.Entry.name en) ^ "_eoi") in
- let symbs = [Symbols.snterm (Gram.Entry.obj en); Symbols.stoken Tok.EOI] in
- let act = Gram.action (fun _ x loc -> x) in
- uncurry (Gram.extend e) (None, make_rule [symbs, act]);
+ let symbs = G.r_next (G.r_next G.r_stop (G.s_nterm en)) (Symbols.stoken Tok.EOI) in
+ let act = fun _ x loc -> x in
+ Gram.safe_extend e None (make_rule [G.production (symbs, act)]);
e
let map_entry f en =
let e = Entry.create ((Gram.Entry.name en) ^ "_map") in
- let symbs = [Symbols.snterm (Gram.Entry.obj en)] in
- let act = Gram.action (fun x loc -> f x) in
- uncurry (Gram.extend e) (None, make_rule [symbs, act]);
+ let symbs = G.r_next G.r_stop (G.s_nterm en) in
+ let act = fun x loc -> f x in
+ Gram.safe_extend e None (make_rule [G.production (symbs, act)]);
e
(* Parse a string, does NOT check if the entire string was read
@@ -516,10 +486,10 @@ module Module =
end
let epsilon_value f e =
- let r = Rule (Next (Stop, e), fun x _ -> f x) in
- let ext = of_coq_extend_statement (None, [None, None, [r]]) in
+ let r = G.production (G.r_next G.r_stop (symbol_of_prod_entry_key e), (fun x _ -> f x)) in
+ let ext = [None, None, [r]] in
let entry = Gram.entry_create "epsilon" in
- let () = uncurry (G.extend entry) ext in
+ let () = G.safe_extend entry None ext in
try Some (parse_string entry "") with _ -> None
(** Synchronized grammar extensions *)
diff --git a/parsing/pcoq.mli b/parsing/pcoq.mli
index c05229d576..e64c614149 100644
--- a/parsing/pcoq.mli
+++ b/parsing/pcoq.mli
@@ -13,20 +13,10 @@ open Extend
open Genarg
open Constrexpr
open Libnames
+open Gramlib
(** The parser of Coq *)
-(** DO NOT USE EXTENSION FUNCTIONS IN THIS MODULE.
- We only have it here to work with Camlp5. Handwritten grammar extensions
- should use the safe [Pcoq.grammar_extend] function below. *)
-module Gram : sig
-
- include Grammar.S with type te = Tok.t
-
- val gram_extend : 'a Entry.e -> 'a Extend.extend_statement -> unit
-
-end with type 'a Entry.e = 'a Grammar.GMake(CLexer).Entry.e
-
module Parsable :
sig
type t
@@ -40,6 +30,9 @@ module Entry : sig
val create : string -> 'a t
val parse : 'a t -> Parsable.t -> 'a
val print : Format.formatter -> 'a t -> unit
+ val of_parser : string -> (Tok.t Stream.t -> 'a) -> 'a t
+ val parse_token_stream : 'a t -> Tok.t Stream.t -> 'a
+ val name : 'a t -> string
end
(** The parser of Coq is built from three kinds of rule declarations:
diff --git a/plugins/btauto/Algebra.v b/plugins/btauto/Algebra.v
index f1095fc9f1..638a4cef21 100644
--- a/plugins/btauto/Algebra.v
+++ b/plugins/btauto/Algebra.v
@@ -10,7 +10,7 @@ end.
Arguments decide P /H.
-Hint Extern 5 => progress bool.
+Hint Extern 5 => progress bool : core.
Ltac define t x H :=
set (x := t) in *; assert (H : t = x) by reflexivity; clearbody x.
@@ -147,7 +147,7 @@ Qed.
(** * The core reflexive part. *)
-Hint Constructors valid.
+Hint Constructors valid : core.
Fixpoint beq_poly pl pr :=
match pl with
@@ -315,7 +315,7 @@ Section Validity.
(* Decision procedure of validity *)
-Hint Constructors valid linear.
+Hint Constructors valid linear : core.
Lemma valid_le_compat : forall k l p, valid k p -> (k <= l)%positive -> valid l p.
Proof.
@@ -425,10 +425,10 @@ match goal with
| [ |- (?z < Pos.max ?x ?y)%positive ] =>
apply Pos.max_case_strong; intros; lia
| _ => zify; omega
-end.
-Hint Resolve Pos.le_max_r Pos.le_max_l.
+end : core.
+Hint Resolve Pos.le_max_r Pos.le_max_l : core.
-Hint Constructors valid linear.
+Hint Constructors valid linear : core.
(* Compatibility of validity w.r.t algebraic operations *)
diff --git a/plugins/btauto/Reflect.v b/plugins/btauto/Reflect.v
index 4cde08872f..98f5ab067a 100644
--- a/plugins/btauto/Reflect.v
+++ b/plugins/btauto/Reflect.v
@@ -77,10 +77,10 @@ intros var f; induction f; simpl poly_of_formula; simpl formula_eval; auto.
end.
Qed.
-Hint Extern 5 => change 0 with (min 0 0).
-Local Hint Resolve poly_add_valid_compat poly_mul_valid_compat.
-Local Hint Constructors valid.
-Hint Extern 5 => zify; omega.
+Hint Extern 5 => change 0 with (min 0 0) : core.
+Local Hint Resolve poly_add_valid_compat poly_mul_valid_compat : core.
+Local Hint Constructors valid : core.
+Hint Extern 5 => zify; omega : core.
(* Compatibility with validity *)
diff --git a/plugins/derive/g_derive.mlg b/plugins/derive/g_derive.mlg
index 18316bf2cd..df4b647642 100644
--- a/plugins/derive/g_derive.mlg
+++ b/plugins/derive/g_derive.mlg
@@ -18,7 +18,7 @@ DECLARE PLUGIN "derive_plugin"
{
-let classify_derive_command _ = Vernacexpr.(VtStartProof ("Classic",Doesn'tGuaranteeOpacity,[]),VtLater)
+let classify_derive_command _ = Vernacextend.(VtStartProof ("Classic",Doesn'tGuaranteeOpacity,[]),VtLater)
}
diff --git a/plugins/firstorder/g_ground.mlg b/plugins/firstorder/g_ground.mlg
index 1128a78093..a212d13453 100644
--- a/plugins/firstorder/g_ground.mlg
+++ b/plugins/firstorder/g_ground.mlg
@@ -66,7 +66,7 @@ let default_intuition_tac =
let name = { Tacexpr.mltac_plugin = "ground_plugin"; mltac_tactic = "auto_with"; } in
let entry = { Tacexpr.mltac_name = name; mltac_index = 0 } in
Tacenv.register_ml_tactic name [| tac |];
- Tacexpr.TacML (Loc.tag (entry, []))
+ Tacexpr.TacML (CAst.make (entry, []))
let (set_default_solver, default_solver, print_default_solver) =
Tactic_option.declare_tactic_option ~default:default_intuition_tac "Firstorder default solver"
diff --git a/plugins/firstorder/ground.ml b/plugins/firstorder/ground.ml
index 516b04ea21..6a80525200 100644
--- a/plugins/firstorder/ground.ml
+++ b/plugins/firstorder/ground.ml
@@ -18,16 +18,16 @@ open Tacticals.New
open Globnames
let update_flags ()=
- let f acc coe =
- match coe.Classops.coe_value with
- | ConstRef c -> Names.Cpred.add c acc
- | _ -> acc
+ let open TransparentState in
+ let f accu coe = match coe.Classops.coe_value with
+ | ConstRef kn -> { accu with tr_cst = Names.Cpred.remove kn accu.tr_cst }
+ | _ -> accu
in
- let pred = List.fold_left f Names.Cpred.empty (Classops.coercions ()) in
+ let flags = List.fold_left f TransparentState.full (Classops.coercions ()) in
red_flags:=
CClosure.RedFlags.red_add_transparent
CClosure.betaiotazeta
- (Names.Id.Pred.full,Names.Cpred.complement pred)
+ flags
let ground_tac solver startseq =
Proofview.Goal.enter begin fun gl ->
diff --git a/plugins/funind/functional_principles_proofs.ml b/plugins/funind/functional_principles_proofs.ml
index 651895aa08..ef1d1af199 100644
--- a/plugins/funind/functional_principles_proofs.ml
+++ b/plugins/funind/functional_principles_proofs.ml
@@ -131,8 +131,7 @@ let finish_proof dynamic_infos g =
g
-let refine c =
- Tacmach.refine c
+let refine c = Refiner.refiner ~check:true EConstr.Unsafe.(to_constr c)
let thin l = Proofview.V82.of_tactic (Tactics.clear l)
@@ -1487,7 +1486,7 @@ let new_prove_with_tcc is_mes acc_inv hrec tcc_hyps eqs : tactic =
Eauto.eauto_with_bases
(true,5)
[(fun _ sigma -> (sigma, Lazy.force refl_equal))]
- [Hints.Hint_db.empty empty_transparent_state false]
+ [Hints.Hint_db.empty TransparentState.empty false]
)
)
)
diff --git a/plugins/funind/functional_principles_types.ml b/plugins/funind/functional_principles_types.ml
index d1e7d8a5a8..1cf952576d 100644
--- a/plugins/funind/functional_principles_types.ml
+++ b/plugins/funind/functional_principles_types.ml
@@ -320,10 +320,16 @@ let build_functional_principle (evd:Evd.evar_map ref) interactive_proof old_prin
(* let dur1 = System.time_difference tim1 tim2 in *)
(* Pp.msgnl (str ("Time to compute proof: ") ++ str (string_of_float dur1)); *)
(* end; *)
- get_proof_clean true, CEphemeron.create hook
- end
-
+ let open Proof_global in
+ let { id; entries; persistence } = fst @@ close_proof ~keep_body_ucst_separate:false (fun x -> x) in
+ match entries with
+ | [entry] ->
+ discard_current ();
+ (id,(entry,persistence)), CEphemeron.create hook
+ | _ ->
+ CErrors.anomaly Pp.(str "[build_functional_principle] close_proof returned more than one proof term")
+ end
let generate_functional_principle (evd: Evd.evar_map ref)
interactive_proof
diff --git a/plugins/funind/g_indfun.mlg b/plugins/funind/g_indfun.mlg
index 155df1c1e0..8f0440a2a4 100644
--- a/plugins/funind/g_indfun.mlg
+++ b/plugins/funind/g_indfun.mlg
@@ -145,7 +145,6 @@ END
{
-module Gram = Pcoq.Gram
module Vernac = Pvernac.Vernac_
module Tactic = Pltac
@@ -186,8 +185,8 @@ VERNAC COMMAND EXTEND Function
Vernac_classifier.classify_vernac
(Vernacexpr.(VernacExpr([], VernacFixpoint(Decl_kinds.NoDischarge, List.map snd recsl))))
with
- | Vernacexpr.VtSideff ids, _ when hard ->
- Vernacexpr.(VtStartProof ("Classic", GuaranteesOpacity, ids), VtLater)
+ | Vernacextend.VtSideff ids, _ when hard ->
+ Vernacextend.(VtStartProof ("Classic", GuaranteesOpacity, ids), VtLater)
| x -> x }
-> { do_generate_principle false (List.map snd recsl) }
END
@@ -225,7 +224,7 @@ let warning_error names e =
VERNAC COMMAND EXTEND NewFunctionalScheme
| ["Functional" "Scheme" ne_fun_scheme_arg_list_sep(fas,"with") ]
- => { Vernacexpr.VtSideff(List.map pi1 fas), Vernacexpr.VtLater }
+ => { Vernacextend.(VtSideff(List.map pi1 fas), VtLater) }
->
{
begin
@@ -261,7 +260,7 @@ END
VERNAC COMMAND EXTEND NewFunctionalCase
| ["Functional" "Case" fun_scheme_arg(fas) ]
- => { Vernacexpr.VtSideff[pi1 fas], Vernacexpr.VtLater }
+ => { Vernacextend.(VtSideff[pi1 fas], VtLater) }
-> { Functional_principles_types.build_case_scheme fas }
END
diff --git a/plugins/funind/indfun_common.ml b/plugins/funind/indfun_common.ml
index cd2ea3ef88..b68b34ca35 100644
--- a/plugins/funind/indfun_common.ml
+++ b/plugins/funind/indfun_common.ml
@@ -147,17 +147,6 @@ let save with_clean id const (locality,_,kind) hook =
CEphemeron.iter_opt hook (fun f -> Lemmas.call_hook fix_exn f l r);
definition_message id
-
-
-let cook_proof _ =
- let (id,(entry,_,strength)) = Pfedit.cook_proof () in
- (id,(entry,strength))
-
-let get_proof_clean do_reduce =
- let result = cook_proof do_reduce in
- Proof_global.discard_current ();
- result
-
let with_full_print f a =
let old_implicit_args = Impargs.is_implicit_args ()
and old_strict_implicit_args = Impargs.is_strict_implicit_args ()
diff --git a/plugins/funind/indfun_common.mli b/plugins/funind/indfun_common.mli
index 0c8f40c5cf..c9d153d89f 100644
--- a/plugins/funind/indfun_common.mli
+++ b/plugins/funind/indfun_common.mli
@@ -45,15 +45,6 @@ val jmeq_refl : unit -> EConstr.constr
val save : bool -> Id.t -> Safe_typing.private_constants Entries.definition_entry -> Decl_kinds.goal_kind ->
Lemmas.declaration_hook CEphemeron.key -> unit
-(* [get_proof_clean do_reduce] : returns the proof name, definition, kind and hook and
- abort the proof
-*)
-val get_proof_clean : bool ->
- Names.Id.t *
- (Safe_typing.private_constants Entries.definition_entry * Decl_kinds.goal_kind)
-
-
-
(* [with_full_print f a] applies [f] to [a] in full printing environment.
This function preserves the print settings
diff --git a/plugins/funind/plugin_base.dune b/plugins/funind/plugin_base.dune
index 9f583234d8..002eb28eea 100644
--- a/plugins/funind/plugin_base.dune
+++ b/plugins/funind/plugin_base.dune
@@ -2,5 +2,4 @@
(name recdef_plugin)
(public_name coq.plugins.recdef)
(synopsis "Coq's functional induction plugin")
- (flags :standard -open Gramlib)
(libraries coq.plugins.extraction))
diff --git a/plugins/funind/recdef.ml b/plugins/funind/recdef.ml
index 63a3e0582d..6e5e3f9353 100644
--- a/plugins/funind/recdef.ml
+++ b/plugins/funind/recdef.ml
@@ -1359,7 +1359,7 @@ let open_new_goal build_proof sigma using_lemmas ref_ goal_name (gls_type,decomp
Eauto.eauto_with_bases
(true,5)
[(fun _ sigma -> (sigma, (Lazy.force refl_equal)))]
- [Hints.Hint_db.empty empty_transparent_state false]
+ [Hints.Hint_db.empty TransparentState.empty false]
]
)
)
diff --git a/plugins/ltac/coretactics.mlg b/plugins/ltac/coretactics.mlg
index 6388906f5e..d9338f0421 100644
--- a/plugins/ltac/coretactics.mlg
+++ b/plugins/ltac/coretactics.mlg
@@ -333,7 +333,7 @@ open Tacexpr
let initial_atomic () =
let nocl = {onhyps=Some[];concl_occs=AllOccurrences} in
let iter (s, t) =
- let body = TacAtom (Loc.tag t) in
+ let body = TacAtom (CAst.make t) in
Tacenv.register_ltac false false (Names.Id.of_string s) body
in
let () = List.iter iter
@@ -348,7 +348,7 @@ let initial_atomic () =
List.iter iter
[ "idtac",TacId [];
"fail", TacFail(TacLocal,ArgArg 0,[]);
- "fresh", TacArg(Loc.tag @@ TacFreshId [])
+ "fresh", TacArg(CAst.make @@ TacFreshId [])
]
let () = Mltop.declare_cache_obj initial_atomic "ltac_plugin"
@@ -379,8 +379,8 @@ let initial_tacticals () =
let varn n = Reference (ArgVar (CAst.make (idn n))) in
let iter (s, t) = Tacenv.register_ltac false false (Id.of_string s) t in
List.iter iter [
- "first", TacFun ([Name (idn 0)], TacML (None, (initial_entry "first", [varn 0])));
- "solve", TacFun ([Name (idn 0)], TacML (None, (initial_entry "solve", [varn 0])));
+ "first", TacFun ([Name (idn 0)], TacML (CAst.make (initial_entry "first", [varn 0])));
+ "solve", TacFun ([Name (idn 0)], TacML (CAst.make (initial_entry "solve", [varn 0])));
]
let () = Mltop.declare_cache_obj initial_tacticals "ltac_plugin"
diff --git a/plugins/ltac/extraargs.mlg b/plugins/ltac/extraargs.mlg
index c4c4e51ecc..156ee94a66 100644
--- a/plugins/ltac/extraargs.mlg
+++ b/plugins/ltac/extraargs.mlg
@@ -332,7 +332,7 @@ END
let local_test_lpar_id_colon =
let err () = raise Stream.Failure in
- Pcoq.Gram.Entry.of_parser "lpar_id_colon"
+ Pcoq.Entry.of_parser "lpar_id_colon"
(fun strm ->
match Util.stream_nth 0 strm with
| Tok.KEYWORD "(" ->
diff --git a/plugins/ltac/extratactics.mlg b/plugins/ltac/extratactics.mlg
index 85fb0c73c9..603dd60cf2 100644
--- a/plugins/ltac/extratactics.mlg
+++ b/plugins/ltac/extratactics.mlg
@@ -31,6 +31,7 @@ open Tactypes
open Tactics
open Proofview.Notations
open Attributes
+open Vernacextend
let wit_hyp = wit_var
@@ -48,7 +49,6 @@ let with_delayed_uconstr ist c tac =
let flags = {
Pretyping.use_typeclasses = false;
solve_unification_constraints = true;
- use_hook = Pfedit.solve_by_implicit_tactic ();
fail_evar = false;
expand_evars = true
} in
@@ -316,7 +316,7 @@ let add_rewrite_hint ~poly bases ort t lcsr =
let add_hints base = add_rew_rules base eqs in
List.iter add_hints bases
-let classify_hint _ = Vernacexpr.VtSideff [], Vernacexpr.VtLater
+let classify_hint _ = VtSideff [], VtLater
}
@@ -343,7 +343,6 @@ open Vars
let constr_flags () = {
Pretyping.use_typeclasses = true;
Pretyping.solve_unification_constraints = Pfedit.use_unification_heuristics ();
- Pretyping.use_hook = Pfedit.solve_by_implicit_tactic ();
Pretyping.fail_evar = false;
Pretyping.expand_evars = true }
@@ -400,7 +399,7 @@ END
open Inv
open Leminv
-let seff id = Vernacexpr.VtSideff [id], Vernacexpr.VtLater
+let seff id = VtSideff [id], VtLater
}
@@ -571,44 +570,6 @@ VERNAC COMMAND EXTEND AddStepr CLASSIFIED AS SIDEFF
{ add_transitivity_lemma false t }
END
-{
-
-let cache_implicit_tactic (_,tac) = match tac with
- | Some tac -> Pfedit.declare_implicit_tactic (Tacinterp.eval_tactic tac)
- | None -> Pfedit.clear_implicit_tactic ()
-
-let subst_implicit_tactic (subst,tac) =
- Option.map (Tacsubst.subst_tactic subst) tac
-
-let inImplicitTactic : glob_tactic_expr option -> obj =
- declare_object {(default_object "IMPLICIT-TACTIC") with
- open_function = (fun i o -> if Int.equal i 1 then cache_implicit_tactic o);
- cache_function = cache_implicit_tactic;
- subst_function = subst_implicit_tactic;
- classify_function = (fun o -> Dispose)}
-
-let warn_deprecated_implicit_tactic =
- CWarnings.create ~name:"deprecated-implicit-tactic" ~category:"deprecated"
- (fun () -> strbrk "Implicit tactics are deprecated")
-
-let declare_implicit_tactic tac =
- let () = warn_deprecated_implicit_tactic () in
- Lib.add_anonymous_leaf (inImplicitTactic (Some (Tacintern.glob_tactic tac)))
-
-let clear_implicit_tactic () =
- let () = warn_deprecated_implicit_tactic () in
- Lib.add_anonymous_leaf (inImplicitTactic None)
-
-}
-
-VERNAC COMMAND EXTEND ImplicitTactic CLASSIFIED AS SIDEFF
-| [ "Declare" "Implicit" "Tactic" tactic(tac) ] -> { declare_implicit_tactic tac }
-| [ "Clear" "Implicit" "Tactic" ] -> { clear_implicit_tactic () }
-END
-
-
-
-
(**********************************************************************)
(* sozeau: abs/gen for induction on instantiated dependent inductives, using "Ford" induction as
defined by Conor McBride *)
@@ -807,7 +768,7 @@ let case_eq_intros_rewrite x =
let rec find_a_destructable_match sigma t =
let cl = induction_arg_of_quantified_hyp (NamedHyp (Id.of_string "x")) in
let cl = [cl, (None, None), None], None in
- let dest = TacAtom (Loc.tag @@ TacInductionDestruct(false, false, cl)) in
+ let dest = TacAtom (CAst.make @@ TacInductionDestruct(false, false, cl)) in
match EConstr.kind sigma t with
| Case (_,_,x,_) when closed0 sigma x ->
if isVar sigma x then
@@ -950,7 +911,7 @@ END
mode. *)
VERNAC COMMAND EXTEND GrabEvars
| [ "Grab" "Existential" "Variables" ]
- => { Vernac_classifier.classify_as_proofstep }
+ => { classify_as_proofstep }
-> { Proof_global.simple_with_current_proof (fun _ p -> Proof.V82.grab_evars p) }
END
@@ -982,7 +943,7 @@ END
(* Command to add every unshelved variables to the focus *)
VERNAC COMMAND EXTEND Unshelve
| [ "Unshelve" ]
- => { Vernac_classifier.classify_as_proofstep }
+ => { classify_as_proofstep }
-> { Proof_global.simple_with_current_proof (fun _ p -> Proof.unshelve p) }
END
@@ -1134,9 +1095,9 @@ END
VERNAC COMMAND EXTEND OptimizeProof
-| [ "Optimize" "Proof" ] => { Vernac_classifier.classify_as_proofstep } ->
+| [ "Optimize" "Proof" ] => { classify_as_proofstep } ->
{ Proof_global.compact_the_proof () }
-| [ "Optimize" "Heap" ] => { Vernac_classifier.classify_as_proofstep } ->
+| [ "Optimize" "Heap" ] => { classify_as_proofstep } ->
{ Gc.compact () }
END
diff --git a/plugins/ltac/g_auto.mlg b/plugins/ltac/g_auto.mlg
index 5af393a3e5..7be8f67616 100644
--- a/plugins/ltac/g_auto.mlg
+++ b/plugins/ltac/g_auto.mlg
@@ -55,7 +55,6 @@ let eval_uconstrs ist cs =
let flags = {
Pretyping.use_typeclasses = false;
solve_unification_constraints = true;
- use_hook = Pfedit.solve_by_implicit_tactic ();
fail_evar = false;
expand_evars = true
} in
diff --git a/plugins/ltac/g_ltac.mlg b/plugins/ltac/g_ltac.mlg
index c58c8556c5..338839ee96 100644
--- a/plugins/ltac/g_ltac.mlg
+++ b/plugins/ltac/g_ltac.mlg
@@ -33,7 +33,7 @@ open Pltac
let fail_default_value = Locus.ArgArg 0
let arg_of_expr = function
- TacArg (loc,a) -> a
+ TacArg { CAst.v } -> v
| e -> Tacexp (e:raw_tactic_expr)
let genarg_of_unit () = in_gen (rawwit Stdarg.wit_unit) ()
@@ -70,7 +70,7 @@ let _ =
(* Hack to parse "[ id" without dropping [ *)
let test_bracket_ident =
- Gram.Entry.of_parser "test_bracket_ident"
+ Pcoq.Entry.of_parser "test_bracket_ident"
(fun strm ->
match stream_nth 0 strm with
| KEYWORD "[" ->
@@ -162,9 +162,9 @@ GRAMMAR EXTEND Gram
| g=failkw; n = [ n = int_or_var -> { n } | -> { fail_default_value } ];
l = LIST0 message_token -> { TacFail (g,n,l) }
| st = simple_tactic -> { st }
- | a = tactic_arg -> { TacArg(Loc.tag ~loc a) }
+ | a = tactic_arg -> { TacArg(CAst.make ~loc a) }
| r = reference; la = LIST0 tactic_arg_compat ->
- { TacArg(Loc.tag ~loc @@ TacCall (Loc.tag ~loc (r,la))) } ]
+ { TacArg(CAst.make ~loc @@ TacCall (CAst.make ~loc (r,la))) } ]
| "0"
[ "("; a = tactic_expr; ")" -> { a }
| "["; ">"; tg = tactic_then_gen; "]" -> {
@@ -173,7 +173,7 @@ GRAMMAR EXTEND Gram
| Some (t,tl) -> TacExtendTac(Array.of_list tf,t,tl)
| None -> TacDispatch tf
end }
- | a = tactic_atom -> { TacArg (Loc.tag ~loc a) } ] ]
+ | a = tactic_atom -> { TacArg (CAst.make ~loc a) } ] ]
;
failkw:
[ [ IDENT "fail" -> { TacLocal } | IDENT "gfail" -> { TacGlobal } ] ]
@@ -223,7 +223,7 @@ GRAMMAR EXTEND Gram
;
tactic_atom:
[ [ n = integer -> { TacGeneric (genarg_of_int n) }
- | r = reference -> { TacCall (Loc.tag ~loc (r,[])) }
+ | r = reference -> { TacCall (CAst.make ~loc (r,[])) }
| "()" -> { TacGeneric (genarg_of_unit ()) } ] ]
;
match_key:
@@ -367,8 +367,7 @@ GRAMMAR EXTEND Gram
open Stdarg
open Tacarg
-open Vernacexpr
-open Vernac_classifier
+open Vernacextend
open Goptions
open Libnames
diff --git a/plugins/ltac/g_obligations.mlg b/plugins/ltac/g_obligations.mlg
index aa78fb5d1e..ef18dd6cdc 100644
--- a/plugins/ltac/g_obligations.mlg
+++ b/plugins/ltac/g_obligations.mlg
@@ -45,7 +45,6 @@ let with_tac f tac =
* Subtac. These entries are named Subtac.<foo>
*)
-module Gram = Pcoq.Gram
module Tactic = Pltac
open Pcoq
@@ -84,7 +83,7 @@ open Obligations
let obligation obl tac = with_tac (fun t -> Obligations.obligation obl t) tac
let next_obligation obl tac = with_tac (fun t -> Obligations.next_obligation obl t) tac
-let classify_obbl _ = Vernacexpr.(VtStartProof ("Classic",Doesn'tGuaranteeOpacity,[]), VtLater)
+let classify_obbl _ = Vernacextend.(VtStartProof ("Classic",Doesn'tGuaranteeOpacity,[]), VtLater)
}
diff --git a/plugins/ltac/g_rewrite.mlg b/plugins/ltac/g_rewrite.mlg
index 1c7220ddc0..f7375a0f01 100644
--- a/plugins/ltac/g_rewrite.mlg
+++ b/plugins/ltac/g_rewrite.mlg
@@ -26,6 +26,7 @@ open Pcoq.Prim
open Pcoq.Constr
open Pvernac.Vernac_
open Pltac
+open Vernacextend
let wit_hyp = wit_var
@@ -225,8 +226,6 @@ let () =
let raw_printer _ _ _ l = Pp.pr_non_empty_arg Ppconstr.pr_binders l in
Pptactic.declare_extra_vernac_genarg_pprule wit_binders raw_printer
-open Pcoq
-
}
GRAMMAR EXTEND Gram
@@ -280,18 +279,18 @@ VERNAC COMMAND EXTEND AddSetoid1 CLASSIFIED AS SIDEFF
}
| #[ atts = rewrite_attributes; ] [ "Add" "Morphism" constr(m) ":" ident(n) ]
(* This command may or may not open a goal *)
- => { Vernacexpr.VtUnknown, Vernacexpr.VtNow }
+ => { VtUnknown, VtNow }
-> {
add_morphism_infer atts m n;
}
| #[ atts = rewrite_attributes; ] [ "Add" "Morphism" constr(m) "with" "signature" lconstr(s) "as" ident(n) ]
- => { Vernacexpr.(VtStartProof("Classic",GuaranteesOpacity,[n]), VtLater) }
+ => { VtStartProof("Classic",GuaranteesOpacity,[n]), VtLater }
-> {
add_morphism atts [] m s n;
}
| #[ atts = rewrite_attributes; ] [ "Add" "Parametric" "Morphism" binders(binders) ":" constr(m)
"with" "signature" lconstr(s) "as" ident(n) ]
- => { Vernacexpr.(VtStartProof("Classic",GuaranteesOpacity,[n]), VtLater) }
+ => { VtStartProof("Classic",GuaranteesOpacity,[n]), VtLater }
-> {
add_morphism atts binders m s n;
}
diff --git a/plugins/ltac/g_tactic.mlg b/plugins/ltac/g_tactic.mlg
index 571595be70..46ea3819ac 100644
--- a/plugins/ltac/g_tactic.mlg
+++ b/plugins/ltac/g_tactic.mlg
@@ -39,7 +39,7 @@ let err () = raise Stream.Failure
(* Hack to parse "(x:=t)" as an explicit argument without conflicts with the *)
(* admissible notation "(x t)" *)
let test_lpar_id_coloneq =
- Gram.Entry.of_parser "lpar_id_coloneq"
+ Pcoq.Entry.of_parser "lpar_id_coloneq"
(fun strm ->
match stream_nth 0 strm with
| KEYWORD "(" ->
@@ -53,7 +53,7 @@ let test_lpar_id_coloneq =
(* Hack to recognize "(x)" *)
let test_lpar_id_rpar =
- Gram.Entry.of_parser "lpar_id_coloneq"
+ Pcoq.Entry.of_parser "lpar_id_coloneq"
(fun strm ->
match stream_nth 0 strm with
| KEYWORD "(" ->
@@ -67,7 +67,7 @@ let test_lpar_id_rpar =
(* idem for (x:=t) and (1:=t) *)
let test_lpar_idnum_coloneq =
- Gram.Entry.of_parser "test_lpar_idnum_coloneq"
+ Pcoq.Entry.of_parser "test_lpar_idnum_coloneq"
(fun strm ->
match stream_nth 0 strm with
| KEYWORD "(" ->
@@ -84,7 +84,7 @@ open Extraargs
(* idem for (x1..xn:t) [n^2 complexity but exceptional use] *)
let check_for_coloneq =
- Gram.Entry.of_parser "lpar_id_colon"
+ Pcoq.Entry.of_parser "lpar_id_colon"
(fun strm ->
let rec skip_to_rpar p n =
match List.last (Stream.npeek n strm) with
@@ -108,7 +108,7 @@ let check_for_coloneq =
| _ -> err ())
let lookup_at_as_comma =
- Gram.Entry.of_parser "lookup_at_as_comma"
+ Pcoq.Entry.of_parser "lookup_at_as_comma"
(fun strm ->
match stream_nth 0 strm with
| KEYWORD (","|"at"|"as") -> ()
@@ -529,178 +529,178 @@ GRAMMAR EXTEND Gram
[ [
(* Basic tactics *)
IDENT "intros"; pl = ne_intropatterns ->
- { TacAtom (Loc.tag ~loc @@ TacIntroPattern (false,pl)) }
+ { TacAtom (CAst.make ~loc @@ TacIntroPattern (false,pl)) }
| IDENT "intros" ->
- { TacAtom (Loc.tag ~loc @@ TacIntroPattern (false,[CAst.make ~loc @@IntroForthcoming false])) }
+ { TacAtom (CAst.make ~loc @@ TacIntroPattern (false,[CAst.make ~loc @@IntroForthcoming false])) }
| IDENT "eintros"; pl = ne_intropatterns ->
- { TacAtom (Loc.tag ~loc @@ TacIntroPattern (true,pl)) }
+ { TacAtom (CAst.make ~loc @@ TacIntroPattern (true,pl)) }
| IDENT "apply"; cl = LIST1 constr_with_bindings_arg SEP ",";
- inhyp = in_hyp_as -> { TacAtom (Loc.tag ~loc @@ TacApply (true,false,cl,inhyp)) }
+ inhyp = in_hyp_as -> { TacAtom (CAst.make ~loc @@ TacApply (true,false,cl,inhyp)) }
| IDENT "eapply"; cl = LIST1 constr_with_bindings_arg SEP ",";
- inhyp = in_hyp_as -> { TacAtom (Loc.tag ~loc @@ TacApply (true,true,cl,inhyp)) }
+ inhyp = in_hyp_as -> { TacAtom (CAst.make ~loc @@ TacApply (true,true,cl,inhyp)) }
| IDENT "simple"; IDENT "apply";
cl = LIST1 constr_with_bindings_arg SEP ",";
- inhyp = in_hyp_as -> { TacAtom (Loc.tag ~loc @@ TacApply (false,false,cl,inhyp)) }
+ inhyp = in_hyp_as -> { TacAtom (CAst.make ~loc @@ TacApply (false,false,cl,inhyp)) }
| IDENT "simple"; IDENT "eapply";
cl = LIST1 constr_with_bindings_arg SEP",";
- inhyp = in_hyp_as -> { TacAtom (Loc.tag ~loc @@ TacApply (false,true,cl,inhyp)) }
+ inhyp = in_hyp_as -> { TacAtom (CAst.make ~loc @@ TacApply (false,true,cl,inhyp)) }
| IDENT "elim"; cl = constr_with_bindings_arg; el = OPT eliminator ->
- { TacAtom (Loc.tag ~loc @@ TacElim (false,cl,el)) }
+ { TacAtom (CAst.make ~loc @@ TacElim (false,cl,el)) }
| IDENT "eelim"; cl = constr_with_bindings_arg; el = OPT eliminator ->
- { TacAtom (Loc.tag ~loc @@ TacElim (true,cl,el)) }
- | IDENT "case"; icl = induction_clause_list -> { TacAtom (Loc.tag ~loc @@ mkTacCase false icl) }
- | IDENT "ecase"; icl = induction_clause_list -> { TacAtom (Loc.tag ~loc @@ mkTacCase true icl) }
+ { TacAtom (CAst.make ~loc @@ TacElim (true,cl,el)) }
+ | IDENT "case"; icl = induction_clause_list -> { TacAtom (CAst.make ~loc @@ mkTacCase false icl) }
+ | IDENT "ecase"; icl = induction_clause_list -> { TacAtom (CAst.make ~loc @@ mkTacCase true icl) }
| "fix"; id = ident; n = natural; "with"; fd = LIST1 fixdecl ->
- { TacAtom (Loc.tag ~loc @@ TacMutualFix (id,n,List.map mk_fix_tac fd)) }
+ { TacAtom (CAst.make ~loc @@ TacMutualFix (id,n,List.map mk_fix_tac fd)) }
| "cofix"; id = ident; "with"; fd = LIST1 cofixdecl ->
- { TacAtom (Loc.tag ~loc @@ TacMutualCofix (id,List.map mk_cofix_tac fd)) }
+ { TacAtom (CAst.make ~loc @@ TacMutualCofix (id,List.map mk_cofix_tac fd)) }
| IDENT "pose"; bl = bindings_with_parameters ->
- { let (id,b) = bl in TacAtom (Loc.tag ~loc @@ TacLetTac (false,Names.Name.Name id,b,Locusops.nowhere,true,None)) }
+ { let (id,b) = bl in TacAtom (CAst.make ~loc @@ TacLetTac (false,Names.Name.Name id,b,Locusops.nowhere,true,None)) }
| IDENT "pose"; b = constr; na = as_name ->
- { TacAtom (Loc.tag ~loc @@ TacLetTac (false,na,b,Locusops.nowhere,true,None)) }
+ { TacAtom (CAst.make ~loc @@ TacLetTac (false,na,b,Locusops.nowhere,true,None)) }
| IDENT "epose"; bl = bindings_with_parameters ->
- { let (id,b) = bl in TacAtom (Loc.tag ~loc @@ TacLetTac (true,Names.Name id,b,Locusops.nowhere,true,None)) }
+ { let (id,b) = bl in TacAtom (CAst.make ~loc @@ TacLetTac (true,Names.Name id,b,Locusops.nowhere,true,None)) }
| IDENT "epose"; b = constr; na = as_name ->
- { TacAtom (Loc.tag ~loc @@ TacLetTac (true,na,b,Locusops.nowhere,true,None)) }
+ { TacAtom (CAst.make ~loc @@ TacLetTac (true,na,b,Locusops.nowhere,true,None)) }
| IDENT "set"; bl = bindings_with_parameters; p = clause_dft_concl ->
- { let (id,c) = bl in TacAtom (Loc.tag ~loc @@ TacLetTac (false,Names.Name.Name id,c,p,true,None)) }
+ { let (id,c) = bl in TacAtom (CAst.make ~loc @@ TacLetTac (false,Names.Name.Name id,c,p,true,None)) }
| IDENT "set"; c = constr; na = as_name; p = clause_dft_concl ->
- { TacAtom (Loc.tag ~loc @@ TacLetTac (false,na,c,p,true,None)) }
+ { TacAtom (CAst.make ~loc @@ TacLetTac (false,na,c,p,true,None)) }
| IDENT "eset"; bl = bindings_with_parameters; p = clause_dft_concl ->
- { let (id,c) = bl in TacAtom (Loc.tag ~loc @@ TacLetTac (true,Names.Name id,c,p,true,None)) }
+ { let (id,c) = bl in TacAtom (CAst.make ~loc @@ TacLetTac (true,Names.Name id,c,p,true,None)) }
| IDENT "eset"; c = constr; na = as_name; p = clause_dft_concl ->
- { TacAtom (Loc.tag ~loc @@ TacLetTac (true,na,c,p,true,None)) }
+ { TacAtom (CAst.make ~loc @@ TacLetTac (true,na,c,p,true,None)) }
| IDENT "remember"; c = constr; na = as_name; e = eqn_ipat;
p = clause_dft_all ->
- { TacAtom (Loc.tag ~loc @@ TacLetTac (false,na,c,p,false,e)) }
+ { TacAtom (CAst.make ~loc @@ TacLetTac (false,na,c,p,false,e)) }
| IDENT "eremember"; c = constr; na = as_name; e = eqn_ipat;
p = clause_dft_all ->
- { TacAtom (Loc.tag ~loc @@ TacLetTac (true,na,c,p,false,e)) }
+ { TacAtom (CAst.make ~loc @@ TacLetTac (true,na,c,p,false,e)) }
(* Alternative syntax for "pose proof c as id" *)
| IDENT "assert"; test_lpar_id_coloneq; "("; lid = identref; ":=";
c = lconstr; ")" ->
{ let { CAst.loc = loc; v = id } = lid in
- TacAtom (Loc.tag ?loc @@ TacAssert (false,true,None,Some (CAst.make ?loc @@ IntroNaming (IntroIdentifier id)),c)) }
+ TacAtom (CAst.make ?loc @@ TacAssert (false,true,None,Some (CAst.make ?loc @@ IntroNaming (IntroIdentifier id)),c)) }
| IDENT "eassert"; test_lpar_id_coloneq; "("; lid = identref; ":=";
c = lconstr; ")" ->
{ let { CAst.loc = loc; v = id } = lid in
- TacAtom (Loc.tag ?loc @@ TacAssert (true,true,None,Some (CAst.make ?loc @@ IntroNaming (IntroIdentifier id)),c)) }
+ TacAtom (CAst.make ?loc @@ TacAssert (true,true,None,Some (CAst.make ?loc @@ IntroNaming (IntroIdentifier id)),c)) }
(* Alternative syntax for "assert c as id by tac" *)
| IDENT "assert"; test_lpar_id_colon; "("; lid = identref; ":";
c = lconstr; ")"; tac=by_tactic ->
{ let { CAst.loc = loc; v = id } = lid in
- TacAtom (Loc.tag ?loc @@ TacAssert (false,true,Some tac,Some (CAst.make ?loc @@ IntroNaming (IntroIdentifier id)),c)) }
+ TacAtom (CAst.make ?loc @@ TacAssert (false,true,Some tac,Some (CAst.make ?loc @@ IntroNaming (IntroIdentifier id)),c)) }
| IDENT "eassert"; test_lpar_id_colon; "("; lid = identref; ":";
c = lconstr; ")"; tac=by_tactic ->
{ let { CAst.loc = loc; v = id } = lid in
- TacAtom (Loc.tag ?loc @@ TacAssert (true,true,Some tac,Some (CAst.make ?loc @@ IntroNaming (IntroIdentifier id)),c)) }
+ TacAtom (CAst.make ?loc @@ TacAssert (true,true,Some tac,Some (CAst.make ?loc @@ IntroNaming (IntroIdentifier id)),c)) }
(* Alternative syntax for "enough c as id by tac" *)
| IDENT "enough"; test_lpar_id_colon; "("; lid = identref; ":";
c = lconstr; ")"; tac=by_tactic ->
{ let { CAst.loc = loc; v = id } = lid in
- TacAtom (Loc.tag ?loc @@ TacAssert (false,false,Some tac,Some (CAst.make ?loc @@ IntroNaming (IntroIdentifier id)),c)) }
+ TacAtom (CAst.make ?loc @@ TacAssert (false,false,Some tac,Some (CAst.make ?loc @@ IntroNaming (IntroIdentifier id)),c)) }
| IDENT "eenough"; test_lpar_id_colon; "("; lid = identref; ":";
c = lconstr; ")"; tac=by_tactic ->
{ let { CAst.loc = loc; v = id } = lid in
- TacAtom (Loc.tag ?loc @@ TacAssert (true,false,Some tac,Some (CAst.make ?loc @@ IntroNaming (IntroIdentifier id)),c)) }
+ TacAtom (CAst.make ?loc @@ TacAssert (true,false,Some tac,Some (CAst.make ?loc @@ IntroNaming (IntroIdentifier id)),c)) }
| IDENT "assert"; c = constr; ipat = as_ipat; tac = by_tactic ->
- { TacAtom (Loc.tag ~loc @@ TacAssert (false,true,Some tac,ipat,c)) }
+ { TacAtom (CAst.make ~loc @@ TacAssert (false,true,Some tac,ipat,c)) }
| IDENT "eassert"; c = constr; ipat = as_ipat; tac = by_tactic ->
- { TacAtom (Loc.tag ~loc @@ TacAssert (true,true,Some tac,ipat,c)) }
+ { TacAtom (CAst.make ~loc @@ TacAssert (true,true,Some tac,ipat,c)) }
| IDENT "pose"; IDENT "proof"; c = lconstr; ipat = as_ipat ->
- { TacAtom (Loc.tag ~loc @@ TacAssert (false,true,None,ipat,c)) }
+ { TacAtom (CAst.make ~loc @@ TacAssert (false,true,None,ipat,c)) }
| IDENT "epose"; IDENT "proof"; c = lconstr; ipat = as_ipat ->
- { TacAtom (Loc.tag ~loc @@ TacAssert (true,true,None,ipat,c)) }
+ { TacAtom (CAst.make ~loc @@ TacAssert (true,true,None,ipat,c)) }
| IDENT "enough"; c = constr; ipat = as_ipat; tac = by_tactic ->
- { TacAtom (Loc.tag ~loc @@ TacAssert (false,false,Some tac,ipat,c)) }
+ { TacAtom (CAst.make ~loc @@ TacAssert (false,false,Some tac,ipat,c)) }
| IDENT "eenough"; c = constr; ipat = as_ipat; tac = by_tactic ->
- { TacAtom (Loc.tag ~loc @@ TacAssert (true,false,Some tac,ipat,c)) }
+ { TacAtom (CAst.make ~loc @@ TacAssert (true,false,Some tac,ipat,c)) }
| IDENT "generalize"; c = constr ->
- { TacAtom (Loc.tag ~loc @@ TacGeneralize [((AllOccurrences,c),Names.Name.Anonymous)]) }
+ { TacAtom (CAst.make ~loc @@ TacGeneralize [((AllOccurrences,c),Names.Name.Anonymous)]) }
| IDENT "generalize"; c = constr; l = LIST1 constr ->
{ let gen_everywhere c = ((AllOccurrences,c),Names.Name.Anonymous) in
- TacAtom (Loc.tag ~loc @@ TacGeneralize (List.map gen_everywhere (c::l))) }
+ TacAtom (CAst.make ~loc @@ TacGeneralize (List.map gen_everywhere (c::l))) }
| IDENT "generalize"; c = constr; lookup_at_as_comma; nl = occs;
na = as_name;
l = LIST0 [","; c = pattern_occ; na = as_name -> { (c,na) } ] ->
- { TacAtom (Loc.tag ~loc @@ TacGeneralize (((nl,c),na)::l)) }
+ { TacAtom (CAst.make ~loc @@ TacGeneralize (((nl,c),na)::l)) }
(* Derived basic tactics *)
| IDENT "induction"; ic = induction_clause_list ->
- { TacAtom (Loc.tag ~loc @@ TacInductionDestruct (true,false,ic)) }
+ { TacAtom (CAst.make ~loc @@ TacInductionDestruct (true,false,ic)) }
| IDENT "einduction"; ic = induction_clause_list ->
- { TacAtom (Loc.tag ~loc @@ TacInductionDestruct(true,true,ic)) }
+ { TacAtom (CAst.make ~loc @@ TacInductionDestruct(true,true,ic)) }
| IDENT "destruct"; icl = induction_clause_list ->
- { TacAtom (Loc.tag ~loc @@ TacInductionDestruct(false,false,icl)) }
+ { TacAtom (CAst.make ~loc @@ TacInductionDestruct(false,false,icl)) }
| IDENT "edestruct"; icl = induction_clause_list ->
- { TacAtom (Loc.tag ~loc @@ TacInductionDestruct(false,true,icl)) }
+ { TacAtom (CAst.make ~loc @@ TacInductionDestruct(false,true,icl)) }
(* Equality and inversion *)
| IDENT "rewrite"; l = LIST1 oriented_rewriter SEP ",";
- cl = clause_dft_concl; t=by_tactic -> { TacAtom (Loc.tag ~loc @@ TacRewrite (false,l,cl,t)) }
+ cl = clause_dft_concl; t=by_tactic -> { TacAtom (CAst.make ~loc @@ TacRewrite (false,l,cl,t)) }
| IDENT "erewrite"; l = LIST1 oriented_rewriter SEP ",";
- cl = clause_dft_concl; t=by_tactic -> { TacAtom (Loc.tag ~loc @@ TacRewrite (true,l,cl,t)) }
+ cl = clause_dft_concl; t=by_tactic -> { TacAtom (CAst.make ~loc @@ TacRewrite (true,l,cl,t)) }
| IDENT "dependent"; k =
[ IDENT "simple"; IDENT "inversion" -> { SimpleInversion }
| IDENT "inversion" -> { FullInversion }
| IDENT "inversion_clear" -> { FullInversionClear } ];
hyp = quantified_hypothesis;
ids = as_or_and_ipat; co = OPT ["with"; c = constr -> { c } ] ->
- { TacAtom (Loc.tag ~loc @@ TacInversion (DepInversion (k,co,ids),hyp)) }
+ { TacAtom (CAst.make ~loc @@ TacInversion (DepInversion (k,co,ids),hyp)) }
| IDENT "simple"; IDENT "inversion";
hyp = quantified_hypothesis; ids = as_or_and_ipat;
cl = in_hyp_list ->
- { TacAtom (Loc.tag ~loc @@ TacInversion (NonDepInversion (SimpleInversion, cl, ids), hyp)) }
+ { TacAtom (CAst.make ~loc @@ TacInversion (NonDepInversion (SimpleInversion, cl, ids), hyp)) }
| IDENT "inversion";
hyp = quantified_hypothesis; ids = as_or_and_ipat;
cl = in_hyp_list ->
- { TacAtom (Loc.tag ~loc @@ TacInversion (NonDepInversion (FullInversion, cl, ids), hyp)) }
+ { TacAtom (CAst.make ~loc @@ TacInversion (NonDepInversion (FullInversion, cl, ids), hyp)) }
| IDENT "inversion_clear";
hyp = quantified_hypothesis; ids = as_or_and_ipat;
cl = in_hyp_list ->
- { TacAtom (Loc.tag ~loc @@ TacInversion (NonDepInversion (FullInversionClear, cl, ids), hyp)) }
+ { TacAtom (CAst.make ~loc @@ TacInversion (NonDepInversion (FullInversionClear, cl, ids), hyp)) }
| IDENT "inversion"; hyp = quantified_hypothesis;
"using"; c = constr; cl = in_hyp_list ->
- { TacAtom (Loc.tag ~loc @@ TacInversion (InversionUsing (c,cl), hyp)) }
+ { TacAtom (CAst.make ~loc @@ TacInversion (InversionUsing (c,cl), hyp)) }
(* Conversion *)
| IDENT "red"; cl = clause_dft_concl ->
- { TacAtom (Loc.tag ~loc @@ TacReduce (Red false, cl)) }
+ { TacAtom (CAst.make ~loc @@ TacReduce (Red false, cl)) }
| IDENT "hnf"; cl = clause_dft_concl ->
- { TacAtom (Loc.tag ~loc @@ TacReduce (Hnf, cl)) }
+ { TacAtom (CAst.make ~loc @@ TacReduce (Hnf, cl)) }
| IDENT "simpl"; d = delta_flag; po = OPT ref_or_pattern_occ; cl = clause_dft_concl ->
- { TacAtom (Loc.tag ~loc @@ TacReduce (Simpl (all_with d, po), cl)) }
+ { TacAtom (CAst.make ~loc @@ TacReduce (Simpl (all_with d, po), cl)) }
| IDENT "cbv"; s = strategy_flag; cl = clause_dft_concl ->
- { TacAtom (Loc.tag ~loc @@ TacReduce (Cbv s, cl)) }
+ { TacAtom (CAst.make ~loc @@ TacReduce (Cbv s, cl)) }
| IDENT "cbn"; s = strategy_flag; cl = clause_dft_concl ->
- { TacAtom (Loc.tag ~loc @@ TacReduce (Cbn s, cl)) }
+ { TacAtom (CAst.make ~loc @@ TacReduce (Cbn s, cl)) }
| IDENT "lazy"; s = strategy_flag; cl = clause_dft_concl ->
- { TacAtom (Loc.tag ~loc @@ TacReduce (Lazy s, cl)) }
+ { TacAtom (CAst.make ~loc @@ TacReduce (Lazy s, cl)) }
| IDENT "compute"; delta = delta_flag; cl = clause_dft_concl ->
- { TacAtom (Loc.tag ~loc @@ TacReduce (Cbv (all_with delta), cl)) }
+ { TacAtom (CAst.make ~loc @@ TacReduce (Cbv (all_with delta), cl)) }
| IDENT "vm_compute"; po = OPT ref_or_pattern_occ; cl = clause_dft_concl ->
- { TacAtom (Loc.tag ~loc @@ TacReduce (CbvVm po, cl)) }
+ { TacAtom (CAst.make ~loc @@ TacReduce (CbvVm po, cl)) }
| IDENT "native_compute"; po = OPT ref_or_pattern_occ; cl = clause_dft_concl ->
- { TacAtom (Loc.tag ~loc @@ TacReduce (CbvNative po, cl)) }
+ { TacAtom (CAst.make ~loc @@ TacReduce (CbvNative po, cl)) }
| IDENT "unfold"; ul = LIST1 unfold_occ SEP ","; cl = clause_dft_concl ->
- { TacAtom (Loc.tag ~loc @@ TacReduce (Unfold ul, cl)) }
+ { TacAtom (CAst.make ~loc @@ TacReduce (Unfold ul, cl)) }
| IDENT "fold"; l = LIST1 constr; cl = clause_dft_concl ->
- { TacAtom (Loc.tag ~loc @@ TacReduce (Fold l, cl)) }
+ { TacAtom (CAst.make ~loc @@ TacReduce (Fold l, cl)) }
| IDENT "pattern"; pl = LIST1 pattern_occ SEP","; cl = clause_dft_concl ->
- { TacAtom (Loc.tag ~loc @@ TacReduce (Pattern pl, cl)) }
+ { TacAtom (CAst.make ~loc @@ TacReduce (Pattern pl, cl)) }
(* Change ne doit pas s'appliquer dans un Definition t := Eval ... *)
| IDENT "change"; c = conversion; cl = clause_dft_concl ->
{ let (oc, c) = c in
let p,cl = merge_occurrences loc cl oc in
- TacAtom (Loc.tag ~loc @@ TacChange (p,c,cl)) }
+ TacAtom (CAst.make ~loc @@ TacChange (p,c,cl)) }
] ]
;
END
diff --git a/plugins/ltac/plugin_base.dune b/plugins/ltac/plugin_base.dune
index 1b31655310..5611f5ba16 100644
--- a/plugins/ltac/plugin_base.dune
+++ b/plugins/ltac/plugin_base.dune
@@ -3,7 +3,6 @@
(public_name coq.plugins.ltac)
(synopsis "Coq's LTAC tactic language")
(modules :standard \ tauto)
- (flags :standard -open Gramlib)
(libraries coq.stm))
(library
diff --git a/plugins/ltac/pptactic.ml b/plugins/ltac/pptactic.ml
index b219ee25ca..50cfb6d004 100644
--- a/plugins/ltac/pptactic.ml
+++ b/plugins/ltac/pptactic.ml
@@ -294,7 +294,7 @@ let string_of_genarg_arg (ArgumentType arg) =
let pr _ = str "_" in
KerName.print key ++ spc() ++ pr_sequence pr l ++ str" (* Generic printer *)"
- let pr_farg prtac arg = prtac (1, Any) (TacArg (Loc.tag arg))
+ let pr_farg prtac arg = prtac (1, Any) (TacArg (CAst.make arg))
let is_genarg tag wit =
let ArgT.Any tag = tag in
@@ -350,9 +350,9 @@ let string_of_genarg_arg (ArgumentType arg) =
pr_extend_gen (pr_farg prtac)
let pr_raw_alias prtac lev key args =
- pr_alias_gen (pr_targ (fun l a -> prtac l (TacArg (Loc.tag a)))) lev key args
+ pr_alias_gen (pr_targ (fun l a -> prtac l (TacArg (CAst.make a)))) lev key args
let pr_glob_alias prtac lev key args =
- pr_alias_gen (pr_targ (fun l a -> prtac l (TacArg (Loc.tag a)))) lev key args
+ pr_alias_gen (pr_targ (fun l a -> prtac l (TacArg (CAst.make a)))) lev key args
(**********************************************************************)
(* The tactic printer *)
@@ -579,7 +579,7 @@ let pr_goal_selector ~toplevel s =
pr_gen arg
else
str name ++ str ":" ++ surround (pr_gen arg)
- | _ -> pr_arg (TacArg (Loc.tag t)) in
+ | _ -> pr_arg (TacArg (CAst.make t)) in
hov 0 (keyword k ++ spc () ++ pr_lname na ++ prlist pr_funvar bl ++
str " :=" ++ brk (1,1) ++ pr t)
@@ -1045,30 +1045,30 @@ let pr_goal_selector ~toplevel s =
| TacSelect (s, tac) -> pr_goal_selector ~toplevel:false s ++ spc () ++ pr_tac ltop tac, latom
| TacId l ->
keyword "idtac" ++ prlist (pr_arg (pr_message_token pr.pr_name)) l, latom
- | TacAtom (loc,t) ->
+ | TacAtom { CAst.loc; v=t } ->
pr_with_comments ?loc (hov 1 (pr_atom pr strip_prod_binders tag_atom t)), ltatom
- | TacArg(_,Tacexp e) ->
+ | TacArg { CAst.v=Tacexp e } ->
pr_tac inherited e, latom
- | TacArg(_,ConstrMayEval (ConstrTerm c)) ->
+ | TacArg { CAst.v=ConstrMayEval (ConstrTerm c) } ->
keyword "constr:" ++ pr.pr_constr c, latom
- | TacArg(_,ConstrMayEval c) ->
+ | TacArg { CAst.v=ConstrMayEval c } ->
pr_may_eval pr.pr_constr pr.pr_lconstr pr.pr_constant pr.pr_pattern c, leval
- | TacArg(_,TacFreshId l) ->
+ | TacArg { CAst.v=TacFreshId l } ->
primitive "fresh" ++ pr_fresh_ids l, latom
- | TacArg(_,TacGeneric arg) ->
+ | TacArg { CAst.v=TacGeneric arg } ->
pr.pr_generic arg, latom
- | TacArg(_,TacCall(_,(f,[]))) ->
+ | TacArg { CAst.v=TacCall {CAst.v=(f,[])} } ->
pr.pr_reference f, latom
- | TacArg(_,TacCall(loc,(f,l))) ->
+ | TacArg { CAst.v=TacCall {CAst.loc; v=(f,l)} } ->
pr_with_comments ?loc (hov 1 (
pr.pr_reference f ++ spc ()
++ prlist_with_sep spc pr_tacarg l)),
lcall
- | TacArg (_,a) ->
+ | TacArg { CAst.v=a } ->
pr_tacarg a, latom
- | TacML (loc,(s,l)) ->
+ | TacML { CAst.loc; v=(s,l) } ->
pr_with_comments ?loc (pr.pr_extend 1 s l), lcall
- | TacAlias (loc,(kn,l)) ->
+ | TacAlias { CAst.loc; v=(kn,l) } ->
pr_with_comments ?loc (pr.pr_alias (level_of inherited) kn l), latom
)
in
@@ -1087,7 +1087,7 @@ let pr_goal_selector ~toplevel s =
| TacNumgoals ->
keyword "numgoals"
| (TacCall _|Tacexp _ | TacGeneric _) as a ->
- hov 0 (keyword "ltac:" ++ surround (pr_tac ltop (TacArg (Loc.tag a))))
+ hov 0 (keyword "ltac:" ++ surround (pr_tac ltop (TacArg (CAst.make a))))
in pr_tac
diff --git a/plugins/ltac/profile_ltac.ml b/plugins/ltac/profile_ltac.ml
index db7dcfa6ef..3eb049dbab 100644
--- a/plugins/ltac/profile_ltac.ml
+++ b/plugins/ltac/profile_ltac.ml
@@ -251,7 +251,7 @@ let string_of_call ck =
| Tacexpr.LtacVarCall (id, t) -> Names.Id.print id
| Tacexpr.LtacAtomCall te ->
(Pptactic.pr_glob_tactic (Global.env ())
- (Tacexpr.TacAtom (Loc.tag te)))
+ (Tacexpr.TacAtom (CAst.make te)))
| Tacexpr.LtacConstrInterp (c, _) ->
pr_glob_constr_env (Global.env ()) c
| Tacexpr.LtacMLCall te ->
diff --git a/plugins/ltac/rewrite.ml b/plugins/ltac/rewrite.ml
index 7d917c58fe..fee469032c 100644
--- a/plugins/ltac/rewrite.ml
+++ b/plugins/ltac/rewrite.ml
@@ -528,7 +528,7 @@ let decompose_applied_relation env sigma (c,l) =
let rewrite_db = "rewrite"
-let conv_transparent_state = (Id.Pred.empty, Cpred.full)
+let conv_transparent_state = TransparentState.cst_full
let rewrite_transparent_state () =
Hints.Hint_db.transparent_state (Hints.searchtable_map rewrite_db)
@@ -537,8 +537,8 @@ let rewrite_core_unif_flags = {
Unification.modulo_conv_on_closed_terms = None;
Unification.use_metas_eagerly_in_conv_on_closed_terms = true;
Unification.use_evars_eagerly_in_conv_on_closed_terms = true;
- Unification.modulo_delta = empty_transparent_state;
- Unification.modulo_delta_types = full_transparent_state;
+ Unification.modulo_delta = TransparentState.empty;
+ Unification.modulo_delta_types = TransparentState.full;
Unification.check_applied_meta_types = true;
Unification.use_pattern_unification = true;
Unification.use_meta_bound_pattern_unification = true;
@@ -585,12 +585,12 @@ let general_rewrite_unif_flags () =
Unification.modulo_conv_on_closed_terms = Some ts;
Unification.use_evars_eagerly_in_conv_on_closed_terms = true;
Unification.modulo_delta = ts;
- Unification.modulo_delta_types = full_transparent_state;
+ Unification.modulo_delta_types = TransparentState.full;
Unification.modulo_betaiota = true }
in {
Unification.core_unify_flags = core_flags;
Unification.merge_unify_flags = core_flags;
- Unification.subterm_unify_flags = { core_flags with Unification.modulo_delta = empty_transparent_state };
+ Unification.subterm_unify_flags = { core_flags with Unification.modulo_delta = TransparentState.empty };
Unification.allow_K_in_toplevel_higher_order_unification = true;
Unification.resolve_evars = true
}
@@ -1958,7 +1958,7 @@ let add_setoid atts binders a aeq t n =
let make_tactic name =
let open Tacexpr in
let tacqid = Libnames.qualid_of_string name in
- TacArg (Loc.tag @@ (TacCall (Loc.tag (tacqid, []))))
+ TacArg (CAst.make @@ (TacCall (CAst.make (tacqid, []))))
let warn_add_morphism_deprecated =
CWarnings.create ~name:"add-morphism" ~category:"deprecated" (fun () ->
diff --git a/plugins/ltac/tacentries.ml b/plugins/ltac/tacentries.ml
index 1b212334ce..ac2d88dec2 100644
--- a/plugins/ltac/tacentries.ml
+++ b/plugins/ltac/tacentries.ml
@@ -177,7 +177,7 @@ let add_tactic_entry (kn, ml, tg) state =
TacGeneric arg
in
let l = List.map map l in
- (TacAlias (Loc.tag ~loc (kn,l)):raw_tactic_expr)
+ (TacAlias (CAst.make ~loc (kn,l)):raw_tactic_expr)
in
let () =
if Int.equal tg.tacgram_level 0 && not (head_is_ident tg) then
@@ -349,7 +349,7 @@ let extend_atomic_tactic name entries =
| TacNonTerm (_, (symb, _)) ->
let EntryName (typ, e) = prod_item_of_symbol 0 symb in
let Genarg.Rawwit wit = typ in
- let inj x = TacArg (Loc.tag @@ TacGeneric (Genarg.in_gen typ x)) in
+ let inj x = TacArg (CAst.make @@ TacGeneric (Genarg.in_gen typ x)) in
let default = epsilon_value inj e in
match default with
| None -> raise NonEmptyArgument
@@ -363,7 +363,7 @@ let extend_atomic_tactic name entries =
| Some (id, args) ->
let args = List.map (fun a -> Tacexp a) args in
let entry = { mltac_name = name; mltac_index = i } in
- let body = TacML (Loc.tag (entry, args)) in
+ let body = TacML (CAst.make (entry, args)) in
Tacenv.register_ltac false false (Names.Id.of_string id) body
in
List.iteri add_atomic entries
@@ -379,7 +379,7 @@ let add_ml_tactic_notation name ~level ?deprecation prods =
let ids = List.map_filter get_id prods in
let entry = { mltac_name = name; mltac_index = len - i - 1 } in
let map id = Reference (Locus.ArgVar (CAst.make id)) in
- let tac = TacML (Loc.tag (entry, List.map map ids)) in
+ let tac = TacML (CAst.make (entry, List.map map ids)) in
add_glob_tactic_notation false ~level ?deprecation prods true ids tac
in
List.iteri iter (List.rev prods);
@@ -664,7 +664,7 @@ let tactic_extend plugin_name tacname ~level ?deprecation sign =
(** Arguments are not passed directly to the ML tactic in the TacML node,
the ML tactic retrieves its arguments in the [ist] environment instead.
This is the rôle of the [lift_constr_tac_to_ml_tac] function. *)
- let body = Tacexpr.TacFun (vars, Tacexpr.TacML (Loc.tag (ml, [])))in
+ let body = Tacexpr.TacFun (vars, Tacexpr.TacML (CAst.make (ml, [])))in
let id = Names.Id.of_string name in
let obj () = Tacenv.register_ltac true false id body ?deprecation in
let () = Tacenv.register_ml_tactic ml_tactic_name [|tac|] in
@@ -697,7 +697,7 @@ type ('b, 'c) argument_interp =
| ArgInterpFun : ('b, Val.t) interp_fun -> ('b, 'c) argument_interp
| ArgInterpWit : ('a, 'b, 'r) Genarg.genarg_type -> ('b, 'c) argument_interp
| ArgInterpLegacy :
- (Geninterp.interp_sign -> Proof_type.goal Evd.sigma -> 'b -> Evd.evar_map * 'c) -> ('b, 'c) argument_interp
+ (Geninterp.interp_sign -> Goal.goal Evd.sigma -> 'b -> Evd.evar_map * 'c) -> ('b, 'c) argument_interp
type ('a, 'b, 'c) tactic_argument = {
arg_parsing : 'a Vernacextend.argument_rule;
diff --git a/plugins/ltac/tacentries.mli b/plugins/ltac/tacentries.mli
index 79f9e093fb..309db539d0 100644
--- a/plugins/ltac/tacentries.mli
+++ b/plugins/ltac/tacentries.mli
@@ -125,7 +125,7 @@ type ('b, 'c) argument_interp =
| ArgInterpFun : ('b, Geninterp.Val.t) Geninterp.interp_fun -> ('b, 'c) argument_interp
| ArgInterpWit : ('a, 'b, 'r) Genarg.genarg_type -> ('b, 'c) argument_interp
| ArgInterpLegacy :
- (Geninterp.interp_sign -> Proof_type.goal Evd.sigma -> 'b -> Evd.evar_map * 'c) -> ('b, 'c) argument_interp
+ (Geninterp.interp_sign -> Goal.goal Evd.sigma -> 'b -> Evd.evar_map * 'c) -> ('b, 'c) argument_interp
type ('a, 'b, 'c) tactic_argument = {
arg_parsing : 'a Vernacextend.argument_rule;
diff --git a/plugins/ltac/tacexpr.ml b/plugins/ltac/tacexpr.ml
index 8731cbf60d..9435d0b911 100644
--- a/plugins/ltac/tacexpr.ml
+++ b/plugins/ltac/tacexpr.ml
@@ -167,7 +167,7 @@ type 'a gen_tactic_arg =
| TacGeneric of 'lev generic_argument
| ConstrMayEval of ('trm,'cst,'pat) may_eval
| Reference of 'ref
- | TacCall of ('ref * 'a gen_tactic_arg list) Loc.located
+ | TacCall of ('ref * 'a gen_tactic_arg list) CAst.t
| TacFreshId of string or_var list
| Tacexp of 'tacexpr
| TacPretype of 'trm
@@ -189,7 +189,7 @@ constraint 'a = <
'r : ltac refs, 'n : idents, 'l : levels *)
and 'a gen_tactic_expr =
- | TacAtom of ('a gen_atomic_tactic_expr) Loc.located
+ | TacAtom of ('a gen_atomic_tactic_expr) CAst.t
| TacThen of
'a gen_tactic_expr *
'a gen_tactic_expr
@@ -245,12 +245,12 @@ and 'a gen_tactic_expr =
| TacMatchGoal of lazy_flag * direction_flag *
('p,'a gen_tactic_expr) match_rule list
| TacFun of 'a gen_tactic_fun_ast
- | TacArg of 'a gen_tactic_arg located
+ | TacArg of 'a gen_tactic_arg CAst.t
| TacSelect of Goal_select.t * 'a gen_tactic_expr
(* For ML extensions *)
- | TacML of (ml_tactic_entry * 'a gen_tactic_arg list) Loc.located
+ | TacML of (ml_tactic_entry * 'a gen_tactic_arg list) CAst.t
(* For syntax extensions *)
- | TacAlias of (KerName.t * 'a gen_tactic_arg list) Loc.located
+ | TacAlias of (KerName.t * 'a gen_tactic_arg list) CAst.t
constraint 'a = <
term:'t;
diff --git a/plugins/ltac/tacexpr.mli b/plugins/ltac/tacexpr.mli
index 9958d6dcda..1527724420 100644
--- a/plugins/ltac/tacexpr.mli
+++ b/plugins/ltac/tacexpr.mli
@@ -167,7 +167,7 @@ type 'a gen_tactic_arg =
| TacGeneric of 'lev generic_argument
| ConstrMayEval of ('trm,'cst,'pat) may_eval
| Reference of 'ref
- | TacCall of ('ref * 'a gen_tactic_arg list) Loc.located
+ | TacCall of ('ref * 'a gen_tactic_arg list) CAst.t
| TacFreshId of string or_var list
| Tacexp of 'tacexpr
| TacPretype of 'trm
@@ -189,7 +189,7 @@ constraint 'a = <
'r : ltac refs, 'n : idents, 'l : levels *)
and 'a gen_tactic_expr =
- | TacAtom of ('a gen_atomic_tactic_expr) Loc.located
+ | TacAtom of ('a gen_atomic_tactic_expr) CAst.t
| TacThen of
'a gen_tactic_expr *
'a gen_tactic_expr
@@ -245,12 +245,12 @@ and 'a gen_tactic_expr =
| TacMatchGoal of lazy_flag * direction_flag *
('p,'a gen_tactic_expr) match_rule list
| TacFun of 'a gen_tactic_fun_ast
- | TacArg of 'a gen_tactic_arg located
+ | TacArg of 'a gen_tactic_arg CAst.t
| TacSelect of Goal_select.t * 'a gen_tactic_expr
(* For ML extensions *)
- | TacML of (ml_tactic_entry * 'a gen_tactic_arg list) Loc.located
+ | TacML of (ml_tactic_entry * 'a gen_tactic_arg list) CAst.t
(* For syntax extensions *)
- | TacAlias of (KerName.t * 'a gen_tactic_arg list) Loc.located
+ | TacAlias of (KerName.t * 'a gen_tactic_arg list) CAst.t
constraint 'a = <
term:'t;
diff --git a/plugins/ltac/tacintern.ml b/plugins/ltac/tacintern.ml
index ebec3c887c..85c6348b52 100644
--- a/plugins/ltac/tacintern.ml
+++ b/plugins/ltac/tacintern.ml
@@ -137,7 +137,7 @@ let intern_isolated_global_tactic_reference qid =
let kn = Tacenv.locate_tactic qid in
Option.iter (fun depr -> warn_deprecated_tactic ?loc (qid,depr)) @@
Tacenv.tac_deprecation kn;
- TacCall (Loc.tag ?loc (ArgArg (loc,kn),[]))
+ TacCall (CAst.make ?loc (ArgArg (loc,kn),[]))
let intern_isolated_tactic_reference strict ist qid =
(* An ltac reference *)
@@ -587,10 +587,10 @@ let rec intern_atomic lf ist x =
and intern_tactic onlytac ist tac = snd (intern_tactic_seq onlytac ist tac)
and intern_tactic_seq onlytac ist = function
- | TacAtom (loc,t) ->
+ | TacAtom { loc; v=t } ->
let lf = ref ist.ltacvars in
let t = intern_atomic lf ist t in
- !lf, TacAtom (Loc.tag ?loc:(adjust_loc loc) t)
+ !lf, TacAtom (CAst.make ?loc:(adjust_loc loc) t)
| TacFun tacfun -> ist.ltacvars, TacFun (intern_tactic_fun ist tacfun)
| TacLetIn (isrec,l,u) ->
let ltacvars = Id.Set.union (extract_let_names l) ist.ltacvars in
@@ -659,27 +659,27 @@ and intern_tactic_seq onlytac ist = function
| TacFirst l -> ist.ltacvars, TacFirst (List.map (intern_pure_tactic ist) l)
| TacSolve l -> ist.ltacvars, TacSolve (List.map (intern_pure_tactic ist) l)
| TacComplete tac -> ist.ltacvars, TacComplete (intern_pure_tactic ist tac)
- | TacArg (loc,a) -> ist.ltacvars, intern_tactic_as_arg loc onlytac ist a
+ | TacArg { loc; v=a } -> ist.ltacvars, intern_tactic_as_arg loc onlytac ist a
| TacSelect (sel, tac) ->
ist.ltacvars, TacSelect (sel, intern_pure_tactic ist tac)
(* For extensions *)
- | TacAlias (loc,(s,l)) ->
+ | TacAlias { loc; v=(s,l) } ->
let alias = Tacenv.interp_alias s in
Option.iter (fun o -> warn_deprecated_alias ?loc (s,o)) @@ alias.Tacenv.alias_deprecation;
let l = List.map (intern_tacarg !strict_check false ist) l in
- ist.ltacvars, TacAlias (Loc.tag ?loc (s,l))
- | TacML (loc,(opn,l)) ->
+ ist.ltacvars, TacAlias (CAst.make ?loc (s,l))
+ | TacML { loc; v=(opn,l) } ->
let _ignore = Tacenv.interp_ml_tactic opn in
- ist.ltacvars, TacML (loc, (opn,List.map (intern_tacarg !strict_check false ist) l))
+ ist.ltacvars, TacML CAst.(make ?loc (opn,List.map (intern_tacarg !strict_check false ist) l))
and intern_tactic_as_arg loc onlytac ist a =
match intern_tacarg !strict_check onlytac ist a with
| TacCall _ | Reference _
- | TacGeneric _ as a -> TacArg (loc,a)
+ | TacGeneric _ as a -> TacArg CAst.(make ?loc a)
| Tacexp a -> a
| ConstrMayEval _ | TacFreshId _ | TacPretype _ | TacNumgoals as a ->
- if onlytac then error_tactic_expected ?loc else TacArg (loc,a)
+ if onlytac then error_tactic_expected ?loc else TacArg CAst.(make ?loc a)
and intern_tactic_or_tacarg ist = intern_tactic false ist
@@ -692,9 +692,9 @@ and intern_tactic_fun ist (var,body) =
and intern_tacarg strict onlytac ist = function
| Reference r -> intern_non_tactic_reference strict ist r
| ConstrMayEval c -> ConstrMayEval (intern_constr_may_eval ist c)
- | TacCall (loc,(f,[])) -> intern_isolated_tactic_reference strict ist f
- | TacCall (loc,(f,l)) ->
- TacCall (Loc.tag ?loc (
+ | TacCall { loc; v=(f,[]) } -> intern_isolated_tactic_reference strict ist f
+ | TacCall { loc; v=(f,l) } ->
+ TacCall (CAst.make ?loc (
intern_applied_tactic_reference ist f,
List.map (intern_tacarg !strict_check false ist) l))
| TacFreshId x -> TacFreshId (List.map (intern_string_or_var ist) x)
diff --git a/plugins/ltac/tacinterp.ml b/plugins/ltac/tacinterp.ml
index 2a046a3e65..cb3a0aaed9 100644
--- a/plugins/ltac/tacinterp.ml
+++ b/plugins/ltac/tacinterp.ml
@@ -543,7 +543,6 @@ let interp_gen kind ist pattern_mode flags env sigma c =
let constr_flags () = {
use_typeclasses = true;
solve_unification_constraints = true;
- use_hook = Pfedit.solve_by_implicit_tactic ();
fail_evar = true;
expand_evars = true }
@@ -558,21 +557,18 @@ let interp_type = interp_constr_gen IsType
let open_constr_use_classes_flags () = {
use_typeclasses = true;
solve_unification_constraints = true;
- use_hook = Pfedit.solve_by_implicit_tactic ();
fail_evar = false;
expand_evars = true }
let open_constr_no_classes_flags () = {
use_typeclasses = false;
solve_unification_constraints = true;
- use_hook = Pfedit.solve_by_implicit_tactic ();
fail_evar = false;
expand_evars = true }
let pure_open_constr_flags = {
use_typeclasses = false;
solve_unification_constraints = true;
- use_hook = None;
fail_evar = false;
expand_evars = false }
@@ -987,7 +983,7 @@ let rec read_match_rule lfun ist env sigma = function
| [] -> []
(* Fully evaluate an untyped constr *)
-let type_uconstr ?(flags = {(constr_flags ()) with use_hook = None })
+let type_uconstr ?(flags = (constr_flags ()))
?(expected_type = WithoutTypeConstraint) ist c =
begin fun env sigma ->
let { closure; term } = c in
@@ -1022,7 +1018,7 @@ let rec val_interp ist ?(appl=UnnamedAppl) (tac:glob_tactic_expr) : Val.t Ftacti
| TacLetIn (false,l,u) -> interp_letin ist l u
| TacMatchGoal (lz,lr,lmr) -> interp_match_goal ist lz lr lmr
| TacMatch (lz,c,lmr) -> interp_match ist lz c lmr
- | TacArg (loc,a) -> interp_tacarg ist a
+ | TacArg {loc;v} -> interp_tacarg ist v
| t ->
(** Delayed evaluation *)
Ftactic.return (of_tacvalue (VFun (UnnamedAppl,extract_trace ist, ist.lfun, [], t)))
@@ -1040,7 +1036,7 @@ let rec val_interp ist ?(appl=UnnamedAppl) (tac:glob_tactic_expr) : Val.t Ftacti
and eval_tactic ist tac : unit Proofview.tactic = match tac with
- | TacAtom (loc,t) ->
+ | TacAtom {loc;v=t} ->
let call = LtacAtomCall t in
push_trace(loc,call) ist >>= fun trace ->
Profile_ltac.do_profile "eval_tactic:2" trace
@@ -1120,7 +1116,7 @@ and eval_tactic ist tac : unit Proofview.tactic = match tac with
eval_tactic ist tac
| TacSelect (sel, tac) -> Tacticals.New.tclSELECT sel (interp_tactic ist tac)
(* For extensions *)
- | TacAlias (loc,(s,l)) ->
+ | TacAlias {loc; v=(s,l)} ->
let alias = Tacenv.interp_alias s in
let (>>=) = Ftactic.bind in
let interp_vars = Ftactic.List.map (fun v -> interp_tacarg ist v) l in
@@ -1151,7 +1147,7 @@ and eval_tactic ist tac : unit Proofview.tactic = match tac with
in
Ftactic.run tac (fun () -> Proofview.tclUNIT ())
- | TacML (loc,(opn,l)) ->
+ | TacML {loc; v=(opn,l)} ->
push_trace (Loc.tag ?loc @@ LtacMLCall tac) ist >>= fun trace ->
let ist = { ist with extra = TacStore.set ist.extra f_trace trace; } in
let tac = Tacenv.interp_ml_tactic opn in
@@ -1205,9 +1201,9 @@ and interp_tacarg ist arg : Val.t Ftactic.t =
Proofview.tclTHEN (Proofview.Unsafe.tclEVARS sigma)
(Ftactic.return (Value.of_constr c_interp))
end
- | TacCall (loc,(r,[])) ->
+ | TacCall { v=(r,[]) } ->
interp_ltac_reference true ist r
- | TacCall (loc,(f,l)) ->
+ | TacCall { loc; v=(f,l) } ->
let (>>=) = Ftactic.bind in
interp_ltac_reference true ist f >>= fun fv ->
Ftactic.List.map (fun a -> interp_tacarg ist a) l >>= fun largs ->
@@ -1341,7 +1337,7 @@ and interp_letrec ist llc u =
Proofview.tclUNIT () >>= fun () -> (* delay for the effects of [lref], just in case. *)
let lref = ref ist.lfun in
let fold accu ({v=na}, b) =
- let v = of_tacvalue (VRec (lref, TacArg (Loc.tag b))) in
+ let v = of_tacvalue (VRec (lref, TacArg (CAst.make b))) in
Name.fold_right (fun id -> Id.Map.add id v) na accu
in
let lfun = List.fold_left fold ist.lfun llc in
@@ -1879,7 +1875,7 @@ module Value = struct
let (_, args, lfun) = List.fold_right fold args (0, [], Id.Map.empty) in
let lfun = Id.Map.add (Id.of_string "F") f lfun in
let ist = { (default_ist ()) with lfun = lfun; } in
- let tac = TacArg(Loc.tag @@ TacCall (Loc.tag (ArgVar CAst.(make @@ Id.of_string "F"),args))) in
+ let tac = TacArg(CAst.make @@ TacCall (CAst.make (ArgVar CAst.(make @@ Id.of_string "F"),args))) in
eval_tactic_ist ist tac
end
diff --git a/plugins/ltac/tacsubst.ml b/plugins/ltac/tacsubst.ml
index 9173e23b89..caaa547a07 100644
--- a/plugins/ltac/tacsubst.ml
+++ b/plugins/ltac/tacsubst.ml
@@ -173,7 +173,7 @@ let rec subst_atomic subst (t:glob_atomic_tactic_expr) = match t with
TacInversion (InversionUsing (subst_glob_constr subst c,cl),hyp)
and subst_tactic subst (t:glob_tactic_expr) = match t with
- | TacAtom (_loc,t) -> TacAtom (Loc.tag @@ subst_atomic subst t)
+ | TacAtom { CAst.v=t } -> TacAtom (CAst.make @@ subst_atomic subst t)
| TacFun tacfun -> TacFun (subst_tactic_fun subst tacfun)
| TacLetIn (r,l,u) ->
let l = List.map (fun (n,b) -> (n,subst_tacarg subst b)) l in
@@ -220,22 +220,22 @@ and subst_tactic subst (t:glob_tactic_expr) = match t with
| TacFirst l -> TacFirst (List.map (subst_tactic subst) l)
| TacSolve l -> TacSolve (List.map (subst_tactic subst) l)
| TacComplete tac -> TacComplete (subst_tactic subst tac)
- | TacArg (_,a) -> TacArg (Loc.tag @@ subst_tacarg subst a)
+ | TacArg { CAst.v=a } -> TacArg (CAst.make @@ subst_tacarg subst a)
| TacSelect (s, tac) -> TacSelect (s, subst_tactic subst tac)
(* For extensions *)
- | TacAlias (_,(s,l)) ->
+ | TacAlias { CAst.v=(s,l) } ->
let s = subst_kn subst s in
- TacAlias (Loc.tag (s,List.map (subst_tacarg subst) l))
- | TacML (loc,(opn,l)) -> TacML (loc, (opn,List.map (subst_tacarg subst) l))
+ TacAlias (CAst.make (s,List.map (subst_tacarg subst) l))
+ | TacML { CAst.loc; v=(opn,l)} -> TacML CAst.(make ?loc (opn,List.map (subst_tacarg subst) l))
and subst_tactic_fun subst (var,body) = (var,subst_tactic subst body)
and subst_tacarg subst = function
| Reference r -> Reference (subst_reference subst r)
| ConstrMayEval c -> ConstrMayEval (subst_raw_may_eval subst c)
- | TacCall (loc,(f,l)) ->
- TacCall (Loc.tag ?loc (subst_reference subst f, List.map (subst_tacarg subst) l))
+ | TacCall { CAst.loc; v=(f,l) } ->
+ TacCall CAst.(make ?loc (subst_reference subst f, List.map (subst_tacarg subst) l))
| TacFreshId _ as x -> x
| TacPretype c -> TacPretype (subst_glob_constr subst c)
| TacNumgoals -> TacNumgoals
diff --git a/plugins/ltac/tactic_debug.ml b/plugins/ltac/tactic_debug.ml
index 6bab8d0353..877d4ee758 100644
--- a/plugins/ltac/tactic_debug.ml
+++ b/plugins/ltac/tactic_debug.ml
@@ -365,7 +365,7 @@ let explain_ltac_call_trace last trace loc =
Pptactic.pr_glob_tactic (Global.env()) t ++ str ")"
| Tacexpr.LtacAtomCall te ->
quote (Pptactic.pr_glob_tactic (Global.env())
- (Tacexpr.TacAtom (Loc.tag te)))
+ (Tacexpr.TacAtom (CAst.make te)))
| Tacexpr.LtacConstrInterp (c, { Ltac_pretype.ltac_constrs = vars }) ->
quote (Printer.pr_glob_constr_env (Global.env()) c) ++
(if not (Id.Map.is_empty vars) then
diff --git a/plugins/ltac/tauto.ml b/plugins/ltac/tauto.ml
index 299bc7ea4d..561bfc5d7c 100644
--- a/plugins/ltac/tauto.ml
+++ b/plugins/ltac/tauto.ml
@@ -191,7 +191,7 @@ let make_unfold name =
let u_not = make_unfold "not"
let reduction_not_iff _ ist =
- let make_reduce c = TacAtom (Loc.tag @@ TacReduce (Genredexpr.Unfold c, Locusops.allHypsAndConcl)) in
+ let make_reduce c = TacAtom (CAst.make @@ TacReduce (Genredexpr.Unfold c, Locusops.allHypsAndConcl)) in
let tac = match !negation_unfolding with
| true -> make_reduce [u_not]
| false -> TacId []
@@ -244,7 +244,7 @@ let with_flags flags _ ist =
let x = CAst.make @@ Id.of_string "x" in
let arg = Val.Dyn (tag_tauto_flags, flags) in
let ist = { ist with lfun = Id.Map.add x.CAst.v arg ist.lfun } in
- eval_tactic_ist ist (TacArg (Loc.tag @@ TacCall (Loc.tag (Locus.ArgVar f, [Reference (Locus.ArgVar x)]))))
+ eval_tactic_ist ist (TacArg (CAst.make @@ TacCall (CAst.make (Locus.ArgVar f, [Reference (Locus.ArgVar x)]))))
let register_tauto_tactic tac name0 args =
let ids = List.map (fun id -> Id.of_string id) args in
@@ -252,7 +252,7 @@ let register_tauto_tactic tac name0 args =
let name = { mltac_plugin = tauto_plugin; mltac_tactic = name0; } in
let entry = { mltac_name = name; mltac_index = 0 } in
let () = Tacenv.register_ml_tactic name [| tac |] in
- let tac = TacFun (ids, TacML (Loc.tag (entry, []))) in
+ let tac = TacFun (ids, TacML (CAst.make (entry, []))) in
let obj () = Tacenv.register_ltac true true (Id.of_string name0) tac in
Mltop.declare_cache_obj obj tauto_plugin
diff --git a/plugins/setoid_ring/g_newring.mlg b/plugins/setoid_ring/g_newring.mlg
index 3ddea7eb30..f59ca4cef4 100644
--- a/plugins/setoid_ring/g_newring.mlg
+++ b/plugins/setoid_ring/g_newring.mlg
@@ -86,7 +86,7 @@ END
VERNAC COMMAND EXTEND AddSetoidRing CLASSIFIED AS SIDEFF
| [ "Add" "Ring" ident(id) ":" constr(t) ring_mods_opt(l) ] ->
{ let l = match l with None -> [] | Some l -> l in add_theory id t l }
- | [ "Print" "Rings" ] => {Vernac_classifier.classify_as_query} -> {
+ | [ "Print" "Rings" ] => { Vernacextend.classify_as_query } -> {
Feedback.msg_notice (strbrk "The following ring structures have been declared:");
Spmap.iter (fun fn fi ->
let sigma, env = Pfedit.get_current_context () in
@@ -130,7 +130,7 @@ END
VERNAC COMMAND EXTEND AddSetoidField CLASSIFIED AS SIDEFF
| [ "Add" "Field" ident(id) ":" constr(t) field_mods_opt(l) ] ->
{ let l = match l with None -> [] | Some l -> l in add_field_theory id t l }
-| [ "Print" "Fields" ] => {Vernac_classifier.classify_as_query} -> {
+| [ "Print" "Fields" ] => {Vernacextend.classify_as_query} -> {
Feedback.msg_notice (strbrk "The following field structures have been declared:");
Spmap.iter (fun fn fi ->
let sigma, env = Pfedit.get_current_context () in
diff --git a/plugins/setoid_ring/newring.ml b/plugins/setoid_ring/newring.ml
index a2dce621d9..4109e9cf38 100644
--- a/plugins/setoid_ring/newring.ml
+++ b/plugins/setoid_ring/newring.ml
@@ -129,7 +129,7 @@ let closed_term_ast =
fun l ->
let l = List.map (fun gr -> ArgArg(Loc.tag gr)) l in
TacFun([Name(Id.of_string"t")],
- TacML(Loc.tag (tacname,
+ TacML(CAst.make (tacname,
[TacGeneric (Genarg.in_gen (Genarg.glbwit Stdarg.wit_constr) (DAst.make @@ GVar(Id.of_string"t"),None));
TacGeneric (Genarg.in_gen (Genarg.glbwit (Genarg.wit_list Stdarg.wit_ref)) l)])))
(*
@@ -160,7 +160,7 @@ let decl_constant na univs c =
(* Calling a global tactic *)
let ltac_call tac (args:glob_tactic_arg list) =
- TacArg(Loc.tag @@ TacCall (Loc.tag (ArgArg(Loc.tag @@ Lazy.force tac),args)))
+ TacArg(CAst.make @@ TacCall (CAst.make (ArgArg(Loc.tag @@ Lazy.force tac),args)))
let dummy_goal env sigma =
let (gl,_,sigma) =
@@ -197,7 +197,7 @@ let exec_tactic env evd n f args =
(** Build the getter *)
let lid = List.init n (fun i -> Id.of_string("x"^string_of_int i)) in
let n = Genarg.in_gen (Genarg.glbwit Stdarg.wit_int) n in
- let get_res = TacML (Loc.tag (get_res, [TacGeneric n])) in
+ let get_res = TacML (CAst.make (get_res, [TacGeneric n])) in
let getter = Tacexp (TacFun (List.map (fun n -> Name n) lid, get_res)) in
(** Evaluate the whole result *)
let gl = dummy_goal env evd in
@@ -557,7 +557,7 @@ let interp_cst_tac env sigma rk kind (zero,one,add,mul,opp) cst_tac =
closed_term_ast (List.map Smartlocate.global_with_alias lc)
| None ->
let t = ArgArg(Loc.tag @@ Lazy.force ltac_inv_morph_nothing) in
- TacArg(Loc.tag (TacCall(Loc.tag (t,[]))))
+ TacArg(CAst.make (TacCall(CAst.make (t,[]))))
let make_hyp env evd c =
let t = Retyping.get_type_of env !evd c in
@@ -582,7 +582,7 @@ let interp_power env evdref pow =
match pow with
| None ->
let t = ArgArg(Loc.tag (Lazy.force ltac_inv_morph_nothing)) in
- (TacArg(Loc.tag (TacCall(Loc.tag (t,[])))), plapp evdref coq_None [|carrier|])
+ (TacArg(CAst.make (TacCall(CAst.make (t,[])))), plapp evdref coq_None [|carrier|])
| Some (tac, spec) ->
let tac =
match tac with
diff --git a/plugins/ssr/ssrbool.v b/plugins/ssr/ssrbool.v
index a618fc781f..3a7cf41d43 100644
--- a/plugins/ssr/ssrbool.v
+++ b/plugins/ssr/ssrbool.v
@@ -371,7 +371,7 @@ Ltac prop_congr := apply: prop_congr.
Lemma is_true_true : true. Proof. by []. Qed.
Lemma not_false_is_true : ~ false. Proof. by []. Qed.
Lemma is_true_locked_true : locked true. Proof. by unlock. Qed.
-Hint Resolve is_true_true not_false_is_true is_true_locked_true.
+Hint Resolve is_true_true not_false_is_true is_true_locked_true : core.
(** Shorter names. **)
Definition isT := is_true_true.
diff --git a/plugins/ssr/ssrbwd.ml b/plugins/ssr/ssrbwd.ml
index 1c4508abf4..3e0fbc9a8c 100644
--- a/plugins/ssr/ssrbwd.ml
+++ b/plugins/ssr/ssrbwd.ml
@@ -104,8 +104,6 @@ let mkRAppView ist gl rv gv =
let nb_view_imps = interp_view_nbimps ist gl rv in
mkRApp rv (mkRHoles (abs nb_view_imps))
-let prof_apply_interp_with = mk_profiler "ssrapplytac.interp_with";;
-
let refine_interp_apply_view dbl ist gl gv =
let pair i = List.map (fun x -> i, x) in
let rv = pf_intern_term ist gl gv in
@@ -113,7 +111,6 @@ let refine_interp_apply_view dbl ist gl gv =
let interp_with (dbl, hint) =
let i = if dbl = Ssrview.AdaptorDb.Equivalence then 2 else 1 in
interp_refine ist gl (mkRApp hint (v :: mkRHoles i)) in
- let interp_with x = prof_apply_interp_with.profile interp_with x in
let rec loop = function
| [] -> (try apply_rconstr ~ist rv gl with _ -> view_error "apply" gv)
| h :: hs -> (try refine_with (snd (interp_with h)) gl with _ -> loop hs) in
diff --git a/plugins/ssr/ssrcommon.ml b/plugins/ssr/ssrcommon.ml
index be8f3603e4..efc4a2c743 100644
--- a/plugins/ssr/ssrcommon.ml
+++ b/plugins/ssr/ssrcommon.ml
@@ -242,7 +242,6 @@ let interp_refine ist gl rc =
let flags = {
Pretyping.use_typeclasses = true;
solve_unification_constraints = true;
- use_hook = None;
fail_evar = false;
expand_evars = true }
in
@@ -860,7 +859,7 @@ let ssr_n_tac seed n gl =
with Not_found ->
if n = -1 then fail "The ssreflect library was not loaded"
else fail ("The tactic "^name^" was not found") in
- let tacexpr = Loc.tag @@ Tacexpr.Reference (ArgArg (Loc.tag @@ tacname)) in
+ let tacexpr = CAst.make @@ Tacexpr.Reference (ArgArg (Loc.tag @@ tacname)) in
Proofview.V82.of_tactic (Tacinterp.eval_tactic (Tacexpr.TacArg tacexpr)) gl
let donetac n gl = ssr_n_tac "done" n gl
@@ -1001,7 +1000,7 @@ let applyn ~with_evars ?beta ?(with_shelve=false) n t gl =
| _ -> assert false
in loop sigma t [] n in
pp(lazy(str"Refiner.refiner " ++ Printer.pr_econstr_env (pf_env gl) (project gl) t));
- Tacmach.refine_no_check t gl
+ Refiner.refiner ~check:false EConstr.Unsafe.(to_constr t) gl
let refine_with ?(first_goes_last=false) ?beta ?(with_evars=true) oc gl =
let rec mkRels = function 1 -> [] | n -> mkRel n :: mkRels (n-1) in
@@ -1018,81 +1017,6 @@ let refine_with ?(first_goes_last=false) ?beta ?(with_evars=true) oc gl =
try applyn ~with_evars ~with_shelve:true ?beta n (EConstr.of_constr oc) gl
with e when CErrors.noncritical e -> raise dependent_apply_error
-(** Profiling *)(* {{{ *************************************************************)
-type profiler = {
- profile : 'a 'b. ('a -> 'b) -> 'a -> 'b;
- reset : unit -> unit;
- print : unit -> unit }
-let profile_now = ref false
-let something_profiled = ref false
-let profilers = ref []
-let add_profiler f = profilers := f :: !profilers;;
-let _ =
- Goptions.declare_bool_option
- { Goptions.optname = "ssreflect profiling";
- Goptions.optkey = ["SsrProfiling"];
- Goptions.optread = (fun _ -> !profile_now);
- Goptions.optdepr = false;
- Goptions.optwrite = (fun b ->
- Ssrmatching.profile b;
- profile_now := b;
- if b then List.iter (fun f -> f.reset ()) !profilers;
- if not b then List.iter (fun f -> f.print ()) !profilers) }
-let () =
- let prof_total =
- let init = ref 0.0 in {
- profile = (fun f x -> assert false);
- reset = (fun () -> init := Unix.gettimeofday ());
- print = (fun () -> if !something_profiled then
- prerr_endline
- (Printf.sprintf "!! %-39s %10d %9.4f %9.4f %9.4f"
- "total" 0 (Unix.gettimeofday() -. !init) 0.0 0.0)) } in
- let prof_legenda = {
- profile = (fun f x -> assert false);
- reset = (fun () -> ());
- print = (fun () -> if !something_profiled then begin
- prerr_endline
- (Printf.sprintf "!! %39s ---------- --------- --------- ---------"
- (String.make 39 '-'));
- prerr_endline
- (Printf.sprintf "!! %-39s %10s %9s %9s %9s"
- "function" "#calls" "total" "max" "average") end) } in
- add_profiler prof_legenda;
- add_profiler prof_total
-;;
-
-let mk_profiler s =
- let total, calls, max = ref 0.0, ref 0, ref 0.0 in
- let reset () = total := 0.0; calls := 0; max := 0.0 in
- let profile f x =
- if not !profile_now then f x else
- let before = Unix.gettimeofday () in
- try
- incr calls;
- let res = f x in
- let after = Unix.gettimeofday () in
- let delta = after -. before in
- total := !total +. delta;
- if delta > !max then max := delta;
- res
- with exc ->
- let after = Unix.gettimeofday () in
- let delta = after -. before in
- total := !total +. delta;
- if delta > !max then max := delta;
- raise exc in
- let print () =
- if !calls <> 0 then begin
- something_profiled := true;
- prerr_endline
- (Printf.sprintf "!! %-39s %10d %9.4f %9.4f %9.4f"
- s !calls !total !max (!total /. (float_of_int !calls))) end in
- let prof = { profile = profile; reset = reset; print = print } in
- add_profiler prof;
- prof
-;;
-(* }}} *)
-
(* We wipe out all the keywords generated by the grammar rules we defined. *)
(* The user is supposed to Require Import ssreflect or Require ssreflect *)
(* and Import ssreflect.SsrSyntax to obtain these keywords and as a *)
@@ -1168,8 +1092,8 @@ let tclDO n tac =
let _, info = CErrors.push e in
let e' = CErrors.UserError (l, prefix i ++ s) in
Util.iraise (e', info)
- | Ploc.Exc(loc, CErrors.UserError (l, s)) ->
- raise (Ploc.Exc(loc, CErrors.UserError (l, prefix i ++ s))) in
+ | Gramlib.Ploc.Exc(loc, CErrors.UserError (l, s)) ->
+ raise (Gramlib.Ploc.Exc(loc, CErrors.UserError (l, prefix i ++ s))) in
let rec loop i gl =
if i = n then tac_err_at i gl else
(tclTHEN (tac_err_at i) (loop (i + 1))) gl in
diff --git a/plugins/ssr/ssrcommon.mli b/plugins/ssr/ssrcommon.mli
index cf4e4b354e..e25c93bf0a 100644
--- a/plugins/ssr/ssrcommon.mli
+++ b/plugins/ssr/ssrcommon.mli
@@ -164,7 +164,7 @@ val mk_lterm : constr_expr -> ssrterm
val mk_ast_closure_term :
[ `None | `Parens | `DoubleParens | `At ] ->
Constrexpr.constr_expr -> ast_closure_term
-val interp_ast_closure_term : Geninterp.interp_sign -> Proof_type.goal
+val interp_ast_closure_term : Geninterp.interp_sign -> Goal.goal
Evd.sigma -> ast_closure_term -> Evd.evar_map * ast_closure_term
val subst_ast_closure_term : Mod_subst.substitution -> ast_closure_term -> ast_closure_term
val glob_ast_closure_term : Genintern.glob_sign -> ast_closure_term -> ast_closure_term
@@ -378,13 +378,6 @@ val pf_interp_gen_aux :
val is_name_in_ipats :
Id.t -> ssripats -> bool
-type profiler = {
- profile : 'a 'b. ('a -> 'b) -> 'a -> 'b;
- reset : unit -> unit;
- print : unit -> unit }
-
-val mk_profiler : string -> profiler
-
(** Basic tactics *)
val introid : ?orig:Name.t ref -> Id.t -> v82tac
diff --git a/plugins/ssr/ssrelim.ml b/plugins/ssr/ssrelim.ml
index d09b81593e..2c9ec3a7cf 100644
--- a/plugins/ssr/ssrelim.ml
+++ b/plugins/ssr/ssrelim.ml
@@ -398,13 +398,13 @@ let revtoptac n0 gl =
let dc, cl = EConstr.decompose_prod_n_assum (project gl) n (pf_concl gl) in
let dc' = dc @ [Context.Rel.Declaration.LocalAssum(Name rev_id, EConstr.it_mkProd_or_LetIn cl (List.rev dc))] in
let f = EConstr.it_mkLambda_or_LetIn (mkEtaApp (EConstr.mkRel (n + 1)) (-n) 1) dc' in
- refine (EConstr.mkApp (f, [|Evarutil.mk_new_meta ()|])) gl
+ Refiner.refiner ~check:true EConstr.Unsafe.(to_constr (EConstr.mkApp (f, [|Evarutil.mk_new_meta ()|]))) gl
let equality_inj l b id c gl =
let msg = ref "" in
try Proofview.V82.of_tactic (Equality.inj None l b None c) gl
with
- | Ploc.Exc(_,CErrors.UserError (_,s))
+ | Gramlib.Ploc.Exc(_,CErrors.UserError (_,s))
| CErrors.UserError (_,s)
when msg := Pp.string_of_ppcmds s;
!msg = "Not a projectable equality but a discriminable one." ||
diff --git a/plugins/ssr/ssrequality.ml b/plugins/ssr/ssrequality.ml
index 2a69e3f23a..22475fef34 100644
--- a/plugins/ssr/ssrequality.ml
+++ b/plugins/ssr/ssrequality.ml
@@ -425,11 +425,6 @@ let rwcltac cl rdx dir sr gl =
in
tclTHEN cvtac' rwtac gl
-let prof_rwcltac = mk_profiler "rwrxtac.rwcltac";;
-let rwcltac cl rdx dir sr gl =
- prof_rwcltac.profile (rwcltac cl rdx dir sr) gl
-;;
-
[@@@ocaml.warning "-3"]
let lz_coq_prod =
@@ -455,8 +450,6 @@ let ssr_is_setoid env =
Rewrite.is_applied_rewrite_relation env
sigma [] (EConstr.mkApp (r, args)) <> None
-let prof_rwxrtac_find_rule = mk_profiler "rwrxtac.find_rule";;
-
let closed0_check cl p gl =
if closed0 cl then
errorstrm Pp.(str"No occurrence of redex "++ pr_constr_env (pf_env gl) (project gl) p)
@@ -556,7 +549,6 @@ let rwrxtac occ rdx_pat dir rule gl =
d, (ise, Evd.evar_universe_context ise, Reductionops.nf_evar ise r)
with _ -> rwtac rs in
rwtac rules in
- let find_rule rdx = prof_rwxrtac_find_rule.profile find_rule rdx in
let sigma0, env0, concl0 = project gl, pf_env gl, pf_concl gl in
let find_R, conclude = match rdx_pat with
| Some (_, (In_T _ | In_X_In_T _)) | None ->
@@ -582,11 +574,6 @@ let rwrxtac occ rdx_pat dir rule gl =
rwcltac (EConstr.of_constr concl) (EConstr.of_constr rdx) d r gl
;;
-let prof_rwxrtac = mk_profiler "rwrxtac";;
-let rwrxtac occ rdx_pat dir rule gl =
- prof_rwxrtac.profile (rwrxtac occ rdx_pat dir rule) gl
-;;
-
let ssrinstancesofrule ist dir arg gl =
let sigma0, env0, concl0 = project gl, pf_env gl, pf_concl gl in
let rule = interp_term ist gl arg in
diff --git a/plugins/ssr/ssrfun.v b/plugins/ssr/ssrfun.v
index e2c0ed7c8b..6535cad8b7 100644
--- a/plugins/ssr/ssrfun.v
+++ b/plugins/ssr/ssrfun.v
@@ -398,7 +398,7 @@ End ExtensionalEquality.
Typeclasses Opaque eqfun.
Typeclasses Opaque eqrel.
-Hint Resolve frefl rrefl.
+Hint Resolve frefl rrefl : core.
Notation "f1 =1 f2" := (eqfun f1 f2)
(at level 70, no associativity) : fun_scope.
diff --git a/plugins/ssr/ssrparser.mlg b/plugins/ssr/ssrparser.mlg
index 52240f5896..2dff0cc84f 100644
--- a/plugins/ssr/ssrparser.mlg
+++ b/plugins/ssr/ssrparser.mlg
@@ -268,16 +268,16 @@ let negate_parser f x =
| Some _ -> raise Stream.Failure
let test_not_ssrslashnum =
- Pcoq.Gram.Entry.of_parser
+ Pcoq.Entry.of_parser
"test_not_ssrslashnum" (negate_parser test_ssrslashnum10)
let test_ssrslashnum00 =
- Pcoq.Gram.Entry.of_parser "test_ssrslashnum01" test_ssrslashnum00
+ Pcoq.Entry.of_parser "test_ssrslashnum01" test_ssrslashnum00
let test_ssrslashnum10 =
- Pcoq.Gram.Entry.of_parser "test_ssrslashnum10" test_ssrslashnum10
+ Pcoq.Entry.of_parser "test_ssrslashnum10" test_ssrslashnum10
let test_ssrslashnum11 =
- Pcoq.Gram.Entry.of_parser "test_ssrslashnum11" test_ssrslashnum11
+ Pcoq.Entry.of_parser "test_ssrslashnum11" test_ssrslashnum11
let test_ssrslashnum01 =
- Pcoq.Gram.Entry.of_parser "test_ssrslashnum01" test_ssrslashnum01
+ Pcoq.Entry.of_parser "test_ssrslashnum01" test_ssrslashnum01
}
@@ -470,7 +470,7 @@ let input_ssrtermkind strm = match Util.stream_nth 0 strm with
| Tok.KEYWORD "@" -> xWithAt
| _ -> xNoFlag
-let ssrtermkind = Pcoq.Gram.Entry.of_parser "ssrtermkind" input_ssrtermkind
+let ssrtermkind = Pcoq.Entry.of_parser "ssrtermkind" input_ssrtermkind
(* New kinds of terms *)
@@ -481,7 +481,7 @@ let input_term_annotation strm =
| Tok.KEYWORD "@" :: _ -> `At
| _ -> `None
let term_annotation =
- Gram.Entry.of_parser "term_annotation" input_term_annotation
+ Pcoq.Entry.of_parser "term_annotation" input_term_annotation
(* terms *)
@@ -800,7 +800,7 @@ let reject_ssrhid strm =
| _ -> ())
| _ -> ()
-let test_nohidden = Pcoq.Gram.Entry.of_parser "test_ssrhid" reject_ssrhid
+let test_nohidden = Pcoq.Entry.of_parser "test_ssrhid" reject_ssrhid
}
@@ -961,7 +961,7 @@ let accept_ssrfwdid strm =
| Tok.IDENT id -> accept_before_syms_or_any_id [":"; ":="; "("] strm
| _ -> raise Stream.Failure
-let test_ssrfwdid = Gram.Entry.of_parser "test_ssrfwdid" accept_ssrfwdid
+let test_ssrfwdid = Pcoq.Entry.of_parser "test_ssrfwdid" accept_ssrfwdid
}
@@ -1540,14 +1540,14 @@ let accept_ssrseqvar strm =
accept_before_syms_or_ids ["["] ["first";"last"] strm
| _ -> raise Stream.Failure
-let test_ssrseqvar = Gram.Entry.of_parser "test_ssrseqvar" accept_ssrseqvar
+let test_ssrseqvar = Pcoq.Entry.of_parser "test_ssrseqvar" accept_ssrseqvar
let swaptacarg (loc, b) = (b, []), Some (TacId [])
let check_seqtacarg dir arg = match snd arg, dir with
- | ((true, []), Some (TacAtom (loc, _))), L2R ->
+ | ((true, []), Some (TacAtom { CAst.loc })), L2R ->
CErrors.user_err ?loc (str "expected \"last\"")
- | ((false, []), Some (TacAtom (loc, _))), R2L ->
+ | ((false, []), Some (TacAtom { CAst.loc })), R2L ->
CErrors.user_err ?loc (str "expected \"first\"")
| _, _ -> arg
@@ -1628,7 +1628,7 @@ let ssr_id_of_string loc s =
^ "Scripts with explicit references to anonymous variables are fragile."))
end; Id.of_string s
-let ssr_null_entry = Gram.Entry.of_parser "ssr_null" (fun _ -> ())
+let ssr_null_entry = Pcoq.Entry.of_parser "ssr_null" (fun _ -> ())
}
@@ -1677,7 +1677,7 @@ let set_pr_ssrtac name prec afmt = (* FIXME *) () (*
| ArgCoq at -> Egramml.GramTerminal "COQ_ARG") afmt in
let tacname = ssrtac_name name in () *)
-let ssrtac_atom ?loc name args = TacML (Loc.tag ?loc (ssrtac_entry name 0, args))
+let ssrtac_atom ?loc name args = TacML (CAst.make ?loc (ssrtac_entry name 0, args))
let ssrtac_expr ?loc name args = ssrtac_atom ?loc name args
let tclintros_expr ?loc tac ipats =
@@ -1704,7 +1704,7 @@ END
GRAMMAR EXTEND Gram
GLOBAL: tactic_expr;
- ssrparentacarg: [[ "("; tac = tactic_expr; ")" -> { Loc.tag ~loc (Tacexp tac) } ]];
+ ssrparentacarg: [[ "("; tac = tactic_expr; ")" -> { CAst.make ~loc (Tacexp tac) } ]];
tactic_expr: LEVEL "0" [[ arg = ssrparentacarg -> { TacArg arg } ]];
END
@@ -1724,7 +1724,7 @@ let ssrautoprop gl =
let tacname =
try Tacenv.locate_tactic (qualid_of_ident (Id.of_string "ssrautoprop"))
with Not_found -> Tacenv.locate_tactic (ssrqid "ssrautoprop") in
- let tacexpr = Loc.tag @@ Tacexpr.Reference (ArgArg (Loc.tag @@ tacname)) in
+ let tacexpr = CAst.make @@ Tacexpr.Reference (ArgArg (Loc.tag @@ tacname)) in
V82.of_tactic (eval_tactic (Tacexpr.TacArg tacexpr)) gl
with Not_found -> V82.of_tactic (Auto.full_trivial []) gl
@@ -1955,7 +1955,7 @@ let accept_ssreqid strm =
accept_before_syms [":"] strm
| _ -> raise Stream.Failure
-let test_ssreqid = Gram.Entry.of_parser "test_ssreqid" accept_ssreqid
+let test_ssreqid = Pcoq.Entry.of_parser "test_ssreqid" accept_ssreqid
}
@@ -2373,7 +2373,7 @@ let test_ssr_rw_syntax =
match Util.stream_nth 0 strm with
| Tok.KEYWORD key when List.mem key.[0] [lbrace; '['; '/'] -> ()
| _ -> raise Stream.Failure in
- Gram.Entry.of_parser "test_ssr_rw_syntax" test
+ Pcoq.Entry.of_parser "test_ssr_rw_syntax" test
}
@@ -2583,7 +2583,7 @@ let accept_idcomma strm =
| Tok.IDENT _ | Tok.KEYWORD "_" -> accept_before_syms [","] strm
| _ -> raise Stream.Failure
-let test_idcomma = Gram.Entry.of_parser "test_idcomma" accept_idcomma
+let test_idcomma = Pcoq.Entry.of_parser "test_idcomma" accept_idcomma
}
diff --git a/plugins/ssrmatching/g_ssrmatching.mlg b/plugins/ssrmatching/g_ssrmatching.mlg
index 3f0794fdd4..4ddaeb49fd 100644
--- a/plugins/ssrmatching/g_ssrmatching.mlg
+++ b/plugins/ssrmatching/g_ssrmatching.mlg
@@ -11,7 +11,6 @@
{
open Ltac_plugin
-open Pcoq
open Pcoq.Constr
open Ssrmatching
open Ssrmatching.Internal
@@ -69,7 +68,7 @@ let input_ssrtermkind strm = match Util.stream_nth 0 strm with
| Tok.KEYWORD "(" -> '('
| Tok.KEYWORD "@" -> '@'
| _ -> ' '
-let ssrtermkind = Pcoq.Gram.Entry.of_parser "ssrtermkind" input_ssrtermkind
+let ssrtermkind = Pcoq.Entry.of_parser "ssrtermkind" input_ssrtermkind
}
diff --git a/plugins/ssrmatching/plugin_base.dune b/plugins/ssrmatching/plugin_base.dune
index 1450a94de1..06f67c3774 100644
--- a/plugins/ssrmatching/plugin_base.dune
+++ b/plugins/ssrmatching/plugin_base.dune
@@ -2,5 +2,4 @@
(name ssrmatching_plugin)
(public_name coq.plugins.ssrmatching)
(synopsis "Coq ssrmatching plugin")
- (flags :standard -open Gramlib)
(libraries coq.plugins.ltac))
diff --git a/plugins/ssrmatching/ssrmatching.ml b/plugins/ssrmatching/ssrmatching.ml
index 5dcbf9b3ef..8cb0a8b463 100644
--- a/plugins/ssrmatching/ssrmatching.ml
+++ b/plugins/ssrmatching/ssrmatching.ml
@@ -174,82 +174,6 @@ let nf_evar sigma c =
(* }}} *)
-(** Profiling *)(* {{{ *************************************************************)
-type profiler = {
- profile : 'a 'b. ('a -> 'b) -> 'a -> 'b;
- reset : unit -> unit;
- print : unit -> unit }
-let profile_now = ref false
-let something_profiled = ref false
-let profilers = ref []
-let add_profiler f = profilers := f :: !profilers;;
-let profile b =
- profile_now := b;
- if b then List.iter (fun f -> f.reset ()) !profilers;
- if not b then List.iter (fun f -> f.print ()) !profilers
-;;
-let _ =
- Goptions.declare_bool_option
- { Goptions.optname = "ssrmatching profiling";
- Goptions.optkey = ["SsrMatchingProfiling"];
- Goptions.optread = (fun _ -> !profile_now);
- Goptions.optdepr = false;
- Goptions.optwrite = profile }
-let () =
- let prof_total =
- let init = ref 0.0 in {
- profile = (fun f x -> assert false);
- reset = (fun () -> init := Unix.gettimeofday ());
- print = (fun () -> if !something_profiled then
- prerr_endline
- (Printf.sprintf "!! %-39s %10d %9.4f %9.4f %9.4f"
- "total" 0 (Unix.gettimeofday() -. !init) 0.0 0.0)) } in
- let prof_legenda = {
- profile = (fun f x -> assert false);
- reset = (fun () -> ());
- print = (fun () -> if !something_profiled then begin
- prerr_endline
- (Printf.sprintf "!! %39s ---------- --------- --------- ---------"
- (String.make 39 '-'));
- prerr_endline
- (Printf.sprintf "!! %-39s %10s %9s %9s %9s"
- "function" "#calls" "total" "max" "average") end) } in
- add_profiler prof_legenda;
- add_profiler prof_total
-;;
-
-let mk_profiler s =
- let total, calls, max = ref 0.0, ref 0, ref 0.0 in
- let reset () = total := 0.0; calls := 0; max := 0.0 in
- let profile f x =
- if not !profile_now then f x else
- let before = Unix.gettimeofday () in
- try
- incr calls;
- let res = f x in
- let after = Unix.gettimeofday () in
- let delta = after -. before in
- total := !total +. delta;
- if delta > !max then max := delta;
- res
- with exc ->
- let after = Unix.gettimeofday () in
- let delta = after -. before in
- total := !total +. delta;
- if delta > !max then max := delta;
- raise exc in
- let print () =
- if !calls <> 0 then begin
- something_profiled := true;
- prerr_endline
- (Printf.sprintf "!! %-39s %10d %9.4f %9.4f %9.4f"
- s !calls !total !max (!total /. (float_of_int !calls))) end in
- let prof = { profile = profile; reset = reset; print = print } in
- add_profiler prof;
- prof
-;;
-(* }}} *)
-
exception NoProgress
(** Unification procedures. *)
@@ -286,11 +210,6 @@ let unif_EQ_args env sigma pa a =
let rec loop i = (i = n) || unif_EQ env sigma pa.(i) a.(i) && loop (i + 1) in
loop 0
-let prof_unif_eq_args = mk_profiler "unif_EQ_args";;
-let unif_EQ_args env sigma pa a =
- prof_unif_eq_args.profile (unif_EQ_args env sigma pa) a
-;;
-
let unif_HO env ise p c =
try Evarconv.the_conv_x env p c ise
with Evarconv.UnableToUnify(ise, err) ->
@@ -650,11 +569,6 @@ let match_upats_FO upats env sigma0 ise orig_c =
iter_constr_LR loop f; Array.iter loop a in
try loop orig_c with Invalid_argument _ -> CErrors.anomaly (str"IN FO.")
-let prof_FO = mk_profiler "match_upats_FO";;
-let match_upats_FO upats env sigma0 ise c =
- prof_FO.profile (match_upats_FO upats env sigma0) ise c
-;;
-
let match_upats_HO ~on_instance upats env sigma0 ise c =
let dont_impact_evars = dont_impact_evars_in c in
@@ -706,11 +620,6 @@ let match_upats_HO ~on_instance upats env sigma0 ise c =
if !it_did_match then raise NoProgress;
!failed_because_of_TC
-let prof_HO = mk_profiler "match_upats_HO";;
-let match_upats_HO ~on_instance upats env sigma0 ise c =
- prof_HO.profile (match_upats_HO ~on_instance upats env sigma0) ise c
-;;
-
let fixed_upat evd = function
| {up_k = KpatFlex | KpatEvar _ | KpatProj _} -> false
@@ -1388,7 +1297,7 @@ let () =
let () = Tacenv.register_ml_tactic name [|mltac|] in
let tac =
TacFun ([Name (Id.of_string "pattern")],
- TacML (Loc.tag ({ mltac_name = name; mltac_index = 0 }, []))) in
+ TacML (CAst.make ({ mltac_name = name; mltac_index = 0 }, []))) in
let obj () =
Tacenv.register_ltac true false (Id.of_string "ssrpattern") tac in
Mltop.declare_cache_obj obj "ssrmatching_plugin"
diff --git a/plugins/ssrmatching/ssrmatching.mli b/plugins/ssrmatching/ssrmatching.mli
index b3ddb52e85..93a8c48435 100644
--- a/plugins/ssrmatching/ssrmatching.mli
+++ b/plugins/ssrmatching/ssrmatching.mli
@@ -221,10 +221,6 @@ val pf_unsafe_merge_uc : UState.t -> goal Evd.sigma -> goal Evd.sigma
(* One can also "Set SsrMatchingDebug" from a .v *)
val debug : bool -> unit
-(* One should delimit a snippet with "Set SsrMatchingProfiling" and
- * "Unset SsrMatchingProfiling" to get timings *)
-val profile : bool -> unit
-
val ssrinstancesof : cpattern -> Tacmach.tactic
(** Functions used for grammar extensions. Do not use. *)
@@ -234,7 +230,7 @@ sig
val wit_rpatternty : (rpattern, rpattern, rpattern) Genarg.genarg_type
val glob_rpattern : Genintern.glob_sign -> rpattern -> rpattern
val subst_rpattern : Mod_subst.substitution -> rpattern -> rpattern
- val interp_rpattern : Geninterp.interp_sign -> Proof_type.goal Evd.sigma -> rpattern -> Evd.evar_map * rpattern
+ val interp_rpattern : Geninterp.interp_sign -> Goal.goal Evd.sigma -> rpattern -> Evd.evar_map * rpattern
val pr_rpattern : rpattern -> Pp.t
val mk_rpattern : (cpattern, cpattern) ssrpattern -> rpattern
val mk_lterm : Constrexpr.constr_expr -> Geninterp.interp_sign option -> cpattern
@@ -242,7 +238,7 @@ sig
val glob_cpattern : Genintern.glob_sign -> cpattern -> cpattern
val subst_ssrterm : Mod_subst.substitution -> cpattern -> cpattern
- val interp_ssrterm : Geninterp.interp_sign -> Proof_type.goal Evd.sigma -> cpattern -> Evd.evar_map * cpattern
+ val interp_ssrterm : Geninterp.interp_sign -> Goal.goal Evd.sigma -> cpattern -> Evd.evar_map * cpattern
val pr_ssrterm : cpattern -> Pp.t
end
diff --git a/pretyping/cases.ml b/pretyping/cases.ml
index 333b99eace..fe67f5767b 100644
--- a/pretyping/cases.ml
+++ b/pretyping/cases.ml
@@ -1698,7 +1698,7 @@ let abstract_tycon ?loc env sigma subst tycon extenv t =
try list_assoc_in_triple i subst0 with Not_found -> mkRel i)
1 (rel_context !!env) in
let sigma, ev' = Evarutil.new_evar ~src ~typeclass_candidate:false !!env sigma ty in
- begin match solve_simple_eqn (evar_conv_x full_transparent_state) !!env sigma (None,ev,substl inst ev') with
+ begin match solve_simple_eqn (evar_conv_x TransparentState.full) !!env sigma (None,ev,substl inst ev') with
| Success evd -> evdref := evd
| UnifFailure _ -> assert false
end;
diff --git a/pretyping/evarconv.ml b/pretyping/evarconv.ml
index 6a75be352b..f370ad7ae2 100644
--- a/pretyping/evarconv.ml
+++ b/pretyping/evarconv.ml
@@ -16,7 +16,6 @@ open Termops
open Environ
open EConstr
open Vars
-open CClosure
open Reduction
open Reductionops
open Recordops
@@ -30,7 +29,7 @@ open Context.Named.Declaration
module RelDecl = Context.Rel.Declaration
module NamedDecl = Context.Named.Declaration
-type unify_fun = transparent_state ->
+type unify_fun = TransparentState.t ->
env -> evar_map -> conv_pb -> EConstr.constr -> EConstr.constr -> Evarsolve.unification_result
let debug_unification = ref (false)
@@ -74,14 +73,14 @@ let coq_unit_judge =
let unfold_projection env evd ts p c =
let cst = Projection.constant p in
- if is_transparent_constant ts cst then
+ if TransparentState.is_transparent_constant ts cst then
Some (mkProj (Projection.unfold p, c))
else None
let eval_flexible_term ts env evd c =
match EConstr.kind evd c with
| Const (c, u) ->
- if is_transparent_constant ts c
+ if TransparentState.is_transparent_constant ts c
then Option.map EConstr.of_constr (constant_opt_value_in env (c, EInstance.kind evd u))
else None
| Rel n ->
@@ -91,7 +90,7 @@ let eval_flexible_term ts env evd c =
with Not_found -> None)
| Var id ->
(try
- if is_transparent_variable ts id then
+ if TransparentState.is_transparent_variable ts id then
env |> lookup_named id |> NamedDecl.get_value
else None
with Not_found -> None)
@@ -1211,7 +1210,7 @@ let second_order_matching ts env_rhs evd (evk,args) argoccs rhs =
| [] ->
let evd =
try Evarsolve.check_evar_instance evd evk rhs
- (evar_conv_x full_transparent_state)
+ (evar_conv_x TransparentState.full)
with IllTypedInstance _ -> raise (TypingFailed evd)
in
Evd.define evk rhs evd
@@ -1354,7 +1353,7 @@ let solve_unconstrained_impossible_cases env evd =
let j, ctx = coq_unit_judge env in
let evd' = Evd.merge_context_set Evd.univ_flexible_alg ?loc evd' ctx in
let ty = j_type j in
- let conv_algo = evar_conv_x full_transparent_state in
+ let conv_algo = evar_conv_x TransparentState.full in
let evd' = check_evar_instance evd' evk ty conv_algo in
Evd.define evk ty evd'
| _ -> evd') evd evd
@@ -1393,7 +1392,7 @@ let solve_unif_constraints_with_heuristics env
exception UnableToUnify of evar_map * unification_error
-let default_transparent_state env = full_transparent_state
+let default_transparent_state env = TransparentState.full
(* Conv_oracle.get_transp_state (Environ.oracle env) *)
let the_conv_x env ?(ts=default_transparent_state env) t1 t2 evd =
diff --git a/pretyping/evarconv.mli b/pretyping/evarconv.mli
index 350dece28a..4585fac252 100644
--- a/pretyping/evarconv.mli
+++ b/pretyping/evarconv.mli
@@ -8,7 +8,6 @@
(* * (see LICENSE file for the text of the license) *)
(************************************************************************)
-open Names
open EConstr
open Environ
open Reductionops
@@ -22,20 +21,20 @@ exception UnableToUnify of evar_map * Pretype_errors.unification_error
(** {6 Main unification algorithm for type inference. } *)
(** returns exception NotUnifiable with best known evar_map if not unifiable *)
-val the_conv_x : env -> ?ts:transparent_state -> constr -> constr -> evar_map -> evar_map
-val the_conv_x_leq : env -> ?ts:transparent_state -> constr -> constr -> evar_map -> evar_map
+val the_conv_x : env -> ?ts:TransparentState.t -> constr -> constr -> evar_map -> evar_map
+val the_conv_x_leq : env -> ?ts:TransparentState.t -> constr -> constr -> evar_map -> evar_map
(** The same function resolving evars by side-effect and
catching the exception *)
-val conv : env -> ?ts:transparent_state -> evar_map -> constr -> constr -> evar_map option
-val cumul : env -> ?ts:transparent_state -> evar_map -> constr -> constr -> evar_map option
+val conv : env -> ?ts:TransparentState.t -> evar_map -> constr -> constr -> evar_map option
+val cumul : env -> ?ts:TransparentState.t -> evar_map -> constr -> constr -> evar_map option
(** {6 Unification heuristics. } *)
(** Try heuristics to solve pending unification problems and to solve
evars with candidates *)
-val solve_unif_constraints_with_heuristics : env -> ?ts:transparent_state -> evar_map -> evar_map
+val solve_unif_constraints_with_heuristics : env -> ?ts:TransparentState.t -> evar_map -> evar_map
(** Check all pending unification problems are solved and raise an
error otherwise *)
@@ -55,14 +54,14 @@ val check_conv_record : env -> evar_map ->
(** Try to solve problems of the form ?x[args] = c by second-order
matching, using typing to select occurrences *)
-val second_order_matching : transparent_state -> env -> evar_map ->
+val second_order_matching : TransparentState.t -> env -> evar_map ->
EConstr.existential -> occurrences option list -> constr -> evar_map * bool
(** Declare function to enforce evars resolution by using typing constraints *)
val set_solve_evars : (env -> evar_map -> constr -> evar_map * constr) -> unit
-type unify_fun = transparent_state ->
+type unify_fun = TransparentState.t ->
env -> evar_map -> conv_pb -> constr -> constr -> Evarsolve.unification_result
(** Override default [evar_conv_x] algorithm. *)
@@ -73,7 +72,7 @@ val evar_conv_x : unify_fun
(**/**)
(* For debugging *)
-val evar_eqappr_x : ?rhs_is_already_stuck:bool -> transparent_state * bool ->
+val evar_eqappr_x : ?rhs_is_already_stuck:bool -> TransparentState.t * bool ->
env -> evar_map ->
conv_pb -> state * Cst_stack.t -> state * Cst_stack.t ->
Evarsolve.unification_result
diff --git a/pretyping/heads.ml b/pretyping/heads.ml
index a3e4eb8971..e533930267 100644
--- a/pretyping/heads.ml
+++ b/pretyping/heads.ml
@@ -26,9 +26,8 @@ open Context.Named.Declaration
the evaluation of [phi(0)] and the head of [h] is declared unknown). *)
type rigid_head_kind =
-| RigidParameter of Constant.t (* a Const without body *)
-| RigidVar of variable (* a Var without body *)
-| RigidType (* an inductive, a product or a sort *)
+| RigidParameter of Constant.t (* a Const without body. Module substitution may instantiate it with something else. *)
+| RigidOther (* a Var without body, inductive, product, sort, projection *)
type head_approximation =
| RigidHead of rigid_head_kind
@@ -77,7 +76,7 @@ let kind_of_head env t =
str "."))
| Construct _ | CoFix _ ->
if b then NotImmediatelyComputableHead else ConstructorHead
- | Sort _ | Ind _ | Prod _ -> RigidHead RigidType
+ | Sort _ | Ind _ | Prod _ -> RigidHead RigidOther
| Cast (c,_,_) -> aux k l c b
| Lambda (_,_,c) ->
begin match l with
@@ -89,9 +88,7 @@ let kind_of_head env t =
| LetIn _ -> assert false
| Meta _ | Evar _ -> NotImmediatelyComputableHead
| App (c,al) -> aux k (Array.to_list al @ l) c b
- | Proj (p,c) ->
- (try on_subterm k (c :: l) b (constant_head (Projection.constant p))
- with Not_found -> assert false)
+ | Proj (p,c) -> RigidHead RigidOther
| Case (_,_,c,_) -> aux k [] c true
| Fix ((i,j),_) ->
@@ -124,22 +121,16 @@ let kind_of_head env t =
(* FIXME: maybe change interface here *)
let compute_head = function
| EvalConstRef cst ->
- let env = Global.env() in
- let cb = Environ.lookup_constant cst env in
- let is_Def = function Declarations.Def _ -> true | _ -> false in
- let body =
- if not (Recordops.is_primitive_projection cst) && is_Def cb.Declarations.const_body
- then Global.body_of_constant cst else None
- in
- (match body with
- | None -> RigidHead (RigidParameter cst)
- | Some (c, _) -> kind_of_head env c)
+ let env = Global.env() in
+ let body = Environ.constant_opt_value_in env (cst,Univ.Instance.empty) in
+ (match body with
+ | None -> RigidHead (RigidParameter cst)
+ | Some c -> kind_of_head env c)
| EvalVarRef id ->
(match Global.lookup_named id with
| LocalDef (_,c,_) when not (Decls.variable_opacity id) ->
kind_of_head (Global.env()) c
- | _ ->
- RigidHead (RigidVar id))
+ | _ -> RigidHead RigidOther)
let is_rigid env t =
match kind_of_head env t with
diff --git a/pretyping/inductiveops.ml b/pretyping/inductiveops.ml
index 14358dd02a..10d8451947 100644
--- a/pretyping/inductiveops.ml
+++ b/pretyping/inductiveops.ml
@@ -759,6 +759,6 @@ let control_only_guard env sigma c =
in
let rec iter env c =
check_fix_cofix env c;
- iter_constr_with_full_binders sigma EConstr.push_rel iter env c
+ EConstr.iter_with_full_binders sigma EConstr.push_rel iter env c
in
iter env c
diff --git a/pretyping/inferCumulativity.ml b/pretyping/inferCumulativity.ml
index 9762d0f1d9..e46d03b743 100644
--- a/pretyping/inferCumulativity.ml
+++ b/pretyping/inferCumulativity.ml
@@ -110,9 +110,9 @@ let rec infer_fterm cv_pb infos variances hd stk =
let (_,ty,bd) = destFLambda mk_clos hd in
let variances = infer_fterm CONV infos variances ty [] in
infer_fterm CONV infos variances bd []
- | FProd (_,dom,codom) ->
+ | FProd (_,dom,codom,e) ->
let variances = infer_fterm CONV infos variances dom [] in
- infer_fterm cv_pb infos variances codom []
+ infer_fterm cv_pb infos variances (mk_clos (Esubst.subs_lift e) codom) []
| FInd (ind, u) ->
let variances =
if Instance.is_empty u then variances
diff --git a/pretyping/pretyping.ml b/pretyping/pretyping.ml
index cba1533da5..abf52d2893 100644
--- a/pretyping/pretyping.ml
+++ b/pretyping/pretyping.ml
@@ -193,7 +193,6 @@ type inference_hook = env -> evar_map -> Evar.t -> evar_map * constr
type inference_flags = {
use_typeclasses : bool;
solve_unification_constraints : bool;
- use_hook : inference_hook option;
fail_evar : bool;
expand_evars : bool
}
@@ -216,7 +215,7 @@ type frozen =
(** Proper partition of the evar map as described above. *)
let frozen_and_pending_holes (sigma, sigma') =
- let undefined0 = Evd.undefined_map sigma in
+ let undefined0 = Option.cata Evd.undefined_map Evar.Map.empty sigma in
(** Fast path when the undefined evars where not modified *)
if undefined0 == Evd.undefined_map sigma' then
FrozenId undefined0
@@ -247,14 +246,14 @@ let apply_typeclasses env sigma frozen fail_evar =
else sigma in
sigma
-let apply_inference_hook hook sigma frozen = match frozen with
+let apply_inference_hook hook env sigma frozen = match frozen with
| FrozenId _ -> sigma
| FrozenProgress (lazy (_, pending)) ->
Evar.Set.fold (fun evk sigma ->
if Evd.is_undefined sigma evk (* in particular not defined by side-effect *)
then
try
- let sigma, c = hook sigma evk in
+ let sigma, c = hook env sigma evk in
Evd.define evk c sigma
with Exit ->
sigma
@@ -307,16 +306,16 @@ let check_evars_are_solved env sigma frozen =
(* Try typeclasses, hooks, unification heuristics ... *)
-let solve_remaining_evars flags env sigma init_sigma =
- let frozen = frozen_and_pending_holes (init_sigma, sigma) in
+let solve_remaining_evars ?hook flags env ?initial sigma =
+ let frozen = frozen_and_pending_holes (initial, sigma) in
let sigma =
if flags.use_typeclasses
then apply_typeclasses env sigma frozen false
else sigma
in
- let sigma = if Option.has_some flags.use_hook
- then apply_inference_hook (Option.get flags.use_hook env) sigma frozen
- else sigma
+ let sigma = match hook with
+ | None -> sigma
+ | Some hook -> apply_inference_hook hook env sigma frozen
in
let sigma = if flags.solve_unification_constraints
then apply_heuristics env sigma false
@@ -325,12 +324,12 @@ let solve_remaining_evars flags env sigma init_sigma =
if flags.fail_evar then check_evars_are_solved env sigma frozen;
sigma
-let check_evars_are_solved env current_sigma init_sigma =
- let frozen = frozen_and_pending_holes (init_sigma, current_sigma) in
+let check_evars_are_solved env ?initial current_sigma =
+ let frozen = frozen_and_pending_holes (initial, current_sigma) in
check_evars_are_solved env current_sigma frozen
-let process_inference_flags flags env initial_sigma (sigma,c,cty) =
- let sigma = solve_remaining_evars flags env sigma initial_sigma in
+let process_inference_flags flags env initial (sigma,c,cty) =
+ let sigma = solve_remaining_evars flags env ~initial sigma in
let c = if flags.expand_evars then nf_evar sigma c else c in
sigma,c,cty
@@ -1075,14 +1074,12 @@ let ise_pretype_gen flags env sigma lvar kind c =
let default_inference_flags fail = {
use_typeclasses = true;
solve_unification_constraints = true;
- use_hook = None;
fail_evar = fail;
expand_evars = true }
let no_classes_no_fail_inference_flags = {
use_typeclasses = false;
solve_unification_constraints = true;
- use_hook = None;
fail_evar = false;
expand_evars = true }
diff --git a/pretyping/pretyping.mli b/pretyping/pretyping.mli
index 0f95d27528..59e6c00037 100644
--- a/pretyping/pretyping.mli
+++ b/pretyping/pretyping.mli
@@ -35,7 +35,6 @@ type inference_hook = env -> evar_map -> Evar.t -> evar_map * constr
type inference_flags = {
use_typeclasses : bool;
solve_unification_constraints : bool;
- use_hook : inference_hook option;
fail_evar : bool;
expand_evars : bool
}
@@ -95,14 +94,14 @@ val understand : ?flags:inference_flags -> ?expected_type:typing_constraint ->
with candidate and no other conversion problems that the one in
[pending], however, it can contain more evars than the pending ones. *)
-val solve_remaining_evars : inference_flags ->
- env -> (* current map *) evar_map -> (* initial map *) evar_map -> evar_map
+val solve_remaining_evars : ?hook:inference_hook -> inference_flags ->
+ env -> ?initial:evar_map -> (* current map *) evar_map -> evar_map
(** Checking evars and pending conversion problems are all solved,
reporting an appropriate error message *)
val check_evars_are_solved :
- env -> (* current map: *) evar_map -> (* initial map: *) evar_map -> unit
+ env -> ?initial:evar_map -> (* current map: *) evar_map -> unit
(** [check_evars env initial_sigma extended_sigma c] fails if some
new unresolved evar remains in [c] *)
diff --git a/pretyping/recordops.ml b/pretyping/recordops.ml
index 4faa753dfb..fe9b69dbbc 100644
--- a/pretyping/recordops.ml
+++ b/pretyping/recordops.ml
@@ -106,16 +106,16 @@ let find_projection = function
let prim_table =
Summary.ref (Cmap_env.empty : Projection.Repr.t Cmap_env.t) ~name:"record-prim-projs"
-let load_prim i (_,p) =
- prim_table := Cmap_env.add (Projection.Repr.constant p) p !prim_table
+let load_prim i (_,(p,c)) =
+ prim_table := Cmap_env.add c p !prim_table
let cache_prim p = load_prim 1 p
-let subst_prim (subst,p) = subst_proj_repr subst p
+let subst_prim (subst,(p,c)) = subst_proj_repr subst p, subst_constant subst c
-let discharge_prim (_,p) = Some (Lib.discharge_proj_repr p)
+let discharge_prim (_,(p,c)) = Some (Lib.discharge_proj_repr p, c)
-let inPrim : Projection.Repr.t -> obj =
+let inPrim : (Projection.Repr.t * Constant.t) -> obj =
declare_object {
(default_object "PRIMPROJS") with
cache_function = cache_prim ;
@@ -124,7 +124,7 @@ let inPrim : Projection.Repr.t -> obj =
classify_function = (fun x -> Substitute x);
discharge_function = discharge_prim }
-let declare_primitive_projection p = Lib.add_anonymous_leaf (inPrim p)
+let declare_primitive_projection p c = Lib.add_anonymous_leaf (inPrim (p,c))
let is_primitive_projection c = Cmap_env.mem c !prim_table
diff --git a/pretyping/recordops.mli b/pretyping/recordops.mli
index 415b964168..3e43372b65 100644
--- a/pretyping/recordops.mli
+++ b/pretyping/recordops.mli
@@ -45,7 +45,7 @@ val find_projection_nparams : GlobRef.t -> int
val find_projection : GlobRef.t -> struc_typ
(** Sets up the mapping from constants to primitive projections *)
-val declare_primitive_projection : Projection.Repr.t -> unit
+val declare_primitive_projection : Projection.Repr.t -> Constant.t -> unit
val is_primitive_projection : Constant.t -> bool
diff --git a/pretyping/reductionops.ml b/pretyping/reductionops.ml
index 17003cd1dd..e632976ae5 100644
--- a/pretyping/reductionops.ml
+++ b/pretyping/reductionops.ml
@@ -675,10 +675,6 @@ let apply_subst recfun env sigma refold cst_l t stack =
let stacklam recfun env sigma t stack =
apply_subst (fun _ _ s -> recfun s) env sigma false Cst_stack.empty t stack
-let beta_app sigma (c,l) =
- let zip s = Stack.zip sigma s in
- stacklam zip [] sigma c (Stack.append_app l Stack.empty)
-
let beta_applist sigma (c,l) =
let zip s = Stack.zip sigma s in
stacklam zip [] sigma c (Stack.append_app_list l Stack.empty)
@@ -1305,13 +1301,13 @@ let test_trans_conversion (f: constr Reduction.extended_conversion_function) red
with Reduction.NotConvertible -> false
| e when is_anomaly e -> report_anomaly e
-let is_conv ?(reds=full_transparent_state) env sigma = test_trans_conversion f_conv reds env sigma
-let is_conv_leq ?(reds=full_transparent_state) env sigma = test_trans_conversion f_conv_leq reds env sigma
-let is_fconv ?(reds=full_transparent_state) = function
+let is_conv ?(reds=TransparentState.full) env sigma = test_trans_conversion f_conv reds env sigma
+let is_conv_leq ?(reds=TransparentState.full) env sigma = test_trans_conversion f_conv_leq reds env sigma
+let is_fconv ?(reds=TransparentState.full) = function
| Reduction.CONV -> is_conv ~reds
| Reduction.CUMUL -> is_conv_leq ~reds
-let check_conv ?(pb=Reduction.CUMUL) ?(ts=full_transparent_state) env sigma x y =
+let check_conv ?(pb=Reduction.CUMUL) ?(ts=TransparentState.full) env sigma x y =
let f = match pb with
| Reduction.CONV -> f_conv
| Reduction.CUMUL -> f_conv_leq
@@ -1345,7 +1341,7 @@ let sigma_univ_state =
compare_cumul_instances = sigma_check_inductive_instances; }
let infer_conv_gen conv_fun ?(catch_incon=true) ?(pb=Reduction.CUMUL)
- ?(ts=full_transparent_state) env sigma x y =
+ ?(ts=TransparentState.full) env sigma x y =
(** FIXME *)
try
let ans = match pb with
@@ -1378,7 +1374,7 @@ let infer_conv = infer_conv_gen (fun pb ~l2r sigma ->
Reduction.generic_conv pb ~l2r (safe_evar_value sigma))
(* This reference avoids always having to link C code with the kernel *)
-let vm_infer_conv = ref (infer_conv ~catch_incon:true ~ts:full_transparent_state)
+let vm_infer_conv = ref (infer_conv ~catch_incon:true ~ts:TransparentState.full)
let set_vm_infer_conv f = vm_infer_conv := f
let vm_infer_conv ?(pb=Reduction.CUMUL) env t1 t2 =
!vm_infer_conv ~pb env t1 t2
@@ -1681,25 +1677,6 @@ let meta_reducible_instance evd b =
if Metaset.is_empty fm then (* nf_betaiota? *) b.rebus
else irec b.rebus
-
-let head_unfold_under_prod ts env sigma c =
- let unfold (cst,u) =
- let cstu = (cst, EInstance.kind sigma u) in
- if Cpred.mem cst (snd ts) then
- match constant_opt_value_in env cstu with
- | Some c -> EConstr.of_constr c
- | None -> mkConstU (cst, u)
- else mkConstU (cst, u) in
- let rec aux c =
- match EConstr.kind sigma c with
- | Prod (n,t,c) -> mkProd (n,aux t, aux c)
- | _ ->
- let (h,l) = decompose_app_vect sigma c in
- match EConstr.kind sigma h with
- | Const cst -> beta_app sigma (unfold cst, l)
- | _ -> c in
- aux c
-
let betazetaevar_applist sigma n c l =
let rec stacklam n env t stack =
if Int.equal n 0 then applist (substl env t, stack) else
diff --git a/pretyping/reductionops.mli b/pretyping/reductionops.mli
index 41de779414..088e898a99 100644
--- a/pretyping/reductionops.mli
+++ b/pretyping/reductionops.mli
@@ -266,21 +266,21 @@ type conversion_test = Constraint.t -> Constraint.t
val pb_is_equal : conv_pb -> bool
val pb_equal : conv_pb -> conv_pb
-val is_conv : ?reds:transparent_state -> env -> evar_map -> constr -> constr -> bool
-val is_conv_leq : ?reds:transparent_state -> env -> evar_map -> constr -> constr -> bool
-val is_fconv : ?reds:transparent_state -> conv_pb -> env -> evar_map -> constr -> constr -> bool
+val is_conv : ?reds:TransparentState.t -> env -> evar_map -> constr -> constr -> bool
+val is_conv_leq : ?reds:TransparentState.t -> env -> evar_map -> constr -> constr -> bool
+val is_fconv : ?reds:TransparentState.t -> conv_pb -> env -> evar_map -> constr -> constr -> bool
(** [check_conv] Checks universe constraints only.
pb defaults to CUMUL and ts to a full transparent state.
*)
-val check_conv : ?pb:conv_pb -> ?ts:transparent_state -> env -> evar_map -> constr -> constr -> bool
+val check_conv : ?pb:conv_pb -> ?ts:TransparentState.t -> env -> evar_map -> constr -> constr -> bool
(** [infer_conv] Adds necessary universe constraints to the evar map.
pb defaults to CUMUL and ts to a full transparent state.
@raise UniverseInconsistency iff catch_incon is set to false,
otherwise returns false in that case.
*)
-val infer_conv : ?catch_incon:bool -> ?pb:conv_pb -> ?ts:transparent_state ->
+val infer_conv : ?catch_incon:bool -> ?pb:conv_pb -> ?ts:TransparentState.t ->
env -> evar_map -> constr -> constr -> evar_map option
(** Conversion with inference of universe constraints *)
@@ -292,9 +292,9 @@ val vm_infer_conv : ?pb:conv_pb -> env -> evar_map -> constr -> constr ->
(** [infer_conv_gen] behaves like [infer_conv] but is parametrized by a
conversion function. Used to pretype vm and native casts. *)
-val infer_conv_gen : (conv_pb -> l2r:bool -> evar_map -> transparent_state ->
+val infer_conv_gen : (conv_pb -> l2r:bool -> evar_map -> TransparentState.t ->
(Constr.constr, evar_map) Reduction.generic_conversion_function) ->
- ?catch_incon:bool -> ?pb:conv_pb -> ?ts:transparent_state -> env ->
+ ?catch_incon:bool -> ?pb:conv_pb -> ?ts:TransparentState.t -> env ->
evar_map -> constr -> constr -> evar_map option
(** {6 Special-Purpose Reduction Functions } *)
@@ -302,13 +302,12 @@ val infer_conv_gen : (conv_pb -> l2r:bool -> evar_map -> transparent_state ->
val whd_meta : local_reduction_function
val plain_instance : evar_map -> constr Metamap.t -> constr -> constr
val instance : evar_map -> constr Metamap.t -> constr -> constr
-val head_unfold_under_prod : transparent_state -> reduction_function
val betazetaevar_applist : evar_map -> int -> constr -> constr list -> constr
(** {6 Heuristic for Conversion with Evar } *)
val whd_betaiota_deltazeta_for_iota_state :
- transparent_state -> Environ.env -> Evd.evar_map -> Cst_stack.t -> state ->
+ TransparentState.t -> Environ.env -> Evd.evar_map -> Cst_stack.t -> state ->
state * Cst_stack.t
(** {6 Meta-related reduction functions } *)
diff --git a/pretyping/tacred.ml b/pretyping/tacred.ml
index 4ec8569dd8..d9df8c8cf8 100644
--- a/pretyping/tacred.ml
+++ b/pretyping/tacred.ml
@@ -638,7 +638,7 @@ let whd_nothing_for_iota env sigma s =
| Meta ev ->
(try whrec (Evd.meta_value sigma ev, stack)
with Not_found -> s)
- | Const (const, u) when is_transparent_constant full_transparent_state const ->
+ | Const (const, u) ->
let u = EInstance.kind sigma u in
(match constant_opt_value_in env (const, u) with
| Some body -> whrec (EConstr.of_constr body, stack)
diff --git a/pretyping/typeclasses.mli b/pretyping/typeclasses.mli
index ee9c83dad3..8bdac0a575 100644
--- a/pretyping/typeclasses.mli
+++ b/pretyping/typeclasses.mli
@@ -119,8 +119,8 @@ val resolve_one_typeclass : ?unique:bool -> env -> evar_map -> EConstr.types ->
val set_typeclass_transparency_hook : (evaluable_global_reference -> bool (*local?*) -> bool -> unit) Hook.t
val set_typeclass_transparency : evaluable_global_reference -> bool -> bool -> unit
-val classes_transparent_state_hook : (unit -> transparent_state) Hook.t
-val classes_transparent_state : unit -> transparent_state
+val classes_transparent_state_hook : (unit -> TransparentState.t) Hook.t
+val classes_transparent_state : unit -> TransparentState.t
val add_instance_hint_hook :
(global_reference_or_constr -> GlobRef.t list ->
diff --git a/pretyping/unification.ml b/pretyping/unification.ml
index e3b942b610..8c1aae26ae 100644
--- a/pretyping/unification.ml
+++ b/pretyping/unification.ml
@@ -149,7 +149,7 @@ let abstract_list_all_with_dependencies env evd typ c l =
let n = List.length l in
let argoccs = set_occurrences_of_last_arg (Array.sub (snd ev') 0 n) in
let evd,b =
- Evarconv.second_order_matching empty_transparent_state
+ Evarconv.second_order_matching TransparentState.empty
env evd ev' argoccs c in
if b then
let p = nf_evar evd ev in
@@ -247,7 +247,7 @@ let sort_eqns = unify_r2l
*)
type core_unify_flags = {
- modulo_conv_on_closed_terms : Names.transparent_state option;
+ modulo_conv_on_closed_terms : TransparentState.t option;
(* What this flag controls was activated with all constants transparent, *)
(* even for auto, since Coq V5.10 *)
@@ -257,11 +257,11 @@ type core_unify_flags = {
use_evars_eagerly_in_conv_on_closed_terms : bool;
- modulo_delta : Names.transparent_state;
+ modulo_delta : TransparentState.t;
(* This controls which constants are unfoldable; this is on for apply *)
(* (but not simple apply) since Feb 2008 for 8.2 *)
- modulo_delta_types : Names.transparent_state;
+ modulo_delta_types : TransparentState.t;
check_applied_meta_types : bool;
(* This controls whether meta's applied to arguments have their *)
@@ -322,7 +322,7 @@ type unify_flags = {
(* Default flag for unifying a type against a type (e.g. apply) *)
(* We set all conversion flags (no flag should be modified anymore) *)
let default_core_unify_flags () =
- let ts = Names.full_transparent_state in {
+ let ts = TransparentState.full in {
modulo_conv_on_closed_terms = Some ts;
use_metas_eagerly_in_conv_on_closed_terms = true;
use_evars_eagerly_in_conv_on_closed_terms = false;
@@ -344,14 +344,14 @@ let default_unify_flags () =
let flags = default_core_unify_flags () in {
core_unify_flags = flags;
merge_unify_flags = flags;
- subterm_unify_flags = { flags with modulo_delta = var_full_transparent_state };
+ subterm_unify_flags = { flags with modulo_delta = TransparentState.var_full };
allow_K_in_toplevel_higher_order_unification = false; (* Why not? *)
resolve_evars = false
}
let set_no_delta_core_flags flags = { flags with
modulo_conv_on_closed_terms = None;
- modulo_delta = empty_transparent_state;
+ modulo_delta = TransparentState.empty;
check_applied_meta_types = false;
use_pattern_unification = false;
use_meta_bound_pattern_unification = true;
@@ -370,7 +370,7 @@ let set_no_delta_flags flags = {
(* For the first phase of keyed unification, restrict
to conversion (including beta-iota) only on closed terms *)
let set_no_delta_open_core_flags flags = { flags with
- modulo_delta = empty_transparent_state;
+ modulo_delta = TransparentState.empty;
modulo_betaiota = false;
}
@@ -388,7 +388,7 @@ let set_no_delta_open_flags flags = {
(* We set only the flags available at the time the new "apply" extended *)
(* out of "simple apply" *)
let default_no_delta_core_unify_flags () = { (default_core_unify_flags ()) with
- modulo_delta = empty_transparent_state;
+ modulo_delta = TransparentState.empty;
check_applied_meta_types = false;
use_pattern_unification = false;
use_meta_bound_pattern_unification = true;
@@ -425,7 +425,7 @@ let elim_flags_evars sigma =
let flags = elim_core_flags sigma in {
core_unify_flags = flags;
merge_unify_flags = flags;
- subterm_unify_flags = { flags with modulo_delta = empty_transparent_state };
+ subterm_unify_flags = { flags with modulo_delta = TransparentState.empty };
allow_K_in_toplevel_higher_order_unification = true;
resolve_evars = false
}
@@ -433,7 +433,7 @@ let elim_flags_evars sigma =
let elim_flags () = elim_flags_evars Evd.empty
let elim_no_delta_core_flags () = { (elim_core_flags Evd.empty) with
- modulo_delta = empty_transparent_state;
+ modulo_delta = TransparentState.empty;
check_applied_meta_types = false;
use_pattern_unification = false;
modulo_betaiota = false;
@@ -504,16 +504,16 @@ let key_of env sigma b flags f =
if subterm_restriction b flags then None else
match EConstr.kind sigma f with
| Const (cst, u) when is_transparent env (ConstKey cst) &&
- (Cpred.mem cst (snd flags.modulo_delta)
+ (TransparentState.is_transparent_constant flags.modulo_delta cst
|| Recordops.is_primitive_projection cst) ->
let u = EInstance.kind sigma u in
Some (IsKey (ConstKey (cst, u)))
| Var id when is_transparent env (VarKey id) &&
- Id.Pred.mem id (fst flags.modulo_delta) ->
+ TransparentState.is_transparent_variable flags.modulo_delta id ->
Some (IsKey (VarKey id))
| Proj (p, c) when Projection.unfolded p
|| (is_transparent env (ConstKey (Projection.constant p)) &&
- (Cpred.mem (Projection.constant p) (snd flags.modulo_delta))) ->
+ (TransparentState.is_transparent_constant flags.modulo_delta (Projection.constant p))) ->
Some (IsProj (p, c))
| _ -> None
@@ -550,7 +550,7 @@ let oracle_order env cf1 cf2 =
let is_rigid_head sigma flags t =
match EConstr.kind sigma t with
- | Const (cst,u) -> not (Cpred.mem cst (snd flags.modulo_delta))
+ | Const (cst,u) -> not (TransparentState.is_transparent_constant flags.modulo_delta cst)
| Ind (i,u) -> true
| Construct _ -> true
| Fix _ | CoFix _ -> true
@@ -633,11 +633,11 @@ let rec is_neutral env sigma ts t =
| Const (c, u) ->
not (Environ.evaluable_constant c env) ||
not (is_transparent env (ConstKey c)) ||
- not (Cpred.mem c (snd ts))
+ not (TransparentState.is_transparent_constant ts c)
| Var id ->
not (Environ.evaluable_named id env) ||
not (is_transparent env (VarKey id)) ||
- not (Id.Pred.mem id (fst ts))
+ not (TransparentState.is_transparent_variable ts id)
| Rel n -> true
| Evar _ | Meta _ -> true
| Case (_, p, c, cl) -> is_neutral env sigma ts c
@@ -935,8 +935,8 @@ let rec unify_0_with_initial_metas (sigma,ms,es as subst : subst0) conv_at_top e
let ty1 = get_type_of curenv ~lax:true sigma c1 in
let ty2 = get_type_of curenv ~lax:true sigma c2 in
unify_0_with_initial_metas substn true curenv cv_pb
- { flags with modulo_conv_on_closed_terms = Some full_transparent_state;
- modulo_delta = full_transparent_state;
+ { flags with modulo_conv_on_closed_terms = Some TransparentState.full;
+ modulo_delta = TransparentState.full;
modulo_eta = true;
modulo_betaiota = true }
ty1 ty2
@@ -1120,10 +1120,10 @@ let rec unify_0_with_initial_metas (sigma,ms,es as subst : subst0) conv_at_top e
| Some sigma -> ans
| None ->
if (match flags.modulo_conv_on_closed_terms, flags.modulo_delta with
- | Some (cv_id, cv_k), (dl_id, dl_k) ->
- Id.Pred.subset dl_id cv_id && Cpred.subset dl_k cv_k
- | None,(dl_id, dl_k) ->
- Id.Pred.is_empty dl_id && Cpred.is_empty dl_k)
+ | Some cv, dl ->
+ let open TransparentState in
+ Id.Pred.subset dl.tr_var cv.tr_var && Cpred.subset dl.tr_cst cv.tr_cst
+ | None, dl -> TransparentState.is_empty dl)
then error_cannot_unify env sigma (m, n) else None
in
let a = match res with
@@ -1263,8 +1263,8 @@ let applyHead env evd n c =
let is_mimick_head sigma ts f =
match EConstr.kind sigma f with
- | Const (c,u) -> not (CClosure.is_transparent_constant ts c)
- | Var id -> not (CClosure.is_transparent_variable ts id)
+ | Const (c,u) -> not (TransparentState.is_transparent_constant ts c)
+ | Var id -> not (TransparentState.is_transparent_variable ts id)
| (Rel _|Construct _|Ind _) -> true
| _ -> false
@@ -1530,15 +1530,15 @@ let indirectly_dependent sigma c d decls =
List.exists (fun d' -> exists (fun c -> Termops.local_occur_var sigma (NamedDecl.get_id d') 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 = Pretyping.solve_remaining_evars flags env current_sigma ~initial:pending in
(sigma, nf_evar sigma c)
let default_matching_core_flags sigma =
- let ts = Names.full_transparent_state in {
- modulo_conv_on_closed_terms = Some empty_transparent_state;
+ let ts = TransparentState.full in {
+ modulo_conv_on_closed_terms = Some TransparentState.empty;
use_metas_eagerly_in_conv_on_closed_terms = false;
use_evars_eagerly_in_conv_on_closed_terms = false;
- modulo_delta = empty_transparent_state;
+ modulo_delta = TransparentState.empty;
modulo_delta_types = ts;
check_applied_meta_types = true;
use_pattern_unification = false;
@@ -1550,7 +1550,7 @@ let default_matching_core_flags sigma =
}
let default_matching_merge_flags sigma =
- let ts = Names.full_transparent_state in
+ let ts = TransparentState.full in
let flags = default_matching_core_flags sigma in {
flags with
modulo_conv_on_closed_terms = Some ts;
@@ -1580,7 +1580,7 @@ let make_pattern_test from_prefix_of_ind is_correct_type env sigma (pending,c) =
if from_prefix_of_ind then
let flags = default_matching_flags pending in
{ flags with core_unify_flags = { flags.core_unify_flags with
- modulo_conv_on_closed_terms = Some Names.full_transparent_state;
+ modulo_conv_on_closed_terms = Some TransparentState.full;
restrict_conv_on_strict_subterms = true } }
else default_matching_flags pending in
let n = Array.length (snd (decompose_app_vect sigma c)) in
diff --git a/pretyping/unification.mli b/pretyping/unification.mli
index e2e261ae7a..a45b8f1dd8 100644
--- a/pretyping/unification.mli
+++ b/pretyping/unification.mli
@@ -8,18 +8,17 @@
(* * (see LICENSE file for the text of the license) *)
(************************************************************************)
-open Names
open Constr
open EConstr
open Environ
open Evd
type core_unify_flags = {
- modulo_conv_on_closed_terms : Names.transparent_state option;
+ modulo_conv_on_closed_terms : TransparentState.t 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;
+ modulo_delta : TransparentState.t;
+ modulo_delta_types : TransparentState.t;
check_applied_meta_types : bool;
use_pattern_unification : bool;
use_meta_bound_pattern_unification : bool;
@@ -41,7 +40,7 @@ val default_core_unify_flags : unit -> core_unify_flags
val default_no_delta_core_unify_flags : unit -> core_unify_flags
val default_unify_flags : unit -> unify_flags
-val default_no_delta_unify_flags : transparent_state -> unify_flags
+val default_no_delta_unify_flags : TransparentState.t -> unify_flags
val elim_flags : unit -> unify_flags
val elim_no_delta_flags : unit -> unify_flags
diff --git a/printing/dune b/printing/dune
index 837ac48009..3392342165 100644
--- a/printing/dune
+++ b/printing/dune
@@ -2,6 +2,5 @@
(name printing)
(synopsis "Coq's Term Pretty Printing Library")
(public_name coq.printing)
- (flags :standard -open Gramlib)
(wrapped false)
(libraries parsing proofs))
diff --git a/printing/prettyp.ml b/printing/prettyp.ml
index e698ba9f8f..712eb21ee6 100644
--- a/printing/prettyp.ml
+++ b/printing/prettyp.ml
@@ -71,27 +71,26 @@ let int_or_no n = if Int.equal n 0 then str "no" else int n
let print_basename sp = pr_global (ConstRef sp)
let print_ref reduce ref udecl =
- let typ, univs = Typeops.type_of_global_in_context (Global.env ()) ref in
+ let env = Global.env () in
+ let typ, univs = Typeops.type_of_global_in_context env ref in
let inst = Univ.make_abstract_instance univs in
- let bl = UnivNames.universe_binders_with_opt_names ref udecl in
+ let bl = UnivNames.universe_binders_with_opt_names (Environ.universes_of_global env ref) udecl in
let sigma = Evd.from_ctx (UState.of_binders bl) in
let typ = EConstr.of_constr typ in
let typ =
if reduce then
- let env = Global.env () in
let ctx,ccl = Reductionops.splay_prod_assum env sigma typ
in EConstr.it_mkProd_or_LetIn ccl ctx
else typ in
let variance = match ref with
| VarRef _ | ConstRef _ -> None
| IndRef (ind,_) | ConstructRef ((ind,_),_) ->
- let mind = Environ.lookup_mind ind (Global.env ()) in
+ let mind = Environ.lookup_mind ind env in
begin match mind.Declarations.mind_universes with
| Declarations.Monomorphic_ind _ | Declarations.Polymorphic_ind _ -> None
| Declarations.Cumulative_ind cumi -> Some (Univ.ACumulativityInfo.variance cumi)
end
in
- let env = Global.env () in
let inst =
if Global.is_polymorphic ref
then Printer.pr_universe_instance sigma inst
@@ -571,7 +570,7 @@ let print_constant with_values sep sp udecl =
in
let ctx =
UState.of_binders
- (UnivNames.universe_binders_with_opt_names (ConstRef sp) udecl)
+ (UnivNames.universe_binders_with_opt_names (Declareops.constant_polymorphic_context cb) udecl)
in
let env = Global.env () and sigma = Evd.from_ctx ctx in
let pr_ltype = pr_ltype_env env sigma in
diff --git a/printing/printer.ml b/printing/printer.ml
index da364c8b9e..4840577cbf 100644
--- a/printing/printer.ml
+++ b/printing/printer.ml
@@ -244,8 +244,19 @@ let pr_abstract_cumulativity_info sigma cumi =
let pr_global_env = Nametab.pr_global_env
let pr_global = pr_global_env Id.Set.empty
+let pr_universe_instance_constraints evd inst csts =
+ let open Univ in
+ let prlev = Termops.pr_evd_level evd in
+ let pcsts = if Constraint.is_empty csts then mt()
+ else str " |= " ++
+ prlist_with_sep (fun () -> str "," ++ spc())
+ (fun (u,d,v) -> hov 0 (prlev u ++ pr_constraint_type d ++ prlev v))
+ (Constraint.elements csts)
+ in
+ str"@{" ++ Instance.pr prlev inst ++ pcsts ++ str"}"
+
let pr_universe_instance evd inst =
- str"@{" ++ Univ.Instance.pr (Termops.pr_evd_level evd) inst ++ str"}"
+ pr_universe_instance_constraints evd inst Univ.Constraint.empty
let pr_puniverses f env sigma (c,u) =
if !Constrextern.print_universes
@@ -445,9 +456,9 @@ let pr_predicate pr_elt (b, elts) =
let pr_cpred p = pr_predicate (pr_constant (Global.env())) (Cpred.elements p)
let pr_idpred p = pr_predicate Id.print (Id.Pred.elements p)
-let pr_transparent_state (ids, csts) =
- hv 0 (str"VARIABLES: " ++ pr_idpred ids ++ fnl () ++
- str"CONSTANTS: " ++ pr_cpred csts ++ fnl ())
+let pr_transparent_state ts =
+ hv 0 (str"VARIABLES: " ++ pr_idpred ts.TransparentState.tr_var ++ fnl () ++
+ str"CONSTANTS: " ++ pr_cpred ts.TransparentState.tr_cst ++ fnl ())
(* display complete goal
og_s has goal+sigma on the previous proof step for diffs
@@ -674,10 +685,6 @@ let pr_subgoals ?(pr_first=true) ?(diffs=false) ?os_map
| None -> GoalMap.empty
in
- let map_goal_for_diff ng = (* todo: move to proof_diffs.ml *)
- try GoalMap.find ng diff_goal_map with Not_found -> ng
- in
-
(** Printing functions for the extra informations. *)
let rec print_stack a = function
| [] -> Pp.int a
@@ -713,7 +720,12 @@ let pr_subgoals ?(pr_first=true) ?(diffs=false) ?os_map
let get_ogs g =
match os_map with
- | Some (osigma, _) -> Some { it = map_goal_for_diff g; sigma = osigma }
+ | Some (osigma, _) ->
+ (* if Not_found, returning None treats the goal as new and it will be highlighted;
+ returning Some { it = g; sigma = sigma } will compare the new goal
+ to itself and it won't be highlighted *)
+ (try Some { it = GoalMap.find g diff_goal_map; sigma = osigma }
+ with Not_found -> raise (Pp_diff.Diff_Failure "Unable to match goals between old and new proof states (7)"))
| None -> None
in
let rec pr_rec n = function
diff --git a/printing/printer.mli b/printing/printer.mli
index f9d1a62895..cefc005c74 100644
--- a/printing/printer.mli
+++ b/printing/printer.mli
@@ -13,7 +13,6 @@ open Constr
open Environ
open Pattern
open Evd
-open Proof_type
open Glob_term
open Ltac_pretype
@@ -85,6 +84,7 @@ val pr_sort : evar_map -> Sorts.t -> Pp.t
val pr_polymorphic : bool -> Pp.t
val pr_cumulative : bool -> bool -> Pp.t
val pr_universe_instance : evar_map -> Univ.Instance.t -> Pp.t
+val pr_universe_instance_constraints : evar_map -> Univ.Instance.t -> Univ.Constraint.t -> Pp.t
val pr_universe_ctx : evar_map -> ?variance:Univ.Variance.t array ->
Univ.UContext.t -> Pp.t
val pr_abstract_universe_ctx : evar_map -> ?variance:Univ.Variance.t array ->
@@ -134,7 +134,7 @@ val pr_context_of : env -> evar_map -> Pp.t
val pr_predicate : ('a -> Pp.t) -> (bool * 'a list) -> Pp.t
val pr_cpred : Cpred.t -> Pp.t
val pr_idpred : Id.Pred.t -> Pp.t
-val pr_transparent_state : transparent_state -> Pp.t
+val pr_transparent_state : TransparentState.t -> Pp.t
(** Proofs, these functions obey [Hyps Limit] and [Compact contexts]. *)
@@ -143,7 +143,7 @@ val pr_transparent_state : transparent_state -> Pp.t
records containing the goal and sigma for, respectively, the new and old proof steps,
e.g. [{ it = g ; sigma = sigma }].
*)
-val pr_goal : ?diffs:bool -> ?og_s:(goal sigma) -> goal sigma -> Pp.t
+val pr_goal : ?diffs:bool -> ?og_s:(Goal.goal sigma) -> Goal.goal sigma -> Pp.t
(** [pr_subgoals ~pr_first ~diffs ~os_map close_cmd sigma ~seeds ~shelf ~stack ~unfocused ~goals]
prints the goals in [goals] followed by the goals in [unfocused] in a compact form
@@ -160,17 +160,17 @@ val pr_goal : ?diffs:bool -> ?og_s:(goal sigma) -> goal sigma ->
there are non-instantiated existential variables. [stack] is used to print summary info on unfocused
goals.
*)
-val pr_subgoals : ?pr_first:bool -> ?diffs:bool -> ?os_map:(evar_map * Evar.t Evar.Map.t) -> Pp.t option -> evar_map
- -> seeds:goal list -> shelf:goal list -> stack:int list
- -> unfocused: goal list -> goals:goal list -> Pp.t
+val pr_subgoals : ?pr_first:bool -> ?diffs:bool -> ?os_map:(evar_map * Goal.goal Evar.Map.t) -> Pp.t option -> evar_map
+ -> seeds:Goal.goal list -> shelf:Goal.goal list -> stack:int list
+ -> unfocused:Goal.goal list -> goals:Goal.goal list -> Pp.t
-val pr_subgoal : int -> evar_map -> goal list -> Pp.t
+val pr_subgoal : int -> evar_map -> Goal.goal list -> Pp.t
(** [pr_concl n ~diffs ~og_s sigma g] prints the conclusion of the goal [g] using [sigma]. The output
is labelled "subgoal [n]". If [diffs] is true, highlight the differences between the old conclusion,
[og_s], and [g]+[sigma]. [og_s] is a record containing the old goal and sigma, e.g. [{ it = g ; sigma = sigma }].
*)
-val pr_concl : int -> ?diffs:bool -> ?og_s:(goal sigma) -> evar_map -> goal -> Pp.t
+val pr_concl : int -> ?diffs:bool -> ?og_s:(Goal.goal sigma) -> evar_map -> Goal.goal -> Pp.t
(** [pr_open_subgoals_diff ~quiet ~diffs ~oproof proof] shows the context for [proof] as used by, for example, coqtop.
The first active goal is printed with all its antecedents and the conclusion. The other active goals only show their
@@ -181,7 +181,7 @@ val pr_open_subgoals_diff : ?quiet:bool -> ?diffs:bool -> ?oproof:Proof.t -> Pr
val pr_open_subgoals : proof:Proof.t -> Pp.t
val pr_nth_open_subgoal : proof:Proof.t -> int -> Pp.t
val pr_evar : evar_map -> (Evar.t * evar_info) -> Pp.t
-val pr_evars_int : evar_map -> shelf:goal list -> givenup:goal list -> int -> evar_info Evar.Map.t -> Pp.t
+val pr_evars_int : evar_map -> shelf:Goal.goal list -> givenup:Goal.goal list -> int -> evar_info Evar.Map.t -> Pp.t
val pr_evars : evar_map -> evar_info Evar.Map.t -> Pp.t
val pr_ne_evar_set : Pp.t -> Pp.t -> evar_map ->
Evar.Set.t -> Pp.t
diff --git a/printing/printmod.ml b/printing/printmod.ml
index cc40c74998..2c3ab46670 100644
--- a/printing/printmod.ml
+++ b/printing/printmod.ml
@@ -119,7 +119,9 @@ let print_mutual_inductive env mind mib udecl =
| BiFinite -> "Variant"
| CoFinite -> "CoInductive"
in
- let bl = UnivNames.universe_binders_with_opt_names (IndRef (mind, 0)) udecl in
+ let bl = UnivNames.universe_binders_with_opt_names
+ (Declareops.inductive_polymorphic_context mib) udecl
+ in
let sigma = Evd.from_ctx (UState.of_binders bl) in
hov 0 (Printer.pr_polymorphic (Declareops.inductive_is_polymorphic mib) ++
Printer.pr_cumulative
@@ -157,7 +159,9 @@ let print_record env mind mib udecl =
let cstrtype = hnf_prod_applist_assum env nparamdecls cstrtypes.(0) args in
let fields = get_fields cstrtype in
let envpar = push_rel_context params env in
- let bl = UnivNames.universe_binders_with_opt_names (IndRef (mind,0)) udecl in
+ let bl = UnivNames.universe_binders_with_opt_names (Declareops.inductive_polymorphic_context mib)
+ udecl
+ in
let sigma = Evd.from_ctx (UState.of_binders bl) in
let keyword =
let open Declarations in
@@ -296,7 +300,7 @@ let print_body is_impl extent env mp (l,body) =
(match extent with
| OnlyNames -> mt ()
| WithContents ->
- let bl = UnivNames.universe_binders_with_opt_names (ConstRef (Constant.make2 mp l)) None in
+ let bl = UnivNames.universe_binders_with_opt_names ctx None in
let sigma = Evd.from_ctx (UState.of_binders bl) in
str " :" ++ spc () ++
hov 0 (Printer.pr_ltype_env env sigma cb.const_type) ++
diff --git a/printing/proof_diffs.ml b/printing/proof_diffs.ml
index 0b630b39b5..cc1bcc66ae 100644
--- a/printing/proof_diffs.ml
+++ b/printing/proof_diffs.ml
@@ -88,7 +88,7 @@ let tokenize_string s =
let st = CLexer.get_lexer_state () in
try
let istr = Stream.of_string s in
- let lex = CLexer.lexer.Plexing.tok_func istr in
+ let lex = CLexer.lexer.Gramlib.Plexing.tok_func istr in
let toks = stream_tok [] (fst lex) in
CLexer.set_lexer_state st;
toks
@@ -214,26 +214,22 @@ module CDC = Context.Compacted.Declaration
let to_tuple : Constr.compacted_declaration -> (Names.Id.t list * 'pc option * 'pc) =
let open CDC in function
- | LocalAssum(idl, tm) -> (idl, None, tm)
- | LocalDef(idl,tdef,tm) -> (idl, Some tdef, tm);;
+ | LocalAssum(idl, tm) -> (idl, None, EConstr.of_constr tm)
+ | LocalDef(idl,tdef,tm) -> (idl, Some (EConstr.of_constr tdef), EConstr.of_constr tm);;
(* XXX: Very unfortunately we cannot use the Proofview interface as
Proof is still using the "legacy" one. *)
-let process_goal_concl sigma g : Constr.t * Environ.env =
+let process_goal_concl sigma g : EConstr.t * Environ.env =
let env = Goal.V82.env sigma g in
let ty = Goal.V82.concl sigma g in
- let ty = EConstr.to_constr sigma ty in
(ty, env)
-let process_goal sigma g : Constr.t reified_goal =
+let process_goal sigma g : EConstr.t reified_goal =
let env = Goal.V82.env sigma g in
- let hyps = Goal.V82.hyps sigma g in
let ty = Goal.V82.concl sigma g in
let name = Goal.uid g in
- (* There is a Constr/Econstr mess here... *)
- let ty = EConstr.to_constr sigma ty in
(* compaction is usually desired [eg for better display] *)
- let hyps = Termops.compact_named_context (Environ.named_context_of_val hyps) in
+ let hyps = Termops.compact_named_context (Environ.named_context env) in
let hyps = List.map to_tuple hyps in
{ name; ty; hyps; env; sigma };;
@@ -241,13 +237,15 @@ let pr_letype_core goal_concl_style env sigma t =
Ppconstr.pr_lconstr_expr (Constrextern.extern_type goal_concl_style env sigma t)
let pp_of_type env sigma ty =
- pr_letype_core true env sigma EConstr.(of_constr ty)
+ pr_letype_core true env sigma ty
let pr_leconstr_core goal_concl_style env sigma t =
Ppconstr.pr_lconstr_expr (Constrextern.extern_constr goal_concl_style env sigma t)
let pr_lconstr_env env sigma c = pr_leconstr_core false env sigma (EConstr.of_constr c)
+let pr_lconstr_env_econstr env sigma c = pr_leconstr_core false env sigma c
+
let diff_concl ?og_s nsigma ng =
let open Evd in
let o_concl_pp = match og_s with
@@ -291,8 +289,8 @@ let goal_info goal sigma =
line_idents := idents :: !line_idents;
let mid = match body with
| Some c ->
- let pb = pr_lconstr_env env sigma c in
- let pb = if Constr.isCast c then surround pb else pb in
+ let pb = pr_lconstr_env_econstr env sigma c in
+ let pb = if EConstr.isCast sigma c then surround pb else pb in
str " := " ++ pb
| None -> mt() in
let ts = pp_of_type env sigma ty in
@@ -409,7 +407,7 @@ let match_goals ot nt =
match exp, exp2 with
| Some expa, Some expb -> constr_expr ogname expa expb
| None, None -> ()
- | _, _ -> raise (Diff_Failure "Unable to match goals betwen old and new proof states (1)")
+ | _, _ -> raise (Diff_Failure "Unable to match goals between old and new proof states (1)")
in
let local_binder_expr ogname exp exp2 =
match exp, exp2 with
@@ -421,7 +419,7 @@ let match_goals ot nt =
| CLocalPattern p, CLocalPattern p2 ->
let (p,ty), (p2,ty2) = p.v,p2.v in
constr_expr_opt ogname ty ty2
- | _, _ -> raise (Diff_Failure "Unable to match goals betwen old and new proof states (2)")
+ | _, _ -> raise (Diff_Failure "Unable to match goals between old and new proof states (2)")
in
let recursion_order_expr ogname exp exp2 =
match exp, exp2 with
@@ -431,7 +429,7 @@ let match_goals ot nt =
| CMeasureRec (m,r), CMeasureRec (m2,r2) ->
constr_expr ogname m m2;
constr_expr_opt ogname r r2
- | _, _ -> raise (Diff_Failure "Unable to match goals betwen old and new proof states (3)")
+ | _, _ -> raise (Diff_Failure "Unable to match goals between old and new proof states (3)")
in
let fix_expr ogname exp exp2 =
let (l,(lo,ro),lb,ce1,ce2), (l2,(lo2,ro2),lb2,ce12,ce22) = exp,exp2 in
@@ -515,7 +513,7 @@ let match_goals ot nt =
| CastNative a, CastNative a2 ->
constr_expr ogname a a2
| CastCoerce, CastCoerce -> ()
- | _, _ -> raise (Diff_Failure "Unable to match goals betwen old and new proof states (4)"))
+ | _, _ -> raise (Diff_Failure "Unable to match goals between old and new proof states (4)"))
| CNotation (ntn,args), CNotation (ntn2,args2) ->
constr_notation_substitution ogname args args2
| CGeneralization (b,a,c), CGeneralization (b2,a2,c2) ->
@@ -523,7 +521,7 @@ let match_goals ot nt =
| CPrim p, CPrim p2 -> ()
| CDelimiters (key,e), CDelimiters (key2,e2) ->
constr_expr ogname e e2
- | _, _ -> raise (Diff_Failure "Unable to match goals betwen old and new proof states (5)")
+ | _, _ -> raise (Diff_Failure "Unable to match goals between old and new proof states (5)")
end
in
@@ -563,9 +561,8 @@ let db_goal_map op np ng_to_og =
Printf.printf "\n"
[@@@ocaml.warning "+32"]
-(* Create a map from new goals to old goals for proof diff. The map only
- has entries for new goals that are not the same as the corresponding old
- goal; there are no entries for unchanged goals.
+(* Create a map from new goals to old goals for proof diff. New goals
+ that are evars not appearing in the proof will not have a mapping.
It proceeds as follows:
1. Find the goal ids that were removed from the old proof and that were
@@ -583,7 +580,7 @@ let db_goal_map op np ng_to_og =
the removed goal.
- if there are more than 2 removals and more than one addition, call
match_goals to get a map between old and new evar names, then use this
- to create the map from new goal ids to old goal ids for the differing goals.
+ to create the map from new goal ids to old goal ids.
*)
let make_goal_map_i op np =
let ng_to_og = ref GoalMap.empty in
@@ -598,6 +595,9 @@ let make_goal_map_i op np =
let add_gs = diff ngs ogs in
let num_adds = cardinal add_gs in
+ (* add common goals *)
+ Goal.Set.iter (fun x -> ng_to_og := GoalMap.add x x !ng_to_og) (inter ogs ngs);
+
if num_rems = 0 then
!ng_to_og (* proofs are the same *)
else if num_adds = 0 then
@@ -616,17 +616,16 @@ let make_goal_map_i op np =
List.iter (fun og -> oevar_to_og := StringMap.add (goal_to_evar og osigma) og !oevar_to_og)
(Goal.Set.elements rem_gs);
- try
- let (_,_,_,_,nsigma) = Proof.proof np in
- let get_og ng =
- let nevar = goal_to_evar ng nsigma in
- let oevar = StringMap.find nevar nevar_to_oevar in
- let og = StringMap.find oevar !oevar_to_og in
- og
- in
- Goal.Set.iter (fun ng -> ng_to_og := GoalMap.add ng (get_og ng) !ng_to_og) add_gs;
- !ng_to_og
- with Not_found -> raise (Diff_Failure "Unable to match goals betwen old and new proof states (6)")
+ let (_,_,_,_,nsigma) = Proof.proof np in
+ let get_og ng =
+ let nevar = goal_to_evar ng nsigma in
+ let oevar = StringMap.find nevar nevar_to_oevar in
+ let og = StringMap.find oevar !oevar_to_og in
+ og
+ in
+ Goal.Set.iter (fun ng ->
+ try ng_to_og := GoalMap.add ng (get_og ng) !ng_to_og with Not_found -> ()) add_gs;
+ !ng_to_og
end
let make_goal_map op np =
diff --git a/printing/proof_diffs.mli b/printing/proof_diffs.mli
index 832393e15f..ce9ee5ae6f 100644
--- a/printing/proof_diffs.mli
+++ b/printing/proof_diffs.mli
@@ -16,7 +16,6 @@ val write_diffs_option : string -> unit
val show_diffs : unit -> bool
open Evd
-open Proof_type
open Environ
open Constr
@@ -31,7 +30,7 @@ If you want to make your call especially bulletproof, catch these
exceptions, print a user-visible message, then recall this routine with
the first argument set to None, which will skip the diff.
*)
-val diff_goal_ide : goal sigma option -> goal -> Evd.evar_map -> Pp.t list * Pp.t
+val diff_goal_ide : Goal.goal sigma option -> Goal.goal -> Evd.evar_map -> Pp.t list * Pp.t
(** Computes the diff between two goals
@@ -43,7 +42,7 @@ If you want to make your call especially bulletproof, catch these
exceptions, print a user-visible message, then recall this routine with
the first argument set to None, which will skip the diff.
*)
-val diff_goal : ?og_s:(goal sigma) -> goal -> Evd.evar_map -> Pp.t
+val diff_goal : ?og_s:(Goal.goal sigma) -> Goal.goal -> Evd.evar_map -> Pp.t
(** Convert a string to a list of token strings using the lexer *)
val tokenize_string : string -> string list
@@ -53,7 +52,7 @@ val pr_leconstr_core : bool -> Environ.env -> Evd.evar_map -> EConstr.cons
val pr_lconstr_env : env -> evar_map -> constr -> Pp.t
(** Computes diffs for a single conclusion *)
-val diff_concl : ?og_s:goal sigma -> Evd.evar_map -> Goal.goal -> Pp.t
+val diff_concl : ?og_s:Goal.goal sigma -> Evd.evar_map -> Goal.goal -> Pp.t
(** Generates a map from [np] to [op] that maps changed goals to their prior
forms. The map doesn't include entries for unchanged goals; unchanged goals
@@ -61,7 +60,7 @@ will have the same goal id in both versions.
[op] and [np] must be from the same proof document and [op] must be for a state
before [np]. *)
-val make_goal_map : Proof.t option -> Proof.t -> Evar.t Evar.Map.t
+val make_goal_map : Proof.t option -> Proof.t -> Goal.goal Evar.Map.t
(* Exposed for unit test, don't use these otherwise *)
(* output channel for the test log file *)
diff --git a/proofs/clenvtac.ml b/proofs/clenvtac.ml
index b99cf245fe..4720328893 100644
--- a/proofs/clenvtac.ml
+++ b/proofs/clenvtac.ml
@@ -9,7 +9,6 @@
(************************************************************************)
open Util
-open Names
open Constr
open Termops
open Evd
@@ -17,7 +16,6 @@ open EConstr
open Refiner
open Logic
open Reduction
-open Tacmach
open Clenv
(* This function put casts around metavariables whose type could not be
@@ -80,7 +78,7 @@ let clenv_refine ?(with_evars=false) ?(with_classes=true) clenv =
let clenv = { clenv with evd = evd' } in
tclTHEN
(tclEVARS (Evd.clear_metas evd'))
- (refine_no_check (clenv_cast_meta clenv (clenv_value clenv))) gl
+ (refiner ~check:false EConstr.Unsafe.(to_constr (clenv_cast_meta clenv (clenv_value clenv)))) gl
end
let clenv_pose_dependent_evars ?(with_evars=false) clenv =
@@ -102,11 +100,11 @@ let res_pf ?with_evars ?(with_classes=true) ?(flags=dft ()) clenv =
provenant de w_Unify. (Utilisé seulement dans prolog.ml) *)
let fail_quick_core_unif_flags = {
- modulo_conv_on_closed_terms = Some full_transparent_state;
+ modulo_conv_on_closed_terms = Some TransparentState.full;
use_metas_eagerly_in_conv_on_closed_terms = false;
use_evars_eagerly_in_conv_on_closed_terms = false;
- modulo_delta = empty_transparent_state;
- modulo_delta_types = full_transparent_state;
+ modulo_delta = TransparentState.empty;
+ modulo_delta_types = TransparentState.full;
check_applied_meta_types = false;
use_pattern_unification = false;
use_meta_bound_pattern_unification = true; (* ? *)
diff --git a/proofs/evar_refiner.ml b/proofs/evar_refiner.ml
index c80f370fdc..6c4193c66b 100644
--- a/proofs/evar_refiner.ml
+++ b/proofs/evar_refiner.ml
@@ -10,7 +10,6 @@
open CErrors
open Util
-open Names
open Evd
open Evarutil
open Evarsolve
@@ -38,7 +37,7 @@ let define_and_solve_constraints evk c env evd =
match
List.fold_left
(fun p (pbty,env,t1,t2) -> match p with
- | Success evd -> Evarconv.evar_conv_x full_transparent_state env evd pbty t1 t2
+ | Success evd -> Evarconv.evar_conv_x TransparentState.full env evd pbty t1 t2
| UnifFailure _ as x -> x) (Success evd)
pbs
with
@@ -53,7 +52,6 @@ let w_refine (evk,evi) (ltac_var,rawc) sigma =
let flags = {
Pretyping.use_typeclasses = true;
Pretyping.solve_unification_constraints = true;
- Pretyping.use_hook = None;
Pretyping.fail_evar = false;
Pretyping.expand_evars = true } in
try Pretyping.understand_ltac flags
diff --git a/proofs/logic.ml b/proofs/logic.ml
index 4d5711c195..15ba0a704f 100644
--- a/proofs/logic.ml
+++ b/proofs/logic.ml
@@ -20,7 +20,6 @@ open Environ
open Reductionops
open Inductiveops
open Typing
-open Proof_type
open Type_errors
open Retyping
@@ -62,6 +61,8 @@ let is_unification_error = function
let catchable_exception = function
| CErrors.UserError _ | TypeError _
+ | Proof.OpenProof _
+ (* abstract will call close_proof inside a tactic *)
| Notation.NumeralNotationError _
| RefinerError _ | Indrec.RecursionSchemeError _
| Nametab.GlobalizationError _
@@ -583,12 +584,15 @@ let convert_hyp check sign sigma d =
let prim_refiner r sigma goal =
let env = Goal.V82.env sigma goal in
let cl = Goal.V82.concl sigma goal in
- match r with
- (* Logical rules *)
- | Refine c ->
- let cl = EConstr.Unsafe.to_constr cl in
- check_meta_variables env sigma c;
- let (sgl,cl',sigma,oterm) = mk_refgoals sigma goal [] cl c in
- let sgl = List.rev sgl in
- let sigma = Goal.V82.partial_solution env sigma goal (EConstr.of_constr oterm) in
- (sgl, sigma)
+ let cl = EConstr.Unsafe.to_constr cl in
+ check_meta_variables env sigma r;
+ let (sgl,cl',sigma,oterm) = mk_refgoals sigma goal [] cl r in
+ let sgl = List.rev sgl in
+ let sigma = Goal.V82.partial_solution env sigma goal (EConstr.of_constr oterm) in
+ (sgl, sigma)
+
+let prim_refiner ~check r sigma goal =
+ if check then
+ with_check (prim_refiner r sigma) goal
+ else
+ prim_refiner r sigma goal
diff --git a/proofs/logic.mli b/proofs/logic.mli
index 2cad278e10..f99076db23 100644
--- a/proofs/logic.mli
+++ b/proofs/logic.mli
@@ -13,27 +13,20 @@
open Names
open Constr
open Evd
-open Proof_type
-(** This suppresses check done in [prim_refiner] for the tactic given in
- argument; works by side-effect *)
-
-val with_check : tactic -> tactic
-
-(** [without_check] respectively means:\\
- [Intro]: no check that the name does not exist\\
- [Intro_after]: no check that the name does not exist and that variables in
+(** [check] respectively means:\\
+ [Intro]: check that the name does not exist\\
+ [Intro_after]: check that the name does not exist and that variables in
its type does not escape their scope\\
- [Intro_replacing]: no check that the name does not exist and that
+ [Intro_replacing]: check that the name does not exist and that
variables in its type does not escape their scope\\
[Convert_hyp]:
- no check that the name exist and that its type is convertible\\
+ check that the name exist and that its type is convertible\\
*)
(** The primitive refiner. *)
-val prim_refiner : prim_rule -> evar_map -> goal -> goal list * evar_map
-
+val prim_refiner : check:bool -> constr -> evar_map -> Goal.goal -> Goal.goal list * evar_map
(** {6 Refiner errors. } *)
diff --git a/proofs/pfedit.ml b/proofs/pfedit.ml
index e6507332b1..81122e6858 100644
--- a/proofs/pfedit.ml
+++ b/proofs/pfedit.ml
@@ -26,25 +26,6 @@ let _ = Goptions.declare_bool_option {
let use_unification_heuristics () = !use_unification_heuristics_ref
-let start_proof (id : Id.t) ?pl str sigma hyps c ?init_tac terminator =
- let goals = [ (Global.env_of_context hyps , c) ] in
- Proof_global.start_proof sigma id ?pl str goals terminator;
- let env = Global.env () in
- ignore (Proof_global.with_current_proof (fun _ p ->
- match init_tac with
- | None -> p,(true,[])
- | Some tac -> Proof.run_tactic env tac p))
-
-let cook_this_proof p =
- match p with
- | { Proof_global.id;entries=[constr];persistence;universes } ->
- (id,(constr,universes,persistence))
- | _ -> CErrors.anomaly ~label:"Pfedit.cook_proof" (Pp.str "more than one proof term.")
-
-let cook_proof () =
- cook_this_proof (fst
- (Proof_global.close_proof ~keep_body_ucst_separate:false (fun x -> x)))
-
exception NoSuchGoal
let _ = CErrors.register_handler begin function
| NoSuchGoal -> CErrors.user_err Pp.(str "No such goal.")
@@ -152,13 +133,19 @@ let next = let n = ref 0 in fun () -> incr n; !n
let build_constant_by_tactic id ctx sign ?(goal_kind = Global, false, Proof Theorem) typ tac =
let evd = Evd.from_ctx ctx in
let terminator = Proof_global.make_terminator (fun _ -> ()) in
- start_proof id goal_kind evd sign typ terminator;
+ let goals = [ (Global.env_of_context sign , typ) ] in
+ Proof_global.start_proof evd id goal_kind goals terminator;
try
let status = by tac in
- let _,(const,univs,_) = cook_proof () in
- Proof_global.discard_current ();
- let univs = UState.demote_seff_univs const univs in
- const, status, univs
+ let open Proof_global in
+ let { entries; universes } = fst @@ close_proof ~keep_body_ucst_separate:false (fun x -> x) in
+ match entries with
+ | [entry] ->
+ discard_current ();
+ let univs = UState.demote_seff_univs entry universes in
+ entry, status, univs
+ | _ ->
+ CErrors.anomaly Pp.(str "[build_constant_by_tactic] close_proof returned more than one proof term")
with reraise ->
let reraise = CErrors.push reraise in
Proof_global.discard_current ();
@@ -227,36 +214,3 @@ let refine_by_tactic env sigma ty tac =
this hack will work in most cases. *)
let ans = Safe_typing.inline_private_constants_in_constr env ans neff in
ans, sigma
-
-(**********************************************************************)
-(* Support for resolution of evars in tactic interpretation, including
- resolution by application of tactics *)
-
-let implicit_tactic = Summary.ref None ~name:"implicit-tactic"
-
-let declare_implicit_tactic tac = implicit_tactic := Some tac
-
-let clear_implicit_tactic () = implicit_tactic := None
-
-let apply_implicit_tactic tac = (); fun env sigma evk ->
- let evi = Evd.find_undefined sigma evk in
- match snd (evar_source evk sigma) with
- | (Evar_kinds.ImplicitArg _ | Evar_kinds.QuestionMark _)
- when
- Context.Named.equal Constr.equal (Environ.named_context_of_val evi.evar_hyps)
- (Environ.named_context env) ->
- let tac = Proofview.tclTHEN tac (Proofview.tclEXTEND [] (Proofview.tclZERO (CErrors.UserError (None,Pp.str"Proof is not complete."))) []) in
- (try
- let c = Evarutil.nf_evars_universes sigma (EConstr.Unsafe.to_constr evi.evar_concl) in
- let c = EConstr.of_constr c in
- if Evarutil.has_undefined_evars sigma c then raise Exit;
- let (ans, _, ctx) =
- build_by_tactic env (Evd.evar_universe_context sigma) c tac in
- let sigma = Evd.set_universe_context sigma ctx in
- sigma, EConstr.of_constr ans
- with e when Logic.catchable_exception e -> raise Exit)
- | _ -> raise Exit
-
-let solve_by_implicit_tactic () = match !implicit_tactic with
-| None -> None
-| Some tac -> Some (apply_implicit_tactic tac)
diff --git a/proofs/pfedit.mli b/proofs/pfedit.mli
index 5feb5bd645..155221947a 100644
--- a/proofs/pfedit.mli
+++ b/proofs/pfedit.mli
@@ -16,34 +16,6 @@ open Environ
open Decl_kinds
(** {6 ... } *)
-(** [start_proof s str env t hook tac] starts a proof of name [s] and
- conclusion [t]; [hook] is optionally a function to be applied at
- proof end (e.g. to declare the built constructions as a coercion
- or a setoid morphism); init_tac is possibly a tactic to
- systematically apply at initialization time (e.g. to start the
- proof of mutually dependent theorems) *)
-
-val start_proof :
- Id.t -> ?pl:UState.universe_decl -> goal_kind -> Evd.evar_map -> named_context_val -> EConstr.constr ->
- ?init_tac:unit Proofview.tactic ->
- Proof_global.proof_terminator -> unit
-
-(** {6 ... } *)
-(** [cook_proof opacity] turns the current proof (assumed completed) into
- a constant with its name, kind and possible hook (see [start_proof]);
- it fails if there is no current proof of if it is not completed;
- it also tells if the guardness condition has to be inferred. *)
-
-val cook_this_proof :
- Proof_global.proof_object ->
- (Id.t *
- (Safe_typing.private_constants Entries.definition_entry * UState.t * goal_kind))
-
-val cook_proof : unit ->
- (Id.t *
- (Safe_typing.private_constants Entries.definition_entry * UState.t * goal_kind))
-
-(** {6 ... } *)
(** [get_goal_context n] returns the context of the [n]th subgoal of
the current focused proof or raises a [UserError] if there is no
focused proof or if there is no more subgoals *)
@@ -116,13 +88,3 @@ val refine_by_tactic : env -> Evd.evar_map -> EConstr.types -> unit Proofview.ta
evars solved by side-effects are NOT purged, so that unexpected failures may
occur. Ideally all code using this function should be rewritten in the
monad. *)
-
-(** Declare the default tactic to fill implicit arguments *)
-
-val declare_implicit_tactic : unit Proofview.tactic -> unit
-
-(** To remove the default tactic *)
-val clear_implicit_tactic : unit -> unit
-
-(* Raise Exit if cannot solve *)
-val solve_by_implicit_tactic : unit -> Pretyping.inference_hook option
diff --git a/proofs/proof.ml b/proofs/proof.ml
index 8220949856..6c13c4946a 100644
--- a/proofs/proof.ml
+++ b/proofs/proof.ml
@@ -335,28 +335,42 @@ let dependent_start goals =
let number_of_goals = List.length (Proofview.initial_goals pr.entry) in
_focus end_of_stack (Obj.repr ()) 1 number_of_goals pr
-exception UnfinishedProof
-exception HasShelvedGoals
-exception HasGivenUpGoals
-exception HasUnresolvedEvar
+type open_error_reason =
+ | UnfinishedProof
+ | HasShelvedGoals
+ | HasGivenUpGoals
+ | HasUnresolvedEvar
+
+let print_open_error_reason er = let open Pp in match er with
+ | UnfinishedProof ->
+ str "Attempt to save an incomplete proof"
+ | HasShelvedGoals ->
+ str "Attempt to save a proof with shelved goals"
+ | HasGivenUpGoals ->
+ strbrk "Attempt to save a proof with given up goals. If this is really what you want to do, use Admitted in place of Qed."
+ | HasUnresolvedEvar ->
+ strbrk "Attempt to save a proof with existential variables still non-instantiated"
+
+exception OpenProof of Names.Id.t option * open_error_reason
+
let _ = CErrors.register_handler begin function
- | UnfinishedProof -> CErrors.user_err Pp.(str "Some goals have not been solved.")
- | HasShelvedGoals -> CErrors.user_err Pp.(str "Some goals have been left on the shelf.")
- | HasGivenUpGoals -> CErrors.user_err Pp.(str "Some goals have been given up.")
- | HasUnresolvedEvar -> CErrors.user_err Pp.(str "Some existential variables are uninstantiated.")
- | _ -> raise CErrors.Unhandled
-end
+ | OpenProof (pid, reason) ->
+ let open Pp in
+ Option.cata (fun pid ->
+ str " (in proof " ++ Names.Id.print pid ++ str "): ") (mt()) pid ++ print_open_error_reason reason
+ | _ -> raise CErrors.Unhandled
+ end
-let return p =
+let return ?pid (p : t) =
if not (is_done p) then
- raise UnfinishedProof
+ raise (OpenProof(pid, UnfinishedProof))
else if has_shelved_goals p then
- raise HasShelvedGoals
+ raise (OpenProof(pid, HasShelvedGoals))
else if has_given_up_goals p then
- raise HasGivenUpGoals
+ raise (OpenProof(pid, HasGivenUpGoals))
else if has_unresolved_evar p then
(* spiwack: for compatibility with <= 8.3 proof engine *)
- raise HasUnresolvedEvar
+ raise (OpenProof(pid, HasUnresolvedEvar))
else
let p = unfocus end_of_stack_kind p () in
Proofview.return p.proofview
@@ -449,11 +463,10 @@ module V82 = struct
let grab_evars p =
if not (is_done p) then
- raise UnfinishedProof
+ raise (OpenProof(None, UnfinishedProof))
else
{ p with proofview = Proofview.V82.grab p.proofview }
-
(* Main component of vernac command Existential *)
let instantiate_evar n com pr =
let tac =
@@ -491,4 +504,6 @@ let all_goals p =
let set = add goals Goal.Set.empty in
let set = List.fold_left (fun s gs -> let (g1, g2) = gs in add g1 (add g2 set)) set stack in
let set = add shelf set in
- add given_up set
+ let set = add given_up set in
+ let { Evd.it = bgoals ; sigma = bsigma } = V82.background_subgoals p in
+ add bgoals set
diff --git a/proofs/proof.mli b/proofs/proof.mli
index 8cf543557b..aaabea3454 100644
--- a/proofs/proof.mli
+++ b/proofs/proof.mli
@@ -89,11 +89,15 @@ val compact : t -> t
Raises [HasShelvedGoals] if some goals are left on the shelf.
Raises [HasGivenUpGoals] if some goals have been given up.
Raises [HasUnresolvedEvar] if some evars have been left undefined. *)
-exception UnfinishedProof
-exception HasShelvedGoals
-exception HasGivenUpGoals
-exception HasUnresolvedEvar
-val return : t -> Evd.evar_map
+type open_error_reason =
+ | UnfinishedProof
+ | HasShelvedGoals
+ | HasGivenUpGoals
+ | HasUnresolvedEvar
+
+exception OpenProof of Names.Id.t option * open_error_reason
+
+val return : ?pid:Names.Id.t -> t -> Evd.evar_map
(*** Focusing actions ***)
diff --git a/proofs/proof_global.ml b/proofs/proof_global.ml
index 25cf789193..cb4b5759dc 100644
--- a/proofs/proof_global.ml
+++ b/proofs/proof_global.ml
@@ -176,7 +176,6 @@ let simple_with_current_proof f = with_current_proof (fun t p -> f t p , ())
let compact_the_proof () = simple_with_current_proof (fun _ -> Proof.compact)
-
(* Sets the tactic to be used when a tactic line is closed with [...] *)
let set_endline_tactic tac =
match !pstates with
@@ -416,20 +415,7 @@ let return_proof ?(allow_partial=false) () =
proofs, Evd.evar_universe_context evd
end else
let initial_goals = Proof.initial_goals proof in
- let evd =
- let error s =
- let prf = str " (in proof " ++ Id.print pid ++ str ")" in
- raise (CErrors.UserError(Some "last tactic before Qed",s ++ prf))
- in
- try Proof.return proof with
- | Proof.UnfinishedProof ->
- error(str"Attempt to save an incomplete proof")
- | Proof.HasShelvedGoals ->
- error(str"Attempt to save a proof with shelved goals")
- | Proof.HasGivenUpGoals ->
- error(strbrk"Attempt to save a proof with given up goals. If this is really what you want to do, use Admitted in place of Qed.")
- | Proof.HasUnresolvedEvar->
- error(strbrk"Attempt to save a proof with existential variables still non-instantiated") in
+ let evd = Proof.return ~pid proof in
let eff = Evd.eval_side_effects evd in
let evd = Evd.minimize_universes evd in
(** ppedrot: FIXME, this is surely wrong. There is no reason to duplicate
diff --git a/proofs/proof_global.mli b/proofs/proof_global.mli
index 2b04bfab57..e3808bc36d 100644
--- a/proofs/proof_global.mli
+++ b/proofs/proof_global.mli
@@ -60,14 +60,14 @@ type closed_proof = proof_object * proof_terminator
val make_terminator : (proof_ending -> unit) -> proof_terminator
val apply_terminator : proof_terminator -> proof_ending -> unit
-(** [start_proof id str pl goals terminator] starts a proof of name [id]
- with goals [goals] (a list of pairs of environment and
- conclusion); [str] describes what kind of theorem/definition this
- is (spiwack: for potential printing, I believe is used only by
- closing commands and the xml plugin); [terminator] is used at the
- end of the proof to close the proof. The proof is started in the
- evar map [sigma] (which can typically contain universe
- constraints), and with universe bindings pl. *)
+(** [start_proof id str pl goals terminator] starts a proof of name
+ [id] with goals [goals] (a list of pairs of environment and
+ conclusion); [str] describes what kind of theorem/definition this
+ is; [terminator] is used at the end of the proof to close the proof
+ (e.g. to declare the built constructions as a coercion or a setoid
+ morphism). The proof is started in the evar map [sigma] (which can
+ typically contain universe constraints), and with universe bindings
+ pl. *)
val start_proof :
Evd.evar_map -> Names.Id.t -> ?pl:UState.universe_decl ->
Decl_kinds.goal_kind -> (Environ.env * EConstr.types) list ->
diff --git a/proofs/proofs.mllib b/proofs/proofs.mllib
index 197f71ca91..dbd5be23ab 100644
--- a/proofs/proofs.mllib
+++ b/proofs/proofs.mllib
@@ -1,10 +1,9 @@
Miscprint
Goal
Evar_refiner
-Proof_type
-Logic
Refine
Proof
+Logic
Goal_select
Proof_bullet
Proof_global
diff --git a/proofs/redexpr.ml b/proofs/redexpr.ml
index 56ce744bc1..0981584bb5 100644
--- a/proofs/redexpr.ml
+++ b/proofs/redexpr.ml
@@ -160,7 +160,7 @@ let make_flag env f =
(fun v red -> red_sub red (make_flag_constant v))
f.rConst red
else (* Only rConst *)
- let red = red_add_transparent (red_add red fDELTA) all_opaque in
+ let red = red_add_transparent (red_add red fDELTA) TransparentState.empty in
List.fold_right
(fun v red -> red_add red (make_flag_constant v))
f.rConst red
diff --git a/proofs/refiner.ml b/proofs/refiner.ml
index be32aadd91..bce227dabb 100644
--- a/proofs/refiner.ml
+++ b/proofs/refiner.ml
@@ -12,9 +12,10 @@ open Pp
open CErrors
open Util
open Evd
-open Proof_type
open Logic
+type tactic = Proofview.V82.tac
+
module NamedDecl = Context.Named.Declaration
let sig_it x = x.it
@@ -25,16 +26,16 @@ let project x = x.sigma
let pf_env gls = Global.env_of_context (Goal.V82.hyps (project gls) (sig_it gls))
let pf_hyps gls = EConstr.named_context_of_val (Goal.V82.hyps (project gls) (sig_it gls))
-let refiner pr goal_sigma =
- let (sgl,sigma') = prim_refiner pr goal_sigma.sigma goal_sigma.it in
+let refiner ~check pr goal_sigma =
+ let (sgl,sigma') = prim_refiner ~check pr goal_sigma.sigma goal_sigma.it in
{ it = sgl; sigma = sigma'; }
(* Profiling refiner *)
-let refiner =
+let refiner ~check =
if Flags.profile then
let refiner_key = CProfile.declare_profile "refiner" in
- CProfile.profile2 refiner_key refiner
- else refiner
+ CProfile.profile2 refiner_key (refiner ~check)
+ else refiner ~check
(*********************)
(* Tacticals *)
@@ -178,9 +179,9 @@ let tclPROGRESS tac ptree =
NOTE: some tactics delete hypothesis and reuse names (induction,
destruct), this is not detected by this tactical. *)
let tclSHOWHYPS (tac : tactic) (goal: Goal.goal Evd.sigma)
- :Proof_type.goal list Evd.sigma =
+ : Goal.goal list Evd.sigma =
let oldhyps = pf_hyps goal in
- let rslt:Proof_type.goal list Evd.sigma = tac goal in
+ let rslt:Goal.goal list Evd.sigma = tac goal in
let { it = gls; sigma = sigma; } = rslt in
let hyps =
List.map (fun gl -> pf_hyps { it = gl; sigma=sigma; }) gls in
diff --git a/proofs/refiner.mli b/proofs/refiner.mli
index 30af6d8e1a..52cbf7658b 100644
--- a/proofs/refiner.mli
+++ b/proofs/refiner.mli
@@ -11,18 +11,18 @@
(** Legacy proof engine. Do not use in newly written code. *)
open Evd
-open Proof_type
open EConstr
(** The refiner (handles primitive rules and high-level tactics). *)
+type tactic = Proofview.V82.tac
val sig_it : 'a sigma -> 'a
val project : 'a sigma -> evar_map
-val pf_env : goal sigma -> Environ.env
-val pf_hyps : goal sigma -> named_context
+val pf_env : Goal.goal sigma -> Environ.env
+val pf_hyps : Goal.goal sigma -> named_context
-val refiner : rule -> tactic
+val refiner : check:bool -> Constr.t -> tactic
(** {6 Tacticals. } *)
diff --git a/proofs/tacmach.ml b/proofs/tacmach.ml
index 231a8fe266..64d7630d55 100644
--- a/proofs/tacmach.ml
+++ b/proofs/tacmach.ml
@@ -17,9 +17,7 @@ open Evd
open Typing
open Redexpr
open Tacred
-open Proof_type
open Logic
-open Refiner
open Context.Named.Declaration
module NamedDecl = Context.Named.Declaration
@@ -30,7 +28,7 @@ let re_sig it gc = { it = it; sigma = gc; }
(* Operations for handling terms under a local typing context *)
(**************************************************************)
-type tactic = Proof_type.tactic
+type tactic = Proofview.V82.tac
let sig_it = Refiner.sig_it
let project = Refiner.project
@@ -103,20 +101,6 @@ let pf_reduce_to_atomic_ind = pf_reduce reduce_to_atomic_ind
let pf_hnf_type_of gls = pf_get_type_of gls %> pf_whd_all gls
-(********************************************)
-(* Definition of the most primitive tactics *)
-(********************************************)
-
-let refiner = refiner
-
-let refine_no_check c gl =
- let c = EConstr.Unsafe.to_constr c in
- refiner (Refine c) gl
-
-(* Versions with consistency checks *)
-
-let refine c = with_check (refine_no_check c)
-
(* Pretty-printers *)
open Pp
diff --git a/proofs/tacmach.mli b/proofs/tacmach.mli
index 14c83a6802..ef6a1544e4 100644
--- a/proofs/tacmach.mli
+++ b/proofs/tacmach.mli
@@ -12,85 +12,78 @@ open Names
open Constr
open Environ
open EConstr
-open Proof_type
open Redexpr
open Locus
(** Operations for handling terms under a local typing context. *)
open Evd
-type tactic = Proof_type.tactic;;
+
+type tactic = Proofview.V82.tac
val sig_it : 'a sigma -> 'a
-val project : goal sigma -> evar_map
+val project : Goal.goal sigma -> evar_map
val re_sig : 'a -> evar_map -> 'a sigma
-val pf_concl : goal sigma -> types
-val pf_env : goal sigma -> env
-val pf_hyps : goal sigma -> named_context
-(*i val pf_untyped_hyps : goal sigma -> (Id.t * constr) list i*)
-val pf_hyps_types : goal sigma -> (Id.t * types) list
-val pf_nth_hyp_id : goal sigma -> int -> Id.t
-val pf_last_hyp : goal sigma -> named_declaration
-val pf_ids_of_hyps : goal sigma -> Id.t list
-val pf_global : goal sigma -> Id.t -> evar_map * constr
-val pf_unsafe_type_of : goal sigma -> constr -> types
-val pf_type_of : goal sigma -> constr -> evar_map * types
-val pf_hnf_type_of : goal sigma -> constr -> types
+val pf_concl : Goal.goal sigma -> types
+val pf_env : Goal.goal sigma -> env
+val pf_hyps : Goal.goal sigma -> named_context
+(*i val pf_untyped_hyps : Goal.goal sigma -> (Id.t * constr) list i*)
+val pf_hyps_types : Goal.goal sigma -> (Id.t * types) list
+val pf_nth_hyp_id : Goal.goal sigma -> int -> Id.t
+val pf_last_hyp : Goal.goal sigma -> named_declaration
+val pf_ids_of_hyps : Goal.goal sigma -> Id.t list
+val pf_global : Goal.goal sigma -> Id.t -> evar_map * constr
+val pf_unsafe_type_of : Goal.goal sigma -> constr -> types
+val pf_type_of : Goal.goal sigma -> constr -> evar_map * types
+val pf_hnf_type_of : Goal.goal sigma -> constr -> types
-val pf_get_hyp : goal sigma -> Id.t -> named_declaration
-val pf_get_hyp_typ : goal sigma -> Id.t -> types
+val pf_get_hyp : Goal.goal sigma -> Id.t -> named_declaration
+val pf_get_hyp_typ : Goal.goal sigma -> Id.t -> types
-val pf_get_new_id : Id.t -> goal sigma -> Id.t
+val pf_get_new_id : Id.t -> Goal.goal sigma -> Id.t
-val pf_reduction_of_red_expr : goal sigma -> red_expr -> constr -> evar_map * constr
+val pf_reduction_of_red_expr : Goal.goal sigma -> red_expr -> constr -> evar_map * constr
-val pf_apply : (env -> evar_map -> 'a) -> goal sigma -> 'a
+val pf_apply : (env -> evar_map -> 'a) -> Goal.goal sigma -> 'a
val pf_eapply : (env -> evar_map -> 'a -> evar_map * 'b) ->
- goal sigma -> 'a -> goal sigma * 'b
+ Goal.goal sigma -> 'a -> Goal.goal sigma * 'b
val pf_reduce :
(env -> evar_map -> constr -> constr) ->
- goal sigma -> constr -> constr
+ Goal.goal sigma -> constr -> constr
val pf_e_reduce :
(env -> evar_map -> constr -> evar_map * constr) ->
- goal sigma -> constr -> evar_map * constr
-
-val pf_whd_all : goal sigma -> constr -> constr
-val pf_hnf_constr : goal sigma -> constr -> constr
-val pf_nf : goal sigma -> constr -> constr
-val pf_nf_betaiota : goal sigma -> constr -> constr
-val pf_reduce_to_quantified_ind : goal sigma -> types -> (inductive * EInstance.t) * types
-val pf_reduce_to_atomic_ind : goal sigma -> types -> (inductive * EInstance.t) * types
-val pf_compute : goal sigma -> constr -> constr
+ Goal.goal sigma -> constr -> evar_map * constr
+
+val pf_whd_all : Goal.goal sigma -> constr -> constr
+val pf_hnf_constr : Goal.goal sigma -> constr -> constr
+val pf_nf : Goal.goal sigma -> constr -> constr
+val pf_nf_betaiota : Goal.goal sigma -> constr -> constr
+val pf_reduce_to_quantified_ind : Goal.goal sigma -> types -> (inductive * EInstance.t) * types
+val pf_reduce_to_atomic_ind : Goal.goal sigma -> types -> (inductive * EInstance.t) * types
+val pf_compute : Goal.goal sigma -> constr -> constr
val pf_unfoldn : (occurrences * evaluable_global_reference) list
- -> goal sigma -> constr -> constr
-
-val pf_const_value : goal sigma -> pconstant -> constr
-val pf_conv_x : goal sigma -> constr -> constr -> bool
-val pf_conv_x_leq : goal sigma -> constr -> constr -> bool
-
-(** {6 The most primitive tactics. } *)
-
-val refiner : rule -> tactic
-val refine_no_check : constr -> tactic
+ -> Goal.goal sigma -> constr -> constr
-(** {6 The most primitive tactics with consistency and type checking } *)
-
-val refine : constr -> tactic
+val pf_const_value : Goal.goal sigma -> pconstant -> constr
+val pf_conv_x : Goal.goal sigma -> constr -> constr -> bool
+val pf_conv_x_leq : Goal.goal sigma -> constr -> constr -> bool
(** {6 Pretty-printing functions (debug only). } *)
-val pr_gls : goal sigma -> Pp.t
-val pr_glls : goal list sigma -> Pp.t
+val pr_gls : Goal.goal sigma -> Pp.t
+val pr_glls : Goal.goal list sigma -> Pp.t
[@@ocaml.deprecated "Please move to \"new\" proof engine"]
(** Variants of [Tacmach] functions built with the new proof engine *)
module New : sig
+
val pf_apply : (env -> evar_map -> 'a) -> Proofview.Goal.t -> 'a
val pf_global : Id.t -> Proofview.Goal.t -> GlobRef.t
+
(** FIXME: encapsulate the level in an existential type. *)
- val of_old : (Proof_type.goal Evd.sigma -> 'a) -> Proofview.Goal.t -> 'a
+ val of_old : (Goal.goal Evd.sigma -> 'a) -> Proofview.Goal.t -> 'a
val project : Proofview.Goal.t -> Evd.evar_map
val pf_env : Proofview.Goal.t -> Environ.env
diff --git a/stm/stm.ml b/stm/stm.ml
index b474bd502a..9359ab15e2 100644
--- a/stm/stm.ml
+++ b/stm/stm.ml
@@ -25,6 +25,7 @@ open CErrors
open Names
open Feedback
open Vernacexpr
+open Vernacextend
module AsyncOpts = struct
@@ -162,7 +163,7 @@ type branch_type =
[ `Master
| `Proof of proof_mode * depth
| `Edit of
- proof_mode * Stateid.t * Stateid.t * vernac_qed_type * Vcs_.Branch.t ]
+ proof_mode * Stateid.t * Stateid.t * Vernacextend.vernac_qed_type * Vcs_.Branch.t ]
(* TODO 8.7 : split commands and tactics, since this type is too messy now *)
type cmd_t = {
ctac : bool; (* is a tactic *)
@@ -174,7 +175,7 @@ type cmd_t = {
| `TacQueue of solving_tac * anon_abstracting_tac * AsyncTaskQueue.cancel_switch
| `QueryQueue of AsyncTaskQueue.cancel_switch
| `SkipQueue ] }
-type fork_t = aast * Vcs_.Branch.t * Vernacexpr.opacity_guarantee * Names.Id.t list
+type fork_t = aast * Vcs_.Branch.t * opacity_guarantee * Names.Id.t list
type qed_t = {
qast : aast;
keep : vernac_qed_type;
diff --git a/stm/stm.mli b/stm/stm.mli
index 95117f04f4..0c0e19ce5c 100644
--- a/stm/stm.mli
+++ b/stm/stm.mli
@@ -258,7 +258,7 @@ type dynamic_block_error_recovery =
doc -> static_block_declaration -> [ `ValidBlock of recovery_action | `Leaks ]
val register_proof_block_delimiter :
- Vernacexpr.proof_block_name ->
+ Vernacextend.proof_block_name ->
static_block_detection ->
dynamic_block_error_recovery ->
unit
diff --git a/stm/vernac_classifier.ml b/stm/vernac_classifier.ml
index 4db86817c9..526858bd73 100644
--- a/stm/vernac_classifier.ml
+++ b/stm/vernac_classifier.ml
@@ -12,6 +12,7 @@ open CErrors
open Util
open Pp
open CAst
+open Vernacextend
open Vernacexpr
let default_proof_mode () = Proof_global.get_default_proof_mode_name () [@ocaml.warning "-3"]
@@ -209,7 +210,3 @@ let classify_vernac e =
| (VtStartProof _ | VtUnknown), _ -> VtUnknown, VtNow)
in
static_control_classifier e
-
-let classify_as_query = VtQuery, VtLater
-let classify_as_sideeff = VtSideff [], VtLater
-let classify_as_proofstep = VtProofStep { parallel = `No; proof_block_detection = None}, VtLater
diff --git a/stm/vernac_classifier.mli b/stm/vernac_classifier.mli
index e82b191418..9d93ad1f39 100644
--- a/stm/vernac_classifier.mli
+++ b/stm/vernac_classifier.mli
@@ -8,16 +8,12 @@
(* * (see LICENSE file for the text of the license) *)
(************************************************************************)
-open Vernacexpr
+open Vernacextend
val string_of_vernac_classification : vernac_classification -> string
(** What does a vernacular do *)
-val classify_vernac : vernac_control -> vernac_classification
-
-(** Standard constant classifiers *)
-val classify_as_query : vernac_classification
-val classify_as_sideeff : vernac_classification
-val classify_as_proofstep : vernac_classification
+val classify_vernac : Vernacexpr.vernac_control -> vernac_classification
+(** *)
val stm_allow_nested_proofs_option_name : string list
diff --git a/tactics/auto.ml b/tactics/auto.ml
index 65b2615b6b..81e487b77d 100644
--- a/tactics/auto.ml
+++ b/tactics/auto.ml
@@ -45,7 +45,7 @@ let auto_core_unif_flags_of st1 st2 = {
use_metas_eagerly_in_conv_on_closed_terms = false;
use_evars_eagerly_in_conv_on_closed_terms = false;
modulo_delta = st2;
- modulo_delta_types = full_transparent_state;
+ modulo_delta_types = TransparentState.full;
check_applied_meta_types = false;
use_pattern_unification = false;
use_meta_bound_pattern_unification = true;
@@ -59,13 +59,13 @@ let auto_unif_flags_of st1 st2 =
let flags = auto_core_unif_flags_of st1 st2 in {
core_unify_flags = flags;
merge_unify_flags = flags;
- subterm_unify_flags = { flags with modulo_delta = empty_transparent_state };
+ subterm_unify_flags = { flags with modulo_delta = TransparentState.empty };
allow_K_in_toplevel_higher_order_unification = false;
resolve_evars = true
}
let auto_unif_flags =
- auto_unif_flags_of full_transparent_state empty_transparent_state
+ auto_unif_flags_of TransparentState.full TransparentState.empty
(* Try unification with the precompiled clause, then use registered Apply *)
@@ -291,7 +291,7 @@ let flags_of_state st =
auto_unif_flags_of st st
let auto_flags_of_state st =
- auto_unif_flags_of full_transparent_state st
+ auto_unif_flags_of TransparentState.full st
let hintmap_of sigma secvars hdc concl =
match hdc with
@@ -358,12 +358,12 @@ and my_find_search_delta sigma db_list local_db secvars hdc concl =
let flags = flags_of_state (Hint_db.transparent_state db) in
List.map (fun x -> (Some flags, x)) (f db)
else
- let (ids, csts as st) = Hint_db.transparent_state db in
+ let st = Hint_db.transparent_state db in
let flags, l =
let l =
match hdc with None -> Hint_db.map_none ~secvars db
| Some hdc ->
- if (Id.Pred.is_empty ids && Cpred.is_empty csts)
+ if TransparentState.is_empty st
then Hint_db.map_auto sigma ~secvars hdc concl db
else Hint_db.map_existential sigma ~secvars hdc concl db
in auto_flags_of_state st, l
diff --git a/tactics/auto.mli b/tactics/auto.mli
index a835c1ed95..72d2292ffb 100644
--- a/tactics/auto.mli
+++ b/tactics/auto.mli
@@ -22,7 +22,7 @@ val compute_secvars : Proofview.Goal.t -> Id.Pred.t
val default_search_depth : int ref
-val auto_flags_of_state : transparent_state -> Unification.unify_flags
+val auto_flags_of_state : TransparentState.t -> Unification.unify_flags
val connect_hint_clenv : polymorphic -> raw_hint -> clausenv ->
Proofview.Goal.t -> clausenv * constr
diff --git a/tactics/btermdn.ml b/tactics/btermdn.ml
index bfee0422e7..2f2bd8d2bc 100644
--- a/tactics/btermdn.ml
+++ b/tactics/btermdn.ml
@@ -69,13 +69,13 @@ let constr_pat_discr t =
| PRef ((VarRef v) as ref), args -> Some(GRLabel ref,args)
| _ -> None
-let constr_val_discr_st sigma (idpred,cpred) t =
+let constr_val_discr_st sigma ts t =
let c, l = decomp sigma t in
match EConstr.kind sigma c with
- | Const (c,u) -> if Cpred.mem c cpred then Everything else Label(GRLabel (ConstRef c),l)
+ | Const (c,u) -> if TransparentState.is_transparent_constant ts c then Everything else Label(GRLabel (ConstRef c),l)
| Ind (ind_sp,u) -> Label(GRLabel (IndRef ind_sp),l)
| Construct (cstr_sp,u) -> Label(GRLabel (ConstructRef cstr_sp),l)
- | Var id when not (Id.Pred.mem id idpred) -> Label(GRLabel (VarRef id),l)
+ | Var id when not (TransparentState.is_transparent_variable ts id) -> Label(GRLabel (VarRef id),l)
| Prod (n, d, c) -> Label(ProdLabel, [d; c])
| Lambda (n, d, c) ->
if List.is_empty l then
@@ -85,15 +85,15 @@ let constr_val_discr_st sigma (idpred,cpred) t =
| Evar _ -> Everything
| _ -> Nothing
-let constr_pat_discr_st (idpred,cpred) t =
+let constr_pat_discr_st ts t =
match decomp_pat t with
| PRef ((IndRef _) as ref), args
| PRef ((ConstructRef _ ) as ref), args -> Some (GRLabel ref,args)
- | PRef ((VarRef v) as ref), args when not (Id.Pred.mem v idpred) ->
+ | PRef ((VarRef v) as ref), args when not (TransparentState.is_transparent_variable ts v) ->
Some(GRLabel ref,args)
- | PVar v, args when not (Id.Pred.mem v idpred) ->
+ | PVar v, args when not (TransparentState.is_transparent_variable ts v) ->
Some(GRLabel (VarRef v),args)
- | PRef ((ConstRef c) as ref), args when not (Cpred.mem c cpred) ->
+ | PRef ((ConstRef c) as ref), args when not (TransparentState.is_transparent_constant ts c) ->
Some (GRLabel ref, args)
| PProd (_, d, c), [] -> Some (ProdLabel, [d ; c])
| PLambda (_, d, c), [] -> Some (LambdaLabel, [d ; c])
diff --git a/tactics/btermdn.mli b/tactics/btermdn.mli
index 861c9b6250..cc31fb0599 100644
--- a/tactics/btermdn.mli
+++ b/tactics/btermdn.mli
@@ -9,7 +9,6 @@
(************************************************************************)
open Pattern
-open Names
(** Discrimination nets with bounded depth. *)
@@ -19,7 +18,7 @@ open Names
order in such a way patterns having the same prefix have this common
prefix shared and the seek for the action associated to the patterns
that a term matches are found in time proportional to the maximal
-number of nodes of the patterns matching the term. The [transparent_state]
+number of nodes of the patterns matching the term. The [TransparentState.t]
indicates which constants and variables can be considered as rigid.
These dnets are able to cope with existential variables as well, which match
[Everything]. *)
@@ -31,10 +30,10 @@ sig
val empty : t
- val add : transparent_state option -> t -> (constr_pattern * Z.t) -> t
- val rmv : transparent_state option -> t -> (constr_pattern * Z.t) -> t
+ val add : TransparentState.t option -> t -> (constr_pattern * Z.t) -> t
+ val rmv : TransparentState.t option -> t -> (constr_pattern * Z.t) -> t
- val lookup : Evd.evar_map -> transparent_state option -> t -> EConstr.constr -> Z.t list
+ val lookup : Evd.evar_map -> TransparentState.t option -> t -> EConstr.constr -> Z.t list
val app : (Z.t -> unit) -> t -> unit
end
diff --git a/tactics/class_tactics.ml b/tactics/class_tactics.ml
index 81cf9289d1..5959dd54b1 100644
--- a/tactics/class_tactics.ml
+++ b/tactics/class_tactics.ml
@@ -358,7 +358,7 @@ let rec e_trivial_fail_db only_classes db_list local_db secvars =
Eauto.registered_e_assumption ::
(tclTHEN Tactics.intro trivial_fail :: [trivial_resolve])
in
- tclFIRST (List.map tclCOMPLETE tacl)
+ tclSOLVE tacl
and e_my_find_search db_list local_db secvars hdc complete only_classes env sigma concl =
let open Proofview.Notations in
@@ -585,9 +585,9 @@ module Search = struct
(** Local hints *)
let autogoal_cache = Summary.ref ~name:"autogoal_cache"
(DirPath.empty, true, Context.Named.empty,
- Hint_db.empty full_transparent_state true)
+ Hint_db.empty TransparentState.full true)
- let make_autogoal_hints only_classes ?(st=full_transparent_state) g =
+ let make_autogoal_hints only_classes ?(st=TransparentState.full) g =
let open Proofview in
let open Tacmach.New in
let sign = Goal.hyps g in
@@ -605,7 +605,7 @@ module Search = struct
in
autogoal_cache := (cwd, only_classes, sign, hints); hints
- let make_autogoal ?(st=full_transparent_state) only_classes dep cut i g =
+ let make_autogoal ?(st=TransparentState.full) only_classes dep cut i g =
let hints = make_autogoal_hints only_classes ~st g in
{ search_hints = hints;
search_depth = [i]; last_tac = lazy (str"none");
@@ -843,7 +843,7 @@ module Search = struct
let info = make_autogoal ?st only_classes dep (cut_of_hints hints) i gl in
search_tac hints depth 1 info
- let search_tac ?(st=full_transparent_state) only_classes dep hints depth =
+ let search_tac ?(st=TransparentState.full) only_classes dep hints depth =
let open Proofview in
let tac sigma gls i =
Goal.enter
@@ -873,7 +873,7 @@ module Search = struct
| (e,ie) -> Proofview.tclZERO ~info:ie e)
in aux 1
- let eauto_tac ?(st=full_transparent_state) ?(unique=false)
+ let eauto_tac ?(st=TransparentState.full) ?(unique=false)
~only_classes ?strategy ~depth ~dep hints =
let open Proofview in
let tac =
@@ -985,7 +985,7 @@ end
(** Binding to either V85 or Search implementations. *)
-let typeclasses_eauto ?(only_classes=false) ?(st=full_transparent_state)
+let typeclasses_eauto ?(only_classes=false) ?(st=TransparentState.full)
?strategy ~depth dbs =
let dbs = List.map_filter
(fun db -> try Some (searchtable_map db)
diff --git a/tactics/class_tactics.mli b/tactics/class_tactics.mli
index 9ba69a0584..46dff34f89 100644
--- a/tactics/class_tactics.mli
+++ b/tactics/class_tactics.mli
@@ -25,7 +25,7 @@ type search_strategy = Dfs | Bfs
val set_typeclasses_strategy : search_strategy -> unit
-val typeclasses_eauto : ?only_classes:bool -> ?st:transparent_state -> ?strategy:search_strategy ->
+val typeclasses_eauto : ?only_classes:bool -> ?st:TransparentState.t -> ?strategy:search_strategy ->
depth:(Int.t option) ->
Hints.hint_db_name list -> unit Proofview.tactic
@@ -39,7 +39,7 @@ val autoapply : constr -> Hints.hint_db_name -> unit Proofview.tactic
module Search : sig
val eauto_tac :
- ?st:Names.transparent_state ->
+ ?st:TransparentState.t ->
(** The transparent_state used when working with local hypotheses *)
?unique:bool ->
(** Should we force a unique solution *)
diff --git a/tactics/eauto.ml b/tactics/eauto.ml
index 5067315d08..b8adb792e8 100644
--- a/tactics/eauto.ml
+++ b/tactics/eauto.ml
@@ -15,7 +15,6 @@ open Names
open Constr
open Termops
open EConstr
-open Proof_type
open Tacticals
open Tacmach
open Evd
@@ -29,7 +28,7 @@ open Locusops
open Hints
open Proofview.Notations
-let eauto_unif_flags = auto_flags_of_state full_transparent_state
+let eauto_unif_flags = auto_flags_of_state TransparentState.full
let e_give_exact ?(flags=eauto_unif_flags) c =
Proofview.Goal.enter begin fun gl ->
@@ -151,7 +150,7 @@ let rec e_trivial_fail_db db_list local_db =
(Tacticals.New.tclTHEN Tactics.intro next) ::
(List.map fst (e_trivial_resolve (Tacmach.New.pf_env gl) (Tacmach.New.project gl) db_list local_db secvars (Tacmach.New.pf_concl gl)))
in
- Tacticals.New.tclFIRST (List.map Tacticals.New.tclCOMPLETE tacl)
+ Tacticals.New.tclSOLVE tacl
end
and e_my_find_search env sigma db_list local_db secvars hdc concl =
@@ -203,7 +202,7 @@ let find_first_goal gls =
type search_state = {
priority : int;
depth : int; (*r depth of search before failing *)
- tacres : goal list sigma;
+ tacres : Goal.goal list sigma;
last_tactic : Pp.t Lazy.t;
dblist : hint_db list;
localdb : hint_db list;
@@ -307,7 +306,7 @@ module SearchProblem = struct
let gls = {Evd.it = gl; sigma = lgls.Evd.sigma } in
let hyps' = pf_hyps gls in
if hyps' == hyps then List.hd s.localdb
- else make_local_hint_db (pf_env gls) (project gls) ~ts:full_transparent_state true s.local_lemmas)
+ else make_local_hint_db (pf_env gls) (project gls) ~ts:TransparentState.full true s.local_lemmas)
(List.firstn ((nbgl'-nbgl) + 1) (sig_it lgls))
in
{ depth = pred s.depth; priority = cost; tacres = lgls;
@@ -388,7 +387,7 @@ let make_initial_state dbg n gl dblist localdb lems =
}
let e_search_auto debug (in_depth,p) lems db_list gl =
- let local_db = make_local_hint_db (pf_env gl) (project gl) ~ts:full_transparent_state true lems in
+ let local_db = make_local_hint_db (pf_env gl) (project gl) ~ts:TransparentState.full true lems in
let d = mk_eauto_dbg debug in
let tac = match in_depth,d with
| (true,Debug) -> Search.debug_depth_first
diff --git a/tactics/eauto.mli b/tactics/eauto.mli
index e161d88824..5aa2f42de1 100644
--- a/tactics/eauto.mli
+++ b/tactics/eauto.mli
@@ -26,7 +26,7 @@ val gen_eauto : ?debug:debug -> bool * int -> delayed_open_constr list ->
val eauto_with_bases :
?debug:debug ->
bool * int ->
- delayed_open_constr list -> hint_db list -> Proof_type.tactic
+ delayed_open_constr list -> hint_db list -> Proofview.V82.tac
val autounfold : hint_db_name list -> Locus.clause -> unit Proofview.tactic
val autounfold_tac : hint_db_name list option -> Locus.clause -> unit Proofview.tactic
diff --git a/tactics/equality.ml b/tactics/equality.ml
index c4a6b1605d..b8967775bf 100644
--- a/tactics/equality.ml
+++ b/tactics/equality.ml
@@ -101,8 +101,8 @@ let rewrite_core_unif_flags = {
modulo_conv_on_closed_terms = None;
use_metas_eagerly_in_conv_on_closed_terms = true;
use_evars_eagerly_in_conv_on_closed_terms = false;
- modulo_delta = empty_transparent_state;
- modulo_delta_types = empty_transparent_state;
+ modulo_delta = TransparentState.empty;
+ modulo_delta_types = TransparentState.empty;
check_applied_meta_types = true;
use_pattern_unification = true;
use_meta_bound_pattern_unification = true;
@@ -169,7 +169,7 @@ let instantiate_lemma gl c ty l l2r concl =
[eqclause]
let rewrite_conv_closed_core_unif_flags = {
- modulo_conv_on_closed_terms = Some full_transparent_state;
+ modulo_conv_on_closed_terms = Some TransparentState.full;
(* We have this flag for historical reasons, it has e.g. the consequence *)
(* to rewrite "?x+2" in "y+(1+1)=0" or to rewrite "?x+?x" in "2+(1+1)=0" *)
@@ -178,8 +178,8 @@ let rewrite_conv_closed_core_unif_flags = {
(* Combined with modulo_conv_on_closed_terms, this flag allows since 8.2 *)
(* to rewrite e.g. "?x+(2+?x)" in "1+(1+2)=0" *)
- modulo_delta = empty_transparent_state;
- modulo_delta_types = full_transparent_state;
+ modulo_delta = TransparentState.empty;
+ modulo_delta_types = TransparentState.full;
check_applied_meta_types = true;
use_pattern_unification = true;
(* To rewrite "?n x y" in "y+x=0" when ?n is *)
@@ -204,7 +204,7 @@ let rewrite_conv_closed_unif_flags = {
}
let rewrite_keyed_core_unif_flags = {
- modulo_conv_on_closed_terms = Some full_transparent_state;
+ modulo_conv_on_closed_terms = Some TransparentState.full;
(* We have this flag for historical reasons, it has e.g. the consequence *)
(* to rewrite "?x+2" in "y+(1+1)=0" or to rewrite "?x+?x" in "2+(1+1)=0" *)
@@ -213,8 +213,8 @@ let rewrite_keyed_core_unif_flags = {
(* Combined with modulo_conv_on_closed_terms, this flag allows since 8.2 *)
(* to rewrite e.g. "?x+(2+?x)" in "1+(1+2)=0" *)
- modulo_delta = full_transparent_state;
- modulo_delta_types = full_transparent_state;
+ modulo_delta = TransparentState.full;
+ modulo_delta_types = TransparentState.full;
check_applied_meta_types = true;
use_pattern_unification = true;
(* To rewrite "?n x y" in "y+x=0" when ?n is *)
@@ -1028,7 +1028,7 @@ let discr_positions env sigma (lbeq,eqn,(t,t1,t2)) eq_clause cpath dirn =
let absurd_clause = apply_on_clause (pf,pf_ty) eq_clause in
let pf = Clenvtac.clenv_value_cast_meta absurd_clause in
tclTHENS (assert_after Anonymous absurd_term)
- [onLastHypId gen_absurdity; (Proofview.V82.tactic (Tacmach.refine pf))]
+ [onLastHypId gen_absurdity; (Proofview.V82.tactic (Refiner.refiner ~check:true EConstr.Unsafe.(to_constr pf)))]
let discrEq (lbeq,_,(t,t1,t2) as u) eq_clause =
let sigma = eq_clause.evd in
@@ -1354,8 +1354,8 @@ let inject_if_homogenous_dependent_pair ty =
tclTHENS (cut (mkApp (ceq,new_eq_args)))
[clear [destVar sigma hyp];
Tacticals.New.pf_constr_of_global inj2 >>= fun inj2 ->
- Proofview.V82.tactic (Tacmach.refine
- (mkApp(inj2,[|ar1.(0);mkConst c;ar1.(1);ar1.(2);ar1.(3);ar2.(3);hyp|])))
+ Proofview.V82.tactic (Refiner.refiner ~check:true EConstr.Unsafe.(to_constr
+ (mkApp(inj2,[|ar1.(0);mkConst c;ar1.(1);ar1.(2);ar1.(3);ar2.(3);hyp|]))))
])]
with Exit ->
Proofview.tclUNIT ()
@@ -1400,7 +1400,7 @@ let inject_at_positions env sigma l2r (eq,_,(t,t1,t2)) eq_clause posns tac =
(Proofview.tclIGNORE (Proofview.Monad.List.map
(fun (pf,ty) -> tclTHENS (cut ty)
[inject_if_homogenous_dependent_pair ty;
- Proofview.V82.tactic (Tacmach.refine pf)])
+ Proofview.V82.tactic (Refiner.refiner ~check:true EConstr.Unsafe.(to_constr pf))])
(if l2r then List.rev injectors else injectors)))
(tac (List.length injectors)))
diff --git a/tactics/hints.ml b/tactics/hints.ml
index 2f2d32e887..e64e08dbde 100644
--- a/tactics/hints.ml
+++ b/tactics/hints.ml
@@ -290,9 +290,9 @@ let lookup_tacs sigma concl st se =
module Constr_map = Map.Make(GlobRef.Ordered)
-let is_transparent_gr (ids, csts) = function
- | VarRef id -> Id.Pred.mem id ids
- | ConstRef cst -> Cpred.mem cst csts
+let is_transparent_gr ts = function
+ | VarRef id -> TransparentState.is_transparent_variable ts id
+ | ConstRef cst -> TransparentState.is_transparent_constant ts cst
| IndRef _ | ConstructRef _ -> false
let strip_params env sigma c =
@@ -497,7 +497,7 @@ type hint_db_name = string
module Hint_db :
sig
type t
-val empty : ?name:hint_db_name -> transparent_state -> bool -> t
+val empty : ?name:hint_db_name -> TransparentState.t -> bool -> t
val find : GlobRef.t -> t -> search_entry
val map_none : secvars:Id.Pred.t -> t -> full_hint list
val map_all : secvars:Id.Pred.t -> GlobRef.t -> t -> full_hint list
@@ -513,8 +513,8 @@ val remove_one : GlobRef.t -> t -> t
val remove_list : GlobRef.t list -> t -> t
val iter : (GlobRef.t option -> hint_mode array list -> full_hint list -> unit) -> t -> unit
val use_dn : t -> bool
-val transparent_state : t -> transparent_state
-val set_transparent_state : t -> transparent_state -> t
+val transparent_state : t -> TransparentState.t
+val set_transparent_state : t -> TransparentState.t -> t
val add_cut : hints_path -> t -> t
val add_mode : GlobRef.t -> hint_mode array -> t -> t
val cut : t -> hints_path
@@ -526,7 +526,7 @@ end =
struct
type t = {
- hintdb_state : Names.transparent_state;
+ hintdb_state : TransparentState.t;
hintdb_cut : hints_path;
hintdb_unfolds : Id.Set.t * Cset.t;
hintdb_max_id : int;
@@ -663,10 +663,13 @@ struct
let st',db,rebuild =
match v.code.obj with
| Unfold_nth egr ->
- let addunf (ids,csts) (ids',csts') =
+ let addunf ts (ids, csts) =
+ let open TransparentState in
match egr with
- | EvalVarRef id -> (Id.Pred.add id ids, csts), (Id.Set.add id ids', csts')
- | EvalConstRef cst -> (ids, Cpred.add cst csts), (ids', Cset.add cst csts')
+ | EvalVarRef id ->
+ { ts with tr_var = Id.Pred.add id ts.tr_var }, (Id.Set.add id ids, csts)
+ | EvalConstRef cst ->
+ { ts with tr_cst = Cpred.add cst ts.tr_cst }, (ids, Cset.add cst csts)
in
let state, unfs = addunf db.hintdb_state db.hintdb_unfolds in
state, { db with hintdb_unfolds = unfs }, true
@@ -740,8 +743,8 @@ let typeclasses_db = "typeclass_instances"
let rewrite_db = "rewrite"
let auto_init_db =
- Hintdbmap.add typeclasses_db (Hint_db.empty full_transparent_state true)
- (Hintdbmap.add rewrite_db (Hint_db.empty cst_full_transparent_state true)
+ Hintdbmap.add typeclasses_db (Hint_db.empty TransparentState.full true)
+ (Hintdbmap.add rewrite_db (Hint_db.empty TransparentState.cst_full true)
Hintdbmap.empty)
let searchtable = Summary.ref ~name:"searchtable" auto_init_db
@@ -977,7 +980,7 @@ let make_trivial env sigma poly ?(name=PathAny) r =
let get_db dbname =
try searchtable_map dbname
- with Not_found -> Hint_db.empty ~name:dbname empty_transparent_state false
+ with Not_found -> Hint_db.empty ~name:dbname TransparentState.empty false
let add_hint dbname hintlist =
let check (_, h) =
@@ -995,18 +998,19 @@ let add_hint dbname hintlist =
searchtable_add (dbname,db')
let add_transparency dbname target b =
+ let open TransparentState in
let db = get_db dbname in
- let (ids, csts as st) = Hint_db.transparent_state db in
+ let st = Hint_db.transparent_state db in
let st' =
match target with
- | HintsVariables -> (if b then Id.Pred.full else Id.Pred.empty), csts
- | HintsConstants -> ids, if b then Cpred.full else Cpred.empty
+ | HintsVariables -> { st with tr_var = (if b then Id.Pred.full else Id.Pred.empty) }
+ | HintsConstants -> { st with tr_cst = (if b then Cpred.full else Cpred.empty) }
| HintsReferences grs ->
- List.fold_left (fun (ids, csts) gr ->
- match gr with
- | EvalConstRef c -> (ids, (if b then Cpred.add else Cpred.remove) c csts)
- | EvalVarRef v -> (if b then Id.Pred.add else Id.Pred.remove) v ids, csts)
- st grs
+ List.fold_left (fun st gr ->
+ match gr with
+ | EvalConstRef c -> { st with tr_cst = (if b then Cpred.add else Cpred.remove) c st.tr_cst }
+ | EvalVarRef v -> { st with tr_var = (if b then Id.Pred.add else Id.Pred.remove) v st.tr_var })
+ st grs
in searchtable_add (dbname, Hint_db.set_transparent_state db st')
let remove_hint dbname grs =
@@ -1015,7 +1019,7 @@ let remove_hint dbname grs =
searchtable_add (dbname, db')
type hint_action =
- | CreateDB of bool * transparent_state
+ | CreateDB of bool * TransparentState.t
| AddTransparency of evaluable_global_reference hints_transparency_target * bool
| AddHints of hint_entry list
| RemoveHints of GlobRef.t list
@@ -1373,10 +1377,10 @@ let interp_hints poly =
let _, tacexp = Genintern.generic_intern env tacexp in
HintsExternEntry ({ hint_priority = Some pri; hint_pattern = pat }, tacexp)
-let add_hints ~local dbnames0 h =
- if String.List.mem "nocore" dbnames0 then
+let add_hints ~local dbnames h =
+ if String.List.mem "nocore" dbnames then
user_err Pp.(str "The hint database \"nocore\" is meant to stay empty.");
- let dbnames = if List.is_empty dbnames0 then ["core"] else dbnames0 in
+ assert (not (List.is_empty dbnames));
let env = Global.env() in
let sigma = Evd.from_env env in
match h with
@@ -1543,7 +1547,7 @@ let pr_hint_db_env env sigma db =
in
Hint_db.fold fold db (mt ())
in
- let (ids, csts) = Hint_db.transparent_state db in
+ let { TransparentState.tr_var = ids; tr_cst = csts } = Hint_db.transparent_state db in
hov 0
((if Hint_db.use_dn db then str"Discriminated database"
else str"Non-discriminated database")) ++ fnl () ++
diff --git a/tactics/hints.mli b/tactics/hints.mli
index 6db8feccd0..dd2c63d351 100644
--- a/tactics/hints.mli
+++ b/tactics/hints.mli
@@ -122,7 +122,7 @@ val glob_hints_path :
module Hint_db :
sig
type t
- val empty : ?name:hint_db_name -> transparent_state -> bool -> t
+ val empty : ?name:hint_db_name -> TransparentState.t -> bool -> t
val find : GlobRef.t -> t -> search_entry
(** All hints which have no pattern.
@@ -155,8 +155,8 @@ module Hint_db :
hint_mode array list -> full_hint list -> unit) -> t -> unit
val use_dn : t -> bool
- val transparent_state : t -> transparent_state
- val set_transparent_state : t -> transparent_state -> t
+ val transparent_state : t -> TransparentState.t
+ val set_transparent_state : t -> TransparentState.t -> t
val add_cut : hints_path -> t -> t
val cut : t -> hints_path
@@ -191,7 +191,7 @@ val searchtable_add : (hint_db_name * hint_db) -> unit
[use_dn] switches the use of the discrimination net for all hints
and patterns. *)
-val create_hint_db : bool -> hint_db_name -> transparent_state -> bool -> unit
+val create_hint_db : bool -> hint_db_name -> TransparentState.t -> bool -> unit
val remove_hints : bool -> hint_db_name list -> GlobRef.t list -> unit
@@ -273,7 +273,7 @@ val repr_hint : hint -> (raw_hint * clausenv) hint_ast
Useful to take the current goal hypotheses as hints;
Boolean tells if lemmas with evars are allowed *)
-val make_local_hint_db : env -> evar_map -> ?ts:transparent_state -> bool -> delayed_open_constr list -> hint_db
+val make_local_hint_db : env -> evar_map -> ?ts:TransparentState.t -> bool -> delayed_open_constr list -> hint_db
val make_db_list : hint_db_name list -> hint_db list
diff --git a/tactics/tacticals.ml b/tactics/tacticals.ml
index f2cf915fe3..224cd68cf9 100644
--- a/tactics/tacticals.ml
+++ b/tactics/tacticals.ml
@@ -26,6 +26,8 @@ module NamedDecl = Context.Named.Declaration
(* Tacticals re-exported from the Refiner module *)
(************************************************************************)
+type tactic = Proofview.V82.tac
+
let tclIDTAC = Refiner.tclIDTAC
let tclIDTAC_MESSAGE = Refiner.tclIDTAC_MESSAGE
let tclORELSE0 = Refiner.tclORELSE0
diff --git a/tactics/tacticals.mli b/tactics/tacticals.mli
index cc15469d0e..2947e44f7a 100644
--- a/tactics/tacticals.mli
+++ b/tactics/tacticals.mli
@@ -12,12 +12,13 @@ open Names
open Constr
open EConstr
open Evd
-open Proof_type
open Locus
open Tactypes
(** Tacticals i.e. functions from tactics to tactics. *)
+type tactic = Proofview.V82.tac
+
val tclIDTAC : tactic
val tclIDTAC_MESSAGE : Pp.t -> tactic
val tclORELSE0 : tactic -> tactic -> tactic
@@ -65,20 +66,20 @@ val onNLastHypsId : int -> (Id.t list -> tactic) -> tactic
val onNLastHyps : int -> (constr list -> tactic) -> tactic
val onNLastDecls : int -> (named_context -> tactic) -> tactic
-val lastHypId : goal sigma -> Id.t
-val lastHyp : goal sigma -> constr
-val lastDecl : goal sigma -> named_declaration
-val nLastHypsId : int -> goal sigma -> Id.t list
-val nLastHyps : int -> goal sigma -> constr list
-val nLastDecls : int -> goal sigma -> named_context
+val lastHypId : Goal.goal sigma -> Id.t
+val lastHyp : Goal.goal sigma -> constr
+val lastDecl : Goal.goal sigma -> named_declaration
+val nLastHypsId : int -> Goal.goal sigma -> Id.t list
+val nLastHyps : int -> Goal.goal sigma -> constr list
+val nLastDecls : int -> Goal.goal sigma -> named_context
-val afterHyp : Id.t -> goal sigma -> named_context
+val afterHyp : Id.t -> Goal.goal sigma -> named_context
val ifOnHyp : (Id.t * types -> bool) ->
(Id.t -> tactic) -> (Id.t -> tactic) ->
Id.t -> tactic
-val onHyps : (goal sigma -> named_context) ->
+val onHyps : (Goal.goal sigma -> named_context) ->
(named_context -> tactic) -> tactic
(** {6 Tacticals applying to goal components } *)
@@ -127,11 +128,11 @@ val compute_constructor_signatures : rec_flag:bool -> inductive * 'a -> bool lis
val compute_induction_names :
bool list array -> or_and_intro_pattern option -> intro_patterns array
-val elimination_sort_of_goal : goal sigma -> Sorts.family
-val elimination_sort_of_hyp : Id.t -> goal sigma -> Sorts.family
-val elimination_sort_of_clause : Id.t option -> goal sigma -> Sorts.family
+val elimination_sort_of_goal : Goal.goal sigma -> Sorts.family
+val elimination_sort_of_hyp : Id.t -> Goal.goal sigma -> Sorts.family
+val elimination_sort_of_clause : Id.t option -> Goal.goal sigma -> Sorts.family
-val pf_with_evars : (goal sigma -> Evd.evar_map * 'a) -> ('a -> tactic) -> tactic
+val pf_with_evars : (Goal.goal sigma -> Evd.evar_map * 'a) -> ('a -> tactic) -> tactic
val pf_constr_of_global : GlobRef.t -> (constr -> tactic) -> tactic
(** Tacticals defined directly in term of Proofview *)
diff --git a/tactics/tactics.ml b/tactics/tactics.ml
index 1646906daa..0beafb7e31 100644
--- a/tactics/tactics.ml
+++ b/tactics/tactics.ml
@@ -142,7 +142,6 @@ let introduction id =
| _ -> raise (RefinerError (env, sigma, IntroNeedsProduct))
end
-let refine = Tacmach.refine
let error msg = CErrors.user_err Pp.(str msg)
let convert_concl ?(check=true) ty k =
@@ -1152,7 +1151,6 @@ let rec intros_move = function
let tactic_infer_flags with_evar = {
Pretyping.use_typeclasses = true;
Pretyping.solve_unification_constraints = true;
- Pretyping.use_hook = Pfedit.solve_by_implicit_tactic ();
Pretyping.fail_evar = not with_evar;
Pretyping.expand_evars = true }
@@ -1301,7 +1299,7 @@ let clenv_refine_in ?(sidecond_first=false) with_evars ?(with_classes=true)
if not with_evars && occur_meta clenv.evd new_hyp_typ then
error_uninstantiated_metas new_hyp_typ clenv;
let new_hyp_prf = clenv_value clenv in
- let exact_tac = Proofview.V82.tactic (Tacmach.refine_no_check new_hyp_prf) in
+ let exact_tac = Proofview.V82.tactic (Refiner.refiner ~check:false EConstr.Unsafe.(to_constr new_hyp_prf)) in
let naming = NamingMustBe (CAst.make targetid) in
let with_clear = do_replace (Some id) naming in
Tacticals.New.tclTHEN
@@ -1625,7 +1623,7 @@ let descend_in_conjunctions avoid tac (err, info) c =
| Some (p,pt) ->
Tacticals.New.tclTHENS
(assert_before_gen false (NamingAvoid avoid) pt)
- [Proofview.V82.tactic (refine p);
+ [Proofview.V82.tactic (refiner ~check:true EConstr.Unsafe.(to_constr p));
(* Might be ill-typed due to forbidden elimination. *)
Tacticals.New.onLastHypId (tac (not isrec))]
end)))
@@ -1661,7 +1659,7 @@ let general_apply ?(respect_opaque=false) with_delta with_destruct with_evars
let sigma = Tacmach.New.project gl in
let ts =
if respect_opaque then Conv_oracle.get_transp_state (oracle env)
- else full_transparent_state
+ else TransparentState.full
in
let flags =
if with_delta then default_unify_flags () else default_no_delta_unify_flags ts in
@@ -1827,7 +1825,7 @@ let apply_in_once ?(respect_opaque = false) sidecond_first with_delta
let sigma = Tacmach.New.project gl in
let ts =
if respect_opaque then Conv_oracle.get_transp_state (oracle env)
- else full_transparent_state
+ else TransparentState.full
in
let flags =
if with_delta then default_unify_flags () else default_no_delta_unify_flags ts in
@@ -4910,7 +4908,7 @@ let constr_eq ~strict x y =
| None -> fail
end
-let unify ?(state=full_transparent_state) x y =
+let unify ?(state=TransparentState.full) x y =
Proofview.Goal.enter begin fun gl ->
let env = Proofview.Goal.env gl in
let sigma = Proofview.Goal.sigma gl in
@@ -4923,7 +4921,7 @@ let unify ?(state=full_transparent_state) x y =
let flags = { (default_unify_flags ()) with
core_unify_flags = core_flags;
merge_unify_flags = core_flags;
- subterm_unify_flags = { core_flags with modulo_delta = empty_transparent_state } }
+ subterm_unify_flags = { core_flags with modulo_delta = TransparentState.empty } }
in
let sigma = w_unify (Tacmach.New.pf_env gl) sigma Reduction.CONV ~flags x y in
Proofview.Unsafe.tclEVARS sigma
diff --git a/tactics/tactics.mli b/tactics/tactics.mli
index b298524ff8..75b5caaa36 100644
--- a/tactics/tactics.mli
+++ b/tactics/tactics.mli
@@ -12,7 +12,6 @@ open Names
open Constr
open EConstr
open Environ
-open Proof_type
open Evd
open Clenv
open Redexpr
@@ -50,8 +49,8 @@ val convert_leq : constr -> constr -> unit Proofview.tactic
(** {6 Introduction tactics. } *)
val fresh_id_in_env : Id.Set.t -> Id.t -> env -> Id.t
-val fresh_id : Id.Set.t -> Id.t -> goal sigma -> Id.t
-val find_intro_names : rel_context -> goal sigma -> Id.t list
+val fresh_id : Id.Set.t -> Id.t -> Goal.goal sigma -> Id.t
+val find_intro_names : rel_context -> Goal.goal sigma -> Id.t list
val intro : unit Proofview.tactic
val introf : unit Proofview.tactic
@@ -419,7 +418,7 @@ val generalize_dep : ?with_let:bool (** Don't lose let bindings *) -> constr -
are added to the evar map. *)
val constr_eq : strict:bool -> constr -> constr -> unit Proofview.tactic
-val unify : ?state:Names.transparent_state -> constr -> constr -> unit Proofview.tactic
+val unify : ?state:TransparentState.t -> constr -> constr -> unit Proofview.tactic
val abstract_generalize : ?generalize_vars:bool -> ?force_dep:bool -> Id.t -> unit Proofview.tactic
val specialize_eqs : Id.t -> unit Proofview.tactic
diff --git a/test-suite/Makefile b/test-suite/Makefile
index 928a77cb8e..1db97f43c5 100644
--- a/test-suite/Makefile
+++ b/test-suite/Makefile
@@ -187,14 +187,6 @@ summary.log:
$(SHOW) BUILDING SUMMARY FILE
$(HIDE)$(MAKE) --quiet summary > "$@"
-# 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
-endif #APPVEYOR
-
report: summary.log
$(HIDE)bash report.sh
diff --git a/test-suite/bugs/closed/bug_2001.v b/test-suite/bugs/closed/bug_2001.v
index 652c65706a..31c62b7b36 100644
--- a/test-suite/bugs/closed/bug_2001.v
+++ b/test-suite/bugs/closed/bug_2001.v
@@ -1,12 +1,10 @@
(* Automatic computing of guard in "Theorem with"; check that guard is not
computed when the user explicitly indicated it *)
-Unset Automatic Introduction.
-
Inductive T : Set :=
| v : T.
-Definition f (s:nat) (t:T) : nat.
+Definition f : forall (s:nat) (t:T), nat.
fix f 2.
intros s t.
refine
diff --git a/test-suite/bugs/closed/gh6165.v b/test-suite/bugs/closed/bug_6165.v
index b87a7caaf2..b87a7caaf2 100644
--- a/test-suite/bugs/closed/gh6165.v
+++ b/test-suite/bugs/closed/bug_6165.v
diff --git a/test-suite/bugs/closed/gh6384.v b/test-suite/bugs/closed/bug_6384.v
index cec84642fb..cec84642fb 100644
--- a/test-suite/bugs/closed/gh6384.v
+++ b/test-suite/bugs/closed/bug_6384.v
diff --git a/test-suite/bugs/closed/gh6385.v b/test-suite/bugs/closed/bug_6385.v
index 3bbb664f4f..3bbb664f4f 100644
--- a/test-suite/bugs/closed/gh6385.v
+++ b/test-suite/bugs/closed/bug_6385.v
diff --git a/test-suite/bugs/closed/bug_6661.v b/test-suite/bugs/closed/bug_6661.v
index e88a3704d8..28a9ffc7bd 100644
--- a/test-suite/bugs/closed/bug_6661.v
+++ b/test-suite/bugs/closed/bug_6661.v
@@ -53,8 +53,6 @@ Definition foo (X:Type) (xy : @total2 X (λ _, X)) : X.
exact x.
Defined.
-Unset Automatic Introduction.
-
Definition idfun (T : UU) := λ t:T, t.
Definition pathscomp0 {X : UU} {a b c : X} (e1 : a = b) (e2 : b = c) : a = c.
diff --git a/test-suite/coqchk/bug_8937.v b/test-suite/coqchk/bug_8937.v
new file mode 100644
index 0000000000..5b326e389b
--- /dev/null
+++ b/test-suite/coqchk/bug_8937.v
@@ -0,0 +1,21 @@
+(* -*- coq-prog-args: ("-noinit"); -*- *)
+
+Unset Elimination Schemes.
+Module Type S.
+
+Inductive foo : Prop :=.
+Definition bar (x:foo) : Prop := match x with end.
+
+End S.
+
+Module M.
+
+Inductive foo : Prop :=.
+Definition bar (x:foo) : Prop := match x with end.
+
+End M.
+
+Module MS : S := M.
+
+Module F (Z:S) := Z.
+Module MS' : S := F M.
diff --git a/test-suite/misc/quick-include.sh b/test-suite/misc/quick-include.sh
new file mode 100755
index 0000000000..96bdee2fc2
--- /dev/null
+++ b/test-suite/misc/quick-include.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+set -e
+
+$coqc -R misc/quick-include/ QuickInclude -quick misc/quick-include/file1.v
+$coqc -R misc/quick-include/ QuickInclude -quick misc/quick-include/file2.v
diff --git a/test-suite/misc/quick-include/file1.v b/test-suite/misc/quick-include/file1.v
new file mode 100644
index 0000000000..fa48e240cb
--- /dev/null
+++ b/test-suite/misc/quick-include/file1.v
@@ -0,0 +1,18 @@
+
+Module Type E. End E.
+
+Module M.
+ Lemma x : True.
+ Proof. trivial. Qed.
+End M.
+
+
+Module Type T.
+ Lemma x : True.
+ Proof. trivial. Qed.
+End T.
+
+Module F(A:E).
+ Lemma x : True.
+ Proof. trivial. Qed.
+End F.
diff --git a/test-suite/misc/quick-include/file2.v b/test-suite/misc/quick-include/file2.v
new file mode 100644
index 0000000000..ab10dfd8de
--- /dev/null
+++ b/test-suite/misc/quick-include/file2.v
@@ -0,0 +1,6 @@
+
+From QuickInclude Require file1.
+
+Module M. Include file1.M. End M.
+Module T. Include file1.T. End T.
+Module F. Include file1.F. End F.
diff --git a/test-suite/output/Notations4.out b/test-suite/output/Notations4.out
index 46784d1897..d25ad5dca8 100644
--- a/test-suite/output/Notations4.out
+++ b/test-suite/output/Notations4.out
@@ -17,3 +17,7 @@ end
: Expr -> Expr
[(1 + 1)]
: Expr
+Let "x" e1 e2
+ : expr
+Let "x" e1 e2
+ : expr
diff --git a/test-suite/output/Notations4.v b/test-suite/output/Notations4.v
index 6bdbf1bed5..7800e91ee5 100644
--- a/test-suite/output/Notations4.v
+++ b/test-suite/output/Notations4.v
@@ -70,3 +70,27 @@ Notation "( x )" := x (in custom expr at level 0, x at level 2).
Check [1 + 1].
End C.
+
+(* An example of interaction between coercion and notations from
+ Robbert Krebbers. *)
+
+Require Import String.
+
+Module D.
+
+Inductive expr :=
+ | Var : string -> expr
+ | Lam : string -> expr -> expr
+ | App : expr -> expr -> expr.
+
+Notation Let x e1 e2 := (App (Lam x e2) e1).
+
+Parameter e1 e2 : expr.
+
+Check (Let "x" e1 e2).
+
+Coercion App : expr >-> Funclass.
+
+Check (Let "x" e1 e2).
+
+End D.
diff --git a/test-suite/output/PrintUnivsSubgraph.out b/test-suite/output/PrintUnivsSubgraph.out
new file mode 100644
index 0000000000..c42e15e4e8
--- /dev/null
+++ b/test-suite/output/PrintUnivsSubgraph.out
@@ -0,0 +1,5 @@
+Prop < Set
+Set < i
+ < j
+i < j
+
diff --git a/test-suite/output/PrintUnivsSubgraph.v b/test-suite/output/PrintUnivsSubgraph.v
new file mode 100644
index 0000000000..ec9cf44d4f
--- /dev/null
+++ b/test-suite/output/PrintUnivsSubgraph.v
@@ -0,0 +1,9 @@
+
+Universes i j k l.
+
+Definition foo : Type@{j} := Type@{i}.
+
+Definition baz : Type@{k} := Type@{l}.
+
+Print Universes Subgraph(i j).
+(* should print [i < j], not [l < k] (and not prelude universes) *)
diff --git a/test-suite/output/UnivBinders.out b/test-suite/output/UnivBinders.out
index d63b6dbfce..4d3f7419e6 100644
--- a/test-suite/output/UnivBinders.out
+++ b/test-suite/output/UnivBinders.out
@@ -41,8 +41,7 @@ Arguments A, Wrap are implicit and maximally inserted
Argument scopes are [type_scope _]
Polymorphic bar@{u} = nat
: Wrap@{u} Set
-(* u |= Set < u
- *)
+(* u |= Set < u *)
bar is universe polymorphic
Polymorphic foo@{u UnivBinders.17 v} =
diff --git a/test-suite/report.sh b/test-suite/report.sh
index 05f39b4b02..c5e698232f 100755
--- a/test-suite/report.sh
+++ b/test-suite/report.sh
@@ -24,7 +24,7 @@ cp summary.log "$SAVEDIR"/
rm "$FAILED"
# print info
-if [ -n "$TRAVIS" ] || [ -n "$PRINT_LOGS" ]; then
+if [ -n "$TRAVIS" ] || [ -n "$APPVEYOR" ] || [ -n "$PRINT_LOGS" ]; then
find logs/ -name '*.log' -not -name 'summary.log' -print0 | while IFS= read -r -d '' file; do
if [ -n "$TRAVIS" ]; then
# ${foo////.} replaces every / by . in $foo
@@ -40,12 +40,13 @@ if [ -n "$TRAVIS" ] || [ -n "$PRINT_LOGS" ]; then
else printf '\n'
fi
done
+ printed_logs=1
fi
if grep -q -F 'Error!' summary.log ; then
echo FAILURES;
grep -F 'Error!' summary.log;
- if [ -z "$TRAVIS" ] && [ -z "$PRINT_LOGS" ]; then
+ if [ -z "$printed_logs" ]; then
echo 'To print details of failed tests, rerun with environment variable PRINT_LOGS=1'
echo 'eg "make report PRINT_LOGS=1" from the test suite directory"'
echo 'See README.md in the test suite directory for more information.'
diff --git a/test-suite/success/Fixpoint.v b/test-suite/success/Fixpoint.v
index efb32ef6f7..81c9763ccd 100644
--- a/test-suite/success/Fixpoint.v
+++ b/test-suite/success/Fixpoint.v
@@ -50,8 +50,6 @@ End folding.
(* Check definition by tactics *)
-Set Automatic Introduction.
-
Inductive even : nat -> Type :=
| even_O : even 0
| even_S : forall n, odd n -> even (S n)
diff --git a/test-suite/success/Require.v b/test-suite/success/Require.v
index f851d8c7d9..de5987c4f7 100644
--- a/test-suite/success/Require.v
+++ b/test-suite/success/Require.v
@@ -1,3 +1,8 @@
+(* -*- coq-prog-args: ("-noinit"); -*- *)
+
Require Import Coq.Arith.Plus.
Require Coq.Arith.Minus.
Locate Library Coq.Arith.Minus.
+
+(* Check that Init didn't get exported by the import above *)
+Fail Check nat.
diff --git a/test-suite/success/autointros.v b/test-suite/success/autointros.v
index 0a0812711c..1140a537fc 100644
--- a/test-suite/success/autointros.v
+++ b/test-suite/success/autointros.v
@@ -1,5 +1,3 @@
-Set Automatic Introduction.
-
Inductive even : nat -> Prop :=
| even_0 : even 0
| even_odd : forall n, odd n -> even (S n)
diff --git a/test-suite/unit-tests/printing/proof_diffs_test.ml b/test-suite/unit-tests/printing/proof_diffs_test.ml
index 526cefec44..7f9e6cc6e0 100644
--- a/test-suite/unit-tests/printing/proof_diffs_test.ml
+++ b/test-suite/unit-tests/printing/proof_diffs_test.ml
@@ -71,6 +71,13 @@ let _ = add_test "tokenize_string examples" t
open Pp
+(* example that was failing from #8922 *)
+let t () =
+ Proof_diffs.write_diffs_option "removed";
+ ignore (diff_str "X : ?Goal" "X : forall x : ?Goal0, ?Goal1");
+ Proof_diffs.write_diffs_option "on"
+let _ = add_test "shorten_diff_span failure from #8922" t
+
(* note pp_to_string concatenates adjacent strings, could become one token,
e.g. str " a" ++ str "b " will give a token "ab" *)
(* checks background is present and correct *)
diff --git a/theories/Bool/Bool.v b/theories/Bool/Bool.v
index 42af3583d4..075288e216 100644
--- a/theories/Bool/Bool.v
+++ b/theories/Bool/Bool.v
@@ -48,7 +48,7 @@ Proof.
discriminate.
Qed.
Hint Resolve diff_false_true : bool.
-Hint Extern 1 (false <> true) => exact diff_false_true.
+Hint Extern 1 (false <> true) => exact diff_false_true : core.
Lemma eq_true_false_abs : forall b:bool, b = true -> b = false -> False.
Proof.
@@ -621,7 +621,7 @@ Lemma absurd_eq_true : forall b, False -> b = true.
Proof.
contradiction.
Qed.
-Hint Resolve absurd_eq_true.
+Hint Resolve absurd_eq_true : core.
(* A specific instance of eq_trans that preserves compatibility with
old hint bool_2 *)
@@ -630,7 +630,7 @@ Lemma trans_eq_bool : forall x y z:bool, x = y -> y = z -> x = z.
Proof.
apply eq_trans.
Qed.
-Hint Resolve trans_eq_bool.
+Hint Resolve trans_eq_bool : core.
(*****************************************)
(** * Reflection of [bool] into [Prop] *)
diff --git a/theories/Classes/RelationPairs.v b/theories/Classes/RelationPairs.v
index 7af2b0fc45..3e6358c8f3 100644
--- a/theories/Classes/RelationPairs.v
+++ b/theories/Classes/RelationPairs.v
@@ -157,6 +157,6 @@ Section RelProd_Instances.
Proof. unfold RelCompFun; firstorder. Qed.
End RelProd_Instances.
-Hint Unfold RelProd RelCompFun.
-Hint Extern 2 (RelProd _ _ _ _) => split.
+Hint Unfold RelProd RelCompFun : core.
+Hint Extern 2 (RelProd _ _ _ _) => split : core.
diff --git a/theories/Compat/Coq87.v b/theories/Compat/Coq87.v
index dc1397aff2..5e031efa85 100644
--- a/theories/Compat/Coq87.v
+++ b/theories/Compat/Coq87.v
@@ -9,6 +9,8 @@
(************************************************************************)
(** Compatibility file for making Coq act similar to Coq v8.7 *)
+Local Set Warnings "-deprecated".
+
Require Export Coq.Compat.Coq88.
(* In 8.7, omega wasn't taking advantage of local abbreviations,
diff --git a/theories/Compat/Coq88.v b/theories/Compat/Coq88.v
index 0aab64e4c4..989072940a 100644
--- a/theories/Compat/Coq88.v
+++ b/theories/Compat/Coq88.v
@@ -9,6 +9,8 @@
(************************************************************************)
(** Compatibility file for making Coq act similar to Coq v8.8 *)
+Local Set Warnings "-deprecated".
+
Require Export Coq.Compat.Coq89.
(** In Coq 8.9, prim token notations follow [Import] rather than
diff --git a/theories/Compat/Coq89.v b/theories/Compat/Coq89.v
index d25671887f..49b9e4c951 100644
--- a/theories/Compat/Coq89.v
+++ b/theories/Compat/Coq89.v
@@ -9,3 +9,4 @@
(************************************************************************)
(** Compatibility file for making Coq act similar to Coq v8.9 *)
+Local Set Warnings "-deprecated".
diff --git a/theories/FSets/FMapAVL.v b/theories/FSets/FMapAVL.v
index b0d1824827..8fc04d81e6 100644
--- a/theories/FSets/FMapAVL.v
+++ b/theories/FSets/FMapAVL.v
@@ -41,7 +41,7 @@ Local Open Scope Int_scope.
Local Notation int := I.t.
Definition key := X.t.
-Hint Transparent key.
+Hint Transparent key : core.
(** * Trees *)
@@ -488,8 +488,8 @@ Functional Scheme map2_opt_ind := Induction for map2_opt Sort Prop.
(** * Automation and dedicated tactics. *)
-Hint Constructors tree MapsTo In bst.
-Hint Unfold lt_tree gt_tree.
+Hint Constructors tree MapsTo In bst : core.
+Hint Unfold lt_tree gt_tree : core.
Tactic Notation "factornode" ident(l) ident(x) ident(d) ident(r) ident(h)
"as" ident(s) :=
@@ -569,7 +569,7 @@ Lemma MapsTo_In : forall k e m, MapsTo k e m -> In k m.
Proof.
induction 1; auto.
Qed.
-Hint Resolve MapsTo_In.
+Hint Resolve MapsTo_In : core.
Lemma In_MapsTo : forall k m, In k m -> exists e, MapsTo k e m.
Proof.
@@ -588,7 +588,7 @@ Lemma MapsTo_1 :
Proof.
induction m; simpl; intuition_in; eauto.
Qed.
-Hint Immediate MapsTo_1.
+Hint Immediate MapsTo_1 : core.
Lemma In_1 :
forall m x y, X.eq x y -> In x m -> In y m.
@@ -627,7 +627,7 @@ Proof.
unfold gt_tree in *; intuition_in; order.
Qed.
-Hint Resolve lt_leaf gt_leaf lt_tree_node gt_tree_node.
+Hint Resolve lt_leaf gt_leaf lt_tree_node gt_tree_node : core.
Lemma lt_left : forall x y l r e h,
lt_tree x (Node l y e r h) -> lt_tree x l.
@@ -653,7 +653,7 @@ Proof.
intuition_in.
Qed.
-Hint Resolve lt_left lt_right gt_left gt_right.
+Hint Resolve lt_left lt_right gt_left gt_right : core.
Lemma lt_tree_not_in :
forall x m, lt_tree x m -> ~ In x m.
@@ -679,7 +679,7 @@ Proof.
eauto.
Qed.
-Hint Resolve lt_tree_not_in lt_tree_trans gt_tree_not_in gt_tree_trans.
+Hint Resolve lt_tree_not_in lt_tree_trans gt_tree_not_in gt_tree_trans : core.
(** * Empty map *)
@@ -811,7 +811,7 @@ Lemma create_bst :
Proof.
unfold create; auto.
Qed.
-Hint Resolve create_bst.
+Hint Resolve create_bst : core.
Lemma create_in :
forall l x e r y,
@@ -828,7 +828,7 @@ Proof.
(apply lt_tree_node || apply gt_tree_node); auto;
(eapply lt_tree_trans || eapply gt_tree_trans); eauto.
Qed.
-Hint Resolve bal_bst.
+Hint Resolve bal_bst : core.
Lemma bal_in : forall l x e r y,
In y (bal l x e r) <-> X.eq y x \/ In y l \/ In y r.
@@ -869,7 +869,7 @@ Proof.
apply MX.eq_lt with x; auto.
apply MX.lt_eq with x; auto.
Qed.
-Hint Resolve add_bst.
+Hint Resolve add_bst : core.
Lemma add_1 : forall m x y e, X.eq x y -> MapsTo y e (add x e m).
Proof.
@@ -949,7 +949,7 @@ Proof.
destruct 1.
apply H2; intuition.
Qed.
-Hint Resolve remove_min_bst.
+Hint Resolve remove_min_bst : core.
Lemma remove_min_gt_tree : forall l x e r h,
bst (Node l x e r h) ->
@@ -968,7 +968,7 @@ Proof.
assert (X.lt m#1 x) by order.
decompose [or] H; order.
Qed.
-Hint Resolve remove_min_gt_tree.
+Hint Resolve remove_min_gt_tree : core.
Lemma remove_min_find : forall l x e r h y,
bst (Node l x e r h) ->
@@ -1120,7 +1120,7 @@ Proof.
intuition; [ apply MX.lt_eq with x | ]; eauto.
intuition; [ apply MX.eq_lt with x | ]; eauto.
Qed.
-Hint Resolve join_bst.
+Hint Resolve join_bst : core.
Lemma join_find : forall l x d r y,
bst l -> bst r -> lt_tree x l -> gt_tree x r ->
@@ -1256,7 +1256,7 @@ Proof.
rewrite remove_min_in, e1; simpl; auto.
change (gt_tree (m2',xd)#2#1 (m2',xd)#1). rewrite <-e1; eauto.
Qed.
-Hint Resolve concat_bst.
+Hint Resolve concat_bst : core.
Lemma concat_find : forall m1 m2 y, bst m1 -> bst m2 ->
(forall y1 y2, In y1 m1 -> In y2 m2 -> X.lt y1 y2) ->
@@ -1344,7 +1344,7 @@ Proof.
intros; unfold elements; apply elements_aux_sort; auto.
intros; inversion H0.
Qed.
-Hint Resolve elements_sort.
+Hint Resolve elements_sort : core.
Lemma elements_nodup : forall s : t elt, bst s -> NoDupA eqk (elements s).
Proof.
@@ -1612,7 +1612,7 @@ destruct (map_option_2 H) as (d0 & ? & ?).
destruct (map_option_2 H') as (d0' & ? & ?).
eapply X.lt_trans with x; eauto using MapsTo_In.
Qed.
-Hint Resolve map_option_bst.
+Hint Resolve map_option_bst : core.
Ltac nonify e :=
replace e with (@None elt) by
@@ -1711,7 +1711,7 @@ apply X.lt_trans with x1.
destruct (map2_opt_2 H1 H6 Hy); intuition.
destruct (map2_opt_2 H2 H7 Hy'); intuition.
Qed.
-Hint Resolve map2_opt_bst.
+Hint Resolve map2_opt_bst : core.
Ltac map2_aux :=
match goal with
@@ -2066,7 +2066,7 @@ Module IntMake_ord (I:Int)(X: OrderedType)(D : OrderedType) <:
Proof.
destruct c; simpl; intros; P.MX.elim_comp; auto.
Qed.
- Hint Resolve cons_Cmp.
+ Hint Resolve cons_Cmp : core.
Lemma compare_end_Cmp :
forall e2, Cmp (compare_end e2) nil (P.flatten_e e2).
diff --git a/theories/FSets/FMapFacts.v b/theories/FSets/FMapFacts.v
index 2d5a79838a..d19c5558d8 100644
--- a/theories/FSets/FMapFacts.v
+++ b/theories/FSets/FMapFacts.v
@@ -20,7 +20,7 @@ Require Export FMapInterface.
Set Implicit Arguments.
Unset Strict Implicit.
-Hint Extern 1 (Equivalence _) => constructor; congruence.
+Hint Extern 1 (Equivalence _) => constructor; congruence : core.
(** * Facts about weak maps *)
diff --git a/theories/FSets/FMapFullAVL.v b/theories/FSets/FMapFullAVL.v
index c0db8646c7..950b30ee4d 100644
--- a/theories/FSets/FMapFullAVL.v
+++ b/theories/FSets/FMapFullAVL.v
@@ -63,7 +63,7 @@ Inductive avl : t elt -> Prop :=
(** * Automation and dedicated tactics about [avl]. *)
-Hint Constructors avl.
+Hint Constructors avl : core.
Lemma height_non_negative : forall (s : t elt), avl s ->
height s >= 0.
@@ -100,7 +100,7 @@ Lemma avl_node : forall x e l r, avl l -> avl r ->
Proof.
intros; auto.
Qed.
-Hint Resolve avl_node.
+Hint Resolve avl_node : core.
(** Results about [height] *)
@@ -193,7 +193,7 @@ Lemma add_avl : forall m x e, avl m -> avl (add x e m).
Proof.
intros; generalize (add_avl_1 x e H); intuition.
Qed.
-Hint Resolve add_avl.
+Hint Resolve add_avl : core.
(** * Extraction of minimum binding *)
@@ -274,7 +274,7 @@ Lemma remove_avl : forall m x, avl m -> avl (remove x m).
Proof.
intros; generalize (remove_avl_1 x H); intuition.
Qed.
-Hint Resolve remove_avl.
+Hint Resolve remove_avl : core.
(** * Join *)
@@ -331,7 +331,7 @@ Lemma join_avl : forall l x d r, avl l -> avl r -> avl (join l x d r).
Proof.
intros; destruct (join_avl_1 x d H H0); auto.
Qed.
-Hint Resolve join_avl.
+Hint Resolve join_avl : core.
(** concat *)
@@ -341,7 +341,7 @@ Proof.
intros; apply join_avl; auto.
generalize (remove_min_avl H0); rewrite e1; simpl; auto.
Qed.
-Hint Resolve concat_avl.
+Hint Resolve concat_avl : core.
(** split *)
@@ -355,7 +355,7 @@ Proof.
Qed.
End Elt.
-Hint Constructors avl.
+Hint Constructors avl : core.
Section Map.
Variable elt elt' : Type.
@@ -713,7 +713,7 @@ Module IntMake_ord (I:Int)(X: OrderedType)(D : OrderedType) <:
Proof.
destruct c; simpl; intros; MX.elim_comp; auto.
Qed.
- Hint Resolve cons_Cmp.
+ Hint Resolve cons_Cmp : core.
Lemma compare_aux_Cmp : forall e,
Cmp (compare_aux e) (flatten_e (fst e)) (flatten_e (snd e)).
diff --git a/theories/FSets/FMapInterface.v b/theories/FSets/FMapInterface.v
index 38a96dc393..8970529103 100644
--- a/theories/FSets/FMapInterface.v
+++ b/theories/FSets/FMapInterface.v
@@ -58,7 +58,7 @@ Definition Cmp (elt:Type)(cmp:elt->elt->bool) e1 e2 := cmp e1 e2 = true.
Module Type WSfun (E : DecidableType).
Definition key := E.t.
- Hint Transparent key.
+ Hint Transparent key : core.
Parameter t : Type -> Type.
(** the abstract type of maps *)
diff --git a/theories/FSets/FMapList.v b/theories/FSets/FMapList.v
index 3e98d11976..6ca158a277 100644
--- a/theories/FSets/FMapList.v
+++ b/theories/FSets/FMapList.v
@@ -51,7 +51,7 @@ Proof.
intro abs.
inversion abs.
Qed.
-Hint Resolve empty_1.
+Hint Resolve empty_1 : core.
Lemma empty_sorted : Sort empty.
Proof.
@@ -216,7 +216,7 @@ Proof.
compute in H0,H1.
simpl; case (X.compare x x''); intuition.
Qed.
-Hint Resolve add_Inf.
+Hint Resolve add_Inf : core.
Lemma add_sorted : forall m (Hm:Sort m) x e, Sort (add x e m).
Proof.
@@ -302,7 +302,7 @@ Proof.
inversion_clear Hm.
apply Inf_lt with (x'',e''); auto.
Qed.
-Hint Resolve remove_Inf.
+Hint Resolve remove_Inf : core.
Lemma remove_sorted : forall m (Hm:Sort m) x, Sort (remove x m).
Proof.
@@ -586,7 +586,7 @@ Proof.
inversion_clear H; auto.
Qed.
-Hint Resolve map_lelistA.
+Hint Resolve map_lelistA : core.
Lemma map_sorted : forall (m: t elt)(Hm : sort (@ltk elt) m)(f:elt -> elt'),
sort (@ltk elt') (map f m).
@@ -654,7 +654,7 @@ Proof.
inversion_clear H; auto.
Qed.
-Hint Resolve mapi_lelistA.
+Hint Resolve mapi_lelistA : core.
Lemma mapi_sorted : forall m (Hm : sort (@ltk elt) m)(f: key ->elt -> elt'),
sort (@ltk elt') (mapi f m).
@@ -781,7 +781,7 @@ Proof.
inversion_clear H; auto.
inversion_clear H0; auto.
Qed.
-Hint Resolve combine_lelistA.
+Hint Resolve combine_lelistA : core.
Lemma combine_sorted :
forall m (Hm : sort (@ltk elt) m) m' (Hm' : sort (@ltk elt') m'),
diff --git a/theories/FSets/FMapWeakList.v b/theories/FSets/FMapWeakList.v
index 6736096509..03dce9666d 100644
--- a/theories/FSets/FMapWeakList.v
+++ b/theories/FSets/FMapWeakList.v
@@ -49,7 +49,7 @@ Proof.
inversion abs.
Qed.
-Hint Resolve empty_1.
+Hint Resolve empty_1 : core.
Lemma empty_NoDup : NoDupA empty.
Proof.
@@ -621,7 +621,7 @@ Proof.
inversion_clear 1.
intros; apply add_NoDup; auto.
Qed.
-Hint Resolve fold_right_pair_NoDup.
+Hint Resolve fold_right_pair_NoDup : core.
Lemma combine_NoDup :
forall m (Hm:NoDupA (@eqk elt) m) m' (Hm':NoDupA (@eqk elt') m'),
diff --git a/theories/FSets/FSetBridge.v b/theories/FSets/FSetBridge.v
index 0c4ecb1f31..3952c28061 100644
--- a/theories/FSets/FSetBridge.v
+++ b/theories/FSets/FSetBridge.v
@@ -137,7 +137,7 @@ Module DepOfNodep (Import M: S) <: Sdep with Module E := M.E.
generalize (E.eq_sym H0); case (Pdec x); case (Pdec y); firstorder.
Qed.
- Hint Resolve compat_P_aux.
+ Hint Resolve compat_P_aux : core.
Definition filter :
forall (P : elt -> Prop) (Pdec : forall x : elt, {P x} + {~ P x}) (s : t),
@@ -467,7 +467,7 @@ Module NodepOfDep (M: Sdep) <: S with Module E := M.E.
Proof.
intros; unfold elements; case (M.elements s); firstorder.
Qed.
- Hint Resolve elements_3.
+ Hint Resolve elements_3 : core.
Lemma elements_3w : forall s : t, NoDupA E.eq (elements s).
Proof. auto. Qed.
@@ -666,7 +666,7 @@ Module NodepOfDep (M: Sdep) <: S with Module E := M.E.
rewrite <- H1; firstorder.
Qed.
- Hint Resolve compat_P_aux.
+ Hint Resolve compat_P_aux : core.
Definition filter (f : elt -> bool) (s : t) : t :=
let (s', _) := filter (P:=fun x => f x = true) (f_dec f) s in s'.
diff --git a/theories/FSets/FSetInterface.v b/theories/FSets/FSetInterface.v
index 0926d3ae9f..fa7f1c5f4e 100644
--- a/theories/FSets/FSetInterface.v
+++ b/theories/FSets/FSetInterface.v
@@ -253,7 +253,7 @@ Module Type WSfun (E : DecidableType).
End Spec.
- Hint Transparent elt.
+ Hint Transparent elt : core.
Hint Resolve mem_1 equal_1 subset_1 empty_1
is_empty_1 choose_1 choose_2 add_1 add_2 remove_1
remove_2 singleton_2 union_1 union_2 union_3
diff --git a/theories/FSets/FSetProperties.v b/theories/FSets/FSetProperties.v
index c9cfb94ace..17f0e25e7a 100644
--- a/theories/FSets/FSetProperties.v
+++ b/theories/FSets/FSetProperties.v
@@ -21,8 +21,8 @@ Require Import DecidableTypeEx FSetFacts FSetDecide.
Set Implicit Arguments.
Unset Strict Implicit.
-Hint Unfold transpose compat_op Proper respectful.
-Hint Extern 1 (Equivalence _) => constructor; congruence.
+Hint Unfold transpose compat_op Proper respectful : core.
+Hint Extern 1 (Equivalence _) => constructor; congruence : core.
(** First, a functor for Weak Sets in functorial version. *)
@@ -732,7 +732,7 @@ Module WProperties_fun (Import E : DecidableType)(M : WSfun E).
Proof.
intros; rewrite cardinal_Empty; auto.
Qed.
- Hint Resolve cardinal_inv_1.
+ Hint Resolve cardinal_inv_1 : core.
Lemma cardinal_inv_2 :
forall s n, cardinal s = S n -> { x : elt | In x s }.
@@ -769,7 +769,7 @@ Module WProperties_fun (Import E : DecidableType)(M : WSfun E).
exact Equal_cardinal.
Qed.
- Hint Resolve Add_add Add_remove Equal_remove cardinal_inv_1 Equal_cardinal.
+ Hint Resolve Add_add Add_remove Equal_remove cardinal_inv_1 Equal_cardinal : core.
(** ** Cardinal and set operators *)
@@ -887,7 +887,7 @@ Module WProperties_fun (Import E : DecidableType)(M : WSfun E).
auto with set.
Qed.
- Hint Resolve subset_cardinal union_cardinal add_cardinal_1 add_cardinal_2.
+ Hint Resolve subset_cardinal union_cardinal add_cardinal_1 add_cardinal_2 : core.
End WProperties_fun.
@@ -952,7 +952,7 @@ Module OrdProperties (M:S).
red; intros x a b H; unfold leb.
f_equal; apply gtb_compat; auto.
Qed.
- Hint Resolve gtb_compat leb_compat.
+ Hint Resolve gtb_compat leb_compat : core.
Lemma elements_split : forall x s,
elements s = elements_lt x s ++ elements_ge x s.
diff --git a/theories/Init/Datatypes.v b/theories/Init/Datatypes.v
index 75f14bb4da..7f0387dd12 100644
--- a/theories/Init/Datatypes.v
+++ b/theories/Init/Datatypes.v
@@ -136,7 +136,7 @@ Defined.
Inductive BoolSpec (P Q : Prop) : bool -> Prop :=
| BoolSpecT : P -> BoolSpec P Q true
| BoolSpecF : Q -> BoolSpec P Q false.
-Hint Constructors BoolSpec.
+Hint Constructors BoolSpec : core.
(********************************************************************)
@@ -344,7 +344,7 @@ Inductive CompareSpec (Peq Plt Pgt : Prop) : comparison -> Prop :=
| CompEq : Peq -> CompareSpec Peq Plt Pgt Eq
| CompLt : Plt -> CompareSpec Peq Plt Pgt Lt
| CompGt : Pgt -> CompareSpec Peq Plt Pgt Gt.
-Hint Constructors CompareSpec.
+Hint Constructors CompareSpec : core.
(** For having clean interfaces after extraction, [CompareSpec] is declared
in Prop. For some situations, it is nonetheless useful to have a
@@ -354,7 +354,7 @@ Inductive CompareSpecT (Peq Plt Pgt : Prop) : comparison -> Type :=
| CompEqT : Peq -> CompareSpecT Peq Plt Pgt Eq
| CompLtT : Plt -> CompareSpecT Peq Plt Pgt Lt
| CompGtT : Pgt -> CompareSpecT Peq Plt Pgt Gt.
-Hint Constructors CompareSpecT.
+Hint Constructors CompareSpecT : core.
Lemma CompareSpec2Type : forall Peq Plt Pgt c,
CompareSpec Peq Plt Pgt c -> CompareSpecT Peq Plt Pgt c.
@@ -371,7 +371,7 @@ Definition CompSpec {A} (eq lt : A->A->Prop)(x y:A) : comparison -> Prop :=
Definition CompSpecT {A} (eq lt : A->A->Prop)(x y:A) : comparison -> Type :=
CompareSpecT (eq x y) (lt x y) (lt y x).
-Hint Unfold CompSpec CompSpecT.
+Hint Unfold CompSpec CompSpecT : core.
Lemma CompSpec2Type : forall A (eq lt:A->A->Prop) x y c,
CompSpec eq lt x y c -> CompSpecT eq lt x y c.
diff --git a/theories/Lists/List.v b/theories/Lists/List.v
index 4614d215eb..d5241e622c 100644
--- a/theories/Lists/List.v
+++ b/theories/Lists/List.v
@@ -219,7 +219,7 @@ Section Facts.
Proof.
auto using app_assoc.
Qed.
- Hint Resolve app_assoc_reverse.
+ Hint Resolve app_assoc_reverse : core.
(* end hide *)
(** [app] commutes with [cons] *)
@@ -1569,19 +1569,19 @@ Section SetIncl.
Variable A : Type.
Definition incl (l m:list A) := forall a:A, In a l -> In a m.
- Hint Unfold incl.
+ Hint Unfold incl : core.
Lemma incl_refl : forall l:list A, incl l l.
Proof.
auto.
Qed.
- Hint Resolve incl_refl.
+ Hint Resolve incl_refl : core.
Lemma incl_tl : forall (a:A) (l m:list A), incl l m -> incl l (a :: m).
Proof.
auto with datatypes.
Qed.
- Hint Immediate incl_tl.
+ Hint Immediate incl_tl : core.
Lemma incl_tran : forall l m n:list A, incl l m -> incl m n -> incl l n.
Proof.
@@ -1592,13 +1592,13 @@ Section SetIncl.
Proof.
auto with datatypes.
Qed.
- Hint Immediate incl_appl.
+ Hint Immediate incl_appl : core.
Lemma incl_appr : forall l m n:list A, incl l n -> incl l (m ++ n).
Proof.
auto with datatypes.
Qed.
- Hint Immediate incl_appr.
+ Hint Immediate incl_appr : core.
Lemma incl_cons :
forall (a:A) (l m:list A), In a m -> incl l m -> incl (a :: l) m.
@@ -1613,7 +1613,7 @@ Section SetIncl.
now_show (In a0 l -> In a0 m).
auto.
Qed.
- Hint Resolve incl_cons.
+ Hint Resolve incl_cons : core.
Lemma incl_app : forall l m n:list A, incl l n -> incl m n -> incl (l ++ m) n.
Proof.
@@ -1621,7 +1621,7 @@ Section SetIncl.
now_show (In a n).
elim (in_app_or _ _ _ H1); auto.
Qed.
- Hint Resolve incl_app.
+ Hint Resolve incl_app : core.
End SetIncl.
@@ -2180,7 +2180,7 @@ Section Exists_Forall.
| Exists_cons_hd : forall x l, P x -> Exists (x::l)
| Exists_cons_tl : forall x l, Exists l -> Exists (x::l).
- Hint Constructors Exists.
+ Hint Constructors Exists : core.
Lemma Exists_exists (l:list A) :
Exists l <-> (exists x, In x l /\ P x).
@@ -2214,7 +2214,7 @@ Section Exists_Forall.
| Forall_nil : Forall nil
| Forall_cons : forall x l, P x -> Forall l -> Forall (x::l).
- Hint Constructors Forall.
+ Hint Constructors Forall : core.
Lemma Forall_forall (l:list A):
Forall l <-> (forall x, In x l -> P x).
@@ -2299,8 +2299,8 @@ Section Exists_Forall.
End Exists_Forall.
-Hint Constructors Exists.
-Hint Constructors Forall.
+Hint Constructors Exists : core.
+Hint Constructors Forall : core.
Section Forall2.
@@ -2314,7 +2314,7 @@ Section Forall2.
| Forall2_cons : forall x y l l',
R x y -> Forall2 l l' -> Forall2 (x::l) (y::l').
- Hint Constructors Forall2.
+ Hint Constructors Forall2 : core.
Theorem Forall2_refl : Forall2 [] [].
Proof. intros; apply Forall2_nil. Qed.
@@ -2348,7 +2348,7 @@ Section Forall2.
Qed.
End Forall2.
-Hint Constructors Forall2.
+Hint Constructors Forall2 : core.
Section ForallPairs.
@@ -2369,7 +2369,7 @@ Section ForallPairs.
| FOP_cons : forall a l,
Forall (R a) l -> ForallOrdPairs l -> ForallOrdPairs (a::l).
- Hint Constructors ForallOrdPairs.
+ Hint Constructors ForallOrdPairs : core.
Lemma ForallOrdPairs_In : forall l,
ForallOrdPairs l ->
diff --git a/theories/Lists/ListSet.v b/theories/Lists/ListSet.v
index cc7d6f5536..3afdd8df27 100644
--- a/theories/Lists/ListSet.v
+++ b/theories/Lists/ListSet.v
@@ -193,7 +193,7 @@ Section first_definitions.
| auto with datatypes ].
Qed.
- Hint Resolve set_add_intro1 set_add_intro2.
+ Hint Resolve set_add_intro1 set_add_intro2 : core.
Lemma set_add_intro :
forall (a b:A) (x:set), a = b \/ set_In a x -> set_In a (set_add b x).
@@ -224,7 +224,7 @@ Section first_definitions.
case H1; trivial.
Qed.
- Hint Resolve set_add_intro set_add_elim set_add_elim2.
+ Hint Resolve set_add_intro set_add_elim set_add_elim2 : core.
Lemma set_add_not_empty : forall (a:A) (x:set), set_add a x <> empty_set.
Proof.
@@ -310,7 +310,7 @@ Section first_definitions.
intros; elim H0; auto with datatypes.
Qed.
- Hint Resolve set_union_intro2 set_union_intro1.
+ Hint Resolve set_union_intro2 set_union_intro1 : core.
Lemma set_union_intro :
forall (a:A) (x y:set),
@@ -393,7 +393,7 @@ Section first_definitions.
eauto with datatypes.
Qed.
- Hint Resolve set_inter_elim1 set_inter_elim2.
+ Hint Resolve set_inter_elim1 set_inter_elim2 : core.
Lemma set_inter_elim :
forall (a:A) (x y:set),
@@ -471,7 +471,7 @@ Section first_definitions.
apply (set_diff_elim1 _ _ _ H).
Qed.
-Hint Resolve set_diff_intro set_diff_trivial.
+Hint Resolve set_diff_intro set_diff_trivial : core.
End first_definitions.
diff --git a/theories/Lists/SetoidList.v b/theories/Lists/SetoidList.v
index 0c5fe55b27..cab4c23df1 100644
--- a/theories/Lists/SetoidList.v
+++ b/theories/Lists/SetoidList.v
@@ -30,7 +30,7 @@ Inductive InA (x : A) : list A -> Prop :=
| InA_cons_hd : forall y l, eqA x y -> InA x (y :: l)
| InA_cons_tl : forall y l, InA x l -> InA x (y :: l).
-Hint Constructors InA.
+Hint Constructors InA : core.
(** TODO: it would be nice to have a generic definition instead
of the previous one. Having [InA = Exists eqA] raises too
@@ -62,7 +62,7 @@ Inductive NoDupA : list A -> Prop :=
| NoDupA_nil : NoDupA nil
| NoDupA_cons : forall x l, ~ InA x l -> NoDupA l -> NoDupA (x::l).
-Hint Constructors NoDupA.
+Hint Constructors NoDupA : core.
(** An alternative definition of [NoDupA] based on [ForallOrdPairs] *)
@@ -93,7 +93,7 @@ Inductive eqlistA : list A -> list A -> Prop :=
| eqlistA_cons : forall x x' l l',
eqA x x' -> eqlistA l l' -> eqlistA (x::l) (x'::l').
-Hint Constructors eqlistA.
+Hint Constructors eqlistA : core.
(** We could also have written [eqlistA = Forall2 eqA]. *)
@@ -107,8 +107,8 @@ Definition eqarefl := (@Equivalence_Reflexive _ _ eqA_equiv).
Definition eqatrans := (@Equivalence_Transitive _ _ eqA_equiv).
Definition eqasym := (@Equivalence_Symmetric _ _ eqA_equiv).
-Hint Resolve eqarefl eqatrans.
-Hint Immediate eqasym.
+Hint Resolve eqarefl eqatrans : core.
+Hint Immediate eqasym : core.
Ltac inv := invlist InA; invlist sort; invlist lelistA; invlist NoDupA.
@@ -154,14 +154,14 @@ Lemma InA_eqA : forall l x y, eqA x y -> InA x l -> InA y l.
Proof.
intros l x y H H'. rewrite <- H. auto.
Qed.
-Hint Immediate InA_eqA.
+Hint Immediate InA_eqA : core.
Lemma In_InA : forall l x, In x l -> InA x l.
Proof.
simple induction l; simpl; intuition.
subst; auto.
Qed.
-Hint Resolve In_InA.
+Hint Resolve In_InA : core.
Lemma InA_split : forall l x, InA x l ->
exists l1 y l2, eqA x y /\ l = l1++y::l2.
@@ -786,12 +786,12 @@ Hypothesis ltA_compat : Proper (eqA==>eqA==>iff) ltA.
Let sotrans := (@StrictOrder_Transitive _ _ ltA_strorder).
-Hint Resolve sotrans.
+Hint Resolve sotrans : core.
Notation InfA:=(lelistA ltA).
Notation SortA:=(sort ltA).
-Hint Constructors lelistA sort.
+Hint Constructors lelistA sort : core.
Lemma InfA_ltA :
forall l x y, ltA x y -> InfA y l -> InfA x l.
@@ -814,7 +814,7 @@ Lemma InfA_eqA l x y : eqA x y -> InfA y l -> InfA x l.
Proof using eqA_equiv ltA_compat.
intros H; now rewrite H.
Qed.
-Hint Immediate InfA_ltA InfA_eqA.
+Hint Immediate InfA_ltA InfA_eqA : core.
Lemma SortA_InfA_InA :
forall l x a, SortA l -> InfA a l -> InA x l -> ltA a x.
@@ -1005,7 +1005,7 @@ Qed.
End Filter.
End Type_with_equality.
-Hint Constructors InA eqlistA NoDupA sort lelistA.
+Hint Constructors InA eqlistA NoDupA sort lelistA : core.
Arguments equivlistA_cons_nil {A} eqA {eqA_equiv} x l _.
Arguments equivlistA_nil_eq {A} eqA {eqA_equiv} l _.
diff --git a/theories/Lists/SetoidPermutation.v b/theories/Lists/SetoidPermutation.v
index 24b96514fd..f5ea303343 100644
--- a/theories/Lists/SetoidPermutation.v
+++ b/theories/Lists/SetoidPermutation.v
@@ -28,7 +28,7 @@ Inductive PermutationA : list A -> list A -> Prop :=
| permA_swap x y l : PermutationA (y :: x :: l) (x :: y :: l)
| permA_trans l₁ l₂ l₃ :
PermutationA l₁ l₂ -> PermutationA l₂ l₃ -> PermutationA l₁ l₃.
-Local Hint Constructors PermutationA.
+Local Hint Constructors PermutationA : core.
Global Instance: Equivalence PermutationA.
Proof.
diff --git a/theories/Logic/JMeq.v b/theories/Logic/JMeq.v
index 25b7811417..3914f44a2c 100644
--- a/theories/Logic/JMeq.v
+++ b/theories/Logic/JMeq.v
@@ -31,7 +31,7 @@ Arguments JMeq_refl {A x} , [A] x.
Register JMeq as core.JMeq.type.
Register JMeq_refl as core.JMeq.refl.
-Hint Resolve JMeq_refl.
+Hint Resolve JMeq_refl : core.
Definition JMeq_hom {A : Type} (x y : A) := JMeq x y.
@@ -42,7 +42,7 @@ Proof.
intros; destruct H; trivial.
Qed.
-Hint Immediate JMeq_sym.
+Hint Immediate JMeq_sym : core.
Register JMeq_sym as core.JMeq.sym.
diff --git a/theories/MSets/MSetAVL.v b/theories/MSets/MSetAVL.v
index aec88f93bf..ac2a143472 100644
--- a/theories/MSets/MSetAVL.v
+++ b/theories/MSets/MSetAVL.v
@@ -305,13 +305,13 @@ Include MSetGenTree.Props X I.
(** Automation and dedicated tactics *)
-Local Hint Immediate MX.eq_sym.
-Local Hint Unfold In lt_tree gt_tree Ok.
-Local Hint Constructors InT bst.
-Local Hint Resolve MX.eq_refl MX.eq_trans MX.lt_trans ok.
-Local Hint Resolve lt_leaf gt_leaf lt_tree_node gt_tree_node.
-Local Hint Resolve lt_tree_not_in lt_tree_trans gt_tree_not_in gt_tree_trans.
-Local Hint Resolve elements_spec2.
+Local Hint Immediate MX.eq_sym : core.
+Local Hint Unfold In lt_tree gt_tree Ok : core.
+Local Hint Constructors InT bst : core.
+Local Hint Resolve MX.eq_refl MX.eq_trans MX.lt_trans ok : core.
+Local Hint Resolve lt_leaf gt_leaf lt_tree_node gt_tree_node : core.
+Local Hint Resolve lt_tree_not_in lt_tree_trans gt_tree_not_in gt_tree_trans : core.
+Local Hint Resolve elements_spec2 : core.
(* Sometimes functional induction will expose too much of
a tree structure. The following tactic allows factoring back
@@ -496,7 +496,7 @@ Proof.
specialize (L m); rewrite remove_min_spec, e0 in L; simpl in L;
[setoid_replace y with x|inv]; eauto.
Qed.
-Local Hint Resolve remove_min_gt_tree.
+Local Hint Resolve remove_min_gt_tree : core.
(** ** Merging two trees *)
diff --git a/theories/MSets/MSetGenTree.v b/theories/MSets/MSetGenTree.v
index 95868861fa..888f9850c1 100644
--- a/theories/MSets/MSetGenTree.v
+++ b/theories/MSets/MSetGenTree.v
@@ -46,7 +46,7 @@ End InfoTyp.
Module Type Ops (X:OrderedType)(Info:InfoTyp).
Definition elt := X.t.
-Hint Transparent elt.
+Hint Transparent elt : core.
Inductive tree : Type :=
| Leaf : tree
@@ -342,11 +342,11 @@ Module Import MX := OrderedTypeFacts X.
Scheme tree_ind := Induction for tree Sort Prop.
Scheme bst_ind := Induction for bst Sort Prop.
-Local Hint Resolve MX.eq_refl MX.eq_trans MX.lt_trans ok.
-Local Hint Immediate MX.eq_sym.
-Local Hint Unfold In lt_tree gt_tree.
-Local Hint Constructors InT bst.
-Local Hint Unfold Ok.
+Local Hint Resolve MX.eq_refl MX.eq_trans MX.lt_trans ok : core.
+Local Hint Immediate MX.eq_sym : core.
+Local Hint Unfold In lt_tree gt_tree : core.
+Local Hint Constructors InT bst : core.
+Local Hint Unfold Ok : core.
(** Automatic treatment of [Ok] hypothesis *)
@@ -432,7 +432,7 @@ Lemma In_1 :
Proof.
induction s; simpl; intuition_in; eauto.
Qed.
-Local Hint Immediate In_1.
+Local Hint Immediate In_1 : core.
Instance In_compat : Proper (X.eq==>eq==>iff) InT.
Proof.
@@ -478,7 +478,7 @@ Proof.
unfold gt_tree; intuition_in; order.
Qed.
-Local Hint Resolve lt_leaf gt_leaf lt_tree_node gt_tree_node.
+Local Hint Resolve lt_leaf gt_leaf lt_tree_node gt_tree_node : core.
Lemma lt_tree_not_in :
forall (x : elt) (t : tree), lt_tree x t -> ~ InT x t.
@@ -516,7 +516,7 @@ Proof.
intros x x' Hx s s' Hs H y Hy. subst. setoid_rewrite <- Hx; auto.
Qed.
-Local Hint Resolve lt_tree_not_in lt_tree_trans gt_tree_not_in gt_tree_trans.
+Local Hint Resolve lt_tree_not_in lt_tree_trans gt_tree_not_in gt_tree_trans : core.
Ltac induct s x :=
induction s as [|i l IHl x' r IHr]; simpl; intros;
@@ -699,7 +699,7 @@ Proof.
intros; unfold elements; apply elements_spec2'; auto.
intros; inversion H0.
Qed.
-Local Hint Resolve elements_spec2.
+Local Hint Resolve elements_spec2 : core.
Lemma elements_spec2w : forall s `(Ok s), NoDupA X.eq (elements s).
Proof.
@@ -1035,7 +1035,7 @@ Qed.
Definition Cmp c x y := CompSpec L.eq L.lt x y c.
-Local Hint Unfold Cmp flip.
+Local Hint Unfold Cmp flip : core.
Lemma compare_end_Cmp :
forall e2, Cmp (compare_end e2) nil (flatten_e e2).
diff --git a/theories/MSets/MSetInterface.v b/theories/MSets/MSetInterface.v
index f0e757157d..a4bbaef52d 100644
--- a/theories/MSets/MSetInterface.v
+++ b/theories/MSets/MSetInterface.v
@@ -884,10 +884,10 @@ Module MakeListOrdering (O:OrderedType).
O.lt x y -> lt_list (x :: s) (y :: s')
| lt_cons_eq : forall x y s s',
O.eq x y -> lt_list s s' -> lt_list (x :: s) (y :: s').
- Hint Constructors lt_list.
+ Hint Constructors lt_list : core.
Definition lt := lt_list.
- Hint Unfold lt.
+ Hint Unfold lt : core.
Instance lt_strorder : StrictOrder lt.
Proof.
@@ -933,13 +933,13 @@ Module MakeListOrdering (O:OrderedType).
left; MO.order. right; rewrite <- E12; auto.
left; MO.order. right; rewrite E12; auto.
Qed.
- Hint Resolve eq_cons.
+ Hint Resolve eq_cons : core.
Lemma cons_CompSpec : forall c x1 x2 l1 l2, O.eq x1 x2 ->
CompSpec eq lt l1 l2 c -> CompSpec eq lt (x1::l1) (x2::l2) c.
Proof.
destruct c; simpl; inversion_clear 2; auto with relations.
Qed.
- Hint Resolve cons_CompSpec.
+ Hint Resolve cons_CompSpec : core.
End MakeListOrdering.
diff --git a/theories/MSets/MSetList.v b/theories/MSets/MSetList.v
index 35fe4cee4e..7b64818b24 100644
--- a/theories/MSets/MSetList.v
+++ b/theories/MSets/MSetList.v
@@ -231,14 +231,14 @@ Module MakeRaw (X: OrderedType) <: RawSets X.
Notation In := (InA X.eq).
Existing Instance X.eq_equiv.
- Hint Extern 20 => solve [order].
+ Hint Extern 20 => solve [order] : core.
Definition IsOk s := Sort s.
Class Ok (s:t) : Prop := ok : Sort s.
- Hint Resolve ok.
- Hint Unfold Ok.
+ Hint Resolve ok : core.
+ Hint Unfold Ok : core.
Instance Sort_Ok s `(Hs : Sort s) : Ok s := { ok := Hs }.
@@ -276,7 +276,7 @@ Module MakeRaw (X: OrderedType) <: RawSets X.
destruct H; constructor; tauto.
Qed.
- Hint Extern 1 (Ok _) => rewrite <- isok_iff.
+ Hint Extern 1 (Ok _) => rewrite <- isok_iff : core.
Ltac inv_ok := match goal with
| H:sort X.lt (_ :: _) |- _ => inversion_clear H; inv_ok
@@ -326,7 +326,7 @@ Module MakeRaw (X: OrderedType) <: RawSets X.
intuition.
intros; elim_compare x a; inv; intuition.
Qed.
- Hint Resolve add_inf.
+ Hint Resolve add_inf : core.
Global Instance add_ok s x : forall `(Ok s), Ok (add x s).
Proof.
@@ -353,7 +353,7 @@ Module MakeRaw (X: OrderedType) <: RawSets X.
intros; elim_compare x a; inv; auto.
apply Inf_lt with a; auto.
Qed.
- Hint Resolve remove_inf.
+ Hint Resolve remove_inf : core.
Global Instance remove_ok s x : forall `(Ok s), Ok (remove x s).
Proof.
@@ -396,7 +396,7 @@ Module MakeRaw (X: OrderedType) <: RawSets X.
Proof.
induction2.
Qed.
- Hint Resolve union_inf.
+ Hint Resolve union_inf : core.
Global Instance union_ok s s' : forall `(Ok s, Ok s'), Ok (union s s').
Proof.
@@ -422,7 +422,7 @@ Module MakeRaw (X: OrderedType) <: RawSets X.
apply Hrec'; auto.
apply Inf_lt with x'; auto.
Qed.
- Hint Resolve inter_inf.
+ Hint Resolve inter_inf : core.
Global Instance inter_ok s s' : forall `(Ok s, Ok s'), Ok (inter s s').
Proof.
@@ -452,7 +452,7 @@ Module MakeRaw (X: OrderedType) <: RawSets X.
apply Hrec'; auto.
apply Inf_lt with x'; auto.
Qed.
- Hint Resolve diff_inf.
+ Hint Resolve diff_inf : core.
Global Instance diff_ok s s' : forall `(Ok s, Ok s'), Ok (diff s s').
Proof.
diff --git a/theories/MSets/MSetProperties.v b/theories/MSets/MSetProperties.v
index 3c7dea736b..29e57ff0a2 100644
--- a/theories/MSets/MSetProperties.v
+++ b/theories/MSets/MSetProperties.v
@@ -21,7 +21,7 @@ Require Import DecidableTypeEx OrdersLists MSetFacts MSetDecide.
Set Implicit Arguments.
Unset Strict Implicit.
-Hint Unfold transpose.
+Hint Unfold transpose : core.
(** First, a functor for Weak Sets in functorial version. *)
@@ -735,7 +735,7 @@ Module WPropertiesOn (Import E : DecidableType)(M : WSetsOn E).
Proof.
intros; rewrite cardinal_Empty; auto.
Qed.
- Hint Resolve cardinal_inv_1.
+ Hint Resolve cardinal_inv_1 : core.
Lemma cardinal_inv_2 :
forall s n, cardinal s = S n -> { x : elt | In x s }.
@@ -774,7 +774,7 @@ Module WPropertiesOn (Import E : DecidableType)(M : WSetsOn E).
exact Equal_cardinal.
Qed.
- Hint Resolve Add_add Add_remove Equal_remove cardinal_inv_1 Equal_cardinal.
+ Hint Resolve Add_add Add_remove Equal_remove cardinal_inv_1 Equal_cardinal : core.
(** ** Cardinal and set operators *)
@@ -898,7 +898,7 @@ Module WPropertiesOn (Import E : DecidableType)(M : WSetsOn E).
auto with set.
Qed.
- Hint Resolve subset_cardinal union_cardinal add_cardinal_1 add_cardinal_2.
+ Hint Resolve subset_cardinal union_cardinal add_cardinal_1 add_cardinal_2 : core.
End WPropertiesOn.
@@ -922,7 +922,7 @@ Module OrdProperties (M:Sets).
Import M.E.
Import M.
- Hint Resolve elements_spec2.
+ Hint Resolve elements_spec2 : core.
Hint Immediate
min_elt_spec1 min_elt_spec2 min_elt_spec3
max_elt_spec1 max_elt_spec2 max_elt_spec3 : set.
@@ -961,7 +961,7 @@ Module OrdProperties (M:Sets).
Proof.
intros a b H; unfold leb. rewrite H; auto.
Qed.
- Hint Resolve gtb_compat leb_compat.
+ Hint Resolve gtb_compat leb_compat : core.
Lemma elements_split : forall x s,
elements s = elements_lt x s ++ elements_ge x s.
diff --git a/theories/MSets/MSetRBT.v b/theories/MSets/MSetRBT.v
index eab01a55b0..f9105fdf74 100644
--- a/theories/MSets/MSetRBT.v
+++ b/theories/MSets/MSetRBT.v
@@ -450,13 +450,13 @@ Include MSetGenTree.Props X Color.
Local Notation Rd := (Node Red).
Local Notation Bk := (Node Black).
-Local Hint Immediate MX.eq_sym.
-Local Hint Unfold In lt_tree gt_tree Ok.
-Local Hint Constructors InT bst.
-Local Hint Resolve MX.eq_refl MX.eq_trans MX.lt_trans ok.
-Local Hint Resolve lt_leaf gt_leaf lt_tree_node gt_tree_node.
-Local Hint Resolve lt_tree_not_in lt_tree_trans gt_tree_not_in gt_tree_trans.
-Local Hint Resolve elements_spec2.
+Local Hint Immediate MX.eq_sym : core.
+Local Hint Unfold In lt_tree gt_tree Ok : core.
+Local Hint Constructors InT bst : core.
+Local Hint Resolve MX.eq_refl MX.eq_trans MX.lt_trans ok : core.
+Local Hint Resolve lt_leaf gt_leaf lt_tree_node gt_tree_node : core.
+Local Hint Resolve lt_tree_not_in lt_tree_trans gt_tree_not_in gt_tree_trans : core.
+Local Hint Resolve elements_spec2 : core.
(** ** Singleton set *)
@@ -1136,7 +1136,7 @@ Record INV l1 l2 acc : Prop := {
acc_sorted : sort X.lt acc;
l1_lt_acc x y : InA X.eq x l1 -> InA X.eq y acc -> X.lt x y;
l2_lt_acc x y : InA X.eq x l2 -> InA X.eq y acc -> X.lt x y}.
-Local Hint Resolve l1_sorted l2_sorted acc_sorted.
+Local Hint Resolve l1_sorted l2_sorted acc_sorted : core.
Lemma INV_init s1 s2 `(Ok s1, Ok s2) :
INV (rev_elements s1) (rev_elements s2) nil.
@@ -1506,8 +1506,8 @@ Class Rbt (t:tree) := RBT : exists d, rbt d t.
(** ** Basic tactics and results about red-black *)
Scheme rbt_ind := Induction for rbt Sort Prop.
-Local Hint Constructors rbt rrt arbt.
-Local Hint Extern 0 (notred _) => (exact I).
+Local Hint Constructors rbt rrt arbt : core.
+Local Hint Extern 0 (notred _) => (exact I) : core.
Ltac invrb := intros; invtree rrt; invtree rbt; try contradiction.
Ltac desarb := match goal with H:arbt _ _ |- _ => destruct H end.
Ltac nonzero n := destruct n as [|n]; [try split; invrb|].
@@ -1519,7 +1519,7 @@ Proof.
destruct l, r; descolor; invrb; auto.
Qed.
-Local Hint Resolve rr_nrr_rb.
+Local Hint Resolve rr_nrr_rb : core.
Lemma arb_nrr_rb n t :
arbt n t -> notredred t -> rbt n t.
@@ -1533,7 +1533,7 @@ Proof.
destruct 1; destruct t; descolor; invrb; auto.
Qed.
-Local Hint Resolve arb_nrr_rb arb_nr_rb.
+Local Hint Resolve arb_nrr_rb arb_nr_rb : core.
(** ** A Red-Black tree has indeed a logarithmic depth *)
diff --git a/theories/MSets/MSetWeakList.v b/theories/MSets/MSetWeakList.v
index 8df1ff1cdb..19058a767e 100644
--- a/theories/MSets/MSetWeakList.v
+++ b/theories/MSets/MSetWeakList.v
@@ -123,15 +123,15 @@ Module MakeRaw (X:DecidableType) <: WRawSets X.
Let eqr:= (@Equivalence_Reflexive _ _ X.eq_equiv).
Let eqsym:= (@Equivalence_Symmetric _ _ X.eq_equiv).
Let eqtrans:= (@Equivalence_Transitive _ _ X.eq_equiv).
- Hint Resolve eqr eqtrans.
- Hint Immediate eqsym.
+ Hint Resolve eqr eqtrans : core.
+ Hint Immediate eqsym : core.
Definition IsOk := NoDup.
Class Ok (s:t) : Prop := ok : NoDup s.
- Hint Unfold Ok.
- Hint Resolve ok.
+ Hint Unfold Ok : core.
+ Hint Resolve ok : core.
Instance NoDup_Ok s (nd : NoDup s) : Ok s := { ok := nd }.
diff --git a/theories/Numbers/Cyclic/ZModulo/ZModulo.v b/theories/Numbers/Cyclic/ZModulo/ZModulo.v
index 784e81758c..4bcd22543f 100644
--- a/theories/Numbers/Cyclic/ZModulo/ZModulo.v
+++ b/theories/Numbers/Cyclic/ZModulo/ZModulo.v
@@ -60,7 +60,7 @@ Section ZModulo.
apply Z.lt_gt.
unfold wB, base; auto with zarith.
Qed.
- Hint Resolve wB_pos.
+ Hint Resolve wB_pos : core.
Lemma spec_to_Z_1 : forall x, 0 <= [|x|].
Proof.
@@ -71,7 +71,7 @@ Section ZModulo.
Proof.
unfold to_Z; intros; destruct (Z_mod_lt x wB wB_pos); auto.
Qed.
- Hint Resolve spec_to_Z_1 spec_to_Z_2.
+ Hint Resolve spec_to_Z_1 spec_to_Z_2 : core.
Lemma spec_to_Z : forall x, 0 <= [|x|] < wB.
Proof.
@@ -732,7 +732,7 @@ Section ZModulo.
Proof.
induction p; simpl; auto with zarith.
Qed.
- Hint Resolve Ptail_pos.
+ Hint Resolve Ptail_pos : core.
Lemma Ptail_bounded : forall p d, Zpos p < 2^(Zpos d) -> Ptail p < Zpos d.
Proof.
diff --git a/theories/Numbers/Natural/Abstract/NDefOps.v b/theories/Numbers/Natural/Abstract/NDefOps.v
index 8e1be0d702..4539dea276 100644
--- a/theories/Numbers/Natural/Abstract/NDefOps.v
+++ b/theories/Numbers/Natural/Abstract/NDefOps.v
@@ -383,7 +383,7 @@ f_equiv. apply E, half_decrease.
rewrite two_succ, <- not_true_iff_false, ltb_lt, nlt_ge, le_succ_l in H.
order'.
Qed.
-Hint Resolve log_good_step.
+Hint Resolve log_good_step : core.
Theorem log_init : forall n, n < 2 -> log n == 0.
Proof.
diff --git a/theories/Program/Basics.v b/theories/Program/Basics.v
index c2316689fc..d86112abc0 100644
--- a/theories/Program/Basics.v
+++ b/theories/Program/Basics.v
@@ -26,7 +26,7 @@ Arguments id {A} x.
Definition compose {A B C} (g : B -> C) (f : A -> B) :=
fun x : A => g (f x).
-Hint Unfold compose.
+Hint Unfold compose : core.
Declare Scope program_scope.
diff --git a/theories/Program/Wf.v b/theories/Program/Wf.v
index 8479b9a2bb..f9d23e3cf6 100644
--- a/theories/Program/Wf.v
+++ b/theories/Program/Wf.v
@@ -110,7 +110,7 @@ Section Measure_well_founded.
End Measure_well_founded.
-Hint Resolve measure_wf.
+Hint Resolve measure_wf : core.
Section Fix_rects.
diff --git a/theories/QArith/Qcanon.v b/theories/QArith/Qcanon.v
index 81c318138e..f18fca99a0 100644
--- a/theories/QArith/Qcanon.v
+++ b/theories/QArith/Qcanon.v
@@ -66,7 +66,7 @@ Proof.
rewrite hq, hq' in H'. subst q'. f_equal.
apply eq_proofs_unicity. intros. repeat decide equality.
Qed.
-Hint Resolve Qc_is_canon.
+Hint Resolve Qc_is_canon : core.
Theorem Qc_decomp: forall q q': Qc, (q:Q) = q' -> q = q'.
Proof.
diff --git a/theories/QArith/Qreals.v b/theories/QArith/Qreals.v
index c832962590..b4c869b4dd 100644
--- a/theories/QArith/Qreals.v
+++ b/theories/QArith/Qreals.v
@@ -21,7 +21,7 @@ intros.
now apply not_O_IZR.
Qed.
-Hint Resolve IZR_nz Rmult_integral_contrapositive.
+Hint Resolve IZR_nz Rmult_integral_contrapositive : core.
Lemma eqR_Qeq : forall x y : Q, Q2R x = Q2R y -> x==y.
Proof.
diff --git a/theories/Reals/RIneq.v b/theories/Reals/RIneq.v
index 59a1049654..ec283b886e 100644
--- a/theories/Reals/RIneq.v
+++ b/theories/Reals/RIneq.v
@@ -1087,7 +1087,7 @@ Proof.
replace (r2 + r1 + - r2) with r1 by ring.
exact H.
Qed.
-Hint Resolve Ropp_gt_lt_contravar.
+Hint Resolve Ropp_gt_lt_contravar : core.
Lemma Ropp_lt_gt_contravar : forall r1 r2, r1 < r2 -> - r1 > - r2.
Proof.
@@ -1204,7 +1204,7 @@ Lemma Rmult_lt_compat_r : forall r r1 r2, 0 < r -> r1 < r2 -> r1 * r < r2 * r.
Proof.
intros; rewrite (Rmult_comm r1 r); rewrite (Rmult_comm r2 r); auto with real.
Qed.
-Hint Resolve Rmult_lt_compat_r.
+Hint Resolve Rmult_lt_compat_r : core.
Lemma Rmult_gt_compat_r : forall r r1 r2, r > 0 -> r1 > r2 -> r1 * r > r2 * r.
Proof. eauto using Rmult_lt_compat_r with rorders. Qed.
diff --git a/theories/Sets/Cpo.v b/theories/Sets/Cpo.v
index 3977097e8c..61fe55770b 100644
--- a/theories/Sets/Cpo.v
+++ b/theories/Sets/Cpo.v
@@ -95,7 +95,7 @@ End Bounds.
Hint Resolve Totally_ordered_definition Upper_Bound_definition
Lower_Bound_definition Lub_definition Glb_definition Bottom_definition
Definition_of_Complete Definition_of_Complete
- Definition_of_Conditionally_complete.
+ Definition_of_Conditionally_complete : core.
Section Specific_orders.
Variable U : Type.
diff --git a/theories/Sets/Infinite_sets.v b/theories/Sets/Infinite_sets.v
index bdeeb6a7c7..a0271a88a3 100644
--- a/theories/Sets/Infinite_sets.v
+++ b/theories/Sets/Infinite_sets.v
@@ -46,7 +46,7 @@ Section Approx.
Defn_of_Approximant : Finite U X -> Included U X A -> Approximant A X.
End Approx.
-Hint Resolve Defn_of_Approximant.
+Hint Resolve Defn_of_Approximant : core.
Section Infinite_sets.
Variable U : Type.
diff --git a/theories/Sets/Powerset.v b/theories/Sets/Powerset.v
index 88bcd6555c..50a7e401f8 100644
--- a/theories/Sets/Powerset.v
+++ b/theories/Sets/Powerset.v
@@ -38,43 +38,43 @@ Variable U : Type.
Inductive Power_set (A:Ensemble U) : Ensemble (Ensemble U) :=
Definition_of_Power_set :
forall X:Ensemble U, Included U X A -> In (Ensemble U) (Power_set A) X.
-Hint Resolve Definition_of_Power_set.
+Hint Resolve Definition_of_Power_set : core.
Theorem Empty_set_minimal : forall X:Ensemble U, Included U (Empty_set U) X.
intro X; red.
intros x H'; elim H'.
Qed.
-Hint Resolve Empty_set_minimal.
+Hint Resolve Empty_set_minimal : core.
Theorem Power_set_Inhabited :
forall X:Ensemble U, Inhabited (Ensemble U) (Power_set X).
intro X.
apply Inhabited_intro with (Empty_set U); auto with sets.
Qed.
-Hint Resolve Power_set_Inhabited.
+Hint Resolve Power_set_Inhabited : core.
Theorem Inclusion_is_an_order : Order (Ensemble U) (Included U).
auto 6 with sets.
Qed.
-Hint Resolve Inclusion_is_an_order.
+Hint Resolve Inclusion_is_an_order : core.
Theorem Inclusion_is_transitive : Transitive (Ensemble U) (Included U).
elim Inclusion_is_an_order; auto with sets.
Qed.
-Hint Resolve Inclusion_is_transitive.
+Hint Resolve Inclusion_is_transitive : core.
Definition Power_set_PO : Ensemble U -> PO (Ensemble U).
intro A; try assumption.
apply Definition_of_PO with (Power_set A) (Included U); auto with sets.
Defined.
-Hint Unfold Power_set_PO.
+Hint Unfold Power_set_PO : core.
Theorem Strict_Rel_is_Strict_Included :
same_relation (Ensemble U) (Strict_Included U)
(Strict_Rel_of (Ensemble U) (Power_set_PO (Full_set U))).
auto with sets.
Qed.
-Hint Resolve Strict_Rel_Transitive Strict_Rel_is_Strict_Included.
+Hint Resolve Strict_Rel_Transitive Strict_Rel_is_Strict_Included : core.
Lemma Strict_inclusion_is_transitive_with_inclusion :
forall x y z:Ensemble U,
@@ -109,7 +109,7 @@ Theorem Empty_set_is_Bottom :
forall A:Ensemble U, Bottom (Ensemble U) (Power_set_PO A) (Empty_set U).
intro A; apply Bottom_definition; simpl; auto with sets.
Qed.
-Hint Resolve Empty_set_is_Bottom.
+Hint Resolve Empty_set_is_Bottom : core.
Theorem Union_minimal :
forall a b X:Ensemble U,
@@ -117,7 +117,7 @@ Theorem Union_minimal :
intros a b X H' H'0; red.
intros x H'1; elim H'1; auto with sets.
Qed.
-Hint Resolve Union_minimal.
+Hint Resolve Union_minimal : core.
Theorem Intersection_maximal :
forall a b X:Ensemble U,
@@ -145,7 +145,7 @@ intros a b; red.
intros x H'; elim H'; auto with sets.
Qed.
Hint Resolve Union_increases_l Union_increases_r Intersection_decreases_l
- Intersection_decreases_r.
+ Intersection_decreases_r : core.
Theorem Union_is_Lub :
forall A a b:Ensemble U,
diff --git a/theories/Sets/Relations_1_facts.v b/theories/Sets/Relations_1_facts.v
index 296ec42add..d275487e15 100644
--- a/theories/Sets/Relations_1_facts.v
+++ b/theories/Sets/Relations_1_facts.v
@@ -52,7 +52,7 @@ intros x y z h; elim h; intros H'3 H'4; clear h.
intro h; elim h; intros H'5 H'6; clear h.
split; apply H'1 with y; auto 10 with sets.
Qed.
-Hint Resolve Equiv_from_preorder.
+Hint Resolve Equiv_from_preorder : core.
Theorem Equiv_from_order :
forall (U:Type) (R:Relation U),
@@ -60,21 +60,21 @@ Theorem Equiv_from_order :
Proof.
intros U R H'; elim H'; auto 10 with sets.
Qed.
-Hint Resolve Equiv_from_order.
+Hint Resolve Equiv_from_order : core.
Theorem contains_is_preorder :
forall U:Type, Preorder (Relation U) (contains U).
Proof.
auto 10 with sets.
Qed.
-Hint Resolve contains_is_preorder.
+Hint Resolve contains_is_preorder : core.
Theorem same_relation_is_equivalence :
forall U:Type, Equivalence (Relation U) (same_relation U).
Proof.
unfold same_relation at 1; auto 10 with sets.
Qed.
-Hint Resolve same_relation_is_equivalence.
+Hint Resolve same_relation_is_equivalence : core.
Theorem cong_reflexive_same_relation :
forall (U:Type) (R R':Relation U),
diff --git a/theories/Sets/Relations_3_facts.v b/theories/Sets/Relations_3_facts.v
index 0c1f670d0e..18ea019526 100644
--- a/theories/Sets/Relations_3_facts.v
+++ b/theories/Sets/Relations_3_facts.v
@@ -38,7 +38,7 @@ Proof.
intros U R x y H'; red.
exists y; auto with sets.
Qed.
-Hint Resolve Rstar_imp_coherent.
+Hint Resolve Rstar_imp_coherent : core.
Theorem coherent_symmetric :
forall (U:Type) (R:Relation U), Symmetric U (coherent U R).
diff --git a/theories/Sets/Uniset.v b/theories/Sets/Uniset.v
index 7940bda1a7..0ff304ed6b 100644
--- a/theories/Sets/Uniset.v
+++ b/theories/Sets/Uniset.v
@@ -41,21 +41,21 @@ Definition Singleton (a:A) :=
end).
Definition In (s:uniset) (a:A) : Prop := charac s a = true.
-Hint Unfold In.
+Hint Unfold In : core.
(** uniset inclusion *)
Definition incl (s1 s2:uniset) := forall a:A, leb (charac s1 a) (charac s2 a).
-Hint Unfold incl.
+Hint Unfold incl : core.
(** uniset equality *)
Definition seq (s1 s2:uniset) := forall a:A, charac s1 a = charac s2 a.
-Hint Unfold seq.
+Hint Unfold seq : core.
Lemma leb_refl : forall b:bool, leb b b.
Proof.
destruct b; simpl; auto.
Qed.
-Hint Resolve leb_refl.
+Hint Resolve leb_refl : core.
Lemma incl_left : forall s1 s2:uniset, seq s1 s2 -> incl s1 s2.
Proof.
@@ -71,7 +71,7 @@ Lemma seq_refl : forall x:uniset, seq x x.
Proof.
destruct x; unfold seq; auto.
Qed.
-Hint Resolve seq_refl.
+Hint Resolve seq_refl : core.
Lemma seq_trans : forall x y z:uniset, seq x y -> seq y z -> seq x z.
Proof.
@@ -94,21 +94,21 @@ Lemma union_empty_left : forall x:uniset, seq x (union Emptyset x).
Proof.
unfold seq; unfold union; simpl; auto.
Qed.
-Hint Resolve union_empty_left.
+Hint Resolve union_empty_left : core.
Lemma union_empty_right : forall x:uniset, seq x (union x Emptyset).
Proof.
unfold seq; unfold union; simpl.
intros x a; rewrite (orb_b_false (charac x a)); auto.
Qed.
-Hint Resolve union_empty_right.
+Hint Resolve union_empty_right : core.
Lemma union_comm : forall x y:uniset, seq (union x y) (union y x).
Proof.
unfold seq; unfold charac; unfold union.
destruct x; destruct y; auto with bool.
Qed.
-Hint Resolve union_comm.
+Hint Resolve union_comm : core.
Lemma union_ass :
forall x y z:uniset, seq (union (union x y) z) (union x (union y z)).
@@ -116,7 +116,7 @@ Proof.
unfold seq; unfold union; unfold charac.
destruct x; destruct y; destruct z; auto with bool.
Qed.
-Hint Resolve union_ass.
+Hint Resolve union_ass : core.
Lemma seq_left : forall x y z:uniset, seq x y -> seq (union x z) (union y z).
Proof.
@@ -124,7 +124,7 @@ unfold seq; unfold union; unfold charac.
destruct x; destruct y; destruct z.
intros; elim H; auto.
Qed.
-Hint Resolve seq_left.
+Hint Resolve seq_left : core.
Lemma seq_right : forall x y z:uniset, seq x y -> seq (union z x) (union z y).
Proof.
@@ -132,7 +132,7 @@ unfold seq; unfold union; unfold charac.
destruct x; destruct y; destruct z.
intros; elim H; auto.
Qed.
-Hint Resolve seq_right.
+Hint Resolve seq_right : core.
(** All the proofs that follow duplicate [Multiset_of_A] *)
diff --git a/theories/Sorting/Heap.v b/theories/Sorting/Heap.v
index 2ef162be4e..6a22501afa 100644
--- a/theories/Sorting/Heap.v
+++ b/theories/Sorting/Heap.v
@@ -36,8 +36,8 @@ Section defs.
Hypothesis leA_trans : forall x y z:A, leA x y -> leA y z -> leA x z.
Hypothesis leA_antisym : forall x y:A, leA x y -> leA y x -> eqA x y.
- Hint Resolve leA_refl.
- Hint Immediate eqA_dec leA_dec leA_antisym.
+ Hint Resolve leA_refl : core.
+ Hint Immediate eqA_dec leA_dec leA_antisym : core.
Let emptyBag := EmptyBag A.
Let singletonBag := SingletonBag _ eqA_dec.
diff --git a/theories/Sorting/Permutation.v b/theories/Sorting/Permutation.v
index 7b99b3626f..f5bc9eee4e 100644
--- a/theories/Sorting/Permutation.v
+++ b/theories/Sorting/Permutation.v
@@ -31,7 +31,7 @@ Inductive Permutation : list A -> list A -> Prop :=
| perm_trans l l' l'' :
Permutation l l' -> Permutation l' l'' -> Permutation l l''.
-Local Hint Constructors Permutation.
+Local Hint Constructors Permutation : core.
(** Some facts about [Permutation] *)
@@ -71,13 +71,13 @@ Qed.
End Permutation.
-Hint Resolve Permutation_refl perm_nil perm_skip.
+Hint Resolve Permutation_refl perm_nil perm_skip : core.
(* These hints do not reduce the size of the problem to solve and they
must be used with care to avoid combinatoric explosions *)
-Local Hint Resolve perm_swap perm_trans.
-Local Hint Resolve Permutation_sym Permutation_trans.
+Local Hint Resolve perm_swap perm_trans : core.
+Local Hint Resolve Permutation_sym Permutation_trans : core.
(* This provides reflexivity, symmetry and transitivity and rewriting
on morphims to come *)
@@ -156,7 +156,7 @@ Qed.
Lemma Permutation_cons_append : forall (l : list A) x,
Permutation (x :: l) (l ++ x :: nil).
Proof. induction l; intros; auto. simpl. rewrite <- IHl; auto. Qed.
-Local Hint Resolve Permutation_cons_append.
+Local Hint Resolve Permutation_cons_append : core.
Theorem Permutation_app_comm : forall (l l' : list A),
Permutation (l ++ l') (l' ++ l).
@@ -166,7 +166,7 @@ Proof.
rewrite app_comm_cons, Permutation_cons_append.
now rewrite <- app_assoc.
Qed.
-Local Hint Resolve Permutation_app_comm.
+Local Hint Resolve Permutation_app_comm : core.
Theorem Permutation_cons_app : forall (l l1 l2:list A) a,
Permutation l (l1 ++ l2) -> Permutation (a :: l) (l1 ++ a :: l2).
@@ -175,7 +175,7 @@ Proof.
rewrite app_comm_cons, Permutation_cons_append.
now rewrite <- app_assoc.
Qed.
-Local Hint Resolve Permutation_cons_app.
+Local Hint Resolve Permutation_cons_app : core.
Lemma Permutation_Add a l l' : Add a l l' -> Permutation (a::l) l'.
Proof.
@@ -188,7 +188,7 @@ Theorem Permutation_middle : forall (l1 l2:list A) a,
Proof.
auto.
Qed.
-Local Hint Resolve Permutation_middle.
+Local Hint Resolve Permutation_middle : core.
Theorem Permutation_rev : forall (l : list A), Permutation l (rev l).
Proof.
diff --git a/theories/Sorting/Sorted.v b/theories/Sorting/Sorted.v
index 89e9c7f3e1..6782dd9ca3 100644
--- a/theories/Sorting/Sorted.v
+++ b/theories/Sorting/Sorted.v
@@ -137,8 +137,8 @@ Section defs.
End defs.
-Hint Constructors HdRel.
-Hint Constructors Sorted.
+Hint Constructors HdRel : core.
+Hint Constructors Sorted : core.
(* begin hide *)
(* Compatibility with deprecated file Sorting.v *)
diff --git a/theories/Structures/DecidableType.v b/theories/Structures/DecidableType.v
index 24333ad815..f82ca5fa3c 100644
--- a/theories/Structures/DecidableType.v
+++ b/theories/Structures/DecidableType.v
@@ -38,8 +38,8 @@ Module KeyDecidableType(D:DecidableType).
Definition eqke (p p':key*elt) :=
eq (fst p) (fst p') /\ (snd p) = (snd p').
- Hint Unfold eqk eqke.
- Hint Extern 2 (eqke ?a ?b) => split.
+ Hint Unfold eqk eqke : core.
+ Hint Extern 2 (eqke ?a ?b) => split : core.
(* eqke is stricter than eqk *)
@@ -70,8 +70,8 @@ Module KeyDecidableType(D:DecidableType).
unfold eqke; intuition; [ eauto | congruence ].
Qed.
- Hint Resolve eqk_trans eqke_trans eqk_refl eqke_refl.
- Hint Immediate eqk_sym eqke_sym.
+ Hint Resolve eqk_trans eqke_trans eqk_refl eqke_refl : core.
+ Hint Immediate eqk_sym eqke_sym : core.
Global Instance eqk_equiv : Equivalence eqk.
Proof. split; eauto. Qed.
@@ -84,7 +84,7 @@ Module KeyDecidableType(D:DecidableType).
Proof.
unfold eqke; induction 1; intuition.
Qed.
- Hint Resolve InA_eqke_eqk.
+ Hint Resolve InA_eqke_eqk : core.
Lemma InA_eqk : forall p q m, eqk p q -> InA eqk p m -> InA eqk q m.
Proof.
@@ -94,7 +94,7 @@ Module KeyDecidableType(D:DecidableType).
Definition MapsTo (k:key)(e:elt):= InA eqke (k,e).
Definition In k m := exists e:elt, MapsTo k e m.
- Hint Unfold MapsTo In.
+ Hint Unfold MapsTo In : core.
(* An alternative formulation for [In k l] is [exists e, InA eqk (k,e) l] *)
@@ -140,13 +140,13 @@ Module KeyDecidableType(D:DecidableType).
End Elt.
- Hint Unfold eqk eqke.
- Hint Extern 2 (eqke ?a ?b) => split.
- Hint Resolve eqk_trans eqke_trans eqk_refl eqke_refl.
- Hint Immediate eqk_sym eqke_sym.
- Hint Resolve InA_eqke_eqk.
- Hint Unfold MapsTo In.
- Hint Resolve In_inv_2 In_inv_3.
+ Hint Unfold eqk eqke : core.
+ Hint Extern 2 (eqke ?a ?b) => split : core.
+ Hint Resolve eqk_trans eqke_trans eqk_refl eqke_refl : core.
+ Hint Immediate eqk_sym eqke_sym : core.
+ Hint Resolve InA_eqke_eqk : core.
+ Hint Unfold MapsTo In : core.
+ Hint Resolve In_inv_2 In_inv_3 : core.
End KeyDecidableType.
diff --git a/theories/Structures/Equalities.v b/theories/Structures/Equalities.v
index 5f60a979c6..4143dba547 100644
--- a/theories/Structures/Equalities.v
+++ b/theories/Structures/Equalities.v
@@ -53,8 +53,8 @@ Module Type IsEqOrig (Import E:Eq').
Axiom eq_refl : forall x : t, x==x.
Axiom eq_sym : forall x y : t, x==y -> y==x.
Axiom eq_trans : forall x y z : t, x==y -> y==z -> x==z.
- Hint Immediate eq_sym.
- Hint Resolve eq_refl eq_trans.
+ Hint Immediate eq_sym : core.
+ Hint Resolve eq_refl eq_trans : core.
End IsEqOrig.
(** * Types with decidable equality *)
diff --git a/theories/Structures/EqualitiesFacts.v b/theories/Structures/EqualitiesFacts.v
index 7b6ee2eaca..c738b57f44 100644
--- a/theories/Structures/EqualitiesFacts.v
+++ b/theories/Structures/EqualitiesFacts.v
@@ -22,7 +22,7 @@ Module KeyDecidableType(D:DecidableType).
Definition eqk {elt} : relation (key*elt) := D.eq @@1.
Definition eqke {elt} : relation (key*elt) := D.eq * Logic.eq.
- Hint Unfold eqk eqke.
+ Hint Unfold eqk eqke : core.
(** eqk, eqke are equalities *)
@@ -60,7 +60,7 @@ Module KeyDecidableType(D:DecidableType).
Lemma eqk_1 {elt} k k' (e e':elt) : eqk (k,e) (k',e') -> D.eq k k'.
Proof. trivial. Qed.
- Hint Resolve eqke_1 eqke_2 eqk_1.
+ Hint Resolve eqke_1 eqke_2 eqk_1 : core.
(* Additional facts *)
@@ -69,7 +69,7 @@ Module KeyDecidableType(D:DecidableType).
Proof.
induction 1; firstorder.
Qed.
- Hint Resolve InA_eqke_eqk.
+ Hint Resolve InA_eqke_eqk : core.
Lemma InA_eqk_eqke {elt} p (m:list (key*elt)) :
InA eqk p m -> exists q, eqk p q /\ InA eqke q m.
@@ -86,7 +86,7 @@ Module KeyDecidableType(D:DecidableType).
Definition MapsTo {elt} (k:key)(e:elt):= InA eqke (k,e).
Definition In {elt} k m := exists e:elt, MapsTo k e m.
- Hint Unfold MapsTo In.
+ Hint Unfold MapsTo In : core.
(* Alternative formulations for [In k l] *)
@@ -167,9 +167,9 @@ Module KeyDecidableType(D:DecidableType).
eauto with *.
Qed.
- Hint Extern 2 (eqke ?a ?b) => split.
- Hint Resolve InA_eqke_eqk.
- Hint Resolve In_inv_2 In_inv_3.
+ Hint Extern 2 (eqke ?a ?b) => split : core.
+ Hint Resolve InA_eqke_eqk : core.
+ Hint Resolve In_inv_2 In_inv_3 : core.
End KeyDecidableType.
diff --git a/theories/Structures/OrderedType.v b/theories/Structures/OrderedType.v
index f6fc247d5a..d000b75bf4 100644
--- a/theories/Structures/OrderedType.v
+++ b/theories/Structures/OrderedType.v
@@ -42,8 +42,8 @@ Module Type MiniOrderedType.
Parameter compare : forall x y : t, Compare lt eq x y.
- Hint Immediate eq_sym.
- Hint Resolve eq_refl eq_trans lt_not_eq lt_trans.
+ Hint Immediate eq_sym : core.
+ Hint Resolve eq_refl eq_trans lt_not_eq lt_trans : core.
End MiniOrderedType.
@@ -143,9 +143,9 @@ Module OrderedTypeFacts (Import O: OrderedType).
Lemma eq_not_gt x y : eq x y -> ~ lt y x. Proof. order. Qed.
Lemma lt_not_gt x y : lt x y -> ~ lt y x. Proof. order. Qed.
- Hint Resolve gt_not_eq eq_not_lt.
- Hint Immediate eq_lt lt_eq le_eq eq_le neq_eq eq_neq.
- Hint Resolve eq_not_gt lt_antirefl lt_not_gt.
+ Hint Resolve gt_not_eq eq_not_lt : core.
+ Hint Immediate eq_lt lt_eq le_eq eq_le neq_eq eq_neq : core.
+ Hint Resolve eq_not_gt lt_antirefl lt_not_gt : core.
Lemma elim_compare_eq :
forall x y : t,
@@ -247,8 +247,8 @@ Proof. exact (SortA_NoDupA eq_equiv lt_strorder lt_compat). Qed.
End ForNotations.
-Hint Resolve ListIn_In Sort_NoDup Inf_lt.
-Hint Immediate In_eq Inf_lt.
+Hint Resolve ListIn_In Sort_NoDup Inf_lt : core.
+Hint Immediate In_eq Inf_lt : core.
End OrderedTypeFacts.
@@ -266,8 +266,8 @@ Module KeyOrderedType(O:OrderedType).
eq (fst p) (fst p') /\ (snd p) = (snd p').
Definition ltk (p p':key*elt) := lt (fst p) (fst p').
- Hint Unfold eqk eqke ltk.
- Hint Extern 2 (eqke ?a ?b) => split.
+ Hint Unfold eqk eqke ltk : core.
+ Hint Extern 2 (eqke ?a ?b) => split : core.
(* eqke is stricter than eqk *)
@@ -283,7 +283,7 @@ Module KeyOrderedType(O:OrderedType).
Lemma ltk_right_l : forall x k e e', ltk (k,e) x -> ltk (k,e') x.
Proof. auto. Qed.
- Hint Immediate ltk_right_r ltk_right_l.
+ Hint Immediate ltk_right_r ltk_right_l : core.
(* eqk, eqke are equalities, ltk is a strict order *)
@@ -319,9 +319,9 @@ Module KeyOrderedType(O:OrderedType).
exact (lt_not_eq H H1).
Qed.
- Hint Resolve eqk_trans eqke_trans eqk_refl eqke_refl.
- Hint Resolve ltk_trans ltk_not_eqk ltk_not_eqke.
- Hint Immediate eqk_sym eqke_sym.
+ Hint Resolve eqk_trans eqke_trans eqk_refl eqke_refl : core.
+ Hint Resolve ltk_trans ltk_not_eqk ltk_not_eqke : core.
+ Hint Immediate eqk_sym eqke_sym : core.
Global Instance eqk_equiv : Equivalence eqk.
Proof. constructor; eauto. Qed.
@@ -359,22 +359,22 @@ Module KeyOrderedType(O:OrderedType).
intros (k,e) (k',e') (k'',e'').
unfold ltk, eqk; simpl; eauto.
Qed.
- Hint Resolve eqk_not_ltk.
- Hint Immediate ltk_eqk eqk_ltk.
+ Hint Resolve eqk_not_ltk : core.
+ Hint Immediate ltk_eqk eqk_ltk : core.
Lemma InA_eqke_eqk :
forall x m, InA eqke x m -> InA eqk x m.
Proof.
unfold eqke; induction 1; intuition.
Qed.
- Hint Resolve InA_eqke_eqk.
+ Hint Resolve InA_eqke_eqk : core.
Definition MapsTo (k:key)(e:elt):= InA eqke (k,e).
Definition In k m := exists e:elt, MapsTo k e m.
Notation Sort := (sort ltk).
Notation Inf := (lelistA ltk).
- Hint Unfold MapsTo In.
+ Hint Unfold MapsTo In : core.
(* An alternative formulation for [In k l] is [exists e, InA eqk (k,e) l] *)
@@ -405,8 +405,8 @@ Module KeyOrderedType(O:OrderedType).
Lemma Inf_lt : forall l x x', ltk x x' -> Inf x' l -> Inf x l.
Proof. exact (InfA_ltA ltk_strorder). Qed.
- Hint Immediate Inf_eq.
- Hint Resolve Inf_lt.
+ Hint Immediate Inf_eq : core.
+ Hint Resolve Inf_lt : core.
Lemma Sort_Inf_In :
forall l p q, Sort l -> Inf q l -> InA eqk p l -> ltk q p.
@@ -469,19 +469,19 @@ Module KeyOrderedType(O:OrderedType).
End Elt.
- Hint Unfold eqk eqke ltk.
- Hint Extern 2 (eqke ?a ?b) => split.
- Hint Resolve eqk_trans eqke_trans eqk_refl eqke_refl.
- Hint Resolve ltk_trans ltk_not_eqk ltk_not_eqke.
- Hint Immediate eqk_sym eqke_sym.
- Hint Resolve eqk_not_ltk.
- Hint Immediate ltk_eqk eqk_ltk.
- Hint Resolve InA_eqke_eqk.
- Hint Unfold MapsTo In.
- Hint Immediate Inf_eq.
- Hint Resolve Inf_lt.
- Hint Resolve Sort_Inf_NotIn.
- Hint Resolve In_inv_2 In_inv_3.
+ Hint Unfold eqk eqke ltk : core.
+ Hint Extern 2 (eqke ?a ?b) => split : core.
+ Hint Resolve eqk_trans eqke_trans eqk_refl eqke_refl : core.
+ Hint Resolve ltk_trans ltk_not_eqk ltk_not_eqke : core.
+ Hint Immediate eqk_sym eqke_sym : core.
+ Hint Resolve eqk_not_ltk : core.
+ Hint Immediate ltk_eqk eqk_ltk : core.
+ Hint Resolve InA_eqke_eqk : core.
+ Hint Unfold MapsTo In : core.
+ Hint Immediate Inf_eq : core.
+ Hint Resolve Inf_lt : core.
+ Hint Resolve Sort_Inf_NotIn : core.
+ Hint Resolve In_inv_2 In_inv_3 : core.
End KeyOrderedType.
diff --git a/theories/Structures/Orders.v b/theories/Structures/Orders.v
index 42756ad339..310a22a0a4 100644
--- a/theories/Structures/Orders.v
+++ b/theories/Structures/Orders.v
@@ -181,7 +181,7 @@ Module OTF_to_TotalOrder (O:OrderedTypeFull) <: TotalOrder
we coerce [bool] into [Prop]. *)
Local Coercion is_true : bool >-> Sortclass.
-Hint Unfold is_true.
+Hint Unfold is_true : core.
Module Type HasLeb (Import T:Typ).
Parameter Inline leb : t -> t -> bool.
diff --git a/theories/Structures/OrdersLists.v b/theories/Structures/OrdersLists.v
index abdb9eff05..fef9b14a9e 100644
--- a/theories/Structures/OrdersLists.v
+++ b/theories/Structures/OrdersLists.v
@@ -50,8 +50,8 @@ Proof. exact (InfA_alt O.eq_equiv O.lt_strorder O.lt_compat). Qed.
Lemma Sort_NoDup : forall l, Sort l -> NoDup l.
Proof. exact (SortA_NoDupA O.eq_equiv O.lt_strorder O.lt_compat) . Qed.
-Hint Resolve ListIn_In Sort_NoDup Inf_lt.
-Hint Immediate In_eq Inf_lt.
+Hint Resolve ListIn_In Sort_NoDup Inf_lt : core.
+Hint Immediate In_eq Inf_lt : core.
End OrderedTypeLists.
@@ -66,7 +66,7 @@ Module KeyOrderedType(O:OrderedType).
Definition ltk {elt} : relation (key*elt) := O.lt @@1.
- Hint Unfold ltk.
+ Hint Unfold ltk : core.
(* ltk is a strict order *)
@@ -109,8 +109,8 @@ Module KeyOrderedType(O:OrderedType).
Lemma Inf_lt l x x' : ltk x x' -> Inf x' l -> Inf x l.
Proof. apply InfA_ltA; auto with *. Qed.
- Hint Immediate Inf_eq.
- Hint Resolve Inf_lt.
+ Hint Immediate Inf_eq : core.
+ Hint Resolve Inf_lt : core.
Lemma Sort_Inf_In l p q : Sort l -> Inf q l -> InA eqk p l -> ltk q p.
Proof. apply SortA_InfA_InA; auto with *. Qed.
@@ -148,10 +148,10 @@ Module KeyOrderedType(O:OrderedType).
End Elt.
- Hint Resolve ltk_not_eqk ltk_not_eqke.
- Hint Immediate Inf_eq.
- Hint Resolve Inf_lt.
- Hint Resolve Sort_Inf_NotIn.
+ Hint Resolve ltk_not_eqk ltk_not_eqke : core.
+ Hint Immediate Inf_eq : core.
+ Hint Resolve Inf_lt : core.
+ Hint Resolve Sort_Inf_NotIn : core.
End KeyOrderedType.
diff --git a/theories/Vectors/VectorDef.v b/theories/Vectors/VectorDef.v
index 4a2bddf35c..7f96aa6b87 100644
--- a/theories/Vectors/VectorDef.v
+++ b/theories/Vectors/VectorDef.v
@@ -269,28 +269,28 @@ Section SCANNING.
Inductive Forall {A} (P: A -> Prop): forall {n} (v: t A n), Prop :=
|Forall_nil: Forall P []
|Forall_cons {n} x (v: t A n): P x -> Forall P v -> Forall P (x::v).
-Hint Constructors Forall.
+Hint Constructors Forall : core.
Inductive Exists {A} (P:A->Prop): forall {n}, t A n -> Prop :=
|Exists_cons_hd {m} x (v: t A m): P x -> Exists P (x::v)
|Exists_cons_tl {m} x (v: t A m): Exists P v -> Exists P (x::v).
-Hint Constructors Exists.
+Hint Constructors Exists : core.
Inductive In {A} (a:A): forall {n}, t A n -> Prop :=
|In_cons_hd {m} (v: t A m): In a (a::v)
|In_cons_tl {m} x (v: t A m): In a v -> In a (x::v).
-Hint Constructors In.
+Hint Constructors In : core.
Inductive Forall2 {A B} (P:A->B->Prop): forall {n}, t A n -> t B n -> Prop :=
|Forall2_nil: Forall2 P [] []
|Forall2_cons {m} x1 x2 (v1:t A m) v2: P x1 x2 -> Forall2 P v1 v2 ->
Forall2 P (x1::v1) (x2::v2).
-Hint Constructors Forall2.
+Hint Constructors Forall2 : core.
Inductive Exists2 {A B} (P:A->B->Prop): forall {n}, t A n -> t B n -> Prop :=
|Exists2_cons_hd {m} x1 x2 (v1: t A m) (v2: t B m): P x1 x2 -> Exists2 P (x1::v1) (x2::v2)
|Exists2_cons_tl {m} x1 x2 (v1:t A m) v2: Exists2 P v1 v2 -> Exists2 P (x1::v1) (x2::v2).
-Hint Constructors Exists2.
+Hint Constructors Exists2 : core.
End SCANNING.
diff --git a/theories/Wellfounded/Inclusion.v b/theories/Wellfounded/Inclusion.v
index ff233ef9c6..18c4bedd9a 100644
--- a/theories/Wellfounded/Inclusion.v
+++ b/theories/Wellfounded/Inclusion.v
@@ -22,7 +22,7 @@ Section WfInclusion.
apply Acc_intro; auto with sets.
Qed.
- Hint Resolve Acc_incl.
+ Hint Resolve Acc_incl : core.
Theorem wf_incl : inclusion A R1 R2 -> well_founded R2 -> well_founded R1.
Proof.
diff --git a/theories/Wellfounded/Transitive_Closure.v b/theories/Wellfounded/Transitive_Closure.v
index 59068623ae..0d56d88869 100644
--- a/theories/Wellfounded/Transitive_Closure.v
+++ b/theories/Wellfounded/Transitive_Closure.v
@@ -31,7 +31,7 @@ Section Wf_Transitive_Closure.
apply Acc_inv with y; auto with sets.
Defined.
- Hint Resolve Acc_clos_trans.
+ Hint Resolve Acc_clos_trans : core.
Lemma Acc_inv_trans : forall x y:A, trans_clos y x -> Acc R x -> Acc R y.
Proof.
diff --git a/theories/ZArith/Zdiv.v b/theories/ZArith/Zdiv.v
index 74614e114a..c278cada61 100644
--- a/theories/ZArith/Zdiv.v
+++ b/theories/ZArith/Zdiv.v
@@ -73,7 +73,7 @@ Proof.
intros; unfold Remainder, Remainder_alt; omega with *.
Qed.
-Hint Unfold Remainder.
+Hint Unfold Remainder : core.
(** Now comes the fully general result about Euclidean division. *)
diff --git a/theories/ZArith/Zlogarithm.v b/theories/ZArith/Zlogarithm.v
index 24412e9431..b8c7319939 100644
--- a/theories/ZArith/Zlogarithm.v
+++ b/theories/ZArith/Zlogarithm.v
@@ -47,7 +47,7 @@ Section Log_pos. (* Log of positive integers *)
| xI n => Z.succ (Z.succ (log_inf n)) (* 2n+1 *)
end.
- Hint Unfold log_inf log_sup.
+ Hint Unfold log_inf log_sup : core.
Lemma Psize_log_inf : forall p, Zpos (Pos.size p) = Z.succ (log_inf p).
Proof.
diff --git a/tools/CoqMakefile.in b/tools/CoqMakefile.in
index 92cc820483..b673225e40 100644
--- a/tools/CoqMakefile.in
+++ b/tools/CoqMakefile.in
@@ -20,7 +20,6 @@ include @CONF_FILE@
VFILES := $(COQMF_VFILES)
MLIFILES := $(COQMF_MLIFILES)
MLFILES := $(COQMF_MLFILES)
-ML4FILES := $(COQMF_ML4FILES)
MLGFILES := $(COQMF_MLGFILES)
MLPACKFILES := $(COQMF_MLPACKFILES)
MLLIBFILES := $(COQMF_MLLIBFILES)
@@ -37,10 +36,6 @@ LOCAL := $(COQMF_LOCAL)
COQLIB := $(COQMF_COQLIB)
DOCDIR := $(COQMF_DOCDIR)
OCAMLFIND := $(COQMF_OCAMLFIND)
-CAMLP5O := $(COQMF_CAMLP5O)
-CAMLP5BIN := $(COQMF_CAMLP5BIN)
-CAMLP5LIB := $(COQMF_CAMLP5LIB)
-CAMLP5OPTIONS := $(COQMF_CAMLP5OPTIONS)
CAMLFLAGS := $(COQMF_CAMLFLAGS)
HASNATDYNLINK := $(COQMF_HASNATDYNLINK)
@@ -99,7 +94,7 @@ BEFORE ?=
AFTER ?=
# FIXME this should be generated by Coq (modules already linked by Coq)
-CAMLDONTLINK=camlp5.gramlib,unix,str
+CAMLDONTLINK=unix,str
# OCaml binaries
CAMLC ?= "$(OCAMLFIND)" ocamlc -c
@@ -192,22 +187,11 @@ COQMAKEFILE_VERSION:=@COQ_VERSION@
COQSRCLIBS?= $(foreach d,$(COQ_SRC_SUBDIRS), -I "$(COQLIB)$(d)")
-CAMLFLAGS+=$(OCAMLLIBS) $(COQSRCLIBS) -I $(CAMLP5LIB)
+CAMLFLAGS+=$(OCAMLLIBS) $(COQSRCLIBS)
# ocamldoc fails with unknown argument otherwise
CAMLDOCFLAGS=$(filter-out -annot, $(filter-out -bin-annot, $(CAMLFLAGS)))
-# FIXME This should be generated by Coq
-GRAMMARS:=grammar.cma
-CAMLP5EXTEND=pa_extend.cmo q_MLast.cmo pa_macro.cmo
-
-CAMLLIB:=$(shell "$(OCAMLFIND)" printconf stdlib 2> /dev/null)
-ifeq (,$(CAMLLIB))
-PP=$(error "Cannot find the 'ocamlfind' binary used to build Coq ($(OCAMLFIND)). Pre-compiled binary packages of Coq do not support compiling plugins this way. Please download the sources of Coq and run the Windows build script.")
-else
-PP:=-pp '$(CAMLP5O) -I $(CAMLLIB) -I "$(COQLIB)/grammar" $(CAMLP5EXTEND) $(GRAMMARS) $(CAMLP5OPTIONS) -impl'
-endif
-
ifneq (,$(TIMING))
TIMING_ARG=-time
ifeq (after,$(TIMING))
@@ -774,10 +758,6 @@ printenv::
@echo 'COQLIB = $(COQLIB)'
@echo 'DOCDIR = $(DOCDIR)'
@echo 'OCAMLFIND = $(OCAMLFIND)'
- @echo 'CAMLP5O = $(CAMLP5O)'
- @echo 'CAMLP5BIN = $(CAMLP5BIN)'
- @echo 'CAMLP5LIB = $(CAMLP5LIB)'
- @echo 'CAMLP5OPTIONS = $(CAMLP5OPTIONS)'
@echo 'HASNATDYNLINK = $(HASNATDYNLINK)'
@echo 'SRC_SUBDIRS = $(SRC_SUBDIRS)'
@echo 'COQ_SRC_SUBDIRS = $(COQ_SRC_SUBDIRS)'
diff --git a/tools/coq_makefile.ml b/tools/coq_makefile.ml
index ca5a232edb..8560bac786 100644
--- a/tools/coq_makefile.ml
+++ b/tools/coq_makefile.ml
@@ -396,8 +396,9 @@ let _ =
| "-destination-of" :: tgt :: rest -> Some tgt, rest
| _ -> None, args in
- let project =
- try cmdline_args_to_project ~curdir:Filename.current_dir_name args
+ let project =
+ let warning_fn x = Format.eprintf "%s@\n%!" x in
+ try cmdline_args_to_project ~warning_fn ~curdir:Filename.current_dir_name args
with Parsing_error s -> prerr_endline s; usage_coq_makefile () in
if only_destination <> None then begin
diff --git a/tools/coqdep.ml b/tools/coqdep.ml
index ba88069be9..226a19678f 100644
--- a/tools/coqdep.ml
+++ b/tools/coqdep.ml
@@ -473,7 +473,8 @@ let add_r_include path l = add_rec_dir_import add_known path (split_period l)
let treat_coqproject f =
let open CoqProject_file in
let iter_sourced f = List.iter (fun {thing} -> f thing) in
- let project = read_project_file f in
+ let warning_fn x = coqdep_warning "%s" x in
+ let project = read_project_file ~warning_fn f in
iter_sourced (fun { path } -> add_caml_dir path) project.ml_includes;
iter_sourced (fun ({ path }, l) -> add_q_include path l) project.q_includes;
iter_sourced (fun ({ path }, l) -> add_r_include path l) project.r_includes;
diff --git a/toplevel/ccompile.ml b/toplevel/ccompile.ml
new file mode 100644
index 0000000000..fb6d07d6cf
--- /dev/null
+++ b/toplevel/ccompile.ml
@@ -0,0 +1,222 @@
+(************************************************************************)
+(* * The Coq Proof Assistant / The Coq Development Team *)
+(* v * INRIA, CNRS and contributors - Copyright 1999-2018 *)
+(* <O___,, * (see CREDITS file for the list of authors) *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(* * (see LICENSE file for the text of the license) *)
+(************************************************************************)
+
+open Pp
+open Coqargs
+
+let fatal_error msg =
+ Topfmt.std_logger Feedback.Error msg;
+ flush_all ();
+ exit 1
+
+(******************************************************************************)
+(* Interactive Load File Simulation *)
+(******************************************************************************)
+let load_vernacular opts ~state =
+ List.fold_left
+ (fun state (f_in, echo) ->
+ let s = Loadpath.locate_file f_in in
+ (* Should make the beautify logic clearer *)
+ let load_vernac f = Vernac.load_vernac ~echo ~interactive:false ~check:true ~state f in
+ if !Flags.beautify
+ then Flags.with_option Flags.beautify_file load_vernac f_in
+ else load_vernac s
+ ) state (List.rev opts.load_vernacular_list)
+
+let load_init_vernaculars opts ~state =
+ let state =
+ if opts.load_rcfile then
+ Topfmt.(in_phase ~phase:LoadingRcFile) (fun () ->
+ Coqinit.load_rcfile ~rcfile:opts.rcfile ~state) ()
+ else begin
+ Flags.if_verbose Feedback.msg_info (str"Skipping rcfile loading.");
+ state
+ end in
+
+ load_vernacular opts ~state
+
+(******************************************************************************)
+(* File Compilation *)
+(******************************************************************************)
+let warn_file_no_extension =
+ CWarnings.create ~name:"file-no-extension" ~category:"filesystem"
+ (fun (f,ext) ->
+ str "File \"" ++ str f ++
+ strbrk "\" has been implicitly expanded to \"" ++
+ str f ++ str ext ++ str "\"")
+
+let ensure_ext ext f =
+ if Filename.check_suffix f ext then f
+ else begin
+ warn_file_no_extension (f,ext);
+ f ^ ext
+ end
+
+let chop_extension f =
+ try Filename.chop_extension f with _ -> f
+
+let ensure_bname src tgt =
+ let src, tgt = Filename.basename src, Filename.basename tgt in
+ let src, tgt = chop_extension src, chop_extension tgt in
+ if src <> tgt then
+ fatal_error (str "Source and target file names must coincide, directories can differ" ++ fnl () ++
+ str "Source: " ++ str src ++ fnl () ++
+ str "Target: " ++ str tgt)
+
+let ensure ext src tgt = ensure_bname src tgt; ensure_ext ext tgt
+
+let ensure_v v = ensure ".v" v v
+let ensure_vo v vo = ensure ".vo" v vo
+let ensure_vio v vio = ensure ".vio" v vio
+
+let ensure_exists f =
+ if not (Sys.file_exists f) then
+ fatal_error (hov 0 (str "Can't find file" ++ spc () ++ str f))
+
+(* Compile a vernac file *)
+let compile opts ~echo ~f_in ~f_out =
+ let open Vernac.State in
+ let check_pending_proofs () =
+ let pfs = Proof_global.get_all_proof_names () in
+ if not (CList.is_empty pfs) then
+ fatal_error (str "There are pending proofs: "
+ ++ (pfs
+ |> List.rev
+ |> prlist_with_sep pr_comma Names.Id.print)
+ ++ str ".")
+ in
+ let iload_path = build_load_path opts in
+ let require_libs = require_libs opts in
+ let stm_options = opts.stm_flags in
+ match opts.compilation_mode with
+ | BuildVo ->
+ Flags.record_aux_file := true;
+ let long_f_dot_v = ensure_v f_in in
+ ensure_exists long_f_dot_v;
+ let long_f_dot_vo =
+ match f_out with
+ | None -> long_f_dot_v ^ "o"
+ | Some f -> ensure_vo long_f_dot_v f in
+
+ let doc, sid = Topfmt.(in_phase ~phase:LoadingPrelude)
+ Stm.new_doc
+ Stm.{ doc_type = VoDoc long_f_dot_vo;
+ iload_path; require_libs; stm_options;
+ } in
+ let state = { doc; sid; proof = None; time = opts.time } in
+ let state = load_init_vernaculars opts ~state in
+ let ldir = Stm.get_ldir ~doc:state.doc in
+ Aux_file.(start_aux_file
+ ~aux_file:(aux_file_name_for long_f_dot_vo)
+ ~v_file:long_f_dot_v);
+ 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 state = Vernac.load_vernac ~echo ~check:true ~interactive:false ~state long_f_dot_v in
+ let _doc = Stm.join ~doc:state.doc in
+ let wall_clock2 = Unix.gettimeofday () in
+ check_pending_proofs ();
+ Library.save_library_to ldir long_f_dot_vo (Global.opaque_tables ());
+ Aux_file.record_in_aux_at "vo_compile_time"
+ (Printf.sprintf "%.3f" (wall_clock2 -. wall_clock1));
+ Aux_file.stop_aux_file ();
+ Dumpglob.end_dump_glob ()
+
+ | BuildVio ->
+ Flags.record_aux_file := false;
+ Dumpglob.noglob ();
+
+ let long_f_dot_v = ensure_v f_in in
+ ensure_exists long_f_dot_v;
+
+ let long_f_dot_vio =
+ match f_out with
+ | None -> long_f_dot_v ^ "io"
+ | Some f -> ensure_vio long_f_dot_v f in
+
+ (* We need to disable error resiliency, otherwise some errors
+ will be ignored in batch mode. c.f. #6707
+
+ This is not necessary in the vo case as it fully checks the
+ document anyways. *)
+ let stm_options = let open Stm.AsyncOpts in
+ { stm_options with
+ async_proofs_cmd_error_resilience = false;
+ async_proofs_tac_error_resilience = `None;
+ } in
+
+ let doc, sid = Topfmt.(in_phase ~phase:LoadingPrelude)
+ Stm.new_doc
+ Stm.{ doc_type = VioDoc long_f_dot_vio;
+ iload_path; require_libs; stm_options;
+ } in
+
+ let state = { doc; sid; proof = None; time = opts.time } in
+ let state = load_init_vernaculars opts ~state in
+ let ldir = Stm.get_ldir ~doc:state.doc in
+ let state = Vernac.load_vernac ~echo ~check:false ~interactive:false ~state long_f_dot_v in
+ let doc = Stm.finish ~doc:state.doc in
+ check_pending_proofs ();
+ let _doc = Stm.snapshot_vio ~doc ldir long_f_dot_vio in
+ Stm.reset_task_queue ()
+
+ | Vio2Vo ->
+ let open Filename in
+ Flags.record_aux_file := false;
+ Dumpglob.noglob ();
+ let f = if check_suffix f_in ".vio" then chop_extension f_in else f_in in
+ let lfdv, sum, lib, univs, disch, tasks, proofs = Library.load_library_todo f in
+ let univs, proofs = Stm.finish_tasks lfdv univs disch proofs tasks in
+ Library.save_library_raw lfdv sum lib univs proofs
+
+let compile opts ~echo ~f_in ~f_out =
+ ignore(CoqworkmgrApi.get 1);
+ compile opts ~echo ~f_in ~f_out;
+ CoqworkmgrApi.giveback 1
+
+let compile_file opts (f_in, echo) =
+ let f_out = opts.compilation_output_name in
+ if !Flags.beautify then
+ Flags.with_option Flags.beautify_file
+ (fun f_in -> compile opts ~echo ~f_in ~f_out) f_in
+ else
+ compile opts ~echo ~f_in ~f_out
+
+let compile_files opts =
+ let compile_list = List.rev opts.compile_list in
+ List.iter (compile_file opts) compile_list
+
+(******************************************************************************)
+(* VIO Dispatching *)
+(******************************************************************************)
+let check_vio_tasks opts =
+ let rc =
+ List.fold_left (fun acc t -> Vio_checking.check_vio t && acc)
+ true (List.rev opts.vio_tasks) in
+ if not rc then fatal_error Pp.(str "VIO Task Check failed")
+
+(* vio files *)
+let schedule_vio opts =
+ if opts.vio_checking then
+ Vio_checking.schedule_vio_checking opts.vio_files_j opts.vio_files
+ else
+ Vio_checking.schedule_vio_compilation opts.vio_files_j opts.vio_files
+
+let do_vio opts =
+ (* We must initialize the loadpath here as the vio scheduling
+ process happens outside of the STM *)
+ if opts.vio_files <> [] || opts.vio_tasks <> [] then
+ let iload_path = build_load_path opts in
+ List.iter Mltop.add_coq_path iload_path;
+
+ (* Vio compile pass *)
+ if opts.vio_files <> [] then schedule_vio opts;
+ (* Vio task pass *)
+ if opts.vio_tasks <> [] then check_vio_tasks opts
diff --git a/toplevel/ccompile.mli b/toplevel/ccompile.mli
new file mode 100644
index 0000000000..757c91c408
--- /dev/null
+++ b/toplevel/ccompile.mli
@@ -0,0 +1,19 @@
+(************************************************************************)
+(* * The Coq Proof Assistant / The Coq Development Team *)
+(* v * INRIA, CNRS and contributors - Copyright 1999-2018 *)
+(* <O___,, * (see CREDITS file for the list of authors) *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(* * (see LICENSE file for the text of the license) *)
+(************************************************************************)
+
+(** [load_init_vernaculars opts ~state] Load vernaculars from
+ the init (rc) file *)
+val load_init_vernaculars : Coqargs.coq_cmdopts -> state:Vernac.State.t-> Vernac.State.t
+
+(** [compile_files opts] compile files specified in [opts] *)
+val compile_files : Coqargs.coq_cmdopts -> unit
+
+(** [do_vio opts] process [.vio] files in [opts] *)
+val do_vio : Coqargs.coq_cmdopts -> unit
diff --git a/toplevel/coqargs.ml b/toplevel/coqargs.ml
index 7c28ef24d4..2f84eb9851 100644
--- a/toplevel/coqargs.ml
+++ b/toplevel/coqargs.ml
@@ -9,7 +9,7 @@
(************************************************************************)
let fatal_error exn =
- Topfmt.print_err_exn Topfmt.ParsingCommandLine exn;
+ Topfmt.(in_phase ~phase:ParsingCommandLine print_err_exn exn);
let exit_code = if CErrors.(is_anomaly exn || not (handled exn)) then 129 else 1 in
exit exit_code
@@ -40,8 +40,8 @@ type coq_cmdopts = {
load_rcfile : bool;
rcfile : string option;
- ml_includes : string list;
- vo_includes : (string * Names.DirPath.t * bool) list;
+ ml_includes : Mltop.coq_path list;
+ vo_includes : Mltop.coq_path list;
vo_requires : (string * string option * bool option) list;
(* None = No Import; Some false = Import; Some true = Export *)
@@ -64,6 +64,7 @@ type coq_cmdopts = {
color : color;
impredicative_set : Declarations.set_predicativity;
+ indices_matter : bool;
enable_VM : bool;
enable_native_compiler : bool;
stm_flags : Stm.AsyncOpts.stm_opt;
@@ -118,6 +119,7 @@ let init_args = {
color = `AUTO;
impredicative_set = Declarations.PredicativeSet;
+ indices_matter = false;
enable_VM = true;
enable_native_compiler = Coq_config.native_compiler;
stm_flags = Stm.AsyncOpts.default_opts;
@@ -145,11 +147,14 @@ let init_args = {
(* Functional arguments *)
(******************************************************************************)
let add_ml_include opts s =
- { opts with ml_includes = s :: opts.ml_includes }
+ Mltop.{ opts with ml_includes = {recursive = false; path_spec = MlPath s} :: opts.ml_includes }
-let add_vo_include opts d p implicit =
- let p = Libnames.dirpath_of_string p in
- { opts with vo_includes = (d, p, implicit) :: opts.vo_includes }
+let add_vo_include opts unix_path coq_path implicit =
+ let open Mltop in
+ let coq_path = Libnames.dirpath_of_string coq_path in
+ { opts with vo_includes = {
+ recursive = true;
+ path_spec = VoPath { unix_path; coq_path; has_ml = AddNoML; implicit } } :: opts.vo_includes }
let add_vo_require opts d p export =
{ opts with vo_requires = (d, p, export) :: opts.vo_requires }
@@ -565,7 +570,7 @@ let parse_args arglist : coq_cmdopts * string list =
|"-filteropts" -> { oval with filter_opts = true }
|"-impredicative-set" ->
{ oval with impredicative_set = Declarations.ImpredicativeSet }
- |"-indices-matter" -> Indtypes.enforce_indices_matter (); oval
+ |"-indices-matter" -> { oval with indices_matter = true }
|"-m"|"--memory" -> { oval with memory_stat = true }
|"-noinit"|"-nois" -> { oval with load_init = false }
|"-no-glob"|"-noglob" -> Dumpglob.noglob (); { oval with glob_opt = true }
@@ -597,3 +602,19 @@ let parse_args arglist : coq_cmdopts * string list =
try
parse init_args
with any -> fatal_error any
+
+(******************************************************************************)
+(* Startup LoadPath and Modules *)
+(******************************************************************************)
+(* prelude_data == From Coq Require Export Prelude. *)
+let prelude_data = "Prelude", Some "Coq", Some false
+
+let require_libs opts =
+ if opts.load_init then prelude_data :: opts.vo_requires else opts.vo_requires
+
+let cmdline_load_path opts =
+ List.rev opts.vo_includes @ List.(rev opts.ml_includes)
+
+let build_load_path opts =
+ Coqinit.libs_init_load_path ~load_init:opts.load_init @
+ cmdline_load_path opts
diff --git a/toplevel/coqargs.mli b/toplevel/coqargs.mli
index b709788dde..30f1caab12 100644
--- a/toplevel/coqargs.mli
+++ b/toplevel/coqargs.mli
@@ -19,8 +19,8 @@ type coq_cmdopts = {
load_rcfile : bool;
rcfile : string option;
- ml_includes : string list;
- vo_includes : (string * Names.DirPath.t * bool) list;
+ ml_includes : Mltop.coq_path list;
+ vo_includes : Mltop.coq_path list;
vo_requires : (string * string option * bool option) list;
(* Fuse these two? Currently, [batch_mode] is only used to
@@ -43,6 +43,7 @@ type coq_cmdopts = {
color : color;
impredicative_set : Declarations.set_predicativity;
+ indices_matter : bool;
enable_VM : bool;
enable_native_compiler : bool;
stm_flags : Stm.AsyncOpts.stm_opt;
@@ -69,3 +70,6 @@ type coq_cmdopts = {
val parse_args : string list -> coq_cmdopts * string list
val exitcode : coq_cmdopts -> int
+
+val require_libs : coq_cmdopts -> (string * string option * bool option) list
+val build_load_path : coq_cmdopts -> Mltop.coq_path list
diff --git a/toplevel/coqloop.ml b/toplevel/coqloop.ml
index cbc5c124c8..5cf2157044 100644
--- a/toplevel/coqloop.ml
+++ b/toplevel/coqloop.ml
@@ -150,10 +150,11 @@ let print_highlight_location ib loc =
let valid_buffer_loc ib loc =
let (b,e) = Loc.unloc loc in b-ib.start >= 0 && e-ib.start < ib.len && b<=e
+
(* Toplevel error explanation. *)
-let error_info_for_buffer ?loc phase buf =
+let error_info_for_buffer ?loc buf =
match loc with
- | None -> Topfmt.pr_phase ?loc phase
+ | None -> Topfmt.pr_phase ?loc ()
| Some loc ->
let fname = loc.Loc.fname in
(* We are in the toplevel *)
@@ -161,17 +162,17 @@ let error_info_for_buffer ?loc phase buf =
| Loc.ToplevelInput ->
let nloc = adjust_loc_buf buf loc in
if valid_buffer_loc buf loc then
- match Topfmt.pr_phase ~loc:nloc phase with
+ match Topfmt.pr_phase ~loc:nloc () with
| None -> None
| Some hd -> Some (hd ++ fnl () ++ print_highlight_location buf nloc)
(* in the toplevel, but not a valid buffer *)
- else Topfmt.pr_phase ~loc phase
+ else Topfmt.pr_phase ~loc ()
(* we are in batch mode, don't adjust location *)
- | Loc.InFile _ -> Topfmt.pr_phase ~loc phase
+ | Loc.InFile _ -> Topfmt.pr_phase ~loc ()
(* Actual printing routine *)
-let print_error_for_buffer ?loc phase lvl msg buf =
- let pre_hdr = error_info_for_buffer ?loc phase buf in
+let print_error_for_buffer ?loc lvl msg buf =
+ let pre_hdr = error_info_for_buffer ?loc buf in
if !print_emacs
then Topfmt.emacs_logger ?pre_hdr lvl msg
else Topfmt.std_logger ?pre_hdr lvl msg
@@ -245,7 +246,7 @@ let parse_to_dot =
| Tok.EOI -> raise Stm.End_of_input
| _ -> dot st
in
- Pcoq.Gram.Entry.of_parser "Coqtoplevel.dot" dot
+ Pcoq.Entry.of_parser "Coqtoplevel.dot" dot
(* If an error occurred while parsing, we try to read the input until a dot
token is encountered.
@@ -255,7 +256,7 @@ let rec discard_to_dot () =
try
Pcoq.Entry.parse parse_to_dot top_buffer.tokens
with
- | Plexing.Error _ | CLexer.Error.E _ -> discard_to_dot ()
+ | Gramlib.Plexing.Error _ | CLexer.Error.E _ -> discard_to_dot ()
| Stm.End_of_input -> raise Stm.End_of_input
| e when CErrors.noncritical e -> ()
@@ -281,7 +282,7 @@ let extract_default_loc loc doc_id sid : Loc.t option =
with _ -> loc
(** Coqloop Console feedback handler *)
-let coqloop_feed phase (fb : Feedback.feedback) = let open Feedback in
+let coqloop_feed (fb : Feedback.feedback) = let open Feedback in
match fb.contents with
| Processed -> ()
| Incomplete -> ()
@@ -300,9 +301,9 @@ let coqloop_feed phase (fb : Feedback.feedback) = let open Feedback in
(* TopErr.print_error_for_buffer ?loc lvl msg top_buffer *)
| Message (Warning,loc,msg) ->
let loc = extract_default_loc loc fb.doc_id fb.span_id in
- TopErr.print_error_for_buffer ?loc phase Warning msg top_buffer
+ TopErr.print_error_for_buffer ?loc Warning msg top_buffer
| Message (lvl,loc,msg) ->
- TopErr.print_error_for_buffer ?loc phase lvl msg top_buffer
+ TopErr.print_error_for_buffer ?loc lvl msg top_buffer
(** Main coq loop : read vernacular expressions until Drop is entered.
Ctrl-C is handled internally as Sys.Break instead of aborting Coq.
@@ -362,7 +363,7 @@ let top_goal_print ~doc c oldp newp =
let (e, info) = CErrors.push exn in
let loc = Loc.get_loc info in
let msg = CErrors.iprint (e, info) in
- TopErr.print_error_for_buffer ?loc Topfmt.InteractiveLoop Feedback.Error msg top_buffer
+ TopErr.print_error_for_buffer ?loc Feedback.Error msg top_buffer
(* Careful to keep this loop tail-rec *)
let rec vernac_loop ~state =
@@ -404,7 +405,7 @@ let rec vernac_loop ~state =
let (e, info) = CErrors.push any in
let loc = Loc.get_loc info in
let msg = CErrors.iprint (e, info) in
- TopErr.print_error_for_buffer ?loc Topfmt.InteractiveLoop Feedback.Error msg top_buffer;
+ TopErr.print_error_for_buffer ?loc Feedback.Error msg top_buffer;
vernac_loop ~state
let rec loop ~state =
@@ -430,7 +431,7 @@ let loop ~opts ~state =
let open Coqargs in
print_emacs := opts.print_emacs;
(* We initialize the console only if we run the toploop_run *)
- let tl_feed = Feedback.add_feeder (coqloop_feed Topfmt.InteractiveLoop) in
+ let tl_feed = Feedback.add_feeder coqloop_feed in
if Dumpglob.dump () then begin
Flags.if_verbose warning "Dumpglob cannot be used in interactive mode.";
Dumpglob.noglob ()
diff --git a/toplevel/coqloop.mli b/toplevel/coqloop.mli
index b11f13d3cb..7d03484412 100644
--- a/toplevel/coqloop.mli
+++ b/toplevel/coqloop.mli
@@ -27,7 +27,7 @@ val top_buffer : input_buffer
val set_prompt : (unit -> string) -> unit
(** Toplevel feedback printer. *)
-val coqloop_feed : Topfmt.execution_phase -> Feedback.feedback -> unit
+val coqloop_feed : Feedback.feedback -> unit
(** Last document seen after `Drop` *)
val drop_last_doc : Vernac.State.t option ref
diff --git a/toplevel/coqtop.ml b/toplevel/coqtop.ml
index e4d9e9ac25..faacbe4c80 100644
--- a/toplevel/coqtop.ml
+++ b/toplevel/coqtop.ml
@@ -30,15 +30,6 @@ let print_header () =
Feedback.msg_notice (str "Welcome to Coq " ++ str ver ++ str " (" ++ str rev ++ str ")");
flush_all ()
-(* Feedback received in the init stage, this is different as the STM
- will not be generally be initialized, thus stateid, etc... may be
- bogus. For now we just print to the console too *)
-let coqtop_init_feed = Coqloop.coqloop_feed Topfmt.Initialization
-
-let coqtop_doc_feed = Coqloop.coqloop_feed Topfmt.LoadingPrelude
-
-let coqtop_rcfile_feed = Coqloop.coqloop_feed Topfmt.LoadingRcFile
-
let memory_stat = ref false
let print_memory_stat () =
begin (* -m|--memory from the command-line *)
@@ -73,74 +64,13 @@ let outputstate opts =
States.extern_state fname) opts.outputstate
(******************************************************************************)
-(* Interactive Load File Simulation *)
-(******************************************************************************)
-let load_vernacular opts ~state =
- List.fold_left
- (fun state (f_in, echo) ->
- let s = Loadpath.locate_file f_in in
- (* Should make the beautify logic clearer *)
- let load_vernac f = Vernac.load_vernac ~echo ~interactive:false ~check:true ~state f in
- if !Flags.beautify
- then Flags.with_option Flags.beautify_file load_vernac f_in
- else load_vernac s
- ) state (List.rev opts.load_vernacular_list)
-
-let load_init_vernaculars cur_feeder opts ~state =
- let state =
- if opts.load_rcfile then begin
- Feedback.del_feeder !cur_feeder;
- let rc_feeder = Feedback.add_feeder coqtop_rcfile_feed in
- let state = Coqinit.load_rcfile ~rcfile:opts.rcfile ~state in
- Feedback.del_feeder rc_feeder;
- cur_feeder := Feedback.add_feeder coqtop_init_feed;
- state
- end
- else begin
- Flags.if_verbose Feedback.msg_info (str"Skipping rcfile loading.");
- state
- end in
-
- load_vernacular opts ~state
-
-(******************************************************************************)
-(* Startup LoadPath and Modules *)
-(******************************************************************************)
-(* prelude_data == From Coq Require Export Prelude. *)
-let prelude_data = "Prelude", Some "Coq", Some true
-
-let require_libs opts =
- if opts.load_init then prelude_data :: opts.vo_requires else opts.vo_requires
-
-let cmdline_load_path opts =
- let open Mltop in
- (* loadpaths given by 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 opts.vo_includes) @
-
- (* additional ml directories, given with option -I *)
- List.map (fun s -> {recursive = false; path_spec = MlPath s}) (List.rev opts.ml_includes)
-
-let build_load_path opts =
- Coqinit.libs_init_load_path ~load_init:opts.load_init @
- cmdline_load_path opts
-
-(******************************************************************************)
(* Fatal Errors *)
(******************************************************************************)
(** Prints info which is either an error or an anomaly and then exits
with the appropriate error code *)
-let fatal_error msg =
- Topfmt.std_logger Feedback.Error msg;
- flush_all ();
- exit 1
-
let fatal_error_exn exn =
- Topfmt.print_err_exn Topfmt.Initialization exn;
+ Topfmt.(in_phase ~phase:Initialization print_err_exn exn);
flush_all ();
let exit_code =
if CErrors.(is_anomaly exn || not (handled exn)) then 129 else 1
@@ -148,195 +78,6 @@ let fatal_error_exn exn =
exit exit_code
(******************************************************************************)
-(* File Compilation *)
-(******************************************************************************)
-let warn_file_no_extension =
- CWarnings.create ~name:"file-no-extension" ~category:"filesystem"
- (fun (f,ext) ->
- str "File \"" ++ str f ++
- strbrk "\" has been implicitly expanded to \"" ++
- str f ++ str ext ++ str "\"")
-
-let ensure_ext ext f =
- if Filename.check_suffix f ext then f
- else begin
- warn_file_no_extension (f,ext);
- f ^ ext
- end
-
-let chop_extension f =
- try Filename.chop_extension f with _ -> f
-
-let ensure_bname src tgt =
- let src, tgt = Filename.basename src, Filename.basename tgt in
- let src, tgt = chop_extension src, chop_extension tgt in
- if src <> tgt then
- fatal_error (str "Source and target file names must coincide, directories can differ" ++ fnl () ++
- str "Source: " ++ str src ++ fnl () ++
- str "Target: " ++ str tgt)
-
-let ensure ext src tgt = ensure_bname src tgt; ensure_ext ext tgt
-
-let ensure_v v = ensure ".v" v v
-let ensure_vo v vo = ensure ".vo" v vo
-let ensure_vio v vio = ensure ".vio" v vio
-
-let ensure_exists f =
- if not (Sys.file_exists f) then
- fatal_error (hov 0 (str "Can't find file" ++ spc () ++ str f))
-
-(* Compile a vernac file *)
-let compile cur_feeder opts ~echo ~f_in ~f_out =
- let open Vernac.State in
- let check_pending_proofs () =
- let pfs = Proof_global.get_all_proof_names () in
- if not (CList.is_empty pfs) then
- fatal_error (str "There are pending proofs: "
- ++ (pfs
- |> List.rev
- |> prlist_with_sep pr_comma Names.Id.print)
- ++ str ".")
- in
- let iload_path = build_load_path opts in
- let require_libs = require_libs opts in
- let stm_options = opts.stm_flags in
- match opts.compilation_mode with
- | BuildVo ->
- Flags.record_aux_file := true;
- let long_f_dot_v = ensure_v f_in in
- ensure_exists long_f_dot_v;
- let long_f_dot_vo =
- match f_out with
- | None -> long_f_dot_v ^ "o"
- | Some f -> ensure_vo long_f_dot_v f in
-
- Feedback.del_feeder !cur_feeder;
- let doc_feeder = Feedback.add_feeder coqtop_doc_feed in
- let doc, sid =
- Stm.(new_doc
- { doc_type = VoDoc long_f_dot_vo;
- iload_path; require_libs; stm_options;
- }) in
- Feedback.del_feeder doc_feeder;
- cur_feeder := Feedback.add_feeder coqtop_init_feed;
-
- let state = { doc; sid; proof = None; time = opts.time } in
- let state = load_init_vernaculars cur_feeder opts ~state in
- let ldir = Stm.get_ldir ~doc:state.doc in
- Aux_file.(start_aux_file
- ~aux_file:(aux_file_name_for long_f_dot_vo)
- ~v_file:long_f_dot_v);
- 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 state = Vernac.load_vernac ~echo ~check:true ~interactive:false ~state long_f_dot_v in
- let _doc = Stm.join ~doc:state.doc in
- let wall_clock2 = Unix.gettimeofday () in
- check_pending_proofs ();
- Library.save_library_to ldir long_f_dot_vo (Global.opaque_tables ());
- Aux_file.record_in_aux_at "vo_compile_time"
- (Printf.sprintf "%.3f" (wall_clock2 -. wall_clock1));
- Aux_file.stop_aux_file ();
- Dumpglob.end_dump_glob ()
-
- | BuildVio ->
- Flags.record_aux_file := false;
- Dumpglob.noglob ();
-
- let long_f_dot_v = ensure_v f_in in
- ensure_exists long_f_dot_v;
-
- let long_f_dot_vio =
- match f_out with
- | None -> long_f_dot_v ^ "io"
- | Some f -> ensure_vio long_f_dot_v f in
-
- (* We need to disable error resiliency, otherwise some errors
- will be ignored in batch mode. c.f. #6707
-
- This is not necessary in the vo case as it fully checks the
- document anyways. *)
- let stm_options = let open Stm.AsyncOpts in
- { stm_options with
- async_proofs_cmd_error_resilience = false;
- async_proofs_tac_error_resilience = `None;
- } in
-
- Feedback.del_feeder !cur_feeder;
- let doc_feeder = Feedback.add_feeder coqtop_doc_feed in
- let doc, sid =
- Stm.(new_doc
- { doc_type = VioDoc long_f_dot_vio;
- iload_path; require_libs; stm_options;
- }) in
- Feedback.del_feeder doc_feeder;
- cur_feeder := Feedback.add_feeder coqtop_init_feed;
-
- let state = { doc; sid; proof = None; time = opts.time } in
- let state = load_init_vernaculars cur_feeder opts ~state in
- let ldir = Stm.get_ldir ~doc:state.doc in
- let state = Vernac.load_vernac ~echo ~check:false ~interactive:false ~state long_f_dot_v in
- let doc = Stm.finish ~doc:state.doc in
- check_pending_proofs ();
- let _doc = Stm.snapshot_vio ~doc ldir long_f_dot_vio in
- Stm.reset_task_queue ()
-
- | Vio2Vo ->
- let open Filename in
- Flags.record_aux_file := false;
- Dumpglob.noglob ();
- let f = if check_suffix f_in ".vio" then chop_extension f_in else f_in in
- let lfdv, sum, lib, univs, disch, tasks, proofs = Library.load_library_todo f in
- let univs, proofs = Stm.finish_tasks lfdv univs disch proofs tasks in
- Library.save_library_raw lfdv sum lib univs proofs
-
-let compile cur_feeder opts ~echo ~f_in ~f_out =
- ignore(CoqworkmgrApi.get 1);
- compile cur_feeder opts ~echo ~f_in ~f_out;
- CoqworkmgrApi.giveback 1
-
-let compile_file cur_feeder opts (f_in, echo) =
- let f_out = opts.compilation_output_name in
- if !Flags.beautify then
- Flags.with_option Flags.beautify_file
- (fun f_in -> compile cur_feeder opts ~echo ~f_in ~f_out) f_in
- else
- compile cur_feeder opts ~echo ~f_in ~f_out
-
-let compile_files cur_feeder opts =
- let compile_list = List.rev opts.compile_list in
- List.iter (compile_file cur_feeder opts) compile_list
-
-(******************************************************************************)
-(* VIO Dispatching *)
-(******************************************************************************)
-let check_vio_tasks opts =
- let rc =
- List.fold_left (fun acc t -> Vio_checking.check_vio t && acc)
- true (List.rev opts.vio_tasks) in
- if not rc then fatal_error Pp.(str "VIO Task Check failed")
-
-(* vio files *)
-let schedule_vio opts =
- if opts.vio_checking then
- Vio_checking.schedule_vio_checking opts.vio_files_j opts.vio_files
- else
- Vio_checking.schedule_vio_compilation opts.vio_files_j opts.vio_files
-
-let do_vio opts =
- (* We must initialize the loadpath here as the vio scheduling
- process happens outside of the STM *)
- if opts.vio_files <> [] || opts.vio_tasks <> [] then
- let iload_path = build_load_path opts in
- List.iter Mltop.add_coq_path iload_path;
-
- (* Vio compile pass *)
- if opts.vio_files <> [] then schedule_vio opts;
- (* Vio task pass *)
- if opts.vio_tasks <> [] then check_vio_tasks opts
-
-
-(******************************************************************************)
(* Color Options *)
(******************************************************************************)
let init_color opts =
@@ -414,7 +155,8 @@ let init_toplevel custom_init arglist =
CProfile.init_profile ();
init_gc ();
Sys.catch_break false; (* Ctrl-C is fatal during the initialisation *)
- let init_feeder = ref (Feedback.add_feeder coqtop_init_feed) in
+ let init_feeder = Feedback.add_feeder Coqloop.coqloop_feed in
+
Lib.init();
(* Coq's init process, phase 2:
@@ -456,6 +198,7 @@ let init_toplevel custom_init arglist =
Flags.if_verbose print_header ();
Mltop.init_known_plugins ();
Global.set_engagement opts.impredicative_set;
+ Global.set_indices_matter opts.indices_matter;
Global.set_VM opts.enable_VM;
Global.set_native_compiler opts.enable_native_compiler;
@@ -485,23 +228,19 @@ let init_toplevel custom_init arglist =
let require_libs = require_libs opts in
let stm_options = opts.stm_flags in
let open Vernac.State in
- Feedback.del_feeder !init_feeder;
- let doc_feeder = Feedback.add_feeder coqtop_doc_feed in
- let doc, sid =
- Stm.(new_doc
- { doc_type = Interactive opts.toplevel_name;
- iload_path; require_libs; stm_options;
- }) in
- Feedback.del_feeder doc_feeder;
- init_feeder := Feedback.add_feeder coqtop_init_feed;
+ let doc, sid = Topfmt.(in_phase ~phase:LoadingPrelude)
+ Stm.new_doc
+ Stm.{ doc_type = Interactive opts.toplevel_name;
+ iload_path; require_libs; stm_options;
+ } in
let state = { doc; sid; proof = None; time = opts.time } in
- Some (load_init_vernaculars init_feeder opts ~state), opts
+ Some (Ccompile.load_init_vernaculars opts ~state), opts
(* Non interactive: we perform a sequence of compilation steps *)
end else begin
- compile_files init_feeder opts;
+ Ccompile.compile_files opts;
(* Careful this will modify the load-path and state so after
this point some stuff may not be safe anymore. *)
- do_vio opts;
+ Ccompile.do_vio opts;
(* Allow the user to output an arbitrary state *)
outputstate opts;
None, opts
@@ -510,7 +249,7 @@ let init_toplevel custom_init arglist =
flush_all();
fatal_error_exn any
end in
- Feedback.del_feeder !init_feeder;
+ Feedback.del_feeder init_feeder;
res
type custom_toplevel = {
diff --git a/toplevel/dune b/toplevel/dune
index c2f9cd662e..f51e50aaa3 100644
--- a/toplevel/dune
+++ b/toplevel/dune
@@ -3,7 +3,6 @@
(public_name coq.toplevel)
(synopsis "Coq's Interactive Shell [terminal-based]")
(wrapped false)
- (flags :standard -open Gramlib)
(libraries num coq.stm))
; Coqlevel provides the `Num` library to plugins, we could also use
; -linkall in the plugins file, to be discussed.
diff --git a/toplevel/toplevel.mllib b/toplevel/toplevel.mllib
index 597173e5f5..732744eb42 100644
--- a/toplevel/toplevel.mllib
+++ b/toplevel/toplevel.mllib
@@ -4,5 +4,6 @@ Coqinit
Coqargs
G_toplevel
Coqloop
+Ccompile
Coqtop
WorkerLoop
diff --git a/vernac/assumptions.ml b/vernac/assumptions.ml
index 6beac2032d..3ca2a4ad6b 100644
--- a/vernac/assumptions.ml
+++ b/vernac/assumptions.ml
@@ -294,7 +294,6 @@ let traverse current t =
let type_of_constant cb = cb.Declarations.const_type
let assumptions ?(add_opaque=false) ?(add_transparent=false) st gr t =
- let (idts, knst) = st in
(** Only keep the transitive dependencies *)
let (_, graph, ax2ty) = traverse (label_of gr) t in
let fold obj _ accu = match obj with
@@ -316,7 +315,7 @@ let assumptions ?(add_opaque=false) ?(add_transparent=false) st gr t =
let t = type_of_constant cb in
let l = try GlobRef.Map_env.find obj ax2ty with Not_found -> [] in
ContextObjectMap.add (Axiom (Constant kn,l)) t accu
- else if add_opaque && (Declareops.is_opaque cb || not (Cpred.mem kn knst)) then
+ else if add_opaque && (Declareops.is_opaque cb || not (TransparentState.is_transparent_constant st kn)) then
let t = type_of_constant cb in
ContextObjectMap.add (Opaque kn) t accu
else if add_transparent then
diff --git a/vernac/assumptions.mli b/vernac/assumptions.mli
index aead345d8c..536185f4aa 100644
--- a/vernac/assumptions.mli
+++ b/vernac/assumptions.mli
@@ -28,5 +28,5 @@ val traverse :
on which a term relies (together with their type). The above warning of
{!traverse} also applies. *)
val assumptions :
- ?add_opaque:bool -> ?add_transparent:bool -> transparent_state ->
+ ?add_opaque:bool -> ?add_transparent:bool -> TransparentState.t ->
GlobRef.t -> constr -> types ContextObjectMap.t
diff --git a/vernac/attributes.ml b/vernac/attributes.ml
index 88638b295b..bc0b0310b3 100644
--- a/vernac/attributes.ml
+++ b/vernac/attributes.ml
@@ -9,7 +9,14 @@
(************************************************************************)
open CErrors
-open Vernacexpr
+
+(** The type of parsing attribute data *)
+type vernac_flags = vernac_flag list
+and vernac_flag = string * vernac_flag_value
+and vernac_flag_value =
+ | VernacFlagEmpty
+ | VernacFlagLeaf of string
+ | VernacFlagList of vernac_flags
let unsupported_attributes = function
| [] -> ()
diff --git a/vernac/attributes.mli b/vernac/attributes.mli
index c81082d5ad..c2dde4cbcc 100644
--- a/vernac/attributes.mli
+++ b/vernac/attributes.mli
@@ -8,7 +8,13 @@
(* * (see LICENSE file for the text of the license) *)
(************************************************************************)
-open Vernacexpr
+(** The type of parsing attribute data *)
+type vernac_flags = vernac_flag list
+and vernac_flag = string * vernac_flag_value
+and vernac_flag_value =
+ | VernacFlagEmpty
+ | VernacFlagLeaf of string
+ | VernacFlagList of vernac_flags
type +'a attribute
(** The type of attributes. When parsing attributes if an ['a
@@ -80,7 +86,7 @@ val parse_with_extra : 'a attribute -> vernac_flags -> vernac_flags * 'a
(** * Defining attributes. *)
-type 'a key_parser = 'a option -> Vernacexpr.vernac_flag_value -> 'a
+type 'a key_parser = 'a option -> vernac_flag_value -> 'a
(** A parser for some key in an attribute. It is given a nonempty ['a
option] when the attribute is multiply set for some command.
diff --git a/vernac/classes.ml b/vernac/classes.ml
index b0dba2485a..95e46b252b 100644
--- a/vernac/classes.ml
+++ b/vernac/classes.ml
@@ -188,8 +188,7 @@ let declare_instance_open env sigma ?hook ~tac ~program_mode ~global ~poly k id
]
in
ignore (Pfedit.by init_refine)
- else if Flags.is_auto_intros () then
- ignore (Pfedit.by (Tactics.auto_intros_tac ids));
+ else ignore (Pfedit.by (Tactics.auto_intros_tac ids));
(match tac with Some tac -> ignore (Pfedit.by tac) | None -> ())) ()
let do_transparent_instance env env' sigma ?hook ~refine ~tac ~global ~poly ~program_mode cty k u ctx ctx' pri decl imps subst id props =
diff --git a/vernac/comAssumption.ml b/vernac/comAssumption.ml
index 8707121306..4cdc60216e 100644
--- a/vernac/comAssumption.ml
+++ b/vernac/comAssumption.ml
@@ -29,7 +29,7 @@ let axiom_into_instance = ref false
let _ =
let open Goptions in
declare_bool_option
- { optdepr = false;
+ { optdepr = true;
optname = "automatically declare axioms whose type is a typeclass as instances";
optkey = ["Typeclasses";"Axioms";"Are";"Instances"];
optread = (fun _ -> !axiom_into_instance);
@@ -156,7 +156,7 @@ let do_assumptions kind nl l =
((sigma,env,ienv),((is_coe,idl),t,imps)))
(sigma,env,empty_internalization_env) l
in
- let sigma = solve_remaining_evars all_and_fail_flags env sigma (Evd.from_env env) in
+ let sigma = solve_remaining_evars all_and_fail_flags env sigma in
(* The universe constraints come from the whole telescope. *)
let sigma = Evd.minimize_universes sigma in
let nf_evar c = EConstr.to_constr sigma c in
diff --git a/vernac/comDefinition.ml b/vernac/comDefinition.ml
index 472411ac3a..9c80f1d2f5 100644
--- a/vernac/comDefinition.ml
+++ b/vernac/comDefinition.ml
@@ -87,8 +87,7 @@ let interp_definition pl bl poly red_option c ctypopt =
let check_definition (ce, evd, _, imps) =
let env = Global.env () in
- let empty_sigma = Evd.from_env env in
- check_evars_are_solved env evd empty_sigma;
+ check_evars_are_solved env evd;
ce
let do_definition ~program_mode ident k univdecl bl red_option c ctypopt hook =
diff --git a/vernac/comFixpoint.ml b/vernac/comFixpoint.ml
index a9c499b192..274c99107f 100644
--- a/vernac/comFixpoint.ml
+++ b/vernac/comFixpoint.ml
@@ -239,7 +239,7 @@ let check_recursive isfix env evd (fixnames,fixdefs,_) =
end
let ground_fixpoint env evd (fixnames,fixdefs,fixtypes) =
- check_evars_are_solved env evd (Evd.from_env env);
+ check_evars_are_solved env evd;
let fixdefs = List.map (fun c -> Option.map EConstr.(to_constr evd) c) fixdefs in
let fixtypes = List.map EConstr.(to_constr evd) fixtypes in
Evd.evar_universe_context evd, (fixnames,fixdefs,fixtypes)
diff --git a/vernac/comInductive.ml b/vernac/comInductive.ml
index f405c4d5a9..8507ee6e2c 100644
--- a/vernac/comInductive.ml
+++ b/vernac/comInductive.ml
@@ -266,7 +266,7 @@ let inductive_levels env evd poly arities inds =
in
let minlev =
(** Indices contribute. *)
- if Indtypes.is_indices_matter () && List.length ctx > 0 then (
+ if indices_matter env && List.length ctx > 0 then (
let ilev = sign_level env evd ctx in
Univ.sup ilev minlev)
else minlev
@@ -402,7 +402,7 @@ let interp_mutual_inductive_gen env0 ~template udecl (uparamsl,paramsl,indl) not
let env_ar_params = EConstr.push_rel_context ctx_params env_ar in
(* Try further to solve evars, and instantiate them *)
- let sigma = solve_remaining_evars all_and_fail_flags env_params sigma (Evd.from_env env_params) in
+ let sigma = solve_remaining_evars all_and_fail_flags env_params sigma in
(* Compute renewed arities *)
let sigma = Evd.minimize_universes sigma in
let nf = Evarutil.nf_evars_universes sigma in
diff --git a/vernac/dune b/vernac/dune
index 4673251002..45b567d631 100644
--- a/vernac/dune
+++ b/vernac/dune
@@ -3,7 +3,6 @@
(synopsis "Coq's Vernacular Language")
(public_name coq.vernac)
(wrapped false)
- (flags :standard -open Gramlib)
(libraries tactics parsing))
(rule
diff --git a/vernac/egramml.mli b/vernac/egramml.mli
index a90ef97e7d..3689f60383 100644
--- a/vernac/egramml.mli
+++ b/vernac/egramml.mli
@@ -21,10 +21,10 @@ type 's grammar_prod_item =
('s, 'a) Extend.symbol) Loc.located -> 's grammar_prod_item
val extend_vernac_command_grammar :
- Vernacexpr.extend_name -> vernac_expr Pcoq.Entry.t option ->
+ extend_name -> vernac_expr Pcoq.Entry.t option ->
vernac_expr grammar_prod_item list -> unit
-val get_extend_vernac_rule : Vernacexpr.extend_name -> vernac_expr grammar_prod_item list
+val get_extend_vernac_rule : extend_name -> vernac_expr grammar_prod_item list
val proj_symbol : ('a, 'b, 'c) Extend.ty_user_symbol -> ('a, 'b, 'c) Genarg.genarg_type
diff --git a/vernac/explainErr.ml b/vernac/explainErr.ml
index e6803443b3..befb4d7ccf 100644
--- a/vernac/explainErr.ml
+++ b/vernac/explainErr.ml
@@ -29,7 +29,7 @@ exception EvaluatedError of Pp.t * exn option
let explain_exn_default = function
(* Basic interaction exceptions *)
| Stream.Error txt -> hov 0 (str "Syntax error: " ++ str txt ++ str ".")
- | Plexing.Error txt -> hov 0 (str "Syntax error: " ++ str txt ++ str ".")
+ | Gramlib.Plexing.Error txt -> hov 0 (str "Syntax error: " ++ str txt ++ str ".")
| CLexer.Error.E err -> hov 0 (str (CLexer.Error.to_string err))
| Sys_error msg -> hov 0 (str "System error: " ++ guill msg)
| Out_of_memory -> hov 0 (str "Out of memory.")
diff --git a/vernac/g_vernac.mlg b/vernac/g_vernac.mlg
index 1d0a5ab0a3..e3f6a87541 100644
--- a/vernac/g_vernac.mlg
+++ b/vernac/g_vernac.mlg
@@ -30,6 +30,7 @@ open Pcoq.Prim
open Pcoq.Constr
open Pcoq.Module
open Pvernac.Vernac_
+open Attributes
let vernac_kw = [ ";"; ","; ">->"; ":<"; "<:"; "where"; "at" ]
let _ = List.iter CLexer.add_keyword vernac_kw
@@ -473,7 +474,7 @@ END
{
let only_starredidentrefs =
- Gram.Entry.of_parser "test_only_starredidentrefs"
+ Pcoq.Entry.of_parser "test_only_starredidentrefs"
(fun strm ->
let rec aux n =
match Util.stream_nth n strm with
@@ -989,8 +990,9 @@ GRAMMAR EXTEND Gram
| IDENT "Scope"; s = IDENT -> { PrintScope s }
| IDENT "Visibility"; s = OPT IDENT -> { PrintVisibility s }
| IDENT "Implicit"; qid = smart_global -> { PrintImplicit qid }
- | IDENT "Universes"; fopt = OPT ne_string -> { PrintUniverses (false, fopt) }
- | IDENT "Sorted"; IDENT "Universes"; fopt = OPT ne_string -> { PrintUniverses (true, fopt) }
+ | b = [ IDENT "Sorted" -> { true } | -> { false } ]; IDENT "Universes";
+ g = OPT printunivs_subgraph; fopt = OPT ne_string ->
+ { PrintUniverses (b, g, fopt) }
| IDENT "Assumptions"; qid = smart_global -> { PrintAssumptions (false, false, qid) }
| IDENT "Opaque"; IDENT "Dependencies"; qid = smart_global -> { PrintAssumptions (true, false, qid) }
| IDENT "Transparent"; IDENT "Dependencies"; qid = smart_global -> { PrintAssumptions (false, true, qid) }
@@ -1000,6 +1002,9 @@ GRAMMAR EXTEND Gram
| IDENT "Registered" -> { PrintRegistered }
] ]
;
+ printunivs_subgraph:
+ [ [ IDENT "Subgraph"; "("; l = LIST0 reference; ")" -> { l } ] ]
+ ;
class_rawexpr:
[ [ IDENT "Funclass" -> { FunClass }
| IDENT "Sortclass" -> { SortClass }
diff --git a/vernac/himsg.ml b/vernac/himsg.ml
index ba31f73030..6c7117b513 100644
--- a/vernac/himsg.ml
+++ b/vernac/himsg.ml
@@ -884,8 +884,6 @@ let explain_not_match_error = function
let status b = if b then str"polymorphic" else str"monomorphic" in
str "a " ++ status b ++ str" declaration was expected, but a " ++
status (not b) ++ str" declaration was found"
- | IncompatibleInstances ->
- str"polymorphic universe instances do not match"
| IncompatibleUniverses incon ->
str"the universe constraints are inconsistent: " ++
Univ.explain_universe_inconsistency UnivNames.pr_with_global_universes incon
@@ -894,11 +892,22 @@ let explain_not_match_error = function
quote (Printer.safe_pr_lconstr_env env (Evd.from_env env) t1) ++ spc () ++
str "compared to " ++ spc () ++
quote (Printer.safe_pr_lconstr_env env (Evd.from_env env) t2)
- | IncompatibleConstraints cst ->
- str " the expected (polymorphic) constraints do not imply " ++
- let cst = Univ.UContext.constraints (Univ.AUContext.repr cst) in
- (** FIXME: provide a proper naming for the bound variables *)
- quote (Univ.pr_constraints (Termops.pr_evd_level Evd.empty) cst)
+ | IncompatibleConstraints { got; expect } ->
+ let open Univ in
+ let pr_auctx auctx =
+ let sigma = Evd.from_ctx
+ (UState.of_binders
+ (UnivNames.universe_binders_with_opt_names auctx None))
+ in
+ let uctx = AUContext.repr auctx in
+ Printer.pr_universe_instance_constraints sigma
+ (UContext.instance uctx)
+ (UContext.constraints uctx)
+ in
+ str "incompatible polymorphic binders: got" ++ spc () ++ h 0 (pr_auctx got) ++ spc() ++
+ str "but expected" ++ spc() ++ h 0 (pr_auctx expect) ++
+ (if not (Int.equal (AUContext.size got) (AUContext.size expect)) then mt() else
+ fnl() ++ str "(incompatible constraints)")
let explain_signature_mismatch l spec why =
str "Signature components for label " ++ Label.print l ++
diff --git a/vernac/lemmas.ml b/vernac/lemmas.ml
index 3b041b7065..2443c5d12a 100644
--- a/vernac/lemmas.ml
+++ b/vernac/lemmas.ml
@@ -306,17 +306,18 @@ let universe_proof_terminator compute_guard hook =
| Admitted (id,k,pe,ctx) ->
admit (id,k,pe) (UState.universe_binders ctx) (hook (Some ctx)) ();
Feedback.feedback Feedback.AddedAxiom
- | Proved (opaque,idopt,proof) ->
- let is_opaque, export_seff = match opaque with
- | Transparent -> false, true
- | Opaque -> true, false
- in
- let (id,(const,univs,persistence)) = Pfedit.cook_this_proof proof in
- let const = {const with const_entry_opaque = is_opaque} in
- let id = match idopt with
- | None -> id
- | Some { CAst.v = save_id } -> check_anonymity id save_id; save_id in
- save ~export_seff id const univs compute_guard persistence (hook (Some univs))
+ | Proved (opaque,idopt, { id; entries=[const]; persistence; universes } ) ->
+ let is_opaque, export_seff = match opaque with
+ | Transparent -> false, true
+ | Opaque -> true, false
+ in
+ let const = {const with const_entry_opaque = is_opaque} in
+ let id = match idopt with
+ | None -> id
+ | Some { CAst.v = save_id } -> check_anonymity id save_id; save_id in
+ save ~export_seff id const universes compute_guard persistence (hook (Some universes))
+ | Proved (opaque,idopt, _ ) ->
+ CErrors.anomaly Pp.(str "[universe_proof_terminator] close_proof returned more than one proof term")
end
let standard_proof_terminator compute_guard hook =
@@ -330,7 +331,7 @@ let initialize_named_context_for_proof () =
let d = if variable_opacity id then NamedDecl.LocalAssum (id, NamedDecl.get_type d) else d in
Environ.push_named_context_val d signv) sign Environ.empty_named_context_val
-let start_proof id ?pl kind sigma ?terminator ?sign c ?init_tac ?(compute_guard=[]) hook =
+let start_proof id ?pl kind sigma ?terminator ?sign c ?(compute_guard=[]) hook =
let terminator = match terminator with
| None -> standard_proof_terminator compute_guard hook
| Some terminator -> terminator compute_guard hook
@@ -340,19 +341,21 @@ let start_proof id ?pl kind sigma ?terminator ?sign c ?init_tac ?(compute_guard=
| Some sign -> sign
| None -> initialize_named_context_for_proof ()
in
- Pfedit.start_proof id ?pl kind sigma sign c ?init_tac terminator
+ let goals = [ Global.env_of_context sign , c ] in
+ Proof_global.start_proof sigma id ?pl kind goals terminator
-let start_proof_univs id ?pl kind sigma ?terminator ?sign c ?init_tac ?(compute_guard=[]) hook =
+let start_proof_univs id ?pl kind sigma ?terminator ?sign c ?(compute_guard=[]) hook =
let terminator = match terminator with
| None -> universe_proof_terminator compute_guard hook
| Some terminator -> terminator compute_guard hook
in
- let sign =
+ let sign =
match sign with
| Some sign -> sign
| None -> initialize_named_context_for_proof ()
in
- Pfedit.start_proof id ?pl kind sigma sign c ?init_tac terminator
+ let goals = [ Global.env_of_context sign , c ] in
+ Proof_global.start_proof sigma id ?pl kind goals terminator
let rec_tac_initializer finite guard thms snl =
if finite then
@@ -372,22 +375,17 @@ let start_proof_with_initialization kind sigma decl recguard thms snl hook =
let intro_tac (_, (_, (ids, _))) = Tactics.auto_intros_tac ids in
let init_tac,guard = match recguard with
| Some (finite,guard,init_tac) ->
- let rec_tac = rec_tac_initializer finite guard thms snl in
- Some (match init_tac with
- | None ->
- if Flags.is_auto_intros () then
- Tacticals.New.tclTHENS rec_tac (List.map intro_tac thms)
- else
- rec_tac
+ let rec_tac = rec_tac_initializer finite guard thms snl in
+ Some (match init_tac with
+ | None ->
+ Tacticals.New.tclTHENS rec_tac (List.map intro_tac thms)
| Some tacl ->
- Tacticals.New.tclTHENS rec_tac
- (if Flags.is_auto_intros () then
- List.map2 (fun tac thm -> Tacticals.New.tclTHEN tac (intro_tac thm)) tacl thms
- else
- tacl)),guard
+ Tacticals.New.tclTHENS rec_tac
+ List.(map2 (fun tac thm -> Tacticals.New.tclTHEN tac (intro_tac thm)) tacl thms)
+ ),guard
| None ->
- let () = match thms with [_] -> () | _ -> assert false in
- (if Flags.is_auto_intros () then Some (intro_tac (List.hd thms)) else None), [] in
+ let () = match thms with [_] -> () | _ -> assert false in
+ Some (intro_tac (List.hd thms)), [] in
match thms with
| [] -> anomaly (Pp.str "No proof to start.")
| (id,(t,(_,imps)))::other_thms ->
@@ -408,7 +406,11 @@ let start_proof_with_initialization kind sigma decl recguard thms snl hook =
List.iter (fun (strength,ref,imps) ->
maybe_declare_manual_implicits false ref imps;
call_hook (fun exn -> exn) hook strength ref) thms_data in
- start_proof_univs id ~pl:decl kind sigma t ?init_tac (fun ctx -> mk_hook (hook ctx)) ~compute_guard:guard
+ start_proof_univs id ~pl:decl kind sigma t (fun ctx -> mk_hook (hook ctx)) ~compute_guard:guard;
+ ignore (Proof_global.with_current_proof (fun _ p ->
+ match init_tac with
+ | None -> p,(true,[])
+ | Some tac -> Proof.run_tactic Global.(env ()) tac p))
let start_proof_com ?inference_hook kind thms hook =
let env0 = Global.env () in
@@ -418,8 +420,8 @@ let start_proof_com ?inference_hook kind thms hook =
let evd, (impls, ((env, ctx), imps)) = interp_context_evars env0 evd bl in
let evd, (t', imps') = interp_type_evars_impls ~impls env evd t in
let flags = all_and_fail_flags in
- let flags = { flags with use_hook = inference_hook } in
- let evd = solve_remaining_evars flags env evd Evd.empty in
+ let hook = inference_hook in
+ let evd = solve_remaining_evars ?hook flags env evd in
let ids = List.map RelDecl.get_name ctx in
check_name_freshness (pi1 kind) id;
(* XXX: The nf_evar is critical !! *)
diff --git a/vernac/lemmas.mli b/vernac/lemmas.mli
index 195fcbf4ca..246d8cbe6d 100644
--- a/vernac/lemmas.mli
+++ b/vernac/lemmas.mli
@@ -18,13 +18,13 @@ val call_hook : Future.fix_exn -> declaration_hook -> Decl_kinds.locality -> Glo
val start_proof : Id.t -> ?pl:UState.universe_decl -> goal_kind -> Evd.evar_map ->
?terminator:(Proof_global.lemma_possible_guards -> 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 ->
+ ?compute_guard:Proof_global.lemma_possible_guards ->
declaration_hook -> unit
val start_proof_univs : Id.t -> ?pl:UState.universe_decl -> goal_kind -> Evd.evar_map ->
?terminator:(Proof_global.lemma_possible_guards -> (UState.t option -> 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 ->
+ ?compute_guard:Proof_global.lemma_possible_guards ->
(UState.t option -> declaration_hook) -> unit
val start_proof_com :
diff --git a/vernac/metasyntax.ml b/vernac/metasyntax.ml
index 2e5e11bb09..5ab877fae2 100644
--- a/vernac/metasyntax.ml
+++ b/vernac/metasyntax.ml
@@ -58,7 +58,7 @@ let pr_registered_grammar name =
| None -> user_err Pp.(str "Unknown or unprintable grammar entry.")
| Some entries ->
let pr_one (Pcoq.AnyEntry e) =
- str "Entry " ++ str (Pcoq.Gram.Entry.name e) ++ str " is" ++ fnl () ++
+ str "Entry " ++ str (Pcoq.Entry.name e) ++ str " is" ++ fnl () ++
pr_entry e
in
prlist pr_one entries
diff --git a/vernac/obligations.ml b/vernac/obligations.ml
index c2805674e4..8baf391c70 100644
--- a/vernac/obligations.ml
+++ b/vernac/obligations.ml
@@ -826,26 +826,41 @@ let rec string_of_list sep f = function
| x :: ((y :: _) as tl) -> f x ^ sep ^ string_of_list sep f tl
(* Solve an obligation using tactics, return the corresponding proof term *)
+let warn_solve_errored = CWarnings.create ~name:"solve_obligation_error" ~category:"tactics" (fun err ->
+ Pp.seq [str "Solve Obligations tactic returned error: "; err; fnl ();
+ str "This will become an error in the future"])
-let solve_by_tac name evi t poly ctx =
+let solve_by_tac ?loc name evi t poly ctx =
let id = name in
(* spiwack: the status is dropped. *)
- let (entry,_,ctx') = Pfedit.build_constant_by_tactic
- id ~goal_kind:(goal_kind poly) ctx evi.evar_hyps evi.evar_concl (Tacticals.New.tclCOMPLETE t) in
- let env = Global.env () in
- let entry = Safe_typing.inline_private_constants_in_definition_entry env entry in
- let body, () = Future.force entry.const_entry_body in
- let ctx' = Evd.merge_context_set ~sideff:true Evd.univ_rigid (Evd.from_ctx ctx') (snd body) in
- Inductiveops.control_only_guard env ctx' (EConstr.of_constr (fst body));
- (fst body), entry.const_entry_type, Evd.evar_universe_context ctx'
+ try
+ let (entry,_,ctx') =
+ Pfedit.build_constant_by_tactic
+ id ~goal_kind:(goal_kind poly) ctx evi.evar_hyps evi.evar_concl t in
+ let env = Global.env () in
+ let entry = Safe_typing.inline_private_constants_in_definition_entry env entry in
+ let body, () = Future.force entry.const_entry_body in
+ let ctx' = Evd.merge_context_set ~sideff:true Evd.univ_rigid (Evd.from_ctx ctx') (snd body) in
+ Inductiveops.control_only_guard env ctx' (EConstr.of_constr (fst body));
+ Some (fst body, entry.const_entry_type, Evd.evar_universe_context ctx')
+ with
+ | Refiner.FailError (_, s) as exn ->
+ let _ = CErrors.push exn in
+ user_err ?loc ~hdr:"solve_obligation" (Lazy.force s)
+ (* If the proof is open we absorb the error and leave the obligation open *)
+ | Proof.OpenProof _ ->
+ None
+ | e when CErrors.noncritical e ->
+ let err = CErrors.print e in
+ warn_solve_errored ?loc err;
+ None
let obligation_terminator name num guard hook auto pf =
let open Proof_global in
let term = Lemmas.universe_proof_terminator guard hook in
match pf with
| Admitted _ -> apply_terminator term pf
- | Proved (opq, id, proof) ->
- let (_, (entry, uctx, _)) = Pfedit.cook_this_proof proof in
+ | Proved (opq, id, { entries=[entry]; universes=uctx } ) -> begin
let env = Global.env () in
let entry = Safe_typing.inline_private_constants_in_definition_entry env entry in
let ty = entry.Entries.const_entry_type in
@@ -904,6 +919,9 @@ let obligation_terminator name num guard hook auto pf =
with e when CErrors.noncritical e ->
let e = CErrors.push e in
pperror (CErrors.iprint (ExplainErr.process_vernac_interp_error e))
+ end
+ | Proved (_, _, _ ) ->
+ CErrors.anomaly Pp.(str "[obligation_terminator] close_proof returned more than one proof term")
let obligation_hook prg obl num auto ctx' _ gr =
let obls, rem = prg.prg_obligations in
@@ -987,41 +1005,34 @@ and solve_obligation_by_tac prg obls i tac =
match obl.obl_body with
| Some _ -> None
| None ->
- try
- if List.is_empty (deps_remaining obls obl.obl_deps) then
- let obl = subst_deps_obl obls obl in
- let tac =
- match tac with
- | Some t -> t
- | None ->
- match obl.obl_tac with
- | Some t -> t
- | None -> !default_tactic
- in
- let evd = Evd.from_ctx prg.prg_ctx in
- let evd = Evd.update_sigma_env evd (Global.env ()) in
- let t, ty, ctx =
- solve_by_tac obl.obl_name (evar_of_obligation obl) tac
- (pi2 prg.prg_kind) (Evd.evar_universe_context evd)
- in
- let uctx = UState.const_univ_entry ~poly:(pi2 prg.prg_kind) ctx in
- let prg = {prg with prg_ctx = ctx} in
- let def, obl' = declare_obligation prg obl t ty uctx in
- obls.(i) <- obl';
- if def && not (pi2 prg.prg_kind) then (
- (* Declare the term constraints with the first obligation only *)
- let evd = Evd.from_env (Global.env ()) in
- let evd = Evd.merge_universe_subst evd (Evd.universe_subst (Evd.from_ctx ctx)) in
- let ctx' = Evd.evar_universe_context evd in
- Some {prg with prg_ctx = ctx'})
- else Some prg
- else None
- with e when CErrors.noncritical e ->
- let (e, _) = CErrors.push e in
- match e with
- | Refiner.FailError (_, s) ->
- user_err ?loc:(fst obl.obl_location) ~hdr:"solve_obligation" (Lazy.force s)
- | e -> None (* FIXME really ? *)
+ if List.is_empty (deps_remaining obls obl.obl_deps) then
+ let obl = subst_deps_obl obls obl in
+ let tac =
+ match tac with
+ | Some t -> t
+ | None ->
+ match obl.obl_tac with
+ | Some t -> t
+ | None -> !default_tactic
+ in
+ let evd = Evd.from_ctx prg.prg_ctx in
+ let evd = Evd.update_sigma_env evd (Global.env ()) in
+ match solve_by_tac ?loc:(fst obl.obl_location) obl.obl_name (evar_of_obligation obl) tac
+ (pi2 prg.prg_kind) (Evd.evar_universe_context evd) with
+ | None -> None
+ | Some (t, ty, ctx) ->
+ let uctx = UState.const_univ_entry ~poly:(pi2 prg.prg_kind) ctx in
+ let prg = {prg with prg_ctx = ctx} in
+ let def, obl' = declare_obligation prg obl t ty uctx in
+ obls.(i) <- obl';
+ if def && not (pi2 prg.prg_kind) then (
+ (* Declare the term constraints with the first obligation only *)
+ let evd = Evd.from_env (Global.env ()) in
+ let evd = Evd.merge_universe_subst evd (Evd.universe_subst (Evd.from_ctx ctx)) in
+ let ctx' = Evd.evar_universe_context evd in
+ Some {prg with prg_ctx = ctx'})
+ else Some prg
+ else None
and solve_prg_obligations prg ?oblset tac =
let obls, rem = prg.prg_obligations in
diff --git a/vernac/ppvernac.ml b/vernac/ppvernac.ml
index 1c1faca599..2ddd210365 100644
--- a/vernac/ppvernac.ml
+++ b/vernac/ppvernac.ml
@@ -492,12 +492,13 @@ open Pputils
keyword "Print Hint *"
| PrintHintDbName s ->
keyword "Print HintDb" ++ spc () ++ str s
- | PrintUniverses (b, fopt) ->
+ | PrintUniverses (b, g, fopt) ->
let cmd =
if b then "Print Sorted Universes"
else "Print Universes"
in
- keyword cmd ++ pr_opt str fopt
+ let pr_subgraph = prlist_with_sep spc pr_qualid in
+ keyword cmd ++ pr_opt pr_subgraph g ++ pr_opt str fopt
| PrintName (qid,udecl) ->
keyword "Print" ++ spc() ++ pr_smart_global qid ++ pr_univ_name_list udecl
| PrintModuleType qid ->
@@ -1213,6 +1214,7 @@ open Pputils
let rec pr_vernac_flag (k, v) =
let k = keyword k in
+ let open Attributes in
match v with
| VernacFlagEmpty -> k
| VernacFlagLeaf v -> k ++ str " = " ++ qs v
diff --git a/vernac/pvernac.ml b/vernac/pvernac.ml
index b2fa8ec99f..f26e0d0885 100644
--- a/vernac/pvernac.ml
+++ b/vernac/pvernac.ml
@@ -41,8 +41,8 @@ module Vernac_ =
let command_entry_ref = ref noedit_mode
let command_entry =
- Gram.Entry.of_parser "command_entry"
- (fun strm -> Gram.Entry.parse_token !command_entry_ref strm)
+ Pcoq.Entry.of_parser "command_entry"
+ (fun strm -> Pcoq.Entry.parse_token_stream !command_entry_ref strm)
end
diff --git a/vernac/record.ml b/vernac/record.ml
index ac84003266..7bdf6a973f 100644
--- a/vernac/record.ml
+++ b/vernac/record.ml
@@ -160,7 +160,7 @@ let typecheck_params_and_fields finite def poly pl ps records =
in
let (sigma, data) = List.fold_left2_map fold sigma records arities in
let sigma =
- Pretyping.solve_remaining_evars Pretyping.all_and_fail_flags env_ar sigma (Evd.from_env env_ar) in
+ Pretyping.solve_remaining_evars Pretyping.all_and_fail_flags env_ar sigma in
let fold sigma (typ, sort) (_, newfs) =
let _, univ = compute_constructor_level sigma env_ar newfs in
if not def && (Sorts.is_prop sort ||
diff --git a/vernac/topfmt.ml b/vernac/topfmt.ml
index f842ca5ead..4bf76dae51 100644
--- a/vernac/topfmt.ml
+++ b/vernac/topfmt.ml
@@ -335,6 +335,20 @@ type execution_phase =
| LoadingRcFile
| InteractiveLoop
+let default_phase = ref InteractiveLoop
+
+let in_phase ~phase f x =
+ let op = !default_phase in
+ default_phase := phase;
+ try
+ let res = f x in
+ default_phase := op;
+ res
+ with exn ->
+ let iexn = Backtrace.add_backtrace exn in
+ default_phase := op;
+ Util.iraise iexn
+
let pr_loc loc =
let fname = loc.Loc.fname in
match fname with
@@ -347,8 +361,8 @@ let pr_loc loc =
int (loc.bp-loc.bol_pos) ++ str"-" ++ int (loc.ep-loc.bol_pos) ++
str":")
-let pr_phase ?loc phase =
- match phase, loc with
+let pr_phase ?loc () =
+ match !default_phase, loc with
| LoadingRcFile, loc ->
(* For when all errors go through feedback:
str "While loading rcfile:" ++
@@ -363,10 +377,10 @@ let pr_phase ?loc phase =
(* Note: interactive messages such as "foo is defined" are not located *)
None
-let print_err_exn phase any =
+let print_err_exn any =
let (e, info) = CErrors.push any in
let loc = Loc.get_loc info in
- let pre_hdr = pr_phase ?loc phase in
+ let pre_hdr = pr_phase ?loc () in
let msg = CErrors.iprint (e, info) ++ fnl () in
std_logger ?pre_hdr Feedback.Error msg
diff --git a/vernac/topfmt.mli b/vernac/topfmt.mli
index 73dcb0064b..0ddf474970 100644
--- a/vernac/topfmt.mli
+++ b/vernac/topfmt.mli
@@ -61,9 +61,11 @@ type execution_phase =
| LoadingRcFile
| InteractiveLoop
+val in_phase : phase:execution_phase -> ('a -> 'b) -> 'a -> 'b
+
val pr_loc : Loc.t -> Pp.t
-val pr_phase : ?loc:Loc.t -> execution_phase -> Pp.t option
-val print_err_exn : execution_phase -> exn -> unit
+val pr_phase : ?loc:Loc.t -> unit -> Pp.t option
+val print_err_exn : exn -> unit
(** [with_output_to_file file f x] executes [f x] with logging
redirected to a file [file] *)
diff --git a/vernac/vernacentries.ml b/vernac/vernacentries.ml
index 1fab35b650..a78329ad1d 100644
--- a/vernac/vernacentries.ml
+++ b/vernac/vernacentries.ml
@@ -319,7 +319,7 @@ let print_registered () =
hov 0 (prlist_with_sep fnl pr_lib_ref @@ Coqlib.get_lib_refs ())
-let dump_universes_gen g s =
+let dump_universes_gen prl g s =
let output = open_out s in
let output_constraint, close =
if Filename.check_suffix s ".dot" || Filename.check_suffix s ".gv" then begin
@@ -344,10 +344,12 @@ let dump_universes_gen g s =
| Univ.Lt -> "<"
| Univ.Le -> "<="
| Univ.Eq -> "="
- in Printf.fprintf output "%s %s %s ;\n" left kind right
+ in
+ Printf.fprintf output "%s %s %s ;\n" left kind right
end, (fun () -> close_out output)
end
in
+ let output_constraint k l r = output_constraint k (prl l) (prl r) in
try
UGraph.dump_universes output_constraint g;
close ();
@@ -357,6 +359,36 @@ let dump_universes_gen g s =
close ();
iraise reraise
+let universe_subgraph ?loc g univ =
+ let open Univ in
+ let sigma = Evd.from_env (Global.env()) in
+ let univs_of q =
+ let q = Glob_term.(GType (UNamed q)) in
+ (* this function has a nice error message for not found univs *)
+ LSet.singleton (Pretyping.interp_known_glob_level ?loc sigma q)
+ in
+ let univs = List.fold_left (fun univs q -> LSet.union univs (univs_of q)) LSet.empty g in
+ let csts = UGraph.constraints_for ~kept:(LSet.add Level.prop (LSet.add Level.set univs)) univ in
+ let univ = LSet.fold UGraph.add_universe_unconstrained univs UGraph.initial_universes in
+ UGraph.merge_constraints csts univ
+
+let print_universes ?loc ~sort ~subgraph dst =
+ let univ = Global.universes () in
+ let univ = match subgraph with
+ | None -> univ
+ | Some g -> universe_subgraph ?loc g univ
+ in
+ let univ = if sort then UGraph.sort_universes univ else univ in
+ let pr_remaining =
+ if Global.is_joined_environment () then mt ()
+ else str"There may remain asynchronous universe constraints"
+ in
+ let prl = UnivNames.pr_with_global_universes in
+ begin match dst with
+ | None -> UGraph.pr_universes prl univ ++ pr_remaining
+ | Some s -> dump_universes_gen (fun u -> Pp.string_of_ppcmds (prl u)) univ s
+ end
+
(*********************)
(* "Locate" commands *)
@@ -457,8 +489,7 @@ let start_proof_and_print k l hook =
Evarutil.is_ground_term sigma concl)
then raise Exit;
let c, _, ctx =
- Pfedit.build_by_tactic env (Evd.evar_universe_context sigma)
- concl (Tacticals.New.tclCOMPLETE tac)
+ Pfedit.build_by_tactic env (Evd.evar_universe_context sigma) concl tac
in Evd.set_universe_context sigma ctx, EConstr.of_constr c
with Logic_monad.TacticFailure e when Logic.catchable_exception e ->
user_err Pp.(str "The statement obligations could not be resolved \
@@ -1064,15 +1095,30 @@ let vernac_restore_state file =
(* Commands *)
let vernac_create_hintdb ~module_local id b =
- Hints.create_hint_db module_local id full_transparent_state b
-
-let vernac_remove_hints ~module_local dbs ids =
- Hints.remove_hints module_local dbs (List.map Smartlocate.global_with_alias ids)
+ Hints.create_hint_db module_local id TransparentState.full b
+
+let warn_implicit_core_hint_db =
+ CWarnings.create ~name:"implicit-core-hint-db" ~category:"deprecated"
+ (fun () -> strbrk "Adding and removing hints in the core database implicitly is deprecated. "
+ ++ strbrk"Please specify a hint database.")
+
+let vernac_remove_hints ~module_local dbnames ids =
+ let dbnames =
+ if List.is_empty dbnames then
+ (warn_implicit_core_hint_db (); ["core"])
+ else dbnames
+ in
+ Hints.remove_hints module_local dbnames (List.map Smartlocate.global_with_alias ids)
-let vernac_hints ~atts lb h =
+let vernac_hints ~atts dbnames h =
+ let dbnames =
+ if List.is_empty dbnames then
+ (warn_implicit_core_hint_db (); ["core"])
+ else dbnames
+ in
let local, poly = Attributes.(parse Notations.(locality ++ polymorphic) atts) in
let local = enforce_module_locality local in
- Hints.add_hints ~local lb (Hints.interp_hints poly h)
+ Hints.add_hints ~local dbnames (Hints.interp_hints poly h)
let vernac_syntactic_definition ~module_local lid x y =
Dumpglob.dump_definition lid false "syndef";
@@ -1421,14 +1467,6 @@ let _ =
let _ =
declare_bool_option
- { optdepr = true; (* remove in 8.8 *)
- optname = "automatic introduction of variables";
- optkey = ["Automatic";"Introduction"];
- optread = Flags.is_auto_intros;
- optwrite = Flags.make_auto_intros }
-
-let _ =
- declare_bool_option
{ optdepr = false;
optname = "coercion printing";
optkey = ["Printing";"Coercions"];
@@ -1826,17 +1864,7 @@ let vernac_print ~atts env sigma =
| PrintCoercionPaths (cls,clt) ->
Prettyp.print_path_between (cl_of_qualid cls) (cl_of_qualid clt)
| PrintCanonicalConversions -> Prettyp.print_canonical_projections env sigma
- | PrintUniverses (b, dst) ->
- let univ = Global.universes () in
- let univ = if b then UGraph.sort_universes univ else univ in
- let pr_remaining =
- if Global.is_joined_environment () then mt ()
- else str"There may remain asynchronous universe constraints"
- in
- begin match dst with
- | None -> UGraph.pr_universes UnivNames.pr_with_global_universes univ ++ pr_remaining
- | Some s -> dump_universes_gen univ s
- end
+ | PrintUniverses (sort, subgraph, dst) -> print_universes ~sort ~subgraph dst
| PrintHint r -> Hints.pr_hint_ref env sigma (smart_global r)
| PrintHintGoal -> Hints.pr_applicable_hint ()
| PrintHintDbName s -> Hints.pr_hint_db_by_name env sigma s
diff --git a/vernac/vernacexpr.ml b/vernac/vernacexpr.ml
index 594e9eca48..122005e011 100644
--- a/vernac/vernacexpr.ml
+++ b/vernac/vernacexpr.ml
@@ -45,7 +45,7 @@ type printable =
| PrintCoercions
| PrintCoercionPaths of class_rawexpr * class_rawexpr
| PrintCanonicalConversions
- | PrintUniverses of bool * string option
+ | PrintUniverses of bool * qualid list option * string option
| PrintHint of qualid or_by_notation
| PrintHintGoal
| PrintHintDbName of string
@@ -219,13 +219,6 @@ type section_subset_expr =
{b ("ExtractionBlacklist", 0)} indicates {b Extraction Blacklist {i ident{_1}} ... {i ident{_n}}} command.
*)
-type extend_name =
- (** Name of the vernac entry where the tactic is defined, typically found
- after the VERNAC EXTEND statement in the source. *)
- string *
- (** Index of the extension in the VERNAC EXTEND statement. Each parsing branch
- is given an offset, starting from zero. *)
- int
(* This type allows registering the inlining of constants in native compiler.
It will be extended with primitive inductive types and operators *)
@@ -253,6 +246,14 @@ type vernac_argument_status = {
implicit_status : vernac_implicit_status;
}
+type extend_name =
+ (** Name of the vernac entry where the tactic is defined, typically found
+ after the VERNAC EXTEND statement in the source. *)
+ string *
+ (** Index of the extension in the VERNAC EXTEND statement. Each parsing branch
+ is given an offset, starting from zero. *)
+ int
+
type nonrec vernac_expr =
| VernacLoad of verbose_flag * string
@@ -395,71 +396,11 @@ type nonrec vernac_expr =
(* For extension *)
| VernacExtend of extend_name * Genarg.raw_generic_argument list
-type vernac_flags = vernac_flag list
-and vernac_flag = string * vernac_flag_value
-and vernac_flag_value =
- | VernacFlagEmpty
- | VernacFlagLeaf of string
- | VernacFlagList of vernac_flags
-
type vernac_control =
- | VernacExpr of vernac_flags * vernac_expr
+ | VernacExpr of Attributes.vernac_flags * 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 CAst.t
| VernacRedirect of string * vernac_control CAst.t
| VernacTimeout of int * vernac_control
| VernacFail of vernac_control
-
-(* A vernac classifier provides information about the exectuion of a
- command:
-
- - vernac_when: encodes if the vernac may alter the parser [thus
- forcing immediate execution], or if indeed it is pure and parsing
- can continue without its execution.
-
- - vernac_type: if it is starts, ends, continues a proof or
- alters the global state or is a control command like BackTo or is
- a query like Check.
-
- The classification works on the assumption that we have 3 states:
- parsing, execution (global enviroment, etc...), and proof
- state. For example, commands that only alter the proof state are
- considered safe to delegate to a worker.
-
-*)
-type vernac_type =
- (* Start of a proof *)
- | VtStartProof of vernac_start
- (* Command altering the global state, bad for parallel
- processing. *)
- | VtSideff of vernac_sideff_type
- (* End of a proof *)
- | VtQed of vernac_qed_type
- (* A proof step *)
- | VtProofStep of proof_step
- (* To be removed *)
- | VtProofMode of string
- (* Queries are commands assumed to be "pure", that is to say, they
- don't modify the interpretation state. *)
- | VtQuery
- (* To be removed *)
- | VtMeta
- | VtUnknown
-and vernac_qed_type = VtKeep | VtKeepAsAxiom | VtDrop (* Qed/Admitted, Abort *)
-and vernac_start = string * opacity_guarantee * Id.t list
-and vernac_sideff_type = Id.t list
-and opacity_guarantee =
- | GuaranteesOpacity (** Only generates opaque terms at [Qed] *)
- | Doesn'tGuaranteeOpacity (** May generate transparent terms even with [Qed].*)
-and proof_step = { (* TODO: inline with OCaml 4.03 *)
- parallel : [ `Yes of solving_tac * anon_abstracting_tac | `No ];
- proof_block_detection : proof_block_name option
-}
-and solving_tac = bool (* a terminator *)
-and anon_abstracting_tac = bool (* abstracting anonymously its result *)
-and proof_block_name = string (* open type of delimiters *)
-type vernac_when =
- | VtNow
- | VtLater
-type vernac_classification = vernac_type * vernac_when
diff --git a/vernac/vernacextend.ml b/vernac/vernacextend.ml
index 5fba586298..35f26cab4d 100644
--- a/vernac/vernacextend.ml
+++ b/vernac/vernacextend.ml
@@ -12,7 +12,43 @@ open Util
open Pp
open CErrors
-type 'a vernac_command = 'a -> atts:Vernacexpr.vernac_flags -> st:Vernacstate.t -> Vernacstate.t
+type vernac_type =
+ (* Start of a proof *)
+ | VtStartProof of vernac_start
+ (* Command altering the global state, bad for parallel
+ processing. *)
+ | VtSideff of vernac_sideff_type
+ (* End of a proof *)
+ | VtQed of vernac_qed_type
+ (* A proof step *)
+ | VtProofStep of {
+ parallel : [ `Yes of solving_tac * anon_abstracting_tac | `No ];
+ proof_block_detection : proof_block_name option
+ }
+ (* To be removed *)
+ | VtProofMode of string
+ (* Queries are commands assumed to be "pure", that is to say, they
+ don't modify the interpretation state. *)
+ | VtQuery
+ (* To be removed *)
+ | VtMeta
+ | VtUnknown
+and vernac_qed_type = VtKeep | VtKeepAsAxiom | VtDrop (* Qed/Admitted, Abort *)
+and vernac_start = string * opacity_guarantee * Names.Id.t list
+and vernac_sideff_type = Names.Id.t list
+and opacity_guarantee =
+ | GuaranteesOpacity (** Only generates opaque terms at [Qed] *)
+ | Doesn'tGuaranteeOpacity (** May generate transparent terms even with [Qed].*)
+and solving_tac = bool (** a terminator *)
+and anon_abstracting_tac = bool (** abstracting anonymously its result *)
+and proof_block_name = string (** open type of delimiters *)
+
+type vernac_when =
+ | VtNow
+ | VtLater
+type vernac_classification = vernac_type * vernac_when
+
+type 'a vernac_command = 'a -> atts:Attributes.vernac_flags -> st:Vernacstate.t -> Vernacstate.t
type plugin_args = Genarg.raw_generic_argument list
@@ -68,10 +104,23 @@ let call opn converted_args ~atts ~st =
(** VERNAC EXTEND registering *)
-type classifier = Genarg.raw_generic_argument list -> Vernacexpr.vernac_classification
+type classifier = Genarg.raw_generic_argument list -> vernac_classification
+
+(** Classifiers *)
+let classifiers : classifier array String.Map.t ref = ref String.Map.empty
+
+let get_vernac_classifier (name, i) args =
+ (String.Map.find name !classifiers).(i) args
+
+let declare_vernac_classifier name f =
+ classifiers := String.Map.add name f !classifiers
+
+let classify_as_query = VtQuery, VtLater
+let classify_as_sideeff = VtSideff [], VtLater
+let classify_as_proofstep = VtProofStep { parallel = `No; proof_block_detection = None}, VtLater
type (_, _) ty_sig =
-| TyNil : (atts:Vernacexpr.vernac_flags -> st:Vernacstate.t -> Vernacstate.t, Vernacexpr.vernac_classification) ty_sig
+| TyNil : (atts:Attributes.vernac_flags -> st:Vernacstate.t -> Vernacstate.t, vernac_classification) ty_sig
| TyTerminal : string * ('r, 's) ty_sig -> ('r, 's) ty_sig
| TyNonTerminal : ('a, 'b, 'c) Extend.ty_user_symbol * ('r, 's) ty_sig -> ('a -> 'r, 'a -> 's) ty_sig
@@ -124,7 +173,7 @@ let rec untype_user_symbol : type s a b c. (a, b, c) Extend.ty_user_symbol -> (s
| TUentry a -> Aentry (Pcoq.genarg_grammar (Genarg.ExtraArg a))
| TUentryl (a, i) -> Aentryl (Pcoq.genarg_grammar (Genarg.ExtraArg a), string_of_int i)
-let rec untype_grammar : type r s. (r, s) ty_sig -> Vernacexpr.vernac_expr Egramml.grammar_prod_item list = function
+let rec untype_grammar : type r s. (r, s) ty_sig -> 'a Egramml.grammar_prod_item list = function
| TyNil -> []
| TyTerminal (tok, ty) -> Egramml.GramTerminal tok :: untype_grammar ty
| TyNonTerminal (tu, ty) ->
@@ -132,16 +181,6 @@ let rec untype_grammar : type r s. (r, s) ty_sig -> Vernacexpr.vernac_expr Egram
let symb = untype_user_symbol tu in
Egramml.GramNonTerminal (Loc.tag (t, symb)) :: untype_grammar ty
-let _ = untype_classifier, untype_command, untype_grammar, untype_user_symbol
-
-let classifiers : classifier array String.Map.t ref = ref String.Map.empty
-
-let get_vernac_classifier (name, i) args =
- (String.Map.find name !classifiers).(i) args
-
-let declare_vernac_classifier name f =
- classifiers := String.Map.add name f !classifiers
-
let vernac_extend ~command ?classifier ?entry ext =
let get_classifier (TyML (_, ty, _, cl)) = match cl with
| Some cl -> untype_classifier ty cl
@@ -151,7 +190,7 @@ let vernac_extend ~command ?classifier ?entry ext =
| None ->
let e = match entry with
| None -> "COMMAND"
- | Some e -> Pcoq.Gram.Entry.name e
+ | Some e -> Pcoq.Entry.name e
in
let msg = Printf.sprintf "\
Vernac entry \"%s\" misses a classifier. \
diff --git a/vernac/vernacextend.mli b/vernac/vernacextend.mli
index bb94f3a6a9..7feaccd9a3 100644
--- a/vernac/vernacextend.mli
+++ b/vernac/vernacextend.mli
@@ -8,20 +8,75 @@
(* * (see LICENSE file for the text of the license) *)
(************************************************************************)
+(** Vernacular Extension data *)
+
+(* A vernac classifier provides information about the exectuion of a
+ command:
+
+ - vernac_when: encodes if the vernac may alter the parser [thus
+ forcing immediate execution], or if indeed it is pure and parsing
+ can continue without its execution.
+
+ - vernac_type: if it is starts, ends, continues a proof or
+ alters the global state or is a control command like BackTo or is
+ a query like Check.
+
+ The classification works on the assumption that we have 3 states:
+ parsing, execution (global enviroment, etc...), and proof
+ state. For example, commands that only alter the proof state are
+ considered safe to delegate to a worker.
+
+*)
+type vernac_type =
+ (* Start of a proof *)
+ | VtStartProof of vernac_start
+ (* Command altering the global state, bad for parallel
+ processing. *)
+ | VtSideff of vernac_sideff_type
+ (* End of a proof *)
+ | VtQed of vernac_qed_type
+ (* A proof step *)
+ | VtProofStep of {
+ parallel : [ `Yes of solving_tac * anon_abstracting_tac | `No ];
+ proof_block_detection : proof_block_name option
+ }
+ (* To be removed *)
+ | VtProofMode of string
+ (* Queries are commands assumed to be "pure", that is to say, they
+ don't modify the interpretation state. *)
+ | VtQuery
+ (* To be removed *)
+ | VtMeta
+ | VtUnknown
+and vernac_qed_type = VtKeep | VtKeepAsAxiom | VtDrop (* Qed/Admitted, Abort *)
+and vernac_start = string * opacity_guarantee * Names.Id.t list
+and vernac_sideff_type = Names.Id.t list
+and opacity_guarantee =
+ | GuaranteesOpacity (** Only generates opaque terms at [Qed] *)
+ | Doesn'tGuaranteeOpacity (** May generate transparent terms even with [Qed].*)
+and solving_tac = bool (** a terminator *)
+and anon_abstracting_tac = bool (** abstracting anonymously its result *)
+and proof_block_name = string (** open type of delimiters *)
+
+type vernac_when =
+ | VtNow
+ | VtLater
+type vernac_classification = vernac_type * vernac_when
+
(** Interpretation of extended vernac phrases. *)
-type 'a vernac_command = 'a -> atts:Vernacexpr.vernac_flags -> st:Vernacstate.t -> Vernacstate.t
+type 'a vernac_command = 'a -> atts:Attributes.vernac_flags -> st:Vernacstate.t -> Vernacstate.t
type plugin_args = Genarg.raw_generic_argument list
-val call : Vernacexpr.extend_name -> plugin_args -> atts:Vernacexpr.vernac_flags -> st:Vernacstate.t -> Vernacstate.t
+val call : Vernacexpr.extend_name -> plugin_args -> atts:Attributes.vernac_flags -> st:Vernacstate.t -> Vernacstate.t
(** {5 VERNAC EXTEND} *)
-type classifier = Genarg.raw_generic_argument list -> Vernacexpr.vernac_classification
+type classifier = Genarg.raw_generic_argument list -> vernac_classification
type (_, _) ty_sig =
-| TyNil : (atts:Vernacexpr.vernac_flags -> st:Vernacstate.t -> Vernacstate.t, Vernacexpr.vernac_classification) ty_sig
+| TyNil : (atts:Attributes.vernac_flags -> st:Vernacstate.t -> Vernacstate.t, vernac_classification) ty_sig
| TyTerminal : string * ('r, 's) ty_sig -> ('r, 's) ty_sig
| TyNonTerminal :
('a, 'b, 'c) Extend.ty_user_symbol * ('r, 's) ty_sig ->
@@ -32,7 +87,7 @@ type ty_ml = TyML : bool (** deprecated *) * ('r, 's) ty_sig * 'r * 's option ->
(** Wrapper to dynamically extend vernacular commands. *)
val vernac_extend :
command:string ->
- ?classifier:(string -> Vernacexpr.vernac_classification) ->
+ ?classifier:(string -> vernac_classification) ->
?entry:Vernacexpr.vernac_expr Pcoq.Entry.t ->
ty_ml list -> unit
@@ -55,6 +110,9 @@ val vernac_argument_extend : name:string -> 'a vernac_argument ->
('a, unit, unit) Genarg.genarg_type * 'a Pcoq.Entry.t
(** {5 STM classifiers} *)
+val get_vernac_classifier : Vernacexpr.extend_name -> classifier
-val get_vernac_classifier :
- Vernacexpr.extend_name -> classifier
+(** Standard constant classifiers *)
+val classify_as_query : vernac_classification
+val classify_as_sideeff : vernac_classification
+val classify_as_proofstep : vernac_classification