aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.bintray.json20
-rw-r--r--.gitignore3
-rw-r--r--.mailmap18
-rw-r--r--.travis.yml82
-rw-r--r--API/API.ml3
-rw-r--r--API/API.mli316
-rw-r--r--CHANGES130
-rw-r--r--Makefile3
-rw-r--r--Makefile.build24
-rw-r--r--Makefile.ci7
-rw-r--r--Makefile.common2
-rw-r--r--Makefile.doc20
-rw-r--r--Makefile.ide54
-rw-r--r--Makefile.install2
-rw-r--r--README.ci.md38
-rw-r--r--checker/indtypes.mli4
-rw-r--r--checker/univ.ml2
-rw-r--r--checker/univ.mli14
-rw-r--r--dev/README4
-rw-r--r--dev/TODO22
-rwxr-xr-xdev/build/osx/make-macos-dmg.sh14
-rwxr-xr-xdev/ci/ci-coq-dpdgraph.sh2
-rwxr-xr-xdev/ci/ci-hott.sh2
-rw-r--r--dev/db_printers.ml16
-rw-r--r--dev/doc/api.txt10
-rw-r--r--dev/doc/changes.txt7
-rw-r--r--dev/doc/debugging.txt2
-rw-r--r--dev/doc/notes-on-conversion.v (renamed from dev/doc/notes-on-conversion)0
-rw-r--r--dev/tools/Makefile.devel74
-rw-r--r--dev/tools/Makefile.dir131
-rw-r--r--dev/tools/Makefile.subdir7
-rw-r--r--dev/v8-syntax/.gitignore6
-rw-r--r--dev/v8-syntax/syntax-v8.tex2
-rw-r--r--doc/Makefile.rt43
-rw-r--r--doc/RecTutorial/RecTutorial.v111
-rw-r--r--doc/common/styles/html/coqremote/modules/node/node.css43
-rw-r--r--doc/common/styles/html/coqremote/modules/system/defaults.css52
-rw-r--r--doc/common/styles/html/coqremote/modules/system/system.css543
-rw-r--r--doc/common/styles/html/coqremote/modules/user/user.css58
-rw-r--r--doc/common/styles/html/coqremote/sites/all/themes/coq/coqdoc.css329
-rw-r--r--doc/common/styles/html/coqremote/sites/all/themes/coq/style.css801
-rw-r--r--doc/refman/AsyncProofs.tex14
-rw-r--r--doc/refman/Extraction.tex31
-rw-r--r--doc/refman/RefMan-cic.tex27
-rw-r--r--doc/refman/RefMan-gal.tex2
-rw-r--r--doc/refman/RefMan-int.tex16
-rw-r--r--doc/refman/RefMan-oth.tex19
-rw-r--r--doc/refman/RefMan-pro.tex4
-rw-r--r--doc/refman/RefMan-sch.tex1
-rw-r--r--doc/refman/RefMan-ssr.tex4932
-rw-r--r--doc/refman/RefMan-tac.tex64
-rw-r--r--doc/refman/RefMan-tacex.tex2
-rw-r--r--doc/refman/Reference-Manual.tex16
-rw-r--r--doc/refman/Setoid.tex4
-rw-r--r--doc/refman/Universes.tex79
-rw-r--r--doc/refman/coq-listing.tex152
-rw-r--r--doc/rt/RefMan-cover.tex45
-rw-r--r--doc/rt/Tutorial-cover.tex47
-rw-r--r--doc/tools/Translator.tex2
-rw-r--r--doc/tutorial/Tutorial.tex18
-rw-r--r--engine/evarutil.ml8
-rw-r--r--engine/evarutil.mli7
-rw-r--r--engine/geninterp.ml2
-rw-r--r--engine/geninterp.mli2
-rw-r--r--engine/logic_monad.mli10
-rw-r--r--engine/proofview.ml2
-rw-r--r--engine/proofview.mli4
-rw-r--r--engine/proofview_monad.ml2
-rw-r--r--engine/proofview_monad.mli4
-rw-r--r--engine/termops.ml2
-rw-r--r--engine/termops.mli37
-rw-r--r--engine/uState.mli2
-rw-r--r--engine/universes.mli6
-rw-r--r--grammar/argextend.mlp3
-rw-r--r--grammar/compat5.ml13
-rw-r--r--ide/coqOps.ml4
-rw-r--r--ide/document.mli2
-rw-r--r--ide/ide_slave.ml6
-rw-r--r--ide/ideutils.ml2
-rw-r--r--ide/ideutils.mli2
-rw-r--r--ide/interface.mli8
-rw-r--r--ide/minilib.mli2
-rw-r--r--ide/richpp.mli4
-rw-r--r--ide/wg_Detachable.ml2
-rw-r--r--ide/wg_MessageView.ml4
-rw-r--r--ide/wg_MessageView.mli4
-rw-r--r--ide/xmlprotocol.ml4
-rw-r--r--interp/constrextern.ml40
-rw-r--r--interp/constrextern.mli3
-rw-r--r--interp/declare.ml15
-rw-r--r--interp/declare.mli5
-rw-r--r--interp/notation.ml10
-rw-r--r--interp/notation.mli14
-rw-r--r--interp/ppextend.ml9
-rw-r--r--interp/ppextend.mli14
-rw-r--r--intf/notation_term.ml24
-rw-r--r--intf/vernacexpr.ml10
-rw-r--r--kernel/cPrimitives.ml (renamed from kernel/primitives.ml)0
-rw-r--r--kernel/cPrimitives.mli (renamed from kernel/primitives.mli)0
-rw-r--r--kernel/cbytecodes.mli6
-rw-r--r--kernel/environ.ml34
-rw-r--r--kernel/kernel.mllib2
-rw-r--r--kernel/mod_subst.mli4
-rw-r--r--kernel/names.mli30
-rw-r--r--kernel/nativecode.ml16
-rw-r--r--kernel/nativeinstr.mli2
-rw-r--r--kernel/nativelambda.mli2
-rw-r--r--kernel/uGraph.mli2
-rw-r--r--kernel/univ.ml2
-rw-r--r--kernel/univ.mli38
-rw-r--r--kernel/vm.mli6
-rw-r--r--lib/cErrors.ml6
-rw-r--r--lib/cErrors.mli28
-rw-r--r--lib/cWarnings.mli2
-rw-r--r--lib/explore.ml2
-rw-r--r--lib/explore.mli2
-rw-r--r--lib/feedback.ml2
-rw-r--r--lib/feedback.mli12
-rw-r--r--lib/flags.ml9
-rw-r--r--lib/flags.mli11
-rw-r--r--lib/future.mli6
-rw-r--r--lib/genarg.ml2
-rw-r--r--lib/genarg.mli2
-rw-r--r--lib/minisys.ml4
-rw-r--r--lib/pp.ml2
-rw-r--r--lib/pp.mli100
-rw-r--r--lib/rtree.mli2
-rw-r--r--lib/system.mli2
-rw-r--r--library/declaremods.ml17
-rw-r--r--library/declaremods.mli10
-rw-r--r--library/goptions.ml10
-rw-r--r--library/goptions.mli9
-rw-r--r--library/keys.mli2
-rw-r--r--library/lib.ml34
-rw-r--r--library/lib.mli6
-rw-r--r--library/libnames.mli9
-rw-r--r--library/library.ml3
-rw-r--r--library/library.mli3
-rw-r--r--library/nameops.mli8
-rw-r--r--library/nametab.mli3
-rw-r--r--man/coqide.17
-rw-r--r--man/coqtop.16
-rw-r--r--parsing/cLexer.ml46
-rw-r--r--parsing/cLexer.mli3
-rw-r--r--parsing/egramcoq.ml33
-rw-r--r--parsing/egramcoq.mli2
-rw-r--r--parsing/g_vernac.ml49
-rw-r--r--plugins/cc/ccalgo.mli4
-rw-r--r--plugins/cc/cctac.ml3
-rw-r--r--plugins/extraction/common.mli23
-rw-r--r--plugins/extraction/extract_env.mli2
-rw-r--r--plugins/extraction/extraction.ml6
-rw-r--r--plugins/extraction/miniml.mli15
-rw-r--r--plugins/extraction/table.mli4
-rw-r--r--plugins/firstorder/sequent.ml2
-rw-r--r--plugins/firstorder/sequent.mli2
-rw-r--r--plugins/funind/functional_principles_proofs.ml3
-rw-r--r--plugins/funind/glob_term_to_relation.ml29
-rw-r--r--plugins/funind/glob_termops.ml27
-rw-r--r--plugins/funind/indfun.ml6
-rw-r--r--plugins/funind/indfun.mli4
-rw-r--r--plugins/funind/indfun_common.mli9
-rw-r--r--plugins/funind/merge.ml4
-rw-r--r--plugins/ltac/extraargs.ml42
-rw-r--r--plugins/ltac/extraargs.mli10
-rw-r--r--plugins/ltac/g_class.ml42
-rw-r--r--plugins/ltac/pptactic.ml54
-rw-r--r--plugins/ltac/pptactic.mli83
-rw-r--r--plugins/ltac/rewrite.ml2
-rw-r--r--plugins/ltac/rewrite.mli4
-rw-r--r--plugins/ltac/tacintern.mli3
-rw-r--r--plugins/ltac/tacinterp.ml2
-rw-r--r--plugins/ltac/tactic_debug.mli8
-rw-r--r--plugins/ltac/tactic_option.mli2
-rw-r--r--plugins/rtauto/proof_search.mli4
-rw-r--r--plugins/setoid_ring/Ring_tac.v34
-rw-r--r--plugins/ssr/ssrcommon.mli2
-rw-r--r--plugins/ssr/ssrparser.ml42
-rw-r--r--plugins/ssr/ssrparser.mli6
-rw-r--r--plugins/ssr/ssrprinters.mli26
-rw-r--r--plugins/ssrmatching/ssrmatching.mli10
-rw-r--r--pretyping/classops.ml4
-rw-r--r--pretyping/classops.mli7
-rw-r--r--pretyping/detyping.ml15
-rw-r--r--pretyping/detyping.mli6
-rw-r--r--pretyping/evardefine.mli2
-rw-r--r--pretyping/pretyping.ml9
-rw-r--r--pretyping/recordops.mli2
-rw-r--r--pretyping/reductionops.ml4
-rw-r--r--pretyping/reductionops.mli10
-rw-r--r--pretyping/retyping.mli2
-rw-r--r--pretyping/typeclasses.ml35
-rw-r--r--printing/genprint.ml2
-rw-r--r--printing/genprint.mli9
-rw-r--r--printing/ppconstr.ml11
-rw-r--r--printing/ppconstr.mli67
-rw-r--r--printing/pputils.mli23
-rw-r--r--printing/ppvernac.ml6
-rw-r--r--printing/ppvernac.mli6
-rw-r--r--printing/prettyp.ml22
-rw-r--r--printing/prettyp.mli77
-rw-r--r--printing/printer.ml54
-rw-r--r--printing/printer.mli187
-rw-r--r--printing/printmod.mli7
-rw-r--r--proofs/clenv.mli2
-rw-r--r--proofs/goal.mli2
-rw-r--r--proofs/logic.ml50
-rw-r--r--proofs/logic.mli6
-rw-r--r--proofs/miscprint.mli20
-rw-r--r--proofs/proof.mli2
-rw-r--r--proofs/proof_bullet.mli2
-rw-r--r--proofs/proof_type.ml2
-rw-r--r--proofs/refine.mli2
-rw-r--r--proofs/refiner.ml2
-rw-r--r--proofs/refiner.mli8
-rw-r--r--proofs/tacmach.ml10
-rw-r--r--proofs/tacmach.mli7
-rw-r--r--stm/asyncTaskQueue.ml2
-rw-r--r--stm/stm.ml6
-rw-r--r--tactics/autorewrite.mli2
-rw-r--r--tactics/class_tactics.ml26
-rw-r--r--tactics/eauto.ml8
-rw-r--r--tactics/eqdecide.ml10
-rw-r--r--tactics/equality.ml102
-rw-r--r--tactics/equality.mli2
-rw-r--r--tactics/hints.mli21
-rw-r--r--tactics/hipattern.ml47
-rw-r--r--tactics/hipattern.mli18
-rw-r--r--tactics/ind_tables.mli2
-rw-r--r--tactics/tacticals.mli11
-rw-r--r--tactics/tactics.ml161
-rw-r--r--tactics/term_dnet.ml2
-rw-r--r--test-suite/Makefile35
-rw-r--r--test-suite/bugs/closed/1859.v20
-rw-r--r--test-suite/bugs/closed/2141.v1
-rw-r--r--test-suite/bugs/closed/3287.v9
-rw-r--r--test-suite/bugs/closed/3923.v1
-rw-r--r--test-suite/bugs/closed/4616.v3
-rw-r--r--test-suite/bugs/closed/4709.v18
-rw-r--r--test-suite/bugs/closed/4710.v3
-rw-r--r--test-suite/bugs/closed/4720.v4
-rw-r--r--test-suite/bugs/closed/5177.v1
-rw-r--r--test-suite/bugs/closed/5315.v10
-rw-r--r--test-suite/bugs/closed/5469.v3
-rw-r--r--test-suite/bugs/closed/5598.v8
-rw-r--r--test-suite/bugs/closed/5608.v33
-rw-r--r--test-suite/bugs/closed/5671.v7
-rw-r--r--test-suite/bugs/closed/HoTT_coq_032.v1
-rw-r--r--test-suite/coqchk/cumulativity.v2
-rw-r--r--test-suite/coqdoc/bug5648.html.out53
-rw-r--r--test-suite/coqdoc/bug5648.tex.out49
-rw-r--r--test-suite/coqdoc/bug5648.v19
-rw-r--r--test-suite/coqdoc/links.html.out206
-rw-r--r--test-suite/coqdoc/links.tex.out162
-rw-r--r--test-suite/output/Notations3.out13
-rw-r--r--test-suite/output/Notations3.v26
-rw-r--r--test-suite/output/UnclosedBlocks.out3
-rw-r--r--test-suite/output/UnclosedBlocks.v8
-rw-r--r--test-suite/success/cumulativity.v39
-rw-r--r--test-suite/success/extraction.v117
-rw-r--r--test-suite/success/extraction_dep.v5
-rw-r--r--test-suite/success/extraction_impl.v9
-rw-r--r--test-suite/success/forward.v11
-rw-r--r--test-suite/success/ltac.v11
-rw-r--r--test-suite/success/primitiveproj.v1
-rw-r--r--theories/Init/Notations.v3
-rw-r--r--tools/CoqMakefile.in12
-rwxr-xr-xtools/beautify-archive2
-rwxr-xr-xtools/check-translate2
-rw-r--r--tools/coq_makefile.ml6
-rw-r--r--tools/coqc.ml11
-rw-r--r--tools/coqdoc/index.ml2
-rw-r--r--tools/coqdoc/output.ml34
-rw-r--r--tools/coqmktop.ml2
-rw-r--r--toplevel/coqtop.ml20
-rw-r--r--toplevel/usage.ml5
-rw-r--r--toplevel/vernac.ml6
-rw-r--r--toplevel/vernac.mli4
-rw-r--r--vernac/explainErr.ml2
-rw-r--r--vernac/explainErr.mli6
-rw-r--r--vernac/himsg.ml17
-rw-r--r--vernac/himsg.mli21
-rw-r--r--vernac/metasyntax.ml311
-rw-r--r--vernac/metasyntax.mli2
-rw-r--r--vernac/mltop.mli6
-rw-r--r--vernac/obligations.ml2
-rw-r--r--vernac/obligations.mli5
-rw-r--r--vernac/topfmt.mli8
-rw-r--r--vernac/vernacentries.ml31
289 files changed, 9877 insertions, 2341 deletions
diff --git a/.bintray.json b/.bintray.json
new file mode 100644
index 000000000..fb9e55368
--- /dev/null
+++ b/.bintray.json
@@ -0,0 +1,20 @@
+{
+ "package": {
+ "name": "coq",
+ "repo": "coq",
+ "subject": "coq"
+ },
+
+ "version": {
+ "name": "8.8+alpha"
+ },
+
+ "files":
+ [
+ {"includePattern": "_build/(.*\\.dmg)", "uploadPattern": "$1",
+ "matrixParams": {
+ "override": 1 }
+ }
+ ],
+ "publish": true
+}
diff --git a/.gitignore b/.gitignore
index 71de7bb8d..36536ec96 100644
--- a/.gitignore
+++ b/.gitignore
@@ -84,6 +84,9 @@ test-suite/coq-makefile/*/subdir/done
test-suite/coq-makefile/merlin1/.merlin
test-suite/coq-makefile/plugin-reach-outside-API-and-fail/_CoqProject
test-suite/coq-makefile/plugin-reach-outside-API-and-succeed-by-bypassing-the-API/_CoqProject
+test-suite/coqdoc/Coqdoc.*
+test-suite/coqdoc/index.html
+test-suite/coqdoc/coqdoc.css
# documentation
diff --git a/.mailmap b/.mailmap
index 5846e07f8..f40455aa7 100644
--- a/.mailmap
+++ b/.mailmap
@@ -9,6 +9,7 @@
## If you're mentionned here and want to update your information,
## either amend this file and commit it, or contact the coqdev list
+Abhishek Anand <abhishek.anand.iitg@gmail.com> Abhishek Anand (@brixpro-home) <abhishek.anand.iitg@gmail.com>
Jim Apple <github.public@jbapple.com> jbapple <github.public@jbapple.com>
Bruno Barras <bruno.barras@inria.fr> barras <barras@85f007b7-540e-0410-9357-904b9bb8a0f7>
Bruno Barras <bruno.barras@inria.fr> barras-local <barras-local@85f007b7-540e-0410-9357-904b9bb8a0f7>
@@ -27,7 +28,7 @@ Judicaël Courant <courant@gforge> courant <courant@85f007b7-54
Pierre Courtieu <Pierre.Courtieu@cnam.fr> courtieu <courtieu@85f007b7-540e-0410-9357-904b9bb8a0f7>
David Delahaye <delahaye@gforge> delahaye <delahaye@85f007b7-540e-0410-9357-904b9bb8a0f7>
Maxime Dénès <mail@maximedenes.fr> mdenes <mdenes@85f007b7-540e-0410-9357-904b9bb8a0f7>
-Daniel de Rauglaudre <daniel.de_rauglaudre@inria.fr> ddr <ddr@85f007b7-540e-0410-9357-904b9bb8a0f7>
+Maxime Dénès <mail@maximedenes.fr> Maxime Denes <maximedenes@gillespie.inria.fr>
Olivier Desmettre <desmettr@gforge> desmettr <desmettr@85f007b7-540e-0410-9357-904b9bb8a0f7>
Damien Doligez <doligez@gforge> doligez <doligez@85f007b7-540e-0410-9357-904b9bb8a0f7>
Jean-Christophe Filliâtre <Jean-Christophe.Filliatre@lri.fr> filliatr <filliatr@85f007b7-540e-0410-9357-904b9bb8a0f7>
@@ -36,7 +37,9 @@ Julien Forest <julien.forest@ensiie.fr> jforest <jforest@85f007b7-540
Julien Forest <julien.forest@ensiie.fr> forest <jforest@mourvedre.ensiie.fr>
Julien Forest <julien.forest@ensiie.fr> jforest <jforest@thune>
Julien Forest <julien.forest@ensiie.fr> jforest <jforest@daneel.lan.home>
+Julien Forest <julien.forest@ensiie.fr> Julien Forest <forest@ensiie.fr>
Emilio Jesus Gallego Arias <e+git@x80.org> Emilio Jesús Gallego Arias <e+git@x80.org>
+Gaëtan Gilbert <gaetan.gilbert@ens-lyon.fr> Gaetan Gilbert <gaetan.gilbert@ens-lyon.fr>
Stéphane Glondu <steph@glondu.net> glondu <glondu@85f007b7-540e-0410-9357-904b9bb8a0f7>
Stéphane Glondu <steph@glondu.net> Stephane Glondu <steph@glondu.net>
Benjamin Grégoire <benjamin.gregoire@inria.fr> Benjamin Gregoire <Benjamin.Gregoire@inria.fr>
@@ -51,9 +54,12 @@ Tom Hutchinson <thutchin@gforge> thutchin <thutchin@85f007b7-5
Cezary Kaliszyk <cek@gforge> cek <cek@85f007b7-540e-0410-9357-904b9bb8a0f7>
Florent Kirchner <fkirchne@gforge> fkirchne <fkirchne@85f007b7-540e-0410-9357-904b9bb8a0f7>
Florent Kirchner <fkirchne@gforge> kirchner <kirchner@85f007b7-540e-0410-9357-904b9bb8a0f7>
-Matej Kosik <matej.kosik@inria.fr> Matej Kosik <m4tej.kosik@gmail.com>
+Matej Košík <matej.kosik@inria.fr> Matej Kosik <m4tej.kosik@gmail.com>
+Matej Košík <matej.kosik@inria.fr> Matej Kosik <matej.kosik@inria.fr>
Marc Lasson <marc.lasson@gmail.com> mlasson <marc.lasson@gmail.com>
+William Lawvere <mundungus.corleone@gmail.com> william-lawvere <mundungus.corleone@gmail.com>
Pierre Letouzey <pierre.letouzey@inria.fr> letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7>
+Pierre Letouzey <pierre.letouzey@inria.fr> letouzey <pierre.letouzey@inria.fr>
Assia Mahboubi <assia.mahboubi@inria.fr> amahboub <amahboub@85f007b7-540e-0410-9357-904b9bb8a0f7>
Evgeny Makarov <emakarov@gforge> emakarov <emakarov@85f007b7-540e-0410-9357-904b9bb8a0f7>
Gregory Malecha <gmalecha@eecs.harvard.edu> Gregory Malecha <gmalecha@cs.harvard.edu>
@@ -68,15 +74,19 @@ Julien Narboux <jnarboux@gforge> jnarboux <jnarboux@85f007b7-5
Julien Narboux <jnarboux@gforge> narboux <narboux@85f007b7-540e-0410-9357-904b9bb8a0f7>
Jean-Marc Notin <notin@gforge> notin,no-port-forwarding,no-agent-forwarding,no-X11-forwarding,no-pty <notin,no-port-forwarding,no-agent-forwarding,no-X11-forwarding,no-pty@85f007b7-540e-0410-9357-904b9bb8a0f7>
Jean-Marc Notin <notin@gforge> notin <notin@85f007b7-540e-0410-9357-904b9bb8a0f7>
-Russel O'Connor <roconnor@gforge> roconnor <roconnor@85f007b7-540e-0410-9357-904b9bb8a0f7>
+Russell O'Connor <roconnor@blockstream.io> roconnor <roconnor@85f007b7-540e-0410-9357-904b9bb8a0f7>
+Russell O'Connor <roconnor@blockstream.io> roconnor-blockstream <roconnor@blockstream.com>
Christine Paulin <cpaulin@gforge> cpaulin <cpaulin@85f007b7-540e-0410-9357-904b9bb8a0f7>
Christine Paulin <cpaulin@gforge> mohring <mohring@85f007b7-540e-0410-9357-904b9bb8a0f7>
Pierre-Marie Pédrot <pierre-marie.pedrot@inria.fr> ppedrot <ppedrot@85f007b7-540e-0410-9357-904b9bb8a0f7>
Loïc Pottier <pottier@gforge> pottier <pottier@85f007b7-540e-0410-9357-904b9bb8a0f7>
Matthias Puech <puech@gforge> puech <puech@85f007b7-540e-0410-9357-904b9bb8a0f7>
-Yann Régis-Gianas <yrg@pps.univ-paris-diderot.fr> regisgia <regisgia@85f007b7-540e-0410-9357-904b9bb8a0f7>
+Lars Rasmusson <lars.rasmusson@sics.se> larsr <Lars.Rasmusson@sics.se>
+Daniel de Rauglaudre <daniel.de_rauglaudre@inria.fr> ddr <ddr@85f007b7-540e-0410-9357-904b9bb8a0f7>
Daniel de Rauglaudre <daniel.de_rauglaudre@inria.fr> Daniel de Rauglaudre <daniel.de_rauglaudre@inria.fr>
Daniel de Rauglaudre <daniel.de_rauglaudre@inria.fr> Daniel De Rauglaudre <ddr@gforge>
+Yann Régis-Gianas <yrg@pps.univ-paris-diderot.fr> regisgia <regisgia@85f007b7-540e-0410-9357-904b9bb8a0f7>
+Yann Régis-Gianas <yrg@pps.univ-paris-diderot.fr> Regis-Gianas <yrg@pps.univ-paris-diderot.fr>
Clément Renard <clrenard@gforge> clrenard <clrenard@85f007b7-540e-0410-9357-904b9bb8a0f7>
Claudio Sacerdoti Coen <sacerdot@gforge> sacerdot <sacerdot@85f007b7-540e-0410-9357-904b9bb8a0f7>
Vincent Siles <vsiles@gforge> vsiles <vsiles@85f007b7-540e-0410-9357-904b9bb8a0f7>
diff --git a/.travis.yml b/.travis.yml
index e40568995..9300505f3 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -32,38 +32,39 @@ env:
- COMPILER="system"
- CAMLP5_VER="6.14"
- NATIVE_COMP="yes"
+ - COQ_DEST="-local"
# Main test suites
matrix:
- TEST_TARGET="test-suite" COMPILER="4.02.3+32bit"
- TEST_TARGET="validate" TW="travis_wait"
- TEST_TARGET="validate" COMPILER="4.02.3+32bit" TW="travis_wait"
- - TEST_TARGET="ci-bignums"
- - TEST_TARGET="ci-color"
- - TEST_TARGET="ci-compcert"
+ - TEST_TARGET="ci-bignums TIMED=1"
+ - TEST_TARGET="ci-color TIMED=1"
+ - TEST_TARGET="ci-compcert TIMED=1"
- TEST_TARGET="ci-coq-dpdgraph" EXTRA_OPAM="ocamlgraph"
- - TEST_TARGET="ci-coquelicot"
- - TEST_TARGET="ci-geocoq"
- - TEST_TARGET="ci-fiat-crypto"
- - TEST_TARGET="ci-fiat-parsers"
- - TEST_TARGET="ci-flocq"
- - TEST_TARGET="ci-formal-topology"
- - TEST_TARGET="ci-hott"
- - TEST_TARGET="ci-iris-coq"
- - TEST_TARGET="ci-math-classes"
- - TEST_TARGET="ci-math-comp"
- - TEST_TARGET="ci-sf"
- - TEST_TARGET="ci-unimath"
- - TEST_TARGET="ci-vst"
+ - TEST_TARGET="ci-coquelicot TIMED=1"
+ - TEST_TARGET="ci-geocoq TIMED=1"
+ - TEST_TARGET="ci-fiat-crypto TIMED=1"
+ - TEST_TARGET="ci-fiat-parsers TIMED=1"
+ - TEST_TARGET="ci-flocq TIMED=1"
+ - TEST_TARGET="ci-formal-topology TIMED=1"
+ - TEST_TARGET="ci-hott TIMED=1"
+ - TEST_TARGET="ci-iris-coq TIMED=1"
+ - TEST_TARGET="ci-math-classes TIMED=1"
+ - TEST_TARGET="ci-math-comp TIMED=1"
+ - TEST_TARGET="ci-sf TIMED=1"
+ - TEST_TARGET="ci-unimath TIMED=1"
+ - TEST_TARGET="ci-vst TIMED=1"
# Not ready yet for 8.7
- # - TEST_TARGET="ci-cpdt"
- # - TEST_TARGET="ci-metacoq"
- # - TEST_TARGET="ci-tlc"
+ # - TEST_TARGET="ci-cpdt TIMED=1"
+ # - TEST_TARGET="ci-metacoq TIMED=1"
+ # - TEST_TARGET="ci-tlc TIMED=1"
matrix:
allow_failures:
- env: TEST_TARGET="ci-coq-dpdgraph" EXTRA_OPAM="ocamlgraph"
- - env: TEST_TARGET="ci-geocoq"
+ - env: TEST_TARGET="ci-geocoq TIMED=1"
include:
# Full Coq test-suite with two compilers
@@ -139,11 +140,46 @@ matrix:
env:
- TEST_TARGET="test-suite"
- COMPILER="4.02.3"
+ - CAMLP5_VER="6.17"
- NATIVE_COMP="no"
+ - COQ_DEST="-local"
before_install:
- brew update
- - brew install opam
- - brew install gnu-time
+ - brew install opam gnu-time
+
+ - os: osx
+ env:
+ - TEST_TARGET=""
+ - COMPILER="4.02.3"
+ - CAMLP5_VER="6.17"
+ - NATIVE_COMP="no"
+ - COQ_DEST="-prefix ${PWD}/_install"
+ - EXTRA_CONF="-coqide opt -warn-error"
+ - EXTRA_OPAM="lablgtk-extras"
+ before_install:
+ - brew update
+ - brew install opam gnu-time gtk+ expat gtksourceview libxml2 gdk-pixbuf python3
+ - pip3 install macpack
+ before_deploy:
+ - dev/build/osx/make-macos-dmg.sh
+ deploy:
+ provider: bintray
+ user: maximedenes
+ file: .bintray.json
+ key:
+ secure: "gUvXWwWR0gicDqsKOnBfe45taToSFied6gN8tCa5IOtl6E6gFoHoPZ83ZWXQsZP50oMDFS5eji0VQAFGEbOsGrTZaD9Y9Jnu34NND78SWL1tsJ6nHO3aCAoMpB0N3+oRuF6S+9HStU6KXWqgj+GeU4vZ4TOlG01RGctJa6U3vII="
+ skip_cleanup: true
+ on:
+ all_branches: true
+ deploy:
+ provider: releases
+ api_key:
+ secure: "Z/ewvydCLXEhlBBtQGYm2nZ8o+2RP+MwA5uEDuu6mEpZttUZAYaoHivChxADLXz8LNKvUloIeBeIL/PrLk6QnhSur/s2iEYHssrnl99SkAPtoWggyfsdacuKLMkpLoZGOBIEYKPuXuEZyqvugSUO42rSya1zdjcnXc4l+E/bXMc="
+ file: _build/*.dmg
+ skip_cleanup: true
+ on:
+ tags: true
+ repo: coq/coq
before_install:
- if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then echo "Tested commit (followed by parent commits):"; git log -1; for commit in `git log -1 --format="%P"`; do echo; git log -1 $commit; done; fi
@@ -159,7 +195,7 @@ script:
- set -e
- echo 'Configuring Coq...' && echo -en 'travis_fold:start:coq.config\\r'
-- ./configure -local -native-compiler ${NATIVE_COMP} ${EXTRA_CONF}
+- ./configure ${COQ_DEST} -native-compiler ${NATIVE_COMP} ${EXTRA_CONF}
- echo -en 'travis_fold:end:coq.config\\r'
- echo 'Building Coq...' && echo -en 'travis_fold:start:coq.build\\r'
diff --git a/API/API.ml b/API/API.ml
index c952e123d..c4bcef6f6 100644
--- a/API/API.ml
+++ b/API/API.ml
@@ -43,7 +43,7 @@ module Cbytecodes = Cbytecodes
(* module Copcodes *)
module Cemitcodes = Cemitcodes
(* module Nativevalues *)
-(* module Primitives *)
+(* module CPrimitives *)
module Opaqueproof = Opaqueproof
module Declareops = Declareops
module Retroknowledge = Retroknowledge
@@ -169,7 +169,6 @@ module Stdarg = Stdarg
module Genintern = Genintern
module Constrexpr_ops = Constrexpr_ops
module Notation_ops = Notation_ops
-module Ppextend = Ppextend
module Notation = Notation
module Dumpglob = Dumpglob
(* module Syntax_def *)
diff --git a/API/API.mli b/API/API.mli
index 19726b52f..e7a434634 100644
--- a/API/API.mli
+++ b/API/API.mli
@@ -47,7 +47,7 @@ sig
val of_string : string -> t
val of_string_soft : string -> t
val to_string : t -> string
- val print : t -> Pp.std_ppcmds
+ val print : t -> Pp.t
module Set : Set.S with type elt = t
module Map : Map.ExtS with type key = t and module Set := Set
@@ -67,7 +67,7 @@ sig
val equal : t -> t -> bool
val hash : t -> int
val hcons : t -> t
- val print : t -> Pp.std_ppcmds
+ val print : t -> Pp.t
end
type name = Name.t =
@@ -128,7 +128,7 @@ sig
val compare : t -> t -> int
val label : t -> Label.t
val repr : t -> ModPath.t * DirPath.t * Label.t
- val print : t -> Pp.std_ppcmds
+ val print : t -> Pp.t
val to_string : t -> string
end
@@ -159,7 +159,7 @@ sig
val modpath : t -> ModPath.t
val label : t -> Label.t
val user : t -> KerName.t
- val print : t -> Pp.std_ppcmds
+ val print : t -> Pp.t
end
module Projection :
@@ -169,6 +169,8 @@ sig
val map : (Constant.t -> Constant.t) -> t -> t
val constant : t -> Constant.t
val equal : t -> t -> bool
+ val unfolded : t -> bool
+ val unfold : t -> t
end
type evaluable_global_reference =
@@ -212,7 +214,7 @@ sig
val var_full_transparent_state : transparent_state
val cst_full_transparent_state : transparent_state
- val pr_kn : KerName.t -> Pp.std_ppcmds
+ val pr_kn : KerName.t -> Pp.t
[@@ocaml.deprecated "alias of API.Names.KerName.print"]
val eq_constant : Constant.t -> Constant.t -> bool
@@ -297,11 +299,11 @@ sig
val make_con : ModPath.t -> DirPath.t -> Label.t -> Constant.t
[@@ocaml.deprecated "alias of API.Names.Constant.make3"]
- val debug_pr_con : Constant.t -> Pp.std_ppcmds
+ val debug_pr_con : Constant.t -> Pp.t
- val debug_pr_mind : MutInd.t -> Pp.std_ppcmds
+ val debug_pr_mind : MutInd.t -> Pp.t
- val pr_con : Constant.t -> Pp.std_ppcmds
+ val pr_con : Constant.t -> Pp.t
val string_of_con : Constant.t -> string
@@ -323,7 +325,7 @@ sig
sig
type t
val set : t
- val pr : t -> Pp.std_ppcmds
+ val pr : t -> Pp.t
end
type universe_level = Level.t
@@ -331,13 +333,13 @@ sig
module LSet :
sig
include CSig.SetS with type elt = universe_level
- val pr : (Level.t -> Pp.std_ppcmds) -> t -> Pp.std_ppcmds
+ val pr : (Level.t -> Pp.t) -> t -> Pp.t
end
module Universe :
sig
type t
- val pr : t -> Pp.std_ppcmds
+ val pr : t -> Pp.t
end
type universe = Universe.t
@@ -348,7 +350,7 @@ sig
val empty : t
val of_array : Level.t array -> t
val to_array : t -> Level.t array
- val pr : (Level.t -> Pp.std_ppcmds) -> t -> Pp.std_ppcmds
+ val pr : (Level.t -> Pp.t) -> t -> Pp.t
end
type 'a puniverses = 'a * Instance.t
@@ -418,7 +420,7 @@ sig
val union : 'a t -> 'a t -> 'a t
val diff : 'a t -> 'a t -> 'a t
val subst_union : 'a option t -> 'a option t -> 'a option t
- val pr : ('a -> Pp.std_ppcmds) -> 'a t -> Pp.std_ppcmds
+ val pr : ('a -> Pp.t) -> 'a t -> Pp.t
end
type 'a universe_map = 'a LMap.t
@@ -426,18 +428,18 @@ sig
type universe_level_subst = universe_level universe_map
val enforce_leq : Universe.t constraint_function
- val pr_uni : Universe.t -> Pp.std_ppcmds
- val pr_universe_context : (Level.t -> Pp.std_ppcmds) -> UContext.t -> Pp.std_ppcmds
- val pr_universe_context_set : (Level.t -> Pp.std_ppcmds) -> ContextSet.t -> Pp.std_ppcmds
- val pr_universe_subst : universe_subst -> Pp.std_ppcmds
- val pr_universe_level_subst : universe_level_subst -> Pp.std_ppcmds
- val pr_constraints : (Level.t -> Pp.std_ppcmds) -> Constraint.t -> Pp.std_ppcmds
+ val pr_uni : Universe.t -> Pp.t
+ val pr_universe_context : (Level.t -> Pp.t) -> UContext.t -> Pp.t
+ val pr_universe_context_set : (Level.t -> Pp.t) -> ContextSet.t -> Pp.t
+ val pr_universe_subst : universe_subst -> Pp.t
+ val pr_universe_level_subst : universe_level_subst -> Pp.t
+ val pr_constraints : (Level.t -> Pp.t) -> Constraint.t -> Pp.t
end
module UGraph :
sig
type t
- val pr_universes : (Univ.Level.t -> Pp.std_ppcmds) -> t -> Pp.std_ppcmds
+ val pr_universes : (Univ.Level.t -> Pp.t) -> t -> Pp.t
end
module Esubst :
@@ -1033,8 +1035,8 @@ sig
val subst_mps : substitution -> Constr.t -> Constr.t
val subst_constant : substitution -> Names.Constant.t -> Names.Constant.t
val subst_ind : substitution -> Names.inductive -> Names.inductive
- val debug_pr_subst : substitution -> Pp.std_ppcmds
- val debug_pr_delta : delta_resolver -> Pp.std_ppcmds
+ val debug_pr_subst : substitution -> Pp.t
+ val debug_pr_delta : delta_resolver -> Pp.t
end
module Opaqueproof :
@@ -1749,10 +1751,10 @@ module Nameops :
sig
val atompart_of_id : Names.Id.t -> string
- val pr_id : Names.Id.t -> Pp.std_ppcmds
+ val pr_id : Names.Id.t -> Pp.t
[@@ocaml.deprecated "alias of API.Names.Id.print"]
- val pr_name : Names.Name.t -> Pp.std_ppcmds
+ val pr_name : Names.Name.t -> Pp.t
[@@ocaml.deprecated "alias of API.Names.Name.print"]
val name_fold : (Names.Id.t -> 'a -> 'a) -> Names.Name.t -> 'a -> 'a
@@ -1761,7 +1763,7 @@ sig
val increment_subscript : Names.Id.t -> Names.Id.t
val make_ident : string -> int option -> Names.Id.t
val out_name : Names.Name.t -> Names.Id.t
- val pr_lab : Names.Label.t -> Pp.std_ppcmds
+ val pr_lab : Names.Label.t -> Pp.t
module Name :
sig
include module type of struct include Names.Name end
@@ -1777,7 +1779,7 @@ sig
open Names
type full_path
- val pr_path : full_path -> Pp.std_ppcmds
+ val pr_path : full_path -> Pp.t
val make_path : Names.DirPath.t -> Names.Id.t -> full_path
val eq_full_path : full_path -> full_path -> bool
val dirpath : full_path -> Names.DirPath.t
@@ -1787,7 +1789,7 @@ sig
val make_qualid : Names.DirPath.t -> Names.Id.t -> qualid
val qualid_eq : qualid -> qualid -> bool
val repr_qualid : qualid -> Names.DirPath.t * Names.Id.t
- val pr_qualid : qualid -> Pp.std_ppcmds
+ val pr_qualid : qualid -> Pp.t
val string_of_qualid : qualid -> string
val qualid_of_string : string -> qualid
val qualid_of_path : full_path -> qualid
@@ -1799,12 +1801,12 @@ sig
| Ident of Names.Id.t Loc.located
val loc_of_reference : reference -> Loc.t option
val qualid_of_reference : reference -> qualid Loc.located
- val pr_reference : reference -> Pp.std_ppcmds
+ val pr_reference : reference -> Pp.t
val is_dirpath_prefix_of : Names.DirPath.t -> Names.DirPath.t -> bool
val split_dirpath : Names.DirPath.t -> Names.DirPath.t * Names.Id.t
val dirpath_of_string : string -> Names.DirPath.t
- val pr_dirpath : Names.DirPath.t -> Pp.std_ppcmds
+ val pr_dirpath : Names.DirPath.t -> Pp.t
val string_of_path : full_path -> string
val basename : full_path -> Names.Id.t
@@ -1929,7 +1931,7 @@ sig
val locate_extended : Libnames.qualid -> Globnames.extended_global_reference
val full_name_module : Libnames.qualid -> Names.DirPath.t
val locate_tactic : Libnames.qualid -> Names.KerName.t
- val pr_global_env : Names.Id.Set.t -> Globnames.global_reference -> Pp.std_ppcmds
+ val pr_global_env : Names.Id.Set.t -> Globnames.global_reference -> Pp.t
val shortest_qualid_of_tactic : Names.KerName.t -> Libnames.qualid
val basename_of_global : Globnames.global_reference -> Names.Id.t
@@ -2052,7 +2054,7 @@ sig
type key
val constr_key : ('a -> ('a, 't, 'u, 'i) Constr.kind_of_term) -> 'a -> key option
val declare_equiv_keys : key -> key -> unit
- val pr_keys : (Globnames.global_reference -> Pp.std_ppcmds) -> Pp.std_ppcmds
+ val pr_keys : (Globnames.global_reference -> Pp.t) -> Pp.t
end
module Coqlib :
@@ -2127,14 +2129,14 @@ sig
val constr_of_global : Globnames.global_reference -> Constr.t
val new_univ_level : Names.DirPath.t -> Univ.Level.t
val new_sort_in_family : Sorts.family -> Sorts.t
- val pr_with_global_universes : Univ.Level.t -> Pp.std_ppcmds
- val pr_universe_opt_subst : universe_opt_subst -> Pp.std_ppcmds
+ val pr_with_global_universes : Univ.Level.t -> Pp.t
+ val pr_universe_opt_subst : universe_opt_subst -> Pp.t
type universe_constraint
module Constraints :
sig
type t
- val pr : t -> Pp.std_ppcmds
+ val pr : t -> Pp.t
end
type universe_constraints = Constraints.t
@@ -2752,9 +2754,9 @@ sig
val it_mkLambda_or_LetIn : Constr.t -> Context.Rel.t -> Constr.t
val local_occur_var : Evd.evar_map -> Names.Id.t -> EConstr.constr -> bool
val occur_var : Environ.env -> Evd.evar_map -> Names.Id.t -> EConstr.constr -> bool
- val pr_evar_info : Evd.evar_info -> Pp.std_ppcmds
+ val pr_evar_info : Evd.evar_info -> Pp.t
- val print_constr : EConstr.constr -> Pp.std_ppcmds
+ val print_constr : EConstr.constr -> Pp.t
(** [dependent m t] tests whether [m] is a subterm of [t] *)
val dependent : Evd.evar_map -> EConstr.constr -> EConstr.constr -> bool
@@ -2798,8 +2800,8 @@ sig
val ids_of_named_context : ('c, 't) Context.Named.pt -> Names.Id.t list
val ids_of_context : Environ.env -> Names.Id.t list
val global_of_constr : Evd.evar_map -> EConstr.constr -> Globnames.global_reference * EConstr.EInstance.t
- val print_named_context : Environ.env -> Pp.std_ppcmds
- val print_constr_env : Environ.env -> Evd.evar_map -> EConstr.constr -> Pp.std_ppcmds
+ val print_named_context : Environ.env -> Pp.t
+ val print_constr_env : Environ.env -> Evd.evar_map -> EConstr.constr -> Pp.t
val clear_named_body : Names.Id.t -> Environ.env -> Environ.env
val is_Prop : Evd.evar_map -> EConstr.constr -> bool
val is_global : Evd.evar_map -> Globnames.global_reference -> EConstr.constr -> bool
@@ -2820,14 +2822,14 @@ sig
val replace_term : Evd.evar_map -> EConstr.constr -> EConstr.constr -> EConstr.constr -> EConstr.constr
val map_named_decl : ('a -> 'b) -> ('a, 'a) Context.Named.Declaration.pt -> ('b, 'b) Context.Named.Declaration.pt
val map_rel_decl : ('a -> 'b) -> ('a, 'a) Context.Rel.Declaration.pt -> ('b, 'b) Context.Rel.Declaration.pt
- val pr_metaset : Evd.Metaset.t -> Pp.std_ppcmds
- val pr_evar_map : ?with_univs:bool -> int option -> Evd.evar_map -> Pp.std_ppcmds
- val pr_evar_universe_context : UState.t -> Pp.std_ppcmds
+ val pr_metaset : Evd.Metaset.t -> Pp.t
+ val pr_evar_map : ?with_univs:bool -> int option -> Evd.evar_map -> Pp.t
+ val pr_evar_universe_context : UState.t -> Pp.t
end
module Proofview_monad :
sig
- type lazy_msg = unit -> Pp.std_ppcmds
+ type lazy_msg = unit -> Pp.t
module Info :
sig
type tree
@@ -2903,10 +2905,10 @@ sig
val ( >> ) : unit t -> 'a t -> 'a t
val ( >>= ) : 'a t -> ('a -> 'b t) -> 'b t
val print_char : char -> unit t
- val print_debug : Pp.std_ppcmds -> unit t
- val print_warning : Pp.std_ppcmds -> unit t
- val print_notice : Pp.std_ppcmds -> unit t
- val print_info : Pp.std_ppcmds -> unit t
+ val print_debug : Pp.t -> unit t
+ val print_warning : Pp.t -> unit t
+ val print_notice : Pp.t -> unit t
+ val print_info : Pp.t -> unit t
val run : 'a t -> 'a
type 'a ref
val ref : 'a -> 'a ref t
@@ -3036,7 +3038,7 @@ sig
| Opt : 'a tag -> 'a option tag
| Pair : 'a tag * 'b tag -> ('a * 'b) tag
val create : string -> 'a typ
- val pr : 'a typ -> Pp.std_ppcmds
+ val pr : 'a typ -> Pp.t
val eq : 'a typ -> 'b typ -> ('a, 'b) CSig.eq option
val typ_list : t list typ
val typ_opt : t option typ
@@ -3182,6 +3184,10 @@ sig
| NCast of notation_constr * notation_constr Misctypes.cast_type
type interpretation = (Names.Id.t * (subscopes * notation_var_instance_type)) list *
notation_constr
+ type precedence = int
+ type parenRelation =
+ | L | E | Any | Prec of precedence
+ type tolerability = precedence * parenRelation
end
module Tactypes :
@@ -3289,16 +3295,16 @@ sig
val nf_evar : Evd.evar_map -> EConstr.constr -> EConstr.constr
val nf_meta : Evd.evar_map -> EConstr.constr -> EConstr.constr
val hnf_prod_appvect : Environ.env -> Evd.evar_map -> EConstr.constr -> EConstr.constr array -> EConstr.constr
- val pr_state : state -> Pp.std_ppcmds
+ val pr_state : state -> Pp.t
module Stack :
sig
type 'a t
- val pr : ('a -> Pp.std_ppcmds) -> 'a t -> Pp.std_ppcmds
+ val pr : ('a -> Pp.t) -> 'a t -> Pp.t
end
module Cst_stack :
sig
type t
- val pr : t -> Pp.std_ppcmds
+ val pr : t -> Pp.t
end
end
@@ -3780,6 +3786,12 @@ sig
| DefaultInline
| InlineAt of int
+ type cumulative_inductive_parsing_flag =
+ | GlobalCumulativity
+ | GlobalNonCumulativity
+ | LocalCumulativity
+ | LocalNonCumulativity
+
type vernac_expr =
| VernacLoad of verbose_flag * string
| VernacTime of vernac_expr Loc.located
@@ -3804,7 +3816,7 @@ sig
| VernacExactProof of Constrexpr.constr_expr
| VernacAssumption of (Decl_kinds.locality option * Decl_kinds.assumption_object_kind) *
inline * (plident list * Constrexpr.constr_expr) with_coercion list
- | VernacInductive of Decl_kinds.cumulative_inductive_flag * Decl_kinds.private_flag * inductive_flag * (inductive_expr * decl_notation list) list
+ | VernacInductive of cumulative_inductive_parsing_flag * Decl_kinds.private_flag * inductive_flag * (inductive_expr * decl_notation list) list
| VernacFixpoint of
Decl_kinds.locality option * (fixpoint_expr * decl_notation list) list
| VernacCoFixpoint of
@@ -3963,7 +3975,7 @@ sig
EConstr.types * inheritance_path
val get_coercion_value : coe_index -> Constr.t
val coercions : unit -> coe_index list
- val pr_cl_index : cl_index -> Pp.std_ppcmds
+ val pr_cl_index : cl_index -> Pp.t
end
module Detyping :
@@ -4171,16 +4183,6 @@ sig
'a -> Notation_term.notation_constr -> Glob_term.glob_constr
end
-module Ppextend :
-sig
-
- type precedence = int
- type parenRelation =
- | L | E | Any | Prec of precedence
- type tolerability = precedence * parenRelation
-
-end
-
module Notation :
sig
type cases_pattern_status = bool
@@ -4196,11 +4198,11 @@ sig
Bigint.bigint prim_token_interpreter -> Bigint.bigint prim_token_uninterpreter -> unit
val interp_notation_as_global_reference : ?loc:Loc.t -> (Globnames.global_reference -> bool) ->
Constrexpr.notation -> delimiters option -> Globnames.global_reference
- val locate_notation : (Glob_term.glob_constr -> Pp.std_ppcmds) -> Constrexpr.notation ->
- Notation_term.scope_name option -> Pp.std_ppcmds
+ val locate_notation : (Glob_term.glob_constr -> Pp.t) -> Constrexpr.notation ->
+ Notation_term.scope_name option -> Pp.t
val find_delimiters_scope : ?loc:Loc.t -> delimiters -> Notation_term.scope_name
- val pr_scope : (Glob_term.glob_constr -> Pp.std_ppcmds) -> Notation_term.scope_name -> Pp.std_ppcmds
- val pr_scopes : (Glob_term.glob_constr -> Pp.std_ppcmds) -> Pp.std_ppcmds
+ val pr_scope : (Glob_term.glob_constr -> Pp.t) -> Notation_term.scope_name -> Pp.t
+ val pr_scopes : (Glob_term.glob_constr -> Pp.t) -> Pp.t
val interp_notation : ?loc:Loc.t -> Constrexpr.notation -> local_scopes ->
Notation_term.interpretation * (notation_location * Notation_term.scope_name option)
val uninterp_prim_token : Glob_term.glob_constr -> Notation_term.scope_name * Constrexpr.prim_token
@@ -4281,10 +4283,10 @@ module Constrextern :
sig
val extern_glob_constr : Names.Id.Set.t -> Glob_term.glob_constr -> Constrexpr.constr_expr
val extern_glob_type : Names.Id.Set.t -> Glob_term.glob_constr -> Constrexpr.constr_expr
- val extern_constr : ?lax:bool -> bool -> Environ.env -> Evd.evar_map -> Constr.t -> Constrexpr.constr_expr
+ val extern_constr : ?lax:bool -> bool -> Environ.env -> Evd.evar_map -> EConstr.t -> Constrexpr.constr_expr
val without_symbols : ('a -> 'b) -> 'a -> 'b
val print_universes : bool ref
- val extern_type : bool -> Environ.env -> Evd.evar_map -> Term.types -> Constrexpr.constr_expr
+ val extern_type : bool -> Environ.env -> Evd.evar_map -> EConstr.t -> Constrexpr.constr_expr
val with_universes : ('a -> 'b) -> 'a -> 'b
val set_extern_reference :
(?loc:Loc.t -> Names.Id.Set.t -> Globnames.global_reference -> Libnames.reference) -> unit
@@ -4333,19 +4335,19 @@ end
module Miscprint :
sig
val pr_or_and_intro_pattern :
- ('a -> Pp.std_ppcmds) -> 'a Misctypes.or_and_intro_pattern_expr -> Pp.std_ppcmds
- val pr_intro_pattern_naming : Misctypes.intro_pattern_naming_expr -> Pp.std_ppcmds
+ ('a -> Pp.t) -> 'a Misctypes.or_and_intro_pattern_expr -> Pp.t
+ val pr_intro_pattern_naming : Misctypes.intro_pattern_naming_expr -> Pp.t
val pr_intro_pattern :
- ('a -> Pp.std_ppcmds) -> 'a Misctypes.intro_pattern_expr Loc.located -> Pp.std_ppcmds
+ ('a -> Pp.t) -> 'a Misctypes.intro_pattern_expr Loc.located -> Pp.t
val pr_bindings :
- ('a -> Pp.std_ppcmds) ->
- ('a -> Pp.std_ppcmds) -> 'a Misctypes.bindings -> Pp.std_ppcmds
+ ('a -> Pp.t) ->
+ ('a -> Pp.t) -> 'a Misctypes.bindings -> Pp.t
val pr_bindings_no_with :
- ('a -> Pp.std_ppcmds) ->
- ('a -> Pp.std_ppcmds) -> 'a Misctypes.bindings -> Pp.std_ppcmds
+ ('a -> Pp.t) ->
+ ('a -> Pp.t) -> 'a Misctypes.bindings -> Pp.t
val pr_with_bindings :
- ('a -> Pp.std_ppcmds) ->
- ('a -> Pp.std_ppcmds) -> 'a * 'a Misctypes.bindings -> Pp.std_ppcmds
+ ('a -> Pp.t) ->
+ ('a -> Pp.t) -> 'a * 'a Misctypes.bindings -> Pp.t
end
(* All items in the Goal modules are deprecated. *)
@@ -4353,7 +4355,7 @@ module Goal :
sig
type goal = Evar.t
- val pr_goal : goal -> Pp.std_ppcmds
+ val pr_goal : goal -> Pp.t
module V82 :
sig
@@ -4430,7 +4432,7 @@ sig
unit Proofview.tactic -> proof -> proof * (bool * Proofview_monad.Info.tree)
val unshelve : proof -> proof
val maximal_unfocus : 'a focus_kind -> proof -> proof
- val pr_proof : proof -> Pp.std_ppcmds
+ val pr_proof : proof -> Pp.t
module V82 :
sig
val grab_evars : proof -> proof
@@ -4509,13 +4511,13 @@ sig
val repackage : Evd.evar_map ref -> 'a -> 'a Evd.sigma
val tclSHOWHYPS : Proof_type.tactic -> Proof_type.tactic
- exception FailError of int * Pp.std_ppcmds Lazy.t
+ exception FailError of int * Pp.t Lazy.t
val tclEVARS : Evd.evar_map -> Proof_type.tactic
val tclMAP : ('a -> Proof_type.tactic) -> 'a list -> Proof_type.tactic
val tclREPEAT : Proof_type.tactic -> Proof_type.tactic
val tclORELSE : Proof_type.tactic -> Proof_type.tactic -> Proof_type.tactic
- val tclFAIL : int -> Pp.std_ppcmds -> Proof_type.tactic
+ val tclFAIL : int -> Pp.t -> Proof_type.tactic
val tclIDTAC : Proof_type.tactic
val tclTHEN : Proof_type.tactic -> Proof_type.tactic -> Proof_type.tactic
val tclTHENLIST : Proof_type.tactic list -> Proof_type.tactic
@@ -4574,7 +4576,7 @@ sig
val pf_hyps_types : Goal.goal Evd.sigma -> (Names.Id.t * EConstr.types) list
- val pr_gls : Goal.goal Evd.sigma -> Pp.std_ppcmds
+ val pr_gls : Goal.goal Evd.sigma -> Pp.t
val pf_nf_betaiota : Goal.goal Evd.sigma -> EConstr.constr -> EConstr.constr
@@ -4648,7 +4650,7 @@ sig
val solve_evar_clause : Environ.env -> Evd.evar_map -> bool -> clause -> EConstr.constr Misctypes.bindings ->
Evd.evar_map
type clausenv
- val pr_clenv : clausenv -> Pp.std_ppcmds
+ val pr_clenv : clausenv -> Pp.t
end
(************************************************************************)
@@ -4843,7 +4845,7 @@ end
module Genprint :
sig
- type 'a printer = 'a -> Pp.std_ppcmds
+ type 'a printer = 'a -> Pp.t
val generic_top_print : Genarg.tlevel Genarg.generic_argument printer
val register_print0 : ('raw, 'glb, 'top) Genarg.genarg_type ->
'raw printer -> 'glb printer -> 'top printer -> unit
@@ -4851,74 +4853,74 @@ end
module Pputils :
sig
- val pr_with_occurrences : ('a -> Pp.std_ppcmds) -> (string -> Pp.std_ppcmds) -> 'a Locus.with_occurrences -> Pp.std_ppcmds
+ val pr_with_occurrences : ('a -> Pp.t) -> (string -> Pp.t) -> 'a Locus.with_occurrences -> Pp.t
val pr_red_expr :
- ('a -> Pp.std_ppcmds) * ('a -> Pp.std_ppcmds) * ('b -> Pp.std_ppcmds) * ('c -> Pp.std_ppcmds) ->
- (string -> Pp.std_ppcmds) ->
- ('a,'b,'c) Genredexpr.red_expr_gen -> Pp.std_ppcmds
- val pr_raw_generic : Environ.env -> Genarg.rlevel Genarg.generic_argument -> Pp.std_ppcmds
- val pr_glb_generic : Environ.env -> Genarg.glevel Genarg.generic_argument -> Pp.std_ppcmds
- val pr_or_var : ('a -> Pp.std_ppcmds) -> 'a Misctypes.or_var -> Pp.std_ppcmds
- val pr_or_by_notation : ('a -> Pp.std_ppcmds) -> 'a Misctypes.or_by_notation -> Pp.std_ppcmds
+ ('a -> Pp.t) * ('a -> Pp.t) * ('b -> Pp.t) * ('c -> Pp.t) ->
+ (string -> Pp.t) ->
+ ('a,'b,'c) Genredexpr.red_expr_gen -> Pp.t
+ val pr_raw_generic : Environ.env -> Genarg.rlevel Genarg.generic_argument -> Pp.t
+ val pr_glb_generic : Environ.env -> Genarg.glevel Genarg.generic_argument -> Pp.t
+ val pr_or_var : ('a -> Pp.t) -> 'a Misctypes.or_var -> Pp.t
+ val pr_or_by_notation : ('a -> Pp.t) -> 'a Misctypes.or_by_notation -> Pp.t
end
module Ppconstr :
sig
- val pr_name : Names.Name.t -> Pp.std_ppcmds
+ val pr_name : Names.Name.t -> Pp.t
[@@ocaml.deprecated "alias of API.Names.Name.print"]
- val pr_id : Names.Id.t -> Pp.std_ppcmds
- val pr_or_var : ('a -> Pp.std_ppcmds) -> 'a Misctypes.or_var -> Pp.std_ppcmds
- val pr_with_comments : ?loc:Loc.t -> Pp.std_ppcmds -> Pp.std_ppcmds
- val pr_lident : Names.Id.t Loc.located -> Pp.std_ppcmds
- val pr_lname : Names.Name.t Loc.located -> Pp.std_ppcmds
- val prec_less : int -> int * Ppextend.parenRelation -> bool
- val pr_constr_expr : Constrexpr.constr_expr -> Pp.std_ppcmds
- val pr_lconstr_expr : Constrexpr.constr_expr -> Pp.std_ppcmds
- val pr_constr_pattern_expr : Constrexpr.constr_pattern_expr -> Pp.std_ppcmds
- val pr_lconstr_pattern_expr : Constrexpr.constr_pattern_expr -> Pp.std_ppcmds
- val pr_binders : Constrexpr.local_binder_expr list -> Pp.std_ppcmds
- val pr_glob_sort : Misctypes.glob_sort -> Pp.std_ppcmds
+ val pr_id : Names.Id.t -> Pp.t
+ val pr_or_var : ('a -> Pp.t) -> 'a Misctypes.or_var -> Pp.t
+ val pr_with_comments : ?loc:Loc.t -> Pp.t -> Pp.t
+ val pr_lident : Names.Id.t Loc.located -> Pp.t
+ val pr_lname : Names.Name.t Loc.located -> Pp.t
+ val prec_less : int -> int * Notation_term.parenRelation -> bool
+ val pr_constr_expr : Constrexpr.constr_expr -> Pp.t
+ val pr_lconstr_expr : Constrexpr.constr_expr -> Pp.t
+ val pr_constr_pattern_expr : Constrexpr.constr_pattern_expr -> Pp.t
+ val pr_lconstr_pattern_expr : Constrexpr.constr_pattern_expr -> Pp.t
+ val pr_binders : Constrexpr.local_binder_expr list -> Pp.t
+ val pr_glob_sort : Misctypes.glob_sort -> Pp.t
end
module Printer :
sig
- val pr_named_context : Environ.env -> Evd.evar_map -> Context.Named.t -> Pp.std_ppcmds
- val pr_rel_context : Environ.env -> Evd.evar_map -> Context.Rel.t -> Pp.std_ppcmds
- val pr_goal : Goal.goal Evd.sigma -> Pp.std_ppcmds
-
- val pr_constr_env : Environ.env -> Evd.evar_map -> Constr.t -> Pp.std_ppcmds
- val pr_lconstr_env : Environ.env -> Evd.evar_map -> Constr.t -> Pp.std_ppcmds
-
- val pr_constr : Constr.t -> Pp.std_ppcmds
-
- val pr_lconstr : Constr.t -> Pp.std_ppcmds
-
- val pr_econstr : EConstr.constr -> Pp.std_ppcmds
- val pr_glob_constr : Glob_term.glob_constr -> Pp.std_ppcmds
- val pr_constr_pattern : Pattern.constr_pattern -> Pp.std_ppcmds
- val pr_glob_constr_env : Environ.env -> Glob_term.glob_constr -> Pp.std_ppcmds
- val pr_lglob_constr_env : Environ.env -> Glob_term.glob_constr -> Pp.std_ppcmds
- val pr_econstr_env : Environ.env -> Evd.evar_map -> EConstr.constr -> Pp.std_ppcmds
- val pr_constr_pattern_env : Environ.env -> Evd.evar_map -> Pattern.constr_pattern -> Pp.std_ppcmds
- val pr_lconstr_pattern_env : Environ.env -> Evd.evar_map -> Pattern.constr_pattern -> Pp.std_ppcmds
- val pr_closed_glob : Glob_term.closed_glob_constr -> Pp.std_ppcmds
- val pr_lglob_constr : Glob_term.glob_constr -> Pp.std_ppcmds
- val pr_leconstr_env : Environ.env -> Evd.evar_map -> EConstr.constr -> Pp.std_ppcmds
- val pr_leconstr : EConstr.constr -> Pp.std_ppcmds
- val pr_global : Globnames.global_reference -> Pp.std_ppcmds
- val pr_lconstr_under_binders : Pattern.constr_under_binders -> Pp.std_ppcmds
- val pr_lconstr_under_binders_env : Environ.env -> Evd.evar_map -> Pattern.constr_under_binders -> Pp.std_ppcmds
-
- val pr_constr_under_binders_env : Environ.env -> Evd.evar_map -> Pattern.constr_under_binders -> Pp.std_ppcmds
- val pr_closed_glob_env : Environ.env -> Evd.evar_map -> Glob_term.closed_glob_constr -> Pp.std_ppcmds
- val pr_rel_context_of : Environ.env -> Evd.evar_map -> Pp.std_ppcmds
- val pr_named_context_of : Environ.env -> Evd.evar_map -> Pp.std_ppcmds
- val pr_ltype : Term.types -> Pp.std_ppcmds
- val pr_ljudge : EConstr.unsafe_judgment -> Pp.std_ppcmds * Pp.std_ppcmds
- val pr_idpred : Names.Id.Pred.t -> Pp.std_ppcmds
- val pr_cpred : Names.Cpred.t -> Pp.std_ppcmds
- val pr_transparent_state : Names.transparent_state -> Pp.std_ppcmds
+ val pr_named_context : Environ.env -> Evd.evar_map -> Context.Named.t -> Pp.t
+ val pr_rel_context : Environ.env -> Evd.evar_map -> Context.Rel.t -> Pp.t
+ val pr_goal : Goal.goal Evd.sigma -> Pp.t
+
+ val pr_constr_env : Environ.env -> Evd.evar_map -> Constr.t -> Pp.t
+ val pr_lconstr_env : Environ.env -> Evd.evar_map -> Constr.t -> Pp.t
+
+ val pr_constr : Constr.t -> Pp.t
+
+ val pr_lconstr : Constr.t -> Pp.t
+
+ val pr_econstr : EConstr.constr -> Pp.t
+ val pr_glob_constr : Glob_term.glob_constr -> Pp.t
+ val pr_constr_pattern : Pattern.constr_pattern -> Pp.t
+ val pr_glob_constr_env : Environ.env -> Glob_term.glob_constr -> Pp.t
+ val pr_lglob_constr_env : Environ.env -> Glob_term.glob_constr -> Pp.t
+ val pr_econstr_env : Environ.env -> Evd.evar_map -> EConstr.constr -> Pp.t
+ val pr_constr_pattern_env : Environ.env -> Evd.evar_map -> Pattern.constr_pattern -> Pp.t
+ val pr_lconstr_pattern_env : Environ.env -> Evd.evar_map -> Pattern.constr_pattern -> Pp.t
+ val pr_closed_glob : Glob_term.closed_glob_constr -> Pp.t
+ val pr_lglob_constr : Glob_term.glob_constr -> Pp.t
+ val pr_leconstr_env : Environ.env -> Evd.evar_map -> EConstr.constr -> Pp.t
+ val pr_leconstr : EConstr.constr -> Pp.t
+ val pr_global : Globnames.global_reference -> Pp.t
+ val pr_lconstr_under_binders : Pattern.constr_under_binders -> Pp.t
+ val pr_lconstr_under_binders_env : Environ.env -> Evd.evar_map -> Pattern.constr_under_binders -> Pp.t
+
+ val pr_constr_under_binders_env : Environ.env -> Evd.evar_map -> Pattern.constr_under_binders -> Pp.t
+ val pr_closed_glob_env : Environ.env -> Evd.evar_map -> Glob_term.closed_glob_constr -> Pp.t
+ val pr_rel_context_of : Environ.env -> Evd.evar_map -> Pp.t
+ val pr_named_context_of : Environ.env -> Evd.evar_map -> Pp.t
+ val pr_ltype : Term.types -> Pp.t
+ val pr_ljudge : EConstr.unsafe_judgment -> Pp.t * Pp.t
+ val pr_idpred : Names.Id.Pred.t -> Pp.t
+ val pr_cpred : Names.Cpred.t -> Pp.t
+ val pr_transparent_state : Names.transparent_state -> Pp.t
end
(************************************************************************)
@@ -4936,7 +4938,7 @@ sig
val tclORELSE : tactic -> tactic -> tactic
val tclDO : int -> tactic -> tactic
val tclIDTAC : tactic
- val tclFAIL : int -> Pp.std_ppcmds -> tactic
+ val tclFAIL : int -> Pp.t -> tactic
val tclTHEN : tactic -> tactic -> tactic
val tclTHENLIST : tactic list -> tactic
val pf_constr_of_global :
@@ -4973,12 +4975,12 @@ sig
sig
open Proofview
val tclORELSE0 : unit tactic -> unit tactic -> unit tactic
- val tclFAIL : int -> Pp.std_ppcmds -> 'a tactic
+ val tclFAIL : int -> Pp.t -> 'a tactic
val pf_constr_of_global : Globnames.global_reference -> EConstr.constr tactic
val tclTHEN : unit tactic -> unit tactic -> unit tactic
val tclTHENS : unit tactic -> unit tactic list -> unit tactic
val tclFIRST : unit tactic list -> unit tactic
- val tclZEROMSG : ?loc:Loc.t -> Pp.std_ppcmds -> 'a tactic
+ val tclZEROMSG : ?loc:Loc.t -> Pp.t -> 'a tactic
val tclORELSE : unit tactic -> unit tactic -> unit tactic
val tclREPEAT : unit tactic -> unit tactic
val tclTRY : unit tactic -> unit tactic
@@ -5035,7 +5037,7 @@ sig
val check_scheme : 'a scheme_kind -> Names.inductive -> bool
val find_scheme : ?mode:Declare.internal_flag -> 'a scheme_kind -> Names.inductive -> Names.Constant.t * Safe_typing.private_constants
- val pr_scheme_kind : 'a scheme_kind -> Pp.std_ppcmds
+ val pr_scheme_kind : 'a scheme_kind -> Pp.t
end
module Elimschemes :
@@ -5233,7 +5235,7 @@ sig
val build_selector :
Environ.env -> Evd.evar_map -> int -> EConstr.constr -> EConstr.types ->
- EConstr.constr -> EConstr.constr -> Evd.evar_map * EConstr.constr
+ EConstr.constr -> EConstr.constr -> EConstr.constr
val replace : EConstr.constr -> EConstr.constr -> unit Proofview.tactic
val general_rewrite :
orientation -> Locus.occurrences -> freeze_evars_flag -> dep_proof_flag ->
@@ -5394,11 +5396,11 @@ sig
val add_hints : bool -> hint_db_name list -> hints_entry -> unit
val searchtable_map : hint_db_name -> hint_db
- val pp_hints_path_atom : ('a -> Pp.std_ppcmds) -> 'a hints_path_atom_gen -> Pp.std_ppcmds
- val pp_hints_path_gen : ('a -> Pp.std_ppcmds) -> 'a hints_path_gen -> Pp.std_ppcmds
+ val pp_hints_path_atom : ('a -> Pp.t) -> 'a hints_path_atom_gen -> Pp.t
+ val pp_hints_path_gen : ('a -> Pp.t) -> 'a hints_path_gen -> Pp.t
val glob_hints_path_atom :
Libnames.reference hints_path_atom_gen -> Globnames.global_reference hints_path_atom_gen
- val pp_hints_path : hints_path -> Pp.std_ppcmds
+ val pp_hints_path : hints_path -> Pp.t
val glob_hints_path :
Libnames.reference hints_path_gen -> Globnames.global_reference hints_path_gen
val run_hint : hint ->
@@ -5408,7 +5410,7 @@ sig
val create_hint_db : bool -> hint_db_name -> Names.transparent_state -> bool -> unit
val empty_hint_info : 'a Vernacexpr.hint_info_gen
val repr_hint : hint -> (raw_hint * Clenv.clausenv) hint_ast
- val pr_hint_db : Hint_db.t -> Pp.std_ppcmds
+ val pr_hint_db : Hint_db.t -> Pp.t
end
module Auto :
@@ -5485,7 +5487,7 @@ sig
val add_rew_rules : string -> raw_rew_rule list -> unit
val find_rewrites : string -> rew_rule list
val find_matches : string -> Constr.t -> rew_rule list
- val print_rewrite_hintdb : string -> Pp.std_ppcmds
+ val print_rewrite_hintdb : string -> Pp.t
end
(************************************************************************)
@@ -5498,8 +5500,8 @@ end
module Ppvernac :
sig
- val pr_vernac : Vernacexpr.vernac_expr -> Pp.std_ppcmds
- val pr_rec_definition : (Vernacexpr.fixpoint_expr * Vernacexpr.decl_notation list) -> Pp.std_ppcmds
+ val pr_vernac : Vernacexpr.vernac_expr -> Pp.t
+ val pr_rec_definition : (Vernacexpr.fixpoint_expr * Vernacexpr.decl_notation list) -> Pp.t
end
module Lemmas :
@@ -5522,14 +5524,14 @@ end
module Himsg :
sig
- val explain_refiner_error : Logic.refiner_error -> Pp.std_ppcmds
- val explain_pretype_error : Environ.env -> Evd.evar_map -> Pretype_errors.pretype_error -> Pp.std_ppcmds
+ val explain_refiner_error : Logic.refiner_error -> Pp.t
+ val explain_pretype_error : Environ.env -> Evd.evar_map -> Pretype_errors.pretype_error -> Pp.t
end
module ExplainErr :
sig
val process_vernac_interp_error : ?allow_uncaught:bool -> Util.iexn -> Util.iexn
- val register_additional_error_info : (Util.iexn -> Pp.std_ppcmds option Loc.located option) -> unit
+ val register_additional_error_info : (Util.iexn -> Pp.t option Loc.located option) -> unit
end
module Locality :
@@ -5574,7 +5576,7 @@ sig
val solve_all_obligations : unit Proofview.tactic option -> unit
val admit_obligations : Names.Id.t option -> unit
val show_obligations : ?msg:bool -> Names.Id.t option -> unit
- val show_term : Names.Id.t option -> Pp.std_ppcmds
+ val show_term : Names.Id.t option -> Pp.t
end
module Command :
diff --git a/CHANGES b/CHANGES
index 91abaa10b..a54e8a426 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,13 @@
-Changes beyond V8.6
-===================
+Changes beyond 8.7
+==================
+
+Notations
+
+- Recursive notations with the recursive pattern repeating on the
+ right (e.g. "( x ; .. ; y ; z )") now supported.
+
+Changes from 8.6.1 to 8.7+beta
+==============================
Tactics
@@ -39,19 +47,46 @@ Tactics
- In "Tactic Notation" or "TACTIC EXTEND", entry "constr_with_bindings"
now uses type classes and rejects terms with unresolved holes, like
entry "constr" does. To get the former behavior use
- "open_constr_with_bindings" (possible source of incompatibility.
+ "open_constr_with_bindings" (possible source of incompatibility).
- New e-variants eassert, eenough, epose proof, eset, eremember, epose
which behave like the corresponding variants with no "e" but turn
unresolved implicit arguments into existential variables, on the
shelf, rather than failing.
+- Tactic injection has become more powerful (closes BZ#4890) and its
+ documentation has been updated.
+- New variants of the `first` and `solve` tacticals that do not rely
+ on parsing rules, meant to define tactic notations.
+- Added support for side effects hooks in `cbv`, `cbn` and `simpl`.
+ The side effects are provided via a plugin:
+ https://github.com/herbelin/reduction-effects/
+- It is now possible to take hint database names as parameters in a
+ Ltac definition or a Tactic Notation.
+- New option `Set Ltac Batch Debug` on top of `Set Ltac Debug` for
+ non-interactive Ltac debug output.
-Vernacular Commands
+Gallina
-- Goals context can be printed in a more compact way when "Set
- Printing Compact Contexts" is activated.
+- Now supporting all kinds of binders, including 'pat, in syntax of record fields.
+Vernacular Commands
+
+- Goals context can be printed in a more compact way when `Set
+ Printing Compact Contexts` is activated.
+- Unfocused goals can be printed with the `Set Printing Unfocused`
+ option.
+- `Print` now shows the types of let-bindings.
+- The compatibility options for printing primitive projections
+ (`Set Printing Primitive Projection Parameters` and
+ `Set Printing Primitive Projection Compatibility`) are now off by default.
+- Possibility to unset the printing of notations in a more fine grained
+ fashion than `Unset Printing Notations` is provided without any
+ user-syntax. The goal is that someone creates a plugin to experiment
+ such a user-syntax, to be later integrated in Coq when stabilized.
+- `About` now tells if a reference is a coercion.
- The deprecated `Save` vernacular and its form `Save Theorem id` to
close proofs have been removed from the syntax. Please use `Qed`.
+- `Search` now sorts results by relevance (the relevance metric is a
+ weighted sum of number of distinct symbols and size of the term).
Standard Library
@@ -61,7 +96,10 @@ Standard Library
and, consequently, choice of representatives in equivalence classes.
Various proof-theoretic characterizations of choice over setoids in
file ChoiceFacts.v.
-- The BigN, BigZ, BigZ libraries are not part anymore of Coq standard
+- New lemmas about iff and about orders on positive and Z.
+- New lemmas on powerRZ.
+- Strengthened statement of JMeq_eq_dep (closes BZ#4912).
+- The BigN, BigZ, BigZ libraries are no longer part of the Coq standard
library, they are now provided by a separate repository
https://github.com/coq/bignums
The split has been done just after the Int31 library.
@@ -74,7 +112,12 @@ Standard Library
Plugins
+- The Ssreflect plugin is now distributed with Coq. Its documentation has
+ been integrated as a chapter of the reference manual. This chapter is
+ work in progress so feedback is welcome.
- The mathematical proof language (also known as declarative mode) was removed.
+- A new command Extraction TestCompile has been introduced, not meant
+ for the general user but instead for Coq's test-suite.
Dependencies
@@ -113,14 +156,77 @@ Build Infrastructure
Universes
- Cumulative inductive types. see prefixes "Cumulative", "NonCumulative"
- for inductive definitions and the option "Set Inductive Cumulativity"
+ for inductive definitions and the option "Set Polymorphic Inductive Cumulativity"
in the reference manual.
+- New syntax `foo@{_}` to instantiate a polymorphic definition with
+ anonymous universes (can also be used with `Type`).
+
+XML Protocol and internal changes
+
+See dev/doc/changes.txt
+
+Many bugfixes including BZ#1859, BZ#2884, BZ#3613, BZ#3943, BZ#3994,
+BZ#4250, BZ#4709, BZ#4720, BZ#4824, BZ#4844, BZ#4911, BZ#5026, BZ#5233,
+BZ#5275, BZ#5315, BZ#5336, BZ#5360, BZ#5390, BZ#5414, BZ#5417, BZ#5420,
+BZ#5439, BZ#5449, BZ#5475, BZ#5476, BZ#5482, BZ#5501, BZ#5507, BZ#5520,
+BZ#5523, BZ#5524, BZ#5553, BZ#5577, BZ#5578, BZ#5589, BZ#5597, BZ#5598,
+BZ#5607, BZ#5618, BZ#5619, BZ#5620, BZ#5641, BZ#5648, BZ#5651, BZ#5671.
-XML Protocol
+Many bugfixes on OS X and Windows (now the test-suite passes on these
+platforms too).
+
+Many optimizations.
+
+Many documentation improvements.
+
+Changes from 8.6 to 8.6.1
+=========================
-- The `query` call has been modified, now it carries a mandatory
- "route_id" integer parameter, that associated the result of such
- query with its generated feedback.
+- Fix #5380: Default colors for CoqIDE are actually applied.
+- Fix plugin warnings
+- Document named evars (including Show ident)
+- Fix Bug #5574, document function scope
+- Adding a test case as requested in bug 5205.
+- Fix Bug #5568, no dup notation warnings on repeated module imports
+- Fix documentation of Typeclasses eauto :=
+- Refactor documentation of records.
+- Protecting from warnings while compiling 8.6
+- Fixing an inconsistency between configure and configure.ml
+- Add test-suite checks for coqchk with constraints
+- Fix bug #5019 (looping zify on dependent types)
+- Fix bug 5550: "typeclasses eauto with" does not work with section variables.
+- Bug 5546, qualify datatype constructors when needed in Show Match
+- Bug #5535, test for Show with -emacs
+- Fix bug #5486, don't reverse ids in tuples
+- Fixing #5522 (anomaly with free vars of pat)
+- Fix bug #5526, don't check for nonlinearity in notation if printing only
+- Fix bug #5255
+- Fix bug #3659: -time should understand multibyte encodings.
+- FIx bug #5300: Anomaly: Uncaught exception Not_found" in "Print Assumptions".
+- Fix outdated description in RefMan.
+- Repairing `Set Rewriting Schemes`
+- Fixing #5487 (v8.5 regression on ltac-matching expressions with evars).
+- Fix description of command-line arguments for Add (Rec) LoadPath
+- Fix bug #5377: @? patterns broken.
+- add XML protocol doc
+- Fix anomaly when doing [all:Check _.] during a proof.
+- Correction of bug #4306
+- Fix #5435: [Eval native_compute in] raises anomaly.
+- Instances should obey universe binders even when defined by tactics.
+- Intern names bound in match patterns
+- funind: Ignore missing info for current function
+- Do not typecheck twice the type of opaque constants.
+- show unused intro pattern warning
+- [future] Be eager when "chaining" already resolved future values.
+- Opaque side effects
+- Fix #5132: coq_makefile generates incorrect install goal
+- Run non-tactic comands without resilient_command
+- Univs: fix bug #5365, generation of u+k <= v constraints
+- make `emit' tail recursive
+- Don't require printing-only notation to be productive
+- Fix the way setoid_rewrite handles bindings.
+- Fix for bug 5244 - set printing width ignored when given enough space
+- Fix bug 4969, autoapply was not tagging shelved subgoals correctly
Changes from V8.6beta1 to V8.6
==============================
diff --git a/Makefile b/Makefile
index 8d9b657d1..82595a6e6 100644
--- a/Makefile
+++ b/Makefile
@@ -54,6 +54,7 @@ FIND_SKIP_DIRS:='(' \
-name "$${GIT_DIR}" -o \
-name '_build' -o \
-name '_build_ci' -o \
+ -name 'user-contrib' -o \
-name 'coq-makefile' -o \
-name '.opamcache' -o \
-name '.coq-native' \
@@ -137,6 +138,7 @@ endif
# This should help preventing weird compilation failures caused by leftover
# compiled files after deleting or moving some source files.
+ifeq (,$(findstring clean,$(MAKECMDGOALS))) # Skip this for 'make clean' and alii
ifndef ACCEPT_ALIEN_VO
EXISTINGVO:=$(call find, '*.vo')
KNOWNVO:=$(patsubst %.v,%.vo,$(call find, '*.v'))
@@ -162,6 +164,7 @@ remove them first, for instance via 'make clean' \
(or skip this check via 'make ACCEPT_ALIEN_OBJ=1'))
endif
endif
+endif
# Apart from clean and tags, everything will be done in a sub-call to make
# on Makefile.build. This way, we avoid doing here the -include of .d :
diff --git a/Makefile.build b/Makefile.build
index 7961092fa..92eaf7232 100644
--- a/Makefile.build
+++ b/Makefile.build
@@ -31,7 +31,7 @@ TIMED ?=
# When $(TIMED) is set, the time command used by default is $(STDTIME)
# (see below), unless the following variable is non-empty. For instance,
-# it could be set to "'/usr/bin/time -p'".
+# it could be set to "'/usr/bin/env time -p'".
TIMECMD ?=
# When non-empty, -time is passed to coqc and the output is recorded
@@ -46,9 +46,6 @@ NO_RECALC_DEPS ?=
# Non-empty runs the checker on all produced .vo files:
VALIDATE ?=
-# Is "-xml" when building XML library:
-COQ_XML ?=
-
# Output file names for timed builds
TIME_OF_BUILD_FILE ?= time-of-build.log
TIME_OF_BUILD_BEFORE_FILE ?= time-of-build-before.log
@@ -167,11 +164,11 @@ DEPENDENCIES := \
###########################################################################
# Default timing command
-# Use /usr/bin/time on linux, gtime on Mac OS
+# Use /usr/bin/env time on linux, gtime on Mac OS
TIMEFMT?="$* (real: %e, user: %U, sys: %S, mem: %M ko)"
ifneq (,$(TIMED))
-ifeq (0,$(shell /usr/bin/time -f $(TIMEFMT) true >/dev/null 2>/dev/null; echo $$?))
-STDTIME?=/usr/bin/time -f $(TIMEFMT)
+ifeq (0,$(shell /usr/bin/env time -f $(TIMEFMT) true >/dev/null 2>/dev/null; echo $$?))
+STDTIME?=/usr/bin/env time -f $(TIMEFMT)
else
ifeq (0,$(shell gtime -f $(TIMEFMT) true >/dev/null 2>/dev/null; echo $$?))
STDTIME?=gtime -f $(TIMEFMT)
@@ -180,7 +177,7 @@ STDTIME?=time
endif
endif
else
-STDTIME?=/usr/bin/time -f $(TIMEFMT)
+STDTIME?=/usr/bin/env time -f $(TIMEFMT)
endif
TIMER=$(if $(TIMED), $(STDTIME), $(TIMECMD))
@@ -189,7 +186,7 @@ TIMER=$(if $(TIMED), $(STDTIME), $(TIMECMD))
# the output format of the unix command time. For instance:
# TIME="%C (%U user, %S sys, %e total, %M maxres)"
-COQOPTS=$(COQ_XML) $(NATIVECOMPUTE)
+COQOPTS=$(NATIVECOMPUTE)
BOOTCOQC=$(TIMER) $(COQTOPBEST) -boot $(COQOPTS) -compile
LOCALINCLUDES=$(if $(filter plugins/%,$<),-I lib -I API -open API $(addprefix -I plugins/,$(PLUGINDIRS)),$(addprefix -I ,$(SRCDIRS)))
@@ -237,7 +234,7 @@ endef
# Camlp5 settings
-CAMLP4DEPS:=grammar/compat5.cmo grammar/grammar.cma
+CAMLP4DEPS:=grammar/grammar.cma
CAMLP4USE=pa_extend.cmo q_MLast.cmo pa_macro.cmo -D$(CAMLVERSION)
PR_O := $(if $(READABLE_ML4),pr_o.cmo,pr_dump.cmo)
@@ -273,9 +270,6 @@ $(error This Makefile needs GNU Make 3.81 or later (that is a version that suppo
endif
VO_TOOLS_DEP := $(COQTOPBEST)
-ifdef COQ_XML
- VO_TOOLS_DEP += $(COQDOC)
-endif
ifdef VALIDATE
VO_TOOLS_DEP += $(CHICKEN)
endif
@@ -707,9 +701,9 @@ TIMING_EXTRA =
endif
theories/Init/%.vo theories/Init/%.glob: theories/Init/%.v $(VO_TOOLS_DEP)
- $(SHOW)'COQC $(COQ_XML) -noinit $<'
+ $(SHOW)'COQC -noinit $<'
$(HIDE)rm -f theories/Init/$*.glob
- $(HIDE)$(BOOTCOQC) $< $(COQ_XML) -noinit -R theories Coq $(TIMING_ARG) $(TIMING_EXTRA)
+ $(HIDE)$(BOOTCOQC) $< -noinit -R theories Coq $(TIMING_ARG) $(TIMING_EXTRA)
# MExtraction.v generates the ml core file of the micromega tactic.
# We check that this generated code is still in sync with the version
diff --git a/Makefile.ci b/Makefile.ci
index c8bc09fdc..1b09905cc 100644
--- a/Makefile.ci
+++ b/Makefile.ci
@@ -24,4 +24,9 @@ CI_TARGETS=ci-all \
# Generic rule, we use make to easy travis integraton with mixed rules
$(CI_TARGETS): ci-%:
- +./dev/ci/ci-$*.sh
+ rm -f ci-$*.ok
+ +(./dev/ci/ci-$*.sh 2>&1 && touch ci-$*.ok) | tee time-of-build.log
+ echo 'Aggregating timing log...' && echo -en 'travis_fold:start:coq.test.timing\\r'
+ python ./tools/make-one-time-file.py time-of-build.log
+ echo -en 'travis_fold:end:coq.test.timing\\r'
+ rm ci-$*.ok # must not be -f; we're checking to see that it exists
diff --git a/Makefile.common b/Makefile.common
index 2e24ac8e9..ccbe9261e 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -109,7 +109,7 @@ CORECMA:=lib/clib.cma lib/lib.cma kernel/kernel.cma intf/intf.cma library/librar
TOPLOOPCMA:=stm/proofworkertop.cma stm/tacworkertop.cma stm/queryworkertop.cma
-GRAMMARCMA:=grammar/compat5.cmo grammar/grammar.cma
+GRAMMARCMA:=grammar/grammar.cma
# modules known by the toplevel of Coq
diff --git a/Makefile.doc b/Makefile.doc
index 6a81b292e..dd7717359 100644
--- a/Makefile.doc
+++ b/Makefile.doc
@@ -36,7 +36,7 @@ HEVEA:=hevea
HACHA:=hacha
HEVEAOPTS:=-fix -exec xxdate.exe
HEVEALIB:=/usr/local/lib/hevea:/usr/lib/hevea
-HTMLSTYLE:=simple
+HTMLSTYLE:=coqremote
export TEXINPUTS:=$(HEVEALIB):
ifdef COQDOC_NOBOOT
COQTEXOPTS:=-n 72 -sl -small
@@ -62,7 +62,7 @@ REFMANTEXFILES:=$(addprefix doc/refman/, \
headers.sty Reference-Manual.tex \
RefMan-pre.tex RefMan-int.tex RefMan-com.tex \
RefMan-uti.tex RefMan-ide.tex RefMan-add.tex RefMan-modr.tex \
- AsyncProofs.tex ) \
+ AsyncProofs.tex RefMan-ssr.tex) \
$(REFMANCOQTEXFILES) \
REFMANEPSFILES:=doc/refman/coqide.eps doc/refman/coqide-queries.eps
@@ -216,7 +216,15 @@ doc/refman/html/index.html: doc/refman/Reference-Manual.html $(REFMANPNGFILES) \
(cd doc/refman/html; $(HACHA) -nolinks -tocbis -o toc.html ../styles.hva ../Reference-Manual.html)
$(INSTALLLIB) doc/refman/cover.html doc/refman/html/index.html
@touch $(INDEXES)
- -$(INSTALLLIB) doc/common/styles/html/$(HTMLSTYLE)/*.css doc/refman/html
+ (cd doc/common/styles/html/$(HTMLSTYLE);\
+ for f in `find . -name \*.css`; do \
+ install -m 644 -D $$f ../../../../refman/html/$$f;\
+ done)
+ (cd doc/common/styles/html/$(HTMLSTYLE);\
+ for f in `find . -name coqdoc.css -o -name style.css`; do \
+ install -m 644 -D $$f ../../../../refman/html/;\
+ done)
+ install -m 644 doc/common/styles/html/$(HTMLSTYLE)/*.css doc/refman/html
refman-quick:
(cd doc/refman;\
@@ -479,6 +487,12 @@ $(OCAMLDOCDIR)/%.pdf: $(OCAMLDOCDIR)/%.tex
$(HIDE)(cd $(OCAMLDOCDIR) ; pdflatex -interaction=batchmode $*.tex && pdflatex -interaction=batchmode $*.tex)
$(HIDE)(cd doc/tools/; show_latex_messages -no-overfull ../../$(OCAMLDOCDIR)/$*.log)
+###########################################################################
+# local web server
+###########################################################################
+
+serve-refman-8080: refman
+ cd doc/refman/html; python3 -m http.server 8080
# For emacs:
# Local Variables:
diff --git a/Makefile.ide b/Makefile.ide
index b534b385b..542d8c252 100644
--- a/Makefile.ide
+++ b/Makefile.ide
@@ -55,7 +55,8 @@ IDEFILES=$(wildcard ide/*.lang) ide/coq_style.xml ide/coq.png ide/MacOS/default_
GTKSHARE=$(shell pkg-config --variable=prefix gtk+-2.0)/share
GTKBIN=$(shell pkg-config --variable=prefix gtk+-2.0)/bin
GTKLIBS=$(shell pkg-config --variable=libdir gtk+-2.0)
-
+PIXBUFBIN=$(shell pkg-config --variable=prefix gdk-pixbuf-2.0)/bin
+SOURCEVIEWSHARE=$(shell pkg-config --variable=prefix gtksourceview-2.0)/share
###########################################################################
# CoqIde special targets
@@ -127,21 +128,24 @@ ide/%.cmx: ide/%.ml
## Install targets
####################
-.PHONY: install-coqide install-ide-bin install-ide-toploop install-ide-files install-ide-info install-ide-devfiles install-ide-byte
+.PHONY: install-coqide install-ide-bin install-ide-toploop install-ide-files install-ide-info install-ide-devfiles install-ide-byte install-ide-toploop-byte install-coqide-byte
ifeq ($(HASCOQIDE),no)
install-coqide: install-ide-toploop
else
install-coqide: install-ide-bin install-ide-toploop install-ide-files install-ide-info install-ide-devfiles
endif
+ifeq ($(HASCOQIDE),no)
+install-coqide-byte: install-ide-toploop-byte
+else
+install-coqide-byte: install-ide-toploop-byte install-ide-byte
+endif
# Apparently, coqide.byte is not meant to be installed
install-ide-byte:
$(MKDIR) $(FULLCOQLIB)
$(INSTALLSH) $(FULLCOQLIB) $(IDECMA)
- $(MKDIR) $(FULLCOQLIB)/toploop
- $(INSTALLBIN) $(IDETOPLOOPCMA) $(FULLCOQLIB)/toploop/
install-ide-bin:
$(MKDIR) $(FULLBINDIR)
@@ -151,6 +155,10 @@ install-ide-toploop:
ifeq ($(BEST),opt)
$(INSTALLBIN) $(IDETOPLOOPCMA:.cma=.cmxs) $(FULLCOQLIB)/toploop/
endif
+install-ide-toploop-byte:
+ifneq ($(BEST),opt)
+ $(INSTALLBIN) $(IDETOPLOOPCMA) $(FULLCOQLIB)/toploop/
+endif
install-ide-devfiles:
$(MKDIR) $(FULLCOQLIB)
@@ -193,15 +201,14 @@ $(COQIDEAPP)/Contents/Resources/share: $(COQIDEAPP)/Contents
$(MKDIR) $@/coq/
$(INSTALLLIB) ide/coq.png ide/*.lang ide/coq_style.xml $@/coq/
$(MKDIR) $@/gtksourceview-2.0/{language-specs,styles}
- $(INSTALLLIB) "$(GTKSHARE)/"gtksourceview-2.0/language-specs/{def.lang,language2.rng} $@/gtksourceview-2.0/language-specs/
- $(INSTALLLIB) "$(GTKSHARE)/"gtksourceview-2.0/styles/{styles.rng,classic.xml} $@/gtksourceview-2.0/styles/
+ $(INSTALLLIB) "$(SOURCEVIEWSHARE)/"gtksourceview-2.0/language-specs/{def.lang,language2.rng} $@/gtksourceview-2.0/language-specs/
+ $(INSTALLLIB) "$(SOURCEVIEWSHARE)/"gtksourceview-2.0/styles/{styles.rng,classic.xml} $@/gtksourceview-2.0/styles/
cp -R "$(GTKSHARE)/"locale $@
- cp -R "$(GTKSHARE)/"icons $@
cp -R "$(GTKSHARE)/"themes $@
$(COQIDEAPP)/Contents/Resources/loaders: $(COQIDEAPP)/Contents
$(MKDIR) $@
- $(INSTALLLIB) $$("$(GTKBIN)/gdk-pixbuf-query-loaders" | sed -n -e '5 s!.*= \(.*\)$$!\1!p')/libpixbufloader-png.so $@
+ $(INSTALLLIB) $$("$(PIXBUFBIN)/gdk-pixbuf-query-loaders" | sed -n -e '5 s!.*= \(.*\)$$!\1!p')/libpixbufloader-png.so $@
$(COQIDEAPP)/Contents/Resources/immodules: $(COQIDEAPP)/Contents
$(MKDIR) $@
@@ -212,7 +219,7 @@ $(COQIDEAPP)/Contents/Resources/etc: $(COQIDEAPP)/Contents/Resources/lib
$(MKDIR) $@/xdg/coq
$(INSTALLLIB) ide/MacOS/default_accel_map $@/xdg/coq/coqide.keys
$(MKDIR) $@/gtk-2.0
- { "$(GTKBIN)/gdk-pixbuf-query-loaders" $@/../loaders/*.so |\
+ { "$(PIXBUFBIN)/gdk-pixbuf-query-loaders" $@/../loaders/*.so |\
sed -e "s!/.*\(/loaders/.*.so\)!@executable_path/../Resources/\1!"; } \
> $@/gtk-2.0/gdk-pixbuf.loaders
{ "$(GTKBIN)/gtk-query-immodules-2.0" $@/../immodules/*.so |\
@@ -224,32 +231,11 @@ $(COQIDEAPP)/Contents/Resources/etc: $(COQIDEAPP)/Contents/Resources/lib
$(COQIDEAPP)/Contents/Resources/lib: $(COQIDEAPP)/Contents/Resources/immodules $(COQIDEAPP)/Contents/Resources/loaders $(COQIDEAPP)/Contents $(COQIDEINAPP)
$(MKDIR) $@
- $(INSTALLLIB) $(GTKLIBS)/charset.alias $@/
- $(MKDIR) $@/pango/1.8.0/modules
- $(INSTALLLIB) "$(GTKLIBS)/pango/1.8.0/modules/"*.so $@/pango/1.8.0/modules/
- { "$(GTKBIN)/pango-querymodules" $@/pango/1.8.0/modules/*.so |\
- sed -e "s!/.*\(/pango/1.8.0/modules/.*.so\)!@executable_path/../Resources/lib\1!"; } \
- > $@/pango/1.8.0/modules.cache
-
- for i in $$(otool -L $(COQIDEINAPP) |sed -n -e "\@$(GTKLIBS)@ s/[^/]*\(\/[^ ]*\) .*$$/\1/p"); \
- do cp $$i $@/; \
- ide/MacOS/relatify_with-respect-to_.sh $@/$$(basename $$i) $(GTKLIBS) $@; \
- done
- for i in $@/../loaders/*.so $@/../immodules/*.so $@/pango/1.8.0/modules/*.so; \
- do \
- for j in $$(otool -L $$i | sed -n -e "\@$(GTKLIBS)@ s/[^/]*\(\/[^ ]*\) .*$$/\1/p"); \
- do cp $$j $@/; ide/MacOS/relatify_with-respect-to_.sh $@/$$(basename $$j) $(GTKLIBS) $@; done; \
- ide/MacOS/relatify_with-respect-to_.sh $$i $(GTKLIBS) $@; \
- done
- EXTRAWORK=1; \
- while [ $${EXTRAWORK} -eq 1 ]; \
- do EXTRAWORK=0; \
- for i in $@/*.dylib; \
- do for j in $$(otool -L $$i | sed -n -e "\@$(GTKLIBS)@ s/[^/]*\(\/[^ ]*\) .*$$/\1/p"); \
- do EXTRAWORK=1; cp $$j $@/; ide/MacOS/relatify_with-respect-to_.sh $@/$$(basename $$j) $(GTKLIBS) $@; done; \
- done; \
+ macpack -d ../Resources/lib $(COQIDEINAPP)
+ for i in $@/../loaders/*.so $@/../immodules/*.so; \
+ do \
+ macpack -d ../lib $$i; \
done
- ide/MacOS/relatify_with-respect-to_.sh $(COQIDEINAPP) $(GTKLIBS) $@
$(COQIDEAPP)/Contents/Resources:$(COQIDEAPP)/Contents/Resources/etc $(COQIDEAPP)/Contents/Resources/share
$(INSTALLLIB) ide/MacOS/*.icns $@
diff --git a/Makefile.install b/Makefile.install
index 02ae724df..85ffc93d5 100644
--- a/Makefile.install
+++ b/Makefile.install
@@ -74,7 +74,7 @@ ifeq ($(BEST),opt)
$(INSTALLBIN) $(TOPLOOPCMA:.cma=.cmxs) $(FULLCOQLIB)/toploop/
endif
-install-byte: install-ide-byte
+install-byte: install-coqide-byte
$(MKDIR) $(FULLBINDIR)
$(INSTALLBIN) $(COQTOPBYTE) $(FULLBINDIR)
$(INSTALLBIN) $(TOPLOOPCMA) $(FULLCOQLIB)/toploop/
diff --git a/README.ci.md b/README.ci.md
index 9e25390d7..cf9da5094 100644
--- a/README.ci.md
+++ b/README.ci.md
@@ -1,30 +1,42 @@
**WARNING:** This document is a work in progress and intended as a RFC.
-If you are not a Coq Developer, don't follow this instructions yet.
+If you are not a Coq Developer, don't follow these instructions yet.
Introduction
============
-The Coq Travis CI infrastructure is meant to provide lightweight
-automatics testing of pull requests.
-If you are on GitLab, their integrated CI is also set up.
+As of 2017, Coq's Git repository includes a `.travis.yml` file, a
+`.gitlab-ci.yml` file, and supporting scripts, that enable lightweight
+Continuous Integration (CI) tests to be run on clones of that repository stored
+at Github or on a GitLab instance, respectively. This affords two benefits.
-More comprehensive testing is the responsability of Coq's [Jenkins CI
-server](https://ci.inria.fr/coq/) see, [XXX: add document] for
-instructions on how to add your development to Jenkins.
+First, it allows developers working on Coq itself to perform CI on their own
+Git remotes, thereby enabling them to catch and fix problems with their
+proposed changes before submitting pull requests to Coq itself. This in turn
+reduces the risk of a faulty PR being opened against the official Coq
+repository.
-How to submit your development for Coq CI
-=========================================
+Secondly, it allows developers working on a library dependent on Coq to have
+that library included in the Travis CI tests invoked by the official Coq
+repository on GitHub.
+
+(More comprehensive testing than is provided by the Travis CI and GitLab CI
+integration is the responsibility of Coq's [Jenkins CI
+server](https://ci.inria.fr/coq/) see, [XXX: add document] for instructions on
+how to add your development to Jenkins.)
+
+How to submit your library for inclusion in Coq's Travis CI builds
+==================================================================
CI provides a convenient way to perform testing of Coq changes
versus a set of curated libraries.
Are you an author of a Coq library who would be interested in having
-the latest Coq changes validated against your development?
+the latest Coq changes validated against it?
-If so, keep reading! Getting Coq changes tested against your library
-is easy, all that you need to do is:
+If so, all you need to do is:
-1. Put you development in a public repository tracking coq trunk.
+1. Put your library in a public repository tracking the `master`
+ branch of Coq's Git repository.
2. Make sure that your development builds in less than 35 minutes.
3. Submit a PR adding your development.
4. ?
diff --git a/checker/indtypes.mli b/checker/indtypes.mli
index 7eaaf65f2..b0554989e 100644
--- a/checker/indtypes.mli
+++ b/checker/indtypes.mli
@@ -12,8 +12,8 @@ open Cic
open Environ
(*i*)
-val prkn : kernel_name -> Pp.std_ppcmds
-val prcon : constant -> Pp.std_ppcmds
+val prkn : kernel_name -> Pp.t
+val prcon : constant -> Pp.t
(*s The different kinds of errors that may result of a malformed inductive
definition. *)
diff --git a/checker/univ.ml b/checker/univ.ml
index e3abc436f..558315c2c 100644
--- a/checker/univ.ml
+++ b/checker/univ.ml
@@ -1071,7 +1071,7 @@ module Instance : sig
val equal : t -> t -> bool
val subst_fn : universe_level_subst_fn -> t -> t
val subst : universe_level_subst -> t -> t
- val pr : t -> Pp.std_ppcmds
+ val pr : t -> Pp.t
val check_eq : t check_function
val length : t -> int
val append : t -> t -> t
diff --git a/checker/univ.mli b/checker/univ.mli
index 7f5aa7626..0a21019b1 100644
--- a/checker/univ.mli
+++ b/checker/univ.mli
@@ -20,7 +20,7 @@ sig
val var : int -> t
- val pr : t -> Pp.std_ppcmds
+ val pr : t -> Pp.t
(** Pretty-printing *)
val equal : t -> t -> bool
@@ -53,7 +53,7 @@ type universe = Universe.t
(** Alias name. *)
-val pr_uni : universe -> Pp.std_ppcmds
+val pr_uni : universe -> Pp.t
(** The universes hierarchy: Type 0- = Prop <= Type 0 = Set <= Type 1 <= ...
Typing of universes: Type 0-, Type 0 : Type 1; Type i : Type (i+1) if i>0 *)
@@ -172,7 +172,7 @@ sig
val subst : universe_level_subst -> t -> t
(** Substitution by a level-to-level function. *)
- val pr : t -> Pp.std_ppcmds
+ val pr : t -> Pp.t
(** Pretty-printing, no comments *)
val check_eq : t check_function
@@ -274,8 +274,8 @@ val check_subtype : universes -> AUContext.t -> AUContext.t -> bool
(** {6 Pretty-printing of universes. } *)
-val pr_constraint_type : constraint_type -> Pp.std_ppcmds
-val pr_constraints : (Level.t -> Pp.std_ppcmds) -> constraints -> Pp.std_ppcmds
-val pr_universe_context : (Level.t -> Pp.std_ppcmds) -> universe_context -> Pp.std_ppcmds
+val pr_constraint_type : constraint_type -> Pp.t
+val pr_constraints : (Level.t -> Pp.t) -> constraints -> Pp.t
+val pr_universe_context : (Level.t -> Pp.t) -> universe_context -> Pp.t
-val pr_universes : universes -> Pp.std_ppcmds
+val pr_universes : universes -> Pp.t
diff --git a/dev/README b/dev/README
index 814f60957..b446c3e97 100644
--- a/dev/README
+++ b/dev/README
@@ -40,10 +40,6 @@ Documentation of ML interfaces using ocamldoc (directory ocamldoc/html)
Other development tools (directory tools)
-----------------------
-Makefile.dir: makefile dedicated to intensive work in a given directory
-Makefile.subdir: makefile dedicated to intensive work in a given subdirectory
-Makefile.devel: utilities to automatically launch coq in various states
-Makefile.common: used by other Makefiles
objects.el: various development utilities at emacs level
anomaly-traces-parser.el: a .emacs-ready elisp snippet to parse
location of Anomaly backtraces and jump to them conveniently from
diff --git a/dev/TODO b/dev/TODO
deleted file mode 100644
index e62ee6e53..000000000
--- a/dev/TODO
+++ /dev/null
@@ -1,22 +0,0 @@
-
- o options de la ligne de commande
- - reporter les options de l'ancien script coqtop sur le nouveau coqtop.ml
-
- o arguments implicites
- - les calculer une fois pour toutes à la déclaration (dans Declare)
- et stocker cette information dans le in_variable, in_constant, etc.
-
- o Environnements compilés (type Environ.compiled_env)
- - pas de timestamp mais plutôt un checksum avec Digest (mais comment ?)
-
- o Efficacité
- - utiliser DOPL plutôt que DOPN (sauf pour Case)
- - batch mode => pas de undo, ni de reset
- - conversion : déplier la constante la plus récente
- - un cache pour type_of_const, type_of_inductive, type_of_constructor,
- lookup_mind_specif
-
- o Toplevel
- - parsing de la ligne de commande : utiliser Arg ???
-
-
diff --git a/dev/build/osx/make-macos-dmg.sh b/dev/build/osx/make-macos-dmg.sh
index b43ada907..cbe2a5186 100755
--- a/dev/build/osx/make-macos-dmg.sh
+++ b/dev/build/osx/make-macos-dmg.sh
@@ -4,19 +4,13 @@
set -e
# Configuration setup
-eval `opam config env`
-make distclean
OUTDIR=$PWD/_install
DMGDIR=$PWD/_dmg
-./configure -debug -prefix $OUTDIR -native-compiler no
VERSION=$(sed -n -e '/^let coq_version/ s/^[^"]*"\([^"]*\)"$/\1/p' configure.ml)
APP=bin/CoqIDE_${VERSION}.app
# Create a .app file with CoqIDE
-~/.local/bin/jhbuild run make -j -l2 $APP
-
-# Build Coq and run test-suite
-make && make check
+make -j $NJOBS -l2 $APP
# Add Coq to the .app file
make OLDROOT=$OUTDIR COQINSTALLPREFIX=$APP/Contents/Resources/ install-coq install-ide-toploop
@@ -29,7 +23,9 @@ mkdir -p $DMGDIR
ln -sf /Applications $DMGDIR/Applications
cp -r $APP $DMGDIR
+mkdir -p _build
+
# Temporary countermeasure to hdiutil error 5341
-head -c9703424 /dev/urandom > $DMGDIR/.padding
+# head -c9703424 /dev/urandom > $DMGDIR/.padding
-hdiutil create -imagekey zlib-level=9 -volname CoqIDE_$VERSION -srcfolder $DMGDIR -ov -format UDZO CoqIDE_$VERSION.dmg
+hdiutil create -imagekey zlib-level=9 -volname CoqIDE_$VERSION -srcfolder $DMGDIR -ov -format UDZO _build/CoqIDE_$VERSION.dmg
diff --git a/dev/ci/ci-coq-dpdgraph.sh b/dev/ci/ci-coq-dpdgraph.sh
index e8018158b..b610f7000 100755
--- a/dev/ci/ci-coq-dpdgraph.sh
+++ b/dev/ci/ci-coq-dpdgraph.sh
@@ -7,4 +7,4 @@ coq_dpdgraph_CI_DIR=${CI_BUILD_DIR}/coq-dpdgraph
git_checkout ${coq_dpdgraph_CI_BRANCH} ${coq_dpdgraph_CI_GITURL} ${coq_dpdgraph_CI_DIR}
-( cd ${coq_dpdgraph_CI_DIR} && autoconf && ./configure && make -j ${NJOBS} && make tests && (make tests | tee tmp.log) && (if grep DIFFERENCES tmp.log ; then exit 1 ; else exit 0 ; fi) )
+( cd ${coq_dpdgraph_CI_DIR} && autoconf && ./configure && make -j ${NJOBS} && make test-suite )
diff --git a/dev/ci/ci-hott.sh b/dev/ci/ci-hott.sh
index 693135a4c..1bf6e9a87 100755
--- a/dev/ci/ci-hott.sh
+++ b/dev/ci/ci-hott.sh
@@ -7,4 +7,4 @@ HoTT_CI_DIR=${CI_BUILD_DIR}/HoTT
git_checkout ${HoTT_CI_BRANCH} ${HoTT_CI_GITURL} ${HoTT_CI_DIR}
-( cd ${HoTT_CI_DIR} && ./autogen.sh && ./configure && make )
+( cd ${HoTT_CI_DIR} && ./autogen.sh && ./configure && make -j ${NJOBS} )
diff --git a/dev/db_printers.ml b/dev/db_printers.ml
deleted file mode 100644
index f4b4a425e..000000000
--- a/dev/db_printers.ml
+++ /dev/null
@@ -1,16 +0,0 @@
-(************************************************************************)
-(* v * The Coq Proof Assistant / The Coq Development Team *)
-(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *)
-(* \VV/ **************************************************************)
-(* // * This file is distributed under the terms of the *)
-(* * GNU Lesser General Public License Version 2.1 *)
-(************************************************************************)
-open Pp
-open Names
-
-let pp s = pp (hov 0 s)
-
-let prid id = Format.print_string (Id.to_string id)
-let prsp sp = Format.print_string (DirPath.to_string sp)
-
-
diff --git a/dev/doc/api.txt b/dev/doc/api.txt
deleted file mode 100644
index 5827257b5..000000000
--- a/dev/doc/api.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-Recommendations in using the API:
-
-The type of terms: constr (see kernel/constr.ml and kernel/term.ml)
-
-- On type constr, the canonical equality on CIC (up to
- alpha-conversion and cast removal) is Constr.equal
-- The type constr is abstract, use mkRel, mkSort, etc. to build
- elements in constr; use "kind_of_term" to analyze the head of a
- constr; use destRel, destSort, etc. when the head constructor is
- known
diff --git a/dev/doc/changes.txt b/dev/doc/changes.txt
index 57c7a97d5..0f1a28028 100644
--- a/dev/doc/changes.txt
+++ b/dev/doc/changes.txt
@@ -18,6 +18,10 @@ We changed the type of the following functions:
The returned term contains De Bruijn universe variables.
- Global.body_of_constant: same as above.
+We renamed the following datatypes:
+
+ Pp.std_ppcmds -> Pp.t
+
=========================================
= CHANGES BETWEEN COQ V8.6 AND COQ V8.7 =
=========================================
@@ -184,6 +188,9 @@ In Coqlib / reference location:
- The tclWEAK_PROGRESS and tclNOTSAMEGOAL tacticals were removed. Their usecase
was very specific. Use tclPROGRESS instead.
+- New (internal) tactical `tclINDEPENDENTL` that combined with enter_one allows
+ to iterate a non-unit tactic on all goals and access their returned values.
+
- The unsafe flag of the Refine.refine function and its variants has been
renamed and dualized into typecheck and has been made mandatory.
diff --git a/dev/doc/debugging.txt b/dev/doc/debugging.txt
index 79cde4884..3e2b435b3 100644
--- a/dev/doc/debugging.txt
+++ b/dev/doc/debugging.txt
@@ -1,7 +1,7 @@
Debugging from Coq toplevel using Caml trace mechanism
======================================================
- 1. Launch bytecode version of Coq (coqtop.byte or coqtop -byte)
+ 1. Launch bytecode version of Coq (coqtop.byte)
2. Access Ocaml toplevel using vernacular command 'Drop.'
3. Install load paths and pretty printers for terms, idents, ... using
Ocaml command '#use "base_include";;' (use '#use "include";;' for
diff --git a/dev/doc/notes-on-conversion b/dev/doc/notes-on-conversion.v
index a81f170c6..a81f170c6 100644
--- a/dev/doc/notes-on-conversion
+++ b/dev/doc/notes-on-conversion.v
diff --git a/dev/tools/Makefile.devel b/dev/tools/Makefile.devel
deleted file mode 100644
index ffdb1bdca..000000000
--- a/dev/tools/Makefile.devel
+++ /dev/null
@@ -1,74 +0,0 @@
-# to be linked to makefile (lowercase - takes precedence over Makefile)
-# in main directory
-# make devel in main directory should do this for you.
-
-TOPDIR=.
-BASEDIR=
-
-SOURCEDIRS=lib kernel library pretyping parsing proofs tactics toplevel API
-
-default: usage noargument
-
-usage::
- @echo Usage: make \<target\>
- @echo Targets are:
-
-usage::
- @echo " setup-devel -- set the devel makefile"
-setup-devel:
- @ln -sfv dev/tools/Makefile.devel makefile
- @(for i in $(SOURCEDIRS); do \
- (cd $(TOPDIR)/$$i; ln -sfv ../dev/tools/Makefile.dir Makefile) \
- done)
-
-
-usage::
- @echo " clean-devel -- clear all devel files"
-clean-devel:
- echo rm -f makefile .depend.devel
- echo rm -f $(foreach dir,$(SOURCEDIRS), $(TOPDIR)/$(dir)/Makefile)
-
-
-usage::
- @echo " coqtop -- make until the bytecode executable, make the link"
-coqtop: bin/coqtop.byte
- ln -sf bin/coqtop.byte coqtop
-
-
-usage::
- @echo " quick -- make bytecode executable and states"
-quick:
- $(MAKE) states BEST=byte
-
-include Makefile
-
-include $(TOPDIR)/dev/tools/Makefile.common
-
-# this file is better described in dev/tools/Makefile.dir
-include .depend.devel
-
-#if dev/tools/Makefile.local exists, it is included
-ifneq ($(wildcard $(TOPDIR)/dev/tools/Makefile.local),)
-include $(TOPDIR)/dev/tools/Makefile.local
-endif
-
-
-usage::
- @echo " total -- runs coqtop with all theories required"
-total:
- ledit ./bin/coqtop.byte $(foreach th,$(THEORIESVO),-require $(notdir $(basename $(th))))
-
-
-usage::
- @echo " run -- makes and runs bytecode coqtop using ledit and the history file"
- @echo " if you want to pass arguments to coqtop, use make run ARG=<args>"
-run: $(TOPDIR)/coqtop
- ledit -h $(TOPDIR)/dev/debug_history -x $(TOPDIR)/coqtop $(ARG) $(ARGS)
-
-
-usage::
- @echo " vars -- echos commands to set COQTOP and COQBIN variables"
-vars:
- @(cd $(TOPDIR); \
- echo export COQTOP=`pwd`/ ; \
- echo export COQBIN=`pwd`/bin/ )
diff --git a/dev/tools/Makefile.dir b/dev/tools/Makefile.dir
deleted file mode 100644
index 1a1bb90b4..000000000
--- a/dev/tools/Makefile.dir
+++ /dev/null
@@ -1,131 +0,0 @@
-# make a link to this file if you are working hard in one directory of Coq
-# ln -s ../dev/tools/Makefile.dir Makefile
-# if you are working in a sub/dir/ make a link to dev/tools/Makefile.subdir instead
-# this Makefile provides many useful facilities to develop Coq
-# it is not completely compatible with .ml4 files unfortunately
-
-ifndef TOPDIR
-TOPDIR=..
-endif
-
-# this complicated thing should work for subsubdirs as well
-BASEDIR=$(shell (dir=`pwd`; cd $(TOPDIR); top=`pwd`; echo $$dir | sed -e "s|$$top/||"))
-
-noargs: dir
-
-test-dir:
- @echo TOPDIR=$(TOPDIR)
- @echo BASEDIR=$(BASEDIR)
-
-include $(TOPDIR)/dev/tools/Makefile.common
-
-# make this directory
-dir:
- $(MAKE) -C $(TOPDIR) $(notdir $(BASEDIR))
-
-# make all cmo's in this directory. Useful in case the main Makefile is not
-# up-to-date
-all:
- @( ( for i in *.ml; do \
- echo -n $(BASEDIR)/`basename $$i .ml`.cmo "" ; \
- done; \
- for i in *.ml4; do \
- echo -n $(BASEDIR)/`basename $$i .ml4`.cmo "" ; \
- done ) \
- | xargs $(MAKE) -C $(TOPDIR) )
-
-# lists all files that should be compiled in this directory
-list:
- @(for i in *.mli; do \
- ls -l `basename $$i .mli`.cmi; \
- done)
- @(for i in *.ml; do \
- ls -l `basename $$i .ml`.cmo; \
- done)
- @(for i in *.ml4; do \
- ls -l `basename $$i .ml4`.cmo; \
- done)
-
-
-clean::
- rm -f *.cmi *.cmo *.cmx *.o
-
-
-# if grammar.cmo files cannot be compiled and main .depend cannot be
-# rebuilt, this is quite useful
-depend:
- (cd $(TOPDIR); ocamldep -I $(BASEDIR) $(BASEDIR)/*.ml $(BASEDIR)/*.mli > .depend.devel)
-
-
-# displays the dependency graph of the current directory (vertically,
-# unlike in doc/)
-graph:
- (ocamldep *.ml *.mli | ocamldot | dot -Tps | gv -) &
-
-
-# the pretty entry draws a dependency graph marking red those nodes
-# which do not have their .cmo files
-
-.INTERMEDIATE: depend.dot depend.2.dot
-.PHONY: depend.ps
-
-depend.dot:
- ocamldep *.ml *.mli | ocamldot > $@
-
-depend.2.dot: depend.dot
- (i=`cat $< | wc -l`; i=`expr $$i - 1`; head -n $$i $<) > $@
- (for ml in *.ml; do \
- base=`basename $$ml .ml`; \
- fst=`echo $$base | cut -c1 | tr [:lower:] [:upper:]`; \
- rest=`echo $$base | cut -c2-`; \
- name=`echo $$fst $$rest | tr -d " "`; \
- cmo=$$base.cmo; \
- if [ ! -e $$cmo ]; then \
- echo \"$$name\" [color=red]\; >> $@;\
- fi;\
- done;\
- echo } >> $@)
-
-depend.ps: depend.2.dot
- dot -Tps $< > $@
-
-clean::
- rm -f depend.ps
-
-pretty: depend.ps
- (gv -spartan $<; rm $<) &
-# gv -spartan $< &
-
-
-
-# generating file.ml.mli by tricking make to pass -i to ocamlc
-
-%.ml.mli: FORCE
- @(cmo=`basename $@ .ml.mli`.cmo ; \
- mv -f $$cmo $$cmo.tmp ; \
- $(MAKE) -s -C $(TOPDIR) $(BASEDIR)/$$cmo CAMLDEBUG=-i > $@ ; \
- echo Generated interface file $@ ; \
- mv -f $$cmo.tmp $$cmo)
-
-%.annot: FORCE
- @(cmo=`basename $@ .annot`.cmo ; \
- mv -f $$cmo $$cmo.tmp ; \
- $(MAKE) -s -C $(TOPDIR) $(BASEDIR)/$$cmo CAMLDEBUG=-dtypes ; \
- echo Generated annotation file $@ ; \
- mv -f $$cmo.tmp $$cmo)
-
-FORCE:
-
-clean::
- rm -f *.ml.mli
-
-# this is not perfect but mostly WORKS! It just calls the main makefile
-
-%.cmi: FORCE
- $(MAKE) -C $(TOPDIR) $(BASEDIR)/$@
-
-%.cmo: FORCE
- $(MAKE) -C $(TOPDIR) $(BASEDIR)/$@
-
-coqtop:
- $(MAKE) -C $(TOPDIR) bin/coqtop.byte
diff --git a/dev/tools/Makefile.subdir b/dev/tools/Makefile.subdir
deleted file mode 100644
index cb914bd12..000000000
--- a/dev/tools/Makefile.subdir
+++ /dev/null
@@ -1,7 +0,0 @@
-# if you work in a sub/sub-rectory of Coq
-# you should make a link to that makefile
-# ln -s ../../dev/tools/Makefile.subdir Makefile
-# in order to have all the facilities of dev/tools/Makefile.dir
-
-TOPDIR=../..
-include $(TOPDIR)/dev/tools/Makefile.dir
diff --git a/dev/v8-syntax/.gitignore b/dev/v8-syntax/.gitignore
new file mode 100644
index 000000000..89e3509b0
--- /dev/null
+++ b/dev/v8-syntax/.gitignore
@@ -0,0 +1,6 @@
+# byproducts of check-grammar
+def
+df
+use
+use-k
+use-t
diff --git a/dev/v8-syntax/syntax-v8.tex b/dev/v8-syntax/syntax-v8.tex
index fa2864cec..6b7960c92 100644
--- a/dev/v8-syntax/syntax-v8.tex
+++ b/dev/v8-syntax/syntax-v8.tex
@@ -1158,7 +1158,7 @@ $$
\nlsep \TERM{Abort}~\NT{ident}
\nlsep \TERM{Existential}~\NT{num}~\KWD{:=}~\NT{constr-body}
\nlsep \TERM{Qed}
-\nlsep \TERM{Save}~\NT{ident}}
+\nlsep \TERM{Save}~\NT{ident}
\nlsep \TERM{Defined}~\OPT{\NT{ident}}
\nlsep \TERM{Suspend}
\nlsep \TERM{Resume}~\OPT{\NT{ident}}
diff --git a/doc/Makefile.rt b/doc/Makefile.rt
deleted file mode 100644
index 6c3281346..000000000
--- a/doc/Makefile.rt
+++ /dev/null
@@ -1,43 +0,0 @@
-# Makefile for building Coq Technical Reports
-
-# if coqc,coqtop,coq-tex are not in your PATH, you need the environment
-# variable COQBIN to be correctly set
-# (COQTOP is autodetected)
-# (some files are preprocessed using Coq and some part of the documentation
-# is automatically built from the theories sources)
-
-# To compile documentation, you need the following tools:
-# Dvi: latex (latex2e), bibtex, makeindex, dviselect (package RPM dviutils)
-# Ps: dvips, psutils (ftp://ftp.dcs.ed.ac.uk/pub/ajcd/psutils.tar.gz)
-# Pdf: pdflatex
-# Html:
-# - hevea: http://para.inria.fr/~maranget/hevea/
-# - htmlSplit: http://coq.inria.fr/~delahaye
-# Rapports INRIA: dviselect, rrkit (par Michel Mauny)
-
-include ./Makefile
-
-###################
-# RT
-###################
-# Fabrication d'un RT INRIA (utilise rrkit de Michel Mauny)
-rt/Reference-Manual-RT.dvi: refman/Reference-Manual.dvi rt/RefMan-cover.tex
- dviselect -i refman/Reference-Manual.dvi -o rt/RefMan-body.dvi 3:
- (cd rt; $(LATEX) RefMan-cover.tex)
- set a=`tail -1 refman/Reference-Manual.log`;\
- set a=expr \("$$a" : '.*(\(.*\) pages.*'\) % 2;\
- (cd rt; if $(TEST) "$$a = 0";\
- then rrkit RefMan-cover.dvi RefMan-body.dvi Reference-Manual-RT.dvi;\
- else rrkit -odd RefMan-cover.dvi RefMan-body.dvi Reference-Manual-RT.dvi;\
- fi)
-
-# Fabrication d'un RT INRIA (utilise rrkit de Michel Mauny)
-rt/Tutorial-RT.dvi : tutorial/Tutorial.v.dvi rt/Tutorial-cover.tex
- dviselect -i rt/Tutorial.v.dvi -o rt/Tutorial-body.dvi 3:
- (cd rt; $(LATEX) Tutorial-cover.tex)
- set a=`tail -1 tutorial/Tutorial.v.log`;\
- set a=expr \("$$a" : '.*(\(.*\) pages.*'\) % 2;\
- (cd rt; if $(TEST) "$$a = 0";\
- then rrkit Tutorial-cover.dvi Tutorial-body.dvi Tutorial-RT.dvi;\
- else rrkit -odd Tutorial-cover.dvi Tutorial-body.dvi Tutorial-RT.dvi;\
- fi)
diff --git a/doc/RecTutorial/RecTutorial.v b/doc/RecTutorial/RecTutorial.v
index 8cfeebc28..4b0ab3125 100644
--- a/doc/RecTutorial/RecTutorial.v
+++ b/doc/RecTutorial/RecTutorial.v
@@ -1,3 +1,5 @@
+Unset Automatic Introduction.
+
Check (forall A:Type, (exists x:A, forall (y:A), x <> y) -> 2 = 3).
@@ -69,13 +71,13 @@ Check (Prop::Set::nil).
Require Import Bvector.
-Print vector.
+Print Vector.t.
-Check (Vnil nat).
+Check (Vector.nil nat).
-Check (fun (A:Type)(a:A)=> Vcons _ a _ (Vnil _)).
+Check (fun (A:Type)(a:A)=> Vector.cons _ a _ (Vector.nil _)).
-Check (Vcons _ 5 _ (Vcons _ 3 _ (Vnil _))).
+Check (Vector.cons _ 5 _ (Vector.cons _ 3 _ (Vector.nil _))).
Lemma eq_3_3 : 2 + 1 = 3.
Proof.
@@ -146,6 +148,7 @@ Proof.
intros; absurd (p < p); eauto with arith.
Qed.
+Require Extraction.
Extraction max.
@@ -300,8 +303,8 @@ Section Le_case_analysis.
(HS : forall m, n <= m -> Q (S m)).
Check (
match H in (_ <= q) return (Q q) with
- | le_n => H0
- | le_S m Hm => HS m Hm
+ | le_n _ => H0
+ | le_S _ m Hm => HS m Hm
end
).
@@ -317,16 +320,16 @@ Proof.
Qed.
Definition Vtail_total
- (A : Type) (n : nat) (v : vector A n) : vector A (pred n):=
-match v in (vector _ n0) return (vector A (pred n0)) with
-| Vnil => Vnil A
-| Vcons _ n0 v0 => v0
+ (A : Type) (n : nat) (v : Vector.t A n) : Vector.t A (pred n):=
+match v in (Vector.t _ n0) return (Vector.t A (pred n0)) with
+| Vector.nil _ => Vector.nil A
+| Vector.cons _ _ n0 v0 => v0
end.
-Definition Vtail' (A:Type)(n:nat)(v:vector A n) : vector A (pred n).
+Definition Vtail' (A:Type)(n:nat)(v:Vector.t A n) : Vector.t A (pred n).
intros A n v; case v.
simpl.
- exact (Vnil A).
+ exact (Vector.nil A).
simpl.
auto.
Defined.
@@ -498,10 +501,8 @@ Inductive typ : Type :=
Definition typ_inject: typ.
split.
-exact typ.
+Fail exact typ.
(*
-Defined.
-
Error: Universe Inconsistency.
*)
Abort.
@@ -920,7 +921,6 @@ Defined.
Print minus_decrease.
-
Definition div_aux (x y:nat)(H: Acc lt x):nat.
fix 3.
intros.
@@ -969,40 +969,40 @@ let rec div_aux x y =
| Right -> div_aux (minus x y) y)
*)
-Lemma vector0_is_vnil : forall (A:Type)(v:vector A 0), v = Vnil A.
+Lemma vector0_is_vnil : forall (A:Type)(v:Vector.t A 0), v = Vector.nil A.
Proof.
intros A v;inversion v.
Abort.
(*
- Lemma vector0_is_vnil_aux : forall (A:Type)(n:nat)(v:vector A n),
- n= 0 -> v = Vnil A.
+ Lemma vector0_is_vnil_aux : forall (A:Type)(n:nat)(v:Vector.t A n),
+ n= 0 -> v = Vector.nil A.
Toplevel input, characters 40281-40287
-> Lemma vector0_is_vnil_aux : forall (A:Set)(n:nat)(v:vector A n), n= 0 -> v = Vnil A.
+> Lemma vector0_is_vnil_aux : forall (A:Set)(n:nat)(v:Vector.t A n), n= 0 -> v = Vector.nil A.
> ^^^^^^
Error: In environment
A : Set
n : nat
-v : vector A n
+v : Vector.t A n
e : n = 0
-The term "Vnil A" has type "vector A 0" while it is expected to have type
- "vector A n"
+The term "Vector.nil A" has type "Vector.t A 0" while it is expected to have type
+ "Vector.t A n"
*)
Require Import JMeq.
(* On devrait changer Set en Type ? *)
-Lemma vector0_is_vnil_aux : forall (A:Type)(n:nat)(v:vector A n),
- n= 0 -> JMeq v (Vnil A).
+Lemma vector0_is_vnil_aux : forall (A:Type)(n:nat)(v:Vector.t A n),
+ n= 0 -> JMeq v (Vector.nil A).
Proof.
destruct v.
auto.
intro; discriminate.
Qed.
-Lemma vector0_is_vnil : forall (A:Type)(v:vector A 0), v = Vnil A.
+Lemma vector0_is_vnil : forall (A:Type)(v:Vector.t A 0), v = Vector.nil A.
Proof.
intros a v;apply JMeq_eq.
apply vector0_is_vnil_aux.
@@ -1010,56 +1010,56 @@ Proof.
Qed.
-Implicit Arguments Vcons [A n].
-Implicit Arguments Vnil [A].
-Implicit Arguments Vhead [A n].
-Implicit Arguments Vtail [A n].
+Implicit Arguments Vector.cons [A n].
+Implicit Arguments Vector.nil [A].
+Implicit Arguments Vector.hd [A n].
+Implicit Arguments Vector.tl [A n].
-Definition Vid : forall (A : Type)(n:nat), vector A n -> vector A n.
+Definition Vid : forall (A : Type)(n:nat), Vector.t A n -> Vector.t A n.
Proof.
destruct n; intro v.
- exact Vnil.
- exact (Vcons (Vhead v) (Vtail v)).
+ exact Vector.nil.
+ exact (Vector.cons (Vector.hd v) (Vector.tl v)).
Defined.
-Eval simpl in (fun (A:Type)(v:vector A 0) => (Vid _ _ v)).
+Eval simpl in (fun (A:Type)(v:Vector.t A 0) => (Vid _ _ v)).
-Eval simpl in (fun (A:Type)(v:vector A 0) => v).
+Eval simpl in (fun (A:Type)(v:Vector.t A 0) => v).
-Lemma Vid_eq : forall (n:nat) (A:Type)(v:vector A n), v=(Vid _ n v).
+Lemma Vid_eq : forall (n:nat) (A:Type)(v:Vector.t A n), v=(Vid _ n v).
Proof.
destruct v.
reflexivity.
reflexivity.
Defined.
-Theorem zero_nil : forall A (v:vector A 0), v = Vnil.
+Theorem zero_nil : forall A (v:Vector.t A 0), v = Vector.nil.
Proof.
intros.
- change (Vnil (A:=A)) with (Vid _ 0 v).
+ change (Vector.nil (A:=A)) with (Vid _ 0 v).
apply Vid_eq.
Defined.
Theorem decomp :
- forall (A : Type) (n : nat) (v : vector A (S n)),
- v = Vcons (Vhead v) (Vtail v).
+ forall (A : Type) (n : nat) (v : Vector.t A (S n)),
+ v = Vector.cons (Vector.hd v) (Vector.tl v).
Proof.
intros.
- change (Vcons (Vhead v) (Vtail v)) with (Vid _ (S n) v).
+ change (Vector.cons (Vector.hd v) (Vector.tl v)) with (Vid _ (S n) v).
apply Vid_eq.
Defined.
Definition vector_double_rect :
- forall (A:Type) (P: forall (n:nat),(vector A n)->(vector A n) -> Type),
- P 0 Vnil Vnil ->
- (forall n (v1 v2 : vector A n) a b, P n v1 v2 ->
- P (S n) (Vcons a v1) (Vcons b v2)) ->
- forall n (v1 v2 : vector A n), P n v1 v2.
+ forall (A:Type) (P: forall (n:nat),(Vector.t A n)->(Vector.t A n) -> Type),
+ P 0 Vector.nil Vector.nil ->
+ (forall n (v1 v2 : Vector.t A n) a b, P n v1 v2 ->
+ P (S n) (Vector.cons a v1) (Vector.cons b v2)) ->
+ forall n (v1 v2 : Vector.t A n), P n v1 v2.
induction n.
intros; rewrite (zero_nil _ v1); rewrite (zero_nil _ v2).
auto.
@@ -1069,24 +1069,23 @@ Defined.
Require Import Bool.
-Definition bitwise_or n v1 v2 : vector bool n :=
- vector_double_rect bool (fun n v1 v2 => vector bool n)
- Vnil
- (fun n v1 v2 a b r => Vcons (orb a b) r) n v1 v2.
-
+Definition bitwise_or n v1 v2 : Vector.t bool n :=
+ vector_double_rect bool (fun n v1 v2 => Vector.t bool n)
+ Vector.nil
+ (fun n v1 v2 a b r => Vector.cons (orb a b) r) n v1 v2.
-Fixpoint vector_nth (A:Type)(n:nat)(p:nat)(v:vector A p){struct v}
+Fixpoint vector_nth (A:Type)(n:nat)(p:nat)(v:Vector.t A p){struct v}
: option A :=
match n,v with
- _ , Vnil => None
- | 0 , Vcons b _ _ => Some b
- | S n', Vcons _ p' v' => vector_nth A n' p' v'
+ _ , Vector.nil => None
+ | 0 , Vector.cons b _ => Some b
+ | S n', @Vector.cons _ _ p' v' => vector_nth A n' p' v'
end.
Implicit Arguments vector_nth [A p].
-Lemma nth_bitwise : forall (n:nat) (v1 v2: vector bool n) i a b,
+Lemma nth_bitwise : forall (n:nat) (v1 v2: Vector.t bool n) i a b,
vector_nth i v1 = Some a ->
vector_nth i v2 = Some b ->
vector_nth i (bitwise_or _ v1 v2) = Some (orb a b).
diff --git a/doc/common/styles/html/coqremote/modules/node/node.css b/doc/common/styles/html/coqremote/modules/node/node.css
new file mode 100644
index 000000000..60d01308e
--- /dev/null
+++ b/doc/common/styles/html/coqremote/modules/node/node.css
@@ -0,0 +1,43 @@
+
+.node-unpublished {
+ background-color: #fff4f4;
+}
+.preview .node {
+ background-color: #ffffea;
+}
+#node-admin-filter ul {
+ list-style-type: none;
+ padding: 0;
+ margin: 0;
+ width: 100%;
+}
+#node-admin-buttons {
+ float: left; /* LTR */
+ margin-left: 0.5em; /* LTR */
+ clear: right; /* LTR */
+}
+td.revision-current {
+ background: #ffc;
+}
+.node-form .form-text {
+ display: block;
+ width: 95%;
+}
+.node-form .container-inline .form-text {
+ display: inline;
+ width: auto;
+}
+.node-form .standard {
+ clear: both;
+}
+.node-form textarea {
+ display: block;
+ width: 95%;
+}
+.node-form .attachments fieldset {
+ float: none;
+ display: block;
+}
+.terms-inline {
+ display: inline;
+}
diff --git a/doc/common/styles/html/coqremote/modules/system/defaults.css b/doc/common/styles/html/coqremote/modules/system/defaults.css
new file mode 100644
index 000000000..eb983b7f8
--- /dev/null
+++ b/doc/common/styles/html/coqremote/modules/system/defaults.css
@@ -0,0 +1,52 @@
+
+/*
+** HTML elements
+*/
+fieldset {
+ margin-bottom: 1em;
+ padding: .5em;
+}
+form {
+ margin: 0;
+ padding: 0;
+}
+hr {
+ height: 1px;
+ border: 1px solid gray;
+}
+img {
+ border: 0;
+}
+table {
+ border-collapse: collapse;
+}
+th {
+ text-align: left; /* LTR */
+ padding-right: 1em; /* LTR */
+ border-bottom: 3px solid #ccc;
+}
+
+/*
+** Markup free clearing
+** Details: http://www.positioniseverything.net/easyclearing.html
+*/
+.clear-block:after {
+ content: ".";
+ display: block;
+ height: 0;
+ clear: both;
+ visibility: hidden;
+}
+
+.clear-block {
+ display: inline-block;
+}
+
+/* Hides from IE-mac \*/
+* html .clear-block {
+ height: 1%;
+}
+.clear-block {
+ display: block;
+}
+/* End hide from IE-mac */
diff --git a/doc/common/styles/html/coqremote/modules/system/system.css b/doc/common/styles/html/coqremote/modules/system/system.css
new file mode 100644
index 000000000..9371bb479
--- /dev/null
+++ b/doc/common/styles/html/coqremote/modules/system/system.css
@@ -0,0 +1,543 @@
+
+/*
+** HTML elements
+*/
+body.drag {
+ cursor: move;
+}
+th.active img {
+ display: inline;
+}
+tr.even, tr.odd {
+ background-color: #eee;
+ border-bottom: 1px solid #ccc;
+ padding: 0.1em 0.6em;
+}
+tr.drag {
+ background-color: #fffff0;
+}
+tr.drag-previous {
+ background-color: #ffd;
+}
+td.active {
+ background-color: #ddd;
+}
+td.checkbox, th.checkbox {
+ text-align: center;
+}
+tbody {
+ border-top: 1px solid #ccc;
+}
+tbody th {
+ border-bottom: 1px solid #ccc;
+}
+thead th {
+ text-align: left; /* LTR */
+ padding-right: 1em; /* LTR */
+ border-bottom: 3px solid #ccc;
+}
+
+/*
+** Other common styles
+*/
+.breadcrumb {
+ padding-bottom: .5em
+}
+div.indentation {
+ width: 20px;
+ height: 1.7em;
+ margin: -0.4em 0.2em -0.4em -0.4em; /* LTR */
+ padding: 0.42em 0 0.42em 0.6em; /* LTR */
+ float: left; /* LTR */
+}
+div.tree-child {
+ background: url(../../misc/tree.png) no-repeat 11px center; /* LTR */
+}
+div.tree-child-last {
+ background: url(../../misc/tree-bottom.png) no-repeat 11px center; /* LTR */
+}
+div.tree-child-horizontal {
+ background: url(../../misc/tree.png) no-repeat -11px center;
+}
+.error {
+ color: #e55;
+}
+div.error {
+ border: 1px solid #d77;
+}
+div.error, tr.error {
+ background: #fcc;
+ color: #200;
+ padding: 2px;
+}
+.warning {
+ color: #e09010;
+}
+div.warning {
+ border: 1px solid #f0c020;
+}
+div.warning, tr.warning {
+ background: #ffd;
+ color: #220;
+ padding: 2px;
+}
+.ok {
+ color: #008000;
+}
+div.ok {
+ border: 1px solid #00aa00;
+}
+div.ok, tr.ok {
+ background: #dfd;
+ color: #020;
+ padding: 2px;
+}
+.item-list .icon {
+ color: #555;
+ float: right; /* LTR */
+ padding-left: 0.25em; /* LTR */
+ clear: right; /* LTR */
+}
+.item-list .title {
+ font-weight: bold;
+}
+.item-list ul {
+ margin: 0 0 0.75em 0;
+ padding: 0;
+}
+.item-list ul li {
+ margin: 0 0 0.25em 1.5em; /* LTR */
+ padding: 0;
+ list-style: disc;
+}
+ol.task-list li.active {
+ font-weight: bold;
+}
+.form-item {
+ margin-top: 1em;
+ margin-bottom: 1em;
+}
+tr.odd .form-item, tr.even .form-item {
+ margin-top: 0;
+ margin-bottom: 0;
+ white-space: nowrap;
+}
+tr.merge-down, tr.merge-down td, tr.merge-down th {
+ border-bottom-width: 0 !important;
+}
+tr.merge-up, tr.merge-up td, tr.merge-up th {
+ border-top-width: 0 !important;
+}
+.form-item input.error, .form-item textarea.error, .form-item select.error {
+ border: 2px solid red;
+}
+.form-item .description {
+ font-size: 0.85em;
+}
+.form-item label {
+ display: block;
+ font-weight: bold;
+}
+.form-item label.option {
+ display: inline;
+ font-weight: normal;
+}
+.form-checkboxes, .form-radios {
+ margin: 1em 0;
+}
+.form-checkboxes .form-item, .form-radios .form-item {
+ margin-top: 0.4em;
+ margin-bottom: 0.4em;
+}
+.marker, .form-required {
+ color: #f00;
+}
+.more-link {
+ text-align: right; /* LTR */
+}
+.more-help-link {
+ font-size: 0.85em;
+ text-align: right; /* LTR */
+}
+.nowrap {
+ white-space: nowrap;
+}
+.item-list .pager {
+ clear: both;
+ text-align: center;
+}
+.item-list .pager li {
+ background-image:none;
+ display:inline;
+ list-style-type:none;
+ padding: 0.5em;
+}
+.pager-current {
+ font-weight:bold;
+}
+.tips {
+ margin-top: 0;
+ margin-bottom: 0;
+ padding-top: 0;
+ padding-bottom: 0;
+ font-size: 0.9em;
+}
+dl.multiselect dd.b, dl.multiselect dd.b .form-item, dl.multiselect dd.b select {
+ font-family: inherit;
+ font-size: inherit;
+ width: 14em;
+}
+dl.multiselect dd.a, dl.multiselect dd.a .form-item {
+ width: 10em;
+}
+dl.multiselect dt, dl.multiselect dd {
+ float: left; /* LTR */
+ line-height: 1.75em;
+ padding: 0;
+ margin: 0 1em 0 0; /* LTR */
+}
+dl.multiselect .form-item {
+ height: 1.75em;
+ margin: 0;
+}
+
+/*
+** Inline items (need to override above)
+*/
+.container-inline div, .container-inline label {
+ display: inline;
+}
+
+/*
+** Tab navigation
+*/
+ul.primary {
+ border-collapse: collapse;
+ padding: 0 0 0 1em; /* LTR */
+ white-space: nowrap;
+ list-style: none;
+ margin: 5px;
+ height: auto;
+ line-height: normal;
+ border-bottom: 1px solid #bbb;
+}
+ul.primary li {
+ display: inline;
+}
+ul.primary li a {
+ background-color: #ddd;
+ border-color: #bbb;
+ border-width: 1px;
+ border-style: solid solid none solid;
+ height: auto;
+ margin-right: 0.5em; /* LTR */
+ padding: 0 1em;
+ text-decoration: none;
+}
+ul.primary li.active a {
+ background-color: #fff;
+ border: 1px solid #bbb;
+ border-bottom: #fff 1px solid;
+}
+ul.primary li a:hover {
+ background-color: #eee;
+ border-color: #ccc;
+ border-bottom-color: #eee;
+}
+ul.secondary {
+ border-bottom: 1px solid #bbb;
+ padding: 0.5em 1em;
+ margin: 5px;
+}
+ul.secondary li {
+ display: inline;
+ padding: 0 1em;
+ border-right: 1px solid #ccc; /* LTR */
+}
+ul.secondary a {
+ padding: 0;
+ text-decoration: none;
+}
+ul.secondary a.active {
+ border-bottom: 4px solid #999;
+}
+
+/*
+** Autocomplete styles
+*/
+/* Suggestion list */
+#autocomplete {
+ position: absolute;
+ border: 1px solid;
+ overflow: hidden;
+ z-index: 100;
+}
+#autocomplete ul {
+ margin: 0;
+ padding: 0;
+ list-style: none;
+}
+#autocomplete li {
+ background: #fff;
+ color: #000;
+ white-space: pre;
+ cursor: default;
+}
+#autocomplete li.selected {
+ background: #0072b9;
+ color: #fff;
+}
+/* Animated throbber */
+html.js input.form-autocomplete {
+ background-image: url(../../misc/throbber.gif);
+ background-repeat: no-repeat;
+ background-position: 100% 2px; /* LTR */
+}
+html.js input.throbbing {
+ background-position: 100% -18px; /* LTR */
+}
+
+/*
+** Collapsing fieldsets
+*/
+html.js fieldset.collapsed {
+ border-bottom-width: 0;
+ border-left-width: 0;
+ border-right-width: 0;
+ margin-bottom: 0;
+ height: 1em;
+}
+html.js fieldset.collapsed * {
+ display: none;
+}
+html.js fieldset.collapsed legend {
+ display: block;
+}
+html.js fieldset.collapsible legend a {
+ padding-left: 15px; /* LTR */
+ background: url(../../misc/menu-expanded.png) 5px 75% no-repeat; /* LTR */
+}
+html.js fieldset.collapsed legend a {
+ background-image: url(../../misc/menu-collapsed.png); /* LTR */
+ background-position: 5px 50%; /* LTR */
+}
+/* Note: IE-only fix due to '* html' (breaks Konqueror otherwise). */
+* html.js fieldset.collapsed legend,
+* html.js fieldset.collapsed legend *,
+* html.js fieldset.collapsed table * {
+ display: inline;
+}
+/* For Safari 2 to prevent collapsible fieldsets containing tables from dissapearing due to tableheader.js. */
+html.js fieldset.collapsible {
+ position: relative;
+}
+html.js fieldset.collapsible legend a {
+ display: block;
+}
+/* Avoid jumping around due to margins collapsing into collapsible fieldset border */
+html.js fieldset.collapsible .fieldset-wrapper {
+ overflow: auto;
+}
+
+/*
+** Resizable text areas
+*/
+.resizable-textarea {
+ width: 95%;
+}
+.resizable-textarea .grippie {
+ height: 9px;
+ overflow: hidden;
+ background: #eee url(../../misc/grippie.png) no-repeat center 2px;
+ border: 1px solid #ddd;
+ border-top-width: 0;
+ cursor: s-resize;
+}
+html.js .resizable-textarea textarea {
+ margin-bottom: 0;
+ width: 100%;
+ display: block;
+}
+
+/*
+** Table drag and drop.
+*/
+.draggable a.tabledrag-handle {
+ cursor: move;
+ float: left; /* LTR */
+ height: 1.7em;
+ margin: -0.4em 0 -0.4em -0.5em; /* LTR */
+ padding: 0.42em 1.5em 0.42em 0.5em; /* LTR */
+ text-decoration: none;
+}
+a.tabledrag-handle:hover {
+ text-decoration: none;
+}
+a.tabledrag-handle .handle {
+ margin-top: 4px;
+ height: 13px;
+ width: 13px;
+ background: url(../../misc/draggable.png) no-repeat 0 0;
+}
+a.tabledrag-handle-hover .handle {
+ background-position: 0 -20px;
+}
+
+/*
+** Teaser splitter
+*/
+.joined + .grippie {
+ height: 5px;
+ background-position: center 1px;
+ margin-bottom: -2px;
+}
+/* Keeps inner content contained in Opera 9. */
+.teaser-checkbox {
+ padding-top: 1px;
+}
+div.teaser-button-wrapper {
+ float: right; /* LTR */
+ padding-right: 5%; /* LTR */
+ margin: 0;
+}
+.teaser-checkbox div.form-item {
+ float: right; /* LTR */
+ margin: 0 5% 0 0; /* LTR */
+ padding: 0;
+}
+textarea.teaser {
+ display: none;
+}
+html.js .no-js {
+ display: none;
+}
+
+/*
+** Progressbar styles
+*/
+.progress {
+ font-weight: bold;
+}
+.progress .bar {
+ background: #fff url(../../misc/progress.gif);
+ border: 1px solid #00375a;
+ height: 1.5em;
+ margin: 0 0.2em;
+}
+.progress .filled {
+ background: #0072b9;
+ height: 1em;
+ border-bottom: 0.5em solid #004a73;
+ width: 0%;
+}
+.progress .percentage {
+ float: right; /* LTR */
+}
+.progress-disabled {
+ float: left; /* LTR */
+}
+.ahah-progress {
+ float: left; /* LTR */
+}
+.ahah-progress .throbber {
+ width: 15px;
+ height: 15px;
+ margin: 2px;
+ background: transparent url(../../misc/throbber.gif) no-repeat 0px -18px;
+ float: left; /* LTR */
+}
+tr .ahah-progress .throbber {
+ margin: 0 2px;
+}
+.ahah-progress-bar {
+ width: 16em;
+}
+
+/*
+** Formatting for welcome page
+*/
+#first-time strong {
+ display: block;
+ padding: 1.5em 0 .5em;
+}
+
+/*
+** To be used with tableselect.js
+*/
+tr.selected td {
+ background: #ffc;
+}
+
+/*
+** Floating header for tableheader.js
+*/
+table.sticky-header {
+ margin-top: 0;
+ background: #fff;
+}
+
+/*
+** Installation clean URLs
+*/
+#clean-url.install {
+ display: none;
+}
+
+/*
+** For anything you want to hide on page load when JS is enabled, so
+** that you can use the JS to control visibility and avoid flicker.
+*/
+html.js .js-hide {
+ display: none;
+}
+
+/*
+** Styles for the system modules page (admin/build/modules)
+*/
+#system-modules div.incompatible {
+ font-weight: bold;
+}
+
+/*
+** Styles for the system themes page (admin/build/themes)
+*/
+#system-themes-form div.incompatible {
+ font-weight: bold;
+}
+
+/*
+** Password strength indicator
+*/
+span.password-strength {
+ visibility: hidden;
+}
+input.password-field {
+ margin-right: 10px; /* LTR */
+}
+div.password-description {
+ padding: 0 2px;
+ margin: 4px 0 0 0;
+ font-size: 0.85em;
+ max-width: 500px;
+}
+div.password-description ul {
+ margin-bottom: 0;
+}
+.password-parent {
+ margin: 0 0 0 0;
+}
+/*
+** Password confirmation checker
+*/
+input.password-confirm {
+ margin-right: 10px; /* LTR */
+}
+.confirm-parent {
+ margin: 5px 0 0 0;
+}
+span.password-confirm {
+ visibility: hidden;
+}
+span.password-confirm span {
+ font-weight: normal;
+}
diff --git a/doc/common/styles/html/coqremote/modules/user/user.css b/doc/common/styles/html/coqremote/modules/user/user.css
new file mode 100644
index 000000000..7b2163e3d
--- /dev/null
+++ b/doc/common/styles/html/coqremote/modules/user/user.css
@@ -0,0 +1,58 @@
+
+#permissions td.module {
+ font-weight: bold;
+}
+#permissions td.permission {
+ padding-left: 1.5em; /* LTR */
+}
+#access-rules .access-type, #access-rules .rule-type {
+ margin-right: 1em; /* LTR */
+ float: left; /* LTR */
+}
+#access-rules .access-type .form-item, #access-rules .rule-type .form-item {
+ margin-top: 0;
+}
+#access-rules .mask {
+ clear: both;
+}
+#user-login-form {
+ text-align: center;
+}
+#user-admin-filter ul {
+ list-style-type: none;
+ padding: 0;
+ margin: 0;
+ width: 100%;
+}
+#user-admin-buttons {
+ float: left; /* LTR */
+ margin-left: 0.5em; /* LTR */
+ clear: right; /* LTR */
+}
+#user-admin-settings fieldset .description {
+ font-size: 0.85em;
+ padding-bottom: .5em;
+}
+
+/* Generated by user.module but used by profile.module: */
+.profile {
+ clear: both;
+ margin: 1em 0;
+}
+.profile .picture {
+ float: right; /* LTR */
+ margin: 0 1em 1em 0; /* LTR */
+}
+.profile h3 {
+ border-bottom: 1px solid #ccc;
+}
+.profile dl {
+ margin: 0 0 1.5em 0;
+}
+.profile dt {
+ margin: 0 0 0.2em 0;
+ font-weight: bold;
+}
+.profile dd {
+ margin: 0 0 1em 0;
+}
diff --git a/doc/common/styles/html/coqremote/sites/all/themes/coq/coqdoc.css b/doc/common/styles/html/coqremote/sites/all/themes/coq/coqdoc.css
new file mode 100644
index 000000000..d23ea8f36
--- /dev/null
+++ b/doc/common/styles/html/coqremote/sites/all/themes/coq/coqdoc.css
@@ -0,0 +1,329 @@
+body { padding: 0px 0px;
+ margin: 0px 0px;
+ background-color: white }
+
+#page { display: block;
+ padding: 0px;
+ margin: 0px;
+ padding-bottom: 10px; }
+
+#header { display: block;
+ position: relative;
+ padding: 0;
+ margin: 0;
+ vertical-align: middle;
+ border-bottom-style: solid;
+ border-width: thin }
+
+#header h1 { padding: 0;
+ margin: 0;}
+
+
+/* Contents */
+
+#main{ display: block;
+ padding: 10px;
+ font-family: sans-serif;
+ font-size: 100%;
+ line-height: 100% }
+
+#main h1 { line-height: 95% } /* allow for multi-line headers */
+
+#main a.idref:visited {color : #416DFF; text-decoration : none; }
+#main a.idref:link {color : #416DFF; text-decoration : none; }
+#main a.idref:hover {text-decoration : none; }
+#main a.idref:active {text-decoration : none; }
+
+#main a.modref:visited {color : #416DFF; text-decoration : none; }
+#main a.modref:link {color : #416DFF; text-decoration : none; }
+#main a.modref:hover {text-decoration : none; }
+#main a.modref:active {text-decoration : none; }
+
+#main .keyword { color : #cf1d1d }
+#main { color: black }
+
+.section { background-color: rgb(60%,60%,100%);
+ padding-top: 13px;
+ padding-bottom: 13px;
+ padding-left: 3px;
+ margin-top: 5px;
+ margin-bottom: 5px;
+ font-size : 175% }
+
+h2.section { background-color: rgb(80%,80%,100%);
+ padding-left: 3px;
+ padding-top: 12px;
+ padding-bottom: 10px;
+ font-size : 130% }
+
+h3.section { background-color: rgb(90%,90%,100%);
+ padding-left: 3px;
+ padding-top: 7px;
+ padding-bottom: 7px;
+ font-size : 115% }
+
+h4.section {
+/*
+ background-color: rgb(80%,80%,80%);
+ max-width: 20em;
+ padding-left: 5px;
+ padding-top: 5px;
+ padding-bottom: 5px;
+*/
+ background-color: white;
+ padding-left: 0px;
+ padding-top: 0px;
+ padding-bottom: 0px;
+ font-size : 100%;
+ font-weight : bold;
+ text-decoration : underline;
+ }
+
+#main .doc { margin: 0px;
+ font-family: sans-serif;
+ font-size: 100%;
+ line-height: 125%;
+ max-width: 40em;
+ color: black;
+ padding: 10px;
+ background-color: #90bdff}
+
+.inlinecode {
+ display: inline;
+/* font-size: 125%; */
+ color: #666666;
+ font-family: monospace }
+
+.doc .inlinecode {
+ display: inline;
+ font-size: 120%;
+ color: rgb(30%,30%,70%);
+ font-family: monospace }
+
+.doc .inlinecode .id {
+ color: rgb(30%,30%,70%);
+}
+
+.inlinecodenm {
+ display: inline;
+ color: #444444;
+}
+
+.doc .code {
+ display: inline;
+ font-size: 120%;
+ color: rgb(30%,30%,70%);
+ font-family: monospace }
+
+.comment {
+ display: inline;
+ font-family: monospace;
+ color: rgb(50%,50%,80%);
+}
+
+.code {
+ display: block;
+/* padding-left: 15px; */
+ font-size: 110%;
+ font-family: monospace;
+ }
+
+table.infrule {
+ border: 0px;
+ margin-left: 50px;
+ margin-top: 10px;
+ margin-bottom: 10px;
+}
+
+td.infrule {
+ font-family: monospace;
+ text-align: center;
+/* color: rgb(35%,35%,70%); */
+ padding: 0px;
+ line-height: 100%;
+}
+
+tr.infrulemiddle hr {
+ margin: 1px 0 1px 0;
+}
+
+.infrulenamecol {
+ color: rgb(60%,60%,60%);
+ font-size: 80%;
+ padding-left: 1em;
+ padding-bottom: 0.1em
+}
+
+/* Pied de page */
+
+#footer { font-size: 65%;
+ font-family: sans-serif; }
+
+/* Identifiers: <span class="id" title="...">) */
+
+.id { display: inline; }
+
+.id[title="constructor"] {
+ color: rgb(60%,0%,0%);
+}
+
+.id[title="var"] {
+ color: rgb(40%,0%,40%);
+}
+
+.id[title="variable"] {
+ color: rgb(40%,0%,40%);
+}
+
+.id[title="definition"] {
+ color: rgb(0%,40%,0%);
+}
+
+.id[title="abbreviation"] {
+ color: rgb(0%,40%,0%);
+}
+
+.id[title="lemma"] {
+ color: rgb(0%,40%,0%);
+}
+
+.id[title="instance"] {
+ color: rgb(0%,40%,0%);
+}
+
+.id[title="projection"] {
+ color: rgb(0%,40%,0%);
+}
+
+.id[title="method"] {
+ color: rgb(0%,40%,0%);
+}
+
+.id[title="inductive"] {
+ color: rgb(0%,0%,80%);
+}
+
+.id[title="record"] {
+ color: rgb(0%,0%,80%);
+}
+
+.id[title="class"] {
+ color: rgb(0%,0%,80%);
+}
+
+.id[title="keyword"] {
+ color : #cf1d1d;
+/* color: black; */
+}
+
+/* Deprecated rules using the 'type' attribute of <span> (not xhtml valid) */
+
+.id[type="constructor"] {
+ color: rgb(60%,0%,0%);
+}
+
+.id[type="var"] {
+ color: rgb(40%,0%,40%);
+}
+
+.id[type="variable"] {
+ color: rgb(40%,0%,40%);
+}
+
+.id[type="definition"] {
+ color: rgb(0%,40%,0%);
+}
+
+.id[type="abbreviation"] {
+ color: rgb(0%,40%,0%);
+}
+
+.id[type="lemma"] {
+ color: rgb(0%,40%,0%);
+}
+
+.id[type="instance"] {
+ color: rgb(0%,40%,0%);
+}
+
+.id[type="projection"] {
+ color: rgb(0%,40%,0%);
+}
+
+.id[type="method"] {
+ color: rgb(0%,40%,0%);
+}
+
+.id[type="inductive"] {
+ color: rgb(0%,0%,80%);
+}
+
+.id[type="record"] {
+ color: rgb(0%,0%,80%);
+}
+
+.id[type="class"] {
+ color: rgb(0%,0%,80%);
+}
+
+.id[type="keyword"] {
+ color : #cf1d1d;
+/* color: black; */
+}
+
+.inlinecode .id {
+ color: rgb(0%,0%,0%);
+}
+
+
+/* TOC */
+
+#toc h2 {
+ padding: 10px;
+ background-color: rgb(60%,60%,100%);
+}
+
+#toc li {
+ padding-bottom: 8px;
+}
+
+/* Index */
+
+#index {
+ margin: 0;
+ padding: 0;
+ width: 100%;
+}
+
+#index #frontispiece {
+ margin: 1em auto;
+ padding: 1em;
+ width: 60%;
+}
+
+.booktitle { font-size : 140% }
+.authors { font-size : 90%;
+ line-height: 115%; }
+.moreauthors { font-size : 60% }
+
+#index #entrance {
+ text-align: center;
+}
+
+#index #entrance .spacer {
+ margin: 0 30px 0 30px;
+}
+
+#index #footer {
+ position: absolute;
+ bottom: 0;
+}
+
+.paragraph {
+ height: 0.75em;
+}
+
+ul.doclist {
+ margin-top: 0em;
+ margin-bottom: 0em;
+}
diff --git a/doc/common/styles/html/coqremote/sites/all/themes/coq/style.css b/doc/common/styles/html/coqremote/sites/all/themes/coq/style.css
new file mode 100644
index 000000000..32c0b3316
--- /dev/null
+++ b/doc/common/styles/html/coqremote/sites/all/themes/coq/style.css
@@ -0,0 +1,801 @@
+body
+{
+ background: white;
+ color:#444;
+ font:normal normal normal small/1.5em "Lucida Grande", Verdana, sans-serif;
+ margin:0;
+ padding:0;
+}
+
+h2
+{
+ font-size:150%;
+ font-weight:normal;
+ margin:20px 0 0;
+}
+
+h3
+{
+ font-size:130%;
+ font-weight:normal;
+}
+
+a:link,a:visited
+{
+ color:#660403;
+ font-weight:normal;
+ text-decoration:none;
+}
+
+a:hover
+{
+ color: red;
+ text-decoration:none;
+}
+
+#container
+{
+ margin: 0;
+ padding: 0;
+ }
+
+ /*----------header, logo and site name styles----------*/
+ #headertop
+ {
+ display: block;
+ /* position:absolute; */
+ min-width: 700px;
+ top: 0;
+ width: 100%;
+ height:30px;
+ z-index: 1;
+ background: transparent url('images/header_top.png') repeat-x;
+ }
+
+ #header
+ {
+ min-width: 700px;
+ width: 100%; height:70px;
+ position: relative;
+ left: 0; top: 0;
+ background: transparent url('images/header_bot.png') repeat-x;
+ }
+
+ #logo
+ {
+ float:left;
+ z-index: 2;
+ position: absolute;
+ top: -15px;
+ left: 0px;
+ }
+
+ #logo img
+ {
+ border:0;
+ float:left;
+ }
+
+ #logoWrapper
+ {
+ line-height:4em;
+ }
+
+ #siteName
+ {
+ position: relative;
+ top: 10px; left: 80px;
+ color:#fff;
+ float:left;
+ font-size:350%;
+ }
+
+ #siteName a
+ {
+ color:#fff;
+ text-decoration:none;
+ }
+
+ #siteName a:hover
+ {
+ color:#ddd;
+ text-decoration:none;
+ }
+
+ #siteSlogan
+ {
+ color:#eee;
+ float:left;
+ font-size:170%;
+ margin:50px 0 0 10px;
+ text-transform:lowercase;
+ white-space:nowrap;
+ }
+
+ /*----------nav styles -- primary links in header----------*/
+
+ #nav
+{
+ position:absolute; right:0;
+ margin: 0;
+ padding: 5px;
+ }
+
+#nav ul
+ {
+ list-style:none outside none;
+ list-style-image:none;
+ margin:0;
+ padding:0;
+ }
+
+ #nav li
+ {
+ display: inline;
+ margin: 0; padding: 4px;
+ }
+
+ #nav li a
+ {
+ border:medium none;
+ color:#ccc;
+ font-weight:normal;
+ padding-left:10px;
+ padding-right:10px;
+ text-decoration:none;
+ }
+
+ #nav li a:hover
+ {
+ background:#7B0505 none repeat;
+ border:medium none;
+ border-left:1px solid #ddd;
+ border-right:1px solid #ddd;
+ color:#fff;
+ padding: 6px 9px 5px 9px;
+ }
+
+
+/************** FOOTER *******************/
+
+
+#footer
+{
+ background:transparent url('images/footer.png') repeat-x;
+ width:100%;
+ clear:both;
+ font-size:85%;
+ text-align:center;
+ /* position:fixed; */
+ margin: 0;
+ padding: 0;
+}
+
+
+#nav-footer
+{
+ display: inline;
+ color:#444;
+ margin: 0;
+ padding: 0;
+ text-align:right;
+ }
+
+#nav-footer ul
+ {
+ list-style:none outside none;
+ list-style-image:none;
+ margin:0;
+ padding:0px; padding-right: 5px;
+ }
+
+#nav-footer li
+{
+ display:inline; padding: 4px;
+}
+
+ #nav-footer li a
+ {
+ border:medium none;
+ color:#ccc;
+ font-size: 11px;
+ font-weight:normal;
+ padding-left: 10px;
+ padding-right: 10px;
+ text-decoration:none;
+ }
+
+ #nav-footer li a:hover
+ {
+ background:#7B0505 none repeat;
+ border:medium none;
+ border-left:1px solid #ddd;
+ border-right:1px solid #ddd;
+ color:#fff;
+ margin:0;
+ padding: 3px 9px 0px 9px;
+ }
+
+
+ /*----------main content----------*/
+ #content
+ {
+ display: block;
+ position: static;
+
+/* min-width: 640px; */
+ max-width: 800px;
+
+ margin-left:40px;
+ margin-right:300px;
+ padding: 2ex 2ex;
+
+ z-index:1;
+ }
+
+.content {
+ display: block;
+ position: relative;
+
+ margin: 0;
+ padding: 0;
+}
+
+ /*----------sidebar styles----------*/
+ #sidebarWrapper
+ {
+ /* background:transparent url('images/sidebar_bottom.jpg') no-repeat scroll left bottom;*/
+ display:block;
+ position:fixed;
+ /* avant : top: 100px; right:0px*/
+ top: 15px; /* 180 */
+ right:0px;
+ left: auto;
+
+ margin-right: 0px;
+
+ /* avant
+ width: 12%;
+ min-width:80px; */
+
+ /* width: 18%; */
+ /* min-*/
+ width:270px;
+
+ z-index:0;
+ overflow:hidden;
+
+/* ajout precedent:*/
+/* min-height:320px;
+ padding:10px;
+ background-image:url('http://www.lix.polytechnique.fr/Labo/Denis.Cousineau/data/coq/rttr340bis.png');
+ background-repeat : repeat-x ;*/
+
+/* last ajout */
+ /* min-height:510px; */ /* 360 */
+ padding-left:0px;
+ padding-right:0px;
+ padding-top:105px; /* 40 */
+ padding-bottom:/*105px*/115px;
+ /* background:transparent url('http://www.lix.polytechnique.fr/Labo/Denis.Cousineau/data/coq/trig6b.png') no-repeat scroll left top; */
+ background:transparent url('images/sidebarbot.png') no-repeat scroll right bottom;
+
+ }
+
+#sidebar {
+ padding-left: 40px;
+ padding-top: 105px;
+ overflow: visible;
+ background:transparent url('images/sidebartop.png') no-repeat scroll right top;
+}
+
+#sidebar .title
+{
+ /* avant :border-bottom:1px solid #eee;*/
+ /* avant : color:#660403;*/
+ color:#2D0102;
+ font-size:120%;
+ font-weight:bold;
+ line-height:19px;
+ margin:10px 0;
+}
+
+/*----------page styles----------*/
+.pageTitle
+{
+ color:#2D0102;
+ font-size:220%;
+ margin:10px 0 20px;
+}
+
+.mission
+{
+ background-color:#efefef;
+ border:solid 1px #ccc;
+ margin:0 0 10px 0;
+ padding:10px;
+}
+
+.messages
+{
+ color:#C80000;
+ font-size:110%;
+ margin:10px 0;
+}
+
+/*----------node styles----------*/
+.nodeTitle
+{
+ background: url('images/nodeTitle.gif') no-repeat 0 100%;
+ color:#9a0000;
+ font-size: 100%;
+ margin:0;
+}
+
+.nodeTitle a
+{
+ color:#660403;
+ text-decoration:none;
+}
+
+.nodeTitle a:hover
+{
+ color:#d00000;
+ text-decoration:none;
+}
+
+.node
+{
+ margin:0 0 20px;
+}
+
+.content p
+{
+ margin:10px 0;
+}
+
+.submitted
+{
+ color:#a3a3a3;
+ font-size:70%;
+}
+
+.nodeLinks
+{
+ font-size:95%;
+ margin:0;
+ padding:0;
+}
+
+.taxonomy
+{
+ background:url('icons/tag_red.png') no-repeat 0 7px;
+ font-size:80%;
+ padding:0 0 5px 16px;
+}
+
+/*----------comment styles----------*/
+.commentTitle
+{
+ Border-bottom:1px solid #ddd;
+ color:#9a0000;
+ font-size:130%;
+ margin:20px 0 0;
+}
+
+.commentTitle a
+{
+ color:#660403;
+ text-decoration:none;
+}
+
+.commentTitle a:hover
+{
+ color:#d00000;
+ text-decoration:none;
+}
+
+.commentLinks
+{
+ background:#f7f7f7;
+ border:1px solid #e1e1e1;
+ color:#444;
+ font-size:95%;
+ margin:20px 0 30px;
+ padding:4px 0 4px 4px;
+}
+
+
+/*----------img styles----------*/
+img
+{
+ padding:3px;
+}
+
+/*----------icons for links----------*/
+.comment_comments a
+{
+ background:url('icons/comment.png') no-repeat 0 2px;
+ padding-bottom:5px;
+ padding-left:20px;
+}
+
+.node_read_more a
+{
+ background:url('icons/page_white_go.png') no-repeat;
+ padding-bottom:5px;
+ padding-left:20px;
+}
+
+.comment_add a,.comment_reply a
+{
+ background:url('icons/comment_add.png') no-repeat;
+ padding-bottom:5px;
+ padding-left:20px;
+}
+.comment_delete a
+{
+ background:url('icons/comment_delete.png') no-repeat;
+ padding-bottom:5px;
+ padding-left:20px;
+}
+
+.comment_edit a
+{
+ background:url('icons/comment_edit.png') no-repeat;
+ padding-bottom:5px;
+ padding-left:20px;
+}
+
+/*----------TinyMCE editor----------*/
+body.mceContentBody
+{
+ background:#fff;
+ color:#000;
+ font-size:12px;
+}
+
+body.mceContentBody a:link
+{
+ color:#ff0000;
+}
+
+/*----------table styles----------*/
+table
+{
+ margin:1em 0;
+ width:100%;
+}
+
+thead th
+{
+ border-bottom:2px solid #AAA;
+ color:#494949;
+ font-weight:bold;
+}
+
+td,th
+{
+ padding:.3em 0 .5em;
+}
+
+tr.even,tr.odd,tbody th
+{
+ border:solid #D5D6D7;
+ border-width:1px 0;
+}
+
+tr.even
+{
+ background:#fff;
+}
+
+td.region,td.module,td.container
+{
+ background:#D5D6D7;
+ border-bottom:1px solid #AAA;
+ border-top:1.5em solid #fff;
+ color:#455067;
+ font-weight:bold;
+}
+
+tr:first-child td.region,tr:first-child td.module,tr:first-child td.container
+{
+ border-top-width:0;
+}
+
+td.menu-disabled,td.menu-disabled a
+{
+ background-color:#D5C2C2;
+ color:#000;
+}
+
+/*----------other styles----------*/
+
+.block
+{
+ margin:5px 0 20px;
+}
+
+.thumbnail,.preview
+{
+ border:1px solid #ccc;
+}
+
+.lstlisting {
+ display: block;
+ font-family: monospace;
+ white-space: pre;
+ margin: 1em 0;
+}
+.center {
+ text-align: center;
+}
+.centered {
+ display: block-inline;
+}
+
+/*----------download table------------*/
+
+table.downloadtable
+{
+ width:90%;
+ margin-left:auto;
+ margin-right:auto;
+}
+
+table.downloadtable td.downloadheader
+{
+padding: 2px 1em;
+font-weight: bold;
+font-size: 120%;
+color: white;
+background: transparent url('images/header_bot.png') repeat-x;
+/*background-color: #660403; */
+border: solid 2px white;
+border-left: none;
+}
+
+table.downloadtable td.downloadcategory
+{
+padding: 2px 1em;
+background-color: #dfbfbe;
+text-indent: 0;
+}
+
+table.downloadtable td.downloadsize
+{
+text-indent: 0;
+white-space: nowrap;
+height: 52px;
+}
+
+table.downloadtable td
+{
+padding: 2px 1em;
+background-color: #dfbfbe;
+border-right: solid white 2px;
+}
+
+
+table.downloadtable td.downloadtopline
+{
+border-top: solid white 2px;
+}
+
+table.downloadtable td.downloadtoprightline
+{
+border-top: solid 2px white;
+border-right: solid 2px white;
+}
+
+table.downloadtable td.downloadbottomline
+{
+border-bottom: solid 2px white;
+border-right: solid 2px white;
+}
+
+table.downloadtable td.downloadbottomrightline
+{
+border-bottom: solid 2px white;
+border-right: solid 2px white;
+}
+
+table.downloadtable td.downloadrightline
+{
+border-right: solid 2px white;
+}
+
+table.downloadtable td.downloadback
+{
+background-color: #efe4e4;
+}
+
+table.downloadtable td.downloadbottomback
+{
+border-bottom: solid 2px white;
+background-color: #efe4e4;
+}
+
+
+/*********** Normal text style ************/
+
+p {
+ text-indent:3em;
+}
+
+ul {
+ margin: 0px;
+ margin-left:4em;
+ padding: 0px;
+ list-style-type:square;
+}
+
+li
+{
+ text-indent: 0px;
+ margin: 0px;
+ padding: 0px;
+}
+
+tt { font-size: 1em; }
+
+pre { font-size: 1em; }
+
+/*********** Framework ***********/
+.framework
+{
+ display: block;
+ position:relative;
+ border:solid 1px #660033;
+ margin: 8ex 1em; /* 8ex 8ex 1em 1em; */
+ padding: 0;
+}
+
+.frameworkcontent
+{
+ position:relative;
+ left:0px;
+
+
+ margin: 0;
+ padding: .5ex 2em;
+
+ text-indent: 2em;
+ text-align: justify;
+}
+
+
+.frameworklabel
+{
+ display: inline;
+ position:relative;
+ top:-1.3ex;
+
+ margin-left:2ex;
+ padding-top:.4ex;
+ padding-bottom:.4ex;
+ padding-right:1ex;
+ padding-left:1ex;
+
+ border: none;
+ background: white;
+ color: black;
+
+ font-weight: bold;
+ font-size:115%;
+}
+
+.frameworklinks {
+ display:block;
+ position:relative;
+ top:1.4ex;
+
+ margin-right:2ex;
+
+ text-align:right;
+ font-size:100%
+ }
+
+.frameworklinks ul
+{
+ display: inline;
+ padding: 0px 1ex;
+
+ border: none;
+ background: white;
+}
+
+
+.frameworklinks li
+ {
+ display:inline;
+ padding: 1ex 0px;
+ }
+
+ .frameworklinks li a
+{
+ border:medium none;
+
+ margin: 0px 1ex;
+ padding-left:2px;
+ padding-right:3px;
+
+ font-weight:normal;
+ text-decoration:none;
+
+ color: #660003;
+}
+
+ .frameworklinks li a:hover
+ {
+ color: red;
+
+ border: none;
+ }
+
+/* General flat lists */
+.flatlist li {display: inline}
+
+/* For sections in bycat.html */
+.bycatsection dt {
+ text-indent: 3em
+}
+
+.bycatsection dt a
+{
+ font-weight: bold;
+ color:#444;
+}
+
+/* footnote is used in the new contribution form */
+.footnote {
+ text-indent: 0pt;
+ font-size: 80%;
+ color: silver;
+ text-align: justify
+}
+
+/****************** CoqIDE Screenshots *****************/
+
+
+.SCpager {
+ position:relative;
+ top:5px;
+ width:630px;
+ background: transparent url('images/header_bot.png') repeat-x;
+ padding:4px;
+}
+
+.SCpagercontent {
+ width:390px;
+ position:relative;
+ margin-left:auto;
+ margin-right:auto;
+}
+
+.SCthumb {
+ height:45px;
+ margin-left:2px;
+ margin-right:2px;
+}
+
+.SCthumbselected {
+ height:55px;
+ margin-left:2px;
+ margin-right:2px;
+}
+
+.SCcontent {
+ position:relative;
+ top:5px;
+ width:638px;
+ background-color: #dfbfbe;
+}
+
+.SCscreenshot {
+ position:relative;
+ height:400px;
+ width:auto;
+ margin:15px auto 15px 19px;
+}
diff --git a/doc/refman/AsyncProofs.tex b/doc/refman/AsyncProofs.tex
index b93ca2957..1609e4a04 100644
--- a/doc/refman/AsyncProofs.tex
+++ b/doc/refman/AsyncProofs.tex
@@ -51,6 +51,12 @@ proof does not begin with \texttt{Proof using}, the system records in an
auxiliary file, produced along with the \texttt{.vo} file, the list of
section variables used.
+\subsubsection{Automatic suggestion of proof annotations}
+
+The command \texttt{Set Suggest Proof Using} makes Coq suggest, when a
+\texttt{Qed} command is processed, a correct proof annotation. It is up
+to the user to modify the proof script accordingly.
+
\section{Proof blocks and error resilience}
Coq 8.6 introduces a mechanism for error resiliency: in interactive mode Coq
@@ -86,13 +92,7 @@ CoqIDE one of the following options:
\texttt{-async-proofs-tactic-error-resilience off},
\texttt{-async-proofs-tactic-error-resilience all},
\texttt{-async-proofs-tactic-error-resilience $blocktype_1$,..., $blocktype_n$}.
-Valid proof block types are: ``curly'', ``par'', ``indent'', ``bullet''.
-
-\subsubsection{Automatic suggestion of proof annotations}
-
-The command \texttt{Set Suggest Proof Using} makes Coq suggest, when a
-\texttt{Qed} command is processed, a correct proof annotation. It is up
-to the user to modify the proof script accordingly.
+Valid proof block types are: ``curly'', ``par'', ``indent'', ``bullet''.
\section{Interactive mode}
diff --git a/doc/refman/Extraction.tex b/doc/refman/Extraction.tex
index fa3d61b1c..499239b6f 100644
--- a/doc/refman/Extraction.tex
+++ b/doc/refman/Extraction.tex
@@ -21,9 +21,14 @@ be used (abusively) to refer to any of the three.
Before using any of the commands or options described in this chapter,
the extraction framework should first be loaded explicitly
-via {\tt Require Extraction}. Note that in earlier versions of Coq, these
-commands and options were directly available without any preliminary
-{\tt Require}.
+via {\tt Require Extraction}, or via the more robust
+{\tt From Coq Require Extraction}.
+Note that in earlier versions of Coq, these commands and options were
+directly available without any preliminary {\tt Require}.
+
+\begin{coq_example}
+Require Extraction.
+\end{coq_example}
\asection{Generating ML code}
\comindex{Extraction}
@@ -82,9 +87,20 @@ one monolithic file or one file per \Coq\ library.
using prefixes \verb!coq_! or \verb!Coq_!.
\end{description}
-\noindent The list of globals \qualid$_i$ does not need to be
-exhaustive: it is automatically completed into a complete and minimal
-environment.
+\noindent The following command is meant to help automatic testing of
+ the extraction, see for instance the {\tt test-suite} directory
+ in the \Coq\ sources.
+
+\begin{description}
+\item {\tt Extraction TestCompile} \qualid$_1$ \dots\ \qualid$_n$. ~\par
+ All the globals (or modules) \qualid$_1$ \dots\ \qualid$_n$ and all
+ their dependencies are extracted to a temporary Ocaml file, just as in
+ {\tt Extraction "{\em file}"}. Then this temporary file and its
+ signature are compiled with the same Ocaml compiler used to built
+ \Coq. This command succeeds only if the extraction and the Ocaml
+ compilation succeed (and it fails if the current target language
+ of the extraction is not Ocaml).
+\end{description}
\asection{Extraction options}
@@ -365,6 +381,9 @@ some specific {\tt Extract Constant} when primitive counterparts exist.
\Example
Typical examples are the following:
+\begin{coq_eval}
+Require Extraction.
+\end{coq_eval}
\begin{coq_example}
Extract Inductive unit => "unit" [ "()" ].
Extract Inductive bool => "bool" [ "true" "false" ].
diff --git a/doc/refman/RefMan-cic.tex b/doc/refman/RefMan-cic.tex
index 96fb1eb75..ad795d406 100644
--- a/doc/refman/RefMan-cic.tex
+++ b/doc/refman/RefMan-cic.tex
@@ -558,7 +558,7 @@ $\Sort$ is called the sort of the inductive type $t$.
\paragraph{Examples}
\newcommand\ind[3]{$\mathsf{Ind}~[#1]\left(\hskip-.4em
- \begin{array}{r @{\mathrm{~:=~}} l}
+ \begin{array}{r@{\mathrm{~:=~}}l}
#2 & #3 \\
\end{array}
\hskip-.4em
@@ -569,7 +569,7 @@ The declaration for parameterized lists is:
\begin{latexonly}
\vskip.5em
-\ind{1}{[\List:\Set\ra\Set]}{\left[\begin{array}{r \colon l}
+ \ind{1}{[\List:\Set\ra\Set]}{\left[\begin{array}{r@{:}l}
\Nil & \forall A:\Set,\List~A \\
\cons & \forall A:\Set, A \ra \List~A \ra \List~A
\end{array}
@@ -613,8 +613,8 @@ Inductive list (A:Set) : Set :=
\noindent The declaration for a mutual inductive definition of {\tree} and {\forest} is:
\begin{latexonly}
\vskip.5em
-\ind{~}{\left[\begin{array}{r \colon l}\tree&\Set\\\forest&\Set\end{array}\right]}
- {\left[\begin{array}{r \colon l}
+\ind{~}{\left[\begin{array}{r@{:}l}\tree&\Set\\\forest&\Set\end{array}\right]}
+ {\left[\begin{array}{r@{:}l}
\node & \forest \ra \tree\\
\emptyf & \forest\\
\consf & \tree \ra \forest \ra \forest\\
@@ -680,15 +680,15 @@ with forest : Set :=
\noindent The declaration for a mutual inductive definition of {\even} and {\odd} is:
\begin{latexonly}
- \newcommand\GammaI{\left[\begin{array}{r \colon l}
- \even & \nat\ra\Prop \\
- \odd & \nat\ra\Prop
+ \newcommand\GammaI{\left[\begin{array}{r@{:}l}
+ \even & \nat\ra\Prop \\
+ \odd & \nat\ra\Prop
\end{array}
\right]}
- \newcommand\GammaC{\left[\begin{array}{r \colon l}
- \evenO & \even~\nO \\
- \evenS & \forall n : \nat, \odd~n \ra \even~(\nS~n)\\
- \oddS & \forall n : \nat, \even~n \ra \odd~(\nS~n)
+ \newcommand\GammaC{\left[\begin{array}{r@{:}l}
+ \evenO & \even~\nO \\
+ \evenS & \forall n : \nat, \odd~n \ra \even~(\nS~n)\\
+ \oddS & \forall n : \nat, \even~n \ra \odd~(\nS~n)
\end{array}
\right]}
\vskip.5em
@@ -769,7 +769,7 @@ Provided that our environment $E$ contains inductive definitions we showed befor
these two inference rules above enable us to conclude that:
\vskip.5em
\newcommand\prefix{E[\Gamma]\vdash\hskip.25em}
-$\begin{array}{@{} l}
+$\begin{array}{@{}l}
\prefix\even : \nat\ra\Prop\\
\prefix\odd : \nat\ra\Prop\\
\prefix\evenO : \even~\nO\\
@@ -1425,6 +1425,9 @@ If there is an hypothesis $h:a=b$ in the local context, it can be used for
rewriting not only in logical propositions but also in any type.
% In that case, the term \verb!eq_rec! which was defined as an axiom, is
% now a term of the calculus.
+\begin{coq_eval}
+Require Extraction.
+\end{coq_eval}
\begin{coq_example}
Print eq_rec.
Extraction eq_rec.
diff --git a/doc/refman/RefMan-gal.tex b/doc/refman/RefMan-gal.tex
index 71977d3e9..ef12fe416 100644
--- a/doc/refman/RefMan-gal.tex
+++ b/doc/refman/RefMan-gal.tex
@@ -37,7 +37,7 @@ Similarly, the notation ``\nelist{\entry}{}'' stands for a non
empty sequence of expressions parsed by the ``{\entry}'' entry,
without any separator between.
-At the end, the notation ``\sequence{\entry}{\tt sep}'' stands for a
+Finally, the notation ``\sequence{\entry}{\tt sep}'' stands for a
possibly empty sequence of expressions parsed by the ``{\entry}'' entry,
separated by the literal ``{\tt sep}''.
diff --git a/doc/refman/RefMan-int.tex b/doc/refman/RefMan-int.tex
index fbeccb664..2b9e4e605 100644
--- a/doc/refman/RefMan-int.tex
+++ b/doc/refman/RefMan-int.tex
@@ -58,7 +58,7 @@ Chapter~\ref{Addoc-coqide}.
\section*{How to read this book}
-This is a Reference Manual, not a User Manual, then it is not made for a
+This is a Reference Manual, not a User Manual, so it is not made for a
continuous reading. However, it has some structure that is explained
below.
@@ -100,6 +100,11 @@ corresponds to the Chapter~\ref{Addoc-syntax}.
presented.
Finally, Chapter~\ref{Addoc-coqide} describes the \Coq{} integrated
development environment.
+
+\item The fifth part documents a number of advanced features, including
+ coercions, canonical structures, typeclasses, program extraction, and
+ specialized solvers and tactics. See the table of contents for a complete
+ list.
\end{itemize}
At the end of the document, after the global index, the user can find
@@ -120,15 +125,6 @@ documents:
user can read also the tutorial on recursive types (document {\tt
RecTutorial.ps}).
-\item[Addendum] The fifth part (the Addendum) of the Reference Manual
- is distributed as a separate document. It contains more
- detailed documentation and examples about some specific aspects of the
- system that may interest only certain users. It shares the indexes,
- the page numbers and
- the bibliography with the Reference Manual. If you see in one of the
- indexes a page number that is outside the Reference Manual, it refers
- to the Addendum.
-
\item[Installation] A text file INSTALL that comes with the sources
explains how to install \Coq{}.
diff --git a/doc/refman/RefMan-oth.tex b/doc/refman/RefMan-oth.tex
index 3daaac88b..8f43ebcfb 100644
--- a/doc/refman/RefMan-oth.tex
+++ b/doc/refman/RefMan-oth.tex
@@ -656,7 +656,7 @@ dynamically.
searched into the current {\ocaml} loadpath (see the command {\tt
Add ML Path} in the Section~\ref{loadpath}). Loading of {\ocaml}
files is only possible under the bytecode version of {\tt coqtop}
-(i.e. {\tt coqtop} called with options {\tt -byte}, see chapter
+(i.e. {\tt coqtop.byte}, see chapter
\ref{Addoc-coqc}), or when {\Coq} has been compiled with a version of
{\ocaml} that supports native {\tt Dynlink} ($\ge$ 3.11).
@@ -739,7 +739,7 @@ the command {\tt Declare ML Module} in the Section~\ref{compiled}).
\subsection[\tt Print ML Path {\str}.]{\tt Print ML Path {\str}.\comindex{Print ML Path}}
This command displays the current {\ocaml} loadpath.
This command makes sense only under the bytecode version of {\tt
-coqtop}, i.e. using option {\tt -byte} (see the
+coqtop}, i.e. {\tt coqtop.byte} (see the
command {\tt Declare ML Module} in the section
\ref{compiled}).
@@ -974,7 +974,20 @@ line provided it does not exceed the printing width (See {\tt Set
Printing Width} above).
\subsection[\tt Test Printing Compact Contexts.]{\tt Test Printing Compact Contexts.\optindex{Printing Compact Contexts}}
-This command displays the current state of compaction of goal d'isolat.
+This command displays the current state of compaction of goal.
+
+
+\subsection[\tt Unset Printing Unfocused.]{\tt Unset Printing Unfocused.\optindex{Printing Unfocused}}
+This command resets the displaying of goals to focused goals only
+(default). Unfocused goals are created by focusing other goals with
+bullets(see~\ref{bullets}) or curly braces (see~\ref{curlybacket}).
+
+\subsection[\tt Set Printing Unfocused.]{\tt Set Printing Unfocused.\optindex{Printing Unfocused}}
+This command enables the displaying of unfocused goals. The goals are
+displayed after the focused ones and are distinguished by a separator.
+
+\subsection[\tt Test Printing Unfocused.]{\tt Test Printing Unfocused.\optindex{Printing Unfocused}}
+This command displays the current state of unfocused goals display.
\subsection[\tt Set Printing Dependent Evars Line.]{\tt Set Printing Dependent Evars Line.\optindex{Printing Dependent Evars Line}}
This command enables the printing of the ``{\tt (dependent evars: \ldots)}''
diff --git a/doc/refman/RefMan-pro.tex b/doc/refman/RefMan-pro.tex
index 95fee3241..eb59ca584 100644
--- a/doc/refman/RefMan-pro.tex
+++ b/doc/refman/RefMan-pro.tex
@@ -308,7 +308,7 @@ last {\tt Focus} command.
Succeeds in the proof is fully unfocused, fails is there are some
goals out of focus.
-\subsection[\tt \{ \textrm{and} \}]{\tt \{ \textrm{and} \}\comindex{\{}\comindex{\}}}
+\subsection[\tt \{ \textrm{and} \}]{\tt \{ \textrm{and} \}\comindex{\{}\comindex{\}}}\label{curlybacket}
The command {\tt \{} (without a terminating period) focuses on the
first goal, much like {\tt Focus.} does, however, the subproof can
only be unfocused when it has been fully solved (\emph{i.e.} when
@@ -327,7 +327,7 @@ unfocus it or focus the next one.
\end{ErrMsgs}
\subsection[Bullets]{Bullets\comindex{+ (command)}
- \comindex{- (command)}\comindex{* (command)}\index{Bullets}}
+ \comindex{- (command)}\comindex{* (command)}\index{Bullets}}\label{bullets}
Alternatively to {\tt \{} and {\tt \}}, proofs can be structured with
bullets. The use of a bullet $b$ for the first time focuses on the
first goal $g$, the same bullet cannot be used again until the proof
diff --git a/doc/refman/RefMan-sch.tex b/doc/refman/RefMan-sch.tex
index d3719bed4..23a1c9b02 100644
--- a/doc/refman/RefMan-sch.tex
+++ b/doc/refman/RefMan-sch.tex
@@ -227,6 +227,7 @@ We define the function \texttt{div2} as follows:
\begin{coq_eval}
Reset Initial.
+Require Import FunInd.
\end{coq_eval}
\begin{coq_example*}
diff --git a/doc/refman/RefMan-ssr.tex b/doc/refman/RefMan-ssr.tex
new file mode 100644
index 000000000..61f7421c4
--- /dev/null
+++ b/doc/refman/RefMan-ssr.tex
@@ -0,0 +1,4932 @@
+\achapter{The SSReflect proof language}
+\aauthor{Georges Gonthier, Assia Mahboubi, Enrico Tassi}
+
+\newcommand{\ssr}{{\sc SSReflect}}
+
+% listing
+\ifhevea\newcommand{\ssrC}[1]{\texttt{#1}}\else\newcommand{\ssrC}[1]{\text{\lstinline!#1!}}\fi
+\ifhevea\renewenvironment{center}{\@open{div}{class="center"}\@open{div}{class="centered"}}{\@close{div}\@close{div}}\fi
+% non-terminal
+%\newcommand\ssrN[2][]{\ensuremath{\langle\mbox{\itshape\rmfamily\small #2}\rangle_{#1}}}
+\newcommand\ssrN[2][]{{\textsl {#2}}\ensuremath{_{#1}}}
+\ifhevea\newcommand{\underbar}[1]{\underline{#1}}\fi
+
+% TODO: only use \ssrC
+\let\ssrL=\lstinline
+
+\newcommand{\iitem}{{\it i-item}}
+\newcommand{\ditem}{{\it d-item}}
+\newcommand{\optional}[1]{{\it[}#1{\it]}}
+\newcommand{\optsep}{{\it|}}
+\newcommand{\idx}[1]{\tacindex{#1 (ssreflect)}}
+\newcommand{\idxC}[1]{\comindex{#1 (ssreflect)}}
+
+\newenvironment{new}%
+ {\begin{Sbox}\begin{minipage}{0.97\textwidth}%
+ \begin{flushright}\textcolor{red}{\fbox{Version 1.3}}%
+ \end{flushright}\noindent}%
+ {\end{minipage}\end{Sbox}\noindent\doublebox{\TheSbox}}
+\section{Introduction}\label{sec:intro}
+
+This chapter describes a set of tactics known as \ssr{}
+originally designed to provide support for the so-called \emph{small scale
+reflection} proof methodology. Despite the original purpose this set of tactic
+is of general interest and is available in Coq starting from version 8.7.
+
+\ssr{} was developed independently of the tactics described in
+Chapter~\ref{Tactics}. Indeed the scope of the tactics part of
+\ssr{} largely overlaps with the standard set of tactics. Eventually
+the overlap will be reduced in future releases of Coq.
+
+Proofs written in \ssr{} typically look quite different from the
+ones written using only tactics as per Chapter~\ref{Tactics}.
+We try to summarise here the most ``visible'' ones in order to
+help the reader already accustomed to the tactics described in
+Chapter~\ref{Tactics}to read this chapter.
+
+The first difference between the tactics described in this
+chapter and the tactics described in Chapter~\ref{Tactics} is the way
+hypotheses are managed (we call this \emph{bookkeeping}).
+In Chapter~\ref{Tactics} the most common
+approach is to avoid moving explicitly hypotheses back and forth
+between the context and the conclusion of the goal. On the contrary
+in \ssr{}
+all bookkeeping is performed on the conclusion of the goal, using for
+that purpose a couple of syntactic constructions behaving similar to
+tacticals (and often named as such in this chapter).
+The \ssrC{:} tactical moves hypotheses from the context to the
+conclusion, while \ssrC{=>} moves hypotheses from the
+conclusion to the context, and \ssrC{in} moves back
+and forth an hypothesis from the context to the conclusion for the
+time of applying an action to it.
+
+While naming hypotheses is commonly done by means of an \ssrC{as}
+clause in the basic model of Chapter~\ref{Tactics}, it is here to
+\ssrC{=>} that this task is devoted. As tactics leave
+new assumptions in the conclusion, and are often followed by
+\ssrC{=>} to explicitly name them.
+While generalizing the goal is normally
+not explicitly needed in Chapter~\ref{Tactics}, it is an explicit
+operation performed by \ssrC{:}.
+
+Beside the difference of bookkeeping model, this chapter includes
+specific tactics which have no explicit counterpart in
+Chapter~\ref{Tactics} such as tactics to mix forward steps and
+generalizations as \ssrC{generally have} or \ssrC{without loss}.
+
+\ssr{} adopts the point of view that rewriting, definition
+expansion and partial evaluation participate all to a same concept of
+rewriting a goal in a larger sense. As such, all these functionalities are
+provided by the \ssrC{rewrite} tactic.
+
+\ssrC{} includes a little language of patterns to select subterms in tactics
+or tacticals where it matters. Its most notable application
+is in the \ssrC{rewrite} tactic, where patterns are used to specify
+where the rewriting step has to take place.
+
+Finally, \ssr{} supports the so-called reflection steps, typically
+allowing to switch back and forth between the computational view and
+logical view of a concept.
+
+To conclude it is worth mentioning that \ssr{} tactics
+can be mixed with non \ssr{} tactics in the same proof,
+or in the same LTac expression. The few exceptions
+to this statement are described in section~\label{sec:compat}.
+
+\iffalse
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection*{How to read this documentation}
+
+The syntax of the tactics is presented as follows:
+\begin{itemize}
+\item \ssrC{terminals} are in typewriter font and \ssrN{non terminals} are
+ between angle brackets.
+\item Optional parts of the grammar are surrounded by \optional{ }
+ brackets. These should not be confused with verbatim brackets
+ \ssrC{[ ]}, which are delimiters in the \ssr{} syntax.
+\item A vertical rule {\optsep} indicates an alternative in the syntax, and
+ should not be confused with a
+ verbatim vertical rule between verbatim brackets \ssrC{[ | ]}.
+\item A non empty list of non terminals (at least one item should be
+ present) is represented by \ssrN{non terminals}$^+$. A possibly empty
+ one is represented by \ssrN{non terminals}$^*$.
+\item In a non empty list of non terminals, items are separated by blanks.
+\end{itemize}
+\fi
+
+% Hevea has no colors
+\ifhevea \else
+\noindent We follow the default color scheme of the \ssr{} mode for
+ProofGeneral provided in the distribution:
+
+\centerline{
+\textcolor{dkblue}{\texttt{tactic}} or \textcolor{dkviolet}{\tt
+ Command} or \textcolor{dkgreen}{\tt keyword} or
+\textcolor{dkpink}{\tt tactical}}
+
+\noindent Closing tactics/tacticals like \ssrC{exact} or \ssrC{by} (see section
+\ref{ssec:termin}) are in red.
+\fi
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection*{Acknowledgments}
+The authors would like to thank Fr\'ed\'eric Blanqui, Fran\,cois Pottier
+and Laurence Rideau for their comments and suggestions.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\newpage\section{Usage}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection{Getting started}\label{sec:files}
+To be available, the tactics presented in this manual need the
+following minimal set of libraries to loaded: {\tt ssreflect.v}, {\tt
+ssrfun.v} and {\tt ssrbool.v}. Moreover, these tactics come with a
+methodology specific to the authors of Ssreflect and which requires a
+few options to be set in a different way than in their default
+way. All in all, this corresponds to working in the following context:
+
+\begin{lstlisting}
+ From Coq Require Import ssreflect ssrfun ssrbool.
+ Set Implicit Arguments.
+ Unset Strict Implicit.
+ Unset Printing Implicit Defensive.
+\end{lstlisting}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection{Compatibility issues}\label{sec:compat}
+Requiring the above modules creates an environment which
+is mostly compatible with the rest of \Coq{}, up to a few discrepancies:
+\begin{itemize}
+\item New keywords (\ssrC{is}) might clash with variable, constant,
+tactic or tactical names, or with quasi-keywords in tactic or
+vernacular notations.
+\item New tactic(al)s names (\ssrC{last}, \ssrC{done}, \ssrC{have},
+ \ssrC{suffices}, \ssrC{suff},
+ \ssrC{without loss}, \ssrC{wlog}, \ssrC{congr}, \ssrC{unlock}) might clash
+ with user tactic names.
+\item Identifiers with both leading and trailing \ssrC{_}, such as \ssrC{_x_},
+are reserved by \ssr{} and cannot appear in scripts.
+\item The extensions to the \ssrC{rewrite} tactic are partly
+incompatible with those available in current versions of \Coq{};
+in particular:
+\ssrC{rewrite .. in (type of k)} or \\ \ssrC{rewrite .. in *} or any other
+variant of \ssrC{rewrite} will not work, and the \ssr{} syntax and semantics for occurrence selection and
+rule chaining is different.
+
+Use an explicit rewrite direction (\ssrC{rewrite <-} $\dots$ or \ssrC{rewrite ->} $\dots$)
+to access the \Coq{} \ssrC{rewrite} tactic.
+\item New symbols (\ssrC{//, /=, //=}) might clash with adjacent existing
+ symbols (e.g., '\ssrC{//}') instead of '\ssrC{/}''\ssrC{/}'). This can be avoided
+ by inserting white spaces.
+\item New constant and theorem names might clash with the user
+theory. This can be avoided by not importing all of \ssr{}:
+\begin{lstlisting}
+ From Coq Require ssreflect.
+ Import ssreflect.SsrSyntax.
+\end{lstlisting}
+Note that the full syntax of \ssr{}'s {\tt rewrite} and reserved identifiers are
+enabled only if the \ssrC{ssreflect} module has been required and if
+\ssrC{SsrSyntax} has been imported. Thus a file that requires (without importing)
+ \ssrC{ssreflect} and imports \ssrC{SsrSyntax}, can be
+required and imported without automatically enabling \ssr{}'s
+extended rewrite syntax and reserved identifiers.
+\item Some user notations (in particular, defining an infix ';') might
+interfere with the "open term", parenthesis free, syntax of tactics
+such as \ssrC{have}, \ssrC{set} and \ssrC{pose}.
+\item The generalization of \ssrC{if} statements to non-Boolean
+conditions is turned off by \ssr{}, because it is mostly subsumed by
+\ssrC{Coercion} to \ssrC{bool} of the \ssrC{sum}XXX types (declared in
+\ssrC{ssrfun.v})
+and the \ssrC{if} {\term} \ssrC{is} \ssrN{pattern} \ssrC{then} {\term} \ssrC{else} {\term} construct (see
+\ref{ssec:patcond}). To use the generalized form, turn off the \ssr{}
+Boolean \ssrC{if} notation using the command:
+\begin{lstlisting}
+ Close Scope boolean_if_scope.
+\end{lstlisting}
+\item The following two options can be unset to disable the
+ incompatible \ssrC{rewrite} syntax and allow
+ reserved identifiers to appear in scripts.
+\begin{lstlisting}
+ Unset SsrRewrite.
+ Unset SsrIdents.
+\end{lstlisting}
+\end{itemize}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{Gallina extensions}
+
+Small-scale reflection makes an extensive use of the programming
+subset of Gallina, \Coq{}'s logical specification language. This subset
+is quite suited to the description of functions on representations,
+because it closely follows the well-established design of the ML
+programming language. The \ssr{} extension provides three additions
+to Gallina, for pattern assignment, pattern testing, and polymorphism;
+these mitigate minor but annoying discrepancies between Gallina and ML.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection{Pattern assignment}\label{ssec:patass}
+The \ssr{} extension provides the following construct for
+irrefutable pattern matching, that is, destructuring assignment:
+
+\ssrC{let: } \ssrN{pattern} \ssrC{:=} \ssrN[1]{term} \ssrC{in} \ssrN[2]{term}
+
+Note the colon `\ssrC{:}' after the \ssrC{let} keyword, which avoids any
+ambiguity with a function
+definition or \Coq{}'s basic destructuring \ssrC{let}. The \ssrC{let:}
+construct differs from the latter in that
+\begin{itemize}
+\item The pattern can be nested (deep pattern matching), in
+ particular, this allows expression of the form:
+\begin{lstlisting}
+ let: exist (x, y) p_xy := Hp in ...
+\end{lstlisting}
+\item The destructured constructor is explicitly given in the
+ pattern, and is used for type inference, e.g.,
+\begin{lstlisting}
+ Let f u := let: (m, n) := u in m + n.
+\end{lstlisting}
+using a colon \ssrC{let:}, infers \ssrC{f : nat * nat -> nat}, whereas
+\begin{lstlisting}
+ Let f u := let (m, n) := u in m + n.
+\end{lstlisting}
+with a usual \ssrC{let}, requires an extra type annotation.
+\end{itemize}
+The \ssrC{let:} construct is just (more legible) notation for the primitive Gallina expression
+
+\begin{center}
+\ssrC{match} \ssrN[1]{term} \ssrC{with} \ssrN{pattern} \ssrC{=>} \ssrN[2]{term} \ssrC{end}
+\end{center}
+
+The \ssr{} destructuring assignment supports all the dependent match
+annotations; the full syntax is
+
+\begin{center}
+\ssrC{let:} \ssrN[1]{pattern} \ssrC{as} \ssrN{ident} \ssrC{in} \ssrN[2]{pattern} \ssrC{:=} \ssrN[1]{term} \ssrC{return} \ssrN[2]{term} \ssrC{in} \ssrN[3]{term}
+\end{center}
+
+where \ssrN[2]{pattern} is a \emph{type} pattern and \ssrN[1]{term} and
+\ssrN[2]{term} are types.
+
+When the \ssrC{as} and \ssrC{return} are both present, then \ssrN{ident} is bound
+in both the type \ssrN[2]{term} and the expression \ssrN[3]{term};
+variables in the optional type pattern \ssrN[2]{pattern} are
+bound only in the type \ssrN[2]{term}, and other variables in \ssrN[1]{pattern} are
+bound only in the expression \ssrN[3]{term}, however.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection{Pattern conditional}\label{ssec:patcond}
+The following construct can be used for a refutable pattern matching,
+that is, pattern testing:
+
+\begin{center}
+\ssrC{if}\ \ssrN[1]{term} \ssrC{is} \ssrN[1]{pattern} \ssrC{then} \ssrN[2]{term} \ssrC{else} \ssrN[3]{term}
+\end{center}
+
+Although this construct is not strictly ML (it does exits in variants
+such as the pattern calculus or the $\rho$-calculus), it turns out to be
+very convenient for writing functions on representations,
+because most such functions manipulate simple datatypes such as Peano
+integers, options,
+lists, or binary trees, and the pattern conditional above is almost
+always the right construct
+for analyzing such simple types. For example, the \ssrC{null} and
+\ssrC{all} list function(al)s can be defined as follows:
+\begin{lstlisting}
+ Variable d: Set.
+ Fixpoint |*null*| (s : list d) := if s is nil then true else false.
+ Variable a : d -> bool.
+ Fixpoint |*all*| (s : list d) : bool :=
+ if s is cons x s' then a x && all s' else true.
+\end{lstlisting}
+
+The pattern conditional also provides a notation for destructuring
+assignment with a refutable pattern, adapted to the pure functional
+setting of Gallina, which lacks a \\\texttt{Match\_Failure} exception.
+
+Like \ssrC{let:} above, the \ssrC{if}$\dots$\ssrC{is} construct is just (more legible)
+notation for the primitive Gallina expression:
+
+\begin{center}
+\ssrC{match} \ssrN[1]{term} \ssrC{with} \ssrN{pattern} \ssrC{=>} \ssrN[2]{term} \ssrC{| _ =>} \ssrN[2]{term} \ssrC{end}
+\end{center}
+
+Similarly, it will always be displayed as the expansion of this form
+in terms of primitive \ssrC{match} expressions (where the default
+expression $\ssrN[3]{term}$ may be replicated).
+
+
+Explicit pattern testing also largely subsumes the generalization of
+the \ssrC{if} construct to all binary datatypes; compare:
+
+\begin{center}
+\ssrC{if} {\term} \ssrC{is inl _ then} \ssrN[l]{term} \ssrC{else} \ssrN[r]{term}
+\end{center}
+
+and:
+
+\begin{center}
+\ssrC{if} {\term} \ssrC{then} \ssrN[l]{term} \ssrC{else} \ssrN[r]{term}
+\end{center}
+
+The latter appears to be marginally shorter, but it is quite
+ambiguous, and indeed often
+requires an explicit annotation term : \ssrC{\{_\}+\{_\}} to type-check,
+which evens the character count.
+
+Therefore, \ssr{} restricts by default the condition of a plain \ssrC{if}
+construct to the standard \ssrC{bool} type; this avoids spurious type
+annotations, e.g., in:
+\begin{lstlisting}
+ Definition |*orb*| b1 b2 := if b1 then true else b2.
+\end{lstlisting}
+As pointed out in section~\ref{sec:compat}, this restriction can be removed with
+the command:
+\begin{lstlisting}
+ Close Scope boolean_if_scope.
+\end{lstlisting}
+Like \ssrC{let:} above, the \ssrC{if} {\term} \ssrC{is} \ssrN{pattern}
+\ssrC{else} {\term} construct
+supports the dependent \ssrC{match} annotations:
+
+\begin{center}
+\ssrC{if} \ssrN[1]{term} \ssrC{is} \ssrN[1]{pattern} \ssrC{as} \ssrN{ident} \ssrC{in} \ssrN[2]{pattern} \ssrC{return} \ssrN[2]{term} \ssrC{then} \ssrN[3]{term} \ssrC{else} \ssrN[4]{term}
+\end{center}
+
+As in \ssrC{let:} the variable \ssrN{ident} (and those in
+the type pattern \ssrN[2]{pattern}) are bound in \ssrN[2]{term}; \ssrN{ident} is
+also bound in \ssrN[3]{term} (but not in \ssrN[4]{term}), while the
+variables in \ssrN[1]{pattern} are bound only in \ssrN[3]{term}.
+
+\noindent
+Another variant allows to treat the else case first:
+
+\begin{center}
+\ssrC{if} \ssrN[1]{term} \ssrC{isn't} \ssrN[1]{pattern} \ssrC{then} \ssrN[2]{term} \ssrC{else} \ssrN[3]{term}
+\end{center}
+
+Note that \ssrN[1]{pattern} eventually binds variables in \ssrN[3]{term}
+and not \ssrN[2]{term}.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection{Parametric polymorphism}\label{ssec:parampoly}
+
+Unlike ML, polymorphism in core Gallina is explicit: the type
+parameters of polymorphic functions must be declared explicitly, and
+supplied at each point of use. However, \Coq{} provides two features
+to suppress redundant parameters:
+\begin{itemize}
+\item Sections are used to provide (possibly implicit) parameters for
+ a set of definitions.
+\item Implicit arguments declarations are used to tell \Coq{} to use
+ type inference to deduce some parameters from the context at each
+ point of call.
+\end{itemize}
+The combination of these features provides a fairly good emulation of ML-style
+polymorphism, but unfortunately this emulation breaks down for
+higher-order programming. Implicit arguments are indeed not inferred
+at all points of use, but only at
+points of call, leading to expressions such as
+\begin{lstlisting}
+ Definition |*all_null*| (s : list T) := all (@null T) s.
+\end{lstlisting}
+Unfortunately, such higher-order expressions are quite frequent in
+representation functions, especially those which use \Coq{}'s
+\ssrC{Structure}s to emulate Haskell type classes.
+
+Therefore, \ssr{} provides a variant of \Coq{}'s implicit argument
+declaration, which causes \Coq{} to fill in some implicit parameters
+at each point of use, e.g., the above definition can be written:
+\begin{lstlisting}
+ Definition |*all_null*| (s : list d) := all null s.
+\end{lstlisting}
+Better yet, it can be omitted entirely, since \ssrC{all_null s} isn't
+much of an improvement over \ssrC{all null s}.
+
+The syntax of the new declaration is
+
+\begin{center}
+\ssrC{Prenex Implicits} \ssrN{ident}$^+$.
+\end{center}
+
+Let us denote $_1 \dots c_n$ the list of identifiers given to a
+\ssrC{Prenex Implicits} command.
+The command checks that each $c_i$ is the name of a functional
+constant, whose implicit arguments are prenex, i.e., the first $n_i >
+0$ arguments of $c_i$ are implicit; then it assigns
+\ssrC{Maximal Implicit} status to these arguments.
+
+As these prenex implicit arguments are ubiquitous and have often large
+display strings, it is strongly recommended to change the default
+display settings of \Coq{} so that they are not printed (except after a
+\ssrC{Set Printing All} command).
+All \ssr{} library files thus start with the incantation
+\begin{lstlisting}
+ Set Implicit Arguments.
+ Unset Strict Implicit.
+ Unset Printing Implicit Defensive.
+\end{lstlisting}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection{Anonymous arguments}
+
+When in a definition, the type of a certain argument is mandatory, but
+not its name, one usually use ``arrow'' abstractions for prenex
+arguments, or the \ssrC{(_ : }{\term}\ssrC{)} syntax for inner arguments.
+In \ssr{}, the latter can be replaced by the open syntax `\ssrC{of\ }{\term}'
+or (equivalently) `\ssrC{& }{\term}', which are both syntactically
+equivalent to a \ssrC{(_ : }{\term}\ssrC{)} expression.
+
+For instance, the usual two-contrsuctor polymorphic type \ssrC{list},
+i.e. the one of the
+standard {\tt List} library, can be defined by the following
+declaration:
+\begin{lstlisting}
+ Inductive list (A : Type) : Type := nil | cons of A & list A.
+\end{lstlisting}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection{Wildcards}\label{ssec:wild}
+
+The terms passed as arguments
+to \ssr{} tactics can contain \emph{holes}, materialized by wildcards
+\ssrC{_}.
+Since \ssr{} allows a more powerful form of type inference for these
+arguments, it enhances the possibilities of using such wildcards.
+These holes are in particular used as a convenient shorthand for
+abstractions, especially in local definitions or type expressions.
+
+Wildcards may be interpreted as abstractions (see for example sections
+\ref{ssec:pose} and \ref{ssec:struct}), or their content can be
+inferred from the whole
+context of the goal (see for example section \ref{ssec:set}).
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{Definitions}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection{Definitions}\label{ssec:pose}
+\idx{pose \dots{} := \dots{}}
+\idx{pose fix \dots{} := \dots{}}
+\idx{pose cofix \dots{} := \dots{}}
+
+The \ssrC{pose} tactic allows to add a defined constant to a
+proof context. \ssr{} generalizes this tactic in several ways.
+In particular, the \ssr{} \ssrC{pose} tactic supports \emph{open syntax}:
+the body of
+the definition does not need surrounding parentheses. For instance:
+\begin{lstlisting}
+ pose t := x + y.
+\end{lstlisting}
+is a valid tactic expression.
+
+The \ssrC{pose} tactic is also improved for the
+local definition of higher order terms.
+Local definitions of functions can use the same syntax as
+global ones. The tactic:
+\begin{lstlisting}
+ pose f x y := x + y.
+\end{lstlisting}
+adds to the context the defined constant:
+\begin{lstlisting}
+ f := fun x y : nat => x + y : nat -> nat -> nat
+\end{lstlisting}
+
+The \ssr{} \ssrC{pose} tactic also supports (co)fixpoints,
+by providing the local counterpart of the
+\ssrC{Fixpoint f := $\dots$ } and \ssrC{CoFixpoint f := $\dots$ } constructs.
+For instance, the following tactic:
+\begin{lstlisting}
+ pose fix f (x y : nat) {struct x} : nat :=
+ if x is S p then S (f p y) else 0.
+\end{lstlisting}
+defines a local fixpoint \ssrC{f}, which mimics the standard \ssrC{plus}
+operation on natural numbers.
+
+Similarly, local cofixpoints can be defined by a tactic of the form:
+\begin{lstlisting}
+ pose cofix f (arg : T) ...
+\end{lstlisting}
+
+The possibility to include wildcards in the body of the definitions
+ offers a smooth
+way of defining local abstractions. The type of ``holes'' is
+guessed by type inference, and the holes are abstracted.
+For instance the tactic:
+\begin{lstlisting}
+ pose f := _ + 1.
+\end{lstlisting}
+is shorthand for:
+\begin{lstlisting}
+ pose f n := n + 1.
+\end{lstlisting}
+
+When the local definition of a function involves both arguments and
+holes, hole abstractions appear first. For instance, the
+tactic:
+\begin{lstlisting}
+ pose f x := x + _.
+\end{lstlisting}
+is shorthand for:
+\begin{lstlisting}
+ pose f n x := x + n.
+\end{lstlisting}
+
+
+The interaction of the \ssrC{pose} tactic with the interpretation of
+implicit arguments results in a powerful and concise syntax for local
+definitions involving dependent types.
+For instance, the tactic:
+\begin{lstlisting}
+ pose f x y := (x, y).
+\end{lstlisting}
+adds to the context the local definition:
+\begin{lstlisting}
+ pose f (Tx Ty : Type) (x : Tx) (y : Ty) := (x, y).
+\end{lstlisting}
+The generalization of wildcards makes the use of the \ssrC{pose} tactic
+resemble ML-like definitions of polymorphic functions.
+
+% The use of \ssrC{Prenex Implicits} declarations (see section
+% \ref{ssec:parampoly}), makes this feature specially convenient.
+% Note that this combines with the interpretation of wildcards, and that
+% it is possible to define:
+% \begin{lstlisting}
+% pose g x y : prod _ nat := (x, y).
+% \end{lstlisting}
+% which is equivalent to:
+% \begin{lstlisting}
+% pose g x (y : nat) := (x, y).
+% \end{lstlisting}
+
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection{Abbreviations}\label{ssec:set}
+\idx{set \dots{} := \dots{}}
+
+
+The \ssr{} \ssrC{set} tactic performs abbreviations: it introduces a
+defined constant for a subterm appearing in the goal and/or in the
+context.
+
+\ssr{} extends the \ssrC{set} tactic by supplying:
+\begin{itemize}
+\item an open syntax, similarly to the \ssrC{pose} tactic;
+\item a more aggressive matching algorithm;
+\item an improved interpretation of wildcards, taking advantage of the
+ matching algorithm;
+\item an improved occurrence selection mechanism allowing to abstract only
+ selected occurrences of a term.
+\end{itemize}
+
+The general syntax of this tactic is
+\begin{center}
+\ssrC{set} \ssrN{ident} \optional{\ssrC{:} \ssrN[1]{term}} \ssrC{:=} \optional{\ssrN{occ-switch}} \ssrN[2]{term}
+\end{center}
+\begin{center}
+\ssrN{occ-switch} ::= \ssrC{\{}[\ssrC{+}|\ssrC{-}] {\naturalnumber}$^*$ \ssrC{\}}
+\end{center}
+
+
+where:
+
+\begin{itemize}
+\item \ssrN{ident} is a fresh identifier chosen by the user.
+\item \ssrN[1]{term} is
+an optional type annotation. The type annotation \ssrN[1]{term} can be
+given in open syntax (no surrounding parentheses). If no \ssrN{occ-switch}
+(described hereafter) is present, it is also
+the case for \ssrN[2]{term}.
+On the other hand, in presence of \ssrN{occ-switch}, parentheses
+surrounding \ssrN[2]{term} are mandatory.
+\item In the occurrence switch \ssrN{occ-switch}, if the first element
+ of the list is a {\naturalnumber}, this element should be a number, and not
+ an Ltac variable. The empty list \ssrC{\{\}} is not interpreted as a
+ valid occurrence switch.
+\end{itemize}
+% For example, the script:
+% \begin{lstlisting}
+% Goal forall (f : nat -> nat)(x y : nat), f x + f x = f x.
+% move=> f x y.
+% \end{lstlisting}
+
+The tactic:
+\begin{lstlisting}
+ set t := f _.
+\end{lstlisting}
+transforms the goal \ssrC{f x + f x = f x} into \ssrC{t + t = t}, adding
+\ssrC{t := f x} to the context, and the tactic:
+\begin{lstlisting}
+ set t := {2}(f _).
+\end{lstlisting}
+transforms it into \ssrC{f x + t = f x}, adding \ssrC{t := f x} to the context.
+
+The type annotation \ssrN[1]{term} may
+contain wildcards, which will be filled with the appropriate value by
+the matching process.
+
+The tactic first tries to find a subterm of the goal matching
+\ssrN[2]{term} (and its type \ssrN[1]{term}),
+and stops at the first subterm it finds. Then the occurrences
+of this subterm selected by the optional \ssrN{occ-switch} are replaced
+by \ssrN{ident} and a definition \ssrN{ident} \ssrC{:=} {\term} is added to
+the context. If no \ssrN{occ-switch} is present, then all the
+occurrences are abstracted.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsubsection*{Matching}
+
+The matching algorithm compares a pattern \textit{term}
+ with a subterm of the goal by comparing their heads
+and then pairwise unifying their arguments (modulo conversion). Head
+symbols match under the following conditions:
+
+\begin{itemize}
+\item If the head of \textit{term} is a constant, then it
+ should be syntactically equal to the head symbol of the subterm.
+\item If this head is a projection of a canonical structure,
+ then canonical structure equations are used for the matching.
+\item If the head of \textit{term} is \emph{not} a constant, the
+ subterm should have the same structure ($\lambda$ abstraction,
+ \ssrC{let}$\dots$\ssrC{in} structure \dots).
+\item If the head of \textit{term} is a hole, the subterm should have
+ at least as many arguments as \textit{term}. For instance the tactic:
+\begin{lstlisting}
+ set t := _ x.
+\end{lstlisting}
+transforms the goal \ssrL-x + y = z- into \ssrC{t y = z} and adds
+\ssrC{t := plus x : nat -> nat} to the context.
+
+\item In the special case where \textit{term} is of the form
+ \ssrC{(let f := }$t_0$ \ssrC{in f) }$t_1\dots t_n$,
+ then the pattern \textit{term} is treated
+as \ssrC{(_ }$t_1\dots t_n$\ssrC{)}. For each subterm in
+the goal having the form $(A\ u_1\dots u_{n'})$ with $n' \geq n$, the
+matching algorithm successively tries to find the largest
+partial application $(A\ u_1\dots u_{i'})$ convertible to the head
+$t_0$ of \textit{term}. For instance the following tactic:
+\begin{lstlisting}
+ set t := (let g y z := y.+1 + z in g) 2.
+\end{lstlisting}
+transforms the goal
+\begin{lstlisting}
+ (let f x y z := x + y + z in f 1) 2 3 = 6.
+\end{lstlisting}
+into \ssrC{t 3 = 6} and adds the local definition of \ssrC{t} to the
+context.
+\end{itemize}
+
+Moreover:
+\begin{itemize}
+\item Multiple holes in \textit{term} are treated as independent
+ placeholders. For instance, the tactic:
+\begin{lstlisting}
+ set t := _ + _.
+\end{lstlisting}
+transforms the goal \ssrC{x + y = z} into \ssrC{t = z} and pushes
+\ssrC{t := x + y : nat} in the context.
+\item The type of the subterm matched should fit the type
+ (possibly casted by some type annotations) of the pattern
+ \textit{term}.
+\item The replacement of the subterm found by the instantiated pattern
+ should not capture variables, hence the following script:
+\begin{lstlisting}
+ Goal forall x : nat, x + 1 = 0.
+ set u := _ + 1.
+\end{lstlisting}
+raises an error message, since \ssrC{x} is bound in the goal.
+\item Typeclass inference should fill in any residual hole, but
+matching should never assign a value to a global existential variable.
+
+\end{itemize}
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsubsection*{Occurrence selection}\label{sssec:occselect}
+
+\ssr{} provides a generic syntax for the selection of occurrences by
+their position indexes. These \emph{occurrence switches} are shared by
+all
+\ssr{} tactics which require control on subterm selection like rewriting,
+generalization, \dots
+
+An \emph{occurrence switch} can be:
+\begin{itemize}
+\item A list \ssrC{\{} {\naturalnumber}$^*$ \ssrC{\}} of occurrences affected by the
+ tactic.
+For instance, the tactic:
+\begin{lstlisting}
+ set x := {1 3}(f 2).
+\end{lstlisting}
+transforms the goal \ssrC{f 2 + f 8 = f 2 + f 2} into
+\ssrC{x + f 8 = f 2 + x}, and adds the abbreviation
+\ssrC{x := f 2} in the
+context. Notice that some occurrences of a
+given term may be hidden to the user, for example because of a
+notation. The vernacular \ssrC{$\texttt{\textcolor{dkviolet}{Set }}$
+ Printing All} command displays all
+these hidden occurrences and should be used to find the correct
+coding of the occurrences to be selected\footnote{Unfortunately,
+even after a call to the Set Printing All command, some occurrences are
+still not displayed to the user, essentially the ones possibly hidden
+in the predicate of a dependent match structure.}. For instance, the
+following script:
+\begin{lstlisting}
+ Notation "a < b":= (le (S a) b).
+ Goal forall x y, x < y -> S x < S y.
+ intros x y; set t := S x.
+\end{lstlisting}
+generates the goal
+\ssrC{t <= y -> t < S y} since \ssrC{x < y} is now a notation for
+\ssrC{S x <= y}.
+\item A list \ssrC{\{}{\naturalnumber}$^+$\ssrC{\}}. This is equivalent to
+ \ssrC{\{} {\naturalnumber}$^+$ \ssrC{\}} but the list should start with a number, and
+ not with an Ltac variable.
+\item A list \ssrC{\{}{\naturalnumber}$^*$\ssrC{\}} of occurrences \emph{not} to be
+ affected by the tactic. For instance, the tactic:
+\begin{lstlisting}
+ set x := {-2}(f 2).
+\end{lstlisting}
+behaves like
+\begin{lstlisting}
+ set x := {1 3}(f 2).
+\end{lstlisting}
+on the goal \ssrL-f 2 + f 8 = f 2 + f 2- which has three occurrences of
+the the term \ssrC{f 2}
+\item In particular, the switch \ssrC{\{+\}} selects \emph{all} the
+ occurrences. This switch is useful to turn
+ off the default behavior of a tactic which automatically clears
+ some assumptions (see section \ref{ssec:discharge} for instance).
+\item The switch \ssrC{\{-\}} imposes that \emph{no} occurrences of the
+ term should be affected by the tactic. The tactic:
+\begin{lstlisting}
+ set x := {-}(f 2).
+\end{lstlisting}
+leaves the goal unchanged and adds the definition \ssrC{x := f 2} to the
+context. This kind of tactic may be used to take advantage of the
+power of the matching algorithm in a local definition, instead of
+copying large terms by hand.
+\end{itemize}
+
+
+It is important to remember that matching \emph{precedes} occurrence
+selection, hence the tactic:
+\begin{lstlisting}
+ set a := {2}(_ + _).
+\end{lstlisting}
+transforms the goal \ssrC{x + y = x + y + z} into \ssrC{x + y = a + z}
+and fails on the goal \\
+\ssrC{(x + y) + (z + z) = z + z} with the error message:
+\begin{lstlisting}
+ User error: only 1 < 2 occurrence of (x + y + (z + z))
+\end{lstlisting}
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection{Localization}\label{ssec:loc}
+
+
+It is possible to define an abbreviation for a term appearing in the
+context of a goal thanks to the \ssrC{in} tactical.
+
+A tactic of the form:
+
+\begin{center}
+ \ssrC{set x :=} {\term} \ssrC{in} \ssrN[1]{fact}\ssrC{...}\ssrN[n]{fact}.
+\end{center}
+
+introduces a defined constant called \ssrC{x} in the context, and folds
+it in the facts \textit{fact$_1 \dots$ fact$_n$}
+The body of \ssrC{x} is the first subterm matching \textit{term} in
+\textit{fact$_1 \dots$ fact$_n$}.
+
+A tactic of the form:
+
+\begin{center}
+ \ssrC{set x :=} {\term} \ssrC{in} \ssrN[1]{fact}\ssrC{...}\ssrN[n]{fact} \ssrC{*.}
+\end{center}
+
+matches {\term} and then folds \ssrC{x} similarly in
+\textit{fact$_1 \dots$ fact$_n$}, but also folds \ssrC{x} in the goal.
+
+A goal \ssrL-x + t = 4-, whose context contains \ssrC{Hx : x = 3}, is left
+unchanged by the tactic:
+\begin{lstlisting}
+ set z := 3 in Hx.
+\end{lstlisting}
+but the context is extended with the definition \ssrC{z := 3} and \ssrC{Hx} becomes
+\ssrC{Hx : x = z}.
+On the same goal and context, the tactic:
+\begin{lstlisting}
+ set z := 3 in Hx *.
+\end{lstlisting}
+will moreover change the goal into \ssrL-x + t = S z-. Indeed, remember
+that \ssrC{4} is just a notation for \ssrC{(S 3)}.
+
+The use of the \ssrC{in} tactical is not limited to the localization of
+abbreviations: for a complete description of the \ssrC{in} tactical, see
+section \ref{ssec:profstack}.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{Basic tactics}\label{sec:book}
+
+
+
+A sizable fraction of proof scripts consists of steps that do not
+"prove" anything new, but instead perform menial bookkeeping tasks
+such as selecting the names of constants and assumptions or splitting
+conjuncts. Although they are logically trivial, bookkeeping steps are
+extremely important because they define the structure of the data-flow
+of a proof script. This is especially true for reflection-based
+proofs, which often involve large numbers of constants and
+assumptions. Good bookkeeping consists in always explicitly declaring
+(i.e., naming) all new constants and assumptions in the script, and
+systematically pruning irrelevant constants and assumptions in the
+context. This is essential in the context of an interactive
+development environment (IDE), because it facilitates navigating the
+proof, allowing to instantly "jump back" to the point at which a
+questionable assumption was added, and to find relevant assumptions by
+browsing the pruned context. While novice or casual \Coq{} users may
+find the automatic name selection feature convenient, the usage of
+such a feature severely undermines the readability and maintainability
+of proof scripts, much like automatic variable declaration in programming
+languages. The \ssr{} tactics are therefore designed to support
+precise bookkeeping and to eliminate name generation heuristics.
+The bookkeeping features of \ssr{} are implemented as tacticals (or
+pseudo-tacticals), shared across most \ssr{} tactics, and thus form
+the foundation of the \ssr{} proof language.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection{Bookkeeping}\label{ssec:profstack}
+\idx{move: \dots{}}
+\idx{move=> \dots{}}
+\idx{move: \dots{} => \dots{}}
+\idx{\dots{} in \dots{}}
+
+During the course of a proof \Coq{} always present the user with
+a \emph{sequent} whose general form is
+\begin{displaymath}\begin{array}{l}
+%\arrayrulecolor{dkviolet}
+c_i\ \ssrC{:}\ T_i \\
+\dots\\
+d_j\ \ssrC{:=}\ e_j\ \ssrC{:}\ T_j \\
+\dots\\
+F_k\ \ssrC{:}\ P_k \\
+\dots \\[3pt]
+\hline\hline\\[-8pt]
+\ssrC{forall}\ \ssrC{(}x_\ell\ \ssrC{:}\ T_\ell\ssrC{)}\ \dots,\\
+\ssrC{let}\ y_m\ \ssrC{:=}\ b_m\ \ssrC{in}\ \dots\ \ssrC{in}\\
+P_n\ \ssrC{->}\ \dots\ \ssrC{->}\ C
+\end{array}\end{displaymath}
+The \emph{goal} to be proved appears below the double line; above the line is
+the \emph{context} of the sequent, a set of declarations of
+\emph{constants}~$c_i$, \emph{defined constants}~$d_i$, and
+\emph{facts}~$F_k$ that can be used to prove the goal (usually, $T_i,
+T_j\;:\;\ssrC{Type}$ and $P_k\;:\;\ssrC{Prop}$). The various kinds of
+declarations can come in any order. The top part of the context
+consists of declarations produced by the \ssrC{Section} commands
+\ssrC{Variable}, \ssrC{Let}, and \ssrC{Hypothesis}. This \emph{section context}
+is never affected by the \ssr{} tactics: they only operate on
+the lower part --- the \emph{proof context}.
+As in the figure above, the goal often decomposes into a series of
+(universally) quantified \emph{variables}
+$\ssrC{(}x_\ell\;\ssrC{:}\;T_\ell\ssrC{)}$, local \emph{definitions}
+$\ssrC{let}\;y_m\:\ssrC{:=}\;b_m\;\ssrC{in}$, and \emph{assumptions}
+$P_n\;\ssrC{->}$, and a \emph{conclusion}~$C$ (as in the context, variables,
+definitions, and assumptions can appear in any order). The conclusion
+is what actually needs to be proved --- the rest of the goal can be
+seen as a part of the proof context that happens to be ``below the line''.
+
+However, although they are logically equivalent, there are fundamental
+differences between constants and facts on the one hand, and variables
+and assumptions on the others. Constants and facts are
+\emph{unordered}, but \emph{named} explicitly in the proof text;
+variables and assumptions are \emph{ordered}, but \emph{unnamed}: the
+display names of variables may change at any time because of
+$\alpha$-conversion.
+
+Similarly, basic deductive steps such as \ssrC{apply} can only operate on
+the goal because the Gallina terms that control their action (e.g.,
+the type of the lemma used by \ssrC{apply}) only provide unnamed bound
+variables.\footnote{Thus scripts that depend on bound variable names, e.g.,
+via \ssrC{intros} or \ssrC{with}, are inherently fragile.} Since the proof
+script can only refer directly to the context, it must constantly
+shift declarations from the goal to the context and conversely in
+between deductive steps.
+
+In \ssr{} these moves are performed by two \emph{tacticals} `\ssrC{=>}'
+and `\ssrC{:}', so that the bookkeeping required by a deductive step can
+be directly associated to that step, and that tactics in an \ssr{}
+script correspond to actual logical steps in the proof rather than
+merely shuffle facts. Still, some isolated bookkeeping is unavoidable,
+such as naming variables and assumptions at the beginning of a proof.
+\ssr{} provides a specific \ssrC{move} tactic for this purpose.
+
+Now \ssrC{move} does essentially nothing: it is mostly a placeholder for
+`\ssrC{=>}' and `\ssrC{:}'. The `\ssrC{=>}' tactical moves variables, local
+definitions, and assumptions to the context, while the `\ssrC{:}'
+tactical moves facts and constants to the goal. For example, the proof
+of\footnote{The name \ssrC{subnK} reads as
+``right cancellation rule for \ssrC{nat} subtraction''.}
+\begin{lstlisting}
+ Lemma |*subnK*| : forall m n, n <= m -> m - n + n = m.
+\end{lstlisting}\noindent
+might start with
+\begin{lstlisting}
+ move=> m n le_n_m.
+\end{lstlisting}
+where \ssrC{move} does nothing, but \ssrL|=> m n le_m_n| changes the
+variables and assumption of the goal in the constants \ssrC{m n : nat}
+and the fact \ssrL|le_n_m : n <= m|, thus exposing the conclusion\\
+ \ssrC{m - n + n = m}.
+
+The `\ssrC{:}' tactical is the converse of `\ssrC{=>}': it removes facts
+and constants from the context by turning them into variables and assumptions.
+Thus
+\begin{lstlisting}
+ move: m le_n_m.
+\end{lstlisting}
+turns back \ssrC{m} and \ssrL|le_m_n| into a variable and an assumption, removing
+them from the proof context, and changing the goal to
+\begin{lstlisting}
+ forall m, n <= m -> m - n + n = m.
+\end{lstlisting}
+which can be proved by induction on \ssrC{n} using \ssrC{elim: n}.
+
+\noindent
+Because they are tacticals, `\ssrC{:}' and `\ssrC{=>}' can be combined, as in
+\begin{lstlisting}
+ move: m le_n_m => p le_n_p.
+\end{lstlisting}
+simultaneously renames \ssrL|m| and \ssrL|le_m_n| into \ssrL|p| and \ssrL|le_n_p|,
+respectively, by first turning them into unnamed variables, then
+turning these variables back into constants and facts.
+
+Furthermore, \ssr{} redefines the basic \Coq{} tactics \ssrC{case},
+\ssrC{elim}, and \ssrC{apply} so that they can take better advantage of
+'\ssrC{:}' and `\ssrC{=>}'. In there \ssr{} variants, these tactic operate
+on the first variable or constant of the goal and they do not use or
+change the proof context. The `\ssrC{:}' tactical is used to operate on
+an element in the context. For instance the proof of \ssrC{subnK} could
+continue with
+\begin{lstlisting}
+ elim: n.
+\end{lstlisting}
+instead of \ssrC{elim n}; this has the advantage of
+removing \ssrC{n} from the context. Better yet, this \ssrC{elim} can be combined
+with previous \ssrC{move} and with the branching version of the \ssrC{=>} tactical
+(described in~\ref{ssec:intro}),
+to encapsulate the inductive step in a single command:
+\begin{lstlisting}
+ elim: n m le_n_m => [|n IHn] m => [_ | lt_n_m].
+\end{lstlisting}
+which breaks down the proof into two subgoals,
+\begin{lstlisting}
+ m - 0 + 0 = m
+\end{lstlisting}
+given \ssrC{m : nat}, and
+\begin{lstlisting}
+ m - S n + S n = m
+\end{lstlisting}
+given \ssrC{m n : nat}, \ssrL|lt_n_m : S n <= m|, and
+\begin{lstlisting}
+ IHn : forall m, n <= m -> m - n + n = m.
+\end{lstlisting}
+The '\ssrC{:}' and `\ssrC{=>}' tacticals can be explained very simply
+if one views the goal as a stack of variables and assumptions piled
+on a conclusion:
+\begin{itemize}
+\item {\tac} \ssrC{:} $a$ $b$ $c$ pushes the context constants $a$, $b$, $c$
+as goal variables \emph{before} performing {\tac}.
+\item {\tac} \ssrC{=>} $a$ $b$ $c$ pops the top three goal variables as
+context constants $a$, $b$, $c$, \emph{after} {\tac}
+has been performed.
+\end{itemize}
+These pushes and pops do not need to balance out as in the examples above,
+so
+\begin{lstlisting}
+ move: m le_n_m => p.
+\end{lstlisting}
+would rename \ssrC{m} into \ssrC{p}, but leave an extra assumption \ssrC{n <= p}
+in the goal.
+
+Basic tactics like \ssrC{apply} and \ssrC{elim} can also be used without the
+'\ssrC{:}' tactical: for example we can directly start a proof of \ssrC{subnK}
+by induction on the top variable \ssrC{m} with
+\begin{lstlisting}
+ elim=> [|m IHm] n le_n.
+\end{lstlisting}
+
+\noindent
+The general form of the localization tactical \ssrC{in} is also best
+explained in terms of the goal stack:
+
+\begin{center}
+ {\tac} \ssrC{in a H1 H2 *.}
+\end{center}
+
+is basically equivalent to
+
+\begin{center}
+ \ssrC{move: a H1 H2;} {\tac} \ssrC{=> a H1 H2.}
+\end{center}
+
+with two differences: the \ssrC{in} tactical will preserve the body of \ssrC{a} if
+\ssrC{a} is a defined constant, and if the `\ssrC{*}' is omitted it
+will use a temporary abbreviation to hide the statement of the goal
+from \ssrC{/*tactic*/}.
+
+The general form of the \ssrC{in} tactical can be used directly with
+the \ssrC{move}, \ssrC{case} and \ssrC{elim} tactics, so that one can write
+\begin{lstlisting}
+ elim: n => [|n IHn] in m le_n_m *.
+\end{lstlisting}
+instead of
+\begin{lstlisting}
+ elim: n m le_n_m => [|n IHn] m le_n_m.
+\end{lstlisting}
+This is quite useful for inductive proofs that involve many facts.
+
+\noindent See section \ref{ssec:gloc} for the general syntax and presentation
+of the \ssrC{in} tactical.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection{The defective tactics}\label{ssec:basictac}
+
+In this section we briefly present the three basic tactics performing
+context manipulations and the main backward chaining tool.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsubsection*{The \ssrC{move} tactic.}\label{sssec:move}
+\idx{move}
+
+The \ssrC{move} tactic, in its
+defective form, behaves like the primitive \ssrC{hnf} \Coq{} tactic. For
+example, such a defective:
+\begin{lstlisting}
+ move.
+\end{lstlisting}
+exposes the first assumption in the goal, i.e. its changes the goal
+\ssrC{\~ False} into \ssrC{False -> False}.
+
+More precisely, the \ssrC{move} tactic inspects the goal and does nothing
+(\ssrC{idtac}) if an introduction step is possible, i.e. if the
+goal is a product or a \ssrC{let}$\dots$\ssrC{in}, and performs \ssrC{hnf}
+otherwise.
+
+Of course this tactic is most often used in combination with the
+bookkeeping tacticals (see section \ref{ssec:intro} and
+\ref{ssec:discharge}). These combinations mostly subsume the \ssrC{intros},
+\ssrC{generalize}, \ssrC{revert}, \ssrC{rename}, \ssrC{clear} and
+\textcolor{dkblue}{\texttt{pattern}} tactics.
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsubsection*{The \ssrC{case} tactic.}
+\idx{case: \dots{}}
+
+The \ssrC{case} tactic performs
+\emph{primitive case analysis} on (co)inductive types; specifically,
+it destructs the top variable or assumption of the goal,
+exposing its constructor(s) and its arguments, as well as setting the value
+of its type family indices if it belongs to a type family
+(see section \ref{ssec:typefam}).
+
+The \ssr{} \ssrC{case} tactic has a special behavior on
+equalities.
+If the top assumption of the goal is an equality, the \ssrC{case} tactic
+``destructs'' it as a set of equalities between the constructor
+arguments of its left and right hand sides, as per the
+tactic \ssrC{injection}.
+For example, \ssrC{case} changes the goal
+\begin{lstlisting}
+ (x, y) = (1, 2) -> G.
+\end{lstlisting}
+into
+\begin{lstlisting}
+ x = 1 -> y = 2 -> G.
+\end{lstlisting}
+
+Note also that the case of \ssr{} performs \ssrC{False}
+elimination, even if no branch is generated by this case operation.
+Hence the command:
+\begin{lstlisting}
+ case.
+\end{lstlisting}
+on a goal of the form \ssrC{False -> G} will succeed and prove the goal.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsubsection*{The \ssrC{elim} tactic.}
+\idx{elim: \dots{}}
+
+The \ssrC{elim} tactic performs
+inductive elimination on inductive types.
+The defective:
+\begin{lstlisting}
+ elim.
+\end{lstlisting}
+tactic performs inductive elimination on a goal whose top assumption
+has an inductive type. For example on goal of the form:
+\begin{lstlisting}
+ forall n : nat, m <= n
+\end{lstlisting}
+ in a context containing \ssrC{m : nat}, the
+\begin{lstlisting}
+ elim.
+\end{lstlisting}
+tactic produces two goals,
+\begin{lstlisting}
+ m <= 0
+\end{lstlisting}
+on one hand and
+\begin{lstlisting}
+ forall n : nat, m <= n -> m <= S n
+\end{lstlisting}
+on the other hand.
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsubsection*{The \ssrC{apply} tactic.}\label{sssec:apply}
+\idx{apply: \dots{}}
+
+The \ssrC{apply} tactic is the main
+backward chaining tactic of the proof system. It takes as argument any
+\ssrC{/*term*/} and applies it to the goal.
+Assumptions in the type of \ssrC{/*term*/} that don't directly match the
+goal may generate one or more subgoals.
+
+In fact the \ssr{} tactic:
+\begin{lstlisting}
+ apply.
+\end{lstlisting}
+is a synonym for:
+\begin{lstlisting}
+ intro top; first [refine top | refine (top _) | refine (top _ _) | ...]; clear top.
+\end{lstlisting}
+where \ssrC{top} is fresh name, and the sequence of \ssrC{refine} tactics
+tries to catch the appropriate number of wildcards to be inserted.
+Note that this use of the \ssrC{refine} tactic implies that the tactic
+tries to match the goal up to expansion of
+constants and evaluation of subterms.
+
+\ssr{}'s \ssrC{apply} has a special behaviour on goals containing
+existential metavariables of sort \ssrC{Prop}. Consider the
+following example:
+\begin{lstlisting}
+Goal (forall y, 1 < y -> y < 2 -> exists x : { n | n < 3 }, proj1_sig x > 0).
+move=> y y_gt1 y_lt2; apply: (ex_intro _ (exist _ y _)).
+ by apply: gt_trans _ y_lt2.
+by move=> y_lt3; apply: lt_trans y_gt1.
+\end{lstlisting}
+Note that the last \ssrC{_} of the tactic \ssrC{apply: (ex_intro _ (exist _ y _))}
+represents a proof that \ssrC{y < 3}. Instead of generating the following
+goal
+\begin{lstlisting}
+ 0 < (n:=3) (m:=y) ?54
+\end{lstlisting}
+\noindent the system tries to prove \ssrC{y < 3} calling the \ssrC{trivial}
+tactic. If it succeeds, let's say because the context contains
+\ssrC{H : y < 3}, then the system generates the following goal:
+\begin{lstlisting}
+ 0 < proj1_sig (exist (fun n => n < 3) y H
+\end{lstlisting}
+\noindent Otherwise the missing proof is considered to be irrelevant, and
+is thus discharged generating the following goals:
+\begin{lstlisting}
+ y < 3
+ forall H : y < 3, proj1_sig (exist (fun n => n < 3) y H)
+\end{lstlisting}
+Last, the user can replace the \ssrC{trivial} tactic by defining
+an Ltac expression named \ssrC{ssrautoprop}.
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection{Discharge}\label{ssec:discharge}
+\idx{\dots{} : \dots{}}
+
+The general syntax of the discharging tactical `\ssrC{:}' is:
+\begin{center}
+ {\tac} \optional{\ssrN{ident}} \ssrC{:} \ssrN[1]{d-item} $\dots$ \ssrN[n]{d-item} \optional{\ssrN{clear-switch}}
+\end{center}
+where $n > 0$, and \ssrN{d-item} and \ssrN{clear-switch} are defined as
+\begin{longtable}{rcl}
+\ssrN{d-item} & ::= & \optional{\ssrN{occ-switch} {\optsep} \ssrN{clear-switch}} {\term} \\
+\ssrN{clear-switch}& ::=& \ssrC{\{} \ssrN[1]{ident}\, \ldots\, \ssrN[m]{ident} \ssrC{\}}
+\end{longtable}
+with the following requirements:
+\begin{itemize}
+\item {\tac} must be one of the four basic tactics described
+ in~\ref{ssec:basictac}, i.e., \ssrC{move}, \ssrC{case}, \ssrC{elim} or \ssrC{apply},
+ the \ssrC{exact} tactic (section \ref{ssec:termin}),
+ the \ssrC{congr} tactic (section \ref{ssec:congr}), or the application
+ of the \emph{view} tactical `\ssrC{/}' (section \ref{ssec:assumpinterp})
+ to one of \ssrC{move}, \ssrC{case}, or \ssrC{elim}.
+\item The optional \ssrN{ident} specifies \emph{equation generation}
+ (section \ref{ssec:equations}), and is only allowed if {\tac}
+ is \ssrC{move}, \ssrC{case} or \ssrC{elim}, or the application of the
+ view tactical `\ssrC{/}' (section \ref{ssec:assumpinterp})
+ to \ssrC{case} or \ssrC{elim}.
+\item An \ssrN{occ-switch} selects occurrences of {\term},
+ as in \ref{sssec:occselect}; \ssrN{occ-switch} is not allowed if
+ {\tac} is \ssrC{apply} or \ssrC{exact}.
+\item A clear item \ssrN{clear-switch} specifies facts and constants to be
+ deleted from the proof context (as per the \ssrC{clear} tactic).
+\end{itemize}
+The `\ssrC{:}' tactical first \emph{discharges} all the \ssrN{d-item}s,
+right to left, and then performs {\tac}, i.e., for each \ssrN{d-item},
+starting with $\ssrN[n]{d-item}$:
+\begin{enumerate}
+\item The \ssr{} matching algorithm described in section~\ref{ssec:set}
+ is used to find occurrences of {\term} in the goal,
+ after filling any holes `\ssrC{_}' in {\term}; however if {\tac}
+ is \ssrC{apply} or \ssrC{exact} a different matching algorithm,
+ described below, is used
+ \footnote{Also, a slightly different variant may be used for the first
+ \ssrN{d-item} of \ssrC{case} and \ssrC{elim}; see section~\ref{ssec:typefam}.}.
+\item~\label{enum:gen} These occurrences are replaced by a new
+ variable; in particular,
+ if {\term} is a fact, this adds an assumption to the goal.
+\item~\label{enum:clr} If {\term} is \emph{exactly} the name of a constant
+ or fact in the proof context, it is deleted from the context,
+ unless there is an \ssrN{occ-switch}.
+\end{enumerate}
+Finally, {\tac} is performed just after $\ssrN[1]{d-item}$ has been
+generalized ---
+that is, between steps \ref{enum:gen} and \ref{enum:clr} for $\ssrN[1]{d-item}$.
+The names listed in the final \ssrN{clear-switch} (if it is present)
+are cleared first, before $\ssrN[n]{d-item}$ is discharged.
+
+\noindent
+Switches affect the discharging of a \ssrN{d-item} as follows:
+\begin{itemize}
+\item An \ssrN{occ-switch} restricts generalization (step~\ref{enum:gen})
+ to a specific subset of the occurrences of {\term}, as per
+ \ref{sssec:occselect}, and prevents clearing (step~\ref{enum:clr}).
+\item All the names specified by a \ssrN{clear-switch} are deleted from the
+ context in step~\ref{enum:clr}, possibly in addition to {\term}.
+\end{itemize}
+For example, the tactic:
+\begin{lstlisting}
+ move: n {2}n (refl_equal n).
+\end{lstlisting}
+\begin{itemize}
+\item first generalizes \ssrC{(refl_equal n : n = n)};
+\item then generalizes the second occurrence of \ssrC{n}.
+\item finally generalizes all the other occurrences of \ssrC{n},
+ and clears \ssrC{n} from the proof context
+ (assuming \ssrC{n} is a proof constant).
+\end{itemize}
+Therefore this tactic changes any goal \ssrC{G} into
+\begin{lstlisting}
+ forall n n0 : nat, n = n0 -> G.
+\end{lstlisting}
+where the name \ssrC{n0} is picked by the \Coq{} display function,
+and assuming \ssrC{n} appeared only in~\ssrC{G}.
+
+Finally, note that a discharge operation generalizes defined constants
+as variables, and not as local definitions. To override this behavior,
+prefix the name of the local definition with a \ssrC{@},
+like in \ssrC{move: @n}.
+
+This is in contrast with the behavior of the \ssrC{in} tactical (see section
+\ref{ssec:gloc}), which preserves local definitions by default.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsubsection*{Clear rules}
+
+The clear step will fail if {\term} is a proof constant that
+appears in other facts; in that case either the facts should be
+cleared explicitly with a \ssrN{clear-switch}, or the clear step should be
+disabled. The latter can be done by adding an \ssrN{occ-switch} or simply by
+putting parentheses around {\term}: both
+\begin{lstlisting}
+ move: (n).
+\end{lstlisting}
+and
+\begin{lstlisting}
+ move: {+}n.
+\end{lstlisting}
+generalize \ssrC{n} without clearing \ssrC{n} from the proof context.
+
+The clear step will also fail if the \ssrN{clear-switch} contains a
+\ssrN{ident} that is not in the \emph{proof} context.
+Note that \ssr{} never clears a section constant.
+
+If {\tac} is \ssrC{move} or \ssrC{case} and an equation \ssrN{ident} is given,
+then clear (step~\ref{enum:clr}) for $\ssrN[1]{d-item}$ is suppressed
+(see section \ref{ssec:equations}).
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsubsection*{Matching for \ssrC{apply} and \ssrC{exact}}\label{sss:strongapply}
+
+The matching algorithm for \ssrN{d-item}s of the \ssr{} \ssrC{apply} and
+\ssrC{exact} tactics
+exploits the type of $\ssrN[1]{d-item}$ to interpret
+wildcards in the other \ssrN{d-item} and to determine which occurrences of
+these should be generalized.
+Therefore, \ssrN{occur switch}es are not needed for \ssrC{apply} and \ssrC{exact}.
+
+Indeed, the \ssr{} tactic \ssrC{apply: H x} is equivalent to
+\begin{lstlisting}
+ refine (@H _ ... _ x); clear H x
+\end{lstlisting}
+with an appropriate number of wildcards between \ssrC{H} and~\ssrC{x}.
+
+Note that this means that matching for \ssrC{apply} and \ssrC{exact} has
+much more context to interpret wildcards; in particular it can accommodate
+the `\ssrC{_}' \ssrN{d-item}, which would always be rejected after `\ssrC{move:}'.
+For example, the tactic
+\begin{lstlisting}
+ apply: trans_equal (Hfg _) _.
+\end{lstlisting}
+transforms the goal \ssrC{f a = g b}, whose context contains
+\ssrC{(Hfg : forall x, f x = g x)}, into \ssrC{g a = g b}.
+This tactic is equivalent (see section \ref{ssec:profstack}) to:
+\begin{lstlisting}
+ refine (trans_equal (Hfg _) _).
+\end{lstlisting}
+and this is a common idiom for applying transitivity on the left hand side
+of an equation.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsubsection*{The \ssrC{abstract} tactic}\label{ssec:abstract}
+\idx{abstract: \dots{}}
+
+The \ssrC{abstract} tactic assigns an abstract constant previously introduced with
+the \ssrC{[: name ]} intro pattern (see section~\ref{ssec:intro},
+page~\pageref{ssec:introabstract}).
+In a goal like the following:
+\begin{lstlisting}
+ m : nat
+ abs : <hidden>
+ n : nat
+ =============
+ m < 5 + n
+\end{lstlisting}
+The tactic \ssrC{abstract: abs n} first generalizes the goal with respect to
+\ssrC{n} (that is not visible to the abstract constant \ssrC{abs}) and then
+assigns \ssrC{abs}. The resulting goal is:
+\begin{lstlisting}
+ m : nat
+ n : nat
+ =============
+ m < 5 + n
+\end{lstlisting}
+Once this subgoal is closed, all other goals having \ssrC{abs} in their context
+see the type assigned to \ssrC{abs}. In this case:
+\begin{lstlisting}
+ m : nat
+ abs : forall n, m < 5 + n
+\end{lstlisting}
+
+For a more detailed example the user should refer to section~\ref{sssec:have},
+page~\pageref{sec:havetransparent}.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection{Introduction}\label{ssec:intro}
+\idx{\dots{} => \dots{}}
+
+The application of a tactic to a given goal can generate
+(quantified) variables, assumptions, or definitions, which the user may want to
+\emph{introduce} as new facts, constants or defined constants, respectively.
+If the tactic splits the goal into several subgoals,
+each of them may require the introduction of different constants and facts.
+Furthermore it is very common to immediately decompose
+or rewrite with an assumption instead of adding it to the context,
+as the goal can often be simplified and even
+proved after this.
+
+All these operations are performed by the introduction tactical
+`\ssrC{=>}', whose general syntax is
+\begin{center}
+ {\tac} \ssrC{=>} \ssrN[1]{i-item} $\dots$ \ssrN[n]{i-item}
+\end{center}
+where {\tac} can be any tactic, $n > 0$ and
+\begin{longtable}{rcl}
+ \ssrN{i-item}& ::=& \ssrN{i-pattern} {\optsep} \ssrN{s-item} {\optsep} \ssrN{clear-switch} {\optsep} \ssrC{/}{\term} \\
+ \ssrN{s-item}& ::=& \ssrC{/=} {\optsep} \ssrC{//} {\optsep} \ssrC{//=} \\
+ \ssrN{i-pattern}& ::=& \ssrN{ident} {\optsep} \ssrC{_} {\optsep} \ssrC{?} {\optsep} \ssrC{*} {\optsep} \optional{\ssrN{occ-switch}}\ssrC{->} {\optsep} \optional{\ssrN{occ-switch}}\ssrC{<-} {\optsep} \\
+ && \ssrC{[} \ssrN[1]{i-item}$^*$ \ssrC{|} $\dots$ \ssrC{|} \ssrN[m]{i-item}$^*$ \ssrC{]} {\optsep} \ssrC{-} {\optsep} \ssrC{[:} \ssrN{ident}$^+$ \ssrC{]}
+\end{longtable}
+
+The `\ssrC{=>}' tactical first executes {\tac}, then the
+\ssrN{i-item}s, left to right, i.e., starting from $\ssrN[1]{i-item}$. An
+\ssrN{s-item} specifies a simplification operation; a $\ssrN{clear
+switch}$ specifies context pruning as in~\ref{ssec:discharge}. The
+\ssrN{i-pattern}s can be seen as a variant of \emph{intro patterns}~\ref{intros-pattern}:
+each performs an introduction operation, i.e., pops some variables or
+assumptions from the goal.
+
+An \ssrN{s-item} can simplify the set of subgoals or the subgoal themselves:
+\begin{itemize}
+\item \ssrC{//} removes all the ``trivial'' subgoals that can be resolved by
+ the \ssr{} tactic \ssrC{done} described in~\ref{ssec:termin}, i.e., it
+ executes \ssrC{try done}.
+\item \ssrC{/=} simplifies the goal by performing partial evaluation, as
+ per the tactic \ssrC{simpl}.\footnote{Except \ssrC{/=} does not
+ expand the local definitions created by the \ssr{} \ssrC{in} tactical.}
+\item \ssrC{//=} combines both kinds of simplification; it is equivalent
+ to \ssrC{/= //}, i.e., \ssrC{simpl; try done}.
+\end{itemize}
+When an \ssrN{s-item} bears a \ssrN{clear-switch}, then the \ssrN{clear-switch} is
+executed \emph{after} the \ssrN{s-item}, e.g., \ssrL|{IHn}//| will solve
+some subgoals, possibly using the fact \ssrL|IHn|, and will erase \ssrL|IHn|
+from the context of the remaining subgoals.
+
+The last entry in the \ssrN{i-item} grammar rule, \ssrC{/}{\term},
+represents a view (see section~\ref{sec:views}). If $\ssrN[k+1]{i-item}$
+is a view \ssrN{i-item}, the view is applied to the assumption in top
+position once $\ssrN[1]{i-item} \dots \ssrN[k]{i-item}$ have been performed.
+
+The view is applied to the top assumption.
+
+\ssr{} supports the following \ssrN{i-pattern}s:
+\begin{itemize}
+\item \ssrN{ident} pops the top variable, assumption, or local definition into
+ a new constant, fact, or defined constant \ssrN{ident}, respectively.
+ Note that defined constants cannot be introduced when
+ $\delta$-expansion is required to expose the top variable or assumption.
+\item \ssrC{?} pops the top variable into an anonymous constant or fact,
+ whose name is picked by the tactic interpreter.
+ \ssr{} only generates names that
+ cannot appear later in the user script.\footnote{\ssr{} reserves
+ all identifiers of the form ``\ssrC{_x_}'', which is used for such
+ generated names.}
+\item \ssrC{_} pops the top variable into an anonymous constant that will be
+ deleted from
+ the proof context of all the subgoals produced by the \ssrC{=>} tactical.
+ They should thus never be displayed, except in an error message
+ if the constant is still actually used in the goal or context after
+ the last \ssrN{i-item} has been executed (\ssrN{s-item}s can erase goals
+ or terms where the constant appears).
+\item \ssrC{*} pops all the remaining apparent variables/assumptions
+ as anonymous constants/facts. Unlike \ssrC{?} and \ssrC{move} the \ssrC{*}
+ \ssrN{i-item} does not expand definitions in the goal to expose
+ quantifiers, so it may be useful to repeat a \ssrC{move=> *} tactic,
+ e.g., on the goal
+\begin{lstlisting}
+ forall a b : bool, a <> b
+\end{lstlisting}
+a first \ssrC{move=> *} adds only \ssrC{_a_ : bool} and \ssrC{_b_ : bool} to
+the context; it takes a second \ssrC{move=> *} to add
+\ssrC{_Hyp_ : _a_ = _b_}.
+\item $[\ssrN{occ-switch}]$\ssrC{->} (resp. $[\ssrN{occ-switch}]$\ssrC{<-})
+ pops the top assumption
+ (which should be a rewritable proposition) into an anonymous fact,
+ rewrites (resp. rewrites right to left) the goal with this fact
+ (using the \ssr{} \ssrC{rewrite} tactic described in section~\ref{sec:rw},
+ and honoring the optional occurrence selector),
+ and finally deletes the anonymous fact from the context.
+\item\ssrC{[ $\ssrN[1]{i-item}^*$ | $\dots$ | $\ssrN[m]{i-item}^*$ ]},
+ when it is the very \emph{first} \ssrN{i-pattern} after ${\tac}\;\ssrC{=>}$
+ tactical \emph{and} {\tac} is not a \ssrC{move}, is a \emph{branching}
+ \ssrN{i-pattern}. It executes
+ the sequence $\ssrN[i]{i-item}^*$ on the $i^{\rm th}$
+ subgoal produced by {\tac}. The execution of {\tac}
+ should thus generate exactly $m$
+ subgoals, unless the \ssrC{[$\dots$]} \ssrN{i-pattern} comes after an initial
+ \ssrC{//} or \ssrC{//=} \ssrN{s-item} that closes some of the goals produced by
+ {\tac}, in which case exactly $m$ subgoals should remain after the
+ \ssrN{s-item}, or we have the trivial branching \ssrN{i-pattern} \ssrC{[]},
+ which always does nothing, regardless of the number of remaining subgoals.
+\item\ssrC{[ $\ssrN[1]{i-item}^*$ | $\dots$ | $\ssrN[m]{i-item}^*$ ]}, when it is
+ \emph{not} the first \ssrN{i-pattern} or when {\tac} is a
+ \ssrC{move}, is a \emph{destructing} \ssrN{i-pattern}. It starts by
+ destructing the top variable, using the \ssr{} \ssrC{case} tactic
+ described in~\ref{ssec:basictac}. It then behaves as the
+ corresponding branching \ssrN{i-pattern}, executing the sequence
+ $\ssrN[i]{i-item}^*$ in the $i^{\rm th}$ subgoal generated by the case
+ analysis; unless we have the trivial destructing \ssrN{i-pattern}
+ \ssrC{[]}, the latter should generate exactly $m$ subgoals, i.e., the
+ top variable should have an inductive type with exactly $m$
+ constructors.\footnote{More precisely, it should have a quantified
+ inductive type with $a$ assumptions and $m - a$ constructors.}
+ While it is good style to use the $\ssrN[i]{i-item}^*$
+ to pop the variables and assumptions corresponding to each constructor,
+ this is not enforced by \ssr{}.
+\item\ssrC{-} does nothing, but counts as an intro pattern. It can also
+ be used to force the interpretation of
+ \ssrC{[ $\ssrN[1]{i-item}^*$ | $\dots$ | $\ssrN[m]{i-item}^*$ ]}
+ as a case analysis like in \ssrC{move=> -[H1 H2]}. It can also be used
+ to indicate explicitly the link between a view and a name like in
+ \ssrC{move=> /eqP-H1}. Last, it can serve as a separator between
+ views. Section~\ref{ssec:multiview} explains in which respect
+ the tactic \ssrC{move=> /v1/v2} differs from the tactic
+ \ssrC{move=> /v1-/v2}.
+\item\ssrC{[: $\ssrN{ident}^+$ ]} introduces in the context an abstract constant
+ for each \ssrN{ident}. Its type has to be fixed later on by using
+ the \ssrC{abstract} tactic (see page~\pageref{ssec:abstract}). Before then
+ the type displayed is \ssrC{<hidden>}.\label{ssec:introabstract}
+\end{itemize}
+Note that \ssr{} does not support the syntax
+$\ssrC{(}\ssrN{ipat}\ssrC{,}\dots\ssrC{,}\ssrN{ipat}\ssrC{)}$ for destructing
+intro-patterns.
+
+Clears are deferred until the end of the intro pattern. For
+example, given the goal:
+\begin{lstlisting}
+x, y : nat
+==================
+0 < x = true -> (0 < x) && (y < 2) = true
+\end{lstlisting}
+the tactic \ssrC{move=> \{x\} ->} successfully rewrites the goal and
+deletes \ssrC{x} and the anonymous equation. The goal is thus turned into:
+\begin{lstlisting}
+y : nat
+==================
+true && (y < 2) = true
+\end{lstlisting}
+If the cleared names are reused in the same intro pattern, a renaming
+is performed behind the scenes.
+
+Facts mentioned in a clear switch must be valid
+names in the proof context (excluding the section context).
+
+The rules for interpreting branching and destructing \ssrN{i-pattern}
+are motivated by the fact that it would be pointless to have a branching
+pattern if {\tac} is a \ssrC{move}, and in most of the remaining cases
+{\tac} is \ssrC{case} or \ssrC{elim}, which implies destruction.
+The rules above imply that
+\begin{lstlisting}
+ move=> [a b].
+ case=> [a b].
+ case=> a b.
+\end{lstlisting}
+are all equivalent, so which one to use is a matter of style;
+\ssrC{move} should be used for casual decomposition,
+such as splitting a pair, and \ssrC{case} should be used for actual decompositions,
+in particular for type families (see~\ref{ssec:typefam})
+and proof by contradiction.
+
+The trivial branching \ssrN{i-pattern} can be used to force the branching
+interpretation, e.g.,
+\begin{lstlisting}
+ case=> [] [a b] c.
+ move=> [[a b] c].
+ case; case=> a b c.
+\end{lstlisting}
+are all equivalent.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection{Generation of equations}\label{ssec:equations}
+\idx{move eq : \dots{}}
+
+The generation of named equations option stores the definition of a
+new constant as an equation. The tactic:
+\begin{lstlisting}
+ move En: (size l) => n.
+\end{lstlisting}
+where \ssrC{l} is a list, replaces \ssrC{size l} by \ssrC{n} in the goal and
+adds the fact \ssrC{En : size l = n} to the context.
+ This is quite different from:
+\begin{lstlisting}
+ pose n := (size l).
+\end{lstlisting}
+which generates a definition \ssrC{n := (size l)}. It is not possible to
+generalize or
+rewrite such a definition; on the other hand, it is automatically
+expanded during
+computation, whereas expanding the equation \ssrC{En} requires explicit
+rewriting.
+
+The use of this equation name generation option with a \ssrC{case} or an
+\ssrC{elim} tactic changes the status of the first \iitem{}, in order to
+deal with the possible parameters of the constants introduced.
+
+On the
+goal \ssrC{a <> b} where \ssrC{a, b} are natural numbers, the tactic:
+\begin{lstlisting}
+ case E : a => [|n].
+\end{lstlisting}
+generates two subgoals. The equation \ssrC{E : a = 0} (resp. \ssrC{E : a =
+ S n}, and the constant \ssrC{n : nat}) has been added to
+the context of the goal \ssrC{0 <> b} (resp. \ssrC{S n <> b}).
+
+If the user does not provide a branching \iitem{} as first \iitem{},
+or if the \iitem{} does not provide enough names for the arguments of
+a constructor,
+then the constants generated are introduced under fresh \ssr{} names.
+For instance, on the goal \ssrC{a <> b}, the tactic:
+\begin{lstlisting}
+ case E : a => H.
+\end{lstlisting}
+also generates two subgoals, both requiring a proof of \ssrC{False}.
+ The hypotheses \ssrC{E : a = 0} and
+\ssrC{H : 0 = b} (resp. \ssrC{E : a = S _n_} and
+\ssrC{H : S _n_ = b}) have been added to the context of the first
+subgoal (resp. the second subgoal).
+
+Combining the generation of named equations mechanism with the
+\ssrC{case} tactic strengthens the power of a case analysis. On the other
+hand, when combined with the \ssrC{elim} tactic, this feature is mostly
+useful for
+debug purposes, to trace the values of decomposed parameters and
+pinpoint failing branches.
+
+% This feature is also useful
+% to analyse and debug generate-and-test style scripts that prove program
+% properties by generating a large set of input patterns and uniformly
+% solving the corresponding subgoals by computation and rewriting, e.g,
+
+% \begin{lstlisting}
+% case: et => [|e' et]; first by case: s.
+% case: e => //; case: b; case: w.
+% \end{lstlisting}
+% If the above sequence fails, then it's easy enough to replace the line
+% above with
+% \begin{lstlisting}
+% case: et => [|e' et].
+% case Ds: s; case De: e => //; case Db: b; case Dw: w=> [|s' w'] //=.
+% \end{lstlisting}
+% Then the first subgoal that appears will be the failing one, and the
+% equations \ssrC{Ds}, \ssrC{De}, \ssrC{Db}
+% and \ssrC{Dw} will pinpoint its branch. When the constructors of
+% the decomposed type have arguments (like \ssrC{w : (seq nat)}
+% above) these need to be
+% introduced in order to generate the equation, so there should
+% always be an explicit \iitem{} (\ssrC{\[|s' w'\]} above) that
+% assigns names to these arguments. If this \iitem{}
+% is omitted the arguments are introduced with default
+% name; this
+% feature should be
+% avoided except for quick debugging runs (it has some uses in complex tactic
+% sequences, however).
+
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection{Type families}\label{ssec:typefam}
+\idx{case: \dots{} / \dots{}}
+
+When the top assumption of a goal has an inductive type, two
+specific operations are possible: the case analysis performed by the
+\ssrC{case} tactic, and the application of an induction principle,
+performed by the \ssrC{elim} tactic. When this top assumption has an
+inductive type, which is moreover an instance of a type family, \Coq{}
+may need help from the user to specify which occurrences of the parameters
+of the type should be substituted.
+
+A specific \ssrC{/} switch indicates the type family parameters of the
+type of a \ditem{} immediately following this \ssrC{/} switch, using the
+syntax:
+
+\begin{center}
+ \ssrC{[} \ssrC{case} {\optsep} \ssrC{elim} \ssrC{]:} \ssrN{d-item}$^+$ \ssrC{/} \ssrN{d-item}$^*$
+\end{center}
+
+The \ssrN{d-item}s on the right side of the \ssrC{/} switch are discharged
+as described in section \ref{ssec:discharge}. The case analysis or
+elimination will be done on the type of the top assumption after these
+discharge operations.
+
+Every \ssrN{d-item} preceding the \ssrC{/} is interpreted as arguments of this
+type, which should be an instance of an inductive type family. These terms are
+not actually generalized, but rather selected for substitution. Occurrence
+switches can be used to restrict the substitution. If a {\term} is left
+completely implicit (e.g. writing just $\ssrC{\_}$), then a pattern is inferred
+looking at the type of the top assumption. This allows for the compact syntax
+\ssrC{case: \{2\}\_ / eqP}, were \ssrC{\_} is interpreted as \ssrC{(\_ == \_)}. Moreover
+if the \ssrN{d-item}s list is too short, it is padded with an initial
+sequence of $\ssrC{\_}$ of the right length.
+
+Here is a small example on lists. We define first a function which
+adds an element at the end of a given list.
+\begin{lstlisting}
+ Require Import List.
+
+ Section LastCases.
+ Variable A : Type.
+
+ Fixpoint |*add_last*|(a : A)(l : list A): list A :=
+ match l with
+ |nil => a :: nil
+ |hd :: tl => hd :: (add_last a tl)
+ end.
+\end{lstlisting}
+Then we define an inductive predicate for
+case analysis on lists according to their last element:
+\begin{lstlisting}
+ Inductive |*last_spec*| : list A -> Type :=
+ | LastSeq0 : last_spec nil
+ | LastAdd s x : last_spec (add_last x s).
+
+ Theorem |*lastP*| : forall l : list A, last_spec l.
+\end{lstlisting}
+Applied to the goal:
+\begin{lstlisting}
+ Goal forall l : list A, (length l) * 2 = length (app l l).
+\end{lstlisting}
+the command:
+\begin{lstlisting}
+ move=> l; case: (lastP l).
+\end{lstlisting}
+generates two subgoals:
+\begin{lstlisting}
+ length nil * 2 = length (nil ++ nil)
+\end{lstlisting}
+and
+\begin{lstlisting}
+ forall (s : list A) (x : A),
+ length (add_last x s) * 2 = length (add_last x s ++ add_last x s)
+\end{lstlisting}
+both having \ssrC{l : list A} in their context.
+
+Applied to the same goal, the command:
+\begin{lstlisting}
+ move=> l; case: l / (lastP l).
+\end{lstlisting}
+generates the same subgoals but \ssrC{l} has been cleared from both
+contexts.
+
+Again applied to the same goal, the command:
+\begin{lstlisting}
+ move=> l; case: {1 3}l / (lastP l).
+\end{lstlisting}
+generates the subgoals \ssrL-length l * 2 = length (nil ++ l)- and
+\ssrL-forall (s : list A) (x : A), length l * 2 = length (add_last x s++l)-
+where the selected occurrences on the left of the \ssrC{/} switch have
+been substituted with \ssrC{l} instead of being affected by the case
+analysis.
+
+The equation name generation feature combined with a type family \ssrC{/}
+ switch generates an equation for the \emph{first} dependent d-item
+specified by the user.
+Again starting with the above goal, the command:
+\begin{lstlisting}
+ move=> l; case E: {1 3}l / (lastP l)=>[|s x].
+\end{lstlisting}
+adds \ssrC{E : l = nil} and \ssrC{E : l = add_last x s},
+respectively, to the context of the two subgoals it generates.
+
+There must be at least one \emph{d-item} to the left of the \ssrC{/}
+switch; this prevents any
+confusion with the view feature. However, the \ditem{}s to the right of
+the \ssrC{/} are optional, and if they are omitted the first assumption
+provides the instance of the type family.
+
+The equation always refers to the first \emph{d-item} in the actual
+tactic call, before any padding with initial $\ssrC{\_}$s. Thus, if an
+inductive type has two family parameters, it is possible to have
+\ssr{} generate an equation for the second one by omitting the pattern
+for the first; note however that this will fail if the type of the
+second parameter depends on the value of the first parameter.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{Control flow}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection{Indentation and bullets}\label{ssec:indent}
+
+A linear development of \Coq{} scripts gives little information on
+the structure of the proof. In addition, replaying a proof after some
+changes in the statement to be proved will usually not display information to
+distinguish between the various branches of case analysis for instance.
+
+To help the user in this organization of the proof script at
+development time, \ssr{} provides some bullets to highlight the
+structure of branching proofs. The available bullets are \ssrC{-},
+\ssrC{+} and \ssrC{*}. Combined with tabulation, this lets us highlight four
+nested levels of branching; the most we have ever
+needed is three. Indeed, the use of ``simpl and closing'' switches, of
+terminators (see above section \ref{ssec:termin}) and selectors (see
+ section \ref{ssec:select}) is powerful enough
+to avoid most of the time more than two levels of indentation.
+
+Here is a fragment of such a structured script:
+
+\begin{lstlisting}
+case E1: (abezoutn _ _) => [[| k1] [| k2]].
+- rewrite !muln0 !gexpn0 mulg1 => H1.
+ move/eqP: (sym_equal F0); rewrite -H1 orderg1 eqn_mul1.
+ by case/andP; move/eqP.
+- rewrite muln0 gexpn0 mulg1 => H1.
+ have F1: t %| t * S k2.+1 - 1.
+ apply: (@dvdn_trans (orderg x)); first by rewrite F0; exact: dvdn_mull.
+ rewrite orderg_dvd; apply/eqP; apply: (mulgI x).
+ rewrite -{1}(gexpn1 x) mulg1 gexpn_add leq_add_sub //.
+ by move: P1; case t.
+ rewrite dvdn_subr in F1; last by exact: dvdn_mulr.
+ + rewrite H1 F0 -{2}(muln1 (p ^ l)); congr (_ * _).
+ by apply/eqP; rewrite -dvdn1.
+ + by move: P1; case: (t) => [| [| s1]].
+- rewrite muln0 gexpn0 mul1g => H1.
+...
+\end{lstlisting}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection{Terminators}\label{ssec:termin}
+\idx{by \dots{}}
+
+To further structure scripts, \ssr{}
+supplies \emph{terminating} tacticals to explicitly close off tactics.
+When replaying scripts, we then have the nice property that
+an error immediately occurs when a closed tactic fails to prove its
+subgoal.
+
+It is hence recommended practice that the proof of any subgoal should
+end with a tactic which \emph{fails if it does not solve the current
+ goal}, like \ssrC{discriminate}, \ssrC{contradiction} or \ssrC{assumption}.
+
+In fact, \ssr{} provides a generic tactical which turns any tactic into
+a closing one (similar to \ssrC{now}). Its general syntax is:
+
+\begin{center}
+ \ssrC{by} {\tac}\ssrC{.}
+\end{center}
+
+The Ltac expression:
+
+\begin{center}
+ \ssrC{by [}\ssrN[1]{tactic} \ssrC{| [}\ssrN[2]{tactic} \ssrC{| ...].}
+\end{center}
+
+is equivalent to:
+
+\begin{center}
+ \ssrC{[by} \ssrN[1]{tactic} \ssrC{| by} \ssrN[2]{tactic} \ssrC{| ...].}
+\end{center}
+
+and this form should be preferred to the former.
+
+In the script provided as example in section \ref{ssec:indent}, the
+paragraph corresponding to each sub-case ends with a tactic line prefixed
+with a \ssrC{by}, like in:
+
+\begin{center}
+ \ssrC{by apply/eqP; rewrite -dvdn1.}
+\end{center}
+
+
+The \ssrC{by} tactical is implemented using the user-defined,
+and extensible \ssrC{done} tactic. This \ssrC{done} tactic tries to solve
+the current goal by some trivial means and fails if it doesn't succeed.
+Indeed, the tactic expression:
+
+\begin{center}
+ \ssrC{by} {\tac}\ssrC{.}
+\end{center}
+
+is equivalent to:
+
+\begin{center}
+ {\tac}\ssrC{; done.}
+\end{center}
+
+Conversely, the tactic
+
+\begin{center}
+ \ssrC{by [ ].}
+\end{center}
+
+is equivalent to:
+
+\begin{center}
+ \ssrC{done.}
+\end{center}
+
+The default implementation of the \ssrC{done} tactic, in the {\tt
+ ssreflect.v} file, is:
+
+\begin{lstlisting}
+Ltac done :=
+ trivial; hnf; intros; solve
+ [ do ![solve [trivial | apply: sym_equal; trivial]
+ | discriminate | contradiction | split]
+ | case not_locked_false_eq_true; assumption
+ | match goal with H : ~ _ |- _ => solve [case H; trivial] end ].
+\end{lstlisting}
+
+The lemma \ssrC{|*not_locked_false_eq_true*|} is needed to discriminate
+\emph{locked} boolean predicates (see section \ref{ssec:lock}).
+The iterator tactical \ssrC{do} is presented in section
+\ref{ssec:iter}.
+This tactic can be customized by the user, for instance to include an
+\ssrC{auto} tactic.
+
+A natural and common way of closing a goal is to apply a lemma which
+is the \ssrC{exact} one needed for the goal to be solved. The defective
+form of the tactic:
+\begin{lstlisting}
+ exact.
+\end{lstlisting}
+is equivalent to:
+\begin{lstlisting}
+ do [done | by move=> top; apply top].
+\end{lstlisting}
+where \ssrC{top} is a fresh name affected to the top assumption of the goal.
+This applied form is supported by the \ssrC{:} discharge tactical, and
+the tactic:
+\begin{lstlisting}
+ exact: MyLemma.
+\end{lstlisting}
+is equivalent to:
+\begin{lstlisting}
+ by apply: MyLemma.
+\end{lstlisting}
+(see section \ref{sss:strongapply} for the documentation of the \ssrC{apply:}
+combination).
+
+\textit{Warning} The list of tactics, possibly chained by
+semi-columns, that follows a \ssrC{by} keyword is considered as a
+parenthesized block
+applied to the current goal. Hence for example if the tactic:
+\begin{lstlisting}
+ by rewrite my_lemma1.
+\end{lstlisting}
+succeeds, then the tactic:
+\begin{lstlisting}
+ by rewrite my_lemma1; apply my_lemma2.
+\end{lstlisting}
+usually fails since it is equivalent to:
+\begin{lstlisting}
+ by (rewrite my_lemma1; apply my_lemma2).
+\end{lstlisting}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection{Selectors}\label{ssec:select}
+\idx{last \dots{} first}
+\idx{first \dots{} last}
+
+When composing tactics, the two tacticals \ssrC{first} and
+\ssrC{last} let the user restrict the application of a tactic to only one
+of the subgoals generated by the previous tactic. This
+covers the frequent cases where a tactic generates two subgoals one of
+which can be easily disposed of.
+
+This is an other powerful way of linearization of scripts, since it
+happens very often that a trivial subgoal can be solved in a less than
+one line tactic. For instance, the tactic:
+
+\begin{center}
+ \ssrN[1]{tactic}\ssrC{; last by} \ssrN[2]{tactic}\ssrC{.}
+\end{center}
+
+tries to solve the last subgoal generated by \ssrN[1]{tactic} using the
+\ssrN[2]{tactic}, and fails if it does not succeeds. Its analogous
+
+\begin{center}
+ \ssrN[1]{tactic}\ssrC{; first by} \ssrN[2]{tactic}.
+\end{center}
+
+tries to solve the first subgoal generated by \ssrN[1]{tactic} using the
+tactic \ssrN[2]{tactic}, and fails if it does not succeeds.
+
+
+\ssr{} also offers an extension of this facility, by supplying
+tactics to \emph{permute} the subgoals generated by a tactic.
+The tactic:
+
+\begin{center}
+ {\tac}\ssrC{; last first.}
+\end{center}
+
+inverts the order of the subgoals generated by {\tac}. It is
+equivalent to:
+
+\begin{center}
+ {\tac}\ssrC{; first last.}
+\end{center}
+
+
+More generally, the tactic:
+
+\begin{center}
+ {\tac}\ssrC{; last }${\naturalnumber}$ \ssrC{first.}
+\end{center}
+
+where ${\naturalnumber}$ is
+a \Coq{} numeral, or and Ltac variable denoting
+a \Coq{} numeral, having the value $k$. It
+rotates the $n$ subgoals $G_1,
+\dots, G_n$ generated by {\tac}. The first subgoal becomes
+$G_{n + 1 - k}$ and the circular order of subgoals remains unchanged.
+
+Conversely, the tactic:
+
+ {\tac}\ssrC{; first }${\naturalnumber}$ \ssrC{last.}
+
+rotates the $n$ subgoals $G_1,
+\dots, G_n$ generated by \ssrC{tactic} in order that the first subgoal
+becomes $G_{k}$.
+
+Finally, the tactics \ssrC{last} and \ssrC{first} combine with the
+branching syntax of Ltac:
+if the tactic $\ssrN[0]{tactic}$ generates $n$
+subgoals on a given goal, then the tactic
+
+ $tactic_0$\ssrC{; last }${\naturalnumber}$ \ssrC{[}$tactic_1$\ssrC{|}$\dots$\ssrC{|}$tactic_m$\ssrC{] || }$tactic_{m+1}$\ssrC{.}
+
+where ${\naturalnumber}$ denotes the integer $k$ as above, applies $tactic_1$ to the
+$n -k + 1$-th goal, $\dots tactic_m$ to the $n -k + 2 - m$-th
+goal and $tactic_{m+1}$ to the others.
+
+For instance, the script:
+\begin{lstlisting}
+ Inductive test : nat -> Prop :=
+ C1 : forall n, test n | C2 : forall n, test n |
+ C3 : forall n, test n | C4 : forall n, test n.
+
+ Goal forall n, test n -> True.
+ move=> n t; case: t; last 2 [move=> k| move=> l]; idtac.
+\end{lstlisting}
+
+creates a goal with four subgoals, the first and the last being
+\ssrC{nat -> True}, the second and the third being \ssrC{True} with
+respectively \ssrC{k : nat} and \ssrC{l : nat} in their context.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection{Iteration}\label{ssec:iter}
+\idx{do \dots{} [ \dots{} ]}
+
+\ssr{} offers an accurate control on the repetition of
+tactics, thanks to the \ssrC{do} tactical, whose general syntax is:
+
+\begin{center}
+ \ssrC{do} \optional{\ssrN{mult}} \ssrC{[} \ssrN[1]{tactic} \ssrC{|} $\dots$ \ssrC{|} \ssrN[n]{tactic} \ssrC{]}
+\end{center}
+where \ssrN{mult} is a \emph{multiplier}.
+
+Brackets can only be omitted if a single tactic is given \emph{and} a
+multiplier is present.
+
+A tactic of the form:
+
+\begin{center}
+ \ssrC{do [} \tac$_1$ \ssrC{|} $\dots$ \ssrC{|} \tac$_n$\ssrC{].}
+\end{center}
+
+is equivalent to the standard Ltac expression:
+
+\begin{center}
+ \ssrC{first [} \tac$_1$ \ssrC{|} $\dots$ \ssrC{|} \tac$_n$\ssrC{].}
+\end{center}
+
+
+The optional multiplier \ssrN{mult} specifies how many times
+the action of {\tac} should be repeated on the current subgoal.
+
+There are four kinds of multipliers:
+ \begin{itemize}
+ \item \ssrC{n!}: the step {\tac} is repeated exactly $n$ times
+ (where $n$ is a positive integer argument).
+ \item \ssrC{!}: the step {\tac} is repeated as many times as possible,
+ and done at least once.
+ \item \ssrC{?}: the step {\tac} is repeated as many times as possible,
+ optionally.
+ \item \ssrC{n?}: the step {\tac} is repeated up to $n$ times,
+ optionally.
+ \end{itemize}
+
+For instance, the tactic:
+
+\begin{center}
+ {\tac} \ssrL+; do 1?rewrite mult_comm.+
+\end{center}
+
+rewrites at most one time the lemma \ssrC{mult_com} in all the subgoals
+generated by {\tac} , whereas the tactic:
+
+\begin{center}
+ {\tac} \ssrL+; do 2!rewrite mult_comm.+
+\end{center}
+
+rewrites exactly two times the lemma \ssrC{mult_com} in all the subgoals
+generated by {\tac}, and fails if this rewrite is not possible
+in some subgoal.
+
+Note that the combination of multipliers and \ssrC{rewrite} is so often
+used that multipliers are in fact integrated to the syntax of the \ssr{}
+\ssrC{rewrite} tactic, see section \ref{sec:rw}.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection{Localization}\label{ssec:gloc}
+\idx{\dots{} in \dots{}}
+
+In sections \ref{ssec:loc} and \ref{ssec:profstack}, we have already
+presented the \emph{localization} tactical \ssrC{in}, whose general
+syntax is:
+\begin{center}
+ {\tac} \ssrC{in} \ssrN{ident}$^+$ \optional{\ssrC{*}}
+\end{center}
+
+where \ssrN{ident}$^+$ is a non empty list of fact
+names in the context. On the left side of \ssrC{in}, {\tac} can be
+\ssrC{move}, \ssrC{case}, \ssrC{elim}, \ssrC{rewrite}, \ssrC{set},
+ or any tactic formed with the general iteration tactical \ssrC{do} (see
+ section \ref{ssec:iter}).
+
+The operation described by {\tac} is performed in the facts
+listed in \ssrN{ident}$^+$ and in the goal if a \ssrC{*} ends
+the list.
+
+The \ssrC{in} tactical successively:
+\begin{itemize}
+\item generalizes the selected hypotheses, possibly ``protecting'' the
+ goal if \ssrC{*} is not present,
+\item performs {\tac}, on the obtained goal,
+\item reintroduces the generalized facts, under the same names.
+\end{itemize}
+
+This defective form of the \ssrC{do} tactical is useful to avoid clashes
+between standard Ltac \ssrC{in} and the \ssr{} tactical \ssrC{in}.
+For example, in the following script:
+\begin{lstlisting}
+ Ltac |*mytac*| H := rewrite H.
+
+ Goal forall x y, x = y -> y = 3 -> x + y = 6.
+ move=> x y H1 H2.
+ do [mytac H2] in H1 *.
+\end{lstlisting}
+the last tactic rewrites the hypothesis \ssrC{H2 : y = 3} both in
+\ssrC{H1 : x = y} and in the goal \ssrC{x + y = 6}.
+
+By default \ssrC{in} keeps the body of local definitions. To erase
+the body of a local definition during the generalization phase,
+the name of the local definition must be written between parentheses,
+like in \ssrC{rewrite H in H1 (def_n) $\;\;$H2}.
+
+From \ssr{} 1.5 the grammar for the \ssrC{in} tactical has been extended
+to the following one:
+
+\begin{center}
+ {\tac} \ssrC{in} \optional{
+ \ssrN{clear-switch} {\optsep}
+ \optional{\ssrC{@}}\ssrN{ident} {\optsep}
+ \ssrC{(}\ssrN{ident}\ssrC{)} {\optsep}
+ \ssrC{(}\optional{\ssrC{@}}\ssrN{ident} \ssrC{:=} \ssrN{c-pattern}\ssrC{)}
+ }$^+$ \optional{\ssrC{*}}
+\end{center}
+
+In its simplest form the last option lets one rename hypotheses that can't be
+cleared (like section variables). For example \ssrC{(y := x)} generalizes
+over \ssrC{x} and reintroduces the generalized
+variable under the name \ssrC{y} (and does not clear \ssrC{x}).\\
+For a more precise description the $\ssrC{(}[\ssrC{@}]\ssrN{ident}\ \ssrC{:=}\ \ssrN{c-pattern}\ssrC{)}$
+item refer to the ``Advanced generalization'' paragraph at page~\pageref{par:advancedgen}.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection{Structure}\label{ssec:struct}
+
+Forward reasoning structures the script by explicitly specifying some
+assumptions to be added to the proof context. It is closely associated
+with the declarative style of proof, since an extensive use of these
+highlighted statements
+make the script closer to a (very detailed) text book proof.
+
+Forward chaining tactics allow to state an intermediate lemma and start a
+piece of script dedicated to the proof of this statement. The use of
+closing tactics (see section \ref{ssec:termin}) and of
+indentation makes syntactically explicit the portion of the script
+building the proof of the intermediate statement.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsubsection*{The \ssrC{have} tactic.}
+\label{sssec:have}
+\idx{have: \dots{}}
+\idx{have: \dots{} := \dots{}}
+
+The main \ssr{} forward reasoning tactic is the \ssrC{have} tactic. It
+can be use in two modes: one starts a new (sub)proof for an
+intermediate result in the main proof, and the other
+provides explicitly a proof term for this intermediate step.
+
+In the first mode, the syntax of \ssrC{have} in its defective form is:
+
+ \ssrC{have: }{\term}\ssrC{.}
+
+This tactic supports open syntax for {\term}.
+Applied to a goal \ssrC{G}, it generates a first subgoal requiring a
+proof of {\term} in the context of \ssrC{G}. The second generated
+subgoal is of the form {\term} \ssrC{-> G}, where {\term} becomes
+the new top assumption, instead of being introduced with a fresh
+name. At the proof-term level, the \ssrC{have} tactic creates a $\beta$
+redex, and introduces the lemma under a fresh name, automatically
+chosen.
+
+
+Like in the case of the \ssrC{pose} tactic (see section \ref{ssec:pose}),
+the types of the holes are abstracted in {\term}.
+For instance, the tactic:
+\begin{lstlisting}
+ have: _ * 0 = 0.
+\end{lstlisting}
+is equivalent to:
+\begin{lstlisting}
+ have: forall n : nat, n * 0 = 0.
+\end{lstlisting}
+The \ssrC{have} tactic also enjoys the same abstraction mechanism as the
+\ssrC{pose} tactic for the non-inferred implicit arguments. For instance,
+the tactic:
+\begin{lstlisting}
+ have: forall x y, (x, y) = (x, y + 0).
+\end{lstlisting}
+opens a new subgoal to prove that:
+
+\noindent\ssrC{forall (T : Type) (x : T) (y : nat), (x, y) = (x, y + 0)}
+
+
+The behavior of the defective \ssrC{have} tactic makes it possible to
+generalize it in the
+following general construction:
+\begin{center}
+ \ssrC{have} \ssrN{i-item}$^*$ \optional{\ssrN{i-pattern}}
+ \optional{\ssrN{s-item} {\optsep} \ssrN{binder}$^+$}
+ \optional{\ssrC{:} \ssrN[1]{term}}
+ \optional{\ssrC{:=} \ssrN[2]{term} {\optsep} \ssrC{by} {\tac}}
+\end{center}
+
+Open syntax is supported for $\ssrN[1]{term}$ and $\ssrN[2]{term}$. For the
+description of
+\iitem{}s and clear switches see section \ref{ssec:intro}.
+The first mode of the \ssrC{have} tactic, which opens a sub-proof for an
+intermediate result, uses tactics of the form:
+
+\begin{center}
+ \ssrC{have} \ssrN{clear-switch} \ssrN{i-item} \ssrC{:} {\term} \ssrC{by} {\tac}.
+\end{center}
+
+which behave like:\\
+
+\begin{center}
+ \ssrC{have:} {\term} \ssrC{; first by } {\tac}.
+\end{center}
+\begin{center}
+ \ssrC{ move=>} \ssrN{clear-switch} \ssrN{i-item}.
+\end{center}
+
+
+Note that the \ssrN{clear-switch} \emph{precedes} the
+\ssrN{i-item}, which allows to reuse a name of the context, possibly used
+by the proof of the assumption, to introduce the new assumption
+itself.
+
+The \ssrC{by} feature is especially convenient when the proof script of the
+statement is very short, basically when it fits in one line like in:
+\begin{lstlisting}
+ have H : forall x y, x + y = y + x by move=> x y; rewrite addnC.
+\end{lstlisting}
+
+The possibility of using \iitem{}s supplies a very concise
+syntax for the further use of the intermediate step. For instance,
+\begin{lstlisting}
+ have -> : forall x, x * a = a.
+\end{lstlisting}
+on a goal \ssrC{G}, opens a new subgoal asking for a proof of
+\ssrC{forall x, x * a = a}, and a second subgoal in which the lemma
+ \ssrC{forall x, x * a = a} has been rewritten in the goal \ssrC{G}. Note
+ that in this last subgoal, the intermediate result does not appear in
+ the context.
+Note that, thanks to the deferred execution of clears, the following
+idiom is supported (assuming \ssrC{x} occurs in the goal only):
+\begin{lstlisting}
+ have {x} -> : x = y
+\end{lstlisting}
+
+An other frequent use of the intro patterns combined with \ssrC{have} is the
+destruction of existential assumptions like in the tactic:
+\begin{lstlisting}
+ have [x Px]: exists x : nat, x > 0.
+\end{lstlisting}
+which opens a new subgoal asking for a proof of \ssrC{exists x : nat, x >
+ 0} and a second subgoal in which the witness is introduced under
+the name \ssrC{x : nat}, and its property under the name \ssrC{Px : x > 0}.
+
+An alternative use of the \ssrC{have} tactic is to provide the explicit proof
+term for the intermediate lemma, using tactics of the form:
+
+\begin{center}
+ \ssrC{have} \optional{\ssrN{ident}} \ssrC{:=} {\term}.
+\end{center}
+
+This tactic creates a new assumption of type the type of
+{\term}. If the
+optional \ssrN{ident} is present, this assumption is introduced under
+the name \ssrN{ident}. Note that the body of the constant is lost for
+the user.
+
+Again, non inferred implicit arguments and explicit holes are abstracted. For
+instance, the tactic:
+\begin{lstlisting}
+ have H := forall x, (x, x) = (x, x).
+\end{lstlisting}
+adds to the context \ssrC{H : Type -> Prop}. This is a schematic example but
+the feature is specially useful when the proof term to give involves
+for instance a lemma with some hidden implicit arguments.
+
+After the \ssrN{i-pattern}, a list of binders is allowed.
+For example, if \ssrC{Pos_to_P} is a lemma that proves that
+\ssrC{P} holds for any positive, the following command:
+\begin{lstlisting}
+ have H x (y : nat) : 2 * x + y = x + x + y by auto.
+\end{lstlisting}
+will put in the context \ssrC{H : forall x, 2 * x = x + x}. A proof term
+provided after \ssrC{:=} can mention these bound variables (that are
+automatically introduced with the given names).
+Since the \ssrN{i-pattern} can be omitted, to avoid ambiguity, bound variables
+can be surrounded with parentheses even if no type is specified:
+\begin{lstlisting}
+ have (x) : 2 * x = x + x by auto.
+\end{lstlisting}
+
+The \ssrN{i-item}s and \ssrN{s-item} can be used to interpret the
+asserted hypothesis with views (see section~\ref{sec:views}) or
+simplify the resulting goals.
+
+The \ssrC{have} tactic also supports a \ssrC{suff} modifier which allows for
+asserting that a given statement implies the current goal without
+copying the goal itself. For example, given a goal \ssrC{G} the tactic
+\ssrC{have suff H : P} results in the following two goals:
+\begin{lstlisting}
+ |- P -> G
+ H : P -> G |- G
+\end{lstlisting}
+Note that \ssrC{H} is introduced in the second goal. The \ssrC{suff}
+modifier is not compatible with the presence of a list of binders.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsubsection*{Generating \ssrC{let in} context entries with \ssrC{have}}
+\label{sec:havetransparent}
+
+Since \ssr{} 1.5 the \ssrC{have} tactic supports a ``transparent'' modifier to
+generate \ssrC{let in} context entries: the \ssrC{@} symbol in front of the context
+entry name. For example:
+
+\begin{lstlisting}
+have @i : 'I_n by apply: (Sub m); auto.
+\end{lstlisting}
+generates the following two context entry:
+\begin{lstlisting}
+i := Sub m proof_produced_by_auto : 'I_n
+\end{lstlisting}
+
+Note that the sub-term produced by \ssrC{auto} is in general huge and
+uninteresting, and hence one may want to hide it.
+
+For this purpose the \ssrC{[: name ]} intro pattern and the tactic
+\ssrC{abstract} (see page~\pageref{ssec:abstract}) are provided.
+Example:
+\begin{lstlisting}
+have [:blurb] @i : 'I_n by apply: (Sub m); abstract: blurb; auto.
+\end{lstlisting}
+generates the following two context entries:
+\begin{lstlisting}
+blurb : (m < n) (*1*)
+i := Sub m blurb : 'I_n
+\end{lstlisting}
+The type of \ssrC{blurb} can be cleaned up by its annotations by just simplifying
+it. The annotations are there for technical reasons only.
+
+When intro patterns for abstract constants are used in conjunction
+with \ssrC{have} and an explicit term, they must be used as follows:
+
+\begin{lstlisting}
+have [:blurb] @i : 'I_n := Sub m blurb.
+ by auto.
+\end{lstlisting}
+
+In this case the abstract constant \ssrC{blurb} is assigned by using it
+in the term that follows \ssrC{:=} and its corresponding goal is left to
+be solved. Goals corresponding to intro patterns for abstract constants
+are opened in the order in which the abstract constants are declared (not
+in the ``order'' in which they are used in the term).
+
+Note that abstract constants do respect scopes. Hence, if a variable
+is declared after their introduction, it has to be properly generalized (i.e.
+explicitly passed to the abstract constant when one makes use of it).
+For example any of the following two lines:
+\begin{lstlisting}
+have [:blurb] @i k : 'I_(n+k) by apply: (Sub m); abstract: blurb k; auto.
+have [:blurb] @i k : 'I_(n+k) := apply: Sub m (blurb k); first by auto.
+\end{lstlisting}
+generates the following context:
+\begin{lstlisting}
+blurb : (forall k, m < n+k) (*1*)
+i := fun k => Sub m (blurb k) : forall k, 'I_(n+k)
+\end{lstlisting}
+
+Last, notice that the use of intro patterns for abstract constants is
+orthogonal to the transparent flag \ssrC{@} for \ssrC{have}.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsubsection*{The \ssrC{have} tactic and type classes resolution}
+\label{ssec:havetcresolution}
+
+Since \ssr{} 1.5 the \ssrC{have} tactic behaves as follows with respect to type
+classes inference.
+
+\begin{itemize}
+\item \ssrC{have foo : ty.}
+ Full inference for \ssrC{ty}.
+ The first subgoal demands a proof of such instantiated statement.
+\item \ssrC{have foo : ty := .}
+ No inference for \ssrC{ty}. Unresolved instances are quantified in
+ \ssrC{ty}. The first subgoal demands a proof of such quantified
+ statement. Note that no proof term follows \ssrC{:=}, hence two
+ subgoals are generated.
+\item \ssrC{have foo : ty := t.}
+ No inference for \ssrC{ty} and \ssrC{t}.
+\item \ssrC{have foo := t.}
+ No inference for \ssrC{t}. Unresolved instances are quantified in the
+ (inferred) type of \ssrC{t} and abstracted in \ssrC{t}.
+\end{itemize}
+
+The behavior of \ssr{} 1.4 and below (never resolve type classes)
+can be restored with the option \ssrC{Set SsrHave NoTCResolution}.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsubsection*{Variants: the \ssrC{suff} and \ssrC{wlog} tactics.}
+\label{ssec:wlog}
+\idx{suff: \dots{}}
+\idx{suffices: \dots{}}
+\idx{wlog: \dots{} / \dots{}}
+\idx{without loss: \dots{} / \dots{}}
+
+As it is often the case in mathematical textbooks, forward
+reasoning may be used in slightly different variants.
+One of these variants is to show that the intermediate step $L$
+easily implies the initial goal $G$. By easily we mean here that
+the proof of $L \Rightarrow G$ is shorter than the one of $L$
+itself. This kind of reasoning step usually starts with:
+``It suffices to show that \dots''.
+
+This is such a frequent way of reasoning that \ssr{} has a variant of the
+\ssrC{have} tactic called \ssrC{suffices} (whose abridged name is
+\ssrC{suff}). The \ssrC{have} and \ssrC{suff} tactics are equivalent and
+have the same syntax but:
+\begin{itemize}
+\item the order of the generated subgoals is inversed
+\item but the optional clear item is still performed in the
+ \emph{second} branch. This means that the tactic:
+\begin{lstlisting}
+ suff {H} H : forall x : nat, x >= 0.
+\end{lstlisting}
+fails if the context of the current goal indeed contains an
+assumption named \ssrC{H}.
+\end{itemize}
+The rationale of this clearing policy is to make possible ``trivial''
+refinements of an assumption, without changing its name in the main
+branch of the reasoning.
+
+The \ssrC{have} modifier can follow the \ssrC{suff} tactic.
+For example, given a goal \ssrC{G} the tactic
+\ssrC{suff have H : P} results in the following two goals:
+\begin{lstlisting}
+ H : P |- G
+ |- (P -> G) -> G
+\end{lstlisting}
+Note that, in contrast with \ssrC{have suff}, the name \ssrC{H} has been introduced
+in the first goal.
+
+Another useful construct is reduction,
+showing that a particular case is in fact general enough to prove
+a general property. This kind of reasoning step usually starts with:
+``Without loss of generality, we can suppose that \dots''.
+Formally, this corresponds to the proof of a goal \ssrC{G} by introducing
+a cut \ssrN{wlog\_statement} \ssrC{-> G}. Hence the user shall provide a
+proof for both \ssrC{(}\ssrN{wlog\_statement} \ssrC{-> G) -> G} and
+\ssrN{wlog\_statement} \ssrC{-> G}. However, such cuts are usually rather
+painful to perform by hand, because the statement
+\ssrN{wlog\_statement} is tedious to write by hand, and somtimes even
+to read.
+
+\ssr{} implements this kind of reasoning step through the \ssrC{without loss}
+tactic, whose short name is \ssrC{wlog}. It offers support to describe
+the shape of the cut statements, by providing the simplifying
+hypothesis and by pointing at the elements of the initial goals which
+should be generalized. The general syntax of \ssrC{without loss} is:
+
+\begin{center}
+ \ssrC{wlog} \optional{\ssrC{suff}} \optional{\ssrN{clear-switch}} \optional{\ssrN{i-item}} \ssrC{:} \optional{\ssrN[1]{ident} $\dots$ \ssrN[n]{ident}} \ssrC{/} {\term}
+\end{center}
+
+where \ssrN[1]{ident} $\dots$ \ssrN[n]{ident} are identifiers for constants
+in the context of the goal. Open syntax is supported for {\term}.
+
+In its defective form:
+
+\begin{center}
+ \ssrC{wlog: /} {\term}.
+\end{center}
+
+on a goal \ssrC{G}, it creates two subgoals: a first one to prove the formula
+\ssrC{(}{\term} \ssrC{-> G) -> G} and a second one to prove the formula
+{\term} \ssrC{-> G}.
+
+:browse confirm wa
+If the optional list \ssrN[1]{ident} $\dots$ \ssrN[n]{ident} is present on the left
+side of \ssrC{/}, these constants are generalized in the premise
+\ssrC{(}{\term} \ssrC{-> G)} of the first subgoal. By default the body of
+local definitions is erased. This behavior can be inhibited
+prefixing the name of the local definition with the \ssrC{@} character.
+
+In the second subgoal, the tactic:
+
+\begin{center}
+ \ssrC{move=>} \ssrN{clear-switch}\ssrC{} \ssrN{i-item}\ssrC{.}
+\end{center}
+
+is performed if at least one of these optional switches is present in
+the \ssrC{wlog} tactic.
+
+The \ssrC{wlog} tactic is specially useful when a symmetry argument
+simplifies a proof. Here is an example showing the beginning of the
+proof that quotient and reminder of natural number euclidean division
+are unique.
+\begin{lstlisting}
+ Lemma quo_rem_unicity: forall d q1 q2 r1 r2,
+ q1*d + r1 = q2*d + r2 -> r1 < d -> r2 < d -> (q1, r1) = (q2, r2).
+ move=> d q1 q2 r1 r2.
+ wlog: q1 q2 r1 r2 / q1 <= q2.
+ by case (le_gt_dec q1 q2)=> H; last symmetry; eauto with arith.
+\end{lstlisting}
+
+The \ssrC{wlog suff} variant is simpler, since it cuts
+\ssrN{wlog\_statement} instead of \ssrN{wlog\_statement} \ssrC{-> G}. It thus
+opens the goals \ssrN{wlog\_statement} \ssrC{-> G} and \ssrN{wlog\_statement}.
+
+In its simplest form
+the \ssrC{generally have :...} tactic
+is equivalent to \ssrC{wlog suff :...} followed by \ssrC{last first}.
+When the \ssrC{have} tactic
+is used with the \ssrC{generally} (or \ssrC{gen}) modifier it accepts an
+extra identifier followed by a comma before the usual intro pattern.
+The identifier will name the new hypothesis in its more general form,
+while the intro pattern will be used to process its instance. For example:
+\begin{lstlisting}
+ Lemma simple n (ngt0 : 0 < n ) : P n.
+ gen have ltnV, /andP[nge0 neq0] : n ngt0 / (0 <= n) && (n != 0).
+\end{lstlisting}
+The first subgoal will be
+\begin{lstlisting}
+ n : nat
+ ngt0 : 0 < n
+ ====================
+ (0 <= n) && (n != 0)
+\end{lstlisting}
+while the second one will be
+\begin{lstlisting}
+ n : nat
+ ltnV : forall n, 0 < n -> (0 <= n) && (n != 0)
+ nge0 : 0 <= n
+ neqn0 : n != 0
+ ====================
+ P n
+\end{lstlisting}
+
+\paragraph{Advanced generalization}\label{par:advancedgen}
+The complete syntax for the items on the left hand side of the \ssrC{/}
+separator is the following one:
+\begin{center}
+\ssrN{clear-switch} {\optsep} \optional{\ssrC{@}} \ssrN{ident} {\optsep} \ssrC{(}\optional{\ssrC{@}}\ssrN{ident} \ssrC{:=} \ssrN{c-pattern}\ssrC{)}
+\end{center}
+Clear operations are intertwined with generalization operations. This
+helps in particular avoiding dependency issues while generalizing some facts.
+
+\noindent
+If an \ssrN{ident} is prefixed with the \ssrC{@} prefix mark, then a
+let-in redex is created, which keeps track if its body (if any). The
+syntax \ssrC{(}\ssrN{ident}\ssrC{:=}\ssrN{c-pattern}\ssrC{)} allows to
+generalize an arbitrary term using a given name. Note that its simplest
+form \ssrC{(x := y)} is just a renaming of \ssrC{y} into \ssrC{x}. In
+particular, this can be useful in order to simulate the generalization
+of a section variable, otherwise not allowed. Indeed renaming does not
+require the original variable to be cleared.
+
+
+\noindent
+The syntax \ssrC{(@x := y)} generates a let-in abstraction but with the following
+caveat: \ssrC{x} will not bind \ssrC{y}, but its body, whenever \ssrC{y} can be
+unfolded. This cover the case of both local and global definitions, as
+illustrated in the following example:
+
+\begin{lstlisting}
+Section Test.
+Variable x : nat.
+Definition addx z := z + x.
+Lemma test : x <= addx x.
+wlog H : (y := x) (@twoy := addx x) / twoy = 2 * y.
+\end{lstlisting}
+\noindent
+The first subgoal is:
+\begin{lstlisting}
+ (forall y : nat, let twoy := y + y in twoy = 2 * y -> y <= twoy) ->
+ x <= addx x
+\end{lstlisting}
+\noindent
+To avoid unfolding the term captured by the pattern \ssrC{add x} one
+can use the pattern \ssrC{id (addx x)}, that would produce the following first
+subgoal:
+\begin{lstlisting}
+ (forall y : nat, let twoy := addx y in twoy = 2 * y -> y <= twoy) ->
+ x <= addx x
+\end{lstlisting}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{Rewriting}\label{sec:rw}
+\idx{rewrite \dots{}}
+
+The generalized use of reflection implies that most of the
+intermediate results handled are properties of effectively computable
+functions. The most efficient mean of establishing such results are
+computation and simplification of expressions involving such
+functions, i.e., rewriting. \ssr{} therefore includes an extended
+\ssrC{rewrite} tactic, that unifies and combines most of the rewriting
+functionalities.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection{An extended \ssrC{rewrite} tactic}\label{ssec:extrw}
+The main features of the \ssrC{rewrite} tactic are:
+\begin{itemize}
+\item It can perform an entire series of such operations in any
+ subset of the goal and/or context;
+\item It allows to perform rewriting,
+ simplifications, folding/unfolding of definitions, closing of goals;
+\item Several rewriting operations can be chained in a single tactic;
+\item Control over the occurrence at which rewriting is to be performed is
+ significantly enhanced.
+\end{itemize}
+
+
+The general form of an \ssr{} rewrite tactic is:
+
+\begin{center}
+ \ssrC{rewrite} \ssrN{rstep}$^+$\ssrC{.}
+\end{center}
+
+The combination of a rewrite tactic with the \ssrC{in} tactical (see
+section \ref{ssec:loc}) performs rewriting in both the context and the
+goal.
+
+A rewrite step \ssrN{rstep} has the general form:
+
+\begin{center}
+ \optional{\ssrN{r-prefix}}\ssrN{r-item}
+\end{center}
+
+where:
+
+\begin{longtable}{rcl}
+\ssrN{r-prefix} & ::= &
+ \optional{\ssrC{-}} \optional{\ssrN{mult}} \optional{\ssrN{occ-switch} {\optsep} \ssrN{clear-switch}} \optional{\ssrC{[}\ssrN{r-pattern}\ssrC{]}}\\
+\ssrN{r-pattern} & ::= &
+{\term} {\optsep} \ssrC{in} \optional{\ssrN{ident} \ssrC{in}} {\term} {\optsep} \optional{{\term} \ssrC{in} {\optsep} {\term} \ssrC{as} } \ssrN{ident} \ssrC{in} {\term}\\
+\ssrN{r-item} & ::= &
+\optional{\ssrC{/}}{\term} {\optsep} \ssrN{s-item} \\
+\end{longtable}
+
+
+% \begin{eqnarray*}
+% \ssrN{r-prefix} & ::= &
+% [\ssrC{-}]\ [\ssrN{mult}][\ssrN{occ-switch} | \ssrN{cl-item}][{\term}]\\
+% \ssrN{r-item} & ::= &
+% [\ssrC{-}]{\term}\ |\ [\ssrC{-}]\ssrC{[}\ssrN[1]{term}\ssrC{]}\ssrC{/(}\ssrN[2]{term}\ssrC{)} \ |\
+% \ssrN{simpl switch} \ |\ \\
+% && \ssrN{eq-term} \ |\ \ssrC{(} \ssrN[1]{eq-term}\ssrC{,}\dots
+% \ssrC{,}\ssrN[n]{eq-term} \ssrC{)} \ |\ \ssrC{(_ :}\ssrN{eq-term} \ssrC{)}
+% \end{eqnarray*}
+
+
+An \ssrN{r-prefix} contains annotations to qualify where and how the
+rewrite operation should be performed:
+\begin{itemize}
+\item The optional initial \ssrC{-} indicates the direction of the rewriting
+ of \ssrN{r-item}: if present the direction is right-to-left and it is
+ left-to-right otherwise.
+\item The multiplier \ssrN{mult} (see section \ref{ssec:iter})
+ specifies if and how the rewrite operation should be repeated.
+\item A rewrite operation matches the occurrences of a \emph{rewrite
+ pattern}, and replaces these occurrences by an other term, according
+ to the given \ssrN{r-item}.
+ The optional \emph{redex switch} $\ssrC{[}\ssrN{r-pattern}\ssrC{]}$, which
+ should always be surrounded by brackets, gives explicitly this
+ rewrite pattern. In its simplest form, it is a regular term.
+ If no explicit redex switch
+ is present the rewrite pattern to be matched is inferred from the
+ \ssrN{r-item}.
+\item This optional {\term}, or
+ the \ssrN{r-item}, may be preceded by an
+ occurrence switch (see section \ref{ssec:select}) or a clear item
+ (see section \ref{ssec:discharge}), these two possibilities being
+ exclusive. An occurrence switch selects the occurrences of the
+ rewrite pattern which should be affected by the rewrite operation.
+\end{itemize}
+
+
+An \ssrN{r-item} can be:
+
+
+\begin{itemize}
+\item A \emph{simplification r-item}, represented by a
+ \ssrN{s-item} (see section \ref{ssec:intro}).
+% In some cases, \ssrN{r-prefix}es are not supported.
+ Simplification operations are
+ intertwined with the possible other rewrite operations specified by
+ the list of r-items.
+\item A \emph{folding/unfolding r-item}. The tactic:
+
+ \ssrC{rewrite /}{\term}
+
+unfolds the head constant of \textit{term} in every occurrence of the
+first matching of \textit{term} in the goal. In particular, if
+\ssrC{my_def} is a (local or global) defined constant, the tactic:
+\begin{lstlisting}
+ rewrite /my_def.
+\end{lstlisting}
+is analogous to:
+\begin{lstlisting}
+ unfold my_def.
+\end{lstlisting}
+Conversely:
+\begin{lstlisting}
+ rewrite -/my_def.
+\end{lstlisting}
+is equivalent to:
+\begin{lstlisting}
+ fold my_def.
+\end{lstlisting}
+%\emph{Warning} The combination of redex switch with unfold
+%\ssrN{r-item} is not yet implemented.
+
+When an unfold r-item is combined with a redex pattern, a conversion
+operation is performed. A tactic of the form:
+
+\begin{center}
+ \ssrC{rewrite -[}\ssrN[1]{term}\ssrC{]/}\ssrN[2]{term}\ssrC{.}
+\end{center}
+
+is equivalent to:
+
+
+\begin{center}
+ \ssrC{change} \ssrN[1]{term} \ssrC{with} \ssrN[2]{term}\ssrC{.}
+\end{center}
+
+
+If \ssrN[2]{term} is a single constant and \ssrN[1]{term} head symbol
+is not \ssrN[2]{term}, then the head symbol of \ssrN[1]{term} is
+repeatedly unfolded until \ssrN[2]{term} appears.
+
+\begin{lstlisting}
+ Definition double x := x + x.
+ Definition ddouble x := double (double x).
+ Lemma ex1 x : ddouble x = 4 * x.
+ rewrite [ddouble _]/double.
+\end{lstlisting}
+
+The resulting goal is:
+
+\begin{lstlisting}
+ double x + double x = 4 * x
+\end{lstlisting}
+
+\emph{Warning} The \ssr{} terms containing holes are \emph{not}
+typed as abstractions in this context. Hence the following script:
+\begin{lstlisting}
+ Definition f := fun x y => x + y.
+ Goal forall x y, x + y = f y x.
+ move=> x y.
+ rewrite -[f y]/(y + _).
+\end{lstlisting}
+raises the error message
+\begin{verbatim}
+ User error: fold pattern (y + _) does not match redex (f y)
+\end{verbatim}
+but the script obtained by replacing the last line with:
+\begin{lstlisting}
+ rewrite -[f y x]/(y + _).
+\end{lstlisting}
+is valid.
+
+
+\item A term, which can be:
+ \begin{itemize}
+ \item A term whose type has the form:
+ $$\ssrC{forall}\ (x_1\ :\ A_1)\dots(x_n\ :\ A_n),\ eq\ term_1\ term_2$$
+ where $eq$ is the Leibniz equality or a registered setoid
+ equality. %In the case of setoid relations, the only supported
+ %r-prefix is the directional \ssrC{-}.
+ \item A list of terms $(t_1,\dots,t_n)$, each $t_i$ having a type of the
+ form: $$\ssrC{forall}\ (x_1\ :\ A_1)\dots(x_n\ :\ A_n),\ eq\ term_1\ term_2$$ where
+ $eq$ is the Leibniz equality or a registered setoid
+ equality. The tactic:
+
+ \centerline{\ssrC{rewrite} \ssrN{r-prefix}\ssrC{(}$t_1$\ssrC{,}$\dots$\ssrC{,}$t_n$\ssrC{).}}
+
+ is equivalent to:
+
+ \centerline{\ssrC{do [rewrite} \ssrN{r-prefix} $t_1$ \ssrC{|} $\dots$ \ssrC| rewrite} \ssrN{r-prefix} $t_n$\ssrC{].}
+
+ \item An anonymous rewrite lemma
+ \ssrC{(_ :} {\term}), where \textit{term} has again the form:
+ $$\ssrC{forall}\ (x_1\ :\ A_1)\dots(x_n\ :\ A_n),\ eq\ term_1\ term_2$$
+ The tactic:
+
+ \centerline{\ssrC{rewrite (_ :} {\term}\ssrC{)}}
+
+ is in fact synonym of:
+
+ \centerline{\ssrC{cutrewrite (}{\term}\ssrC{).}}
+
+
+ \end{itemize}
+
+\end{itemize}
+
+
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection{Remarks and examples}\label{ssec:rwex}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsubsection*{Rewrite redex selection}
+The general strategy of \ssr{}
+is to grasp as many redexes as possible and to let the user select the
+ones to be rewritten thanks to the improved syntax for the control of
+rewriting.
+
+This may be a source of incompatibilities between the two \ssrC{rewrite}
+tactics.
+
+In a rewrite tactic of the form:
+
+ \ssrC{rewrite} \ssrN{occ-switch}\ssrC{[}\ssrN[1]{term}\ssrC{]}\ssrN[2]{term}.
+
+\ssrN[1]{term} is the explicit rewrite redex and
+\ssrN[2]{term} is the
+rewrite rule. This execution of this tactic unfolds as follows:
+
+\begin{itemize}
+\item First \ssrN[1]{term} and \ssrN[2]{term} are $\beta\iota$ normalized. Then
+ \ssrN[2]{term} is put in head normal form if the Leibniz equality
+ constructor \ssrC{eq} is not the head symbol. This may involve $\zeta$
+ reductions.
+\item Then, the matching algorithm (see section \ref{ssec:set})
+ determines the first subterm of the goal matching the rewrite pattern.
+ The rewrite pattern is
+ given by \ssrN[1]{term}, if an explicit redex pattern switch is provided, or by
+ the type of \ssrN[2]{term} otherwise. However, matching skips over
+ matches that would lead to trivial rewrites. All the
+ occurrences of this subterm in the goal are candidates for rewriting.
+\item Then only the occurrences coded by \ssrN{occ-switch} (see again
+ section \ref{ssec:set}) are finally selected for rewriting.
+\item The left hand side of $\ssrN[2]{term}$ is unified with the subterm found
+ by the matching algorithm, and if this succeeds, all the selected
+ occurrences in the goal are replaced by the right hand side of
+ $\ssrN[2]{term}$.
+\item Finally the goal is $\beta\iota$ normalized.
+\end{itemize}
+
+In the case $\ssrN[2]{term}$ is a list of terms, the first top-down (in
+the goal) left-to-right (in the list) matching rule gets selected.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsubsection*{Chained rewrite steps}
+
+
+The possibility to chain rewrite operations in a single tactic makes
+scripts more compact and gathers in a single command line a bunch
+of surgical
+operations which would be described by a one sentence in a pen and
+paper proof.
+
+Performing rewrite and simplification operations in a single tactic
+enhances significantly the concision of scripts. For instance the
+tactic:
+\begin{lstlisting}
+ rewrite /my_def {2}[f _]/= my_eq //=.
+\end{lstlisting}
+unfolds \ssrC{my_def} in the goal, simplifies the second occurrence of the
+first subterm matching pattern \ssrC{[f _]}, rewrites \ssrC{my_eq},
+simplifies the whole goal and closes trivial goals.
+
+Here are some concrete examples of chained rewrite operations, in the
+proof of basic results on natural numbers arithmetic:
+
+\begin{lstlisting}
+ Lemma |*addnS*| : forall m n, m + n.+1 = (m + n).+1.
+ Proof. by move=> m n; elim: m. Qed.
+
+ Lemma |*addSnnS*| : forall m n, m.+1 + n = m + n.+1.
+ Proof. move=> *; rewrite addnS; apply addSn. Qed.
+
+ Lemma |*addnCA*| : forall m n p, m + (n + p) = n + (m + p).
+ Proof. by move=> m n; elim: m => [|m Hrec] p; rewrite ?addSnnS -?addnS. Qed.
+
+ Lemma |*addnC*| : forall m n, m + n = n + m.
+ Proof. by move=> m n; rewrite -{1}[n]addn0 addnCA addn0. Qed.
+\end{lstlisting}
+
+Note the use of the \ssrC{?} switch for parallel rewrite operations in
+the proof of \ssrC{|*addnCA*|}.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsubsection*{Explicit redex switches are matched first}
+If an \ssrN{r-prefix} involves a \emph{redex switch}, the first step is to
+find a subterm matching this redex pattern, independently from the left hand
+side \ssrC{t1} of the equality the user wants to rewrite.
+
+For instance, if \ssrL-H : forall t u, t + u = u + t- is in the context of a
+goal \ssrL-x + y = y + x-, the tactic:
+\begin{lstlisting}
+ rewrite [y + _]H.
+\end{lstlisting}
+transforms the goal into \ssrL-x + y = x + y-.
+
+Note that if this first pattern matching is not compatible with the
+\emph{r-item}, the rewrite fails, even if the goal contains a correct
+redex matching both the redex switch and the left hand side of the
+equality. For instance, if \ssrL-H : forall t u, t + u * 0 = t- is
+in the context of a goal \ssrL-x + y * 4 + 2 * 0 = x + 2 * 0-, then tactic:
+\begin{lstlisting}
+ rewrite [x + _]H.
+\end{lstlisting}
+raises the error message:
+\begin{verbatim}
+ User error: rewrite rule H doesn't match redex (x + y * 4)
+\end{verbatim}
+while the tactic:
+\begin{lstlisting}
+ rewrite (H _ 2).
+\end{lstlisting}
+transforms the goal into \ssrL-x + y * 4 = x + 2 * 0-.
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsubsection*{Occurrence switches and redex switches}
+The tactic:
+\begin{lstlisting}
+ rewrite {2}[_ + y + 0](_: forall z, z + 0 = z).
+\end{lstlisting}
+transforms the goal:
+\begin{lstlisting}
+ x + y + 0 = x + y + y + 0 + 0 + (x + y + 0)
+\end{lstlisting}
+into:
+\begin{lstlisting}
+ x + y + 0 = x + y + y + 0 + 0 + (x + y)
+\end{lstlisting}
+and generates a second subgoal:
+\begin{lstlisting}
+ forall z : nat, z + 0 = z
+\end{lstlisting}
+The second subgoal is generated by the use of an anonymous lemma in
+the rewrite tactic. The effect of the tactic on the initial goal is to
+rewrite this lemma at the second occurrence of the first matching
+\ssrL-x + y + 0- of the explicit rewrite redex \ssrL-_ + y + 0-.
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsubsection*{Occurrence selection and repetition}
+Occurrence selection has priority over repetition switches. This means
+the repetition of a rewrite tactic specified by a multiplier
+will perform matching each time an elementary rewrite operation is
+performed. Repeated rewrite tactics apply to every subgoal generated
+by the previous tactic, including the previous instances of the
+repetition. For example:
+\begin{lstlisting}
+ Goal forall x y z : nat, x + 1 = x + y + 1.
+ move=> x y z.
+\end{lstlisting}
+creates a goal \ssrC{ x + 1 = x + y + 1}, which is turned into \ssrC{z = z}
+by the additional tactic:
+\begin{lstlisting}
+ rewrite 2!(_ : _ + 1 = z).
+\end{lstlisting}
+In fact, this last tactic generates \emph{three} subgoals,
+respectively
+\ssrC{ x + y + 1 = z}, \ssrC{ z = z} and \ssrC{x + 1 = z}. Indeed, the second
+rewrite operation specified with the \ssrC{2!} multiplier applies to
+the two subgoals generated by the first rewrite.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsubsection*{Multi-rule rewriting}
+The \ssrC{rewrite} tactic can be provided a \emph{tuple} of rewrite rules,
+or more generally a tree of such rules, since this tuple can feature
+arbitrary inner parentheses. We call \emph{multirule} such a
+generalized rewrite rule. This feature is of special interest when it
+is combined with multiplier switches, which makes the \ssrC{rewrite}
+tactic iterates the rewrite operations prescribed by the rules on the
+current goal. For instance, let us define two triples \ssrC{multi1} and
+\ssrC{multi2} as:
+\begin{lstlisting}
+ Variables (a b c : nat).
+
+ Hypothesis eqab : a = b.
+
+ Hypothesis eqac : a = c.
+\end{lstlisting}
+
+Executing the tactic:
+\begin{lstlisting}
+ rewrite (eqab, eqac)
+\end{lstlisting}
+on the goal:
+\begin{lstlisting}
+ =========
+ a = a
+\end{lstlisting}
+turns it into \ssrC{b = b}, as rule \ssrC{eqab} is the first to apply among
+the ones gathered in the tuple passed to the \ssrC{rewrite}
+tactic. This multirule \ssrC{(eqab, eqac)} is actually a \Coq{} term and we
+can name it with a definition:
+\begin{lstlisting}
+Definition |*multi1*| := (eqab, eqac).
+\end{lstlisting}
+In this case, the tactic \ssrC{rewrite multi1} is a synonym for
+\ssrC{(eqab, eqac)}. More precisely, a multirule rewrites
+the first subterm to which one of the rules applies in a left-to-right
+traversal of the goal, with the first rule from the multirule tree in
+left-to-right order. Matching is performed according to the algorithm
+described in Section~\ref{ssec:set}, but literal matches have
+priority. For instance if we add a definition and a new multirule to
+our context:
+
+\begin{lstlisting}
+ Definition |*d*| := a.
+
+ Hypotheses eqd0 : d = 0.
+
+ Definition |*multi2*| := (eqab, eqd0).
+\end{lstlisting}
+then executing the tactic:
+\begin{lstlisting}
+ rewrite multi2.
+\end{lstlisting}
+on the goal:
+\begin{lstlisting}
+ =========
+ d = b
+\end{lstlisting}
+turns it into \ssrC{0 = b}, as rule \ssrC{eqd0} applies without unfolding
+the definition of \ssrC{d}. For repeated rewrites the selection process
+is repeated anew. For instance, if we define:
+
+\begin{lstlisting}
+ Hypothesis eq_adda_b : forall x, x + a = b.
+
+ Hypothesis eq_adda_c : forall x, x + a = c.
+
+ Hypothesis eqb0 : b = 0.
+
+ Definition |*multi3*| := (eq_adda_b, eq_adda_c, eqb0).
+\end{lstlisting}
+then executing the tactic:
+\begin{lstlisting}
+ rewrite 2!multi3.
+\end{lstlisting}
+on the goal:
+\begin{lstlisting}
+ =========
+ 1 + a = 12 + a
+\end{lstlisting}
+turns it into \ssrC{0 = 12 + a}: it uses \ssrC{eq_adda_b} then \ssrC{eqb0} on the
+left-hand side only. Now executing the tactic \ssrC{rewrite !multi3}
+turns the same goal into \ssrC{0 = 0}.
+
+The grouping of rules inside a multirule does not affect the selection
+strategy but can make it easier to include one rule set in another or
+to (universally) quantify over the parameters of a subset of rules (as
+there is special code that will omit unnecessary quantifiers for rules that
+can be syntactically extracted). It is also possible to
+reverse the direction of a rule subset, using a special dedicated syntax:
+the tactic \ssrC{rewrite (=~ multi1)} is equivalent to
+\ssrC{rewrite multi1_rev} with:
+\begin{lstlisting}
+ Hypothesis eqba : b = a.
+
+ Hypothesis eqca : c = a.
+
+ Definition |*multi1_rev*| := (eqba, eqca).
+\end{lstlisting}
+except that the constants \ssrC{eqba, eqab, mult1_rev} have not been created.
+
+Rewriting with multirules
+is useful to implement simplification or transformation
+procedures, to be applied on terms of small to medium size. For
+instance the library \ssrL{ssrnat} provides two implementations for
+arithmetic operations on natural numbers: an elementary one and a tail
+recursive version, less inefficient but also less convenient for
+reasoning purposes. The library also provides one lemma per such
+operation, stating that both versions return the same values when
+applied to the same arguments:
+
+\begin{lstlisting}
+ Lemma |*addE*| : add =2 addn.
+ Lemma |*doubleE*| : double =1 doublen.
+ Lemma |*add_mulE*| n m s : add_mul n m s = addn (muln n m) s.
+ Lemma |*mulE*| : mul =2 muln.
+ Lemma |*mul_expE*| m n p : mul_exp m n p = muln (expn m n) p.
+ Lemma |*expE*| : exp =2 expn.
+ Lemma |*oddE*| : odd =1 oddn.
+\end{lstlisting}
+
+The operation on the left hand side of each lemma is the efficient
+version, and the corresponding naive implementation is on the right
+hand side. In order to reason conveniently on expressions involving
+the efficient operations, we gather all these rules in the
+definition \ssrC{|*trecE*|}:
+\begin{lstlisting}
+ Definition |*trecE*| := (addE, (doubleE, oddE), (mulE, add_mulE, (expE, mul_expE))).
+\end{lstlisting}
+The tactic:
+\begin{lstlisting}
+ rewrite !trecE.
+\end{lstlisting}
+restores the naive versions of each operation in a goal involving the
+efficient ones, e.g. for the purpose of a correctness proof.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsubsection*{Wildcards vs abstractions}
+ The \ssrC{rewrite} tactic supports r-items containing holes. For example
+ in the tactic $(1)$:
+\begin{lstlisting}
+ rewrite (_ : _ * 0 = 0).
+\end{lstlisting}
+ the term \ssrC{_ * 0 = 0} is interpreted as \ssrC{forall n : nat, n * 0 = 0}.
+ Anyway this tactic is \emph{not} equivalent to the tactic $(2)$:
+\begin{lstlisting}
+ rewrite (_ : forall x, x * 0 = 0).
+\end{lstlisting}
+ The tactic $(1)$ transforms the goal
+ \ssrL-(y * 0) + y * (z * 0) = 0- into \ssrC{y * (z * 0) = 0}
+ and generates a new subgoal to prove the statement \ssrC{y * 0 = 0},
+ which is the \emph{instance} of the\\ \ssrC{forall x, x * 0 = 0}
+ rewrite rule that
+ has been used to perform the rewriting. On the other hand, tactic
+ $(2)$ performs the same rewriting on the current goal but generates a
+ subgoal to prove \ssrC{forall x, x * 0 = 0}.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsubsection*{When \ssr{} \ssrC{rewrite} fails on standard \Coq{} licit rewrite}
+In a few cases, the \ssr{} \ssrC{rewrite} tactic fails
+rewriting some redexes which standard \Coq{} successfully rewrites.
+There are two main cases:
+
+\begin{itemize}
+\item \ssr{} never accepts to rewrite indeterminate patterns like:
+\begin{lstlisting}
+ Lemma |*foo*| : forall x : unit, x = tt.
+\end{lstlisting}
+\ssr{} will however accept the $\eta\zeta$ expansion of this rule:
+\begin{lstlisting}
+ Lemma |*fubar*| : forall x : unit, (let u := x in u) = tt.
+\end{lstlisting}
+\item In standard \Coq{}, suppose that we work in the following context:
+\begin{lstlisting}
+ Variable g : nat -> nat.
+ Definition |*f*| := g.
+\end{lstlisting}
+then rewriting \ssrC{H : forall x, f x = 0} in the goal
+\ssrC{g 3 + g 3 = g 6} succeeds
+and transforms the goal into \ssrC{0 + 0 = g 6}.
+
+This rewriting is not possible in \ssr{} because there is no
+occurrence of the head symbol \ssrC{f} of the rewrite rule in the
+goal. Rewriting with \ssrC{H} first requires unfolding the occurrences of
+\ssrC{f} where the substitution is to be performed (here there is a single
+such occurrence), using tactic \ssrC{rewrite /f} (for a global
+replacement of \ssrC{f} by \ssrC{g}) or \ssrC{rewrite $\ \ssrN{pattern}$/f}, for a
+finer selection.
+\end{itemize}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsubsection*{Existential metavariables and rewriting}
+\label{ssec:rewcaveats}
+The \ssrC{rewrite} tactic will not instantiate existing existential
+metavariables when matching a redex pattern.
+
+If a rewrite rule generates a goal
+with new existential metavariables, these will be generalized as for \ssrC{apply}
+(see page~\pageref{sssec:apply}) and corresponding new goals will be generated.
+For example, consider the following script:
+
+\begin{lstlisting}
+ Lemma |*ex3*| (x : 'I_2) y (le_1 : y < 1) (E : val x = y) : Some x = insub y.
+ rewrite insubT ?(leq_trans le_1)// => le_2.
+\end{lstlisting}
+
+Since \ssrC{insubT} has the following type:
+
+\begin{lstlisting}
+ forall T P (sT : subType P) (x : T) (Px : P x), insub x = Some (Sub x Px)
+\end{lstlisting}
+
+and since the implicit argument corresponding to the \ssrC{Px} abstraction is not
+supplied by the user, the resulting goal should be \ssrC{Some x = Some (Sub y
+$\;\;?_{Px}$)}. Instead, \ssr{} \ssrC{rewrite} tactic generates the two following
+goals:
+\begin{lstlisting}
+ y < 2
+ forall Hyp0 : y < 2, Some x = Some (Sub y Hyp0)
+\end{lstlisting}
+The script closes the former with \ssrC{?(leq_trans le_1)//}, then it introduces
+the new generalization naming it \ssrC{le_2}.
+
+\begin{lstlisting}
+ x : 'I_2
+ y : nat
+ le_1 : y < 1
+ E : val x = y
+ le_2 : y < 2
+ ============================
+ Some x = Some (Sub y le_2)
+\end{lstlisting}
+
+As a temporary limitation, this behavior is available only if the rewriting
+rule is stated using Leibniz equality (as opposed to setoid relations).
+It will be extended to other rewriting relations in the future.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection{Locking, unlocking} \label{ssec:lock}
+
+As program proofs tend to generate large goals, it is important to be
+able to control the partial evaluation performed by the simplification
+operations that are performed by the tactics. These evaluations can
+for example come from a \ssrC{/=} simplification switch, or from rewrite steps
+which may expand large terms while performing conversion. We definitely
+want to avoid repeating large subterms of the goal in
+the proof script. We do this by
+``clamping down'' selected function symbols in the goal, which
+prevents them from
+being considered in simplification or rewriting steps. This clamping
+is accomplished by using the occurrence switches (see section
+\ref{sssec:occselect}) together with ``term tagging'' operations.
+
+\ssr{} provides two levels of tagging.
+
+The first one uses auxiliary definitions to introduce a provably equal
+copy of any term \ssrC{t}. However this copy is (on purpose)
+\emph{not convertible} to \ssrC{t} in the \Coq{} system\footnote{This is
+ an implementation feature: there is not such obstruction in the
+ metatheory}. The job is done by the following construction:
+
+\begin{lstlisting}
+ Lemma |*master_key*| : unit. Proof. exact tt. Qed.
+ Definition |*locked*| A := let: tt := master_key in fun x : A => x.
+ Lemma |*lock*| : forall A x, x = locked x :> A.
+\end{lstlisting}
+Note that the definition of \ssrC{|*master_key*|} is explicitly opaque.
+The equation \ssrC{t = locked t} given by the \ssrC{lock} lemma can be used
+for selective rewriting, blocking on the fly the reduction in the
+term \ssrC{t}.
+For example the script:
+\begin{lstlisting}
+ Require Import List.
+ Variable A : Type.
+
+ Fixpoint |*my_has*| (p : A -> bool)(l : list A){struct l} : bool:=
+ match l with
+ |nil => false
+ |cons x l => p x || (my_has p l)
+ end.
+
+ Goal forall a x y l, a x = true -> my_has a ( x :: y :: l) = true.
+ move=> a x y l Hax.
+\end{lstlisting}
+where \ssrL{||} denotes the boolean disjunction, results in a goal
+\ssrC{my_has a ( x :: y :: l) = true}. The tactic:
+\begin{lstlisting}
+ rewrite {2}[cons]lock /= -lock.
+\end{lstlisting}
+turns it into \ssrC{a x || my_has a (y :: l) = true}.
+Let us now start by reducing the initial goal without blocking reduction.
+The script:
+\begin{lstlisting}
+ Goal forall a x y l, a x = true -> my_has a ( x :: y :: l) = true.
+ move=> a x y l Hax /=.
+\end{lstlisting}
+creates a goal \ssrC{(a x) || (a y) || (my_has a l) = true}. Now the
+tactic:
+\begin{lstlisting}
+ rewrite {1}[orb]lock orbC -lock.
+\end{lstlisting}
+where \ssrC{orbC} states the commutativity of \ssrC{orb}, changes the
+goal into\\ \ssrC{(a x) || (my_has a l) || (a y) = true}: only the
+arguments of the second disjunction where permuted.
+
+
+It is sometimes desirable to globally prevent a definition from being
+expanded by simplification; this is done by adding \ssrC{locked} in the
+definition.
+
+For instance, the function \ssrC{|*fgraph_of_fun*|} maps a function whose
+domain and codomain are finite types to a concrete representation of
+its (finite) graph. Whatever implementation of this transformation we
+may use, we want it to be hidden to simplifications and tactics, to
+avoid the collapse of the graph object:
+\begin{lstlisting}
+ Definition |*fgraph_of_fun*| :=
+ locked
+ (fun (d1 :finType) (d2 :eqType) (f : d1 -> d2) => Fgraph (size_maps f _)).
+\end{lstlisting}
+
+We provide a special tactic \ssrC{unlock} for unfolding such definitions
+while removing ``locks'', e.g., the tactic:
+
+ \ssrC{unlock} \ssrN{occ-switch}\ssrC{fgraph_of_fun}.
+
+replaces the occurrence(s) of \ssrC{fgraph_of_fun} coded by the \ssrN{occ-switch}
+with \ssrC{(Fgraph (size_maps _ _))} in the goal.
+
+We found that it was usually preferable to prevent the expansion of
+some functions by the partial evaluation switch ``/='', unless
+this allowed the evaluation of a condition. This is possible thanks to
+an other mechanism of term tagging, resting on the following
+\emph{Notation}:
+\begin{lstlisting}
+ Notation "'nosimpl' t" := (let: tt := tt in t).
+\end{lstlisting}
+
+The term \ssrC{(nosimpl t)} simplifies to t \emph{except} in a
+definition. More precisely,
+given:
+\begin{lstlisting}
+ Definition |*foo*| := (nosimpl bar).
+\end{lstlisting}
+the term \ssrC{foo (or (foo t'))} will \emph{not} be expanded by the
+\emph{simpl} tactic unless it is in a forcing context (e.g., in
+\ssrC{match foo t' with $\dots$ end}, \ssrC{foo t'} will be reduced if this allows
+\ssrC{match} to be reduced). Note that \ssrC{nosimpl bar} is simply notation
+for a term that reduces to \ssrC{bar}; hence \ssrC{unfold foo} will replace
+ \ssrC{foo} by \ssrC{bar}, and \ssrC{fold foo} will replace \ssrC{bar} by
+ \ssrC{foo}.
+
+\emph{Warning} The \ssrC{nosimpl} trick only works if no reduction is
+apparent in \ssrC{t}; in particular, the declaration:
+\begin{lstlisting}
+ Definition |*foo*| x := nosimpl (bar x).
+\end{lstlisting}
+will usually not work. Anyway, the common practice is to tag only the
+function, and to use the following definition, which blocks the
+reduction as expected:
+\begin{lstlisting}
+ Definition |*foo*| x := nosimpl bar x.
+\end{lstlisting}
+
+
+A standard example making this technique shine is the case of
+arithmetic operations. We define for instance:
+\begin{lstlisting}
+ Definition |*addn*| := nosimpl plus.
+\end{lstlisting}
+The operation \ssrC{addn} behaves exactly like plus, except that
+\ssrC{(addn (S n) m)} will not
+simplify spontaneously to \ssrC{(S (addn n m))} (the two terms, however, are
+inter-convertible). In addition, the unfolding step:
+\begin{lstlisting}
+rewrite /addn
+\end{lstlisting}
+will replace \ssrC{addn} directly with \ssrC{plus}, so the \ssrC{nosimpl} form
+is essentially invisible.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection{Congruence}\label{ssec:congr}
+
+Because of the way matching interferes with type families parameters,
+the tactic:
+\begin{lstlisting}
+ apply: my_congr_property.
+\end{lstlisting}
+will generally fail to perform congruence simplification, even on
+rather simple cases. We therefore provide a
+more robust alternative in which the function is supplied:
+$$\ssrC{congr}\ [\ssrN{int}]\ {\term}$$
+
+This tactic:
+\begin{itemize}
+\item checks that the goal is a Leibniz equality
+\item matches both sides of this equality with ``{\term} applied to
+ some arguments'', inferring the right number of arguments from the goal
+ and the type of {\term}. This may
+ expand some definitions or fixpoints.
+\item generates the subgoals corresponding to pairwise equalities of
+ the arguments present in the goal.
+\end{itemize}
+
+The goal can be a non dependent product \ssrC{P -> Q}.
+In that case, the system asserts the equation \ssrC{P = Q}, uses it to solve
+the goal, and calls the \ssrC{congr} tactic on the remaining goal
+\ssrC{P = Q}. This can be useful for instance to perform a transitivity
+step, like in the following situation:
+\begin{lstlisting}
+ x, y, z : nat
+ ===============
+ x = y -> x = z
+\end{lstlisting}
+the tactic \ssrC{congr (_ = _)} turns this goal into:
+
+\begin{lstlisting}
+ x, y, z : nat
+ ===============
+ y = z
+\end{lstlisting}
+which can also be obtained starting from:
+\begin{lstlisting}
+ x, y, z : nat
+ h : x = y
+ ===============
+ x = z
+\end{lstlisting}
+and using the tactic \ssrC{congr (_ = _): h}.
+
+The optional \ssrN{int} forces the number of arguments for which the
+tactic should generate equality proof obligations.
+
+This tactic supports equalities between applications with dependent
+arguments. Yet dependent arguments should have exactly the same
+parameters on both sides, and these parameters should appear as first
+arguments.
+
+The following script:
+\begin{lstlisting}
+ Definition f n := match n with 0 => plus | S _ => mult end.
+ Definition g (n m : nat) := plus.
+
+ Goal forall x y, f 0 x y = g 1 1 x y.
+ by move=> x y; congr plus.
+ Qed.
+\end{lstlisting}
+shows that the \ssrC{congr} tactic matches \ssrC{plus} with \ssrC{f 0} on the
+left hand side and \ssrC{g 1 1} on the right hand side, and solves the goal.
+
+The script:
+\begin{lstlisting}
+ Goal forall n m, m <= n -> S m + (S n - S m) = S n.
+ move=> n m Hnm; congr S; rewrite -/plus.
+\end{lstlisting}
+generates the subgoal \ssrC{m + (S n - S m) = n}. The tactic
+\ssrC{rewrite -/plus} folds back the expansion of \ssrC{plus} which was
+necessary for matching both sides of the equality with an application
+of \ssrC{S}.
+
+Like most \ssr{} arguments, {\term} can contain wildcards.
+The script:
+\begin{lstlisting}
+ Goal forall x y, x + (y * (y + x - x)) = x * 1 + (y + 0) * y.
+ move=> x y; congr ( _ + (_ * _)).
+\end{lstlisting}
+generates three subgoals, respectively \ssrC{x = x * 1}, \ssrC{y = y + 0}
+and \ssrC{ y + x - x = y}.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{Contextual patterns}
+\label{ssec:rewp}
+
+The simple form of patterns used so far, ${\term}s$ possibly containing
+wild cards, often require an additional \ssrN{occ-switch} to be specified.
+While this may work pretty fine for small goals, the use of polymorphic
+functions and dependent types may lead to an invisible duplication of functions
+arguments. These copies usually end up in types hidden by the implicit
+arguments machinery or by user defined notations. In these situations
+computing the right occurrence numbers is very tedious because they must be
+counted on the goal as printed after setting the \ssrC{Printing All} flag.
+Moreover the resulting script is not really informative for the reader, since
+it refers to occurrence numbers he cannot easily see.
+
+Contextual patterns mitigate these issues allowing to specify occurrences
+according to the context they occur in.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection{Syntax}
+
+The following table summarizes the full syntax of
+\ssrN{c-pattern} and the corresponding subterm(s) identified
+by the pattern.
+In the third column we use s.m.r. for
+``the subterms matching the redex'' specified in the second column.
+
+\begin{center}
+%\begin{tabularx}{\textwidth}{>{\arraybackslash}m{0.30\textwidth}|>{\arraybackslash}m{0.21\textwidth}|>{\arraybackslash}m{0.39\textwidth}}
+\begin{tabular}{llp{10em}}
+\ssrN{c-pattern} & redex & subterms affected \\
+\hline
+{\term} & {\term} & all occurrences of {\term}\\
+\hline
+$\ssrN{ident}\ \ssrC{in}\ {\term}$ &
+ subterm of {\term} selected by \ssrN{ident} &
+ all the subterms identified by \ssrN{ident} in all
+ the occurrences of {\term} \\
+\hline
+$\ssrN[1]{term}\ \ssrC{in}\ \ssrN{ident}\ \ssrC{in}\ \ssrN[2]{term}$ & $\ssrN[1]{term}$ &
+ in all s.m.r. in all the subterms identified by \ssrN{ident} in all
+ the occurrences of $\ssrN[2]{term}$ \\
+\hline
+$\ssrN[1]{term}\ \ssrC{as}\ \ssrN{ident}\ \ssrC{in}\ \ssrN[2]{term}$ & $\ssrN[1]{term}$ &
+ in all the subterms identified by \ssrN{ident} in all
+ the occurrences of $\ssrN[2]{term}[\ssrN[1]{term}/\ssrN{ident}]$\\
+\hline
+%\end{tabularx}
+\end{tabular}
+\end{center}
+
+The \ssrC{rewrite} tactic supports two more patterns obtained
+prefixing the first two with \ssrC{in}. The intended meaning is that the
+pattern identifies all subterms of the specified context. The
+\ssrC{rewrite} tactic will infer a pattern for the redex looking at the
+rule used for rewriting.
+
+\begin{center}
+\begin{tabularx}{\textwidth}{>{\arraybackslash}m{0.30\textwidth}|>{\arraybackslash}m{0.21\textwidth}|>{\arraybackslash}m{0.39\textwidth}}
+\ssrN{r-pattern} & redex & subterms affected \\
+\hline
+$\ssrC{in}\ {\term}$ & inferred from rule &
+ in all s.m.r. in all occurrences of {\term}\\
+\hline
+$\ssrC{in}\ \ssrN{ident}\ \ssrC{in}\ {\term}$ & inferred from rule &
+ in all s.m.r. in all the subterms identified by \ssrN{ident} in all
+ the occurrences of {\term} \\
+\hline
+\end{tabularx}
+\end{center}
+
+The first \ssrN{c-pattern} is the simplest form matching any
+context but selecting a specific redex and has been described in the
+previous sections. We have seen so far that the possibility of
+selecting a redex using a term with holes is already a powerful mean of redex
+selection. Similarly, any {\term}s provided by the
+user in the more complex forms of \ssrN{c-pattern}s presented in the
+tables above can contain holes.
+
+For a quick glance at what can be expressed with the last
+\ssrN{r-pattern} consider the goal \ssrC{a = b} and the tactic
+\begin{lstlisting}
+ rewrite [in X in _ = X]rule.
+\end{lstlisting}
+It rewrites all occurrences of the left hand side of \ssrC{rule} inside
+\ssrC{b} only (\ssrC{a}, and the hidden type of the equality, are ignored).
+Note that the variant \ssrC{rewrite [X in _ = X]rule} would have
+rewritten \ssrC{b} exactly (i.e., it would only work if \ssrC{b} and the
+left hand side of \ssrC{rule} can be unified).
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection{Matching contextual patterns}
+
+The \ssrN{c-pattern}s and \ssrN{r-pattern}s involving
+{\term}s with holes are matched
+against the goal in order to find a closed instantiation. This
+matching proceeds as follows:
+
+\begin{center}
+\begin{tabularx}{\textwidth}{>{\arraybackslash}m{0.30\textwidth}|>{\arraybackslash}m{0.65\textwidth}}
+\ssrN{c-pattern} & instantiation order and place for $\ssrN[i]{term}$ and redex\\
+\hline
+{\term} & {\term} is matched against the goal, redex is unified with
+ the instantiation of {\term}\\
+\hline
+$\ssrN{ident}\ \ssrC{in}\ {\term}$ &
+ {\term} is matched against the goal, redex is
+ unified with the subterm of the
+ instantiation of {\term} identified by \ssrN{ident}\\
+\hline
+$\ssrN[1]{term}\ \ssrC{in}\ \ssrN{ident}\ \ssrC{in}\ \ssrN[2]{term}$ &
+ $\ssrN[2]{term}$ is matched against the goal, $\ssrN[1]{term}$ is
+ matched against the subterm of the
+ instantiation of $\ssrN[1]{term}$ identified by \ssrN{ident},
+ redex is unified with the instantiation of $\ssrN[1]{term}$\\
+\hline
+$\ssrN[1]{term}\ \ssrC{as}\ \ssrN{ident}\ \ssrC{in}\ \ssrN[2]{term}$ &
+ $\ssrN[2]{term}[\ssrN[1]{term}/\ssrN{ident}]$
+ is matched against the goal,
+ redex is unified with the instantiation of $\ssrN[1]{term}$\\
+\hline
+\end{tabularx}
+\end{center}
+
+In the following patterns, the redex is intended to be inferred from the
+rewrite rule.
+
+\begin{center}
+\begin{tabularx}{\textwidth}{>{\arraybackslash}m{0.30\textwidth}|>{\arraybackslash}m{0.65\textwidth}}
+\ssrN{r-pattern} & instantiation order and place for $\ssrN[i]{term}$ and redex\\
+\hline
+$\ssrC{in}\ \ssrN{ident}\ \ssrC{in}\ {\term}$ &
+ {\term} is matched against the goal, the redex is
+ matched against the subterm of the
+ instantiation of {\term} identified by \ssrN{ident}\\
+\hline
+$\ssrC{in}\ {\term}$ & {\term} is matched against the goal, redex is
+ matched against the instantiation of {\term}\\
+\hline
+\end{tabularx}
+\end{center}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection{Examples}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsubsection{Contextual pattern in \ssrC{set} and the \ssrC{:} tactical}
+
+As already mentioned in section~\ref{ssec:set} the \ssrC{set} tactic
+takes as an argument a term in open syntax. This term is interpreted
+as the simplest for of \ssrN{c-pattern}. To void confusion in the grammar,
+open syntax is supported only for the simplest form of patterns, while
+ parentheses are required around more complex patterns.
+
+\begin{lstlisting}
+set t := (X in _ = X).
+set t := (a + _ in X in _ = X).
+\end{lstlisting}
+
+Given the goal \ssrC{a + b + 1 = b + (a + 1)} the first tactic
+captures \ssrC{b + (a + 1)}, while the latter \ssrC{a + 1}.
+
+Since the user may define an infix notation for \ssrC{in} the former
+tactic may result ambiguous. The disambiguation rule implemented is
+to prefer patterns over simple terms, but to interpret a pattern with
+double parentheses as a simple term. For example
+the following tactic would capture any occurrence of the term `\ssrC{a in A}'.
+
+\begin{lstlisting}
+set t := ((a in A)).
+\end{lstlisting}
+
+Contextual pattern can also be used as arguments of the \ssrC{:} tactical.
+For example:
+\begin{lstlisting}
+elim: n (n in _ = n) (refl_equal n).
+\end{lstlisting}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsubsection{Contextual patterns in \ssrC{rewrite}}
+As a more comprehensive example consider the following goal:
+\begin{lstlisting}
+ (x.+1 + y) + f (x.+1 + y) (z + (x + y).+1) = 0
+\end{lstlisting}
+The tactic \ssrC{rewrite [in f _ _]addSn} turns it into:
+\begin{lstlisting}
+ (x.+1 + y) + f (x + y).+1 (z + (x + y).+1) = 0
+\end{lstlisting}
+since the simplification rule \ssrC{addSn} is applied only under the \ssrC{f} symbol.
+Then we simplify also the first addition and expand \ssrC{0} into \ssrC{0+0}.
+\begin{lstlisting}
+ rewrite addSn -[X in _ = X]addn0.
+\end{lstlisting}
+obtaining:
+\begin{lstlisting}
+ (x + y).+1 + f (x + y).+1 (z + (x + y).+1) = 0 + 0
+\end{lstlisting}
+Note that the right hand side of \ssrC{addn0} is undetermined, but the
+rewrite pattern specifies the redex explicitly. The right hand side of
+\ssrC{addn0} is unified with the term identified by \ssrC{X}, \ssrC{0} here.
+
+The following pattern does not specify a redex, since it
+identifies an entire region, hence the rewrite rule has to be instantiated
+explicitly. Thus the tactic:
+\begin{lstlisting}
+ rewrite -{2}[in X in _ = X](addn0 0).
+\end{lstlisting}
+changes the goal as follows:
+\begin{lstlisting}
+ (x + y).+1 + f (x + y).+1 (z + (x + y).+1) = 0 + (0 + 0)
+\end{lstlisting}
+The following tactic is quite tricky:
+\begin{lstlisting}
+ rewrite [_.+1 in X in f _ X](addnC x.+1).
+\end{lstlisting}
+and the resulting goals is:
+\begin{lstlisting}
+ (x + y).+1 + f (x + y).+1 (z + (y + x.+1)) = 0 + (0 + 0)
+\end{lstlisting}
+The explicit redex \ssrC{_.+1} is important since its head
+constant \ssrC{S} differs from the head constant inferred from
+\ssrC{(addnC x.+1)} (that is \ssrC{addn}, denoted \ssrC{+} here).
+Moreover, the pattern \ssrC{f _ X} is important to rule out the first occurrence
+of \ssrC{(x + y).+1}. Last, only the subterms of \ssrC{f _ X} identified by \ssrC{X} are
+rewritten, thus the first argument of \ssrC{f} is skipped too.
+Also note the pattern \ssrC{_.+1} is interpreted in the context
+identified by \ssrC{X}, thus it gets instantiated to \ssrC{(y + x).+1} and
+not \ssrC{(x + y).+1}.
+
+The last rewrite pattern allows to specify exactly the shape of the term
+identified by \ssrC{X}, that is thus unified with the left hand side of the
+rewrite rule.
+\begin{lstlisting}
+ rewrite [x.+1 + y as X in f X _]addnC.
+\end{lstlisting}
+The resulting goal is:
+\begin{lstlisting}
+ (x + y).+1 + f (y + x.+1) (z + (y + x.+1)) = 0 + (0 + 0)
+\end{lstlisting}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection{Patterns for recurrent contexts}
+
+The user can define shortcuts for recurrent contexts corresponding to the
+\ssrN{ident} \ssrC{in} {\term} part. The notation scope identified
+with \ssrC{\%pattern} provides a special notation `\ssrC{(X in t)}' the user
+must adopt to define context shortcuts.
+
+The following example is taken from \ssrC{ssreflect.v} where the
+\ssrC{LHS} and \ssrC{RHS} shortcuts are defined.
+
+\begin{lstlisting}
+Notation RHS := (X in _ = X)%pattern.
+Notation LHS := (X in X = _)%pattern.
+\end{lstlisting}
+
+Shortcuts defined this way can be freely used in place of the
+trailing \ssrN{ident} \ssrC{in} {\term} part of any contextual
+pattern.
+Some examples follow:
+
+\begin{lstlisting}
+set rhs := RHS.
+rewrite [in RHS]rule.
+case: (a + _ in RHS).
+\end{lstlisting}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{Views and reflection}\label{sec:views}
+
+The bookkeeping facilities presented in section \ref{sec:book} are
+crafted to ease simultaneous introductions and generalizations of facts and
+casing,
+naming $\dots$ operations. It also a common practice to make a stack
+operation immediately followed by an \emph{interpretation} of the fact
+being pushed,
+that is, to apply a lemma to this fact before passing it
+to a tactic for decomposition, application and so on.
+
+
+% possibly
+
+% Small scale reflection consists in using a two levels
+% approach locally when developing formal proofs. This means that a
+% fact, which may be an assumption, or the goal itself, will often be
+% \emph{interpreted} before being passed to a tactic
+% for decomposition, application and so on.
+
+\ssr{} provides a convenient, unified syntax to combine these
+interpretation operations with the proof stack operations. This
+\emph{view mechanism} relies on the combination of the \ssrC{/} view
+switch with bookkeeping tactics and tacticals.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection{Interpreting eliminations}
+\idx{elim/\dots{}}
+
+The view syntax combined with the \ssrC{elim} tactic specifies an
+elimination scheme to
+be used instead of the default, generated, one. Hence the \ssr{} tactic:
+\begin{lstlisting}
+ elim/V.
+\end{lstlisting}
+is a synonym for:
+\begin{lstlisting}
+ intro top; elim top using V; clear top.
+\end{lstlisting}
+where \ssrC{top} is a fresh name and \ssrC{V} any second-order lemma.
+
+Since an elimination view supports the two bookkeeping tacticals of
+discharge and introduction (see section \ref{sec:book}), the \ssr{} tactic:
+\begin{lstlisting}
+ elim/V: x => y.
+\end{lstlisting}
+is a synonym for:
+\begin{lstlisting}
+ elim x using V; clear x; intro y.
+\end{lstlisting}
+where \ssrC{x} is a variable in the context, \ssrC{y} a fresh name and \ssrC{V}
+any second order lemma; \ssr{} relaxes the syntactic restrictions of
+the \Coq{} \ssrC{elim}. The first pattern following \ssrC{:} can be a \ssrC{_}
+wildcard if the conclusion of the view \ssrC{V} specifies a pattern for
+its last argument (e.g., if \ssrC{V} is a functional induction lemma
+generated by the \ssrC{Function} command).
+
+The elimination view mechanism is compatible with the equation name
+generation (see section \ref{ssec:equations}).
+
+The following script illustrate a toy example of this feature. Let us
+define a function adding an element at the end of a list:
+\begin{lstlisting}
+ Require Import List.
+
+ Variable d : Type.
+
+ Fixpoint |*add_last*|(s : list d) (z : d) {struct s} : list d :=
+ match s with
+ | nil => z :: nil
+ | cons x s' => cons x (add_last s' z)
+ end.
+\end{lstlisting}
+
+One can define an alternative, reversed, induction principle on inductively
+defined \ssrC{list}s, by proving the following lemma:
+
+\begin{lstlisting}
+ Lemma |*last_ind_list*| : forall (P : list d -> Type),
+ P nil ->
+ (forall (s : list d) (x : d), P s -> P (add_last s x)) -> forall s : list d, P s.
+\end{lstlisting}
+
+Then the combination of elimination views with equation names result
+in a concise syntax for reasoning inductively using the user
+defined elimination scheme. The script:
+\begin{lstlisting}
+ Goal forall (x : d)(l : list d), l = l.
+ move=> x l.
+ elim/last_ind_list E : l=> [| u v]; last first.
+\end{lstlisting}
+generates two subgoals: the first one to prove \ssrC{nil = nil} in a
+context featuring \ssrC{E : l = nil} and the second to prove
+\ssrC{add_last u v = add_last u v}, in a context containing
+\ssrC{E : l = add_last u v}.
+
+User provided eliminators (potentially generated with the
+\ssrC{Function} \Coq{}'s command) can be combined with the type family switches
+described in section~\ref{ssec:typefam}. Consider an eliminator
+\ssrC{foo_ind} of type:
+
+ \ssrC{foo_ind : forall $\dots$, forall x : T, P p$_1$ $\dots$ p$_m$}
+
+and consider the tactic
+
+ \ssrC{elim/foo_ind: e$_1$ $\dots$ / e$_n$}
+
+The \ssrC{elim/} tactic distinguishes two cases:
+\begin{description}
+\item[truncated eliminator] when \ssrC{x} does not occur in \ssrC{P p$_1 \dots$ p$_m$}
+ and the type of \ssrC{e$_n$} unifies with \ssrC{T} and \ssrC{e$_n$} is not \ssrC{_}.
+ In that case, \ssrC{e$_n$} is passed to the eliminator as the last argument
+ (\ssrC{x} in \ssrC{foo_ind}) and \ssrC{e$_{n-1} \dots$ e$_1$} are used as patterns
+ to select in the goal the occurrences that will be bound by the
+ predicate \ssrC{P}, thus it must be possible to unify the sub-term of
+ the goal matched by \ssrC{e$_{n-1}$} with \ssrC{p$_m$}, the one matched by
+ \ssrC{e$_{n-2}$} with \ssrC{p$_{m-1}$} and so on.
+\item[regular eliminator] in all the other cases. Here it must be
+ possible to unify the term matched by
+ \ssrC{e$_n$} with \ssrC{p$_m$}, the one matched by
+ \ssrC{e$_{n-1}$} with \ssrC{p$_{m-1}$} and so on. Note that
+ standard eliminators have the shape \ssrC{$\dots$forall x, P $\dots$ x}, thus
+ \ssrC{e$_n$} is the pattern identifying the eliminated term, as expected.
+\end{description}
+As explained in section~\ref{ssec:typefam}, the initial prefix of
+\ssrC{e$_i$} can be omitted.
+
+Here an example of a regular, but non trivial, eliminator:
+\begin{lstlisting}
+ Function |*plus*| (m n : nat) {struct n} : nat :=
+ match n with 0 => m | S p => S (plus m p) end.
+\end{lstlisting}
+The type of \ssrC{plus_ind} is
+\begin{lstlisting}
+plus_ind : forall (m : nat) (P : nat -> nat -> Prop),
+ (forall n : nat, n = 0 -> P 0 m) ->
+ (forall n p : nat, n = p.+1 -> P p (plus m p) -> P p.+1 (plus m p).+1) ->
+ forall n : nat, P n (plus m n)
+\end{lstlisting}
+Consider the following goal
+\begin{lstlisting}
+ Lemma |*exF*| x y z: plus (plus x y) z = plus x (plus y z).
+\end{lstlisting}
+The following tactics are all valid and perform the same elimination
+on that goal.
+\begin{lstlisting}
+ elim/plus_ind: z / (plus _ z).
+ elim/plus_ind: {z}(plus _ z).
+ elim/plus_ind: {z}_.
+ elim/plus_ind: z / _.
+\end{lstlisting}
+In the two latter examples, being the user provided pattern a wildcard, the
+pattern inferred from the type of the eliminator is used instead. For both
+cases it is \ssrC{(plus _ _)} and matches the subterm \ssrC{plus (plus x y)$\;$z} thus
+instantiating the latter \ssrC{_} with \ssrC{z}. Note that the tactic
+\ssrC{elim/plus_ind: y / _} would have resulted in an error, since \ssrC{y} and \ssrC{z}
+do no unify but the type of the eliminator requires the second argument of
+\ssrC{P} to be the same as the second argument of \ssrC{plus} in the second
+argument of \ssrC{P}.
+
+Here an example of a truncated eliminator. Consider the goal
+\begin{lstlisting}
+ p : nat_eqType
+ n : nat
+ n_gt0 : 0 < n
+ pr_p : prime p
+ =================
+ p %| \prod_(i <- prime_decomp n | i \in prime_decomp n) i.1 ^ i.2 ->
+ exists2 x : nat * nat, x \in prime_decomp n & p = x.1
+\end{lstlisting}
+and the tactic
+\begin{lstlisting}
+elim/big_prop: _ => [| u v IHu IHv | [q e] /=].
+\end{lstlisting}
+where the type of the eliminator is
+\begin{lstlisting}
+big_prop: forall (R : Type) (Pb : R -> Type) (idx : R) (op1 : R -> R -> R),
+ Pb idx ->
+ (forall x y : R, Pb x -> Pb y -> Pb (op1 x y)) ->
+ forall (I : Type) (r : seq I) (P : pred I) (F : I -> R),
+ (forall i : I, P i -> Pb (F i)) ->
+ Pb (\big[op1/idx]_(i <- r | P i) F i)
+\end{lstlisting}
+Since the pattern for the argument of \ssrC{Pb} is not specified, the inferred one
+is used instead: \ssrC{(\\big[_/_]_(i <- _ | _ i) _ i)}, and after the
+introductions, the following goals are generated.
+\begin{lstlisting}
+subgoal 1 is:
+ p %| 1 -> exists2 x : nat * nat, x \in prime_decomp n & p = x.1
+subgoal 2 is:
+ p %| u * v -> exists2 x : nat * nat, x \in prime_decomp n & p = x.1
+subgoal 3 is:
+ (q, e) \in prime_decomp n -> p %| q ^ e ->
+ exists2 x : nat * nat, x \in prime_decomp n & p = x.1
+\end{lstlisting}
+Note that the pattern matching algorithm instantiated all the variables
+occurring in the pattern.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection{Interpreting assumptions}\label{ssec:assumpinterp}
+\idx{move/\dots{}}
+
+Interpreting an assumption in the context of a proof is applying it a
+correspondence lemma before generalizing, and/or decomposing it.
+For instance, with the extensive use of boolean reflection (see
+section \ref{ssec:boolrefl}), it is
+quite frequent to need to decompose the logical interpretation of (the
+boolean expression of) a
+fact, rather than the fact itself.
+This can be achieved by a combination of \ssrC{move : _ => _}
+switches, like in the following script, where \ssrC{||} is a notation for
+the boolean disjunction:
+\begin{lstlisting}
+ Variables P Q : bool -> Prop.
+ Hypothesis |*P2Q*| : forall a b, P (a || b) -> Q a.
+
+ Goal forall a, P (a || a) -> True.
+ move=> a HPa; move: {HPa}(P2Q _ _ HPa) => HQa.
+\end{lstlisting}
+which transforms the hypothesis \ssrC{HPn : P n} which has been
+introduced from the initial statement into \ssrC{HQn : Q n}.
+This operation is so common that the tactic shell has
+specific syntax for it.
+The following scripts:
+\begin{lstlisting}
+ Goal forall a, P (a || a) -> True.
+ move=> a HPa; move/P2Q: HPa => HQa.
+\end{lstlisting}
+or more directly:
+\begin{lstlisting}
+ Goal forall a, P (a || a) -> True.
+ move=> a; move/P2Q=> HQa.
+\end{lstlisting}
+are equivalent to the former one. The former script shows how to
+interpret a fact (already in the context), thanks to the discharge
+tactical (see section \ref{ssec:discharge}) and the latter, how to
+interpret the top assumption of a goal. Note
+that the number of wildcards to be inserted to find the correct
+application of the view lemma to the hypothesis has been automatically
+inferred.
+
+The view mechanism is compatible with the \ssrC{case} tactic and with the
+equation name generation mechanism (see section \ref{ssec:equations}):
+\begin{lstlisting}
+ Variables P Q: bool -> Prop.
+ Hypothesis |*Q2P*| : forall a b, Q (a || b) -> P a \/ P b.
+
+ Goal forall a b, Q (a || b) -> True.
+ move=> a b; case/Q2P=> [HPa | HPb].
+\end{lstlisting}
+creates two new subgoals whose contexts no more contain
+\ssrC{HQ : Q (a || b)} but respectively \ssrC{HPa : P a} and
+\ssrC{HPb : P b}. This view tactic
+performs:
+\begin{lstlisting}
+ move=> a b HQ; case: {HQ}(Q2P _ _ HQ) => [HPa | HPb].
+\end{lstlisting}
+
+The term on the right of the \ssrC{/} view switch is called a \emph{view
+ lemma}. Any \ssr{} term coercing to a product type can be used as a
+view lemma.
+
+
+The examples we have given so far explicitly provide the direction of the
+translation to be performed. In fact, view lemmas need not to be
+oriented. The view mechanism is able to detect which
+application is relevant for the current goal. For instance, the
+script:
+\begin{lstlisting}
+ Variables P Q: bool -> Prop.
+ Hypothesis |*PQequiv*| : forall a b, P (a || b) <-> Q a.
+
+ Goal forall a b, P (a || b) -> True.
+ move=> a b; move/PQequiv=> HQab.
+\end{lstlisting}
+has the same behavior as the first example above.
+
+The view mechanism can insert automatically a \emph{view hint} to
+transform the double implication into the expected simple implication.
+The last script is in fact equivalent to:
+\begin{lstlisting}
+ Goal forall a b, P (a || b) -> True.
+ move=> a b; move/(iffLR (PQequiv _ _)).
+\end{lstlisting}
+where:
+\begin{lstlisting}
+ Lemma |*iffLR*| : forall P Q, (P <-> Q) -> P -> Q.
+\end{lstlisting}
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsubsection*{Specializing assumptions}
+\idx{move/\dots{}}
+
+The special case when the \emph{head symbol} of the view lemma is a
+wildcard is used to interpret an assumption by \emph{specializing}
+it. The view mechanism hence offers the possibility to
+apply a higher-order assumption to some given arguments.
+
+For example, the script:
+\begin{lstlisting}
+ Goal forall z, (forall x y, x + y = z -> z = x) -> z = 0.
+ move=> z; move/(_ 0 z).
+\end{lstlisting}
+changes the goal into:
+\begin{lstlisting}
+ (0 + z = z -> z = 0) -> z = 0
+\end{lstlisting}
+
+
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection{Interpreting goals}\label{ssec:goalinterp}
+
+In a similar way, it is also often convenient to interpret a goal by changing
+it into an equivalent proposition. The view mechanism of \ssr{} has a
+special syntax \ssrC{apply/} for combining simultaneous goal
+interpretation operations and
+bookkeeping steps in a single tactic.
+
+With the hypotheses of section \ref{ssec:assumpinterp}, the following
+script, where \ssrL+~~+ denotes the boolean negation:
+\begin{lstlisting}
+ Goal forall a, P ((~~ a) || a).
+ move=> a; apply/PQequiv.
+\end{lstlisting}
+transforms the goal into \ssrC{Q (~~ a)}, and is equivalent to:
+\begin{lstlisting}
+ Goal forall a, P ((~~ a) || a).
+ move=> a; apply: (iffRL (PQequiv _ _)).
+\end{lstlisting}
+where \ssrC{iffLR} is the analogous of \ssrC{iffRL} for the converse
+implication.
+
+Any \ssr{} term whose type coerces to a double implication can be used
+as a view for goal interpretation.
+
+Note that the goal interpretation view mechanism supports both
+\ssrC{apply} and \ssrC{exact} tactics. As expected, a goal interpretation
+view command \ssrC{exact/$term$} should solve the current goal or it will
+fail.
+
+
+\emph{Warning} Goal interpretation view tactics are \emph{not} compatible
+with the bookkeeping tactical \ssrC{=>} since this would be redundant with
+the \ssrC{apply:} {\term} \ssrC{=> _} construction.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection{Boolean reflection}\label{ssec:boolrefl}
+In the Calculus of Inductive Construction, there is
+an obvious distinction between logical propositions and boolean values.
+On the one hand, logical propositions are objects
+of \emph{sort} \ssrC{Prop} which is the carrier of intuitionistic
+reasoning. Logical connectives in \ssrC{Prop} are \emph{types}, which give precise
+information on the structure of their proofs; this information is
+automatically exploited by \Coq{} tactics. For example, \Coq{} knows that a
+proof of \ssrL+A \/ B+ is either a proof of \ssrC{A} or a proof of \ssrC{B}.
+The tactics \ssrC{left} and \ssrC{right} change the goal \ssrL+A \/ B+
+to \ssrC{A} and \ssrC{B}, respectively; dualy, the tactic \ssrC{case} reduces the goal
+\ssrL+A \/ B => G+ to two subgoals \ssrC{A => G} and \ssrC{B => G}.
+
+On the other hand, \ssrC{bool} is an inductive \emph{datatype}
+with two constructors \ssrC{true} and \ssrC{false}.
+Logical connectives on \ssrC{bool} are \emph{computable functions}, defined by
+their truth tables, using case analysis:
+\begin{lstlisting}
+ Definition (b1 || b2) := if b1 then true else b2.
+\end{lstlisting}
+Properties of such connectives are also established using case
+analysis: the tactic \ssrC{by case: b} solves the goal
+\begin{lstlisting}
+ b || ~~ b = true
+\end{lstlisting}
+by replacing \ssrC{b} first by \ssrC{true} and then by \ssrC{false}; in either case,
+the resulting subgoal reduces by computation to the trivial
+\ssrC{true = true}.
+
+Thus, \ssrC{Prop} and \ssrC{bool} are truly complementary: the former
+supports robust natural deduction, the latter allows brute-force
+evaluation.
+\ssr{} supplies
+a generic mechanism to have the best of the two worlds and move freely
+from a propositional version of a
+decidable predicate to its boolean version.
+
+First, booleans are injected into propositions
+using the coercion mechanism:
+\begin{lstlisting}
+ Coercion |*is_true*| (b : bool) := b = true.
+\end{lstlisting}
+This allows any boolean formula~\ssrC{b} to be used in a context
+where \Coq{} would expect a proposition, e.g., after \ssrC{Lemma $\dots$ : }.
+It is then interpreted as \ssrC{(is_true b)}, i.e.,
+the proposition \ssrC{b = true}. Coercions are elided by the pretty-printer,
+so they are essentially transparent to the user.
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection{The \ssrC{reflect} predicate}\label{ssec:reflpred}
+
+To get all the benefits of the boolean reflection, it is in fact
+convenient to introduce the following inductive predicate
+\ssrC{reflect} to relate propositions and booleans:
+
+\begin{lstlisting}
+ Inductive |*reflect*| (P: Prop): bool -> Type :=
+ | Reflect_true: P => reflect P true
+ | Reflect_false: ~P => reflect P false.
+\end{lstlisting}
+
+The statement \ssrC{(reflect P b)} asserts that \ssrC{(is_true b)}
+and \ssrC{P} are logically equivalent propositions.
+
+For instance, the following lemma:
+\begin{lstlisting}
+ Lemma |*andP*|: forall b1 b2, reflect (b1 /\ b2) (b1 && b2).
+\end{lstlisting}
+relates the boolean conjunction \ssrC{&&} to
+the logical one \ssrL+/\+.
+Note that in \ssrC{andP}, \ssrC{b1} and \ssrC{b2} are two boolean variables and
+the proposition \ssrL+b1 /\ b2+ hides two coercions.
+The conjunction of \ssrC{b1} and \ssrC{b2} can then be viewed
+as \ssrL+b1 /\ b2+ or as \ssrC{b1 && b2}.
+
+
+Expressing logical equivalences through this family of inductive types
+makes possible to take benefit from \emph{rewritable equations}
+associated to the case analysis of \Coq{}'s inductive types.
+
+Since the equivalence predicate is defined in \Coq{} as:
+\begin{lstlisting}
+ Definition |*iff*| (A B:Prop) := (A -> B) /\ (B -> A).
+\end{lstlisting}
+where \ssrC{/\\} is a notation for \ssrC{and}:
+\begin{lstlisting}
+ Inductive |*and*| (A B:Prop) : Prop :=
+ conj : A -> B -> and A B
+\end{lstlisting}
+
+This make case analysis very different according to the way an
+equivalence property has been defined.
+
+
+For instance, if we have proved the lemma:
+\begin{lstlisting}
+ Lemma |*andE*|: forall b1 b2, (b1 /\ b2) <-> (b1 && b2).
+\end{lstlisting}
+let us compare the respective behaviours of \ssrC{andE} and \ssrC{andP} on a
+goal:
+\begin{lstlisting}
+ Goal forall b1 b2, if (b1 && b2) then b1 else ~~(b1||b2).
+\end{lstlisting}
+
+The command:
+\begin{lstlisting}
+ move=> b1 b2; case (@andE b1 b2).
+\end{lstlisting}
+generates a single subgoal:
+\begin{lstlisting}
+ (b1 && b2 -> b1 /\ b2) -> (b1 /\ b2 -> b1 && b2) ->
+ if b1 && b2 then b1 else ~~ (b1 || b2)
+\end{lstlisting}
+
+while the command:
+\begin{lstlisting}
+ move=> b1 b2; case (@andP b1 b2).
+\end{lstlisting}
+generates two subgoals, respectively \ssrL+b1 /\ b2 -> b1+ and
+\ssrL+~ (b1 /\ b2) -> ~~ (b1 || b2)+.
+
+
+
+Expressing reflection relation through the \ssrC{reflect} predicate
+is hence a very convenient way to deal with classical reasoning, by
+case analysis. Using the \ssrC{reflect} predicate allows moreover to
+program rich specifications inside
+its two constructors, which will be automatically taken into account
+during destruction. This formalisation style gives far more
+efficient specifications than quantified (double) implications.
+
+
+A naming convention in \ssr{} is to postfix the name of view lemmas with \ssrC{P}.
+For example, \ssrC{orP} relates \ssrC{||} and \ssrL+\/+, \ssrC{negP} relates
+\ssrL+~~+ and \ssrL+~+.
+
+The view mechanism is compatible with \ssrC{reflect} predicates.
+
+For example, the script
+\begin{lstlisting}
+ Goal forall a b : bool, a -> b -> a /\\ b.
+ move=> a b Ha Hb; apply/andP.
+\end{lstlisting}
+changes the goal \ssrL+a /\ b+ to \ssrC{a && b} (see section \ref{ssec:goalinterp}).
+
+Conversely, the script
+\begin{lstlisting}
+ Goal forall a b : bool, a /\ b -> a.
+ move=> a b; move/andP.
+\end{lstlisting}
+changes the goal \ssrL+a /\ b -> a+ into \ssrC{a && b -> a} (see section
+\ref{ssec:assumpinterp}).
+
+
+The same tactics can also be used to perform the converse
+operation, changing a boolean conjunction into a logical one. The view
+mechanism guesses the direction of the
+transformation to be used i.e., the constructor of the \ssrC{reflect}
+predicate which should be chosen.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection{General mechanism for interpreting goals and assumptions}
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsubsection*{Specializing assumptions}
+\idx{move/\dots{}}
+
+The \ssr{}
+tactic:
+
+ \ssrC{move/(_} \ssrN[1]{term} $\dots$ \ssrN[n]{term}\ssrC{)}
+
+\noindent
+is equivalent to the tactic:
+
+ \ssrC{intro top; generalize (top} \ssrN[1]{term} $\dots$ \ssrN[n]{term}\ssrC{); clear top.}
+
+\noindent
+where \ssrC{top} is a fresh name for introducing the top assumption of
+the current goal.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsubsection*{Interpreting assumptions}
+\label{sssec:hypview}
+The general form of an assumption view tactic is:
+
+\begin{center}
+ \optional{\ssrC{move} {\optsep} \ssrC{case}} \ssrC{/} \ssrN[0]{term}
+\end{center}
+
+The term \ssrN[0]{term}, called the \emph{view lemma} can be:
+\begin{itemize}
+\item a (term coercible to a) function;
+\item a (possibly quantified) implication;
+\item a (possibly quantified) double implication;
+\item a (possibly quantified) instance of the \ssrC{reflect} predicate
+ (see section \ref{ssec:reflpred}).
+\end{itemize}
+
+Let \ssrC{top} be the top assumption in the goal.
+
+There are three steps in the behaviour of an assumption view tactic:
+\begin{itemize}
+\item It first introduces \ssrL+top+.
+\item If the type of \ssrN[0]{term} is neither a double implication nor
+ an instance of the \ssrC{reflect} predicate, then the tactic
+ automatically generalises a term of the form:
+
+\begin{center}
+ \ssrC{(}\ssrN[0]{term} \ssrN[1]{term} $\dots$ \ssrN[n]{term}\ssrC{)}
+\end{center}
+
+ where the terms \ssrN[1]{term} $\dots$ \ssrN[n]{term} instantiate the
+ possible quantified variables of \ssrN[0]{term}, in order for
+ \ssrC{(}\ssrN[0]{term} \ssrN[1]{term} $\dots$ \ssrN[n]{term} \ssrC{top)} to be well typed.
+\item If the type of $\ssrN[0]{term}$ is an equivalence, or
+ an instance of the \ssrC{reflect} predicate, it generalises a term of
+ the form:
+ \begin{center}
+ (\ssrN[vh]{term} (\ssrN[0]{term} \ssrN[1]{term} $\dots$ \ssrN[n]{term}))
+ \end{center}
+ where the term \ssrN[vh]{term} inserted is called an
+ \emph{assumption interpretation view hint}.
+\item It finally clears \ssrC{top}.
+\end{itemize}
+For a \ssrC{case/}\ssrN[0]{term} tactic, the generalisation step is
+replaced by a case analysis step.
+
+\emph{View hints} are declared by the user (see section
+\ref{ssec:vhints}) and are stored in the \ssrC{Hint View} database.
+The proof engine automatically
+detects from the shape of the top assumption \ssrC{top} and of the view
+lemma $\ssrN[0]{term}$ provided to the tactic the appropriate view hint in
+the database to be inserted.
+
+If $\ssrN[0]{term}$ is a double implication, then the view hint \ssrC{A} will
+be one of the defined view hints for implication. These hints are by
+default the ones present in the file {\tt ssreflect.v}:
+\begin{lstlisting}
+ Lemma |*iffLR*| : forall P Q, (P <-> Q) -> P -> Q.
+\end{lstlisting}
+which transforms a double implication into the left-to-right one, or:
+\begin{lstlisting}
+ Lemma |*iffRL*| : forall P Q, (P <-> Q) -> Q -> P.
+\end{lstlisting}
+which produces the converse implication. In both cases, the two first
+\ssrC{Prop} arguments are implicit.
+
+If $\ssrN[0]{term}$ is an instance of the \ssrC{reflect} predicate, then \ssrC{A}
+will be one of the defined view hints for the \ssrC{reflect}
+predicate, which are by
+default the ones present in the file {\tt ssrbool.v}.
+These hints are not only used for choosing the appropriate direction of
+the translation, but they also allow complex transformation, involving
+negations.
+ For instance the hint:
+\begin{lstlisting}
+ Lemma |*introN*| : forall (P : Prop) (b : bool), reflect P b -> ~ P -> ~~ b.
+\end{lstlisting}
+makes the following script:
+\begin{lstlisting}
+ Goal forall a b : bool, a -> b -> ~~ (a && b).
+ move=> a b Ha Hb. apply/andP.
+\end{lstlisting}
+transforms the goal into \ssrC{ \~ (a /\ b)}.
+In fact\footnote{The current state of the proof shall be displayed by
+ the \ssrC{Show Proof} command of \Coq{} proof mode.}
+this last script does not exactly use the hint \ssrC{introN}, but the
+more general hint:
+\begin{lstlisting}
+ Lemma |*introNTF*| : forall (P : Prop) (b c : bool),
+ reflect P b -> (if c then ~ P else P) -> ~~ b = c
+\end{lstlisting}
+The lemma \ssrL+|*introN*|+ is an instantiation of \ssrC{introNF} using
+ \ssrC{c := true}.
+
+Note that views, being part of \ssrN{i-pattern}, can be used to interpret
+assertions too. For example the following script asserts \ssrC{a \&\& b}
+but actually used its propositional interpretation.
+\begin{lstlisting}
+ Lemma |*test*| (a b : bool) (pab : b && a) : b.
+ have /andP [pa ->] : (a && b) by rewrite andbC.
+\end{lstlisting}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsubsection*{Interpreting goals}
+\idx{apply/\dots{}}
+
+A goal interpretation view tactic of the form:
+
+\begin{center}
+ \ssrC{apply/} \ssrN[0]{term}
+\end{center}
+applied to a goal \ssrC{top} is interpreted in the following way:
+\begin{itemize}
+\item If the type of $\ssrN[0]{term}$ is not an instance of the
+ \ssrC{reflect} predicate, nor an equivalence,
+ then the term $\ssrN[0]{term}$ is applied to the current goal \ssrC{top},
+ possibly inserting implicit arguments.
+\item If the type of $\ssrN[0]{term}$ is an instance of the \ssrC{reflect}
+ predicate or an equivalence, then
+a \emph{goal interpretation view hint} can possibly be inserted, which
+corresponds to the application of a term
+\ssrC{($\ssrN[vh]{term}$ ($\ssrN[0]{term}$ _ $\dots$ _))} to the current
+goal, possibly inserting implicit arguments.
+\end{itemize}
+
+Like assumption interpretation view hints, goal interpretation ones
+are user defined lemmas stored (see section \ref{ssec:vhints}) in the
+\ssrC{Hint View} database bridging
+the possible gap between the type of $\ssrN[0]{term}$ and the type of the
+goal.
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection{Interpreting equivalences}
+\idx{apply/\dots{}/\dots{}}
+
+Equivalent boolean propositions are simply \emph{equal} boolean terms.
+A special construction helps the user to prove boolean equalities by
+considering them as logical double implications (between their coerced
+versions), while
+performing at the same time logical operations on both sides.
+
+The syntax of double views is:
+\begin{center}
+ \ssrC{apply/} \ssrN[l]{term} \ssrC{/} \ssrN[r]{term}
+\end{center}
+
+The term \ssrN[l]{term} is the view lemma applied to the left hand side of the
+equality, \ssrN[r]{term} is the one applied to the right hand side.
+
+In this context, the identity view:
+\begin{lstlisting}
+Lemma |*idP*| : reflect b1 b1.
+\end{lstlisting}
+is useful, for example the tactic:
+\begin{lstlisting}
+ apply/idP/idP.
+\end{lstlisting}
+transforms the goal
+\ssrL+~~ (b1 || b2)= b3+
+ into two subgoals, respectively
+ \ssrL+~~ (b1 || b2) -> b3+ and \\
+\ssrL+b3 -> ~~ (b1 || b2).+
+
+The same goal can be decomposed in several ways, and the user may
+choose the most convenient interpretation. For instance, the tactic:
+\begin{lstlisting}
+ apply/norP/idP.
+\end{lstlisting}
+applied on the same goal \ssrL+~~ (b1 || b2) = b3+ generates the subgoals
+\ssrL+~~ b1 /\ ~~ b2 -> b3+ and\\
+\ssrL+b3 -> ~~ b1 /\ ~~ b2+.
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection{Declaring new \ssrC{Hint View}s}\label{ssec:vhints}
+\idxC{Hint View}
+
+The database of hints for the view mechanism is extensible via a
+dedicated vernacular command. As library {\tt ssrbool.v} already
+declares a corpus of hints, this feature is probably useful only for
+users who define their own logical connectives. Users can declare
+their own hints following the syntax used in {\tt ssrbool.v}:
+
+\begin{center}
+ \ssrC{Hint View for} {\tac} \ssrC{/} \ssrN{ident} \optional{\ssrC{|}{\naturalnumber}}
+\end{center}
+
+ where {\tac}$\in \{$\ssrC{move, apply}$\}$, \ssrN{ident} is the
+name of the lemma to be declared as a hint, and ${\naturalnumber}$ a natural
+number. If \ssrL+move+ is used as {\tac}, the hint is declared for
+assumption interpretation tactics, \ssrL+apply+ declares hints for goal
+interpretations.
+Goal interpretation view hints are declared for both simple views and
+left hand side views. The optional natural number ${\naturalnumber}$ is the
+number of implicit arguments to be considered for the declared hint
+view lemma \ssrC{name_of_the_lemma}.
+
+The command:
+
+\begin{center}
+ \ssrC{Hint View for apply//} \ssrN{ident}\optional{\ssrC{|}{\naturalnumber}}.
+\end{center}
+
+with a double slash \ssrL+//+, declares hint views for right hand sides of
+double views.
+
+
+\noindent See the files {\tt ssreflect.v} and {\tt ssrbool.v} for examples.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection{Multiple views}\label{ssec:multiview}
+
+The hypotheses and the goal can be interpreted applying multiple views in
+sequence. Both \ssrC{move} and \ssrC{apply} can be followed by an arbitrary number
+of \ssrC{/}$\ssrN[i]{term}$. The main difference between the following two tactics
+\begin{lstlisting}
+ apply/v1/v2/v3.
+ apply/v1; apply/v2; apply/v3.
+\end{lstlisting}
+is that the former applies all the views to the principal goal.
+Applying a view with hypotheses generates new goals, and the second line
+would apply the view \ssrC{v2} to all the goals generated by \ssrC{apply/v1}.
+Note that the NO-OP intro pattern \ssrC{-} can be used to separate two
+views, making the two following examples equivalent:
+\begin{lstlisting}
+ move=> /v1; move=> /v2.
+ move=> /v1-/v2.
+\end{lstlisting}
+
+The tactic \ssrC{move} can be used together with the \ssrC{in}
+tactical to pass a given hypothesis to a lemma. For example, if
+\ssrC{P2Q : P -> Q } and \ssrC{Q2R : Q -> R}, the following
+tactic turns the hypothesis \ssrC{p : P} into \ssrC{P : R}.
+\begin{lstlisting}
+ move/P2Q/Q2R in p.
+\end{lstlisting}
+
+If the list of views is of length two, \ssrC{Hint View}s for interpreting
+equivalences are indeed taken into account, otherwise only single
+\ssrC{Hint View}s are used.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{\ssr{} searching tool}
+\idxC{Search \dots{}}
+
+\ssr{} proposes an extension of the \ssrC{Search} command. Its syntax is:
+
+\begin{center}
+ \ssrC{Search} \optional{\ssrN{pattern}} \optional{\optional{\ssrC{\-}} \optional{\ssrN{string}\optional{\ssrC{\%}\ssrN{key}} {\optsep} \ssrN{pattern}}}$^*$ \optional{\ssrC{in} \optional{\optional{\ssrC{\-}} \ssrN{name} }$^+$}
+\end{center}
+
+% \begin{lstlisting}
+% Search [[\~]\ssrN{string}]$^*$ [\ssrN{pattern}] [[$\ssrN[1]{pattern} \dots $ $\ssrN[n]{pattern}$]] $[[$inside$|$outside$]$ $M_1 \dots M_n$].
+% \end{lstlisting}
+
+% This tactic returns the list of defined constants matching the
+% given criteria:
+% \begin{itemize}
+% \item \ssrL+[[-]\ssrN{string}]$^*$+ is an open sequence of strings, which sould
+% all appear in the name of the returned constants. The optional \ssrL+-+
+% prefixes strings that are required \emph{not} to appear.
+% % \item \ssrN{pattern} should be a subterm of the
+% % \emph{conclusion} of the lemmas found by the command. If a lemma features
+% % an occurrence
+% % of this pattern only in one or several of its assumptions, it will not be
+% % selected by the searching tool.
+% \item
+% \ssrL=[$\ssrN{pattern}^+$]=
+% is a list of \ssr{} terms, which may
+% include types, that are required to appear in the returned constants.
+% Terms with holes should be surrounded by parentheses.
+% \item $\ssrC{in}\ [[\ssrC{\-}]M]^+$ limits the search to the signature
+% of open modules given in the list, but the ones preceeded by the
+% $\ssrC{\-}$ flag. The
+% command:
+% \begin{lstlisting}
+% Search in M.
+% \end{lstlisting}
+% is hence a way of obtaining the complete signature of the module \ssrL{M}.
+% \end{itemize}
+where \ssrN{name} is the name of an open module.
+This command search returns the list of lemmas:
+\begin{itemize}
+\item whose \emph{conclusion} contains a subterm matching the optional
+ first \ssrN{pattern}. A $\ssrC{-}$ reverses the test, producing the list
+ of lemmas whose conclusion does not contain any subterm matching
+ the pattern;
+\item whose name contains the given string. A $\ssrC{-}$ prefix reverses
+ the test, producing the list of lemmas whose name does not contain the
+ string. A string that contains symbols or
+is followed by a scope \ssrN{key}, is interpreted as the constant whose
+notation involves that string (e.g., \ssrL=+= for \ssrL+addn+), if this is
+unambiguous; otherwise the diagnostic includes the output of the
+\ssrC{Locate} vernacular command.
+
+\item whose statement, including assumptions and types, contains a
+ subterm matching the next patterns. If a pattern is prefixed by
+ $\ssrC{-}$, the test is reversed;
+\item contained in the given list of modules, except the ones in the
+ modules prefixed by a $\ssrC{-}$.
+\end{itemize}
+
+Note that:
+\begin{itemize}
+\item As for regular terms, patterns can feature scope
+ indications. For instance, the command:
+\begin{lstlisting}
+ Search _ (_ + _)%N.
+\end{lstlisting}
+lists all the lemmas whose statement (conclusion or hypotheses)
+involve an application of the binary operation denoted by the infix
+\ssrC{+} symbol in the \ssrC{N} scope (which is \ssr{} scope for natural numbers).
+\item Patterns with holes should be surrounded by parentheses.
+\item Search always volunteers the expansion of the notation, avoiding the
+ need to execute Locate independently. Moreover, a string fragment
+ looks for any notation that contains fragment as
+ a substring. If the \ssrL+ssrbool+ library is imported, the command:
+\begin{lstlisting}
+ Search "~~".
+\end{lstlisting}
+answers :
+\begin{lstlisting}
+"~~" is part of notation (~~ _)
+In bool_scope, (~~ b) denotes negb b
+negbT forall b : bool, b = false -> ~~ b
+contra forall c b : bool, (c -> b) -> ~~ b -> ~~ c
+introN forall (P : Prop) (b : bool), reflect P b -> ~ P -> ~~ b
+\end{lstlisting}
+ \item A diagnostic is issued if there are different matching notations;
+ it is an error if all matches are partial.
+\item Similarly, a diagnostic warns about multiple interpretations, and
+ signals an error if there is no default one.
+\item The command \ssrC{Search in M.}
+is a way of obtaining the complete signature of the module \ssrL{M}.
+\item Strings and pattern indications can be interleaved, but the
+ first indication has a special status if it is a pattern, and only
+ filters the conclusion of lemmas:
+\begin{itemize}
+ \item The command :
+ \begin{lstlisting}
+ Search (_ =1 _) "bij".
+ \end{lstlisting}
+lists all the lemmas whose conclusion features a '$\ssrC{=1}$' and whose
+name contains the string \verb+bij+.
+\item The command :
+ \begin{lstlisting}
+ Search "bij" (_ =1 _).
+ \end{lstlisting}
+lists all the lemmas whose statement, including hypotheses, features a
+'$\ssrC{=1}$' and whose name contains the string \verb+bij+.
+
+\end{itemize}
+
+\end{itemize}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{Synopsis and Index}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection*{Parameters}
+
+\begin{minipage}[c]{\textwidth}\renewcommand{\footnoterule}{}
+\begin{longtable}{lcl}
+\ssrN{d-tactic} && one of the
+ \ssrC{elim}, \ssrC{case}, \ssrC{congr}, \ssrC{apply}, \ssrC{exact}
+ and \ssrC{move} \ssr{} tactics \\
+\ssrN{fix-body} && standard \Coq{} \textit{fix\_body}\\
+\ssrN{ident} && standard \Coq{} identifier\\
+\ssrN{int} && integer literal \\
+\ssrN{key} && notation scope\\
+\ssrN{name} && module name\\
+${\naturalnumber}$ && \ssrN{int} or Ltac variable denoting a standard \Coq{} numeral\footnote{The name of this Ltac variable should not be the name of a tactic which can be followed by a bracket
+ \ssrL+[+, like \ssrL+do+, \ssrL+ have+,\dots}\\
+\ssrN{pattern} && synonym for {\term}\\
+\ssrN{string} && standard \Coq{} string\\
+{\tac} && standard \Coq{} tactic or \ssr{} tactic\\
+{\term} & \hspace{1cm} & Gallina term, possibly containing wildcards\\
+%\ssrN{view} && global constant\\
+\end{longtable}
+\end{minipage}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection*{Items and switches}
+
+\begin{longtable}{lclr}
+\ssrN{binder} & {\ident} {\optsep} \ssrC{(} {\ident} \optional{\ssrC{:} {\term} } \ssrC{)} & binder& p. \pageref{ssec:pose}\\
+\\
+\ssrN{clear-switch} & \ssrC{\{} {\ident}$^+$ \ssrC{\}} & clear switch & p. \pageref{ssec:discharge}\\
+\\
+\ssrN{c-pattern} & \optional{{\term} \ssrC{in} {\optsep} {\term} \ssrC{as}} {\ident} \ssrC{in} {\term} & context pattern & p. \pageref{ssec:rewp} \\
+\\
+\ssrN{d-item} & \optional{\ssrN{occ-switch} {\optsep} \ssrN{clear-switch}} \optional{{\term} {\optsep} \ssrC{(}\ssrN{c-pattern}\ssrC{)}} & discharge item & p. \pageref{ssec:discharge}\\
+\\
+\ssrN{gen-item} & \optional{\ssrC{@}}{\ident} {\optsep} \ssrC{(}{\ident}\ssrC{)} {\optsep} \ssrC{(}\optional{\ssrC{@}}{\ident} \ssrC{:=} \ssrN{c-pattern}\ssrC{)} & generalization item & p. \pageref{ssec:struct}\\
+\\
+\ssrN{i-pattern} & {\ident} {\optsep} \ssrC{_} {\optsep} \ssrC{?} {\optsep} \ssrC{*} {\optsep} \optional{\ssrN{occ-switch}}\ssrC{->} {\optsep} \optional{\ssrN{occ-switch}}\ssrC{<-} {\optsep} & intro pattern & p. \pageref{ssec:intro}\\
+& \ssrC{[} \ssrN{i-item}$^*$ \ssrC{|} $\dots$ \ssrC{|} \ssrN{i-item}$^*$ \ssrC{]} {\optsep} \ssrC{-} {\optsep} \ssrC{[:} {\ident}$^+$\ssrC{]} &\\
+\\
+\ssrN{i-item} & \ssrN{clear-switch} {\optsep} \ssrN{s-item} {\optsep} \ssrN{i-pattern} {\optsep} \ssrC{/}{\term} & intro item & p. \pageref{ssec:intro}\\
+\\
+\ssrN{int-mult} & \optional{{\naturalnumber}} \ssrN{mult-mark} & multiplier & p. \pageref{ssec:iter}\\
+\\
+\ssrN{occ-switch} & \ssrC{\{} \optional{\ssrC{+} {\optsep} \ssrC{-}} {\naturalnumber}$^*$\ssrC{\}} & occur. switch & p. \pageref{sssec:occselect}\\
+\\
+\ssrN{mult} & \optional{{\naturalnumber}} \ssrN{mult-mark} & multiplier & p. \pageref{ssec:iter}\\
+\\
+\ssrN{mult-mark} & \ssrC{?} {\optsep} \ssrC{!} & multiplier mark & p. \pageref{ssec:iter}\\
+\\
+\ssrN{r-item} & \optional{\ssrC{/}} {\term} {\optsep} \ssrN{s-item} & rewrite item & p. \pageref{ssec:extrw}\\
+\\
+\ssrN{r-prefix} & \optional{\ssrC{-}} \optional{\ssrN{int-mult}} \optional{\ssrN{occ-switch} {\optsep} \ssrN{clear-switch}} \optional{\ssrC{[}\ssrN{r-pattern}\ssrC{]}} & rewrite prefix & p. \pageref{ssec:extrw}\\
+\\
+\ssrN{r-pattern} & {\term} {\optsep} \ssrN{c-pattern} {\optsep} \ssrC{in} \optional{{\ident} \ssrC{in}} {\term} & rewrite pattern & p. \pageref{ssec:extrw}\\
+\\
+\ssrN{r-step} & \optional{\ssrN{r-prefix}}\ssrN{r-item} & rewrite step & p. \pageref{ssec:extrw}\\
+\\
+\ssrN{s-item} & \ssrC{/=} {\optsep} \ssrC{//} {\optsep} \ssrC{//=} & simplify switch & p. \pageref{ssec:intro}\\
+\\
+\end{longtable}
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection*{Tactics}
+\emph{Note}: \ssrC{without loss} and \ssrC{suffices} are synonyms for \ssrC{wlog} and
+\ssrC{suff} respectively.
+
+\begin{longtable}{llr}
+\ssrC{move} & \textcolor{dkblue}{\texttt{idtac}} or \ssrC{hnf}& p. \pageref{ssec:profstack} \\
+\ssrC{apply} & application & p. \pageref{ssec:basictac}\\
+\ssrC{exact} &&\\
+\ssrC{abstract} && p. \pageref{ssec:abstract}, \pageref{sec:havetransparent}\\
+\\
+\ssrC{elim} & induction & p. \pageref{ssec:basictac}\\
+\ssrC{case} & case analysis & p. \pageref{ssec:basictac}\\
+\\
+\ssrC{rewrite} \ssrN{rstep}$^+$ & rewrite& p. \pageref{ssec:extrw}\\
+\\
+\ssrC{have} \ssrN{i-item}$^*$ \optional{\ssrN{i-pattern}} \optional{\ssrN{s-item} {\optsep} \ssrN{binder}$^+$} \optional{\ssrC{:} {\term}} \ssrC{:=} {\term} & forward & p. \pageref{ssec:struct}\\
+\ssrC{have} \ssrN{i-item}$^*$ \optional{\ssrN{i-pattern}} \optional{\ssrN{s-item}{\optsep} \ssrN{binder}$^+$} \ssrC{:} {\term} \optional{\ssrC{by} {\tac}} & chaining & \\
+\ssrC{have suff} \optional{\ssrN{clear-switch}} \optional{\ssrN{i-pattern}} \optional{\ssrC{:} {\term}} \ssrC{:=} {\term} & & \\
+\ssrC{have suff} \optional{\ssrN{clear-switch}} \optional{\ssrN{i-pattern}} \ssrC{:} {\term} \optional{\ssrC{by} {\tac}} & & \\
+\ssrC{gen have} \optional{{\ident}\ssrC{,}} \optional{\ssrN{i-pattern}} \ssrC{:} \ssrN{gen-item}$^+$ \ssrC{/} {\term} \optional{\ssrC{by} {\tac}} & & \\
+\\
+\ssrC{wlog} \optional{\ssrC{suff}} \optional{\ssrN{i-item}} \ssrC{:} \optional{\ssrN{gen-item}{\optsep} \ssrN{clear-switch}}$^*$ \ssrC{/} {\term} & specializing & p. \pageref{ssec:struct} \\
+\\
+\ssrC{suff} \ssrN{i-item}$^*$ \optional{\ssrN{i-pattern}} \optional{\ssrN{binder}$^+$} \ssrC{:} {\term} \optional{\ssrC{by} {\tac}} & backchaining & p. \pageref{ssec:struct}\\
+\ssrC{suff} \optional{\ssrC{have}} \optional{\ssrN{clear-switch}} \optional{\ssrN{i-pattern}} \ssrC{:} {\term} \optional{\ssrC{by} {\tac}} & & \\
+\\
+\ssrC{pose} {\ident} \ssrC{:=} {\term} & local definition& p. \pageref{ssec:pose}\\
+\ssrC{pose} {\ident} \ssrN{binder}$^+$ \ssrC{:=} {\term} & \rlap{local function definition}& \\
+\ssrC{pose fix} \ssrN{fix-body} & \rlap{local fix definition} & \\
+\ssrC{pose cofix} \ssrN{fix-body} & \rlap{local cofix definition} & \\
+\\
+\ssrC{set} {\ident} \optional{\ssrC{:} {\term}} \ssrC{:=} \optional{\ssrN{occ-switch}} \optional{{\term}{\optsep} \ssrC{(}\ssrN{c-pattern}\ssrC{)}} & abbreviation&p. \pageref{ssec:set}\\
+\\
+\ssrC{unlock} \optional{\ssrN{r-prefix}]{\ident}}$^*$ & unlock & p. \pageref{ssec:lock}\\
+\\
+\ssrC{congr} \optional{\naturalnumber} {\term} & congruence& p. \pageref{ssec:congr}\\
+\end{longtable}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection*{Tacticals}
+
+\begin{longtable}{lclr}
+\ssrN{d-tactic} \optional{\ident} \ssrC{:} \ssrN{d-item}$^{+}$ \optional{\ssrN{clear-switch}} & & discharge & p. \pageref{ssec:discharge}\\
+\\
+{\tac} \ssrC{=>} \ssrN{i-item}$^+$ && introduction & p. \pageref{ssec:intro}\\
+\\
+{\tac} \ssrC{in} \optional{\ssrN{gen-item} {\optsep} \ssrN{clear-switch}}$^+$ \optional{\ssrC{*}} && localization & p. \pageref{ssec:gloc}\\
+\\
+\ssrC{do} \optional{\ssrN{mult}} \ssrC{[} \nelist{\tac}{|} \ssrC{]}&& iteration & p. \pageref{ssec:iter}\\
+\ssrC{do} \ssrN{mult} {\tac} &&& \\
+\\
+{\tac} \ssrC{ ; first} \optional{\naturalnumber} \ssrC{[}\nelist{\tac}{|}\ssrC{]} && selector & p. \pageref{ssec:select}\\
+{\tac} \ssrC{ ; last} \optional{\naturalnumber} \ssrC{[}\nelist{\tac}{|}\ssrC{]} \\
+{\tac} \ssrC{ ; first} \optional{\naturalnumber} \ssrC{last} && subgoals & p. \pageref{ssec:select}\\
+{\tac} \ssrC{; last} \optional{\naturalnumber} \ssrC{first} && rotation & \\
+\\
+\ssrC{by [} \nelist{\tac}{|} \ssrC{]} && closing & p. \pageref{ssec:termin}\\
+\ssrC{by []} \\
+\ssrC{by} {\tac} \\
+\end{longtable}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection*{Commands}
+\begin{longtable}{lclr}
+\ssrL+Hint View for+ \optional{\ssrL+move+ {\it |} \ssrL+apply+} {\tt /} {\ident} \optional{{\tt|} {\naturalnumber}} && view hint
+declaration & p. \pageref{ssec:vhints}\\
+\\
+\ssrL+Hint View for apply//+ {\ident} \optional{{\tt|}{\naturalnumber}} && right hand side double
+ & p. \pageref{ssec:vhints}\\
+&& view hint declaration &\\
+\\
+%\ssrL+Import Prenex Implicits+ && enable prenex implicits &
+%p. \pageref{ssec:parampoly}\\
+%\\
+\ssrL+Prenex Implicits+ {\ident}$^+$ & \hspace{.6cm} & prenex implicits decl.
+ & p. \pageref{ssec:parampoly}\\
+
+\end{longtable}
+
+\iffalse
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{Changes}
+
+\subsection{\ssr{} version 1.3}
+All changes are retrocompatible extensions but for:
+\begin{itemize}
+\item Occurrences in the type family switch now refer only to the goal, while
+ before they used to refer also to the types in the abstractions of the
+ predicate used by the eliminator. This bug used to affect lemmas like
+ \ssrC{boolP}. See the relative comments in \ssrC{ssrbool.v}.
+\item Clear switches can only mention existing hypothesis and
+ otherwise fail. This can in particular affect intro patterns
+ simultaneously applied to several goals.
+ % commit: 2686
+\item A bug in the \ssrC{rewrite} tactic allowed to
+ instantiate existential metavariables occurring in the goal.
+ This is not the case any longer (see section~\ref{ssec:rewcaveats}).
+\item The \ssrC{fold} and \ssrC{unfold} \ssrN{r-items} for \ssrC{rewrite} used to
+ fail silently when used in combination with a \ssrN{r-pattern} matching no
+ goal subterm. They now fail. The old behavior can be obtained using
+ the \ssrC{?} multiplier (see section~\ref{ssec:extrw}).
+\item \Coq{} 8.2 users with a statically linked toplevel must comment out the\\
+ \ssrC{Declare ML Module "ssreflect".}\\
+ line at the beginning of \ssrC{ssreflect.v} to compile the 1.3 library.
+\end{itemize}
+New features:
+\begin{itemize}
+\item Contextual \ssrC{rewrite} patterns.
+ The context surrounding the redex can now be used to specify which
+ redex occurrences should be rewritten (see section~\ref{ssec:rewp}).\\
+ \ssrC{rewrite [in X in _ = X]addnC.}
+ % commit: 2690, 2689, 2718, 2733
+\item Proof irrelevant interpretation of goals with existential metavariables.
+ Goals containing an existential metavariable of sort \ssrC{Prop} are
+ generalized over it, and a new goal for the missing subproof is
+ generated (see page~\pageref{sssec:apply} and
+ section~\ref{ssec:rewcaveats}).\\
+ \ssrC{apply: (ex_intro _ (@Ordinal _ y _)).}\\
+ \ssrC{rewrite insubT.}
+ % commit: 2553, 2544, 2543, 2733
+\item Views are now part of \ssrN{i-pattern} and can thus be used
+ inside intro patterns (see section~\ref{ssec:intro}).\\
+ \ssrC{move=> a b /andP [Ha Hb].}
+ % commit: 2720
+\item Multiple views for \ssrC{move}, \ssrC{move $\dots$ in} and \ssrC{apply}
+ (see section~\ref{ssec:multiview}).\\
+ \ssrC{move/v1/v2/v3.}\\
+ \ssrC{move/v1/v2/v3 in H.}\\
+ \ssrC{apply/v1/v2/v3.}
+ % commit: 2720
+\item \ssrC{have} and \ssrC{suff} idiom with view (see section~\ref{sssec:hypview}).
+\begin{lstlisting}
+ Lemma |*test*| (a b : bool) (pab : a && b) : b.
+ have {pab} /= /andP [pa ->] // : true && (a && b) := pab.
+\end{lstlisting}
+ % commit: 2726
+\item \ssrC{have suff}, \ssrC{suff have} and \ssrC{wlog suff} forward reasoning
+ tactics (see section~\ref{ssec:struct}).\\
+ \ssrC{have suff H : P.}
+ % commit: 2633
+\item Binders support in \ssrC{have} (see section~\ref{sssec:have}).\\
+ \ssrC{have H x y (r : R x y) : P x -> Q y.}
+ % commit: 2633
+\item Deferred clear switches. Clears are deferred to the end of the
+ intro pattern. In the meanwhile, cleared variables are still
+ part of the context, thus the goal can mention them, but are
+ renamed to non accessible dummy names (see section~\ref{ssec:intro}).\\
+ \ssrC{suff: G \\x H = K; first case/dprodP=> \{G H\} [[G H -> -> defK]].}
+ % commit: 2660
+\item Relaxed alternation condition in intro patterns. The
+ \ssrN{i-item} grammar rule is simplified (see section~\ref{ssec:intro}).\\
+ \ssrC{move=> a \{H\} /= \{H1\} // b c /= \{H2\}.}
+ % commit: 2713
+\item Occurrence selection for \ssrC{->} and \ssrC{<-} intro pattern
+ (see section~\ref{ssec:intro}).\\
+ \ssrC{move=> a b H \{2\}->.}
+ % commit: 2714
+\item Modifiers for the discharging '\ssrC{:}' and \ssrC{in} tactical to override
+ the default behavior when dealing with local definitions (let-in):
+ \ssrC{@f} forces the body of \ssrC{f} to be kept, \ssrC{(f)} forces the body of
+ \ssrC{f} to be dropped (see sections~\ref{ssec:discharge}
+ and~\ref{ssec:gloc}).\\
+ \ssrC{move: x y @f z.}\\
+ \ssrC{rewrite rule in (f) $\;\;$H.}
+ %commit: 2659, 2710
+\item Type family switch in \ssrC{elim} and \ssrC{case}
+ can contain patterns with occurrence switch
+ (see section~\ref{ssec:typefam}).\\
+ \ssrC{case: \{2\}(_ == x) / eqP.}
+ % commit: 2593, 2598, 2539, 2538, 2527, 2529
+\item Generic second order predicate support for \ssrC{elim}
+ (see section~\ref{sec:views}).\\
+ \ssrC{elim/big\_prop: _}
+ % commit: 2767
+\item The \ssrC{congr} tactic now also works on products (see
+ section~\ref{ssec:congr}).
+\begin{lstlisting}
+ Lemma |*test*| x (H : P x) : P y.
+ congr (P _): H.
+\end{lstlisting}
+ % commit: 2608
+\item Selectors now support Ltac variables
+ (see section~\ref{ssec:select}).\\
+ \ssrC{let n := 3 in tac; first n last.}
+ % commit: 2725
+\item Deprecated use of \ssrC{Import Prenex Implicits} directive.
+ It must be replaced with the \Coq{} \ssrC{Unset Printing
+ Implicit Defensive} vernacular command.
+\item New synonym \ssrC{Canonical} for \ssrC{Canonical Structure}.
+\end{itemize}
+\subsection{\ssr{} version 1.4}
+New features:
+\begin{itemize}
+\item User definable recurrent contexts (see section~\ref{ssec:rewp}).\\
+ \ssrC{Notation RHS := (X in _ = X)\%pattern}
+\item Contextual patterns in
+ \ssrC{set} and `\ssrC{:}' (see section~\ref{ssec:rewp}).\\
+ \ssrC{set t := (a + _ in RHS)}
+\item NO-OP intro pattern (see section~\ref{ssec:intro}).\\
+ \ssrC{move=> /eqP-H /fooP-/barP}
+\item \ssrC{if $\ {\term}\ $ isn't $\ \ssrN{pattern}\ $ then $\ {\term}\ $
+ else $\ {\term}\ $} notation (see section~\ref{ssec:patcond}).\\
+ \ssrC{if x isn't Some y then simple else complex y}
+\end{itemize}
+\subsection{\ssr{} version 1.5}
+Incompatibilities:
+\begin{itemize}
+\item The \ssrC{have} tactic now performs type classes resolution. The old
+ behavior can be restored with \ssrC{Set SsrHave NoTCResolution}
+\end{itemize}
+Fixes:
+\begin{itemize}
+\item The \ssrC{let foo := type of t in} syntax of standard \ssrC{Ltac} has
+ been made compatible with \ssr{} and can be freely used even if
+ the \ssr{} plugin is loaded
+\end{itemize}
+New features:
+\begin{itemize}
+\item Generalizations supported in have (see section~\ref{ssec:struct}).\\
+ \ssrC{generally have hx2px, pa : a ha / P a.}
+\item Renaming and patterns in wlog (see section~\ref{ssec:struct} and
+ page \pageref{par:advancedgen}).\\
+ \ssrC{wlog H : (n := m)$\;$ (x := m + _)$\;$ / T x}.\\
+ \ssrC{wlog H : (n := m)$\;$ (@ldef := secdef m)$\;$ / T x}.
+\item Renaming, patterns and clear switches in \ssrC{in}
+ tactical (see section~\ref{ssec:gloc}).\\
+ \ssrC{$\dots$ in H1 \{H2\} (n := m).}
+\item Handling of type classes in \ssrC{have}
+ (see page~\pageref{ssec:havetcresolution}).\\
+ \ssrC{have foo : ty. (* TC inference for ty *)}\\
+ \ssrC{have foo : ty := . (* no TC inference for ty *)}\\
+ \ssrC{have foo : ty := t. (* no TC inference for ty and t *)}\\
+ \ssrC{have foo := t. (* no TC inference for t *)}
+\item Transparent flag for \ssrC{have} to generate a \ssrC{let in} context entry
+ (see page~\pageref{sec:havetransparent}).\\
+ \ssrC{have @i : 'I\_n by apply: (Sub m); auto.}
+\item Intro pattern \ssrC{[: foo bar ]} to create abstract variables
+ (see page~\pageref{ssec:introabstract}).
+\item Tactic \ssrC{abstract:} to assign an abstract variable
+ (see page~\pageref{ssec:abstract}).\\
+ \ssrC{have [: blurb ] @i : 'I\_n by apply: (Sub m); abstract: blurb; auto.}\\
+ \ssrC{have [: blurb ] i : 'I\_n := Sub m blurb; first by auto.}
+
+\end{itemize}
+
+\fi
diff --git a/doc/refman/RefMan-tac.tex b/doc/refman/RefMan-tac.tex
index a23c43232..b3b0df5c8 100644
--- a/doc/refman/RefMan-tac.tex
+++ b/doc/refman/RefMan-tac.tex
@@ -4113,7 +4113,7 @@ is to set the cut expression to $c | e$, the initial cut expression
being \texttt{emp}.
-\item \texttt{Mode} {\tt (+ | ! | -)}$^*$ {\qualid}
+\item \texttt{Mode} {\qualid} {\tt (+ | ! | -)}$^*$
\label{HintMode}
\comindex{Hint Mode}
@@ -4671,50 +4671,15 @@ congruence.
\end{ErrMsgs}
+\section{Checking properties of terms}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-\section{Everything after this point has yet to be sorted}
-
+Each of the following tactics acts as the identity if the check succeeds, and results in an error otherwise.
\subsection{\tt constr\_eq \term$_1$ \term$_2$}
\tacindex{constr\_eq}
\label{constreq}
-This tactic applies to any goal. It checks whether its arguments are
-equal modulo alpha conversion and casts.
+This tactic checks whether its arguments are equal modulo alpha conversion and casts.
\ErrMsg \errindex{Not equal}
@@ -4722,8 +4687,8 @@ equal modulo alpha conversion and casts.
\tacindex{unify}
\label{unify}
-This tactic applies to any goal. It checks whether its arguments are
-unifiable, potentially instantiating existential variables.
+This tactic checks whether its arguments are unifiable, potentially
+instantiating existential variables.
\ErrMsg \errindex{Not unifiable}
@@ -4738,9 +4703,9 @@ unifiable, potentially instantiating existential variables.
\tacindex{is\_evar}
\label{isevar}
-This tactic applies to any goal. It checks whether its argument is an
-existential variable. Existential variables are uninstantiated
-variables generated by e.g. {\tt eapply} (see Section~\ref{apply}).
+This tactic checks whether its argument is a current existential
+variable. Existential variables are uninstantiated variables generated
+by {\tt eapply} (see Section~\ref{apply}) and some other tactics.
\ErrMsg \errindex{Not an evar}
@@ -4748,10 +4713,9 @@ variables generated by e.g. {\tt eapply} (see Section~\ref{apply}).
\tacindex{has\_evar}
\label{hasevar}
-This tactic applies to any goal. It checks whether its argument has an
-existential variable as a subterm. Unlike {\tt context} patterns
-combined with {\tt is\_evar}, this tactic scans all subterms,
-including those under binders.
+This tactic checks whether its argument has an existential variable as
+a subterm. Unlike {\tt context} patterns combined with {\tt is\_evar},
+this tactic scans all subterms, including those under binders.
\ErrMsg \errindex{No evars}
@@ -4759,8 +4723,8 @@ including those under binders.
\tacindex{is\_var}
\label{isvar}
-This tactic applies to any goal. It checks whether its argument is a
-variable or hypothesis in the current goal context or in the opened sections.
+This tactic checks whether its argument is a variable or hypothesis in the
+current goal context or in the opened sections.
\ErrMsg \errindex{Not a variable or hypothesis}
diff --git a/doc/refman/RefMan-tacex.tex b/doc/refman/RefMan-tacex.tex
index 9f4ddc804..cb8f916f1 100644
--- a/doc/refman/RefMan-tacex.tex
+++ b/doc/refman/RefMan-tacex.tex
@@ -849,7 +849,7 @@ Ltac DSimplif trm :=
Ltac Length trm :=
match trm with
| (_ * ?B) => let succ := Length B in constr:(S succ)
- | _ => constr:1
+ | _ => constr:(1)
end.
Ltac assoc := repeat rewrite <- Ass.
\end{coq_example}
diff --git a/doc/refman/Reference-Manual.tex b/doc/refman/Reference-Manual.tex
index 291c07de4..fc1c01cf2 100644
--- a/doc/refman/Reference-Manual.tex
+++ b/doc/refman/Reference-Manual.tex
@@ -22,6 +22,17 @@
\usepackage{xspace}
\usepackage{pmboxdraw}
\usepackage{float}
+\usepackage{color}
+ \definecolor{dkblue}{rgb}{0,0.1,0.5}
+ \definecolor{lightblue}{rgb}{0,0.5,0.5}
+ \definecolor{dkgreen}{rgb}{0,0.4,0}
+ \definecolor{dk2green}{rgb}{0.4,0,0}
+ \definecolor{dkviolet}{rgb}{0.6,0,0.8}
+ \definecolor{dkpink}{rgb}{0.2,0,0.6}
+\usepackage{listings}
+ \def\lstlanguagefiles{coq-listing.tex}
+\usepackage{tabularx}
+\usepackage{array,longtable}
\floatstyle{boxed}
\restylefloat{figure}
@@ -99,6 +110,11 @@ Options A and B of the licence are {\em not} elected.}
\include{RefMan-ltac.v}% Writing tactics
\include{RefMan-tacex.v}% Detailed Examples of tactics
+\lstset{language=SSR}
+\lstset{moredelim=[is][]{|*}{*|}}
+\lstset{moredelim=*[is][\itshape\rmfamily]{/*}{*/}}
+\include{RefMan-ssr}
+
\part{User extensions}
\include{RefMan-syn.v}% The Syntax and the Grammar commands
%%SUPPRIME \include{RefMan-tus.v}% Writing tactics
diff --git a/doc/refman/Setoid.tex b/doc/refman/Setoid.tex
index 2c9602a22..6c7928438 100644
--- a/doc/refman/Setoid.tex
+++ b/doc/refman/Setoid.tex
@@ -156,9 +156,9 @@ compatibility constraints.
\begin{cscexample}[Rewriting]
Continuing the previous examples, suppose that the user must prove
\texttt{set\_eq int (union int (union int S1 S2) S2) (f S1 S2)} under the
-hypothesis \texttt{H: set\_eq int S2 (nil int)}. It is possible to
+hypothesis \texttt{H: set\_eq int S2 (@nil int)}. It is possible to
use the \texttt{rewrite} tactic to replace the first two occurrences of
-\texttt{S2} with \texttt{nil int} in the goal since the context
+\texttt{S2} with \texttt{@nil int} in the goal since the context
\texttt{set\_eq int (union int (union int S1 nil) nil) (f S1 S2)}, being
a composition of morphisms instances, is a morphism. However the tactic
will fail replacing the third occurrence of \texttt{S2} unless \texttt{f}
diff --git a/doc/refman/Universes.tex b/doc/refman/Universes.tex
index 2bb1301c7..6ea253739 100644
--- a/doc/refman/Universes.tex
+++ b/doc/refman/Universes.tex
@@ -134,12 +134,14 @@ producing global universe constraints, one can use the
\asection{{\tt Cumulative, NonCumulative}}
\comindex{Cumulative}
\comindex{NonCumulative}
-\optindex{Inductive Cumulativity}
+\optindex{Polymorphic Inductive Cumulativity}
-Inductive types, coinductive types, variants and records can be
+Polymorphic inductive types, coinductive types, variants and records can be
declared cumulative using the \texttt{Cumulative}. Alternatively,
-there is an option \texttt{Set Inductive Cumulativity} which when set,
-makes all subsequent inductive definitions cumulative. Consider the examples below.
+there is an option \texttt{Set Polymorphic Inductive Cumulativity} which when set,
+makes all subsequent \emph{polymorphic} inductive definitions cumulative. When set,
+inductive types and the like can be enforced to be
+\emph{non-cumulative} using the \texttt{NonCumulative} prefix. Consider the examples below.
\begin{coq_example*}
Polymorphic Cumulative Inductive list {A : Type} :=
| nil : list
@@ -158,24 +160,61 @@ This also means that any two instances of \texttt{list} are convertible:
$\WTEGCONV{\mathtt{list@\{i\}} A}{\mathtt{list@\{j\}} B}$ whenever $\WTEGCONV{A}{B}$ and
furthermore their corresponding (when fully applied to convertible arguments) constructors.
See Chapter~\ref{Cic} for more details on convertibility and subtyping.
-Also notice the subtyping constraints for the \emph{non-cumulative} version of list:
+The following is an example of a record with non-trivial subtyping relation:
\begin{coq_example*}
-Polymorphic NonCumulative Inductive list' {A : Type} :=
-| nil' : list'
-| cons' : A -> list' -> list'.
+Polymorphic Cumulative Record packType := {pk : Type}.
\end{coq_example*}
\begin{coq_example}
-Print list'.
+Print packType.
+\end{coq_example}
+Notice that as expected, \texttt{packType@\{i\}} and \texttt{packType@\{j\}} are
+convertible if and only if \texttt{i $=$ j}.
+
+Cumulative inductive types, coninductive types, variants and records
+only make sense when they are universe polymorphic. Therefore, an
+error is issued whenever the user uses the \texttt{Cumulative} or
+\texttt{NonCumulative} prefix in a monomorphic context.
+Notice that this is not the case for the option \texttt{Set Polymorphic Inductive Cumulativity}.
+That is, this option, when set, makes all subsequent \emph{polymorphic}
+inductive declarations cumulative (unless, of course the \texttt{NonCumulative} prefix is used)
+but has no effect on \emph{monomorphic} inductive declarations.
+Consider the following examples.
+\begin{coq_example}
+Monomorphic Cumulative Inductive Unit := unit.
+\end{coq_example}
+\begin{coq_example}
+Monomorphic NonCumulative Inductive Unit := unit.
\end{coq_example}
-The following is an example of a record with non-trivial subtyping relation:
\begin{coq_example*}
-Polymorphic Cumulative Record packType := {pk : Type}.
+Set Polymorphic Inductive Cumulativity.
+Inductive Unit := unit.
\end{coq_example*}
\begin{coq_example}
-Print packType.
+Print Unit.
\end{coq_example}
-Notice that as expected, \texttt{packType@\{i\}} and \texttt{packType@\{j\}} are convertible if and only if \texttt{i $=$ j}.
+\subsection*{An example of a proof using cumulativity}
+
+\begin{coq_example}
+Set Universe Polymorphism.
+Set Polymorphic Inductive Cumulativity.
+
+Inductive eq@{i} {A : Type@{i}} (x : A) : A -> Type@{i} := eq_refl : eq x x.
+
+Definition funext_type@{a b e} (A : Type@{a}) (B : A -> Type@{b})
+ := forall f g : (forall a, B a),
+ (forall x, eq@{e} (f x) (g x))
+ -> eq@{e} f g.
+
+Section down.
+ Universes a b e e'.
+ Constraint e' < e.
+ Lemma funext_down {A B}
+ (H : @funext_type@{a b e} A B) : @funext_type@{a b e'} A B.
+ Proof.
+ exact H.
+ Defined.
+\end{coq_example}
\asection{Global and local universes}
@@ -293,8 +332,18 @@ Universes k l.
Check (le@{k l}).
\end{coq_example}
-User-named universes are considered rigid for unification and are never
-minimized.
+User-named universes and the anonymous universe implicitly attached to
+an explicit $Type$ are considered rigid for unification and are never
+minimized. Flexible anonymous universes can be produced with an
+underscore or by omitting the annotation to a polymorphic definition.
+
+\begin{coq_example}
+ Check (fun x => x) : Type -> Type.
+ Check (fun x => x) : Type -> Type@{_}.
+
+ Check le@{k _}.
+ Check le.
+\end{coq_example}
\subsection{\tt Unset Strict Universe Declaration.
\optindex{Strict Universe Declaration}
diff --git a/doc/refman/coq-listing.tex b/doc/refman/coq-listing.tex
new file mode 100644
index 000000000..c69c3b1b8
--- /dev/null
+++ b/doc/refman/coq-listing.tex
@@ -0,0 +1,152 @@
+%=======================================================================
+% Listings LaTeX package style for Gallina + SSReflect (Assia Mahboubi 2007)
+
+\lstdefinelanguage{SSR} {
+
+% Anything betweeen $ becomes LaTeX math mode
+mathescape=true,
+% Comments may or not include Latex commands
+texcl=false,
+
+
+% Vernacular commands
+morekeywords=[1]{
+From, Section, Module, End, Require, Import, Export, Defensive, Function,
+Variable, Variables, Parameter, Parameters, Axiom, Hypothesis, Hypotheses,
+Notation, Local, Tactic, Reserved, Scope, Open, Close, Bind, Delimit,
+Definition, Let, Ltac, Fixpoint, CoFixpoint, Add, Morphism, Relation,
+Implicit, Arguments, Set, Unset, Contextual, Strict, Prenex, Implicits,
+Inductive, CoInductive, Record, Structure, Canonical, Coercion,
+Theorem, Lemma, Corollary, Proposition, Fact, Remark, Example,
+Proof, Goal, Save, Qed, Defined, Hint, Resolve, Rewrite, View,
+Search, Show, Print, Printing, All, Graph, Projections, inside,
+outside, Locate, Maximal},
+
+% Gallina
+morekeywords=[2]{forall, exists, exists2, fun, fix, cofix, struct,
+ match, with, end, as, in, return, let, if, is, then, else,
+ for, of, nosimpl},
+
+% Sorts
+morekeywords=[3]{Type, Prop},
+
+% Various tactics, some are std Coq subsumed by ssr, for the manual purpose
+morekeywords=[4]{
+ pose, set, move, case, elim, apply, clear,
+ hnf, intro, intros, generalize, rename, pattern, after,
+ destruct, induction, using, refine, inversion, injection,
+ rewrite, congr, unlock, compute, ring, field,
+ replace, fold, unfold, change, cutrewrite, simpl,
+ have, gen, generally, suff, wlog, suffices, without, loss, nat_norm,
+ assert, cut, trivial, revert, bool_congr, nat_congr, abstract,
+ symmetry, transitivity, auto, split, left, right, autorewrite},
+
+% Terminators
+morekeywords=[5]{
+ by, done, exact, reflexivity, tauto, romega, omega,
+ assumption, solve, contradiction, discriminate},
+
+
+% Control
+morekeywords=[6]{do, last, first, try, idtac, repeat},
+
+% Various symbols
+% For the ssr manual we turn off the prettyprint of formulas
+% literate=
+% {->}{{$\rightarrow\,$}}2
+% {->}{{\tt ->}}3
+% {<-}{{$\leftarrow\,$}}2
+% {<-}{{\tt <-}}2
+% {>->}{{$\mapsto$}}3
+% {<=}{{$\leq$}}1
+% {>=}{{$\geq$}}1
+% {<>}{{$\neq$}}1
+% {/\\}{{$\wedge$}}2
+% {\\/}{{$\vee$}}2
+% {<->}{{$\leftrightarrow\;$}}3
+% {<=>}{{$\Leftrightarrow\;$}}3
+% {:nat}{{$~\in\mathbb{N}$}}3
+% {fforall\ }{{$\forall_f\,$}}1
+% {forall\ }{{$\forall\,$}}1
+% {exists\ }{{$\exists\,$}}1
+% {negb}{{$\neg$}}1
+% {spp}{{:*:\,}}1
+% {~}{{$\sim$}}1
+% {\\in}{{$\in\;$}}1
+% {/\\}{$\land\,$}1
+% {:*:}{{$*$}}2
+% {=>}{{$\,\Rightarrow\ $}}1
+% {=>}{{\tt =>}}2
+% {:=}{{{\tt:=}\,\,}}2
+% {==}{{$\equiv$}\,}2
+% {!=}{{$\neq$}\,}2
+% {^-1}{{$^{-1}$}}1
+% {elt'}{elt'}1
+% {=}{{\tt=}\,\,}2
+% {+}{{\tt+}\,\,}2,
+literate=
+ {isn't }{{{\ttfamily\color{dkgreen} isn't }}}1,
+
+% Comments delimiters, we do turn this off for the manual
+%comment=[s]{(*}{*)},
+
+% Spaces are not displayed as a special character
+showstringspaces=false,
+
+% String delimiters
+morestring=[b]",
+morestring=[d]",
+
+% Size of tabulations
+tabsize=3,
+
+% Enables ASCII chars 128 to 255
+extendedchars=true,
+
+% Case sensitivity
+sensitive=true,
+
+% Automatic breaking of long lines
+breaklines=true,
+
+% Default style fors listings
+basicstyle=\ttfamily,
+
+% Position of captions is bottom
+captionpos=b,
+
+% Full flexible columns
+columns=[l]fullflexible,
+
+% Style for (listings') identifiers
+identifierstyle={\ttfamily\color{black}},
+% Note : highlighting of Coq identifiers is done through a new
+% delimiter definition through an lstset at the begining of the
+% document. Don't know how to do better.
+
+% Style for declaration keywords
+keywordstyle=[1]{\ttfamily\color{dkviolet}},
+
+% Style for gallina keywords
+keywordstyle=[2]{\ttfamily\color{dkgreen}},
+
+% Style for sorts keywords
+keywordstyle=[3]{\ttfamily\color{lightblue}},
+
+% Style for tactics keywords
+keywordstyle=[4]{\ttfamily\color{dkblue}},
+
+% Style for terminators keywords
+keywordstyle=[5]{\ttfamily\color{red}},
+
+
+%Style for iterators
+keywordstyle=[6]{\ttfamily\color{dkpink}},
+
+% Style for strings
+stringstyle=\ttfamily,
+
+% Style for comments
+commentstyle=\rmfamily,
+
+}
diff --git a/doc/rt/RefMan-cover.tex b/doc/rt/RefMan-cover.tex
deleted file mode 100644
index ac1686c25..000000000
--- a/doc/rt/RefMan-cover.tex
+++ /dev/null
@@ -1,45 +0,0 @@
-\documentstyle[RRcover]{book}
- % The use of the style `french' forces the french abstract to appear first.
-
-\RRtitle{Manuel de r\'ef\'erence du syst\`eme Coq \\ version V7.1}
-\RRetitle{The Coq Proof Assistant \\ Reference Manual \\ Version 7.1
-\thanks
-{This research was partly supported by ESPRIT Basic Research
-Action ``Types'' and by the GDR ``Programmation'' co-financed by MRE-PRC and CNRS.}
-}
-\RRauthor{Bruno Barras, Samuel Boutin, Cristina Cornes,
-Judica\"el Courant, Jean-Christophe Filli\^atre, Eduardo Gim\'enez,
-Hugo Herbelin, G\'erard Huet, C\'esar Mu\~noz, Chetan Murthy,
-Catherine Parent, Christine Paulin-Mohring,
-Amokrane Sa{\"\i}bi, Benjamin Werner}
-\authorhead{}
-\titlehead{Coq V7.1 Reference Manual}
-\RRtheme{2}
-\RRprojet{Coq}
-\RRNo{0123456789}
-\RRdate{May 1997}
-%\RRpages{}
-\URRocq
-
-\RRresume{Coq est un syst\`eme permettant le d\'eveloppement et la
-v\'erification de preuves formelles dans une logique d'ordre
-sup\'erieure incluant un riche langage de d\'efinitions de fonctions.
-Ce document constitue le manuel de r\'ef\'erence de la version V7.1
-qui est distribu\'ee par ftp anonyme \`a l'adresse
-\url{ftp://ftp.inria.fr/INRIA/coq/}}
-
-\RRmotcle{Coq, Syst\`eme d'aide \`a la preuve, Preuves formelles,
-Calcul des Constructions Inductives}
-
-
-\RRabstract{Coq is a proof assistant based on a higher-order logic
-allowing powerful definitions of functions.
-Coq V7.1 is available by anonymous
-ftp at \url{ftp://ftp.inria.fr/INRIA/coq/}}
-
-\RRkeyword{Coq, Proof Assistant, Formal Proofs, Calculus of Inductives
-Constructions}
-
-\begin{document}
-\makeRT
-\end{document}
diff --git a/doc/rt/Tutorial-cover.tex b/doc/rt/Tutorial-cover.tex
deleted file mode 100644
index aefea8d42..000000000
--- a/doc/rt/Tutorial-cover.tex
+++ /dev/null
@@ -1,47 +0,0 @@
-\documentstyle[RRcover]{book}
- % The use of the style `french' forces the french abstract to appear first.
-\RRetitle{
-The Coq Proof Assistant \\ A Tutorial \\ Version 7.1
-\thanks{This research was partly supported by ESPRIT Basic Research
-Action ``Types'' and by the GDR ``Programmation'' co-financed by MRE-PRC and CNRS.}
-}
-\RRtitle{Coq \\ Une introduction \\ V7.1 }
-\RRauthor{G\'erard Huet, Gilles Kahn and Christine Paulin-Mohring}
-\RRtheme{2}
-\RRprojet{{Coq
-\\[15pt]
-{INRIA Rocquencourt}
-{\hskip -5.25pt}
-~~{\bf ---}~~
- \def\thefootnote{\arabic{footnote}\hss}
-{CNRS - ENS Lyon}
-\footnote[1]{LIP URA 1398 du CNRS,
-46 All\'ee d'Italie, 69364 Lyon CEDEX 07, France.}
-{\hskip -14pt}}}
-
-%\RRNo{0123456789}
-\RRNo{0204}
-\RRdate{Ao\^ut 1997}
-
-\URRocq
-\RRresume{Coq est un syst\`eme permettant le d\'eveloppement et la
-v\'erification de preuves formelles dans une logique d'ordre
-sup\'erieure incluant un riche langage de d\'efinitions de fonctions.
-Ce document constitue une introduction pratique \`a l'utilisation de
-la version V7.1 qui est distribu\'ee par ftp anonyme \`a l'adresse
-\url{ftp://ftp.inria.fr/INRIA/coq/}}
-
-\RRmotcle{Coq, Syst\`eme d'aide \`a la preuve, Preuves formelles, Calcul
-des Constructions Inductives}
-
-\RRabstract{Coq is a proof assistant based on a higher-order logic
-allowing powerful definitions of functions. This document is a
-tutorial for the version V7.1 of Coq. This version is available by
-anonymous ftp at \url{ftp://ftp.inria.fr/INRIA/coq/}}
-
-\RRkeyword{Coq, Proof Assistant, Formal Proofs, Calculus of Inductives
-Constructions}
-
-\begin{document}
-\makeRT
-\end{document}
diff --git a/doc/tools/Translator.tex b/doc/tools/Translator.tex
index ed1d336d9..3ee65d6f2 100644
--- a/doc/tools/Translator.tex
+++ b/doc/tools/Translator.tex
@@ -614,7 +614,7 @@ is compiled by a Makefile with the following constraints:
\begin{itemize}
\item compilation is achieved by invoking make without specifying a target
\item options are passed to Coq with make variable COQFLAGS that
- includes variables OPT, COQLIBS, OTHERFLAGS and COQ_XML.
+ includes variables OPT, COQLIBS, and OTHERFLAGS.
\end{itemize}
These constraints are met by the makefiles produced by {\tt coq\_makefile}
diff --git a/doc/tutorial/Tutorial.tex b/doc/tutorial/Tutorial.tex
index 8337b1c48..77ce8574f 100644
--- a/doc/tutorial/Tutorial.tex
+++ b/doc/tutorial/Tutorial.tex
@@ -241,7 +241,7 @@ Variables A B C : Prop.
\end{coq_example}
We shall consider simple implications, such as $A\ra B$, read as
-``$A$ implies $B$''. Remark that we overload the arrow symbol, which
+``$A$ implies $B$''. Note that we overload the arrow symbol, which
has been used above as the functionality type constructor, and which
may be used as well as propositional connective:
\begin{coq_example}
@@ -289,7 +289,7 @@ apply H.
We are now in the situation where we have two judgments as conjectures
that remain to be proved. Only the first is listed in full, for the
others the system displays only the corresponding subgoal, without its
-local hypotheses list. Remark that \verb:apply: has kept the local
+local hypotheses list. Note that \verb:apply: has kept the local
hypotheses of its father judgment, which are still available for
the judgments it generated.
@@ -654,7 +654,7 @@ Hypothesis R_transitive :
forall x y z : D, R x y -> R y z -> R x z.
\end{coq_example}
-Remark the syntax \verb+forall x : D,+ which stands for universal quantification
+Note the syntax \verb+forall x : D,+ which stands for universal quantification
$\forall x : D$.
\subsection{Existential quantification}
@@ -664,10 +664,10 @@ We now state our lemma, and enter proof mode.
Lemma refl_if : forall x : D, (exists y, R x y) -> R x x.
\end{coq_example}
-Remark that the hypotheses which are local to the currently opened sections
+The hypotheses that are local to the currently opened sections
are listed as local hypotheses to the current goals.
-The rationale is that these hypotheses are going to be discharged, as we
-shall see, when we shall close the corresponding sections.
+That is because these hypotheses are going to be discharged, as
+we shall see, when we shall close the corresponding sections.
Note the functional syntax for existential quantification. The existential
quantifier is built from the operator \verb:ex:, which expects a
@@ -687,7 +687,7 @@ verifies \verb:P:. Let us see how this works on this simple example.
intros x x_Rlinked.
\end{coq_example}
-Remark that \verb:intros: treats universal quantification in the same way
+Note that \verb:intros: treats universal quantification in the same way
as the premises of implications. Renaming of bound variables occurs
when it is needed; for instance, had we started with \verb:intro y:,
we would have obtained the goal:
@@ -859,7 +859,7 @@ Check weird.
Check drinker.
\end{coq_example}
-Remark how the three theorems are completely generic in the most general
+Note how the three theorems are completely generic in the most general
fashion;
the domain \verb:D: is discharged in all of them, \verb:R: is discharged in
\verb:refl_if: only, \verb:P: is discharged only in \verb:weird: and
@@ -867,7 +867,7 @@ the domain \verb:D: is discharged in all of them, \verb:R: is discharged in
Finally, the excluded middle hypothesis is discharged only in
\verb:drinker:.
-Note that the name \verb:d: has vanished as well from
+Note, too, that the name \verb:d: has vanished from
the statements of \verb:weird: and \verb:drinker:,
since \Coq's pretty-printer replaces
systematically a quantification such as \texttt{forall d : D, E},
diff --git a/engine/evarutil.ml b/engine/evarutil.ml
index 2afc12cd3..339c6a248 100644
--- a/engine/evarutil.ml
+++ b/engine/evarutil.ml
@@ -412,6 +412,14 @@ let new_evar_instance sign evd typ ?src ?filter ?candidates ?store ?naming ?prin
let (evd, newevk) = new_pure_evar sign evd ?src ?filter ?candidates ?store ?naming ?principal typ in
evd, mkEvar (newevk,Array.of_list instance)
+let new_evar_from_context sign evd ?src ?filter ?candidates ?store ?naming ?principal typ =
+ let instance = List.map (NamedDecl.get_id %> EConstr.mkVar) (named_context_of_val sign) in
+ let instance =
+ match filter with
+ | None -> instance
+ | Some filter -> Filter.filter_list filter instance in
+ new_evar_instance sign evd typ ?src ?filter ?candidates ?store ?naming ?principal instance
+
(* [new_evar] declares a new existential in an env env with type typ *)
(* Converting the env into the sign of the evar to define *)
let new_evar env evd ?src ?filter ?candidates ?store ?naming ?principal typ =
diff --git a/engine/evarutil.mli b/engine/evarutil.mli
index a8b6b5861..14173e774 100644
--- a/engine/evarutil.mli
+++ b/engine/evarutil.mli
@@ -21,6 +21,13 @@ val new_meta : unit -> metavariable
val mk_new_meta : unit -> constr
(** {6 Creating a fresh evar given their type and context} *)
+
+val new_evar_from_context :
+ named_context_val -> evar_map -> ?src:Evar_kinds.t Loc.located -> ?filter:Filter.t ->
+ ?candidates:constr list -> ?store:Store.t ->
+ ?naming:Misctypes.intro_pattern_naming_expr ->
+ ?principal:bool -> types -> evar_map * EConstr.t
+
val new_evar :
env -> evar_map -> ?src:Evar_kinds.t Loc.located -> ?filter:Filter.t ->
?candidates:constr list -> ?store:Store.t ->
diff --git a/engine/geninterp.ml b/engine/geninterp.ml
index 9964433a8..e79e258fb 100644
--- a/engine/geninterp.ml
+++ b/engine/geninterp.ml
@@ -32,7 +32,7 @@ struct
let repr = ValT.repr
let create = ValT.create
- let pr : type a. a typ -> Pp.std_ppcmds = fun t -> Pp.str (repr t)
+ let pr : type a. a typ -> Pp.t = fun t -> Pp.str (repr t)
let typ_list = ValT.create "list"
let typ_opt = ValT.create "option"
diff --git a/engine/geninterp.mli b/engine/geninterp.mli
index 9a925dcd8..492e372ad 100644
--- a/engine/geninterp.mli
+++ b/engine/geninterp.mli
@@ -30,7 +30,7 @@ sig
val eq : 'a typ -> 'b typ -> ('a, 'b) CSig.eq option
val repr : 'a typ -> string
- val pr : 'a typ -> Pp.std_ppcmds
+ val pr : 'a typ -> Pp.t
val typ_list : t list typ
val typ_opt : t option typ
diff --git a/engine/logic_monad.mli b/engine/logic_monad.mli
index aaebe4c1b..8c8f9fe93 100644
--- a/engine/logic_monad.mli
+++ b/engine/logic_monad.mli
@@ -57,11 +57,11 @@ module NonLogical : sig
val print_char : char -> unit t
(** Loggers. The buffer is also flushed. *)
- val print_debug : Pp.std_ppcmds -> unit t
- val print_warning : Pp.std_ppcmds -> unit t
- val print_notice : Pp.std_ppcmds -> unit t
- val print_info : Pp.std_ppcmds -> unit t
- val print_error : Pp.std_ppcmds -> unit t
+ val print_debug : Pp.t -> unit t
+ val print_warning : Pp.t -> unit t
+ val print_notice : Pp.t -> unit t
+ val print_info : Pp.t -> unit t
+ val print_error : Pp.t -> unit t
(** [Pervasives.raise]. Except that exceptions are wrapped with
{!Exception}. *)
diff --git a/engine/proofview.ml b/engine/proofview.ml
index b4e2160f4..eef2b83f4 100644
--- a/engine/proofview.ml
+++ b/engine/proofview.ml
@@ -332,7 +332,7 @@ exception NoSuchGoals of int
(* This hook returns a string to be appended to the usual message.
Primarily used to add a suggestion about the right bullet to use to
focus the next goal, if applicable. *)
-let nosuchgoals_hook:(int -> std_ppcmds) ref = ref (fun n -> mt ())
+let nosuchgoals_hook:(int -> Pp.t) ref = ref (fun n -> mt ())
let set_nosuchgoals_hook f = nosuchgoals_hook := f
diff --git a/engine/proofview.mli b/engine/proofview.mli
index 957c9213c..d92d0a7d5 100644
--- a/engine/proofview.mli
+++ b/engine/proofview.mli
@@ -235,7 +235,7 @@ val tclBREAK : (iexn -> iexn option) -> 'a tactic -> 'a tactic
This hook is used to add a suggestion about bullets when
applicable. *)
exception NoSuchGoals of int
-val set_nosuchgoals_hook: (int -> Pp.std_ppcmds) -> unit
+val set_nosuchgoals_hook: (int -> Pp.t) -> unit
val tclFOCUS : int -> int -> 'a tactic -> 'a tactic
@@ -526,7 +526,7 @@ module Trace : sig
val log : Proofview_monad.lazy_msg -> unit tactic
val name_tactic : Proofview_monad.lazy_msg -> 'a tactic -> 'a tactic
- val pr_info : ?lvl:int -> Proofview_monad.Info.tree -> Pp.std_ppcmds
+ val pr_info : ?lvl:int -> Proofview_monad.Info.tree -> Pp.t
end
diff --git a/engine/proofview_monad.ml b/engine/proofview_monad.ml
index 1b737b6f4..d0f471225 100644
--- a/engine/proofview_monad.ml
+++ b/engine/proofview_monad.ml
@@ -62,7 +62,7 @@ end
(** We typically label nodes of [Trace.tree] with messages to
print. But we don't want to compute the result. *)
-type lazy_msg = unit -> Pp.std_ppcmds
+type lazy_msg = unit -> Pp.t
let pr_lazy_msg msg = msg ()
(** Info trace. *)
diff --git a/engine/proofview_monad.mli b/engine/proofview_monad.mli
index 554583421..e7123218b 100644
--- a/engine/proofview_monad.mli
+++ b/engine/proofview_monad.mli
@@ -43,7 +43,7 @@ end
(** We typically label nodes of [Trace.tree] with messages to
print. But we don't want to compute the result. *)
-type lazy_msg = unit -> Pp.std_ppcmds
+type lazy_msg = unit -> Pp.t
(** Info trace. *)
module Info : sig
@@ -58,7 +58,7 @@ module Info : sig
type state = tag Trace.incr
type tree = tag Trace.forest
- val print : tree -> Pp.std_ppcmds
+ val print : tree -> Pp.t
(** [collapse n t] flattens the first [n] levels of [Tactic] in an
info trace, effectively forgetting about the [n] top level of
diff --git a/engine/termops.ml b/engine/termops.ml
index cf7c0cc20..2bd0c06d6 100644
--- a/engine/termops.ml
+++ b/engine/termops.ml
@@ -994,12 +994,14 @@ let rec strip_outer_cast sigma c = match EConstr.kind sigma c with
(* flattens application lists throwing casts in-between *)
let collapse_appl sigma c = match EConstr.kind sigma c with
| App (f,cl) ->
+ if EConstr.isCast sigma f then
let rec collapse_rec f cl2 =
match EConstr.kind sigma (strip_outer_cast sigma f) with
| App (g,cl1) -> collapse_rec g (Array.append cl1 cl2)
| _ -> EConstr.mkApp (f,cl2)
in
collapse_rec f cl
+ else c
| _ -> c
(* First utilities for avoiding telescope computation for subst_term *)
diff --git a/engine/termops.mli b/engine/termops.mli
index c19a2d15a..2624afd30 100644
--- a/engine/termops.mli
+++ b/engine/termops.mli
@@ -9,16 +9,15 @@
(** This file defines various utilities for term manipulation that are not
needed in the kernel. *)
-open Pp
open Names
open Term
open Environ
open EConstr
(** printers *)
-val print_sort : sorts -> std_ppcmds
-val pr_sort_family : sorts_family -> std_ppcmds
-val pr_fix : ('a -> std_ppcmds) -> ('a, 'a) pfixpoint -> std_ppcmds
+val print_sort : sorts -> Pp.t
+val pr_sort_family : sorts_family -> Pp.t
+val pr_fix : ('a -> Pp.t) -> ('a, 'a) pfixpoint -> Pp.t
(** about contexts *)
val push_rel_assum : Name.t * types -> env -> env
@@ -279,25 +278,25 @@ val on_judgment_type : ('t -> 't) -> ('c, 't) punsafe_judgment -> ('c, 't) puns
open Evd
-val pr_existential_key : evar_map -> evar -> Pp.std_ppcmds
+val pr_existential_key : evar_map -> evar -> Pp.t
val pr_evar_suggested_name : existential_key -> evar_map -> Id.t
-val pr_evar_info : evar_info -> Pp.std_ppcmds
-val pr_evar_constraints : evar_map -> evar_constraint list -> Pp.std_ppcmds
-val pr_evar_map : ?with_univs:bool -> int option -> evar_map -> Pp.std_ppcmds
+val pr_evar_info : evar_info -> Pp.t
+val pr_evar_constraints : evar_map -> evar_constraint list -> Pp.t
+val pr_evar_map : ?with_univs:bool -> int option -> evar_map -> Pp.t
val pr_evar_map_filter : ?with_univs:bool -> (Evar.t -> evar_info -> bool) ->
- evar_map -> Pp.std_ppcmds
-val pr_metaset : Metaset.t -> Pp.std_ppcmds
-val pr_evar_universe_context : evar_universe_context -> Pp.std_ppcmds
-val pr_evd_level : evar_map -> Univ.Level.t -> Pp.std_ppcmds
+ evar_map -> Pp.t
+val pr_metaset : Metaset.t -> Pp.t
+val pr_evar_universe_context : evar_universe_context -> Pp.t
+val pr_evd_level : evar_map -> Univ.Level.t -> Pp.t
(** debug printer: do not use to display terms to the casual user... *)
-val set_print_constr : (env -> Evd.evar_map -> constr -> std_ppcmds) -> unit
-val print_constr : constr -> std_ppcmds
-val print_constr_env : env -> Evd.evar_map -> constr -> std_ppcmds
-val print_named_context : env -> std_ppcmds
-val pr_rel_decl : env -> Context.Rel.Declaration.t -> std_ppcmds
-val print_rel_context : env -> std_ppcmds
-val print_env : env -> std_ppcmds
+val set_print_constr : (env -> Evd.evar_map -> constr -> Pp.t) -> unit
+val print_constr : constr -> Pp.t
+val print_constr_env : env -> Evd.evar_map -> constr -> Pp.t
+val print_named_context : env -> Pp.t
+val pr_rel_decl : env -> Context.Rel.Declaration.t -> Pp.t
+val print_rel_context : env -> Pp.t
+val print_env : env -> Pp.t
diff --git a/engine/uState.mli b/engine/uState.mli
index 3776e4c9f..d198fbfbe 100644
--- a/engine/uState.mli
+++ b/engine/uState.mli
@@ -123,4 +123,4 @@ val update_sigma_env : t -> Environ.env -> t
(** {5 Pretty-printing} *)
-val pr_uctx_level : t -> Univ.Level.t -> Pp.std_ppcmds
+val pr_uctx_level : t -> Univ.Level.t -> Pp.t
diff --git a/engine/universes.mli b/engine/universes.mli
index 0f6e419d0..fe40f8238 100644
--- a/engine/universes.mli
+++ b/engine/universes.mli
@@ -17,7 +17,7 @@ val is_set_minimization : unit -> bool
(** Universes *)
-val pr_with_global_universes : Level.t -> Pp.std_ppcmds
+val pr_with_global_universes : Level.t -> Pp.t
(** Local universe name <-> level mapping *)
@@ -52,7 +52,7 @@ type universe_constraint = universe * universe_constraint_type * universe
module Constraints : sig
include Set.S with type elt = universe_constraint
- val pr : t -> Pp.std_ppcmds
+ val pr : t -> Pp.t
end
type universe_constraints = Constraints.t
@@ -203,7 +203,7 @@ val refresh_constraints : UGraph.t -> universe_context_set -> universe_context_s
(** Pretty-printing *)
-val pr_universe_opt_subst : universe_opt_subst -> Pp.std_ppcmds
+val pr_universe_opt_subst : universe_opt_subst -> Pp.t
(** {6 Support for template polymorphism } *)
diff --git a/grammar/argextend.mlp b/grammar/argextend.mlp
index 643b6277a..12b7b171b 100644
--- a/grammar/argextend.mlp
+++ b/grammar/argextend.mlp
@@ -137,7 +137,8 @@ let declare_tactic_argument loc s (typ, f, g, h) cl =
let typ = match globtyp with None -> ExtraArgType s | Some typ -> typ in
<:expr<
let f = $lid:f$ in
- fun ist v -> Ftactic.nf_enter (fun gl ->
+ fun ist v -> Ftactic.enter (fun gl ->
+ let gl = Proofview.Goal.assume gl in
let (sigma, v) = Tacmach.New.of_old (fun gl -> f ist gl v) gl in
let v = Geninterp.Val.inject (Geninterp.val_tag $make_topwit loc typ$) v in
Proofview.tclTHEN (Proofview.Unsafe.tclEVARS sigma) (Ftactic.return v)
diff --git a/grammar/compat5.ml b/grammar/compat5.ml
deleted file mode 100644
index 370d9e3a0..000000000
--- a/grammar/compat5.ml
+++ /dev/null
@@ -1,13 +0,0 @@
-(************************************************************************)
-(* v * The Coq Proof Assistant / The Coq Development Team *)
-(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *)
-(* \VV/ **************************************************************)
-(* // * This file is distributed under the terms of the *)
-(* * GNU Lesser General Public License Version 2.1 *)
-(************************************************************************)
-
-(* This file is meant for camlp5, for which there is nothing to
- add to gain camlp5 compatibility :-).
-
- See [compat5.mlp] for the [camlp4] counterpart
-*)
diff --git a/ide/coqOps.ml b/ide/coqOps.ml
index 3eb5b0753..364fc883b 100644
--- a/ide/coqOps.ml
+++ b/ide/coqOps.ml
@@ -58,7 +58,7 @@ module SentenceId : sig
val connect : sentence -> signals
val dbg_to_string :
- GText.buffer -> bool -> Stateid.t option -> sentence -> Pp.std_ppcmds
+ GText.buffer -> bool -> Stateid.t option -> sentence -> Pp.t
end = struct
@@ -163,7 +163,7 @@ let flags_to_color f =
else `NAME Preferences.processed_color#get
(* Move to utils? *)
-let rec validate (s : Pp.std_ppcmds) = match Pp.repr s with
+let rec validate (s : Pp.t) = match Pp.repr s with
| Pp.Ppcmd_empty
| Pp.Ppcmd_print_break _
| Pp.Ppcmd_force_newline -> true
diff --git a/ide/document.mli b/ide/document.mli
index fb96cb6d7..ab8e71808 100644
--- a/ide/document.mli
+++ b/ide/document.mli
@@ -102,7 +102,7 @@ val context : 'a document -> (id * 'a) list * (id * 'a) list
(** debug print *)
val print :
- 'a document -> (bool -> id option -> 'a -> Pp.std_ppcmds) -> Pp.std_ppcmds
+ 'a document -> (bool -> id option -> 'a -> Pp.t) -> Pp.t
(** Callbacks on documents *)
diff --git a/ide/ide_slave.ml b/ide/ide_slave.ml
index cb2b365a4..67391f556 100644
--- a/ide/ide_slave.ml
+++ b/ide/ide_slave.ml
@@ -177,11 +177,9 @@ let process_goal sigma g =
let min_env = Environ.reset_context env in
let id = Goal.uid g in
let ccl =
- let norm_constr = Reductionops.nf_evar sigma (Goal.V82.concl sigma g) in
- pr_goal_concl_style_env env sigma norm_constr
+ pr_goal_concl_style_env env sigma (Goal.V82.concl sigma g)
in
let process_hyp d (env,l) =
- let d = CompactedDecl.map_constr (fun c -> EConstr.Unsafe.to_constr (Reductionops.nf_evar sigma (EConstr.of_constr c))) d in
let d' = CompactedDecl.to_named_context d in
(List.fold_right Environ.push_named d' env,
(pr_compacted_decl env sigma d) :: l) in
@@ -210,7 +208,7 @@ let evars () =
Stm.finish ();
let pfts = Proof_global.give_me_the_proof () in
let { Evd.it = all_goals ; sigma = sigma } = Proof.V82.subgoals pfts in
- let exl = Evar.Map.bindings (Evarutil.non_instantiated sigma) in
+ let exl = Evar.Map.bindings (Evd.undefined_map sigma) in
let map_evar ev = { Interface.evar_info = string_of_ppcmds (pr_evar sigma ev); } in
let el = List.map map_evar exl in
Some el
diff --git a/ide/ideutils.ml b/ide/ideutils.ml
index 2573b6d6f..83e5da950 100644
--- a/ide/ideutils.ml
+++ b/ide/ideutils.ml
@@ -316,7 +316,7 @@ let textview_width (view : #GText.view_skel) =
let char_width = GPango.to_pixels metrics#approx_char_width in
pixel_width / char_width
-type logger = Feedback.level -> Pp.std_ppcmds -> unit
+type logger = Feedback.level -> Pp.t -> unit
let default_logger level message =
let level = match level with
diff --git a/ide/ideutils.mli b/ide/ideutils.mli
index 458b8e0a5..f06a48aeb 100644
--- a/ide/ideutils.mli
+++ b/ide/ideutils.mli
@@ -67,7 +67,7 @@ val requote : string -> string
val textview_width : #GText.view_skel -> int
(** Returns an approximate value of the character width of a textview *)
-type logger = Feedback.level -> Pp.std_ppcmds -> unit
+type logger = Feedback.level -> Pp.t -> unit
val default_logger : logger
(** Default logger. It logs messages that the casual user should not see. *)
diff --git a/ide/interface.mli b/ide/interface.mli
index aab1d8272..1939a8427 100644
--- a/ide/interface.mli
+++ b/ide/interface.mli
@@ -17,9 +17,9 @@ type verbose = bool
type goal = {
goal_id : string;
(** Unique goal identifier *)
- goal_hyp : Pp.std_ppcmds list;
+ goal_hyp : Pp.t list;
(** List of hypotheses *)
- goal_ccl : Pp.std_ppcmds;
+ goal_ccl : Pp.t;
(** Goal conclusion *)
}
@@ -121,7 +121,7 @@ type edit_id = int
should probably retract to that point *)
type 'a value =
| Good of 'a
- | Fail of (state_id * location * Pp.std_ppcmds)
+ | Fail of (state_id * location * Pp.t)
type ('a, 'b) union = ('a, 'b) Util.union
@@ -213,7 +213,7 @@ type about_sty = unit
type about_rty = coq_info
type handle_exn_sty = Exninfo.iexn
-type handle_exn_rty = state_id * location * Pp.std_ppcmds
+type handle_exn_rty = state_id * location * Pp.t
(* Retrocompatibility stuff *)
type interp_sty = (raw * verbose) * string
diff --git a/ide/minilib.mli b/ide/minilib.mli
index 4517a2374..c96e59b22 100644
--- a/ide/minilib.mli
+++ b/ide/minilib.mli
@@ -22,7 +22,7 @@ type level = [
(** debug printing *)
val debug : bool ref
-val log_pp : ?level:level -> Pp.std_ppcmds -> unit
+val log_pp : ?level:level -> Pp.t -> unit
val log : ?level:level -> string -> unit
val coqide_config_home : unit -> string
diff --git a/ide/richpp.mli b/ide/richpp.mli
index f2ba15d22..84adc61ca 100644
--- a/ide/richpp.mli
+++ b/ide/richpp.mli
@@ -24,7 +24,7 @@ type 'annotation located = {
that represents (located) annotations of this string.
The [get_annotations] function is used to convert tags into the desired
annotation. [width] sets the printing witdh of the formatter. *)
-val rich_pp : int -> Pp.std_ppcmds -> Pp.pp_tag located Xml_datatype.gxml
+val rich_pp : int -> Pp.t -> Pp.pp_tag located Xml_datatype.gxml
(** [annotations_positions ssdoc] returns a list associating each
annotations with its position in the string from which [ssdoc] is
@@ -47,5 +47,5 @@ type richpp = Xml_datatype.xml
(** Type of text with style annotations *)
-val richpp_of_pp : int -> Pp.std_ppcmds -> richpp
+val richpp_of_pp : int -> Pp.t -> richpp
(** Extract style information from formatted text *)
diff --git a/ide/wg_Detachable.ml b/ide/wg_Detachable.ml
index e5b436427..3d3a5ccb2 100644
--- a/ide/wg_Detachable.ml
+++ b/ide/wg_Detachable.ml
@@ -19,7 +19,7 @@ class detachable (obj : ([> Gtk.box] as 'a) Gobject.obj) =
inherit GPack.box_skel (obj :> Gtk.box Gobject.obj) as super
val but = GButton.button ()
- val win = GWindow.window ()
+ val win = GWindow.window ~type_hint:`DIALOG ()
val frame = GBin.frame ~shadow_type:`NONE ()
val mutable detached = false
val mutable detached_cb = (fun _ -> ())
diff --git a/ide/wg_MessageView.ml b/ide/wg_MessageView.ml
index d2a09dd94..65df2b849 100644
--- a/ide/wg_MessageView.ml
+++ b/ide/wg_MessageView.ml
@@ -28,9 +28,9 @@ class type message_view =
inherit GObj.widget
method connect : message_view_signals
method clear : unit
- method add : Pp.std_ppcmds -> unit
+ method add : Pp.t -> unit
method add_string : string -> unit
- method set : Pp.std_ppcmds -> unit
+ method set : Pp.t -> unit
method refresh : bool -> unit
method push : Ideutils.logger
(** same as [add], but with an explicit level instead of [Notice] *)
diff --git a/ide/wg_MessageView.mli b/ide/wg_MessageView.mli
index 0ce257c3d..6bd0625f0 100644
--- a/ide/wg_MessageView.mli
+++ b/ide/wg_MessageView.mli
@@ -18,9 +18,9 @@ class type message_view =
inherit GObj.widget
method connect : message_view_signals
method clear : unit
- method add : Pp.std_ppcmds -> unit
+ method add : Pp.t -> unit
method add_string : string -> unit
- method set : Pp.std_ppcmds -> unit
+ method set : Pp.t -> unit
method refresh : bool -> unit
method push : Ideutils.logger
(** same as [add], but with an explicit level instead of [Notice] *)
diff --git a/ide/xmlprotocol.ml b/ide/xmlprotocol.ml
index 06c695c77..4b521a968 100644
--- a/ide/xmlprotocol.ml
+++ b/ide/xmlprotocol.ml
@@ -117,7 +117,7 @@ let to_box = let open Pp in
| x -> raise (Marshal_error("*ppbox",PCData x))
)
-let rec of_pp (pp : Pp.std_ppcmds) = let open Pp in match Pp.repr pp with
+let rec of_pp (pp : Pp.t) = let open Pp in match Pp.repr pp with
| Ppcmd_empty -> constructor "ppdoc" "empty" []
| Ppcmd_string s -> constructor "ppdoc" "string" [of_string s]
| Ppcmd_glue sl -> constructor "ppdoc" "glue" [of_list of_pp sl]
@@ -149,7 +149,7 @@ let rec to_pp xpp = let open Pp in
let of_richpp x = Element ("richpp", [], [x])
(* Run-time Selectable *)
-let of_pp (pp : Pp.std_ppcmds) =
+let of_pp (pp : Pp.t) =
match !msg_format with
| Richpp margin -> of_richpp (Richpp.richpp_of_pp margin pp)
| Ppcmds -> of_pp pp
diff --git a/interp/constrextern.ml b/interp/constrextern.ml
index fcaee5c93..e85415bed 100644
--- a/interp/constrextern.ml
+++ b/interp/constrextern.ml
@@ -320,38 +320,6 @@ let drop_implicits_in_patt cst nb_expl args =
let imps = List.skipn_at_least nb_expl (select_stronger_impargs impl_st) in
impls_fit [] (imps,args)
-let has_curly_brackets ntn =
- String.length ntn >= 6 && (String.is_sub "{ _ } " ntn 0 ||
- String.is_sub " { _ }" ntn (String.length ntn - 6) ||
- String.string_contains ~where:ntn ~what:" { _ } ")
-
-let rec wildcards ntn n =
- if Int.equal n (String.length ntn) then []
- else let l = spaces ntn (n+1) in if ntn.[n] == '_' then n::l else l
-and spaces ntn n =
- if Int.equal n (String.length ntn) then []
- else if ntn.[n] == ' ' then wildcards ntn (n+1) else spaces ntn (n+1)
-
-let expand_curly_brackets loc mknot ntn l =
- let ntn' = ref ntn in
- let rec expand_ntn i =
- function
- | [] -> []
- | a::l ->
- let a' =
- let p = List.nth (wildcards !ntn' 0) i - 2 in
- if p>=0 && p+5 <= String.length !ntn' && String.is_sub "{ _ }" !ntn' p
- then begin
- ntn' :=
- String.sub !ntn' 0 p ^ "_" ^
- String.sub !ntn' (p+5) (String.length !ntn' -p-5);
- mknot (loc,"{ _ }",[a]) end
- else a in
- a' :: expand_ntn (i+1) l in
- let l = expand_ntn 0 l in
- (* side effect *)
- mknot (loc,!ntn',l)
-
let destPrim = function { CAst.v = CPrim t } -> Some t | _ -> None
let destPatPrim = function { CAst.v = CPatPrim t } -> Some t | _ -> None
@@ -367,9 +335,7 @@ let is_zero s =
in aux 0
let make_notation_gen loc ntn mknot mkprim destprim l =
- if has_curly_brackets ntn
- then expand_curly_brackets loc mknot ntn l
- else match ntn,List.map destprim l with
+ match ntn,List.map destprim l with
(* Special case to avoid writing "- 3" for e.g. (Z.opp 3) *)
| "- _", [Some (Numeral (p,true))] when not (is_zero p) ->
mknot (loc,ntn,([mknot (loc,"( _ )",l)]))
@@ -1098,7 +1064,6 @@ let extern_constr_gen lax goal_concl_style scopt env sigma t =
(* Not "goal_concl_style" means do alpha-conversion avoiding only *)
(* those goal/section/rel variables that occurs in the subterm under *)
(* consideration; see namegen.ml for further details *)
- let t = EConstr.of_constr t in
let avoid = if goal_concl_style then ids_of_context env else [] in
let r = Detyping.detype ~lax:lax goal_concl_style avoid env sigma t in
let vars = vars_of_env env in
@@ -1111,7 +1076,6 @@ let extern_constr ?(lax=false) goal_concl_style env sigma t =
extern_constr_gen lax goal_concl_style None env sigma t
let extern_type goal_concl_style env sigma t =
- let t = EConstr.of_constr t in
let avoid = if goal_concl_style then ids_of_context env else [] in
let r = Detyping.detype goal_concl_style avoid env sigma t in
extern_glob_type (vars_of_env env) r
@@ -1198,8 +1162,6 @@ let extern_constr_pattern env sigma pat =
extern true (None,[]) Id.Set.empty (glob_of_pat env sigma pat)
let extern_rel_context where env sigma sign =
- let sign = List.map (fun d -> Termops.map_rel_decl EConstr.of_constr d) sign in
- let where = Option.map EConstr.of_constr where in
let a = detype_rel_context where [] (names_of_rel_context env,env) sigma sign in
let vars = vars_of_env env in
let a = List.map (extended_glob_local_binder_of_decl) a in
diff --git a/interp/constrextern.mli b/interp/constrextern.mli
index b5242b347..ffa891c50 100644
--- a/interp/constrextern.mli
+++ b/interp/constrextern.mli
@@ -9,6 +9,7 @@
open Names
open Term
open Termops
+open EConstr
open Environ
open Libnames
open Globnames
@@ -41,7 +42,7 @@ val extern_reference : ?loc:Loc.t -> Id.Set.t -> global_reference -> reference
val extern_type : bool -> env -> Evd.evar_map -> types -> constr_expr
val extern_sort : Evd.evar_map -> sorts -> glob_sort
val extern_rel_context : constr option -> env -> Evd.evar_map ->
- Context.Rel.t -> local_binder_expr list
+ rel_context -> local_binder_expr list
(** Printing options *)
val print_implicits : bool ref
diff --git a/interp/declare.ml b/interp/declare.ml
index 70f422b51..7fcb38296 100644
--- a/interp/declare.ml
+++ b/interp/declare.ml
@@ -32,14 +32,6 @@ type internal_flag =
| InternalTacticRequest (* kernel action, no message is displayed *)
| UserIndividualRequest (* user action, a message is displayed *)
-(** XML output hooks *)
-
-let (f_xml_declare_variable, xml_declare_variable) = Hook.make ~default:ignore ()
-let (f_xml_declare_constant, xml_declare_constant) = Hook.make ~default:ignore ()
-let (f_xml_declare_inductive, xml_declare_inductive) = Hook.make ~default:ignore ()
-
-let if_xml f x = if !Flags.xml_export then f x else ()
-
(** Declaration of section variables and local definitions *)
type section_variable_entry =
@@ -95,7 +87,6 @@ let declare_variable id obj =
declare_var_implicits id;
Notation.declare_ref_arguments_scope (VarRef id);
Heads.declare_head (EvalVarRef id);
- if_xml (Hook.get f_xml_declare_variable) oname;
oname
@@ -256,7 +247,6 @@ let declare_constant ?(internal = UserIndividualRequest) ?(local = false) id ?(e
let id = Label.to_id (pi3 (Constant.repr3 c)) in
ignore(add_leaf id o);
update_tables c;
- let () = if_xml (Hook.get f_xml_declare_constant) (InternalTacticRequest, c) in
match role with
| Safe_typing.Subproof -> ()
| Safe_typing.Schema (ind, kind) -> !declare_scheme kind [|ind,c|]
@@ -268,9 +258,7 @@ let declare_constant ?(internal = UserIndividualRequest) ?(local = false) id ?(e
cst_kind = kind;
cst_locl = local;
} in
- let kn = declare_constant_common id cst in
- let () = if_xml (Hook.get f_xml_declare_constant) (internal, kn) in
- kn
+ declare_constant_common id cst
let declare_definition ?(internal=UserIndividualRequest)
?(opaque=false) ?(kind=Decl_kinds.Definition) ?(local = false)
@@ -410,7 +398,6 @@ let declare_mind mie =
let isrecord,isprim = declare_projections mind in
declare_mib_implicits mind;
declare_inductive_argument_scopes mind mie;
- if_xml (Hook.get f_xml_declare_inductive) (isrecord,oname);
oname, isprim
(* Declaration messages *)
diff --git a/interp/declare.mli b/interp/declare.mli
index 6a0943464..ccd7d28bb 100644
--- a/interp/declare.mli
+++ b/interp/declare.mli
@@ -69,11 +69,6 @@ val set_declare_scheme :
the whole block and a boolean indicating if it is a primitive record. *)
val declare_mind : mutual_inductive_entry -> object_name * bool
-(** Hooks for XML output *)
-val xml_declare_variable : (object_name -> unit) Hook.t
-val xml_declare_constant : (internal_flag * constant -> unit) Hook.t
-val xml_declare_inductive : (bool * object_name -> unit) Hook.t
-
(** Declaration messages *)
val definition_message : Id.t -> unit
diff --git a/interp/notation.ml b/interp/notation.ml
index c07a00943..c373faf68 100644
--- a/interp/notation.ml
+++ b/interp/notation.ml
@@ -41,7 +41,6 @@ open Context.Named.Declaration
(**********************************************************************)
(* Scope of symbols *)
-type level = precedence * tolerability list
type delimiters = string
type notation_location = (DirPath.t * DirPath.t) * string
@@ -83,11 +82,18 @@ let parenRelation_eq t1 t2 = match t1, t2 with
| Prec l1, Prec l2 -> Int.equal l1 l2
| _ -> false
-let level_eq (l1, t1) (l2, t2) =
+let notation_var_internalization_type_eq v1 v2 = match v1, v2 with
+| NtnInternTypeConstr, NtnInternTypeConstr -> true
+| NtnInternTypeBinder, NtnInternTypeBinder -> true
+| NtnInternTypeIdent, NtnInternTypeIdent -> true
+| (NtnInternTypeConstr | NtnInternTypeBinder | NtnInternTypeIdent), _ -> false
+
+let level_eq (l1, t1, u1) (l2, t2, u2) =
let tolerability_eq (i1, r1) (i2, r2) =
Int.equal i1 i2 && parenRelation_eq r1 r2
in
Int.equal l1 l2 && List.equal tolerability_eq t1 t2
+ && List.equal notation_var_internalization_type_eq u1 u2
let declare_scope scope =
try let _ = String.Map.find scope !scope_map in ()
diff --git a/interp/notation.mli b/interp/notation.mli
index dd0144e8d..f9f247fe1 100644
--- a/interp/notation.mli
+++ b/interp/notation.mli
@@ -6,7 +6,6 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-open Pp
open Bigint
open Names
open Libnames
@@ -22,7 +21,6 @@ open Ppextend
(** A scope is a set of interpreters for symbols + optional
interpreter and printers for integers + optional delimiters *)
-type level = precedence * tolerability list
type delimiters = string
type scope
type scopes (** = [scope_name list] *)
@@ -189,13 +187,13 @@ val make_notation_key : symbol list -> notation
val decompose_notation_key : notation -> symbol list
(** Prints scopes (expects a pure aconstr printer) *)
-val pr_scope_class : scope_class -> std_ppcmds
-val pr_scope : (glob_constr -> std_ppcmds) -> scope_name -> std_ppcmds
-val pr_scopes : (glob_constr -> std_ppcmds) -> std_ppcmds
-val locate_notation : (glob_constr -> std_ppcmds) -> notation ->
- scope_name option -> std_ppcmds
+val pr_scope_class : scope_class -> Pp.t
+val pr_scope : (glob_constr -> Pp.t) -> scope_name -> Pp.t
+val pr_scopes : (glob_constr -> Pp.t) -> Pp.t
+val locate_notation : (glob_constr -> Pp.t) -> notation ->
+ scope_name option -> Pp.t
-val pr_visibility: (glob_constr -> std_ppcmds) -> scope_name option -> std_ppcmds
+val pr_visibility: (glob_constr -> Pp.t) -> scope_name option -> Pp.t
(** {6 Printing rules for notations} *)
diff --git a/interp/ppextend.ml b/interp/ppextend.ml
index 2bbe87bbc..3ebc9b71d 100644
--- a/interp/ppextend.ml
+++ b/interp/ppextend.ml
@@ -7,17 +7,10 @@
(************************************************************************)
open Pp
+open Notation_term
(*s Pretty-print. *)
-(* Dealing with precedences *)
-
-type precedence = int
-
-type parenRelation = L | E | Any | Prec of precedence
-
-type tolerability = precedence * parenRelation
-
type ppbox =
| PpHB of int
| PpHOVB of int
diff --git a/interp/ppextend.mli b/interp/ppextend.mli
index 4874989cd..6ff5a4272 100644
--- a/interp/ppextend.mli
+++ b/interp/ppextend.mli
@@ -6,18 +6,10 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-open Pp
+open Notation_term
(** {6 Pretty-print. } *)
-(** Dealing with precedences *)
-
-type precedence = int
-
-type parenRelation = L | E | Any | Prec of precedence
-
-type tolerability = precedence * parenRelation
-
type ppbox =
| PpHB of int
| PpHOVB of int
@@ -28,9 +20,9 @@ type ppcut =
| PpBrk of int * int
| PpFnl
-val ppcmd_of_box : ppbox -> std_ppcmds -> std_ppcmds
+val ppcmd_of_box : ppbox -> Pp.t -> Pp.t
-val ppcmd_of_cut : ppcut -> std_ppcmds
+val ppcmd_of_cut : ppcut -> Pp.t
type unparsing =
| UnpMetaVar of int * parenRelation
diff --git a/intf/notation_term.ml b/intf/notation_term.ml
index 0fa0afdad..c342da3dc 100644
--- a/intf/notation_term.ml
+++ b/intf/notation_term.ml
@@ -83,15 +83,29 @@ type notation_interp_env = {
type grammar_constr_prod_item =
| GramConstrTerminal of Tok.t
| GramConstrNonTerminal of Extend.constr_prod_entry_key * Id.t option
- | GramConstrListMark of int * bool
+ | GramConstrListMark of int * bool * int
(* tells action rule to make a list of the n previous parsed items;
- concat with last parsed list if true *)
+ concat with last parsed list when true; additionally release
+ the p last items as if they were parsed autonomously *)
-type notation_grammar = {
- notgram_level : int;
+(** Dealing with precedences *)
+
+type precedence = int
+type parenRelation = L | E | Any | Prec of precedence
+type tolerability = precedence * parenRelation
+
+type level = precedence * tolerability list * notation_var_internalization_type list
+
+(** Grammar rules for a notation *)
+
+type one_notation_grammar = {
+ notgram_level : level;
notgram_assoc : Extend.gram_assoc option;
notgram_notation : Constrexpr.notation;
notgram_prods : grammar_constr_prod_item list list;
- notgram_typs : notation_var_internalization_type list;
+}
+
+type notation_grammar = {
notgram_onlyprinting : bool;
+ notgram_rules : one_notation_grammar list
}
diff --git a/intf/vernacexpr.ml b/intf/vernacexpr.ml
index 6ef9532ad..2adf522b7 100644
--- a/intf/vernacexpr.ml
+++ b/intf/vernacexpr.ml
@@ -305,6 +305,14 @@ type inline =
type module_ast_inl = module_ast * inline
type module_binder = bool option * lident list * module_ast_inl
+(** Cumulativity can be set globally, locally or unset locally and it
+ can not enabled at all. *)
+type cumulative_inductive_parsing_flag =
+ | GlobalCumulativity
+ | GlobalNonCumulativity
+ | LocalCumulativity
+ | LocalNonCumulativity
+
(** {6 The type of vernacular expressions} *)
type vernac_expr =
@@ -336,7 +344,7 @@ type vernac_expr =
| VernacExactProof of constr_expr
| VernacAssumption of (locality option * assumption_object_kind) *
inline * (plident list * constr_expr) with_coercion list
- | VernacInductive of cumulative_inductive_flag * private_flag * inductive_flag * (inductive_expr * decl_notation list) list
+ | VernacInductive of cumulative_inductive_parsing_flag * private_flag * inductive_flag * (inductive_expr * decl_notation list) list
| VernacFixpoint of
locality option * (fixpoint_expr * decl_notation list) list
| VernacCoFixpoint of
diff --git a/kernel/primitives.ml b/kernel/cPrimitives.ml
index 14c11bf10..14c11bf10 100644
--- a/kernel/primitives.ml
+++ b/kernel/cPrimitives.ml
diff --git a/kernel/primitives.mli b/kernel/cPrimitives.mli
index 8cdffb670..8cdffb670 100644
--- a/kernel/primitives.mli
+++ b/kernel/cPrimitives.mli
diff --git a/kernel/cbytecodes.mli b/kernel/cbytecodes.mli
index 8f38e9d34..718917ab3 100644
--- a/kernel/cbytecodes.mli
+++ b/kernel/cbytecodes.mli
@@ -34,7 +34,7 @@ type structured_constant =
| Const_univ_level of Univ.universe_level
| Const_type of Univ.universe
-val pp_struct_const : structured_constant -> Pp.std_ppcmds
+val pp_struct_const : structured_constant -> Pp.t
type reloc_table = (tag * int) array
@@ -163,8 +163,8 @@ type comp_env = {
in_env : vm_env ref (** the variables that are accessed *)
}
-val pp_bytecodes : bytecodes -> Pp.std_ppcmds
-val pp_fv_elem : fv_elem -> Pp.std_ppcmds
+val pp_bytecodes : bytecodes -> Pp.t
+val pp_fv_elem : fv_elem -> Pp.t
(*spiwack: moved this here because I needed it for retroknowledge *)
type block =
diff --git a/kernel/environ.ml b/kernel/environ.ml
index d2c737ab0..621a9931d 100644
--- a/kernel/environ.ml
+++ b/kernel/environ.ml
@@ -624,39 +624,39 @@ fun rk value field ->
native_constant_dynamic = Some Nativelambda.compile_dynamic_int31;
}
| KInt31 (_, Int31Plus) -> int31_binop_from_const Cbytecodes.Kaddint31
- Primitives.Int31add
+ CPrimitives.Int31add
| KInt31 (_, Int31PlusC) -> int31_binop_from_const Cbytecodes.Kaddcint31
- Primitives.Int31addc
+ CPrimitives.Int31addc
| KInt31 (_, Int31PlusCarryC) -> int31_binop_from_const Cbytecodes.Kaddcarrycint31
- Primitives.Int31addcarryc
+ CPrimitives.Int31addcarryc
| KInt31 (_, Int31Minus) -> int31_binop_from_const Cbytecodes.Ksubint31
- Primitives.Int31sub
+ CPrimitives.Int31sub
| KInt31 (_, Int31MinusC) -> int31_binop_from_const Cbytecodes.Ksubcint31
- Primitives.Int31subc
+ CPrimitives.Int31subc
| KInt31 (_, Int31MinusCarryC) -> int31_binop_from_const
- Cbytecodes.Ksubcarrycint31 Primitives.Int31subcarryc
+ Cbytecodes.Ksubcarrycint31 CPrimitives.Int31subcarryc
| KInt31 (_, Int31Times) -> int31_binop_from_const Cbytecodes.Kmulint31
- Primitives.Int31mul
+ CPrimitives.Int31mul
| KInt31 (_, Int31TimesC) -> int31_binop_from_const Cbytecodes.Kmulcint31
- Primitives.Int31mulc
+ CPrimitives.Int31mulc
| KInt31 (_, Int31Div21) -> int31_op_from_const 3 Cbytecodes.Kdiv21int31
- Primitives.Int31div21
+ CPrimitives.Int31div21
| KInt31 (_, Int31Diveucl) -> int31_binop_from_const Cbytecodes.Kdivint31
- Primitives.Int31diveucl
+ CPrimitives.Int31diveucl
| KInt31 (_, Int31AddMulDiv) -> int31_op_from_const 3 Cbytecodes.Kaddmuldivint31
- Primitives.Int31addmuldiv
+ CPrimitives.Int31addmuldiv
| KInt31 (_, Int31Compare) -> int31_binop_from_const Cbytecodes.Kcompareint31
- Primitives.Int31compare
+ CPrimitives.Int31compare
| KInt31 (_, Int31Head0) -> int31_unop_from_const Cbytecodes.Khead0int31
- Primitives.Int31head0
+ CPrimitives.Int31head0
| KInt31 (_, Int31Tail0) -> int31_unop_from_const Cbytecodes.Ktail0int31
- Primitives.Int31tail0
+ CPrimitives.Int31tail0
| KInt31 (_, Int31Lor) -> int31_binop_from_const Cbytecodes.Klorint31
- Primitives.Int31lor
+ CPrimitives.Int31lor
| KInt31 (_, Int31Land) -> int31_binop_from_const Cbytecodes.Klandint31
- Primitives.Int31land
+ CPrimitives.Int31land
| KInt31 (_, Int31Lxor) -> int31_binop_from_const Cbytecodes.Klxorint31
- Primitives.Int31lxor
+ CPrimitives.Int31lxor
| _ -> empty_reactive_info
let _ = Hook.set Retroknowledge.dispatch_hook dispatch
diff --git a/kernel/kernel.mllib b/kernel/kernel.mllib
index 994634854..917e4f6f1 100644
--- a/kernel/kernel.mllib
+++ b/kernel/kernel.mllib
@@ -17,7 +17,7 @@ Opaqueproof
Declarations
Entries
Nativevalues
-Primitives
+CPrimitives
Declareops
Retroknowledge
Conv_oracle
diff --git a/kernel/mod_subst.mli b/kernel/mod_subst.mli
index 3cd02fb9f..f1d0e4279 100644
--- a/kernel/mod_subst.mli
+++ b/kernel/mod_subst.mli
@@ -107,9 +107,9 @@ val subst_substituted : substitution -> 'a substituted -> 'a substituted
(**/**)
(* debugging *)
val debug_string_of_subst : substitution -> string
-val debug_pr_subst : substitution -> Pp.std_ppcmds
+val debug_pr_subst : substitution -> Pp.t
val debug_string_of_delta : delta_resolver -> string
-val debug_pr_delta : delta_resolver -> Pp.std_ppcmds
+val debug_pr_delta : delta_resolver -> Pp.t
(**/**)
(** [subst_mp sub mp] guarantees that whenever the result of the
diff --git a/kernel/names.mli b/kernel/names.mli
index 74d63c0ce..d111dd3c0 100644
--- a/kernel/names.mli
+++ b/kernel/names.mli
@@ -57,7 +57,7 @@ sig
val to_string : t -> string
(** Converts a identifier into an string. *)
- val print : t -> Pp.std_ppcmds
+ val print : t -> Pp.t
(** Pretty-printer. *)
module Set : Set.S with type elt = t
@@ -105,7 +105,7 @@ sig
val hcons : t -> t
(** Hashconsing over names. *)
- val print : t -> Pp.std_ppcmds
+ val print : t -> Pp.t
(** Pretty-printer (print "_" for [Anonymous]. *)
end
@@ -187,7 +187,7 @@ sig
val to_id : t -> Id.t
(** Conversion to an identifier. *)
- val print : t -> Pp.std_ppcmds
+ val print : t -> Pp.t
(** Pretty-printer. *)
module Set : Set.S with type elt = t
@@ -286,7 +286,7 @@ sig
val debug_to_string : t -> string
(** Same as [to_string], but outputs information related to debug. *)
- val print : t -> Pp.std_ppcmds
+ val print : t -> Pp.t
(** Comparisons *)
val compare : t -> t -> int
@@ -365,9 +365,9 @@ sig
(** Displaying *)
val to_string : t -> string
- val print : t -> Pp.std_ppcmds
+ val print : t -> Pp.t
val debug_to_string : t -> string
- val debug_print : t -> Pp.std_ppcmds
+ val debug_print : t -> Pp.t
end
@@ -447,9 +447,9 @@ sig
(** Displaying *)
val to_string : t -> string
- val print : t -> Pp.std_ppcmds
+ val print : t -> Pp.t
val debug_to_string : t -> string
- val debug_print : t -> Pp.std_ppcmds
+ val debug_print : t -> Pp.t
end
@@ -609,7 +609,7 @@ val mk_label : string -> label
val string_of_label : label -> string
(** @deprecated Same as [Label.to_string]. *)
-val pr_label : label -> Pp.std_ppcmds
+val pr_label : label -> Pp.t
(** @deprecated Same as [Label.print]. *)
val label_of_id : Id.t -> label
@@ -695,7 +695,7 @@ val label : kernel_name -> Label.t
val string_of_kn : kernel_name -> string
(** @deprecated Same as [KerName.to_string]. *)
-val pr_kn : kernel_name -> Pp.std_ppcmds
+val pr_kn : kernel_name -> Pp.t
(** @deprecated Same as [KerName.print]. *)
val kn_ord : kernel_name -> kernel_name -> int
@@ -731,7 +731,7 @@ module Projection : sig
val map : (constant -> constant) -> t -> t
val to_string : t -> string
- val print : t -> Pp.std_ppcmds
+ val print : t -> Pp.t
end
@@ -776,10 +776,10 @@ val con_with_label : constant -> Label.t -> constant
val string_of_con : constant -> string
(** @deprecated Same as [Constant.to_string] *)
-val pr_con : constant -> Pp.std_ppcmds
+val pr_con : constant -> Pp.t
(** @deprecated Same as [Constant.print] *)
-val debug_pr_con : constant -> Pp.std_ppcmds
+val debug_pr_con : constant -> Pp.t
(** @deprecated Same as [Constant.debug_print] *)
val debug_string_of_con : constant -> string
@@ -826,10 +826,10 @@ val mind_modpath : mutual_inductive -> ModPath.t
val string_of_mind : mutual_inductive -> string
(** @deprecated Same as [MutInd.to_string] *)
-val pr_mind : mutual_inductive -> Pp.std_ppcmds
+val pr_mind : mutual_inductive -> Pp.t
(** @deprecated Same as [MutInd.print] *)
-val debug_pr_mind : mutual_inductive -> Pp.std_ppcmds
+val debug_pr_mind : mutual_inductive -> Pp.t
(** @deprecated Same as [MutInd.debug_print] *)
val debug_string_of_mind : mutual_inductive -> string
diff --git a/kernel/nativecode.ml b/kernel/nativecode.ml
index da7fcd6f2..e08d913bc 100644
--- a/kernel/nativecode.ml
+++ b/kernel/nativecode.ml
@@ -296,7 +296,7 @@ type primitive =
| MLmagic
| MLarrayget
| Mk_empty_instance
- | Coq_primitive of Primitives.t * (prefix * constant) option
+ | Coq_primitive of CPrimitives.t * (prefix * constant) option
let eq_primitive p1 p2 =
match p1, p2 with
@@ -361,9 +361,9 @@ let primitive_hash = function
| MLsub -> 33
| MLmul -> 34
| MLmagic -> 35
- | Coq_primitive (prim, None) -> combinesmall 36 (Primitives.hash prim)
+ | Coq_primitive (prim, None) -> combinesmall 36 (CPrimitives.hash prim)
| Coq_primitive (prim, Some (prefix,kn)) ->
- combinesmall 37 (combine3 (String.hash prefix) (Constant.hash kn) (Primitives.hash prim))
+ combinesmall 37 (combine3 (String.hash prefix) (Constant.hash kn) (CPrimitives.hash prim))
| Mk_proj -> 38
| MLarrayget -> 39
| Mk_empty_instance -> 40
@@ -921,7 +921,7 @@ let merge_branches t =
type prim_aux =
- | PAprim of string * constant * Primitives.t * prim_aux array
+ | PAprim of string * constant * CPrimitives.t * prim_aux array
| PAml of mllambda
let add_check cond args =
@@ -988,11 +988,11 @@ let compile_prim decl cond paux =
| Int31lt ->
if Sys.word_size = 64 then
app_prim Mk_bool [|(app_prim MLlt (args_to_int args))|]
- else app_prim (Coq_primitive (Primitives.Int31lt,None)) args
+ else app_prim (Coq_primitive (CPrimitives.Int31lt,None)) args
| Int31le ->
if Sys.word_size = 64 then
app_prim Mk_bool [|(app_prim MLle (args_to_int args))|]
- else app_prim (Coq_primitive (Primitives.Int31le, None)) args
+ else app_prim (Coq_primitive (CPrimitives.Int31le, None)) args
| Int31lsl -> of_int (mk_lsl (args_to_int args))
| Int31lsr -> of_int (mk_lsr (args_to_int args))
| Int31land -> of_int (mk_land (args_to_int args))
@@ -1752,9 +1752,9 @@ let pp_mllam fmt l =
| MLarrayget -> Format.fprintf fmt "Array.get"
| Mk_empty_instance -> Format.fprintf fmt "Univ.Instance.empty"
| Coq_primitive (op,None) ->
- Format.fprintf fmt "no_check_%s" (Primitives.to_string op)
+ Format.fprintf fmt "no_check_%s" (CPrimitives.to_string op)
| Coq_primitive (op, Some (prefix,kn)) ->
- Format.fprintf fmt "%s %a" (Primitives.to_string op)
+ Format.fprintf fmt "%s %a" (CPrimitives.to_string op)
pp_mllam (MLglobal (Gconstant (prefix, kn)))
in
Format.fprintf fmt "@[%a@]" pp_mllam l
diff --git a/kernel/nativeinstr.mli b/kernel/nativeinstr.mli
index cb79877e8..2353470f0 100644
--- a/kernel/nativeinstr.mli
+++ b/kernel/nativeinstr.mli
@@ -30,7 +30,7 @@ and lambda =
| Lapp of lambda * lambda array
| Lconst of prefix * pconstant
| Lproj of prefix * constant (* prefix, projection name *)
- | Lprim of prefix * constant * Primitives.t * lambda array
+ | Lprim of prefix * constant * CPrimitives.t * lambda array
| Lcase of annot_sw * lambda * lambda * lam_branches
(* annotations, term being matched, accu, branches *)
| Lif of lambda * lambda * lambda
diff --git a/kernel/nativelambda.mli b/kernel/nativelambda.mli
index bfa3bf941..156e4f834 100644
--- a/kernel/nativelambda.mli
+++ b/kernel/nativelambda.mli
@@ -38,5 +38,5 @@ val compile_dynamic_int31 : bool -> prefix -> constructor -> lambda array ->
val before_match_int31 : inductive -> bool -> prefix -> constructor -> lambda ->
lambda
-val compile_prim : Primitives.t -> constant -> bool -> prefix -> lambda array ->
+val compile_prim : CPrimitives.t -> constant -> bool -> prefix -> lambda array ->
lambda
diff --git a/kernel/uGraph.mli b/kernel/uGraph.mli
index 4de373eb4..2fe555018 100644
--- a/kernel/uGraph.mli
+++ b/kernel/uGraph.mli
@@ -59,7 +59,7 @@ val check_subtype : AUContext.t check_function
(** {6 Pretty-printing of universes. } *)
-val pr_universes : (Level.t -> Pp.std_ppcmds) -> universes -> Pp.std_ppcmds
+val pr_universes : (Level.t -> Pp.t) -> universes -> Pp.t
(** {6 Dumping to a file } *)
diff --git a/kernel/univ.ml b/kernel/univ.ml
index 02b02db89..d915fb8c9 100644
--- a/kernel/univ.ml
+++ b/kernel/univ.ml
@@ -892,7 +892,7 @@ module Instance : sig
val subst_fn : universe_level_subst_fn -> t -> t
- val pr : (Level.t -> Pp.std_ppcmds) -> t -> Pp.std_ppcmds
+ val pr : (Level.t -> Pp.t) -> t -> Pp.t
val levels : t -> LSet.t
end =
struct
diff --git a/kernel/univ.mli b/kernel/univ.mli
index 99092a543..a4f2e26b6 100644
--- a/kernel/univ.mli
+++ b/kernel/univ.mli
@@ -37,7 +37,7 @@ sig
(** Create a new universe level from a unique identifier and an associated
module path. *)
- val pr : t -> Pp.std_ppcmds
+ val pr : t -> Pp.t
(** Pretty-printing *)
val to_string : t -> string
@@ -56,7 +56,7 @@ module LSet :
sig
include CSig.SetS with type elt = universe_level
- val pr : (Level.t -> Pp.std_ppcmds) -> t -> Pp.std_ppcmds
+ val pr : (Level.t -> Pp.t) -> t -> Pp.t
(** Pretty-printing *)
end
@@ -86,10 +86,10 @@ sig
val make : Level.t -> t
(** Create a universe representing the given level. *)
- val pr : t -> Pp.std_ppcmds
+ val pr : t -> Pp.t
(** Pretty-printing *)
- val pr_with : (Level.t -> Pp.std_ppcmds) -> t -> Pp.std_ppcmds
+ val pr_with : (Level.t -> Pp.t) -> t -> Pp.t
val is_level : t -> bool
(** Test if the universe is a level or an algebraic universe. *)
@@ -127,7 +127,7 @@ type universe = Universe.t
(** Alias name. *)
-val pr_uni : universe -> Pp.std_ppcmds
+val pr_uni : universe -> Pp.t
(** The universes hierarchy: Type 0- = Prop <= Type 0 = Set <= Type 1 <= ...
Typing of universes: Type 0-, Type 0 : Type 1; Type i : Type (i+1) if i>0 *)
@@ -218,7 +218,7 @@ sig
(** [subst_union x y] favors the bindings of the first map that are [Some],
otherwise takes y's bindings. *)
- val pr : ('a -> Pp.std_ppcmds) -> 'a t -> Pp.std_ppcmds
+ val pr : ('a -> Pp.t) -> 'a t -> Pp.t
(** Pretty-printing *)
end
@@ -270,7 +270,7 @@ sig
val subst_fn : universe_level_subst_fn -> t -> t
(** Substitution by a level-to-level function. *)
- val pr : (Level.t -> Pp.std_ppcmds) -> t -> Pp.std_ppcmds
+ val pr : (Level.t -> Pp.t) -> t -> Pp.t
(** Pretty-printing, no comments *)
val levels : t -> LSet.t
@@ -463,18 +463,18 @@ val make_abstract_instance : abstract_universe_context -> universe_instance
(** {6 Pretty-printing of universes. } *)
-val pr_constraint_type : constraint_type -> Pp.std_ppcmds
-val pr_constraints : (Level.t -> Pp.std_ppcmds) -> constraints -> Pp.std_ppcmds
-val pr_universe_context : (Level.t -> Pp.std_ppcmds) -> universe_context -> Pp.std_ppcmds
-val pr_cumulativity_info : (Level.t -> Pp.std_ppcmds) -> cumulativity_info -> Pp.std_ppcmds
-val pr_abstract_universe_context : (Level.t -> Pp.std_ppcmds) -> abstract_universe_context -> Pp.std_ppcmds
-val pr_abstract_cumulativity_info : (Level.t -> Pp.std_ppcmds) -> abstract_cumulativity_info -> Pp.std_ppcmds
-val pr_universe_context_set : (Level.t -> Pp.std_ppcmds) -> universe_context_set -> Pp.std_ppcmds
-val explain_universe_inconsistency : (Level.t -> Pp.std_ppcmds) ->
- univ_inconsistency -> Pp.std_ppcmds
-
-val pr_universe_level_subst : universe_level_subst -> Pp.std_ppcmds
-val pr_universe_subst : universe_subst -> Pp.std_ppcmds
+val pr_constraint_type : constraint_type -> Pp.t
+val pr_constraints : (Level.t -> Pp.t) -> constraints -> Pp.t
+val pr_universe_context : (Level.t -> Pp.t) -> universe_context -> Pp.t
+val pr_cumulativity_info : (Level.t -> Pp.t) -> cumulativity_info -> Pp.t
+val pr_abstract_universe_context : (Level.t -> Pp.t) -> abstract_universe_context -> Pp.t
+val pr_abstract_cumulativity_info : (Level.t -> Pp.t) -> abstract_cumulativity_info -> Pp.t
+val pr_universe_context_set : (Level.t -> Pp.t) -> universe_context_set -> Pp.t
+val explain_universe_inconsistency : (Level.t -> Pp.t) ->
+ univ_inconsistency -> Pp.t
+
+val pr_universe_level_subst : universe_level_subst -> Pp.t
+val pr_universe_subst : universe_subst -> Pp.t
(** {6 Hash-consing } *)
diff --git a/kernel/vm.mli b/kernel/vm.mli
index 6e9579aa4..df638acc1 100644
--- a/kernel/vm.mli
+++ b/kernel/vm.mli
@@ -50,9 +50,9 @@ type whd =
(** For debugging purposes only *)
-val pr_atom : atom -> Pp.std_ppcmds
-val pr_whd : whd -> Pp.std_ppcmds
-val pr_stack : stack -> Pp.std_ppcmds
+val pr_atom : atom -> Pp.t
+val pr_whd : whd -> Pp.t
+val pr_stack : stack -> Pp.t
(** Constructors *)
diff --git a/lib/cErrors.ml b/lib/cErrors.ml
index 8ef11a2cd..3f4e8aa12 100644
--- a/lib/cErrors.ml
+++ b/lib/cErrors.ml
@@ -14,7 +14,7 @@ let push = Backtrace.add_backtrace
(* Errors *)
-exception Anomaly of string option * std_ppcmds (* System errors *)
+exception Anomaly of string option * Pp.t (* System errors *)
let _ =
let pr = function
@@ -33,7 +33,7 @@ let is_anomaly = function
| Anomaly _ -> true
| _ -> false
-exception UserError of string option * std_ppcmds (* User errors *)
+exception UserError of string option * Pp.t (* User errors *)
let todo s = prerr_string ("TODO: "^s^"\n")
@@ -41,7 +41,7 @@ let user_err ?loc ?hdr strm = Loc.raise ?loc (UserError (hdr, strm))
let invalid_arg ?loc s = Loc.raise ?loc (Invalid_argument s)
-exception AlreadyDeclared of std_ppcmds (* for already declared Schemes *)
+exception AlreadyDeclared of Pp.t (* for already declared Schemes *)
let alreadydeclared pps = raise (AlreadyDeclared(pps))
exception Timeout
diff --git a/lib/cErrors.mli b/lib/cErrors.mli
index ca0838575..f3253979f 100644
--- a/lib/cErrors.mli
+++ b/lib/cErrors.mli
@@ -6,8 +6,6 @@
(* * GNU Lesser General Public License Version 2.1 *)
(***********************************************************************)
-open Pp
-
(** This modules implements basic manipulations of errors for use
throughout Coq's code. *)
@@ -21,10 +19,10 @@ val push : exn -> Exninfo.iexn
[Anomaly] is used for system errors and [UserError] for the
user's ones. *)
-val make_anomaly : ?label:string -> std_ppcmds -> exn
+val make_anomaly : ?label:string -> Pp.t -> exn
(** Create an anomaly. *)
-val anomaly : ?loc:Loc.t -> ?label:string -> std_ppcmds -> 'a
+val anomaly : ?loc:Loc.t -> ?label:string -> Pp.t -> 'a
(** Raise an anomaly, with an optional location and an optional
label identifying the anomaly. *)
@@ -33,16 +31,16 @@ val is_anomaly : exn -> bool
This is mostly provided for compatibility. Please avoid doing specific
tricks with anomalies thanks to it. See rather [noncritical] below. *)
-exception UserError of string option * std_ppcmds
+exception UserError of string option * Pp.t
(** Main error signaling exception. It carries a header plus a pretty printing
doc *)
-val user_err : ?loc:Loc.t -> ?hdr:string -> std_ppcmds -> 'a
+val user_err : ?loc:Loc.t -> ?hdr:string -> Pp.t -> 'a
(** Main error raising primitive. [user_err ?loc ?hdr pp] signals an
error [pp] with optional header and location [hdr] [loc] *)
-exception AlreadyDeclared of std_ppcmds
-val alreadydeclared : std_ppcmds -> 'a
+exception AlreadyDeclared of Pp.t
+val alreadydeclared : Pp.t -> 'a
val invalid_arg : ?loc:Loc.t -> string -> 'a
@@ -74,16 +72,16 @@ exception Quit
exception Unhandled
-val register_handler : (exn -> Pp.std_ppcmds) -> unit
+val register_handler : (exn -> Pp.t) -> unit
(** The standard exception printer *)
-val print : ?info:Exninfo.info -> exn -> Pp.std_ppcmds
-val iprint : Exninfo.iexn -> Pp.std_ppcmds
+val print : ?info:Exninfo.info -> exn -> Pp.t
+val iprint : Exninfo.iexn -> Pp.t
(** Same as [print], except that the "Please report" part of an anomaly
isn't printed (used in Ltac debugging). *)
-val print_no_report : exn -> Pp.std_ppcmds
-val iprint_no_report : Exninfo.iexn -> Pp.std_ppcmds
+val print_no_report : exn -> Pp.t
+val iprint_no_report : Exninfo.iexn -> Pp.t
(** Critical exceptions should not be caught and ignored by mistake
by inner functions during a [vernacinterp]. They should be handled
@@ -100,9 +98,9 @@ val handled : exn -> bool
val error : string -> 'a
[@@ocaml.deprecated "use [user_err] instead"]
-val errorlabstrm : string -> std_ppcmds -> 'a
+val errorlabstrm : string -> Pp.t -> 'a
[@@ocaml.deprecated "use [user_err ~hdr] instead"]
-val user_err_loc : Loc.t * string * std_ppcmds -> 'a
+val user_err_loc : Loc.t * string * Pp.t -> 'a
[@@ocaml.deprecated "use [user_err ~loc] instead"]
diff --git a/lib/cWarnings.mli b/lib/cWarnings.mli
index 0622d7593..ba152a19b 100644
--- a/lib/cWarnings.mli
+++ b/lib/cWarnings.mli
@@ -11,7 +11,7 @@ type status = Disabled | Enabled | AsError
val set_current_loc : Loc.t option -> unit
val create : name:string -> category:string -> ?default:status ->
- ('a -> Pp.std_ppcmds) -> ?loc:Loc.t -> 'a -> unit
+ ('a -> Pp.t) -> ?loc:Loc.t -> 'a -> unit
val get_flags : unit -> string
val set_flags : string -> unit
diff --git a/lib/explore.ml b/lib/explore.ml
index 1919af51e..7da077e96 100644
--- a/lib/explore.ml
+++ b/lib/explore.ml
@@ -14,7 +14,7 @@ module type SearchProblem = sig
type state
val branching : state -> state list
val success : state -> bool
- val pp : state -> std_ppcmds
+ val pp : state -> Pp.t
end
module Make = functor(S : SearchProblem) -> struct
diff --git a/lib/explore.mli b/lib/explore.mli
index 3c31d0766..5875246ff 100644
--- a/lib/explore.mli
+++ b/lib/explore.mli
@@ -27,7 +27,7 @@ module type SearchProblem = sig
val success : state -> bool
- val pp : state -> Pp.std_ppcmds
+ val pp : state -> Pp.t
end
diff --git a/lib/feedback.ml b/lib/feedback.ml
index ed1d495d7..54d16a9be 100644
--- a/lib/feedback.ml
+++ b/lib/feedback.ml
@@ -32,7 +32,7 @@ type feedback_content =
(* Extra metadata *)
| Custom of Loc.t option * string * xml
(* Generic messages *)
- | Message of level * Loc.t option * Pp.std_ppcmds
+ | Message of level * Loc.t option * Pp.t
type feedback = {
id : Stateid.t;
diff --git a/lib/feedback.mli b/lib/feedback.mli
index bd3316abb..45a02d384 100644
--- a/lib/feedback.mli
+++ b/lib/feedback.mli
@@ -40,7 +40,7 @@ type feedback_content =
(* Extra metadata *)
| Custom of Loc.t option * string * xml
(* Generic messages *)
- | Message of level * Loc.t option * Pp.std_ppcmds
+ | Message of level * Loc.t option * Pp.t
type feedback = {
id : Stateid.t; (* The document part concerned *)
@@ -78,20 +78,20 @@ relaxed. *)
(* Should we advertise these functions more? Should they be the ONLY
allowed way to output something? *)
-val msg_info : ?loc:Loc.t -> Pp.std_ppcmds -> unit
+val msg_info : ?loc:Loc.t -> Pp.t -> unit
(** Message that displays information, usually in verbose mode, such as [Foobar
is defined] *)
-val msg_notice : ?loc:Loc.t -> Pp.std_ppcmds -> unit
+val msg_notice : ?loc:Loc.t -> Pp.t -> unit
(** Message that should be displayed, such as [Print Foo] or [Show Bar]. *)
-val msg_warning : ?loc:Loc.t -> Pp.std_ppcmds -> unit
+val msg_warning : ?loc:Loc.t -> Pp.t -> unit
(** Message indicating that something went wrong, but without serious
consequences. *)
-val msg_error : ?loc:Loc.t -> Pp.std_ppcmds -> unit
+val msg_error : ?loc:Loc.t -> Pp.t -> unit
(** Message indicating that something went really wrong, though still
recoverable; otherwise an exception would have been raised. *)
-val msg_debug : ?loc:Loc.t -> Pp.std_ppcmds -> unit
+val msg_debug : ?loc:Loc.t -> Pp.t -> unit
(** For debugging purposes *)
diff --git a/lib/flags.ml b/lib/flags.ml
index 0bce22f58..d4be81c61 100644
--- a/lib/flags.ml
+++ b/lib/flags.ml
@@ -87,8 +87,6 @@ let in_toplevel = ref false
let profile = false
-let xml_export = ref false
-
let ide_slave = ref false
let ideslave_coqtop_flags = ref None
@@ -96,7 +94,6 @@ let time = ref false
let raw_print = ref false
-
let univ_print = ref false
let we_are_parsing = ref false
@@ -167,9 +164,9 @@ let use_polymorphic_flag () =
let make_polymorphic_flag b =
local_polymorphic_flag := Some b
-let inductive_cumulativity = ref false
-let make_inductive_cumulativity b = inductive_cumulativity := b
-let is_inductive_cumulativity () = !inductive_cumulativity
+let polymorphic_inductive_cumulativity = ref false
+let make_polymorphic_inductive_cumulativity b = polymorphic_inductive_cumulativity := b
+let is_polymorphic_inductive_cumulativity () = !polymorphic_inductive_cumulativity
(** [program_mode] tells that Program mode has been activated, either
globally via [Set Program] or locally via the Program command prefix. *)
diff --git a/lib/flags.mli b/lib/flags.mli
index eb4c37a54..3024c6039 100644
--- a/lib/flags.mli
+++ b/lib/flags.mli
@@ -56,11 +56,6 @@ val stm_debug : bool ref
val profile : bool
-(* Legacy flags *)
-
-(* -xml option: xml hooks will be called *)
-val xml_export : bool ref
-
(* -ide_slave: printing will be more verbose, will affect stm caching *)
val ide_slave : bool ref
val ideslave_coqtop_flags : string option ref
@@ -119,9 +114,9 @@ val is_universe_polymorphism : unit -> bool
val make_polymorphic_flag : bool -> unit
val use_polymorphic_flag : unit -> bool
-(** Global inductive cumulativity flag. *)
-val make_inductive_cumulativity : bool -> unit
-val is_inductive_cumulativity : unit -> bool
+(** Global polymorphic inductive cumulativity flag. *)
+val make_polymorphic_inductive_cumulativity : bool -> unit
+val is_polymorphic_inductive_cumulativity : unit -> bool
val warn : bool ref
val make_warn : bool -> unit
diff --git a/lib/future.mli b/lib/future.mli
index ce9155657..acfce51a0 100644
--- a/lib/future.mli
+++ b/lib/future.mli
@@ -154,7 +154,7 @@ val purify : ('a -> 'b) -> 'a -> 'b
val transactify : ('a -> 'b) -> 'a -> 'b
(** Debug: print a computation given an inner printing function. *)
-val print : ('a -> Pp.std_ppcmds) -> 'a computation -> Pp.std_ppcmds
+val print : ('a -> Pp.t) -> 'a computation -> Pp.t
type freeze
(* These functions are needed to get rid of side effects.
@@ -162,5 +162,5 @@ type freeze
deal with the whole system state. *)
val set_freeze : (unit -> freeze) -> (freeze -> unit) -> unit
-val customize_not_ready_msg : (string -> Pp.std_ppcmds) -> unit
-val customize_not_here_msg : (string -> Pp.std_ppcmds) -> unit
+val customize_not_ready_msg : (string -> Pp.t) -> unit
+val customize_not_here_msg : (string -> Pp.t) -> unit
diff --git a/lib/genarg.ml b/lib/genarg.ml
index 1174cfe10..b78fe4037 100644
--- a/lib/genarg.ml
+++ b/lib/genarg.ml
@@ -58,7 +58,7 @@ fun t1 t2 -> match t1, t2 with
end
| _ -> None
-let rec pr_genarg_type : type a b c. (a, b, c) genarg_type -> std_ppcmds = function
+let rec pr_genarg_type : type a b c. (a, b, c) genarg_type -> Pp.t = function
| ListArg t -> pr_genarg_type t ++ spc () ++ str "list"
| OptArg t -> pr_genarg_type t ++ spc () ++ str "opt"
| PairArg (t1, t2) ->
diff --git a/lib/genarg.mli b/lib/genarg.mli
index d7f24eac1..7fa71299e 100644
--- a/lib/genarg.mli
+++ b/lib/genarg.mli
@@ -146,7 +146,7 @@ val abstract_argument_type_eq :
('a, 'l) abstract_argument_type -> ('b, 'l) abstract_argument_type ->
('a, 'b) CSig.eq option
-val pr_argument_type : argument_type -> Pp.std_ppcmds
+val pr_argument_type : argument_type -> Pp.t
(** Print a human-readable representation for a given type. *)
val genarg_tag : 'a generic_argument -> argument_type
diff --git a/lib/minisys.ml b/lib/minisys.ml
index 1ed017e48..706f0430c 100644
--- a/lib/minisys.ml
+++ b/lib/minisys.ml
@@ -44,11 +44,13 @@ let ok_dirname f =
(* Check directory can be opened *)
let exists_dir dir =
+ (* See BZ#5391 on windows failing on a trailing (back)slash *)
let rec strip_trailing_slash dir =
let len = String.length dir in
if len > 0 && (dir.[len-1] = '/' || dir.[len-1] = '\\')
then strip_trailing_slash (String.sub dir 0 (len-1)) else dir in
- try Sys.is_directory (strip_trailing_slash dir) with Sys_error _ -> false
+ let dir = if Sys.os_type = "Win32" then strip_trailing_slash dir else dir in
+ try Sys.is_directory dir with Sys_error _ -> false
let apply_subdir f path name =
(* we avoid all files and subdirs starting by '.' (e.g. .svn) *)
diff --git a/lib/pp.ml b/lib/pp.ml
index eccaa0928..88ddcb35b 100644
--- a/lib/pp.ml
+++ b/lib/pp.ml
@@ -39,7 +39,9 @@ type doc_view =
(* Following discussion on #390, we play on the safe side and make the
internal representation opaque here. *)
type t = doc_view
+
type std_ppcmds = t
+[@@ocaml.deprecated "alias of Pp.t"]
let repr x = x
let unrepr x = x
diff --git a/lib/pp.mli b/lib/pp.mli
index 96656c8b6..2d11cad86 100644
--- a/lib/pp.mli
+++ b/lib/pp.mli
@@ -10,7 +10,7 @@
(** Pretty printing guidelines ******************************************)
(* *)
-(* `Pp.t` or `Pp.std_ppcmds` is the main pretty printing document type *)
+(* `Pp.t` is the main pretty printing document type *)
(* in the Coq system. Documents are composed laying out boxes, and *)
(* users can add arbitrary tag metadata that backends are free *)
(* to interpret. *)
@@ -39,7 +39,9 @@ type pp_tag = string
(* Following discussion on #390, we play on the safe side and make the
internal representation opaque here. *)
type t
+
type std_ppcmds = t
+[@@ocaml.deprecated "alias of Pp.t"]
type block_type =
| Pp_hbox of int
@@ -58,127 +60,127 @@ type doc_view =
| Ppcmd_force_newline
| Ppcmd_comment of string list
-val repr : std_ppcmds -> doc_view
-val unrepr : doc_view -> std_ppcmds
+val repr : t -> doc_view
+val unrepr : doc_view -> t
(** {6 Formatting commands} *)
-val str : string -> std_ppcmds
-val brk : int * int -> std_ppcmds
-val fnl : unit -> std_ppcmds
-val ws : int -> std_ppcmds
-val mt : unit -> std_ppcmds
-val ismt : std_ppcmds -> bool
+val str : string -> t
+val brk : int * int -> t
+val fnl : unit -> t
+val ws : int -> t
+val mt : unit -> t
+val ismt : t -> bool
-val comment : string list -> std_ppcmds
+val comment : string list -> t
(** {6 Manipulation commands} *)
-val app : std_ppcmds -> std_ppcmds -> std_ppcmds
+val app : t -> t -> t
(** Concatenation. *)
-val seq : std_ppcmds list -> std_ppcmds
+val seq : t list -> t
(** Multi-Concatenation. *)
-val (++) : std_ppcmds -> std_ppcmds -> std_ppcmds
+val (++) : t -> t -> t
(** Infix alias for [app]. *)
(** {6 Derived commands} *)
-val spc : unit -> std_ppcmds
-val cut : unit -> std_ppcmds
-val align : unit -> std_ppcmds
-val int : int -> std_ppcmds
-val real : float -> std_ppcmds
-val bool : bool -> std_ppcmds
-val qstring : string -> std_ppcmds
-val qs : string -> std_ppcmds
-val quote : std_ppcmds -> std_ppcmds
-val strbrk : string -> std_ppcmds
+val spc : unit -> t
+val cut : unit -> t
+val align : unit -> t
+val int : int -> t
+val real : float -> t
+val bool : bool -> t
+val qstring : string -> t
+val qs : string -> t
+val quote : t -> t
+val strbrk : string -> t
(** {6 Boxing commands} *)
-val h : int -> std_ppcmds -> std_ppcmds
-val v : int -> std_ppcmds -> std_ppcmds
-val hv : int -> std_ppcmds -> std_ppcmds
-val hov : int -> std_ppcmds -> std_ppcmds
+val h : int -> t -> t
+val v : int -> t -> t
+val hv : int -> t -> t
+val hov : int -> t -> t
(** {6 Tagging} *)
-val tag : pp_tag -> std_ppcmds -> std_ppcmds
+val tag : pp_tag -> t -> t
(** {6 Printing combinators} *)
-val pr_comma : unit -> std_ppcmds
+val pr_comma : unit -> t
(** Well-spaced comma. *)
-val pr_semicolon : unit -> std_ppcmds
+val pr_semicolon : unit -> t
(** Well-spaced semicolon. *)
-val pr_bar : unit -> std_ppcmds
+val pr_bar : unit -> t
(** Well-spaced pipe bar. *)
-val pr_arg : ('a -> std_ppcmds) -> 'a -> std_ppcmds
+val pr_arg : ('a -> t) -> 'a -> t
(** Adds a space in front of its argument. *)
-val pr_non_empty_arg : ('a -> std_ppcmds) -> 'a -> std_ppcmds
+val pr_non_empty_arg : ('a -> t) -> 'a -> t
(** Adds a space in front of its argument if non empty. *)
-val pr_opt : ('a -> std_ppcmds) -> 'a option -> std_ppcmds
+val pr_opt : ('a -> t) -> 'a option -> t
(** Inner object preceded with a space if [Some], nothing otherwise. *)
-val pr_opt_no_spc : ('a -> std_ppcmds) -> 'a option -> std_ppcmds
+val pr_opt_no_spc : ('a -> t) -> 'a option -> t
(** Same as [pr_opt] but without the leading space. *)
-val pr_nth : int -> std_ppcmds
+val pr_nth : int -> t
(** Ordinal number with the correct suffix (i.e. "st", "nd", "th", etc.). *)
-val prlist : ('a -> std_ppcmds) -> 'a list -> std_ppcmds
+val prlist : ('a -> t) -> 'a list -> t
(** Concatenation of the list contents, without any separator.
Unlike all other functions below, [prlist] works lazily. If a strict
behavior is needed, use [prlist_strict] instead. *)
-val prlist_strict : ('a -> std_ppcmds) -> 'a list -> std_ppcmds
+val prlist_strict : ('a -> t) -> 'a list -> t
(** Same as [prlist], but strict. *)
val prlist_with_sep :
- (unit -> std_ppcmds) -> ('a -> std_ppcmds) -> 'a list -> std_ppcmds
+ (unit -> t) -> ('a -> t) -> 'a list -> t
(** [prlist_with_sep sep pr [a ; ... ; c]] outputs
[pr a ++ sep () ++ ... ++ sep () ++ pr c].
where the thunk sep is memoized, rather than being called each place
its result is used.
*)
-val prvect : ('a -> std_ppcmds) -> 'a array -> std_ppcmds
+val prvect : ('a -> t) -> 'a array -> t
(** As [prlist], but on arrays. *)
-val prvecti : (int -> 'a -> std_ppcmds) -> 'a array -> std_ppcmds
+val prvecti : (int -> 'a -> t) -> 'a array -> t
(** Indexed version of [prvect]. *)
val prvect_with_sep :
- (unit -> std_ppcmds) -> ('a -> std_ppcmds) -> 'a array -> std_ppcmds
+ (unit -> t) -> ('a -> t) -> 'a array -> t
(** As [prlist_with_sep], but on arrays. *)
val prvecti_with_sep :
- (unit -> std_ppcmds) -> (int -> 'a -> std_ppcmds) -> 'a array -> std_ppcmds
+ (unit -> t) -> (int -> 'a -> t) -> 'a array -> t
(** Indexed version of [prvect_with_sep]. *)
-val pr_enum : ('a -> std_ppcmds) -> 'a list -> std_ppcmds
+val pr_enum : ('a -> t) -> 'a list -> t
(** [pr_enum pr [a ; b ; ... ; c]] outputs
[pr a ++ str "," ++ pr b ++ str "," ++ ... ++ str "and" ++ pr c]. *)
-val pr_sequence : ('a -> std_ppcmds) -> 'a list -> std_ppcmds
+val pr_sequence : ('a -> t) -> 'a list -> t
(** Sequence of objects separated by space (unless an element is empty). *)
-val surround : std_ppcmds -> std_ppcmds
+val surround : t -> t
(** Surround with parenthesis. *)
-val pr_vertical_list : ('b -> std_ppcmds) -> 'b list -> std_ppcmds
+val pr_vertical_list : ('b -> t) -> 'b list -> t
(** {6 Main renderers, to formatter and to string } *)
(** [pp_with fmt pp] Print [pp] to [fmt] and don't flush [fmt] *)
-val pp_with : Format.formatter -> std_ppcmds -> unit
+val pp_with : Format.formatter -> t -> unit
-val string_of_ppcmds : std_ppcmds -> string
+val string_of_ppcmds : t -> string
diff --git a/lib/rtree.mli b/lib/rtree.mli
index a1b06f38e..1a916bbaf 100644
--- a/lib/rtree.mli
+++ b/lib/rtree.mli
@@ -78,7 +78,7 @@ val map : ('a -> 'b) -> 'a t -> 'b t
val smartmap : ('a -> 'a) -> 'a t -> 'a t
(** A rather simple minded pretty-printer *)
-val pp_tree : ('a -> Pp.std_ppcmds) -> 'a t -> Pp.std_ppcmds
+val pp_tree : ('a -> Pp.t) -> 'a t -> Pp.t
val eq_rtree : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
(** @deprecated Same as [Rtree.equal] *)
diff --git a/lib/system.mli b/lib/system.mli
index 5f800f191..7281de97c 100644
--- a/lib/system.mli
+++ b/lib/system.mli
@@ -96,7 +96,7 @@ type time
val get_time : unit -> time
val time_difference : time -> time -> float (** in seconds *)
-val fmt_time_difference : time -> time -> Pp.std_ppcmds
+val fmt_time_difference : time -> time -> Pp.t
val with_time : bool -> ('a -> 'b) -> 'a -> 'b
diff --git a/library/declaremods.ml b/library/declaremods.ml
index e7aa5bd0d..6d9295bde 100644
--- a/library/declaremods.ml
+++ b/library/declaremods.ml
@@ -557,17 +557,6 @@ let openmodtype_info =
Summary.ref ([] : module_type_body list) ~name:"MODTYPE-INFO"
-(** XML output hooks *)
-
-let (f_xml_declare_module, xml_declare_module) = Hook.make ~default:ignore ()
-let (f_xml_start_module, xml_start_module) = Hook.make ~default:ignore ()
-let (f_xml_end_module, xml_end_module) = Hook.make ~default:ignore ()
-let (f_xml_declare_module_type, xml_declare_module_type) = Hook.make ~default:ignore ()
-let (f_xml_start_module_type, xml_start_module_type) = Hook.make ~default:ignore ()
-let (f_xml_end_module_type, xml_end_module_type) = Hook.make ~default:ignore ()
-
-let if_xml f x = if !Flags.xml_export then f x else ()
-
(** {6 Modules : start, end, declare} *)
module RawModOps = struct
@@ -589,7 +578,6 @@ let start_module interp_modast export id args res fs =
openmod_info := { cur_typ = res_entry_o; cur_typs = subtyps };
let prefix = Lib.start_module export id mp fs in
Nametab.push_dir (Nametab.Until 1) (fst prefix) (DirOpenModule prefix);
- if_xml (Hook.get f_xml_start_module) mp;
mp
let end_module () =
@@ -628,7 +616,6 @@ let end_module () =
assert (eq_full_path (fst newoname) (fst oldoname));
assert (ModPath.equal (mp_of_kn (snd newoname)) mp);
- if_xml (Hook.get f_xml_end_module) mp;
mp
let declare_module interp_modast id args res mexpr_o fs =
@@ -682,7 +669,6 @@ let declare_module interp_modast id args res mexpr_o fs =
let sobjs = subst_sobjs (map_mp mp0 mp resolver) sobjs in
ignore (Lib.add_leaf id (in_module sobjs));
- if_xml (Hook.get f_xml_declare_module) mp;
mp
end
@@ -699,7 +685,6 @@ let start_modtype interp_modast id args mtys fs =
openmodtype_info := sub_mty_l;
let prefix = Lib.start_modtype id mp fs in
Nametab.push_dir (Nametab.Until 1) (fst prefix) (DirOpenModtype prefix);
- if_xml (Hook.get f_xml_start_module_type) mp;
mp
let end_modtype () =
@@ -716,7 +701,6 @@ let end_modtype () =
assert (eq_full_path (fst oname) (fst oldoname));
assert (ModPath.equal (mp_of_kn (snd oname)) mp);
- if_xml (Hook.get f_xml_end_module_type) mp;
mp
let declare_modtype interp_modast id args mtys (mty,ann) fs =
@@ -750,7 +734,6 @@ let declare_modtype interp_modast id args mtys (mty,ann) fs =
check_subtypes_mt mp sub_mty_l;
ignore (Lib.add_leaf id (in_modtype sobjs));
- if_xml (Hook.get f_xml_declare_module_type) mp;
mp
end
diff --git a/library/declaremods.mli b/library/declaremods.mli
index 1f2aaf7b5..9d750b616 100644
--- a/library/declaremods.mli
+++ b/library/declaremods.mli
@@ -63,14 +63,6 @@ val start_modtype :
val end_modtype : unit -> module_path
-(** Hooks for XML output *)
-val xml_declare_module : (module_path -> unit) Hook.t
-val xml_start_module : (module_path -> unit) Hook.t
-val xml_end_module : (module_path -> unit) Hook.t
-val xml_declare_module_type : (module_path -> unit) Hook.t
-val xml_start_module_type : (module_path -> unit) Hook.t
-val xml_end_module_type : (module_path -> unit) Hook.t
-
(** {6 Libraries i.e. modules on disk } *)
type library_name = DirPath.t
@@ -121,7 +113,7 @@ val iter_all_segments :
(Libnames.object_name -> Libobject.obj -> unit) -> unit
-val debug_print_modtab : unit -> Pp.std_ppcmds
+val debug_print_modtab : unit -> Pp.t
(** For printing modules, [process_module_binding] adds names of
bound module (and its components) to Nametab. It also loads
diff --git a/library/goptions.ml b/library/goptions.ml
index fe014ef68..184c6fa11 100644
--- a/library/goptions.ml
+++ b/library/goptions.ml
@@ -57,10 +57,10 @@ module MakeTable =
val table : (string * key table_of_A) list ref
val encode : key -> t
val subst : substitution -> t -> t
- val printer : t -> std_ppcmds
+ val printer : t -> Pp.t
val key : option_name
val title : string
- val member_message : t -> bool -> std_ppcmds
+ val member_message : t -> bool -> Pp.t
end) ->
struct
type option_mark =
@@ -131,7 +131,7 @@ module type StringConvertArg =
sig
val key : option_name
val title : string
- val member_message : string -> bool -> std_ppcmds
+ val member_message : string -> bool -> Pp.t
end
module StringConvert = functor (A : StringConvertArg) ->
@@ -161,10 +161,10 @@ sig
val compare : t -> t -> int
val encode : reference -> t
val subst : substitution -> t -> t
- val printer : t -> std_ppcmds
+ val printer : t -> Pp.t
val key : option_name
val title : string
- val member_message : t -> bool -> std_ppcmds
+ val member_message : t -> bool -> Pp.t
end
module RefConvert = functor (A : RefConvertArg) ->
diff --git a/library/goptions.mli b/library/goptions.mli
index 3100c1ce7..cec7250f1 100644
--- a/library/goptions.mli
+++ b/library/goptions.mli
@@ -43,7 +43,6 @@
All options are synchronized with the document.
*)
-open Pp
open Libnames
open Mod_subst
@@ -64,7 +63,7 @@ module MakeStringTable :
(A : sig
val key : option_name
val title : string
- val member_message : string -> bool -> std_ppcmds
+ val member_message : string -> bool -> Pp.t
end) ->
sig
val active : string -> bool
@@ -88,10 +87,10 @@ module MakeRefTable :
val compare : t -> t -> int
val encode : reference -> t
val subst : substitution -> t -> t
- val printer : t -> std_ppcmds
+ val printer : t -> Pp.t
val key : option_name
val title : string
- val member_message : t -> bool -> std_ppcmds
+ val member_message : t -> bool -> Pp.t
end) ->
sig
val active : A.t -> bool
@@ -177,6 +176,6 @@ type option_state = {
}
val get_tables : unit -> option_state OptionMap.t
-val print_tables : unit -> std_ppcmds
+val print_tables : unit -> Pp.t
val error_undeclared_key : option_name -> 'a
diff --git a/library/keys.mli b/library/keys.mli
index 6fe9efc6e..d5dc0e2a1 100644
--- a/library/keys.mli
+++ b/library/keys.mli
@@ -19,5 +19,5 @@ val equiv_keys : key -> key -> bool
val constr_key : ('a -> ('a, 't, 'u, 'i) Constr.kind_of_term) -> 'a -> key option
(** Compute the head key of a term. *)
-val pr_keys : (global_reference -> Pp.std_ppcmds) -> Pp.std_ppcmds
+val pr_keys : (global_reference -> Pp.t) -> Pp.t
(** Pretty-print the mapping *)
diff --git a/library/lib.ml b/library/lib.ml
index a24d20c68..5418003eb 100644
--- a/library/lib.ml
+++ b/library/lib.ml
@@ -162,6 +162,13 @@ let find_entry_p p =
in
find !lib_state.lib_stk
+let find_entries_p p =
+ let rec find = function
+ | [] -> []
+ | ent::l -> if p ent then ent::find l else find l
+ in
+ find !lib_state.lib_stk
+
let split_lib_gen test =
let rec collect after equal = function
| hd::before when test hd -> collect after (hd::equal) before
@@ -328,16 +335,18 @@ let start_compilation s mp =
lib_state := { !lib_state with comp_name = Some s;
path_prefix = prefix }
+let open_blocks_message es =
+ let open_block_name = function
+ | oname, OpenedSection _ -> str "section " ++ pr_id (basename (fst oname))
+ | oname, OpenedModule (ty,_,_,_) -> str (module_kind ty) ++ spc () ++ pr_id (basename (fst oname))
+ | _ -> assert false in
+ str "The " ++ pr_enum open_block_name es ++ spc () ++
+ str "need" ++ str (if List.length es == 1 then "s" else "") ++ str " to be closed."
+
let end_compilation_checks dir =
- let _ =
- try match snd (find_entry_p is_opening_node) with
- | OpenedSection _ -> user_err Pp.(str "There are some open sections.")
- | OpenedModule (ty,_,_,_) ->
- user_err ~hdr:"Lib.end_compilation_checks"
- (str "There are some open " ++ str (module_kind ty) ++ str "s.")
- | _ -> assert false
- with Not_found -> ()
- in
+ let _ = match find_entries_p is_opening_node with
+ | [] -> ()
+ | es -> user_err ~hdr:"Lib.end_compilation_checks" (open_blocks_message es) in
let is_opening_lib = function _,CompilingLibrary _ -> true | _ -> false
in
let oname =
@@ -512,11 +521,6 @@ let is_in_section ref =
(*************)
(* Sections. *)
-
-(* XML output hooks *)
-let (f_xml_open_section, xml_open_section) = Hook.make ~default:ignore ()
-let (f_xml_close_section, xml_close_section) = Hook.make ~default:ignore ()
-
let open_section id =
let olddir,(mp,oldsec) = !lib_state.path_prefix in
let dir = add_dirpath_suffix olddir id in
@@ -528,7 +532,6 @@ let open_section id =
(*Pushed for the lifetime of the section: removed by unfrozing the summary*)
Nametab.push_dir (Nametab.Until 1) dir (DirOpenSection prefix);
lib_state := { !lib_state with path_prefix = prefix };
- if !Flags.xml_export then Hook.get f_xml_open_section id;
add_section ()
@@ -556,7 +559,6 @@ let close_section () =
let full_olddir = fst !lib_state.path_prefix in
pop_path_prefix ();
add_entry oname (ClosedSection (List.rev (mark::secdecls)));
- if !Flags.xml_export then Hook.get f_xml_close_section (basename (fst oname));
let newdecls = List.map discharge_item secdecls in
Summary.unfreeze_summaries fs;
List.iter (Option.iter (fun (id,o) -> add_discharged_leaf id o)) newdecls;
diff --git a/library/lib.mli b/library/lib.mli
index f1c9bfca2..3dcec1d53 100644
--- a/library/lib.mli
+++ b/library/lib.mli
@@ -150,10 +150,6 @@ val unfreeze : frozen -> unit
val init : unit -> unit
-(** XML output hooks *)
-val xml_open_section : (Names.Id.t -> unit) Hook.t
-val xml_close_section : (Names.Id.t -> unit) Hook.t
-
(** {6 Section management for discharge } *)
type variable_info = Context.Named.Declaration.t * Decl_kinds.binding_kind
type variable_context = variable_info list
@@ -165,7 +161,7 @@ val named_of_variable_context : variable_context -> Context.Named.t
val section_segment_of_constant : Names.constant -> abstr_info
val section_segment_of_mutual_inductive: Names.mutual_inductive -> abstr_info
val variable_section_segment_of_reference : Globnames.global_reference -> variable_context
-
+
val section_instance : Globnames.global_reference -> Univ.universe_instance * Names.Id.t array
val is_in_section : Globnames.global_reference -> bool
diff --git a/library/libnames.mli b/library/libnames.mli
index b6d6f7f3b..1b351290a 100644
--- a/library/libnames.mli
+++ b/library/libnames.mli
@@ -7,14 +7,13 @@
(************************************************************************)
open Util
-open Pp
open Loc
open Names
(** {6 Dirpaths } *)
(** FIXME: ought to be in Names.dir_path *)
-val pr_dirpath : DirPath.t -> Pp.std_ppcmds
+val pr_dirpath : DirPath.t -> Pp.t
val dirpath_of_string : string -> DirPath.t
val string_of_dirpath : DirPath.t -> string
@@ -58,7 +57,7 @@ val basename : full_path -> Id.t
(** Parsing and printing of section path as ["coq_root.module.id"] *)
val path_of_string : string -> full_path
val string_of_path : full_path -> string
-val pr_path : full_path -> std_ppcmds
+val pr_path : full_path -> Pp.t
module Spmap : CSig.MapS with type key = full_path
@@ -77,7 +76,7 @@ val repr_qualid : qualid -> DirPath.t * Id.t
val qualid_eq : qualid -> qualid -> bool
-val pr_qualid : qualid -> std_ppcmds
+val pr_qualid : qualid -> Pp.t
val string_of_qualid : qualid -> string
val qualid_of_string : string -> qualid
@@ -124,7 +123,7 @@ type reference =
val eq_reference : reference -> reference -> bool
val qualid_of_reference : reference -> qualid located
val string_of_reference : reference -> string
-val pr_reference : reference -> std_ppcmds
+val pr_reference : reference -> Pp.t
val loc_of_reference : reference -> Loc.t option
val join_reference : reference -> reference -> reference
diff --git a/library/library.ml b/library/library.ml
index 20ecc2c22..28afa054e 100644
--- a/library/library.ml
+++ b/library/library.ml
@@ -551,8 +551,6 @@ let in_require : require_obj -> obj =
(* Require libraries, import them if [export <> None], mark them for export
if [export = Some true] *)
-let (f_xml_require, xml_require) = Hook.make ~default:ignore ()
-
let warn_require_in_module =
CWarnings.create ~name:"require-in-module" ~category:"deprecated"
(fun () -> strbrk "Require inside a module is" ++
@@ -574,7 +572,6 @@ let require_library_from_dirpath modrefl export =
end
else
add_anonymous_leaf (in_require (needed,modrefl,export));
- if !Flags.xml_export then List.iter (Hook.get f_xml_require) modrefl;
()
(* the function called by Vernacentries.vernac_import *)
diff --git a/library/library.mli b/library/library.mli
index 604167804..6c624ce52 100644
--- a/library/library.mli
+++ b/library/library.mli
@@ -67,9 +67,6 @@ val library_full_filename : DirPath.t -> string
(** - Overwrite the filename of all libraries (used when restoring a state) *)
val overwrite_library_filenames : string -> unit
-(** {6 Hook for the xml exportation of libraries } *)
-val xml_require : (DirPath.t -> unit) Hook.t
-
(** {6 Locate a library in the load paths } *)
exception LibUnmappedDir
exception LibNotFound
diff --git a/library/nameops.mli b/library/nameops.mli
index 88290f485..89aba2447 100644
--- a/library/nameops.mli
+++ b/library/nameops.mli
@@ -106,13 +106,13 @@ val name_max : Name.t -> Name.t -> Name.t
val name_cons : Name.t -> Id.t list -> Id.t list
(** @deprecated Same as [Name.cons] *)
-val pr_name : Name.t -> Pp.std_ppcmds
+val pr_name : Name.t -> Pp.t
(** @deprecated Same as [Name.print] *)
-val pr_id : Id.t -> Pp.std_ppcmds
+val pr_id : Id.t -> Pp.t
(** @deprecated Same as [Names.Id.print] *)
-val pr_lab : Label.t -> Pp.std_ppcmds
+val pr_lab : Label.t -> Pp.t
(** some preset paths *)
@@ -127,5 +127,5 @@ val coq_string : string (** "Coq" *)
val default_root_prefix : DirPath.t
(** Metavariables *)
-val pr_meta : Term.metavariable -> Pp.std_ppcmds
+val pr_meta : Term.metavariable -> Pp.t
val string_of_meta : Term.metavariable -> string
diff --git a/library/nametab.mli b/library/nametab.mli
index be57f5dcc..025a63b1c 100644
--- a/library/nametab.mli
+++ b/library/nametab.mli
@@ -6,7 +6,6 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-open Pp
open Names
open Libnames
open Globnames
@@ -155,7 +154,7 @@ val basename_of_global : global_reference -> Id.t
(** Printing of global references using names as short as possible.
@raise Not_found when the reference is not in the global tables. *)
-val pr_global_env : Id.Set.t -> global_reference -> std_ppcmds
+val pr_global_env : Id.Set.t -> global_reference -> Pp.t
(** The [shortest_qualid] functions given an object with [user_name]
diff --git a/man/coqide.1 b/man/coqide.1
index f82bf2ad4..3592f6e4e 100644
--- a/man/coqide.1
+++ b/man/coqide.1
@@ -123,13 +123,6 @@ Set sort Set impredicative.
.TP
.B \-dont\-load\-proofs
Don't load opaque proofs in memory.
-.TP
-.B \-xml
-Export XML files either to the hierarchy rooted in
-the directory
-.B COQ_XML_LIBRARY_ROOT
-(if set) or to stdout (if unset).
-
.SH SEE ALSO
diff --git a/man/coqtop.1 b/man/coqtop.1
index feee7fd8b..62d17aa67 100644
--- a/man/coqtop.1
+++ b/man/coqtop.1
@@ -153,12 +153,6 @@ set sort Set impredicative
.B \-dont\-load\-proofs
don't load opaque proofs in memory
-.TP
-.B \-xml
-export XML files either to the hierarchy rooted in
-the directory $COQ_XML_LIBRARY_ROOT (if set) or to
-stdout (if unset)
-
.SH SEE ALSO
.BR coqc (1),
diff --git a/parsing/cLexer.ml4 b/parsing/cLexer.ml4
index 5fcbb43b6..636027f9b 100644
--- a/parsing/cLexer.ml4
+++ b/parsing/cLexer.ml4
@@ -368,9 +368,6 @@ let rec string loc ~comm_level bp len = parser
let loc = set_loc_pos loc bp ep in
err loc Unterminated_string
-(* Hook for exporting comment into xml theory files *)
-let (f_xml_output_comment, xml_output_comment) = Hook.make ~default:ignore ()
-
(* To associate locations to a file name *)
let current_file = ref None
@@ -432,9 +429,6 @@ let null_comment s =
let comment_stop ep =
let current_s = Buffer.contents current_comment in
- if !Flags.xml_export && Buffer.length current_comment > 0 &&
- (!between_commands || not(null_comment current_s)) then
- Hook.get f_xml_output_comment current_s;
(if !Flags.beautify && Buffer.length current_comment > 0 &&
(!between_commands || not(null_comment current_s)) then
let bp = match !comment_begin with
diff --git a/parsing/cLexer.mli b/parsing/cLexer.mli
index 09c9d8ee4..77d652b18 100644
--- a/parsing/cLexer.mli
+++ b/parsing/cLexer.mli
@@ -19,9 +19,6 @@ val get_keyword_state : unit -> keyword_state
val check_ident : string -> unit
val is_ident : string -> bool
val check_keyword : string -> unit
-
-val xml_output_comment : (string -> unit) Hook.t
-
val terminal : string -> Tok.t
(** The lexer of Coq: *)
diff --git a/parsing/egramcoq.ml b/parsing/egramcoq.ml
index d4043f31e..870137ca1 100644
--- a/parsing/egramcoq.ml
+++ b/parsing/egramcoq.ml
@@ -354,7 +354,7 @@ type (_, _) ty_symbol =
type ('self, _, 'r) ty_rule =
| TyStop : ('self, 'r, 'r) ty_rule
| TyNext : ('self, 'a, 'r) ty_rule * ('self, 'b) ty_symbol -> ('self, 'b -> 'a, 'r) ty_rule
-| TyMark : int * bool * ('self, 'a, 'r) ty_rule -> ('self, 'a, 'r) ty_rule
+| TyMark : int * bool * int * ('self, 'a, 'r) ty_rule -> ('self, 'a, 'r) ty_rule
type 'r gen_eval = Loc.t -> 'r env -> 'r
@@ -368,18 +368,27 @@ let rec ty_eval : type s a. (s, a, Loc.t -> s) ty_rule -> s gen_eval -> s env ->
| TyNext (rem, TyNonTerm (forpat, e, _, true)) ->
fun f env v ->
ty_eval rem f (push_item forpat e env v)
-| TyMark (n, b, rem) ->
+| TyMark (n, b, p, rem) ->
fun f env ->
let heads, constrs = List.chop n env.constrs in
- let constrlists =
- if b then (heads @ List.hd env.constrlists) :: List.tl env.constrlists
- else heads :: env.constrlists
+ let constrlists, constrs =
+ if b then
+ (* We rearrange constrs = c1..cn rem and constrlists = [d1..dr e1..ep] rem' into
+ constrs = e1..ep rem and constrlists [c1..cn d1..dr] rem' *)
+ let constrlist = List.hd env.constrlists in
+ let constrlist, tail = List.chop (List.length constrlist - p) constrlist in
+ (heads @ constrlist) :: List.tl env.constrlists, tail @ constrs
+ else
+ (* We rearrange constrs = c1..cn e1..ep rem into
+ constrs = e1..ep rem and add a constr list [c1..cn] *)
+ let constrlist, tail = List.chop (n - p) heads in
+ constrlist :: env.constrlists, tail @ constrs
in
ty_eval rem f { env with constrs; constrlists; }
let rec ty_erase : type s a r. (s, a, r) ty_rule -> (s, a, r) Extend.rule = function
| TyStop -> Stop
-| TyMark (_, _, r) -> ty_erase r
+| TyMark (_, _, _, r) -> ty_erase r
| TyNext (rem, TyTerm tok) -> Next (ty_erase rem, Atoken tok)
| TyNext (rem, TyNonTerm (_, _, s, _)) -> Next (ty_erase rem, s)
@@ -398,9 +407,9 @@ let make_ty_rule assoc from forpat prods =
let s = symbol_of_entry assoc from e in
let bind = match var with None -> false | Some _ -> true in
AnyTyRule (TyNext (r, TyNonTerm (forpat, e, s, bind)))
- | GramConstrListMark (n, b) :: rem ->
+ | GramConstrListMark (n, b, p) :: rem ->
let AnyTyRule r = make_ty_rule rem in
- AnyTyRule (TyMark (n, b, r))
+ AnyTyRule (TyMark (n, b, p, r))
in
make_ty_rule (List.rev prods)
@@ -434,7 +443,7 @@ let make_act : type r. r target -> _ -> r gen_eval = function
CAst.make ~loc @@ CPatNotation (notation, env, [])
let extend_constr state forpat ng =
- let n = ng.notgram_level in
+ let n,_,_ = ng.notgram_level in
let assoc = ng.notgram_assoc in
let (entry, level) = interp_constr_entry_key forpat n in
let fold (accu, state) pt =
@@ -455,7 +464,7 @@ let extend_constr state forpat ng =
let constr_levels = GramState.field ()
-let extend_constr_notation (_, ng) state =
+let extend_constr_notation ng state =
let levels = match GramState.get state constr_levels with
| None -> default_constr_levels
| Some lev -> lev
@@ -467,7 +476,7 @@ let extend_constr_notation (_, ng) state =
let state = GramState.set state constr_levels levels in
(r @ r', state)
-let constr_grammar : (Notation.level * notation_grammar) grammar_command =
+let constr_grammar : one_notation_grammar grammar_command =
create_grammar_command "Notation" extend_constr_notation
-let extend_constr_grammar pr ntn = extend_grammar_command constr_grammar (pr, ntn)
+let extend_constr_grammar ntn = extend_grammar_command constr_grammar ntn
diff --git a/parsing/egramcoq.mli b/parsing/egramcoq.mli
index 248de3348..8e0469275 100644
--- a/parsing/egramcoq.mli
+++ b/parsing/egramcoq.mli
@@ -13,5 +13,5 @@
(** {5 Adding notations} *)
-val extend_constr_grammar : Notation.level -> Notation_term.notation_grammar -> unit
+val extend_constr_grammar : Notation_term.one_notation_grammar -> unit
(** Add a term notation rule to the parsing system. *)
diff --git a/parsing/g_vernac.ml4 b/parsing/g_vernac.ml4
index 99c8b1dbf..560a9a757 100644
--- a/parsing/g_vernac.ml4
+++ b/parsing/g_vernac.ml4
@@ -181,8 +181,13 @@ GEXTEND Gram
let indl=List.map (fun ((a,b,c,d),e) -> ((a,b,c,k,d),e)) indl in
let cum =
match cum with
- Some b -> b
- | None -> Flags.is_inductive_cumulativity ()
+ Some true -> LocalCumulativity
+ | Some false -> LocalNonCumulativity
+ | None ->
+ if Flags.is_polymorphic_inductive_cumulativity () then
+ GlobalCumulativity
+ else
+ GlobalNonCumulativity
in
VernacInductive (cum, priv,f,indl)
| "Fixpoint"; recs = LIST1 rec_definition SEP "with" ->
diff --git a/plugins/cc/ccalgo.mli b/plugins/cc/ccalgo.mli
index e6abf1ccf..f904aa3e6 100644
--- a/plugins/cc/ccalgo.mli
+++ b/plugins/cc/ccalgo.mli
@@ -120,7 +120,7 @@ val term_equal : term -> term -> bool
val constr_of_term : term -> constr
-val debug : (unit -> Pp.std_ppcmds) -> unit
+val debug : (unit -> Pp.t) -> unit
val forest : state -> forest
@@ -169,7 +169,7 @@ val find_instances : state -> (quant_eq * int array) list
val execute : bool -> state -> explanation option
-val pr_idx_term : forest -> int -> Pp.std_ppcmds
+val pr_idx_term : forest -> int -> Pp.t
val empty_forest: unit -> forest
diff --git a/plugins/cc/cctac.ml b/plugins/cc/cctac.ml
index 4934b0750..11d3a6d1f 100644
--- a/plugins/cc/cctac.ml
+++ b/plugins/cc/cctac.ml
@@ -231,7 +231,8 @@ let make_prb gls depth additionnal_terms =
let build_projection intype (cstr:pconstructor) special default gls=
let open Tacmach.New in
let ci= (snd(fst cstr)) in
- let sigma, body=Equality.build_selector (pf_env gls) (project gls) ci (mkRel 1) intype special default in
+ let sigma = project gls in
+ let body=Equality.build_selector (pf_env gls) sigma ci (mkRel 1) intype special default in
let id=pf_get_new_id (Id.of_string "t") gls in
sigma, mkLambda(Name id,intype,body)
diff --git a/plugins/extraction/common.mli b/plugins/extraction/common.mli
index d6342b59c..356bad98b 100644
--- a/plugins/extraction/common.mli
+++ b/plugins/extraction/common.mli
@@ -9,30 +9,29 @@
open Names
open Globnames
open Miniml
-open Pp
(** By default, in module Format, you can do horizontal placing of blocks
even if they include newlines, as long as the number of chars in the
blocks are less that a line length. To avoid this awkward situation,
we attach a big virtual size to [fnl] newlines. *)
-val fnl : unit -> std_ppcmds
-val fnl2 : unit -> std_ppcmds
-val space_if : bool -> std_ppcmds
+val fnl : unit -> Pp.t
+val fnl2 : unit -> Pp.t
+val space_if : bool -> Pp.t
-val pp_par : bool -> std_ppcmds -> std_ppcmds
+val pp_par : bool -> Pp.t -> Pp.t
(** [pp_apply] : a head part applied to arguments, possibly with parenthesis *)
-val pp_apply : std_ppcmds -> bool -> std_ppcmds list -> std_ppcmds
+val pp_apply : Pp.t -> bool -> Pp.t list -> Pp.t
(** Same as [pp_apply], but with also protection of the head by parenthesis *)
-val pp_apply2 : std_ppcmds -> bool -> std_ppcmds list -> std_ppcmds
+val pp_apply2 : Pp.t -> bool -> Pp.t list -> Pp.t
-val pp_tuple_light : (bool -> 'a -> std_ppcmds) -> 'a list -> std_ppcmds
-val pp_tuple : ('a -> std_ppcmds) -> 'a list -> std_ppcmds
-val pp_boxed_tuple : ('a -> std_ppcmds) -> 'a list -> std_ppcmds
+val pp_tuple_light : (bool -> 'a -> Pp.t) -> 'a list -> Pp.t
+val pp_tuple : ('a -> Pp.t) -> 'a list -> Pp.t
+val pp_boxed_tuple : ('a -> Pp.t) -> 'a list -> Pp.t
-val pr_binding : Id.t list -> std_ppcmds
+val pr_binding : Id.t list -> Pp.t
val rename_id : Id.t -> Id.Set.t -> Id.t
@@ -80,4 +79,4 @@ val mk_ind : string -> string -> MutInd.t
val is_native_char : ml_ast -> bool
val get_native_char : ml_ast -> char
-val pp_native_char : ml_ast -> std_ppcmds
+val pp_native_char : ml_ast -> Pp.t
diff --git a/plugins/extraction/extract_env.mli b/plugins/extraction/extract_env.mli
index e10dcd48b..5769ff117 100644
--- a/plugins/extraction/extract_env.mli
+++ b/plugins/extraction/extract_env.mli
@@ -29,7 +29,7 @@ val mono_environment :
(* Used by the Relation Extraction plugin *)
val print_one_decl :
- Miniml.ml_structure -> ModPath.t -> Miniml.ml_decl -> Pp.std_ppcmds
+ Miniml.ml_structure -> ModPath.t -> Miniml.ml_decl -> Pp.t
(* Used by Extraction Compute *)
diff --git a/plugins/extraction/extraction.ml b/plugins/extraction/extraction.ml
index 661842790..7644b49ce 100644
--- a/plugins/extraction/extraction.ml
+++ b/plugins/extraction/extraction.ml
@@ -295,7 +295,11 @@ let rec extract_type env db j c args =
| Ind ((kn,i),u) ->
let s = (extract_ind env kn).ind_packets.(i).ip_sign in
extract_type_app env db (IndRef (kn,i),s) args
- | Case _ | Fix _ | CoFix _ | Proj _ -> Tunknown
+ | Proj (p,t) ->
+ (* Let's try to reduce, if it hasn't already been done. *)
+ if Projection.unfolded p then Tunknown
+ else extract_type env db j (Term.mkProj (Projection.unfold p, t)) args
+ | Case _ | Fix _ | CoFix _ -> Tunknown
| _ -> assert false
(*s Auxiliary function dealing with type application.
diff --git a/plugins/extraction/miniml.mli b/plugins/extraction/miniml.mli
index be8282da0..edebba49d 100644
--- a/plugins/extraction/miniml.mli
+++ b/plugins/extraction/miniml.mli
@@ -8,7 +8,6 @@
(*s Target language for extraction: a core ML called MiniML. *)
-open Pp
open Names
open Globnames
@@ -205,19 +204,19 @@ type language_descr = {
file_naming : ModPath.t -> string;
(* the second argument is a comment to add to the preamble *)
preamble :
- Id.t -> std_ppcmds option -> ModPath.t list -> unsafe_needs ->
- std_ppcmds;
- pp_struct : ml_structure -> std_ppcmds;
+ Id.t -> Pp.t option -> ModPath.t list -> unsafe_needs ->
+ Pp.t;
+ pp_struct : ml_structure -> Pp.t;
(* Concerning a possible interface file *)
sig_suffix : string option;
(* the second argument is a comment to add to the preamble *)
sig_preamble :
- Id.t -> std_ppcmds option -> ModPath.t list -> unsafe_needs ->
- std_ppcmds;
- pp_sig : ml_signature -> std_ppcmds;
+ Id.t -> Pp.t option -> ModPath.t list -> unsafe_needs ->
+ Pp.t;
+ pp_sig : ml_signature -> Pp.t;
(* for an isolated declaration print *)
- pp_decl : ml_decl -> std_ppcmds;
+ pp_decl : ml_decl -> Pp.t;
}
diff --git a/plugins/extraction/table.mli b/plugins/extraction/table.mli
index 2b3007f02..7e47d0bc8 100644
--- a/plugins/extraction/table.mli
+++ b/plugins/extraction/table.mli
@@ -191,7 +191,7 @@ val find_custom_match : ml_branch array -> string
val extraction_language : lang -> unit
val extraction_inline : bool -> reference list -> unit
-val print_extraction_inline : unit -> Pp.std_ppcmds
+val print_extraction_inline : unit -> Pp.t
val reset_extraction_inline : unit -> unit
val extract_constant_inline :
bool -> reference -> string list -> string -> unit
@@ -206,7 +206,7 @@ val extraction_implicit : reference -> int_or_id list -> unit
val extraction_blacklist : Id.t list -> unit
val reset_extraction_blacklist : unit -> unit
-val print_extraction_blacklist : unit -> Pp.std_ppcmds
+val print_extraction_blacklist : unit -> Pp.t
diff --git a/plugins/firstorder/sequent.ml b/plugins/firstorder/sequent.ml
index 5ba98fb58..05194164b 100644
--- a/plugins/firstorder/sequent.ml
+++ b/plugins/firstorder/sequent.ml
@@ -233,7 +233,7 @@ let extend_with_auto_hints env sigma l seq =
let print_cmap map=
let print_entry c l s=
- let xc=Constrextern.extern_constr false (Global.env ()) Evd.empty c in
+ let xc=Constrextern.extern_constr false (Global.env ()) Evd.empty (EConstr.of_constr c) in
str "| " ++
prlist Printer.pr_global l ++
str " : " ++
diff --git a/plugins/firstorder/sequent.mli b/plugins/firstorder/sequent.mli
index 0a2e84bb8..ca6079c8b 100644
--- a/plugins/firstorder/sequent.mli
+++ b/plugins/firstorder/sequent.mli
@@ -57,4 +57,4 @@ val extend_with_ref_list : Environ.env -> Evd.evar_map -> global_reference list
val extend_with_auto_hints : Environ.env -> Evd.evar_map -> Hints.hint_db_name list ->
t -> t * Evd.evar_map
-val print_cmap: global_reference list CM.t -> Pp.std_ppcmds
+val print_cmap: global_reference list CM.t -> Pp.t
diff --git a/plugins/funind/functional_principles_proofs.ml b/plugins/funind/functional_principles_proofs.ml
index 15ab396e3..5f6d78359 100644
--- a/plugins/funind/functional_principles_proofs.ml
+++ b/plugins/funind/functional_principles_proofs.ml
@@ -821,8 +821,9 @@ let build_proof
| Fix _ | CoFix _ ->
user_err Pp.(str ( "Anonymous local (co)fixpoints are not handled yet"))
+
| Proj _ -> user_err Pp.(str "Prod")
- | Prod _ -> user_err Pp.(str "Prod")
+ | Prod _ -> do_finalize dyn_infos g
| LetIn _ ->
let new_infos =
{ dyn_infos with
diff --git a/plugins/funind/glob_term_to_relation.ml b/plugins/funind/glob_term_to_relation.ml
index 379c83b24..8cf5e8442 100644
--- a/plugins/funind/glob_term_to_relation.ml
+++ b/plugins/funind/glob_term_to_relation.ml
@@ -32,6 +32,14 @@ type binder_type =
type glob_context = (binder_type*glob_constr) list
+
+let rec solve_trivial_holes pat_as_term e =
+ match pat_as_term.CAst.v,e.CAst.v with
+ | GHole _,_ -> e
+ | GApp(fp,argsp),GApp(fe,argse) when glob_constr_eq fp fe ->
+ CAst.make (GApp((solve_trivial_holes fp fe),List.map2 solve_trivial_holes argsp argse))
+ | _,_ -> pat_as_term
+
(*
compose_glob_context [(bt_1,n_1,t_1);......] rt returns
b_1(n_1,t_1,.....,bn(n_k,t_k,rt)) where the b_i's are the
@@ -226,7 +234,12 @@ let combine_lam n t b =
compose_glob_context b.context b.value )
}
-
+let combine_prod2 n t b =
+ {
+ context = [];
+ value = mkGProd(n, compose_glob_context t.context t.value,
+ compose_glob_context b.context b.value )
+ }
let combine_prod n t b =
{ context = t.context@((Prod n,t.value)::b.context); value = b.value}
@@ -604,7 +617,9 @@ let rec build_entry_lc env funnames avoid rt : glob_constr build_entry_return =
let t_res = build_entry_lc env funnames avoid t in
let new_env = raw_push_named (n,None,t) env in
let b_res = build_entry_lc new_env funnames avoid b in
- combine_results (combine_prod n) t_res b_res
+ if List.length t_res.result = 1 && List.length b_res.result = 1
+ then combine_results (combine_prod2 n) t_res b_res
+ else combine_results (combine_prod n) t_res b_res
| GLetIn(n,v,typ,b) ->
(* we first compute the list of constructor
corresponding to the body of the function,
@@ -806,6 +821,12 @@ and build_entry_lc_from_case_term env types funname make_discr patterns_to_preve
let typ_as_constr = EConstr.of_constr typ_as_constr in
let typ = Detyping.detype false [] new_env (Evd.from_env env) typ_as_constr in
let pat_as_term = pattern_to_term pat in
+ (* removing trivial holes *)
+ let pat_as_term = solve_trivial_holes pat_as_term e in
+ (* observe (str "those_pattern_preconds" ++ spc () ++ *)
+ (* str "pat" ++ spc () ++ pr_glob_constr pat_as_term ++ spc ()++ *)
+ (* str "e" ++ spc () ++ pr_glob_constr e ++spc ()++ *)
+ (* str "typ_as_constr" ++ spc () ++ pr_lconstr typ_as_constr); *)
List.fold_right
(fun id acc ->
if Id.Set.mem id this_pat_ids
@@ -1471,7 +1492,7 @@ let do_build_inductive
in
let msg =
str "while trying to define"++ spc () ++
- Ppvernac.pr_vernac (Vernacexpr.VernacInductive(false,false,Decl_kinds.Finite,repacked_rel_inds))
+ Ppvernac.pr_vernac (Vernacexpr.VernacInductive(Vernacexpr.GlobalNonCumulativity,false,Decl_kinds.Finite,repacked_rel_inds))
++ fnl () ++
msg
in
@@ -1486,7 +1507,7 @@ let do_build_inductive
in
let msg =
str "while trying to define"++ spc () ++
- Ppvernac.pr_vernac (Vernacexpr.VernacInductive(false,false,Decl_kinds.Finite,repacked_rel_inds))
+ Ppvernac.pr_vernac (Vernacexpr.VernacInductive(Vernacexpr.GlobalNonCumulativity,false,Decl_kinds.Finite,repacked_rel_inds))
++ fnl () ++
CErrors.print reraise
in
diff --git a/plugins/funind/glob_termops.ml b/plugins/funind/glob_termops.ml
index 7cb35838c..003bb4e30 100644
--- a/plugins/funind/glob_termops.ml
+++ b/plugins/funind/glob_termops.ml
@@ -708,9 +708,6 @@ let expand_as =
in
expand_as Id.Map.empty
-
-
-
(* [resolve_and_replace_implicits ?expected_type env sigma rt] solves implicits of [rt] w.r.t. [env] and [sigma] and then replace them by their solution
*)
@@ -749,6 +746,30 @@ If someone knows how to prevent solved existantial removal in understand, pleas
Detyping.detype false [] env ctx (EConstr.of_constr (f c))
| Evar_empty -> rt (* the hole was not solved : we do nothing *)
)
+ | (GHole(BinderType na,_,_)) -> (* we only want to deal with implicit arguments *)
+ (
+ let res =
+ try (* we scan the new evar map to find the evar corresponding to this hole (by looking the source *)
+ Evd.fold (* to simulate an iter *)
+ (fun _ evi _ ->
+ match evi.evar_source with
+ | (loc_evi,BinderType na') ->
+ if Name.equal na na' && rt.CAst.loc = loc_evi then raise (Found evi)
+ | _ -> ()
+ )
+ ctx
+ ();
+ (* the hole was not solved : we do nothing *)
+ rt
+ with Found evi -> (* we found the evar corresponding to this hole *)
+ match evi.evar_body with
+ | Evar_defined c ->
+ (* we just have to lift the solution in glob_term *)
+ Detyping.detype false [] env ctx (EConstr.of_constr (f c))
+ | Evar_empty -> rt (* the hole was not solved : we d when falseo nothing *)
+ in
+ res
+ )
| _ -> Glob_ops.map_glob_constr change rt
in
change rt
diff --git a/plugins/funind/indfun.ml b/plugins/funind/indfun.ml
index 89537ad3f..8769f5668 100644
--- a/plugins/funind/indfun.ml
+++ b/plugins/funind/indfun.ml
@@ -618,7 +618,7 @@ let recompute_binder_list (fixpoint_exprl : (Vernacexpr.fixpoint_expr * Vernacex
let fixl,ntns = Command.extract_fixpoint_components false fixpoint_exprl in
let ((_,_,typel),_,ctx,_) = Command.interp_fixpoint fixl ntns in
let constr_expr_typel =
- with_full_print (List.map (Constrextern.extern_constr false (Global.env ()) (Evd.from_ctx ctx))) typel in
+ with_full_print (List.map (fun c -> Constrextern.extern_constr false (Global.env ()) (Evd.from_ctx ctx) (EConstr.of_constr c))) typel in
let fixpoint_exprl_with_new_bl =
List.map2 (fun ((lna,(rec_arg_opt,rec_order),bl,ret_typ,opt_body),notation_list) fix_typ ->
@@ -855,9 +855,9 @@ let make_graph (f_ref:global_reference) =
let sigma = Evd.from_env env in
let extern_body,extern_type =
with_full_print (fun () ->
- (Constrextern.extern_constr false env sigma body,
+ (Constrextern.extern_constr false env sigma (EConstr.of_constr body),
Constrextern.extern_type false env sigma
- ((*FIXME*) c_body.const_type)
+ (EConstr.of_constr (*FIXME*) c_body.const_type)
)
)
()
diff --git a/plugins/funind/indfun.mli b/plugins/funind/indfun.mli
index 7a60da44f..93e03852e 100644
--- a/plugins/funind/indfun.mli
+++ b/plugins/funind/indfun.mli
@@ -1,8 +1,8 @@
open Misctypes
-val warn_cannot_define_graph : ?loc:Loc.t -> Pp.std_ppcmds * Pp.std_ppcmds -> unit
+val warn_cannot_define_graph : ?loc:Loc.t -> Pp.t * Pp.t -> unit
-val warn_cannot_define_principle : ?loc:Loc.t -> Pp.std_ppcmds * Pp.std_ppcmds -> unit
+val warn_cannot_define_principle : ?loc:Loc.t -> Pp.t * Pp.t -> unit
val do_generate_principle :
bool ->
diff --git a/plugins/funind/indfun_common.mli b/plugins/funind/indfun_common.mli
index 5e425cd18..2e2ced790 100644
--- a/plugins/funind/indfun_common.mli
+++ b/plugins/funind/indfun_common.mli
@@ -1,5 +1,4 @@
open Names
-open Pp
(*
The mk_?_id function build different name w.r.t. a function
@@ -11,7 +10,7 @@ val mk_complete_id : Id.t -> Id.t
val mk_equation_id : Id.t -> Id.t
-val msgnl : std_ppcmds -> unit
+val msgnl : Pp.t -> unit
val fresh_id : Id.t list -> string -> Id.t
val fresh_name : Id.t list -> string -> Name.t
@@ -24,7 +23,7 @@ val id_of_name : Name.t -> Id.t
val locate_ind : Libnames.reference -> inductive
val locate_constant : Libnames.reference -> Constant.t
val locate_with_msg :
- Pp.std_ppcmds -> (Libnames.reference -> 'a) ->
+ Pp.t -> (Libnames.reference -> 'a) ->
Libnames.reference -> 'a
val filter_map : ('a -> bool) -> ('a -> 'b) -> 'a list -> 'b list
@@ -89,8 +88,8 @@ val update_Function : function_info -> unit
(** debugging *)
-val pr_info : function_info -> Pp.std_ppcmds
-val pr_table : unit -> Pp.std_ppcmds
+val pr_info : function_info -> Pp.t
+val pr_table : unit -> Pp.t
(* val function_debug : bool ref *)
diff --git a/plugins/funind/merge.ml b/plugins/funind/merge.ml
index 52a82b0e5..3ae922190 100644
--- a/plugins/funind/merge.ml
+++ b/plugins/funind/merge.ml
@@ -812,13 +812,13 @@ let merge_rec_params_and_arity prms1 prms2 shift (concl:constr) =
let typ = glob_constr_to_constr_expr tp in
CLocalAssum ([(Loc.tag nme)], Constrexpr_ops.default_binder_kind, typ) :: acc)
[] params in
- let concl = Constrextern.extern_constr false (Global.env()) Evd.empty concl in
+ let concl = Constrextern.extern_constr false (Global.env()) Evd.empty (EConstr.of_constr concl) in
let arity,_ =
List.fold_left
(fun (acc,env) decl ->
let nm = Context.Rel.Declaration.get_name decl in
let c = RelDecl.get_type decl in
- let typ = Constrextern.extern_constr false env Evd.empty c in
+ let typ = Constrextern.extern_constr false env Evd.empty (EConstr.of_constr c) in
let newenv = Environ.push_rel (LocalAssum (nm,c)) env in
CAst.make @@ CProdN ([[(Loc.tag nm)],Constrexpr_ops.default_binder_kind,typ] , acc) , newenv)
(concl,Global.env())
diff --git a/plugins/ltac/extraargs.ml4 b/plugins/ltac/extraargs.ml4
index 609795133..89feea8dc 100644
--- a/plugins/ltac/extraargs.ml4
+++ b/plugins/ltac/extraargs.ml4
@@ -249,7 +249,7 @@ END
let pr_by_arg_tac _prc _prlc prtac opt_c =
match opt_c with
| None -> mt ()
- | Some t -> hov 2 (str "by" ++ spc () ++ prtac (3,Ppextend.E) t)
+ | Some t -> hov 2 (str "by" ++ spc () ++ prtac (3,Notation_term.E) t)
ARGUMENT EXTEND by_arg_tac
TYPED AS tactic_opt
diff --git a/plugins/ltac/extraargs.mli b/plugins/ltac/extraargs.mli
index acdf67779..00668ddc7 100644
--- a/plugins/ltac/extraargs.mli
+++ b/plugins/ltac/extraargs.mli
@@ -14,13 +14,13 @@ open Misctypes
val wit_orient : bool Genarg.uniform_genarg_type
val orient : bool Pcoq.Gram.entry
-val pr_orient : bool -> Pp.std_ppcmds
+val pr_orient : bool -> Pp.t
val wit_rename : (Id.t * Id.t) Genarg.uniform_genarg_type
val occurrences : (int list or_var) Pcoq.Gram.entry
val wit_occurrences : (int list or_var, int list or_var, int list) Genarg.genarg_type
-val pr_occurrences : int list or_var -> Pp.std_ppcmds
+val pr_occurrences : int list or_var -> Pp.t
val occurrences_of : int list -> Locus.occurrences
val wit_natural : int Genarg.uniform_genarg_type
@@ -55,7 +55,7 @@ type place = Id.t gen_place
val wit_hloc : (loc_place, loc_place, place) Genarg.genarg_type
val hloc : loc_place Pcoq.Gram.entry
-val pr_hloc : loc_place -> Pp.std_ppcmds
+val pr_hloc : loc_place -> Pp.t
val by_arg_tac : Tacexpr.raw_tactic_expr option Pcoq.Gram.entry
val wit_by_arg_tac :
@@ -64,8 +64,8 @@ val wit_by_arg_tac :
Geninterp.Val.t option) Genarg.genarg_type
val pr_by_arg_tac :
- (int * Ppextend.parenRelation -> raw_tactic_expr -> Pp.std_ppcmds) ->
- raw_tactic_expr option -> Pp.std_ppcmds
+ (int * Notation_term.parenRelation -> raw_tactic_expr -> Pp.t) ->
+ raw_tactic_expr option -> Pp.t
val test_lpar_id_colon : unit Pcoq.Gram.entry
diff --git a/plugins/ltac/g_class.ml4 b/plugins/ltac/g_class.ml4
index dd24aa3db..104977aef 100644
--- a/plugins/ltac/g_class.ml4
+++ b/plugins/ltac/g_class.ml4
@@ -20,7 +20,7 @@ let set_transparency cl b =
List.iter (fun r ->
let gr = Smartlocate.global_with_alias r in
let ev = Tacred.evaluable_of_global_reference (Global.env ()) gr in
- Classes.set_typeclass_transparency ev false b) cl
+ Classes.set_typeclass_transparency ev (Locality.make_section_locality None) b) cl
VERNAC COMMAND EXTEND Typeclasses_Unfold_Settings CLASSIFIED AS SIDEFF
| [ "Typeclasses" "Transparent" reference_list(cl) ] -> [
diff --git a/plugins/ltac/pptactic.ml b/plugins/ltac/pptactic.ml
index 327b347ec..cb7d9b9c0 100644
--- a/plugins/ltac/pptactic.ml
+++ b/plugins/ltac/pptactic.ml
@@ -18,7 +18,7 @@ open Geninterp
open Stdarg
open Tacarg
open Libnames
-open Ppextend
+open Notation_term
open Misctypes
open Locus
open Decl_kinds
@@ -67,22 +67,22 @@ let declare_notation_tactic_pprule kn pt =
prnotation_tab := KNmap.add kn pt !prnotation_tab
type 'a raw_extra_genarg_printer =
- (constr_expr -> std_ppcmds) ->
- (constr_expr -> std_ppcmds) ->
- (tolerability -> raw_tactic_expr -> std_ppcmds) ->
- 'a -> std_ppcmds
+ (constr_expr -> Pp.t) ->
+ (constr_expr -> Pp.t) ->
+ (tolerability -> raw_tactic_expr -> Pp.t) ->
+ 'a -> Pp.t
type 'a glob_extra_genarg_printer =
- (glob_constr_and_expr -> std_ppcmds) ->
- (glob_constr_and_expr -> std_ppcmds) ->
- (tolerability -> glob_tactic_expr -> std_ppcmds) ->
- 'a -> std_ppcmds
+ (glob_constr_and_expr -> Pp.t) ->
+ (glob_constr_and_expr -> Pp.t) ->
+ (tolerability -> glob_tactic_expr -> Pp.t) ->
+ 'a -> Pp.t
type 'a extra_genarg_printer =
- (EConstr.constr -> std_ppcmds) ->
- (EConstr.constr -> std_ppcmds) ->
- (tolerability -> Val.t -> std_ppcmds) ->
- 'a -> std_ppcmds
+ (EConstr.constr -> Pp.t) ->
+ (EConstr.constr -> Pp.t) ->
+ (tolerability -> Val.t -> Pp.t) ->
+ 'a -> Pp.t
let keyword x = tag_keyword (str x)
let primitive x = tag_primitive (str x)
@@ -96,7 +96,7 @@ type 'a extra_genarg_printer =
| None -> assert false
| Some Refl -> x
- let rec pr_value lev v : std_ppcmds =
+ let rec pr_value lev v : Pp.t =
if has_type v Val.typ_list then
pr_sequence (fun x -> pr_value lev x) (unbox v Val.typ_list)
else if has_type v Val.typ_opt then
@@ -272,7 +272,7 @@ type 'a extra_genarg_printer =
| Glbwit (OptArg wit) -> Some (Option.map (in_gen (glbwit wit)) arg)
| _ -> None
- let rec pr_any_arg : type l. (_ -> l generic_argument -> std_ppcmds) -> _ -> l generic_argument -> std_ppcmds =
+ let rec pr_any_arg : type l. (_ -> l generic_argument -> Pp.t) -> _ -> l generic_argument -> Pp.t =
fun prtac symb arg -> match symb with
| Extend.Uentry tag when is_genarg tag (genarg_tag arg) -> prtac (1, Any) arg
| Extend.Ulist1 s | Extend.Ulist0 s ->
@@ -599,18 +599,18 @@ type 'a extra_genarg_printer =
"raw", "glob" and "typed" levels *)
type 'a printer = {
- pr_tactic : tolerability -> 'tacexpr -> std_ppcmds;
- pr_constr : 'trm -> std_ppcmds;
- pr_lconstr : 'trm -> std_ppcmds;
- pr_dconstr : 'dtrm -> std_ppcmds;
- pr_pattern : 'pat -> std_ppcmds;
- pr_lpattern : 'pat -> std_ppcmds;
- pr_constant : 'cst -> std_ppcmds;
- pr_reference : 'ref -> std_ppcmds;
- pr_name : 'nam -> std_ppcmds;
- pr_generic : 'lev generic_argument -> std_ppcmds;
- pr_extend : int -> ml_tactic_entry -> 'a gen_tactic_arg list -> std_ppcmds;
- pr_alias : int -> KerName.t -> 'a gen_tactic_arg list -> std_ppcmds;
+ pr_tactic : tolerability -> 'tacexpr -> Pp.t;
+ pr_constr : 'trm -> Pp.t;
+ pr_lconstr : 'trm -> Pp.t;
+ pr_dconstr : 'dtrm -> Pp.t;
+ pr_pattern : 'pat -> Pp.t;
+ pr_lpattern : 'pat -> Pp.t;
+ pr_constant : 'cst -> Pp.t;
+ pr_reference : 'ref -> Pp.t;
+ pr_name : 'nam -> Pp.t;
+ pr_generic : 'lev generic_argument -> Pp.t;
+ pr_extend : int -> ml_tactic_entry -> 'a gen_tactic_arg list -> Pp.t;
+ pr_alias : int -> KerName.t -> 'a gen_tactic_arg list -> Pp.t;
}
constraint 'a = <
diff --git a/plugins/ltac/pptactic.mli b/plugins/ltac/pptactic.mli
index 1127c9831..1f6ebaf44 100644
--- a/plugins/ltac/pptactic.mli
+++ b/plugins/ltac/pptactic.mli
@@ -9,7 +9,6 @@
(** This module implements pretty-printers for tactic_expr syntactic
objects and their subcomponents. *)
-open Pp
open Genarg
open Geninterp
open Names
@@ -17,29 +16,29 @@ open Misctypes
open Environ
open Constrexpr
open Tacexpr
-open Ppextend
+open Notation_term
type 'a grammar_tactic_prod_item_expr =
| TacTerm of string
| TacNonTerm of ('a * Names.Id.t option) Loc.located
type 'a raw_extra_genarg_printer =
- (constr_expr -> std_ppcmds) ->
- (constr_expr -> std_ppcmds) ->
- (tolerability -> raw_tactic_expr -> std_ppcmds) ->
- 'a -> std_ppcmds
+ (constr_expr -> Pp.t) ->
+ (constr_expr -> Pp.t) ->
+ (tolerability -> raw_tactic_expr -> Pp.t) ->
+ 'a -> Pp.t
type 'a glob_extra_genarg_printer =
- (glob_constr_and_expr -> std_ppcmds) ->
- (glob_constr_and_expr -> std_ppcmds) ->
- (tolerability -> glob_tactic_expr -> std_ppcmds) ->
- 'a -> std_ppcmds
+ (glob_constr_and_expr -> Pp.t) ->
+ (glob_constr_and_expr -> Pp.t) ->
+ (tolerability -> glob_tactic_expr -> Pp.t) ->
+ 'a -> Pp.t
type 'a extra_genarg_printer =
- (EConstr.t -> std_ppcmds) ->
- (EConstr.t -> std_ppcmds) ->
- (tolerability -> Val.t -> std_ppcmds) ->
- 'a -> std_ppcmds
+ (EConstr.t -> Pp.t) ->
+ (EConstr.t -> Pp.t) ->
+ (tolerability -> Val.t -> Pp.t) ->
+ 'a -> Pp.t
val declare_extra_genarg_pprule :
('a, 'b, 'c) genarg_type ->
@@ -57,61 +56,61 @@ type pp_tactic = {
val declare_notation_tactic_pprule : KerName.t -> pp_tactic -> unit
val pr_with_occurrences :
- ('a -> std_ppcmds) -> 'a Locus.with_occurrences -> std_ppcmds
+ ('a -> Pp.t) -> 'a Locus.with_occurrences -> Pp.t
val pr_red_expr :
- ('a -> std_ppcmds) * ('a -> std_ppcmds) * ('b -> std_ppcmds) * ('c -> std_ppcmds) ->
- ('a,'b,'c) Genredexpr.red_expr_gen -> std_ppcmds
+ ('a -> Pp.t) * ('a -> Pp.t) * ('b -> Pp.t) * ('c -> Pp.t) ->
+ ('a,'b,'c) Genredexpr.red_expr_gen -> Pp.t
val pr_may_eval :
- ('a -> std_ppcmds) -> ('a -> std_ppcmds) -> ('b -> std_ppcmds) ->
- ('c -> std_ppcmds) -> ('a,'b,'c) Genredexpr.may_eval -> std_ppcmds
+ ('a -> Pp.t) -> ('a -> Pp.t) -> ('b -> Pp.t) ->
+ ('c -> Pp.t) -> ('a,'b,'c) Genredexpr.may_eval -> Pp.t
-val pr_and_short_name : ('a -> std_ppcmds) -> 'a and_short_name -> std_ppcmds
-val pr_or_by_notation : ('a -> std_ppcmds) -> 'a or_by_notation -> std_ppcmds
+val pr_and_short_name : ('a -> Pp.t) -> 'a and_short_name -> Pp.t
+val pr_or_by_notation : ('a -> Pp.t) -> 'a or_by_notation -> Pp.t
val pr_in_clause :
- ('a -> Pp.std_ppcmds) -> 'a Locus.clause_expr -> Pp.std_ppcmds
+ ('a -> Pp.t) -> 'a Locus.clause_expr -> Pp.t
val pr_clauses : bool option ->
- ('a -> Pp.std_ppcmds) -> 'a Locus.clause_expr -> Pp.std_ppcmds
+ ('a -> Pp.t) -> 'a Locus.clause_expr -> Pp.t
-val pr_raw_generic : env -> rlevel generic_argument -> std_ppcmds
+val pr_raw_generic : env -> rlevel generic_argument -> Pp.t
-val pr_glb_generic : env -> glevel generic_argument -> std_ppcmds
+val pr_glb_generic : env -> glevel generic_argument -> Pp.t
val pr_raw_extend: env -> int ->
- ml_tactic_entry -> raw_tactic_arg list -> std_ppcmds
+ ml_tactic_entry -> raw_tactic_arg list -> Pp.t
val pr_glob_extend: env -> int ->
- ml_tactic_entry -> glob_tactic_arg list -> std_ppcmds
+ ml_tactic_entry -> glob_tactic_arg list -> Pp.t
val pr_extend :
- (Val.t -> std_ppcmds) -> int -> ml_tactic_entry -> Val.t list -> std_ppcmds
+ (Val.t -> Pp.t) -> int -> ml_tactic_entry -> Val.t list -> Pp.t
-val pr_alias_key : Names.KerName.t -> std_ppcmds
+val pr_alias_key : Names.KerName.t -> Pp.t
-val pr_alias : (Val.t -> std_ppcmds) ->
- int -> Names.KerName.t -> Val.t list -> std_ppcmds
+val pr_alias : (Val.t -> Pp.t) ->
+ int -> Names.KerName.t -> Val.t list -> Pp.t
-val pr_ltac_constant : Nametab.ltac_constant -> std_ppcmds
+val pr_ltac_constant : Nametab.ltac_constant -> Pp.t
-val pr_raw_tactic : raw_tactic_expr -> std_ppcmds
+val pr_raw_tactic : raw_tactic_expr -> Pp.t
-val pr_raw_tactic_level : tolerability -> raw_tactic_expr -> std_ppcmds
+val pr_raw_tactic_level : tolerability -> raw_tactic_expr -> Pp.t
-val pr_glob_tactic : env -> glob_tactic_expr -> std_ppcmds
+val pr_glob_tactic : env -> glob_tactic_expr -> Pp.t
-val pr_atomic_tactic : env -> Evd.evar_map -> atomic_tactic_expr -> std_ppcmds
+val pr_atomic_tactic : env -> Evd.evar_map -> atomic_tactic_expr -> Pp.t
-val pr_hintbases : string list option -> std_ppcmds
+val pr_hintbases : string list option -> Pp.t
-val pr_auto_using : ('constr -> std_ppcmds) -> 'constr list -> std_ppcmds
+val pr_auto_using : ('constr -> Pp.t) -> 'constr list -> Pp.t
-val pr_match_pattern : ('a -> std_ppcmds) -> 'a match_pattern -> std_ppcmds
+val pr_match_pattern : ('a -> Pp.t) -> 'a match_pattern -> Pp.t
-val pr_match_rule : bool -> ('a -> std_ppcmds) -> ('b -> std_ppcmds) ->
- ('b, 'a) match_rule -> std_ppcmds
+val pr_match_rule : bool -> ('a -> Pp.t) -> ('b -> Pp.t) ->
+ ('b, 'a) match_rule -> Pp.t
-val pr_value : tolerability -> Val.t -> std_ppcmds
+val pr_value : tolerability -> Val.t -> Pp.t
val ltop : tolerability
diff --git a/plugins/ltac/rewrite.ml b/plugins/ltac/rewrite.ml
index bbd7834d5..75b665aad 100644
--- a/plugins/ltac/rewrite.ml
+++ b/plugins/ltac/rewrite.ml
@@ -1461,7 +1461,7 @@ let solve_constraints env (evars,cstrs) =
let nf_zeta =
Reductionops.clos_norm_flags (CClosure.RedFlags.mkflags [CClosure.RedFlags.fZETA])
-exception RewriteFailure of Pp.std_ppcmds
+exception RewriteFailure of Pp.t
type result = (evar_map * constr option * types) option option
diff --git a/plugins/ltac/rewrite.mli b/plugins/ltac/rewrite.mli
index 35205ac58..23767c12f 100644
--- a/plugins/ltac/rewrite.mli
+++ b/plugins/ltac/rewrite.mli
@@ -61,8 +61,8 @@ val strategy_of_ast : (glob_constr_and_expr, raw_red_expr) strategy_ast -> strat
val map_strategy : ('a -> 'b) -> ('c -> 'd) ->
('a, 'c) strategy_ast -> ('b, 'd) strategy_ast
-val pr_strategy : ('a -> Pp.std_ppcmds) -> ('b -> Pp.std_ppcmds) ->
- ('a, 'b) strategy_ast -> Pp.std_ppcmds
+val pr_strategy : ('a -> Pp.t) -> ('b -> Pp.t) ->
+ ('a, 'b) strategy_ast -> Pp.t
(** Entry point for user-level "rewrite_strat" *)
val cl_rewrite_clause_strat : strategy -> Id.t option -> unit Proofview.tactic
diff --git a/plugins/ltac/tacintern.mli b/plugins/ltac/tacintern.mli
index b262473a9..e3a4d5c79 100644
--- a/plugins/ltac/tacintern.mli
+++ b/plugins/ltac/tacintern.mli
@@ -6,7 +6,6 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-open Pp
open Names
open Tacexpr
open Genarg
@@ -55,7 +54,7 @@ val intern_hyp : glob_sign -> Id.t Loc.located -> Id.t Loc.located
val intern_genarg : glob_sign -> raw_generic_argument -> glob_generic_argument
(** printing *)
-val print_ltac : Libnames.qualid -> std_ppcmds
+val print_ltac : Libnames.qualid -> Pp.t
(** Reduction expressions *)
diff --git a/plugins/ltac/tacinterp.ml b/plugins/ltac/tacinterp.ml
index 60a8f75ec..d3e625e73 100644
--- a/plugins/ltac/tacinterp.ml
+++ b/plugins/ltac/tacinterp.ml
@@ -2000,7 +2000,7 @@ let lift f = (); fun ist x -> Ftactic.enter begin fun gl ->
Ftactic.return (f ist env sigma x)
end
-let lifts f = (); fun ist x -> Ftactic.nf_enter begin fun gl ->
+let lifts f = (); fun ist x -> Ftactic.enter begin fun gl ->
let env = Proofview.Goal.env gl in
let sigma = Proofview.Goal.sigma gl in
let (sigma, v) = f ist env sigma x in
diff --git a/plugins/ltac/tactic_debug.mli b/plugins/ltac/tactic_debug.mli
index ef6362270..2475e41f9 100644
--- a/plugins/ltac/tactic_debug.mli
+++ b/plugins/ltac/tactic_debug.mli
@@ -58,16 +58,16 @@ val db_hyp_pattern_failure :
val db_matching_failure : debug_info -> unit Proofview.NonLogical.t
(** Prints an evaluation failure message for a rule *)
-val db_eval_failure : debug_info -> Pp.std_ppcmds -> unit Proofview.NonLogical.t
+val db_eval_failure : debug_info -> Pp.t -> unit Proofview.NonLogical.t
(** An exception handler *)
-val explain_logic_error: exn -> Pp.std_ppcmds
+val explain_logic_error: exn -> Pp.t
(** For use in the Ltac debugger: some exception that are usually
consider anomalies are acceptable because they are caught later in
the process that is being debugged. One should not require
from users that they report these anomalies. *)
-val explain_logic_error_no_anomaly : exn -> Pp.std_ppcmds
+val explain_logic_error_no_anomaly : exn -> Pp.t
(** Prints a logic failure message for a rule *)
val db_logic_failure : debug_info -> exn -> unit Proofview.NonLogical.t
@@ -77,4 +77,4 @@ val db_breakpoint : debug_info ->
Id.t Loc.located message_token list -> unit Proofview.NonLogical.t
val extract_ltac_trace :
- ?loc:Loc.t -> Tacexpr.ltac_trace -> Pp.std_ppcmds option Loc.located
+ ?loc:Loc.t -> Tacexpr.ltac_trace -> Pp.t option Loc.located
diff --git a/plugins/ltac/tactic_option.mli b/plugins/ltac/tactic_option.mli
index dd91944d4..95cd243ec 100644
--- a/plugins/ltac/tactic_option.mli
+++ b/plugins/ltac/tactic_option.mli
@@ -12,4 +12,4 @@ open Vernacexpr
val declare_tactic_option : ?default:Tacexpr.glob_tactic_expr -> string ->
(* put *) (locality_flag -> glob_tactic_expr -> unit) *
(* get *) (unit -> locality_flag * unit Proofview.tactic) *
- (* print *) (unit -> Pp.std_ppcmds)
+ (* print *) (unit -> Pp.t)
diff --git a/plugins/rtauto/proof_search.mli b/plugins/rtauto/proof_search.mli
index e0c09f394..86231cf19 100644
--- a/plugins/rtauto/proof_search.mli
+++ b/plugins/rtauto/proof_search.mli
@@ -38,9 +38,9 @@ val branching: state -> state list
val success: state -> bool
-val pp: state -> Pp.std_ppcmds
+val pp: state -> Pp.t
-val pr_form : form -> Pp.std_ppcmds
+val pr_form : form -> Pp.t
val reset_info : unit -> unit
diff --git a/plugins/setoid_ring/Ring_tac.v b/plugins/setoid_ring/Ring_tac.v
index fc02cef10..329fa0ee8 100644
--- a/plugins/setoid_ring/Ring_tac.v
+++ b/plugins/setoid_ring/Ring_tac.v
@@ -427,19 +427,37 @@ Tactic Notation "ring_simplify" constr_list(rl) "in" hyp(H):=
let t := type of H in
let g := fresh "goal" in
set (g:= G);
- generalize H;clear H;
+ generalize H;
ring_lookup (PackRing Ring_simplify) [] rl t;
- intro H;
+ (*
+ Correction of bug 1859:
+ we want to leave H at its initial position
+ this is obtained by adding a copy of H (H'),
+ move it just after H, remove H and finally
+ rename H into H'
+ *)
+ let H' := fresh "H" in
+ intro H';
+ move H' after H;
+ clear H;rename H' into H;
unfold g;clear g.
-Tactic Notation
- "ring_simplify" "["constr_list(lH)"]" constr_list(rl) "in" hyp(H):=
+Tactic Notation "ring_simplify" "["constr_list(lH)"]" constr_list(rl) "in" hyp(H):=
let G := Get_goal in
let t := type of H in
let g := fresh "goal" in
set (g:= G);
- generalize H;clear H;
+ generalize H;
ring_lookup (PackRing Ring_simplify) [lH] rl t;
- intro H;
- unfold g;clear g.
-
+ (*
+ Correction of bug 1859:
+ we want to leave H at its initial position
+ this is obtained by adding a copy of H (H'),
+ move it just after H, remove H and finally
+ rename H into H'
+ *)
+ let H' := fresh "H" in
+ intro H';
+ move H' after H;
+ clear H;rename H' into H;
+ unfold g;clear g. \ No newline at end of file
diff --git a/plugins/ssr/ssrcommon.mli b/plugins/ssr/ssrcommon.mli
index 4b045e989..2eadd5f26 100644
--- a/plugins/ssr/ssrcommon.mli
+++ b/plugins/ssr/ssrcommon.mli
@@ -41,7 +41,7 @@ val nohint : 'a ssrhint
(******************************** misc ************************************)
-val errorstrm : Pp.std_ppcmds -> 'a
+val errorstrm : Pp.t -> 'a
val anomaly : string -> 'a
val array_app_tl : 'a array -> 'a list -> 'a list
diff --git a/plugins/ssr/ssrparser.ml4 b/plugins/ssr/ssrparser.ml4
index ce23bb2b3..db1981228 100644
--- a/plugins/ssr/ssrparser.ml4
+++ b/plugins/ssr/ssrparser.ml4
@@ -62,7 +62,7 @@ DECLARE PLUGIN "ssreflect_plugin"
* we thus save the lexer to restore it at the end of the file *)
let frozen_lexer = CLexer.get_keyword_state () ;;
-let tacltop = (5,Ppextend.E)
+let tacltop = (5,Notation_term.E)
let pr_ssrtacarg _ _ prt = prt tacltop
ARGUMENT EXTEND ssrtacarg TYPED AS tactic PRINTED BY pr_ssrtacarg
diff --git a/plugins/ssr/ssrparser.mli b/plugins/ssr/ssrparser.mli
index bf6f44f11..f9dc345e1 100644
--- a/plugins/ssr/ssrparser.mli
+++ b/plugins/ssr/ssrparser.mli
@@ -10,11 +10,11 @@
val ssrtacarg : Tacexpr.raw_tactic_expr Pcoq.Gram.entry
val wit_ssrtacarg : (Tacexpr.raw_tactic_expr, Tacexpr.glob_tactic_expr, Geninterp.Val.t) Genarg.genarg_type
-val pr_ssrtacarg : 'a -> 'b -> (int * Ppextend.parenRelation -> 'c) -> 'c
+val pr_ssrtacarg : 'a -> 'b -> (Notation_term.tolerability -> 'c) -> 'c
val ssrtclarg : Tacexpr.raw_tactic_expr Pcoq.Gram.entry
val wit_ssrtclarg : (Tacexpr.raw_tactic_expr, Tacexpr.glob_tactic_expr, Geninterp.Val.t) Genarg.genarg_type
-val pr_ssrtclarg : 'a -> 'b -> (int * Ppextend.parenRelation -> 'c -> 'd) -> 'c -> 'd
+val pr_ssrtclarg : 'a -> 'b -> (Notation_term.tolerability -> 'c -> 'd) -> 'c -> 'd
-val add_genarg : string -> ('a -> Pp.std_ppcmds) -> 'a Genarg.uniform_genarg_type
+val add_genarg : string -> ('a -> Pp.t) -> 'a Genarg.uniform_genarg_type
diff --git a/plugins/ssr/ssrprinters.mli b/plugins/ssr/ssrprinters.mli
index 5c68872b7..f23106826 100644
--- a/plugins/ssr/ssrprinters.mli
+++ b/plugins/ssr/ssrprinters.mli
@@ -11,16 +11,16 @@
open Ssrast
val pp_term :
- Goal.goal Evd.sigma -> EConstr.constr -> Pp.std_ppcmds
+ Goal.goal Evd.sigma -> EConstr.constr -> Pp.t
-val pr_spc : unit -> Pp.std_ppcmds
-val pr_bar : unit -> Pp.std_ppcmds
+val pr_spc : unit -> Pp.t
+val pr_bar : unit -> Pp.t
val pr_list :
- (unit -> Pp.std_ppcmds) -> ('a -> Pp.std_ppcmds) -> 'a list -> Pp.std_ppcmds
+ (unit -> Pp.t) -> ('a -> Pp.t) -> 'a list -> Pp.t
val pp_concat :
- Pp.std_ppcmds ->
- ?sep:Pp.std_ppcmds -> Pp.std_ppcmds list -> Pp.std_ppcmds
+ Pp.t ->
+ ?sep:Pp.t -> Pp.t list -> Pp.t
val xInParens : ssrtermkind
val xWithAt : ssrtermkind
@@ -29,17 +29,17 @@ val xCpattern : ssrtermkind
val pr_term :
ssrtermkind * (Glob_term.glob_constr * Constrexpr.constr_expr option) ->
- Pp.std_ppcmds
+ Pp.t
-val pr_hyp : ssrhyp -> Pp.std_ppcmds
+val pr_hyp : ssrhyp -> Pp.t
-val prl_constr_expr : Constrexpr.constr_expr -> Pp.std_ppcmds
-val prl_glob_constr : Glob_term.glob_constr -> Pp.std_ppcmds
+val prl_constr_expr : Constrexpr.constr_expr -> Pp.t
+val prl_glob_constr : Glob_term.glob_constr -> Pp.t
val pr_guarded :
- (string -> int -> bool) -> ('a -> Pp.std_ppcmds) -> 'a -> Pp.std_ppcmds
+ (string -> int -> bool) -> ('a -> Pp.t) -> 'a -> Pp.t
-val pr_occ : ssrocc -> Pp.std_ppcmds
+val pr_occ : ssrocc -> Pp.t
-val ppdebug : Pp.std_ppcmds Lazy.t -> unit
+val ppdebug : Pp.t Lazy.t -> unit
diff --git a/plugins/ssrmatching/ssrmatching.mli b/plugins/ssrmatching/ssrmatching.mli
index 65ea76d16..8e2a1a717 100644
--- a/plugins/ssrmatching/ssrmatching.mli
+++ b/plugins/ssrmatching/ssrmatching.mli
@@ -15,7 +15,7 @@ open Term
(** The type of context patterns, the patterns of the [set] tactic and
[:] tactical. These are patterns that identify a precise subterm. *)
type cpattern
-val pr_cpattern : cpattern -> Pp.std_ppcmds
+val pr_cpattern : cpattern -> Pp.t
(** CS cpattern: (f _), (X in t), (t in X in t), (t as X in t) *)
val cpattern : cpattern Pcoq.Gram.entry
@@ -29,7 +29,7 @@ val wit_lcpattern : cpattern uniform_genarg_type
These patterns also include patterns that identify all the subterms
of a context (i.e. "in" prefix) *)
type rpattern
-val pr_rpattern : rpattern -> Pp.std_ppcmds
+val pr_rpattern : rpattern -> Pp.t
(** OS rpattern: f _, in t, X in t, in X in t, t in X in t, t as X in t *)
val rpattern : rpattern Pcoq.Gram.entry
@@ -50,7 +50,7 @@ type ('ident, 'term) ssrpattern =
| E_As_X_In_T of 'term * 'ident * 'term
type pattern = evar_map * (constr, constr) ssrpattern
-val pp_pattern : pattern -> Pp.std_ppcmds
+val pp_pattern : pattern -> Pp.t
(** Extracts the redex and applies to it the substitution part of the pattern.
@raise Anomaly if called on [In_T] or [In_X_In_T] *)
@@ -115,7 +115,7 @@ val fill_occ_pattern :
the T pattern above, and calls a continuation on its occurrences. *)
type ssrdir = L2R | R2L
-val pr_dir_side : ssrdir -> Pp.std_ppcmds
+val pr_dir_side : ssrdir -> Pp.t
(** a pattern for a term with wildcards *)
type tpattern
@@ -225,7 +225,7 @@ val loc_of_cpattern : cpattern -> Loc.t option
val id_of_pattern : pattern -> Names.Id.t option
val is_wildcard : cpattern -> bool
val cpattern_of_id : Names.Id.t -> cpattern
-val pr_constr_pat : constr -> Pp.std_ppcmds
+val pr_constr_pat : constr -> Pp.t
val pf_merge_uc : UState.t -> goal Evd.sigma -> goal Evd.sigma
val pf_unsafe_merge_uc : UState.t -> goal Evd.sigma -> goal Evd.sigma
diff --git a/pretyping/classops.ml b/pretyping/classops.ml
index 078990a8c..1cc072a2a 100644
--- a/pretyping/classops.ml
+++ b/pretyping/classops.ml
@@ -89,7 +89,7 @@ sig
type t
val compare : t -> t -> int
val equal : t -> t -> bool
- val print : t -> std_ppcmds
+ val print : t -> Pp.t
end
type 'a t
val empty : 'a t
@@ -324,7 +324,7 @@ let coercion_value { coe_value = c; coe_type = t; coe_context = ctx;
(* rajouter une coercion dans le graphe *)
let path_printer = ref (fun _ -> str "<a class path>"
- : (Bijint.Index.t * Bijint.Index.t) * inheritance_path -> std_ppcmds)
+ : (Bijint.Index.t * Bijint.Index.t) * inheritance_path -> Pp.t)
let install_path_printer f = path_printer := f
diff --git a/pretyping/classops.mli b/pretyping/classops.mli
index 2e5ce30f3..8707078b5 100644
--- a/pretyping/classops.mli
+++ b/pretyping/classops.mli
@@ -95,15 +95,14 @@ val lookup_pattern_path_between :
(**/**)
(* Crade *)
-open Pp
val install_path_printer :
- ((cl_index * cl_index) * inheritance_path -> std_ppcmds) -> unit
+ ((cl_index * cl_index) * inheritance_path -> Pp.t) -> unit
(**/**)
(** {6 This is for printing purpose } *)
val string_of_class : cl_typ -> string
-val pr_class : cl_typ -> std_ppcmds
-val pr_cl_index : cl_index -> std_ppcmds
+val pr_class : cl_typ -> Pp.t
+val pr_cl_index : cl_index -> Pp.t
val get_coercion_value : coe_index -> Constr.t
val inheritance_graph : unit -> ((cl_index * cl_index) * inheritance_path) list
val classes : unit -> cl_typ list
diff --git a/pretyping/detyping.ml b/pretyping/detyping.ml
index f830d4be3..a27debe73 100644
--- a/pretyping/detyping.ml
+++ b/pretyping/detyping.ml
@@ -81,7 +81,7 @@ let encode_tuple r =
module PrintingInductiveMake =
functor (Test : sig
val encode : reference -> inductive
- val member_message : std_ppcmds -> bool -> std_ppcmds
+ val member_message : Pp.t -> bool -> Pp.t
val field : string
val title : string
end) ->
@@ -475,8 +475,8 @@ let rec detype flags avoid env sigma t = CAst.make @@
GApp (f',args''@args')
| _ -> GApp (f',args')
in
- mkapp (detype flags avoid env sigma f)
- (Array.map_to_list (detype flags avoid env sigma) args)
+ mkapp (detype flags avoid env sigma f)
+ (detype_array flags avoid env sigma args)
| Const (sp,u) -> GRef (ConstRef sp, detype_instance sigma u)
| Proj (p,c) ->
let noparams () =
@@ -694,6 +694,15 @@ and detype_binder (lax,isgoal as flags) bk avoid env sigma na body ty c =
let t = if s != InProp && not !Flags.raw_print then None else Some (detype (lax,false) avoid env sigma ty) in
GLetIn (na', c, t, r)
+(** We use a dedicated function here to prevent overallocation from
+ Array.map_to_list. *)
+and detype_array flags avoid env sigma args =
+ let ans = ref [] in
+ for i = Array.length args - 1 downto 0 do
+ ans := detype flags avoid env sigma args.(i) :: !ans;
+ done;
+ !ans
+
let detype_rel_context ?(lax=false) where avoid env sigma sign =
let where = Option.map (fun c -> EConstr.it_mkLambda_or_LetIn c sign) where in
let rec aux avoid env = function
diff --git a/pretyping/detyping.mli b/pretyping/detyping.mli
index ffd67299d..59f3f967d 100644
--- a/pretyping/detyping.mli
+++ b/pretyping/detyping.mli
@@ -66,7 +66,7 @@ val subst_genarg_hook :
module PrintingInductiveMake :
functor (Test : sig
val encode : Libnames.reference -> Names.inductive
- val member_message : Pp.std_ppcmds -> bool -> Pp.std_ppcmds
+ val member_message : Pp.t -> bool -> Pp.t
val field : string
val title : string
end) ->
@@ -75,9 +75,9 @@ module PrintingInductiveMake :
val compare : t -> t -> int
val encode : Libnames.reference -> Names.inductive
val subst : substitution -> t -> t
- val printer : t -> Pp.std_ppcmds
+ val printer : t -> Pp.t
val key : Goptions.option_name
val title : string
- val member_message : t -> bool -> Pp.std_ppcmds
+ val member_message : t -> bool -> Pp.t
val synchronous : bool
end
diff --git a/pretyping/evardefine.mli b/pretyping/evardefine.mli
index c727332c7..5477c5c99 100644
--- a/pretyping/evardefine.mli
+++ b/pretyping/evardefine.mli
@@ -43,5 +43,5 @@ val define_evar_as_sort : env -> evar_map -> existential -> evar_map * sorts
(** {6 debug pretty-printer:} *)
-val pr_tycon : env -> evar_map -> type_constraint -> Pp.std_ppcmds
+val pr_tycon : env -> evar_map -> type_constraint -> Pp.t
diff --git a/pretyping/pretyping.ml b/pretyping/pretyping.ml
index bfc6bf5cf..b4d87dfdb 100644
--- a/pretyping/pretyping.ml
+++ b/pretyping/pretyping.ml
@@ -1136,8 +1136,13 @@ and pretype_type k0 resolve_tc valcon (env : ExtraEnv.t) evdref lvar = function
evd_comb1 (define_evar_as_sort env.ExtraEnv.env) evdref ev
| _ -> anomaly (Pp.str "Found a type constraint which is not a type.")
in
- { utj_val = v;
- utj_type = s }
+ (* Correction of bug #5315 : we need to define an evar for *all* holes *)
+ let evkt = e_new_evar env evdref ~src:(loc, knd) ~naming (mkSort s) in
+ let ev,_ = destEvar !evdref evkt in
+ evdref := Evd.define ev (to_constr !evdref v) !evdref;
+ (* End of correction of bug #5315 *)
+ { utj_val = v;
+ utj_type = s }
| None ->
let env = ltac_interp_name_env k0 lvar env !evdref in
let s = evd_comb0 (new_sort_variable univ_flexible_alg) evdref in
diff --git a/pretyping/recordops.mli b/pretyping/recordops.mli
index de09edcdc..5480b14af 100644
--- a/pretyping/recordops.mli
+++ b/pretyping/recordops.mli
@@ -67,7 +67,7 @@ type obj_typ = {
(** Return the form of the component of a canonical structure *)
val cs_pattern_of_constr : constr -> cs_pattern * int option * constr list
-val pr_cs_pattern : cs_pattern -> Pp.std_ppcmds
+val pr_cs_pattern : cs_pattern -> Pp.t
val lookup_canonical_conversion : (global_reference * cs_pattern) -> constr * obj_typ
val declare_canonical_structure : global_reference -> unit
diff --git a/pretyping/reductionops.ml b/pretyping/reductionops.ml
index 1d75fecb1..356323543 100644
--- a/pretyping/reductionops.ml
+++ b/pretyping/reductionops.ml
@@ -272,7 +272,7 @@ module Stack :
sig
open EConstr
type 'a app_node
- val pr_app_node : ('a -> Pp.std_ppcmds) -> 'a app_node -> Pp.std_ppcmds
+ val pr_app_node : ('a -> Pp.t) -> 'a app_node -> Pp.t
type cst_member =
| Cst_const of pconstant
@@ -290,7 +290,7 @@ sig
exception IncompatibleFold2
- val pr : ('a -> Pp.std_ppcmds) -> 'a t -> Pp.std_ppcmds
+ val pr : ('a -> Pp.t) -> 'a t -> Pp.t
val empty : 'a t
val is_empty : 'a t -> bool
val append_app : 'a array -> 'a t -> 'a t
diff --git a/pretyping/reductionops.mli b/pretyping/reductionops.mli
index db407b6c9..1828196fe 100644
--- a/pretyping/reductionops.mli
+++ b/pretyping/reductionops.mli
@@ -26,7 +26,7 @@ module ReductionBehaviour : sig
bool -> Globnames.global_reference -> (int list * int * flag list) -> unit
val get :
Globnames.global_reference -> (int list * int * flag list) option
- val print : Globnames.global_reference -> Pp.std_ppcmds
+ val print : Globnames.global_reference -> Pp.t
end
(** Option telling if reduction should use the refolding machinery of cbn
@@ -63,13 +63,13 @@ module Cst_stack : sig
val best_cst : t -> (constr * constr list) option
val best_replace : Evd.evar_map -> constr -> t -> constr -> constr
val reference : Evd.evar_map -> t -> Constant.t option
- val pr : t -> Pp.std_ppcmds
+ val pr : t -> Pp.t
end
module Stack : sig
type 'a app_node
- val pr_app_node : ('a -> Pp.std_ppcmds) -> 'a app_node -> Pp.std_ppcmds
+ val pr_app_node : ('a -> Pp.t) -> 'a app_node -> Pp.t
type cst_member =
| Cst_const of pconstant
@@ -86,7 +86,7 @@ module Stack : sig
| Update of 'a
and 'a t = 'a member list
- val pr : ('a -> Pp.std_ppcmds) -> 'a t -> Pp.std_ppcmds
+ val pr : ('a -> Pp.t) -> 'a t -> Pp.t
val empty : 'a t
val is_empty : 'a t -> bool
@@ -145,7 +145,7 @@ type contextual_state_reduction_function =
type state_reduction_function = contextual_state_reduction_function
type local_state_reduction_function = evar_map -> state -> state
-val pr_state : state -> Pp.std_ppcmds
+val pr_state : state -> Pp.t
(** {6 Reduction Function Operators } *)
diff --git a/pretyping/retyping.mli b/pretyping/retyping.mli
index 163d3975a..ed3a9d0f9 100644
--- a/pretyping/retyping.mli
+++ b/pretyping/retyping.mli
@@ -48,4 +48,4 @@ val sorts_of_context : env -> evar_map -> rel_context -> sorts list
val expand_projection : env -> evar_map -> Names.projection -> constr -> constr list -> constr
-val print_retype_error : retype_error -> Pp.std_ppcmds
+val print_retype_error : retype_error -> Pp.t
diff --git a/pretyping/typeclasses.ml b/pretyping/typeclasses.ml
index d4fa266c0..375a8a983 100644
--- a/pretyping/typeclasses.ml
+++ b/pretyping/typeclasses.ml
@@ -84,8 +84,8 @@ type instance = {
is_class: global_reference;
is_info: Vernacexpr.hint_info_expr;
(* Sections where the instance should be redeclared,
- -1 for discard, 0 for none. *)
- is_global: int;
+ None for discard, Some 0 for none. *)
+ is_global: int option;
is_poly: bool;
is_impl: global_reference;
}
@@ -98,9 +98,11 @@ let hint_priority is = is.is_info.Vernacexpr.hint_priority
let new_instance cl info glob poly impl =
let global =
- if glob then Lib.sections_depth ()
- else -1
+ if glob then Some (Lib.sections_depth ())
+ else None
in
+ if match global with Some n -> n>0 && isVarRef impl | _ -> false then
+ CErrors.user_err (Pp.str "Cannot set Global an instance referring to a section variable.");
{ is_class = cl.cl_impl;
is_info = info ;
is_global = global ;
@@ -350,22 +352,34 @@ let subst_instance (subst, (action, inst)) = action,
is_impl = fst (subst_global subst inst.is_impl) }
let discharge_instance (_, (action, inst)) =
- if inst.is_global <= 0 then None
- else Some (action,
+ match inst.is_global with
+ | None -> None
+ | Some n ->
+ assert (not (isVarRef inst.is_impl));
+ Some (action,
{ inst with
- is_global = pred inst.is_global;
+ is_global = Some (pred n);
is_class = Lib.discharge_global inst.is_class;
is_impl = Lib.discharge_global inst.is_impl })
-let is_local i = Int.equal i.is_global (-1)
+let is_local i = (i.is_global == None)
+
+let is_local_for_hint i =
+ match i.is_global with
+ | None -> true (* i.e. either no Global keyword not in section, or in section *)
+ | Some n -> n <> 0 (* i.e. in a section, declare the hint as local
+ since discharge is managed by rebuild_instance which calls again
+ add_instance_hint; don't ask hints to take discharge into account
+ itself *)
let add_instance check inst =
let poly = Global.is_polymorphic inst.is_impl in
- add_instance_hint (IsGlobal inst.is_impl) [inst.is_impl] (is_local inst)
+ let local = is_local_for_hint inst in
+ add_instance_hint (IsGlobal inst.is_impl) [inst.is_impl] local
inst.is_info poly;
List.iter (fun (path, pri, c) -> add_instance_hint (IsConstr c) path
- (is_local inst) pri poly)
+ local pri poly)
(build_subclasses ~check:(check && not (isVarRef inst.is_impl))
(Global.env ()) (Evd.from_env (Global.env ())) inst.is_impl inst.is_info)
@@ -404,6 +418,7 @@ let declare_instance info local glob =
let info = Option.default {hint_priority = None; hint_pattern = None} info in
match class_of_constr Evd.empty (EConstr.of_constr ty) with
| Some (rels, ((tc,_), args) as _cl) ->
+ assert (not (isVarRef glob) || local);
add_instance (new_instance tc info (not local) (Flags.use_polymorphic_flag ()) glob)
| None -> ()
diff --git a/printing/genprint.ml b/printing/genprint.ml
index bb9736d73..543b05024 100644
--- a/printing/genprint.ml
+++ b/printing/genprint.ml
@@ -9,7 +9,7 @@
open Pp
open Genarg
-type 'a printer = 'a -> std_ppcmds
+type 'a printer = 'a -> Pp.t
type ('raw, 'glb, 'top) genprinter = {
raw : 'raw printer;
diff --git a/printing/genprint.mli b/printing/genprint.mli
index 24779a359..130a89c92 100644
--- a/printing/genprint.mli
+++ b/printing/genprint.mli
@@ -8,18 +8,17 @@
(** Entry point for generic printers *)
-open Pp
open Genarg
-type 'a printer = 'a -> std_ppcmds
+type 'a printer = 'a -> Pp.t
-val raw_print : ('raw, 'glb, 'top) genarg_type -> 'raw -> std_ppcmds
+val raw_print : ('raw, 'glb, 'top) genarg_type -> 'raw -> Pp.t
(** Printer for raw level generic arguments. *)
-val glb_print : ('raw, 'glb, 'top) genarg_type -> 'glb -> std_ppcmds
+val glb_print : ('raw, 'glb, 'top) genarg_type -> 'glb -> Pp.t
(** Printer for glob level generic arguments. *)
-val top_print : ('raw, 'glb, 'top) genarg_type -> 'top -> std_ppcmds
+val top_print : ('raw, 'glb, 'top) genarg_type -> 'top -> Pp.t
(** Printer for top level generic arguments. *)
val generic_raw_print : rlevel generic_argument printer
diff --git a/printing/ppconstr.ml b/printing/ppconstr.ml
index cf513321f..4a103cdd2 100644
--- a/printing/ppconstr.ml
+++ b/printing/ppconstr.ml
@@ -15,6 +15,7 @@ open Nameops
open Libnames
open Pputils
open Ppextend
+open Notation_term
open Constrexpr
open Constrexpr_ops
open Decl_kinds
@@ -731,13 +732,13 @@ let tag_var = tag Tag.variable
(sep() ++ if prec_less prec inherited then strm else surround strm)
type term_pr = {
- pr_constr_expr : constr_expr -> std_ppcmds;
- pr_lconstr_expr : constr_expr -> std_ppcmds;
- pr_constr_pattern_expr : constr_pattern_expr -> std_ppcmds;
- pr_lconstr_pattern_expr : constr_pattern_expr -> std_ppcmds
+ pr_constr_expr : constr_expr -> Pp.t;
+ pr_lconstr_expr : constr_expr -> Pp.t;
+ pr_constr_pattern_expr : constr_pattern_expr -> Pp.t;
+ pr_lconstr_pattern_expr : constr_pattern_expr -> Pp.t
}
- type precedence = Ppextend.precedence * Ppextend.parenRelation
+ type precedence = Notation_term.precedence * Notation_term.parenRelation
let modular_constr_pr = pr
let rec fix rf x = rf (fix rf) x
let pr = fix modular_constr_pr mt
diff --git a/printing/ppconstr.mli b/printing/ppconstr.mli
index fd232759e..7546c748d 100644
--- a/printing/ppconstr.mli
+++ b/printing/ppconstr.mli
@@ -9,14 +9,13 @@
(** This module implements pretty-printers for constr_expr syntactic
objects and their subcomponents. *)
-(** The default pretty-printers produce {!Pp.std_ppcmds} that are
- interpreted as raw strings. *)
+(** The default pretty-printers produce pretty-printing commands ({!Pp.t}). *)
open Loc
-open Pp
open Libnames
open Constrexpr
open Names
open Misctypes
+open Notation_term
val extract_lam_binders :
constr_expr -> local_binder_expr list * constr_expr
@@ -26,47 +25,47 @@ val split_fix :
int -> constr_expr -> constr_expr ->
local_binder_expr list * constr_expr * constr_expr
-val prec_less : int -> int * Ppextend.parenRelation -> bool
+val prec_less : precedence -> tolerability -> bool
-val pr_tight_coma : unit -> std_ppcmds
+val pr_tight_coma : unit -> Pp.t
-val pr_or_var : ('a -> std_ppcmds) -> 'a or_var -> std_ppcmds
+val pr_or_var : ('a -> Pp.t) -> 'a or_var -> Pp.t
-val pr_lident : Id.t located -> std_ppcmds
-val pr_lname : Name.t located -> std_ppcmds
+val pr_lident : Id.t located -> Pp.t
+val pr_lname : Name.t located -> Pp.t
-val pr_with_comments : ?loc:Loc.t -> std_ppcmds -> std_ppcmds
-val pr_com_at : int -> std_ppcmds
+val pr_with_comments : ?loc:Loc.t -> Pp.t -> Pp.t
+val pr_com_at : int -> Pp.t
val pr_sep_com :
- (unit -> std_ppcmds) ->
- (constr_expr -> std_ppcmds) ->
- constr_expr -> std_ppcmds
+ (unit -> Pp.t) ->
+ (constr_expr -> Pp.t) ->
+ constr_expr -> Pp.t
-val pr_id : Id.t -> std_ppcmds
-val pr_name : Name.t -> std_ppcmds
-val pr_qualid : qualid -> std_ppcmds
-val pr_patvar : patvar -> std_ppcmds
+val pr_id : Id.t -> Pp.t
+val pr_name : Name.t -> Pp.t
+val pr_qualid : qualid -> Pp.t
+val pr_patvar : patvar -> Pp.t
-val pr_glob_level : glob_level -> std_ppcmds
-val pr_glob_sort : glob_sort -> std_ppcmds
-val pr_guard_annot : (constr_expr -> std_ppcmds) ->
+val pr_glob_level : glob_level -> Pp.t
+val pr_glob_sort : glob_sort -> Pp.t
+val pr_guard_annot : (constr_expr -> Pp.t) ->
local_binder_expr list ->
('a * Names.Id.t) option * recursion_order_expr ->
- std_ppcmds
+ Pp.t
-val pr_record_body : (reference * constr_expr) list -> std_ppcmds
-val pr_binders : local_binder_expr list -> std_ppcmds
-val pr_constr_pattern_expr : constr_pattern_expr -> std_ppcmds
-val pr_lconstr_pattern_expr : constr_pattern_expr -> std_ppcmds
-val pr_constr_expr : constr_expr -> std_ppcmds
-val pr_lconstr_expr : constr_expr -> std_ppcmds
-val pr_cases_pattern_expr : cases_pattern_expr -> std_ppcmds
+val pr_record_body : (reference * constr_expr) list -> Pp.t
+val pr_binders : local_binder_expr list -> Pp.t
+val pr_constr_pattern_expr : constr_pattern_expr -> Pp.t
+val pr_lconstr_pattern_expr : constr_pattern_expr -> Pp.t
+val pr_constr_expr : constr_expr -> Pp.t
+val pr_lconstr_expr : constr_expr -> Pp.t
+val pr_cases_pattern_expr : cases_pattern_expr -> Pp.t
type term_pr = {
- pr_constr_expr : constr_expr -> std_ppcmds;
- pr_lconstr_expr : constr_expr -> std_ppcmds;
- pr_constr_pattern_expr : constr_pattern_expr -> std_ppcmds;
- pr_lconstr_pattern_expr : constr_pattern_expr -> std_ppcmds
+ pr_constr_expr : constr_expr -> Pp.t;
+ pr_lconstr_expr : constr_expr -> Pp.t;
+ pr_constr_pattern_expr : constr_pattern_expr -> Pp.t;
+ pr_lconstr_pattern_expr : constr_pattern_expr -> Pp.t
}
val set_term_pr : term_pr -> unit
@@ -91,5 +90,5 @@ type precedence
val lsimpleconstr : precedence
val ltop : precedence
val modular_constr_pr :
- ((unit->std_ppcmds) -> precedence -> constr_expr -> std_ppcmds) ->
- (unit->std_ppcmds) -> precedence -> constr_expr -> std_ppcmds
+ ((unit->Pp.t) -> precedence -> constr_expr -> Pp.t) ->
+ (unit->Pp.t) -> precedence -> constr_expr -> Pp.t
diff --git a/printing/pputils.mli b/printing/pputils.mli
index 0dee11e0b..1f4fa1390 100644
--- a/printing/pputils.mli
+++ b/printing/pputils.mli
@@ -6,26 +6,25 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-open Pp
open Genarg
open Misctypes
open Locus
open Genredexpr
-val pr_located : ('a -> std_ppcmds) -> 'a Loc.located -> std_ppcmds
+val pr_located : ('a -> Pp.t) -> 'a Loc.located -> Pp.t
(** Prints an object surrounded by its commented location *)
-val pr_or_var : ('a -> std_ppcmds) -> 'a or_var -> std_ppcmds
-val pr_or_by_notation : ('a -> std_ppcmds) -> 'a or_by_notation -> std_ppcmds
+val pr_or_var : ('a -> Pp.t) -> 'a or_var -> Pp.t
+val pr_or_by_notation : ('a -> Pp.t) -> 'a or_by_notation -> Pp.t
val pr_with_occurrences :
- ('a -> std_ppcmds) -> (string -> std_ppcmds) -> 'a with_occurrences -> std_ppcmds
+ ('a -> Pp.t) -> (string -> Pp.t) -> 'a with_occurrences -> Pp.t
-val pr_short_red_flag : ('a -> std_ppcmds) -> 'a glob_red_flag -> std_ppcmds
-val pr_red_flag : ('a -> std_ppcmds) -> 'a glob_red_flag -> std_ppcmds
+val pr_short_red_flag : ('a -> Pp.t) -> 'a glob_red_flag -> Pp.t
+val pr_red_flag : ('a -> Pp.t) -> 'a glob_red_flag -> Pp.t
val pr_red_expr :
- ('a -> std_ppcmds) * ('a -> std_ppcmds) * ('b -> std_ppcmds) * ('c -> std_ppcmds) ->
- (string -> std_ppcmds) ->
- ('a,'b,'c) red_expr_gen -> std_ppcmds
+ ('a -> Pp.t) * ('a -> Pp.t) * ('b -> Pp.t) * ('c -> Pp.t) ->
+ (string -> Pp.t) ->
+ ('a,'b,'c) red_expr_gen -> Pp.t
-val pr_raw_generic : Environ.env -> rlevel generic_argument -> std_ppcmds
-val pr_glb_generic : Environ.env -> glevel generic_argument -> std_ppcmds
+val pr_raw_generic : Environ.env -> rlevel generic_argument -> Pp.t
+val pr_glb_generic : Environ.env -> glevel generic_argument -> Pp.t
diff --git a/printing/ppvernac.ml b/printing/ppvernac.ml
index a68b569cb..4c50c2f36 100644
--- a/printing/ppvernac.ml
+++ b/printing/ppvernac.ml
@@ -760,7 +760,11 @@ open Decl_kinds
| Class _ -> "Class" | Variant -> "Variant"
in
if p then
- let cm = if cum then "Cumulative" else "NonCumulative" in
+ let cm =
+ match cum with
+ | GlobalCumulativity | LocalCumulativity -> "Cumulative"
+ | GlobalNonCumulativity | LocalNonCumulativity -> "NonCumulative"
+ in
cm ^ " " ^ kind
else kind
in
diff --git a/printing/ppvernac.mli b/printing/ppvernac.mli
index ed5585b30..b88eed484 100644
--- a/printing/ppvernac.mli
+++ b/printing/ppvernac.mli
@@ -10,10 +10,10 @@
objects and their subcomponents. *)
(** Prints a fixpoint body *)
-val pr_rec_definition : (Vernacexpr.fixpoint_expr * Vernacexpr.decl_notation list) -> Pp.std_ppcmds
+val pr_rec_definition : (Vernacexpr.fixpoint_expr * Vernacexpr.decl_notation list) -> Pp.t
(** Prints a vernac expression *)
-val pr_vernac_body : Vernacexpr.vernac_expr -> Pp.std_ppcmds
+val pr_vernac_body : Vernacexpr.vernac_expr -> Pp.t
(** Prints a vernac expression and closes it with a dot. *)
-val pr_vernac : Vernacexpr.vernac_expr -> Pp.std_ppcmds
+val pr_vernac : Vernacexpr.vernac_expr -> Pp.t
diff --git a/printing/prettyp.ml b/printing/prettyp.ml
index 17249262e..09859157c 100644
--- a/printing/prettyp.ml
+++ b/printing/prettyp.ml
@@ -33,17 +33,17 @@ open Context.Rel.Declaration
module NamedDecl = Context.Named.Declaration
type object_pr = {
- print_inductive : mutual_inductive -> std_ppcmds;
- print_constant_with_infos : constant -> std_ppcmds;
- print_section_variable : variable -> std_ppcmds;
- print_syntactic_def : kernel_name -> std_ppcmds;
- print_module : bool -> Names.module_path -> std_ppcmds;
- print_modtype : module_path -> std_ppcmds;
- print_named_decl : Context.Named.Declaration.t -> std_ppcmds;
- print_library_entry : bool -> (object_name * Lib.node) -> std_ppcmds option;
- print_context : bool -> int option -> Lib.library_segment -> std_ppcmds;
- print_typed_value_in_env : Environ.env -> Evd.evar_map -> EConstr.constr * EConstr.types -> Pp.std_ppcmds;
- print_eval : Reductionops.reduction_function -> env -> Evd.evar_map -> Constrexpr.constr_expr -> EConstr.unsafe_judgment -> std_ppcmds;
+ print_inductive : mutual_inductive -> Pp.t;
+ print_constant_with_infos : constant -> Pp.t;
+ print_section_variable : variable -> Pp.t;
+ print_syntactic_def : kernel_name -> Pp.t;
+ print_module : bool -> Names.module_path -> Pp.t;
+ print_modtype : module_path -> Pp.t;
+ print_named_decl : Context.Named.Declaration.t -> Pp.t;
+ print_library_entry : bool -> (object_name * Lib.node) -> Pp.t option;
+ print_context : bool -> int option -> Lib.library_segment -> Pp.t;
+ print_typed_value_in_env : Environ.env -> Evd.evar_map -> EConstr.constr * EConstr.types -> Pp.t;
+ print_eval : Reductionops.reduction_function -> env -> Evd.evar_map -> Constrexpr.constr_expr -> EConstr.unsafe_judgment -> Pp.t;
}
let gallina_print_module = print_module
diff --git a/printing/prettyp.mli b/printing/prettyp.mli
index 4add21fa7..f4277b6c5 100644
--- a/printing/prettyp.mli
+++ b/printing/prettyp.mli
@@ -6,7 +6,6 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-open Pp
open Names
open Environ
open Reductionops
@@ -19,57 +18,57 @@ open Misctypes
val assumptions_for_print : Name.t list -> Termops.names_context
val print_closed_sections : bool ref
-val print_context : bool -> int option -> Lib.library_segment -> std_ppcmds
-val print_library_entry : bool -> (object_name * Lib.node) -> std_ppcmds option
-val print_full_context : unit -> std_ppcmds
-val print_full_context_typ : unit -> std_ppcmds
-val print_full_pure_context : unit -> std_ppcmds
-val print_sec_context : reference -> std_ppcmds
-val print_sec_context_typ : reference -> std_ppcmds
-val print_judgment : env -> Evd.evar_map -> EConstr.unsafe_judgment -> std_ppcmds
-val print_safe_judgment : env -> Evd.evar_map -> Safe_typing.judgment -> std_ppcmds
+val print_context : bool -> int option -> Lib.library_segment -> Pp.t
+val print_library_entry : bool -> (object_name * Lib.node) -> Pp.t option
+val print_full_context : unit -> Pp.t
+val print_full_context_typ : unit -> Pp.t
+val print_full_pure_context : unit -> Pp.t
+val print_sec_context : reference -> Pp.t
+val print_sec_context_typ : reference -> Pp.t
+val print_judgment : env -> Evd.evar_map -> EConstr.unsafe_judgment -> Pp.t
+val print_safe_judgment : env -> Evd.evar_map -> Safe_typing.judgment -> Pp.t
val print_eval :
reduction_function -> env -> Evd.evar_map ->
- Constrexpr.constr_expr -> EConstr.unsafe_judgment -> std_ppcmds
+ Constrexpr.constr_expr -> EConstr.unsafe_judgment -> Pp.t
-val print_name : reference or_by_notation -> std_ppcmds
-val print_opaque_name : reference -> std_ppcmds
-val print_about : reference or_by_notation -> std_ppcmds
-val print_impargs : reference or_by_notation -> std_ppcmds
+val print_name : reference or_by_notation -> Pp.t
+val print_opaque_name : reference -> Pp.t
+val print_about : reference or_by_notation -> Pp.t
+val print_impargs : reference or_by_notation -> Pp.t
(** Pretty-printing functions for classes and coercions *)
-val print_graph : unit -> std_ppcmds
-val print_classes : unit -> std_ppcmds
-val print_coercions : unit -> std_ppcmds
-val print_path_between : Classops.cl_typ -> Classops.cl_typ -> std_ppcmds
-val print_canonical_projections : unit -> std_ppcmds
+val print_graph : unit -> Pp.t
+val print_classes : unit -> Pp.t
+val print_coercions : unit -> Pp.t
+val print_path_between : Classops.cl_typ -> Classops.cl_typ -> Pp.t
+val print_canonical_projections : unit -> Pp.t
(** Pretty-printing functions for type classes and instances *)
-val print_typeclasses : unit -> std_ppcmds
-val print_instances : global_reference -> std_ppcmds
-val print_all_instances : unit -> std_ppcmds
+val print_typeclasses : unit -> Pp.t
+val print_instances : global_reference -> Pp.t
+val print_all_instances : unit -> Pp.t
-val inspect : int -> std_ppcmds
+val inspect : int -> Pp.t
(** Locate *)
-val print_located_qualid : reference -> std_ppcmds
-val print_located_term : reference -> std_ppcmds
-val print_located_tactic : reference -> std_ppcmds
-val print_located_module : reference -> std_ppcmds
+val print_located_qualid : reference -> Pp.t
+val print_located_term : reference -> Pp.t
+val print_located_tactic : reference -> Pp.t
+val print_located_module : reference -> Pp.t
type object_pr = {
- print_inductive : mutual_inductive -> std_ppcmds;
- print_constant_with_infos : constant -> std_ppcmds;
- print_section_variable : variable -> std_ppcmds;
- print_syntactic_def : kernel_name -> std_ppcmds;
- print_module : bool -> Names.module_path -> std_ppcmds;
- print_modtype : module_path -> std_ppcmds;
- print_named_decl : Context.Named.Declaration.t -> std_ppcmds;
- print_library_entry : bool -> (object_name * Lib.node) -> std_ppcmds option;
- print_context : bool -> int option -> Lib.library_segment -> std_ppcmds;
- print_typed_value_in_env : Environ.env -> Evd.evar_map -> EConstr.constr * EConstr.types -> Pp.std_ppcmds;
- print_eval : reduction_function -> env -> Evd.evar_map -> Constrexpr.constr_expr -> EConstr.unsafe_judgment -> std_ppcmds
+ print_inductive : mutual_inductive -> Pp.t;
+ print_constant_with_infos : constant -> Pp.t;
+ print_section_variable : variable -> Pp.t;
+ print_syntactic_def : kernel_name -> Pp.t;
+ print_module : bool -> Names.module_path -> Pp.t;
+ print_modtype : module_path -> Pp.t;
+ print_named_decl : Context.Named.Declaration.t -> Pp.t;
+ print_library_entry : bool -> (object_name * Lib.node) -> Pp.t option;
+ print_context : bool -> int option -> Lib.library_segment -> Pp.t;
+ print_typed_value_in_env : Environ.env -> Evd.evar_map -> EConstr.constr * EConstr.types -> Pp.t;
+ print_eval : reduction_function -> env -> Evd.evar_map -> Constrexpr.constr_expr -> EConstr.unsafe_judgment -> Pp.t
}
val set_object_pr : object_pr -> unit
diff --git a/printing/printer.ml b/printing/printer.ml
index 351678802..28b10c781 100644
--- a/printing/printer.ml
+++ b/printing/printer.ml
@@ -79,23 +79,23 @@ let _ =
and only names of goal/section variables and rel names that do
_not_ occur in the scope of the binder to be printed are avoided. *)
-let pr_constr_core goal_concl_style env sigma t =
+let pr_econstr_core goal_concl_style env sigma t =
pr_constr_expr (extern_constr goal_concl_style env sigma t)
-let pr_lconstr_core goal_concl_style env sigma t =
+let pr_leconstr_core goal_concl_style env sigma t =
pr_lconstr_expr (extern_constr goal_concl_style env sigma t)
-let pr_lconstr_env env = pr_lconstr_core false env
-let pr_constr_env env = pr_constr_core false env
+let pr_lconstr_env env sigma c = pr_leconstr_core false env sigma (EConstr.of_constr c)
+let pr_constr_env env sigma c = pr_econstr_core false env sigma (EConstr.of_constr c)
let _ = Hook.set Refine.pr_constr pr_constr_env
-let pr_lconstr_goal_style_env env = pr_lconstr_core true env
-let pr_constr_goal_style_env env = pr_constr_core true env
+let pr_lconstr_goal_style_env env sigma c = pr_leconstr_core true env sigma (EConstr.of_constr c)
+let pr_constr_goal_style_env env sigma c = pr_econstr_core true env sigma (EConstr.of_constr c)
let pr_open_lconstr_env env sigma (_,c) = pr_lconstr_env env sigma c
let pr_open_constr_env env sigma (_,c) = pr_constr_env env sigma c
-let pr_leconstr_env env sigma c = pr_lconstr_env env sigma (EConstr.to_constr sigma c)
-let pr_econstr_env env sigma c = pr_constr_env env sigma (EConstr.to_constr sigma c)
+let pr_leconstr_env env sigma c = pr_leconstr_core false env sigma c
+let pr_econstr_env env sigma c = pr_econstr_core false env sigma c
(* NB do not remove the eta-redexes! Global.env() has side-effects... *)
let pr_lconstr t =
@@ -128,13 +128,13 @@ let pr_lconstr_under_binders c =
let (sigma, env) = get_current_context () in
pr_lconstr_under_binders_env env sigma c
-let pr_type_core goal_concl_style env sigma t =
+let pr_etype_core goal_concl_style env sigma t =
pr_constr_expr (extern_type goal_concl_style env sigma t)
-let pr_ltype_core goal_concl_style env sigma t =
+let pr_letype_core goal_concl_style env sigma t =
pr_lconstr_expr (extern_type goal_concl_style env sigma t)
-let pr_ltype_env env = pr_ltype_core false env
-let pr_type_env env = pr_type_core false env
+let pr_ltype_env env sigma c = pr_letype_core false env sigma (EConstr.of_constr c)
+let pr_type_env env sigma c = pr_etype_core false env sigma (EConstr.of_constr c)
let pr_ltype t =
let (sigma, env) = get_current_context () in
@@ -143,10 +143,9 @@ let pr_type t =
let (sigma, env) = get_current_context () in
pr_type_env env sigma t
-let pr_etype_env env sigma c = pr_type_env env sigma (EConstr.to_constr sigma c)
-let pr_letype_env env sigma c = pr_ltype_env env sigma (EConstr.to_constr sigma c)
-let pr_goal_concl_style_env env sigma c =
- pr_ltype_core true env sigma (EConstr.to_constr sigma c)
+let pr_etype_env env sigma c = pr_etype_core false env sigma c
+let pr_letype_env env sigma c = pr_letype_core false env sigma c
+let pr_goal_concl_style_env env sigma c = pr_letype_core true env sigma c
let pr_ljudge_env env sigma j =
(pr_leconstr_env env sigma j.uj_val, pr_leconstr_env env sigma j.uj_type)
@@ -191,7 +190,7 @@ let pr_constr_pattern t =
let pr_sort sigma s = pr_glob_sort (extern_sort sigma s)
let _ = Termops.set_print_constr
- (fun env sigma t -> pr_lconstr_expr (extern_constr ~lax:true false env sigma (EConstr.Unsafe.to_constr t)))
+ (fun env sigma t -> pr_lconstr_expr (extern_constr ~lax:true false env sigma t))
let pr_in_comment pr x = str "(* " ++ pr x ++ str " *)"
@@ -364,6 +363,7 @@ let pr_named_context env sigma ne_context =
ne_context ~init:(mt ()))
let pr_rel_context env sigma rel_context =
+ let rel_context = List.map (fun d -> Termops.map_rel_decl EConstr.of_constr d) rel_context in
pr_binders (extern_rel_context None env sigma rel_context)
let pr_rel_context_of env sigma =
@@ -479,7 +479,8 @@ let pr_transparent_state (ids, csts) =
(* display complete goal *)
let default_pr_goal gs =
- let (g,sigma) = Goal.V82.nf_evar (project gs) (sig_it gs) in
+ let g = sig_it gs in
+ let sigma = project gs in
let env = Goal.V82.env sigma g in
let concl = Goal.V82.concl sigma g in
let goal =
@@ -727,7 +728,7 @@ let default_pr_subgoals ?(pr_first=true)
match goals with
| [] ->
begin
- let exl = Evarutil.non_instantiated sigma in
+ let exl = Evd.undefined_map sigma in
if Evar.Map.is_empty exl then
(str"No more subgoals." ++ print_dependent_evars None sigma seeds)
else
@@ -758,9 +759,9 @@ let default_pr_subgoals ?(pr_first=true)
type printer_pr = {
- pr_subgoals : ?pr_first:bool -> std_ppcmds option -> evar_map -> evar list -> Goal.goal list -> int list -> goal list -> goal list -> std_ppcmds;
- pr_subgoal : int -> evar_map -> goal list -> std_ppcmds;
- pr_goal : goal sigma -> std_ppcmds;
+ pr_subgoals : ?pr_first:bool -> Pp.t option -> evar_map -> evar list -> Goal.goal list -> int list -> goal list -> goal list -> Pp.t;
+ pr_subgoal : int -> evar_map -> goal list -> Pp.t;
+ pr_goal : goal sigma -> Pp.t;
}
let default_printer_pr = {
@@ -845,15 +846,6 @@ let pr_goal_by_uid uid =
(* Elementary tactics *)
let pr_prim_rule = function
- | Cut (b,replace,id,t) ->
- if b then
- (* TODO: express "replace" *)
- (str"assert " ++ str"(" ++ pr_id id ++ str":" ++ pr_lconstr t ++ str")")
- else
- let cl = if replace then str"clear " ++ pr_id id ++ str"; " else mt() in
- (str"cut " ++ pr_constr t ++
- str ";[" ++ cl ++ str"intro " ++ pr_id id ++ str"|idtac]")
-
| Refine c ->
(** FIXME *)
str(if Termops.occur_meta Evd.empty (EConstr.of_constr c) then "refine " else "exact ") ++
diff --git a/printing/printer.mli b/printing/printer.mli
index f8685b089..2c9a4d70e 100644
--- a/printing/printer.mli
+++ b/printing/printer.mli
@@ -6,7 +6,6 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-open Pp
open Names
open Globnames
open Term
@@ -25,96 +24,96 @@ val enable_goal_names_printing : bool ref
(** Terms *)
-val pr_lconstr_env : env -> evar_map -> constr -> std_ppcmds
-val pr_lconstr : constr -> std_ppcmds
-val pr_lconstr_goal_style_env : env -> evar_map -> constr -> std_ppcmds
+val pr_lconstr_env : env -> evar_map -> constr -> Pp.t
+val pr_lconstr : constr -> Pp.t
+val pr_lconstr_goal_style_env : env -> evar_map -> constr -> Pp.t
-val pr_constr_env : env -> evar_map -> constr -> std_ppcmds
-val pr_constr : constr -> std_ppcmds
-val pr_constr_goal_style_env : env -> evar_map -> constr -> std_ppcmds
+val pr_constr_env : env -> evar_map -> constr -> Pp.t
+val pr_constr : constr -> Pp.t
+val pr_constr_goal_style_env : env -> evar_map -> constr -> Pp.t
(** Same, but resilient to [Nametab] errors. Prints fully-qualified
names when [shortest_qualid_of_global] has failed. Prints "??"
in case of remaining issues (such as reference not in env). *)
-val safe_pr_lconstr_env : env -> evar_map -> constr -> std_ppcmds
-val safe_pr_lconstr : constr -> std_ppcmds
+val safe_pr_lconstr_env : env -> evar_map -> constr -> Pp.t
+val safe_pr_lconstr : constr -> Pp.t
-val safe_pr_constr_env : env -> evar_map -> constr -> std_ppcmds
-val safe_pr_constr : constr -> std_ppcmds
+val safe_pr_constr_env : env -> evar_map -> constr -> Pp.t
+val safe_pr_constr : constr -> Pp.t
-val pr_econstr_env : env -> evar_map -> EConstr.t -> std_ppcmds
-val pr_econstr : EConstr.t -> std_ppcmds
-val pr_leconstr_env : env -> evar_map -> EConstr.t -> std_ppcmds
-val pr_leconstr : EConstr.t -> std_ppcmds
+val pr_econstr_env : env -> evar_map -> EConstr.t -> Pp.t
+val pr_econstr : EConstr.t -> Pp.t
+val pr_leconstr_env : env -> evar_map -> EConstr.t -> Pp.t
+val pr_leconstr : EConstr.t -> Pp.t
-val pr_etype_env : env -> evar_map -> EConstr.types -> std_ppcmds
-val pr_letype_env : env -> evar_map -> EConstr.types -> std_ppcmds
+val pr_etype_env : env -> evar_map -> EConstr.types -> Pp.t
+val pr_letype_env : env -> evar_map -> EConstr.types -> Pp.t
-val pr_open_constr_env : env -> evar_map -> open_constr -> std_ppcmds
-val pr_open_constr : open_constr -> std_ppcmds
+val pr_open_constr_env : env -> evar_map -> open_constr -> Pp.t
+val pr_open_constr : open_constr -> Pp.t
-val pr_open_lconstr_env : env -> evar_map -> open_constr -> std_ppcmds
-val pr_open_lconstr : open_constr -> std_ppcmds
+val pr_open_lconstr_env : env -> evar_map -> open_constr -> Pp.t
+val pr_open_lconstr : open_constr -> Pp.t
-val pr_constr_under_binders_env : env -> evar_map -> constr_under_binders -> std_ppcmds
-val pr_constr_under_binders : constr_under_binders -> std_ppcmds
+val pr_constr_under_binders_env : env -> evar_map -> constr_under_binders -> Pp.t
+val pr_constr_under_binders : constr_under_binders -> Pp.t
-val pr_lconstr_under_binders_env : env -> evar_map -> constr_under_binders -> std_ppcmds
-val pr_lconstr_under_binders : constr_under_binders -> std_ppcmds
+val pr_lconstr_under_binders_env : env -> evar_map -> constr_under_binders -> Pp.t
+val pr_lconstr_under_binders : constr_under_binders -> Pp.t
-val pr_goal_concl_style_env : env -> evar_map -> EConstr.types -> std_ppcmds
-val pr_ltype_env : env -> evar_map -> types -> std_ppcmds
-val pr_ltype : types -> std_ppcmds
+val pr_goal_concl_style_env : env -> evar_map -> EConstr.types -> Pp.t
+val pr_ltype_env : env -> evar_map -> types -> Pp.t
+val pr_ltype : types -> Pp.t
-val pr_type_env : env -> evar_map -> types -> std_ppcmds
-val pr_type : types -> std_ppcmds
+val pr_type_env : env -> evar_map -> types -> Pp.t
+val pr_type : types -> Pp.t
-val pr_closed_glob_env : env -> evar_map -> closed_glob_constr -> std_ppcmds
-val pr_closed_glob : closed_glob_constr -> std_ppcmds
+val pr_closed_glob_env : env -> evar_map -> closed_glob_constr -> Pp.t
+val pr_closed_glob : closed_glob_constr -> Pp.t
-val pr_ljudge_env : env -> evar_map -> EConstr.unsafe_judgment -> std_ppcmds * std_ppcmds
-val pr_ljudge : EConstr.unsafe_judgment -> std_ppcmds * std_ppcmds
+val pr_ljudge_env : env -> evar_map -> EConstr.unsafe_judgment -> Pp.t * Pp.t
+val pr_ljudge : EConstr.unsafe_judgment -> Pp.t * Pp.t
-val pr_lglob_constr_env : env -> glob_constr -> std_ppcmds
-val pr_lglob_constr : glob_constr -> std_ppcmds
+val pr_lglob_constr_env : env -> glob_constr -> Pp.t
+val pr_lglob_constr : glob_constr -> Pp.t
-val pr_glob_constr_env : env -> glob_constr -> std_ppcmds
-val pr_glob_constr : glob_constr -> std_ppcmds
+val pr_glob_constr_env : env -> glob_constr -> Pp.t
+val pr_glob_constr : glob_constr -> Pp.t
-val pr_lconstr_pattern_env : env -> evar_map -> constr_pattern -> std_ppcmds
-val pr_lconstr_pattern : constr_pattern -> std_ppcmds
+val pr_lconstr_pattern_env : env -> evar_map -> constr_pattern -> Pp.t
+val pr_lconstr_pattern : constr_pattern -> Pp.t
-val pr_constr_pattern_env : env -> evar_map -> constr_pattern -> std_ppcmds
-val pr_constr_pattern : constr_pattern -> std_ppcmds
+val pr_constr_pattern_env : env -> evar_map -> constr_pattern -> Pp.t
+val pr_constr_pattern : constr_pattern -> Pp.t
-val pr_cases_pattern : cases_pattern -> std_ppcmds
+val pr_cases_pattern : cases_pattern -> Pp.t
-val pr_sort : evar_map -> sorts -> std_ppcmds
+val pr_sort : evar_map -> sorts -> Pp.t
(** Universe constraints *)
-val pr_polymorphic : bool -> std_ppcmds
-val pr_cumulative : bool -> bool -> std_ppcmds
-val pr_universe_instance : evar_map -> Univ.universe_context -> std_ppcmds
-val pr_universe_ctx : evar_map -> Univ.universe_context -> std_ppcmds
-val pr_cumulativity_info : evar_map -> Univ.cumulativity_info -> std_ppcmds
+val pr_polymorphic : bool -> Pp.t
+val pr_cumulative : bool -> bool -> Pp.t
+val pr_universe_instance : evar_map -> Univ.universe_context -> Pp.t
+val pr_universe_ctx : evar_map -> Univ.universe_context -> Pp.t
+val pr_cumulativity_info : evar_map -> Univ.cumulativity_info -> Pp.t
(** Printing global references using names as short as possible *)
-val pr_global_env : Id.Set.t -> global_reference -> std_ppcmds
-val pr_global : global_reference -> std_ppcmds
+val pr_global_env : Id.Set.t -> global_reference -> Pp.t
+val pr_global : global_reference -> Pp.t
-val pr_constant : env -> constant -> std_ppcmds
-val pr_existential_key : evar_map -> existential_key -> std_ppcmds
-val pr_existential : env -> evar_map -> existential -> std_ppcmds
-val pr_constructor : env -> constructor -> std_ppcmds
-val pr_inductive : env -> inductive -> std_ppcmds
-val pr_evaluable_reference : evaluable_global_reference -> std_ppcmds
+val pr_constant : env -> constant -> Pp.t
+val pr_existential_key : evar_map -> existential_key -> Pp.t
+val pr_existential : env -> evar_map -> existential -> Pp.t
+val pr_constructor : env -> constructor -> Pp.t
+val pr_inductive : env -> inductive -> Pp.t
+val pr_evaluable_reference : evaluable_global_reference -> Pp.t
-val pr_pconstant : env -> pconstant -> std_ppcmds
-val pr_pinductive : env -> pinductive -> std_ppcmds
-val pr_pconstructor : env -> pconstructor -> std_ppcmds
+val pr_pconstant : env -> pconstant -> Pp.t
+val pr_pinductive : env -> pinductive -> Pp.t
+val pr_pconstructor : env -> pconstructor -> Pp.t
(** Contexts *)
@@ -122,29 +121,29 @@ val pr_pconstructor : env -> pconstructor -> std_ppcmds
val set_compact_context : bool -> unit
val get_compact_context : unit -> bool
-val pr_context_unlimited : env -> evar_map -> std_ppcmds
-val pr_ne_context_of : std_ppcmds -> env -> evar_map -> std_ppcmds
+val pr_context_unlimited : env -> evar_map -> Pp.t
+val pr_ne_context_of : Pp.t -> env -> evar_map -> Pp.t
-val pr_named_decl : env -> evar_map -> Context.Named.Declaration.t -> std_ppcmds
-val pr_compacted_decl : env -> evar_map -> Context.Compacted.Declaration.t -> std_ppcmds
-val pr_rel_decl : env -> evar_map -> Context.Rel.Declaration.t -> std_ppcmds
+val pr_named_decl : env -> evar_map -> Context.Named.Declaration.t -> Pp.t
+val pr_compacted_decl : env -> evar_map -> Context.Compacted.Declaration.t -> Pp.t
+val pr_rel_decl : env -> evar_map -> Context.Rel.Declaration.t -> Pp.t
-val pr_named_context : env -> evar_map -> Context.Named.t -> std_ppcmds
-val pr_named_context_of : env -> evar_map -> std_ppcmds
-val pr_rel_context : env -> evar_map -> Context.Rel.t -> std_ppcmds
-val pr_rel_context_of : env -> evar_map -> std_ppcmds
-val pr_context_of : env -> evar_map -> std_ppcmds
+val pr_named_context : env -> evar_map -> Context.Named.t -> Pp.t
+val pr_named_context_of : env -> evar_map -> Pp.t
+val pr_rel_context : env -> evar_map -> Context.Rel.t -> Pp.t
+val pr_rel_context_of : env -> evar_map -> Pp.t
+val pr_context_of : env -> evar_map -> Pp.t
(** Predicates *)
-val pr_predicate : ('a -> std_ppcmds) -> (bool * 'a list) -> std_ppcmds
-val pr_cpred : Cpred.t -> std_ppcmds
-val pr_idpred : Id.Pred.t -> std_ppcmds
-val pr_transparent_state : transparent_state -> std_ppcmds
+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
(** Proofs, these functions obey [Hyps Limit] and [Compact contexts]. *)
-val pr_goal : goal sigma -> std_ppcmds
+val pr_goal : goal sigma -> Pp.t
(** [pr_subgoals ~pr_first pp sigma seeds shelf focus_stack unfocused goals]
prints the goals of the list [goals] followed by the goals in
@@ -155,25 +154,25 @@ val pr_goal : goal sigma -> std_ppcmds
focused goals unless the conrresponding option
[enable_unfocused_goal_printing] is set. [seeds] is for printing
dependent evars (mainly for emacs proof tree mode). *)
-val pr_subgoals : ?pr_first:bool -> std_ppcmds option -> evar_map -> evar list -> Goal.goal list -> int list
- -> goal list -> goal list -> std_ppcmds
+val pr_subgoals : ?pr_first:bool -> Pp.t option -> evar_map -> evar list -> Goal.goal list -> int list
+ -> goal list -> goal list -> Pp.t
-val pr_subgoal : int -> evar_map -> goal list -> std_ppcmds
-val pr_concl : int -> evar_map -> goal -> std_ppcmds
+val pr_subgoal : int -> evar_map -> goal list -> Pp.t
+val pr_concl : int -> evar_map -> goal -> Pp.t
-val pr_open_subgoals : ?proof:Proof.proof -> unit -> std_ppcmds
-val pr_nth_open_subgoal : int -> std_ppcmds
-val pr_evar : evar_map -> (evar * evar_info) -> std_ppcmds
-val pr_evars_int : evar_map -> int -> evar_info Evar.Map.t -> std_ppcmds
-val pr_evars : evar_map -> evar_info Evar.Map.t -> std_ppcmds
-val pr_ne_evar_set : std_ppcmds -> std_ppcmds -> evar_map ->
- Evar.Set.t -> std_ppcmds
+val pr_open_subgoals : ?proof:Proof.proof -> unit -> Pp.t
+val pr_nth_open_subgoal : int -> Pp.t
+val pr_evar : evar_map -> (evar * evar_info) -> Pp.t
+val pr_evars_int : evar_map -> int -> evar_info Evar.Map.t -> Pp.t
+val pr_evars : evar_map -> evar_info Evar.Map.t -> Pp.t
+val pr_ne_evar_set : Pp.t -> Pp.t -> evar_map ->
+ Evar.Set.t -> Pp.t
-val pr_prim_rule : prim_rule -> std_ppcmds
+val pr_prim_rule : prim_rule -> Pp.t
(** Backwards compatibility *)
-val prterm : constr -> std_ppcmds (** = pr_lconstr *)
+val prterm : constr -> Pp.t (** = pr_lconstr *)
(** Declarations for the "Print Assumption" command *)
@@ -193,15 +192,15 @@ module ContextObjectMap : CMap.ExtS
with type key = context_object and module Set := ContextObjectSet
val pr_assumptionset :
- env -> Term.types ContextObjectMap.t -> std_ppcmds
+ env -> Term.types ContextObjectMap.t -> Pp.t
-val pr_goal_by_id : Id.t -> std_ppcmds
-val pr_goal_by_uid : string -> std_ppcmds
+val pr_goal_by_id : Id.t -> Pp.t
+val pr_goal_by_uid : string -> Pp.t
type printer_pr = {
- pr_subgoals : ?pr_first:bool -> std_ppcmds option -> evar_map -> evar list -> Goal.goal list -> int list -> goal list -> goal list -> std_ppcmds;
- pr_subgoal : int -> evar_map -> goal list -> std_ppcmds;
- pr_goal : goal sigma -> std_ppcmds;
+ pr_subgoals : ?pr_first:bool -> Pp.t option -> evar_map -> evar list -> Goal.goal list -> int list -> goal list -> goal list -> Pp.t;
+ pr_subgoal : int -> evar_map -> goal list -> Pp.t;
+ pr_goal : goal sigma -> Pp.t;
};;
val set_printer_pr : printer_pr -> unit
diff --git a/printing/printmod.mli b/printing/printmod.mli
index 81b577453..8c3f0149e 100644
--- a/printing/printmod.mli
+++ b/printing/printmod.mli
@@ -6,12 +6,11 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-open Pp
open Names
(** false iff the module is an element of an open module type *)
val printable_body : DirPath.t -> bool
-val pr_mutual_inductive_body : Environ.env -> mutual_inductive -> Declarations.mutual_inductive_body -> std_ppcmds
-val print_module : bool -> module_path -> std_ppcmds
-val print_modtype : module_path -> std_ppcmds
+val pr_mutual_inductive_body : Environ.env -> mutual_inductive -> Declarations.mutual_inductive_body -> Pp.t
+val print_module : bool -> module_path -> Pp.t
+val print_modtype : module_path -> Pp.t
diff --git a/proofs/clenv.mli b/proofs/clenv.mli
index 26c6e6014..9c69995f4 100644
--- a/proofs/clenv.mli
+++ b/proofs/clenv.mli
@@ -112,7 +112,7 @@ exception NotExtensibleClause
val clenv_push_prod : clausenv -> clausenv
(** {6 Pretty-print (debug only) } *)
-val pr_clenv : clausenv -> Pp.std_ppcmds
+val pr_clenv : clausenv -> Pp.t
(** {6 Evar-based clauses} *)
diff --git a/proofs/goal.mli b/proofs/goal.mli
index cd71d11f8..6d3ec8bd4 100644
--- a/proofs/goal.mli
+++ b/proofs/goal.mli
@@ -20,7 +20,7 @@ val uid : goal -> string
val get_by_uid : string -> goal
(* Debugging help *)
-val pr_goal : goal -> Pp.std_ppcmds
+val pr_goal : goal -> Pp.t
(* Layer to implement v8.2 tactic engine ontop of the new architecture.
Types are different from what they used to be due to a change of the
diff --git a/proofs/logic.ml b/proofs/logic.ml
index 17128b92e..20d075ae1 100644
--- a/proofs/logic.ml
+++ b/proofs/logic.ml
@@ -22,7 +22,6 @@ open Proof_type
open Type_errors
open Retyping
open Misctypes
-open Context.Named.Declaration
module NamedDecl = Context.Named.Declaration
@@ -93,15 +92,6 @@ let check_typability env sigma c =
(* Implementation of the structural rules (moving and deleting
hypotheses around) *)
-(* The Clear tactic: it scans the context for hypotheses to be removed
- (instead of iterating on the list of identifier to be removed, which
- forces the user to give them in order). *)
-
-let clear_hyps2 env sigma ids sign t cl =
- let evdref = ref (Evd.clear_metas sigma) in
- let (hyps,t,cl) = Evarutil.clear_hyps2_in_evi env evdref sign t cl ids in
- (hyps, t, cl, !evdref)
-
(* The ClearBody tactic *)
(* Reordering of the context *)
@@ -200,14 +190,6 @@ let move_location_eq m1 m2 = match m1, m2 with
| MoveFirst, MoveFirst -> true
| _ -> false
-let rec get_hyp_after h = function
- | [] -> error_no_such_hypothesis h
- | d :: right ->
- if Id.equal (NamedDecl.get_id d) h then
- match right with d' ::_ -> MoveBefore (NamedDecl.get_id d') | [] -> MoveFirst
- else
- get_hyp_after h right
-
let split_sign hfrom hto l =
let rec splitrec left toleft = function
| [] -> error_no_such_hypothesis hfrom
@@ -282,6 +264,10 @@ let move_hyp_in_named_context sigma hfrom hto sign =
split_sign hfrom hto (named_context_of_val sign) in
move_hyp sigma toleft (left,declfrom,right) hto
+let insert_decl_in_named_context sigma decl hto sign =
+ let open EConstr in
+ move_hyp sigma false ([],decl,named_context_of_val sign) hto
+
(**********************************************************************)
@@ -535,37 +521,9 @@ let convert_hyp check sign sigma d =
(* Primitive tactics are handled here *)
let prim_refiner r sigma goal =
- let env = Goal.V82.env sigma goal in
- let sign = Goal.V82.hyps sigma goal in
let cl = Goal.V82.concl sigma goal in
- let mk_goal hyps concl =
- Goal.V82.mk_goal sigma hyps concl (Goal.V82.extra sigma goal)
- in
- let open EConstr in
match r with
(* Logical rules *)
- | Cut (b,replace,id,t) ->
-(* if !check && not (Retyping.get_sort_of env sigma t) then*)
- let t = EConstr.of_constr t in
- let (sg1,ev1,sigma) = mk_goal sign (nf_betaiota sigma t) in
- let sign,t,cl,sigma =
- if replace then
- let nexthyp = get_hyp_after id (named_context_of_val sign) in
- let sign,t,cl,sigma = clear_hyps2 env sigma (Id.Set.singleton id) sign t cl in
- move_hyp sigma false ([], LocalAssum (id,t),named_context_of_val sign)
- nexthyp,
- t,cl,sigma
- else
- (if !check && mem_named_context_val id sign then
- user_err ~hdr:"Logic.prim_refiner"
- (str "Variable " ++ pr_id id ++ str " is already declared.");
- push_named_context_val (LocalAssum (id,t)) sign,t,cl,sigma) in
- let (sg2,ev2,sigma) =
- Goal.V82.mk_goal sigma sign cl (Goal.V82.extra sigma goal) in
- let oterm = mkLetIn (Name id, ev1, t, EConstr.Vars.subst_var id ev2) in
- let sigma = Goal.V82.partial_solution_to sigma goal sg2 oterm in
- if b then ([sg1;sg2],sigma) else ([sg2;sg1],sigma)
-
| Refine c ->
let cl = EConstr.Unsafe.to_constr cl in
check_meta_variables c;
diff --git a/proofs/logic.mli b/proofs/logic.mli
index 84a21044b..9d0756b33 100644
--- a/proofs/logic.mli
+++ b/proofs/logic.mli
@@ -52,6 +52,8 @@ type refiner_error =
exception RefinerError of refiner_error
+val error_no_such_hypothesis : Id.t -> 'a
+
val catchable_exception : exn -> bool
val convert_hyp : bool -> Environ.named_context_val -> evar_map ->
@@ -59,3 +61,7 @@ val convert_hyp : bool -> Environ.named_context_val -> evar_map ->
val move_hyp_in_named_context : Evd.evar_map -> Id.t -> Id.t Misctypes.move_location ->
Environ.named_context_val -> Environ.named_context_val
+
+val insert_decl_in_named_context : Evd.evar_map ->
+ EConstr.named_declaration -> Id.t Misctypes.move_location ->
+ Environ.named_context_val -> Environ.named_context_val
diff --git a/proofs/miscprint.mli b/proofs/miscprint.mli
index 21d410c7b..b75718cd0 100644
--- a/proofs/miscprint.mli
+++ b/proofs/miscprint.mli
@@ -11,27 +11,27 @@ open Misctypes
(** Printing of [intro_pattern] *)
val pr_intro_pattern :
- ('a -> Pp.std_ppcmds) -> 'a intro_pattern_expr Loc.located -> Pp.std_ppcmds
+ ('a -> Pp.t) -> 'a intro_pattern_expr Loc.located -> Pp.t
val pr_or_and_intro_pattern :
- ('a -> Pp.std_ppcmds) -> 'a or_and_intro_pattern_expr -> Pp.std_ppcmds
+ ('a -> Pp.t) -> 'a or_and_intro_pattern_expr -> Pp.t
-val pr_intro_pattern_naming : intro_pattern_naming_expr -> Pp.std_ppcmds
+val pr_intro_pattern_naming : intro_pattern_naming_expr -> Pp.t
(** Printing of [move_location] *)
val pr_move_location :
- ('a -> Pp.std_ppcmds) -> 'a move_location -> Pp.std_ppcmds
+ ('a -> Pp.t) -> 'a move_location -> Pp.t
val pr_bindings :
- ('a -> Pp.std_ppcmds) ->
- ('a -> Pp.std_ppcmds) -> 'a bindings -> Pp.std_ppcmds
+ ('a -> Pp.t) ->
+ ('a -> Pp.t) -> 'a bindings -> Pp.t
val pr_bindings_no_with :
- ('a -> Pp.std_ppcmds) ->
- ('a -> Pp.std_ppcmds) -> 'a bindings -> Pp.std_ppcmds
+ ('a -> Pp.t) ->
+ ('a -> Pp.t) -> 'a bindings -> Pp.t
val pr_with_bindings :
- ('a -> Pp.std_ppcmds) ->
- ('a -> Pp.std_ppcmds) -> 'a * 'a bindings -> Pp.std_ppcmds
+ ('a -> Pp.t) ->
+ ('a -> Pp.t) -> 'a * 'a bindings -> Pp.t
diff --git a/proofs/proof.mli b/proofs/proof.mli
index 1865382e4..698aa48b0 100644
--- a/proofs/proof.mli
+++ b/proofs/proof.mli
@@ -182,7 +182,7 @@ val in_proof : proof -> (Evd.evar_map -> 'a) -> 'a
focused goals. *)
val unshelve : proof -> proof
-val pr_proof : proof -> Pp.std_ppcmds
+val pr_proof : proof -> Pp.t
(*** Compatibility layer with <=v8.2 ***)
module V82 : sig
diff --git a/proofs/proof_bullet.mli b/proofs/proof_bullet.mli
index 9ae521d3f..9e924fec9 100644
--- a/proofs/proof_bullet.mli
+++ b/proofs/proof_bullet.mli
@@ -48,6 +48,6 @@ val suggest : proof -> Pp.t
(* *)
(**********************************************************)
-val pr_goal_selector : Vernacexpr.goal_selector -> Pp.std_ppcmds
+val pr_goal_selector : Vernacexpr.goal_selector -> Pp.t
val get_default_goal_selector : unit -> Vernacexpr.goal_selector
diff --git a/proofs/proof_type.ml b/proofs/proof_type.ml
index 11f1a13e6..2ad5f607f 100644
--- a/proofs/proof_type.ml
+++ b/proofs/proof_type.ml
@@ -9,14 +9,12 @@
(** Legacy proof engine. Do not use in newly written code. *)
open Evd
-open Names
open Term
(** This module defines the structure of proof tree and the tactic type. So, it
is used by [Proof_tree] and [Refiner] *)
type prim_rule =
- | Cut of bool * bool * Id.t * types
| Refine of constr
(** Nowadays, the only rules we'll consider are the primitive rules *)
diff --git a/proofs/refine.mli b/proofs/refine.mli
index 20f5a0791..3b0a9e5b6 100644
--- a/proofs/refine.mli
+++ b/proofs/refine.mli
@@ -17,7 +17,7 @@ open Proofview
(** Printer used to print the constr which refine refines. *)
val pr_constr :
- (Environ.env -> Evd.evar_map -> Term.constr -> Pp.std_ppcmds) Hook.t
+ (Environ.env -> Evd.evar_map -> Term.constr -> Pp.t) Hook.t
(** {7 Refinement primitives} *)
diff --git a/proofs/refiner.ml b/proofs/refiner.ml
index f1b1cd359..3e3313eb5 100644
--- a/proofs/refiner.ml
+++ b/proofs/refiner.ml
@@ -63,7 +63,7 @@ let tclIDTAC_MESSAGE s gls =
let tclFAIL_s s gls = user_err ~hdr:"Refiner.tclFAIL_s" (str s)
(* A special exception for levels for the Fail tactic *)
-exception FailError of int * std_ppcmds Lazy.t
+exception FailError of int * Pp.t Lazy.t
(* The Fail tactic *)
let tclFAIL lvl s g = raise (FailError (lvl,lazy s))
diff --git a/proofs/refiner.mli b/proofs/refiner.mli
index aac10e81b..3ff010fe3 100644
--- a/proofs/refiner.mli
+++ b/proofs/refiner.mli
@@ -31,7 +31,7 @@ val refiner : rule -> tactic
(** [tclIDTAC] is the identity tactic without message printing*)
val tclIDTAC : tactic
-val tclIDTAC_MESSAGE : Pp.std_ppcmds -> tactic
+val tclIDTAC_MESSAGE : Pp.t -> tactic
(** [tclEVARS sigma] changes the current evar map *)
val tclEVARS : evar_map -> tactic
@@ -100,7 +100,7 @@ val tclTHENLASTn : tactic -> tactic array -> tactic
val tclTHENFIRSTn : tactic -> tactic array -> tactic
(** A special exception for levels for the Fail tactic *)
-exception FailError of int * Pp.std_ppcmds Lazy.t
+exception FailError of int * Pp.t Lazy.t
(** Takes an exception and either raise it at the next
level or do nothing. *)
@@ -116,8 +116,8 @@ val tclTRY : tactic -> tactic
val tclTHENTRY : tactic -> tactic -> tactic
val tclCOMPLETE : tactic -> tactic
val tclAT_LEAST_ONCE : tactic -> tactic
-val tclFAIL : int -> Pp.std_ppcmds -> tactic
-val tclFAIL_lazy : int -> Pp.std_ppcmds Lazy.t -> tactic
+val tclFAIL : int -> Pp.t -> tactic
+val tclFAIL_lazy : int -> Pp.t Lazy.t -> tactic
val tclDO : int -> tactic -> tactic
val tclPROGRESS : tactic -> tactic
val tclSHOWHYPS : tactic -> tactic
diff --git a/proofs/tacmach.ml b/proofs/tacmach.ml
index 2ed9416d1..a4d662e0a 100644
--- a/proofs/tacmach.ml
+++ b/proofs/tacmach.ml
@@ -115,22 +115,12 @@ let pf_matches gl p c = pf_apply Constr_matching.matches_conv gl p c
let refiner = refiner
-let internal_cut_no_check replace id t gl =
- let t = EConstr.Unsafe.to_constr t in
- refiner (Cut (true,replace,id,t)) gl
-
-let internal_cut_rev_no_check replace id t gl =
- let t = EConstr.Unsafe.to_constr t in
- refiner (Cut (false,replace,id,t)) gl
-
let refine_no_check c gl =
let c = EConstr.Unsafe.to_constr c in
refiner (Refine c) gl
(* Versions with consistency checks *)
-let internal_cut b d t = with_check (internal_cut_no_check b d t)
-let internal_cut_rev b d t = with_check (internal_cut_rev_no_check b d t)
let refine c = with_check (refine_no_check c)
(* Pretty-printers *)
diff --git a/proofs/tacmach.mli b/proofs/tacmach.mli
index 2b7c36594..93bf428fd 100644
--- a/proofs/tacmach.mli
+++ b/proofs/tacmach.mli
@@ -84,18 +84,15 @@ val pf_is_matching : goal sigma -> constr_pattern -> constr -> bool
(** {6 The most primitive tactics. } *)
val refiner : rule -> tactic
-val internal_cut_no_check : bool -> Id.t -> types -> tactic
val refine_no_check : constr -> tactic
(** {6 The most primitive tactics with consistency and type checking } *)
-val internal_cut : bool -> Id.t -> types -> tactic
-val internal_cut_rev : bool -> Id.t -> types -> tactic
val refine : constr -> tactic
(** {6 Pretty-printing functions (debug only). } *)
-val pr_gls : goal sigma -> Pp.std_ppcmds
-val pr_glls : goal list sigma -> Pp.std_ppcmds
+val pr_gls : goal sigma -> Pp.t
+val pr_glls : goal list sigma -> Pp.t
(* Variants of [Tacmach] functions built with the new proof engine *)
module New : sig
diff --git a/stm/asyncTaskQueue.ml b/stm/asyncTaskQueue.ml
index 25f9d7c18..9c58df5b2 100644
--- a/stm/asyncTaskQueue.ml
+++ b/stm/asyncTaskQueue.ml
@@ -123,7 +123,7 @@ module Make(T : Task) = struct
"-worker-id"; name;
"-async-proofs-worker-priority";
Flags.string_of_priority !Flags.async_proofs_worker_priority]
- | ("-ideslave"|"-emacs"|"-emacs-U"|"-batch")::tl -> set_slave_opt tl
+ | ("-ideslave"|"-emacs"|"-batch")::tl -> set_slave_opt tl
| ("-async-proofs" |"-toploop" |"-vio2vo"
|"-load-vernac-source" |"-l" |"-load-vernac-source-verbose" |"-lv"
|"-compile" |"-compile-verbose"
diff --git a/stm/stm.ml b/stm/stm.ml
index 7c9620854..3386044f2 100644
--- a/stm/stm.ml
+++ b/stm/stm.ml
@@ -1133,7 +1133,7 @@ let record_pb_time ?loc proof_name time =
hints := Aux_file.set !hints proof_name proof_build_time
end
-exception RemoteException of Pp.std_ppcmds
+exception RemoteException of Pp.t
let _ = CErrors.register_handler (function
| RemoteException ppcmd -> ppcmd
| _ -> raise Unhandled)
@@ -1274,7 +1274,7 @@ end = struct (* {{{ *)
type error = {
e_error_at : Stateid.t;
e_safe_id : Stateid.t;
- e_msg : Pp.std_ppcmds;
+ e_msg : Pp.t;
e_safe_states : Stateid.t list }
type response =
@@ -1711,7 +1711,7 @@ end = struct (* {{{ *)
type response =
| RespBuiltSubProof of (Constr.constr * Evd.evar_universe_context)
- | RespError of Pp.std_ppcmds
+ | RespError of Pp.t
| RespNoProgress
let name = ref "tacworker"
diff --git a/tactics/autorewrite.mli b/tactics/autorewrite.mli
index 306ff1868..edbb7c6b7 100644
--- a/tactics/autorewrite.mli
+++ b/tactics/autorewrite.mli
@@ -40,7 +40,7 @@ val auto_multi_rewrite : ?conds:conditions -> string list -> Locus.clause -> uni
val auto_multi_rewrite_with : ?conds:conditions -> unit Proofview.tactic -> string list -> Locus.clause -> unit Proofview.tactic
-val print_rewrite_hintdb : string -> Pp.std_ppcmds
+val print_rewrite_hintdb : string -> Pp.t
open Clenv
diff --git a/tactics/class_tactics.ml b/tactics/class_tactics.ml
index 3fc2fc31b..b98b10315 100644
--- a/tactics/class_tactics.ml
+++ b/tactics/class_tactics.ml
@@ -621,7 +621,7 @@ module V85 = struct
type autoinfo = { hints : hint_db; is_evar: existential_key option;
only_classes: bool; unique : bool;
- auto_depth: int list; auto_last_tac: std_ppcmds Lazy.t;
+ auto_depth: int list; auto_last_tac: Pp.t Lazy.t;
auto_path : global_reference option list;
auto_cut : hints_path }
type autogoal = goal * autoinfo
@@ -972,7 +972,7 @@ end
module Search = struct
type autoinfo =
{ search_depth : int list;
- last_tac : Pp.std_ppcmds Lazy.t;
+ last_tac : Pp.t Lazy.t;
search_dep : bool;
search_only_classes : bool;
search_cut : hints_path;
@@ -1342,7 +1342,7 @@ module Search = struct
| Some i -> str ", with depth limit " ++ int i));
tac
- let run_on_evars p evm tac =
+ let run_on_evars env evm p tac =
match evars_to_goals p evm with
| None -> None (* This happens only because there's no evar having p *)
| Some (goals, evm') ->
@@ -1357,7 +1357,7 @@ module Search = struct
let pv = Proofview.unshelve goals pv in
try
let (), pv', (unsafe, shelved, gaveup), _ =
- Proofview.apply (Global.env ()) tac pv
+ Proofview.apply env tac pv
in
if Proofview.finished pv' then
let evm' = Proofview.return pv' in
@@ -1374,22 +1374,22 @@ module Search = struct
else raise Not_found
with Logic_monad.TacticFailure _ -> raise Not_found
- let evars_eauto depth only_classes unique dep st hints p evd =
+ let evars_eauto env evd depth only_classes unique dep st hints p =
let eauto_tac = eauto_tac ~st ~unique ~only_classes ~depth ~dep:(unique || dep) hints in
- let res = run_on_evars p evd eauto_tac in
+ let res = run_on_evars env evd p eauto_tac in
match res with
| None -> evd
| Some evd' -> evd'
- let typeclasses_eauto ?depth unique st hints p evd =
- evars_eauto depth true unique false st hints p evd
+ let typeclasses_eauto env evd ?depth unique st hints p =
+ evars_eauto env evd depth true unique false st hints p
(** Typeclasses eauto is an eauto which tries to resolve only
goals of typeclass type, and assumes that the initially selected
evars in evd are independent of the rest of the evars *)
- let typeclasses_resolve debug depth unique p evd =
+ let typeclasses_resolve env evd debug depth unique p =
let db = searchtable_map typeclasses_db in
- typeclasses_eauto ?depth unique (Hint_db.transparent_state db) [db] p evd
+ typeclasses_eauto env evd ?depth unique (Hint_db.transparent_state db) [db] p
end
(** Binding to either V85 or Search implementations. *)
@@ -1460,7 +1460,6 @@ let is_mandatory p comp evd =
(** In case of unsatisfiable constraints, build a nice error message *)
let error_unresolvable env comp evd =
- let evd = Evarutil.nf_evar_map_undefined evd in
let is_part ev = match comp with
| None -> true
| Some s -> Evar.Set.mem ev s
@@ -1474,8 +1473,7 @@ let error_unresolvable env comp evd =
else (found, accu)
in
let (_, ev) = Evd.fold_undefined fold evd (true, None) in
- Pretype_errors.unsatisfiable_constraints
- (Evarutil.nf_env_evar evd env) evd ev comp
+ Pretype_errors.unsatisfiable_constraints env evd ev comp
(** Check if an evar is concerned by the current resolution attempt,
(and in particular is in the current component), and also update
@@ -1534,7 +1532,7 @@ let resolve_all_evars debug depth unique env p oevd do_split fail =
if get_typeclasses_legacy_resolution () then
V85.resolve_all_evars_once debug depth unique p evd
else
- Search.typeclasses_resolve debug depth unique p evd
+ Search.typeclasses_resolve env evd debug depth unique p
in
if has_undefined p oevd evd' then raise Unresolved;
docomp evd' comps
diff --git a/tactics/eauto.ml b/tactics/eauto.ml
index 64d4d3135..2b5bbfcd1 100644
--- a/tactics/eauto.ml
+++ b/tactics/eauto.ml
@@ -86,16 +86,16 @@ let rec prolog l n gl =
let prol = (prolog l (n-1)) in
(tclFIRST (List.map (fun t -> (tclTHEN t prol)) (one_step l gl))) gl
-let out_term = function
+let out_term env = function
| IsConstr (c, _) -> c
- | IsGlobRef gr -> EConstr.of_constr (fst (Universes.fresh_global_instance (Global.env ()) gr))
+ | IsGlobRef gr -> EConstr.of_constr (fst (Universes.fresh_global_instance env gr))
let prolog_tac l n =
Proofview.V82.tactic begin fun gl ->
let map c =
let (sigma, c) = c (pf_env gl) (project gl) in
let c = pf_apply (prepare_hint false (false,true)) gl (sigma, c) in
- out_term c
+ out_term (pf_env gl) c
in
let l = List.map map l in
try (prolog l n gl)
@@ -203,7 +203,7 @@ type search_state = {
priority : int;
depth : int; (*r depth of search before failing *)
tacres : goal list sigma;
- last_tactic : std_ppcmds Lazy.t;
+ last_tactic : Pp.t Lazy.t;
dblist : hint_db list;
localdb : hint_db list;
prev : prev_search_state;
diff --git a/tactics/eqdecide.ml b/tactics/eqdecide.ml
index d4cad3fa8..e16fcec7c 100644
--- a/tactics/eqdecide.ml
+++ b/tactics/eqdecide.ml
@@ -155,9 +155,9 @@ open Proofview.Notations
(* spiwack: a PatternMatchingFailure wrapper around [Hipattern]. *)
-let match_eqdec sigma c =
+let match_eqdec env sigma c =
try
- let (eqonleft,_,c1,c2,ty) = match_eqdec sigma c in
+ let (eqonleft,_,c1,c2,ty) = match_eqdec env sigma c in
let (op,eq1,noteq,eq2) =
match EConstr.kind sigma c with
| App (op,[|ty1;ty2|]) ->
@@ -202,8 +202,9 @@ let solveEqBranch rectype =
begin
Proofview.Goal.enter begin fun gl ->
let concl = pf_concl gl in
+ let env = Proofview.Goal.env gl in
let sigma = project gl in
- match_eqdec sigma concl >>= fun (eqonleft,mk,lhs,rhs,_) ->
+ match_eqdec env sigma concl >>= fun (eqonleft,mk,lhs,rhs,_) ->
let (mib,mip) = Global.lookup_inductive rectype in
let nparams = mib.mind_nparams in
let getargs l = List.skipn nparams (snd (decompose_app sigma l)) in
@@ -229,8 +230,9 @@ let decideGralEquality =
begin
Proofview.Goal.enter begin fun gl ->
let concl = pf_concl gl in
+ let env = Proofview.Goal.env gl in
let sigma = project gl in
- match_eqdec sigma concl >>= fun (eqonleft,mk,c1,c2,typ as data) ->
+ match_eqdec env sigma concl >>= fun (eqonleft,mk,c1,c2,typ as data) ->
let headtyp = hd_app sigma (pf_compute gl typ) in
begin match EConstr.kind sigma headtyp with
| Ind (mi,_) -> Proofview.tclUNIT mi
diff --git a/tactics/equality.ml b/tactics/equality.ml
index 66345ce43..ad6abfa1f 100644
--- a/tactics/equality.ml
+++ b/tactics/equality.ml
@@ -334,25 +334,27 @@ let (forward_general_setoid_rewrite_clause, general_setoid_rewrite_clause) = Hoo
(* Do we have a JMeq instance on twice the same domains ? *)
-let jmeq_same_dom gl = function
+let jmeq_same_dom env sigma = function
| None -> true (* already checked in Hipattern.find_eq_data_decompose *)
| Some t ->
- let rels, t = decompose_prod_assum (project gl) t in
- let env = push_rel_context rels (Proofview.Goal.env gl) in
- match decompose_app (project gl) t with
- | _, [dom1; _; dom2;_] -> is_conv env (Tacmach.New.project gl) dom1 dom2
+ let rels, t = decompose_prod_assum sigma t in
+ let env = push_rel_context rels env in
+ match decompose_app sigma t with
+ | _, [dom1; _; dom2;_] -> is_conv env sigma dom1 dom2
| _ -> false
(* find_elim determines which elimination principle is necessary to
eliminate lbeq on sort_of_gl. *)
-let find_elim hdcncl lft2rgt dep cls ot gl =
+let find_elim hdcncl lft2rgt dep cls ot =
+ Proofview.Goal.enter_one begin fun gl ->
let sigma = project gl in
let is_global gr c = Termops.is_global sigma gr c in
let inccl = Option.is_empty cls in
+ let env = Proofview.Goal.env gl in
if (is_global Coqlib.glob_eq hdcncl ||
(is_global Coqlib.glob_jmeq hdcncl &&
- jmeq_same_dom gl ot)) && not dep
+ jmeq_same_dom env sigma ot)) && not dep
then
let c =
match EConstr.kind sigma hdcncl with
@@ -382,9 +384,7 @@ let find_elim hdcncl lft2rgt dep cls ot gl =
Logic.eq or Jmeq just before *)
assert false
in
- let (sigma, elim) = fresh_global (Global.env ()) (Proofview.Goal.sigma gl) (ConstRef c) in
- let elim = EConstr.of_constr elim in
- (sigma, (elim, Safe_typing.empty_private_constants))
+ pf_constr_of_global (ConstRef c)
else
let scheme_name = match dep, lft2rgt, inccl with
(* Non dependent case *)
@@ -400,14 +400,12 @@ let find_elim hdcncl lft2rgt dep cls ot gl =
in
match EConstr.kind sigma hdcncl with
| Ind (ind,u) ->
+
let c, eff = find_scheme scheme_name ind in
- (* MS: cannot use pf_constr_of_global as the eliminator might be generated by side-effect *)
- let (sigma, elim) =
- fresh_global (Global.env ()) (Proofview.Goal.sigma gl) (ConstRef c)
- in
- let elim = EConstr.of_constr elim in
- (sigma, (elim, eff))
+ Proofview.tclEFFECTS eff <*>
+ pf_constr_of_global (ConstRef c)
| _ -> assert false
+ end
let type_of_clause cls gl = match cls with
| None -> Proofview.Goal.concl gl
@@ -420,9 +418,7 @@ let leibniz_rewrite_ebindings_clause cls lft2rgt tac c t l with_evars frzevars d
let dep_fun = if isatomic then dependent else dependent_no_evar in
let type_of_cls = type_of_clause cls gl in
let dep = dep_proof_ok && dep_fun evd c type_of_cls in
- let (sigma, (elim, effs)) = find_elim hdcncl lft2rgt dep cls (Some t) gl in
- Proofview.Unsafe.tclEVARS sigma <*>
- Proofview.tclEFFECTS effs <*>
+ find_elim hdcncl lft2rgt dep cls (Some t) >>= fun elim ->
general_elim_clause with_evars frzevars tac cls c t l
(match lft2rgt with None -> false | Some b -> b)
{elimindex = None; elimbody = (elim,NoBindings); elimrename = None}
@@ -536,7 +532,7 @@ let general_rewrite_clause l2r with_evars ?tac c cl =
let do_hyps =
(* If the term to rewrite uses an hypothesis H, don't rewrite in H *)
let ids gl =
- let ids_in_c = Termops.global_vars_set (Global.env()) (project gl) (fst c) in
+ let ids_in_c = Termops.global_vars_set (Proofview.Goal.env gl) (project gl) (fst c) in
let ids_of_hyps = pf_ids_of_hyps gl in
Id.Set.fold (fun id l -> List.remove Id.equal id l) ids_in_c ids_of_hyps
in
@@ -858,7 +854,8 @@ let descend_then env sigma head dirn =
let IndType (indf,_) =
try find_rectype env sigma (get_type_of env sigma head)
with Not_found ->
- user_err Pp.(str "Cannot project on an inductive type derived from a dependency.") in
+ user_err Pp.(str "Cannot project on an inductive type derived from a dependency.")
+ in
let indp,_ = (dest_ind_family indf) in
let ind, _ = check_privacy env indp in
let (mib,mip) = lookup_mind_specif env ind in
@@ -880,7 +877,7 @@ let descend_then env sigma head dirn =
List.map build_branch
(List.interval 1 (Array.length mip.mind_consnames)) in
let ci = make_case_info env ind RegularStyle in
- sigma, Inductiveops.make_case_or_project env sigma indf ci p head (Array.of_list brl)))
+ Inductiveops.make_case_or_project env sigma indf ci p head (Array.of_list brl)))
(* Now we need to construct the discriminator, given a discriminable
position. This boils down to:
@@ -925,23 +922,20 @@ let build_selector env sigma dirn c ind special default =
let brl =
List.map build_branch(List.interval 1 (Array.length mip.mind_consnames)) in
let ci = make_case_info env ind RegularStyle in
- sigma, mkCase (ci, p, c, Array.of_list brl)
+ mkCase (ci, p, c, Array.of_list brl)
-let build_coq_False sigma = Evarutil.new_global sigma (build_coq_False ())
-let build_coq_True sigma = Evarutil.new_global sigma (build_coq_True ())
-let build_coq_I sigma = Evarutil.new_global sigma (build_coq_I ())
+let build_coq_False () = pf_constr_of_global (build_coq_False ())
+let build_coq_True () = pf_constr_of_global (build_coq_True ())
+let build_coq_I () = pf_constr_of_global (build_coq_I ())
-let rec build_discriminator env sigma dirn c = function
+let rec build_discriminator env sigma true_0 false_0 dirn c = function
| [] ->
let ind = get_type_of env sigma c in
- let sigma, true_0 = build_coq_True sigma in
- let sigma, false_0 = build_coq_False sigma in
build_selector env sigma dirn c ind true_0 false_0
| ((sp,cnum),argnum)::l ->
- let sigma, false_0 = build_coq_False sigma in
let (cnum_nlams,cnum_env,kont) = descend_then env sigma c cnum in
let newc = mkRel(cnum_nlams-argnum) in
- let sigma, subval = build_discriminator cnum_env sigma dirn newc l in
+ let subval = build_discriminator cnum_env sigma true_0 false_0 dirn newc l in
kont sigma subval (false_0,mkSort (Prop Null))
(* Note: discrimination could be more clever: if some elimination is
@@ -984,14 +978,15 @@ let ind_scheme_of_eq lbeq =
ConstRef c, eff
-let discrimination_pf env sigma e (t,t1,t2) discriminator lbeq =
- let sigma, i = build_coq_I sigma in
- let sigma, absurd_term = build_coq_False sigma in
+let discrimination_pf e (t,t1,t2) discriminator lbeq =
+ build_coq_I () >>= fun i ->
+ build_coq_False () >>= fun absurd_term ->
let eq_elim, eff = ind_scheme_of_eq lbeq in
- let sigma, eq_elim = Evd.fresh_global (Global.env ()) sigma eq_elim in
- let eq_elim = EConstr.of_constr eq_elim in
- sigma, (applist (eq_elim, [t;t1;mkNamedLambda e t discriminator;i;t2]), absurd_term),
- eff
+ Proofview.tclEFFECTS eff <*>
+ pf_constr_of_global eq_elim >>= fun eq_elim ->
+ Proofview.tclUNIT
+ (applist (eq_elim, [t;t1;mkNamedLambda e t discriminator;i;t2]), absurd_term)
+
let eq_baseid = Id.of_string "e"
@@ -1005,19 +1000,24 @@ let apply_on_clause (f,t) clause =
clenv_fchain ~with_univs:false argmv f_clause 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 e = next_ident_away eq_baseid (ids_of_context env) in
let e_env = push_named (Context.Named.Declaration.LocalAssum (e,t)) env in
- let sigma, discriminator =
- build_discriminator e_env sigma dirn (mkVar e) cpath in
- let sigma,(pf, absurd_term), eff =
- discrimination_pf env sigma e (t,t1,t2) discriminator lbeq in
- let pf_ty = mkArrow eqn absurd_term in
- let absurd_clause = apply_on_clause (pf,pf_ty) eq_clause in
- let pf = Clenvtac.clenv_value_cast_meta absurd_clause in
- Proofview.Unsafe.tclEVARS sigma <*>
- Proofview.tclEFFECTS eff <*>
- tclTHENS (assert_after Anonymous absurd_term)
- [onLastHypId gen_absurdity; (Proofview.V82.tactic (Tacmach.refine pf))]
+ let discriminator =
+ try
+ Proofview.tclUNIT
+ (build_discriminator e_env sigma true_0 false_0 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 absurd_term 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)
+ [onLastHypId gen_absurdity; (Proofview.V82.tactic (Tacmach.refine pf))]
let discrEq (lbeq,_,(t,t1,t2) as u) eq_clause =
let sigma = eq_clause.evd in
@@ -1303,7 +1303,7 @@ let rec build_injrec env sigma dflt c = function
let (cnum_nlams,cnum_env,kont) = descend_then env sigma c cnum in
let newc = mkRel(cnum_nlams-argnum) in
let sigma, (subval,tuplety,dfltval) = build_injrec cnum_env sigma dflt newc l in
- let sigma, res = kont sigma subval (dfltval,tuplety) in
+ let res = kont sigma subval (dfltval,tuplety) in
sigma, (res, tuplety,dfltval)
with
UserError _ -> failwith "caught"
@@ -1536,7 +1536,7 @@ let decomp_tuple_term env sigma c t =
let rec decomprec inner_code ex exty =
let iterated_decomp =
try
- let ({proj1=p1; proj2=p2}),(i,a,p,car,cdr) = find_sigma_data_decompose sigma ex in
+ let ({proj1=p1; proj2=p2}),(i,a,p,car,cdr) = find_sigma_data_decompose env sigma ex in
let car_code = applist (mkConstU (destConstRef p1,i),[a;p;inner_code])
and cdr_code = applist (mkConstU (destConstRef p2,i),[a;p;inner_code]) in
let cdrtyp = beta_applist sigma (p,[car]) in
diff --git a/tactics/equality.mli b/tactics/equality.mli
index 421f7c7f5..a4d1c0f9b 100644
--- a/tactics/equality.mli
+++ b/tactics/equality.mli
@@ -126,4 +126,4 @@ val set_eq_dec_scheme_kind : mutual scheme_kind -> unit
(* [build_selector env sigma i c t u v] matches on [c] of
type [t] and returns [u] in branch [i] and [v] on other branches *)
val build_selector : env -> evar_map -> int -> constr -> types ->
- constr -> constr -> evar_map * constr
+ constr -> constr -> constr
diff --git a/tactics/hints.mli b/tactics/hints.mli
index 6325a4470..44e5370e9 100644
--- a/tactics/hints.mli
+++ b/tactics/hints.mli
@@ -6,7 +6,6 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-open Pp
open Util
open Names
open EConstr
@@ -85,10 +84,10 @@ type hints_path = global_reference hints_path_gen
val normalize_path : hints_path -> hints_path
val path_matches : hints_path -> hints_path_atom list -> bool
val path_derivate : hints_path -> hints_path_atom -> hints_path
-val pp_hints_path_gen : ('a -> Pp.std_ppcmds) -> 'a hints_path_gen -> Pp.std_ppcmds
-val pp_hints_path_atom : ('a -> Pp.std_ppcmds) -> 'a hints_path_atom_gen -> Pp.std_ppcmds
-val pp_hints_path : hints_path -> Pp.std_ppcmds
-val pp_hint_mode : hint_mode -> Pp.std_ppcmds
+val pp_hints_path_gen : ('a -> Pp.t) -> 'a hints_path_gen -> Pp.t
+val pp_hints_path_atom : ('a -> Pp.t) -> 'a hints_path_atom_gen -> Pp.t
+val pp_hints_path : hints_path -> Pp.t
+val pp_hint_mode : hint_mode -> Pp.t
val glob_hints_path_atom :
Libnames.reference hints_path_atom_gen -> Globnames.global_reference hints_path_atom_gen
val glob_hints_path :
@@ -261,12 +260,12 @@ val rewrite_db : hint_db_name
(** Printing hints *)
-val pr_searchtable : unit -> std_ppcmds
-val pr_applicable_hint : unit -> std_ppcmds
-val pr_hint_ref : global_reference -> std_ppcmds
-val pr_hint_db_by_name : hint_db_name -> std_ppcmds
-val pr_hint_db : Hint_db.t -> std_ppcmds
-val pr_hint : hint -> Pp.std_ppcmds
+val pr_searchtable : unit -> Pp.t
+val pr_applicable_hint : unit -> Pp.t
+val pr_hint_ref : global_reference -> Pp.t
+val pr_hint_db_by_name : hint_db_name -> Pp.t
+val pr_hint_db : Hint_db.t -> Pp.t
+val pr_hint : hint -> Pp.t
(** Hook for changing the initialization of auto *)
diff --git a/tactics/hipattern.ml b/tactics/hipattern.ml
index 4101004d4..b057cf72b 100644
--- a/tactics/hipattern.ml
+++ b/tactics/hipattern.ml
@@ -280,10 +280,7 @@ let coq_refl_jm_pattern =
open Globnames
-let is_matching sigma x y = is_matching (Global.env ()) sigma x y
-let matches sigma x y = matches (Global.env ()) sigma x y
-
-let match_with_equation sigma t =
+let match_with_equation env sigma t =
if not (isApp sigma t) then raise NoEquationFound;
let (hdapp,args) = destApp sigma t in
match EConstr.kind sigma hdapp with
@@ -302,11 +299,11 @@ let match_with_equation sigma t =
let constr_types = mip.mind_nf_lc in
let nconstr = Array.length mip.mind_consnames in
if Int.equal nconstr 1 then
- if is_matching sigma coq_refl_leibniz1_pattern (EConstr.of_constr constr_types.(0)) then
+ if is_matching env sigma coq_refl_leibniz1_pattern (EConstr.of_constr constr_types.(0)) then
None, hdapp, MonomorphicLeibnizEq(args.(0),args.(1))
- else if is_matching sigma coq_refl_leibniz2_pattern (EConstr.of_constr constr_types.(0)) then
+ else if is_matching env sigma coq_refl_leibniz2_pattern (EConstr.of_constr constr_types.(0)) then
None, hdapp, PolymorphicLeibnizEq(args.(0),args.(1),args.(2))
- else if is_matching sigma coq_refl_jm_pattern (EConstr.of_constr constr_types.(0)) then
+ else if is_matching env sigma coq_refl_jm_pattern (EConstr.of_constr constr_types.(0)) then
None, hdapp, HeterogenousEq(args.(0),args.(1),args.(2),args.(3))
else raise NoEquationFound
else raise NoEquationFound
@@ -335,8 +332,8 @@ let is_equality_type sigma t = op2bool (match_with_equality_type sigma t)
(** X1 -> X2 **)
let coq_arrow_pattern = mkPattern (mkGArrow (mkGPatVar "X1") (mkGPatVar "X2"))
-let match_arrow_pattern sigma t =
- let result = matches sigma coq_arrow_pattern t in
+let match_arrow_pattern env sigma t =
+ let result = matches env sigma coq_arrow_pattern t in
match Id.Map.bindings result with
| [(m1,arg);(m2,mind)] ->
assert (Id.equal m1 meta1 && Id.equal m2 meta2); (arg, mind)
@@ -349,13 +346,13 @@ let match_with_imp_term sigma c =
let is_imp_term sigma c = op2bool (match_with_imp_term sigma c)
-let match_with_nottype sigma t =
+let match_with_nottype env sigma t =
try
- let (arg,mind) = match_arrow_pattern sigma t in
+ let (arg,mind) = match_arrow_pattern env sigma t in
if is_empty_type sigma mind then Some (mind,arg) else None
with PatternMatchingFailure -> None
-let is_nottype sigma t = op2bool (match_with_nottype sigma t)
+let is_nottype env sigma t = op2bool (match_with_nottype env sigma t)
(* Forall *)
@@ -481,7 +478,7 @@ let dest_nf_eq gls eqn =
(*** Sigma-types *)
-let match_sigma sigma ex =
+let match_sigma env sigma ex =
match EConstr.kind sigma ex with
| App (f, [| a; p; car; cdr |]) when Termops.is_global sigma (Lazy.force coq_exist_ref) f ->
build_sigma (), (snd (destConstruct sigma f), a, p, car, cdr)
@@ -489,19 +486,19 @@ let match_sigma sigma ex =
build_sigma_type (), (snd (destConstruct sigma f), a, p, car, cdr)
| _ -> raise PatternMatchingFailure
-let find_sigma_data_decompose ex = (* fails with PatternMatchingFailure *)
- match_sigma ex
+let find_sigma_data_decompose env ex = (* fails with PatternMatchingFailure *)
+ match_sigma env ex
(* Pattern "(sig ?1 ?2)" *)
let coq_sig_pattern =
lazy (mkPattern (mkGAppRef coq_sig_ref [mkGPatVar "X1"; mkGPatVar "X2"]))
-let match_sigma sigma t =
- match Id.Map.bindings (matches sigma (Lazy.force coq_sig_pattern) t) with
+let match_sigma env sigma t =
+ match Id.Map.bindings (matches env sigma (Lazy.force coq_sig_pattern) t) with
| [(_,a); (_,p)] -> (a,p)
| _ -> anomaly (Pp.str "Unexpected pattern.")
-let is_matching_sigma sigma t = is_matching sigma (Lazy.force coq_sig_pattern) t
+let is_matching_sigma env sigma t = is_matching env sigma (Lazy.force coq_sig_pattern) t
(*** Decidable equalities *)
@@ -533,15 +530,15 @@ let coq_eqdec_rev_pattern = coq_eqdec ~sum:coq_or_ref ~rev:true
let op_or = coq_or_ref
let op_sum = coq_sumbool_ref
-let match_eqdec sigma t =
+let match_eqdec env sigma t =
let eqonleft,op,subst =
- try true,op_sum,matches sigma (Lazy.force coq_eqdec_inf_pattern) t
+ try true,op_sum,matches env sigma (Lazy.force coq_eqdec_inf_pattern) t
with PatternMatchingFailure ->
- try false,op_sum,matches sigma (Lazy.force coq_eqdec_inf_rev_pattern) t
+ try false,op_sum,matches env sigma (Lazy.force coq_eqdec_inf_rev_pattern) t
with PatternMatchingFailure ->
- try true,op_or,matches sigma (Lazy.force coq_eqdec_pattern) t
+ try true,op_or,matches env sigma (Lazy.force coq_eqdec_pattern) t
with PatternMatchingFailure ->
- false,op_or,matches sigma (Lazy.force coq_eqdec_rev_pattern) t in
+ false,op_or,matches env sigma (Lazy.force coq_eqdec_rev_pattern) t in
match Id.Map.bindings subst with
| [(_,typ);(_,c1);(_,c2)] ->
eqonleft, Lazy.force op, c1, c2, typ
@@ -551,8 +548,8 @@ let match_eqdec sigma t =
let coq_not_pattern = lazy (mkPattern (mkGAppRef coq_not_ref [mkGHole]))
let coq_imp_False_pattern = lazy (mkPattern (mkGArrow mkGHole (mkGRef coq_False_ref)))
-let is_matching_not sigma t = is_matching sigma (Lazy.force coq_not_pattern) t
-let is_matching_imp_False sigma t = is_matching sigma (Lazy.force coq_imp_False_pattern) t
+let is_matching_not env sigma t = is_matching env sigma (Lazy.force coq_not_pattern) t
+let is_matching_imp_False env sigma t = is_matching env sigma (Lazy.force coq_imp_False_pattern) t
(* Remark: patterns that have references to the standard library must
be evaluated lazily (i.e. at the time they are used, not a the time
diff --git a/tactics/hipattern.mli b/tactics/hipattern.mli
index 59406e158..8ff6fe95c 100644
--- a/tactics/hipattern.mli
+++ b/tactics/hipattern.mli
@@ -81,8 +81,8 @@ val is_inductive_equality : inductive -> bool
val match_with_equality_type : (constr * constr list) matching_function
val is_equality_type : testing_function
-val match_with_nottype : (constr * constr) matching_function
-val is_nottype : testing_function
+val match_with_nottype : Environ.env -> (constr * constr) matching_function
+val is_nottype : Environ.env -> testing_function
val match_with_forall_term : (Name.t * constr * constr) matching_function
val is_forall_term : testing_function
@@ -114,7 +114,7 @@ type equation_kind =
exception NoEquationFound
val match_with_equation:
- evar_map -> constr -> coq_eq_data option * constr * equation_kind
+ Environ.env -> evar_map -> constr -> coq_eq_data option * constr * equation_kind
(***** Destructing patterns bound to some theory *)
@@ -132,21 +132,21 @@ val find_eq_data : evar_map -> constr -> coq_eq_data * EInstance.t * equation_ki
(** Match a term of the form [(existT A P t p)]
Returns associated lemmas and [A,P,t,p] *)
-val find_sigma_data_decompose : evar_map -> constr ->
+val find_sigma_data_decompose : Environ.env -> evar_map -> constr ->
coq_sigma_data * (EInstance.t * constr * constr * constr * constr)
(** Match a term of the form [{x:A|P}], returns [A] and [P] *)
-val match_sigma : evar_map -> constr -> constr * constr
+val match_sigma : Environ.env -> evar_map -> constr -> constr * constr
-val is_matching_sigma : evar_map -> constr -> bool
+val is_matching_sigma : Environ.env -> evar_map -> constr -> bool
(** Match a decidable equality judgement (e.g [{t=u:>T}+{~t=u}]), returns
[t,u,T] and a boolean telling if equality is on the left side *)
-val match_eqdec : evar_map -> constr -> bool * Globnames.global_reference * constr * constr * constr
+val match_eqdec : Environ.env -> evar_map -> constr -> bool * Globnames.global_reference * constr * constr * constr
(** Match an equality up to conversion; returns [(eq,t1,t2)] in normal form *)
val dest_nf_eq : 'a Proofview.Goal.t -> constr -> (constr * constr * constr)
(** Match a negation *)
-val is_matching_not : evar_map -> constr -> bool
-val is_matching_imp_False : evar_map -> constr -> bool
+val is_matching_not : Environ.env -> evar_map -> constr -> bool
+val is_matching_imp_False : Environ.env -> evar_map -> constr -> bool
diff --git a/tactics/ind_tables.mli b/tactics/ind_tables.mli
index 005555caa..f825c4f4a 100644
--- a/tactics/ind_tables.mli
+++ b/tactics/ind_tables.mli
@@ -48,4 +48,4 @@ val find_scheme : ?mode:internal_flag -> 'a scheme_kind -> inductive -> constant
val check_scheme : 'a scheme_kind -> inductive -> bool
-val pr_scheme_kind : 'a scheme_kind -> Pp.std_ppcmds
+val pr_scheme_kind : 'a scheme_kind -> Pp.t
diff --git a/tactics/tacticals.mli b/tactics/tacticals.mli
index 4ad9c6541..2a04c413b 100644
--- a/tactics/tacticals.mli
+++ b/tactics/tacticals.mli
@@ -6,7 +6,6 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-open Pp
open Names
open Term
open EConstr
@@ -19,7 +18,7 @@ open Tactypes
(** Tacticals i.e. functions from tactics to tactics. *)
val tclIDTAC : tactic
-val tclIDTAC_MESSAGE : std_ppcmds -> tactic
+val tclIDTAC_MESSAGE : Pp.t -> tactic
val tclORELSE0 : tactic -> tactic -> tactic
val tclORELSE : tactic -> tactic -> tactic
val tclTHEN : tactic -> tactic -> tactic
@@ -41,8 +40,8 @@ val tclSOLVE : tactic list -> tactic
val tclTRY : tactic -> tactic
val tclCOMPLETE : tactic -> tactic
val tclAT_LEAST_ONCE : tactic -> tactic
-val tclFAIL : int -> std_ppcmds -> tactic
-val tclFAIL_lazy : int -> std_ppcmds Lazy.t -> tactic
+val tclFAIL : int -> Pp.t -> tactic
+val tclFAIL_lazy : int -> Pp.t Lazy.t -> tactic
val tclDO : int -> tactic -> tactic
val tclPROGRESS : tactic -> tactic
val tclSHOWHYPS : tactic -> tactic
@@ -160,9 +159,9 @@ module New : sig
(* [tclFAIL n msg] fails with [msg] as an error message at level [n]
(meaning that it will jump over [n] error catching tacticals FROM
THIS MODULE. *)
- val tclFAIL : int -> Pp.std_ppcmds -> 'a tactic
+ val tclFAIL : int -> Pp.t -> 'a tactic
- val tclZEROMSG : ?loc:Loc.t -> Pp.std_ppcmds -> 'a tactic
+ val tclZEROMSG : ?loc:Loc.t -> Pp.t -> 'a tactic
(** Fail with a [User_Error] containing the given message. *)
val tclOR : unit tactic -> unit tactic -> unit tactic
diff --git a/tactics/tactics.ml b/tactics/tactics.ml
index cb905e749..67bc55d3f 100644
--- a/tactics/tactics.ml
+++ b/tactics/tactics.ml
@@ -436,19 +436,85 @@ let find_name mayrepl decl naming gl = match naming with
id
(**************************************************************)
+(* Computing position of hypotheses for replacing *)
+(**************************************************************)
+
+let get_next_hyp_position id =
+ let rec aux = function
+ | [] -> error_no_such_hypothesis id
+ | decl :: right ->
+ if Id.equal (NamedDecl.get_id decl) id then
+ match right with decl::_ -> MoveBefore (NamedDecl.get_id decl) | [] -> MoveFirst
+ else
+ aux right
+ in
+ aux
+
+let get_previous_hyp_position id =
+ let rec aux dest = function
+ | [] -> error_no_such_hypothesis id
+ | decl :: right ->
+ let hyp = NamedDecl.get_id decl in
+ if Id.equal hyp id then dest else aux (MoveAfter hyp) right
+ in
+ aux MoveLast
+
+(**************************************************************)
(* Cut rule *)
(**************************************************************)
+let clear_hyps2 env sigma ids sign t cl =
+ try
+ let evdref = ref (Evd.clear_metas sigma) in
+ let (hyps,t,cl) = Evarutil.clear_hyps2_in_evi env evdref sign t cl ids in
+ (hyps, t, cl, !evdref)
+ with Evarutil.ClearDependencyError (id,err) ->
+ error_replacing_dependency env sigma id err
+
+let internal_cut_gen ?(check=true) dir replace id t =
+ Proofview.Goal.enter begin fun gl ->
+ let env = Proofview.Goal.env gl in
+ let sigma = Tacmach.New.project gl in
+ let concl = Proofview.Goal.concl gl in
+ let store = Proofview.Goal.extra gl in
+ let sign = named_context_val env in
+ let sign',t,concl,sigma =
+ if replace then
+ let nexthyp = get_next_hyp_position id (named_context_of_val sign) in
+ let sign',t,concl,sigma = clear_hyps2 env sigma (Id.Set.singleton id) sign t concl in
+ let sign' = insert_decl_in_named_context sigma (LocalAssum (id,t)) nexthyp sign' in
+ sign',t,concl,sigma
+ else
+ (if check && mem_named_context_val id sign then
+ user_err (str "Variable " ++ pr_id id ++ str " is already declared.");
+ push_named_context_val (LocalAssum (id,t)) sign,t,concl,sigma) in
+ let nf_t = nf_betaiota sigma t in
+ Proofview.tclTHEN
+ (Proofview.Unsafe.tclEVARS sigma)
+ (Refine.refine ~typecheck:false begin fun sigma ->
+ let (sigma,ev,ev') =
+ if dir then
+ let (sigma, ev) = Evarutil.new_evar_from_context sign sigma nf_t in
+ let (sigma, ev') = Evarutil.new_evar_from_context sign' sigma ~principal:true ~store concl in
+ (sigma,ev,ev')
+ else
+ let (sigma, ev') = Evarutil.new_evar_from_context sign' sigma ~principal:true ~store concl in
+ let (sigma, ev) = Evarutil.new_evar_from_context sign sigma nf_t in
+ (sigma,ev,ev') in
+ let term = mkLetIn (Name id, ev, t, EConstr.Vars.subst_var id ev') in
+ (sigma, term)
+ end)
+ end
+
+let internal_cut ?(check=true) = internal_cut_gen ~check true
+let internal_cut_rev ?(check=true) = internal_cut_gen ~check false
+
let assert_before_then_gen b naming t tac =
let open Context.Rel.Declaration in
Proofview.Goal.enter begin fun gl ->
let id = find_name b (LocalAssum (Anonymous,t)) naming gl in
Tacticals.New.tclTHENLAST
- (Proofview.V82.tactic
- (fun gl ->
- try Tacmach.internal_cut b id t gl
- with Evarutil.ClearDependencyError (id,err) ->
- error_replacing_dependency (pf_env gl) (project gl) id err))
+ (internal_cut b id t)
(tac id)
end
@@ -463,11 +529,7 @@ let assert_after_then_gen b naming t tac =
Proofview.Goal.enter begin fun gl ->
let id = find_name b (LocalAssum (Anonymous,t)) naming gl in
Tacticals.New.tclTHENFIRST
- (Proofview.V82.tactic
- (fun gl ->
- try Tacmach.internal_cut_rev b id t gl
- with Evarutil.ClearDependencyError (id,err) ->
- error_replacing_dependency (pf_env gl) (project gl) id err))
+ (internal_cut_rev b id t)
(tac id)
end
@@ -999,29 +1061,10 @@ let intro_forthcoming_then_gen name_flag move_flag dep_flag n bound tac =
in
aux n []
-let get_next_hyp_position id gl =
- let rec aux = function
- | [] -> raise (RefinerError (NoSuchHyp id))
- | decl :: right ->
- if Id.equal (NamedDecl.get_id decl) id then
- match right with decl::_ -> MoveBefore (NamedDecl.get_id decl) | [] -> MoveLast
- else
- aux right
- in
- aux (Proofview.Goal.hyps (Proofview.Goal.assume gl))
-
-let get_previous_hyp_position id gl =
- let rec aux dest = function
- | [] -> raise (RefinerError (NoSuchHyp id))
- | decl :: right ->
- let hyp = NamedDecl.get_id decl in
- if Id.equal hyp id then dest else aux (MoveAfter hyp) right
- in
- aux MoveLast (Proofview.Goal.hyps (Proofview.Goal.assume gl))
-
let intro_replacing id =
Proofview.Goal.enter begin fun gl ->
- let next_hyp = get_next_hyp_position id gl in
+ let hyps = Proofview.Goal.hyps (Proofview.Goal.assume gl) in
+ let next_hyp = get_next_hyp_position id hyps in
Tacticals.New.tclTHENLIST [
clear_for_replacing [id];
introduction id;
@@ -1040,7 +1083,8 @@ let intro_replacing id =
let intros_possibly_replacing ids =
let suboptimal = true in
Proofview.Goal.enter begin fun gl ->
- let posl = List.map (fun id -> (id, get_next_hyp_position id gl)) ids in
+ let hyps = Proofview.Goal.hyps (Proofview.Goal.assume gl) in
+ let posl = List.map (fun id -> (id, get_next_hyp_position id hyps)) ids in
Tacticals.New.tclTHEN
(Tacticals.New.tclMAP (fun id ->
Tacticals.New.tclTRY (clear_for_replacing [id]))
@@ -1053,7 +1097,8 @@ let intros_possibly_replacing ids =
(* This version assumes that replacement is actually possible *)
let intros_replacing ids =
Proofview.Goal.enter begin fun gl ->
- let posl = List.map (fun id -> (id, get_next_hyp_position id gl)) ids in
+ let hyps = Proofview.Goal.hyps (Proofview.Goal.assume gl) in
+ let posl = List.map (fun id -> (id, get_next_hyp_position id hyps)) ids in
Tacticals.New.tclTHEN
(clear_for_replacing ids)
(Tacticals.New.tclMAP (fun (id,pos) -> intro_move (Some id) pos) posl)
@@ -2578,7 +2623,8 @@ let general_apply_in sidecond_first with_delta with_destruct with_evars
Proofview.Goal.enter begin fun gl ->
let destopt =
if with_evars then MoveLast (* evars would depend on the whole context *)
- else get_previous_hyp_position id gl in
+ else
+ get_previous_hyp_position id (Proofview.Goal.hyps (Proofview.Goal.assume gl)) in
let naming,ipat_tac =
prepare_intros_opt with_evars (IntroIdentifier id) destopt ipat in
let lemmas_target, last_lemma_target =
@@ -2979,7 +3025,7 @@ let specialize (c,lbind) ipat =
sigma,hd'
| _ ,_ -> assert false in
let sigma,hd = rebuild_lambdas sigma (List.rev lprod) [] c_hd tstack in
- sigma, hd
+ Evd.clear_metas sigma, hd
in
let typ = Retyping.get_type_of env sigma term in
let tac =
@@ -3074,17 +3120,17 @@ let expand_hyp id = Tacticals.New.tclTRY (unfold_body id) <*> clear [id]
*)
-let warn_unused_intro_pattern =
+let warn_unused_intro_pattern env sigma =
CWarnings.create ~name:"unused-intro-pattern" ~category:"tactics"
(fun names ->
strbrk"Unused introduction " ++ str (String.plural (List.length names) "pattern")
++ str": " ++ prlist_with_sep spc
(Miscprint.pr_intro_pattern
- (fun c -> Printer.pr_econstr (snd (c (Global.env()) Evd.empty)))) names)
+ (fun c -> Printer.pr_econstr (snd (c env sigma)))) names)
-let check_unused_names names =
+let check_unused_names env sigma names =
if not (List.is_empty names) then
- warn_unused_intro_pattern names
+ warn_unused_intro_pattern env sigma names
let intropattern_of_name gl avoid = function
| Anonymous -> IntroNaming IntroAnonymous
@@ -3204,8 +3250,12 @@ let induct_discharge with_evars dests avoid' tac (avoid,ra) names =
peel_tac ra' dests names thin)
end
| [] ->
- check_unused_names names;
+ Proofview.Goal.enter begin fun gl ->
+ let env = Proofview.Goal.env gl in
+ let sigma = Proofview.Goal.sigma gl in
+ check_unused_names env sigma names;
Tacticals.New.tclTHEN (clear_wildcards thin) (tac dests)
+ end
in
peel_tac ra dests names []
@@ -3272,7 +3322,7 @@ let atomize_param_of_ind_then (indref,nparams,_) hyp0 tac =
| Var id -> id
| _ ->
let type_of = Tacmach.New.pf_unsafe_type_of gl in
- id_of_name_using_hdchar (Global.env()) sigma (type_of c) Anonymous in
+ id_of_name_using_hdchar env sigma (type_of c) Anonymous in
let x = fresh_id_in_env avoid id env in
Tacticals.New.tclTHEN
(letin_tac None (Name x) c None allHypsAndConcl)
@@ -3805,11 +3855,12 @@ let compare_upto_variables sigma x y =
in
compare x y
-let specialize_eqs id gl =
+let specialize_eqs id =
let open Context.Rel.Declaration in
- let env = Tacmach.pf_env gl in
- let ty = Tacmach.pf_get_hyp_typ gl id in
- let evars = ref (project gl) in
+ Proofview.Goal.enter begin fun gl ->
+ let env = Proofview.Goal.env gl in
+ let ty = Tacmach.New.pf_get_hyp_typ id gl in
+ let evars = ref (Proofview.Goal.sigma gl) in
let unif env evars c1 c2 =
compare_upto_variables !evars c1 c2 && Evarconv.e_conv env evars c1 c2
in
@@ -3852,16 +3903,18 @@ let specialize_eqs id gl =
and acc' = Tacred.whd_simpl env !evars acc' in
let ty' = Evarutil.nf_evar !evars ty' in
if worked then
- tclTHENFIRST (Tacmach.internal_cut true id ty')
- (Proofview.V82.of_tactic (exact_no_check ((* refresh_universes_strict *) acc'))) gl
- else tclFAIL 0 (str "Nothing to do in hypothesis " ++ pr_id id) gl
-
+ Tacticals.New.tclTHENFIRST
+ (internal_cut true id ty')
+ (exact_no_check ((* refresh_universes_strict *) acc'))
+ else
+ Tacticals.New.tclFAIL 0 (str "Nothing to do in hypothesis " ++ pr_id id)
+ end
let specialize_eqs id = Proofview.Goal.enter begin fun gl ->
let msg = str "Specialization not allowed on dependent hypotheses" in
Proofview.tclOR (clear [id])
(fun _ -> Tacticals.New.tclZEROMSG msg) >>= fun () ->
- Proofview.V82.tactic (specialize_eqs id)
+ specialize_eqs id
end
let occur_rel sigma n c =
@@ -4485,7 +4538,7 @@ let induction_gen clear_flag isrec with_evars elim
declaring the induction argument as a new local variable *)
let id =
(* Type not the right one if partially applied but anyway for internal use*)
- let x = id_of_name_using_hdchar (Global.env()) evd t Anonymous in
+ let x = id_of_name_using_hdchar env evd t Anonymous in
new_fresh_id [] x gl in
let info_arg = (is_arg_pure_hyp, not enough_applied) in
pose_induction_arg_then
@@ -4521,8 +4574,9 @@ let induction_gen_l isrec with_evars elim names lc =
Proofview.Goal.enter begin fun gl ->
let type_of = Tacmach.New.pf_unsafe_type_of gl in
let sigma = Tacmach.New.project gl in
+ Proofview.tclENV >>= fun env ->
let x =
- id_of_name_using_hdchar (Global.env()) sigma (type_of c) Anonymous in
+ id_of_name_using_hdchar env sigma (type_of c) Anonymous in
let id = new_fresh_id [] x gl in
let newl' = List.map (fun r -> replace_term sigma c (mkVar id) r) l' in
@@ -4741,8 +4795,9 @@ let prove_symmetry hdcncl eq_kind =
one_constructor 1 NoBindings ])
let match_with_equation sigma c =
+ Proofview.tclENV >>= fun env ->
try
- let res = match_with_equation sigma c in
+ let res = match_with_equation env sigma c in
Proofview.tclUNIT res
with NoEquationFound ->
Proofview.tclZERO NoEquationFound
diff --git a/tactics/term_dnet.ml b/tactics/term_dnet.ml
index e90e1959e..64ba38a51 100644
--- a/tactics/term_dnet.ml
+++ b/tactics/term_dnet.ml
@@ -49,7 +49,7 @@ struct
| DNil
(* debug *)
- let _pr_dconstr f : 'a t -> std_ppcmds = function
+ let _pr_dconstr f : 'a t -> Pp.t = function
| DRel -> str "*"
| DSort -> str "Sort"
| DRef _ -> str "Ref"
diff --git a/test-suite/Makefile b/test-suite/Makefile
index beb80a3df..78d90aad8 100644
--- a/test-suite/Makefile
+++ b/test-suite/Makefile
@@ -33,6 +33,7 @@ BIN := $(shell cd ..; pwd)/bin/
coqtop := $(BIN)coqtop -coqlib $(LIB) -boot -q -batch -test-mode -R prerequisite TestSuite
coqc := $(BIN)coqc -coqlib $(LIB) -R prerequisite TestSuite
coqchk := $(BIN)coqchk -coqlib $(LIB) -R prerequisite TestSuite
+coqdoc := $(BIN)coqdoc
coqtopbyte := $(BIN)coqtop.byte
coqtopload := $(coqtop) -top Top -async-proofs-cache force -load-vernac-source
@@ -85,7 +86,8 @@ COMPLEXITY := $(if $(bogomips),complexity)
BUGS := bugs/opened bugs/closed
VSUBSYSTEMS := prerequisite success failure $(BUGS) output \
- output-modulo-time interactive micromega $(COMPLEXITY) modules stm
+ output-modulo-time interactive micromega $(COMPLEXITY) modules stm \
+ coqdoc
# All subsystems
SUBSYSTEMS := $(VSUBSYSTEMS) misc bugs ide vio coqchk coq-makefile
@@ -153,6 +155,7 @@ summary:
$(call summary_dir, "VI tests", vio); \
$(call summary_dir, "Coqchk tests", coqchk); \
$(call summary_dir, "Coq makefile", coq-makefile); \
+ $(call summary_dir, "Coqdoc tests", coqdoc); \
nb_success=`find . -name '*.log' -exec tail -n2 '{}' \; | grep -e $(log_success) | wc -l`; \
nb_failure=`find . -name '*.log' -exec tail -n2 '{}' \; | grep -e $(log_failure) | wc -l`; \
nb_tests=`expr $$nb_success + $$nb_failure`; \
@@ -456,6 +459,8 @@ ide : $(patsubst %.fake,%.fake.log,$(wildcard ide/*.fake))
fi; \
} > "$@"
+# vio compilation
+
vio: $(patsubst %.v,%.vio.log,$(wildcard vio/*.v))
%.vio.log:%.v
@@ -473,6 +478,8 @@ vio: $(patsubst %.v,%.vio.log,$(wildcard vio/*.v))
fi; \
} > "$@"
+# coqchk
+
coqchk: $(patsubst %.v,%.chk.log,$(wildcard coqchk/*.v))
%.chk.log:%.v
@@ -489,6 +496,8 @@ coqchk: $(patsubst %.v,%.chk.log,$(wildcard coqchk/*.v))
fi; \
} > "$@"
+# coq_makefile
+
coq-makefile: $(patsubst %/run.sh,%.log,$(wildcard coq-makefile/*/run.sh))
coq-makefile/%.log : coq-makefile/%/run.sh
@@ -505,3 +514,27 @@ coq-makefile/%.log : coq-makefile/%/run.sh
echo " $<...Error!"; \
fi; \
) > "$@"
+
+# coqdoc
+
+coqdoc: $(patsubst %.sh,%.log,$(wildcard coqdoc/*.sh))
+
+$(addsuffix .log,$(wildcard coqdoc/*.v)): %.v.log: %.v %.html.out %.tex.out $(PREREQUISITELOG)
+ @echo "TEST $< $(call get_coq_prog_args_in_parens,"$<")"
+ $(HIDE){ \
+ echo $(call log_intro,$<); \
+ $(coqc) -R coqdoc Coqdoc $* 2>&1; \
+ cd coqdoc; \
+ f=`basename $*`; \
+ $(coqdoc) -R . Coqdoc -coqlib http://coq.inria.fr/stdlib --html $$f.v; \
+ $(coqdoc) -R . Coqdoc -coqlib http://coq.inria.fr/stdlib --latex $$f.v; \
+ diff -u --strip-trailing-cr $$f.html.out Coqdoc.$$f.html 2>&1; R=$$?; times; \
+ grep -v "^%%" Coqdoc.$$f.tex | diff -u --strip-trailing-cr $$f.tex.out - 2>&1; S=$$?; times; \
+ if [ $$R = 0 -a $$S = 0 ]; then \
+ echo $(log_success); \
+ echo " $<...Ok"; \
+ else \
+ echo $(log_failure); \
+ echo " $<...Error! (unexpected output)"; \
+ fi; \
+ } > "$@"
diff --git a/test-suite/bugs/closed/1859.v b/test-suite/bugs/closed/1859.v
new file mode 100644
index 000000000..43acfe4ba
--- /dev/null
+++ b/test-suite/bugs/closed/1859.v
@@ -0,0 +1,20 @@
+Require Import Ring.
+Require Import ArithRing.
+
+Ltac ring_simplify_neq :=
+ match goal with
+ | [ H: ?X <> ?Y |- _ ] => progress ring_simplify X Y in H
+ end.
+
+Lemma toto : forall x y, x*1 <> y*1 -> y*1 <> x*1 -> x<>y.
+Proof.
+ intros.
+ ring_simplify_neq.
+ ring_simplify_neq.
+ (* make sure ring_simplify has simplified both hypotheses *)
+ match goal with
+ | [ H: context[_*1] |- _ ] => fail 1
+ | _ => idtac
+ end.
+ auto.
+Qed.
diff --git a/test-suite/bugs/closed/2141.v b/test-suite/bugs/closed/2141.v
index 098a7e9e7..c556ff0b2 100644
--- a/test-suite/bugs/closed/2141.v
+++ b/test-suite/bugs/closed/2141.v
@@ -11,5 +11,6 @@ End FSetHide.
Module NatSet' := FSetHide NatSet.
Recursive Extraction NatSet'.fold.
+Extraction TestCompile NatSet'.fold.
(* Extraction "test2141.ml" NatSet'.fold. *) \ No newline at end of file
diff --git a/test-suite/bugs/closed/3287.v b/test-suite/bugs/closed/3287.v
index 1b758acd7..4b3e7ff05 100644
--- a/test-suite/bugs/closed/3287.v
+++ b/test-suite/bugs/closed/3287.v
@@ -6,6 +6,7 @@ Definition bar := true.
End Foo.
Recursive Extraction Foo.bar.
+Extraction TestCompile Foo.bar.
Module Foo'.
Definition foo := (I,I).
@@ -13,10 +14,6 @@ Definition bar := true.
End Foo'.
Recursive Extraction Foo'.bar.
+Extraction TestCompile Foo'.bar.
-Module Foo''.
-Definition foo := (I,I).
-Definition bar := true.
-End Foo''.
-
-Extraction Foo.bar.
+Extraction Foo'.bar.
diff --git a/test-suite/bugs/closed/3923.v b/test-suite/bugs/closed/3923.v
index 2fb0a5439..1d9488c6e 100644
--- a/test-suite/bugs/closed/3923.v
+++ b/test-suite/bugs/closed/3923.v
@@ -33,3 +33,4 @@ Axiom empty_fieldstore : cert_fieldstore.
End MkCertRuntimeTypes.
Extraction MkCertRuntimeTypes. (* Was leading to an uncaught Not_found *)
+Extraction TestCompile MkCertRuntimeTypes.
diff --git a/test-suite/bugs/closed/4616.v b/test-suite/bugs/closed/4616.v
index a59975dbc..d6660e355 100644
--- a/test-suite/bugs/closed/4616.v
+++ b/test-suite/bugs/closed/4616.v
@@ -2,5 +2,6 @@ Require Coq.extraction.Extraction.
Set Primitive Projections.
Record Foo' := Foo { foo : Type }.
-Axiom f : forall t : Foo', foo t.
+Definition f := forall t : Foo', foo t.
Extraction f.
+Extraction TestCompile f.
diff --git a/test-suite/bugs/closed/4709.v b/test-suite/bugs/closed/4709.v
new file mode 100644
index 000000000..a9edcc804
--- /dev/null
+++ b/test-suite/bugs/closed/4709.v
@@ -0,0 +1,18 @@
+
+(** Bug 4709 https://coq.inria.fr/bug/4709
+ Extraction wasn't reducing primitive projections in types. *)
+
+Require Extraction.
+
+Set Primitive Projections.
+
+Record t := Foo { foo : Type }.
+Definition ty := foo (Foo nat).
+
+(* Without proper reduction of primitive projections in
+ [extract_type], the type [ty] was extracted as [Tunknown].
+ Let's check it isn't the case anymore. *)
+
+Parameter check : nat.
+Extract Constant check => "(O:ty)".
+Extraction TestCompile ty check.
diff --git a/test-suite/bugs/closed/4710.v b/test-suite/bugs/closed/4710.v
index 5d8ca330a..e792a3623 100644
--- a/test-suite/bugs/closed/4710.v
+++ b/test-suite/bugs/closed/4710.v
@@ -4,7 +4,6 @@ Set Primitive Projections.
Record Foo' := Foo { foo : nat }.
Extraction foo.
Record Foo2 (a : nat) := Foo2c { foo2p : nat; foo2b : bool }.
-Extraction Language Ocaml.
Extraction foo2p.
Definition bla (x : Foo2 0) := foo2p _ x.
@@ -12,3 +11,5 @@ Extraction bla.
Definition bla' (a : nat) (x : Foo2 a) := foo2b _ x.
Extraction bla'.
+
+Extraction TestCompile foo foo2p bla bla'.
diff --git a/test-suite/bugs/closed/4720.v b/test-suite/bugs/closed/4720.v
index 9265b60c1..704331e78 100644
--- a/test-suite/bugs/closed/4720.v
+++ b/test-suite/bugs/closed/4720.v
@@ -44,3 +44,7 @@ Recursive Extraction WithMod.
Recursive Extraction WithDef.
Recursive Extraction WithModPriv.
+
+(* Let's even check that all this extracted code is actually compilable: *)
+
+Extraction TestCompile WithMod WithDef WithModPriv.
diff --git a/test-suite/bugs/closed/5177.v b/test-suite/bugs/closed/5177.v
index 231d103a5..7c8af1e46 100644
--- a/test-suite/bugs/closed/5177.v
+++ b/test-suite/bugs/closed/5177.v
@@ -19,3 +19,4 @@ End MakeA.
Require Extraction.
Recursive Extraction MakeA.
+Extraction TestCompile MakeA.
diff --git a/test-suite/bugs/closed/5315.v b/test-suite/bugs/closed/5315.v
new file mode 100644
index 000000000..f1f1b8c05
--- /dev/null
+++ b/test-suite/bugs/closed/5315.v
@@ -0,0 +1,10 @@
+Require Import Recdef.
+
+Function dumb_works (a:nat) {struct a} :=
+ match (fun x => x) a with O => O | S n' => dumb_works n' end.
+
+Function dumb_nope (a:nat) {struct a} :=
+ match (id (fun x => x)) a with O => O | S n' => dumb_nope n' end.
+
+(* This check is just present to ensure Function worked well *)
+Check R_dumb_nope_complete. \ No newline at end of file
diff --git a/test-suite/bugs/closed/5469.v b/test-suite/bugs/closed/5469.v
deleted file mode 100644
index fce671c75..000000000
--- a/test-suite/bugs/closed/5469.v
+++ /dev/null
@@ -1,3 +0,0 @@
-(* Some problems with the special treatment of curly braces *)
-
-Reserved Notation "'a' { x }" (at level 0, format "'a' { x }").
diff --git a/test-suite/bugs/closed/5598.v b/test-suite/bugs/closed/5598.v
new file mode 100644
index 000000000..55fef1a57
--- /dev/null
+++ b/test-suite/bugs/closed/5598.v
@@ -0,0 +1,8 @@
+(* Checking when discharge of an existing class is possible *)
+Section foo.
+ Context {T} (a : T) (b : T).
+ Let k := eq_refl a.
+ Existing Class eq.
+ Fail Global Existing Instance k.
+ Existing Instance k.
+End foo.
diff --git a/test-suite/bugs/closed/5608.v b/test-suite/bugs/closed/5608.v
new file mode 100644
index 000000000..f02eae69c
--- /dev/null
+++ b/test-suite/bugs/closed/5608.v
@@ -0,0 +1,33 @@
+Reserved Notation "'slet' x .. y := A 'in' b"
+ (at level 200, x binder, y binder, b at level 200, format "'slet' x .. y := A 'in' '//' b").
+Reserved Notation "T x [1] = { A } ; 'return' ( b0 , b1 , .. , b2 )"
+ (at level 200, format "T x [1] = { A } ; '//' 'return' ( b0 , b1 , .. , b2 )").
+
+Delimit Scope ctype_scope with ctype.
+Local Open Scope ctype_scope.
+Delimit Scope expr_scope with expr.
+Inductive base_type := TZ | TWord (logsz : nat).
+Inductive flat_type := Tbase (T : base_type) | Prod (A B : flat_type).
+Context {var : base_type -> Type}.
+Fixpoint interp_flat_type (interp_base_type : base_type -> Type) (t :
+flat_type) :=
+ match t with
+ | Tbase t => interp_base_type t
+ | Prod x y => prod (interp_flat_type interp_base_type x) (interp_flat_type
+interp_base_type y)
+ end.
+Inductive exprf : flat_type -> Type :=
+| Var {t} (v : var t) : exprf (Tbase t)
+| LetIn {tx} (ex : exprf tx) {tC} (eC : interp_flat_type var tx -> exprf tC) :
+exprf tC
+| Pair {tx} (ex : exprf tx) {ty} (ey : exprf ty) : exprf (Prod tx ty).
+Global Arguments Var {_} _.
+Global Arguments LetIn {_} _ {_} _.
+Global Arguments Pair {_} _ {_} _.
+Notation "T x [1] = { A } ; 'return' ( b0 , b1 , .. , b2 )" := (LetIn (tx:=T) A
+(fun x => Pair .. (Pair b0%expr b1%expr) .. b2%expr)) : expr_scope.
+Definition foo :=
+ (fun x3 =>
+ (LetIn (Var x3) (fun x18 : var TZ
+ => (Pair (Var x18) (Var x18))))).
+Print foo.
diff --git a/test-suite/bugs/closed/5671.v b/test-suite/bugs/closed/5671.v
new file mode 100644
index 000000000..c9a085045
--- /dev/null
+++ b/test-suite/bugs/closed/5671.v
@@ -0,0 +1,7 @@
+(* Fixing Meta-unclean specialize *)
+
+Require Import Setoid.
+Axiom a : forall x, x=0 -> True.
+Lemma lem (x y1 y2:nat) (H:x=0) (H0:eq y1 y2) : y1 = y2.
+specialize a with (1:=H). clear H x. intros _.
+setoid_rewrite H0.
diff --git a/test-suite/bugs/closed/HoTT_coq_032.v b/test-suite/bugs/closed/HoTT_coq_032.v
index 39a7103d1..40abb215e 100644
--- a/test-suite/bugs/closed/HoTT_coq_032.v
+++ b/test-suite/bugs/closed/HoTT_coq_032.v
@@ -1,4 +1,3 @@
-(* -*- mode: coq; coq-prog-args: ("-xml") -*- *)
Set Implicit Arguments.
Generalizable All Variables.
Set Asymmetric Patterns.
diff --git a/test-suite/coqchk/cumulativity.v b/test-suite/coqchk/cumulativity.v
index a978f6b90..7906a5b15 100644
--- a/test-suite/coqchk/cumulativity.v
+++ b/test-suite/coqchk/cumulativity.v
@@ -1,5 +1,5 @@
Set Universe Polymorphism.
-Set Inductive Cumulativity.
+Set Polymorphic Inductive Cumulativity.
Set Printing Universes.
Inductive List (A: Type) := nil | cons : A -> List A -> List A.
diff --git a/test-suite/coqdoc/bug5648.html.out b/test-suite/coqdoc/bug5648.html.out
new file mode 100644
index 000000000..06789c1c1
--- /dev/null
+++ b/test-suite/coqdoc/bug5648.html.out
@@ -0,0 +1,53 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+<link href="coqdoc.css" rel="stylesheet" type="text/css" />
+<title>Coqdoc.bug5648</title>
+</head>
+
+<body>
+
+<div id="page">
+
+<div id="header">
+</div>
+
+<div id="main">
+
+<h1 class="libtitle">Library Coqdoc.bug5648</h1>
+
+<div class="code">
+<span class="id" title="keyword">Lemma</span> <a name="a"><span class="id" title="lemma">a</span></a> : <a class="idref" href="http://coq.inria.fr/stdlib/Coq.Init.Logic.html#True"><span class="id" title="inductive">True</span></a>.<br/>
+<span class="id" title="keyword">Proof</span>.<br/>
+<span class="id" title="tactic">auto</span>.<br/>
+<span class="id" title="keyword">Qed</span>.<br/>
+
+<br/>
+<span class="id" title="keyword">Variant</span> <a name="t"><span class="id" title="inductive">t</span></a> :=<br/>
+| <a name="A"><span class="id" title="constructor">A</span></a> | <a name="Add"><span class="id" title="constructor">Add</span></a> | <a name="G"><span class="id" title="constructor">G</span></a> | <a name="Goal"><span class="id" title="constructor">Goal</span></a> | <a name="L"><span class="id" title="constructor">L</span></a> | <a name="Lemma"><span class="id" title="constructor">Lemma</span></a> | <a name="P"><span class="id" title="constructor">P</span></a> | <a name="Proof"><span class="id" title="constructor">Proof</span></a> .<br/>
+
+<br/>
+<span class="id" title="keyword">Definition</span> <a name="d"><span class="id" title="definition">d</span></a> <span class="id" title="var">x</span> :=<br/>
+&nbsp;&nbsp;<span class="id" title="keyword">match</span> <a class="idref" href="Coqdoc.bug5648.html#x"><span class="id" title="variable">x</span></a> <span class="id" title="keyword">with</span><br/>
+&nbsp;&nbsp;| <a class="idref" href="Coqdoc.bug5648.html#A"><span class="id" title="constructor">A</span></a> =&gt; 0<br/>
+&nbsp;&nbsp;| <a class="idref" href="Coqdoc.bug5648.html#Add"><span class="id" title="constructor">Add</span></a> =&gt; 1<br/>
+&nbsp;&nbsp;| <a class="idref" href="Coqdoc.bug5648.html#G"><span class="id" title="constructor">G</span></a> =&gt; 2<br/>
+&nbsp;&nbsp;| <a class="idref" href="Coqdoc.bug5648.html#Goal"><span class="id" title="constructor">Goal</span></a> =&gt; 3<br/>
+&nbsp;&nbsp;| <a class="idref" href="Coqdoc.bug5648.html#L"><span class="id" title="constructor">L</span></a> =&gt; 4<br/>
+&nbsp;&nbsp;| <a class="idref" href="Coqdoc.bug5648.html#Lemma"><span class="id" title="constructor">Lemma</span></a> =&gt; 5<br/>
+&nbsp;&nbsp;| <a class="idref" href="Coqdoc.bug5648.html#P"><span class="id" title="constructor">P</span></a> =&gt; 6<br/>
+&nbsp;&nbsp;| <a class="idref" href="Coqdoc.bug5648.html#Proof"><span class="id" title="constructor">Proof</span></a> =&gt; 7<br/>
+&nbsp;&nbsp;<span class="id" title="keyword">end</span>.<br/>
+</div>
+</div>
+
+<div id="footer">
+<hr/><a href="index.html">Index</a><hr/>This page has been generated by <a href="http://coq.inria.fr/">coqdoc</a>
+</div>
+
+</div>
+
+</body>
+</html> \ No newline at end of file
diff --git a/test-suite/coqdoc/bug5648.tex.out b/test-suite/coqdoc/bug5648.tex.out
new file mode 100644
index 000000000..b0b732eff
--- /dev/null
+++ b/test-suite/coqdoc/bug5648.tex.out
@@ -0,0 +1,49 @@
+\documentclass[12pt]{report}
+\usepackage[]{inputenc}
+\usepackage[T1]{fontenc}
+\usepackage{fullpage}
+\usepackage{coqdoc}
+\usepackage{amsmath,amssymb}
+\usepackage{url}
+\begin{document}
+\coqlibrary{Coqdoc.bug5648}{Library }{Coqdoc.bug5648}
+
+\begin{coqdoccode}
+\coqdocnoindent
+\coqdockw{Lemma} \coqdef{Coqdoc.bug5648.a}{a}{\coqdoclemma{a}} : \coqexternalref{True}{http://coq.inria.fr/stdlib/Coq.Init.Logic}{\coqdocinductive{True}}.\coqdoceol
+\coqdocnoindent
+\coqdockw{Proof}.\coqdoceol
+\coqdocnoindent
+\coqdoctac{auto}.\coqdoceol
+\coqdocnoindent
+\coqdockw{Qed}.\coqdoceol
+\coqdocemptyline
+\coqdocnoindent
+\coqdockw{Variant} \coqdef{Coqdoc.bug5648.t}{t}{\coqdocinductive{t}} :=\coqdoceol
+\coqdocnoindent
+\ensuremath{|} \coqdef{Coqdoc.bug5648.A}{A}{\coqdocconstructor{A}} \ensuremath{|} \coqdef{Coqdoc.bug5648.Add}{Add}{\coqdocconstructor{Add}} \ensuremath{|} \coqdef{Coqdoc.bug5648.G}{G}{\coqdocconstructor{G}} \ensuremath{|} \coqdef{Coqdoc.bug5648.Goal}{Goal}{\coqdocconstructor{Goal}} \ensuremath{|} \coqdef{Coqdoc.bug5648.L}{L}{\coqdocconstructor{L}} \ensuremath{|} \coqdef{Coqdoc.bug5648.Lemma}{Lemma}{\coqdocconstructor{Lemma}} \ensuremath{|} \coqdef{Coqdoc.bug5648.P}{P}{\coqdocconstructor{P}} \ensuremath{|} \coqdef{Coqdoc.bug5648.Proof}{Proof}{\coqdocconstructor{Proof}} .\coqdoceol
+\coqdocemptyline
+\coqdocnoindent
+\coqdockw{Definition} \coqdef{Coqdoc.bug5648.d}{d}{\coqdocdefinition{d}} \coqdocvar{x} :=\coqdoceol
+\coqdocindent{1.00em}
+\coqdockw{match} \coqdocvariable{x} \coqdockw{with}\coqdoceol
+\coqdocindent{1.00em}
+\ensuremath{|} \coqref{Coqdoc.bug5648.A}{\coqdocconstructor{A}} \ensuremath{\Rightarrow} 0\coqdoceol
+\coqdocindent{1.00em}
+\ensuremath{|} \coqref{Coqdoc.bug5648.Add}{\coqdocconstructor{Add}} \ensuremath{\Rightarrow} 1\coqdoceol
+\coqdocindent{1.00em}
+\ensuremath{|} \coqref{Coqdoc.bug5648.G}{\coqdocconstructor{G}} \ensuremath{\Rightarrow} 2\coqdoceol
+\coqdocindent{1.00em}
+\ensuremath{|} \coqref{Coqdoc.bug5648.Goal}{\coqdocconstructor{Goal}} \ensuremath{\Rightarrow} 3\coqdoceol
+\coqdocindent{1.00em}
+\ensuremath{|} \coqref{Coqdoc.bug5648.L}{\coqdocconstructor{L}} \ensuremath{\Rightarrow} 4\coqdoceol
+\coqdocindent{1.00em}
+\ensuremath{|} \coqref{Coqdoc.bug5648.Lemma}{\coqdocconstructor{Lemma}} \ensuremath{\Rightarrow} 5\coqdoceol
+\coqdocindent{1.00em}
+\ensuremath{|} \coqref{Coqdoc.bug5648.P}{\coqdocconstructor{P}} \ensuremath{\Rightarrow} 6\coqdoceol
+\coqdocindent{1.00em}
+\ensuremath{|} \coqref{Coqdoc.bug5648.Proof}{\coqdocconstructor{Proof}} \ensuremath{\Rightarrow} 7\coqdoceol
+\coqdocindent{1.00em}
+\coqdockw{end}.\coqdoceol
+\end{coqdoccode}
+\end{document}
diff --git a/test-suite/coqdoc/bug5648.v b/test-suite/coqdoc/bug5648.v
new file mode 100644
index 000000000..9b62dd1e1
--- /dev/null
+++ b/test-suite/coqdoc/bug5648.v
@@ -0,0 +1,19 @@
+Lemma a : True.
+Proof.
+auto.
+Qed.
+
+Variant t :=
+| A | Add | G | Goal | L | Lemma | P | Proof .
+
+Definition d x :=
+ match x with
+ | A => 0
+ | Add => 1
+ | G => 2
+ | Goal => 3
+ | L => 4
+ | Lemma => 5
+ | P => 6
+ | Proof => 7
+ end.
diff --git a/test-suite/coqdoc/links.html.out b/test-suite/coqdoc/links.html.out
new file mode 100644
index 000000000..7d7d01c1b
--- /dev/null
+++ b/test-suite/coqdoc/links.html.out
@@ -0,0 +1,206 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+<link href="coqdoc.css" rel="stylesheet" type="text/css" />
+<title>Coqdoc.links</title>
+</head>
+
+<body>
+
+<div id="page">
+
+<div id="header">
+</div>
+
+<div id="main">
+
+<h1 class="libtitle">Library Coqdoc.links</h1>
+
+<div class="code">
+</div>
+
+<div class="doc">
+Various checks for coqdoc
+
+<div class="paragraph"> </div>
+
+<ul class="doclist">
+<li> symbols should not be inlined in string g
+
+</li>
+<li> links to both kinds of notations in a' should work to the right notation
+
+</li>
+<li> with utf8 option, forall must be unicode
+
+</li>
+<li> splitting between symbols and ident should be correct in a' and c
+
+</li>
+<li> ".." should be rendered correctly
+
+</li>
+</ul>
+
+</div>
+<div class="code">
+
+<br/>
+<span class="id" title="keyword">Require</span> <span class="id" title="keyword">Import</span> <a class="idref" href="http://coq.inria.fr/stdlib/Coq.Strings.String.html#"><span class="id" title="library">String</span></a>.<br/>
+
+<br/>
+<span class="id" title="keyword">Definition</span> <a name="g"><span class="id" title="definition">g</span></a> := "dfjkh""sdfhj forall &lt;&gt; * ~"%<span class="id" title="var">string</span>.<br/>
+
+<br/>
+<span class="id" title="keyword">Definition</span> <a name="a"><span class="id" title="definition">a</span></a> (<span class="id" title="var">b</span>: <a class="idref" href="http://coq.inria.fr/stdlib/Coq.Init.Datatypes.html#nat"><span class="id" title="inductive">nat</span></a>) := <a class="idref" href="Coqdoc.links.html#b"><span class="id" title="variable">b</span></a>.<br/>
+
+<br/>
+<span class="id" title="keyword">Definition</span> <a name="f"><span class="id" title="definition">f</span></a> := <span class="id" title="keyword">forall</span> <span class="id" title="var">C</span>:<span class="id" title="keyword">Prop</span>, <a class="idref" href="Coqdoc.links.html#C"><span class="id" title="variable">C</span></a>.<br/>
+
+<br/>
+<span class="id" title="keyword">Notation</span> <a name="1a1c7f13320341c3638e9edcc3e6389d"><span class="id" title="notation">&quot;</span></a>n ++ m" := (<a class="idref" href="http://coq.inria.fr/stdlib/Coq.Init.Peano.html#plus"><span class="id" title="abbreviation">plus</span></a> <span class="id" title="var">n</span> <span class="id" title="var">m</span>).<br/>
+
+<br/>
+<span class="id" title="keyword">Notation</span> <a name="1a1c7f13320341c3638e9edcc3e6389d"><span class="id" title="notation">&quot;</span></a>n ++ m" := (<a class="idref" href="http://coq.inria.fr/stdlib/Coq.Init.Peano.html#mult"><span class="id" title="abbreviation">mult</span></a> <span class="id" title="var">n</span> <span class="id" title="var">m</span>).
+<br/>
+<span class="id" title="keyword">Notation</span> <a name="6b97e27793a3d22f5c0d1dd63170fd68"><span class="id" title="notation">&quot;</span></a>n ** m" := (<a class="idref" href="http://coq.inria.fr/stdlib/Coq.Init.Peano.html#plus"><span class="id" title="abbreviation">plus</span></a> <span class="id" title="var">n</span> <span class="id" title="var">m</span>) (<span class="id" title="tactic">at</span> <span class="id" title="keyword">level</span> 60).<br/>
+
+<br/>
+<span class="id" title="keyword">Notation</span> <a name="3e01fbae4590c7b7699ff99ce61580e1"><span class="id" title="notation">&quot;</span></a>n â–µ m" := (<a class="idref" href="http://coq.inria.fr/stdlib/Coq.Init.Peano.html#plus"><span class="id" title="abbreviation">plus</span></a> <span class="id" title="var">n</span> <span class="id" title="var">m</span>) (<span class="id" title="tactic">at</span> <span class="id" title="keyword">level</span> 60).<br/>
+
+<br/>
+<span class="id" title="keyword">Notation</span> <a name="347f39a83bf7d45676cff54fd7e8966f"><span class="id" title="notation">&quot;</span></a>n '_' ++ 'x' m" := (<a class="idref" href="http://coq.inria.fr/stdlib/Coq.Init.Peano.html#plus"><span class="id" title="abbreviation">plus</span></a> <span class="id" title="var">n</span> <span class="id" title="var">m</span>) (<span class="id" title="tactic">at</span> <span class="id" title="keyword">level</span> 3).<br/>
+
+<br/>
+<span class="id" title="keyword">Inductive</span> <a name="eq"><span class="id" title="inductive">eq</span></a> (<span class="id" title="var">A</span>:<span class="id" title="keyword">Type</span>) (<span class="id" title="var">x</span>:<a class="idref" href="Coqdoc.links.html#A"><span class="id" title="variable">A</span></a>) : <span class="id" title="var">A</span> <a class="idref" href="http://coq.inria.fr/stdlib/Coq.Init.Logic.html#d43e996736952df71ebeeae74d10a287"><span class="id" title="notation">-&gt;</span></a> <span class="id" title="keyword">Prop</span> := <a name="eq_refl"><span class="id" title="constructor">eq_refl</span></a> : <a class="idref" href="Coqdoc.links.html#x"><span class="id" title="variable">x</span></a> <a class="idref" href="Coqdoc.links.html#8f9364556521ebb498093f28eea2240f"><span class="id" title="notation">=</span></a> <a class="idref" href="Coqdoc.links.html#x"><span class="id" title="variable">x</span></a> <a class="idref" href="Coqdoc.links.html#8f9364556521ebb498093f28eea2240f"><span class="id" title="notation">:&gt;</span></a><a class="idref" href="Coqdoc.links.html#A"><span class="id" title="variable">A</span></a><br/>
+<br/>
+<span class="id" title="keyword">where</span> <a name="8f9364556521ebb498093f28eea2240f"><span class="id" title="notation">&quot;</span></a>x = y :&gt; A" := (@<a class="idref" href="Coqdoc.links.html#eq"><span class="id" title="variable">eq</span></a> <span class="id" title="var">A</span> <span class="id" title="var">x</span> <span class="id" title="var">y</span>) : <span class="id" title="var">type_scope</span>.<br/>
+
+<br/>
+<span class="id" title="keyword">Definition</span> <a name="eq0"><span class="id" title="definition">eq0</span></a> := 0 <a class="idref" href="Coqdoc.links.html#8f9364556521ebb498093f28eea2240f"><span class="id" title="notation">=</span></a> 0 <a class="idref" href="Coqdoc.links.html#8f9364556521ebb498093f28eea2240f"><span class="id" title="notation">:&gt;</span></a> <a class="idref" href="http://coq.inria.fr/stdlib/Coq.Init.Datatypes.html#nat"><span class="id" title="inductive">nat</span></a>.<br/>
+
+<br/>
+<span class="id" title="keyword">Notation</span> <a name="548d1059c499c9b2a9b95b07e68c2090"><span class="id" title="notation">&quot;</span></a>( x # y ; .. ; z )" := (<a class="idref" href="http://coq.inria.fr/stdlib/Coq.Init.Datatypes.html#pair"><span class="id" title="constructor">pair</span></a> .. (<a class="idref" href="http://coq.inria.fr/stdlib/Coq.Init.Datatypes.html#pair"><span class="id" title="constructor">pair</span></a> <span class="id" title="var">x</span> <span class="id" title="var">y</span>) .. <span class="id" title="var">z</span>).<br/>
+
+<br/>
+<span class="id" title="keyword">Definition</span> <a name="9f5a1d89cbd4d38f5e289576db7123d1"><span class="id" title="definition">b_α</span></a> := <a class="idref" href="http://coq.inria.fr/stdlib/Coq.Init.Datatypes.html#44400027531d4bc3f586a1997dc874c0"><span class="id" title="notation">(</span></a><a class="idref" href="Coqdoc.links.html#548d1059c499c9b2a9b95b07e68c2090"><span class="id" title="notation">(</span></a>0<a class="idref" href="Coqdoc.links.html#548d1059c499c9b2a9b95b07e68c2090"><span class="id" title="notation">#</span></a>0<a class="idref" href="Coqdoc.links.html#548d1059c499c9b2a9b95b07e68c2090"><span class="id" title="notation">;</span></a>0<a class="idref" href="Coqdoc.links.html#548d1059c499c9b2a9b95b07e68c2090"><span class="id" title="notation">)</span></a> <a class="idref" href="http://coq.inria.fr/stdlib/Coq.Init.Datatypes.html#44400027531d4bc3f586a1997dc874c0"><span class="id" title="notation">,</span></a> <a class="idref" href="http://coq.inria.fr/stdlib/Coq.Init.Datatypes.html#44400027531d4bc3f586a1997dc874c0"><span class="id" title="notation">(</span></a>0 <a class="idref" href="Coqdoc.links.html#6b97e27793a3d22f5c0d1dd63170fd68"><span class="id" title="notation">**</span></a> 0<a class="idref" href="http://coq.inria.fr/stdlib/Coq.Init.Datatypes.html#44400027531d4bc3f586a1997dc874c0"><span class="id" title="notation">))</span></a>.<br/>
+
+<br/>
+<span class="id" title="keyword">Notation</span> <a name="h"><span class="id" title="abbreviation">h</span></a> := <a class="idref" href="Coqdoc.links.html#a"><span class="id" title="definition">a</span></a>.<br/>
+
+<br/>
+&nbsp;&nbsp;<span class="id" title="keyword">Section</span> <a name="test"><span class="id" title="section">test</span></a>.<br/>
+
+<br/>
+&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">Variables</span> <a name="test.b'"><span class="id" title="variable">b'</span></a> <a name="test.b2"><span class="id" title="variable">b2</span></a>: <a class="idref" href="http://coq.inria.fr/stdlib/Coq.Init.Datatypes.html#nat"><span class="id" title="inductive">nat</span></a>.<br/>
+
+<br/>
+&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">Notation</span> <a name="4ab0449b36c75cf94e08c5822ea83e3d"><span class="id" title="notation">&quot;</span></a>n + m" := (<span class="id" title="var">n</span> <a class="idref" href="Coqdoc.links.html#3e01fbae4590c7b7699ff99ce61580e1"><span class="id" title="notation">â–µ</span></a> <span class="id" title="var">m</span>) : <span class="id" title="var">my_scope</span>.<br/>
+
+<br/>
+&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">Delimit</span> <span class="id" title="keyword">Scope</span> <span class="id" title="var">my_scope</span> <span class="id" title="keyword">with</span> <span class="id" title="var">my</span>.<br/>
+
+<br/>
+&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">Notation</span> <a name="l"><span class="id" title="abbreviation">l</span></a> := 0.<br/>
+
+<br/>
+&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">Definition</span> <a name="ab410a966ac148e9b78c65c6cdf301fd"><span class="id" title="definition">α</span></a> := (0 <a class="idref" href="Coqdoc.links.html#4ab0449b36c75cf94e08c5822ea83e3d"><span class="id" title="notation">+</span></a> <a class="idref" href="Coqdoc.links.html#l"><span class="id" title="abbreviation">l</span></a>)%<span class="id" title="var">my</span>.<br/>
+
+<br/>
+&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">Definition</span> <a name="a'"><span class="id" title="definition">a'</span></a> <span class="id" title="var">b</span> := <a class="idref" href="Coqdoc.links.html#test.b'"><span class="id" title="variable">b'</span></a><a class="idref" href="Coqdoc.links.html#1a1c7f13320341c3638e9edcc3e6389d"><span class="id" title="notation">++</span></a>0<a class="idref" href="Coqdoc.links.html#1a1c7f13320341c3638e9edcc3e6389d"><span class="id" title="notation">++</span></a><a class="idref" href="Coqdoc.links.html#test.b2"><span class="id" title="variable">b2</span></a> <a class="idref" href="Coqdoc.links.html#347f39a83bf7d45676cff54fd7e8966f"><span class="id" title="notation">_</span></a> <a class="idref" href="Coqdoc.links.html#347f39a83bf7d45676cff54fd7e8966f"><span class="id" title="notation">++</span></a><a class="idref" href="Coqdoc.links.html#347f39a83bf7d45676cff54fd7e8966f"><span class="id" title="notation">x</span></a> <a class="idref" href="Coqdoc.links.html#b"><span class="id" title="variable">b</span></a>.<br/>
+
+<br/>
+&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">Definition</span> <a name="c"><span class="id" title="definition">c</span></a> := <a class="idref" href="http://coq.inria.fr/stdlib/Coq.Init.Specif.html#5bf2050e90b21ebc82dc5463d1ba338e"><span class="id" title="notation">{</span></a><a class="idref" href="http://coq.inria.fr/stdlib/Coq.Init.Logic.html#True"><span class="id" title="inductive">True</span></a><a class="idref" href="http://coq.inria.fr/stdlib/Coq.Init.Specif.html#5bf2050e90b21ebc82dc5463d1ba338e"><span class="id" title="notation">}+{</span></a><a class="idref" href="http://coq.inria.fr/stdlib/Coq.Init.Logic.html#True"><span class="id" title="inductive">True</span></a><a class="idref" href="http://coq.inria.fr/stdlib/Coq.Init.Specif.html#5bf2050e90b21ebc82dc5463d1ba338e"><span class="id" title="notation">}</span></a>.<br/>
+
+<br/>
+&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">Definition</span> <a name="d"><span class="id" title="definition">d</span></a> := (1<a class="idref" href="http://coq.inria.fr/stdlib/Coq.Init.Peano.html#b3eea360671e1b32b18a26e15b3aace3"><span class="id" title="notation">+</span></a>2)%<span class="id" title="var">nat</span>.<br/>
+
+<br/>
+&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">Lemma</span> <a name="e"><span class="id" title="lemma">e</span></a> : <a class="idref" href="http://coq.inria.fr/stdlib/Coq.Init.Datatypes.html#nat"><span class="id" title="inductive">nat</span></a> <a class="idref" href="http://coq.inria.fr/stdlib/Coq.Init.Datatypes.html#3dcaec3b772747610227247939f96b01"><span class="id" title="notation">+</span></a> <a class="idref" href="http://coq.inria.fr/stdlib/Coq.Init.Datatypes.html#nat"><span class="id" title="inductive">nat</span></a>.<br/>
+&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">Admitted</span>.<br/>
+
+<br/>
+&nbsp;&nbsp;<span class="id" title="keyword">End</span> <a class="idref" href="Coqdoc.links.html#test"><span class="id" title="section">test</span></a>.<br/>
+
+<br/>
+&nbsp;&nbsp;<span class="id" title="keyword">Section</span> <a name="test2"><span class="id" title="section">test2</span></a>.<br/>
+
+<br/>
+&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">Variables</span> <a name="test2.b'"><span class="id" title="variable">b'</span></a>: <a class="idref" href="http://coq.inria.fr/stdlib/Coq.Init.Datatypes.html#nat"><span class="id" title="inductive">nat</span></a>.<br/>
+
+<br/>
+&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">Section</span> <a name="test2.test"><span class="id" title="section">test</span></a>.<br/>
+
+<br/>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">Variables</span> <a name="test2.test.b2"><span class="id" title="variable">b2</span></a>: <a class="idref" href="http://coq.inria.fr/stdlib/Coq.Init.Datatypes.html#nat"><span class="id" title="inductive">nat</span></a>.<br/>
+
+<br/>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">Definition</span> <a name="a''"><span class="id" title="definition">a''</span></a> <span class="id" title="var">b</span> := <a class="idref" href="Coqdoc.links.html#test2.b'"><span class="id" title="variable">b'</span></a> <a class="idref" href="Coqdoc.links.html#1a1c7f13320341c3638e9edcc3e6389d"><span class="id" title="notation">++</span></a> <a class="idref" href="http://coq.inria.fr/stdlib/Coq.Init.Datatypes.html#O"><span class="id" title="constructor">O</span></a> <a class="idref" href="Coqdoc.links.html#1a1c7f13320341c3638e9edcc3e6389d"><span class="id" title="notation">++</span></a> <a class="idref" href="Coqdoc.links.html#test2.test.b2"><span class="id" title="variable">b2</span></a> <a class="idref" href="Coqdoc.links.html#347f39a83bf7d45676cff54fd7e8966f"><span class="id" title="notation">_</span></a> <a class="idref" href="Coqdoc.links.html#347f39a83bf7d45676cff54fd7e8966f"><span class="id" title="notation">++</span></a> <a class="idref" href="Coqdoc.links.html#347f39a83bf7d45676cff54fd7e8966f"><span class="id" title="notation">x</span></a> <a class="idref" href="Coqdoc.links.html#b"><span class="id" title="variable">b</span></a> <a class="idref" href="http://coq.inria.fr/stdlib/Coq.Init.Peano.html#b3eea360671e1b32b18a26e15b3aace3"><span class="id" title="notation">+</span></a> <a class="idref" href="Coqdoc.links.html#h"><span class="id" title="abbreviation">h</span></a> 0.<br/>
+
+<br/>
+&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">End</span> <a class="idref" href="Coqdoc.links.html#test2.test"><span class="id" title="section">test</span></a>.<br/>
+
+<br/>
+&nbsp;&nbsp;<span class="id" title="keyword">End</span> <a class="idref" href="Coqdoc.links.html#test2"><span class="id" title="section">test2</span></a>.<br/>
+
+<br/>
+</div>
+
+<div class="doc">
+skip
+<div class="paragraph"> </div>
+
+ skip
+<div class="paragraph"> </div>
+
+ skip
+<div class="paragraph"> </div>
+
+ skip
+<div class="paragraph"> </div>
+
+ skip
+<div class="paragraph"> </div>
+
+ skip
+<div class="paragraph"> </div>
+
+ skip
+<div class="paragraph"> </div>
+
+ skip
+<div class="paragraph"> </div>
+
+ skip
+<div class="paragraph"> </div>
+
+ skip
+<div class="paragraph"> </div>
+
+ skip
+<div class="paragraph"> </div>
+
+ skip
+<div class="paragraph"> </div>
+
+ skip
+<div class="paragraph"> </div>
+
+ skip
+</div>
+<div class="code">
+
+<br/>
+</div>
+</div>
+
+<div id="footer">
+<hr/><a href="index.html">Index</a><hr/>This page has been generated by <a href="http://coq.inria.fr/">coqdoc</a>
+</div>
+
+</div>
+
+</body>
+</html> \ No newline at end of file
diff --git a/test-suite/coqdoc/links.tex.out b/test-suite/coqdoc/links.tex.out
new file mode 100644
index 000000000..844fb3031
--- /dev/null
+++ b/test-suite/coqdoc/links.tex.out
@@ -0,0 +1,162 @@
+\documentclass[12pt]{report}
+\usepackage[]{inputenc}
+\usepackage[T1]{fontenc}
+\usepackage{fullpage}
+\usepackage{coqdoc}
+\usepackage{amsmath,amssymb}
+\usepackage{url}
+\begin{document}
+\coqlibrary{Coqdoc.links}{Library }{Coqdoc.links}
+
+\begin{coqdoccode}
+\end{coqdoccode}
+Various checks for coqdoc
+
+
+
+\begin{itemize}
+\item symbols should not be inlined in string g
+
+\item links to both kinds of notations in a' should work to the right notation
+
+\item with utf8 option, forall must be unicode
+
+\item splitting between symbols and ident should be correct in a' and c
+
+\item ``..'' should be rendered correctly
+
+\end{itemize}
+\begin{coqdoccode}
+\coqdocemptyline
+\coqdocnoindent
+\coqdockw{Require} \coqdockw{Import} \coqexternalref{}{http://coq.inria.fr/stdlib/Coq.Strings.String}{\coqdoclibrary{String}}.\coqdoceol
+\coqdocemptyline
+\coqdocnoindent
+\coqdockw{Definition} \coqdef{Coqdoc.links.g}{g}{\coqdocdefinition{g}} := "dfjkh""sdfhj forall <> * \~{}"\%\coqdocvar{string}.\coqdoceol
+\coqdocemptyline
+\coqdocnoindent
+\coqdockw{Definition} \coqdef{Coqdoc.links.a}{a}{\coqdocdefinition{a}} (\coqdocvar{b}: \coqexternalref{nat}{http://coq.inria.fr/stdlib/Coq.Init.Datatypes}{\coqdocinductive{nat}}) := \coqdocvariable{b}.\coqdoceol
+\coqdocemptyline
+\coqdocnoindent
+\coqdockw{Definition} \coqdef{Coqdoc.links.f}{f}{\coqdocdefinition{f}} := \coqdockw{\ensuremath{\forall}} \coqdocvar{C}:\coqdockw{Prop}, \coqdocvariable{C}.\coqdoceol
+\coqdocemptyline
+\coqdocnoindent
+\coqdockw{Notation} \coqdef{Coqdoc.links.::x '++' x}{"}{"}n ++ m" := (\coqexternalref{plus}{http://coq.inria.fr/stdlib/Coq.Init.Peano}{\coqdocabbreviation{plus}} \coqdocvar{n} \coqdocvar{m}).\coqdoceol
+\coqdocemptyline
+\coqdocnoindent
+\coqdockw{Notation} \coqdef{Coqdoc.links.::x '++' x}{"}{"}n ++ m" := (\coqexternalref{mult}{http://coq.inria.fr/stdlib/Coq.Init.Peano}{\coqdocabbreviation{mult}} \coqdocvar{n} \coqdocvar{m}). \coqdocemptyline
+\coqdocnoindent
+\coqdockw{Notation} \coqdef{Coqdoc.links.::x '**' x}{"}{"}n ** m" := (\coqexternalref{plus}{http://coq.inria.fr/stdlib/Coq.Init.Peano}{\coqdocabbreviation{plus}} \coqdocvar{n} \coqdocvar{m}) (\coqdoctac{at} \coqdockw{level} 60).\coqdoceol
+\coqdocemptyline
+\coqdocnoindent
+\coqdockw{Notation} \coqdef{Coqdoc.links.::x 'xE2x96xB5' x}{"}{"}n â–µ m" := (\coqexternalref{plus}{http://coq.inria.fr/stdlib/Coq.Init.Peano}{\coqdocabbreviation{plus}} \coqdocvar{n} \coqdocvar{m}) (\coqdoctac{at} \coqdockw{level} 60).\coqdoceol
+\coqdocemptyline
+\coqdocnoindent
+\coqdockw{Notation} \coqdef{Coqdoc.links.::x ''' ''' '++' 'x' x}{"}{"}n '\_' ++ 'x' m" := (\coqexternalref{plus}{http://coq.inria.fr/stdlib/Coq.Init.Peano}{\coqdocabbreviation{plus}} \coqdocvar{n} \coqdocvar{m}) (\coqdoctac{at} \coqdockw{level} 3).\coqdoceol
+\coqdocemptyline
+\coqdocnoindent
+\coqdockw{Inductive} \coqdef{Coqdoc.links.eq}{eq}{\coqdocinductive{eq}} (\coqdocvar{A}:\coqdockw{Type}) (\coqdocvar{x}:\coqdocvariable{A}) : \coqdocvar{A} \coqexternalref{:type scope:x '->' x}{http://coq.inria.fr/stdlib/Coq.Init.Logic}{\coqdocnotation{\ensuremath{\rightarrow}}} \coqdockw{Prop} := \coqdef{Coqdoc.links.eq refl}{eq\_refl}{\coqdocconstructor{eq\_refl}} : \coqdocvariable{x} \coqref{Coqdoc.links.:type scope:x '=' x ':>' x}{\coqdocnotation{=}} \coqdocvariable{x} \coqref{Coqdoc.links.:type scope:x '=' x ':>' x}{\coqdocnotation{:>}}\coqdocvariable{A}\coqdoceol
+\coqdocnoindent
+\coqdoceol
+\coqdocnoindent
+\coqdockw{where} \coqdef{Coqdoc.links.:type scope:x '=' x ':>' x}{"}{"}x = y :> A" := (@\coqdocvariable{eq} \coqdocvar{A} \coqdocvar{x} \coqdocvar{y}) : \coqdocvar{type\_scope}.\coqdoceol
+\coqdocemptyline
+\coqdocnoindent
+\coqdockw{Definition} \coqdef{Coqdoc.links.eq0}{eq0}{\coqdocdefinition{eq0}} := 0 \coqref{Coqdoc.links.:type scope:x '=' x ':>' x}{\coqdocnotation{=}} 0 \coqref{Coqdoc.links.:type scope:x '=' x ':>' x}{\coqdocnotation{:>}} \coqexternalref{nat}{http://coq.inria.fr/stdlib/Coq.Init.Datatypes}{\coqdocinductive{nat}}.\coqdoceol
+\coqdocemptyline
+\coqdocnoindent
+\coqdockw{Notation} \coqdef{Coqdoc.links.::'(' x 'x23' x ';' '..' ';' x ')'}{"}{"}( x \# y ; .. ; z )" := (\coqexternalref{pair}{http://coq.inria.fr/stdlib/Coq.Init.Datatypes}{\coqdocconstructor{pair}} .. (\coqexternalref{pair}{http://coq.inria.fr/stdlib/Coq.Init.Datatypes}{\coqdocconstructor{pair}} \coqdocvar{x} \coqdocvar{y}) .. \coqdocvar{z}).\coqdoceol
+\coqdocemptyline
+\coqdocnoindent
+\coqdockw{Definition} \coqdef{Coqdoc.links.b xCExB1}{b\_α}{\coqdocdefinition{b\_α}} := \coqexternalref{:core scope:'(' x ',' x ',' '..' ',' x ')'}{http://coq.inria.fr/stdlib/Coq.Init.Datatypes}{\coqdocnotation{(}}\coqref{Coqdoc.links.::'(' x 'x23' x ';' '..' ';' x ')'}{\coqdocnotation{(}}0\coqref{Coqdoc.links.::'(' x 'x23' x ';' '..' ';' x ')'}{\coqdocnotation{\#}}0\coqref{Coqdoc.links.::'(' x 'x23' x ';' '..' ';' x ')'}{\coqdocnotation{;}}0\coqref{Coqdoc.links.::'(' x 'x23' x ';' '..' ';' x ')'}{\coqdocnotation{)}} \coqexternalref{:core scope:'(' x ',' x ',' '..' ',' x ')'}{http://coq.inria.fr/stdlib/Coq.Init.Datatypes}{\coqdocnotation{,}} \coqexternalref{:core scope:'(' x ',' x ',' '..' ',' x ')'}{http://coq.inria.fr/stdlib/Coq.Init.Datatypes}{\coqdocnotation{(}}0 \coqref{Coqdoc.links.::x '**' x}{\coqdocnotation{**}} 0\coqexternalref{:core scope:'(' x ',' x ',' '..' ',' x ')'}{http://coq.inria.fr/stdlib/Coq.Init.Datatypes}{\coqdocnotation{))}}.\coqdoceol
+\coqdocemptyline
+\coqdocnoindent
+\coqdockw{Notation} \coqdef{Coqdoc.links.h}{h}{\coqdocabbreviation{h}} := \coqref{Coqdoc.links.a}{\coqdocdefinition{a}}.\coqdoceol
+\coqdocemptyline
+\coqdocindent{1.00em}
+\coqdockw{Section} \coqdef{Coqdoc.links.test}{test}{\coqdocsection{test}}.\coqdoceol
+\coqdocemptyline
+\coqdocindent{2.00em}
+\coqdockw{Variables} \coqdef{Coqdoc.links.test.b'}{b'}{\coqdocvariable{b'}} \coqdef{Coqdoc.links.test.b2}{b2}{\coqdocvariable{b2}}: \coqexternalref{nat}{http://coq.inria.fr/stdlib/Coq.Init.Datatypes}{\coqdocinductive{nat}}.\coqdoceol
+\coqdocemptyline
+\coqdocindent{2.00em}
+\coqdockw{Notation} \coqdef{Coqdoc.links.test.:my scope:x '+' x}{"}{"}n + m" := (\coqdocvar{n} \coqref{Coqdoc.links.::x 'xE2x96xB5' x}{\coqdocnotation{â–µ}} \coqdocvar{m}) : \coqdocvar{my\_scope}.\coqdoceol
+\coqdocemptyline
+\coqdocindent{2.00em}
+\coqdockw{Delimit} \coqdockw{Scope} \coqdocvar{my\_scope} \coqdockw{with} \coqdocvar{my}.\coqdoceol
+\coqdocemptyline
+\coqdocindent{2.00em}
+\coqdockw{Notation} \coqdef{Coqdoc.links.l}{l}{\coqdocabbreviation{l}} := 0.\coqdoceol
+\coqdocemptyline
+\coqdocindent{2.00em}
+\coqdockw{Definition} \coqdef{Coqdoc.links.xCExB1}{α}{\coqdocdefinition{α}} := (0 \coqref{Coqdoc.links.test.:my scope:x '+' x}{\coqdocnotation{+}} \coqref{Coqdoc.links.l}{\coqdocabbreviation{l}})\%\coqdocvar{my}.\coqdoceol
+\coqdocemptyline
+\coqdocindent{2.00em}
+\coqdockw{Definition} \coqdef{Coqdoc.links.a'}{a'}{\coqdocdefinition{a'}} \coqdocvar{b} := \coqdocvariable{b'}\coqref{Coqdoc.links.::x '++' x}{\coqdocnotation{++}}0\coqref{Coqdoc.links.::x '++' x}{\coqdocnotation{++}}\coqdocvariable{b2} \coqref{Coqdoc.links.::x ''' ''' '++' 'x' x}{\coqdocnotation{\_}} \coqref{Coqdoc.links.::x ''' ''' '++' 'x' x}{\coqdocnotation{++}}\coqref{Coqdoc.links.::x ''' ''' '++' 'x' x}{\coqdocnotation{x}} \coqdocvariable{b}.\coqdoceol
+\coqdocemptyline
+\coqdocindent{2.00em}
+\coqdockw{Definition} \coqdef{Coqdoc.links.c}{c}{\coqdocdefinition{c}} := \coqexternalref{:type scope:'x7B' x 'x7D' '+' 'x7B' x 'x7D'}{http://coq.inria.fr/stdlib/Coq.Init.Specif}{\coqdocnotation{\{}}\coqexternalref{True}{http://coq.inria.fr/stdlib/Coq.Init.Logic}{\coqdocinductive{True}}\coqexternalref{:type scope:'x7B' x 'x7D' '+' 'x7B' x 'x7D'}{http://coq.inria.fr/stdlib/Coq.Init.Specif}{\coqdocnotation{\}+\{}}\coqexternalref{True}{http://coq.inria.fr/stdlib/Coq.Init.Logic}{\coqdocinductive{True}}\coqexternalref{:type scope:'x7B' x 'x7D' '+' 'x7B' x 'x7D'}{http://coq.inria.fr/stdlib/Coq.Init.Specif}{\coqdocnotation{\}}}.\coqdoceol
+\coqdocemptyline
+\coqdocindent{2.00em}
+\coqdockw{Definition} \coqdef{Coqdoc.links.d}{d}{\coqdocdefinition{d}} := (1\coqexternalref{:nat scope:x '+' x}{http://coq.inria.fr/stdlib/Coq.Init.Peano}{\coqdocnotation{+}}2)\%\coqdocvar{nat}.\coqdoceol
+\coqdocemptyline
+\coqdocindent{2.00em}
+\coqdockw{Lemma} \coqdef{Coqdoc.links.e}{e}{\coqdoclemma{e}} : \coqexternalref{nat}{http://coq.inria.fr/stdlib/Coq.Init.Datatypes}{\coqdocinductive{nat}} \coqexternalref{:type scope:x '+' x}{http://coq.inria.fr/stdlib/Coq.Init.Datatypes}{\coqdocnotation{+}} \coqexternalref{nat}{http://coq.inria.fr/stdlib/Coq.Init.Datatypes}{\coqdocinductive{nat}}.\coqdoceol
+\coqdocindent{2.00em}
+\coqdocvar{Admitted}.\coqdoceol
+\coqdocemptyline
+\coqdocindent{1.00em}
+\coqdockw{End} \coqref{Coqdoc.links.test}{\coqdocsection{test}}.\coqdoceol
+\coqdocemptyline
+\coqdocindent{1.00em}
+\coqdockw{Section} \coqdef{Coqdoc.links.test2}{test2}{\coqdocsection{test2}}.\coqdoceol
+\coqdocemptyline
+\coqdocindent{2.00em}
+\coqdockw{Variables} \coqdef{Coqdoc.links.test2.b'}{b'}{\coqdocvariable{b'}}: \coqexternalref{nat}{http://coq.inria.fr/stdlib/Coq.Init.Datatypes}{\coqdocinductive{nat}}.\coqdoceol
+\coqdocemptyline
+\coqdocindent{2.00em}
+\coqdockw{Section} \coqdef{Coqdoc.links.test2.test}{test}{\coqdocsection{test}}.\coqdoceol
+\coqdocemptyline
+\coqdocindent{3.00em}
+\coqdockw{Variables} \coqdef{Coqdoc.links.test2.test.b2}{b2}{\coqdocvariable{b2}}: \coqexternalref{nat}{http://coq.inria.fr/stdlib/Coq.Init.Datatypes}{\coqdocinductive{nat}}.\coqdoceol
+\coqdocemptyline
+\coqdocindent{3.00em}
+\coqdockw{Definition} \coqdef{Coqdoc.links.a''}{a'{}'}{\coqdocdefinition{a'{}'}} \coqdocvar{b} := \coqdocvariable{b'} \coqref{Coqdoc.links.::x '++' x}{\coqdocnotation{++}} \coqexternalref{O}{http://coq.inria.fr/stdlib/Coq.Init.Datatypes}{\coqdocconstructor{O}} \coqref{Coqdoc.links.::x '++' x}{\coqdocnotation{++}} \coqdocvariable{b2} \coqref{Coqdoc.links.::x ''' ''' '++' 'x' x}{\coqdocnotation{\_}} \coqref{Coqdoc.links.::x ''' ''' '++' 'x' x}{\coqdocnotation{++}} \coqref{Coqdoc.links.::x ''' ''' '++' 'x' x}{\coqdocnotation{x}} \coqdocvariable{b} \coqexternalref{:nat scope:x '+' x}{http://coq.inria.fr/stdlib/Coq.Init.Peano}{\coqdocnotation{+}} \coqref{Coqdoc.links.h}{\coqdocabbreviation{h}} 0.\coqdoceol
+\coqdocemptyline
+\coqdocindent{2.00em}
+\coqdockw{End} \coqref{Coqdoc.links.test2.test}{\coqdocsection{test}}.\coqdoceol
+\coqdocemptyline
+\coqdocindent{1.00em}
+\coqdockw{End} \coqref{Coqdoc.links.test2}{\coqdocsection{test2}}.\coqdoceol
+\coqdocemptyline
+\end{coqdoccode}
+skip
+
+ skip
+
+ skip
+
+ skip
+
+ skip
+
+ skip
+
+ skip
+
+ skip
+
+ skip
+
+ skip
+
+ skip
+
+ skip
+
+ skip
+
+ skip \begin{coqdoccode}
+\coqdocemptyline
+\end{coqdoccode}
+\end{document}
diff --git a/test-suite/output/Notations3.out b/test-suite/output/Notations3.out
index ffea0819a..e5dbfcb4b 100644
--- a/test-suite/output/Notations3.out
+++ b/test-suite/output/Notations3.out
@@ -1,3 +1,5 @@
+{x : nat | x = 0} + {True /\ False} + {forall x : nat, x = 0}
+ : Set
[<0, 2 >]
: nat * nat * (nat * nat)
[<0, 2 >]
@@ -109,3 +111,14 @@ fun x : ?A => x === x
: forall x : ?A, x = x
where
?A : [x : ?A |- Type] (x cannot be used)
+{{0, 1}}
+ : nat * nat
+{{0, 1, 2}}
+ : nat * (nat * nat)
+{{0, 1, 2, 3}}
+ : nat * (nat * (nat * nat))
+letpair x [1] = {0};
+return (1, 2, 3, 4)
+ : nat * nat * nat * nat
+{{ 1 | 1 // 1 }}
+ : nat
diff --git a/test-suite/output/Notations3.v b/test-suite/output/Notations3.v
index 250aecafd..b1015137d 100644
--- a/test-suite/output/Notations3.v
+++ b/test-suite/output/Notations3.v
@@ -1,4 +1,9 @@
(**********************************************************************)
+(* Check precedence, spacing, etc. in printing with curly brackets *)
+
+Check {x|x=0}+{True/\False}+{forall x, x=0}.
+
+(**********************************************************************)
(* Check printing of notations with several instances of a recursive pattern *)
(* Was wrong but I could not trigger a problem due to the collision between *)
(* different instances of ".." *)
@@ -160,3 +165,24 @@ End Bug4765.
Notation "x === x" := (eq_refl x) (only printing, at level 10).
Check (fun x => eq_refl x).
+
+(* Test recursive notations with the recursive pattern repeated on the right *)
+
+Notation "{{ x , .. , y , z }}" := (pair x .. (pair y z) ..).
+Check {{0,1}}.
+Check {{0,1,2}}.
+Check {{0,1,2,3}}.
+
+(* Test printing of #5608 *)
+
+Reserved Notation "'letpair' x [1] = { A } ; 'return' ( b0 , b1 , .. , b2 )"
+ (at level 200, format "'letpair' x [1] = { A } ; '//' 'return' ( b0 , b1 , .. , b2 )").
+Notation "'letpair' x [1] = { a } ; 'return' ( b0 , b1 , .. , b2 )" :=
+ (let x:=a in ( .. (b0,b1) .., b2)).
+Check letpair x [1] = {0}; return (1,2,3,4).
+
+(* Test spacing in #5569 *)
+
+Notation "{ { xL | xR // xcut } }" := (xL+xR+xcut)
+ (at level 0, xR at level 39, format "{ { xL | xR // xcut } }").
+Check 1+1+1.
diff --git a/test-suite/output/UnclosedBlocks.out b/test-suite/output/UnclosedBlocks.out
new file mode 100644
index 000000000..b83e94ad4
--- /dev/null
+++ b/test-suite/output/UnclosedBlocks.out
@@ -0,0 +1,3 @@
+
+Error: The section Baz, module type Bar and module Foo need to be closed.
+
diff --git a/test-suite/output/UnclosedBlocks.v b/test-suite/output/UnclosedBlocks.v
new file mode 100644
index 000000000..854bd6a6d
--- /dev/null
+++ b/test-suite/output/UnclosedBlocks.v
@@ -0,0 +1,8 @@
+(* -*- mode: coq; coq-prog-args: ("-compile" "UnclosedBlocks.v") *)
+Module Foo.
+ Module Closed.
+ End Closed.
+ Module Type Bar.
+ Section Baz.
+ (* end-of-compilation error message reports unclosed sections, blocks, and
+ module types *)
diff --git a/test-suite/success/cumulativity.v b/test-suite/success/cumulativity.v
index ebf817cfc..0ee85712e 100644
--- a/test-suite/success/cumulativity.v
+++ b/test-suite/success/cumulativity.v
@@ -1,5 +1,11 @@
+Polymorphic Cumulative Inductive T1 := t1 : T1.
+Fail Monomorphic Cumulative Inductive T2 := t2 : T2.
+
+Polymorphic Cumulative Record R1 := { r1 : T1 }.
+Fail Monomorphic Cumulative Inductive R2 := {r2 : T1}.
+
Set Universe Polymorphism.
-Set Inductive Cumulativity.
+Set Polymorphic Inductive Cumulativity.
Set Printing Universes.
Inductive List (A: Type) := nil | cons : A -> List A -> List A.
@@ -62,4 +68,33 @@ End subtyping_test.
Record A : Type := { a :> Type; }.
-Record B (X : A) : Type := { b : X; }. \ No newline at end of file
+Record B (X : A) : Type := { b : X; }.
+
+NonCumulative Inductive NCList (A: Type)
+ := ncnil | nccons : A -> NCList A -> NCList A.
+
+Section NCListLift.
+ Universe i j.
+
+ Constraint i < j.
+
+ Fail Definition LiftNCL {A} : NCList@{i} A -> NCList@{j} A := fun x => x.
+
+End NCListLift.
+
+Inductive eq@{i} {A : Type@{i}} (x : A) : A -> Type@{i} := eq_refl : eq x x.
+
+Definition funext_type@{a b e} (A : Type@{a}) (B : A -> Type@{b})
+ := forall f g : (forall a, B a),
+ (forall x, eq@{e} (f x) (g x))
+ -> eq@{e} f g.
+
+Section down.
+ Universes a b e e'.
+ Constraint e' < e.
+ Lemma funext_down {A B}
+ : @funext_type@{a b e} A B -> @funext_type@{a b e'} A B.
+ Proof.
+ intros H f g Hfg. exact (H f g Hfg).
+ Defined.
+End down.
diff --git a/test-suite/success/extraction.v b/test-suite/success/extraction.v
index 4a509da89..0ee223250 100644
--- a/test-suite/success/extraction.v
+++ b/test-suite/success/extraction.v
@@ -545,47 +545,96 @@ Recursive Extraction test_proj.
(*** TO SUM UP: ***)
-(* Was previously producing a "test_extraction.ml" *)
-Recursive Extraction
- idnat id id' test2 test3 test4 test5 test6 test7 d d2
- d3 d4 d5 d6 test8 id id' test9 test10 test11 test12
- test13 test19 test20 nat sumbool_rect c Finite tree
- tree_size test14 test15 eta_c test16 test17 test18 bidon
- tb fbidon fbidon2 fbidon2 test_0 test_1 eq eq_rect tp1
- tp1bis Truc oups test24 loop horibilis PropSet natbool
- zerotrue zeroTrue zeroprop test21 test22 test23 f f_prop
- f_arity f_normal Boite boite1 boite2 test_boite Box box1
- zarb test_proj.
+Module Everything.
+ Definition idnat := idnat.
+ Definition id := id.
+ Definition id' := id'.
+ Definition test2 := test2.
+ Definition test3 := test3.
+ Definition test4 := test4.
+ Definition test5 := test5.
+ Definition test6 := test6.
+ Definition test7 := test7.
+ Definition d := d.
+ Definition d2 := d2.
+ Definition d3 := d3.
+ Definition d4 := d4.
+ Definition d5 := d5.
+ Definition d6 := d6.
+ Definition test8 := test8.
+ Definition test9 := test9.
+ Definition test10 := test10.
+ Definition test11 := test11.
+ Definition test12 := test12.
+ Definition test13 := test13.
+ Definition test19 := test19.
+ Definition test20 := test20.
+ Definition nat := nat.
+ Definition sumbool_rect := sumbool_rect.
+ Definition c := c.
+ Definition Finite := Finite.
+ Definition tree := tree.
+ Definition tree_size := tree_size.
+ Definition test14 := test14.
+ Definition test15 := test15.
+ Definition eta_c := eta_c.
+ Definition test16 := test16.
+ Definition test17 := test17.
+ Definition test18 := test18.
+ Definition bidon := bidon.
+ Definition tb := tb.
+ Definition fbidon := fbidon.
+ Definition fbidon2 := fbidon2.
+ Definition test_0 := test_0.
+ Definition test_1 := test_1.
+ Definition eq_rect := eq_rect.
+ Definition tp1 := tp1.
+ Definition tp1bis := tp1bis.
+ Definition Truc := Truc.
+ Definition oups := oups.
+ Definition test24 := test24.
+ Definition loop := loop.
+ Definition horibilis := horibilis.
+ Definition PropSet := PropSet.
+ Definition natbool := natbool.
+ Definition zerotrue := zerotrue.
+ Definition zeroTrue := zeroTrue.
+ Definition zeroprop := zeroprop.
+ Definition test21 := test21.
+ Definition test22 := test22.
+ Definition test23 := test23.
+ Definition f := f.
+ Definition f_prop := f_prop.
+ Definition f_arity := f_arity.
+ Definition f_normal := f_normal.
+ Definition Boite := Boite.
+ Definition boite1 := boite1.
+ Definition boite2 := boite2.
+ Definition test_boite := test_boite.
+ Definition Box := Box.
+ Definition box1 := box1.
+ Definition zarb := zarb.
+ Definition test_proj := test_proj.
+End Everything.
+
+(* Extraction "test_extraction.ml" Everything. *)
+Recursive Extraction Everything.
+(* Check that the previous OCaml code is compilable *)
+Extraction TestCompile Everything.
Extraction Language Haskell.
-(* Was previously producing a "Test_extraction.hs" *)
-Recursive Extraction
- idnat id id' test2 test3 test4 test5 test6 test7 d d2
- d3 d4 d5 d6 test8 id id' test9 test10 test11 test12
- test13 test19 test20 nat sumbool_rect c Finite tree
- tree_size test14 test15 eta_c test16 test17 test18 bidon
- tb fbidon fbidon2 fbidon2 test_0 test_1 eq eq_rect tp1
- tp1bis Truc oups test24 loop horibilis PropSet natbool
- zerotrue zeroTrue zeroprop test21 test22 test23 f f_prop
- f_arity f_normal Boite boite1 boite2 test_boite Box box1
- zarb test_proj.
+(* Extraction "Test_extraction.hs" Everything. *)
+Recursive Extraction Everything.
Extraction Language Scheme.
-(* Was previously producing a "test_extraction.scm" *)
-Recursive Extraction
- idnat id id' test2 test3 test4 test5 test6 test7 d d2
- d3 d4 d5 d6 test8 id id' test9 test10 test11 test12
- test13 test19 test20 nat sumbool_rect c Finite tree
- tree_size test14 test15 eta_c test16 test17 test18 bidon
- tb fbidon fbidon2 fbidon2 test_0 test_1 eq eq_rect tp1
- tp1bis Truc oups test24 loop horibilis PropSet natbool
- zerotrue zeroTrue zeroprop test21 test22 test23 f f_prop
- f_arity f_normal Boite boite1 boite2 test_boite Box box1
- zarb test_proj.
+(* Extraction "test_extraction.scm" Everything. *)
+Recursive Extraction Everything.
(*** Finally, a test more focused on everyday's life situations ***)
Require Import ZArith.
-Recursive Extraction two_or_two_plus_one Zdiv_eucl_exist.
+Extraction Language Ocaml.
+Recursive Extraction Z_modulo_2 Zdiv_eucl_exist.
+Extraction TestCompile Z_modulo_2 Zdiv_eucl_exist.
diff --git a/test-suite/success/extraction_dep.v b/test-suite/success/extraction_dep.v
index e770cf779..fb0adabae 100644
--- a/test-suite/success/extraction_dep.v
+++ b/test-suite/success/extraction_dep.v
@@ -4,7 +4,7 @@
Require Coq.extraction.Extraction.
(** NB: we should someday check the produced code instead of
- simply running the commands. *)
+ extracting and just compiling. *)
(** 1) Without signature ... *)
@@ -20,6 +20,7 @@ End A.
Definition testA := A.u + A.B.x.
Recursive Extraction testA. (* without: v w *)
+Extraction TestCompile testA.
(** 1b) Same with an Include *)
@@ -31,6 +32,7 @@ End Abis.
Definition testAbis := Abis.u + Abis.y.
Recursive Extraction testAbis. (* without: A B v w x *)
+Extraction TestCompile testAbis.
(** 2) With signature, we only keep elements mentionned in signature. *)
@@ -46,3 +48,4 @@ End Ater.
Definition testAter := Ater.u.
Recursive Extraction testAter. (* with only: u v *)
+Extraction TestCompile testAter.
diff --git a/test-suite/success/extraction_impl.v b/test-suite/success/extraction_impl.v
index 5bf807b1c..a38a688fb 100644
--- a/test-suite/success/extraction_impl.v
+++ b/test-suite/success/extraction_impl.v
@@ -2,7 +2,7 @@
(** Examples of extraction with manually-declared implicit arguments *)
(** NB: we should someday check the produced code instead of
- simply running the commands. *)
+ extracting and just compiling. *)
Require Coq.extraction.Extraction.
@@ -22,9 +22,11 @@ Proof.
Defined.
Recursive Extraction dnat_nat.
+Extraction TestCompile dnat_nat.
Extraction Implicit dnat_nat [n].
Recursive Extraction dnat_nat.
+Extraction TestCompile dnat_nat.
(** Same, with a Fixpoint *)
@@ -35,9 +37,11 @@ Fixpoint dnat_nat' n (d:dnat n) :=
end.
Recursive Extraction dnat_nat'.
+Extraction TestCompile dnat_nat'.
Extraction Implicit dnat_nat' [n].
Recursive Extraction dnat_nat'.
+Extraction TestCompile dnat_nat'.
(** Bug #4243, part 2 *)
@@ -56,6 +60,7 @@ Defined.
Extraction Implicit es [n].
Extraction Implicit enat_nat [n].
Recursive Extraction enat_nat.
+Extraction TestCompile enat_nat.
(** Same, with a Fixpoint *)
@@ -67,6 +72,7 @@ Fixpoint enat_nat' n (e:enat n) : nat :=
Extraction Implicit enat_nat' [n].
Recursive Extraction enat_nat'.
+Extraction TestCompile enat_nat'.
(** Bug #4228 *)
@@ -82,3 +88,4 @@ Extraction Implicit two_course [n].
End Food.
Recursive Extraction Food.Meal.
+Extraction TestCompile Food.Meal.
diff --git a/test-suite/success/forward.v b/test-suite/success/forward.v
index 0ed5b524f..4e36dec15 100644
--- a/test-suite/success/forward.v
+++ b/test-suite/success/forward.v
@@ -16,3 +16,14 @@ eremember (S (S ?[x])).
instantiate (x:=0).
reflexivity.
Qed.
+
+(* Don't know if it is good or not but the compatibility tells that
+ the asserted goal to prove is subject to beta-iota but not the
+ asserted hypothesis *)
+
+Goal True.
+assert ((fun x => x) False).
+Fail match goal with |- (?f ?a) => idtac end. (* should be beta-iota reduced *)
+2:match goal with _: (?f ?a) |- _ => idtac end. (* should not be beta-iota reduced *)
+Abort.
+
diff --git a/test-suite/success/ltac.v b/test-suite/success/ltac.v
index 1d35f1ef6..29e373eaa 100644
--- a/test-suite/success/ltac.v
+++ b/test-suite/success/ltac.v
@@ -337,3 +337,14 @@ Goal True.
evar (0=0).
Abort.
+(* Test location of hypothesis in "symmetry in H". This was broken in
+ 8.6 where H, when the oldest hyp, was moved at the place of most
+ recent hypothesis *)
+
+Goal 0=1 -> True -> True.
+intros H H0.
+symmetry in H.
+(* H should be the first hypothesis *)
+match goal with h:_ |- _ => assert (h=h) end. (* h should be H0 *)
+exact (eq_refl H0).
+Abort.
diff --git a/test-suite/success/primitiveproj.v b/test-suite/success/primitiveproj.v
index 789854b2d..576bdbf71 100644
--- a/test-suite/success/primitiveproj.v
+++ b/test-suite/success/primitiveproj.v
@@ -184,6 +184,7 @@ Definition term' (x : wrap nat) := let f := (@unwrap2 nat) in f x.
Require Coq.extraction.Extraction.
Recursive Extraction term term'.
+Extraction TestCompile term term'.
(*Unset Printing Primitive Projection Parameters.*)
(* Primitive projections in the presence of let-ins (was not failing in beta3)*)
diff --git a/theories/Init/Notations.v b/theories/Init/Notations.v
index e67ae6a92..5e8d2faa5 100644
--- a/theories/Init/Notations.v
+++ b/theories/Init/Notations.v
@@ -66,6 +66,9 @@ Reserved Notation "{ x }" (at level 0, x at level 99).
(** Notations for sigma-types or subsets *)
+Reserved Notation "{ A } + { B }" (at level 50, left associativity).
+Reserved Notation "A + { B }" (at level 50, left associativity).
+
Reserved Notation "{ x | P }" (at level 0, x at level 99).
Reserved Notation "{ x | P & Q }" (at level 0, x at level 99).
diff --git a/tools/CoqMakefile.in b/tools/CoqMakefile.in
index f1e519d03..9f891afe5 100644
--- a/tools/CoqMakefile.in
+++ b/tools/CoqMakefile.in
@@ -63,11 +63,11 @@ VERBOSE ?=
# Time the Coq process (set to non empty), and how (see default value)
TIMED?=
TIMECMD?=
-# Use /usr/bin/time on linux, gtime on Mac OS
+# Use /usr/bin/env time on linux, gtime on Mac OS
TIMEFMT?="$* (real: %e, user: %U, sys: %S, mem: %M ko)"
ifneq (,$(TIMED))
-ifeq (0,$(shell /usr/bin/time -f $(TIMEFMT) true >/dev/null 2>/dev/null; echo $$?))
-STDTIME?=/usr/bin/time -f $(TIMEFMT)
+ifeq (0,$(shell /usr/bin/env time -f $(TIMEFMT) true >/dev/null 2>/dev/null; echo $$?))
+STDTIME?=/usr/bin/env time -f $(TIMEFMT)
else
ifeq (0,$(shell gtime -f $(TIMEFMT) true >/dev/null 2>/dev/null; echo $$?))
STDTIME?=gtime -f $(TIMEFMT)
@@ -76,7 +76,7 @@ STDTIME?=time
endif
endif
else
-STDTIME?=/usr/bin/time -f $(TIMEFMT)
+STDTIME?=/usr/bin/env time -f $(TIMEFMT)
endif
# Coq binaries
@@ -170,7 +170,7 @@ COQMAKEFILE_VERSION:=@COQ_VERSION@
COQSRCLIBS?= $(foreach d,$(COQ_SRC_SUBDIRS), -I "$(COQLIB)$(d)")
-CAMLFLAGS=$(OCAMLLIBS) $(COQSRCLIBS) -I $(CAMLP4LIB)
+CAMLFLAGS=$(OCAMLLIBS) $(COQSRCLIBS) -I $(CAMLP4LIB) $(OCAML_API_FLAGS)
CAMLLIB:=$(shell "$(OCAMLFIND)" printconf stdlib)
@@ -182,7 +182,7 @@ else
CAMLP4EXTEND=
endif
-PP:=-pp '$(CAMLP4O) -I $(CAMLLIB) -I "$(COQLIB)/grammar" compat5.cmo $(CAMLP4EXTEND) $(GRAMMARS) $(CAMLP4OPTIONS) -impl'
+PP:=-pp '$(CAMLP4O) -I $(CAMLLIB) -I "$(COQLIB)/grammar" $(CAMLP4EXTEND) $(GRAMMARS) $(CAMLP4OPTIONS) -impl'
ifneq (,$(TIMING))
TIMING_ARG=-time
diff --git a/tools/beautify-archive b/tools/beautify-archive
index 6bfa974a5..a327ea44e 100755
--- a/tools/beautify-archive
+++ b/tools/beautify-archive
@@ -23,7 +23,7 @@ cp -pr /tmp/$OLDARCHIVE.$$ $NEWARCHIVE
cd $NEWARCHIVE
rm description || true
make clean
-make COQFLAGS='-beautify -q $(OPT) $(COQLIBS) $(OTHERFLAGS) $(COQ_XML)' || \
+make COQFLAGS='-beautify -q $(OPT) $(COQLIBS) $(OTHERFLAGS)' || \
{ echo ---- Failed to beautify; exit 1; }
echo -------- Upgrading files in the beautification directory --------------
beaufiles=`find . -name \*.v$BEAUTIFYSUFFIX`
diff --git a/tools/check-translate b/tools/check-translate
index 3dd824053..acb6f4590 100755
--- a/tools/check-translate
+++ b/tools/check-translate
@@ -2,7 +2,7 @@
echo -------------- Producing translated files ---------------------
rm */*/*.v8 >& /dev/null
-make COQ_XML=-translate theories || { echo ---- Failed to translate; exit 1; }
+make COQOPTS=-translate theories || { echo ---- Failed to translate; exit 1; }
if [ -e translated ]; then rm -r translated; fi
if [ -e successful-translation ]; then rm -r successful-translation; fi
if [ -e failed-translation ]; then rm -r failed-translation; fi
diff --git a/tools/coq_makefile.ml b/tools/coq_makefile.ml
index 327f53520..0f38d1938 100644
--- a/tools/coq_makefile.ml
+++ b/tools/coq_makefile.ml
@@ -203,8 +203,12 @@ let generate_conf_coq_config oc args bypass_API =
section oc "Coq configuration.";
let src_dirs = if bypass_API
then Coq_config.all_src_dirs
- else Coq_config.api_dirs @ Coq_config.plugins_dirs @ ["-open API"] in
+ else Coq_config.api_dirs @ Coq_config.plugins_dirs in
Envars.print_config ~prefix_var_name:"COQMF_" oc src_dirs;
+ if bypass_API then
+ Printf.fprintf oc "OCAML_API_FLAGS=\n"
+ else
+ Printf.fprintf oc "OCAML_API_FLAGS=-open API\n";
fprintf oc "COQMF_WINDRIVE=%s\n" (windrive Coq_config.coqlib)
;;
diff --git a/tools/coqc.ml b/tools/coqc.ml
index 5da203742..862225d3d 100644
--- a/tools/coqc.ml
+++ b/tools/coqc.ml
@@ -86,16 +86,15 @@ let parse_args () =
Envars.print_config stdout Coq_config.all_src_dirs;
exit 0
- |"--print-version" :: _ ->
+ | ("-print-version" | "--print-version") :: _ ->
Usage.machine_readable_version 0
(* Options for coqtop : a) options with 0 argument *)
- | ("-notactics"|"-bt"|"-debug"|"-nolib"|"-boot"|"-time"|"-profile-ltac"
+ | ("-bt"|"-debug"|"-nolib"|"-boot"|"-time"|"-profile-ltac"
|"-batch"|"-noinit"|"-nois"|"-noglob"|"-no-glob"
- |"-q"|"-full"|"-profile"|"-just-parsing"|"-echo" |"-unsafe"|"-quiet"
- |"-silent"|"-m"|"-xml"|"-v7"|"-v8"|"-beautify"|"-strict-implicit"
- |"-dont-load-proofs"|"-load-proofs"|"-force-load-proofs"
+ |"-q"|"-profile"|"-just-parsing"|"-echo" |"-quiet"
+ |"-silent"|"-m"|"-beautify"|"-strict-implicit"
|"-impredicative-set"|"-vm"|"-native-compiler"
|"-indices-matter"|"-quick"|"-type-in-type"
|"-async-proofs-always-delegate"|"-async-proofs-never-reopen-branch"
@@ -110,7 +109,7 @@ let parse_args () =
|"-load-ml-source"|"-require"|"-load-ml-object"
|"-init-file"|"-dump-glob"|"-compat"|"-coqlib"|"-top"
|"-async-proofs-j" |"-async-proofs-private-flags" |"-async-proofs" |"-w"
- |"-o"|"-profile-ltac-cutoff"
+ |"-o"|"-profile-ltac-cutoff"
as o) :: rem ->
begin
match rem with
diff --git a/tools/coqdoc/index.ml b/tools/coqdoc/index.ml
index 8ba615670..1bbf76490 100644
--- a/tools/coqdoc/index.ml
+++ b/tools/coqdoc/index.ml
@@ -117,7 +117,7 @@ let find_module m =
if Hashtbl.mem local_modules m then
Local
else
- try External (Filename.concat (find_external_library m) m)
+ try External (find_external_library m ^ "/" ^ m)
with Not_found -> Unknown
diff --git a/tools/coqdoc/output.ml b/tools/coqdoc/output.ml
index 5c0d2a39b..d043c4a58 100644
--- a/tools/coqdoc/output.ml
+++ b/tools/coqdoc/output.ml
@@ -693,25 +693,21 @@ module Html = struct
printf "<span class=\"id\" title=\"keyword\">%s</span>" (translate s)
let ident s loc =
- if is_keyword s then begin
- printf "<span class=\"id\" title=\"keyword\">%s</span>" (translate s)
- end else begin
- try
- match loc with
- | None -> raise Not_found
- | Some loc ->
- reference (translate s) (Index.find (get_module false) loc)
- with Not_found ->
- if is_tactic s then
- printf "<span class=\"id\" title=\"tactic\">%s</span>" (translate s)
- else
- if !Cdglobals.interpolate && !in_doc (* always a var otherwise *)
- then
- try reference (translate s) (Index.find_string (get_module false) s)
- with _ -> Tokens.output_tagged_ident_string s
- else
- Tokens.output_tagged_ident_string s
- end
+ try
+ match loc with
+ | None -> raise Not_found
+ | Some loc ->
+ reference (translate s) (Index.find (get_module false) loc)
+ with Not_found ->
+ if is_tactic s then
+ printf "<span class=\"id\" title=\"tactic\">%s</span>" (translate s)
+ else if is_keyword s then
+ printf "<span class=\"id\" title=\"keyword\">%s</span>" (translate s)
+ else if !Cdglobals.interpolate && !in_doc (* always a var otherwise *) then
+ try reference (translate s) (Index.find_string (get_module false) s)
+ with Not_found -> Tokens.output_tagged_ident_string s
+ else
+ Tokens.output_tagged_ident_string s
let proofbox () = printf "<font size=-2>&#9744;</font>"
diff --git a/tools/coqmktop.ml b/tools/coqmktop.ml
index 30e098df5..28a3c791c 100644
--- a/tools/coqmktop.ml
+++ b/tools/coqmktop.ml
@@ -175,8 +175,6 @@ let parse_args () =
| "-top" :: rem -> top := true ; parse (op,fl) rem
| "-no-start" :: rem -> no_start:=true; parse (op, fl) rem
| "-echo" :: rem -> echo := true ; parse (op,fl) rem
- | ("-v8"|"-full" as o) :: rem ->
- Printf.eprintf "warning: option %s deprecated\n" o; parse (op,fl) rem
(* Extra options with arity 0 or 1, directly passed to ocamlc/ocamlopt *)
| ("-noassert"|"-compact"|"-g"|"-p"|"-thread"|"-dtypes" as o) :: rem ->
diff --git a/toplevel/coqtop.ml b/toplevel/coqtop.ml
index 5ecd71a39..0f8524e92 100644
--- a/toplevel/coqtop.ml
+++ b/toplevel/coqtop.ml
@@ -138,8 +138,6 @@ let set_toplevel_name dir =
if Names.DirPath.is_empty dir then user_err Pp.(str "Need a non empty toplevel module name");
toplevel_name := dir
-let remove_top_ml () = Mltop.remove ()
-
let warn_deprecated_inputstate =
CWarnings.create ~name:"deprecated-inputstate" ~category:"deprecated"
(fun () -> strbrk "The inputstate option is deprecated and discouraged.")
@@ -585,24 +583,8 @@ let parse_args arglist =
|"-type-in-type" -> set_type_in_type ()
|"-unicode" -> add_require "Utf8_core"
|"-v"|"--version" -> Usage.version (exitcode ())
- |"--print-version" -> Usage.machine_readable_version (exitcode ())
+ |"-print-version"|"--print-version" -> Usage.machine_readable_version (exitcode ())
|"-where" -> print_where := true
- |"-xml" -> Flags.xml_export := true
-
- (* Deprecated options *)
- |"-byte" -> warning "option -byte deprecated, call with .byte suffix"
- |"-opt" -> warning "option -opt deprecated, call with .opt suffix"
- |"-full" -> warning "option -full deprecated"
- |"-notactics" -> warning "Obsolete option \"-notactics\"."; remove_top_ml ()
- |"-emacs-U" ->
- warning "Obsolete option \"-emacs-U\", use -emacs instead."; set_emacs ()
- |"-v7" -> user_err Pp.(str "This version of Coq does not support v7 syntax")
- |"-v8" -> warning "Obsolete option \"-v8\"."
- |"-lazy-load-proofs" -> warning "Obsolete option \"-lazy-load-proofs\"."
- |"-dont-load-proofs" -> warning "Obsolete option \"-dont-load-proofs\"."
- |"-force-load-proofs" -> warning "Obsolete option \"-force-load-proofs\"."
- |"-unsafe" -> warning "Obsolete option \"-unsafe\"."; ignore (next ())
- |"-quality" -> warning "Obsolete option \"-quality\"."
(* Unknown option *)
| s -> extras := s :: !extras
diff --git a/toplevel/usage.ml b/toplevel/usage.ml
index f8c7b114c..d596e36f3 100644
--- a/toplevel/usage.ml
+++ b/toplevel/usage.ml
@@ -57,7 +57,7 @@ let print_usage_channel co command =
\n -where print Coq's standard library location and exit\
\n -config, --config print Coq's configuration information and exit\
\n -v, --version print Coq version and exit\
-\n --print-version print Coq version in easy to parse format and exit\
+\n -print-version print Coq version in easy to parse format and exit\
\n -list-tags print highlight color tags known by Coq and exit\
\n\
\n -quiet unset display of extra information (implies -w \"-all\")\
@@ -78,9 +78,6 @@ let print_usage_channel co command =
\n -impredicative-set set sort Set impredicative\
\n -indices-matter levels of indices (and nonuniform parameters) contribute to the level of inductives\
\n -type-in-type disable universe consistency checking\
-\n -xml export XML files either to the hierarchy rooted in\
-\n the directory $COQ_XML_LIBRARY_ROOT (if set) or to\
-\n stdout (if unset)\
\n -time display the time taken by each command\
\n -profile-ltac display the time taken by each (sub)tactic\
\n -m, --memory display total heap size at program exit\
diff --git a/toplevel/vernac.ml b/toplevel/vernac.ml
index fe853c093..bfab44770 100644
--- a/toplevel/vernac.ml
+++ b/toplevel/vernac.ml
@@ -243,10 +243,6 @@ let process_expr sid loc_ast =
checknav_deep loc_ast;
interp_vernac sid loc_ast
-(* XML output hooks *)
-let (f_xml_start_library, xml_start_library) = Hook.make ~default:ignore ()
-let (f_xml_end_library, xml_end_library) = Hook.make ~default:ignore ()
-
let warn_file_no_extension =
CWarnings.create ~name:"file-no-extension" ~category:"filesystem"
(fun (f,ext) ->
@@ -308,7 +304,6 @@ let compile verbosely f =
~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");
- if !Flags.xml_export then Hook.get f_xml_start_library ();
let wall_clock1 = Unix.gettimeofday () in
let _ = load_vernac verbosely (Stm.get_current_state ()) long_f_dot_v in
Stm.join ();
@@ -318,7 +313,6 @@ let compile verbosely f =
Aux_file.record_in_aux_at "vo_compile_time"
(Printf.sprintf "%.3f" (wall_clock2 -. wall_clock1));
Aux_file.stop_aux_file ();
- if !Flags.xml_export then Hook.get f_xml_end_library ();
Dumpglob.end_dump_glob ()
| BuildVio ->
let long_f_dot_v = ensure_v f in
diff --git a/toplevel/vernac.mli b/toplevel/vernac.mli
index 77c4f44e1..bccf560e1 100644
--- a/toplevel/vernac.mli
+++ b/toplevel/vernac.mli
@@ -21,7 +21,3 @@ val load_vernac : bool -> Stateid.t -> string -> Stateid.t
(** Compile a vernac file, (f is assumed without .v suffix) *)
val compile : bool -> string -> unit
-
-(** Set XML hooks *)
-val xml_start_library : (unit -> unit) Hook.t
-val xml_end_library : (unit -> unit) Hook.t
diff --git a/vernac/explainErr.ml b/vernac/explainErr.ml
index 793a4c580..2178a7caa 100644
--- a/vernac/explainErr.ml
+++ b/vernac/explainErr.ml
@@ -18,7 +18,7 @@ let guill s = str "\"" ++ str s ++ str "\""
(** Invariant : exceptions embedded in EvaluatedError satisfy
Errors.noncritical *)
-exception EvaluatedError of std_ppcmds * exn option
+exception EvaluatedError of Pp.t * exn option
(** Registration of generic errors
Nota: explain_exn does NOT end with a newline anymore!
diff --git a/vernac/explainErr.mli b/vernac/explainErr.mli
index 944339d85..0cbd71fa4 100644
--- a/vernac/explainErr.mli
+++ b/vernac/explainErr.mli
@@ -7,7 +7,7 @@
(************************************************************************)
(** Toplevel Exception *)
-exception EvaluatedError of Pp.std_ppcmds * exn option
+exception EvaluatedError of Pp.t * exn option
(** Pre-explain a vernac interpretation error *)
@@ -16,6 +16,6 @@ val process_vernac_interp_error : ?allow_uncaught:bool -> Util.iexn -> Util.iexn
(** General explain function. Should not be used directly now,
see instead function [Errors.print] and variants *)
-val explain_exn_default : exn -> Pp.std_ppcmds
+val explain_exn_default : exn -> Pp.t
-val register_additional_error_info : (Util.iexn -> (Pp.std_ppcmds option Loc.located) option) -> unit
+val register_additional_error_info : (Util.iexn -> (Pp.t option Loc.located) option) -> unit
diff --git a/vernac/himsg.ml b/vernac/himsg.ml
index 784c6d338..2be10a039 100644
--- a/vernac/himsg.ml
+++ b/vernac/himsg.ml
@@ -100,17 +100,18 @@ let pr_ljudge_env e s c = let v,t = pr_ljudge_env e s c in (quote v,quote t)
(** A canonisation procedure for constr such that comparing there
externalisation catches more equalities *)
-let canonize_constr c =
+let canonize_constr sigma c =
(* replaces all the names in binders by [dn] ("default name"),
ensures that [alpha]-equivalent terms will have the same
externalisation. *)
+ let open EConstr in
let dn = Name.Anonymous in
let rec canonize_binders c =
- match Term.kind_of_term c with
+ match EConstr.kind sigma c with
| Prod (_,t,b) -> mkProd(dn,t,b)
| Lambda (_,t,b) -> mkLambda(dn,t,b)
| LetIn (_,u,t,b) -> mkLetIn(dn,u,t,b)
- | _ -> Term.map_constr canonize_binders c
+ | _ -> EConstr.map sigma canonize_binders c
in
canonize_binders c
@@ -118,8 +119,8 @@ let canonize_constr c =
let display_eq ~flags env sigma t1 t2 =
(* terms are canonized, then their externalisation is compared syntactically *)
let open Constrextern in
- let t1 = canonize_constr t1 in
- let t2 = canonize_constr t2 in
+ let t1 = canonize_constr sigma t1 in
+ let t2 = canonize_constr sigma t2 in
let ct1 = Flags.with_options flags (fun () -> extern_constr false env sigma t1) () in
let ct2 = Flags.with_options flags (fun () -> extern_constr false env sigma t2) () in
Constrexpr_ops.constr_expr_eq ct1 ct2
@@ -129,7 +130,7 @@ let display_eq ~flags env sigma t1 t2 =
let rec pr_explicit_aux env sigma t1 t2 = function
| [] ->
(** no specified flags: default. *)
- (quote (Printer.pr_lconstr_env env sigma t1), quote (Printer.pr_lconstr_env env sigma t2))
+ (quote (Printer.pr_leconstr_env env sigma t1), quote (Printer.pr_leconstr_env env sigma t2))
| flags :: rem ->
let equal = display_eq ~flags env sigma t1 t2 in
if equal then
@@ -153,7 +154,7 @@ let explicit_flags =
[print_universes; print_implicits; print_coercions; print_no_symbol] (** and more! *) ]
let pr_explicit env sigma t1 t2 =
- pr_explicit_aux env sigma (EConstr.to_constr sigma t1) (EConstr.to_constr sigma t2) explicit_flags
+ pr_explicit_aux env sigma t1 t2 explicit_flags
let pr_db env i =
try
@@ -783,7 +784,7 @@ let pr_constraints printenv env sigma evars cstrs =
let explain_unsatisfiable_constraints env sigma constr comp =
let (_, constraints) = Evd.extract_all_conv_pbs sigma in
- let undef = Evd.undefined_map (Evarutil.nf_evar_map_undefined sigma) in
+ let undef = Evd.undefined_map sigma in
(** Only keep evars that are subject to resolution and members of the given
component. *)
let is_kept evk evi = match comp with
diff --git a/vernac/himsg.mli b/vernac/himsg.mli
index b95ef8425..5b91f9e68 100644
--- a/vernac/himsg.mli
+++ b/vernac/himsg.mli
@@ -6,7 +6,6 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-open Pp
open Indtypes
open Environ
open Type_errors
@@ -18,28 +17,28 @@ open Logic
(** This module provides functions to explain the type errors. *)
-val explain_type_error : env -> Evd.evar_map -> type_error -> std_ppcmds
+val explain_type_error : env -> Evd.evar_map -> type_error -> Pp.t
-val explain_pretype_error : env -> Evd.evar_map -> pretype_error -> std_ppcmds
+val explain_pretype_error : env -> Evd.evar_map -> pretype_error -> Pp.t
-val explain_inductive_error : inductive_error -> std_ppcmds
+val explain_inductive_error : inductive_error -> Pp.t
-val explain_typeclass_error : env -> typeclass_error -> Pp.std_ppcmds
+val explain_typeclass_error : env -> typeclass_error -> Pp.t
-val explain_recursion_scheme_error : recursion_scheme_error -> std_ppcmds
+val explain_recursion_scheme_error : recursion_scheme_error -> Pp.t
-val explain_refiner_error : refiner_error -> std_ppcmds
+val explain_refiner_error : refiner_error -> Pp.t
val explain_pattern_matching_error :
- env -> Evd.evar_map -> pattern_matching_error -> std_ppcmds
+ env -> Evd.evar_map -> pattern_matching_error -> Pp.t
val explain_reduction_tactic_error :
- Tacred.reduction_tactic_error -> std_ppcmds
+ Tacred.reduction_tactic_error -> Pp.t
-val explain_module_error : Modops.module_typing_error -> std_ppcmds
+val explain_module_error : Modops.module_typing_error -> Pp.t
val explain_module_internalization_error :
- Modintern.module_internalization_error -> std_ppcmds
+ Modintern.module_internalization_error -> Pp.t
val map_pguard_error : ('c -> 'd) -> 'c pguard_error -> 'd pguard_error
val map_ptype_error : ('c -> 'd) -> ('c, 'c) ptype_error -> ('d, 'd) ptype_error
diff --git a/vernac/metasyntax.ml b/vernac/metasyntax.ml
index 567fc57fa..8b042a3ca 100644
--- a/vernac/metasyntax.ml
+++ b/vernac/metasyntax.ml
@@ -522,35 +522,11 @@ let read_recursive_format sl fmt =
let slfmt, fmt = get_head fmt in
slfmt, get_tail (slfmt, fmt)
-let warn_skip_spaces_curly =
- CWarnings.create ~name:"skip-spaces-curly" ~category:"parsing"
- (fun () ->strbrk "Skipping spaces inside curly brackets")
-
-let rec drop_spacing = function
- | UnpCut _ :: fmt -> warn_skip_spaces_curly (); drop_spacing fmt
- | UnpTerminal s' :: fmt when String.equal s' (String.make (String.length s') ' ') -> warn_skip_spaces_curly (); drop_spacing fmt
- | fmt -> fmt
-
-let has_closing_curly_brace symbs fmt =
- (* TODO: recognize and fail in case a box overlaps a pair of curly braces *)
- let fmt = drop_spacing fmt in
- match symbs, fmt with
- | NonTerminal s :: symbs, (UnpTerminal s' as u) :: fmt when Id.equal s (Id.of_string s') ->
- let fmt = drop_spacing fmt in
- (match fmt with
- | UnpTerminal "}" :: fmt -> Some (u :: fmt)
- | _ -> None)
- | _ -> None
-
let hunks_of_format (from,(vars,typs)) symfmt =
- let a = ref None in
let rec aux = function
| symbs, (UnpTerminal s' as u) :: fmt
when String.equal s' (String.make (String.length s') ' ') ->
let symbs, l = aux (symbs,fmt) in symbs, u :: l
- | symbs, (UnpTerminal "{") :: fmt when (a := has_closing_curly_brace symbs fmt; !a <> None) ->
- let newfmt = Option.get !a in
- aux (symbs,newfmt)
| Terminal s :: symbs, (UnpTerminal s') :: fmt
when String.equal s (String.drop_simple_quotes s') ->
let symbs, l = aux (symbs,fmt) in symbs, UnpTerminal s :: l
@@ -615,46 +591,71 @@ let define_keywords = function
let distribute a ll = List.map (fun l -> a @ l) ll
- (* Expand LIST1(t,sep) into the combination of t and t;sep;LIST1(t,sep)
- as many times as expected in [n] argument *)
-let rec expand_list_rule typ tkl x n i hds ll =
- if Int.equal i n then
+ (* Expand LIST1(t,sep);sep;t;...;t (with the trailing pattern
+ occurring p times, possibly p=0) into the combination of
+ t;sep;t;...;t;sep;t (p+1 times)
+ t;sep;t;...;t;sep;t;sep;t (p+2 times)
+ ...
+ t;sep;t;...;t;sep;t;...;t;sep;t (p+n times)
+ t;sep;t;...;t;sep;t;...;t;sep;t;LIST1(t,sep) *)
+
+let expand_list_rule typ tkl x n p ll =
+ let camlp4_message_name = Some (add_suffix x ("_"^string_of_int n)) in
+ let main = GramConstrNonTerminal (ETConstr typ, camlp4_message_name) in
+ let tks = List.map (fun x -> GramConstrTerminal x) tkl in
+ let rec aux i hds ll =
+ if i < p then aux (i+1) (main :: tks @ hds) ll
+ else if Int.equal i (p+n) then
let hds =
- GramConstrListMark (n,true) :: hds
+ GramConstrListMark (p+n,true,p) :: hds
@ [GramConstrNonTerminal (ETConstrList (typ,tkl), Some x)] in
distribute hds ll
else
- let camlp4_message_name = Some (add_suffix x ("_"^string_of_int n)) in
- let main = GramConstrNonTerminal (ETConstr typ, camlp4_message_name) in
- let tks = List.map (fun x -> GramConstrTerminal x) tkl in
- distribute (GramConstrListMark (i+1,false) :: hds @ [main]) ll @
- expand_list_rule typ tkl x n (i+1) (main :: tks @ hds) ll
+ distribute (GramConstrListMark (i+1,false,p) :: hds @ [main]) ll @
+ aux (i+1) (main :: tks @ hds) ll in
+ aux 0 [] ll
+
+let is_constr_typ typ x etyps =
+ match List.assoc x etyps with
+ | ETConstr typ' -> typ = typ'
+ | _ -> false
+
+let include_possible_similar_trailing_pattern typ etyps sl l =
+ let rec aux n = function
+ | Terminal s :: sl, Terminal s'::l' when s = s' -> aux n (sl,l')
+ | [], NonTerminal x ::l' when is_constr_typ typ x etyps -> try_aux n l'
+ | _ -> raise Exit
+ and try_aux n l =
+ try aux (n+1) (sl,l)
+ with Exit -> n,l in
+ try_aux 0 l
let make_production etyps symbols =
- let prod =
- List.fold_right
- (fun t ll -> match t with
- | NonTerminal m ->
- let typ = List.assoc m etyps in
- distribute [GramConstrNonTerminal (typ, Some m)] ll
- | Terminal s ->
- distribute [GramConstrTerminal (CLexer.terminal s)] ll
- | Break _ ->
- ll
- | SProdList (x,sl) ->
- let tkl = List.flatten
- (List.map (function Terminal s -> [CLexer.terminal s]
- | Break _ -> []
- | _ -> anomaly (Pp.str "Found a non terminal token in recursive notation separator.")) sl) in
- match List.assoc x etyps with
- | ETConstr typ -> expand_list_rule typ tkl x 1 0 [] ll
- | ETBinder o ->
- distribute
- [GramConstrNonTerminal (ETBinderList (o,tkl), Some x)] ll
- | _ ->
- user_err Pp.(str "Components of recursive patterns in notation must be terms or binders."))
- symbols [[]] in
- List.map define_keywords prod
+ let rec aux = function
+ | [] -> [[]]
+ | NonTerminal m :: l ->
+ let typ = List.assoc m etyps in
+ distribute [GramConstrNonTerminal (typ, Some m)] (aux l)
+ | Terminal s :: l ->
+ distribute [GramConstrTerminal (CLexer.terminal s)] (aux l)
+ | Break _ :: l ->
+ aux l
+ | SProdList (x,sl) :: l ->
+ let tkl = List.flatten
+ (List.map (function Terminal s -> [CLexer.terminal s]
+ | Break _ -> []
+ | _ -> anomaly (Pp.str "Found a non terminal token in recursive notation separator.")) sl) in
+ match List.assoc x etyps with
+ | ETConstr typ ->
+ let p,l' = include_possible_similar_trailing_pattern typ etyps sl l in
+ expand_list_rule typ tkl x 1 p (aux l')
+ | ETBinder o ->
+ distribute
+ [GramConstrNonTerminal (ETBinderList (o,tkl), Some x)] (aux l)
+ | _ ->
+ user_err Pp.(str "Components of recursive patterns in notation must be terms or binders.") in
+ let prods = aux symbols in
+ List.map define_keywords prods
let rec find_symbols c_current c_next c_last = function
| [] -> []
@@ -680,26 +681,40 @@ let recompute_assoc typs =
(**************************************************************************)
(* Registration of syntax extensions (parsing/printing, no interpretation)*)
-let pr_arg_level from = function
+let pr_arg_level from (lev,typ) =
+ let pplev = match lev with
| (n,L) when Int.equal n from -> str "at next level"
| (n,E) -> str "at level " ++ int n
| (n,L) -> str "at level below " ++ int n
| (n,Prec m) when Int.equal m n -> str "at level " ++ int n
- | (n,_) -> str "Unknown level"
-
-let pr_level ntn (from,args) =
+ | (n,_) -> str "Unknown level" in
+ let pptyp = match typ with
+ | NtnInternTypeConstr -> mt ()
+ | NtnInternTypeBinder -> str " " ++ surround (str "binder")
+ | NtnInternTypeIdent -> str " " ++ surround (str "ident") in
+ pplev ++ pptyp
+
+let pr_level ntn (from,args,typs) =
str "at level " ++ int from ++ spc () ++ str "with arguments" ++ spc() ++
- prlist_with_sep pr_comma (pr_arg_level from) args
+ prlist_with_sep pr_comma (pr_arg_level from) (List.combine args typs)
let error_incompatible_level ntn oldprec prec =
user_err
- (str "Notation " ++ str ntn ++ str " is already defined" ++ spc() ++
+ (str "Notation " ++ qstring ntn ++ str " is already defined" ++ spc() ++
+ pr_level ntn oldprec ++
+ spc() ++ str "while it is now required to be" ++ spc() ++
+ pr_level ntn prec ++ str ".")
+
+let error_parsing_incompatible_level ntn ntn' oldprec prec =
+ user_err
+ (str "Notation " ++ qstring ntn ++ str " relies on a parsing rule for " ++ qstring ntn' ++ spc() ++
+ str " which is already defined" ++ spc() ++
pr_level ntn oldprec ++
spc() ++ str "while it is now required to be" ++ spc() ++
pr_level ntn prec ++ str ".")
type syntax_extension = {
- synext_level : Notation.level;
+ synext_level : Notation_term.level;
synext_notation : notation;
synext_notgram : notation_grammar;
synext_unparsing : unparsing list;
@@ -711,7 +726,17 @@ let is_active_compat = function
| None -> true
| Some v -> 0 <= Flags.version_compare v !Flags.compat_version
-type syntax_extension_obj = locality_flag * syntax_extension list
+type syntax_extension_obj = locality_flag * syntax_extension
+
+let check_and_extend_constr_grammar ntn rule =
+ try
+ let ntn_for_grammar = rule.notgram_notation in
+ if String.equal ntn ntn_for_grammar then raise Not_found;
+ let prec = rule.notgram_level in
+ let oldprec = Notation.level_of_notation ntn_for_grammar in
+ if not (Notation.level_eq prec oldprec) then error_parsing_incompatible_level ntn ntn_for_grammar oldprec prec;
+ with Not_found ->
+ Egramcoq.extend_constr_grammar rule
let cache_one_syntax_extension se =
let ntn = se.synext_notation in
@@ -719,31 +744,30 @@ let cache_one_syntax_extension se =
let onlyprint = se.synext_notgram.notgram_onlyprinting in
try
let oldprec = Notation.level_of_notation ntn in
- if not (Notation.level_eq prec oldprec) then error_incompatible_level ntn oldprec prec
+ if not (Notation.level_eq prec oldprec) then error_incompatible_level ntn oldprec prec;
with Not_found ->
if is_active_compat se.synext_compat then begin
(* Reserve the notation level *)
Notation.declare_notation_level ntn prec;
(* Declare the parsing rule *)
- if not onlyprint then Egramcoq.extend_constr_grammar prec se.synext_notgram;
+ if not onlyprint then List.iter (check_and_extend_constr_grammar ntn) se.synext_notgram.notgram_rules;
(* Declare the notation rule *)
Notation.declare_notation_rule ntn
- ~extra:se.synext_extra (se.synext_unparsing, fst prec) se.synext_notgram
+ ~extra:se.synext_extra (se.synext_unparsing, pi1 prec) se.synext_notgram
end
let cache_syntax_extension (_, (_, sy)) =
- List.iter cache_one_syntax_extension sy
+ cache_one_syntax_extension sy
let subst_parsing_rule subst x = x
let subst_printing_rule subst x = x
let subst_syntax_extension (subst, (local, sy)) =
- let map sy = { sy with
- synext_notgram = subst_parsing_rule subst sy.synext_notgram;
+ (local, { sy with
+ synext_notgram = { sy.synext_notgram with notgram_rules = List.map (subst_parsing_rule subst) sy.synext_notgram.notgram_rules };
synext_unparsing = subst_printing_rule subst sy.synext_unparsing;
- } in
- (local, List.map map sy)
+ })
let classify_syntax_definition (local, _ as o) =
if local then Dispose else Substitute o
@@ -1024,13 +1048,10 @@ let remove_curly_brackets l =
| Terminal "{" as t1 :: l ->
let br,next = skip_break [] l in
(match next with
- | NonTerminal _ as x :: l' as l0 ->
+ | NonTerminal _ as x :: l' ->
let br',next' = skip_break [] l' in
(match next' with
- | Terminal "}" as t2 :: l'' as l1 ->
- if not (List.equal Notation.symbol_eq l l0) ||
- not (List.equal Notation.symbol_eq l' l1) then
- warn_skip_spaces_curly ();
+ | Terminal "}" as t2 :: l'' ->
if deb && List.is_empty l'' then [t1;x;t2] else begin
check_curly_brackets_notation_exists ();
x :: aux false l''
@@ -1042,6 +1063,8 @@ let remove_curly_brackets l =
module SynData = struct
+ type subentry_types = (Id.t * (production_level, production_position) constr_entry_key_gen) list
+
(* XXX: Document *)
type syn_data = {
@@ -1056,7 +1079,7 @@ module SynData = struct
extra : (string * string) list;
(* XXX: Callback to printing, must remove *)
- msgs : ((std_ppcmds -> unit) * std_ppcmds) list;
+ msgs : ((Pp.t -> unit) * Pp.t) list;
(* Fields for internalization *)
recvars : (Id.t * Id.t) list;
@@ -1064,17 +1087,28 @@ module SynData = struct
intern_typs : notation_var_internalization_type list;
(* Notation data for parsing *)
-
- level : int;
- syntax_data : (Id.t * (production_level, production_position) constr_entry_key_gen) list * (* typs *)
- symbol list; (* symbols *)
+ level : level;
+ pa_syntax_data : subentry_types * symbol list;
+ pp_syntax_data : subentry_types * symbol list;
not_data : notation * (* notation *)
- (int * parenRelation) list * (* precedence *)
+ level * (* level, precedence, types *)
bool; (* needs_squash *)
}
end
+let find_subentry_types n assoc etyps symbols =
+ let innerlevel = NumLevel 200 in
+ let typs =
+ find_symbols
+ (NumLevel n,BorderProd(Left,assoc))
+ (innerlevel,InternalProd)
+ (NumLevel n,BorderProd(Right,assoc))
+ symbols in
+ let sy_typs = List.map (set_entry_type etyps) typs in
+ let prec = List.map (assoc_of_type n) sy_typs in
+ sy_typs, prec
+
let compute_syntax_data df modifiers =
let open SynData in
let open NotationMods in
@@ -1090,27 +1124,24 @@ let compute_syntax_data df modifiers =
(* Notations for interp and grammar *)
let ntn_for_interp = make_notation_key symbols in
- let symbols' = remove_curly_brackets symbols in
- let ntn_for_grammar = make_notation_key symbols' in
- if not onlyprint then check_rule_productivity symbols';
-
- (* Misc *)
- let need_squash = not (List.equal Notation.symbol_eq symbols symbols') in
- let msgs,n = find_precedence mods.level mods.etyps symbols' in
- let innerlevel = NumLevel 200 in
- let typs =
- find_symbols
- (NumLevel n,BorderProd(Left,assoc))
- (innerlevel,InternalProd)
- (NumLevel n,BorderProd(Right,assoc))
- symbols' in
+ let symbols_for_grammar = remove_curly_brackets symbols in
+ let need_squash = not (List.equal Notation.symbol_eq symbols symbols_for_grammar) in
+ let ntn_for_grammar = if need_squash then make_notation_key symbols_for_grammar else ntn_for_interp in
+ if not onlyprint then check_rule_productivity symbols_for_grammar;
+ let msgs,n = find_precedence mods.level mods.etyps symbols in
(* To globalize... *)
let etyps = join_auxiliary_recursive_types recvars mods.etyps in
- let sy_typs = List.map (set_entry_type etyps) typs in
- let prec = List.map (assoc_of_type n) sy_typs in
+ let sy_typs, prec =
+ find_subentry_types n assoc etyps symbols in
+ let sy_typs_for_grammar, prec_for_grammar =
+ if need_squash then
+ find_subentry_types n assoc etyps symbols_for_grammar
+ else
+ sy_typs, prec in
let i_typs = set_internalization_type sy_typs in
- let sy_data = (sy_typs,symbols') in
- let sy_fulldata = (ntn_for_grammar,prec,need_squash) in
+ let pa_sy_data = (sy_typs_for_grammar,symbols_for_grammar) in
+ let pp_sy_data = (sy_typs,symbols) in
+ let sy_fulldata = (ntn_for_grammar,(n,prec_for_grammar,i_typs),need_squash) in
let df' = ((Lib.library_dp(),Lib.current_dirpath true),df) in
let i_data = ntn_for_interp, df' in
@@ -1129,8 +1160,9 @@ let compute_syntax_data df modifiers =
mainvars;
intern_typs = i_typs;
- level = n;
- syntax_data = sy_data;
+ level = (n,prec,i_typs);
+ pa_syntax_data = pa_sy_data;
+ pp_syntax_data = pp_sy_data;
not_data = sy_fulldata;
}
@@ -1211,25 +1243,9 @@ let with_syntax_protection f x =
(**********************************************************************)
(* Recovering existing syntax *)
-let contract_notation ntn =
- if String.equal ntn "{ _ }" then ntn else
- let rec aux ntn i =
- if i <= String.length ntn - 5 then
- let ntn' =
- if String.is_sub "{ _ }" ntn i &&
- (i = 0 || ntn.[i-1] = ' ') &&
- (i = String.length ntn - 5 || ntn.[i+5] = ' ')
- then
- String.sub ntn 0 i ^ "_" ^
- String.sub ntn (i+5) (String.length ntn -i-5)
- else ntn in
- aux ntn' (i+1)
- else ntn in
- aux ntn 0
-
exception NoSyntaxRule
-let recover_syntax ntn =
+let recover_notation_syntax ntn =
try
let prec = Notation.level_of_notation ntn in
let pp_rule,_ = Notation.find_notation_printing_rule ntn in
@@ -1246,29 +1262,25 @@ let recover_syntax ntn =
raise NoSyntaxRule
let recover_squash_syntax sy =
- let sq = recover_syntax "{ _ }" in
- [sy; sq]
-
-let recover_notation_syntax rawntn =
- let ntn = contract_notation rawntn in
- let sy = recover_syntax ntn in
- let need_squash = not (String.equal ntn rawntn) in
- let rules = if need_squash then recover_squash_syntax sy else [sy] in
- sy.synext_notgram.notgram_typs, rules, sy.synext_notgram.notgram_onlyprinting
+ let sq = recover_notation_syntax "{ _ }" in
+ sy :: sq.synext_notgram.notgram_rules
(**********************************************************************)
(* Main entry point for building parsing and printing rules *)
-let make_pa_rule i_typs level (typs,symbols) ntn onlyprint =
+let make_pa_rule level (typs,symbols) ntn need_squash =
let assoc = recompute_assoc typs in
let prod = make_production typs symbols in
- { notgram_level = level;
+ let sy = {
+ notgram_level = level;
notgram_assoc = assoc;
notgram_notation = ntn;
notgram_prods = prod;
- notgram_typs = i_typs;
- notgram_onlyprinting = onlyprint;
- }
+ } in
+ (* By construction, the rule for "{ _ }" is declared, but we need to
+ redeclare it because the file where it is declared needs not be open
+ when the current file opens (especially in presence of -nois) *)
+ if need_squash then recover_squash_syntax sy else [sy]
let make_pp_rule level (typs,symbols) fmt =
match fmt with
@@ -1277,21 +1289,16 @@ let make_pp_rule level (typs,symbols) fmt =
(* let make_syntax_rules i_typs (ntn,prec,need_squash) sy_data fmt extra onlyprint compat = *)
let make_syntax_rules (sd : SynData.syn_data) = let open SynData in
- let ntn, prec, need_squash = sd.not_data in
- let pa_rule = make_pa_rule sd.intern_typs sd.level sd.syntax_data ntn sd.only_printing in
- let pp_rule = make_pp_rule sd.level sd.syntax_data sd.format in
- let sy = {
- synext_level = (sd.level, prec);
- synext_notation = ntn;
- synext_notgram = pa_rule;
+ let ntn_for_grammar, prec_for_grammar, need_squash = sd.not_data in
+ let pa_rule = make_pa_rule prec_for_grammar sd.pa_syntax_data ntn_for_grammar need_squash in
+ let pp_rule = make_pp_rule (pi1 sd.level) sd.pp_syntax_data sd.format in {
+ synext_level = sd.level;
+ synext_notation = fst sd.info;
+ synext_notgram = { notgram_onlyprinting = sd.only_printing; notgram_rules = pa_rule };
synext_unparsing = pp_rule;
synext_extra = sd.extra;
synext_compat = sd.compat;
- } in
- (* By construction, the rule for "{ _ }" is declared, but we need to
- redeclare it because the file where it is declared needs not be open
- when the current file opens (especially in presence of -nois) *)
- if need_squash then recover_squash_syntax sy else [sy]
+ }
(**********************************************************************)
(* Main functions about notations *)
@@ -1336,11 +1343,11 @@ let add_notation_interpretation_core local df ?(impls=empty_internalization_env)
let (recvars,mainvars,symbs) = analyze_notation_tokens ~onlyprint dfs in
(* Recover types of variables and pa/pp rules; redeclare them if needed *)
let i_typs, onlyprint = if not (is_numeral symbs) then begin
- let i_typs,sy_rules,onlyprint' = recover_notation_syntax (make_notation_key symbs) in
- let () = Lib.add_anonymous_leaf (inSyntaxExtension (local,sy_rules)) in
+ let sy = recover_notation_syntax (make_notation_key symbs) in
+ let () = Lib.add_anonymous_leaf (inSyntaxExtension (local,sy)) in
(** If the only printing flag has been explicitly requested, put it back *)
- let onlyprint = onlyprint || onlyprint' in
- i_typs, onlyprint
+ let onlyprint = onlyprint || sy.synext_notgram.notgram_onlyprinting in
+ pi3 sy.synext_level, onlyprint
end else [], false in
(* Declare interpretation *)
let path = (Lib.library_dp(), Lib.current_dirpath true) in
diff --git a/vernac/metasyntax.mli b/vernac/metasyntax.mli
index c9e37a4eb..9cd00cbcb 100644
--- a/vernac/metasyntax.mli
+++ b/vernac/metasyntax.mli
@@ -52,7 +52,7 @@ val add_syntactic_definition : Id.t -> Id.t list * constr_expr ->
(** Print the Camlp4 state of a grammar *)
-val pr_grammar : string -> Pp.std_ppcmds
+val pr_grammar : string -> Pp.t
type any_entry = AnyEntry : 'a Pcoq.Gram.entry -> any_entry
diff --git a/vernac/mltop.mli b/vernac/mltop.mli
index 3ecda656d..324a66d38 100644
--- a/vernac/mltop.mli
+++ b/vernac/mltop.mli
@@ -83,6 +83,6 @@ val declare_ml_modules : Vernacexpr.locality_flag -> string list -> unit
(** {5 Utilities} *)
-val print_ml_path : unit -> Pp.std_ppcmds
-val print_ml_modules : unit -> Pp.std_ppcmds
-val print_gc : unit -> Pp.std_ppcmds
+val print_ml_path : unit -> Pp.t
+val print_ml_modules : unit -> Pp.t
+val print_gc : unit -> Pp.t
diff --git a/vernac/obligations.ml b/vernac/obligations.ml
index 28aeaa725..a4fe49020 100644
--- a/vernac/obligations.ml
+++ b/vernac/obligations.ml
@@ -650,7 +650,7 @@ let declare_obligation prg obl body ty uctx =
let constant = Declare.declare_constant obl.obl_name ~local:true
(DefinitionEntry ce,IsProof Property)
in
- if not opaque then add_hint false prg constant;
+ if not opaque then add_hint (Locality.make_section_locality None) prg constant;
definition_message obl.obl_name;
true, { obl with obl_body =
if poly then
diff --git a/vernac/obligations.mli b/vernac/obligations.mli
index fa691ad1b..5614403ba 100644
--- a/vernac/obligations.mli
+++ b/vernac/obligations.mli
@@ -10,7 +10,6 @@ open Environ
open Term
open Evd
open Names
-open Pp
open Globnames
(* This is a hack to make it possible for Obligations to craft a Qed
@@ -96,12 +95,12 @@ val try_solve_obligations : Names.Id.t option -> unit Proofview.tactic option ->
val show_obligations : ?msg:bool -> Names.Id.t option -> unit
-val show_term : Names.Id.t option -> std_ppcmds
+val show_term : Names.Id.t option -> Pp.t
val admit_obligations : Names.Id.t option -> unit
exception NoObligations of Names.Id.t option
-val explain_no_obligations : Names.Id.t option -> Pp.std_ppcmds
+val explain_no_obligations : Names.Id.t option -> Pp.t
val set_program_mode : bool -> unit
diff --git a/vernac/topfmt.mli b/vernac/topfmt.mli
index 6e006fc6c..afe76f6f8 100644
--- a/vernac/topfmt.mli
+++ b/vernac/topfmt.mli
@@ -37,8 +37,8 @@ val set_margin : int option -> unit
val get_margin : unit -> int option
(** Console display of feedback, we may add some location information *)
-val std_logger : ?pre_hdr:Pp.std_ppcmds -> Feedback.level -> Pp.std_ppcmds -> unit
-val emacs_logger : ?pre_hdr:Pp.std_ppcmds -> Feedback.level -> Pp.std_ppcmds -> unit
+val std_logger : ?pre_hdr:Pp.t -> Feedback.level -> Pp.t -> unit
+val emacs_logger : ?pre_hdr:Pp.t -> Feedback.level -> Pp.t -> unit
(** Color output *)
val clear_styles : unit -> unit
@@ -51,8 +51,8 @@ val init_terminal_output : color:bool -> unit
(** Error printing *)
(* To be deprecated when we can fully move to feedback-based error
printing. *)
-val pr_loc : Loc.t -> Pp.std_ppcmds
-val print_err_exn : ?extra:Pp.std_ppcmds -> exn -> unit
+val pr_loc : Loc.t -> Pp.t
+val print_err_exn : ?extra:Pp.t -> 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 6b04ff00a..4f63ed6f4 100644
--- a/vernac/vernacentries.ml
+++ b/vernac/vernacentries.ml
@@ -65,7 +65,7 @@ let show_top_evars () =
let pfts = Proof_global.give_me_the_proof () in
let gls = Proof.V82.subgoals pfts in
let sigma = gls.Evd.sigma in
- Feedback.msg_notice (pr_evars_int sigma 1 (Evarutil.non_instantiated sigma))
+ Feedback.msg_notice (pr_evars_int sigma 1 (Evd.undefined_map sigma))
let show_universes () =
let pfts = Proof_global.give_me_the_proof () in
@@ -522,7 +522,21 @@ let vernac_assumption locality poly (local, kind) l nl =
let status = do_assumptions kind nl l in
if not status then Feedback.feedback Feedback.AddedAxiom
+let should_treat_as_cumulative cum poly =
+ if poly then
+ match cum with
+ | GlobalCumulativity | LocalCumulativity -> true
+ | GlobalNonCumulativity | LocalNonCumulativity -> false
+ else
+ match cum with
+ | GlobalCumulativity | GlobalNonCumulativity -> false
+ | LocalCumulativity ->
+ user_err Pp.(str "The Cumulative prefix can only be used in a polymorphic context.")
+ | LocalNonCumulativity ->
+ user_err Pp.(str "The NonCumulative prefix can only be used in a polymorphic context.")
+
let vernac_record cum k poly finite struc binders sort nameopt cfs =
+ let is_cumulative = should_treat_as_cumulative cum poly in
let const = match nameopt with
| None -> add_prefix "Build_" (snd (fst (snd struc)))
| Some (_,id as lid) ->
@@ -533,13 +547,14 @@ let vernac_record cum k poly finite struc binders sort nameopt cfs =
match x with
| Vernacexpr.AssumExpr ((loc, Name id), _) -> Dumpglob.dump_definition (loc,id) false "proj"
| _ -> ()) cfs);
- ignore(Record.definition_structure (k,cum,poly,finite,struc,binders,cfs,const,sort))
+ ignore(Record.definition_structure (k,is_cumulative,poly,finite,struc,binders,cfs,const,sort))
(** When [poly] is true the type is declared polymorphic. When [lo] is true,
then the type is declared private (as per the [Private] keyword). [finite]
indicates whether the type is inductive, co-inductive or
neither. *)
let vernac_inductive cum poly lo finite indl =
+ let is_cumulative = should_treat_as_cumulative cum poly in
if Dumpglob.dump () then
List.iter (fun (((coe,(lid,_)), _, _, _, cstrs), _) ->
match cstrs with
@@ -576,7 +591,7 @@ let vernac_inductive cum poly lo finite indl =
| _ -> user_err Pp.(str "Cannot handle mutually (co)inductive records.")
in
let indl = List.map unpack indl in
- do_mutual_inductive indl cum poly lo finite
+ do_mutual_inductive indl is_cumulative poly lo finite
let vernac_fixpoint locality poly local l =
let local = enforce_locality_exp locality local in
@@ -1363,10 +1378,10 @@ let _ =
let _ =
declare_bool_option
{ optdepr = false;
- optname = "inductive cumulativity";
- optkey = ["Inductive"; "Cumulativity"];
- optread = Flags.is_inductive_cumulativity;
- optwrite = Flags.make_inductive_cumulativity }
+ optname = "Polymorphic inductive cumulativity";
+ optkey = ["Polymorphic"; "Inductive"; "Cumulativity"];
+ optread = Flags.is_polymorphic_inductive_cumulativity;
+ optwrite = Flags.make_polymorphic_inductive_cumulativity }
let _ =
declare_int_option
@@ -2120,7 +2135,7 @@ let locate_if_not_already ?loc (e, info) =
| Some l -> (e, info)
exception HasNotFailed
-exception HasFailed of std_ppcmds
+exception HasFailed of Pp.t
let with_fail b f =
if not b then f ()