aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.build2
-rw-r--r--dev/ci/user-overlays/07819-mattam-ho-matching-occ-sel.sh13
-rw-r--r--dev/ci/user-overlays/08764-validsdp-master-parsing-decimal.sh18
-rw-r--r--dev/ci/user-overlays/08817-sprop.sh34
-rw-r--r--dev/ci/user-overlays/08829-proj-syntax-check.sh5
-rw-r--r--dev/ci/user-overlays/08893-herbelin-master+moving-evars-of-term-on-econstr.sh7
-rw-r--r--dev/ci/user-overlays/08984-vbgl-rm-hardwired-hint-db.sh12
-rw-r--r--dev/ci/user-overlays/08988-herbelin-master+mini-uniformizaton-parsing-printing-univ-level-sort.sh6
-rw-r--r--dev/ci/user-overlays/09129-ejgallego-proof+no_global_partial.sh30
-rw-r--r--dev/ci/user-overlays/09165-ejgallego-recarg-cleanup.sh9
-rw-r--r--dev/ci/user-overlays/09173-ejgallego-proofview+proof_info.sh9
-rw-r--r--dev/ci/user-overlays/09389-SkySkimmer-set-implicits.sh9
-rw-r--r--dev/ci/user-overlays/09439-sep-variance.sh14
-rw-r--r--dev/ci/user-overlays/09476-ppedrot-context-constructor.sh9
-rw-r--r--dev/ci/user-overlays/09567-ejgallego-hooks_unify.sh12
-rw-r--r--dev/ci/user-overlays/09602-gares-more-delta-in-termination-checking.sh6
-rw-r--r--dev/ci/user-overlays/09678-printed-by-env.sh14
-rw-r--r--dev/ci/user-overlays/09733-gares-quotations.sh6
-rw-r--r--dev/ci/user-overlays/09815-token-type.sh4
-rw-r--r--dev/ci/user-overlays/09870-vbgl-recordops.sh6
-rw-r--r--dev/ci/user-overlays/09895-ejgallego-require+upper.sh6
-rw-r--r--dev/ci/user-overlays/09909-maximedenes-pretyping-rm-global.sh21
-rw-r--r--dev/ci/user-overlays/09973-gares-elpi-2.1.sh6
-rw-r--r--dev/ci/user-overlays/10052-ppedrot-cleanup-logic-convert-hyp.sh6
-rw-r--r--dev/ci/user-overlays/10069-ppedrot-whd-for-evar-conv-no-stack.sh6
-rw-r--r--dev/ci/user-overlays/10076-vbgl-canonical-disable-hint.sh6
-rw-r--r--dev/ci/user-overlays/10125-SkySkimmer-run_tactic_gen.sh6
-rw-r--r--dev/ci/user-overlays/10133-SkySkimmer-kelim.sh6
-rw-r--r--dev/ci/user-overlays/10135-maximedenes-detype-anonymous.sh6
-rw-r--r--dev/ci/user-overlays/10157-SkySkimmer-def-not-visible-generic-warning.sh6
-rw-r--r--dev/ci/user-overlays/10177-SkySkimmer-generalize.sh6
-rw-r--r--dev/ci/user-overlays/10201-ppedrot-opaque-future-cleanup.sh15
-rw-r--r--dev/ci/user-overlays/10215-gares-less-ontop.sh15
-rw-r--r--dev/ci/user-overlays/README.md10
-rw-r--r--doc/changelog/04-tactics/10205-discriminate-HoTT.rst6
-rw-r--r--doc/plugin_tutorial/README.md38
-rw-r--r--doc/plugin_tutorial/tuto0/src/g_tuto0.mlg56
-rw-r--r--doc/plugin_tutorial/tuto0/theories/Demo.v20
-rw-r--r--doc/plugin_tutorial/tuto1/_CoqProject3
-rw-r--r--doc/plugin_tutorial/tuto1/src/g_tuto1.mlg345
-rw-r--r--doc/plugin_tutorial/tuto1/src/inspector.ml8
-rw-r--r--doc/plugin_tutorial/tuto1/src/inspector.mli4
-rw-r--r--doc/plugin_tutorial/tuto1/src/simple_check.ml38
-rw-r--r--doc/plugin_tutorial/tuto1/src/simple_check.mli7
-rw-r--r--doc/plugin_tutorial/tuto1/src/simple_declare.ml6
-rw-r--r--doc/plugin_tutorial/tuto1/src/simple_declare.mli5
-rw-r--r--doc/plugin_tutorial/tuto1/src/simple_print.ml2
-rw-r--r--doc/plugin_tutorial/tuto1/src/simple_print.mli2
-rw-r--r--doc/plugin_tutorial/tuto1/src/tuto1_plugin.mlpack1
-rw-r--r--doc/plugin_tutorial/tuto1/theories/Demo.v95
-rw-r--r--kernel/dune11
-rw-r--r--kernel/uint63_amd64_63.ml (renamed from kernel/uint63_amd64.ml)0
-rw-r--r--kernel/uint63_i386_31.ml (renamed from kernel/uint63_x86.ml)0
-rw-r--r--kernel/write_uint63.ml4
-rw-r--r--plugins/ltac/rewrite.ml6
-rw-r--r--plugins/ssr/ssrequality.ml4
-rw-r--r--tactics/elimschemes.ml12
-rw-r--r--tactics/elimschemes.mli1
-rw-r--r--tactics/equality.ml55
-rw-r--r--test-suite/success/Discriminate_HoTT.v89
-rw-r--r--vernac/vernacentries.ml6
61 files changed, 615 insertions, 555 deletions
diff --git a/Makefile.build b/Makefile.build
index 147668187f..c76c14f2de 100644
--- a/Makefile.build
+++ b/Makefile.build
@@ -365,7 +365,7 @@ $(COQPP): $(COQPPCMO) coqpp/coqpp_main.ml
###########################################################################
# Specific rules for Uint63
###########################################################################
-kernel/uint63.ml: kernel/write_uint63.ml kernel/uint63_x86.ml kernel/uint63_amd64.ml
+kernel/uint63.ml: kernel/write_uint63.ml kernel/uint63_i386_31.ml kernel/uint63_amd64_63.ml
$(SHOW)'WRITE $@'
$(HIDE)(cd kernel && ocaml unix.cma $(shell basename $<))
diff --git a/dev/ci/user-overlays/07819-mattam-ho-matching-occ-sel.sh b/dev/ci/user-overlays/07819-mattam-ho-matching-occ-sel.sh
deleted file mode 100644
index 2b4c1489ad..0000000000
--- a/dev/ci/user-overlays/07819-mattam-ho-matching-occ-sel.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-_OVERLAY_BRANCH=ho-matching-occ-sel
-
-if [ "$CI_PULL_REQUEST" = "7819" ] || [ "$CI_BRANCH" = "$_OVERLAY_BRANCH" ]; then
-
- unicoq_CI_REF="PR7819-overlay"
-
- mtac2_CI_REF="PR7819-overlay"
- mtac2_CI_GITURL=https://github.com/mattam82/Mtac2
-
- equations_CI_GITURL=https://github.com/mattam82/Coq-Equations
- equations_CI_REF="PR7819-overlay"
-
-fi
diff --git a/dev/ci/user-overlays/08764-validsdp-master-parsing-decimal.sh b/dev/ci/user-overlays/08764-validsdp-master-parsing-decimal.sh
deleted file mode 100644
index 67f6f8610a..0000000000
--- a/dev/ci/user-overlays/08764-validsdp-master-parsing-decimal.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-if [ "$CI_PULL_REQUEST" = "8764" ] || [ "$CI_BRANCH" = "master-parsing-decimal" ]; then
-
- ltac2_CI_REF=master-parsing-decimal
- ltac2_CI_GITURL=https://github.com/proux01/ltac2
-
- quickchick_CI_REF=master-parsing-decimal
- quickchick_CI_GITURL=https://github.com/proux01/QuickChick
-
- Corn_CI_REF=master-parsing-decimal
- Corn_CI_GITURL=https://github.com/proux01/corn
-
- HoTT_CI_REF=master-parsing-decimal
- HoTT_CI_GITURL=https://github.com/proux01/HoTT
-
- stdlib2_CI_REF=master-parsing-decimal
- stdlib2_CI_GITURL=https://github.com/proux01/stdlib2
-
-fi
diff --git a/dev/ci/user-overlays/08817-sprop.sh b/dev/ci/user-overlays/08817-sprop.sh
deleted file mode 100644
index 81e18226ed..0000000000
--- a/dev/ci/user-overlays/08817-sprop.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-if [ "$CI_PULL_REQUEST" = "8817" ] || [ "$CI_BRANCH" = "sprop" ]; then
- aac_tactics_CI_REF=sprop
- aac_tactics_CI_GITURL=https://github.com/SkySkimmer/aac-tactics
-
- coq_dpdgraph_CI_REF=sprop
- coq_dpdgraph_CI_GITURL=https://github.com/SkySkimmer/coq-dpdgraph
-
- coqhammer_CI_REF=sprop
- coqhammer_CI_GITURL=https://github.com/SkySkimmer/coqhammer
-
- elpi_CI_REF=sprop
- elpi_CI_GITURL=https://github.com/SkySkimmer/coq-elpi
-
- equations_CI_REF=sprop
- equations_CI_GITURL=https://github.com/SkySkimmer/Coq-Equations
-
- ltac2_CI_REF=sprop
- ltac2_CI_GITURL=https://github.com/SkySkimmer/ltac2
-
- unicoq_CI_REF=sprop
- unicoq_CI_GITURL=https://github.com/SkySkimmer/unicoq
-
- mtac2_CI_REF=sprop
- mtac2_CI_GITURL=https://github.com/SkySkimmer/mtac2
-
- paramcoq_CI_REF=sprop
- paramcoq_CI_GITURL=https://github.com/SkySkimmer/paramcoq
-
- quickchick_CI_REF=sprop
- quickchick_CI_GITURL=https://github.com/SkySkimmer/QuickChick
-
- relation_algebra_CI_REF=sprop
- relation_algebra_CI_GITURL=https://github.com/SkySkimmer/relation-algebra
-fi
diff --git a/dev/ci/user-overlays/08829-proj-syntax-check.sh b/dev/ci/user-overlays/08829-proj-syntax-check.sh
deleted file mode 100644
index c04621114f..0000000000
--- a/dev/ci/user-overlays/08829-proj-syntax-check.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-if [ "$CI_PULL_REQUEST" = "8829" ] || [ "$CI_BRANCH" = "proj-syntax-check" ]; then
- lambdaRust_CI_REF=proj-syntax-check
- lambdaRust_CI_GITURL=https://github.com/SkySkimmer/lambda-rust
- lambdaRust_CI_ARCHIVEURL=$lambdaRust_CI_GITURL/archive
-fi
diff --git a/dev/ci/user-overlays/08893-herbelin-master+moving-evars-of-term-on-econstr.sh b/dev/ci/user-overlays/08893-herbelin-master+moving-evars-of-term-on-econstr.sh
deleted file mode 100644
index dc39ea5ef0..0000000000
--- a/dev/ci/user-overlays/08893-herbelin-master+moving-evars-of-term-on-econstr.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-if [ "$CI_PULL_REQUEST" = "8893" ] || [ "$CI_BRANCH" = "master+moving-evars-of-term-on-econstr" ]; then
-
- equations_CI_BRANCH=master+fix-evars_of_term-pr8893
- equations_CI_REF=master+fix-evars_of_term-pr8893
- equations_CI_GITURL=https://github.com/herbelin/Coq-Equations
-
-fi
diff --git a/dev/ci/user-overlays/08984-vbgl-rm-hardwired-hint-db.sh b/dev/ci/user-overlays/08984-vbgl-rm-hardwired-hint-db.sh
deleted file mode 100644
index 12be1b676a..0000000000
--- a/dev/ci/user-overlays/08984-vbgl-rm-hardwired-hint-db.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-if [ "$CI_PULL_REQUEST" = "8984" ] || [ "$CI_BRANCH" = "rm-hardwired-hint-db" ]; then
-
- HoTT_CI_REF=rm-hardwired-hint-db
- HoTT_CI_GITURL=https://github.com/vbgl/HoTT
-
- ltac2_CI_REF=rm-hardwired-hint-db
- ltac2_CI_GITURL=https://github.com/vbgl/ltac2
-
- UniMath_CI_REF=rm-hardwired-hint-db
- UniMath_CI_GITURL=https://github.com/vbgl/UniMath
-
-fi
diff --git a/dev/ci/user-overlays/08988-herbelin-master+mini-uniformizaton-parsing-printing-univ-level-sort.sh b/dev/ci/user-overlays/08988-herbelin-master+mini-uniformizaton-parsing-printing-univ-level-sort.sh
deleted file mode 100644
index ae72405e6e..0000000000
--- a/dev/ci/user-overlays/08988-herbelin-master+mini-uniformizaton-parsing-printing-univ-level-sort.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-if [ "$CI_PULL_REQUEST" = "8988" ] || [ "$CI_BRANCH" = "master+mini-uniformizaton-parsing-printing-univ-level-sort" ]; then
-
- elpi_CI_REF=coq-master+adapt-coq8988-type-internal-syntax
- elpi_CI_GITURL=https://github.com/herbelin/coq-elpi
-
-fi
diff --git a/dev/ci/user-overlays/09129-ejgallego-proof+no_global_partial.sh b/dev/ci/user-overlays/09129-ejgallego-proof+no_global_partial.sh
deleted file mode 100644
index c09d1b8929..0000000000
--- a/dev/ci/user-overlays/09129-ejgallego-proof+no_global_partial.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-if [ "$CI_PULL_REQUEST" = "9129" ] || [ "$CI_BRANCH" = "proof+no_global_partial" ]; then
-
- aac_tactics_CI_REF=proof+no_global_partial
- aac_tactics_CI_GITURL=https://github.com/ejgallego/aac-tactics
-
- # coqhammer_CI_REF=proof+no_global_partial
- # coqhammer_CI_GITURL=https://github.com/ejgallego/coqhammer
-
- elpi_CI_REF=proof+no_global_partial
- elpi_CI_GITURL=https://github.com/ejgallego/coq-elpi
-
- equations_CI_REF=proof+no_global_partial
- equations_CI_GITURL=https://github.com/ejgallego/Coq-Equations
-
- ltac2_CI_REF=proof+no_global_partial
- ltac2_CI_GITURL=https://github.com/ejgallego/ltac2
-
- # unicoq_CI_REF=proof+no_global_partial
- # unicoq_CI_GITURL=https://github.com/ejgallego/unicoq
-
- mtac2_CI_REF=proof+no_global_partial
- mtac2_CI_GITURL=https://github.com/ejgallego/Mtac2
-
- paramcoq_CI_REF=proof+no_global_partial
- paramcoq_CI_GITURL=https://github.com/ejgallego/paramcoq
-
- quickchick_CI_REF=proof+no_global_partial
- quickchick_CI_GITURL=https://github.com/ejgallego/QuickChick
-
-fi
diff --git a/dev/ci/user-overlays/09165-ejgallego-recarg-cleanup.sh b/dev/ci/user-overlays/09165-ejgallego-recarg-cleanup.sh
deleted file mode 100644
index 1e1d36d54a..0000000000
--- a/dev/ci/user-overlays/09165-ejgallego-recarg-cleanup.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-if [ "$CI_PULL_REQUEST" = "9165" ] || [ "$CI_BRANCH" = "recarg-cleanup" ]; then
-
- elpi_CI_REF=recarg-cleanup
- elpi_CI_GITURL=https://github.com/ejgallego/coq-elpi
-
- quickchick_CI_REF=recarg-cleanup
- quickchick_CI_GITURL=https://github.com/ejgallego/QuickChick
-
-fi
diff --git a/dev/ci/user-overlays/09173-ejgallego-proofview+proof_info.sh b/dev/ci/user-overlays/09173-ejgallego-proofview+proof_info.sh
deleted file mode 100644
index 23eb24c304..0000000000
--- a/dev/ci/user-overlays/09173-ejgallego-proofview+proof_info.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-if [ "$CI_PULL_REQUEST" = "9173" ] || [ "$CI_BRANCH" = "proofview+proof_info" ]; then
-
- ltac2_CI_REF=proofview+proof_info
- ltac2_CI_GITURL=https://github.com/ejgallego/ltac2
-
- fiat_parsers_CI_REF=proofview+proof_info
- fiat_parsers_CI_GITURL=https://github.com/ejgallego/fiat
-
-fi
diff --git a/dev/ci/user-overlays/09389-SkySkimmer-set-implicits.sh b/dev/ci/user-overlays/09389-SkySkimmer-set-implicits.sh
deleted file mode 100644
index 1110157069..0000000000
--- a/dev/ci/user-overlays/09389-SkySkimmer-set-implicits.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-if [ "$CI_PULL_REQUEST" = "9389" ] || [ "$CI_BRANCH" = "set-implicits" ]; then
-
- equations_CI_REF=set-implicits
- equations_CI_GITURL=https://github.com/SkySkimmer/Coq-Equations
-
- mtac2_CI_REF=set-implicits
- mtac2_CI_GITURL=https://github.com/SkySkimmer/Mtac2
-
-fi
diff --git a/dev/ci/user-overlays/09439-sep-variance.sh b/dev/ci/user-overlays/09439-sep-variance.sh
deleted file mode 100644
index cca85a2f68..0000000000
--- a/dev/ci/user-overlays/09439-sep-variance.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-
-if [ "$CI_PULL_REQUEST" = "9439" ] || [ "$CI_BRANCH" = "sep-variance" ]; then
- elpi_CI_REF=sep-variance
- elpi_CI_GITURL=https://github.com/SkySkimmer/coq-elpi
-
- equations_CI_REF=sep-variance
- equations_CI_GITURL=https://github.com/SkySkimmer/Coq-Equations
-
- mtac2_CI_REF=sep-variance
- mtac2_CI_GITURL=https://github.com/SkySkimmer/mtac2
-
- paramcoq_CI_REF=sep-variance
- paramcoq_CI_GITURL=https://github.com/SkySkimmer/paramcoq
-fi
diff --git a/dev/ci/user-overlays/09476-ppedrot-context-constructor.sh b/dev/ci/user-overlays/09476-ppedrot-context-constructor.sh
deleted file mode 100644
index 1af8b5430d..0000000000
--- a/dev/ci/user-overlays/09476-ppedrot-context-constructor.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-if [ "$CI_PULL_REQUEST" = "9476" ] || [ "$CI_BRANCH" = "context-constructor" ]; then
-
- quickchick_CI_REF=context-constructor
- quickchick_CI_GITURL=https://github.com/ppedrot/QuickChick
-
- equations_CI_REF=context-constructor
- equations_CI_GITURL=https://github.com/ppedrot/Coq-Equations
-
-fi
diff --git a/dev/ci/user-overlays/09567-ejgallego-hooks_unify.sh b/dev/ci/user-overlays/09567-ejgallego-hooks_unify.sh
deleted file mode 100644
index 27ce9aca16..0000000000
--- a/dev/ci/user-overlays/09567-ejgallego-hooks_unify.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-if [ "$CI_PULL_REQUEST" = "9567" ] || [ "$CI_BRANCH" = "hooks_unify" ]; then
-
- equations_CI_REF=hooks_unify
- equations_CI_GITURL=https://github.com/ejgallego/Coq-Equations
-
- mtac2_CI_REF=hooks_unify
- mtac2_CI_GITURL=https://github.com/ejgallego/Mtac2
-
- paramcoq_CI_REF=hooks_unify
- paramcoq_CI_GITURL=https://github.com/ejgallego/paramcoq
-
-fi
diff --git a/dev/ci/user-overlays/09602-gares-more-delta-in-termination-checking.sh b/dev/ci/user-overlays/09602-gares-more-delta-in-termination-checking.sh
deleted file mode 100644
index 18a295cdbb..0000000000
--- a/dev/ci/user-overlays/09602-gares-more-delta-in-termination-checking.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-if [ "$CI_PULL_REQUEST" = "9602" ] || [ "$CI_BRANCH" = "more-delta-in-termination-checking" ]; then
-
- equations_CI_REF=more-delta-in-termination-checking
- equations_CI_GITURL=https://github.com/gares/Coq-Equations
-
-fi
diff --git a/dev/ci/user-overlays/09678-printed-by-env.sh b/dev/ci/user-overlays/09678-printed-by-env.sh
deleted file mode 100644
index ccb3498764..0000000000
--- a/dev/ci/user-overlays/09678-printed-by-env.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-
-if [ "$CI_PULL_REQUEST" = "9678" ] || [ "$CI_BRANCH" = "printed-by-env" ]; then
- elpi_CI_REF=printed-by-env
- elpi_CI_GITURL=https://github.com/maximedenes/coq-elpi
-
- equations_CI_REF=printed-by-env
- equations_CI_GITURL=https://github.com/maximedenes/Coq-Equations
-
- ltac2_CI_REF=printed-by-env
- ltac2_CI_GITURL=https://github.com/maximedenes/ltac2
-
- quickchick_CI_REF=printed-by-env
- quickchick_CI_GITURL=https://github.com/maximedenes/QuickChick
-fi
diff --git a/dev/ci/user-overlays/09733-gares-quotations.sh b/dev/ci/user-overlays/09733-gares-quotations.sh
deleted file mode 100644
index b17454fc4c..0000000000
--- a/dev/ci/user-overlays/09733-gares-quotations.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-if [ "$CI_PULL_REQUEST" = "9733" ] || [ "$CI_BRANCH" = "quotations" ]; then
-
- ltac2_CI_REF=quotations
- ltac2_CI_GITURL=https://github.com/gares/ltac2
-
-fi
diff --git a/dev/ci/user-overlays/09815-token-type.sh b/dev/ci/user-overlays/09815-token-type.sh
deleted file mode 100644
index 4b49011de3..0000000000
--- a/dev/ci/user-overlays/09815-token-type.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-if [ "$CI_PULL_REQUEST" = "9815" ] || [ "$CI_BRANCH" = "token-type" ]; then
- ltac2_CI_REF=token-type
- ltac2_CI_GITURL=https://github.com/proux01/ltac2
-fi
diff --git a/dev/ci/user-overlays/09870-vbgl-recordops.sh b/dev/ci/user-overlays/09870-vbgl-recordops.sh
deleted file mode 100644
index bb14a8c204..0000000000
--- a/dev/ci/user-overlays/09870-vbgl-recordops.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-if [ "$CI_PULL_REQUEST" = "9870" ] || [ "$CI_BRANCH" = "doc-canonical" ]; then
-
- elpi_CI_REF=pr-9870
- elpi_CI_GITURL=https://github.com/vbgl/coq-elpi
-
-fi
diff --git a/dev/ci/user-overlays/09895-ejgallego-require+upper.sh b/dev/ci/user-overlays/09895-ejgallego-require+upper.sh
deleted file mode 100644
index 9a42c829ce..0000000000
--- a/dev/ci/user-overlays/09895-ejgallego-require+upper.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-if [ "$CI_PULL_REQUEST" = "9895" ] || [ "$CI_BRANCH" = "require+upper" ]; then
-
- quickchick_CI_REF=require+upper
- quickchick_CI_GITURL=https://github.com/ejgallego/QuickChick
-
-fi
diff --git a/dev/ci/user-overlays/09909-maximedenes-pretyping-rm-global.sh b/dev/ci/user-overlays/09909-maximedenes-pretyping-rm-global.sh
deleted file mode 100644
index 01d3068591..0000000000
--- a/dev/ci/user-overlays/09909-maximedenes-pretyping-rm-global.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-if [ "$CI_PULL_REQUEST" = "9909" ] || [ "$CI_BRANCH" = "pretyping-rm-global" ]; then
-
- elpi_CI_REF=pretyping-rm-global
- elpi_CI_GITURL=https://github.com/maximedenes/coq-elpi
-
- coqhammer_CI_REF=pretyping-rm-global
- coqhammer_CI_GITURL=https://github.com/maximedenes/coqhammer
-
- equations_CI_REF=pretyping-rm-global
- equations_CI_GITURL=https://github.com/maximedenes/Coq-Equations
-
- ltac2_CI_REF=pretyping-rm-global
- ltac2_CI_GITURL=https://github.com/maximedenes/ltac2
-
- paramcoq_CI_REF=pretyping-rm-global
- paramcoq_CI_GITURL=https://github.com/maximedenes/paramcoq
-
- mtac2_CI_REF=pretyping-rm-global
- mtac2_CI_GITURL=https://github.com/maximedenes/Mtac2
-
-fi
diff --git a/dev/ci/user-overlays/09973-gares-elpi-2.1.sh b/dev/ci/user-overlays/09973-gares-elpi-2.1.sh
deleted file mode 100644
index 9a6e25d893..0000000000
--- a/dev/ci/user-overlays/09973-gares-elpi-2.1.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-if [ "$CI_PULL_REQUEST" = "9973" ] || [ "$CI_BRANCH" = "elpi-1.2" ]; then
-
- elpi_CI_REF=overlay-elpi1.2-coq-master
- elpi_CI_GITURL=https://github.com/LPCIC/coq-elpi
-
-fi
diff --git a/dev/ci/user-overlays/10052-ppedrot-cleanup-logic-convert-hyp.sh b/dev/ci/user-overlays/10052-ppedrot-cleanup-logic-convert-hyp.sh
deleted file mode 100644
index 9f9cc19e83..0000000000
--- a/dev/ci/user-overlays/10052-ppedrot-cleanup-logic-convert-hyp.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-if [ "$CI_PULL_REQUEST" = "10052" ] || [ "$CI_BRANCH" = "cleanup-logic-convert-hyp" ]; then
-
- relation_algebra_CI_REF=cleanup-logic-convert-hyp
- relation_algebra_CI_GITURL=https://github.com/ppedrot/relation-algebra
-
-fi
diff --git a/dev/ci/user-overlays/10069-ppedrot-whd-for-evar-conv-no-stack.sh b/dev/ci/user-overlays/10069-ppedrot-whd-for-evar-conv-no-stack.sh
deleted file mode 100644
index 0e1449f36c..0000000000
--- a/dev/ci/user-overlays/10069-ppedrot-whd-for-evar-conv-no-stack.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-if [ "$CI_PULL_REQUEST" = "10069" ] || [ "$CI_BRANCH" = "whd-for-evar-conv-no-stack" ]; then
-
- unicoq_CI_REF=whd-for-evar-conv-no-stack
- unicoq_CI_GITURL=https://github.com/ppedrot/unicoq
-
-fi
diff --git a/dev/ci/user-overlays/10076-vbgl-canonical-disable-hint.sh b/dev/ci/user-overlays/10076-vbgl-canonical-disable-hint.sh
deleted file mode 100644
index 2015935dd9..0000000000
--- a/dev/ci/user-overlays/10076-vbgl-canonical-disable-hint.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-if [ "$CI_PULL_REQUEST" = "10076" ] || [ "$CI_BRANCH" = "canonical-disable-hint" ]; then
-
- elpi_CI_REF=canonical-disable-hint
- elpi_CI_GITURL=https://github.com/vbgl/coq-elpi
-
-fi
diff --git a/dev/ci/user-overlays/10125-SkySkimmer-run_tactic_gen.sh b/dev/ci/user-overlays/10125-SkySkimmer-run_tactic_gen.sh
deleted file mode 100644
index 4032b1c6b5..0000000000
--- a/dev/ci/user-overlays/10125-SkySkimmer-run_tactic_gen.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-if [ "$CI_PULL_REQUEST" = "10125" ] || [ "$CI_BRANCH" = "run_tactic_gen" ]; then
-
- paramcoq_CI_REF=run_tactic_gen
- paramcoq_CI_GITURL=https://github.com/SkySkimmer/paramcoq
-
-fi
diff --git a/dev/ci/user-overlays/10133-SkySkimmer-kelim.sh b/dev/ci/user-overlays/10133-SkySkimmer-kelim.sh
deleted file mode 100644
index 3658e96a3a..0000000000
--- a/dev/ci/user-overlays/10133-SkySkimmer-kelim.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-if [ "$CI_PULL_REQUEST" = "10133" ] || [ "$CI_BRANCH" = "kelim" ]; then
-
- equations_CI_REF=kelim
- equations_CI_GITURL=https://github.com/SkySkimmer/Coq-Equations
-
-fi
diff --git a/dev/ci/user-overlays/10135-maximedenes-detype-anonymous.sh b/dev/ci/user-overlays/10135-maximedenes-detype-anonymous.sh
deleted file mode 100644
index bc8aa33565..0000000000
--- a/dev/ci/user-overlays/10135-maximedenes-detype-anonymous.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-if [ "$CI_PULL_REQUEST" = "10135" ] || [ "$CI_BRANCH" = "detype-anonymous" ]; then
-
- unicoq_CI_REF=detype-anonymous
- unicoq_CI_GITURL=https://github.com/maximedenes/unicoq
-
-fi
diff --git a/dev/ci/user-overlays/10157-SkySkimmer-def-not-visible-generic-warning.sh b/dev/ci/user-overlays/10157-SkySkimmer-def-not-visible-generic-warning.sh
deleted file mode 100644
index fcbeb32a58..0000000000
--- a/dev/ci/user-overlays/10157-SkySkimmer-def-not-visible-generic-warning.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-if [ "$CI_PULL_REQUEST" = "10188" ] || [ "$CI_BRANCH" = "def-not-visible-remove-warning" ]; then
-
- elpi_CI_REF=def-not-visible-generic-warning
- elpi_CI_GITURL=https://github.com/SkySkimmer/coq-elpi
-
-fi
diff --git a/dev/ci/user-overlays/10177-SkySkimmer-generalize.sh b/dev/ci/user-overlays/10177-SkySkimmer-generalize.sh
deleted file mode 100644
index a89f6aca1b..0000000000
--- a/dev/ci/user-overlays/10177-SkySkimmer-generalize.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-if [ "$CI_PULL_REQUEST" = "10177" ] || [ "$CI_BRANCH" = "generalize" ]; then
-
- quickchick_CI_REF=generalize
- quickchick_CI_GITURL=https://github.com/SkySkimmer/QuickChick
-
-fi
diff --git a/dev/ci/user-overlays/10201-ppedrot-opaque-future-cleanup.sh b/dev/ci/user-overlays/10201-ppedrot-opaque-future-cleanup.sh
deleted file mode 100644
index e3bbb84bcb..0000000000
--- a/dev/ci/user-overlays/10201-ppedrot-opaque-future-cleanup.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-if [ "$CI_PULL_REQUEST" = "10201" ] || [ "$CI_BRANCH" = "opaque-future-cleanup" ]; then
-
- coq_dpdgraph_CI_REF=opaque-future-cleanup
- coq_dpdgraph_CI_GITURL=https://github.com/ppedrot/coq-dpdgraph
-
- coqhammer_CI_REF=opaque-future-cleanup
- coqhammer_CI_GITURL=https://github.com/ppedrot/coqhammer
-
- elpi_CI_REF=opaque-future-cleanup
- elpi_CI_GITURL=https://github.com/ppedrot/coq-elpi
-
- paramcoq_CI_REF=opaque-future-cleanup
- paramcoq_CI_GITURL=https://github.com/ppedrot/paramcoq
-
-fi
diff --git a/dev/ci/user-overlays/10215-gares-less-ontop.sh b/dev/ci/user-overlays/10215-gares-less-ontop.sh
deleted file mode 100644
index bceb5ad0e8..0000000000
--- a/dev/ci/user-overlays/10215-gares-less-ontop.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-if [ "$CI_PULL_REQUEST" = "10215" ] || [ "$CI_BRANCH" = "custom-typing" ]; then
-
- equations_CI_REF=pass-less-ontop
- equations_CI_GITURL=https://github.com/gares/Coq-Equations
-
- mtac2_CI_REF=pass-less-ontop
- mtac2_CI_GITURL=https://github.com/SkySkimmer/Mtac2
-
- paramcoq_CI_REF=pass-less-ontop
- paramcoq_CI_GITURL=https://github.com/gares/paramcoq
-
- quickchick_CI_REF=pass-less-ontop
- quickchick_CI_GITURL=https://github.com/gares/QuickChick
-
-fi
diff --git a/dev/ci/user-overlays/README.md b/dev/ci/user-overlays/README.md
index 7fb73e447d..4c2f264a74 100644
--- a/dev/ci/user-overlays/README.md
+++ b/dev/ci/user-overlays/README.md
@@ -21,14 +21,14 @@ The name of your overlay file should start with a five-digit pull request
number, followed by a dash, anything (for instance your GitHub nickname
and the branch name), then a `.sh` extension (`[0-9]{5}-[a-zA-Z0-9-_]+.sh`).
-Example: `00669-maximedenes-ssr-merge.sh` containing
+Example: `10185-SkySkimmer-instance-no-bang.sh` containing
```
-#!/bin/sh
+if [ "$CI_PULL_REQUEST" = "10185" ] || [ "$CI_BRANCH" = "instance-no-bang" ]; then
+
+ quickchick_CI_REF=instance-no-bang
+ quickchick_CI_GITURL=https://github.com/SkySkimmer/QuickChick
-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/doc/changelog/04-tactics/10205-discriminate-HoTT.rst b/doc/changelog/04-tactics/10205-discriminate-HoTT.rst
new file mode 100644
index 0000000000..bb2d2a092e
--- /dev/null
+++ b/doc/changelog/04-tactics/10205-discriminate-HoTT.rst
@@ -0,0 +1,6 @@
+- Make the :tacn:`discriminate` tactic work together with
+ :flag:`Universe Polymorphism` and equality in :g:`Type`. This,
+ in particular, makes :tacn:`discriminate` compatible with the HoTT
+ library https://github.com/HoTT/HoTT.
+ (`#10205 <https://github.com/coq/coq/pull/10205>`_,
+ by Andreas Lynge, review by Pierre-Marie Pédrot and Matthieu Sozeau)
diff --git a/doc/plugin_tutorial/README.md b/doc/plugin_tutorial/README.md
index f82edb2352..6d142a9af8 100644
--- a/doc/plugin_tutorial/README.md
+++ b/doc/plugin_tutorial/README.md
@@ -1,34 +1,20 @@
How to write plugins in Coq
===========================
- # Working environment : merlin, tuareg (open question)
+ # Working environment
+
+ In addition to installing OCaml and Coq, it can help to install several tools for development.
- ## OCaml & related tools
+ ## Merlin
These instructions use [OPAM](http://opam.ocaml.org/doc/Install.html)
```shell
-opam init --root=$PWD/CIW2018 --compiler=4.06.0 -j2
-eval `opam config env --root=$PWD/CIW2018`
-opam install camlp5 ocamlfind num # Coq's dependencies
-opam install lablgtk # Coqide's dependencies (optional)
opam install merlin # prints instructions for vim and emacs
```
- ## Coq
-
-```shell
-git clone git@github.com:coq/coq.git
-cd coq
-./configure -profile devel
-make -j2
-cd ..
-export PATH=$PWD/coq/bin:$PATH
-```
-
## This tutorial
```shell
-git clone git@github.com:ybertot/plugin_tutorials.git
cd plugin_tutorials/tuto0
make .merlin # run before opening .ml files in your editor
make # build
@@ -40,6 +26,8 @@ make # build
package a ml4 file in a plugin, organize a `Makefile`, `_CoqProject`
- Example of syntax to add a new toplevel command
- Example of function call to print a simple message
+ - Example of function call to print a simple warning
+ - Example of function call to raise a simple error to the user
- Example of syntax to add a simple tactic
(that does nothing and prints a message)
- To use it:
@@ -54,19 +42,23 @@ make # build
Require Import Tuto0.Loader. HelloWorld.
```
- # tuto1 : Ocaml to Coq communication
+ You can also modify and run `theories/Demo.v`.
+
+ # tuto1 : OCaml to Coq communication
Explore the memory of Coq, modify it
- - Commands that take arguments: strings, symbols, expressions of the calculus of constructions
+ - Commands that take arguments: strings, integers, symbols, expressions of the calculus of constructions
+ - Examples of using environments correctly
+ - Examples of using state (the evar_map) correctly
- Commands that interact with type-checking in Coq
+ - A command that checks convertibility between two terms
- A command that adds a new definition or theorem
- - A command that uses a name and exploits the existing definitions
- or theorems
+ - A command that uses a name and exploits the existing definitions or theorems
- A command that exploits an existing ongoing proof
- A command that defines a new tactic
Compilation and loading must be performed as for `tuto0`.
- # tuto2 : Ocaml to Coq communication
+ # tuto2 : OCaml to Coq communication
A more step by step introduction to writing commands
- Explanation of the syntax of entries
- Adding a new type to and parsing to the available choices
diff --git a/doc/plugin_tutorial/tuto0/src/g_tuto0.mlg b/doc/plugin_tutorial/tuto0/src/g_tuto0.mlg
index 5c633fe862..97689adfed 100644
--- a/doc/plugin_tutorial/tuto0/src/g_tuto0.mlg
+++ b/doc/plugin_tutorial/tuto0/src/g_tuto0.mlg
@@ -5,14 +5,70 @@ DECLARE PLUGIN "tuto0_plugin"
open Pp
open Ltac_plugin
+let tuto_warn = CWarnings.create ~name:"name" ~category:"category"
+ (fun _ -> strbrk Tuto0_main.message)
+
}
+(*** Printing messages ***)
+
+(*
+ * This defines a command that prints HelloWorld.
+ * Note that Feedback.msg_notice can be used to print messages.
+ *)
VERNAC COMMAND EXTEND HelloWorld CLASSIFIED AS QUERY
| [ "HelloWorld" ] -> { Feedback.msg_notice (strbrk Tuto0_main.message) }
END
+(*
+ * This is a tactic version of the same thing.
+ *)
TACTIC EXTEND hello_world_tactic
| [ "hello_world" ] ->
{ let _ = Feedback.msg_notice (str Tuto0_main.message) in
Tacticals.New.tclIDTAC }
END
+
+(*** Printing warnings ***)
+
+(*
+ * This defines a command that prints HelloWorld as a warning.
+ * tuto_warn is defined at the top-level, before the command runs,
+ * which is standard.
+ *)
+VERNAC COMMAND EXTEND HelloWarning CLASSIFIED AS QUERY
+| [ "HelloWarning" ] ->
+ {
+ tuto_warn ()
+ }
+END
+
+(*
+ * This is a tactic version of the same thing.
+ *)
+TACTIC EXTEND hello_warning_tactic
+| [ "hello_warning" ] ->
+ {
+ let _ = tuto_warn () in
+ Tacticals.New.tclIDTAC
+ }
+END
+
+(*** Printing errors ***)
+
+(*
+ * This defines a command that prints HelloWorld inside of an error.
+ * Note that CErrors.user_err can be used to raise errors to the user.
+ *)
+VERNAC COMMAND EXTEND HelloError CLASSIFIED AS QUERY
+| [ "HelloError" ] -> { CErrors.user_err (str Tuto0_main.message) }
+END
+
+(*
+ * This is a tactic version of the same thing.
+ *)
+TACTIC EXTEND hello_error_tactic
+| [ "hello_error" ] ->
+ { let _ = CErrors.user_err (str Tuto0_main.message) in
+ Tacticals.New.tclIDTAC }
+END
diff --git a/doc/plugin_tutorial/tuto0/theories/Demo.v b/doc/plugin_tutorial/tuto0/theories/Demo.v
index bdc61986af..54d5239421 100644
--- a/doc/plugin_tutorial/tuto0/theories/Demo.v
+++ b/doc/plugin_tutorial/tuto0/theories/Demo.v
@@ -1,8 +1,28 @@
From Tuto0 Require Import Loader.
+(*** Printing messages ***)
+
HelloWorld.
Lemma test : True.
Proof.
hello_world.
Abort.
+
+(*** Printing warnings ***)
+
+HelloWarning.
+
+Lemma test : True.
+Proof.
+hello_warning.
+Abort.
+
+(*** Signaling errors ***)
+
+Fail HelloError.
+
+Lemma test : True.
+Proof.
+Fail hello_error.
+Abort.
diff --git a/doc/plugin_tutorial/tuto1/_CoqProject b/doc/plugin_tutorial/tuto1/_CoqProject
index 585d1360be..60f9f0a0c7 100644
--- a/doc/plugin_tutorial/tuto1/_CoqProject
+++ b/doc/plugin_tutorial/tuto1/_CoqProject
@@ -2,7 +2,10 @@
-I src
theories/Loader.v
+theories/Demo.v
+src/inspector.mli
+src/inspector.ml
src/simple_check.mli
src/simple_check.ml
src/simple_declare.mli
diff --git a/doc/plugin_tutorial/tuto1/src/g_tuto1.mlg b/doc/plugin_tutorial/tuto1/src/g_tuto1.mlg
index 300d62285a..0b005a2341 100644
--- a/doc/plugin_tutorial/tuto1/src/g_tuto1.mlg
+++ b/doc/plugin_tutorial/tuto1/src/g_tuto1.mlg
@@ -8,7 +8,6 @@ DECLARE PLUGIN "tuto1_plugin"
theories/Loader.v
*)
open Ltac_plugin
-open Attributes
open Pp
(* This module defines the types of arguments to be used in the
EXTEND directives below, for example the string one. *)
@@ -16,136 +15,276 @@ open Stdarg
}
-VERNAC COMMAND EXTEND HelloWorld CLASSIFIED AS QUERY
-| [ "Hello" string(s) ] ->
- { Feedback.msg_notice (strbrk "Hello " ++ str s) }
-END
+(*** Printing inputs ***)
-(* reference is allowed as a syntactic entry, but so are all the entries
- found the signature of module Prim in file coq/parsing/pcoq.mli *)
+(*
+ * This command prints an input from the user.
+ *
+ * A list with allowable inputs can be found in interp/stdarg.mli,
+ * plugin/ltac/extraargs.mli, and plugin/ssr/ssrparser.mli
+ * (remove the wit_ prefix), but not all of these are allowable
+ * (unit and bool, for example, are not usable from within here).
+ *
+ * We include only some examples that are standard and useful for commands.
+ * Some of the omitted examples are useful for tactics.
+ *
+ * Inspector is our own file that defines a simple messaging function.
+ * The printing functions (pr_qualid and so on) are in printing.
+ *
+ * Some of these cases would be ambiguous if we used "What's" for each of
+ * these. For example, all of these are terms. We purposely disambiguate.
+ *)
+VERNAC COMMAND EXTEND WhatIsThis CLASSIFIED AS QUERY
+| [ "What's" constr(e) ] ->
+ {
+ let env = Global.env () in (* we'll explain later *)
+ let sigma = Evd.from_env env in (* we'll explain later *)
+ Inspector.print_input e (Ppconstr.pr_constr_expr env sigma) "term"
+ }
+| [ "What" "kind" "of" "term" "is" string(s) ] ->
+ { Inspector.print_input s strbrk "string" }
+| [ "What" "kind" "of" "term" "is" int(i) ] ->
+ { Inspector.print_input i Pp.int "int" }
+| [ "What" "kind" "of" "term" "is" ident(id) ] ->
+ { Inspector.print_input id Ppconstr.pr_id "identifier" }
+| [ "What" "kind" "of" "identifier" "is" reference(r) ] ->
+ { Inspector.print_input r Ppconstr.pr_qualid "reference" }
+END
-VERNAC COMMAND EXTEND HelloAgain CLASSIFIED AS QUERY
-| [ "HelloAgain" reference(r)] ->
-(* The function Ppconstr.pr_qualid was found by searching all mli files
- for a function of type qualid -> Pp.t *)
- { Feedback.msg_notice
- (strbrk "Hello again " ++ Ppconstr.pr_qualid r)}
+(*
+ * This command demonstrates basic combinators built into the DSL here.
+ * You can generalize this for constr_list, constr_opt, int_list, and so on.
+ *)
+VERNAC COMMAND EXTEND WhatAreThese CLASSIFIED AS QUERY
+| [ "What" "is" int_list(l) "a" "list" "of" ] ->
+ {
+ let print l = str "[" ++ Pp.prlist_with_sep (fun () -> str ";") Pp.int l ++ str "]" in
+ Inspector.print_input l print "int list"
+ }
+| [ "Is" ne_int_list(l) "nonempty" ] ->
+ {
+ let print l = str "[" ++ Pp.prlist_with_sep (fun () -> str ";") Pp.int l ++ str "]" in
+ Inspector.print_input l print "nonempty int list"
+ }
+| [ "And" "is" int_opt(o) "provided" ] ->
+ {
+ let print o = strbrk (if Option.has_some o then "Yes" else "No") in
+ Feedback.msg_notice (print o)
+ }
END
-(* According to parsing/pcoq.mli, e has type constr_expr *)
-(* this type is defined in pretyping/constrexpr.ml *)
-(* Question for the developers: why is the file constrexpr.ml and not
- constrexpr.mli --> Easier for packing the software in components. *)
-VERNAC COMMAND EXTEND TakingConstr CLASSIFIED AS QUERY
-| [ "Cmd1" constr(e) ] ->
- { let _ = e in Feedback.msg_notice (strbrk "Cmd1 parsed something") }
+
+(*** Interning terms ***)
+
+(*
+ * The next step is to make something of parsed expression.
+ * Interesting information in interp/constrintern.mli.
+ *
+ * When you read in constr(e), e will have type Constrexpr.constr_expr,
+ * which is defined in pretyping/constrexpr.ml. Your plugin
+ * will want a different representation.
+ *
+ * The important function is Constrintern.interp_constr_evars,
+ * which converts between a constr_expr and an
+ * (EConstr.constr, evar_map) pair. This essentially contains
+ * an internal representation of the term along with some state.
+ * For more on the state, read /dev/doc/econstr.md.
+ *
+ * NOTE ON INTERNING: Always prefer Constrintern.interp_constr_evars
+ * over Constrintern.interp_constr. The latter is an internal function
+ * not meant for external use.
+ *
+ * To get your initial environment, call Global.env ().
+ * To get state from that environment, call Evd.from_env on that environment.
+ * It is important to NEVER use the empty environment or Evd.empty;
+ * if you do, you will get confusing errors.
+ *
+ * NOTE ON STATE: It is important to use the evar_map that is returned to you.
+ * Otherwise, you may get cryptic errors later in your plugin.
+ * For example, you may get universe inconsistency errors.
+ * In general, if a function returns an evar_map to you, that's the one
+ * you want to thread through the rest of your command.
+ *
+ * NOTE ON STYLE: In general, it's better practice to move large
+ * chunks of OCaml code like this one into an .ml file. We include
+ * this here because it's really important to understand how to
+ * thread state in a plugin, and it's easier to see that if it's in the
+ * top-level file itself.
+ *)
+VERNAC COMMAND EXTEND Intern CLASSIFIED AS QUERY
+| [ "Intern" constr(e) ] ->
+ {
+ let env = Global.env () in (* use this; never use empty *)
+ let sigma = Evd.from_env env in (* use this; never use empty *)
+ let debug sigma = Termops.pr_evar_map ~with_univs:true None env sigma in
+ Feedback.msg_notice (strbrk "State before intern: " ++ debug sigma);
+ let (sigma, t) = Constrintern.interp_constr_evars env sigma e in
+ Feedback.msg_notice (strbrk "State after intern: " ++ debug sigma);
+ let print t = Printer.pr_econstr_env env sigma t in
+ Feedback.msg_notice (strbrk "Interned: " ++ print t)
+ }
END
-(* The next step is to make something of parsed expression.
- Interesting information in interp/constrintern.mli *)
-
-(* There are several phases of transforming a parsed expression into
- the final internal data-type (constr). There exists a collection of
- functions that combine all the phases *)
-
-VERNAC COMMAND EXTEND TakingConstr2 CLASSIFIED AS QUERY
-| [ "Cmd2" constr(e) ] ->
- { let _ = Constrintern.interp_constr
- (Global.env())
- (* Make sure you don't use Evd.empty here, as this does not
- check consistency with existing universe constraints. *)
- (Evd.from_env (Global.env())) e in
- Feedback.msg_notice (strbrk "Cmd2 parsed something legitimate") }
+(*** Defining terms ***)
+
+(*
+ * To define a term, we start similarly to our intern functionality,
+ * then we call another function. We define this function in
+ * the Simple_declare module.
+ *
+ * The line #[ poly = Attributes.polymorphic ] says that this command accepts
+ * polymorphic attributes.
+ * @SkySkimmer: Here, poly is what the result is bound to in the
+ * rule's code. Multiple attributes may be used separated by ;, and we have
+ * punning so foo is equivalent to foo = foo.
+ *
+ * The declare_definition function returns the reference
+ * that was defined. This reference will be present in the new environment.
+ * If you want to refer to it later in your plugin, you must use an
+ * updated environment and the constructed reference.
+ *
+ * Note since we are now defining a term, we must classify this
+ * as a side-effect (CLASSIFIED AS SIDEFF).
+ *)
+VERNAC COMMAND EXTEND MyDefine CLASSIFIED AS SIDEFF
+| #[ poly = Attributes.polymorphic ] [ "MyDefine" ident(i) ":=" constr(e) ] ->
+ {
+ let env = Global.env () in
+ let sigma = Evd.from_env env in
+ let (sigma, t) = Constrintern.interp_constr_evars env sigma e in
+ let r = Simple_declare.declare_definition ~poly i sigma t in
+ let print r = strbrk "Defined " ++ Printer.pr_global r ++ strbrk "." in
+ Feedback.msg_notice (print r)
+ }
END
-(* This is to show what happens when typing in an empty environment
- with an empty evd.
- Question for the developers: why does "Cmd3 (fun x : nat => x)."
- raise an anomaly, not the same error as "Cmd3 (fun x : a => x)." *)
-
-VERNAC COMMAND EXTEND TakingConstr3 CLASSIFIED AS QUERY
-| [ "Cmd3" constr(e) ] ->
- { let _ = Constrintern.interp_constr Environ.empty_env
- Evd.empty e in
- Feedback.msg_notice
- (strbrk "Cmd3 accepted something in the empty context")}
+(*** Printing terms ***)
+
+(*
+ * This command takes a name and return its value. It does less
+ * than Print, because it fails on constructors, axioms, and inductive types.
+ * It signals an error to the user for unsupported terms.
+ *
+ * Simple_print contains simple_body_access, which shows how to look up
+ * a global reference.
+ *)
+VERNAC COMMAND EXTEND ExamplePrint CLASSIFIED AS QUERY
+| [ "MyPrint" reference(r) ] ->
+ {
+ let env = Global.env () in
+ let sigma = Evd.from_env env in
+ try
+ let t = Simple_print.simple_body_access (Nametab.global r) in
+ Feedback.msg_notice (Printer.pr_econstr_env env sigma t)
+ with Failure s ->
+ CErrors.user_err (str s)
+ }
END
-(* When adding a definition, we have to be careful that just
- the operation of constructing a well-typed term may already change
- the environment, at the level of universe constraints (which
- are recorded in the evd component). The function
- Constrintern.interp_constr ignores this side-effect, so it should
- not be used here. *)
-
-(* Looking at the interface file interp/constrintern.ml4, I lost
- some time because I did not see that the "constr" type appearing
- there was "EConstr.constr" and not "Constr.constr". *)
-
-VERNAC COMMAND EXTEND Define1 CLASSIFIED AS SIDEFF
-| #[ poly = polymorphic ] [ "Cmd4" ident(i) constr(e) ] ->
- { let v = Constrintern.interp_constr (Global.env())
- (Evd.from_env (Global.env())) e in
- Simple_declare.packed_declare_definition ~poly i v }
+(*
+ * This command shows that after you define a new term,
+ * you can also look it up. But there's a catch! You need to actually
+ * refresh your environment. Otherwise, the defined term
+ * will not be in the environment.
+ *
+ * Using the global reference as opposed to the ID is generally
+ * a good idea, otherwise you might end up running into unforeseen
+ * problems inside of modules and sections and so on.
+ *
+ * Inside of simple_body_access, note that it uses Global.env (),
+ * which refreshes the environment before looking up the term.
+ *)
+VERNAC COMMAND EXTEND DefineLookup CLASSIFIED AS SIDEFF
+| #[ poly = Attributes.polymorphic ] [ "DefineLookup" ident(i) ":=" constr(e) ] ->
+ {
+ let env = Global.env () in
+ let sigma = Evd.from_env env in
+ let (sigma, t) = Constrintern.interp_constr_evars env sigma e in
+ let r = Simple_declare.declare_definition ~poly i sigma t in
+ let print r = strbrk "Defined " ++ Printer.pr_global r ++ strbrk "." in
+ Feedback.msg_notice (print r);
+ let env = Global.env () in
+ let sigma = Evd.from_env env in
+ let t = Simple_print.simple_body_access r in
+ let print t = strbrk "Found " ++ Printer.pr_econstr_env env sigma t in
+ Feedback.msg_notice (print t)
+ }
END
+(*** Checking terms ***)
+
+(*
+ * These are two commands for simple type-checking of terms.
+ * The bodies and explanations of the differences are in simple_check.ml.
+ *)
+
VERNAC COMMAND EXTEND Check1 CLASSIFIED AS QUERY
-| [ "Cmd5" constr(e) ] ->
- { let v = Constrintern.interp_constr (Global.env())
- (Evd.from_env (Global.env())) e in
- let (_, ctx) = v in
- let sigma = Evd.from_ctx ctx in
- Feedback.msg_notice
- (Printer.pr_econstr_env (Global.env()) sigma
- (Simple_check.simple_check1 v)) }
+| [ "Check1" constr(e) ] ->
+ {
+ let env = Global.env () in
+ let sigma = Evd.from_env env in
+ let (sigma, t) = Constrintern.interp_constr_evars env sigma e in
+ let (sigma, typ) = Simple_check.simple_check1 env sigma t in
+ Feedback.msg_notice (Printer.pr_econstr_env env sigma typ)
+ }
END
VERNAC COMMAND EXTEND Check2 CLASSIFIED AS QUERY
-| [ "Cmd6" constr(e) ] ->
- { let v = Constrintern.interp_constr (Global.env())
- (Evd.from_env (Global.env())) e in
- let sigma, ty = Simple_check.simple_check2 v in
- Feedback.msg_notice
- (Printer.pr_econstr_env (Global.env()) sigma ty) }
+| [ "Check2" constr(e) ] ->
+ {
+ let env = Global.env () in
+ let sigma = Evd.from_env env in
+ let (sigma, t) = Constrintern.interp_constr_evars env sigma e in
+ let typ = Simple_check.simple_check2 env sigma t in
+ Feedback.msg_notice (Printer.pr_econstr_env env sigma typ)
+ }
END
-VERNAC COMMAND EXTEND Check1 CLASSIFIED AS QUERY
-| [ "Cmd7" constr(e) ] ->
- { let v = Constrintern.interp_constr (Global.env())
- (Evd.from_env (Global.env())) e in
- let (a, ctx) = v in
- let sigma = Evd.from_ctx ctx in
- Feedback.msg_notice
- (Printer.pr_econstr_env (Global.env()) sigma
- (Simple_check.simple_check3 v)) }
-END
+(*** Convertibility ***)
-(* This command takes a name and return its value. It does less
- than Print, because it fails on constructors, axioms, and inductive types.
- This should be improved, because the error message is an anomaly.
- Anomalies should never appear even when using a command outside of its
- intended use. *)
-VERNAC COMMAND EXTEND ExamplePrint CLASSIFIED AS QUERY
-| [ "Cmd8" reference(r) ] ->
- { let env = Global.env() in
- let sigma = Evd.from_env env in
- Feedback.msg_notice
- (Printer.pr_econstr_env env sigma
- (EConstr.of_constr
- (Simple_print.simple_body_access (Nametab.global r)))) }
+(*
+ * This command checks if there is a possible assignment of
+ * constraints in the state under which the two terms are
+ * convertible.
+ *)
+VERNAC COMMAND EXTEND Convertible CLASSIFIED AS QUERY
+| [ "Convertible" constr(e1) constr(e2) ] ->
+ {
+ let env = Global.env () in
+ let sigma = Evd.from_env env in
+ let (sigma, t1) = Constrintern.interp_constr_evars env sigma e1 in
+ let (sigma, t2) = Constrintern.interp_constr_evars env sigma e2 in
+ match Reductionops.infer_conv env sigma t1 t2 with
+ | Some _ ->
+ Feedback.msg_notice (strbrk "Yes :)")
+ | None ->
+ Feedback.msg_notice (strbrk "No :(")
+ }
END
+(*** Introducing terms ***)
+
+(*
+ * We can call the tactics defined in Tactics within our tactics.
+ * Here we call intros.
+ *)
TACTIC EXTEND my_intro
| [ "my_intro" ident(i) ] ->
{ Tactics.introduction i }
END
-(* if one write this:
- VERNAC COMMAND EXTEND exploreproof CLASSIFIED AS QUERY
- it gives an error message that is basically impossible to understand. *)
+(*** Exploring proof state ***)
+(*
+ * This command demonstrates exploring the proof state from within
+ * a command.
+ *
+ * Note that Pfedit.get_current_context gets us the environment
+ * and state within a proof, as opposed to the global environment
+ * and state. This is important within tactics.
+ *)
VERNAC COMMAND EXTEND ExploreProof CLASSIFIED AS QUERY
-| ![ proof_query ] [ "Cmd9" ] ->
+| ![ proof_query ] [ "ExploreProof" ] ->
{ fun ~pstate ->
let sigma, env = Pfedit.get_current_context pstate in
let pprf = Proof.partial_proof Proof_global.(give_me_the_proof pstate) in
diff --git a/doc/plugin_tutorial/tuto1/src/inspector.ml b/doc/plugin_tutorial/tuto1/src/inspector.ml
new file mode 100644
index 0000000000..d37cbdb74c
--- /dev/null
+++ b/doc/plugin_tutorial/tuto1/src/inspector.ml
@@ -0,0 +1,8 @@
+open Pp
+
+(*
+ * Inspect an input and print a feedback message explaining what it is
+ *)
+let print_input (a : 'a) (printer : 'a -> Pp.t) (type_str : string) : unit =
+ let msg = printer a ++ strbrk (Printf.sprintf " is a %s." type_str) in
+ Feedback.msg_notice msg
diff --git a/doc/plugin_tutorial/tuto1/src/inspector.mli b/doc/plugin_tutorial/tuto1/src/inspector.mli
new file mode 100644
index 0000000000..52b970bbe0
--- /dev/null
+++ b/doc/plugin_tutorial/tuto1/src/inspector.mli
@@ -0,0 +1,4 @@
+(*
+ * Inspect an input and print a feedback message explaining what it is
+ *)
+val print_input : 'a -> ('a -> Pp.t) -> string -> unit
diff --git a/doc/plugin_tutorial/tuto1/src/simple_check.ml b/doc/plugin_tutorial/tuto1/src/simple_check.ml
index c2f09c64e0..684864a056 100644
--- a/doc/plugin_tutorial/tuto1/src/simple_check.ml
+++ b/doc/plugin_tutorial/tuto1/src/simple_check.ml
@@ -1,32 +1,14 @@
-let simple_check1 value_with_constraints =
- begin
- let evalue, st = value_with_constraints in
- let sigma = Evd.from_ctx st in
-(* This is reverse engineered from vernacentries.ml *)
-(* The point of renaming is to make sure the bound names printed by Check
- can be re-used in `apply with` tactics that use bound names to
- refer to arguments. *)
- let j = Environ.on_judgment EConstr.of_constr
- (Arguments_renaming.rename_typing (Global.env())
- (EConstr.to_constr sigma evalue)) in
- let {Environ.uj_type=x}=j in x
- end
-
-let simple_check2 value_with_constraints =
- let evalue, st = value_with_constraints in
- let sigma = Evd.from_ctx st in
-(* This version should be preferred if bound variable names are not so
- important, you want to really verify that the input is well-typed,
+let simple_check1 env sigma evalue =
+(* This version should be preferred if you want to really
+ verify that the input is well-typed,
and if you want to obtain the type. *)
(* Note that the output value is a pair containing a new evar_map:
typing will fill out blanks in the term by add evar bindings. *)
- Typing.type_of (Global.env()) sigma evalue
+ Typing.type_of env sigma evalue
-let simple_check3 value_with_constraints =
- let evalue, st = value_with_constraints in
- let sigma = Evd.from_ctx st in
-(* This version should be preferred if bound variable names are not so
- important and you already expect the input to have been type-checked
- before. Set ~lax to false if you want an anomaly to be raised in
- case of a type error. Otherwise a ReTypeError exception is raised. *)
- Retyping.get_type_of ~lax:true (Global.env()) sigma evalue
+let simple_check2 env sigma evalue =
+(* This version should be preferred if you already expect the input to
+ have been type-checked before. Set ~lax to false if you want an anomaly
+ to be raised in case of a type error. Otherwise a ReTypeError exception
+ is raised. *)
+ Retyping.get_type_of ~lax:true env sigma evalue
diff --git a/doc/plugin_tutorial/tuto1/src/simple_check.mli b/doc/plugin_tutorial/tuto1/src/simple_check.mli
index bcf1bf56cf..4b28ac74fe 100644
--- a/doc/plugin_tutorial/tuto1/src/simple_check.mli
+++ b/doc/plugin_tutorial/tuto1/src/simple_check.mli
@@ -1,8 +1,5 @@
val simple_check1 :
- EConstr.constr Evd.in_evar_universe_context -> EConstr.constr
+ Environ.env -> Evd.evar_map -> EConstr.constr -> Evd.evar_map * EConstr.constr
val simple_check2 :
- EConstr.constr Evd.in_evar_universe_context -> Evd.evar_map * EConstr.constr
-
-val simple_check3 :
- EConstr.constr Evd.in_evar_universe_context -> EConstr.constr
+ Environ.env -> Evd.evar_map -> EConstr.constr -> EConstr.constr
diff --git a/doc/plugin_tutorial/tuto1/src/simple_declare.ml b/doc/plugin_tutorial/tuto1/src/simple_declare.ml
index e9b91d5a7e..1e582e6456 100644
--- a/doc/plugin_tutorial/tuto1/src/simple_declare.ml
+++ b/doc/plugin_tutorial/tuto1/src/simple_declare.ml
@@ -6,11 +6,9 @@ let edeclare ?hook ident (_, poly, _ as k) ~opaque sigma udecl body tyopt imps =
let hook_data = Option.map (fun hook -> hook, uctx, []) hook in
DeclareDef.declare_definition ident k ce ubinders imps ?hook_data
-let packed_declare_definition ~poly ident value_with_constraints =
- let body, ctx = value_with_constraints in
- let sigma = Evd.from_ctx ctx in
+let declare_definition ~poly ident sigma body =
let k = (Decl_kinds.Global, poly, Decl_kinds.Definition) in
let udecl = UState.default_univ_decl in
- ignore (edeclare ident k ~opaque:false sigma udecl body None [])
+ edeclare ident k ~opaque:false sigma udecl body None []
(* But this definition cannot be undone by Reset ident *)
diff --git a/doc/plugin_tutorial/tuto1/src/simple_declare.mli b/doc/plugin_tutorial/tuto1/src/simple_declare.mli
index fd74e81526..c55b36742f 100644
--- a/doc/plugin_tutorial/tuto1/src/simple_declare.mli
+++ b/doc/plugin_tutorial/tuto1/src/simple_declare.mli
@@ -1,5 +1,4 @@
open Names
-open EConstr
-val packed_declare_definition :
- poly:bool -> Id.t -> constr Evd.in_evar_universe_context -> unit
+val declare_definition :
+ poly:bool -> Id.t -> Evd.evar_map -> EConstr.t -> Names.GlobRef.t
diff --git a/doc/plugin_tutorial/tuto1/src/simple_print.ml b/doc/plugin_tutorial/tuto1/src/simple_print.ml
index 22a0163fbb..48b5f2214c 100644
--- a/doc/plugin_tutorial/tuto1/src/simple_print.ml
+++ b/doc/plugin_tutorial/tuto1/src/simple_print.ml
@@ -12,6 +12,6 @@ let simple_body_access gref =
| Globnames.ConstRef cst ->
let cb = Environ.lookup_constant cst (Global.env()) in
match Global.body_of_constant_body Library.indirect_accessor cb with
- | Some(e, _) -> e
+ | Some(e, _) -> EConstr.of_constr e
| None -> failwith "This term has no value"
diff --git a/doc/plugin_tutorial/tuto1/src/simple_print.mli b/doc/plugin_tutorial/tuto1/src/simple_print.mli
index 254b56ff79..943e26acb6 100644
--- a/doc/plugin_tutorial/tuto1/src/simple_print.mli
+++ b/doc/plugin_tutorial/tuto1/src/simple_print.mli
@@ -1 +1 @@
-val simple_body_access : Names.GlobRef.t -> Constr.constr
+val simple_body_access : Names.GlobRef.t -> EConstr.constr
diff --git a/doc/plugin_tutorial/tuto1/src/tuto1_plugin.mlpack b/doc/plugin_tutorial/tuto1/src/tuto1_plugin.mlpack
index a797a509e0..9309f78cd0 100644
--- a/doc/plugin_tutorial/tuto1/src/tuto1_plugin.mlpack
+++ b/doc/plugin_tutorial/tuto1/src/tuto1_plugin.mlpack
@@ -1,3 +1,4 @@
+Inspector
Simple_check
Simple_declare
Simple_print
diff --git a/doc/plugin_tutorial/tuto1/theories/Demo.v b/doc/plugin_tutorial/tuto1/theories/Demo.v
new file mode 100644
index 0000000000..5723e2f82e
--- /dev/null
+++ b/doc/plugin_tutorial/tuto1/theories/Demo.v
@@ -0,0 +1,95 @@
+From Tuto1 Require Import Loader.
+
+(*** Printing user inputs ***)
+
+Definition definition := 5.
+What's definition.
+What kind of term is definition.
+What kind of identifier is definition.
+
+What is 1 2 3 a list of.
+What is a list of. (* no arguments = empty list *)
+
+Is 1 2 3 nonempty.
+(* Is nonempty *) (* does not parse *)
+
+And is 1 provided.
+And is provided.
+
+(*** Interning terms ***)
+
+Intern 3.
+Intern definition.
+Intern (fun (x : Prop) => x).
+Intern (fun (x : Type) => x).
+Intern (forall (T : Type), T).
+Intern (fun (T : Type) (t : T) => t).
+Intern _.
+Intern (Type : Type).
+
+(*** Defining terms ***)
+
+MyDefine n := 1.
+Print n.
+
+MyDefine f := (fun (x : Type) => x).
+Print f.
+
+(*** Printing terms ***)
+
+MyPrint f.
+MyPrint n.
+Fail MyPrint nat.
+
+DefineLookup n' := 1.
+DefineLookup f' := (fun (x : Type) => x).
+
+(*** Checking terms ***)
+
+Check1 3.
+Check1 definition.
+Check1 (fun (x : Prop) => x).
+Check1 (fun (x : Type) => x).
+Check1 (forall (T : Type), T).
+Check1 (fun (T : Type) (t : T) => t).
+Check1 _.
+Check1 (Type : Type).
+
+Check2 3.
+Check2 definition.
+Check2 (fun (x : Prop) => x).
+Check2 (fun (x : Type) => x).
+Check2 (forall (T : Type), T).
+Check2 (fun (T : Type) (t : T) => t).
+Check2 _.
+Check2 (Type : Type).
+
+(*** Convertibility ***)
+
+Convertible 1 1.
+Convertible (fun (x : Type) => x) (fun (x : Type) => x).
+Convertible Type Type.
+Convertible 1 ((fun (x : nat) => x) 1).
+
+Convertible 1 2.
+Convertible (fun (x : Type) => x) (fun (x : Prop) => x).
+Convertible Type Prop.
+Convertible 1 ((fun (x : nat) => x) 2).
+
+(*** Introducing variables ***)
+
+Theorem foo:
+ forall (T : Set) (t : T), T.
+Proof.
+ my_intro T. my_intro t. apply t.
+Qed.
+
+(*** Exploring proof state ***)
+
+Fail ExploreProof. (* not in a proof *)
+
+Theorem bar:
+ forall (T : Set) (t : T), T.
+Proof.
+ ExploreProof. my_intro T. ExploreProof. my_intro t. ExploreProof. apply t.
+Qed.
diff --git a/kernel/dune b/kernel/dune
index 5b23a705ae..4038bf5638 100644
--- a/kernel/dune
+++ b/kernel/dune
@@ -3,7 +3,7 @@
(synopsis "The Coq Kernel")
(public_name coq.kernel)
(wrapped false)
- (modules (:standard \ genOpcodeFiles uint63_x86 uint63_amd64 write_uint63))
+ (modules (:standard \ genOpcodeFiles uint63_i386_31 uint63_amd64_63 write_uint63))
(libraries lib byterun dynlink))
(executable
@@ -14,15 +14,10 @@
(targets copcodes.ml)
(action (with-stdout-to %{targets} (run ./genOpcodeFiles.exe copml))))
-(executable
- (name write_uint63)
- (modules write_uint63)
- (libraries unix))
-
(rule
(targets uint63.ml)
- (deps (:gen ./write_uint63.exe) uint63_x86.ml uint63_amd64.ml)
- (action (run %{gen})))
+ (deps (:gen-file uint63_%{ocaml-config:architecture}_%{ocaml-config:int_size}.ml))
+ (action (copy# %{gen-file} %{targets})))
(documentation
(package coq))
diff --git a/kernel/uint63_amd64.ml b/kernel/uint63_amd64_63.ml
index 2d4d685775..2d4d685775 100644
--- a/kernel/uint63_amd64.ml
+++ b/kernel/uint63_amd64_63.ml
diff --git a/kernel/uint63_x86.ml b/kernel/uint63_i386_31.ml
index fa45c90241..fa45c90241 100644
--- a/kernel/uint63_x86.ml
+++ b/kernel/uint63_i386_31.ml
diff --git a/kernel/write_uint63.ml b/kernel/write_uint63.ml
index beb59ce205..42bb5dfbb1 100644
--- a/kernel/write_uint63.ml
+++ b/kernel/write_uint63.ml
@@ -31,8 +31,8 @@ let ml_file_copy input output =
let write_uint63 () =
ml_file_copy
- (if max_int = 1073741823 (* 32-bits *) then "uint63_x86.ml"
- else (* 64 bits *) "uint63_amd64.ml")
+ (if max_int = 1073741823 (* 32-bits *) then "uint63_i386_31.ml"
+ else (* 64 bits *) "uint63_amd64_63.ml")
"uint63.ml"
let () = write_uint63 ()
diff --git a/plugins/ltac/rewrite.ml b/plugins/ltac/rewrite.ml
index 7b286e69dc..e0a31e7dba 100644
--- a/plugins/ltac/rewrite.ml
+++ b/plugins/ltac/rewrite.ml
@@ -946,9 +946,9 @@ let fold_match ?(force=false) env sigma c =
if dep then case_dep_scheme_kind_from_prop
else case_scheme_kind_from_prop
else (
- if dep
- then case_dep_scheme_kind_from_type_in_prop
- else case_scheme_kind_from_type)
+ if dep
+ then case_dep_scheme_kind_from_type_in_prop
+ else case_scheme_kind_from_type)
else ((* sortc <> InProp by typing *)
if dep
then case_dep_scheme_kind_from_type
diff --git a/plugins/ssr/ssrequality.ml b/plugins/ssr/ssrequality.ml
index dbb0f25abf..91905d277c 100644
--- a/plugins/ssr/ssrequality.ml
+++ b/plugins/ssr/ssrequality.ml
@@ -336,14 +336,14 @@ let pirrel_rewrite ?(under=false) ?(map_redex=id_map_redex) pred rdx rdx_ty new_
let sigma, p = (* The resulting goal *)
Evarutil.new_evar env sigma (beta (EConstr.Vars.subst1 new_rdx pred)) in
let pred = EConstr.mkNamedLambda (make_annot pattern_id Sorts.Relevant) rdx_ty pred in
- let elim, gl =
+ let elim, gl =
let ((kn, i) as ind, _), unfolded_c_ty = pf_reduce_to_quantified_ind gl c_ty in
let sort = elimination_sort_of_goal gl in
let elim, gl = pf_fresh_global (Indrec.lookup_eliminator env ind sort) gl in
if dir = R2L then elim, gl else (* taken from Coq's rewrite *)
let elim, _ = destConst elim in
let mp,l = Constant.repr2 (Constant.make1 (Constant.canonical elim)) in
- let l' = Label.of_id (Nameops.add_suffix (Label.to_id l) "_r") in
+ let l' = Label.of_id (Nameops.add_suffix (Label.to_id l) "_r") in
let c1' = Global.constant_of_delta_kn (Constant.canonical (Constant.make2 mp l')) in
mkConst c1', gl in
let elim = EConstr.of_constr elim in
diff --git a/tactics/elimschemes.ml b/tactics/elimschemes.ml
index 1170c1acd0..8ead050262 100644
--- a/tactics/elimschemes.ml
+++ b/tactics/elimschemes.ml
@@ -59,7 +59,7 @@ let build_induction_scheme_in_type dep sort ind =
let sigma, pind = Evd.fresh_inductive_instance env sigma ind in
let sigma, c = build_induction_scheme env sigma pind dep sort in
c, Evd.evar_universe_context sigma
-
+
let rect_scheme_kind_from_type =
declare_individual_scheme_object "_rect_nodep"
(fun _ x -> build_induction_scheme_in_type false InType x, Safe_typing.empty_private_constants)
@@ -108,6 +108,16 @@ let sind_scheme_kind_from_prop =
declare_individual_scheme_object "_sind" ~aux:"_sind_from_prop"
(fun _ x -> build_induction_scheme_in_type false InSProp x, Safe_typing.empty_private_constants)
+let nondep_elim_scheme from_kind to_kind =
+ match from_kind, to_kind with
+ | InProp, InProp -> ind_scheme_kind_from_prop
+ | InProp, InSProp -> sind_scheme_kind_from_prop
+ | InProp, InSet -> rec_scheme_kind_from_prop
+ | InProp, InType -> rect_scheme_kind_from_prop
+ | _ , InProp -> ind_scheme_kind_from_type
+ | _ , InSProp -> sind_scheme_kind_from_type
+ | _ , InSet -> rec_scheme_kind_from_type
+ | _ , InType -> rect_scheme_kind_from_type
(* Case analysis *)
diff --git a/tactics/elimschemes.mli b/tactics/elimschemes.mli
index 4472792449..f60e6c137a 100644
--- a/tactics/elimschemes.mli
+++ b/tactics/elimschemes.mli
@@ -33,6 +33,7 @@ val sind_dep_scheme_kind_from_type : individual scheme_kind
val rec_scheme_kind_from_type : individual scheme_kind
val rec_dep_scheme_kind_from_type : individual scheme_kind
+val nondep_elim_scheme : Sorts.family -> Sorts.family -> individual scheme_kind
(** Case analysis schemes *)
diff --git a/tactics/equality.ml b/tactics/equality.ml
index 51eee2a053..ec0876110b 100644
--- a/tactics/equality.ml
+++ b/tactics/equality.ml
@@ -352,35 +352,35 @@ let find_elim hdcncl lft2rgt dep cls ot =
(is_global_exists "core.JMeq.type" hdcncl
&& jmeq_same_dom env sigma ot)) && not dep
then
- let c =
+ let c =
match EConstr.kind sigma hdcncl with
- | Ind (ind_sp,u) ->
- let pr1 =
+ | Ind (ind_sp,u) ->
+ let pr1 =
lookup_eliminator env ind_sp (elimination_sort_of_clause cls gl)
- in
+ in
begin match lft2rgt, cls with
| Some true, None
| Some false, Some _ ->
- let c1 = destConstRef pr1 in
+ let c1 = destConstRef pr1 in
let mp,l = Constant.repr2 (Constant.make1 (Constant.canonical c1)) in
- let l' = Label.of_id (add_suffix (Label.to_id l) "_r") in
+ let l' = Label.of_id (add_suffix (Label.to_id l) "_r") in
let c1' = Global.constant_of_delta_kn (KerName.make mp l') in
- begin
- try
- let _ = Global.lookup_constant c1' in
- c1'
- with Not_found ->
+ begin
+ try
+ let _ = Global.lookup_constant c1' in
+ c1'
+ with Not_found ->
user_err ~hdr:"Equality.find_elim"
(str "Cannot find rewrite principle " ++ Label.print l' ++ str ".")
end
- | _ -> destConstRef pr1
+ | _ -> destConstRef pr1
end
| _ ->
(* cannot occur since we checked that we are in presence of
Logic.eq or Jmeq just before *)
assert false
in
- pf_constr_of_global (ConstRef c)
+ pf_constr_of_global (ConstRef c)
else
let scheme_name = match dep, lft2rgt, inccl with
(* Non dependent case *)
@@ -946,12 +946,12 @@ let build_coq_I () = pf_constr_of_global (lib_ref "core.True.I")
let rec build_discriminator env sigma true_0 false_0 dirn c = function
| [] ->
let ind = get_type_of env sigma c in
- build_selector env sigma dirn c ind true_0 false_0
+ build_selector env sigma dirn c ind true_0 (fst false_0)
| ((sp,cnum),argnum)::l ->
let (cnum_nlams,cnum_env,kont) = descend_then env sigma c cnum in
let newc = mkRel(cnum_nlams-argnum) in
let subval = build_discriminator cnum_env sigma true_0 false_0 dirn newc l in
- kont sigma subval (false_0,mkProp)
+ kont sigma subval false_0
(* Note: discrimination could be more clever: if some elimination is
not allowed because of a large impredicative constructor in the
@@ -983,25 +983,22 @@ let gen_absurdity id =
absurd_term=False
*)
-let ind_scheme_of_eq lbeq =
+let ind_scheme_of_eq lbeq to_kind =
let (mib,mip) = Global.lookup_inductive (destIndRef lbeq.eq) in
- let kind = inductive_sort_family mip in
+ let from_kind = inductive_sort_family mip in
(* use ind rather than case by compatibility *)
- let kind =
- if kind == InProp then Elimschemes.ind_scheme_kind_from_prop
- else Elimschemes.ind_scheme_kind_from_type in
+ let kind = Elimschemes.nondep_elim_scheme from_kind to_kind in
let c, eff = find_scheme kind (destIndRef lbeq.eq) in
ConstRef c, eff
-let discrimination_pf e (t,t1,t2) discriminator lbeq =
+let discrimination_pf e (t,t1,t2) discriminator lbeq to_kind =
build_coq_I () >>= fun i ->
- build_coq_False () >>= fun absurd_term ->
- let eq_elim, eff = ind_scheme_of_eq lbeq in
+ let eq_elim, eff = ind_scheme_of_eq lbeq to_kind in
Proofview.tclEFFECTS eff <*>
pf_constr_of_global eq_elim >>= fun eq_elim ->
Proofview.tclUNIT
- (applist (eq_elim, [t;t1;mkNamedLambda (make_annot e Sorts.Relevant) t discriminator;i;t2]), absurd_term)
+ (applist (eq_elim, [t;t1;mkNamedLambda (make_annot e Sorts.Relevant) t discriminator;i;t2]))
let eq_baseid = Id.of_string "e"
@@ -1018,21 +1015,23 @@ let apply_on_clause (f,t) clause =
let discr_positions env sigma (lbeq,eqn,(t,t1,t2)) eq_clause cpath dirn =
build_coq_True () >>= fun true_0 ->
build_coq_False () >>= fun false_0 ->
+ let false_ty = Retyping.get_type_of env sigma false_0 in
+ let false_kind = Retyping.get_sort_family_of env sigma false_0 in
let e = next_ident_away eq_baseid (vars_of_env env) in
let e_env = push_named (Context.Named.Declaration.LocalAssum (make_annot e Sorts.Relevant,t)) env in
let discriminator =
try
Proofview.tclUNIT
- (build_discriminator e_env sigma true_0 false_0 dirn (mkVar e) cpath)
+ (build_discriminator e_env sigma true_0 (false_0,false_ty) dirn (mkVar e) cpath)
with
UserError _ as ex -> Proofview.tclZERO ex
in
discriminator >>= fun discriminator ->
- discrimination_pf e (t,t1,t2) discriminator lbeq >>= fun (pf, absurd_term) ->
- let pf_ty = mkArrow eqn Sorts.Relevant absurd_term in
+ discrimination_pf e (t,t1,t2) discriminator lbeq false_kind >>= fun pf ->
+ let pf_ty = mkArrow eqn Sorts.Relevant false_0 in
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)
+ tclTHENS (assert_after Anonymous false_0)
[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 =
diff --git a/test-suite/success/Discriminate_HoTT.v b/test-suite/success/Discriminate_HoTT.v
new file mode 100644
index 0000000000..2a5e083d56
--- /dev/null
+++ b/test-suite/success/Discriminate_HoTT.v
@@ -0,0 +1,89 @@
+(* -*- mode: coq; coq-prog-args: ("-noinit" "-indices-matter") -*- *)
+
+(* This file tests the discriminate tactic compatibility with HoTT.
+ The first part of the file will setup a mini HoTT environment.
+ Afterwards a number of tests are performed. The tests are basically
+ copied from the Discriminate.v test file. *)
+
+Unset Elimination Schemes.
+
+Set Universe Polymorphism.
+
+Declare ML Module "ltac_plugin".
+
+Global Set Default Proof Mode "Classic".
+
+Notation "x -> y" := (forall (_:x), y) (at level 99, right associativity, y at level 200).
+
+Cumulative Variant paths {A} (a:A) : A -> Type
+ := idpath : paths a a.
+
+Arguments idpath {A a} , [A] a.
+
+Scheme paths_ind := Induction for paths Sort Type.
+Arguments paths_ind [A] a P f y p.
+
+Notation "x = y :> A" := (@paths A x y) (at level 70, y at next level, no associativity).
+Notation "x = y" := (x = y :>_) (at level 70, no associativity).
+
+Register paths as core.identity.type.
+Register idpath as core.identity.refl.
+Register paths_ind as core.identity.ind.
+
+Definition inverse {A : Type} {x y : A} (p : x = y) : y = x
+ := match p with idpath => idpath end.
+Arguments inverse {A x y} p : simpl nomatch.
+Register inverse as core.identity.sym.
+
+Definition concat {A : Type} {x y z : A} (p : x = y) (q : y = z) : x = z :=
+ match p, q with idpath, idpath => idpath end.
+Arguments concat {A x y z} p q : simpl nomatch.
+Register concat as core.identity.trans.
+
+Definition ap {A B:Type} (f:A -> B) {x y:A} (p:x = y) : f x = f y
+ := match p with idpath => idpath end.
+Arguments ap {A B} f {x y} p.
+Register ap as core.identity.congr.
+
+Variant Empty : Type :=.
+
+Register Empty as core.False.type.
+
+Variant Unit : Type := tt.
+
+Register Unit as core.True.type.
+Register tt as core.True.I.
+
+Variant Bool : Type := true | false.
+
+Inductive nat : Type := O | S (n:nat).
+
+(*********** Test discriminate tactic below. ***************)
+
+Goal O = S O -> Empty.
+ discriminate 1.
+Qed.
+
+Goal forall H : O = S O, H = H.
+ discriminate H.
+Qed.
+
+Goal O = S O -> Unit.
+intros. discriminate H. Qed.
+Goal O = S O -> Unit.
+intros. Ltac g x := discriminate x. g H. Qed.
+
+Goal (forall x y : nat, x = y -> x = S y) -> Unit.
+intros.
+try discriminate (H O) || exact tt.
+Qed.
+
+Goal (forall x y : nat, x = y -> x = S y) -> Unit.
+intros. ediscriminate (H O). instantiate (1:=O). Abort.
+
+(* Check discriminate on types with local definitions *)
+
+Inductive A := B (T := Unit) (x y : Bool) (z := x).
+Goal forall x y, B x true = B y false -> Empty.
+discriminate.
+Qed.
diff --git a/vernac/vernacentries.ml b/vernac/vernacentries.ml
index af13c873e2..8668f01053 100644
--- a/vernac/vernacentries.ml
+++ b/vernac/vernacentries.ml
@@ -2694,7 +2694,7 @@ let rec interp_expr ?proof ~atts ~st c =
[vernac_load] is mutually-recursive with [interp_expr] *)
| VernacLoad (verbosely,fname) ->
unsupported_attributes atts;
- vernac_load ?proof ~verbosely ~st fname
+ vernac_load ~verbosely ~st fname
(* Special: ?proof parameter doesn't allow for uniform pstate pop :S *)
| VernacEndProof e ->
@@ -2711,7 +2711,7 @@ let rec interp_expr ?proof ~atts ~st c =
the way the proof mode is set there makes the task non trivial
without a considerable amount of refactoring.
*)
-and vernac_load ?proof ~verbosely ~st fname =
+and vernac_load ~verbosely ~st fname =
let pstate = st.Vernacstate.proof in
if there_are_pending_proofs ~pstate then
CErrors.user_err Pp.(str "Load is not supported inside proofs.");
@@ -2734,7 +2734,7 @@ and vernac_load ?proof ~verbosely ~st fname =
try
let proof_mode = Option.map (fun _ -> get_default_proof_mode ()) pstate in
let pstate =
- v_mod (interp_control ?proof ~st:{ st with Vernacstate.proof = pstate })
+ v_mod (interp_control ?proof:None ~st:{ st with Vernacstate.proof = pstate })
(parse_sentence proof_mode input) in
load_loop ~pstate
with