emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/proof-general 0e51f5af9a 06/25: Merge remote-tracking bran


From: ELPA Syncer
Subject: [nongnu] elpa/proof-general 0e51f5af9a 06/25: Merge remote-tracking branch 'origin/master' into qrhl-tool
Date: Mon, 28 Feb 2022 07:58:43 -0500 (EST)

branch: elpa/proof-general
commit 0e51f5af9a3efb255cc9c07bedfe4cce3c872e3d
Merge: 57a9d9ea91 a61a1d8e5f
Author: Dominique Unruh <unruh@ut.ee>
Commit: Dominique Unruh <unruh@ut.ee>

    Merge remote-tracking branch 'origin/master' into qrhl-tool
    
    # Conflicts:
    #       generic/proof-site.el
---
 .github/workflows/test.yml                         |  117 +-
 .gitignore                                         |    4 +-
 AUTHORS                                            |   30 +
 BUGS                                               |   25 +-
 CHANGES                                            |   62 +-
 COMPATIBILITY                                      |   40 +-
 COPYING                                            |  912 ++++---
 FAQ.md                                             |   16 +-
 INSTALL                                            |   14 +-
 Makefile                                           |   87 +-
 Makefile.devel                                     |    2 +-
 README.md                                          |   29 +-
 REGISTER                                           |   12 -
 acl2/README                                        |   22 -
 acl2/acl2.el                                       |  106 -
 acl2/example.acl2                                  |    9 -
 acl2/root2.acl2                                    |  348 ---
 ccc/README                                         |   14 -
 ccc/ccc.el                                         |   85 -
 ci/compile-tests/001-mini-project/Makefile         |    2 +-
 ci/compile-tests/001-mini-project/a.v              |    2 +-
 ci/compile-tests/001-mini-project/b.v              |    2 +-
 ci/compile-tests/001-mini-project/c.v              |    2 +-
 ci/compile-tests/001-mini-project/d.v              |    2 +-
 ci/compile-tests/001-mini-project/e.v              |    2 +-
 ci/compile-tests/001-mini-project/f.v              |    2 +-
 ci/compile-tests/001-mini-project/runtest.el       |    7 +-
 .../002-require-no-dependencies/Makefile           |    2 +-
 ci/compile-tests/002-require-no-dependencies/a.v   |    2 +-
 ci/compile-tests/002-require-no-dependencies/b.v   |    2 +-
 ci/compile-tests/002-require-no-dependencies/c.v   |    2 +-
 .../002-require-no-dependencies/runtest.el         |    6 +-
 ci/compile-tests/003-require-error/Makefile        |    2 +-
 ci/compile-tests/003-require-error/a.v             |    2 +-
 ci/compile-tests/003-require-error/b.v             |    2 +-
 ci/compile-tests/003-require-error/c.v             |    2 +-
 ci/compile-tests/003-require-error/runtest.el      |    6 +-
 ci/compile-tests/004-dependency-cycle/Makefile     |    2 +-
 ci/compile-tests/004-dependency-cycle/a.v          |    2 +-
 ci/compile-tests/004-dependency-cycle/b.v          |    2 +-
 ci/compile-tests/004-dependency-cycle/c.v          |    2 +-
 ci/compile-tests/004-dependency-cycle/d.v          |    2 +-
 ci/compile-tests/004-dependency-cycle/e.v          |    2 +-
 ci/compile-tests/004-dependency-cycle/f.v          |    2 +-
 ci/compile-tests/004-dependency-cycle/runtest.el   |    6 +-
 ci/compile-tests/005-change-recompile/Makefile     |    2 +-
 ci/compile-tests/005-change-recompile/a.v.orig     |    2 +-
 ci/compile-tests/005-change-recompile/b.v.orig     |    2 +-
 ci/compile-tests/005-change-recompile/c.v.orig     |    2 +-
 ci/compile-tests/005-change-recompile/d.v.orig     |    2 +-
 ci/compile-tests/005-change-recompile/e.v.orig     |    2 +-
 ci/compile-tests/005-change-recompile/f.v.orig     |    2 +-
 ci/compile-tests/005-change-recompile/g.v.orig     |    2 +-
 ci/compile-tests/005-change-recompile/h.v.orig     |    2 +-
 ci/compile-tests/005-change-recompile/runtest.el   |    8 +-
 ci/compile-tests/006-ready-dependee/Makefile       |    2 +-
 ci/compile-tests/006-ready-dependee/a.v.orig       |    2 +-
 ci/compile-tests/006-ready-dependee/b.v.orig       |    2 +-
 ci/compile-tests/006-ready-dependee/c.v.orig       |    2 +-
 ci/compile-tests/006-ready-dependee/d.v.orig       |    2 +-
 ci/compile-tests/006-ready-dependee/e.v.orig       |    2 +-
 ci/compile-tests/006-ready-dependee/f.v.orig       |    2 +-
 ci/compile-tests/006-ready-dependee/g.v.orig       |    2 +-
 ci/compile-tests/006-ready-dependee/h.v.orig       |    2 +-
 ci/compile-tests/006-ready-dependee/i.v.orig       |    2 +-
 ci/compile-tests/006-ready-dependee/j.v.orig       |    2 +-
 ci/compile-tests/006-ready-dependee/k.v.orig       |    2 +-
 ci/compile-tests/006-ready-dependee/runtest.el     |    8 +-
 ci/compile-tests/007-slow-require/Makefile         |    7 +-
 ci/compile-tests/007-slow-require/a1.v.orig        |    2 +-
 ci/compile-tests/007-slow-require/a2.v.orig        |    2 +-
 ci/compile-tests/007-slow-require/a3.v.orig        |    2 +-
 ci/compile-tests/007-slow-require/a4.v.orig        |    2 +-
 ci/compile-tests/007-slow-require/a5.v.orig        |    2 +-
 ci/compile-tests/007-slow-require/a6.v.orig        |    2 +-
 ci/compile-tests/007-slow-require/b1.v.orig        |    4 +-
 ci/compile-tests/007-slow-require/b2.v.orig        |    2 +-
 ci/compile-tests/007-slow-require/b3.v.orig        |    4 +-
 ci/compile-tests/007-slow-require/b4.v.orig        |    4 +-
 ci/compile-tests/007-slow-require/b5.v.orig        |    4 +-
 ci/compile-tests/007-slow-require/b6.v.orig        |    4 +-
 ci/compile-tests/007-slow-require/c1.v.orig        |    2 +-
 ci/compile-tests/007-slow-require/c2.v.orig        |    2 +-
 ci/compile-tests/007-slow-require/c3.v.orig        |    2 +-
 ci/compile-tests/007-slow-require/c4.v.orig        |    2 +-
 ci/compile-tests/007-slow-require/c5.v.orig        |    2 +-
 ci/compile-tests/007-slow-require/c6.v.orig        |    2 +-
 ci/compile-tests/007-slow-require/d1.v.orig        |    2 +-
 ci/compile-tests/007-slow-require/d2.v.orig        |    2 +-
 ci/compile-tests/007-slow-require/d3.v.orig        |    2 +-
 ci/compile-tests/007-slow-require/d4.v.orig        |    2 +-
 ci/compile-tests/007-slow-require/d5.v.orig        |    2 +-
 ci/compile-tests/007-slow-require/d6.v.orig        |    2 +-
 ci/compile-tests/007-slow-require/runtest.el       |   14 +-
 .../{007-slow-require => 008-default-dir}/Makefile |   15 +-
 .../a5.v.orig => 008-default-dir/a.v.orig}         |   19 +-
 .../b.v.orig                                       |    6 +-
 .../c.v.orig                                       |    6 +-
 ci/compile-tests/008-default-dir/runtest.el        |  143 ++
 ci/compile-tests/009-failure-processing/Makefile   |   44 +
 .../a1.v.orig                                      |   25 +-
 .../a10.v.orig}                                    |   27 +-
 .../a2.v.orig                                      |   23 +-
 .../a3.v.orig                                      |   25 +-
 .../a4.v.orig                                      |   23 +-
 .../a5.v.orig                                      |   23 +-
 .../a6.v.orig                                      |   23 +-
 .../a5.v.orig => 009-failure-processing/a7.v.orig} |   27 +-
 .../a5.v.orig => 009-failure-processing/a8.v.orig} |   27 +-
 .../a5.v.orig => 009-failure-processing/a9.v.orig} |   27 +-
 .../d4.v.orig => 009-failure-processing/b1.v.orig} |    7 +-
 .../b10.v.orig}                                    |    9 +-
 .../d1.v.orig => 009-failure-processing/b2.v.orig} |    9 +-
 .../d1.v.orig => 009-failure-processing/b3.v.orig} |    9 +-
 .../d1.v.orig => 009-failure-processing/b4.v.orig} |    7 +-
 .../d1.v.orig => 009-failure-processing/b5.v.orig} |    9 +-
 .../d4.v.orig => 009-failure-processing/b6.v.orig} |    7 +-
 .../d1.v.orig => 009-failure-processing/b7.v.orig} |    9 +-
 .../d1.v.orig => 009-failure-processing/b8.v.orig} |    9 +-
 .../d1.v.orig => 009-failure-processing/b9.v.orig} |    7 +-
 .../d4.v.orig => 009-failure-processing/c1.v.orig} |    9 +-
 .../c10.v.orig}                                    |    9 +-
 .../d1.v.orig => 009-failure-processing/c2.v.orig} |    9 +-
 .../d4.v.orig => 009-failure-processing/c3.v.orig} |    9 +-
 .../d4.v.orig => 009-failure-processing/c4.v.orig} |    9 +-
 .../d4.v.orig => 009-failure-processing/c5.v.orig} |    9 +-
 .../d1.v.orig => 009-failure-processing/c6.v.orig} |    9 +-
 .../d1.v.orig => 009-failure-processing/c7.v.orig} |    9 +-
 .../d1.v.orig => 009-failure-processing/c8.v.orig} |    9 +-
 .../d1.v.orig => 009-failure-processing/c9.v.orig} |    9 +-
 .../d1.v.orig                                      |    9 +-
 .../d10.v.orig}                                    |    7 +-
 .../d2.v.orig                                      |    9 +-
 .../d3.v.orig                                      |    9 +-
 .../d4.v.orig                                      |    7 +-
 .../d1.v.orig => 009-failure-processing/d5.v.orig} |    7 +-
 .../d1.v.orig => 009-failure-processing/d6.v.orig} |    9 +-
 .../d1.v.orig => 009-failure-processing/d7.v.orig} |    9 +-
 .../d1.v.orig => 009-failure-processing/d8.v.orig} |    9 +-
 .../d1.v.orig => 009-failure-processing/d9.v.orig} |    7 +-
 .../d1.v.orig => 009-failure-processing/e1.v.orig} |    7 +-
 .../e10.v.orig}                                    |    8 +-
 .../d1.v.orig => 009-failure-processing/e2.v.orig} |    7 +-
 .../d1.v.orig => 009-failure-processing/e3.v.orig} |    7 +-
 .../d1.v.orig => 009-failure-processing/e4.v.orig} |    7 +-
 .../d1.v.orig => 009-failure-processing/e5.v.orig} |    8 +-
 .../d1.v.orig => 009-failure-processing/e6.v.orig} |    7 +-
 .../d1.v.orig => 009-failure-processing/e7.v.orig} |    7 +-
 .../d1.v.orig => 009-failure-processing/e8.v.orig} |    7 +-
 .../d1.v.orig => 009-failure-processing/e9.v.orig} |    7 +-
 .../d1.v.orig => 009-failure-processing/f1.v.orig} |    7 +-
 .../f10.v.orig}                                    |    7 +-
 .../d1.v.orig => 009-failure-processing/f2.v.orig} |    7 +-
 .../d1.v.orig => 009-failure-processing/f3.v.orig} |    7 +-
 .../d1.v.orig => 009-failure-processing/f4.v.orig} |    7 +-
 .../d1.v.orig => 009-failure-processing/f5.v.orig} |    7 +-
 .../d1.v.orig => 009-failure-processing/f6.v.orig} |    7 +-
 .../d1.v.orig => 009-failure-processing/f7.v.orig} |    7 +-
 .../d1.v.orig => 009-failure-processing/f8.v.orig} |    7 +-
 .../d1.v.orig => 009-failure-processing/f9.v.orig} |    7 +-
 .../d6.v.orig => 009-failure-processing/g1.v.orig} |   12 +-
 .../g10.v.orig}                                    |    9 +-
 .../d6.v.orig => 009-failure-processing/g2.v.orig} |   12 +-
 .../d6.v.orig => 009-failure-processing/g3.v.orig} |   12 +-
 .../d6.v.orig => 009-failure-processing/g4.v.orig} |   12 +-
 .../d6.v.orig => 009-failure-processing/g5.v.orig} |   12 +-
 .../d1.v.orig => 009-failure-processing/g6.v.orig} |    9 +-
 .../d1.v.orig => 009-failure-processing/g7.v.orig} |    7 +-
 .../d1.v.orig => 009-failure-processing/g8.v.orig} |    7 +-
 .../d1.v.orig => 009-failure-processing/g9.v.orig} |    9 +-
 .../d1.v.orig => 009-failure-processing/h1.v.orig} |    7 +-
 .../h10.v.orig}                                    |    7 +-
 .../d1.v.orig => 009-failure-processing/h2.v.orig} |    7 +-
 .../d1.v.orig => 009-failure-processing/h3.v.orig} |    7 +-
 .../d1.v.orig => 009-failure-processing/h4.v.orig} |    7 +-
 .../d1.v.orig => 009-failure-processing/h5.v.orig} |    7 +-
 .../d1.v.orig => 009-failure-processing/h6.v.orig} |    7 +-
 .../d1.v.orig => 009-failure-processing/h7.v.orig} |    7 +-
 .../d1.v.orig => 009-failure-processing/h8.v.orig} |    7 +-
 .../d1.v.orig => 009-failure-processing/h9.v.orig} |    7 +-
 ci/compile-tests/009-failure-processing/runtest.el |  142 ++
 ci/compile-tests/Makefile                          |    2 +-
 ci/compile-tests/README.md                         |   41 +-
 ci/compile-tests/bin/compile-test-start-delayed    |   46 +-
 ci/compile-tests/bin/coqc-delayed                  |    2 +-
 ci/compile-tests/bin/coqdep-delayed                |    2 +-
 ci/compile-tests/cct-lib.el                        |   85 +-
 ci/coq-tests.el                                    |   44 +-
 ci/simple-tests/.gitignore                         |    1 +
 ci/simple-tests/Makefile                           |   23 +
 ci/simple-tests/README.md                          |   23 +
 ci/simple-tests/omit_test.v                        |   25 +
 .../test-coq-par-job-needs-compilation-quick.el    |  179 +-
 ci/simple-tests/test-coqtop-unavailable.el         |   24 +
 ci/simple-tests/test-omit-proofs.el                |  154 ++
 ci/simple-tests/test-prelude-correct.el            |   92 +
 ci/test-indent/.gitignore                          |    1 +
 ci/test-indent/Makefile                            |   22 +
 ci/test-indent/coq-test-indent.el                  |   96 +
 ci/test-indent/coq-test-indent.sh                  |   43 +
 ci/test-indent/indent-commands-boxed.v             |  268 ++
 ci/test-indent/indent-commands.v                   |  265 ++
 ci/test-indent/indent-equations.v                  |   79 +
 ci/test-indent/indent-inside-command-boxed.v       |  104 +
 ci/test-indent/indent-inside-command.v             |   93 +
 ci/test-indent/indent-monadic.v                    |   44 +
 ci/test-indent/indent-tac-boxed.v                  |  164 ++
 coq/ex/indent.v => ci/test-indent/indent-tac.v     |  454 ++--
 ci/test-indent/tests.sh                            |    9 +
 ci/test_stepwise.v                                 |   16 +
 coq/coq-abbrev.el                                  |   14 +-
 coq/coq-compile-common.el                          |  202 +-
 coq/coq-db.el                                      |   31 +-
 coq/coq-diffs.el                                   |    4 +-
 coq/coq-indent.el                                  |   51 +-
 coq/coq-mode.el                                    |   17 +-
 coq/coq-par-compile.el                             |  940 ++++---
 coq/coq-seq-compile.el                             |   82 +-
 coq/coq-smie.el                                    |  640 ++---
 coq/coq-syntax.el                                  |  110 +-
 coq/coq-system.el                                  |   46 +-
 coq/coq-unicode-tokens.el                          |   10 +-
 coq/coq.el                                         |  477 ++--
 coq/ex/indent.v                                    |    5 +
 doc/PG-adapting.texi                               |  295 ++-
 doc/ProofGeneral.texi                              | 1060 +++-----
 doc/docstring-magic.el                             |   20 +-
 doc/proofgeneral.1                                 |    4 +-
 etc/ProofGeneral.spec                              |    4 +-
 etc/README                                         |    3 -
 etc/hol-light/example4.ml                          |   13 -
 etc/isar/AHundredProofs.thy                        | 1009 --------
 etc/isar/AHundredTheorems.thy                      |  117 -
 etc/isar/AThousandComments.thy                     | 1005 --------
 etc/isar/AThousandTheorems.thy                     | 1013 --------
 etc/isar/BackslashInStrings.thy                    |   47 -
 etc/isar/BigErrors.thy                             |   20 -
 etc/isar/BigErrorsNested.thy                       |    6 -
 etc/isar/ChosenLogic.thy                           |    8 -
 etc/isar/ChosenLogic2.thy                          |    8 -
 etc/isar/CommentParsingBug.thy                     |    3 -
 etc/isar/CommentParsingBug2.thy                    |    8 -
 etc/isar/Depends.thy                               |   14 -
 etc/isar/EmptyCommands.thy                         |   10 -
 etc/isar/FaultyErrors.thy                          |   28 -
 etc/isar/Fibonacci.thy                             |  168 --
 etc/isar/HighlightSize.thy                         |   13 -
 etc/isar/IllegalEscape.thy                         |    7 -
 etc/isar/InterruptTest.thy.gz                      |  Bin 3914 -> 0 bytes
 etc/isar/MultipleModes.thy                         |   27 -
 etc/isar/NamesInStrings.thy                        |   34 -
 etc/isar/Parsing.thy                               |   75 -
 etc/isar/ParsingBug1.thy                           |   15 -
 etc/isar/Persistent.thy                            |   40 -
 etc/isar/README                                    |    8 -
 etc/isar/Sendback.thy                              |   23 -
 etc/isar/TextProps.thy                             |   22 -
 etc/isar/TokensAcid.thy                            |  218 --
 etc/isar/Trac189.thy                               |    8 -
 etc/isar/Trac280-subrev.thy                        |   14 -
 etc/isar/Unicode.thy                               |   73 -
 etc/isar/XEmacsSyntacticContextProb.thy            |   20 -
 etc/isar/XSymbolTests.thy                          |  146 --
 etc/isar/bad1.thy                                  |    3 -
 etc/isar/bad2.thy                                  |    1 -
 etc/isar/multiple/A.thy                            |    7 -
 etc/isar/multiple/B.thy                            |    4 -
 etc/isar/multiple/C.thy                            |    4 -
 etc/isar/multiple/D.thy                            |    4 -
 etc/isar/multiple/E.thy                            |    4 -
 etc/isar/multiple/README                           |    3 -
 etc/isar/nesting-too-deep-for-parser.txt           | 1622 ------------
 etc/isar/new-parsing-test.el                       |   38 -
 etc/isar/profiling.txt                             |  322 ---
 etc/isar/trace_simp.thy                            |   20 -
 etc/lego/GoalGoal.l                                |   13 -
 etc/lego/error-eg.l                                |   16 -
 etc/lego/lego-site.el                              |   37 -
 etc/lego/long-line-backslash.l                     |   22 -
 etc/lego/multiple/A.l                              |    1 -
 etc/lego/multiple/B.l                              |    4 -
 etc/lego/multiple/C.l                              |    1 -
 etc/lego/multiple/D.l                              |    1 -
 etc/lego/multiple/README                           |   33 -
 etc/lego/pbp.l                                     |   30 -
 etc/lego/unsaved-goals.l                           |   54 -
 generic/pg-assoc.el                                |    2 +-
 generic/pg-autotest.el                             |    2 +-
 generic/pg-custom.el                               |   12 +-
 generic/pg-goals.el                                |    2 +-
 generic/pg-movie.el                                |    2 +-
 generic/pg-pamacs.el                               |   46 +-
 generic/pg-pbrpm.el                                |   13 +-
 generic/pg-pgip.el                                 |    9 +-
 generic/pg-response.el                             |    6 +-
 generic/pg-user.el                                 |   58 +-
 generic/pg-vars.el                                 |    2 +-
 generic/pg-xml.el                                  |    2 +-
 generic/proof-autoloads.el                         |  126 +-
 generic/proof-auxmodes.el                          |    2 +-
 generic/proof-config.el                            |  149 +-
 generic/proof-depends.el                           |   29 +-
 generic/proof-easy-config.el                       |    2 +-
 generic/proof-faces.el                             |    9 +-
 generic/proof-indent.el                            |    2 +-
 generic/proof-maths-menu.el                        |    2 +-
 generic/proof-menu.el                              |   24 +-
 generic/proof-script.el                            |  262 +-
 generic/proof-shell.el                             |   81 +-
 generic/proof-site.el                              |   48 +-
 generic/proof-splash.el                            |   29 +-
 generic/proof-syntax.el                            |    2 +-
 generic/proof-toolbar.el                           |    2 +-
 generic/proof-tree.el                              |   32 +-
 generic/proof-unicode-tokens.el                    |    5 +-
 generic/proof-useropts.el                          |   23 +-
 generic/proof-utils.el                             |   23 +-
 generic/proof.el                                   |    2 +-
 hol-light/LICENSE-HOL-LIGHT                        |   29 -
 hol-light/README                                   |   45 -
 hol-light/TODO                                     |   17 -
 hol-light/TacticRecording/INSTRUCTIONS             |   36 -
 hol-light/TacticRecording/LIMITATIONS              |   18 -
 hol-light/TacticRecording/biolayout.ml             |   30 -
 hol-light/TacticRecording/dltree.ml                |  268 --
 hol-light/TacticRecording/dltree.mli               |   22 -
 hol-light/TacticRecording/ex.dot                   |   24 -
 hol-light/TacticRecording/ex2.dot                  |   13 -
 hol-light/TacticRecording/ex3.dot                  |   24 -
 hol-light/TacticRecording/ex3.png                  |  Bin 39644 -> 0 bytes
 hol-light/TacticRecording/ex3b.dot                 |   37 -
 hol-light/TacticRecording/examples1.ml             |   64 -
 hol-light/TacticRecording/examples1_output.txt     |   72 -
 hol-light/TacticRecording/examples2.ml             |   45 -
 hol-light/TacticRecording/examples3.ml             |  236 --
 hol-light/TacticRecording/examples3_LEMMA1.dot     |   24 -
 hol-light/TacticRecording/examples3_output.txt     |   36 -
 hol-light/TacticRecording/examples4.ml             |   13 -
 hol-light/TacticRecording/examples5.ml             |  182 --
 hol-light/TacticRecording/gvexport.ml              |   47 -
 hol-light/TacticRecording/hiproofs.ml              |  417 ---
 hol-light/TacticRecording/lib.ml                   |   91 -
 hol-light/TacticRecording/main.ml                  |   31 -
 hol-light/TacticRecording/mldata.ml                |   33 -
 hol-light/TacticRecording/mlexport.ml              |  186 --
 hol-light/TacticRecording/printutils.ml            |   61 -
 hol-light/TacticRecording/promote.ml               |  327 ---
 hol-light/TacticRecording/prooftree.ml             |  177 --
 hol-light/TacticRecording/tacticrec.ml             |  383 ---
 hol-light/TacticRecording/wrappers.ml              |  359 ---
 hol-light/TacticRecording/xtactics.ml              |  451 ----
 hol-light/TacticRecording/xthm.ml                  |   40 -
 hol-light/example.ml                               |   19 -
 hol-light/hol-light-autotest.el                    |   42 -
 hol-light/hol-light-unicode-tokens.el              |  252 --
 hol-light/hol-light.el                             |  519 ----
 hol-light/pg_prompt.ml                             |   59 -
 hol-light/pg_tactics.ml                            |  349 ---
 hol-light/temp-prooftree-configure.patch           |   25 -
 hol98/README                                       |   53 -
 hol98/example.sml                                  |   30 -
 hol98/hol98.el                                     |  170 --
 hol98/root2.sml                                    |   83 -
 isar/Example-Tokens.thy                            |   37 -
 isar/Example.thy                                   |   33 -
 isar/README                                        |   33 -
 isar/ex/Knaster_Tarski.thy                         |  110 -
 isar/ex/PER.thy                                    |  269 --
 isar/ex/README                                     |    8 -
 isar/ex/Sqrt.thy                                   |   90 -
 isar/ex/Sqrt_Script.thy                            |   70 -
 isar/ex/Tarski.thy                                 |  927 -------
 isar/interface                                     |  205 --
 isar/interface-setup.el                            |   40 -
 isar/isabelle-system.el                            |  375 ---
 isar/isar-autotest.el                              |  117 -
 isar/isar-find-theorems.el                         |  489 ----
 isar/isar-keywords.el                              |  655 -----
 isar/isar-profiling.el                             |   58 -
 isar/isar-syntax.el                                |  612 -----
 isar/isar-unicode-tokens.el                        |  691 -----
 isar/isar.el                                       |  645 -----
 isar/isartags                                      |   86 -
 lego/BUGS                                          |   53 -
 lego/README                                        |   37 -
 lego/example.l                                     |   15 -
 lego/example2.l                                    |    1 -
 lego/lego-syntax.el                                |  131 -
 lego/lego.el                                       |  439 ----
 lego/legotags                                      |   91 -
 lego/root2.l                                       |  368 ---
 lib/bufhist.el                                     |   44 +-
 lib/holes.el                                       |   29 +-
 lib/local-vars-list.el                             |   16 +-
 lib/maths-menu.el                                  |   14 +-
 lib/pg-dev.el                                      |   10 +-
 lib/pg-fontsets.el                                 |    2 +-
 lib/proof-compat.el                                |    2 +-
 lib/scomint.el                                     |    2 +-
 lib/span.el                                        |    9 +-
 lib/texi-docstring-magic.el                        |  130 +-
 lib/unicode-tokens.el                              |  165 +-
 obsolete/demoisa/demoisa.el                        |    2 +-
 obsolete/lclam/README                              |   15 -
 obsolete/lclam/example.lcm                         |   34 -
 obsolete/lclam/lclam.el                            |  209 --
 obsolete/plastic/README                            |   12 -
 obsolete/plastic/plastic-syntax.el                 |  119 -
 obsolete/plastic/plastic.el                        |  665 -----
 obsolete/plastic/test.lf                           |   64 -
 proof-general-pkg.el                               |    3 -
 proof-general.el                                   |   21 +-
 twelf/README                                       |   27 -
 twelf/example.elf                                  |   64 -
 twelf/twelf-font.el                                |  444 ----
 twelf/twelf-old.el                                 | 2660 --------------------
 twelf/twelf.el                                     |  209 --
 417 files changed, 6719 insertions(+), 27598 deletions(-)

diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 15c8d3c78c..826ed743af 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -17,15 +17,13 @@ jobs:
     strategy:
       matrix:
         emacs_version:
-          - 24.3
-          - 24.4
-          - 24.5
           - 25.1
           - 25.2
           - 25.3
           - 26.1
           - 26.2
           - 26.3
+          - 27.1
       # at most 20 concurrent jobs per free account
       # cf. 
https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#usage-limit
       max-parallel: 4
@@ -41,10 +39,42 @@ jobs:
 
     - run: emacs --version
     - run: make
+    # Erik: Extend this with linting?
     - name: Install makeinfo
       run: sudo apt-get update -y -q && sudo DEBIAN_FRONTEND=noninteractive 
apt-get install -y -q --no-install-recommends texinfo
     - run: make doc.info
 
+  # Check that the texinfo sources of the manual can be updated
+  # with the documentation strings for variables and functions in
+  # the source code and that the manual is actually up-to-date.
+  # If the final git diff fails, then somebody forgot to update
+  # the manuals with ``make -C doc magic'' after changing a
+  # variable or function documentation that appears in one of the
+  # manuals.
+  check-doc-magic:
+    runs-on: ubuntu-latest
+
+    strategy:
+      matrix:
+        emacs_version:
+          # I don't think we need to check with all emacs
+          # versions. The latest two should be enough, maybe even
+          # only the latest one.
+          - 26.3
+          - 27.1
+      fail-fast: false
+
+    steps:
+    - uses: actions/checkout@v2
+
+    - uses: purcell/setup-emacs@master
+      with:
+        version: ${{ matrix.emacs_version }}
+
+    - run: emacs --version
+    - run: make -C doc magic
+    - run: git diff --exit-code -- doc
+      
   test:
     runs-on: ubuntu-latest
 
@@ -61,6 +91,8 @@ jobs:
           - '8.9'
           - '8.10'
           - '8.11'
+          - '8.12'
+          - '8.13'
         ocaml_version:
           - minimal
       # at most 20 concurrent jobs per free account
@@ -91,7 +123,7 @@ jobs:
           endGroup
           startGroup Run tests
             sudo chown -R coq:coq ./ci
-            ./ci/test.sh
+            make tests
           endGroup
 
   # - run: echo "::remove-matcher owner=ert-problem-matcher::"
@@ -100,6 +132,7 @@ jobs:
     runs-on: ubuntu-latest
 
     strategy:
+      # change to selected versions of coq-emacs docker containers
       matrix:
         coq_version:
           - '8.9'
@@ -143,3 +176,79 @@ jobs:
             sudo chown -R coq:coq ./ci
             make -C ci/compile-tests test
           endGroup
+
+  simple-tests:
+    runs-on: ubuntu-latest
+
+    strategy:
+      # change to selected versions of coq-emacs docker containers
+      matrix:
+        coq_version:
+          - '8.9'
+          - '8.10'
+          - '8.11'
+        ocaml_version:
+          - minimal
+      max-parallel: 6
+      # don't cancel all in-progress jobs if one matrix job fails:
+      fail-fast: false
+
+    steps:
+    - uses: actions/checkout@v2
+
+    - name: Add ert problem matcher
+      run: echo "::add-matcher::.github/ert.json"
+      
+    - uses: coq-community/docker-coq-action@v1
+      id: docker-coq-action
+      with:
+        opam_file: 'dummy.opam'
+        coq_version: ${{ matrix.coq_version }}
+        ocaml_version: ${{ matrix.ocaml_version }}
+        custom_script: |
+          startGroup Print opam config
+            opam config list; opam repo list; opam list
+          endGroup
+          startGroup Install emacs
+            sudo apt-get update -y -q
+            sudo DEBIAN_FRONTEND=noninteractive apt-get install -y -q 
--no-install-recommends emacs
+          endGroup
+          startGroup other relevant configuration
+            getconf _NPROCESSORS_ONLN
+            emacs --version
+            coqc --version
+            ocaml --version
+          endGroup
+          startGroup Run tests
+            sudo chown -R coq:coq ./ci
+            make -C ci/simple-tests all
+          endGroup
+
+  # Run indentation tests in ci/test-indent on all supported emacs
+  # versions without coq installed.
+  test-indent:
+    runs-on: ubuntu-latest
+
+    strategy:
+      matrix:
+        emacs_version:
+          - 25.1
+          - 25.2
+          - 25.3
+          - 26.1
+          - 26.2
+          - 26.3
+          - 27.1
+      max-parallel: 4
+      # don't cancel all in-progress jobs if one matrix job fails:
+      fail-fast: false
+
+    steps:
+    - uses: actions/checkout@v2
+
+    - uses: purcell/setup-emacs@master
+      with:
+        version: ${{ matrix.emacs_version }}
+
+    - run: emacs --version
+    - run: make -C ci/test-indent
diff --git a/.gitignore b/.gitignore
index 2039757e64..7bd11a20f3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,8 @@
 nohup.out
 TAGS
 ChangeLog
-proof-general-autoloads.el
+/proof-general-autoloads.el
+/proof-general-pkg.el
 *.elc
 *~
+/ci/.lia.cache
diff --git a/AUTHORS b/AUTHORS
index 58978d23e5..eac073ab95 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -26,3 +26,33 @@ These are the main "official" authors of Proof General, but 
many more
 people have contributed, some very significantly.  We're grateful to
 everyone who has!  Please see the CREDITS section in the manual for a
 more complete list.
+
+====================================================================
+
+Notes regarding the License change to GPLv3+:
+
+Contributors who are positively known to be OK with relicensing:
+
+    Stefan Monnier
+    Clément Pit-Claudel
+    Paul Steckler
+    Erik Martin-Dorel
+    Pierre Courtieu
+    Jim Fehrle
+    stardiviner <numbchild@gmail.com>
+    Pierre-Yves Strub
+    Hendrik Tews
+    David Aspinall
+    Cyril Anaclet
+    Christophe Raffalli
+    Makarius Wenzel
+
+## New provers compared to PG-async: phox easycrypt pghaskell pgocaml pgshell
+
+Git history:
+
+    git log -- phox easycrypt pghaskell pgocaml pgshell |
+        grep 'Author:' | sort -u
+
+shows that these have only received contributions from people in the
+above list.
diff --git a/BUGS b/BUGS
index 92aef309bf..81db17fad3 100644
--- a/BUGS
+++ b/BUGS
@@ -2,9 +2,6 @@
 
 * Known Bugs and Workarounds for Proof General.
 
-For latest, see: http://proofgeneral.inf.ed.ac.uk/trac
-See also FAQ:    http://proofgeneral.inf.ed.ac.uk/FAQ
-
 The bugs here are split into problems which are generic,
 and those which only apply to particular provers.  
 
@@ -79,18 +76,6 @@ assistant.  Files ought to be coloured red while they are 
being
 processed, just as single lines are.  Workaround: be careful not to
 edit a file as it is being read by the proof assistant.
 
-* Problems with Isabelle
-
-** Issues with tracing mode 
-
-Large volumes of output can cause Emacs to hog CPU spending
-all its time processing the output (esp with fontifying and X-symbol
-decoding).   It becomes difficult to use normal editing commands,
-even C-c C-c to interrupt the prover.  Workaround: hitting C-g,
-the Emacs quit key, will interrupt the prover in this state.
-See manual for further description of this.
-
-
 * Problems with Coq
 
 ** Multiple file handling and auto-compilation is incomplete
@@ -100,12 +85,4 @@ See manual for further description of this.
 ** coqtags doesn't find all declarations. 
 
 It cannot handle lists e.g., with "Parameter x,y:nat" it only tags x
-but not y. [The same problem exists for legotags] Workaround: don't
-rely too much on the etags mechanism.
-
-
-* LEGO Proof General Bugs
-
-See lego/BUGS
-
-
+but not y. Workaround: don't rely too much on the etags mechanism.
diff --git a/CHANGES b/CHANGES
index 109fedfe59..e615731182 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,11 +2,27 @@
 
 This is a summary of main changes.  For details, please see
 the Git ChangeLog, the GitHub repo https://github.com/ProofGeneral/PG
-and the PG Trac http://proofgeneral.inf.ed.ac.uk/trac
 
 * Changes of Proof General 4.5 from Proof General 4.4
 
 ** Generic changes
+*** License changed to GPLv3+
+*** Remove support for the following systems:
+Twelf, CCC, Lego, Hol-Light, ACL2, Plastic, Lambda-Clam, Isabelle, HOL98.
+
+*** require GNU Emacs 25.1 or later
+
+The current policy aims at supporting multiple Emacs versions,
+including those available in distributions Debian Stable
+(https://packages.debian.org/stable/emacs) and Ubuntu LTS
+(https://packages.ubuntu.com/emacs), until their End-Of-Support (see
+also https://wiki.ubuntu.com/Releases).
+
+
+*** new command and menu item to easily upgrade all packages
+    - To upgrade all ELPA packages (including ProofGeneral if it was
+      installed via MELPA), do "M-x proof-upgrade-elpa-packages RET"
+      or use the "Proof-General > Upgrade ELPA packages..." menu item
 
 *** bug fixes
     - Using query-replace (or replace-string) in the processed region
@@ -27,9 +43,18 @@ and the PG Trac http://proofgeneral.inf.ed.ac.uk/trac
 
 ** Coq changes
 
+*** fix highlighting issues for ssr tactics ending with colon
+
+    Now, { exact: term. } will always be correctly highlighted.
+
+    However, only (forall {T: Type}, Type) will be highlighted,
+    unlike term (forall { T: Type }, Type) that has a spurious space.
+
+    Also in (forall [T: Type], Type), variable T is now highlighted.
+
 *** new menu Coq -> Auto Compilation for all background compilation options
 
-*** support for 8.11 vos compilation
+*** support for 8.11 vos and vok compilation
 
     See menu Coq -> Auto Compilation -> vos compilation, option
     coq-compile-vos and subsection "11.3.3 Quick and inconsistent
@@ -137,6 +162,26 @@ and the PG Trac http://proofgeneral.inf.ed.ac.uk/trac
     file contains "Require ... ssreflect" on the same line; otherwise
     PG inserts "intros ..." as before.
 
+*** Customizing Search Blacklist (command created and menu entry moved)
+    To change the list of blacklisted string for Search commands
+    during development, use now
+    coq-change-search-blacklist-interactive. The menu for this has
+    moved, it is now in Coq/Other Queries/Search Blacklist.
+
+    To change the default blacklist, set variable
+    coq-search-blacklist-string (unchanged).
+
+*** Proof General can omit complete opaque proofs
+    This speeds up asserting of larger chunks at the price of
+    letting errors in these proofs go unnoticed. Configure
+    `proof-omit-proofs-option' or select "Proof-General -> Quick
+    Options -> Processing -> Omit Proofs". See also section
+    "11.5 Omitting proofs for speed" in the manual.
+
+    Beware that if lemmas are proved in a section, these lemmas should
+    start with a "Proof using" annotation, otherwise Coq would compute
+    a wrong type for them when this omitting-proofs feature is enabled.
+
 *** bug fixes
     - avoid leaving partial files behind when compilation fails
     - 123: Parallel background compliation fails to execute some
@@ -150,14 +195,23 @@ and the PG Trac http://proofgeneral.inf.ed.ac.uk/trac
     - 92: Compile before require from current directory failing
       with 8.5
 
+*** indentation code refactored
+
+    A big refactoring of the code for indentation has been done. You
+    may experience a few changes in indentation results. Mostly small
+    shifts to the right.
+
+    Variable `coq-indent-box-style' only affects indentation after
+    quantifiers (used to affect script braces "{").
+
+
 * Changes of Proof General 4.4 from Proof General 4.3
 
 ** ProofGeneral has moved to GitHub!
 
    https://github.com/ProofGeneral/PG
 
-   Please submit new bugs there, old bugs may stay in good old PG trac
-   for a while though: http://proofgeneral.inf.ed.ac.uk/trac
+   Please submit new bugs there.
 
 ** Coq changes
 
diff --git a/COMPATIBILITY b/COMPATIBILITY
index e2345a9962..3bf33b3801 100644
--- a/COMPATIBILITY
+++ b/COMPATIBILITY
@@ -4,12 +4,13 @@ Compatibility of Proof General
 This version of Proof General has been tested with these Emacs versions
 on recent Linux systems:
 
- Emacs 24.5          -- recommended and supported
- Emacs 24.3, 24.4    -- previous versions, should work
- Emacs 25 (dev)      -- next version, should work
- Emacs 23.2, earlier -- obsolete versions, do NOT work
+ Emacs 25.1          -- minimal supported version
+ Emacs 24.5, earlier -- previous versions, do NOT work
 
-and (main) prover versions:  Coq 8.4, Coq 8.5
+and (main) prover versions:
+
+  Coq 8.9, 8.10, 8.11, 8.12, 8.13 -- tested versions in PG's CI
+  Coq 8.4, 8.5, 8.6, 8.7, 8.8     -- previous versions, should work
 
 See below for notes about other operating systems.
 
@@ -18,14 +19,10 @@ In the major 4.0 release ** XEmacs compatibility was 
dropped **
 Running on macOS
 -------------------
 
-For tips, please see here:
-
-   http://proofgeneral.inf.ed.ac.uk/wiki/PGEmacsOnMacOSX
-
-We recommend the 24.5 build of GNU Emacs, which builds natively on macOS
-(based on the NextStep port).  Binaries are available at various
-websites (e.g., http://emacsformacosx.com), or you can build your own
-by compiling from the FSF CVS. See the Emacs Wiki at
+We recommend 24.5+ builds of GNU Emacs, which builds natively on
+macOS.  Binaries are available at various websites (e.g.,
+http://emacsformacosx.com), or you can build your own by compiling
+from the FSF CVS. See the Emacs Wiki at
 http://www.emacswiki.org/emacs/EmacsForMacOS for more.
 
 Note that macOS compatibility isn't thoroughly tested.  If you discover
@@ -36,19 +33,4 @@ add tips to the wiki page above.
 Running on Windows
 ------------------
 
-For tips, please see here:
-
-   http://proofgeneral.inf.ed.ac.uk/wiki/PGEmacsOnWindows
-
-Note that Windows compatibility isn't tested by the maintainers.  If
-you discover problems, please add notes on the Wiki page above, and
-submit patches to http://proofgeneral.inf.ed.ac.uk/trac
-
-
-
-
-
-
-
-
-
+Note that Windows compatibility isn't tested by the maintainers.  
diff --git a/COPYING b/COPYING
index d60c31a97a..f288702d2f 100644
--- a/COPYING
+++ b/COPYING
@@ -1,285 +1,626 @@
-                   GNU GENERAL PUBLIC LICENSE
-                      Version 2, June 1991
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
 
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
  Everyone is permitted to copy and distribute verbatim copies
  of this license document, but changing it is not allowed.
 
-                           Preamble
+                            Preamble
 
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users.  This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it.  (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.)  You can apply it to
+  The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  You can apply it to
 your programs, too.
 
   When we speak of free software, we are referring to freedom, not
 price.  Our General Public Licenses are designed to make sure that you
 have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
 
-  To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
+  To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights.  Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
 
   For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have.  You must make sure that they, too, receive or can get the
-source code.  And you must show them these terms so they know their
-rights.
-
-  We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
-  Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software.  If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
-  Finally, any free program is threatened constantly by software
-patents.  We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary.  To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  You must make sure that they, too, receive
+or can get the source code.  And you must show them these terms so they
+know their rights.
+
+  Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+  For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+  Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+  Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary.  To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
 
   The precise terms and conditions for copying, distribution and
 modification follow.
-
-                   GNU GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License.  The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language.  (Hereinafter, translation is included without limitation in
-the term "modification".)  Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
-  1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
-  2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) You must cause the modified files to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    b) You must cause any work that you distribute or publish, that in
-    whole or in part contains or is derived from the Program or any
-    part thereof, to be licensed as a whole at no charge to all third
-    parties under the terms of this License.
-
-    c) If the modified program normally reads commands interactively
-    when run, you must cause it, when started running for such
-    interactive use in the most ordinary way, to print or display an
-    announcement including an appropriate copyright notice and a
-    notice that there is no warranty (or else, saying that you provide
-    a warranty) and that users may redistribute the program under
-    these conditions, and telling the user how to view a copy of this
-    License.  (Exception: if the Program itself is interactive but
-    does not normally print such an announcement, your work based on
-    the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
-    a) Accompany it with the complete corresponding machine-readable
-    source code, which must be distributed under the terms of Sections
-    1 and 2 above on a medium customarily used for software interchange; or,
-
-    b) Accompany it with a written offer, valid for at least three
-    years, to give any third party, for a charge no more than your
-    cost of physically performing source distribution, a complete
-    machine-readable copy of the corresponding source code, to be
-    distributed under the terms of Sections 1 and 2 above on a medium
-    customarily used for software interchange; or,
-
-    c) Accompany it with the information you received as to the offer
-    to distribute corresponding source code.  (This alternative is
-    allowed only for noncommercial distribution and only if you
-    received the program in object code or executable form with such
-    an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it.  For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable.  However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-  4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License.  Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
-  5. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Program or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
-  6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
+
+                       TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+  A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+  To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy.  Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+  To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies.  Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+  An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License.  If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+  1. Source Code.
+
+  The "source code" for a work means the preferred form of the work
+for making modifications to it.  "Object code" means any non-source
+form of a work.
+
+  A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+  The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form.  A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+  The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities.  However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work.  For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+  The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+  The Corresponding Source for a work in source code form is that
+same work.
+
+  2. Basic Permissions.
+
+  All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met.  This License explicitly affirms your unlimited
+permission to run the unmodified Program.  The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work.  This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+  You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force.  You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright.  Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+  Conveying under any other circumstances is permitted solely under
+the conditions stated below.  Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+  No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+  When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+  4. Conveying Verbatim Copies.
+
+  You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+  You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+  5. Conveying Modified Source Versions.
+
+  You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+    a) The work must carry prominent notices stating that you modified
+    it, and giving a relevant date.
+
+    b) The work must carry prominent notices stating that it is
+    released under this License and any conditions added under section
+    7.  This requirement modifies the requirement in section 4 to
+    "keep intact all notices".
+
+    c) You must license the entire work, as a whole, under this
+    License to anyone who comes into possession of a copy.  This
+    License will therefore apply, along with any applicable section 7
+    additional terms, to the whole of the work, and all its parts,
+    regardless of how they are packaged.  This License gives no
+    permission to license the work in any other way, but it does not
+    invalidate such permission if you have separately received it.
+
+    d) If the work has interactive user interfaces, each must display
+    Appropriate Legal Notices; however, if the Program has interactive
+    interfaces that do not display Appropriate Legal Notices, your
+    work need not make them do so.
+
+  A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit.  Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+  6. Conveying Non-Source Forms.
+
+  You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+    a) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by the
+    Corresponding Source fixed on a durable physical medium
+    customarily used for software interchange.
+
+    b) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by a
+    written offer, valid for at least three years and valid for as
+    long as you offer spare parts or customer support for that product
+    model, to give anyone who possesses the object code either (1) a
+    copy of the Corresponding Source for all the software in the
+    product that is covered by this License, on a durable physical
+    medium customarily used for software interchange, for a price no
+    more than your reasonable cost of physically performing this
+    conveying of source, or (2) access to copy the
+    Corresponding Source from a network server at no charge.
+
+    c) Convey individual copies of the object code with a copy of the
+    written offer to provide the Corresponding Source.  This
+    alternative is allowed only occasionally and noncommercially, and
+    only if you received the object code with such an offer, in accord
+    with subsection 6b.
+
+    d) Convey the object code by offering access from a designated
+    place (gratis or for a charge), and offer equivalent access to the
+    Corresponding Source in the same way through the same place at no
+    further charge.  You need not require recipients to copy the
+    Corresponding Source along with the object code.  If the place to
+    copy the object code is a network server, the Corresponding Source
+    may be on a different server (operated by you or a third party)
+    that supports equivalent copying facilities, provided you maintain
+    clear directions next to the object code saying where to find the
+    Corresponding Source.  Regardless of what server hosts the
+    Corresponding Source, you remain obligated to ensure that it is
+    available for as long as needed to satisfy these requirements.
+
+    e) Convey the object code using peer-to-peer transmission, provided
+    you inform other peers where the object code and Corresponding
+    Source of the work are being offered to the general public at no
+    charge under subsection 6d.
+
+  A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+  A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling.  In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage.  For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product.  A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+  "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source.  The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+  If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information.  But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+  The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed.  Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+  Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+  7. Additional Terms.
+
+  "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law.  If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+  When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it.  (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.)  You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+  Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+    a) Disclaiming warranty or limiting liability differently from the
+    terms of sections 15 and 16 of this License; or
+
+    b) Requiring preservation of specified reasonable legal notices or
+    author attributions in that material or in the Appropriate Legal
+    Notices displayed by works containing it; or
+
+    c) Prohibiting misrepresentation of the origin of that material, or
+    requiring that modified versions of such material be marked in
+    reasonable ways as different from the original version; or
+
+    d) Limiting the use for publicity purposes of names of licensors or
+    authors of the material; or
+
+    e) Declining to grant rights under trademark law for use of some
+    trade names, trademarks, or service marks; or
+
+    f) Requiring indemnification of licensors and authors of that
+    material by anyone who conveys the material (or modified versions of
+    it) with contractual assumptions of liability to the recipient, for
+    any liability that these contractual assumptions directly impose on
+    those licensors and authors.
+
+  All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10.  If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term.  If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+  If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+  Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+  8. Termination.
+
+  You may not propagate or modify a covered work except as expressly
+provided under this License.  Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+  However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+  Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+  Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License.  If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+  9. Acceptance Not Required for Having Copies.
+
+  You are not required to accept this License in order to receive or
+run a copy of the Program.  Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance.  However,
+nothing other than this License grants you permission to propagate or
+modify any covered work.  These actions infringe copyright if you do
+not accept this License.  Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+  10. Automatic Licensing of Downstream Recipients.
+
+  Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License.  You are not responsible
+for enforcing compliance by third parties with this License.
+
+  An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations.  If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+  You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License.  For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+  11. Patents.
+
+  A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based.  The
+work thus licensed is called the contributor's "contributor version".
+
+  A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version.  For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
 this License.
 
-  7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
+  Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+  In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement).  To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+  If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients.  "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+  If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+  A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License.  You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+  Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+  12. No Surrender of Others' Freedom.
+
+  If conditions are imposed on you (whether by court order, agreement or
 otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-  8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded.  In such case, this License incorporates
-the limitation as if written in the body of this License.
-
-  9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time.  Such new versions will
+excuse you from the conditions of this License.  If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all.  For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+  13. Use with the GNU Affero General Public License.
+
+  Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work.  The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+  14. Revised Versions of this License.
+
+  The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time.  Such new versions will
 be similar in spirit to the present version, but may differ in detail to
 address new problems or concerns.
 
-Each version is given a distinguishing version number.  If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation.  If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
-  10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission.  For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this.  Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
-                           NO WARRANTY
-
-  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
-  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
-                    END OF TERMS AND CONDITIONS
-
-           How to Apply These Terms to Your New Programs
+  Each version is given a distinguishing version number.  If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation.  If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+  If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+  Later license versions may give you additional or different
+permissions.  However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+  15. Disclaimer of Warranty.
+
+  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. Limitation of Liability.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+  17. Interpretation of Sections 15 and 16.
+
+  If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
 
   If you develop a new program, and you want it to be of the greatest
 possible use to the public, the best way to achieve this is to make it
@@ -287,15 +628,15 @@ free software which everyone can redistribute and change 
under these terms.
 
   To do so, attach the following notices to the program.  It is safest
 to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
+state the exclusion of warranty; and each file should have at least
 the "copyright" line and a pointer to where the full notice is found.
 
     <one line to give the program's name and a brief idea of what it does.>
     Copyright (C) <year>  <name of author>
 
-    This program is free software; you can redistribute it and/or modify
+    This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
+    the Free Software Foundation, either version 3 of the License, or
     (at your option) any later version.
 
     This program is distributed in the hope that it will be useful,
@@ -304,37 +645,30 @@ the "copyright" line and a pointer to where the full 
notice is found.
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
+    along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
 Also add information on how to contact you by electronic and paper mail.
 
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
+  If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
 
-    Gnomovision version 69, Copyright (C) year  name of author
-    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    <program>  Copyright (C) <year>  <name of author>
+    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
     This is free software, and you are welcome to redistribute it
     under certain conditions; type `show c' for details.
 
 The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-  `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-  <signature of Ty Coon>, 1 April 1989
-  Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs.  If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library.  If this is what you want to do, use the GNU Library General
-Public License instead of this License.
+parts of the General Public License.  Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+  You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<https://www.gnu.org/licenses/>.
+
+  The GNU General Public License does not permit incorporating your program
+into proprietary programs.  If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.  But first, please read
+<https://www.gnu.org/licenses/why-not-lgpl.html>.
diff --git a/FAQ.md b/FAQ.md
index 3aeeffc5a5..6fc9bae981 100644
--- a/FAQ.md
+++ b/FAQ.md
@@ -95,7 +95,6 @@ A. Unfortunately this is a bug in the display engine inside
    of emacs, Emacs 23.3.1 on Ubuntu 11.10, suffers.
 
    The solution is to switch to another version (e.g. Emacs 23.2).
-   (See Trac#409: <http://proofgeneral.inf.ed.ac.uk/trac/ticket/409>)
 
    You may be able to get better results with different fonts, even
    without upgrading Emacs.
@@ -141,8 +140,7 @@ A. Please check the documentation carefully, particularly 
the
    If you still cannot solve your problem, try to contact someone
    else who is using Proof General with a similar setup.  The
    best way to do this may be through the user mailing list for your
-   proof assistant.  If you think the problem is Proof General related,
-   consult the PG Wiki and Trac pages.
+   proof assistant.
 
 -----------------------------------------------------------------
 
@@ -222,18 +220,6 @@ A. Coq has a limited history for Undo.  Change
 
 -----------------------------------------------------------------
 
-Q. Can I join any mailing lists for Proof General?
-
-A. Of course, email <proofgeneral-request@informatics.ed.ac.uk>
-   with the line "subscribe" in the message body, to join the
-   users' and announcements list.
-
-   There is also a list for developers, proofgeneral-devel:
-   <http://proofgeneral.inf.ed.ac.uk/mailinglist>
-   for more details.
-
------------------------------------------------------------------
-
 Q. Emacs appears to hang when the prover process is started.
 
 A. One thing is to check the variable `comint-process-echoes` which
diff --git a/INSTALL b/INSTALL
index 3b496bd72c..c89150c238 100644
--- a/INSTALL
+++ b/INSTALL
@@ -32,22 +32,14 @@ Proof General loaded.
 
 The command above will set the Emacs load path and add auto-loads for
 proof assistants, for example, visiting a file ending in .v will start
-Coq Proof General, and a file ending in .thy will start 
-Isabelle Proof General.  See the manual for a full list of file
+Coq Proof General, and a file ending in .ec will start 
+EasyCrypt Proof General.  See the manual for a full list of file
 extensions and proof assistants, and the note below for how to disable
 those you don't need.
 
 In case of difficulty, please check the documentation in doc/, the
 notes below, the README file for each prover, and the file BUGS.  
 
-If none of these files help, then contact me via the address below.
-
-   David Aspinall,
-   LFCS, School Of Informatics,
-   University of Edinburgh.
-   Edinburgh.
-   
-   http://proofgeneral.inf.ed.ac.uk/trac
 
 
 
@@ -148,7 +140,7 @@ Removing support for unwanted provers
 
 You cannot run more than one instance of Proof General at a time in
 the same Emacs process: e.g. if you're using Coq, you won't be able to
-run LEGO scripts.
+run EasyCrypt scripts.
 
 If there are some assistants supported that you never want to use, you
 can remove them from the variable `proof-assistants' to prevent Proof
diff --git a/Makefile b/Makefile
index 21aed373ad..e441e3d19b 100644
--- a/Makefile
+++ b/Makefile
@@ -9,6 +9,7 @@
 ##  make scripts       - edit paths to bash/perl/PGHOME in scripts
 ##  make install       - install into system directories
 ##  make clean         - return to clean source
+##  make tests         - run the suite of regression tests
 ##
 ## Edit the EMACS setting below or call with an explicit one, like this:
 ##
@@ -34,14 +35,15 @@ PREFIX=$(DESTDIR)/usr
 DEST_PREFIX=$(DESTDIR)/usr
 
 # subdirectories for provers: to be compiled and installed
-PROVERS=acl2 ccc coq easycrypt hol-light hol98 isar lego pghaskell pgocaml 
pgshell phox twelf
+PROVERS=coq easycrypt pghaskell pgocaml pgshell phox
 
 # generic lisp code: to be compiled and installed
 OTHER_ELISP=generic lib
 
 # additional lisp code: to be compiled but not installed
-ADDITIONAL_ELISP:=ci/compile-tests \
-               $(wildcard ci/compile-tests/[0-9][0-9][0-9]-*)
+ADDITIONAL_ELISP:=ci/compile-tests                            \
+               $(wildcard ci/compile-tests/[0-9][0-9][0-9]-*) \
+               ci/simple-tests
 
 # directories with lisp code to be installed
 ELISP_DIRS_INST=${PROVERS} ${OTHER_ELISP}
@@ -55,25 +57,24 @@ ELISP_EXTRAS=
 # to be installed
 EXTRA_DIRS = images
 
-DOC_FILES=AUTHORS BUGS COMPATIBILITY CHANGES COPYING INSTALL README REGISTER 
doc/*.pdf
-DOC_EXAMPLES=acl2/*.acl2 hol98/*.sml isar/*.thy lclam/*.lcm lego/*.l 
pgshell/*.pgsh phox/*.phx plastic/*.lf twelf/*.elf
+DOC_FILES=AUTHORS BUGS COMPATIBILITY CHANGES COPYING INSTALL README doc/*.pdf
+DOC_EXAMPLES=pgshell/*.pgsh phox/*.phx
 DOC_SUBDIRS=${DOC_EXAMPLES} */README* */CHANGES */BUGS 
 
 BATCHEMACS=${EMACS} --batch --no-site-file -q 
 
 # Scripts to edit paths to shells
-BASH_SCRIPTS = isar/interface
-PERL_SCRIPTS = lego/legotags coq/coqtags isar/isartags
+PERL_SCRIPTS = coq/coqtags
 
 # Scripts to install to bin directory
-BIN_SCRIPTS = lego/legotags coq/coqtags isar/isartags
+BIN_SCRIPTS = coq/coqtags
 
 # Setting load path might be better in Elisp, but seems tricky to do
 # only during compilation.  Another idea: put a function in proof-site
 # to output the compile-time load path and ELISP_DIRS_COMP so these are set
 # just in that one place.
 ERROR_ON_WARN = nil
-BYTECOMP = $(BATCHEMACS) -eval '(setq load-path (append (mapcar (lambda (d) 
(expand-file-name (symbol-name d))) (quote (${ELISP_DIRS_COMP}))) load-path))' 
-eval '(progn (require (quote bytecomp)) (require (quote mouse)) (require 
(quote tool-bar)) (require (quote fontset)) (setq byte-compile-warnings (remove 
(quote cl-functions) (remove (quote noruntime) byte-compile-warning-types))) 
(setq byte-compile-error-on-warn $(ERROR_ON_WARN)))' -f batch-byte-compile
+BYTECOMP = $(BATCHEMACS) -eval '(setq load-path (append (mapcar (lambda (d) 
(expand-file-name (symbol-name d))) (quote (\. ${ELISP_DIRS_COMP}))) 
load-path))' -eval '(progn (require (quote bytecomp)) (require (quote mouse)) 
(require (quote tool-bar)) (require (quote fontset)) (setq 
byte-compile-warnings (remove (quote noruntime) byte-compile-warning-types)) 
(setq byte-compile-error-on-warn $(ERROR_ON_WARN)))' -f batch-byte-compile
 EL=$(shell for f in $(ELISP_DIRS_COMP); do ls $$f/*.el; done)
 ELC=$(EL:.el=.elc)
 
@@ -102,14 +103,12 @@ compile: $(EL)
        @echo "****************************************************************"
 
 ## 
-## compile : byte compile all lisp files
-##
-## Compiling can show up errors in the code, but be wary of fixing obsoletion
-## or argument call warnings unless they're valid for all supported Emacsen.
+## check : make sure compilation doesn't emit warnings
 ##
 ## The check target aborts compilation on any byte-compiler warning.
-## Compile with this target once before commiting your changes to 
+## Compile with this target once before commiting your changes to
 ## the repository.
+## FIXME: Compilation currently emits many warnings :-(
 ##
 check: $(EL) 
        @echo "****************************************************************"
@@ -120,6 +119,29 @@ check: $(EL)
        @echo " Finished."
        @echo "****************************************************************"
 
+##
+## tests : run a selection of regression tests
+##
+.PHONY: tests
+tests:
+       ci/test.sh
+
+##
+## dist-tests : run all regression tests
+##
+.PHONY: dist-tests
+dist-tests: tests check-doc-magic
+       +$(MAKE) -C ci/simple-tests all
+       +$(MAKE) -C ci/compile-tests test
+       +$(MAKE) -C ci/test-indent
+
+##
+## check-doc-magic : check *.texi are up-to-date w.r.t. docstrings
+##
+.PHONY: check-doc-magic
+check-doc-magic:
+       +$(MAKE) -C doc magic
+       git diff --exit-code -- doc
 
 ##
 ## Make an individual .elc.  Building separately means we need to be
@@ -251,36 +273,33 @@ scripts: bashscripts perlscripts
 
 .PHONY: bashscripts
 bashscripts:
-       (bash="`which bash`"; \
-        if [ -z "$$bash" ]; then \
+       (bash="`which bash`";                                       \
+        if [ -z "$$bash" ]; then                                   \
           echo "Could not find bash - bash paths not checked" >&2; \
-          exit 0; \
-        fi; \
-        for i in $(BASH_SCRIPTS); do \
-          sed -i.orig "s|^#.*!.*/bin/bash.*$$|#!$$bash|" $$i; \
-        done)
+          exit 0;                                                  \
+        fi)
 
 .PHONY: perlscripts
 perlscripts:
-       (perl="`which perl`"; \
-        if [ -z "$$perl" ]; then \
+       (perl="`which perl`";                                       \
+        if [ -z "$$perl" ]; then                                   \
           echo "Could not find perl - perl paths not checked" >&2; \
-          exit 0; \
-        fi; \
-        for i in $(PERL_SCRIPTS); do \
-          sed -i.orig "s|^#.*!.*/bin/perl.*$$|#!$$perl|" $$i; \
+          exit 0;                                                  \
+        fi;                                                        \
+        for i in $(PERL_SCRIPTS); do                               \
+          sed -i.orig "s|^#.*!.*/bin/perl.*$$|#!$$perl|" $$i;      \
         done)
 
 # Set PGHOME path in scripts back to default location.
 .PHONY: cleanscripts
 cleanscripts:
-       (for i in $(BASH_SCRIPTS) $(PERL_SCRIPTS); do \
-          if [ -f $$i.rm ] ; then \
-            rm -f $$i.rm; \
-          fi; \
-          if [ -f $$i.orig ] ; then \
-             mv -f $$i.orig $$i; \
-           fi; \
+       (for i in $(PERL_SCRIPTS); do \
+          if [ -f $$i.rm ] ; then    \
+            rm -f $$i.rm;            \
+          fi;                        \
+          if [ -f $$i.orig ] ; then  \
+             mv -f $$i.orig $$i;      \
+           fi;                               \
         done)
 
 ##
diff --git a/Makefile.devel b/Makefile.devel
index 8705af311e..f244798bdc 100644
--- a/Makefile.devel
+++ b/Makefile.devel
@@ -147,7 +147,7 @@ TAR=tar
 
 # Files not to include the distribution area or tarball
 UNFINISHED_ELISP=
-ETC_FILES=etc/lego etc/coq etc/demoisa etc/isa etc/isar etc/lego etc/patches 
etc/*.txt
+ETC_FILES=etc/coq etc/demoisa etc/patches etc/*.txt
 NONDISTFILES=.gitignore */.gitignore Makefile.devel etc/trac etc/testsuite 
$(UNFINISHED_ELISP) $(ETC_FILES)
 DOCDISTFILES=ProofGeneral.info PG-adapting.info
 
diff --git a/README.md b/README.md
index a0f1a640c8..26d66a2bb5 100644
--- a/README.md
+++ b/README.md
@@ -27,6 +27,13 @@ Two editions of Proof General are currently available:
 
 ## Installing Proof General
 
+Proof General requires GNU Emacs `25.1` or later.
+
+The current policy aims at supporting multiple Emacs versions,
+including those available in [Debian 
Stable](https://packages.debian.org/stable/emacs)
+as well as in [Ubuntu LTS](https://packages.ubuntu.com/emacs) distributions
+until their [End-Of-Support](https://wiki.ubuntu.com/Releases).
+
 ### Using MELPA (recommended procedure)
 
 [MELPA](https://melpa.org/) is a repository of Emacs packages. Skip
@@ -43,7 +50,7 @@ your `.emacs` and restart Emacs:
 **Remark:** If you have Emacs 26.1 (which is precisely
 [the packaged version in Debian 10](https://packages.debian.org/emacs)),
 you may get the error message `Failed to download 'melpa' archive`
-during the package refresh step. This is a know bug
+during the package refresh step. This is a known bug
 ([debbug #34341](https://debbugs.gnu.org/cgi/bugreport.cgi?bug=34341))
 which has been fixed in Emacs 26.3 and 27.1, while a simple workaround
 consists in uncommenting the line
@@ -119,7 +126,6 @@ See:
 Links:
 
 * [https://proofgeneral.github.io/doc](https://proofgeneral.github.io/doc) for 
online documentation of Proof General
-* 
[http://proofgeneral.inf.ed.ac.uk/mailinglist](http://proofgeneral.inf.ed.ac.uk/mailinglist)
 for mailing list information
 
 Supported proof assistants:
 
@@ -130,19 +136,10 @@ Supported proof assistants:
 Proof General used to support other proof assistants, but those
 instances are no longer maintained nor available in the MELPA package:
 
-* Legacy support of
-  [Isabelle](https://www.cl.cam.ac.uk/research/hvg/Isabelle/) and
-  [LEGO](http://www.dcs.ed.ac.uk/home/lego)
-* Experimental support of: CCC, ACL2, HOL98, Hol-Light, Lambda-Clam, Shell, 
Twelf
-* Obsolete instances: Demoisa, Lambda-Clam, Plastic
+* Experimental support of: Shell
+* Obsolete instances: Demoisa
+* Removed instances: Twelf, CCC, Hol-Light, ACL2, Plastic, Lambda-Clam, HOL98,
+  [LEGO](http://www.dcs.ed.ac.uk/home/lego),
+  [Isabelle](https://www.cl.cam.ac.uk/research/hvg/Isabelle/)
 
 A few example proofs are included in each prover subdirectory.
-
-## Contributing
-
-Contributions to this repository are placed under the BSD-3 license.
-As BSD-3 is compatible with both GPLv2 and GPLv3+, this means that
-we can merge them in both `master` and `async` branches if need be,
-using the same license as the rest of the codebase, while you keep
-all the rights on your code.
-For more info, see <https://opensource.org/licenses/BSD-3-Clause>.
diff --git a/REGISTER b/REGISTER
deleted file mode 100644
index 820c9517e7..0000000000
--- a/REGISTER
+++ /dev/null
@@ -1,12 +0,0 @@
-Please register your use of Proof General on the web at:
-
-         http://proofgeneral.inf.ed.ac.uk/register
-
-The information provided will only be used to help a case for support
-for Proof General in the future.
-
-There is also an opportunity to join the mailing list from this page.
-To add or remove yourself from the mailing list after registering, go
-to:
-  
-         http://proofgeneral.inf.ed.ac.uk/mailinglist
diff --git a/acl2/README b/acl2/README
deleted file mode 100644
index fbe9344090..0000000000
--- a/acl2/README
+++ /dev/null
@@ -1,22 +0,0 @@
-ACL2 Proof General, for ACL2.
-
-Written by David Aspinall.
-
-Status:               alpha; unsupported
-Maintainer:    volunteer required
-ACL2 version:  Tested briefly with acl2.5
-ACL2 homepage: http://www.cs.utexas.edu/users/moore/acl2
-
-========================================
-
-This is the absolute bare beginnings of a PG instance for ACL2.
-At the moment, only basic script management is configured.
-
-I have written this in the hope that somebody from the ACL2 community
-will adopt it, maintain and improve it, and thus turn it into a proper
-instantiation of Proof General.
-
-
-
-$Id$
-
diff --git a/acl2/acl2.el b/acl2/acl2.el
deleted file mode 100644
index db3120edcc..0000000000
--- a/acl2/acl2.el
+++ /dev/null
@@ -1,106 +0,0 @@
-;;; acl2.el --- Basic Proof General instance for ACL2
-
-;; This file is part of Proof General.
-
-;; Portions © Copyright 1994-2012  David Aspinall and University of Edinburgh
-;; Portions © Copyright 2003-2018  Free Software Foundation, Inc.
-;; Portions © Copyright 2001-2017  Pierre Courtieu
-;; Portions © Copyright 2010, 2016  Erik Martin-Dorel
-;; Portions © Copyright 2011-2013, 2016-2017  Hendrik Tews
-;; Portions © Copyright 2015-2017  Clément Pit-Claudel
-
-;; License:   GPL (GNU GENERAL PUBLIC LICENSE)
-
-;; Author:    David Aspinall <David.Aspinall@ed.ac.uk>
-
-;;; Commentary:
-;;
-;; Needs improvement!
-;;
-;; See the README file in this directory for information.
-
-;;; Code:
-
-(require 'proof-easy-config)            ; easy configure mechanism
-(require 'proof-syntax)                        ; functions for making regexps
-
-(add-to-list 'auto-mode-alist                ; ACL2 uses two file extensions
-                                             ; Only grab .lisp extension after
-             (cons "\\.lisp\\'" 'acl2-mode)) ; an acl2 file has been loaded
-
-(proof-easy-config  'acl2 "ACL2"
- proof-assistant-home-page       "http://www.cs.utexas.edu/users/moore/acl2";
- proof-prog-name                "acl2"
-
- proof-script-sexp-commands     t
- proof-script-comment-start    ";"
-
- proof-shell-annotated-prompt-regexp "ACL2[ !]*>+"
-
- proof-save-command-regexp      "(def\\w+\\s "
- proof-goal-command-regexp       "(def\\w+\\s "
- proof-save-with-hole-regexp     "(def\\w+[ \t\n]+\\(\\w+\\)"
- proof-save-with-hole-result    1
- proof-shell-error-regexp
- "^Error: \\|Error in TOP-LEVEL: \\|\\*\\*\\*\\* FAILED \\*\\*\\*"
- proof-shell-interrupt-regexp    "Correctable error: Console interrupt."
-
- proof-shell-quit-cmd            ":q"   ;; FIXME: followed by C-d.
- proof-shell-restart-cmd        ":q\n:q\n:q\n(lp)\n"    ;; FIXME: maybe not?
- proof-info-command             ":help"
- proof-undo-n-times-cmd                 ":ubt %s"  ;; shouldn't give errors
- proof-forget-id-command        ":ubt %s"  ;; so use ubt not ubt!
- proof-context-command          ":pbt :max"
- ;; proof-showproof-cmd                 ":pbt :here"
-
- proof-shell-truncate-before-error nil
-
- ;;
- ;; Syntax table entries for proof scripts  (FIXME: incomplete)
- ;;
- proof-script-syntax-table-entries
- '(?\[ "(]  "
-   ?\] "([  "
-   ?\( "()  "
-   ?\) ")(  "
-   ?.  "w   "
-   ?_  "w   "
-   ?-  "w   "
-   ?>  "w   " ;; things treated as names can have > in them
-   ?#  "'   "
-   ?\' "'    "
-   ?`  "'    "
-   ?,  "'    "
-   ?\| "."
-   ?\; "<    "
-   ?\n ">    "
-   )
-
- ;; A tiny bit of syntax highlighting
- ;;
- proof-script-font-lock-keywords
- (append
-  (list
-   (proof-ids-to-regexp '("defthm" "defabbrev" "defaxiom" "defchoose"
-                         "defcong" "defconst" "defdoc" "defequiv"
-                         "defevaluator" "defpackage" "deflabel" "deftheory"
-                         "implies" "equal" "and")))
-  (if (boundp 'lisp-font-lock-keywords) ;; wins if font-lock is loaded
-      lisp-font-lock-keywords))
-
-
- ;; End of easy config.
- )
-
-;; Interrupts and errors enter another loop; break out of it
-(add-hook
- 'proof-shell-handle-error-or-interrupt-hook
- (lambda () (if (eq proof-shell-error-or-interrupt-seen 'interrupt)
-               (proof-shell-insert ":q" nil))))
-
-
-
-(warn "ACL2 Proof General is incomplete!  Please help improve it!
-Please add improvements at https://github.com/ProofGeneral/PG";)
-
-(provide 'acl2)
diff --git a/acl2/example.acl2 b/acl2/example.acl2
deleted file mode 100644
index a3a0f2117e..0000000000
--- a/acl2/example.acl2
+++ /dev/null
@@ -1,9 +0,0 @@
-;;  Example proof script for ACL2 Proof General.
-;;
-;;   $Id$
-;;    
-
-(defthm assoc->assoc-equal
-  (equal (assoc x a)
-        (assoc-equal x a)))
-
diff --git a/acl2/root2.acl2 b/acl2/root2.acl2
deleted file mode 100644
index c60d05ed6d..0000000000
--- a/acl2/root2.acl2
+++ /dev/null
@@ -1,348 +0,0 @@
-(* Example proof by Ruben Gamboa.  
-   See http://www.cs.kun.nl/~freek/comparison/ *)
-
-
-(in-package "ACL2")
-
-;; This book presents the proof that sqrt(2) is an irrational number.
-;; The proof proceeds by observing that p^2 is even precisely when p
-;; is even.  Thus, if p^2 = 2 q^2, p must be even.  But then, p^2
-;; isn't just even, it's a multiple of 4, so q^2 = p^2 / 2 must also
-;; be even.  But since q^2 is even, so is q.  Now, letting p be the
-;; numerator of 2 and q the denominator of 2, we find that both the
-;; numerator and denominator are even -- but this is an
-;; impossibility.  Hence, we can conclude that 2 is not rational.
-
-;; The proof is completed by observing that sqrt(2) is not complex.
-;; The reason is that if x is complex, x^2 is real only when x is a
-;; pure imaginary number.  But in those cases, x^2 is negative
-
-(include-book "../arithmetic/top"
-             :load-compiled-file nil)
-
-;; Step 1: We begin by proving that p^2 is even precisely when p is
-;; even.
-
-(encapsulate
- ()
-
- ;; Since ACL2 is so strong in induction, it is common to use
- ;; induction to prove simple number theoretic results.  But to induce
- ;; over the even numbers requires that each time through the
- ;; induction we "step" by 2, not the usual 1.  So we start by
- ;; introducing the induction scheme for the even numbers.
-
- (local
-  (defun even-induction (x)
-    "Induct by going two steps at a time"
-    (if (or (zp x) (equal x 1))
-       x
-      (1+ (even-induction (1- (1- x)))))))
-
- ;; Now we can prove that if p^2 is even, so is p.  Because we're
- ;; doing this inductively, we only consider the even naturals to
- ;; begin with.
-
- (local
-  (defthm lemma-1
-    (implies (and (integerp p)
-                 (<= 0 p)
-                 (evenp (* p p)))
-            (evenp p))
-    :hints (("Goal"
-            :induct (even-induction p)))
-    :rule-classes nil))
-
- ;; Technically, we do not need to worry about the negative integers
- ;; in this proof, since both the numerator and denominator of 2 (if
- ;; they existed) are positive.  But it's easy enough to prove this,
- ;; and it gets rid of the "non-negative" hypothesis.  In general, it
- ;; is good to get rid of hypothesis in ACL2 rewrite rules.
-
- (local
-  (defthm lemma-2
-    (implies (and (integerp p)
-                 (<= p 0)
-                 (evenp (* p p)))
-            (evenp p))
-    :hints (("Goal"
-            :use (:instance lemma-1 (p (- p)))))
-    :rule-classes nil))
-
- ;; Now, we can prove that if p^2 is even, so is p.  But the converse
- ;; is trivial, so we could show that p^2 is even iff p is even.
- ;; Because equalities are more powerful rewrite rules than
- ;; implications, we prefer to do so, even though we don't really need
- ;; the stronger equality for this proof.  So we prove the converse
- ;; here: if p is even, so is p^2.
-
- (local
-  (defthm lemma-3
-    (implies (and (integerp p)
-                 (evenp p))
-            (evenp (* p p)))
-    :rule-classes nil))
-    
- ;; Now, we simply collect the results above to find that p^2 is even
- ;; if and only if p is even.  This is the only theorem that is
- ;; exported from this event.
-
- (defthm even-square-implies-even
-   (implies (integerp p)
-           (equal (evenp (* p p)) (evenp p)))
-   :hints (("Goal"
-           :use ((:instance lemma-1)
-                 (:instance lemma-2)
-                 (:instance lemma-3)))))
- )
-
-;; Step 2. Suppose p^2 is even.  Then, p is even, so p^2 is more than
-;; even -- it is a multiple of 4.  We prove this here, since it is the
-;; key fact allowing us to conclude that q^2 is even when we know that
-;; p^2 = 2 * q^2.
-
-(defthm even-square-implies-even-square-multiple-of-4
-  (implies (and (integerp p)
-               (evenp (* p p)))
-          (evenp (* 1/2 p p)))
-  :hints (("Goal"
-          :use ((:instance even-square-implies-even)
-                (:instance (:theorem (implies (integerp x) (integerp (* x x))))
-                           (x (* 1/2 p))))
-          :in-theory (disable even-square-implies-even))))
-
-;; In the proofs below, we disable ACL2's definition of even, but we
-;; need to remember that 2*n is always even.  So we prove that rewrite
-;; rule here.
-
-(defthm evenp-2x
-  (implies (integerp x)
-          (evenp (* 2 x))))
-
-;; Step 3. Suppose p^2 = 2 * q^2.  Then we can conclude that p is
-;; even, since p^2 is even.
-
-(defthm numerator-sqrt-2-is-even
-   (implies (and (integerp p)
-                (integerp q)
-                (equal (* p p)
-                       (* 2 (* q q))))
-           (evenp p))
-   :hints (("Goal"
-           :use ((:instance even-square-implies-even)
-                 (:instance evenp-2x (x (* q q))))
-           :in-theory (disable even-square-implies-even
-                               evenp-2x
-                               evenp))))
-
-;; Step 4. Suppose p^2 = 2 * q^2.  Then we can conclude that q is
-;; even, since p^2 is a multiple of 4, so q^2 is even.
-
-(defthm denominator-sqrt-2-is-even
-   (implies (and (integerp p)
-                (integerp q)
-                (equal (* p p)
-                       (* 2 (* q q))))
-           (evenp q))
-   :hints (("Goal"
-           :use ((:instance even-square-implies-even-square-multiple-of-4)
-                 (:instance even-square-implies-even (p q))
-                 (:instance evenp-2x 
-                            (x (* q q)))
-                 (:instance equal-*-/-1
-                            (x 2)
-                            (y (* p p))
-                            (z (* q q))))
-           :in-theory (disable even-square-implies-even-square-multiple-of-4
-                               even-square-implies-even
-                               evenp-2x
-                               evenp
-                               equal-*-/-1))))
-
-;; Step 5.  Those are all the pieces we need to prove that sqrt(2) is
-;; not rational.  For we observe that if p=numerator(sqrt(2)) and
-;; q=denominator(sqrt(2)), the theorems above show that both p and q
-;; are even, and that's an absurdity.
-
-(encapsulate
- ()
-
- ;; ACL2's algebraic prowess is modest.  In the proof of the main
- ;; theorem below, it builds the expression p^2/q^2 where x=p/q, but
- ;; it does not reduce the expression further to x^2.  We add a
- ;; rewrite rule to take care of that.
-
- (local
-  (defthm lemma-1
-    (implies (rationalp x)
-            (equal (* (/ (denominator x))
-                      (/ (denominator x))
-                      (numerator x)
-                      (numerator x))
-                   (* x x)))
-    :hints (("Goal"
-            :use ((:instance Rational-implies2)
-                  (:instance *-r-denominator-r (r x)))
-            :in-theory (disable Rational-implies2
-                                *-r-denominator-r)))))
-
- ;; Now we can prove that the square root of 2 is not rational.  This
- ;; involves using the theorems defined above, as well as some
- ;; algebraic lemmas to help reduce the terms.  The most important
- ;; hint, however, is the inclusion of the axiom Lowest-Terms, because
- ;; it is not enabled in the ACL2 world.
-
- (defthm sqrt-2-not-rational
-   (implies (equal (* x x) 2)
-           (not (rationalp x)))
-   :hints (("Goal"
-           :use ((:instance numerator-sqrt-2-is-even
-                            (p (numerator x))
-                            (q (denominator x)))
-                 (:instance denominator-sqrt-2-is-even
-                            (p (numerator x))
-                            (q (denominator x)))       
-                 (:instance Lowest-Terms
-                            (n 2)
-                            (r (/ (numerator x) 2))
-                            (q (/ (denominator x) 2)))
-                 (:instance equal-*-/-1
-                            (x (/ (* (denominator x) (denominator x))))
-                            (y 2)
-                            (z (* (numerator x) (numerator x)))))
-           :in-theory (disable equal-*-/-1
-                               numerator-sqrt-2-is-even
-                               denominator-sqrt-2-is-even))))
- )
-
-;; Step 6. Now that the rationals are ruled out, we need to weed out
-;; the remaining sqrt(2) suspects.  One possibility is that sqrt(2) is
-;; a complex number.  We explore that here.  Because ACL2 has very
-;; little knowledge of the complex numbers, we have to start with some
-;; basic facts.  First, we show that (a+bi)^2 = (a^2-b^2)+(ab+ab)i.
-(encapsulate
- ()
-
- ;; We start out with the desired theorem when the complex number is
- ;; written as a+bi instead of (complex a b).  Here, the result
- ;; follows from simple algebra and the fact that i^2=-1.
- (local
-  (defthm lemma-1
-    (equal (* (+ x (* #c(0 1) y))
-             (+ x (* #c(0 1) y)))
-          (+ (- (* x x) (* y y))
-             (* #c(0 1) (+ (* x y) (* x y)))))
-    :rule-classes nil))
-
- ;; Now we rewrite the right-hand side of the rewrite rule into the
- ;; final form of (complex (a^2-b^2) (ab+ab))
- (local
-  (defthm lemma-2
-    (implies (and (realp x)
-                 (realp y))
-            (equal (* (+ x (* #c(0 1) y))
-                      (+ x (* #c(0 1) y)))
-                   (complex (- (* x x) (* y y))
-                            (+ (* x y) (* x y)))))
-    :hints (("Goal"
-            :use ((:instance lemma-1)
-                  (:instance complex-definition
-                             (x (- (* x x) (* y y)))
-                             (y (+ (* x y) (* x y)))))))
-    :rule-classes nil))
-
- ;; And finally we rewrite the left-hand side of the rewrite rule into
- ;; the final form of (complex a b)^2.
- (defthm complex-square-definition
-   (implies (and (realp x)
-                (realp y))
-           (equal (* (complex x y) (complex x y))
-                  (complex (- (* x x) (* y y))
-                           (+ (* x y) (* x y)))))
-   :hints (("Goal"
-           :use ((:instance complex-definition)
-                 (:instance lemma-2))))
-   :rule-classes nil)
- )
-
-;; Step 7.  Since (a+bi)^2 = (a^2-b^2)+(ab+ab)i, it follows that it is
-;; real if and only if a or b is zero, i.e., if and only if the number
-;; is real or pure imaginary.  Since we're interested only in the
-;; non-real complex numbers (the ones for which complexp is true), we
-;; can conlude that only pure imaginaries have real squares.
-(encapsulate
- ()
-
- ;; First we show that (a+bi)^2 = (a^2-b^2)+(ab+ab)i is real if and
- ;; only ab+ab is zero.
- (local
-  (defthm lemma-1
-    (implies (and (complexp x)
-                 (realp (* x x)))
-            (equal (+ (* (realpart x) (imagpart x))
-                      (* (realpart x) (imagpart x)))
-                   0))
-    :hints (("Goal"
-            :use (:instance complex-square-definition
-                            (x (realpart x))
-                            (y (imagpart x)))))
-    :rule-classes nil))
-
- ;; The following rewrite rule allows us to conclude that a real
- ;; number x is zero whenever x+x is zero.
- (local
-  (defthm lemma-2
-    (implies (and (realp x)
-                 (equal (+ x x) 0))
-            (= x 0))))
-
- ;; The two lemmas above conclude that ab is zero whenever (a+bi)^2 is
- ;; zero, and since b is assumed non-zero (because a+bi is complex),
- ;; we have that a must be zero, and a+bi=bi is a pure imaginary
- ;; number.
- (defthm complex-squares-real-iff-imaginary
-   (implies (and (complexp x)
-                (realp (* x x)))
-           (equal (realpart x) 0))
-   :hints (("Goal"
-           :use ((:instance lemma-1)
-                 (:instance lemma-2
-                            (x (* (realpart x) (imagpart x))))))))
- )
-
-;; Step 7.  Trivially, the square of a pure imaginary number bi is a
-;; negative real, since bi^2 = -b^2.
-(defthm imaginary-squares-are-negative
-  (implies (and (complexp x)
-               (equal (realpart x) 0))
-          (< (* x x) 0))
-  :hints (("Goal"
-          :use (:instance complex-square-definition
-                          (x 0)
-                          (y (imagpart x))))))
-
-;; Step 8.  From the theorems above, we can conclude that sqrt(2) is
-;; not a complex number, because the only candidates are the pure
-;; imaginary numbers, and their squares are all negative.
-(defthm sqrt-2-not-complexp
-  (implies (complexp x)
-          (not (equal (* x x) 2)))
-  :hints (("Goal"
-          :use ((:instance complex-squares-real-iff-imaginary)
-                (:instance imaginary-squares-are-negative)))))
-
-;; Step 9.  That means sqrt(2) is not rational, and neither is it a
-;; complex number.  The only remaining candidates (in ACL2's universe)
-;; are the non-rational reals, so we can prove the main result: the
-;; square root of two (if it exists) is irrational.
-(defthm irrational-sqrt-2
-  (implies (equal (* x x) 2)
-          (and (realp x)
-               (not (rationalp x))))
-  :hints (("Goal"
-          :cases ((rationalp x) (complexp x)))))
-
-;; Step 10.  Next, it would be nice to show that sqrt(2) actually
-;; exists!  See the book nonstd/nsa/sqrt.lisp for a proof of that,
-;; using non-standard analysis.
-
diff --git a/ccc/README b/ccc/README
deleted file mode 100644
index 88faf172fd..0000000000
--- a/ccc/README
+++ /dev/null
@@ -1,14 +0,0 @@
-Proof General for the Casl Consistency Checker
-
-Author:        Christoph L�th <cxl@informatik.uni-bremen.de>
-       
-=================================================================
-
-This is a fairly straightforward instantiation of Proof General for
-the Casl Consistency Checker, CCC. 
-
-CASL is the standard algebraic specification language, and CCC is a
-tool to check consistency of CASL specifications.
-
-For more information, hasten thee browser yonder:
-  http://www.informatik.uni-bremen.de/cofi/ccc
diff --git a/ccc/ccc.el b/ccc/ccc.el
deleted file mode 100644
index 44a0d7c3f2..0000000000
--- a/ccc/ccc.el
+++ /dev/null
@@ -1,85 +0,0 @@
-;; ccc.el - Proof General for the Casl Consistency Checker
-;;
-;; Author: Christoph L�th <cxl@informatik.uni-bremen.de>
-;;
-;; This is a fairly straightforward instantiation of Proof General for
-;; the Casl Consistency Checker, CCC.
-;;
-;; CASL is the standard algebraic specification language, and CCC is a
-;; tool to check consistency of CASL specifications.
-;;
-;; For more information, hasten thee browser yonder:
-;;   http://www.informatik.uni-bremen.de/cofi/ccc
-
-(require 'proof-easy-config)            ; nice and easy does it
-(require 'proof-syntax)                        ; functions for making regexps
-
-(defvar ccc-keywords nil)
-(defvar ccc-tactics nil)
-(defvar ccc-tacticals nil)
-
-(proof-easy-config  'ccc "CASL Consistency Checker"
- proof-prog-name                "ccc" ;; must be in your path.
- proof-terminal-string             ";"
- proof-script-comment-start      "(*"
- proof-script-comment-end        "*)"
- proof-goal-command-regexp       "\\(ccc\\|holcasl\\) \".*\";"
- proof-save-command-regexp       "^qeccc"
- proof-goal-with-hole-regexp     "\\(ccc\\|holcasl\\) \"\\(\\(.*\\)\\)\""
- proof-save-with-hole-regexp     "qeccc \"\\(\\(.*\\)\\)\""
- proof-non-undoables-regexp      "undo\\|back"
- proof-goal-command              "ccc \"%s\";"
- proof-save-command              "qeccc \"%s\";"
- proof-kill-goal-command         "abort ();"
- proof-showproof-command         "prt()"
- proof-undo-n-times-cmd          "undo_steps %s;"
- proof-auto-multiple-files       nil
- proof-shell-cd-cmd              "cd \"%s\""
- proof-shell-interrupt-regexp    "Interrupt"
- proof-shell-start-goals-regexp  "^No subgoals\\|^[0-9]* subgoals\\|^Wts:"
- proof-shell-end-goals-regexp    "val it"
- proof-shell-quit-cmd            "quit();"
- proof-assistant-home-page       
"http://www.informatik.uni-bremen.de/cofi/tools/ccc";
- proof-shell-annotated-prompt-regexp  "^\\(val it = () : 
unit\n\\)?\\(CCC\\|^HOL-CASL\\)> " ;; "^\\(val it = () : unit\n\\)?ML>? "
- proof-shell-error-regexp        "\\*\\*\\*\\|^.*Error:\\|^uncaught exception 
\\|^Exception- "
- proof-shell-proof-completed-regexp "^Consistency proof successfully finished."
- proof-shell-eager-annotation-start "^\\[opening \\|^###\\|^Reading" ;;; ???
-
- ;;
- ;; Some basic fontlocking and syntax table entries, as taken from the
- ;; hol98 instance (it's all SML anyway :-)
- ;;
- proof-script-syntax-table-entries
- '(?\` "\""
-   ?\$ "."
-   ?\/ "."
-   ?\\ "."
-   ?+  "."
-   ?-  "."
-   ?=  "."
-   ?%  "."
-   ?<  "."
-   ?>  "."
-   ?\& "."
-   ?.  "w"
-   ?_  "w"
-   ?\' "w"
-   ?\| "."
-   ?\[ "(]"
-   ?\] ")["
-   ?\* ". 23"
-   ?\( "()1"
-   ?\) ")(4")
-
- ccc-keywords  '("use" "ap" "holcasl" "ccc" "load_lib" "qeccc")
- ccc-tactics   '("compose" "compose'" "prove" "prove_free_type")
- ccc-tacticals '("Repeat" "Orelse" "Then" "ThenList" "OrelseList")
- proof-script-font-lock-keywords
- (list
-  (cons (proof-ids-to-regexp ccc-keywords) 'font-lock-keyword-face)
-  (cons (proof-ids-to-regexp ccc-tactics) 'font-lock-keyword-face)
-  ; (cons (proof-ids-to-regexp hol98-rules) 'font-lock-keyword-face)
-  (cons (proof-ids-to-regexp ccc-tacticals) 'proof-tacticals-name-face))
-
-
-)
diff --git a/ci/compile-tests/001-mini-project/Makefile 
b/ci/compile-tests/001-mini-project/Makefile
index 95f05017d3..63bf6d07fa 100644
--- a/ci/compile-tests/001-mini-project/Makefile
+++ b/ci/compile-tests/001-mini-project/Makefile
@@ -5,7 +5,7 @@
 # Authors: Hendrik Tews
 # Maintainer: Hendrik Tews <hendrik@askra.de>
 # 
-# License:     GPL (GNU GENERAL PUBLIC LICENSE)
+# SPDX-License-Identifier: GPL-3.0-or-later
 
 
 .PHONY: test
diff --git a/ci/compile-tests/001-mini-project/a.v 
b/ci/compile-tests/001-mini-project/a.v
index fe3521baf6..15c2a0e456 100644
--- a/ci/compile-tests/001-mini-project/a.v
+++ b/ci/compile-tests/001-mini-project/a.v
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/001-mini-project/b.v 
b/ci/compile-tests/001-mini-project/b.v
index ed30f615ed..35de075d58 100644
--- a/ci/compile-tests/001-mini-project/b.v
+++ b/ci/compile-tests/001-mini-project/b.v
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/001-mini-project/c.v 
b/ci/compile-tests/001-mini-project/c.v
index a879933343..8aae8e99b8 100644
--- a/ci/compile-tests/001-mini-project/c.v
+++ b/ci/compile-tests/001-mini-project/c.v
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/001-mini-project/d.v 
b/ci/compile-tests/001-mini-project/d.v
index ca175bfce4..4099574bb7 100644
--- a/ci/compile-tests/001-mini-project/d.v
+++ b/ci/compile-tests/001-mini-project/d.v
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/001-mini-project/e.v 
b/ci/compile-tests/001-mini-project/e.v
index 7cd08e90d7..088390a54f 100644
--- a/ci/compile-tests/001-mini-project/e.v
+++ b/ci/compile-tests/001-mini-project/e.v
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/001-mini-project/f.v 
b/ci/compile-tests/001-mini-project/f.v
index f5e47cd804..4e190df0d6 100644
--- a/ci/compile-tests/001-mini-project/f.v
+++ b/ci/compile-tests/001-mini-project/f.v
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/001-mini-project/runtest.el 
b/ci/compile-tests/001-mini-project/runtest.el
index 9edbcbd530..6ebd31451f 100644
--- a/ci/compile-tests/001-mini-project/runtest.el
+++ b/ci/compile-tests/001-mini-project/runtest.el
@@ -1,11 +1,11 @@
-;; This file is part of Proof General.
+;; This file is part of Proof General.  -*- lexical-binding: t; -*-
 ;; 
 ;; © Copyright 2020  Hendrik Tews
 ;; 
 ;; Authors: Hendrik Tews
 ;; Maintainer: Hendrik Tews <hendrik@askra.de>
 ;; 
-;; License:     GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
@@ -26,7 +26,7 @@
 
 
 ;; require cct-lib for the elisp compilation, otherwise this is present already
-(require 'cct-lib)
+(require 'cct-lib "ci/compile-tests/cct-lib")
 
 ;;; set configuration
 (cct-configure-proof-general)
@@ -36,6 +36,7 @@
 (ert-deftest cct-mini-project ()
   "Test successful background compilation and ancestor recording."
   (find-file "a.v")
+  ; (setq coq--debug-auto-compilation t)
   (cct-process-to-line 25)
   
   (cct-check-locked 24 'locked)
diff --git a/ci/compile-tests/002-require-no-dependencies/Makefile 
b/ci/compile-tests/002-require-no-dependencies/Makefile
index 95f05017d3..63bf6d07fa 100644
--- a/ci/compile-tests/002-require-no-dependencies/Makefile
+++ b/ci/compile-tests/002-require-no-dependencies/Makefile
@@ -5,7 +5,7 @@
 # Authors: Hendrik Tews
 # Maintainer: Hendrik Tews <hendrik@askra.de>
 # 
-# License:     GPL (GNU GENERAL PUBLIC LICENSE)
+# SPDX-License-Identifier: GPL-3.0-or-later
 
 
 .PHONY: test
diff --git a/ci/compile-tests/002-require-no-dependencies/a.v 
b/ci/compile-tests/002-require-no-dependencies/a.v
index b44c78f3f4..cbe7525f55 100644
--- a/ci/compile-tests/002-require-no-dependencies/a.v
+++ b/ci/compile-tests/002-require-no-dependencies/a.v
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/002-require-no-dependencies/b.v 
b/ci/compile-tests/002-require-no-dependencies/b.v
index d37d48bbef..411a8c6114 100644
--- a/ci/compile-tests/002-require-no-dependencies/b.v
+++ b/ci/compile-tests/002-require-no-dependencies/b.v
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/002-require-no-dependencies/c.v 
b/ci/compile-tests/002-require-no-dependencies/c.v
index 8619c90ba5..ac8d7d820d 100644
--- a/ci/compile-tests/002-require-no-dependencies/c.v
+++ b/ci/compile-tests/002-require-no-dependencies/c.v
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/002-require-no-dependencies/runtest.el 
b/ci/compile-tests/002-require-no-dependencies/runtest.el
index f2feefad7e..0ea01fb624 100644
--- a/ci/compile-tests/002-require-no-dependencies/runtest.el
+++ b/ci/compile-tests/002-require-no-dependencies/runtest.el
@@ -1,11 +1,11 @@
-;; This file is part of Proof General.
+;; This file is part of Proof General.  -*- lexical-binding: t; -*-
 ;; 
 ;; © Copyright 2020  Hendrik Tews
 ;; 
 ;; Authors: Hendrik Tews
 ;; Maintainer: Hendrik Tews <hendrik@askra.de>
 ;; 
-;; License:     GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
@@ -23,7 +23,7 @@
 
 
 ;; require cct-lib for the elisp compilation, otherwise this is present already
-(require 'cct-lib)
+(require 'cct-lib "ci/compile-tests/cct-lib")
 
 ;;; set configuration
 (cct-configure-proof-general)
diff --git a/ci/compile-tests/003-require-error/Makefile 
b/ci/compile-tests/003-require-error/Makefile
index 95f05017d3..63bf6d07fa 100644
--- a/ci/compile-tests/003-require-error/Makefile
+++ b/ci/compile-tests/003-require-error/Makefile
@@ -5,7 +5,7 @@
 # Authors: Hendrik Tews
 # Maintainer: Hendrik Tews <hendrik@askra.de>
 # 
-# License:     GPL (GNU GENERAL PUBLIC LICENSE)
+# SPDX-License-Identifier: GPL-3.0-or-later
 
 
 .PHONY: test
diff --git a/ci/compile-tests/003-require-error/a.v 
b/ci/compile-tests/003-require-error/a.v
index d5716ae056..c8bdf62aaa 100644
--- a/ci/compile-tests/003-require-error/a.v
+++ b/ci/compile-tests/003-require-error/a.v
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/003-require-error/b.v 
b/ci/compile-tests/003-require-error/b.v
index e3f5da5fa3..ff9842d106 100644
--- a/ci/compile-tests/003-require-error/b.v
+++ b/ci/compile-tests/003-require-error/b.v
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/003-require-error/c.v 
b/ci/compile-tests/003-require-error/c.v
index bd60ca0d0f..02b0e0ec2b 100644
--- a/ci/compile-tests/003-require-error/c.v
+++ b/ci/compile-tests/003-require-error/c.v
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/003-require-error/runtest.el 
b/ci/compile-tests/003-require-error/runtest.el
index c5e2a713c8..4c4d558c19 100644
--- a/ci/compile-tests/003-require-error/runtest.el
+++ b/ci/compile-tests/003-require-error/runtest.el
@@ -1,11 +1,11 @@
-;; This file is part of Proof General.
+;; This file is part of Proof General.  -*- lexical-binding: t; -*-
 ;;
 ;; © Copyright 2020  Hendrik Tews
 ;;
 ;; Authors: Hendrik Tews
 ;; Maintainer: Hendrik Tews <hendrik@askra.de>
 ;;
-;; License:     GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
@@ -26,7 +26,7 @@
 
 
 ;; require cct-lib for the elisp compilation, otherwise this is present already
-(require 'cct-lib)
+(require 'cct-lib "ci/compile-tests/cct-lib")
 
 ;;; set configuration
 (cct-configure-proof-general)
diff --git a/ci/compile-tests/004-dependency-cycle/Makefile 
b/ci/compile-tests/004-dependency-cycle/Makefile
index 95f05017d3..63bf6d07fa 100644
--- a/ci/compile-tests/004-dependency-cycle/Makefile
+++ b/ci/compile-tests/004-dependency-cycle/Makefile
@@ -5,7 +5,7 @@
 # Authors: Hendrik Tews
 # Maintainer: Hendrik Tews <hendrik@askra.de>
 # 
-# License:     GPL (GNU GENERAL PUBLIC LICENSE)
+# SPDX-License-Identifier: GPL-3.0-or-later
 
 
 .PHONY: test
diff --git a/ci/compile-tests/004-dependency-cycle/a.v 
b/ci/compile-tests/004-dependency-cycle/a.v
index d84f5d10f4..570a91b638 100644
--- a/ci/compile-tests/004-dependency-cycle/a.v
+++ b/ci/compile-tests/004-dependency-cycle/a.v
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/004-dependency-cycle/b.v 
b/ci/compile-tests/004-dependency-cycle/b.v
index c703c3ae76..48beb4198b 100644
--- a/ci/compile-tests/004-dependency-cycle/b.v
+++ b/ci/compile-tests/004-dependency-cycle/b.v
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/004-dependency-cycle/c.v 
b/ci/compile-tests/004-dependency-cycle/c.v
index 53bc67d5dc..f26b7bf431 100644
--- a/ci/compile-tests/004-dependency-cycle/c.v
+++ b/ci/compile-tests/004-dependency-cycle/c.v
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/004-dependency-cycle/d.v 
b/ci/compile-tests/004-dependency-cycle/d.v
index d06e5fec3f..63ce0cff71 100644
--- a/ci/compile-tests/004-dependency-cycle/d.v
+++ b/ci/compile-tests/004-dependency-cycle/d.v
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/004-dependency-cycle/e.v 
b/ci/compile-tests/004-dependency-cycle/e.v
index 604b44e0cc..80521cd531 100644
--- a/ci/compile-tests/004-dependency-cycle/e.v
+++ b/ci/compile-tests/004-dependency-cycle/e.v
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/004-dependency-cycle/f.v 
b/ci/compile-tests/004-dependency-cycle/f.v
index e3f5da5fa3..ff9842d106 100644
--- a/ci/compile-tests/004-dependency-cycle/f.v
+++ b/ci/compile-tests/004-dependency-cycle/f.v
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/004-dependency-cycle/runtest.el 
b/ci/compile-tests/004-dependency-cycle/runtest.el
index 97d60fb59d..143cf7a24b 100644
--- a/ci/compile-tests/004-dependency-cycle/runtest.el
+++ b/ci/compile-tests/004-dependency-cycle/runtest.el
@@ -1,11 +1,11 @@
-;; This file is part of Proof General.
+;; This file is part of Proof General.  -*- lexical-binding: t; -*-
 ;;
 ;; © Copyright 2020  Hendrik Tews
 ;;
 ;; Authors: Hendrik Tews
 ;; Maintainer: Hendrik Tews <hendrik@askra.de>
 ;;
-;; License:     GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
@@ -26,7 +26,7 @@
 
 
 ;; require cct-lib for the elisp compilation, otherwise this is present already
-(require 'cct-lib)
+(require 'cct-lib "ci/compile-tests/cct-lib")
 
 ;;; set configuration
 (cct-configure-proof-general)
diff --git a/ci/compile-tests/005-change-recompile/Makefile 
b/ci/compile-tests/005-change-recompile/Makefile
index 4cdc65039d..8299006e83 100644
--- a/ci/compile-tests/005-change-recompile/Makefile
+++ b/ci/compile-tests/005-change-recompile/Makefile
@@ -5,7 +5,7 @@
 # Authors: Hendrik Tews
 # Maintainer: Hendrik Tews <hendrik@askra.de>
 # 
-# License:     GPL (GNU GENERAL PUBLIC LICENSE)
+# SPDX-License-Identifier: GPL-3.0-or-later
 
 
 # This test modifies some .v files during the test. The original
diff --git a/ci/compile-tests/005-change-recompile/a.v.orig 
b/ci/compile-tests/005-change-recompile/a.v.orig
index f3d28e82ab..c320a9b1c6 100644
--- a/ci/compile-tests/005-change-recompile/a.v.orig
+++ b/ci/compile-tests/005-change-recompile/a.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/005-change-recompile/b.v.orig 
b/ci/compile-tests/005-change-recompile/b.v.orig
index 0354f63555..16b61f1623 100644
--- a/ci/compile-tests/005-change-recompile/b.v.orig
+++ b/ci/compile-tests/005-change-recompile/b.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/005-change-recompile/c.v.orig 
b/ci/compile-tests/005-change-recompile/c.v.orig
index 0dd52b4b79..ad28b37116 100644
--- a/ci/compile-tests/005-change-recompile/c.v.orig
+++ b/ci/compile-tests/005-change-recompile/c.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/005-change-recompile/d.v.orig 
b/ci/compile-tests/005-change-recompile/d.v.orig
index 8c984eb319..b8800ed610 100644
--- a/ci/compile-tests/005-change-recompile/d.v.orig
+++ b/ci/compile-tests/005-change-recompile/d.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/005-change-recompile/e.v.orig 
b/ci/compile-tests/005-change-recompile/e.v.orig
index dcef3a6ee7..75e9a573cb 100644
--- a/ci/compile-tests/005-change-recompile/e.v.orig
+++ b/ci/compile-tests/005-change-recompile/e.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/005-change-recompile/f.v.orig 
b/ci/compile-tests/005-change-recompile/f.v.orig
index ef17405a96..09c3bc23e6 100644
--- a/ci/compile-tests/005-change-recompile/f.v.orig
+++ b/ci/compile-tests/005-change-recompile/f.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/005-change-recompile/g.v.orig 
b/ci/compile-tests/005-change-recompile/g.v.orig
index fbc58fed9e..84285e5aca 100644
--- a/ci/compile-tests/005-change-recompile/g.v.orig
+++ b/ci/compile-tests/005-change-recompile/g.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/005-change-recompile/h.v.orig 
b/ci/compile-tests/005-change-recompile/h.v.orig
index 1a0f57f7df..002abb3883 100644
--- a/ci/compile-tests/005-change-recompile/h.v.orig
+++ b/ci/compile-tests/005-change-recompile/h.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/005-change-recompile/runtest.el 
b/ci/compile-tests/005-change-recompile/runtest.el
index 825ad83469..2110fd5a21 100644
--- a/ci/compile-tests/005-change-recompile/runtest.el
+++ b/ci/compile-tests/005-change-recompile/runtest.el
@@ -1,11 +1,11 @@
-;; This file is part of Proof General.
+;; This file is part of Proof General.  -*- lexical-binding: t; -*-
 ;;
 ;; © Copyright 2020  Hendrik Tews
 ;;
 ;; Authors: Hendrik Tews
 ;; Maintainer: Hendrik Tews <hendrik@askra.de>
 ;;
-;; License:     GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
@@ -36,7 +36,7 @@
 ;;
 
 ;; require cct-lib for the elisp compilation, otherwise this is present already
-(require 'cct-lib)
+(require 'cct-lib "ci/compile-tests/cct-lib")
 
 ;;; set configuration
 (cct-configure-proof-general)
@@ -53,7 +53,7 @@
   "All ancestors.")
 
 (defconst all-compiled-ancestors
-  (mapcar 'cct-library-vo-of-v-file all-ancestors)
+  (mapcar #'cct-library-vo-of-v-file all-ancestors)
   "All vo ancestors files.")
   
 
diff --git a/ci/compile-tests/006-ready-dependee/Makefile 
b/ci/compile-tests/006-ready-dependee/Makefile
index eb6223013d..8ef96dc226 100644
--- a/ci/compile-tests/006-ready-dependee/Makefile
+++ b/ci/compile-tests/006-ready-dependee/Makefile
@@ -5,7 +5,7 @@
 # Authors: Hendrik Tews
 # Maintainer: Hendrik Tews <hendrik@askra.de>
 # 
-# License:     GPL (GNU GENERAL PUBLIC LICENSE)
+# SPDX-License-Identifier: GPL-3.0-or-later
 
 
 # This test modifies some .v files during the test. The original
diff --git a/ci/compile-tests/006-ready-dependee/a.v.orig 
b/ci/compile-tests/006-ready-dependee/a.v.orig
index 8e4300e8eb..7465b894c9 100644
--- a/ci/compile-tests/006-ready-dependee/a.v.orig
+++ b/ci/compile-tests/006-ready-dependee/a.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/006-ready-dependee/b.v.orig 
b/ci/compile-tests/006-ready-dependee/b.v.orig
index 0354f63555..16b61f1623 100644
--- a/ci/compile-tests/006-ready-dependee/b.v.orig
+++ b/ci/compile-tests/006-ready-dependee/b.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/006-ready-dependee/c.v.orig 
b/ci/compile-tests/006-ready-dependee/c.v.orig
index 3d2e542c40..f6768101b3 100644
--- a/ci/compile-tests/006-ready-dependee/c.v.orig
+++ b/ci/compile-tests/006-ready-dependee/c.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/006-ready-dependee/d.v.orig 
b/ci/compile-tests/006-ready-dependee/d.v.orig
index 2f9825cbd7..28ebb5bf39 100644
--- a/ci/compile-tests/006-ready-dependee/d.v.orig
+++ b/ci/compile-tests/006-ready-dependee/d.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/006-ready-dependee/e.v.orig 
b/ci/compile-tests/006-ready-dependee/e.v.orig
index 0589d31b34..01fce56435 100644
--- a/ci/compile-tests/006-ready-dependee/e.v.orig
+++ b/ci/compile-tests/006-ready-dependee/e.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/006-ready-dependee/f.v.orig 
b/ci/compile-tests/006-ready-dependee/f.v.orig
index 32c9287b51..aab05c27d9 100644
--- a/ci/compile-tests/006-ready-dependee/f.v.orig
+++ b/ci/compile-tests/006-ready-dependee/f.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/006-ready-dependee/g.v.orig 
b/ci/compile-tests/006-ready-dependee/g.v.orig
index 73b210c13e..26ffdd9801 100644
--- a/ci/compile-tests/006-ready-dependee/g.v.orig
+++ b/ci/compile-tests/006-ready-dependee/g.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/006-ready-dependee/h.v.orig 
b/ci/compile-tests/006-ready-dependee/h.v.orig
index 5db2c3ca33..0830c202dc 100644
--- a/ci/compile-tests/006-ready-dependee/h.v.orig
+++ b/ci/compile-tests/006-ready-dependee/h.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/006-ready-dependee/i.v.orig 
b/ci/compile-tests/006-ready-dependee/i.v.orig
index 09135c38ac..4e1dd16516 100644
--- a/ci/compile-tests/006-ready-dependee/i.v.orig
+++ b/ci/compile-tests/006-ready-dependee/i.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/006-ready-dependee/j.v.orig 
b/ci/compile-tests/006-ready-dependee/j.v.orig
index 62702b4fc2..f39a5c36ef 100644
--- a/ci/compile-tests/006-ready-dependee/j.v.orig
+++ b/ci/compile-tests/006-ready-dependee/j.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/006-ready-dependee/k.v.orig 
b/ci/compile-tests/006-ready-dependee/k.v.orig
index 7405e2c95d..dde1805060 100644
--- a/ci/compile-tests/006-ready-dependee/k.v.orig
+++ b/ci/compile-tests/006-ready-dependee/k.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/006-ready-dependee/runtest.el 
b/ci/compile-tests/006-ready-dependee/runtest.el
index 9f4a2ce0b7..7e96bb32bb 100644
--- a/ci/compile-tests/006-ready-dependee/runtest.el
+++ b/ci/compile-tests/006-ready-dependee/runtest.el
@@ -1,11 +1,11 @@
-;; This file is part of Proof General.
+;; This file is part of Proof General.  -*- lexical-binding: t; -*-
 ;;
 ;; © Copyright 2020  Hendrik Tews
 ;;
 ;; Authors: Hendrik Tews
 ;; Maintainer: Hendrik Tews <hendrik@askra.de>
 ;;
-;; License:     GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
@@ -35,7 +35,7 @@
 
 
 ;; require cct-lib for the elisp compilation, otherwise this is present already
-(require 'cct-lib)
+(require 'cct-lib "ci/compile-tests/cct-lib")
 
 ;;; set configuration
 (cct-configure-proof-general)
@@ -53,7 +53,7 @@
   "All ancestors.")
 
 (defconst all-compiled-ancestors
-  (mapcar 'cct-library-vo-of-v-file all-ancestors)
+  (mapcar #'cct-library-vo-of-v-file all-ancestors)
   "All vo ancestors files.")
 
 (defun cct-replace-last-word (line word)
diff --git a/ci/compile-tests/007-slow-require/Makefile 
b/ci/compile-tests/007-slow-require/Makefile
index b99eebc1dc..33b099a144 100644
--- a/ci/compile-tests/007-slow-require/Makefile
+++ b/ci/compile-tests/007-slow-require/Makefile
@@ -5,7 +5,7 @@
 # Authors: Hendrik Tews
 # Maintainer: Hendrik Tews <hendrik@askra.de>
 # 
-# License:     GPL (GNU GENERAL PUBLIC LICENSE)
+# SPDX-License-Identifier: GPL-3.0-or-later
 
 
 # This test modifies some .v files during the test. The original
@@ -19,6 +19,11 @@ TEST_SOURCES:=\
        a5.v b5.v c5.v d5.v \
        a6.v b6.v c6.v d6.v
 
+# This test uses ../bin/compile-test-start-delayed to start certain
+# commands with specified delays to check carfully constructed
+# internal states. compile-test-start-delayed outputs diagnostics on
+# file descriptor 9, which bypasses emacs and is joined with stderr of
+# the current make. Open file descriptor 9 here.
 .PHONY: test
 test:
        $(MAKE) clean
diff --git a/ci/compile-tests/007-slow-require/a1.v.orig 
b/ci/compile-tests/007-slow-require/a1.v.orig
index 6b3e334984..2faef8399b 100644
--- a/ci/compile-tests/007-slow-require/a1.v.orig
+++ b/ci/compile-tests/007-slow-require/a1.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/007-slow-require/a2.v.orig 
b/ci/compile-tests/007-slow-require/a2.v.orig
index 60ac1279ce..5eeb398c58 100644
--- a/ci/compile-tests/007-slow-require/a2.v.orig
+++ b/ci/compile-tests/007-slow-require/a2.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/007-slow-require/a3.v.orig 
b/ci/compile-tests/007-slow-require/a3.v.orig
index 8337b2ade3..13a39371ea 100644
--- a/ci/compile-tests/007-slow-require/a3.v.orig
+++ b/ci/compile-tests/007-slow-require/a3.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/007-slow-require/a4.v.orig 
b/ci/compile-tests/007-slow-require/a4.v.orig
index fd5d4b6034..91488d4cfd 100644
--- a/ci/compile-tests/007-slow-require/a4.v.orig
+++ b/ci/compile-tests/007-slow-require/a4.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/007-slow-require/a5.v.orig 
b/ci/compile-tests/007-slow-require/a5.v.orig
index b6d7edbbc1..e79a3ea0c0 100644
--- a/ci/compile-tests/007-slow-require/a5.v.orig
+++ b/ci/compile-tests/007-slow-require/a5.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/007-slow-require/a6.v.orig 
b/ci/compile-tests/007-slow-require/a6.v.orig
index a9bb279fa3..b18b427227 100644
--- a/ci/compile-tests/007-slow-require/a6.v.orig
+++ b/ci/compile-tests/007-slow-require/a6.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/007-slow-require/b1.v.orig 
b/ci/compile-tests/007-slow-require/b1.v.orig
index 926bed1dae..0a0afe538b 100644
--- a/ci/compile-tests/007-slow-require/b1.v.orig
+++ b/ci/compile-tests/007-slow-require/b1.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -23,5 +23,5 @@
 
 Require Export d1.
 
-(* This is line 27 *)
+(* This is line 26 *)
 Definition b : nat := 2.
diff --git a/ci/compile-tests/007-slow-require/b2.v.orig 
b/ci/compile-tests/007-slow-require/b2.v.orig
index b9cff7ea3a..2f830b9d4d 100644
--- a/ci/compile-tests/007-slow-require/b2.v.orig
+++ b/ci/compile-tests/007-slow-require/b2.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/007-slow-require/b3.v.orig 
b/ci/compile-tests/007-slow-require/b3.v.orig
index 51ab7a2f93..c44ebb61c5 100644
--- a/ci/compile-tests/007-slow-require/b3.v.orig
+++ b/ci/compile-tests/007-slow-require/b3.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -23,5 +23,5 @@
 
 Require Export d3.
 
-(* This is line 27 *)
+(* This is line 26 *)
 Definition b : nat := 2.
diff --git a/ci/compile-tests/007-slow-require/b4.v.orig 
b/ci/compile-tests/007-slow-require/b4.v.orig
index fd8d331ea1..3d000e0118 100644
--- a/ci/compile-tests/007-slow-require/b4.v.orig
+++ b/ci/compile-tests/007-slow-require/b4.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -23,5 +23,5 @@
 
 Require Export d4.
 
-(* This is line 27 *)
+(* This is line 26 *)
 Definition b : nat := 2.
diff --git a/ci/compile-tests/007-slow-require/b5.v.orig 
b/ci/compile-tests/007-slow-require/b5.v.orig
index 3fec38a35e..fbcfb5c66c 100644
--- a/ci/compile-tests/007-slow-require/b5.v.orig
+++ b/ci/compile-tests/007-slow-require/b5.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -23,5 +23,5 @@
 
 Require Export d5.
 
-(* This is line 27 *)
+(* This is line 26 *)
 Definition b : nat := 2.
diff --git a/ci/compile-tests/007-slow-require/b6.v.orig 
b/ci/compile-tests/007-slow-require/b6.v.orig
index 2b957e6ef8..1e3e54fdb4 100644
--- a/ci/compile-tests/007-slow-require/b6.v.orig
+++ b/ci/compile-tests/007-slow-require/b6.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -23,5 +23,5 @@
 
 Require Export d6.
 
-(* This is line 27 *)
+(* This is line 26 *)
 Definition b : nat := 2.
diff --git a/ci/compile-tests/007-slow-require/c1.v.orig 
b/ci/compile-tests/007-slow-require/c1.v.orig
index 9df47c9b0d..369b419922 100644
--- a/ci/compile-tests/007-slow-require/c1.v.orig
+++ b/ci/compile-tests/007-slow-require/c1.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/007-slow-require/c2.v.orig 
b/ci/compile-tests/007-slow-require/c2.v.orig
index b8db747415..4c76c4a3ec 100644
--- a/ci/compile-tests/007-slow-require/c2.v.orig
+++ b/ci/compile-tests/007-slow-require/c2.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/007-slow-require/c3.v.orig 
b/ci/compile-tests/007-slow-require/c3.v.orig
index 04b225abec..e68f940cff 100644
--- a/ci/compile-tests/007-slow-require/c3.v.orig
+++ b/ci/compile-tests/007-slow-require/c3.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/007-slow-require/c4.v.orig 
b/ci/compile-tests/007-slow-require/c4.v.orig
index 400a8a6c83..648b554fe1 100644
--- a/ci/compile-tests/007-slow-require/c4.v.orig
+++ b/ci/compile-tests/007-slow-require/c4.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/007-slow-require/c5.v.orig 
b/ci/compile-tests/007-slow-require/c5.v.orig
index 2fa5a6128a..e282c5190d 100644
--- a/ci/compile-tests/007-slow-require/c5.v.orig
+++ b/ci/compile-tests/007-slow-require/c5.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/007-slow-require/c6.v.orig 
b/ci/compile-tests/007-slow-require/c6.v.orig
index fd0289bf96..8cc39988ce 100644
--- a/ci/compile-tests/007-slow-require/c6.v.orig
+++ b/ci/compile-tests/007-slow-require/c6.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/007-slow-require/d1.v.orig
index fec9578782..312a9dbb96 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/007-slow-require/d1.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/007-slow-require/d2.v.orig 
b/ci/compile-tests/007-slow-require/d2.v.orig
index fec9578782..312a9dbb96 100644
--- a/ci/compile-tests/007-slow-require/d2.v.orig
+++ b/ci/compile-tests/007-slow-require/d2.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/007-slow-require/d3.v.orig 
b/ci/compile-tests/007-slow-require/d3.v.orig
index fec9578782..312a9dbb96 100644
--- a/ci/compile-tests/007-slow-require/d3.v.orig
+++ b/ci/compile-tests/007-slow-require/d3.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/007-slow-require/d4.v.orig 
b/ci/compile-tests/007-slow-require/d4.v.orig
index fec9578782..312a9dbb96 100644
--- a/ci/compile-tests/007-slow-require/d4.v.orig
+++ b/ci/compile-tests/007-slow-require/d4.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/007-slow-require/d5.v.orig 
b/ci/compile-tests/007-slow-require/d5.v.orig
index d2fae3f695..d6d0e62e68 100644
--- a/ci/compile-tests/007-slow-require/d5.v.orig
+++ b/ci/compile-tests/007-slow-require/d5.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/007-slow-require/d6.v.orig 
b/ci/compile-tests/007-slow-require/d6.v.orig
index b60d54a6d1..f1b086ab7c 100644
--- a/ci/compile-tests/007-slow-require/d6.v.orig
+++ b/ci/compile-tests/007-slow-require/d6.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
diff --git a/ci/compile-tests/007-slow-require/runtest.el 
b/ci/compile-tests/007-slow-require/runtest.el
index 52c2f392c6..6696aa1bcc 100644
--- a/ci/compile-tests/007-slow-require/runtest.el
+++ b/ci/compile-tests/007-slow-require/runtest.el
@@ -1,11 +1,11 @@
-;; This file is part of Proof General.
+;; This file is part of Proof General.  -*- lexical-binding: t; -*-
 ;; 
 ;; © Copyright 2021  Hendrik Tews
 ;; 
 ;; Authors: Hendrik Tews
 ;; Maintainer: Hendrik Tews <hendrik@askra.de>
 ;; 
-;; License:     GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
@@ -17,7 +17,11 @@
 ;; in each possible state. For specifying the different delays there
 ;; are 6 mini projects, one for each test in this file. Each project
 ;; consists of four files, a1.v, b1.v, c1.v and d1.v for the first one
-;; and a6.v, b6.v, c6.v and d6.v for the sixth one.
+;; and a6.v, b6.v, c6.v and d6.v for the sixth one. Each project is
+;; one ert test, described further below. In each project or test, the
+;; top level require commands are asserted and retracted several times
+;; with changes in different files to test (almost) all possible
+;; internal state combinations.
 ;;
 ;; The dependencies are the same in all projects:
 ;; 
@@ -50,7 +54,7 @@
 ;; state enqueued-coqc.
 
 ;; require cct-lib for the elisp compilation, otherwise this is present already
-(require 'cct-lib)
+(require 'cct-lib "ci/compile-tests/cct-lib")
 
 ;;; set configuration
 (cct-configure-proof-general)
@@ -79,7 +83,7 @@
 
 (defun all-compiled-ancestors (n)
   "All vo ancestor files for part N."
-  (mapcar 'cct-library-vo-of-v-file (all-ancestors n)))
+  (mapcar #'cct-library-vo-of-v-file (all-ancestors n)))
 
 (defun check-main-buffer (n vo-times new-sum recompiled-files
                                        other-locked-files)
diff --git a/ci/compile-tests/007-slow-require/Makefile 
b/ci/compile-tests/008-default-dir/Makefile
similarity index 61%
copy from ci/compile-tests/007-slow-require/Makefile
copy to ci/compile-tests/008-default-dir/Makefile
index b99eebc1dc..f063efac83 100644
--- a/ci/compile-tests/007-slow-require/Makefile
+++ b/ci/compile-tests/008-default-dir/Makefile
@@ -5,20 +5,19 @@
 # Authors: Hendrik Tews
 # Maintainer: Hendrik Tews <hendrik@askra.de>
 # 
-# License:     GPL (GNU GENERAL PUBLIC LICENSE)
+# SPDX-License-Identifier: GPL-3.0-or-later
 
 
 # This test modifies some .v files during the test. The original
 # versions are in .v.orig files. They are moved to the corresponding
 # .v files before the test starts.
-TEST_SOURCES:=\
-       a1.v b1.v c1.v d1.v \
-       a2.v b2.v c2.v d2.v \
-       a3.v b3.v c3.v d3.v \
-       a4.v b4.v c4.v d4.v \
-       a5.v b5.v c5.v d5.v \
-       a6.v b6.v c6.v d6.v
+TEST_SOURCES:= a.v b.v c.v
 
+# This test uses ../bin/compile-test-start-delayed to start certain
+# commands with specified delays to check carfully constructed
+# internal states. compile-test-start-delayed outputs diagnostics on
+# file descriptor 9, which bypasses emacs and is joined with stderr of
+# the current make. Open file descriptor 9 here.
 .PHONY: test
 test:
        $(MAKE) clean
diff --git a/ci/compile-tests/007-slow-require/a5.v.orig 
b/ci/compile-tests/008-default-dir/a.v.orig
similarity index 70%
copy from ci/compile-tests/007-slow-require/a5.v.orig
copy to ci/compile-tests/008-default-dir/a.v.orig
index b6d7edbbc1..00c53443cc 100644
--- a/ci/compile-tests/007-slow-require/a5.v.orig
+++ b/ci/compile-tests/008-default-dir/a.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -22,20 +22,19 @@
 
 
 (* This is line 24 *)
-Require Export b5.
-Require Export c5.
-(* This is line 27 *)
+Require Export (* coqdep-delay 1 *) b.
+(* This is line 26 *)
 
 
-(* This is line 30 *)
-Definition sum : nat := 9.
+(* This is line 29 *)
+Definition sum : nat := 5.
 
 
-(* This is line 34 *)
-Lemma x : b + c + d = sum.
+(* This is line 33 *)
+Lemma x : b + c = sum.
 Proof using.
-  unfold b, c, d, sum in *.
+  unfold b, c, sum in *.
   simpl.
   trivial.
 Qed.
-(* This is line 41 *)
+(* This is line 40 *)
diff --git a/ci/compile-tests/006-ready-dependee/b.v.orig 
b/ci/compile-tests/008-default-dir/b.v.orig
similarity index 81%
copy from ci/compile-tests/006-ready-dependee/b.v.orig
copy to ci/compile-tests/008-default-dir/b.v.orig
index 0354f63555..37d8c98488 100644
--- a/ci/compile-tests/006-ready-dependee/b.v.orig
+++ b/ci/compile-tests/008-default-dir/b.v.orig
@@ -1,11 +1,11 @@
 (* This file is part of Proof General.
  *
- * © Copyright 2020  Hendrik Tews
+ * © Copyright 2021  Hendrik Tews
  *
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -17,7 +17,7 @@
  *)
 
 
-Require Export d.
+Require Export c.
 
 (* This is line 22 *)
 Definition b : nat := 2.
diff --git a/ci/compile-tests/006-ready-dependee/c.v.orig 
b/ci/compile-tests/008-default-dir/c.v.orig
similarity index 81%
copy from ci/compile-tests/006-ready-dependee/c.v.orig
copy to ci/compile-tests/008-default-dir/c.v.orig
index 3d2e542c40..f3e09eb825 100644
--- a/ci/compile-tests/006-ready-dependee/c.v.orig
+++ b/ci/compile-tests/008-default-dir/c.v.orig
@@ -1,11 +1,11 @@
 (* This file is part of Proof General.
  *
- * © Copyright 2020  Hendrik Tews
+ * © Copyright 2021  Hendrik Tews
  *
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -17,7 +17,7 @@
  *)
 
 
-Require Export k.
+
 
 (* This is line 22 *)
 Definition c : nat := 3.
diff --git a/ci/compile-tests/008-default-dir/runtest.el 
b/ci/compile-tests/008-default-dir/runtest.el
new file mode 100644
index 0000000000..e4c3f4e184
--- /dev/null
+++ b/ci/compile-tests/008-default-dir/runtest.el
@@ -0,0 +1,143 @@
+;; This file is part of Proof General.  -*- lexical-binding: t; -*-
+;; 
+;; © Copyright 2021  Hendrik Tews
+;; 
+;; Authors: Hendrik Tews
+;; Maintainer: Hendrik Tews <hendrik@askra.de>
+;; 
+;; SPDX-License-Identifier: GPL-3.0-or-later
+
+;;; Commentary:
+;;
+;; Coq Compile Tests (cct) --
+;; ert tests for parallel background compilation for Coq
+;;
+;; Test that default-directory is correctly set independently of the
+;; current buffer in the foreground.
+;;
+;; The dependencies in this test are:
+;; 
+;;           a
+;;           |
+;;           b
+;;           |
+;;           c
+;;
+
+
+;; require cct-lib for the elisp compilation, otherwise this is present already
+(require 'cct-lib "ci/compile-tests/cct-lib")
+
+;;; set configuration
+(cct-configure-proof-general)
+(configure-delayed-coq)    
+
+(defconst all-ancestors '("./b.v" "./c.v")
+  "All ancestors.")
+
+(defconst all-compiled-ancestors
+  (mapcar #'cct-library-vo-of-v-file all-ancestors)
+  "All vo ancestors files.")
+
+(defun check-main-buffer (vo-times new-sum recompiled-files
+                                       other-locked-files)
+  "Perform various checks in buffer a.v.
+See `cct-generic-check-main-buffer'."
+  (cct-generic-check-main-buffer
+   "a.v"                                ; main-buf
+   24                                   ; main-unlocked
+   40                                   ; main-locked
+   30                                   ; main-sum-line
+   new-sum
+   vo-times
+   recompiled-files
+   `((25 . ,all-ancestors))             ; require-ancestors
+   other-locked-files
+   23                                   ; other-locked-line
+   ))
+
+
+;;; The test itself
+
+(ert-deftest test-default-dir ()
+  "`default-directory' test.
+Test that `default-directory' is correctly set independently of the
+current buffer in the foreground."
+  (let (vo-times av-buffer ci-buffer other-locked-files
+        vok-times vos-vio-files)
+
+    ;; (setq cct--debug-tests t)
+    ;; (setq coq--debug-auto-compilation t)
+    (find-file "a.v")
+    (setq av-buffer (current-buffer))
+
+    (message
+     "coqdep: %s\ncoqc: %s\nPATH %s\nexec-path: %s\ndetected coq version: %s"
+     coq-dependency-analyzer
+     coq-compiler
+     (getenv "PATH")
+     exec-path
+     coq-autodetected-version)
+
+    (find-file "../..")
+    (setq ci-buffer (current-buffer))
+
+    (add-hook 'cct-before-busy-waiting-hook (lambda () (set-buffer ci-buffer)))
+    (add-hook 'cct-after-busy-waiting-hook (lambda () (set-buffer av-buffer)))
+
+    ;; 1. process original content - compile everything
+    (message "\n1. process original content - compile everything\n")
+    (check-main-buffer vo-times "5" nil other-locked-files)
+    (setq vo-times (cct-record-change-times all-compiled-ancestors))
+
+    ;; 2. retract and process again - nothing should be compiled
+    (message "\n2. retract and process again - nothing should be compiled\n")
+    (cct-process-to-line 21)
+    (check-main-buffer vo-times "5" nil other-locked-files)
+
+    ;; 3. change b and process again - only b should get compiled
+    (message "\n3. change b and process again - only b should get compiled\n")
+    (find-file "b.v")
+    (push "b.v" other-locked-files)
+    (cct-check-locked 23 'locked)
+    (cct-replace-last-word 23 "3")
+    (check-main-buffer vo-times "6" '("./b.vo") other-locked-files)
+    (setq vo-times (cct-record-change-times all-compiled-ancestors))
+
+    ;; 4. change c and process again - b and c should get compiled
+    (message "\n4. change c and process again - b and c should get compiled\n")
+    (find-file "c.v")
+    (push "c.v" other-locked-files)
+    (cct-check-locked 23 'locked)
+    (cct-replace-last-word 23 "5")
+    (check-main-buffer vo-times "8" '("./b.vo" "./c.vo") other-locked-files)
+    (setq vo-times (cct-record-change-times all-compiled-ancestors))
+
+    ;; 5. change b and c and reprocess with vos-and-vok/quick-and-vio2vo
+    (message
+     "\n5. change b and c and reprocess with vos-and-vok/quick-and-vio2vo\n")
+    (if (coq--post-v811)
+        (setq coq-compile-vos 'vos-and-vok
+              vos-vio-files '("./b.vos" "./c.vos")
+              vok-times (cct-record-change-times '("./b.vok" "./c.vok")))
+      (setq coq-compile-quick 'quick-and-vio2vo
+            vos-vio-files '("./b.vio" "./c.vio")))
+
+    (set-buffer "b.v")
+    (cct-check-locked 23 'locked)
+    (cct-replace-last-word 23 "7")
+    (set-buffer "c.v")
+    (cct-check-locked 23 'unlocked)
+    (cct-replace-last-word 23 "10")
+    (check-main-buffer nil "17" nil other-locked-files)
+
+    (cct-files-are-readable vos-vio-files)
+    ;; this will switch to a different default-directory, see the
+    ;; hooks above
+    (cct-wait-for-second-stage)
+    (if (coq--post-v811)
+        (progn
+          (cct-older-change-times vok-times)
+          (cct-unmodified-change-times vo-times))
+      (cct-older-change-times vo-times))
+    ))
diff --git a/ci/compile-tests/009-failure-processing/Makefile 
b/ci/compile-tests/009-failure-processing/Makefile
new file mode 100644
index 0000000000..f7bc08df7f
--- /dev/null
+++ b/ci/compile-tests/009-failure-processing/Makefile
@@ -0,0 +1,44 @@
+# This file is part of Proof General.
+# 
+# © Copyright 2021  Hendrik Tews
+# 
+# Authors: Hendrik Tews
+# Maintainer: Hendrik Tews <hendrik@askra.de>
+# 
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+
+# This test modifies some .v files during the test. The original
+# versions are in .v.orig files. They are moved to the corresponding
+# .v files before the test starts.
+TEST_SOURCES:=\
+       a1.v b1.v c1.v d1.v e1.v f1.v g1.v h1.v \
+       a2.v b2.v c2.v d2.v e2.v f2.v g2.v h2.v \
+       a3.v b3.v c3.v d3.v e3.v f3.v g3.v h3.v \
+       a4.v b4.v c4.v d4.v e4.v f4.v g4.v h4.v \
+       a5.v b5.v c5.v d5.v e5.v f5.v g5.v h5.v \
+       a6.v b6.v c6.v d6.v e6.v f6.v g6.v h6.v \
+       a7.v b7.v c7.v d7.v e7.v f7.v g7.v h7.v \
+       a8.v b8.v c8.v d8.v e8.v f8.v g8.v h8.v \
+       a9.v b9.v c9.v d9.v e9.v f9.v g9.v h9.v \
+       a10.v b10.v c10.v d10.v e10.v f10.v g10.v h10.v
+
+# This test uses ../bin/compile-test-start-delayed to start certain
+# commands with specified delays to check carfully constructed
+# internal states. compile-test-start-delayed outputs diagnostics on
+# file descriptor 9, which bypasses emacs and is joined with stderr of
+# the current make. Open file descriptor 9 here.
+.PHONY: test
+test:
+       $(MAKE) clean
+       $(MAKE) $(TEST_SOURCES)
+       emacs -batch -l ../../../generic/proof-site.el -l ../cct-lib.el \
+               -l runtest.el -f ert-run-tests-batch-and-exit \
+               9>&1
+
+%.v: %.v.orig
+       cp $< $@
+
+.PHONY: clean
+clean:
+       rm -f *.vo *.glob *.vio *.vos *.vok .*.aux *.X $(TEST_SOURCES)
diff --git a/ci/compile-tests/007-slow-require/a1.v.orig 
b/ci/compile-tests/009-failure-processing/a1.v.orig
similarity index 50%
copy from ci/compile-tests/007-slow-require/a1.v.orig
copy to ci/compile-tests/009-failure-processing/a1.v.orig
index 6b3e334984..c1409aeb7e 100644
--- a/ci/compile-tests/007-slow-require/a1.v.orig
+++ b/ci/compile-tests/009-failure-processing/a1.v.orig
@@ -5,15 +5,15 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
- * compilation in coq-par-compile.el. See test.el in this directory.
+ * compilation in coq-par-compile.el. See runtest.el in this directory.
  *)
 
 (* The test script relies on absolute line numbers. 
- * DO NOT INSERT ANY LINE UNLESS YOU KNOW WHAT YOU ARE DOING.
+ * DO NOT INSERT/DELETE ANY LINE UNLESS YOU KNOW WHAT YOU ARE DOING.
  *)
 
 (* The delay for coqdep is specified in comments with key coqdep-delay,
@@ -23,19 +23,6 @@
 
 (* This is line 24 *)
 Require Export b1.
-Require Export (* coqdep-delay 2 *) c1.
-(* This is line 27 *)
-
-
-(* This is line 30 *)
-Definition sum : nat := 9.
-
-
-(* This is line 34 *)
-Lemma x : b + c + d = sum.
-Proof using.
-  unfold b, c, d, sum in *.
-  simpl.
-  trivial.
-Qed.
-(* This is line 41 *)
+Require Export c1.
+Require Export d1.
+(* This is line 28 *)
diff --git a/ci/compile-tests/007-slow-require/a5.v.orig 
b/ci/compile-tests/009-failure-processing/a10.v.orig
similarity index 50%
copy from ci/compile-tests/007-slow-require/a5.v.orig
copy to ci/compile-tests/009-failure-processing/a10.v.orig
index b6d7edbbc1..543bc5a759 100644
--- a/ci/compile-tests/007-slow-require/a5.v.orig
+++ b/ci/compile-tests/009-failure-processing/a10.v.orig
@@ -5,15 +5,15 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
- * compilation in coq-par-compile.el. See test.el in this directory.
+ * compilation in coq-par-compile.el. See runtest.el in this directory.
  *)
 
 (* The test script relies on absolute line numbers. 
- * DO NOT INSERT ANY LINE UNLESS YOU KNOW WHAT YOU ARE DOING.
+ * DO NOT INSERT/DELETE ANY LINE UNLESS YOU KNOW WHAT YOU ARE DOING.
  *)
 
 (* The delay for coqdep is specified in comments with key coqdep-delay,
@@ -22,20 +22,7 @@
 
 
 (* This is line 24 *)
-Require Export b5.
-Require Export c5.
-(* This is line 27 *)
-
-
-(* This is line 30 *)
-Definition sum : nat := 9.
-
-
-(* This is line 34 *)
-Lemma x : b + c + d = sum.
-Proof using.
-  unfold b, c, d, sum in *.
-  simpl.
-  trivial.
-Qed.
-(* This is line 41 *)
+Require Export b10.
+Require Export c10.
+Require Export d10.
+(* This is line 28 *)
diff --git a/ci/compile-tests/007-slow-require/a2.v.orig 
b/ci/compile-tests/009-failure-processing/a2.v.orig
similarity index 54%
copy from ci/compile-tests/007-slow-require/a2.v.orig
copy to ci/compile-tests/009-failure-processing/a2.v.orig
index 60ac1279ce..332934ff63 100644
--- a/ci/compile-tests/007-slow-require/a2.v.orig
+++ b/ci/compile-tests/009-failure-processing/a2.v.orig
@@ -5,15 +5,15 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
- * compilation in coq-par-compile.el. See test.el in this directory.
+ * compilation in coq-par-compile.el. See runtest.el in this directory.
  *)
 
 (* The test script relies on absolute line numbers. 
- * DO NOT INSERT ANY LINE UNLESS YOU KNOW WHAT YOU ARE DOING.
+ * DO NOT INSERT/DELETE ANY LINE UNLESS YOU KNOW WHAT YOU ARE DOING.
  *)
 
 (* The delay for coqdep is specified in comments with key coqdep-delay,
@@ -24,18 +24,5 @@
 (* This is line 24 *)
 Require Export b2.
 Require Export c2.
-(* This is line 27 *)
-
-
-(* This is line 30 *)
-Definition sum : nat := 9.
-
-
-(* This is line 34 *)
-Lemma x : b + c + d = sum.
-Proof using.
-  unfold b, c, d, sum in *.
-  simpl.
-  trivial.
-Qed.
-(* This is line 41 *)
+Require Export d2.
+(* This is line 28 *)
diff --git a/ci/compile-tests/007-slow-require/a3.v.orig 
b/ci/compile-tests/009-failure-processing/a3.v.orig
similarity index 50%
copy from ci/compile-tests/007-slow-require/a3.v.orig
copy to ci/compile-tests/009-failure-processing/a3.v.orig
index 8337b2ade3..b48788c74d 100644
--- a/ci/compile-tests/007-slow-require/a3.v.orig
+++ b/ci/compile-tests/009-failure-processing/a3.v.orig
@@ -5,15 +5,15 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
- * compilation in coq-par-compile.el. See test.el in this directory.
+ * compilation in coq-par-compile.el. See runtest.el in this directory.
  *)
 
 (* The test script relies on absolute line numbers. 
- * DO NOT INSERT ANY LINE UNLESS YOU KNOW WHAT YOU ARE DOING.
+ * DO NOT INSERT/DELETE ANY LINE UNLESS YOU KNOW WHAT YOU ARE DOING.
  *)
 
 (* The delay for coqdep is specified in comments with key coqdep-delay,
@@ -22,20 +22,7 @@
 
 
 (* This is line 24 *)
-Require Export (* coqdep-delay 2 *) b3.
+Require Export b3.
 Require Export c3.
-(* This is line 27 *)
-
-
-(* This is line 30 *)
-Definition sum : nat := 9.
-
-
-(* This is line 34 *)
-Lemma x : b + c + d = sum.
-Proof using.
-  unfold b, c, d, sum in *.
-  simpl.
-  trivial.
-Qed.
-(* This is line 41 *)
+Require Export d3.
+(* This is line 28 *)
diff --git a/ci/compile-tests/007-slow-require/a4.v.orig 
b/ci/compile-tests/009-failure-processing/a4.v.orig
similarity index 54%
copy from ci/compile-tests/007-slow-require/a4.v.orig
copy to ci/compile-tests/009-failure-processing/a4.v.orig
index fd5d4b6034..3bac801801 100644
--- a/ci/compile-tests/007-slow-require/a4.v.orig
+++ b/ci/compile-tests/009-failure-processing/a4.v.orig
@@ -5,15 +5,15 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
- * compilation in coq-par-compile.el. See test.el in this directory.
+ * compilation in coq-par-compile.el. See runtest.el in this directory.
  *)
 
 (* The test script relies on absolute line numbers. 
- * DO NOT INSERT ANY LINE UNLESS YOU KNOW WHAT YOU ARE DOING.
+ * DO NOT INSERT/DELETE ANY LINE UNLESS YOU KNOW WHAT YOU ARE DOING.
  *)
 
 (* The delay for coqdep is specified in comments with key coqdep-delay,
@@ -24,18 +24,5 @@
 (* This is line 24 *)
 Require Export b4.
 Require Export c4.
-(* This is line 27 *)
-
-
-(* This is line 30 *)
-Definition sum : nat := 9.
-
-
-(* This is line 34 *)
-Lemma x : b + c + d = sum.
-Proof using.
-  unfold b, c, d, sum in *.
-  simpl.
-  trivial.
-Qed.
-(* This is line 41 *)
+Require Export d4.
+(* This is line 28 *)
diff --git a/ci/compile-tests/007-slow-require/a5.v.orig 
b/ci/compile-tests/009-failure-processing/a5.v.orig
similarity index 54%
copy from ci/compile-tests/007-slow-require/a5.v.orig
copy to ci/compile-tests/009-failure-processing/a5.v.orig
index b6d7edbbc1..bfb3a5fb99 100644
--- a/ci/compile-tests/007-slow-require/a5.v.orig
+++ b/ci/compile-tests/009-failure-processing/a5.v.orig
@@ -5,15 +5,15 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
- * compilation in coq-par-compile.el. See test.el in this directory.
+ * compilation in coq-par-compile.el. See runtest.el in this directory.
  *)
 
 (* The test script relies on absolute line numbers. 
- * DO NOT INSERT ANY LINE UNLESS YOU KNOW WHAT YOU ARE DOING.
+ * DO NOT INSERT/DELETE ANY LINE UNLESS YOU KNOW WHAT YOU ARE DOING.
  *)
 
 (* The delay for coqdep is specified in comments with key coqdep-delay,
@@ -24,18 +24,5 @@
 (* This is line 24 *)
 Require Export b5.
 Require Export c5.
-(* This is line 27 *)
-
-
-(* This is line 30 *)
-Definition sum : nat := 9.
-
-
-(* This is line 34 *)
-Lemma x : b + c + d = sum.
-Proof using.
-  unfold b, c, d, sum in *.
-  simpl.
-  trivial.
-Qed.
-(* This is line 41 *)
+Require Export d5.
+(* This is line 28 *)
diff --git a/ci/compile-tests/007-slow-require/a6.v.orig 
b/ci/compile-tests/009-failure-processing/a6.v.orig
similarity index 54%
copy from ci/compile-tests/007-slow-require/a6.v.orig
copy to ci/compile-tests/009-failure-processing/a6.v.orig
index a9bb279fa3..c5832f0440 100644
--- a/ci/compile-tests/007-slow-require/a6.v.orig
+++ b/ci/compile-tests/009-failure-processing/a6.v.orig
@@ -5,15 +5,15 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
- * compilation in coq-par-compile.el. See test.el in this directory.
+ * compilation in coq-par-compile.el. See runtest.el in this directory.
  *)
 
 (* The test script relies on absolute line numbers. 
- * DO NOT INSERT ANY LINE UNLESS YOU KNOW WHAT YOU ARE DOING.
+ * DO NOT INSERT/DELETE ANY LINE UNLESS YOU KNOW WHAT YOU ARE DOING.
  *)
 
 (* The delay for coqdep is specified in comments with key coqdep-delay,
@@ -24,18 +24,5 @@
 (* This is line 24 *)
 Require Export b6.
 Require Export c6.
-(* This is line 27 *)
-
-
-(* This is line 30 *)
-Definition sum : nat := 9.
-
-
-(* This is line 34 *)
-Lemma x : b + c + d = sum.
-Proof using.
-  unfold b, c, d, sum in *.
-  simpl.
-  trivial.
-Qed.
-(* This is line 41 *)
+Require Export d6.
+(* This is line 28 *)
diff --git a/ci/compile-tests/007-slow-require/a5.v.orig 
b/ci/compile-tests/009-failure-processing/a7.v.orig
similarity index 50%
copy from ci/compile-tests/007-slow-require/a5.v.orig
copy to ci/compile-tests/009-failure-processing/a7.v.orig
index b6d7edbbc1..9f0724ca08 100644
--- a/ci/compile-tests/007-slow-require/a5.v.orig
+++ b/ci/compile-tests/009-failure-processing/a7.v.orig
@@ -5,15 +5,15 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
- * compilation in coq-par-compile.el. See test.el in this directory.
+ * compilation in coq-par-compile.el. See runtest.el in this directory.
  *)
 
 (* The test script relies on absolute line numbers. 
- * DO NOT INSERT ANY LINE UNLESS YOU KNOW WHAT YOU ARE DOING.
+ * DO NOT INSERT/DELETE ANY LINE UNLESS YOU KNOW WHAT YOU ARE DOING.
  *)
 
 (* The delay for coqdep is specified in comments with key coqdep-delay,
@@ -22,20 +22,7 @@
 
 
 (* This is line 24 *)
-Require Export b5.
-Require Export c5.
-(* This is line 27 *)
-
-
-(* This is line 30 *)
-Definition sum : nat := 9.
-
-
-(* This is line 34 *)
-Lemma x : b + c + d = sum.
-Proof using.
-  unfold b, c, d, sum in *.
-  simpl.
-  trivial.
-Qed.
-(* This is line 41 *)
+Require Export b7.
+Require Export c7.
+Require Export d7.
+(* This is line 28 *)
diff --git a/ci/compile-tests/007-slow-require/a5.v.orig 
b/ci/compile-tests/009-failure-processing/a8.v.orig
similarity index 50%
copy from ci/compile-tests/007-slow-require/a5.v.orig
copy to ci/compile-tests/009-failure-processing/a8.v.orig
index b6d7edbbc1..bc00d9c14c 100644
--- a/ci/compile-tests/007-slow-require/a5.v.orig
+++ b/ci/compile-tests/009-failure-processing/a8.v.orig
@@ -5,15 +5,15 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
- * compilation in coq-par-compile.el. See test.el in this directory.
+ * compilation in coq-par-compile.el. See runtest.el in this directory.
  *)
 
 (* The test script relies on absolute line numbers. 
- * DO NOT INSERT ANY LINE UNLESS YOU KNOW WHAT YOU ARE DOING.
+ * DO NOT INSERT/DELETE ANY LINE UNLESS YOU KNOW WHAT YOU ARE DOING.
  *)
 
 (* The delay for coqdep is specified in comments with key coqdep-delay,
@@ -22,20 +22,7 @@
 
 
 (* This is line 24 *)
-Require Export b5.
-Require Export c5.
-(* This is line 27 *)
-
-
-(* This is line 30 *)
-Definition sum : nat := 9.
-
-
-(* This is line 34 *)
-Lemma x : b + c + d = sum.
-Proof using.
-  unfold b, c, d, sum in *.
-  simpl.
-  trivial.
-Qed.
-(* This is line 41 *)
+Require Export b8.
+Require Export c8.
+Require Export d8.
+(* This is line 28 *)
diff --git a/ci/compile-tests/007-slow-require/a5.v.orig 
b/ci/compile-tests/009-failure-processing/a9.v.orig
similarity index 50%
copy from ci/compile-tests/007-slow-require/a5.v.orig
copy to ci/compile-tests/009-failure-processing/a9.v.orig
index b6d7edbbc1..fe60be5134 100644
--- a/ci/compile-tests/007-slow-require/a5.v.orig
+++ b/ci/compile-tests/009-failure-processing/a9.v.orig
@@ -5,15 +5,15 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
- * compilation in coq-par-compile.el. See test.el in this directory.
+ * compilation in coq-par-compile.el. See runtest.el in this directory.
  *)
 
 (* The test script relies on absolute line numbers. 
- * DO NOT INSERT ANY LINE UNLESS YOU KNOW WHAT YOU ARE DOING.
+ * DO NOT INSERT/DELETE ANY LINE UNLESS YOU KNOW WHAT YOU ARE DOING.
  *)
 
 (* The delay for coqdep is specified in comments with key coqdep-delay,
@@ -22,20 +22,7 @@
 
 
 (* This is line 24 *)
-Require Export b5.
-Require Export c5.
-(* This is line 27 *)
-
-
-(* This is line 30 *)
-Definition sum : nat := 9.
-
-
-(* This is line 34 *)
-Lemma x : b + c + d = sum.
-Proof using.
-  unfold b, c, d, sum in *.
-  simpl.
-  trivial.
-Qed.
-(* This is line 41 *)
+Require Export b9.
+Require Export c9.
+Require Export d9.
+(* This is line 28 *)
diff --git a/ci/compile-tests/007-slow-require/d4.v.orig 
b/ci/compile-tests/009-failure-processing/b1.v.orig
similarity index 84%
copy from ci/compile-tests/007-slow-require/d4.v.orig
copy to ci/compile-tests/009-failure-processing/b1.v.orig
index fec9578782..8cc99d1b74 100644
--- a/ci/compile-tests/007-slow-require/d4.v.orig
+++ b/ci/compile-tests/009-failure-processing/b1.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -21,7 +21,4 @@
  * coqc-delay 0
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Require Export f1.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/b10.v.orig
similarity index 81%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/b10.v.orig
index fec9578782..6167891265 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/b10.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -18,10 +18,7 @@
 
 (* Specify delays for coqdep and coqc when processing this file:
  * coqdep-delay 0
- * coqc-delay 0
+ * coqc-delay 1.5
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Require Export f10.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/b2.v.orig
similarity index 81%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/b2.v.orig
index fec9578782..d6ebd0d25d 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/b2.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -18,10 +18,7 @@
 
 (* Specify delays for coqdep and coqc when processing this file:
  * coqdep-delay 0
- * coqc-delay 0
+ * coqc-delay 2
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Require Export f2.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/b3.v.orig
similarity index 81%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/b3.v.orig
index fec9578782..4e1e13d12a 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/b3.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -18,10 +18,7 @@
 
 (* Specify delays for coqdep and coqc when processing this file:
  * coqdep-delay 0
- * coqc-delay 0
+ * coqc-delay 3
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Require Export f3.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/b4.v.orig
similarity index 84%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/b4.v.orig
index fec9578782..dbd0e3e627 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/b4.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -21,7 +21,4 @@
  * coqc-delay 0
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Require Export f4.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/b5.v.orig
similarity index 81%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/b5.v.orig
index fec9578782..c995f5bac8 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/b5.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -18,10 +18,7 @@
 
 (* Specify delays for coqdep and coqc when processing this file:
  * coqdep-delay 0
- * coqc-delay 0
+ * coqc-delay 1.5
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Require Export f5.
diff --git a/ci/compile-tests/007-slow-require/d4.v.orig 
b/ci/compile-tests/009-failure-processing/b6.v.orig
similarity index 84%
copy from ci/compile-tests/007-slow-require/d4.v.orig
copy to ci/compile-tests/009-failure-processing/b6.v.orig
index fec9578782..ecaefb0679 100644
--- a/ci/compile-tests/007-slow-require/d4.v.orig
+++ b/ci/compile-tests/009-failure-processing/b6.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -21,7 +21,4 @@
  * coqc-delay 0
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Require Export f6.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/b7.v.orig
similarity index 81%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/b7.v.orig
index fec9578782..141454c5a5 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/b7.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -18,10 +18,7 @@
 
 (* Specify delays for coqdep and coqc when processing this file:
  * coqdep-delay 0
- * coqc-delay 0
+ * coqc-delay 1
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Require Export f7.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/b8.v.orig
similarity index 81%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/b8.v.orig
index fec9578782..1ceea57cad 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/b8.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -18,10 +18,7 @@
 
 (* Specify delays for coqdep and coqc when processing this file:
  * coqdep-delay 0
- * coqc-delay 0
+ * coqc-delay 1.5
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Require Export f8.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/b9.v.orig
similarity index 84%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/b9.v.orig
index fec9578782..81493d4026 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/b9.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -21,7 +21,4 @@
  * coqc-delay 0
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Require Export f9.
diff --git a/ci/compile-tests/007-slow-require/d4.v.orig 
b/ci/compile-tests/009-failure-processing/c1.v.orig
similarity index 81%
copy from ci/compile-tests/007-slow-require/d4.v.orig
copy to ci/compile-tests/009-failure-processing/c1.v.orig
index fec9578782..39d9d894cc 100644
--- a/ci/compile-tests/007-slow-require/d4.v.orig
+++ b/ci/compile-tests/009-failure-processing/c1.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -18,10 +18,7 @@
 
 (* Specify delays for coqdep and coqc when processing this file:
  * coqdep-delay 0
- * coqc-delay 0
+ * coqc-delay X
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Require Export e1 g1.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/c10.v.orig
similarity index 81%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/c10.v.orig
index fec9578782..0d69b23d56 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/c10.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -18,10 +18,7 @@
 
 (* Specify delays for coqdep and coqc when processing this file:
  * coqdep-delay 0
- * coqc-delay 0
+ * coqc-delay X
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Require Export e10 g10.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/c2.v.orig
similarity index 81%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/c2.v.orig
index fec9578782..4dfa3954ee 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/c2.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -18,10 +18,7 @@
 
 (* Specify delays for coqdep and coqc when processing this file:
  * coqdep-delay 0
- * coqc-delay 0
+ * coqc-delay X
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Require Export e2 g2.
diff --git a/ci/compile-tests/007-slow-require/d4.v.orig 
b/ci/compile-tests/009-failure-processing/c3.v.orig
similarity index 81%
copy from ci/compile-tests/007-slow-require/d4.v.orig
copy to ci/compile-tests/009-failure-processing/c3.v.orig
index fec9578782..af0c937c02 100644
--- a/ci/compile-tests/007-slow-require/d4.v.orig
+++ b/ci/compile-tests/009-failure-processing/c3.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -18,10 +18,7 @@
 
 (* Specify delays for coqdep and coqc when processing this file:
  * coqdep-delay 0
- * coqc-delay 0
+ * coqc-delay X
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Require Export e3 g3.
diff --git a/ci/compile-tests/007-slow-require/d4.v.orig 
b/ci/compile-tests/009-failure-processing/c4.v.orig
similarity index 81%
copy from ci/compile-tests/007-slow-require/d4.v.orig
copy to ci/compile-tests/009-failure-processing/c4.v.orig
index fec9578782..124af3b80c 100644
--- a/ci/compile-tests/007-slow-require/d4.v.orig
+++ b/ci/compile-tests/009-failure-processing/c4.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -18,10 +18,7 @@
 
 (* Specify delays for coqdep and coqc when processing this file:
  * coqdep-delay 0
- * coqc-delay 0
+ * coqc-delay X
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Require Export e4 g4.
diff --git a/ci/compile-tests/007-slow-require/d4.v.orig 
b/ci/compile-tests/009-failure-processing/c5.v.orig
similarity index 81%
copy from ci/compile-tests/007-slow-require/d4.v.orig
copy to ci/compile-tests/009-failure-processing/c5.v.orig
index fec9578782..16af5ca02c 100644
--- a/ci/compile-tests/007-slow-require/d4.v.orig
+++ b/ci/compile-tests/009-failure-processing/c5.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -18,10 +18,7 @@
 
 (* Specify delays for coqdep and coqc when processing this file:
  * coqdep-delay 0
- * coqc-delay 0
+ * coqc-delay X
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Require Export e5 g5.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/c6.v.orig
similarity index 81%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/c6.v.orig
index fec9578782..ca6d688d21 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/c6.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -18,10 +18,7 @@
 
 (* Specify delays for coqdep and coqc when processing this file:
  * coqdep-delay 0
- * coqc-delay 0
+ * coqc-delay X
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Require Export e6 g6.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/c7.v.orig
similarity index 81%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/c7.v.orig
index fec9578782..2f3d66ea96 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/c7.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -18,10 +18,7 @@
 
 (* Specify delays for coqdep and coqc when processing this file:
  * coqdep-delay 0
- * coqc-delay 0
+ * coqc-delay X
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Require Export e7 g7.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/c8.v.orig
similarity index 81%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/c8.v.orig
index fec9578782..e779802b75 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/c8.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -18,10 +18,7 @@
 
 (* Specify delays for coqdep and coqc when processing this file:
  * coqdep-delay 0
- * coqc-delay 0
+ * coqc-delay X
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Require Export e8 g8.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/c9.v.orig
similarity index 81%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/c9.v.orig
index fec9578782..e5b7218f78 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/c9.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -18,10 +18,7 @@
 
 (* Specify delays for coqdep and coqc when processing this file:
  * coqdep-delay 0
- * coqc-delay 0
+ * coqc-delay X
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Require Export e9 g9.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/d1.v.orig
similarity index 81%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/d1.v.orig
index fec9578782..607de616ea 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/d1.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -18,10 +18,7 @@
 
 (* Specify delays for coqdep and coqc when processing this file:
  * coqdep-delay 0
- * coqc-delay 0
+ * coqc-delay 1.5
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Require Export h1.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/d10.v.orig
similarity index 84%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/d10.v.orig
index fec9578782..3080e44411 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/d10.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -21,7 +21,4 @@
  * coqc-delay 0
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Require Export h10.
diff --git a/ci/compile-tests/007-slow-require/d2.v.orig 
b/ci/compile-tests/009-failure-processing/d2.v.orig
similarity index 81%
copy from ci/compile-tests/007-slow-require/d2.v.orig
copy to ci/compile-tests/009-failure-processing/d2.v.orig
index fec9578782..26df3c8e2f 100644
--- a/ci/compile-tests/007-slow-require/d2.v.orig
+++ b/ci/compile-tests/009-failure-processing/d2.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -18,10 +18,7 @@
 
 (* Specify delays for coqdep and coqc when processing this file:
  * coqdep-delay 0
- * coqc-delay 0
+ * coqc-delay 3
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Require Export h2.
diff --git a/ci/compile-tests/007-slow-require/d3.v.orig 
b/ci/compile-tests/009-failure-processing/d3.v.orig
similarity index 81%
copy from ci/compile-tests/007-slow-require/d3.v.orig
copy to ci/compile-tests/009-failure-processing/d3.v.orig
index fec9578782..c1cc13dda2 100644
--- a/ci/compile-tests/007-slow-require/d3.v.orig
+++ b/ci/compile-tests/009-failure-processing/d3.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -18,10 +18,7 @@
 
 (* Specify delays for coqdep and coqc when processing this file:
  * coqdep-delay 0
- * coqc-delay 0
+ * coqc-delay 2
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Require Export h3.
diff --git a/ci/compile-tests/007-slow-require/d4.v.orig 
b/ci/compile-tests/009-failure-processing/d4.v.orig
similarity index 84%
copy from ci/compile-tests/007-slow-require/d4.v.orig
copy to ci/compile-tests/009-failure-processing/d4.v.orig
index fec9578782..fe2f988ffb 100644
--- a/ci/compile-tests/007-slow-require/d4.v.orig
+++ b/ci/compile-tests/009-failure-processing/d4.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -21,7 +21,4 @@
  * coqc-delay 0
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Require Export h4.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/d5.v.orig
similarity index 84%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/d5.v.orig
index fec9578782..b70ae03bbf 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/d5.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -21,7 +21,4 @@
  * coqc-delay 0
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Require Export h5.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/d6.v.orig
similarity index 81%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/d6.v.orig
index fec9578782..ac55358edf 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/d6.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -18,10 +18,7 @@
 
 (* Specify delays for coqdep and coqc when processing this file:
  * coqdep-delay 0
- * coqc-delay 0
+ * coqc-delay 1.5
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Require Export h6.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/d7.v.orig
similarity index 81%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/d7.v.orig
index fec9578782..dba452d05a 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/d7.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -18,10 +18,7 @@
 
 (* Specify delays for coqdep and coqc when processing this file:
  * coqdep-delay 0
- * coqc-delay 0
+ * coqc-delay 1.5
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Require Export h7.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/d8.v.orig
similarity index 81%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/d8.v.orig
index fec9578782..4ca53ddb48 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/d8.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -18,10 +18,7 @@
 
 (* Specify delays for coqdep and coqc when processing this file:
  * coqdep-delay 0
- * coqc-delay 0
+ * coqc-delay 1
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Require Export h8.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/d9.v.orig
similarity index 84%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/d9.v.orig
index fec9578782..0a2e797d89 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/d9.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -21,7 +21,4 @@
  * coqc-delay 0
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Require Export h9.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/e1.v.orig
similarity index 84%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/e1.v.orig
index fec9578782..72c612b3cc 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/e1.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -21,7 +21,4 @@
  * coqc-delay 0
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Require Export b1.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/e10.v.orig
similarity index 84%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/e10.v.orig
index fec9578782..27275559bf 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/e10.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -21,7 +21,5 @@
  * coqc-delay 0
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+(* Require Export b10. *)
+Definition e : nat := 3.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/e2.v.orig
similarity index 84%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/e2.v.orig
index fec9578782..d367fb61a8 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/e2.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -21,7 +21,4 @@
  * coqc-delay 0
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Require Export b2.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/e3.v.orig
similarity index 84%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/e3.v.orig
index fec9578782..3dc245ce8a 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/e3.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -21,7 +21,4 @@
  * coqc-delay 0
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Require Export b3.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/e4.v.orig
similarity index 84%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/e4.v.orig
index fec9578782..18cac3f6bc 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/e4.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -21,7 +21,4 @@
  * coqc-delay 0
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Require Export b4.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/e5.v.orig
similarity index 84%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/e5.v.orig
index fec9578782..7a28f2ec9f 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/e5.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -21,7 +21,5 @@
  * coqc-delay 0
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+(* Require Export b5. *)
+Definition e : nat := 3.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/e6.v.orig
similarity index 84%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/e6.v.orig
index fec9578782..cba4f3b362 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/e6.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -21,7 +21,4 @@
  * coqc-delay 0
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Require Export b6.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/e7.v.orig
similarity index 84%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/e7.v.orig
index fec9578782..9f97729930 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/e7.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -21,7 +21,4 @@
  * coqc-delay 0
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Require Export b7.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/e8.v.orig
similarity index 84%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/e8.v.orig
index fec9578782..ccec3b1c92 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/e8.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -21,7 +21,4 @@
  * coqc-delay 0
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Require Export b8.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/e9.v.orig
similarity index 84%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/e9.v.orig
index fec9578782..95c1b28236 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/e9.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -21,7 +21,4 @@
  * coqc-delay 0
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Require Export b9.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/f1.v.orig
similarity index 84%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/f1.v.orig
index fec9578782..60923f9d01 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/f1.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -21,7 +21,4 @@
  * coqc-delay 0
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Definition f : nat := 1.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/f10.v.orig
similarity index 84%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/f10.v.orig
index fec9578782..60923f9d01 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/f10.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -21,7 +21,4 @@
  * coqc-delay 0
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Definition f : nat := 1.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/f2.v.orig
similarity index 84%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/f2.v.orig
index fec9578782..60923f9d01 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/f2.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -21,7 +21,4 @@
  * coqc-delay 0
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Definition f : nat := 1.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/f3.v.orig
similarity index 84%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/f3.v.orig
index fec9578782..60923f9d01 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/f3.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -21,7 +21,4 @@
  * coqc-delay 0
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Definition f : nat := 1.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/f4.v.orig
similarity index 84%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/f4.v.orig
index fec9578782..60923f9d01 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/f4.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -21,7 +21,4 @@
  * coqc-delay 0
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Definition f : nat := 1.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/f5.v.orig
similarity index 84%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/f5.v.orig
index fec9578782..60923f9d01 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/f5.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -21,7 +21,4 @@
  * coqc-delay 0
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Definition f : nat := 1.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/f6.v.orig
similarity index 84%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/f6.v.orig
index fec9578782..60923f9d01 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/f6.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -21,7 +21,4 @@
  * coqc-delay 0
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Definition f : nat := 1.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/f7.v.orig
similarity index 84%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/f7.v.orig
index fec9578782..60923f9d01 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/f7.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -21,7 +21,4 @@
  * coqc-delay 0
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Definition f : nat := 1.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/f8.v.orig
similarity index 84%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/f8.v.orig
index fec9578782..60923f9d01 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/f8.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -21,7 +21,4 @@
  * coqc-delay 0
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Definition f : nat := 1.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/f9.v.orig
similarity index 84%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/f9.v.orig
index fec9578782..60923f9d01 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/f9.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -21,7 +21,4 @@
  * coqc-delay 0
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Definition f : nat := 1.
diff --git a/ci/compile-tests/007-slow-require/d6.v.orig 
b/ci/compile-tests/009-failure-processing/g1.v.orig
similarity index 79%
copy from ci/compile-tests/007-slow-require/d6.v.orig
copy to ci/compile-tests/009-failure-processing/g1.v.orig
index b60d54a6d1..aeaa48f8a5 100644
--- a/ci/compile-tests/007-slow-require/d6.v.orig
+++ b/ci/compile-tests/009-failure-processing/g1.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -17,11 +17,9 @@
  *)
 
 (* Specify delays for coqdep and coqc when processing this file:
- * coqdep-delay 
- * coqc-delay 4
+ * coqdep-delay 1
+ * coqc-delay X
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+(* coqdep error *)
+Require Export f1 h1
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/g10.v.orig
similarity index 81%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/g10.v.orig
index fec9578782..5d101315e2 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/g10.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -17,11 +17,12 @@
  *)
 
 (* Specify delays for coqdep and coqc when processing this file:
- * coqdep-delay 0
+ * coqdep-delay 1
  * coqc-delay 0
  *)
 
 
+Require Export f10 h10.
 
-(* This is line 26 *)
-Definition d : nat := 4.
+(* coqc error *)
+XXX.
diff --git a/ci/compile-tests/007-slow-require/d6.v.orig 
b/ci/compile-tests/009-failure-processing/g2.v.orig
similarity index 79%
copy from ci/compile-tests/007-slow-require/d6.v.orig
copy to ci/compile-tests/009-failure-processing/g2.v.orig
index b60d54a6d1..a1453e83e8 100644
--- a/ci/compile-tests/007-slow-require/d6.v.orig
+++ b/ci/compile-tests/009-failure-processing/g2.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -17,11 +17,9 @@
  *)
 
 (* Specify delays for coqdep and coqc when processing this file:
- * coqdep-delay 
- * coqc-delay 4
+ * coqdep-delay 1
+ * coqc-delay X
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+(* coqdep error *)
+Require Export f2 h2
diff --git a/ci/compile-tests/007-slow-require/d6.v.orig 
b/ci/compile-tests/009-failure-processing/g3.v.orig
similarity index 79%
copy from ci/compile-tests/007-slow-require/d6.v.orig
copy to ci/compile-tests/009-failure-processing/g3.v.orig
index b60d54a6d1..99a3c0ec1f 100644
--- a/ci/compile-tests/007-slow-require/d6.v.orig
+++ b/ci/compile-tests/009-failure-processing/g3.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -17,11 +17,9 @@
  *)
 
 (* Specify delays for coqdep and coqc when processing this file:
- * coqdep-delay 
- * coqc-delay 4
+ * coqdep-delay 1
+ * coqc-delay X
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+(* coqdep error *)
+Require Export f3 h3
diff --git a/ci/compile-tests/007-slow-require/d6.v.orig 
b/ci/compile-tests/009-failure-processing/g4.v.orig
similarity index 79%
copy from ci/compile-tests/007-slow-require/d6.v.orig
copy to ci/compile-tests/009-failure-processing/g4.v.orig
index b60d54a6d1..0f2371e418 100644
--- a/ci/compile-tests/007-slow-require/d6.v.orig
+++ b/ci/compile-tests/009-failure-processing/g4.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -17,11 +17,9 @@
  *)
 
 (* Specify delays for coqdep and coqc when processing this file:
- * coqdep-delay 
- * coqc-delay 4
+ * coqdep-delay 1
+ * coqc-delay X
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+(* coqdep error *)
+Require Export f4 h4
diff --git a/ci/compile-tests/007-slow-require/d6.v.orig 
b/ci/compile-tests/009-failure-processing/g5.v.orig
similarity index 79%
copy from ci/compile-tests/007-slow-require/d6.v.orig
copy to ci/compile-tests/009-failure-processing/g5.v.orig
index b60d54a6d1..5acb2e2339 100644
--- a/ci/compile-tests/007-slow-require/d6.v.orig
+++ b/ci/compile-tests/009-failure-processing/g5.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -17,11 +17,9 @@
  *)
 
 (* Specify delays for coqdep and coqc when processing this file:
- * coqdep-delay 
- * coqc-delay 4
+ * coqdep-delay 1
+ * coqc-delay X
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+(* coqdep error *)
+Require Export f5 h5
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/g6.v.orig
similarity index 82%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/g6.v.orig
index fec9578782..609a2213ae 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/g6.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -18,10 +18,11 @@
 
 (* Specify delays for coqdep and coqc when processing this file:
  * coqdep-delay 0
- * coqc-delay 0
+ * coqc-delay 1
  *)
 
 
+Require Export f6 h6.
 
-(* This is line 26 *)
-Definition d : nat := 4.
+(* coqc error *)
+XXX.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/g7.v.orig
similarity index 84%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/g7.v.orig
index fec9578782..54c84dc6ee 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/g7.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -22,6 +22,7 @@
  *)
 
 
+Require Export f7 h7.
 
-(* This is line 26 *)
-Definition d : nat := 4.
+(* coqc error *)
+XXX.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/g8.v.orig
similarity index 84%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/g8.v.orig
index fec9578782..d25403992e 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/g8.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -22,6 +22,7 @@
  *)
 
 
+Require Export f8 h8.
 
-(* This is line 26 *)
-Definition d : nat := 4.
+(* coqc error *)
+XXX.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/g9.v.orig
similarity index 82%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/g9.v.orig
index fec9578782..42e8fee44d 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/g9.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -18,10 +18,11 @@
 
 (* Specify delays for coqdep and coqc when processing this file:
  * coqdep-delay 0
- * coqc-delay 0
+ * coqc-delay 1
  *)
 
 
+Require Export f9 h9.
 
-(* This is line 26 *)
-Definition d : nat := 4.
+(* coqc error *)
+XXX.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/h1.v.orig
similarity index 84%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/h1.v.orig
index fec9578782..8f0b315cec 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/h1.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -21,7 +21,4 @@
  * coqc-delay 0
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Definition h : nat := 2.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/h10.v.orig
similarity index 84%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/h10.v.orig
index fec9578782..8f0b315cec 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/h10.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -21,7 +21,4 @@
  * coqc-delay 0
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Definition h : nat := 2.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/h2.v.orig
similarity index 84%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/h2.v.orig
index fec9578782..8f0b315cec 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/h2.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -21,7 +21,4 @@
  * coqc-delay 0
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Definition h : nat := 2.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/h3.v.orig
similarity index 84%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/h3.v.orig
index fec9578782..8f0b315cec 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/h3.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -21,7 +21,4 @@
  * coqc-delay 0
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Definition h : nat := 2.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/h4.v.orig
similarity index 84%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/h4.v.orig
index fec9578782..8f0b315cec 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/h4.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -21,7 +21,4 @@
  * coqc-delay 0
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Definition h : nat := 2.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/h5.v.orig
similarity index 84%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/h5.v.orig
index fec9578782..8f0b315cec 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/h5.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -21,7 +21,4 @@
  * coqc-delay 0
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Definition h : nat := 2.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/h6.v.orig
similarity index 84%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/h6.v.orig
index fec9578782..8f0b315cec 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/h6.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -21,7 +21,4 @@
  * coqc-delay 0
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Definition h : nat := 2.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/h7.v.orig
similarity index 84%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/h7.v.orig
index fec9578782..8f0b315cec 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/h7.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -21,7 +21,4 @@
  * coqc-delay 0
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Definition h : nat := 2.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/h8.v.orig
similarity index 84%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/h8.v.orig
index fec9578782..8f0b315cec 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/h8.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -21,7 +21,4 @@
  * coqc-delay 0
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Definition h : nat := 2.
diff --git a/ci/compile-tests/007-slow-require/d1.v.orig 
b/ci/compile-tests/009-failure-processing/h9.v.orig
similarity index 84%
copy from ci/compile-tests/007-slow-require/d1.v.orig
copy to ci/compile-tests/009-failure-processing/h9.v.orig
index fec9578782..8f0b315cec 100644
--- a/ci/compile-tests/007-slow-require/d1.v.orig
+++ b/ci/compile-tests/009-failure-processing/h9.v.orig
@@ -5,7 +5,7 @@
  * Authors: Hendrik Tews
  * Maintainer: Hendrik Tews <hendrik@askra.de>
  *
- * License:     GPL (GNU GENERAL PUBLIC LICENSE)
+ * SPDX-License-Identifier: GPL-3.0-or-later
  *
  *
  * This file is part of an automatic test case for parallel background
@@ -21,7 +21,4 @@
  * coqc-delay 0
  *)
 
-
-
-(* This is line 26 *)
-Definition d : nat := 4.
+Definition h : nat := 2.
diff --git a/ci/compile-tests/009-failure-processing/runtest.el 
b/ci/compile-tests/009-failure-processing/runtest.el
new file mode 100644
index 0000000000..1835eeb69e
--- /dev/null
+++ b/ci/compile-tests/009-failure-processing/runtest.el
@@ -0,0 +1,142 @@
+;; This file is part of Proof General.  -*- lexical-binding: t; -*-
+;;
+;; © Copyright 2021  Hendrik Tews
+;;
+;; Authors: Hendrik Tews
+;; Maintainer: Hendrik Tews <hendrik@askra.de>
+;;
+;; SPDX-License-Identifier: GPL-3.0-or-later
+
+;;; Commentary:
+;;
+;; Coq Compile Tests (cct) --
+;; ert tests for parallel background compilation for Coq
+;;
+;; Test a partially successful and partially failing compilation with
+;; coq-compile-keep-going. Check that the right files are compiled,
+;; locked and unlocked. Check also the case, where unlocking of failed
+;; files must be delayed, because some earlier successful require job
+;; has not yet locked its ancestors.
+;;
+;; The dependencies in this test are:
+;;
+;;    Rb    Rc  Rd
+;;    |     |   |
+;;    |     c   |
+;;    |    /|   |
+;;    |   / |   |
+;;    |  e  |   d
+;;    | ?   |   |
+;;    |?    |   |
+;;    b     g   /
+;;    |   _/|  /
+;;    | _/  | /
+;;    |/    |/
+;;    f     h
+;;
+;; Rb, Rc and Rd are three different require commands in file a. The
+;; dependency e -> b is not present in test 5 and test 10 (but in all
+;; other tests). The error always happens in file g, for test 1-5 with
+;; coqdep, for tests 6-10 with coqc. There are 10 tests, each with
+;; slighly different delays, in 10 versions of the sources, e.g.,
+;; a1-a10, b1-b10, and so on.
+;;
+;; For tests 1-5 coqdep fails on g, when this happens
+;;
+;; 1: Rb is ready and d still busy
+;; 2: f is ready and b and d are still busy and d finishes last
+;; 3: f is ready and b and d are still busy and b finishes last
+;; 4: RB is ready and Rd is queue waiting
+;; 5: without dependency e -> b: Rc, Rd are queue waiting, b finishes last
+;;
+;;
+;; For tests 6-10 coqc fails on g, when this happens
+;;
+;; 6: Rb is ready and d still busy
+;; 7: f is ready and b and d are still busy and d finishes last
+;; 8: f is ready and b and d are still busy and b finishes last
+;; 9: RB is ready and Rd is queue waiting
+;; 10: without dependency b -> e: Rc, Rd are queue waiting, b finishes last
+
+
+
+;; require cct-lib for the elisp compilation, otherwise this is present already
+(require 'cct-lib "ci/compile-tests/cct-lib")
+
+;;; set configuration
+(cct-configure-proof-general)
+(configure-delayed-coq)    
+
+(defconst pre-b-ancestors '("b" "f")
+    "Ancestors of b without suffixes.")
+
+(defconst pre-all-compiled (append pre-b-ancestors '("e" "h" "d"))
+  "All files that get compiled.")
+
+(defun pre-not-compiled (n)
+  "List of file name stems for which coqc must not be called.
+Files for which coqc must not be called have an ``X'' in
+coqc-delay. For such files `compile-test-start-delayed' would
+create a ``.X'' file, whose absense is checked in the test."
+  (cond
+   ((< n 6) '("g" "c"))
+   (t       '("c"))))
+
+(defconst pre-all-unlocked '("c" "d" "e" "g" "h")
+  "All stems of files that should be unlocked after compilation.")
+
+(defun b-ancestors (n)
+  "Ancestors of b for part N."
+  (mapcar (lambda (f) (format "./%s%d.v" f n)) pre-b-ancestors))
+
+(defun all-compiled (n)
+  "All files that get compiled for part N."
+  (mapcar (lambda (f) (format "./%s%d.v" f n)) pre-all-compiled))
+
+(defun all-compiled-vo (n)
+  "All vo files for part N."
+  (mapcar #'cct-library-vo-of-v-file (all-compiled n)))
+
+(defun not-compiled (n)
+  "Files that should not be compiled for part N, see `pre-not-compiled'."
+  (mapcar (lambda (f) (format "./%s%d.v.X" f n)) (pre-not-compiled n)))
+
+(defun all-unlocked (n)
+  "All files that should be unlocked after compilation for part N."
+  (mapcar (lambda (f) (format "./%s%d.v" f n)) pre-all-unlocked))
+
+
+;;; Define the test
+
+(defun test-failure-processing (n)
+  "Test partially successful and partially failing compilation, part N."
+  ;; (setq cct--debug-tests t)
+  ;; (setq coq--debug-auto-compilation t)
+  (find-file (format "a%d.v" n))
+  (message "coqdep: %s\ncoqc: %s\nPATH %s\nexec-path: %s"
+           coq-dependency-analyzer
+           coq-compiler
+           (getenv "PATH")
+           exec-path)
+
+  (message "\n%d. Partially failing compilation part %d\n" n n)
+  (cct-process-to-line 28)
+  (cct-check-locked 25 'locked)
+  (cct-check-locked 26 'unlocked)
+  (cct-locked-ancestors 25 (b-ancestors n))
+  (cct-check-files-locked 24 'locked (b-ancestors n))
+  (cct-check-files-locked 1 'unlocked (all-unlocked n))
+  (cct-files-are-readable (all-compiled-vo n))
+  (cct-files-dont-exist (not-compiled n)))
+
+
+(ert-deftest cct-failure-processing-01 () (test-failure-processing 1))
+(ert-deftest cct-failure-processing-02 () (test-failure-processing 2))
+(ert-deftest cct-failure-processing-03 () (test-failure-processing 3))
+(ert-deftest cct-failure-processing-04 () (test-failure-processing 4))
+(ert-deftest cct-failure-processing-05 () (test-failure-processing 5))
+(ert-deftest cct-failure-processing-06 () (test-failure-processing 6))
+(ert-deftest cct-failure-processing-07 () (test-failure-processing 7))
+(ert-deftest cct-failure-processing-08 () (test-failure-processing 8))
+(ert-deftest cct-failure-processing-09 () (test-failure-processing 9))
+(ert-deftest cct-failure-processing-10 () (test-failure-processing 10))
diff --git a/ci/compile-tests/Makefile b/ci/compile-tests/Makefile
index 32f6561b32..483322e896 100644
--- a/ci/compile-tests/Makefile
+++ b/ci/compile-tests/Makefile
@@ -5,7 +5,7 @@
 # Authors: Hendrik Tews
 # Maintainer: Hendrik Tews <hendrik@askra.de>
 # 
-# License:     GPL (GNU GENERAL PUBLIC LICENSE)
+# SPDX-License-Identifier: GPL-3.0-or-later
 
 
 TOPTARGETS := test clean
diff --git a/ci/compile-tests/README.md b/ci/compile-tests/README.md
index 3b0364e223..3bf3b62ddd 100644
--- a/ci/compile-tests/README.md
+++ b/ci/compile-tests/README.md
@@ -5,9 +5,41 @@ compilation feature for Coq. The test check that
   are compiled
 - files are locked and registered in the right require commands.
 
+Each test comes with a hand-crafted set of Coq source files that
+implement a particular dependency tree. Therefore, most of the
+tests have a subdirectory on their own.
+
+# Overview of existing tests
+
+All tests are for parallel background compilation.
+
+001-mini-project
+: test compilation for a simple project
+002-require-no-dependencies
+: Test a require that does not produce any dependencies.
+003-require-error
+: coqdep fails on a require
+004-dependency-cycle
+: dependency cycle
+005-change-recompile
+: test that the right files are recompiled when changes are made
+006-ready-dependee
+: dependency in state ready
+007-slow-require
+: test almost all internal state combinations with delay on
+  coqdep and coqc
+008-default-dir
+: test that the default/current directory is set correctly
+  independent of user/emacs changing the current buffer during
+  first and second stage compilation
+009-failure-processing
+: check ancestor unlocking for a failed job with
+  coq-compile-keep-going; test also the case, where the last
+  (failed) require job must be delayed, because some queue
+  dependee is still processing
+
+# Tests currently missing
 
-Tests currently missing:
-- unlock checks for ancestors of failed jobs in different cases
 - a job depending on a failed dependee, where the dependee has
   been finished before
 - coq-par-create-file-job detects a dependency cycle
@@ -16,3 +48,8 @@ Tests currently missing:
   in state waiting-queue
 - coq-par-create-file-job finds a failed job
 - all tests in all quick and all vos variants
+- test two coq-par-kickoff-queue-from-action-list entries being
+  active at the same time: assert one region, let compilation
+  fail, assert second region, while first region is still busy,
+  this should fail in some weird way, because failed is not
+  propagated
diff --git a/ci/compile-tests/bin/compile-test-start-delayed 
b/ci/compile-tests/bin/compile-test-start-delayed
index f528f4d1d3..81bfbcf7ef 100755
--- a/ci/compile-tests/bin/compile-test-start-delayed
+++ b/ci/compile-tests/bin/compile-test-start-delayed
@@ -7,7 +7,7 @@
 # Authors: Hendrik Tews
 # Maintainer: Hendrik Tews <hendrik@askra.de>
 # 
-# License:     GPL (GNU GENERAL PUBLIC LICENSE)
+# SPDX-License-Identifier: GPL-3.0-or-later
 #
 # See function usage for documentation.
 
@@ -20,11 +20,18 @@ function usage(){
 
        Start program prog with arguments args with some delay. There
        must be at least one argument in args and the last one must be
-       a file. The delay is taken from a line in that file that
+       a file or something that becomes a file when ".v" is appended.
+       The delay is taken from a line in that file that
        contains the key, followed by a space and the delay in seconds
        (maybe somewhere in the middle of the line). The file must
        contain at most one line containing key. When there is no line
-       containing key the delay is zero.
+       containing key the delay is zero. As a special case, a delay
+       equal to X means to record the fact that prog has been called
+       on file by creating a file with suffix ".X" added to the name
+       of file. The absence of this .X file can then be used, for
+       instance, to check that prog has not been called on file. With
+       delay equal to X, the real delay is 0.
+        Fractional delays are properly handled.
 EOF
 }
 
@@ -37,24 +44,41 @@ fi
 
 key="$1"
 file="${@: -1}"
+
+#echo key $key file "\"$file\""
+
 shift
 
-delay=$(sed -ne "/$key/ s/.*$key \([0-9]*\).*/\1/p" $file)
+# vio2vo needs a module name or a .vio file on the command line
+# support only module names for now
+if [ ! -f "$file" ] ; then
+    if [ -f "$file.v" ] ; then
+        file="$file.v"
+    else
+        exit 22
+    fi
+fi
+
+delay=$(sed -ne "/$key/ s/.*$key \([X0-9.]*\).*/\1/p" $file)
 
 if [ -z "$delay" ] ; then
     # echo compile-test-start-delayed: key $key not found in $file >&9
     delay=0
+elif [ "$delay" = "X" ] ; then
+    echo compile-test-start-delayed: delay X for $file >&9
+    delay=0
+    touch $file.X
 fi
 
-if [ $delay -ne 0 ] ; then
-    date "+compile-test-start-delayed +%Y-%m-%d %T %Z" >&9
-    echo delay $delay for $@ >&9
+# use string comparison on $delay to permit fractional values
+if [ $delay != 0 ] ; then
+    date "+compile-test-start-delayed %T delay $delay for $*" >&9
+    sleep $delay
+    date "+compile-test-start-delayed %T start now $*" >&9
+else
+    date "+compile-test-start-delayed %T start without delay $*" >&9
 fi
 
-sleep $delay
-date "+compile-test-start-delayed +%Y-%m-%d %T %Z" >&9
-echo start $@ >&9
-
 #set -x
 #echo "$@"
 set +e
diff --git a/ci/compile-tests/bin/coqc-delayed 
b/ci/compile-tests/bin/coqc-delayed
index 26c92805ca..dcbe9d59c3 100755
--- a/ci/compile-tests/bin/coqc-delayed
+++ b/ci/compile-tests/bin/coqc-delayed
@@ -1,3 +1,3 @@
 #!/bin/bash
 
-exec compile-test-start-delayed coqc-delay coqc "$*"
+exec compile-test-start-delayed coqc-delay coqc "$@"
diff --git a/ci/compile-tests/bin/coqdep-delayed 
b/ci/compile-tests/bin/coqdep-delayed
index f123770a0d..76fc4efcca 100755
--- a/ci/compile-tests/bin/coqdep-delayed
+++ b/ci/compile-tests/bin/coqdep-delayed
@@ -1,3 +1,3 @@
 #!/bin/bash
 
-exec compile-test-start-delayed coqdep-delay coqdep "$*"
+exec compile-test-start-delayed coqdep-delay coqdep "$@"
diff --git a/ci/compile-tests/cct-lib.el b/ci/compile-tests/cct-lib.el
index 740b04c1af..7a5a427c9a 100644
--- a/ci/compile-tests/cct-lib.el
+++ b/ci/compile-tests/cct-lib.el
@@ -1,11 +1,11 @@
 ;; This file is part of Proof General.
 ;; 
-;; © Copyright 2020  Hendrik Tews
+;; © Copyright 2020 - 2021  Hendrik Tews
 ;; 
 ;; Authors: Hendrik Tews
 ;; Maintainer: Hendrik Tews <hendrik@askra.de>
 ;; 
-;; License:     GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 
 ;;; Commentary:
@@ -38,6 +38,13 @@
 (defvar cct--debug-tests nil
   "Set to t to get more output during test runs.")
 
+(defvar cct-before-busy-waiting-hook nil
+  "Hooks run by ‘cct-process-to-line’ before busy waiting.")
+
+(defvar cct-after-busy-waiting-hook nil
+  "Hooks run by ‘cct-process-to-line’ after busy waiting.")
+
+
 (defmacro cct-implies (p q)
   "Short-circuit logical implication.
 Evaluate Q only if P is non-nil."
@@ -109,12 +116,16 @@ backward. Replace the word there with WORD."
   (insert word))
 
 (defun cct-process-to-line (line)
-  "Assert/retract to line LINE and wait until processing completed."
+  "Assert/retract to line LINE and wait until processing completed.
+Runs `cct-before-busy-waiting-hook' and
+`cct-after-busy-waiting-hook' before and after busy waiting for
+the prover. In many tests these hooks are not used."
   (when cct--debug-tests
     (message "assert/retrect to line %d in buffer %s" line (buffer-name)))
   (cct-goto-line line)
   (proof-goto-point)
 
+  (run-hooks 'cct-before-busy-waiting-hook)
   (while (or proof-second-action-list-active (consp proof-action-list))
     ;; (message "wait for coq/compilation with %d items queued\n"
     ;;          (length proof-action-list))
@@ -122,7 +133,29 @@ backward. Replace the word there with WORD."
     ;; accept-process-output without timeout returns rather quickly,
     ;; apparently most times without process output or any other event
     ;; to process.
-    (accept-process-output nil 0.1)))
+    (accept-process-output nil 0.1))
+  (run-hooks 'cct-after-busy-waiting-hook))
+
+(defun cct-wait-for-second-stage ()
+  "Wait until second stage compilation is complete.
+Runs `cct-before-busy-waiting-hook' and
+`cct-after-busy-waiting-hook' before and after busy waiting."
+  (run-hooks 'cct-before-busy-waiting-hook)
+  (when cct--debug-tests
+    (message
+     "%s start waiting for vok/vio2vo timer %s 2nd-stage-in-progress %s"
+     (current-time-string)
+     coq--par-second-stage-delay-timer
+     coq--par-second-stage-in-progress))
+  (while (or coq--par-second-stage-delay-timer
+             coq--par-second-stage-in-progress)
+    (accept-process-output nil 0.5)
+    (when cct--debug-tests
+      (message "%s wait for vok/vio2vo timer %s 2nd-stage-in-progress %s"
+               (current-time-string)
+               coq--par-second-stage-delay-timer
+               coq--par-second-stage-in-progress)))
+  (run-hooks 'cct-after-busy-waiting-hook))
 
 (defun cct-get-vanilla-span (line)
   "Get THE vanilla span for line LINE, report an error if there is none.
@@ -158,7 +191,7 @@ region of the buffer and signals a test failure if not."
   (let ((locked (eq locked-state 'locked)))
     (when cct--debug-tests
       (message (concat "check lock state in buffer %s: line %d should be %s;\n"
-                       "\tlocked-span: %s ends at char %s in line %d")
+                       "\tlocked-span: %s ends at char %s in line %s")
                (buffer-name)
                line (if locked "locked" "unlocked")
                proof-locked-span
@@ -181,6 +214,20 @@ region of the buffer and signals a test failure if not."
            (funcall (if locked '< '>)
                     (point) (span-end proof-locked-span)))))))
 
+(defun cct-check-files-locked (line lock-state files)
+  "Check that all FILES at line number LINE have lock state LOCK-STATE.
+LOCK-STATE must be either 'locked or 'unlocked. FILES must be
+list of file names."
+  (when cct--debug-tests
+    (message "check files %s at line %d: %s"
+             (if (eq lock-state 'locked) "locked" "unlocked") line files))
+  (save-current-buffer
+    (mapc
+     (lambda (file)
+       (find-file file)
+       (cct-check-locked line lock-state))
+     files)))
+
 (defun cct-locked-ancestors (line ancestors)
   "Check that the vanilla span at line LINE has ANCESTORS recorded.
 The comparison treats ANCESTORS as set but the file names must
@@ -200,7 +247,7 @@ Used to check that FILE has not been changed since TIME was
 recorded before."
   (let ((file-time (nth 5 (file-attributes file))))
     (when cct--debug-tests
-      (message "file %s should be unchanged, recorded time: %s now: %s\n"
+      (message "file %s should be unchanged, recorded time: %s now: %s"
                file
                (format-time-string "%H:%M:%S.%3N" time)
                (format-time-string "%H:%M:%S.%3N" file-time)))
@@ -229,6 +276,14 @@ changed since FILE-TIME-ASSOC has been recorded."
 (defun cct-file-newer (file time)
   "Check that FILE exists and its modification time is more recent than TIME."
   (let ((file-time (nth 5 (file-attributes file))))
+    (when cct--debug-tests
+      (message "file %s in %s should be changed, recorded time: %s now: %s"
+               file
+               default-directory
+               (if time (format-time-string "%H:%M:%S.%3N" time) "---")
+               (if file-time
+                   (format-time-string "%H:%M:%S.%3N" file-time)
+                 "---")))
     (should (and file-time (time-less-p time file-time)))))
 
 (defun cct-older-change-times (file-time-assoc)
@@ -239,11 +294,29 @@ times as returned by `cct-record-change-times' or
 FILE-TIME-ASSOC do exist and that their modification time is more
 recent than in the association list, i.e., they have been updated
 or changed since recording the time in the association."
+  (when cct--debug-tests
+    (message "Files should have been changed: %s"
+             (mapconcat
+              (lambda (file-time) (car file-time))
+              file-time-assoc
+              ", ")))
   (mapc
    (lambda (file-time-cons)
      (cct-file-newer (car file-time-cons) (cdr file-time-cons)))
    file-time-assoc))
 
+(defun cct-files-are-readable (files)
+  "Check that FILES exist and are readable."
+  (when cct--debug-tests
+    (message "Files should exist and be readable: %s" files))
+  (mapc (lambda (fname) (should (file-readable-p fname))) files))
+
+(defun cct-files-dont-exist (files)
+  "Check that FILES don't exist."
+  (when cct--debug-tests
+    (message "Files should not exist: %s" files))
+  (mapc (lambda (fname) (should-not (file-exists-p fname))) files))
+
 (defun cct-generic-check-main-buffer
     (main-buf main-unlocked main-locked main-sum-line new-sum
               vo-times recompiled-files require-ancestors
diff --git a/ci/coq-tests.el b/ci/coq-tests.el
index ff762d9c85..3766415545 100644
--- a/ci/coq-tests.el
+++ b/ci/coq-tests.el
@@ -133,7 +133,9 @@ then evaluate the BODY function and finally tear-down (exit 
Coq)."
 ;;; For info on macros: https://mullikine.github.io/posts/macro-tutorial
 ;;; (pp (macroexpand '(macro args)))
   (save-excursion
-    (let* ((openfile (or file
+    (let* (;; avoids bad width detection in batch mode 
+           (coq-auto-adapt-printing-width nil)
+           (openfile (or file
                          (concat (make-temp-file coq-test-file-prefix) ".v")))
            ;; if FILE is nil, create a temporary Coq file, removed in the end
            (rmfile (unless file openfile))
@@ -274,7 +276,7 @@ For example, COMMENT could be (*test-definition*)"
      (proof-shell-wait)
      (goto-char (point-min))
      (insert "(*.*)")
-     (should (equal (proof-queue-or-locked-end) 1)))))
+     (should (equal (proof-queue-or-locked-end) (point-min))))))
 
 (ert-deftest 080_coq-test-regression-show-proof-stepwise()
   "Regression test for the \"Show Proof\" option"
@@ -303,6 +305,44 @@ For example, COMMENT could be (*test-definition*)"
    'show-proof-stepwise 'diffs-on))
  
 
+(ert-deftest 090_coq-test-regression-Fail()
+  "Test for Fail"
+  (coq-fixture-on-file
+   (coq-test-full-path "test_stepwise.v")
+   (lambda ()
+     (coq-test-goto-before "(*FailNoTrace*)")
+     (proof-goto-point)
+     (proof-shell-wait)
+     (proof-assert-next-command-interactive) ;; pas the comment
+     (proof-assert-next-command-interactive)
+     (proof-shell-wait)
+     (if (coq--version< (coq-version) "8.10.0")
+         (coq-should-buffer-string "The command has indeed failed with message:
+In nested Ltac calls to \"now (tactic)\" and \"easy\", last call failed.
+Tactic failure: Cannot solve this goal.")
+       (coq-should-buffer-string "The command has indeed failed with message:
+Tactic failure: Cannot solve this goal." "*coq*")))))
+
+
+;; (coq-should-buffer-regexp (regexp-quote "The command has indeed failed with 
message: Tactic failure: Cannot solve this goal.") "*response*")
+
+(ert-deftest 091_coq-test-regression-Fail()
+  "Test for Fail"
+  (coq-fixture-on-file
+   (coq-test-full-path "test_stepwise.v")
+   (lambda ()
+     (coq-test-goto-before "(*FailTrace*)")
+     (proof-goto-point)
+     (proof-shell-wait)
+     (proof-assert-next-command-interactive) ;; pas the comment
+     (proof-assert-next-command-interactive)
+     (proof-shell-wait)
+     ;; If coq--post-v811, it should be "Show Proof Diffs." otherwise "Show 
Proof."
+     (coq-should-buffer-string "The command has indeed failed with message:
+In nested Ltac calls to \"now (tactic)\" and \"easy\", last call failed.
+Tactic failure: Cannot solve this goal."))))
+ 
+
 (provide 'coq-tests)
 
 ;;; coq-tests.el ends here
diff --git a/ci/simple-tests/.gitignore b/ci/simple-tests/.gitignore
new file mode 100644
index 0000000000..67f5cfcffe
--- /dev/null
+++ b/ci/simple-tests/.gitignore
@@ -0,0 +1 @@
+*.success
diff --git a/ci/simple-tests/Makefile b/ci/simple-tests/Makefile
new file mode 100644
index 0000000000..95e13d3b0b
--- /dev/null
+++ b/ci/simple-tests/Makefile
@@ -0,0 +1,23 @@
+# This file is part of Proof General.
+# 
+# © Copyright 2021  Hendrik Tews
+# 
+# Authors: Hendrik Tews
+# Maintainer: Hendrik Tews <hendrik@askra.de>
+# 
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+
+TESTS:=$(wildcard test-*.el)
+SUCCESS:=$(TESTS:.el=.success)
+
+all: $(SUCCESS)
+
+test-%.success: test-%.el
+       emacs -batch -l ../../generic/proof-site.el -l $< \
+               -f ert-run-tests-batch-and-exit \
+       && touch $@
+
+.PHONY: clean
+clean:
+       rm -f *.vo *.glob *.vio *.vos *.vok .*.aux *.success
diff --git a/ci/simple-tests/README.md b/ci/simple-tests/README.md
new file mode 100644
index 0000000000..34812cf444
--- /dev/null
+++ b/ci/simple-tests/README.md
@@ -0,0 +1,23 @@
+This directory contains a number of more simple tests, that can
+all run in the same directory.
+
+# Overview of existing tests
+
+test-coqtop-unavailable
+: open a file with PG when no coqtop is available
+test-omit-proofs
+: test the omit proofs feature
+coq-par-job-needs-compilation-quick
+: test coq-par-job-needs-compilation-quick by enumerating all
+  possible cases
+test-prelude-correct
+: test that the Proof General prelude is correct
+
+
+# Important conventions
+
+The Makefile runs all ERT tests in all `test-*.el` files.
+Therefore, the test should be written in a file matching this
+pattern.
+
+To run all tests in a single file, do `make test-*.success`.
diff --git a/ci/simple-tests/omit_test.v b/ci/simple-tests/omit_test.v
new file mode 100644
index 0000000000..b8d177cc08
--- /dev/null
+++ b/ci/simple-tests/omit_test.v
@@ -0,0 +1,25 @@
+
+Definition classical_logic : Prop := forall(P : Prop), ~~P -> P.
+
+(* automatic test marker 1 *)
+
+Lemma classic_excluded_middle :
+  (forall(P : Prop), P \/ ~ P) -> classical_logic.
+Proof.
+  intros H P H0.
+  (* automatic test marker 2 *)
+  specialize (H P).
+Abort.
+
+Lemma classic_excluded_middle :
+  (forall(P : Prop), P \/ ~ P) -> classical_logic.
+Proof using.
+  intros H P H0.
+  specialize (H P).
+  (* automatic test marker 3 *)
+  destruct H.
+    trivial.
+  contradiction.
+Qed.
+
+(* automatic test marker 4 *)
diff --git a/coq/coq-par-test.el 
b/ci/simple-tests/test-coq-par-job-needs-compilation-quick.el
similarity index 87%
rename from coq/coq-par-test.el
rename to ci/simple-tests/test-coq-par-job-needs-compilation-quick.el
index 1cc04880c7..23018091ee 100644
--- a/coq/coq-par-test.el
+++ b/ci/simple-tests/test-coq-par-job-needs-compilation-quick.el
@@ -1,4 +1,4 @@
-;;; coq-par-test.el --- tests for parallel compilation
+;;; test-coq-par-job-needs-compilation-quick.el --- test compilation internals
 
 ;; This file is part of Proof General.
 
@@ -6,30 +6,34 @@
 ;; Portions © Copyright 2003-2018  Free Software Foundation, Inc.
 ;; Portions © Copyright 2001-2017  Pierre Courtieu
 ;; Portions © Copyright 2010, 2016  Erik Martin-Dorel
-;; Portions © Copyright 2011-2013, 2016-2017  Hendrik Tews
+;; Portions © Copyright 2011-2013, 2016-2017 2021 Hendrik Tews
 ;; Portions © Copyright 2015-2017  Clément Pit-Claudel
 
 ;; Authors: Hendrik Tews
 ;; Maintainer: Hendrik Tews <hendrik@askra.de>
 
-;; License:     GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
-;; This file file contains tests for `coq-par-job-needs-compilation'.
+;; This file file contains tests for `coq-par-job-needs-compilation-quick'.
 ;; It specifies for all combinations of `coq-compile-quick', existing
 ;; files and relative file ages the required result and side effects
-;; of `coq-par-job-needs-compilation'.
+;; of `coq-par-job-needs-compilation-quick'. There are more than 500
+;; single tests, which are all independent. One could therefore define
+;; each of these single tests as an ERT test. However, one line in
+;; `coq--par-job-needs-compilation-tests' generates between 1 and 4 of
+;; such single tests. Therefore, making each an ERT test is probably
+;; not worth the effort.
 ;;
-;; Run the tests with
-;; Emacs -batch -L . -L ../generic -L ../lib -load coq-par-test.el
-;;
-;;; TODO:
-;;
-;; - integrate into PG build and test(?) system
+;; Debugging hints: Set test--coq-par-only-test to the failing test
+;; number and set coq--debug-auto-compilation to t. Don't forget to
+;; reset all this when done.
 
 ;;; Code:
 
+(require 'proof-site)
+(proof-ready-for-assistant 'coq)
 (require 'coq-par-compile)
 (eval-when-compile (require 'cl-lib))
 
@@ -704,7 +708,7 @@
      (quick              t              nil      vio )
      (ensure-vo          t              vio      vo  ))
     )
-  "Test and result specification for `coq-par-job-needs-compilation'.
+  "Test and result specification for `coq-par-job-needs-compilation-quick'.
 
 List of tests.  A test is a list of 4 elements.  The first element,
 a list, specifies the existing files and their relative age.  In
@@ -720,7 +724,7 @@ modification time stamps and .vo and .vio are older than the
 dependency.
 
 Elements 2-4 of a test specify the results and side effects of
-`coq-par-job-needs-compilation' for all settings of
+`coq-par-job-needs-compilation-quick' for all settings of
 `coq-compile-quick' on the file configuration described in
 element 1. The options `quick-no-vio2vo' and `quick-and-vio2vo'
 are specified together with label `quick'.  Each result and side
@@ -728,8 +732,8 @@ effect specification (also called a variant in the source 
code
 below) is itself a list of 4 elements.  Element 1 is the value for
 `coq-compile-quick', where `quick' denotes both `quick-no-vio2vo'
 and `quick-and-vio2vo'.  Element 2 specifies the result of
-`coq-par-job-needs-compilation', nil for don't compile, t for do
-compile.  Elements 3-5 specify side effects.  Element 3 which file
+`coq-par-job-needs-compilation-quick', nil for don't compile, t for do
+compile.  Elements 3-4 specify side effects.  Element 3 which file
 must be deleted, where nil means no file must be deleted.  Element
 4 specifies which file name must be stored in the
 `required-obj-file' property of the job.  This file will be used
@@ -754,32 +758,28 @@ relative ages.")
    (lambda (test)
      (let ((test-id (format "%s" (car test))))
        ;; a test is a list of 4 elements and the first element is a list itself
-       (cl-assert
+       (should
        (and
         (eq (length test) 4)
-        (listp (car test)))
-       nil (concat test-id " 1"))
+        (listp (car test))))
        (mapc
        (lambda (variant)
          ;; a variant is a list of 4 elements
-         (cl-assert (eq (length variant) 4) nil (concat test-id " 2"))
+         (should (eq (length variant) 4))
          (let ((files (coq-par-test-flatten-files (car test)))
                (quick-mode (car variant))
                (compilation-result (nth 1 variant))
                (delete-result (nth 2 variant))
                (req-obj-result (nth 3 variant)))
            ;; the delete field, when set, must be a member of the files list
-           (cl-assert (or (not delete-result)
-                       (member delete-result files))
-                   nil (concat test-id " 3"))
+           (should (or (not delete-result)
+                       (member delete-result files)))
            ;; 8.4 compatibility check
            (when (and (or (eq quick-mode 'no-quick) (eq quick-mode 'ensure-vo))
                       (not (member 'vio files)))
-             (cl-assert (not delete-result)
-                     nil (concat test-id " 4"))
-             (cl-assert (eq compilation-result
-                         (not (eq (car (last (car test))) 'vo)))
-                     nil (concat test-id " 5")))))
+             (should (not delete-result))
+             (should (eq compilation-result
+                         (not (eq (car (last (car test))) 'vo)))))))
          (cdr test))))
    coq--par-job-needs-compilation-tests))
 
@@ -815,8 +815,8 @@ test the result and side effects wth `assert'."
        (file-descr-flattened (coq-par-test-flatten-files file-descr))
        same-time-stamp file-list
        obj-mod-result result)
-    (message "test case %s/576: %s %s%s" counter (car variant) file-descr
-            (if dep-just-compiled " just" ""))
+    (message "test case %d/576: %s %s just-compiled: %s"
+             counter (car variant) file-descr dep-just-compiled)
     (when (not compilation-result)
       (setq obj-mod-result req-obj-result))
     (ignore-errors
@@ -874,73 +874,102 @@ test the result and side effects wth `assert'."
        (sleep-for 0 15)))
     (when dep-just-compiled
       (put job 'youngest-coqc-dependency 'just-compiled))
-    (setq result (coq-par-job-needs-compilation job))
+    (setq result (coq-par-job-needs-compilation-quick job))
     ;; check result
-    (cl-assert (eq result compilation-result)
-           nil (concat id " result"))
+    (when coq--debug-auto-compilation
+      (message "check result"))
+    (should (eq result compilation-result))
     ;; check file deletion
-    (cl-assert (or (not delete-result)
+    (when coq--debug-auto-compilation
+      (message "check file deletion"))
+    (should (or (not delete-result)
                (not (file-attributes
-                     (test-coq-par-sym-to-file dir delete-result))))
-           nil (concat id " delete file"))
+                     (test-coq-par-sym-to-file dir delete-result)))))
     ;; check no other file is deleted
+    (when coq--debug-auto-compilation
+      (message "check no other file is deleted"))
     (dolist (f file-descr-flattened)
       (unless (eq f delete-result)
-       (cl-assert (file-attributes (test-coq-par-sym-to-file dir f))
-               nil (format "%s non del file %s: %s"
-                           id f
-                           (test-coq-par-sym-to-file dir f)))))
+       (should (file-attributes (test-coq-par-sym-to-file dir f)))))
     ;; check value of 'required-obj-file property
-    (cl-assert (equal (get job 'required-obj-file)
-                  (test-coq-par-sym-to-file dir req-obj-result))
-           nil (concat id " required-obj-file"))
+    (when coq--debug-auto-compilation
+      (message "check value of 'required-obj-file property"))
+    (should (equal (get job 'required-obj-file)
+                  (test-coq-par-sym-to-file dir req-obj-result)))
     ;; check 'obj-mod-time property
+    (when coq--debug-auto-compilation
+      (message "check 'obj-mod-time property with obj-mod-result %s"
+               (if obj-mod-result "set" "unset")))
     (if obj-mod-result
-       (cl-assert
+       (should
         (equal
          (get job 'obj-mod-time)
          (nth 5 (file-attributes
-                 (test-coq-par-sym-to-file dir obj-mod-result))))
-        nil (concat id " obj-mod-time non nil"))
-      (cl-assert (not (get job 'obj-mod-time))
-             nil (concat id " obj-mod-time nil")))
+                 (test-coq-par-sym-to-file dir obj-mod-result)))))
+      (should (not (get job 'obj-mod-time))))
     ;; check 'use-quick property
-    (cl-assert (eq (not (not (and compilation-result (eq req-obj-result 
'vio))))
-               (get job 'use-quick))
-           nil (concat id " use-quick"))
-    ;; check vio2vo-needed property
-    (cl-assert (eq
+    (when coq--debug-auto-compilation
+      (message "check 'use-quick property"))
+    (should (eq (not (not (and compilation-result (eq req-obj-result 'vio))))
+               (eq (get job 'use-quick) 'vio)))
+    ;; Check vio2vo-needed property: this property is not present in
+    ;; the test specification because it can be logically derived. The
+    ;; property must be present, if and only if vio2vo mode is
+    ;; selected, a vio will be produced and the vo is unusable, either
+    ;; because it is not present or it must be deleted.
+    (when coq--debug-auto-compilation
+      (message "check vio2vo-needed property"))
+    (should (eq
             (and (eq quick-mode 'quick-and-vio2vo)
                  (eq req-obj-result 'vio)
                  (or (eq delete-result 'vo)
                      (not (member 'vo file-descr-flattened))))
-            (get job 'vio2vo-needed))
-           nil (concat id " vio2vo-needed wrong"))
+            (eq (get job 'second-stage) 'vio2vo)))
     (ignore-errors
       (delete-directory dir t))))
 
-(defvar test-coq-par-counter 0
+
+(defvar test--coq-par-counter 0
   "Stupid counter.")
 
+(defconst test--coq-par-only-test nil
+  "If non-nil, run this test only.
+Must be nil under normal circumstances. Can be set to a number
+for debugging, then only this test number is run.")
+
+
+(defun test-coq-par-one-test-wrapper
+    (counter dir file-descr variant dep-just-compiled)
+  "Wrapper around `test-coq-par-one-test'."
+  (when (or
+         (not test--coq-par-only-test)
+         (and test--coq-par-only-test
+              (eq test--coq-par-only-test test--coq-par-counter)))
+    (test-coq-par-one-test
+     counter dir file-descr variant dep-just-compiled)))
+
+
 (defun test-coq-par-one-spec (dir files variant dep-just-compiled)
   "Run one test for one variant and split it for the 2 quick settings."
   (if (eq (car variant) 'quick)
       (progn
-       (test-coq-par-one-test test-coq-par-counter dir files
-                              (cons 'quick-no-vio2vo (cdr variant))
-                              dep-just-compiled)
-       (setq test-coq-par-counter (1+ test-coq-par-counter))
-       (test-coq-par-one-test test-coq-par-counter dir files
-                              (cons 'quick-and-vio2vo (cdr variant))
-                              dep-just-compiled))
-    (test-coq-par-one-test test-coq-par-counter dir files variant
-                          dep-just-compiled))
-  (setq test-coq-par-counter (1+ test-coq-par-counter)))
-
-(defun test-coq-par-job-needs-compilation (dir)
+       (test-coq-par-one-test-wrapper
+         test--coq-par-counter dir files (cons 'quick-no-vio2vo (cdr variant))
+        dep-just-compiled)
+       (setq test--coq-par-counter (1+ test--coq-par-counter))
+       (test-coq-par-one-test-wrapper
+         test--coq-par-counter dir files (cons 'quick-and-vio2vo (cdr variant))
+        dep-just-compiled))
+    (test-coq-par-one-test-wrapper test--coq-par-counter dir files variant
+                                  dep-just-compiled))
+  (setq test--coq-par-counter (1+ test--coq-par-counter)))
+
+(defun test-coq-par-job-needs-compilation-quick-fun (dir)
   "Check test data wellformedness and run all the tests."
+  (when coq--debug-auto-compilation
+    (message "check coq--par-job-needs-compilation-tests invariant")) 
   (test-coq-par-test-data-invarint)
-  (setq test-coq-par-counter 1)
+  (setq test--coq-par-counter 1)
   (mapc
    (lambda (test)
      (mapc
@@ -951,12 +980,10 @@ test the result and side effects wth `assert'."
       (cdr test)))
    coq--par-job-needs-compilation-tests))
 
-(condition-case err
-    (progn
-      (test-coq-par-job-needs-compilation (make-temp-name "/tmp/coq-par-test"))
-      (message "test completed successfully"))
-  (error
-   (message "test failed with %s" err)
-   (kill-emacs 1)))
+(ert-deftest test-coq-par-job-needs-compilation-quick ()
+  "Run all tests for coq-par-job-needs-compilation-quick."
+  ;;(setq coq--debug-auto-compilation t)
+  (test-coq-par-job-needs-compilation-quick-fun
+   (make-temp-name "/tmp/coq-par-test")))
 
-;;; coq-par-test.el ends here
+;;; test-coq-par-job-needs-compilation-quick.el ends here
diff --git a/ci/simple-tests/test-coqtop-unavailable.el 
b/ci/simple-tests/test-coqtop-unavailable.el
new file mode 100644
index 0000000000..6628238916
--- /dev/null
+++ b/ci/simple-tests/test-coqtop-unavailable.el
@@ -0,0 +1,24 @@
+;; This file is part of Proof General.
+;; 
+;; © Copyright 2021  Hendrik Tews
+;; 
+;; Authors: Hendrik Tews
+;; Maintainer: Hendrik Tews <hendrik@askra.de>
+;; 
+;; SPDX-License-Identifier: GPL-3.0-or-later
+
+;;; Commentary:
+;;
+;; Test that Proof General can open Coq files even when coqtop is
+;; unavailable.
+
+
+(ert-deftest coqtop-unavailable ()
+  "Proof General can open Coq files even when coqtop is unavailable.."
+  (setq coq-prog-name "unavailable-program")
+
+  ;; ensure coq-prog-name cannot be found
+  (should (not (locate-file coq-prog-name exec-path)))
+
+  (find-file "simple.v")
+  (coq-prog-args))
diff --git a/ci/simple-tests/test-omit-proofs.el 
b/ci/simple-tests/test-omit-proofs.el
new file mode 100644
index 0000000000..64dcb6473b
--- /dev/null
+++ b/ci/simple-tests/test-omit-proofs.el
@@ -0,0 +1,154 @@
+;; This file is part of Proof General.
+;; 
+;; © Copyright 2021  Hendrik Tews
+;; 
+;; Authors: Hendrik Tews
+;; Maintainer: Hendrik Tews <hendrik@askra.de>
+;; 
+;; SPDX-License-Identifier: GPL-3.0-or-later
+
+;;; Commentary:
+;;
+;; Test the omit proofs feature
+;;
+;; Test that with proof-omit-proofs-option
+;; - the proof _is_ processed when using a prefix argument
+;; - in this case the proof as normal locked color
+;; - without prefix arg, the proof is omitted
+;; - the proof has omitted color then
+;; - stuff before the proof still has normal color
+
+;; reimplement seq-some from the seq package
+;; seq-some not present in emacs 24
+;; XXX consider to switch to seq-some when support for emacs 24 is dropped
+(defun list-some (pred list)
+  "Return non-nil if PRED is satisfied for at least one element of LIST.
+If so, return the first non-nil value returned by PRED."
+  (let (res)
+    (while (and (consp list) (not res))
+      (setq res (funcall pred (car list)))
+      (setq list (cdr list)))
+    res))
+
+(defun wait-for-coq ()
+  "Wait until processing is complete."
+  (while (or proof-second-action-list-active
+             (consp proof-action-list))
+    ;; (message "wait for coq/compilation with %d items queued\n"
+    ;;          (length proof-action-list))
+    ;;
+    ;; accept-process-output without timeout returns rather quickly,
+    ;; apparently most times without process output or any other event
+    ;; to process.
+    (accept-process-output nil 0.1)))
+  
+(defun overlay-less (a b)
+  "Compare two overlays.
+Return t if overlay A has smaller size than overlay B and should
+therefore have a higher priority."
+  (let ((sa (- (overlay-end a) (overlay-start a)))
+        (sb (- (overlay-end b) (overlay-start b))))
+    (<= sa sb)))
+
+(defun overlays-at-point-sorted ()
+  "Return overlays at point in decreasing order of priority.
+Works only if no overlays has a priority property. Same
+'(overlays-at (point) t)', except that it also works on Emacs <= 25."
+  (sort (overlays-at (point) t) 'overlay-less))
+
+(defun first-overlay-face ()
+  "Return the face of the first overlay/span that has a face property.
+Properties configured in that face are in effect. Properties not
+configured there may be taken from faces with less priority."
+  (list-some
+   (lambda (ov) (overlay-get ov 'face))
+   ;; Need to sort overlays oneself, because emacs 25 returns overlays
+   ;; in increasing instead of decreasing priority.
+   (overlays-at-point-sorted)))
+
+(ert-deftest omit-proofs-omit-and-not-omit ()
+  "Test the omit proofs feature.
+In particular, test that with proof-omit-proofs-option configured:
+- the proof _is_ processed when using a prefix argument
+- in this case the proof as normal locked color
+- without prefix arg, the proof is omitted
+- the proof has omitted color then
+- stuff before the proof still has normal color "
+  (setq proof-omit-proofs-option t
+        proof-three-window-enable nil)
+  (find-file "omit_test.v")
+
+  ;; Check 1: check that the proof is valid and omit can be disabled
+  (message "1: check that the proof is valid and omit can be disabled")
+  (should (search-forward "automatic test marker 4" nil t))
+  (forward-line -1)
+  ;; simulate C-u prefix argument
+  (proof-goto-point '(4))
+  (wait-for-coq)
+  ;; Look into the *coq* buffer to find out whether the proof was
+  ;; processed fully without error. This is necessary for Coq >= 8.11.
+  ;; Coq < 8.11 prints a defined message, which ends up in *response*,
+  ;; for those versions it would be better to simply check the
+  ;; *response* buffer. However, consolidating all this is not easy,
+  ;; therefore I check the message in *coq* also for Coq < 8.11.
+  (with-current-buffer "*coq*"
+    ;; output *coq* content for debugging
+    ;; (message
+    ;;  "*coq* content:\n%s"
+    ;;  ;; (max 0 (- (point-max) 400))
+    ;;  (buffer-substring-no-properties (point-min) (point-max)))
+
+    (goto-char (point-max))
+    ;; goto second last prompt
+    (should (search-backward "</prompt>" nil t 2))
+    ;; move behind prompt
+    (forward-char 9)
+    ;; There should be a Qed with no error or message after it
+    (should
+     (or
+      ;; for Coq 8.11 and later
+      (looking-at "Qed\\.\n\n<prompt>Coq <")
+      ;; for Coq 8.10 and earlier
+      ;; in 8.9 the message is on 1 line, in 8.10 on 3
+      (looking-at "Qed\\.\n<infomsg>\n?classic_excluded_middle is defined"))))
+
+  ;; Check 2: check proof-locked-face is active at marker 2 and 3
+  (message "2: check proof-locked-face is active at marker 2 and 3")
+  (should (search-backward "automatic test marker 2" nil t))
+  (should (eq (first-overlay-face) 'proof-locked-face))
+  (should (search-forward "automatic test marker 3" nil t))
+  (should (eq (first-overlay-face) 'proof-locked-face))
+
+  ;; Check 3: check that the second proof is omitted
+  (message "3: check that the second proof is omitted")
+  ;; first retract
+  (should (search-backward "automatic test marker 1" nil t))
+  (proof-goto-point)
+  (wait-for-coq)
+  ;; move forward again
+  (should (search-forward "automatic test marker 4" nil t))
+  (forward-line -1)
+  (proof-goto-point)
+  (wait-for-coq)
+  (with-current-buffer "*response*"
+    (goto-char (point-min))
+    ;; There should be a declared message.
+    (should (looking-at "classic_excluded_middle is declared")))
+
+  ;; Check 4: check proof-omitted-proof-face is active at marker 3
+  (message "4: check proof-omitted-proof-face is active at marker 3")
+  (should (search-backward "automatic test marker 3" nil t))
+  ;; debug overlay order
+  ;; (mapc
+  ;;  (lambda (ov)
+  ;;    (message "OV %d-%d face %s"
+  ;;             (overlay-start ov) (overlay-end ov) (overlay-get ov 'face)))
+  ;;    (overlays-at-point-sorted))
+  (should (eq (first-overlay-face) 'proof-omitted-proof-face))
+
+  ;; Check 5: check proof-locked-face is active at marker 1 and 2
+  (message "5: check proof-locked-face is active at marker 1 and 2")
+  (should (search-backward "automatic test marker 1" nil t))
+  (should (eq (first-overlay-face) 'proof-locked-face))
+  (should (search-forward "automatic test marker 2" nil t))
+  (should (eq (first-overlay-face) 'proof-locked-face)))
diff --git a/ci/simple-tests/test-prelude-correct.el 
b/ci/simple-tests/test-prelude-correct.el
new file mode 100644
index 0000000000..77676d205b
--- /dev/null
+++ b/ci/simple-tests/test-prelude-correct.el
@@ -0,0 +1,92 @@
+;; This file is part of Proof General.
+;; 
+;; © Copyright 2021  Hendrik Tews
+;; 
+;; Authors: Hendrik Tews
+;; Maintainer: Hendrik Tews <hendrik@askra.de>
+;; 
+;; SPDX-License-Identifier: GPL-3.0-or-later
+
+;;; Commentary:
+;;
+;; Test that the Proof General prelude is correct.
+;;
+;; I use Proof General prelude here to refer to the initialization
+;; commands that Proof General sends to Coq before the first command
+;; of the script.
+
+;; This test shows different behaviour before 8.10. When the problem
+;; is fixed, I expect that the version distinction is no longer
+;; necessary and can be deleted.
+;;
+;; Load stuff for `coq--version<'
+(require 'proof-site)
+(proof-ready-for-assistant 'coq)
+(require 'coq-system)
+
+(defconst coq--post-v810 (coq--post-v810)
+  "t if Coq is more recent than 8.9")
+
+(message "goal present tests run with Coq version %s; post-v810: %s"
+         (coq-version t) coq--post-v810)
+
+
+;;; Coq source code for tests 
+
+(defconst coq-src-proof
+  "Check 1."
+  "Coq source code for checking the prelude.")
+
+
+;;; utility functions
+
+(defun record-buffer-content (buf)
+  "Record buffer content of BUF via `message' for debugging.
+BUF should be a string."
+  (with-current-buffer buf
+    (let ((content (buffer-substring-no-properties (point-min) (point-max))))
+      (message "%s buffer contains %d chars: %s" buf (length content) 
content))))
+
+(defun wait-for-coq ()
+  "Wait until processing is complete."
+  (while (or proof-second-action-list-active
+             (consp proof-action-list))
+    ;; (message "wait for coq/compilation with %d items queued\n"
+    ;;          (length proof-action-list))
+    ;;
+    ;; accept-process-output without timeout returns rather quickly,
+    ;; apparently most times without process output or any other event
+    ;; to process.
+    (accept-process-output nil 0.1)))
+
+
+;;; define the test
+
+(ert-deftest prelude-correct ()
+  :expected-result (if coq--post-v810 :passed :failed)
+  "Test that the Proof Genneral prelude is correct.
+Check that all the commands that Proof General sends as
+initialization before the first script command to Coq do not
+yield an error."
+  (message "prelude-correct test: Check the Proof General prelude")
+  (setq proof-three-window-enable nil)
+  (let (buffer)
+    (unwind-protect
+        (progn
+          (find-file "goals.v")
+          (setq buffer (current-buffer))
+          (insert coq-src-proof)
+          (proof-goto-point)
+          (wait-for-coq)
+          (record-buffer-content "*coq*")
+
+          ;; check that there is no error in *coq*
+          (with-current-buffer "*coq*"
+            (goto-char (point-min))
+            (should (not (re-search-forward "Error:" nil t)))))
+
+      ;; clean up
+      (when buffer
+        (with-current-buffer buffer
+          (set-buffer-modified-p nil))
+        (kill-buffer buffer)))))
diff --git a/ci/test-indent/.gitignore b/ci/test-indent/.gitignore
new file mode 100644
index 0000000000..8e2384ae58
--- /dev/null
+++ b/ci/test-indent/.gitignore
@@ -0,0 +1 @@
+indented_*
\ No newline at end of file
diff --git a/ci/test-indent/Makefile b/ci/test-indent/Makefile
new file mode 100644
index 0000000000..ff733d438e
--- /dev/null
+++ b/ci/test-indent/Makefile
@@ -0,0 +1,22 @@
+# This file is part of Proof General.
+# 
+# © Copyright 2021  Pierre Courtieu
+# 
+# Authors: Pierre Courtieu
+# Maintainer: Pierre Courtieu <Pierre.Courtieu@cnam.fr>
+# 
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+TESTS:=$(wildcard indent-*.v)
+INDENTED:=$(subst indent-,indented_indent-, $(TESTS))
+
+all: $(INDENTED)
+
+indented_%.v: %.v
+       @echo "### testing indentation of $<..."
+       @./coq-test-indent.sh $<
+
+.PHONY: clean
+
+clean:
+       rm -f indented_indent*
diff --git a/ci/test-indent/coq-test-indent.el 
b/ci/test-indent/coq-test-indent.el
new file mode 100644
index 0000000000..2320433137
--- /dev/null
+++ b/ci/test-indent/coq-test-indent.el
@@ -0,0 +1,96 @@
+;;; Regression testing of indentation.
+
+;;; Initially the file is indented as it is supposed to be. Each line
+;;; is unindented, then indented. If the new indentation differ a
+;;; comment is added to signal it.
+
+;;; WARNING: there are relative path names, so this currently works
+;;; only frowhen the current directory is the one containin this file.
+
+(defun blank-line-p ()
+  (= (current-indentation)
+     (- (line-end-position) (line-beginning-position))))
+
+
+(defun line-fixindent ()
+  (save-excursion 
+    (let ((end (line-end-position)))
+      (re-search-forward "fixindent" end t))))
+
+
+(defun test-indent-line (&optional nocomment)
+  (interactive)
+  (unless (or (blank-line-p) (line-fixindent))
+    (back-to-indentation)
+    (let ((init-col (current-column)))
+      ;; avoid moving comments 
+      (unless (proof-inside-comment (point)) (delete-horizontal-space))
+      (indent-according-to-mode)
+      (let ((res (- (current-column) init-col)))
+        (unless (= 0 res)
+          (save-excursion
+            (end-of-line)
+            (unless nocomment
+              (insert (format " (*<=== %s%d INDENT CHANGED *)"
+                              (if (< res 0) "" "+")
+                              res))))
+          res)
+        0))))
+
+
+(defun remove-previous-comment ()
+  (interactive)
+  (save-excursion
+    (end-of-line)
+    (let* ((com (re-search-backward " (\\*<===" (line-beginning-position) t))
+           (strt (and com (point)))
+           (end (and com (line-end-position))))
+      (when com (delete-region strt end)))))
+
+
+(defun test--indent-region (beg end boxed &optional nocomment)
+  (let ((line-move-visual nil)
+        ;; we store the last line number rather than the position
+        ;; since by inderting things we shift the end pos, but not the
+        ;; end line.
+        (last-line (line-number-at-pos end))
+        (stop nil))
+    (set (make-local-variable 'coq-indent-box-style) boxed)
+    (goto-char beg)
+    (while (and (<= (line-number-at-pos) last-line)
+                (not stop))
+      (remove-previous-comment)
+      (test-indent-line nocomment)
+      (setq stop (/= (forward-line) 0)))))
+
+(defun remove-comments-region (beg end)
+  (interactive "r")
+  (goto-char beg)
+  (let ((line-move-visual nil))
+    (while (< (point) end);; loops because end position changes.
+      (remove-previous-comment)
+      (forward-line))))
+
+
+(defun test-indent-region (beg end &optional boxed nocomment)
+  (interactive "r\nP")
+  (test--indent-region beg end boxed nocomment))
+
+
+(defun test-indent-region-boxed (beg end &optional nocomment)
+  (interactive "r")
+  (test--indent-region beg end t nocomment))
+
+
+(defun test-indent-buffer (&optional nocomment) (interactive)
+       (test--indent-region (point-min) (point-max) nil nocomment))
+
+(defun test-indent-buffer-boxed (&optional nocomment) (interactive)
+       (test--indent-region (point-min) (point-max) t nocomment))
+
+(defun launch-test (orig indented &optional boxed)
+    (load-file "../../generic/proof-site.el")
+    (find-file orig)
+    (write-file indented)
+    (if boxed (test-indent-buffer-boxed t) (test-indent-buffer t))
+    (write-file indented))
diff --git a/ci/test-indent/coq-test-indent.sh 
b/ci/test-indent/coq-test-indent.sh
new file mode 100755
index 0000000000..2f35397927
--- /dev/null
+++ b/ci/test-indent/coq-test-indent.sh
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+# This script should be launched from its own directory, so that file
+# coq-test-indent.el is accessible.
+
+GREEN='\033[1;32m'
+RED='\033[1;31m'
+MAGENTA='\033[1;35m'
+NC='\033[0m' # No Color
+
+TESTFILE=$1
+INDENTEDTESTFILE=indented_$1
+
+BOXED="nil" 
+if [[ "$1" == *"boxed.v" ]];
+then
+    BOXED="t"
+fi
+
+echo "cp $TESTFILE $INDENTEDTESTFILE"
+cp $TESTFILE $INDENTEDTESTFILE
+
+emacs -q -batch --eval "(progn (load-file \"coq-test-indent.el\") (launch-test 
\"$TESTFILE\" \"$INDENTEDTESTFILE\" $BOXED))" 
+
+# echo "grep \"INDENT CHANGED\" $INDENTEDTESTFILE"
+# grep "INDENT CHANGED" $INDENTEDTESTFILE
+echo -n " diff -q $TESTFILE $INDENTEDTESTFILE..."
+diff -q $TESTFILE $INDENTEDTESTFILE
+if [[ "$?" == 1 ]] ;
+then echo " DIFFERENCES FOUND" 
+     diff -u $TESTFILE $INDENTEDTESTFILE
+     printf "${RED} TEST FAILURE ***${NC}\n"
+     echo "  *** details can be seen by reproducing the tests:"
+     echo "  *** cd ci/test-indent"
+     echo "  *** make"
+     echo "  ***  diff --side-by-side --suppress-common-lines $TESTFILE 
$INDENTEDTESTFILE"
+     echo "  *** or graphically: "
+     echo "  ***  meld $TESTFILE $INDENTEDTESTFILE"
+     exit 1 # Make the test program fail, so that CI knows.
+else echo "NO DIFFERENCE"
+     printf "${GREEN} TEST SUCCESS *** ${NC}\n"
+     exit 0
+fi
diff --git a/ci/test-indent/indent-commands-boxed.v 
b/ci/test-indent/indent-commands-boxed.v
new file mode 100644
index 0000000000..f22bb5074d
--- /dev/null
+++ b/ci/test-indent/indent-commands-boxed.v
@@ -0,0 +1,268 @@
+
+Require Export Coq.Lists.List.
+
+Module Mod.
+
+  Module Foo.
+    Axiom X:Set.
+    Axiom Y:Set.
+    Axiom Z:Set.
+  End Foo.
+  
+  Section Sec.
+    Axiom X:Set.
+    Axiom Y:Set.
+    Axiom Z:Set.
+  End Sec.
+
+  Definition a1 := 1.
+  Definition A2 := 1.
+  Definition arith1:=
+    1.
+  Definition arith1
+    :=
+    1.
+  Definition
+    arith1
+    :=
+    1.
+
+  Let x := 1.  Let y := 2.
+
+  Notation "[ a ; .. ; b ]" := (a :: .. (b :: []) ..) : list_scope.
+  
+  
+  Inductive test : nat -> Prop :=
+    C1 : forall n, test n
+  | C2 : forall n, test n
+  | C3 : forall n, test n
+  | C4 : forall n, test n.
+  
+  Inductive testbar' : nat -> Prop :=
+  | Cbar1 : forall n, test n
+  | Cbar2 : forall n, test n
+  | Cbar3 : forall n, test n
+  | Cbar4 : forall n, test n.
+  
+  Inductive test2 : nat -> Prop
+    := | C21 : forall n, test2 n
+  | C22 : forall n, test2 n
+  | C23 : forall n, test2 n
+  | C24 : forall n, test2 n.
+  
+  Inductive test' : nat -> Prop :=
+    C1' : forall n, test' n
+  | C2' : forall n, test' n
+  | C3' : forall n, test' n
+  | C4' : forall n, test' n
+  with
+    test2' : nat -> Prop :=
+    C21' : forall n, test2' n
+  | C22' : forall n, test2' n
+  | C23' : forall n, test2' n
+  | C24' : forall n, test2' n
+  with test3' : nat -> Prop :=
+    C21' : forall n, test2' n
+  | C22' : forall n, test2' n
+  | C23' : forall n, test2' n
+  | C24' : forall n, test2' n
+  with test4' : nat -> Prop :=
+  | C21' : forall n, test2' n
+  | C22' : forall n, test2' n
+  | C23' : forall n, test2' n
+  | C24' : forall n, test2' n.
+  
+  
+  Inductive test3
+    : nat -> Prop
+    := C31 : forall n, test3 n
+  | C32 : forall n, test3 n
+  | C33 : forall n, test3 n .
+  
+  (* Goal parenthesizing. *)
+  Lemma L : True.
+  Proof.
+    idtac.
+    idtac... (* special case of command ender. *)
+    idtac.
+  Qed.
+
+  (* Goal starter *)
+  Definition Foo:True.
+    exact I.
+  Defined.
+
+  (* Bullets. *)
+  Lemma L : forall x:nat , Nat.iter x (A:=nat) (plus 2) 0 >= x.
+  Proof.
+    idtac. idtac.
+    idtac.
+    {
+      idtac.
+      idtac.
+    }
+    idtac. {
+      idtac.
+      idtac. }
+    { idtac.
+      idtac.
+    }
+    {
+      idtac.
+      idtac.
+    }
+    { idtac. {
+        idtac.
+        idtac.
+      }
+      idtac.
+
+      { idtac . {
+          idtac.
+          idtac.
+        }
+      }
+      idtac.
+    }
+    idtac. { idtac. {
+        idtac.
+        idtac.
+      }
+    }
+    idtac.
+    
+    { idtac    . {
+        idtac.
+        idtac.
+      }
+    }
+    {
+      idtac.
+      idtac.
+      idtac. {
+        idtac.
+        idtac.
+      }
+      idtac.
+    }
+  Qed.
+
+  Lemma L : forall x:nat , Nat.iter x (A:=nat) (plus 2) 0 >= x.
+  Proof.
+    idtac.
+    { idtac.
+      idtac. }
+    { 
+      idtac.
+      idtac.
+    }
+    { idtac. {
+        idtac.
+        idtac.
+      }
+      idtac.
+    }
+    { idtac. idtac. { idtac.
+                      idtac. }
+      idtac.
+    }
+    { idtac. { idtac. {
+          idtac.
+          idtac.
+        }
+        idtac.
+      }
+    }
+    { idtac. { idtac.
+               {
+                 idtac.
+                 idtac.
+               }
+               idtac.
+               idtac.
+               idtac.
+      }
+      idtac.
+    }
+    {
+      idtac.
+      - idtac.
+        idtac. {
+          idtac.
+          idtac.
+        }
+        idtac.
+    }
+  Qed.
+
+
+  Lemma L : forall x:nat , Nat.iter x (A:=nat) (plus 2) 0 >= x.
+  Proof.
+    idtac.
+    -
+      idtac.
+      idtac.
+    - idtac.
+      idtac.
+      + idtac.
+        idtac.
+      + idtac.
+        idtac.
+        * idtac.
+    - idtac.
+  Qed.
+
+  Lemma L : forall x:nat , Nat.iter x (A:=nat) (plus 2) 0 >= x.
+  Proof.
+    idtac.
+    -
+      idtac.
+      idtac.
+      idtac.
+      idtac.
+    - idtac.
+      { idtac.
+        - idtac.
+          idtac.
+        - idtac.
+          idtac.
+      }
+    - idtac. idtac. {
+        idtac.
+        - idtac.
+          idtac.
+        - idtac.
+          idtac.
+      }
+      idtac.
+    - idtac.
+  Qed.
+
+
+  (* goal selectors. *)
+  Lemma L : forall x:nat , Nat.iter x (A:=nat) (plus 2) 0 >= x.
+  Proof.
+    idtac.
+    2:idtac.
+    3-6:idtac.
+
+    2:{ idtac.
+        idtac. }
+    { 
+      idtac.
+      idtac.
+    }
+    [foo]:{
+      idtac.
+      - idtac.
+        idtac. {
+          idtac.
+          idtac.
+        }
+        idtac.
+    }
+  Qed.
+
+
+
+End Mod.
diff --git a/ci/test-indent/indent-commands.v b/ci/test-indent/indent-commands.v
new file mode 100644
index 0000000000..9d1c52cb71
--- /dev/null
+++ b/ci/test-indent/indent-commands.v
@@ -0,0 +1,265 @@
+
+Require Export Coq.Lists.List.
+
+Module Mod.
+
+  Module Foo.
+    Axiom X:Set.
+    Axiom Y:Set.
+    Axiom Z:Set.
+  End Foo.
+  
+  Section Sec.
+    Axiom X:Set.
+    Axiom Y:Set.
+    Axiom Z:Set.
+  End Sec.
+
+  Definition a1 := 1.
+  Definition A2 := 1.
+  Definition arith1:=
+    1.
+  Definition arith1
+    :=
+    1.
+  Definition
+    arith1
+    :=
+    1.
+
+  Let x := 1.  Let y := 2.
+               
+  Notation "[ a ; .. ; b ]" := (a :: .. (b :: []) ..) : list_scope.
+  
+  
+  Inductive test : nat -> Prop :=
+    C1 : forall n, test n
+  | C2 : forall n, test n
+  | C3 : forall n, test n
+  | C4 : forall n, test n.
+  
+  Inductive testbar' : nat -> Prop :=
+  | Cbar1 : forall n, test n
+  | Cbar2 : forall n, test n
+  | Cbar3 : forall n, test n
+  | Cbar4 : forall n, test n.
+  
+  Inductive test2 : nat -> Prop
+    := | C21 : forall n, test2 n
+  | C22 : forall n, test2 n
+  | C23 : forall n, test2 n
+  | C24 : forall n, test2 n.
+  
+  Inductive test' : nat -> Prop :=
+    C1' : forall n, test' n
+  | C2' : forall n, test' n
+  | C3' : forall n, test' n
+  | C4' : forall n, test' n
+  with
+    test2' : nat -> Prop :=
+    C21' : forall n, test2' n
+  | C22' : forall n, test2' n
+  | C23' : forall n, test2' n
+  | C24' : forall n, test2' n
+  with test3' : nat -> Prop :=
+    C21' : forall n, test2' n
+  | C22' : forall n, test2' n
+  | C23' : forall n, test2' n
+  | C24' : forall n, test2' n
+  with test4' : nat -> Prop :=
+  | C21' : forall n, test2' n
+  | C22' : forall n, test2' n
+  | C23' : forall n, test2' n
+  | C24' : forall n, test2' n.
+  
+  
+  Inductive test3
+    : nat -> Prop
+    := C31 : forall n, test3 n
+  | C32 : forall n, test3 n
+  | C33 : forall n, test3 n .
+  
+  (* Goal parenthesizing. *)
+  Lemma L : True.
+  Proof.
+    idtac.
+    idtac... (* special case of command ender. *)
+    idtac.
+  Qed.
+
+  (* Goal starter *)
+  Definition Foo:True.
+    exact I.
+  Defined.
+
+  (* Bullets. *)
+  Lemma L : forall x:nat , Nat.iter x (A:=nat) (plus 2) 0 >= x.
+  Proof.
+    idtac. idtac.
+    idtac.
+    {
+      idtac.
+      idtac.
+    }
+    idtac. {
+      idtac.
+      idtac. }
+    { idtac.
+      idtac.
+    }
+    {
+      idtac.
+      idtac.
+    }
+    { idtac. {
+        idtac.
+        idtac.
+      }
+      idtac.
+           
+      { idtac . {
+          idtac.
+          idtac.
+        }
+      }
+      idtac.
+    }
+    idtac. { idtac. {
+        idtac.
+        idtac.
+      }
+    }
+    idtac.
+    
+    { idtac    . {
+        idtac.
+        idtac.
+      }
+    }
+    {
+      idtac.
+      idtac.
+      idtac. {
+        idtac.
+        idtac.
+      }
+      idtac.
+    }
+  Qed.
+
+  Lemma L : forall x:nat , Nat.iter x (A:=nat) (plus 2) 0 >= x.
+  Proof.
+    idtac.
+    { idtac.
+      idtac. }
+    { 
+      idtac.
+      idtac.
+    }
+    { idtac. {
+        idtac.
+        idtac.
+      }
+      idtac.
+    }
+    { idtac. idtac. { idtac.
+                      idtac. }
+      idtac.
+    }
+    { idtac. { idtac. {
+          idtac.
+          idtac.
+    }} }
+    { idtac. { idtac.
+               {
+                 idtac.
+                 idtac.
+               }
+               idtac.
+               idtac.
+               idtac.
+      }
+      idtac.
+    }
+    {
+      idtac.
+      - idtac.
+        idtac. {
+          idtac.
+          idtac.
+        }
+        idtac.
+    }
+  Qed.
+
+
+  Lemma L : forall x:nat , Nat.iter x (A:=nat) (plus 2) 0 >= x.
+  Proof.
+    idtac.
+    -
+      idtac.
+      idtac.
+    - idtac.
+      idtac.
+      + idtac.
+        idtac.
+      + idtac.
+        idtac.
+        * idtac.
+    - idtac.
+  Qed.
+
+  Lemma L : forall x:nat , Nat.iter x (A:=nat) (plus 2) 0 >= x.
+  Proof.
+    idtac.
+    -
+      idtac.
+      idtac.
+      idtac.
+      idtac.
+    - idtac.
+      { idtac.
+        - idtac.
+          idtac.
+        - idtac.
+          idtac.
+      }
+    - idtac. idtac. {
+        idtac.
+        - idtac.
+          idtac.
+        - idtac.
+          idtac.
+      }
+      idtac.
+    - idtac.
+  Qed.
+
+
+  (* goal selectors. *)
+  Lemma L : forall x:nat , Nat.iter x (A:=nat) (plus 2) 0 >= x.
+  Proof.
+    idtac.
+    2:idtac.
+    3-6:idtac.
+
+    2:{ idtac.
+        idtac. }
+    { 
+      idtac.
+      idtac.
+    }
+    [foo]:{
+      idtac.
+      - idtac.
+        idtac. {
+          idtac.
+          idtac.
+        }
+        idtac.
+    }
+  Qed.
+
+
+
+End Mod.
diff --git a/ci/test-indent/indent-equations.v 
b/ci/test-indent/indent-equations.v
new file mode 100644
index 0000000000..3e200b5f2a
--- /dev/null
+++ b/ci/test-indent/indent-equations.v
@@ -0,0 +1,79 @@
+(* Needs Equations plugin to work. *)
+
+From Coq Require Import Arith Omega Program.
+From Equations Require Import Equations.
+Require Import Bvector.
+
+
+Module Equations.
+  Equations neg (b : bool) : bool :=
+    neg true := false ;
+    neg false := true.
+
+  Lemma neg_inv : forall b, neg (neg b) = b.
+  Proof.
+    intros b.
+    funelim (neg b); now simp neg.
+  Defined.
+
+
+  Inductive list {A} : Type := nil : list | cons : A -> list -> list.
+
+  Arguments list : clear implicits.
+  Notation "x :: l" := (cons x l). 
+
+  Equations tail {A} (l : list A) : list A :=
+  | nil := nil ;
+  | (cons a v) := v.
+
+  Equations tail' {A} (l : list A) : list A :=
+  | nil :=
+      nil ;
+  | (cons a v)
+      := v.
+
+  (* The cases inside { } are recognized as record fields, which from
+     an indentation perspective is OK *)
+  Equations filter {A} (l : list A) (p : A -> bool) : list A :=
+    filter nil p := nil; 
+    filter (cons a l) p with p a => { 
+      | true := a :: filter l p ;
+      | false := filter l p
+      }.
+
+  Equations filter' {A} (l : list A) (p : A -> bool) : list A :=
+    filter' (cons a l) p with p a =>
+      { 
+      | true := a :: filter' l p ;
+      | false := filter' l p
+      };
+    filter' nil p := nil.
+
+  Equations filter' {A} (l : list A) (p : A -> bool) : list A :=
+    filter' (cons a l) p with p a =>
+      { 
+        true := a :: filter' l p ;
+        false := filter' l p
+      };
+    filter' nil p := nil.
+
+  Equations filter'' {A} (l : list A) (p : A -> bool) : list A :=
+    filter'' (cons a l) p with p a =>
+      { | true := a :: filter'' l p ;
+      | false := filter'' l p };
+    filter'' nil p := nil.
+
+  Equations unzip {A B} (l : list (A * B)) : list A * list B :=
+    unzip nil := (nil, nil) ;
+    unzip (cons p l) with unzip l => {
+        unzip (cons (pair a b) l) (pair la lb) := (a :: la, b :: lb) }.
+
+
+  Equations equal (n m : nat) : { n = m } + { n <> m } :=
+    equal O O := left eq_refl ;
+    equal (S n) (S m) with equal n m :=
+      { equal (S n) (S ?(n)) (left eq_refl) := left eq_refl ;
+        equal (S n) (S m) (right p) := right _ } ;
+    equal x y := right _.
+  
+End Equations.
diff --git a/ci/test-indent/indent-inside-command-boxed.v 
b/ci/test-indent/indent-inside-command-boxed.v
new file mode 100644
index 0000000000..b5b0e9330a
--- /dev/null
+++ b/ci/test-indent/indent-inside-command-boxed.v
@@ -0,0 +1,104 @@
+
+Require Export
+        Coq.Lists.List.
+Require
+  Export
+  Arith.
+
+Module
+  Mod.
+
+  Module
+    Foo.
+    Axiom
+      X
+      :
+      Set.
+    Axiom Y
+      :
+      Set.
+    Axiom Z:
+      Set.
+  End
+    Foo.
+  
+
+  Definition a1 :=
+    1.
+  Definition A2
+    := 1.
+  Definition arith1
+    :=
+    1.
+  Definition
+    arith1
+    :=
+    1.
+
+  Let x := 1.  Let y := 2.
+
+  Notation "[ a ; .. ; b ]" := (a :: .. (b :: []) ..) : list_scope.
+  
+  
+  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 parenthesizing. *)
+  Lemma L :
+    True.
+  Proof.
+    idtac.
+    idtac... (* special case of command ender. *)
+    idtac.
+  Qed.
+
+
+  Lemma L4 : forall x:nat,
+               Nat.iter x (A:=nat)
+                        (plus 2) 0 >= x.
+  Proof.
+    idtac.
+  Qed.
+
+  Lemma L3 : forall x:nat,
+               Nat.iter
+                 x 
+                 (A:=nat)
+                 (plus 2)
+                 0 >= x.
+  Proof.
+    idtac.
+  Qed.
+
+  Lemma L1 : forall x:nat, Nat.iter x 
+                                    (A:=nat)
+                                    (plus 2)
+                                    0 >= x.
+  Proof.
+    idtac.
+  Qed.
+
+  Lemma L2 : forall x:nat, Nat.iter
+                             x 
+                             (A:=nat)
+                             (plus 2)
+                             0 >= x.
+  Proof.
+    idtac.
+  Qed.
+
+
+
+End Mod.
diff --git a/ci/test-indent/indent-inside-command.v 
b/ci/test-indent/indent-inside-command.v
new file mode 100644
index 0000000000..5ad50e6eec
--- /dev/null
+++ b/ci/test-indent/indent-inside-command.v
@@ -0,0 +1,93 @@
+
+Require Export
+        Coq.Lists.List.
+Require
+  Export
+  Arith.
+
+Module
+  Mod.
+
+  Module
+    Foo.
+    Axiom
+      X
+      :
+      Set.
+    Axiom Y
+      :
+      Set.
+    Axiom Z:
+      Set.
+  End
+    Foo.
+  
+
+  Definition a1 :=
+    1.
+  Definition A2
+    := 1.
+  Definition arith1
+    :=
+    1.
+  Definition
+    arith1
+    :=
+    1.
+
+  Let x := 1.  Let y := 2.
+
+  Notation "[ a ; .. ; b ]" := (a :: .. (b :: []) ..) : list_scope.
+  
+  
+  Inductive test
+    : nat 
+      -> 
+        Prop :=
+    C1 : forall n,
+        test n
+  | C2 : forall n,
+      test
+        n
+  | C3 :
+    forall
+      n, test n
+  | C4 : forall n, test n.
+
+  Lemma L4 : forall x:nat,
+      Nat.iter x (A:=nat)
+               (plus 2) 0 >= x.
+  Proof.
+    idtac.
+  Qed.
+
+  Lemma L3 : forall x:nat,
+      Nat.iter
+        x 
+        (A:=nat)
+        (plus 2)
+        0 >= x.
+  Proof.
+    idtac.
+  Qed.
+
+  Lemma L1 : forall x:nat, Nat.iter x 
+                                    (A:=nat)
+                                    (plus 2)
+                                    0 >= x.
+  Proof.
+    idtac.
+  Qed.
+
+  Lemma L2 : forall x:nat, Nat.iter
+                             x 
+                             (A:=nat)
+                             (plus 2)
+                             0 >= x.
+  Proof.
+    idtac.
+  Qed.
+
+
+
+End Mod.
diff --git a/ci/test-indent/indent-monadic.v b/ci/test-indent/indent-monadic.v
new file mode 100644
index 0000000000..1cc6e8c1a1
--- /dev/null
+++ b/ci/test-indent/indent-monadic.v
@@ -0,0 +1,44 @@
+(* Needs ext-lib library to compile. *)
+
+Require Import Coq.ZArith.ZArith_base Coq.Strings.Ascii Coq.Strings.String.
+Require Import ExtLib.Data.Monads.StateMonad ExtLib.Structures.Monads.
+Import StringSyntax.
+Open Scope string_scope.
+Section StateGame.
+  
+  Check Ascii.Space.
+
+  Import MonadNotation.
+  Local Open Scope Z_scope.
+  Local Open Scope char_scope.
+  Local Open Scope monad_scope.
+
+  Definition GameValue : Type := Z.
+  Definition GameState : Type := (prod bool Z).
+
+  Variable m : Type -> Type.
+  Context {Monad_m: Monad m}.
+  Context {State_m: MonadState GameState m}.
+
+  Print Grammar constr.
+
+  Fixpoint playGame (s: string) m' {struct s}: m GameValue :=
+    match s with
+    | EmptyString =>
+        v <- (if true then m' else get) ;;
+        let '(on, score) := v in ret score
+    | String x xs =>
+        v <- get ;;
+        let '(on, score) := v in
+        match x, on with
+        | "a"%char, true =>  put (on, score + 1)
+        | "b"%char, true => put (on, score - 1)
+        | "c"%char, _ =>   put (negb on, score)
+        |  _, _  =>    put (on, score)
+        end ;;
+        playGame xs m'
+    end.
+
+  Definition startState: GameState := (false, 0).
+
+End StateGame.
diff --git a/ci/test-indent/indent-tac-boxed.v 
b/ci/test-indent/indent-tac-boxed.v
new file mode 100644
index 0000000000..8c37d910ea
--- /dev/null
+++ b/ci/test-indent/indent-tac-boxed.v
@@ -0,0 +1,164 @@
+Module foo.
+  Lemma toto:nat.
+  Proof.
+    {{
+        exact 3.
+    }}
+  Qed.
+
+  Lemma foo: forall n: nat,
+             exists m:nat,
+               m = n + 1.
+  Proof.
+    intros n.
+    destruct n. {
+      exists 1.
+      reflexivity. }
+    exists (S (S n)).
+    simpl.
+    rewrite Nat.add_1_r.
+    reflexivity.
+  Qed.
+
+  Lemma L : forall x:nat,
+              Nat.iter x (A:=nat) (plus 2) 0 >= x.
+  Proof with auto with arith.
+    intros x.
+    
+    induction x;simpl;intros...
+    
+    induction x;
+      simpl ;
+      simpl ;
+      simpl ;
+      intros.
+  Qed.
+  
+  Ltac foo:= intros x;
+             induction x;
+             simpl ;
+             intros.
+  
+
+  Lemma L :
+    forall x:nat ,
+      Nat.iter x (A:=nat) (plus 2) 0 >= x.
+  Proof with auto with arith.
+    intros x;
+      induction x;
+      simpl ;
+      intros.
+    idtacjqslkjd;[
+        intros x ;
+        induction x ;
+        simpl ;
+        intros].
+  Qed.
+
+
+
+  Lemma L' : forall x:nat ,
+               Nat.iter x (A:=nat) (plus 2) 0 >= x
+  with L'' : forall x:nat ,
+               Nat.iter x (A:=nat) (plus 2) 0 >= x.
+  Proof with auto with arith.
+    - induction x;simpl;intros...
+    - induction x;simpl;intros...
+  Qed.
+
+End foo.
+
+Section SET.
+  Definition set (T : Type) := Ensemble T.
+  
+  Require Import Program.
+  
+  
+  Definition eq_n : forall A n (v:Vector.t A n) n',
+                      n=n' ->
+                      Vector.t A n'.
+  Proof.
+    intros A n v n' H.
+    rewrite <- H.
+    assumption.
+  Defined.
+  
+End SET.
+
+Module curlybracesatend.
+
+  
+  Lemma foo2: forall n: nat,
+              exists m:nat,
+                m = n + 1.
+  Proof.
+    intros n.
+    destruct n. {
+      exists 1.
+      reflexivity. }
+    
+    exists (S (S n)).
+    simpl.
+    rewrite Nat.add_1_r.
+    reflexivity.
+  Qed.
+  
+  Lemma foo3: forall n: nat,
+              forall n: nat,
+              forall n: nat,
+              forall n: nat, forall n: nat,
+              exists m:nat,
+                m = n + 1 ->
+                m = n + 1 ->
+                m = n + 1
+                -> m = n + 1
+                -> m = n + 1 ->
+                m = n + 1.
+  Proof.
+    intros n. cut (n = n). {
+      destruct n. {
+        exists 1.
+        reflexivity. } {
+        exists (S (S n)).
+        simpl.
+        rewrite Nat.add_1_r.
+        reflexivity. }
+    }
+    idtac.
+    reflexivity.
+  Qed.
+
+  Lemma foooooooooooooooo3: forall n: nat,
+                            forall n: nat, forall n: nat,
+                              f x ->
+                              g y ->
+                              f x -> forall n: nat,
+                                     forall n: nat,
+                                     forall n: nat,
+                                     exists m:nat,
+                                       m = n + 1 ->
+                                       m = n + 1 ->
+                                       m = n + 1
+                                       -> m = n + 1
+                                       -> m = n + 1 ->
+                                       m = n + 1 -> 
+                                       True.
+  Proof.
+    intros n. cut (n = n).
+    {
+      destruct n. {
+        exists 1.
+        reflexivity. } {
+        exists (S (S n)).
+        simpl.
+        rewrite Nat.add_1_r.
+        reflexivity.
+      }
+    }
+    idtac.
+    reflexivity.
+  Qed.
+
+  
+End curlybracesatend.
+
diff --git a/coq/ex/indent.v b/ci/test-indent/indent-tac.v
similarity index 57%
copy from coq/ex/indent.v
copy to ci/test-indent/indent-tac.v
index 72a3c20136..19aede3707 100644
--- a/coq/ex/indent.v
+++ b/ci/test-indent/indent-tac.v
@@ -1,123 +1,206 @@
-(* First check that ".." is not considered as a command end. *)
-Require Export Coq.Lists.List.
-Notation "[ ]" := nil : list_scope.
-Notation "[ a ; .. ; b ]" := (a :: .. (b :: []) ..) : list_scope.
 
-Require Import Arith.
-Open Scope nat_scope.
-Definition arith1:=
-  1 + 3 *
-      4.
+Module foo.
+  Lemma toto:nat.
+  Proof.
+    {{
+        exact 3.
+    }}
+  Qed.
 
-Definition arith2 :=
-  1 * 3 +
-  4.
+  Lemma L : forall x:nat , Nat.iter x (A:=nat) (plus 2) 0 >= x.
+  Proof with auto with arith.
+    intros x.
+    
+    induction x;simpl;intros...
 
-Definition logic1 :=
-  True \/ False /\
-          False.
+    induction x;
+      simpl ;
+      simpl ;
+      simpl ;
+      intros.
 
-Definition logic2 :=
-  True /\ False \/
-  False.
+    Ltac foo:=
+      intros x;
+      induction x;
+      simpl ;
+      simpl ;
+      simpl ;
+      intros.
 
-Definition logic3 :=
-  let x := True /\ False in True \/
-                            False .
-Definition logic4 :=
-  (let x := True /\ False in True) \/
-  False .
+    
+    induction x
+    ;
+      simpl
+    ;
+      intros
+    ;
+      intros
+    ;
+      intros
+    .
+    
+    
+    idtac
+    ;
+      [
+        induction x
+        ;
+          simpl
+        ;
+          intros
+      ].
 
+    
+    Ltac foo
+      :=
+      intros x
+      ;
+        induction x
+      ;
+        simpl
+      ;
+        intros
+      ;
+        intros
+    .
+    
 
-Record a : Type := make_a {
-                       aa : nat
-                     }.
+    idtac
+    ;
+      [
+        induction x
+        ;
+          simpl ;
+        simpl
+      | intros
+      ].
+    
+    Ltac foo :=
+      intros x
+      ;
+        induction x
+      ;
+        simpl
+      ;
+        intros
+      ;
+        intros
+    .
+    
 
-Module foo.
-  Inductive test : nat -> Prop :=
-    C1 : forall n, test n
-  | C2 : forall n, test n
-  | C3 : forall n, test n
-  | C4 : forall n, test n.
-
-  Inductive testbar' : nat -> Prop :=
-  | Cbar1 : forall n, test n
-  | Cbar2 : forall n, test n
-  | Cbar3 : forall n, test n
-  | Cbar4 : forall n, test n.
-  
-  Inductive test2 : nat -> Prop
-    := | C21 : forall n, test2 n
-    | C22 : forall n, test2 n
-    | C23 : forall n, test2 n
-    | C24 : forall n, test2 n.
-  
-  Inductive test' : nat -> Prop :=
-    C1' : forall n, test' n
-  | C2' : forall n, test' n
-  | C3' : forall n, test' n
-  | C4' : forall n, test' n
-  with
-    test2' : nat -> Prop :=
-    C21' : forall n, test2' n
-  | C22' : forall n, test2' n
-  | C23' : forall n, test2' n
-  | C24' : forall n, test2' n
-  with test3' : nat -> Prop :=
-    C21' : forall n, test2' n
-  | C22' : forall n, test2' n
-  | C23' : forall n, test2' n
-  | C24' : forall n, test2' n
-  with test4' : nat -> Prop :=
-  | C21' : forall n, test2' n
-  | C22' : forall n, test2' n
-  | C23' : forall n, test2' n
-  | C24' : forall n, test2' n.
-  
-  Let x := 1.  Let y := 2.
-  
-  Let y2 := (1, 2, 3,
-             4, 5).
-  
-  Inductive test3             (* fixindent *)
-    : nat -> Prop
-    := C31 : forall n, test3 n
-     | C32 : forall n, test3 n.
+
+
+    induction x ;
+      simpl ;
+      intros.
+
+    induction x
+    ;
+      simpl ;
+      intros.
+
+    induction x ;
+      simpl
+    ;
+      simpl ;
+      intros.
+    
+    
+    intros x
+    ; induction x
+    ; simpl
+    ; intros.
+    
+    idtac;(intros x
+           ; induction x
+           ; simpl
+           ; intros).
+    
+
+    idtac;( induction x;
+            simpl ;
+            intros ).
+    
+    idtac;[ intros x
+            ; induction x
+            ; simpl
+            ; intros].
+
+    idtac
+    ;
+      [
+        induction x;
+        simpl ;
+        intros
+      | simpl
+        ; intros ].
+
+
+    idtac;[ intros x
+            ; induction x
+          | simpl
+            ; intros].
+    
+
+    idtac;[ intros x ;
+            induction x
+          | simpl ;
+            intros
+      ].
+    
+
+    idtac foobar;[ induction x;
+                   simpl ;
+                   intros ].
+
+  Qed.
+
+  Ltac foo:=
+    intros x;
+    induction x;
+    simpl ;
+    intros.
   
-End foo.
-
-Lemma toto:nat.
-Proof.
-  {{
-      exact 3.
-  }}
-Qed.
-
-Let xxx                        (* Precedence of "else" w.r.t "," and "->"!  *)
-  : if true then nat * nat else nat ->
-                                nat
-  := (if true then 1 else 2,
-      3).
-
-Module Y.
+
+  Lemma L :
+    forall x:nat ,
+      Nat.iter x (A:=nat) (plus 2) 0 >= x.
+  Proof with auto with arith.
+    intros x;
+      induction x;
+      simpl ;
+      intros.
+    idtacjqslkjd;[
+        intros x ;
+        induction x ;
+        simpl ;
+        intros].
+  Qed.
   Lemma L : forall x:nat , Nat.iter x (A:=nat) (plus 2) 0 >= x.
   Proof with auto with arith.
-    intros x.
-    induction x;simpl;intros...
+    intros x;
+      [ induction x;
+        [
+          simpl;
+          intros...
+        ]
+      ].
   Qed.
+
+
   Lemma L2 : forall x:nat , Nat.iter x (A:=nat) (plus 2) 0 >= x.
   Proof with auto with arith.
     idtac.
     (* "as" tactical *)
     induction x
       as
-        [ | x IHx]. 
+      [ | x IHx]. 
     - cbn.
       apply Nat.le_trans
         with
-          (n:=0) (* aligning the different closes of a "with". *)
-          (m:=0)
-          (p:=0).
+        (n:=0) (* aligning the different closes of a "with". *)
+        (m:=0)
+        (p:=0).
       + auto with arith.
       + auto with arith.
     - simpl.
@@ -219,18 +302,23 @@ Module M1'.
       intros.
       Lemma l7: forall n:nat, n = n.
       Proof.
-        destruct n.
+        destruct n. intros.
         {
           auto.
         }
         { 
-          destruct n.
-          {
-            idtac;[
+          destruct n. 
+          idtac a
+          ;
+            [
+              auto;
               auto
+            |
+              auto;
+              auto.
             ].
-          }
-          auto.
+        }
+        auto.
         } 
       Qed.
       {destruct n.
@@ -254,8 +342,8 @@ Module M4'.
         - auto.
         - destruct n.
           + idtac;[
-              auto
-            ].
+                auto
+              ].
           + destruct n.
             * auto.
             * auto.
@@ -283,28 +371,30 @@ End M1''.
 
 
 Record rec:Set := {
-                   fld1:nat;
-                   fld2:nat;
-                   fld3:bool
-                 }.
+    fld1:nat;
+    fld2:nat;
+    fld3:bool
+  }.
 
 Class cla {X:Set}:Set := {
-                          cfld1:nat;
-                          cld2:nat;
-                          cld3:bool
-                        }.
+    cfld1:nat;
+    cld2:nat;
+    cld3:bool
+  }.
 
 
 
 Module X.
-  Lemma l
-  :
+  Lemma l:
     forall r:rec,
     exists r':rec,
       r'.(fld1) = r.(fld2)/\ r'.(fld2) = r.(fld1).
   Proof.
-    intros r.
-    { exists
+    idtac.
+    idtac.
+    idtac.
+    intros r. {
+      exists
         {|
           fld1:=r.(fld2);
           fld2:=r.(fld1);
@@ -314,9 +404,20 @@ Module X.
       {auto. }
       {auto. }
     }
+    auto.
+    auto.
   Qed.
   
-  
+  (* Issue #574 *)
+  Goal let x := 1 in True.
+  Proof.
+    intro.
+    match goal with
+    | y := _ : unit |- _ => idtac "unit"
+    | y := _ : nat |- _ => idtac "nat"
+    end.
+  Qed.
+
   Lemma l2 :
     forall r:rec,
     exists r':rec,
@@ -340,6 +441,11 @@ Module X.
         | _ => fail
         end.
 
+        match goal with
+        | ?g := _:rec |- ?a /\ ?b => split
+        | _ => fail
+        end.
+
         Fail
           lazymatch goal with
             _:rec |- ?a /\ ?b => split
@@ -354,6 +460,27 @@ Module X.
 
         { simpl. auto. }
         { simpl. auto. }}}
+
+    - split.
+      match
+        goal
+      with
+        X => foo
+      end.
+    - split.
+      match goal with
+        X |- _ => foo
+      | H: X := Y |- _ => foo
+      end.
+    - split.
+      match H with
+        ?a = ?b |- _ => foo
+      | ?a < ?b |- _ => foo
+      end.
+    - split.
+      let x := f y in
+      let foo := idtac x in
+      idtac foo.
   Qed.
 End X.
 
@@ -414,25 +541,25 @@ Section SET.
     (Vector.t T n) ->  Prop :=
     match v1 with
       Vector.nil _ =>
-      fun v2 =>
-        match v2 with 
-          Vector.nil _ => True
-        | _ => False
-        end
+        fun v2 =>
+          match v2 with 
+            Vector.nil _ => True
+          | _ => False
+          end
     | (Vector.cons _ x n' v1') =>
-      fun v2 =>
-        (* indentation of dependen "match" clause. *)
-        match v2
-              as
-              X
-              in
-              Vector.t _ n''
-              return
-              (Vector.t T (pred n'') -> Prop) -> Prop
-        with 
-        | Vector.nil _ => fun _ => False 
-        | (Vector.cons _ y n'' v2') => fun v2'' => (x y) /\ (v2'' v2')
-        end (setVecProd T n' v1')
+        fun v2 =>
+          (* indentation of dependen "match" clause. *)
+          match v2
+                as
+                X
+                in
+                Vector.t _ n''
+                return
+                (Vector.t T (pred n'') -> Prop) -> Prop
+          with 
+          | Vector.nil _ => fun _ => False 
+          | (Vector.cons _ y n'' v2') => fun v2'' => (x y) /\ (v2'' v2')
+          end (setVecProd T n' v1')
     end.
   
 End SET.
@@ -454,8 +581,8 @@ Module curlybracesatend.
   Qed.
   
   Lemma foo2: forall n: nat,
-      exists m:nat,  (* This is strange compared to the same line in the 
previous lemma *)
-        m = n + 1.
+    exists m:nat,
+      m = n + 1.
   Proof.
     intros n.
     destruct n. {
@@ -468,9 +595,19 @@ Module curlybracesatend.
     reflexivity.
   Qed.
   
-  Lemma foo3: forall n: nat,
-      exists m:nat,  (* This is strange compared to the same line in the 
previous lemma *)
-        m = n + 1.
+  Lemma foo3:
+    forall n: nat,
+    forall n: nat,
+    forall n: nat,
+    forall n: nat,
+    forall n: nat,
+    exists m:nat,
+      m = n + 1 ->
+      m = n + 1 ->
+      m = n + 1
+      -> m = n + 1
+      -> m = n + 1 ->
+      m = n + 1.
   Proof.
     intros n. cut (n = n). {
       destruct n. {
@@ -485,6 +622,37 @@ Module curlybracesatend.
     reflexivity.
   Qed.
 
+  Lemma foooooooooooooooo3: forall n: nat,
+    forall n: nat, forall n: nat,
+      f x ->
+      g y ->
+      f x -> forall n: nat,
+        forall n: nat,
+        forall n: nat,
+        exists m:nat,
+          m = n + 1 ->
+          m = n + 1 ->
+          m = n + 1
+          -> m = n + 1
+          -> m = n + 1 ->
+          m = n + 1 -> 
+          True.
+  Proof.
+    intros n. cut (n = n).
+    {
+      destruct n. {
+        exists 1.
+        reflexivity. } {
+        exists (S (S n)).
+        simpl.
+        rewrite Nat.add_1_r.
+        reflexivity.
+      }
+    }
+    idtac.
+    reflexivity.
+  Qed.
+
   
 End curlybracesatend.
 
diff --git a/ci/test-indent/tests.sh b/ci/test-indent/tests.sh
new file mode 100755
index 0000000000..ef2c23e140
--- /dev/null
+++ b/ci/test-indent/tests.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+
+
+
+for i in $(find . -name "*.v" -exec basename '{}' \; | grep -v "indented_") ; 
do
+    echo -n "Testing $i..."
+    ./coq-test-indent.sh $i 2>&1 | tee .$i.log | grep "\*\*\*"
+done
diff --git a/ci/test_stepwise.v b/ci/test_stepwise.v
index 3812adbddb..af451ff79b 100644
--- a/ci/test_stepwise.v
+++ b/ci/test_stepwise.v
@@ -11,6 +11,22 @@ Proof using .
   exact proof_of_A.
 Qed. (*test-lemma*)
 
+Section failSection.
+  Local Unset Ltac Backtrace.
+  Goal False.
+  Proof. (*FailNoTrace*)
+    Fail (now auto).
+    auto.
+  Abort.
+
+  Local Set Ltac Backtrace.
+  Goal False. (*FailTrace*) 
+    Fail (now auto).
+    auto.
+  Abort.
+End failSection.
+
+
 Lemma false_proof : forall A B : bool, A = B. 
 Proof.
   intros A B.
diff --git a/coq/coq-abbrev.el b/coq/coq-abbrev.el
index 74ddb0769d..14658c51eb 100644
--- a/coq/coq-abbrev.el
+++ b/coq/coq-abbrev.el
@@ -12,7 +12,7 @@
 ;; Authors: Healfdene Goguen, Pierre Courtieu
 ;; Maintainer: Pierre Courtieu <Pierre.Courtieu@cnam.fr>
 
-;; License:     GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
@@ -154,13 +154,20 @@
        :active (and coq-compile-before-require
                    coq-compile-parallel-in-background)
        :help "Derive behavior from Quick compilation setting above"]
-      ["use -vos"
+      ["use -vos and -vok"
+       (customize-set-variable 'coq-compile-vos 'vos-and-vok)
+       :style radio
+       :selected (eq coq-compile-vos 'vos-and-vok)
+       :active (and coq-compile-before-require
+                   coq-compile-parallel-in-background)
+       :help "Speedup with -vos, check proofs later, possibly inconsistent"]
+      ["use -vos, no -vok"
        (customize-set-variable 'coq-compile-vos 'vos)
        :style radio
        :selected (eq coq-compile-vos 'vos)
        :active (and coq-compile-before-require
                    coq-compile-parallel-in-background)
-       :help "Speedup with -vos, possibly inconsistent"]
+       :help "Speedup with -vos, don't check proofs, possibly inconsistent"]
       ["ensure vo"
        (customize-set-variable 'coq-compile-vos 'ensure-vo)
        :style radio
@@ -313,6 +320,7 @@
      ["Search..." coq-Search t]
      ["SearchRewrite..." coq-SearchRewrite t]
      ["SearchPattern..." coq-SearchIsos t]
+     ["Search Blacklist..." coq-change-search-blacklist-interactive t]
      ["Locate constant..." coq-LocateConstant t]
      ["Locate Library..." coq-LocateLibrary t]
      ["Pwd" coq-Pwd t]
diff --git a/coq/coq-compile-common.el b/coq/coq-compile-common.el
index 3e3b7023dc..1055c7443e 100644
--- a/coq/coq-compile-common.el
+++ b/coq/coq-compile-common.el
@@ -1,18 +1,18 @@
-;;; coq-compile-common.el --- common part of compilation feature
+;;; coq-compile-common.el --- common part of compilation feature  -*- 
lexical-binding: t; -*-
 
 ;; This file is part of Proof General.
 
 ;; Portions © Copyright 1994-2012  David Aspinall and University of Edinburgh
-;; Portions © Copyright 2003-2018  Free Software Foundation, Inc.
+;; Portions © Copyright 2003-2021  Free Software Foundation, Inc.
 ;; Portions © Copyright 2001-2017  Pierre Courtieu
 ;; Portions © Copyright 2010, 2016  Erik Martin-Dorel
-;; Portions © Copyright 2011-2013, 2016-2017  Hendrik Tews
+;; Portions © Copyright 2011-2013, 2016-2017, 2019-2021  Hendrik Tews
 ;; Portions © Copyright 2015-2017  Clément Pit-Claudel
 
 ;; Authors: Hendrik Tews
 ;; Maintainer: Hendrik Tews <hendrik@askra.de>
 
-;; License:     GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
@@ -47,33 +47,33 @@
   "Enable parallel compilation.
 Must be used together with `coq-seq-disable'."
   (add-hook 'proof-shell-extend-queue-hook
-           'coq-par-preprocess-require-commands)
+           #'coq-par-preprocess-require-commands)
   (add-hook 'proof-shell-signal-interrupt-hook
-           'coq-par-user-interrupt)
+           #'coq-par-user-interrupt)
   (add-hook 'proof-shell-handle-error-or-interrupt-hook
-           'coq-par-user-interrupt))
+           #'coq-par-user-interrupt))
 
 (defun coq-par-disable ()
   "Disable parallel compilation.
 Must be used together with `coq-seq-enable'."
   (remove-hook 'proof-shell-extend-queue-hook
-              'coq-par-preprocess-require-commands)
+              #'coq-par-preprocess-require-commands)
   (remove-hook 'proof-shell-signal-interrupt-hook
-              'coq-par-user-interrupt)
+              #'coq-par-user-interrupt)
   (remove-hook 'proof-shell-handle-error-or-interrupt-hook
-              'coq-par-user-interrupt))
+              #'coq-par-user-interrupt))
 
 (defun coq-seq-enable ()
   "Enable sequential synchronous compilation.
 Must be used together with `coq-par-disable'."
   (add-hook 'proof-shell-extend-queue-hook
-           'coq-seq-preprocess-require-commands))
+           #'coq-seq-preprocess-require-commands))
 
 (defun coq-seq-disable ()
   "Disable sequential synchronous compilation.
 Must be used together with `coq-par-enable'."
   (remove-hook 'proof-shell-extend-queue-hook
-              'coq-seq-preprocess-require-commands))
+              #'coq-seq-preprocess-require-commands))
 
 
 
@@ -100,40 +100,40 @@ Must be used together with `coq-par-enable'."
        ncpus
       nil)))
 
-(defvar coq--max-background-vio2vo-percentage-shadow 40
-  "Internal shadow value of `coq-max-background-vio2vo-percentage'.
+(defvar coq--max-background-second-stage-percentage-shadow 40
+  "Internal shadow value of `coq-max-background-second-stage-percentage'.
 This variable does always contain the same value as
-`coq-max-background-vio2vo-percentage'.  It is used only to break
-the dependency cycle between `coq-set-max-vio2vo-jobs' and
-`coq-max-background-vio2vo-percentage'.")
+`coq-max-background-second-stage-percentage'.  It is used only to break
+the dependency cycle between `coq-set-max-second-stage-jobs' and
+`coq-max-background-second-stage-percentage'.")
 
-(defvar coq--internal-max-vio2vo-jobs 1
-  "Internal number of vio2vo jobs.
+(defvar coq--internal-max-second-stage-jobs 1
+  "Internal number of second-stage background jobs (vok or vio2vo).
 This is the internal value, use
-`coq-max-background-vio2vo-percentage' to configure.")
+`coq-max-background-second-stage-percentage' to configure.")
 
 (defvar coq--internal-max-jobs 1
   "Value of `coq-max-background-compilation-jobs' translated to a number.")
 
-(defun coq-set-max-vio2vo-jobs ()
-  "Set `coq--internal-max-vio2vo-jobs'."
-  (setq coq--internal-max-vio2vo-jobs
+(defun coq-set-max-second-stage-jobs ()
+  "Set `coq--internal-max-second-stage-jobs'."
+  (setq coq--internal-max-second-stage-jobs
        (max 1
             (round (* coq--internal-max-jobs
-                      coq--max-background-vio2vo-percentage-shadow
+                      coq--max-background-second-stage-percentage-shadow
                       0.01)))))
 
-(defun coq-max-vio2vo-setter (symbol new-value)
-  ":set function for `coq-max-background-vio2vo-percentage'.
-SYMBOL should be 'coq-max-background-vio2vo-percentage"
-  (set symbol new-value)
-  (setq coq--max-background-vio2vo-percentage-shadow new-value)
-  (coq-set-max-vio2vo-jobs))
+(defun coq-max-second-stage-setter (symbol new-value)
+  ":set function for `coq-max-background-second-stage-percentage'.
+SYMBOL should be 'coq-max-background-second-stage-percentage"
+  (set-default symbol new-value)
+  (setq coq--max-background-second-stage-percentage-shadow new-value)
+  (coq-set-max-second-stage-jobs))
 
 (defun coq-max-jobs-setter (symbol new-value)
   ":set function for `coq-max-background-compilation-jobs'.
 SYMBOL should be 'coq-max-background-compilation-jobs"
-  (set symbol new-value)
+  (set-default symbol new-value)
   (cond
    ((eq new-value 'all-cpus)
     (setq new-value (number-of-cpus))
@@ -142,7 +142,7 @@ SYMBOL should be 'coq-max-background-compilation-jobs"
    ((and (integerp new-value) (> new-value 0)) t)
    (t (setq new-value 1)))
   (setq coq--internal-max-jobs new-value)
-  (coq-set-max-vio2vo-jobs))
+  (coq-set-max-second-stage-jobs))
 
 (defun coq-compile-quick-setter (symbol new-value)
   ":set function for `coq-compile-quick' for pre 8.5 compatibility.
@@ -154,7 +154,7 @@ Ignore any quick setting for Coq versions before 8.5."
     (message "Ignore coq-compile-quick setting %s for Coq before 8.5"
             new-value)
     (setq new-value 'no-quick)))
-  (set symbol new-value))
+  (set-default symbol new-value))
 
 
 ;;; user options and variables
@@ -173,8 +173,7 @@ are compiled from the sources before the \"Require\" 
command is processed.
 This option can be set/reset via menu
 `Coq -> Auto Compilation -> Compile Before Require'."
   :type 'boolean
-  :safe 'booleanp
-  :group 'coq-auto-compile)
+  :safe 'booleanp)
 
 (proof-deftoggle coq-compile-before-require)
 
@@ -192,8 +191,7 @@ is set with `coq-max-background-compilation-jobs'.
 This option can be set/reset via menu
 `Coq -> Auto Compilation -> Compile Parallel In Background'."
   :type 'boolean
-  :safe 'booleanp
-  :group 'coq-auto-compile)
+  :safe 'booleanp)
 
 (proof-deftoggle coq-compile-parallel-in-background)
 
@@ -272,10 +270,9 @@ This option can be set via menu
     (const :tag "use -quick, don't do vio2vo" quick-no-vio2vo)
     (const :tag "use -quick and do vio2vo" quick-and-vio2vo)
     (const :tag "ensure vo compilation, delete vio files" ensure-vo))
-  :safe (lambda (v) (member v '(no-quick quick-no-vio2vo
-                                        quick-and-vio2vo ensure-vo)))
-  :set 'coq-compile-quick-setter
-  :group 'coq-auto-compile)
+  :safe (lambda (v)
+         (member v '(no-quick quick-no-vio2vo quick-and-vio2vo ensure-vo)))
+  :set #'coq-compile-quick-setter)
 
 (defun coq-compile-prefer-quick ()
   "Return t if a .vio file would be prefered."
@@ -284,16 +281,26 @@ This option can be set via menu
    (eq coq-compile-quick 'quick-and-vio2vo)))
 
 (defcustom coq-compile-vos nil
-  "Control fast compilation, skipping opaque proofs with ``-vos''.
+  "Control fast compilation, skipping opaque proofs with ``-vos'' and ``-vok''.
 When using coq >= 8.11, this option controls whether parallel
 background compilation is done with ``-vos'', skipping opaque
 proofs, thus being considerably faster and inconsistent.
 
 Set this option to `vos' if you want fast background compilation
-and don't care if all proofs are correct. Set this option to
-`ensure-vo' if you want all proof and universe constraints
+without a second stage ``-vok'' run to check all proofs.  Set this
+option to `vos-and-vok' if you want fast background compilation
+but also want to check all proofs in a second stage with
+``-vok''.  Option `vos-and-vok' does not guarantee consistency,
+because not all universe constraints are checked.  Set this option
+to `ensure-vo' if you want all proofs and universe constraints
 checked carefully.
 
+The second stage ``-vok'' run starts in the background after
+`coq-compile-second-stage-delay' seconds on
+`coq-max-background-second-stage-percentage' per cent of the
+cores used for the first run (configured in
+`coq-max-background-compilation-jobs').
+
 For upgrading, if this option is `nil' (i.e., not configured),
 then the value of `coq-compile-quick' is considered and vos
 compilation is used when `coq-compile-quick' equals
@@ -303,10 +310,10 @@ For coq < 8.11 this option is ignored."
   :type
   '(radio
     (const :tag "unset, derive behavior from `coq-compile-quick'" nil)
-    (const :tag "use -vos" vos)
+    (const :tag "use -vos, don't do -vok" vos)
+    (const :tag "use -vos and do -vok" vos-and-vok)
     (const :tag "ensure vo compilation" ensure-vo))
-  :safe (lambda (v) (member v '(nil vos ensure-vo)))
-  :group 'coq-auto-compile)
+  :safe (lambda (v) (member v '(nil vos vos-and-vok ensure-vo))))
 
 (defun coq-compile-prefer-vos ()
   "Decide whether ``-vos'' should be used.
@@ -315,6 +322,7 @@ by checking the value of `coq-compile-quick' if 
`coq-compile-vos'
 is nil."
   (or
    (eq coq-compile-vos 'vos)
+   (eq coq-compile-vos 'vos-and-vok)
    (and (not coq-compile-vos)
         (eq coq-compile-quick 'quick-no-vio2vo))))
 
@@ -342,26 +350,59 @@ is not adapted."
   :type '(choice (const :tag "use all CPU cores" all-cpus)
                 (integer :tag "fixed number" :value 1))
   :safe (lambda (v) (or (eq v 'all-cpus) (and (integerp v) (> v 0))))
-  :set 'coq-max-jobs-setter
-  :group 'coq-auto-compile)
-
-(defcustom coq-max-background-vio2vo-percentage 40
-  "Percentage of `coq-max-background-vio2vo-percentage' for vio2vo jobs.
-This setting configures the maximal number of vio2vo background
-jobs (if you set `coq-compile-quick' to 'quick-and-vio2vo) as
-percentage of `coq-max-background-compilation-jobs'."
+  :set #'coq-max-jobs-setter)
+
+(defcustom coq-max-background-second-stage-percentage
+  (or (and (boundp 'coq-max-background-vio2vo-percentage)
+           coq-max-background-vio2vo-percentage)
+      (and (get 'coq-max-background-vio2vo-percentage 'saved-value)
+           (eval (car (get 'coq-max-background-vio2vo-percentage 
'saved-value))))
+      40)
+  ;; XXX change in ProofGeneral.texi
+  "Percentage of `coq-max-background-compilation-jobs' for the second stage.
+This setting configures the maximal number of ``-vok'' or vio2vo background
+jobs running in a second stage as
+percentage of `coq-max-background-compilation-jobs'.
+
+For backward compatibility, if this option is not customized, it
+is initialized from the now deprecated option
+`coq-max-background-vio2vo-percentage'."
   :type 'number
   :safe 'numberp
-  :set 'coq-max-vio2vo-setter
-  :group 'coq-auto-compile)
+  :set #'coq-max-second-stage-setter)
 
-(defcustom coq-compile-vio2vo-delay 2.5
-  "Delay in seconds for the vio2vo compilation.
-This delay helps to avoid running into a library inconsistency
-with 'quick-and-vio2vo, see Coq issue #5223."
+(defcustom coq-max-background-vio2vo-percentage nil
+  "Deprecated. Please configure `coq-max-background-second-stage-percentage'.
+This is the old configuration option for Coq < 8.11, used before
+the ``-vok'' second stage was implemented."
   :type 'number
-  :safe 'numberp
-  :group 'coq-auto-compile)
+  :safe 'numberp)
+
+
+(defcustom coq-compile-second-stage-delay
+  (or (and (boundp 'coq-compile-vio2vo-delay) coq-compile-vio2vo-delay)
+      (and (get 'coq-compile-vio2vo-delay 'saved-value)
+           (eval (car (get 'coq-compile-vio2vo-delay 'saved-value))))
+      2.5)
+  "Delay in seconds before starting the second stage compilation.
+The delay is applied to both ``-vok'' and vio2vo second stages.
+For Coq < 8.11 and vio2vo delay helps to avoid running into a
+library inconsistency with 'quick-and-vio2vo, see Coq issue
+#5223.
+
+For backward compatibility, if this option is not customized, it
+is initialized from the now deprecated option
+`coq-compile-vio2vo-delay'."
+  :type 'number
+  :safe 'numberp)
+
+(defcustom coq-compile-vio2vo-delay nil
+  ;; XXX replace coq-compile-vio2vo-delay in ../doc/ProofGeneral.texi
+  "Deprecated. Please configure `coq-compile-second-stage-delay'.
+This is the old configuration option for Coq < 8.11, used before
+the ``-vok'' second stage was implemented."
+  :type 'number
+  :safe 'numberp)
 
 (defcustom coq-compile-command ""
   "External compilation command.  If empty ProofGeneral compiles itself.
@@ -390,8 +431,7 @@ minibuffer if `coq-confirm-external-compilation' is t."
   :safe (lambda (v)
           (and (stringp v)
                (or (not (boundp 'coq-confirm-external-compilation))
-                   coq-confirm-external-compilation)))
-  :group 'coq-auto-compile)
+                   coq-confirm-external-compilation))))
 
 (defconst coq-compile-substitution-list
   '(("%p" physical-dir)
@@ -404,9 +444,9 @@ Value must be a list of substitutions, where each 
substitution is
 a 2-element list.  The first element of a substitution is the
 regexp to substitute, the second the replacement.  The replacement
 is evaluated before passing it to `replace-regexp-in-string', so
-it might be a string, or one of the symbols 'physical-dir,
-'module-object, 'module-source, 'qualified-id and
-'requiring-file, which are bound to, respectively, the physical
+it might be a string, or one of the symbols `physical-dir',
+`module-object', `module-source', `qualified-id' and
+`requiring-file', which are bound to, respectively, the physical
 directory containing the source file, the Coq object file in
 'physical-dir that will be loaded, the Coq source file in
 'physical-dir whose object will be loaded, the qualified module
@@ -439,8 +479,7 @@ This option can be set via menu
      "save all coq-mode buffers except the current buffer without confirmation"
      save-coq)
     (const :tag "save all buffers without confirmation" save-all))
-  :safe (lambda (v) (member v '(ask-coq ask-all save-coq save-all)))
-  :group 'coq-auto-compile)
+  :safe (lambda (v) (member v '(ask-coq ask-all save-coq save-all))))
 
 (defcustom coq-lock-ancestors t
   "If non-nil, lock ancestor module files.
@@ -452,8 +491,7 @@ This option can be set via menu
 `Coq -> Auto Compilation -> Lock Ancestors'."
 
   :type 'boolean
-  :safe 'booleanp
-  :group 'coq-auto-compile)
+  :safe 'booleanp)
 
 ;; define coq-lock-ancestors-toggle
 (proof-deftoggle coq-lock-ancestors)
@@ -466,8 +504,7 @@ Otherwise start the external compilation without 
confirmation.
 
 This option can be set/reset via menu
 `Coq -> Auto Compilation -> Confirm External Compilation'."
-  :type 'boolean
-  :group 'coq-auto-compile)
+  :type 'boolean)
 
 
 (defcustom coq-compile-ignored-directories nil
@@ -483,8 +520,7 @@ expressions in here are always matched against the .vo file 
name,
 regardless whether ``-quick'' would be used to compile the file
 or not."
   :type '(repeat regexp)
-  :safe (lambda (v) (cl-every #'stringp v))
-  :group 'coq-auto-compile)
+  :safe (lambda (v) (cl-every #'stringp v)))
 
 (defcustom coq-coqdep-error-regexp
   (concat "^\\*\\*\\* Warning: in file .*, library .* is required "
@@ -500,8 +536,7 @@ library at multiple places in the load path.  If you want 
to turn
 the latter condition into an error, then set this variable to
 \"^\\*\\*\\* Warning\"."
   :type 'string
-  :safe 'stringp
-  :group 'coq-auto-compile)
+  :safe 'stringp)
 
 
 (defconst coq-require-id-regexp
@@ -604,6 +639,11 @@ Changes the suffix from .vo to .vio.  VO-OBJ-FILE must 
have a .vo suffix."
 Changes the suffix from .vo to .vos.  VO-OBJ-FILE must have a .vo suffix."
   (concat vo-obj-file "s"))
 
+(defun coq-library-vok-of-vo-file (vo-obj-file)
+  "Return .vok file name for VO-OBJ-FILE.
+Changes the suffix from .vo to .vok.  VO-OBJ-FILE must have a .vo suffix."
+  (concat vo-obj-file "k"))
+
 
 ;;; ancestor unlocking
 ;;; (locking is different for sequential and parallel compilation)
@@ -620,7 +660,7 @@ Changes the suffix from .vo to .vos.  VO-OBJ-FILE must have 
a .vo suffix."
 
 (defun coq-unlock-all-ancestors-of-span (span)
   "Unlock all ancestors that have been locked when SPAN was asserted."
-  (mapc 'coq-unlock-ancestor (span-property span 'coq-locked-ancestors))
+  (mapc #'coq-unlock-ancestor (span-property span 'coq-locked-ancestors))
   (span-set-property span 'coq-locked-ancestors ()))
 
 
@@ -677,7 +717,9 @@ the command whose output will appear in the buffer."
   (with-current-buffer coq--compile-response-buffer
     ;; fontification enables the error messages
     (let ((font-lock-verbose nil)) ; shut up font-lock messages
-      (font-lock-fontify-buffer)))
+      (if (fboundp 'font-lock-ensure)
+          (font-lock-ensure)
+        (with-no-warnings (font-lock-fontify-buffer)))))
   ;; Make it so the next C-x ` will use this buffer.
   (setq next-error-last-buffer (get-buffer coq--compile-response-buffer))
   (proof-display-and-keep-buffer coq--compile-response-buffer 1 t)
diff --git a/coq/coq-db.el b/coq/coq-db.el
index 758177c9d1..6e79e95f3b 100644
--- a/coq/coq-db.el
+++ b/coq/coq-db.el
@@ -11,7 +11,7 @@
 
 ;; Author: Pierre Courtieu <courtieu@lri.fr>
 
-;; License:     GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
@@ -325,26 +325,31 @@ See `coq-syntax-db' for DB structure."
   "Face used for `ltac:', `constr:', and `uconstr:' headers."
   :group 'proof-faces)
 
-;; This messes columns, can't figure out why putting this face makes the 
overlay
-;; larger than a character
+;; This is so quite ugly, better have our own face.
 ;; (defface coq-button-face
-;;   '((t :inherit custom-button :background "dark gray"))
-;;   ""
-;;   :group 'proof-faces)
-
-;; (defface coq-button-face-pressed
-;;   '((t :inherit custom-button-pressed :background "light gray"))
+;;   '((t :inherit custom-button :background "dark gray"
+;;        ;; -1 avoids messing with line and column sizes
+;;        :box (:line-width (-1 . -1) :style key-pressed)))
 ;;   ""
 ;;   :group 'proof-faces)
 
 (defface coq-button-face
-  '((t . (:background "light gray")))
-  ""
+  '(
+    (((class color) (background light)) . (:background "light gray"))
+    (((class color) (background dark)) . (:background "gray" :foreground 
"black")))
+  "Coq face for the (un)folding hypothesis button"
   :group 'proof-faces)
 
 (defface coq-button-face-pressed
-  '((t . (:background "dark gray")))
-  ""
+  '((((class color) (background light)) . (:background "gray"))
+    (((class color) (background dark)) . (:background "dim gray" :foreground 
"black")))
+  "Coq face for the (un)folding hypothesis button"
+  :group 'proof-faces)
+
+(defface coq-button-face-active
+  '((((class color) (background light)) . (:background "black" :foreground 
"white"))
+    (((class color) (background dark)) . (:background "grey24" :foreground 
"black")))
+  "Coq face for the (un)folding hypothesis button"
   :group 'proof-faces)
 
 (defconst coq-solve-tactics-face 'coq-solve-tactics-face
diff --git a/coq/coq-diffs.el b/coq/coq-diffs.el
index ff71634aa5..198a09f544 100644
--- a/coq/coq-diffs.el
+++ b/coq/coq-diffs.el
@@ -1,4 +1,4 @@
-;;; coq-diffs.el --- highlight text marked with XML-like tags for Coq diffs
+;;; coq-diffs.el --- highlight text marked with XML-like tags for Coq diffs  
-*- lexical-binding: t; -*-
 
 ;; This file is part of Proof General.
 
@@ -6,7 +6,7 @@
 
 ;; Author:      Jim Fehrle <jim.fehrle@gmail.com>
 
-;; License:  BSD-3 (3-Clause BSD License)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;; 
diff --git a/coq/coq-indent.el b/coq/coq-indent.el
index 6c1cdcae58..e4f72c0367 100644
--- a/coq/coq-indent.el
+++ b/coq/coq-indent.el
@@ -3,7 +3,7 @@
 ;; This file is part of Proof General.
 
 ;; Portions © Copyright 1994-2012  David Aspinall and University of Edinburgh
-;; Portions © Copyright 2003-2018  Free Software Foundation, Inc.
+;; Portions © Copyright 2003-2021  Free Software Foundation, Inc.
 ;; Portions © Copyright 2001-2017  Pierre Courtieu
 ;; Portions © Copyright 2010, 2016  Erik Martin-Dorel
 ;; Portions © Copyright 2011-2013, 2016-2017  Hendrik Tews
@@ -78,7 +78,7 @@ No context checking.")
 (defconst coq-bullet-prefix-regexp-backward
   (concat "\\(?:\\(?:" coq-simple-cmd-ender-prefix-regexp-backward 
"\\)\\(?:\\.\\s-+\\)"
           "\\(?:\\(?:" coq-goal-selector-regexp "\\)?"
-          "{\\|}\\|-\\|+\\|\\*\\)*\\)"))
+          "{\\|}\\|-\\|+\\|\\*\\)+\\s-*\\)"))
 
 ;; matches regular command end (. and ... followed by a space or "}" or buffer 
end)
 ;; ". " and "... " are command endings, ".. " is not, same as in
@@ -124,7 +124,7 @@ There are 2 substrings:
      "\\(?2:"
        "\\(?:" coq-bullet-prefix-regexp-forward"\\)\\)"
       "\\(?1:\\(?:" coq-goal-selector-regexp "\\)?{\\)"
-      "\\(?3:[^|]\\)"
+      "\\(?3:\\s-*[^|{]\\)"
      "\\|"
      ;; [^|]}
      "\\(?2:[^|.]\\|\\=\\)\\(?1:}\\)\\)")
@@ -175,7 +175,7 @@ precise regexp (but only when searching backward).")
 
 ; Order here is significant, when two pattern match with the same
 ; starting position, the first regexp is preferred. period-command is
-; the shorter one so let us have it at the end, but what about cury vs
+; the shorter one so let us have it at the end, but what about curly vs
 ; bullets?
 (defconst coq-end-command-regexp-backward
   (concat coq-bullet-end-command-backward "\\|"
@@ -188,8 +188,40 @@ There are 3 substrings (2 and 3 may be nil):
 * number 2 is the left context matched that is not part of the ending string
 * number 3 is the right context matched that is not part of the ending string
 
-Remqrk: This regexp is much more precise than `coq-end-command-regexp-forward' 
but only
-works when searching backward.")
+Remark: This regexp is much more precise than `coq-end-command-regexp-forward'
+but only works when searching backward.")
+
+(defconst coq-cmd-end-backward-matcher (concat "\\(?2:" 
coq-simple-cmd-ender-prefix-regexp-backward "\\)\\.\\s-"))
+
+(defun coq-looking-at-comment ()
+  "Return non-nil if point is inside a comment."
+  (or (proof-inside-comment (point))
+      (proof-inside-comment (+ 1 (point)))))
+
+(defun coq-find-previous-endcmd ()
+  "Internal use, look backward for a \".\" that is an end of command.
+
+Go backward and put point exactly after the first \".\" that is
+an end of command, or at point-min if none found. Return the new
+position."
+  (re-search-backward (concat "\\(?2:" 
coq-simple-cmd-ender-prefix-regexp-backward "\\)\\.\\s-") (point-min) 'dummy)
+  (while (coq-looking-at-comment) ;; we are looking for ". " so this is enough
+    (re-search-backward (concat "\\(?2:" 
coq-simple-cmd-ender-prefix-regexp-backward "\\)\\.\\s-") (point-min) 'dummy))
+  ;; unless we reached point-min, jump over the "."
+  (when (match-end 2) (goto-char (match-end 2)) (forward-char 1))
+  (point))
+
+(defun coq-find-start-of-cmd ()
+  (let ((p (point)) (something-found))
+    (coq-find-previous-endcmd)
+    (while (not something-found)
+      (forward-comment (point-max))
+      (if (and (looking-at "\\({\\|}\\|\\++\\|\\*+\\|-+\\)")
+               (< (point) p) ;; if we are after the starting point then 
anything is the start of the current command, even "#" or ".".
+               )
+          (forward-char 1)
+        (setq something-found t))))
+  (point))
 
 
 (defun coq-search-comment-delimiter-forward ()
@@ -417,6 +449,7 @@ regexp."
 
 ;; This is not used by generic pg, just by a few functions in here.
 ;; It is less trustable that itsforward version above.
+;; FIXME: rely on coq-find-previous-endcmd
 (defun coq-script-parse-cmdend-backward (&optional limit)
   "Move to the first end of command (not commented) found looking up.
 Point is put exactly before the last ending token (before the last
@@ -430,7 +463,7 @@ and return nil."
     (if (> (coq-is-on-ending-context) 0)
         (ignore-errors(forward-char (coq-is-on-ending-context))))
     (let (foundbeg)
-      ;; Find end of command
+      ;; Find end of previous command
       (while (and (setq foundbeg
                         (and
                          (re-search-backward coq-end-command-regexp-backward 
limit 'dummy)
@@ -477,9 +510,7 @@ the (point-min) if there is no previous command."
 (defun coq-find-real-start ()
   "Move to the start of command at point.
 The point is put exactly before first non comment letter of the command."
-  (coq-find-current-start)
-  (forward-comment (point-max))
-  (point))
+  (coq-find-start-of-cmd))
 
 ;; (defun same-line (pt pt2)
 ;;  (or (= (line-number-at-pos pt) (line-number-at-pos pt2))))
diff --git a/coq/coq-mode.el b/coq/coq-mode.el
index 70d3952c31..16140caf13 100644
--- a/coq/coq-mode.el
+++ b/coq/coq-mode.el
@@ -12,7 +12,7 @@
 ;; Authors: Healfdene Goguen, Pierre Courtieu
 ;; Maintainer: Pierre Courtieu <Pierre.Courtieu@cnam.fr>
 
-;; License:     GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
@@ -75,14 +75,15 @@ See also `coq-prog-env' to adjust the environment."
 (defvar prettify-symbols-alist)
 
 (defconst coq-prettify-symbols-alist
-  '(("not"     . ?¬)
-    ;; ("/\\"  . ?∧)
-    ("/\\"     . ?⋀)
-    ;; ("\\/"  . ?∨)
-    ("\\/"     . ?⋁)
-    ;;("forall"        . ?∀)
-    ("forall"  . ?Π)
+  '(;;("not"   . ?¬)
+    ("/\\"     . ?∧)
+    ;; ("/\\"  . ?⋀)
+    ("\\/"     . ?∨)
+    ;; ("\\/"  . ?⋁)
+    ("forall"  . ?∀)
+    ;; ("forall"       . ?Π)
     ("fun"     . ?λ)
+    ("exists"  . ?∃)
     ("->"      . ?→)
     ("<-"      . ?←)
     ("=>"      . ?⇒)
diff --git a/coq/coq-par-compile.el b/coq/coq-par-compile.el
index e8512068cd..ecf7545862 100644
--- a/coq/coq-par-compile.el
+++ b/coq/coq-par-compile.el
@@ -1,18 +1,18 @@
-;;; coq-par-compile.el --- parallel compilation of required modules
+;;; coq-par-compile.el --- parallel compilation of required modules  -*- 
lexical-binding: t; -*-
 
 ;; This file is part of Proof General.
 
 ;; Portions © Copyright 1994-2012  David Aspinall and University of Edinburgh
-;; Portions © Copyright 2003-2018  Free Software Foundation, Inc.
+;; Portions © Copyright 2003-2021  Free Software Foundation, Inc.
 ;; Portions © Copyright 2001-2017  Pierre Courtieu
 ;; Portions © Copyright 2010, 2016  Erik Martin-Dorel
-;; Portions © Copyright 2011-2013, 2016-2017  Hendrik Tews
+;; Portions © Copyright 2011-2013, 2016-2017, 2019-2021 Hendrik Tews
 ;; Portions © Copyright 2015-2017  Clément Pit-Claudel
 
 ;; Authors: Hendrik Tews
 ;; Maintainer: Hendrik Tews <hendrik@askra.de>
 
-;; License:     GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
@@ -51,10 +51,10 @@
 ;;
 ;; In this file, compilation jobs are uninterned lisp symbols that
 ;; store all important information in their property list. New
-;; compilation jobs are created when Require commands are parsed and
+;; compilation jobs are created when Require commands are recognized and
 ;; when the output of coqdep is processed. If there is space, new jobs
 ;; are directly launched. Otherwise, they are put into a queue
-;; (`coq-par-compilation-queue') to be launched when some other
+;; (`coq--par-compilation-queue') to be launched when some other
 ;; process terminates.
 ;;
 ;; Dependencies between files are reflected with suitable links. They
@@ -83,6 +83,8 @@
 ;; 3- error reporting
 ;; 4- using -quick and the handling of .vo/.vio prerequisites for Coq < 8.11
 ;; 5- using -vos for Coq >= 8.11
+;; 6- running vio2vo or -vok to check proofs
+;; 7- default-directory / current directory
 ;;
 ;;
 ;; For 1- where to put the Require command and the items that follow it:
@@ -97,7 +99,7 @@
 ;; back into proof-action-list and lets Proof General process them as
 ;; usual.
 ;;
-;; All 'require commands are linked with so-called 'queue-dependent
+;; All 'require commands are linked with so-called 'queue-dependant
 ;; links, such that later 'require jobs can be delayed until earlier
 ;; ones are ready. The later 'require job is said to be a queue
 ;; dependant of the earlier one.
@@ -107,22 +109,23 @@
 ;;
 ;; Consider "Require a. Require b." where a and b depend on c. Locking
 ;; must be done such that c is only unlocked, when "Require a" is
-;; undone and not when "Require b" is undone alone. During compilation
-;; files are locked just before coqdep is started on them (after they
-;; have been identified as a dependency). At that time the 'lock-state
-;; property of the job is set to 'locked. Ancestors are then
-;; propagated upwards in the dependency tree and stored in the
-;; 'ancestors property of jobs. When a require job is retired all
-;; direct and indirect ancestors with 'lock-state 'locked are stored
-;; in the 'coq-locked-ancestors property of the span belonging to that
-;; require command (in the 'require-span property). The 'lock-state is
-;; then set to 'asserted, such that any other require job will ignore
-;; these jobs. A span delete action will unlock all uncestors in the
+;; undone and not when "Require b" is undone alone. In case
+;; compilation of c fails then c and all its ancestors must be
+;; unlocked. During compilation, files are locked just before coqdep
+;; is started on them (after they have been identified as a
+;; dependency). At that time the 'lock-state property of the job is
+;; set to 'locked. When a require job is retired, all ancestors with
+;; 'lock-state property 'locked are collected by following the
+;; downward links. When the require job was successful, the collected
+;; jobs are stored in the 'coq-locked-ancestors property of the span
+;; belonging to that require command (in the 'require-span property).
+;; Furhter, the 'lock-state is set to 'asserted, such that another
+;; collection from a following require job ignores these jobs. A span
+;; delete action will unlock all uncestors in the
 ;; 'coq-locked-ancestors property.
 ;;
-;; The 'ancestors property holds a hash that is used as a set, to
-;; avoid exponential duplication of ancestors, see Proof General
-;; issue 499.
+;; When the require job was unsuccessful, all collected jobs are
+;; unlocked.
 ;;
 ;;
 ;; For 3- error reporting:
@@ -203,10 +206,45 @@
 ;; file. This simplifies the logic for deciding about recompilation
 ;; quite a bit.
 ;;
-;; For Coq >= 8.11, vio to vo compilation is disabled for obvious
-;; reasons and in this version of Proof General, there is no similar
-;; feature.
 ;;
+;; For 6- running vio2vo or -vok to check proofs
+;;
+;; To check proofs when compilation is done with -quick/-vio or -vok,
+;; a second stage can be configured using 'quick-and-vio2vo and
+;; 'vos-and-vok. If configured, coq-par-job-needs-compilation sets the
+;; 'second-stage property if the job needs a second stage run to check
+;; the proofs. Such jobs are stored in `coq--par-second-stage-queue'
+;; until first stage compilation and library loading has been done and
+;; `coq-compile-second-stage-delay' is over. To ensure the timer
+;; starts after loading libraries, it is started in a callback from an
+;; otherwise empty action list item when the first stage compilation
+;; produced no error. When there was an error, the timer is started
+;; directly when retiring the last require job. Jobs that participate
+;; in the second stage are in state 'ready. They do not change their
+;; state in the second stage.
+;;
+;; The user can relatively easily achieve that there is more than one
+;; action item with a callback to start the delay timer present in
+;; `proof-action-list'. To ensure only the last one starts the timer,
+;; the callback remembers the value of
+;; `coq--par-second-stage-start-id' and only acts if that is still the
+;; current value when the callback is executed.
+;;
+;;
+;; For 7- default-directory / current directory
+;;
+;; `default-directory' determines the current directory for background
+;; processes. In a sentinel or process filter, default-directory is
+;; taken from the current buffer, which is basically random. Starting
+;; with a wrong current directory will cause compilation failures.
+;; Therefore all entry points of this library must set
+;; default-directory. Entry points are coq-par-process-sentinel, the
+;; functions started from timer and those started from an empty entry
+;; in `proof-action-list'. To set default-directory in these cases, I
+;; record default-directory in 'current-dir inside
+;; `coq-par-preprocess-require-commands' and then pass it on to all
+;; jobs created.
+;; 
 ;; 
 ;; Properties of compilation jobs
 ;;
@@ -236,6 +274,10 @@
 ;;                      when this job finishes it propagates the
 ;;                      necessary information to it's parent jobs and
 ;;                      decreases their 'coqc-dependency-count
+;;   'coqc-dependees  - list of child jobs this job depends on
+;;                      reverse links of 'coqc-dependants, needed to
+;;                      efficiently traverse the tree to collect ancestors
+;;                      for locking and unlocking
 ;;   'coqc-dependency-count - number of unfinished child jobs
 ;;                            increased for every subjob spawned
 ;;                            during coqdep output processing
@@ -254,28 +296,30 @@
 ;;                              are compiled, but queue items are only
 ;;                              put back into proof-action-list when
 ;;                              this property becomes nil
+;;   'queue-dependee  - previous top-level job, only present in require jobs
+;;                      reverse link of 'queue-dependant, needed to unlock
+;;                      ancestors in case of error
 ;;   'src-file        - the .v file name, only in file jobs
 ;;   'load-path       - value of coq-load-path, propagated to all
 ;;                      dependencies
-;;   'ancestors       - set of ancestor jobs, implemented as hash
-;;                     mapping jobs to t; for file jobs
-;;                     this set includes the job itself; the hash is
-;;                     necessary to avoid an exponentially growing
-;;                     number of duplicates
 ;;   'lock-state      - nil for require jobs, 'unlocked if the file
 ;;                      corresponding to job is not locked, 'locked if that
 ;;                      file has been locked, 'asserted if it has been
 ;;                      registered in some span in the 'coq-locked-ancestors
 ;;                      property already
 ;;   'require-span    - holds the span with the require command for require 
jobs
-;;   'vio2vo-needed   - t if a subsequent vio2vo process is required to
+;;   'second-stage    - nil if no second stage is required, otherwise 'vio2vo
+;;                      for <8.11 or 'vok for >=8.11; set in
+;;                      coq-par-job-needs-compilation
 ;;                      build the .vo file. Otherwiese nil.
 ;;   'failed          - t if coqdep or coqc for the job or one dependee failed.
 ;;   'visited         - used in the dependency cycle detection to mark
 ;;                      visited jobs
 ;;   'current-dir     - current directory or default-directory of the buffer
-;;                      that contained the require command. Only present in
-;;                      require jobs. Only needed for 8.4 compatibility.
+;;                      that contained the require command. Passed recursively
+;;                      to all jobs. Used to set default-directory in the
+;;                      sentinel and other functions, because it can otherwise
+;;                      be more or less random.
 ;;   'temp-require-file  - temporary file name just containing the require
 ;;                         command of a require job for determining the files
 ;;                         needed for that require. Must be deleted after
@@ -320,7 +364,8 @@
 ;;                      the dependencies
 ;;   'enqueued-coqc   - dependencies ready, coqc is running, or the job is
 ;;                      enqueued, waiting for a slot to start coqc
-;;   'waiting-queue   - XXX
+;;   'waiting-queue   - dependencies ready, waiting for queue dependee
+;;                      to get ready
 ;;   'ready           - ready, the result might be missing when 'failed
 ;;
 ;;
@@ -352,7 +397,7 @@
 ;; | coq-par-retire-top-level-job     |                  |                     
                 |
 ;; | coq-par-kickoff-queue-maybe cont | 'ready           |                     
                 |
 ;; | coq-par-require-processed        |                  | in dummy action in 
proof-action-list |
-;; | coq-par-run-vio2vo-queue         |                  | called via timer    
                 |
+;; | coq-par-run-second-stage-queue   |                  | called via timer    
                 |
 ;;
 ;;
 ;; The following _is_ outdated.
@@ -402,22 +447,25 @@ names to compilation jobs, regardless of ``-quick''.")
   "Pointer to the last require compilation job.
 Used to link top-level jobs with queue dependencies.")
 
-(defvar coq--compile-vio2vo-in-progress nil
-  "Set to t iff vio2vo is running in background.")
+(defvar coq--par-second-stage-in-progress nil
+  "t iff vio2vo or vok is running in background.")
 
-(defvar coq--compile-vio2vo-delay-timer nil
-  "Holds the timer for the vio2vo delay.")
+(defvar coq--par-second-stage-delay-timer nil
+  "Holds the timer for the second stage delay.")
 
-(defvar coq--compile-vio2vo-start-id 0
+(defvar coq--par-second-stage-start-id 0
   "Integer counter to detect races for `coq-par-require-processed'.
-Assume compilation for the last top-level ``Require'' command
-finishes but executing the ``Require'' takes so long that the
-user can assert a next ``Require'' and that the second
-compilation finishes before the first ``Require'' has been
-processed. In this case there are two `coq-par-require-processed'
-callbacks active, of which the first one must be ignored. For
-each new callback this counter is incremented and when there is a
-difference the call to `coq-par-require-processed' is ignored.")
+Assume the last top-level ``Require'' command is retired, but
+executing the ``Require'' takes so long that the user can assert
+a next ``Require'' and that the second require is retired before
+the first ``Require'' has been processed. In this case there are
+two `coq-par-require-processed' callbacks active, of which the
+first one must be ignored. For each new callback this counter is
+incremented and, when there is a difference,
+`coq-par-require-processed' does not start the second stage
+timer. In case the first callback gets executed before the second
+require is retired, the race is detected with
+`coq--last-compilation-job' without this counter.")
 
 (defvar coq--par-next-id 1
   "Increased for every job and process, to get unique job names.
@@ -475,13 +523,6 @@ latter is greater then everything else."
   "(Re-)Initialize `coq--compilation-object-hash'."
   (setq coq--compilation-object-hash (make-hash-table :test 'equal)))
 
-(defun merge-hash-content (target source)
-  "Add all elements of hash SOURCE to hash TARGET.
-Keys present in TARGET and in SOURCE are replaced in TARGET with
-their SOURCE binding."
-  (maphash
-   (lambda (key val) (puthash key val target))
-   source))
 
 ;;; generic queues
 ;; Standard implementation with two lists.
@@ -494,33 +535,44 @@ their SOURCE binding."
   "Insert X in queue QUEUE."
   (push x (car queue)))
 
+(defun coq-par-queue-reverse-if-needed (queue)
+  "Reorganize QUEUE, such that the pop-end contains something.
+Of course only if necessary and possible."
+  (unless (cdr queue)
+    (setcdr queue (nreverse (car queue)))
+    (setcar queue nil)))
+
+(defun coq-par-queue-head (queue)
+  "Return the head of QUEUE, if any, without removing it."
+  (coq-par-queue-reverse-if-needed queue)
+  (cadr queue))
+
 (defun coq-par-dequeue (queue)
   "Dequeue the next item from QUEUE."
-  (let ((res (pop (cdr queue))))
-    (unless res
-      (setcdr queue (nreverse (car queue)))
-      (setcar queue nil)
-      (setq res (pop (cdr queue))))
-    res))
+  (coq-par-queue-reverse-if-needed queue)
+  (pop (cdr queue)))
+
+(defun coq-par-queue-length (queue)
+  "Length of QUEUE."
+  (+ (length (car queue)) (length (cdr queue))))
 
 
 ;;; job queue
 
-;; XXX local variable -- check all defvars for local variables
-(defvar coq-par-compilation-queue (coq-par-new-queue)
+(defvar coq--par-compilation-queue (coq-par-new-queue)
   "Queue of compilation jobs that wait for a free core to get started.
 Use `coq-par-job-enqueue' and `coq-par-job-dequeue' to access the
 queue.")
 
 (defun coq-par-job-enqueue (job)
   "Insert JOB in the queue of waiting compilation jobs."
-  (coq-par-enqueue coq-par-compilation-queue job)
+  (coq-par-enqueue coq--par-compilation-queue job)
   (when coq--debug-auto-compilation
     (message "%s: enqueue job in waiting queue" (get job 'name))))
 
 (defun coq-par-job-dequeue ()
   "Dequeue the next job from the compilation queue."
-  (let ((res (coq-par-dequeue coq-par-compilation-queue)))
+  (let ((res (coq-par-dequeue coq--par-compilation-queue)))
     (when coq--debug-auto-compilation
       (if res
          (message "%s: dequeue" (get res 'name))
@@ -528,28 +580,37 @@ queue.")
     res))
 
 
-;;; vio2vo queue
+;;; queue for second stage (vio2vo or vok)
 
-(defvar coq-par-vio2vo-queue (coq-par-new-queue)
-  "Queue of jobs that need a vio2vo process.
-Use `coq-par-vio2vo-enqueue' and `coq-par-vio2vo-dequeue' to
-access the queue.")
+(defvar coq--par-second-stage-queue (coq-par-new-queue)
+  "Queue of jobs that need a vio2vo or vok process.
+Use `coq-par-second-stage-enqueue',
+`coq-par-second-stage-dequeue' and
+`coq-par-second-stage-queue-length' to access the queue.")
 
-(defun coq-par-vio2vo-enqueue (job)
-  "Insert JOB in the queue for vio2vo processing."
-  (coq-par-enqueue coq-par-vio2vo-queue job)
+(defun coq-par-second-stage-enqueue (job)
+  "Insert JOB in the queue for second stage processing."
+  (coq-par-enqueue coq--par-second-stage-queue job)
   (when coq--debug-auto-compilation
-    (message "%s: enqueue job in vio2vo queue" (get job 'name))))
+    (message "%s: enqueue job in second stage queue" (get job 'name))))
+
+(defun coq-par-second-stage-head ()
+  "Return the head of the second stage queue, if any, without removing it."
+  (coq-par-queue-head coq--par-second-stage-queue))
 
-(defun coq-par-vio2vo-dequeue ()
-  "Dequeue the next job from the vio2vo queue."
-  (let ((res (coq-par-dequeue coq-par-vio2vo-queue)))
+(defun coq-par-second-stage-dequeue ()
+  "Dequeue the next job from the second stage queue."
+  (let ((res (coq-par-dequeue coq--par-second-stage-queue)))
     (when coq--debug-auto-compilation
       (if res
-         (message "%s: vio2vo dequeue" (get res 'name))
-       (message "vio2vo queue empty")))
+         (message "%s: second stage dequeue" (get res 'name))
+       (message "second stage queue empty")))
     res))
 
+(defun coq-par-second-stage-queue-length ()
+  "Return the length of the second stage queue."
+  (coq-par-queue-length coq--par-second-stage-queue))
+
 
 ;;; error symbols
 
@@ -673,10 +734,10 @@ If no circle is found return nil, otherwise the list of 
files
 belonging to the circle.  Jobs in state 'enqueue-coqc can be
 ignored, because they can never participate in a cycle."
   (let (cycle)
-    (maphash (lambda (key job) (put job 'visited nil))
+    (maphash (lambda (_key job) (put job 'visited nil))
             coq--compilation-object-hash)
     (maphash
-     (lambda (key job)
+     (lambda (_key job)
        (when (and (not cycle) (not (get job 'visited))
                  (eq (get job 'state) 'waiting-dep))
         (setq cycle (coq-par-find-dependency-circle-for-job job nil))))
@@ -686,22 +747,22 @@ ignored, because they can never participate in a cycle."
 
 ;;; map coq module names to files, using synchronously running coqdep
 
-(defun coq-par-coqdep-arguments (lib-src-file coq-load-path)
+(defun coq-par-coqdep-arguments (lib-src-file clpath)
   "Compute the command line arguments for invoking coqdep on LIB-SRC-FILE.
-Argument COQ-LOAD-PATH must be `coq-load-path' from the buffer
+Argument CLPATH must be `coq-load-path' from the buffer
 that triggered the compilation, in order to provide correct
 load-path options to coqdep."
-  (nconc (coq-coqdep-prog-args coq-load-path
+  (nconc (coq-coqdep-prog-args clpath
                                (file-name-directory lib-src-file)
                                (coq--pre-v85))
          (list lib-src-file)))
 
-(defun coq-par-coqc-arguments (lib-src-file coq-load-path)
+(defun coq-par-coqc-arguments (lib-src-file clpath)
   "Compute the command line arguments for invoking coqc on LIB-SRC-FILE.
-Argument COQ-LOAD-PATH must be `coq-load-path' from the buffer
+Argument CLPATH must be `coq-load-path' from the buffer
 that triggered the compilation, in order to provide correct
 load-path options to coqdep."
-  (nconc (coq-coqc-prog-args coq-load-path (file-name-directory lib-src-file) 
(coq--pre-v85))
+  (nconc (coq-coqc-prog-args clpath (file-name-directory lib-src-file) 
(coq--pre-v85))
          (list lib-src-file)))
 
 (defun coq-par-analyse-coq-dep-exit (status output command)
@@ -717,13 +778,28 @@ or .vos files must be done elsewhere."
   ;;   (message "analyse coqdep output \"%s\"" output))
   (if (or
        (not (eq status 0))
+       ;; when a file on the command line is missing, coqdep drops it,
+       ;; possibly outputting nothing
+       (equal output "")
+       ;; when a dependency is missing coqdep outputs a warning with status 0
        (string-match coq-coqdep-error-regexp output))
       (progn
        ;; display the error
-       (coq-compile-display-error (mapconcat 'identity command " ") output t)
-        (if (eq status 0)
-            "unsatisfied dependencies"
-          (format "coqdep exist status %d" status)))
+       (coq-compile-display-error
+         (mapconcat #'identity command " ")
+         (if (equal output "")
+             "No coqdep output - file probably inaccessible"
+           output)
+         t)
+        ;; give back a string to signal error - the string content
+        ;; will only become visible during debugging
+        (cond
+         ((not (eq status 0))
+          (format "coqdep exit status %d" status))
+         ((equal output "")
+          "no coqdep output")
+         (t
+          "unsatisfied dependencies")))
     ;; In 8.5, coqdep produces two lines. Match with .* here to
     ;; extract only a part of the first line.
     ;; We could match against (concat "^[^:]*" obj-file "[^:]*: \\(.*\\)")
@@ -740,11 +816,11 @@ or .vos files must be done elsewhere."
 ;;; manage background jobs
 
 (defun coq-par-kill-all-processes ()
-  "Kill all background coqc, coqdep or vio2vo compilation processes.
+  "Kill all background coqc, coqdep, vio2vo or vok compilation processes.
 Return t if some process was killed."
   ;; need to first mark processes as killed, because delete process
   ;; starts running sentinels in the order processes terminated, so
-  ;; after the first delete-process we see sentinentels of non-killed
+  ;; after the first delete-process we see sentinels of non-killed
   ;; processes running
   (let ((kill-needed))
     (mapc
@@ -773,7 +849,7 @@ Return t if some process was killed."
 Used for unlocking ancestors on compilation errors."
   (when coq--compilation-object-hash
     (maphash
-     (lambda (key job)
+     (lambda (_key job)
        (when (eq (get job 'lock-state) 'locked)
          (coq-unlock-ancestor (get job 'src-file))
         (put job 'lock-state 'unlocked)))
@@ -788,13 +864,13 @@ background job that was killed."
     (when coq--debug-auto-compilation
       (message "kill all jobs and cleanup state"))
     (setq proc-killed (coq-par-kill-all-processes))
-    (setq coq-par-compilation-queue (coq-par-new-queue))
+    (setq coq--par-compilation-queue (coq-par-new-queue))
     (setq coq--last-compilation-job nil)
-    (setq coq-par-vio2vo-queue (coq-par-new-queue))
-    (setq coq--compile-vio2vo-in-progress nil)
-    (when coq--compile-vio2vo-delay-timer
-      (cancel-timer coq--compile-vio2vo-delay-timer)
-      (setq coq--compile-vio2vo-delay-timer nil))
+    (setq coq--par-second-stage-queue (coq-par-new-queue))
+    (setq coq--par-second-stage-in-progress nil)
+    (when coq--par-second-stage-delay-timer
+      (cancel-timer coq--par-second-stage-delay-timer)
+      (setq coq--par-second-stage-delay-timer nil))
     (coq-par-unlock-all-ancestors-on-error)
     (setq proof-second-action-list-active nil)
     (coq-par-init-compilation-hash)
@@ -839,8 +915,8 @@ side effect, that `proof-interrupt-process' does not send an
 interrupt signal to the prover."
   (let (proc-killed
        (was-busy (or coq--last-compilation-job
-                     coq--compile-vio2vo-in-progress
-                     coq--compile-vio2vo-delay-timer)))
+                     coq--par-second-stage-in-progress
+                     coq--par-second-stage-delay-timer)))
     (when coq--debug-auto-compilation
       (message "cleanup on user interrupt"))
     (setq proc-killed (coq-par-kill-and-cleanup))
@@ -869,50 +945,53 @@ file to be deleted when the process does not finish 
successfully."
        (process-name (format "pro-%s" coq--par-next-id))
        process)
     (setq coq--par-next-id (1+ coq--par-next-id))
-    (with-current-buffer (or proof-script-buffer (current-buffer))
-      (when coq--debug-auto-compilation
-       (message "%s %s: start %s %s in %s"
-                (get job 'name) process-name
-                command (mapconcat 'identity arguments " ")
-                default-directory))
-      (condition-case err
-         ;; If the command is wrong, start-process aborts with an
-         ;; error. However, in Emacs 23.4.1. it will leave a process
-         ;; behind, which is in a very strange state: running with no
-         ;; pid. Emacs 24.2 fixes this.
-         (setq process (apply 'start-process process-name
-                              nil      ; no process buffer
-                              command arguments))
-       (error
-        (when coq--debug-auto-compilation
-           (message "%s %s: error in start process, %s"
-                   (get job 'name) process-name
-                    (if file-rm
-                        (format "rm %s" file-rm)
-                      "no file removal")))         
-        (when file-rm
-          (ignore-errors (delete-file file-rm)))
-        (signal 'coq-compile-error-command-start
-                (list (cons command arguments) (nth 2 err)))))
-      (set-process-filter process 'coq-par-process-filter)
-      (set-process-sentinel process 'coq-par-process-sentinel)
-      (set-process-query-on-exit-flag process nil)
-      (setq coq--current-background-jobs (1+ coq--current-background-jobs))
-      (process-put process 'coq-compilation-job job)
-      (process-put process 'coq-process-continuation continuation)
-      (process-put process 'coq-process-command (cons command arguments))
-      (process-put process 'coq-process-output "")
-      (process-put process 'coq-process-rm file-rm))))
+    (when coq--debug-auto-compilation
+      (message "%s %s: start %s %s in %s"
+              (get job 'name) process-name
+              command (mapconcat #'identity arguments " ")
+              default-directory))
+    (condition-case err
+       ;; If the command is wrong, start-process aborts with an
+       ;; error. However, in Emacs 23.4.1. it will leave a process
+       ;; behind, which is in a very strange state: running with no
+       ;; pid. Emacs 24.2 fixes this.
+       (setq process (apply #'start-process process-name
+                            nil        ; no process buffer
+                            command arguments))
+      (error
+       (when coq--debug-auto-compilation
+         (message "%s %s: error in start process, %s"
+                 (get job 'name) process-name
+                  (if file-rm
+                      (format "rm %s" file-rm)
+                    "no file removal")))         
+       (when file-rm
+        (ignore-errors (delete-file file-rm)))
+       (signal 'coq-compile-error-command-start
+              (list (cons command arguments) (nth 2 err)))))
+    (set-process-filter process #'coq-par-process-filter)
+    (set-process-sentinel process #'coq-par-process-sentinel)
+    (set-process-query-on-exit-flag process nil)
+    (setq coq--current-background-jobs (1+ coq--current-background-jobs))
+    (process-put process 'coq-compilation-job job)
+    (process-put process 'coq-process-continuation continuation)
+    (process-put process 'coq-process-command (cons command arguments))
+    (process-put process 'coq-process-output "")
+    (process-put process 'coq-process-rm file-rm)))
 
 (defun coq-par-process-sentinel (process event)
-  "Sentinel for all background processes.
+  "Sentinel for all kinds of Coq background compilation processes.
 Runs when process PROCESS terminated because of EVENT. It
 determines the exit status and calls the continuation function
 that has been registered with that process. Normal compilation
 errors are reported with an error message inside the callback.
-Starts as many queued jobs as possible. If, at the end, no job is
+Starts as many queued jobs as possible. Second stage compilation
+jobs that have been killed, possibly because the user triggered a
+next first stage compilation, are put back into
+`coq--par-second-stage-queue'. If, at the end, no job is
 running in the background but compilation has not been finished,
-then there must be a cycle in the dependencies, which is found
+then, either second stage compilation finished (which is reported),
+or there must be a cycle in the dependencies, which is found
 and reported here. The cycle detection is skipped, if the
 retirement of the last compilation job has been delayed per
 `coq--par-delayed-last-job'. All signals are caught inside this
@@ -931,19 +1010,30 @@ function and reported appropriately."
            (when (process-get process 'coq-process-rm)
              (ignore-errors
                (delete-file (process-get process 'coq-process-rm))))
-           (when (eq (process-get process 'coq-process-continuation)
-                     'coq-par-vio2vo-continuation)
+           (when (or
+                   (eq (process-get process 'coq-process-continuation)
+                      'coq-par-vok-continuation)
+                   (eq (process-get process 'coq-process-continuation)
+                      'coq-par-vio2vo-continuation))
              (when coq--debug-auto-compilation
-               (message "%s: reenqueue for vio2vo"
+               (message "%s: reenqueue for second stage"
                         (get (process-get process 'coq-compilation-job) 
'name)))
-             (coq-par-vio2vo-enqueue
+             (coq-par-second-stage-enqueue
               (process-get process 'coq-compilation-job))))
-       (let (exit-status)
+        ;; process was not killed explicitly by us
+       (let (exit-status
+              (default-directory
+                (get (process-get process 'coq-compilation-job) 'current-dir)))
          (when coq--debug-auto-compilation
-           (message "%s %s: process status changed to %s"
-                    (get (process-get process 'coq-compilation-job) 'name)
-                    (process-name process)
-                    event))
+           (message
+             (concat "%s %s: TTT process status changed to %s  "
+                     "command: %s\n  default-dir: %s curr buf %s")
+            (get (process-get process 'coq-compilation-job) 'name)
+            (process-name process)
+            event
+             (mapconcat 'identity (process-get process 'coq-process-command) " 
")
+             default-directory
+             (buffer-name)))
          (cond
           ((eq (process-status process) 'exit)
            (setq exit-status (process-exit-status process)))
@@ -953,20 +1043,20 @@ function and reported appropriately."
          (funcall (process-get process 'coq-process-continuation)
                   process exit-status)
          (coq-par-start-jobs-until-full)
-         (when (and coq--compile-vio2vo-in-progress
+         (when (and coq--par-second-stage-in-progress
                     (eq coq--current-background-jobs 0))
-           (setq coq--compile-vio2vo-in-progress nil)
-           (message "vio2vo compilation finished"))
+           (setq coq--par-second-stage-in-progress nil)
+            (if (coq--post-v811)
+                (message "vok compilation finished")
+             (message "vio2vo compilation finished")))
          (when (and
                 (not coq--par-delayed-last-job)
                 (eq coq--current-background-jobs 0)
                 coq--last-compilation-job)
            (let ((cycle (coq-par-find-dependency-circle)))
              (if cycle
-                  ;; XXX cycle may contain a file job -> check code and adapt
-                  ;; cycle printing
                  (signal 'coq-compile-error-circular-dep
-                         (mapconcat 'identity cycle " -> "))
+                         (mapconcat #'identity cycle " -> "))
                (error "Deadlock in parallel compilation"))))))
     ;; coq-compile-error-start can be signaled inside the continuation
     ;; function, if that tries to start new jobs
@@ -986,38 +1076,46 @@ function and reported appropriately."
      (signal (car err) (cdr err)))))
 
 
-;;; vio2vo compilation
+;;; second stage compilation (vio2vo and vok)
 
-(defun coq-par-run-vio2vo-queue ()
-  "Start delayed vio2vo compilation."
-  ;; XXX this assert can be triggered - just start a compilation
-  ;; shortly before the timer triggers
+(defun coq-par-run-second-stage-queue ()
+  "Start delayed second stage compilation (vio2vo or vok).
+Set `default-directory' from the 'current-dir property of the
+head of the second stage queue, such that processes started here
+run with the right current directory."
+  ;; when the user starts another compilation, the timer for second
+  ;; stage is canceled
   (cl-assert (not coq--last-compilation-job)
-         nil "normal compilation and vio2vo in parallel 3")
-  (setq coq--compile-vio2vo-in-progress t)
-  (setq coq--compile-vio2vo-delay-timer nil)
+         nil "normal compilation and second stage in parallel 1")
+  (setq coq--par-second-stage-delay-timer nil)
   (when coq--debug-auto-compilation
-    (message "Start vio2vo processing for %d jobs"
-            (+ (length (car coq-par-vio2vo-queue))
-               (length (cdr coq-par-vio2vo-queue)))))
-  (coq-par-start-jobs-until-full))
+    (message "Start second stage processing for %d jobs"
+             (coq-par-second-stage-queue-length)))
+  (let ((head (coq-par-second-stage-head))
+        default-directory)
+    (when head
+      (setq default-directory (get head 'current-dir))
+      (setq coq--par-second-stage-in-progress t)
+      (coq-par-start-jobs-until-full))))
 
 (defun coq-par-require-processed (race-counter)
   "Callback for `proof-action-list' to signal completion of the last Require.
-This function ensures that vio2vo compilation starts after
-`coq-compile-vio2vo-delay' seconds after the last module has been
+This function ensures that second stage compilation starts after
+`coq-compile-second-stage-delay' seconds after the last module has been
 loaded into Coq. When background compilation is successful, this
 callback is inserted with a dummy item into proof-action-list
-somewhere after the last require command."
+somewhere after the last require command. RACE-COUNTER is used to
+detect more than one active callback, see
+`coq--par-second-stage-start-id'"
   ;; When the user asserts new stuff while the (previously) last
   ;; require command is being processed, `coq--last-compilation-job'
   ;; might get non-nil. In this case there is a new last compilation
-  ;; job that will eventually trigger vio2vo compilation.
+  ;; job that will eventually trigger the second stage.
   (unless (or coq--last-compilation-job
-             (not (eq race-counter coq--compile-vio2vo-start-id)))
-    (setq coq--compile-vio2vo-delay-timer
-         (run-at-time coq-compile-vio2vo-delay nil
-                      'coq-par-run-vio2vo-queue))))
+             (not (eq race-counter coq--par-second-stage-start-id)))
+    (setq coq--par-second-stage-delay-timer
+         (run-at-time coq-compile-second-stage-delay nil
+                      #'coq-par-run-second-stage-queue))))
 
 (defun coq-par-callback-queue-item (callback)
   "Create queue item containing just CALLBACK.
@@ -1039,15 +1137,25 @@ item will be processed as comment and only the callback 
will be called."
   "Return t if all dependencies of compilation job JOB are ready."
   (eq (get job 'coqc-dependency-count) 0))
 
-(defun coq-par-add-coqc-dependency (dependee dependant)
-  "Add normal Coq dependency from child job DEPENDEE to parent job DEPENDANT."
-  (put dependant 'coqc-dependency-count
-       (1+ (get dependant 'coqc-dependency-count)))
+(defun coq-par-add-coqc-dependency (dependee dependant count)
+  "Add normal Coq dependency from child job DEPENDEE to parent job DEPENDANT.
+If argument COUNT is non-nil, the dependency counter in DEPENDANT
+is increased, such that DEPENDANT waits for the completion of DEPENDEE."
+  (when count
+    (put dependant 'coqc-dependency-count
+         (1+ (get dependant 'coqc-dependency-count))))
   (push dependant (get dependee 'coqc-dependants))
+  (push dependee (get dependant 'coqc-dependees))
   (when coq--debug-auto-compilation
-    (message "%s -> %s: add coqc dependency"
-            (get dependee 'name) (get dependant 'name))))
-
+    (message "%s -> %s: add %s coqc dependency"
+            (get dependee 'name) (get dependant 'name)
+             (if count "counted" "uncounted"))))
+
+;; XXX need to propagate 'failed from dependee to dependant
+;; Relevant, if user asserts second region when for the first one
+;; compilation has failed already, but the queue region is still
+;; processing. What happens with coq--par-delayed-last-job and the
+;; delayed coq-par-kickoff-queue-maybe call?
 (defun coq-par-add-queue-dependency (dependee dependant)
   "Add queue dependency from require job DEPENDEE to require job DEPENDANT.
 The require item of DEPENDANT comes after those of DEPENDEE.
@@ -1057,6 +1165,7 @@ Therefore DEPENDANT must wait for DEPENDEE to finish. "
          nil "queue dependency cannot be added")
   (put dependant 'queue-dependant-waiting t)
   (put dependee 'queue-dependant dependant)
+  (put dependant 'queue-dependee dependee)
   (when coq--debug-auto-compilation
     (message "%s -> %s: add queue dependency"
             (get dependee 'name) (get dependant 'name))))
@@ -1076,7 +1185,7 @@ that are in the way are deleted.  Note that the coq 
documentation
 does not contain a statement, about what file is loaded, if both
 a .vo and a .vio file are present.  To be on the safe side, I
 therefore delete a file if it might be in the way.  Sets the
-'vio2vo-needed property on job if necessary."
+'second-stage property on job if necessary."
   (let* ((vo-file (get job 'vo-file))
         (vio-file (coq-library-vio-of-vo-file vo-file))
         (vo-obj-time (nth 5 (file-attributes vo-file)))
@@ -1100,6 +1209,9 @@ therefore delete a file if it might be in the way.  Sets 
the
        (if vio-obj-time (time-less-p vio-obj-time src-time) "-")
        (if vo-obj-time (coq-par-time-less vo-obj-time dep-time) "-")
        (if vio-obj-time (coq-par-time-less vio-obj-time dep-time) "-")))
+    ;; the source file must exist
+    (cl-assert src-time nil
+               "internal error - cannot find src file I")
     ;; Compute first the max of vo-obj-time and vio-obj-time and remember
     ;; which of both is newer. This is only meaningful if at least one of
     ;; the .vo or .vio file exists.
@@ -1132,7 +1244,7 @@ therefore delete a file if it might be in the way.  Sets 
the
                (when vo-obj-time
                  (setq file-to-delete vo-file))
                (when (eq coq-compile-quick 'quick-and-vio2vo)
-                 (put job 'vio2vo-needed t)))
+                 (put job 'second-stage 'vio2vo)))
            (put job 'required-obj-file vo-file)
            (when vio-obj-time
              (setq file-to-delete vio-file)))
@@ -1211,7 +1323,7 @@ therefore delete a file if it might be in the way.  Sets 
the
                (put job 'required-obj-file vio-file)
                (put job 'obj-mod-time vio-obj-time)
                (when (eq coq-compile-quick 'quick-and-vio2vo)
-                 (put job 'vio2vo-needed t))
+                 (put job 'second-stage 'vio2vo))
                (when coq--debug-auto-compilation
                  (message "%s: vio up-to-date; delete %s"
                           (get job 'name)
@@ -1241,7 +1353,8 @@ has been created more recently. As result, this function 
sets the
 property 'use-quick to `vos' if JOB should be compiled with -vos.
 If compilation is needed, 'required-obj-file is set.
 If no compilation is needed, 'obj-mod-time is set to the time stamp of
-the .vos or .vo file, depending on `coq-compile-prefer-vos'."
+the .vos or .vo file, depending on `coq-compile-prefer-vos'.  Sets
+the 'second-stage property on job to 'vok if necessary."
   (let* ((vo-file (get job 'vo-file))
          (vos-file (coq-library-vos-of-vo-file vo-file))
          (dep-time (get job 'youngest-coqc-dependency))
@@ -1249,12 +1362,19 @@ the .vos or .vo file, depending on 
`coq-compile-prefer-vos'."
          (vos-obj-time (nth 5 (file-attributes vos-file)))
          result)
     (when coq--debug-auto-compilation
-      (message "%s: compare mod times: vos mod %s, src mod %s, youngest dep %s"
+      (message
+       (concat "%s: compare mod times: vos mod %s, src mod %s, youngest dep 
%s\n"
+               "\tsrc file %s in %s")
                (get job 'name)
                (if vos-obj-time (current-time-string vos-obj-time) "-")
                (if src-time (current-time-string src-time) "-")
                (if (eq dep-time 'just-compiled) "just compiled"
-                (current-time-string dep-time))))
+                (current-time-string dep-time))
+               (get job 'src-file)
+               default-directory))
+    ;; the source file must exist
+    (cl-assert src-time nil
+               "internal error - cannot find src file II")
     (if (or (eq dep-time 'just-compiled) ; a dep has been just compiled
             (not vos-obj-time)           ; neither vos nor vo present
            ;; src younger than vos?
@@ -1266,13 +1386,24 @@ the .vos or .vo file, depending on 
`coq-compile-prefer-vos'."
             (progn
              (put job 'required-obj-file vos-file)
              (put job 'use-quick 'vos)
+              (when (eq coq-compile-vos 'vos-and-vok)
+                (put job 'second-stage 'vok))
               (setq result t))
           (put job 'required-obj-file vo-file)
           (setq result t))
       ;; maybe need to compile if vo is required
       (if (coq-compile-prefer-vos)
-          ;; vo not required and vos is fine - no compilation
-          (put job 'obj-mod-time vos-obj-time)
+          ;; vo not required and vos is fine - no compilation, but maybe vok
+          (let* ((vok-file (coq-library-vok-of-vo-file vo-file))
+                 (vok-time (nth 5 (file-attributes vok-file))))
+            (put job 'obj-mod-time vos-obj-time)
+            (when (and (eq coq-compile-vos 'vos-and-vok)
+                       (or (not vok-time) ; no vok exists
+                           ;; vos/vo is younger than src and dep, see above
+                           ;; if vo present, vok and vo have often the same 
time
+                           ;; vos/vo younger than vok?
+                           (time-less-p vok-time vos-obj-time)))
+              (put job 'second-stage 'vok)))
         ;; vo required, may need to compile
         (let ((vo-obj-time (nth 5 (file-attributes vo-file))))
           (when coq--debug-auto-compilation
@@ -1292,7 +1423,6 @@ the .vos or .vo file, depending on 
`coq-compile-prefer-vos'."
             (put job 'obj-mod-time vo-obj-time)))))
     result))
 
-
 (defun coq-par-job-needs-compilation (job)
   "Determine if JOB nees to get compiled and possibly do some side effects.
 This function calls `coq-par-job-needs-compilation-vos for coq >=
@@ -1305,6 +1435,70 @@ If compilation is needed, 'required-obj-file is set.  
Property
       (coq-par-job-needs-compilation-vos job)
     (coq-par-job-needs-compilation-quick job)))
 
+(defun coq-par-collect-locked-ancestors-dependees (job)
+  "Collect locked, not-yet-found ancestors from ancestors of JOB.
+Apply `coq-par-collect-locked-file-ancestors' recursively to all
+dependees to return those ancestors that are not yet asserted and
+have not been returned yet by a previous invocation of this
+function on a different job. This function sets the
+'collect-visited property on all returned jobs, which should be
+cleared before the next collection run."
+  ;; (message "CLAD: job %s: dependees %s"
+  ;;          (get job 'name)
+  ;;          (mapconcat
+  ;;           (lambda (job) (get job 'name))
+  ;;           (get job 'coqc-dependees) " "))
+  (apply #'nconc (mapcar #'coq-par-collect-locked-file-ancestors
+                         (get job 'coqc-dependees))))
+
+(defun coq-par-collect-locked-file-ancestors (job)
+  "Collect locked, not-yet-found ancestors of JOB.
+Return JOB if JOB is not asserted yet and has not been visited
+before by this function. Do the same recursively on all ancestors
+to return all not-yet-asserted ancestors of JOB. This function
+sets the 'collect-visited property on all returned jobs, which
+should be cleared before the next collection run."
+  ;; (message "CLFA job %s cv %s ls %s"
+  ;;          (get job 'name) (get job 'collect-visited) (get job 'lock-state))
+  (when (and (not (get job 'collect-visited))
+             (eq (get job 'lock-state) 'locked))
+    (put job 'collect-visited t)
+    (cons job (coq-par-collect-locked-ancestors-dependees job))))
+
+(defun coq-par-collect-locked-require-ancestors-rec (job)
+  "Collect locked, not yet found ancestorors for require job JOB.
+Return all not yet asserted ancestors for successful jobs JOB as
+well as for failed jobs JOB. For successful jobs, the not yet
+asserted ancestors of preceeding require jobs have been collected
+in a previous collection run. For failed jobs, this is not the
+case, therefore, for failed jobs, this function recureses into
+the preceeding require job, if it exists."
+  (let ((this-anc (coq-par-collect-locked-ancestors-dependees job))
+        (q-dep (get job 'queue-dependee))
+        prev-anc)
+    (when (and q-dep (get q-dep 'failed))
+      (setq prev-anc (coq-par-collect-locked-require-ancestors-rec q-dep)))
+    (nconc this-anc prev-anc)))
+
+(defun coq-par-collect-locked-require-ancestors (job)
+  "Top-level ancestor collection function - collects not asserted ancestors.
+Return all not yet asserted ancestors for successful jobs JOB as
+well as for failed jobs JOB. For failed require jobs JOB, this
+entails visiting the preceeding require job. The recursion
+internally uses property 'collect-visited to mark already visited
+jobs in order to avoid an exponential blowup in graphs that are
+not trees. This property is reset here after collection, such
+that its use stays internal."
+  (let ((ancs (coq-par-collect-locked-require-ancestors-rec job)))
+    (mapc (lambda (job) (put job 'collect-visited nil)) ancs)
+    (when coq--debug-auto-compilation
+      (message "%s: locked ancestors: %s"
+               (get job 'name)
+               (mapconcat
+                (lambda (job) (get job 'name))
+                ancs " ")))
+    ancs))
+
 (defun coq-par-retire-top-level-job (job)
   "Register ancestors and start queue items.
 JOB must be a successful require job.
@@ -1316,30 +1510,32 @@ jobs when they transition from 'waiting-queue to 'ready:
 - Moving queue items back to `proof-action-list' and start their
   execution.
 - Insert `coq-par-require-processed' as callback if this is the
-  last top-level job, such that vio2vo compilation will start
+  last top-level job, such that second stage compilation will start
   eventually."
   (cl-assert (and (not (get job 'failed)) (eq (get job 'type) 'require))
          nil "coq-par-retire-top-level-job precondition failed")
   (let ((span (get job 'require-span))
        (items (get job 'queueitems)))
     (when coq-lock-ancestors
-      (maphash
-       (lambda (anc-job not-used)
-         (cl-assert (not (eq (get anc-job 'lock-state) 'unlocked))
+      (mapc
+       (lambda (anc-job)
+         (cl-assert (eq (get anc-job 'lock-state) 'locked)
                     nil "bad ancestor lock state")
-         (when (eq (get anc-job 'lock-state) 'locked)
-           (put anc-job 'lock-state 'asserted)
-           (push (get anc-job 'src-file)
-                 (span-property span 'coq-locked-ancestors))))
-       (get job 'ancestors)))
+         (put anc-job 'lock-state 'asserted)
+         (push (get anc-job 'src-file)
+               (span-property span 'coq-locked-ancestors)))
+       (coq-par-collect-locked-require-ancestors job)))
     ;; XXX each require job must have items, right?
     (when items
-      (when (and (not (coq--post-v811))
-                 (eq coq-compile-quick 'quick-and-vio2vo)
-                (eq coq--last-compilation-job job))
-       (let ((vio2vo-counter
-              (setq coq--compile-vio2vo-start-id
-                    (1+ coq--compile-vio2vo-start-id))))
+      (when (and
+             (eq coq--last-compilation-job job)
+             (or (and (coq--post-v811)
+                      (eq coq-compile-vos 'vos-and-vok))
+                 (and (not (coq--post-v811))
+                      (eq coq-compile-quick 'quick-and-vio2vo))))
+       (let ((2nd-stage-counter
+              (setq coq--par-second-stage-start-id
+                    (1+ coq--par-second-stage-start-id))))
          ;; Insert a notification callback for when the last require
          ;; queue item has been processed.
          (setq items
@@ -1347,7 +1543,8 @@ jobs when they transition from 'waiting-queue to 'ready:
                 (car items)            ; this is the require
                 (cons
                  (coq-par-callback-queue-item
-                  `(lambda (span) (coq-par-require-processed ,vio2vo-counter)))
+                  (lambda (_span) (coq-par-require-processed
+                               2nd-stage-counter)))
                  (cdr items))))))
       (proof-add-to-queue items 'advancing)
       (when coq--debug-auto-compilation
@@ -1357,6 +1554,17 @@ jobs when they transition from 'waiting-queue to 'ready:
       ;; resetting queueitems is on the save side in any case
       (put job 'queueitems nil))))
 
+(defun coq-par-kickoff-queue-from-action-list (job)
+  "Trigger `coq-par-kickoff-queue-maybe' from action list.
+Simple wrapper around `coq-par-kickoff-queue-maybe' to set
+`default-directory' when entering background compilation
+functions from `proof-action-list'."
+  (let ((default-directory (get job 'current-dir)))
+    (when coq--debug-auto-compilation
+      (message "%s: TTT retry queue kickoff after processing action list"
+               (get job 'name)))
+    (coq-par-kickoff-queue-maybe job)))
+
 (defun coq-par-kickoff-queue-maybe (job)
   "Transition require job JOB to 'waiting-queue and maybe to 'ready.
 This function can only be called for require jobs. It further
@@ -1382,7 +1590,7 @@ retired and transition to 'ready. This means:
   is (recursively) done for the dependant
 - if this job is the last top-level compilation
   job (`coq--last-compilation-job') then the last compilation job
-  and `proof-second-action-list-active' are cleared and vio2vo
+  and `proof-second-action-list-active' are cleared and second stage
   processing is triggered.
 - If compilation failed, the (failing) last top-level job is
   delayed until `proof-action-list' is empty, possibly by
@@ -1420,7 +1628,8 @@ retired and transition to 'ready. This means:
          (setq coq--par-delayed-last-job t)
          (proof-add-to-queue
           (list (coq-par-callback-queue-item
-                 `(lambda (span) (coq-par-kickoff-queue-maybe ',job))))
+                 (lambda (_span)
+                    (coq-par-kickoff-queue-from-action-list job))))
           'advancing))
       (put job 'state 'ready)
       (when coq--debug-auto-compilation
@@ -1453,17 +1662,31 @@ retired and transition to 'ready. This means:
          (when (eq coq--last-compilation-job job)
            (when (get job 'failed)
              ;; proof-action-list is empty, see above
+              ;; unlock ancestors
+              (mapc
+               (lambda (anc-job)
+                 (cl-assert (eq (get anc-job 'lock-state) 'locked)
+                            nil "bad ancestor lock state")
+                 (when coq--debug-auto-compilation
+                   (message "%s: %s unlock because of error"
+                            (get anc-job 'name) (get anc-job 'src-file)))
+                 (coq-unlock-ancestor (get anc-job 'src-file))
+                 (put anc-job 'lock-state 'unlocked))
+               (coq-par-collect-locked-require-ancestors job))
              ;; variables that hold the queue span are buffer local
              (with-current-buffer (or proof-script-buffer (current-buffer))
                (proof-script-clear-queue-spans-on-error nil))
              (proof-release-lock)
-             (when (and (not (coq--post-v811))
-                         (eq coq-compile-quick 'quick-and-vio2vo))
-               (cl-assert (not coq--compile-vio2vo-delay-timer)
-                       nil "vio2vo timer set before last compilation job")
-               (setq coq--compile-vio2vo-delay-timer
-                     (run-at-time coq-compile-vio2vo-delay nil
-                                  'coq-par-run-vio2vo-queue))))
+             (when (or (and (coq--post-v811)
+                             (eq coq-compile-vos 'vos-and-vok))
+                        (and (not (coq--post-v811))
+                             (eq coq-compile-quick 'quick-and-vio2vo)))
+               (cl-assert (not coq--par-second-stage-delay-timer)
+                          nil
+                           "second stage timer set before last compilation 
job")
+               (setq coq--par-second-stage-delay-timer
+                     (run-at-time coq-compile-second-stage-delay nil
+                                  #'coq-par-run-second-stage-queue))))
            (setq coq--last-compilation-job nil)
            (setq proof-second-action-list-active nil)
            (when coq--debug-auto-compilation
@@ -1491,7 +1714,7 @@ transition 'enqueued-coqc -> 'ready is triggered."
   ;; Note that coq-par-job-needs-compilation sets 'required-obj-file
   ;; if compilation is needed (but it might also get set if no
   ;; compilation is needed). For Coq < 8.11 .vo or .vio files that are
-  ;; in the way are deleted. It also sets the 'vio2vo-needed property
+  ;; in the way are deleted. It also sets the 'second-stage property
   ;; if needed.
   (if (and (not (get job 'failed)) (coq-par-job-needs-compilation job))
       (coq-par-start-or-enqueue job)
@@ -1499,20 +1722,18 @@ transition 'enqueued-coqc -> 'ready is triggered."
       (message "%s: %s, no compilation"
               (get job 'name)
               (if (get job 'failed) "failed" "up-to-date")))
-    (when (get job 'vio2vo-needed)
-      (coq-par-vio2vo-enqueue job))
+    (when (get job 'second-stage)
+      (coq-par-second-stage-enqueue job))
     (coq-par-kickoff-coqc-dependants job nil)))
 
-(defun coq-par-decrease-coqc-dependency (dependant dependee-time
-                                                  dependee-anc-hash)
+(defun coq-par-decrease-coqc-dependency (dependant dependee-time)
   "Clear Coq dependency and update dependee information in DEPENDANT.
 This function handles a Coq dependency from child dependee to
 parent dependant when the dependee has finished compilation (ie.
 is in state 'ready).  DEPENDANT must be in state
 'waiting-dep.  The time of the most recent ancestor is updated, if
 necessary using DEPENDEE-TIME.  DEPENDEE-TIME must be an Emacs
-time or 'just-compiled.  The ancestors of dependee in hash
-DEPENDEE-ANC-HASH are propagated to DEPENDANT.  The dependency
+time or 'just-compiled.  The dependency
 count of DEPENDANT is decreased and, if it reaches 0, the next
 transition is triggered for DEPENDANT.  For 'file jobs this is
 'waiting-dep -> 'enqueued-coqc and for 'require jobs this is
@@ -1520,14 +1741,12 @@ transition is triggered for DEPENDANT.  For 'file jobs 
this is
 
 This function must be called for failed jobs to complete all
 necessary transitions."
-
   ;(message "%s: CPDCD with time %s" (get dependant 'name) dependee-time)
   (cl-assert (eq (get dependant 'state) 'waiting-dep)
          nil "wrong state of parent dependant job")
   (when (coq-par-time-less (get dependant 'youngest-coqc-dependency)
                           dependee-time)
     (put dependant 'youngest-coqc-dependency dependee-time))
-  (merge-hash-content (get dependant 'ancestors) dependee-anc-hash)
   (put dependant 'coqc-dependency-count
        (1- (get dependant 'coqc-dependency-count)))
   (cl-assert (<= 0 (get dependant 'coqc-dependency-count))
@@ -1536,12 +1755,9 @@ necessary transitions."
     (message "%s: coqc dependency count down to %d"
             (get dependant 'name) (get dependant 'coqc-dependency-count)))
   (when (coq-par-dependencies-ready dependant)
-    (cond
-     ;;; XXX rewrite with if
-     ((eq (get dependant 'type) 'file)
-      (coq-par-compile-job-maybe dependant))
-     ((eq (get dependant 'type) 'require)
-      (coq-par-kickoff-queue-maybe dependant)))))
+    (if (eq (get dependant 'type) 'file)
+        (coq-par-compile-job-maybe dependant)
+      (coq-par-kickoff-queue-maybe dependant))))
 
 (defun coq-par-kickoff-coqc-dependants (job just-compiled)
   "Handle transition to state 'ready for file job JOB.
@@ -1553,11 +1769,11 @@ not necessary or failed (with JUST-COMPILED being nil). 
This
 function sets 'youngest-coqc-dependency to the maximal (youngest)
 time stamp of the vo file for this job and all its ancestors.
 This function also decreases the dependency counter on all
-dependants, propagates 'youngest-coqc-dependency and the
-ancestors and starts any necessary state transitions on the
-dependants. Finally, if this job has not failed, but all
-dependants are marked as failed already, then the ancestors are
-unlocked as necessary.
+dependants, propagates 'youngest-coqc-dependency and
+starts any necessary state transitions on the
+dependants.  Nothing special happens, if this job is successful
+but all its dependants are marked failed.  Ancestor unlocking will
+be done when the last require job is retired.
 
 For the case that JUST-COMPILED is nil and that JOB has not
 failed, this function relies on 'obj-mod-time has been set
@@ -1565,8 +1781,7 @@ before."
   (cl-assert (not (eq (get job 'type) 'require))
              nil "kickoff-coqc-dependants called for require job")
   ;; most actions are not relevant for failed jobs, but do not harm
-  (let ((ancestor-hash (get job 'ancestors))
-       (dependant-alive nil)
+  (let ((dependant-alive nil)
         ;; take max (youngest) time of this job and all ancestors
         ;;
         ;; If this job has just been compiled then it is clearly
@@ -1578,17 +1793,12 @@ before."
                     (get job 'obj-mod-time))))
     (put job 'youngest-coqc-dependency dep-time)
     (when coq--debug-auto-compilation
-      (let (ancs)
-        ;; don't use map-apply here, this changes the timing too much
-        (maphash
-         (lambda (anc-job not-used) (push (get anc-job 'src-file) ancs))
-         ancestor-hash)
-        (message "%s: kickoff %d coqc dependencies with time %s\n\tancestors 
%s"
-                (get job 'name) (length (get job 'coqc-dependants))
-                (if (eq dep-time 'just-compiled)
-                    'just-compiled
-                  (current-time-string dep-time))
-                 ancs)))
+      ;; (let (ancs)
+      (message "%s: kickoff %d coqc dependencies with time %s"
+              (get job 'name) (length (get job 'coqc-dependants))
+              (if (eq dep-time 'just-compiled)
+                  'just-compiled
+                (current-time-string dep-time))))
     ;; In the recursion coq-par-kickoff-coqc-dependants ->
     ;; coq-par-decrease-coqc-dependency -> coq-par-compile-job-maybe
     ;; -> coq-par-kickoff-coqc-dependants jobs on the path upwards
@@ -1596,17 +1806,13 @@ before."
     ;; might take one of those as witness for an ongoing compilation.
     (put job 'state 'ready)
     (dolist (dependant (get job 'coqc-dependants))
-      (coq-par-decrease-coqc-dependency dependant dep-time ancestor-hash)
+      (coq-par-decrease-coqc-dependency dependant dep-time)
       (unless (get dependant 'failed)
        (setq dependant-alive t)))
     (when coq--debug-auto-compilation
       (message (concat "%s: coqc kickoff finished, %s dependant alive")
               (get job 'name)
-              (if dependant-alive "some" "no")))
-    (when (and (not dependant-alive)
-               (not (get job 'failed)))
-      ;; job has not failed, but all dependants have 'failed set
-      (coq-par-unlock-job-ancestors-on-error job))))
+              (if dependant-alive "some" "no")))))
 
 (defun coq-par-start-coqdep-on-require (job)
   "Start coqdep for require job JOB.
@@ -1629,12 +1835,12 @@ was queued."
            (get job 'load-path)))
         (coq-load-path-include-current nil)
         (require-command
-         (mapconcat 'identity (nth 1 (car (get job 'queueitems))) " "))
+         (mapconcat #'identity (nth 1 (car (get job 'queueitems))) " "))
         (temp-file (make-temp-file "ProofGeneral-coq" nil ".v")))
     (put job 'temp-require-file temp-file)
     (with-temp-file temp-file (insert require-command))
     (when coq--debug-auto-compilation
-      (message "%s: start coqdep for require job for file %s"
+      (message "%s: TTT start coqdep for require job for file %s"
               (get job 'name)
               (get job 'temp-require-file)))
     (coq-par-start-process
@@ -1652,8 +1858,11 @@ Lock the source file and start the coqdep background 
process."
              ;; locked registered files in `proof-included-files-list'
             (eq (get job 'lock-state) 'unlocked))
     (proof-register-possibly-new-processed-file (get job 'src-file))
-    (puthash job t (get job 'ancestors))
     (put job 'lock-state 'locked))
+  (when coq--debug-auto-compilation
+    (message "%s: TTT start coqdep for file job for file %s"
+            (get job 'name)
+            (get job 'src-file)))
   (coq-par-start-process
    coq-dependency-analyzer
    (coq-par-coqdep-arguments (get job 'src-file) (get job 'load-path))
@@ -1677,6 +1886,10 @@ used."
      ((eq (get job 'use-quick) 'vos) (push "-vos" arguments))
      ((eq (get job 'use-quick) 'vio) (push "-quick" arguments))
      (t t))
+    (when coq--debug-auto-compilation
+      (message "%s: TTT start coqc compile for file job for file %s"
+              (get job 'name)
+              (get job 'src-file)))
     (coq-par-start-process
      coq-compiler
      arguments
@@ -1684,6 +1897,27 @@ used."
      job
      (get job 'required-obj-file))))
 
+(defun coq-par-start-vok (job)
+  "Start coqc -vok background compilation for JOB."
+  (when coq--debug-auto-compilation
+    (message "%s start coqc -vok for %s"
+             (get job 'name)
+             (get job 'src-file)))
+  (message "coqc -vok %s" (get job 'src-file))
+  (when coq--debug-auto-compilation
+    (message "%s: TTT start coqc -vok for file job for file %s"
+            (get job 'name)
+            (get job 'src-file)))
+  (let ((arguments
+         (coq-par-coqc-arguments (get job 'src-file) (get job 'load-path))))
+    (push "-vok" arguments)
+    (coq-par-start-process
+     coq-compiler
+     arguments
+     'coq-par-vok-continuation
+     job
+     nil)))
+
 (defun coq-par-start-vio2vo (job)
   "Start vio2vo background job."
   (let ((arguments (coq-include-options (get job 'load-path)))
@@ -1695,6 +1929,10 @@ used."
               (get job 'name)
               (get job 'src-file)))
     (message "vio2vo %s" (get job 'src-file))
+    (when coq--debug-auto-compilation
+      (message "%s: TTT start vio2vo for file job for file %s"
+              (get job 'name)
+              (get job 'src-file)))
     (coq-par-start-process
      ;; in 8.9.1 and before only coqtop accepts -schedule-vio2vo
      ;; after change 103f59e only coqc accepts -schedule-vio2vo
@@ -1707,7 +1945,7 @@ used."
 (defun coq-par-start-task (job)
   "Start the background job for which JOB is waiting.
 JOB was at the head of the compilation queue and now either
-coqdep, coqc or vio2vo is started for it. This function may be called
+coqdep, coqc, vio2vo or vok is started for it. This function may be called
 synchronously or asynchronously."
   (let ((job-state (get job 'state)))
     (cond
@@ -1717,20 +1955,22 @@ synchronously or asynchronously."
       (coq-par-start-coqdep-on-file job))
      ((eq job-state 'enqueued-coqc)
       (coq-par-start-coqc job))
-     ((eq job-state 'ready)
+     ((and (eq job-state 'ready) (eq (get job 'second-stage) 'vok))
+      (coq-par-start-vok job))
+     ((and (eq job-state 'ready) (eq (get job 'second-stage) 'vio2vo))
       (coq-par-start-vio2vo job))
      (t (cl-assert nil nil "coq-par-start-task with invalid job")))))
 
 (defun coq-par-start-jobs-until-full ()
   "Start background jobs until the limit is reached.
 This function may be called synchronously or asynchronously."
-  (let ((max-jobs (if coq--compile-vio2vo-in-progress
-                     coq--internal-max-vio2vo-jobs
+  (let ((max-jobs (if coq--par-second-stage-in-progress
+                     coq--internal-max-second-stage-jobs
                    coq--internal-max-jobs))
        next-job)
     (while (and (< coq--current-background-jobs max-jobs)
-               (setq next-job (if coq--compile-vio2vo-in-progress
-                                  (coq-par-vio2vo-dequeue)
+               (setq next-job (if coq--par-second-stage-in-progress
+                                  (coq-par-second-stage-dequeue)
                                 (coq-par-job-dequeue))))
       (coq-par-start-task next-job))))
   
@@ -1744,7 +1984,7 @@ synchronously or asynchronously."
       (coq-par-start-task new-job)
     (coq-par-job-enqueue new-job)))
 
-(defun coq-par-job-init-common (coq-load-path type)
+(defun coq-par-job-init-common (clpath type current-dir)
   "Common initialization for 'require and 'file jobs.
 Create a new job of type TYPE and initialize all common fields of
 require and file jobs that need an initialization different from
@@ -1755,17 +1995,18 @@ nil."
     (put new-job 'coqc-dependency-count 0)
     (put new-job 'type type)
     (put new-job 'state 'enqueued-coqdep)
+    (put new-job 'current-dir current-dir)
     ;; The ancestor modification time is not really needed in require
     ;; jobs, however, if the field is present, we can treat require
     ;; and file jobs more uniformely.
     (put new-job 'youngest-coqc-dependency '(0 0))
-    (put new-job 'ancestors (make-hash-table :size 7 :rehash-size 2.1))
-    (put new-job 'load-path coq-load-path)
+    (put new-job 'load-path clpath)
     new-job))
 
-(defun coq-par-create-require-job (coq-load-path require-items require-span)
+(defun coq-par-create-require-job (clpath require-items require-span
+                                          current-dir)
   "Create a new require job for REQUIRE-SPAN.
-Create a new require job and initialize its fields. COQ-LOAD-PATH
+Create a new require job and initialize its fields. CLPATH
 is the load path configured for the current scripting buffer,
 that is passed down to all dependencies and used in all
 compilations. REQUIRE-ITEMS are the non-require commands
@@ -1773,19 +2014,20 @@ following the REQUIRE-SPAN, they are temporarily stored 
in the
 new require job outside of `proof-action-list'. 
 
 The current directory (from `default-directory') is stored in
-property 'current-dir for <8.5 compatibility, where coqdep did
-not search the current directory.
+property 'current-dir and propagated to all dependend jobs. This
+is used to set `default-directory' when entering background
+compilation from a sentinel or elsewhere.
 
 This function is called synchronously when asserting. The new
 require job is neither started nor enqueued here - the caller
 must do this."
-  (let ((new-job (coq-par-job-init-common coq-load-path 'require)))
+  (let* ((coq-load-path clpath)
+         (new-job (coq-par-job-init-common clpath 'require current-dir)))
     (put new-job 'require-span require-span)
     (put new-job 'queueitems require-items)
-    (put new-job 'current-dir default-directory)
     (when coq--debug-auto-compilation
       (let* ((require-item (car require-items))
-             (require-command (mapconcat 'identity (nth 1 require-item) " ")))
+             (require-command (mapconcat #'identity (nth 1 require-item) " ")))
         (message "%s: create require job for %s"
                  (get new-job 'name) require-command)))
     new-job))
@@ -1794,7 +2036,8 @@ must do this."
 ;; there was some error and it was not used anywhere back then, but
 ;; job is now needed as a dependency of some other file?
 ;; XXX what happens if the job exists and is failed?
-(defun coq-par-create-file-job (module-vo-file coq-load-path dep-src-file)
+(defun coq-par-create-file-job (module-vo-file clpath dep-src-file
+                                               current-dir)
   "Create a new file job for MODULE-VO-FILE.
 DEP-SRC-FILE is the source file whose coqdep output we are just
 processing and which depends on MODULE-VO-FILE. This argument is
@@ -1811,7 +2054,8 @@ If a new job is created it is started or enqueued right 
away."
   (cond
    ((gethash module-vo-file coq--compilation-object-hash))
    (t
-    (let ((new-job (coq-par-job-init-common coq-load-path 'file)))
+    (let* ((coq-load-path clpath)
+           (new-job (coq-par-job-init-common clpath 'file current-dir)))
       ;; fields 'required-obj-file and obj-mod-time are implicitely set to nil
       (put new-job 'vo-file module-vo-file)
       (put new-job 'src-file (coq-library-src-of-vo-file module-vo-file))
@@ -1837,78 +2081,6 @@ If a new job is created it is started or enqueued right 
away."
       (coq-par-start-or-enqueue new-job)
       new-job))))
 
-(defun coq-par-ongoing-compilation (job)
-  "Determine if the source file for JOB needs to stay looked.
-Return t if job has a direct or indirect dependant that has not
-failed yet and that is in a state before 'ready. Also,
-return t if JOB has a dependant that is a top-level job which has
-not yet failed."
-  ;; This function is called on jobs with 'lock-state 'locked. A job
-  ;; that is 'asserted has all its ancestors 'asserted as well.
-  ;; Therefore all direct and indirect dependants of job (i.e.,
-  ;; everything above) cannot be 'asserted. In a stable state all
-  ;; dependants must be 'locked. But when this function is called,
-  ;; ancestors from some failing job are unlocked in no particular
-  ;; order, therefore some dependant might already be 'unlocked.
-  (cl-assert (not (eq (get job 'lock-state) 'asserted))
-         nil "coq-par-ongoing-compilation precondition failed")
-  (cond
-   ((get job 'failed)
-    nil)
-   ((or (eq (get job 'state) 'waiting-dep)
-       (eq (get job 'state) 'enqueued-coqc)
-       ;; top-level job that has compilation finished but has not
-       ;; been asserted yet and has not been set to 'failed (see
-       ;; first cond check)
-       (eq (get job 'state) 'waiting-queue)
-       ;; Note that job cannot be a top-level in state 'ready,
-       ;; because we started from job with 'lock-state property equal
-       ;; to 'locked. Top-level job in state 'ready have all
-       ;; dependees with 'lock-state equal to 'asserted.
-       )
-    t)
-   ;; The following recursive clause needs to match file and require
-   ;; jobs that were ready, before the current mark-failing or
-   ;; unlocking-ancestors procedure started. Additionally, it also
-   ;; needs to match dependants that are right now inside
-   ;; coq-par-kickoff-coqc-dependants in the loop to propagate their
-   ;; ancestors to their dependants. Therefore it is important that
-   ;; coq-par-kickoff-coqc-dependants sets the state to 'ready quite
-   ;; early.
-   ((eq (get job 'state) 'ready)
-    ;; internal ready job
-    (let ((dependants (get job 'coqc-dependants))
-         (res nil)
-         dep)
-      (while (and (not res) (setq dep (pop dependants)))
-       (setq res (coq-par-ongoing-compilation dep)))
-      res))
-   (t
-    (cl-assert nil nil
-           "impossible ancestor state %s on job %s"
-           (get job 'state) (get job 'name)))))
-
-;; XXX check whether this needs to be called only when job is set to 'failed
-;; - when job was set to failed earlier, then the ancestors should have been
-;; unlocked earlier too
-(defun coq-par-unlock-job-ancestors-on-error (job)
-  "Unlock those ancestors of JOB that need to be unlocked.
-For a failing job JOB, an ancestor needs to stay looked if there
-is still some compilation going on for which this ancestor is a
-dependee or if a top level job with JOB as ancestor has finished
-it's compilation successfully.  In all other cases the ancestor
-must be unlocked."
-  (maphash
-   (lambda (anc-job not-used)
-     (when (and (eq (get anc-job 'lock-state) 'locked)
-                (not (coq-par-ongoing-compilation anc-job)))
-       (when coq--debug-auto-compilation
-         (message "%s: %s unlock because no ongoing compilation"
-                  (get anc-job 'name) (get anc-job 'src-file)))
-       (coq-unlock-ancestor (get anc-job 'src-file))
-       (put anc-job 'lock-state 'unlocked)))
-   (get job 'ancestors)))
-
 (defun coq-par-mark-queue-failing (job)
   "Mark require JOB and its queue dependants with 'failed.
 Mark JOB with 'failed and unlock ancestors as appropriate.
@@ -1918,12 +2090,7 @@ Recurse for queue dependants."
     (cl-assert (not (eq (get job 'state) 'ready))
            nil "coq-par-mark-queue-failing impossible state")
     (when coq--debug-auto-compilation
-      (message "%s: mark as failed, %s"
-              (get job 'name)
-              (if (eq (get job 'state) 'waiting-queue)
-                  "and unlock ancestors"
-                "wait")))
-    (coq-par-unlock-job-ancestors-on-error job)
+      (message "%s: mark as failed" (get job 'name)))
     (when (get job 'queue-dependant)
       (coq-par-mark-queue-failing (get job 'queue-dependant)))))
 
@@ -1935,8 +2102,7 @@ JOB.  Along the way, unlock ancestors as determined by
   (unless (get job 'failed)
     (put job 'failed t)
     (when coq--debug-auto-compilation
-      (message "%s: mark as failed and unlock free ancestors" (get job 'name)))
-    (coq-par-unlock-job-ancestors-on-error job)
+      (message "%s: mark as failed" (get job 'name)))
     (dolist (dependant (get job 'coqc-dependants))
       (coq-par-mark-job-failing dependant))
     (when (get job 'queue-dependant)
@@ -1994,21 +2160,19 @@ is directly passed to `coq-par-analyse-coq-dep-exit'."
        (unless (coq-compile-ignore-file dep-vo-file)
          (let* ((dep-job (coq-par-create-file-job dep-vo-file
                                                    (get job 'load-path)
-                                                   (get job 'src-file)))
+                                                   (get job 'src-file)
+                                                   (get job 'current-dir)))
                 (dep-time (get dep-job 'youngest-coqc-dependency)))
             (when (get dep-job 'failed)
               (setq dependee-failed t))
-            (when (eq (get dep-job 'state) 'ready)
-              (merge-hash-content (get job 'ancestors) (get dep-job 
'ancestors))
+            (when (and (eq (get dep-job 'state) 'ready)
+                       (coq-par-time-less job-max-time dep-time))
               ;; the following clause is not needed for require jobs,
               ;; but it doesn't harm either, so keep the code a little
               ;; bit more simple
-              (when (coq-par-time-less job-max-time dep-time)
-                (setq job-max-time dep-time)))
-            ;; not adding the dependency link is fine now
-            ;; with a feature for background vo compilation, this link is 
needed
-            (unless (eq (get dep-job 'state) 'ready)
-             (coq-par-add-coqc-dependency dep-job job)))))
+              (setq job-max-time dep-time))
+           (coq-par-add-coqc-dependency
+             dep-job job (not (eq (get dep-job 'state) 'ready))))))
       (put job 'youngest-coqc-dependency job-max-time)
       (when dependee-failed
         (cl-assert coq-compile-keep-going
@@ -2039,12 +2203,12 @@ behind PROCESS."
     (if (eq exit-status 0)
        (progn
          ;; coqc success
-         (when (get job 'vio2vo-needed)
-           (coq-par-vio2vo-enqueue job))
+         (when (get job 'second-stage)
+           (coq-par-second-stage-enqueue job))
          (coq-par-kickoff-coqc-dependants job t))
       ;; coqc error
       (coq-compile-display-error
-       (mapconcat 'identity (process-get process 'coq-process-command) " ")
+       (mapconcat #'identity (process-get process 'coq-process-command) " ")
        (process-get process 'coq-process-output)
        t)
       (if coq-compile-keep-going
@@ -2054,6 +2218,23 @@ behind PROCESS."
        (signal 'coq-compile-error-coqc
                (get (process-get process 'coq-compilation-job) 'src-file))))))
 
+(defun coq-par-vok-continuation (process exit-status)
+  "Vok continuation function.
+Nothing to do in case of success. Otherwise display the errors."
+  (let ((job (process-get process 'coq-compilation-job)))
+    (if (eq exit-status 0)
+       ;; success - nothing to do
+       (when coq--debug-auto-compilation
+         (message "%s: vok finished successfully" (get job 'name)))
+      (when coq--debug-auto-compilation
+       (message "%s: vok failed" (get job 'name)))
+      (coq-compile-display-error
+       (mapconcat 'identity (process-get process 'coq-process-command) " ")
+       (process-get process 'coq-process-output)
+       t)
+      ;; don't signal an error or abort other vok processes
+      )))
+
 (defun coq-par-vio2vo-continuation (process exit-status)
   "Vio2vo continuation function.
 Nothing to do in case of success. Otherwise display the errors."
@@ -2104,10 +2285,11 @@ This function is called synchronously when asserting."
         (message "handle require command \"%s\"" require-command)))
     (span-add-delete-action
      span
-     `(lambda ()
-       (coq-unlock-all-ancestors-of-span ,span)))
+     (lambda () (coq-unlock-all-ancestors-of-span span)))
     ;; create a new require job and maintain coq--last-compilation-job
-    (setq new-job (coq-par-create-require-job coq-load-path require-items 
span))
+    (setq new-job
+          (coq-par-create-require-job coq-load-path require-items span
+                                      default-directory))
     (when coq--last-compilation-job
       (coq-par-add-queue-dependency coq--last-compilation-job new-job))
     (setq coq--last-compilation-job new-job)
@@ -2121,7 +2303,7 @@ This function is called synchronously when asserting."
   "Return t if ITEM contains a Require command.
 Predicate for `split-list-at-predicate', used to split the new
 queue items at each Require command."
-  (let ((string (mapconcat 'identity (nth 1 item) " ")))
+  (let ((string (mapconcat #'identity (nth 1 item) " ")))
     (and string
         (string-match coq-require-command-regexp string))))
 
@@ -2144,12 +2326,12 @@ the ancestor hash are reinitialized.
 
 As next action the new queue items are splitted at each Require
 command.  The items before the first Require are appended to the
-last compilation job or put back into ‘proof-action-list’.  The
+old last compilation job or put back into ‘proof-action-list’.  The
 remaining batches of items that each start with a Require are
 then processed by `coq-par-handle-require-list', which creates
 require jobs as necessary.  Before processing the
 first of these batches, buffers are saved with
-`coq-compile-save-some-buffers' and an possibly ongoing vio2vo
+`coq-compile-save-some-buffers' and an possibly ongoing second stage
 compilation is stopped.
 
 Finally, `proof-second-action-list-active' is set if I keep some
@@ -2182,15 +2364,15 @@ This function is called synchronously when asserting."
     ;; with one command, use compilation-finish-functions to get
     ;; notification
     (when (cdr splitted-items)
-      (when coq--compile-vio2vo-delay-timer
-       (cancel-timer coq--compile-vio2vo-delay-timer)
-       (setq coq--compile-vio2vo-delay-timer nil))
-      (when coq--compile-vio2vo-in-progress
+      (when coq--par-second-stage-delay-timer
+       (cancel-timer coq--par-second-stage-delay-timer)
+       (setq coq--par-second-stage-delay-timer nil))
+      (when coq--par-second-stage-in-progress
        (cl-assert (not coq--last-compilation-job)
-               nil "normal compilation and vio2vo in parallel 2")
-       ;; there are only vio2vo background processes
+               nil "normal compilation and second stage in parallel 2")
+       ;; there are only second stage background processes
        (coq-par-kill-all-processes)
-       (setq coq--compile-vio2vo-in-progress nil))
+       (setq coq--par-second-stage-in-progress nil))
       ;; save buffers before invoking the first coqdep
       (coq-compile-save-some-buffers)
       (dolist (require-items (cdr splitted-items))
diff --git a/coq/coq-seq-compile.el b/coq/coq-seq-compile.el
index 3cdcd02a8d..af0c133f90 100644
--- a/coq/coq-seq-compile.el
+++ b/coq/coq-seq-compile.el
@@ -1,9 +1,9 @@
-;;; coq-seq-compile.el --- sequential compilation of required modules
+;;; coq-seq-compile.el --- sequential compilation of required modules  -*- 
lexical-binding: t; -*-
 
 ;; This file is part of Proof General.
 
 ;; Portions © Copyright 1994-2012  David Aspinall and University of Edinburgh
-;; Portions © Copyright 2003-2018  Free Software Foundation, Inc.
+;; Portions © Copyright 2003-2021  Free Software Foundation, Inc.
 ;; Portions © Copyright 2001-2017  Pierre Courtieu
 ;; Portions © Copyright 2010, 2016  Erik Martin-Dorel
 ;; Portions © Copyright 2011-2013, 2016-2017  Hendrik Tews
@@ -12,7 +12,7 @@
 ;; Authors: Hendrik Tews
 ;; Maintainer: Hendrik Tews <hendrik@askra.de>
 
-;; License:     GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
@@ -84,7 +84,7 @@ break."
       (message "call coqdep arg list: %S" coqdep-arguments))
     (with-temp-buffer
       (setq coqdep-status
-            (apply 'call-process
+            (apply #'call-process
                    coq-dependency-analyzer nil (current-buffer) nil
                    coqdep-arguments))
       (setq coqdep-output (buffer-string)))
@@ -100,7 +100,7 @@ break."
                                this-command)))
           ;; display the error
           (coq-init-compile-response-buffer
-           (mapconcat 'identity full-command " "))
+           (mapconcat #'identity full-command " "))
           (let ((inhibit-read-only t))
             (with-current-buffer coq--compile-response-buffer
               (insert coqdep-output)))
@@ -120,11 +120,11 @@ Display errors in buffer `coq--compile-response-buffer'."
          (list src-file)))
         coqc-status)
     (coq-init-compile-response-buffer
-     (mapconcat 'identity (cons coq-compiler coqc-arguments) " "))
+     (mapconcat #'identity (cons coq-compiler coqc-arguments) " "))
     (when coq--debug-auto-compilation
       (message "call coqc arg list: %s" coqc-arguments))
     (setq coqc-status
-          (apply 'call-process
+          (apply #'call-process
                  coq-compiler nil coq--compile-response-buffer t 
coqc-arguments))
     (when coq--debug-auto-compilation
       (message "compilation %s exited with %s, output |%s|"
@@ -243,8 +243,7 @@ function."
       (puthash lib-obj-file result coq-obj-hash)
       result)))
 
-(defun coq-seq-auto-compile-externally (span qualified-id
-                                            absolute-module-obj-file)
+(defun coq-seq-auto-compile-externally (span q-id absolute-module-obj-file)
   "Make MODULE up-to-date according to `coq-compile-command'.
 Start a compilation to make ABSOLUTE-MODULE-OBJ-FILE up-to-date.
 The compilation command is derived from `coq-compile-command' by
@@ -260,7 +259,14 @@ span for for proper unlocking on retract.
 This function uses the low-level interface `compilation-start',
 therefore the customizations for `compile' do not apply."
   (unless (coq-compile-ignore-file absolute-module-obj-file)
+    ;; Dynvar list taken from `coq-compile-substitution-list'.
+    (defvar physical-dir)
+    (defvar module-object)
+    (defvar module-source)
+    (defvar qualified-id)
+    (defvar requiring-file)
     (let* ((local-compile-command coq-compile-command)
+           (qualified-id q-id)
            (physical-dir (file-name-directory absolute-module-obj-file))
            (module-object (file-name-nondirectory absolute-module-obj-file))
            (module-source (coq-library-src-of-vo-file module-object))
@@ -269,7 +275,7 @@ therefore the customizations for `compile' do not apply."
        (lambda (substitution)
          (setq local-compile-command
                (replace-regexp-in-string
-                (car substitution) (eval (car (cdr substitution)))
+                (car substitution) (eval (car (cdr substitution)) t)
                 local-compile-command)))
        coq-compile-substitution-list)
       (if coq-confirm-external-compilation
@@ -287,7 +293,7 @@ therefore the customizations for `compile' do not apply."
        span
        (coq-library-src-of-vo-file absolute-module-obj-file)))))
 
-(defun coq-seq-map-module-id-to-obj-file (module-id span &optional from)
+(defun coq-seq-map-module-id-to-obj-file (module-id _span &optional from)
   "Map MODULE-ID to the appropriate coq object file.
 The mapping depends of course on `coq-load-path'.  The current
 implementation invokes coqdep with a one-line require command.
@@ -363,7 +369,7 @@ will be used for all \"Require\" commands added at once to 
the queue."
       (if (> (length coq-compile-command) 0)
           (coq-seq-auto-compile-externally span module-id module-obj-file)
         (unless (symbol-value coq-object-local-hash-symbol)
-          (set coq-object-local-hash-symbol (make-hash-table :test 'equal)))
+          (set coq-object-local-hash-symbol (make-hash-table :test #'equal)))
         (coq-seq-make-lib-up-to-date (symbol-value 
coq-object-local-hash-symbol)
                                  span module-obj-file)))))
 
@@ -371,31 +377,33 @@ will be used for all \"Require\" commands added at once 
to the queue."
   "Coq function for `proof-shell-extend-queue-hook'.
 If `coq-compile-before-require' is non-nil, this function performs the
 compilation (if necessary) of the dependencies."
-  (if coq-compile-before-require
-      (let (;; coq-object-hash-symbol serves as a pointer to the
-            ;; coq-obj-hash (see coq-seq-make-lib-up-to-date). The hash
-            ;; will be initialized when needed and stored in the value
-            ;; cell of coq-object-hash-symbol. The symbol is initialized
-            ;; here to use one hash for all the requires that are added now.
-            (coq-object-hash-symbol nil)
-            string)
-        (dolist (item queueitems)
-          (let ((string (mapconcat 'identity (nth 1 item) " ")))
-            (when (and string
-                       (string-match coq-require-command-regexp string))
-              (let ((span (car item))
-                    (start (match-end 0))
-                    (prefix (match-string 1 string)))
-                (span-add-delete-action
-                 span
-                 `(lambda ()
-                    (coq-unlock-all-ancestors-of-span ,span)))
-                (coq-compile-save-some-buffers)
-                ;; now process all required modules
-                (while (string-match coq-require-id-regexp string start)
-                  (setq start (match-end 0))
-                  (coq-seq-check-module 'coq-object-hash-symbol span
-                                    (match-string 1 string) prefix)))))))))
+  (when coq-compile-before-require
+    (defvar coq-object-hash-symbol)
+    (let (;; coq-object-hash-symbol serves as a pointer to the
+          ;; coq-obj-hash (see coq-seq-make-lib-up-to-date). The hash
+          ;; will be initialized when needed and stored in the value
+          ;; cell of coq-object-hash-symbol. The symbol is initialized
+          ;; here to use one hash for all the requires that are added now.
+          ;; FIXME: Why not create the hash table eagerly here and
+          ;; avoid the indirection (and avoid passing dynbound variable
+          ;; names around)?
+          (coq-object-hash-symbol nil))
+      (dolist (item queueitems)
+        (let ((string (mapconcat 'identity (nth 1 item) " ")))
+          (when (and string
+                     (string-match coq-require-command-regexp string))
+            (let ((span (car item))
+                  (start (match-end 0))
+                  (prefix (match-string 1 string)))
+              (span-add-delete-action
+               span
+               (lambda () (coq-unlock-all-ancestors-of-span span)))
+              (coq-compile-save-some-buffers)
+              ;; now process all required modules
+              (while (string-match coq-require-id-regexp string start)
+                (setq start (match-end 0))
+                (coq-seq-check-module 'coq-object-hash-symbol span
+                                      (match-string 1 string) prefix)))))))))
 
 
 (provide 'coq-seq-compile)
diff --git a/coq/coq-smie.el b/coq/coq-smie.el
index 37dc390cec..00c1fd5e38 100644
--- a/coq/coq-smie.el
+++ b/coq/coq-smie.el
@@ -3,7 +3,7 @@
 ;; This file is part of Proof General.
 
 ;; Portions © Copyright 1994-2012  David Aspinall and University of Edinburgh
-;; Portions © Copyright 2003-2018  Free Software Foundation, Inc.
+;; Portions © Copyright 2003-2021  Free Software Foundation, Inc.
 ;; Portions © Copyright 2001-2017  Pierre Courtieu
 ;; Portions © Copyright 2010, 2016  Erik Martin-Dorel
 ;; Portions © Copyright 2011-2013, 2016-2017  Hendrik Tews
@@ -13,7 +13,7 @@
 ;;          Stefan Monnier
 ;; Maintainer: Pierre Courtieu <Pierre.Courtieu@cnam.fr>
 
-;; License:     GPLv3+ (GNU GENERAL PUBLIC LICENSE version 3 or later)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 
@@ -87,7 +87,7 @@ indentation work well.
 
 An example of cofiguration is:
 
-(setq coq-smie-user-tokens '((\"xor\" . \"or\") (\"ifb\" . \"if\")))
+  (setq coq-smie-user-tokens '((\"xor\" . \"or\") (\"ifb\" . \"if\")))
 
 to have token \"xor\" and \"ifb\" be considered as having
 repectively same priority and associativity as \"or\" and \"if\".
@@ -158,11 +158,12 @@ attention to case differences."
 ;; coq grammar tacticals. This is not too problematic here since only
 ;; in records the indentation changes (maily for ";").
 (defun coq-smie-is-tactic ()
-  (let* ((pos (point))
+  (let* (;; (pos (point))
          (cmdstrt (save-excursion (coq-find-real-start)))
          (enclosing (coq-is-inside-enclosing cmdstrt)))
     (cond
-     ((string-equal enclosing "{|") nil)
+     ((string-equal enclosing "{|") nil) ;; only records
+     ((and enclosing (string-match "{" enclosing)) nil) ;; more agressive: 
record-like notations
      (t (save-excursion
           (goto-char cmdstrt)
           (let ((case-fold-search nil))
@@ -172,7 +173,7 @@ attention to case differences."
   (let ((case-fold-search nil))
     (save-excursion
       (coq-find-real-start)
-      (looking-at 
"\\(\\(Local\\|Global\\)\\s-+\\)?\\(Ltac\\|Tactic\\s-+Notation\\)\\s-"))))
+      (looking-at 
"\\(\\(Local\\|Global\\)\\s-+\\)?\\(Ltac2?\\|Tactic\\s-+Notation\\)\\s-"))))
 
 (defun coq-smie-is-inside-parenthesized-tactic ()
   (and (coq-smie-is-tactic) ;; fragile (uppercase test only)
@@ -239,7 +240,7 @@ the token of \".\" is simply \".\"."
 
 
 (defun coq-smie-find-unclosed-match-backward ()
-  (let ((tok (coq-smie-search-token-backward '("with" "match" "lazymatch" 
"multimatch" "."))))
+  (let ((tok (coq-smie-search-token-backward '("with" "match" "lazymatch" 
"multimatch" "lazy_match" "mult_match" "."))))
     (cond
      ((null tok) nil)
      ((equal tok ".") nil)
@@ -361,12 +362,11 @@ inside parenthesis)."
                  (let ((parops ; corresponding matcher may be a list
                         (if (listp (car parop)) (car parop) (cons (car parop) 
nil))))
                    ; go to corresponding closer or meet "."
-                   (when (member
-                          (coq-smie-search-token-backward
-                           (append parops (cons "." nil))
-                           end ignore-between)
-                          (cons "." nil))
-                     next))
+                   (coq-smie-search-token-backward
+                    ;; Add "." at the head of the list, since
+                    ;; it's more efficient and ordering is ignored anyway.
+                    (cons "." parops)
+                    end ignore-between))
                ;; Do not consider "." when not followed by a space
                ;(message "SPACE?: %S , %S , %S" next next (looking-at 
".[[:space:]]"))
                (when (or (not (equal next "."))
@@ -487,14 +487,14 @@ The point should be at the beginning of the command name."
        (t (save-excursion (coq-smie-backward-token))))) ;; recursive call
      ((or (string-match coq-bullet-regexp-nospace tok)
          (member tok '("=>" ":=" "::=" "exists" "in" "as" "∀" "∃" "→" "∨" "∧" 
";"
-                       "," ":" "eval")))
+                       "," ":" "eval" "return")))
       ;; The important lexer for indentation's performance is the backward
       ;; lexer, so for the forward lexer we delegate to the backward one when
       ;; we can.
       (save-excursion (coq-smie-backward-token)))
 
-     ;; easier to return directly than calling coq-smie-backward-token
-     ((member tok '("lazymatch" "multimatch")) "match")
+     ;; match needs to be catpured now to avoid being catpured by "Com start"
+     ((member tok '("match" "lazymatch" "lazy_match" "multimatch" 
"multi_match")) "match")
 
      ;; detect "with signature", otherwies use coq-smie-backward-token
      ((equal tok "with")
@@ -549,17 +549,36 @@ The point should be at the beginning of the command name."
      ((coq-dot-friend-p tok) ".")
      ;; Try to rely on backward-token for non empty tokens: bugs (hangs)
      ;; ((not (zerop (length tok))) (save-excursion (coq-smie-backward-token)))
+
+     ;; Com start is a token for the first word of a command (provided it is a 
word)
+     ((save-excursion
+        (and (smie-default-backward-token) 
+             (coq-is-at-command-real-start)
+             (> (length tok) 0)
+             (or (string= "Lu" (get-char-code-property (aref tok 0) 
'general-category))
+                 (string= "Ll" (get-char-code-property (aref tok 0) 
'general-category)))))
+      "Com start")
+
      ;; return it.
      (tok)
      )))
 
 
+(defun coq-is-at-def ()
+  ;; This is very approximate and should be used with care
+  (let ((case-fold-search nil)) (looking-at coq-command-defn-regexp)))
+
+(defun coq-is-at-def-or-decl ()
+  ;; This is very approximate and should be used with care
+  (let ((case-fold-search nil))
+    (or (looking-at coq-command-defn-regexp) (looking-at 
coq-command-decl-regexp))))
+
 
 ;; ":= with module" is really to declare some sub-information ":=
 ;; with" is for mutual definitions where both sides are of the same
 ;; level
 (defun coq-smie-:=-deambiguate ()
-  (let* ((orig (point))
+  (let* (;; (orig (point))
          (cmdstrt (save-excursion (coq-find-real-start)))
          (corresp (coq-smie-search-token-backward
                   '("let" "Inductive" "CoInductive" "{|" "." "with" "Module" 
"where"
@@ -586,14 +605,15 @@ The point should be at the beginning of the command name."
      ((equal corresp "where") ":= inductive") ;; inductive or fixpoint, 
nevermind
      ((or (eq ?\{ (char-before))) ":= record")
      ((equal (point) cmdstrt)
-      (if (looking-at "Equations") ":="
-        ":= def")) ; := outside of any parenthesis
-     (t ":=")
-     ))) ; a parenthesis stopped the search
+      ;; we reached the command start: either we were in an Equation,
+      ;; or the ":=" was inpatter of an Ltac match (pattern the form
+      ;; "| H: T := t |- _"). Toherwise we are probably in a Definition.
+      (if (or (looking-at "Equations\\|match\\|let")) ":=" ":= def"))
+     (t ":="))))
 
 
 (defun coq-smie-semicolon-deambiguate ()
-  (let* ((pos (point))
+  (let* (;; (pos (point))
          (cmdstrt (save-excursion (coq-find-real-start)))
          (istac (or (coq-smie-is-tactic)
                     (coq-smie-is-ltacdef)
@@ -626,10 +646,12 @@ The point should be at the beginning of the command name."
     (cond
      ;; Distinguish between "," from quantification and other uses of
      ;; "," (tuples, tactic arguments)
+     ;; we cannot distinguish between tuples and tac args, because of:
+     ;; an term (f x , v) and a tactic expecting a tuple (tac x , v)
      ((equal tok ",")
       (save-excursion
        (let ((backtok (coq-smie-search-token-backward
-                       '("forall" "∀" "∃" "exists" "|" "match" "lazymatch" 
"multimatch" "."))))
+                       '("forall" "∀" "∃" "exists" "|" "match" "lazymatch" 
"multimatch" "lazy_match" "multi_match" "."))))
          (cond
           ((member backtok '("forall" "∀" "∃")) ", quantif")
           ((equal backtok "exists") ; there is a tactic called exists
@@ -645,9 +667,9 @@ The point should be at the beginning of the command name."
      ;; trying to discriminate between bollean operator || and tactical ||.
      ((equal tok "||")
       (save-excursion
-       (let ((backtok (coq-smie-search-token-backward '("." ";" "Ltac" "(" "[" 
"{"))))
+       (let ((backtok (coq-smie-search-token-backward '("." ";" "Ltac" "Ltac2" 
"(" "[" "{"))))
          (cond
-          ((member backtok '("." "Ltac")) "|| tactic")
+          ((member backtok '("." "Ltac" "Ltac2")) "|| tactic")
           ((and (equal backtok ";")
                 (or (forward-char) t)
                 (equal (coq-smie-backward-token) "; tactic")) ;; recursive
@@ -697,7 +719,8 @@ The point should be at the beginning of the command name."
        ;(coq-find-real-start)
        (coq-smie-module-deambiguate)))
 
-     ((member tok '("lazymatch" "multimatch")) "match")
+     ;; match needs to be catpured now to avoid being catpured by "Com start"
+     ((member tok '("match" "lazy_match" "lazymatch" "multi_match" 
"multimatch")) "match")
 
      ((equal tok "tryif") "if")
 
@@ -732,9 +755,9 @@ The point should be at the beginning of the command name."
      ;;         (let ((nxttok (coq-smie-backward-token))) ;; recursive call
      ;;           (coq-is-cmdend-token nxttok))))
      ;;  (forward-char -1)
-     ;;  (if (looking-at "{") "{ subproof" "} subproof"))
+     ;;  (if (looking-at "{") "{ subproof" "} subproof")))
 
-     ((and (equal tok ":") (looking-back "\\<\\(constr\\|ltac\\|uconstr\\)"
+     ((and (equal tok ":") (looking-back "\\<\\(constr\\|ltac2?\\|uconstr\\)"
                                          (- (point) 7)))
       ": ltacconstr")
 
@@ -745,8 +768,8 @@ The point should be at the beginning of the command name."
      ((equal tok "=>")
       (save-excursion
        (let ((corresp (coq-smie-search-token-backward
-                       '("|" "match" "lazymatch" "multimatch" "fun" ".")
-                       nil '((("match" "lazymatch" "multimatch") . "end") 
("fun" . "=>")))))
+                       '("|" "match" "lazymatch" "multimatch" "lazy_match" 
"multi_match" "fun" ".")
+                       nil '((("match" "lazy_match" "multi_match") . "end") 
("fun" . "=>")))))
          (cond
           ((member corresp '("fun")) "=> fun") ; fun
           (t tok)))))
@@ -803,15 +826,26 @@ The point should be at the beginning of the command name."
       (save-excursion
        (let ((prev-interesting
               (coq-smie-search-token-backward
-               '("match" "lazymatch" "multimatch" "Morphism" "Relation" "." ". 
proofstart"
+               '("match" "lazymatch" "multimatch" "lazy_match" "multi_match" 
"Morphism" "Relation" "." ". proofstart"
                  "{ subproof" "} subproof" "as")
                nil
-               '((("match" "lazymatch" "multimatch" "let") . "with") ("with" . 
"signature")))))
+               '((("match" "lazy_match" "multi_match" "let") . "with") ("with" 
. "signature")))))
          (cond
-          ((member prev-interesting '("match" "lazymatch" "multimatch")) "as 
match")
+          ((member prev-interesting '("match" "lazymatch" "multimatch" 
"lazy_match" "mult_match")) "as match")
           ((member prev-interesting '("Morphism" "Relation")) "as morphism")
           (t tok)))))
 
+     ((equal tok "return")
+      (save-excursion
+       (let ((prev-interesting
+              (coq-smie-search-token-backward
+               '("match" "lazymatch" "multimatch" "lazy_match" "multi_match" 
"Morphism" "Relation" "." ". proofstart")
+               nil
+               '((("match" "lazy_match" "multi_match" "let") . "with") ("with" 
. "signature")))))
+         (cond
+          ((member prev-interesting '("match" "lazymatch" "multimatch" 
"lazy_match" "mult_match")) "return match")
+          (t tok)))))
+
      ((equal tok "by")
       (let ((p (point)))
        (if (and (equal (smie-default-backward-token) "proved")
@@ -834,10 +868,13 @@ The point should be at the beginning of the command name."
       (save-excursion
        (let ((prev-interesting
               (coq-smie-search-token-backward
-               '("let" "match" "lazymatch" "multimatch" ;"eval" should be 
"eval in" but this is not supported by search-token-backward
-                 "." ) nil
-               '((("match" "lazymatch" "multimatch") . "with") (("let" ;"eval"
-                                      ) . "in")))))
+               '("let" "match" "lazymatch" "multimatch" "lazy_match" 
"mult_match" ;"eval" should be "eval in" but this is not supported by 
search-token-backward
+                 "." )
+               nil
+               '((("match" "lazymatch" "multimatch" "lazy_match" "mult_match")
+                  . "with")
+                 (("let") ;"eval"
+                  . "in")))))
          (cond
           ((member prev-interesting '("." nil)) "in tactic")
           ((equal prev-interesting "let") "in let")
@@ -875,7 +912,26 @@ The point should be at the beginning of the command name."
       (let ((newtok (coq-smie-backward-token))) ; recursive call
        (concat newtok "." tok)))
 
+     ((member tok '("lazymatch" "lazy_match" "multimatch" "multi_match")) 
"match")
+
      ((coq-dot-friend-p tok) ".")
+
+     ;; Default fallback for words at command start position: We use a
+     ;; generic "Com start" token, so that everything in the command
+     ;; is considered a child of this token. This makes indentation
+     ;; never look above the current command start (unless indenting
+     ;; the first line of the command. For now we only apply this to
+     ;; things starting with a letter, because the grammar makes use
+     ;; of non letters token and this would hide them. Other
+     ;; exception: Ltac things like "match" and "let' that need to be
+     ;; recognized as such by the grammar.
+     ((and (coq-is-at-command-real-start)
+           (> (length tok) 0)
+           (not (member tok '("match" "lazymatch" "let"))) ;; match are 
already captured
+           (or (string= "Lu" (get-char-code-property (aref tok 0) 
'general-category))
+               (string= "Ll" (get-char-code-property (aref tok 0) 
'general-category))))
+      "Com start")
+
      (tok))))
 
 
@@ -893,6 +949,9 @@ Lemma foo: forall n,
   :type 'boolean
   :group 'coq)
 
+(make-variable-buffer-local 'coq-indent-box-style)
+
+
 (defun coq-indent-safep (indent)
   (>= indent 0))
 
@@ -958,14 +1017,71 @@ Typical values are 2 or 4."
   :group 'coq
   :safe #'coq-indent-safep)
 
-;; - TODO: remove tokens "{ subproof" and "} subproof" but they are
-;;         needed by the lexers at a lot of places.
-;; - FIXME: This does not know about Notations.
-;; - TODO Actually there are two grammars: one at script level, for
-;;   indenting each command with respect to the previous commands, and
-;;   a standard one inside commands. Separating the two grammars would
-;;   greatly simplify this file. We should ask Stefan Monnier how to
-;;   have two grammars with smie.
+
+
+;; smie grammar. General Remarks.
+
+;; 1. One oddity (a standard one IIUC) is that the "command end token"
+;; is considerd a separator. So any command is the child of the
+;; previous one. This may lead to strange things wrt to indentation if
+;; we don't take care. For instance the following script
+;:;
+;; Com1 .(1)
+;; Definition foo := bar .(2)
+;; ...
+;; could easily lead to the grammar tree
+;;
+;;                        __.(2)
+;;                    .(1)      \
+;;                  /      \     ...
+;;                 /        \
+;;             Com1        :=
+;;                       /     \
+;;                  Def foo    bar
+;;
+;; which means that "(1)" is the parent of ":=", which is the parent
+;; of "Def foo". This leads to hell. We need Def to be the parent. But
+;; there are hundreds of commands in coq. so we adopt the policy below.
+;;
+;; 2. the lexer tries to always treat the first word of a command as a
+;; dstinguished token "Com start". And a command is of the form ("Com
+;; start" exp) in smie grammar. This way the top-node of a command is
+;; always this token.
+;;
+;; This way the above script is parsed as:
+;;
+;;                        __.(2)
+;;                    .(1)      \
+;;                  /      \     ...
+;;                 /        \
+;;             Com1     Com start
+;;                          |
+;;                         :=
+;;                       /    \
+;;                     foo    bar
+;;
+;; which is much better. Indenting *inside* a command never looks
+;; above its own "Com start". This makes indentation rules much
+;; simpler, and hopefully speeds up things too since in practice it
+;; means indentation never inspect too far.
+;;
+;; 3. The only exception to "Com start" token at command start is
+;; structuring commands like "Proof" "Module", "{ subproof", bullets,
+;; goal selectors.
+;;
+;; 4. All non-word tokens (in particular bullets) are also not seen as
+;; "Com start". Thus user-defined commands (or tactics) starting with
+;; a non-word token will probably break indentation.
+;;
+;; 5. KNOWN BUGS: This does not know about Notations, but users can
+;; add new syntax for already defined tokens.
+;;
+;; 6. BUGS: probably dozens of.
+;;
+;; TODO: factorize infix operators into a series of "opxx" where "xx"
+;; is the coq grammar priority. users could then add there own infix
+;; operators in a consistent way.
+
 (defconst coq-smie-grammar
   (smie-prec2->grammar
    (smie-bnf->prec2
@@ -982,7 +1098,6 @@ Typical values are 2 or 4."
        ("fun" exp "=> fun" exp) ("if" exp "then" exp "else" exp)
        ("quantif exists" exp ", quantif" exp)
        ("forall" exp ", quantif" exp)
-;;;
        (exp "<- monadic" exp) (exp ";; monadic" exp)
        ("(" exp ")") ("{|" exps "|}") ("{" exps "}")
        (exp "; tactic" exp) (exp "in tactic" exp) (exp "as" exp)
@@ -996,11 +1111,14 @@ Typical values are 2 or 4."
        (exp "+" exp) (exp "-" exp)
        (exp "*" exp) (exp "&&" exp)
        (exp "^" exp)
-       (exp ": ltacconstr" exp)(exp ". selector" exp))
+       (exp ": ltacconstr" exp)(exp ". selector" exp)
+       ("Com start" exp)
+       )
+      
       ;; Having "return" here rather than as a separate rule in `exp' causes
       ;; it to be indented at a different level than "with".
       (matchexp (exp) (exp "as match" exp) (exp "in match" exp)
-               (exp "return" exp) )
+               (exp "return match" exp) )
       (exps (affectrec) (exps "; record" exps))
       (affectrec (exp ":= record" exp))
       (assigns  (exp ":= let" exp) (exp "<- monadic" exp))
@@ -1024,6 +1142,7 @@ Typical values are 2 or 4."
            (exp))
 
       (commands (commands "." commands)
+                ;(commands ". sameline" commands)
                (commands "- bullet" commands)
                (commands "+ bullet" commands)
                (commands "* bullet" commands)
@@ -1055,27 +1174,31 @@ Typical values are 2 or 4."
       (assoc "---- bullet") (assoc "++++ bullet") (assoc "**** bullet")
       (assoc ".")
       (assoc "with inductive" "with fixpoint" "where"))
-    '((assoc ":= equations") (assoc ":= def" ":= inductive")
-      (assoc "|") (assoc "; equations") (assoc "=>") (assoc ":=")
-      (assoc "xxx provedby")
-      (assoc "as morphism") (assoc "with signature") (assoc "with match")
+    '((nonassoc "Com start") (assoc ":= equations")
+      (assoc ":= def" ":= inductive")
+      (left "|") (assoc "; equations") (assoc "=>") (assoc ":=")
+      (assoc "as morphism") (assoc "xxx provedby")
+      (assoc "with signature") (assoc "with match")
       (assoc "in let" "in monadic")
-      (assoc "in eval") (assoc "=> fun") (assoc ", quantif") (assoc "then")
+      (assoc "in eval") (left "=> fun") (left ", quantif") (assoc "then")
       (assoc "|| tactic") ;; FIXME: detecting "+ tactic" and "|| tactic" seems 
impossible
-      (assoc "; tactic") (assoc "in tactic") (assoc "as" "by") (assoc "with")
-      (assoc "|-") (assoc ":" ":<") (assoc ",")
+      (left "; tactic") (assoc "in tactic") (assoc "as" "by") (assoc "with")
+      (assoc "|-") (assoc ":" ":<") (left ",")
       (assoc "else")
       (assoc "->") (assoc "<->")
-      (assoc "\\/") (assoc "&") (assoc "/\\")
-      (assoc "==") (assoc "=") (assoc "<" ">" "<=" ">=" "<>")
+      (left "\\/") (left "&" "/\\")
+      ;; FTR: left (instead of assoc) for "<" makes the hoare triple notation
+      ;; <{ .. }>\n exp \n<{ ... }> indent the two assertions at the same 
column.
+      (assoc "==") (assoc "=") (left "<" ">" "<=" ">=" "<>")
       (assoc "=?") (assoc "<=?") (assoc "<?")
       (assoc ";; monadic") (assoc "<- monadic")
       (assoc "^")
       (assoc "||") ;; FIXME: detecting "+ tactic" and "|| tactic" seems 
impossible
-      (assoc "+") (assoc "-") (assoc "*")(assoc "&&")
+      ;; this make indentation as expected.
+      (left "+" "-") (left "*") (left "&&")
       (assoc ": ltacconstr") (assoc ". selector"))
-    '((assoc ":" ":<")  (assoc "<"))
-    '((assoc ". modulestart" "." ". proofstart") (assoc "Module def")
+    '((assoc ":" ":<") (left "<"))
+    '((assoc "Module def")
       (assoc "with module" "module nodecl") (assoc ":= module")
       (assoc ":= with module")  (assoc ":" ":<"))
     '((assoc ":= def") (assoc "; record") (assoc ":= record"))))
@@ -1131,17 +1254,38 @@ Typical values are 2 or 4."
   "Return non-nil if PARENT-POS is on same line as CHILD-POS."
   (= (line-number-at-pos parent-pos) (line-number-at-pos child-pos)))
 
-(defcustom coq-indent-basic nil
+(defcustom coq-indent-basic 2
   "Basic indentation step.
 If nil, default to `proof-indent' if it exists or to `smie-indent-basic'."
   :group 'coq-mode
   :type '(choice (const :tag "Fallback on global settings" nil)
           integer))
 
-
-;; Debugging smie parent token, needs the highlight library
-;;and something like this in .emacs:
-;; (require 'highlight)
+;; otherwise there are some glitches
+(setq smie-indent-basic coq-indent-basic)
+
+;;;;;;;;;; DEBUG CODE ;;;;;;
+;; smie-config-show-indent is sufficient most of the time.
+
+(defun coq-debug-smie--parent (point parent &optional num)
+  ;;refresh highlighting? Not a good idea since this is called several times.
+  ;;(hlt-unhighlight-region)
+  (let* ((beg (if (listp (car parent)) (caar parent) (car parent)))
+         (end (cadr parent))
+         (regi (list (list beg end)))
+         (tok (caddr parent))
+         (face (cond
+                ((equal num 1) 'hlt-regexp-level-1)
+                ((equal num 2) 'hlt-regexp-level-2)
+                (t 'hlt-regexp-level-1))))
+    ;; uncomment to see visually the region
+    ;;(and parent (hlt-highlight-regions regi face))
+    ;;(when end (hlt-highlight-regions (list (list end (+ end 1))) 
'hlt-regexp-level-1))
+    ;; and the point considered
+    (hlt-highlight-regions (list (list point (+ point 1))) 'holiday)))
+
+;; Debugging smie rules calls, needs the highlight library and
+;; something like this in .emacs: (require 'highlight)
 ;; (custom-set-faces '(highlight ((((type x) (class color) (background light)) 
(:background "Wheat")))))
 (defun coq-show-smie--parent (parent token parent-token &optional num msg)
   (ignore-errors
@@ -1150,266 +1294,130 @@ If nil, default to `proof-indent' if it exists or to 
`smie-indent-basic'."
    (let* ((beg (if (listp (car parent)) (caar parent) (car parent)))
           (end (cadr parent))
           (regi (list (list beg end)))
-          (tok (caddr parent))
+          ;; (tok (caddr parent))
           (face (cond
-                 ((equal num 1) 'hlt-regexp-level-1)
                  ((equal num 2) 'hlt-regexp-level-2)
                  (t 'hlt-regexp-level-1))))
      (and parent (hlt-highlight-regions regi face)))))
+;;;;;;;;;; END DEBUG CODE ;;;;;;;;;;;;
+
+(defun coq-indent-categorize-token-after (tk)
+  "Factorize tokens behaving the same \"smie-rules\"-wise (kind:after)."
+  (cond
+   ((coq-is-bullet-token tk) "after bullet")
+   ((member tk '("with" ":" "by" "in tactic" "as" ",")) "tactic infix")
+   ((member tk '("<:" "<+" "with module")) "modulespec infix") ;;  ":= 
inductive" ":= module" and other ":= xxx"
+   ((string-prefix-p ":= " tk) "after :=")
+   ((member tk '(". proofstart" ". modulestart")) "dot script parent open")
+   ;; by default we pass the token name, but maybe it would be safer
+   ;; to simply fail, so that we detect missing tokens in this function?
+   (t tk)))
+
+(defun coq-indent-categorize-token-before (tk)
+  "Factorize tokens behaving the same \"smie-rules\"-wise (kind:after)."
+  (cond
+   ((member tk '(". proofstart" ". modulestart")) "dot script parent open")
+   ((member tk '(":" "by" "in tactic" "as" "with" ",")) "tactic infix")
+   ((string-prefix-p ":= " tk) "before :=")
+
+   ;; by default we pass the token name, but maybe it would be safer
+   ;; to simply fail, so that we detect missing tokens in this function?
+   (t tk)))
+
+
+;; ";" is a usual operator, with no indentation
+;; it would be like this;
+;;  foo.
+;;  foo ;
+;;  bar ;
+;;  bar.
+;;  foo.
+;; which is confusing. So we indent the first ";" of a sequence
+;; if not already inside an ltacdef of parenthesized tactic:
+;; foo ;
+;;   tac ; <--- indented
+;;   tac ; <--- no indent
+;;   [ tac2 ;
+;;     tac1 ; <-- no indentation here
+;;     now ( tac3 ;  <- neither here
+;;           tac5) ;
+;;   ]
+(defun coq-smie-ltac-semicol-indent-first (parent-semicol)
+  (and coq-indent-semicolon-tactical (not parent-semicol)
+       (not (coq-smie-is-ltacdef))
+       (not (coq-smie-is-inside-parenthesized-tactic))))
+
+
+;; this should be called if we already know that parent is a quantif.
+(defun coq--prev-quantif-at-indent-p ()
+  (save-excursion
+    (coq-smie-search-token-backward '("forall" "quantif exists"))
+    (equal (current-column) (current-indentation))))
 
-
+;; Reminder: (smie-rule-separator kind) only works for *parenthesized* 
enumerations.
+;; and ":= inductive" is not considered a parenthesis so "|" needs special hack
+;; below. "," for tuples and for tac args cannot be distinguished, so it 
cannot be
+;; treated like this either.
 
 (defun coq-smie-rules (kind token)
   "Indentation rules for Coq.  See `smie-rules-function'.
 KIND is the situation and TOKEN is the thing w.r.t which the rule applies."
-  (pcase kind
-     (`:elem (pcase token
-              (`basic (or coq-indent-basic
-                           (bound-and-true-p proof-indent)
-                           smie-indent-basic))))
-     (`:close-all t)
-     (`:list-intro
-      (or (member token '("fun" "forall" "quantif exists" "with"))
-         ;; We include "." in list-intro for the ". { .. } \n { .. }" so the
-         ;; second {..} is aligned with the first rather than being indented as
-         ;; if it were an argument to the first.
-         ;; FIXME: this gives a strange indentation for ". { \n .. } \n { .. }"
-;        (when (or (coq-is-bullet-token token)
-;                  (coq-is-dot-token token)
-;                  (member token '("{ subproof")))
-;          (forward-char 1) ; skip de "."
-;          (equal (coq-smie-forward-token) "{ subproof"))
-         ))
-     (`:after
-      ;;(coq-show-smie--parent smie--parent smie--token (smie-indent--parent) 
1 "AFTER")
-      (cond
-       ;; Override the default indent step added because of their presence
-       ;; in smie-closer-alist.
-       ((or (coq-is-bullet-token token)
-           (member token '(":" ":=" ":= with" ":= def" ":= equations"
-                           "by" "in tactic" "<:" "<+" ":= record"
-                           "with module" "as" ":= inductive" ":= module" )))
-       2)
-
-       ((equal token "with match") coq-match-indent)
-
-       ;; Inductive foo ...
-       ;; ...
-       ;; with
-       ;;   bar  <-- indent this by 2
-       ;; TODO: have this optional?
-       ((equal token "with inductive")
-       (if (smie-rule-parent-p "with inductive")
-           0
-         2)) 
-
-       ((equal token "with") 2)  ; add 2 to the column of "with" in the 
children
-
-       ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;XXXXXXXXXXXXXXXXXXXXXXXx
-       ((and (member token '("{" "{|"))
-             (smie-rule-prev-p ":=" ":= def")
-             (not coq-indent-box-style))
-        (save-excursion
-          (smie-backward-sexp t)
-          (cons 'column (+ 2 (smie-indent-virtual)))))
-
-
-       ;;; the ";" tactical ;;;
-       ;; ";" is a usual operator, with no indentation
-       ;; it would be like this;
-       ;;  foo.
-       ;;  foo ;
-       ;;  bar ;
-       ;;  bar.
-       ;;  foo.
-       ;; which is confusing. So we indent the first ";" of a sequence
-       ;; if not already inside an ltacdef of parenthesized tactic:
-       ;; foo ;
-       ;;   tac ; <--- indented
-       ;;   tac ; <--- no indent
-       ;;   [ tac2 ;
-       ;;     tac1 ; <-- no indentation here
-       ;;     now ( tac3 ;  <- neither here
-       ;;           tac5) ;
-       ;;   ]
-       ((equal token "; tactic")
-       (if (and (smie-rule-hanging-p)
-                coq-indent-semicolon-tactical
-                (not (coq-smie-is-ltacdef))
-                (not (coq-smie-is-inside-parenthesized-tactic))
-                (or (not (smie-rule-parent-p "; tactic"))
-                     ;; FIXME: Don't depend on SMIE's internals!
-                    (and (boundp 'smie--parent)
-                          smie--parent
-                         (coq-smie--same-line-as-parent
-                          (nth 1 smie--parent) (point)))))
-           coq-indent-semicolon-tactical
-         nil))
-
-       ((member token '("in let" "in monadic")) (smie-rule-parent))
-
-       ((equal token "} subproof")
-        (smie-rule-parent))
-
-       ;; proofstart is a special hack, since "." should be used as a
-       ;; separator between commands, here it is recognized as an open
-       ;; parenthesis, hence the current command (C) ending with "."
-       ;; is not recognized as correctly terminated. The "parent"
-       ;; computed by smie is therefore wrong and default indetation
-       ;; is broken. We fix this by indenting from the real-start of
-       ;; the command terminated by ". proofstart".
-       ((equal token ". proofstart")
-       (save-excursion (forward-char -1) (coq-find-real-start)
-                       `(column . ,(+ coq-indent-proofstart 
(current-column)))))
-       ((equal token ". modulestart")
-       (save-excursion (forward-char -1) (coq-find-real-start)
-                       `(column . ,(+ coq-indent-modulestart 
(current-column)))))))
-
-     (`:before
-      ;(coq-show-smie--parent smie--parent smie--token (smie-indent--parent) 2 
"BEFORE")
-      (cond
-
-
-       
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;XXXXXXXXXXXXXXXXXXXXXXXx;;;;;;;;;;;;;;
-       ;; trying to indent "{" at the end of line for records, but the
-       ;; parent is not what I think.
-       ;; ((and (member token '("{" "{|"))
-       ;;       (not coq-indent-box-style))
-       ;;  (if (smie-rule-bolp) 2 0))
-       ;(and (zerop (length tok)) (member (char-before) '(?\{ ?\})))
-       ((and (zerop (length token))
-             (looking-back "}") ;; "|}" useless when looking backward
-             (not coq-indent-box-style))
-        (smie-backward-sexp)
-        (smie-backward-sexp t)
-        (smie-indent-virtual)
-        )
-
-       ;; "with" is also in the :list-intro rules and in :after.
-       ((equal token "with")
-        ;; Hack: We know that "with" is linked to the first word of
-        ;; the current atomic tactic. This tactic is the parent, not
-        ;; the "." of the previous command.
-        `(column . ,(+ 2 (coq-find-with-related-backward))))
-
-       ((equal token "with module")
-       (if (smie-rule-parent-p "with module")
-           (smie-rule-parent)
-         (smie-rule-parent 2)))
-
-       ((member token '("in tactic" "as" "by"))
-       (cond
-        ((smie-rule-parent-p "- bullet" "+ bullet" "* bullet"
-                             "-- bullet" "++ bullet" "** bullet"
-                             "--- bullet" "+++ bullet" "*** bullet"
-                             "---- bullet" "++++ bullet" "**** bullet"
-                             "{ subproof" ". proofstart")
-         (smie-rule-parent 4))
-        ((smie-rule-parent-p "in tactic") (smie-rule-parent))
-        (t (smie-rule-parent 2))))
-
-       ((equal token "as")
-       (if (smie-rule-parent-p "in tactic") (smie-rule-parent) 2))
-
-       ((equal token "as morphism") (smie-rule-parent 2))
-       ((member token '("xxx provedby" "with signature"))
-       (if (smie-rule-parent-p "xxx provedby" "with signature")
-           (smie-rule-parent)
-         (smie-rule-parent 4)))
-
-
-       ;; This applies to forall located on the same line than "Lemma"
-       ;; & co. This says that "if it *were* be on the beginning of
-       ;; line" (which it is not) it would be indented of 2 wrt
-       ;; "Lemma". This never applies directly to indent the forall,
-       ;; but it is used to guess indentation of the next line. This
-       ;; allows fo the following indentation:
-       ;;  Lemma foo: forall x:nat,
-       ;;      x <= 0 -> x = 0.
-       ;; which refer to:
-       ;;  Lemma foo:
-       ;;    forall x:nat, <--- if it where on its own line it would be on 
column 2
-       ;;      x <= 0 -> x = 0. <--- therefore this is on column 4.
-       ;; instead of:
-       ;;  Lemma foo: forall x:nat,
-       ;;               x <= 0 -> x = 0.
-
-       ((and (member token '("forall" "quantif exists"))
-            (not coq-indent-box-style)
-            (not (smie-rule-bolp)))
-       (smie-rule-parent coq-smie-after-bolp-indentation))
-
-
-
-       ((and (member token '("forall" "quantif exists"))
-            (smie-rule-parent-p "forall" "quantif exists"))
-       (if (save-excursion
-             (coq-smie-search-token-backward '("forall" "quantif exists"))
-             (equal (current-column) (current-indentation)))
-           (smie-rule-parent)
-         (smie-rule-parent 2)))
-
-
-       ;; This rule allows "End Proof" to align with corresponding ".
-       ;; proofstart" PARENT instead of ". proofstart" itself
-       ;;  Typically:
-       ;;    "Proof" ". proofstart"
-       ;;    "Qed" <- parent is ". proofstart" above
-       ;; Align with the real command start of the ". xxxstart"
-       ((member token '(". proofstart" ". modulestart"))
-       (save-excursion (coq-find-real-start)
-                       `(column . ,(current-column))))
-
-       ((or (member token '(":= inductive" ":= def" ":= equations" ":="))
-            (and (equal token ":") (smie-rule-parent-p ".")))
-        (let ((pcol
-               (save-excursion
-                 ;; Indent relative to the beginning of the current command
-                 ;; rather than relative to the previous command.
-                 (smie-backward-sexp token)
-                 ;; special case: if this ":=" corresponds to a "with
-                 ;; foo", then the previous smie-backward-sexp stopped
-                 ;; between "with" and "foo" (because "with inductive"
-                 ;; and co are considered as ".", maybe this is the
-                 ;; problem), but we want to indent from the column of
-                 ;; "with" instead
-                 (let ((col1 (current-column)))
-                   (if (equal (coq-smie-backward-token) "with inductive")
-                       (current-column)
-                     col1)
-                   ))))
-          `(column . ,(if (smie-rule-hanging-p) pcol (+ 2 pcol)))))
-
-       ((equal token "|")
-       (cond
-         ;; ":= equations" and "; record" are for Equations plugin
-         ((smie-rule-parent-p "with match" ":= equations" "; record")
-         (- (funcall smie-rules-function :after "with match") 2))
-         ;; This is also for Equations plugijns, but happens at first
-         ;; line if a pattern matching and it is ugly to have the "|"
-         ;; at the saem column than "{"
-         ((smie-rule-parent-p "{")
-         (funcall smie-rules-function :after "with match"))
-        ((smie-rule-prev-p ":= inductive")
-         (- (funcall smie-rules-function :after ":= inductive") 2))
-        (t (smie-rule-separator kind))))))
-     ))
-
-;; No need of this hack anymore?
-;;       ((and (equal token "Proof End")
-;;             (smie-rule-parent-p "Module" "Section" "goalcmd"))
-;;        ;; ¡¡Major gross hack!!
-;;        ;; This typically happens when a Lemma had no "Proof" keyword.
-;;        ;; We should ideally find some other way to handle it (e.g. matching 
Qed
-;;        ;; not with Proof but with any of the keywords like Lemma that can
-;;        ;; start a new proof), but we can workaround the problem here, 
because
-;;        ;; SMIE happened to decide arbitrarily that Qed will stop before 
Module
-;;        ;; when parsing backward.
-;;        ;; FIXME: This is fundamentally very wrong, but it seems to work
-;;        ;; OK in practice.
-;;        (smie-rule-parent 2))
-
-
+  (let ((boxed coq-indent-box-style))
+    ;; smie-rule... short synonyms
+    (cl-flet ((parent-p (&rest x) (apply 'smie-rule-parent-p x))
+              (parent (&optional x) (smie-rule-parent x))(hang-p () 
(smie-rule-hanging-p)))
+      (pcase (cons kind token)
+        (`(,_ . (or "; record")) (smie-rule-separator kind)) ;; see also the 
"before" rule
+        (`(:elem . basic) (or coq-indent-basic (bound-and-true-p proof-indent) 
2))
+        (`(:elem . arg)  (if (smie-rule-prev-p "} subproof") 0 nil)) ;; hack: 
"{} {}"" not an application
+        (`(:close-all . ,_) t)
+        (`(:list-intro . ,_) (member token '("fun" "forall" "quantif exists"
+                                             "with" "Com start")))
+        (`(:after . ,_) ;; indent relative to token (parent of token at point).
+         (pcase (coq-indent-categorize-token-after token)
+           ("} subproof" 0) ;;shouldn't be captured by (:elem . args)?
+           ;; decrement indentation when hanging 
+           ((and (or "tactic infix" "after :=") (guard (or (hang-p) 
(smie-rule-bolp)))) 0)
+           ((and "->" (guard (hang-p))) 0) ((or ":=" "with inductive") 2)
+           ((or "." "; equations" "in let" "in monadic" ";; monadic") 0)
+           ((and "; tactic" (guard (hang-p)) (guard (not (parent-p "Com 
start")))) 0)
+           ("; tactic" 2);; only applies "after" so when ";" is alone at its 
line
+           ((guard (string-match "^[^][:alnum:](){}\[]" token)) 2); guessing 
infix operator.
+           ;;((guard (and (message "DEFAULTING") nil)) nil)
+           ))
+        (`(:before . ,_) ; indent token at point itself
+         (let* ((cat (coq-indent-categorize-token-before token))
+                (real-start-col (save-excursion (coq-find-real-start) 
(current-column))))
+           (pcase cat
+             ;; indenting the ". modulestart" itself, which is a prenthesizing 
cmd
+             ("dot script parent open" `(column . ,real-start-col))
+             ;; special case for equations, so that "| xxx\n :=" is indented 
nicely
+             ((and ":=" (guard (and (not (hang-p)) (parent-p "|")))) 4)
+             ("before :=" (parent 2)) ;; ":= xxx" always introduced by a parent
+             ("tactic infix" (parent 2))
+             ("|" (cond ((parent-p ":= inductive" ":= equations") -2)
+                        (t 0)));((parent-p "|") 0)
+             ;; align quantifiers with the previous one
+             ((and(or "forall" "quantif exists")(guard (parent-p "forall" 
"quantif exists")))
+              (parent))
+             ((and(or "fun")(guard (parent-p "fun"))) (parent))
+             ;; indent on level after a ";" but only at command level.
+             ((and "; tactic" (guard (parent-p "Com start"))) (parent))
+             ("; record" 0); is also a smie-rule-separator
+             ;; VIRTUAL INDENTATION for "unboxed" indentation: we are in the 
"before"
+             ;; section, but we compute the indentation for a token NOT 
appearing at
+             ;; beginning of line. This happens when not indenting the token 
itself but
+             ;; rather querying its virtual indentation to compute indentation 
of another
+             ;; (child) token. unbox ==> indent relative to parent.
+             ;; unboxed indent for "{" not at bol:
+             ((and (or "forall" "quantif exists") (guard (and (not 
(smie-rule-bolp)) (not boxed))))
+              (parent coq-smie-after-bolp-indentation))
+             ((and (or "[" "{") (guard (not (smie-rule-bolp)))) (parent 2))
+             ((guard (and (smie-rule-prev-p "} subproof" "{ subproof" ".") 
(not (smie-rule-bolp))))
+              (cond
+               ((smie-rule-prev-p "} subproof") (parent))
+               ((smie-rule-prev-p "{ subproof") (coq-smie-backward-token) (+ 2 
(smie-indent-virtual)))
+               ((smie-rule-prev-p ".") (smie-backward-sexp 'half) 
(smie-indent-virtual)))))))))))
 
 
 (provide 'coq-smie)
diff --git a/coq/coq-syntax.el b/coq/coq-syntax.el
index 0e14363700..5017a6ed32 100644
--- a/coq/coq-syntax.el
+++ b/coq/coq-syntax.el
@@ -3,7 +3,7 @@
 ;; This file is part of Proof General.
 
 ;; Portions © Copyright 1994-2012  David Aspinall and University of Edinburgh
-;; Portions © Copyright 2003-2018  Free Software Foundation, Inc.
+;; Portions © Copyright 2003-2021  Free Software Foundation, Inc.
 ;; Portions © Copyright 2001-2017  Pierre Courtieu
 ;; Portions © Copyright 2010, 2016  Erik Martin-Dorel
 ;; Portions © Copyright 2011-2013, 2016-2017  Hendrik Tews
@@ -12,7 +12,7 @@
 ;; Authors: Thomas Kleymann, Healfdene Goguen, Pierre Courtieu
 ;; Maintainer: Pierre Courtieu <Pierre.Courtieu@cnam.fr>
 
-;; License:     GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
@@ -205,7 +205,7 @@ so for the following reasons:
      ("exfalso" "exf" "exfalso" t "exfalso")
      ("exists" "ex" "exists #" t "exists")
      ;;     ("fail" "fa" "fail" nil)
-     ;;     ("field" "field" "field" t "field")
+     ("field" "field" "field" t "field")
      ("false_hyp" nil "false_hyp @{H} @{G}" t "false_hyp")
      ("firstorder" "fsto" "firstorder" t "firstorder")
      ("firstorder with" "fsto" "firstorder with #" t)
@@ -236,14 +236,16 @@ so for the following reasons:
      ("inversion_clear" "invcl" "inversion_clear" t "inversion_clear")
      ("lapply" "lap" "lapply" t "lapply")
      ("lazy" "lazy" "lazy beta delta [#] iota zeta" t "lazy")
-     ("lazymatch with" "m" "lazymatch # with\n| # => #\nend")
+     ("lazymatch with" "lazym" "lazymatch # with\n| # => #\nend")
+     ("lazy_match! with" "lazy_m" "lazy_match! # with\n| # => #\nend")
      ("left" "left" "left" t "left")
      ("lia" nil "lia" t "lia")
      ("linear" "lin" "linear" t "linear")
      ("load" "load" "load" t "load")
      ("lra" nil "lra" t "lra")
      ("move after" "mov" "move # after #" t "move")
-     ("multimatch with" "m" "multimatch # with\n| # => #\nend")
+     ("multimatch with" "mm" "multimatch # with\n| # => #\nend")
+     ("multi_match! with" "multi_m" "multi_match! # with\n| # => #\nend")
      ("nia" nil "nia" t "nia")
      ("now_show" nil "now_show" t "now_show")
      ("nra" nil "nra" t "nra")
@@ -350,7 +352,6 @@ so for the following reasons:
      ("exact" "exa" "exact" t "exact")
      ("fourier" "four" "fourier" t "fourier")
      ("fail" "fa" "fail" nil)
-     ("field" "field" "field" t "field")
      ("gfail" "gfa" "gfail" nil "gfail")
      ("lia" nil "lia" t "lia")
      ("lra" nil "lra" t "lra")
@@ -374,7 +375,8 @@ so for the following reasons:
 (defvar coq-solve-cheat-tactics-db
   (append
    '(("admit" nil "admit" t "admit")
-     ("Admitted" nil "Admitted" t "Admitted"))
+     ("Admitted" nil "Admitted" t "Admitted")
+     ("Abort" nil "Abort" t "Abort"))
    coq-user-cheat-tactics-db)
   "Coq tactic(al)s that solve a subgoal."
   )
@@ -453,6 +455,7 @@ so for the following reasons:
 
 (defvar coq-defn-db
   '(
+    ("Canonical Structure" nil "Canonical Structure #." t 
"Canonical\\s-+Structure")
     ("CoFixpoint" "cfix" "CoFixpoint # (#:#) : # :=\n#." t "CoFixpoint")
     ("CoInductive" "coindv" "CoInductive # : # :=\n|# : #." t "CoInductive")
     ("Class" "class" "Class [ # ] := \n# : #;\n# : #." t "Class")
@@ -587,8 +590,8 @@ so for the following reasons:
      ("Test" nil "Test" nil "Test" nil t) ; let us not highlight all possible 
options for Test
      ("Timeout" nil "Timeout" nil "Timeout")
      )
-   "Coq queries command, that deserve a separate menu for sending them to coq 
without insertion."
-   )
+   "Coq queries command.
+They deserve a separate menu for sending them to Coq without insertion.")
 
 ;; command that are not declarations, definition or goal starters
 (defvar coq-other-commands-db
@@ -614,7 +617,7 @@ so for the following reasons:
     ("Local Arguments" nil "Local Arguments @{id} : @{rule}" t 
"Local\\s-+Arguments")
     ("Arguments" "args" "Arguments @{id} : @{rule}" t "Arguments")
     ("Bind Scope" "bndsc" "Bind Scope @{scope} with @{type}" t 
"Bind\\s-+Scope")
-    ("Canonical Structure" nil "Canonical Structure #." t 
"Canonical\\s-+Structure")
+    ("Canonical" nil "Canonical #." t "Canonical")
     ("Cd" nil "Cd #." nil "Cd")
     ("Local Close Scope" "lclsc" "Local Close Scope #" t 
"Local\\s-+Close\\s-+Scope")
     ("Close Scope" "clsc" "Close Scope #" t "Close\\s-+Scope")
@@ -633,6 +636,7 @@ so for the following reasons:
     ("Extraction Library" "extrl" "Extraction Library @{id}." nil 
"Extraction\\s-+Library")
     ("Extraction" "extr" "Extraction @{id}." nil "Extraction")
     ("Focus" nil "Focus #." nil "Focus")
+    ("From" nil "From #." nil "From")
     ("Generalizable Variables" nil "Generalizable Variables #." t 
"Generalizable\\s-+Variables")
     ("Generalizable All Variables" nil "Generalizable All Variables." t 
"Generalizable\\s-+All\\s-+Variables")
     ("Identity Coercion" nil "Identity Coercion #." t "Identity\\s-+Coercion")
@@ -736,7 +740,7 @@ so for the following reasons:
     ("Set Primitive Projections" nil "Set Primitive Projections" t "Set 
Primitive\\s-+Projections")
     ("Set Printing All" nil "Set Printing All" t "Set\\s-+Printing\\s-+All")
     ("Set Printing Coercions" nil "Set Printing Coercions" t 
"Set\\s-+Printing\\s-+Coercions")
-    ("Set Printing Compact Contexts" nil "Set Printing Compact Contexts" t 
"Set\\s-+Printing\\s-+Compact\\s-+Contexts")
+    ("Set Printing Compact Contexts" nil "set Printing Compact Contexts" t 
"set\\s-+Printing\\s-+Compact\\s-+Contexts")
     ("Set Printing Depth" nil "Set Printing Depth" t 
"Set\\s-+Printing\\s-+Depth")
     ("Set Printing Existential Instances" nil "Set Printing Existential 
Instances" t "Set\\s-+Printing\\s-+Existential\\s-+Instances")
     ("Set Printing Goal Tags" nil "Set Printing Goal Tags" t 
"Set\\s-+Printing\\s-+Goal\\s-+Tags")
@@ -864,7 +868,8 @@ so for the following reasons:
     ("Unset Parsing Explicit" nil "Unset Parsing Explicit" t "Unset 
Parsing\\s-+Explicit")
     ("Unset Primitive Projections" nil "Unset Primitive Projections" t "Unset 
Primitive\\s-+Projections")
     ("Unset Printing All" nil "Unset Printing All" t "Unset Printing\\s-+All")
-    ("Unset Printing Coercions" nil "Unset Printing Coercions" t "Unset 
Printing\\s-+Coercions")
+    ("Unset Printing Coercions" nil "Unset Printing Coercions" t 
"Unset\\s-+Printing\\s-+Coercions")
+    ("Unset Printing Compact Contexts" nil "Unset Printing Compact Contexts" t 
"Unset\\s-+Printing\\s-+Compact\\s-+Contexts")
     ("Unset Printing Depth" nil "Unset Printing Depth" t "Unset 
Printing\\s-+Depth")
     ("Unset Printing Existential Instances" nil "Unset Printing Existential 
Instances" t "Unset Printing\\s-+Existential\\s-+Instances")
     ("Unset Printing Implicit" nil "Unset Printing Implicit" t "Unset 
Printing\\s-+Implicit")
@@ -955,7 +960,7 @@ so for the following reasons:
     ("forall (4 args)" "fo4" "forall (#:#) (#:#) (#:#) (#:#), #")
     ("if" "if" "if # then # else #" nil "if")
     ("let in" "li" "let # := # in #" nil "let")
-    ("match! (from type)" nil "" nil "match" coq-insert-match)
+    ("match?" nil "" nil "match" coq-insert-match)
     ("match with" "m" "match # with\n| # => #\nend")
     ("match with 2" "m2" "match # with\n| # => #\n| # => #\nend")
     ("match with 3" "m3" "match # with\n| # => #\n| # => #\n| # => #\nend")
@@ -1105,6 +1110,31 @@ It is used:
              (not (string-match 
"\\`Proof\\s-*\\(\\.\\|\\_<with\\_>\\|\\_<using\\_>\\)" str))))))
 
 
+;; ----- regular expressions for the proof omit feature
+;; see `proof-omit-proofs-configured' in generic/proof-config
+
+(defcustom coq-proof-start-regexp "^Proof\\(\\.\\| \\)"
+  "Value for `proof-script-proof-start-regexp'."
+  :type 'regexp
+  :group 'coq)
+
+(defcustom coq-proof-end-regexp "^\\(Qed\\|Admitted\\)\\."
+  "Value for `proof-script-proof-end-regexp'.
+This is similar to `coq-save-command-regexp-strict' but slightly
+different."
+  :type 'regexp
+  :group 'coq)
+
+(defcustom coq-definition-end-regexp "^\\(Defined\\|Abort\\)\\(\\.\\| \\)"
+  "Value for `proof-script-definition-end-regexp'."
+  :type 'regexp
+  :group 'coq)
+  
+(defcustom coq-omit-proof-admit-command "Admitted."
+  "Value for `proof-script-proof-admit-command'."
+  :type 'string
+  :group 'coq)
+
 ;; ----- keywords for font-lock.
 
 (defvar coq-keywords-kill-goal
@@ -1172,7 +1202,7 @@ It is used:
   (append
    '(
      "False" "True" "after" "as" "cofix" "fix" "forall" "fun" "match"
-     "lazymatch" "multimatch"
+     "lazymatch" "multimatch" "lazy_match" "multi_match"
      "return" "struct" "else" "end" "if" "in" "into" "let" "then"
      "using" "with" "beta" "delta" "iota" "zeta" "after" "until"
      "at" "Sort" "Time" "dest" "where"
@@ -1219,6 +1249,9 @@ It is used:
 (defun coq--regexp-alt-list-symb (args)
   (concat "\\_<\\(?:" (mapconcat #'identity args "\\|") "\\)\\_>"))
 
+(defun coq--regexp-alt-list (args)
+  (concat "\\(?:" (mapconcat #'identity args "\\|") "\\)"))
+
 (defvar coq-keywords-regexp (coq--regexp-alt-list-symb coq-keywords))
 
 
@@ -1251,8 +1284,37 @@ It is used:
 
 (defvar coq-symbols-regexp (regexp-opt coq-symbols))
 
+;; HACKISH: This string matches standard error regexp UNLESS there is
+;; the standard header of the "Fail" command (which is "The command
+;; blah has indeed failed with message:\n"). The case where the error
+;; header has nothing before it is treated using "empty string at
+;; start" regexp. BUT coq-error-regexp (and hence
+;; proof-shell-error-regexp) must be correct either when searching in
+;; a string or when searching in the proof-shell-buffer when point is
+;; at the start of the last output. Hence when we use \\` (empty
+;; string at start of the string) we should also accept \\= (empty
+;; string at point).
+(defvar coq--prefix-not-regexp 
"\\(\\(\\`\\|\\=\\)\n?\\)\\|\\(?:\\(?:[^:]\\|[^e]:\\|[^g]e:\\|[^a]ge:\\|[^s]age:\\|[^s]sage:\\|[^e]ssage:\\|[^m]essage:\\)\n\\)"
+  "A regexp matching allowed text before coq error.")
+
+(defvar coq--error-header-re-list
+  '("In nested Ltac call"
+    "Discarding pattern"
+    "Syntax error:"
+    "System Error:"
+    "User Error:"
+    "User error:"
+    "Anomaly[:.]"
+    "Toplevel input"
+    "\\<Error:")
+  "A list of regexps matching coq error headers.")
+
+(defvar coq--raw-error-regexp (coq--regexp-alt-list coq--error-header-re-list))
+
 ;; ----- regular expressions
-(defvar coq-error-regexp "^\\(In nested Ltac call\\|Error:\\|Discarding 
pattern\\|Syntax error:\\|System Error:\\|User Error:\\|User 
error:\\|Anomaly[:.]\\|Toplevel input[,]\\)"
+;; ignore "Error:" if preceded by \n[ ^]+\n
+(defvar coq-error-regexp
+  (concat "\\(?:" coq--prefix-not-regexp "\\)" coq--raw-error-regexp)
   "A regexp indicating that the Coq process has identified an error.")
 
 ;; april2017: coq-8.7 removes special chars definitely and puts
@@ -1273,6 +1335,10 @@ It is used:
 (defun coq-first-abstr-regexp (paren end)
   (concat paren "\\s-*\\(" coq-ids "\\)\\s-*" end))
 
+(defun coq-first-abstr-without-space-regexp (paren end)
+  "Variant of `coq-first-abstr-regexp' without space between PAREN & 
`coq-ids'."
+  (concat paren "\\(" coq-ids "\\)\\s-*" end))
+
 (defcustom coq-variable-highlight-enable t
   "Activates partial bound variable highlighting."
   :type 'boolean
@@ -1307,7 +1373,10 @@ It is used:
       ;;               (list 0 font-lock-variable-name-face)))
       ;; parenthesized binders
       (list (coq-first-abstr-regexp "(" ":[ a-zA-Z]") 1 
'font-lock-variable-name-face)
-      (list (coq-first-abstr-regexp "{" ":[ a-zA-Z]") 1 
'font-lock-variable-name-face)
+      ;; Don't use coq-first-abstr-regexp here, see ProofGeneral/PG#581:
+      (list (coq-first-abstr-without-space-regexp "{" ":[ a-zA-Z]") 1 
'font-lock-variable-name-face)
+      ;; Likewise, for 
https://coq.github.io/doc/V8.12.0/refman/language/extensions/implicit-arguments.html#implicit-argument-binders
 :
+      (list (coq-first-abstr-without-space-regexp "\\[" ":[ a-zA-Z]") 1 
'font-lock-variable-name-face)
       )))
   "*Font-lock table for Coq terms.")
 
@@ -1344,6 +1413,15 @@ It is used:
   (concat "\\(" (mapconcat #'identity coq-keywords-defn "\\|")
           "\\)\\s-+\\(" coq-id "\\)"))
 
+;; Any command can be prefixed with Local, Global of #[anyhting,anything,...]
+(defconst coq-command-prefix-regexp 
"\\(Local\\s-\\|Global\\s-\\|#[[][^]]*[]]\\)")
+;; FIXME: incomplete
+
+(defun coq-add-command-prefix (reg) (concat "\\(" coq-command-prefix-regexp 
"\\)?" (mapconcat #'identity reg "\\|")))
+
+(defconst coq-command-decl-regexp (coq-add-command-prefix coq-keywords-decl))
+(defconst coq-command-defn-regexp (coq-add-command-prefix coq-keywords-defn))
+
 ;; must match:
 ;; "with f x y :" (followed by = or not)
 ;; "with f x y (z:" (not followed by =)
diff --git a/coq/coq-system.el b/coq/coq-system.el
index 5b530e45cc..d32629f289 100644
--- a/coq/coq-system.el
+++ b/coq/coq-system.el
@@ -3,7 +3,7 @@
 ;; This file is part of Proof General.
 
 ;; Portions © Copyright 1994-2012  David Aspinall and University of Edinburgh
-;; Portions © Copyright 2003-2018  Free Software Foundation, Inc.
+;; Portions © Copyright 2003-2021  Free Software Foundation, Inc.
 ;; Portions © Copyright 2001-2017  Pierre Courtieu
 ;; Portions © Copyright 2010, 2016  Erik Martin-Dorel
 ;; Portions © Copyright 2011-2013, 2016-2017  Hendrik Tews
@@ -12,7 +12,7 @@
 ;; Authors: Hendrik Tews, Pierre Courtieu
 ;; Maintainer: Pierre.Courtieu<Pierre.Courtieu@cnam.fr>
 
-;; License:     GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
@@ -123,7 +123,6 @@ This function supports calling coqtop via tramp."
           (if (or (not expectedretv) (equal retv expectedretv))
               (buffer-string)))
       (error nil))))
-        
 
 (defun coq-autodetect-version (&optional interactive-p)
   "Detect and record the version of Coq currently in use.
@@ -131,16 +130,17 @@ Interactively (with INTERACTIVE-P), show that number."
   (interactive '(t))
   (setq coq-autodetected-version nil)
   (let* ((str (coq-callcoq "-v" 0))
-         (mtch (and str (string-match "version \\([^ ]+\\)" str))))
+         (mtch (and str (string-match "version \\([^ \n]+\\)" str))))
     (when mtch
       (setq coq-autodetected-version (match-string 1 str))))
   (when interactive-p (coq-show-version))
   coq-autodetected-version)
 
-(defun coq-autodetect-help (&optional interactive-p)
-  "Record the output of coqotp -help in `coq-autodetected-help'."
+(defun coq-autodetect-help (&optional _interactive-p)
+  "Record the output of coqtop -help in `coq-autodetected-help'."
   (interactive '(t))
-  (setq coq-autodetected-help (coq-callcoq "-help")))
+  (let ((coq-output (coq-callcoq "-help")))
+    (setq coq-autodetected-help (or coq-output ""))))
 
 
 (defun coq--version< (v1 v2)
@@ -485,13 +485,13 @@ path (including the -R lib options) (see 
`coq-load-path')."
 
 (defcustom coq-project-filename "_CoqProject"
   "The name of coq project file.
-The coq project file of a coq developpement (cf. Coq documentation on
+The coq project file of a coq development (cf. Coq documentation on
 \"makefile generation\") should contain the arguments given to
 coq_makefile. In particular it contains the -I and -R
 options (preferably one per line).  If `coq-use-coqproject' is
-t (default) the content of this file will be used by proofgeneral to
+t (default) the content of this file will be used by Proof General to
 infer the `coq-load-path' and the `coq-prog-args' variables that set
-the coqtop invocation by proofgeneral.  This is now the recommended
+the coqtop invocation by Proof General.  This is now the recommended
 way of configuring the coqtop invocation.  Local file variables may
 still be used to override the coq project file's configuration.
 .dir-locals.el files also work and override project file settings."
@@ -649,27 +649,27 @@ Does nothing if `coq-use-project-file' is nil."
 ;; need to make this hook local.
 ;; hack-local-variables-hook seems to hack local and dir local vars.
 (add-hook 'coq-mode-hook
-          '(lambda ()
-             (add-hook 'hack-local-variables-hook
-                       'coq-load-project-file
-                       nil t)))
+          (lambda ()
+            (add-hook 'hack-local-variables-hook
+                      #'coq-load-project-file
+                      nil t)))
 
 ; detecting coqtop args should happen at the last moment before
 ; calling the process. In particular it should ahppen after that
 ; proof-prog-name-ask is performed, this hook is at the right place.
 (add-hook 'proof-shell-before-process-hook
-          '(lambda ()
-             ;; It seems coq-prog-name and proof-prog-name are not correctly 
linked
-             ;; so let us make sure they are the same before computing options
-             (setq coq-prog-name proof-prog-name)
-             (setq coq-prog-args (coq-prog-args))))
+          (lambda ()
+            ;; It seems coq-prog-name and proof-prog-name are not correctly 
linked
+            ;; so let us make sure they are the same before computing options
+            (setq coq-prog-name proof-prog-name)
+            (setq coq-prog-args (coq-prog-args))))
 
 ;; smie's parenthesis blinking is too slow, let us have the default one back
 (add-hook 'coq-mode-hook
-          '(lambda ()
-             (when (and (fboundp 'show-paren--default)
-                        (boundp 'show-paren-data-function))
-               (setq show-paren-data-function 'show-paren--default))))
+          (lambda ()
+            (when (and (fboundp 'show-paren--default)
+                       (boundp 'show-paren-data-function))
+              (setq show-paren-data-function #'show-paren--default))))
 
 
 
diff --git a/coq/coq-unicode-tokens.el b/coq/coq-unicode-tokens.el
index 349038c152..c4a26b7bab 100644
--- a/coq/coq-unicode-tokens.el
+++ b/coq/coq-unicode-tokens.el
@@ -1,9 +1,9 @@
-;;; coq-unicode-tokens.el --- (No) Tokens for Unicode Tokens package -*- 
coding: utf-8; -*-
+;;; coq-unicode-tokens.el --- (No) Tokens for Unicode Tokens package -*- 
coding: utf-8; lexical-binding: t; -*-
 
 ;; This file is part of Proof General.
 
 ;; Portions © Copyright 1994-2012  David Aspinall and University of Edinburgh
-;; Portions © Copyright 2003, 2012, 2014  Free Software Foundation, Inc.
+;; Portions © Copyright 2003-2021  Free Software Foundation, Inc.
 ;; Portions © Copyright 2001-2017  Pierre Courtieu
 ;; Portions © Copyright 2010, 2016  Erik Martin-Dorel
 ;; Portions © Copyright 2011-2013, 2016-2017  Hendrik Tews
@@ -169,7 +169,7 @@ The string mapping can be anything, but should be such that
 tokens can be uniquely recovered from a decoded text; otherwise
 results will be undefined when files are saved."
   :type 'unicode-tokens-token-symbol-map
-  :set 'coq-unicode-tokens-set
+  :set #'coq-unicode-tokens-set
   :group 'coq
   :tag "Coq Unicode Token Mapping")
 
@@ -253,7 +253,7 @@ performed.  This means that the target strings need to have 
a defined
 meaning to be useful."
   :type '(repeat (cons (string :tag "Shortcut sequence")
                       (string :tag "Unicode string")))
-  :set 'coq-unicode-tokens-set
+  :set #'coq-unicode-tokens-set
   :group 'coq
   :tag "Coq Unicode Input Shortcuts")
 
@@ -275,7 +275,7 @@ meaning to be useful."
     ("Superscript" "^^" sup)))
 
 ;(defconst coq-control-region-format-regexp 
"\\(\s*%s\{\\)\\([^}]*\\)\\(\}\s*\\)")
-(defconst coq-control-region-format-regexp "\\(%s\{\\)\\([^}]*\\)\\(\}\\)")
+(defconst coq-control-region-format-regexp "\\(%s{\\)\\([^}]*\\)\\(}\\)")
 
 (defconst coq-control-regions
   '(("Subscript" "," "" sub)
diff --git a/coq/coq.el b/coq/coq.el
index 7fe6e0d5c2..93cc934fc1 100644
--- a/coq/coq.el
+++ b/coq/coq.el
@@ -1,9 +1,9 @@
-;;; coq.el --- Major mode for Coq proof assistant  -*- coding: utf-8 -*-
+;;; coq.el --- Major mode for Coq proof assistant  -*- coding: utf-8; 
lexical-binding: t; -*-
 
 ;; This file is part of Proof General.
 
 ;; Portions © Copyright 1994-2012  David Aspinall and University of Edinburgh
-;; Portions © Copyright 2003-2018  Free Software Foundation, Inc.
+;; Portions © Copyright 2003-2021  Free Software Foundation, Inc.
 ;; Portions © Copyright 2001-2017  Pierre Courtieu
 ;; Portions © Copyright 2010, 2016  Erik Martin-Dorel
 ;; Portions © Copyright 2011-2013, 2016-2017  Hendrik Tews
@@ -12,7 +12,7 @@
 ;; Authors: Healfdene Goguen, Pierre Courtieu
 ;; Maintainer: Pierre Courtieu <Pierre.Courtieu@cnam.fr>
 
-;; License:     GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
@@ -91,31 +91,41 @@ These are appended at the end of `coq-shell-init-cmd'."
 ;; Default coq is only Private_ and _subproof
 (defcustom coq-search-blacklist-string ; add this? \"_ind\" \"_rect\" \"_rec\"
  "\"Private_\" \"_subproof\""
-  "String for blacklisting strings from requests to Coq environment."
+  "Initial strings to blacklist in requests to Coq environment.
+If you are setting this via emacs cutomization menus, you should
+restart Coq to see the effect. To change blacklist during a coq
+development, please use \\[coq-change-search-blacklist-interactive]
+instead (or menu: Coq/Settings/Search Blacklist)."
   :type 'string
   :group 'coq)
 
+;; Coq has no command to overwrite the current blacklist, only to add or remove
+;; particular strings. To provide the overwrite feature to the user we thus 
need
+;; to know the current value of blacklist to first remove everything, then add
+;; the new values.
+;;; TODO: retrieve the value from coq itself and remove this variable?
+(defvar coq-search-blacklist-current-string coq-search-blacklist-string
+  "Current value of Coq Search Blacklist.
+This may become desynchronized with Coq if you use the command
+\"Add/Remove Search Blacklist\" in you script." )
+
 (defcustom coq-prefer-top-of-conclusion nil
   "Prefer start of the conclusion over its end when displaying large goals.
 Namely, goals that do not fit in the goals window."
   :type 'boolean
   :group 'coq)
 
-;; this remembers the previous value of coq-search-blacklist-string, so that we
-;; can cook a remove+add blacklist command each time the variable is changed.
-;; initially we put it at current value of coq-search-blacklist-string.
-(defvar coq-search-blacklist-string-prev coq-search-blacklist-string)
 
-;TODO: remove Set Undo xx. It is obsolete since coq-8.5 at least.
-;;`(,(format "Set Undo %s . " coq-default-undo-limit) "Set Printing Width 75.")
 (defconst coq-shell-init-cmd
-  (append `(,(format "Add Search Blacklist %s. " coq-search-blacklist-string))
-          '("Set Suggest Proof Using. ")
-          coq-user-init-cmd)
- "Command to initialize the Coq Proof Assistant.")
-
+  (append
+   `(
+     ;; Should this variable be buffer-local? No opinion on that but if yes we
+     ;; should re-intialize to coq-search-blacklist-string instead of
+     ;; keeping the current value (that may come from another file).
+     ,(format "Add Search Blacklist %s. " coq-search-blacklist-current-string))
+   '("Set Suggest Proof Using. ") coq-user-init-cmd)
+  "Command to initialize the Coq Proof Assistant.")
 
-(require 'coq-syntax)
 ;; FIXME: Even if we don't use coq-indent for indentation, we still need it for
 ;; coq-script-parse-cmdend-forward/backward and coq-find-real-start.
 (require 'coq-indent)
@@ -369,7 +379,7 @@ that should maybe not be classified as urgent messages.")
   "Find forward the next really urgent message.
 Return the position of the beginning of the message (after the
 annotation-start) if found."
-  (let ((again t) (found nil) (start-start nil) (end-end nil)
+  (let ((again t) (start-start nil) (end-end nil) ;; (found nil)
         (eager proof-shell-eager-annotation-start))
     (while again
       (setq start-start (and (re-search-forward eager nil 'limit)
@@ -446,14 +456,12 @@ This is a subroutine of `proof-shell-filter'."
     (min end
          (save-excursion (end-of-line) (point))
          (+ start 75))))
-  (let*
-      ((face
-        (progn (goto-char start)
-               (if (looking-at "<infomsg>") 'default
-                 'proof-eager-annotation-face)))
-       (str (proof-shell-strip-eager-annotations start end))
-       (strnotrailingspace
-        (coq-remove-starting-blanks (coq-remove-trailing-blanks str))))
+  (goto-char start)
+  (let* (;; (face (if (looking-at "<infomsg>") 'default
+         ;;         'proof-eager-annotation-face))
+         (str (proof-shell-strip-eager-annotations start end))
+         (strnotrailingspace
+          (coq-remove-starting-blanks (coq-remove-trailing-blanks str))))
     (pg-response-display-with-face strnotrailingspace))) ; face
 
 
@@ -696,7 +704,7 @@ If locked span already has a state number, then do nothing. 
Also updates
       ;; processed externally (i.e. Require, etc), nothing to do
       ;; (should really be unlocked when we undo the Require).
       nil
-    (let* ((naborts 0)
+    (let* (;; (naborts 0)
            (proofdepth (coq-get-span-proofnum span))
            (proofstack (coq-get-span-proofstack span))
            (span-staten (coq-get-span-statenum span))
@@ -720,7 +728,7 @@ If locked span already has a state number, then do nothing. 
Also updates
     (cons 'goal (int-to-string coq-current-goal)))
    ((looking-at "\\(?:sub\\)?goal \\([0-9]+\\) is:\n")
     (goto-char (match-end 0))
-    (cons 'goal (match-string 1))       ;FIXME: This is dead-code!?  --Stef
+    ;; (cons 'goal (match-string 1)) ;FIXME: This is dead-code!?  --Stef
     (setq coq-current-goal (string-to-number (match-string 1))))
    ((proof-looking-at proof-shell-assumption-regexp)
     (cons 'hyp (match-string 1)))
@@ -775,15 +783,13 @@ the *goals* buffer."
         (completing-read "Infos on notation (TAB to see list): "
                          notation-print-kinds-table))
        (s (read-string  "Name (empty for all): "))
-       (all (string-equal s "")))
+       ;; (all (string-equal s ""))
+       )
     (cond
      ((and (string-equal mods "Print Scope(s)") (string-equal s ""))
       (proof-shell-invisible-command (format "Print Scopes.")))
      (t
-      (proof-shell-invisible-command (format "%s %s ." mods s)))
-     )
-    )
-  )
+      (proof-shell-invisible-command (format "%s %s ." mods s))))))
 
 (defun coq-remove-trailing-dot (s)
   "Return the string S without its trailing \".\" if any.
@@ -943,11 +949,13 @@ the time of writing this documentation)."
                         'waitforit  nil 'no-response-display 
'empty-action-list))))
 
 (defun coq-ask-do-set-unset (ask do setcmd unsetcmd
-                                 &optional dontguess postformatcmd tescmd)
+                                 &optional dontguess postformatcmd _tescmd)
   "Ask for an ident id and execute command DO in SETCMD mode.
 More precisely it executes SETCMD, then DO id and finally silently
 UNSETCMD.  See `coq-command-with-set-unset'."
-  (let* ((cmd) (postform (if (eq postformatcmd nil) 'identity postformatcmd 
tescmd)))
+  (let* ((cmd)
+         ;; (postform (if (eq postformatcmd nil) 'identity postformatcmd 
tescmd))
+         )
     (proof-shell-ready-prover)
     (setq cmd (coq-guess-or-ask-for-string ask dontguess))
     (coq-command-with-set-unset setcmd (concat do " " cmd) unsetcmd 
postformatcmd)))
@@ -1164,9 +1172,6 @@ Printing All set."
   (interactive)
   (coq-ask-do-show-all "Show goal number" "Show" t))
 
-;; Check
-(defvar coq-auto-adapt-printing-width); defpacustom
-
 ;; Since Printing Width is a synchronized option in coq (?) it is retored
 ;; silently to a previous value when retracting. So we reset the stored width
 ;; when retracting, so that it will be auto-adapted at the next command. Not
@@ -1174,15 +1179,18 @@ Printing All set."
 
 ;; FIXME: hopefully this will eventually become a non synchronized option and
 ;; we can remove this.
-(defun coq-set-auto-adapt-printing-width (&optional symb val); args are for 
:set compatibility
-  "Function called when setting `auto-adapt-printing-width'."
-  (setq symb val) ;; FIXME this is wrong (it should be 'set', but it would set 
nil sometimes)
-  (if coq-auto-adapt-printing-width
-      (progn
-        (add-hook 'proof-assert-command-hook #'coq-adapt-printing-width)
-        (add-hook 'proof-retract-command-hook #'coq-reset-printing-width))
-    (remove-hook 'proof-assert-command-hook #'coq-adapt-printing-width)
-    (remove-hook 'proof-retract-command-hook #'coq-reset-printing-width)))
+;; This obeyx coq-auto-adapt-printing-width
+(add-hook 'proof-assert-command-hook #'coq-adapt-printing-width)
+(add-hook 'proof-retract-command-hook #'coq-reset-printing-width)
+
+(defun coq--show-proof-stepwise-cmds ()
+  (when coq-show-proof-stepwise
+    (if (coq--post-v811)
+        (pcase coq-diffs
+          ('off     '("Show Proof."))
+          ('on      '("Show Proof Diffs."))
+          ('removed '("Show Proof Diffs removed.")))
+      '("Show Proof."))))
 
 ;; In case of nested proofs (which are announced as obsolete in future versions
 ;; of coq) Coq does not show the goals of enclosing proof when closing a nested
@@ -1206,34 +1214,17 @@ should match the `coq-show-proof-diffs-regexp'."
      ;; If user issued a printing option then t printing.
      (and (string-match-p "\\(S\\|Uns\\)et\\s-+Printing" cmd)
           (> (length coq-last-but-one-proofstack) 0)))
-    (let ((showlist (list "Show.")))
-      (when coq-show-proof-stepwise
-        (add-to-list 'showlist
-                     (if (coq--post-v811) 
-                     (or
-                      (when (eq coq-diffs 'off) "Show Proof.")
-                      (when (eq coq-diffs 'on) "Show Proof Diffs.")
-                      (when (eq coq-diffs 'removed) "Show Proof Diffs 
removed."))
-                     "Show Proof.")
-                     t))
-      showlist))
+    `("Show."
+      . ,(coq--show-proof-stepwise-cmds)))
    
    ((or
      ;; If we go back in the buffer and the number of abort is less than
      ;; the number of nested goals, then Unset Silent and Show the goal
      (and (string-match-p "BackTo\\s-" cmd)
           (> (length coq-last-but-one-proofstack) coq--retract-naborts)))
-    (let ((showlist (list "Unset Silent." (if (coq--post-v810) (coq-diffs) 
"Show."))))
-      (when coq-show-proof-stepwise
-        (add-to-list 'showlist
-                     (if (coq--post-v811) 
-                     (or
-                      (when (eq coq-diffs 'off) "Show Proof.")
-                      (when (eq coq-diffs 'on) "Show Proof Diffs." )
-                      (when (eq coq-diffs 'removed) "Show Proof Diffs 
removed."))
-                     "Show Proof.")
-                     t))
-      showlist))
+    `("Unset Silent."
+      ,(if (coq--post-v810) (coq-diffs) "Show.")
+      . ,(coq--show-proof-stepwise-cmds)))
 
    ((or
      ;; If we go back in the buffer and not in the above case, then only Unset
@@ -1248,15 +1239,10 @@ should match the `coq-show-proof-diffs-regexp'."
      ;; If doing (not closing) a proof, Show Proof if need be
      (and (not (string-match-p coq-save-command-regexp-strict cmd))
           (> (length coq-last-but-one-proofstack) 0)))
-    (when coq-show-proof-stepwise
-      (if (coq--post-v811) 
-      (or
-       (when (eq coq-diffs 'off) (list "Show Proof." ))
-       (when (eq coq-diffs 'on) (list "Show Proof Diffs."))
-       (when (eq coq-diffs 'removed) (list "Show Proof Diffs removed.")))
-       (list "Show Proof."))))))
-
+    (coq--show-proof-stepwise-cmds))))
 
+;; This does not Set Printing Width, it rather tells pg to do that before each
+;; command (if necessary)
 (defpacustom auto-adapt-printing-width t
   "If non-nil, adapt automatically printing width of goals window.
 Each time the user sends a bunch of commands to Coq, check if the
@@ -1266,17 +1252,7 @@ is chosen arbitrarily.  WARNING 2: when backtracking the 
printing
 width is synchronized by coq (?!)."
   :type 'boolean
   :safe 'booleanp
-  :group 'coq
-  :eval (coq-set-auto-adapt-printing-width))
-
-
-;; defpacustom fails to call :eval during inititialization, see trac #456
-(coq-set-auto-adapt-printing-width)
-
-;; this initiates auto adapt printing width at start, by reading the config
-;; var. Let us put this at the end of hooks to have a chance to read local
-;; variables first.
-(add-hook 'coq-mode-hook #'coq-auto-adapt-printing-width t)
+  :group 'coq)
 
 (defvar coq-shell-current-line-width nil
   "Current line width of the Coq printing width.
@@ -1292,11 +1268,11 @@ necessary.")
   "Return the width of a window currently displaying BUFFER."
   (let*
       ((buf-wins (get-buffer-window-list buffer nil t))
-       (dummy (if (not (eq 1 (length buf-wins)))
-                  (display-warning
-                   'proof-general
-                   "Zero or more than one goals window, guessing window width."
-                   :debug)))
+       (_ (if (not (eq 1 (length buf-wins)))
+              (display-warning
+               'proof-general
+               "Zero or more than one goals window, guessing window width."
+               :debug)))
        (buf-win (car buf-wins)));; TODO return the widest one instead of the 
first?
     ;; return nil if no goal buffer found
     (and buf-win (window-width buf-win))))
@@ -1311,7 +1287,7 @@ necessary.")
   "Return the probable width of goals buffer if it pops up now.
 This is a guess based on the current width of goals buffer if
 present, current pg display mode and current geometry otherwise."
-  (let (pol (proof-guess-3win-display-policy proof-three-window-mode-policy))
+  (let ((pol (proof-guess-3win-display-policy proof-three-window-mode-policy)))
     (cond
      ;; goals buffer is visible, bingo
      ((coq-goals-window-width))
@@ -1339,16 +1315,17 @@ present, current pg display mode and current geometry 
otherwise."
 A Show command is also issued if SHOW is non-nil, so that the goal is
 redisplayed."
   (interactive)
-  (let ((wdth (or width (coq-guess-goal-buffer-at-next-command))))
-    ;; if no available width, or unchanged, do nothing
-    (when (and wdth (not (equal wdth coq-shell-current-line-width)))
-      (proof-shell-invisible-command (format "Set Printing Width %S." (- wdth 
1)) t)
-      (setq coq-shell-current-line-width wdth)
-      ;; Show iff show non nil and some proof is under way
-      (when (and show (not (null (cl-caddr (coq-last-prompt-info-safe)))))
-        (proof-shell-invisible-command (format "Show.") t nil 
'no-error-display)))))
-
-(defun coq-adapt-printing-width-and-show(&optional show width)
+  (when coq-auto-adapt-printing-width
+    (let ((wdth (or width (coq-guess-goal-buffer-at-next-command))))
+      ;; if no available width, or unchanged, do nothing
+      (when (and wdth (not (equal wdth coq-shell-current-line-width)))
+        (proof-shell-invisible-command (format "Set Printing Width %S." (- 
wdth 1)) t)
+        (setq coq-shell-current-line-width wdth)
+        ;; Show iff show non nil and some proof is under way
+        (when (and show (not (null (cl-caddr (coq-last-prompt-info-safe)))))
+          (proof-shell-invisible-command (format "Show.") t nil 
'no-error-display))))))
+
+(defun coq-adapt-printing-width-and-show (&optional _show width)
   (interactive)
   (coq-adapt-printing-width t width))
 
@@ -1405,13 +1382,13 @@ Maintained by a hook in 
`proof-shell-handle-delayed-output-hook'.")
   (propertize
    "-"
    'face 'coq-button-face
-   'mouse-face 'coq-button-face-pressed))
+   'mouse-face 'coq-button-face-active))
 
 (defun coq-hypcross-folded-string()
   (propertize
    "+"
-   'face 'coq-button-face
-   'mouse-face 'coq-button-face-pressed))
+   'face 'coq-button-face-pressed
+   'mouse-face 'coq-button-face-active))
 
 ;; hypcross is displayerd with a "-" when unfolded and a "+" when unfolded.
 ;; It is highlighted when hovered, is clickable and have a special
@@ -1432,7 +1409,7 @@ Maintained by a hook in 
`proof-shell-handle-delayed-output-hook'.")
       ;(overlay-put ov 'width .6)
       ;(overlay-put ov 'height -1)
       (when (eq coq-hypcross-hovering-help t)
-        (overlay-put ov 'help-echo "mouse-3: unfold; mouse-2 copy name")))
+        (overlay-put ov 'help-echo "MOUSE-1: (un)fold ; MOUSE-2 copy hyp name 
at point")))
     ov))
 
 ;; Once we have created the 3 overlays, each recieves a reference to the 2
@@ -1652,7 +1629,8 @@ See  `coq-highlight-hyp'."
     (insert hyp-name)))
 
 ;;;;;;;;;;; Hiding Hypothesis  ;;;;;;;;;;;
-(defvar coq-hidden-hyp-map (make-sparse-keymap) "Keymap for hidden 
hypothesis.")
+(defvar coq-hidden-hyp-map (make-sparse-keymap)
+  "Keymap for hidden hypothesis.")
 
 (defvar coq-hidden-hyps nil
   "List of hypothesis that should be hidden in goals buffer.
@@ -1693,19 +1671,20 @@ Used on hyptohesis overlays in goals buffer mainly."
        )
       (overlay-put hyp-overlay 'evaporate t)
       (overlay-put hyp-overlay 'mouse-face 'proof-command-mouse-highlight-face)
-      (overlay-put hyp-overlay 'help-echo "mouse-3: unfold; mouse-2 copy name")
+      (overlay-put hyp-overlay 'help-echo "MOUSE-1: unfold; MOUSE-2 copy name 
at point")
       (overlay-put hyp-overlay 'hyp-name h)
       (overlay-put hyp-overlay 'keymap coq-hidden-hyp-map)
       (overlay-put hypcross-ov 'display (coq-hypcross-folded-string)))))
 
-(defun coq-configure-hyp-overlay-visible (hyp-overlay h)
+(defun coq-configure-hyp-overlay-visible (hyp-overlay _h)
   (when hyp-overlay
     (overlay-put hyp-overlay 'display nil)
     (overlay-put hyp-overlay 'evaporate t)
     (overlay-put hyp-overlay 'mouse-face nil)
     (overlay-put hyp-overlay 'help-echo nil)
     (overlay-put hyp-overlay 'keymap nil)
-    (overlay-put (overlay-get hyp-overlay 'hypcross-ov) 'display 
(coq-hypcross-unfolded-string))))
+    (overlay-put (overlay-get hyp-overlay 'hypcross-ov)
+                 'display (coq-hypcross-unfolded-string))))
 
 (defun coq-fold-hyp-aux (h)
   "Fold hypothesis H's type from the context temporarily.
@@ -1901,7 +1880,7 @@ at `proof-assistant-settings-cmds' evaluation time.")
   (setq proof-terminal-string ".")
   ;; superseded by coq-script-parse-function
   ;;(setq proof-script-command-end-regexp coq-script-command-end-regexp)
-  (setq proof-script-parse-function 'coq-script-parse-function)
+  (setq proof-script-parse-function #'coq-script-parse-function)
   (setq proof-script-comment-start comment-start)
   (setq proof-script-comment-end comment-end)
   (setq proof-script-insert-newlines nil)
@@ -1967,6 +1946,14 @@ at `proof-assistant-settings-cmds' evaluation time.")
    proof-tree-find-begin-of-unfinished-proof
      'coq-find-begin-of-unfinished-proof)
 
+  ;; proof-omit-proofs config
+  (setq
+   proof-omit-proofs-configured t
+   proof-script-proof-start-regexp coq-proof-start-regexp
+   proof-script-proof-end-regexp coq-proof-end-regexp
+   proof-script-definition-end-regexp coq-definition-end-regexp
+   proof-script-proof-admit-command coq-omit-proof-admit-command)
+
   (setq proof-cannot-reopen-processed-files nil)
 
   (proof-config-done)
@@ -2144,7 +2131,7 @@ Set Diffs setting if Coq is running and has a version >= 
8.10."
     (const :tag "Show diffs: only added" on)
     (const :tag "Show diffs: added and removed" removed))
   :safe (lambda (v) (member v '(off on removed)))
-  :set 'coq-diffs--setter
+  :set #'coq-diffs--setter
   :group 'coq)
 
 ;; Obsolete:
@@ -2153,22 +2140,33 @@ Set Diffs setting if Coq is running and has a version 
>= 8.10."
 ;;  :type 'integer
 ;;  :setting "Set Undo %i . ")
 
-(defun coq-set-search-blacklist (s)
-  (let ((res (format "Remove Search Blacklist %s. \nAdd Search Blacklist %s. "
-          coq-search-blacklist-string-prev s)))
-    (setq coq-search-blacklist-string-prev coq-search-blacklist-string)
-    res))
-
-
-(defun coq-get-search-blacklist (s)
-  coq-search-blacklist-string)
-
+;; Problem if the Remove or Add fails we leave Coq's blacklist in a strange
+;; state: unnoticed by the user, and desynched from
+;; coq-search-blacklist-current-string.
+;; TODO: have a way to detect error and re-set old value.
+(defun coq-change-search-blacklist (s)
+  (let* ((cmd-clean (list (format "Remove Search Blacklist %s."
+                                  coq-search-blacklist-current-string)))
+         (item-clean `(nil ,cmd-clean proof-done-invisible 'invisible))
+         (cmd-set (list (format "Add Search Blacklist %s." s)))
+         (item-set `(nil ,cmd-set proof-done-invisible 'invisible)))
+  (proof-add-to-queue `(,item-clean ,item-set) 'advancing)))
+
+(defun coq-change-search-blacklist-interactive ()
+  (interactive)
+  (proof-shell-ready-prover)
+  (let* ((current-value coq-search-blacklist-current-string)
+         (s (read-string
+             "Set search blacklist to: "
+             current-value 'proof-minibuffer-history)))
+    (coq-change-search-blacklist s)
+    (setq coq-search-blacklist-current-string s)))
 
-(defpacustom search-blacklist coq-search-blacklist-string
-  "Strings to blacklist in requests to Coq environment."
-  :type 'string
-  :get 'coq-get-search-blacklist
-  :setting coq-set-search-blacklist)
+;; (defpacustom search-blacklist coq-search-blacklist-string
+;;   "Strings to blacklist in requests to Coq environment."
+;;   :type 'string
+;;   :get 'coq-get-search-blacklist
+;;   :setting coq-set-search-blacklist)
 
 
 (defpacustom time-commands nil
@@ -2256,14 +2254,13 @@ The not yet delayed output is in the region
           (let ((subgoal-id (match-string-no-properties 1)))
             (unless (gethash subgoal-id proof-tree-sequent-hash)
               ;; (message "CPTGNS new sequent %s found" subgoal-id)
-              (setq proof-action-list
-                    (cons (proof-shell-action-list-item
-                           (coq-show-sequent-command subgoal-id)
-                           (proof-tree-make-show-goal-callback (car 
proof-info))
-                           '(no-goals-display
-                             no-response-display
-                             proof-tree-show-subgoal))
-                          proof-action-list))))))))))
+              (push (proof-shell-action-list-item
+                     (coq-show-sequent-command subgoal-id)
+                     (proof-tree-make-show-goal-callback (car proof-info))
+                     '(no-goals-display
+                       no-response-display
+                       proof-tree-show-subgoal))
+                    proof-action-list)))))))))
 
 (add-hook 'proof-tree-urgent-action-hook #'coq-proof-tree-get-new-subgoals)
 
@@ -2313,7 +2310,7 @@ This is the Coq incarnation of 
`proof-tree-find-undo-position'."
 (defvar coq--proof-tree-must-disable-evars nil
   "Remember if evar printing must be disabled when leaving the current proof.")
 
-(defun coq-proof-tree-enable-evar-callback (span)
+(defun coq-proof-tree-enable-evar-callback (_span)
   "Callback for the evar printing status test.
 This is the callback for the command ``Test Printing Dependent Evars Line''.
 It checks whether evar printing was off and remembers that
@@ -2434,6 +2431,9 @@ This is a hook setting for `pg-after-fontify-output-hook' 
to
 enable identifiers to be highlighted and allow useful
 mouse activation."
   (goto-char (point-min))
+  ;; FIXME: This regexp is obviously wrong.  The backslashes have no effect
+  ;; (for lack of being doubled), so Emacs searches for "(w+[^w])" :-(
+  ;; Also the \w regexp operator cannot be used within a [...] char range.
   (while (re-search-forward "\(\w+[^\w]\)" nil t)
     (replace-match "\372\200\373\\1\374" nil t)))
 
@@ -2442,7 +2442,7 @@ mouse activation."
 ;; Context-senstive in-span menu additions
 ;;
 
-(defun coq-create-span-menu (span idiom name)
+(defun coq-create-span-menu (span idiom _name)
   (if (eq idiom 'proof)
       (let ((thm (span-property span 'name)))
         (list (vector
@@ -2628,7 +2628,7 @@ Warning: this makes the error messages (and location) 
wrong.")
 ;; itself sets the 'dependencies property of the span, and calls
 ;; `proof-dependencies-system-specific'. The latter is bound to
 ;; `coq-dependencies-system-specific' below.
-(setq coq-shell-theorem-dependency-list-regexp
+(defconst coq-shell-theorem-dependency-list-regexp
   "<infomsg>\n?The proof of \\(?1:[^ \n]+\\)\\(?: \\|\n\\)should start with 
one of the following commands:\\(?: \\|\n\\)Proof using\\(?2:[^.]*\\)\\.")
 
 (defcustom coq-accept-proof-using-suggestion 'highlight
@@ -2681,12 +2681,12 @@ Remarks and limitations:
     (let* ((deps (span-property-safe span 'dependencies))
            (specialspans (spans-at-region-prop (span-start span) (span-end 
span) 'proofusing))
            (specialspan (and specialspans (not (cdr specialspans)) (car 
specialspans)))
-           (suggested (mapconcat 'identity deps " "))
+           (suggested (mapconcat #'identity deps " "))
            (suggested (coq-hack-proofusing-suggestion suggested))
            (name (concat " insert \"proof using " suggested "\""))
-           (fn `(lambda (sp)
+           (fn (lambda (sp)
                  (coq-insert-proof-using-suggestion sp t)
-                 (and ,specialspan (span-delete ,specialspan)))))
+                 (and specialspan (span-delete specialspan)))))
       (list "-------------" (vector name `(,fn ,span) t))))
   "Coq specific additional menu entry for \"Proof using\".
 annotation. See `proof-dependency-menu-system-specific'." )
@@ -2703,7 +2703,7 @@ insertion point for the \"using\" annotation. ")
 
 ;; span is typically the whole theorem statement+proof span built after a save
 ;; command
-(defun coq-highlight-span-dependencies (span suggested)
+(defun coq-highlight-span-dependencies (span _suggested)
   (goto-char (span-start span))
   ; Search for the "Proof" command and build a hilighted span on it
   (let* ((endpos (re-search-forward coq-proof-using-regexp))
@@ -2713,17 +2713,15 @@ insertion point for the \"using\" annotation. ")
     (span-set-property newspan 'help-echo "Right click to insert \"proof 
using\"")
     (span-set-property newspan 'proofusing t)))
 
-(defun coq-insert-proof-using (proof-pos previous-content insert-point 
string-suggested)
+(defun coq-insert-proof-using (_proof-pos _previous-content insert-point 
string-suggested)
   (goto-char insert-point)
-  (let ((spl proof-locked-span))
-    (span-read-write spl) ; temporarily make the locked span writable
-    (insert (concat " using " string-suggested))
-    (proof-span-read-only spl)))
+  (let ((proof--inhibit-retract-on-change t))
+    (insert (concat " using " string-suggested))))
 
 (defun coq-insert-suggested-dependency ()
   (interactive)
   (let* ((span (span-at (point) 'type))
-         (deps (span-property-safe span 'dependencies))
+         ;; (deps (span-property-safe span 'dependencies))
          (specialspans (spans-at-region-prop (span-start span) (span-end span) 
'proofusing))
          (specialspan (and specialspans (not (cdr specialspans)) (car 
specialspans))))
     (coq-insert-proof-using-suggestion span t)
@@ -2746,7 +2744,7 @@ SPAN is the span of the whole theorem (statement + 
proof)."
                  (insert-point (match-beginning 1))
                  (previous-string (match-string 1))
                  (previous-content (split-string previous-string))
-                 (string-suggested (mapconcat 'identity suggested " "))
+                 (string-suggested (mapconcat #'identity suggested " "))
                  (string-suggested (coq-hack-proofusing-suggestion 
string-suggested))
                  ;; disabled for now it never happens because Coq would 
suggest anything?
                  (same (and nil previous-content
@@ -2777,7 +2775,7 @@ Used for automatic insertion of \"Proof using\" 
annotations.")
     (goto-char (proof-unprocessed-begin))
     (coq-find-real-start)
     (let* ((pt (point))
-           (dummy (coq-script-parse-cmdend-forward))
+           (_ (coq-script-parse-cmdend-forward))
            (cmd (buffer-substring pt (point)))
            (newcmd (if (coq-tactic-already-has-an-as-close cmd)
                        nil
@@ -2828,7 +2826,7 @@ Also insert holes at insertion positions."
     (setq cmd (read-string "Build match for type: "))
     (let* ((thematch
            (proof-shell-invisible-cmd-get-result (concat "Show Match " cmd 
".")))
-           (match (replace-regexp-in-string "=> \n" "=> #\n" thematch)))
+           (match (replace-regexp-in-string "=> *\n" "=> #\n" thematch)))
       ;; if error, it will be displayed in response buffer (see def of
       ;; proof-shell-invisible-cmd-get-result), otherwise:
       (unless (proof-string-match coq-error-regexp match)
@@ -2901,34 +2899,34 @@ Completion is on a quasi-exhaustive list of Coq 
tacticals."
 
 
 ;; Insertion commands
-(define-key coq-keymap [(control ?i)] 'coq-insert-intros)
-(define-key coq-keymap [(control ?m)] 'coq-insert-match)
-(define-key coq-keymap [(control ?\()] 'coq-insert-section-or-module)
-(define-key coq-keymap [(control ?\))] 'coq-end-Section)
-(define-key coq-keymap [(control ?t)] 'coq-insert-tactic)
-(define-key coq-keymap [?t] 'coq-insert-tactical)
-(define-key coq-keymap [?!] 'coq-insert-solve-tactic) ; will work in tty
-(define-key coq-keymap [(control ?\s)] 'coq-insert-term)
-(define-key coq-keymap [(control return)] 'coq-insert-command)
-(define-key coq-keymap [(control ?q)] 'coq-query)
-(define-key coq-keymap [(control ?r)] 'coq-insert-requires)
+(define-key coq-keymap [(control ?i)]  #'coq-insert-intros)
+(define-key coq-keymap [(control ?m)]  #'coq-insert-match)
+(define-key coq-keymap [(control ?\()] #'coq-insert-section-or-module)
+(define-key coq-keymap [(control ?\))] #'coq-end-Section)
+(define-key coq-keymap [(control ?t)]  #'coq-insert-tactic)
+(define-key coq-keymap [?t]            #'coq-insert-tactical)
+(define-key coq-keymap [?!]            #'coq-insert-solve-tactic) ; will work 
in tty
+(define-key coq-keymap [(control ?\s)] #'coq-insert-term)
+(define-key coq-keymap [(control return)] #'coq-insert-command)
+(define-key coq-keymap [(control ?q)]  #'coq-query)
+(define-key coq-keymap [(control ?r)]  #'coq-insert-requires)
 ; [ for "as [xxx]" is easy to remember, ccontrol-[ would be better but hard to 
type on french keyboards
 ; anyway company-coq should provide an "as!<TAB>".
-(define-key coq-keymap [(?\[)] 'coq-insert-as-in-next-command) ;; not for 
goal/response buffer?
+(define-key coq-keymap [(?\[)]         #'coq-insert-as-in-next-command) ;; not 
for goal/response buffer?
 
 ; Query commands
-(define-key coq-keymap [(control ?s)] 'coq-Show)
-(define-key coq-keymap [?r] 'proof-store-response-win)
-(define-key coq-keymap [?g] 'proof-store-goals-win)
-(define-key coq-keymap [(control ?o)] 'coq-SearchIsos)
-(define-key coq-keymap [(control ?p)] 'coq-Print)
-(define-key coq-keymap [(control ?b)] 'coq-About)
-(define-key coq-keymap [(control ?a)] 'coq-Search)
-(define-key coq-keymap [(control ?c)] 'coq-Check)
-(define-key coq-keymap [?h] 'coq-PrintHint)
-(define-key coq-keymap [(control ?l)] 'coq-LocateConstant)
-(define-key coq-keymap [(control ?n)] 'coq-LocateNotation)
-(define-key coq-keymap [(control ?w)] 'coq-ask-adapt-printing-width-and-show)
+(define-key coq-keymap [(control ?s)]  #'coq-Show)
+(define-key coq-keymap [?r]            #'proof-store-response-win)
+(define-key coq-keymap [?g]            #'proof-store-goals-win)
+(define-key coq-keymap [(control ?o)]  #'coq-SearchIsos)
+(define-key coq-keymap [(control ?p)]  #'coq-Print)
+(define-key coq-keymap [(control ?b)]  #'coq-About)
+(define-key coq-keymap [(control ?a)]  #'coq-Search)
+(define-key coq-keymap [(control ?c)]  #'coq-Check)
+(define-key coq-keymap [?h]            #'coq-PrintHint)
+(define-key coq-keymap [(control ?l)]  #'coq-LocateConstant)
+(define-key coq-keymap [(control ?n)]  #'coq-LocateNotation)
+(define-key coq-keymap [(control ?w)]  #'coq-ask-adapt-printing-width-and-show)
 
 ;(proof-eval-when-ready-for-assistant
 ; (define-key ??? [(control c) (control a)] (proof-ass keymap)))
@@ -2936,61 +2934,61 @@ Completion is on a quasi-exhaustive list of Coq 
tacticals."
 ;(proof-eval-when-ready-for-assistant
 ; (define-key ??? [(control c) (control a)] (proof-ass keymap)))
 
-(define-key coq-goals-mode-map [(control ?c)(control ?a)(control ?c)] 
'coq-Check)
-(define-key coq-goals-mode-map [(control ?c)(control ?a)(control ?p)] 
'coq-Print)
-(define-key coq-goals-mode-map [(control ?c)(control ?a)(control ?o)] 
'coq-SearchIsos)
-(define-key coq-goals-mode-map [(control ?c)(control ?a)(control ?b)] 
'coq-About)
-(define-key coq-goals-mode-map [(control ?c)(control ?a)(control ?a)] 
'coq-Search)
-(define-key coq-goals-mode-map [(control ?c)(control ?a)(control ?s)] 
'coq-Show)
-(define-key coq-goals-mode-map [(control ?c)(control ?a)?r] 
'proof-store-response-win)
-(define-key coq-goals-mode-map [(control ?c)(control ?a)?g] 
'proof-store-goals-win)
-(define-key coq-goals-mode-map [(control ?c)(control ?a)?h] 'coq-PrintHint)
-(define-key coq-goals-mode-map [(control ?c)(control ?a)(control ?q)] 
'coq-query)
-(define-key coq-goals-mode-map [(control ?c)(control ?a)(control ?w)] 
'coq-ask-adapt-printing-width-and-show)
-(define-key coq-goals-mode-map [(control ?c)(control ?a)(control ?l)] 
'coq-LocateConstant)
-(define-key coq-goals-mode-map [(control ?c)(control ?a)(control ?n)] 
'coq-LocateNotation)
+(define-key coq-goals-mode-map [(control ?c)(control ?a)(control ?c)] 
#'coq-Check)
+(define-key coq-goals-mode-map [(control ?c)(control ?a)(control ?p)] 
#'coq-Print)
+(define-key coq-goals-mode-map [(control ?c)(control ?a)(control ?o)] 
#'coq-SearchIsos)
+(define-key coq-goals-mode-map [(control ?c)(control ?a)(control ?b)] 
#'coq-About)
+(define-key coq-goals-mode-map [(control ?c)(control ?a)(control ?a)] 
#'coq-Search)
+(define-key coq-goals-mode-map [(control ?c)(control ?a)(control ?s)] 
#'coq-Show)
+(define-key coq-goals-mode-map [(control ?c)(control ?a)?r] 
#'proof-store-response-win)
+(define-key coq-goals-mode-map [(control ?c)(control ?a)?g] 
#'proof-store-goals-win)
+(define-key coq-goals-mode-map [(control ?c)(control ?a)?h] #'coq-PrintHint)
+(define-key coq-goals-mode-map [(control ?c)(control ?a)(control ?q)] 
#'coq-query)
+(define-key coq-goals-mode-map [(control ?c)(control ?a)(control ?w)] 
#'coq-ask-adapt-printing-width-and-show)
+(define-key coq-goals-mode-map [(control ?c)(control ?a)(control ?l)] 
#'coq-LocateConstant)
+(define-key coq-goals-mode-map [(control ?c)(control ?a)(control ?n)] 
#'coq-LocateNotation)
 ;; specific to goals buffer: (un)foldinng and (un)highlighting shortcuts
-(define-key coq-goals-mode-map [?f] 'coq-toggle-fold-hyp-at-point)
-(define-key coq-goals-mode-map [?F] 'coq-unfold-hyps)
-(define-key coq-goals-mode-map [?h] 'coq-toggle-highlight-hyp-at-point)
-(define-key coq-goals-mode-map [?H] 'coq-unhighlight-selected-hyps)
-
-
-(define-key coq-response-mode-map [(control ?c)(control ?a)(control ?c)] 
'coq-Check)
-(define-key coq-response-mode-map [(control ?c)(control ?a)(control ?p)] 
'coq-Print)
-(define-key coq-response-mode-map [(control ?c)(control ?a)(control ?o)] 
'coq-SearchIsos)
-(define-key coq-response-mode-map [(control ?c)(control ?a)(control ?b)] 
'coq-About)
-(define-key coq-response-mode-map [(control ?c)(control ?a)(control ?a)] 
'coq-Search)
-(define-key coq-response-mode-map [(control ?c)(control ?a)(control ?s)] 
'coq-Show)
-(define-key coq-response-mode-map [(control ?c)(control ?a)(control ?r)] 
'proof-store-response-win)
-(define-key coq-response-mode-map [(control ?c)(control ?a)(control ?g)] 
'proof-store-goals-win)
-(define-key coq-response-mode-map [(control ?c)(control ?a)?h] 'coq-PrintHint)
-(define-key coq-response-mode-map [(control ?c)(control ?a)(control ?q)] 
'coq-query)
-(define-key coq-response-mode-map [(control ?c)(control ?a)(control ?w)] 
'coq-ask-adapt-printing-width-and-show)
-(define-key coq-response-mode-map [(control ?c)(control ?a)(control ?l)] 
'coq-LocateConstant)
-(define-key coq-response-mode-map [(control ?c)(control ?a)(control ?n)] 
'coq-LocateNotation)
+(define-key coq-goals-mode-map [?f] #'coq-toggle-fold-hyp-at-point)
+(define-key coq-goals-mode-map [?F] #'coq-unfold-hyps)
+(define-key coq-goals-mode-map [?h] #'coq-toggle-highlight-hyp-at-point)
+(define-key coq-goals-mode-map [?H] #'coq-unhighlight-selected-hyps)
+
+
+(define-key coq-response-mode-map [(control ?c)(control ?a)(control ?c)] 
#'coq-Check)
+(define-key coq-response-mode-map [(control ?c)(control ?a)(control ?p)] 
#'coq-Print)
+(define-key coq-response-mode-map [(control ?c)(control ?a)(control ?o)] 
#'coq-SearchIsos)
+(define-key coq-response-mode-map [(control ?c)(control ?a)(control ?b)] 
#'coq-About)
+(define-key coq-response-mode-map [(control ?c)(control ?a)(control ?a)] 
#'coq-Search)
+(define-key coq-response-mode-map [(control ?c)(control ?a)(control ?s)] 
#'coq-Show)
+(define-key coq-response-mode-map [(control ?c)(control ?a)(control ?r)] 
#'proof-store-response-win)
+(define-key coq-response-mode-map [(control ?c)(control ?a)(control ?g)] 
#'proof-store-goals-win)
+(define-key coq-response-mode-map [(control ?c)(control ?a)?h] #'coq-PrintHint)
+(define-key coq-response-mode-map [(control ?c)(control ?a)(control ?q)] 
#'coq-query)
+(define-key coq-response-mode-map [(control ?c)(control ?a)(control ?w)] 
#'coq-ask-adapt-printing-width-and-show)
+(define-key coq-response-mode-map [(control ?c)(control ?a)(control ?l)] 
#'coq-LocateConstant)
+(define-key coq-response-mode-map [(control ?c)(control ?a)(control ?n)] 
#'coq-LocateNotation)
 
 (when coq-remap-mouse-1
-  (define-key proof-mode-map [(control down-mouse-1)] 
'coq-id-under-mouse-query)
-  (define-key proof-mode-map [(shift down-mouse-1)] 'coq-id-under-mouse-query)
-  (define-key proof-mode-map [(control mouse-1)] '(lambda () (interactive)))
-  (define-key proof-mode-map [(shift mouse-1)] '(lambda () (interactive)))
-  (define-key proof-mode-map [(control shift down-mouse-1)] 
'coq-id-under-mouse-query)
-  (define-key proof-mode-map [(control shift mouse-1)] '(lambda () 
(interactive)))
+  (define-key proof-mode-map [(control down-mouse-1)] 
#'coq-id-under-mouse-query)
+  (define-key proof-mode-map [(shift down-mouse-1)] #'coq-id-under-mouse-query)
+  (define-key proof-mode-map [(control mouse-1)] #'ignore)
+  (define-key proof-mode-map [(shift mouse-1)] #'ignore)
+  (define-key proof-mode-map [(control shift down-mouse-1)] 
#'coq-id-under-mouse-query)
+  (define-key proof-mode-map [(control shift mouse-1)] #'ignore)
 
-  (define-key proof-response-mode-map [(control down-mouse-1)] 
'coq-id-under-mouse-query)
-  (define-key proof-response-mode-map [(shift down-mouse-1)] 
'coq-id-under-mouse-query)
-  (define-key proof-response-mode-map [(control mouse-1)] '(lambda () 
(interactive)))
-  (define-key proof-response-mode-map [(shift mouse-1)] '(lambda () 
(interactive)))
-  (define-key proof-response-mode-map [(control shift down-mouse-1)] 
'coq-id-under-mouse-query)
-  (define-key proof-response-mode-map [(control shift mouse-1)] '(lambda () 
(interactive)))
+  (define-key proof-response-mode-map [(control down-mouse-1)] 
#'coq-id-under-mouse-query)
+  (define-key proof-response-mode-map [(shift down-mouse-1)] 
#'coq-id-under-mouse-query)
+  (define-key proof-response-mode-map [(control mouse-1)] #'ignore)
+  (define-key proof-response-mode-map [(shift mouse-1)] #'ignore)
+  (define-key proof-response-mode-map [(control shift down-mouse-1)] 
#'coq-id-under-mouse-query)
+  (define-key proof-response-mode-map [(control shift mouse-1)] #'ignore)
 
-  (define-key proof-goals-mode-map [(control down-mouse-1)] 
'coq-id-under-mouse-query)
-  (define-key proof-goals-mode-map [(shift down-mouse-1)] 
'coq-id-under-mouse-query)
-  (define-key proof-goals-mode-map [(control mouse-1)] '(lambda () 
(interactive)))
-  (define-key proof-goals-mode-map [(shift mouse-1)] '(lambda () 
(interactive)))
-  (define-key proof-goals-mode-map [(control shift down-mouse-1)] 
'coq-id-under-mouse-query)
-  (define-key proof-goals-mode-map [(control shift mouse-1)] '(lambda () 
(interactive))))
+  (define-key proof-goals-mode-map [(control down-mouse-1)] 
#'coq-id-under-mouse-query)
+  (define-key proof-goals-mode-map [(shift down-mouse-1)] 
#'coq-id-under-mouse-query)
+  (define-key proof-goals-mode-map [(control mouse-1)] #'ignore)
+  (define-key proof-goals-mode-map [(shift mouse-1)] #'ignore)
+  (define-key proof-goals-mode-map [(control shift down-mouse-1)] 
#'coq-id-under-mouse-query)
+  (define-key proof-goals-mode-map [(control shift mouse-1)] #'ignore))
 
 
 
@@ -2998,20 +2996,22 @@ Completion is on a quasi-exhaustive list of Coq 
tacticals."
 ;; button 3 folds it. Click on it with button 2 copies the names at current
 ;; point.
 (when coq-hypname-map
-  (define-key coq-hypname-map [(mouse-3)] 'coq-toggle-fold-hyp-at-mouse)
-  (define-key coq-hypname-map [(mouse-2)] 'coq-insert-at-point-hyp-at-mouse))
+  (define-key coq-hypname-map [(mouse-3)] #'coq-toggle-fold-hyp-at-mouse)
+  (define-key coq-hypcross-map [(return)] #'coq-toggle-fold-hyp-at-point)
+  (define-key coq-hypname-map [(mouse-2)] #'coq-insert-at-point-hyp-at-mouse))
 
 ;; Default binding: clicking on the cross to folds/unfold hyp.
 ;; Click on it with button 2 copies the names at current point.
 (when coq-hypname-map
-  (define-key coq-hypcross-map [(mouse-1)] 'coq-toggle-fold-hyp-at-mouse)
-  (define-key coq-hypcross-map [return] 'coq-toggle-fold-hyp-at-point)
-  (define-key coq-hypcross-map [(mouse-2)] 'coq-insert-at-point-hyp-at-mouse))
+  (define-key coq-hypcross-map [(mouse-1)] #'coq-toggle-fold-hyp-at-mouse)
+  (define-key coq-hypcross-map [(return)]  #'coq-toggle-fold-hyp-at-point)
+  (define-key coq-hypcross-map [(mouse-2)] #'coq-insert-at-point-hyp-at-mouse))
 ;; Ddefault binding: clicking on a hidden hyp with button 3 unfolds it, with
 ;; button 2 it copies hyp name at current point.
 (when coq-hidden-hyp-map
-  (define-key coq-hidden-hyp-map [(mouse-3)] 'coq-toggle-fold-hyp-at-mouse)
-  (define-key coq-hidden-hyp-map [(mouse-2)] 
'coq-insert-at-point-hyp-at-mouse))
+  (define-key coq-hidden-hyp-map [(mouse-1)] #'coq-toggle-fold-hyp-at-mouse)
+  (define-key coq-hypcross-map   [(return)]  #'coq-toggle-fold-hyp-at-point)
+  (define-key coq-hidden-hyp-map [(mouse-2)] 
#'coq-insert-at-point-hyp-at-mouse))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;
 ;; error handling
@@ -3021,6 +3021,9 @@ Completion is on a quasi-exhaustive list of Coq 
tacticals."
 (defvar last-coq-error-location nil
   "Last error from `coq-get-last-error-location' and `coq-highlight-error'.")
 
+(defvar coq--error-location-regexp
+  "^Toplevel input[^:]+:\n> \\(.*\\)\n> \\([^^]*\\)\\(\\^+\\)\n"
+  "A regexp to search the header of coq error locations.")
 
 ;; I don't use proof-shell-last-output here since it is not always set to the
 ;; really last output (specially when a *tactic* gives an error) instead I go
@@ -3049,7 +3052,7 @@ buffer."
     ;; then highlight the corresponding error location
     (proof-with-current-buffer-if-exists proof-response-buffer
       (goto-char (point-max)) ;\nToplevel input, character[^:]:\n
-      (when (re-search-backward "^Toplevel input[^:]+:\n> \\(.*\\)\n> 
\\([^^]*\\)\\(\\^+\\)\n" nil t)
+      (when (re-search-backward coq--error-location-regexp nil t)
         (let ((text (match-string 1))
               (pos (length (match-string 2)))
               (len (length (match-string 3))))
@@ -3225,7 +3228,7 @@ number of hypothesis displayed, without hiding the goal"
 
 
 
-(defun is-not-split-vertic (selected-window)
+(defun is-not-split-vertic (_selected-window)
   (<= (- (frame-height) (window-height)) 2))
 
 ;; bug fixed in generic ocde, useless now:
@@ -3301,7 +3304,7 @@ this variable is not nil, then 1) it means that electric
 terminator is off and 2) a double hit on the terminator act as
 the usual electric terminator.  See `proof-electric-terminator'."
   :type 'boolean
-  :set 'proof-set-value
+  :set #'proof-set-value
   :group 'proof-user-options)
 
 
@@ -3381,7 +3384,7 @@ Starts a timer for a double hit otherwise."
     (setq coq-double-hit-hot t)
     (setq coq-double-hit-timer
           (run-with-timer coq-double-hit-delay
-                          nil 'coq-unset-double-hit-hot))))
+                          nil #'coq-unset-double-hit-hot))))
 
 (defun coq-terminator-insert (&optional count)
   "A wrapper on `proof-electric-terminator'.
diff --git a/coq/ex/indent.v b/coq/ex/indent.v
index 72a3c20136..17bf4819cb 100644
--- a/coq/ex/indent.v
+++ b/coq/ex/indent.v
@@ -340,6 +340,11 @@ Module X.
         | _ => fail
         end.
 
+        match goal with
+        | ?g := _:rec |- ?a /\ ?b => split
+        | _ => fail
+        end.
+
         Fail
           lazymatch goal with
             _:rec |- ?a /\ ?b => split
diff --git a/doc/PG-adapting.texi b/doc/PG-adapting.texi
index 14fe5219ef..1dda289af5 100644
--- a/doc/PG-adapting.texi
+++ b/doc/PG-adapting.texi
@@ -117,8 +117,8 @@ preserved on all copies.
 This manual documents Proof General, Version @value{version}, for use
 GNU Emacs @value{emacsversion} or (as far as possible) later versions.
 Proof General is distributed under the terms of the GNU General Public
-License (GPL); please check the accompanying file @file{COPYING} for
-more details.
+License (GPL), version 3 or later;
+please check the accompanying file @file{COPYING} for more details.
 
 @sp 1
 
@@ -139,7 +139,7 @@ of @b{Proof General}, a generic Emacs interface for proof 
assistants.
 
 Proof General @value{version} has been tested with GNU Emacs
 @value{emacsversion}.  It is supplied ready customized for the proof
-assistants Coq, Lego, Isabelle, and HOL.
+assistants Coq, EasyCrypt, and PhoX.
 
 This manual contains information for customizing to new proof
 assistants; see the user manual for details about how to use
@@ -335,7 +335,7 @@ more details.
 @c Internals.
 
 @c TEXI DOCSTRING MAGIC: proof-assistant-table
-@defopt proof-assistant-table 
+@defvar proof-assistant-table 
 Proof General's table of supported proof assistants.@*
 This is copied from @samp{@code{proof-assistant-table-default}} at load time,
 removing any entries that do not have a corresponding directory
@@ -348,10 +348,10 @@ Each entry is a list of the form
 The @var{name} is a string, naming the proof assistant.
 The @var{symbol} is used to form the name of the mode for the
 assistant, @samp{SYMBOL-mode}, run when files with @var{automode-regexp}
-(or with extension @var{file-extension}) are visited. If present,
+(or with extension @var{file-extension}) are visited.  If present,
 @var{ignored-extensions-list} is a list of file-name extensions to be
 ignored when doing file-name completion (@var{ignored-extensions-list}
-is added to @code{completion-ignored-extensions}).
+is added to @samp{@code{completion-ignored-extensions}}).
 
 @var{symbol} is also used to form the name of the directory and elisp
 file for the mode, which will be
@@ -360,9 +360,7 @@ file for the mode, which will be
 @end lisp
 where @var{proof-home-directory} is the value of the
 variable @samp{@code{proof-home-directory}}.
-
-The default value is @code{((isar "Isabelle" "thy") (coq "Coq" "v" nil (".vo" 
".glob")) (easycrypt "EasyCrypt" "ec" ".*\\.eca?") (pgshell "PG-Shell" "pgsh") 
(pgocaml "PG-OCaml" "pgml") (pghaskell "PG-Haskell" "pghci"))}.
-@end defopt
+@end defvar
 
 
 The final step of the description above is where the work lies.  There
@@ -648,6 +646,7 @@ the behaviour of script management.
 * Recognizing other elements::
 * Configuring undo behaviour::
 * Nested proofs::
+* Omitting proofs for speed::
 * Safe (state-preserving) commands::
 * Activate scripting hook::
 * Automatic multiple files::
@@ -689,7 +688,7 @@ If non-nil, electric terminator does not actually insert a 
terminator.
 @end defvar
 @c TEXI DOCSTRING MAGIC: proof-script-sexp-commands
 @defvar proof-script-sexp-commands 
-Non-nil if script has LISP-like syntax: commands are @code{top-level} sexps.@*
+Non-nil if script has Lisp-like syntax: commands are @code{top-level} sexps.@*
 You should set this variable in script mode configuration.
 
 To configure command recognition properly, you must set at least one
@@ -842,9 +841,9 @@ It's safe to leave this setting as nil.
 @defvar proof-goal-with-hole-result 
 How to get theorem name after @samp{@code{proof-goal-with-hole-regexp}} 
match.@*
 String or Int.
-If an int N use @code{match-string} to recover the value of the Nth 
parenthesis matched.
-If it is a string use @code{replace-match}. In this case, 
@code{proof-save-with-hole-regexp}
-should match the entire command
+If an int N, use @samp{@code{match-string}} to get the value of the Nth 
parenthesis matched.
+If a string, use @samp{@code{replace-match}}.  In this case, 
@samp{@code{proof-goal-with-hole-regexp}}
+should match the entire command.
 @end defvar
 
 @c TEXI DOCSTRING MAGIC: proof-save-command-regexp
@@ -1137,6 +1136,97 @@ history.
 @end defvar
 
 
+@node Omitting proofs for speed
+@section Omitting proofs for speed
+
+In normal operation, the commands in an asserted region are sent
+successively to the proof assistant. When the proof assistant
+reports an error, processing stops. This ensures the consistency
+of the development. Proof General supports omitting portions of
+the asserted region to speed processing up at the cost of
+consistency. Portions that can be potentially omitted are called
+@emph{opaque proofs} in Proof General, because usually only
+opaque proofs (in the sense of Coq) can be omitted without
+risking to break the following code. This feature is also
+described in the Proof General manual, @inforef{Script processing
+commands, ,ProofGeneral} and @inforef{Omitting proofs for speed,
+,ProofGeneral}.
+
+The omit proofs feature works in a simple, straightforward way:
+After parsing the asserted region, Proof General uses regular
+expressions to search for commands that start
+(@code{proof-script-proof-start-regexp}) and end
+(@code{proof-script-proof-end-regexp}) an opaque proof. If one is
+found, the opaque proof is replaced with a cheating command
+(@code{proof-script-proof-admit-command}). From this description
+it is immediate, that the omit proof feature does only work if
+proofs are not nested. If a nested proof is found, a warning is
+displayed and omitting proofs stops at that location for the
+currently asserted region.
+
+To enable the omit proofs feature, the following settings must be
+configured.
+
+@c TEXI DOCSTRING MAGIC: proof-omit-proofs-configured
+@defvar proof-omit-proofs-configured 
+t if the omit proofs feature has been configured by the proof assitant.@*
+See also @samp{@code{proof-omit-proofs-option}} or the Proof General manual
+for a description of the feature. This option can only be set, if
+all of @samp{@code{proof-script-proof-start-regexp}},
+@samp{@code{proof-script-proof-end-regexp}},
+@samp{@code{proof-script-definition-end-regexp}} and
+@samp{@code{proof-script-proof-admit-command}} have been configured.
+
+The omit proofs feature skips over opaque proofs in the source
+code, admitting the theorems, to speed up processing.
+
+If @samp{@code{proof-omit-proofs-option}} is set by the user, all proof
+commands in the source following a match of
+@samp{@code{proof-script-proof-start-regexp}} up to and including the next
+match of @samp{@code{proof-script-proof-end-regexp}}, are omitted (not send
+to the proof assistant) and replaced by
+@samp{@code{proof-script-proof-admit-command}}. If a match for
+@samp{@code{proof-script-definition-end-regexp}} is found while searching
+forward for the proof end, the current proof (up to and including
+the match of @samp{@code{proof-script-definition-end-regexp}}) is considered
+to be not opaque and not omitted, thus all these proof commands
+_are_ sent to the proof assistant.
+
+The feature does not work for nested proofs. If a match for
+@samp{@code{proof-script-proof-start-regexp}} is found before the next match
+for @samp{@code{proof-script-proof-end-regexp}} or
+@samp{@code{proof-script-definition-end-regexp}}, the search for opaque
+proofs immediately stops and all commands following the previous
+match of @samp{@code{proof-script-proof-start-regexp}} are sent verbatim to
+the proof assistant.
+
+All the regular expressions for this feature are matched against
+the commands inside proof action items, that is as strings,
+without surrounding space.
+@end defvar
+
+@c TEXI DOCSTRING MAGIC: proof-script-proof-start-regexp
+@defvar proof-script-proof-start-regexp 
+Regular expression for the start of a proof for the omit proofs feature.@*
+See @samp{@code{proof-omit-proofs-configured}}.
+@end defvar
+
+@c TEXI DOCSTRING MAGIC: proof-script-proof-end-regexp
+@defvar proof-script-proof-end-regexp 
+Regular expression for the end of an opaque proof for the omit proofs 
feature.@*
+See @samp{@code{proof-omit-proofs-configured}}.
+@end defvar
+
+@c TEXI DOCSTRING MAGIC: proof-script-definition-end-regexp
+@defvar proof-script-definition-end-regexp 
+Regexp for the end of a non-opaque proof for the omit proofs feature.@*
+See @samp{@code{proof-omit-proofs-configured}}.
+@end defvar
+
+@c TEXI DOCSTRING MAGIC: proof-script-proof-admit-command
+@defvar proof-script-proof-admit-command 
+Proof command to be inserted instead of omitted proofs.
+@end defvar
 @node Safe (state-preserving) commands
 @section Safe (state-preserving) commands
 
@@ -1229,10 +1319,10 @@ switching to B.
 @defvar proof-no-fully-processed-buffer 
 Set to t if buffers should always retract before scripting elsewhere.@*
 Leave at nil if fully processed buffers make sense for the current
-proof assistant. If nil the user can choose to fully assert a
-buffer when starting scripting in a different buffer. If t there
+proof assistant.  If nil the user can choose to fully assert a
+buffer when starting scripting in a different buffer.  If t there
 is only the choice to fully retract the active buffer before
-starting scripting in a different buffer. This last behavior is
+starting scripting in a different buffer.  This last behavior is
 needed for Coq.
 @end defvar
 
@@ -1511,7 +1601,7 @@ input, then newlines can be retained in the input.
 
 @c TEXI DOCSTRING MAGIC: proof-shell-insert-hook
 @defvar proof-shell-insert-hook 
-Hooks run by @samp{@code{proof-shell-insert}} before inserting a command.@*
+Hook run by @samp{@code{proof-shell-insert}} before inserting a command.@*
 Can be used to configure the proof assistant to the interface in
 various ways -- for example, to observe or alter the commands sent to
 the prover, or to sneak in extra commands to configure the prover.
@@ -1544,9 +1634,9 @@ prompts than expected, things will break!  Extending the 
variable
 stripped of carriage returns before being sent.
 
 Example uses:
-@var{lego} uses this hook for setting the pretty printer width if
+Lego used this hook for setting the pretty printer width if
 the window width has changed;
-Plastic uses it to remove literate-style markup from @samp{string}.
+Plastic used it to remove literate-style markup from @samp{string}.
 
 See also @samp{@code{proof-script-preprocess}} which can munge text when
 it is added to the queue of commands.
@@ -1814,43 +1904,6 @@ on @samp{@code{proof-shell-eager-annotation-start}} and
 Set to nil to disable.
 @end defvar
 
-@c TEXI DOCSTRING MAGIC: proof-shell-set-elisp-variable-regexp
-@defvar proof-shell-set-elisp-variable-regexp 
-Matches output telling Proof General to set some variable.@*
-This allows the proof assistant to configure Proof General directly
-and dynamically.   (It's also a fantastic backdoor security risk).
-
-More precisely, this should match a string which is bounded by
-matches on @samp{@code{proof-shell-eager-annotation-start}} and
-@samp{@code{proof-shell-eager-annotation-end}}.
-
-If the regexp matches output from the proof assistant, there should be
-two match strings: (@code{match-string} 1) should be the name of the elisp
-variable to be set, and (@code{match-string} 2) should be the value of the
-variable (which will be evaluated as a Lisp expression).
-
-A good markup for the second string is to delimit with #'s, since
-these are not valid syntax for elisp evaluation.
-
-Elisp errors will be trapped when evaluating; set
-@samp{@code{proof-general-debug}} to be informed when this happens.
-
-Example uses are to adjust PG's internal copies of proof assistant's
-settings, or to make automatic dynamic syntax adjustments in Emacs to
-match changes in theory, etc.
-
-If you pick a dummy variable name (e.g. @samp{proof-dummy-setting}) you
-can just evaluation arbitrary elisp expressions for their side
-effects, to adjust menu entries, or even launch auxiliary programs.
-But use with care -- there is no protection against catastrophic elisp!
-
-This setting could also be used to move some configuration settings
-from PG to the prover, but this is not really supported (most settings
-must be made before this mechanism will work).  In future, the PG
-standard protocol, @var{pgip}, will use this mechanism for making all
-settings.
-@end defvar
-
 @c TEXI DOCSTRING MAGIC: proof-shell-theorem-dependency-list-regexp
 @defvar proof-shell-theorem-dependency-list-regexp 
 Matches output telling Proof General about dependencies.@*
@@ -1959,9 +2012,7 @@ quote characters must be escaped.  The setting
   '(("@var{\\\\}" . "@var{\\\\}")
     ("\"" . "\\\""))
 @end lisp
-achieves this.   This does not apply to @var{lego}, which does not
-need backslash escapes and does not allow filenames with
-quote characters.
+achieves this.
 
 This setting is used inside the function @samp{@code{proof-format-filename}}.
 @end defvar
@@ -1971,7 +2022,7 @@ This setting is used inside the function 
@samp{@code{proof-format-filename}}.
 The value of @samp{@code{process-connection-type}} for the proof shell.@*
 Set non-nil for ptys, nil for pipes.
 
-@var{note}: In emacs >= 24 (checked for 24 and 25.0.50.1), t is not a
+@var{note}: In Emacs >= 24 (checked for 24 and 25.0.50.1), t is not a
 good choice: input is cut after @var{4095} chars, which hangs pg.
 @end defvar
 
@@ -2547,7 +2598,7 @@ commands that add new goals to a proof.
 @defvar proof-tree-new-layer-command-regexp 
 Regexp to match proof commands that add new goals to a proof.@*
 This regexp must match the command that turns the proof assistant
-into prover mode, which adds the initial goal to the proof. It
+into prover mode, which adds the initial goal to the proof.  It
 must further match commands that add additional goals after all
 previous goals have been proved.
 @end defvar
@@ -2673,13 +2724,13 @@ Elisp code maintains the following two state variables.
 Hash table to remember sequent ID's.@*
 Needed because some proof assistants do not distinguish between
 new subgoals, which have been created by the last proof command,
-and older, currently unfocussed subgoals. If Proof General meets
+and older, currently unfocussed subgoals.  If Proof General meets
 a goal, it is treated as new subgoal if it is not in this hash yet.
 
-The hash is mostly used as a set of sequent ID's. However, for
+The hash is mostly used as a set of sequent ID's.  However, for
 undo operations it is necessary to delete all those sequents from
 the hash that have been created in a state later than the undo
-state. For this purpose this hash maps sequent ID's to the state
+state.  For this purpose this hash maps sequent ID's to the state
 number in which the sequent has been created.
 
 The hash table is initialized in @samp{@code{proof-tree-start-process}}.
@@ -2690,9 +2741,9 @@ The hash table is initialized in 
@samp{@code{proof-tree-start-process}}.
 @defvar proof-tree-existentials-alist 
 Alist mapping existential variables to sequent ID's.@*
 Used to remember which goals need a refresh when an existential
-variable gets instantiated. To support undo commands the old
+variable gets instantiated.  To support undo commands the old
 contents of this list must be stored in
-@samp{@code{proof-tree-existentials-alist-history}}. To ensure undo is
+@samp{@code{proof-tree-existentials-alist-history}}.  To ensure undo is
 properly working, this variable should only be changed by using
 @samp{@code{proof-tree-delete-existential-assoc}},
 @samp{@code{proof-tree-add-existential-assoc}} or
@@ -2776,10 +2827,10 @@ that starts external proof-tree display.
 @defvar proof-tree-external-display 
 Display proof trees in external prooftree windows if t.@*
 Actually, if this variable is t then the user requested an
-external proof-tree display. If there was no unfinished proof
+external proof-tree display.  If there was no unfinished proof
 when proof-tree display was requested and if no proof has been
 started since then, then there is obviously no proof-tree
-display. In this case, this variable stays t and the proof-tree
+display.  In this case, this variable stays t and the proof-tree
 display will be started for the next proof.
 
 Controlled by @samp{@code{proof-tree-external-display-toggle}}.
@@ -2805,10 +2856,10 @@ message.
 @deffn Command proof-tree-external-display-toggle 
 Toggle the external proof-tree display.@*
 When called outside a proof the external proof-tree display will
-be enabled for the next proof. When called inside a proof the
-proof display will be created for the current proof. If the
+be enabled for the next proof.  When called inside a proof the
+proof display will be created for the current proof.  If the
 external proof-tree display is currently on, then this toggle
-will switch it off. At the end of the proof the proof-tree
+will switch it off.  At the end of the proof the proof-tree
 display is switched off.
 @end deffn
 
@@ -2835,7 +2886,7 @@ the current output does not come from a command (with the
 
 Urgent actions are only needed if the external proof display is
 currently running. Therefore this function should not be called
-when @samp{@code{proof-tree-external-display}} is nil. 
+when @samp{@code{proof-tree-external-display}} is nil.
 
 This function assumes that the prover output is not suppressed.
 Therefore, @samp{@code{proof-tree-external-display}} being t is actually a
@@ -2859,10 +2910,10 @@ assistant is already busy with the next item from
 @code{proof-action-list}. 
 
 @c TEXI DOCSTRING MAGIC: proof-tree-handle-delayed-output
-@defun proof-tree-handle-delayed-output old-proof-marker cmd flags span
+@defun proof-tree-handle-delayed-output old-proof-marker cmd flags _span
 Process delayed output for prooftree.@*
 This function is the main entry point of the Proof General
-prooftree support. It examines the delayed output in order to
+prooftree support.  It examines the delayed output in order to
 take appropriate actions and maintains the internal state.
 
 The delayed output to handle is in the region
@@ -2872,7 +2923,7 @@ which contains the position of 
@samp{@code{proof-marker}}, before the next
 command was sent to the proof assistant.
 
 All other arguments are (former) fields of the @samp{@code{proof-action-list}}
-entry that is now finally retired. @var{cmd} is the command, @var{flags} are
+entry that is now finally retired.  @var{cmd} is the command, @var{flags} are
 the flags and @var{span} is the span.
 @end defun
 
@@ -3046,11 +3097,6 @@ and operating systems.  They are referred to mainly in
 @file{proof-compat} (which helps to keep the architecture and version
 dependent code in one place).
 
-@c TEXI DOCSTRING MAGIC: proof-running-on-win32
-@defvar proof-running-on-win32 
-Non-nil if Proof General is running on a windows variant system.
-@end defvar
-
 
 @node Useful functions and macros
 @section Useful functions and macros
@@ -3107,8 +3153,7 @@ before and after sending the command.
 In case @var{cmd} is (or yields) nil, do nothing.
 
 @var{invisiblecallback} will be invoked after the command has finished,
-if it is set. It should probably run the hook variables
-@samp{@code{proof-state-change-pre-hook}} and
+if it is set.  It should probably run the hook variables
 @samp{@code{proof-state-change-hook}}.
 
 @var{flags} are additional flags to put onto the 
@samp{@code{proof-action-list}}.
@@ -3129,13 +3174,14 @@ KEY is added onto proof assistant map.
 
 @c TEXI DOCSTRING MAGIC: proof-define-assistant-command
 @deffn Macro proof-define-assistant-command 
-Define FN (docstring DOC) to send @var{body} to prover, based on 
@var{cmdvar}.@*
+Define FN (docstring DOC): check if @var{cmdvar} is set, then send @var{body} 
to prover.@*
 @var{body} defaults to @var{cmdvar}, a variable.
 @end deffn
 
 @c TEXI DOCSTRING MAGIC: proof-define-assistant-command-witharg
 @deffn Macro proof-define-assistant-command-witharg 
-Define command FN to prompt for string @var{cmdvar} to proof assistant.@*
+Define FN (arg) with DOC: check @var{cmdvar} is set, @var{prompt} a string and 
eval @var{body}.@*
+The @var{body} can contain occurrences of arg.
 @var{cmdvar} is a variable holding a function or string.  Automatically has 
history.
 @end deffn
 
@@ -3223,10 +3269,10 @@ is located in, or to the variable of the environment 
variable
 
 @c TEXI DOCSTRING MAGIC: proof-home-directory
 @defvar proof-home-directory 
-Directory where Proof General is installed.  Ends with slash.@*
-Default value taken from environment variable @samp{PROOFGENERAL_HOME} if set,
-otherwise based on where the file @samp{proof-site.el} was loaded from.
-You can use customize to set this variable.
+Directory where Proof General is installed.@*
+Based on where the file @samp{proof-site.el} was loaded from.
+Falls back to consulting the environment variable @samp{PROOFGENERAL_HOME} if
+proof-site.el couldn't know where it was executed from.
 @end defvar
 
 @c They're no longer options.
@@ -3257,9 +3303,9 @@ extension.  The proof assistants enabled are the ones 
listed
 in the @code{proof-assistants} setting.
 
 @c TEXI DOCSTRING MAGIC: proof-assistants
-@defopt proof-assistants 
+@defvar proof-assistants 
 Choice of proof assistants to use with Proof General.@*
-A list of symbols chosen from: @code{'isar} @code{'coq} @code{'easycrypt} 
@code{'pgshell} @code{'pgocaml} @code{'pghaskell}.
+A list of symbols chosen from: @samp{coq} @samp{easycrypt} @samp{phox} 
@samp{pgshell} @samp{pgocaml} @samp{pghaskell}.
 If nil, the default will be ALL available proof assistants.
 
 Each proof assistant defines its own instance of Proof General,
@@ -3271,13 +3317,11 @@ only select the proof assistants you (or your site) may 
need.
 You can select which proof assistants you want by setting this
 variable before @samp{proof-site.el} is loaded, or by setting
 the environment variable @samp{PROOFGENERAL_ASSISTANTS} to the
-symbols you want, for example "lego isa".  Or you can
+symbols you want, for example "coq easycrypt".  Or you can
 edit the file @samp{proof-site.el} itself.
 
 Note: to change proof assistant, you must start a new Emacs session.
-
-The default value is @code{nil}.
-@end defopt
+@end defvar
 
 The file @file{proof-site.el} also defines a version variable.
 
@@ -3324,7 +3368,7 @@ but which the user may require different values of across 
provers.
 The function proof-assistant-<SYM> is also defined, which can be used in the
 generic portion of Proof General to access the value for the current prover.
 
-Arguments are as for @samp{defcustom}, which see.  If a :group argument is
+Arguments @var{args} are as for @samp{defcustom}, which see.  If a :group 
argument is
 not supplied, the setting will be added to the internal settings for the
 current prover (named <PA>-config).
 @end deffn
@@ -3619,7 +3663,7 @@ retract or assert, or automatically take the action 
indicated in the
 user option @samp{@code{proof-auto-action-when-deactivating-scripting}}.
 
 If @samp{@code{proof-no-fully-processed-buffer}} is t there is only the choice
-to fully retract the active scripting buffer. In this case the
+to fully retract the active scripting buffer.  In this case the
 active scripting buffer is retracted even if it was fully processed.
 Setting @samp{@code{proof-auto-action-when-deactivating-scripting}} to 
@code{'process}
 is ignored in this case.
@@ -3713,8 +3757,8 @@ the locked region.  If invoked outside the locked region, 
undo
 the last successfully processed command.  See 
@samp{@code{proof-retract-target}}.
 
 After retraction has succeeded in the prover, the filter will call
-@samp{@code{proof-done-retracting}}.  If @var{undo-action} is non-nil, it will 
-then be invoked on the region in the proof script corresponding to 
+@samp{@code{proof-done-retracting}}.  If @var{undo-action} is non-nil, it will
+then be invoked on the region in the proof script corresponding to
 the proof command sequence.
 @var{displayflags} control output shown to user, see 
@samp{@code{proof-action-list}}.
 
@@ -3726,7 +3770,7 @@ of effects:
 for scripting again which may involve retracting
 other (dependent) files.
 
-2. We may query the user whether to save some buffers.  
+2. We may query the user whether to save some buffers.
 
 Step 2 may seem odd -- we're undoing (in) the buffer, after all
 -- but what may happen is that when scripting starts going
@@ -3745,8 +3789,8 @@ proof assistant exits, we use the functions
 @defun proof-restart-buffers buffers
 Remove all extents in @var{buffers} and maybe reset 
@samp{@code{proof-script-buffer}}.@*
 The high-level effect is that all members of @var{buffers} are
-completely unlocked, including all the necessary cleanup. No
-effect on a buffer which is nil or killed. If one of the buffers
+completely unlocked, including all the necessary cleanup.  No
+effect on a buffer which is nil or killed.  If one of the buffers
 is the current scripting buffer, then @samp{@code{proof-script-buffer}} will
 deactivated.
 @end defun
@@ -3822,12 +3866,12 @@ The value is a list of lists of the form
 @end lisp
 which is the queue of things to do.
 
-@var{span} is a region in the sources, where @var{commands} come from. Often,
+@var{span} is a region in the sources, where @var{commands} come from.  Often,
 additional properties are recorded as properties of @var{span}.
 
 @var{commands} is a list of strings, holding the text to be send to the
-prover. It might be the empty list if nothing needs to be sent to
-the prover, such as, for comments. Usually @var{commands}
+prover.  It might be the empty list if nothing needs to be sent to
+the prover, such as, for comments.  Usually @var{commands}
 contains just 1 string, but it might also contains more elements.
 The text should be obtained with
 @samp{(mapconcat }identity @var{commands} " ")', where the last argument
@@ -3849,6 +3893,7 @@ bother the user.  They may include
   @code{'no-error-display}         do not display errors/take error action
   @code{'no-goals-display}         do not goals in @strong{goals} buffer
   @code{'proof-tree-show-subgoal}  item inserted by the proof-tree package
+  @code{'priority-action}          item added via 
@code{proof-add-to-priority-queue}
 @end lisp
 Note that @code{'invisible} does not imply any of the others. If flags
 are non-empty, interactive cues will be surpressed. (E.g.,
@@ -3875,14 +3920,13 @@ until the asynchronous background compilation finishes.
 Signals that some items are waiting outside of 
@samp{@code{proof-action-list}}.@*
 If this is t it means that some items from the queue region are
 waiting for being processed in a place different from
-@samp{@code{proof-action-list}}. In this case Proof General must behave as if
-@samp{@code{proof-action-list}} would be non-empty, when it is, in fact,
-empty.
+@samp{@code{proof-action-list}}.  In this case Proof General must behave as if
+@samp{@code{proof-action-list}} would be non-empty, when it is, in fact, empty.
 
 This is used, for instance, for parallel background compilation
 for Coq: The Require command and the following items are not put
 into @samp{@code{proof-action-list}} and are stored somewhere else until the
-background compilation finishes. Then those items are put into
+background compilation finishes.  Then those items are put into
 @samp{@code{proof-action-list}} for getting processed.
 @end defvar
 
@@ -3892,7 +3936,7 @@ Choice of syntax tree encoding for terms.
 
 If nil, prover is expected to make no optimisations.
 If non-nil, the pretty printer of the prover only reports local changes.
-For @var{lego} 1.3.1 use nil, for Coq 6.2, use t.
+For Coq 6.2, use t.
 @end defvar
 
 
@@ -3932,7 +3976,7 @@ Query the user and exit the proof process.
 
 This simply kills the @samp{@code{proof-shell-buffer}} relying on the hook 
function
 
-@samp{@code{proof-shell-kill-function}} to do the hard work. If optional
+@samp{@code{proof-shell-kill-function}} to do the hard work.  If optional
 argument @var{dont-ask} is non-nil, the proof process is terminated
 without confirmation.
 
@@ -3970,7 +4014,7 @@ It is up to the proof assistant how much context is 
cleared: for
 example, theories already loaded may be "cached" in some way,
 so that loading them the next time round only performs a re-linking
 operation, not full re-processing.  (One way of caching is via
-object files, used by Lego and Coq).
+object files, used by Coq).
 @end deffn
 
 @c
@@ -4031,9 +4075,9 @@ single string.
 The @var{action} argument is a symbol which is typically the name of a
 callback for when each string has been processed.
 
-This calls @samp{@code{proof-shell-insert-hook}}.  The arguments @samp{action} 
and
-@samp{scriptspan} may be examined by the hook to determine how to modify
-the @samp{string} variable (exploiting dynamic scoping) which will be
+This calls @samp{@code{proof-shell-insert-hook}}.  The arguments @var{action} 
and
+@var{scriptspan} may be examined by the hook to determine how to modify
+the string variable (exploiting dynamic scoping) which will be
 the command actually sent to the shell.
 
 Note that the hook is not called for the empty (null) string
@@ -4057,9 +4101,8 @@ not need to use these directly.
 @c TEXI DOCSTRING MAGIC: proof-grab-lock
 @defun proof-grab-lock &optional queuemode
 Grab the proof shell lock, starting the proof assistant if need be.@*
-Runs @samp{@code{proof-state-change-pre-hook}} and
-@samp{@code{proof-state-change-hook}} to notify state change. If
-@var{queuemode} is supplied, set the lock to that value.
+Runs @samp{@code{proof-state-change-hook}} to notify state change.
+If @var{queuemode} is supplied, set the lock to that value.
 @end defun
 
 @c TEXI DOCSTRING MAGIC: proof-release-lock
@@ -4261,8 +4304,8 @@ Marker in proof shell buffer pointing to end of last 
urgent message.
 @defun proof-shell-process-urgent-message start end
 Analyse urgent message between @var{start} and @var{end} for various cases.
 
-Cases are: @strong{trace} output, included/retracted files, cleared 
-goals/response buffer, variable setting, xml-encoded @var{pgip} response, 
+Cases are: @strong{trace} output, included/retracted files, cleared
+goals/response buffer, variable setting, xml-encoded @var{pgip} response,
 theorem dependency message or interactive output indicator.
 
 If none of these apply, display the text between @var{start} and @var{end}.
@@ -4284,13 +4327,13 @@ library that is distributed with Proof General (in
 Master filter for the proof assistant shell-process.@*
 A function for @samp{@code{scomint-output-filter-functions}}.
 
-Deal with output and issue new input from the queue. This is an
-important internal function. The output must be collected from
-@samp{@code{proof-shell-buffer}} for the following reason. This function
+Deal with output and issue new input from the queue.  This is an
+important internal function.  The output must be collected from
+@samp{@code{proof-shell-buffer}} for the following reason.  This function
 might block inside @samp{@code{process-send-string}} when sending input to
-the proof assistant or to prooftree. In this case Emacs might
+the proof assistant or to prooftree.  In this case Emacs might
 call the process filter again while the previous instance is
-still running. @samp{@code{proof-shell-filter-wrapper}} detects and delays
+still running.  @samp{@code{proof-shell-filter-wrapper}} detects and delays
 such calls but does not buffer the output.
 
 Handle urgent messages first.  As many as possible are processed,
@@ -4354,7 +4397,7 @@ by the filter is to send the next command from the queue.
 Wrapper for @samp{@code{proof-shell-filter}}, protecting against parallel 
calls.@*
 In Emacs a process filter function can be called while the same
 filter is currently running for the same process, for instance,
-when the filter bocks on I/O. This wrapper protects the main
+when the filter blocks on I/O. This wrapper protects the main
 entry point, @samp{@code{proof-shell-filter}} against such parallel,
 overlapping calls.
 
@@ -4443,7 +4486,7 @@ This is a note by David Aspinall about proof by pointing 
and similar
 features.
 
 Proof General already supports proof by pointing, and experimental
-support is provided in LEGO.  We would like to extend this support to
+support was provided in LEGO.  We would like to extend this support to
 other proof assistants.  Unfortunately, proof by pointing requires
 rather heavy support from the proof assistant.  There are two aspects to
 the support:
diff --git a/doc/ProofGeneral.texi b/doc/ProofGeneral.texi
index dfa09085df..a566a50092 100644
--- a/doc/ProofGeneral.texi
+++ b/doc/ProofGeneral.texi
@@ -58,8 +58,8 @@
 @c
 
 @set version 4.5-git
-@set emacsversion 24.3
-@set last-update September 2016
+@set emacsversion 25.1
+@set last-update February 2021
 @set rcsid $Id$
 
 @dircategory Theorem proving
@@ -121,7 +121,8 @@ preserved on all copies.
 This manual documents Proof General, Version @value{version}, for use
 with GNU Emacs @value{emacsversion} or
 later versions (subject to Emacs API changes).  Proof General is
-distributed under the terms of the GNU General Public License (GPL);
+distributed under the terms of the GNU General Public License (GPL),
+version 3 or later;
 please check the accompanying file @file{COPYING} for more details.
 
 @sp 1
@@ -158,10 +159,7 @@ assistants Coq, EasyCrypt, and PhoX.
 * Graphical Proof-Tree Visualization::
 * Customizing Proof General::   
 * Hints and Tips::
-* LEGO Proof General::          
 * Coq Proof General::           
-* Isabelle Proof General::    
-* HOL Light Proof General::
 * EasyCrypt Proof General::
 * Shell Proof General::
 @c * PhoX Proof General::
@@ -194,6 +192,7 @@ other documentation, system downloads, etc.
 
 
 @menu
+* News for Version 4.5::
 * News for Version 4.4::
 * News for Version 4.3::
 * News for Version 4.2::
@@ -203,6 +202,16 @@ other documentation, system downloads, etc.
 * Credits::                     
 @end menu
 
+@node News for Version 4.5
+@unnumberedsec News for Version 4.5
+@cindex news
+
+Proof-General is now distributed under the GPLv3+ license.
+
+The old code for the support of the following systems have been
+removed: Twelf, CCC, Lego, Hol-Light, ACL2, Plastic, Lambda-Clam,
+Isabelle, HOL98.
+
 @node News for Version 4.4
 @unnumberedsec News for Version 4.4
 @cindex news
@@ -302,7 +311,6 @@ webpage}.  Help us to help you organize your proofs!
 
 @node Credits
 @unnumberedsec Credits
-@cindex @code{lego-mode}
 @cindex maintenance
 
 The original developers of the basis of Proof General were:
@@ -508,24 +516,15 @@ script file for your proof assistant, for example:
 
 @multitable @columnfractions .35 .3 .35
 @item       @b{Prover}    @tab @b{Extensions} @tab @b{Mode}
-@item       LEGO          @tab @file{.l}      @tab @code{lego-mode}
 @item       Coq           @tab @file{.v}      @tab @code{coq-mode}
-@item       Isabelle      @tab @file{.thy}    @tab @code{isar-mode}
 @item       Phox          @tab @file{.phx}    @tab @code{phox-mode}
-@item       HOL98         @tab @file{.sml}    @tab @code{hol98-mode}
-@item       HOL Light     @tab @file{.ml}     @tab @code{hol-light-mode}
-@item       ACL2          @tab @file{.acl2}   @tab @code{acl2-mode}
-@item       Twelf         @tab @file{.elf}    @tab @code{twelf-mode}
-@item       Plastic       @tab @file{.lf}     @tab @code{plastic-mode}
-@item       Lambda-CLAM   @tab @file{.lcm}    @tab @code{lclam-mode}
-@item       CCC           @tab @file{.ccc}    @tab @code{ccc-mode}
 @item       PG-Shell      @tab @file{.pgsh}   @tab @code{pgshell-mode}
 @item       EasyCrypt     @tab @file{.ec}     @tab @code{easycrypt-mode}
 @end multitable
 (the exact list of Proof Assistants supported may vary according to the
 version of Proof General and its local configuration).  You can also
-invoke the mode command directly, e.g., type @kbd{M-x lego-mode}, to
-turn a buffer into a lego script buffer.
+invoke the mode command directly, e.g., type @kbd{M-x coq-mode}, to
+turn a buffer into a Coq script buffer.
 
 You'll find commands to process the proof script are available from the
 toolbar, menus, and keyboard.  Type @kbd{C-h m} to get a list of the
@@ -660,24 +659,11 @@ proof assistants, including these:
 @c FLAG VERSIONS HERE
 @itemize @bullet
 @item 
-@b{LEGO Proof General} for LEGO Version 1.3.1@*
-@xref{LEGO Proof General}, for more details.
-@item 
 @b{Coq Proof General} for Coq Version 8.2@*
 @xref{Coq Proof General}, for more details.
-@item 
-@b{Isabelle Proof General} for Isabelle2009-2@*
-@xref{Isabelle Proof General}, and documentation supplied with
-Isabelle for more details.
 @c @item
 @c @b{PhoX Proof General} for PhoX 0.8X@*
 @c @xref{PhoX Proof General}, for more details.
-@c @item
-@c @b{HOL Proof General} for HOL98 (HOL4)@*
-@c @xref{HOL Proof General}, for more details.
-@item
-@b{HOL Light Proof General} for HOL Light@*
-@xref{HOL Light Proof General}, for more details.
 @item
 @b{EasyCrypt Proof General} for EasyCrypt@*
 @xref{EasyCrypt Proof General}, for mode details.
@@ -703,7 +689,7 @@ standard instances documented in this manual are listed 
above.
 
 Note that there is some variation between the features supported by
 different instances of Proof General.  The main variation is proof by
-pointing, which is only supported in LEGO at the moment.  For advanced
+pointing, which has been supported only in LEGO so far.  For advanced
 features like this, some extensions to the output routines of the proof
 assistant are required, typically.  If you like Proof General, @b{please
 help us by asking the implementors of your favourite proof assistant to
@@ -798,6 +784,7 @@ then describe the concepts and functions in more detail.
 * Interrupting during trace output::
 @end menu
 
+@c FIXME: Rewrite this to use Coq since Isabelle support was removed.
 @node Walkthrough example in Isabelle
 @section Walkthrough example in Isabelle
 
@@ -1281,9 +1268,9 @@ file and a @code{.thy} theory file which defines its 
theory.
 If you have a partly processed scripting buffer and use @kbd{C-c C-s},
 or you attempt to use script processing in a new buffer, Proof General
 will ask you if you want to retract what has been proved so far,
-@code{Scripting incomplete in buffer myproof.l, retract?}
+@code{Scripting incomplete in buffer myproof.v, retract?}
 or if you want to process the remainder of the active buffer, 
-@code{Completely process buffer myproof.l instead?}
+@code{Completely process buffer myproof.v instead?}
 before you can start scripting in a new buffer.  If you refuse to do
 either, Proof General will give an error message: 
 @code{Cannot have more than one active scripting buffer!}.
@@ -1405,7 +1392,7 @@ Set point to end of command at point.
 
 @vindex proof-terminal-string
 The variable @code{proof-terminal-string} is a prover-specific string
-to terminate proof commands.  LEGO and Isabelle use a semicolon,
+to terminate proof commands.  LEGO and Isabelle used a semicolon,
 @samp{;}. Coq employs a full-stop @samp{.}.
 
 @c TEXI DOCSTRING MAGIC: proof-goto-end-of-locked
@@ -1481,7 +1468,7 @@ design, by allowing successive assertion commands without 
complaining.}
 
 The last command, @code{proof-electric-terminator-toggle}, is triggered
 using the character which terminates proof commands for your proof
-assistant's script language.  For LEGO and Isabelle, use @kbd{C-c ;},
+assistant's script language.  LEGO and Isabelle used @kbd{C-c ;},
 for Coq, use @kbd{C-c .}.  This not really a script processing
 command. Instead, if enabled, it causes subsequent key presses of
 @kbd{;} or @kbd{.} to automatically activate
@@ -1495,6 +1482,42 @@ will stop exactly where the proof script fails, showing 
you the error
 message and the last processed command.  So you can easily continue
 development from exactly the right place in the script.
 
+In normal development, one often jumps into the middle or to the
+end of some file, because this is the point, where a lemma must
+be added or a definition must be fixed. Before starting the real
+work, one needs to assert the file up to that point, usually with
+@kbd{C-c C-RET} (@code{proof-goto-point}). Even for medium sized
+files, asserting a big portion can take several seconds. There
+are different ways to speed this process up.
+@itemize @bullet
+@item
+One can split the development into smaller files. This works
+quite well with Coq, automatic background compilation,
+@ref{Automatic Compilation in Detail}, and the fast compilation
+options, @ref{Quick and inconsistent compilation}.
+@item
+One can configure @code{proof-omit-proofs-option} to @code{t} to
+omit complete opaque proofs when larger chunks are asserted. A
+proof is opaque, if its proof script or proof term cannot
+influence the following code. In Coq, opaque proofs are finished
+with @code{Qed}, non-opaque ones with @code{Defined}. When this
+omit proofs feature is configured, complete opaque proofs are
+silently replace with a suitable cheating command
+(@code{Admitted} for Coq) before sending the proof to the proof
+assistant. For files with big proofs this can bring down the
+processing time to 10% with the obvious disadvantage that errors
+in the omitted proofs go unnoticed. For checking the proofs
+occasionally, a prefix argument for @code{proof-goto-point} and
+@code{proof-process-buffer} causes these commands to disregard
+the setting of @code{proof-omit-proofs-option}. Currently, the
+omit proofs feature is only supported for Coq.
+@item
+An often used poor man's solution is to collect all new material
+at the end of one file, regardless where the material really
+belongs. When the final theorem has been proved, one cleans up
+the mess and moves all stuff where it really belongs.
+@end itemize
+
 Here is the full set of script processing commands.
 
 @c TEXI DOCSTRING MAGIC: proof-assert-next-command-interactive
@@ -1522,15 +1545,19 @@ deleted text.
 
 
 @c TEXI DOCSTRING MAGIC: proof-goto-point
-@deffn Command proof-goto-point 
+@deffn Command proof-goto-point &optional raw
 Assert or retract to the command at current position.@*
 Calls @samp{@code{proof-assert-until-point}} or 
@samp{@code{proof-retract-until-point}} as
-appropriate.
+appropriate. With prefix argument @var{raw} the omit proofs feature
+(@samp{@code{proof-omit-proofs-option}}) is temporaily disabled to check all
+proofs in the asserted region.
 @end deffn
 
 @c TEXI DOCSTRING MAGIC: proof-process-buffer
-@deffn Command proof-process-buffer 
-Process the current (or script) buffer, and maybe move point to the end.
+@deffn Command proof-process-buffer &optional raw
+Process the current (or script) buffer, and maybe move point to the end.@*
+With prefix argument @var{raw} the omit proofs feature 
(@samp{@code{proof-omit-proofs-option}})
+is temporaily disabled to check all proofs in the asserted region.
 @end deffn
 
 @c TEXI DOCSTRING MAGIC: proof-retract-buffer
@@ -1728,7 +1755,7 @@ Query the user and exit the proof process.
 
 This simply kills the @samp{@code{proof-shell-buffer}} relying on the hook 
function
 
-@samp{@code{proof-shell-kill-function}} to do the hard work. If optional
+@samp{@code{proof-shell-kill-function}} to do the hard work.  If optional
 argument @var{dont-ask} is non-nil, the proof process is terminated
 without confirmation.
 
@@ -1757,7 +1784,7 @@ It is up to the proof assistant how much context is 
cleared: for
 example, theories already loaded may be "cached" in some way,
 so that loading them the next time round only performs a re-linking
 operation, not full re-processing.  (One way of caching is via
-object files, used by Lego and Coq).
+object files, used by Coq).
 @end deffn
 
 
@@ -2079,8 +2106,8 @@ Basic modularity in large proof developments can be 
achieved by
 splitting proof scripts across various files. Let's assume that you are
 in the middle of a proof development. You are working on a soundness
 proof of Hoare Logic in a file called@footnote{The suffix may depend of
-the specific proof assistant you are using e.g, LEGO's proof script
-files have to end with @file{.l}.} @file{HSound.l}. It
+the specific proof assistant you are using e.g, Coq's proof script
+files have to end with @file{.v}.} @file{HSound.v}. It
 depends on a number of other files which develop underlying
 concepts e.g. syntax and semantics of expressions, assertions,
 imperative programs. You notice that the current lemma is too difficult
@@ -2089,11 +2116,11 @@ about determinism of the programming language. Or 
perhaps a previous
 definition is too cumbersome or even wrong.
 
 At this stage, you would like to visit the appropriate file, say
-@file{sos.l} and retract to where changes are required. Then, using
+@file{sos.v} and retract to where changes are required. Then, using
 script management, you want to develop some more basic theory in
-@file{sos.l}. Once this task has been completed (possibly involving
+@file{sos.v}. Once this task has been completed (possibly involving
 retraction across even earlier files) and the new development has been
-asserted, you want to switch back to @file{HSound.l} and replay to the
+asserted, you want to switch back to @file{HSound.v} and replay to the
 point you got stuck previously.
 
 Some hours (or days) later you have completed the soundness proof and
@@ -2114,7 +2141,7 @@ or retract the current script buffer.
 Proof General tries to be aware of all files that the proof assistant
 has processed or is currently processing.  In the best case, it relies
 on the proof assistant explicitly telling it whenever it processes a new
-file which corresponds@footnote{For example, LEGO generates additional
+file which corresponds@footnote{For example, LEGO generated additional
 compiled (optimised) proof script files for efficiency.} to a file
 containing a proof script.
 
@@ -2158,16 +2185,6 @@ you are back on track.
 
 
 
-@c only true for LEGO!
-@c If the proof assistant is not happy with the script and
-@c complains with an error message, the buffer will still be marked as
-@c having been completely processed. Sorry. You need to visit the
-@c troublesome file, retract (which will always retract to the beginning of 
-@c the file) and debug the problem e.g., by asserting all of the buffer
-@c under the supervision of Proof General, see @ref{Script processing
-@c commands}. 
-
-
 @node Retracting across files
 @section Retracting across files
 @cindex Retraction
@@ -2306,11 +2323,13 @@ The size of the ring is set by the variable 
@code{pg-input-ring-size}.
 
 @c TEXI DOCSTRING MAGIC: pg-previous-input
 @deffn Command pg-previous-input arg
-Cycle backwards through input history, saving input.
+Cycle backwards through input history, saving input.@*
+If called interactively, @var{arg} is given by the prefix argument.
 @end deffn
 @c TEXI DOCSTRING MAGIC: pg-next-input
 @deffn Command pg-next-input arg
-Cycle forwards through input history.
+Cycle forwards through input history.@*
+If called interactively, @var{arg} is given by the prefix argument.
 @end deffn
 @c TEXI DOCSTRING MAGIC: pg-previous-matching-input
 @deffn Command pg-previous-matching-input regexp n
@@ -2464,6 +2483,7 @@ file @code{@i{PA}-unicode-tokens.el}, or customize the 
main
 variables it contains, for example @code{@i{PA}-token-name-alist} and 
 @code{@i{PA}-shortcut-alist}. 
 
+@c FIXME: Isabelle support was removed.
 E.g., for Isabelle 
 @example
   M-x customize-variable isar-token-name-alist RET
@@ -2685,7 +2705,7 @@ Show a buffer of all the shortcuts available.
 @deffn Command unicode-tokens-list-unicode-chars 
 Insert each Unicode character into a buffer.@*
 Lets you see which characters are available for literal display
-in your emacs font.
+in your Emacs font.
 
 (fn)
 @end deffn
@@ -2786,9 +2806,7 @@ and @code{etags}.
 
 @node Syntax highlighting
 @section Syntax highlighting
-@vindex lego-mode-hooks
 @vindex coq-mode-hooks
-@vindex isa-mode-hooks
 @cindex font lock 
 @cindex colour
 @c Proof General specifics  
@@ -2952,8 +2970,8 @@ through all the files with one command.  Recording the 
function names
 and positions makes possible the @kbd{M-.} command which finds the
 definition of a function by looking up which of the files it is in.
 
-Some instantiations of Proof General (currently LEGO and Coq) are
-supplied with external programs (@file{legotags} and @file{coqtags}) for
+Some instantiations of Proof General (currently Coq) are
+supplied with external programs (@file{coqtags}) for
 making tags tables.  For example, invoking @samp{coqtags *.v} produces a
 file @file{TAGS} for all files @samp{*.v} in the current
 directory. Invoking @samp{coqtags `find . -name \*.v`} produces a file
@@ -2998,7 +3016,7 @@ Add completions from the current tags table.
 This chapter describes what you can do from inside the goals buffer,
 providing support for these features exists for your proof assistant.
 
-As of Proof General 4.0, this support only exists for LEGO and
+As of Proof General 4.4, this support has existed only for LEGO and
 proof-by-pointing functionality has been temporarily removed from the
 interface.  If you would like to see subterm activation support for
 Proof General in another proof assistant, please petition the developers
@@ -3467,49 +3485,40 @@ For multiple frame mode, this function obeys the 
setting of
 
 For single frame mode:
 
-@itemize @bullet
-@item
-In two panes mode, this uses a canonical layout made by splitting
-Emacs windows in equal proportions. The splitting is vertical if
-emacs width is smaller than @samp{@code{split-width-threshold}} and
-horizontal otherwise. You can then adjust the proportions by
+- In two panes mode, this uses a canonical layout made by splitting
+Emacs windows in equal proportions.  The splitting is vertical if
+Emacs width is smaller than @samp{@code{split-width-threshold}} and
+horizontal otherwise.  You can then adjust the proportions by
 dragging the separating bars.
 
-@item
-In three pane mode, there are three display modes, depending
-where the three useful buffers are displayed: scripting
-buffer, goals buffer and response buffer.
-
-Here are the three modes:
-
-@itemize @bullet
-@item
-@code{vertical}: the 3 buffers are displayed in one column.
-
-@item
-@code{hybrid}: 2 columns mode, left column displays scripting buffer
-and right column displays the 2 others.
-
-@item
-@code{horizontal}: 3 columns mode, one for each buffer (script, goals, 
response).
-@end itemize
-
-By default, the display mode is automatically chosen by
-considering the current emacs frame width: if it is smaller
-than @samp{@code{split-width-threshold}} then vertical mode is chosen,
-otherwise if it is smaller than 1.5 * @samp{@code{split-width-threshold}}
-then hybrid mode is chosen, finally if the frame is larger than
-1.5 * @samp{@code{split-width-threshold}} then the horizontal mode is chosen.
-
-You can change the value of @samp{@code{split-width-threshold}} at your
-will.
-
-If you want to force one of the layouts, you can set variable
-@samp{@code{proof-three-window-mode-policy}} to @code{'vertical}, 
@code{'horizontal} or
-@code{'hybrid}. The default value is @code{'smart} which sets the automatic
-behaviour described above.
-@end itemize
-
+- In three pane mode, there are three display modes, depending
+@lisp
+  where the three useful buffers are displayed: scripting
+  buffer, goals buffer and response buffer.
+
+  Here are the three modes:
+
+  - vertical: the 3 buffers are displayed in one column.
+  - hybrid: 2 columns mode, left column displays scripting buffer
+    and right column displays the 2 others.
+  - horizontal: 3 columns mode, one for each buffer (script, goals,
+    response).
+
+  By default, the display mode is automatically chosen by
+  considering the current Emacs frame width: if it is smaller
+  than @samp{@code{split-width-threshold}} then vertical mode is chosen,
+  otherwise if it is smaller than 1.5 * @samp{@code{split-width-threshold}}
+  then hybrid mode is chosen, finally if the frame is larger than
+  1.5 * @samp{@code{split-width-threshold}} then the horizontal mode is chosen.
+
+  You can change the value of @samp{@code{split-width-threshold}} at your
+  will.
+
+  If you want to force one of the layouts, you can set variable
+  @samp{@code{proof-three-window-mode-policy}} to @code{'vertical}, 
@code{'horizontal} or
+  @code{'hybrid}.  The default value is @code{'smart} which sets the automatic
+  behaviour described above.
+@end lisp
 @end deffn
 
 @c TEXI DOCSTRING MAGIC: proof-shrink-windows-tofit
@@ -3537,7 +3546,7 @@ Hovers will be added when this option is non-nil.  Prover 
outputs
 can be displayed when the mouse hovers over the region that
 produced it and output is available (see @samp{@code{proof-full-annotation}}).
 If output is not available, the type of the output region is displayed.
-Changes of this option will not be reflected in already-processed 
+Changes of this option will not be reflected in already-processed
 regions of the script.
 
 The default value is @code{nil}.
@@ -3643,6 +3652,21 @@ If non-nil, format for newlines after each command in a 
script.
 The default value is @code{t}.
 @end defopt
 
+@c TEXI DOCSTRING MAGIC: proof-omit-proofs-option
+@defvar proof-omit-proofs-option 
+Set to t to omit complete opaque proofs for speed reasons.@*
+When t, complete opaque proofs in the asserted region are not
+sent to the proof assistant (and thus not checked). For files
+with big proofs this can drastically reduce the processing time
+for the asserted region at the cost of not checking the proofs.
+For partial and non-opaque proofs in the asserted region all
+proof commands are sent to the proof assistant.
+
+Using a prefix argument for @samp{@code{proof-goto-point}} (M-x 
@code{proof-goto-point})
+or @samp{@code{proof-process-buffer}} (M-x @code{proof-process-buffer}) 
temporarily
+disables omitting proofs.
+@end defvar
+
 @c TEXI DOCSTRING MAGIC: proof-prog-name-ask
 @defopt proof-prog-name-ask 
 If non-nil, query user which program to run for the inferior process.
@@ -3762,8 +3786,8 @@ locked (coloured blue); a buffer is completely 
unprocessed when there
 is no locked region.
 
 For some proof assistants (such as Coq) fully processed buffers make
-no sense. Setting this option to @code{'process} has then the same effect
-as leaving it unset (nil). (This behaviour is controlled by
+no sense.  Setting this option to @code{'process} has then the same effect
+as leaving it unset (nil).  (This behaviour is controlled by
 @samp{@code{proof-no-fully-processed-buffer}}.)
 
 The default value is @code{nil}.
@@ -3776,8 +3800,8 @@ For example,
 @lisp
    ssh bigjobs
 @end lisp
-Would cause Proof General to issue the command @samp{ssh bigjobs isabelle}
-to start Isabelle remotely on our large compute server called @samp{bigjobs}.
+Would cause Proof General to issue the command @samp{ssh bigjobs coqtop}
+to start Coq remotely on our large compute server called @samp{bigjobs}.
 
 The protocol used should be configured so that no user interaction
 (passwords, or whatever) is required to get going.  For proper
@@ -3945,8 +3969,8 @@ and save these variables, saving them may have no 
practical effect
 because the default settings are mostly hard-wired into the proof
 assistant code.  Ones we expect may need changing appear as proof
 assistant specific configurations.  For example,
-@code{proof-assistant-home-page} is set in the LEGO code from the value
-of the customization setting @code{lego-www-home-page}.  At present
+@code{proof-assistant-home-page} is set in the Coq code from the value
+of the customization setting @code{coq-www-home-page}.  At present
 there is no easy way to save changes to other configuration variables
 across sessions, other than by editing the source code.  (In future
 versions of Proof General, we plan to make all configuration
@@ -4003,8 +4027,8 @@ code like this to your @file{.emacs} file:
 
 This lisp fragment adds bindings for every buffer in proof script
 mode (the Emacs keymap is called @code{proof-mode-map}).  To just
-affect one prover, use a keymap name like @code{isar-mode-map} and
-evaluate after the library @code{isar} has been loaded.
+affect one prover, use a keymap name like @code{coq-mode-map} and
+evaluate after the library @code{coq} has been loaded.
 
 To find the names of the functions you may want to bind, look in this
 manual, or query current bindings interactively with @kbd{C-h k}.  This
@@ -4057,72 +4081,53 @@ the file.
 @b{Remark 1:} The examples in the following are for Coq but the
 trick is applicable to other provers. 
 
-@b{Remark 2:} For Coq specifically, there is a recommended other way
-of configuring Coq options:
-project files (@ref{Using the Coq project file}).
-Actually, project files are intended to be included in the
-distribution of a library (and included in its repository), so the Coq
-options specified in project files are supposed to work for all users.
-In contrast, user-defined options such as @code{coq-prog-name} should
-preferably be specified in a directory-local-variables file (see below).
-
-For example, in Coq projects involving multiple directories, it is necessary
-to set the variable @code{coq-load-path} 
-(@ref{Customizing Coq Multiple File Support}). 
-Here is an example:
-Assume the file @file{.../dir/bar/foo.v} depends on modules in
-@code{.../dir/theories/}. Then you can put the following at the
-end of @file{foo.v}:
-
-@lisp
-(* 
-*** Local Variables: ***
-*** coq-load-path: ("../theories") ***
-*** End: ***
-*)
-@end lisp
-
-This way, the right command line arguments are passed to the
-invocation of
-@code{coqtop} when scripting starts in
-@file{foo.v}. Note that the load path @code{"../theories"} is
-project or even file specific, and that therefore a global
-setting via the
-configuration tool would be inappropriate.
-With file variables, Emacs will set @code{coq-load-path}
-automatically when visiting @code{foo.v}. Moreover, the setting of
-@code{coq-load-path} in different files or buffers will not be
-affected. (File variables become buffer local.) 
-
-Extending the previous example, if the makefile for @file{foo.v} is
-located in directory @file{.../dir/}, you can add the right compile
-command. You can also specify a "-R" command. And if you want a non
-standard coq executable to be used, here is what you should put in
-variables:
+@b{Remark 2:} For Coq specifically, there is a recommended other way of
+configuring Coq command-line options: project files (@ref{Using the Coq
+project file}). However file variables are useful to set a specific
+@code{coqtop} executable, or for defining file-specific command-line
+options. Actually, since project files are intended to be included in
+the distribution of a library (and included in its repository), the file
+variables can be used to set non versioned options like
+@code{coq-prog-name}.
+
+@b{Remark 3:} For obvious security reasons, when emacs reads file
+variables, it asks for permission to the user before applying the
+assignment. You should read carefully the content of the variable before
+accepting. You can hit @code{!} to accept definitely the exact values at
+hand.
+
+Let us take a concrete example: suppose the makefile for @file{foo.v} is
+located in directory @file{.../dir/}, you need the right compile command
+in the @code{compile-command} emacs variable. Moreover suppose that you
+want @code{coqtop} to be found in a non standard directory. To put these
+values in file variables, here is what you should put at the end of
+@file{foo.v}:
 
 @lisp
 (* 
 *** Local Variables: ***
 *** coq-prog-name: "../../coqsrc/bin/coqtop" ***
-*** coq-load-path: (("../util" "util") "../theories") ***
 *** compile-command: "make -C .. -k bar/foo.vo" ***
 *** End:***
 *)
 @end lisp
 
 And then the right call to make will be done if you use the @kbd{M-x
-compile} command. Note that the lines are commented in order to be
-ignored by the proof assistant. It is possible to use this mechanism for
-all variables, @inforef{File Variables, ,emacs}.
+compile} command, and the correct @code{coqtop} will be called by
+ProofGeneral. Note that the lines are commented in order to be ignored
+by the proof assistant. It is possible to use this mechanism for all
+variables, @inforef{File Variables, ,emacs}.
+
+@emph{NOTE:} @code{coq-prog-name} should contain only the @code{coqtop}
+executable, @emph{not the options}.
 
 One can also specify file variables on a per directory basis,
-@inforef{Directory Variables, ,emacs}. For instance,
-assume you have a Coq project with several subdirectories and you
-want to put each subdirectory into @code{coq-load-path} for every
-file in the project. You can achieve this by storing
+@inforef{Directory Variables, ,emacs}. You can achieve almost the same
+as above for all the files of a directory by storing
 
 @lisp
-((coq-mode . ((coq-load-path . (("../util" "util") "../theories")))))
+((coq-mode . ((coq-prog-name . "/home/xxx/yyy/coqsrc/bin/coqtop")
+              (compile-command . "make -C .. -k"))))
 @end lisp
 
 into the file @code{.dir-locals.el} in one of the parent directories.
@@ -4130,20 +4135,8 @@ The value in this file must be an alist that maps mode 
names to alists,
 where these latter alists map variables to values. You can aso put
 arbitrary code in this file @inforef{Directory Variables, ,emacs}.
 
-Regarding the configuration of the @code{coq-prog-name} variable, the
-@code{.dir-locals.el} file should contain something like:
-
-@lisp
-((coq-mode . ((coq-prog-name . ".../path/to/coqtop"))))
-@end lisp
-
 @emph{Note:} if you add such content to the @code{.dir-locals.el} file
-you should restart Emacs to take this change into account (or
-just run @kbd{M-x proof-shell-exit RET yes RET}
-and @kbd{M-x normal-mode RET} in the Coq buffer
-before restarting the Coq process).
-
-
+you should restart Emacs or revert your buffer.
 
 @node Using abbreviations
 @section Using abbreviations
@@ -4169,117 +4162,6 @@ minor mode, type @kbd{M-x abbrev-mode RET}. When you 
are not in Abbrev
 mode you can expand an abbreviation by pressing @kbd{C-x '}
 (@code{expand-abbrev}). See the Emacs manual for more details.
 
-Coq Proof General has a special experimental feature called "Holes"
-which makes use of the abbreviation mechanism and includes a large list
-of command abbreviations. @xref{Holes feature}, for details.  With other
-provers, you may use the standard Emacs commands above to set up your
-own abbreviation tables.
-
-
-
-
-
-
-@c =================================================================
-@c
-@c  CHAPTER: LEGO Proof General
-@c 
-@node LEGO Proof General
-@chapter LEGO Proof General
-@cindex LEGO Proof General
-
-LEGO proof script mode is a mode derived from proof script mode for
-editing LEGO scripts. An important convention is that proof script
-buffers @emph{must} start with a module declaration. If the proof script
-buffer's file name is @file{fermat.l}, then it must commence with a
-declaration of the form
-
-@lisp
-Module fermat;
-@end lisp
-
-If, in the development of the module @samp{fermat}, you require material
-from other module e.g., @samp{lib_nat} and @samp{galois}, you need to
-specify this dependency as part of the module declaration:
-
-@lisp
-Module fermat Import lib_nat galois;
-@end lisp
-
-No need to worry too much about efficiency. When you retract back to a
-module declaration to add a new import item, LEGO does not actually
-retract the previously imported modules. Therefore, reasserting the
-extended module declaration really only processes the newly imported
-modules.
-
-Using the LEGO Proof General, you never ever need to use administrative
-LEGO commands such as @samp{Forget}, @samp{ForgetMark}, @samp{KillRef},
-@samp{Load}, @samp{Make}, @samp{Reload} and @samp{Undo} again
-@footnote{And please, don't even think of including those in your LEGO
-proof script!}. 
-
-@menu
-* LEGO specific commands::      
-* LEGO tags::                   
-* LEGO customizations::         
-@end menu
-
-
-@node LEGO specific commands
-@section LEGO specific commands
-
-In addition to the commands provided by the generic Proof General (as
-discussed in the previous sections) the LEGO Proof General provides a
-few extensions. In proof scripts, there are some abbreviations for
-common commands:
-
-@kindex C-c C-a C-i
-@kindex C-c C-a C-I
-@kindex C-c C-a C-R
-@table @kbd
-@item C-c C-a C-i   
-intros
-@item C-c C-a C-I   
-Intros
-@item C-c C-a C-R   
-Refine
-@end table
-
-@node LEGO tags
-@section LEGO tags
-
-You
-might want to ask your local system administrator to tag the directories
-@file{lib_Prop}, @file{lib_Type} and @file{lib_TYPE} of the LEGO
-library. See @ref{Support for tags}, for further details on tags.
-
-
-
-@node LEGO customizations
-@section LEGO customizations
-
-We refer to chapter @ref{Customizing Proof General}, for an introduction
-to the customisation mechanism. In addition to customizations at the
-generic level, for LEGO you can also customize:
-
-@defopt lego-tags 
-The directory of the @var{tags} table for the @var{lego} library
-
-The default value is @code{"/usr/lib/lego/lib_Type/"}.
-@end defopt
-
-@defvar lego-www-home-page 
-Lego home page URL.
-@end defvar
-
-@c We don't worry about the following for now. These are too obscure.
-@c lego-indent
-@c lego-test-all-name
-
-@c We also don't document any of the internal variables which have been
-@c set to configure the generic Proof General and which the user should
-@c not tamper with
-
 
 @c =================================================================
 @c
@@ -4288,6 +4170,10 @@ Lego home page URL.
 @node Coq Proof General
 @chapter Coq Proof General
 
+@macro coqrefman {sectionurl,txt}
+@uref{https://coq.inria.fr/distrib/current/refman/\sectionurl\,\txt\}
+@end macro
+
 Coq Proof General is an instantiation of Proof General for the Coq proof
 assistant.  It supports most of the generic features of Proof General.
 
@@ -4296,6 +4182,7 @@ assistant.  It supports most of the generic features of 
Proof General.
 * Using the Coq project file::
 * Proof using annotations::
 * Multiple File Support::
+* Omitting proofs for speed::
 * Editing multiple proofs::
 * User-loaded tactics::
 * Indentation tweaking::
@@ -4355,14 +4242,19 @@ Inserts ``End <section-name>.'' (this should work well 
with nested sections).
 
 The Coq project file is the recommended way to configure the Coq
 load path and the mapping of logical module names to physical
-file path'. The project file is typically named
+file path (-R,-Q,-I options). The project file is typically named
 @code{_CoqProject} and must be located at the directory root of
 your Coq project. Proof General searches for the Coq project file
 starting at the current directory and walking the directory
 structure upwards. The Coq project file contains the common
 options (especially @code{-R}) and a list of the files of the
-project, see the Coq reference manual, Section 15.3, ``Creating a
-Makefile for Coq modules''.
+project, see the Coq reference manual, Section
+@coqrefman{practical-tools/utilities.html#building-a-coq-project,
+``Building a Coq project''}.
+
+
+@c 
@uref{https://coq.inria.fr/distrib/current/refman/practical-tools/utilities.html#building-a-coq-project,
+@c ``Building a Coq project''}.
 
 The Coq project file should contain something like:
 
@@ -4380,9 +4272,10 @@ project file and uses them for @code{coqtop} background
 processes as well as for @code{coqdep} and @code{coqc} when you use
 the auto compilation feature, @ref{Automatic Compilation in
 Detail}. For the example above, Proof General will start
-@code{coqtop -foo3 -R foo bar -I foo2}.
+@code{coqtop -emacs -foo3 -R foo bar -I foo2} (remark:
+@code{-emacs} is always added to the options).
 
-@emph{Remarque:} @code{-arg} must be followed by one and only one option
+@emph{NOTE:} @code{-arg} must be followed by one and only one option
 to pass to coqtop/coqc, use several @code{-arg} to issue several
 options. One per line (limitation of Proof General).
 
@@ -4390,6 +4283,12 @@ For backward compatibility, one can also configure the 
load path
 with the option @code{coq-load-path}, but this is not compatible
 with @code{CoqIde} or @code{coq_makefile}.
 
+@emph{NOTE:} the Coq project file cannot define which version of
+@code{coqtop} is launched. You need either to launch emacs with the
+right executable in the path or use @inforef{File Variables, ,emacs} or
+@inforef{Directory Variables, ,emacs}. See @ref{Using file variables}
+below.
+
 @menu
 * Changing the name of the coq project file::
 * Disabling the coq project file mechanism::
@@ -4427,17 +4326,16 @@ Documentation of the user option 
@code{coq-project-filename}:
 @c TEXI DOCSTRING MAGIC: coq-project-filename
 @defvar coq-project-filename 
 The name of coq project file.@*
-The coq project file of a coq development (Cf Coq documentation
-on "makefile generation") should contain the arguments given to
+The coq project file of a coq development (cf. Coq documentation on
+"makefile generation") should contain the arguments given to
 coq_makefile. In particular it contains the -I and -R
-options (preferably one per line). If @samp{coq-use-coqproject} is
-t (default) the content of this file will be used by Proof General
-to infer the @samp{@code{coq-load-path}} and the @samp{@code{coq-prog-args}} 
variables
-that set the coqtop invocation by Proof General. This is now the
-recommended way of configuring the coqtop invocation. Local file
-variables may still be used to override the coq project file's
-configuration. .dir-locals.el files also work and override
-project file settings.
+options (preferably one per line).  If @samp{coq-use-coqproject} is
+t (default) the content of this file will be used by Proof General to
+infer the @samp{@code{coq-load-path}} and the @samp{@code{coq-prog-args}} 
variables that set
+the coqtop invocation by Proof General.  This is now the recommended
+way of configuring the coqtop invocation.  Local file variables may
+still be used to override the coq project file's configuration.
+.dir-locals.el files also work and override project file settings.
 @end defvar
 
 
@@ -4451,8 +4349,8 @@ down to ``Coq Use Project File'').
 
 @c TEXI DOCSTRING MAGIC: coq-use-project-file
 @defvar coq-use-project-file 
-If t, when opening a coq file read the dominating _CoqProject.@*
-If t, when a coq file is opened, Proof General will look for a
+If t, when opening a Coq file read the dominating _CoqProject.@*
+If t, when a Coq file is opened, Proof General will look for a
 project file (see @samp{@code{coq-project-filename}}) somewhere in the
 current directory or its parent directories.  If there is one,
 its contents are read and used to determine the arguments that
@@ -4601,9 +4499,9 @@ compilation has finished.
 and dependencies on ML Modules reported by @code{coqdep} are
 ignored.
 
-Proof General uses @code{coqdep} in order to translate the
-qualified identifiers in @code{Require} commands to coq library
-file names and to determine library dependencies. Because Proof
+Proof General uses @code{coqdep} to determine which libraries a
+@code{Require} command will load and which files must be
+up-to-date. Because Proof
 General cannot know whether files are updated outside of Emacs,
 it checks for every @code{Require} command the complete
 dependency tree and recompiles files as necessary.
@@ -4629,10 +4527,9 @@ and via menu entries in @code{Coq -> Auto Compilation},
 Similar to @code{make -k}, background compilation can be
 configured to continue as far as possible after the first error,
 see option @code{coq-compile-keep-going} (menu @code{Coq -> Auto
-Compilation -> Keep going}). The keep-going option only applies
-to errors from @code{coqdep} and @code{coqc}. For all other
-errors (for instance when the translation from logical module
-names to physical files fails or when starting @code{coqc} or
+Compilation -> Keep going}). The keep-going option applies
+to errors from @code{coqdep} and @code{coqc}. However, when
+starting @code{coqc} or
 @code{coqdep} fails), the compilation is immediately aborted.
 
 When a @code{Require} command causes a compilation of some files,
@@ -4683,14 +4580,6 @@ compilation jobs.
 Parallel asynchronous compilation supports both vos and quick/vio
 compilation, but exclusively, depending on the Coq version,
 @ref{Quick and inconsistent compilation}. 
-
-Actually, even with parallel asynchronous compilation, not everything runs
-asynchronously. To translate module identifiers from the Coq
-sources into file names, Proof General runs coqdep on an
-automatically generated, one-line file. These coqdep jobs run
-synchronously while the Require commands are parsed. The coqdep
-jobs on the real source files do run asynchronously in the
-background. 
 @end table
 
 
@@ -4751,16 +4640,21 @@ detection of Proof General or by the setting
 @code{coq-pinned-version}) required modules are either compiled
 to @code{.vo} or @code{.vos} files, depending on the setting
 @code{coq-compile-vos}, which can also be set on menu @code{Coq
--> Auto Compilation -> vos compilation}. There are three choices:
+-> Auto Compilation -> vos compilation}. There are four choices:
 
 @table @asis
-@item @code{use-vos}
-Compile with @code{-vos}. Noticeably faster, but proofs are
-skipped during compilation and some universe constraints might be
-missing.
+@item @code{vos-and-vok}
+First compile using @code{-vos}, skipping proofs. When
+compilation finished, run @code{coqc -vok} in a second stage to
+check proofs on all files that require it. Some universe
+constraints might be missed, rendering this method possibly
+inconsistent.
+@item @code{vos}
+Only compile using @code{-vos}, skipping proofs. No @code{coqc
+-vok} run to check proofs. Obviously inconsistent.
 @item @code{ensure-vo}
 Compile without @code{-vos} to @code{.vo} files, checking all
-proofs and universe constraints.
+proofs and universe constraints. Only consistent choice.
 @item unset (@code{nil})
 Compile with @code{-vos} if @code{coq-compile-quick} (see below)
 equals @code{quick-no-vio2vo}. Otherwise compile without
@@ -4768,6 +4662,17 @@ equals @code{quick-no-vio2vo}. Otherwise compile without
 for users that configured @code{coq-compile-quick} in the past.
 @end table
 
+For @code{vos-and-vok} the second @code{-vok} stage runs
+asynchronously @code{coq-compile-second-stage-delay} seconds
+after the last @code{Require} command has been processed. Errors
+might pop up later and interrupt your normal interaction with
+Coq. Because the second stage is not time critical, it runs on
+@code{coq-max-background-second-stage-percentage} per cent of the
+cores configured for the first stage. When
+@code{coq-compile-keep-going} is configured and an error occurs,
+the second @code{-vok} stage is run on those dependencies not
+affected by the error.
+
 For Coq version 8.5 until before 8.11, Proof General supports
 quick or vio compilation with parallel asynchronous compilation.
 There are 4 modes that can be
@@ -4781,10 +4686,10 @@ that have not switched there development to
 @code{Proof using}. Use @code{quick-no-vio2vo}, if you want quick
 recompilation without producing .vo files. Option
 @code{quick-and-vio2vo} recompiles with @code{-quick}/@code{-vio} as
-@code{quick-no-vio2vo} does, but schedules a vio2vo compilation
-for missing @code{.vo} files after a certain delay. Finally, use
+@code{quick-no-vio2vo} does, but schedules a second vio2vo stage
+for missing @code{.vo} files. Finally, use
 @code{ensure-vo} for only importing @code{.vo} files with
-complete universe checks.
+complete universe checks. 
 
 Note that with all of @code{no-quick}, @code{quick-no-vio2vo} and
 @code{quick-and-vio2vo} your development might be unsound because
@@ -4841,16 +4746,9 @@ files, but don't compile prerequisites for which an 
up-to-date
 @code{.vo} file exists. Delete or overwrite outdated @code{.vio} files.
 
 @item quick-and-vio2vo
-Same as @code{quick-no-vio2vo}, but start vio2vo processes for
-missing @code{.vo} files after a certain delay when library
-compilation for the current queue region has finished. With this
-mode you might see asynchronous errors from vio2vo compilation
-while you are processing stuff far below the last require. vio2vo
-compilation is done on a subset of the available cores controlled
-by option @code{coq-compile-vio2vo-percentage}, @ref{Customizing
-Coq Multiple File Support}. When @code{coq-compile-keep-going} is
-set, vio2vo compilation is scheduled for those files for which
-@code{coqc} compilation was successful.
+Same as @code{quick-no-vio2vo}, but start a second vio2vo stage for
+missing @code{.vo} files. Everything described previously for the
+second @code{-vok} stage applies here as well.
 
 @emph{Warning}: This mode does only work when you process require
 commands in batches. Slowly single-stepping through require's
@@ -4858,7 +4756,7 @@ might lead to inconsistency errors when loading some 
libraries,
 see Coq issue #5223. To mitigate this risk, vio2vo compilation
 only starts after a certain delay after the last require command
 of the current queue region has been processed. This is
-controlled by @code{coq-compile-vio2vo-delay}, @ref{Customizing
+controlled by @code{coq-compile-second-stage-delay}, @ref{Customizing
 Coq Multiple File Support}.
 
 @item ensure-vo
@@ -4891,7 +4789,7 @@ Coq Auto Compile -> Coq Auto Compile}.
 @defvar coq-compile-before-require 
 If non-nil, check dependencies of required modules and compile if necessary.@*
 If non-nil ProofGeneral intercepts "Require" commands and checks if the
-required library module and its dependencies are up-to-date. If not, they
+required library module and its dependencies are up-to-date.  If not, they
 are compiled from the sources before the "Require" command is processed.
 
 This option can be set/reset via menu
@@ -4904,7 +4802,7 @@ This option can be set/reset via menu
 Buffers to save before checking dependencies for compilation.@*
 There are two orthogonal choices: Firstly one can save all or only the coq
 buffers, where coq buffers means all buffers in coq mode except the current
-buffer. Secondly, Emacs can ask about each such buffer or save all of them
+buffer.  Secondly, Emacs can ask about each such buffer or save all of them
 unconditionally.
 
 This makes four permitted values: @code{'ask-coq} to confirm saving all
@@ -4924,12 +4822,12 @@ The following options configure parallel compilation.
 @defvar coq-compile-parallel-in-background 
 Choose the internal compilation method.@*
 When Proof General compiles itself, you have the choice between
-two implementations. If this setting is nil, then Proof General
+two implementations.  If this setting is nil, then Proof General
 uses the old implementation and compiles everything sequentially
-with synchronous job. With this old method Proof General is
-locked during compilation. If this setting is t, then the new
+with synchronous job.  With this old method Proof General is
+locked during compilation.  If this setting is t, then the new
 method is used and compilation jobs are dispatched in parallel in
-the background. The maximal number of parallel compilation jobs
+the background.  The maximal number of parallel compilation jobs
 is set with @samp{@code{coq-max-background-compilation-jobs}}.
 
 This option can be set/reset via menu
@@ -4959,28 +4857,38 @@ This option can be set/reset via menu
 @defvar coq-max-background-compilation-jobs 
 Maximal number of parallel jobs, if parallel compilation is enabled.@*
 Use the number of available CPU cores if this is set to
-@code{'all-cpus}. This variable is the user setting. The value that is
-really used is @samp{@code{coq--internal-max-jobs}}. Use 
@samp{@code{coq-max-jobs-setter}}
-or the customization system to change this variable. Otherwise
+@code{'all-cpus}.  This variable is the user setting.  The value that is
+really used is @samp{@code{coq--internal-max-jobs}}.  Use 
@samp{@code{coq-max-jobs-setter}}
+or the customization system to change this variable.  Otherwise
 your change will have no effect, because @samp{@code{coq--internal-max-jobs}}
 is not adapted.
 @end defvar
 
 
-@c TEXI DOCSTRING MAGIC: coq-max-background-vio2vo-percentage
-@defvar coq-max-background-vio2vo-percentage 
-Percentage of @samp{@code{coq-max-background-vio2vo-percentage}} for vio2vo 
jobs.@*
-This setting configures the maximal number of vio2vo background
-jobs (if you set @samp{@code{coq-compile-quick}} to @code{'quick-and-vio2vo}) 
as
+@c TEXI DOCSTRING MAGIC: coq-max-background-second-stage-percentage
+@defvar coq-max-background-second-stage-percentage 
+Percentage of @samp{@code{coq-max-background-compilation-jobs}} for the second 
stage.@*
+This setting configures the maximal number of @samp{`-vok}' or vio2vo 
background
+jobs running in a second stage as
 percentage of @samp{@code{coq-max-background-compilation-jobs}}.
+
+For backward compatibility, if this option is not customized, it
+is initialized from the now deprecated option
+@samp{@code{coq-max-background-vio2vo-percentage}}.
 @end defvar
 
 
-@c TEXI DOCSTRING MAGIC: coq-compile-vio2vo-delay
-@defvar coq-compile-vio2vo-delay 
-Delay in seconds for the vio2vo compilation.@*
-This delay helps to avoid running into a library inconsistency
-with @code{'quick-and-vio2vo}, see Coq issue #@var{5223}.
+@c TEXI DOCSTRING MAGIC: coq-compile-second-stage-delay
+@defvar coq-compile-second-stage-delay 
+Delay in seconds before starting the second stage compilation.@*
+The delay is applied to both @samp{`-vok}' and vio2vo second stages.
+For Coq < 8.11 and vio2vo delay helps to avoid running into a
+library inconsistency with @code{'quick-and-vio2vo}, see Coq issue
+#@var{5223}.
+
+For backward compatibility, if this option is not customized, it
+is initialized from the now deprecated option
+@samp{@code{coq-compile-vio2vo-delay}}.
 @end defvar
 
 Locking ancestors can be disabled with the following option.
@@ -4989,7 +4897,7 @@ Locking ancestors can be disabled with the following 
option.
 @defvar coq-lock-ancestors 
 If non-nil, lock ancestor module files.@*
 If external compilation is used (via @samp{@code{coq-compile-command}}) then
-only the direct ancestors are locked. Otherwise all ancestors are
+only the direct ancestors are locked.  Otherwise all ancestors are
 locked when the "Require" command is processed.
 
 This option can be set via menu
@@ -5005,13 +4913,13 @@ configure the compilation command in 
@code{coq-compile-command}.
 
 @c TEXI DOCSTRING MAGIC: coq-compile-command
 @defvar coq-compile-command 
-External compilation command. If empty ProofGeneral compiles itself.@*
+External compilation command.  If empty ProofGeneral compiles itself.@*
 If unset (the empty string) ProofGeneral computes the dependencies of
-required modules with coqdep and compiles as necessary. This internal
+required modules with coqdep and compiles as necessary.  This internal
 dependency checking does currently not handle ML modules.
 
 If a non-empty string, the denoted command is called to do the
-dependency checking and compilation. Before executing this
+dependency checking and compilation.  Before executing this
 command the following keys are substituted as follows:
 @lisp
   %p  the (physical) directory containing the source of
@@ -5050,12 +4958,12 @@ configure these things with the following options.
 @defvar coq-load-path 
 Non-standard coq library load path.@*
 This list specifies the LoadPath extension for coqdep, coqc and
-coqtop. Usually, the elements of this list are strings (for
+coqtop.  Usually, the elements of this list are strings (for
 "-I") or lists of two strings (for "-R" dir path and
 "-Q" dir path).
 
 The possible forms of elements of this list correspond to the 4
-forms of include options (@samp{-I} @samp{-Q} and @samp{-R}). An element can be
+forms of include options (@samp{-I} @samp{-Q} and @samp{-R}).  An element can 
be
 @lisp
   - A list of the form @samp{(}ocamlimport dir)', specifying (in 8.5) a
     directory to be added to ocaml path (@samp{-I}).
@@ -5086,10 +4994,10 @@ not the same (-I is for coq path).
 
 @c TEXI DOCSTRING MAGIC: coq-load-path-include-current
 @defvar coq-load-path-include-current 
-If @samp{t} let coqdep search the current directory too.@*
-Should be @samp{t} for normal users. If @samp{t} pass -Q dir "" to coqdep when
-processing files in directory "dir" in addition to any entries
-in @samp{@code{coq-load-path}}.
+If t, let coqdep search the current directory too.@*
+Should be t for normal users.  If t, pass -Q dir "" to coqdep when
+processing files in directory "dir" in addition to any entries in
+@samp{@code{coq-load-path}}.
 
 This setting is only relevant with Coq < 8.5.
 @end defvar
@@ -5105,12 +5013,12 @@ libraries.
 @defvar coq-compile-ignored-directories 
 Directories in which ProofGeneral should not compile modules.@*
 List of regular expressions for directories in which ProofGeneral
-should not compile modules. If a library file name matches one
+should not compile modules.  If a library file name matches one
 of the regular expressions in this list then ProofGeneral does
 neither compile this file nor check its dependencies for
-compilation. It makes sense to include non-standard coq library
+compilation.  It makes sense to include non-standard coq library
 directories here if they are not changed and if they are so big
-that dependency checking takes noticeable time. The regular
+that dependency checking takes noticeable time.  The regular
 expressions in here are always matched against the .vo file name,
 regardless whether @samp{`-quick}' would be used to compile the file
 or not.
@@ -5125,10 +5033,6 @@ or not.
 No support for @code{Declare ML Module} commands and files
 depending on an ML module.
 @item
-Comments inside require commands should be avoided, see Proof
-General issue #352. The regular expression to extract module
-names does not skip over comments.
-@item
 When a compiled library has the same time stamp as the source
 file, it is considered outdated. Some old file systems (for
 instance ext3) or Emacs before version 24.3 support only time
@@ -5137,6 +5041,51 @@ General will perform some unnecessary compilations.
 @end itemize
 
 
+@node Omitting proofs for speed
+@section Omitting proofs for speed
+
+To speed up asserting larger chunks, Proof General can omit
+complete opaque proofs by silently replacing the whole proof
+script with @code{Admitted}, @ref{Script processing commands}.
+This works when
+@itemize
+@item
+proofs are not nested
+@item
+opaque and non-opaque proofs start with @code{Proof.} or
+@code{Proof using}
+@item
+opaque proofs end with @code{Qed} or @code{Admitted}
+@item
+non-opaque proofs or definition end with @code{Defined}
+@end itemize
+Aborted proofs can be present if they start with a variant of
+@code{Proof} and end with @code{Abort}. They are handled like
+non-opaque proofs (i.e., not omitted).
+
+To enable omitting proofs, configure
+@code{proof-omit-proofs-option} or select @code{Proof-General ->
+Quick Options -> Processing -> Omit Proofs}.
+
+With a prefix argument, both @code{proof-goto-point} and
+@code{proof-process-buffer} will temporarily disable the omit
+proofs feature and send the full proof script to Coq.
+
+If a nested proof is detected while searching for opaque proofs
+to omit, a warning is displayed and the complete remainder of the
+asserted region is sent unmodified to Coq. 
+
+If the proof script relies on sections, it is highly recommended to use
+a @code{Proof using} annotation for all lemmas contained in a Section,
+otherwise @code{Coq} will compute a wrong type for these lemmas when
+this omitting-proofs feature is enabled.
+
+To automate this, we recall that ProofGeneral provides a dedicated
+feature to generate these @code{Proof using} annotations (a defective
+form being e.g. @code{Proof using Type} if no section hypothesis is
+used), see the menu command @code{Coq > "Proof using" mode} and
+@ref{Proof using annotations} for details.
+
 @node Editing multiple proofs
 @section Editing multiple proofs
 
@@ -5282,9 +5231,9 @@ and
 @end verbatim
 @end itemize
 
-NOTE: This feature is experimental.
+@emph{NOTE:} This feature is experimental.
 
-NOTE: the ``pg tokens'' are actually the ones PG generates internally by
+@emph{NOTE:} the ``pg tokens'' are actually the ones PG generates internally by
 exploring the file around the indentation point. Consequently this
 refers to internals of PoofGeneral. Contact the Proof General team if you
 need help.
@@ -5339,8 +5288,7 @@ several layers.
 
 Coq 8.10 supports automatically highlighting the differences
 between successive proof steps in Proof General.  The feature is described in 
the
-@uref{https://coq.inria.fr/distrib/current/refman/proof-engine/proof-handling.html#showing-differences-between-proof-steps,
-Coq Documentation}.
+Coq Documentation, section 
@coqrefman{proofs/writing-proofs/proof-mode.html#showing-differences-between-proof-steps,
 Showing differences between proof steps}.
 
 The Coq proof diff does more than a basic "diff" operation.  For example:
 
@@ -5374,323 +5322,6 @@ have added or removed tokens are shown with the entire 
line highlighted with
 a @code{Coq Diffs ... Bg} face.  The added or removed tokens themselves are 
highlighted
 with non-@code{Bg} faces.
 
-@c =================================================================
-@c
-@c  CHAPTER: Isabelle Proof General
-@c
-@node Isabelle Proof General
-@chapter Isabelle Proof General
-@cindex Isabelle Proof General
-
-Isabelle Proof General supports major generic features of Proof General,
-including integration with Isabelle's theory loader for proper automatic
-multiple file handling.  
-@comment Support for tags and proof-by-pointing is missing.
-
-Isabelle provides its own way to invoke Proof General via the
-@code{isabelle} command.  Running @code{isabelle emacs} starts an Emacs
-session with Isabelle Proof General.  The defaults may be changed by
-editing the Isabelle settings, see the Isabelle documentation for
-details.
-
-Proof General for Isabelle manages Isar @file{.thy} files.  Proof
-General provides reliable control over incremental execution of the
-text.
-
-@menu
-* Choosing logic and starting isabelle::
-* Isabelle commands::
-* Isabelle settings::
-* Isabelle customizations::
-@end menu
-
-@node Choosing logic and starting isabelle
-@section Choosing logic and starting isabelle
-@cindex Isabelle logic
-
-When you load an Isabelle theory file into Proof General, you may be
-prompted for the path to the program @code{isabelle} if it is not on the
-system @code{PATH} already.  This is used to generate further
-information for invoking Isabelle, in particular, the list of available
-logics.
-
-The Isabelle menu offers an easy way to select the invoked object logic.
-If you look at the menu:
-@lisp
-        Isabelle -> Logics -> 
-@end lisp 
-you should see the list of logics available to Isabelle.  This menu is
-generated from the output of the command @code{isabelle findlogics}.
-(Similarly, the documentation menu is partly generated from
-@code{isabelle doc}).  Instead of the menu, you can use the
-keyboard command @code{isabelle-chose-logic} to choose from the list.
-
-The logics list is refreshed dynamically so you can select any newly
-built heap images in the same Emacs session.  However, notice that the
-choices are greyed out while Isabelle is actually running --- you can
-only switch to a new logic if you first exit Isabelle (similarly to
-Proof General, Isabelle operates with only one logic at a time).
-
-Another way to set the logic before Isabelle is launched is using an
-Emacs local variable setting inside a comment at the top of the file,
-see the documentation of @code{isabelle-chosen-logic} below.
-
-In case you do not have the @code{isabelle} program available or want to
-override its behaviour, you may set the variable
-@code{isabelle-program-name-override} to define the name of the
-executable used to start Isabelle.  The standard options are and 
-logic name are still appended.  
-@c in fact, we also have ISABELLE_OPTIONS and PROOFGENERAL_LOGIC,
-@c but lets not mention these.
-
-
-@c TEXI DOCSTRING MAGIC: isabelle-program-name-override
-@defopt isabelle-program-name-override 
-Name of executable program to run Isabelle.
-
-You can set customize this in case the automatic settings
-mechanism does not work for you, perhaps because isabelle
-is not on your path, or you are running it remotely.
-
-The logic image name is tagged onto the end.
-
-The default value is @code{nil}.
-@end defopt
-@c TEXI DOCSTRING MAGIC: isabelle-chosen-logic
-@defopt isabelle-chosen-logic 
-Choice of logic to use with Isabelle.@*
-If non-nil, added onto the Isabelle command line for invoking Isabelle.
-
-You can set this as a file local variable, using a special comment
-at the top of your theory file, like this:
-@lisp
-   (* -*- @code{isabelle-chosen-logic}: "ZF" -*- *)
-@end lisp
-
-The default value is @code{nil}.
-@end defopt
-@c TEXI DOCSTRING MAGIC: isabelle-choose-logic
-@deffn Command isabelle-choose-logic logic
-Adjust isabelle-prog-name and @code{proof-prog-name} for running @var{logic}.
-@end deffn
-@node Isabelle commands
-@section Isabelle commands
-@cindex Isabelle commands
-
-
-@kindex C-c C-a r
-@kindex C-c C-a C-q
-@kindex C-c C-a C-d
-@kindex C-c C-a C-p
-@kindex C-c C-a h A
-@kindex C-c C-a h C
-@kindex C-c C-a h I
-@kindex C-c C-a h S
-@kindex C-c C-a h T
-@kindex C-c C-a h a
-@kindex C-c C-a h b
-@kindex C-c C-a h c
-@kindex C-c C-a h f
-@kindex C-c C-a h i
-@kindex C-c C-a h m
-@kindex C-c C-a h o
-@kindex C-c C-a h t
-@kindex C-c C-a C-s
-@kindex C-c C-a C-m
-@kindex C-c C-a C-f
-@kindex C-c C-f
-
-The Isabelle instance of Proof General supplies several specific
-help key bindings; these functions are offered within the prover help
-menu as well.
-
-@table @kbd
-@item C-c C-a r
-Invokes Isar command @code{refute} on the current subgoal.  Only available in 
HOL
-and derived logics.
-@item C-c C-a C-q
-Invokes Isar command @code{quickcheck} on the current subgoal.
-@item C-c C-a C-d
-Displays a draft document of the current theory.
-@item C-c C-a C-p
-Prints a draft document of the current theory.
-@item C-c C-a h A
-Shows available antiquotation commands and options.
-@item C-c C-a h C
-Shows the current Classical Reasoner context.
-@item C-c C-a h I
-Shows the current set of induct/cases rules.
-@item C-c C-a h S
-Shows the current Simplifier context.
-@item C-c C-a h T
-Shows the current set of transitivity rules (for calculational reasoning).
-@item C-c C-a h a
-Shows attributes available in current theory context.
-@item C-c C-a h b
-Shows all local term bindings.
-@item C-c C-a h c
-Shows all named local contexts (cases).
-@item C-c C-a h f
-Shows all local facts.
-@item C-c C-a h i
-Shows inner syntax of the current theory context (for types and terms).
-@item C-c C-a h m
-Shows proof methods available in current theory context.
-@item C-c C-a h o
-Shows all available commands of Isabelle's outer syntax.
-@item C-c C-a h t
-Shows theorems stored in the current theory node.
-@item C-c C-a C-s
-Invoke sledgehammer on first subgoal.
-@item C-c C-a C-m 
-Find theorems containing given arguments (prompt in minibuffer).
-Invokes the @code{thms_containing} command.  Arguments are
-separated by white space as usual in Isar.
-@item C-c C-a C-f 
-Find theorems containing (argument in form)
-@item C-c C-f
-Find theorems: either of the above.  
-@end table
-
-@comment da: this isn't a very good way!!
-@comment it may override settings for other provers, or have no effect, I 
think!
-@comment we should introduce specific Isar setting.
-@c You can customize the default behaviour of the toolbar or
-@c menu item for find theorems by
-@c setting @code{proof-find-theorems-command} 
-@c to 
-@c @code{isar-find-theorems-minibuffer} or
-@c @code{isar-find-theorems-form}.  The setting
-@c can be customized on the menu:
-@c @example
-@c  Proof-General -> Advanced -> Internals -> Prover Config
-@c @end example
-
-
-@kindex C-c C-a b
-@kindex C-c C-a C-b
-@kindex C-c C-a C-u
-@kindex C-c C-a C-l
-@kindex C-c C-a u
-@kindex C-c C-a l
-@kindex C-c C-a C-i
-@kindex C-c C-a C-r
-@kindex C-c C-a C-a
-
-The following shortcuts insert control sequences into the text,
-modifying the appearance of individual symbols (single letters,
-mathematical entities etc.); the Tokens package will provide immediate
-visual feedback.
-
-@table @kbd
-@item C-c C-a C-b
-Inserts "\<^bold>" (bold character)
-@item C-c C-a C-c
-Inserts "\<^loc>" (``local'' control)
-@item C-c C-a C-u
-Inserts "\<^sup>"  (superscript character)
-@item C-c C-a C-l
-Inserts "\<^sub>" (subscript character)
-@item C-c C-a u
-Inserts "\<^bsup> \<^esup>"  (superscript string)
-@item C-c C-a l
-Inserts "\<^bsub> \<^esub>"  (subscript string)
-@item C-c C-a C-i
-Inserts "\<^isub>"  (identifier subscript letter)
-@item C-c C-a C-r
-Inserts "\<^raw:>"  (raw LaTeX text)
-@item C-c C-a C-a
-Inserts "@@@{text ""@}"  (anti-quotation).
-@item C-c C-a C-x
-Inserts "ML @{* *@}"  (inline ML code).
-@end table
-
-Command termination via `@code{;}' is an optional feature of Isar
-syntax.  Neither Isabelle nor Proof General require semicolons to
-do their job.  The following command allows to get rid of command
-terminators in existing texts.
-
-@c TEXI DOCSTRING MAGIC: isar-strip-terminators
-@deffn Command isar-strip-terminators 
-Remove explicit Isabelle/Isar command terminators @samp{;} from the buffer.
-@end deffn
-
-
-@node Isabelle settings
-@section Isabelle settings
-
-The Isabelle menu also contains a @code{Settings} submenu, which
-allows you to configure things such as the behaviour of Isabelle's term
-pretty printer (display of types, sorts, etc).  Note that you won't
-see this sub-menu until Isabelle has been started, because it is
-generated by Isabelle itself.  Proof General, on the other hand, is
-responsible for recording any settings that are configured when you
-select @code{Isabelle -> Settings -> Save Settings}.  They are stored
-along with the other Emacs customization settings.
-
-
-
-@node Isabelle customizations
-@section Isabelle customizations
-@cindex Isabelle customizations
-
-Here are some of the other user options specific to Isabelle.  You can
-set these as usual with the customization mechanism.
-
-@c TEXI DOCSTRING MAGIC: isabelle-web-page
-@defvar isabelle-web-page 
-URL of web page for Isabelle.
-@end defvar
-
-
-
-
-
-@c FIXME todo: theorem dependencies
-
-
-@c =================================================================
-@c
-@c  CHAPTER: HOL Light Proof General
-@c
-@node HOL Light Proof General
-@chapter HOL Light Proof General
-@cindex HOL Light Proof General
-
-HOL Light Proof General is a "technology demonstration" of Proof General
-for HOL Light.  This means that only a basic instantiation has been
-provided, and that it is not yet supported as a maintained instantiation
-of Proof General.
-
-HOL Light Proof General has basic script management support, with a
-little bit of decoration of scripts and output.  It does not rely on a
-modified version of HOL Light, so the pattern matching may be fragile in
-certain cases.  
-
-@c Support for multiple files deduces dependencies
-@c automatically, so there is no interaction with the HOL make system yet.
-
-See the @file{example.ml} file for a demonstration proof script
-which works with Proof General.
-
-Note that HOL Light Proof Script proof scripts often use batch-oriented
-single step tactic proofs, but Proof General does not (yet) offer an
-easy way to edit these kind of proofs.  They will replay simply as a
-single step proof and you will need to convert from the interactive to
-batch form as usual if you wish to obtain batch proofs.  Also note that
-Proof General does not contain an SML parser, so there can be problems
-if you write complex ML in proof scripts.
-@c Old section was helpful on this: @xref{ML files}, for the same issue with 
Isabelle.
-
-HOL Light is the most recently tested version of HOL with Proof General,
-but the Proof General distribution also contains experimental support
-for HOL 4 (aka HOL 98).  To improve this older version, or to support a
-new HOL variant, a few of the settings probably need to be tweaked to
-cope with small differences in output between the systems.  Please let
-us know if you try this out and want help.  We welcome any interested
-collaborators from the HOL communities to help improve Proof General as
-an interface for HOL provers.
-
 @c =================================================================
 @c
 @c  CHAPTER: EasyCrypt Proof General
@@ -5737,18 +5368,21 @@ Here are some of the other user options specific to 
EasyCrypt.  You can
 set these as usual with the customization mechanism.
 
 @c TEXI DOCSTRING MAGIC: easycrypt-prog-name
-@defvar easycrypt-prog-name
+@defopt easycrypt-prog-name 
 Name of program to run EasyCrypt.
-@end defvar
+
+The default value is @code{"easycrypt"}.
+@end defopt
 
 @c TEXI DOCSTRING MAGIC: easycrypt-load-path
-@defvar easycrypt-load-path
-Non-standard EasyCrypt library load path. This list specifies the
-include path for EasyCrypt.
+@defvar easycrypt-load-path 
+Non-standard EasyCrypt library load path.@*
+This list specifies the include path for EasyCrypt.  The elements of
+this list are strings.
 @end defvar
 
 @c TEXI DOCSTRING MAGIC: easycrypt-web-page
-@defvar easycrypt-web-page
+@defvar easycrypt-web-page 
 URL of web page for EasyCrypt.
 @end defvar
 
@@ -5820,8 +5454,8 @@ The distribution is available in the master branch of the 
repository.
 Tagged versions of the sources may be redistributed by third party
 packagers in other forms.
 
-The sources includes the generic elisp code, and code for Coq, LEGO,
-Isabelle, and other provers.  Also included are installation
+The sources includes the generic elisp code, and code for Coq, EasyCrypt,
+and other provers.  Also included are installation
 instructions (reproduced in brief below) and this documentation.
 
 @node Installing Proof General from sources
@@ -5871,7 +5505,7 @@ General is loaded.  To load it manually, type
 
 If you do not want to use customize, simply add a line like this:
 @lisp
-  (setq coq-prog-name "/usr/bin/coqtop -emacs")
+  (setq coq-prog-name "/usr/bin/coqtop")
 @end lisp
 to your @file{.emacs} file.
 For more advice on how to customize the @code{coq-prog-name} variable,
@@ -5908,7 +5542,7 @@ providing the variables in @file{proof-site.el} are 
adjusted
 accordingly (see @i{Proof General site configuration} in
 @i{Adapting Proof General} for more details).  Make sure that
 the @file{generic/} and assistant-specific elisp files are kept in
-subdirectories (@file{coq/}, @file{isa/}, @file{lego/}) of
+subdirectories (@file{coq/}, @file{phox/}, @file{easycrypt/}, ...) of
 @code{proof-home-directory} so that the autoload directory calculations
 are correct.
 
@@ -5920,7 +5554,7 @@ details if you don't know where to find this file.
 @unnumberedsubsec Removing support for unwanted provers
 
 You cannot run more than one instance of Proof General at a time: so if
-you're using Coq, visiting an @file{.ML} file will not load Isabelle
+you're using Coq, visiting an @file{.ec} file will not load EasyCrypt
 Proof General, and the buffer remains in fundamental mode.  If there are
 some assistants supported that you never want to use, you can adjust the
 variable @code{proof-assistants} in @file{proof-site.el} to remove the
@@ -6017,7 +5651,6 @@ l'INRIA Sophia Antipolis RR-3286
 @c
 @node History of Proof General
 @unnumbered History of Proof General
-@cindex @code{lego-mode}
 @cindex history
 
 It all started some time in 1994. There was no Emacs interface for LEGO.
@@ -6304,8 +5937,7 @@ Public License (GPL).  Compared with the previous more 
restrictive
 license, this means the program can now be redistributed by third
 parties, and used in any context without applying for a special
 license.  Despite these legal changes, we would still appreciate if
-you send us back any useful improvements you make to Proof General,
-and register your use of Proof General on the web site.
+you send us back any useful improvements you make to Proof General.
 
 @node Old News for 3.5
 @unnumberedsec Old News for 3.5
diff --git a/doc/docstring-magic.el b/doc/docstring-magic.el
index 2943dd9f88..7ff84883bc 100644
--- a/doc/docstring-magic.el
+++ b/doc/docstring-magic.el
@@ -48,17 +48,35 @@
         (sname          (symbol-name assistant))
         (elisp-file   sname))
       (setq proof-assistant-symbol nil)
+
+      ;; proof-ready-for-assistant below loads pg-custom by require.
+      ;; pg-custom must be loaded for each proof assistant again,
+      ;; because it defines a lot with defpgcustom, which defines
+      ;; assistent specific variables by using assistant-symbol
+      ;; (called assistant here). Therefore, delete pg-custom from the
+      ;; featue list here, such that it is also loaded for the second
+      ;; proof assistant. Otherwise (proof-ass keymap) would fail
+      ;; because the symbol is not defined for the second proof
+      ;; assistant. And (proof-ass keymap) is put into
+      ;; proof-ready-for-assistant-hook by
+      ;; proof-eval-when-ready-for-assistant, when proof-script is
+      ;; loaded as autoload for proof-ready-for-assistant, because
+      ;; then proof-assistant is not yet set.
+      (setq features (delete 'pg-custom features))
       (proof-ready-for-assistant assistant assistant-name)
       ;; Must load proof-config each time to define proof assistant
       ;; specific variables
       (setq features (delete 'pg-custom features))
-      (load "pg-custom.el")
       (load-library elisp-file)
       (setq assistants (cdr assistants)))))
 
 ;; Now a fake proof assistant to document the automatically
 ;; specific variables
 (setq proof-assistant-symbol nil)
+
+;; ensure again, pg-custom is loaded inside proof-ready-for-assistant,
+;; see above
+(setq features (delete 'pg-custom features))
 (proof-ready-for-assistant 'PA "PROOF ASSISTANT")
 (setq features (delete 'pg-custom features))
 (load "pg-custom.el")
diff --git a/doc/proofgeneral.1 b/doc/proofgeneral.1
index 9c7a245047..b02091e83d 100644
--- a/doc/proofgeneral.1
+++ b/doc/proofgeneral.1
@@ -27,8 +27,8 @@ output version information and exit
 Unrecognized options are passed to Emacs, along with file names.
 .SH EXAMPLES
 .TP
-proofgeneral Example.thy
-Load Proof General editing Isar file Example.thy
+proofgeneral Example.ec
+Load Proof General editing EasyCrypt file Example.ec
 .TP
 proofgeneral example.v
 Load Proof General editing Coq file Example.v
diff --git a/etc/ProofGeneral.spec b/etc/ProofGeneral.spec
index f1d006a7fc..0055ef5764 100644
--- a/etc/ProofGeneral.spec
+++ b/etc/ProofGeneral.spec
@@ -3,7 +3,7 @@ Name:           ProofGeneral
 Version:       4.5-git
 Release:       1
 Group:         Text Editors/Integrated Development Environments (IDE)
-License:       GPL
+License:       GPLv3+
 Url:           http://proofgeneral.inf.ed.ac.uk/
 Packager:      David Aspinall <David.Aspinall@ed.ac.uk>
 Source:                
http://proofgeneral.inf.ed.ac.uk/ProofGeneral-%{version}.tgz
@@ -16,7 +16,7 @@ BuildArchitectures: noarch
 %description
 Proof General is a generic Emacs interface for proof assistants,
 suitable for use by pacifists and Emacs militants alike.
-It is supplied ready-customized for LEGO, Coq, and Isabelle.
+It is supplied ready-customized for EasyCrypt, Coq, and PhoX.
 You can adapt Proof General to other proof assistants if you know a
 little bit of Emacs Lisp.
 
diff --git a/etc/README b/etc/README
index 1b1b0f3fe5..925e985a1e 100644
--- a/etc/README
+++ b/etc/README
@@ -15,9 +15,6 @@ ProofGeneral.menu      Menu file for some Linux versions.
 ProofGeneral.desktop   Menu file for some Linux versions.  
                       Install in /etc/X11/applnk/Applications/
 
-lego                  Files for testing: LEGO Proof General
-isa                                      Isabelle Proof General
-isar                                     Isar PG
 demoisa                                          Isabelle Demo PG
 coq                                      Coq
 <otherprover>                             .. others, similarly
diff --git a/etc/hol-light/example4.ml b/etc/hol-light/example4.ml
deleted file mode 100644
index 3178f6562b..0000000000
--- a/etc/hol-light/example4.ml
+++ /dev/null
@@ -1,13 +0,0 @@
-pg_mode_on ();;
-get_pg_mode ();;
-
-g `(?x:num. p(x) /\ q(x) /\ r(x)) ==> (?x. r(x) /\ p(x)) /\ (?x. p(x) /\ (q(x) 
<=> r(x)))`;;
-e (STRIP_TAC);;
-e (STRIP_TAC);;
-e (X_META_EXISTS_TAC `n1:num` THEN CONJ_TAC);;
-e (FIRST_X_ASSUM(UNIFY_ACCEPT_TAC [`n1:num`]));;
-e (ASM_REWRITE_TAC[]);;
-e (X_META_EXISTS_TAC `n2:num` THEN CONJ_TAC);;
-e (FIRST_X_ASSUM(UNIFY_ACCEPT_TAC [`n2:num`]));;
-e (ASM_REWRITE_TAC[]);;
-let th = top_thm ();;
diff --git a/etc/isar/AHundredProofs.thy b/etc/isar/AHundredProofs.thy
deleted file mode 100644
index 2687b3060f..0000000000
--- a/etc/isar/AHundredProofs.thy
+++ /dev/null
@@ -1,1009 +0,0 @@
-theory AHundredProofs
-imports Main
-begin
-
-ML {* val start = Timing.start () *}
-
-theorem and_comms1: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms2: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms3: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms4: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms5: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms6: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms7: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms8: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms9: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms10: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms11: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms12: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms13: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms14: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms15: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms16: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms17: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms18: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms19: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms20: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms21: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms22: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms23: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms24: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms25: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms26: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms27: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms28: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms29: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms30: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms31: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms32: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms33: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms34: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms35: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms36: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms37: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms38: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms39: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms40: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms41: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms42: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms43: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms44: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms45: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms46: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms47: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms48: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms49: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms50: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms51: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms52: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms53: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms54: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms55: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms56: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms57: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms58: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms59: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms60: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms61: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms62: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms63: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms64: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms65: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms66: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms67: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms68: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms69: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms70: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms71: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms72: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms73: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms74: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms75: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms76: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms77: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms78: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms79: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms80: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms81: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms82: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms83: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms84: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms85: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms86: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms87: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms88: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms89: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms90: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms91: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms92: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms93: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms94: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms95: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms96: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms97: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms98: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms99: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-theorem and_comms100: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
- qed
-qed
-
-ML {* warning (Timing.message (Timing.result start)) *}
-
-end
diff --git a/etc/isar/AHundredTheorems.thy b/etc/isar/AHundredTheorems.thy
deleted file mode 100644
index ab6ad8fd96..0000000000
--- a/etc/isar/AHundredTheorems.thy
+++ /dev/null
@@ -1,117 +0,0 @@
-theory AHundredTheorems
-imports Main
-begin
-
-(* test this *)
-
-ML {* val start = Timing.start () *}
-(* ELISP: -- (setq start (current-time)) -- *)
-
-lemma foo: "P --> P" by auto
-lemma foo2: "P --> P" by auto
-lemma foo3: "P --> P" by auto
-lemma foo4: "P --> P" by auto
-lemma foo5: "P --> P" by auto
-lemma foo6: "P --> P" by auto
-lemma foo7: "P --> P" by auto
-lemma foo8: "P --> P" by auto
-lemma foo9: "P --> P" by auto
-lemma foo10: "P --> P" by auto
-lemma foo11: "P --> P" by auto
-lemma foo12: "P --> P" by auto
-lemma foo13: "P --> P" by auto
-lemma foo14: "P --> P" by auto
-lemma foo15: "P --> P" by auto
-lemma foo16: "P --> P" by auto
-lemma foo17: "P --> P" by auto
-lemma foo18: "P --> P" by auto
-lemma foo19: "P --> P" by auto
-lemma foo20: "P --> P" by auto
-lemma foo21: "P --> P" by auto
-lemma foo22: "P --> P" by auto
-lemma foo23: "P --> P" by auto
-lemma foo24: "P --> P" by auto
-lemma foo25: "P --> P" by auto
-lemma foo26: "P --> P" by auto
-lemma foo27: "P --> P" by auto
-lemma foo28: "P --> P" by auto
-lemma foo29: "P --> P" by auto
-lemma foo30: "P --> P" by auto
-lemma foo31: "P --> P" by auto
-lemma foo32: "P --> P" by auto
-lemma foo33: "P --> P" by auto
-lemma foo34: "P --> P" by auto
-lemma foo35: "P --> P" by auto
-lemma foo36: "P --> P" by auto
-lemma foo37: "P --> P" by auto
-lemma foo38: "P --> P" by auto
-lemma foo39: "P --> P" by auto
-lemma foo40: "P --> P" by auto
-lemma foo41: "P --> P" by auto
-lemma foo42: "P --> P" by auto
-lemma foo43: "P --> P" by auto
-lemma foo44: "P --> P" by auto
-lemma foo45: "P --> P" by auto
-lemma foo46: "P --> P" by auto
-lemma foo47: "P --> P" by auto
-lemma foo48: "P --> P" by auto
-lemma foo49: "P --> P" by auto
-lemma foo50: "P --> P" by auto
-lemma foo51: "P --> P" by auto
-lemma foo52: "P --> P" by auto
-lemma foo53: "P --> P" by auto
-lemma foo54: "P --> P" by auto
-lemma foo55: "P --> P" by auto
-lemma foo56: "P --> P" by auto
-lemma foo57: "P --> P" by auto
-lemma foo58: "P --> P" by auto
-lemma foo59: "P --> P" by auto
-lemma foo60: "P --> P" by auto
-lemma foo61: "P --> P" by auto
-lemma foo62: "P --> P" by auto
-lemma foo63: "P --> P" by auto
-lemma foo64: "P --> P" by auto
-lemma foo65: "P --> P" by auto
-lemma foo66: "P --> P" by auto
-lemma foo67: "P --> P" by auto
-lemma foo68: "P --> P" by auto
-lemma foo69: "P --> P" by auto
-lemma foo70: "P --> P" by auto
-lemma foo71: "P --> P" by auto
-lemma foo72: "P --> P" by auto
-lemma foo73: "P --> P" by auto
-lemma foo74: "P --> P" by auto
-lemma foo75: "P --> P" by auto
-lemma foo76: "P --> P" by auto
-lemma foo77: "P --> P" by auto
-lemma foo78: "P --> P" by auto
-lemma foo79: "P --> P" by auto
-lemma foo80: "P --> P" by auto
-lemma foo81: "P --> P" by auto
-lemma foo82: "P --> P" by auto
-lemma foo83: "P --> P" by auto
-lemma foo84: "P --> P" by auto
-lemma foo85: "P --> P" by auto
-lemma foo86: "P --> P" by auto
-lemma foo87: "P --> P" by auto
-lemma foo88: "P --> P" by auto
-lemma foo89: "P --> P" by auto
-lemma foo90: "P --> P" by auto
-lemma foo91: "P --> P" by auto
-lemma foo92: "P --> P" by auto
-lemma foo93: "P --> P" by auto
-lemma foo94: "P --> P" by auto
-lemma foo95: "P --> P" by auto
-lemma foo96: "P --> P" by auto
-lemma foo97: "P --> P" by auto
-lemma foo98: "P --> P" by auto
-lemma foo99: "P --> P" by auto
-lemma foo100: "P --> P" by auto
-
-
-(* NB: this doesn't work because of comment aggregation *)
-(* ELISP: -- (message "Time taken: %f seconds" (time-to-seconds (time-since 
start))) -- *)
-ML {* warning (Timing.message (Timing.result start)) *}
-
-end
-
diff --git a/etc/isar/AThousandComments.thy b/etc/isar/AThousandComments.thy
deleted file mode 100644
index a84d60184f..0000000000
--- a/etc/isar/AThousandComments.thy
+++ /dev/null
@@ -1,1005 +0,0 @@
-theory AThousandComments imports Main
-begin
-(* This is comment 1.  Skipped by the interface, not even sent to the prover. 
*)
-
-(* This is comment 2.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 3.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 4.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 5.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 6.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 7.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 8.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 9.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 10.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 11.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 12.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 13.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 14.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 15.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 16.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 17.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 18.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 19.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 20.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 21.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 22.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 23.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 24.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 25.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 26.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 27.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 28.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 29.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 30.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 31.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 32.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 33.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 34.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 35.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 36.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 37.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 38.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 39.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 40.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 41.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 42.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 43.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 44.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 45.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 46.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 47.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 48.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 49.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 50.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 51.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 52.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 53.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 54.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 55.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 56.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 57.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 58.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 59.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 60.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 61.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 62.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 63.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 64.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 65.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 66.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 67.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 68.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 69.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 70.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 71.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 72.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 73.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 74.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 75.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 76.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 77.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 78.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 79.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 80.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 81.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 82.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 83.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 84.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 85.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 86.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 87.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 88.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 89.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 90.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 91.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 92.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 93.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 94.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 95.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 96.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 97.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 98.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 99.  Skipped by the interface, not even sent to the prover. 
*)
-(* This is comment 100.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 101.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 102.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 103.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 104.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 105.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 106.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 107.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 108.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 109.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 110.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 111.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 112.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 113.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 114.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 115.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 116.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 117.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 118.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 119.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 120.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 121.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 122.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 123.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 124.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 125.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 126.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 127.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 128.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 129.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 130.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 131.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 132.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 133.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 134.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 135.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 136.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 137.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 138.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 139.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 140.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 141.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 142.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 143.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 144.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 145.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 146.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 147.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 148.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 149.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 150.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 151.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 152.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 153.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 154.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 155.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 156.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 157.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 158.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 159.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 160.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 161.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 162.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 163.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 164.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 165.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 166.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 167.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 168.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 169.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 170.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 171.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 172.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 173.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 174.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 175.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 176.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 177.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 178.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 179.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 180.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 181.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 182.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 183.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 184.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 185.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 186.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 187.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 188.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 189.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 190.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 191.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 192.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 193.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 194.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 195.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 196.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 197.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 198.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 199.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 200.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 201.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 202.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 203.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 204.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 205.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 206.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 207.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 208.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 209.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 210.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 211.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 212.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 213.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 214.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 215.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 216.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 217.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 218.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 219.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 220.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 221.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 222.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 223.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 224.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 225.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 226.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 227.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 228.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 229.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 230.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 231.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 232.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 233.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 234.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 235.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 236.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 237.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 238.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 239.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 240.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 241.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 242.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 243.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 244.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 245.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 246.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 247.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 248.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 249.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 250.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 251.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 252.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 253.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 254.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 255.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 256.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 257.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 258.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 259.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 260.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 261.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 262.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 263.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 264.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 265.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 266.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 267.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 268.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 269.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 270.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 271.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 272.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 273.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 274.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 275.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 276.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 277.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 278.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 279.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 280.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 281.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 282.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 283.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 284.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 285.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 286.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 287.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 288.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 289.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 290.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 291.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 292.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 293.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 294.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 295.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 296.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 297.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 298.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 299.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 300.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 301.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 302.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 303.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 304.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 305.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 306.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 307.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 308.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 309.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 310.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 311.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 312.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 313.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 314.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 315.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 316.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 317.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 318.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 319.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 320.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 321.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 322.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 323.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 324.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 325.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 326.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 327.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 328.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 329.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 330.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 331.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 332.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 333.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 334.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 335.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 336.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 337.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 338.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 339.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 340.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 341.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 342.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 343.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 344.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 345.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 346.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 347.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 348.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 349.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 350.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 351.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 352.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 353.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 354.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 355.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 356.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 357.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 358.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 359.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 360.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 361.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 362.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 363.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 364.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 365.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 366.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 367.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 368.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 369.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 370.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 371.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 372.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 373.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 374.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 375.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 376.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 377.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 378.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 379.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 380.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 381.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 382.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 383.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 384.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 385.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 386.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 387.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 388.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 389.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 390.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 391.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 392.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 393.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 394.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 395.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 396.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 397.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 398.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 399.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 400.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 401.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 402.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 403.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 404.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 405.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 406.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 407.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 408.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 409.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 410.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 411.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 412.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 413.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 414.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 415.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 416.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 417.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 418.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 419.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 420.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 421.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 422.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 423.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 424.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 425.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 426.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 427.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 428.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 429.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 430.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 431.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 432.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 433.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 434.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 435.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 436.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 437.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 438.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 439.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 440.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 441.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 442.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 443.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 444.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 445.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 446.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 447.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 448.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 449.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 450.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 451.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 452.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 453.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 454.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 455.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 456.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 457.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 458.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 459.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 460.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 461.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 462.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 463.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 464.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 465.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 466.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 467.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 468.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 469.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 470.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 471.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 472.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 473.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 474.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 475.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 476.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 477.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 478.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 479.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 480.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 481.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 482.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 483.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 484.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 485.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 486.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 487.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 488.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 489.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 490.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 491.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 492.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 493.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 494.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 495.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 496.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 497.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 498.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 499.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 500.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 501.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 502.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 503.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 504.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 505.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 506.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 507.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 508.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 509.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 510.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 511.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 512.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 513.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 514.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 515.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 516.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 517.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 518.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 519.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 520.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 521.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 522.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 523.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 524.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 525.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 526.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 527.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 528.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 529.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 530.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 531.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 532.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 533.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 534.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 535.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 536.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 537.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 538.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 539.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 540.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 541.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 542.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 543.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 544.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 545.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 546.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 547.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 548.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 549.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 550.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 551.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 552.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 553.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 554.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 555.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 556.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 557.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 558.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 559.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 560.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 561.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 562.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 563.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 564.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 565.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 566.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 567.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 568.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 569.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 570.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 571.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 572.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 573.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 574.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 575.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 576.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 577.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 578.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 579.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 580.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 581.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 582.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 583.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 584.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 585.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 586.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 587.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 588.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 589.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 590.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 591.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 592.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 593.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 594.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 595.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 596.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 597.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 598.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 599.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 600.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 601.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 602.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 603.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 604.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 605.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 606.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 607.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 608.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 609.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 610.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 611.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 612.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 613.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 614.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 615.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 616.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 617.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 618.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 619.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 620.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 621.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 622.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 623.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 624.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 625.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 626.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 627.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 628.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 629.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 630.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 631.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 632.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 633.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 634.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 635.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 636.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 637.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 638.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 639.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 640.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 641.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 642.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 643.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 644.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 645.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 646.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 647.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 648.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 649.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 650.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 651.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 652.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 653.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 654.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 655.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 656.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 657.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 658.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 659.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 660.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 661.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 662.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 663.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 664.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 665.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 666.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 667.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 668.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 669.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 670.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 671.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 672.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 673.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 674.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 675.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 676.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 677.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 678.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 679.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 680.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 681.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 682.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 683.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 684.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 685.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 686.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 687.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 688.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 689.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 690.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 691.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 692.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 693.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 694.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 695.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 696.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 697.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 698.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 699.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 700.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 701.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 702.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 703.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 704.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 705.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 706.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 707.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 708.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 709.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 710.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 711.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 712.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 713.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 714.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 715.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 716.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 717.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 718.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 719.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 720.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 721.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 722.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 723.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 724.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 725.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 726.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 727.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 728.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 729.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 730.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 731.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 732.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 733.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 734.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 735.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 736.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 737.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 738.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 739.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 740.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 741.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 742.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 743.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 744.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 745.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 746.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 747.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 748.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 749.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 750.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 751.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 752.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 753.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 754.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 755.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 756.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 757.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 758.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 759.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 760.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 761.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 762.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 763.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 764.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 765.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 766.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 767.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 768.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 769.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 770.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 771.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 772.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 773.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 774.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 775.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 776.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 777.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 778.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 779.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 780.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 781.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 782.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 783.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 784.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 785.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 786.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 787.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 788.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 789.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 790.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 791.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 792.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 793.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 794.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 795.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 796.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 797.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 798.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 799.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 800.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 801.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 802.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 803.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 804.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 805.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 806.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 807.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 808.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 809.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 810.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 811.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 812.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 813.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 814.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 815.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 816.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 817.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 818.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 819.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 820.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 821.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 822.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 823.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 824.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 825.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 826.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 827.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 828.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 829.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 830.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 831.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 832.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 833.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 834.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 835.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 836.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 837.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 838.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 839.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 840.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 841.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 842.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 843.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 844.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 845.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 846.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 847.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 848.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 849.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 850.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 851.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 852.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 853.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 854.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 855.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 856.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 857.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 858.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 859.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 860.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 861.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 862.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 863.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 864.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 865.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 866.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 867.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 868.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 869.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 870.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 871.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 872.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 873.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 874.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 875.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 876.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 877.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 878.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 879.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 880.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 881.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 882.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 883.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 884.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 885.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 886.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 887.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 888.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 889.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 890.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 891.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 892.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 893.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 894.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 895.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 896.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 897.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 898.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 899.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 900.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 901.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 902.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 903.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 904.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 905.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 906.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 907.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 908.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 909.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 910.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 911.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 912.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 913.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 914.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 915.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 916.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 917.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 918.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 919.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 920.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 921.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 922.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 923.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 924.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 925.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 926.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 927.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 928.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 929.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 930.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 931.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 932.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 933.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 934.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 935.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 936.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 937.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 938.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 939.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 940.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 941.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 942.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 943.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 944.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 945.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 946.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 947.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 948.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 949.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 950.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 951.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 952.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 953.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 954.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 955.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 956.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 957.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 958.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 959.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 960.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 961.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 962.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 963.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 964.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 965.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 966.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 967.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 968.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 969.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 970.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 971.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 972.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 973.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 974.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 975.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 976.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 977.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 978.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 979.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 980.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 981.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 982.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 983.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 984.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 985.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 986.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 987.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 988.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 989.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 990.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 991.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 992.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 993.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 994.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 995.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 996.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 997.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 998.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 999.  Skipped by the interface, not even sent to the 
prover. *)
-(* This is comment 1000.  Skipped by the interface, not even sent to the 
prover. *)
-
-end
diff --git a/etc/isar/AThousandTheorems.thy b/etc/isar/AThousandTheorems.thy
deleted file mode 100644
index 6e565f90c3..0000000000
--- a/etc/isar/AThousandTheorems.thy
+++ /dev/null
@@ -1,1013 +0,0 @@
-theory AThousandTheorems imports Main
-begin
-
-ML {* val start = Timing.start () *}
-(* ELISP: -- (setq start (current-time)) -- *)
-
-lemma foo: "P --> P" by auto
-lemma foo2: "P --> P" by auto
-lemma foo3: "P --> P" by auto
-lemma foo4: "P --> P" by auto
-lemma foo5: "P --> P" by auto
-lemma foo6: "P --> P" by auto
-lemma foo7: "P --> P" by auto
-lemma foo8: "P --> P" by auto
-lemma foo9: "P --> P" by auto
-lemma foo10: "P --> P" by auto
-lemma foo11: "P --> P" by auto
-lemma foo12: "P --> P" by auto
-lemma foo13: "P --> P" by auto
-lemma foo14: "P --> P" by auto
-lemma foo15: "P --> P" by auto
-lemma foo16: "P --> P" by auto
-lemma foo17: "P --> P" by auto
-lemma foo18: "P --> P" by auto
-lemma foo19: "P --> P" by auto
-lemma foo20: "P --> P" by auto
-lemma foo21: "P --> P" by auto
-lemma foo22: "P --> P" by auto
-lemma foo23: "P --> P" by auto
-lemma foo24: "P --> P" by auto
-lemma foo25: "P --> P" by auto
-lemma foo26: "P --> P" by auto
-lemma foo27: "P --> P" by auto
-lemma foo28: "P --> P" by auto
-lemma foo29: "P --> P" by auto
-lemma foo30: "P --> P" by auto
-lemma foo31: "P --> P" by auto
-lemma foo32: "P --> P" by auto
-lemma foo33: "P --> P" by auto
-lemma foo34: "P --> P" by auto
-lemma foo35: "P --> P" by auto
-lemma foo36: "P --> P" by auto
-lemma foo37: "P --> P" by auto
-lemma foo38: "P --> P" by auto
-lemma foo39: "P --> P" by auto
-lemma foo40: "P --> P" by auto
-lemma foo41: "P --> P" by auto
-lemma foo42: "P --> P" by auto
-lemma foo43: "P --> P" by auto
-lemma foo44: "P --> P" by auto
-lemma foo45: "P --> P" by auto
-lemma foo46: "P --> P" by auto
-lemma foo47: "P --> P" by auto
-lemma foo48: "P --> P" by auto
-lemma foo49: "P --> P" by auto
-lemma foo50: "P --> P" by auto
-lemma foo51: "P --> P" by auto
-lemma foo52: "P --> P" by auto
-lemma foo53: "P --> P" by auto
-lemma foo54: "P --> P" by auto
-lemma foo55: "P --> P" by auto
-lemma foo56: "P --> P" by auto
-lemma foo57: "P --> P" by auto
-lemma foo58: "P --> P" by auto
-lemma foo59: "P --> P" by auto
-lemma foo60: "P --> P" by auto
-lemma foo61: "P --> P" by auto
-lemma foo62: "P --> P" by auto
-lemma foo63: "P --> P" by auto
-lemma foo64: "P --> P" by auto
-lemma foo65: "P --> P" by auto
-lemma foo66: "P --> P" by auto
-lemma foo67: "P --> P" by auto
-lemma foo68: "P --> P" by auto
-lemma foo69: "P --> P" by auto
-lemma foo70: "P --> P" by auto
-lemma foo71: "P --> P" by auto
-lemma foo72: "P --> P" by auto
-lemma foo73: "P --> P" by auto
-lemma foo74: "P --> P" by auto
-lemma foo75: "P --> P" by auto
-lemma foo76: "P --> P" by auto
-lemma foo77: "P --> P" by auto
-lemma foo78: "P --> P" by auto
-lemma foo79: "P --> P" by auto
-lemma foo80: "P --> P" by auto
-lemma foo81: "P --> P" by auto
-lemma foo82: "P --> P" by auto
-lemma foo83: "P --> P" by auto
-lemma foo84: "P --> P" by auto
-lemma foo85: "P --> P" by auto
-lemma foo86: "P --> P" by auto
-lemma foo87: "P --> P" by auto
-lemma foo88: "P --> P" by auto
-lemma foo89: "P --> P" by auto
-lemma foo90: "P --> P" by auto
-lemma foo91: "P --> P" by auto
-lemma foo92: "P --> P" by auto
-lemma foo93: "P --> P" by auto
-lemma foo94: "P --> P" by auto
-lemma foo95: "P --> P" by auto
-lemma foo96: "P --> P" by auto
-lemma foo97: "P --> P" by auto
-lemma foo98: "P --> P" by auto
-lemma foo99: "P --> P" by auto
-lemma foo100: "P --> P" by auto
-lemma foo101: "P --> P" by auto
-lemma foo102: "P --> P" by auto
-lemma foo103: "P --> P" by auto
-lemma foo104: "P --> P" by auto
-lemma foo105: "P --> P" by auto
-lemma foo106: "P --> P" by auto
-lemma foo107: "P --> P" by auto
-lemma foo108: "P --> P" by auto
-lemma foo109: "P --> P" by auto
-lemma foo110: "P --> P" by auto
-lemma foo111: "P --> P" by auto
-lemma foo112: "P --> P" by auto
-lemma foo113: "P --> P" by auto
-lemma foo114: "P --> P" by auto
-lemma foo115: "P --> P" by auto
-lemma foo116: "P --> P" by auto
-lemma foo117: "P --> P" by auto
-lemma foo118: "P --> P" by auto
-lemma foo119: "P --> P" by auto
-lemma foo120: "P --> P" by auto
-lemma foo121: "P --> P" by auto
-lemma foo122: "P --> P" by auto
-lemma foo123: "P --> P" by auto
-lemma foo124: "P --> P" by auto
-lemma foo125: "P --> P" by auto
-lemma foo126: "P --> P" by auto
-lemma foo127: "P --> P" by auto
-lemma foo128: "P --> P" by auto
-lemma foo129: "P --> P" by auto
-lemma foo130: "P --> P" by auto
-lemma foo131: "P --> P" by auto
-lemma foo132: "P --> P" by auto
-lemma foo133: "P --> P" by auto
-lemma foo134: "P --> P" by auto
-lemma foo135: "P --> P" by auto
-lemma foo136: "P --> P" by auto
-lemma foo137: "P --> P" by auto
-lemma foo138: "P --> P" by auto
-lemma foo139: "P --> P" by auto
-lemma foo140: "P --> P" by auto
-lemma foo141: "P --> P" by auto
-lemma foo142: "P --> P" by auto
-lemma foo143: "P --> P" by auto
-lemma foo144: "P --> P" by auto
-lemma foo145: "P --> P" by auto
-lemma foo146: "P --> P" by auto
-lemma foo147: "P --> P" by auto
-lemma foo148: "P --> P" by auto
-lemma foo149: "P --> P" by auto
-lemma foo150: "P --> P" by auto
-lemma foo151: "P --> P" by auto
-lemma foo152: "P --> P" by auto
-lemma foo153: "P --> P" by auto
-lemma foo154: "P --> P" by auto
-lemma foo155: "P --> P" by auto
-lemma foo156: "P --> P" by auto
-lemma foo157: "P --> P" by auto
-lemma foo158: "P --> P" by auto
-lemma foo159: "P --> P" by auto
-lemma foo160: "P --> P" by auto
-lemma foo161: "P --> P" by auto
-lemma foo162: "P --> P" by auto
-lemma foo163: "P --> P" by auto
-lemma foo164: "P --> P" by auto
-lemma foo165: "P --> P" by auto
-lemma foo166: "P --> P" by auto
-lemma foo167: "P --> P" by auto
-lemma foo168: "P --> P" by auto
-lemma foo169: "P --> P" by auto
-lemma foo170: "P --> P" by auto
-lemma foo171: "P --> P" by auto
-lemma foo172: "P --> P" by auto
-lemma foo173: "P --> P" by auto
-lemma foo174: "P --> P" by auto
-lemma foo175: "P --> P" by auto
-lemma foo176: "P --> P" by auto
-lemma foo177: "P --> P" by auto
-lemma foo178: "P --> P" by auto
-lemma foo179: "P --> P" by auto
-lemma foo180: "P --> P" by auto
-lemma foo181: "P --> P" by auto
-lemma foo182: "P --> P" by auto
-lemma foo183: "P --> P" by auto
-lemma foo184: "P --> P" by auto
-lemma foo185: "P --> P" by auto
-lemma foo186: "P --> P" by auto
-lemma foo187: "P --> P" by auto
-lemma foo188: "P --> P" by auto
-lemma foo189: "P --> P" by auto
-lemma foo190: "P --> P" by auto
-lemma foo191: "P --> P" by auto
-lemma foo192: "P --> P" by auto
-lemma foo193: "P --> P" by auto
-lemma foo194: "P --> P" by auto
-lemma foo195: "P --> P" by auto
-lemma foo196: "P --> P" by auto
-lemma foo197: "P --> P" by auto
-lemma foo198: "P --> P" by auto
-lemma foo199: "P --> P" by auto
-lemma foo200: "P --> P" by auto
-lemma foo201: "P --> P" by auto
-lemma foo202: "P --> P" by auto
-lemma foo203: "P --> P" by auto
-lemma foo204: "P --> P" by auto
-lemma foo205: "P --> P" by auto
-lemma foo206: "P --> P" by auto
-lemma foo207: "P --> P" by auto
-lemma foo208: "P --> P" by auto
-lemma foo209: "P --> P" by auto
-lemma foo210: "P --> P" by auto
-lemma foo211: "P --> P" by auto
-lemma foo212: "P --> P" by auto
-lemma foo213: "P --> P" by auto
-lemma foo214: "P --> P" by auto
-lemma foo215: "P --> P" by auto
-lemma foo216: "P --> P" by auto
-lemma foo217: "P --> P" by auto
-lemma foo218: "P --> P" by auto
-lemma foo219: "P --> P" by auto
-lemma foo220: "P --> P" by auto
-lemma foo221: "P --> P" by auto
-lemma foo222: "P --> P" by auto
-lemma foo223: "P --> P" by auto
-lemma foo224: "P --> P" by auto
-lemma foo225: "P --> P" by auto
-lemma foo226: "P --> P" by auto
-lemma foo227: "P --> P" by auto
-lemma foo228: "P --> P" by auto
-lemma foo229: "P --> P" by auto
-lemma foo230: "P --> P" by auto
-lemma foo231: "P --> P" by auto
-lemma foo232: "P --> P" by auto
-lemma foo233: "P --> P" by auto
-lemma foo234: "P --> P" by auto
-lemma foo235: "P --> P" by auto
-lemma foo236: "P --> P" by auto
-lemma foo237: "P --> P" by auto
-lemma foo238: "P --> P" by auto
-lemma foo239: "P --> P" by auto
-lemma foo240: "P --> P" by auto
-lemma foo241: "P --> P" by auto
-lemma foo242: "P --> P" by auto
-lemma foo243: "P --> P" by auto
-lemma foo244: "P --> P" by auto
-lemma foo245: "P --> P" by auto
-lemma foo246: "P --> P" by auto
-lemma foo247: "P --> P" by auto
-lemma foo248: "P --> P" by auto
-lemma foo249: "P --> P" by auto
-lemma foo250: "P --> P" by auto
-lemma foo251: "P --> P" by auto
-lemma foo252: "P --> P" by auto
-lemma foo253: "P --> P" by auto
-lemma foo254: "P --> P" by auto
-lemma foo255: "P --> P" by auto
-lemma foo256: "P --> P" by auto
-lemma foo257: "P --> P" by auto
-lemma foo258: "P --> P" by auto
-lemma foo259: "P --> P" by auto
-lemma foo260: "P --> P" by auto
-lemma foo261: "P --> P" by auto
-lemma foo262: "P --> P" by auto
-lemma foo263: "P --> P" by auto
-lemma foo264: "P --> P" by auto
-lemma foo265: "P --> P" by auto
-lemma foo266: "P --> P" by auto
-lemma foo267: "P --> P" by auto
-lemma foo268: "P --> P" by auto
-lemma foo269: "P --> P" by auto
-lemma foo270: "P --> P" by auto
-lemma foo271: "P --> P" by auto
-lemma foo272: "P --> P" by auto
-lemma foo273: "P --> P" by auto
-lemma foo274: "P --> P" by auto
-lemma foo275: "P --> P" by auto
-lemma foo276: "P --> P" by auto
-lemma foo277: "P --> P" by auto
-lemma foo278: "P --> P" by auto
-lemma foo279: "P --> P" by auto
-lemma foo280: "P --> P" by auto
-lemma foo281: "P --> P" by auto
-lemma foo282: "P --> P" by auto
-lemma foo283: "P --> P" by auto
-lemma foo284: "P --> P" by auto
-lemma foo285: "P --> P" by auto
-lemma foo286: "P --> P" by auto
-lemma foo287: "P --> P" by auto
-lemma foo288: "P --> P" by auto
-lemma foo289: "P --> P" by auto
-lemma foo290: "P --> P" by auto
-lemma foo291: "P --> P" by auto
-lemma foo292: "P --> P" by auto
-lemma foo293: "P --> P" by auto
-lemma foo294: "P --> P" by auto
-lemma foo295: "P --> P" by auto
-lemma foo296: "P --> P" by auto
-lemma foo297: "P --> P" by auto
-lemma foo298: "P --> P" by auto
-lemma foo299: "P --> P" by auto
-lemma foo300: "P --> P" by auto
-lemma foo301: "P --> P" by auto
-lemma foo302: "P --> P" by auto
-lemma foo303: "P --> P" by auto
-lemma foo304: "P --> P" by auto
-lemma foo305: "P --> P" by auto
-lemma foo306: "P --> P" by auto
-lemma foo307: "P --> P" by auto
-lemma foo308: "P --> P" by auto
-lemma foo309: "P --> P" by auto
-lemma foo310: "P --> P" by auto
-lemma foo311: "P --> P" by auto
-lemma foo312: "P --> P" by auto
-lemma foo313: "P --> P" by auto
-lemma foo314: "P --> P" by auto
-lemma foo315: "P --> P" by auto
-lemma foo316: "P --> P" by auto
-lemma foo317: "P --> P" by auto
-lemma foo318: "P --> P" by auto
-lemma foo319: "P --> P" by auto
-lemma foo320: "P --> P" by auto
-lemma foo321: "P --> P" by auto
-lemma foo322: "P --> P" by auto
-lemma foo323: "P --> P" by auto
-lemma foo324: "P --> P" by auto
-lemma foo325: "P --> P" by auto
-lemma foo326: "P --> P" by auto
-lemma foo327: "P --> P" by auto
-lemma foo328: "P --> P" by auto
-lemma foo329: "P --> P" by auto
-lemma foo330: "P --> P" by auto
-lemma foo331: "P --> P" by auto
-lemma foo332: "P --> P" by auto
-lemma foo333: "P --> P" by auto
-lemma foo334: "P --> P" by auto
-lemma foo335: "P --> P" by auto
-lemma foo336: "P --> P" by auto
-lemma foo337: "P --> P" by auto
-lemma foo338: "P --> P" by auto
-lemma foo339: "P --> P" by auto
-lemma foo340: "P --> P" by auto
-lemma foo341: "P --> P" by auto
-lemma foo342: "P --> P" by auto
-lemma foo343: "P --> P" by auto
-lemma foo344: "P --> P" by auto
-lemma foo345: "P --> P" by auto
-lemma foo346: "P --> P" by auto
-lemma foo347: "P --> P" by auto
-lemma foo348: "P --> P" by auto
-lemma foo349: "P --> P" by auto
-lemma foo350: "P --> P" by auto
-lemma foo351: "P --> P" by auto
-lemma foo352: "P --> P" by auto
-lemma foo353: "P --> P" by auto
-lemma foo354: "P --> P" by auto
-lemma foo355: "P --> P" by auto
-lemma foo356: "P --> P" by auto
-lemma foo357: "P --> P" by auto
-lemma foo358: "P --> P" by auto
-lemma foo359: "P --> P" by auto
-lemma foo360: "P --> P" by auto
-lemma foo361: "P --> P" by auto
-lemma foo362: "P --> P" by auto
-lemma foo363: "P --> P" by auto
-lemma foo364: "P --> P" by auto
-lemma foo365: "P --> P" by auto
-lemma foo366: "P --> P" by auto
-lemma foo367: "P --> P" by auto
-lemma foo368: "P --> P" by auto
-lemma foo369: "P --> P" by auto
-lemma foo370: "P --> P" by auto
-lemma foo371: "P --> P" by auto
-lemma foo372: "P --> P" by auto
-lemma foo373: "P --> P" by auto
-lemma foo374: "P --> P" by auto
-lemma foo375: "P --> P" by auto
-lemma foo376: "P --> P" by auto
-lemma foo377: "P --> P" by auto
-lemma foo378: "P --> P" by auto
-lemma foo379: "P --> P" by auto
-lemma foo380: "P --> P" by auto
-lemma foo381: "P --> P" by auto
-lemma foo382: "P --> P" by auto
-lemma foo383: "P --> P" by auto
-lemma foo384: "P --> P" by auto
-lemma foo385: "P --> P" by auto
-lemma foo386: "P --> P" by auto
-lemma foo387: "P --> P" by auto
-lemma foo388: "P --> P" by auto
-lemma foo389: "P --> P" by auto
-lemma foo390: "P --> P" by auto
-lemma foo391: "P --> P" by auto
-lemma foo392: "P --> P" by auto
-lemma foo393: "P --> P" by auto
-lemma foo394: "P --> P" by auto
-lemma foo395: "P --> P" by auto
-lemma foo396: "P --> P" by auto
-lemma foo397: "P --> P" by auto
-lemma foo398: "P --> P" by auto
-lemma foo399: "P --> P" by auto
-lemma foo400: "P --> P" by auto
-lemma foo401: "P --> P" by auto
-lemma foo402: "P --> P" by auto
-lemma foo403: "P --> P" by auto
-lemma foo404: "P --> P" by auto
-lemma foo405: "P --> P" by auto
-lemma foo406: "P --> P" by auto
-lemma foo407: "P --> P" by auto
-lemma foo408: "P --> P" by auto
-lemma foo409: "P --> P" by auto
-lemma foo410: "P --> P" by auto
-lemma foo411: "P --> P" by auto
-lemma foo412: "P --> P" by auto
-lemma foo413: "P --> P" by auto
-lemma foo414: "P --> P" by auto
-lemma foo415: "P --> P" by auto
-lemma foo416: "P --> P" by auto
-lemma foo417: "P --> P" by auto
-lemma foo418: "P --> P" by auto
-lemma foo419: "P --> P" by auto
-lemma foo420: "P --> P" by auto
-lemma foo421: "P --> P" by auto
-lemma foo422: "P --> P" by auto
-lemma foo423: "P --> P" by auto
-lemma foo424: "P --> P" by auto
-lemma foo425: "P --> P" by auto
-lemma foo426: "P --> P" by auto
-lemma foo427: "P --> P" by auto
-lemma foo428: "P --> P" by auto
-lemma foo429: "P --> P" by auto
-lemma foo430: "P --> P" by auto
-lemma foo431: "P --> P" by auto
-lemma foo432: "P --> P" by auto
-lemma foo433: "P --> P" by auto
-lemma foo434: "P --> P" by auto
-lemma foo435: "P --> P" by auto
-lemma foo436: "P --> P" by auto
-lemma foo437: "P --> P" by auto
-lemma foo438: "P --> P" by auto
-lemma foo439: "P --> P" by auto
-lemma foo440: "P --> P" by auto
-lemma foo441: "P --> P" by auto
-lemma foo442: "P --> P" by auto
-lemma foo443: "P --> P" by auto
-lemma foo444: "P --> P" by auto
-lemma foo445: "P --> P" by auto
-lemma foo446: "P --> P" by auto
-lemma foo447: "P --> P" by auto
-lemma foo448: "P --> P" by auto
-lemma foo449: "P --> P" by auto
-lemma foo450: "P --> P" by auto
-lemma foo451: "P --> P" by auto
-lemma foo452: "P --> P" by auto
-lemma foo453: "P --> P" by auto
-lemma foo454: "P --> P" by auto
-lemma foo455: "P --> P" by auto
-lemma foo456: "P --> P" by auto
-lemma foo457: "P --> P" by auto
-lemma foo458: "P --> P" by auto
-lemma foo459: "P --> P" by auto
-lemma foo460: "P --> P" by auto
-lemma foo461: "P --> P" by auto
-lemma foo462: "P --> P" by auto
-lemma foo463: "P --> P" by auto
-lemma foo464: "P --> P" by auto
-lemma foo465: "P --> P" by auto
-lemma foo466: "P --> P" by auto
-lemma foo467: "P --> P" by auto
-lemma foo468: "P --> P" by auto
-lemma foo469: "P --> P" by auto
-lemma foo470: "P --> P" by auto
-lemma foo471: "P --> P" by auto
-lemma foo472: "P --> P" by auto
-lemma foo473: "P --> P" by auto
-lemma foo474: "P --> P" by auto
-lemma foo475: "P --> P" by auto
-lemma foo476: "P --> P" by auto
-lemma foo477: "P --> P" by auto
-lemma foo478: "P --> P" by auto
-lemma foo479: "P --> P" by auto
-lemma foo480: "P --> P" by auto
-lemma foo481: "P --> P" by auto
-lemma foo482: "P --> P" by auto
-lemma foo483: "P --> P" by auto
-lemma foo484: "P --> P" by auto
-lemma foo485: "P --> P" by auto
-lemma foo486: "P --> P" by auto
-lemma foo487: "P --> P" by auto
-lemma foo488: "P --> P" by auto
-lemma foo489: "P --> P" by auto
-lemma foo490: "P --> P" by auto
-lemma foo491: "P --> P" by auto
-lemma foo492: "P --> P" by auto
-lemma foo493: "P --> P" by auto
-lemma foo494: "P --> P" by auto
-lemma foo495: "P --> P" by auto
-lemma foo496: "P --> P" by auto
-lemma foo497: "P --> P" by auto
-lemma foo498: "P --> P" by auto
-lemma foo499: "P --> P" by auto
-lemma foo500: "P --> P" by auto
-(*lemma foo500: "P --> P" by auto *)
-lemma foo501: "P --> P" by auto
-lemma foo502: "P --> P" by auto
-lemma foo503: "P --> P" by auto
-lemma foo504: "P --> P" by auto
-lemma foo505: "P --> P" by auto
-lemma foo506: "P --> P" by auto
-lemma foo507: "P --> P" by auto
-lemma foo508: "P --> P" by auto
-lemma foo509: "P --> P" by auto
-lemma foo510: "P --> P" by auto
-lemma foo511: "P --> P" by auto
-lemma foo512: "P --> P" by auto
-lemma foo513: "P --> P" by auto
-lemma foo514: "P --> P" by auto
-lemma foo515: "P --> P" by auto
-lemma foo516: "P --> P" by auto
-lemma foo517: "P --> P" by auto
-lemma foo518: "P --> P" by auto
-lemma foo519: "P --> P" by auto
-lemma foo520: "P --> P" by auto
-lemma foo521: "P --> P" by auto
-lemma foo522: "P --> P" by auto
-lemma foo523: "P --> P" by auto
-lemma foo524: "P --> P" by auto
-lemma foo525: "P --> P" by auto
-lemma foo526: "P --> P" by auto
-lemma foo527: "P --> P" by auto
-lemma foo528: "P --> P" by auto
-lemma foo529: "P --> P" by auto
-lemma foo530: "P --> P" by auto
-lemma foo531: "P --> P" by auto
-lemma foo532: "P --> P" by auto
-lemma foo533: "P --> P" by auto
-lemma foo534: "P --> P" by auto
-lemma foo535: "P --> P" by auto
-lemma foo536: "P --> P" by auto
-lemma foo537: "P --> P" by auto
-lemma foo538: "P --> P" by auto
-lemma foo539: "P --> P" by auto
-lemma foo540: "P --> P" by auto
-lemma foo541: "P --> P" by auto
-lemma foo542: "P --> P" by auto
-lemma foo543: "P --> P" by auto
-lemma foo544: "P --> P" by auto
-lemma foo545: "P --> P" by auto
-lemma foo546: "P --> P" by auto
-lemma foo547: "P --> P" by auto
-lemma foo548: "P --> P" by auto
-lemma foo549: "P --> P" by auto
-lemma foo550: "P --> P" by auto
-lemma foo551: "P --> P" by auto
-lemma foo552: "P --> P" by auto
-lemma foo553: "P --> P" by auto
-lemma foo554: "P --> P" by auto
-lemma foo555: "P --> P" by auto
-lemma foo556: "P --> P" by auto
-lemma foo557: "P --> P" by auto
-lemma foo558: "P --> P" by auto
-lemma foo559: "P --> P" by auto
-lemma foo560: "P --> P" by auto
-lemma foo561: "P --> P" by auto
-lemma foo562: "P --> P" by auto
-lemma foo563: "P --> P" by auto
-lemma foo564: "P --> P" by auto
-lemma foo565: "P --> P" by auto
-lemma foo566: "P --> P" by auto
-lemma foo567: "P --> P" by auto
-lemma foo568: "P --> P" by auto
-lemma foo569: "P --> P" by auto
-lemma foo570: "P --> P" by auto
-lemma foo571: "P --> P" by auto
-lemma foo572: "P --> P" by auto
-lemma foo573: "P --> P" by auto
-lemma foo574: "P --> P" by auto
-lemma foo575: "P --> P" by auto
-lemma foo576: "P --> P" by auto
-lemma foo577: "P --> P" by auto
-lemma foo578: "P --> P" by auto
-lemma foo579: "P --> P" by auto
-lemma foo580: "P --> P" by auto
-lemma foo581: "P --> P" by auto
-lemma foo582: "P --> P" by auto
-lemma foo583: "P --> P" by auto
-lemma foo584: "P --> P" by auto
-lemma foo585: "P --> P" by auto
-lemma foo586: "P --> P" by auto
-lemma foo587: "P --> P" by auto
-lemma foo588: "P --> P" by auto
-lemma foo589: "P --> P" by auto
-lemma foo590: "P --> P" by auto
-lemma foo591: "P --> P" by auto
-lemma foo592: "P --> P" by auto
-lemma foo593: "P --> P" by auto
-lemma foo594: "P --> P" by auto
-lemma foo595: "P --> P" by auto
-lemma foo596: "P --> P" by auto
-lemma foo597: "P --> P" by auto
-lemma foo598: "P --> P" by auto
-lemma foo599: "P --> P" by auto
-lemma foo600: "P --> P" by auto
-lemma foo601: "P --> P" by auto
-lemma foo602: "P --> P" by auto
-lemma foo603: "P --> P" by auto
-lemma foo604: "P --> P" by auto
-lemma foo605: "P --> P" by auto
-lemma foo606: "P --> P" by auto
-lemma foo607: "P --> P" by auto
-lemma foo608: "P --> P" by auto
-lemma foo609: "P --> P" by auto
-lemma foo610: "P --> P" by auto
-lemma foo611: "P --> P" by auto
-lemma foo612: "P --> P" by auto
-lemma foo613: "P --> P" by auto
-lemma foo614: "P --> P" by auto
-lemma foo615: "P --> P" by auto
-lemma foo616: "P --> P" by auto
-lemma foo617: "P --> P" by auto
-lemma foo618: "P --> P" by auto
-lemma foo619: "P --> P" by auto
-lemma foo620: "P --> P" by auto
-lemma foo621: "P --> P" by auto
-lemma foo622: "P --> P" by auto
-lemma foo623: "P --> P" by auto
-lemma foo624: "P --> P" by auto
-lemma foo625: "P --> P" by auto
-lemma foo626: "P --> P" by auto
-lemma foo627: "P --> P" by auto
-lemma foo628: "P --> P" by auto
-lemma foo629: "P --> P" by auto
-lemma foo630: "P --> P" by auto
-lemma foo631: "P --> P" by auto
-lemma foo632: "P --> P" by auto
-lemma foo633: "P --> P" by auto
-lemma foo634: "P --> P" by auto
-lemma foo635: "P --> P" by auto
-lemma foo636: "P --> P" by auto
-lemma foo637: "P --> P" by auto
-lemma foo638: "P --> P" by auto
-lemma foo639: "P --> P" by auto
-lemma foo640: "P --> P" by auto
-lemma foo641: "P --> P" by auto
-lemma foo642: "P --> P" by auto
-lemma foo643: "P --> P" by auto
-lemma foo644: "P --> P" by auto
-lemma foo645: "P --> P" by auto
-lemma foo646: "P --> P" by auto
-lemma foo647: "P --> P" by auto
-lemma foo648: "P --> P" by auto
-lemma foo649: "P --> P" by auto
-lemma foo650: "P --> P" by auto
-lemma foo651: "P --> P" by auto
-lemma foo652: "P --> P" by auto
-lemma foo653: "P --> P" by auto
-lemma foo654: "P --> P" by auto
-lemma foo655: "P --> P" by auto
-lemma foo656: "P --> P" by auto
-lemma foo657: "P --> P" by auto
-lemma foo658: "P --> P" by auto
-lemma foo659: "P --> P" by auto
-lemma foo660: "P --> P" by auto
-lemma foo661: "P --> P" by auto
-lemma foo662: "P --> P" by auto
-lemma foo663: "P --> P" by auto
-lemma foo664: "P --> P" by auto
-lemma foo665: "P --> P" by auto
-lemma foo666: "P --> P" by auto
-lemma foo667: "P --> P" by auto
-lemma foo668: "P --> P" by auto
-lemma foo669: "P --> P" by auto
-lemma foo670: "P --> P" by auto
-lemma foo671: "P --> P" by auto
-lemma foo672: "P --> P" by auto
-lemma foo673: "P --> P" by auto
-lemma foo674: "P --> P" by auto
-lemma foo675: "P --> P" by auto
-lemma foo676: "P --> P" by auto
-lemma foo677: "P --> P" by auto
-lemma foo678: "P --> P" by auto
-lemma foo679: "P --> P" by auto
-lemma foo680: "P --> P" by auto
-lemma foo681: "P --> P" by auto
-lemma foo682: "P --> P" by auto
-lemma foo683: "P --> P" by auto
-lemma foo684: "P --> P" by auto
-lemma foo685: "P --> P" by auto
-lemma foo686: "P --> P" by auto
-lemma foo687: "P --> P" by auto
-lemma foo688: "P --> P" by auto
-lemma foo689: "P --> P" by auto
-lemma foo690: "P --> P" by auto
-lemma foo691: "P --> P" by auto
-lemma foo692: "P --> P" by auto
-lemma foo693: "P --> P" by auto
-lemma foo694: "P --> P" by auto
-lemma foo695: "P --> P" by auto
-lemma foo696: "P --> P" by auto
-lemma foo697: "P --> P" by auto
-lemma foo698: "P --> P" by auto
-lemma foo699: "P --> P" by auto
-lemma foo700: "P --> P" by auto
-lemma foo701: "P --> P" by auto
-lemma foo702: "P --> P" by auto
-lemma foo703: "P --> P" by auto
-lemma foo704: "P --> P" by auto
-lemma foo705: "P --> P" by auto
-lemma foo706: "P --> P" by auto
-lemma foo707: "P --> P" by auto
-lemma foo708: "P --> P" by auto
-lemma foo709: "P --> P" by auto
-lemma foo710: "P --> P" by auto
-lemma foo711: "P --> P" by auto
-lemma foo712: "P --> P" by auto
-lemma foo713: "P --> P" by auto
-lemma foo714: "P --> P" by auto
-lemma foo715: "P --> P" by auto
-lemma foo716: "P --> P" by auto
-lemma foo717: "P --> P" by auto
-lemma foo718: "P --> P" by auto
-lemma foo719: "P --> P" by auto
-lemma foo720: "P --> P" by auto
-lemma foo721: "P --> P" by auto
-lemma foo722: "P --> P" by auto
-lemma foo723: "P --> P" by auto
-lemma foo724: "P --> P" by auto
-lemma foo725: "P --> P" by auto
-lemma foo726: "P --> P" by auto
-lemma foo727: "P --> P" by auto
-lemma foo728: "P --> P" by auto
-lemma foo729: "P --> P" by auto
-lemma foo730: "P --> P" by auto
-lemma foo731: "P --> P" by auto
-lemma foo732: "P --> P" by auto
-lemma foo733: "P --> P" by auto
-lemma foo734: "P --> P" by auto
-lemma foo735: "P --> P" by auto
-lemma foo736: "P --> P" by auto
-lemma foo737: "P --> P" by auto
-lemma foo738: "P --> P" by auto
-lemma foo739: "P --> P" by auto
-lemma foo740: "P --> P" by auto
-lemma foo741: "P --> P" by auto
-lemma foo742: "P --> P" by auto
-lemma foo743: "P --> P" by auto
-lemma foo744: "P --> P" by auto
-lemma foo745: "P --> P" by auto
-lemma foo746: "P --> P" by auto
-lemma foo747: "P --> P" by auto
-lemma foo748: "P --> P" by auto
-lemma foo749: "P --> P" by auto
-lemma foo750: "P --> P" by auto
-lemma foo751: "P --> P" by auto
-lemma foo752: "P --> P" by auto
-lemma foo753: "P --> P" by auto
-lemma foo754: "P --> P" by auto
-lemma foo755: "P --> P" by auto
-lemma foo756: "P --> P" by auto
-lemma foo757: "P --> P" by auto
-lemma foo758: "P --> P" by auto
-lemma foo759: "P --> P" by auto
-lemma foo760: "P --> P" by auto
-lemma foo761: "P --> P" by auto
-lemma foo762: "P --> P" by auto
-lemma foo763: "P --> P" by auto
-lemma foo764: "P --> P" by auto
-lemma foo765: "P --> P" by auto
-lemma foo766: "P --> P" by auto
-lemma foo767: "P --> P" by auto
-lemma foo768: "P --> P" by auto
-lemma foo769: "P --> P" by auto
-lemma foo770: "P --> P" by auto
-lemma foo771: "P --> P" by auto
-lemma foo772: "P --> P" by auto
-lemma foo773: "P --> P" by auto
-lemma foo774: "P --> P" by auto
-lemma foo775: "P --> P" by auto
-lemma foo776: "P --> P" by auto
-lemma foo777: "P --> P" by auto
-lemma foo778: "P --> P" by auto
-lemma foo779: "P --> P" by auto
-lemma foo780: "P --> P" by auto
-lemma foo781: "P --> P" by auto
-lemma foo782: "P --> P" by auto
-lemma foo783: "P --> P" by auto
-lemma foo784: "P --> P" by auto
-lemma foo785: "P --> P" by auto
-lemma foo786: "P --> P" by auto
-lemma foo787: "P --> P" by auto
-lemma foo788: "P --> P" by auto
-lemma foo789: "P --> P" by auto
-lemma foo790: "P --> P" by auto
-lemma foo791: "P --> P" by auto
-lemma foo792: "P --> P" by auto
-lemma foo793: "P --> P" by auto
-lemma foo794: "P --> P" by auto
-lemma foo795: "P --> P" by auto
-lemma foo796: "P --> P" by auto
-lemma foo797: "P --> P" by auto
-lemma foo798: "P --> P" by auto
-lemma foo799: "P --> P" by auto
-lemma foo800: "P --> P" by auto
-lemma foo801: "P --> P" by auto
-lemma foo802: "P --> P" by auto
-lemma foo803: "P --> P" by auto
-lemma foo804: "P --> P" by auto
-lemma foo805: "P --> P" by auto
-lemma foo806: "P --> P" by auto
-lemma foo807: "P --> P" by auto
-lemma foo808: "P --> P" by auto
-lemma foo809: "P --> P" by auto
-lemma foo810: "P --> P" by auto
-lemma foo811: "P --> P" by auto
-lemma foo812: "P --> P" by auto
-lemma foo813: "P --> P" by auto
-lemma foo814: "P --> P" by auto
-lemma foo815: "P --> P" by auto
-lemma foo816: "P --> P" by auto
-lemma foo817: "P --> P" by auto
-lemma foo818: "P --> P" by auto
-lemma foo819: "P --> P" by auto
-lemma foo820: "P --> P" by auto
-lemma foo821: "P --> P" by auto
-lemma foo822: "P --> P" by auto
-lemma foo823: "P --> P" by auto
-lemma foo824: "P --> P" by auto
-lemma foo825: "P --> P" by auto
-lemma foo826: "P --> P" by auto
-lemma foo827: "P --> P" by auto
-lemma foo828: "P --> P" by auto
-lemma foo829: "P --> P" by auto
-lemma foo830: "P --> P" by auto
-lemma foo831: "P --> P" by auto
-lemma foo832: "P --> P" by auto
-lemma foo833: "P --> P" by auto
-lemma foo834: "P --> P" by auto
-lemma foo835: "P --> P" by auto
-lemma foo836: "P --> P" by auto
-lemma foo837: "P --> P" by auto
-lemma foo838: "P --> P" by auto
-lemma foo839: "P --> P" by auto
-lemma foo840: "P --> P" by auto
-lemma foo841: "P --> P" by auto
-lemma foo842: "P --> P" by auto
-lemma foo843: "P --> P" by auto
-lemma foo844: "P --> P" by auto
-lemma foo845: "P --> P" by auto
-lemma foo846: "P --> P" by auto
-lemma foo847: "P --> P" by auto
-lemma foo848: "P --> P" by auto
-lemma foo849: "P --> P" by auto
-lemma foo850: "P --> P" by auto
-lemma foo851: "P --> P" by auto
-lemma foo852: "P --> P" by auto
-lemma foo853: "P --> P" by auto
-lemma foo854: "P --> P" by auto
-lemma foo855: "P --> P" by auto
-lemma foo856: "P --> P" by auto
-lemma foo857: "P --> P" by auto
-lemma foo858: "P --> P" by auto
-lemma foo859: "P --> P" by auto
-lemma foo860: "P --> P" by auto
-lemma foo861: "P --> P" by auto
-lemma foo862: "P --> P" by auto
-lemma foo863: "P --> P" by auto
-lemma foo864: "P --> P" by auto
-lemma foo865: "P --> P" by auto
-lemma foo866: "P --> P" by auto
-lemma foo867: "P --> P" by auto
-lemma foo868: "P --> P" by auto
-lemma foo869: "P --> P" by auto
-lemma foo870: "P --> P" by auto
-lemma foo871: "P --> P" by auto
-lemma foo872: "P --> P" by auto
-lemma foo873: "P --> P" by auto
-lemma foo874: "P --> P" by auto
-lemma foo875: "P --> P" by auto
-lemma foo876: "P --> P" by auto
-lemma foo877: "P --> P" by auto
-lemma foo878: "P --> P" by auto
-lemma foo879: "P --> P" by auto
-lemma foo880: "P --> P" by auto
-lemma foo881: "P --> P" by auto
-lemma foo882: "P --> P" by auto
-lemma foo883: "P --> P" by auto
-lemma foo884: "P --> P" by auto
-lemma foo885: "P --> P" by auto
-lemma foo886: "P --> P" by auto
-lemma foo887: "P --> P" by auto
-lemma foo888: "P --> P" by auto
-lemma foo889: "P --> P" by auto
-lemma foo890: "P --> P" by auto
-lemma foo891: "P --> P" by auto
-lemma foo892: "P --> P" by auto
-lemma foo893: "P --> P" by auto
-lemma foo894: "P --> P" by auto
-lemma foo895: "P --> P" by auto
-lemma foo896: "P --> P" by auto
-lemma foo897: "P --> P" by auto
-lemma foo898: "P --> P" by auto
-lemma foo899: "P --> P" by auto
-lemma foo900: "P --> P" by auto
-lemma foo901: "P --> P" by auto
-lemma foo902: "P --> P" by auto
-lemma foo903: "P --> P" by auto
-lemma foo904: "P --> P" by auto
-lemma foo905: "P --> P" by auto
-lemma foo906: "P --> P" by auto
-lemma foo907: "P --> P" by auto
-lemma foo908: "P --> P" by auto
-lemma foo909: "P --> P" by auto
-lemma foo910: "P --> P" by auto
-lemma foo911: "P --> P" by auto
-lemma foo912: "P --> P" by auto
-lemma foo913: "P --> P" by auto
-lemma foo914: "P --> P" by auto
-lemma foo915: "P --> P" by auto
-lemma foo916: "P --> P" by auto
-lemma foo917: "P --> P" by auto
-lemma foo918: "P --> P" by auto
-lemma foo919: "P --> P" by auto
-lemma foo920: "P --> P" by auto
-lemma foo921: "P --> P" by auto
-lemma foo922: "P --> P" by auto
-lemma foo923: "P --> P" by auto
-lemma foo924: "P --> P" by auto
-lemma foo925: "P --> P" by auto
-lemma foo926: "P --> P" by auto
-lemma foo927: "P --> P" by auto
-lemma foo928: "P --> P" by auto
-lemma foo929: "P --> P" by auto
-lemma foo930: "P --> P" by auto
-lemma foo931: "P --> P" by auto
-lemma foo932: "P --> P" by auto
-lemma foo933: "P --> P" by auto
-lemma foo934: "P --> P" by auto
-lemma foo935: "P --> P" by auto
-lemma foo936: "P --> P" by auto
-lemma foo937: "P --> P" by auto
-lemma foo938: "P --> P" by auto
-lemma foo939: "P --> P" by auto
-lemma foo940: "P --> P" by auto
-lemma foo941: "P --> P" by auto
-lemma foo942: "P --> P" by auto
-lemma foo943: "P --> P" by auto
-lemma foo944: "P --> P" by auto
-lemma foo945: "P --> P" by auto
-lemma foo946: "P --> P" by auto
-lemma foo947: "P --> P" by auto
-lemma foo948: "P --> P" by auto
-lemma foo949: "P --> P" by auto
-lemma foo950: "P --> P" by auto
-lemma foo951: "P --> P" by auto
-lemma foo952: "P --> P" by auto
-lemma foo953: "P --> P" by auto
-lemma foo954: "P --> P" by auto
-lemma foo955: "P --> P" by auto
-lemma foo956: "P --> P" by auto
-lemma foo957: "P --> P" by auto
-lemma foo958: "P --> P" by auto
-lemma foo959: "P --> P" by auto
-lemma foo960: "P --> P" by auto
-lemma foo961: "P --> P" by auto
-lemma foo962: "P --> P" by auto
-lemma foo963: "P --> P" by auto
-lemma foo964: "P --> P" by auto
-lemma foo965: "P --> P" by auto
-lemma foo966: "P --> P" by auto
-lemma foo967: "P --> P" by auto
-lemma foo968: "P --> P" by auto
-lemma foo969: "P --> P" by auto
-lemma foo970: "P --> P" by auto
-lemma foo971: "P --> P" by auto
-lemma foo972: "P --> P" by auto
-lemma foo973: "P --> P" by auto
-lemma foo974: "P --> P" by auto
-lemma foo975: "P --> P" by auto
-lemma foo976: "P --> P" by auto
-lemma foo977: "P --> P" by auto
-lemma foo978: "P --> P" by auto
-lemma foo979: "P --> P" by auto
-lemma foo980: "P --> P" by auto
-lemma foo981: "P --> P" by auto
-lemma foo982: "P --> P" by auto
-lemma foo983: "P --> P" by auto
-lemma foo984: "P --> P" by auto
-lemma foo985: "P --> P" by auto
-lemma foo986: "P --> P" by auto
-lemma foo987: "P --> P" by auto
-lemma foo988: "P --> P" by auto
-lemma foo989: "P --> P" by auto
-lemma foo990: "P --> P" by auto
-lemma foo991: "P --> P" by auto
-lemma foo992: "P --> P" by auto
-lemma foo993: "P --> P" by auto
-lemma foo994: "P --> P" by auto
-lemma foo995: "P --> P" by auto
-lemma foo996: "P --> P" by auto
-lemma foo997: "P --> P" by auto
-lemma foo998: "P --> P" by auto
-lemma foo999: "P --> P" by auto
-lemma foo1000: "P --> P" by auto
-
-ML {* warning (Timing.message (Timing.result start)) *}
-(* ELISP: -- (message "Time taken: %f seconds" (time-to-seconds (time-since 
start))) -- *)
-
-end
-
diff --git a/etc/isar/BackslashInStrings.thy b/etc/isar/BackslashInStrings.thy
deleted file mode 100644
index 2161ed8aab..0000000000
--- a/etc/isar/BackslashInStrings.thy
+++ /dev/null
@@ -1,47 +0,0 @@
-theory BackslashInStrings imports Main begin
-
-consts test :: string
-
-(*
-
-10.8.04  NB: Isar currently sets \ as word constituent ("w").
-Isabelle sets it as a punctuation element (".").
-
-Experiments:  (modify-syntax-entry ?\\ "w")
-             (modify-syntax-entry ?\\ ".")
-
-(add-hook 'isar-mode-hook
-  (lambda () (modify-syntax-entry ?\\ "\\")))
-*)
-
-defs test_def: "test == ''System.out.println(\"List from here:\")''"
-
-
-end 
-
-
-
-(*
-
-I'd be grateful for a little help in solving a bug/issue that I'm encountering 
in using Proof General with strings. It appears that Isar doesn't correctly 
understand Isabelle strings correctly.
-
-He's an example theory that throws up the observed issues:
-
-theory Test = Main:
-
-consts test :: string
-
-defs test_def: "test == ''System.out.println(\"List from here:\")''"
-
-end
-
-Firstly, anything between escaped double quotes is incorrectly highlighted.
-
-This is benign, unless an Isar keyword occurs between the double quotes (eg. 
from). In this case, Isabelle throws an error when it trys to parse the 
Isabelle term - mainly, it appears, because Isar/Proof General has passed 
Isabelle an incorrect term.
-
-I presume there's some Proof General regular expression that needs modifying 
here?
-
-Any help in fixing the issue is greatly appreciated.
-
-Thanks,
-*)
diff --git a/etc/isar/BigErrors.thy b/etc/isar/BigErrors.thy
deleted file mode 100644
index 0dd41e4256..0000000000
--- a/etc/isar/BigErrors.thy
+++ /dev/null
@@ -1,20 +0,0 @@
-(* See http://proofgeneral.inf.ed.ac.uk/trac/ticket/274 *)
-
-theory BigErrors imports Pure 
-begin
-
-consts foo :: 'a
-consts bar :: 'a
-
-ML {* warning (cat_lines (replicate 300 "This is a big warning message")); *}
-
-(* Attempt to get a big error with "error" fails, but we can use printing 
function
-   (see FaultyErrors.thy) *)
-
-ML {* Output.error_msg (cat_lines (replicate 10000 "This is a big error 
message")); *}
-
-(* Note about FaultyErrors: the above generates an error
-   interactively but does *not* generate an error when 
-   required by another theory, see, BigErrorsNested *)
-
-end
diff --git a/etc/isar/BigErrorsNested.thy b/etc/isar/BigErrorsNested.thy
deleted file mode 100644
index 69fa7142ee..0000000000
--- a/etc/isar/BigErrorsNested.thy
+++ /dev/null
@@ -1,6 +0,0 @@
-(* See http://proofgeneral.inf.ed.ac.uk/trac/ticket/274 *)
-
-theory BigErrorsNested imports BigErrors 
-begin
-
-end
diff --git a/etc/isar/ChosenLogic.thy b/etc/isar/ChosenLogic.thy
deleted file mode 100644
index 67b164d070..0000000000
--- a/etc/isar/ChosenLogic.thy
+++ /dev/null
@@ -1,8 +0,0 @@
-(* -*- isabelle-chosen-logic: "ZF" -*- *)
-
-theory ChosenLogic imports Main_ZFC
-begin
-
-end
-
-
diff --git a/etc/isar/ChosenLogic2.thy b/etc/isar/ChosenLogic2.thy
deleted file mode 100644
index a7a6c9343a..0000000000
--- a/etc/isar/ChosenLogic2.thy
+++ /dev/null
@@ -1,8 +0,0 @@
-(* -*- isabelle-chosen-logic: "HOL" -*- *)
-
-theory ChosenLogic2 imports HOL
-begin
-
-end
-
-
diff --git a/etc/isar/CommentParsingBug.thy b/etc/isar/CommentParsingBug.thy
deleted file mode 100644
index 0da1575dc6..0000000000
--- a/etc/isar/CommentParsingBug.thy
+++ /dev/null
@@ -1,3 +0,0 @@
-(**)(**)
-theory CommentParsingBug imports Main begin
-
diff --git a/etc/isar/CommentParsingBug2.thy b/etc/isar/CommentParsingBug2.thy
deleted file mode 100644
index a7bcba2b51..0000000000
--- a/etc/isar/CommentParsingBug2.thy
+++ /dev/null
@@ -1,8 +0,0 @@
-(* Tobias reported 24.1.03.  Could not repeat prob *)
-theory CommentParsingBug2 imports Main begin
-
-(*
-defs
-*)
-
-end
diff --git a/etc/isar/Depends.thy b/etc/isar/Depends.thy
deleted file mode 100644
index 2d13c0f486..0000000000
--- a/etc/isar/Depends.thy
+++ /dev/null
@@ -1,14 +0,0 @@
-(* In order to test the latest thm deps setup, consider this example: *)
-
-theory Depends imports Main begin
-
-  lemma I: "A ==> A" and K: "A ==> B ==> A" .
-
-(*
-This reports I, K depending on several things; for your internal
-dependency graph you may interpret this as each member of {I, K} depending
-on all the deps.
-*)
-
-end
-
diff --git a/etc/isar/EmptyCommands.thy b/etc/isar/EmptyCommands.thy
deleted file mode 100644
index f361ecca65..0000000000
--- a/etc/isar/EmptyCommands.thy
+++ /dev/null
@@ -1,10 +0,0 @@
-(* See Trac #289, http://proofgeneral.inf.ed.ac.uk/trac/ticket/289 *)
-theory EmptyCommands imports Main begin
-
-term x;
-
-term y;
-
-; ;
-
-end
diff --git a/etc/isar/FaultyErrors.thy b/etc/isar/FaultyErrors.thy
deleted file mode 100644
index 5106ce75bc..0000000000
--- a/etc/isar/FaultyErrors.thy
+++ /dev/null
@@ -1,28 +0,0 @@
-theory FaultyErrors imports Main
-begin
-
-lemma foo: "P --> P" by auto
-
-ML {* Output.error_msg "Fake error"; *} (* now *not* an error *)
-ML {* error "Real error" :unit; *}      (* a true error, command fails *)
-
-(* After an error message, the system wrongly thinks the
-   command has succeeded, currently 03.01.07.
-   This means that undo>redo fails.  
-   
-   This happens immediately after processing to the error and undoing
-   all the way back: redoing "theory" in Eclipse fails, because <undostep> is
-   used each time, and it doesn't get far enough.  Repeating theory gives
-   the error "can't use theory in theory mode".
-     
-   The lemma helps exercise the case that <abortheory> is used
-   to undo the theory quickly (as it should be, and as it is in
-   Emacs, by looking at the buffer), which fixes the "theory" redo.  
-   
-    1. Do until error
-    2. Undo to before lemma
-    3. Redo should not give warning message "foo is already defined".
-    
-   Now fixed for Eclipse and Emacs in Isabelle >=03.01.07.
-*)   
-end
diff --git a/etc/isar/Fibonacci.thy b/etc/isar/Fibonacci.thy
deleted file mode 100644
index d26f3af3eb..0000000000
--- a/etc/isar/Fibonacci.thy
+++ /dev/null
@@ -1,168 +0,0 @@
-(*  Copied from Isabelle2011-1/src/HOL/Isar_examples/ *)
-
-(*  Title:      HOL/Isar_Examples/Fibonacci.thy
-    Author:     Gertrud Bauer
-    Copyright   1999 Technische Universitaet Muenchen
-
-The Fibonacci function.  Demonstrates the use of recdef.  Original
-tactic script by Lawrence C Paulson.
-
-Fibonacci numbers: proofs of laws taken from
-
-  R. L. Graham, D. E. Knuth, O. Patashnik.
-  Concrete Mathematics.
-  (Addison-Wesley, 1989)
-*)
-
-header {* Fib and Gcd commute *}
-
-theory Fibonacci
-imports "~~/src/HOL/Number_Theory/Primes"
-begin
-
-text_raw {* \footnote{Isar version by Gertrud Bauer.  Original tactic
-  script by Larry Paulson.  A few proofs of laws taken from
-  \cite{Concrete-Math}.} *}
-
-
-declare One_nat_def [simp]
-
-
-subsection {* Fibonacci numbers *}
-
-fun fib :: "nat \<Rightarrow> nat" where
-  "fib 0 = 0"
-| "fib (Suc 0) = 1"
-| "fib (Suc (Suc x)) = fib x + fib (Suc x)"
-
-lemma [simp]: "fib (Suc n) > 0"
-  by (induct n rule: fib.induct) simp_all
-
-
-text {* Alternative induction rule. *}
-
-theorem fib_induct:
-    "P 0 ==> P 1 ==> (!!n. P (n + 1) ==> P n ==> P (n + 2)) ==> P (n::nat)"
-  by (induct rule: fib.induct) simp_all
-
-
-subsection {* Fib and gcd commute *}
-
-text {* A few laws taken from \cite{Concrete-Math}. *}
-
-lemma fib_add:
-  "fib (n + k + 1) = fib (k + 1) * fib (n + 1) + fib k * fib n"
-  (is "?P n")
-  -- {* see \cite[page 280]{Concrete-Math} *}
-proof (induct n rule: fib_induct)
-  show "?P 0" by simp
-  show "?P 1" by simp
-  fix n
-  have "fib (n + 2 + k + 1)
-    = fib (n + k + 1) + fib (n + 1 + k + 1)" by simp
-  also assume "fib (n + k + 1)
-    = fib (k + 1) * fib (n + 1) + fib k * fib n"
-      (is " _ = ?R1")
-  also assume "fib (n + 1 + k + 1)
-    = fib (k + 1) * fib (n + 1 + 1) + fib k * fib (n + 1)"
-      (is " _ = ?R2")
-  also have "?R1 + ?R2
-    = fib (k + 1) * fib (n + 2 + 1) + fib k * fib (n + 2)"
-    by (simp add: add_mult_distrib2)
-  finally show "?P (n + 2)" .
-qed
-
-lemma gcd_fib_Suc_eq_1: "gcd (fib n) (fib (n + 1)) = 1" (is "?P n")
-proof (induct n rule: fib_induct)
-  show "?P 0" by simp
-  show "?P 1" by simp
-  fix n
-  have "fib (n + 2 + 1) = fib (n + 1) + fib (n + 2)"
-    by simp
-  also have "... = fib (n + 2) + fib (n + 1)" by simp
-  also have "gcd (fib (n + 2)) ... = gcd (fib (n + 2)) (fib (n + 1))"
-    by (rule gcd_add2_nat)
-  also have "... = gcd (fib (n + 1)) (fib (n + 1 + 1))"
-    by (simp add: gcd_commute_nat)
-  also assume "... = 1"
-  finally show "?P (n + 2)" .
-qed
-
-lemma gcd_mult_add: "(0::nat) < n ==> gcd (n * k + m) n = gcd m n"
-proof -
-  assume "0 < n"
-  then have "gcd (n * k + m) n = gcd n (m mod n)"
-    by (simp add: gcd_non_0_nat add_commute)
-  also from `0 < n` have "... = gcd m n" by (simp add: gcd_non_0_nat)
-  finally show ?thesis .
-qed
-
-lemma gcd_fib_add: "gcd (fib m) (fib (n + m)) = gcd (fib m) (fib n)"
-proof (cases m)
-  case 0
-  then show ?thesis by simp
-next
-  case (Suc k)
-  then have "gcd (fib m) (fib (n + m)) = gcd (fib (n + k + 1)) (fib (k + 1))"
-    by (simp add: gcd_commute_nat)
-  also have "fib (n + k + 1)
-      = fib (k + 1) * fib (n + 1) + fib k * fib n"
-    by (rule fib_add)
-  also have "gcd ... (fib (k + 1)) = gcd (fib k * fib n) (fib (k + 1))"
-    by (simp add: gcd_mult_add)
-  also have "... = gcd (fib n) (fib (k + 1))"
-    by (simp only: gcd_fib_Suc_eq_1 gcd_mult_cancel_nat)
-  also have "... = gcd (fib m) (fib n)"
-    using Suc by (simp add: gcd_commute_nat)
-  finally show ?thesis .
-qed
-
-lemma gcd_fib_diff:
-  assumes "m <= n"
-  shows "gcd (fib m) (fib (n - m)) = gcd (fib m) (fib n)"
-proof -
-  have "gcd (fib m) (fib (n - m)) = gcd (fib m) (fib (n - m + m))"
-    by (simp add: gcd_fib_add)
-  also from `m <= n` have "n - m + m = n" by simp
-  finally show ?thesis .
-qed
-
-lemma gcd_fib_mod:
-  assumes "0 < m"
-  shows "gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)"
-proof (induct n rule: nat_less_induct)
-  case (1 n) note hyp = this
-  show ?case
-  proof -
-    have "n mod m = (if n < m then n else (n - m) mod m)"
-      by (rule mod_if)
-    also have "gcd (fib m) (fib ...) = gcd (fib m) (fib n)"
-    proof (cases "n < m")
-      case True then show ?thesis by simp
-    next
-      case False then have "m <= n" by simp
-      from `0 < m` and False have "n - m < n" by simp
-      with hyp have "gcd (fib m) (fib ((n - m) mod m))
-          = gcd (fib m) (fib (n - m))" by simp
-      also have "... = gcd (fib m) (fib n)"
-        using `m <= n` by (rule gcd_fib_diff)
-      finally have "gcd (fib m) (fib ((n - m) mod m)) =
-          gcd (fib m) (fib n)" .
-      with False show ?thesis by simp
-    qed
-    finally show ?thesis .
-  qed
-qed
-
-theorem fib_gcd: "fib (gcd m n) = gcd (fib m) (fib n)" (is "?P m n")
-proof (induct m n rule: gcd_nat_induct)
-  fix m show "fib (gcd m 0) = gcd (fib m) (fib 0)" by simp
-  fix n :: nat assume n: "0 < n"
-  then have "gcd m n = gcd n (m mod n)" by (simp add: gcd_non_0_nat)
-  also assume hyp: "fib ... = gcd (fib n) (fib (m mod n))"
-  also from n have "... = gcd (fib n) (fib m)" by (rule gcd_fib_mod)
-  also have "... = gcd (fib m) (fib n)" by (rule gcd_commute_nat)
-  finally show "fib (gcd m n) = gcd (fib m) (fib n)" .
-qed
-
-end
diff --git a/etc/isar/HighlightSize.thy b/etc/isar/HighlightSize.thy
deleted file mode 100644
index 7c68b74fbd..0000000000
--- a/etc/isar/HighlightSize.thy
+++ /dev/null
@@ -1,13 +0,0 @@
-(* See: http://proofgeneral.inf.ed.ac.uk/trac/ticket/266 *)
-
-theory HighlightSize imports Main
-begin
-
-lemmas rules = sym refl trans sym refl trans sym refl trans sym refl trans sym 
refl trans
-
-ML_command {* Pretty.writeln (Pretty.markup Markup.hilite
-  [Proof_Context.pretty_fact @{context} ("foo", @{thms rules(1-14)})]) *}
-
-end
-
-
diff --git a/etc/isar/IllegalEscape.thy b/etc/isar/IllegalEscape.thy
deleted file mode 100644
index 3478830b66..0000000000
--- a/etc/isar/IllegalEscape.thy
+++ /dev/null
@@ -1,7 +0,0 @@
-(* See http://proofgeneral.inf.ed.ac.uk/trac/ticket/166 *)
-
-theory IllegalEscape imports Main begin
-
-    lemma X: "a=b ==> b=a" by simp -- "Text with \illegal escape sequence"
-      oops
-end 
diff --git a/etc/isar/InterruptTest.thy.gz b/etc/isar/InterruptTest.thy.gz
deleted file mode 100644
index 4f21806179..0000000000
Binary files a/etc/isar/InterruptTest.thy.gz and /dev/null differ
diff --git a/etc/isar/MultipleModes.thy b/etc/isar/MultipleModes.thy
deleted file mode 100644
index 7e5525708b..0000000000
--- a/etc/isar/MultipleModes.thy
+++ /dev/null
@@ -1,27 +0,0 @@
-header {* Some tests for \textbf{multiple modes!!} *}
-
-theory MultipleModes imports Main begin
-
-text {* Proper proof text -- \textit{naive version}. *}
-
-theorem and_comms: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then
-   show ?thesis ..
- qed
-qed
-
-ML {*
-  fun fact 0 = 1 
-    | fact n = n * (fact (n-1))
-
-  val x = 7; 
-*}
-
-end
-
-
diff --git a/etc/isar/NamesInStrings.thy b/etc/isar/NamesInStrings.thy
deleted file mode 100644
index 366b9a2a5e..0000000000
--- a/etc/isar/NamesInStrings.thy
+++ /dev/null
@@ -1,34 +0,0 @@
-theory "Names In Strings" imports Main begin   (* NB: must also check case 
without quotes! *)
-
-lemma foo: "B --> B" by auto
-
-lemma "foo bar": "B --> B" by auto
-
-lemma "foo-wiggle-bar": "B --> B" by auto
-
-theorem "x b": "B --> B" by auto
-
-(* NB: various other regexps and settings based on them are sensitive
-   to grouping in isar-name-regexp: should check function menu, imenu,
-   as well as undo behaviour. *)
-
-end
-
-
-(*
-
-I noticed the following minor problem with Isabelle and 
-ProofGeneral:
-
-
->>   theory "a" = Main:
->>   Proof General -> Use -> Retract:
->>   *** Outer syntax error: end of input expected,
->>   *** but identifier "a" was found
-
-Regards,
-Tjark
-
-*)
-
-
diff --git a/etc/isar/Parsing.thy b/etc/isar/Parsing.thy
deleted file mode 100644
index 98e8819e80..0000000000
--- a/etc/isar/Parsing.thy
+++ /dev/null
@@ -1,75 +0,0 @@
-(* Not really a theory of parsing, but a test of Proof General's
-   parsing for Isabelle/Isar.... *)
-
-(* First, start with successive comments before a real command *)
-
-theory Parsing imports Main begin
-
-(* Then a comment *after* a command.  Also one which mentions
-   the names of commands, such as theory or theorem or proof itself,
-   never mind thus assume end qed. *)
-
-(* At the moment, successive comments are amalgamated, and comments
-   following commands are wrapped into the command (so cannot be
-   hidden). *)
-
-text {* Isar theories can have arbitrary literal text,
-          so the text must be ignored as well; thus. *}
-
-(* Those pieces of literal text are treated as another kind
-   of comment. What gets slight risky is when they're
-   text {* nested one inside the other. *}.
-   If Emacs confuses the two kinds of sequence, then
-   this can go wrong.
-*)
-
-text {* nesting (* may be the other way around *) *}
-
-(* The main type of comment (* may be nested *)
-   just like in SML. GNU Emacs [21.1] supports this now, nicely,
-   but XEmacs [21.4.8] doesn't, so colouration goes wrong.  
-   If there are any command names inside this comment
-   (e.g. theorem), it breaks the parser in XEmacs. 
-   [ To process this in XEmacs, delete "thxxrem" above, C-c C-n, C-x u ]
-*)
-
-(* Let's do my favourite proof. *)
-
-theorem and_comms: "A & B --> B & A"
-proof
-  assume "A & B"  (* it's "important" that we test "strings" I guess *)
-  then show "B & A"
-  proof
-    assume B A (* blah boo bah *)
-    then show ?thesis (* bah boo bah *)
-      ..
-  qed
-qed
-
-(* Another thing: nesting with { and } can be tricky. *)
-
-theorem and_comms_again: "A & B --> B & A"
-proof
-  assume "A & B" 
-  then show "B & A"
-  proof
-    {
-      assume B A
-      then show ?thesis
-       ..
-    }
-  qed
-qed
-
-(* Now the end of file is coming up.  Funny things happen
-   because PG only knows how commands start, not how they end.
-*)
-
-end
-(* That's the final command and it includes any text which follows it.
-   An oddity is that if there is a syntax error - unclosed comment
-   or whatever, after the last end, PG will say that it can't find
-   a complete command! 
-
-   Another oddity with comments at the end: these are left as "commands". *)
-
diff --git a/etc/isar/ParsingBug1.thy b/etc/isar/ParsingBug1.thy
deleted file mode 100644
index e56a5ae9b8..0000000000
--- a/etc/isar/ParsingBug1.thy
+++ /dev/null
@@ -1,15 +0,0 @@
-(* 
-  This is a small test case for parsing the { nested proof } phrase.
-
-  This case causes problems with the new parsing mechanism, see
-  comments in isar/isar-syntax.el and generic/proof-script.el
-*)
-  
-
-theory ParsingBug1 imports Main begin
-
-theorem "P"
-proof -
-  assume a: "Q"
-  {fix i have "Q" sorry}
-qed
diff --git a/etc/isar/Persistent.thy b/etc/isar/Persistent.thy
deleted file mode 100644
index 8a04288662..0000000000
--- a/etc/isar/Persistent.thy
+++ /dev/null
@@ -1,40 +0,0 @@
-(* 
-
-We now support persistent Isabelle sessions with Proof General, preserving
-the state of loaded theories (before I used to have a few explicit
-``bombs'' to prevent this).  When saying ``Exit Isabelle/Isar'' the image
-is committed back.  It's not possible to go continue partially processed
-theory buffer, but users could expect to have a fully processed theory
-stored properly.  The latter requires scripting to be disabled first, in
-order to inform the process to store the finished theory.
-
-To spare users to think about this, the ``Exit Isabelle/Isar''
-operation disables scripting automatically.
-
-Produce a writable Isabelle session like this:
-
-  isabelle -q HOL Foo
-
-Now start PG and start a process with the Foo logic image.
-
-Tests:
-
-  Process this file, exit, start.  
-  Unprocess, exit, start.              [FAILS with Isabelle2002]
-
-*)
-
-
-theory Persistent imports Main begin
-
-theorem and_comms: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume B and A
-    then show ?thesis ..
-  qed
-qed
-
-end
diff --git a/etc/isar/README b/etc/isar/README
deleted file mode 100644
index b2f5ffb297..0000000000
--- a/etc/isar/README
+++ /dev/null
@@ -1,8 +0,0 @@
-bad1.thy:
-  Bug test case: parser would silently skip bad command "foo".
-  Resolved as of 13.9.00
-
-bad2.thy:
-  Bug test case: synchronization problem on starting Isar process,
-  doesn't catch the first error.
-  Resolved as of 17.9.00
diff --git a/etc/isar/Sendback.thy b/etc/isar/Sendback.thy
deleted file mode 100644
index c77e90bac1..0000000000
--- a/etc/isar/Sendback.thy
+++ /dev/null
@@ -1,23 +0,0 @@
-(* $Id$ *)
-
-header {* Demonstrate the use of literal command markup *}
-
-theory Sendback imports Main begin
-
-ML {*
-fun sendback cmd = ProofGeneral.sendback "Try this:" [Pretty.str cmd]
-fun sendback2 cmd1 cmd2 =
-  writeln ("Try: " ^ (Markup.markup Markup.sendback cmd1) ^ " or " ^
-                    (Markup.markup Markup.sendback cmd2))
-*}
-
-theorem and_comms: "A & B --> B & A"
-proof
-  ML_command {* sendback "assume \"A & B\"" *}
-  ML_command {* sendback "show \"B & A\"" *}
-  ML_command {* sendback2 "proof assume B and A then" 
-                         "proof assume A and B then" *}
-  ML_command {* sendback "show ?thesis .. qed" *}
-  ML_command {* sendback "qed" *}
-qed
-
diff --git a/etc/isar/TextProps.thy b/etc/isar/TextProps.thy
deleted file mode 100644
index 6c5b4b8895..0000000000
--- a/etc/isar/TextProps.thy
+++ /dev/null
@@ -1,22 +0,0 @@
-theory TextProps imports Main begin
-
-(* Note: nesting regions shows up possible text property 
-   merging problem inside Emacs/font-lock
-
-   \<^bbold>Bold and \<^bitalic>italic\<^eitalic>\<^ebold>
-
-   ;; good, desirable property value for 'face 
-   (append '(:slant italic) '(:weight bold font-lock-string-face))
-   (:slant italic :weight bold font-lock-string-face)
-
-   ;; bad, value obtained with font-lock-{append/prepend}-property:
-   (append '(:slant italic) '((:weight bold font-lock-string-face)))
-   (:slant italic (:weight bold font-lock-string-face))
-
-   For now we work around this in unicode-tokens 
-   (see unicode-tokens-prepend-text-properties)
-*)
-
-term "\<^bbold>Bold and \<^bitalic>italic\<^eitalic>\<^ebold>"
-
-end
diff --git a/etc/isar/TokensAcid.thy b/etc/isar/TokensAcid.thy
deleted file mode 100644
index 1759718117..0000000000
--- a/etc/isar/TokensAcid.thy
+++ /dev/null
@@ -1,218 +0,0 @@
-(* 
-   Some acid tests for token modes in Isabelle
-   David Aspinall, 2008-9.
-   $Id$
-
-   Note:
-    Unicode Tokens mode works much better in Emacs 23 than 22.
-
-   jEdit properties :tabSize=8:indentSize=8:noTabs=false:
-*)
-
-theory TokensAcid imports Main 
-begin
-
-(* Symbols.
-
-   Here's a table of all the standardly defined tokens for symbols,
-   produced by menu command Tokens -> List Tokens
-
-   You should see glyphs in all positions except the whitespace
-   tokens at positions 208, 262 and 263.
- 
-   I recommend using StixGeneral for symbols.
-   See http://www.stixfonts.org/
-   To install on Ubuntu, try:  
-
-         sudo apt-get install fonts-stix
-
-   Other good choices are: Lucida Grande, Lucida Sans Unicode, 
-   or DejaVuLGC Sans Mono.
-
-   Unfortunately 
-
-
- 1.  \<leftarrow>      \<rightarrow>   \<Leftarrow>    \<Rightarrow>   
\<leftrightarrow>       \<Leftrightarrow>       \<mapsto>       
\<longleftarrow>        \<Longleftarrow>        \<longrightarrow>
- 2.  \<Longrightarrow> \<longleftrightarrow>   \<Longleftrightarrow>   
\<longmapsto>   \<midarrow>     \<Midarrow>     \<hookleftarrow>        
\<hookrightarrow>       \<leftharpoondown>      \<rightharpoondown>
- 3.  \<leftharpoonup>  \<rightharpoonup>       \<rightleftharpoons>    
\<leadsto>      \<downharpoonleft>      \<downharpoonright>     
\<upharpoonleft>        \<upharpoonright>       \<restriction>  \<Colon>
- 4.  \<up>     \<Up>   \<down> \<Down> \<updown>       \<Updown>       
\<langle>       \<rangle>       \<lceil>        \<rceil>
- 5.  \<lfloor> \<rfloor>       \<lparr>        \<rparr>        \<lbrakk>       
\<rbrakk>       \<lbrace>       \<rbrace>       \<guillemotleft>        
\<guillemotright>
- 6.  \<bottom> \<top>  \<and>  \<And>  \<or>   \<Or>   \<forall>       
\<exists>       \<nexists>      \<not>
- 7.  \<box>    \<diamond>      \<turnstile>    \<Turnstile>    \<tturnstile>   
\<TTurnstile>   \<stileturn>    \<surd> \<le>   \<ge>
- 8.  \<lless>  \<ggreater>     \<lesssim>      \<greatersim>   \<lessapprox>   
\<greaterapprox>        \<in>   \<notin>        \<subset>       \<supset>
- 9.  \<subseteq>       \<supseteq>     \<sqsubset>     \<sqsupset>     
\<sqsubseteq>   \<sqsupseteq>   \<inter>        \<Inter>        \<union>        
\<Union>
-10.  \<squnion>        \<Squnion>      \<sqinter>      \<Sqinter>      
\<setminus>     \<propto>       \<uplus>        \<Uplus>        \<noteq>        
\<sim>
-11.  \<doteq>  \<simeq>        \<approx>       \<asymp>        \<cong> 
\<smile>        \<equiv>        \<frown>        \<Join> \<bowtie>
-12.  \<prec>   \<succ> \<preceq>       \<succeq>       \<parallel>     \<bar>  
\<plusminus>    \<minusplus>    \<times>        \<div>
-13.  \<cdot>   \<star> \<bullet>       \<circ> \<dagger>       \<ddagger>      
\<lhd>  \<rhd>  \<unlhd>        \<unrhd>
-14.  \<triangleleft>   \<triangleright>        \<triangle>     \<triangleq>    
\<oplus>        \<Oplus>        \<otimes>       \<Otimes>       \<odot> \<Odot>
-15.  \<ominus> \<oslash>       \<dots> \<cdots>        \<Sum>  \<Prod> 
\<Coprod>       \<infinity>     \<integral>     \<ointegral>
-16.  \<clubsuit>       \<diamondsuit>  \<heartsuit>    \<spadesuit>    
\<aleph>        \<emptyset>     \<nabla>        \<partial>      \<Re>   \<Im>
-17.  \<flat>   \<natural>      \<sharp>        \<angle>        \<copyright>    
\<registered>   \<hyphen>       \<inverse>      \<onesuperior>  \<twosuperior>
-18.  \<threesuperior>  \<onequarter>   \<onehalf>      \<threequarters>        
\<ordmasculine> \<ordfeminine>  \<section>      \<paragraph>    \<exclamdown>   
\<questiondown>
-19.  \<euro>   \<pounds>       \<yen>  \<cent> \<currency>     \<degree>       
\<amalg>        \<mho>  \<lozenge>      \<wp>
-20.  \<wrong>  \<struct>       \<acute>        \<index>        \<dieresis>     
\<cedilla>      \<hungarumlaut> \<spacespace>   \<module>       \<some>
-21.  \<stareq> \<defeq>        \<questioneq>   \<vartheta>     \<varpi>        
\<varrho>       \<varsigma>     \<varphi>       \<hbar> \<ell>
-22.  \<ast>    \<bigcirc>      \<bigtriangleup>        \<bigtriangledown>      
\<ni>   \<mid>  \<notlt>        \<notle>        \<notprec>      \<notpreceq>
-23.  \<notsubset>      \<notsubseteq>  \<notsqsubseteq>        \<notgt>        
\<notge>        \<notsucc>      \<notsucceq>    \<notsupset>    \<notsupseteq>  
\<notsqsupseteq>
-24.  \<notequiv>       \<notsim>       \<notsimeq>     \<notapprox>    
\<notcong>      \<notasymp>     \<nearrow>      \<searrow>      \<swarrow>      
\<nwarrow>
-25.  \<vdots>  \<ddots>        \<closequote>   \<openquote>    \<opendblquote> 
\<closedblquote>        \<emdash>       \<prime>        \<doubleprime>  
\<tripleprime>
-26.  \<quadrupleprime> \<nbspace>      \<thinspace>    \<notni>        
\<colonequals>  \<foursuperior> \<fivesuperior> \<sixsuperior>  
\<sevensuperior>        \<eightsuperior>
-27.  \<ninesuperior>   \<bool> \<complex>      \<nat>  \<rat>  \<real> \<int>  
\<alpha>        \<beta> \<gamma>
-28.  \<delta>  \<epsilon>      \<zeta> \<eta>  \<theta>        \<iota> 
\<kappa>        \<lambda>       \<mu>   \<nu>
-29.  \<xi>     \<pi>   \<rho>  \<sigma>        \<tau>  \<upsilon>      \<phi>  
\<chi>  \<psi>  \<omega>
-30.  \<Gamma>  \<Delta>        \<Theta>        \<Lambda>       \<Xi>   \<Pi>   
\<Sigma>        \<Upsilon>      \<Phi>  \<Psi>
-31.  \<Omega>  \<zero> \<one>  \<two>  \<three>        \<four> \<five> \<six>  
\<seven>        \<eight>
-32.  \<nine>   \<A>    \<B>    \<C>    \<D>    \<E>    \<F>    \<G>    \<H>    
\<I>
-33.  \<J>      \<K>    \<L>    \<M>    \<N>    \<O>    \<P>    \<Q>    \<R>    
\<S>
-34.  \<T>      \<U>    \<V>    \<W>    \<X>    \<Y>    \<Z>    \<a>    \<b>    
\<c>
-35.  \<d>      \<e>    \<f>    \<g>    \<h>    \<i>    \<j>    \<k>    \<l>    
\<m>
-36.  \<n>      \<o>    \<p>    \<q>    \<r>    \<s>    \<t>    \<u>    \<v>    
\<w>
-37.  \<x>      \<y>    \<z>    \<AA>   \<BB>   \<CC>   \<DD>   \<EE>   \<FF>   
\<GG>
-38.  \<HH>     \<II>   \<JJ>   \<KK>   \<LL>   \<MM>   \<NN>   \<OO>   \<PP>   
\<QQ>
-39.  \<RR>     \<SS>   \<TT>   \<UU>   \<VV>   \<WW>   \<XX>   \<YY>   \<ZZ>   
\<aa>
-40.  \<bb>     \<cc>   \<dd>   \<ee>   \<ff>   \<gg>   \<hh>   \<ii>   \<jj>   
\<kk>
-41.  \<ll>     \<mm>   \<nn>   \<oo>   \<pp>   \<qq>   \<rr>   \<ss>   \<tt>   
\<uu>
-42.  \<vv>     \<ww>   \<xx>   \<yy>   \<zz>                                   
 
-*)
-
-(* Tokens controlling layout and fonts: regions.
-
-   Token region convention in Isabelle is \<^bFOO>... \<^eFOO>
-  
-   The \<^bserif>font\<^eserif> and 
\<^bbold>bold\<^ebold>/\<^bitalic>italic\<^eitalic> controls are non-standard 
and
-   may not be supported by other interfaces.
-
-   Convenience functions:
-     Select a region, use Tokens -> Format Region -> Bold, etc
-  
-   Editing can be a bit fiddly, use C-c C-t C-t to show or hide
-   the control tokens to help.
-*)  
-
-(* Introduce uninterpreted term syntax using these features,
-   to check behaviour in locked/unlocked regions. *)
-
-consts longsub :: "['a,'a]\<Rightarrow>'a" ("_\<^bsub>_\<^esub>")
-consts longsup :: "['a,'a]\<Rightarrow>'a" ("_\<^bsup>_\<^esup>")
-
-consts bold    :: "'a\<Rightarrow>'a" ("\<^bbold>_\<^ebold>")
-consts italic  :: "'a\<Rightarrow>'a" ("\<^bitalic>_\<^eitalic>")
-consts sans    :: "'a\<Rightarrow>'a" ("\<^bsans>_\<^esans>")
-consts script  :: "'a\<Rightarrow>'a" ("\<^bscript>_\<^escript>")
-consts frakt   :: "'a\<Rightarrow>'a" ("\<^bfrakt>_\<^efrakt>")
-consts serif   :: "'a\<Rightarrow>'a" ("\<^bserif>_\<^eserif>")
-
-term "a\<^bsub>longsub\<^esub>"   term "b\<^bsup>longsuper\<^esup>"
-
-term "\<^bbold>Bold text\<^ebold>"  term "\<^bitalic>Italic text \<alpha> 
\<beta>\<^eitalic>"  
-term "\<^bsans>Sans \<gamma>\<^esans>"     term "\<^bscript>Script 
text\<^escript>"
-term "\<^bfrakt>Frakt stuff\<^efrakt>"  term "\<^bserif>Roman stuff\<^eserif>"
-   
-lemma "\<lbrakk> \<^bbold>(Bold text)\<^ebold>; Q \<rbrakk> \<Longrightarrow> 
Q"
-by auto
-
-(* Tokens controlling layout and fonts: next character.
-   These are tokens that affect the following character/identifier only.
-   Similar to previous case.
-
-   See Tokens -> Format Char -> ...
-*)
-
-consts shortsub :: "['a,'a]\<Rightarrow>'a" ("_\<^sub>_")
-consts shortsup :: "['a,'a]\<Rightarrow>'a" ("_\<^sup>_")
-
-consts charloc    :: "['a,'a]\<Rightarrow>'a" ("\<^loc>_")
-consts charbold   :: "['a,'a]\<Rightarrow>'a" ("\<^bold>_")
-consts charitalic :: "['a,'a]\<Rightarrow>'a" ("\<^italic>_")
-
-term "a\<^sub>b"
-term "a\<^sup>b"
-term "\<^loc>a"
-term "\<^bold>b"
-term "\<^italic>b"
-
-(* Further examples *)
-
-term "a\<^isub>\<gamma>\<delta>"     (* subscripted gamma  *)
-term "a\<^isub>def"  (* no subscript on ef *)
-
-term "a\<^isub>x\<^isub>y"      (* x and y subscripted individually *)
-term "a\<^isub>xabc\<^isub>y"   (* x and y should be subscripted, but not ab *)
-
-(* 
-   Variants on token names: different token names,
-   same appearance.   Simulated overloading, \<^bitalic>much\<^eitalic> 
simpler to do
-   this in the UI than mess with type classes, etc,
-   in the logical framework!
-
-   Demonstration: let's take back \<And> from the meta-level.
-
-   NB: the token scheme mechanism here is a PG convenience,
-   in other frontends you may have to define \ < AndX> to
-   appear in the same way as \ < And> individually.
-   Similarly for LaTeX output.
-
-   Use C-c C-t C-z to toggle the display of tokens.
-*)
-
-consts 
-   andprops :: "bool set \<Rightarrow> bool"      
-   andpreds :: "('a \<Rightarrow> bool) set \<Rightarrow> bool"   
-
-notation (xsymbols)
-   andprops ("\<And1>") and   (* token <And1>, hover to see this *)
-   andpreds ("\<And2>")       (* token <And2>, hover to see this *)
-
-term "\<And1> {True, False}"             
-term "\<And2> {\<lambda> x. True, \<lambda> y. False}"
-
-(* Note: of course, copy and paste using Unicode to another
-   application (Tokens \<rightarrow> Copy As Unicode) and then re-reading in
-   Isabelle using another interface will probably produce the wrong
-   result.  But copy-pasting within Proof General Emacs is fine since
-   the underlying token text is copied, not the presentation.
-   What happens is that the text properties are "sticky" and
-   copied as well, so you see them even in non-Unicode Tokens buffers.
-   But if you save and revisit, you'll see the real text.
-*)
-
-
-(* More esoteric non-standard stuff: unlikely in other interfaces *)
-
-consts 
-  shout :: "'a \<Rightarrow> 'a"
-  whisper :: "'a \<Rightarrow> 'a"
-  underline :: "'a \<Rightarrow> 'a"
-  overline :: "'a \<Rightarrow> 'a"
-
-notation (xsymbols)
-  shout ("\<^bbig>_\<^ebig>") and
-  whisper ("\<^bsmall>_\<^esmall>") and
-  underline ("\<^bunderline>_\<^eunderline>") and
-  overline ("\<^boverline>_\<^eoverline>")
-
-term "\<^bbig>large text \<alpha> \<beta> \<Sigma> \<integral>\<^ebig>"
-
-term "\<^bsmall>smaller text ((\<alpha> \<and> \<beta>) \<longrightarrow> 
\<gamma>) \<^esmall>"
-
-term "\<^bunderline>underlined\<^eunderline>"
-
-term "\<^boverline>overlined\<^eoverline>"
-
-
-(* Bold and italic combinations for regions *)
-term "\<^bbold>Bold and (\<^bitalic>italic\<^eitalic>)\<^ebold>"
-term "\<^bitalic>Italic and \<^bbold>bold\<^ebold>\<^eitalic>"
-
-(* Font and weight/shape changes for regions *)
-term "\<^bbold>Bold and \<^bscript>script\<^escript>\<^ebold>"
-term "\<^bserif>Roman and \<^bitalic>italic\<^eitalic> and 
\<^bbold>bold\<^ebold> \<^eserif>"
-term "\<^bfrakt>Frakt and \<^bitalic>italic\<^eitalic> and 
\<^bbold>bold\<^ebold> \<^efrakt>"
-
-(* Spanning identifier supers/subs: not included in standard Isabelle 
lexer/latex *)
-
-(* term "a\<^bisup>bcd\<^eisup>"
-   term "a\<^bisub>bcd\<^eisub>"  *)
-
-end
diff --git a/etc/isar/Trac189.thy b/etc/isar/Trac189.thy
deleted file mode 100644
index 43c4bdd430..0000000000
--- a/etc/isar/Trac189.thy
+++ /dev/null
@@ -1,8 +0,0 @@
-theory Trac189 imports Main begin
-
-
-(* Undoing of a diagnostic: exercises proof-no-command *)
-
-lemma "True"
-  apply (rule TrueI)
-  thm TrueI
diff --git a/etc/isar/Trac280-subrev.thy b/etc/isar/Trac280-subrev.thy
deleted file mode 100644
index ff392ec39f..0000000000
--- a/etc/isar/Trac280-subrev.thy
+++ /dev/null
@@ -1,14 +0,0 @@
-theory "Trac280-subrev" imports Main begin
-
-lemma 
- assumes asm: "P\<^isub>i \<and> Q\<^isub>i"
- shows "Q\<^isub>i \<and> P\<^isub>i"
-proof - 
-  from asm obtain "P\<^isub>i" and "Q\<^isub>i"
-    by blast
-  then show "Q\<^isub>i \<and> P\<^isub>i"
-    by simp
-qed
-
-end
-
diff --git a/etc/isar/Unicode.thy b/etc/isar/Unicode.thy
deleted file mode 100644
index 95140e6add..0000000000
--- a/etc/isar/Unicode.thy
+++ /dev/null
@@ -1,73 +0,0 @@
-(* -*- coding: utf-8 -*- *)
-
-(*
-  Example theory involving unicode characters (utf-8 encoding) -- both
-  formal and informal ones.
-*)
-
-theory Unicode
-imports Main
-begin
-
-text {* The Hebrew Alef-Bet (א-ב). *}
-
-datatype alef_bet =
-    Alef    ("א")
-  | Bet     ("ב")
-  | Gimel   ("ג")
-  | Dalet   ("ד")
-  | He      ("ה")
-  | Vav     ("ו")
-  | Zayin   ("ז")
-  | Het     ("ח")
-  | Tet     ("ט")
-  | Yod     ("י")
-  | Kaf     ("כ")
-  | Lamed   ("ל")
-  | Mem     ("מ")
-  | Nun     ("נ")
-  | Samekh  ("ס")
-  | Ayin    ("ע")
-  | Pe      ("פ")
-  | Tsadi   ("צ")
-  | Qof     ("ק")
-  | Resh    ("ר")
-  | Shin    ("ש")
-  | Tav     ("ת")
-
-thm alef_bet.induct
-
-
-text {* Interpreting Hebrew letters as numbers. *}
-
-primrec mispar :: "alef_bet => nat"
-where
-  "mispar א = 1"
-| "mispar ב = 2"
-| "mispar ג = 3"
-| "mispar ד = 4"
-| "mispar ה = 5"
-| "mispar ו = 6"
-| "mispar ז = 7"
-| "mispar ח = 8"
-| "mispar ט = 9"
-| "mispar י = 10"
-| "mispar כ = 20"
-| "mispar ל = 30"
-| "mispar מ = 40"
-| "mispar נ = 50"
-| "mispar ס = 60"
-| "mispar ע = 70"
-| "mispar פ = 80"
-| "mispar צ = 90"
-| "mispar ק = 100"
-| "mispar ר = 200"
-| "mispar ש = 300"
-| "mispar ת = 400"
-
-thm mispar.simps
-
-lemma "mispar ק + mispar ל + mispar ה = 135"
-  by simp
-
-end
diff --git a/etc/isar/XEmacsSyntacticContextProb.thy 
b/etc/isar/XEmacsSyntacticContextProb.thy
deleted file mode 100644
index ef295a93d5..0000000000
--- a/etc/isar/XEmacsSyntacticContextProb.thy
+++ /dev/null
@@ -1,20 +0,0 @@
-(* Demonstrates a bug with XEmacs 21.1: after procesing, between
-   two terms, buffer-syntactic-context returns "string".  
-   But _before_ processing, it correctly returns "nil".
-   Even when regions are removed, still get "string" returned
-   after processing started. 
-
-   Bug doesn't occur in GNU Emacs (using imp of buffer-syntactic context
-   provided in proof-compat.el), nor in XEmacs 21.4
-
-   Workaround added Fri Aug 10 13:55:28 BST 2001
-*)
-
-theory XEmacsSyntacticContextProb imports Main begin
-
-term "
-(f x)" 
-
-term "(f x)"
-
-end
diff --git a/etc/isar/XSymbolTests.thy b/etc/isar/XSymbolTests.thy
deleted file mode 100644
index 0425fc39c6..0000000000
--- a/etc/isar/XSymbolTests.thy
+++ /dev/null
@@ -1,146 +0,0 @@
-(* Some checks for Unicode Tokens behaviour.  
-
-   This file should be displayed sensibly, and also the
-   display back from Isabelle ought to match.
-
-   $Id$
-*)
-
-theory XSymbolTests imports Main begin
-
-(* Fri Dec 14 13:20:38 GMT 2007.
-   http://proofgeneral.inf.ed.ac.uk/trac/ticket/161
-   Sub/superscript output not handled properly when enabled using
-   menu.   Fix: add fontification to proof-x-symbol-decode-region,
-   fix in proof-x-symbol.el 8.10.
-*)
-
-(* response output *)
-thm wf_trancl
-
-(* goals output *)
-lemma wf_trancl2 : "wf ?r \<Longrightarrow> wf (?r\<^sup>+)"
-by auto
-
-(* Thu Sep 25 16:26:47 BST 2003.  
-   Problem reported by Norbert Schirmer <norbert.schirmer@web.de>
-   Currently, superscript output highlighting seems broken anyway? *)
-
-consts "\<alpha1>":: "'a => 'a" ("\<alpha1>\<^sup>_")
-consts "\<alpha2>":: "'a => 'a => 'a" ("\<alpha2>\<^sup>_")
-consts "\<alpha3>":: "'a => 'a => 'a => 'a" ("_\<^sup>_\<^sup>_")
-
-consts k:: 'a
-
-term "\<alpha>"
-term "a\<^sup>b" (* b should be a blue variable *)
-term "\<forall>x. a\<^sup>x" (* x should be a green bound variable *)
-term "a\<^sup>k" (* k should be a black constant *)
-term "\<alpha>\<^isub>2" (* alpha should be blue variable with subscripted 
blue 2 *)
-term "\<alpha>\<^isup>x"  (* identifier *)
-
-consts sausage:: "'a => 'a => 'a" ("_\<^bsup>_\<^esup>" [1000,1000] 1000)
-
-term "k\<^bsup>long\<^esup>"  (* k black, long is blue *)
-
-
-(* 28.8.02: bug in pg-remove-specials broke this; now fixed *)
-
-lemma "A ==> A" .  -- OK
-
-consts A :: bool
-lemma "A ==> A" .  -- "xsymbols should be displayed!"
-
-
-(* Test electric token input: writing a token 
-like \ <alpha>  (without space, \<alpha>) should immediately 
-replace it. *)
-
-constdefs
- P1 :: bool   ("P\<^sub>1")    (* subscript *)
- "P\<^sub>1 == True"
- P2 :: bool   ("P\<^sup>2")    (* superscript *)
- "P\<^sup>2 == True"
-
- "P\<^loc>x" (* location escape *)
-
-(* Buglet here: if we enable x-sym during scripting,
-   goals/response flks are not updated, so xsyms
-   do not appear in output windows. Stoping/starting
-   prover fixes.
-*)
-
-thm P1_def P2_def      (* check display from Isabelle *)
-
-constdefs (* long sub/sups, new 29/12/03, added by Gerwin Klein *)
-
-\<^bitalic>test italics\<^eitalic>
-\<^bserif>serif\<^eserif>
-\<^bfrakt>fraktur\<^efrakt>
-\<^bbold>test\<^ebold>
-
-\<^bsub> asda low\<^esub>
- Plow :: bool ("P\<^bsub>low\<^esub>")         (* spanning subscript *)
-  "P\<^bsub>low\<^esub> \<equiv> True"
- Phigh :: bool ("P\<^bsup>high\<^esup>")               (* spanning superscript 
*)
-  "P\<^bsup>high\<^esup> \<equiv> True"
-
-thm Plow_def Phigh_def (* check display from Isabelle *)
-
-theorem "P\<^sub>1 \<and> P\<^sup>2";  (* check fonts in goals window *)
-by (simp add: P1_def P2_def)  (* .. and response window *)
-
-consts
- "P\<^sup>\<alpha>" :: bool   (* superscript of a token char *)
- "\<^bold>P"  :: bool   (* bold character *)
- "\<^italic>i"  :: int 
-
-\<^bitalic>italic?\<^eitalic>
-
-(* test: using a symbol as a subscript *)
-(* 9.3.03: this causes nasty prob with pre-command hook,
-   x-symbol-invisitiblity-spec type error, at least
-   during editing. *)
-consts
- intof :: "nat \<Rightarrow> int"  ("_\<^sub>\<int>" 50)
- mynat :: nat ("\<gamma>")
-\<one> \<two> \<C> \<J>      \<S> \<h> h \<AA> 
-
-\<^bscript>foo\<^escript>
-bar
-
-term "intof 3"
-
-constdefs
- myint :: int
- "myint == \<gamma>\<^sub>\<int>"
- 
-
-(* 
- Another X-Symbol oddity: sometimes the _first_ buffer to
- be visited displays _some_ characters as \2xx, e.g.
- for \<circ>.  But subsequent buffers to be visited work
- fine.  Problem is stable for turning x-symbol on/off.
- Revisting the first buffer cures the problem.
- Update: May be inherent problem with non-Mule version of
- X-Symbol (CW suggests)
-*)
-
-consts
-  iter :: "('a => 'a) => nat => ('a => 'a)"
-primrec
-  "iter f 0 = id"
-  "iter f (Suc n) = f \<circ> (iter f n)"
-
-
-end
-
-\<A>
-\<AA> \<ABC> \<ss> \<pounds> \<yen>
-
-SYMBOL Ideas:
-
- \<0x888>  for unicode character
- \<alpha:foo> for variants, same display
-
- \<color:foo> for colour, no sems (dropped in translation)
\ No newline at end of file
diff --git a/etc/isar/bad1.thy b/etc/isar/bad1.thy
deleted file mode 100644
index a355389f16..0000000000
--- a/etc/isar/bad1.thy
+++ /dev/null
@@ -1,3 +0,0 @@
-(*foo*)
-foo
-end
diff --git a/etc/isar/bad2.thy b/etc/isar/bad2.thy
deleted file mode 100644
index 7a12fdb869..0000000000
--- a/etc/isar/bad2.thy
+++ /dev/null
@@ -1 +0,0 @@
-theory bad2 imports unknown begin
diff --git a/etc/isar/multiple/A.thy b/etc/isar/multiple/A.thy
deleted file mode 100644
index aac334a161..0000000000
--- a/etc/isar/multiple/A.thy
+++ /dev/null
@@ -1,7 +0,0 @@
-theory A imports Pure 
-begin
-
-consts foo :: 'a
-consts bar :: 'a
-
-end
diff --git a/etc/isar/multiple/B.thy b/etc/isar/multiple/B.thy
deleted file mode 100644
index efebff837b..0000000000
--- a/etc/isar/multiple/B.thy
+++ /dev/null
@@ -1,4 +0,0 @@
-theory B imports Pure
-begin
-
-end
diff --git a/etc/isar/multiple/C.thy b/etc/isar/multiple/C.thy
deleted file mode 100644
index 22d8685832..0000000000
--- a/etc/isar/multiple/C.thy
+++ /dev/null
@@ -1,4 +0,0 @@
-theory C imports A B
-begin
-
-end
diff --git a/etc/isar/multiple/D.thy b/etc/isar/multiple/D.thy
deleted file mode 100644
index 3c78e5426a..0000000000
--- a/etc/isar/multiple/D.thy
+++ /dev/null
@@ -1,4 +0,0 @@
-theory D imports Pure
-begin
-
-end
diff --git a/etc/isar/multiple/E.thy b/etc/isar/multiple/E.thy
deleted file mode 100644
index 02d6202022..0000000000
--- a/etc/isar/multiple/E.thy
+++ /dev/null
@@ -1,4 +0,0 @@
-theory E imports C D
-begin
-
-end
diff --git a/etc/isar/multiple/README b/etc/isar/multiple/README
deleted file mode 100644
index ad57b4497e..0000000000
--- a/etc/isar/multiple/README
+++ /dev/null
@@ -1,3 +0,0 @@
-
-Test files for multiple file handling with Isabelle/Isar
-(see also isa/multiple/README).
diff --git a/etc/isar/nesting-too-deep-for-parser.txt 
b/etc/isar/nesting-too-deep-for-parser.txt
deleted file mode 100644
index 580c6405d8..0000000000
--- a/etc/isar/nesting-too-deep-for-parser.txt
+++ /dev/null
@@ -1,1622 +0,0 @@
-Here is an example of some text which generates the "nesting too deep
-for parser" error message in XEmacs.  [da]
-
-Paste into the response buffer and do
-
- (proof-fontify-region (point-min) (point-max))
-
-Backtrace is this:
-
-  parse-partial-sexp(1 72319 nil nil nil syntax-table)
-  font-lock-fontify-syntactically-region(1 72319 nil)
-  font-lock-default-fontify-region(1 72319 nil)
-  (let ((font-lock-keywords proof-font-lock-keywords)) (if (and 
proof-running-on-XEmacs ... ... ...) (progn ... ...)) (save-restriction 
(narrow-to-region start end) (run-hooks ...) (setq end ...)) 
(font-lock-default-fontify-region start end nil))
-  (progn (proof-font-lock-set-font-lock-vars) (unless proof-running-on-XEmacs 
(font-lock-set-defaults)) (let (...) (if ... ...) (save-restriction ... ... 
...) (font-lock-default-fontify-region start end nil)))
-  (if proof-output-fontify-enable (progn (proof-font-lock-set-font-lock-vars) 
(unless proof-running-on-XEmacs ...) (let ... ... ... ...)))
-  proof-fontify-region(1 72319)
-
-How deep is too deep?
-
-
-  (parse-partial-sexp 1 72319 10)
-  (parse-partial-sexp 1 72319 20)
-  (parse-partial-sexp 1 72319 80)
-  (parse-partial-sexp 1 72319 99)     -- gets to char 51927
-  (parse-partial-sexp 1 72319 100)    -- Gives error on XEmacs 21.4.15 
-                                    -- still on
-    Value: "21.5  (beta17) \"chayote\" (+CVS-20040622) XEmacs Lucid"
-
-  (parse-partial-sexp 1 72319 200)    -- reaches end of this text at
-                                        depth 130 in Emacs 21.3.1
-
-In fact Emacs 21.3.1 isn't bothered by a buffer containing 40,000 left-parens.
-Bug report at bottom [23.6.04].
-
------------------
-
-
-"$ISATOOL" document -c -o 'ps' '/tmp/isabelle-da4586/document' 2>&1
-This is TeXk, Version 3.14159 (Web2C 7.4.5)
- %&-line parsing enabled.
-LaTeX2e <2001/06/01>
-Babel <v3.7h> and hyphenation patterns for american, french, german, ngerman, n
-ohyphenation, loaded.
-
-(./root.tex (/usr/share/texmf/tex/latex/base/article.cls
-Document Class: article 2001/04/21 v1.4e Standard LaTeX document class
-(/usr/share/texmf/tex/latex/base/size10.clo)) (./isabelle.sty)
-(./isabellesym.sty) (/usr/share/texmf/tex/latex/base/inputenc.sty
-(/usr/share/texmf/tex/latex/base/latin1.def)) (./pdfsetup.sty)
-(/usr/local/texmf.da/tex/latex/comisc/url.sty)
-(/usr/share/texmf/tex/latex/base/latexsym.sty)
-No file root.aux.
-(./session.tex (./HeapSortProofVCG.tex
-Overfull \hbox (14.09698pt too wide) in paragraph at lines 6--7
-[][]  \OT1/cmtt/m/sl/9 -- would be desirable to redesign CALLMP rule so that si
-de condition which[] 
-
-Overfull \hbox (42.44675pt too wide) in paragraph at lines 12--13
-[][]       \OT1/cmtt/m/sl/9 generates (variable number of) subgoals for each fu
-nction that is dominated
-(/usr/share/texmf/tex/latex/base/ulasy.fd)
-Overfull \hbox (23.5469pt too wide) in paragraph at lines 19--20
-[][]       \OT1/cmtt/m/sl/9 need to verify n+1, which leaves indeterminate numb
-er of side-condition
-
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 31--32
-[][]       \OT1/cmtt/m/sl/9 maybe a good idea to have a method for (each) primi
-tives, and then a
-
-Overfull \hbox (18.82195pt too wide) in paragraph at lines 32--33
-[][]       \OT1/cmtt/m/sl/9 let which does the composition on-the-fly  --- this
- avoids duplicating
-
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 35--36
-[][]        \OT1/cmtt/m/sl/9 -- define ML values bound to tactics appearing in 
-bodies of methods[] 
-
-Overfull \hbox (14.09698pt too wide) in paragraph at lines 47--48
-[][]\OT1/cmtt/m/sl/9 text {*This corresponds to the following specifications, f
-ormalised from the
-
-Overfull \hbox (14.09698pt too wide) in paragraph at lines 48--49
-[][]       \OT1/cmtt/m/sl/9 method bodies: the contexts (in second parameter of
- @{text DAss}) are
-[1]
-Overfull \hbox (5.55548pt too wide) in paragraph at lines 52--53
-[][]  \OT1/cmtt/m/sl/9 (if M = Insert then (DAss {t_} 1 (emptyfinmap(t_ $\OMS/c
-msy/m/n/9 7!$$[][]$\OT1/cmtt/m/sl/9 (TreeET 0))) (TreeET
-
-Overfull \hbox (29.18028pt too wide) in paragraph at lines 53--54
-[][]  \OT1/cmtt/m/sl/9 if M = Removesome then (DAss {t_} 0 (emptyfinmap(t_ $\OM
-S/cmsy/m/n/9 7!$$[][]$\OT1/cmtt/m/sl/9 (TreeET 0))) (ResultET
-
-Overfull \hbox (24.45532pt too wide) in paragraph at lines 54--55
-[][]  \OT1/cmtt/m/sl/9 if M = Removetop then (DAss {t_} 0 (emptyfinmap(t_ $\OMS
-/cmsy/m/n/9 7!$$[][]$\OT1/cmtt/m/sl/9 (TreeET 0))) (ResultET
-
-Overfull \hbox (15.0054pt too wide) in paragraph at lines 55--56
-[][]  \OT1/cmtt/m/sl/9 if M = Make_heap then (DAss {l_} 0 (emptyfinmap(l_ $\OMS
-/cmsy/m/n/9 7!$$[][]$\OT1/cmtt/m/sl/9 (ListET 0))) (TreeET
-
-Overfull \hbox (5.55548pt too wide) in paragraph at lines 56--57
-[][]  \OT1/cmtt/m/sl/9 if M = Extract then (DAss {h_} 0 (emptyfinmap(h_ $\OMS/c
-msy/m/n/9 7!$$[][]$\OT1/cmtt/m/sl/9 (TreeET 0))) (ListET
-
-Overfull \hbox (19.73036pt too wide) in paragraph at lines 57--58
-[][]  \OT1/cmtt/m/sl/9 if M = Siftdown then (DAss {t1_, t2_} 1 (emptyfinmap(t1_
- $\OMS/cmsy/m/n/9 7!$$[][]$\OT1/cmtt/m/sl/9 (TreeET 0))(t2_
-
-Overfull \hbox (5.55548pt too wide) in paragraph at lines 58--59
-[][]  \OT1/cmtt/m/sl/9 if M = Sort then (DAss {l_} 0 (emptyfinmap(l_ $\OMS/cmsy
-/m/n/9 7!$$[][]$\OT1/cmtt/m/sl/9 (ListET 0))) (ListET 0)
-
-Overfull \hbox (20.53447pt too wide) in paragraph at lines 65--66
-[][]\OT1/cmtt/m/sl/9 "sMST == ($\OML/cmm/m/it/9 ^^U$ \OT1/cmtt/m/sl/9 C M args 
-E h hh v p. SPEC M (newframe_env Nullref (fst (methtable
-
-Overfull \hbox (70.79651pt too wide) in paragraph at lines 70--71
-[][]  \OT1/cmtt/m/sl/9 Meth_Insert Fun_fInsert Fun_fzeroInsert Fun_foneInsert F
-un_ftwoInsert Fun_fthreeInsert[] 
-
-Overfull \hbox (61.34659pt too wide) in paragraph at lines 74--75
-[][]  \OT1/cmtt/m/sl/9 Meth_Removetop Fun_fRemovetop Fun_fzeroRemovetop Fun_fon
-eRemovetop Fun_ftwoRemovetop
-
-Overfull \hbox (37.72179pt too wide) in paragraph at lines 75--76
-[][]  \OT1/cmtt/m/sl/9 Meth_Siftdown Fun_fSiftdown Fun_fzeroSiftdown Fun_foneSi
-ftdown Fun_ftwoSiftdown
-
-Overfull \hbox (89.69635pt too wide) in paragraph at lines 76--77
-[][]  \OT1/cmtt/m/sl/9 Fun_ffourSiftdown Fun_ffiveSiftdown Fun_fsixSiftdown Fun
-_fsevenSiftdown Fun_feightSiftdown[] 
-
-Overfull \hbox (14.09698pt too wide) in paragraph at lines 77--78
-[][]  \OT1/cmtt/m/sl/9 Fun_fnineSiftdown Fun_ftenSiftdown Fun_felevenSiftdown F
-un_ftwelveSiftdown
-
-Overfull \hbox (70.79651pt too wide) in paragraph at lines 78--79
-[][]  \OT1/cmtt/m/sl/9 Fun_ffourteenSiftdown Fun_ffifteenSiftdown Fun_fsixteenS
-iftdown Fun_fseventeenSiftdown
-
-Overfull \hbox (38.27744pt too wide) in paragraph at lines 81--82
-[][]\OT1/cmtt/m/sl/9 lemma LL2: "$[]$(E, h, U,C,R,m):CS; U = V$[]$ $[][]\OMS/cm
-sy/m/n/9 )$ \OT1/cmtt/m/sl/9 (E, h, V,C,R,m):CS" (*<*)by simp(*>*)[] 
-
-Overfull \hbox (12.18752pt too wide) in paragraph at lines 88--89
-[][]  $[]$ \OT1/cmtt/m/sl/9 {y,z} , 1 , (emptyfinmap(y $\OMS/cmsy/m/n/9 7!$$[][
-]$\OT1/cmtt/m/sl/9 (TreeET 0))(z $\OMS/cmsy/m/n/9 7!$$[][]$\OT1/cmtt/m/sl/9 (Tr
-eeET 0))) $\OMS/cmsy/m/n/9 ^^]$  \OT1/cmtt/m/sl/9 (TreeET
-
-Overfull \hbox (47.1717pt too wide) in paragraph at lines 90--91
-[][]\OT1/cmtt/m/sl/9 apply (simp add: sMST_def SPEC_def MFS_defs newframe_env_d
-ef evalARGS_def self_def)[] 
-[2]
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 92--93
-[][]\OT1/cmtt/m/sl/9 apply (erule_tac x=q in allE, erule_tac x=F in allE, erule
-_tac x=R in allE,
-
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 96--97
-[][]        \OT1/cmtt/m/sl/9 ( (rule CS_NIL, fastsimp, simp+) | (rule CS_CONS, 
-fastsimp, simp+)
-
-Overfull \hbox (7.43889pt too wide) in paragraph at lines 103--104
-[][] $[][]\OMS/cmsy/m/n/9 )$ $[]$ \OT1/cmtt/m/sl/9 {x}, 0 , (emptyfinmap(x $\OM
-S/cmsy/m/n/9 7!$$[][]$\OT1/cmtt/m/sl/9 (ListET 0)))  $\OMS/cmsy/m/n/9 ^^]$ \OT1
-/cmtt/m/sl/9 (TreeET 0) , 0 $[]$ E h hh
-
-Overfull \hbox (47.1717pt too wide) in paragraph at lines 105--106
-[][]\OT1/cmtt/m/sl/9 apply (simp add: sMST_def SPEC_def MFS_defs newframe_env_d
-ef evalARGS_def self_def)[] 
-
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 107--108
-[][]\OT1/cmtt/m/sl/9 apply (erule_tac x=q in allE, erule_tac x=F in allE, erule
-_tac x=R in allE,
-
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 111--112
-[][]        \OT1/cmtt/m/sl/9 ( (rule CS_NIL, fastsimp, simp+) | (rule CS_CONS, 
-fastsimp, simp+)
-
-Overfull \hbox (47.1717pt too wide) in paragraph at lines 120--121
-[][]\OT1/cmtt/m/sl/9 apply (simp add: sMST_def SPEC_def MFS_defs newframe_env_d
-ef evalARGS_def self_def)[] 
-
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 122--123
-[][]\OT1/cmtt/m/sl/9 apply (erule_tac x=q in allE, erule_tac x=F in allE, erule
-_tac x=R in allE,
-
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 126--127
-[][]        \OT1/cmtt/m/sl/9 ( (rule CS_NIL, fastsimp, simp+) | (rule CS_CONS, 
-fastsimp, simp+)
-
-Overfull \hbox (2.71393pt too wide) in paragraph at lines 133--134
-[][]$[][]\OMS/cmsy/m/n/9 )$ $[]$ \OT1/cmtt/m/sl/9 {x}, 0 , (emptyfinmap(x $\OMS
-/cmsy/m/n/9 7!$$[][]$\OT1/cmtt/m/sl/9 (TreeET 0)))  $\OMS/cmsy/m/n/9 ^^]$ \OT1/
-cmtt/m/sl/9 (ListET 0) , 0 $[]$ E h hh
-
-Overfull \hbox (47.1717pt too wide) in paragraph at lines 135--136
-[][]\OT1/cmtt/m/sl/9 apply (simp add: sMST_def SPEC_def MFS_defs newframe_env_d
-ef evalARGS_def self_def)[] 
-
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 137--138
-[][]\OT1/cmtt/m/sl/9 apply (erule_tac x=q in allE, erule_tac x=F in allE, erule
-_tac x=R in allE,
-[3]
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 141--142
-[][]        \OT1/cmtt/m/sl/9 ( (rule CS_NIL, fastsimp, simp+) | (rule CS_CONS, 
-fastsimp, simp+)
-
-Overfull \hbox (3.75562pt too wide) in paragraph at lines 148--149
-[][]$[][]\OMS/cmsy/m/n/9 )$ $[]$ \OT1/cmtt/m/sl/9 {y} , 1 , (emptyfinmap(y $\OM
-S/cmsy/m/n/9 7!$$[][]$\OT1/cmtt/m/sl/9 (TreeET 0))) $\OMS/cmsy/m/n/9 ^^]$  \OT1
-/cmtt/m/sl/9 (TreeET 0), 0 $[]$ E h hh
-
-Overfull \hbox (47.1717pt too wide) in paragraph at lines 150--151
-[][]\OT1/cmtt/m/sl/9 apply (simp add: sMST_def SPEC_def MFS_defs newframe_env_d
-ef evalARGS_def self_def)[] 
-
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 152--153
-[][]\OT1/cmtt/m/sl/9 apply (erule_tac x=q in allE, erule_tac x=F in allE, erule
-_tac x=R in allE,
-
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 156--157
-[][]        \OT1/cmtt/m/sl/9 ( (rule CS_NIL, fastsimp, simp+) | (rule CS_CONS, 
-fastsimp, simp+)
-
-Overfull \hbox (2.55698pt too wide) in paragraph at lines 163--164
-[][]$[][]\OMS/cmsy/m/n/9 )$ $[]$ \OT1/cmtt/m/sl/9 {x} , 0 , (emptyfinmap(x $\OM
-S/cmsy/m/n/9 7!$$[][]$\OT1/cmtt/m/sl/9 (TreeET 0))) $\OMS/cmsy/m/n/9 ^^]$  \OT1
-/cmtt/m/sl/9 (ResultET 0 (TreeET 0)
-
-Overfull \hbox (47.1717pt too wide) in paragraph at lines 165--166
-[][]\OT1/cmtt/m/sl/9 apply (simp add: sMST_def SPEC_def MFS_defs newframe_env_d
-ef evalARGS_def self_def)[] 
-
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 167--168
-[][]\OT1/cmtt/m/sl/9 apply (erule_tac x=q in allE, erule_tac x=F in allE, erule
-_tac x=R in allE,
-
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 171--172
-[][]        \OT1/cmtt/m/sl/9 ( (rule CS_NIL, fastsimp, simp+) | (rule CS_CONS, 
-fastsimp, simp+)
-
-Overfull \hbox (2.55698pt too wide) in paragraph at lines 178--179
-[][]$[][]\OMS/cmsy/m/n/9 )$ $[]$ \OT1/cmtt/m/sl/9 {x} , 0 , (emptyfinmap(x $\OM
-S/cmsy/m/n/9 7!$$[][]$\OT1/cmtt/m/sl/9 (TreeET 0))) $\OMS/cmsy/m/n/9 ^^]$  \OT1
-/cmtt/m/sl/9 (ResultET 0 (TreeET 0)
-
-Overfull \hbox (47.1717pt too wide) in paragraph at lines 180--181
-[][]\OT1/cmtt/m/sl/9 apply (simp add: sMST_def SPEC_def MFS_defs newframe_env_d
-ef evalARGS_def self_def)[] 
-
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 182--183
-[][]\OT1/cmtt/m/sl/9 apply (erule_tac x=q in allE, erule_tac x=F in allE, erule
-_tac x=R in allE,
-[4]
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 186--187
-[][]        \OT1/cmtt/m/sl/9 ( (rule CS_NIL, fastsimp, simp+) | (rule CS_CONS, 
-fastsimp, simp+)
-
-Overfull \hbox (2.5181pt too wide) in paragraph at lines 208--209
-[][]\OT1/cmtt/m/sl/9 lemma vcg_rvar: "GETr C x = Some T $[][]\OMS/cmsy/m/n/9 )$
- \OT1/cmtt/m/sl/9 G $\U/lasy/m/n/9 ^^C$  \OT1/cmtt/m/sl/9 RVar x : $[]$ {x} , n
- , C $\OMS/cmsy/m/n/9 ^^]$  \OT1/cmtt/m/sl/9 T
-
-Overfull \hbox (12.12497pt too wide) in paragraph at lines 218--219
-[][]                 $[][]\OMS/cmsy/m/n/9 )$ \OT1/cmtt/m/sl/9 G $\U/lasy/m/n/9 
-^^C$  \OT1/cmtt/m/sl/9 RPrimop f x y : $[]$ {x, y} , n , C $\OMS/cmsy/m/n/9 ^^]
-$ \OT1/cmtt/m/sl/9 IntET , n $[]$"
-
-Overfull \hbox (8.07211pt too wide) in paragraph at lines 230--231
-[][]     \OT1/cmtt/m/sl/9 "$[]$GETr C y = Some (TreeET k); GETr C z = Some (Tre
-eET k); y$\OMS/cmsy/m/n/9 6\OT1/cmr/m/n/9 =$\OT1/cmtt/m/sl/9 z; n=(Suc
-
-Overfull \hbox (17.61093pt too wide) in paragraph at lines 231--232
-[][]     $[][]\OMS/cmsy/m/n/9 )$ \OT1/cmtt/m/sl/9 G $\U/lasy/m/n/9 ^^C$ \OT1/cm
-tt/m/sl/9 (DIAM$[]$Make_IIDD ([VALarg (IVal 3), INarg v, RNarg y, RNarg z]))
-[5]
-Overfull \hbox (1.16122pt too wide) in paragraph at lines 239--240
-[][]  \OT1/cmtt/m/sl/9 "$\OMS/cmsy/m/n/9 :$ \OT1/cmtt/m/sl/9 isMergePoint f $\O
-MS/cmsy/m/n/9 ^$ \OT1/cmtt/m/sl/9 (dominates f, G, f, $[]$U, n, C $\OMS/cmsy/m/
-n/9 ^^]$ \OT1/cmtt/m/sl/9 T, m$[]$) $\OMS/cmsy/m/n/9 2$ \OT1/cmtt/m/sl/9 DOM_Ca
-ll
-
-Overfull \hbox (12.61101pt too wide) in paragraph at lines 241--242
-[][]\OT1/cmtt/m/sl/9 (CALL f, $[]$U, n , restr C (ParList2RnameList (fst (funta
-ble f))) $\OMS/cmsy/m/n/9 ^^]$ \OT1/cmtt/m/sl/9 T , m $[]$)
-
-Overfull \hbox (1.16122pt too wide) in paragraph at lines 245--246
-[][]  \OT1/cmtt/m/sl/9 "$\OMS/cmsy/m/n/9 :$ \OT1/cmtt/m/sl/9 isMergePoint f $\O
-MS/cmsy/m/n/9 ^$ \OT1/cmtt/m/sl/9 (dominates f, G, f, $[]$U, n, C $\OMS/cmsy/m/
-n/9 ^^]$ \OT1/cmtt/m/sl/9 T, m$[]$) $\OMS/cmsy/m/n/9 2$ \OT1/cmtt/m/sl/9 DOM_Ca
-ll
-
-Overfull \hbox (12.61101pt too wide) in paragraph at lines 247--248
-[][]\OT1/cmtt/m/sl/9 (CALL f, $[]$U, n , restr C (ParList2RnameList (fst (funta
-ble f))) $\OMS/cmsy/m/n/9 ^^]$ \OT1/cmtt/m/sl/9 T , m $[]$)
-
-Overfull \hbox (8.40714pt too wide) in paragraph at lines 256--257
-[][]  \OT1/cmtt/m/sl/9 G $\U/lasy/m/n/9 ^^C$  \OT1/cmtt/m/sl/9 e : $[]$ U1 , n 
-, C $\OMS/cmsy/m/n/9 ^^]$  \OT1/cmtt/m/sl/9 T1 , m $[]$ ; G $\U/lasy/m/n/9 ^^C$
-  \OT1/cmtt/m/sl/9 ee : $[]$ U2 , m , C(x$\OMS/cmsy/m/n/9 7!$$[][]$\OT1/cmtt/m/
-sl/9 T1) $\OMS/cmsy/m/n/9 ^^]$
-
-Overfull \hbox (4.4306pt too wide) in paragraph at lines 257--258
-[][]  \OT1/cmtt/m/sl/9 G $\U/lasy/m/n/9 ^^C$  \OT1/cmtt/m/sl/9 (LET rf x =e IN 
-ee END) : $[]$ U1 $\OMS/cmsy/m/n/9 [$ \OT1/cmtt/m/sl/9 (U2 - {x}) , n , C $\OMS
-/cmsy/m/n/9 ^^]$  \OT1/cmtt/m/sl/9 T2 , k $[]$"[] 
-
-Overfull \hbox (5.1584pt too wide) in paragraph at lines 270--271
-[][]  $[][]\OMS/cmsy/m/n/9 )$ \OT1/cmtt/m/sl/9 G $\U/lasy/m/n/9 ^^C$ \OT1/cmtt/
-m/sl/9 (LET z = RPrimop f x y IN e END) : $[]${x, y} $\OMS/cmsy/m/n/9 [$ \OT1/c
-mtt/m/sl/9 U, n, C $\OMS/cmsy/m/n/9 ^^]$ \OT1/cmtt/m/sl/9 T, m$[]$"
-
-Overfull \hbox (14.09698pt too wide) in paragraph at lines 273--274
-[][]\OT1/cmtt/m/sl/9 (* Note: side conditions in match rules cannot be solved u
-ntil later because
-[6]
-Overfull \hbox (28.63316pt too wide) in paragraph at lines 292--293
-[][]$[][]\OMS/cmsy/m/n/9 )$ \OT1/cmtt/m/sl/9 G $\U/lasy/m/n/9 ^^C$  \OT1/cmtt/m
-/sl/9 (LET cont =t$[]$V0; rf left =t$\OMS/cmsy/m/n/9 }$\OT1/cmtt/m/sl/9 R1; rf 
-right =t$\OMS/cmsy/m/n/9 }$\OT1/cmtt/m/sl/9 R2;  _ =DIAM$[]$Free([RNarg
-
-Overfull \hbox (8.16101pt too wide) in paragraph at lines 300--301
-[][] $[][]\OMS/cmsy/m/n/9 )$ \OT1/cmtt/m/sl/9 G $\U/lasy/m/n/9 ^^C$ \OT1/cmtt/m
-/sl/9 (LET h = GetFi l V0; rf t = GetFr l R1; _ = DIAM$[]$Free ([RNarg l])
-
-Overfull \hbox (8.16101pt too wide) in paragraph at lines 308--309
-[][] $[][]\OMS/cmsy/m/n/9 )$ \OT1/cmtt/m/sl/9 G $\U/lasy/m/n/9 ^^C$ \OT1/cmtt/m
-/sl/9 (LET h = GetFi l V0; rf t = GetFr l R1; _ = DIAM$[]$Free ([RNarg l])
-
-Overfull \hbox (1.11948pt too wide) in paragraph at lines 315--316
-[][]     $\OMS/cmsy/m/n/9 8 $ \OT1/cmtt/m/sl/9 E h hh v p. sMST c M L E h hh v 
-p $[][]\OMS/cmsy/m/n/9 !$ $[]$\OT1/cmtt/m/sl/9 U, n, C $\OMS/cmsy/m/n/9 ^^]$ \O
-T1/cmtt/m/sl/9 T1, m$[]$ E h hh v
-
-Overfull \hbox (4.43343pt too wide) in paragraph at lines 319--320
-[][]   $[][]\OMS/cmsy/m/n/9 )$ \OT1/cmtt/m/sl/9 G $\U/lasy/m/n/9 ^^C$  \OT1/cmt
-t/m/sl/9 (LET rf x = c$[]$M(L) IN e END) : $[]$U $\OMS/cmsy/m/n/9 [$ \OT1/cmtt/
-m/sl/9 (V-{x}), nk, D $\OMS/cmsy/m/n/9 ^^]$ \OT1/cmtt/m/sl/9 T, l$[]$"
-
-Overfull \hbox (3.34715pt too wide) in paragraph at lines 323--324
-[][]     \OT1/cmtt/m/sl/9 "$[]$GETr C y = Some (TreeET k);GETr C z = Some (Tree
-ET k); y$\OMS/cmsy/m/n/9 6\OT1/cmr/m/n/9 =$\OT1/cmtt/m/sl/9 z; n=(Suc
-[7]
-Overfull \hbox (3.43605pt too wide) in paragraph at lines 326--327
-[][]     $[][]\OMS/cmsy/m/n/9 )$ \OT1/cmtt/m/sl/9 G $\U/lasy/m/n/9 ^^C$ \OT1/cm
-tt/m/sl/9 (LET rf x = DIAM$[]$Make_IIDD ([VALarg (IVal 3), INarg v, RNarg
-
-Overfull \hbox (62.34396pt too wide) in paragraph at lines 326--327
-\OT1/cmtt/m/sl/9 y, RNarg z]) IN e END): $[]$({y,z} $\OMS/cmsy/m/n/9 [$ \OT1/cm
-tt/m/sl/9 (U-{x})), n, C $\OMS/cmsy/m/n/9 ^^]$ \OT1/cmtt/m/sl/9 T, l$[]$" by (e
-rule DA_LetrMakeTree,
-
-Overfull \hbox (19.73325pt too wide) in paragraph at lines 335--336
-[][]\OT1/cmtt/m/sl/9 lemma vcg_domcallcons: "$[]$(t,{(Call h, $[]$U, n, C $\OMS
-/cmsy/m/n/9 ^^]$ \OT1/cmtt/m/sl/9 T, m$[]$)} $\OMS/cmsy/m/n/9 [$ \OT1/cmtt/m/sl
-/9 G,f,P):DOM_Call;[] 
-
-Overfull \hbox (42.44675pt too wide) in paragraph at lines 347--348
-[][]       \OT1/cmtt/m/sl/9 context which contains an one entry for each syntac
-tic method invocation.*}[] 
-
-Overfull \hbox (3.92209pt too wide) in paragraph at lines 350--351
-[][]  \OT1/cmtt/m/sl/9 {(HS$[]$Insert([INarg x_,RNarg r2_]), sMST HS Insert [IN
-arg x_,RNarg r2_]),[] 
-
-Overfull \hbox (8.64705pt too wide) in paragraph at lines 351--352
-[][]  \OT1/cmtt/m/sl/9 (HS$[]$Insert([INarg v4_,RNarg r2_]), sMST HS Insert [IN
-arg v4_,RNarg r2_]),[] 
-
-Overfull \hbox (3.92209pt too wide) in paragraph at lines 358--359
-[][]  \OT1/cmtt/m/sl/9 (HS$[]$Siftdown([INarg v2_, RNarg r3_, RNarg r1_]), sMST
- HS Siftdown [INarg
-
-Overfull \hbox (18.09697pt too wide) in paragraph at lines 359--360
-[][]  \OT1/cmtt/m/sl/9 (HS$[]$Siftdown([INarg w_, RNarg r5_, RNarg r4_]), sMST 
-HS Siftdown [INarg w_,
-
-Overfull \hbox (18.09697pt too wide) in paragraph at lines 360--361
-[][]  \OT1/cmtt/m/sl/9 (HS$[]$Siftdown([INarg w_, RNarg r8_, RNarg r7_]), sMST 
-HS Siftdown [INarg w_,
-[8]
-Overfull \hbox (14.09698pt too wide) in paragraph at lines 380--381
-[][]    \OT1/cmtt/m/sl/9 CHANGED (simp_tac ((Simplifier.get_local_simpset ctxt)
- addsimps thms) i)[] 
-
-Overfull \hbox (18.82195pt too wide) in paragraph at lines 382--383
-[][]    \OT1/cmtt/m/sl/9 CHANGED (asm_simp_tac ((Simplifier.get_local_simpset c
-txt) addsimps thms)
-[9] [10]
-Overfull \hbox (18.82195pt too wide) in paragraph at lines 510--511
-[][]\OT1/cmtt/m/sl/9 (*            apply method_Let prefer 2 apply (simp add: H
-eapSortContext_def)[] 
-
-Overfull \hbox (18.82195pt too wide) in paragraph at lines 511--512
-[][]                             \OT1/cmtt/m/sl/9 prefer 2 apply (clarsimp, eru
-le Siftdown_Invoke,
-
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 518--519
-[][]  \OT1/cmtt/m/sl/9 (* for solving premise of vcg_call -- either unfold Dom 
-def, or lookup *)
-[11]
-Overfull \hbox (28.27187pt too wide) in paragraph at lines 557--558
-[][]   \OT1/cmtt/m/sl/9 fun main_tac ctxt (alldefs as (flowdefs,dom_defs,gamma_
-def)) i state = state
-
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 562--563
-[][]   \OT1/cmtt/m/sl/9 and main_tac_aux ctxt (alldefs as (flowdefs,dom_defs,ga
-mma_def)) i state
-
-Overfull \hbox (14.09698pt too wide) in paragraph at lines 566--567
-[][]            \OT1/cmtt/m/sl/9 let_tac ctxt (flowdefs @ gamma_def)  (main_tac
-_aux ctxt alldefs)
-
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 575--576
-[][]\OT1/cmtt/m/sl/9 (* Testing methods for invoking parts of the tactic above 
-[for debug only]
-[12]
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 585--586
-[][]\OT1/cmtt/m/sl/9 method_setup method_Let = {* Method.thms_ctxt_args (fn thm
-s => fn ctxt => [] 
-
-Overfull \hbox (14.09698pt too wide) in paragraph at lines 589--590
-[][]\OT1/cmtt/m/sl/9 (* apply (rule vcg_call) apply (simp add: dominates_def is
-MergePoint_def) *)[] 
-
-Overfull \hbox (42.44675pt too wide) in paragraph at lines 594--595
-[][]\OT1/cmtt/m/sl/9 (* apply (simp?, (rule DA_NullResult, simp) | rule DA_Null
-Tree | rule DA_NullList)
-
-Overfull \hbox (18.82195pt too wide) in paragraph at lines 603--604
-[][]\OT1/cmtt/m/sl/9 (* FIXME: to combine method_Call with method_Dom or mergep
-oint stuff, we need
-
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 606--607
-[][]\OT1/cmtt/m/sl/9 (* apply ((rule vcg_domcallcons) | (rule vcg_domcallnil))+
- apply simp apply
-
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 608--609
-[][]  \OT1/cmtt/m/sl/9 fn ctxt => Method.METHOD (fn facts => dom_tac ctxt thms 
-stop stop 1)) *}[] 
-
-Overfull \hbox (37.72179pt too wide) in paragraph at lines 624--625
-[][]         \OT1/cmtt/m/sl/9 two_subgoal_tacs i THEN vdm_tac (i+1) THEN vdm_ta
-c i,  (* stack: reverse
-
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 630--631
-[][]\OT1/cmtt/m/sl/9 (* apply ((rule vcg_domcallcons) | (rule vcg_domcallnil))+
- apply simp apply
-
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 631--632
-[][]\OT1/cmtt/m/sl/9 method_setup method_Weak = {* Method.thms_ctxt_args (fn th
-ms => fn ctxt =>
-[13]
-Overfull \hbox (37.72179pt too wide) in paragraph at lines 636--637
-[][]\OT1/cmtt/m/sl/9 (*methods call and dom are applied together, using CallDom
-: proofs takes 55secs*)[] 
-
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 642--643
-[][]\OT1/cmtt/m/sl/9 (* apply (method_main dominates_def isMergePoint_def MFS_d
-efs SPEC_def) *)[] 
-
-Overfull \hbox (42.44675pt too wide) in paragraph at lines 657--658
-[][]\OT1/cmtt/m/sl/9 (* Method main: writing bits of ML code to parse in Isar i
-s a pain, so we hardwire[] 
-
-Overfull \hbox (28.27187pt too wide) in paragraph at lines 666--667
-[][]  \OT1/cmtt/m/sl/9 Method.METHOD (fn facts => main_tac ctxt (thms "flow_def
-s", thms "doms_defs",
-
-Overfull \hbox (47.1717pt too wide) in paragraph at lines 670--671
-[][]  \OT1/cmtt/m/sl/9 Method.METHOD (fn facts => main_tac_aux ctxt (thms "flow
-_defs", thms "doms_defs",
-
-Overfull \hbox (13.4388pt too wide) in paragraph at lines 674--675
-[][]\OT1/cmtt/m/sl/9 "$[]$G = HeapSortContext$[]$ $[][]\OMS/cmsy/m/n/9 )$ \OT1/
-cmtt/m/sl/9 G $\U/lasy/m/n/9 ^^C$ \OT1/cmtt/m/sl/9 snd (methtable HS Siftdown) 
-: SPEC Siftdown"[] 
-[14] [15] [16]
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 805--806
-[][]                \OT1/cmtt/m/sl/9 apply (method_Dom doms_defs)  (* this the 
-place that cut is
-
-Overfull \hbox (37.72179pt too wide) in paragraph at lines 830--831
-[][]                                \OT1/cmtt/m/sl/9 (*Call*) (* first call to 
-the merge point ffour*)[] 
-
-Overfull \hbox (18.82195pt too wide) in paragraph at lines 840--841
-[][]                                \OT1/cmtt/m/sl/9 (*Call*) (*This is the sec
-ond call to ffour*)[] 
-[17]
-Overfull \hbox (18.82195pt too wide) in paragraph at lines 853--854
-[][]                    \OT1/cmtt/m/sl/9 (*1*) apply simp (*contraint came from
- TreematchD STAR.*)[] 
-
-Overfull \hbox (18.82195pt too wide) in paragraph at lines 855--856
-[][]                     \OT1/cmtt/m/sl/9 (*this is like a top-level verificati
-on, i.e.starts with
-
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 878--879
-[][]                           \OT1/cmtt/m/sl/9 apply (method_Dom doms_defs)  (
-* this the place
-[18]
-Overfull \hbox (18.82195pt too wide) in paragraph at lines 900--901
-[][]                                   \OT1/cmtt/m/sl/9 (*call This is the firs
-t call to feleven*)[] 
-
-Overfull \hbox (23.5469pt too wide) in paragraph at lines 910--911
-[][]                                   \OT1/cmtt/m/sl/9 (*call This is the seco
-nd call to feleven*)[] 
-
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 920--921
-[][]                                 \OT1/cmtt/m/sl/9 (*call This is the third 
-call to feleven*)[] 
-
-Overfull \hbox (32.99683pt too wide) in paragraph at lines 924--925
-[][]                             \OT1/cmtt/m/sl/9 (*this is like a top-level ve
-rification, i.e.starts
-
-Overfull \hbox (23.5469pt too wide) in paragraph at lines 938--939
-[][]                                           \OT1/cmtt/m/sl/9 (*of course, de
-fining the adaptaion
-
-Overfull \hbox (37.72179pt too wide) in paragraph at lines 939--940
-[][]                                           \OT1/cmtt/m/sl/9 apply (method_L
-et HeapSortContext_def)[] 
-
-Overfull \hbox (23.5469pt too wide) in paragraph at lines 943--944
-[][]                                           \OT1/cmtt/m/sl/9 (*1*) apply sim
-p (*letinvokeconst*)[] 
-[19]
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 951--952
-[][]                                     \OT1/cmtt/m/sl/9 apply (method_Let Hea
-pSortContext_def)[] 
-
-Overfull \hbox (14.09698pt too wide) in paragraph at lines 957--958
-[][]                                           \OT1/cmtt/m/sl/9 (*2*) apply sim
-p (*letrmaketree*)[] 
-
-Overfull \hbox (51.89667pt too wide) in paragraph at lines 959--960
-[][]                             \OT1/cmtt/m/sl/9 (*2*) apply fast (* the weake
-ning from the verification
-
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 960--961
-[][]                   \OT1/cmtt/m/sl/9 (*2*) apply fast (* the weakening from 
-the verification
-
-Overfull \hbox (240.89508pt too wide) in paragraph at lines 967--968
-[][]\OT1/cmtt/m/sl/9 (* =======================================================
-==================================================================
-)) [20] (./root.aux) )
-(see the transcript file for additional information)
-Output written on root.dvi (20 pages, 43848 bytes).
-Transcript written on root.log.
-This is TeXk, Version 3.14159 (Web2C 7.4.5)
- %&-line parsing enabled.
-LaTeX2e <2001/06/01>
-Babel <v3.7h> and hyphenation patterns for american, french, german, ngerman, n
-ohyphenation, loaded.
-
-(./root.tex (/usr/share/texmf/tex/latex/base/article.cls
-Document Class: article 2001/04/21 v1.4e Standard LaTeX document class
-(/usr/share/texmf/tex/latex/base/size10.clo)) (./isabelle.sty)
-(./isabellesym.sty) (/usr/share/texmf/tex/latex/base/inputenc.sty
-(/usr/share/texmf/tex/latex/base/latin1.def)) (./pdfsetup.sty)
-(/usr/local/texmf.da/tex/latex/comisc/url.sty)
-(/usr/share/texmf/tex/latex/base/latexsym.sty) (./root.aux) (./session.tex
-(./HeapSortProofVCG.tex
-Overfull \hbox (14.09698pt too wide) in paragraph at lines 6--7
-[][]  \OT1/cmtt/m/sl/9 -- would be desirable to redesign CALLMP rule so that si
-de condition which[] 
-
-Overfull \hbox (42.44675pt too wide) in paragraph at lines 12--13
-[][]       \OT1/cmtt/m/sl/9 generates (variable number of) subgoals for each fu
-nction that is dominated
-(/usr/share/texmf/tex/latex/base/ulasy.fd)
-Overfull \hbox (23.5469pt too wide) in paragraph at lines 19--20
-[][]       \OT1/cmtt/m/sl/9 need to verify n+1, which leaves indeterminate numb
-er of side-condition
-
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 31--32
-[][]       \OT1/cmtt/m/sl/9 maybe a good idea to have a method for (each) primi
-tives, and then a
-
-Overfull \hbox (18.82195pt too wide) in paragraph at lines 32--33
-[][]       \OT1/cmtt/m/sl/9 let which does the composition on-the-fly  --- this
- avoids duplicating
-
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 35--36
-[][]        \OT1/cmtt/m/sl/9 -- define ML values bound to tactics appearing in 
-bodies of methods[] 
-
-Overfull \hbox (14.09698pt too wide) in paragraph at lines 47--48
-[][]\OT1/cmtt/m/sl/9 text {*This corresponds to the following specifications, f
-ormalised from the
-
-Overfull \hbox (14.09698pt too wide) in paragraph at lines 48--49
-[][]       \OT1/cmtt/m/sl/9 method bodies: the contexts (in second parameter of
- @{text DAss}) are
-[1]
-Overfull \hbox (5.55548pt too wide) in paragraph at lines 52--53
-[][]  \OT1/cmtt/m/sl/9 (if M = Insert then (DAss {t_} 1 (emptyfinmap(t_ $\OMS/c
-msy/m/n/9 7!$$[][]$\OT1/cmtt/m/sl/9 (TreeET 0))) (TreeET
-
-Overfull \hbox (29.18028pt too wide) in paragraph at lines 53--54
-[][]  \OT1/cmtt/m/sl/9 if M = Removesome then (DAss {t_} 0 (emptyfinmap(t_ $\OM
-S/cmsy/m/n/9 7!$$[][]$\OT1/cmtt/m/sl/9 (TreeET 0))) (ResultET
-
-Overfull \hbox (24.45532pt too wide) in paragraph at lines 54--55
-[][]  \OT1/cmtt/m/sl/9 if M = Removetop then (DAss {t_} 0 (emptyfinmap(t_ $\OMS
-/cmsy/m/n/9 7!$$[][]$\OT1/cmtt/m/sl/9 (TreeET 0))) (ResultET
-
-Overfull \hbox (15.0054pt too wide) in paragraph at lines 55--56
-[][]  \OT1/cmtt/m/sl/9 if M = Make_heap then (DAss {l_} 0 (emptyfinmap(l_ $\OMS
-/cmsy/m/n/9 7!$$[][]$\OT1/cmtt/m/sl/9 (ListET 0))) (TreeET
-
-Overfull \hbox (5.55548pt too wide) in paragraph at lines 56--57
-[][]  \OT1/cmtt/m/sl/9 if M = Extract then (DAss {h_} 0 (emptyfinmap(h_ $\OMS/c
-msy/m/n/9 7!$$[][]$\OT1/cmtt/m/sl/9 (TreeET 0))) (ListET
-
-Overfull \hbox (19.73036pt too wide) in paragraph at lines 57--58
-[][]  \OT1/cmtt/m/sl/9 if M = Siftdown then (DAss {t1_, t2_} 1 (emptyfinmap(t1_
- $\OMS/cmsy/m/n/9 7!$$[][]$\OT1/cmtt/m/sl/9 (TreeET 0))(t2_
-
-Overfull \hbox (5.55548pt too wide) in paragraph at lines 58--59
-[][]  \OT1/cmtt/m/sl/9 if M = Sort then (DAss {l_} 0 (emptyfinmap(l_ $\OMS/cmsy
-/m/n/9 7!$$[][]$\OT1/cmtt/m/sl/9 (ListET 0))) (ListET 0)
-
-Overfull \hbox (20.53447pt too wide) in paragraph at lines 65--66
-[][]\OT1/cmtt/m/sl/9 "sMST == ($\OML/cmm/m/it/9 ^^U$ \OT1/cmtt/m/sl/9 C M args 
-E h hh v p. SPEC M (newframe_env Nullref (fst (methtable
-
-Overfull \hbox (70.79651pt too wide) in paragraph at lines 70--71
-[][]  \OT1/cmtt/m/sl/9 Meth_Insert Fun_fInsert Fun_fzeroInsert Fun_foneInsert F
-un_ftwoInsert Fun_fthreeInsert[] 
-
-Overfull \hbox (61.34659pt too wide) in paragraph at lines 74--75
-[][]  \OT1/cmtt/m/sl/9 Meth_Removetop Fun_fRemovetop Fun_fzeroRemovetop Fun_fon
-eRemovetop Fun_ftwoRemovetop
-
-Overfull \hbox (37.72179pt too wide) in paragraph at lines 75--76
-[][]  \OT1/cmtt/m/sl/9 Meth_Siftdown Fun_fSiftdown Fun_fzeroSiftdown Fun_foneSi
-ftdown Fun_ftwoSiftdown
-
-Overfull \hbox (89.69635pt too wide) in paragraph at lines 76--77
-[][]  \OT1/cmtt/m/sl/9 Fun_ffourSiftdown Fun_ffiveSiftdown Fun_fsixSiftdown Fun
-_fsevenSiftdown Fun_feightSiftdown[] 
-
-Overfull \hbox (14.09698pt too wide) in paragraph at lines 77--78
-[][]  \OT1/cmtt/m/sl/9 Fun_fnineSiftdown Fun_ftenSiftdown Fun_felevenSiftdown F
-un_ftwelveSiftdown
-
-Overfull \hbox (70.79651pt too wide) in paragraph at lines 78--79
-[][]  \OT1/cmtt/m/sl/9 Fun_ffourteenSiftdown Fun_ffifteenSiftdown Fun_fsixteenS
-iftdown Fun_fseventeenSiftdown
-
-Overfull \hbox (38.27744pt too wide) in paragraph at lines 81--82
-[][]\OT1/cmtt/m/sl/9 lemma LL2: "$[]$(E, h, U,C,R,m):CS; U = V$[]$ $[][]\OMS/cm
-sy/m/n/9 )$ \OT1/cmtt/m/sl/9 (E, h, V,C,R,m):CS" (*<*)by simp(*>*)[] 
-
-Overfull \hbox (12.18752pt too wide) in paragraph at lines 88--89
-[][]  $[]$ \OT1/cmtt/m/sl/9 {y,z} , 1 , (emptyfinmap(y $\OMS/cmsy/m/n/9 7!$$[][
-]$\OT1/cmtt/m/sl/9 (TreeET 0))(z $\OMS/cmsy/m/n/9 7!$$[][]$\OT1/cmtt/m/sl/9 (Tr
-eeET 0))) $\OMS/cmsy/m/n/9 ^^]$  \OT1/cmtt/m/sl/9 (TreeET
-
-Overfull \hbox (47.1717pt too wide) in paragraph at lines 90--91
-[][]\OT1/cmtt/m/sl/9 apply (simp add: sMST_def SPEC_def MFS_defs newframe_env_d
-ef evalARGS_def self_def)[] 
-[2]
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 92--93
-[][]\OT1/cmtt/m/sl/9 apply (erule_tac x=q in allE, erule_tac x=F in allE, erule
-_tac x=R in allE,
-
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 96--97
-[][]        \OT1/cmtt/m/sl/9 ( (rule CS_NIL, fastsimp, simp+) | (rule CS_CONS, 
-fastsimp, simp+)
-
-Overfull \hbox (7.43889pt too wide) in paragraph at lines 103--104
-[][] $[][]\OMS/cmsy/m/n/9 )$ $[]$ \OT1/cmtt/m/sl/9 {x}, 0 , (emptyfinmap(x $\OM
-S/cmsy/m/n/9 7!$$[][]$\OT1/cmtt/m/sl/9 (ListET 0)))  $\OMS/cmsy/m/n/9 ^^]$ \OT1
-/cmtt/m/sl/9 (TreeET 0) , 0 $[]$ E h hh
-
-Overfull \hbox (47.1717pt too wide) in paragraph at lines 105--106
-[][]\OT1/cmtt/m/sl/9 apply (simp add: sMST_def SPEC_def MFS_defs newframe_env_d
-ef evalARGS_def self_def)[] 
-
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 107--108
-[][]\OT1/cmtt/m/sl/9 apply (erule_tac x=q in allE, erule_tac x=F in allE, erule
-_tac x=R in allE,
-
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 111--112
-[][]        \OT1/cmtt/m/sl/9 ( (rule CS_NIL, fastsimp, simp+) | (rule CS_CONS, 
-fastsimp, simp+)
-
-Overfull \hbox (47.1717pt too wide) in paragraph at lines 120--121
-[][]\OT1/cmtt/m/sl/9 apply (simp add: sMST_def SPEC_def MFS_defs newframe_env_d
-ef evalARGS_def self_def)[] 
-
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 122--123
-[][]\OT1/cmtt/m/sl/9 apply (erule_tac x=q in allE, erule_tac x=F in allE, erule
-_tac x=R in allE,
-
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 126--127
-[][]        \OT1/cmtt/m/sl/9 ( (rule CS_NIL, fastsimp, simp+) | (rule CS_CONS, 
-fastsimp, simp+)
-
-Overfull \hbox (2.71393pt too wide) in paragraph at lines 133--134
-[][]$[][]\OMS/cmsy/m/n/9 )$ $[]$ \OT1/cmtt/m/sl/9 {x}, 0 , (emptyfinmap(x $\OMS
-/cmsy/m/n/9 7!$$[][]$\OT1/cmtt/m/sl/9 (TreeET 0)))  $\OMS/cmsy/m/n/9 ^^]$ \OT1/
-cmtt/m/sl/9 (ListET 0) , 0 $[]$ E h hh
-
-Overfull \hbox (47.1717pt too wide) in paragraph at lines 135--136
-[][]\OT1/cmtt/m/sl/9 apply (simp add: sMST_def SPEC_def MFS_defs newframe_env_d
-ef evalARGS_def self_def)[] 
-
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 137--138
-[][]\OT1/cmtt/m/sl/9 apply (erule_tac x=q in allE, erule_tac x=F in allE, erule
-_tac x=R in allE,
-[3]
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 141--142
-[][]        \OT1/cmtt/m/sl/9 ( (rule CS_NIL, fastsimp, simp+) | (rule CS_CONS, 
-fastsimp, simp+)
-
-Overfull \hbox (3.75562pt too wide) in paragraph at lines 148--149
-[][]$[][]\OMS/cmsy/m/n/9 )$ $[]$ \OT1/cmtt/m/sl/9 {y} , 1 , (emptyfinmap(y $\OM
-S/cmsy/m/n/9 7!$$[][]$\OT1/cmtt/m/sl/9 (TreeET 0))) $\OMS/cmsy/m/n/9 ^^]$  \OT1
-/cmtt/m/sl/9 (TreeET 0), 0 $[]$ E h hh
-
-Overfull \hbox (47.1717pt too wide) in paragraph at lines 150--151
-[][]\OT1/cmtt/m/sl/9 apply (simp add: sMST_def SPEC_def MFS_defs newframe_env_d
-ef evalARGS_def self_def)[] 
-
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 152--153
-[][]\OT1/cmtt/m/sl/9 apply (erule_tac x=q in allE, erule_tac x=F in allE, erule
-_tac x=R in allE,
-
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 156--157
-[][]        \OT1/cmtt/m/sl/9 ( (rule CS_NIL, fastsimp, simp+) | (rule CS_CONS, 
-fastsimp, simp+)
-
-Overfull \hbox (2.55698pt too wide) in paragraph at lines 163--164
-[][]$[][]\OMS/cmsy/m/n/9 )$ $[]$ \OT1/cmtt/m/sl/9 {x} , 0 , (emptyfinmap(x $\OM
-S/cmsy/m/n/9 7!$$[][]$\OT1/cmtt/m/sl/9 (TreeET 0))) $\OMS/cmsy/m/n/9 ^^]$  \OT1
-/cmtt/m/sl/9 (ResultET 0 (TreeET 0)
-
-Overfull \hbox (47.1717pt too wide) in paragraph at lines 165--166
-[][]\OT1/cmtt/m/sl/9 apply (simp add: sMST_def SPEC_def MFS_defs newframe_env_d
-ef evalARGS_def self_def)[] 
-
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 167--168
-[][]\OT1/cmtt/m/sl/9 apply (erule_tac x=q in allE, erule_tac x=F in allE, erule
-_tac x=R in allE,
-
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 171--172
-[][]        \OT1/cmtt/m/sl/9 ( (rule CS_NIL, fastsimp, simp+) | (rule CS_CONS, 
-fastsimp, simp+)
-
-Overfull \hbox (2.55698pt too wide) in paragraph at lines 178--179
-[][]$[][]\OMS/cmsy/m/n/9 )$ $[]$ \OT1/cmtt/m/sl/9 {x} , 0 , (emptyfinmap(x $\OM
-S/cmsy/m/n/9 7!$$[][]$\OT1/cmtt/m/sl/9 (TreeET 0))) $\OMS/cmsy/m/n/9 ^^]$  \OT1
-/cmtt/m/sl/9 (ResultET 0 (TreeET 0)
-
-Overfull \hbox (47.1717pt too wide) in paragraph at lines 180--181
-[][]\OT1/cmtt/m/sl/9 apply (simp add: sMST_def SPEC_def MFS_defs newframe_env_d
-ef evalARGS_def self_def)[] 
-
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 182--183
-[][]\OT1/cmtt/m/sl/9 apply (erule_tac x=q in allE, erule_tac x=F in allE, erule
-_tac x=R in allE,
-[4]
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 186--187
-[][]        \OT1/cmtt/m/sl/9 ( (rule CS_NIL, fastsimp, simp+) | (rule CS_CONS, 
-fastsimp, simp+)
-
-Overfull \hbox (2.5181pt too wide) in paragraph at lines 208--209
-[][]\OT1/cmtt/m/sl/9 lemma vcg_rvar: "GETr C x = Some T $[][]\OMS/cmsy/m/n/9 )$
- \OT1/cmtt/m/sl/9 G $\U/lasy/m/n/9 ^^C$  \OT1/cmtt/m/sl/9 RVar x : $[]$ {x} , n
- , C $\OMS/cmsy/m/n/9 ^^]$  \OT1/cmtt/m/sl/9 T
-
-Overfull \hbox (12.12497pt too wide) in paragraph at lines 218--219
-[][]                 $[][]\OMS/cmsy/m/n/9 )$ \OT1/cmtt/m/sl/9 G $\U/lasy/m/n/9 
-^^C$  \OT1/cmtt/m/sl/9 RPrimop f x y : $[]$ {x, y} , n , C $\OMS/cmsy/m/n/9 ^^]
-$ \OT1/cmtt/m/sl/9 IntET , n $[]$"
-
-Overfull \hbox (8.07211pt too wide) in paragraph at lines 230--231
-[][]     \OT1/cmtt/m/sl/9 "$[]$GETr C y = Some (TreeET k); GETr C z = Some (Tre
-eET k); y$\OMS/cmsy/m/n/9 6\OT1/cmr/m/n/9 =$\OT1/cmtt/m/sl/9 z; n=(Suc
-
-Overfull \hbox (17.61093pt too wide) in paragraph at lines 231--232
-[][]     $[][]\OMS/cmsy/m/n/9 )$ \OT1/cmtt/m/sl/9 G $\U/lasy/m/n/9 ^^C$ \OT1/cm
-tt/m/sl/9 (DIAM$[]$Make_IIDD ([VALarg (IVal 3), INarg v, RNarg y, RNarg z]))
-[5]
-Overfull \hbox (1.16122pt too wide) in paragraph at lines 239--240
-[][]  \OT1/cmtt/m/sl/9 "$\OMS/cmsy/m/n/9 :$ \OT1/cmtt/m/sl/9 isMergePoint f $\O
-MS/cmsy/m/n/9 ^$ \OT1/cmtt/m/sl/9 (dominates f, G, f, $[]$U, n, C $\OMS/cmsy/m/
-n/9 ^^]$ \OT1/cmtt/m/sl/9 T, m$[]$) $\OMS/cmsy/m/n/9 2$ \OT1/cmtt/m/sl/9 DOM_Ca
-ll
-
-Overfull \hbox (12.61101pt too wide) in paragraph at lines 241--242
-[][]\OT1/cmtt/m/sl/9 (CALL f, $[]$U, n , restr C (ParList2RnameList (fst (funta
-ble f))) $\OMS/cmsy/m/n/9 ^^]$ \OT1/cmtt/m/sl/9 T , m $[]$)
-
-Overfull \hbox (1.16122pt too wide) in paragraph at lines 245--246
-[][]  \OT1/cmtt/m/sl/9 "$\OMS/cmsy/m/n/9 :$ \OT1/cmtt/m/sl/9 isMergePoint f $\O
-MS/cmsy/m/n/9 ^$ \OT1/cmtt/m/sl/9 (dominates f, G, f, $[]$U, n, C $\OMS/cmsy/m/
-n/9 ^^]$ \OT1/cmtt/m/sl/9 T, m$[]$) $\OMS/cmsy/m/n/9 2$ \OT1/cmtt/m/sl/9 DOM_Ca
-ll
-
-Overfull \hbox (12.61101pt too wide) in paragraph at lines 247--248
-[][]\OT1/cmtt/m/sl/9 (CALL f, $[]$U, n , restr C (ParList2RnameList (fst (funta
-ble f))) $\OMS/cmsy/m/n/9 ^^]$ \OT1/cmtt/m/sl/9 T , m $[]$)
-
-Overfull \hbox (8.40714pt too wide) in paragraph at lines 256--257
-[][]  \OT1/cmtt/m/sl/9 G $\U/lasy/m/n/9 ^^C$  \OT1/cmtt/m/sl/9 e : $[]$ U1 , n 
-, C $\OMS/cmsy/m/n/9 ^^]$  \OT1/cmtt/m/sl/9 T1 , m $[]$ ; G $\U/lasy/m/n/9 ^^C$
-  \OT1/cmtt/m/sl/9 ee : $[]$ U2 , m , C(x$\OMS/cmsy/m/n/9 7!$$[][]$\OT1/cmtt/m/
-sl/9 T1) $\OMS/cmsy/m/n/9 ^^]$
-
-Overfull \hbox (4.4306pt too wide) in paragraph at lines 257--258
-[][]  \OT1/cmtt/m/sl/9 G $\U/lasy/m/n/9 ^^C$  \OT1/cmtt/m/sl/9 (LET rf x =e IN 
-ee END) : $[]$ U1 $\OMS/cmsy/m/n/9 [$ \OT1/cmtt/m/sl/9 (U2 - {x}) , n , C $\OMS
-/cmsy/m/n/9 ^^]$  \OT1/cmtt/m/sl/9 T2 , k $[]$"[] 
-
-Overfull \hbox (5.1584pt too wide) in paragraph at lines 270--271
-[][]  $[][]\OMS/cmsy/m/n/9 )$ \OT1/cmtt/m/sl/9 G $\U/lasy/m/n/9 ^^C$ \OT1/cmtt/
-m/sl/9 (LET z = RPrimop f x y IN e END) : $[]${x, y} $\OMS/cmsy/m/n/9 [$ \OT1/c
-mtt/m/sl/9 U, n, C $\OMS/cmsy/m/n/9 ^^]$ \OT1/cmtt/m/sl/9 T, m$[]$"
-
-Overfull \hbox (14.09698pt too wide) in paragraph at lines 273--274
-[][]\OT1/cmtt/m/sl/9 (* Note: side conditions in match rules cannot be solved u
-ntil later because
-[6]
-Overfull \hbox (28.63316pt too wide) in paragraph at lines 292--293
-[][]$[][]\OMS/cmsy/m/n/9 )$ \OT1/cmtt/m/sl/9 G $\U/lasy/m/n/9 ^^C$  \OT1/cmtt/m
-/sl/9 (LET cont =t$[]$V0; rf left =t$\OMS/cmsy/m/n/9 }$\OT1/cmtt/m/sl/9 R1; rf 
-right =t$\OMS/cmsy/m/n/9 }$\OT1/cmtt/m/sl/9 R2;  _ =DIAM$[]$Free([RNarg
-
-Overfull \hbox (8.16101pt too wide) in paragraph at lines 300--301
-[][] $[][]\OMS/cmsy/m/n/9 )$ \OT1/cmtt/m/sl/9 G $\U/lasy/m/n/9 ^^C$ \OT1/cmtt/m
-/sl/9 (LET h = GetFi l V0; rf t = GetFr l R1; _ = DIAM$[]$Free ([RNarg l])
-
-Overfull \hbox (8.16101pt too wide) in paragraph at lines 308--309
-[][] $[][]\OMS/cmsy/m/n/9 )$ \OT1/cmtt/m/sl/9 G $\U/lasy/m/n/9 ^^C$ \OT1/cmtt/m
-/sl/9 (LET h = GetFi l V0; rf t = GetFr l R1; _ = DIAM$[]$Free ([RNarg l])
-
-Overfull \hbox (1.11948pt too wide) in paragraph at lines 315--316
-[][]     $\OMS/cmsy/m/n/9 8 $ \OT1/cmtt/m/sl/9 E h hh v p. sMST c M L E h hh v 
-p $[][]\OMS/cmsy/m/n/9 !$ $[]$\OT1/cmtt/m/sl/9 U, n, C $\OMS/cmsy/m/n/9 ^^]$ \O
-T1/cmtt/m/sl/9 T1, m$[]$ E h hh v
-
-Overfull \hbox (4.43343pt too wide) in paragraph at lines 319--320
-[][]   $[][]\OMS/cmsy/m/n/9 )$ \OT1/cmtt/m/sl/9 G $\U/lasy/m/n/9 ^^C$  \OT1/cmt
-t/m/sl/9 (LET rf x = c$[]$M(L) IN e END) : $[]$U $\OMS/cmsy/m/n/9 [$ \OT1/cmtt/
-m/sl/9 (V-{x}), nk, D $\OMS/cmsy/m/n/9 ^^]$ \OT1/cmtt/m/sl/9 T, l$[]$"
-
-Overfull \hbox (3.34715pt too wide) in paragraph at lines 323--324
-[][]     \OT1/cmtt/m/sl/9 "$[]$GETr C y = Some (TreeET k);GETr C z = Some (Tree
-ET k); y$\OMS/cmsy/m/n/9 6\OT1/cmr/m/n/9 =$\OT1/cmtt/m/sl/9 z; n=(Suc
-[7]
-Overfull \hbox (3.43605pt too wide) in paragraph at lines 326--327
-[][]     $[][]\OMS/cmsy/m/n/9 )$ \OT1/cmtt/m/sl/9 G $\U/lasy/m/n/9 ^^C$ \OT1/cm
-tt/m/sl/9 (LET rf x = DIAM$[]$Make_IIDD ([VALarg (IVal 3), INarg v, RNarg
-
-Overfull \hbox (62.34396pt too wide) in paragraph at lines 326--327
-\OT1/cmtt/m/sl/9 y, RNarg z]) IN e END): $[]$({y,z} $\OMS/cmsy/m/n/9 [$ \OT1/cm
-tt/m/sl/9 (U-{x})), n, C $\OMS/cmsy/m/n/9 ^^]$ \OT1/cmtt/m/sl/9 T, l$[]$" by (e
-rule DA_LetrMakeTree,
-
-Overfull \hbox (19.73325pt too wide) in paragraph at lines 335--336
-[][]\OT1/cmtt/m/sl/9 lemma vcg_domcallcons: "$[]$(t,{(Call h, $[]$U, n, C $\OMS
-/cmsy/m/n/9 ^^]$ \OT1/cmtt/m/sl/9 T, m$[]$)} $\OMS/cmsy/m/n/9 [$ \OT1/cmtt/m/sl
-/9 G,f,P):DOM_Call;[] 
-
-Overfull \hbox (42.44675pt too wide) in paragraph at lines 347--348
-[][]       \OT1/cmtt/m/sl/9 context which contains an one entry for each syntac
-tic method invocation.*}[] 
-
-Overfull \hbox (3.92209pt too wide) in paragraph at lines 350--351
-[][]  \OT1/cmtt/m/sl/9 {(HS$[]$Insert([INarg x_,RNarg r2_]), sMST HS Insert [IN
-arg x_,RNarg r2_]),[] 
-
-Overfull \hbox (8.64705pt too wide) in paragraph at lines 351--352
-[][]  \OT1/cmtt/m/sl/9 (HS$[]$Insert([INarg v4_,RNarg r2_]), sMST HS Insert [IN
-arg v4_,RNarg r2_]),[] 
-
-Overfull \hbox (3.92209pt too wide) in paragraph at lines 358--359
-[][]  \OT1/cmtt/m/sl/9 (HS$[]$Siftdown([INarg v2_, RNarg r3_, RNarg r1_]), sMST
- HS Siftdown [INarg
-
-Overfull \hbox (18.09697pt too wide) in paragraph at lines 359--360
-[][]  \OT1/cmtt/m/sl/9 (HS$[]$Siftdown([INarg w_, RNarg r5_, RNarg r4_]), sMST 
-HS Siftdown [INarg w_,
-
-Overfull \hbox (18.09697pt too wide) in paragraph at lines 360--361
-[][]  \OT1/cmtt/m/sl/9 (HS$[]$Siftdown([INarg w_, RNarg r8_, RNarg r7_]), sMST 
-HS Siftdown [INarg w_,
-[8]
-Overfull \hbox (14.09698pt too wide) in paragraph at lines 380--381
-[][]    \OT1/cmtt/m/sl/9 CHANGED (simp_tac ((Simplifier.get_local_simpset ctxt)
- addsimps thms) i)[] 
-
-Overfull \hbox (18.82195pt too wide) in paragraph at lines 382--383
-[][]    \OT1/cmtt/m/sl/9 CHANGED (asm_simp_tac ((Simplifier.get_local_simpset c
-txt) addsimps thms)
-[9] [10]
-Overfull \hbox (18.82195pt too wide) in paragraph at lines 510--511
-[][]\OT1/cmtt/m/sl/9 (*            apply method_Let prefer 2 apply (simp add: H
-eapSortContext_def)[] 
-
-Overfull \hbox (18.82195pt too wide) in paragraph at lines 511--512
-[][]                             \OT1/cmtt/m/sl/9 prefer 2 apply (clarsimp, eru
-le Siftdown_Invoke,
-
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 518--519
-[][]  \OT1/cmtt/m/sl/9 (* for solving premise of vcg_call -- either unfold Dom 
-def, or lookup *)
-[11]
-Overfull \hbox (28.27187pt too wide) in paragraph at lines 557--558
-[][]   \OT1/cmtt/m/sl/9 fun main_tac ctxt (alldefs as (flowdefs,dom_defs,gamma_
-def)) i state = state
-
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 562--563
-[][]   \OT1/cmtt/m/sl/9 and main_tac_aux ctxt (alldefs as (flowdefs,dom_defs,ga
-mma_def)) i state
-
-Overfull \hbox (14.09698pt too wide) in paragraph at lines 566--567
-[][]            \OT1/cmtt/m/sl/9 let_tac ctxt (flowdefs @ gamma_def)  (main_tac
-_aux ctxt alldefs)
-
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 575--576
-[][]\OT1/cmtt/m/sl/9 (* Testing methods for invoking parts of the tactic above 
-[for debug only]
-[12]
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 585--586
-[][]\OT1/cmtt/m/sl/9 method_setup method_Let = {* Method.thms_ctxt_args (fn thm
-s => fn ctxt => [] 
-
-Overfull \hbox (14.09698pt too wide) in paragraph at lines 589--590
-[][]\OT1/cmtt/m/sl/9 (* apply (rule vcg_call) apply (simp add: dominates_def is
-MergePoint_def) *)[] 
-
-Overfull \hbox (42.44675pt too wide) in paragraph at lines 594--595
-[][]\OT1/cmtt/m/sl/9 (* apply (simp?, (rule DA_NullResult, simp) | rule DA_Null
-Tree | rule DA_NullList)
-
-Overfull \hbox (18.82195pt too wide) in paragraph at lines 603--604
-[][]\OT1/cmtt/m/sl/9 (* FIXME: to combine method_Call with method_Dom or mergep
-oint stuff, we need
-
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 606--607
-[][]\OT1/cmtt/m/sl/9 (* apply ((rule vcg_domcallcons) | (rule vcg_domcallnil))+
- apply simp apply
-
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 608--609
-[][]  \OT1/cmtt/m/sl/9 fn ctxt => Method.METHOD (fn facts => dom_tac ctxt thms 
-stop stop 1)) *}[] 
-
-Overfull \hbox (37.72179pt too wide) in paragraph at lines 624--625
-[][]         \OT1/cmtt/m/sl/9 two_subgoal_tacs i THEN vdm_tac (i+1) THEN vdm_ta
-c i,  (* stack: reverse
-
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 630--631
-[][]\OT1/cmtt/m/sl/9 (* apply ((rule vcg_domcallcons) | (rule vcg_domcallnil))+
- apply simp apply
-
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 631--632
-[][]\OT1/cmtt/m/sl/9 method_setup method_Weak = {* Method.thms_ctxt_args (fn th
-ms => fn ctxt =>
-[13]
-Overfull \hbox (37.72179pt too wide) in paragraph at lines 636--637
-[][]\OT1/cmtt/m/sl/9 (*methods call and dom are applied together, using CallDom
-: proofs takes 55secs*)[] 
-
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 642--643
-[][]\OT1/cmtt/m/sl/9 (* apply (method_main dominates_def isMergePoint_def MFS_d
-efs SPEC_def) *)[] 
-
-Overfull \hbox (42.44675pt too wide) in paragraph at lines 657--658
-[][]\OT1/cmtt/m/sl/9 (* Method main: writing bits of ML code to parse in Isar i
-s a pain, so we hardwire[] 
-
-Overfull \hbox (28.27187pt too wide) in paragraph at lines 666--667
-[][]  \OT1/cmtt/m/sl/9 Method.METHOD (fn facts => main_tac ctxt (thms "flow_def
-s", thms "doms_defs",
-
-Overfull \hbox (47.1717pt too wide) in paragraph at lines 670--671
-[][]  \OT1/cmtt/m/sl/9 Method.METHOD (fn facts => main_tac_aux ctxt (thms "flow
-_defs", thms "doms_defs",
-
-Overfull \hbox (13.4388pt too wide) in paragraph at lines 674--675
-[][]\OT1/cmtt/m/sl/9 "$[]$G = HeapSortContext$[]$ $[][]\OMS/cmsy/m/n/9 )$ \OT1/
-cmtt/m/sl/9 G $\U/lasy/m/n/9 ^^C$ \OT1/cmtt/m/sl/9 snd (methtable HS Siftdown) 
-: SPEC Siftdown"[] 
-[14] [15] [16]
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 805--806
-[][]                \OT1/cmtt/m/sl/9 apply (method_Dom doms_defs)  (* this the 
-place that cut is
-
-Overfull \hbox (37.72179pt too wide) in paragraph at lines 830--831
-[][]                                \OT1/cmtt/m/sl/9 (*Call*) (* first call to 
-the merge point ffour*)[] 
-
-Overfull \hbox (18.82195pt too wide) in paragraph at lines 840--841
-[][]                                \OT1/cmtt/m/sl/9 (*Call*) (*This is the sec
-ond call to ffour*)[] 
-[17]
-Overfull \hbox (18.82195pt too wide) in paragraph at lines 853--854
-[][]                    \OT1/cmtt/m/sl/9 (*1*) apply simp (*contraint came from
- TreematchD STAR.*)[] 
-
-Overfull \hbox (18.82195pt too wide) in paragraph at lines 855--856
-[][]                     \OT1/cmtt/m/sl/9 (*this is like a top-level verificati
-on, i.e.starts with
-
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 878--879
-[][]                           \OT1/cmtt/m/sl/9 apply (method_Dom doms_defs)  (
-* this the place
-[18]
-Overfull \hbox (18.82195pt too wide) in paragraph at lines 900--901
-[][]                                   \OT1/cmtt/m/sl/9 (*call This is the firs
-t call to feleven*)[] 
-
-Overfull \hbox (23.5469pt too wide) in paragraph at lines 910--911
-[][]                                   \OT1/cmtt/m/sl/9 (*call This is the seco
-nd call to feleven*)[] 
-
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 920--921
-[][]                                 \OT1/cmtt/m/sl/9 (*call This is the third 
-call to feleven*)[] 
-
-Overfull \hbox (32.99683pt too wide) in paragraph at lines 924--925
-[][]                             \OT1/cmtt/m/sl/9 (*this is like a top-level ve
-rification, i.e.starts
-
-Overfull \hbox (23.5469pt too wide) in paragraph at lines 938--939
-[][]                                           \OT1/cmtt/m/sl/9 (*of course, de
-fining the adaptaion
-
-Overfull \hbox (37.72179pt too wide) in paragraph at lines 939--940
-[][]                                           \OT1/cmtt/m/sl/9 apply (method_L
-et HeapSortContext_def)[] 
-
-Overfull \hbox (23.5469pt too wide) in paragraph at lines 943--944
-[][]                                           \OT1/cmtt/m/sl/9 (*1*) apply sim
-p (*letinvokeconst*)[] 
-[19]
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 951--952
-[][]                                     \OT1/cmtt/m/sl/9 apply (method_Let Hea
-pSortContext_def)[] 
-
-Overfull \hbox (14.09698pt too wide) in paragraph at lines 957--958
-[][]                                           \OT1/cmtt/m/sl/9 (*2*) apply sim
-p (*letrmaketree*)[] 
-
-Overfull \hbox (51.89667pt too wide) in paragraph at lines 959--960
-[][]                             \OT1/cmtt/m/sl/9 (*2*) apply fast (* the weake
-ning from the verification
-
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 960--961
-[][]                   \OT1/cmtt/m/sl/9 (*2*) apply fast (* the weakening from 
-the verification
-
-Overfull \hbox (240.89508pt too wide) in paragraph at lines 967--968
-[][]\OT1/cmtt/m/sl/9 (* =======================================================
-==================================================================
-)) [20] (./root.aux) )
-(see the transcript file for additional information)
-Output written on root.dvi (20 pages, 43848 bytes).
-Transcript written on root.log.
-This is TeXk, Version 3.14159 (Web2C 7.4.5)
- %&-line parsing enabled.
-LaTeX2e <2001/06/01>
-Babel <v3.7h> and hyphenation patterns for american, french, german, ngerman, n
-ohyphenation, loaded.
-
-(./root.tex (/usr/share/texmf/tex/latex/base/article.cls
-Document Class: article 2001/04/21 v1.4e Standard LaTeX document class
-(/usr/share/texmf/tex/latex/base/size10.clo)) (./isabelle.sty)
-(./isabellesym.sty) (/usr/share/texmf/tex/latex/base/inputenc.sty
-(/usr/share/texmf/tex/latex/base/latin1.def)) (./pdfsetup.sty)
-(/usr/local/texmf.da/tex/latex/comisc/url.sty)
-(/usr/share/texmf/tex/latex/base/latexsym.sty) (./root.aux) (./session.tex
-(./HeapSortProofVCG.tex
-Overfull \hbox (14.09698pt too wide) in paragraph at lines 6--7
-[][]  \OT1/cmtt/m/sl/9 -- would be desirable to redesign CALLMP rule so that si
-de condition which[] 
-
-Overfull \hbox (42.44675pt too wide) in paragraph at lines 12--13
-[][]       \OT1/cmtt/m/sl/9 generates (variable number of) subgoals for each fu
-nction that is dominated
-(/usr/share/texmf/tex/latex/base/ulasy.fd)
-Overfull \hbox (23.5469pt too wide) in paragraph at lines 19--20
-[][]       \OT1/cmtt/m/sl/9 need to verify n+1, which leaves indeterminate numb
-er of side-condition
-
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 31--32
-[][]       \OT1/cmtt/m/sl/9 maybe a good idea to have a method for (each) primi
-tives, and then a
-
-Overfull \hbox (18.82195pt too wide) in paragraph at lines 32--33
-[][]       \OT1/cmtt/m/sl/9 let which does the composition on-the-fly  --- this
- avoids duplicating
-
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 35--36
-[][]        \OT1/cmtt/m/sl/9 -- define ML values bound to tactics appearing in 
-bodies of methods[] 
-
-Overfull \hbox (14.09698pt too wide) in paragraph at lines 47--48
-[][]\OT1/cmtt/m/sl/9 text {*This corresponds to the following specifications, f
-ormalised from the
-
-Overfull \hbox (14.09698pt too wide) in paragraph at lines 48--49
-[][]       \OT1/cmtt/m/sl/9 method bodies: the contexts (in second parameter of
- @{text DAss}) are
-[1]
-Overfull \hbox (5.55548pt too wide) in paragraph at lines 52--53
-[][]  \OT1/cmtt/m/sl/9 (if M = Insert then (DAss {t_} 1 (emptyfinmap(t_ $\OMS/c
-msy/m/n/9 7!$$[][]$\OT1/cmtt/m/sl/9 (TreeET 0))) (TreeET
-
-Overfull \hbox (29.18028pt too wide) in paragraph at lines 53--54
-[][]  \OT1/cmtt/m/sl/9 if M = Removesome then (DAss {t_} 0 (emptyfinmap(t_ $\OM
-S/cmsy/m/n/9 7!$$[][]$\OT1/cmtt/m/sl/9 (TreeET 0))) (ResultET
-
-Overfull \hbox (24.45532pt too wide) in paragraph at lines 54--55
-[][]  \OT1/cmtt/m/sl/9 if M = Removetop then (DAss {t_} 0 (emptyfinmap(t_ $\OMS
-/cmsy/m/n/9 7!$$[][]$\OT1/cmtt/m/sl/9 (TreeET 0))) (ResultET
-
-Overfull \hbox (15.0054pt too wide) in paragraph at lines 55--56
-[][]  \OT1/cmtt/m/sl/9 if M = Make_heap then (DAss {l_} 0 (emptyfinmap(l_ $\OMS
-/cmsy/m/n/9 7!$$[][]$\OT1/cmtt/m/sl/9 (ListET 0))) (TreeET
-
-Overfull \hbox (5.55548pt too wide) in paragraph at lines 56--57
-[][]  \OT1/cmtt/m/sl/9 if M = Extract then (DAss {h_} 0 (emptyfinmap(h_ $\OMS/c
-msy/m/n/9 7!$$[][]$\OT1/cmtt/m/sl/9 (TreeET 0))) (ListET
-
-Overfull \hbox (19.73036pt too wide) in paragraph at lines 57--58
-[][]  \OT1/cmtt/m/sl/9 if M = Siftdown then (DAss {t1_, t2_} 1 (emptyfinmap(t1_
- $\OMS/cmsy/m/n/9 7!$$[][]$\OT1/cmtt/m/sl/9 (TreeET 0))(t2_
-
-Overfull \hbox (5.55548pt too wide) in paragraph at lines 58--59
-[][]  \OT1/cmtt/m/sl/9 if M = Sort then (DAss {l_} 0 (emptyfinmap(l_ $\OMS/cmsy
-/m/n/9 7!$$[][]$\OT1/cmtt/m/sl/9 (ListET 0))) (ListET 0)
-
-Overfull \hbox (20.53447pt too wide) in paragraph at lines 65--66
-[][]\OT1/cmtt/m/sl/9 "sMST == ($\OML/cmm/m/it/9 ^^U$ \OT1/cmtt/m/sl/9 C M args 
-E h hh v p. SPEC M (newframe_env Nullref (fst (methtable
-
-Overfull \hbox (70.79651pt too wide) in paragraph at lines 70--71
-[][]  \OT1/cmtt/m/sl/9 Meth_Insert Fun_fInsert Fun_fzeroInsert Fun_foneInsert F
-un_ftwoInsert Fun_fthreeInsert[] 
-
-Overfull \hbox (61.34659pt too wide) in paragraph at lines 74--75
-[][]  \OT1/cmtt/m/sl/9 Meth_Removetop Fun_fRemovetop Fun_fzeroRemovetop Fun_fon
-eRemovetop Fun_ftwoRemovetop
-
-Overfull \hbox (37.72179pt too wide) in paragraph at lines 75--76
-[][]  \OT1/cmtt/m/sl/9 Meth_Siftdown Fun_fSiftdown Fun_fzeroSiftdown Fun_foneSi
-ftdown Fun_ftwoSiftdown
-
-Overfull \hbox (89.69635pt too wide) in paragraph at lines 76--77
-[][]  \OT1/cmtt/m/sl/9 Fun_ffourSiftdown Fun_ffiveSiftdown Fun_fsixSiftdown Fun
-_fsevenSiftdown Fun_feightSiftdown[] 
-
-Overfull \hbox (14.09698pt too wide) in paragraph at lines 77--78
-[][]  \OT1/cmtt/m/sl/9 Fun_fnineSiftdown Fun_ftenSiftdown Fun_felevenSiftdown F
-un_ftwelveSiftdown
-
-Overfull \hbox (70.79651pt too wide) in paragraph at lines 78--79
-[][]  \OT1/cmtt/m/sl/9 Fun_ffourteenSiftdown Fun_ffifteenSiftdown Fun_fsixteenS
-iftdown Fun_fseventeenSiftdown
-
-Overfull \hbox (38.27744pt too wide) in paragraph at lines 81--82
-[][]\OT1/cmtt/m/sl/9 lemma LL2: "$[]$(E, h, U,C,R,m):CS; U = V$[]$ $[][]\OMS/cm
-sy/m/n/9 )$ \OT1/cmtt/m/sl/9 (E, h, V,C,R,m):CS" (*<*)by simp(*>*)[] 
-
-Overfull \hbox (12.18752pt too wide) in paragraph at lines 88--89
-[][]  $[]$ \OT1/cmtt/m/sl/9 {y,z} , 1 , (emptyfinmap(y $\OMS/cmsy/m/n/9 7!$$[][
-]$\OT1/cmtt/m/sl/9 (TreeET 0))(z $\OMS/cmsy/m/n/9 7!$$[][]$\OT1/cmtt/m/sl/9 (Tr
-eeET 0))) $\OMS/cmsy/m/n/9 ^^]$  \OT1/cmtt/m/sl/9 (TreeET
-
-Overfull \hbox (47.1717pt too wide) in paragraph at lines 90--91
-[][]\OT1/cmtt/m/sl/9 apply (simp add: sMST_def SPEC_def MFS_defs newframe_env_d
-ef evalARGS_def self_def)[] 
-[2]
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 92--93
-[][]\OT1/cmtt/m/sl/9 apply (erule_tac x=q in allE, erule_tac x=F in allE, erule
-_tac x=R in allE,
-
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 96--97
-[][]        \OT1/cmtt/m/sl/9 ( (rule CS_NIL, fastsimp, simp+) | (rule CS_CONS, 
-fastsimp, simp+)
-
-Overfull \hbox (7.43889pt too wide) in paragraph at lines 103--104
-[][] $[][]\OMS/cmsy/m/n/9 )$ $[]$ \OT1/cmtt/m/sl/9 {x}, 0 , (emptyfinmap(x $\OM
-S/cmsy/m/n/9 7!$$[][]$\OT1/cmtt/m/sl/9 (ListET 0)))  $\OMS/cmsy/m/n/9 ^^]$ \OT1
-/cmtt/m/sl/9 (TreeET 0) , 0 $[]$ E h hh
-
-Overfull \hbox (47.1717pt too wide) in paragraph at lines 105--106
-[][]\OT1/cmtt/m/sl/9 apply (simp add: sMST_def SPEC_def MFS_defs newframe_env_d
-ef evalARGS_def self_def)[] 
-
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 107--108
-[][]\OT1/cmtt/m/sl/9 apply (erule_tac x=q in allE, erule_tac x=F in allE, erule
-_tac x=R in allE,
-
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 111--112
-[][]        \OT1/cmtt/m/sl/9 ( (rule CS_NIL, fastsimp, simp+) | (rule CS_CONS, 
-fastsimp, simp+)
-
-Overfull \hbox (47.1717pt too wide) in paragraph at lines 120--121
-[][]\OT1/cmtt/m/sl/9 apply (simp add: sMST_def SPEC_def MFS_defs newframe_env_d
-ef evalARGS_def self_def)[] 
-
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 122--123
-[][]\OT1/cmtt/m/sl/9 apply (erule_tac x=q in allE, erule_tac x=F in allE, erule
-_tac x=R in allE,
-
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 126--127
-[][]        \OT1/cmtt/m/sl/9 ( (rule CS_NIL, fastsimp, simp+) | (rule CS_CONS, 
-fastsimp, simp+)
-
-Overfull \hbox (2.71393pt too wide) in paragraph at lines 133--134
-[][]$[][]\OMS/cmsy/m/n/9 )$ $[]$ \OT1/cmtt/m/sl/9 {x}, 0 , (emptyfinmap(x $\OMS
-/cmsy/m/n/9 7!$$[][]$\OT1/cmtt/m/sl/9 (TreeET 0)))  $\OMS/cmsy/m/n/9 ^^]$ \OT1/
-cmtt/m/sl/9 (ListET 0) , 0 $[]$ E h hh
-
-Overfull \hbox (47.1717pt too wide) in paragraph at lines 135--136
-[][]\OT1/cmtt/m/sl/9 apply (simp add: sMST_def SPEC_def MFS_defs newframe_env_d
-ef evalARGS_def self_def)[] 
-
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 137--138
-[][]\OT1/cmtt/m/sl/9 apply (erule_tac x=q in allE, erule_tac x=F in allE, erule
-_tac x=R in allE,
-[3]
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 141--142
-[][]        \OT1/cmtt/m/sl/9 ( (rule CS_NIL, fastsimp, simp+) | (rule CS_CONS, 
-fastsimp, simp+)
-
-Overfull \hbox (3.75562pt too wide) in paragraph at lines 148--149
-[][]$[][]\OMS/cmsy/m/n/9 )$ $[]$ \OT1/cmtt/m/sl/9 {y} , 1 , (emptyfinmap(y $\OM
-S/cmsy/m/n/9 7!$$[][]$\OT1/cmtt/m/sl/9 (TreeET 0))) $\OMS/cmsy/m/n/9 ^^]$  \OT1
-/cmtt/m/sl/9 (TreeET 0), 0 $[]$ E h hh
-
-Overfull \hbox (47.1717pt too wide) in paragraph at lines 150--151
-[][]\OT1/cmtt/m/sl/9 apply (simp add: sMST_def SPEC_def MFS_defs newframe_env_d
-ef evalARGS_def self_def)[] 
-
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 152--153
-[][]\OT1/cmtt/m/sl/9 apply (erule_tac x=q in allE, erule_tac x=F in allE, erule
-_tac x=R in allE,
-
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 156--157
-[][]        \OT1/cmtt/m/sl/9 ( (rule CS_NIL, fastsimp, simp+) | (rule CS_CONS, 
-fastsimp, simp+)
-
-Overfull \hbox (2.55698pt too wide) in paragraph at lines 163--164
-[][]$[][]\OMS/cmsy/m/n/9 )$ $[]$ \OT1/cmtt/m/sl/9 {x} , 0 , (emptyfinmap(x $\OM
-S/cmsy/m/n/9 7!$$[][]$\OT1/cmtt/m/sl/9 (TreeET 0))) $\OMS/cmsy/m/n/9 ^^]$  \OT1
-/cmtt/m/sl/9 (ResultET 0 (TreeET 0)
-
-Overfull \hbox (47.1717pt too wide) in paragraph at lines 165--166
-[][]\OT1/cmtt/m/sl/9 apply (simp add: sMST_def SPEC_def MFS_defs newframe_env_d
-ef evalARGS_def self_def)[] 
-
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 167--168
-[][]\OT1/cmtt/m/sl/9 apply (erule_tac x=q in allE, erule_tac x=F in allE, erule
-_tac x=R in allE,
-
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 171--172
-[][]        \OT1/cmtt/m/sl/9 ( (rule CS_NIL, fastsimp, simp+) | (rule CS_CONS, 
-fastsimp, simp+)
-
-Overfull \hbox (2.55698pt too wide) in paragraph at lines 178--179
-[][]$[][]\OMS/cmsy/m/n/9 )$ $[]$ \OT1/cmtt/m/sl/9 {x} , 0 , (emptyfinmap(x $\OM
-S/cmsy/m/n/9 7!$$[][]$\OT1/cmtt/m/sl/9 (TreeET 0))) $\OMS/cmsy/m/n/9 ^^]$  \OT1
-/cmtt/m/sl/9 (ResultET 0 (TreeET 0)
-
-Overfull \hbox (47.1717pt too wide) in paragraph at lines 180--181
-[][]\OT1/cmtt/m/sl/9 apply (simp add: sMST_def SPEC_def MFS_defs newframe_env_d
-ef evalARGS_def self_def)[] 
-
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 182--183
-[][]\OT1/cmtt/m/sl/9 apply (erule_tac x=q in allE, erule_tac x=F in allE, erule
-_tac x=R in allE,
-[4]
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 186--187
-[][]        \OT1/cmtt/m/sl/9 ( (rule CS_NIL, fastsimp, simp+) | (rule CS_CONS, 
-fastsimp, simp+)
-
-Overfull \hbox (2.5181pt too wide) in paragraph at lines 208--209
-[][]\OT1/cmtt/m/sl/9 lemma vcg_rvar: "GETr C x = Some T $[][]\OMS/cmsy/m/n/9 )$
- \OT1/cmtt/m/sl/9 G $\U/lasy/m/n/9 ^^C$  \OT1/cmtt/m/sl/9 RVar x : $[]$ {x} , n
- , C $\OMS/cmsy/m/n/9 ^^]$  \OT1/cmtt/m/sl/9 T
-
-Overfull \hbox (12.12497pt too wide) in paragraph at lines 218--219
-[][]                 $[][]\OMS/cmsy/m/n/9 )$ \OT1/cmtt/m/sl/9 G $\U/lasy/m/n/9 
-^^C$  \OT1/cmtt/m/sl/9 RPrimop f x y : $[]$ {x, y} , n , C $\OMS/cmsy/m/n/9 ^^]
-$ \OT1/cmtt/m/sl/9 IntET , n $[]$"
-
-Overfull \hbox (8.07211pt too wide) in paragraph at lines 230--231
-[][]     \OT1/cmtt/m/sl/9 "$[]$GETr C y = Some (TreeET k); GETr C z = Some (Tre
-eET k); y$\OMS/cmsy/m/n/9 6\OT1/cmr/m/n/9 =$\OT1/cmtt/m/sl/9 z; n=(Suc
-
-Overfull \hbox (17.61093pt too wide) in paragraph at lines 231--232
-[][]     $[][]\OMS/cmsy/m/n/9 )$ \OT1/cmtt/m/sl/9 G $\U/lasy/m/n/9 ^^C$ \OT1/cm
-tt/m/sl/9 (DIAM$[]$Make_IIDD ([VALarg (IVal 3), INarg v, RNarg y, RNarg z]))
-[5]
-Overfull \hbox (1.16122pt too wide) in paragraph at lines 239--240
-[][]  \OT1/cmtt/m/sl/9 "$\OMS/cmsy/m/n/9 :$ \OT1/cmtt/m/sl/9 isMergePoint f $\O
-MS/cmsy/m/n/9 ^$ \OT1/cmtt/m/sl/9 (dominates f, G, f, $[]$U, n, C $\OMS/cmsy/m/
-n/9 ^^]$ \OT1/cmtt/m/sl/9 T, m$[]$) $\OMS/cmsy/m/n/9 2$ \OT1/cmtt/m/sl/9 DOM_Ca
-ll
-
-Overfull \hbox (12.61101pt too wide) in paragraph at lines 241--242
-[][]\OT1/cmtt/m/sl/9 (CALL f, $[]$U, n , restr C (ParList2RnameList (fst (funta
-ble f))) $\OMS/cmsy/m/n/9 ^^]$ \OT1/cmtt/m/sl/9 T , m $[]$)
-
-Overfull \hbox (1.16122pt too wide) in paragraph at lines 245--246
-[][]  \OT1/cmtt/m/sl/9 "$\OMS/cmsy/m/n/9 :$ \OT1/cmtt/m/sl/9 isMergePoint f $\O
-MS/cmsy/m/n/9 ^$ \OT1/cmtt/m/sl/9 (dominates f, G, f, $[]$U, n, C $\OMS/cmsy/m/
-n/9 ^^]$ \OT1/cmtt/m/sl/9 T, m$[]$) $\OMS/cmsy/m/n/9 2$ \OT1/cmtt/m/sl/9 DOM_Ca
-ll
-
-Overfull \hbox (12.61101pt too wide) in paragraph at lines 247--248
-[][]\OT1/cmtt/m/sl/9 (CALL f, $[]$U, n , restr C (ParList2RnameList (fst (funta
-ble f))) $\OMS/cmsy/m/n/9 ^^]$ \OT1/cmtt/m/sl/9 T , m $[]$)
-
-Overfull \hbox (8.40714pt too wide) in paragraph at lines 256--257
-[][]  \OT1/cmtt/m/sl/9 G $\U/lasy/m/n/9 ^^C$  \OT1/cmtt/m/sl/9 e : $[]$ U1 , n 
-, C $\OMS/cmsy/m/n/9 ^^]$  \OT1/cmtt/m/sl/9 T1 , m $[]$ ; G $\U/lasy/m/n/9 ^^C$
-  \OT1/cmtt/m/sl/9 ee : $[]$ U2 , m , C(x$\OMS/cmsy/m/n/9 7!$$[][]$\OT1/cmtt/m/
-sl/9 T1) $\OMS/cmsy/m/n/9 ^^]$
-
-Overfull \hbox (4.4306pt too wide) in paragraph at lines 257--258
-[][]  \OT1/cmtt/m/sl/9 G $\U/lasy/m/n/9 ^^C$  \OT1/cmtt/m/sl/9 (LET rf x =e IN 
-ee END) : $[]$ U1 $\OMS/cmsy/m/n/9 [$ \OT1/cmtt/m/sl/9 (U2 - {x}) , n , C $\OMS
-/cmsy/m/n/9 ^^]$  \OT1/cmtt/m/sl/9 T2 , k $[]$"[] 
-
-Overfull \hbox (5.1584pt too wide) in paragraph at lines 270--271
-[][]  $[][]\OMS/cmsy/m/n/9 )$ \OT1/cmtt/m/sl/9 G $\U/lasy/m/n/9 ^^C$ \OT1/cmtt/
-m/sl/9 (LET z = RPrimop f x y IN e END) : $[]${x, y} $\OMS/cmsy/m/n/9 [$ \OT1/c
-mtt/m/sl/9 U, n, C $\OMS/cmsy/m/n/9 ^^]$ \OT1/cmtt/m/sl/9 T, m$[]$"
-
-Overfull \hbox (14.09698pt too wide) in paragraph at lines 273--274
-[][]\OT1/cmtt/m/sl/9 (* Note: side conditions in match rules cannot be solved u
-ntil later because
-[6]
-Overfull \hbox (28.63316pt too wide) in paragraph at lines 292--293
-[][]$[][]\OMS/cmsy/m/n/9 )$ \OT1/cmtt/m/sl/9 G $\U/lasy/m/n/9 ^^C$  \OT1/cmtt/m
-/sl/9 (LET cont =t$[]$V0; rf left =t$\OMS/cmsy/m/n/9 }$\OT1/cmtt/m/sl/9 R1; rf 
-right =t$\OMS/cmsy/m/n/9 }$\OT1/cmtt/m/sl/9 R2;  _ =DIAM$[]$Free([RNarg
-
-Overfull \hbox (8.16101pt too wide) in paragraph at lines 300--301
-[][] $[][]\OMS/cmsy/m/n/9 )$ \OT1/cmtt/m/sl/9 G $\U/lasy/m/n/9 ^^C$ \OT1/cmtt/m
-/sl/9 (LET h = GetFi l V0; rf t = GetFr l R1; _ = DIAM$[]$Free ([RNarg l])
-
-Overfull \hbox (8.16101pt too wide) in paragraph at lines 308--309
-[][] $[][]\OMS/cmsy/m/n/9 )$ \OT1/cmtt/m/sl/9 G $\U/lasy/m/n/9 ^^C$ \OT1/cmtt/m
-/sl/9 (LET h = GetFi l V0; rf t = GetFr l R1; _ = DIAM$[]$Free ([RNarg l])
-
-Overfull \hbox (1.11948pt too wide) in paragraph at lines 315--316
-[][]     $\OMS/cmsy/m/n/9 8 $ \OT1/cmtt/m/sl/9 E h hh v p. sMST c M L E h hh v 
-p $[][]\OMS/cmsy/m/n/9 !$ $[]$\OT1/cmtt/m/sl/9 U, n, C $\OMS/cmsy/m/n/9 ^^]$ \O
-T1/cmtt/m/sl/9 T1, m$[]$ E h hh v
-
-Overfull \hbox (4.43343pt too wide) in paragraph at lines 319--320
-[][]   $[][]\OMS/cmsy/m/n/9 )$ \OT1/cmtt/m/sl/9 G $\U/lasy/m/n/9 ^^C$  \OT1/cmt
-t/m/sl/9 (LET rf x = c$[]$M(L) IN e END) : $[]$U $\OMS/cmsy/m/n/9 [$ \OT1/cmtt/
-m/sl/9 (V-{x}), nk, D $\OMS/cmsy/m/n/9 ^^]$ \OT1/cmtt/m/sl/9 T, l$[]$"
-
-Overfull \hbox (3.34715pt too wide) in paragraph at lines 323--324
-[][]     \OT1/cmtt/m/sl/9 "$[]$GETr C y = Some (TreeET k);GETr C z = Some (Tree
-ET k); y$\OMS/cmsy/m/n/9 6\OT1/cmr/m/n/9 =$\OT1/cmtt/m/sl/9 z; n=(Suc
-[7]
-Overfull \hbox (3.43605pt too wide) in paragraph at lines 326--327
-[][]     $[][]\OMS/cmsy/m/n/9 )$ \OT1/cmtt/m/sl/9 G $\U/lasy/m/n/9 ^^C$ \OT1/cm
-tt/m/sl/9 (LET rf x = DIAM$[]$Make_IIDD ([VALarg (IVal 3), INarg v, RNarg
-
-Overfull \hbox (62.34396pt too wide) in paragraph at lines 326--327
-\OT1/cmtt/m/sl/9 y, RNarg z]) IN e END): $[]$({y,z} $\OMS/cmsy/m/n/9 [$ \OT1/cm
-tt/m/sl/9 (U-{x})), n, C $\OMS/cmsy/m/n/9 ^^]$ \OT1/cmtt/m/sl/9 T, l$[]$" by (e
-rule DA_LetrMakeTree,
-
-Overfull \hbox (19.73325pt too wide) in paragraph at lines 335--336
-[][]\OT1/cmtt/m/sl/9 lemma vcg_domcallcons: "$[]$(t,{(Call h, $[]$U, n, C $\OMS
-/cmsy/m/n/9 ^^]$ \OT1/cmtt/m/sl/9 T, m$[]$)} $\OMS/cmsy/m/n/9 [$ \OT1/cmtt/m/sl
-/9 G,f,P):DOM_Call;[] 
-
-Overfull \hbox (42.44675pt too wide) in paragraph at lines 347--348
-[][]       \OT1/cmtt/m/sl/9 context which contains an one entry for each syntac
-tic method invocation.*}[] 
-
-Overfull \hbox (3.92209pt too wide) in paragraph at lines 350--351
-[][]  \OT1/cmtt/m/sl/9 {(HS$[]$Insert([INarg x_,RNarg r2_]), sMST HS Insert [IN
-arg x_,RNarg r2_]),[] 
-
-Overfull \hbox (8.64705pt too wide) in paragraph at lines 351--352
-[][]  \OT1/cmtt/m/sl/9 (HS$[]$Insert([INarg v4_,RNarg r2_]), sMST HS Insert [IN
-arg v4_,RNarg r2_]),[] 
-
-Overfull \hbox (3.92209pt too wide) in paragraph at lines 358--359
-[][]  \OT1/cmtt/m/sl/9 (HS$[]$Siftdown([INarg v2_, RNarg r3_, RNarg r1_]), sMST
- HS Siftdown [INarg
-
-Overfull \hbox (18.09697pt too wide) in paragraph at lines 359--360
-[][]  \OT1/cmtt/m/sl/9 (HS$[]$Siftdown([INarg w_, RNarg r5_, RNarg r4_]), sMST 
-HS Siftdown [INarg w_,
-
-Overfull \hbox (18.09697pt too wide) in paragraph at lines 360--361
-[][]  \OT1/cmtt/m/sl/9 (HS$[]$Siftdown([INarg w_, RNarg r8_, RNarg r7_]), sMST 
-HS Siftdown [INarg w_,
-[8]
-Overfull \hbox (14.09698pt too wide) in paragraph at lines 380--381
-[][]    \OT1/cmtt/m/sl/9 CHANGED (simp_tac ((Simplifier.get_local_simpset ctxt)
- addsimps thms) i)[] 
-
-Overfull \hbox (18.82195pt too wide) in paragraph at lines 382--383
-[][]    \OT1/cmtt/m/sl/9 CHANGED (asm_simp_tac ((Simplifier.get_local_simpset c
-txt) addsimps thms)
-[9] [10]
-Overfull \hbox (18.82195pt too wide) in paragraph at lines 510--511
-[][]\OT1/cmtt/m/sl/9 (*            apply method_Let prefer 2 apply (simp add: H
-eapSortContext_def)[] 
-
-Overfull \hbox (18.82195pt too wide) in paragraph at lines 511--512
-[][]                             \OT1/cmtt/m/sl/9 prefer 2 apply (clarsimp, eru
-le Siftdown_Invoke,
-
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 518--519
-[][]  \OT1/cmtt/m/sl/9 (* for solving premise of vcg_call -- either unfold Dom 
-def, or lookup *)
-[11]
-Overfull \hbox (28.27187pt too wide) in paragraph at lines 557--558
-[][]   \OT1/cmtt/m/sl/9 fun main_tac ctxt (alldefs as (flowdefs,dom_defs,gamma_
-def)) i state = state
-
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 562--563
-[][]   \OT1/cmtt/m/sl/9 and main_tac_aux ctxt (alldefs as (flowdefs,dom_defs,ga
-mma_def)) i state
-
-Overfull \hbox (14.09698pt too wide) in paragraph at lines 566--567
-[][]            \OT1/cmtt/m/sl/9 let_tac ctxt (flowdefs @ gamma_def)  (main_tac
-_aux ctxt alldefs)
-
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 575--576
-[][]\OT1/cmtt/m/sl/9 (* Testing methods for invoking parts of the tactic above 
-[for debug only]
-[12]
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 585--586
-[][]\OT1/cmtt/m/sl/9 method_setup method_Let = {* Method.thms_ctxt_args (fn thm
-s => fn ctxt => [] 
-
-Overfull \hbox (14.09698pt too wide) in paragraph at lines 589--590
-[][]\OT1/cmtt/m/sl/9 (* apply (rule vcg_call) apply (simp add: dominates_def is
-MergePoint_def) *)[] 
-
-Overfull \hbox (42.44675pt too wide) in paragraph at lines 594--595
-[][]\OT1/cmtt/m/sl/9 (* apply (simp?, (rule DA_NullResult, simp) | rule DA_Null
-Tree | rule DA_NullList)
-
-Overfull \hbox (18.82195pt too wide) in paragraph at lines 603--604
-[][]\OT1/cmtt/m/sl/9 (* FIXME: to combine method_Call with method_Dom or mergep
-oint stuff, we need
-
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 606--607
-[][]\OT1/cmtt/m/sl/9 (* apply ((rule vcg_domcallcons) | (rule vcg_domcallnil))+
- apply simp apply
-
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 608--609
-[][]  \OT1/cmtt/m/sl/9 fn ctxt => Method.METHOD (fn facts => dom_tac ctxt thms 
-stop stop 1)) *}[] 
-
-Overfull \hbox (37.72179pt too wide) in paragraph at lines 624--625
-[][]         \OT1/cmtt/m/sl/9 two_subgoal_tacs i THEN vdm_tac (i+1) THEN vdm_ta
-c i,  (* stack: reverse
-
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 630--631
-[][]\OT1/cmtt/m/sl/9 (* apply ((rule vcg_domcallcons) | (rule vcg_domcallnil))+
- apply simp apply
-
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 631--632
-[][]\OT1/cmtt/m/sl/9 method_setup method_Weak = {* Method.thms_ctxt_args (fn th
-ms => fn ctxt =>
-[13]
-Overfull \hbox (37.72179pt too wide) in paragraph at lines 636--637
-[][]\OT1/cmtt/m/sl/9 (*methods call and dom are applied together, using CallDom
-: proofs takes 55secs*)[] 
-
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 642--643
-[][]\OT1/cmtt/m/sl/9 (* apply (method_main dominates_def isMergePoint_def MFS_d
-efs SPEC_def) *)[] 
-
-Overfull \hbox (42.44675pt too wide) in paragraph at lines 657--658
-[][]\OT1/cmtt/m/sl/9 (* Method main: writing bits of ML code to parse in Isar i
-s a pain, so we hardwire[] 
-
-Overfull \hbox (28.27187pt too wide) in paragraph at lines 666--667
-[][]  \OT1/cmtt/m/sl/9 Method.METHOD (fn facts => main_tac ctxt (thms "flow_def
-s", thms "doms_defs",
-
-Overfull \hbox (47.1717pt too wide) in paragraph at lines 670--671
-[][]  \OT1/cmtt/m/sl/9 Method.METHOD (fn facts => main_tac_aux ctxt (thms "flow
-_defs", thms "doms_defs",
-
-Overfull \hbox (13.4388pt too wide) in paragraph at lines 674--675
-[][]\OT1/cmtt/m/sl/9 "$[]$G = HeapSortContext$[]$ $[][]\OMS/cmsy/m/n/9 )$ \OT1/
-cmtt/m/sl/9 G $\U/lasy/m/n/9 ^^C$ \OT1/cmtt/m/sl/9 snd (methtable HS Siftdown) 
-: SPEC Siftdown"[] 
-[14] [15] [16]
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 805--806
-[][]                \OT1/cmtt/m/sl/9 apply (method_Dom doms_defs)  (* this the 
-place that cut is
-
-Overfull \hbox (37.72179pt too wide) in paragraph at lines 830--831
-[][]                                \OT1/cmtt/m/sl/9 (*Call*) (* first call to 
-the merge point ffour*)[] 
-
-Overfull \hbox (18.82195pt too wide) in paragraph at lines 840--841
-[][]                                \OT1/cmtt/m/sl/9 (*Call*) (*This is the sec
-ond call to ffour*)[] 
-[17]
-Overfull \hbox (18.82195pt too wide) in paragraph at lines 853--854
-[][]                    \OT1/cmtt/m/sl/9 (*1*) apply simp (*contraint came from
- TreematchD STAR.*)[] 
-
-Overfull \hbox (18.82195pt too wide) in paragraph at lines 855--856
-[][]                     \OT1/cmtt/m/sl/9 (*this is like a top-level verificati
-on, i.e.starts with
-
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 878--879
-[][]                           \OT1/cmtt/m/sl/9 apply (method_Dom doms_defs)  (
-* this the place
-[18]
-Overfull \hbox (18.82195pt too wide) in paragraph at lines 900--901
-[][]                                   \OT1/cmtt/m/sl/9 (*call This is the firs
-t call to feleven*)[] 
-
-Overfull \hbox (23.5469pt too wide) in paragraph at lines 910--911
-[][]                                   \OT1/cmtt/m/sl/9 (*call This is the seco
-nd call to feleven*)[] 
-
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 920--921
-[][]                                 \OT1/cmtt/m/sl/9 (*call This is the third 
-call to feleven*)[] 
-
-Overfull \hbox (32.99683pt too wide) in paragraph at lines 924--925
-[][]                             \OT1/cmtt/m/sl/9 (*this is like a top-level ve
-rification, i.e.starts
-
-Overfull \hbox (23.5469pt too wide) in paragraph at lines 938--939
-[][]                                           \OT1/cmtt/m/sl/9 (*of course, de
-fining the adaptaion
-
-Overfull \hbox (37.72179pt too wide) in paragraph at lines 939--940
-[][]                                           \OT1/cmtt/m/sl/9 apply (method_L
-et HeapSortContext_def)[] 
-
-Overfull \hbox (23.5469pt too wide) in paragraph at lines 943--944
-[][]                                           \OT1/cmtt/m/sl/9 (*1*) apply sim
-p (*letinvokeconst*)[] 
-[19]
-Overfull \hbox (9.37202pt too wide) in paragraph at lines 951--952
-[][]                                     \OT1/cmtt/m/sl/9 apply (method_Let Hea
-pSortContext_def)[] 
-
-Overfull \hbox (14.09698pt too wide) in paragraph at lines 957--958
-[][]                                           \OT1/cmtt/m/sl/9 (*2*) apply sim
-p (*letrmaketree*)[] 
-
-Overfull \hbox (51.89667pt too wide) in paragraph at lines 959--960
-[][]                             \OT1/cmtt/m/sl/9 (*2*) apply fast (* the weake
-ning from the verification
-
-Overfull \hbox (4.64706pt too wide) in paragraph at lines 960--961
-[][]                   \OT1/cmtt/m/sl/9 (*2*) apply fast (* the weakening from 
-the verification
-
-Overfull \hbox (240.89508pt too wide) in paragraph at lines 967--968
-[][]\OT1/cmtt/m/sl/9 (* =======================================================
-==================================================================
-)) [20] (./root.aux) )
-(see the transcript file for additional information)
-Output written on root.dvi (20 pages, 43848 bytes).
-Transcript written on root.log.
-request id is kyo-603 (1 file(s))
-
-
-=================================================================
-
-To: XEmacs Beta <xemacs-beta@xemacs.org>
-Subject: [Bug: 21.4.15] parse-partial-sexp gives stack overflow 
---text follows this line--
-================================================================
-Dear Bug Team!
-
-This bug/issue has been bothering me and (users of my Proof General
-package) for some time.  I have just verified that with the current CVS
-version of XEmacs the same problem is still present.
-
-Test case:
-
-1. switch to *scratch*
-2. C-u 100 ( 
-3. Eval expression (parse-partial-sexp 1 (point-max))
-
-The symptom I get is "nesting too deep for parser" error messages.
-(These are triggered e.g. by font-lock-fontify-region on large regions which
-contained ill-balanced parens; I also use parse-partial-sexp
-elsewhere in the PG code because of problems with buffer-syntactic-context.
-
-I notice some old comments in font-lock.el concerning this issue.  It
-might be worth looking at GNU Emacs implementation if these two are
-really supposed to be equivalent functions: on GNU Emacs 21.3.1 I
-tested a *scratch* buffer containing 40000 left parens and
-parse-partial-sexp returned a result without missing a beat 8-).
-[ NB: I didn't confirm whether the syntax tables being used were
-identical, but both cases were in Lisp Interaction mode ]
-
- - David Aspinall.
-
-
-================================================================
diff --git a/etc/isar/new-parsing-test.el b/etc/isar/new-parsing-test.el
deleted file mode 100644
index 147ad47646..0000000000
--- a/etc/isar/new-parsing-test.el
+++ /dev/null
@@ -1,38 +0,0 @@
-;; 
-;; Temporary test for new code in proof-done-advancing, following
-;; Markus's suggestions in proof-config  
-;; [see doc of proof-really-save-command-p]
-;; 
-;; Not integrated yet for fear of destruction of finely tuned 
-;; PG/Isar instance.
-;; 
-;;  -da  June 02.
-;; 
-;; FIXME: the handling of nesting depth counter doesn't yet work
-;; smoothly in the generic code, especially across undos/forget.
-;; Need to fix when nesting depth is changed, how it is changed,
-;; and choice of kill_proof vs undos for Isar.
-;;
-;; Testing: evaluate this buffer, reload script file 
-;; (to re-execute isar-mode).
-
-(setq proof-nested-goals-p t)
-(setq proof-goal-command-regexp 
-      (concat isar-goal-command-regexp "\\|" isar-local-goal-command-regexp))
-
-(defun isar-goal-command-p (str)
-  "Decide whether argument is a goal or not"
-  (proof-string-match proof-goal-command-regexp str))
-
-;; Reset this to default value
-(setq proof-really-save-command-p (lambda (span cmd) t))
-
-;; Use the new parser, but have to hack the keywords setting
-;; to fix prob with "{"  
-;; [do we??  that was probably buffer-syntactic context/symtab problem]
-(setq proof-script-use-old-parser nil)
-(setq isar-any-command-regexp
-      (isar-ids-to-regexp isar-keywords-major))
-;      (cons "{[^\\*]"  ;; FIXME:
-;          (isar-ids-to-regexp 
-;           (remove "{" isar-keywords-major))))
diff --git a/etc/isar/profiling.txt b/etc/isar/profiling.txt
deleted file mode 100644
index 27c9c8ff3d..0000000000
--- a/etc/isar/profiling.txt
+++ /dev/null
@@ -1,322 +0,0 @@
-Wed Aug 18 2010.  See Trac #324.
-
------------------------------------------------------------------
-
-Interactive:  C-c C-n
-
-### 12.461s elapsed time, 0.514s cpu time, 0.108s GC time
-
-scomint-output-filter                                           206         
3.6426039999  0.0176825436
-proof-shell-filter                                              206         
3.629433      0.0176186067
-proof-shell-filter-manage-output                                206         
3.6140779999  0.0175440679
-proof-shell-exec-loop                                           206         
3.5814560000  0.0173857087
-mapc                                                            208         
3.4833689999  0.0167469663
-proof-shell-invoke-callback                                     206         
3.4798549999  0.0168924999
-proof-done-advancing                                            204         
3.4786709999  0.0170523088
-proof-done-advancing-other                                      104         
3.2460199999  0.0312117307
-pg-add-element                                                  204         
3.2301699999  0.0158341666
-proof-debug                                                     99          
3.2140250000  0.0324648989
-pg-autotest-message                                             99          
3.211558      0.0324399797
-redisplay                                                       99          
3.140468      0.0317218989
-proof-done-advancing-save                                       100         
0.107982      0.00107982
-proof-process-buffer                                            1           
0.103025      0.103025
-proof-assert-until-point-interactive                            1           
0.102849      0.102849
-proof-assert-until-point                                        1           
0.102845      0.102845
-proof-make-goalsave                                             100         
0.0734089999  0.0007340899
-proof-assert-semis                                              1           
0.0729        0.0729
-proof-semis-to-vanillas                                         1           
0.069353      0.069353
-span-at-before                                                  200         
0.0607209999  0.0003036049
-proof-shell-insert-action-item                                  206         
0.0561400000  0.0002725242
-proof-shell-insert                                              206         
0.0552149999  0.0002680339
-pg-set-span-helphighlights                                      304         
0.0523910000  0.0001723388
-pg-add-proof-element                                            100         
0.0507439999  0.0005074399
-isar-global-save-command-p                                      100         
0.0403249999  0.0004032499
-isar-command-wrapping                                           204         
0.0389439999  0.0001909019
-isar-positions-of                                               204         
0.0342390000  0.0001678382
-proof-segment-up-to-using-cache                                 1           
0.029667      0.029667
-proof-segment-up-to                                             1           
0.029599      0.029599
-proof-segment-up-to-parser                                      1           
0.02959       0.02959
-proof-script-generic-parse-cmdstart                             204         
0.0265809999  0.0001302990
-span-live-p                                                     408         
0.0245460000  6.016...e-05
-span-property                                                   2226        
0.0242540000  1.089...e-05
-proof-set-locked-end                                            204         
0.0179210000  8.784...e-05
-proof-set-locked-endpoints                                      204         
0.0169129999  8.290...e-05
-goto-char                                                       3401        
0.0159649999  4.694...e-06
-replace-regexp-in-string                                        613         
0.0154579999  2.521...e-05
-pg-processing-complete-hint                                     1           
0.014814      0.014814
-proof-buffer-syntactic-context                                  411         
0.0145479999  3.539...e-05
-pg-last-output-displayform                                      304         
0.0140980000  4.637...e-05
-proof-buffer-syntactic-context-emulate                          411         
0.0135870000  3.305...e-05
-span-set-property                                               4968        
0.0131570000  2.648...e-06
-proof-shell-strip-output-markup                                 202         
0.0121529999  6.016...e-05
-isar-strip-output-markup                                        202         
0.0115120000  5.699...e-05
-proof-set-overlay-arrow                                         204         
0.0110750000  5.428...e-05
-pg-hint                                                         1           
0.010877      0.010877
-scomint-send-input                                              206         
0.0096710000  4.694...e-05
-skip-chars-forward                                              917         
0.0088720000  9.675...e-06
-string-match                                                    3879        
0.0085580000  2.206...e-06
-proof-string-match                                              1114        
0.0083859999  7.527...e-06
-re-search-forward                                               1084        
0.0076900000  7.094...e-06
-proof-shell-process-urgent-messages                             206         
0.0072959999  3.541...e-05
-proof-shell-handle-immediate-output                             206         
0.0069180000  3.358...e-05
-span-set-endpoints                                              409         
0.0060590000  1.481...e-05
-isar-preprocessing                                              206         
0.0057689999  2.800...e-05
-isar-string-wrapping                                            408         
0.0057090000  1.399...e-05
-move-overlay                                                    410         
0.0048900000  1.192...e-05
-insert                                                          718         
0.0043259999  6.025...e-06
-proof-set-queue-start                                           204         
0.0039419999  1.932...e-05
-proof-next-element-id                                           204         
0.0038919999  1.907...e-05
-proof-re-search-forward-safe                                    824         
0.0038370000  4.656...e-06
-proof-script-delete-secondary-spans                             1           
0.003218      0.003218
-span-delete-spans                                               1           
0.003215      0.003215
-span-mapc-spans                                                 1           
0.003214      0.003214
-span-set-start                                                  204         
0.003181      1.559...e-05
-pg-add-to-input-history                                         204         
0.0030040000  1.472...e-05
-isar-goal-command-p                                             204         
0.0029059999  1.424...e-05
-span-make                                                       608         
0.0029059999  4.779...e-06
-span-end                                                        928         
0.0026819999  2.890...e-06
-proof-get-name-from-goal                                        100         
0.0024339999  2.433...e-05
-proof-string-match-safe                                         204         
0.0024330000  1.192...e-05
-overlay-put                                                     4970        
0.0023869999  4.802...e-07
-span-delete                                                     304         
0.002174      7.151...e-06
-pg-span-name                                                    102         
0.00199       1.950...e-05
-proof-element-id                                                204         
0.0019369999  9.495...e-06
-span-start                                                      604         
0.0018080000  2.993...e-06
-replace-match                                                   1009        
0.0016779999  1.663...e-06
-skip-chars-backward                                             207         
0.0015489999  7.483...e-06
-make-overlay                                                    609         
0.0014599999  2.397...e-06
-proof-shell-slurp-comments                                      207         
0.0012420000  6.000...e-06
-delete-overlay                                                  306         
0.0011619999  3.797...e-06
-font-lock-fontify-region                                        2           
0.000982      0.000491
-font-lock-default-fontify-region                                2           
0.0009649999  0.0004824999
-set-marker                                                      1853        
0.0009280000  5.008...e-07
-proof-shell-handle-delayed-output                               1           
0.000917      0.000917
-proof-shell-display-output-as-response                          1           
0.000892      0.000892
-pg-response-display                                             1           
0.000888      0.000888
-font-lock-fontify-keywords-region                               2           
0.000882      0.000441
-proof-display-and-keep-buffer                                   1           
0.00087       0.00087
-kill-buffer                                                     4           
0.000787      0.00019675
-proof-next-element-count                                        204         
0.0006769999  3.318...e-06
-spans-at-region-prop                                            1           
0.000641      0.000641
-overlay-end                                                     1129        
0.0004920000  4.357...e-07
-match-string                                                    308         
0.0004569999  1.483...e-06
-marker-position                                                 1237        
0.0004520000  3.654...e-07
-buffer-live-p                                                   723         
0.0003860000  5.338...e-07
-isar-shell-adjust-line-width                                    206         
0.0003380000  1.640...e-06
-get-buffer-process                                              212         
0.0002819999  1.330...e-06
-proof-extend-queue                                              1           
0.000254      0.000254
-proof-shell-process-urgent-message                              1           
0.00024       0.00024
-overlay-start                                                   605         
0.0002349999  3.884...e-07
-proof-add-to-queue                                              1           
0.000231      0.000231
-proof-only-whitespace-to-locked-region-p                        1           
0.000192      0.000192
-isar-font-lock-fontify-syntactically-region                     2           
0.000184      9.2e-05
-nreverse                                                        209         
0.0001679999  8.038...e-07
-proof-shell-process-urgent-message-default                      1           
0.000163      0.000163
-proof-get-window-for-buffer                                     1           
0.000161      0.000161
-proof-re-search-backward                                        1           
0.000157      0.000157
-re-search-backward                                              1           
8.5e-05       8.5e-05
-pg-response-display-with-face                                   2           
7.999...e-05  3.999...e-05
-proof-queue-or-locked-end                                       6           
7.2e-05       1.2e-05
-pg-response-maybe-erase                                         2           
5.9e-05       2.95e-05
-proof-shell-ready-prover                                        2           
5.3e-05       2.65e-05
-proof-looking-at-safe                                           8           
5.1e-05       6.375e-06
-proof-shell-start                                               2           
4.6e-05       2.3e-05
-proof-unprocessed-begin                                         5           
4.3e-05       8.6e-06
-isar-match-nesting                                              1           
4.3e-05       4.3e-05
-proof-activate-scripting                                        1           
4.2e-05       4.2e-05
-proof-shell-live-buffer                                         2           
3.9e-05       1.95e-05
-proof-looking-at                                                7           
3.6e-05       5.142...e-06
-proof-re-search-forward                                         2           
3.500...e-05  1.750...e-05
-proof-detach-queue                                              1           
3.1e-05       3.1e-05
-scomint-check-proc                                              2           
2.9e-05       1.45e-05
-span-detach                                                     1           
2.8e-05       2.8e-05
-proof-maybe-follow-locked-end                                   1           
2.7e-05       2.7e-05
-proof-locked-region-full-p                                      1           
2.7e-05       2.7e-05
-proof-grab-lock                                                 1           
2.4e-05       2.4e-05
-font-lock-fontify-syntactically-region                          1           
2.3e-05       2.3e-05
-font-lock-mode                                                  1           
2e-05         2e-05
-font-lock-unfontify-region                                      2           
1.7e-05       8.5e-06
-font-lock-extend-jit-lock-region-after-change                   3           
1.1e-05       3.666...e-06
-proof-locked-region-empty-p                                     1           
1e-05         1e-05
-proof-set-queue-endpoints                                       1           
1e-05         1e-05
-proof-shell-strip-eager-annotations                             1           
1e-05         1e-05
-font-lock-default-unfontify-region                              2           
7.000...e-06  3.500...e-06
-proof-associated-windows                                        1           
7e-06         7e-06
-proof-shell-should-be-silent                                    1           
6e-06         6e-06
-font-lock-default-function                                      1           
5e-06         5e-06
-proof-shell-stop-silent-item                                    1           
4e-06         4e-06
-proof-shell-start-silent-item                                   1           
4e-06         4e-06
-proof-script-next-command-advance                               1           
4e-06         4e-06
-proof-shell-action-list-item                                    2           
3e-06         1.5e-06
-font-lock-set-defaults                                          2           
3e-06         1.5e-06
-proof-associated-buffers                                        2           
2e-06         1e-06
-font-lock-extend-region-wholelines                              2           
2e-06         1e-06
-font-lock-extend-region-multiline                               2           
2e-06         1e-06
-proof-minibuffer-message                                        1           
1e-06         1e-06
-proof-shell-set-silent                                          1           
1e-06         1e-06
-proof-shell-clear-silent                                        1           
1e-06         1e-06
-proof-pbp-focus-on-first-goal                                   1           
1e-06         1e-06
-proof-release-lock                                              1           
1e-06         1e-06
-pg-finish-tracing-display                                       1           
1e-06         1e-06
-nconc                                                           1           
1e-06         1e-06
-process-status                                                  2           
0.0           0.0
-
-
------------------------------------------------------------------
-
-Non-interactive:  (progn (proof-process-buffer) (proof-shell-wait))
-
-### 4.368s elapsed time, 0.457s cpu time, 0.094s GC time
-
-proof-shell-wait                                                1           
4.484316      4.484316
-accept-process-output                                           73          
3.8998559999  0.0534226849
-redisplay                                                       172         
3.7155909999  0.0216022732
-scomint-output-filter                                           206         
3.5921849999  0.0174377912
-proof-shell-filter                                              206         
3.5562370000  0.0172632864
-proof-shell-filter-manage-output                                206         
3.5167620000  0.0170716601
-proof-shell-exec-loop                                           206         
3.5079160000  0.0170287184
-mapc                                                            208         
3.4532319999  0.0166020769
-proof-shell-invoke-callback                                     206         
3.4492200000  0.0167437864
-proof-done-advancing                                            204         
3.4481900000  0.0169028921
-proof-done-advancing-other                                      104         
3.2636610000  0.0313813557
-pg-add-element                                                  204         
3.2225049999  0.0157965931
-proof-debug                                                     99          
3.1809079999  0.0321303838
-pg-autotest-message                                             99          
3.1785960000  0.0321070303
-proof-process-buffer                                            1           
0.098653      0.098653
-proof-assert-until-point-interactive                            1           
0.098513      0.098513
-proof-assert-until-point                                        1           
0.098508      0.098508
-proof-done-advancing-save                                       100         
0.0861289999  0.0008612899
-pg-set-span-helphighlights                                      304         
0.0751920000  0.0002473421
-proof-make-goalsave                                             100         
0.074799      0.00074799
-proof-assert-semis                                              1           
0.072791      0.072791
-proof-shell-insert-action-item                                  206         
0.0508700000  0.0002469417
-proof-shell-insert                                              206         
0.0500239999  0.0002428349
-proof-set-locked-end                                            204         
0.0447420000  0.0002193235
-proof-semis-to-vanillas                                         1           
0.043912      0.043912
-proof-set-locked-endpoints                                      204         
0.0438019999  0.0002147156
-proof-set-overlay-arrow                                         204         
0.039986      0.0001960098
-span-set-property                                               4968        
0.0389520000  7.840...e-06
-isar-command-wrapping                                           204         
0.0359119999  0.0001760392
-isar-global-save-command-p                                      100         
0.0357419999  0.0003574199
-span-at-before                                                  200         
0.033411      0.0001670550
-proof-script-delete-secondary-spans                             1           
0.02853       0.02853
-span-delete-spans                                               1           
0.028527      0.028527
-span-mapc-spans                                                 1           
0.028523      0.028523
-pg-add-proof-element                                            100         
0.0274090000  0.0002740900
-proof-segment-up-to-using-cache                                 1           
0.025547      0.025547
-proof-segment-up-to                                             1           
0.025512      0.025512
-proof-segment-up-to-parser                                      1           
0.025509      0.025509
-proof-script-generic-parse-cmdstart                             204         
0.023117      0.0001133186
-replace-regexp-in-string                                        612         
0.0151239999  2.471...e-05
-pg-last-output-displayform                                      304         
0.0137170000  4.512...e-05
-goto-char                                                       3399        
0.0134079999  3.944...e-06
-proof-buffer-syntactic-context                                  411         
0.0133350000  3.244...e-05
-proof-buffer-syntactic-context-emulate                          411         
0.0125479999  3.053...e-05
-proof-shell-strip-output-markup                                 202         
0.0118950000  5.888...e-05
-isar-strip-output-markup                                        202         
0.01126       5.574...e-05
-scomint-send-input                                              206         
0.0089030000  4.321...e-05
-skip-chars-forward                                              917         
0.0077629999  8.465...e-06
-proof-string-match                                              1114        
0.0076579999  6.874...e-06
-string-match                                                    3859        
0.0065880000  1.707...e-06
-isar-positions-of                                               204         
0.0063140000  3.095...e-05
-proof-shell-handle-immediate-output                             206         
0.0061669999  2.993...e-05
-proof-shell-process-urgent-messages                             206         
0.006087      2.954...e-05
-re-search-forward                                               1048        
0.0060810000  5.802...e-06
-isar-string-wrapping                                            408         
0.0055940000  1.371...e-05
-isar-preprocessing                                              206         
0.0048040000  2.332...e-05
-insert                                                          718         
0.0036899999  5.139...e-06
-proof-re-search-forward-safe                                    824         
0.0034060000  4.133...e-06
-proof-next-element-id                                           204         
0.0033579999  1.646...e-05
-span-set-endpoints                                              409         
0.0031649999  7.738...e-06
-proof-set-queue-start                                           204         
0.0029729999  1.457...e-05
-span-delete                                                     304         
0.0027480000  9.039...e-06
-isar-goal-command-p                                             204         
0.0027019999  1.324...e-05
-span-make                                                       608         
0.0026310000  4.327...e-06
-span-end                                                        926         
0.0024999999  2.699...e-06
-overlay-put                                                     4977        
0.0024500000  4.922...e-07
-pg-add-to-input-history                                         204         
0.002432      1.192...e-05
-proof-string-match-safe                                         204         
0.0024030000  1.177...e-05
-proof-get-name-from-goal                                        100         
0.0022690000  2.269...e-05
-span-set-start                                                  204         
0.0022479999  1.101...e-05
-move-overlay                                                    413         
0.0020689999  5.009...e-06
-pg-span-name                                                    102         
0.0019750000  1.936...e-05
-span-start                                                      604         
0.0016740000  2.771...e-06
-replace-match                                                   1008        
0.0015839999  1.571...e-06
-span-live-p                                                     408         
0.0015820000  3.877...e-06
-proof-element-id                                                204         
0.0015369999  7.534...e-06
-span-property                                                   2226        
0.0014979999  6.729...e-07
-make-overlay                                                    609         
0.0012819999  2.105...e-06
-delete-overlay                                                  309         
0.0012420000  4.019...e-06
-skip-chars-backward                                             206         
0.0011609999  5.635...e-06
-proof-shell-slurp-comments                                      207         
0.0011250000  5.434...e-06
-set-marker                                                      1853        
0.0009220000  4.975...e-07
-pg-processing-complete-hint                                     1           
0.000625      0.000625
-proof-next-element-count                                        204         
0.0005830000  2.857...e-06
-spans-at-region-prop                                            1           
0.000573      0.000573
-proof-shell-handle-delayed-output                               1           
0.000495      0.000495
-proof-shell-display-output-as-response                          1           
0.000478      0.000478
-pg-response-display                                             1           
0.000474      0.000474
-proof-display-and-keep-buffer                                   1           
0.000463      0.000463
-overlay-end                                                     1126        
0.0004170000  3.703...e-07
-marker-position                                                 1236        
0.0004100000  3.317...e-07
-match-string                                                    308         
0.0003959999  1.285...e-06
-buffer-live-p                                                   725         
0.0003580000  4.937...e-07
-isar-shell-adjust-line-width                                    206         
0.0003170000  1.538...e-06
-proof-extend-queue                                              1           
0.000293      0.000293
-proof-add-to-queue                                              1           
0.000266      0.000266
-get-buffer-process                                              209         
0.0002369999  1.133...e-06
-overlay-start                                                   604         
0.0002369999  3.923...e-07
-proof-shell-process-urgent-message                              1           
0.000232      0.000232
-proof-shell-process-urgent-message-default                      1           
0.000169      0.000169
-font-lock-fontify-region                                        1           
0.000167      0.000167
-font-lock-default-fontify-region                                1           
0.00016       0.00016
-nreverse                                                        209         
0.0001489999  7.129...e-07
-proof-get-window-for-buffer                                     1           
0.000124      0.000124
-font-lock-fontify-keywords-region                               1           
0.000117      0.000117
-proof-only-whitespace-to-locked-region-p                        1           
0.000108      0.000108
-proof-re-search-backward                                        1           
8.2e-05       8.2e-05
-pg-response-display-with-face                                   2           
8.2e-05       4.1e-05
-re-search-backward                                              1           
6.7e-05       6.7e-05
-pg-response-maybe-erase                                         2           
5.900...e-05  2.950...e-05
-font-lock-mode                                                  3           
5.8e-05       1.933...e-05
-proof-queue-or-locked-end                                       6           
5.600...e-05  9.333...e-06
-proof-shell-ready-prover                                        2           
4.6e-05       2.3e-05
-proof-looking-at-safe                                           8           
4.2e-05       5.25e-06
-proof-shell-start                                               2           
3.700...e-05  1.850...e-05
-proof-maybe-follow-locked-end                                   1           
3.5e-05       3.5e-05
-proof-shell-live-buffer                                         2           
3.1e-05       1.55e-05
-proof-activate-scripting                                        1           
2.8e-05       2.8e-05
-proof-looking-at                                                7           
2.8e-05       4e-06
-proof-grab-lock                                                 1           
2.7e-05       2.7e-05
-proof-unprocessed-begin                                         3           
2.399...e-05  8e-06
-proof-shell-should-be-silent                                    1           
2.2e-05       2.2e-05
-proof-detach-queue                                              1           
1.8e-05       1.8e-05
-scomint-check-proc                                              2           
1.7e-05       8.5e-06
-font-lock-fontify-syntactically-region                          1           
1.7e-05       1.7e-05
-isar-font-lock-fontify-syntactically-region                     1           
1.6e-05       1.6e-05
-span-detach                                                     1           
1.5e-05       1.5e-05
-font-lock-default-function                                      3           
1.400...e-05  4.666...e-06
-proof-shell-strip-eager-annotations                             1           
1.1e-05       1.1e-05
-font-lock-extend-jit-lock-region-after-change                   3           
1e-05         3.333...e-06
-proof-set-queue-endpoints                                       1           
8e-06         8e-06
-font-lock-unfontify-region                                      1           
7e-06         7e-06
-proof-re-search-forward                                         1           
6e-06         6e-06
-proof-associated-windows                                        1           
6e-06         6e-06
-proof-script-next-command-advance                               1           
6e-06         6e-06
-proof-shell-stop-silent-item                                    1           
4e-06         4e-06
-proof-shell-start-silent-item                                   1           
4e-06         4e-06
-proof-shell-action-list-item                                    2           
3e-06         1.5e-06
-proof-shell-clear-silent                                        1           
3e-06         3e-06
-process-status                                                  2           
2e-06         1e-06
-font-lock-set-defaults                                          1           
2e-06         2e-06
-proof-associated-buffers                                        2           
1e-06         5e-07
-proof-minibuffer-message                                        1           
1e-06         1e-06
-proof-shell-set-silent                                          1           
1e-06         1e-06
-proof-release-lock                                              1           
1e-06         1e-06
-pg-finish-tracing-display                                       1           
1e-06         1e-06
-nconc                                                           1           
1e-06         1e-06
-font-lock-extend-region-wholelines                              1           
1e-06         1e-06
-font-lock-default-unfontify-region                              1           
1e-06         1e-06
-proof-pbp-focus-on-first-goal                                   1           
0.0           0.0
-font-lock-extend-region-multiline                               1           
0.0           0.0
-
diff --git a/etc/isar/trace_simp.thy b/etc/isar/trace_simp.thy
deleted file mode 100644
index de651e5bc8..0000000000
--- a/etc/isar/trace_simp.thy
+++ /dev/null
@@ -1,20 +0,0 @@
-(* This is a test of tracing output for Isabelle. *)
-
-theory trace_simp imports Main begin
-
-text {*
-  this produces massive amount of simplifier trace, but terminates
-  eventually: *}
-
-declare [[simp_trace]]
-ML {* quick_and_dirty := false *}
-
-datatype ord = Zero | Succ ord | Limit "nat => ord"
-
-(* testing comment here *)
-
-text {* this one loops forever *}
-
-lemma "ALL x. f x = g(f(g(x))) ==> f [] = f [] @ []"
-  apply simp
-
diff --git a/etc/lego/GoalGoal.l b/etc/lego/GoalGoal.l
deleted file mode 100644
index c4826e0dce..0000000000
--- a/etc/lego/GoalGoal.l
+++ /dev/null
@@ -1,13 +0,0 @@
-Module GoalGoal;
-
-Goal first : {A:Prop}A->A;
-intros; Immed;
-(* no Save *)
-
-Goal second : {A:Prop}A->A;
-intros; Immed;
-Save second;
-(* asserting until here caused Proof General to swap first and second.
-This is a bug for LEGO. Thanks to Martin Hofmann for pointing this
-out. An obvious bug fix would be to make the function
-proof-lift-global Coq specific. *)
\ No newline at end of file
diff --git a/etc/lego/error-eg.l b/etc/lego/error-eg.l
deleted file mode 100644
index f6872c90b6..0000000000
--- a/etc/lego/error-eg.l
+++ /dev/null
@@ -1,16 +0,0 @@
-Init LF;
-
-[prop:Type];
-[prf:prop->Type];
-[type:Type];
-[el:type->Type];
-
-[FA : {A:type}((el A) -> prop) -> prop];
-[LL : {A:type}{P:(el A) -> prop}
-          ({x:el A}prf(P(x)))->
-   (********************************)
-         prf(FA A P)];
-
-[P_FA : {A:type}{P:(el A) -> prop}{C_FA:prf(FA A P) -> prop}
-         ((g:{x:el A}prf(P(x)))prf(C_FA(LL A P g))) -> 
-                         {z:prf(FA A P)}prf(C_FA(z))];
\ No newline at end of file
diff --git a/etc/lego/lego-site.el b/etc/lego/lego-site.el
deleted file mode 100644
index 1a31f3547e..0000000000
--- a/etc/lego/lego-site.el
+++ /dev/null
@@ -1,37 +0,0 @@
-;;; lego-site.el --- Site-specific Emacs support for LEGO
-
-;; This file is part of Proof General.
-
-;; Portions © Copyright 1994-2012  David Aspinall and University of Edinburgh
-;; Portions © Copyright 2003, 2012, 2014  Free Software Foundation, Inc.
-;; Portions © Copyright 2001-2017  Pierre Courtieu
-;; Portions © Copyright 2010, 2016  Erik Martin-Dorel
-;; Portions © Copyright 2011-2013, 2016-2017  Hendrik Tews
-;; Portions © Copyright 2015-2017  Clément Pit-Claudel
-
-;;; Author: Thomas Kleymann <T.Kleymann@ed.ac.uk>
-;;; Maintainer: lego@dcs.ed.ac.uk
-
-;;; Commentary:
-;;
-
-;;; Code:
-
-(let ((version (getenv "PROOFGENERAL")))
-  (cond ((not version)         ;default
-        (setq load-path
-              (cons "/usr/local/share/elisp/script-management" load-path))
-        (setq load-path
-              (cons "/usr/local/share/elisp/script-management/lego" load-path))
-        (setq auto-mode-alist (cons '("\\.l$" . lego-mode) auto-mode-alist))
-        (autoload 'lego-mode "lego" "Major mode for editing Lego proof 
scripts." t))
-       ((string= version "ancient") 
-        (setq load-path (cons "/usr/local/share/elisp/lego" load-path))
-        (setq auto-mode-alist (cons '("\\.l$" . lego-mode) auto-mode-alist))
-        (autoload 'lego-mode "lego" "Major mode for editing Lego proof 
scripts." t)
-        (autoload 'lego-shell "lego" "Inferior shell invoking lego." t))
-       ((string= version "latest")
-        (load-file 
"/usr/local/share/elisp/ProofGeneral/generic/proof-site.el"))))
-        
-
-        
diff --git a/etc/lego/long-line-backslash.l b/etc/lego/long-line-backslash.l
deleted file mode 100644
index c85dcdc61a..0000000000
--- a/etc/lego/long-line-backslash.l
+++ /dev/null
@@ -1,22 +0,0 @@
-(* 
-
-  long-line-backslash.l
-
-  Test for long lines with backslashes in them.
-  Cause problem with pty communication where line length
-  is limited to 256 characters sometimes (e.g. on Solaris).
-
-*)
-
-echo 
"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
 [...]
-
-(* Test subsequent commands can be processed *)
-
-[one = Prop];
-[two = Prop -> Prop];
-[three = Prop -> two];
-
-(* Test something with eager annotations *)
-
-Make "/usr/local/share/lego/lib-alpha/lib_Type/lib_logic";
-
diff --git a/etc/lego/multiple/A.l b/etc/lego/multiple/A.l
deleted file mode 100644
index d45f8db823..0000000000
--- a/etc/lego/multiple/A.l
+++ /dev/null
@@ -1 +0,0 @@
-Module A;
\ No newline at end of file
diff --git a/etc/lego/multiple/B.l b/etc/lego/multiple/B.l
deleted file mode 100644
index 3a8df7b2c7..0000000000
--- a/etc/lego/multiple/B.l
+++ /dev/null
@@ -1,4 +0,0 @@
-(* B.l Module with a comment *)
-Module B;
-
-[prop = Prop];
\ No newline at end of file
diff --git a/etc/lego/multiple/C.l b/etc/lego/multiple/C.l
deleted file mode 100644
index 5a3afdd6dc..0000000000
--- a/etc/lego/multiple/C.l
+++ /dev/null
@@ -1 +0,0 @@
-Module C Import A B;
\ No newline at end of file
diff --git a/etc/lego/multiple/D.l b/etc/lego/multiple/D.l
deleted file mode 100644
index b794253ba2..0000000000
--- a/etc/lego/multiple/D.l
+++ /dev/null
@@ -1 +0,0 @@
-Module D;
\ No newline at end of file
diff --git a/etc/lego/multiple/README b/etc/lego/multiple/README
deleted file mode 100644
index 11f2152a78..0000000000
--- a/etc/lego/multiple/README
+++ /dev/null
@@ -1,33 +0,0 @@
-Handling of Multiple Files
-==========================
-
-[C depends on A and B]
-
-Notation: A  means that buffer A.l is unlocked
-          A+ means that buffer A.l is partly locked
-          A* means that buffer A.l is locked
-         ? means that behaviour might be different for proof systems
-           with non-linear contexts
-
-
-Test Protocol
--------------
-
- 1) visit A.l                 EFFECTS A
- 2) visit C.l                 EFFECTS A     C
- 3) assert C                  EFFECTS A*    C*
- 4) visit B.l                 EFFECTS A* B* C*
- 5) visit D.l                 EFFECTS A* B* C* D
- 6) retract to middle of B    EFFECTS A* B  C  D
- 7) assert first command of B EFFECTS A* B+ C  D
- 8) assert C                  EFFECTS A* B+ C  D [error message]
- 9) assert B                  EFFECTS A* B* C  D
-10) assert D                  EFFECTS A* B* C  D*
-11) retract B                 EFFECTS A* B  C  D?
-12) assert C                  EFFECTS A* B* C* D?
-13) retract B                 EFFECTS A* B  C  D?
-14) assert B                  EFFECTS A* B* C  D?
-15) assert C                  EFFECTS A* B* C* D?
-16) retract to middle of B    EFFECTS A* B+ C  D?
-14) M-x proof-shell-restart   EFFECTS A  B  C  D
-
diff --git a/etc/lego/pbp.l b/etc/lego/pbp.l
deleted file mode 100644
index 66a6df7226..0000000000
--- a/etc/lego/pbp.l
+++ /dev/null
@@ -1,30 +0,0 @@
-(* How to prove a sample theorem by PBP. *)
-
-(* All using middle-clicks.
-  
-   1. Click on  ->          (Pbp 0 3 1: Intros A B)
-   2. Click on left (A/\B)  (Pbp 1 2 1: Intros H; Try Refine H)
-   3. Click on A            (Pbp 4 2 1: Intros H1; Try Refine H1)
-   4. Click on B            (Pbp 5 2 1: Intros H2; Try Refine H2)
-   5. Click on A in A/\B    (Pbp 6 2 1: Refine pair; Try Assumption)
-   6. Click on final B      (Pbp 10:    Try Assumption)
-      OR:
-      Click on assumption B (PbpHyp H2: Try Refine H2)
-   QED!!
-*)
-
-Module pbp Import lib_logic;
-
-Goal {A,B:Prop}(A /\ B) -> (B /\ A);
-Intros A B; 
-Intros H; Try Refine H; 
-Intros H1; Try Refine H1; 
-Intros H2; Try Refine H2; 
-Refine pair; Try Assumption; 
-Try Assumption; 
-Save and_comms;
-
-
-
-
-
diff --git a/etc/lego/unsaved-goals.l b/etc/lego/unsaved-goals.l
deleted file mode 100644
index dd9c9646b4..0000000000
--- a/etc/lego/unsaved-goals.l
+++ /dev/null
@@ -1,54 +0,0 @@
-(* 
-  Some test cases for closing off unsaved goals, 
-  and the setting proof-completed-proof-behaviour.
-
-  David Aspinall, November 1999.
-
-  Things work fairly well in lego with 
-
-       proof-completed-proof-behaviour='closeany
-
-  In that case, undoing/redoing later declarations 
-  (E and F) following the completed proof works okay, and
-  in the absence of declarations, things work fine.
-    
-  Declarations in LEGO are global, and forgetting a
-  declaration when a proof is still open (even if complete)
-  aborts the proof!  So a proper handling would need to
-  trigger a *further* retraction when the "Forget D" is
-  issued undoing the definition of D.  Never mind.
-
-  With proof-completed-proof-behaviour='closegoal or 'extend,
-  undoing the first goal doesn't forget the declarations.
-
-  This file even causes internal errors in LEGO!
-
-     Warning: forgetting a finished proof
-
-     LEGO detects unexpected exception named "InfixInternal"
-
-  Test with undoing and redoing, and various settings
-  for proof-completed-proof-behaviour
-*)
-   
-
-
-Module unsaved Import lib_logic;
-
-Goal {A,B:Prop}(and A B) -> (and B A);
-intros;
-Refine H;
-intros;
-andI;
-Immed;
-[D = Type];
-[E = Type];
-[F = Type];
-
-Goal {A,B:Prop}(and A B) -> (and B A);
-intros;
-Refine H;
-intros;
-andI;
-Immed;
-
diff --git a/generic/pg-assoc.el b/generic/pg-assoc.el
index 59593ad667..d67177302b 100644
--- a/generic/pg-assoc.el
+++ b/generic/pg-assoc.el
@@ -12,7 +12,7 @@
 ;; Authors:   David Aspinall, Yves Bertot, Healfdene Goguen,
 ;;            Thomas Kleymann and Dilip Sequeira
 
-;; License:   GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
diff --git a/generic/pg-autotest.el b/generic/pg-autotest.el
index 54fa8abbee..2bb1d05bd3 100644
--- a/generic/pg-autotest.el
+++ b/generic/pg-autotest.el
@@ -11,7 +11,7 @@
 
 ;; Authors:   David Aspinall
 
-;; License:   GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
diff --git a/generic/pg-custom.el b/generic/pg-custom.el
index 0c67c7a260..acbc1246ec 100644
--- a/generic/pg-custom.el
+++ b/generic/pg-custom.el
@@ -3,7 +3,7 @@
 ;; This file is part of Proof General.
 
 ;; Portions © Copyright 1994-2012  David Aspinall and University of Edinburgh
-;; Portions © Copyright 2003, 2012, 2014  Free Software Foundation, Inc.
+;; Portions © Copyright 2003, 2012, 2014, 2021  Free Software Foundation, Inc.
 ;; Portions © Copyright 2001-2017  Pierre Courtieu
 ;; Portions © Copyright 2010, 2016  Erik Martin-Dorel
 ;; Portions © Copyright 2011-2013, 2016-2017  Hendrik Tews
@@ -11,14 +11,14 @@
 
 ;; Author:      David Aspinall <David.Aspinall@ed.ac.uk> and others
 
-;; License:     GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
 ;; Prover specific settings and user options.
 ;;
 ;; The settings defined here automatically use the current proof
-;; assistant symbol as a prefix, i.e.  isar-favourites, coq-favourites,
+;; assistant symbol as a prefix, i.e.  coq-favourites,
 ;; or whatever will be defined on evaluation.
 ;;
 ;; This file is loaded only by mode stubs defined in `proof-site.el',
@@ -117,7 +117,7 @@ For example for coq on Windows you might need something 
like:
 
 (defpgcustom quit-timeout
   (cond
-   ((eq proof-assistant-symbol 'isar)    45)
+   ;; ((eq proof-assistant-symbol 'isar)    45)
    (t                                   5))
   "The number of seconds to wait after sending `proof-shell-quit-cmd'.
 After this timeout, the proof shell will be killed off more rudely.
@@ -180,7 +180,7 @@ Currently this setting is UNIMPLEMENTED, changes have no 
effect."
 
 (defpgcustom one-command-per-line
   (cond
-   ((eq proof-assistant-symbol 'isar)  nil)
+   ;; ((eq proof-assistant-symbol 'isar)  nil)
    (t t))
   "*If non-nil, format for newlines after each command in a script."
   :type 'boolean
@@ -195,7 +195,7 @@ Currently this setting is UNIMPLEMENTED, changes have no 
effect."
   :set 'proof-set-value
   :group 'proof-user-options)
 
-(defpgcustom unicode-tokens-enable (eq proof-assistant-symbol 'isar)
+(defpgcustom unicode-tokens-enable nil ;; (eq proof-assistant-symbol 'isar)
   "*Non-nil for using Unicode token input mode in Proof General."
   :type 'boolean
   :set 'proof-set-value
diff --git a/generic/pg-goals.el b/generic/pg-goals.el
index d0897fbe5e..f7cb9b3c70 100755
--- a/generic/pg-goals.el
+++ b/generic/pg-goals.el
@@ -12,7 +12,7 @@
 ;; Authors:   David Aspinall, Yves Bertot, Healfdene Goguen,
 ;;            Thomas Kleymann and Dilip Sequeira
 
-;; License:   GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 
diff --git a/generic/pg-movie.el b/generic/pg-movie.el
index 2b2454d808..69de716061 100644
--- a/generic/pg-movie.el
+++ b/generic/pg-movie.el
@@ -11,7 +11,7 @@
 
 ;; Author:      David Aspinall <David.Aspinall@ed.ac.uk> and others
 
-;; License:     GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
diff --git a/generic/pg-pamacs.el b/generic/pg-pamacs.el
index 1492e0ca40..c603d1537f 100644
--- a/generic/pg-pamacs.el
+++ b/generic/pg-pamacs.el
@@ -1,9 +1,9 @@
-;;; pg-pamacs.el --- Macros for per-proof assistant configuration
+;;; pg-pamacs.el --- Macros for per-proof assistant configuration  -*- 
lexical-binding: t; -*-
 
 ;; This file is part of Proof General.
 
 ;; Portions © Copyright 1994-2012  David Aspinall and University of Edinburgh
-;; Portions © Copyright 2003, 2012, 2014  Free Software Foundation, Inc.
+;; Portions © Copyright 2003-2021  Free Software Foundation, Inc.
 ;; Portions © Copyright 2001-2017  Pierre Courtieu
 ;; Portions © Copyright 2010, 2016  Erik Martin-Dorel
 ;; Portions © Copyright 2011-2013, 2016-2017  Hendrik Tews
@@ -75,7 +75,7 @@ This macro should only be invoked once a specific prover is 
engaged."
 (defun proof-ass-differs-from-default (sym)
   "Return non-nil if SYM for current prover differs from its customize 
standard value."
   (let ((pasym (proof-ass-symv sym)))
-    (not (equal (eval (car (get pasym 'standard-value)))
+    (not (equal (eval (car (get pasym 'standard-value)) t)
                (symbol-value pasym)))))
 
 (defun proof-defpgcustom-fn (sym args)
@@ -83,14 +83,16 @@ This macro should only be invoked once a specific prover is 
engaged."
 Helper for macro `defpgcustom'."
   (let ((specific-var (proof-ass-symv sym))
         (generic-var  (intern (concat "proof-assistant-" (symbol-name sym))))
-        (newargs     (if (member :group args)
-                         args
-                       (append (list :group
-                                     proof-assistant-internals-cusgrp)
-                               args))))
+        ;; (newargs     (if (member :group args)
+        ;;               args
+        ;;             (append (list :group
+        ;;                           proof-assistant-internals-cusgrp)
+        ;;                     args)))
+        )
     (eval
      `(defcustom ,specific-var
-       ,@args))
+       ,@args)
+     t)
     ;; For functions, we could simply use defalias.  Unfortunately there
     ;; is nothing similar for values, so we define a new set/get function.
     (eval
@@ -100,7 +102,8 @@ Helper for macro `defpgcustom'."
 If NEWVAL is present, set the variable, otherwise return its current value.")
        (if newval
            (setq ,specific-var newval)
-         ,specific-var)))))
+         ,specific-var))
+     t)))
 
 (defun undefpgcustom (sym)
   (let ((specific-var (proof-ass-symv sym))
@@ -188,7 +191,7 @@ Usage: (defpgdefault SYM VALUE)"
        (setq args (cdr args)))
        ((eq (car args) :type)
        (setq type (cadr args))
-       (if (eq (eval type) 'float)
+       (if (eq (eval type t) 'float)
            (setq type (quote 'number))) ; widget type for defcustom
        (setq args (cdr args))
        (setq newargs (cons type (cons :type newargs))))
@@ -198,10 +201,7 @@ Usage: (defpgdefault SYM VALUE)"
     (setq newargs (reverse newargs))
     (setq descr (car-safe newargs))
     (unless (and type
-                 (or (eq (eval type) 'boolean)
-                     (eq (eval type) 'integer)
-                     (eq (eval type) 'number)
-                     (eq (eval type) 'string)))
+                 (memq (eval type t) '(boolean integer number string)))
       (error "Macro defpacustom: missing :type keyword or wrong :type value"))
 
     ;; Error in case a defpacustom is repeated.
@@ -212,21 +212,23 @@ Usage: (defpgdefault SYM VALUE)"
     (eval
      `(defpgcustom ,name ,val
        ,@newargs
-       :set 'proof-set-value
-       :group (quote ,proof-assistant-cusgrp)))
+       :set #'proof-set-value
+       :group (quote ,proof-assistant-cusgrp))
+     t)
     (cond
      (evalform
       (eval
        `(defpgfun ,name ()
-         ,evalform)))
+         ,evalform)
+       t))
      (setting
       (eval
        `(defpgfun ,name ()
          (proof-assistant-invisible-command-ifposs
-          (proof-assistant-settings-cmd (quote ,name)))))))
-    (setq proof-assistant-settings
-         (cons (list name setting (eval type) descr)
-               proof-assistant-settings))))
+          (proof-assistant-settings-cmd (quote ,name))))
+       t)))
+    (push (list name setting (eval type t) descr)
+         proof-assistant-settings)))
 
 ;;;###autoload
 (defmacro defpacustom (name val &rest args)
diff --git a/generic/pg-pbrpm.el b/generic/pg-pbrpm.el
index 942cc91943..dd34965bfe 100644
--- a/generic/pg-pbrpm.el
+++ b/generic/pg-pbrpm.el
@@ -1,8 +1,8 @@
-;; pg-pbrpm.el --- Proof General - Proof By Rules Pop-up Menu - mode.
+;; pg-pbrpm.el --- Proof General - Proof By Rules Pop-up Menu - mode.  -*- 
lexical-binding: t; -*-
 ;;
 ;; Copyright (C) 2004 - Universite de Savoie, France.
 ;; Authors:   Jean-Roch SOTTY, Christophe Raffalli
-;; License:   GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
 ;; $Id$
 ;;
@@ -98,12 +98,10 @@ Matches the region to be returned.")
            (mapc (lambda (sp)
                    (let* ((p1 (span-start sp))
                           (p2 (span-end sp))
-                          (spl (span-at p1 'pglock)))
-                     (span-read-write spl)
+                          (proof--inhibit-retract-on-change t))
                      (goto-char p1)
                      (insert (span-string span))
-                     (delete-region (+ p1 len) (+ p2 len))
-                     (span-read-only spl)))
+                     (delete-region (+ p1 len) (+ p2 len))))
                  (span-property span 'occurrences)))))))
 
 
@@ -257,7 +255,8 @@ The prover command is processed via pg-pbrpm-run-command."
                       (insert-gui-button (make-gui-button
                                           (concat (int-to-string count) ")")
                                           'pg-pbrpm-run-command
-                                          (list command act spans)) pos))
+                                          (list command act spans))
+                                         pos))
                     (insert "\n")))
                 (insert-gui-button
                  (make-gui-button
diff --git a/generic/pg-pgip.el b/generic/pg-pgip.el
index e7c7e3448d..0954b50491 100644
--- a/generic/pg-pgip.el
+++ b/generic/pg-pgip.el
@@ -11,7 +11,7 @@
 
 ;; Author:   David Aspinall <David.Aspinall@ed.ac.uk>
 
-;; License:  GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
@@ -281,7 +281,7 @@ Return a symbol representing the PGIP command processed, or 
nil."
     ;; TODO: display and cache the value in a dedicated buffer
     ;; FIXME: should idvalue have a context?
     (pg-response-message text)))
-    
+
 ;;
 ;; Menu configuration [TODO]
 ;;
@@ -583,7 +583,10 @@ See `pg-pgip-assemble-packet' "
 (defconst pg-pgip-id
   ;; Identifier based on hostname, user, time, and (FIXME: possible?) ppid
   (concat (getenv "HOSTNAME") "/" (getenv "USER") "/"
-         (let ((tm (current-time))) (format "%d.%d" (car tm) (cadr tm))))
+         (let ((tm (if (fboundp 'time-convert)
+                       (time-convert nil 'list)
+                     (current-time))))
+           (format "%d.%d" (car tm) (cadr tm))))
   "PGIP Identifier for this Emacs Proof General component.")
 
 (defvar pg-pgip-refseq nil
diff --git a/generic/pg-response.el b/generic/pg-response.el
index 37f629af3a..cd611ad946 100644
--- a/generic/pg-response.el
+++ b/generic/pg-response.el
@@ -3,7 +3,7 @@
 ;; This file is part of Proof General.
 
 ;; Portions © Copyright 1994-2012  David Aspinall and University of Edinburgh
-;; Portions © Copyright 2003-2019  Free Software Foundation, Inc.
+;; Portions © Copyright 2003-2021  Free Software Foundation, Inc.
 ;; Portions © Copyright 2001-2017  Pierre Courtieu
 ;; Portions © Copyright 2010, 2016  Erik Martin-Dorel
 ;; Portions © Copyright 2011-2013, 2016-2017  Hendrik Tews
@@ -12,7 +12,7 @@
 ;; Authors:   David Aspinall, Healfdene Goguen,
 ;;             Thomas Kleymann and Dilip Sequeira
 
-;; License:   GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
@@ -377,7 +377,7 @@ Returns non-nil if response buffer was cleared."
   ;; NB: this displays an empty buffer sometimes when it's not
   ;; so useful.  It _is_ useful if the user has requested to
   ;; see the proof state and there is none
-  ;; (Isabelle/Isar displays nothing: might be better if it did).
+  ;; (Isabelle/Isar displayed nothing: might be better if it did).
   (proof-display-and-keep-buffer proof-response-buffer))
 
 ;;
diff --git a/generic/pg-user.el b/generic/pg-user.el
index f10f02c16a..c87309a453 100644
--- a/generic/pg-user.el
+++ b/generic/pg-user.el
@@ -11,7 +11,7 @@
 
 ;; Author:     David Aspinall and others
 
-;; License:    GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
@@ -165,19 +165,24 @@ If called interactively, NUM is given by the prefix 
argument."
 ;;
 
 ;;;###autoload
-(defun proof-goto-point ()
+(defun proof-goto-point (&optional raw)
   "Assert or retract to the command at current position.
 Calls `proof-assert-until-point' or `proof-retract-until-point' as
-appropriate."
-  (interactive)
-  (save-excursion
-    (if (> (proof-queue-or-locked-end) (point))
-       (proof-retract-until-point)
-      (if (proof-only-whitespace-to-locked-region-p)
-         (progn
-           (skip-chars-forward " \t\n")
-           (forward-char 1)))
-      (proof-assert-until-point))))
+appropriate. With prefix argument RAW the omit proofs feature
+(`proof-omit-proofs-option') is temporaily disabled to check all
+proofs in the asserted region."
+  (interactive "P")
+  (let ((proof-omit-proofs-option proof-omit-proofs-option))
+    (when raw
+      (setq proof-omit-proofs-option nil))
+    (save-excursion
+      (if (> (proof-queue-or-locked-end) (point))
+         (proof-retract-until-point)
+        (if (proof-only-whitespace-to-locked-region-p)
+           (progn
+             (skip-chars-forward " \t\n")
+             (forward-char 1)))
+        (proof-assert-until-point)))))
 
 (defun proof-assert-next-command-interactive ()
   "Process until the end of the next unprocessed command after point.
@@ -198,18 +203,23 @@ If inside a comment, just process until the start of the 
comment."
   (proof-assert-until-point))
 
 ;;;###autoload
-(defun proof-process-buffer ()
-  "Process the current (or script) buffer, and maybe move point to the end."
-  (interactive)
-  (proof-with-script-buffer
-   (save-excursion
-     (goto-char (point-max))
-     (proof-assert-until-point-interactive))
-   (proof-maybe-follow-locked-end))
-  (when proof-fast-process-buffer
-    (message "Processing buffer...")
-    (proof-shell-wait)
-    (message "Processing buffer...done")))
+(defun proof-process-buffer (&optional raw)
+  "Process the current (or script) buffer, and maybe move point to the end.
+With prefix argument RAW the omit proofs feature (`proof-omit-proofs-option')
+is temporaily disabled to check all proofs in the asserted region."
+  (interactive "P")
+  (let ((proof-omit-proofs-option proof-omit-proofs-option))
+    (when raw
+      (setq proof-omit-proofs-option nil))
+    (proof-with-script-buffer
+     (save-excursion
+       (goto-char (point-max))
+       (proof-assert-until-point-interactive))
+     (proof-maybe-follow-locked-end))
+    (when proof-fast-process-buffer
+      (message "Processing buffer...")
+      (proof-shell-wait)
+      (message "Processing buffer...done"))))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
diff --git a/generic/pg-vars.el b/generic/pg-vars.el
index d1e5dfa925..be696b2ef5 100644
--- a/generic/pg-vars.el
+++ b/generic/pg-vars.el
@@ -11,7 +11,7 @@
 
 ;; Author:      David Aspinall <David.Aspinall@ed.ac.uk> and others
 
-;; License:     GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
diff --git a/generic/pg-xml.el b/generic/pg-xml.el
index 4e5ea3851d..ca2bfd874e 100644
--- a/generic/pg-xml.el
+++ b/generic/pg-xml.el
@@ -11,7 +11,7 @@
 
 ;; Author:     David Aspinall <David.Aspinall@ed.ac.uk>
 
-;; License:    GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
diff --git a/generic/proof-autoloads.el b/generic/proof-autoloads.el
index 92c5468906..d2ab935747 100644
--- a/generic/proof-autoloads.el
+++ b/generic/proof-autoloads.el
@@ -17,8 +17,8 @@
 (provide 'proof-autoloads)
 
 
-;;;### (autoloads nil "../coq/coq" "../coq/coq.el" (23587 63448 184007
-;;;;;;  512000))
+;;;### (autoloads nil "../coq/coq" "../coq/coq.el" (24631 49612 444031
+;;;;;;  796000))
 ;;; Generated autoloads from ../coq/coq.el
 
 (autoload 'coq-pg-setup "../coq/coq" "\
@@ -29,7 +29,7 @@
 ;;;***
 
 ;;;### (autoloads nil "../coq/coq-autotest" "../coq/coq-autotest.el"
-;;;;;;  (23572 12262 140036 921000))
+;;;;;;  (24208 57600 771957 35000))
 ;;; Generated autoloads from ../coq/coq-autotest.el
 
 (autoload 'coq-autotest "../coq/coq-autotest" "\
@@ -39,8 +39,8 @@
 
 ;;;***
 
-;;;### (autoloads nil "../coq/coq-mode" "../coq/coq-mode.el" (23588
-;;;;;;  277 353962 216000))
+;;;### (autoloads nil "../coq/coq-mode" "../coq/coq-mode.el" (24208
+;;;;;;  57600 775957 25000))
 ;;; Generated autoloads from ../coq/coq-mode.el
 
 (add-to-list 'auto-mode-alist '("\\.v\\'" . coq-mode))
@@ -54,8 +54,8 @@ Major mode for Coq scripts.
 
 ;;;***
 
-;;;### (autoloads nil "../lib/bufhist" "../lib/bufhist.el" (23587
-;;;;;;  60072 965937 641000))
+;;;### (autoloads nil "../lib/bufhist" "../lib/bufhist.el" (24208
+;;;;;;  57600 787956 998000))
 ;;; Generated autoloads from ../lib/bufhist.el
 
 (autoload 'bufhist-mode "../lib/bufhist" "\
@@ -86,8 +86,8 @@ Stop keeping ring history for current buffer.
 
 ;;;***
 
-;;;### (autoloads nil "../lib/holes" "../lib/holes.el" (23587 60990
-;;;;;;  445008 855000))
+;;;### (autoloads nil "../lib/holes" "../lib/holes.el" (24208 57600
+;;;;;;  787956 998000))
 ;;; Generated autoloads from ../lib/holes.el
 
 (autoload 'holes-set-make-active-hole "../lib/holes" "\
@@ -201,7 +201,7 @@ Insert S, expand it and replace #s and @{]s by holes.
 ;;;***
 
 ;;;### (autoloads nil "../lib/maths-menu" "../lib/maths-menu.el"
-;;;;;;  (23587 60072 965937 641000))
+;;;;;;  (24208 57600 787956 998000))
 ;;; Generated autoloads from ../lib/maths-menu.el
 
 (autoload 'maths-menu-mode "../lib/maths-menu" "\
@@ -214,8 +214,8 @@ This mode is only useful with a font which can display the 
maths repertoire.
 
 ;;;***
 
-;;;### (autoloads nil "pg-assoc" "pg-assoc.el" (23572 10813 702789
-;;;;;;  96000))
+;;;### (autoloads nil "pg-assoc" "pg-assoc.el" (24208 57600 779957
+;;;;;;  17000))
 ;;; Generated autoloads from pg-assoc.el
 
 (autoload 'proof-associated-buffers "pg-assoc" "\
@@ -239,8 +239,8 @@ Return the list of frames displaying at least one 
associated buffer.
 
 ;;;***
 
-;;;### (autoloads nil "../lib/pg-dev" "../lib/pg-dev.el" (23587 60072
-;;;;;;  965937 641000))
+;;;### (autoloads nil "../lib/pg-dev" "../lib/pg-dev.el" (24208 57600
+;;;;;;  787956 998000))
 ;;; Generated autoloads from ../lib/pg-dev.el
 
 (autoload 'profile-pg "../lib/pg-dev" "\
@@ -250,8 +250,8 @@ Configure Proof General for profiling.  Use \\[elp-results] 
to see results.
 
 ;;;***
 
-;;;### (autoloads nil "pg-goals" "pg-goals.el" (23587 64293 950005
-;;;;;;  517000))
+;;;### (autoloads nil "pg-goals" "pg-goals.el" (24208 57600 779957
+;;;;;;  17000))
 ;;; Generated autoloads from pg-goals.el
 
 (autoload 'proof-goals-config-done "pg-goals" "\
@@ -261,8 +261,8 @@ Initialise the goals buffer after the child has been 
configured.
 
 ;;;***
 
-;;;### (autoloads nil "pg-movie" "pg-movie.el" (23575 9223 344856
-;;;;;;  367000))
+;;;### (autoloads nil "pg-movie" "pg-movie.el" (24208 57600 779957
+;;;;;;  17000))
 ;;; Generated autoloads from pg-movie.el
 
 (autoload 'pg-movie-export "pg-movie" "\
@@ -284,8 +284,8 @@ Existing XML files are overwritten.
 
 ;;;***
 
-;;;### (autoloads nil "pg-pamacs" "pg-pamacs.el" (23587 60072 961937
-;;;;;;  714000))
+;;;### (autoloads nil "pg-pamacs" "pg-pamacs.el" (24217 47839 196027
+;;;;;;  466000))
 ;;; Generated autoloads from pg-pamacs.el
 
 (autoload 'proof-defpacustom-fn "pg-pamacs" "\
@@ -335,8 +335,8 @@ This macro also extends the `proof-assistant-settings' list.
 
 ;;;***
 
-;;;### (autoloads nil "pg-pgip" "pg-pgip.el" (23587 64365 208880
-;;;;;;  260000))
+;;;### (autoloads nil "pg-pgip" "pg-pgip.el" (24208 57600 779957
+;;;;;;  17000))
 ;;; Generated autoloads from pg-pgip.el
 
 (autoload 'pg-pgip-process-packet "pg-pgip" "\
@@ -357,8 +357,8 @@ Send an <askprefs> message to the prover.
 
 ;;;***
 
-;;;### (autoloads nil "pg-response" "pg-response.el" (23572 10813
-;;;;;;  706789 146000))
+;;;### (autoloads nil "pg-response" "pg-response.el" (24208 57600
+;;;;;;  783957 8000))
 ;;; Generated autoloads from pg-response.el
 
 (autoload 'proof-response-mode "pg-response" "\
@@ -427,8 +427,7 @@ See `pg-next-error-regexp'.
 
 ;;;***
 
-;;;### (autoloads nil "pg-user" "pg-user.el" (23572 12262 148037
-;;;;;;  11000))
+;;;### (autoloads nil "pg-user" "pg-user.el" (24230 6619 211624 483000))
 ;;; Generated autoloads from pg-user.el
 
 (autoload 'proof-script-new-command-advance "pg-user" "\
@@ -555,7 +554,7 @@ Enable or disable autosend behaviour.
 
 ;;;***
 
-;;;### (autoloads nil "pg-xml" "pg-xml.el" (23572 10813 706789 146000))
+;;;### (autoloads nil "pg-xml" "pg-xml.el" (24208 57600 783957 8000))
 ;;; Generated autoloads from pg-xml.el
 
 (autoload 'pg-xml-parse-string "pg-xml" "\
@@ -565,8 +564,8 @@ Parse string in ARG, same as pg-xml-parse-buffer.
 
 ;;;***
 
-;;;### (autoloads nil "proof-depends" "proof-depends.el" (23587 64458
-;;;;;;  963411 650000))
+;;;### (autoloads nil "proof-depends" "proof-depends.el" (24230 6619
+;;;;;;  211624 483000))
 ;;; Generated autoloads from proof-depends.el
 
 (autoload 'proof-depends-process-dependencies "proof-depends" "\
@@ -578,13 +577,15 @@ Called from `proof-done-advancing' when a save is 
processed and
 
 (autoload 'proof-dependency-in-span-context-menu "proof-depends" "\
 Make some menu entries showing proof dependencies of SPAN.
+Use `proof-dependency-menu-system-specific' to build system
+specific entries.
 
 \(fn SPAN)" nil nil)
 
 ;;;***
 
 ;;;### (autoloads nil "proof-easy-config" "proof-easy-config.el"
-;;;;;;  (23553 26684 846646 250000))
+;;;;;;  (24208 57600 783957 8000))
 ;;; Generated autoloads from proof-easy-config.el
 
 (autoload 'proof-easy-config "proof-easy-config" "\
@@ -597,8 +598,8 @@ Additional arguments are taken into account as a setq BODY.
 
 ;;;***
 
-;;;### (autoloads nil "proof-indent" "proof-indent.el" (23553 26684
-;;;;;;  846646 250000))
+;;;### (autoloads nil "proof-indent" "proof-indent.el" (24208 57600
+;;;;;;  783957 8000))
 ;;; Generated autoloads from proof-indent.el
 
 (autoload 'proof-indent-line "proof-indent" "\
@@ -608,8 +609,8 @@ Indent current line of proof script, if indentation enabled.
 
 ;;;***
 
-;;;### (autoloads nil "proof-maths-menu" "proof-maths-menu.el" (23587
-;;;;;;  60072 961937 714000))
+;;;### (autoloads nil "proof-maths-menu" "proof-maths-menu.el" (24208
+;;;;;;  57600 783957 8000))
 ;;; Generated autoloads from proof-maths-menu.el
 
 (autoload 'proof-maths-menu-set-global "proof-maths-menu" "\
@@ -629,8 +630,8 @@ in future if we have just activated it for this buffer.
 
 ;;;***
 
-;;;### (autoloads nil "proof-menu" "proof-menu.el" (23587 60072 961937
-;;;;;;  714000))
+;;;### (autoloads nil "proof-menu" "proof-menu.el" (24631 53911 652410
+;;;;;;  737000))
 ;;; Generated autoloads from proof-menu.el
 
 (autoload 'proof-menu-define-keys "proof-menu" "\
@@ -655,8 +656,8 @@ Construct and return PG auxiliary menu used in 
non-scripting buffers.
 
 ;;;***
 
-;;;### (autoloads nil "proof-script" "proof-script.el" (23587 64464
-;;;;;;  199330 36000))
+;;;### (autoloads nil "proof-script" "proof-script.el" (24631 49612
+;;;;;;  448031 792000))
 ;;; Generated autoloads from proof-script.el
 
 (autoload 'proof-ready-for-assistant "proof-script" "\
@@ -718,8 +719,8 @@ finish setup which depends on specific proof assistant 
configuration.
 
 ;;;***
 
-;;;### (autoloads nil "proof-shell" "proof-shell.el" (23587 60072
-;;;;;;  961937 714000))
+;;;### (autoloads nil "proof-shell" "proof-shell.el" (24631 49612
+;;;;;;  448031 792000))
 ;;; Generated autoloads from proof-shell.el
 
 (autoload 'proof-shell-ready-prover "proof-shell" "\
@@ -854,8 +855,8 @@ processing.
 
 ;;;***
 
-;;;### (autoloads nil "proof-splash" "proof-splash.el" (23587 59572
-;;;;;;  767190 499000))
+;;;### (autoloads nil "proof-splash" "proof-splash.el" (24208 57600
+;;;;;;  783957 8000))
 ;;; Generated autoloads from proof-splash.el
 
 (autoload 'proof-splash-display-screen "proof-splash" "\
@@ -873,8 +874,8 @@ Make sure the user gets welcomed one way or another.
 
 ;;;***
 
-;;;### (autoloads nil "proof-syntax" "proof-syntax.el" (23587 61484
-;;;;;;  723836 209000))
+;;;### (autoloads nil "proof-syntax" "proof-syntax.el" (24208 57600
+;;;;;;  783957 8000))
 ;;; Generated autoloads from proof-syntax.el
 
 (autoload 'proof-replace-regexp-in-string "proof-syntax" "\
@@ -891,8 +892,8 @@ may be a string or sexp evaluated to get a string.
 
 ;;;***
 
-;;;### (autoloads nil "proof-toolbar" "proof-toolbar.el" (23553 26684
-;;;;;;  850646 288000))
+;;;### (autoloads nil "proof-toolbar" "proof-toolbar.el" (24208 57600
+;;;;;;  783957 8000))
 ;;; Generated autoloads from proof-toolbar.el
 
 (autoload 'proof-toolbar-setup "proof-toolbar" "\
@@ -911,7 +912,7 @@ Menu made from the Proof General toolbar commands.
 ;;;***
 
 ;;;### (autoloads nil "proof-unicode-tokens" "proof-unicode-tokens.el"
-;;;;;;  (23587 60072 961937 714000))
+;;;;;;  (24631 49612 448031 792000))
 ;;; Generated autoloads from proof-unicode-tokens.el
 
 (autoload 'proof-unicode-tokens-mode-if-enabled "proof-unicode-tokens" "\
@@ -938,10 +939,15 @@ is changed.
 
 ;;;***
 
-;;;### (autoloads nil "proof-utils" "proof-utils.el" (23587 60072
-;;;;;;  961937 714000))
+;;;### (autoloads nil "proof-utils" "proof-utils.el" (24631 64200
+;;;;;;  229975 917000))
 ;;; Generated autoloads from proof-utils.el
 
+(autoload 'proof-upgrade-elpa-packages "proof-utils" "\
+Upgrade all ELPA packages (using package.el).
+
+\(fn)" t nil)
+
 (autoload 'proof-debug "proof-utils" "\
 Issue the debugging message (format MSG ARGS) in the *PG Debug* buffer.
 If flag `proof-general-debug' is nil, do nothing.
@@ -950,8 +956,8 @@ If flag `proof-general-debug' is nil, do nothing.
 
 ;;;***
 
-;;;### (autoloads nil "../lib/scomint" "../lib/scomint.el" (23587
-;;;;;;  60072 965937 641000))
+;;;### (autoloads nil "../lib/scomint" "../lib/scomint.el" (24208
+;;;;;;  57600 787956 998000))
 ;;; Generated autoloads from ../lib/scomint.el
 
 (autoload 'scomint-make-in-buffer "../lib/scomint" "\
@@ -983,7 +989,7 @@ If PROGRAM is a string, the remaining SWITCHES are 
arguments to PROGRAM.
 ;;;***
 
 ;;;### (autoloads nil "../lib/texi-docstring-magic" 
"../lib/texi-docstring-magic.el"
-;;;;;;  (23587 60072 965937 641000))
+;;;;;;  (24631 49612 448031 792000))
 ;;; Generated autoloads from ../lib/texi-docstring-magic.el
 
 (autoload 'texi-docstring-magic "../lib/texi-docstring-magic" "\
@@ -996,7 +1002,7 @@ With prefix arg, no errors on unknown symbols.  (This 
results in
 ;;;***
 
 ;;;### (autoloads nil "../lib/unicode-chars" "../lib/unicode-chars.el"
-;;;;;;  (23553 26684 902646 787000))
+;;;;;;  (24208 57600 791956 991000))
 ;;; Generated autoloads from ../lib/unicode-chars.el
 
 (autoload 'unicode-chars-list-chars "../lib/unicode-chars" "\
@@ -1009,7 +1015,7 @@ in your Emacs font.
 ;;;***
 
 ;;;### (autoloads nil "../lib/unicode-tokens" "../lib/unicode-tokens.el"
-;;;;;;  (23587 60072 965937 641000))
+;;;;;;  (24208 57600 791956 991000))
 ;;; Generated autoloads from ../lib/unicode-tokens.el
 
 (autoload 'unicode-tokens-encode-str "../lib/unicode-tokens" "\
@@ -1020,15 +1026,15 @@ Return a unicode encoded version presentation of STR.
 ;;;***
 
 ;;;### (autoloads nil nil ("../coq/coq-abbrev.el" 
"../coq/coq-compile-common.el"
-;;;;;;  "../coq/coq-db.el" "../coq/coq-indent.el" "../coq/coq-local-vars.el"
-;;;;;;  "../coq/coq-par-compile.el" "../coq/coq-par-test.el" 
"../coq/coq-seq-compile.el"
-;;;;;;  "../coq/coq-smie.el" "../coq/coq-syntax.el" "../coq/coq-system.el"
-;;;;;;  "../coq/coq-unicode-tokens.el" "../lib/local-vars-list.el"
+;;;;;;  "../coq/coq-db.el" "../coq/coq-diffs.el" "../coq/coq-indent.el"
+;;;;;;  "../coq/coq-local-vars.el" "../coq/coq-par-compile.el" 
"../coq/coq-par-test.el"
+;;;;;;  "../coq/coq-seq-compile.el" "../coq/coq-smie.el" "../coq/coq-syntax.el"
+;;;;;;  "../coq/coq-system.el" "../coq/coq-unicode-tokens.el" 
"../lib/local-vars-list.el"
 ;;;;;;  "../lib/pg-fontsets.el" "../lib/proof-compat.el" "../lib/span.el"
 ;;;;;;  "pg-autotest.el" "pg-custom.el" "pg-pbrpm.el" "pg-vars.el"
 ;;;;;;  "proof-auxmodes.el" "proof-config.el" "proof-faces.el" "proof-site.el"
-;;;;;;  "proof-tree.el" "proof-useropts.el" "proof.el") (23588 1830
-;;;;;;  459568 860000))
+;;;;;;  "proof-tree.el" "proof-useropts.el" "proof.el") (24631 50949
+;;;;;;  251401 294000))
 
 ;;;***
 
diff --git a/generic/proof-auxmodes.el b/generic/proof-auxmodes.el
index d3ccf41e17..a77491261f 100644
--- a/generic/proof-auxmodes.el
+++ b/generic/proof-auxmodes.el
@@ -11,7 +11,7 @@
 
 ;; Author:    David Aspinall <David.Aspinall@ed.ac.uk>
 
-;; License:   GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
diff --git a/generic/proof-config.el b/generic/proof-config.el
index 6f1e914876..506a0e1fbc 100644
--- a/generic/proof-config.el
+++ b/generic/proof-config.el
@@ -3,7 +3,7 @@
 ;; This file is part of Proof General.
 
 ;; Portions © Copyright 1994-2012  David Aspinall and University of Edinburgh
-;; Portions © Copyright 2003, 2012, 2014  Free Software Foundation, Inc.
+;; Portions © Copyright 2003-2021  Free Software Foundation, Inc.
 ;; Portions © Copyright 2001-2017  Pierre Courtieu
 ;; Portions © Copyright 2010, 2016  Erik Martin-Dorel
 ;; Portions © Copyright 2011-2013, 2016-2017  Hendrik Tews
@@ -11,7 +11,7 @@
 
 ;; Author:      David Aspinall <David.Aspinall@ed.ac.uk> and others
 
-;; License:     GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
@@ -446,10 +446,10 @@ It's safe to leave this setting as nil."
   :group 'proof-script)
 
 (defcustom proof-goal-with-hole-result 2
-  "How to get theorem name after ‘proof-goal-with-hole-regexp’ match.
+  "How to get theorem name after `proof-goal-with-hole-regexp' match.
 String or Int.
-If an int N, use ‘match-string’ to get the value of the Nth parenthesis 
matched.
-If a string, use ‘replace-match’.  In this case, ‘proof-goal-with-hole-regexp’
+If an int N, use `match-string' to get the value of the Nth parenthesis 
matched.
+If a string, use `replace-match'.  In this case, `proof-goal-with-hole-regexp'
 should match the entire command."
   :type '(choice string integer)
   :group 'proof-script)
@@ -696,19 +696,69 @@ needed for Coq."
   :type 'boolean
   :group 'proof-script)
 
-(defcustom proof-script-evaluate-elisp-comment-regexp "ELISP: -- \\(.*\\) --"
-  "Matches text within a comment telling Proof General to evaluate some code.
-This allows Emacs Lisp to be executed during scripting.
-\(It's also a fantastic backdoor security risk).
+(defcustom proof-omit-proofs-configured nil
+  "t if the omit proofs feature has been configured by the proof assitant.
+See also `proof-omit-proofs-option' or the Proof General manual
+for a description of the feature. This option can only be set, if
+all of `proof-script-proof-start-regexp',
+`proof-script-proof-end-regexp',
+`proof-script-definition-end-regexp' and
+`proof-script-proof-admit-command' have been configured.
+
+The omit proofs feature skips over opaque proofs in the source
+code, admitting the theorems, to speed up processing.
+
+If `proof-omit-proofs-option' is set by the user, all proof
+commands in the source following a match of
+`proof-script-proof-start-regexp' up to and including the next
+match of `proof-script-proof-end-regexp', are omitted (not send
+to the proof assistant) and replaced by
+`proof-script-proof-admit-command'. If a match for
+`proof-script-definition-end-regexp' is found while searching
+forward for the proof end, the current proof (up to and including
+the match of `proof-script-definition-end-regexp') is considered
+to be not opaque and not omitted, thus all these proof commands
+_are_ sent to the proof assistant.
+
+The feature does not work for nested proofs. If a match for
+`proof-script-proof-start-regexp' is found before the next match
+for `proof-script-proof-end-regexp' or
+`proof-script-definition-end-regexp', the search for opaque
+proofs immediately stops and all commands following the previous
+match of `proof-script-proof-start-regexp' are sent verbatim to
+the proof assistant.
+
+All the regular expressions for this feature are matched against
+the commands inside proof action items, that is as strings,
+without surrounding space."
+  :type 'boolean
+  :group 'proof-script)
+
+;; proof-omit-proofs-option is in proof-useropts as user option
+
+(defcustom proof-script-proof-start-regexp nil
+  "Regular expression for the start of a proof for the omit proofs feature.
+See `proof-omit-proofs-configured'."
+  :type 'regexp
+  :group 'proof-script)
 
-If the regexp matches text inside a comment, there should be
-one subexpression match string, which will contain elisp code
-to be evaluated.
+(defcustom proof-script-proof-end-regexp nil
+  "Regular expression for the end of an opaque proof for the omit proofs 
feature.
+See `proof-omit-proofs-configured'."
+  :type 'regexp
+  :group 'proof-script)
 
-Elisp errors will be trapped when evaluating; set
-`proof-general-debug' to be informed when this happens."
+(defcustom proof-script-definition-end-regexp nil
+  "Regexp for the end of a non-opaque proof for the omit proofs feature.
+See `proof-omit-proofs-configured'."
   :type 'regexp
   :group 'proof-script)
+  
+(defcustom proof-script-proof-admit-command nil
+  "Proof command to be inserted instead of omitted proofs."
+  :type 'string
+  :group 'proof-script)
+
 
 ;;
 ;; Proof script indentation
@@ -1345,44 +1395,6 @@ match data triggered by 
`proof-shell-retract-files-regexp'."
   :type 'string
   :group 'proof-shell)
 
-(defcustom proof-shell-set-elisp-variable-regexp nil
-  "Matches output telling Proof General to set some variable.
-This allows the proof assistant to configure Proof General directly
-and dynamically.   (It's also a fantastic backdoor security risk).
-
-More precisely, this should match a string which is bounded by
-matches on `proof-shell-eager-annotation-start' and
-`proof-shell-eager-annotation-end'.
-
-If the regexp matches output from the proof assistant, there should be
-two match strings: (match-string 1) should be the name of the elisp
-variable to be set, and (match-string 2) should be the value of the
-variable (which will be evaluated as a Lisp expression).
-
-A good markup for the second string is to delimit with #'s, since
-these are not valid syntax for elisp evaluation.
-
-Elisp errors will be trapped when evaluating; set
-`proof-general-debug' to be informed when this happens.
-
-Example uses are to adjust PG's internal copies of proof assistant's
-settings, or to make automatic dynamic syntax adjustments in Emacs to
-match changes in theory, etc.
-
-If you pick a dummy variable name (e.g. `proof-dummy-setting') you
-can just evaluation arbitrary elisp expressions for their side
-effects, to adjust menu entries, or even launch auxiliary programs.
-But use with care -- there is no protection against catastrophic elisp!
-
-This setting could also be used to move some configuration settings
-from PG to the prover, but this is not really supported (most settings
-must be made before this mechanism will work).  In future, the PG
-standard protocol, PGIP, will use this mechanism for making all
-settings."
-  :type '(choice (const nil) regexp)
-  :group 'proof-shell)
-
-
 (defcustom proof-shell-match-pgip-cmd nil
   "Regexp used to match PGIP command from proof assistant.
 
@@ -1437,8 +1449,7 @@ This is an experimental feature, currently 
work-in-progress."
   "Splits strings which match `proof-shell-theorem-dependency-list-regexp'.
 Used as an argument to `split-string'; nil defaults to whitespace.
 \(This setting is necessary for provers which allow whitespace in
-the names of theorems/definitions/constants), see setting for
-Isabelle in isa/isa.el and isar/isar.el."
+the names of theorems/definitions/constants)."
   :type '(choice (const nil) regexp)
   :group 'proof-shell)
 
@@ -1569,9 +1580,7 @@ they appear inside ML strings and the backslash character 
and
 quote characters must be escaped.  The setting
   '((\"\\\\\\\\\" . \"\\\\\\\\\")
     (\"\\\"\" . \"\\\\\\\"\"))
-achieves this.   This does not apply to LEGO, which does not
-need backslash escapes and does not allow filenames with
-quote characters.
+achieves this.
 
 This setting is used inside the function `proof-format-filename'."
   :type '(list (cons string string))
@@ -1617,7 +1626,7 @@ bound to `queueitems'."
   :group 'proof-shell)
 
 (defcustom proof-shell-insert-hook nil
-  "Hooks run by `proof-shell-insert' before inserting a command.
+  "Hook run by `proof-shell-insert' before inserting a command.
 Can be used to configure the proof assistant to the interface in
 various ways -- for example, to observe or alter the commands sent to
 the prover, or to sneak in extra commands to configure the prover.
@@ -1650,12 +1659,15 @@ prompts than expected, things will break!  Extending 
the variable
 stripped of carriage returns before being sent.
 
 Example uses:
-LEGO uses this hook for setting the pretty printer width if
+Lego used this hook for setting the pretty printer width if
 the window width has changed;
-Plastic uses it to remove literate-style markup from `string'.
+Plastic used it to remove literate-style markup from `string'.
 
 See also `proof-script-preprocess' which can munge text when
 it is added to the queue of commands."
+  ;; FIXME: The docstring suggests this is used by the backend code (e.g. LEGO
+  ;; support) rather than by the end user, so maybe it shouldn't be
+  ;; a `defcustom'?
   :type '(repeat function)
   :group 'proof-shell)
 
@@ -1667,10 +1679,9 @@ by the user.  It is run by `proof-assert-until-point'.
 WARNING: don't call `proof-assert-until-point' in this hook, you
 would loop forever.
 
-Example of use: Insert a command to adapt printing width.  Note
-that `proof-shell-insert-hook' may be use instead (see lego mode)
-if no more prompt will be displayed (see
-`proof-shell-insert-hook' for details)."
+Example of use: Insert a command to adapt printing width.
+Note that `proof-shell-insert-hook' (which see) may be use instead
+if no more prompt will be displayed."
   :type '(repeat function)
   :group 'proof-shell)
 
@@ -1682,10 +1693,9 @@ Can be used to insert commands.  It is run by
 WARNING: don't call `proof-retract-until-point' in this hook, you
 would loop forever.
 
-Example of use: Insert a command to adapt printing width.  Note
-that `proof-shell-insert-hook' may be use instead (see lego mode)
-if no more prompt will be displayed (see
-`proof-shell-insert-hook' for details)."
+Example of use: Insert a command to adapt printing width.
+Note that `proof-shell-insert-hook' (which see) may be use instead
+if no more prompt will be displayed."
   :type '(repeat function)
   :group 'proof-shell)
 
@@ -1843,11 +1853,12 @@ Leave unset if no special characters are being used."
   :group 'proof-goals)
 
 (defcustom pg-subterm-anns-use-stack nil
+  ;; FIXME: The docstring suggest we should use t!?
   "Choice of syntax tree encoding for terms.
 
 If nil, prover is expected to make no optimisations.
 If non-nil, the pretty printer of the prover only reports local changes.
-For LEGO 1.3.1 use nil, for Coq 6.2, use t."
+For Coq 6.2, use t."
   :type 'boolean
   :group 'proof-goals)
 
diff --git a/generic/proof-depends.el b/generic/proof-depends.el
index 6651e277a4..dd224424b8 100644
--- a/generic/proof-depends.el
+++ b/generic/proof-depends.el
@@ -3,7 +3,7 @@
 ;; This file is part of Proof General.
 
 ;; Portions © Copyright 1994-2012  David Aspinall and University of Edinburgh
-;; Portions © Copyright 2003-2018  Free Software Foundation, Inc.
+;; Portions © Copyright 2003-2021  Free Software Foundation, Inc.
 ;; Portions © Copyright 2001-2017  Pierre Courtieu
 ;; Portions © Copyright 2010, 2016  Erik Martin-Dorel
 ;; Portions © Copyright 2011-2013, 2016-2017  Hendrik Tews
@@ -12,7 +12,7 @@
 ;; Authors:      David Aspinall <David.Aspinall@ed.ac.uk>
 ;;              Earlier version by Fiona McNeil.
 
-;; License:      GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
@@ -89,7 +89,7 @@ Called from `proof-done-advancing' when a save is processed 
and
   (span-set-property gspan 'dependencies
                     ;; Ancestors of NAME are in the second component.
                     ;; FIXME: for now we ignore the first component:
-                    ;; NAME may not be enough [Isar allows proof regions
+                    ;; NAME may not be enough [e.g. Isar allowed proof regions
                     ;; with multiple names, which are reported in dep'c'y
                     ;; output].
                     (cdr proof-last-theorem-dependencies))
@@ -101,7 +101,7 @@ Called from `proof-done-advancing' when a save is processed 
and
         ;; one depends on; update their list of dependents,
         ;; and return resulting list paired up with names.
         (depspans
-         (apply 'append
+         (apply #'append
                 (span-mapcar-spans
                  (lambda (depspan)
                    (let ((dname (span-property depspan 'name)))
@@ -144,15 +144,15 @@ specific entries."
           (list
            "-------------"
            (proof-dep-make-submenu "Local Dependency..."
-                                  (lambda (namespan) (car namespan))
-                                  'proof-goto-dependency
+                                  #'car
+                                  #'proof-goto-dependency
                                   (span-property span 
'dependencies-within-file))
            (proof-make-highlight-depts-menu "Highlight Dependencies"
                                            'proof-highlight-depcs
                                            span 'dependencies-within-file)
            (proof-dep-make-submenu "Local Dependents..."
-                                  (lambda (namepos) (car namepos))
-                                  'proof-goto-dependency
+                                  #'car
+                                  #'proof-goto-dependency
                                   (span-property span 'dependents))
            (proof-make-highlight-depts-menu "Highlight Dependents"
                                            'proof-highlight-depts
@@ -184,9 +184,9 @@ specific entries."
                         (cdr nestedtop))
                 (mapcar (lambda (sm)
                           (proof-dep-make-submenu (car sm)
-                                                  'car
-                                                  'proof-show-dependency
-                                                  (mapcar 'list (cdr sm))))
+                                                  #'car
+                                                  #'proof-show-dependency
+                                                  (mapcar #'list (cdr sm))))
                         (car nestedtop)))))
       (vector menuname nil nil))))
 
@@ -214,9 +214,10 @@ If LIST is empty, return a disabled menu item with NAME.
 NAMEFN is applied to each element of LIST to make the names."
   (if list
       (cons name
-           (mapcar `(lambda (l)
-                      (vector (,namefn l)
-                              (cons (quote ,appfn) l) t)) list))
+           (mapcar (lambda (l)
+                     (vector (funcall namefn l)
+                             (cons appfn l) t))
+                   list))
     (vector name nil nil)))
 
 (defun proof-make-highlight-depts-menu (name fn span prop)
diff --git a/generic/proof-easy-config.el b/generic/proof-easy-config.el
index 4dc2e1d446..6639e9b266 100644
--- a/generic/proof-easy-config.el
+++ b/generic/proof-easy-config.el
@@ -11,7 +11,7 @@
 
 ;; Author:    David Aspinall <David.Aspinall@ed.ac.uk>
 
-;; License:   GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
diff --git a/generic/proof-faces.el b/generic/proof-faces.el
index 115d8667fd..322fdd14cf 100644
--- a/generic/proof-faces.el
+++ b/generic/proof-faces.el
@@ -11,7 +11,7 @@
 
 ;; Author:      David Aspinall <David.Aspinall@ed.ac.uk> and others
 
-;; License:     GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
@@ -218,6 +218,13 @@ Warning messages can come from proof assistant or from 
Proof General itself."
   "Proof General face for highlighting an error in the proof script. "
   :group 'proof-faces)
 
+(defface proof-omitted-proof-face
+  (proof-face-specs
+   (:background "#EAEFFF" :extend t)
+   (:background "#9C4A90" :extend t)
+   (:foreground "white" :background "black" :extend t))
+  "*Face for background of omitted proofs"
+  :group 'proof-faces)
 
 
 ;;; Compatibility: these are required for use in GNU Emacs/font-lock-keywords
diff --git a/generic/proof-indent.el b/generic/proof-indent.el
index 24da2059e1..d8062cc10b 100644
--- a/generic/proof-indent.el
+++ b/generic/proof-indent.el
@@ -11,7 +11,7 @@
 
 ;; Authors:       Markus Wenzel, David Aspinall
 
-;; License:        GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;; 
diff --git a/generic/proof-maths-menu.el b/generic/proof-maths-menu.el
index 6ff81c90a1..1c91c00ecc 100644
--- a/generic/proof-maths-menu.el
+++ b/generic/proof-maths-menu.el
@@ -11,7 +11,7 @@
 
 ;; Author:    David Aspinall <David.Aspinall@ed.ac.uk>
 
-;; License:   GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
diff --git a/generic/proof-menu.el b/generic/proof-menu.el
index c17d4e95f4..77bc05a84b 100644
--- a/generic/proof-menu.el
+++ b/generic/proof-menu.el
@@ -5,13 +5,13 @@
 ;; Portions © Copyright 1994-2012  David Aspinall and University of Edinburgh
 ;; Portions © Copyright 2003-2018  Free Software Foundation, Inc.
 ;; Portions © Copyright 2001-2017  Pierre Courtieu
-;; Portions © Copyright 2010, 2016  Erik Martin-Dorel
+;; Portions © Copyright 2010, 2016, 2021  Erik Martin-Dorel
 ;; Portions © Copyright 2011-2013, 2016-2017  Hendrik Tews
 ;; Portions © Copyright 2015-2017  Clément Pit-Claudel
 
 ;; Authors:   David Aspinall
 
-;; License:   GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
@@ -34,7 +34,7 @@
 (defvar proof-display-some-buffers-count 0)
 
 (defun proof-display-some-buffers ()
-  "Display the reponse, trace, goals, or shell buffer, rotating.
+  "Display the response, trace, goals, or shell buffer, rotating.
 A fixed number of repetitions of this command switches back to
 the same buffer.
 Also move point to the end of the response buffer if it's selected.
@@ -86,7 +86,6 @@ without adjusting window layout."
        (pg-response-buffers-hint (buffer-name nextbuf))))))
 
 
-
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;
 ;;; Key bindings
@@ -335,6 +334,7 @@ without adjusting window layout."
 (proof-deftoggle proof-fast-process-buffer)
 (proof-deftoggle proof-imenu-enable proof-imenu-toggle)
 (proof-deftoggle proof-keep-response-history)
+(proof-deftoggle proof-omit-proofs-option)
 
 (proof-eval-when-ready-for-assistant
  ;; togglers for settings separately configurable per-prover
@@ -362,6 +362,11 @@ without adjusting window layout."
 ;;;       :selected proof-keep-response-history]
 
      ("Processing"
+      ["Omit Proofs" proof-omit-proofs-option-toggle
+       :style toggle
+       :selected proof-omit-proofs-option
+       :active proof-omit-proofs-configured
+       :help "Skip over proofs, admitting theorems, when asserting larger 
chunks"]
       ["Fast Process Buffer" proof-fast-process-buffer-toggle
        :style toggle
        :selected proof-fast-process-buffer
@@ -687,6 +692,10 @@ without adjusting window layout."
         (list (customize-menu-create 'proof-general-internals "Internals"))))
   "Advanced sub-menu of script functions and customize.")
 
+(defvar proof-upgrade-menu
+  '(["Upgrade ELPA packages..." proof-upgrade-elpa-packages
+     :help "Update all Emacs packages (including Proof General!)"])
+  "The Proof General generic menu for upgrading packages.")
 
 (defvar proof-menu
   '(["Next Error" proof-next-error
@@ -706,7 +715,8 @@ without adjusting window layout."
         proof-config-menu
         (list (customize-menu-create 'proof-user-options "Customize Options"))
         (list proof-advanced-menu)
-        (list proof-help-menu))))
+        (list proof-help-menu)
+         proof-upgrade-menu)))
 
 ;;;###autoload
 (defun proof-aux-menu ()
@@ -1053,10 +1063,6 @@ value) and the second for false."
        (funcall proof-assistant-setting-format setting)
       setting)))
 
-
-
-
-
 (provide 'proof-menu)
 
 ;;; proof-menu.el ends here
diff --git a/generic/proof-script.el b/generic/proof-script.el
index a5109be7c3..654b9796f9 100644
--- a/generic/proof-script.el
+++ b/generic/proof-script.el
@@ -3,7 +3,7 @@
 ;; This file is part of Proof General.
 
 ;; Portions © Copyright 1994-2012  David Aspinall and University of Edinburgh
-;; Portions © Copyright 2003-2018  Free Software Foundation, Inc.
+;; Portions © Copyright 2003-2021  Free Software Foundation, Inc.
 ;; Portions © Copyright 2001-2017  Pierre Courtieu
 ;; Portions © Copyright 2010, 2016  Erik Martin-Dorel
 ;; Portions © Copyright 2011-2013, 2016-2017  Hendrik Tews
@@ -12,7 +12,7 @@
 ;; Authors:   David Aspinall, Yves Bertot, Healfdene Goguen,
 ;;            Thomas Kleymann and Dilip Sequeira
 
-;; License:   GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
@@ -86,6 +86,7 @@ If ASSISTANT-NAME is omitted, look up in 
`proof-assistant-table'."
        (cus-internals (intern (concat cusgrp-rt "-config")))
        (elisp-dir     sname)           ; NB: dirname same as symbol name!
        (loadpath-elt  (concat proof-home-directory elisp-dir "/")))
+    ;; FIXME: Yuck!!
     (eval `(progn
        ;; Make a customization group for this assistant
        (defgroup ,cusgrp nil
@@ -116,11 +117,12 @@ If ASSISTANT-NAME is omitted, look up in 
`proof-assistant-table'."
        ;; Extend the load path if necessary
        (proof-add-to-load-path ,loadpath-elt)
        ;; Run hooks for late initialisation
-       (run-hooks 'proof-ready-for-assistant-hook))))))
+       (run-hooks 'proof-ready-for-assistant-hook))
+          t))))
 
 
 (defalias 'proof-active-buffer-fake-minor-mode
-  'proof-toggle-active-scripting)
+  #'proof-toggle-active-scripting)
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -601,8 +603,7 @@ It is recorded in the span with the 'rawname property."
         (rawname  name)
         (name     (or name id))
         (idiom    (symbol-name idiomsym))
-        (delfn    `(lambda () (pg-remove-element
-                               (quote ,idiomsym) (quote ,idsym))))
+        (delfn    (lambda () (pg-remove-element idiomsym idsym)))
         (elts (cdr-safe (assq idiomsym pg-script-portions))))
     (unless elts
       (setq pg-script-portions
@@ -741,14 +742,14 @@ Each span has a 'type property, one of:
 (defvar pg-span-context-menu-keymap
   (let ((map (make-sparse-keymap
              "Keymap for context-sensitive menus on spans")))
-      (define-key map [down-mouse-3] 'pg-span-context-menu)
+      (define-key map [down-mouse-3] #'pg-span-context-menu)
       map)
     "Keymap for the span context menu.")
 
 (defun pg-last-output-displayform ()
   "Return displayable form of `proof-shell-last-output'.
 This is used to annotate the buffer with the result of proof steps."
-  ;; NOTE: Isabelle/Isar uses urgent messages (sigh) in its ordinary output.
+  ;; NOTE: Isabelle/Isar used urgent messages (sigh) in its ordinary output.
   ;; ("Successful attempt...").  This loses here.
   (if (string= proof-shell-last-output "") ""
     (let* ((text (proof-shell-strip-output-markup
@@ -1373,7 +1374,17 @@ With ARG, turn on scripting iff ARG is positive."
 
 (defun proof-done-advancing (span)
   "The callback function for `assert-until-point'.
-Argument SPAN has just been processed."
+Argument SPAN has just been processed.
+
+This is the callback for all the normal commands. Besides stuff
+that is not yet documented here, this function
+- extends the locked region
+- creates additional spans (without 'type property) for help,
+  tooltips, color and menus
+- merges spans with 'type as needed to achieve atomic undo for
+  proofs and sections
+- enters some commands and their spans in some database (with for
+  me unknown purpose)"
   (let ((end     (span-end span))
        (cmd     (span-property span 'cmd)))
 
@@ -1398,7 +1409,7 @@ Argument SPAN has just been processed."
               ;; don't amalgamate unless the nesting depth is 0,
               ;; i.e. we're in a top-level proof.
               ;; This assumes prover keeps history for nested proofs.
-              ;; (True for Isabelle/Isar).
+              ;; (was true for Isabelle/Isar).
               (eq proof-nesting-depth 0)
             t))
       (proof-done-advancing-save span))
@@ -1406,6 +1417,8 @@ Argument SPAN has just been processed."
      ;; CASE 3: Proof completed one step or more ago, non-save
      ;; command seen, no nested goals allowed.
      ;;
+     ;; AFAICT case 3 is never taken for Coq.
+     ;; 
      ;; We make a fake goal-save from any previous
      ;; goal to the command before the present one.
      ;;
@@ -1453,35 +1466,33 @@ Argument SPAN has just been processed."
                    (+ (length comment-start) (span-start span))
                    (- (span-end span)
                       (max 1 (length comment-end)))))
-       (id        (proof-next-element-id 'comment))
-       str)
+       (id        (proof-next-element-id 'comment)))
     (pg-add-element 'comment id bodyspan)
     (span-set-property span 'id (intern id))
     (span-set-property span 'idiom 'comment)
     (let ((proof-shell-last-output "")) ; comments not sent, no last output
-      (pg-set-span-helphighlights bodyspan))
-
-    ;; possibly evaluate some arbitrary Elisp.  SECURITY RISK!
-    (save-match-data
-      (setq str (buffer-substring-no-properties (span-start span)
-                                               (span-end span)))
-      (if (proof-string-match-safe proof-script-evaluate-elisp-comment-regexp 
str)
-         (condition-case nil
-             (eval (car (read-from-string (match-string-no-properties 1 str)))
-                    t)
-           (t (proof-debug
-               (concat
-                "lisp error when obeying 
proof-shell-evaluate-elisp-comment-regexp: \n"
-                (prin1-to-string (match-string-no-properties 1))
-                "\n"))))))))
+      (pg-set-span-helphighlights bodyspan))))
 
 
 (defun proof-done-advancing-save (span)
-  "A subroutine of `proof-done-advancing'.  Add info for save span SPAN."
+  "Retire commands that close a proof or some other region.
+This is a subroutine of `proof-done-advancing'.
+Besides stuff that is not yet documented here, this function
+- creates additional spans (without 'type property) for help,
+  tooltips, color and menus
+- in particular, adds the background color for omitted proofs
+- merges spans with 'type as needed to achieve atomic undo for
+  proofs and sections; for Coq this is done at least for proofs
+  and sections.
+- enters some commands and their spans in some database (with for
+  me unknown purpose)"
   (unless (or (eq proof-shell-proof-completed 1)
-             (eq proof-assistant-symbol 'isar))
+             ;; (eq proof-assistant-symbol 'isar)
+             )
     ;; We expect saves to succeed only for recently completed top-level proofs.
-    ;; NB: not true in Isar, because save commands can perform proof.
+    ;; NB: Wasn't true in Isar, because save commands could perform proof.
+    ;; Note: not true in Coq either, if there is a command (eg. a Check)
+    ;; between the tactic that finished the proof and the Qed.
     (proof-debug
      (format
       "PG: save command with proof-shell-proof-completed=%s, 
proof-nesting-depth=%s"
@@ -1494,6 +1505,13 @@ Argument SPAN has just been processed."
        (savestart (span-start span))
        (saveend   (span-end span))
        (cmd       (span-property span 'cmd))
+        ;; With the omit proofs feature (see
+        ;; `proof-omit-proofs-configured'), the span of the Admitted
+        ;; command that replaces the proof contains an
+        ;; 'omitted-proof-region property, that holds the start and
+        ;; end of the omitted proof for colouring. The property is
+        ;; only inserted for omitted proofs in the replacing Admitted.
+        (omitted-proof-region (span-property span 'omitted-proof-region))
        lev nestedundos nam next)
 
     (and proof-save-with-hole-regexp
@@ -1560,6 +1578,20 @@ Argument SPAN has just been processed."
       (proof-make-goalsave gspan (span-end gspan)
                           savestart saveend nam nestedundos)
 
+      ;; In case SPAN (which is retired now) belongs to an admit
+      ;; command that closes an omitted proof: create an additional
+      ;; span for the different background color of the omitted span.
+      ;; Start and end point of this span has been computed before in
+      ;; `proof-script-omit-proofs'. This background color span is
+      ;; registered in the span of the goal command for the only
+      ;; reason to not leave it dangling around.
+      (when omitted-proof-region
+        (let ((omit-span (span-make (car omitted-proof-region)
+                                    (cadr omitted-proof-region))))
+          (span-set-property omit-span 'face 'proof-omitted-proof-face)
+          (span-set-property omit-span 'omitted-proof-span t)
+          (span-set-property gspan 'omit-color-span omit-span)))
+
       ;; *** Theorem dependencies ***
       (if proof-last-theorem-dependencies
          (proof-depends-process-dependencies nam gspan)))))
@@ -1945,6 +1977,144 @@ Assumes that point is at the end of a command."
 
 
 
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Omit proofs feature.
+;;
+;; See `proof-omit-proofs-configured' for the feature. When the parsed
+;; buffer content has been converted to vanilla spans,
+;; `proof-script-omit-proofs' searches for complete opaque proofs in
+;; there and replaces them with `proof-script-proof-admit-command'.
+
+(defun proof-move-over-whitespace-to-next-line (pos)
+  "Return position of next line if one needs only to jump over white space.
+Utility function. In the current buffer, check if beginning of
+next line can be reached from POS by moving over white
+space (spaces, tabs) only. If yes return the beginning of next
+line, otherwise POS."
+  (save-excursion
+    (goto-char pos)
+    (skip-chars-forward " \t")
+    (setq pos (point))
+    (if (eolp)
+        (1+ (point))
+      pos)))
+  
+(defun proof-script-omit-proofs (vanillas)
+  "Return a copy of VANILLAS with complete opaque proofs omitted.
+See `proof-omit-proofs-configured' for the description of the
+omit proofs feature. This function uses
+`proof-script-proof-start-regexp',
+`proof-script-proof-end-regexp' and
+`proof-script-definition-end-regexp' to search for complete
+opaque proofs in the action list VANILLAS. Complete opaque proofs
+are replaced by `proof-script-proof-admit-command'. The span of
+the admit command contains an 'omitted-proof-region property with
+the region of the omitted proof. This is used in
+`proof-done-advancing-save' to colour the omitted proof with
+`proof-omitted-proof-face'.
+
+Report an error to the (probably surprised) user if another proof
+start is found inside a proof."
+  (cl-assert
+   (and proof-omit-proofs-configured proof-script-proof-start-regexp
+        proof-script-proof-end-regexp proof-script-definition-end-regexp
+        proof-script-proof-admit-command)
+   nil
+   "proof-script omit proof feature not properly configured")
+  (let (result maybe-result inside-proof
+        proof-start-span-start proof-start-span-end
+        item cmd)
+    (while vanillas
+      (setq item (car vanillas))
+      ;; cdr vanillas is at the end of the loop
+      (setq cmd (mapconcat #'identity (nth 1 item) " "))
+      (if inside-proof
+          (progn
+            (if (string-match proof-script-proof-start-regexp cmd)
+                ;; found another proof start inside a proof
+                ;; stop omitting and pass the remainder unmodified
+                ;; the result in `result' is aggregated in reverse
+                ;; order, need to reverse vanillas
+                (progn
+                  (setq result (nconc (nreverse vanillas) maybe-result result))
+                  (setq maybe-result nil)
+                  (setq vanillas nil)
+                  ;; for Coq nobody will notice the warning, because
+                  ;; the error about nested proofs will pop up shortly
+                  ;; afterwards
+                  (display-warning
+                   '(proof-script)
+                   ;; use the end of the span, because the start is
+                   ;; usually on the preceding  line
+                   (format (concat "found second proof start at line %d"
+                                   " - are there nested proofs?")
+                           (line-number-at-pos (span-end (car item))))))
+              (if (string-match proof-script-proof-end-regexp cmd)
+                  (let
+                      ;; Reuse the Qed span for the whole proof,
+                      ;; including the faked Admitted command.
+                      ;; `proof-done-advancing' expects such a span.
+                      ((cmd-span (car item)))
+                    (span-set-property cmd-span 'type 'omitted-proof)
+                    (span-set-property cmd-span
+                                       'cmd proof-script-proof-admit-command)
+                    (span-set-endpoints cmd-span proof-start-span-end
+                                        (span-end (car item)))
+                    ;; Throw away all commands between start of proof
+                    ;; and the current point, in particular, delete
+                    ;; all the spans.
+                    (mapc
+                     (lambda (item) (span-detach (car item)))
+                     maybe-result)
+                    (setq maybe-result nil)
+                    ;; Record start and end point for the fancy
+                    ;; colored span that marks the skipped proof. The
+                    ;; span will be created in
+                    ;; `proof-done-advancing-save' when
+                    ;; `proof-script-proof-admit-command' is retired.
+                    (span-set-property
+                     cmd-span 'omitted-proof-region
+                     ;; for the start take proper line start if possible
+                     (list (proof-move-over-whitespace-to-next-line
+                            proof-start-span-start)
+                           ;; For the end, don't extend to the end of
+                           ;; the line, because then the fancy color
+                           ;; span is behind the end of the proof span
+                           ;; and will get deleted when undoing just
+                           ;; behind that proof.
+                           (span-end (car item))))
+                    (push (list cmd-span
+                                (list proof-script-proof-admit-command)
+                                'proof-done-advancing nil)
+                          result)
+                    (setq inside-proof nil))
+                (if (string-match proof-script-definition-end-regexp cmd)
+                    ;; A proof ending in Defined or something similar.
+                    ;; Need to keep all commands from the start of the proof.
+                    (progn
+                      (setq result (cons item (nconc maybe-result result)))
+                      (setq maybe-result nil)
+                      (setq inside-proof nil))
+                  ;; normal proof command - maybe it belongs to a
+                  ;; Defined, keep it separate, until we know.
+                  (push item maybe-result)))))
+        ;; outside proof
+        (if (string-match proof-script-proof-start-regexp cmd)
+            (progn
+              (setq maybe-result nil)
+              ;; Keep the Proof using command in any case.
+              (push item result)
+              (setq proof-start-span-start (span-start (car item)))
+              (setq proof-start-span-end (span-end (car item)))
+              (setq inside-proof t))
+          ;; outside, no proof start - keep it unmodified
+          (push item result)))
+      (setq vanillas (cdr vanillas)))
+    (nreverse (nconc maybe-result result))))
+
+
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
 ;; Assert-until-point.
@@ -2019,20 +2189,29 @@ SEMIS must be a non-empty list, in reverse order (last 
position first).
 We assume that the list is contiguous and begins at 
(proof-queue-or-locked-end).
 We also delete help spans which appear in the same region (in the expectation
 that these may be overwritten).
-This function expects the buffer to be activated for advancing."
+This function expects the buffer to be activated for advancing.
+If the omit proofs feature is active, complete opaque proofs will
+be omitted from the vanilla action list obtained from SEMIS."
   (cl-assert semis nil "proof-assert-semis: argument must be a list")
   (let ((startpos  (proof-queue-or-locked-end))
        (lastpos   (nth 2 (car semis)))
        (vanillas  (proof-semis-to-vanillas semis displayflags)))
     (proof-script-delete-secondary-spans startpos lastpos)
+    (when (and proof-omit-proofs-option proof-omit-proofs-configured)
+      (setq vanillas (proof-script-omit-proofs vanillas)))
     (proof-extend-queue lastpos vanillas)))
 
+(defvar proof--inhibit-retract-on-change nil)
+
 (defun proof-retract-before-change (beg end)
   "For `before-change-functions'.  Retract to BEG unless BEG and END in 
comment.
 No effect if prover is busy."
-  (when (and (> (proof-queue-or-locked-end) beg)
-            (not (and (proof-inside-comment beg)
-                      (proof-inside-comment end))))
+  (unless (or (<= (proof-queue-or-locked-end) beg)
+             proof--inhibit-retract-on-change
+             (and (proof-inside-comment beg)
+                  ;; FIXME: This may mis fire if a change starts in a comment
+                  ;; and ends in another but with non-comment code in-between.
+                  (proof-inside-comment end)))
     (when proof-shell-busy
       (message "Interrupting prover")
       (proof-interrupt-process)
@@ -2080,7 +2259,7 @@ No effect if prover is busy."
 ;;
 
 ;; Most of the hard work (computing the commands to do the retraction)
-;; is implemented in the customisation module (lego.el or coq.el), so
+;; is implemented in the customisation module (e.g. coq.el), so
 ;; code here is fairly straightforward.
 
 
@@ -2617,9 +2796,9 @@ finish setup which depends on specific proof assistant 
configuration."
 ;; This key-binding was disabled following a request in PG issue #160.
 ;;     (define-key proof-mode-map
 ;;       (vconcat [(control c)] (vector (aref proof-terminal-string 0)))
-;;       'proof-electric-terminator-toggle)
+;;       #'proof-electric-terminator-toggle)
        (define-key proof-mode-map (vector (aref proof-terminal-string 0))
-         'proof-electric-terminator)))
+         #'proof-electric-terminator)))
 
   ;; Toolbar, main menu (loads proof-toolbar,setting p.-toolbar-scripting-menu)
   (proof-toolbar-setup)
@@ -2627,8 +2806,6 @@ finish setup which depends on specific proof assistant 
configuration."
   ;; Menus: the Proof-General and the specific menu
   (proof-menu-define-main)
   (proof-menu-define-specific)
-  (easy-menu-add proof-mode-menu proof-mode-map)
-  (easy-menu-add proof-assistant-menu proof-mode-map)
 
   ;; Define parsing functions
   (proof-setup-parsing-mechanism)
@@ -2655,6 +2832,13 @@ finish setup which depends on specific proof assistant 
configuration."
       (proof-shell-make-associated-buffers)
       (proof-layout-windows))
 
+  ;; Allow reindenting the already-processed code without causing
+  ;; a retraction.
+  (add-function :around (local 'indent-line-function)
+                #'(lambda (orig-fun &rest args)
+                    (let ((proof--inhibit-retract-on-change t))
+                      (apply orig-fun args))))
+
   ;; Make sure the user has been welcomed!
   (proof-splash-message))
 
diff --git a/generic/proof-shell.el b/generic/proof-shell.el
index af9b50e0fd..3407a0fbd8 100644
--- a/generic/proof-shell.el
+++ b/generic/proof-shell.el
@@ -3,7 +3,7 @@
 ;; This file is part of Proof General.
 
 ;; Portions © Copyright 1994-2012  David Aspinall and University of Edinburgh
-;; Portions © Copyright 2003-2018  Free Software Foundation, Inc.
+;; Portions © Copyright 2003-2021  Free Software Foundation, Inc.
 ;; Portions © Copyright 2001-2017  Pierre Courtieu
 ;; Portions © Copyright 2010, 2016  Erik Martin-Dorel
 ;; Portions © Copyright 2011-2013, 2016-2017  Hendrik Tews
@@ -12,7 +12,7 @@
 ;; Authors:   David Aspinall, Yves Bertot, Healfdene Goguen,
 ;;            Thomas Kleymann and Dilip Sequeira
 
-;; License:   GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
@@ -85,6 +85,7 @@ bother the user.  They may include
   'no-error-display         do not display errors/take error action
   'no-goals-display         do not goals in *goals* buffer
   'proof-tree-show-subgoal  item inserted by the proof-tree package
+  'priority-action          item added via proof-add-to-priority-queue
 
 Note that 'invisible does not imply any of the others. If flags
 are non-empty, interactive cues will be surpressed. (E.g.,
@@ -92,6 +93,22 @@ printing hints).
 
 See the functions `proof-start-queue' and `proof-shell-exec-loop'.")
 
+(defvar proof-priority-action-list nil
+  "Holds action items to be inserted at the head of `proof-action-list' ASAP.
+When the proof assistant is busy, one cannot push to the head of
+`proof-action-list`, because the head usually (but not always)
+contains the item that the proof assistant is currently
+executing. This list therefore holds the items to be executed
+before any other items in `proof-action-list'. Inside
+`proof-shell-exec-loop', when `proof-action-list' is in the right
+state, the content of this list is prepended to
+`proof-action-list'. Use `proof-add-to-priority-queue' to add
+items to this priority list, to ensure the proof assistant starts
+running, in case `proof-action-list' is currently empty.
+
+The items in this list are reversed, that is, the one added last
+and to be executed last is at the head.")
+
 (defsubst proof-shell-invoke-callback (listitem)
   "From `proof-action-list' LISTITEM, invoke the callback on the span."
   (condition-case err
@@ -359,7 +376,7 @@ process command."
              proof-shell-process-connection-type)
 
             ;; Trac #324, Trac #284: default with Emacs 23 variants
-            ;; is t.  nil gives marginally better results with "make
+            ;; is t.  nil gave marginally better results with "make
             ;; profile.isar" on homogenous test input.  Top-level
             ;; Emacs loop causes slow down on Mac and Windows ports.
             (process-adaptive-read-buffering nil)
@@ -610,7 +627,7 @@ It is up to the proof assistant how much context is 
cleared: for
 example, theories already loaded may be \"cached\" in some way,
 so that loading them the next time round only performs a re-linking
 operation, not full re-processing.  (One way of caching is via
-object files, used by Lego and Coq)."
+object files, used by Coq)."
   (interactive)
   (when proof-shell-busy
     (proof-interrupt-process)
@@ -1063,6 +1080,37 @@ being processed."
       ;; nothing to do: maybe we completed a list of comments without sending 
them
        (proof-detach-queue)))))
 
+(defun proof-start-prover-with-priority-items-maybe ()
+  "Start processing priority items if necessary.
+If there are priority items and the proof shell is not busy with
+other items, then this function starts the prover with the
+priority items. This function relies on the invariants of
+`proof-shell-filter-active' and on `proof-action-list'. The
+latter is non-empty, if there is some item, which has not been
+fully processed yet.
+
+Note that inside `proof-shell-exec-loop' the priority items are
+processed without calling this function."
+  (when (and proof-priority-action-list
+             (null proof-action-list) (not proof-shell-filter-active))
+    ;; not sure how fast we end up in proof-shell-exec-loop, better to clear
+    ;; proof-priority-action-list here before calling proof-add-to-queue
+    (let ((copy proof-priority-action-list))
+      (setq proof-priority-action-list nil)
+      ;; add to queue with the right mode - simply use the current mode
+      (proof-add-to-queue (nreverse copy) proof-shell-busy))))
+
+(defun proof-add-to-priority-queue (queueitem)
+  "Add item to `proof-priority-action-list' and start the queue if necessary.
+Argument QUEUEITEM must be an action item as documented for
+`proof-action-list'. Add flag 'priority-action to QUEUEITEM, such
+that priority items can be recognized and the order of added
+priority items can be preserved."
+  (let ((qi (list (car queueitem) (cadr queueitem) (caddr queueitem)
+                  (cons 'priority-action (cadddr queueitem)))))
+    (push qi proof-priority-action-list)
+    (proof-start-prover-with-priority-items-maybe)))
+
 
 ;;;###autoload
 (defun proof-start-queue (start end queueitems &optional queuemode)
@@ -1159,6 +1207,21 @@ contains only invisible elements for Prooftree 
synchronization."
        (if proof-tree-external-display
            (proof-tree-urgent-action flags))
 
+        ;; Add priority actions to the front of proof-action-list.
+        ;; Delay adding of priority items until there is no priority
+        ;; item at the head of `proof-action-list', such that more
+        ;; recently added priority items cannot overtake older items
+        ;; that wait in `proof-action-list'.
+        (when
+            (and proof-priority-action-list
+                 (or (null proof-action-list)
+                     (not (member 'priority-action
+                                  (nth 3 (car proof-action-list))))))
+          (setq proof-action-list
+                (nconc (nreverse proof-priority-action-list)
+                       proof-action-list))
+          (setq proof-priority-action-list nil))
+
        ;; if action list is (nearly) empty, ensure prover is noisy.
        (if (and proof-shell-silent
                 (not (eq (nth 2 item) 'proof-shell-clear-silent))
@@ -1258,9 +1321,6 @@ ends with text matching 
`proof-shell-eager-annotation-end'."
    ((proof-looking-at-safe proof-shell-clear-goals-regexp)
     (proof-clean-buffer proof-goals-buffer))
 
-   ((proof-looking-at-safe proof-shell-set-elisp-variable-regexp)
-    (proof-shell-process-urgent-message-elisp))
-
    ((proof-looking-at-safe proof-shell-match-pgip-cmd)
     (pg-pgip-process-packet
      ;; NB: xml-parse-region ignores junk before XML
@@ -1393,7 +1453,7 @@ to `proof-register-possibly-new-processed-file'."
   "Wrapper for `proof-shell-filter', protecting against parallel calls.
 In Emacs a process filter function can be called while the same
 filter is currently running for the same process, for instance,
-when the filter bocks on I/O. This wrapper protects the main
+when the filter blocks on I/O. This wrapper protects the main
 entry point, `proof-shell-filter' against such parallel,
 overlapping calls.
 
@@ -1418,7 +1478,10 @@ calls."
           (setq proof-shell-filter-active nil
                 proof-shell-filter-was-blocked nil)
           (signal (car err) (cdr err))))
-       (setq call-proof-shell-filter proof-shell-filter-was-blocked)))))
+       (setq call-proof-shell-filter proof-shell-filter-was-blocked)))
+    ;; finally leaving proof-shell-filter - maybe somebody has added
+    ;; priority items inside proof-shell-filter?
+    (proof-start-prover-with-priority-items-maybe)))
 
 
 (defun proof-shell-filter ()
diff --git a/generic/proof-site.el b/generic/proof-site.el
index 9f91d0e072..85819882e3 100644
--- a/generic/proof-site.el
+++ b/generic/proof-site.el
@@ -3,7 +3,7 @@
 ;; This file is part of Proof General.
 
 ;; Portions © Copyright 1994-2012  David Aspinall and University of Edinburgh
-;; Portions © Copyright 2003-2018  Free Software Foundation, Inc.
+;; Portions © Copyright 2003-2021  Free Software Foundation, Inc.
 ;; Portions © Copyright 2001-2017  Pierre Courtieu
 ;; Portions © Copyright 2010, 2016  Erik Martin-Dorel
 ;; Portions © Copyright 2011-2013, 2016-2017  Hendrik Tews
@@ -11,7 +11,7 @@
 
 ;; Author:      David Aspinall <David.Aspinall@ed.ac.uk>
 
-;; License:     GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
@@ -44,19 +44,10 @@
     '(
       ;; Main instances of PG.
 
-      (qrhl "qRHL" "qrhl")
-      
-      (isar "Isabelle" "thy")
       (coq "Coq" "v" nil (".vo" ".glob"))
       (easycrypt "EasyCrypt" "ec" "\\.eca?\\'")
       (phox "PhoX" "phx" nil (".phi" ".pho"))
-
-      ;; Obscure instances or conflict with other Emacs modes.
-
-      ;; (lego "LEGO" "l")
-      ;; (ccc    "CASL Consistency Checker" "ccc")
-
-      ;; (hol-light "HOL Light" "ml") ; [for testing]
+      (qrhl "qRHL" "qrhl")
 
       ;; Cut-and-paste management only
 
@@ -66,11 +57,6 @@
 
       ;; Incomplete/obsolete:
 
-      ;; (hol98        "HOL" "sml")
-      ;; (acl2 "ACL2" "acl2")
-      ;; (twelf        "Twelf" "elf")
-      ;; (plastic "Plastic" "lf")        ; obsolete
-      ;; (lclam "Lambda-CLAM" "lcm")     ; obsolete
       ;; (demoisa "Isabelle Demo" "ML")  ; obsolete
       )
     "Default value for `proof-assistant-table', which see.")
@@ -127,7 +113,7 @@
       (let ((s (getenv "PROOFGENERAL_HOME")))
        (if s (file-name-as-directory s)))))
   "Directory where Proof General is installed.
-based on where the file `proof-site.el' was loaded from.
+Based on where the file `proof-site.el' was loaded from.
 Falls back to consulting the environment variable `PROOFGENERAL_HOME' if
 proof-site.el couldn't know where it was executed from.")
 
@@ -191,7 +177,7 @@ proof-site.el couldn't know where it was executed from.")
            (list dne)
          nil)))
     proof-assistant-table-default))
-  "*Proof General's table of supported proof assistants.
+  "Proof General's table of supported proof assistants.
 This is copied from `proof-assistant-table-default' at load time,
 removing any entries that do not have a corresponding directory
 under `proof-home-directory'.
@@ -206,7 +192,7 @@ assistant, `SYMBOL-mode', run when files with 
AUTOMODE-REGEXP
 \(or with extension FILE-EXTENSION) are visited.  If present,
 IGNORED-EXTENSIONS-LIST is a list of file-name extensions to be
 ignored when doing file-name completion (IGNORED-EXTENSIONS-LIST
-is added to ‘completion-ignored-extensions’).
+is added to `completion-ignored-extensions').
 
 SYMBOL is also used to form the name of the directory and elisp
 file for the mode, which will be
@@ -222,11 +208,12 @@ variable `proof-home-directory'."
 
 (defcustom proof-assistants nil
   (concat
-   "*Choice of proof assistants to use with Proof General.
-A list of symbols chosen from:"
-   (apply 'concat (mapcar (lambda (astnt)
-                           (concat " '" (symbol-name (car astnt))))
-                         proof-assistant-table))
+   "Choice of proof assistants to use with Proof General.
+A list of symbols chosen from: "
+   (mapconcat (lambda (astnt)
+               (concat "`" (symbol-name (car astnt)) "'"))
+             proof-assistant-table
+             " ")
 ".\nIf nil, the default will be ALL available proof assistants.
 
 Each proof assistant defines its own instance of Proof General,
@@ -238,7 +225,7 @@ only select the proof assistants you (or your site) may 
need.
 You can select which proof assistants you want by setting this
 variable before `proof-site.el' is loaded, or by setting
 the environment variable `PROOFGENERAL_ASSISTANTS' to the
-symbols you want, for example \"lego isa\".  Or you can
+symbols you want, for example \"coq easycrypt\".  Or you can
 edit the file `proof-site.el' itself.
 
 Note: to change proof assistant, you must start a new Emacs session.")
@@ -249,9 +236,10 @@ Note: to change proof assistant, you must start a new 
Emacs session.")
   :group 'proof-general)
 
 (defvar proof-general-configured-provers
-  (or (mapcar 'intern (split-string (or (getenv "PROOFGENERAL_ASSISTANTS") 
"")))
+  (or (mapcar #'intern (split-string
+                        (or (getenv "PROOFGENERAL_ASSISTANTS") "")))
       proof-assistants
-      (mapcar (lambda (astnt) (car astnt)) proof-assistant-table))
+      (mapcar #'car proof-assistant-table))
   "A list of the configured proof assistants.
 Set on startup to contents of environment variable PROOFGENERAL_ASSISTANTS,
 the Lisp variable `proof-assistants', or the contents of 
`proof-assistant-table'.")
@@ -281,6 +269,8 @@ the Lisp variable `proof-assistants', or the contents of 
`proof-assistant-table'
 
         ;; Stub to initialize and load specific code.
         (mode-stub
+         ;; FIXME: Make it a closure with (:documentation EXP)
+          ;; once we don't need compatibility with Emacs<25.
          `(lambda ()
             ,(concat
               "Major mode for editing scripts for proof assistant "
@@ -323,7 +313,7 @@ the Lisp variable `proof-assistants', or the contents of 
`proof-assistant-table'
 
 (defun proof-chose-prover (prompt)
   (completing-read prompt
-                  (mapcar 'symbol-name
+                  (mapcar #'symbol-name
                           proof-general-configured-provers)))
 
 (defun proofgeneral (prover)
diff --git a/generic/proof-splash.el b/generic/proof-splash.el
index bb8b5c0ead..c44de006fb 100644
--- a/generic/proof-splash.el
+++ b/generic/proof-splash.el
@@ -1,9 +1,9 @@
-;;; proof-splash.el --- Splash welcome screen for Proof General
+;;; proof-splash.el --- Splash welcome screen for Proof General  -*- 
lexical-binding: t; -*-
 
 ;; This file is part of Proof General.
 
 ;; Portions © Copyright 1994-2012  David Aspinall and University of Edinburgh
-;; Portions © Copyright 2003-2018  Free Software Foundation, Inc.
+;; Portions © Copyright 2003-2021  Free Software Foundation, Inc.
 ;; Portions © Copyright 2001-2017  Pierre Courtieu
 ;; Portions © Copyright 2010, 2016  Erik Martin-Dorel
 ;; Portions © Copyright 2011-2013, 2016-2017  Hendrik Tews
@@ -11,7 +11,7 @@
 
 ;; Author:    David Aspinall
 
-;; License:   GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;; 
@@ -109,8 +109,8 @@ If it is nil, a new line is inserted."
   (set-buffer-modified-p nil)
   (setq buffer-read-only t))
 
-(define-key proof-splash-mode-map "q" 'bury-buffer)
-(define-key proof-splash-mode-map [mouse-3] 'bury-buffer)
+(define-key proof-splash-mode-map "q" #'bury-buffer)
+(define-key proof-splash-mode-map [mouse-3] #'bury-buffer)
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
@@ -157,7 +157,7 @@ Borrowed from startup-center-spaces."
 ;; Symptom is ProofGeneral mode instead of the native script mode.
 ;; 
 
-(defun proof-splash-remove-screen (&optional nothing)
+(defun proof-splash-remove-screen (&optional _nothing)
   "Remove splash screen and restore window config."
   (let ((splashbuf (get-buffer proof-splash-welcome)))
     (proof-splash-unset-frame-titles)
@@ -192,8 +192,8 @@ Borrowed from startup-center-spaces."
   "Insert splash buffer contents into current buffer."
  (let*
      ((splash-contents (append
-                       (eval proof-splash-contents)
-                       (eval proof-splash-startup-msg)))
+                       (eval proof-splash-contents t)
+                       (eval proof-splash-startup-msg t)))
       s)
    (setq buffer-read-only nil)
    (erase-buffer)
@@ -258,13 +258,13 @@ binding to remove this buffer."
         (setq proof-splash-timeout-conf
               (cons
                (add-timeout proof-splash-time
-                            'proof-splash-remove-screen nil)
+                            #'proof-splash-remove-screen nil)
                savedwincnf))
-        (add-hook 'proof-mode-hook 'proof-splash-timeout-waiter))))
+        (add-hook 'proof-mode-hook #'proof-splash-timeout-waiter))))
 
    (setq proof-splash-seen t)))
 
-(defalias 'pg-about 'proof-splash-display-screen)
+(defalias 'pg-about #'proof-splash-display-screen)
 
 ;;;###autoload
 (defun proof-splash-message ()
@@ -279,9 +279,8 @@ binding to remove this buffer."
           ;; otherwise it can have undesired interference.
           (run-with-timer
            0 nil
-           `(lambda ()
-             (proof-splash-display-screen
-               ,(not (called-interactively-p 'any))))))
+           (let ((nci (not (called-interactively-p 'any))))
+             (lambda () (proof-splash-display-screen nci)))))
       ;; Otherwise, a message
       (message "Welcome to %s Proof General!" proof-assistant))
     (setq proof-splash-seen t)))
@@ -297,7 +296,7 @@ binding to remove this buffer."
       (if (input-pending-p)
          (setq unread-command-events
                (cons (next-command-event) unread-command-events))))
-  (remove-hook 'proof-mode-hook 'proof-splash-timeout-waiter))
+  (remove-hook 'proof-mode-hook #'proof-splash-timeout-waiter))
 
 (defvar proof-splash-old-frame-title-format nil)
 
diff --git a/generic/proof-syntax.el b/generic/proof-syntax.el
index 6fbe8eb0c5..51601715e4 100644
--- a/generic/proof-syntax.el
+++ b/generic/proof-syntax.el
@@ -12,7 +12,7 @@
 ;; Authors:   David Aspinall, Healfdene Goguen,
 ;;           Thomas Kleymann, Dilip Sequiera
 
-;; License:   GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;; 
diff --git a/generic/proof-toolbar.el b/generic/proof-toolbar.el
index 8855247628..7bffbad2e8 100644
--- a/generic/proof-toolbar.el
+++ b/generic/proof-toolbar.el
@@ -11,7 +11,7 @@
 
 ;; Author:    David Aspinall <David.Aspinall@ed.ac.uk>
 
-;; License:   GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
diff --git a/generic/proof-tree.el b/generic/proof-tree.el
index 1a01147b76..6ddefead45 100644
--- a/generic/proof-tree.el
+++ b/generic/proof-tree.el
@@ -1,9 +1,9 @@
-;;; proof-tree.el --- Proof General prooftree communication.
+;;; proof-tree.el --- Proof General prooftree communication.  -*- 
lexical-binding: t; -*-
 
 ;; This file is part of Proof General.
 
 ;; Portions © Copyright 1994-2012  David Aspinall and University of Edinburgh
-;; Portions © Copyright 2003-2018  Free Software Foundation, Inc.
+;; Portions © Copyright 2003-2021  Free Software Foundation, Inc.
 ;; Portions © Copyright 2001-2017  Pierre Courtieu
 ;; Portions © Copyright 2010, 2016  Erik Martin-Dorel
 ;; Portions © Copyright 2011-2013, 2016-2017  Hendrik Tews
@@ -11,7 +11,7 @@
 
 ;; Authors:   Hendrik Tews
 
-;; License:   GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
@@ -467,7 +467,7 @@ from `proof-tree-process-filter' when more output arrives.")
           ;; there yet
           ;; need to try again later
           (setq proof-tree-filter-continuation
-                `(lambda () (proof-tree-insert-script ,data)))))
+                (lambda () (proof-tree-insert-script data)))))
       (display-warning
        '(proof-general proof-tree)
        "Prooftree sent an invalid data length for insert-command"
@@ -490,7 +490,7 @@ newly arrived output."
       (if moving (goto-char (point-max))))))
 
 
-(defun proof-tree-process-filter (proc string)
+(defun proof-tree-process-filter (_proc string)
   "Output filter for prooftree.
 Records the output in the prooftree process buffer and checks for
 callback function requests. Such callback functions might fail
@@ -550,7 +550,7 @@ everything is processed, the marker is deleted and
 ;; Process creation
 ;;
 
-(defun proof-tree-process-sentinel (proc event)
+(defun proof-tree-process-sentinel (_proc event)
   "Sentinel for prooftee.
 Runs on process status changes and cleans up when prooftree dies."
   (proof-tree-insert-output (concat "\nsubprocess status change: " event) t)
@@ -579,14 +579,14 @@ variables."
     ;; now start the new process
     (proof-tree-insert-output "\nStart new prooftree process\n\n" t)
     (setq proof-tree-process
-         (apply 'start-process
+         (apply #'start-process
           proof-tree-process-name
           proof-tree-process-buffer
           proof-tree-program
           proof-tree-arguments))
     (set-process-coding-system proof-tree-process 'utf-8-unix 'utf-8-unix)
-    (set-process-filter proof-tree-process 'proof-tree-process-filter)
-    (set-process-sentinel proof-tree-process 'proof-tree-process-sentinel)
+    (set-process-filter proof-tree-process #'proof-tree-process-filter)
+    (set-process-sentinel proof-tree-process #'proof-tree-process-sentinel)
     (set-process-query-on-exit-flag proof-tree-process nil)
     ;; other initializations
     (setq proof-tree-sequent-hash (make-hash-table :test 'equal)
@@ -627,7 +627,7 @@ DATA as data sections to Prooftree."
      (format "second line %03d\n%s\n%s%s"
             (1+ second-line-len)
             second-line
-            (mapconcat 'identity data "\n")
+            (mapconcat #'identity data "\n")
             (if data "\n" "")))))
 
 (defun proof-tree-send-configure ()
@@ -645,7 +645,7 @@ DATA as data sections to Prooftree."
   "Send the current goal state to prooftree."
   ;; (message "PTSGS id %s sequent %s ex-info %s"
   ;;      current-sequent-id current-sequent-text existential-info)
-  (let* ((add-id-string (mapconcat 'identity additional-sequent-ids " "))
+  (let* ((add-id-string (mapconcat #'identity additional-sequent-ids " "))
         (second-line
          (format
           (concat "current-goals state %d current-sequent %s %s %s "
@@ -819,7 +819,7 @@ lambda expressions that you can put into 
`proof-action-list'."
 
 (defun proof-tree-make-show-goal-callback (state)
   "Create the callback for display-goal commands."
-  `(lambda (span) (proof-tree-show-goal-callback ,state)))
+  (lambda (_span) (proof-tree-show-goal-callback state)))
 
 (defun proof-tree-urgent-action (flags)
   "Handle urgent points before the next item is sent to the proof assistant.
@@ -1054,8 +1054,8 @@ The delayed output of the navigation command is in the 
region
 (defun proof-tree-handle-proof-command (old-proof-marker cmd proof-info)
   "Display current goal in prooftree unless CMD should be ignored."
   ;; (message "PTHPC")
-  (let ((proof-state (car proof-info))
-       (cmd-string (mapconcat 'identity cmd " ")))
+  (let (;; (proof-state (car proof-info))
+       (cmd-string (mapconcat #'identity cmd " ")))
     (unless (and proof-tree-ignored-commands-regexp
                 (proof-string-match proof-tree-ignored-commands-regexp
                                     cmd-string))
@@ -1140,7 +1140,7 @@ The delayed output is in the region
                                                  sequent-text)))))))
 
 
-(defun proof-tree-handle-delayed-output (old-proof-marker cmd flags span)
+(defun proof-tree-handle-delayed-output (old-proof-marker cmd flags _span)
   "Process delayed output for prooftree.
 This function is the main entry point of the Proof General
 prooftree support.  It examines the delayed output in order to
@@ -1205,7 +1205,7 @@ the flags and SPAN is the span."
   (if (and proof-tree-configured (proof-tree-is-running))
       (proof-tree-send-undo 0)))
 
-(add-hook 'proof-deactivate-scripting-hook 'proof-tree-leave-buffer)
+(add-hook 'proof-deactivate-scripting-hook #'proof-tree-leave-buffer)
 
 
 ;;
diff --git a/generic/proof-unicode-tokens.el b/generic/proof-unicode-tokens.el
index 7ae75ba1ee..967265f8c1 100644
--- a/generic/proof-unicode-tokens.el
+++ b/generic/proof-unicode-tokens.el
@@ -11,7 +11,7 @@
 
 ;; Author:    David Aspinall <David.Aspinall@ed.ac.uk>
 
-;; License:   GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
@@ -26,7 +26,8 @@
 
 (eval-when-compile
   (require 'scomint)
-  (require 'proof-auxmodes)     ; loaded by proof.el, autoloads us
+  ;; the following require causes make magic to fail with a recursive chain
+  ;; (require 'proof-auxmodes)  ; loaded by proof.el, autoloads us
   (require 'unicode-tokens))    ; it will be loaded by proof-auxmodes
 
 (require 'proof-config)                        ; config variables
diff --git a/generic/proof-useropts.el b/generic/proof-useropts.el
index 4ce51c99e8..9edeec437a 100644
--- a/generic/proof-useropts.el
+++ b/generic/proof-useropts.el
@@ -3,7 +3,7 @@
 ;; This file is part of Proof General.
 
 ;; Portions © Copyright 1994-2012  David Aspinall and University of Edinburgh
-;; Portions © Copyright 2003-2018  Free Software Foundation, Inc.
+;; Portions © Copyright 2003-2021  Free Software Foundation, Inc.
 ;; Portions © Copyright 2001-2017  Pierre Courtieu
 ;; Portions © Copyright 2010, 2016  Erik Martin-Dorel
 ;; Portions © Copyright 2011-2013, 2016-2017  Hendrik Tews
@@ -11,7 +11,7 @@
 
 ;; Author:      David Aspinall <David.Aspinall@ed.ac.uk> and others
 
-;; License:     GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
@@ -99,6 +99,21 @@ be inserted as the user types commands to the prover."
   :set 'proof-set-value
   :group 'proof-user-options)
 
+(defcustom proof-omit-proofs-option nil
+  "Set to t to omit complete opaque proofs for speed reasons.
+When t, complete opaque proofs in the asserted region are not
+sent to the proof assistant (and thus not checked). For files
+with big proofs this can drastically reduce the processing time
+for the asserted region at the cost of not checking the proofs.
+For partial and non-opaque proofs in the asserted region all
+proof commands are sent to the proof assistant.
+
+Using a prefix argument for `proof-goto-point' (\\[proof-goto-point])
+or `proof-process-buffer' (\\[proof-process-buffer]) temporarily
+disables omitting proofs."
+  :type 'boolean
+  :group 'proof-user-options)
+
 (defcustom pg-show-hints t
   "*Whether to display keyboard hints in the minibuffer."
   :type 'boolean
@@ -377,8 +392,8 @@ For example,
 
    ssh bigjobs
 
-Would cause Proof General to issue the command `ssh bigjobs isabelle'
-to start Isabelle remotely on our large compute server called `bigjobs'.
+Would cause Proof General to issue the command `ssh bigjobs coqtop'
+to start Coq remotely on our large compute server called `bigjobs'.
 
 The protocol used should be configured so that no user interaction
 \(passwords, or whatever) is required to get going.  For proper
diff --git a/generic/proof-utils.el b/generic/proof-utils.el
index 39d1c22a35..1e0f407985 100644
--- a/generic/proof-utils.el
+++ b/generic/proof-utils.el
@@ -5,13 +5,13 @@
 ;; Portions © Copyright 1994-2012  David Aspinall and University of Edinburgh
 ;; Portions © Copyright 2003-2018  Free Software Foundation, Inc.
 ;; Portions © Copyright 2001-2017  Pierre Courtieu
-;; Portions © Copyright 2010, 2016  Erik Martin-Dorel
+;; Portions © Copyright 2010, 2016, 2021  Erik Martin-Dorel
 ;; Portions © Copyright 2011-2013, 2016-2017  Hendrik Tews
 ;; Portions © Copyright 2015-2017  Clément Pit-Claudel
 
 ;; Author:      David Aspinall <David.Aspinall@ed.ac.uk> and others
 
-;; License:     GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
@@ -101,6 +101,25 @@ Return nil if not a script buffer or if no active 
scripting buffer."
     (file-error nil))
   (featurep symbol))
 
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Facility to upgrade all ELPA packages (including ProofGeneral)
+;;
+
+;;;###autoload
+(defun proof-upgrade-elpa-packages ()
+  "Upgrade all ELPA packages (using package.el)."
+  (interactive)
+  (unless (proof-try-require 'package)
+    (error "The package feature is not available!"))
+  (let ((package-menu-async nil))
+    (package-list-packages)
+    (package-menu-mark-upgrades)
+    (let ((use-dialog-box nil))
+      ;; make `y-or-n-p' show up within the minibuffer
+      ;; even if `proof-upgrade-elpa-packages' is called interactively
+      ;; to avoid any dialog-box overflow if many packages are updated
+      (package-menu-execute))))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
diff --git a/generic/proof.el b/generic/proof.el
index 769459dfce..6db3cc43bc 100644
--- a/generic/proof.el
+++ b/generic/proof.el
@@ -12,7 +12,7 @@
 ;; Authors:   David Aspinall, Yves Bertot, Healfdene Goguen,
 ;;            Thomas Kleymann and Dilip Sequeira
 
-;; License:   GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;; Keywords: languages
 
diff --git a/hol-light/LICENSE-HOL-LIGHT b/hol-light/LICENSE-HOL-LIGHT
deleted file mode 100644
index f192eff1a0..0000000000
--- a/hol-light/LICENSE-HOL-LIGHT
+++ /dev/null
@@ -1,29 +0,0 @@
-            HOL Light copyright notice, licence and disclaimer
-
-                     (c) University of Cambridge 1998
-                  (c) Copyright, John Harrison 1998-2008
-
-HOL Light version 2.20, hereinafter referred to as "the software", is a
-computer theorem proving system written by John Harrison. Much of the
-software was developed at the University of Cambridge Computer Laboratory,
-New Museums Site, Pembroke Street, Cambridge, CB2 3QG, England. The
-software is copyright, University of Cambridge 1998 and John Harrison
-1998-2007.
-
-Permission to use, copy, modify, and distribute the software and its
-documentation for any purpose and without fee is hereby granted. In the
-case of further distribution of the software the present text, including
-copyright notice, licence and disclaimer of warranty, must be included in
-full and unmodified form in any release. Distribution of derivative
-software obtained by modifying the software, or incorporating it into
-other software, is permitted, provided the inclusion of the software is
-acknowledged and that any changes made to the software are clearly
-documented.
-
-John Harrison and the University of Cambridge disclaim all warranties
-with regard to the software, including all implied warranties of
-merchantability and fitness. In no event shall John Harrison or the
-University of Cambridge be liable for any special, indirect,
-incidental or consequential damages or any damages whatsoever,
-including, but not limited to, those arising from computer failure or
-malfunction, work stoppage, loss of profit or loss of contracts.
diff --git a/hol-light/README b/hol-light/README
deleted file mode 100644
index 238586c6c8..0000000000
--- a/hol-light/README
+++ /dev/null
@@ -1,45 +0,0 @@
-HOL Light in Proof General.
-
-Written by David Aspinall and Mark Adams.
-
-Status:                   not officially supported yet
-Maintainer:        volunteer required
-HOL-Light version: SVN trunk (a moving target 8-) - tested on 118)
-HOL homepage:      https://www.cl.cam.ac.uk/~jrh13/hol-light/
-
-========================================
-
-
-This is a "technology demonstration" of Proof General for HOL-Light.
-
-We have written this in the hope that somebody from the HOL-Light
-community will adopt it, maintain and improve it, and thus turn it
-into a proper instantiation of Proof General.
-
-
-------------
-
-Notes:
-
-There are some problems at the moment.  HOL proof scripts often use
-batch-oriented single step tactic proofs, but Proof General does not
-offer an easy way to edit these kind of proofs.  The "Boomburg-HOL"
-Emacs interface by Koichi Takahashi and Masima Hagiya addressed this a
-long time ago, and to some extent so perhaps does the Emacs interface
-supplied with HOL.  Perhaps one of these could be
-embedded/reimplemented inside Proof General.  Implemented in a generic
-way, managing batch vs interactive proofs might also be useful for
-other provers.
-
-Another problem is that HOL scripts sometimes use OCaml modules, which
-will cause confusion because Proof General does not really parse OCaml,
-it just looks for semicolons.  This could be improved by taking a
-better parser (perhaps from the OCaml mode for Emacs).
-
-These improvements would be worthwhile contributions to Proof General
-and also provide the HOL community with a nice front end.  
-Please have a go!
-
-
-$Id$
-
diff --git a/hol-light/TODO b/hol-light/TODO
deleted file mode 100644
index 61efb544b9..0000000000
--- a/hol-light/TODO
+++ /dev/null
@@ -1,17 +0,0 @@
-* Prooftree support: fix problem with successive proofs
-  (try example.ml with tree turned on, gives exn in Prooftree)
-  [da to investigate]
-
-* Prooftree: fix evar support so it works
-  Need patch for proof tree program and (maybe) modification of 
-  output
-  [ma to do]
-
-* PG: add patch for background startup (needs testing)
-  [da to do]
-
-* Integrate Tactic recording/proof refactoring (e.g. menu commands,
-  also load point: if it is to work from Proof General, make it
-  work from here, otherwise distribute it separately)
-  [ma to do]
-
diff --git a/hol-light/TacticRecording/INSTRUCTIONS 
b/hol-light/TacticRecording/INSTRUCTIONS
deleted file mode 100644
index 86380b93ce..0000000000
--- a/hol-light/TacticRecording/INSTRUCTIONS
+++ /dev/null
@@ -1,36 +0,0 @@
-To use this:
-1. first compile HOL Light and any extra files up to the particular proof you 
want to record;
-     #use "hol.ml";;
-     #use ....
-
-2. Then process the 'main.ml' file
-     #use "TacticRecording/main.ml";;
-
-3. Then perform the tactic proof you want to record, using g/e's or prove:
-     g `...`;;
-     e (...);;
-     e (...);;
-  OR
-     prove (`...`, ... THEN ... THENL [...]);;
-
-4. Use the ML export commands to output the proof in the form you want:
-
-     print_executed_proof ();;
-         - Tries to reproduce the inputted proof verbatim, with steps
-          corresponding one-to-one to original.
-
-     print_flat_proof ();;
-         - Prints the proof as a flatten series single-tactic steps, with no
-          tacticals.
-
-     print_thenl_proof ();;
-         - Prints the proof as a single-step tactic, connected by THEN for
-          single goals and THENL for multiple goals.  This structure directly
-          reflects the tree structure of the proof as it was executed.
-
-     print_optimal_proof ();;
-         - Like 'print_thenl_proof', but prints a more concise proof, not
-          necessarily reflecting the original tree structure.  Currently this
-          only performs one improvement: seeing where THENL can be replaced
-          with THEN.
-
diff --git a/hol-light/TacticRecording/LIMITATIONS 
b/hol-light/TacticRecording/LIMITATIONS
deleted file mode 100644
index 56537d479b..0000000000
--- a/hol-light/TacticRecording/LIMITATIONS
+++ /dev/null
@@ -1,18 +0,0 @@
-ML objects that get recorded need to be promoted
-- and the promoted subgoal package commands don't work for unpromoted ML 
objects
-- implementor needs to write promotion functions for each type shape
-- implementor needs to apply these promotion functions to lots of tactics/thms
-- user needs to promote their own stuff, e.g. their own rules/thms
-
-Tactic proofs with embedded arbitrary ML are problematic
-- sometimes this can still get recorded, and if so then exported ML will work
-- but exported ML is unlikely to faithfully reproduce original ML text
-
-Limitations in HOL Light's pretty printer for HOL terms
-- it outputs ambiguous expressions without type annotations
-- this is used by my ML exporter
-
-However, in practice the appraoch works well
-- the same old pool of 100 tactics, 100 rules, 1000 theorems get used
-- and any promotion that needs doing is easy anyway
-- hand tweaks are occasionally required for aribitrary ML and type annotations
diff --git a/hol-light/TacticRecording/biolayout.ml 
b/hol-light/TacticRecording/biolayout.ml
deleted file mode 100644
index 0de311987b..0000000000
--- a/hol-light/TacticRecording/biolayout.ml
+++ /dev/null
@@ -1,30 +0,0 @@
-(* ========================================================================== 
*)
-(* BIOLAYOUT EXPORT (HOL LIGHT)                                               
*)
-(* - Support for BioLayout graph display of recorded tactics                  
*)
-(*                                                                            
*)
-(* By Mark Adams                                                              
*)
-(* Copyright (c) Univeristy of Edinburgh, 2012                                
*)
-(* ========================================================================== 
*)
-
-
-(* biolayout_nodename *)
-
-let biolayout_nodename n =
-  "Node" ^ string_of_int n;;
-
-
-(* biolayout_export *)
-
-let biolayout_export path name =
-  let nns = gtree_graph () in
-  let suffix = ".layout" in
-  let fullname = Filename.concat path (name ^ suffix) in
-  let ch = open_out fullname in
-  let export_line ch (n1,n2) =
-     (output_string ch (biolayout_nodename n1);
-      output_string ch "\t";
-      output_string ch (biolayout_nodename n2);
-      output_string ch "\n") in
-  (print_string ("Exporting to file \"" ^ fullname ^ "\"\n");
-   do_list (export_line ch) nns;
-   close_out ch);;
diff --git a/hol-light/TacticRecording/dltree.ml 
b/hol-light/TacticRecording/dltree.ml
deleted file mode 100644
index e97ecd0bee..0000000000
--- a/hol-light/TacticRecording/dltree.ml
+++ /dev/null
@@ -1,268 +0,0 @@
-(* ========================================================================== 
*)
-(* DYNAMIC LOOKUP TREES (HOL Zero)                                            
*)
-(* - Library support for data storage in dynamic indexed binary trees         
*)
-(*                                                                            
*)
-(* By Mark Adams                                                              
*)
-(* Copyright (c) Proof Technologies Ltd, 2008-2011                            
*)
-(* ========================================================================== 
*)
-
-
-module Dltree : Dltree_sig = struct
-
-
-(* This module provides library support for operations on dynamic lookup      
*)
-(* trees - self-balancing binary trees that store information on nodes        
*)
-(* ordered according to an index under '(<)'-comparison.                      
*)
-
-(* This is implemented as Andersson trees (also called AA trees), that stay   
*)
-(* balanced within a factor of 2 - i.e. the maximum distance from root to     
*)
-(* leaf is no more than twice the minimum distance.  This has a fairly simple 
*)
-(* implementation and yet is one of the most efficient forms of self-         
*)
-(* balancing trees.                                                           
*)
-
-
-(* dltree datatype *)
-
-(* The 'dltree' datatype is a binary lookup tree datatype, where an index and 
*)
-(* item are held at each node, and leaves hold no information.  Comparison    
*)
-(* between indexes is done using the polymorphic '(<)' total order relation.  
*)
-
-(* An integer is also held at each node and is used to keep the tree balanced 
*)
-(* as items are inserted/removed.  This integer represents the distance from  
*)
-(* the node to the left-most leaf descendant of the node.  Thus every left-   
*)
-(* branch node holds a value 1 less than its parent, and a node with a leaf   
*)
-(* as its left branch holds value 1.  Every right-branch holds an integer     
*)
-(* either equal to its parent's or 1 less, and must be strictly less than its 
*)
-(* grandparent's.  Thus the integer at a node also represents an upper bound  
*)
-(* of half the distance from the node to its rightmost leaf descendant, and   
*)
-(* thus an upper bound of half the distance from the node to any descendant.  
*)
-
-(* The tree is kept balanced by adjusting nodes' integers and left and right  
*)
-(* branches as the tree is updated.  This is done by the 'skew' and 'split'   
*)
-(* operations.  The number of nodes that need to be considered in this        
*)
-(* process is at most O(log n).  Note that reference types are used for a     
*)
-(* node's branches, to save on unnecessary garbage collection that would      
*)
-(* otherwise result in rebuilding all ancestor nodes of all adjusted nodes    
*)
-(* each time a tree is updated.                                               
*)
-
-type ('a,'b) dltree0 =
-   Node of (int * ('a * 'b) * ('a,'b) dltree * ('a,'b) dltree)
- | Leaf
-
-and ('a,'b) dltree = ('a,'b) dltree0 ref;;
-
-
-(* dltree_empty : unit -> ('a,'b) dltree                                      
*)
-(*                                                                            
*)
-(* Returns a fresh empty dltree.                                              
*)
-
-let dltree_empty () = ref Leaf;;
-
-
-(* dltree_reempty : ('a,'b) dltree -> unit                                    
*)
-(*                                                                            
*)
-(* Empties a given dltree.                                                    
*)
-
-let dltree_reempty tr = (tr := Leaf);;
-
-
-(* dltree_elems : ('a,'b) dltree -> ('a * 'b) list                            
*)
-(*                                                                            
*)
-(* This converts the information held in a given lookup tree into an index-   
*)
-(* ordered association list.                                                  
*)
-
-let rec dltree_elems0 tr0 xys0 =
-  match !tr0 with
-    Node (_,xy0,tr1,tr2) -> dltree_elems0 tr1 (xy0::(dltree_elems0 tr2 xys0))
-  | Leaf                 -> xys0;;
-
-let dltree_elems tr = dltree_elems0 tr [];;
-
-
-(* Node destructors *)
-
-let dest_node tr0 =
-  match !tr0 with
-    Node info -> info
-  | Leaf      -> failwith "dest_node: ?";;
-
-let level tr0 =
-  match !tr0 with
-    Node (l,_,_,_) -> l
-  | Leaf           -> 0;;
-
-let left_branch tr0 =
-  match !tr0 with
-    Node (_,_,tr1,_) -> tr1
-  | Leaf             -> failwith "left_branch: No left branch";;
-
-let right_branch tr0 =
-  match !tr0 with
-    Node (_,_,_,tr2) -> tr2
-  | Leaf             -> failwith "right_branch: No right branch";;
-
-let rec leftmost_elem x tr0 =
-  match !tr0 with
-    Node (_,x0,tr1,_) -> leftmost_elem x0 tr1
-  | Leaf              -> x;;
-
-let rec rightmost_elem x tr0 =
-  match !tr0 with
-    Node (_,x0,_,tr2) -> rightmost_elem x0 tr2
-  | Leaf              -> x;;
-
-
-(* Tests *)
-
-let is_leaf tr0 =
-  match !tr0 with
-    Leaf -> true
-  | _    -> false;;
-
-let is_node tr0 =
-  match !tr0 with
-    Node _ -> true
-  | _      -> false;;
-
-
-(* skew *)
-
-let skew tr0 =
-  if (is_leaf tr0) or (is_leaf (left_branch tr0))
-    then ()
-  else if (level (left_branch tr0) = level tr0)
-    then let (l0,xy0,tr1,tr2) = dest_node tr0 in
-         let (l1,xy1,tr11,tr12) = dest_node tr1 in
-         (tr0 := Node (l1, xy1, tr11, ref (Node (l0,xy0,tr12,tr2))))
-    else ();;
-
-
-(* split *)
-
-let split tr0 =
-  if (is_leaf tr0) or (is_leaf (right_branch tr0))
-    then ()
-  else if (level (right_branch (right_branch tr0)) = level tr0)
-    then let (l0,xy0,tr1,tr2) = dest_node tr0 in
-         let (l2,xy2,tr21,tr22) = dest_node tr2 in
-         (tr0 := Node (l2 + 1, xy2, ref (Node (l0,xy0,tr1,tr21)), tr22))
-    else ();;
-
-
-(* dltree_insert : 'a * 'b -> ('a,'b) dltree -> unit                          
*)
-(*                                                                            
*)
-(* This inserts the supplied single indexed item into a given lookup tree.    
*)
-(* Fails if the tree already contains an entry for the supplied index.        
*)
-
-let rec dltree_insert ((x,_) as xy) tr0 =
-  match !tr0 with
-    Node (_,(x0,_),tr1,tr2)
-       -> ((if (x < x0)
-              then (* Put into left branch *)
-                   dltree_insert xy tr1
-            else if (x0 < x)
-              then (* Put into right branch *)
-                   dltree_insert xy tr2
-              else (* Element already in tree *)
-                   failwith "dltree_insert: Already in tree");
-           (* Rebalance from the node *)
-           skew tr0;
-           split tr0)
-  | Leaf
-       -> (* Put element here *)
-          (tr0 := Node (1, xy, ref Leaf, ref Leaf));;
-
-
-(* dltree_remove : 'a -> ('a,'b) dltree -> unit                               
*)
-(*                                                                            
*)
-(* This removes the entry at the supplied index in a given lookup tree.       
*)
-(* Fails if the tree does not contain an entry for the supplied index.        
*)
-
-let decrease_level tr0 =
-  let (l0,xy0,tr1,tr2) = dest_node tr0 in
-  let n = 1 + min (level tr1) (level tr2) in
-  if (n < l0) && (is_node tr2)
-    then (tr0 := Node (n,xy0,tr1,tr2);
-          if (is_node tr2)
-            then let (l2,xy2,tr21,tr22) = dest_node tr2 in
-                 if (n < level tr2)
-                   then (tr2 := Node (n,xy2,tr21,tr22))
-                   else ()
-            else ())
-    else ();;
-
-let rec dltree_remove x tr0 =
-  match !tr0 with
-    Node (l0,((x0,_) as xy0),tr1,tr2)
-       -> ((if (x < x0)
-              then (* Element should be in left branch *)
-                   dltree_remove x tr1
-            else if (x0 < x)
-              then (* Element should be in right branch *)
-                   dltree_remove x tr2
-              else (* Node holds element to be removed *)
-                   if (is_leaf tr1) && (is_leaf tr2)
-                     then (tr0 := Leaf)
-                   else if (is_leaf tr1)
-                     then let (x2,_) as xy2 = leftmost_elem xy0 tr2 in
-                          (dltree_remove x2 tr2;
-                           tr0 := Node (l0,xy2,tr1,tr2))
-                     else let (x1,_) as xy1 = rightmost_elem xy0 tr1 in
-                          (dltree_remove x1 tr1;
-                           tr0 := Node (l0,xy1,tr1,tr2)));
-           (if (is_node tr0)
-              then (decrease_level tr0;
-                    skew tr0;
-                    skew tr2;
-                    (if (is_node tr2) then skew (right_branch tr2)
-                                      else ());
-                    split tr0;
-                    split tr2)
-              else ()))
-  | Leaf
-       -> (* Element not in tree *)
-          failwith "dltree_remove: Not in tree";;
-
-
-(* dltree_elem : 'a -> ('a,'b) dltree -> 'a * 'b                              
*)
-(*                                                                            
*)
-(* This returns the index and item held at the supplied index in a given      
*)
-(* lookup tree.  Fails if the tree has no entry for the supplied index.       
*)
-
-let rec dltree_elem x0 tr =
-  match !tr with
-    Node (_, ((x,_) as xy), tr1, tr2)
-         -> if (x0 < x)
-              then dltree_elem x0 tr1
-            else if (x < x0)
-              then dltree_elem x0 tr2
-              else xy
-  | Leaf -> failwith "dltree_elem: Not in tree";;
-
-
-(* dltree_lookup : 'a -> ('a,'b) dltree -> 'b                                 
*)
-(*                                                                            
*)
-(* This returns the item held at the supplied index in a given lookup tree.   
*)
-
-let rec dltree_lookup x0 tr =
-  let (_,y) = try  dltree_elem x0 tr
-              with Failure _ -> failwith "dltree_lookup: Not in tree" in
-  y;;
-
-
-(* dltree_mem : 'a -> ('a,'b) dltree -> bool                                  
*)
-(*                                                                            
*)
-(* This returns "true" iff the supplied index occurs in a given lookup tree.  
*)
-
-let rec dltree_mem x0 tr =
-  match !tr with
-    Node (_,(x,_),tr1,tr2)
-         -> if (x0 < x)
-              then dltree_mem x0 tr1
-            else if (x < x0)
-              then dltree_mem x0 tr2
-              else true
-  | Leaf -> false;;
-
-
-end;;
diff --git a/hol-light/TacticRecording/dltree.mli 
b/hol-light/TacticRecording/dltree.mli
deleted file mode 100644
index 2f570490f5..0000000000
--- a/hol-light/TacticRecording/dltree.mli
+++ /dev/null
@@ -1,22 +0,0 @@
-(* ========================================================================== 
*)
-(* DYNAMIC LOOKUP TREES (HOL Zero)                                            
*)
-(* - Library support for data storage in dynamic indexed binary trees         
*)
-(*                                                                            
*)
-(* By Mark Adams                                                              
*)
-(* Copyright (c) Proof Technologies Ltd, 2008-2011                            
*)
-(* ========================================================================== 
*)
-
-
-module type Dltree_sig = sig
-
-  type ('a,'b) dltree
-  val dltree_empty : unit -> ('a,'b) dltree
-  val dltree_reempty : ('a,'b) dltree -> unit
-  val dltree_mem : 'a -> ('a,'b) dltree -> bool
-  val dltree_lookup : 'a -> ('a,'b) dltree -> 'b
-  val dltree_elem : 'a -> ('a,'b) dltree -> 'a * 'b
-  val dltree_elems : ('a,'b) dltree -> ('a * 'b) list
-  val dltree_insert : ('a * 'b) -> ('a,'b) dltree -> unit
-  val dltree_remove : 'a -> ('a,'b) dltree -> unit
-
-end;;
diff --git a/hol-light/TacticRecording/ex.dot b/hol-light/TacticRecording/ex.dot
deleted file mode 100644
index e96142f970..0000000000
--- a/hol-light/TacticRecording/ex.dot
+++ /dev/null
@@ -1,24 +0,0 @@
-digraph G {
-  subgraph cluster1 {
-    label = "induction";
-    517 -> 518;
-    517 -> 519;
-  }
-  subgraph cluster2 {
-    label = "base case";
-    528;
-  }
-  subgraph cluster3 {
-    label = "step case";
-    537 -> 538;
-    538 -> 540;
-    540 -> 542;
-    542 -> 544;
-    544 -> 546;
-    546 -> 548;
-  }
-  512 -> 513;
-  513 -> 517;
-  518 -> 528;
-  519 -> 537;
-}
\ No newline at end of file
diff --git a/hol-light/TacticRecording/ex2.dot 
b/hol-light/TacticRecording/ex2.dot
deleted file mode 100644
index fbe961bd82..0000000000
--- a/hol-light/TacticRecording/ex2.dot
+++ /dev/null
@@ -1,13 +0,0 @@
-digraph G {
-  subgraph cluster0 {
-    label = "process #1"
-    a0->a1->a2->a3
-  }
-  subgraph cluster1 {
-    label = "process #2"
-    b0->b1->b2->b3
-  }
-  b3->23
-  b2->a3
-  a3->23
-}
\ No newline at end of file
diff --git a/hol-light/TacticRecording/ex3.dot 
b/hol-light/TacticRecording/ex3.dot
deleted file mode 100644
index 1704533dc0..0000000000
--- a/hol-light/TacticRecording/ex3.dot
+++ /dev/null
@@ -1,24 +0,0 @@
-digraph G {
-  subgraph cluster1 {
-    label = "induction";
-    351 -> 352;
-    351 -> 353;
-    352 -> 358;
-    subgraph cluster2 {
-      label = "base case";
-      358;
-    }
-    353 -> 367;
-    subgraph cluster3 {
-      label = "step case";
-      367 -> 368;
-      368 -> 370;
-      370 -> 372;
-      372 -> 374;
-      374 -> 376;
-      376 -> 378;
-    }
-  }
-  344 -> 345;
-  345 -> 351;
-}
diff --git a/hol-light/TacticRecording/ex3.png 
b/hol-light/TacticRecording/ex3.png
deleted file mode 100644
index f2edfbdc56..0000000000
Binary files a/hol-light/TacticRecording/ex3.png and /dev/null differ
diff --git a/hol-light/TacticRecording/ex3b.dot 
b/hol-light/TacticRecording/ex3b.dot
deleted file mode 100644
index 5b951b96e9..0000000000
--- a/hol-light/TacticRecording/ex3b.dot
+++ /dev/null
@@ -1,37 +0,0 @@
-digraph G {
-  344 [label = "CONV_TAC"];
-  345 [label = "GEN_TAC"];
-  351 [label = "INDUCT_TAC"];
-  352 [label = "REWRITE_TAC"];
-  358 [label = "REAL_ARITH_TAC"];
-  353 [label = "REWRITE_TAC"];
-  367 [label = "REWRITE_TAC"];
-  368 [label = "SIMP_TAC"];
-  370 [label = "REWRITE_TAC"];
-  372 [label = "REWRITE_TAC"];
-  374 [label = "ASM_REWRITE_TAC"];
-  376 [label = "REWRITE_TAC"];
-  378 [label = "REAL_ARITH_TAC"];
-  344 -> 345;
-  345 -> 351;
-  subgraph cluster1 {
-    label = "induction";
-    351 -> 352;
-    351 -> 353;
-    352 -> 358;
-    subgraph cluster2 {
-      label = "base case";
-      358;
-    }
-    353 -> 367;
-    subgraph cluster3 {
-      label = "step case";
-      367 -> 368;
-      368 -> 370;
-      370 -> 372;
-      372 -> 374;
-      374 -> 376;
-      376 -> 378;
-    }
-  }
-}
\ No newline at end of file
diff --git a/hol-light/TacticRecording/examples1.ml 
b/hol-light/TacticRecording/examples1.ml
deleted file mode 100644
index 4e67ca180f..0000000000
--- a/hol-light/TacticRecording/examples1.ml
+++ /dev/null
@@ -1,64 +0,0 @@
-#use"TacticRecording/main.ml";;
-#use "TacticRecording/biolayout.ml";;
-
-pg_mode_off ();;
-
-g `x = x /\ y = y /\ z = z`;;
-e (CONJ_TAC);;
-e (REFL_TAC);;
-e (CONJ_TAC);;
-e (REFL_TAC);;
-e (REFL_TAC);;
-let th = top_thm ();;
-
-g `(!x. x = x) /\ (!y.y = y) /\ (!z.z = z)`;;
-e (REPEAT CONJ_TAC THEN GEN_TAC);;
-e (REFL_TAC);;
-e (REFL_TAC);;
-e (REFL_TAC);;
-let th = top_thm ();;
-
-g `(!x. x = x) /\ (!y.y = y) /\ (!z.z = z)`;;
-e (CONJ_TAC);;
-e (GEN_TAC);;
-e (REFL_TAC);;
-e (CONJ_TAC);;
-e (GEN_TAC);;
-e (REFL_TAC);;
-e (GEN_TAC);;
-e (REFL_TAC);;
-let th = top_thm ();;
-
-g `(!x. x = x) /\ (!y.y = y) /\ (!z.z = z)`;;
-e (REPEAT CONJ_TAC);;
-e (GEN_TAC);;
-e (REFL_TAC);;
-e (GEN_TAC);;
-e (REFL_TAC);;
-e (GEN_TAC);;
-e (REFL_TAC);;
-let th = top_thm ();;
-
-g `(!x. x = x) /\ (!y.y = y) /\ (!z.z = z)`;;
-e (REPEAT CONJ_TAC THEN GEN_TAC THEN REFL_TAC);;
-let th = top_thm ();;
-
-print_executed_proof true;;
-print_flat_proof true;;
-print_thenl_proof ();;
-print_packaged_proof ();;
-print_gv_proof ();;
-
-g `(y:A) = z ==> (x:A) = x /\ y = y /\ z = z`;;
-e (STRIP_TAC);;
-e (UNDISCH_TAC `(y:A) = z`);;
-e (DISCH_TAC);;
-e (CONJ_TAC);;
-e (REFL_TAC);;
-e (CONJ_TAC);;
-e (REFL_TAC);;
-e (REFL_TAC);;
-
-
-
-
diff --git a/hol-light/TacticRecording/examples1_output.txt 
b/hol-light/TacticRecording/examples1_output.txt
deleted file mode 100644
index 85f58add53..0000000000
--- a/hol-light/TacticRecording/examples1_output.txt
+++ /dev/null
@@ -1,72 +0,0 @@
-# g `(!x. x = x) /\ (!y.y = y) /\ (!z.z = z)`;;
-Warning: inventing type variables
-val it : xgoalstack = 1 subgoal (1 total)
-
-`(!x. x = x) /\ (!y. y = y) /\ (!z. z = z)`
-
-# e (REPEAT CONJ_TAC);;
-val it : xgoalstack = 3 subgoals (3 total)
-
-`!z. z = z`
-
-`!y. y = y`
-
-`!x. x = x`
-
-# e (GEN_TAC);;
-val it : xgoalstack = 1 subgoal (3 total)
-
-`x = x`
-
-# e (REFL_TAC);;
-val it : xgoalstack = 1 subgoal (2 total)
-
-`!y. y = y`
-
-# e (GEN_TAC);;
-val it : xgoalstack = 1 subgoal (2 total)
-
-`y = y`
-
-# e (REFL_TAC);;
-val it : xgoalstack = 1 subgoal (1 total)
-
-`!z. z = z`
-
-# e (GEN_TAC);;
-val it : xgoalstack = 1 subgoal (1 total)
-
-`z = z`
-
-# e (REFL_TAC);;
-val it : xgoalstack = No subgoals
-
-# print_executed_proof ();;
-e (REPEAT CONJ_TAC);;
-e (GEN_TAC);;
-e (REFL_TAC);;
-e (GEN_TAC);;
-e (REFL_TAC);;
-e (GEN_TAC);;
-e (REFL_TAC);;
-
-val it : unit = ()
-# print_flat_proof ();;
-e (CONJ_TAC);;
-e (GEN_TAC);;
-e (REFL_TAC);;
-e (CONJ_TAC);;
-e (GEN_TAC);;
-e (REFL_TAC);;
-e (GEN_TAC);;
-e (REFL_TAC);;
-
-val it : unit = ()
-# print_thenl_proof ();;
-e (CONJ_TAC THENL [GEN_TAC THEN REFL_TAC; CONJ_TAC THENL [GEN_TAC THEN 
REFL_TAC; GEN_TAC THEN REFL_TAC]]);;
-
-val it : unit = ()
-# print_optimal_proof ();;
-e (REPEAT CONJ_TAC THEN GEN_TAC THEN REFL_TAC);;
-val it : unit = ()
-# 
\ No newline at end of file
diff --git a/hol-light/TacticRecording/examples2.ml 
b/hol-light/TacticRecording/examples2.ml
deleted file mode 100644
index a53baa4023..0000000000
--- a/hol-light/TacticRecording/examples2.ml
+++ /dev/null
@@ -1,45 +0,0 @@
-#use "hol.ml";;
-needs "Examples/prime.ml";;
-
-#use "TacticRecording/main.ml";;
-
-
-let egcd = define
- `egcd(m,n) = if m = 0 then n 
-              else if n = 0 then m
-              else if m <= n then egcd(m,n - m)
-              else egcd(m - n,n)`;;
-
-let egcd = theorem_wrap "egcd" egcd;;
-let DIVIDES_0 =  theorem_wrap "DIVIDES_0" DIVIDES_0;;
-let WF_INDUCT_TAC = term_tactic_wrap "WF_INDUCT_TAC" WF_INDUCT_TAC;;
-
-g `!m n d. d divides egcd(m,n) <=> d divides m /\ d divides n`;;
-e (GEN_TAC THEN GEN_TAC THEN WF_INDUCT_TAC `m + n` THEN
-   GEN_TAC THEN ONCE_REWRITE_TAC[egcd] THEN
-   ASM_CASES_TAC `m = 0` THEN ASM_REWRITE_TAC[DIVIDES_0] THEN
-   ASM_CASES_TAC `n = 0` THEN ASM_REWRITE_TAC[DIVIDES_0] THEN 
-   COND_CASES_TAC);;
-top_goal ();;
-
-print_executed_proof ();;
-print_flat_proof ();;
-print_thenl_proof ();;
-print_optimal_proof ();;
-is_empty [23];;
-not true or not true;;
-
-let EGCD_INVARIANT = prove
- (`!m n d. d divides egcd(m,n) <=> d divides m /\ d divides n`,
-  GEN_TAC THEN GEN_TAC THEN WF_INDUCT_TAC `m + n` THEN
-  GEN_TAC THEN ONCE_REWRITE_TAC[egcd] THEN
-  ASM_CASES_TAC `m = 0` THEN ASM_REWRITE_TAC[DIVIDES_0] THEN
-  ASM_CASES_TAC `n = 0` THEN ASM_REWRITE_TAC[DIVIDES_0] THEN 
-  COND_CASES_TAC THEN
-  (W(fun (asl,w) -> FIRST_X_ASSUM(fun th ->
-    MP_TAC(PART_MATCH (lhs o snd o dest_forall o rand) th (lhand w)))) THEN
-   ANTS_TAC THENL [REPEAT(POP_ASSUM MP_TAC) THEN ARITH_TAC; ALL_TAC]) THEN
-  ASM_MESON_TAC[DIVIDES_SUB; DIVIDES_ADD; SUB_ADD; LE_CASES]);;
-  
-
-
diff --git a/hol-light/TacticRecording/examples3.ml 
b/hol-light/TacticRecording/examples3.ml
deleted file mode 100644
index f78ace3fce..0000000000
--- a/hol-light/TacticRecording/examples3.ml
+++ /dev/null
@@ -1,236 +0,0 @@
-#use"hol.ml";;
-needs "Library/products.ml";;
-
-#use "TacticRecording/main.ml";;
-
-prioritize_real();;
-
-AIM: CONT_COMPOSE (Library/analysis.ml)
-- used by John in his Proof Style paper
-
-
-(* ** LEMMA1 from HOL Light's 100/arithmetic_geometric_mean.ml ** *)
-
-let LEMMA_1 = prove
- (`!x n. x pow (n + 1) - (&n + &1) * x + &n =
-         (x - &1) pow 2 * sum(1..n) (\k. &k * x pow (n - k))`,
-  CONV_TAC(ONCE_DEPTH_CONV SYM_CONV) THEN GEN_TAC THEN INDUCT_TAC THEN
-  REWRITE_TAC[SUM_CLAUSES_NUMSEG; ARITH_EQ; ADD_CLAUSES] THENL
-   [REAL_ARITH_TAC; REWRITE_TAC[ARITH_RULE `1 <= SUC n`]] THEN
-  SIMP_TAC[ARITH_RULE `k <= n ==> SUC n - k = SUC(n - k)`; SUB_REFL] THEN
-  REWRITE_TAC[real_pow; REAL_MUL_RID] THEN
-  REWRITE_TAC[REAL_ARITH `k * x * x pow n = (k * x pow n) * x`] THEN
-  ASM_REWRITE_TAC[SUM_RMUL; REAL_MUL_ASSOC; REAL_ADD_LDISTRIB] THEN
-  REWRITE_TAC[GSYM REAL_OF_NUM_SUC; REAL_POW_ADD] THEN REAL_ARITH_TAC);;
-
-let LEMMA_1 = prove
- (`!x n. x pow (n + 1) - (&n + &1) * x + &n =
-         (x - &1) pow 2 * sum(1..n) (\k. &k * x pow (n - k))`,
-  CONV_TAC(ONCE_DEPTH_CONV SYM_CONV) THEN GEN_TAC THEN
-  HILABEL "induction"
-         (INDUCT_TAC THEN
-          REWRITE_TAC[SUM_CLAUSES_NUMSEG; ARITH_EQ; ADD_CLAUSES] THENL
-   [HILABEL "base case" REAL_ARITH_TAC; ALL_TAC] THEN
-  HILABEL "step case" (REWRITE_TAC[ARITH_RULE `1 <= SUC n`] THEN
-  SIMP_TAC[ARITH_RULE `k <= n ==> SUC n - k = SUC(n - k)`; SUB_REFL] THEN
-  REWRITE_TAC[real_pow; REAL_MUL_RID] THEN
-  REWRITE_TAC[REAL_ARITH `k * x * x pow n = (k * x pow n) * x`] THEN
-  ASM_REWRITE_TAC[SUM_RMUL; REAL_MUL_ASSOC; REAL_ADD_LDISTRIB] THEN
-  REWRITE_TAC[GSYM REAL_OF_NUM_SUC; REAL_POW_ADD] THEN REAL_ARITH_TAC)));;
-
-let LEMMA_1 = theorem_wrap "LEMMA_1" LEMMA_1;;
-
-top_thm ();;
-print_executed_proof true;;
-print_flat_proof true;;
-print_packaged_proof ();;
-print_thenl_proof ();;
-print_gv_proof ();;
-
-let gtr = !the_goal_tree;;
-let h = gtree_to_hiproof gtr;;
-let h' = (trivsimp_hiproof o dethen_hiproof) h;;
-
-g `!x n. x pow (n + 1) - (&n + &1) * x + &n =
-         (x - &1) pow 2 * sum(1..n) (\k. &k * x pow (n - k))`;;
-e (CONV_TAC (ONCE_DEPTH_CONV SYM_CONV));;
-e (GEN_TAC);;
-e (INDUCT_TAC);;
-(* *** Subgoal 1 *** *)
-e (REWRITE_TAC [SUM_CLAUSES_NUMSEG;ARITH_EQ;ADD_CLAUSES]);;
-e (REAL_ARITH_TAC);;
-(* *** Subgoal 2 *** *)
-e (REWRITE_TAC [SUM_CLAUSES_NUMSEG;ARITH_EQ;ADD_CLAUSES]);;
-e (REWRITE_TAC [ARITH_RULE `1 <= SUC n`]);;
-e (SIMP_TAC [ARITH_RULE `k <= n ==> SUC n - k = SUC (n - k)`; SUB_REFL]);;
-e (REWRITE_TAC [real_pow;REAL_MUL_RID]);;
-e (REWRITE_TAC [REAL_ARITH `k * x * x pow n = (k * x pow n) * x`]);;
-e (ASM_REWRITE_TAC [SUM_RMUL;REAL_MUL_ASSOC;REAL_ADD_LDISTRIB]);;
-e (REWRITE_TAC [GSYM REAL_OF_NUM_SUC; REAL_POW_ADD]);;
-e (REAL_ARITH_TAC);;
-
-print_executed_proof true;;
-print_packaged_proof ();;
-print_thenl_proof ();;
-
-(* LEMMA 2 *)
-
-let LEMMA_2 = prove
- (`!n x. &0 <= x ==> &0 <= x pow (n + 1) - (&n + &1) * x + &n`,
-  REPEAT STRIP_TAC THEN REWRITE_TAC[LEMMA_1] THEN
-  MATCH_MP_TAC REAL_LE_MUL THEN REWRITE_TAC[REAL_POW_2; REAL_LE_SQUARE] THEN
-  MATCH_MP_TAC SUM_POS_LE_NUMSEG THEN
-  ASM_SIMP_TAC[REAL_LE_MUL; REAL_POS; REAL_POW_LE]);;
-
-let LEMMA_2 = theorem_wrap "LEMMA_2" LEMMA_2;;
-
-print_executed_proof true;;
-print_flat_proof true;;
-print_packaged_proof ();;
-print_gv_proof ();;
-
-g `!n x. &0 <= x ==> &0 <= x pow (n + 1) - (&n + &1) * x + &n`;;
-
-(* LEMMA 3 *)
-
-let LEMMA_3 = prove
- (`!n x. 1 <= n /\ (!i. 1 <= i /\ i <= n + 1 ==> &0 <= x i)
-         ==> x(n + 1) * (sum(1..n) x / &n) pow n
-                <= (sum(1..n+1) x / (&n + &1)) pow (n + 1)`,
-  REPEAT STRIP_TAC THEN
-  ABBREV_TAC `a = sum(1..n+1) x / (&n + &1)` THEN
-  ABBREV_TAC `b = sum(1..n) x / &n` THEN
-  SUBGOAL_THEN `x(n + 1) = (&n + &1) * a - &n * b` SUBST1_TAC THENL
-   [MAP_EVERY EXPAND_TAC ["a"; "b"] THEN
-    ASM_SIMP_TAC[REAL_DIV_LMUL; REAL_OF_NUM_EQ; LE_1;
-                 REAL_ARITH `~(&n + &1 = &0)`] THEN
-    SIMP_TAC[SUM_ADD_SPLIT; ARITH_RULE `1 <= n + 1`; SUM_SING_NUMSEG] THEN
-    REAL_ARITH_TAC;
-    ALL_TAC] THEN
-  SUBGOAL_THEN `&0 <= a /\ &0 <= b` STRIP_ASSUME_TAC THENL
-   [MAP_EVERY EXPAND_TAC ["a"; "b"] THEN CONJ_TAC THEN
-    MATCH_MP_TAC REAL_LE_DIV THEN
-    (CONJ_TAC THENL [MATCH_MP_TAC SUM_POS_LE_NUMSEG; REAL_ARITH_TAC]) THEN
-    ASM_SIMP_TAC[ARITH_RULE `p <= n ==> p <= n + 1`];
-    ALL_TAC] THEN
-  ASM_CASES_TAC `b = &0` THEN
-  ASM_SIMP_TAC[REAL_POW_ZERO; LE_1; REAL_MUL_RZERO; REAL_POW_LE] THEN
-  MP_TAC(ISPECL [`n:num`; `a / b`] LEMMA_2) THEN ASM_SIMP_TAC[REAL_LE_DIV] THEN
-  REWRITE_TAC[REAL_ARITH `&0 <= x - a + b <=> a - b <= x`; REAL_POW_DIV] THEN
-  SUBGOAL_THEN `&0 < b` ASSUME_TAC THENL [ASM_REAL_ARITH_TAC; ALL_TAC] THEN
-  ASM_SIMP_TAC[REAL_LE_RDIV_EQ; REAL_POW_LT] THEN
-  MATCH_MP_TAC EQ_IMP THEN AP_THM_TAC THEN AP_TERM_TAC THEN
-  REWRITE_TAC[REAL_POW_ADD] THEN UNDISCH_TAC `~(b = &0)` THEN
-  CONV_TAC REAL_FIELD);;
-
-let LEMMA_3 = theorem_wrap "LEMMA_3" LEMMA_3;;
-
-print_executed_proof true;;
-print_flat_proof true;;
-print_thenl_proof ();;
-print_packaged_proof ();;
-print_gv_proof ();;
-
-g `!n x. 1 <= n /\ (!i. 1 <= i /\ i <= n + 1 ==> &0 <= x i)
-         ==> x(n + 1) * (sum(1..n) x / &n) pow n
-                <= (sum(1..n+1) x / (&n + &1)) pow (n + 1)`;;
-
-print_flat_proof true;;
-e (STRIP_TAC);;
-e (STRIP_TAC);;
-e (STRIP_TAC);;
-e (ABBREV_TAC `a = sum (1..n + 1) x / (&n + &1)`);;
-e (ABBREV_TAC `b = sum (1..n) x / &n`);;
-e (SUBGOAL_THEN `x (n + 1) = (&n + &1) * a - &n * b` SUBST1_TAC);;
-(* *** Subgoal 1 *** *)
-e (EXPAND_TAC "a");;
-e (EXPAND_TAC "b");;
-e (ASM_SIMP_TAC [REAL_DIV_LMUL; REAL_OF_NUM_EQ; LE_1; REAL_ARITH `~(&n + &1 = 
&0)`]);;
-e (SIMP_TAC [SUM_ADD_SPLIT; ARITH_RULE `1 <= n + 1`; SUM_SING_NUMSEG]);;
-e (REAL_ARITH_TAC);;
-(* *** Subgoal 2 *** *)
-e (SUBGOAL_THEN `&0 <= a /\ &0 <= b` STRIP_ASSUME_TAC);;
-(* *** Subgoal 2.1 *** *)
-e (EXPAND_TAC "a");;
-e (EXPAND_TAC "b");;
-e (CONJ_TAC);;
-(* *** Subgoal 2.1.1 *** *)
-e (MATCH_MP_TAC REAL_LE_DIV);;
-e (CONJ_TAC);;
-(* *** Subgoal 2.1.1.1 *** *)
-e (MATCH_MP_TAC SUM_POS_LE_NUMSEG);;
-e (ASM_SIMP_TAC [ARITH_RULE `p <= n ==> p <= n + 1`]);;
-(* *** Subgoal 2.1.1.2 *** *)
-e (REAL_ARITH_TAC);;
-(* *** Subgoal 2.1.2 *** *)
-e (MATCH_MP_TAC REAL_LE_DIV);;
-e (CONJ_TAC);;
-(* *** Subgoal 2.1.2.1 *** *)
-e (MATCH_MP_TAC SUM_POS_LE_NUMSEG);;
-e (ASM_SIMP_TAC [ARITH_RULE `p <= n ==> p <= n + 1`]);;
-(* *** Subgoal 2.1.2.2 *** *)
-e (REAL_ARITH_TAC);;
-(* *** Subgoal 2.2 *** *)
-e (ASM_CASES_TAC `b = &0`);;
-(* *** Subgoal 2.2.1 *** *)
-e (ASM_SIMP_TAC [REAL_POW_ZERO;LE_1;REAL_MUL_RZERO;REAL_POW_LE]);;
-(* *** Subgoal 2.2.2 *** *)
-e (ASM_SIMP_TAC [REAL_POW_ZERO;LE_1;REAL_MUL_RZERO;REAL_POW_LE]);;
-e (MP_TAC (ISPECL [`n`;`a / b`] LEMMA_2));;
-e (ASM_SIMP_TAC [REAL_LE_DIV]);;
-e (REWRITE_TAC [REAL_ARITH `&0 <= x - a + b <=> a - b <= x`; REAL_POW_DIV]);;
-e (SUBGOAL_THEN `&0 < b` ASSUME_TAC);;
-(* *** Subgoal 2.2.2.1 *** *)
-e (ASM_REAL_ARITH_TAC);;
-(* *** Subgoal 2.2.2.2 *** *)
-e (ASM_SIMP_TAC [REAL_LE_RDIV_EQ;REAL_POW_LT]);;
-e (MATCH_MP_TAC EQ_IMP);;
-e (AP_THM_TAC);;
-e (AP_TERM_TAC);;
-e (REWRITE_TAC [REAL_POW_ADD]);;
-e (UNDISCH_TAC `~(b = &0)`);;
-e (CONV_TAC REAL_FIELD);;
-
-(* AGM *)
-
-let AGM = prove
- (`!n a. 1 <= n /\ (!i. 1 <= i /\ i <= n ==> &0 <= a(i))
-         ==> product(1..n) a <= (sum(1..n) a / &n) pow n`,
-  INDUCT_TAC THEN REWRITE_TAC[ARITH; PRODUCT_CLAUSES_NUMSEG] THEN
-  REWRITE_TAC[ARITH_RULE `1 <= SUC n`] THEN X_GEN_TAC `x:num->real` THEN
-  ASM_CASES_TAC `n = 0` THENL
-   [ASM_REWRITE_TAC[PRODUCT_CLAUSES_NUMSEG; ARITH; SUM_SING_NUMSEG] THEN
-    REAL_ARITH_TAC;
-    REWRITE_TAC[ADD1] THEN STRIP_TAC THEN MATCH_MP_TAC REAL_LE_TRANS THEN     
-    EXISTS_TAC `x(n + 1) * (sum(1..n) x / &n) pow n` THEN
-    ASM_SIMP_TAC[LEMMA_3; GSYM REAL_OF_NUM_ADD; LE_1;
-                 ARITH_RULE `i <= n ==> i <= n + 1`] THEN
-    GEN_REWRITE_TAC RAND_CONV [REAL_MUL_SYM] THEN MATCH_MP_TAC REAL_LE_RMUL 
THEN
-    ASM_SIMP_TAC[LE_REFL; LE_1; ARITH_RULE `i <= n ==> i <= n + 1`]]);;
-
-g `!n a. 1 <= n /\ (!i. 1 <= i /\ i <= n ==> &0 <= a(i))
-         ==> product(1..n) a <= (sum(1..n) a / &n) pow n`;;
-e (INDUCT_TAC);;
-(* *** Subgoal 1 *** *)
-e (REWRITE_TAC [ARITH;PRODUCT_CLAUSES_NUMSEG]);;
-(* *** Subgoal 2 *** *)
-e (REWRITE_TAC [ARITH;PRODUCT_CLAUSES_NUMSEG]);;
-e (REWRITE_TAC [ARITH_RULE `1 <= SUC n`]);;
-e (X_GEN_TAC `x:num->real`);;
-e (ASM_CASES_TAC `n = 0`);;
-(* *** Subgoal 2.1 *** *)
-e (ASM_REWRITE_TAC [PRODUCT_CLAUSES_NUMSEG;ARITH;SUM_SING_NUMSEG]);;
-e (REAL_ARITH_TAC);;
-(* *** Subgoal 2.2 *** *)
-e (REWRITE_TAC [ADD1]);;
-e (STRIP_TAC);;
-e (MATCH_MP_TAC REAL_LE_TRANS);;
-e (EXISTS_TAC `x (n + 1) * (sum (1..n) x / &n) pow n`);;
-e (ASM_SIMP_TAC [LEMMA_3; GSYM REAL_OF_NUM_ADD; LE_1; ARITH_RULE `i <= n ==> i 
<= n + 1`]);;
-e (GEN_REWRITE_TAC RAND_CONV [REAL_MUL_SYM]);;
-e (MATCH_MP_TAC REAL_LE_RMUL);;
-e (ASM_SIMP_TAC [LE_REFL; LE_1; ARITH_RULE `i <= n ==> i <= n + 1`]);;
-
-g `!n a. 1 <= n /\ (!i. 1 <= i /\ i <= n ==> &0 <= a(i))
-         ==> product(1..n) a <= (sum(1..n) a / &n) pow n`;;
-e (INDUCT_TAC THEN REWRITE_TAC [ARITH;PRODUCT_CLAUSES_NUMSEG] THEN REWRITE_TAC 
[ARITH_RULE `1 <= SUC n`] THEN X_GEN_TAC `x:num->real` THEN ASM_CASES_TAC `n = 
0` THENL [ASM_REWRITE_TAC [PRODUCT_CLAUSES_NUMSEG;ARITH;SUM_SING_NUMSEG] THEN 
REAL_ARITH_TAC; REWRITE_TAC [ADD1] THEN STRIP_TAC THEN MATCH_MP_TAC 
REAL_LE_TRANS THEN EXISTS_TAC `x (n + 1) * (sum (1..n) x / &n) pow n` THEN 
ASM_SIMP_TAC [LEMMA_3; GSYM REAL_OF_NUM_ADD; LE_1; ARITH_RULE `i <= n ==> i <= 
n + 1`] THEN GEN_REWRITE_TAC RAND_ [...]
diff --git a/hol-light/TacticRecording/examples3_LEMMA1.dot 
b/hol-light/TacticRecording/examples3_LEMMA1.dot
deleted file mode 100644
index 69bc7c4a96..0000000000
--- a/hol-light/TacticRecording/examples3_LEMMA1.dot
+++ /dev/null
@@ -1,24 +0,0 @@
-digraph G {
-  subgraph cluster0 {
-    label = "induction";
-    517->518;
-    517->519;
-  }
-  subgraph cluster1 {
-    label = "base case";
-    528->528
-  }
-  subgraph cluster2 {
-    label = "step case";
-    537->538;
-    538->540;
-    540->542;
-    542->544;
-    544->546;
-    546->548;
-  }
-  512->513;
-  513->517;
-  518->528;
-  519->537;
-}
\ No newline at end of file
diff --git a/hol-light/TacticRecording/examples3_output.txt 
b/hol-light/TacticRecording/examples3_output.txt
deleted file mode 100644
index 18d4901f6b..0000000000
--- a/hol-light/TacticRecording/examples3_output.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-# let LEMMA_1 = prove
- (`!x n. x pow (n + 1) - (&n + &1) * x + &n =
-         (x - &1) pow 2 * sum(1..n) (\k. &k * x pow (n - k))`,
-  CONV_TAC(ONCE_DEPTH_CONV SYM_CONV) THEN GEN_TAC THEN INDUCT_TAC THEN
-  REWRITE_TAC[SUM_CLAUSES_NUMSEG; ARITH_EQ; ADD_CLAUSES] THENL
-   [REAL_ARITH_TAC; REWRITE_TAC[ARITH_RULE `1 <= SUC n`]] THEN
-  SIMP_TAC[ARITH_RULE `k <= n ==> SUC n - k = SUC(n - k)`; SUB_REFL] THEN
-  REWRITE_TAC[real_pow; REAL_MUL_RID] THEN
-  REWRITE_TAC[REAL_ARITH `k * x * x pow n = (k * x pow n) * x`] THEN
-  ASM_REWRITE_TAC[SUM_RMUL; REAL_MUL_ASSOC; REAL_ADD_LDISTRIB] THEN
-  REWRITE_TAC[GSYM REAL_OF_NUM_SUC; REAL_POW_ADD] THEN REAL_ARITH_TAC);;
-val ( LEMMA_1 ) : thm =
-  |- !x n.
-         x pow (n + 1) - (&n + &1) * x + &n =
-         (x - &1) pow 2 * sum (1..n) (\k. &k * x pow (n - k))
-
-# print_executed_proof ();;
-e ((CONV_TAC (ONCE_DEPTH_CONV SYM_CONV)) THEN GEN_TAC THEN INDUCT_TAC THEN 
(REWRITE_TAC [SUM_CLAUSES_NUMSEG;ARITH_EQ;ADD_CLAUSES]) THENL [REAL_ARITH_TAC; 
REWRITE_TAC [ARITH_RULE `1 <= SUC n`]] THEN (SIMP_TAC [ARITH_RULE `k <= n ==> 
SUC n - k = SUC (n - k)`; SUB_REFL]) THEN (REWRITE_TAC [real_pow;REAL_MUL_RID]) 
THEN (REWRITE_TAC [REAL_ARITH `k * x * x pow n = (k * x pow n) * x`]) THEN 
(ASM_REWRITE_TAC [SUM_RMUL;REAL_MUL_ASSOC;REAL_ADD_LDISTRIB]) THEN (REWRITE_TAC 
[GSYM REAL_OF_NUM_SUC; RE [...]
-
-val it : unit = () 
-# print_flat_proof ();;
-e (CONV_TAC (ONCE_DEPTH_CONV SYM_CONV));;
-e (GEN_TAC);;
-e (INDUCT_TAC);;
-e (REWRITE_TAC [SUM_CLAUSES_NUMSEG;ARITH_EQ;ADD_CLAUSES]);;
-e (REAL_ARITH_TAC);;
-e (REWRITE_TAC [SUM_CLAUSES_NUMSEG;ARITH_EQ;ADD_CLAUSES]);;
-e (REWRITE_TAC [ARITH_RULE `1 <= SUC n`]);;
-e (SIMP_TAC [ARITH_RULE `k <= n ==> SUC n - k = SUC (n - k)`; SUB_REFL]);;
-e (REWRITE_TAC [real_pow;REAL_MUL_RID]);;
-e (REWRITE_TAC [REAL_ARITH `k * x * x pow n = (k * x pow n) * x`]);;
-e (ASM_REWRITE_TAC [SUM_RMUL;REAL_MUL_ASSOC;REAL_ADD_LDISTRIB]);;
-e (REWRITE_TAC [GSYM REAL_OF_NUM_SUC; REAL_POW_ADD]);;
-e (REAL_ARITH_TAC);;
-
-
diff --git a/hol-light/TacticRecording/examples4.ml 
b/hol-light/TacticRecording/examples4.ml
deleted file mode 100644
index 3178f6562b..0000000000
--- a/hol-light/TacticRecording/examples4.ml
+++ /dev/null
@@ -1,13 +0,0 @@
-pg_mode_on ();;
-get_pg_mode ();;
-
-g `(?x:num. p(x) /\ q(x) /\ r(x)) ==> (?x. r(x) /\ p(x)) /\ (?x. p(x) /\ (q(x) 
<=> r(x)))`;;
-e (STRIP_TAC);;
-e (STRIP_TAC);;
-e (X_META_EXISTS_TAC `n1:num` THEN CONJ_TAC);;
-e (FIRST_X_ASSUM(UNIFY_ACCEPT_TAC [`n1:num`]));;
-e (ASM_REWRITE_TAC[]);;
-e (X_META_EXISTS_TAC `n2:num` THEN CONJ_TAC);;
-e (FIRST_X_ASSUM(UNIFY_ACCEPT_TAC [`n2:num`]));;
-e (ASM_REWRITE_TAC[]);;
-let th = top_thm ();;
diff --git a/hol-light/TacticRecording/examples5.ml 
b/hol-light/TacticRecording/examples5.ml
deleted file mode 100644
index 1ded99cf88..0000000000
--- a/hol-light/TacticRecording/examples5.ml
+++ /dev/null
@@ -1,182 +0,0 @@
-(* Taken from Library/prime.ml   *)
-
-prioritize_num();;
-
-(* ------------------------------------------------------------------------- *)
-(* HOL88 compatibility (since all this is a port of old HOL88 stuff).        *)
-(* ------------------------------------------------------------------------- *)
-
-let MULT_MONO_EQ = prove
- (`!m i n. ((SUC n) * m = (SUC n) * i) <=> (m = i)`,
-  REWRITE_TAC[EQ_MULT_LCANCEL; NOT_SUC]);;
-
-let LESS_ADD_1 = prove
- (`!m n. n < m ==> (?p. m = n + (p + 1))`,
-  REWRITE_TAC[LT_EXISTS; ADD1; ADD_ASSOC]);;
-
-let LESS_ADD_SUC = ARITH_RULE `!m n. m < (m + (SUC n))`;;
-
-let LESS_0_CASES = ARITH_RULE `!m. (0 = m) \/ 0 < m`;;
-
-let LESS_MONO_ADD = ARITH_RULE `!m n p. m < n ==> (m + p) < (n + p)`;;
-
-let LESS_EQ_0 = prove
- (`!n. n <= 0 <=> (n = 0)`,
-  REWRITE_TAC[LE]);;
-
-let LESS_LESS_CASES = ARITH_RULE `!m n. (m = n) \/ m < n \/ n < m`;;
-
-let LESS_ADD_NONZERO = ARITH_RULE `!m n. ~(n = 0) ==> m < (m + n)`;;
-
-let NOT_EXP_0 = prove
- (`!m n. ~((SUC n) EXP m = 0)`,
-  REWRITE_TAC[EXP_EQ_0; NOT_SUC]);;
-
-let LESS_THM = ARITH_RULE `!m n. m < (SUC n) <=> (m = n) \/ m < n`;;
-
-let NOT_LESS_0 = ARITH_RULE `!n. ~(n < 0)`;;
-
-let ZERO_LESS_EXP = prove
- (`!m n. 0 < ((SUC n) EXP m)`,
-  REWRITE_TAC[LT_NZ; NOT_EXP_0]);;
-
-(* ------------------------------------------------------------------------- *)
-(* General arithmetic lemmas.                                                *)
-(* ------------------------------------------------------------------------- *)
-
-let MULT_FIX = prove(
-  `!x y. (x * y = x) <=> (x = 0) \/ (y = 1)`,
-  REPEAT GEN_TAC THEN
-  STRUCT_CASES_TAC(SPEC `x:num` num_CASES) THEN
-  REWRITE_TAC[MULT_CLAUSES; NOT_SUC] THEN
-  REWRITE_TAC[GSYM(el 4 (CONJUNCTS (SPEC_ALL MULT_CLAUSES)))] THEN
-  GEN_REWRITE_TAC (LAND_CONV o RAND_CONV)     (* MMA: this is a problem !!!!)
-   [GSYM(el 3 (CONJUNCTS(SPEC_ALL MULT_CLAUSES)))] THEN
-  MATCH_ACCEPT_TAC MULT_MONO_EQ);;
-
-let LESS_EQ_MULT = prove(
-  `!m n p q. m <= n /\ p <= q ==> (m * p) <= (n * q)`,
-  REPEAT GEN_TAC THEN
-  DISCH_THEN(STRIP_ASSUME_TAC o REWRITE_RULE[LE_EXISTS]) THEN
-  ASM_REWRITE_TAC[LEFT_ADD_DISTRIB; RIGHT_ADD_DISTRIB;
-    GSYM ADD_ASSOC; LE_ADD]);;
-
-let LESS_MULT = prove(
-  `!m n p q. m < n /\ p < q ==> (m * p) < (n * q)`,
-  REPEAT GEN_TAC THEN DISCH_THEN(CONJUNCTS_THEN
-   ((CHOOSE_THEN SUBST_ALL_TAC) o MATCH_MP LESS_ADD_1)) THEN
-  REWRITE_TAC[LEFT_ADD_DISTRIB; RIGHT_ADD_DISTRIB] THEN
-  REWRITE_TAC[GSYM ADD1; MULT_CLAUSES; ADD_CLAUSES; GSYM ADD_ASSOC] THEN
-  ONCE_REWRITE_TAC[GSYM (el 3 (CONJUNCTS ADD_CLAUSES))] THEN
-  MATCH_ACCEPT_TAC LESS_ADD_SUC);;
-
-let MULT_LCANCEL = prove(
-  `!a b c. ~(a = 0) /\ (a * b = a * c) ==> (b = c)`,
-  REPEAT GEN_TAC THEN STRUCT_CASES_TAC(SPEC `a:num` num_CASES) THEN
-  REWRITE_TAC[NOT_SUC; MULT_MONO_EQ]);;
-
-let LT_POW2_REFL = prove
- (`!n. n < 2 EXP n`,
-  INDUCT_TAC THEN REWRITE_TAC[EXP] THEN TRY(POP_ASSUM MP_TAC) THEN ARITH_TAC);;
-
-(* ------------------------------------------------------------------------- *)
-(* Properties of the exponential function.                                   *)
-(* ------------------------------------------------------------------------- *)
-
-let EXP_0 = prove
- (`!n. 0 EXP (SUC n) = 0`,
-  REWRITE_TAC[EXP; MULT_CLAUSES]);;
-
-let EXP_MONO_LT_SUC = prove
- (`!n x y. (x EXP (SUC n)) < (y EXP (SUC n)) <=> (x < y)`,
-  REWRITE_TAC[EXP_MONO_LT; NOT_SUC]);;
-
-let EXP_MONO_LE_SUC = prove
- (`!x y n. (x EXP (SUC n)) <= (y EXP (SUC n)) <=> x <= y`,
-  REWRITE_TAC[EXP_MONO_LE; NOT_SUC]);;
-
-let EXP_MONO_EQ_SUC = prove
- (`!x y n. (x EXP (SUC n) = y EXP (SUC n)) <=> (x = y)`,
-  REWRITE_TAC[EXP_MONO_EQ; NOT_SUC]);;
-
-let EXP_EXP = prove
- (`!x m n. (x EXP m) EXP n = x EXP (m * n)`,
-  REWRITE_TAC[EXP_MULT]);;
-
-(* ------------------------------------------------------------------------- *)
-(* More ad-hoc arithmetic lemmas unlikely to be useful elsewhere.            *)
-(* ------------------------------------------------------------------------- *)
-
-let DIFF_LEMMA = prove(
-  `!a b. a < b ==> (a = 0) \/ (a + (b - a)) < (a + b)`,
-  REPEAT GEN_TAC THEN
-  DISJ_CASES_TAC(SPEC `a:num` LESS_0_CASES) THEN ASM_REWRITE_TAC[] THEN
-  DISCH_THEN(CHOOSE_THEN SUBST1_TAC o MATCH_MP LESS_ADD_1) THEN
-  DISJ2_TAC THEN REWRITE_TAC[ONCE_REWRITE_RULE[ADD_SYM] ADD_SUB] THEN
-  GEN_REWRITE_TAC LAND_CONV [GSYM (CONJUNCT1 ADD_CLAUSES)] THEN
-  REWRITE_TAC[ADD_ASSOC] THEN
-  REPEAT(MATCH_MP_TAC LESS_MONO_ADD) THEN POP_ASSUM ACCEPT_TAC);;
-
-let NOT_EVEN_EQ_ODD = prove(
-  `!m n. ~(2 * m = SUC(2 * n))`,
-  REPEAT GEN_TAC THEN DISCH_THEN(MP_TAC o AP_TERM `EVEN`) THEN
-  REWRITE_TAC[EVEN; EVEN_MULT; ARITH]);;
-
-let CANCEL_TIMES2 = prove(
-  `!x y. (2 * x = 2 * y) <=> (x = y)`,
-  REWRITE_TAC[num_CONV `2`; MULT_MONO_EQ]);;
-
-let EVEN_SQUARE = prove(
-  `!n. EVEN(n) ==> ?x. n EXP 2 = 4 * x`,
-  GEN_TAC THEN REWRITE_TAC[EVEN_EXISTS] THEN
-  DISCH_THEN(X_CHOOSE_THEN `m:num` SUBST1_TAC) THEN
-  EXISTS_TAC `m * m` THEN REWRITE_TAC[EXP_2] THEN
-  REWRITE_TAC[SYM(REWRITE_CONV[ARITH] `2 * 2`)] THEN
-  REWRITE_TAC[MULT_AC]);;
-
-let ODD_SQUARE = prove(
-  `!n. ODD(n) ==> ?x. n EXP 2 = (4 * x) + 1`,
-  GEN_TAC THEN REWRITE_TAC[ODD_EXISTS] THEN
-  DISCH_THEN(X_CHOOSE_THEN `m:num` SUBST1_TAC) THEN
-  ASM_REWRITE_TAC[EXP_2; MULT_CLAUSES; ADD_CLAUSES] THEN
-  REWRITE_TAC[GSYM ADD1; SUC_INJ] THEN
-  EXISTS_TAC `(m * m) + m` THEN
-  REWRITE_TAC(map num_CONV [`4`; `3`; `2`; `1`]) THEN
-  REWRITE_TAC[ADD_CLAUSES; MULT_CLAUSES] THEN
-  REWRITE_TAC[LEFT_ADD_DISTRIB; RIGHT_ADD_DISTRIB] THEN
-  REWRITE_TAC[ADD_AC]);;
-
-let DIFF_SQUARE = prove(
-  `!x y. (x EXP 2) - (y EXP 2) = (x + y) * (x - y)`,
-  REPEAT GEN_TAC THEN
-  DISJ_CASES_TAC(SPECL [`x:num`; `y:num`] LE_CASES) THENL
-   [SUBGOAL_THEN `(x * x) <= (y * y)` MP_TAC THENL
-     [MATCH_MP_TAC LESS_EQ_MULT THEN ASM_REWRITE_TAC[];
-      POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM SUB_EQ_0] THEN
-      REPEAT DISCH_TAC THEN ASM_REWRITE_TAC[EXP_2; MULT_CLAUSES]];
-    POP_ASSUM(CHOOSE_THEN SUBST1_TAC o REWRITE_RULE[LE_EXISTS]) THEN
-    REWRITE_TAC[ONCE_REWRITE_RULE[ADD_SYM] ADD_SUB] THEN
-    REWRITE_TAC[EXP_2; LEFT_ADD_DISTRIB; RIGHT_ADD_DISTRIB] THEN
-    REWRITE_TAC[GSYM ADD_ASSOC; ONCE_REWRITE_RULE[ADD_SYM] ADD_SUB] THEN
-    AP_TERM_TAC THEN GEN_REWRITE_TAC LAND_CONV [ADD_SYM] THEN
-    AP_TERM_TAC THEN MATCH_ACCEPT_TAC MULT_SYM]);;
-
-let ADD_IMP_SUB = prove(
-  `!x y z. (x + y = z) ==> (x = z - y)`,
-  REPEAT GEN_TAC THEN DISCH_THEN(SUBST1_TAC o SYM) THEN
-  REWRITE_TAC[ADD_SUB]);;
-
-let ADD_SUM_DIFF = prove(
-  `!v w. v <= w ==> ((w + v) - (w - v) = 2 * v) /\
-                    ((w + v) + (w - v) = 2 * w)`,
-  REPEAT GEN_TAC THEN REWRITE_TAC[LE_EXISTS] THEN
-  DISCH_THEN(CHOOSE_THEN SUBST1_TAC) THEN
-  REWRITE_TAC[ONCE_REWRITE_RULE[ADD_SYM] ADD_SUB] THEN
-  REWRITE_TAC[MULT_2; GSYM ADD_ASSOC] THEN
-  ONCE_REWRITE_TAC[ADD_SYM] THEN
-  REWRITE_TAC[ONCE_REWRITE_RULE[ADD_SYM] ADD_SUB; GSYM ADD_ASSOC]);;
-
-let EXP_4 = prove(
-  `!n. n EXP 4 = (n EXP 2) EXP 2`,
-  GEN_TAC THEN REWRITE_TAC[EXP_EXP] THEN
-  REWRITE_TAC[ARITH]);;
diff --git a/hol-light/TacticRecording/gvexport.ml 
b/hol-light/TacticRecording/gvexport.ml
deleted file mode 100644
index 952b3ad90a..0000000000
--- a/hol-light/TacticRecording/gvexport.ml
+++ /dev/null
@@ -1,47 +0,0 @@
-(* ========================================================================== 
*)
-(* GRAPHVIZ EXPORT (HOL LIGHT)                                                
*)
-(* - Exporting recorded tactics into a Dot file for GraphViz                  
*)
-(*                                                                            
*)
-(* By Mark Adams                                                              
*)
-(* Copyright (c) Univeristy of Edinburgh, 2012                                
*)
-(* ========================================================================== 
*)
-
-
-let cluster_count = ref 0;;
-
-let rec print_gv_graphelem d ge =
-  match ge with
-    Box (l,ges)
-       -> let () = (cluster_count := !cluster_count + 1) in
-          (print_indent d; print_string "subgraph cluster";
-             print_int !cluster_count; print_string " "; print_string "{\n";
-           print_indent (d+2); print_string "label = "; print_label l;
-             print_string ";\n";
-           do_list (print_gv_graphelem (d+2)) ges;
-           print_indent d; print_string "}\n")
-  | Line (id1,id2)
-       -> (print_indent d; print_goalid id1; print_string " -> ";
-             print_goalid id2; print_string ";\n")
-  | Single id
-       -> (print_indent d; print_goalid id; print_string ";\n")
-  | Name (id,x)
-       -> (print_indent d; print_goalid id;
-             print_string " [label = "; print_fstring x; print_string "];\n");;
-
-let print_gv_graph ges =
-  let () = (cluster_count := 0) in
-  (print_string "digraph G {\n";
-   do_list (print_gv_graphelem 2) ges;
-   print_string "}\n");;
-
-let print_hiproof_gv_graph h =
-  let h' = (trivsimp_hiproof o rightgroup_hiproof o
-            trivsimp_hiproof o dethen_hiproof) h in
-  let ges = hiproof_graph h' in
-  print_gv_graph ges;;
-
-let print_gtree_gv_proof gtr =
-  let h = gtree_to_hiproof gtr in
-  print_hiproof_gv_graph h;;
-
-let print_gv_proof () = print_gtree_gv_proof !the_goal_tree;;
diff --git a/hol-light/TacticRecording/hiproofs.ml 
b/hol-light/TacticRecording/hiproofs.ml
deleted file mode 100644
index 310ba677c9..0000000000
--- a/hol-light/TacticRecording/hiproofs.ml
+++ /dev/null
@@ -1,417 +0,0 @@
-(* ========================================================================== 
*)
-(* HIPROOFS (HOL LIGHT)                                                       
*)
-(* - Hiproofs and refactoring operations                                      
*)
-(*                                                                            
*)
-(* By Mark Adams                                                              
*)
-(* Copyright (c) Univeristy of Edinburgh, 2012                                
*)
-(* ========================================================================== 
*)
-
-
-(* This file defines a hiproof [1] datatype and various operations on it.     
*)
-(* The datatype closely resembles that proposed in [2], with the notable      
*)
-(* difference that atomic steps carry their arity.                            
*)
-
-(* [1] "Hiproofs: A Hierarchical Notion of Proof Tree", Denney, Power &       
*)
-(*    Tourlas, 2006.                                                          
*)
-(* [2] "A Tactic Language for Hiproofs", Aspinall, Denney & Luth, 2008.       
*)
-
-
-
-(* ** DATATYPE ** *)
-
-
-(* Hiproof datatype *)
-
-(* Note that atomic tactics are labelled with their arity, corresponding to   
*)
-(* how many subgoals they result in.  An arity of -1 indicates unknown, and 0 
*)
-(* indicates a tactic that completes its goal.                                
*)
-
-type hiproof =
-    Hactive of goalid                   (* Active subgoal *)
-  | Hatomic of (goalid * int)           (* Atomic tactic + arity *)
-  | Hidentity of goalid                 (* Null, for wiring *)
-  | Hlabelled of (label * hiproof)      (* Box *)
-  | Hsequence of (hiproof * hiproof)    (* Serial application *)
-  | Htensor of hiproof list             (* Parallel application *)
-  | Hempty;;                            (* Completed goal *)
-
-
-(* Constructors and destructors *)
-
-let hsequence (h1,h2) = Hsequence (h1,h2);;
-
-let dest_hsequence h =
-  match h with
-    Hsequence hh -> hh
-  | _   -> failwith "Not a sequence hiproof";;
-
-let is_hsequence h = can dest_hsequence h;;
-
-let is_hidentity h = match h with Hidentity _ -> true | _ -> false;;
-
-let hiproof_id h =
-  match h with
-    Hactive id | Hatomic (id,_) | Hidentity id -> id
-  | _  -> failwith "hiproof_id: Not a unit hiproof";;
-
-
-(* Arity *)
-
-let rec hiproof_arity h =
-  match h with
-    Hactive _         -> 1
-  | Hatomic (_,n)     -> n
-  | Hidentity _       -> 1
-  | Hlabelled (_,h0)  -> hiproof_arity h0
-  | Hsequence (h1,h2) -> hiproof_arity h2
-  | Htensor hs        -> sum (map hiproof_arity hs)
-  | Hempty            -> 0;;
-
-
-(* Hitrace *)
-
-type hitrace =
-   Hicomment of int list
- | Hiproof of hiproof;;
-
-
-
-(* ** TRANSLATION OF GOAL TREE TO HIPROOF ** *)
-
-
-let rec gtree_to_hiproof gtr =
-  let id = gtree_id gtr in
-  let (_,gtrm) = gtr in
-  match !gtrm with
-    Gactive
-       -> Hactive id
-  | Gexit _
-       -> Hidentity id
-  | Gexecuted (gstp,gtrs)
-       -> let h1 =
-             match gstp with
-               Gatom _ | Gbox (_,_,true)
-                  -> Hatomic (id, length gtrs)
-             | Gbox (l,gtr,false)
-                  -> Hlabelled (l, gtree_to_hiproof gtr) in
-          let h2 = Htensor (map gtree_to_hiproof gtrs) in
-          Hsequence (h1,h2);;
-
-
-
-(* ** REFACTORING OPERATIONS ** *)
-
-
-(* Generic refactoring operation *)
-
-(* Applies a refactoring function 'foo' at every level of hiproof 'h', from   
*)
-(* bottom up.  If the 'r' flag is set then refactoring is repeated bottom up  
*)
-(* whenever 'foo' makes a change.  Note that if 'foo' makes no change then it 
*)
-(* should just return its input hiproof (rather than raise an exception).     
*)
-
-let rec refactor_hiproof r foo h =
-  let h' =
-     match h with
-       Hlabelled (l,h0)
-          -> let h0' = refactor_hiproof r foo h0 in
-             Hlabelled (l,h0')
-     | Hsequence (h1,h2)
-          -> let h1' = refactor_hiproof r foo h1 in
-             let h2' = refactor_hiproof r foo h2 in
-             Hsequence (h1',h2')
-     | Htensor hs
-          -> let hs' = map (refactor_hiproof r foo) hs in 
-             Htensor hs'
-     | _  -> h in
-  let h'' = if (h' = h) then h else h' in
-  let h''' = foo h'' in
-  if r & not (h''' = h'')
-    then refactor_hiproof r foo h'''
-    else h''';;
-
-
-(* Trivial simplification *)
-
-(* Removes basic algebraic identities/zeros.                                  
*)
-
-let collapse_tensor h hs =
-  match h with
-    Hempty      -> hs
-  | Htensor hs0 -> hs0 @ hs
-  | _           -> h :: hs;;
-
-let trivsimp_hiproof h =
-  let trivsimp h =
-     match h with
-       Hatomic (id,_) when (gtree_tactic (get_gtree id) = ("ALL_TAC",[]))
-                                   -> Hidentity id
-     | Hsequence (h1, Hempty)      -> h1
-     | Hsequence (h1, Hidentity _) -> h1
-     | Hsequence (h1, Htensor hs2) -> if (forall is_hidentity hs2)
-                                        then h1
-                                        else h
-     | Hsequence (Hidentity _, h2) -> h2
-     | Hsequence (Htensor hs1, h2) -> if (forall is_hidentity hs1)
-                                        then h2
-                                        else h
-     | Htensor []                  -> Hempty
-     | Htensor [h0]                -> h0
-     | Htensor hs0                 -> Htensor (foldr collapse_tensor hs0 [])
-     | _  -> h in
-  refactor_hiproof true trivsimp h;;
-
-
-(* Matching up two tensored lists to create single tensored list *)
-
-let rec matchup_hiproofs0 hs1 hs2 =
-  match hs1 with
-    [] -> []
-  | h1::hs01
-       -> let n1 = hiproof_arity h1 in
-          let (hs2a,hs2b) = try chop_list n1 hs2
-                with Failure _ ->
-                     if (n1 = -1)
-                       then failwith "matchup_hiproofs: unknown arity"
-                       else failwith "matchup_hiproofs: Internal error - \
-                                                      inconsistent arities" in
-          (h1,hs2a) :: (matchup_hiproofs0 hs01 hs2b);;
-
-let matchup_hiproofs hs1 hs2 =
-  let hhs = matchup_hiproofs0 hs1 hs2 in
-  map (fun (h1,hs2) -> Hsequence (h1, Htensor hs2)) hhs;;
-
-
-(* Separating out tensored list into head tensor and tail tensor  *)
-
-let separate_hiproofs0 h (hs01,hs02) =
-  match h with
-    Hsequence (h1,h2)
-       -> (h1::hs01, h2::hs02)
-  | _  -> let n = hiproof_arity h in
-          let h2 = Htensor (copy n (Hidentity (-1))) in
-          (h::hs01, h2::hs02);;
-
-let separate_hiproofs hs = foldr separate_hiproofs0 hs ([],[]);;
-
-
-(* Delabelling *)
-
-(* Strips out any boxes from the proof.  Note that some boxes, such as        
*)
-(* 'SUBGOAL_THEN', cannot be stripped out without spoiling the proof, and so  
*)
-(* are left alone.                                                            
*)
-
-let delabel_hiproof h =
-  let delabel h =
-     match h with
-       Hlabelled (Tactical ("SUBGOAL_THEN",_), h0)
-          -> h
-     | Hlabelled (_,h0)
-          -> h0
-     | _  -> h in
-  refactor_hiproof true delabel h;;
-
-let dethen_hiproof h =
-  let dethen h =
-     match h with
-       Hlabelled (Tactical (("THEN" | "THENL"),_), h0)
-          -> h0
-     | _  -> h in
-  refactor_hiproof true dethen h;;
-
-
-(* Right-grouping *)
-
-(* Expands the proof into a right-associative sequence, with tensor           
*)
-(* compounding on the right.  Leaves all boxes unchanged.                     
*)
-
-let rightgroup_hiproof h =
-  let rightgroup h =
-     match h with
-       Hsequence (Hsequence (h1, Htensor hs2), Htensor hs3)
-          -> Hsequence (h1, Htensor (matchup_hiproofs hs2 hs3))
-     | Hsequence (Hsequence (h1, Htensor hs2), h3)
-          -> Hsequence (h1, Htensor (matchup_hiproofs hs2 [h3]))
-     | Hsequence (Hsequence (h1,h2), h3)
-          -> Hsequence (h1, Hsequence (h2,h3))
-     | _  -> h in
-  refactor_hiproof true rightgroup h;;
-
-
-(* Left-grouping *)
-
-(* Expands the proof into a left-associative sequence.                        
*)
-
-let leftgroup_hiproof h =
-  let leftgroup h =
-     match h with
-       Hsequence (h1, Hsequence (h2, h3))
-          -> Hsequence (Hsequence (h1,h2), h3)
-     | _  -> h in
-  refactor_hiproof true leftgroup h;;
-
-
-(* THEN insertion *)
-
-(* Looks for opportunities to use 'THEN' tacticals.  Note that assumes a      
*)
-(* normal form where trivsimp has taken place.                                
*)
-
-let rec head_hiproof_equiv h1 h2 =
-  match (h1,h2) with
-    (Hatomic (id1,_), Hatomic (id2,_))
-       -> (gtree_tactic o get_gtree) id1 = (gtree_tactic o get_gtree) id2
-  | (Hidentity _, Hidentity _)
-       -> true
-  | (Hsequence (h1a,h1b), h2)
-       -> head_hiproof_equiv h1a h2
-  | (h1, Hsequence (h2a,h2b))
-       -> head_hiproof_equiv h1 h2a
-  | (Hempty, Hempty)
-       -> true
-  | _  -> false;;
-
-let thenise_hiproof h =
-  let rec thenise h =
-     match h with
-       Hsequence (h1, Htensor (h2::h2s))
-          -> if not (is_hidentity h2) & (forall (head_hiproof_equiv h2) h2s) 
-               then let (hs2a,hs2b) = separate_hiproofs (h2::h2s) in
-                    let h' = Hsequence
-                               (Hlabelled (Tactical ("THEN",[]),
-                                           Hsequence (h1, Htensor hs2a)),
-                                Htensor hs2b) in
-                    thenise h'
-               else h
-     | _  -> h in
-  refactor_hiproof false thenise h;;
-
-
-
-(* ** HIPROOF GRAPH ** *)
-
-
-(* Graph element datatype *)
-
-type graph_elem =
-    Box of (label * graph_elem list)
-  | Line of (goalid * goalid)
-  | Single of goalid
-  | Name of (goalid * string);;
-
-let is_box ge =
-  match ge with Box _ -> true | _ -> false;;
-
-let mk_line id1 id2 = Line (id1,id2);;
-
-let rec graph_elem_nodes ge =
-  match ge with
-    Box (_,ges)    -> graph_nodes ges
-  | Line (id1,id2) -> [id1;id2]
-  | Single id      -> [id]
-  | Name (id,x)    -> [id]
-
-and graph_nodes ges =
-  foldr (fun ge ids -> union (graph_elem_nodes ge) ids) ges [];;
-
-
-(* Utils *)
-
-let rec hiproof_ins h =
-  match h with
-    Hactive id        -> [id]
-  | Hatomic (id,n)    -> [id]
-  | Hidentity id      -> [-1]
-  | Hlabelled (l,h0)  -> hiproof_ins h0
-  | Hsequence (h1,h2) -> hiproof_ins h1
-  | Htensor hs        -> flat (map hiproof_ins hs)
-  | Hempty            -> [];;
-
-let rec hiproof_outs (h:hiproof) : goalid list =
-  match h with
-    Hactive id        -> [id]
-  | Hatomic (id,n)    -> copy n id
-  | Hidentity id      -> [id]
-  | Hlabelled (l,h0)  -> hiproof_outs h0
-  | Hsequence (h1, Htensor hs2)
-       -> let nhs2 = enumerate hs2 in
-          let ids1 = hiproof_outs h1 in
-          let foo (n2,h2) =
-             if (is_hidentity h2) then [el (n2-1) ids1]
-                                  else hiproof_outs h2 in
-          flat (map foo nhs2)
-  | Hsequence (h1,h2) -> hiproof_outs h2
-  | Htensor hs        -> flat (map hiproof_outs hs)
-  | Hempty            -> [];;
-
-
-(* Graph production *)
-
-let rec hiproof_graph0 h =
-  match h with
-    Hactive _      -> []
-  | Hatomic _      -> []
-  | Hidentity _    -> []
-  | Hlabelled (l,Hatomic (id,_))
-       -> [Box (l, [Single id])]
-  | Hlabelled (l,h0)
-       -> [Box (l, hiproof_graph0 h0)]
-  | Hsequence (h1,h2)
-       -> let idids = zip (hiproof_outs h1) (hiproof_ins h2) in
-          let idids' = filter (fun (_,id2) -> (id2 > 0)) idids in
-          (hiproof_graph0 h1) @
-          (map (fun idid -> Line idid) idids') @
-          (hiproof_graph0 h2)
-  | Htensor hs     -> flat (map hiproof_graph0 hs)
-  | Hempty         -> [];;
-
-let hiproof_graph h =
-  let ges = hiproof_graph0 h in
-  let ids = graph_nodes ges in
-  let tacname_of_id id = (fst o gtree_tactic1 o get_gtree) id in
-  let ges' = map (fun id -> Name (id, tacname_of_id id)) ids in
-  ges' @ ges;;
-
-
-
-(* ** OTHER OPERATIONS ** *)
-
-
-(* Tactic trace *)
-
-(* Gives a linear trace of the basic tactics used in the proof, ignoring how  
*)
-(* they were combined by tacticals.                                           
*)
-
-let rec hiproof_tactic_trace0 h =
-  match h with
-    Hactive _
-       -> [active_info]
-  | Hatomic (id, _)
-       -> [gtree_tactic (get_gtree id)]
-  | Hidentity _
-       -> []
-  | Hlabelled (_,h0)
-       -> hiproof_tactic_trace0 h0
-  | Hsequence (h1,h2)
-       -> (hiproof_tactic_trace0 h1) @ (hiproof_tactic_trace0 h2)
-  | Htensor hs
-       -> flat (map hiproof_tactic_trace0 hs)
-  | Hempty
-       -> [];;
-
-let hiproof_tactic_trace h = (hiproof_tactic_trace0 o delabel_hiproof) h;;
-
-
-(* Block trace *)
-
-(* Gives a linear trace of the hiproofs used in the proof, stopping at boxes. 
*)
-
-let rec hiproof_block_trace0 ns0 h =
-  match h with
-  | Hsequence (h1,h2)
-       -> (hiproof_block_trace0 ns0 h1) @ (hiproof_block_trace0 ns0 h2)
-  | Htensor hs
-       -> let nss = map (fun n -> ns0 @ [n]) (1 -- length hs) in
-          flat (map (fun (ns,h) -> (Hicomment ns) :: hiproof_block_trace0 ns h)
-                    (zip nss hs))
-  | _  -> [Hiproof h];;
-
-let hiproof_block_trace h = hiproof_block_trace0 [] h;;
diff --git a/hol-light/TacticRecording/lib.ml b/hol-light/TacticRecording/lib.ml
deleted file mode 100644
index 5de283310c..0000000000
--- a/hol-light/TacticRecording/lib.ml
+++ /dev/null
@@ -1,91 +0,0 @@
-
-let rec copy n x =
-  if (n > 0) then x::(copy (n-1) x)
-             else [];;
-
-
-let rec enumerate0 n xs =
-  match xs with
-    []     -> []
-  | x::xs0 -> (n,x)::enumerate0 (n+1) xs0;;
-let enumerate xs = enumerate0 1 xs;;
-
-
-(* foldr : ('a -> 'b -> 'b) -> 'a list -> 'b -> 'b                            
*)
-
-let rec foldr f xs a =
-  match xs with
-    x1::xs2 -> f x1 (foldr f xs2 a)
-  | []      -> a;;
-
-
-(* foldr1 : ('a -> 'a -> 'a) -> 'a list -> 'a                                 
*)
-
-let rec foldr1 f xs =
-  match xs with
-    x::[]   -> x
-  | x1::xs2 -> f x1 (foldr1 f xs2)
-  | []      -> failwith "foldr1: Empty list";;
-
-
-(* foldl : ('b -> 'a -> 'b) -> 'b -> 'a list -> 'b                            
*)
-
-let rec foldl f a xs =
-  match xs with
-    x1::xs2 -> foldl f (f a x1) xs2
-  | []      -> a;;
-
-
-(* is_empty *)
-
-let is_empty xs =
-  match xs with
-    [] -> true
-  | _  -> false;;
-
-
-(* front *)
-
-let rec front xs =
-  match xs with
-    _::[]   -> []
-  | x0::xs0 -> x0::(front xs0)
-  | []      -> failwith "front: Empty list";;
-
-
-(* string_option *)
-
-let string_option x0 x_ =
-  match x_ with
-    Some x -> x
-  | None   -> x0;;
-
-
-(* print_option *)
-
-let print_option x0 x_ =
-  match x_ with
-    Some x -> print_string x
-  | None   -> print_string x0;;
-
-
-(* seplists *)
-
-let print_seplist p sep xs =
-  if (xs = [])
-    then ()
-    else (p (hd xs);
-          do_list (fun x -> print_string sep; p x) (tl xs));;
-
-let print_string_seplist sep xs =
-  print_seplist print_string sep xs;;
-
-
-(* sum *)
-
-let sum ns = foldl (+) 0 ns;;
-
-
-(* snd_map *)
-
-let snd_map f xys = map (fun (x,y) -> (x, f y)) xys;;
diff --git a/hol-light/TacticRecording/main.ml 
b/hol-light/TacticRecording/main.ml
deleted file mode 100644
index 57c825472b..0000000000
--- a/hol-light/TacticRecording/main.ml
+++ /dev/null
@@ -1,31 +0,0 @@
-(* Library stuff *)
-
-#use "TacticRecording/lib.ml";;
-#use "TacticRecording/dltree.mli";;
-#use "TacticRecording/dltree.ml";;
-
-(* Datatypes and recording mechanism *)
-
-#use "TacticRecording/mldata.ml";;
-#use "TacticRecording/xthm.ml";;
-#use "TacticRecording/xtactics.ml";;
-#use "TacticRecording/tacticrec.ml";;
-#use "TacticRecording/wrappers.ml";;
-
-(* Prooftree support *)
-
-#use "TacticRecording/prooftree.ml";;
-
-(* Hiproofs & refactoring *)
-
-#use "TacticRecording/hiproofs.ml";;
-
-(* Export *)
-
-#use "TacticRecording/printutils.ml";;
-#use "TacticRecording/gvexport.ml";;
-#use "TacticRecording/mlexport.ml";;
-
-(* Overwriting the existing HOL Light objects *)
-
-#use "TacticRecording/promote.ml";;
diff --git a/hol-light/TacticRecording/mldata.ml 
b/hol-light/TacticRecording/mldata.ml
deleted file mode 100644
index b547a89b93..0000000000
--- a/hol-light/TacticRecording/mldata.ml
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-type mlarg =
-   Mlint of int
- | Mlstring of string
- | Mlterm of term
- | Mltype of hol_type
- | Mlthm of mldata
- | Mlpair of mlarg * mlarg
- | Mllist of mlarg list
- | Mlfn of mldata
-
-and mldata = string * mlarg list;;          (* ML object name and args *)
-
-
-type label =
-   Tactical of mldata
- | Label of string;;
-
-
-(* Atomic tests *)
-
-let is_atomic_mlarg arg =
-  match arg with
-    Mlthm (_,(_::_)) | Mlpair _ | Mlfn (_, _::_) -> false
-  | _ -> true;;
-
-let is_atomic_mldata ((x,args):mldata) = (is_empty args);;
-
-
-(* active_info *)
-
-let active_info = ("...",[]);;
diff --git a/hol-light/TacticRecording/mlexport.ml 
b/hol-light/TacticRecording/mlexport.ml
deleted file mode 100644
index 9a9207d528..0000000000
--- a/hol-light/TacticRecording/mlexport.ml
+++ /dev/null
@@ -1,186 +0,0 @@
-(* ========================================================================== 
*)
-(* ML EXPORT (HOL LIGHT)                                                      
*)
-(* - Exporting recorded tactics into a proof script                           
*)
-(*                                                                            
*)
-(* By Mark Adams                                                              
*)
-(* Copyright (c) Univeristy of Edinburgh, 2012                                
*)
-(* ========================================================================== 
*)
-
-
-(* Routines for exporting an ML tactic proof script from the recorded tactic  
*)
-(* proof tree, via a hiproof representation.                                  
*)
-
-
-
-(* ** UTILS ** *)
-
-
-(* Printer for tactic is just the ML data printer *)
-
-let print_tactic br obj = print_mldata br obj;;
-
-
-(* Printer for subgoal comments *)
-
-let print_hicomment_line ns =
-  (print_string "(* *** Subgoal ";
-   print_int (hd ns);
-   do_list (fun n -> print_string "."; print_int n) (tl ns);
-   print_string " *** *)\n");;
-
-
-(* print_tactic_line *)
-
-let print_tactic_line_with pr arg =
-  (print_string "e ("; pr false arg; print_string ");;\n");;
-
-let print_tactic_line obj =
-  (print_tactic_line_with print_tactic obj);;
-
-let print_hitrace_line_with fl pr htr =
-  match htr with
-    Hicomment ns -> if fl then print_hicomment_line ns
-  | Hiproof h    -> print_tactic_line_with pr h;;
-
-
-(* print_hiproof0 *)
-
-(* This is a utility used in exporters, for basic cases not explicitly dealt  
*)
-(* with in the exporter's special cases.  Does not print tacticals, other     
*)
-(* than 'THEN' (for single arity) and 'THENL' (for multi-arity).  Argument    
*)
-(* 'pr' is the printer to be used on subcases.                                
*)
-
-let print_hiproof0 pr br h =
-  match h with
-    Hactive _
-       -> print_string "..."
-  | Hatomic (id,_)
-       -> print_tactic br (gtree_tactic (get_gtree id))
-  | Hidentity _
-       -> print_string "ALL_TAC"
-  | Hlabelled (_,h0)
-       -> pr br h0
-  | Hsequence (h1, Htensor h2s)
-       -> (print_string_if br "(";
-           pr false h1;
-           print_string " THENL [";
-           print_seplist (pr false) "; " h2s;
-           print_string "]";
-           print_string_if br ")")
-  | Hsequence (h1,Hempty)
-       -> (pr br h1)
-  | Hsequence (h1,h2)
-       -> (print_string_if br "(";
-           pr false h1;
-           print_string " THEN ";
-           pr true h2;
-           print_string_if br ")")
-  | Htensor _
-       -> failwith "print_hiproof: Unexpected tensor"
-  | Hempty
-       -> failwith "print_hiproof: Unexpected empty";;
-
-
-(* A basic hiproof printer that just uses 'print_hiproof0'.                   
*)
-
-let rec print_hiproof1 br h = print_hiproof0 print_hiproof1 br h;;
-
-
-(* print_hiproof2 *)
-
-let rec print_hiproof2 br h =
-  match h with
-    Hlabelled (Tactical ("REPEAT", _), Hsequence (h1,h2)) (* if repeated *)
-       -> (print_string_if br "(";
-           print_string "REPEAT ";
-           print_hiproof2 true h1;
-           print_string_if br ")")
-  | Hlabelled (Tactical ("THEN", _),                     (* if tac2 used *)
-               Hsequence (h1, Htensor (h2::h2s)))
-       -> (print_string_if br "(";
-           print_hiproof2 false h1;
-           print_string " THEN ";
-           print_hiproof2 true h2;
-           print_string_if br ")")
-  | Hlabelled (Tactical (("SUBGOAL_THEN",                (* special case *)
-                         (Mlterm tm)::[_]) as obj),
-               _)
-       -> (print_tactic br obj)
-  | Hlabelled (Label x, h)
-       -> (print_string_if br "(";
-           print_string "HILABEL ";
-           print_fstring x; print_string " ";
-           print_hiproof2 true h;
-           print_string_if br ")")
-  | _  -> (print_hiproof0 print_hiproof2 br h);;
-
-
-
-(* ** PRINTERS ** *)
-
-
-(* Executed proof *)
-
-(* Prints proof according to how it was executed, i.e. using the original e-  
*)
-(* steps and according to any user-supplied 'REPEAT' and 'THEN' tacticals,    
*)
-(* but only those parts that actually execute and not according to any other  
*)
-(* tacticals.                                                                 
*)
-
-let print_hiproof_executed_proof fl h =
-  let h' = trivsimp_hiproof h in
-  let htrs' = hiproof_block_trace h' in
-  do_list (print_hitrace_line_with fl print_hiproof2) htrs';;
-
-let print_gtree_executed_proof fl gtr =
-  (print_hiproof_executed_proof fl o gtree_to_hiproof) gtr;;
-
-let print_executed_proof fl = print_gtree_executed_proof fl !the_goal_tree;;
-
-
-(* Packaged proof *)
-
-(* Prints proof as a monolithic step, spotting opportunities for 'REPEAT' and 
*)
-(* multi-arity 'THEN' tacticals in addition to those already in proof.        
*)
-(* ! 'REPEAT' not currently catered for.                                      
*)
-
-let print_hiproof_packaged_proof h =
-  let h' = (trivsimp_hiproof o thenise_hiproof o
-            trivsimp_hiproof o leftgroup_hiproof) h in
-  print_tactic_line_with print_hiproof2 h';;
-
-let print_gtree_packaged_proof gtr =
-  (print_hiproof_packaged_proof o gtree_to_hiproof) gtr;;
-
-let print_packaged_proof () = print_gtree_packaged_proof !the_goal_tree;;
-
-
-(* THENL proof *)
-
-(* Prints proof as a naive monolithic step, using 'THEN' for single arity,    
*)
-(* and 'THENL' for multi-arity (even if each subgoal has the same proof).     
*)
-(* This gives the full structure of each tactic execution.                    
*)
-
-let print_hiproof_thenl_proof h =
-  let h' = (trivsimp_hiproof o delabel_hiproof) h in
-  print_tactic_line_with print_hiproof1 h';;
-
-let print_gtree_thenl_proof gtr =
-  (print_hiproof_thenl_proof o gtree_to_hiproof) gtr;;
-
-let print_thenl_proof () = print_gtree_thenl_proof !the_goal_tree;;
-
-
-(* Flat proof *)
-
-(* This exports a proof as a flat series of e-steps, with no tacticals.       
*)
-
-let print_hiproof_flat_proof fl h =
-  let h' = (trivsimp_hiproof o rightgroup_hiproof o trivsimp_hiproof o
-            delabel_hiproof) h in
-  let htrs' = hiproof_block_trace h' in
-  do_list (print_hitrace_line_with fl print_hiproof2) htrs';;
-
-let print_gtree_flat_proof fl gtr =
-  (print_hiproof_flat_proof fl o gtree_to_hiproof) gtr;;
-
-let print_flat_proof fl = print_gtree_flat_proof fl !the_goal_tree;;
diff --git a/hol-light/TacticRecording/printutils.ml 
b/hol-light/TacticRecording/printutils.ml
deleted file mode 100644
index aa74ee2222..0000000000
--- a/hol-light/TacticRecording/printutils.ml
+++ /dev/null
@@ -1,61 +0,0 @@
-(* ========================================================================== 
*)
-(* PRINTER UTILITIES (HOL LIGHT)                                              
*)
-(* - Various basic utilities used in writing the exporters                    
*)
-(*                                                                            
*)
-(* By Mark Adams                                                              
*)
-(* Copyright (c) Univeristy of Edinburgh, 2012                                
*)
-(* ========================================================================== 
*)
-
-
-(* Basics *)
-
-let print_string_if b x = if b then print_string x;;
-
-let print_fstring x = print_string ("\"" ^ String.escaped x ^ "\"");;
-
-let print_fterm tm = print_string ("`" ^ string_of_term tm ^ "`");;
-
-let print_ftype ty = print_string ("`" ^ string_of_type ty ^ "`");;
-
-let print_goalid id = print_int id;;
-
-let print_indent d = print_string (String.make d ' ');;
-
-
-(* Printer for 'mldata' *)
-
-let rec print_mlarg br arg =
-  match arg with
-    Mlint n       -> print_int n
-  | Mlstring x    -> print_fstring x
-  | Mlterm tm     -> print_fterm tm
-  | Mltype ty     -> print_ftype ty
-  | Mlthm prf     -> print_mldata br prf
-  | Mlpair (arg1,arg2)
-       -> let sep =
-             if (forall is_atomic_mlarg [arg1;arg2]) then "," else ", " in
-          (print_string_if br "(";
-           print_mlarg false arg1;
-           print_string sep;
-           print_mlarg false arg2;
-           print_string_if br ")")
-  | Mllist args 
-       -> let sep = if (forall is_atomic_mlarg args) then ";" else "; " in
-          (print_string "[";
-           print_seplist (print_mlarg false) sep args;
-           print_string "]")
-  | Mlfn f
-       -> (print_mldata br f)
-
-and print_mldata br ((x,args):mldata) =
-  (print_string_if (br & not (is_empty args)) "(";
-   print_string x;
-   do_list (fun arg -> print_string " "; print_mlarg true arg) args;
-   print_string_if (br & not (is_empty args)) ")");;
-
-
-(* Printer for labels *)
-
-let print_label l =
-  match l with
-    Tactical (x,_) | Label x  -> print_fstring x;;
diff --git a/hol-light/TacticRecording/promote.ml 
b/hol-light/TacticRecording/promote.ml
deleted file mode 100644
index c19abb8a58..0000000000
--- a/hol-light/TacticRecording/promote.ml
+++ /dev/null
@@ -1,327 +0,0 @@
-(* ========================================================================== 
*)
-(* PROMOTTION (HOL LIGHT)                                                     
*)
-(* - Overwrites original HOL Light tactics/etc with xgoal/xthm versions       
*)
-(*                                                                            
*)
-(* By Mark Adams                                                              
*)
-(* Copyright (c) Univeristy of Edinburgh, 2012                                
*)
-(* ========================================================================== 
*)
-
-
-
-(* ** TACTICS.ML ** *)
-
-
-(* Tactics *)
-
-(* Atomic tactics can be automatically promoted to deal with xgoals and       
*)
-(* recording.                                                                 
*)
-
-let NO_TAC = tactic_wrap "NO_TAC" NO_TAC;;
-let ALL_TAC = tactic_wrap "ALL_TAC" ALL_TAC;;
-
-let LABEL_TAC = stringthm_tactic_wrap "LABEL_TAC" LABEL_TAC;;
-let ASSUME_TAC = thm_tactic_wrap "ASSUME_TAC" ASSUME_TAC;;
-
-let ACCEPT_TAC = thm_tactic_wrap "ACCEPT_TAC" ACCEPT_TAC;;
-
-let CONV_TAC = conv_tactic_wrap "CONV_TAC" CONV_TAC;;
-
-let REFL_TAC = tactic_wrap "REFL_TAC" REFL_TAC;;
-let ABS_TAC = tactic_wrap "ABS_TAC" ABS_TAC;;
-let MK_COMB_TAC = tactic_wrap "MK_COMB_TAC" MK_COMB_TAC;;
-let AP_TERM_TAC = tactic_wrap "AP_TERM_TAC" AP_TERM_TAC;;
-let AP_THM_TAC = tactic_wrap "AP_THM_TAC" AP_THM_TAC;;
-let BINOP_TAC = tactic_wrap "BINOP_TAC" BINOP_TAC;;
-let SUBST1_TAC = thm_tactic_wrap "SUBST1_TAC" SUBST1_TAC;;
-let SUBST_ALL_TAC = thm_tactic_wrap "SUBST_ALL_TAC" SUBST_ALL_TAC;;
-let BETA_TAC = tactic_wrap "BETA_TAC" BETA_TAC;;
-
-let SUBST_VAR_TAC = thm_tactic_wrap "SUBST_VAR_TAC" SUBST_VAR_TAC;;
-
-let DISCH_TAC = tactic_wrap "DISCH_TAC" DISCH_TAC;;
-let MP_TAC = thm_tactic_wrap "MP_TAC" MP_TAC;;
-let EQ_TAC = tactic_wrap "EQ_TAC" EQ_TAC;;
-let UNDISCH_TAC = term_tactic_wrap "UNDISCH_TAC" UNDISCH_TAC;;
-let SPEC_TAC = termpair_tactic_wrap "SPEC_TAC" SPEC_TAC;;
-let X_GEN_TAC = term_tactic_wrap "X_GEN_TAC" X_GEN_TAC;;
-let GEN_TAC = tactic_wrap "GEN_TAC" GEN_TAC;;
-let EXISTS_TAC = term_tactic_wrap "EXISTS_TAC" EXISTS_TAC;;
-let CHOOSE_TAC = thm_tactic_wrap "CHOOSE_TAC" CHOOSE_TAC;;
-let CONJ_TAC = tactic_wrap "CONJ_TAC" CONJ_TAC;;
-let DISJ1_TAC = tactic_wrap "DISJ1_TAC" DISJ1_TAC;;
-let DISJ2_TAC = tactic_wrap "DISJ2_TAC" DISJ2_TAC;;
-let DISJ_CASES_TAC = thm_tactic_wrap "DISJ_CASES_TAC" DISJ_CASES_TAC;;
-let CONTR_TAC = thm_tactic_wrap "CONTR_TAC" CONTR_TAC;;
-let MATCH_ACCEPT_TAC = thm_tactic_wrap "MATCH_ACCEPT_TAC" MATCH_ACCEPT_TAC;;
-let MATCH_MP_TAC = thm_tactic_wrap "MATCH_MP_TAC" MATCH_MP_TAC;;
-
-let STRIP_ASSUME_TAC = thm_tactic_wrap "STRIP_ASSUME_TAC" STRIP_ASSUME_TAC;;
-let STRUCT_CASES_TAC = thm_tactic_wrap "STRUCT_CASES_TAC" STRUCT_CASES_TAC;;
-let STRIP_TAC = tactic_wrap "STRIP_TAC" STRIP_TAC;;
-
-let X_META_EXISTS_TAC = term_tactic_wrap "X_META_EXISTS_TAC" 
X_META_EXISTS_TAC;;
-let META_EXISTS_TAC = tactic_wrap "META_EXISTS_TAC" META_EXISTS_TAC;;
-
-let ANTS_TAC = tactic_wrap "ANTS_TAC" ANTS_TAC;;
-
-
-(* Special cases, already fully hand-promoted *)
-
-let SUBGOAL_THEN = xSUBGOAL_THEN;;
-
-
-(* Tacticals *)
-
-(* Tacticals need to be hand-promoted to deal with xgoals, but this is        
*)
-(* trivial and is done in 'xtactics.ml'.  They are further promoted here to   
*)
-(* get recorded as boxes, using the tactical-wrap functions.                  
*)
-
-let (THEN) = btactical_wrap "THEN" (xTHEN);;
-let (THENL) = btactical_wrap "THENL" (xTHENL);;
-let (ORELSE) = btactical_wrap "ORELSE" (xORELSE);;
-let TRY = tactical_wrap "TRY" xTRY;;
-let REPEAT = tactical_wrap "REPEAT" xREPEAT;;
-let EVERY = tactical_wrap "EVERY" xEVERY;;
-let FIRST = tactical_wrap "FIRST" xFIRST;;
-let MAP_EVERY = list_tactical_wrap "MAP_EVERY" xMAP_EVERY;;
-let MAP_FIRST = list_tactical_wrap "MAP_FIRST" xMAP_FIRST;;
-let CHANGED_TAC = tactical_wrap "CHANGED_TAC" xCHANGED_TAC;;
-let REPLICATE_TAC = int_tactical_wrap "REPLICATE_TAC" xREPLICATE_TAC;;
-
-
-(* Subgoal commands *)
-
-let e = xe;;
-let r = xr;;
-let set_goal = xset_goal;;
-let g = xg;;
-let b = xb;;
-let p = xp;;
-let top_goal = xtop_goal;;
-let top_thm = xtop_thm;;
-
-let prove = xprove;;
-
-
-
-(* ** COMMON HOL API ** *)
-
-
-(* Rules *)
-
-let ADD_ASSUM = term_rule_wrap "ADD_ASSUM" ADD_ASSUM;;
-let ASSUME = conv_wrap "ASSUME" ASSUME;;
-let BETA_CONV = conv_wrap "BETA_CONV" BETA_CONV;;
-let CCONTR = term_rule_wrap "CCONTR" CCONTR;;
-let CHOOSE = termthmpair_rule_wrap "CHOOSE" CHOOSE;;
-let CONJ = drule_wrap "CONJ" CONJ;;
-let CONJUNCT1 = rule_wrap "CONJUNCT1" CONJUNCT1;;
-let CONJUNCT2 = rule_wrap "CONJUNCT2" CONJUNCT2;;
-let CONTR = term_rule_wrap "CONTR" CONTR;;
-let DEDUCT_ANTISYM_RULE = drule_wrap "DEDUCT_ANTISYM_RULE" 
DEDUCT_ANTISYM_RULE;;
-let DISCH = term_rule_wrap "DISCH" DISCH;;
-let DISJ1 = thm_conv_wrap "DISJ1" DISJ1;;
-let DISJ2 = term_rule_wrap "DISJ2" DISJ2;;
-let DISJ_CASES = trule_wrap "DISJ_CASES" DISJ_CASES;;
-let EQ_MP = drule_wrap "EQ_MP" EQ_MP;;
-let EQF_INTRO = rule_wrap "EQF_INTRO" EQF_INTRO;;
-let EQF_ELIM = rule_wrap "EQF_ELIM" EQF_ELIM;;
-let EQT_INTRO = rule_wrap "EQT_INTRO" EQT_INTRO;;
-let EQT_ELIM = rule_wrap "EQT_ELIM" EQT_ELIM;;
-let ETA_CONV = conv_wrap "ETA_CONV" ETA_CONV;;
-let EXISTS = termpair_rule_wrap "EXISTS" EXISTS;;
-let GEN = term_rule_wrap "GEN" GEN;;
-let GENL = termlist_rule_wrap "GENL" GENL;;
-let IMP_ANTISYM_RULE = drule_wrap "IMP_ANTISYM_RULE" IMP_ANTISYM_RULE;;
-let IMP_TRANS = drule_wrap "IMP_TRANS" IMP_TRANS;;
-let INST = terminst_rule_wrap "INST" INST;;
-let INST_TYPE = typeinst_rule_wrap "INST_TYPE" INST_TYPE;;
-let MP = drule_wrap "MP" MP;;
-let NOT_ELIM = rule_wrap "NOT_ELIM" NOT_ELIM;;
-let NOT_INTRO = rule_wrap "NOT_INTRO" NOT_INTRO;;
-let PROVE_HYP = drule_wrap "PROVE_HYP" PROVE_HYP;;
-let REFL = conv_wrap "REFL" REFL;;
-let SELECT_RULE = rule_wrap "SELECT_RULE" SELECT_RULE;;
-let SPEC = term_rule_wrap "SPEC" SPEC;;
-let SPECL = termlist_rule_wrap "SPECL" SPECL;;
-let SUBS = thmlist_rule_wrap "SUBS" SUBS;;
-let SUBS_CONV = thmlist_conv_wrap "SUBS_CONV" SUBS_CONV;;
-let SYM = rule_wrap "SYM" SYM;;
-let SYM_CONV = conv_wrap "SYM_CONV" SYM_CONV;;
-let TRANS = drule_wrap "TRANS" TRANS;;
-let UNDISCH = rule_wrap "UNDISCH" UNDISCH;;
-
-let ABS = term_rule_wrap "ABS" ABS;;
-let MK_COMB = prule_wrap "MK_COMB" MK_COMB;;
-let AP_THM = thm_conv_wrap "AP_THM" AP_THM;;
-let AP_TERM = term_rule_wrap "AP_TERM" AP_TERM;;
-
-let NUM_SUC_CONV = conv_wrap "NUM_SUC_CONV" NUM_SUC_CONV;;
-let NUM_PRE_CONV = conv_wrap "NUM_PRE_CONV" NUM_PRE_CONV;;
-let NUM_ADD_CONV = conv_wrap "NUM_ADD_CONV" NUM_ADD_CONV;;
-let NUM_SUB_CONV = conv_wrap "NUM_SUB_CONV" NUM_SUB_CONV;;
-let NUM_MULT_CONV = conv_wrap "NUM_MULT_CONV" NUM_MULT_CONV;;
-let NUM_EXP_CONV = conv_wrap "NUM_EXP_CONV" NUM_EXP_CONV;;
-let NUM_EQ_CONV = conv_wrap "NUM_EQ_CONV" NUM_EQ_CONV;;
-let NUM_LT_CONV = conv_wrap "NUM_LT_CONV" NUM_LT_CONV;;
-let NUM_LE_CONV = conv_wrap "NUM_LE_CONV" NUM_LE_CONV;;
-let NUM_GT_CONV = conv_wrap "NUM_GT_CONV" NUM_GT_CONV;;
-let NUM_EVEN_CONV = conv_wrap "NUM_EVEN_CONV" NUM_EVEN_CONV;;
-let NUM_ODD_CONV = conv_wrap "NUM_ODD_CONV" NUM_ODD_CONV;;
-
-
-(* Theorems *)
-
-let ETA_AX = theorem_wrap "ETA_AX" ETA_AX;;
-let INFINITY_AX = theorem_wrap "INFINITY_AX" INFINITY_AX;;
-let BOOL_CASES_AX = theorem_wrap "BOOL_CASES_AX" BOOL_CASES_AX;;
-let SELECT_AX = theorem_wrap "SELECT_AX" SELECT_AX;;
-let TRUTH = theorem_wrap "TRUTH" TRUTH;;
-let EXCLUDED_MIDDLE = theorem_wrap "EXCLUDED_MIDDLE" EXCLUDED_MIDDLE;;
-
-let PAIR_EQ = theorem_wrap "PAIR_EQ" PAIR_EQ;;
-let PAIR_SURJECTIVE = theorem_wrap "PAIR_SURJECTIVE" PAIR_SURJECTIVE;;
-let FST = theorem_wrap "FST" FST;;
-let SND = theorem_wrap "SND" SND;;
-
-let IND_SUC_0 = theorem_wrap "IND_SUC_0" IND_SUC_0;;
-let IND_SUC_INJ = theorem_wrap "IND_SUC_INJ" IND_SUC_INJ;;
-
-let NOT_SUC = theorem_wrap "NOT_SUC" NOT_SUC;;
-let SUC_INJ = theorem_wrap "SUC_INJ" SUC_INJ;;
-let num_INDUCTION = theorem_wrap "num_INDUCTION" num_INDUCTION;;
-let num_CASES = theorem_wrap "num_CASES" num_CASES;;
-let num_RECURSION = theorem_wrap "num_RECURSION" num_RECURSION;;
-let PRE = theorem_wrap "PRE" PRE;;
-let ADD = theorem_wrap "ADD" ADD;;
-let SUB = theorem_wrap "SUB" SUB;;
-let MULT = theorem_wrap "MULT" MULT;;
-let EXP = theorem_wrap "EXP" EXP;;
-let LT = theorem_wrap "LT" LT;;
-let LE = theorem_wrap "LE" LE;;
-let GT = theorem_wrap "GT" GT;;
-let GE = theorem_wrap "GE" GE;;
-let EVEN = theorem_wrap "EVEN" EVEN;;
-let ODD = theorem_wrap "ODD" ODD;;
-
-
-
-(* ** OTHER HOL LIGHT ** *)
-
-
-(* More tactics *)
-
-let REWRITE_TAC = thmlist_tactic_wrap "REWRITE_TAC" REWRITE_TAC;;
-let PURE_REWRITE_TAC = thmlist_tactic_wrap "PURE_REWRITE_TAC" 
PURE_REWRITE_TAC;;
-let ONCE_REWRITE_TAC = thmlist_tactic_wrap "ONCE_REWRITE_TAC" 
ONCE_REWRITE_TAC;;
-let ASM_REWRITE_TAC = thmlist_tactic_wrap "ASM_REWRITE_TAC" ASM_REWRITE_TAC;;
-let PURE_ASM_REWRITE_TAC =
-        thmlist_tactic_wrap "PURE_ASM_REWRITE_TAC" PURE_ASM_REWRITE_TAC;;
-let ONCE_ASM_REWRITE_TAC =
-        thmlist_tactic_wrap "ONCE_ASM_REWRITE_TAC" ONCE_ASM_REWRITE_TAC;;
-let GEN_REWRITE_TAC =
-        convconvthmlist_tactic_wrap "GEN_REWRITE_TAC" GEN_REWRITE_TAC;;
-let SIMP_TAC = thmlist_tactic_wrap "SIMP_TAC" SIMP_TAC;;
-let PURE_SIMP_TAC = thmlist_tactic_wrap "PURE_SIMP_TAC" PURE_SIMP_TAC;;
-let ONCE_SIMP_TAC = thmlist_tactic_wrap "ONCE_SIMP_TAC" ONCE_SIMP_TAC;;
-let ASM_SIMP_TAC = thmlist_tactic_wrap "ASM_SIMP_TAC" ASM_SIMP_TAC;;
-let PURE_ASM_SIMP_TAC =
-        thmlist_tactic_wrap "PURE_ASM_SIMP_TAC" PURE_ASM_SIMP_TAC;;
-let ONCE_ASM_SIMP_TAC =
-        thmlist_tactic_wrap "ONCE_ASM_SIMP_TAC" ONCE_ASM_SIMP_TAC;;
-let ABBREV_TAC = term_tactic_wrap "ABBREV_TAC" ABBREV_TAC;;
-let EXPAND_TAC = string_tactic_wrap "EXPAND_TAC" EXPAND_TAC;;
-
-let ASM_CASES_TAC = term_tactic_wrap "ASM_CASES_TAC" ASM_CASES_TAC;;
-let COND_CASES_TAC = tactic_wrap "COND_CASES_TAC" COND_CASES_TAC;;
-
-let ARITH_TAC = tactic_wrap "ARITH_TAC" ARITH_TAC;;
-let INDUCT_TAC = tactic_wrap "INDUCT_TAC" INDUCT_TAC;;
-
-let REAL_ARITH_TAC = tactic_wrap "REAL_ARITH_TAC" REAL_ARITH_TAC;;
-let ASM_REAL_ARITH_TAC = tactic_wrap "ASM_REAL_ARITH_TAC" ASM_REAL_ARITH_TAC;;
-
-
-(* More rules *)
-
-let RATOR_CONV = conv_conv_wrap "RATOR_CONV" RATOR_CONV;;
-let RAND_CONV = conv_conv_wrap "RAND_CONV" RAND_CONV;;
-let LAND_CONV = conv_conv_wrap "LAND_CONV" LAND_CONV;;
-let ABS_CONV = conv_conv_wrap "ABS_CONV" ABS_CONV;;
-let BINDER_CONV = conv_conv_wrap "BINDER_CONV" BINDER_CONV;;
-let SUB_CONV = conv_conv_wrap "SUB_CONV" SUB_CONV;;
-let BINOP_CONV = conv_conv_wrap "BINOP_CONV" BINOP_CONV;;
-let GSYM = rule_wrap "GSYM" GSYM;;
-let CONJUNCTS = multirule_wrap "CONJUNCTS" CONJUNCTS;;
-let SPEC_ALL = rule_wrap "SPEC_ALL" SPEC_ALL;;
-let ISPECL = termlist_rule_wrap "ISPECL" ISPECL;;
-let ALL_CONV = conv_wrap "ALL_CONV" ALL_CONV;;
-let (REPEATC) = conv_conv_wrap "REPEATC" REPEATC;;
-let ONCE_DEPTH_CONV = conv_conv_wrap "ONCE_DEPTH_CONV" ONCE_DEPTH_CONV;;
-
-let REWRITE_RULE = thmlist_rule_wrap "REWRITE_RULE" REWRITE_RULE;;
-
-let num_CONV = conv_wrap "num_CONV" num_CONV;;
-let ARITH_RULE = conv_wrap "ARITH_RULE" ARITH_RULE;;
-
-let REAL_ARITH = conv_wrap "REAL_ARITH" REAL_ARITH;;
-let REAL_FIELD = conv_wrap "REAL_FIELD" REAL_FIELD;;
-
-
-(* More theorems *)
-
-let CONJ_ASSOC = theorem_wrap "CONJ_ASSOC" CONJ_ASSOC;;
-let IMP_IMP = theorem_wrap "IMP_IMP" IMP_IMP;;
-let EQ_IMP = theorem_wrap "EQ_IMP" EQ_IMP;;
-
-let ARITH = theorem_wrap "ARITH" ARITH;;
-let ARITH_EQ = theorem_wrap "ARITH_EQ" ARITH_EQ;;
-let ADD_ASSOC = theorem_wrap "ADD_ASSOC" ADD_ASSOC;;
-let ADD_CLAUSES = theorem_wrap "ADD_CLAUSES" ADD_CLAUSES;;
-let LEFT_ADD_DISTRIB = theorem_wrap "LEFT_ADD_DISTRIB" LEFT_ADD_DISTRIB;;
-let RIGHT_ADD_DISTRIB = theorem_wrap "RIGHT_ADD_DISTRIB" RIGHT_ADD_DISTRIB;;
-let MULT_CLAUSES =theorem_wrap "MULT_CLAUSES" MULT_CLAUSES;;
-let SUB_REFL = theorem_wrap "SUB_REFL" SUB_REFL;;
-let ADD1 =  theorem_wrap "ADD1" ADD1;;
-let EQ_MULT_LCANCEL = theorem_wrap "EQ_MULT_LCANCEL" EQ_MULT_LCANCEL;;
-let LE_EXISTS = theorem_wrap "LE_EXISTS" LE_EXISTS;;
-let LE_ADD = theorem_wrap "LE_ADD" LE_ADD;;
-let LE_1 = theorem_wrap "LE_1" LE_1;;
-let LE_REFL = theorem_wrap "LE_REFL" LE_REFL;;
-let LT_SUC = theorem_wrap "LT_SUC" LT_SUC;;
-let LT_EXISTS = theorem_wrap "LT_EXISTS" LT_EXISTS;;
-let LT_NZ = theorem_wrap "LT_NZ" LT_NZ;;
-let EXP_EQ_0 = theorem_wrap "EXP_EQ_0" EXP_EQ_0;;
-let FACT = theorem_wrap "FACT" FACT;;
-let  = theorem_wrap "" ;;
-
-let REAL_ADD_LDISTRIB = theorem_wrap "REAL_ADD_LDISTRIB" REAL_ADD_LDISTRIB;;
-let REAL_OF_NUM_ADD = theorem_wrap "REAL_OF_NUM_ADD" REAL_OF_NUM_ADD;;
-let REAL_OF_NUM_EQ = theorem_wrap "REAL_OF_NUM_EQ" REAL_OF_NUM_EQ;;
-let REAL_OF_NUM_SUC = theorem_wrap "REAL_OF_NUM_SUC" REAL_OF_NUM_SUC;;
-let REAL_MUL_ASSOC = theorem_wrap "REAL_MUL_ASSOC" REAL_MUL_ASSOC;;
-let REAL_MUL_SYM = theorem_wrap "REAL_MUL_SYM" REAL_MUL_SYM;;
-let REAL_MUL_RID = theorem_wrap "REAL_MUL_RID" REAL_MUL_RID;;
-let REAL_MUL_RZERO = theorem_wrap "REAL_MUL_RZERO" REAL_MUL_RZERO;;
-let REAL_DIV_LMUL = theorem_wrap "REAL_DIV_LMUL" REAL_DIV_LMUL;;
-let REAL_POS = theorem_wrap "REAL_POS" REAL_POS;;
-let REAL_LE_TRANS = theorem_wrap "REAL_LE_TRANS" REAL_LE_TRANS;;
-let REAL_LE_MUL = theorem_wrap "REAL_LE_MUL" REAL_LE_MUL;;
-let REAL_LE_RMUL = theorem_wrap "REAL_LE_RMUL" REAL_LE_RMUL;;
-let REAL_LE_DIV = theorem_wrap "REAL_LE_DIV" REAL_LE_DIV;;
-let REAL_LE_SQUARE = theorem_wrap "REAL_LE_SQUARE" REAL_LE_SQUARE;;
-let REAL_LE_RDIV_EQ = theorem_wrap "REAL_LE_RDIV_EQ" REAL_LE_RDIV_EQ;;
-let real_pow = theorem_wrap "real_pow" real_pow;;
-let REAL_POW_2 = theorem_wrap "REAL_POW_2" REAL_POW_2;;
-let REAL_POW_ZERO = theorem_wrap "REAL_POW_ZERO" REAL_POW_ZERO;;
-let REAL_POW_ADD = theorem_wrap "REAL_POW_ADD" REAL_POW_ADD;;
-let REAL_POW_DIV = theorem_wrap "REAL_POW_DIV" REAL_POW_DIV;;
-let REAL_POW_LE = theorem_wrap "REAL_POW_LE" REAL_POW_LE;;
-let REAL_POW_LT = theorem_wrap "REAL_POW_LT" REAL_POW_LT;;
-let SUM_RMUL = theorem_wrap "SUM_RMUL" SUM_RMUL;;
-let SUM_ADD_SPLIT = theorem_wrap "SUM_ADD_SPLIT" SUM_ADD_SPLIT;;
-let SUM_POS_LE_NUMSEG = theorem_wrap "SUM_POS_LE_NUMSEG" SUM_POS_LE_NUMSEG;;
-let SUM_CLAUSES_NUMSEG = theorem_wrap "SUM_CLAUSES_NUMSEG" SUM_CLAUSES_NUMSEG;;
-let SUM_SING_NUMSEG = theorem_wrap "SUM_SING_NUMSEG" SUM_SING_NUMSEG;;
-let PRODUCT_CLAUSES_NUMSEG =
-   theorem_wrap "PRODUCT_CLAUSES_NUMSEG" PRODUCT_CLAUSES_NUMSEG;;
\ No newline at end of file
diff --git a/hol-light/TacticRecording/prooftree.ml 
b/hol-light/TacticRecording/prooftree.ml
deleted file mode 100644
index 877e738c27..0000000000
--- a/hol-light/TacticRecording/prooftree.ml
+++ /dev/null
@@ -1,177 +0,0 @@
-(* ========================================================================= *)
-(* HOL Light subgoal package amended for Proof General's Prooftree.          *)
-(*                                                                           *)
-(*       Mark Adams, School of Informatics, University of Edinburgh          *)
-(*                                                                           *)
-(* (c) Copyright, University of Edinburgh, 2012                              *)
-(* ========================================================================= *)
-
-(* This file provides alternatives to HOL Light's subgoal package commands   *)
-(* that output additional annotations specifically for Prooftree.  These     *)
-(* annotations get intercepted by Proof General, which removes them from the *)
-(* output displayed to the Proof General user.  Annotation can be switched   *)
-(* off completely with the 'pg_mode_off' command.                            *)
-
-(* Note that this assumes the existence of xgoals (see 'xtactics.ml').       *)
-
-(* ------------------------------------------------------------------------- *)
-(* Proof General mode, for providing extra annotations for Prooftree.        *)
-(* ------------------------------------------------------------------------- *)
-
-let pg_mode = ref (false : bool);;
-
-let pg_mode_on () = (pg_mode := true);;
-let pg_mode_off () = (pg_mode := false);;
-
-let get_pg_mode () = !pg_mode;;
-
-(* ------------------------------------------------------------------------- *)
-(* The Prooftree global state is an ever increasing counter.                 *)
-(* ------------------------------------------------------------------------- *)
-
-let the_pt_global_state = ref 1;;
-
-let inc_pt_global_state () =
-  (the_pt_global_state := !the_pt_global_state + 1);;
-
-let pt_global_state () = !the_pt_global_state;;
-
-(* ------------------------------------------------------------------------- *)
-(* The Prooftree proof state is the length of the goal stack.                *)
-(* ------------------------------------------------------------------------- *)
-
-let pt_proof_state () = length !current_xgoalstack;;
-
-let pt_back_to_proof_state n : xgoalstack =
-  let pst = pt_proof_state () in
-  if (0 <= n) & (n <= pst)
-    then (current_xgoalstack :=
-               snd (chop_list (pst-n) !current_xgoalstack);
-          !current_xgoalstack)
-    else failwith "Not a valid Prooftree state number";;
-
-(* ------------------------------------------------------------------------- *)
-(* Subgoal package commands adjusted to update Prooftree global state.       *)
-(* ------------------------------------------------------------------------- *)
-
-let the_tactic_flag = ref false;;
-
-let xe tac =
-  let result = xe tac in
-  (inc_pt_global_state ();
-   the_tactic_flag := true;      (* So that special info gets displayed *)
-   result);;
-
-let xr n =
-  let result = xr n in
-  (inc_pt_global_state ();
-   result);;
-
-let xset_goal (asl,w) =
-  let result = xset_goal (asl,w) in
-  (inc_pt_global_state ();
-   result);;
-
-let xg t =
-  let fvs = sort (<) (map (fst o dest_var) (frees t)) in
-  (if fvs <> [] then
-     let errmsg = end_itlist (fun s t -> s^", "^t) fvs in
-     warn true ("Free variables in goal: "^errmsg)
-   else ());
-   xset_goal([],t);;
-
-let xb () =
-  let result = xb () in
-  (inc_pt_global_state ();
-   result);;
-
-(* ------------------------------------------------------------------------- *)
-(* Special Prooftree printers for xgoals and xgoalstacks.                    *)
-(* ------------------------------------------------------------------------- *)
-
-let the_new_goal_ids = ref ([] : goalid list);;
-
-let print_prooftree_xgoal ((g,id) : xgoal) : unit =
-  ((if (!pg_mode)
-      then (print_string ("[Goal ID " ^ string_of_goal_id id ^ "]");
-            print_newline ()));
-   print_goal g);;
-
-let (print_prooftree_xgoalstack:xgoalstack->unit) =
-  let print_prooftree_xgoalstate k gs =
-    let (_,gl,_) = gs in
-    let n = length gl in
-    let s = if n = 0 then "No subgoals" else
-              (string_of_int k)^" subgoal"^(if k > 1 then "s" else "")
-           ^" ("^(string_of_int n)^" total)" in
-    print_string s; print_newline();
-    if gl = [] then () else
-    (do_list (print_prooftree_xgoal o C el gl) (rev(1--(k-1)));
-     (if (!pg_mode) then print_string "[*]");
-     print_prooftree_xgoal (el 0 gl)) in
-  fun l ->
-   ((if (!pg_mode) & (!the_tactic_flag)
-       then let xs = map string_of_int (!the_new_goal_ids) in
-            (the_tactic_flag := false;
-             print_string  "[New Goal IDs: ";
-             print_string_seplist " " xs;
-             print_string "]";
-             print_newline ()));
-    (if l = [] then print_string "Empty goalstack"
-     else if tl l = [] then
-       let (_,gl,_ as gs) = hd l in
-       print_prooftree_xgoalstate 1 gs
-     else
-       let (_,gl,_ as gs) = hd l
-       and (_,gl0,_) = hd(tl l) in
-       let p = length gl - length gl0 in
-       let p' = if p < 1 then 1 else p + 1 in
-       print_prooftree_xgoalstate p' gs);
-    (if (!pg_mode) then
-     let (vs,theta) =
-        if (l = []) then ([],[])
-                    else let ((vs,(_,theta,_)),_,_) = hd l in
-                         (vs,theta) in
-     let foo v =
-        let (x,_) = dest_var v in
-        x ^ if (can (rev_assoc v) theta) then " using" else " open" in
-     let xs = map foo vs in
-     (print_newline();
-      print_string "(dependent evars: ";
-      print_string_seplist ", " xs;
-      print_string ")";
-      print_newline ())));;
-
-(* ------------------------------------------------------------------------- *)
-(* Adjust the OCaml prompt to carry information for Prooftree.               *)
-(* ------------------------------------------------------------------------- *)
-
-let original_prompt_fn = !Toploop.read_interactive_input in
-Toploop.read_interactive_input :=
-   fun prompt buffer len ->
-      let basic_prompt = "<" in        (* 'prompt' arg is ignored  *)
-      let prompt' =
-         if (!pg_mode)
-           then let pst = pt_proof_state () and gst = pt_global_state () in
-                "<prompt> " ^ basic_prompt ^ " " ^
-                string_of_int gst ^ " || " ^ string_of_int pst ^
-                " " ^ basic_prompt ^ " </prompt>"
-           else prompt in
-      original_prompt_fn prompt' buffer len;;
-
-(* ------------------------------------------------------------------------- *)
-(* Printing the goal of a given Prooftree goal id.                           *)
-(* ------------------------------------------------------------------------- *)
-
-let xgoal_of_id (id:goalid) : xgoal =
-  let gsts = !current_xgoalstack in
-  let find_goal (_,xgs,_) = find (fun (g,id0) -> id0 = id) xgs in
-  let xg = tryfind find_goal gsts in
-  xg;;
-
-(* ------------------------------------------------------------------------- *)
-(* Install the new goal-related printers.                                    *)
-(* ------------------------------------------------------------------------- *)
-
-#install_printer print_prooftree_xgoal;;
-#install_printer print_prooftree_xgoalstack;;
diff --git a/hol-light/TacticRecording/tacticrec.ml 
b/hol-light/TacticRecording/tacticrec.ml
deleted file mode 100644
index c65ee71ca2..0000000000
--- a/hol-light/TacticRecording/tacticrec.ml
+++ /dev/null
@@ -1,383 +0,0 @@
-(* ========================================================================== 
*)
-(* TACTIC RECORDING (HOL LIGHT)                                               
*)
-(* - Mechanism to record tactic proofs at the user level                      
*)
-(*                                                                            
*)
-(* By Mark Adams                                                              
*)
-(* Copyright (c) Univeristy of Edinburgh, 2011-2012                           
*)
-(* ========================================================================== 
*)
-
-
-(* This file implements a mechanism for recording tactic proofs at the level  
*)
-(* of interactive proof steps.  A recorded proof takes the form of a tree of  
*)
-(* goals, and is capable of capturing both complete and incomplete proofs, as 
*)
-(* well as hierarchy correspoding to tacticals.                               
*)
-
-(* The crucial mechanism by which goals in the subgoal package state are      
*)
-(* linked to parts of the stored goal tree is based on unique goal id         
*)
-(* numbers.  Each goal in the subgoal package state is annotated with such an 
*)
-(* id, and this is also stored at each level of the goal tree.  As a tactic   
*)
-(* is executed, the id from the goal in the subgoal package state that it     
*)
-(* executes on is used to locate the corresponding part of the goal tree, and 
*)
-(* the ids of the resulting subgoals are used to label the corresponding      
*)
-(* subparts of the goal tree.                                                 
*)
-
-
-open Dltree;;
-
-
-
-(* ** MODES ** *)
-
-
-(* Store goal sequent flag *)
-
-(* Intermediate goal results are only stored if this flag is set.  This can   
*)
-(* be used to cut down on memory usage.                                       
*)
-
-let store_goalsequent_flag = ref true;;
-
-
-
-(* ** GOAL TREE DATATYPES & STATE ** *)
-
-
-(* Goal tree datatype *)
-
-(* This is the datatype for recording tactic proofs as a tree of goals, with  
*)
-(* structure corresponding to interactive proof steps.  The structural aspect 
*)
-(* is captured by 'gtree0':                                                   
*)
-(*  Gactive   - Leaf for an active goal in the proof;                         
*)
-(*  Gexecuted - Node for a goal that has had a tactic successfully executed   
*)
-(*             on it.  Carries a list of subtrees, one for each of the        
*)
-(*             resulting subgoals, where the list is empty for a tactic that  
*)
-(*             completes its goal;                                            
*)
-(*  Gexit     - Wiring exiting a box, indicating destination goal.            
*)
-
-type ginfo =
-   (goalid * goalid)                 (* Goal id & Parent id *)
- * string option                     (* Goal name (optional) *)
- * goal option                       (* Goal sequent (optional) *)
- * unit option ref;;                 (* Formal proof (optional) *)
-
-type gstep =
-   Gatom of mldata                   (* Atomic tactic *)
- | Gbox of (label * gtree * bool)    (* Box for a tactical; flag for special *)
-
-and gtree0 =
-   Gactive                                                (* Active goal *)
- | Gexecuted of (gstep *       (* Tactic structure *)     (* Executed tactic *)
-                 gtree list)   (* Resulting subgoals *)
- | Gexit of goalid                                        (* Exit the box *)
-
-and gtree =
-   ginfo                             (* Various info about goal *)
- * gtree0 ref;;                      (* Goal plumbing *)
-
-
-(* Example *)
-
-(* Figure 1(b) in Denny et al would be represented by the following:          
*)
-(*                                                                            
*)
-(*  (_, ref                                                                   
*)
-(*   Gexecuted                                                                
*)
-(*     (Gbox (Tactical ("T1",[])                                              
*)
-(*        (_, ref                                                             
*)
-(*         Gexecuted                                                          
*)
-(*           (Gatom ("T2",[]),                                                
*)
-(*            [ (_, ref Gexecuted (Gatom ("WF",[]), []));                     
*)
-(*              (_, ref Gexit _) ])),                                         
*)
-(*      [ (_, ref                                                             
*)
-(*         Gexecuted                                                          
*)
-(*           (Gbox (Tactical ("DP",[]))                                       
*)
-(*              (_, ref                                                       
*)
-(*               Gexecuted                                                    
*)
-(*                 (Gatom ("Normalise",[]),                                   
*)
-(*                  [ (_, ref Gexecuted (Gatom ("Taut",[]), [])) ])),         
*)
-(*            [])) ]))                                                        
*)
-
-
-(* Destructors *)
-
-let ginfo_id (((id,_),_,_,_):ginfo) : goalid = id;;
-
-let ginfo_pid (((_,pid),_,_,_):ginfo) : goalid = pid;;
-
-let ginfo_name ((_,x_,_,_):ginfo) : string =
-  match x_ with
-    Some x -> x
-  | None   -> failwith "Goal not named";;
-
-let ginfo_sqt ((_,_,sqt_,_):ginfo) : goal =
-  match sqt_ with
-    Some sqt -> sqt
-  | None     -> failwith "Goal sequent not stored";;
-
-let ginfo_fproof ((_,_,_,prf_):ginfo) : unit =
-  match !prf_ with
-    Some prf -> prf
-  | None     -> failwith "Goal's formal proof not stored";;
-
-let gtree_id ((info,_):gtree) = ginfo_id info;;
-let gtree_pid ((info,_):gtree) = ginfo_pid info;;
-let gtree_name ((info,_):gtree) = ginfo_name info;;
-let gtree_sqt ((info,_):gtree) = ginfo_sqt info;;
-let gtree_fproof ((info,_):gtree) = ginfo_fproof info;;
-
-let gstep_tactic (gstp:gstep) =
-  match gstp with
-    Gatom obj | Gbox (Tactical obj, _, true) -> obj
-  | Gbox _ -> failwith "gstep_tactic: Not an atomic tactic";;
-
-let gtree_proof ((_,gtrm):gtree) =
-  match (!gtrm) with
-    Gexecuted (gstp,_) -> gstp
-  | _                  -> failwith "gtree_proof: Not executed";;
-
-let gtree_tactic gtr =
-  (gstep_tactic o gtree_proof) gtr;;
-
-let gtree_tactic1 ((_,gtrm) as gtr :gtree) =
-  match !gtrm with
-    Gactive -> active_info
-  | _       -> gtree_tactic gtr;;
-
-
-(* Tests *)
-
-let is_active_gtree ((_,gtrm):gtree) =
-  match !gtrm with
-    Gactive -> true
-  | _       -> false;;
-
-
-(* Dummy values *)
-
-let dummy_goal_info : ginfo = ((0,0), None, None, ref None);;
-
-let dummy_goal_tree : gtree = (dummy_goal_info, ref Gactive);;
-
-
-(* Goal tree database *)
-
-let the_goal_tree = ref dummy_goal_tree;;
-
-
-(* Location database *)
-
-(* This database is maintained in parallel with the goal tree, to enable fast 
*)
-(* location of the subtree corresponding to a goal (as opposed to laboriously 
*)
-(* traversing the tree to find the branch with the right id).                 
*)
-
-let the_gtree_locations = (dltree_empty () : (goalid, gtree ref) dltree);;
-
-let get_gtree id = !(dltree_lookup id the_gtree_locations);;
-
-let deregister_gtree gtr =
-  (dltree_remove (gtree_id gtr) the_gtree_locations);;
-
-let register_gtree gtr =
-  (dltree_insert (gtree_id gtr, ref gtr) the_gtree_locations);;
-
-
-(* Initialisation of the goal tree state *)
-
-let init_goal_tree g =
-  let g_ = if (!store_goalsequent_flag) then Some g else None in
-  let ginfo = ((!the_goal_id_counter,0), None, g_, ref None) in
-  let gtr = (ginfo, ref Gactive) in
-  (the_goal_tree := gtr;
-   dltree_reempty the_gtree_locations;
-   register_gtree gtr);;
-
-
-
-(* ** GTREE UTILITIES ** *)
-
-
-(* All children *)
-
-let rec gtree_all_children gtr =
-  let (_,gtrm) = gtr in
-  match (!gtrm) with
-    Gexecuted (gstp,gtrs)
-       -> (gstep_all_children gstp) @
-          gtrs @
-          flat (map gtree_all_children gtrs)
-  | _  -> []
-
-and gstep_all_children gstp =
-  match gstp with
-    Gatom _ | Gbox (_,_,true) -> []
-  | Gbox (_,gtr,false)        -> gtr::(gtree_all_children gtr);;
-
-
-
-(* ** PLUMBING ** *)
-
-(* These utilities do the plumbing for tactic applications and tactical       
*)
-(* applications, promoting operations from goals to xgoals and incorporating  
*)
-(* the results into gtrees.                                                   
*)
-
-
-(* Creating a sub gtree *)
-
-(* This creates a new xgoal for a goal, giving it a fresh id and registering  
*)
-(* it in the locations database.  Used on all new subgoals.                   
*)
-
-let new_active_subgtree pid (g:goal) : goalid * gtree =
-  let id = (inc_goal_id_counter (); !the_goal_id_counter) in
-  let g_ = if (!store_goalsequent_flag) then Some g else None in
-  let info = ((id,pid), None, g_, ref None) in
-  let gtr = (info, ref Gactive) in
-  (register_gtree gtr;
-   (id,gtr));;
-
-
-(* Extension *)
-
-(* This extends a gtree with the subgoals resulting from applying a tactic.   
*)
-
-let extend_gtree (pid:goalid) (gstp:gstep) (gs':goal list) : xgoal list =
-  let gtr = get_gtree pid in
-  let (_,gtrm) = gtr in
-  let () = try assert (!gtrm = Gactive)
-           with Assert_failure _ ->
-                   failwith "extend_gtree: Internal error - Not active" in
-  let (ids',gtrs) = unzip (map (new_active_subgtree pid) gs') in
-  let xgs' = zip gs' ids' in
-  (gtrm := Gexecuted (gstp,gtrs);
-   xgs');;
-
-
-(* Deletion *)
-
-(* This deletes from a gtree the result of applying a tactic to a given goal, 
*)
-(* also deleting the resulting subgoals from the locations database.          
*)
-
-let delete_step (id:goalid) =
-  let gtr = get_gtree id in
-  let (_,gtrm) = gtr in
-  let () = match (!gtrm) with
-             Gexecuted _ -> ()
-           | _ -> failwith "delete_step: Internal error - Not executed" in
-  let gtrs = gtree_all_children gtr in
-  (gtrm := Gactive;
-   do_list deregister_gtree gtrs);;
-
-
-(* Externalising *)
-
-(* This is used for turning a box's active subgoal to exit wiring.            
*)
-
-let externalise_gtree ((id0,id):goalid*goalid) : unit =
-  let (_,gtrm) = get_gtree id0 in
-  match (!gtrm) with
-    Gactive -> (gtrm := Gexit id)
-  | _ -> failwith "externalise_gtree: Internal error - Not active";;
-
-
-
-(* ** SUBGOAL PACKAGE OPERATIONS FOR XGOALS ** *)
-
-(* A few of the xtactic subgoal package commands are adjusted here.           
*)
-
-
-(* Starting/finishing a tactic proof *)
-
-(* For commands that start a tactic proof, 'mk_xgoalstate' is adjusted to     
*)
-(* initialise the goal tree.  Commands that return a tactic proof's resulting 
*)
-(* theorem, the theorem is adjusted to be an 'xthm' that carries a reference  
*)
-(* to the goal tree.                                                          
*)
-
-let mk_xgoalstate (g:goal) : xgoalstate =
-  let result = mk_xgoalstate g in
-  (init_goal_tree g;
-   result);;
-
-let (xTAC_PROOF : goal * xtactic -> thm) =
-  fun (g,tac) ->
-    let gstate = mk_xgoalstate g in
-    let _,sgs,just = xby tac gstate in
-    if sgs = [] then just null_inst []
-    else failwith "TAC_PROOF: Unsolved goals";;
-
-let xprove(t,tac) =
-  let th = xTAC_PROOF(([],t),tac) in
-  let t' = concl th in
-  let th' =
-    if t' = t then th else
-    try EQ_MP (ALPHA t' t) th
-    with Failure _ -> failwith "prove: justification generated wrong theorem" 
in
-  mk_xthm (th', ("<tactic-proof>",[]))
-
-let xset_goal(asl,w) =
-  current_xgoalstack :=
-    [mk_xgoalstate(map (fun t -> "",ASSUME t) asl,w)];
-  !current_xgoalstack;;
-
-let xg t =
-  let fvs = sort (<) (map (fst o dest_var) (frees t)) in
-  (if fvs <> [] then
-     let errmsg = end_itlist (fun s t -> s^", "^t) fvs in
-     warn true ("Free variables in goal: "^errmsg)
-   else ());
-   xset_goal([],t);;
-
-
-(* Undoing a tactic proof step *)
-
-(* 'xb' needs to be adjusted to delete the undone step in the goal tree.      
*)
-
-let xb () =
-  let result = xb () in
-  let (_,xgs,_) = hd result in
-  let (_,id) = hd xgs in
-  (delete_step id;
-   result);;
-
-
-
-(* ** GTREE OPERATIONS ** *)
-
-
-(* Goal id graph *)
-
-let rec gtree_graph0 gtr graph0 =
-  let (info,gtrm) = gtr in
-  let ((id,pid),_,g_,_) = info in
-  match !gtrm with
-    Gactive
-       -> (pid,id)::graph0
-  | Gexit id
-       -> failwith "???"
-  | Gexecuted (_,gtrs)
-       -> (pid,id)::(foldr gtree_graph0 gtrs graph0);;
-
-let gtree_graph () =
-  let nns = gtree_graph0 (!the_goal_tree) [] in
-  tl nns;;                (* remove (0,0) at head of dumped list *)
-
-
-(* Goal id trace *)
-
-let rec gtree_id_trace gtr =
-  let (_,gtrm) = gtr in
-  match !gtrm with
-    Gactive
-       -> [gtree_id gtr]
-  | Gexit id
-       -> let gtr1 = get_gtree id in
-          gtree_id_trace gtr1
-  | Gexecuted (gstp,gtrs1)
-       -> (match gstp with
-             Gatom _ | Gbox (_,_,true)
-                -> (gtree_id gtr) :: flat (map gtree_id_trace gtrs1)
-           | Gbox (_,gtr1,false)
-                -> gtree_id_trace gtr1);;
-
-
-(* Tactic trace *)
-
-let rec gtree_tactic_trace gtr =
-  map (gtree_tactic1 o get_gtree) (gtree_id_trace gtr);;
-
diff --git a/hol-light/TacticRecording/wrappers.ml 
b/hol-light/TacticRecording/wrappers.ml
deleted file mode 100644
index 115163d43e..0000000000
--- a/hol-light/TacticRecording/wrappers.ml
+++ /dev/null
@@ -1,359 +0,0 @@
-(* ========================================================================== 
*)
-(* WRAPPER FUNCTIONS (HOL LIGHT)                                              
*)
-(* - Functions for promoting thm/goal-related ML objects for xthm/xgoal       
*)
-(*                                                                            
*)
-(* By Mark Adams                                                              
*)
-(* Copyright (c) Univeristy of Edinburgh, 2011-2012                           
*)
-(* ========================================================================== 
*)
-
-
-
-(* ** THEOREM-RELATED WRAPPER FUNCTIONS ** *)
-
-
-(* mldata_as_meta_arg *)
-
-let mldata_as_meta_arg (obj:mldata) =
-  match obj with
-    (x, ((_::_) as args))
-       -> Mlfn (x, front args)
-  | _  -> failwith "mldata_as_meta_arg: Unexpected empty rule arg list";;
-
-let mldata_as_meta2_arg (obj:mldata) =
-  match obj with
-    (x, ((_::_) as args))
-       -> Mlfn (x, (front o front) args)
-  | _  -> failwith "mldata_as_meta_arg: Unexpected empty rule arg list";;
-
-
-(* detect_rule_app *)
-
-(* Based on the assumption that the given meta function actually executes its 
*)
-(* rule argument at some point, this utility detects such an execution during 
*)
-(* the demotion of a given xrule argument to a rule.  The meta function's     
*)
-(* result is returned along with an 'farg' that captures the rule.            
*)
-
-let detect_rule_app (mfunc:('a->thm)->'b) (xr:'a->xthm) : 'c =
-  let temp = ref (Mlfn ("<rule>", []) : mlarg) in
-  let r arg = let xth = xr arg in
-              let (th,obj) = dest_xthm xth in
-              (temp := mldata_as_meta_arg obj;
-               th) in
-  let th = mfunc r in
-  (th,!temp);;
-
-let detect_metarule_app (mfunc:(('a->thm)->'b->thm)->'c)
-                        (xmr:('a->xthm)->'b->xthm) : 'd =
-  let temp = ref (Mlfn ("<meta-rule>",[]) : mlarg) in
-  let mr marg arg = let xmarg arg0 =
-                       let th = marg arg0 in
-                       let obj = ("<rule>", [Mlfn ("<arg>",[])]) in
-                       mk_xthm (th,obj) in
-                    let xth = xmr xmarg arg in
-                    let (th,obj) = dest_xthm xth in
-                    (temp := mldata_as_meta2_arg obj;
-                     th) in
-  let th = mfunc mr in
-  (th,!temp);;
-
-
-(* Theorem wrapper *)
-
-let theorem_wrap (x:string) (th:thm) : xthm =
-  (th, (x,[]));;
-
-
-(* Rule wrappers *)
-
-(* Lots of rule wrappers are required because there are many different type   
*)
-(* shapes for rules.                                                          
*)
-
-let rule_wrap0 obj (r:'a->thm) (arg:'a) : xthm =
-  let th' = r arg in
-  mk_xthm (th',obj);;
-
-let conv_wrap x (r:term->thm) (tm:term) : xthm =
-  rule_wrap0 (x, [Mlterm tm]) r tm;;
-
-let thm_conv_wrap x (r:thm->term->thm) (xth:xthm) tm : xthm =
-  let (th,prf) = dest_xthm xth in
-  rule_wrap0 (x, [Mlthm prf; Mlterm tm]) (r th) tm;;
-
-let thmlist_conv_wrap x (r:thm list->term->thm) xths (tm:term) : xthm =
-  let (ths,prfs) = unzip (map dest_xthm xths) in
-  rule_wrap0 (x, [Mllist (map (fun prf -> Mlthm prf) prfs); Mlterm tm])
-             (r ths) tm;;
-
-let rule_wrap x (r:thm->thm) (xth:xthm) : xthm =
-  let (th,prf) = dest_xthm xth in
-  rule_wrap0 (x, [Mlthm prf]) r th;;
-
-let drule_wrap x (r:thm->thm->thm) (xth1:xthm) (xth2:xthm) : xthm =
-  let (th1,prf1) = dest_xthm xth1 in
-  let (th2,prf2) = dest_xthm xth2 in
-  rule_wrap0 (x, [Mlthm prf1; Mlthm prf2]) (r th1) th2;;
-
-let prule_wrap x (r:thm*thm->thm) ((xth1:xthm),(xth2:xthm)) : xthm =
-  let (th1,prf1) = dest_xthm xth1 in
-  let (th2,prf2) = dest_xthm xth2 in
-  rule_wrap0 (x, [Mlpair(Mlthm prf1, Mlthm prf2)]) r (th1,th2);;
-
-let trule_wrap x (r:thm->thm->thm->thm)
-                 (xth1:xthm) (xth2:xthm) (xth3:xthm) : xthm =
-  let (th1,prf1) = dest_xthm xth1 in
-  let (th2,prf2) = dest_xthm xth2 in
-  let (th3,prf3) = dest_xthm xth3 in
-  rule_wrap0 (x, [Mlthm prf1; Mlthm prf2; Mlthm prf3]) (r th1 th2) th3;;
-
-let term_rule_wrap x (r:term->thm->thm) tm (xth:xthm) : xthm =
-  let (th,prf) = dest_xthm xth in
-  rule_wrap0 (x, [Mlterm tm; Mlthm prf]) (r tm) th;;
-
-let termpair_rule_wrap x (r:term*term->thm->thm) (tm1,tm2) (xth:xthm) : xthm =
-  let (th,prf) = dest_xthm xth in
-  rule_wrap0 (x, [Mlpair(Mlterm tm1,Mlterm tm2); Mlthm prf]) (r (tm1,tm2)) th;;
-
-let termthmpair_rule_wrap x (r:term*thm->thm->thm) (tm,xth0) (xth:xthm) : xthm 
=
-  let (th0,prf0) = dest_xthm xth0 in
-  let (th,prf) = dest_xthm xth in
-  rule_wrap0 (x, [Mlpair(Mlterm tm, Mlthm prf0); Mlthm prf]) (r (tm,th0)) th;;
-
-let termlist_rule_wrap x (r:term list->thm->thm) tms (xth:xthm) : xthm =
-  let (th,prf) = dest_xthm xth in
-  rule_wrap0 (x, [Mllist (map (fun tm -> Mlterm tm) tms); Mlthm prf])
-             (r tms) th;;
-
-let terminst_rule_wrap x (r:(term*term)list->thm->thm) theta (xth:xthm) : xthm 
=
-  let (th,prf) = dest_xthm xth in
-  rule_wrap0 (x,
-              [Mllist (map (fun (tm1,tm2) -> Mlpair(Mlterm tm1, Mlterm tm2))
-                           theta);
-               Mlthm prf])
-             (r theta) th;;
-
-let typeinst_rule_wrap x (r:(hol_type*hol_type)list->thm->thm)
-                         theta (xth:xthm) : xthm =
-  let (th,prf) = dest_xthm xth in
-  rule_wrap0 (x,
-              [Mllist (map (fun (tm1,tm2) -> Mlpair(Mltype tm1, Mltype tm2))
-                           theta);
-               Mlthm prf])
-             (r theta) th;;
-
-let thmlist_rule_wrap x (r:thm list->thm->thm) xths (xth:xthm) : xthm =
-  let (ths,prfs) = unzip (map dest_xthm xths) in
-  let (th,prf) = dest_xthm xth in
-  rule_wrap0 (x, [Mllist (map (fun prf -> Mlthm prf) prfs); Mlthm prf])
-             (r ths) th;;
-
-
-(* Multi-rule wrappers *)
-
-let multirule_wrap0 obj (r:'a->thm list) (arg:'a) : xthm list =
-  let ths' = r arg in
-  let n = length ths' in
-  let infos' = map (fun i -> ("el", [Mlint i; Mlfn obj])) (0 -- (n-1)) in
-  map mk_xthm (zip ths' infos');; 
-
-let multirule_wrap x (r:thm->thm list) (xth:xthm) : xthm list =
-  let (th,prf) = dest_xthm xth in
-  multirule_wrap0 (x, [Mlthm prf]) r th;;
-
-
-(* Meta rule wrappers *)
-
-let meta_rule_wrap0 info0 (mr:('a->thm)->'b->thm)
-                          (xr:'a->xthm) (arg:'b) : xthm =
-  let (th',f) = detect_rule_app (fun r -> mr r arg) xr in
-  let (x,args0) = info0 in
-  let obj' = (x, f::args0) in
-  (th',obj');;
-
-let conv_conv_wrap x (mc:conv->conv) (xc:term->xthm) (tm:term) : xthm =
-  meta_rule_wrap0 (x, [Mlterm tm]) mc xc tm;;
-
-
-
-(* ** TACTIC-RELATED WRAPPER FUNCTIONS ** *)
-
-(* These functions are for promoting existing tactics and tacticals.          
*)
-
-
-(* Generic basic wrapper util *)
-
-(* Applies a tactic and incorproates the results into the goal tree.  Takes   
*)
-(* an "infotactic", i.e. like a normal tactic that works on 'goal' and        
*)
-(* returns 'goalstate', but that also returns a 'gstep' summary of the        
*)
-(* operation.  This is used to promote every basic tactic-based function.     
*)
-
-let infotactic_wrap (infotac:goal->goalstate*mldata) (xg:xgoal) : xgoalstate =
-  let (g,id) = dest_xgoal xg in
-  let ((meta,gs,just),obj) = infotac g in
-  let xgs = extend_gtree id (Gatom obj) gs in
-  (meta,xgs,just);;
-
-
-(* Generic box wrapper util *)
-
-(* Sets up a box to apply an xtactic within, applies the xtactic (which       
*)
-(* incorporates itself into the goal tree) and wires up the resulting         
*)
-(* subgoals to external subgoals of the box.  Note that this is not quite     
*)
-(* generic enough for 'SUBGOAL_THEN' (because there is not a total surjection 
*)
-(* between internal and external goals).                                      
*)
-
-let infobox_wrap (xinfotac:xgoal->xgoalstate*label) (xg:xgoal) : xgoalstate =
-  let (g,id) = dest_xgoal xg in
-  let (id0,gtr0) = new_active_subgtree id g in
-  let xg0 = mk_xgoal (g,id0) in
-  let ((meta,xgs0,just),l) = xinfotac xg0 in
-  let (gs0,ids0) = unzip (map dest_xgoal xgs0) in
-  let xgs = extend_gtree id (Gbox (l,gtr0,false)) gs0 in
-  let ids = map xgoal_id xgs in
-  (do_list externalise_gtree (zip ids0 ids);
-   (meta,xgs,just));;
-
-
-(* Tactic wrapper *)
-
-(* This is for wrapping around a tactic, to promote it to work on xgoals and  
*)
-(* incorporate the results into an existing gtree.                            
*)
-
-let tactic_wrap0 obj (tac:tactic) : xtactic =
-  let infotac g = (tac g, obj) in
-  infotactic_wrap infotac;;
-
-let tactic_wrap x tac =
-  tactic_wrap0 (x, []) tac;;
-
-let string_tactic_wrap x (tac:string->tactic) (s:string) : xtactic =
-  tactic_wrap0 (x, [Mlstring s]) (tac s);;
-
-let term_tactic_wrap x (tac:term->tactic) (tm:term) : xtactic =
-  tactic_wrap0 (x, [Mlterm tm]) (tac tm);;
-
-let termpair_tactic_wrap x (tac:term*term->tactic) (tm1,tm2) : xtactic =
-  tactic_wrap0 (x, [Mlpair (Mlterm tm1, Mlterm tm2)]) (tac (tm1,tm2));;
-
-let termlist_tactic_wrap x (tac:term list->tactic) tms : xtactic =
-  tactic_wrap0 (x, [Mllist (map (fun tm -> Mlterm tm) tms)]) (tac tms);;
-
-let thm_tactic_wrap x (tac:thm->tactic) (xth:xthm) : xtactic =
-  let (th,prf) = dest_xthm xth in
-  tactic_wrap0 (x, [Mlthm prf]) (tac th);;
-
-let thmlist_tactic_wrap x (tac:thm list->tactic) (xths:xthm list) : xtactic =
-  let (ths,prfs) = unzip (map dest_xthm xths) in
-  tactic_wrap0 (x, [Mllist (map (fun prf -> Mlthm prf) prfs)]) (tac ths);;
-
-let stringthm_tactic_wrap x (tac:string->thm->tactic) s (xth:xthm) : xtactic =
-  let (th,prf) = dest_xthm xth in
-  tactic_wrap0 (x, [Mlstring s; Mlthm prf]) (tac s th);;
-
-
-(* Meta-tactic wrapper *)
-
-(* For tactics that take rule arguments.                                      
*)
-
-let meta_tactic_wrap0 info0 (mtac:('a->thm)->tactic)
-                            (xr:'a->xthm) : xtactic =
-  let infotac g =
-     let (gst,f) = detect_rule_app (fun r -> mtac r g) xr in
-     let (x,args0) = info0 in
-     let obj = (x, f::args0) in
-     (gst,obj) in
-  infotactic_wrap infotac;;
-
-let conv_tactic_wrap x (mtac:conv->tactic) (xc:xconv) : xtactic =
-  meta_tactic_wrap0 (x, []) mtac xc;;
-
-let metameta_tactic_wrap info0 (mmtac:(('a->thm)->'b->thm)->tactic)
-                               (xmr:('a->xthm)->'b->xthm) : xtactic =
-  let infotac g =
-     let (gst,f) = detect_metarule_app (fun mr -> mmtac mr g) xmr in
-     let (x,args0) = info0 in
-     let obj = (x, f::args0) in
-     (gst,obj) in
-  infotactic_wrap infotac;;
-
-let convconvthmlist_tactic_wrap x (mmtac:(conv->conv)->thm list->tactic)
-                                 (xmc:xconv->xconv) (xths:xthm list) : xtactic 
=
-  let (ths,prfs) = unzip (map dest_xthm xths) in
-  metameta_tactic_wrap (x, [Mllist (map (fun prf -> Mlthm prf) prfs)])
-                       (fun mc -> mmtac mc ths)
-                       xmc;;
-
-
-(* Tactical wrapper *)
-
-(* This is for wrapping around a tactical, to incorporate the results into a  
*)
-(* box in an existing gtree, where the execution of the tactical's tactics is 
*)
-(* captured inside the box, so that they can be stepped through and/or        
*)
-(* refactored.  Thus we cannot take the tactical as a black box; it must      
*)
-(* already be promoted to work with xtactics and xgoals.  This must done by   
*)
-(* hand for each tactical by trivially adjusting its original source code.    
*)
-
-let tactical_wrap0 obj (xttcl:'a->xtactic) (arg:'a) : xtactic =
-  let xinfotac xg = (xttcl arg xg, Tactical obj) in
-  infobox_wrap xinfotac;;
-
-let tactical_wrap x (xttcl:'a->xtactic) (xtac:'a) : xtactic =
-  tactical_wrap0 (x,[]) xttcl xtac;;
-
-let btactical_wrap x (xttcl:'a->'b->xtactic) (xtac1:'a) (xtac2:'b) : xtactic =
-  tactical_wrap0 (x,[]) (xttcl xtac1) xtac2;;
-
-let int_tactical_wrap x (xttcl:int->'a->xtactic) (n:int) (xtac:'a) : xtactic =
-  tactical_wrap0 (x, [Mlint n]) (xttcl n) xtac;;
-
-let list_tactical_wrap x (xttcl:('a->xtactic)->'a list->xtactic)
-                         (xtac:'a->xtactic) (l:'a list) : xtactic =
-  tactical_wrap0 (x,[]) (xttcl xtac) l;;
-
-
-(* HILABEL *)
-
-(* Command for putting the result of a tactic into a box and giving the box a 
*)
-(* label (distinct from a tactical label).                                    
*)
-
-let HILABEL x (xtac:xtactic) : xtactic =
-  let xinfotac xg = (xtac xg, Label x) in
-  infobox_wrap xinfotac;;
-
-
-(* xSUBGOAL_THEN - seems to be a special case *)
-
-let xASSUME = conv_wrap "ASSUME" ASSUME;;
-
-let xSUBGOAL_THEN (tm:term) (ttac:xthm_tactic) (xg:xgoal) : xgoalstate =
-  let arg = xASSUME tm in
-
-  let (g,id) = dest_xgoal xg in
-  let (id0,gtr0) = new_active_subgtree id g in
-  let xg0 = mk_xgoal (g,id0) in
-  let (meta,xgs0,just) = ttac arg xg0 in
-
-  let (asl,_) = g in
-  let g2 = (asl,tm) in
-  let obj = ("SUBGOAL_THEN",
-               [Mlterm tm; (mldata_as_meta_arg o gtree_tactic) gtr0]) in
-
-  let (gs0,ids0) = unzip (map dest_xgoal xgs0) in
-  let xgs = extend_gtree id (Gbox (Tactical obj, gtr0, true)) (g2::gs0) in
-  let ids1 = map xgoal_id (tl xgs) in
-  let just' = fun i l -> PROVE_HYP (hd l) (just i (tl l)) in
-  (do_list externalise_gtree (zip ids0 ids1);
-   (meta,xgs,just'));;
-
-
-(*
-let SUBGOAL_TAC s tm prfs =
-  match prfs with
-   p::ps -> (warn (ps <> []) "SUBGOAL_TAC: additional subproofs ignored";
-             SUBGOAL_THEN tm (LABEL_TAC s) THENL [p; ALL_TAC])
-  | [] -> failwith "SUBGOAL_TAC: no subproof given";;
-
-let (FREEZE_THEN :thm_tactical) =
-  fun ttac th (asl,w) ->
-    let meta,gl,just = ttac (ASSUME(concl th)) (asl,w) in
-    meta,gl,fun i l -> PROVE_HYP th (just i l);;
-*)
diff --git a/hol-light/TacticRecording/xtactics.ml 
b/hol-light/TacticRecording/xtactics.ml
deleted file mode 100644
index fb7028c7ae..0000000000
--- a/hol-light/TacticRecording/xtactics.ml
+++ /dev/null
@@ -1,451 +0,0 @@
-(* ========================================================================= *)
-(* HOL Light subgoal package amended for id-carrying goals.                  *)
-(*                                                                           *)
-(*       Mark Adams, School of Informatics, University of Edinburgh          *)
-(*                                                                           *)
-(* (c) Copyright, University of Edinburgh, 2012                              *)
-(* ========================================================================= *)
-
-(* The 'xgoal' variant of the 'goal' datatype is defined here, to label      *)
-(* goals with a unique goal id.  This gives a basis for recording tactic     *)
-(* proofs.  Variants of all the datatypes depending on 'goal', such as       *)
-(* 'xgoalstate' and 'xtactic', are also defined, along with a variant        *)
-(* subgoal package.  ML names are given an "x" prefix to keep them distinct  *)
-(* from the originals for now (but originals are overwritten later, in       *)
-(* 'install.ml').                                                            *)
-
-(* The goal id counter is only adjusted in this file by being incremented in *)
-(* 'mk_xgoalstate', used when starting a new subgoal package proof.          *)
-(* Xtactics are assumed to give their resulting xgoals id labels based on an *)
-(* appropriately updated goal id counter.                                    *)
-
-(* After the implementation of xgoals themselves at the start of this file,  *)
-(* the rest of the file is more-or-less copied verbatim from HOL Light's     *)
-(* original 'tactics.ml', with just a few changes required.  This enables an *)
-(* easy diff operation with the original if required to check that the       *)
-(* changes are valid.                                                        *)
-
-(* ------------------------------------------------------------------------- *)
-(* Goal counter for providing goal ids.                                      *)
-(* ------------------------------------------------------------------------- *)
-
-type goalid = int;;
-
-let string_of_goal_id (id:goalid) = string_of_int id;;
-
-let the_goal_id_counter = ref (0 : goalid);;
-
-let inc_goal_id_counter () =
-  (the_goal_id_counter := !the_goal_id_counter + 1);;
-
-(* ------------------------------------------------------------------------- *)
-(* An xgoal extends a goal with an identity.                                 *)
-(* ------------------------------------------------------------------------- *)
-
-type xgoal = goal * goalid;;
-
-let equals_xgoal (((a,w),_):xgoal) (((a',w'),_):xgoal) =
-  forall2 (fun (s,th) (s',th') -> s = s' & equals_thm th th') a a' & w = w';;
-
-let mk_xgoal (gn:goal*goalid) : xgoal = gn;;
-
-let dest_xgoal (gn:xgoal) : goal*goalid = gn;;
-
-let xgoal_goal ((g,id):xgoal) : goal  = g;;
-
-let xgoal_id ((g,id):xgoal) : goalid  = id;;
-
-(* ------------------------------------------------------------------------- *)
-(* The xgoalstate is like goalstate but for xgoals instead of goals.         *)
-(* ------------------------------------------------------------------------- *)
-
-type xgoalstate = (term list * instantiation) * xgoal list * justification;;
-
-(* ------------------------------------------------------------------------- *)
-(* A goalstack but for xgoals.                                               *)
-(* ------------------------------------------------------------------------- *)
-
-type xgoalstack = xgoalstate list;;
-
-(* ------------------------------------------------------------------------- *)
-(* Refinements for xgoals.                                                   *)
-(* ------------------------------------------------------------------------- *)
-
-type xrefinement = xgoalstate -> xgoalstate;;
-
-(* ------------------------------------------------------------------------- *)
-(* Tactics for xgoals.                                                       *)
-(* ------------------------------------------------------------------------- *)
-
-type xtactic = xgoal -> xgoalstate;;
-
-type xthm_tactic = xthm -> xtactic;;
-
-type xthm_tactical = xthm_tactic -> xthm_tactic;;
-
-(* ------------------------------------------------------------------------- *)
-(* Instantiation of xgoals.                                                  *)
-(* ------------------------------------------------------------------------- *)
-
-let (inst_xgoal:instantiation->xgoal->xgoal) =
-  fun p ((thms,w),id) ->
-    (map (I F_F INSTANTIATE_ALL p) thms,instantiate p w),id;;
-
-(* ------------------------------------------------------------------------- *)
-(* Validity check for xtactics.                                              *)
-(* ------------------------------------------------------------------------- *)
-
-let (xVALID:xtactic->xtactic) =
-  let fake_thm ((asl,w),id) =
-    let asms = itlist (union o hyp o snd) asl [] in
-    mk_fthm(asms,w)
-  and false_tm = `_FALSITY_` in
-  fun tac ((asl,w),id) ->
-    let ((mvs,i),gls,just as res) = tac ((asl,w),id) in
-    let ths = map fake_thm gls in
-    let asl',w' = dest_thm(just null_inst ths) in
-    let asl'',w'' = inst_goal i (asl,w) in
-    let maxasms =
-      itlist (fun (_,th) -> union (insert (concl th) (hyp th))) asl'' [] in
-    if aconv w' w'' & forall (C mem maxasms) (subtract asl' [false_tm])
-    then res else failwith "VALID: Invalid tactic";;
-
-(* ------------------------------------------------------------------------- *)
-(* Various simple combinators for tactics, identity tactic etc.              *)
-(* ------------------------------------------------------------------------- *)
-
-let (xTHEN),(xTHENL) =
-  let propagate_empty i [] = []
-  and propagate_thm th i [] = INSTANTIATE_ALL i th in
-  let compose_justs n just1 just2 i ths =
-    let ths1,ths2 = chop_list n ths in
-    (just1 i ths1)::(just2 i ths2) in
-  let rec seqapply l1 l2 = match (l1,l2) with
-     ([],[]) -> null_meta,[],propagate_empty
-   | ((tac:xtactic)::tacs),((goal:xgoal)::goals) ->
-            let ((mvs1,insts1),gls1,just1 as gstate1) = tac goal in
-            let goals' = map (inst_xgoal insts1) goals in
-            let ((mvs2,insts2),gls2,just2 as gstate2) = seqapply tacs goals' in
-            ((union mvs1 mvs2,compose_insts insts1 insts2),
-             gls1@gls2,compose_justs (length gls1) just1 just2)
-   | _,_ -> failwith "seqapply: Length mismatch" in
-  let justsequence just1 just2 insts2 i ths =
-    just1 (compose_insts insts2 i) (just2 i ths) in
-  let tacsequence ((mvs1,insts1),gls1,just1 as gstate1) tacl =
-    let ((mvs2,insts2),gls2,just2 as gstate2) = seqapply tacl gls1 in
-    let jst = justsequence just1 just2 insts2 in
-    let just = if gls2 = [] then propagate_thm (jst null_inst []) else jst in
-    ((union mvs1 mvs2,compose_insts insts1 insts2),gls2,just) in
-  let (then_: xtactic -> xtactic -> xtactic) =
-    fun tac1 tac2 g ->
-      let _,gls,_ as gstate = tac1 g in
-      tacsequence gstate (replicate tac2 (length gls))
-  and (thenl_: xtactic -> xtactic list -> xtactic) =
-    fun tac1 tac2l g ->
-      let _,gls,_ as gstate = tac1 g in
-      if gls = [] then tacsequence gstate []
-      else tacsequence gstate tac2l in
-  then_,thenl_;;
-
-let ((xORELSE): xtactic -> xtactic -> xtactic) =
-  fun tac1 tac2 g ->
-    try tac1 g with Failure _ -> tac2 g;;
-
-let (xFAIL_TAC: string -> xtactic) =
-  fun tok g -> failwith tok;;
-
-let (xALL_TAC:xtactic) =
-  fun g -> null_meta,[g],fun _ [th] -> th;;
-
-let xTRY tac =
-  xORELSE tac xALL_TAC;;
-
-let rec xREPEAT tac g =
-  (xORELSE (xTHEN tac (xREPEAT tac)) xALL_TAC) g;;
-
-let xEVERY tacl =
-  itlist (fun t1 t2 -> xTHEN t1 t2) tacl xALL_TAC;;
-
-let (xFIRST: xtactic list -> xtactic) =
-  fun tacl g -> end_itlist (fun t1 t2 -> xORELSE t1 t2) tacl g;;
-
-let xMAP_EVERY tacf lst =
-  xEVERY (map tacf lst);;
-
-let xMAP_FIRST tacf lst =
-  xFIRST (map tacf lst);;
-
-let (xCHANGED_TAC: xtactic -> xtactic) =
-  fun tac g ->
-    let (meta,gl,_ as gstate) = tac g in
-    if meta = null_meta & length gl = 1 & equals_xgoal (hd gl) g
-    then failwith "CHANGED_TAC" else gstate;;
-
-let rec xREPLICATE_TAC n tac =
-  if n <= 0 then xALL_TAC else xTHEN tac (xREPLICATE_TAC (n - 1) tac);;
-
-(* ------------------------------------------------------------------------- *)
-(* Combinators for theorem continuations adjusted for xthms and xtactics.    *)
-(* ------------------------------------------------------------------------- *)
-
-let ((xTHEN_TCL): xthm_tactical -> xthm_tactical -> xthm_tactical) =
-  fun ttcl1 ttcl2 ttac -> ttcl1 (ttcl2 ttac);;
-
-let ((xORELSE_TCL): xthm_tactical -> xthm_tactical -> xthm_tactical) =
-  fun ttcl1 ttcl2 ttac th ->
-    try ttcl1 ttac th with Failure _ -> ttcl2 ttac th;;
-
-let rec xREPEAT_TCL ttcl ttac th =
-  (xORELSE_TCL (xTHEN_TCL ttcl (xREPEAT_TCL ttcl)) I) ttac th;;
-
-let (xREPEAT_GTCL: xthm_tactical -> xthm_tactical) =
-  let rec xREPEAT_GTCL ttcl ttac th g =
-    try ttcl (xREPEAT_GTCL ttcl ttac) th g with Failure _ -> ttac th g in
-  xREPEAT_GTCL;;
-
-let (xALL_THEN: xthm_tactical) =
-  I;;
-
-let (xNO_THEN: xthm_tactical) =
-  fun ttac th -> failwith "NO_THEN";;
-
-let xEVERY_TCL ttcll =
-  itlist (fun t1 t2 -> xTHEN_TCL t1 t2) ttcll xALL_THEN;;
-
-let xFIRST_TCL ttcll =
-  end_itlist (fun t1 t2 -> xORELSE_TCL t1 t2) ttcll;;
-
-(* ------------------------------------------------------------------------- *)
-(* Tactics to augment assumption list. Note that to allow "ASSUME p" for     *)
-(* any assumption "p", these add a PROVE_HYP in the justification function,  *)
-(* just in case.                                                             *)
-(* ------------------------------------------------------------------------- *)
-
-let (xLABEL_TAC: string -> xthm_tactic) =
-  fun s thm ((asl,w),id) ->
-    let thm' = xthm_thm thm in
-    null_meta,[(((s,thm')::asl,w),id)],
-    fun i [th] -> PROVE_HYP (INSTANTIATE_ALL i thm') th;;
-
-(* ------------------------------------------------------------------------- *)
-(* Manipulation of assumption list.                                          *)
-(* ------------------------------------------------------------------------- *)
-
-let mk_asm_xthm th = mk_xthm0 "<asm>" th;;
-
-let (xFIND_ASSUM: xthm_tactic -> term -> xtactic) =
-  fun ttac t (((asl,w),id) as g) ->
-    ttac (mk_asm_xthm (snd(find (fun (_,th) -> concl th = t) asl))) g;;
-
-let (xPOP_ASSUM: xthm_tactic -> xtactic) =
-  fun ttac ->
-   function ((((_,th)::asl),w),id) -> ttac (mk_asm_xthm th) ((asl,w),id)
-    | _ -> failwith "POP_ASSUM: No assumption to pop";;
-
-let (xASSUM_LIST: (xthm list -> xtactic) -> xtactic) =
-    fun aslfun ((asl,w),id) -> aslfun (map (mk_asm_xthm o snd) asl)
-               ((asl,w),id);;
-
-let (xPOP_ASSUM_LIST: (xthm list -> xtactic) -> xtactic) =
-  fun asltac ((asl,w),id) -> asltac (map (mk_asm_xthm o snd) asl) (([],w),id);;
-
-let (xEVERY_ASSUM: xthm_tactic -> xtactic) =
-  fun ttac -> xASSUM_LIST (xMAP_EVERY ttac);;
-
-let (xFIRST_ASSUM: xthm_tactic -> xtactic) =
-  fun ttac (((asl,w),id) as g) ->
-                    tryfind (fun (_,th) -> ttac (mk_asm_xthm th) g) asl;;
-
-let (xRULE_ASSUM_TAC :(xthm->xthm)->xtactic) =
-  fun rule ((asl,w),id) ->
-              (xTHEN (xPOP_ASSUM_LIST(K xALL_TAC))
-                     (xMAP_EVERY
-                        (fun (s,th) -> xLABEL_TAC s (rule (mk_asm_xthm th)))
-                        (rev asl)))
-              ((asl,w),id);;
-
-(* ------------------------------------------------------------------------- *)
-(* Operate on assumption identified by a label.                              *)
-(* ------------------------------------------------------------------------- *)
-
-let (xUSE_THEN:string->xthm_tactic->xtactic) =
-  fun s ttac (((asl,w),id) as gl) ->
-    let th = try assoc s asl with Failure _ ->
-             failwith("USE_TAC: didn't find assumption "^s) in
-    ttac (mk_asm_xthm th) gl;;
-
-let (xREMOVE_THEN:string->xthm_tactic->xtactic) =
-  fun s ttac ((asl,w),id) ->
-    let th = try assoc s asl with Failure _ ->
-             failwith("USE_TAC: didn't find assumption "^s) in
-    let asl1,asl2 = chop_list(index s (map fst asl)) asl in
-    let asl' = asl1 @ tl asl2 in
-    ttac (mk_asm_xthm th) ((asl',w),id);;
-
-(* ------------------------------------------------------------------------- *)
-(* General tool to augment a required set of theorems with assumptions.      *)
-(* ------------------------------------------------------------------------- *)
-
-let (xASM :(xthm list -> xtactic)->(xthm list -> xtactic)) =
-  fun tltac ths
-         (((asl,w),id) as g) -> tltac (map (mk_asm_xthm o snd) asl @ ths) g;;
-
-(* ------------------------------------------------------------------------- *)
-(* A printer for xgoals etc.                                                 *)
-(* ------------------------------------------------------------------------- *)
-
-let print_xgoal ((g,x):xgoal) : unit =
-  print_goal g;;
-
-let (print_xgoalstack:xgoalstack->unit) =
-  let print_xgoalstate k gs =
-    let (_,gl,_) = gs in
-    let n = length gl in
-    let s = if n = 0 then "No subgoals" else
-              (string_of_int k)^" subgoal"^(if k > 1 then "s" else "")
-           ^" ("^(string_of_int n)^" total)" in
-    print_string s; print_newline();
-    if gl = [] then () else
-    do_list (print_xgoal o C el gl) (rev(0--(k-1))) in
-  fun l ->
-    if l = [] then print_string "Empty goalstack"
-    else if tl l = [] then
-      let (_,gl,_ as gs) = hd l in
-      print_xgoalstate 1 gs
-    else
-      let (_,gl,_ as gs) = hd l
-      and (_,gl0,_) = hd(tl l) in
-      let p = length gl - length gl0 in
-      let p' = if p < 1 then 1 else p + 1 in
-      print_xgoalstate p' gs;;
-
-(* ------------------------------------------------------------------------- *)
-(* Convert an xtactic into an xrefinement.                                   *)
-(* ------------------------------------------------------------------------- *)
-
-let (xby:xtactic->xrefinement) =
-  fun tac ((mvs,inst),gls,just) ->
-    let g = hd gls
-    and ogls = tl gls in
-    let ((newmvs,newinst),subgls,subjust) = tac g in
-    let n = length subgls in
-    let mvs' = union newmvs mvs
-    and inst' = compose_insts inst newinst
-    and gls' = subgls @ map (inst_xgoal newinst) ogls in
-    let just' i ths =
-      let i' = compose_insts inst' i in
-      let cths,oths = chop_list n ths in
-      let sths = (subjust i cths) :: oths in
-      just i' sths in
-    (mvs',inst'),gls',just';;
-
-(* ------------------------------------------------------------------------- *)
-(* Rotate for xgoalstate.                                                    *)
-(* ------------------------------------------------------------------------- *)
-
-let (xrotate:int->xrefinement) =
-  let rotate_p (meta,sgs,just) =
-    let sgs' = (tl sgs)@[hd sgs] in
-    let just' i ths =
-      let ths' = (last ths)::(butlast ths) in
-      just i ths' in
-    (meta,sgs',just')
-  and rotate_n (meta,sgs,just) =
-    let sgs' = (last sgs)::(butlast sgs) in
-    let just' i ths =
-      let ths' = (tl ths)@[hd ths] in
-      just i ths' in
-    (meta,sgs',just') in
-  fun n -> if n > 0 then funpow n rotate_p
-           else funpow (-n) rotate_n;;
-
-(* ------------------------------------------------------------------------- *)
-(* Refinement proof, tactic proof etc for xgoals/xtactics.                   *)
-(* ------------------------------------------------------------------------- *)
-
-let (mk_xgoalstate:goal->xgoalstate) =
-  fun (asl,w) ->
-    if type_of w = bool_ty then
-      let id = (inc_goal_id_counter (); !the_goal_id_counter) in
-      null_meta,[((asl,w),id)],
-      (fun inst [th] -> INSTANTIATE_ALL inst th)
-    else failwith "mk_goalstate: Non-boolean goal";;
-
-let (xTAC_PROOF : goal * xtactic -> thm) =
-  fun (g,tac) ->
-    let gstate = mk_xgoalstate g in
-    let _,sgs,just = xby tac gstate in
-    if sgs = [] then just null_inst []
-    else failwith "TAC_PROOF: Unsolved goals";;
-
-let xprove(t,tac) =
-  let th = xTAC_PROOF(([],t),tac) in
-  let t' = concl th in
-  let th' =
-    if t' = t then th else
-    try EQ_MP (ALPHA t' t) th
-    with Failure _ -> failwith "prove: justification generated wrong theorem" 
in
-  mk_xthm (th', ("<tactic-proof>",[]))
-
-(* ------------------------------------------------------------------------- *)
-(* Subgoal package for xgoals.                                               *)
-(* ------------------------------------------------------------------------- *)
-
-let current_xgoalstack = ref ([] :xgoalstack);;
-
-let (xrefine:xrefinement->xgoalstack) =
-  fun r ->
-    let l = !current_xgoalstack in
-    let h = hd l in
-    let res = r h :: l in
-    current_xgoalstack := res;
-    !current_xgoalstack;;
-
-let flush_xgoalstack() =
-  let l = !current_xgoalstack in
-  current_xgoalstack := [hd l];;
-
-let xe tac = xrefine(xby(xVALID tac));;
-
-let xr n = xrefine(xrotate n);;
-
-let xset_goal(asl,w) =
-  current_xgoalstack :=
-    [mk_xgoalstate(map (fun t -> "",ASSUME t) asl,w)];
-  !current_xgoalstack;;
-
-let xg t =
-  let fvs = sort (<) (map (fst o dest_var) (frees t)) in
-  (if fvs <> [] then
-     let errmsg = end_itlist (fun s t -> s^", "^t) fvs in
-     warn true ("Free variables in goal: "^errmsg)
-   else ());
-   xset_goal([],t);;
-
-let xb() =
-  let l = !current_xgoalstack in
-  if length l = 1 then failwith "Can't back up any more" else
-  current_xgoalstack := tl l;
-  !current_xgoalstack;;
-
-let xp() =
-  !current_xgoalstack;;
-
-let xtop_realgoal() =
-  let (_,(((asl,w),_)::_),_)::_ = !current_xgoalstack in
-  asl,w;;
-
-let xtop_goal() =
-  let asl,w = xtop_realgoal() in
-  map (concl o snd) asl,w;;
-
-let xtop_thm() =
-  let (_,[],f)::_ = !current_xgoalstack in
-  mk_xthm (f null_inst [], ("<tactic-proof>",[]));;
-
-(* ------------------------------------------------------------------------- *)
-(* Install the goal-related printers.                                        *)
-(* ------------------------------------------------------------------------- *)
-
-#install_printer print_xgoal;;
-#install_printer print_xgoalstack;;
diff --git a/hol-light/TacticRecording/xthm.ml 
b/hol-light/TacticRecording/xthm.ml
deleted file mode 100644
index 97fcec5741..0000000000
--- a/hol-light/TacticRecording/xthm.ml
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
-(* ** DATATYPE ** *)
-
-
-(* The 'xthm' datatype *)
-
-(* This couples a theorem with an 'mldata' representation of its proof.  For  
*)
-(* named ML objects, this 'mldata' will simply be the ML name of the theorem. 
*)
-(* For rule applications, it will capture the rule and its arguments.         
*)
-
-type xthm = thm * mldata;;
-
-type xconv = term -> xthm;;
-
-
-(* Constructors and destructors *)
-
-let mk_xthm (xth:thm*mldata) : xthm = xth;;
-
-let mk_xthm0 x th = mk_xthm (th, (x,[]));;
-
-let dest_xthm ((th,prf):xthm) : thm * mldata = (th,prf);;
-
-let xthm_thm ((th,_):xthm) = th;;
-
-let xthm_proof ((_,prf):xthm) = prf;;
-
-let name_xthm x ((th,_):xthm) : xthm = (th, (x,[]));;
-
-
-
-(* ** INSTALL PRINTERS ** *)
-
-
-let print_xthm ((th,_):xthm) = print_thm th;;
-
-#install_printer print_xthm;;
-
diff --git a/hol-light/example.ml b/hol-light/example.ml
deleted file mode 100644
index 7010fbc226..0000000000
--- a/hol-light/example.ml
+++ /dev/null
@@ -1,19 +0,0 @@
-(*
-    Example proof script for HOL Proof General.
-
-    $Id$
-*)    
-
-g `A /\ B ==> B /\ A`;;
-e DISCH_TAC;;
-e CONJ_TAC;;
-e (ASM_SIMP_TAC[]);;
-e (ASM_SIMP_TAC[]);;
-let and_comms = top_thm();;
-
-g `A /\ B ==> B /\ A`;;
-e DISCH_TAC;;
-e CONJ_TAC;;
-e (ASM_SIMP_TAC[]);;
-e (ASM_SIMP_TAC[]);;
-let and_comms2 = top_thm();;
diff --git a/hol-light/hol-light-autotest.el b/hol-light/hol-light-autotest.el
deleted file mode 100644
index dab2c4c4a9..0000000000
--- a/hol-light/hol-light-autotest.el
+++ /dev/null
@@ -1,42 +0,0 @@
-;;; hol-light-autotest.el --- tests of HOL Light Proof General.
-
-;; This file is part of Proof General.
-
-;; Portions © Copyright 1994-2012  David Aspinall and University of Edinburgh
-;; Portions © Copyright 2003, 2012, 2014, 2018  Free Software Foundation, Inc.
-;; Portions © Copyright 2001-2017  Pierre Courtieu
-;; Portions © Copyright 2010, 2016  Erik Martin-Dorel
-;; Portions © Copyright 2011-2013, 2016-2017  Hendrik Tews
-;; Portions © Copyright 2015-2017  Clément Pit-Claudel
-
-;;; Commentary:
-;;
-;; You can run these by issuing "make test.hol-light" in PG home dir.
-;;
-
-;;; Code:
-
-(require 'proof-site)
-(proof-ready-for-assistant 'hol-light)
-
-(require 'pg-autotest)
-
-(unless (bound-and-true-p byte-compile-current-file)
-  
-  (pg-autotest start 'debug)
-  (pg-autotest log ".autotest.log")  ; convention
-
-  (pg-autotest timestart 'total)
-
-  (pg-autotest remark "Testing standard examples...")
-
-  (pg-autotest script-wholefile "hol-light/example.ml")
-
-  (proof-shell-wait)
-
-
-  (pg-autotest remark "Complete.")
-
-  (pg-autotest timetaken 'total)
-
-  (pg-autotest exit))
diff --git a/hol-light/hol-light-unicode-tokens.el 
b/hol-light/hol-light-unicode-tokens.el
deleted file mode 100644
index 7e24e4b155..0000000000
--- a/hol-light/hol-light-unicode-tokens.el
+++ /dev/null
@@ -1,252 +0,0 @@
-;;; coq-unicode-tokens.el --- (No) Tokens for Unicode Tokens package -*- 
coding: utf-8; -*-
-
-;; This file is part of Proof General.
-
-;; Portions © Copyright 1994-2012  David Aspinall and University of Edinburgh
-;; Portions © Copyright 2003, 2012, 2014  Free Software Foundation, Inc.
-;; Portions © Copyright 2001-2017  Pierre Courtieu
-;; Portions © Copyright 2010, 2016  Erik Martin-Dorel
-;; Portions © Copyright 2011-2013, 2016-2017  Hendrik Tews
-;; Portions © Copyright 2015-2017  Clément Pit-Claudel
-
-;; Author:    David Aspinall <David.Aspinall@ed.ac.uk>
-
-;;; Commentary:
-;;
-;; This file is loaded by `proof-unicode-tokens.el'.
-;;
-;; It sets the variables defined at the top of unicode-tokens.el,
-;; unicode-tokens-<foo> is set from hol-light-<foo>.  See the corresponding
-;; variable for documentation.
-;;
-;; For HOL Light, there is no dedicated token syntax, we simply
-;; define replacements for common ASCII sequences.
-;; 
-;; FIXME TODO: 
-;;  - only do it for quoted text
-;;  - fix unicode tokens sorting so longs tokens handled first (broken?)
-;;      <=> not <= >
-
-;;; Code:
-
-(require 'proof-unicode-tokens)
-
-(defconst hol-light-token-format "%s") ; plain tokens
-(defconst hol-light-token-match nil)
-(defconst hol-light-hexcode-match nil)
-
-(defun hol-light-unicode-tokens-set (sym val)
-  "Change a Unicode Tokens configuration variable and restart."
-  (set-default sym val)
-  (when (featurep 'hol-light-unicode-tokens) ; not during loading
-    (proof-unicode-tokens-configure)))
-
-(defcustom hol-light-token-symbol-map
-  '(;; Greek letters
-    ("alpha" "α")
-    ("beta" "β")
-    ("gamma" "γ")
-    ("delta" "δ")
-    ("epsilon" "ε")
-    ("zeta" "ζ")
-    ("eta" "η")
-    ("theta" "θ")
-    ("iota" "ι")
-    ("kappa" "κ")
-    ("lambda" "λ")
-    ("mu" "μ")
-    ("nu" "ν")
-    ("xi" "ξ")
-    ("pi" "π")
-    ("rho" "ρ")
-    ("sigma" "σ")
-    ("tau" "τ")
-    ("upsilon" "υ")
-    ("phi" "ϕ")
-    ("chi" "χ")
-    ("psi" "ψ")
-    ("omega" "ω")
-    ("Gamma" "Γ")
-    ("Delta" "Δ")
-    ("Theta" "Θ")
-    ("Lambda" "Λ")
-    ("Xi" "Ξ")
-    ("Pi" "Π")
-    ("Sigma" "Σ")
-    ("Upsilon" "Υ")
-    ("Phi" "Φ")
-    ("Psi" "Ψ")
-    ("Omega" "Ω")
-    ;; logic
-    ("forall" "∀")
-    ("exists" "∃")
-    ("num" "ℕ" type) ;; ?
-    ("complex" "ℂ" type)
-    ("real" "ℝ" type)
-    ("int" "ℤ" type)
-    ("rat" "ℚ" type)
-    ("bool" "B" underline type)
-    ("false" "false" bold sans)
-    ("true" "true" bold sans)
-
-    ("lhd" "⊲")
-    ("rhd" "⊳")
-    ("<=" "≤")
-    (">=" "≥")
-    ("=>" "⇒")
-    ("->" "→")  ; or ⟶ or ⟹ if you prefer
-    ("<-" "←")  ; or ⟵ or ⟸ 
-    ("<->" "↔") ; or ⟷ ...
-    ("++" "⧺")
-    ("<<" "《")
-    (">>" "》")
-
-    ;; Equivalence
-    ("===" "≡") ; equiv
-    ("=/=" "≢")  ; complement equiv
-    ("=~=" "≅") ; pequiv
-    ("==b" "≡") ; NB: same presentation
-    ("<>b" "≢") ; NB: same presentation
-    
-    ("-->" "⟹-") ; Morphisms
-    ("++>" "⟹+") ; 
-    ("==>" "⟹") ; 
-
-    (":=" "≔")
-    ("|-" "⊢")
-    ("<>" "≠")
-    ("-|" "⊣")
-    ("\\/" "∨")
-    ("/\\" "∧")
-    ("~"  "¬")
-    )
-  ;; an alist of token name, unicode char sequence
-  "Table mapping Coq tokens to Unicode strings.
-
-You can adjust this table to add entries, or to change entries for
-glyphs that not are available in your Emacs or chosen font.
-
-When a file is visited, tokens are replaced by the strings
-in this table.  When the file is saved, the reverse is done.
-The string mapping can be anything, but should be such that
-tokens can be uniquely recovered from a decoded text; otherwise
-results will be undefined when files are saved."
-  :type 'unicode-tokens-token-symbol-map
-  :set 'hol-light-unicode-tokens-set
-  :group 'coq
-  :tag "Coq Unicode Token Mapping")
-
-(defcustom hol-light-shortcut-alist
-  '(; short cut, REAL unicode string
-    ("<>" . "⋄")
-    ("|>" . "⊳")
-    ("\\/" . "∨")
-    ("/\\" . "∧")
-    ("+O" . "⊕")
-    ("-O" . "⊖")
-    ("xO" . "⊗")
-    ("/O" . "⊘")
-    (".O" . "⊙")
-    ("|+" . "†")
-    ("|++" . "‡")
-    ("<=" . "≤")
-    ("|-" . "⊢")
-    (">=" . "≥")
-    ("-|" . "⊣")
-    ("||" . "∥")
-    ("==" . "≡")
-    ("~=" . "≃")
-    ("~~~" . "≍")
-    ("~~" . "≈")
-    ("~==" . "≅")
-    ("|<>|" . "⋈")
-    ("|=" . "⊨")
-    ("=." . "≐")
-    ("_|_" . "⊥")
-    ("</" . "≮")
-    (">=/" . "≱")
-    ("=/" . "≠")
-    ("==/" . "≢")
-    ("~/" . "≁")
-    ("~=/" . "≄")
-    ("~~/" . "≉")
-    ("~==/" . "≇")
-    ("<-" . "←")
-    ("<=" . "⇐")
-    ("->" . "→")
-    ("=>" . "⇒")
-    ("<->" . "↔")
-    ("<=>" . "⇔")
-    ("|->" . "↦")
-    ("<--" . "⟵")
-    ("<==" . "⟸")
-    ("-->" . "⟶")
-    ("==>" . "⟹")
-    ("<==>" . "⟷")
-    ("|-->" . "⟼")
-    ("<--" . "←⎯")
-    ("<-->" . "⟷")
-    ("<<" . "⟪")
-    ("[|" . "⟦")
-    (">>" . "⟫")
-    ("|]" . "⟧")
-    ("``" . "”")
-    ("''" . "“")
-    ("--" . "–")
-    ("---" . "—")
-    ("''" . "″")
-    ("'''" . "‴")
-    ("''''" . "⁗")
-    (":=" . "≔")
-    ;; some word shortcuts, started with backslash otherwise
-    ;; too annoying, perhaps.
-    ("\\int" . "ℤ")
-    ("\\rat" . "ℚ")
-    ("\\complex" . "ℂ")
-    ("\\euro" . "€")
-    ("\\yen" . "¥")
-    ("\\cent" . "¢"))
-  "Shortcut key sequence table for Unicode strings.
-
-You can adjust this table to add more entries, or to change entries for
-glyphs that not are available in your Emacs or chosen font.
-
-These shortcuts are only used for input; no reverse conversion is
-performed.  This means that the target strings need to have a defined
-meaning to be useful."
-  :type '(repeat (cons (string :tag "Shortcut sequence")
-                      (string :tag "Unicode string")))
-  :set 'hol-light-unicode-tokens-set
-  :group 'coq
-  :tag "Coq Unicode Input Shortcuts")
-
-
-;;
-;; Controls
-;;
-
-(defconst hol-light-control-char-format-regexp
-  ;; FIXME: fix Coq identifier syntax below
-  "\\(\s*%s\s*\\)\\([a-zA-Z0-9']+\\)")
-
-(defconst hol-light-control-char-format " %s ")
-
-(defconst hol-light-control-characters
-  '(("Subscript" "__" sub)
-    ("Superscript" "^^" sup)))
-
-(defconst hol-light-control-region-format-regexp 
"\\(\s*%s\{\\)\\([^}]*\\)\\(\}\s*\\)")
-
-(defconst hol-light-control-regions
-  '(("Subscript" "," "" sub)
-    ("Superscript" "^" "" sup)
-    ("Bold" "BOLD" "" bold)
-    ("Italic" "ITALIC" "" italic)
-    ("Script" "SCRIPT" "" script)
-    ("Frakt"  "FRACT" "" frakt)
-    ("Roman"  "ROMAN" "" serif)))
-
-
-(provide 'hol-light-unicode-tokens)
-
-;;; hol-light-unicode-tokens.el ends here
diff --git a/hol-light/hol-light.el b/hol-light/hol-light.el
deleted file mode 100644
index 808e04a9c1..0000000000
--- a/hol-light/hol-light.el
+++ /dev/null
@@ -1,519 +0,0 @@
-;;; hol-light.el --- Basic Proof General instance for HOL Light
-
-;; This file is part of Proof General.
-
-;; Portions © Copyright 1994-2012  David Aspinall and University of Edinburgh
-;; Portions © Copyright 2003-2018  Free Software Foundation, Inc.
-;; Portions © Copyright 2001-2017  Pierre Courtieu
-;; Portions © Copyright 2010, 2016  Erik Martin-Dorel
-;; Portions © Copyright 2011-2013, 2016-2017  Hendrik Tews
-;; Portions © Copyright 2015-2017  Clément Pit-Claudel
-
-;; Author: David Aspinall <David.Aspinall@ed.ac.uk>
-;;         Mark Adams <mark@proof-technologies.com>
-
-;;; Commentary:
-;;
-;; See the README file in this directory for information.
-;;
-
-;;; Code:
-
-(require 'proof-easy-config)            ; easy configure mechanism
-(require 'proof-syntax)                        ; functions for making regexps
-
-(proof-try-require 'caml-font)            ; use OCaml Emacs mode syntax 
-
-(eval-when-compile
-  (require 'proof-tree))
-
-(defcustom hol-light-home 
-  (or (getenv "HOLLIGHT_HOME")
-      (concat (getenv "HOME") "/hol_light"))
-  "*Directory holding the local installation of HOL Light."
-  :type 'string
-  :group 'hol-light)
-
-(defcustom hol-light-prog-name 
-  (or (getenv "HOLLIGHT_OCMAL")
-      (getenv "OCAML")
-      "ocaml")
-  "*Name of the OCaml interpreter to launch HOL Light."
-  :type 'string
-  :group 'hol-light)
-
-(defcustom hol-light-use-custom-toplevel t
-  "*If non-nil, we use a custom toplevel for Proof General.
-This configures extra annotations inside HOL Light to help
-recognise portions of output from the proof assistant.
-
-If this is incompatible with your usage of HOL Light for
-some reason, you can change this setting to run in a
-degraded (less robust) way which interfaces with the
-standard top level.
-
-You need to restart Emacs if you change this setting."
-  :type 'boolean
-  :group 'hol-light)
-
-(defconst hol-light-pre-sync-cmd
-  (format "#use \"%shol-light/pg_prompt.ml\";; " proof-home-directory)
-  "Command used to configure prompt annotations for Proof General.")
-
-(defcustom hol-light-init-cmd 
-  (append
-   (list (format "#cd \"%s\"" hol-light-home)
-        "#use \"hol.ml\"")
-   (if hol-light-use-custom-toplevel
-       (list (format "#use \"%shol-light/pg_tactics.ml\""
-                    proof-home-directory))
-     (list
-  "let rec pg_repeat f n = match n with 0 -> () | _ -> (f(); pg_repeat f 
(n-1));;"
-  "let pg_undo n = (pg_repeat n (fun ()->let _ = b() in ()); p());;"
-  "let pg_kill() = current_goalstack:=[];;"
-  "let pg_forget id = ();;"
-  "let pg_restart() = print_string \"*** Session restarted.\";;")))
-  "*Commands used to start up a running HOL Light session."
-  :type '(list string)
-  :group 'hol-light)
-
-;;
-;; Regular expressions for matching output with  
-;; standard or custom top levels
-;;
-
-(defconst hol-light-plain-start-goals-regexp
-  (concat
-  "^\\(val it : x?goalstack = \\)"
-  "\\(?:.+\n\\)*"
-  "\\(?:[0-9]*[0-9] subgoals? ([0-9]+ total)\\|No subgoals\\)")
-  "Value for `proof-shell-start-goals-regexp' with standard top level.")
-
-(defconst hol-light-annotated-start-goals-regexp 
-  hol-light-plain-start-goals-regexp
-  "Value for `proof-shell-start-goals-regexp' with custom top level.")
-
-(defconst hol-light-plain-interrupt-regexp
-  "Interrupted"
-  "Value for `proof-shell-interrupt-regexp' with standard top level.")
-
-(defconst hol-light-annotated-interrupt-regexp
-  hol-light-plain-interrupt-regexp ;; TODO
-  "Value for `proof-shell-interrupt-regexp' with custom top level.")  
-
-(defconst hol-light-plain-prompt-regexp
-  "\\(val it : unit = ()\n\\)?^# "
-  "Value for `proof-shell-annotated-prompt-regexp' with standard top level.")
-
-(defconst hol-light-annotated-prompt-regexp
-  "\\(val it : unit = ()\n\\)?<prompt>.*</prompt>"
-  "Value for `proof-shell-annotated-prompt-regexp' with custom top level.")
-
-(defconst hol-light-plain-error-regexp
-  (proof-regexp-alt "Characters [0-9]+-[0-9]+:" 
-                   "^Exception: Failure"
-                   "^Parse error: "
-                   "^Cannot find file"
-                   "^Error: Unbound value"
-                   "^Error: Syntax error"
-                   ;; TODO: more here
-                   )
-  "Value for `proof-shell-error-regexp' with standard top level.")
-
-(defconst hol-light-annotated-error-regexp 
-  ;; "<error>.+</error>" ;; unfortunately not enough, this is only for failwith
-  hol-light-plain-error-regexp
-  "Value for `proof-shell-error-regexp' with custom top level.")
-
-(defconst hol-light-plain-proof-completed-regexp
-   "Initial goal proved"
-   "Value for `proof-shell-proof-completed-regexp' with standard top level.")
-
-(defconst hol-light-annotated-proof-completed-regexp
-  hol-light-plain-proof-completed-regexp ;; TODO
-   "Value for `proof-shell-proof-completed-regexp' with standard top level.")
-
-(defconst hol-light-plain-message-start 
-  "^Warning \\|\\*\*\\*"
-  "Value for `proof-shell-eager-annotation-start' with standard top level.")
-
-(defconst hol-light-annotated-message-start
-  "^Warning \\|\\*\\*\\*" ;; TODO
-  "Value for `proof-shell-eager-annotation-start' with custom top level.")
-
-(defconst hol-light-plain-message-end
-  "\n" ;; TODO
-  "Value for `proof-shell-eager-annotation-start' with standard top level.")
-
-(defconst hol-light-annotated-message-end
-  "\n" ;; TODO
-  "Value for `proof-shell-eager-annotation-start' with custom top level.")
-  
-
-;;;
-;;; State 
-;;;
-
-(defvar hol-light-keywords nil)
-(defvar hol-light-rules nil)
-(defvar hol-light-tactics nil)
-(defvar hol-light-tacticals nil)
-
-
-;;;
-;;; Main configuration
-;;;
-
-(proof-easy-config  'hol-light "HOL Light"
- proof-assistant-home-page       "https://www.cl.cam.ac.uk/~jrh13/hol-light/";
- proof-prog-name                hol-light-prog-name
- proof-terminal-string           ";;"
- proof-shell-pre-sync-init-cmd   hol-light-pre-sync-cmd
- proof-shell-init-cmd            hol-light-init-cmd
-
- ;; Regexps for matching tactic script inputs: all approximations, of course.
- proof-goal-command-regexp             "^g[ `]"
- proof-save-command-regexp             "top_thm()"
- proof-goal-with-hole-regexp           "let \\(\\([^ \t=]*\\)\\)[ \t]*=[ 
\t]*prove"
- proof-save-with-hole-regexp           "let \\(\\([^ \t=]*\\)\\)[ \t]*=[ 
\t]*top_thm()"
- proof-non-undoables-regexp            "b()" ; and others..
- proof-goal-command                    "g `%s`;;"
- proof-save-command                    "val %s = top_thm();;"
- proof-kill-goal-command               "pg_kill();;"
- proof-undo-n-times-cmd                "pg_undo %s;;"
- proof-forget-id-command       "pg_forget \"%s\";;"
- proof-shell-restart-cmd        "pg_restart();;"
- proof-showproof-command               "p();;"
- proof-auto-multiple-files             t
- proof-shell-cd-cmd                    "#cd \"%s\";;"
- proof-shell-filename-escapes          '(("\\\\" . "\\\\") ("\""   . "\\\""))
-
- proof-shell-annotated-prompt-regexp (if hol-light-use-custom-toplevel
-                                        hol-light-annotated-prompt-regexp
-                                      hol-light-plain-prompt-regexp)
-
- proof-shell-interrupt-regexp        (if hol-light-use-custom-toplevel
-                                        hol-light-annotated-interrupt-regexp
-                                      hol-light-plain-interrupt-regexp)
-
- proof-shell-start-goals-regexp      (if hol-light-use-custom-toplevel
-                                        hol-light-annotated-start-goals-regexp
-                                      hol-light-plain-start-goals-regexp)
-
- proof-shell-error-regexp           (if hol-light-use-custom-toplevel
-                                        hol-light-annotated-error-regexp
-                                      hol-light-plain-error-regexp)
-
- proof-shell-proof-completed-regexp  (if hol-light-use-custom-toplevel
-                                        
hol-light-annotated-proof-completed-regexp
-                                      hol-light-plain-proof-completed-regexp)
-
- proof-shell-eager-annotation-start  (if hol-light-use-custom-toplevel
-                                        hol-light-annotated-message-start
-                                      hol-light-plain-message-start)
-
- proof-shell-eager-annotation-end    (if hol-light-use-custom-toplevel
-                                        hol-light-annotated-message-end
-                                      hol-light-plain-message-end)
-
- 
- ;; FIXME: add optional help topic parameter to help command.
- proof-info-command                "help \"hol\""
-
- ;; FIXME: next one needs setting so that "urgent" messages are displayed
- ;; eagerly from HOL.
- ;; proof-shell-eager-annotation-start
- proof-find-theorems-command   "DB.match [] (%s);;"
-
- ;;
- ;; Syntax and syntax table entries for proof scripts
- ;;
- proof-script-comment-start      "(*"
- proof-script-comment-end        "*)"
- proof-script-syntax-table-entries
- '(?\` "\""
-   ?\$ "."
-   ?\/ "."
-   ?\\ "."
-   ?+  "."
-   ?-  "."
-   ?=  "."
-   ?%  "."
-   ?<  "."
-   ?>  "."
-   ?\& "."
-   ?.  "w"
-   ?_  "w"
-   ?\' "w"
-   ?\| "."
-   ?\* ". 23n"
-   ?\( "()1"
-   ?\) ")(4")
-
- ;;
- ;; A few of the vast variety of keywords, tactics, tacticals,
- ;; for decorating proof scripts.
- ;;
- ;; In the future, PG will use a mechanism for passing identifier
- ;; lists like this from the proof assistant, we don't really
- ;; want to duplicate all this information here!
- ;;
- hol-light-keywords  '("g" "expand" "e" "store_thm" "top_thm" "by"
-                      "Define" "xDefine" "Hol_defn"
-                      "Induct" "Cases" "Cases_on" "Induct_on"
-                      "std_ss" "arith_ss" "list_ss"
-                      "define_type")
-
- hol-light-rules        
- '("REFL" "TRANS" "MK_COMB" "ABS" "BETA" "BETA_CONV"
-   "ASSUME" "EQ_MP" "DEDUCT_ANTISYM_RULE" "INST_TYPE" "INST"
-   "TRUTH" "CONJ" "CONJUNCT1" "CONJUNCT2" "PINST" "PROVE_HYP"
-   "T_DEF" "TRUTH" "EQT_ELIM" "EQT_INTRO" "AND_DEF" "CONJ"
-   "CONJUNCT1" "CONJUNCT2" "CONJ_PAIR" "CONJUNCTS" "IMP_DEF" "MP"
-   "DISCH" "DISCH_ALL" "UNDISCH" "UNDISCH_ALL" "IMP_ANTISYM_RULE" "ADD_ASSUM"
-   "EQ_IMP_RULE" "IMP_TRANS" "FORALL_DEF" "SPEC" "SPECL" "SPEC_VAR"
-   "SPEC_ALL" "ISPEC" "ISPECL" "GEN" "GENL" "GEN_ALL"
-   "EXISTS_DEF" "EXISTS" "SIMPLE_EXISTS" "CHOOSE" "SIMPLE_CHOOSE" "OR_DEF"
-   "DISJ1" "DISJ2" "DISJ_CASES" "SIMPLE_DISJ_CASES" "F_DEF" "NOT_DEF"
-   "NOT_ELIM" "NOT_INTRO" "EQF_INTRO" "EQF_ELIM" "CONTR" "EXISTS_UNIQUE_DEF"
-   "EXISTENCE"
-   "EQ_REFL" "REFL_CLAUSE" "EQ_SYM" "EQ_SYM_EQ" "EQ_TRANS"
-   "AC" "BETA_THM" "ABS_SIMP" "CONJ_ASSOC" "CONJ_SYM"
-   "CONJ_ACI" "DISJ_ASSOC" "DISJ_SYM" "DISJ_ACI" "IMP_CONJ"
-   "IMP_IMP" "IMP_CONJ_ALT" "LEFT_OR_DISTRIB" "RIGHT_OR_DISTRIB" "FORALL_SIMP"
-   "EXISTS_SIMP" "EQ_IMP" "EQ_CLAUSES" "NOT_CLAUSES_WEAK" "AND_CLAUSES"
-   "OR_CLAUSES" "IMP_CLAUSES" "IMP_EQ_CLAUSE" "EXISTS_UNIQUE_THM" "EXISTS_REFL"
-   "EXISTS_UNIQUE_REFL" "UNWIND_THM1" "UNWIND_THM2" "FORALL_UNWIND_THM2" 
"FORALL_UNWIND_THM1"
-   "SWAP_FORALL_THM" "SWAP_EXISTS_THM" "FORALL_AND_THM" "AND_FORALL_THM" 
"LEFT_AND_FORALL_THM"
-   "RIGHT_AND_FORALL_THM" "EXISTS_OR_THM" "OR_EXISTS_THM" "LEFT_OR_EXISTS_THM" 
"RIGHT_OR_EXISTS_THM"
-   "LEFT_EXISTS_AND_THM" "RIGHT_EXISTS_AND_THM" "TRIV_EXISTS_AND_THM" 
-   "LEFT_AND_EXISTS_THM" "RIGHT_AND_EXISTS_THM"
-   "TRIV_AND_EXISTS_THM" "TRIV_FORALL_OR_THM" 
-   "TRIV_OR_FORALL_THM" "RIGHT_IMP_FORALL_THM" "RIGHT_FORALL_IMP_THM"
-   "LEFT_IMP_EXISTS_THM" "LEFT_FORALL_IMP_THM" "TRIV_FORALL_IMP_THM" 
-   "TRIV_EXISTS_IMP_THM" "EXISTS_UNIQUE_ALT" "EXISTS_UNIQUE")
-
- hol-light-tactics   
- '("ABS_TAC" "ACCEPT_TAC" "ALL_TAC" "ANTS_TAC" "AP_TERM_TAC"
-   "AP_THM_TAC" "ASSUME_TAC" "BETA_TAC" "BINOP_TAC" "CHANGED_TAC"
-   "CHEAT_TAC" "CHOOSE_TAC" "CONJ_TAC" "CONTR_TAC" "CONV_TAC"
-   "DISCARD_TAC" "DISCH_TAC" "DISJ1_TAC" "DISJ2_TAC" "DISJ_CASES_TAC"
-   "EQ_TAC" "EXISTS_TAC" "FAIL_TAC" "GEN_TAC" "LABEL_TAC"
-   "MATCH_ACCEPT_TAC" "MATCH_MP_TAC " "META_EXISTS_TAC" "META_SPEC_TAC" 
"MK_COMB_TAC"
-   "MP_TAC" "NO_TAC" "RECALL_ACCEPT_TAC" "REFL_TAC" "REPLICATE_TAC"
-   "RULE_ASSUM_TAC " "SPEC_TAC" "STRIP_ASSUME_TAC" "STRIP_GOAL_THEN" 
"STRIP_TAC"
-   "STRUCT_CASES_TAC" "SUBGOAL_TAC" "SUBST1_TAC" "SUBST_ALL_TAC" 
"SUBST_VAR_TAC"
-   "UNDISCH_TAC" "X_CHOOSE_TAC" "X_GEN_TAC" "X_META_EXISTS_TAC")
-
- hol-light-tacticals 
- '("ORELSE" "FIRST" "CHANGED_TAC" "THEN" "THENL" 
-   "EVERY" "REPEAT" "MAP_EVERY"
-   "IMP_RES_THEN"
-   "FIND_ASSUM" "POP_ASSUM" "ASSUM_LIST" "EVERY_ASSUM" "FIRST_ASSUM"
-   "CONJUCTS_THEN" "DISJ_CASES_THEN" "DISCH_THEN" "X_CHOOSE_THEN" "MAP_EVERY"
-   "CHOOSE_THEN" "STRIP_THM_THEN" "SUBGOAL_THEN" "FREEZE_THEN")
-
- proof-script-font-lock-keywords
- (append
-  (bound-and-true-p caml-font-lock-keywords)
-  (list
-   (cons (proof-ids-to-regexp hol-light-keywords) 'font-lock-keyword-face)
-   (cons (proof-ids-to-regexp hol-light-tactics) 'proof-tactics-name-face)
-   (cons (proof-ids-to-regexp hol-light-rules) 'font-lock-keyword-face)
-   (cons (proof-ids-to-regexp hol-light-tacticals) 
'proof-tacticals-name-face)))
-
- ;;
- ;; Some decoration of the goals output [FIXME: not yet HOL Light]
- ;;
- proof-goals-font-lock-keywords
- (list
-  (cons (proof-ids-to-regexp '("Proof manager status"
-                              "proof" "Incomplete"
-                              "Initial goal proved"
-                              "Initial goal"
-                              "There are currently no proofs"
-                              "OK"))
-       'font-lock-keyword-face)
-  (cons (regexp-quote "------------------------------------")
-       'font-lock-comment-face)
-  (cons ": GoalstackPure.goalstack" 'proof-boring-face)
-  (cons ": GoalstackPure.proofs"    'proof-boring-face)
-  (cons ": Thm.thm"                'proof-boring-face)
-  (cons "val it ="                 'proof-boring-face))
-
- ;;
- ;; Some decoration of the response output
- ;;
- proof-goals-font-lock-keywords
- (setq 
-  proof-goals-font-lock-keywords
-  (list
-   ;; Help system output
-   (cons (proof-ids-to-regexp 
-         '("^----------[-]+$"
-           "SYNOPSIS" "DESCRIPTION" "FAILURE CONDITIONS"
-           "EXAMPLES" "SEE ALSO"))
-        'font-lock-keyword-face)
-   (cons ": GoalstackPure.goalstack" 'proof-boring-face)
-   (cons ": GoalstackPure.proofs"    'proof-boring-face)
-   (cons ": Thm.thm"               'proof-boring-face)
-   (cons "val it ="                'proof-boring-face)))
-
- ;; End of easy config.
- )
-
-
-;;;
-;;; Prooftree configuration  (experimental, ongoing)
-;;;
-
-;; regexps for recognising additional markup in output
-
-(defvar hol-light-update-goal-regexp 
-  (concat "\\[Goal ID \\([0-9]+\\)\\]"
-         "\\s-*\n\\(\\(?:.+\n\\)*\\)\\(?:\n\\|$\\)"))
-
-(defconst hol-light-current-goal-regexp
-  ;; match final (focused) subgoal.  
-  (concat (regexp-quote "[*]") 
-         "\\[Goal ID \\([0-9]+\\)\\]"
-         "\\s-*\n\\(\\(?:.+\n\\)*\\)\\(?:\n\\|$\\)"))
-         
-(defconst hol-light-additional-subgoal-regexp 
-  "\\[New Goal IDs: \\([0-9 ]+\\)\\]"
-  "HOL Light instance of `proof-tree-additional-subgoal-ID-regexp'.")
-
-(defconst hol-light-statenumber-regexp 
-  "<prompt>\\([0-9]+\\)|\\([0-9]+\\)</prompt>"
-  "Regular expression to match prompt with state numbers.
-The first number is a global state counter which increases with
-processed steps.  The second number is the number of steps within
-the currently open proof.")
-
-(defconst hol-light-existential-regexp "\\(\\?[0-9]+\\)"
-  "Regexp for `proof-tree-existential-regexp'.")
-
-(defconst hol-light-existentials-state-start-regexp "^(dependent evars:"
-  "HOL Light instance of `proof-tree-existentials-state-start-regexp'.")
-
-(defconst hol-light-existentials-state-end-regexp ")\n"
-  "HOL Light instance of `proof-tree-existentials-state-end-regexp'.")
-
-
-(setq 
- ;; These ones belong in script mode config
- proof-tree-configured t
- proof-tree-get-proof-info 'hol-light-get-proof-info
- proof-tree-find-begin-of-unfinished-proof 
-           'hol-light-find-begin-of-unfinished-proof
- ;; These ones belong in shell mode
- proof-tree-branch-finished-regexp "No subgoals"         
- proof-tree-show-sequent-command 
- (lambda (id) (format "print_xgoal_of_id \"%s\";;" id))
-
- proof-tree-current-goal-regexp hol-light-current-goal-regexp
- proof-tree-additional-subgoal-ID-regexp hol-light-additional-subgoal-regexp
- proof-tree-update-goal-regexp hol-light-update-goal-regexp
- proof-tree-cheating-regexp "CHEAT_TAC" ;; others...
-
- proof-tree-existential-regexp hol-light-existential-regexp
- proof-tree-existentials-state-start-regexp 
hol-light-existentials-state-start-regexp
- proof-tree-existentials-state-end-regexp 
hol-light-existentials-state-end-regexp
- ) ;; end setq proof tree stuff
-
-
-
-;;; get proof info: uses last goals output
-;;; FIXME problem here: this is called BEFORE last goals output 
-;;; is set.  Can we move order without harming Coq?
-
-;; TEMP to fix compile.  Will use Coq-stype annotated prompt for proof tree 
now.
-(defvar proof-shell-delayed-output-start nil)
-(defvar proof-shell-delayed-output-end nil)
-(defvar proof-info nil)
-(defvar proof-action-list nil)
-(defun proof-shell-action-list-item (&rest args))
-
-(defconst hol-light-show-sequent-command "print_xgoal_of_id %s;;")
-
-(defun hol-light-get-proof-info ()
-  "Return proof info for Prooftree for HOL Light.
-See `proof-tree-get-proof-info'."
-  (let ((proof-state-number 0)
-       (proof-name         "Goal")) ; no named goals
-
-    (when (and t ; (> proof-nesting-depth 0) ; inside a proof
-              (string-match hol-light-statenumber-regexp 
-               proof-shell-last-prompt))
-      (setq proof-state-number 
-           (string-to-number 
-            (match-string 1 proof-shell-last-prompt))))
-    (list 
-     proof-state-number
-     proof-name)))
-
-(defun hol-light-find-begin-of-unfinished-proof ()
-  ;; Quick hack, we should use some internal proof script stuff here
-  (save-excursion
-    (re-search-backward "^g" nil t)))
-
-
-;;; FIXME: this is duplicated from coq.el.  It might be kind of generic.
-;;; However, for HOL Light the default behaviour is actually to print out
-;;; exactly the new subgoals arising from a previous tactic allocation,
-;;; or the currently focused goal (top of stack).
-
-(defun hol-light-proof-tree-get-new-subgoals ()
-  "Check for new subgoals and issue appropriate Show commands.
-This is a hook function for `proof-tree-urgent-action-hook'. This
-function examines the current goal output and searches for new
-unknown subgoals. Those subgoals have been generated by the last
-proof command and we must send their complete sequent text
-eventually to prooftree. Because subgoals may change with
-the next proof command, we must execute the additionally needed
-Show commands before the next real proof command.
-
-The ID's of the open goals are checked with
-`proof-tree-sequent-hash' in order to find out if they are new.
-For any new goal an appropriate Show Goal command with a
-'proof-tree-show-subgoal flag is inserted into
-`proof-action-list'. Then, in the normal delayed output
-processing, the sequent text is send to prooftree as a sequent
-update (see `proof-tree-update-sequent') and the ID of the
-sequent is registered as known in `proof-tree-sequent-hash'.
-
-The not yet delayed output is in the region
-\[proof-shell-delayed-output-start, proof-shell-delayed-output-end]."
-  ;; (message "CPTGNS start %s end %s"
-  ;;          proof-shell-delayed-output-start
-  ;;          proof-shell-delayed-output-end)
-  (with-current-buffer proof-shell-buffer
-    (let ((start proof-shell-delayed-output-start)
-          (end proof-shell-delayed-output-end))
-      (goto-char start)
-      (while (proof-re-search-forward
-              hol-light-update-goal-regexp end t)
-        (let ((subgoal-id (match-string-no-properties 1)))
-          (unless (gethash subgoal-id proof-tree-sequent-hash)
-            (setq proof-action-list
-                  (cons (proof-shell-action-list-item
-                         (format hol-light-show-sequent-command subgoal-id)
-                         (proof-tree-make-show-goal-callback (car proof-info))
-                         '(no-goals-display
-                           no-response-display
-                           proof-tree-show-subgoal))
-                        proof-action-list))))))))
-  
-(add-hook 'proof-tree-urgent-action-hook 
'hol-light-proof-tree-get-new-subgoals)
-
-
-;;;
-;;; Menu commands
-;;;
-
-(proof-definvisible hol-light-dump-proof "dump_proof();;")
-
-(defpgdefault menu-entries
-  '(["Dump refactored proof" hol-light-dump-proof t]))
-
-(provide 'hol-light)
diff --git a/hol-light/pg_prompt.ml b/hol-light/pg_prompt.ml
deleted file mode 100644
index b14c01ca88..0000000000
--- a/hol-light/pg_prompt.ml
+++ /dev/null
@@ -1,59 +0,0 @@
-(* ========================================================================= *)
-(* HOL Light tweaks for Proof General.                                      *)
-(*                                                                           *)
-(* Mark Adams, David Aspinall.                                              *)
-(* LFCS, School of Informatics, University of Edinburgh                        
     *)
-(*                                                                           *)
-(* (c) Copyright University of Edinburgh and authors, 2012.                  *)
-(*                                                                          *)
-(* This file adjust the OCaml prompt to help Proof General synchronization.  *)
-(* It is loaded before HOL Light.                                           *)
-(* ========================================================================= *)
-
-
-(* ------------------------------------------------------------------------- *)
-(* Proof General mode, providing extra annotations in output                *)
-(* ------------------------------------------------------------------------- *)
-
-let pg_mode = ref (true : bool);;
-
-let pg_mode_on () = (pg_mode := true);;
-let pg_mode_off () = (pg_mode := false);;
-
-let pg_prompt_info = ref (fun () -> "");;
-
-
-(* ------------------------------------------------------------------------- *)
-(* Adjust the OCaml prompt to carry information for Proof General            *)
-(* ------------------------------------------------------------------------- *)
-
-let original_prompt_fn = !Toploop.read_interactive_input in
-(Toploop.read_interactive_input :=
-   fun prompt buffer len ->
-      let prompt' =
-         if (!pg_mode)
-           then "<prompt>" ^
-               (!pg_prompt_info()) ^
-                "</prompt>"
-           else prompt in
-      original_prompt_fn prompt' buffer len);;
-
-
-(* ------------------------------------------------------------------------- *)
-(* Adjust error printing to markup error messages                           *)
-(* ------------------------------------------------------------------------- *)
-
-(* Doesn't really work, as many errors are from OCaml top level and
-   not printed in this way.
-
-let print_exn e =
-    match e with
-      Failure x -> Format.print_string 
-                    (if (!pg_mode) then 
-                        "<error>" ^ x ^ "</error>"
-                     else x)
-    | _  -> Format.print_string (Printexc.to_string e);;
-
-#install_printer print_exn;;
-
-*) 
diff --git a/hol-light/pg_tactics.ml b/hol-light/pg_tactics.ml
deleted file mode 100644
index 2943f461c1..0000000000
--- a/hol-light/pg_tactics.ml
+++ /dev/null
@@ -1,349 +0,0 @@
-(* ========================================================================= *)
-(* HOL Light subgoal package amended for Proof General and Prooftree.        *)
-(*                                                                           *)
-(* Mark Adams, David Aspinall.                                              *)
-(* LFCS, School of Informatics, University of Edinburgh                        
     *)
-(*                                                                           *)
-(* (c) Copyright University of Edinburgh and authors, 2012.                  *)
-(*                                                                          *)
-(* This file contains some functions that are modified from the                
     *)
-(* original HOL Light code, and is therefore subject to the HOL Light       *)
-(* copyright, see the file LICENSE-HOL-LIGHT in this directory.                
     *)
-(*                                                                          *)
-(* ========================================================================= *)
-(*                                                                          *)
-(* This file overwrites HOL Light's subgoal package commands with variants   *)
-(* that output additional annotations specifically for Prooftree.  These get *)
-(* intercepted by Proof General, which removes them from the output          *)
-(* displayed to the Proof General user.                                        
     *)
-
-(* TODO: 
-   1. add urgent message annotations for errors and strings output during
-      long-running tactics
-   2. fix on/off: don't turn off prompt annotation, support Prooftree on/off.
-*)
-
-(* ------------------------------------------------------------------------- *)
-(* Goal counter for providing goal ids.                                      *)
-(* ------------------------------------------------------------------------- *)
-
-type goal_id = int;;
-
-let string_of_goal_id id = string_of_int id;;
-
-let the_goal_counter = ref (0 : goal_id);;
-
-let inc_goal_counter () =
-  (the_goal_counter := !the_goal_counter + 1);;
-
-let reset_goal_counter () =
-  (the_goal_counter := 0;
-   !the_goal_counter);;
-
-(* ------------------------------------------------------------------------- *)
-(* An xgoal extends a goal with an identity.                                 *)
-(* ------------------------------------------------------------------------- *)
-
-type xgoal = goal * goal_id;;
-
-let dest_xgoal (gx : xgoal) = gx;;
-
-(* ------------------------------------------------------------------------- *)
-(* The xgoalstate is like goalstate but for xgoals instead of goals.         *)
-(* ------------------------------------------------------------------------- *)
-
-type xgoalstate = (term list * instantiation) * xgoal list * justification;;
-
-(* ------------------------------------------------------------------------- *)
-(* A goalstack but for xgoals.  Overwrites original HL datatype.             *)
-(* ------------------------------------------------------------------------- *)
-
-type goalstack = xgoalstate list;;
-
-(* ------------------------------------------------------------------------- *)
-(* A refinement but for xgoals.                                              *)
-(* ------------------------------------------------------------------------- *)
-
-type xrefinement = xgoalstate -> xgoalstate;;
-
-(* ------------------------------------------------------------------------- *)
-(* Instantiation of xgoals.                                                  *)
-(* ------------------------------------------------------------------------- *)
-
-let (inst_xgoal:instantiation->xgoal->xgoal) =
-  fun p ((thms,w),id) ->
-    (map (I F_F INSTANTIATE_ALL p) thms,instantiate p w),id;;
-
-(* ------------------------------------------------------------------------- *)
-(* A printer for xgoals and xgoalstacks.                                     *)
-(* ------------------------------------------------------------------------- *)
-
-let the_new_goal_ids = ref ([] : goal_id list);;
-
-let the_tactic_flag = ref false;;
-
-let print_string_seplist sep xs =
-  if (xs = [])
-    then ()
-    else (print_string (hd xs);
-          do_list (fun x -> print_string sep; print_string x) (tl xs));;
-
-let print_xgoal ((g,id) : xgoal) : unit =
-  ((if (!pg_mode)
-      then (print_string ("[Goal ID " ^ string_of_goal_id id ^ "]");
-            print_newline ()));
-   print_goal g);;
-
-let (print_xgoalstack:goalstack->unit) =
-  let print_xgoalstate k gs =
-    let (_,gl,_) = gs in
-    let n = length gl in
-    let s = if n = 0 then "No subgoals" else
-              (string_of_int k)^" subgoal"^(if k > 1 then "s" else "")
-           ^" ("^(string_of_int n)^" total)" in
-    print_string s; print_newline();
-    if gl = [] then () else
-    (do_list (print_xgoal o C el gl) (rev(1--(k-1)));
-     (if (!pg_mode) then print_string "[*]");
-     print_xgoal (el 0 gl)) in
-  fun l ->
-   ((if (!pg_mode) & (!the_tactic_flag)
-       then let xs = map string_of_int (!the_new_goal_ids) in
-            (the_tactic_flag := false;
-             print_string  "[New Goal IDs: ";
-             print_string_seplist " " xs;
-             print_string "]";
-             print_newline ()));
-    (if l = [] then print_string "Empty goalstack"
-     else if tl l = [] then
-       let (_,gl,_ as gs) = hd l in
-       print_xgoalstate 1 gs
-     else
-       let (_,gl,_ as gs) = hd l
-       and (_,gl0,_) = hd(tl l) in
-       let p = length gl - length gl0 in
-       let p' = if p < 1 then 1 else p + 1 in
-       print_xgoalstate p' gs);
-    (if (!pg_mode) then
-     let (vs,theta) =
-        if (l = []) then ([],[])
-                    else let ((vs,(_,theta,_)),_,_) = hd l in
-                         (vs,theta) in
-     let foo v =
-        let (x,_) = dest_var v in
-        "?" (* FIXME: Coq syntax for meta vars is expected by Prooftree *)
-        ^ x ^ if (can (rev_assoc v) theta) then " using" else " open" in
-     let xs = map foo vs in
-     (print_newline();
-      print_string "(dependent evars:";
-      if xs != [] then 
-       (print_string " ";
-       print_string_seplist ", " xs;
-       print_string ",");
-      print_string ")";
-      print_newline ())));;
-
-(* ------------------------------------------------------------------------- *)
-(* Goal labelling, for fresh xgoals.                                         *)
-(* ------------------------------------------------------------------------- *)
-
-let label_goals (gs : goal list) : xgoal list =
-  let gxs = map (fun g -> inc_goal_counter (); (g, !the_goal_counter))
-                gs in
-  (the_new_goal_ids := map snd gxs;
-   gxs);;
-
-(* ------------------------------------------------------------------------- *)
-(* Version of 'by' for xrefinements.                                         *)
-(* ------------------------------------------------------------------------- *)
-
-let (xby:tactic->xrefinement) =
-  fun tac ((mvs,inst),glsx,just) ->
-    let gx = hd glsx
-    and oglsx = tl glsx in
-    let (g,id) = dest_xgoal gx in
-    let ((newmvs,newinst),subgls,subjust) = tac g in
-    let subglsx = label_goals subgls in
-    let n = length subglsx in
-    let mvs' = union newmvs mvs
-    and inst' = compose_insts inst newinst
-    and glsx' = subglsx @ map (inst_xgoal newinst) oglsx in
-    let just' i ths =
-      let i' = compose_insts inst' i in
-      let cths,oths = chop_list n ths in
-      let sths = (subjust i cths) :: oths in
-      just i' sths in
-    (mvs',inst'),glsx',just';;
-
-(* ------------------------------------------------------------------------- *)
-(* Rotate but for xgoalstate.  Only change is different ML datatype.         *)
-(* ------------------------------------------------------------------------- *)
-
-let (xrotate:int->xrefinement) =
-  let rotate_p (meta,sgs,just) =
-    let sgs' = (tl sgs)@[hd sgs] in
-    let just' i ths =
-      let ths' = (last ths)::(butlast ths) in
-      just i ths' in
-    (meta,sgs',just')
-  and rotate_n (meta,sgs,just) =
-    let sgs' = (last sgs)::(butlast sgs) in
-    let just' i ths =
-      let ths' = (tl ths)@[hd ths] in
-      just i ths' in
-    (meta,sgs',just') in
-  fun n -> if n > 0 then funpow n rotate_p
-           else funpow (-n) rotate_n;;
-
-(* ------------------------------------------------------------------------- *)
-(* Perform refinement proof, tactic proof etc.                               *)
-(* ------------------------------------------------------------------------- *)
-
-let (mk_xgoalstate:goal->xgoalstate) =
-  fun (asl,w) ->
-    if type_of w = bool_ty then
-      null_meta,[((asl,w), reset_goal_counter ())],
-      (fun inst [th] -> INSTANTIATE_ALL inst th)
-    else failwith "mk_goalstate: Non-boolean goal";;
-
-(* ------------------------------------------------------------------------- *)
-(* The global state counts the total number of proof steps taken.            *)
-(* ------------------------------------------------------------------------- *)
-
-let the_pg_global_state = ref 1;;
-
-let inc_pg_global_state () =
-  (the_pg_global_state := !the_pg_global_state + 1);;
-
-let dec_pg_global_state n =
-  (the_pg_global_state := !the_pg_global_state - n);;
-
-let pg_global_state () = !the_pg_global_state;;
-
-(* ------------------------------------------------------------------------- *)
-(* The proof state number is the length of the current goal stack.           *)
-(* ------------------------------------------------------------------------- *)
-
-let the_current_xgoalstack = ref ([] : goalstack);;
-
-let pg_proof_state () = length !the_current_xgoalstack;;
-
-(* ------------------------------------------------------------------------- *)
-(* Subgoal package for xgoals and with a constrained undo protocol for       *)
-(* interacting with Proof General to track the state.  These overwrite the   *)
-(* existing commands and may cause breakage of interactive proofs.           *)
-(*                                                                          *)
-(* The restrictions are:                                                    *)
-(*  - top_thm may only be called once and closes the currently open proof.   *)
-(*  - the back command b() is not allowed to appear in a file.              *)
-(*                                                                          *)
-(* ------------------------------------------------------------------------- *)
-
-let (xrefine:xrefinement->goalstack) =
-  fun r ->
-    let l = !the_current_xgoalstack in
-    let h = hd l in
-    let res = r h :: l in
-    the_current_xgoalstack := res;
-    !the_current_xgoalstack;;
-
-let flush_goalstack() =
-  let l = !the_current_xgoalstack in
-  the_current_xgoalstack := [hd l];;
-
-let e tac =
-  let result = xrefine(xby(VALID tac)) in
-  (inc_pg_global_state ();
-   the_tactic_flag := true;
-   result);;
-
-let r n =
-  (inc_pg_global_state ();
-   xrefine(xrotate n));;
-
-let set_goal(asl,w) =
-  let aths = map ASSUME asl in
-  (inc_pg_global_state ();
-   the_current_xgoalstack :=
-     [mk_xgoalstate(map (fun th -> "",th) aths,w)];
-   !the_current_xgoalstack);;
-
-let g t =
-  let fvs = sort (<) (map (fst o dest_var) (frees t)) in
-  (if fvs <> [] then
-     let errmsg = end_itlist (fun s t -> s^", "^t) fvs in
-     warn true ("Free variables in goal: "^errmsg)
-   else ());
-  set_goal([],t);;
-
-let p() = !the_current_xgoalstack;;
-
-let b() =
-  failwith "Undo with b() is not available in Proof General top level";;
-
-let top_realgoal() =
-  let (_,(((asl,w),id)::_),_)::_ = !the_current_xgoalstack in
-  asl,w;;
-
-let top_goal() =
-  let asl,w = top_realgoal() in
-  map (concl o snd) asl,w;;
-
-let plain_top_thm() =
-  let (_,[],f)::_ = !the_current_xgoalstack in
-   f null_inst [];;
-
-let top_thm() = 
-  let t = plain_top_thm() in
-  (inc_pg_global_state();
-   the_current_xgoalstack := [];
-   t);;
-
-(* ------------------------------------------------------------------------- *)
-(* Undo handling functions for Proof General                                *)
-(* ------------------------------------------------------------------------- *)
-
-let pg_undo n =
-  let l = !the_current_xgoalstack in
-   if length l < n then failwith "pg_undo: called with too many steps"
-   else (dec_pg_global_state n;
-         the_current_xgoalstack := snd (chop_list n l);
-         p());;
-
-let pg_kill() = 
-  let n = length (!the_current_xgoalstack) in
-  (dec_pg_global_state n;
-   the_current_xgoalstack := [];
-   print_string "*** Proof aborted.\n");;
-
-let pg_forget s = 
-   print_string ("*** Remove theorem "^s^"\n");;
-
-let pg_restart() = 
-   print_string "*** Session restarted.\n";;
-
-(* ------------------------------------------------------------------------- *)
-(* Configure the annotated prompt.                                          *)
-(* ------------------------------------------------------------------------- *)
-
-pg_prompt_info := 
-   fun () -> 
-   let pst = pg_proof_state () and gst = pg_global_state () in
-   string_of_int gst ^ "|" ^ string_of_int pst;;
-
-(* ------------------------------------------------------------------------- *)
-(* Printing the goal of a given Prooftree goal id.                           *)
-(* ------------------------------------------------------------------------- *)
-
-let print_xgoal_of_id (id:goal_id) : unit =
-  let gsts = !the_current_xgoalstack in
-  let find_goal (_,xgs,_) = find (fun (g,id0) -> id0 = id) xgs in
-  let xg = tryfind find_goal gsts in
-  print_xgoal xg;;
-
-(* ------------------------------------------------------------------------- *)
-(* Install the new goal-related printers.                                    *)
-(* ------------------------------------------------------------------------- *)
-
-#install_printer print_xgoal;;
-#install_printer print_xgoalstack;;
diff --git a/hol-light/temp-prooftree-configure.patch 
b/hol-light/temp-prooftree-configure.patch
deleted file mode 100644
index 8716610040..0000000000
--- a/hol-light/temp-prooftree-configure.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-Index: generic/proof-tree.el
-===================================================================
-RCS file: /disk/cvs/proofgen/ProofGeneral/generic/proof-tree.el,v
-retrieving revision 12.3
-diff -c -r12.3 proof-tree.el
-*** generic/proof-tree.el      19 Jan 2012 13:23:56 -0000      12.3
---- generic/proof-tree.el      19 Jan 2012 13:25:30 -0000
-***************
-*** 492,498 ****
-    "Send the configure message."
-    (proof-tree-send-message
-     (format "configure for \"%s\" and protocol version %02d"
-!         proof-assistant
-          proof-tree-protocol-version)
-     ()))
-  
---- 492,499 ----
-    "Send the configure message."
-    (proof-tree-send-message
-     (format "configure for \"%s\" and protocol version %02d"
-!         ;; temporarily pretend every proof assistant is Coq
-!         "Coq" ;; was proof-assistant
-          proof-tree-protocol-version)
-     ()))
-  
diff --git a/hol98/README b/hol98/README
deleted file mode 100644
index 8462763cbb..0000000000
--- a/hol98/README
+++ /dev/null
@@ -1,53 +0,0 @@
-HOL Proof General, for HOL98.
-
-Written by David Aspinall.
-
-Status:              not officially supported yet
-Maintainer:   volunteer required
-HOL version:  HOL4/HOL98, tested with HOL 4 Kananaskis 2
-HOL homepage: http://hol.sourceforge.net
-
-========================================
-
-
-This is a "technology demonstration" of Proof General for HOL4.
-
-It may work with other versions of HOL, but is untested (please let me
-know if you try).  Probably just a few settings need changing to
-configure for different output formats.
-
-It has basic script management support, with a little bit of
-decoration of scripts and output.
-
-There is support for X Symbol, but not using a proper token language.
-
-I have written this in the hope that somebody from the HOL community
-will adopt it, maintain and improve it, and thus turn it into a proper
-instantiation of Proof General.
-
-
-------------
-
-Notes:
-
-There are some problems at the moment.  HOL proof scripts often use
-batch-oriented single step tactic proofs, but Proof General does not
-offer an easy way to edit these kind of proofs.  The "Boomburg-HOL"
-Emacs interface by Koichi Takahashi and Masima Hagiya addressed this,
-and to some extent so perhaps does the Emacs interface supplied with
-HOL.  Perhaps one of these could be embedded/reimplemented inside
-Proof General.  Implemented in a generic way, managing batch vs
-interactive proofs might also be useful for other provers.
-
-Another problem is that HOL scripts sometimes use SML structures,
-which can cause confusion because Proof General does not really parse
-SML, it just looks for semicolons.  This could be improved by taking a
-better parser (e.g. from sml mode).
-
-These improvements would be worthwhile contributions to Proof General
-and also provide the HOL community with a nice front end.  
-Please have a go!
-
-
-$Id$
-
diff --git a/hol98/example.sml b/hol98/example.sml
deleted file mode 100644
index 7e008eb883..0000000000
--- a/hol98/example.sml
+++ /dev/null
@@ -1,30 +0,0 @@
-(*
-    Example proof script for HOL Proof General.
-
-    $Id$
-*)    
-
-g `A /\ B ==> B /\ A`;
-e DISCH_TAC;
-e CONJ_TAC;
-e (IMP_RES_TAC AND_INTRO_THM);
-e (IMP_RES_TAC AND_INTRO_THM);
-val and_comms = pg_top_thm_and_drop();
-
-(* Hints about HOL Proof General:
- 
-   Proof General needs to work with top-level declarations throughout,
-   and with "interactive" rather than "batch" versions of proofs.
-
-   For best results, theorems should be saved in the way that they are
-   saved above, with pg_top_thm_and_drop.  The function isn't
-   mysterious, it is defined as:
-
-    fun pg_top_thm_and_drop () = let val t = top_thm(); in (drop(); t) end;
-*)
-
-(* this simple proof is not quite like proofs in the other systems,
-   can anyone tell me a more similar proof in HOL? I want to split 
-   the IMP_RES_TAC into two steps.  
-*)
-
diff --git a/hol98/hol98.el b/hol98/hol98.el
deleted file mode 100644
index 6f89707b1e..0000000000
--- a/hol98/hol98.el
+++ /dev/null
@@ -1,170 +0,0 @@
-;;; hol98.el --- Basic Proof General instance for HOL 98
-
-;; This file is part of Proof General.
-
-;; Portions © Copyright 1994-2012  David Aspinall and University of Edinburgh
-;; Portions © Copyright 2003, 2012, 2014  Free Software Foundation, Inc.
-;; Portions © Copyright 2001-2017  Pierre Courtieu
-;; Portions © Copyright 2010, 2016  Erik Martin-Dorel
-;; Portions © Copyright 2011-2013, 2016-2017  Hendrik Tews
-;; Portions © Copyright 2015-2017  Clément Pit-Claudel
-
-;; Author: David Aspinall <David.Aspinall@ed.ac.uk>
-
-;;; Commentary:
-;; Needs improvement!
-;;
-;; See the README file in this directory for information.
-
-;;; Code:
-
-(require 'proof-easy-config)            ; easy configure mechanism
-(require 'proof-syntax)                        ; functions for making regexps
-
-(defvar hol98-keywords nil)
-(defvar hol98-rules nil)
-(defvar hol98-tactics nil)
-(defvar hol98-tacticals nil)
-
-(proof-easy-config  'hol98 "HOL"
- proof-prog-name                "hol.unquote"
- proof-terminal-string             ";"
- proof-script-comment-start             "(*"
- proof-script-comment-end               "*)"
- ;; These are all approximations, of course.
- proof-goal-command-regexp     "^g[ `]"
- proof-save-command-regexp     "pg_top_thm_and_drop"
- proof-goal-with-hole-regexp   "val \\(\\([^ \t=]*\\)\\)[ \t]*=[ \t]*prove"
- proof-save-with-hole-regexp   "val \\(\\([^ \t=]*\\)\\)[ \t]*=[ \t]*top_thm()"
- proof-non-undoables-regexp      "b()" ; and others..
- proof-goal-command              "g `%s`;"
- proof-save-command              "val %s = pg_top_thm_and_drop();"
- proof-kill-goal-command         "drop();"
- proof-showproof-command         "p()"
- proof-undo-n-times-cmd          "(pg_repeat backup %s; p());"
- proof-auto-multiple-files       t
- proof-shell-cd-cmd              "FileSys.chDir \"%s\""
- proof-shell-filename-escapes    '(("\\\\" . "\\\\") ("\""   . "\\\""))
- proof-shell-interrupt-regexp    "Interrupted"
- proof-shell-start-goals-regexp
- (proof-regexp-alt "Proof manager status"
-                  "OK.."
-                  "val it =\n")
- proof-shell-end-goals-regexp
- (proof-regexp-alt "^[ \t]*: GoalstackPure.goalstack"
-                  "^[ \t]*: GoalstackPure.proofs")
- proof-shell-quit-cmd            "quit();"
- proof-assistant-home-page
- "http://www.cl.cam.ac.uk/Research/HVG/HOL/HOL.html";
- proof-shell-annotated-prompt-regexp
- "^- "
- ;; This one is nice but less reliable, I think.
- ;; "\\(> val it = () : unit\n\\)?- "
- proof-shell-error-regexp "^! "
- proof-shell-init-cmd
- "Help.displayLines:=3000;
-  fun pg_repeat f 0 = () | pg_repeat f n = (f(); pg_repeat f (n-1));
-  fun pg_top_thm_and_drop () = let val t = top_thm(); in (drop(); t) end;"
- ;; FIXME: add optional help topic parameter to help command.
- proof-info-command                "help \"hol\""
- proof-shell-proof-completed-regexp "Initial goal proved"
- ;; FIXME: next one needs setting so that "urgent" messages are displayed
- ;; eagerly from HOL.
- ;; proof-shell-eager-annotation-start
- proof-find-theorems-command   "DB.match [] (%s);"
-
- proof-forget-id-command       ";" ;; vacuous: but empty string doesn't give
-                                   ;; new prompt
- ;; We must force this to use ptys since mosml doesn't flush its output
- ;; (on Linux, presumably on Solaris too).
- proof-shell-process-connection-type t
-
- ;;
- ;; Syntax table entries for proof scripts
- ;;
- proof-script-syntax-table-entries
- '(?\` "\""
-   ?\$ "."
-   ?\/ "."
-   ?\\ "."
-   ?+  "."
-   ?-  "."
-   ?=  "."
-   ?%  "."
-   ?<  "."
-   ?>  "."
-   ?\& "."
-   ?.  "w"
-   ?_  "w"
-   ?\' "w"
-   ?\| "."
-   ?\* ". 23"
-   ?\( "()1"
-   ?\) ")(4")
-
- ;;
- ;; A few of the vast variety of keywords, tactics, tacticals,
- ;; for decorating proof scripts.
- ;;
- ;; In the future, PG will use a mechanism for passing identifier
- ;; lists like this from the proof assistant, we don't really
- ;; want to duplicate the information here!
- ;;
- hol98-keywords  '("g" "expand" "e" "val" "store_thm" "top_thm" "by"
-                  "pg_top_thm_and_drop"
-                  "Define" "xDefine" "Hol_defn"
-                  "Induct" "Cases" "Cases_on" "Induct_on"
-                  "std_ss" "arith_ss" "list_ss"
-                  "define_type")
- hol98-rules    '("ASSUME" "REFL" "BETA_CONV" "SUBST"
-                  "ABS" "INST_TYPE" "DISCH" "MP"
-                  "T_DEF" "FORALL_DEF" "AND_DEF" "OR_DEF" "F_DEF"
-                  "NOT_DEF" "EXISTS_UNIQUE_DEF" "BOOL_CASES_AX"
-                  "IMP_ANTISYM_AX" "ETA_AX" "SELECT_AX" "ONE_ONE_DEF"
-                  "ONTO_DEF" "INFINITY_AX" "LET_DEF" "COND_DEF" "ARB_DEF")
- hol98-tactics   '("ACCEPT_TAC" "ASSUME_TAC" "GEN_TAC"
-                  "CONJ_TAC" "DISCH_TAC" "STRIP_TAC"
-                  "SUBST_TAC" "ASM_CASES_TAC" "DISJ_CASES_TAC"
-                  "REWRITE_TAC" "IMP_RES_TAC" "ALL_TAC" "NO_TAC"
-                  "EQ_TAC" "EXISTS_TAC" "INDUCT_TAC"
-                  "POP_ASM" "SUBST1_TAC" "ASSUM_LIST"
-                  "PROVE" "PROVE_TAC" "DECIDE" "DECIDE_TAC" "RW_TAC"
-                  "STP_TAC" "ZAP_TAC"
-                  "EXISTS_TAC")
- hol98-tacticals '("ORELSE" "FIRST" "CHANGED_TAC" "THEN"
-                  "THENL" "EVERY" "REPEAT"
-                  "MAP_EVERY")
- proof-script-font-lock-keywords
- (list
-  (cons (proof-ids-to-regexp hol98-keywords) 'font-lock-keyword-face)
-  (cons (proof-ids-to-regexp hol98-tactics) 'font-lock-keyword-face)
-  ; (cons (proof-ids-to-regexp hol98-rules) 'font-lock-keyword-face)
-  (cons (proof-ids-to-regexp hol98-tacticals) 'proof-tacticals-name-face))
-
- ;;
- ;; Some decoration of the goals output
- ;;
- proof-goals-font-lock-keywords
- (list
-  (cons (proof-ids-to-regexp '("Proof manager status"
-                              "proof" "Incomplete"
-                              "Initial goal proved"
-                              "Initial goal"
-                              "There are currently no proofs"
-                              "OK"))
-       'font-lock-keyword-face)
-  (cons (regexp-quote "------------------------------------")
-       'font-lock-comment-face)
-  (cons ": GoalstackPure.goalstack" 'proof-boring-face)
-  (cons ": GoalstackPure.proofs"    'proof-boring-face)
-  (cons ": Thm.thm"                'proof-boring-face)
-  (cons "val it ="                 'proof-boring-face))
-
- ;; End of easy config.
- )
-
-
-(warn "Hol Proof General is incomplete!  Please help improve it!
-Read the manual, make improvements and send them to 
da+pg-feedback@inf.ed.ac.uk")
-
-(provide 'hol98)
diff --git a/hol98/root2.sml b/hol98/root2.sml
deleted file mode 100644
index 0644fc3e30..0000000000
--- a/hol98/root2.sml
+++ /dev/null
@@ -1,83 +0,0 @@
-(* Example proof by Konrad Slind.  See http://www.cs.kun.nl/~freek/comparison/ 
-   Taken from HOL4 distribution hol98/examples/root2.sml *)
-
-(*---------------------------------------------------------------------------*)
-(* Challenge from Freek Wiedijk: the square root of two is not rational.     *)
-(* I've adapted a proof in HOL Light by John Harrison.                       *)
-(*---------------------------------------------------------------------------*)
- 
-load "transcTheory";   open arithmeticTheory BasicProvers;
-
-(*---------------------------------------------------------------------------*)
-(* Need a predicate on reals that picks out the rational ones                *)
-(*---------------------------------------------------------------------------*)
-
-val Rational_def = Define `Rational r = ?p q. ~(q=0) /\ (abs(r) = &p / &q)`;
-
-(*---------------------------------------------------------------------------*)
-(* Trivial lemmas                                                            *)
-(*---------------------------------------------------------------------------*)
-
-val EXP_2 = Q.prove(`!n:num. n**2 = n*n`,
-  REWRITE_TAC [TWO,ONE,EXP] THEN RW_TAC arith_ss []);
-
-val EXP2_LEM = Q.prove(`!x y:num. ((2*x)**2 = 2*(y**2)) = (2*(x**2) = y**2)`,
- REWRITE_TAC [TWO,EXP_2]
- THEN PROVE_TAC [MULT_MONO_EQ,MULT_ASSOC,MULT_SYM]);
-
-(*---------------------------------------------------------------------------*)
-(* Lemma: squares are not doublings of squares, except trivially.            *)
-(*---------------------------------------------------------------------------*)
-
-val lemma = Q.prove
-(`!m n. (m**2 = 2 * n**2) ==> (m=0) /\ (n=0)`,
- completeInduct_on `m` THEN NTAC 2 STRIP_TAC THEN
-  `?k. m = 2*k`      by PROVE_TAC[EVEN_DOUBLE,EXP_2,EVEN_MULT,EVEN_EXISTS] 
-                     THEN VAR_EQ_TAC THEN
-  `?p. n = 2*p`      by PROVE_TAC[EVEN_DOUBLE,EXP_2,EVEN_MULT,
-                                  EVEN_EXISTS,EXP2_LEM] 
-                     THEN VAR_EQ_TAC THEN
-  `k**2 = 2*(p**2)`  by PROVE_TAC [EXP2_LEM] THEN
-  `(k=0) \/ k < 2*k` by numLib.ARITH_TAC
- THENL [FULL_SIMP_TAC arith_ss [EXP_2],
-        PROVE_TAC [MULT_EQ_0, DECIDE (Term `~(2 = 0n)`)]]);
-
-(*---------------------------------------------------------------------------*)
-(* The proof moves the problem from R to N, then uses lemma                  *)
-(*---------------------------------------------------------------------------*)
-
-local open realTheory transcTheory
-in
-val SQRT_2_IRRATIONAL = Q.prove
-(`~Rational (sqrt 2r)`,
- RW_TAC std_ss [Rational_def,abs,SQRT_POS_LE,REAL_POS]
-  THEN Cases_on `q = 0` THEN ASM_REWRITE_TAC []
-  THEN SPOSE_NOT_THEN (MP_TAC o Q.AP_TERM `\x. x pow 2`)
-  THEN RW_TAC arith_ss [SQRT_POW_2, REAL_POS, REAL_POW_DIV,
-                        REAL_EQ_RDIV_EQ,REAL_LT, REAL_POW_LT]
-  THEN REWRITE_TAC [REAL_OF_NUM_POW, REAL_MUL, REAL_INJ]
-  THEN PROVE_TAC [lemma])
-end;
-
-(*---------------------------------------------------------------------------*)
-(* The following is a bit more declarative                                   *)
-(*---------------------------------------------------------------------------*)
-
-infix THEN1;
-fun ie q tac = Q_TAC SUFF_TAC q THEN1 tac;
-
-local open realTheory transcTheory
-in
-val SQRT_2_IRRATIONAL = Q.prove
-(`~Rational (sqrt 2r)`,
- ie `!p q. ~(q=0) ==> ~(sqrt 2 = & p / & q)` 
-             (RW_TAC std_ss [Rational_def,abs,SQRT_POS_LE,REAL_POS] 
-               THEN PROVE_TAC[]) THEN RW_TAC std_ss [] THEN
- ie `~(sqrt 2 = & p / & q)` (PROVE_TAC []) THEN 
- ie `~(2 * q**2 = p**2)` 
-             (DISCH_TAC THEN SPOSE_NOT_THEN (MP_TAC o Q.AP_TERM `\x. x pow 2`) 
-              THEN RW_TAC arith_ss [SQRT_POW_2,REAL_POS,
-                          REAL_POW_DIV,REAL_EQ_RDIV_EQ,REAL_LT, REAL_POW_LT] 
-              THEN ASM_REWRITE_TAC [REAL_OF_NUM_POW, REAL_MUL,REAL_INJ])
-  THEN PROVE_TAC [lemma])
-end;
diff --git a/isar/Example-Tokens.thy b/isar/Example-Tokens.thy
deleted file mode 100644
index 46c9a2cc69..0000000000
--- a/isar/Example-Tokens.thy
+++ /dev/null
@@ -1,37 +0,0 @@
-(*
-      Example proof document for Isabelle/Isar Proof General,
-      using symbols.  
-      View and process this document with Unicode Tokens engaged.
-   
-      For a more exhaustive test of token display, visit the test
-      file etc/isar/TokensAcid.thy.  Check the FAQ for more advice.
-
-      $Id$
-*)
-
-theory "Example-Tokens" imports Main begin
-
-text {* Proper proof text -- \<^bitalic>naive version\<^eitalic>. *}
-
-theorem and_comms: "\<phi> \<and> \<psi> \<longrightarrow> \<psi> \<and> 
\<phi>"
-proof
-  assume "\<phi> \<and> \<psi>"
-  then show "\<psi> \<and> \<phi>"
-  proof
-    assume "\<psi>" and "\<phi>"
-    then show ?thesis ..
- qed
-qed
-
-text {* \<^bbold>Unstructured\<^ebold> proof script. *}
-
-theorem "\<phi>\<^isub>\<alpha> \<and> \<phi>\<^isub>\<beta> \<longrightarrow> 
\<phi>\<^isub>\<beta> \<and> \<phi>\<^isub>\<alpha>"
-  apply (rule impI)
-  apply (erule conjE)
-  apply (rule conjI)
-  apply assumption
-  apply assumption
-done
-
-end
-
diff --git a/isar/Example.thy b/isar/Example.thy
deleted file mode 100644
index 01b755db19..0000000000
--- a/isar/Example.thy
+++ /dev/null
@@ -1,33 +0,0 @@
-(*
-      Example proof document for Isabelle/Isar Proof General.
-   
-      $Id$
-*)
-
-
-theory Example imports Main begin
-
-text {* Proper proof text -- \textit{naive version}. *}
-
-theorem and_comms: "A & B --> B & A"
-proof
-  assume "A & B"
-  then show "B & A"
-  proof
-    assume "B" and "A"
-    then show ?thesis ..
- qed
-qed
-
-text {* Unstructured proof script. *}
-
-theorem  "A & B --> B & A"
-  apply (rule impI)
-  apply (erule conjE)
-  apply (rule conjI)
-  apply assumption
-  apply assumption
-done
-
-
-end
diff --git a/isar/README b/isar/README
deleted file mode 100644
index bd1e377ce7..0000000000
--- a/isar/README
+++ /dev/null
@@ -1,33 +0,0 @@
-Isabelle/Isar Proof General
-
-Written by Markus Wenzel and David Aspinall.
-
-Contributions from David von Oheimb, Stefan Berghofer, 
- Sebastian Skalberg, Gerwin Klein, Tjark Weber.
-
-Status:                    supported
-Maintainers:       David Aspinall, Makarius Wenzel
-Isabelle versions:  Isabelle2011 (earlier versions not guaranteed)
-Isabelle homepage:  http://www.cl.cam.ac.uk/Research/HVG/Isabelle/
-
-===========================================================================
-
-Isabelle/Isar Proof General has full support for multiple file
-scripting, with dependencies between theories communicated between
-Isabelle and Proof General.  
-
-There is full support for Unicode Tokens, using the Isabelle print
-mode for X Symbol tokens.  Many Isabelle theories have X Symbol syntax
-already defined and it's easy to add to your own theories.
-
-The script `interface' and file 'interface-setup.el' are used
-internally to start Isabelle Proof General via the 'isabelle' shell
-command.  This is the default way to invoke Proof General from the
-Isabelle perspective; it enables Isabelle to provide a consistent
-process and file-system environment, including the all-important
-isar-keywords.el file.
-
-========================================
-
-$Id$
-
diff --git a/isar/ex/Knaster_Tarski.thy b/isar/ex/Knaster_Tarski.thy
deleted file mode 100644
index ff7e77f64f..0000000000
--- a/isar/ex/Knaster_Tarski.thy
+++ /dev/null
@@ -1,110 +0,0 @@
-(********** 
-  This file is copied from Isabelle2011.
- **********)
-
-(*  Title:      HOL/Isar_Examples/Knaster_Tarski.thy
-    Author:     Markus Wenzel, TU Muenchen
-
-Typical textbook proof example.
-*)
-
-header {* Textbook-style reasoning: the Knaster-Tarski Theorem *}
-
-theory Knaster_Tarski
-imports Main "~~/src/HOL/Library/Lattice_Syntax"
-begin
-
-
-subsection {* Prose version *}
-
-text {* According to the textbook \cite[pages
-  93--94]{davey-priestley}, the Knaster-Tarski fixpoint theorem is as
-  follows.\footnote{We have dualized the argument, and tuned the
-  notation a little bit.}
-
-  \textbf{The Knaster-Tarski Fixpoint Theorem.}  Let @{text L} be a
-  complete lattice and @{text "f: L \<rightarrow> L"} an order-preserving map.
-  Then @{text "\<Sqinter>{x \<in> L | f(x) \<le> x}"} is a fixpoint of @{text 
f}.
-
-  \textbf{Proof.} Let @{text "H = {x \<in> L | f(x) \<le> x}"} and @{text "a =
-  \<Sqinter>H"}.  For all @{text "x \<in> H"} we have @{text "a \<le> x"}, so 
@{text
-  "f(a) \<le> f(x) \<le> x"}.  Thus @{text "f(a)"} is a lower bound of @{text
-  H}, whence @{text "f(a) \<le> a"}.  We now use this inequality to prove
-  the reverse one (!) and thereby complete the proof that @{text a} is
-  a fixpoint.  Since @{text f} is order-preserving, @{text "f(f(a)) \<le>
-  f(a)"}.  This says @{text "f(a) \<in> H"}, so @{text "a \<le> f(a)"}. *}
-
-
-subsection {* Formal versions *}
-
-text {* The Isar proof below closely follows the original
-  presentation.  Virtually all of the prose narration has been
-  rephrased in terms of formal Isar language elements.  Just as many
-  textbook-style proofs, there is a strong bias towards forward proof,
-  and several bends in the course of reasoning. *}
-
-theorem Knaster_Tarski:
-  fixes f :: "'a::complete_lattice \<Rightarrow> 'a"
-  assumes "mono f"
-  shows "\<exists>a. f a = a"
-proof
-  let ?H = "{u. f u \<le> u}"
-  let ?a = "\<Sqinter>?H"
-  show "f ?a = ?a"
-  proof -
-    {
-      fix x
-      assume "x \<in> ?H"
-      then have "?a \<le> x" by (rule Inf_lower)
-      with `mono f` have "f ?a \<le> f x" ..
-      also from `x \<in> ?H` have "\<dots> \<le> x" ..
-      finally have "f ?a \<le> x" .
-    }
-    then have "f ?a \<le> ?a" by (rule Inf_greatest)
-    {
-      also presume "\<dots> \<le> f ?a"
-      finally (order_antisym) show ?thesis .
-    }
-    from `mono f` and `f ?a \<le> ?a` have "f (f ?a) \<le> f ?a" ..
-    then have "f ?a \<in> ?H" ..
-    then show "?a \<le> f ?a" by (rule Inf_lower)
-  qed
-qed
-
-text {* Above we have used several advanced Isar language elements,
-  such as explicit block structure and weak assumptions.  Thus we have
-  mimicked the particular way of reasoning of the original text.
-
-  In the subsequent version the order of reasoning is changed to
-  achieve structured top-down decomposition of the problem at the
-  outer level, while only the inner steps of reasoning are done in a
-  forward manner.  We are certainly more at ease here, requiring only
-  the most basic features of the Isar language. *}
-
-theorem Knaster_Tarski':
-  fixes f :: "'a::complete_lattice \<Rightarrow> 'a"
-  assumes "mono f"
-  shows "\<exists>a. f a = a"
-proof
-  let ?H = "{u. f u \<le> u}"
-  let ?a = "\<Sqinter>?H"
-  show "f ?a = ?a"
-  proof (rule order_antisym)
-    show "f ?a \<le> ?a"
-    proof (rule Inf_greatest)
-      fix x
-      assume "x \<in> ?H"
-      then have "?a \<le> x" by (rule Inf_lower)
-      with `mono f` have "f ?a \<le> f x" ..
-      also from `x \<in> ?H` have "\<dots> \<le> x" ..
-      finally show "f ?a \<le> x" .
-    qed
-    show "?a \<le> f ?a"
-    proof (rule Inf_lower)
-      from `mono f` and `f ?a \<le> ?a` have "f (f ?a) \<le> f ?a" ..
-      then show "f ?a \<in> ?H" ..
-    qed
-  qed
-qed
-
-end
diff --git a/isar/ex/PER.thy b/isar/ex/PER.thy
deleted file mode 100644
index 068885bd57..0000000000
--- a/isar/ex/PER.thy
+++ /dev/null
@@ -1,269 +0,0 @@
-(********** 
-  This file is copied from Isabelle2011. 
-  It has been beautified with Tokens \<rightarrow> Replace Shortcuts
- **********)
-
-(*  Title:      HOL/ex/PER.thy
-    Author:     Oscar Slotosch and Markus Wenzel, TU Muenchen
-*)
-
-header {* Partial equivalence relations *}
-
-theory PER imports Main begin
-
-text {*
-  Higher-order quotients are defined over partial equivalence
-  relations (PERs) instead of total ones.  We provide axiomatic type
-  classes @{text "equiv < partial_equiv"} and a type constructor
-  @{text "'a quot"} with basic operations.  This development is based
-  on:
-
-  Oscar Slotosch: \emph{Higher Order Quotients and their
-  Implementation in Isabelle HOL.}  Elsa L. Gunter and Amy Felty,
-  editors, Theorem Proving in Higher Order Logics: TPHOLs '97,
-  Springer LNCS 1275, 1997.
-*}
-
-
-subsection {* Partial equivalence *}
-
-text {*
-  Type class @{text partial_equiv} models partial equivalence
-  relations (PERs) using the polymorphic @{text "\<sim> :: 'a \<Rightarrow> 'a 
\<Rightarrow>
-  bool"} relation, which is required to be symmetric and transitive,
-  but not necessarily reflexive.
-*}
-
-class partial_equiv =
-  fixes eqv :: "'a \<Rightarrow> 'a \<Rightarrow> bool"    (infixl "\<sim>" 50)
-  assumes partial_equiv_sym [elim?]: "x \<sim> y \<Longrightarrow> y \<sim> x"
-  assumes partial_equiv_trans [trans]: "x \<sim> y \<Longrightarrow> y \<sim> 
z \<Longrightarrow> x \<sim> z"
-
-text {*
-  \medskip The domain of a partial equivalence relation is the set of
-  reflexive elements.  Due to symmetry and transitivity this
-  characterizes exactly those elements that are connected with
-  \emph{any} other one.
-*}
-
-definition
-  "domain" :: "'a::partial_equiv set" where
-  "domain = {x. x \<sim> x}"
-
-lemma domainI [intro]: "x \<sim> x \<Longrightarrow> x \<in> domain"
-  unfolding domain_def by blast
-
-lemma domainD [dest]: "x \<in> domain \<Longrightarrow> x \<sim> x"
-  unfolding domain_def by blast
-
-theorem domainI' [elim?]: "x \<sim> y \<Longrightarrow> x \<in> domain"
-proof
-  assume xy: "x \<sim> y"
-  also from xy have "y \<sim> x" ..
-  finally show "x \<sim> x" .
-qed
-
-
-subsection {* Equivalence on function spaces *}
-
-text {*
-  The @{text \<sim>} relation is lifted to function spaces.  It is
-  important to note that this is \emph{not} the direct product, but a
-  structural one corresponding to the congruence property.
-*}
-
-instantiation "fun" :: (partial_equiv, partial_equiv) partial_equiv
-begin
-
-definition
-  eqv_fun_def: "f \<sim> g \<equiv> \<forall>x \<in> domain. \<forall>y \<in> 
domain. x \<sim> y \<longrightarrow> f x \<sim> g y"
-
-lemma partial_equiv_funI [intro?]:
-    "(\<And>x y. x \<in> domain \<Longrightarrow> y \<in> domain 
\<Longrightarrow> x \<sim> y \<Longrightarrow> f x \<sim> g y) 
\<Longrightarrow> f \<sim> g"
-  unfolding eqv_fun_def by blast
-
-lemma partial_equiv_funD [dest?]:
-    "f \<sim> g \<Longrightarrow> x \<in> domain \<Longrightarrow> y \<in> 
domain \<Longrightarrow> x \<sim> y \<Longrightarrow> f x \<sim> g y"
-  unfolding eqv_fun_def by blast
-
-text {*
-  The class of partial equivalence relations is closed under function
-  spaces (in \emph{both} argument positions).
-*}
-
-instance proof
-  fix f g h :: "'a::partial_equiv \<Rightarrow> 'b::partial_equiv"
-  assume fg: "f \<sim> g"
-  show "g \<sim> f"
-  proof
-    fix x y :: 'a
-    assume x: "x \<in> domain" and y: "y \<in> domain"
-    assume "x \<sim> y" then have "y \<sim> x" ..
-    with fg y x have "f y \<sim> g x" ..
-    then show "g x \<sim> f y" ..
-  qed
-  assume gh: "g \<sim> h"
-  show "f \<sim> h"
-  proof
-    fix x y :: 'a
-    assume x: "x \<in> domain" and y: "y \<in> domain" and "x \<sim> y"
-    with fg have "f x \<sim> g y" ..
-    also from y have "y \<sim> y" ..
-    with gh y y have "g y \<sim> h y" ..
-    finally show "f x \<sim> h y" .
-  qed
-qed
-
-end
-
-
-subsection {* Total equivalence *}
-
-text {*
-  The class of total equivalence relations on top of PERs.  It
-  coincides with the standard notion of equivalence, i.e.\ @{text "\<sim>
-  :: 'a \<Rightarrow> 'a \<Rightarrow> bool"} is required to be reflexive, 
transitive and
-  symmetric.
-*}
-
-class equiv =
-  assumes eqv_refl [intro]: "x \<sim> x"
-
-text {*
-  On total equivalences all elements are reflexive, and congruence
-  holds unconditionally.
-*}
-
-theorem equiv_domain [intro]: "(x::'a::equiv) \<in> domain"
-proof
-  show "x \<sim> x" ..
-qed
-
-theorem equiv_cong [dest?]: "f \<sim> g \<Longrightarrow> x \<sim> y 
\<Longrightarrow> f x \<sim> g (y::'a::equiv)"
-proof -
-  assume "f \<sim> g"
-  moreover have "x \<in> domain" ..
-  moreover have "y \<in> domain" ..
-  moreover assume "x \<sim> y"
-  ultimately show ?thesis ..
-qed
-
-
-subsection {* Quotient types *}
-
-text {*
-  The quotient type @{text "'a quot"} consists of all
-  \emph{equivalence classes} over elements of the base type @{typ 'a}.
-*}
-
-typedef 'a quot = "{{x. a \<sim> x}| a::'a::partial_equiv. True}"
-  by blast
-
-lemma quotI [intro]: "{x. a \<sim> x} \<in> quot"
-  unfolding quot_def by blast
-
-lemma quotE [elim]: "R \<in> quot \<Longrightarrow> (\<And>a. R = {x. a \<sim> 
x} \<Longrightarrow> C) \<Longrightarrow> C"
-  unfolding quot_def by blast
-
-text {*
-  \medskip Abstracted equivalence classes are the canonical
-  representation of elements of a quotient type.
-*}
-
-definition
-  eqv_class :: "('a::partial_equiv) \<Rightarrow> 'a quot"    
("\<lfloor>_\<rfloor>") where
-  "\<lfloor>a\<rfloor> = Abs_quot {x. a \<sim> x}"
-
-theorem quot_rep: "\<exists>a. A = \<lfloor>a\<rfloor>"
-proof (cases A)
-  fix R assume R: "A = Abs_quot R"
-  assume "R \<in> quot" then have "\<exists>a. R = {x. a \<sim> x}" by blast
-  with R have "\<exists>a. A = Abs_quot {x. a \<sim> x}" by blast
-  then show ?thesis by (unfold eqv_class_def)
-qed
-
-lemma quot_cases [cases type: quot]:
-  obtains (rep) a where "A = \<lfloor>a\<rfloor>"
-  using quot_rep by blast
-
-
-subsection {* Equality on quotients *}
-
-text {*
-  Equality of canonical quotient elements corresponds to the original
-  relation as follows.
-*}
-
-theorem eqv_class_eqI [intro]: "a \<sim> b \<Longrightarrow> 
\<lfloor>a\<rfloor> = \<lfloor>b\<rfloor>"
-proof -
-  assume ab: "a \<sim> b"
-  have "{x. a \<sim> x} = {x. b \<sim> x}"
-  proof (rule Collect_cong)
-    fix x show "(a \<sim> x) = (b \<sim> x)"
-    proof
-      from ab have "b \<sim> a" ..
-      also assume "a \<sim> x"
-      finally show "b \<sim> x" .
-    next
-      note ab
-      also assume "b \<sim> x"
-      finally show "a \<sim> x" .
-    qed
-  qed
-  then show ?thesis by (simp only: eqv_class_def)
-qed
-
-theorem eqv_class_eqD' [dest?]: "\<lfloor>a\<rfloor> = \<lfloor>b\<rfloor> 
\<Longrightarrow> a \<in> domain \<Longrightarrow> a \<sim> b"
-proof (unfold eqv_class_def)
-  assume "Abs_quot {x. a \<sim> x} = Abs_quot {x. b \<sim> x}"
-  then have "{x. a \<sim> x} = {x. b \<sim> x}" by (simp only: Abs_quot_inject 
quotI)
-  moreover assume "a \<in> domain" then have "a \<sim> a" ..
-  ultimately have "a \<in> {x. b \<sim> x}" by blast
-  then have "b \<sim> a" by blast
-  then show "a \<sim> b" ..
-qed
-
-theorem eqv_class_eqD [dest?]: "\<lfloor>a\<rfloor> = \<lfloor>b\<rfloor> 
\<Longrightarrow> a \<sim> (b::'a::equiv)"
-proof (rule eqv_class_eqD')
-  show "a \<in> domain" ..
-qed
-
-lemma eqv_class_eq' [simp]: "a \<in> domain \<Longrightarrow> 
(\<lfloor>a\<rfloor> = \<lfloor>b\<rfloor>) = (a \<sim> b)"
-  using eqv_class_eqI eqv_class_eqD' by (blast del: eqv_refl)
-
-lemma eqv_class_eq [simp]: "(\<lfloor>a\<rfloor> = \<lfloor>b\<rfloor>) = (a 
\<sim> (b::'a::equiv))"
-  using eqv_class_eqI eqv_class_eqD by blast
-
-
-subsection {* Picking representing elements *}
-
-definition
-  pick :: "'a::partial_equiv quot \<Rightarrow> 'a" where
-  "pick A = (SOME a. A = \<lfloor>a\<rfloor>)"
-
-theorem pick_eqv' [intro?, simp]: "a \<in> domain \<Longrightarrow> pick 
\<lfloor>a\<rfloor> \<sim> a"
-proof (unfold pick_def)
-  assume a: "a \<in> domain"
-  show "(SOME x. \<lfloor>a\<rfloor> = \<lfloor>x\<rfloor>) \<sim> a"
-  proof (rule someI2)
-    show "\<lfloor>a\<rfloor> = \<lfloor>a\<rfloor>" ..
-    fix x assume "\<lfloor>a\<rfloor> = \<lfloor>x\<rfloor>"
-    from this and a have "a \<sim> x" ..
-    then show "x \<sim> a" ..
-  qed
-qed
-
-theorem pick_eqv [intro, simp]: "pick \<lfloor>a\<rfloor> \<sim> 
(a::'a::equiv)"
-proof (rule pick_eqv')
-  show "a \<in> domain" ..
-qed
-
-theorem pick_inverse: "\<lfloor>pick A\<rfloor> = (A::'a::equiv quot)"
-proof (cases A)
-  fix a assume a: "A = \<lfloor>a\<rfloor>"
-  then have "pick A \<sim> a" by simp
-  then have "\<lfloor>pick A\<rfloor> = \<lfloor>a\<rfloor>" by simp
-  with a show ?thesis by simp
-qed
-
-end
diff --git a/isar/ex/README b/isar/ex/README
deleted file mode 100644
index c70f02f257..0000000000
--- a/isar/ex/README
+++ /dev/null
@@ -1,8 +0,0 @@
-This directory contains some example files copied from the Isabelle
-distribution.
-
-These are re-distributed with Proof General for convenience of trying
-out PG without needing a local installation of Isabelle.
-
-They can also be used as test cases.
-
diff --git a/isar/ex/Sqrt.thy b/isar/ex/Sqrt.thy
deleted file mode 100644
index 96164f90ef..0000000000
--- a/isar/ex/Sqrt.thy
+++ /dev/null
@@ -1,90 +0,0 @@
-(*  Title:      HOL/ex/Sqrt.thy
-    Author:     Markus Wenzel, TU Muenchen
-*)
-
-header {*  Square roots of primes are irrational *}
-
-theory Sqrt
-imports Complex_Main "~~/src/HOL/Number_Theory/Primes"
-begin
-
-text {*
-  The square root of any prime number (including @{text 2}) is
-  irrational.
-*}
-
-theorem sqrt_prime_irrational:
-  assumes "prime (p::nat)"
-  shows "sqrt (real p) \<notin> \<rat>"
-proof
-  from `prime p` have p: "1 < p" by (simp add: prime_nat_def)
-  assume "sqrt (real p) \<in> \<rat>"
-  then obtain m n :: nat where
-      n: "n \<noteq> 0" and sqrt_rat: "\<bar>sqrt (real p)\<bar> = real m / 
real n"
-    and gcd: "gcd m n = 1" by (rule Rats_abs_nat_div_natE)
-  have eq: "m\<twosuperior> = p * n\<twosuperior>"
-  proof -
-    from n and sqrt_rat have "real m = \<bar>sqrt (real p)\<bar> * real n" by 
simp
-    then have "real (m\<twosuperior>) = (sqrt (real p))\<twosuperior> * real 
(n\<twosuperior>)"
-      by (auto simp add: power2_eq_square)
-    also have "(sqrt (real p))\<twosuperior> = real p" by simp
-    also have "\<dots> * real (n\<twosuperior>) = real (p * n\<twosuperior>)" 
by simp
-    finally show ?thesis ..
-  qed
-  have "p dvd m \<and> p dvd n"
-  proof
-    from eq have "p dvd m\<twosuperior>" ..
-    with `prime p` pos2 show "p dvd m" by (rule prime_dvd_power_nat)
-    then obtain k where "m = p * k" ..
-    with eq have "p * n\<twosuperior> = p\<twosuperior> * k\<twosuperior>" by 
(auto simp add: power2_eq_square mult_ac)
-    with p have "n\<twosuperior> = p * k\<twosuperior>" by (simp add: 
power2_eq_square)
-    then have "p dvd n\<twosuperior>" ..
-    with `prime p` pos2 show "p dvd n" by (rule prime_dvd_power_nat)
-  qed
-  then have "p dvd gcd m n" ..
-  with gcd have "p dvd 1" by simp
-  then have "p \<le> 1" by (simp add: dvd_imp_le)
-  with p show False by simp
-qed
-
-corollary "sqrt (real (2::nat)) \<notin> \<rat>"
-  by (rule sqrt_prime_irrational) (rule two_is_prime_nat)
-
-
-subsection {* Variations *}
-
-text {*
-  Here is an alternative version of the main proof, using mostly
-  linear forward-reasoning.  While this results in less top-down
-  structure, it is probably closer to proofs seen in mathematics.
-*}
-
-theorem
-  assumes "prime (p::nat)"
-  shows "sqrt (real p) \<notin> \<rat>"
-proof
-  from `prime p` have p: "1 < p" by (simp add: prime_nat_def)
-  assume "sqrt (real p) \<in> \<rat>"
-  then obtain m n :: nat where
-      n: "n \<noteq> 0" and sqrt_rat: "\<bar>sqrt (real p)\<bar> = real m / 
real n"
-    and gcd: "gcd m n = 1" by (rule Rats_abs_nat_div_natE)
-  from n and sqrt_rat have "real m = \<bar>sqrt (real p)\<bar> * real n" by 
simp
-  then have "real (m\<twosuperior>) = (sqrt (real p))\<twosuperior> * real 
(n\<twosuperior>)"
-    by (auto simp add: power2_eq_square)
-  also have "(sqrt (real p))\<twosuperior> = real p" by simp
-  also have "\<dots> * real (n\<twosuperior>) = real (p * n\<twosuperior>)" by 
simp
-  finally have eq: "m\<twosuperior> = p * n\<twosuperior>" ..
-  then have "p dvd m\<twosuperior>" ..
-  with `prime p` pos2 have dvd_m: "p dvd m" by (rule prime_dvd_power_nat)
-  then obtain k where "m = p * k" ..
-  with eq have "p * n\<twosuperior> = p\<twosuperior> * k\<twosuperior>" by 
(auto simp add: power2_eq_square mult_ac)
-  with p have "n\<twosuperior> = p * k\<twosuperior>" by (simp add: 
power2_eq_square)
-  then have "p dvd n\<twosuperior>" ..
-  with `prime p` pos2 have "p dvd n" by (rule prime_dvd_power_nat)
-  with dvd_m have "p dvd gcd m n" by (rule gcd_greatest_nat)
-  with gcd have "p dvd 1" by simp
-  then have "p \<le> 1" by (simp add: dvd_imp_le)
-  with p show False by simp
-qed
-
-end
diff --git a/isar/ex/Sqrt_Script.thy b/isar/ex/Sqrt_Script.thy
deleted file mode 100644
index 08634ea7ff..0000000000
--- a/isar/ex/Sqrt_Script.thy
+++ /dev/null
@@ -1,70 +0,0 @@
-(*  Title:      HOL/ex/Sqrt_Script.thy
-    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   2001  University of Cambridge
-*)
-
-header {* Square roots of primes are irrational (script version) *}
-
-theory Sqrt_Script
-imports Complex_Main "~~/src/HOL/Number_Theory/Primes"
-begin
-
-text {*
-  \medskip Contrast this linear Isabelle/Isar script with Markus
-  Wenzel's more mathematical version.
-*}
-
-subsection {* Preliminaries *}
-
-lemma prime_nonzero:  "prime (p::nat) \<Longrightarrow> p \<noteq> 0"
-  by (force simp add: prime_nat_def)
-
-lemma prime_dvd_other_side:
-    "(n::nat) * n = p * (k * k) \<Longrightarrow> prime p \<Longrightarrow> p 
dvd n"
-  apply (subgoal_tac "p dvd n * n", blast dest: prime_dvd_mult_nat)
-  apply auto
-  done
-
-lemma reduction: "prime (p::nat) \<Longrightarrow>
-    0 < k \<Longrightarrow> k * k = p * (j * j) \<Longrightarrow> k < p * j 
\<and> 0 < j"
-  apply (rule ccontr)
-  apply (simp add: linorder_not_less)
-  apply (erule disjE)
-   apply (frule mult_le_mono, assumption)
-   apply auto
-  apply (force simp add: prime_nat_def)
-  done
-
-lemma rearrange: "(j::nat) * (p * j) = k * k \<Longrightarrow> k * k = p * (j 
* j)"
-  by (simp add: mult_ac)
-
-lemma prime_not_square:
-    "prime (p::nat) \<Longrightarrow> (\<And>k. 0 < k \<Longrightarrow> m * m 
\<noteq> p * (k * k))"
-  apply (induct m rule: nat_less_induct)
-  apply clarify
-  apply (frule prime_dvd_other_side, assumption)
-  apply (erule dvdE)
-  apply (simp add: nat_mult_eq_cancel_disj prime_nonzero)
-  apply (blast dest: rearrange reduction)
-  done
-
-
-subsection {* Main theorem *}
-
-text {*
-  The square root of any prime number (including @{text 2}) is
-  irrational.
-*}
-
-theorem prime_sqrt_irrational:
-    "prime (p::nat) \<Longrightarrow> x * x = real p \<Longrightarrow> 0 \<le> 
x \<Longrightarrow> x \<notin> \<rat>"
-  apply (rule notI)
-  apply (erule Rats_abs_nat_div_natE)
-  apply (simp del: real_of_nat_mult
-              add: abs_if divide_eq_eq prime_not_square real_of_nat_mult 
[symmetric])
-  done
-
-lemmas two_sqrt_irrational =
-  prime_sqrt_irrational [OF two_is_prime_nat]
-
-end
diff --git a/isar/ex/Tarski.thy b/isar/ex/Tarski.thy
deleted file mode 100644
index ec1247aafc..0000000000
--- a/isar/ex/Tarski.thy
+++ /dev/null
@@ -1,927 +0,0 @@
-(********** 
-  This file is copied from Isabelle2011. 
-  It has been beautified with Tokens -> Replace Shortcuts
- **********)
-
-(*  Title:      HOL/ex/Tarski.thy
-    Author:     Florian Kammüller, Cambridge University Computer Laboratory
-*)
-
-header {* The Full Theorem of Tarski *}
-
-theory Tarski
-imports Main "~~/src/HOL/Library/FuncSet"
-begin
-
-text {*
-  Minimal version of lattice theory plus the full theorem of Tarski:
-  The fixedpoints of a complete lattice themselves form a complete
-  lattice.
-
-  Illustrates first-class theories, using the Sigma representation of
-  structures.  Tidied and converted to Isar by lcp.
-*}
-
-record 'a potype =
-  pset  :: "'a set"
-  order :: "('a * 'a) set"
-
-definition
-  monotone :: "['a \<Rightarrow> 'a, 'a set, ('a *'a)set] \<Rightarrow> bool" 
where
-  "monotone f A r = (\<forall>x\<in>A. \<forall>y\<in>A. (x, y): r 
\<longrightarrow> ((f x), (f y)) : r)"
-
-definition
-  least :: "['a \<Rightarrow> bool, 'a potype] \<Rightarrow> 'a" where
-  "least P po = (SOME x. x: pset po & P x &
-                       (\<forall>y \<in> pset po. P y \<longrightarrow> (x,y): 
order po))"
-
-definition
-  greatest :: "['a \<Rightarrow> bool, 'a potype] \<Rightarrow> 'a" where
-  "greatest P po = (SOME x. x: pset po & P x &
-                          (\<forall>y \<in> pset po. P y \<longrightarrow> 
(y,x): order po))"
-
-definition
-  lub  :: "['a set, 'a potype] \<Rightarrow> 'a" where
-  "lub S po = least (%x. \<forall>y\<in>S. (y,x): order po) po"
-
-definition
-  glb  :: "['a set, 'a potype] \<Rightarrow> 'a" where
-  "glb S po = greatest (%x. \<forall>y\<in>S. (x,y): order po) po"
-
-definition
-  isLub :: "['a set, 'a potype, 'a] \<Rightarrow> bool" where
-  "isLub S po = (%L. (L: pset po & (\<forall>y\<in>S. (y,L): order po) &
-                   (\<forall>z\<in>pset po. (\<forall>y\<in>S. (y,z): order 
po) \<longrightarrow> (L,z): order po)))"
-
-definition
-  isGlb :: "['a set, 'a potype, 'a] \<Rightarrow> bool" where
-  "isGlb S po = (%G. (G: pset po & (\<forall>y\<in>S. (G,y): order po) &
-                 (\<forall>z \<in> pset po. (\<forall>y\<in>S. (z,y): order 
po) \<longrightarrow> (z,G): order po)))"
-
-definition
-  "fix"    :: "[('a \<Rightarrow> 'a), 'a set] \<Rightarrow> 'a set" where
-  "fix f A  = {x. x: A & f x = x}"
-
-definition
-  interval :: "[('a*'a) set,'a, 'a ] \<Rightarrow> 'a set" where
-  "interval r a b = {x. (a,x): r & (x,b): r}"
-
-
-definition
-  Bot :: "'a potype \<Rightarrow> 'a" where
-  "Bot po = least (%x. True) po"
-
-definition
-  Top :: "'a potype \<Rightarrow> 'a" where
-  "Top po = greatest (%x. True) po"
-
-definition
-  PartialOrder :: "('a potype) set" where
-  "PartialOrder = {P. refl_on (pset P) (order P) & antisym (order P) &
-                       trans (order P)}"
-
-definition
-  CompleteLattice :: "('a potype) set" where
-  "CompleteLattice = {cl. cl: PartialOrder &
-                        (\<forall>S. S \<subseteq> pset cl \<longrightarrow> 
(\<exists>L. isLub S cl L)) &
-                        (\<forall>S. S \<subseteq> pset cl \<longrightarrow> 
(\<exists>G. isGlb S cl G))}"
-
-definition
-  CLF_set :: "('a potype * ('a \<Rightarrow> 'a)) set" where
-  "CLF_set = (SIGMA cl: CompleteLattice.
-            {f. f: pset cl \<rightarrow> pset cl & monotone f (pset cl) (order 
cl)})"
-
-definition
-  induced :: "['a set, ('a * 'a) set] \<Rightarrow> ('a *'a)set" where
-  "induced A r = {(a,b). a : A & b: A & (a,b): r}"
-
-
-definition
-  sublattice :: "('a potype * 'a set)set" where
-  "sublattice =
-      (SIGMA cl: CompleteLattice.
-          {S. S \<subseteq> pset cl &
-           \<lparr> pset = S, order = induced S (order cl) \<rparr>: 
CompleteLattice})"
-
-abbreviation
-  sublat :: "['a set, 'a potype] \<Rightarrow> bool"  ("_ \<guillemotleft>= _" 
[51,50]50) where
-  "S \<guillemotleft>= cl \<equiv> S : sublattice `` {cl}"
-
-definition
-  dual :: "'a potype \<Rightarrow> 'a potype" where
-  "dual po = \<lparr> pset = pset po, order = converse (order po) \<rparr>"
-
-locale S =
-  fixes cl :: "'a potype"
-    and A  :: "'a set"
-    and r  :: "('a * 'a) set"
-  defines A_def: "A \<equiv> pset cl"
-     and  r_def: "r \<equiv> order cl"
-
-locale PO = S +
-  assumes cl_po:  "cl : PartialOrder"
-
-locale CL = S +
-  assumes cl_co:  "cl : CompleteLattice"
-
-sublocale CL < PO
-apply (simp_all add: A_def r_def)
-apply unfold_locales
-using cl_co unfolding CompleteLattice_def by auto
-
-locale CLF = S +
-  fixes f :: "'a \<Rightarrow> 'a"
-    and P :: "'a set"
-  assumes f_cl:  "(cl,f) : CLF_set" (*was the equivalent "f : CLF_set``{cl}"*)
-  defines P_def: "P \<equiv> fix f A"
-
-sublocale CLF < CL
-apply (simp_all add: A_def r_def)
-apply unfold_locales
-using f_cl unfolding CLF_set_def by auto
-
-locale Tarski = CLF +
-  fixes Y     :: "'a set"
-    and intY1 :: "'a set"
-    and v     :: "'a"
-  assumes
-    Y_ss: "Y \<subseteq> P"
-  defines
-    intY1_def: "intY1 \<equiv> interval r (lub Y cl) (Top cl)"
-    and v_def: "v \<equiv> glb {x. ((%x: intY1. f x) x, x): induced intY1 r &
-                             x: intY1}
-                      \<lparr> pset=intY1, order=induced intY1 r\<rparr>"
-
-
-subsection {* Partial Order *}
-
-lemma (in PO) dual:
-  "PO (dual cl)"
-apply unfold_locales
-using cl_po
-unfolding PartialOrder_def dual_def
-by auto
-
-lemma (in PO) PO_imp_refl_on [simp]: "refl_on A r"
-apply (insert cl_po)
-apply (simp add: PartialOrder_def A_def r_def)
-done
-
-lemma (in PO) PO_imp_sym [simp]: "antisym r"
-apply (insert cl_po)
-apply (simp add: PartialOrder_def r_def)
-done
-
-lemma (in PO) PO_imp_trans [simp]: "trans r"
-apply (insert cl_po)
-apply (simp add: PartialOrder_def r_def)
-done
-
-lemma (in PO) reflE: "x \<in> A \<Longrightarrow> (x, x) \<in> r"
-apply (insert cl_po)
-apply (simp add: PartialOrder_def refl_on_def A_def r_def)
-done
-
-lemma (in PO) antisymE: "\<lbrakk> (a, b) \<in> r; (b, a) \<in> r \<rbrakk> 
\<Longrightarrow> a = b"
-apply (insert cl_po)
-apply (simp add: PartialOrder_def antisym_def r_def)
-done
-
-lemma (in PO) transE: "\<lbrakk> (a, b) \<in> r; (b, c) \<in> r\<rbrakk> 
\<Longrightarrow> (a,c) \<in> r"
-apply (insert cl_po)
-apply (simp add: PartialOrder_def r_def)
-apply (unfold trans_def, fast)
-done
-
-lemma (in PO) monotoneE:
-     "\<lbrakk> monotone f A r;  x \<in> A; y \<in> A; (x, y) \<in> r 
\<rbrakk> \<Longrightarrow> (f x, f y) \<in> r"
-by (simp add: monotone_def)
-
-lemma (in PO) po_subset_po:
-     "S \<subseteq> A \<Longrightarrow> \<lparr> pset = S, order = induced S r 
\<rparr> \<in> PartialOrder"
-apply (simp (no_asm) add: PartialOrder_def)
-apply auto
--- {* refl *}
-apply (simp add: refl_on_def induced_def)
-apply (blast intro: reflE)
--- {* antisym *}
-apply (simp add: antisym_def induced_def)
-apply (blast intro: antisymE)
--- {* trans *}
-apply (simp add: trans_def induced_def)
-apply (blast intro: transE)
-done
-
-lemma (in PO) indE: "\<lbrakk> (x, y) \<in> induced S r; S \<subseteq> A 
\<rbrakk> \<Longrightarrow> (x, y) \<in> r"
-by (simp add: add: induced_def)
-
-lemma (in PO) indI: "\<lbrakk> (x, y) \<in> r; x \<in> S; y \<in> S \<rbrakk> 
\<Longrightarrow> (x, y) \<in> induced S r"
-by (simp add: add: induced_def)
-
-lemma (in CL) CL_imp_ex_isLub: "S \<subseteq> A \<Longrightarrow> \<exists>L. 
isLub S cl L"
-apply (insert cl_co)
-apply (simp add: CompleteLattice_def A_def)
-done
-
-declare (in CL) cl_co [simp]
-
-lemma isLub_lub: "(\<exists>L. isLub S cl L) = isLub S cl (lub S cl)"
-by (simp add: lub_def least_def isLub_def some_eq_ex [symmetric])
-
-lemma isGlb_glb: "(\<exists>G. isGlb S cl G) = isGlb S cl (glb S cl)"
-by (simp add: glb_def greatest_def isGlb_def some_eq_ex [symmetric])
-
-lemma isGlb_dual_isLub: "isGlb S cl = isLub S (dual cl)"
-by (simp add: isLub_def isGlb_def dual_def converse_def)
-
-lemma isLub_dual_isGlb: "isLub S cl = isGlb S (dual cl)"
-by (simp add: isLub_def isGlb_def dual_def converse_def)
-
-lemma (in PO) dualPO: "dual cl \<in> PartialOrder"
-apply (insert cl_po)
-apply (simp add: PartialOrder_def dual_def refl_on_converse
-                 trans_converse antisym_converse)
-done
-
-lemma Rdual:
-     "\<forall>S. (S \<subseteq> A \<longrightarrow>( \<exists>L. isLub S 
\<lparr> pset = A, order = r\<rparr> L))
-      \<Longrightarrow> \<forall>S. (S \<subseteq> A \<longrightarrow> 
(\<exists>G. isGlb S \<lparr> pset = A, order = r\<rparr> G))"
-apply safe
-apply (rule_tac x = "lub {y. y \<in> A & (\<forall>k \<in> S. (y, k) \<in> r)}
-                      \<lparr>pset = A, order = r\<rparr> " in exI)
-apply (drule_tac x = "{y. y \<in> A & (\<forall>k \<in> S. (y,k) \<in> r) }" 
in spec)
-apply (drule mp, fast)
-apply (simp add: isLub_lub isGlb_def)
-apply (simp add: isLub_def, blast)
-done
-
-lemma lub_dual_glb: "lub S cl = glb S (dual cl)"
-by (simp add: lub_def glb_def least_def greatest_def dual_def converse_def)
-
-lemma glb_dual_lub: "glb S cl = lub S (dual cl)"
-by (simp add: lub_def glb_def least_def greatest_def dual_def converse_def)
-
-lemma CL_subset_PO: "CompleteLattice \<subseteq> PartialOrder"
-by (simp add: PartialOrder_def CompleteLattice_def, fast)
-
-lemmas CL_imp_PO = CL_subset_PO [THEN subsetD]
-
-(*declare CL_imp_PO [THEN PO.PO_imp_refl, simp]
-declare CL_imp_PO [THEN PO.PO_imp_sym, simp]
-declare CL_imp_PO [THEN PO.PO_imp_trans, simp]*)
-
-lemma (in CL) CO_refl_on: "refl_on A r"
-by (rule PO_imp_refl_on)
-
-lemma (in CL) CO_antisym: "antisym r"
-by (rule PO_imp_sym)
-
-lemma (in CL) CO_trans: "trans r"
-by (rule PO_imp_trans)
-
-lemma CompleteLatticeI:
-     "\<lbrakk> po \<in> PartialOrder; (\<forall>S. S \<subseteq> pset po 
\<longrightarrow> (\<exists>L. isLub S po L));
-         (\<forall>S. S \<subseteq> pset po \<longrightarrow> (\<exists>G. 
isGlb S po G))\<rbrakk>
-      \<Longrightarrow> po \<in> CompleteLattice"
-apply (unfold CompleteLattice_def, blast)
-done
-
-lemma (in CL) CL_dualCL: "dual cl \<in> CompleteLattice"
-apply (insert cl_co)
-apply (simp add: CompleteLattice_def dual_def)
-apply (fold dual_def)
-apply (simp add: isLub_dual_isGlb [symmetric] isGlb_dual_isLub [symmetric]
-                 dualPO)
-done
-
-lemma (in PO) dualA_iff: "pset (dual cl) = pset cl"
-by (simp add: dual_def)
-
-lemma (in PO) dualr_iff: "((x, y) \<in> (order(dual cl))) = ((y, x) \<in> 
order cl)"
-by (simp add: dual_def)
-
-lemma (in PO) monotone_dual:
-     "monotone f (pset cl) (order cl) 
-     \<Longrightarrow> monotone f (pset (dual cl)) (order(dual cl))"
-by (simp add: monotone_def dualA_iff dualr_iff)
-
-lemma (in PO) interval_dual:
-     "\<lbrakk> x \<in> A; y \<in> A\<rbrakk> \<Longrightarrow> interval r x y 
= interval (order(dual cl)) y x"
-apply (simp add: interval_def dualr_iff)
-apply (fold r_def, fast)
-done
-
-lemma (in PO) trans:
-  "(x, y) \<in> r \<Longrightarrow> (y, z) \<in> r \<Longrightarrow> (x, z) 
\<in> r"
-using cl_po apply (auto simp add: PartialOrder_def r_def)
-unfolding trans_def by blast 
-
-lemma (in PO) interval_not_empty:
-  "interval r a b \<noteq> {} \<Longrightarrow> (a, b) \<in> r"
-apply (simp add: interval_def)
-using trans by blast
-
-lemma (in PO) interval_imp_mem: "x \<in> interval r a b \<Longrightarrow> (a, 
x) \<in> r"
-by (simp add: interval_def)
-
-lemma (in PO) left_in_interval:
-     "\<lbrakk> a \<in> A; b \<in> A; interval r a b \<noteq> {} \<rbrakk> 
\<Longrightarrow> a \<in> interval r a b"
-apply (simp (no_asm_simp) add: interval_def)
-apply (simp add: PO_imp_trans interval_not_empty)
-apply (simp add: reflE)
-done
-
-lemma (in PO) right_in_interval:
-     "\<lbrakk> a \<in> A; b \<in> A; interval r a b \<noteq> {} \<rbrakk> 
\<Longrightarrow> b \<in> interval r a b"
-apply (simp (no_asm_simp) add: interval_def)
-apply (simp add: PO_imp_trans interval_not_empty)
-apply (simp add: reflE)
-done
-
-
-subsection {* sublattice *}
-
-lemma (in PO) sublattice_imp_CL:
-     "S \<guillemotleft>= cl  \<Longrightarrow> \<lparr> pset = S, order = 
induced S r \<rparr> \<in> CompleteLattice"
-by (simp add: sublattice_def CompleteLattice_def r_def)
-
-lemma (in CL) sublatticeI:
-     "\<lbrakk> S \<subseteq> A; \<lparr> pset = S, order = induced S r 
\<rparr> \<in> CompleteLattice \<rbrakk>
-      \<Longrightarrow> S \<guillemotleft>= cl"
-by (simp add: sublattice_def A_def r_def)
-
-lemma (in CL) dual:
-  "CL (dual cl)"
-apply unfold_locales
-using cl_co unfolding CompleteLattice_def
-apply (simp add: dualPO isGlb_dual_isLub [symmetric] isLub_dual_isGlb 
[symmetric] dualA_iff)
-done
-
-
-subsection {* lub *}
-
-lemma (in CL) lub_unique: "\<lbrakk> S \<subseteq> A; isLub S cl x; isLub S cl 
L\<rbrakk> \<Longrightarrow> x = L"
-apply (rule antisymE)
-apply (auto simp add: isLub_def r_def)
-done
-
-lemma (in CL) lub_upper: "\<lbrakk>S \<subseteq> A; x \<in> S\<rbrakk> 
\<Longrightarrow> (x, lub S cl) \<in> r"
-apply (rule CL_imp_ex_isLub [THEN exE], assumption)
-apply (unfold lub_def least_def)
-apply (rule some_equality [THEN ssubst])
-  apply (simp add: isLub_def)
- apply (simp add: lub_unique A_def isLub_def)
-apply (simp add: isLub_def r_def)
-done
-
-lemma (in CL) lub_least:
-     "\<lbrakk> S \<subseteq> A; L \<in> A; \<forall>x \<in> S. (x,L) \<in> r 
\<rbrakk> \<Longrightarrow> (lub S cl, L) \<in> r"
-apply (rule CL_imp_ex_isLub [THEN exE], assumption)
-apply (unfold lub_def least_def)
-apply (rule_tac s=x in some_equality [THEN ssubst])
-  apply (simp add: isLub_def)
- apply (simp add: lub_unique A_def isLub_def)
-apply (simp add: isLub_def r_def A_def)
-done
-
-lemma (in CL) lub_in_lattice: "S \<subseteq> A \<Longrightarrow> lub S cl 
\<in> A"
-apply (rule CL_imp_ex_isLub [THEN exE], assumption)
-apply (unfold lub_def least_def)
-apply (subst some_equality)
-apply (simp add: isLub_def)
-prefer 2 apply (simp add: isLub_def A_def)
-apply (simp add: lub_unique A_def isLub_def)
-done
-
-lemma (in CL) lubI:
-     "\<lbrakk> S \<subseteq> A; L \<in> A; \<forall>x \<in> S. (x,L) \<in> r;
-         \<forall>z \<in> A. (\<forall>y \<in> S. (y,z) \<in> r) 
\<longrightarrow> (L,z) \<in> r \<rbrakk> \<Longrightarrow> L = lub S cl"
-apply (rule lub_unique, assumption)
-apply (simp add: isLub_def A_def r_def)
-apply (unfold isLub_def)
-apply (rule conjI)
-apply (fold A_def r_def)
-apply (rule lub_in_lattice, assumption)
-apply (simp add: lub_upper lub_least)
-done
-
-lemma (in CL) lubIa: "\<lbrakk> S \<subseteq> A; isLub S cl L \<rbrakk> 
\<Longrightarrow> L = lub S cl"
-by (simp add: lubI isLub_def A_def r_def)
-
-lemma (in CL) isLub_in_lattice: "isLub S cl L \<Longrightarrow> L \<in> A"
-by (simp add: isLub_def  A_def)
-
-lemma (in CL) isLub_upper: "\<lbrakk>isLub S cl L; y \<in> S\<rbrakk> 
\<Longrightarrow> (y, L) \<in> r"
-by (simp add: isLub_def r_def)
-
-lemma (in CL) isLub_least:
-     "\<lbrakk> isLub S cl L; z \<in> A; \<forall>y \<in> S. (y, z) \<in> 
r\<rbrakk> \<Longrightarrow> (L, z) \<in> r"
-by (simp add: isLub_def A_def r_def)
-
-lemma (in CL) isLubI:
-     "\<lbrakk> L \<in> A; \<forall>y \<in> S. (y, L) \<in> r;
-         (\<forall>z \<in> A. (\<forall>y \<in> S. (y, z):r) \<longrightarrow> 
(L, z) \<in> r)\<rbrakk> \<Longrightarrow> isLub S cl L"
-by (simp add: isLub_def A_def r_def)
-
-
-subsection {* glb *}
-
-lemma (in CL) glb_in_lattice: "S \<subseteq> A \<Longrightarrow> glb S cl 
\<in> A"
-apply (subst glb_dual_lub)
-apply (simp add: A_def)
-apply (rule dualA_iff [THEN subst])
-apply (rule CL.lub_in_lattice)
-apply (rule dual)
-apply (simp add: dualA_iff)
-done
-
-lemma (in CL) glb_lower: "\<lbrakk>S \<subseteq> A; x \<in> S\<rbrakk> 
\<Longrightarrow> (glb S cl, x) \<in> r"
-apply (subst glb_dual_lub)
-apply (simp add: r_def)
-apply (rule dualr_iff [THEN subst])
-apply (rule CL.lub_upper)
-apply (rule dual)
-apply (simp add: dualA_iff A_def, assumption)
-done
-
-text {*
-  Reduce the sublattice property by using substructural properties;
-  abandoned see @{text "Tarski_4.ML"}.
-*}
-
-lemma (in CLF) [simp]:
-    "f: pset cl \<rightarrow> pset cl & monotone f (pset cl) (order cl)"
-apply (insert f_cl)
-apply (simp add: CLF_set_def)
-done
-
-declare (in CLF) f_cl [simp]
-
-
-lemma (in CLF) f_in_funcset: "f \<in> A \<rightarrow> A"
-by (simp add: A_def)
-
-lemma (in CLF) monotone_f: "monotone f A r"
-by (simp add: A_def r_def)
-
-lemma (in CLF) CLF_dual: "(dual cl, f) \<in> CLF_set"
-apply (simp add: CLF_set_def  CL_dualCL monotone_dual)
-apply (simp add: dualA_iff)
-done
-
-lemma (in CLF) dual:
-  "CLF (dual cl) f"
-apply (rule CLF.intro)
-apply (rule CLF_dual)
-done
-
-
-subsection {* fixed points *}
-
-lemma fix_subset: "fix f A \<subseteq> A"
-by (simp add: fix_def, fast)
-
-lemma fix_imp_eq: "x \<in> fix f A \<Longrightarrow> f x = x"
-by (simp add: fix_def)
-
-lemma fixf_subset:
-     "\<lbrakk> A \<subseteq> B; x \<in> fix (%y: A. f y) A \<rbrakk> 
\<Longrightarrow> x \<in> fix f B"
-by (simp add: fix_def, auto)
-
-
-subsection {* lemmas for Tarski, lub *}
-lemma (in CLF) lubH_le_flubH:
-     "H = {x. (x, f x) \<in> r & x \<in> A} \<Longrightarrow> (lub H cl, f 
(lub H cl)) \<in> r"
-apply (rule lub_least, fast)
-apply (rule f_in_funcset [THEN funcset_mem])
-apply (rule lub_in_lattice, fast)
--- {* @{text "\<forall>x:H. (x, f (lub H r)) \<in> r"} *}
-apply (rule ballI)
-apply (rule transE)
--- {* instantiates @{text "(x, ???z) \<in> order cl to (x, f x)"}, *}
--- {* because of the def of @{text H} *}
-apply fast
--- {* so it remains to show @{text "(f x, f (lub H cl)) \<in> r"} *}
-apply (rule_tac f = "f" in monotoneE)
-apply (rule monotone_f, fast)
-apply (rule lub_in_lattice, fast)
-apply (rule lub_upper, fast)
-apply assumption
-done
-
-lemma (in CLF) flubH_le_lubH:
-     "\<lbrakk>  H = {x. (x, f x) \<in> r & x \<in> A} \<rbrakk> 
\<Longrightarrow> (f (lub H cl), lub H cl) \<in> r"
-apply (rule lub_upper, fast)
-apply (rule_tac t = "H" in ssubst, assumption)
-apply (rule CollectI)
-apply (rule conjI)
-apply (rule_tac [2] f_in_funcset [THEN funcset_mem])
-apply (rule_tac [2] lub_in_lattice)
-prefer 2 apply fast
-apply (rule_tac f = "f" in monotoneE)
-apply (rule monotone_f)
-  apply (blast intro: lub_in_lattice)
- apply (blast intro: lub_in_lattice f_in_funcset [THEN funcset_mem])
-apply (simp add: lubH_le_flubH)
-done
-
-lemma (in CLF) lubH_is_fixp:
-     "H = {x. (x, f x) \<in> r & x \<in> A} \<Longrightarrow> lub H cl \<in> 
fix f A"
-apply (simp add: fix_def)
-apply (rule conjI)
-apply (rule lub_in_lattice, fast)
-apply (rule antisymE)
-apply (simp add: flubH_le_lubH)
-apply (simp add: lubH_le_flubH)
-done
-
-lemma (in CLF) fix_in_H:
-     "\<lbrakk> H = {x. (x, f x) \<in> r & x \<in> A};  x \<in> P \<rbrakk> 
\<Longrightarrow> x \<in> H"
-by (simp add: P_def fix_imp_eq [of _ f A] reflE CO_refl_on
-                    fix_subset [of f A, THEN subsetD])
-
-lemma (in CLF) fixf_le_lubH:
-     "H = {x. (x, f x) \<in> r & x \<in> A} \<Longrightarrow> \<forall>x \<in> 
fix f A. (x, lub H cl) \<in> r"
-apply (rule ballI)
-apply (rule lub_upper, fast)
-apply (rule fix_in_H)
-apply (simp_all add: P_def)
-done
-
-lemma (in CLF) lubH_least_fixf:
-     "H = {x. (x, f x) \<in> r & x \<in> A}
-      \<Longrightarrow> \<forall>L. (\<forall>y \<in> fix f A. (y,L) \<in> r) 
\<longrightarrow> (lub H cl, L) \<in> r"
-apply (rule allI)
-apply (rule impI)
-apply (erule bspec)
-apply (rule lubH_is_fixp, assumption)
-done
-
-subsection {* Tarski fixpoint theorem 1, first part *}
-lemma (in CLF) T_thm_1_lub: "lub P cl = lub {x. (x, f x) \<in> r & x \<in> A} 
cl"
-apply (rule sym)
-apply (simp add: P_def)
-apply (rule lubI)
-apply (rule fix_subset)
-apply (rule lub_in_lattice, fast)
-apply (simp add: fixf_le_lubH)
-apply (simp add: lubH_least_fixf)
-done
-
-lemma (in CLF) glbH_is_fixp: "H = {x. (f x, x) \<in> r & x \<in> A} 
\<Longrightarrow> glb H cl \<in> P"
-  -- {* Tarski for glb *}
-apply (simp add: glb_dual_lub P_def A_def r_def)
-apply (rule dualA_iff [THEN subst])
-apply (rule CLF.lubH_is_fixp)
-apply (rule dual)
-apply (simp add: dualr_iff dualA_iff)
-done
-
-lemma (in CLF) T_thm_1_glb: "glb P cl = glb {x. (f x, x) \<in> r & x \<in> A} 
cl"
-apply (simp add: glb_dual_lub P_def A_def r_def)
-apply (rule dualA_iff [THEN subst])
-apply (simp add: CLF.T_thm_1_lub [of _ f, OF dual]
-                 dualPO CL_dualCL CLF_dual dualr_iff)
-done
-
-subsection {* interval *}
-
-lemma (in CLF) rel_imp_elem: "(x, y) \<in> r \<Longrightarrow> x \<in> A"
-apply (insert CO_refl_on)
-apply (simp add: refl_on_def, blast)
-done
-
-lemma (in CLF) interval_subset: "\<lbrakk> a \<in> A; b \<in> A \<rbrakk> 
\<Longrightarrow> interval r a b \<subseteq> A"
-apply (simp add: interval_def)
-apply (blast intro: rel_imp_elem)
-done
-
-lemma (in CLF) intervalI:
-     "\<lbrakk> (a, x) \<in> r; (x, b) \<in> r \<rbrakk> \<Longrightarrow> x 
\<in> interval r a b"
-by (simp add: interval_def)
-
-lemma (in CLF) interval_lemma1:
-     "\<lbrakk> S \<subseteq> interval r a b; x \<in> S \<rbrakk> 
\<Longrightarrow> (a, x) \<in> r"
-by (unfold interval_def, fast)
-
-lemma (in CLF) interval_lemma2:
-     "\<lbrakk> S \<subseteq> interval r a b; x \<in> S \<rbrakk> 
\<Longrightarrow> (x, b) \<in> r"
-by (unfold interval_def, fast)
-
-lemma (in CLF) a_less_lub:
-     "\<lbrakk> S \<subseteq> A; S \<noteq> {};
-         \<forall>x \<in> S. (a,x) \<in> r; \<forall>y \<in> S. (y, L) \<in> r 
\<rbrakk> \<Longrightarrow> (a,L) \<in> r"
-by (blast intro: transE)
-
-lemma (in CLF) glb_less_b:
-     "\<lbrakk> S \<subseteq> A; S \<noteq> {};
-         \<forall>x \<in> S. (x,b) \<in> r; \<forall>y \<in> S. (G, y) \<in> r 
\<rbrakk> \<Longrightarrow> (G,b) \<in> r"
-by (blast intro: transE)
-
-lemma (in CLF) S_intv_cl:
-     "\<lbrakk> a \<in> A; b \<in> A; S \<subseteq> interval r a b 
\<rbrakk>\<Longrightarrow> S \<subseteq> A"
-by (simp add: subset_trans [OF _ interval_subset])
-
-lemma (in CLF) L_in_interval:
-     "\<lbrakk> a \<in> A; b \<in> A; S \<subseteq> interval r a b;
-         S \<noteq> {}; isLub S cl L; interval r a b \<noteq> {} \<rbrakk> 
\<Longrightarrow> L \<in> interval r a b"
-apply (rule intervalI)
-apply (rule a_less_lub)
-prefer 2 apply assumption
-apply (simp add: S_intv_cl)
-apply (rule ballI)
-apply (simp add: interval_lemma1)
-apply (simp add: isLub_upper)
--- {* @{text "(L, b) \<in> r"} *}
-apply (simp add: isLub_least interval_lemma2)
-done
-
-lemma (in CLF) G_in_interval:
-     "\<lbrakk> a \<in> A; b \<in> A; interval r a b \<noteq> {}; S 
\<subseteq> interval r a b; isGlb S cl G;
-         S \<noteq> {} \<rbrakk> \<Longrightarrow> G \<in> interval r a b"
-apply (simp add: interval_dual)
-apply (simp add: CLF.L_in_interval [of _ f, OF dual]
-                 dualA_iff A_def isGlb_dual_isLub)
-done
-
-lemma (in CLF) intervalPO:
-     "\<lbrakk> a \<in> A; b \<in> A; interval r a b \<noteq> {} \<rbrakk>
-      \<Longrightarrow> \<lparr> pset = interval r a b, order = induced 
(interval r a b) r \<rparr>
-          \<in> PartialOrder"
-apply (rule po_subset_po)
-apply (simp add: interval_subset)
-done
-
-lemma (in CLF) intv_CL_lub:
- "\<lbrakk> a \<in> A; b \<in> A; interval r a b \<noteq> {} \<rbrakk>
-  \<Longrightarrow> \<forall>S. S \<subseteq> interval r a b \<longrightarrow>
-          (\<exists>L. isLub S \<lparr> pset = interval r a b,
-                          order = induced (interval r a b) r \<rparr>  L)"
-apply (intro strip)
-apply (frule S_intv_cl [THEN CL_imp_ex_isLub])
-prefer 2 apply assumption
-apply assumption
-apply (erule exE)
--- {* define the lub for the interval as *}
-apply (rule_tac x = "if S = {} then a else L" in exI)
-apply (simp (no_asm_simp) add: isLub_def split del: split_if)
-apply (intro impI conjI)
--- {* @{text "(if S = {} then a else L) \<in> interval r a b"} *}
-apply (simp add: CL_imp_PO L_in_interval)
-apply (simp add: left_in_interval)
--- {* lub prop 1 *}
-apply (case_tac "S = {}")
--- {* @{text "S = {}, y \<in> S = False \<Rightarrow> everything"} *}
-apply fast
--- {* @{text "S \<noteq> {}"} *}
-apply simp
--- {* @{text "\<forall>y:S. (y, L) \<in> induced (interval r a b) r"} *}
-apply (rule ballI)
-apply (simp add: induced_def  L_in_interval)
-apply (rule conjI)
-apply (rule subsetD)
-apply (simp add: S_intv_cl, assumption)
-apply (simp add: isLub_upper)
--- {* @{text "\<forall>z:interval r a b. (\<forall>y:S. (y, z) \<in> induced 
(interval r a b) r \<longrightarrow> (if S = {} then a else L, z) \<in> induced 
(interval r a b) r"} *}
-apply (rule ballI)
-apply (rule impI)
-apply (case_tac "S = {}")
--- {* @{text "S = {}"} *}
-apply simp
-apply (simp add: induced_def  interval_def)
-apply (rule conjI)
-apply (rule reflE, assumption)
-apply (rule interval_not_empty)
-apply (simp add: interval_def)
--- {* @{text "S \<noteq> {}"} *}
-apply simp
-apply (simp add: induced_def  L_in_interval)
-apply (rule isLub_least, assumption)
-apply (rule subsetD)
-prefer 2 apply assumption
-apply (simp add: S_intv_cl, fast)
-done
-
-lemmas (in CLF) intv_CL_glb = intv_CL_lub [THEN Rdual]
-
-lemma (in CLF) interval_is_sublattice:
-     "\<lbrakk> a \<in> A; b \<in> A; interval r a b \<noteq> {} \<rbrakk>
-        \<Longrightarrow> interval r a b \<guillemotleft>= cl"
-apply (rule sublatticeI)
-apply (simp add: interval_subset)
-apply (rule CompleteLatticeI)
-apply (simp add: intervalPO)
- apply (simp add: intv_CL_lub)
-apply (simp add: intv_CL_glb)
-done
-
-lemmas (in CLF) interv_is_compl_latt =
-    interval_is_sublattice [THEN sublattice_imp_CL]
-
-
-subsection {* Top and Bottom *}
-lemma (in CLF) Top_dual_Bot: "Top cl = Bot (dual cl)"
-by (simp add: Top_def Bot_def least_def greatest_def dualA_iff dualr_iff)
-
-lemma (in CLF) Bot_dual_Top: "Bot cl = Top (dual cl)"
-by (simp add: Top_def Bot_def least_def greatest_def dualA_iff dualr_iff)
-
-lemma (in CLF) Bot_in_lattice: "Bot cl \<in> A"
-apply (simp add: Bot_def least_def)
-apply (rule_tac a="glb A cl" in someI2)
-apply (simp_all add: glb_in_lattice glb_lower 
-                     r_def [symmetric] A_def [symmetric])
-done
-
-lemma (in CLF) Top_in_lattice: "Top cl \<in> A"
-apply (simp add: Top_dual_Bot A_def)
-apply (rule dualA_iff [THEN subst])
-apply (rule CLF.Bot_in_lattice [OF dual])
-done
-
-lemma (in CLF) Top_prop: "x \<in> A \<Longrightarrow> (x, Top cl) \<in> r"
-apply (simp add: Top_def greatest_def)
-apply (rule_tac a="lub A cl" in someI2)
-apply (rule someI2)
-apply (simp_all add: lub_in_lattice lub_upper 
-                     r_def [symmetric] A_def [symmetric])
-done
-
-lemma (in CLF) Bot_prop: "x \<in> A \<Longrightarrow> (Bot cl, x) \<in> r"
-apply (simp add: Bot_dual_Top r_def)
-apply (rule dualr_iff [THEN subst])
-apply (rule CLF.Top_prop [OF dual])
-apply (simp add: dualA_iff A_def)
-done
-
-lemma (in CLF) Top_intv_not_empty: "x \<in> A  \<Longrightarrow> interval r x 
(Top cl) \<noteq> {}"
-apply (rule notI)
-apply (drule_tac a = "Top cl" in equals0D)
-apply (simp add: interval_def)
-apply (simp add: refl_on_def Top_in_lattice Top_prop)
-done
-
-lemma (in CLF) Bot_intv_not_empty: "x \<in> A \<Longrightarrow> interval r 
(Bot cl) x \<noteq> {}"
-apply (simp add: Bot_dual_Top)
-apply (subst interval_dual)
-prefer 2 apply assumption
-apply (simp add: A_def)
-apply (rule dualA_iff [THEN subst])
-apply (rule CLF.Top_in_lattice [OF dual])
-apply (rule CLF.Top_intv_not_empty [OF dual])
-apply (simp add: dualA_iff A_def)
-done
-
-subsection {* fixed points form a partial order *}
-
-lemma (in CLF) fixf_po: "\<lparr> pset = P, order = induced P r\<rparr> \<in> 
PartialOrder"
-by (simp add: P_def fix_subset po_subset_po)
-
-lemma (in Tarski) Y_subset_A: "Y \<subseteq> A"
-apply (rule subset_trans [OF _ fix_subset])
-apply (rule Y_ss [simplified P_def])
-done
-
-lemma (in Tarski) lubY_in_A: "lub Y cl \<in> A"
-  by (rule Y_subset_A [THEN lub_in_lattice])
-
-lemma (in Tarski) lubY_le_flubY: "(lub Y cl, f (lub Y cl)) \<in> r"
-apply (rule lub_least)
-apply (rule Y_subset_A)
-apply (rule f_in_funcset [THEN funcset_mem])
-apply (rule lubY_in_A)
--- {* @{text "Y \<subseteq> P \<Longrightarrow> f x = x"} *}
-apply (rule ballI)
-apply (rule_tac t = "x" in fix_imp_eq [THEN subst])
-apply (erule Y_ss [simplified P_def, THEN subsetD])
--- {* @{text "reduce (f x, f (lub Y cl)) \<in> r to (x, lub Y cl) \<in> r"} by 
monotonicity *}
-apply (rule_tac f = "f" in monotoneE)
-apply (rule monotone_f)
-apply (simp add: Y_subset_A [THEN subsetD])
-apply (rule lubY_in_A)
-apply (simp add: lub_upper Y_subset_A)
-done
-
-lemma (in Tarski) intY1_subset: "intY1 \<subseteq> A"
-apply (unfold intY1_def)
-apply (rule interval_subset)
-apply (rule lubY_in_A)
-apply (rule Top_in_lattice)
-done
-
-lemmas (in Tarski) intY1_elem = intY1_subset [THEN subsetD]
-
-lemma (in Tarski) intY1_f_closed: "x \<in> intY1 \<Longrightarrow> f x \<in> 
intY1"
-apply (simp add: intY1_def  interval_def)
-apply (rule conjI)
-apply (rule transE)
-apply (rule lubY_le_flubY)
--- {* @{text "(f (lub Y cl), f x) \<in> r"} *}
-apply (rule_tac f=f in monotoneE)
-apply (rule monotone_f)
-apply (rule lubY_in_A)
-apply (simp add: intY1_def interval_def  intY1_elem)
-apply (simp add: intY1_def  interval_def)
--- {* @{text "(f x, Top cl) \<in> r"} *}
-apply (rule Top_prop)
-apply (rule f_in_funcset [THEN funcset_mem])
-apply (simp add: intY1_def interval_def  intY1_elem)
-done
-
-lemma (in Tarski) intY1_mono:
-     "monotone (%x: intY1. f x) intY1 (induced intY1 r)"
-apply (auto simp add: monotone_def induced_def intY1_f_closed)
-apply (blast intro: intY1_elem monotone_f [THEN monotoneE])
-done
-
-lemma (in Tarski) intY1_is_cl:
-    "\<lparr> pset = intY1, order = induced intY1 r \<rparr> \<in> 
CompleteLattice"
-apply (unfold intY1_def)
-apply (rule interv_is_compl_latt)
-apply (rule lubY_in_A)
-apply (rule Top_in_lattice)
-apply (rule Top_intv_not_empty)
-apply (rule lubY_in_A)
-done
-
-lemma (in Tarski) v_in_P: "v \<in> P"
-apply (unfold P_def)
-apply (rule_tac A = "intY1" in fixf_subset)
-apply (rule intY1_subset)
-unfolding v_def
-apply (rule CLF.glbH_is_fixp [OF CLF.intro, unfolded CLF_set_def, of 
"\<lparr>pset = intY1, order = induced intY1 r\<rparr>", simplified])
-apply auto
-apply (rule intY1_is_cl)
-apply (erule intY1_f_closed)
-apply (rule intY1_mono)
-done
-
-lemma (in Tarski) z_in_interval:
-     "\<lbrakk> z \<in> P; \<forall>y\<in>Y. (y, z) \<in> induced P r 
\<rbrakk> \<Longrightarrow> z \<in> intY1"
-apply (unfold intY1_def P_def)
-apply (rule intervalI)
-prefer 2
- apply (erule fix_subset [THEN subsetD, THEN Top_prop])
-apply (rule lub_least)
-apply (rule Y_subset_A)
-apply (fast elim!: fix_subset [THEN subsetD])
-apply (simp add: induced_def)
-done
-
-lemma (in Tarski) f'z_in_int_rel: "\<lbrakk> z \<in> P; \<forall>y\<in>Y. (y, 
z) \<in> induced P r \<rbrakk>
-      \<Longrightarrow> ((%x: intY1. f x) z, z) \<in> induced intY1 r"
-apply (simp add: induced_def  intY1_f_closed z_in_interval P_def)
-apply (simp add: fix_imp_eq [of _ f A] fix_subset [of f A, THEN subsetD]
-                 reflE)
-done
-
-lemma (in Tarski) tarski_full_lemma:
-     "\<exists>L. isLub Y \<lparr> pset = P, order = induced P r \<rparr> L"
-apply (rule_tac x = "v" in exI)
-apply (simp add: isLub_def)
--- {* @{text "v \<in> P"} *}
-apply (simp add: v_in_P)
-apply (rule conjI)
--- {* @{text v} is lub *}
--- {* @{text "1. \<forall>y:Y. (y, v) \<in> induced P r"} *}
-apply (rule ballI)
-apply (simp add: induced_def subsetD v_in_P)
-apply (rule conjI)
-apply (erule Y_ss [THEN subsetD])
-apply (rule_tac b = "lub Y cl" in transE)
-apply (rule lub_upper)
-apply (rule Y_subset_A, assumption)
-apply (rule_tac b = "Top cl" in interval_imp_mem)
-apply (simp add: v_def)
-apply (fold intY1_def)
-apply (rule CL.glb_in_lattice [OF CL.intro [OF intY1_is_cl], simplified])
-apply auto
-apply (rule indI)
-  prefer 3 apply assumption
- prefer 2 apply (simp add: v_in_P)
-apply (unfold v_def)
-apply (rule indE)
-apply (rule_tac [2] intY1_subset)
-apply (rule CL.glb_lower [OF CL.intro [OF intY1_is_cl], simplified])
-  apply (simp add: CL_imp_PO intY1_is_cl)
- apply force
-apply (simp add: induced_def intY1_f_closed z_in_interval)
-apply (simp add: P_def fix_imp_eq [of _ f A] reflE
-                 fix_subset [of f A, THEN subsetD])
-done
-
-lemma CompleteLatticeI_simp:
-     "\<lbrakk> \<lparr> pset = A, order = r \<rparr> \<in> PartialOrder;
-         \<forall>S. S \<subseteq> A \<longrightarrow> (\<exists>L. isLub S 
\<lparr> pset = A, order = r \<rparr>  L) \<rbrakk>
-    \<Longrightarrow> \<lparr> pset = A, order = r \<rparr> \<in> 
CompleteLattice"
-by (simp add: CompleteLatticeI Rdual)
-
-theorem (in CLF) Tarski_full:
-     "\<lparr> pset = P, order = induced P r\<rparr> \<in> CompleteLattice"
-apply (rule CompleteLatticeI_simp)
-apply (rule fixf_po, clarify)
-apply (simp add: P_def A_def r_def)
-apply (rule Tarski.tarski_full_lemma [OF Tarski.intro [OF _ 
Tarski_axioms.intro]])
-proof - show "CLF cl f" .. qed
-
-end
diff --git a/isar/interface b/isar/interface
deleted file mode 100755
index 16d7d56785..0000000000
--- a/isar/interface
+++ /dev/null
@@ -1,205 +0,0 @@
-#!/usr/bin/env bash
-#
-# $Id$
-#
-# Proof General interface wrapper for Isabelle.
-
-
-## self references
-
-THIS="$(cd "$(dirname "$0")"; pwd)"
-SUPER="$(cd "$THIS/.."; pwd)"
-
-
-## diagnostics
-
-usage()
-{
-  echo
-  echo "Usage: isabelle emacs [OPTIONS] [FILES ...]"
-  echo
-  echo "  Options are:"
-  echo "    -L NAME      abbreviates -l NAME -k NAME"
-  echo "    -U BOOL      enable UTF-8 communication (default true)"
-  echo "    -f FONT      specify Emacs font"
-  echo "    -g GEOMETRY  specify Emacs geometry"
-  echo "    -k NAME      use specific isar-keywords for named logic"
-  echo "    -l NAME      logic image name (default 
\$ISABELLE_LOGIC=$ISABELLE_LOGIC)"
-  echo "    -m MODE      add print mode for output"
-  echo "    -p NAME      Emacs program name (default emacs)"
-  echo "    -u BOOL      use personal .emacs file (default true)"
-  echo "    -w BOOL      use window system (default true)"
-  echo "    -x BOOL      render Isabelle symbols via Unicode (default false)"
-  echo
-  echo "Starts Proof General for Isabelle with theory and proof FILES"
-  echo "(default Scratch.thy)."
-  echo
-  echo "  PROOFGENERAL_OPTIONS=$PROOFGENERAL_OPTIONS"
-  echo
-  exit 1
-}
-
-fail()
-{
-  echo "$1" >&2
-  exit 2
-}
-
-
-## process command line
-
-# options
-
-ISABELLE_OPTIONS=""
-
-KEYWORDS=""
-LOGIC="$ISABELLE_LOGIC"
-UNICODE=""
-FONT=""
-GEOMETRY=""
-PROGNAME="emacs"
-INITFILE="true"
-WINDOWSYSTEM="true"
-UNICODE_SYMBOLS=""
-
-getoptions()
-{
-  OPTIND=1
-  while getopts "L:U:f:g:k:l:m:p:u:w:x:" OPT
-  do
-    case "$OPT" in
-      L)
-        KEYWORDS="$OPTARG"
-        LOGIC="$OPTARG"
-        ;;
-      U)
-        UNICODE="$OPTARG"
-        ;;
-      f)
-        FONT="$OPTARG"
-        ;;
-      g)
-        GEOMETRY="$OPTARG"
-        ;;
-      k)
-        KEYWORDS="$OPTARG"
-        ;;
-      l)
-        LOGIC="$OPTARG"
-        ;;
-      m)
-        if [ -z "$ISABELLE_OPTIONS" ]; then
-          ISABELLE_OPTIONS="-m $OPTARG"
-        else
-          ISABELLE_OPTIONS="$ISABELLE_OPTIONS -m $OPTARG"
-        fi
-        ;;
-      p)
-        PROGNAME="$OPTARG"
-        ;;
-      u)
-        INITFILE="$OPTARG"
-        ;;
-      w)
-        WINDOWSYSTEM="$OPTARG"
-        ;;
-      x)
-        UNICODE_SYMBOLS="$OPTARG"
-        ;;
-      \?)
-        usage
-        ;;
-    esac
-  done
-}
-
-eval "OPTIONS=($PROOFGENERAL_OPTIONS)"
-getoptions "${OPTIONS[@]}"
-
-getoptions "$@"
-shift $(($OPTIND - 1))
-
-
-# args
-
-declare -a FILES=()
-
-if [ "$#" -eq 0 ]; then
-  FILES["${#FILES[@]}"]="Scratch.thy"
-else
-  while [ "$#" -gt 0 ]; do
-    FILES["${#FILES[@]}"]="$1"
-    shift
-  done
-fi
-
-
-## main
-
-declare -a ARGS=()
-
-if [ -n "$FONT" ]; then
-  ARGS["${#ARGS[@]}"]="-fn"
-  ARGS["${#ARGS[@]}"]="$FONT"
-fi
-
-if [ -n "$GEOMETRY" ]; then
-  ARGS["${#ARGS[@]}"]="-geometry"
-  ARGS["${#ARGS[@]}"]="$GEOMETRY"
-fi
-
-[ "$INITFILE" = false ] && ARGS["${#ARGS[@]}"]="-q"
-[ "$WINDOWSYSTEM" = false ] && ARGS["${#ARGS[@]}"]="-nw"
-
-ARGS["${#ARGS[@]}"]="-l"
-ARGS["${#ARGS[@]}"]="$SUPER/isar/interface-setup.el"
-
-if [ -n "$KEYWORDS" ]; then
-  if [ -f "$ISABELLE_HOME_USER/etc/isar-keywords-$KEYWORDS.el" ]; then
-    ARGS["${#ARGS[@]}"]="-l"
-    ARGS["${#ARGS[@]}"]="$ISABELLE_HOME_USER/etc/isar-keywords-$KEYWORDS.el"
-  elif [ -f "$ISABELLE_HOME/etc/isar-keywords-$KEYWORDS.el" ]; then
-    ARGS["${#ARGS[@]}"]="-l"
-    ARGS["${#ARGS[@]}"]="$ISABELLE_HOME/etc/isar-keywords-$KEYWORDS.el"
-  else
-    fail "No isar-keywords file for '$KEYWORDS'"
-  fi
-elif [ -f "$ISABELLE_HOME_USER/etc/isar-keywords.el" ]; then
-  ARGS["${#ARGS[@]}"]="-l"
-  ARGS["${#ARGS[@]}"]="$ISABELLE_HOME_USER/etc/isar-keywords.el"
-elif [ -f "$ISABELLE_HOME/etc/isar-keywords.el" ]; then
-  ARGS["${#ARGS[@]}"]="-l"
-  ARGS["${#ARGS[@]}"]="$ISABELLE_HOME/etc/isar-keywords.el"
-fi
-
-for FILE in "$ISABELLE_HOME/etc/proofgeneral-settings.el" \
-    "$ISABELLE_HOME_USER/etc/proofgeneral-settings.el"
-do
-  if [ -f "$FILE" ]; then
-    ARGS["${#ARGS[@]}"]="-l"
-    ARGS["${#ARGS[@]}"]="$FILE"
-  fi
-done
-
-case "$LOGIC" in
-  /*)
-    ;;
-  */*)
-    LOGIC="$(pwd -P)/$LOGIC"
-    ;;
-esac
-
-export PROOFGENERAL_HOME="$SUPER"
-export PROOFGENERAL_ASSISTANTS="isar"
-export PROOFGENERAL_LOGIC="$LOGIC"
-export PROOFGENERAL_UNICODE="$UNICODE"
-export PROOFGENERAL_UNICODE_SYMBOLS="$UNICODE_SYMBOLS"
-
-export ISABELLE_OPTIONS
-
-# Isabelle2008 compatibility
-[ -z "$ISABELLE_PROCESS" ] && export ISABELLE_PROCESS="$ISABELLE"
-[ -z "$ISABELLE_TOOL" ] && export ISABELLE_TOOL="$ISATOOL"
-
-exec "$PROGNAME" "${ARGS[@]}" "${FILES[@]}"
-
diff --git a/isar/interface-setup.el b/isar/interface-setup.el
deleted file mode 100644
index 4cf12aac71..0000000000
--- a/isar/interface-setup.el
+++ /dev/null
@@ -1,40 +0,0 @@
-;; interface-setup.el Interface wrapper for Isabelle Proof General
-;;
-;; This file is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
-;;
-;; Author: Markus Wenzel <wenzelm@in.tum.de>
-;;
-;; interface-setup.el,v 7.0 2002/08/29 09:14:03 da Exp
-;;
-
-;;
-;; Tool bar
-;;
-
-(if (and window-system (fboundp 'tool-bar-mode)) (tool-bar-mode t))
-
-;;
-;; Unicode
-;;
-
-(let ((unicode (getenv "PROOFGENERAL_UNICODE")))
-  (if (and unicode (not (equal unicode "")))
-      (customize-set-variable 'proof-shell-unicode (equal unicode "true"))))
-
-;;
-;; Unicode symbols
-;;
-
-(let ((symbols (getenv "PROOFGENERAL_UNICODE_SYMBOLS")))
-  (if (and symbols (not (equal symbols "")))
-      (customize-set-variable 'isar-unicode-tokens-enable (equal symbols 
"true"))))
-
-;;
-;; Proof General startup
-;;
-
-(if (not (featurep 'proof-site))
-    (load (concat (getenv "PROOFGENERAL_HOME") "/generic/proof-site.el")))
diff --git a/isar/isabelle-system.el b/isar/isabelle-system.el
deleted file mode 100644
index 4fb2bcde38..0000000000
--- a/isar/isabelle-system.el
+++ /dev/null
@@ -1,375 +0,0 @@
-;; isabelle-system.el --- Interface with Isabelle system
-;;
-;; Copyright (C) 2000 LFCS Edinburgh, David Aspinall.
-;; Copyright (C) 2018  Free Software Foundation, Inc.
-;;
-;; Author:      David Aspinall <da@dcs.ed.ac.uk>
-;; Maintainer:  Proof General maintainer <proofgen@dcs.ed.ac.uk>
-;;
-;; $Id$
-;;
-;; Most of this code is taken from the final version of Isamode.
-;; --------------------------------------------------------------
-;;
-
-;;; Code:
-
-(require 'cl-lib)                       ;cl-mapcan
-(eval-when-compile
-  (require 'span)
-  (require 'scomint)
-  (require 'proof-site)
-  (require 'proof-menu)
-  (require 'proof-syntax))
-(defvar proof-assistant-menu)
-
-(declare-function mapcan "cl-extra")   ; spurious bytecomp warning
-
-
-;; The isabelle custom group won't have been defined yet.
-(defgroup isabelle nil
-  "Customization of user options for Isabelle and Isabelle/Isar Proof General"
-  :group 'proof-general)
-
-(defcustom isabelle-web-page
-  "http://www.cl.cam.ac.uk/Research/HVG/Isabelle/";
-  "URL of web page for Isabelle."
-  :type 'string
-  :group 'isabelle)
-
-
-;;; ================ Extract Isabelle settings ================
-
-(defcustom isa-isabelle-command
-  (or (if proof-rsh-command
-         ;; not much hope to locate executable remotely
-         (concat proof-rsh-command " isabelle"))
-      (getenv "ISABELLE_TOOL")
-      (proof-locate-executable "isabelle" nil
-                              (list
-                               ;; support default unpack in home dir situation
-                               (concat (getenv "HOME") "/Isabelle/bin/")
-                               ;; or Mac Package for Isabelle2014
-                               "/Applications/Isabelle2014.app/Isabelle/bin/"
-                               ))
-      "path_to_isabelle_is_unknown")
-  "Command to invoke the main Isabelle wrapper 'isabelle'.
-Emacs should be able to find `isabelle' if it is on the PATH when
-started.  Then several standard locations are attempted.
-Otherwise you should set this, using a full path name here for reliable
-working."
-  :type 'file
-  :group 'isabelle)
-
-(defvar isabelle-not-found nil
-  "Non-nil if user has been prompted for `isabelle' already and it wasn't 
found.")
-
-(defun isa-set-isabelle-command (&optional force)
-  "Make sure `isa-isabelle-command' points to a valid executable.
-If it does not, or if prefix arg supplied, prompt the user for
-the proper setting.  If `proof-rsh-command' is set, leave this
-unverified.  Otherwise, returns non-nil if isa-isabelle-command
-is surely an executable with full path."
-  (interactive "p")
-  (when (and (not noninteractive)
-             (not (bound-and-true-p byte-compile-current-file))
-            (not proof-rsh-command)
-            (or force
-                isabelle-not-found
-                (not (file-executable-p isa-isabelle-command))))
-    (setq isa-isabelle-command
-         (read-file-name
-          "Full path to `isabelle' command (anything non-executable if you 
don't have it): "
-          nil nil nil))
-    (unless (file-executable-p isa-isabelle-command)
-      (setq isabelle-not-found t)
-      (beep)
-      (warn "Proof General: isabelle command not found; some menus will be 
incomplete and Isabelle may not run correctly.  Please check your Isabelle 
installation.")))
-  (or proof-rsh-command
-      (file-executable-p isa-isabelle-command)))
-
-(defun isa-shell-command-to-string (command)
-  "Like shell-command-to-string except the last character is stripped."
-  (let ((s (shell-command-to-string command)))
-    (if (equal (length s) 0) s
-      (substring s 0 -1))))
-
-(defun isa-getenv (envvar &optional default)
-  "Extract environment variable ENVVAR setting using the `isabelle' program.
-If the isabelle command is not available, try using elisp's getenv
-to extract the value from Emacs' environment.
-If there is no setting for the variable, DEFAULT will be returned"
-  (isa-set-isabelle-command)
-  (if (or proof-rsh-command
-         (file-executable-p isa-isabelle-command))
-      (let ((setting (isa-shell-command-to-string
-                     (concat "\"" isa-isabelle-command
-                             "\" getenv -b " envvar))))
-       (if (string-equal setting "")
-           default
-         setting))
-    (or (getenv envvar) default)))
-
-;;;
-;;; ======= Interaction with System using Isabelle tools =======
-;;;
-
-(defcustom isabelle-program-name-override nil
-  "*Name of executable program to run Isabelle.
-
-You can set customize this in case the automatic settings
-mechanism does not work for you, perhaps because isabelle
-is not on your path, or you are running it remotely.
-
-The logic image name is tagged onto the end."
-  :type 'file
-  :group 'isabelle)
-
-(defun isa-tool-list-logics ()
-  "Generate a list of available object logics."
-  (if (isa-set-isabelle-command)
-      (delete "" (split-string
-                 (isa-shell-command-to-string
-                  (concat "\"" isa-isabelle-command "\" findlogics")) "[ 
\t]"))))
-
-(defcustom isabelle-logics-available nil
-  "*List of logics available to use with Isabelle.
-If the `isabelle' program is available, this is automatically
-generated with the Lisp form `(isa-tool-list-logics)'."
-  :type (list 'string)
-  :group 'isabelle)
-
-(unless (or noninteractive (bound-and-true-p byte-compile-current-file))
-  (setq isabelle-logics-available (isa-tool-list-logics)))
-
-(defcustom isabelle-chosen-logic nil
-  "*Choice of logic to use with Isabelle.
-If non-nil, added onto the Isabelle command line for invoking Isabelle.
-
-You can set this as a file local variable, using a special comment
-at the top of your theory file, like this:
-
-   (* -*- isabelle-chosen-logic: \"ZF\" -*- *)"
-  :type (append
-        (list 'choice)
-        (mapcar (lambda (str) (list 'const str)) isabelle-logics-available)
-        (list '(string :tag "Choose another")
-              '(const :tag "Unset (use default)" nil)))
-  :group 'isabelle)
-(put 'isabelle-chosen-logic 'safe-local-variable 'stringp)
-
-(defvar isabelle-chosen-logic-prev nil
-  "Value of `isabelle-chosen-logic' on last call of `isabelle-set-prog-name'.")
-
-(defun isabelle-hack-local-variables-function ()
-  "Hook function for `hack-local-variables-hook'."
-  (if (and isabelle-chosen-logic
-          (not (equal isabelle-chosen-logic
-                      isabelle-chosen-logic-prev))
-          (proof-shell-live-buffer))
-      (message "Warning: chosen logic %s does not match running Isabelle 
instance"
-              isabelle-chosen-logic)))
-
-(add-hook 'hack-local-variables-hook
-         'isabelle-hack-local-variables-function)
-
-(defun isabelle-set-prog-name (&optional filename)
-  "Make proper command line for running Isabelle.
-This function sets `proof-prog-name' and `isar-prog-args'."
-  (let*
-      ;; The ISABELLE_PROCESS and PROOFGENERAL_LOGIC values (set when
-      ;; run under the interface wrapper script) indicate command line
-      ;; is set in current Isabelle settings environment.
-      ((isabelle (or
-                 isabelle-program-name-override  ; override in Emacs
-                 (getenv "ISABELLE_PROCESS")     ; command line override
-                 (isa-getenv "ISABELLE_PROCESS") ; choose to match isabelle
-                 "isabelle-process"))            ; to
-       (isabelle-opts (split-string (or (getenv "ISABELLE_OPTIONS") "")))
-       (opts (append (list "-PI")  ;; Proof General + Isar
-                    (if proof-shell-unicode (list "-m" "PGASCII") nil)
-                    isabelle-opts))
-       (logic (or isabelle-chosen-logic
-                 (getenv "PROOFGENERAL_LOGIC")))
-       (logicarg (if (and logic (not (equal logic "")))
-                    (list logic) nil)))
-    (setq isabelle-chosen-logic-prev isabelle-chosen-logic)
-    (setq isar-prog-args (append opts logicarg))
-    (setq proof-prog-name isabelle)))
-
-(defun isabelle-choose-logic (logic)
-  "Adjust isabelle-prog-name and proof-prog-name for running LOGIC."
-  (interactive
-   (list (completing-read
-         "Use logic: "
-         (mapcar 'list (cons "Default"
-                             isabelle-logics-available)))))
-  (if (proof-shell-live-buffer)
-      (error "Can't change logic while Isabelle is running, please exit 
process first!"))
-  (customize-set-variable 'isabelle-chosen-logic
-                         (unless (string-equal logic "Default") logic))
-  (isabelle-set-prog-name)
-  ;; Settings are potentially different between logics, and
-  ;; so are Isar keywords.  Set these to nil so they get
-  ;; automatically re-initialised.
-  ;; FIXME: Isar keywords change not handled yet.
-  (setq proof-assistant-settings nil)
-  (setq proof-menu-settings nil))
-
-(defun isa-view-doc (docname)
-  "View Isabelle document DOCNAME, using Isabelle tools."
-  (if (isa-set-isabelle-command)
-      (apply 'start-process
-            "isa-view-doc" nil
-            (list isa-isabelle-command "doc" docname))))
-
-(defun isa-tool-list-docs ()
-  "Generate a list of documentation files available, with descriptions.
-This function returns a list of lists of the form
- ((DOCNAME DESCRIPTION) ....)
-of Isabelle document names and descriptions.  When DOCNAME is
-passed to isa-tool-doc-command, DOCNAME will be viewed."
-  (if (isa-set-isabelle-command)
-      (let ((docs (isa-shell-command-to-string
-                  (concat "\"" isa-isabelle-command "\" doc"))))
-       (unless (string-equal docs "")
-         (cl-mapcan
-          (function (lambda (docdes)
-                      (if (proof-string-match "^[ \t]+\\(\\S-+\\)[ \t]+" 
docdes)
-                          (list (list
-                                 (substring docdes (match-beginning 1) 
(match-end 1))
-                                 (substring docdes (match-end 0)))))))
-          (split-string docs "\n"))))))
-
-(defconst isabelle-verbatim-regexp "\\`\^VERBATIM: \\(\\(.\\|\n\\)*\\)\\'"
-  "Regexp matching internal marker for verbatim command output.")
-
-(defun isabelle-verbatim (str)
-  "Mark internal command STR for verbatim output."
-  (concat "\^VERBATIM: " str))
-
-
-;;; ==========  Utility functions ==========
-
-(defcustom isabelle-refresh-logics t
-  "*Whether to refresh the list of logics during an interactive session.
-If non-nil, then `isabelle findlogics' will be used to regenerate
-the `isabelle-logics-available' setting.  If this tool does not work
-for you, you should disable this behaviour."
-  :type 'boolean
-  :group 'isabelle)
-
-(defvar isabelle-docs-menu
-  (let ((vc (lambda (docdes)
-              (vector (car (cdr docdes))
-                      (list 'isa-view-doc (car docdes)) t))))
-    (list (cons "Isabelle Documentation" (mapcar vc (isa-tool-list-docs)))))
-  "Isabelle documentation menu.  Constructed when PG is loaded.")
-
-(defvar isabelle-logics-menu-entries nil
-  "Menu of logics available.")
-
-(defun isabelle-logics-menu-calculate ()
-  (setq isabelle-logics-menu-entries
-       (cons "Logics"
-             (append
-              '(["Default"
-                 (isabelle-choose-logic nil)
-                 :active (not (proof-shell-live-buffer))
-                 :style radio
-                 :selected (not isabelle-chosen-logic)
-                 :help "Switch to default logic"])
-              (mapcar (lambda (l)
-                        (vector l (list 'isabelle-choose-logic l)
-                                :active '(not (proof-shell-live-buffer))
-                                :style 'radio
-                                :selected (list 'equal 'isabelle-chosen-logic 
l)
-                                :help (format "Switch to %s logic" l)))
-                      isabelle-logics-available)))))
-
-(unless (or noninteractive (bound-and-true-p byte-compile-current-file))
-  (isabelle-logics-menu-calculate))
-
-(defvar isabelle-time-to-refresh-logics t
-  "Non-nil if we should refresh the logics list.")
-
-
-(defun isabelle-logics-menu-refresh ()
-  "Refresh isabelle-logics-menu-entries, returning new entries."
-  (interactive)
-  (if (and isabelle-refresh-logics
-          (or isabelle-time-to-refresh-logics (called-interactively-p 'any)))
-      (progn
-       (setq isabelle-logics-available (isa-tool-list-logics))
-       (isabelle-logics-menu-calculate)
-       ;; update the menu manually
-       (easy-menu-add-item proof-assistant-menu nil
-                           isabelle-logics-menu-entries)
-       (setq isabelle-time-to-refresh-logics nil) ;; just done it, don't 
repeat!
-       (run-with-timer 4 nil ;; short delay to avoid doing this too often
-                       (lambda () (setq isabelle-time-to-refresh-logics t))))))
-
-(defun isabelle-menu-bar-update-logics ()
-  "Update logics menu."
-  (and (current-local-map)
-       (keymapp (lookup-key (current-local-map)
-                           (vector 'menu-bar (intern proof-assistant))))
-       (isabelle-logics-menu-refresh)))
-
-(add-hook 'menu-bar-update-hook 'isabelle-menu-bar-update-logics)
-
-
-;; Added in PG 3.4: load isar-keywords file.
-;; This roughly follows the method given in the interface script.
-;; It could be used to add an elisp command at the bottom of
-;; a theory file, if we sorted out the load order a bit, or
-;; added a facility to reconfigure.
-;; TODO: also add something to spill out a keywords file?
-(defun isabelle-load-isar-keywords (&optional kw)
-  (interactive "sLoad isar keywords: ")
-  (let ((userhome  (isa-getenv "ISABELLE_HOME_USER"))
-       (isahome   (isa-getenv "ISABELLE_HOME"))
-       (isarkwel  "%s/etc/isar-keywords-%s.el")
-       (isarel    "%s/etc/isar-keywords.el")
-       (ifrdble   (lambda (f) (if (file-readable-p f) f))))
-    (load-file
-     (or
-      (and kw (funcall ifrdble (format isarkwel userhome kw)))
-      (and kw (funcall ifrdble (format isarkwel isahome kw)))
-      (funcall ifrdble (format isarel userhome))
-      (funcall ifrdble (format isarel isahome))
-      (locate-library "isar-keywords")))))
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;
-;; Context-senstive in-span menu additions
-;;
-
-(defun isabelle-create-span-menu (span idiom name)
-  (if (eq idiom 'proof)
-      (let ((thm (span-property span 'name)))
-       (list (vector
-              "Visualise dependencies"
-              `(proof-shell-invisible-command
-                ,(format "thm_deps %s;" thm))
-              (not (string-equal thm proof-unnamed-theorem-name)))))))
-
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;
-;; XML as an SML string: add escapes for quotes
-;;
-
-(defun isabelle-xml-sml-escapes (xmlstring)
-  (replace-regexp-in-string "\"" "\\\"" xmlstring t t))
-
-(defun isabelle-process-pgip (xmlstring)
-  "Return an Isabelle or Isabelle/Isar command to process PGIP in XMLSTRING."
-  (format "ProofGeneral.process_pgip \"%s\";"
-         (isabelle-xml-sml-escapes xmlstring)))
-
-
-(provide 'isabelle-system)
-;;; isabelle-system.el ends here
diff --git a/isar/isar-autotest.el b/isar/isar-autotest.el
deleted file mode 100644
index 8e098a291e..0000000000
--- a/isar/isar-autotest.el
+++ /dev/null
@@ -1,117 +0,0 @@
-;; isar-autotest.el: tests of Isar Proof General.
-;;
-;; You can run these by issuing "make test.isar" in PG home dir.
-;;
-;; $Id$
-;;
-
-(defvar isar-long-tests nil
-  "Whether or not to perform lengthy tests")
-
-(require 'pg-autotest)
-
-(require 'proof-site)
-(proof-ready-for-assistant 'isar)
-
-(declare-function isar-tracing:auto-quickcheck-toggle "isar.el")
-(declare-function isar-tracing:auto-solve-direct-toggle "isar.el")
-(declare-function isar-proof:parallel-proofs-toggle "isar.el")
-
-(unless (bound-and-true-p byte-compile-current-file)
-
-  (pg-autotest start) ; can add 'debug flag for debug-on-error
-
-  (pg-autotest log ".autotest.log")  ; convention
-
-  (pg-autotest timestart 'total)
-
-  (pg-autotest remark "Testing standard Example.thy, Example-Xsym.thy")
-  (pg-autotest script-wholefile "isar/Example.thy")
-
-  ;; Test Trac#344 (nested spans bug with old-style undo)
-  ;; TODO: should test with both undo styles
-  (pg-autotest eval (proof-retract-buffer))
-  (proof-shell-wait)
-  (goto-char 135) ; first line
-  (pg-autotest eval (proof-goto-point))
-  (proof-shell-wait)
-  (pg-autotest eval (proof-retract-buffer))
-  (proof-shell-wait)
-  (goto-char 135) ; first line
-  (pg-autotest eval (proof-goto-point))
-  (proof-shell-wait)
-  (pg-autotest eval (proof-process-buffer))
-  (pg-autotest assert-full)
-  
-
-  ;; Speed up prover
-  (pg-autotest eval (isar-tracing:auto-quickcheck-toggle 0))
-  (pg-autotest eval (isar-tracing:auto-solve-direct-toggle 0)) ; autosolve 
hammers this!
-  (pg-autotest eval (proof-full-annotation-toggle 0))
-  (pg-autotest eval (isar-proof:parallel-proofs-toggle 0))
-  (proof-shell-wait)
-
-  (pg-autotest script-wholefile "isar/Example-Tokens.thy")
-
-  (pg-autotest remark "Testing prove-as-you-go (not replay)")
-  (find-file ".autotest.thy")
-  (erase-buffer) ; just in case exists
-  (setq buffer-file-name nil)
-  (pg-autotest eval (proof-electric-terminator-toggle 1))
-  (pg-autotest eval (insert "theory Example imports Main begin ")) ; no \n
-  (proof-electric-terminator)
-  (pg-autotest eval (insert "theorem and_comms: \"A & B --> B & A\"\n"))
-  (proof-electric-terminator)
-  (pg-autotest eval (insert "apply auto done\n"))
-  (pg-autotest eval (insert "end"))
-  (proof-electric-terminator)
-  (pg-autotest assert-full)
-  ;; Test Trac#138
-  (pg-autotest eval (proof-undo-last-successful-command))
-  (proof-shell-wait)
-  (pg-autotest eval (proof-goto-end-of-locked))
-  (pg-autotest eval (insert "(* this is a comment *)"))
-  (pg-autotest eval (proof-goto-point))
-  (proof-shell-wait)
-  (pg-autotest eval (skip-chars-backward " \n\t"))
-  (pg-autotest eval (insert " ")) ;; shouldn't give read-only error!
-  (set-buffer-modified-p nil)
-  (kill-buffer ".autotest.thy")
-
-  (pg-autotest remark "Now in tokens mode")
-  (pg-autotest eval (proof-unicode-tokens-toggle))
-  (pg-autotest script-wholefile "isar/Example-Tokens.thy")
-
-  (pg-autotest remark "Testing random jumps and edits")
-  (pg-autotest script-randomjumps "isar/Example.thy" 8)
-
-  (when isar-long-tests
-    (pg-autotest remark "Larger files...")
-    (pg-autotest script-wholefile "etc/isar/AHundredTheorems.thy")
-    (pg-autotest script-wholefile "isar/ex/Tarski.thy")
-    (pg-autotest script-randomjumps "isar/ex/Tarski.thy" 10)) ; better test?
-
-
-  (pg-autotest remark "Testing restarting the prover")
-  (pg-autotest quit-prover)
-
-
-  (pg-autotest remark           "Simple test of multiple file behaviour:")
-  (pg-autotest script-wholefile  "etc/isar/multiple/C.thy")
-  (pg-autotest assert-processed   "etc/isar/multiple/C.thy")
-  (pg-autotest assert-processed   "etc/isar/multiple/A.thy")
-  (pg-autotest assert-processed   "etc/isar/multiple/B.thy")
-  (pg-autotest retract-file       "etc/isar/multiple/B.thy")
-  (pg-autotest assert-unprocessed "etc/isar/multiple/B.thy")
-  (pg-autotest assert-unprocessed "etc/isar/multiple/C.thy")
-  (pg-autotest assert-processed   "etc/isar/multiple/A.thy")
-
-
-  (pg-autotest quit-prover)
-  
-  (pg-autotest remark  "Complete")
-  (pg-autotest timetaken 'total)
-
-  (pg-autotest exit)
-
-  )
diff --git a/isar/isar-find-theorems.el b/isar/isar-find-theorems.el
deleted file mode 100644
index 15da9f6731..0000000000
--- a/isar/isar-find-theorems.el
+++ /dev/null
@@ -1,489 +0,0 @@
-;; isar-find-theorems.el    A search form for Isabelle's find_theorems command.
-;;
-;; Copyright (C) 2007 Tjark Weber <tjark.weber@gmx.de>
-;;
-;; This program is free software; you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License
-;; as published by the Free Software Foundation; either version 2
-;; of the License, or (at your option) any later version.
-;;
-;; $Id$
-;;
-
-(require 'pg-vars)
-(declare-function proof-find-theorems "pg-user")
-
-
-;; search form field values
-
-(defvar isar-find-theorems-data (list
-  ""      ;; num
-  ""      ;; pattern
-  "none"  ;; intro
-  "none"  ;; elim
-  "none"  ;; dest
-  ""      ;; name
-  ""      ;; simp
-  )
-  "Values of the Find Theorems search form's fields.")
-
-;; make the original (minibuffer based) "Find theorems" command (from
-;; ../generic/pg-user.el) available as isar-find-theorems-minibuffer;
-;; return '(nil) so that isar-find-theorems-minibuffer works as a
-;; value for isar-find-theorems-command
-
-(defun isar-find-theorems-minibuffer ()
-  "Search for items containing given constants (using the minibuffer)."
-  (interactive)
-  (let ((proof-find-theorems-command "find_theorems %s"))
-    (call-interactively 'proof-find-theorems))
-  '(nil))
-
-;; isar-find-theorems-form (just like isar-find-theorems-minibuffer) can be
-;; called interactively, and can be used as a value for
-;; proof-find-theorems-command (returning '(nil) means that the actual
-;; "find_theorems" command will NOT be issued to Isabelle by
-;; proof-find-theorems in this case, but only later on by a handler function
-;; for the form's "Find" button)
-
-(defun isar-find-theorems-form ()
-  "Search for items containing given constants (using a search form)."
-  (interactive)
-  (apply 'isar-find-theorems-create-searchform isar-find-theorems-data)
-  '(nil))
-
-;; update the universal key bindings (see ../generic/pg-vars.el)
-;;
-;; C-c C-a C-m is bound to isar-find-theorems-minibuffer
-;; C-c C-a C-f is bound to isar-find-theorems-form
-;;
-;; Note that C-c C-a C-f, although C-c C-a usually invokes the prover
-;; assistant specific keymap, is defined as a universal key binding here.
-;; This way it will be available in the same buffers as C-c C-f.
-
-(setq proof-universal-keys
-  (cons
-    '([(control c) (control a) (control m)] . isar-find-theorems-minibuffer)
-    (cons
-      '([(control c) (control a) (control f)] . isar-find-theorems-form)
-      proof-universal-keys)))
-
-;; Documentation, taken from isabelle/NEWS:
-;;
-;; * Command 'find_theorems' searches for a list of criteria instead of a
-;; list of constants. Known criteria are: intro, elim, dest, name:string,
-;; simp:term, and any term. Criteria can be preceded by '-' to select
-;; theorems that do not match. Intro, elim, dest select theorems that
-;; match the current goal, name:s selects theorems whose fully qualified
-;; name contain s, and simp:term selects all simplification rules whose
-;; lhs match term.  Any other term is interpreted as pattern and selects
-;; all theorems matching the pattern. Available in ProofGeneral under
-;; 'ProofGeneral -> Find Theorems' or C-c C-f.  Example:
-;;
-;;   C-c C-f (100) "(_::nat) + _ + _" intro -name: "HOL."
-;;
-;; prints the last 100 theorems matching the pattern "(_::nat) + _ + _",
-;; matching the current goal as introduction rule and not having "HOL."
-;; in their name (i.e. not being defined in theory HOL).
-
-;; search form widgets (set in isar-find-theorems-create-searchform
-;; and accessed in the "Find" handler)
-
-(defvar isar-find-theorems-widget-number nil
-  "Search form widget for the number of theorems.")
-
-(defvar isar-find-theorems-widget-pattern nil
-  "Search form widget for search patterns.")
-
-(defvar isar-find-theorems-widget-intro nil
-  "Search form widget for intro rules.")
-
-(defvar isar-find-theorems-widget-elim nil
-  "Search form widget for elim rules.")
-
-(defvar isar-find-theorems-widget-dest nil
-  "Search form widget for dest rules.")
-
-(defvar isar-find-theorems-widget-name nil
-  "Search form widget for theorem names.")
-
-(defvar isar-find-theorems-widget-simp nil
-  "Search form widget for simplification rules.")
-
-;; creates (or switches to) the search form buffer
-
-(defun isar-find-theorems-create-searchform
-    (num pattern intro elim dest name simp &optional errmsg)
-  "Create (or switch to) the Find Theorems search form buffer."
-
-  (if (get-buffer "*Find Theorems*")
-    (switch-to-buffer "*Find Theorems*")
-
-  ;; create a new search form
-
-  (switch-to-buffer "*Find Theorems*")
-
-  (widget-insert
-    (concat "\n  "
-      (if (fboundp 'propertize)
-       (propertize "Find Theorems" 'face 'bold)
-      "Find Theorems")
-      "\n\n"))
-
-  ;; pattern
-  (widget-insert "  Search pattern: ")
-  (setq isar-find-theorems-widget-pattern (widget-create 'editable-field
-    :size 50
-    :help-echo "A pattern to match in the theorem."
-    pattern))
-  (widget-insert " ")
-  (widget-create 'push-button
-    :help-echo "Click <mouse-2> for help."
-    :notify (lambda (&rest ignore) (isar-find-theorems-create-help))
-    "?")
-
-  ;; name
-  (widget-insert "\n\n  Theorem name:   ")
-  (setq isar-find-theorems-widget-name (widget-create 'editable-field
-    :size 50
-    :help-echo "Part of the theorem's name."
-    name))
-  (widget-insert " ")
-  (widget-create 'push-button
-    :help-echo "Click <mouse-2> for help."
-    :notify (lambda (&rest ignore) (isar-find-theorems-create-help))
-    "?")
-
-  ;; intro
-  (widget-insert "\n\n  Rules matching the current goal: ")
-  (widget-create 'push-button
-    :help-echo "Click <mouse-2> for help."
-    :notify (lambda (&rest ignore) (isar-find-theorems-create-help))
-    "?")
-  (widget-insert "\n\n    INTRO:\n      ")
-    (setq isar-find-theorems-widget-intro (widget-create 'radio-button-choice
-    :value intro
-    :indent 6
-    :button-args (list :help-echo "Click <mouse-2> to select one option.")
-    '(item "none") '(item "intro") '(item "-intro")))
-
-  ;; elim
-  (widget-insert "\n    ELIM:\n      ")
-  (setq isar-find-theorems-widget-elim (widget-create 'radio-button-choice
-    :value elim
-    :indent 6
-    :button-args (list :help-echo "Click <mouse-2> to select one option.")
-    '(item "none") '(item "elim") '(item "-elim")))
-
-  ;; dest
-  (widget-insert "\n    DEST:\n      ")
-  (setq isar-find-theorems-widget-dest (widget-create 'radio-button-choice
-    :value dest
-    :indent 6
-    :button-args (list :help-echo "Click <mouse-2> to select one option.")
-    '(item "none") '(item "dest") '(item "-dest")))
-
-  ;; simp
-  (widget-insert "\n  Simplification pattern: ")
-  (setq isar-find-theorems-widget-simp (widget-create 'editable-field
-    :size 42
-    :help-echo
-      "A pattern to match in the left-hand side of a simplification rule."
-    simp))
-  (widget-insert " ")
-  (widget-create 'push-button
-    :help-echo "Click <mouse-2> for help."
-    :notify (lambda (&rest ignore) (isar-find-theorems-create-help))
-    "?")
-
-  ;; num
-  (widget-insert "\n\n  Number of results:      ")
-  (setq isar-find-theorems-widget-number (widget-create 'editable-field
-    :size 10
-    :help-echo "Maximum number of results to be displayed."
-    num))
-  (widget-insert " ")
-  (widget-create 'push-button
-    :help-echo "Click <mouse-2> for help."
-    :notify (lambda (&rest ignore) (isar-find-theorems-create-help))
-    "?")
-
-  ;; Find
-  (widget-insert "\n\n  ")
-    (widget-create 'push-button
-    :help-echo "Click <mouse-2> to submit this form."
-    :notify (lambda (&rest ignore)
-      (let ((num     (widget-value isar-find-theorems-widget-number))
-           (pattern (widget-value isar-find-theorems-widget-pattern))
-           (intro   (widget-value isar-find-theorems-widget-intro))
-           (elim    (widget-value isar-find-theorems-widget-elim))
-           (dest    (widget-value isar-find-theorems-widget-dest))
-           (name    (widget-value isar-find-theorems-widget-name))
-           (simp    (widget-value isar-find-theorems-widget-simp)))
-      (kill-buffer "*Find Theorems*")
-      (isar-find-theorems-submit-searchform
-       num pattern intro elim dest name simp)))
-    "Find")
-
-  ;; Reset form
-    (widget-insert "    ")
-    (widget-create 'push-button
-    :help-echo "Click <mouse-2> to reset this form."
-    :notify (lambda (&rest ignore)
-      (kill-buffer "*Find Theorems*")
-      (isar-find-theorems-create-searchform
-       "" "" "none" "none" "none" "" ""))
-    "Reset Form")
-    (widget-insert "\n")
-
-  ;; errmsg
-  (if errmsg
-    (widget-insert (concat "\n    "
-      (if (fboundp 'propertize)
-       (propertize (concat errmsg "\n    See help for details.") 'face 'bold)
-      (concat errmsg "\n    See help for details."))
-      "\n")))
-
-  (use-local-map widget-keymap)
-  (widget-setup)
-
-  (goto-char 37))  ;; beginning of the "Search pattern" text field
-)
-
-;; creates the search form help buffer
-
-(defun isar-find-theorems-create-help ()
-  "Create a help text buffer for the Find Theorems search form."
-
-  (with-output-to-temp-buffer "*Find Theorems - Help*"
-    (princ (concat
-      "\n"
-      "*** Find Theorems - Help ***\n"
-      "\n"
-      "Command \"Find Theorems\" (C-c C-f) searches for theorems that satisfy 
a list of\n"
-      "user-supplied criteria. Known criteria are:\n"
-      "\n"
-      "* Search pattern: a pattern that occurs in the theorem, e.g. \"(_::nat) 
+ _\".\n"
-      "\n"
-      "* Theorem name: a substring of the theorem's fully qualified name. 
(Treats \"*\"\n"
-      "                as a wildcard character.)\n"
-      "\n"
-      "* Intro, Elim, Dest: select theorems that match the current goal as\n"
-      "                     introduction/elimination/destruction rule.\n"
-      "\n"
-      "* Simplification pattern: selects simplification rules whose left-hand 
side\n"
-      "                          matches the given pattern.\n"
-      "\n"
-      "* Number of results: an upper bound on the number of theorems that 
are\n"
-      "                     displayed. (Leave empty to use Isabelle's default 
value.)\n"
-      "\n"
-      "Multiple search patterns, theorem names and simplification patterns can 
be\n"
-      "given, separated by spaces. (Patterns containing a space must be 
enclosed in\n"
-      "double-quotes.) Criteria can be preceded by \"-\" to select theorems 
that do not.\n"
-      "match. (Patterns that begin with a \"-\" must be enclosed in 
double-quotes.)\n"
-      "\n"
-      "A minibuffer based \"Find Theorems\" command is available via (C-c C-a 
C-m). See\n"
-      "the Isabelle NEWS file for up-to-date documentation. A search form is 
available\n"
-      "via (C-c C-a C-f). Variable proof-find-theorems-command (customizable 
via\n"
-      "Proof-General > Advanced > Internals > Prover Config) controls the 
default\n"
-      "behavior of the \"Find Theorems\" command: set to 
isar-find-theorems-form or\n"
-      "isar-find-theorems-minibuffer.\n"
-  )))
-)
-
-;; parses the search form's data and calls isar-find-theorems
-;; with an appropriate argument string, or displays the search
-;; form again, but with an error message
-
-(defun isar-find-theorems-submit-searchform
-    (num pattern intro elim dest name simp)
-  "Parse the Find Theorems search form's data."
-
-  (let (num_ pattern_ intro_ elim_ dest_ name_ simp_ searchstring)
-
-  ;; pattern
-  (setq pattern_ (isar-find-theorems-parse-criteria "" pattern))
-
-  (if (not (pop pattern_))
-    (isar-find-theorems-create-searchform
-      num pattern intro elim dest name simp
-      (concat "Invalid search pattern: " (car pattern_)))
-
-  (setq pattern_ (car pattern_))
-
-  ;; name
-  (setq name_ (isar-find-theorems-parse-criteria "name: " name))
-
-  (if (not (pop name_))
-    (isar-find-theorems-create-searchform
-      num pattern intro elim dest name simp
-      (concat "Invalid theorem name: " (car name_)))
-
-  (setq name_ (car name_))
-
-  ;; simp
-  (setq simp_ (isar-find-theorems-parse-criteria "simp: " simp))
-
-  (if (not (pop simp_))
-    (isar-find-theorems-create-searchform
-      num pattern intro elim dest name simp
-      (concat "Invalid simplification pattern: " (car simp_)))
-
-  (setq simp_ (car simp_))
-
-  ;; num
-  (setq num_ (isar-find-theorems-parse-number num))
-
-  (if (not num_)
-    (isar-find-theorems-create-searchform
-      num pattern intro elim dest name simp
-      "Number of results must be a positive integer.")
-
-  ;; intro
-  (setq intro_ (if (equal intro "none") "" intro))
-
-  ;; elim
-  (setq elim_ (if (equal elim "none") "" elim))
-
-  ;; dest
-  (setq dest_ (if (equal dest "none") "" dest))
-
-  ;; success: save data, call isar-find-theorems
-  (setq isar-find-theorems-data
-    (list num pattern intro elim dest name simp))
-
-  (setq searchstring (format "find_theorems %s"
-    (mapconcat 'identity
-      (isar-find-theorems-filter-empty
-       (list num_ pattern_ intro_ elim_ dest_ name_ simp_))
-      " ")))
-
-  ;; note that proof-find-theorems with an argument provided
-  ;; will merely pass this on to Isabelle, and NOT display
-  ;; the search form again
-  (proof-find-theorems searchstring))))))
-)
-
-;; "Multiple search patterns, theorem names and simplification terms can be
-;; given, separated by spaces. (Patterns containing a space must be enclosed
-;; in double-quotes.) Criteria can be preceded by "-" to select theorems that
-;; do not match. (Patterns that begin with a "-" must be enclosed in double-
-;; quotes.)"
-;;
-;; returns (t parsed-string) (where parsed-string may be empty) or
-;; (nil errmsg) in case of an error
-
-(defun isar-find-theorems-parse-criteria (option-string criteria-string)
-  "Parse search patterns/theorem names/simplification terms,
-separated by \" \", possibly preceded by \"-\", and possibly
-escaped by double-quotes."
-
-  ;; This code might benefit greatly from the use of regexps.
-
-  (let ((tokens nil) (errmsg nil))
-
-  ;; turn criteria-string into a list of (string) tokens
-  (while (and (not (equal criteria-string "")) (not errmsg))
-
-    ;; ignore space
-    (if (equal (elt criteria-string 0) ?\ )
-      (setq criteria-string (substring criteria-string 1))
-
-    ;; - is a token
-    ;; Note: This is still a bit weird, as it treats a - following a -
-    ;;       just like the first -, i.e. not as part of a pattern. Oh
-    ;;       well.
-    (if (equal (elt criteria-string 0) ?-)
-      (progn
-       (setq tokens (cons "-" tokens))
-       (setq criteria-string (substring criteria-string 1)))
-
-    ;; " starts a token: search for the next ", regard as one token
-    ;; Note: This is still a bit weird, as it does not require the
-    ;;       closing double-quotes to be followed by a space. Oh well.
-    (if (equal (elt criteria-string 0) ?\")
-      (let ((i 1))
-       (while (and (< i (length criteria-string))
-                   (not (equal (elt criteria-string i) ?\")))
-         (setq i (1+ i)))
-       (if (equal i (length criteria-string))
-         (setq errmsg "missing closing double-quotes.")
-       (setq i (1+ i))
-       (setq tokens (cons (substring criteria-string 0 i) tokens))
-       (setq criteria-string (substring criteria-string i))))
-
-    ;; everything else: search for the next space, regard as one token
-    ;; Note: This is still a bit weird, as it scans over double-quotes.
-    ;;       Oh well.
-    (let ((i 1))
-      (while (and (< i (length criteria-string))
-                 (not (equal (elt criteria-string i) ?\ )))
-       (setq i (1+ i)))
-      (setq tokens (cons (substring criteria-string 0 i) tokens))
-      (setq criteria-string (substring criteria-string i)))
-    )))
-  )
-
-  (if errmsg
-    (list nil errmsg)
-
-  (setq tokens (nreverse tokens))
-
-  ;; convert the tokens into argument strings; make sure every "-" is
-  ;; followed by a pattern/name (i.e. not by another "-")
-  (let ((strings nil) (negated nil))
-
-  (while (and tokens (not errmsg))
-    (let ((token (car tokens)))
-    (if (equal token "-")
-      (if negated
-       (setq errmsg "- may not be followed by another -.")
-      (setq negated t)
-      (setq tokens (cdr tokens)))
-    (setq strings (cons
-      (concat (if negated "-" "") option-string
-       ;; wrap token in double-quotes if necessary
-       (if (equal (elt token 0) ?\") token (concat "\"" token "\"")))
-      strings))
-    (setq negated nil)
-    (setq tokens (cdr tokens))))
-  )
-
-  (if errmsg
-    (list nil errmsg)
-
-  (if negated
-    (list nil "- must be followed by a search criterion.")
-
-  (setq strings (nreverse strings))
-
-  (list t (mapconcat 'identity strings " "))
-  )))))
-)
-
-;; auxiliary functions
-
-;; returns "" if num is "", "(num)" if num is a string encoding a positive
-;; integer, and nil otherwise
-
-(defun isar-find-theorems-parse-number (num)
-  "Parse the number of theorems to be displayed."
-  (if (equal num "")
-    ""
-  (let ((numval (string-to-number num)))
-  (if (and (wholenump numval) (not (equal numval 0)))
-    (concat "(" (number-to-string numval) ")")
-  nil)))
-)
-
-(defun isar-find-theorems-filter-empty (strings)
-  "Build a new list by removing empty strings from a (non-circular) list."
-  (if (not strings)
-    nil
-  (if (equal (car strings) "")
-    (isar-find-theorems-filter-empty (cdr strings))
-  (cons (car strings)
-    (isar-find-theorems-filter-empty (cdr strings)))))
-)
-
-(provide 'isar-find-theorems)
diff --git a/isar/isar-keywords.el b/isar/isar-keywords.el
deleted file mode 100644
index 07f9861a40..0000000000
--- a/isar/isar-keywords.el
+++ /dev/null
@@ -1,655 +0,0 @@
-;;
-;; Keyword classification tables for Isabelle/Isar.
-;; Generated from Pure + Pure-ProofGeneral + HOL + HOLCF + IOA + HOL-Boogie + 
HOL-Nominal + HOL-Statespace.
-;; *** DO NOT EDIT *** DO NOT EDIT *** DO NOT EDIT ***
-;;
-
-(defconst isar-keywords-major
-  '("\\."
-    "\\.\\."
-    "Isabelle\\.command"
-    "Isar\\.begin_document"
-    "Isar\\.define_command"
-    "Isar\\.edit_document"
-    "Isar\\.end_document"
-    "ML"
-    "ML_command"
-    "ML_prf"
-    "ML_val"
-    "ProofGeneral\\.inform_file_processed"
-    "ProofGeneral\\.inform_file_retracted"
-    "ProofGeneral\\.kill_proof"
-    "ProofGeneral\\.pr"
-    "ProofGeneral\\.process_pgip"
-    "ProofGeneral\\.restart"
-    "ProofGeneral\\.undo"
-    "abbreviation"
-    "also"
-    "apply"
-    "apply_end"
-    "arities"
-    "assume"
-    "atom_decl"
-    "attribute_setup"
-    "automaton"
-    "ax_specification"
-    "axiomatization"
-    "axioms"
-    "back"
-    "boogie_end"
-    "boogie_open"
-    "boogie_status"
-    "boogie_vc"
-    "by"
-    "cannot_undo"
-    "case"
-    "cd"
-    "chapter"
-    "class"
-    "class_deps"
-    "classes"
-    "classrel"
-    "code_abort"
-    "code_class"
-    "code_const"
-    "code_datatype"
-    "code_deps"
-    "code_include"
-    "code_instance"
-    "code_library"
-    "code_module"
-    "code_modulename"
-    "code_monad"
-    "code_pred"
-    "code_reflect"
-    "code_reserved"
-    "code_thms"
-    "code_type"
-    "coinductive"
-    "coinductive_set"
-    "commit"
-    "constdefs"
-    "consts"
-    "consts_code"
-    "context"
-    "corollary"
-    "cpodef"
-    "datatype"
-    "declaration"
-    "declare"
-    "def"
-    "default_sort"
-    "defer"
-    "defer_recdef"
-    "definition"
-    "defs"
-    "disable_pr"
-    "display_drafts"
-    "domain"
-    "domain_isomorphism"
-    "done"
-    "enable_pr"
-    "end"
-    "equivariance"
-    "example_proof"
-    "exit"
-    "export_code"
-    "extract"
-    "extract_type"
-    "finalconsts"
-    "finally"
-    "find_consts"
-    "find_theorems"
-    "fix"
-    "fixpat"
-    "fixrec"
-    "from"
-    "full_prf"
-    "fun"
-    "function"
-    "global"
-    "guess"
-    "have"
-    "header"
-    "help"
-    "hence"
-    "hide_class"
-    "hide_const"
-    "hide_fact"
-    "hide_type"
-    "inductive"
-    "inductive_cases"
-    "inductive_set"
-    "init_toplevel"
-    "instance"
-    "instantiation"
-    "interpret"
-    "interpretation"
-    "judgment"
-    "kill"
-    "kill_thy"
-    "lemma"
-    "lemmas"
-    "let"
-    "linear_undo"
-    "local"
-    "local_setup"
-    "locale"
-    "method_setup"
-    "moreover"
-    "new_domain"
-    "next"
-    "nitpick"
-    "nitpick_params"
-    "no_notation"
-    "no_syntax"
-    "no_translations"
-    "no_type_notation"
-    "nominal_datatype"
-    "nominal_inductive"
-    "nominal_inductive2"
-    "nominal_primrec"
-    "nonterminals"
-    "normal_form"
-    "notation"
-    "note"
-    "obtain"
-    "oops"
-    "oracle"
-    "overloading"
-    "parse_ast_translation"
-    "parse_translation"
-    "pcpodef"
-    "pr"
-    "prefer"
-    "presume"
-    "pretty_setmargin"
-    "prf"
-    "primrec"
-    "print_abbrevs"
-    "print_antiquotations"
-    "print_ast_translation"
-    "print_attributes"
-    "print_binds"
-    "print_cases"
-    "print_claset"
-    "print_classes"
-    "print_codeproc"
-    "print_codesetup"
-    "print_commands"
-    "print_configs"
-    "print_context"
-    "print_drafts"
-    "print_facts"
-    "print_induct_rules"
-    "print_interps"
-    "print_locale"
-    "print_locales"
-    "print_methods"
-    "print_orders"
-    "print_quotconsts"
-    "print_quotients"
-    "print_quotmaps"
-    "print_rules"
-    "print_simpset"
-    "print_statement"
-    "print_syntax"
-    "print_theorems"
-    "print_theory"
-    "print_trans_rules"
-    "print_translation"
-    "proof"
-    "prop"
-    "pwd"
-    "qed"
-    "quickcheck"
-    "quickcheck_params"
-    "quit"
-    "quotient_definition"
-    "quotient_type"
-    "realizability"
-    "realizers"
-    "recdef"
-    "recdef_tc"
-    "record"
-    "refute"
-    "refute_params"
-    "remove_thy"
-    "rep_datatype"
-    "repdef"
-    "schematic_corollary"
-    "schematic_lemma"
-    "schematic_theorem"
-    "sect"
-    "section"
-    "setup"
-    "show"
-    "simproc_setup"
-    "sledgehammer"
-    "sledgehammer_params"
-    "smt_status"
-    "sorry"
-    "specification"
-    "statespace"
-    "subclass"
-    "sublocale"
-    "subsect"
-    "subsection"
-    "subsubsect"
-    "subsubsection"
-    "syntax"
-    "term"
-    "termination"
-    "text"
-    "text_raw"
-    "then"
-    "theorem"
-    "theorems"
-    "theory"
-    "thm"
-    "thm_deps"
-    "thus"
-    "thy_deps"
-    "touch_thy"
-    "translations"
-    "txt"
-    "txt_raw"
-    "typ"
-    "type_notation"
-    "typed_print_translation"
-    "typedecl"
-    "typedef"
-    "types"
-    "types_code"
-    "ultimately"
-    "undo"
-    "undos_proof"
-    "unfolding"
-    "unused_thms"
-    "use"
-    "use_thy"
-    "using"
-    "value"
-    "values"
-    "welcome"
-    "with"
-    "write"
-    "{"
-    "}"))
-
-(defconst isar-keywords-minor
-  '("actions"
-    "advanced"
-    "and"
-    "assumes"
-    "attach"
-    "avoids"
-    "begin"
-    "binder"
-    "compose"
-    "congs"
-    "constrains"
-    "contains"
-    "datatypes"
-    "defines"
-    "file"
-    "fixes"
-    "for"
-    "functions"
-    "hide_action"
-    "hints"
-    "identifier"
-    "if"
-    "imports"
-    "in"
-    "infix"
-    "infixl"
-    "infixr"
-    "initially"
-    "inputs"
-    "internals"
-    "is"
-    "lazy"
-    "module_name"
-    "monos"
-    "morphisms"
-    "notes"
-    "obtains"
-    "open"
-    "output"
-    "outputs"
-    "overloaded"
-    "permissive"
-    "pervasive"
-    "post"
-    "pre"
-    "rename"
-    "restrict"
-    "shows"
-    "signature"
-    "states"
-    "structure"
-    "to"
-    "transitions"
-    "transrel"
-    "unchecked"
-    "uses"
-    "where"))
-
-(defconst isar-keywords-control
-  '("Isabelle\\.command"
-    "Isar\\.begin_document"
-    "Isar\\.define_command"
-    "Isar\\.edit_document"
-    "Isar\\.end_document"
-    "ProofGeneral\\.inform_file_processed"
-    "ProofGeneral\\.inform_file_retracted"
-    "ProofGeneral\\.kill_proof"
-    "ProofGeneral\\.process_pgip"
-    "ProofGeneral\\.restart"
-    "ProofGeneral\\.undo"
-    "cannot_undo"
-    "exit"
-    "init_toplevel"
-    "kill"
-    "linear_undo"
-    "quit"
-    "undo"
-    "undos_proof"))
-
-(defconst isar-keywords-diag
-  '("ML_command"
-    "ML_val"
-    "ProofGeneral\\.pr"
-    "boogie_status"
-    "cd"
-    "class_deps"
-    "code_deps"
-    "code_thms"
-    "commit"
-    "disable_pr"
-    "display_drafts"
-    "enable_pr"
-    "export_code"
-    "find_consts"
-    "find_theorems"
-    "full_prf"
-    "header"
-    "help"
-    "kill_thy"
-    "nitpick"
-    "normal_form"
-    "pr"
-    "pretty_setmargin"
-    "prf"
-    "print_abbrevs"
-    "print_antiquotations"
-    "print_attributes"
-    "print_binds"
-    "print_cases"
-    "print_claset"
-    "print_classes"
-    "print_codeproc"
-    "print_codesetup"
-    "print_commands"
-    "print_configs"
-    "print_context"
-    "print_drafts"
-    "print_facts"
-    "print_induct_rules"
-    "print_interps"
-    "print_locale"
-    "print_locales"
-    "print_methods"
-    "print_orders"
-    "print_quotconsts"
-    "print_quotients"
-    "print_quotmaps"
-    "print_rules"
-    "print_simpset"
-    "print_statement"
-    "print_syntax"
-    "print_theorems"
-    "print_theory"
-    "print_trans_rules"
-    "prop"
-    "pwd"
-    "quickcheck"
-    "refute"
-    "remove_thy"
-    "sledgehammer"
-    "smt_status"
-    "term"
-    "thm"
-    "thm_deps"
-    "thy_deps"
-    "touch_thy"
-    "typ"
-    "unused_thms"
-    "use_thy"
-    "value"
-    "values"
-    "welcome"))
-
-(defconst isar-keywords-theory-begin
-  '("theory"))
-
-(defconst isar-keywords-theory-switch
-  '())
-
-(defconst isar-keywords-theory-end
-  '("end"))
-
-(defconst isar-keywords-theory-heading
-  '("chapter"
-    "section"
-    "subsection"
-    "subsubsection"))
-
-(defconst isar-keywords-theory-decl
-  '("ML"
-    "abbreviation"
-    "arities"
-    "atom_decl"
-    "attribute_setup"
-    "automaton"
-    "axiomatization"
-    "axioms"
-    "boogie_end"
-    "boogie_open"
-    "class"
-    "classes"
-    "classrel"
-    "code_abort"
-    "code_class"
-    "code_const"
-    "code_datatype"
-    "code_include"
-    "code_instance"
-    "code_library"
-    "code_module"
-    "code_modulename"
-    "code_monad"
-    "code_reflect"
-    "code_reserved"
-    "code_type"
-    "coinductive"
-    "coinductive_set"
-    "constdefs"
-    "consts"
-    "consts_code"
-    "context"
-    "datatype"
-    "declaration"
-    "declare"
-    "default_sort"
-    "defer_recdef"
-    "definition"
-    "defs"
-    "domain"
-    "domain_isomorphism"
-    "equivariance"
-    "extract"
-    "extract_type"
-    "finalconsts"
-    "fixpat"
-    "fixrec"
-    "fun"
-    "global"
-    "hide_class"
-    "hide_const"
-    "hide_fact"
-    "hide_type"
-    "inductive"
-    "inductive_set"
-    "instantiation"
-    "judgment"
-    "lemmas"
-    "local"
-    "local_setup"
-    "locale"
-    "method_setup"
-    "new_domain"
-    "nitpick_params"
-    "no_notation"
-    "no_syntax"
-    "no_translations"
-    "no_type_notation"
-    "nominal_datatype"
-    "nonterminals"
-    "notation"
-    "oracle"
-    "overloading"
-    "parse_ast_translation"
-    "parse_translation"
-    "primrec"
-    "print_ast_translation"
-    "print_translation"
-    "quickcheck_params"
-    "quotient_definition"
-    "realizability"
-    "realizers"
-    "recdef"
-    "record"
-    "refute_params"
-    "repdef"
-    "setup"
-    "simproc_setup"
-    "sledgehammer_params"
-    "statespace"
-    "syntax"
-    "text"
-    "text_raw"
-    "theorems"
-    "translations"
-    "type_notation"
-    "typed_print_translation"
-    "typedecl"
-    "types"
-    "types_code"
-    "use"))
-
-(defconst isar-keywords-theory-script
-  '("inductive_cases"))
-
-(defconst isar-keywords-theory-goal
-  '("ax_specification"
-    "boogie_vc"
-    "code_pred"
-    "corollary"
-    "cpodef"
-    "example_proof"
-    "function"
-    "instance"
-    "interpretation"
-    "lemma"
-    "nominal_inductive"
-    "nominal_inductive2"
-    "nominal_primrec"
-    "pcpodef"
-    "quotient_type"
-    "recdef_tc"
-    "rep_datatype"
-    "schematic_corollary"
-    "schematic_lemma"
-    "schematic_theorem"
-    "specification"
-    "subclass"
-    "sublocale"
-    "termination"
-    "theorem"
-    "typedef"))
-
-(defconst isar-keywords-qed
-  '("\\."
-    "\\.\\."
-    "by"
-    "done"
-    "sorry"))
-
-(defconst isar-keywords-qed-block
-  '("qed"))
-
-(defconst isar-keywords-qed-global
-  '("oops"))
-
-(defconst isar-keywords-proof-heading
-  '("sect"
-    "subsect"
-    "subsubsect"))
-
-(defconst isar-keywords-proof-goal
-  '("have"
-    "hence"
-    "interpret"))
-
-(defconst isar-keywords-proof-block
-  '("next"
-    "proof"))
-
-(defconst isar-keywords-proof-open
-  '("{"))
-
-(defconst isar-keywords-proof-close
-  '("}"))
-
-(defconst isar-keywords-proof-chain
-  '("finally"
-    "from"
-    "then"
-    "ultimately"
-    "with"))
-
-(defconst isar-keywords-proof-decl
-  '("ML_prf"
-    "also"
-    "let"
-    "moreover"
-    "note"
-    "txt"
-    "txt_raw"
-    "unfolding"
-    "using"
-    "write"))
-
-(defconst isar-keywords-proof-asm
-  '("assume"
-    "case"
-    "def"
-    "fix"
-    "presume"))
-
-(defconst isar-keywords-proof-asm-goal
-  '("guess"
-    "obtain"
-    "show"
-    "thus"))
-
-(defconst isar-keywords-proof-script
-  '("apply"
-    "apply_end"
-    "back"
-    "defer"
-    "prefer"))
-
-(provide 'isar-keywords)
diff --git a/isar/isar-profiling.el b/isar/isar-profiling.el
deleted file mode 100644
index ae8a8f8ce3..0000000000
--- a/isar/isar-profiling.el
+++ /dev/null
@@ -1,58 +0,0 @@
-;; isar-profiling.el: simple profiling Isar Proof General.
-;;
-;; You can run these tests by issuing "make profile.isar" in PG home dir.
-;;
-;; $Id$
-;;
-
-(require 'proof-site)
-(proof-ready-for-assistant 'isar)
-
-(declare-function isar-tracing:auto-solve-toggle "isar.el")
-(declare-function isar-tracing:auto-quickcheck-toggle "isar.el")
-(declare-function isar-proof:parallel-proofs-toggle "isar.el")
-
-(require 'pg-autotest)
-(require 'pg-dev)
-
-(unless (bound-and-true-p byte-compile-current-file)
-
-  (pg-autotest log ".profile.log")  ; convention
-
-  (pg-autotest timestart 'total)
-
-  (pg-autotest-find-file "etc/isar/AHundredTheorems.thy")
-  (pg-autotest eval (proof-shell-ready-prover))
-  (pg-autotest eval (isar-tracing:auto-solve-toggle 0)) ; autosolve hammers 
this!
-  (pg-autotest eval (isar-tracing:auto-quickcheck-toggle 0))
-  (pg-autotest eval (isar-proof:parallel-proofs-toggle 0))
-  (pg-autotest eval (proof-full-annotation-toggle 0))
-  (proof-shell-wait)
-
-  ;; Simple profiling test.  Cf TRAC #324
-  (pg-autotest timestart)
-  (pg-autotest process-wholefile "etc/isar/AHundredTheorems.thy")
-  (pg-autotest timetaken)
-
-  ;; Same again with profiling
-  (profile-pg)
-  (pg-autotest timestart)
-  (pg-autotest process-wholefile "etc/isar/AHundredTheorems.thy")
-  (pg-autotest timetaken)
-  (pg-autotest timestart)
-  (pg-autotest process-wholefile "etc/isar/AHundredTheorems.thy")
-  (pg-autotest timetaken)
-  (pg-autotest timestart)
-  (pg-autotest process-wholefile "etc/isar/AHundredProofs.thy")
-  (pg-autotest timetaken)
-  (elp-results)
-  (let ((results 
-        (with-current-buffer "*ELP Profiling Results*"
-          (buffer-string))))
-    (with-current-buffer pg-autotest-log
-      (goto-char (point-min))
-      (insert "ELP Profiling Results: \n" results "\n\n")))
-
-  (pg-autotest exit)
-
-  )
diff --git a/isar/isar-syntax.el b/isar/isar-syntax.el
deleted file mode 100644
index 4b5f2e4afa..0000000000
--- a/isar/isar-syntax.el
+++ /dev/null
@@ -1,612 +0,0 @@
-;; isar-syntax.el Syntax expressions for Isabelle/Isar  -*- lexical-binding:t 
-*-
-;; Copyright (C) 1994-2004, 2009, 2010 LFCS Edinburgh.
-;; License:   GPL (GNU GENERAL PUBLIC LICENSE)
-;;
-;; Authors:     David Aspinall <David.Aspinall@ed.ac.uk>
-;;              Markus Wenzel
-;;
-;; $Id$
-;;
-
-(eval-when-compile (require 'cl-lib))
-
-(require 'proof-syntax)
-(require 'isar-keywords)               ; NB: we want to load isar-keywords at 
runtime
-
-;; ----- character syntax
-
-(defconst isar-script-syntax-table-entries
-  '(?\$ "."
-    ?\/ "."
-    ?\\ "\\"
-    ?+  "."
-    ?-  "."
-    ?=  "."
-    ?%  "."
-    ?<  "w"
-    ?>  "w"
-    ?\& "."
-    ?.  "w"
-    ?_  "w"
-    ?\' "w"
-    ??  "w"
-    ?`  "\""
-    ?\( "()1"
-    ?\) ")(4"
-    ?\{ "(}1b"
-    ?\} "){4b"
-    ?\* ". 23n")
-   "Syntax table entries for Isar scripts.
-This list is in the right format for proof-easy-config.")
-
-(defconst isar-script-syntax-table-alist
-  ;; NB: this is used for imenu.  Probably only need word syntax
-  (let ((syn isar-script-syntax-table-entries)
-       al)
-    (while syn
-      (setq al (cons (cons (char-to-string (car syn)) (cadr syn)) al))
-      (setq syn (cddr syn)))
-    al))
-
-(defun isar-init-syntax-table ()
-  "Set appropriate values for syntax table in current buffer."
-  (let ((syn isar-script-syntax-table-entries))
-    (while syn
-      (modify-syntax-entry
-       (car syn) (cadr syn))
-      (setq syn (cddr syn)))))
-
-(defun isar-init-output-syntax-table ()
-  "Set appropriate values for syntax table for Isabelle output."
-  (isar-init-syntax-table)
-  ;; ignore strings so font-locking works inside them
-  (modify-syntax-entry ?\" " ")
-  (modify-syntax-entry ?`  " ")
-  (modify-syntax-entry ?\* ".")
-  (modify-syntax-entry ?\( "()")
-  (modify-syntax-entry ?\) ")(")
-  (modify-syntax-entry ?\{ "(}")
-  (modify-syntax-entry ?\} "){"))
-
-
-;; ----- keyword groups
-
-(defconst isar-keyword-begin "begin")
-(defconst isar-keyword-end "end")
-
-(defconst isar-keywords-theory-enclose
-  (append isar-keywords-theory-begin
-         isar-keywords-theory-switch
-         isar-keywords-theory-end))
-
-(defconst isar-keywords-theory
-  (append isar-keywords-theory-heading
-         isar-keywords-theory-decl
-         isar-keywords-theory-goal))
-
-(defconst isar-keywords-save
-  (append isar-keywords-qed
-         isar-keywords-qed-block
-         isar-keywords-qed-global))
-
-(defconst isar-keywords-proof-enclose
-  (append isar-keywords-proof-block
-         isar-keywords-proof-open
-         isar-keywords-proof-close
-         isar-keywords-qed-block))
-
-(defconst isar-keywords-proof
-  (append isar-keywords-proof-heading
-         isar-keywords-proof-goal
-         isar-keywords-proof-chain
-         isar-keywords-proof-decl
-         isar-keywords-qed))
-
-(defconst isar-keywords-proof-context
-  (append isar-keywords-proof-asm
-         isar-keywords-proof-asm-goal))
-
-(defconst isar-keywords-local-goal
-  (append isar-keywords-proof-goal
-         isar-keywords-proof-asm-goal))
-
-(defconst isar-keywords-proper
-  (append isar-keywords-theory
-         isar-keywords-proof-enclose
-         isar-keywords-proof))
-
-(defconst isar-keywords-improper
-  (append isar-keywords-theory-script
-         isar-keywords-proof-script
-         isar-keywords-qed-global))
-
-(defconst isar-keyword-level-alist
-  (append 
-   (mapcar (lambda (w) (cons w 1))
-          (append isar-keywords-theory-heading
-                  isar-keywords-theory-begin
-                  isar-keywords-theory-end))
-   (mapcar (lambda (w) (cons w 2))
-          (append isar-keywords-theory-script
-                  isar-keywords-theory-goal))
-   (mapcar (lambda (w) (cons w 3))
-          (append isar-keywords-proof-heading
-                  isar-keywords-theory-goal))
-   (mapcar (lambda (w) (cons w 4))
-          isar-keywords-proof-block)))
-
-(defconst isar-keywords-outline 
-  (mapcar 'car isar-keyword-level-alist))
-
-(defconst isar-keywords-indent-open
-  (append isar-keywords-theory-goal
-         isar-keywords-proof-goal
-         isar-keywords-proof-asm-goal
-         isar-keywords-proof-open
-          '("notepad")))
-
-(defconst isar-keywords-indent-close
-  (append isar-keywords-save
-         isar-keywords-proof-close
-          isar-keywords-theory-end))
-
-(defconst isar-keywords-indent-enclose
-  (append isar-keywords-proof-block
-         isar-keywords-proof-close
-         isar-keywords-qed-block
-          isar-keywords-theory-end
-         (list isar-keyword-begin)))
-
-
-;; ----- regular expressions
-
-(defconst isar-ext-first "\\(?:\\\\<\\^?[A-Za-z]+>\\|[A-Za-z]\\)")
-(defconst isar-ext-rest "\\(?:\\\\<\\^?[A-Za-z]+>\\|[A-Za-z0-9'_]\\)")
-
-(defconst isar-text "[^\^A- ]*")
-(defconst isar-long-id-stuff (concat "\\(?:" isar-ext-rest "\\|\\.\\)+"))
-(defconst isar-id (concat "\\(" isar-ext-first isar-ext-rest "*\\)"))
-(defconst isar-idx (concat isar-id "\\(?:\\.[0-9]+\\)?"))
-
-(defconst isar-string "\"\\(\\(?:[^\"]\\|\\\\\"\\)*\\)\"")
-
-(defun isar-ids-to-regexp (ids)
-  "Hack list IDS of keywords IDS to make a regexp matching any of them.
-Note: IDS may have full-stops already regexp quoted." ; a nuisance!
-  (let* ((unquoted     (mapcar (lambda (s)
-                        (replace-regexp-in-string (regexp-quote "\\.") "." s))
-                              ids))
-        (cleaned      (remove "{" (remove "}" unquoted)))
-        (words        (if cleaned (list (regexp-opt cleaned 'words))))
-        ;; } is not a word constituent, so \_<}\_> fails
-        (rbrace       (if (member "}" ids) '("}")))
-        ;; { similarly, must also prevent {* matching
-        (lbrace       (if (member "{" ids)
-                          '("\\(?:{\\(?:\\b\\|[^\\*]\\)\\)"))))
-    (mapconcat 'identity (append words lbrace rbrace) "\\|")))
-
-;; tests
-; (isar-ids-to-regexp '("bla" "blubber"))
-; (isar-ids-to-regexp '("bla" "\\." "blubber"))
-; (isar-ids-to-regexp '("bla" "\\." "blubber" "{"))
-; NB: string-match not entirely accurate, syntax table affects \_< \_> 
behaviour
-; (string-match (isar-ids-to-regexp '("bla" "}" "blubber" "{")) "}")  ; 0
-; (string-match (isar-ids-to-regexp '("bla" "}" "blubber" "{")) "*}") ; 1 [OK]
-; (string-match (isar-ids-to-regexp '("bla" "}" "blubber" "{")) "*}bla") ; 1 
[OK]
-; (string-match (isar-ids-to-regexp '("bla" "}" "blubber" "{")) "ug{*") ; nil
-; (string-match (isar-ids-to-regexp '("bla" "}" "blubber" "{")) "ug{") ; 2
-; (string-match (isar-ids-to-regexp '("bla" "}" "blubber" "{")) "}ug") ; 0
-; (string-match (isar-ids-to-regexp '("bla" "}" "blubber" "{")) "}\n ug") ; 0
-; (string-match (isar-ids-to-regexp '("foo" "\\." "Foo\\.bar")) "boo.foo") ; 
nil/4
-; (string-match (isar-ids-to-regexp '("foo" "\\." "Foo\\.bar")) "Foo.bar") ; 0
-; (string-match (isar-ids-to-regexp '("foo" "\\." "Foo\\.bar")) "bar.foo") ; 4
-; (string-match (isar-ids-to-regexp '("foo" "\\." "Foo\\.bar")) "bar. foo") ; 5
-
-(defconst isar-any-command-regexp
-  ;; allow terminator to be considered as command start: 
-  ;; FIXME: really needs change in generic function to take account of this,
-  ;; since the end character of a command is not the start 
-  (concat ";\\|" (isar-ids-to-regexp isar-keywords-major))
-  "Regexp matching any Isabelle/Isar command keyword or the terminator 
character.")
-
-(defconst isar-name-regexp
-  (concat "\\s-*\\(" isar-string "\\|" isar-id "\\)\\s-*")
-  "Regexp matching Isabelle/Isar names; surrounding space and contents grouped.
-Group number 1 matches the identifier possibly with quotes; group number 2
-matches contents of quotes for quoted identifiers.")
-
-(defconst isar-improper-regexp
-  "\\(\\<[A-Za-z][A-Za-z0-9'_]*_tac\\>\\|\\<goal[0-9]+\\>\\)"
-  "Regexp matching low-level features")
-
-(defconst isar-save-command-regexp
-  (proof-anchor-regexp (isar-ids-to-regexp isar-keywords-save)))
-
-(defconst isar-global-save-command-regexp
-  (proof-anchor-regexp (isar-ids-to-regexp isar-keywords-qed-global)))
-
-(defconst isar-goal-command-regexp
-  (proof-anchor-regexp (isar-ids-to-regexp isar-keywords-theory-goal)))
-
-(defconst isar-local-goal-command-regexp
-  (proof-anchor-regexp (isar-ids-to-regexp isar-keywords-local-goal)))
-
-(defconst isar-comment-start "(*")
-(defconst isar-comment-end "*)")
-(defconst isar-comment-start-regexp (regexp-quote isar-comment-start))
-(defconst isar-comment-end-regexp (regexp-quote isar-comment-end))
-
-(defconst isar-string-start-regexp "\"\\|`\\|{\\*")
-(defconst isar-string-end-regexp "\"\\|`\\|\\*}")
-
-(defun isar-syntactic-context ()
-  (let ((sc (proof-looking-at-syntactic-context-default)))
-    (or (if (eq sc 'string)
-           (save-excursion
-             (save-match-data
-               (and (or (looking-at isar-string-start-regexp)
-                        (re-search-backward isar-string-start-regexp nil t))
-                    (skip-chars-backward " \t\n-")
-                    (looking-at "[ \t\n]*--")
-                    'comment))))
-      sc)))
-
-
-;; antiquotations
-
-(defconst isar-antiq-regexp
-  (concat "@{\\(?:[^\"{}]\\|" isar-string "\\)*}")
-  "Regexp matching Isabelle/Isar antiquotations.")
-
-;; keyword nesting
-
-(defconst isar-nesting-regexp
-  (isar-ids-to-regexp (list isar-keyword-begin isar-keyword-end)))
-
-(defun isar-nesting ()
-  "Determine keyword nesting"
-  (let ((nesting 0) (limit (point)))
-    (save-excursion
-      (goto-char (point-min))
-      (while (proof-re-search-forward isar-nesting-regexp limit t)
-       (cond
-        ((proof-buffer-syntactic-context))
-        ((equal (match-string 0) isar-keyword-begin) (cl-incf nesting))
-        ((equal (match-string 0) isar-keyword-end) (cl-decf nesting)))))
-    nesting))
-
-(defun isar-match-nesting (limit)
-  (cl-block nil
-    (while (proof-re-search-forward isar-nesting-regexp limit t)
-      (and (not (proof-buffer-syntactic-context))
-          (if (equal (match-string 0) isar-keyword-begin)
-              (> (isar-nesting) 1)
-            (> (isar-nesting) 0))
-          (cl-return t)))))
-
-
-;; ----- Isabelle inner syntax highlight
-
-(defface isabelle-string-face 
-  (proof-face-specs
-   (:foreground "springgreen4")
-   (:foreground "springgreen1")
-   ())
-  "*Face for fontifying string contents in Isabelle."
-  :group 'proof-faces)
-
-(defface isabelle-quote-face 
-  (proof-face-specs
-   (:foreground "Gray80")
-   (:foreground "Gray30")
-   (:italic t))
-  "*Face for quotes (string delimiters) in Isabelle."
-  :group 'proof-faces)
-
-(defface isabelle-class-name-face
-  (proof-face-specs
-   (:foreground "red")
-   (:foreground "red3")
-   (:bold t))
-  "*Face for Isabelle term / type highlighting"
-  :group 'proof-faces)
-
-(defface isabelle-tfree-name-face
-  (proof-face-specs
-   (:foreground "purple")
-   (:foreground "purple3")
-   (:bold t))
-  "*Face for Isabelle term / type highlighting"
-  :group 'proof-faces)
-
-(defface isabelle-tvar-name-face
-  (proof-face-specs
-   (:foreground "purple")
-   (:foreground "purple3")
-   (:bold t))
-  "*Face for Isabelle term / type highlighting"
-  :group 'proof-faces)
-
-(defface isabelle-free-name-face
-  (proof-face-specs
-   (:foreground "blue")
-   (:foreground "lightblue")
-   (:bold t))
-  "*Face for Isabelle term / type highlighting"
-  :group 'proof-faces)
-
-(defface isabelle-bound-name-face
-  (proof-face-specs
-   (:foreground "green4")
-   (:foreground "green")
-   (:bold t))
-  "*Face for Isabelle term / type highlighting"
-  :group 'proof-faces)
-
-(defface isabelle-var-name-face
-  (proof-face-specs
-   (:foreground "darkblue")
-   (:foreground "blue3")
-   (:bold t))
-  "*Face for Isabelle term / type highlighting"
-  :group 'proof-faces)
-
-(defconst isabelle-string-face 'isabelle-string-face)
-(defconst isabelle-quote-face  'isabelle-quote-face)
-(defconst isabelle-class-name-face 'isabelle-class-name-face)
-(defconst isabelle-tfree-name-face 'isabelle-tfree-name-face)
-(defconst isabelle-tvar-name-face  'isabelle-tvar-name-face)
-(defconst isabelle-free-name-face  'isabelle-free-name-face)
-(defconst isabelle-bound-name-face 'isabelle-bound-name-face)
-(defconst isabelle-var-name-face   'isabelle-var-name-face)
-
-
-;; font-lock syntactic fontification
-
-;; adapted from font-lock.el in GNU Emacs 23.1.1
-;; FIXME: Why not use the built-in syntactic fontification?
-(defun isar-font-lock-fontify-syntactically-region
-  (end) ;; (start end &optional loudly ppss)
-  "Put proper face on each string and comment between point and END."
-  (let (;; (comment-end-regexp
-       ;;  (replace-regexp-in-string "^ *" "" comment-end))
-        (start (point))
-        ;; Find the start state.
-        (state (syntax-ppss))
-        beg)
-    (if font-lock-verbose ;; loudly
-        (message "Fontifying %s... (syntactically...)" (buffer-name)))
-    ;;
-    ;; Find each interesting place between here and `end'.
-    (while
-       (let ((instring     (nth 3 state))
-             (incomment    (nth 4 state)))
-         (when (or instring incomment)
-           (setq beg (max (nth 8 state) start))
-           (setq state (parse-partial-sexp (point) end nil nil state
-                                           'syntax-table))
-           (cond
-            (instring
-             (put-text-property (1+ beg)
-                                (1- (point)) 'face isabelle-string-face)
-             (put-text-property beg (1+ beg) 'face isabelle-quote-face)
-             (put-text-property (1- (point)) (point) 'face 
isabelle-quote-face))
-            (t
-             (put-text-property beg (point) 'face font-lock-comment-face))))
-         (< (point) end))
-      (setq state (parse-partial-sexp (point) end nil nil state
-                                     'syntax-table))))
-  ;; Job is done, return to font-lock-keywords that there's no match.
-  nil)
-
-;; font-lock keywords fontification
-
-(defvar isar-font-lock-keywords-1
-  (list
-   (list #'isar-font-lock-fontify-syntactically-region)
-   (cons #'isar-match-nesting                               
'font-lock-preprocessor-face)
-   (cons (isar-ids-to-regexp isar-keywords-minor)          
'font-lock-type-face)
-   (cons (isar-ids-to-regexp isar-keywords-control)        'proof-error-face)
-   (cons (isar-ids-to-regexp isar-keywords-diag)           
'proof-tacticals-name-face)
-   (cons (isar-ids-to-regexp isar-keywords-theory-enclose) 
'font-lock-type-face)
-   (cons (isar-ids-to-regexp isar-keywords-proper)         
'font-lock-keyword-face)
-   (cons (isar-ids-to-regexp isar-keywords-proof-context)  
'proof-declaration-name-face)
-   (cons (isar-ids-to-regexp isar-keywords-improper)       
'font-lock-reference-face)
-   (cons isar-improper-regexp 'font-lock-reference-face)
-   (cons isar-antiq-regexp '(0 'font-lock-variable-name-face t))))
-
-(put 'isar-goals-mode
-     'font-lock-extra-managed-props '(invisible sendback))
-(put 'isar-response-mode
-     'font-lock-extra-managed-props '(invisible sendback))
-
-(defun isar-output-flkprops (start regexp end props)
-  `(,(concat "\\(" start "\\)\\(" regexp "\\)\\(" end "\\)")
-    (1 '(face nil invisible t) prepend)
-    (2 ',props prepend)
-    (,(+ 3 (regexp-opt-depth regexp)) '(face nil invisible t) prepend)))
-
-(defun isar-output-flk (start regexp end face)
-  (isar-output-flkprops start regexp end (list 'face face)))
-
-(defvar isar-output-font-lock-keywords-1
-  (list
-   '("\^A[IJKLMNOPV]" (0 '(face nil invisible t) t))
-   (isar-output-flkprops
-    "\^AW" "\\(?:[^\^A]\\|\^A[^X]\\)*" "\^AX"
-    '(face (:underline t) mouse-face 'highlight sendback t))
-
-   (isar-output-flk "\^A0"
-                   "\\(?:[^\^A]\\|\^A[^1]\\)*" "\^A1"
-                   'proof-warning-face)
-
-;; done generically at the moment:
-;; (isar-output-flk "\^AM" "\\(?:[^\^A]\\|\^A[^N]\\)*" "\^AN" 
'proof-error-face)
-
-   (isar-output-flk "\^AB" isar-text "\^AA" 'isabelle-class-name-face)
-   (isar-output-flk "\^AC" isar-text "\^AA" 'isabelle-tfree-name-face)
-   (isar-output-flk "\^AD" isar-text "\^AA" 'isabelle-tvar-name-face)
-   (isar-output-flk "\^AE" isar-text "\^AA" 'isabelle-free-name-face)
-   (isar-output-flk "\^AF" isar-text "\^AA" 'isabelle-bound-name-face)
-   (isar-output-flk "\^AG" isar-text "\^AA" 'isabelle-var-name-face)
-   (isar-output-flk "\^AH" isar-text "\^AA" 'proof-declaration-name-face)
-   )
-  "*Font-lock table for Isabelle output terms.")
-
-(defun isar-strip-output-markup (string)
-  "Remove invisible output markup from STRING"
-  (replace-regexp-in-string "\^A." "" string))
-
-(defconst isar-shell-font-lock-keywords
-  '(("\^A." (0 '(face nil invisible t)))))
-
-(defvar isar-goals-font-lock-keywords
-  (append
-   (list
-    "^theory:"
-    "^proof (prove):"
-    "^proof (state):"
-    "^proof (chain):"
-    "^goal.*:"
-    "^picking.*:"
-    "^using.*:"
-    "^calculation:"
-    "^this:"
-    "^abbreviations:"
-    "^term bindings:"
-    "^facts:"
-    "^cases:"
-    "^prems:"
-    "^fixed variables:"
-    "^structures:"
-    "^abbreviations:"
-    "^type constraints:"
-    "^default sorts:"
-    "^used type variable names:"
-    "^flex-flex pairs:"
-    "^constants:"
-    "^variables:"
-    "^type variables:"
-    "^\\s-*[0-9][0-9]?\\. ")
-   isar-output-font-lock-keywords-1)
-  "*Font-lock table for Isabelle/Isar output.")
-
-
-;; ----- variations on undo
-
-(defconst isar-linear-undo "linear_undo")
-
-(defconst isar-undo "ProofGeneral.undo;")
-
-(defconst isar-pr
-  (if (member "ProofGeneral\\.pr" 
-             isar-keywords-major)
-      "ProofGeneral.pr" ; does right thing
-    "pr" ; See Trac #292 
-    ))
-
-(defun isar-remove (name)
-  (concat "init_toplevel; kill_thy " name ";"))
-
-(defun isar-undos (linearp i)
-  (if (> i 0) (concat (if linearp "linear_undo " "undos_proof ")
-                     (int-to-string i) ";"
-                     (if linearp 
-                         (concat " "
-                                 isar-pr
-                                 ";"))
-                     )
-    nil))  ; was proof-no-command
-
-(defun isar-cannot-undo (cmd)
-  (concat "cannot_undo \"" cmd "\";"))
-
-(defconst isar-undo-commands
-  (list
-   isar-linear-undo
-   isar-undo
-   "init_toplevel" "kill_thy"
-   "undos_proof"
-   "cannot_undo"))
-
-(defconst isar-theory-start-regexp
-  (proof-anchor-regexp
-   (isar-ids-to-regexp
-    (append isar-keywords-theory-begin
-           isar-keywords-theory-switch))))
-
-(defconst isar-end-regexp
-  (proof-anchor-regexp
-   (isar-ids-to-regexp isar-keywords-theory-end)))
-
-(defconst isar-undo-fail-regexp
-  (proof-anchor-regexp
-   (isar-ids-to-regexp isar-keywords-control)))
-
-(defconst isar-undo-skip-regexp
-  (proof-anchor-regexp (proof-regexp-alt (isar-ids-to-regexp 
isar-keywords-diag) ";")))
-
-(defconst isar-undo-ignore-regexp
-  (proof-anchor-regexp "--"))
-
-(defconst isar-undo-remove-regexp
-  (concat
-   (proof-anchor-regexp (isar-ids-to-regexp isar-keywords-theory-begin))
-   isar-name-regexp))
-
-
-;; ----- imenu
-
-(defconst isar-keywords-imenu
-  (append isar-keywords-theory-begin
-         isar-keywords-theory-heading
-         isar-keywords-theory-decl
-         isar-keywords-theory-script
-         isar-keywords-theory-goal))
-
-(defconst isar-entity-regexp 
-  (concat "\\(" (isar-ids-to-regexp isar-keywords-imenu) "\\)"))
-
-(defconst isar-named-entity-regexp
-  (concat isar-entity-regexp
-         "\\(?:\\s-*(\\s-*in[^)]+)\\)?"
-         isar-name-regexp "[[:=]" ))
-
-(defconst isar-named-entity-name-match-number
-          (1+ (regexp-opt-depth isar-entity-regexp)))
-
-(defconst isar-generic-expression
-  (mapcar (lambda (kw)
-           (list (capitalize kw)
-                 (concat "\\<" kw "\\>"
-                         "\\(?:\\s-*(\\s-*in[^)]+)\\)?"
-                         isar-name-regexp "[[:=]")
-                 1))
-         isar-keywords-imenu))
-
-;; ----- indentation
-
-(defconst isar-indent-any-regexp
-  (proof-regexp-alt isar-any-command-regexp "\\s(" "\\s)"))
-(defconst isar-indent-inner-regexp
-  (proof-regexp-alt "[[]()]"))
-(defconst isar-indent-enclose-regexp
-  (proof-regexp-alt (isar-ids-to-regexp isar-keywords-indent-enclose) "\\s)"))
-(defconst isar-indent-open-regexp
-  (proof-regexp-alt (isar-ids-to-regexp isar-keywords-indent-open) "\\s("))
-(defconst isar-indent-close-regexp
-  (proof-regexp-alt (isar-ids-to-regexp isar-keywords-indent-close) "\\s)"))
-
-
-;; ----- outline mode
-
-(defconst isar-outline-regexp
-  (concat "[ \t]*\\(?:" (isar-ids-to-regexp isar-keywords-outline) "\\)")
-  "Outline regexp for Isabelle/Isar documents")
-
-(defconst isar-outline-heading-end-regexp "\n")
-
-(defconst isar-outline-heading-alist isar-keyword-level-alist)
-
-
-(provide 'isar-syntax)
diff --git a/isar/isar-unicode-tokens.el b/isar/isar-unicode-tokens.el
deleted file mode 100644
index 725bc54447..0000000000
--- a/isar/isar-unicode-tokens.el
+++ /dev/null
@@ -1,691 +0,0 @@
-;;; -*- coding: utf-8; -*-
-;; isar-unicode-tokens.el --- Tokens for Unicode Tokens package
-;;
-;; Copyright(C) 2008, 2009 David Aspinall / LFCS Edinburgh
-;; Author:    David Aspinall <David.Aspinall@ed.ac.uk>
-;;
-;; This file is loaded by proof-auxmodes.el for proof-unicode-tokens.el.
-;;
-;; It sets the variables defined at the top of unicode-tokens.el,
-;; unicode-tokens-<foo> is set from isar-<foo>.  See the corresponding
-;; variable for documentation.
-;;
-
-
-(eval-when-compile (require 'cl-lib))   ; cl-loop
-
-(eval-when-compile
-  (require 'unicode-tokens)        ; it's loaded dynamically at runtime
-  (require 'proof-unicode-tokens))  ; that file loads us at runtime
-
-(declare-function isar-markup-ml "isar")
-
-;;
-;; Customization
-;;
-
-(defgroup isabelle-tokens nil
-  "Variables which configure Isabelle tokens for Unicode Tokens mode."
-  :group 'isabelle
-  :prefix "isar-")
-
-(defun isar-set-and-restart-tokens (sym val)
-  "Function to restart Unicode Tokens when a token value is adjusted."
-  (set-default sym val)
-  (when (featurep 'isar-unicode-tokens) ; not during loading
-    (isar-init-token-symbol-map)
-    (isar-init-shortcut-alists)
-    (if (featurep 'unicode-tokens)
-       (unicode-tokens-initialise))))
-
-;;
-;; Controls
-;;
-
-(defconst isar-control-region-format-regexp
-  "\\(\\\\<\\^%s>\\)\\(.*?\\)\\(\\\\<\\^%s>\\)")
-
-(defconst isar-control-char-format-regexp
-  (concat
-   "\\(\\\\<\\^%s>\\)\\("
-   "\\(?:\\\\<[A-Za-z]+>\\|[^\\]\\)" ; cf isar-ext-first
-   "\\)"))
-
-(defconst isar-control-char-format        "\\<^%s>")
-(defconst isar-control-region-format-start "\\<^%s>")
-(defconst isar-control-region-format-end   "\\<^%s>")
-
-
-(defcustom isar-control-characters
-  '(("Subscript" "sub" sub)
-    ("Id subscript" "isub" sub)
-    ("Superscript" "sup" sup)
-    ("Id superscript" "isup" sup)
-    ("Loc" "loc" keyword)
-    ("Constant" "const" keyword)
-    ("Bold" "bold" bold)
-    ;; unofficial/unsupported:
-    ("Italic" "italic" italic))
-  "Control character tokens for Isabelle."
-  :group 'isabelle-tokens
-  :set 'isar-set-and-restart-tokens)
-
-(defcustom isar-control-regions
-  '(("Subscript" "bsub" "esub" sub)
-    ("Superscript" "bsup" "esup" sup)
-    ;; unofficial/unsupported:
-    ("Id subscript" "bisub" "eisub" sub)
-    ("Id superscript" "bisup" "eisup" sup)
-    ("Bold" "bbold" "ebold" bold)
-    ("Italic" "bitalic" "eitalic" italic)
-    ("Script" "bscript" "escript" script)
-    ("Frakt" "bfrakt" "efrakt" frakt)
-    ("Roman" "bserif" "eserif" serif)
-    ("Sans" "bsans" "esans" sans)
-    ("Overline" "boverline" "eoverline" overline)
-    ("Underline" "bunderline" "eunderline" underline)
-    ("Big"   "bbig" "ebig" big)
-    ("Small" "bsmall" "esmall" small)
-;    ("Large symbols" "bbigsyms" "ebigsyms" large-symbols)
-    )
-  "Control sequence tokens for Isabelle."
-  :group 'isabelle-tokens
-  :set 'isar-set-and-restart-tokens)
-
-;;
-;; Symbols
-;;
-
-(defconst isar-token-format "\\<%s>")
-
-;(defconst isar-token-variant-format-regexp
-;  "\\\\<\\(%s\\)\\([:][a-zA-Z0-9]+\\)?>") ; syntax change required
-(defconst isar-token-variant-format-regexp
-  "\\\\<\\(%s\\)[0-9]*>") ; unofficial interpretation of usual syntax
-
-(defcustom isar-greek-letters-tokens
-  '(("alpha" "α")
-    ("beta" "β")
-    ("gamma" "γ")
-    ("delta" "δ")
-    ("epsilon" "ε") ; varepsilon (some is epsilon), although PG can use dups
-    ("zeta" "ζ")
-    ("eta" "η")
-    ("theta" "θ")
-    ("iota" "ι")
-    ("kappa" "κ")
-    ("lambda" "λ")
-    ("mu" "μ")
-    ("nu" "ν")
-    ("xi" "ξ")
-    ("pi" "π")
-    ("rho" "ρ")
-    ("sigma" "σ")
-    ("tau" "τ")
-    ("upsilon" "υ")
-    ("phi" "φ")
-    ("chi" "χ")
-    ("psi" "ψ")
-    ("omega" "ω")
-    ("Gamma" "Γ")
-    ("Delta" "Δ")
-    ("Theta" "Θ")
-    ("Lambda" "Λ")
-    ("Xi" "Ξ")
-    ("Pi" "Π")
-    ("Sigma" "Σ")
-    ("Upsilon" "Υ")
-    ("Phi" "Φ")
-    ("Psi" "Ψ")
-    ("Omega" "Ω"))
-  "Greek letter token map for Isabelle."
-  :type 'unicode-tokens-token-symbol-map
-  :group 'isabelle-tokens
-  :set 'isar-set-and-restart-tokens)
-
-(defcustom isar-misc-letters-tokens
-  '(("bool" "B" bold underline)
-    ("complex" "ℂ")
-    ("nat" "ℕ")
-    ("rat" "ℚ")
-    ("real" "ℝ")
-    ("int" "ℤ"))
-  "Miscellaneous letter token map for Isabelle."
-  :type 'unicode-tokens-token-symbol-map
-  :group 'isabelle-tokens
-  :set 'isar-set-and-restart-tokens)
-
-(defcustom isar-symbols-tokens
-  '(("leftarrow" "←")
-    ("rightarrow" "→")
-    ("Leftarrow" "⇐")
-    ("Rightarrow" "⇒")
-    ("leftrightarrow" "↔")
-    ("Leftrightarrow" "⇔")
-    ("mapsto" "↦")
-    ("longleftarrow" "⟵")
-    ("Longleftarrow" "⟸")
-    ("longrightarrow" "⟶")
-    ("Longrightarrow" "⟹")
-    ("longleftrightarrow" "⟷")
-    ("Longleftrightarrow" "⟺")
-    ("longmapsto" "⟼")
-    ("midarrow" "–") ; #x002013 en dash
-    ("Midarrow" "‗") ; #x002017 double low line (not mid)
-    ("hookleftarrow" "↩")
-    ("hookrightarrow" "↪")
-    ("leftharpoondown" "↽")
-    ("rightharpoondown" "⇁")
-    ("leftharpoonup" "↼")
-    ("rightharpoonup" "⇀")
-    ("rightleftharpoons" "⇌")
-    ("leadsto" "↝")
-    ("downharpoonleft" "⇃")
-    ("downharpoonright" "⇂")
-    ("upharpoonleft" "↿")  ;;
-    ("upharpoonright" "↾") ;; overlaps restriction
-    ("restriction" "↾")    ;; same as above
-    ("Colon" "∷")
-    ("up" "↑")
-    ("Up" "⇑")
-    ("down" "↓")
-    ("Down" "⇓")
-    ("updown" "↕")
-    ("Updown" "⇕")
-    ("langle" "⟨")
-    ("rangle" "⟩")
-    ("lceil" "⌈")
-    ("rceil" "⌉")
-    ("lfloor" "⌊")
-    ("rfloor" "⌋")
-    ("lparr" "⦇")
-    ("rparr" "⦈")
-    ("lbrakk" "⟦")
-    ("rbrakk" "⟧")
-    ("lbrace" "⦃")
-    ("rbrace" "⦄")
-    ("guillemotleft" "«")
-    ("guillemotright" "»")
-    ("bottom" "⊥")
-    ("top" "⊤")
-    ("and" "∧")
-    ("And" "⋀")
-    ("or" "∨")
-    ("Or" "⋁")
-    ("forall" "∀")
-    ("exists" "∃")
-    ("nexists" "∄")
-    ("not" "¬")
-    ("box" "□")
-    ("diamond" "◇")
-    ("turnstile" "⊢")
-    ("Turnstile" "⊨")
-    ("tturnstile" "⊩")
-    ("TTurnstile" "⊫")
-    ("stileturn" "⊣")
-    ("surd" "√")
-    ("le" "≤")
-    ("ge" "≥")
-    ("lless" "≪")
-    ("ggreater" "≫")
-    ("lesssim" "⪍")
-    ("greatersim" "⪎")
-    ("lessapprox" "⪅")
-    ("greaterapprox" "⪆")
-    ("in" "∈")
-    ("notin" "∉")
-    ("subset" "⊂")
-    ("supset" "⊃")
-    ("subseteq" "⊆")
-    ("supseteq" "⊇")
-    ("sqsubset" "⊏")
-    ("sqsupset" "⊐")
-    ("sqsubseteq" "⊑")
-    ("sqsupseteq" "⊒")
-    ("inter" "∩")
-    ("Inter" "⋂")
-    ("union" "∪")
-    ("Union" "⋃")
-    ("squnion" "⊔")
-    ("Squnion" "⨆")
-    ("sqinter" "⊓")
-    ("Sqinter" "⨅")
-    ("setminus" "∖")
-    ("propto" "∝")
-    ("uplus" "⊎")
-    ("Uplus" "⨄")
-    ("noteq" "≠")
-    ("sim" "∼")
-    ("doteq" "≐")
-    ("simeq" "≃")
-    ("approx" "≈")
-    ("asymp" "≍")
-    ("cong" "≅")
-    ("smile" "⌣")
-    ("equiv" "≡")
-    ("frown" "⌢")
-    ("Join" "⨝")
-    ("bowtie" "⋈")
-    ("prec" "≺")
-    ("succ" "≻")
-    ("preceq" "≼")
-    ("succeq" "≽")
-    ("parallel" "∥")
-    ("bar" "¦")
-    ("plusminus" "±")
-    ("minusplus" "∓")
-    ("times" "×")
-    ("div" "÷")
-    ("cdot" "⋅")
-    ("star" "⋆")
-    ("bullet" "∙")
-    ("circ" "∘")
-    ("dagger" "†")
-    ("ddagger" "‡")
-    ("lhd" "⊲")
-    ("rhd" "⊳")
-    ("unlhd" "⊴")
-    ("unrhd" "⊵")
-    ("triangleleft" "◁")
-    ("triangleright" "▷")
-    ("triangle" "▵") ; or △
-    ("triangleq" "≜")
-    ("oplus" "⊕")
-    ("Oplus" "⨁")
-    ("otimes" "⊗")
-    ("Otimes" "⨂")
-    ("odot" "⊙")
-    ("Odot" "⨀")
-    ("ominus" "⊖")
-    ("oslash" "⊘")
-    ("dots" "…")
-    ("cdots" "⋯")
-    ("Sum" "∑")
-    ("Prod" "∏")
-    ("Coprod" "∐")
-    ("infinity" "∞")
-    ("integral" "∫")
-    ("ointegral" "∮")
-    ("clubsuit" "♣")
-    ("diamondsuit" "♢")
-    ("heartsuit" "♡")
-    ("spadesuit" "♠")
-    ("aleph" "ℵ")
-    ("emptyset" "∅")
-    ("nabla" "∇")
-    ("partial" "∂")
-    ("Re" "ℜ")
-    ("Im" "ℑ")
-    ("flat" "♭")
-    ("natural" "♮")
-    ("sharp" "♯")
-    ("angle" "∠")
-    ("copyright" "©")
-    ("registered" "®")
-    ("hyphen" "‐")
-    ("inverse" "¯¹") ; X-Symb: just "¯"
-    ("onesuperior" "¹")
-    ("twosuperior" "²")
-    ("threesuperior" "³")
-    ("onequarter" "¼")
-    ("onehalf" "½")
-    ("threequarters" "¾")
-    ("ordmasculine" "º")
-    ("ordfeminine" "ª")
-    ("section" "§")
-    ("paragraph" "¶")
-    ("exclamdown" "¡")
-    ("questiondown" "¿")
-    ("euro" "€")
-    ("pounds" "£")
-    ("yen" "¥")
-    ("cent" "¢")
-    ("currency" "¤")
-    ("degree" "°")
-    ("amalg" "⨿")
-    ("mho" "℧")
-    ("lozenge" "◊")
-    ("wp" "℘")
-    ("wrong" "≀")  ;; #x002307
-    ("struct" "⋄") ;; #x0022c4
-    ("acute" "´")
-    ("index" "ı")
-    ("dieresis" "¨")
-    ("cedilla" "¸")
-    ("hungarumlaut" "ʺ")
-    ("spacespace" " ")  ;; #x002001
-    ("module" "⟨module⟩" bold)
-    ("some" "ϵ")
-    ("open" "‹")
-    ("close" "›")
-    ("newline" "⏎"))
-  "Symbol token map for Isabelle.  The standard set of Isabelle symbols."
-  :type 'unicode-tokens-token-symbol-map
-  :group 'isabelle-tokens
-  :set 'isar-set-and-restart-tokens)
-
-(defcustom isar-extended-symbols-tokens
-  '(("stareq" "≛")
-    ("defeq" "≝")
-    ("questioneq" "≟")
-    ("vartheta" "ϑ")
-    ; ("o" "ø")
-    ("varpi" "ϖ")
-    ("varrho" "ϱ")
-    ("varsigma" "ς")
-    ("varphi" "ϕ")
-    ("hbar" "ℏ")
-    ("ell" "ℓ")
-    ("ast" "∗")
-
-    ("bigcirc" "◯")
-    ("bigtriangleup" "△")
-    ("bigtriangledown" "▽")
-    ("ni" "∋")
-    ("mid" "∣")
-    ("notlt" "≮")
-    ("notle" "≰")
-    ("notprec" "⊀")
-    ("notpreceq" "⋠")
-    ("notsubset" "⊄")
-    ("notsubseteq" "⊈")
-    ("notsqsubseteq" "⋢")
-    ("notgt" "≯")
-    ("notge" "≱")
-    ("notsucc" "⊁")
-    ("notsucceq" "⋡")
-    ("notsupset" "⊅")
-    ("notsupseteq" "⊉")
-    ("notsqsupseteq" "⋣")
-    ("notequiv" "≢")
-    ("notsim" "≁")
-    ("notsimeq" "≄")
-    ("notapprox" "≉")
-    ("notcong" "≇")
-    ("notasymp" "≭")
-    ("nearrow" "↗")
-    ("searrow" "↘")
-    ("swarrow" "↙")
-    ("nwarrow" "↖")
-    ("vdots" "⋮")
-    ("ddots" "⋱")
-    ("closequote" "’")
-    ("openquote" "‘")
-    ("opendblquote" "”")
-    ("closedblquote" "“")
-    ("emdash" "—")
-    ("prime" "′")
-    ("doubleprime" "″")
-    ("tripleprime" "‴")
-    ("quadrupleprime" "⁗")
-    ("nbspace" " ")
-    ("thinspace" " ")
-    ("notni" "∌")
-    ("colonequals" "≔")
-    ("foursuperior" "⁴")
-    ("fivesuperior" "⁵")
-    ("sixsuperior" "⁶")
-    ("sevensuperior" "⁷")
-    ("eightsuperior" "⁸")
-    ("ninesuperior" "⁹"))
-  "Extended symbols token map for Isabelle.  These are not defined standardly."
-  :type 'unicode-tokens-token-symbol-map
-  :group 'isabelle-tokens
-  :set 'isar-set-and-restart-tokens)
-
-(defun isar-try-char (charset code1 code2)
-  (and (charsetp charset) ; prevent error
-       (char-to-string (make-char charset code1 code2))))
-
-(defcustom isar-symbols-tokens-fallbacks
-  `(;; Faked long symbols
-    ("longleftarrow" "←-")
-    ("Longleftarrow" "⇐–")
-    ("longrightarrow" "–→")
-    ("Longrightarrow" "–⇒")
-    ("longleftrightarrow" "←→")
-    ("Longleftrightarrow" "⇐⇒")
-    ("longmapsto" "❘→")
-    ;; bracket composition alternatives
-    ("lparr" "(|")
-    ("rparr" "|)")
-    ;; an example of using characters from another charset.
-    ;; to expand this table, see output of M-x list-charset-chars
-    ("lbrakk" ,(isar-try-char 'japanese-jisx0208 #x22 #x5A))
-    ("rbrakk" ,(isar-try-char 'japanese-jisx0208 #x22 #x5A))
-    ("lbrakk" "[|")
-    ("rbrakk" "|]")
-    ("lbrace" "{|")
-    ("rbrace" "|}"))
-  "Fallback alternatives to `isar-symbols-tokens'.
-The first displayable composition will be displayed to replace the
-tokens."
-  :type 'unicode-tokens-token-symbol-map
-  :group 'isabelle-tokens
-  :set 'isar-set-and-restart-tokens)
-
-(defcustom isar-bold-nums-tokens
-  '(("zero" "0" bold)
-    ("one" "1" bold)
-    ("two" "2" bold)
-    ("three" "3" bold)
-    ("four" "4" bold)
-    ("five" "5" bold)
-    ("six" "6" bold)
-    ("seven" "7" bold)
-    ("eight" "8" bold)
-    ("nine" "9" bold))
-  "Tokens for bold numerals."
-  :type 'unicode-tokens-token-symbol-map
-  :group 'isabelle-tokens
-  :set 'isar-set-and-restart-tokens)
-
-(defun isar-map-letters (f1 f2 &rest symbs)
-  (cl-loop for x below 26
-          for c = (+ 65 x)
-          collect
-          (cons (funcall f1 c) (cons (funcall f2 c) symbs))))
-
-(defconst isar-script-letters-tokens ; \<A> \<B> ...
-  (isar-map-letters (lambda (x) (format "%c" x))
-                   (lambda (x) (format "%c" x))
-                   'script))
-
-(defconst isar-roman-letters-tokens ; \<a> \<b> ...
-  (isar-map-letters (lambda (x) (downcase (format "%c" x)))
-                   (lambda (x) (downcase (format "%c" x)))
-                   'serif))
-
-(defconst isar-fraktur-uppercase-letters-tokens ; \<AA> \<BB> ..
-  (isar-map-letters (lambda (x) (format "%c%c" x x))
-                   (lambda (x) (format "%c" x))
-                   'frakt))
-
-(defconst isar-fraktur-lowercase-letters-tokens ; \<AA> \<BB> ..
-  (isar-map-letters (lambda (x) (downcase (format "%c%c" x x)))
-                   (lambda (x) (downcase (format "%c" x)))
-                   'frakt))
-
-(defcustom isar-token-symbol-map nil
-  "Table mapping Isabelle symbol token names to Unicode strings.
-See `unicode-tokens-token-symbol-map'.
-
-You can adjust this table to change the default entries.
-
-Each element is a list
-
-  (TOKNAME COMPOSITION FONTSYMB ...)
-
-COMPOSITION is usually a string, perhaps containing Unicode characters.
-For Isabelle, the token TOKNAME is made into the token \\<TOKNAME>."
-  :type 'unicode-tokens-token-symbol-map
-  :group 'isabelle
-  :set 'isar-set-and-restart-tokens
-  :tag "Isabelle Unicode Token Mapping")
-
-(defcustom isar-user-tokens nil
-  "User-defined additions to `isar-token-symbol-map'.
-
-Each element is a list
-
-  (TOKNAME COMPOSITION FONTSYMB ...)
-
-COMPOSITION is usually a string, perhaps containing Unicode characters.
-For Isabelle, the token TOKNAME is made into the token \\<TOKNAME>."
-  :type 'unicode-tokens-token-symbol-map
-  :group 'isabelle
-  :set 'isar-set-and-restart-tokens
-  :tag "User extensions for Isabelle Token Mapping")
-
-(defun isar-init-token-symbol-map ()
-  "Initialise the default value for `unicode-tokens-token-symbol-map'."
-  (custom-set-default 'isar-token-symbol-map
-                     (append
-                      isar-symbols-tokens
-                      isar-extended-symbols-tokens
-                      isar-user-tokens
-                      isar-misc-letters-tokens
-                      isar-greek-letters-tokens
-                      isar-bold-nums-tokens
-                      isar-script-letters-tokens
-                      isar-roman-letters-tokens
-                      isar-fraktur-uppercase-letters-tokens
-                      isar-fraktur-lowercase-letters-tokens
-                      isar-user-tokens
-                      isar-symbols-tokens-fallbacks)))
-
-(isar-init-token-symbol-map)
-
-
-
-;;
-;; Shortcuts
-;;
-
-(defcustom isar-symbol-shortcuts
-  '(("\\/" . "\\<or>")
-    ("/\\" . "\\<and>")
-    ("+O" . "\\<oplus>")
-    ("-O" . "\\<ominus>")
-    ("xO" . "\\<otimes>")
-    ("/O" . "\\<oslash>")
-    (".O" . "\\<odot>")
-    ("|+" . "\\<dagger>")
-    ("|++" . "\\<ddagger>")
-    ("<=" . "\\<le>")
-    ("|-" . "\\<turnstile>")
-    (">=" . "\\<ge>")
-    ("-|" . "\\<stileturn>")
-    ("||" . "\\<parallel>")
-    ("==" . "\\<equiv>")
-    ("~=" . "\\<noteq>")
-    ("~:" . "\\<notin>")
-    ("~~~" . "\\<notapprox>")
-    ("~~" . "\\<approx>")
-    ("~==" . "\\<cong>")
-    ("|<>|" . "\\<bowtie>")
-    ("|=" . "\\<Turnstile>")
-    ("=." . "\\<doteq>")
-    ("_|_" . "\\<bottom>")
-    ("</" . "\\<notle>")
-    ("~>=" . "\\<notge>")
-    ("==/" . "\\<notequiv>")
-    ("~/" . "\\<notsim>")
-    ("~=/" . "\\<notsimeq>")
-    ("~~/" . "\\<notsimeq>")
-    ("<-" . "\\<leftarrow>")
-    ("<=" . "\\<Leftarrow>")
-    ("->" . "\\<rightarrow>")
-    ("=>" . "\\<Rightarrow>")
-    ("<->" . "\\<leftrightarrow>")
-    ("<=>" . "\\<Leftrightarrow>")
-    ("|->" . "\\<mapsto>")
-    ("<--" . "\\<longleftarrow>")
-    ("<==" . "\\<Longleftarrow>")
-    ("-->" . "\\<longrightarrow>")
-    ("==>" . "\\<Longrightarrow>")
-    ("<==>" . "\\<Longleftrightarrow>")
-    ("|-->" . "\\<longmapsto>")
-    ("<->" . "\\<longleftrightarrow>")
-    ("<<" . "\\<guillemotleft>")
-    (">>" . "\\<guillemotright>")
-    ("<>" . "\\<diamond>")
-    ("[|" . "\\<lbrakk>")
-    ("|]" . "\\<rbrakk>")
-    ("{|" . "\\<lbrace>")
-    ("|}" . "\\<rbrace>")
-    ("(|" . "\\<lparr>")
-    ("|)" . "\\<rparr>")
-    ;; useful for unicode-tokens-replace-shortcuts
-    ("ALL" . "\\<forall>")
-    ("EX"  . "\\<exists>")
-    ("!!"  . "\\<And>")
-    ;; TODO: put these into replacement shortcuts, perhaps
-    ;; ("~"  . "\\<not>")
-    ;; ("!"  . "\\<forall>")
-    ;; ("?"  . "\\<exists>")
-    ;; extra misc, switch them off if you don't like them
-    ;("|>" . "\\<triangleright>") ; clashes with ML parsing combinator
-    ("<|" . "\\<triangleleft>"))
-  "Shortcut key sequence table for symbol tokens input.
-See `unicode-tokens-shortcut-alist'."
-    :type 'unicode-tokens-shortcut-alist
-    :set 'isar-set-and-restart-tokens
-    :group 'isabelle
-    :tag "Isabelle symbol shortcuts")
-
-(defcustom isar-shortcut-alist nil
-  "Shortcut key sequence table for token input.
-See `unicode-tokens-shortcut-alist'."
-  :type 'unicode-tokens-shortcut-alist
-  :set 'isar-set-and-restart-tokens
-  :group 'isabelle
-  :tag "Isabelle Unicode Input Shortcuts")
-
-(defun isar-init-shortcut-alists ()
-  "Set defaults for `isar-shortcut-alist' and 
`isar-shortcut-replacement-alist'."
-  (custom-set-default 'isar-shortcut-alist
-                     (append
-                      isar-symbol-shortcuts
-                      ;; LaTeX-like syntax for symbol names, easier to type
-                      (mapcar
-                       (lambda (tokentry)
-                         (cons (concat "\\" (car tokentry))
-                               (format isar-token-format (car tokentry))))
-                       (append isar-greek-letters-tokens
-                               isar-symbols-tokens)))))
-  ;; todo: allow shortcuts for replacements to be a different list
-  ;; (setq unicode-tokens-shortcut-replacement-alist nil))
-
-(isar-init-shortcut-alists)
-
-;;
-;; To generate special menu entries
-;;
-
-(defconst isar-tokens-customizable-variables
-  '(("Symbols" isar-symbols-tokens)
-    ("Extended Symbols" isar-extended-symbols-tokens)
-    ("User Tokens" isar-user-tokens)
-    ("Misc Letters" isar-misc-letters-tokens)
-    ("Greek Letters" isar-greek-letters-tokens)
-    ("Fallbacks" isar-symbols-tokens-fallbacks)
-    ("Shortcuts" isar-symbol-shortcuts)))
-
-
-;;
-;; prover symbol support
-;;
-
-(eval-after-load "isar"
-  '(setq
-    proof-tokens-activate-command
-    (isar-markup-ml "change print_mode (insert (op =) \"xsymbols\")")
-    proof-tokens-deactivate-command
-    (isar-markup-ml "change print_mode (remove (op =) \"xsymbols\")")))
-
-
-
-(provide 'isar-unicode-tokens)
-
-;;; isar-unicode-tokens.el ends here
diff --git a/isar/isar.el b/isar/isar.el
deleted file mode 100644
index 9deed7c1fa..0000000000
--- a/isar/isar.el
+++ /dev/null
@@ -1,645 +0,0 @@
-;; isar.el --- Major mode for Isabelle/Isar proof assistant
-;;
-;; Copyright (C) 1994-2010 LFCS Edinburgh.
-;; Copyright (C) 2018  Free Software Foundation, Inc.
-;;
-;; License:   GPL (GNU GENERAL PUBLIC LICENSE)
-;;
-;; Maintainers:   David Aspinall, Makarius, Stefan Berghofer
-;;
-;; Authors:       David Aspinall <David.Aspinall@ed.ac.uk>
-;;               Markus Wenzel <wenzelm@in.tum.de>
-;;
-;; Contributors:  David von Oheimb, Sebastian Skalberg
-;;
-;; $Id$
-;;
-
-;;; Code:
-
-(eval-when-compile
-  (require 'span)
-  (require 'proof-syntax)
-  (require 'pg-goals)
-  (require 'pg-vars)
-  (require 'outline))
-(defvar comment-quote-nested)
-(defvar isar-use-find-theorems-form)
-(defvar isar-use-linear-undo)
-
-(require 'proof)
-(require 'isabelle-system)             ; system code
-(require 'isar-find-theorems)          ; "Find Theorems" search form
-
-;;
-;; Load syntax
-;;
-
-(defcustom isar-keywords-name nil
-  "Specifies a theory-specific keywords setting to use with Isar.
-See -k option for Isabelle interface script."
-  :type 'string
-  :group 'isabelle)
-
-(or (featurep 'isar-keywords)
-    ;; Pickup isar-keywords file from somewhere appropriate, giving
-    ;; user chance to set name of file, or based on name of logic.
-    (isabelle-load-isar-keywords
-     (or isar-keywords-name
-        isabelle-chosen-logic)))
-(require 'isar-syntax)
-
-
-;; Completion table for Isabelle/Isar identifiers
-(defpgdefault completion-table isar-keywords-major)
-
-(defcustom isar-web-page
-  "http://isabelle.in.tum.de/";
-  "URL of web page for Isabelle/Isar."
-  :type 'string
-  :group 'isabelle-isar)
-
-
-;; Adjust toolbar entries (must be done before proof-toolbar is loaded).
-
-(eval-after-load "pg-custom"
-  '(setq isar-toolbar-entries
-        (assq-delete-all 'qed (assq-delete-all 'goal isar-toolbar-entries))))
-
-
-(defun isar-strip-terminators ()
-  "Remove explicit Isabelle/Isar command terminators `;' from the buffer."
-  (interactive)
-  (save-excursion
-    (goto-char (point-min))
-    (while (proof-search-forward ";" (point-max) t)
-      (while (not (proof-buffer-syntactic-context))
-       (delete-char -1)
-       (or (proof-looking-at ";\\|\\s-\\|$")
-           (insert " "))))))
-
-
-(defun isar-markup-ml (string)
-  "Return marked up version of ML command STRING for Isar."
-  (format "ML_command {* %s *};" string))
-
-
-(defun isar-mode-config-set-variables ()
-  "Configure generic proof scripting mode variables for Isabelle/Isar."
-  (set (make-local-variable 'indent-tabs-mode) nil)
-  (setq
-   proof-assistant-home-page    isar-web-page
-   proof-guess-command-line     'isabelle-set-prog-name
-   proof-prog-name-guess       t
-
-   ;; proof script syntax
-   proof-terminal-string          ";"          ; forcibly ends a command
-   proof-electric-terminator-noterminator t  ; don't insert it
-   proof-script-command-start-regexp  isar-any-command-regexp 
-
-   proof-script-integral-proofs t
-   proof-script-comment-start          isar-comment-start
-   proof-script-comment-end            isar-comment-end
-   proof-script-comment-start-regexp   isar-comment-start-regexp
-   proof-script-comment-end-regexp     isar-comment-end-regexp
-   proof-string-start-regexp    isar-string-start-regexp
-   proof-string-end-regexp      isar-string-end-regexp
-
-   ;; For func-menu and finding goal..save regions
-   proof-save-command-regexp    isar-save-command-regexp
-   proof-goal-command-regexp    isar-goal-command-regexp
-   proof-goal-with-hole-regexp  isar-named-entity-regexp
-   proof-goal-with-hole-result isar-named-entity-name-match-number
-   proof-save-with-hole-regexp  nil
-   proof-script-imenu-generic-expression isar-generic-expression
-   imenu-syntax-alist isar-script-syntax-table-alist
-
-   proof-indent-enclose-offset  (- proof-indent)
-   proof-indent-open-offset     0
-   proof-indent-close-offset    0
-   proof-indent-any-regexp      isar-indent-any-regexp
-;   proof-indent-inner-regexp    isar-indent-inner-regexp
-   proof-indent-enclose-regexp  isar-indent-enclose-regexp
-   proof-indent-open-regexp     isar-indent-open-regexp
-   proof-indent-close-regexp    isar-indent-close-regexp
-
-   ;; proof engine
-   proof-showproof-command      "pr"
-   proof-goal-command           "lemma \"%s\""
-   proof-save-command           "qed"
-   proof-context-command        "print_context"
-   proof-info-command           "welcome"
-   proof-query-identifier-command
-   '((nil     "thm %s;")
-     (string  "term \"%s\";")
-     (comment "term \"%s\";"))
-   proof-shell-start-silent-cmd "disable_pr"
-   proof-shell-stop-silent-cmd  "enable_pr"
-   proof-shell-trace-output-regexp  "\^AI\^AV"
-   proof-script-preprocess      'isar-command-wrapping
-   ;; command hooks
-   proof-goal-command-p         'isar-goal-command-p
-   proof-really-save-command-p  'isar-global-save-command-p
-   proof-state-preserving-p     'isar-state-preserving-p
-   proof-shell-compute-new-files-list 'isar-shell-compute-new-files-list
-   ;; span menu
-   proof-script-span-context-menu-extensions 'isabelle-create-span-menu)
-  ;; proof assistant settings
-  (setq proof-use-pgip-askprefs        t)
-  ;; others: find theorems, undo config
-  (isar-configure-from-settings))
-
-(defun isar-shell-mode-config-set-variables ()
-  "Configure generic proof shell mode variables for Isabelle/Isar."
-  (setq
-
-   proof-shell-annotated-prompt-regexp  "^\\w*[>#] \^AS"
-
-   ;; for issuing command, not used to track cwd in any way.
-   proof-shell-cd-cmd          (isar-markup-ml "ThyLoad.add_path \"%s\"")
-
-   ;; Escapes for filenames inside ML strings.
-   ;; We also make a hack for a bug in Isabelle, by switching from
-   ;; backslashes to forward slashes if it looks like we're running
-   ;; on Windows.
-   proof-shell-filename-escapes
-   (if (fboundp 'win32-long-filename)   ; rough test for XEmacs on win32
-       ;; Patterns to unixfy names.
-       ;; Jacques Fleuriot's patch in ML does this too: ("^[a-zA-Z]:" . "")
-       ;; But I'll risk leaving drive names in, not sure how to replace them.
-       '(("\\\\" . "/") ("\"" . "\\\""))
-     ;; Normal case: quotation for backslash, quote mark.
-     '(("\\\\" . "\\\\") ("\""   . "\\\"")))
-
-   proof-shell-interrupt-regexp         "\^AM\\*\\*\\* Interrupt"
-   proof-shell-error-regexp             "\^AM\\*\\*\\*"
-   proof-shell-proof-completed-regexp   nil     ; n.a.
-
-   pg-next-error-regexp          "\\((line \\([0-9]+\\) of \"[^\"]+\")\\)"
-   pg-next-error-filename-regexp "\\((line [0-9]+ of \"\\([^\"]+\\)\")\\)"
-
-   ;; matches names of assumptions
-   proof-shell-assumption-regexp        isar-id
-
-   proof-shell-start-goals-regexp       "\^AO"
-   proof-shell-end-goals-regexp         "\^AP"
-
-   proof-shell-init-cmd                        nil
-   proof-shell-restart-cmd              "ProofGeneral.restart"
-
-   proof-shell-eager-annotation-start-length 2
-   proof-shell-eager-annotation-start   "\^AI\\|\^AK"
-   proof-shell-eager-annotation-end     "\^AJ\\|\^AL"
-   proof-shell-strip-output-markup     'isar-strip-output-markup
-
-   pg-special-char-regexp               "\^A[0-9A-Z]"
-   pg-subterm-help-cmd                 "term %s"
-   proof-cannot-reopen-processed-files  t
-
-   ;; Urgent messages delimited by eager annotations
-   proof-shell-clear-response-regexp    
-   "\^AIProof General, please clear the response buffer."
-   proof-shell-clear-goals-regexp       
-   "\^AIProof General, please clear the goals buffer."
-   proof-shell-theorem-dependency-list-regexp 
-   "\^AIProof General, theorem dependencies of \"\\(.*\\)\" are 
\"\\(.*\\)\"\\(\^AJ\\)"
-   proof-shell-retract-files-regexp
-   "\^AIProof General, you can unlock the file \"\\(.*\\)\"\^AJ"
-   proof-shell-process-file
-   (cons
-    "\^AIProof General, this file is loaded: \"\\(.*\\)\"\^AJ"
-    (lambda () (match-string 1)))
-
-   proof-shell-match-pgip-cmd          "\^AI<pgip"
-   proof-shell-issue-pgip-cmd          'isabelle-process-pgip
-
-   proof-shell-theorem-dependency-list-split "\" \""
-   proof-shell-show-dependency-cmd     "thm %s;"
-
-   proof-shell-compute-new-files-list 'isar-shell-compute-new-files-list
-   proof-shell-inform-file-processed-cmd 
-   "ProofGeneral.inform_file_processed \"%s\""
-   proof-shell-inform-file-retracted-cmd 
-   "ProofGeneral.inform_file_retracted \"%s\""))
-
-
-;;
-;; Settings for the interface
-;;
-;; Note: settings for Isabelle are configured automatically via PGIP messages,
-;; see `pg-pgip-process-hasprefs' in pg-pgip.el and 
-;; `proof-assistant-settings-cmds' in proof-menu.el.
-;;
-
-(defun isar-set-proof-find-theorems-command ()
-  (setq proof-find-theorems-command
-       (if isar-use-find-theorems-form
-           'isar-find-theorems-form
-         'isar-find-theorems-minibuffer)))
-
-(defpacustom use-find-theorems-form nil
-  "Use a form-style input for the find theorems operation."
-  :type 'boolean
-  :eval (isar-set-proof-find-theorems-command))
-
-(defun isar-set-undo-commands (&optional initp)
-  (unless initp
-    (proof-deactivate-scripting)
-    (when proof-script-buffer
-      (message "Warning: switching undo mechanism will break undo in current 
buffer")))
-  (setq proof-count-undos-fn 'isar-count-undos)
-  (when isar-use-linear-undo
-    (setq proof-kill-goal-command nil)
-    (setq proof-find-and-forget-fn 'isar-count-undos)
-    (setq proof-arbitrary-undo-positions t))
-  (when (not isar-use-linear-undo)
-    (setq proof-kill-goal-command "ProofGeneral.kill_proof")
-    (setq proof-find-and-forget-fn 'isar-find-and-forget)
-    (setq proof-arbitrary-undo-positions nil)))
-
-(defpacustom use-linear-undo t
-  "Whether to allow undo to re-enter completed proofs (requires restart)."
-  :type 'boolean
-  :eval (isar-set-undo-commands))
-
-(defun isar-configure-from-settings ()
-  (isar-set-proof-find-theorems-command)
-  (isar-set-undo-commands 'init))
-
-;;
-;; Theory loader operations
-;;
-
-(defun isar-remove-file (name files cmp-base)
-  (let (result)
-    (while files
-      (let*
-         ((file (car files))
-          (same (if cmp-base (string= name (file-name-nondirectory file))
-                  (string= name file))))
-       (unless same 
-         (setq result (cons file result)))
-       (setq files (cdr files))))
-    result))
-
-(defun isar-shell-compute-new-files-list ()
-  "Compute the new list of files read by the proof assistant.
-This is called when Proof General spots output matching
-`proof-shell-retract-files-regexp'."
-  (let*
-      ((name (match-string 1))
-       (base-name (file-name-nondirectory name)))
-    (if (string= name base-name)
-       (isar-remove-file name proof-included-files-list t)
-      (isar-remove-file 
-       (file-truename name) proof-included-files-list nil))))
-
-
-;;
-;; Define the derived modes
-;;
-;; use eval-and-compile to define vars for byte comp.
-
-(define-derived-mode isar-shell-mode proof-shell-mode
-   "Isabelle Shell" nil
-   (isar-shell-mode-config))
-
-(define-derived-mode isar-response-mode proof-response-mode
-  "Isar Messages" nil
-  (isar-response-mode-config))
-
-(define-derived-mode isar-goals-mode proof-goals-mode
-  "Isar Proofstate" nil
-  (isar-goals-mode-config))
-
-(define-derived-mode isar-mode proof-mode
-  "Isar"
-  "Major mode for editing Isar proof scripts.
-
-\\{isar-mode-map}"
-  (isar-mode-config))
-
-
-
-;;
-;; Help menu
-;;
-;; NB: definvisible must be after derived modes (uses isar-mode-map)
-
-(proof-definvisible isar-help-antiquotations "print_antiquotations" "hA")
-(proof-definvisible isar-help-attributes "print_attributes" "ha")
-(proof-definvisible isar-help-cases "print_cases" "hc")
-(proof-definvisible isar-help-claset "print_claset" "hC")
-(proof-definvisible isar-help-commands "print_commands" "ho")
-(proof-definvisible isar-help-facts "print_facts" "hf")
-(proof-definvisible isar-help-syntax "print_syntax" "hi")
-(proof-definvisible isar-help-induct-rules "print_induct_rules" "hI")
-(proof-definvisible isar-help-methods "print_methods" "hm")
-(proof-definvisible isar-help-simpset "print_simpset" "hS")
-(proof-definvisible isar-help-binds "print_binds" "hb")
-(proof-definvisible isar-help-theorems "print_theorems" "ht")
-(proof-definvisible isar-help-trans-rules "print_trans_rules" "hT")
-
-;;
-;; Command menu
-;;
-
-(proof-definvisible isar-cmd-display-draft
- '(progn
-    (proof-save-this-buffer)
-    (format "display_drafts \"%s\"" buffer-file-name))
- [(control d)])
-
-(proof-definvisible isar-cmd-print-draft
-  '(if (y-or-n-p
-       (format "Print draft of file %s? " buffer-file-name))
-       (progn
-        (proof-save-this-buffer)
-        (format "print_drafts \"%s\"" buffer-file-name))
-     (error "Aborted"))
-  [(control p)])
-
-(proof-definvisible isar-cmd-quickcheck "quickcheck" [(control q)])
-(proof-definvisible isar-cmd-nitpick "nitpick" [(control n)])
-(proof-definvisible isar-cmd-refute "refute" "r")
-(proof-definvisible isar-cmd-sledgehammer "sledgehammer" [(control s)])
-
-(defpgdefault menu-entries
-  (append
-   (list isabelle-logics-menu-entries)
-   (list
-    (cons "Commands"
-         (list
-          ["Quickcheck"         isar-cmd-quickcheck     t]
-          ["Nitpick"            isar-cmd-nitpick        t]
-          ["Refute"             isar-cmd-refute         t]
-          ["Sledgehammer"       isar-cmd-sledgehammer   t]
-          ["Display Draft"      isar-cmd-display-draft  t]
-          ["Print Draft"        isar-cmd-print-draft    t])))
-   (list
-    (cons "Show Me"
-         (list
-          ["Cases"              isar-help-cases          t]
-          ["Facts"              isar-help-facts          t]
-          ["Term Bindings"      isar-help-binds          t]
-          "----"
-          ["Classical Rules"    isar-help-claset         t]
-          ["Induct/Cases Rules" isar-help-induct-rules   t]
-          ["Simplifier Rules"   isar-help-simpset        t]
-          ["Theorems"           isar-help-theorems       t]
-          ["Transitivity Rules" isar-help-trans-rules    t]
-          "----"
-          ["Antiquotations"     isar-help-antiquotations t]
-          ["Attributes"         isar-help-attributes     t]
-          ["Commands"           isar-help-commands       t]
-          ["Inner Syntax"       isar-help-syntax         t]
-          ["Methods"            isar-help-methods        t])))))
-
-(defun isar-set-command ()
-  "Query the user to set the command to run Isabelle"
-  (interactive)
-  (isa-set-isabelle-command t))
-
-(defpgdefault help-menu-entries isabelle-docs-menu)
-
-;; undo proof commands
-(defun isar-count-undos (span)
-  "Return commands to be used to forget SPAN."
-  (let ((ct 0) str i)
-    (while span
-      (setq str (or (span-property span 'cmd) ""))
-      (cond ((or (eq (span-property span 'type) 'vanilla)
-                (eq (span-property span 'type) 'goalsave))
-            (or (proof-string-match isar-undo-skip-regexp str)
-                (proof-string-match isar-undo-ignore-regexp str)
-                (setq ct (+ 1 ct))))
-           ((eq (span-property span 'type) 'pbp)
-            ;; this case for automatically inserted text (e.g. sledgehammer)
-            (cond ((not (proof-string-match isar-undo-skip-regexp str))
-                   (setq ct 1)
-                   (setq i 0)
-                   ;; If we find a semicolon, assume several commands,
-                   ;; and increment the undo count.
-                   (while (< i (length str))
-                     (if (= (aref str i) ?\;)
-                         (setq ct (+ 1 ct)))
-                     (setq i (+ 1 i))))
-                  (t nil))))
-      (setq span (next-span span 'type)))
-    (list (isar-undos isar-use-linear-undo ct))))
-
-;; undo theory commands
-(defun isar-find-and-forget (span)
-  "Return commands to be used to forget SPAN."
-  (let (str ans answers)
-    (while span
-      (setq str (span-property span 'cmd))
-      (setq ans nil)
-      (cond
-       ;; comment, diagnostic, nested proof command: skip
-       ;; FIXME: should adjust proof-nesting-depth here.
-       ((or (eq (span-property span 'type) 'comment)
-           (eq (span-property span 'type) 'proverproc)
-           (eq (span-property span 'type) 'proof)
-           (and str (proof-string-match isar-undo-skip-regexp str))
-           (and str (proof-string-match isar-undo-ignore-regexp str))))
-       ;; finished goal: undo
-       ((eq (span-property span 'type) 'goalsave)
-       (setq ans isar-undo))
-       ;; open goal: skip and exit
-       ((and str (proof-string-match isar-goal-command-regexp str))
-       (setq span nil))
-       ;; control command: cannot undo
-       ((and str (proof-string-match isar-undo-fail-regexp str))
-       (setq ans (isar-cannot-undo (match-string 1 str)))
-       (setq answers nil)
-       (setq span nil))
-       ;; theory: remove and exit
-       ((and str (proof-string-match isar-undo-remove-regexp str))
-       (setq ans (isar-remove (match-string 3 str)))
-       (setq span nil))
-       ;; else: undo
-       (t
-       (setq ans isar-undo)))
-      (if ans (setq answers (cons ans answers)))
-      (if span (setq span (next-span span 'type))))
-    answers))
-
-(defun isar-goal-command-p (span)
-  "Decide whether argument SPAN is a goal or not."
-  (proof-string-match isar-goal-command-regexp
-                     (or (span-property span 'cmd) "")))
-
-(defun isar-global-save-command-p (span str)
-  "Decide whether argument SPAN with command STR is a global save command."
-  (or
-   (proof-string-match isar-global-save-command-regexp str)
-   (let ((ans nil) (lev 0) cmd)
-     (while (and (not ans) span (setq span (prev-span span 'type)))
-       (setq cmd (or (span-property span 'cmd) ""))
-       (cond
-       ;; comment: skip
-       ((eq (span-property span 'type) 'comment))
-       ;; local qed: enter block
-       ((proof-string-match isar-save-command-regexp cmd)
-        (setq lev (+ lev 1)))
-       ;; local goal: leave block, or done
-       ((proof-string-match isar-local-goal-command-regexp cmd)
-        (if (> lev 0) (setq lev (- lev 1)) (setq ans 'no)))
-       ;; global goal: done
-       ((proof-string-match isar-goal-command-regexp cmd)
-        (setq ans 'yes))))
-     (eq ans 'yes))))
-
-(defvar isar-current-goal 1
-  "Last goal that Emacs looked at.")
-
-(defun isar-state-preserving-p (cmd)
-  "Non-nil if command CMD preserves the proofstate."
-  (proof-string-match isar-undo-skip-regexp cmd))
-
-
-;;
-;; Commands specific to isar
-;;
-
-(proof-defshortcut isar-bold      "\\<^bold>%p" [(control b)])
-(proof-defshortcut isar-local     "\\<^loc>%p" [(control c)])
-(proof-defshortcut isar-super     "\\<^sup>%p" [(control u)])
-(proof-defshortcut isar-sub       "\\<^sub>%p" [(control l)])
-(proof-defshortcut isar-longsuper "\\<^bsup>%p\\<^esup>" [?u])
-(proof-defshortcut isar-longsub   "\\<^bsub>%p\\<^esub>" [?l])
-(proof-defshortcut isar-idsub     "\\<^isub>%p" [(control i)])
-(proof-defshortcut isar-raw       "\\<^raw:%p>" [(control r)])
-(proof-defshortcut isar-antiquote "@{text \"%p\"}" [(control a)])
-(proof-defshortcut isar-ml       "ML {* %p *}" [(control x)])
-
-
-;;
-;; Isar shell startup and exit hooks
-;;
-
-(defvar isar-shell-current-line-width nil
-  "Current line width of the Isabelle process's pretty printing module.
-Its value will be updated whenever the corresponding screen gets
-selected.")
-
-(defun isar-shell-adjust-line-width ()
-  "Use Isabelle's pretty printing facilities to adjust output line width.
-Checks the width in the `proof-goals-buffer'"
-  (let ((ans ""))
-    (and (not proof-shell-silent)
-        (proof-with-current-buffer-if-exists proof-goals-buffer
-          (let ((current-width
-                 ;; Actually, one might want the width of the
-                 ;; proof-response-buffer instead. Never mind.
-                 (max 20 (window-width
-                          (get-buffer-window proof-goals-buffer t)))))
-
-            (if (equal current-width isar-shell-current-line-width) ()
-              (setq isar-shell-current-line-width current-width)
-              (set-buffer proof-shell-buffer)
-              (setq ans (format "pretty_setmargin %d;"
-                                (- current-width 4)))))))
-    ans))
-
-;;
-;; Shell mode command adjusting
-;;
-
-(defsubst isar-string-wrapping (string)
-  (concat
-   "\""
-   (replace-regexp-in-string
-    "[\000-\037\"\\\\]"
-    (lambda (str) (format "\\\\%03d" (string-to-char str)))
-    string)
-   "\""))
-
-(defsubst isar-positions-of (filename start end)
-  (let ((line (line-number-at-pos start)))
-    (format "(\"file\"=%s, \"line\"=\"%d\") "
-            (isar-string-wrapping filename) ; cache this?
-            line)))
-
-(defcustom isar-wrap-commands-singly t
-  "Non-nil to use command wrapping around commands sent to Isabelle.
-This slows down interactive processing slightly."
-  :type 'boolean
-  :group 'isabelle)
-
-(defun isar-command-wrapping (filename start end string)
-  "A value for `proof-script-preprocess'."
-  (if isar-wrap-commands-singly
-      (list "Isabelle.command "
-           (isar-positions-of filename start end)
-           (isar-string-wrapping string))
-    (list (replace-regexp-in-string "\n" "\\\\<^newline>" string))))
-
-(defun isar-preprocessing ()
-  "Insert sync markers and other hacks.
-Uses variables `string' and `scriptspan' passed by dynamic scoping."
-  (with-no-warnings  ; dynamic scoping of string, scriptspan
-    (if (proof-string-match isabelle-verbatim-regexp string)
-       (setq string (match-string 1 string))
-      (unless (string-match ";[ \t]*\\'" string)
-       (setq string (concat string ";")))
-      (setq string (concat
-                   "\\<^sync>; "
-                   (isar-shell-adjust-line-width)
-                   string
-                   " \\<^sync>;")))))
-
-;;
-;;   Configuring proof output buffer
-;;
-
-(defun isar-mode-config ()
-  (isar-mode-config-set-variables)
-  (isar-init-syntax-table)
-  (setq proof-script-font-lock-keywords isar-font-lock-keywords-1)
-  (set (make-local-variable 'comment-quote-nested) nil) ;; can cope with 
nested comments
-  (set (make-local-variable 'outline-regexp) isar-outline-regexp)
-  (set (make-local-variable 'outline-heading-end-regexp) 
-       isar-outline-heading-end-regexp)
-  (set (make-local-variable 'outline-heading-alist)
-       isar-outline-heading-alist)
-  (set (make-local-variable 'blink-matching-paren-dont-ignore-comments) t)
-  (add-hook 'proof-shell-insert-hook 'isar-preprocessing)
-  (proof-config-done))
-
-(defun isar-shell-mode-config ()
-  "Configure Proof General proof shell for Isabelle/Isar."
-  (isar-init-output-syntax-table)
-  (isar-shell-mode-config-set-variables)
-  (set (make-local-variable 'font-lock-extra-managed-props)
-       '(invisible))
-  (setq proof-shell-font-lock-keywords
-       isar-shell-font-lock-keywords)
-  (proof-shell-config-done))
-
-(defun isar-response-mode-config ()
-  (isar-init-output-syntax-table)
-  (setq proof-response-font-lock-keywords
-       (append proof-response-font-lock-keywords
-               isar-output-font-lock-keywords-1))
-  (setq font-lock-multiline t)
-  (make-local-variable 'jit-lock-chunk-size)
-  (setq jit-lock-chunk-size 2000)
-  (proof-response-config-done))
-
-(defun isar-goals-mode-config ()
-  (setq pg-goals-change-goal "prefer %s")
-  (setq pg-goals-error-regexp proof-shell-error-regexp)
-  (isar-init-output-syntax-table)
-  (setq proof-goals-font-lock-keywords
-       (append proof-goals-font-lock-keywords
-               isar-goals-font-lock-keywords))
-  (setq font-lock-multiline t)
-  (make-local-variable 'jit-lock-chunk-size)
-  (setq jit-lock-chunk-size 2000)
-  (proof-goals-config-done))
-
-(provide 'isar)
-
-;;; isar.el ends here
diff --git a/isar/isartags b/isar/isartags
deleted file mode 100755
index 0d65f8e644..0000000000
--- a/isar/isartags
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/usr/bin/perl
-#
-# Or perhaps: /usr/local/bin/perl
-#
-# FIXME: this code is just borrowed from legotags program,
-#        it isn't yet working!   Please send us fixes.
-#
-# $Id$
-#
-undef $/;
-
-if($#ARGV<$[) {die "No Files\n";}
-open(tagfile,">TAGS") || die "Couldn't open TAGS: $!\n";
-
-while(<>)      
-{ 
-  print "Tagging $ARGV\n";
-  $a=$_;
-  $cp=1;
-  $lp=1;
-  $tagstring="";
-
-  while(1) 
-  { 
-
-#   ---- Get the next statement starting on a newline ---- 
-
-    if($a=~/^[ \t\n]*\(\*/)
-    { while($a=~/^\s*\(\*/) 
-      { $d=1; $a=$'; $cp+=length $&; $lp+=(($wombat=$&)=~tr/\n/\n/);
-        while($d>0 && $a=~/\(\*|\*\)/)
-        { $a=$'; $cp+=2+length $`; $lp+=(($wombat=$`)=~tr/\n/\n/);
-          if($& eq "(*") {$d++} else {$d--};
-        }
-        if($d!=0) {die "Unbalanced Comment?";}
-      }
-    }
-
-    if($cp>1 && $a=~/.*\n/) {$a=$'; $cp+=length $&; $lp++;}
-    while($a=~/^\n/) {$cp++;$lp++;$a=$'}
-
-    if($a=~/^[^;]*;/) 
-    { $stmt=$&; 
-      $newa=$'; 
-      $newcp=$cp+length $&; 
-      $newlp=$lp+(($wombat=$&)=~tr/\n/\n/); }
-    else { last;}
-
-# ---- The above embarrasses itself if there are semicolons inside comments or
-# ---- inside commands. Could do better.
-
-#  print "----- (",$lp,",",$cp,")\n", $stmt, "\n";
-
-    if($stmt=~/^([ \t]*\$?theory\s*([\w\']+))\s*:/)
-       { $tagstring.=$1."\177".$2."\001".$lp.",".$cp."\n"; }
-
-    elsif($stmt=~/^([ \t]*\$?\[\s*[\w\']+)/)
-       { do adddecs($stmt,$1) }
-
-    elsif($stmt=~/^([ \t]*Inductive\s*\[\s*[\w\']+)/)
-       { do adddecs($stmt,$1) }
-
-#   ---- Maybe do something smart with discharge as well?
-
-    $cp=$newcp; $lp=$newlp; $a=$newa;
-  }  
-  print tagfile "\f\n".$ARGV.",".(length $tagstring)."\n".$tagstring;
-}
-close tagfile;
-
-
-sub adddecs {
-  $wk=$_[0];
-  $tag=$_[1];
-  while($wk=~/\[\s*([\w\']+)/)
-  { $tagstring.=$tag."\177".$1."\001".$lp.",".$cp."\n"; $wk=$';
-    while($wk=~/^\s*,\s*([\w\']+)/)
-    { $tagstring.=$tag."\177".$1."\001".$lp.",".$cp."\n"; $wk=$'; }
-    $d=1;
-    while($d>0 && $wk=~/\[|\]/)
-    { $wk=$'; if($& eq "[") {$d++} else {$d--};
-    }
-  }
-  0;
-}
-
diff --git a/lego/BUGS b/lego/BUGS
deleted file mode 100644
index bfe3975298..0000000000
--- a/lego/BUGS
+++ /dev/null
@@ -1,53 +0,0 @@
--*- mode:outline -*-
-
-* LEGO Proof General Bugs
-
-See also ../BUGS for generic bugs.
-
-
-** PBP doesn't work on FSF, reason mentioned in generic bugs.
-
-** [FSF specific] `proof-zap-commas-region' does not work for Emacs
-  
-  On lego/example.l . On *initially* fontifying the buffer,
-  commas are not zapped [unfontified]. However, when entering text,
-  commata are zapped correctly. Workaround: don't stare too much at commata
-
-** If LEGO attempts to write a (object) file in a non-writable directory
-
-  It forgets the protocol mechanism on how to interact with 
-  Proof General and gets stuck. Workaround: Directly enter "Configure
-  AnnotateOn" in the Proof Shell to recover.
-
-** After a `Discharge', retraction ought to only be possible back 
-
- to the first declaration/definition which is discharged. However,
- LEGO Proof General does not know that Discharge has such a non-local
- effect.  Workaround: retract back to the first declaration/definition
- which is discharged.
-
-** A thorny issue is local definitions in a proof state. 
-
- LEGO cannot undo them explicitly. Workaround: retract back to a
- command before a definition.
-
-** Normalisation commands such as `Dnf', `Hnf' `Normal' cannot be undone
-
- in a proof state by Proof General. Workaround: retract back to the
- start of the proof.
-
-** After LEGO has issued a `*** QED ***' you may undo steps in the proof
-
- as long as you don't issue a `Save' command or start a new proof.
- LEGO Proof General assumes that all proofs are terminated with a
- proper `Save' command. Workaround: Always issue a `Save' command after
- completing a proof. If you forget one, you should retract to a point
- before the offending proof development.
-
-** legotags doesn't find all declarations. 
-
- It cannot handle lists e.g., with [x,y:nat]; it only tags x but not y. 
- [The same problem exists for coqtags] 
- Workaround: don't rely too much on the etags mechanism.
-
-
diff --git a/lego/README b/lego/README
deleted file mode 100644
index ee92ec219f..0000000000
--- a/lego/README
+++ /dev/null
@@ -1,37 +0,0 @@
-LEGO Proof General
-
-Written by Thomas Kleymann and  Dilip Sequeira.
-Later maintainance by David Aspinall and Paul Callaghan.
-
-Status:                *unsupported* (but tell us about problems)
-Maintainer:    Paul Callaghan / David Aspinall
-LEGO version:  1.3.1
-LEGO homepage: http://www.lfcs.informatics.ed.ac.uk/lego
-
-========================================
-
-LEGO Proof General has full support for multiple file scripting, and
-experimental support for proof by pointing.
-
-There is support for X Symbol, but not using a proper token language.
-
-There is a tags program, legotags.
-
-========================================
-
-Installation notes:
-
-Install legotags in a standard place or add <proofgeneral-home>/lego 
-to your PATH.
-NB: You may need to change the path to perl at the top of the file.
-
-Generate a TAGS file for the Lego library by running
-       legotags `find . -name \*.l -print`
-in the root directory of the library.
-
-
-
-========================================
-
-$Id$
-
diff --git a/lego/example.l b/lego/example.l
deleted file mode 100644
index 535d571283..0000000000
--- a/lego/example.l
+++ /dev/null
@@ -1,15 +0,0 @@
-(*
-    Example proof script for Lego Proof General.
- 
-    $Id$
-*)
-
-Module example Import lib_logic;
-
-Goal {A,B:Prop}(A /\ B) -> (B /\ A);
-intros;
-Refine H;
-intros;
-andI;
-Immed;
-Save and_comms;
diff --git a/lego/example2.l b/lego/example2.l
deleted file mode 100644
index 37d1e56387..0000000000
--- a/lego/example2.l
+++ /dev/null
@@ -1 +0,0 @@
-Module example2 Import "readonly/readonly";
\ No newline at end of file
diff --git a/lego/lego-syntax.el b/lego/lego-syntax.el
deleted file mode 100644
index 1cca4cf281..0000000000
--- a/lego/lego-syntax.el
+++ /dev/null
@@ -1,131 +0,0 @@
-;;; lego-syntax.el --- Syntax of LEGO
-
-;; This file is part of Proof General.
-
-;; Portions © Copyright 1994-2012  David Aspinall and University of Edinburgh
-;; Portions © Copyright 2003, 2012, 2014  Free Software Foundation, Inc.
-;; Portions © Copyright 2001-2017  Pierre Courtieu
-;; Portions © Copyright 2010, 2016  Erik Martin-Dorel
-;; Portions © Copyright 2011-2013, 2016-2017  Hendrik Tews
-;; Portions © Copyright 2015-2017  Clément Pit-Claudel
-
-;; Author: Thomas Kleymann and Dilip Sequeira
-;; Maintainer: Paul Callaghan <P.C.Callaghan@durham.ac.uk>
-
-;; License:     GPL (GNU GENERAL PUBLIC LICENSE)
-
-;;; Commentary:
-;;
-
-;;; Code:
-
-(require 'proof-syntax)
-
-;; ----- keywords for font-lock.
-
-(defconst lego-keywords-goal '("$?Goal"))
-
-(defconst lego-keywords-save '("$?Save" "SaveFrozen" "SaveUnfrozen"))
-
-(defconst lego-commands
-  (append lego-keywords-goal lego-keywords-save
-         '("allE" "allI" "andE" "andI" "Assumption" "Claim"
-           "Cut" "Discharge" "DischargeKeep"
-           "echo" "exE" "exI" "Expand" "ExpAll"
-           "ExportState" "Equiv" "For" "Freeze" "Hnf" "Immed"
-           "impE" "impI" "Induction" "Inductive"
-           "Invert" "Init" "intros" "Intros" "Module" "Next"
-           "Normal" "notE" "notI" "orE" "orIL" "orIR" "qnify" "Qnify"
-           "Qrepl" "Record" "Refine" "Repeat" "Try" "Unfreeze"))
-  "Subset of LEGO keywords and tacticals which are terminated by a \?;")
-
-(defconst lego-keywords
-  (append lego-commands
-         '("Constructors" "Double" "ElimOver" "Fields" "Import" "Inversion"
-           "NoReductions" "Parameters" "Relation" "Theorems")))
-
-(defconst lego-tacticals '("Then" "Else" "Try" "Repeat" "For"))
-
-;; ----- regular expressions for font-lock
-(defconst lego-error-regexp "^\\(cannot assume\\|Error\\|Lego parser\\)"
-  "A regular expression indicating that the LEGO process has identified an 
error.")
-
-(defvar lego-id proof-id)
-
-(defvar lego-ids (concat lego-id "\\(\\s *,\\s *" lego-id "\\)*")
-  "*For font-lock, we treat \",\" separated identifiers as one identifier
-  and refontify commata using \\{lego-fixup-change}.")
-
-(defconst lego-arg-list-regexp "\\s *\\(\\[[^]]+\\]\\s *\\)*"
-  "Regular expression maching a list of arguments.")
-
-(defun lego-decl-defn-regexp (char)
-    (concat "\\[\\s *\\(" lego-ids "\\)" lego-arg-list-regexp char))
-; Examples
-;              ^        ^^^^        ^^^^^^^^^^^^^^^^^^^^^^^  ^^^^
-;              [        sort                                 =
-;              [        sort        [n:nat]                  =
-;              [        sort        [abbrev=...][n:nat]      =
-
-(defconst lego-definiendum-alternative-regexp
-  (concat "\\(" lego-id "\\)" lego-arg-list-regexp "\\s * ==")
-  "Regular expression where the first match identifies the definiendum.")
-
-(defvar lego-font-lock-terms
-  (list
-
-   ; lambda binders
-     (list (lego-decl-defn-regexp "[:|?]") 1
-          'proof-declaration-name-face)
-
-     ; let binders
-     (list lego-definiendum-alternative-regexp 1 'font-lock-function-name-face)
-     (list (lego-decl-defn-regexp "=") 1 'font-lock-function-name-face)
-
-     ; Pi and Sigma binders
-     (list (concat "[{<]\\s *\\(" lego-ids "\\)") 1
-          'proof-declaration-name-face)
-
-     ;; Kinds
-     (cons (concat "\\<Prop\\>\\|\\<Type\\s *\\(("
-                  lego-id ")\\)?") 'font-lock-type-face)
-
-     ;; Special hacks!!
-     (cons "Discharge.." 'font-lock-keyword-face)
-     (cons "\\*\\*\\* QED \\*\\*\\*" 'font-lock-keyword-face))
-  "*Font-lock table for LEGO terms (displayed in output buffers).")
-
-;; Instead of "[^:]+", it may be better to use "lego-id". Furthermore,
-;; it might be safer to append "\\s-*:".
-(defconst lego-goal-with-hole-regexp
-  (concat "\\(" (proof-ids-to-regexp lego-keywords-goal) 
"\\)\\s-+\\([^(){},:]+\\)")
-  "Regular expression which matches an entry in `lego-keywords-goal'
-  and the name of the goal.")
-
-(defconst lego-save-with-hole-regexp
-  (concat "\\(" (proof-ids-to-regexp lego-keywords-save) "\\)\\s-+\\([^;]+\\)")
-  "Regular expression which matches an entry in
-  `lego-keywords-save' and the name of the goal.")
-
-(defvar lego-font-lock-keywords-1
-   (append
-    lego-font-lock-terms
-    (list
-     (cons (proof-ids-to-regexp lego-keywords) 'font-lock-keyword-face)
-     (cons (proof-ids-to-regexp lego-tacticals) 'proof-tacticals-name-face)
-     (list lego-goal-with-hole-regexp 2 'font-lock-function-name-face)
-     (list lego-save-with-hole-regexp 2 'font-lock-function-name-face)
-     ;; Remove spurious variable and function faces on commas.
-     '(proof-zap-commas))))
-
-(defun lego-init-syntax-table ()
-  "Set appropriate values for syntax table in current buffer."
-
-  (modify-syntax-entry ?_ "_")
-  (modify-syntax-entry ?\' "_")
-  (modify-syntax-entry ?\| ".")
-  (modify-syntax-entry ?\* ". 23")
-  (modify-syntax-entry ?\( "()1")
-  (modify-syntax-entry ?\) ")(4"))
-
-(provide 'lego-syntax)
diff --git a/lego/lego.el b/lego/lego.el
deleted file mode 100644
index 248e9d0991..0000000000
--- a/lego/lego.el
+++ /dev/null
@@ -1,439 +0,0 @@
-;;; lego.el --- Major mode for LEGO proof assistants
-
-;; This file is part of Proof General.
-
-;; Portions © Copyright 1994-2012  David Aspinall and University of Edinburgh
-;; Portions © Copyright 2003-2018  Free Software Foundation, Inc.
-;; Portions © Copyright 2001-2017  Pierre Courtieu
-;; Portions © Copyright 2010, 2016  Erik Martin-Dorel
-;; Portions © Copyright 2011-2013, 2016-2017  Hendrik Tews
-;; Portions © Copyright 2015-2017  Clément Pit-Claudel
-
-;; Author:      Thomas Kleymann and Dilip Sequeira
-;; Maintainer: Paul Callaghan <P.C.Callaghan@durham.ac.uk>
-
-;; License:     GPL (GNU GENERAL PUBLIC LICENSE)
-
-;;; Commentary:
-;;
-
-;;; Code:
-
-(require 'cl-lib)                       ;cl-member-if
-(require 'proof)
-(require 'lego-syntax)
-(eval-when-compile
-  (require 'outline))
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; User Configuration ;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-;; I believe this is standard for Linux under RedHat -tms
-(defcustom lego-tags "/usr/lib/lego/lib_Type/"
-  "*The directory of the TAGS table for the LEGO library"
-  :type 'file
-  :group 'lego)
-
-(defcustom lego-test-all-name "test_all"
-  "*The name of the LEGO module which inherits all other modules of the
-  library."
-  :type 'string
-  :group 'lego)
-
-(defpgdefault help-menu-entries
-  '(["LEGO Reference Card" (browse-url lego-www-refcard) t]
-    ["LEGO library (WWW)" (browse-url lego-library-www-page)  t]))
-
-(defpgdefault menu-entries
-  '(["intros" lego-intros t]
-    ["Intros" lego-Intros t]
-    ["Refine" lego-Refine t]))
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; Configuration of Generic Proof Package ;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Users should not need to change this.
-
-(defvar lego-shell-handle-output
-  (lambda (cmd string) 
-    (when (proof-string-match "^Module" cmd)
-      ;; prevent output and just give a minibuffer message
-      (setq proof-shell-last-output-kind 'systemspecific)
-      (message "Imports done!")))
-  "Acknowledge end of processing import declarations.")
-
-(defconst lego-process-config
-  ;; da: I think "Configure AnnotateOn;" is only included here for
-  ;; safety since there is a bug in LEGO which turns it off
-  ;; inadvertently sometimes.
-  "Init XCC; Configure PrettyOn; Configure AnnotateOn;"
-  "Command to initialise the LEGO process.
-
-Initialises empty context and prepares XCC theory.
-Enables pretty printing.
-Activates extended printing routines required for Proof General.")
-
-(defconst lego-pretty-set-width "Configure PrettyWidth %s; "
-  "Command to adjust the linewidth for pretty printing of the LEGO
-  process.")
-
-(defconst lego-interrupt-regexp "Interrupt.."
-  "Regexp corresponding to an interrupt")
-
-;; ----- web documentation
-
-(defcustom lego-www-home-page "http://www.dcs.ed.ac.uk/home/lego/";
-  "Lego home page URL."
-  :type 'string
-  :group 'lego)
-
-(defcustom lego-www-latest-release
-  "http://www.dcs.ed.ac.uk/home/lego/html/release-1.3.1/";
-  "The WWW address for the latest LEGO release."
-  :type 'string
-  :group 'lego)
-
-(defcustom lego-www-refcard
-  (concat lego-www-latest-release "refcard.ps.gz")
-  "URL for the Lego reference card."
-  :type 'string
-  :group 'lego)
-
-(defcustom lego-library-www-page
-  (concat lego-www-latest-release "library/library.html")
-  "The HTML documentation of the LEGO library."
-  :type 'string
-  :group 'lego)
-
-
-;; ----- lego-shell configuration options
-
-(defvar lego-prog-name "lego"
-  "*Name of program to run as lego.")
-
-(defvar lego-shell-cd "Cd \"%s\";"
-  "*Command of the inferior process to change the directory.")
-
-(defvar lego-shell-proof-completed-regexp "\\*\\*\\* QED \\*\\*\\*"
-  "*Regular expression indicating that the proof has been completed.")
-
-(defvar lego-save-command-regexp
-  (concat "^" (proof-ids-to-regexp lego-keywords-save)))
-(defvar lego-goal-command-regexp
-  (concat "^" (proof-ids-to-regexp lego-keywords-goal)))
-
-(defvar lego-kill-goal-command "KillRef;")
-(defvar lego-forget-id-command "Forget %s;")
-
-(defvar lego-undoable-commands-regexp
-  (proof-ids-to-regexp '("Dnf" "Refine" "Intros" "intros" "Next" "Normal"
-  "Qrepl" "Claim" "For" "Repeat" "Succeed" "Fail" "Try" "Assumption"
-  "UTac" "Qnify" "qnify" "andE" "andI" "exE" "exI" "orIL" "orIR" "orE" "ImpI"
-  "impE" "notI" "notE" "allI" "allE" "Expand" "Induction" "Immed"
-  "Invert")) "Undoable list")
-
-;; ----- outline
-
-(defvar lego-goal-regexp "\\?\\([0-9]+\\)")
-
-(defvar lego-outline-regexp
-  (concat "[[*]\\|"
-         (proof-ids-to-regexp
-          '("Discharge" "DischargeKeep" "Freeze" "$?Goal" "Module" "Record" 
"Inductive"
-     "Unfreeze"))))
-
-(defvar lego-outline-heading-end-regexp ";\\|\\*)")
-
-(defvar lego-shell-outline-regexp lego-goal-regexp)
-(defvar lego-shell-outline-heading-end-regexp lego-goal-regexp)
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;   Derived modes - they're here 'cos they define keymaps 'n stuff ;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(define-derived-mode lego-shell-mode proof-shell-mode
-   "lego-shell"
-     "Major mode for LEGO proof scripts.
-
-\\{lego-mode-map}"
-   (lego-shell-mode-config))
-
-(define-derived-mode lego-mode proof-mode
-  "lego" nil
-  (lego-mode-config))
-
-(define-derived-mode lego-response-mode proof-response-mode
-  "LEGOResp" nil
-  (setq proof-response-font-lock-keywords lego-font-lock-terms)
-  (lego-init-syntax-table)
-  (proof-response-config-done))
-
-(define-derived-mode lego-goals-mode proof-goals-mode
-  "LEGOGoals" "LEGO Proof State"
-  (lego-goals-mode-config))
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;   Code that's lego specific                                      ;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-;; needs to handle Normal as well
-;; it should ignore Normal TReg Normal VReg and (Normal ...)
-(defun lego-count-undos (span)
-  "This is how to work out what the undo commands are.
-Given is the first SPAN which needs to be undone."
-  (let ((ct 0) str i)
-    (while span
-      (setq str (span-property span 'cmd))
-      (cond ((eq (span-property span 'type) 'vanilla)
-            (if (or (proof-string-match lego-undoable-commands-regexp str)
-                    (and (proof-string-match "Equiv" str)
-                         (not (proof-string-match "Equiv\\s +[TV]Reg" str))))
-                (setq ct (+ 1 ct))))
-           ((eq (span-property span 'type) 'pbp)
-            (setq i 0)
-            (while (< i (length str))
-              (if (= (aref str i) ?\;) (setq ct (+ 1 ct)))
-              (setq i (+ 1 i)))))
-      (setq span (next-span span 'type)))
-    (list (concat "Undo " (int-to-string ct) ";"))))
-
-(defun lego-goal-command-p (span)
-  "Decide whether argument is a goal or not"
-  (proof-string-match lego-goal-command-regexp
-                     (or (span-property span 'cmd) "")))
-
-(defun lego-find-and-forget (span)
-  (let (str ans)
-    (while (and span (not ans))
-      (setq str (span-property span 'cmd))
-
-      (cond
-
-       ((eq (span-property span 'type) 'comment))
-
-       ((eq (span-property span 'type) 'proverproc))
-
-       ((eq (span-property span 'type) 'goalsave)
-       (unless (eq (span-property span 'name) proof-unnamed-theorem-name)
-         (setq ans (format lego-forget-id-command (span-property span 
'name)))))
-       ;; alternative definitions
-       ((proof-string-match lego-definiendum-alternative-regexp str)
-       (setq ans (format lego-forget-id-command (match-string 1 str))))
-       ;; declarations
-       ((proof-string-match (concat "\\`\\$?" (lego-decl-defn-regexp "[:|=]")) 
str)
-       (let ((ids (match-string 1 str))) ; returns "a,b"
-         (proof-string-match proof-id ids)     ; matches "a"
-         (setq ans (format lego-forget-id-command (match-string 1 ids)))))
-
-       ((proof-string-match 
"\\`\\(Inductive\\|\\Record\\)\\s-*\\[\\s-*\\w+\\s-*:[^;]+\\`Parameters\\s-*\\[\\s-*\\(\\w+\\)\\s-*:"
 str)
-       (setq ans (format lego-forget-id-command (match-string 2 str))))
-
-       ((proof-string-match
-        "\\`\\(Inductive\\|Record\\)\\s-*\\[\\s-*\\(\\w+\\)\\s-*:" str)
-       (setq ans
-             (format lego-forget-id-command (match-string 2 str))))
-
-       ((proof-string-match "\\`\\s-*Module\\s-+\\(\\S-+\\)\\W" str)
-       (setq ans (format "ForgetMark %s;" (match-string 1 str)))))
-      ;; Carry on searching forward for something to forget
-      ;; (The first thing to be forget will forget everything following)
-      (setq span (next-span span 'type)))
-    (when ans (list ans)))); was (or ans proof-no-command)
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;   Other stuff which is required to customise script management   ;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(defun lego-goal-hyp ()
-  (cond
-   ((looking-at lego-goal-regexp)
-    (cons 'goal (match-string 1)))
-   ((looking-at proof-shell-assumption-regexp)
-    (cons 'hyp (match-string 1)))
-   (t nil)))
-
-
-(defun lego-state-preserving-p (cmd)
-  (not (proof-string-match lego-undoable-commands-regexp cmd)))
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;   Commands specific to lego                                      ;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(proof-defshortcut lego-Intros "Intros "  [(control I)])
-(proof-defshortcut lego-intros "intros "  [(control i)])
-(proof-defshortcut lego-Refine "Refine "  [(control r)])
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;   Lego shell startup and exit hooks                              ;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(defvar lego-shell-current-line-width nil
-  "Current line width of the LEGO process's pretty printing module.
-  Its value will be updated whenever the corresponding screen gets
-  selected.")
-
-;; The line width needs to be adjusted if the LEGO process is
-;; running and is out of sync with the screen width
-
-(defun lego-shell-adjust-line-width ()
-  "Use LEGO's pretty printing facilities to adjust output line width.
-Checks the width in the `proof-goals-buffer'"
-  (and (proof-shell-live-buffer)
-       (proof-with-current-buffer-if-exists proof-goals-buffer
-        (let ((current-width
-               ;; Actually, one might sometimes
-               ;; want to get the width of the proof-response-buffer
-               ;; instead. Never mind.
-               (window-width (get-buffer-window proof-goals-buffer t))))
-          (if (equal current-width lego-shell-current-line-width) ()
-            ; else
-            (setq lego-shell-current-line-width current-width)
-            (set-buffer proof-shell-buffer)
-            (insert (format lego-pretty-set-width (- current-width 1)))
-            )))))
-
-(defun lego-mode-config ()
-
-  (setq proof-terminal-string ";")
-  (setq proof-script-comment-start "(*")
-  (setq proof-script-comment-end "*)")
-
-  (setq proof-assistant-home-page lego-www-home-page)
-
-  (setq proof-showproof-command "Prf;"
-       proof-goal-command "Goal %s;"
-       proof-save-command "Save %s;"
-       proof-context-command "Ctxt;"
-       proof-info-command "Help;")
-
-  (setq proof-prog-name lego-prog-name)
-
-  (setq proof-goal-command-p 'lego-goal-command-p
-       proof-completed-proof-behaviour 'closeany ; new in 3.0
-       proof-count-undos-fn 'lego-count-undos
-       proof-find-and-forget-fn 'lego-find-and-forget
-       pg-topterm-goalhyplit-fn 'lego-goal-hyp
-       proof-state-preserving-p 'lego-state-preserving-p)
-
-  (setq        proof-save-command-regexp lego-save-command-regexp
-       proof-goal-command-regexp lego-goal-command-regexp
-       proof-save-with-hole-regexp lego-save-with-hole-regexp
-       proof-goal-with-hole-regexp lego-goal-with-hole-regexp
-       proof-kill-goal-command lego-kill-goal-command
-       proof-indent-any-regexp
-       (proof-regexp-alt (proof-ids-to-regexp lego-commands) "\\s(" "\\s)"))
-
-  (lego-init-syntax-table)
-
-  ;; da: I've moved these out of proof-config-done in proof-script.el
-  (setq pbp-goal-command "Pbp %s;")
-  (setq pbp-hyp-command "PbpHyp %s;")
-
-;; font-lock
-
-  (set proof-script-font-lock-keywords lego-font-lock-keywords-1)
-
-  (proof-config-done)
-
-;; outline
-
-  (make-local-variable 'outline-regexp)
-  (setq outline-regexp lego-outline-regexp)
-
-  (make-local-variable 'outline-heading-end-regexp)
-  (setq outline-heading-end-regexp lego-outline-heading-end-regexp)
-
-;; tags
-  (cond ((boundp 'tags-table-list) ;; GNU Emacs
-        (make-local-variable 'tags-table-list)
-        (setq tags-table-list (cons lego-tags tags-table-list))))
-
-  (and (boundp 'tag-table-alist)  ;; XEmacs
-       (setq tag-table-alist
-            (append '(("\\.l$" . lego-tags)
-                      ("lego"  . lego-tags))
-                    tag-table-alist)))
-
-  (set (make-local-variable 'blink-matching-paren-dont-ignore-comments) t)
-
-;; hooks and callbacks
-
-  (add-hook 'proof-shell-insert-hook 'lego-shell-adjust-line-width))
-
-(defun lego-equal-module-filename (module filename)
-  "Returns `t' if MODULE is equal to the FILENAME and `nil' otherwise.
-The directory and extension is stripped of FILENAME before the test."
-  (equal module
-        (file-name-sans-extension (file-name-nondirectory filename))))
-
-(defun lego-shell-compute-new-files-list ()
-  "Function to update `proof-included-files-list'.
-Value for `proof-shell-compute-new-files-list', which see.
-
-For LEGO, we assume that module identifiers coincide with file names."
-  (let ((module (match-string 1)))
-    (cdr (cl-member-if
-         (lambda (filename) (lego-equal-module-filename module filename))
-         proof-included-files-list))))
-
-(defun lego-shell-mode-config ()
-  (setq proof-shell-cd-cmd lego-shell-cd
-       proof-shell-proof-completed-regexp lego-shell-proof-completed-regexp
-       proof-shell-error-regexp lego-error-regexp
-       proof-shell-interrupt-regexp lego-interrupt-regexp
-       proof-shell-assumption-regexp lego-id
-       pg-subterm-first-special-char ?\360
-       pg-subterm-start-char ?\372
-       pg-subterm-sep-char ?\373
-       pg-subterm-end-char ?\374
-       pg-topterm-regexp "\375"
-       proof-shell-eager-annotation-start "\376"
-       proof-shell-eager-annotation-start-length 1
-       proof-shell-eager-annotation-end "\377"
-       proof-shell-annotated-prompt-regexp "Lego> \371"
-       proof-shell-result-start "\372 Pbp result \373"
-       proof-shell-result-end "\372 End Pbp result \373"
-       proof-shell-start-goals-regexp "\372 Start of Goals \373"
-       proof-shell-end-goals-regexp "\372 End of Goals \373"
-       proof-shell-pre-sync-init-cmd "Configure AnnotateOn;"
-       proof-shell-init-cmd lego-process-config
-       proof-shell-restart-cmd lego-process-config
-       pg-subterm-anns-use-stack nil
-       proof-shell-handle-output-system-specific lego-shell-handle-output
-       lego-shell-current-line-width nil
-
-       ;; LEGO uses Unicode escape prefix: liable to create problems
-       proof-shell-unicode nil
-
-       proof-shell-process-file
-       (cons "Creating mark \"\\(.*\\)\" \\[\\(.*\\)\\]"
-         (lambda () (let ((match (match-string 2)))
-                      (if (equal match "") match
-                        (concat (file-name-sans-extension match) ".l")))))
-
-       proof-shell-retract-files-regexp
-       "forgot back through Mark \"\\(.*\\)\""
-       
-       proof-shell-font-lock-keywords lego-font-lock-keywords-1
-
-       proof-shell-compute-new-files-list
-       'lego-shell-compute-new-files-list)
-
-  (lego-init-syntax-table)
-
-  (proof-shell-config-done))
-
-(defun lego-goals-mode-config ()
-  (setq pg-goals-change-goal "Next %s;"
-       pg-goals-error-regexp lego-error-regexp)
-  (setq font-lock-keywords lego-font-lock-terms)
-  (lego-init-syntax-table)
-  (proof-goals-config-done))
-
-
-(provide 'lego)
diff --git a/lego/legotags b/lego/legotags
deleted file mode 100755
index 8243287a20..0000000000
--- a/lego/legotags
+++ /dev/null
@@ -1,91 +0,0 @@
-#!/usr/bin/perl
-#
-# Or perhaps: /usr/local/bin/perl
-#
-# $Id$
-#
-undef $/;
-
-if($#ARGV<$[) {die "No Files\n";}
-open(tagfile,">TAGS") || die "Couldn't open TAGS: $!\n";
-
-while(<>)      
-{ 
-  print "Tagging $ARGV\n";
-  $a=$_;
-  $cp=1;
-  $lp=1;
-  $tagstring="";
-
-  while(1) 
-  { 
-
-#   ---- Get the next statement starting on a newline ---- 
-
-    if($a=~/^[ \t\n]*\(\*/)
-    { while($a=~/^\s*\(\*/) 
-      { $d=1; $a=$'; $cp+=length $&; $lp+=(($wombat=$&)=~tr/\n/\n/);
-        while($d>0 && $a=~/\(\*|\*\)/)
-        { $a=$'; $cp+=2+length $`; $lp+=(($wombat=$`)=~tr/\n/\n/);
-          if($& eq "(*") {$d++} else {$d--};
-        }
-        if($d!=0) {die "Unbalanced Comment?";}
-      }
-    }
-
-    if($cp>1 && $a=~/.*\n/) {$a=$'; $cp+=length $&; $lp++;}
-    while($a=~/^\n/) {$cp++;$lp++;$a=$'}
-
-    if($a=~/^[^;]*;/) 
-    { $stmt=$&; 
-      $newa=$'; 
-      $newcp=$cp+length $&; 
-      $newlp=$lp+(($wombat=$&)=~tr/\n/\n/); }
-    else { last;}
-
-# ---- The above embarrasses itself if there are semicolons inside comments 
-# ---- inside commands. Could do better.
-
-#  print "----- (",$lp,",",$cp,")\n", $stmt, "\n";
-
-    if($stmt=~/^([ \t]*\$?Goal\s*([\w\']+))\s*:/)
-       { $tagstring.=$1."\177".$2."\001".$lp.",".$cp."\n"; }
-
-    elsif($stmt=~/^([ \t]*\$?\[\s*[\w\']+)/)
-       { do adddecs($stmt,$1) }
-
-    elsif($stmt=~/^([ \t]*Inductive\s*\[\s*[\w\']+)/)
-       { do adddecs($stmt,$1) }
-
-# ---- we don't need to tag saves: all goals should be named!
-
-#    elsif($stmt=~/([ \t]*\$?Save\s+([\w\']+))/)
-#       { $tagstring.=$1."\177".$2."\001".$lp.",".$cp."\n"; }
-#
-#    elsif($stmt=~/^([ \t]*\$?SaveUnfrozen\s+([\w\']+))/)
-#       { $tagstring.=$1."\177".$2."\001".$lp.",".$cp."\n"; }
-
-#   ---- Maybe do something smart with discharge as well?
-
-    $cp=$newcp; $lp=$newlp; $a=$newa;
-  }  
-  print tagfile "\f\n".$ARGV.",".(length $tagstring)."\n".$tagstring;
-}
-close tagfile;
-
-
-sub adddecs {
-  $wk=$_[0];
-  $tag=$_[1];
-  while($wk=~/\[\s*([\w\']+)/)
-  { $tagstring.=$tag."\177".$1."\001".$lp.",".$cp."\n"; $wk=$';
-    while($wk=~/^\s*,\s*([\w\']+)/)
-    { $tagstring.=$tag."\177".$1."\001".$lp.",".$cp."\n"; $wk=$'; }
-    $d=1;
-    while($d>0 && $wk=~/\[|\]/)
-    { $wk=$'; if($& eq "[") {$d++} else {$d--};
-    }
-  }
-  0;
-}
-
diff --git a/lego/root2.l b/lego/root2.l
deleted file mode 100644
index 5712b129ce..0000000000
--- a/lego/root2.l
+++ /dev/null
@@ -1,368 +0,0 @@
-(************************************************************************
-   Conor McBride's proof that 2 has no rational root.
-
-   This proof is accepted by LEGO version 1.3.1 with its standard library.
-*************************************************************************)
-
-Make lib_nat; (* loading basic logic, nat, plus, times etc *)
-
-(* note, plus and times are defined by recursion on their first arg *)
-
-
-(************************************************************************
-   Alternative eliminators for nat
-
-   LEGO's induction tactic figures out which induction principle to use
-   by looking at the type of the variable on which we're doing induction.
-   Consequently, we can persuade the tactic to use an alternative induction
-   principle if we alias the type.
-
-   Nat_elim is just the case analysis principle for natural numbers---the
-   same as the induction principle except that there's no inductive hypothesis
-   in the step case. It's intended to be used in combination with...
-
-   ...NAT_elim, which performs no case analysis but says you can have an
-   inductive hypothesis for any smaller value, where y is smaller than
-   suc (plus x y). This is `well-founded induction' for the < relation,
-   but expressed more concretely.
-
-   The effect is very similar to that of `Case' and `Fix' in Coq.
-************************************************************************)
-
-[Nat = nat];
-[NAT = Nat];
-
-(* case analysis: just a weakening of induction *)
-
-Goal Nat_elim : {Phi:nat->Type}
-                {phiz:Phi zero}
-                {phis:{n:Nat}Phi (suc n)}
-                {n:Nat}Phi n;
-intros ___;
-  Expand Nat; Induction n;
-    Immed;
-    intros; Immed;
-Save;
-
-(* suc-plus guarded induction: the usual proof *)
-
-Goal NAT_elim :
-     {Phi:nat->Type}
-     {phi:{n:Nat}
-          {ih:{x,y|Nat}(Eq n (suc (plus x y)))->Phi y}
-          Phi n}
-     {n:NAT}Phi n;
-intros Phi phi n';
-(* claim that we can build the hypothesis collector for each n *)
-Claim {n:nat}{x,y|Nat}(Eq n (suc (plus x y)))->Phi y;
-(* use phi on the claimed collector *)
-Refine phi n' (?+1 n');
-(* now build the collector by one-step induction *)
-  Induction n;
-    Qnify; (* nothing to collect for zero *)
-    intros n nhyp;
-      Induction x; (* case analysis on the slack *)
-        Qnify;
-          Refine phi;  (* if the bound is tight, use phi to         *)
-            Immed;     (* generate the new member of the collection *)
-        Qnify;
-          Refine nhyp; (* otherwise, we've already collected it *)
-            Immed;
-Save;
-
-
-(***************************************************************************
-   Equational laws governing plus and times:
-   some of these are doubtless in the library, but it takes longer to
-   remember their names than to prove them again.
-****************************************************************************)
-
-Goal plusZero : {x:nat}Eq (plus x zero) x;
-Induction x;
-  Refine Eq_refl;
-  intros;
-    Refine Eq_resp suc;
-      Immed;
-Save;
-
-Goal plusSuc : {x,y:nat}Eq (plus x (suc y)) (suc (plus x y));
-Induction x;
-  intros; Refine Eq_refl;
-  intros;
-    Refine Eq_resp suc;
-      Immed;
-Save;
-
-Goal plusAssoc : {x,y,z:nat}Eq (plus (plus x y) z) (plus x (plus y z));
-Induction x;
-  intros; Refine Eq_refl;
-  intros;
-    Refine Eq_resp suc;
-      Immed;
-Save;
-
-Goal plusComm : {x,y:nat}Eq (plus x y) (plus y x);
-Induction y;
-  Refine plusZero;
-  intros y yh x;
-    Refine Eq_trans (plusSuc x y);
-      Refine Eq_resp suc;
-        Immed;
-Save;
-
-Goal plusCommA : {x,y,z:nat}Eq (plus x (plus y z)) (plus y (plus x z));
-intros;
-  Refine Eq_trans ? (plusAssoc ???);
-    Refine Eq_trans (Eq_sym (plusAssoc ???));
-      Refine Eq_resp ([w:nat]plus w z);
-        Refine plusComm;
-Save;
-
-Goal timesZero : {x:nat}Eq (times x zero) zero;
-Induction x;
-  Refine Eq_refl;
-    intros;
-      Immed;
-Save;
-
-Goal timesSuc : {x,y:nat}Eq (times x (suc y)) (plus x (times x y));
-Induction x;
-  intros; Refine Eq_refl;
-  intros x xh y;
-    Equiv Eq (suc (plus y (times x (suc y)))) ?;
-      Equiv Eq ? (suc (plus x (plus y (times x y))));
-        Refine Eq_resp;
-          Qrepl xh y;
-            Refine plusCommA;
-Save;
-
-Goal timesComm : {x,y:nat}Eq (times x y) (times y x);
-Induction y;
-  Refine timesZero;
-  intros y yh x;
-    Refine Eq_trans (timesSuc ??);
-      Refine Eq_resp (plus x);
-        Immed;
-Save;
-
-Goal timesDistL : {x,y,z:nat}Eq (times (plus x y) z)
-                                (plus (times x z) (times y z));
-Induction x;
-  intros; Refine Eq_refl;
-    intros x xh y z;
-      Refine Eq_trans (Eq_resp (plus z) (xh y z));
-        Refine Eq_sym (plusAssoc ???);
-Save;
-
-Goal timesAssoc : {x,y,z:nat}Eq (times (times x y) z) (times x (times y z));
-Induction x;
-  intros; Refine Eq_refl;
-  intros x xh y z;
-    Refine Eq_trans (timesDistL ???);
-      Refine Eq_resp (plus (times y z));
-        Immed;
-Save;
-
-(**********************************************************************
-   Inversion principles for equations governing plus and times:
-   these aren't in the library, at least not in this form.
-***********************************************************************)
-
-[Phi|Type]; (* Inversion principles are polymorphic in any goal *)
-
-Goal plusCancelL : {y,z|nat}{phi:{q':Eq y z}Phi}{x|nat}
-                   {q:Eq (plus x y) (plus x z)}Phi;
-intros ___;
-Induction x;
-  intros;
-    Refine phi q;
-  intros x xh; Qnify;
-    Refine xh;
-      Immed;
-Save;
-
-Goal timesToZero : {a,b|Nat}
-                   {phiL:(Eq a zero)->Phi}
-                   {phiR:(Eq b zero)->Phi}
-                   {tz:Eq (times a b) zero}
-                   Phi;
-Induction a;
-  intros; Refine phiL (Eq_refl ?);
-  intros a;
-    Induction b;
-      intros; Refine phiR (Eq_refl ?);
-      Qnify;
-Save;
-
-Goal timesToNonZero : {x,y|nat}
-                      {phi:{x',y'|nat}(Eq x (suc x'))->(Eq y (suc y'))->Phi}
-                      {z|nat}{q:Eq (times x y) (suc z)}Phi;
-Induction x;
-  Qnify;
-  intros x xh;
-    Induction y;
-      intros __; Qrepl timesZero (suc x); Qnify;
-      intros;
-        [EQR=Eq_refl]; Refine phi Then Immed;
-Save;
-
-(* I actually want plusDivisionL, but plusDivisionR is easier to prove,
-   because here we do induction where times does computation. *)
-Goal plusDivisionR : {b|nat}{a,x,c|Nat}
-                     {phi:{c'|nat}(Eq (times c' (suc x)) c)->
-                                  (Eq a (plus b c'))->Phi}
-                     {q:Eq (times a (suc x)) (plus (times b (suc x)) c)}
-                     Phi;
-Induction b;
-  intros _____; Refine phi;
-    Immed;
-    Refine Eq_refl;
-  intros b bh;
-    Induction a;
-      Qnify;
-      intros a x c phi;
-        Qrepl plusAssoc (suc x) (times b (suc x)) c;
-          Refine plusCancelL;
-            Refine bh;
-              intros c q1 q2; Refine phi q1;
-                Refine Eq_resp ? q2;
-Save;
-
-(* A bit of timesComm gives us the one we really need. *)
-Goal plusDivisionL : {b|nat}{a,x,c|Nat}
-                     {phi:{c'|nat}(Eq (times (suc x) c') c)->
-                                  (Eq a (plus b c'))->Phi}
-                     {q:Eq (times (suc x) a) (plus (times (suc x) b) c)}
-                     Phi;
-intros _____;
-  Qrepl timesComm (suc x) a; Qrepl timesComm (suc x) b;
-    Refine plusDivisionR;
-      intros c'; Qrepl timesComm c' (suc x);
-        Immed;
-Save;
-
-Discharge Phi;
-
-
-(**************************************************************************
-   Definition of primality:
-
-   This choice of definition makes primality easy to exploit
-   (especially as it's presented as an inversion principle), but hard to
-   establish.
-***************************************************************************)
-
-[Prime = [p:nat]
-         {a|NAT}{b,x|Nat}{Phi|Prop}
-         {q:Eq (times p x) (times a b)}
-         {phiL:{a':nat}
-               (Eq a (times p a'))->(Eq x (times a' b))->Phi}
-         {phiR:{b':nat}
-               (Eq b (times p b'))->(Eq x (times a b'))->Phi}
-         Phi
-];
-
-
-(**************************************************************************
-   Proof that 2 is Prime. Nontrivial because of the above definition.
-   Manageable because 1 is the only number between 0 and 2.
-***************************************************************************)
-
-Goal doublePlusGood : {x,y:nat}Eq (times (suc (suc x)) y)
-                                  (plus (times two y) (times x y));
-intros __;
-  Refine Eq_trans ? (Eq_sym (plusAssoc ???));
-    Refine Eq_resp (plus y);
-      Refine Eq_trans ? (Eq_sym (plusAssoc ???));
-        Refine Eq_refl;
-Save;
-
-Goal twoPrime : Prime two;
-Expand Prime;
-  Induction a;
-    Induction n;
-      intros useless b x _;
-        Refine timesToZero Then Expand Nat Then Qnify;
-                            (* Qnify needs to know it's a nat *)
-          intros; Refine phiL;
-            Refine +1 (Eq_sym (timesZero ?));
-            Refine Eq_refl;
-      Induction n;
-        intros useless b x _;
-          Qrepl plusZero b;
-            intros; Refine phiR;
-              Refine +1 Eq_sym q;
-              Refine Eq_sym (plusZero x);
-        intros n nhyp b x _;
-          Qrepl doublePlusGood n b;
-            Refine plusDivisionL;
-              intros c q1 q2; Qrepl q2; intros __;
-                Refine nhyp|one (Eq_refl ?) q1;
-                  intros a' q3 q4; Refine phiL (suc a');
-                    Refine Eq_resp suc;
-                      Refine Eq_trans ? (Eq_sym (plusSuc ??));
-                        Refine Eq_resp ? q3;
-                    Refine Eq_resp (plus b) q4;
-                  intros b' q3 q4; Refine phiR b';
-                    Immed;
-                    Qrepl q3; Qrepl q4;
-                      Refine Eq_sym (doublePlusGood ??);
-Save;
-
-
-(**************************************************************************
-   Now the proof that primes (>=2) have no rational root. It's the
-   classic `minimal counterexample' proof unwound as an induction: we
-   apply the inductive hypothesis to the smaller counterexample we
-   construct.
-***************************************************************************)
-
-[pm2:nat]
-[p=suc (suc pm2)] (* p is at least 2 *)
-[Pp:Prime p];
-
-Goal noRatRoot : {b|NAT}{a|Nat}{q:Eq (times p (times a a)) (times b b)}
-                          and (Eq a zero) (Eq b zero);
-Induction b;
-  Induction n; (* if b is zero, so is a, and the result holds *)
-    intros useless;
-      intros a;
-        Refine timesToZero;
-          Expand Nat; Qnify;
-          Refine timesToZero; Refine ?+1;
-            intros; Refine pair; Immed; Refine Eq_refl;
-    intros b hyp a q; (* otherwise, build a smaller counterexample *)
-      Refine Pp q; (* use primality once *)
-        Refine cut ?+1; (* standard technique for exploiting symmetry *)
-          intros H a' aq1 aq2; Refine H;
-            Immed;
-            Refine Eq_trans aq2;
-              Refine timesComm;
-        intros c bq; Qrepl bq; Qrepl timesAssoc p c c;
-          Refine timesToNonZero ? (Eq_sym bq); (* need c to be nonzero *)
-            intros p' c' dull cq; Qrepl cq; intros q2;
-              Refine Pp (Eq_sym q2); (* use primality twice *)
-                Refine cut ?+1; (* symmetry again *)
-                  intros H a' aq1 aq2; Refine H;
-                    Immed;
-                    Refine Eq_trans aq2;
-                      Refine timesComm;
-                intros d aq; Qrepl aq; Qrepl timesAssoc p d d;
-                  intros q3;
-                    Refine hyp ? (Eq_sym q3); (* now use ind hyp *)
-                      Next +2; Expand NAT Nat; Qnify; (* trivial solution *)
-                      Next +1; (* show induction was properly guarded *)
-                        Refine Eq_trans bq; Expand p; Qrepl cq;
-                          Refine plusComm;
-Save;
-
-Discharge pm2;
-
-(**********************************************************************
-   Putting it all together
-***********************************************************************)
-
-[noRatRootTwo = noRatRoot zero twoPrime
-  : {b|nat}{a|nat}(Eq (times two (times a a)) (times b b))->
-     (Eq a zero /\ Eq b zero)];
-
diff --git a/lib/bufhist.el b/lib/bufhist.el
index 7e96682cf6..d7cce2d4f3 100644
--- a/lib/bufhist.el
+++ b/lib/bufhist.el
@@ -1,9 +1,9 @@
-;; bufhist.el --- keep read-only history of buffer contents for browsing
+;; bufhist.el --- keep read-only history of buffer contents for browsing  -*- 
lexical-binding: t; -*-
 
 ;; This file is part of Proof General.
 
 ;; Portions © Copyright 1994-2012  David Aspinall and University of Edinburgh
-;; Portions © Copyright 2003-2018  Free Software Foundation, Inc.
+;; Portions © Copyright 2003-2021  Free Software Foundation, Inc.
 ;; Portions © Copyright 2001-2017  Pierre Courtieu
 ;; Portions © Copyright 2010, 2016  Erik Martin-Dorel
 ;; Portions © Copyright 2011-2013, 2016-2017  Hendrik Tews
@@ -12,10 +12,10 @@
 ;; Author:     David Aspinall <David.Aspinall@ed.ac.uk>
 ;; Keywords:   tools
 
-;; License:    GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;; This file is distributed under the terms of the GNU General Public
-;; License, Version 2.  Find a copy of the GPL with your version of
+;; License, Version 3 or later.  Find a copy of the GPL with your version of
 ;; GNU Emacs or Texinfo.
 
 ;;; Commentary:
@@ -59,8 +59,7 @@
   :group 'tools)
 
 (defcustom bufhist-ring-size 30
-  "*Default size of buffer history ring."
-  :group 'bufhist
+  "Default size of buffer history ring."
   :type 'integer)
 
 (defvar bufhist-ring nil
@@ -98,10 +97,10 @@
                 (let ((map (make-sparse-keymap)))
                   ;; FIXME: clicking can go wrong here because the
                   ;; current buffer can be something else which has no hist!
-                  (define-key map [mode-line mouse-1] 'bufhist-prev)
-                  (define-key map [mode-line mouse-3] 'bufhist-next)
-                  ;; (define-key map [mode-line control mouse-1] 
'bufhist-first)
-                  ;; (define-key map [mode-line control mouse-3] 'bufhist-last)
+                  (define-key map [mode-line mouse-1] #'bufhist-prev)
+                  (define-key map [mode-line mouse-3] #'bufhist-next)
+                  ;; (define-key map [mode-line control mouse-1] 
#'bufhist-first)
+                  ;; (define-key map [mode-line control mouse-3] 
#'bufhist-last)
                   map))
        'mouse-face 'mode-line-highlight))))
 
@@ -113,15 +112,17 @@
 
 ;;; Minor mode
 
-(defconst bufhist-minor-mode-map
+(define-obsolete-variable-alias
+  'bufhist-minor-mode-map 'bufhist-mode-map "2021")
+(defconst bufhist-mode-map
   (let ((map (make-sparse-keymap)))
-    ;; (define-key map [mouse-2] 'bufhist-popup-menu)
-    (define-key map [(meta left)] 'bufhist-prev)
-    (define-key map [(meta right)] 'bufhist-next)
-    (define-key map [(meta up)] 'bufhist-first)
-    (define-key map [(meta down)] 'bufhist-last)
-    (define-key map [(meta c)] 'bufhist-clear)
-    (define-key map [(meta d)] 'bufhist-delete)
+    ;; (define-key map [mouse-2]   #'bufhist-popup-menu)
+    (define-key map [(meta left)]  #'bufhist-prev)
+    (define-key map [(meta right)] #'bufhist-next)
+    (define-key map [(meta up)]    #'bufhist-first)
+    (define-key map [(meta down)]  #'bufhist-last)
+    (define-key map [(meta c)]     #'bufhist-clear)
+    (define-key map [(meta d)]     #'bufhist-delete)
     map)
   "Keymap for `bufhist-minor-mode'.")
 
@@ -129,15 +130,14 @@
 (define-minor-mode bufhist-mode
   "Minor mode retaining an in-memory history of the buffer contents.
 
-Commands:\\<bufhist-minor-mode-map>
+Commands:\\<bufhist-mode-map>
 \\[bufhist-prev]    bufhist-prev    go back in history
 \\[bufhist-next]    bufhist-next    go forward in history
 \\[bufhist-first]   bufhist-first   go to first item in history
 \\[bufhist-last]    bufhist-last    go to last (current) item in history.
 \\[bufhist-clear]   bufhist-clear   clear history.
 \\[bufhist-delete]  bufhist-clear   delete current item from history."
-  nil "" bufhist-minor-mode-map
-  :group 'bufhist
+  :lighter ""
   (if bufhist-mode
       (bufhist-init)
     (bufhist-exit)))
@@ -335,7 +335,7 @@ If RINGSIZE is omitted or nil, the size defaults to 
‘bufhist-ring-size’."
 
 ;; Restore the latest buffer contents before changes from elsewhere.
 
-(defun bufhist-before-change-function (&rest args)
+(defun bufhist-before-change-function (&rest _)
   "Restore the most recent contents of the buffer before changes."
   (bufhist-switch-to-index 0))
 
diff --git a/lib/holes.el b/lib/holes.el
index 84dcf1f373..80c23c8445 100644
--- a/lib/holes.el
+++ b/lib/holes.el
@@ -3,7 +3,7 @@
 ;; This file is part of Proof General.
 
 ;; Portions © Copyright 1994-2012  David Aspinall and University of Edinburgh
-;; Portions © Copyright 2003-2018  Free Software Foundation, Inc.
+;; Portions © Copyright 2003-2021  Free Software Foundation, Inc.
 ;; Portions © Copyright 2001-2017  Pierre Courtieu
 ;; Portions © Copyright 2010, 2016  Erik Martin-Dorel
 ;; Portions © Copyright 2011-2013, 2016-2017  Hendrik Tews
@@ -19,14 +19,14 @@
 
 ;; This software is free software; you can redistribute it and/or
 ;; modify it under the terms of the GNU General Public
-;; License version 2, as published by the Free Software Foundation.
+;; License version 3 or later, as published by the Free Software Foundation.
 ;;
 ;; This software is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 ;;
-;; See the GNU General Public License version 2 for more details
-;; (enclosed in the file GPL).
+;; See the GNU General Public License for more details
+;; (enclosed in the file COPYING).
 
 ;;; Commentary:
 ;;
@@ -112,9 +112,9 @@ which should be removed when making the text into a hole."
 
 (defvar hole-map
   (let ((map (make-sparse-keymap)))
-    (define-key map [(mouse-1)] 'holes-mouse-set-active-hole)
-    (define-key map [(mouse-3)] 'holes-mouse-destroy-hole)
-    (define-key map [(mouse-2)] 'holes-mouse-forget-hole)
+    (define-key map [(mouse-1)] #'holes-mouse-set-active-hole)
+    (define-key map [(mouse-3)] #'holes-mouse-destroy-hole)
+    (define-key map [(mouse-2)] #'holes-mouse-forget-hole)
     map)
   "Keymap to use on the holes's overlays.
 This keymap is used only when point is on a hole.
@@ -122,14 +122,15 @@ See `holes-mode-map' for the keymap of `holes-mode'.")
 
 (defvar holes-mode-map
   (let ((map (make-sparse-keymap)))
-    (define-key map [(control c) (h)] 'holes-set-make-active-hole)
-    (define-key map [(control c) (control y)] 
'holes-replace-update-active-hole)
+    (define-key map [(control c) (h)] #'holes-set-make-active-hole)
+    (define-key map [(control c) (control y)]
+      #'holes-replace-update-active-hole)
     (define-key map [(control meta down-mouse-1)]
-      'holes-mouse-set-make-active-hole)
+      #'holes-mouse-set-make-active-hole)
     (define-key map [(control meta shift down-mouse-1)]
-      'holes-mouse-replace-active-hole)
+      #'holes-mouse-replace-active-hole)
     (define-key map [(control c) (control j)]
-      'holes-set-point-next-hole-destroy)
+      #'holes-set-point-next-hole-destroy)
     map)
   "Keymap of `holes-mode'.
 
@@ -473,7 +474,7 @@ Sets `holes-active-hole' to the next hole if it exists."
 ;; have nearly the same meaning for me.  So I define this
 ;; track-mouse-selection.
 
-(defalias 'holes-track-mouse-selection 'mouse-drag-track)
+(defalias 'holes-track-mouse-selection #'mouse-drag-track)
 (defsubst holes-track-mouse-clicks ()
   "See `mouse-track-click-count'."
   (+ mouse-selection-click-count 1))
@@ -722,7 +723,7 @@ it mean anyway?)
 
  o Cutting or pasting a hole will not produce new holes, and
 undoing on holes cannot make holes re-appear."
-  nil " Holes" holes-mode-map
+  :lighter " Holes"
   (if holes-mode
       (add-hook 'skeleton-end-hook #'holes-skeleton-end-hook nil t)
     (remove-hook 'skeleton-end-hook #'holes-skeleton-end-hook t)
diff --git a/lib/local-vars-list.el b/lib/local-vars-list.el
index 4d737d73c8..8b5be2a31a 100644
--- a/lib/local-vars-list.el
+++ b/lib/local-vars-list.el
@@ -3,7 +3,7 @@
 ;; This file is part of Proof General.
 
 ;; Portions © Copyright 1994-2012  David Aspinall and University of Edinburgh
-;; Portions © Copyright 2003, 2012, 2014  Free Software Foundation, Inc.
+;; Portions © Copyright 2003-2021  Free Software Foundation, Inc.
 ;; Portions © Copyright 2001-2017  Pierre Courtieu
 ;; Portions © Copyright 2010, 2016  Erik Martin-Dorel
 ;; Portions © Copyright 2011-2013, 2016-2017  Hendrik Tews
@@ -14,14 +14,14 @@
 
 ;; This software is free software; you can redistribute it and/or
 ;; modify it under the terms of the GNU General Public
-;; License version 2, as published by the Free Software Foundation.
+;; License version 3 or later, as published by the Free Software Foundation.
 ;;
 ;; This software is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 ;;
-;; See the GNU General Public License version 2 for more details
-;; (enclosed in the file GPL).
+;; See the GNU General Public License for more details
+;; (enclosed in the file COPYING).
 
 ;;; Commentary:
 ;;
@@ -150,10 +150,10 @@ of the buffer first."
 
 
 
-;;; Local Variables: ***
-;;; fill-column: 85 ***
-;;; indent-tabs-mode: nil ***
-;;; End: ***
+;; Local Variables: ***
+;; fill-column: 85 ***
+;; indent-tabs-mode: nil ***
+;; End: ***
 
 (provide 'local-vars-list)
 ;;; local-vars-list.el ends here
diff --git a/lib/maths-menu.el b/lib/maths-menu.el
index 43592bed41..ab61f8a3a1 100644
--- a/lib/maths-menu.el
+++ b/lib/maths-menu.el
@@ -3,7 +3,7 @@
 ;; This file is part of Proof General.
 
 ;; Portions © Copyright 1994-2012  David Aspinall and University of Edinburgh
-;; Portions © Copyright 2003-2018  Free Software Foundation, Inc.
+;; Portions © Copyright 2003-2021  Free Software Foundation, Inc.
 ;; Portions © Copyright 2001-2017  Pierre Courtieu
 ;; Portions © Copyright 2010, 2016  Erik Martin-Dorel
 ;; Portions © Copyright 2011-2013, 2016-2017  Hendrik Tews
@@ -18,7 +18,7 @@
 
 ;; This file is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
 ;; This file is distributed in the hope that it will be useful,
@@ -55,7 +55,7 @@
 
 ;;; Code:
 
-(defvar maths-menu-filter-predicate (lambda (char) t)
+(defvar maths-menu-filter-predicate (lambda (_char) t)
   "Predicate function used to filter menu elements.")
 
 (defvar maths-menu-tokenise-insert #'insert
@@ -72,9 +72,9 @@
                        (concat "maths-menu-insert-"
                                (replace-regexp-in-string " " "-" (cadr 
elt))))))
            (fset fname
-                 `(lambda ()
-                    (interactive)
-                    (funcall maths-menu-tokenise-insert ,(car elt))))
+                 (lambda ()
+                   (interactive)
+                   (funcall maths-menu-tokenise-insert (car elt))))
            (define-key-after pane-map
              (vector (intern (string (car elt)))) ; convenient unique symbol
              (list 'menu-item
@@ -356,7 +356,7 @@
 Uses window system menus only when they can display multilingual text.
 Otherwise the menu-bar item activates the text-mode menu system.
 This mode is only useful with a font which can display the maths repertoire."
-  nil nil maths-menu-mode-map)
+  :lighter nil)
 
 (provide 'maths-menu)
 ;;; maths-menu.el ends here
diff --git a/lib/pg-dev.el b/lib/pg-dev.el
index 78d79862fd..72202eec30 100644
--- a/lib/pg-dev.el
+++ b/lib/pg-dev.el
@@ -3,7 +3,7 @@
 ;; This file is part of Proof General.
 
 ;; Portions © Copyright 1994-2012  David Aspinall and University of Edinburgh
-;; Portions © Copyright 2003-2018  Free Software Foundation, Inc.
+;; Portions © Copyright 2003-2021  Free Software Foundation, Inc.
 ;; Portions © Copyright 2001-2017  Pierre Courtieu
 ;; Portions © Copyright 2010, 2016  Erik Martin-Dorel
 ;; Portions © Copyright 2011-2013, 2016-2017  Hendrik Tews
@@ -11,7 +11,7 @@
 
 ;; Author:      David Aspinall <David.Aspinall@ed.ac.uk> and others
 
-;; License:     GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
@@ -110,10 +110,6 @@
      proof-maths-menu proof-unicode-tokens
      pg-thymodes pg-autotest
      ;;
-     isar-syntax isar-find-theorems isar-unicode-tokens
-     isar-autotest interface-setup isabelle-system isar
-     isar-keywords
-     ;;
      coq-abbrev coq-db coq-unicode-tokens coq-local-vars coq coq-syntax
      coq-indent coq-autotest)))
 
@@ -134,7 +130,6 @@
   (elp-instrument-package "scomint")
   (elp-instrument-package "unicode-tokens")
   (elp-instrument-package "coq")
-  (elp-instrument-package "isar")
   (elp-instrument-package "span")
   (elp-instrument-package "replace-") ; for replace-regexp etc
   (elp-instrument-package "re-search-") ; for re-search-forwad etc
@@ -176,7 +171,6 @@
              "http://proofgeneral.inf.ed.ac.uk/trac/ticket/%s";))))
 
 (add-hook 'emacs-lisp-mode-hook 'pg-bug-references)
-(add-hook 'isar-mode-hook 'pg-bug-references)
 (add-hook 'coq-mode-hook 'pg-bug-references)
 
 (add-hook 'emacs-lisp-mode-hook 'goto-address-mode)
diff --git a/lib/pg-fontsets.el b/lib/pg-fontsets.el
index 771e76f154..2cb61a4586 100644
--- a/lib/pg-fontsets.el
+++ b/lib/pg-fontsets.el
@@ -11,7 +11,7 @@
 
 ;; Author:    David Aspinall <David.Aspinall@ed.ac.uk>
 
-;; License:   GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
diff --git a/lib/proof-compat.el b/lib/proof-compat.el
index 95c533e520..b1db0dc61b 100644
--- a/lib/proof-compat.el
+++ b/lib/proof-compat.el
@@ -11,7 +11,7 @@
 
 ;; Author:      David Aspinall <David.Aspinall@ed.ac.uk> and others
 
-;; License:     GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
diff --git a/lib/scomint.el b/lib/scomint.el
index 8f7104e8b9..eef4e522d8 100644
--- a/lib/scomint.el
+++ b/lib/scomint.el
@@ -11,7 +11,7 @@
 
 ;; Author:    David Aspinall
 
-;; License:   GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
diff --git a/lib/span.el b/lib/span.el
index 48cfb3c965..b478f3dec5 100644
--- a/lib/span.el
+++ b/lib/span.el
@@ -3,7 +3,7 @@
 ;; This file is part of Proof General.
 
 ;; Portions © Copyright 1994-2012  David Aspinall and University of Edinburgh
-;; Portions © Copyright 2003-2018  Free Software Foundation, Inc.
+;; Portions © Copyright 2003-2021  Free Software Foundation, Inc.
 ;; Portions © Copyright 2001-2017  Pierre Courtieu
 ;; Portions © Copyright 2010, 2016  Erik Martin-Dorel
 ;; Portions © Copyright 2011-2013, 2016-2017  Hendrik Tews
@@ -12,7 +12,7 @@
 ;; Author:      Healfdene Goguen
 ;; Maintainer:  David Aspinall <David.Aspinall@ed.ac.uk>
 
-;; License:     GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;;; Commentary:
 ;;
@@ -51,11 +51,6 @@
   (span-set-property span 'modification-hooks '(span-read-only-hook))
   (span-set-property span 'insert-in-front-hooks '(span-read-only-hook)))
 
-(defun span-read-write (span)
-  "Set SPAN to be writeable."
-  (span-set-property span 'modification-hooks nil)
-  (span-set-property span 'insert-in-front-hooks nil))
-
 (defun span-write-warning (span fun)
   "Give a warning message when SPAN is changed, unless `inhibit-read-only' is 
non-nil."
   (let ((funs (list (lambda (_span afterp beg end &rest _)
diff --git a/lib/texi-docstring-magic.el b/lib/texi-docstring-magic.el
index 2d6a3cf400..91a3a5d1b9 100644
--- a/lib/texi-docstring-magic.el
+++ b/lib/texi-docstring-magic.el
@@ -1,9 +1,9 @@
-;;; texi-docstring-magic.el --- munge internal docstrings into texi
+;;; texi-docstring-magic.el --- munge internal docstrings into texi  -*- 
lexical-binding: t; -*-
 
 ;; This file is part of Proof General.
 
 ;; Portions © Copyright 1994-2012  David Aspinall and University of Edinburgh
-;; Portions © Copyright 2003-2018  Free Software Foundation, Inc.
+;; Portions © Copyright 2003-2021  Free Software Foundation, Inc.
 ;; Portions © Copyright 2001-2017  Pierre Courtieu
 ;; Portions © Copyright 2010, 2016  Erik Martin-Dorel
 ;; Portions © Copyright 2011-2013, 2016-2017  Hendrik Tews
@@ -12,10 +12,10 @@
 ;; Author:     David Aspinall <David.Aspinall@ed.ac.uk>
 ;; Keywords: lisp, docs, tex
 
-;; License:     GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;; This file is distributed under the terms of the GNU General Public
-;; License, Version 2.  Find a copy of the GPL with your version of
+;; License, Version 3 or later.  Find a copy of the GPL with your version of
 ;; GNU Emacs or Texinfo.
 
 ;;; Commentary:
@@ -110,28 +110,32 @@ Compatibility between FSF Emacs and XEmacs."
       (setq strings (cdr strings)))
     str))
 
+(defvar texi-docstring--args)
+(defvar texi-docstring--in-quoted-region)
+
 (defconst texi-docstring-magic-munge-table
-  '(;; 0. Escape @, { and } characters
+  `(;; 0. Escape @, { and } characters
     ("\\(@\\)" t "@@")
     ("\\({\\)" t "@{")
     ("\\(}\\)" t "@}")
     ;; 1. Indented lines are gathered into @lisp environment.
     ("^\\(\n\\|.+\\)$"
      t
-     (let
-        ((line (match-string 0 docstring)))
-       (if (save-match-data (string-match "^[ \t]" line))
-          ;; whitespace
-          (if in-quoted-region
-              line
-            (setq in-quoted-region t)
-            (concat "@lisp\n" line))
-        ;; non-white space/carriage return
-        (if (and in-quoted-region (not (equal line "\n")))
-            (progn
-              (setq in-quoted-region nil)
-              (concat "@end lisp\n" line))
-          line))))
+     ,(lambda (docstring)
+       (let
+           ((line (match-string 0 docstring)))
+         (if (save-match-data (string-match "^[ \t]" line))
+             ;; whitespace
+             (if texi-docstring--in-quoted-region
+                 line
+               (setq texi-docstring--in-quoted-region t)
+               (concat "@lisp\n" line))
+           ;; non-white space/carriage return
+           (if (and texi-docstring--in-quoted-region (not (equal line "\n")))
+               (progn
+                 (setq texi-docstring--in-quoted-region nil)
+                 (concat "@end lisp\n" line))
+             line)))))
     ;; 2. Pieces of text `stuff' or surrounded in quotes
     ;; are marked up with @samp.  NB: Must be backquote
     ;; followed by forward quote for this to work.
@@ -142,21 +146,25 @@ Compatibility between FSF Emacs and XEmacs."
     ;; and symbols put inside quotes.
     ("\\(`\\([^']+\\)'\\)"
      t
-     (concat "@samp{" (match-string 2 docstring) "}"))
+     ,(lambda (docstring)
+        (concat "@samp{" (match-string 2 docstring) "}")))
     ;; 3. Words *emphasized* are made @strong{emphasized}
     ("\\(\\*\\(\\w+\\)\\*\\)"
      t
-     (concat "@strong{" (match-string 2 docstring) "}"))
+     ,(lambda (docstring)
+        (concat "@strong{" (match-string 2 docstring) "}")))
     ;; 4. Words sym-bol which are symbols become @code{sym-bol}.
     ;; Must have at least one hyphen to be recognized,
     ;; terminated in whitespace, end of line, or punctuation.
     ;; Only consider symbols made from word constituents
     ;; and hyphen.
-    ("\\(\\(\\w+\\-\\(\\w\\|\\-\\)+\\)\\)\\(\\s\)\\|\\s-\\|\\s.\\|$\\)"
-     (or (boundp (intern (match-string 2 docstring)))
-        (fboundp (intern (match-string 2 docstring))))
-     (concat "@code{" (match-string 2 docstring) "}"
-            (match-string 4 docstring)))
+    ("\\(\\(\\w+-\\(\\w\\|-\\)+\\)\\)\\(\\s)\\|\\s-\\|\\s.\\|$\\)"
+     ,(lambda (docstring)
+       (or (boundp (intern (match-string 2 docstring)))
+           (fboundp (intern (match-string 2 docstring)))))
+     ,(lambda (docstring)
+       (concat "@code{" (match-string 2 docstring) "}"
+               (match-string 4 docstring))))
     ;; 5. Upper cased words ARG corresponding to arguments become
     ;; @var{arg}
     ;; In fact, include any word so long as it is more than 3 characters
@@ -165,19 +173,23 @@ Compatibility between FSF Emacs and XEmacs."
     ;; FIXME: maybe we don't want to downcase stuff already
     ;; inside @samp
     ;; FIXME: should - terminate?  should _ be included?
-    ("\\([A-Z0-9_\\-]+\\)\\(/\\|\)\\|}\\|\\s-\\|\\s.\\|$\\)"
-     (or (> (length (match-string 1 docstring)) 3)
-        (member (downcase (match-string 1 docstring)) args))
-     (concat "@var{" (downcase (match-string 1 docstring)) "}"
-            (match-string 2 docstring)))
+    ("\\([A-Z0-9_\\-]+\\)\\(/\\|)\\|}\\|\\s-\\|\\s.\\|$\\)"
+     ,(lambda (docstring)
+       (or (> (length (match-string 1 docstring)) 3)
+           (member (downcase (match-string 1 docstring))
+                   texi-docstring--args)))
+     ,(lambda (docstring)
+       (concat "@var{" (downcase (match-string 1 docstring)) "}"
+               (match-string 2 docstring))))
 
     ;; 6. Words 'sym which are lisp quoted are
     ;; marked with @code.
-    ("\\(\\(\\s-\\|^\\)'\\(\\(\\w\\|\\-\\)+\\)\\)\\(\\s\)\\|\\s-\\|\\s.\\|$\\)"
+    ("\\(\\(\\s-\\|^\\)'\\(\\(\\w\\|-\\)+\\)\\)\\(\\s)\\|\\s-\\|\\s.\\|$\\)"
      t
-     (concat (match-string 2 docstring)
-            "@code{'" (match-string 3 docstring) "}"
-            (match-string 5 docstring)))
+     ,(lambda (docstring)
+       (concat (match-string 2 docstring)
+               "@code{'" (match-string 3 docstring) "}"
+               (match-string 5 docstring))))
     ;; 7,8. Clean up for @lisp environments left with spurious newlines
     ;; after 1.
     ("\\(\\(^\\s-*$\\)\n@lisp\\)" t "@lisp")
@@ -186,14 +198,16 @@ Compatibility between FSF Emacs and XEmacs."
     ;; Changed to just @samp of uppercase.
     ("\\(@samp{@var{\\([^}]+\\)}}\\)"
      t
-     (concat "@samp{" (upcase (match-string 2 docstring)) "}")))
+     ,(lambda (docstring)
+        (concat "@samp{" (upcase (match-string 2 docstring)) "}"))))
     "Table of regexp matches and replacements used to markup docstrings.
 Format of table is a list of elements of the form
-   (regexp predicate replacement-form)
-If regexp matches and predicate holds, then replacement-form is
-evaluated to get the replacement for the match.
-predicate and replacement-form can use variables arg,
-and forms such as (match-string 1 docstring)
+   (REGEXP PREDICATE REPLACEMENT)
+If REGEXP matches and PREDICATE holds, then REPLACEMENT is
+used to replace the match.
+PREDICATE and REPLACEMENT can be functions taking
+the docstring as argument and they can use the dynamically scoped
+variables `texi-docstring--args' and `texi-docstring--in-quoted-region'.
 Match string 1 is assumed to determine the
 length of the matched item, hence where parsing restarts from.
 The replacement must cover the whole match (match string 0),
@@ -207,30 +221,34 @@ including any whitespace included to delimit matches.")
     (untabify (point-min) (point-max))
     (buffer-string)))
 
+(defun texi-docstring--funcall (f arg)
+  (if (functionp f) (funcall f arg) f))
+
 (defun texi-docstring-magic-munge-docstring (docstring args)
   "Markup DOCSTRING for texi according to regexp matches."
   ;; FIXME(EMD): seems buggy as ARGS is not used
-  (let ((case-fold-search nil))
+  (let ((case-fold-search nil)
+        (texi-docstring--args args))
     (setq docstring (texi-docstring-magic-untabify docstring))
     (dolist (test texi-docstring-magic-munge-table)
       (let ((regexp    (nth 0 test))
            (predicate  (nth 1 test))
            (replace    (nth 2 test))
            (i          0)
-           in-quoted-region)
+           texi-docstring--in-quoted-region)
 
        (while (and
                (< i (length docstring))
                (string-match regexp docstring i))
          (setq i (match-end 1))
-         (if (eval predicate)
+         (if (texi-docstring--funcall predicate docstring)
              (let* ((origlength  (- (match-end 0) (match-beginning 0)))
-                    (replacement (eval replace))
+                    (replacement (texi-docstring--funcall replace docstring))
                     (newlength   (length replacement)))
                (setq docstring
                      (replace-match replacement t t docstring))
                (setq i (+ i (- newlength origlength))))))
-       (if in-quoted-region
+       (if texi-docstring--in-quoted-region
            (setq docstring (concat docstring "\n@end lisp"))))))
   ;; Force a new line after (what should be) the first sentence,
   ;; if not already a new paragraph.
@@ -319,8 +337,10 @@ Markup as @code{stuff} or @lisp stuff @end Lisp."
         (def       (symbol-function function))
         (macrop    (eq 'macro (car-safe def)))
         (argsyms   (cond ((eq (car-safe def) 'lambda)
-                          (nth 1 def))))
-        (args      (mapcar 'symbol-name argsyms)))
+                          (nth 1 def))
+                          ((eq (car-safe def) 'closure)
+                           (nth 2 def))))
+        (args      (mapcar #'symbol-name argsyms)))
       (cond
        ((commandp function)
        (texi-docstring-magic-texi "fn" "Command" name docstring args))
@@ -347,9 +367,19 @@ With prefix arg, no errors on unknown symbols.  (This 
results in
   (interactive "P")
   (save-excursion
     (goto-char (point-min))
-    (let ((magic (concat "^"
+    ;; Since emacs 26 grave accent and apostrophe are translated to
+    ;; unicode single quotation marks, \"`foo'" becomes "‘foo’", see
+    ;; Section Documentation -> Text Quoting Style (24.4 in emacs 27)
+    ;; in the elisp manual. This translation happens apparently
+    ;; already when accessing the documentation strings with
+    ;; `documentation-property' or similar functions; breaking the
+    ;; regular expressions for transforming the doc strings in this
+    ;; module. Set `text-quoting-style' to get the doc strings without
+    ;; this translation.
+    (let ((text-quoting-style 'grave)
+          (magic (concat "^"
                         (regexp-quote texi-docstring-magic-comment)
-                        "\\s-*\\(\\(\\w\\|\\-\\)+\\)[ \t]*$"))
+                        "\\s-*\\(\\(\\w\\|-\\)+\\)[ \t]*$"))
          p
          symbol
          deleted)
diff --git a/lib/unicode-tokens.el b/lib/unicode-tokens.el
index 41f478d14a..11fdada1e2 100644
--- a/lib/unicode-tokens.el
+++ b/lib/unicode-tokens.el
@@ -1,9 +1,9 @@
-;;; unicode-tokens.el --- Support for control and symbol tokens
+;;; unicode-tokens.el --- Support for control and symbol tokens  -*- 
lexical-binding: t; -*-
 
 ;; This file is part of Proof General.
 
 ;; Portions © Copyright 1994-2012  David Aspinall and University of Edinburgh
-;; Portions © Copyright 2003, 2012, 2014  Free Software Foundation, Inc.
+;; Portions © Copyright 2003-2021  Free Software Foundation, Inc.
 ;; Portions © Copyright 2001-2017  Pierre Courtieu
 ;; Portions © Copyright 2010, 2016  Erik Martin-Dorel
 ;; Portions © Copyright 2011-2013, 2016-2017  Hendrik Tews
@@ -11,11 +11,11 @@
 
 ;; Author:    David Aspinall <David.Aspinall@ed.ac.uk>
 
-;; License:     GPL (GNU GENERAL PUBLIC LICENSE)
+;; SPDX-License-Identifier: GPL-3.0-or-later
 
 ;; This is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
 ;; This software is distributed in the hope that it will be useful,
@@ -71,8 +71,10 @@
   (interactive)
   (customize-set-variable 'unicode-tokens-add-help-echo
                          (not unicode-tokens-add-help-echo))
-  ;; NB: approximate, should refontify all...
-  (font-lock-fontify-buffer))
+  (if (fboundp 'font-lock-flush)        ;Emacs-25
+      (font-lock-flush)
+    ;; NB: approximate, should refontify all...
+    (with-no-warnings (font-lock-fontify-buffer))))
 
 ;;
 ;; Variables that should be set by client modes
@@ -127,7 +129,8 @@ The shortcuts are only used for input convenience; no 
reverse
 mapping back to shortucts is performed.  Behaviour is like abbrev.")
 
 (defvar unicode-tokens-shortcut-replacement-alist nil
-  "Overrides `unicode-tokens-shortcut-alist' for 
`unicode-tokens-replace-shortcuts'.")
+  "Overrides `unicode-tokens-shortcut-alist'.
+Used for `unicode-tokens-replace-shortcuts'.")
 
 
 ;;
@@ -194,12 +197,14 @@ and (match-string 2) has the display control applied.")
   (intern (concat "unicode-tokens-" (symbol-name sym) "-variable")))
 
 (dolist (sym unicode-tokens-configuration-variables)
+  ;; FIXME: This dolist loop does nothing!
  (lambda (sym)
    (eval `(defvar ,(unicode-tokens-config-var sym)
           nil
           ,(format
             "Name of a variable used to configure %s.\nValue should be a 
symbol."
-            (symbol-name (unicode-tokens-config sym)))))))
+            (symbol-name (unicode-tokens-config sym))))
+        t)))
 
 (defun unicode-tokens-copy-configuration-variables ()
   "Initialise the configuration variables by copying from variable names.
@@ -578,7 +583,9 @@ Optional argument OBJECT is the string or buffer containing 
the text."
   (setq unicode-tokens-show-symbols
        (if (null arg) (not unicode-tokens-show-symbols)
          (> (prefix-numeric-value arg) 0)))
-  (font-lock-fontify-buffer))
+  (if (fboundp 'font-lock-flush)        ;Emacs-25
+      (font-lock-flush)
+    (with-no-warnings (font-lock-fontify-buffer))))
 
 (defun unicode-tokens-symbs-to-props (symbs &optional facenil)
   "Turn the property name list SYMBS into a list of text properties.
@@ -615,31 +622,33 @@ Optional argument FACENIL means set the face property to 
nil, unless 'face is in
     (add-to-invisibility-spec 'unicode-tokens-show-controls))
   (redraw-display))
 
-(defun unicode-tokens-control-char (name s &rest props)
+(defun unicode-tokens-control-char (_name s &rest props)
   `(,(format unicode-tokens-control-char-format-regexp (regexp-quote s))
     (1 '(face nil invisible unicode-tokens-show-controls) prepend)
     ;; simpler but buggy with font-lock-prepend-text-property:
     ;; (2 ',(unicode-tokens-symbs-to-props props t) prepend)
     (2 (unicode-tokens-prepend-text-properties-in-match
-       ',(unicode-tokens-symbs-to-props props t) 2) prepend)
+       ',(unicode-tokens-symbs-to-props props t) 2)
+       prepend)
     ))
 
-(defun unicode-tokens-control-region (name start end &rest props)
+(defun unicode-tokens-control-region (_name start end &rest props)
   `(,(format unicode-tokens-control-region-format-regexp
             (regexp-quote start) (regexp-quote end))
     (1 '(face nil invisible unicode-tokens-show-controls) prepend)
     ;; simpler but buggy with font-lock-prepend-text-property:
     ;; (2 ',(unicode-tokens-symbs-to-props props t) prepend)
     (2 (unicode-tokens-prepend-text-properties-in-match
-       ',(unicode-tokens-symbs-to-props props t) 2) prepend)
+       ',(unicode-tokens-symbs-to-props props t) 2)
+       prepend)
     (3 '(face nil invisible unicode-tokens-show-controls) prepend)
     ))
 
 (defun unicode-tokens-control-font-lock-keywords ()
   (append
-   (mapcar (lambda (args) (apply 'unicode-tokens-control-char args))
+   (mapcar (lambda (args) (apply #'unicode-tokens-control-char args))
           unicode-tokens-control-characters)
-   (mapcar (lambda (args) (apply 'unicode-tokens-control-region args))
+   (mapcar (lambda (args) (apply #'unicode-tokens-control-region args))
           unicode-tokens-control-regions)))
 
 ;;
@@ -678,20 +687,14 @@ Optional argument FACENIL means set the face property to 
nil, unless 'face is in
   "Define the token and shortcut input rules.
 Calculated from `unicode-tokens-token-name-alist' and
 `unicode-tokens-shortcut-alist'."
-  (let ((unicode-tokens-quail-define-rules
-        (list 'quail-define-rules)))
-    (let ((ulist (copy-sequence unicode-tokens-shortcut-alist))
-         ustring shortcut)
-      (setq ulist (sort ulist 'unicode-tokens-map-ordering))
-      (while ulist
-       (setq shortcut (caar ulist))
-       (setq ustring (cdar ulist))
-       (nconc unicode-tokens-quail-define-rules
-              (list (list shortcut
-                          (vector ustring))))
-       (setq ulist (cdr ulist))))
-    (eval unicode-tokens-quail-define-rules)))
-
+  (eval `(quail-define-rules
+          ,@(mapcar (lambda (x)
+                      (let ((shortcut (car x))
+                           (ustring (cdr x)))
+                       (list shortcut (vector ustring))))
+                    (sort (copy-sequence unicode-tokens-shortcut-alist)
+                         #'unicode-tokens-map-ordering)))
+        t))
 
 ;;
 ;; User-level functions
@@ -826,7 +829,7 @@ but multiple characters in the underlying buffer."
   (interactive "p")
   (if (> (point) (point-min))
       (save-match-data
-       (let ((pos    (point))
+       (let (;; (pos    (point))
              (token  (unicode-tokens-prev-token)))
          (when (not token)
            (goto-char (point))
@@ -854,7 +857,7 @@ but multiple characters in the underlying buffer."
   (interactive "p")
   (unicode-tokens-rotate-token-forward (if n (- n) -1)))
 
-(defun unicode-tokens-replace-shortcut-match (&rest ignore)
+(defun unicode-tokens-replace-shortcut-match (&rest _ignore)
   "Subroutine for `unicode-tokens-replace-shortcuts'."
   (let* ((match (match-string-no-properties 0))
         (repl  (if match
@@ -868,7 +871,7 @@ but multiple characters in the underlying buffer."
 Starts from point."
   (interactive)
   (let ((shortcut-regexp
-        (regexp-opt (mapcar 'car unicode-tokens-shortcut-replacement-alist))))
+        (regexp-opt (mapcar #'car unicode-tokens-shortcut-replacement-alist))))
     ;; override the display of the regexp because it's huge!
     ;; (doesn't help with C-h: need way to programmatically show string)
     (cl-flet ((query-replace-descr (str)
@@ -877,7 +880,7 @@ Starts from point."
                       (cons 'unicode-tokens-replace-shortcut-match nil)
                       t t nil))))
 
-(defun unicode-tokens-replace-unicode-match (&rest ignore)
+(defun unicode-tokens-replace-unicode-match (&rest _ignore)
   "Subroutine for `unicode-tokens-replace-unicode'."
   (let* ((useq (match-string-no-properties 0))
         (token (gethash useq unicode-tokens-uchar-hash-table)))
@@ -971,7 +974,7 @@ Starts from point."
                           'face
                           'header-line)))))))
 
-(defalias 'unicode-tokens-list-unicode-chars 'unicode-chars-list-chars)
+(defalias 'unicode-tokens-list-unicode-chars #'unicode-chars-list-chars)
 
 (defun unicode-tokens-encode-in-temp-buffer (str fn)
   "Compute an encoded version of STR and call FN onto."
@@ -1046,7 +1049,9 @@ tokenised symbols."
   (setq unicode-tokens-highlight-unicode
        (not unicode-tokens-highlight-unicode))
   (unicode-tokens-highlight-unicode-setkeywords)
-  (font-lock-fontify-buffer))
+  (if (fboundp 'font-lock-flush)        ;Emacs-25
+      (font-lock-flush)
+    (with-no-warnings (font-lock-fontify-buffer))))
 
 (defun unicode-tokens-highlight-unicode-setkeywords ()
   "Adjust font lock keywords according to variable 
`unicode-tokens-highlight-unicode'."
@@ -1144,7 +1149,9 @@ Commands available are:
 
       (unicode-tokens-highlight-unicode-setkeywords)
 
-      (font-lock-fontify-buffer)
+      (if (fboundp 'font-lock-flush)        ;Emacs-25
+          (font-lock-flush)
+        (with-no-warnings (font-lock-fontify-buffer)))
 
       ;; experimental: this may be rude for non-nil standard tables
       (setq buffer-display-table unicode-tokens-display-table)
@@ -1167,12 +1174,15 @@ Commands available are:
       (remove-from-invisibility-spec 'unicode-tokens-show-controls)
 
       (when flks
-       (font-lock-unfontify-buffer)
+       (unless (fboundp 'font-lock-flush)        ;Emacs-25
+         (font-lock-unfontify-buffer))
        (setq font-lock-extra-managed-props
              (get 'font-lock-extra-managed-props major-mode))
        (setq font-lock-set-defaults nil) ; force font-lock-set-defaults to 
reinit
-       (font-lock-fontify-buffer)
-       (set-input-method nil))
+       (if (fboundp 'font-lock-flush)        ;Emacs-25
+            (font-lock-flush)
+          (with-no-warnings (font-lock-fontify-buffer)))
+        (set-input-method nil))
 
       ;; experimental: this may be rude for non-nil standard tables
       (setq buffer-display-table nil)
@@ -1211,12 +1221,12 @@ Commands available are:
         (with-no-warnings
           ns-input-font)))
      (t
-      (apply 'old-ns-respond-to-change-font args))))
+      (apply #'old-ns-respond-to-change-font args))))
 
   (defun ns-popup-font-panel (&rest args)
     (setq unicode-tokens-respond-to-change-font nil)
     (with-no-warnings
-      (apply 'old-ns-popup-font-panel args)))
+      (apply #'old-ns-popup-font-panel args)))
 
   (defun unicode-tokens-popup-font-panel (fontvar)
     (setq unicode-tokens-respond-to-change-font fontvar)
@@ -1229,17 +1239,17 @@ Commands available are:
 (defun unicode-tokens-set-font-var (fontvar)
   "Interactively select a font for FONTVAR."
   (interactive)
-  (let (font spec)
-    (if (fboundp 'ns-popup-font-panel)
-       (with-no-warnings
-         (unicode-tokens-popup-font-panel fontvar))
-      (cond
-       ((fboundp 'x-select-font)
-       (setq font (x-select-font)))
-       ((fboundp 'mouse-select-font)
-       (setq font (mouse-select-font)))
-       (t
-       (setq font (unicode-tokens-mouse-set-font))))
+  (if (fboundp 'ns-popup-font-panel)
+      (with-no-warnings
+       (unicode-tokens-popup-font-panel fontvar))
+    (let (;; spec
+         (font (cond
+                ((fboundp 'x-select-font)
+                 (x-select-font))
+                ((fboundp 'mouse-select-font)
+                 (mouse-select-font))
+                (t
+                 (unicode-tokens-mouse-set-font)))))
       (unicode-tokens-set-font-var-aux fontvar font))))
 
 (defun unicode-tokens-set-font-var-aux (fontvar font)
@@ -1270,6 +1280,9 @@ Commands available are:
       (and (display-graphic-p f)
           (dolist (w (window-list f))
             (with-current-buffer (window-buffer w)
+              ;; FIXME: Why should we need to re-fontify those buffers?  We've
+              ;; only changed the definition of some faces, whereas font-lock
+              ;; only choose which faces to use: the two are independent!
               (when font-lock-mode (font-lock-fontify-buffer))))))))
 
 ;; based on mouse-set-font from mouse.el in Emacs 22.2.1
@@ -1295,6 +1308,7 @@ Commands available are:
   (let ((facevar (unicode-tokens-face-font-sym fontsym)))
     (unicode-tokens-set-font-var facevar)
     (unicode-tokens-initialise)
+    ;; FIXME: Why do we need this here?
     (font-lock-fontify-buffer)))
 
 ;;
@@ -1305,9 +1319,9 @@ Commands available are:
   "Save the customized font variables."
   ;; save all customized faces (tricky to do less)
   (interactive)
-  (apply 'unicode-tokens-custom-save-faces
-   (mapcar 'unicode-tokens-face-font-sym
-          unicode-tokens-fonts)))
+  (apply #'unicode-tokens-custom-save-faces
+        (mapcar #'unicode-tokens-face-font-sym
+                unicode-tokens-fonts)))
 
 (defun unicode-tokens-custom-save-faces (&rest faces)
   "Save custom faces FACES."
@@ -1328,10 +1342,10 @@ Commands available are:
 
 (define-key unicode-tokens-mode-map
   [remap delete-backward-char]
-  'unicode-tokens-delete-backward-char)
+  #'unicode-tokens-delete-backward-char)
 (define-key unicode-tokens-mode-map
   [remap delete-char]
-  'unicode-tokens-delete-char)
+  #'unicode-tokens-delete-char)
 
 ;; support delete selection mode
 (put 'unicode-tokens-delete-backward-char 'delete-selection 'supersede)
@@ -1346,7 +1360,7 @@ Commands available are:
 ;; FIXME: does this work?
 (define-key unicode-tokens-quail-translation-keymap
      [remap quail-delete-last-char]
-     'unicode-tokens-quail-delete-last-char)
+     #'unicode-tokens-quail-delete-last-char)
 
 (defun unicode-tokens-quail-delete-last-char ()
   (interactive)
@@ -1364,22 +1378,22 @@ Commands available are:
 
 
 (define-key unicode-tokens-mode-map [(control ?,)]
-  'unicode-tokens-rotate-token-backward)
+  #'unicode-tokens-rotate-token-backward)
 (define-key unicode-tokens-mode-map [(control ?.)]
-  'unicode-tokens-rotate-token-forward)
+  #'unicode-tokens-rotate-token-forward)
 (define-key unicode-tokens-mode-map
-  [(control c) (control t) (control t)] 'unicode-tokens-insert-token)
+  [(control c) (control t) (control t)] #'unicode-tokens-insert-token)
 (define-key unicode-tokens-mode-map
   [(control c) (control backspace)]
-  'unicode-tokens-delete-token-near-point)
+  #'unicode-tokens-delete-token-near-point)
 (define-key unicode-tokens-mode-map
-  [(control c) (control t) (control r)] 'unicode-tokens-annotate-region)
+  [(control c) (control t) (control r)] #'unicode-tokens-annotate-region)
 (define-key unicode-tokens-mode-map
-  [(control c) (control t) (control e)] 'unicode-tokens-insert-control)
+  [(control c) (control t) (control e)] #'unicode-tokens-insert-control)
 (define-key unicode-tokens-mode-map
-  [(control c) (control t) (control z)] 'unicode-tokens-show-symbols)
+  [(control c) (control t) (control z)] #'unicode-tokens-show-symbols)
 (define-key unicode-tokens-mode-map
-  [(control c) (control t) (control t)] 'unicode-tokens-show-controls)
+  [(control c) (control t) (control t)] #'unicode-tokens-show-controls)
 
 
 ;;
@@ -1388,9 +1402,10 @@ Commands available are:
 
 (defun unicode-tokens-customize-submenu ()
   (mapcar (lambda (cv)
-           (vector (car cv)
-                   `(lambda () (interactive)
-                      (customize-variable (quote ,(cadr cv))))))
+           (let ((v (cadr cv)))
+             (vector (car cv)
+                     (lambda () (interactive)
+                       (customize-variable v)))))
          unicode-tokens-tokens-customizable-variables))
 
 (defun unicode-tokens-define-menu ()
@@ -1407,8 +1422,8 @@ Commands available are:
             (mapcar
             (lambda (fmt)
               (vector (car fmt)
-                      `(lambda () (interactive)
-                         (funcall 'unicode-tokens-insert-control ',(car fmt)))
+                      (lambda () (interactive)
+                        (unicode-tokens-insert-control (car fmt)))
                       :help (concat "Format next item as "
                                     (downcase (car fmt)))))
             unicode-tokens-control-characters))
@@ -1416,8 +1431,8 @@ Commands available are:
            (mapcar
             (lambda (fmt)
               (vector (car fmt)
-                      `(lambda () (interactive)
-                        (funcall 'unicode-tokens-annotate-region ',(car fmt)))
+                      (lambda () (interactive)
+                        (unicode-tokens-annotate-region (car fmt)))
                       :help (concat "Format region as "
                                     (downcase (car fmt)))
                       :active 'mark-active))
@@ -1472,8 +1487,8 @@ Commands available are:
         (lambda (var)
           (vector
            (upcase-initials (symbol-name var))
-           `(lambda () (interactive)
-               (funcall 'unicode-tokens-set-font-restart ',var))
+           (lambda () (interactive)
+             (unicode-tokens-set-font-restart var))
             :help (concat "Set the " (symbol-name var) " font")))
         unicode-tokens-fonts)
         (list "----"
diff --git a/obsolete/demoisa/demoisa.el b/obsolete/demoisa/demoisa.el
index 5254e97e55..895b32822a 100644
--- a/obsolete/demoisa/demoisa.el
+++ b/obsolete/demoisa/demoisa.el
@@ -15,7 +15,7 @@
 ;; Basic configuration is controlled by one line in `proof-site.el'.
 ;; It has this line in proof-assistant-table:
 ;;
-;;     (demoisa "Isabelle Demo"        "\\.ML$")
+;;     (demoisa "Isabelle Demo"        "\\.ML\\'")
 ;;
 ;; From this it loads this file "demoisa/demoisa.el" whenever
 ;; a .ML file is visited, and sets the mode to `demoisa-mode'
diff --git a/obsolete/lclam/README b/obsolete/lclam/README
deleted file mode 100644
index 39db25c1cb..0000000000
--- a/obsolete/lclam/README
+++ /dev/null
@@ -1,15 +0,0 @@
-Lambda-CLAM Proof General
-
-Written by James Brotherston <jjb@dai.ed.ac.uk>.
-
-
-Status:                        supported
-Maintainer:            James Brotherston <jjb@dai.ed.ac.uk>
-Lambda-CLAM version:    ??
-Lambda-CLAM homepage:   http://dream.dai.ed.ac.uk/software/systems/lambda-clam/
-
-========================================
-
-$Id$
-
-
diff --git a/obsolete/lclam/example.lcm b/obsolete/lclam/example.lcm
deleted file mode 100644
index 5b27581466..0000000000
--- a/obsolete/lclam/example.lcm
+++ /dev/null
@@ -1,34 +0,0 @@
-/* File name:      example.lcm                            */
-/* Description:    Tutorial walkthrough from LClam manual */
-/* Author:         James Brotherston                      */
-/* Last modified:  20th August 2001                       */
-
-query_top_goal X assp.
-
-set_spypoint (induction_top normal_ind).
-set_spypoint sym_eval.
-
-silent_output on.
-
-pds_plan (induction_top normal_ind) assp.
-continue.
-continue.
-continue.
-
-add_theory_to_induction_scheme_list arithmetic.
-add_theory_to_sym_eval_list arithmetic.
-set_wave_rule_to_sym_eval.
-add_to_sym_eval_list [idty].
-set_wave_rule_to_sym_eval.
-remove_spypoint (induction_top normal_ind).
-remove_spypoint sym_eval.
-pds_plan (induction_top normal_ind) assp.
-
-step_by_step on.
-pds_plan (induction_top normal_ind) assp.
-continue.
-backtrack.
-try ind_strat.
-continue.
-plan_node (2::1::nil).
-abandon.
diff --git a/obsolete/lclam/lclam.el b/obsolete/lclam/lclam.el
deleted file mode 100644
index 0472b6a0da..0000000000
--- a/obsolete/lclam/lclam.el
+++ /dev/null
@@ -1,209 +0,0 @@
-;; File name:      lclam.el        
-;; Description:    Proof General instance for Lambda-CLAM
-;; Author:         James Brotherston <jjb@dai.ed.ac.uk>
-;; Last modified:  23 October 2001
-;;
-;; $Id$
-
-(require 'proof)            ; load generic parts
-(require 'proof-syntax)     
-
-;;
-;; =========== User settings for Lambda-CLAM ============
-;;
-
-(defcustom lclam-prog-name ; "~/lambda-clam-teyjus/bin/lclam"
-                          "lclam"
-  "*Name of program to run Lambda-CLAM"
-  :type 'file
-  :group 'lclam)
-
-(defcustom lclam-web-page
-  "http://dream.dai.ed.ac.uk/software/systems/lambda-clam/";
-  "URL of web page for Lambda-CLAM"
-  :type 'string
-  :group 'lclam-config)
-
-
-;;
-;; =========== Configuration of generic modes ============
-;;
-
-(defun lclam-config ()
-  "Configure Proof General scripting for Lambda-CLAM."
-  (setq 
-   proof-terminal-string           "."
-   proof-script-comment-start      "/*"
-   proof-script-comment-end        "*/"
-   proof-goal-command-regexp       "^pds_plan"
-   proof-save-command-regexp       nil
-   proof-goal-with-hole-regexp     nil
-   proof-save-with-hole-regexp     nil
-   proof-non-undoables-regexp      nil
-   proof-undo-n-times-cmd          nil
-   proof-showproof-command         nil 
-   proof-goal-command              "^pds_plan %s."
-   proof-save-command              nil
-   proof-kill-goal-command         nil
-   proof-assistant-home-page       lclam-web-page
-   proof-auto-multiple-files       nil 
-   ))
-
-(defun lclam-shell-config ()
-  "Configure Proof General shell for Lambda-CLAM"
-  (setq
-   proof-shell-annotated-prompt-regexp "^lclam:" 
-   proof-shell-cd-cmd                  nil
-   proof-shell-interrupt-regexp        nil
-   proof-shell-error-regexp            nil
-   proof-shell-start-goals-regexp      nil
-   proof-shell-end-goals-regexp        nil
-   proof-shell-proof-completed-regexp  "^Plan Succeeded"
-   proof-shell-init-cmd                nil
-   proof-shell-quit-cmd                "halt."
-   proof-shell-eager-annotation-start  nil
-    ))
-
-;;
-;; =========== Defining the derived modes ================
-;;
-
-(define-derived-mode lclam-proofscript-mode proof-mode
-  "Lambda-CLAM script" nil
-  (lclam-config)
-  (proof-config-done))
-
-(define-derived-mode lclam-shell-mode proof-shell-mode
-  "Lambda-CLAM shell" nil
-  (lclam-shell-config)
-  (proof-shell-config-done))
-
-(define-derived-mode lclam-response-mode proof-response-mode
-  "Lambda-CLAM response" nil
-  (proof-response-config-done))
-
-(define-derived-mode lclam-goals-mode proof-goals-mode
-  "Lambda-CLAM goals" nil
-  (proof-goals-config-done))
-
-;; Automatic selection of theory file or proof script mode
-;; .lcm -> proof script mode
-;; .def -> theory file mode
-
-(defun lclam-mode ()
-(interactive)
-(cond
-    ((proof-string-match "\\.def$" (buffer-file-name))
-    (thy-mode))
-    (t
-    (lclam-proofscript-mode)))
-)
-
-;; Hook which configures settings to get the proof shell running 
-
-(add-hook 'proof-pre-shell-start-hook 'lclam-pre-shell-start)
-
-(defun lclam-pre-shell-start ()
-  (setq proof-prog-name         lclam-prog-name)
-  (setq proof-mode-for-shell    'lclam-shell-mode)
-  (setq proof-mode-for-response 'lclam-response-mode)
-  (setq proof-mode-for-goals    'lclam-goals-mode)
-  (setq proof-shell-process-connection-type t))
-
-
-;;
-;; ============ Extra bits and pieces - JB ============
-;;
-
-;; Open .def files in theory mode from now on
-
-(setq auto-mode-alist
-      (cons '("\\.def$" . thy-mode) auto-mode-alist))
-
-;; Remove redundant toolbar buttons
-
-(eval-after-load "pg-custom"
-'(progn
-  (setq lclam-toolbar-entries
-       (remassoc 'state lclam-toolbar-entries))
-  (setq lclam-toolbar-entries
-       (remassoc 'context lclam-toolbar-entries))
-  (setq lclam-toolbar-entries
-       (remassoc 'undo lclam-toolbar-entries))
-  (setq lclam-toolbar-entries
-       (remassoc 'retract lclam-toolbar-entries))
-  (setq lclam-toolbar-entries
-       (remassoc 'qed lclam-toolbar-entries))))
-
-;;
-;; ============ Theory file mode ==============
-;;
-
-(define-derived-mode thy-mode fundamental-mode "Lambda-CLAM theory file mode"
-  (thy-add-menus))
-
-(defvar thy-mode-map nil)
-
-(defun thy-add-menus ()
-  "Add Lambda-CLAM menu to current menu bar."  
-  (require 'proof-script)    
-  (require 'proof-x-symbol)
-  (easy-menu-define thy-mode-pg-menu
-                    thy-mode-map
-                    "PG Menu for Lambda-CLAM Proof General"
-                    (cons proof-general-name
-                          (append
-                           (list
-                           ;; A couple from the toolbar that make sense here
-                           ;; (also in proof-universal-keys)
-                            ["Issue command" proof-minibuffer-cmd t]
-                            ["Interrupt prover" proof-interrupt-process t])
-                          (list proof-buffer-menu)
-                           (list proof-help-menu))))
-
-  (easy-menu-define thy-mode-lclam-menu
-                    thy-mode-map
-                    "Menu for Lambda-CLAM Proof General, theory file mode."
-                    (cons "Theory"
-                          (list
-                           ["Next section" thy-goto-next-section t]
-                           ["Prev section" thy-goto-prev-section t]
-                           ["Insert template" thy-insert-template t]
-; da: commented out this, function is incomplete
-;                           ["Include definitions" match-and-assert-defs
-;                            :active (proof-locked-region-empty-p)]
-                           ["Process theory" process-thy-file
-                            :active (proof-locked-region-empty-p)]
-; da: commented out this, there's no retract function provided
-;                           ["Retract theory" isa-retract-thy-file
-;                            :active (proof-locked-region-full-p)]
-                           ["Next error" proof-next-error t]
-                           ["Switch to script" thy-find-other-file t])))
-
-  (easy-menu-add thy-mode-pg-menu thy-mode-map)
-  (easy-menu-add thy-mode-lclam-menu thy-mode-map)
-)
-
-(defun process-thy-file (file)
-  "Process the theory file FILE.  If interactive, use buffer-file-name."
-  (interactive (list buffer-file-name))
-  (save-some-buffers)
-  (update-thy-only file nil nil))
-
-(defun update-thy-only (file try wait)
-  "Process the theory file FILE."
-  ;; First make sure we're in the right directory to take care of
-  ;; relative "files" paths inside theory file.
-  (proof-cd-sync)
-  (proof-shell-invisible-command
-   (proof-format-filename
-    ;; %r parameter means relative (don't expand) path
-    (format "use_thy \"%s%%r\"." (if try "try_" ""))
-    (file-name-nondirectory file))
-   wait))
-
-;(defun match-and-assert-defs
-;  "Interactively process and assert definitions in theory file"
-;)
-
-(provide 'lclam)
diff --git a/obsolete/plastic/README b/obsolete/plastic/README
deleted file mode 100644
index 881f5b5dbc..0000000000
--- a/obsolete/plastic/README
+++ /dev/null
@@ -1,12 +0,0 @@
-Plastic Proof General
-
-Written by Paul Callaghan
-
-Status:                  under development together with Plastic
-Maintainer:      Paul Callaghan
-Plastic homepage: http://www.dur.ac.uk/CARG/plastic.html
-
-========================================
-
-$Id$
-
diff --git a/obsolete/plastic/plastic-syntax.el 
b/obsolete/plastic/plastic-syntax.el
deleted file mode 100644
index c259a3b764..0000000000
--- a/obsolete/plastic/plastic-syntax.el
+++ /dev/null
@@ -1,119 +0,0 @@
-;; plastic-syntax.el - Syntax of Plastic
-;; Author: Paul Callaghan <P.C.Callaghan@durham.ac.uk>
-;; Maintainer: <author>
-;; plastic-syntax.el,v 6.0 2001/09/03 12:11:56 da Exp
-
-;; adapted from the following, by Paul Callaghan
-;; ;; lego-syntax.el Syntax of LEGO
-;; ;; Copyright (C) 1994 - 1998 LFCS Edinburgh.
-;; ;; Author: Thomas Kleymann and Dilip Sequeira
-;; ;; Maintainer: Paul Callaghan <P.C.Callaghan@durham.ac.uk>
-;; ;; lego-syntax.el,v 2.10 1998/11/06 16:18:55 tms Exp
-
-
-(require 'proof-syntax)
-
-;; ----- keywords for font-lock.
-
-(defconst plastic-keywords-goal '("$?Goal"))
-
-(defconst plastic-keywords-save '("$?Save" "SaveFrozen" "SaveUnfrozen"))
-
-(defconst plastic-commands
-  (append plastic-keywords-goal plastic-keywords-save
-         '("allE" "allI" "andE" "andI" "Assumption" "Claim" "Coercion"
-           "Cut" "Discharge" "DischargeKeep"
-           "echo" "exE" "exI" "Expand" "ExpAll"
-           "ExportState" "Equiv" "For" "Freeze" "Hnf" "Immed"
-           "impE" "impI" "Induction" "Inductive"
-           "Invert" "Init" "intros" "Intros" "Module" "Next"
-           "Normal" "notE" "notI" "orE" "orIL" "orIR" "qnify" "Qnify"
-           "Qrepl" "Record" "Refine" "Repeat" "Return" "ReturnAll"
-           "Try" "Unfreeze"))
-  "Subset of Plastic keywords and tacticals which are terminated by a \?;")
-
-(defconst plastic-keywords
-  (append plastic-commands
-         '("Constructors" "Double" "ElimOver" "Fields" "Import" "Inversion"
-           "NoReductions" "Parameters" "Relation" "Theorems")))
-
-(defconst plastic-tacticals '("Then" "Else" "Try" "Repeat" "For"))
-
-;; ----- regular expressions for font-lock
-(defconst plastic-error-regexp "^\\(FAIL\\)"
-  "A regular expression indicating that the Plastic process has identified an 
error.")
-
-(defvar plastic-id proof-id)
-
-(defvar plastic-ids (concat plastic-id "\\(\\s *,\\s *" plastic-id "\\)*")
-  "*For font-lock, we treat \",\" separated identifiers as one identifier
-  and refontify commata using \\{plastic-fixup-change}.")
-
-(defconst plastic-arg-list-regexp "\\s *\\(\\[[^]]+\\]\\s *\\)*"
-  "Regular expression maching a list of arguments.")
-
-(defun plastic-decl-defn-regexp (char)
-    (concat "\\[\\s *\\(" plastic-ids "\\)" plastic-arg-list-regexp char))
-; Examples
-;              ^        ^^^^        ^^^^^^^^^^^^^^^^^^^^^^^  ^^^^
-;              [        sort                                 =
-;              [        sort        [n:nat]                  =
-;              [        sort        [abbrev=...][n:nat]      =
-
-(defconst plastic-definiendum-alternative-regexp
-  (concat "\\(" plastic-id "\\)" plastic-arg-list-regexp "\\s * ==")
-  "Regular expression where the first match identifies the definiendum.")
-
-(defvar plastic-font-lock-terms
-  (list
-
-   ; lambda binders
-     (list (plastic-decl-defn-regexp "[:|?]") 1
-          'proof-declaration-name-face)
-
-     ; let binders
-     (list plastic-definiendum-alternative-regexp 1 
'font-lock-function-name-face)
-     (list (plastic-decl-defn-regexp "=") 1 'font-lock-function-name-face)
-
-     ; Pi and Sigma binders
-     (list (concat "[{<]\\s *\\(" plastic-ids "\\)") 1
-          'proof-declaration-name-face)
-
-     ;; Kinds
-     (cons (concat "\\<Prop\\>\\|\\<Type\\s *\\(("
-                  plastic-id ")\\)?") 'font-lock-type-face))
-  "*Font-lock table for Plastic terms.")
-
-;; Instead of "[^:]+", it may be better to use "plastic-id". Furthermore,
-;; it might be safer to append "\\s-*:".
-(defconst plastic-goal-with-hole-regexp
-  (concat "\\(" (proof-ids-to-regexp plastic-keywords-goal) 
"\\)\\s-+\\([^:]+\\)")
-  "Regular expression which matches an entry in `plastic-keywords-goal'
-  and the name of the goal.")
-
-(defconst plastic-save-with-hole-regexp
-  (concat "\\(" (proof-ids-to-regexp plastic-keywords-save) 
"\\)\\s-+\\([^;]+\\)")
-  "Regular expression which matches an entry in
-  `plastic-keywords-save' and the name of the goal.")
-
-(defvar plastic-font-lock-keywords-1
-   (append
-    plastic-font-lock-terms
-    (list
-     (cons (proof-ids-to-regexp plastic-keywords) 'font-lock-keyword-face)
-     (cons (proof-ids-to-regexp plastic-tacticals) 'proof-tacticals-name-face)
-     (list plastic-goal-with-hole-regexp 2 'font-lock-function-name-face)
-     (list plastic-save-with-hole-regexp 2 'font-lock-function-name-face))))
-
-(defun plastic-init-syntax-table ()
-  "Set appropriate values for syntax table in current buffer."
-
-  (modify-syntax-entry ?_ "_")
-  (modify-syntax-entry ?\' "_")
-  (modify-syntax-entry ?\| ".")
-  (modify-syntax-entry ?\* ". 23")
-  (modify-syntax-entry ?\( "()1")
-  (modify-syntax-entry ?\) ")(4"))
-
-
-(provide 'plastic-syntax)
diff --git a/obsolete/plastic/plastic.el b/obsolete/plastic/plastic.el
deleted file mode 100644
index 39f6c01f45..0000000000
--- a/obsolete/plastic/plastic.el
+++ /dev/null
@@ -1,665 +0,0 @@
-;; plastic.el  - Major mode for Plastic proof assistant
-;;
-;; Portions © Copyright 2018  Free Software Foundation, Inc.
-;;
-;; Author: Paul Callaghan <P.C.Callaghan@durham.ac.uk>
-;;
-;; $Id$
-
-;; NOTES:
-;;     remember to prefix all potential cmds with plastic-lit-string
-;;     alternative is to fix the filtering
-
-
-(require 'proof)
-
-(require 'cl-lib)                       ;cl-member-if
-(eval-when-compile
-  (require 'span)
-  (require 'proof-syntax)
-  (require 'outline))
-(defvar plastic-keymap)                 ;FIXME: Not defined anywhere!
-
-(require 'plastic-syntax)
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; User Configuration ;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-;; I believe this is standard for Linux under RedHat -tms
-(defcustom plastic-tags "TO BE DONE"
-  "*The directory of the TAGS table for the Plastic library"
-  :type 'file
-  :group 'plastic)
-
-(defcustom plastic-test-all-name "need_a_global_lib"
-  "*The name of the LEGO module which inherits all other modules of the
-  library."
-  :type 'string
-  :group 'plastic)
-
-(eval-and-compile
-(defvar plastic-lit-string
-  ">"
-  "*Prefix of literate lines. Set to empty string to get non-literate mode"))
-
-(defcustom plastic-help-menu-list
-  '(["The PLASTIC Reference Card" (browse-url plastic-www-refcard) t]
-    ["The PLASTIC library (WWW)" (browse-url plastic-library-www-page)  t])
-  "List of menu items, as defined in `easy-menu-define' for Plastic
-  specific help."
-  :type '(repeat sexp)
-  :group 'plastic)
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; Configuration of Generic Proof Package ;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Users should not need to change this.
-
-(defvar plastic-shell-handle-output
-  (lambda (cmd string) 
-    (when (proof-string-match "^Module" cmd)
-      ;; prevent output and just give a minibuffer message
-      (setq proof-shell-last-output-kind 'systemspecific)
-      (message "Imports done!")))
-  "Acknowledge end of processing import declarations.")
-
-(defconst plastic-process-config
-  (concat plastic-lit-string
-         " &S ECHO No PrettyPrinting configuration implemented;\n")
-  "Command to enable pretty printing of the Plastic process.
-   Proof-General annotations triggered by a cmd-line opt
-  ")
-
-(defconst plastic-pretty-set-width "&S ECHO no PrettyWidth ;\n"
-  "Command to adjust the linewidth for pretty printing of the Plastic
-  process.")
-
-(defconst plastic-interrupt-regexp "Interrupt.."
-  "Regexp corresponding to an interrupt")
-
-
-;; ----- web documentation
-
-(defcustom plastic-www-home-page "http://www.dur.ac.uk/CARG/plastic.html";
-  "Plastic home page URL."
-  :type 'string
-  :group 'plastic)
-
-(defcustom plastic-www-latest-release
-  (concat plastic-www-home-page "/current")
-  "The WWW address for the latest Plastic release."
-  :type 'string
-  :group 'plastic)
-
-(defcustom plastic-www-refcard
-  plastic-www-home-page
-  "URL for the Plastic reference card."
-  :type 'string
-  :group 'plastic)
-
-(defcustom plastic-library-www-page
-  (concat plastic-www-home-page "/library")
-  "The HTML documentation of the Plastic library."
-  :type 'string
-  :group 'plastic)
-
-
-
-;; ----- plastic-shell configuration options
-
-(defcustom plastic-base
-  "/usr/local/plastic"
-  ;; da: was
-  ;; "PLASTIC_BASE:TO_BE_CUSTOMISED"
-  "*base dir of plastic distribution"
-  :type 'string
-  :group 'plastic)
-
-(defvar plastic-prog-name
-  (concat plastic-base "/bin/plastic")
-  "*Name of program to run as plastic.")
-
-(defun plastic-set-default-env-vars ()
-  "defaults for the expected lib vars."
-  (cond
-    ((not (getenv "PLASTIC_LIB"))
-               (setenv "PLASTIC_LIB" (concat plastic-base "/lib"))
-               (setenv "PLASTIC_TEST" (concat plastic-base "/test"))
-       )))
-
-(defvar plastic-shell-cd
-  (concat plastic-lit-string " &S ECHO no cd ;\n")
-  "*Command of the inferior process to change the directory.")
-
-(defvar plastic-shell-proof-completed-regexp "\\*\\*\\* QED \\*\\*\\*"
-  "*Regular expression indicating that the proof has been completed.")
-
-(defvar plastic-save-command-regexp
-  (concat "^" (proof-ids-to-regexp plastic-keywords-save)))
-(defvar plastic-goal-command-regexp
-  (concat "^" (proof-ids-to-regexp plastic-keywords-goal)))
-
-(defvar plastic-kill-goal-command
-  (concat plastic-lit-string " &S ECHO KillRef not applicable;"))
-(defvar plastic-forget-id-command
-  (concat plastic-lit-string " &S Forget "))
-
-(defvar plastic-undoable-commands-regexp
-  (proof-ids-to-regexp '("Refine" "Intros" "intros" "Normal" "Claim" "Immed"))
-  "Undoable list")
-
-;; "Dnf" "Refine" "Intros" "intros" "Next" "Normal"
-;;   "Qrepl" "Claim" "For" "Repeat" "Succeed" "Fail" "Try" "Assumption"
-;;   "UTac" "Qnify" "qnify" "andE" "andI" "exE" "exI" "orIL" "orIR" "orE" 
"ImpI"
-;;   "impE" "notI" "notE" "allI" "allE" "Expand" "Induction" "Immed"
-;;   "Invert"
-
-;; ----- outline
-
-(defvar plastic-goal-regexp "\\?\\([0-9]+\\)")
-
-(defvar plastic-outline-regexp
-  (concat "[[*]\\|"
-         (proof-ids-to-regexp
-          '("Discharge" "DischargeKeep" "Freeze" "$?Goal" "Module" "Record" 
"Inductive"
-     "Unfreeze"))))
-
-(defvar plastic-outline-heading-end-regexp ";\\|\\*)")
-
-(defvar plastic-shell-outline-regexp plastic-goal-regexp)
-(defvar plastic-shell-outline-heading-end-regexp plastic-goal-regexp)
-
-(defvar plastic-error-occurred
-       nil
-       "flag for whether undo is required for try or minibuffer cmds")
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;   Derived modes - they're here 'cos they define keymaps 'n stuff ;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(define-derived-mode plastic-shell-mode proof-shell-mode
-   "plastic-shell"
-   ;; With nil argument for docstring, Emacs makes up a nice one.
-   nil
-   (plastic-shell-mode-config))
-
-(define-derived-mode plastic-mode proof-mode
-   "Plastic script"
-     "Major mode for Plastic proof scripts.
-
-\\{plastic-mode-map}"
-   (plastic-mode-config)
-   (easy-menu-change (list proof-general-name) (car proof-help-menu)
-                    (append (cdr proof-help-menu) plastic-help-menu-list)))
-
-(eval-and-compile
-  (define-derived-mode plastic-response-mode proof-response-mode
-    "PlasticResp" nil
-    (setq font-lock-keywords plastic-font-lock-terms)
-    (plastic-init-syntax-table)
-    (proof-response-config-done)))
-
-(define-derived-mode plastic-goals-mode proof-goals-mode
-  "PlasticGoals" "Plastic Goal State"
-  (plastic-goals-mode-config))
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;   Code that's plastic specific                                      ;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(defun plastic-count-undos (span)
-  "This is how to work out what the undo commands are.
-Given is the first SPAN which needs to be undone."
-  (let ((ct 0) string i
-       (tl (length proof-terminal-string)))
-    (while span
-      (setq string (span-property span 'cmd))
-      (plastic-preprocessing)                  ;; dynamic scope, on string
-      (cond ((eq (span-property span 'type) 'vanilla)
-            (if (or (proof-string-match plastic-undoable-commands-regexp 
string)
-                    (and (proof-string-match "Equiv" string)
-                         (not (proof-string-match "Equiv\\s +[TV]Reg" 
string))))
-                (setq ct (+ 1 ct))))
-           ((eq (span-property span 'type) 'pbp)
-            (setq i 0)
-            (while (< i (length string))
-              (if (string-equal (substring string i (+ i tl)) 
proof-terminal-string)
-                  (cl-incf ct))
-              (setq i (+ 1 i)))))
-      (setq span (next-span span 'type)))
-    (list (concat plastic-lit-string 
-                 " &S Undo x" (int-to-string ct) proof-terminal-string))))
-
-(defun plastic-goal-command-p (span)
-  "Decide whether argument is a goal or not"                   ;; NEED CHG.
-  (proof-string-match plastic-goal-command-regexp
-                     (or (span-property span 'cmd) "")))
-
-(defun plastic-find-and-forget (span)
-       ;; count the number of spans to undo.
-       ;; all spans are equal...
-    ;; (NB the 'x' before the id is required so xNN looks like an id,
-    ;;  so that Undo can be implemented via the tmp_cmd route.)
-  (let (string (spans 0))
-    (while span
-      ;; FIXME da: should probably ignore comments/proverproc here?
-      (setq string (span-property span 'cmd))
-      (plastic-preprocessing)          ;; dynamic scope, on string
-
-      (cond
-        ((null string) nil)
-        ((or (string-match "^\\s-*import" string)
-             (string-match "^\\s-*test" string)
-             (string-match "^\\s-*\\$" string)
-             (string-match "^\\s-*#" string))
-         
-         ; da: put this instead of XEmacs code
-         (message "Can't Undo imports yet!  You must exit Plastic for this!")
-       ;    (popup-dialog-box
-       ;       (list (concat "Can't Undo imports yet\n"
-       ;                          "You have to exit Plastic for this\n")
-       ;             ["ok, I'll do this" (lambda () t) t]))
-           (cl-return)  ;FIXME: No enclosing block?!
-          )    ;; warn the user that undo of imports not yet working.
-        (t (cl-incf spans))
-      )
-      (setq span (next-span span 'type))
-
-    )
-    (list (concat plastic-lit-string 
-                 " &S Undo x" (int-to-string spans) 
-                 proof-terminal-string))))
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;   Other stuff which is required to customise script management   ;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(defun plastic-goal-hyp ()             ;; not used.
-  (cond
-   ((looking-at plastic-goal-regexp)
-    (cons 'goal (match-string 1)))
-   ((looking-at proof-shell-assumption-regexp)
-    (cons 'hyp (match-string 1)))
-   (t nil)))
-
-
-;; NEED TO REFINE THIS (may99)
-
-(defun plastic-state-preserving-p (cmd)
-  (not (proof-string-match plastic-undoable-commands-regexp cmd)))
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;   Commands specific to plastic                                      ;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(eval-after-load "plastic" ;; da: so that plastic-lit-string can be changed
-  '(progn
-     (eval `(proof-defshortcut plastic-Intros
-                              ,(concat plastic-lit-string "Intros ")  
[(control i)]))
-     (eval `(proof-defshortcut plastic-Refine
-                              ,(concat plastic-lit-string "Refine ")  
[(control r)]))
-     (eval `(proof-defshortcut plastic-ReturnAll
-                              ,(concat plastic-lit-string "ReturnAll ") 
[(control u)]))))
-
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;   Plastic shell startup and exit hooks                              ;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(defvar plastic-shell-current-line-width nil
-  "Current line width of the Plastic process's pretty printing module.
-  Its value will be updated whenever the corresponding screen gets
-  selected.")
-
-;; The line width needs to be adjusted if the PLASTIC process is
-;; running and is out of sync with the screen width
-
-(defun plastic-shell-adjust-line-width ()
-  "Use Plastic's pretty printing facilities to adjust output line width.
-   Checks the width in the `proof-goals-buffer'
-   ACTUALLY - still need to work with this. (pcc, may99)"
-   (and (proof-shell-live-buffer)
-       (proof-with-current-buffer-if-exists proof-goals-buffer
-       (let ((current-width
-              ;; Actually, one might sometimes
-              ;; want to get the width of the proof-response-buffer
-              ;; instead. Never mind.
-              (window-width (get-buffer-window proof-goals-buffer t))))
-
-          (if (equal current-width plastic-shell-current-line-width) ()
-            ; else
-            (setq plastic-shell-current-line-width current-width)
-            (set-buffer proof-shell-buffer)
-            (insert (format plastic-pretty-set-width (- current-width 1)))
-            )))))
-
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;   Configuring proof mode and setting up various utilities  ;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(defun plastic-mode-config ()
-
-  (setq proof-terminal-string ";")
-  (setq proof-script-comment-start "(*")                       ;; these still 
active
-  (setq proof-script-comment-end "*)")
-
-  (setq proof-prog-name (concat plastic-prog-name ""))
-  (setenv "PROOF_GENERAL" "") ;; signal to plastic, use annotations
-
-  (setq proof-assistant-home-page plastic-www-home-page)
-
-  (setq proof-showproof-command (concat plastic-lit-string " &S PrfCtxt")
-       proof-goal-command      (concat plastic-lit-string " Claim %s;")
-       proof-save-command      (concat plastic-lit-string " Save %s;") ;; 
analogue?
-       proof-context-command   (concat plastic-lit-string " &S Ctxt 20"))
-
-  (setq proof-showproof-command  (concat plastic-lit-string " &S PrfCtxt")
-       proof-goal-command   (concat plastic-lit-string " Claim %s;")
-       proof-save-command   (concat plastic-lit-string " Save %s;") ;; 
analogue?
-       proof-context-command  (concat plastic-lit-string " &S Ctxt 20")
-          ;; show 20 things; see ^c+C...
-       proof-info-command   (concat plastic-lit-string " &S Help"))
-
-  (setq proof-goal-command-p 'plastic-goal-command-p
-       proof-count-undos-fn 'plastic-count-undos
-       proof-find-and-forget-fn 'plastic-find-and-forget
-       pg-topterm-goalhyplit-fn 'plastic-goal-hyp
-       proof-state-preserving-p 'plastic-state-preserving-p)
-
-  (setq        proof-save-command-regexp plastic-save-command-regexp
-       proof-goal-command-regexp plastic-goal-command-regexp
-       proof-save-with-hole-regexp plastic-save-with-hole-regexp
-       proof-goal-with-hole-regexp plastic-goal-with-hole-regexp
-       proof-kill-goal-command plastic-kill-goal-command
-       proof-indent-any-regexp
-       (proof-regexp-alt
-        (proof-ids-to-regexp plastic-commands)
-        "\\s(" "\\s)"))
-
-  (plastic-init-syntax-table)
-
-  ;; da: I've moved these out of proof-config-done in proof-script.el
-  (setq pbp-goal-command (concat "UNIMPLEMENTED"))
-  (setq pbp-hyp-command (concat "UNIMPLEMENTED"))
-
-;; font-lock
-
-  (set proof-script-font-lock-keywords plastic-font-lock-keywords-1)
-
-  (proof-config-done)
-
-;; outline
-
-  (make-local-variable 'outline-regexp)
-  (setq outline-regexp plastic-outline-regexp)
-
-  (make-local-variable 'outline-heading-end-regexp)
-  (setq outline-heading-end-regexp plastic-outline-heading-end-regexp)
-
-;; tags
-  (cond ((boundp 'tags-table-list)
-        (make-local-variable 'tags-table-list)
-        (setq tags-table-list (cons plastic-tags tags-table-list))))
-
-  (and (boundp 'tag-table-alist)
-       (setq tag-table-alist
-            (append '(("\\.lf$"   . plastic-tags)
-                      ("plastic"  . plastic-tags))
-                    tag-table-alist)))
-
-  (set (make-local-variable 'blink-matching-paren-dont-ignore-comments) t)
-
-;; hooks and callbacks
-
-  (add-hook 'proof-shell-insert-hook       'plastic-shell-adjust-line-width)
-  (add-hook 'proof-shell-handle-error-or-interrupt-hook 'plastic-had-error)
-  (add-hook 'proof-shell-insert-hook       'plastic-preprocessing)
-
-;; (add-hook 'proof-shell-handle-error-or-interrupt-hook
-;; (lambda()(goto-char (search-forward (regexp-quote proof-terminal-char)))))
-
-;;  (add-hook 'proof-shell-handle-delayed-output-hook 
`plastic-show-shell-buffer t)
-;; this forces display of shell-buffer after each cmd, rather than goals-buffer
-;; it is not always necessary - could always add it as a toggle option?
-
-;; set up the env.
-  (plastic-set-default-env-vars)
-  )
-
-(defun plastic-show-shell-buffer ()
-   "switch buffers."
-   (display-buffer proof-shell-buffer)
-   )
-
-
-(defun plastic-equal-module-filename (module filename)
-  "Returns `t' if MODULE is equal to the FILENAME and `nil' otherwise.
-The directory and extension is stripped of FILENAME before the test."
-  (equal module
-        (file-name-sans-extension (file-name-nondirectory filename))))
-
-(defun plastic-shell-compute-new-files-list ()
-  "Function to update `proof-included-files list'.
-Value for `proof-shell-compute-new-files-list', which see.
-
-For Plastic, we assume that module identifiers coincide with file names."
-  (let ((module (match-string 1)))
-    (cdr (cl-member-if
-         (lambda (filename) (plastic-equal-module-filename module filename))
-         proof-included-files-list))))
-
-
-
-(defun plastic-shell-mode-config ()
-  (setq proof-shell-cd-cmd plastic-shell-cd
-       proof-shell-proof-completed-regexp plastic-shell-proof-completed-regexp
-       proof-shell-error-regexp plastic-error-regexp
-       proof-shell-interrupt-regexp plastic-interrupt-regexp
-       ;; DEAD proof-shell-noise-regexp "Discharge\\.\\. "
-       proof-shell-assumption-regexp plastic-id
-       proof-shell-start-goals-regexp plastic-goal-regexp
-       pg-subterm-first-special-char ?\360
-       pg-subterm-start-char ?\372
-       pg-subterm-sep-char ?\373
-       pg-subterm-end-char ?\374
-       pg-topterm-regexp "\375"
-       proof-shell-eager-annotation-start "\376"
-       ;; FIXME da: if p-s-e-a-s is implemented, you should set
-       ;; proof-shell-eager-annotation-start-length=1 to
-       ;; avoid possibility of duplicating short messages.
-       proof-shell-eager-annotation-end "\377"
-
-       proof-shell-annotated-prompt-regexp "LF> \371"
-       proof-shell-result-start "\372 Pbp result \373"
-       proof-shell-result-end "\372 End Pbp result \373"
-       proof-shell-start-goals-regexp "\372 Start of Goals \373"
-       proof-shell-end-goals-regexp "\372 End of Goals \373"
-
-       proof-shell-init-cmd plastic-process-config
-       proof-shell-restart-cmd plastic-process-config
-       pg-subterm-anns-use-stack nil
-       proof-shell-handle-output-system-specific plastic-shell-handle-output
-       plastic-shell-current-line-width nil
-
-       proof-shell-process-file
-       (cons "Creating mark \"\\(.*\\)\" \\[\\(.*\\)\\]"
-             (lambda () (let ((match (match-string 2)))
-                             (if (equal match "") match
-                               (concat 
-                                (file-name-sans-extension match) ".lf")))))
-
-       proof-shell-retract-files-regexp "forgot back through Mark \"\\(.*\\)\""
-       ;; DEAD: proof-shell-font-lock-keywords plastic-font-lock-keywords-1
-
-       proof-shell-compute-new-files-list 
'plastic-shell-compute-new-files-list)
-
-  (plastic-init-syntax-table)
-
-  (proof-shell-config-done)
-  )
-
-(defun plastic-goals-mode-config ()
-  (setq pg-goals-change-goal "Next %s;"
-       pg-goals-error-regexp plastic-error-regexp)
-  (setq proof-goals-font-lock-keywords plastic-font-lock-terms)
-  (plastic-init-syntax-table)
-  (proof-goals-config-done))
-
-
-
-;;;;;;;;;;;;;;;;;
-;; MY new additions.
-
-(defun plastic-small-bar () (interactive) (insert 
"%------------------------------\n"))
-
-(defun plastic-large-bar () (interactive) (insert 
"%-------------------------------------------------------------------------------\n"))
-
-(defun plastic-preprocessing () ;; NB: dynamic scoping of string
-   "clear comments and remove literate marks (ie, \\n> ) - acts on var string"
-
-   (with-no-warnings
-   ;; might want to use proof-string-match here if matching is going
-   ;; to be case sensitive (see docs)
-
-   (if (= 0 (length plastic-lit-string))
-       string                          ; no-op if non-literate
-                                       ; remaining lines are the
-                                       ; Else. (what, no 'return'?)
-   (setq string (concat "\n" string " "))   ;; seed routine below, & extra char
-   (let* ;; da: let* not really needed, added to nuke byte-comp warnings.
-       (x
-       (i 0)
-       (l (length string))
-       (eat-rest (lambda ()
-                   (aset string i ?\ )  ;; kill the \n or "-" at least
-                   (cl-incf i)
-                   (while (and (< i l) (/= (aref string i) ?\n))
-                     (aset string i ?\ )
-                     (cl-incf i) )))
-       (keep-rest (lambda ()
-                    (cl-loop for x in (string-to-list plastic-lit-string)
-                             do (aset string i ?\ ) (cl-incf i))
-                    (while (and (< i l)
-                                (/= (aref string i) ?\n)
-                                (/= (aref string i) ?-))
-                      (cl-incf i) ))))
-     (while (< i l)
-       (cond
-       ((eq 0 (string-match "--" (substring string i)))
-        (funcall eat-rest))            ; comment.
-       ((eq 0 (string-match "\n\n" (substring string i)))
-        (aset string i ?\ )
-        (cl-incf i))                   ; kill repeat \n
-       ((= (aref string i) ?\n)        ; start of new line
-        (aset string i ?\ ) (cl-incf i)        ; remove \n
-        (if (eq 0 (string-match plastic-lit-string
-                                (substring string i)))
-            (funcall keep-rest)        ; code line.
-          (funcall eat-rest)           ; non-code line
-          ))
-       (t
-        (cl-incf i))))                 ; else include.
-     (setq string (replace-regexp-in-string "  +" " " string))
-     (setq string (replace-regexp-in-string "^ +" "" string))
-   (if (string-match "^\\s-*$" string)
-       (setq string (concat "ECHO comment line" proof-terminal-string))
-     string)))))
-
-
-(defun plastic-all-ctxt ()
-       "show the full ctxt"
-       (interactive)
-       (proof-shell-invisible-command
-             (concat plastic-lit-string " &S Ctxt" proof-terminal-string))
-       )
-
-(defun plastic-send-one-undo ()
-       "send an Undo cmd"
-    ;; FIXME etc
-    ;; is like this because I don't want the undo output to be shown.
-    (proof-shell-insert (concat plastic-lit-string " &S Undo;")
-                       'proof-done-invisible))
-
-;; hacky expt version.
-;; still don't understand the significance of cmd!
-
-(defun plastic-minibuf-cmd (cmd)
-    "do minibuffer cmd then undo it, if error-free."
-    (interactive
-     (list (read-string "Command: " nil 'proof-minibuffer-history)))
-    (print "hello")
-    (plastic-reset-error)
-    (if (and proof-state-preserving-p
-          (not (funcall proof-state-preserving-p cmd)))
-      (error "Command is not state preserving, I won't execute it!"))
-    (proof-shell-invisible-command cmd)
-    (plastic-call-if-no-error 'plastic-send-one-undo))
-
-(defun plastic-minibuf ()
-    "do minibuffer cmd then undo it, if error-free."
-    (interactive)
-    (plastic-reset-error)
-    (plastic-send-minibuf)
-    (plastic-call-if-no-error 'plastic-send-one-undo))
-
-(defun plastic-synchro ()
-    "do minibuffer cmd BUT DON'T UNDO IT - use if things go wrong!"
-    (interactive)
-    (plastic-send-minibuf))
-
-(defun plastic-send-minibuf ()
-    "take cmd from minibuffer - see doc for proof-minibuffer-cmd"
-    (interactive)
-    (let (cmd)
-       (setq cmd (read-string "Command: " nil 'proof-minibuffer-history))
-       (setq cmd (concat plastic-lit-string " " cmd proof-terminal-string))
-       (proof-shell-invisible-command cmd)))
-
-(defun plastic-had-error ()
-    "sets var plastic-error-occurred, called from hook"
-    (if (eq proof-shell-error-or-interrupt-seen 'error)
-       (setq plastic-error-occurred t)))
-(defun plastic-reset-error ()
-    "UNsets var plastic-error-occurred, before minibuffer or try cmd"
-    (setq plastic-error-occurred nil))
-(defun plastic-call-if-no-error (fn)
-    "wait for proof process to be idle, and call fn if error-free."
-    (while proof-shell-busy (sleep-for 0.25))
-    (if (not plastic-error-occurred) (funcall fn)))
-
-(defun plastic-show-shell ()
-    "shortcut to shell buffer"
-    (interactive)
-    (proof-switch-to-buffer proof-shell-buffer))
-
-(define-key plastic-keymap [(control s)] 'plastic-small-bar)
-(define-key plastic-keymap [(control l)] 'plastic-large-bar)
-(define-key plastic-keymap [(control c)] 'plastic-all-ctxt)
-(define-key plastic-keymap [(control v)] 'plastic-minibuf)
-(define-key plastic-keymap [(control o)] 'plastic-synchro)
-(define-key plastic-keymap [(control p)] 'plastic-show-shell)
-
-
-;; original end.
-
-;;;;;;;;;;;;;;;;;
-;; hacky overriding of the toolbar command and C-c C-v action
-;; my version handles literate characters.
-;; (should do better for long-term though)
-
-(defalias 'proof-toolbar-command 'plastic-minibuf)
-(defalias 'proof-minibuffer-cmd  'plastic-minibuf)
-       ;; the latter doesn't seem to work (pcc, 05aug02)
-
-;;;
-
-(provide 'plastic)
diff --git a/obsolete/plastic/test.lf b/obsolete/plastic/test.lf
deleted file mode 100644
index 7c163d3dbc..0000000000
--- a/obsolete/plastic/test.lf
+++ /dev/null
@@ -1,64 +0,0 @@
-EXAMPLE FILE: less than or equal on Nat
-
-%---------------------------------------
-Nat
-
-> Inductive
->      [Nat : Type]
->      Constructors
->      [zero : Nat]
->      [succ : (n:Nat)Nat];
-
-> [plus [m:Nat] = E_Nat ([_:Nat]Nat) m ([_:Nat]succ) ];
-
-
------------------------
-Non-dependent Pi type.
-
-> Inductive
->      [A,B:Type]
->      [Pi_ : Type]
->      Constructors
->      [La_ : (f:(x:El A)El B)Pi_ ];
-
-
-application of Pi_ types, ie conversion to a dependent product.
-
-> Claim ap_ : (A,B:Type) Pi_ A B -> A -> B;
-> Intros A B f x;
-> Refine E_Pi_ ? ? ([_:?]B);
-> Refine f;
-> Intros fo;
-> Refine fo x;
-> ReturnAll;
-> ap_;
-
-
-
-%---------------------------------------
-Combined leq with if-branch - thus avoiding Boolean type.
-
-Notice that we have to prove (Pi_ Nat T) by induction on x, since we can't
-eliminate over (Nat -> T) in LF. 
-
-
-> Claim if_leq : (x,y:Nat)(T:Type)T -> T -> T;
-> Intros x y T leq not_leq;
-> Refine ap_ ? ? (ap_ ? ? ? x) y;
-
-> Refine La_;
-> Intros x1;
-> Refine E_Nat ([_:?]Pi_ Nat T) ?x_z ?x_s x1;
-> x_z Refine La_ ? ? ([_:?]leq);
-> Intros x1_ f_x1_;
-> Refine La_;
-> Intros y1;
-> Refine E_Nat ([_:?]T) ?y_z ?y_s y1;
-> y_z Refine not_leq;
-> Intros y1_ _;
-> Refine ap_ ? ? f_x1_ y1_;
-> ReturnAll;
-
-> if_leq;
-
-
diff --git a/proof-general-pkg.el b/proof-general-pkg.el
deleted file mode 100644
index 53f3343240..0000000000
--- a/proof-general-pkg.el
+++ /dev/null
@@ -1,3 +0,0 @@
-(define-package "proof-general" "4.5-git"
-  "A generic front-end for proof assistants (interactive theorem provers)"
-  '((emacs "24.3")))
diff --git a/proof-general.el b/proof-general.el
index 5b4b6a562f..3dc15fa031 100644
--- a/proof-general.el
+++ b/proof-general.el
@@ -3,7 +3,7 @@
 ;; This file is part of Proof General.
 
 ;; Portions © Copyright 1994-2012  David Aspinall and University of Edinburgh
-;; Portions © Copyright 2003-2019  Free Software Foundation, Inc.
+;; Portions © Copyright 2003-2021  Free Software Foundation, Inc.
 ;; Portions © Copyright 2001-2017  Pierre Courtieu
 ;; Portions © Copyright 2010, 2016  Erik Martin-Dorel
 ;; Portions © Copyright 2011-2013, 2016-2017  Hendrik Tews
@@ -11,12 +11,13 @@
 
 ;; Authors: (see the AUTHORS file distributed along the sources)
 ;; URL: https://proofgeneral.github.io/
-;; Package-Requires: ((emacs "24.3"))
+;; Package-Requires: ((emacs "25.1"))
 ;; Version: 4.5-git
 
-;; This software is free software; you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License
-;; version 2, as published by the Free Software Foundation.
+;; The software is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; This program is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -69,8 +70,8 @@
   (require 'proof-site (expand-file-name "generic/proof-site" 
pg-init--pg-root)))
 
 (eval-when-compile
-  ;; FIXME: This is used during installation of the ELPA package:
-  ;; we presume that this file will be compiled before any of the files in
+  ;; FIXME: [ This is used during installation of the ELPA package ]
+  ;; We presume that this file will be compiled before any of the files in
   ;; sub-directories and we presume that all files are compiled within the same
   ;; session, so we here add to load-path all the subdirectories so
   ;; that files in (say) coq/ can (require 'coq-foo) and the compiler will find
@@ -78,11 +79,7 @@
   (let ((byte-compile-directories
          '("generic" "lib"
            "coq" "easycrypt" "pghaskell" "pgocaml" "pgshell" "phox"
-           ;; FIXME: These dirs used to not be listed, but I needed to add
-           ;; them for the compilation to succeed for me.  --Stef
-           ;; These dirs are now obsolete and not published on MELPA.  --Erik
-           ;; "isar" "lego" "twelf" "obsolete/plastic"
-       )))
+           )))
     (dolist (dir byte-compile-directories)
       (add-to-list 'load-path (expand-file-name dir pg-init--pg-root)))))
 
diff --git a/twelf/README b/twelf/README
deleted file mode 100644
index 2d91f558d3..0000000000
--- a/twelf/README
+++ /dev/null
@@ -1,27 +0,0 @@
-Twelf Proof General, for Twelf.
-
-Written by David Aspinall.
-
-Status:                not officially supported yet
-Maintainer:     volunteer required
-Twelf version:  Twelf 1.2 (and later, I hope)
-Twelf homepage: http://www.twelf.org
-
-========================================
-
-
-This is a "technology demonstration" of Proof General for Twelf.
-
-It has basic script management support, with some support for
-decoration taken from the present Twelf Emacs mode.
-
-There is support for X Symbol, but not using a proper token language,
-and it seems fairly broken because Twelf's syntax highlighting
-doesn't work properly with font lock.
-
-I have written this in the hope that somebody from the Twelf community
-will adopt it, maintain and improve it, and thus turn it into a proper
-instantiation of Proof General.
-
-$Id$
-
diff --git a/twelf/example.elf b/twelf/example.elf
deleted file mode 100644
index b428173495..0000000000
--- a/twelf/example.elf
+++ /dev/null
@@ -1,64 +0,0 @@
-%%% 
-%%% Example script for Twelf Proof General.
-%%%
-%%% $Id$
-%%%
-
-%%% Rather than a proof this file is just a signature,
-%%% bunch of declarations.  Would be nice to have something
-%%% closer to other systems for pedagogical purposes...
-%%% (i.e. proving commutativity of conjunction in ND fragment
-%%%  of this logic)
-
-%%% Intuitionistic propositional calculus
-%%% Positive fragment with implies, and, true.
-%%% Two formulations here: natural deduction and Hilbert-style system.
-%%% Author: Frank Pfenning
-
-% Type of propositions.
-o : type.
-%name o A.
-
-% Syntax: implication, plus a few constants.
-=> : o -> o -> o.  %infix right 10 =>.
-&  : o -> o -> o.  %infix right 11 &.
-true : o.
-
-% Provability.
-|- : o -> type.    %prefix 9 |-.
-%name |- P.
-
-% Axioms.
-K : |- A => B => A.
-S : |- (A => B => C) => (A => B) => A => C.
-ONE : |- true.
-PAIR : |- A => B => A & B.
-LEFT : |- A & B => A.
-RIGHT : |- A & B => B.
-
-% Inference Rule.
-MP : |- A => B -> |- A -> |- B. 
-
-% Natural Deduction.
-
-! : o -> type.   %prefix 9 !.
-%name ! D.
-
-trueI : ! true.
-andI  : ! A -> ! B -> ! A & B.
-andEL : ! A & B -> ! A.
-andER : ! A & B -> ! B.
-impliesI : (! A -> ! B) -> ! A => B.
-impliesE : ! A => B -> ! A -> ! B.
-
-% Normal deductions (for faster search)
-!^ : o -> type.
-!v : o -> type.
-
-trueI^ : !^ true.
-andI^ : !^ A -> !^ B -> !^ (A & B).
-andEvL : !v (A & B) -> !v A.
-andEvR : !v (A & B) -> !v B.
-impI^ : (!v A -> !^ B) -> !^ (A => B).
-impEv : !v (A => B) -> !^ A -> !v B.
-close : !v A -> !^ A.
diff --git a/twelf/twelf-font.el b/twelf/twelf-font.el
deleted file mode 100644
index 44e5468ebe..0000000000
--- a/twelf/twelf-font.el
+++ /dev/null
@@ -1,444 +0,0 @@
-;; twelf-font.el  Font lock configuration for Twelf
-;;
-;; Author: Frank Pfenning
-;;        Taken from Twelf's emacs mode and
-;;        adapted for Proof General by David Aspinall <David.Aspinall@ed.ac.uk>
-;;
-;; $Id$
-;;
-;;
-
-(require 'font-lock)
-
-;; FIXME da: integrate with PG's face mechanism?
-;; (but maybe keep twelf faces to help users)
-;; Also should add font locking.
-
-;; FIXME da: the twelf faces don't work with PG's
-;; background colouring, why?
-
-
-;; modify the syntax table so _ and ' are word constituents
-;; otherwise the regexp's for identifiers become very complicated
-;; FIXME: fn undef'd(set-word ?\_)
-;; FIXME: fn (set-word ?\')
-
-;; setting faces here...
-;; use devices to improve portability?
-;; make it dependent on light background vs dark background
-;; tie in X resources?
-
-(defun twelf-font-create-face (face from-face color)
-  "Creates a Twelf font from FROM-FACE with COLOR."
-  (make-face face)
-  ;(reset-face face)                   ; seems to be necessary, but why?
-  (copy-face from-face face)
-  (if color (set-face-foreground face color)))
-
-(defvar twelf-font-dark-background nil
-  "*T if the background of Emacs is to be considered dark.")
-
-;; currently we not using bold or italics---some font families
-;; work poorly with that kind of face.
-(cond (twelf-font-dark-background
-       (twelf-font-create-face 'twelf-font-keyword-face 'default nil)
-       (twelf-font-create-face 'twelf-font-comment-face 'font-lock-comment-face
-                            nil)
-       (twelf-font-create-face 'twelf-font-percent-key-face 'default "Plum")
-       (twelf-font-create-face 'twelf-font-decl-face 'default "Orange")
-       (twelf-font-create-face 'twelf-font-parm-face 'default "Orange")
-       (twelf-font-create-face 'twelf-font-fvar-face 'default "SpringGreen")
-       (twelf-font-create-face 'twelf-font-evar-face 'default "Aquamarine"))
-      (t
-       (twelf-font-create-face 'twelf-font-keyword-face 'default nil)
-       (twelf-font-create-face 'twelf-font-comment-face 'font-lock-comment-face
-                            nil)
-       (twelf-font-create-face 'twelf-font-percent-key-face 'default 
"MediumPurple")
-       (twelf-font-create-face 'twelf-font-decl-face 'default "FireBrick")
-       (twelf-font-create-face 'twelf-font-parm-face 'default "Green4")
-       (twelf-font-create-face 'twelf-font-fvar-face 'default "Blue1")
-       (twelf-font-create-face 'twelf-font-evar-face 'default "Blue4")))
-
-;; Note that the order matters!
-
-(defvar twelf-font-patterns
- '(
-   ;; delimited comments, perhaps should use different font
-   ;;("%{" "}%" comment)
-   (twelf-font-find-delimited-comment . twelf-font-comment-face)
-   ;; single-line comments
-   ;; replace \\W by \\s- for whitespace?
-   ("%\\W.*$" 0 twelf-font-comment-face)
-   ;; %keyword declarations
-   
("\\(%infix\\|%prefix\\|%prefix\\|%postfix\\|%name\\|%solve\\|%query\\|%mode\\|%terminates\\|%theorem\\|%prove\\).*$"
-    1 twelf-font-percent-key-face nil)
-   ;; keywords, omit punctuations for now.
-   ("\\(\\<<-\\>\\|\\<->\\>\\|\\<type\\>\\|\\<=\\>\\|\\<_\\>\\)"
-    ;; for LLF, no punctuation marks
-;;"\\(\\<<-\\>\\|\\<->\\>\\|\\<o-\\>\\|\\<-o\\>\\|\\<<T>\\>\\|\\<&\\>\\|\\^\\|()\\|\\<type\\>\\|\\<sigma\\>\\)"
-    ;; for LLF, with punctuation marks
-    
;;"\\([][:.(){},]\\|\\<<-\\>\\|\\<->\\>\\|\\<o-\\>\\|\\<-o\\>\\|\\<<T>\\>\\|\\<&\\>\\|\\^\\|()\\|\\<type\\>\\|\\<sigma\\>\\)"
-    ;; for Elf, no punction marks
-    ;;"\\(\\<<-\\>\\|\\<->\\>\\|\\<type\\>\\|\\<sigma\\>\\)"
-    ;; for Elf, including punctuation marks
-    ;;"\\([][:.(){}]\\|\\<<-\\>\\|\\<->\\>\\|\\<type\\>\\|\\<sigma\\>\\)"
-   . twelf-font-keyword-face)
-   ;; declared constants
-   (twelf-font-find-decl . twelf-font-decl-face)
-   ;; parameters
-   (twelf-font-find-parm . twelf-font-parm-face)
-   ;; quantified existentials
-   (twelf-font-find-evar . twelf-font-evar-face)
-   ;; lower-case identifiers (almost = constants)
-   ;;("\\<\\([a-z!&$^+/<=>?@~|#*`;,]\\|\\-\\|\\\\\\)\\w*\\>"
-   ;; nil black)
-   ;; upper-case identifiers (almost = variables)
-   ("\\<[A-Z_]\\w*\\>" . twelf-font-fvar-face)
-   ;; numbers and quoted identifiers omitted for now
-   )
- "Highlighting patterns for Twelf mode.
-This generally follows the syntax of the FONT-LOCK-KEYWORDS variable,
-but allows an arbitrary function to be called instead of just
-regular expressions."
- )
-
-(defun twelf-font-fontify-decl  ()
-  "Fontifies the current Twelf declaration."
-  (interactive)
-  (let* ((region (twelf-current-decl))
-        (start (nth 0 region))
-        (end (nth 1 region)))
-    (save-excursion
-      (font-lock-unfontify-region start end)
-      (twelf-font-fontify-region start end))))
-
-(defun twelf-font-fontify-buffer ()
-  "Fontitifies the current buffer as Twelf code."
-  (interactive)
-  (save-excursion
-    (font-lock-unfontify-region (point-min) (point-max)) ; t optional in XEmacs
-    (twelf-font-fontify-region (point-min) (point-max))))
-
-(defun twelf-font-unfontify ()
-  "Removes fontification from current buffer."
-  (interactive)
-  (font-lock-unfontify-region (point-min) (point-max)))        ; t optional in 
XEmacs
-
-(defvar font-lock-message-threshold 6000) ; in case we are running FSF Emacs
-
-(defun twelf-font-fontify-region (start end)
-  "Go through TWELF-FONT-PATTERNS, fontifying according to given functions"
-  (save-restriction
-    (narrow-to-region start end)
-    (if (and font-lock-verbose
-            (>= (- end start) font-lock-message-threshold))
-       (message "Fontifying %s... (semantically...)" (buffer-name)))
-    (let ((patterns twelf-font-patterns)
-         (case-fold-search nil)        ; in Twelf, never case-fold
-         (modified (buffer-modified-p)) ; for FSF Emacs 19
-         pattern
-         fun-or-regexp
-         instructions
-         face
-         match-index
-         allow-overlap-p
-         region)
-      (while patterns
-       (setq pattern (car patterns))
-       (setq patterns (cdr patterns))
-       (goto-char start)
-       (cond ((stringp pattern)
-              (setq match-index 0)
-              (setq face 'font-lock-keyword-face)
-              (setq allow-overlap-p nil))
-             ((listp pattern)
-              (setq fun-or-regexp (car pattern))
-              (setq instructions (cdr pattern))
-              (cond ((integerp instructions)
-                     (setq match-index instructions)
-                     (setq face 'font-lock-keyword-face)
-                     (setq allow-overlap-p nil))
-                    ((symbolp instructions)
-                     (setq match-index 0)
-                     (setq face instructions)
-                     (setq allow-overlap-p nil))
-                    ((listp instructions)
-                     (setq match-index (nth 0 instructions))
-                     (setq face (nth 1 instructions))
-                     (setq allow-overlap-p (nth 2 instructions)))
-                    (t (error "Illegal font-lock-keyword instructions"))))
-             (t (error "Illegal font-lock-keyword instructions")))
-       (cond ((symbolp fun-or-regexp)  ; a function to call
-              (while
-                  (setq region (funcall fun-or-regexp end))
-                ;; END is limit of forward search, start at point
-                ;; and move point
-                ;; check whether overlap is permissible!
-                (twelf-font-highlight (car region) (cdr region)
-                                    face allow-overlap-p)))
-             ((stringp fun-or-regexp)  ; a pattern to find
-              (while
-                  (re-search-forward fun-or-regexp end t)
-                (goto-char (match-end match-index)) ; back-to-back font hack
-                (twelf-font-highlight (match-beginning match-index)
-                                    (match-end match-index)
-                                    face
-                                    allow-overlap-p)))
-             (t (error "Illegal font-lock-keyword instructions"))))
-      ;; For FSF Emacs 19: mark buffer not modified, if it wasn't before
-      ;; fontification.
-      (and (not modified) (buffer-modified-p) (set-buffer-modified-p nil))
-      (if (and font-lock-verbose
-              (>= (- end start) font-lock-message-threshold))
-         (message "Fontifying %s... done" (buffer-name))))))
-
-(defun twelf-font-highlight (start end face allow-overlap-p)
-  "Highlight region between START and END with FONT.
-If already highlighted and ALLOW-OVERLAP-P is nil, don't highlight."
-  (or (= start end)
-      ;;(if allow-overlap-p nil (font-lock-any-faces-p start (1- end)))
-      ;; different in XEmacs 19.16?  font-lock-any-faces-p subtracts 1.
-      (if allow-overlap-p nil (font-lock-any-faces-p start end))
-      (font-lock-set-face start end face)))
-
-(defun twelf-font-find-delimited-comment (limit)
-  "Find a delimited Twelf comment and return (START . END), nil if none."
-  (let ((comment-level nil)
-       (comment-start nil))
-    (if (search-forward "%{" limit t)
-       (progn
-         (setq comment-start (- (point) 2))
-         (setq comment-level 1)
-         (while (and (> comment-level 0)
-                     (re-search-forward "\\(%{\\)\\|\\(}%\\)"
-                                        limit 'limit))
-           (cond
-            ((match-beginning 1) (setq comment-level (1+ comment-level)))
-            ((match-beginning 2) (setq comment-level (1- comment-level)))))
-         (cons comment-start (point)))
-      nil)))
-
-;; doesn't work yet with LIMIT!!!
-;; this should never be done in incremental-highlighting mode
-(defun twelf-font-find-decl (limit)
-  "Find an Twelf constant declaration and return (START . END), nil if none."
-  (let (start
-       end
-       ;; Turn off error messages
-       (id (twelf-next-decl nil nil)))
-    ;; ignore limit for now because of global buffer restriction
-    (if (null id) ; (or (null id) (> (point) limit))
-       nil
-      (skip-chars-backward *whitespace*)
-      (setq end (point))
-      (beginning-of-line 1)
-      (setq start (point))
-      (twelf-end-of-par)
-      (cons start end))))
-
-(defun twelf-font-find-binder (var-pattern limit occ-face)
-  "Find Twelf binder whose bound variable matches var-pattern.
-Returns (START . END) if found, NIL if there is none before LIMIT.
-Binders have the form [x],[x:A],{y},{y:A}.
-As a side-effect, it highlights all occurrences of the bound
-variable using the variable OCC-FACE."
-  (let (start
-       end
-       par-end
-       scope-start
-       scope-end
-       word
-       (found nil))
-    ;;; At the moment, ignore limit since restriction is done globally
-    ;; (save-restriction
-    ;; (narrow-to-region (point) limit)
-      (while (not found)
-       (skip-chars-forward "^[{%")
-       (while (looking-at *twelf-comment-start*)
-         (cond ((looking-at "%{")
-                (condition-case nil (forward-sexp 1)
-                  (error (goto-char (point-max))))
-                (or (eobp) (forward-char 1)))
-               (t
-                (end-of-line 1)))
-         (skip-chars-forward "^[{%"))
-       (if (eobp)
-           (setq found 'eob)
-         (forward-char 1)
-         (skip-chars-forward *whitespace*)
-         (if (looking-at var-pattern)
-             ;;"\\<\\w+\\>"
-             ;;"\\<[-a-z!&$^+/\\<=>?@~|#*`;,]\\w*\\>"
-             (setq found t))))
-      (if (eq found 'eob)
-         nil
-       (setq start (match-beginning 0))
-       (setq end (match-end 0))
-       (setq word (buffer-substring start end))
-       ;; find scope of quantifier
-       (twelf-end-of-par)
-       (setq par-end (point))
-       (goto-char end)
-       (condition-case nil (up-list 1) ; end of quantifier
-         (error (goto-char par-end)))
-       (setq scope-start (min (point) par-end))
-       (condition-case nil (up-list 1) ; end of scope
-         (error (goto-char par-end)))
-       (setq scope-end (min (point) par-end))
-       (goto-char scope-start)
-       (while
-           ;; speed here???
-           (search-forward-regexp (concat "\\<" (regexp-quote word) "\\>")
-                                  scope-end 'limit)
-         ;; Check overlap here!!! --- current bug if in comment
-         (font-lock-set-face (match-beginning 0) (match-end 0)
-                             occ-face))
-       (goto-char end)
-       (cons start end)))
-  ;;)
-  )
-
-(defun twelf-font-find-parm (limit)
-  "Find bound Twelf parameters and return (START . END), NIL if none.
-Also highlights all occurrences of the parameter.
-For these purposes, a parameter is a bound, lower-case identifier."
-  (twelf-font-find-binder "\\<[-a-z!&$^+/\\<=>?@~|#*`;,]\\w*\\>"
-                       limit 'twelf-font-parm-face))
-
-(defun twelf-font-find-evar (limit)
-  "Find bound Twelf existential variable return (START . END), NIL if none.
-Also highlights all occurrences of the existential variable.
-For these purposes, an existential variable is a bound, upper-case identifier."
-  (twelf-font-find-binder "\\<[A-Z_]\\w*\\>"
-                       limit 'twelf-font-evar-face))
-
-; next two are now in twelf.el
-;(define-key twelf-mode-map "\C-c\C-l" 'twelf-font-fontify-decl)
-;(define-key twelf-mode-map "\C-cl" 'twelf-font-fontify-buffer)
-
-
-;;;
-;;;
-;;; This comes from twelf-old.el but is needed for fontification,
-;;;
-;;; Perhaps some of these parsing functions will need reusing
-;;; for sending input to server properly?
-;;;
-
-;;; FIXME: some of names need fixing for safe conventions.
-
-(defun twelf-current-decl ()
-  "Returns list (START END COMPLETE) for current Twelf declaration.
-This should be the declaration or query under or just before
-point within the nearest enclosing blank lines.
-If declaration ends in `.' then COMPLETE is t, otherwise nil."
-  (let (par-start par-end complete)
-    (save-excursion
-      ;; Skip backwards if between declarations
-      (if (or (eobp) (looking-at (concat "[" *whitespace* "]")))
-         (skip-chars-backward (concat *whitespace* ".")))
-      (setq par-end (point))
-      ;; Move forward from beginning of decl until last
-      ;; declaration before par-end is found.
-      (if (not (bobp)) (backward-paragraph 1))
-      (setq par-start (point))
-      (while (and (twelf-end-of-par par-end)
-                 (< (point) par-end))
-       (setq par-start (point)))
-      ;; Now par-start is at end of preceding declaration or query.
-      (goto-char par-start)
-      (skip-twelf-comments-and-whitespace)
-      (setq par-start (point))
-      ;; Skip to period or consective blank lines
-      (setq complete (twelf-end-of-par))
-      (setq par-end (point)))
-    (list par-start par-end complete)))
-
-(defun twelf-next-decl (filename error-buffer)
-  "Set point after the identifier of the next declaration.
-Return the declared identifier or `nil' if none was found.
-FILENAME and ERROR-BUFFER are used if something appears wrong."
-  (let ((id nil)
-       end-of-id
-       beg-of-id)
-    (skip-twelf-comments-and-whitespace)
-    (while (and (not id) (not (eobp)))
-      (setq beg-of-id (point))
-      (if (zerop (skip-chars-forward *twelf-id-chars*))
-         ;; Not looking at id: skip ahead
-         (skip-ahead filename (current-line-absolute) "No identifier"
-                     error-buffer)
-       (setq end-of-id (point))
-       (skip-twelf-comments-and-whitespace)
-       (if (not (looking-at ":"))
-           ;; Not looking at valid decl: skip ahead
-           (skip-ahead filename (current-line-absolute end-of-id) "No colon"
-                       error-buffer)
-         (goto-char end-of-id)
-         (setq id (buffer-substring beg-of-id end-of-id))))
-      (skip-twelf-comments-and-whitespace))
-    id))
-
-(defconst *whitespace* " \t\n\f"
-  "Whitespace characters to be skipped by various operations.")
-
-(defconst *twelf-comment-start* (concat "%[%{" *whitespace* "]")
-  "Regular expression to match the start of a Twelf comment.")
-
-(defconst *twelf-id-chars* "a-z!&$^+/<=>?@~|#*`;,\\-\\\\A-Z_0-9'"
-  "Characters that constitute Twelf identifiers.")
-
-(defun skip-twelf-comments-and-whitespace ()
-  "Skip Twelf comments (single-line or balanced delimited) and white space."
-  (skip-chars-forward *whitespace*)
-  (while (looking-at *twelf-comment-start*)
-    (cond ((looking-at "%{")           ; delimited comment
-          (condition-case nil (forward-sexp 1)
-            (error (goto-char (point-max))))
-          (or (eobp) (forward-char 1)))
-         (t                            ; single-line comment
-          (end-of-line 1)))
-    (skip-chars-forward *whitespace*)))
-
-(defun twelf-end-of-par (&optional limit)
-  "Skip to presumed end of current Twelf declaration.
-Moves to next period or blank line (whichever comes first)
-and returns t if period is found, nil otherwise.
-Skips over comments (single-line or balanced delimited).
-Optional argument LIMIT specifies limit of search for period."
-  (if (not limit)
-      (save-excursion
-       (forward-paragraph 1)
-       (setq limit (point))))
-  (while (and (not (looking-at "\\."))
-             (< (point) limit))
-    (skip-chars-forward "^.%" limit)
-    (cond ((looking-at *twelf-comment-start*)
-          (skip-twelf-comments-and-whitespace))
-         ((looking-at "%")
-          (forward-char 1))))
-  (cond ((looking-at "\\.")
-        (forward-char 1)
-        t)
-       (t ;; stopped at limit
-        nil)))
-
-(defun skip-ahead (filename line message error-buffer)
-  "Skip ahead when syntactic error was found.
-A parsable error message constited from FILENAME, LINE, and MESSAGE is
-deposited in ERROR-BUFFER."
-  (if error-buffer
-      (save-excursion
-       (set-buffer error-buffer)
-       (goto-char (point-max))
-       (insert filename ":" (int-to-string line) " Warning: " message "\n")
-       (setq *twelf-error-pos* (point))))
-  (twelf-end-of-par))
-
-(defun current-line-absolute (&optional char-pos)
-  "Return line number of CHAR-POS (default: point) in current buffer.
-Ignores any possible buffer restrictions."
-  (1+ (count-lines 1 (or char-pos (point)))))
-
-
-(provide 'twelf-font)
diff --git a/twelf/twelf-old.el b/twelf/twelf-old.el
deleted file mode 100644
index 62763ba4a0..0000000000
--- a/twelf/twelf-old.el
+++ /dev/null
@@ -1,2660 +0,0 @@
-;; twelf-old.el  Port of old Twelf Emacs mode
-;;
-;; Author: Frank Pfenning
-;;        Adapted for Proof General by David Aspinall <David.Aspinall@ed.ac.uk>
-;;
-;; $Id$
-;;
-;;
-
-;; FIXME: have copied over directly!
-
-;;; Modes and utilities for Twelf programming.  This package supports (1)
-;;; editing Twelf source files with reasonable indentation, (2) managing
-;;; configurations of Twelf source files, including TAGS tables, (3)
-;;; communication with an inferior Twelf server to type-check and execute
-;;; declarations and queries, (4) interaction with an inferior Twelf process
-;;; in SML.
-;;;
-;;; For documentation, type C-h m in Twelf mode, or see the function
-;;; twelf-mode below
-;;;
-;;; Author: Frank Pfenning
-;;; Thu Oct 7 19:48:50 1993 (1.0 created)
-;;; Fri Jan 6 09:06:38 1995 (2.0 major revision)
-;;; Tue Jun 16 15:49:31 1998 (3.0 major revision)
-;;;
-;;;======================================================================
-;;; For the `.emacs' file (copied from init.el)
-;;;======================================================================
-;;;
-;;; ;; Tell Emacs where the Twelf libraries are.
-;;; (setq load-path
-;;;       (cons "/afs/cs/project/twelf/research/twelf/emacs" load-path))
-;;;
-;;; ;; Autoload libraries when Twelf-related major modes are started.
-;;; (autoload 'twelf-mode "twelf" "Major mode for editing Twelf source." t)
-;;; (autoload 'twelf-server "twelf" "Run an inferior Twelf server." t)
-;;; (autoload 'twelf-sml "twelf" "Run an inferior Twelf-SML process." t)
-;;;
-;;; ;; Switch buffers to Twelf mode based on filename extension,
-;;; ;; which is one of .elf, .quy, .thm, or .cfg.
-;;; (setq auto-mode-alist
-;;;       (cons '("\\.elf$" . twelf-mode)
-;;;        (cons '("\\.quy$" . twelf-mode)
-;;;              (cons '("\\.thm$" . twelf-mode)
-;;;                    (cons '("\\.cfg$" . twelf-mode)
-;;;                          auto-mode-alist)))))
-;;;
-;;; ;; Default Twelf server program location
-;;; (setq twelf-server-program
-;;;       "/afs/cs/project/twelf/research/twelf/bin/twelf-server")
-;;;
-;;; ;; Default Twelf SML program location
-;;; (setq twelf-sml-program
-;;;       "/afs/cs/project/twelf/misc/smlnj/bin/sml-cm")
-;;;
-;;; ;; Default documentation location (in info format)
-;;; (setq twelf-info-file
-;;;       "/afs/cs/project/twelf/research/twelf/doc/info/twelf.info")
-;;;
-;;; ;; Automatically highlight Twelf sources using font-lock
-;;; (add-hook 'twelf-mode-hook 'twelf-font-fontify-buffer)
-;;;
-;;;======================================================================
-;;; Command Summary
-;;;======================================================================
-;;;
-;;; Quick summary of Twelf mode, generated from C-h b:
-;;;
-;;; --- Editing Commands ---
-;;; TAB          twelf-indent-line
-;;; DEL          backward-delete-char-untabify
-;;; M-C-q        twelf-indent-decl
-;;;
-;;; --- Type Checking ---
-;;; C-c C-c      twelf-save-check-config
-;;; C-c C-s      twelf-save-check-file
-;;; C-c C-d      twelf-check-declaration
-;;; C-c c        twelf-type-const
-;;; C-c C-u      twelf-server-display
-;;;
-;;; --- Error Tracking ---
-;;; C-c `        twelf-next-error
-;;; C-c =        twelf-goto-error
-;;;
-;;; --- Syntax Highlighting ---
-;;; C-c C-l      twelf-font-fontify-decl
-;;; C-c l        twelf-font-fontify-buffer
-;;;
-;;; --- Server State ---
-;;; C-c <        twelf-set
-;;; C-c >        twelf-get
-;;; C-c C-i      twelf-server-interrupt
-;;; M-x twelf-server
-;;; M-x twelf-server-configure
-;;; M-x twelf-server-quit
-;;; M-x twelf-server-restart
-;;; M-x twelf-server-send-command
-;;;
-;;; --- Timers ---
-;;; M-x twelf-timers-reset
-;;; M-x twelf-timers-show
-;;; M-x twelf-timers-check
-;;;
-;;; --- Tags (standard Emacs etags package) ---
-;;; M-x twelf-tag
-;;; M-.          find-tag (standard binding)
-;;; C-x 4 .      find-tag-other-window (standard binding)
-;;; C-c q        tags-query-replace (Twelf mode binding)
-;;; C-c s        tags-search (Twelf mode binding)
-;;; M-,          tags-loop-continue (standard binding)
-;;;              visit-tags-table, list-tags, tags-apropos
-;;;
-;;; --- Communication with inferior Twelf-SML process (not Twelf Server) ---
-;;; M-x twelf-sml
-;;; C-c C-e      twelf-sml-send-query
-;;; C-c C-r      twelf-sml-send-region
-;;; C-c RET      twelf-sml-send-newline
-;;; C-c ;        twelf-sml-send-semicolon
-;;; C-c d        twelf-sml-cd
-;;; M-x twelf-sml-quit
-;;;
-;;; --- Variables ---
-;;; twelf-indent        amount of indentation for nested Twelf expressions
-;;;
-;;;======================================================================
-;;; Some Terminology
-;;;======================================================================
-;;;
-;;; Twelf Server --- an inferior process that services requests to type-check,
-;;; load, or execute declarations and queries.  It is usually attached to the
-;;; buffer *twelf-server*.  Requests are generated by Emacs from user commands,
-;;; or may be typed directly into the Twelf server buffer.
-;;;
-;;; Current configuration --- A configuration is an ordered list of
-;;; Twelf source files in dependency order.  It is usually initialized
-;;; and maintained in a file sources.cfg.  The current configuration is
-;;; also the bases for the TAGS file created by twelf-tags.  This allows
-;;; quick jumping to declaration sites for constants, or to apply
-;;; searches or replacements to all files in a configuration.
-;;;
-;;; Current Twelf declaration --- When checking individual declarations
-;;; Emacs must extract it from the current buffer and then send it to
-;;; the server.  This is necessarily based on a heuristic, since Emacs
-;;; does not know enough in order to parse Twelf source properly in all
-;;; cases, but it knows the syntax for comments, Twelf identifiers, and
-;;; matching delimiters.  Search for the end or beginning of a
-;;; declaration is always limited by double blank lines in order to be
-;;; more robust (in case a period is missing at the end of a
-;;; declaration).  If the point falls between declarations, the
-;;; declaration after the point is considered current.
-;;;
-;;; Twelf-SML --- During development or debugging of the Twelf
-;;; implementation itself it is often useful to interact with SML, the
-;;; language in which Twelf is implementated, rather than using an Twelf
-;;; server.  This is an inferior SML process which may run a Twelf
-;;; query interpreter.
-;;;
-;;;======================================================================
-;;; Change Log
-;;;======================================================================
-;;;
-;;; Thu Jun  3 14:51:35 1993 -fp
-;;; Added variable display-elf-queries.  If T (default) redisplays Elf
-;;; buffer after a query has been sent.  Delays one second after sending
-;;; the query which is rather arbitrary.
-;;; Wed Jun 30 19:57:58 1993
-;;; - Error messages in the format line0.col0-line1.col1 can now be parsed.
-;;; - Error from std_in, either interactive or through elf-send-query
-;;;   can now be tracked.
-;;; - Added simple directory tracking and function elf-cd, bound to C-c d.
-;;; - improved filename completion in Elf mode under Lucid Emacs.
-;;; - replaced tail recursion in elf-indent-line by a while loop.
-;;; - changed elf-input-filter to ignore one character inputs.
-;;; - elf-error-marker is now updated on every interactive input or send.
-;;; - added commands elf-send-newline, bound to C-c RET
-;;;   and elf-send-semicolon, bound to C-c ;.
-;;;   These are useful when sending queries from a buffer with examples.
-;;; Fri Sep  3 15:02:10 1993
-;;; Changed definition of elf-current-paragraph so that it recognizes
-;;; individual declarations within a traditional ``paragraph'' (separated
-;;; by blank lines).
-;;; Fri Oct 22 10:05:08 1993
-;;; Changed elf-send-query to ensure that the Elf process expects a query
-;;; If the Elf process is at the SML prompt, it starts a top level.
-;;; If the Elf process is waiting after printing an answer substitution,
-;;; it sends a RET.
-;;; This is based on a heuristic analysis of the contents of the Elf buffer.
-;;; Fri Dec 16 15:27:14 1994
-;;; Changed elf-error-marker to elf-error-pos, since it moved in undesirable
-;;; ways in Emacs 19.
-;;; Fri Jan  6 09:06:54 1995
-;;; Major revision: incorporating elf-server.el and elf-tag.el
-;;; Thu Jan 12 14:31:36 1995
-;;; Finished major revision (version 2.0)
-;;; Sat Jun 13 12:14:34 1998
-;;; Renamed to Twelf and incorporated menus from elf-menu.el
-;;; Major revision for Twelf 1.2 release
-;;; Q: Improve tagging for %keyword declarations?
-;;; Thu Jun 25 08:52:41 1998
-;;; Finished major revision (version 3.0)
-;;; Fri Oct  2 11:06:15 1998
-;;; Added NT Emacs bug workaround
-
-(require 'comint)
-(require 'easymenu)
-
-;;;----------------------------------------------------------------------
-;;; User visible variables
-;;;----------------------------------------------------------------------
-
-(defvar twelf-indent 3
-  "*Indent for Twelf expressions.")
-
-(defvar twelf-infix-regexp ":\\|\\<->\\>\\|\\<<-\\>\\|\\<=\\>"
-  "*Regular expression to match Twelf infix operators.
-Match must exclude surrounding whitespace.  This is used for indentation.")
-
-(defvar twelf-server-program "twelf-server"
-  "*Default Twelf server program.")
-
-(defvar twelf-info-file "twelf.info"
-  "*Default info file for Twelf.")
-
-(defvar twelf-server-display-commands nil
-  "*If non-nil, the Twelf server buffer will be displayed after each command.
-Normally, the Twelf server buffer is displayed only after some selected
-commands or if a command is given a prefix argument.")
-
-(defvar twelf-highlight-range-function 'twelf-highlight-range-zmacs
-  "*Function which highlights the range analyzed by the server.
-This is called for certain commands which apply to a subterm at point.
-You may want to change this for FSF Emacs, XEmacs and/or highlight packages.")
-
-(defvar twelf-focus-function 'twelf-focus-noop
-  "*Function which focusses on the current declaration or query.
-This is called for certain commands which pick out (a part of) a declaration
-or query.  You may want to change this for FSF Emacs, XEmacs and/or highlight
-packages.")
-
-(defvar twelf-server-echo-commands t
-  "*If nil, Twelf server commands will not be echoed in the Twelf server 
buffer.")
-
-(defvar twelf-save-silently nil
-  "*If non-nil, modified buffers are saved without confirmation
-before `twelf-check-config' if they belong to the current configuration.")
-
-(defvar twelf-server-timeout 5
-  "*Number of seconds before the server is considered delinquent.
-This is unsupported in some versions of Emacs.")
-
-(defvar twelf-sml-program "twelf-sml"
-  "*Default Twelf-SML program.")
-
-(defvar twelf-sml-args '()
-  "*Arguments to Twelf-SML program.")
-
-(defvar twelf-sml-display-queries t
-  "*If nil, the Twelf-SML buffer will not be selected after a query.")
-
-(defvar twelf-mode-hook '()
-  "List of hook functions to run when switching to Twelf mode.")
-
-(defvar twelf-server-mode-hook '()
-  "List of hook functions to run when switching to Twelf Server mode.")
-
-(defvar twelf-config-mode-hook '()
-  "List of hook functions to run when switching to Twelf Config minor mode.")
-
-(defvar twelf-sml-mode-hook '()
-  "List of hook functions for Twelf-SML mode.")
-
-(defvar twelf-to-twelf-sml-mode '()
-  "List of hook functions for 2Twelf-SML minor mode.")
-
-(defvar twelf-config-mode nil
-  "Non-NIL means the Twelf Config minor mode is in effect.")
-
-;;;----------------------------------------------------------------------
-;;; Internal variables
-;;;----------------------------------------------------------------------
-
-(defvar *twelf-server-buffer-name* "*twelf-server*"
-  "The default name for the Twelf server buffer.")
-
-(defvar *twelf-server-buffer* nil
-  "The buffer with the Twelf server if one exists.")
-
-(defvar *twelf-server-process-name* "twelf-server"
-  "Name of the Twelf server process.")
-
-(defvar *twelf-config-buffer* nil
-  "The current Twelf configuration buffer if one exists.")
-
-(defvar *twelf-config-time* nil
-  "The modification time of Twelf configuration file when read by the server.")
-
-(defvar *twelf-config-list* nil
-  "The reversely ordered list with files in the current Twelf configuration.")
-
-(defvar *twelf-server-last-process-mark* 0
-  "The process mark before the last command in the Twelf server buffer.")
-
-(defvar *twelf-last-region-sent* nil
-  "Contains a list (BUFFER START END) identifying the last region sent
-to the Twelf server or Twelf-SML process for error tracking.
-If nil, then the last input was interactive.
-If t, then the last input was interactive, but has already been copied
-to the end of the Twelf-SML buffer.")
-
-(defvar *twelf-last-input-buffer* nil
-  "Last buffer to which input was sent.
-This is used by the error message parser.")
-
-(defvar *twelf-error-pos* 0
-  "Last error position in the server buffer.")
-
-(defconst *twelf-read-functions*
-  '((nat . twelf-read-nat)
-    (bool . twelf-read-bool)
-    (limit . twelf-read-limit)
-    (strategy . twelf-read-strategy))
-  "Association between Twelf parameter types and their Emacs read functions.")
-
-(defconst *twelf-parm-table*
-  '(("chatter" . nat)
-    ("doubleCheck" . bool)
-    ("Print.implicit" . bool)
-    ("Print.depth" . limit)
-    ("Print.length" . limit)
-    ("Print.indent" . nat)
-    ("Print.width" . nat)
-    ("Prover.strategy" . strategy)
-    ("Prover.maxSplit" . nat)
-    ("Prover.maxRecurse" . nat))
-  "Association between Twelf parameters and their types.")
-
-(defvar twelf-chatter 3
-  "Chatter level in current Twelf server.
-Maintained to present reasonable menus.")
-
-;(defvar twelf-trace 0
-;  "Trace level in current Twelf server.
-;Maintained to present reasonable menus.")
-
-(defvar twelf-double-check "false"
-  "Current value of doubleCheck Twelf parameter.")
-
-(defvar twelf-print-implicit "false"
-  "Current value of Print.implicit Twelf parameter.")
-
-(defconst *twelf-track-parms*
-  '(("chatter" . twelf-chatter)
-    ;("trace" . twelf-trace)
-    ("doubleCheck" . twelf-double-check)
-    ("Print.implicit" . twelf-print-implicit))
-  "Association between Twelf parameters and Emacs tracking variables.")
-
-;;;----------------------------------------------------------------------
-;;; Basic key bindings
-;;;----------------------------------------------------------------------
-
-(defun install-basic-twelf-keybindings (map)
-  "General key bindings for Twelf and Twelf Server modes."
-  ;; Additional tag keybindings
-  (define-key map "\C-cq" 'tags-query-replace)
-  (define-key map "\C-cs" 'tags-search)
-  ;; Server state
-  (define-key map "\C-c<" 'twelf-set)
-  (define-key map "\C-c>" 'twelf-get)
-  ;; Error handling
-  (define-key map "\C-c`" 'twelf-next-error)
-  (define-key map "\C-c=" 'twelf-goto-error)
-  ;; Proper indentation
-  (define-key map "\e\C-q" 'twelf-indent-decl)
-  (define-key map "\t" 'twelf-indent-line)
-  (define-key map "\177" 'backward-delete-char-untabify)
-  ;; Info documentation
-  (define-key map "\C-c\C-h" 'twelf-info)
-  )
-
-;;;----------------------------------------------------------------------
-;;; Twelf mode
-;;; This mode should be used for files with Twelf declarations,
-;;; usually *.elf, *.quy, or *.thm, and Twelf configuration files *.cfg
-;;;----------------------------------------------------------------------
-
-(defun install-twelf-keybindings (map)
-  "Install the key bindings for the Twelf mode."
-  (define-key map "\C-cl" 'twelf-font-fontify-buffer) ;autoload twelf-font
-  (define-key map "\C-c\C-l" 'twelf-font-fontify-decl) ;autoload twelf-font
-  (define-key map "\C-c\C-i" 'twelf-server-interrupt)
-  (define-key map "\C-c\C-u" 'twelf-server-display)
-  (define-key map "\C-cc" 'twelf-type-const)
-  ;(define-key map "\C-ce" 'twelf-expected-type-at-point)
-  ;(define-key map "\C-cp" 'twelf-type-at-point)
-  ;(define-key map "\C-c." 'twelf-complete)
-  ;(define-key map "\C-c?" 'twelf-completions-at-point)
-  (define-key map "\C-c\C-d" 'twelf-check-declaration)
-  (define-key map "\C-c\C-s" 'twelf-save-check-file)
-  (define-key map "\C-c\C-c" 'twelf-save-check-config)
-  )
-
-(defvar twelf-mode-map nil
-  "The keymap used in Twelf mode.")
-
-(cond ((not twelf-mode-map)
-       (setq twelf-mode-map (make-sparse-keymap))
-       (install-basic-twelf-keybindings twelf-mode-map)
-       (install-twelf-keybindings twelf-mode-map)))
-
-;;;----------------------------------------------------------------------
-;;; General editing and indentation
-;;;----------------------------------------------------------------------
-
-(defvar twelf-mode-syntax-table nil
-  "The syntax table used in Twelf mode.")
-
-(defun set-twelf-syntax (char entry)
-  (modify-syntax-entry char entry twelf-mode-syntax-table))
-(defun set-word (char) (set-twelf-syntax char "w   "))
-(defun set-symbol (char) (set-twelf-syntax char "_   "))
-
-(defun map-string (func string)
-  (if (string= "" string)
-      ()
-    (funcall func (string-to-char string))
-    (map-string func (substring string 1))))
-
-(if twelf-mode-syntax-table
-    ()
-  (setq twelf-mode-syntax-table (make-syntax-table))
-  ;; A-Z and a-z are already word constituents
-  ;; For fontification, it would be better if _ and ' were word constituents
-  (map-string 'set-word "!&$^+/<=>?@~|#*`;,-0123456789\\") ; word constituents
-  (map-string 'set-symbol "_'")         ; symbol constituents
-  ;; Delimited comments are %{ }%, see 1234 below.
-  (set-twelf-syntax ?\ "    ")            ; whitespace
-  (set-twelf-syntax ?\t "    ")           ; whitespace
-  (set-twelf-syntax ?% "< 14")            ; comment begin
-  (set-twelf-syntax ?\n ">   ")           ; comment end
-  (set-twelf-syntax ?: ".   ")            ; punctuation
-  (set-twelf-syntax ?. ".   ")            ; punctuation
-  (set-twelf-syntax ?\( "()  ")           ; open delimiter
-  (set-twelf-syntax ?\) ")(  ")           ; close delimiter
-  (set-twelf-syntax ?\[ "(]  ")           ; open delimiter
-  (set-twelf-syntax ?\] ")[  ")           ; close delimiter
-  (set-twelf-syntax ?\{ "(}2 ")           ; open delimiter
-  (set-twelf-syntax ?\} "){ 3")           ; close delimiter
-  ;; Actually, strings are illegal but we include:
-  (set-twelf-syntax ?\" "\"   ")          ; string quote
-  ;; \ is not an escape, but a word constituent (see above)
-  ;;(set-twelf-syntax ?\\ "/   ")         ; escape
-  )
-
-(defconst *whitespace* " \t\n\f"
-  "Whitespace characters to be skipped by various operations.")
-
-(defconst *twelf-comment-start* (concat "%[%{" *whitespace* "]")
-  "Regular expression to match the start of a Twelf comment.")
-
-(defconst *twelf-id-chars* "a-z!&$^+/<=>?@~|#*`;,\\-\\\\A-Z_0-9'"
-  "Characters that constitute Twelf identifiers.")
-
-(defun skip-twelf-comments-and-whitespace ()
-  "Skip Twelf comments (single-line or balanced delimited) and white space."
-  (skip-chars-forward *whitespace*)
-  (while (looking-at *twelf-comment-start*)
-    (cond ((looking-at "%{")           ; delimited comment
-          (condition-case nil (forward-sexp 1)
-            (error (goto-char (point-max))))
-          (or (eobp) (forward-char 1)))
-         (t                            ; single-line comment
-          (end-of-line 1)))
-    (skip-chars-forward *whitespace*)))
-
-(defun twelf-end-of-par (&optional limit)
-  "Skip to presumed end of current Twelf declaration.
-Moves to next period or blank line (whichever comes first)
-and returns t if period is found, nil otherwise.
-Skips over comments (single-line or balanced delimited).
-Optional argument LIMIT specifies limit of search for period."
-  (if (not limit)
-      (save-excursion
-       (forward-paragraph 1)
-       (setq limit (point))))
-  (while (and (not (looking-at "\\."))
-             (< (point) limit))
-    (skip-chars-forward "^.%" limit)
-    (cond ((looking-at *twelf-comment-start*)
-          (skip-twelf-comments-and-whitespace))
-         ((looking-at "%")
-          (forward-char 1))))
-  (cond ((looking-at "\\.")
-        (forward-char 1)
-        t)
-       (t ;; stopped at limit
-        nil)))
-
-(defun twelf-current-decl ()
-  "Returns list (START END COMPLETE) for current Twelf declaration.
-This should be the declaration or query under or just before
-point within the nearest enclosing blank lines.
-If declaration ends in `.' then COMPLETE is t, otherwise nil."
-  (let (par-start par-end complete)
-    (save-excursion
-      ;; Skip backwards if between declarations
-      (if (or (eobp) (looking-at (concat "[" *whitespace* "]")))
-         (skip-chars-backward (concat *whitespace* ".")))
-      (setq par-end (point))
-      ;; Move forward from beginning of decl until last
-      ;; declaration before par-end is found.
-      (if (not (bobp)) (backward-paragraph 1))
-      (setq par-start (point))
-      (while (and (twelf-end-of-par par-end)
-                 (< (point) par-end))
-       (setq par-start (point)))
-      ;; Now par-start is at end of preceding declaration or query.
-      (goto-char par-start)
-      (skip-twelf-comments-and-whitespace)
-      (setq par-start (point))
-      ;; Skip to period or consective blank lines
-      (setq complete (twelf-end-of-par))
-      (setq par-end (point)))
-    (list par-start par-end complete)))
-
-(defun twelf-mark-decl ()
-  "Marks current Twelf declaration and moves point to its beginning."
-  (interactive)
-  (let* ((par (twelf-current-decl))
-        (par-start (nth 0 par))
-        (par-end (nth 1 par)))
-    (push-mark par-end)
-    (goto-char par-start)))
-
-(defun twelf-indent-decl ()
-  "Indent each line of the current Twelf declaration."
-  (interactive)
-  (let* ((par (twelf-current-decl))
-        (par-start (nth 0 par))
-        (par-end (nth 1 par)))
-    (goto-char par-start)
-    (twelf-indent-lines (count-lines par-start par-end))))
-
-(defun twelf-indent-region (from to)
-  "Indent each line of the region as Twelf code."
-  (interactive "r")
-  (cond ((< from to)
-        (goto-char from)
-        (twelf-indent-lines (count-lines from to)))
-       ((> from to)
-        (goto-char to)
-        (twelf-indent-lines (count-lines to from)))
-       (t nil)))
-
-(defun twelf-indent-lines (n)
-  "Indent N lines starting at point."
-  (interactive "p")
-  (while (> n 0)
-    (twelf-indent-line)
-    (forward-line 1)
-    (setq n (1- n))))
-
-(defun twelf-comment-indent ()
-  "Calculates the proper Twelf comment column.
-Currently does not deal specially with pragmas."
-  (cond ((looking-at "%%%")
-        0)
-       ((looking-at "%[%{]")
-        (car (twelf-calculate-indent)))
-       (t
-        (skip-chars-backward " \t")
-        (max (if (bolp) 0 (1+ (current-column))) comment-column))))
-
-(defun looked-at ()
-  "Returns the last string matched against.
-Beware of intervening, even unsuccessful matches."
-  (buffer-substring (match-beginning 0) (match-end 0)))
-
-(defun twelf-indent-line ()
-  "Indent current line as Twelf code.
-This recognizes comments, matching delimiters, and standard infix operators."
-  (interactive)
-  (let ((old-point (point)))
-    (beginning-of-line)
-    (let* ((indent-info (twelf-calculate-indent))
-          (indent-column (nth 0 indent-info))
-          (indent-type (nth 1 indent-info))
-          (indent-string (nth 2 indent-info)))
-      (skip-chars-forward " \t")        ; skip whitespace
-      (let ((fwdskip (- old-point (point))))
-       (cond ((looking-at "%%%")
-              (twelf-indent-line-to 0 fwdskip)) ; %%% comment at column 0
-             ((looking-at "%[%{]")     ; delimited or %% comment
-              (twelf-indent-line-to indent-column fwdskip))
-             ((looking-at *twelf-comment-start*)    ; indent single-line 
comment
-              (indent-for-comment)
-              (forward-char -1))
-             ((looking-at "%")         ; %keyword declaration
-              (twelf-indent-line-to indent-column fwdskip))
-             ((looking-at twelf-infix-regexp) ; looking at infix operator
-              (if (string= indent-string (looked-at))
-                  ;; indent string is the same as the one we are looking at
-                  (twelf-indent-line-to indent-column fwdskip)
-                (twelf-indent-line-to (+ indent-column twelf-indent) fwdskip)))
-             ((eq indent-type 'delimiter) ; indent after delimiter
-              (twelf-indent-line-to (+ indent-column twelf-indent) fwdskip))
-             ((eq indent-type 'limit)  ; no delimiter or infix found.
-              (twelf-indent-line-to indent-column fwdskip))
-             ((eq indent-type 'infix)
-              (twelf-indent-line-to (+ indent-column twelf-indent) 
fwdskip)))))))
-
-(defun twelf-indent-line-to (indent fwdskip)
-  "Indent current line to INDENT then skipping to FWDSKIP if positive.
-Assumes point is on the first non-whitespace character of the line."
-  (let ((text-start (point))
-       (shift-amount (- indent (current-column))))
-    (if (= shift-amount 0)
-       nil
-      (beginning-of-line)
-      (delete-region (point) text-start)
-      (indent-to indent))
-    (if (> fwdskip 0)
-       (forward-char fwdskip))))
-
-(defun twelf-calculate-indent ()
-  "Calculate the indentation and return a list (INDENT INDENT-TYPE STRING).
-INDENT is a natural number,
-INDENT-TYPE is 'DELIMITER, 'INFIX, or 'LIMIT, and
-STRING is the delimiter, infix operator, or the empty string, respectively."
-  (save-excursion
-    (let* ((par (twelf-current-decl))
-          (par-start (nth 0 par))
-          (par-end (nth 1 par))
-          (par-complete (nth 2 par))
-          (limit (cond ((> par-start (point)) (point))
-                       ((and (> (point) par-end) par-complete) par-end)
-                       (t par-start))))
-      (twelf-dsb limit))))
-
-(defun twelf-dsb (limit)
-  "Scan backwards from point to find opening delimiter or infix operator.
-This currently does not deal with comments or mis-matched delimiters.
-Argument LIMIT specifies bound for backwards search."
-  (let ((result nil)
-       (lparens 0) (lbraces 0) (lbrackets 0))
-    (while (not result)
-      (if (or (= lparens 1) (= lbraces 1) (= lbrackets 1))
-         (setq result (list (current-column) 'delimiter (looked-at)))
-       (if (re-search-backward (concat "[][{}()]\\|" twelf-infix-regexp)
-                               limit 'limit) ; return 'LIMIT if limit reached
-           (let ((found (looked-at)))
-             (cond
-              ((string= found "(") (setq lparens (1+ lparens)))
-              ((string= found ")") (setq lparens (1- lparens)))
-              ((string= found "{") (setq lbraces (1+ lbraces)))
-              ((string= found "}") (setq lbraces (1- lbraces)))
-              ((string= found "[") (setq lbrackets (1+ lbrackets)))
-              ((string= found "]") (setq lbrackets (1- lbrackets)))
-              (t;; otherwise, we are looking at an infix operator
-               (if (and (= lparens 0) (= lbraces 0) (= lbrackets 0))
-                   (setq result (list (current-column) 'infix found))
-                 nil))))               ; embedded - skip
-         (setq result (list 0 'limit ""))))) ; reached the limit, no indent
-    result))
-
-(defun twelf-mode-variables ()
-  "Set up local variables for Twelf mode."
-  (set-syntax-table twelf-mode-syntax-table)
-  ;; Paragraphs are separated by blank lines or ^L.
-  (make-local-variable 'paragraph-start)
-  (setq paragraph-start "^[ \t\f]*$")
-  (make-local-variable 'paragraph-separate)
-  (setq paragraph-separate paragraph-start)
-  (make-local-variable 'indent-line-function)
-  (setq indent-line-function 'twelf-indent-line)
-  (make-local-variable 'comment-start)
-  (setq comment-start "%")
-  (make-local-variable 'comment-start-skip)
-  (setq comment-start-skip "%+{?[ \t]*")
-  (make-local-variable 'comment-end)
-  (setq comment-end "")
-  (make-local-variable 'comment-column)
-  (setq comment-column 40)
-  ;; (make-local-variable 'parse-sexp-ignore-comments)
-  ;; (setq parse-sexp-ignore-comments t)
-  )
-
-(defun twelf-mode ()
-  "Major mode for editing Twelf code.
-Tab indents for Twelf code.
-Delete converts tabs to spaces as it moves back.
-M-C-q indents all lines in current Twelf declaration.
-
-Twelf mode also provides commands to maintain groups of Twelf source
-files (configurations) and communicate with an Twelf server which
-processes declarations.  It also supports quick jumps to the (presumed)
-source of error message that may arise during parsing or type-checking.
-
-Customisation: Entry to this mode runs the hooks on twelf-mode-hook.
-See also the hints for the .emacs file given below.
-
-Mode map
-========
-\\{twelf-mode-map}
-\\<twelf-mode-map>
-Overview
-========
-
-The basic architecture is that Emacs sends commands to an Twelf server
-which runs as an inferior process, usually in the buffer *twelf-server*.
-Emacs in turn interprets or displays the replies from the Twelf server.
-Since a typical Twelf application comprises several files, Emacs
-maintains a configuration in a file, usally called sources.cfg.  This
-file contains a list of files, each on a separate line, in dependency
-order.  The `%' character starts a comment line.  A configuration is
-established with the command \\[twelf-server-configure].
-
-A new file is switched to Twelf mode if a file has extension `.elf',
-`.quy', `.thm' or `.cfg' and the `auto-mode-alist' is set correctly (see
-init.el).
-
-The files in the current configuration can be checked in sequence with
-\\[twelf-save-check-config], the current file with
-\\[twelf-save-check-file], individual declarations with
-\\[twelf-check-declaration].  These, like many other commands, take an
-optional prefix arguments which means to display the Twelf server buffer
-after the processing of the configuration, file, or declaration.  If an
-error should arise during these or related operations a message is
-issued both in the server buffer and Emacs, and the command
-\\[twelf-next-error] visits the presumed source of the type error in a
-separate buffer.
-
-Summary of most common commands:
- M-x twelf-save-check-config \\[twelf-save-check-config]  save, check & load 
configuration
- M-x twelf-save-check-file   \\[twelf-save-check-file]  save, check & load 
current file
- M-x twelf-check-declaration \\[twelf-check-declaration]  type-check 
declaration at point
- M-x twelf-server-display    \\[twelf-server-display]  display Twelf server 
buffer
-
-It is important to remember that the commands to save and check
-a file or check a declaration may change the state of the global
-signature maintained in Twelf.  After a number of changes it is usually
-a good idea to return to a clean slate with \\[twelf-save-check-config].
-
-Individual Commands
-===================
-
-Configurations, Files and Declarations
-
-  twelf-save-check-config                   \\[twelf-save-check-config]
-   Save its modified buffers and then check the current Twelf configuration.
-   With prefix argument also displays Twelf server buffer.
-   If necessary, this will start up an Twelf server process.
-
-  twelf-save-check-file                     \\[twelf-save-check-file]
-   Save buffer and then check it by giving a command to the Twelf server.
-   With prefix argument also displays Twelf server buffer.
-
-  twelf-check-declaration                   \\[twelf-check-declaration]
-   Send the current declaration to the Twelf server process for checking.
-   With prefix argument, subsequently display Twelf server buffer.
-
-Subterm at Point
-
-  twelf-type-const                          \\[twelf-type-const]
-   Display the type of the constant before point.
-   Note that the type of the constant will be `absolute' rather than the
-   type of the particular instance of the constant.
-
-Error Tracking
-
-  twelf-next-error                          \\[twelf-next-error]
-   Find the next error by parsing the Twelf server or Twelf-SML buffer.
-
-  twelf-goto-error                          \\[twelf-goto-error]
-   Go to the error reported on the current line or below.
-
-Server State
-
-  twelf-set PARM VALUE                      \\[twelf-set]
-   Sets the Twelf server parameter PARM to VALUE.
-   Prompts for PARM when called interactively, using completion for legal
-   parameters.
-
-  twelf-get PARM                            \\[twelf-get]
-   Print the current value the Twelf server parameter PARM.
-
-  twelf-server-interrupt                    \\[twelf-server-interrupt]
-   Interrupt the Twelf server-process.
-
-  twelf-server                              \\[twelf-server]
-   Start a Twelf server process in a buffer named *twelf-server*.
-
-  twelf-server-configure                    \\[twelf-server-configure]
-   Set the current configuration of the Twelf server.
-
-  twelf-reset                               \\[twelf-reset]
-   Reset the global signature in the Twelf server process.
-
-  twelf-server-quit                         \\[twelf-server-quit]
-   Kill the Twelf server process.
-
-  twelf-server-restart                      \\[twelf-server-restart]
-   Restarts server and re-initializes configuration.
-   This is primarily useful during debugging of the Twelf server code or
-   if the Twelf server is hopelessly wedged.
-
-  twelf-server-send-command                 \\[twelf-server-send-command]
-   Send arbitrary string to Twelf server.
-
-Tags (for other, M-x apropos tags or see `etags' documentation)
-
-  twelf-tag                                 \\[twelf-tag]
-   Create tags file TAGS for current configuration.
-   If current configuration is names CONFIGx, tags file will be named TAGx.
-   Errors are displayed in the Twelf server buffer.
-
-Timers
-
-  twelf-timers-reset                       \\[twelf-timers-reset]
-   Reset Twelf timers.
-
-  twelf-timers-show                         \\[twelf-timers-show]
-   Show and reset Twelf timers.
-
-  twelf-timers-check                        \\[twelf-timers-check]
-   Show, but do not reset Twelf timers.
-
-Editing
-
-  twelf-indent-decl                         \\[twelf-indent-decl]
-   Indent each line in current declaration as Twelf code.
-
-  twelf-indent-region                       \\[twelf-indent-region]
-   Indent each line of the region as Twelf code.
-
-Minor Modes
-===========
-
-An associated minor modes is 2Twelf-SML (toggled with
-twelf-to-twelf-sml-mode).  This means that we assume communication
-is an inferior Twelf-SML process and not a Twelf server.
-
-Related Major Modes
-===================
-
-Related major modes are Twelf Server (for the Twelf server buffer) and
-Twelf-SML (for an inferior Twelf-SML process).  Both modes are based on
-the standard Emacs comint package and inherit keybindings for retrieving
-preceding input.
-
-Customization
-=============
-
-The following variables may be of general utility.
-
- twelf-indent          amount of indentation for nested Twelf expressions
- twelf-mode-hook       hook to run when entering Twelf mode
- twelf-server-program  full pathname of Twelf server program
- twelf-server-mode-hook  hook to run when entering Twelf server mode
- twelf-info-file       name of Twelf info file with documentation
-
-The following is a typical section of a .emacs initialization file
-which can be found in the file init.el.
-
-(setq load-path (cons \"/afs/cs/project/twelf/research/twelf/emacs\" 
load-path))
-
-(autoload 'twelf-mode \"twelf\" \"Major mode for editing Twelf source.\" t)
-(autoload 'twelf-server \"twelf\" \"Run an inferior Twelf server.\" t)
-(autoload 'twelf-sml \"twelf\" \"Run an inferior Twelf-SML process.\" t)
-
-(setq auto-mode-alist
-      (cons '(\"\\.elf$\" . twelf-mode)
-           (cons '(\"\\.quy$\" . twelf-mode)
-                 (cons '(\"\\.thm$\" . twelf-mode)
-                       (cons '(\"\\.cfg$\" . twelf-mode)
-                             auto-mode-alist)))))
-
-(setq twelf-server-program
-      \"/afs/cs/project/twelf/research/twelf/bin/twelf-server\")
-
-(setq twelf-sml-program
-      \"/afs/cs/project/twelf/misc/smlnj/bin/sml-cm\")
-
-(setq twelf-info-file
-      \"/afs/cs/project/twelf/research/twelf/doc/info/twelf.info\")
-"
-  (interactive)
-  (kill-all-local-variables)
-  (twelf-mode-variables)
-  (use-local-map twelf-mode-map)
-  (setq major-mode 'twelf-mode)
-  (setq mode-name "Twelf")
-  (twelf-config-mode-check)
-  (twelf-add-menu)                     ; add Twelf menu to menubar
-  ;; disable twelf-add-to-config-check: require explicit add-file
-  ;; (twelf-add-to-config-check)
-  (run-hooks 'twelf-mode-hook))
-
-;;;----------------------------------------------------------------------
-;;; Reading info file
-;;;----------------------------------------------------------------------
-
-(defun twelf-info (&optional file)
-  "Enter Info, starting with the Twelf node
-Optional argument FILE specifies the info file.
-
-In interactive use, a prefix arguments directs this command to
-read a file name from the minibuffer."
-  (interactive (if current-prefix-arg
-                  (list (read-file-name "Info file name: " nil nil t))))
-  (info (or file twelf-info-file)))
-
-;;;----------------------------------------------------------------------
-;;; Error message parsing
-;;;----------------------------------------------------------------------
-
-(defconst twelf-error-regexp
-  "^.+:[-0-9.:]+.* \\(Error\\|Warning\\):"
-  "Regexp for matching Twelf error.")
-
-(defconst twelf-error-fields-regexp
-   "^[-=? \t]*\\(.+\\):\
-\\([0-9]+\\)\\(\\.\\([0-9]+\\)\\)?\\(-\\([0-9]+\\)\\(\\.\\([0-9]+\\)\\)?\\)?\
-.+\\(Error\\|Warning\\):"
-   "Regexp to extract fields of Twelf error.")
-
-(defconst twelf-error-decl-regexp
-  "^[-=? \t]*\\(.+\\)::\\([^ \t\n]+\\) "
-  "Regexp to extract filename and identifier from declaration error.")
-
-(defun looked-at-nth (n)
-  (let ((b (match-beginning n))
-       (e (match-end n)))
-    (if (or (null b) (null e)) nil
-      (buffer-substring (match-beginning n) (match-end n)))))
-
-(defun looked-at-nth-int (n)
-  (let ((str (looked-at-nth n)))
-    (if (null str) nil
-      (string-to-number str))))
-
-(defun twelf-error-parser (pt)
-  "Standard parser for Twelf errors.
-Returns a 5-element list (FILE START-LINE START-COL END-LINE END-COL)
-or (\"Local\" START-CHAR NIL END-CHAR NIL)."
-  (save-excursion
-    (goto-char pt)
-    (re-search-forward twelf-error-fields-regexp)
-    (list (looked-at-nth 1)            ; file or "Local" or "stdIn"
-         (looked-at-nth-int 2)         ; start line or char
-         (looked-at-nth-int 4)         ; start column, if given, else nil
-         (looked-at-nth-int 6)         ; end line, if given, else nil or char
-         (looked-at-nth-int 8)         ; end column, if given, else nil
-         )))
-
-(defun twelf-error-decl (pos)
-  "Determines if the error is identified only by its declaration."
-  (save-excursion
-    (goto-char pos)
-    (looking-at twelf-error-decl-regexp)))
-
-(defun twelf-mark-relative (line0 col0 line1 col1)
-  "Mark error region if location is given relative to a buffer position."
-  (if (not (= line0 1))
-      (forward-line (1- line0)))
-  ;; work around bug: from stdIn, first line is off by one.
-  (forward-char (if (not (= line0 1)) (1- col0) (1- (1- col0))))
-  ;; select region, if non-empty
-  (cond ((not (null line1))
-        (push-mark (point))
-        (cond ((not (= line1 line0))
-               (forward-line (- line1 line0))
-               (forward-char (1- col1)))
-              (t (forward-char (- col1 col0))))
-        (exchange-point-and-mark)
-        (funcall twelf-highlight-range-function (point) (mark)))))
-
-(defun twelf-mark-absolute (line0 col0 line1 col1)
-  "Mark error region if location is given as absolute buffer position."
-  (cond ((and line0 col0 line1 col1)   ; line0.col0-line1.col1 range
-        (goto-line line0)
-        ;; don't use move-to-column since <tab> is 1 char to lexer
-        (forward-char (1- col0))
-        ;; select region, if non-empty
-        (push-mark (point))
-        (goto-line line1)
-        (forward-char (1- col1))
-        (exchange-point-and-mark)
-        (funcall twelf-highlight-range-function (point) (mark)))
-       ((and (null col0) (null col1))  ; char0-char1 range
-        (goto-char line0)
-        (push-mark (point))
-        (goto-char line1)
-        (exchange-point-and-mark)
-        (funcall twelf-highlight-range-function (point) (mark)))
-       ((and line0 col0)               ; beginning line0.col0
-        (goto-line line0)
-        (forward-char (1- col0)))
-       (line0                          ; beginning char0
-        (goto-char line0))
-       (t (error "Unrecognized format for error location"))))
-
-(defun twelf-find-decl (filename id)
-  "In FILENAME find probable declaration of ID."
-  (if (not (file-readable-p filename))
-      (error "Cannot read file %s" filename)
-    (switch-to-buffer-other-window (find-file-noselect filename))
-    (goto-char (point-min))
-    (let ((done nil)
-         decl-id)
-      (while (not done)
-       (setq decl-id (twelf-next-decl filename *twelf-last-input-buffer*))
-       (if (not decl-id)
-           (error "Declaration of %s not found in file %s." id filename)
-         (setq done (string= decl-id id))
-         (if (not done) (twelf-end-of-par)))))))
-
-(defun twelf-next-error ()
-  "Find the next error by parsing the Twelf server or Twelf-SML buffer.
-Move the error message on the top line of the window;
-put the cursor at the beginning of the error source. If the
-error message specifies a range, the mark is placed at the end."
-  (interactive)
-  (let ((case-fold-search nil)
-       (twelf-buffer (or *twelf-last-input-buffer*
-                       (error "Cannot determine process buffer with last 
input")))
-       error-begin)
-    (pop-to-buffer twelf-buffer)
-    (goto-char *twelf-error-pos*)   ; go to last error
-    (if (not (re-search-forward twelf-error-regexp (point-max) t))
-       (error "No error message found.")
-      (setq error-begin (match-beginning 0))
-      (setq *twelf-error-pos* (point))
-      (set-window-start (get-buffer-window twelf-buffer)
-                       (save-excursion (beginning-of-line) (point)))
-      (if (twelf-error-decl error-begin)
-         (twelf-find-decl (looked-at-nth 1) (looked-at-nth 2))
-       (let* ((parse (twelf-error-parser error-begin))
-              (file (nth 0 parse))
-              (line0 (nth 1 parse))
-              (col0 (nth 2 parse))
-              (line1 (nth 3 parse))
-              (col1 (nth 4 parse)))
-         (cond ((equal file "stdIn")
-                ;; Error came from direct input
-                (cond ((null *twelf-last-region-sent*)
-                       ;; from last interactive input in the Twelf buffer
-                       (goto-char (point-max))
-                       (comint-previous-input 1)
-                       (setq *twelf-last-region-sent* t)
-                       (goto-char (process-mark
-                                   (get-buffer-process twelf-buffer)))
-                       (twelf-mark-relative line0 col0 line1 col1))
-                      ((eq *twelf-last-region-sent* t)
-                       ;; from the waiting input in the Twelf buffer
-                       (goto-char (process-mark
-                                   (get-buffer-process twelf-buffer)))
-                       (twelf-mark-relative line0 col0 line1 col1))
-                      (t
-                       ;; from a region sent from some buffer
-                       (let ((buf (nth 0 *twelf-last-region-sent*))
-                             (start (nth 1 *twelf-last-region-sent*)))
-                         (switch-to-buffer-other-window buf)
-                         (goto-char start)
-                         (twelf-mark-relative line0 col0 line1 col1)))))
-               ((equal file "Local")
-                ;; Error came from local input, usually to a server process
-                ;; in this case the address relative, and expressed in
-                ;; characters, rather than lines.
-                (let ((local-buffer (nth 0 *twelf-last-region-sent*))
-                      ;; Local characters seem to be off by two
-                      (char0 (+ (nth 1 *twelf-last-region-sent*) (- line0 2)))
-                      (char1 (+ (nth 1 *twelf-last-region-sent*) (- line1 2))))
-                  (switch-to-buffer-other-window local-buffer)
-                  (goto-char char1)
-                  (push-mark)
-                  (goto-char char0)
-                  (exchange-point-and-mark)))
-               ((file-readable-p file)
-                ;; Error came from a source file
-                (switch-to-buffer-other-window (find-file-noselect file))
-                (twelf-mark-absolute line0 col0 line1 col1))
-               (t
-                (error (concat "Can't read file " file)))))))))
-
-(defun twelf-goto-error ()
-  "Go to the error reported on the current line or below.
-Also updates the error cursor to the current line."
-  (interactive)
-  (pop-to-buffer (or *twelf-last-input-buffer*
-                    (error "Cannot determine process buffer with last input")))
-  (beginning-of-line)
-  (setq *twelf-error-pos* (point))
-  (twelf-next-error))
-
-;;;----------------------------------------------------------------------
-;;; NT Emacs bug workaround
-;;;----------------------------------------------------------------------
-
-(defun twelf-convert-standard-filename (filename)
-  "Convert FILENAME to form appropriate for Twelf Server of current OS."
-  (cond ((eq system-type 'windows-nt)
-        (while (string-match "/" filename)
-          (setq filename (replace-match "\\" t t filename)))
-        filename)
-       (t (convert-standard-filename filename))))
-
-;;;----------------------------------------------------------------------
-;;; Communication with Twelf server
-;;;----------------------------------------------------------------------
-
-(defun string-member (x l)
-  (if (null l) nil
-    (or (string-equal x (car l)) (string-member x (cdr l)))))
-
-;(defun twelf-add-to-config-check ()
-;  "Ask if current file should be added to the current Twelf configuration."
-;  (let ((file-name (buffer-file-name)))
-;    (if (and (not (string-member file-name *twelf-config-list*))
-;             (not (null *twelf-config-buffer*))
-;             (yes-or-no-p "Add to the current configuration? "))
-;        (twelf-server-add-file file-name))))
-
-(defun twelf-config-proceed-p (file-name)
-  "Ask if to proceed if FILE-NAME is not in current configuration."
-  (if (and (not (string-member file-name *twelf-config-list*))
-          (not (yes-or-no-p "File not in current configuration.  Save? ")))
-      nil
-    t))
-
-(defun twelf-save-if-config (buffer)
-  "Ask if BUFFER should be saved if in the current configuration.
-Always save if the variable `twelf-save-silently' is non-nil."
-  (let ((file-name (buffer-file-name buffer)))
-    (if (and (buffer-modified-p buffer)
-            file-name
-            (string-member file-name *twelf-config-list*))
-       (if twelf-save-silently
-           (save-buffer)
-         (pop-to-buffer buffer)
-         (if (yes-or-no-p (concat "Save " file-name "? "))
-             (save-buffer))))))
-
-(defun twelf-config-save-some-buffers ()
-  "Cycle through all buffers and save those in the current configuration."
-  (mapcar 'twelf-save-if-config (buffer-list)))
-
-(defun twelf-save-check-config (&optional displayp)
-  "Save its modified buffers and then check the current Twelf configuration.
-With prefix argument also displays Twelf server buffer.
-If necessary, this will start up an Twelf server process."
-  (interactive "P")
-  (let ((current-file-name (buffer-file-name)))
-    (cond ((and current-file-name
-               (not buffer-read-only)
-               (buffer-modified-p)
-               (twelf-config-proceed-p current-file-name))
-          (save-buffer)))
-    (save-excursion
-      (twelf-config-save-some-buffers))
-    (twelf-check-config displayp)))
-
-(defun twelf-check-config (&optional displayp)
-  "Check the current Twelf configuration.
-With prefix argument also displays Twelf server buffer.
-If necessary, this will start up an Twelf server process."
-  (interactive "P")
-  (if (not *twelf-config-buffer*)
-      (call-interactively 'twelf-server-configure))
-  (twelf-server-sync-config)
-  (twelf-focus nil nil)
-  (twelf-server-send-command "Config.load")
-  (twelf-server-wait displayp))
-
-(defun twelf-save-check-file (&optional displayp)
-  "Save buffer and then check it by giving a command to the Twelf server.
-In Twelf Config minor mode, it reconfigures the server.
-With prefix argument also displays Twelf server buffer."
-  (interactive "P")
-  (save-buffer)
-  (if twelf-config-mode
-      (twelf-server-configure (buffer-file-name) "Server OK: Reconfigured")
-    (let* ((save-file (buffer-file-name))
-          (check-file (file-relative-name save-file (twelf-config-directory)))
-          (check-file-os (twelf-convert-standard-filename check-file)))
-      (twelf-server-sync-config)
-      (twelf-focus nil nil)
-      (twelf-server-send-command (concat "loadFile " check-file-os))
-      (twelf-server-wait displayp))))
-
-(defun twelf-buffer-substring (start end)
-  "The substring of the current buffer between START and END.
-The location is recorded for purposes of error parsing."
-  (setq *twelf-last-region-sent* (list (current-buffer) start end))
-  (buffer-substring start end))
-
-(defun twelf-buffer-substring-dot (start end)
-  "The substring of the current buffer between START and END plus
-an end-of-input marker, `%.'.  The location of the input is recorded
-for purposes of error parsing."
-  (concat (twelf-buffer-substring start end) "%."))
-
-(defun twelf-check-declaration (&optional displayp)
-  "Send the current declaration to the Twelf server process for checking.
-With prefix argument also displays Twelf server buffer."
-  (interactive "P")
-  (let* ((par (twelf-current-decl))
-        (par-start (nth 0 par))
-        (par-end (nth 1 par))
-        (decl (twelf-buffer-substring-dot par-start par-end)))
-    (twelf-focus par-start par-end)
-    (twelf-server-send-command (concat "readDecl\n" decl))
-    (twelf-server-wait displayp)))
-
-;(defun twelf-highlight-range (par-start par-end &optional offset)
-;  "Set point and mark to encompass the range analyzed by the Twelf server."
-;  (let* ((range (twelf-parse-range))
-;         (range-start (nth 0 range))
-;         (range-end (nth 1 range))
-;         (offset (if (null offset) 0 offset)))
-;    (if (and (integerp range-start) (integerp range-end))
-;        (progn (goto-char (+ (- (+ par-start range-end) 2) offset))
-;               (push-mark (- (+ par-start range-start) 2))
-;             (funcall twelf-highlight-range-function (point) (mark))))))
-
-(defun twelf-highlight-range-zmacs (start end)
-  "Highlight range as zmacs region.  Assumes point and mark are set.
-Does nothing if function zmacs-activate-region is undefined."
-  (if (fboundp 'zmacs-activate-region)
-      (zmacs-activate-region)))
-
-(defun twelf-focus (&optional start end)
-  "Focus on region between START and END as current declaration or query.  If
-START and END are nil, then no focus exists.  This intermediary just calls
-the appropriate function."
-  (funcall twelf-focus-function start end))
-
-(defun twelf-focus-noop (start end)
-  "This default focus function does nothing."
-  ())
-
-;; Not yet available in Twelf 1.2 -fp
-
-;(defun twelf-type-at-point ()
-;  "Display the type of the subterm at the point in the current Twelf decl.
-
-;The subterm at point is the smallest subterm whose printed representation
-;begins to the left of point and extends up to or beyond point.  After this and
-;similar commands applicable to subterms, the current region (between mark and
-;point) is set to encompass precisely the selected subterm.  In XEmacs,
-;it will thus be highlighted under many circumstances.  In other versions
-;of Emacs \\[exchange-point-and-mark] will indicate the extent of the region.
-
-;The type computed for the subterm at point takes contextual information into
-;account.  For example, if the subterm at point is a constant with implicit
-;arguments, the type displayed will be the instance of the constant (unlike
-;M-x twelf-type-const (\\[twelf-type-const]), which yields the absolute type 
of a constant)."
-
-;  (interactive)
-;  (let* ((par (twelf-current-decl))
-;         (par-start (nth 0 par))
-;         (par-end (nth 1 par))
-;         (decl (twelf-buffer-substring-dot par-start par-end)))
-;    (twelf-focus par-start par-end)
-;    (twelf-server-send-command
-;     (concat "type-at "
-;             (twelf-current-syncat) " "
-;             (int-to-string (+ (- (point) par-start) 2)) "\n"
-;             decl))
-;    (twelf-server-wait t)
-;    (twelf-highlight-range par-start par-end)))
-
-;(defun twelf-expected-type-at-point ()
-;  "Display the type expected at the point in the current declaration.
-
-;This replaces the subterm at point by an underscore _ and determines
-;the type that _ would have to have for the whole declaration to be valid.
-;This is useful for debugging in places where inconsistent type constraints
-;have arisen.  Error messages may be given, but will not be correctly
-;interpreted by Emacs, since the string sent to the server may be different
-;from the declaration in the buffer.
-
-;For a definition of the subterm at point, see function twelf-type-at-point."
-;  (interactive)
-;  (let* ((par (twelf-current-decl))
-;         (par-start (nth 0 par))
-;         (par-end (nth 1 par))
-;         (par-initial-end nil)
-;         (par-final-start nil)
-;         modified-decl)
-;    ;; (exp-present (not (looking-at (concat "[" *whitespace* "]"))))
-;    (backward-sexp 1)
-;    (setq par-initial-end (point))
-;    (forward-sexp 1)
-;    (setq par-final-start (point))
-;    (setq modified-decl
-;          (concat (twelf-buffer-substring par-start par-initial-end)
-;                  "_" (twelf-buffer-substring-dot par-final-start par-end)))
-;    ;; Error messages here are not accurate.  Nontheless:
-;    (setq *twelf-last-region-sent* (list (current-buffer) par-start par-end))
-;    (twelf-focus par-start par-end)
-;    (twelf-server-send-command
-;     (concat "type-at "
-;             (twelf-current-syncat) " "
-;             (int-to-string (1+ (+ (- par-initial-end par-start) 2))) "\n"
-;             modified-decl))
-;    (twelf-server-wait t)
-;    (twelf-highlight-range par-start par-end
-;                       (1- (- par-final-start par-initial-end)))))
-
-;(defun twelf-parse-range ()
-;  "Parse a range as returned by the Twelf server and return as a list."
-;  (save-window-excursion
-;    (let ((twelf-server-buffer (twelf-get-server-buffer)))
-;      (set-buffer twelf-server-buffer)
-;      (goto-char *twelf-server-last-process-mark*)
-;      ;; We are now at the beginning of the output
-;      (re-search-forward "^\\[\\([0-9]+\\),\\([0-9]+\\))")
-;      (list (looked-at-nth-int 1) (looked-at-nth-int 2)))))
-
-(defun twelf-type-const ()
-  "Display the type of the constant before point.
-Note that the type of the constant will be `absolute' rather than the
-type of the particular instance of the constant."
-  (interactive)
-  (let ((previous-point (point)))
-    (skip-chars-backward *whitespace* (point-min))
-    (skip-chars-forward *twelf-id-chars* (point-max))
-    (let ((end-of-id (point)))
-      (skip-chars-backward *twelf-id-chars* (point-min))
-      (let ((c (if (= (point) end-of-id)
-                  ;; we didn't move.  this should eventually become a
-                  ;; completing-read
-                  (read-string "Constant: ")
-                (buffer-substring (point) end-of-id))))
-       (twelf-server-send-command (concat "decl " c))
-       (twelf-server-wait t)             ; Wait for and display reply
-       (goto-char previous-point)))))
-
-;; Unused? -fp
-;(defun twelf-backwards-parse-arglist ()
-;  "Parse an argument list template as returned by the server."
-;  (save-window-excursion
-;    (let ((twelf-server-buffer (twelf-get-server-buffer)))
-;      (set-buffer twelf-server-buffer)
-;      (goto-char *twelf-server-last-process-mark*)
-;      ;; Should be right at the beginning of the output.
-;      ;; (re-search-forward "^arglist") ;
-;      ;; (beginning-of-line 2)
-;      (let ((arglist-begin (point)))
-;        (skip-chars-forward "^." (point-max))
-;        (buffer-substring arglist-begin (point))))))
-
-;; Not yet ported to Twelf 1.2
-;(defun twelf-show-region-in-window (start end)
-;  "Change window parameters so it precisely shows the given region."
-;  (enlarge-window (- (max (count-lines start end) window-min-height)
-;                     (window-height)))
-;  (set-window-start (selected-window) start))
-
-;(defun twelf-show-menu ()
-;  "Display the Twelf server buffer to show menu of possible completions."
-;  (let ((old-buffer (current-buffer))
-;        (twelf-server-buffer (twelf-get-server-buffer))
-;        region-start region-end)
-;    (switch-to-buffer-other-window twelf-server-buffer)
-;    (goto-char *twelf-server-last-process-mark*)
-;    (if (re-search-forward "-\\.$" (point-max) t)
-;        (progn
-;          (forward-char 1)
-;          (setq region-start (point))
-;          (if (re-search-forward "^-\\." (point-max) t)
-;              (setq region-end (point))
-;            (error "List of alternatives not terminated by -.")))
-;      (error "No alternatives found."))
-;    (twelf-show-region-in-window region-start region-end)
-;    (switch-to-buffer-other-window old-buffer)))
-
-;(defun twelf-completions-at-point ()
-;  "List the possible completions of the term at point based on type 
information.
-
-;The possible completions are numbered, and the function twelf-complete
-;(\\[twelf-complete]) can be used subsequently to replace the term at point 
with
-;one of the alternatives.
-
-;Above the display of the alternatives, the type of the subterm at
-;point is shown, since it is this type which is the basis for listing
-;the possible completions.
-
-;In the list alternatives, a variable X free in the remaining declaration
-;is printed ^X, and a bound variable x may be printed as !x.  These marks
-;are intended to aid in the understanding of the alternatives, but
-;must be removed in case the alternative is copied literally into the
-;input declaration (as, for example, with the \\[twelf-complete] command)."
-;  (interactive)
-;  (let* ((par (twelf-current-decl))
-;         (par-start (nth 0 par))
-;         (par-end (nth 1 par))
-;         (decl (twelf-buffer-substring-dot par-start par-end)))
-;    (twelf-focus par-start par-end)
-;    (twelf-server-send-command
-;     (concat "complete-at "
-;             (twelf-current-syncat) " "
-;             (int-to-string (+ (- (point) par-start) 2)) "\n"
-;             decl))
-;    (twelf-server-wait nil)
-;    (twelf-highlight-range par-start par-end)
-;    (twelf-show-menu)))
-
-;(defun twelf-complete (n)
-;  "Pick the alternative N from among possible completions.
-;This replaces the current region with the given pattern.
-;The list of completions must be generated with the command
-;twelf-completions-at-point (\\[twelf-completions-at-point])."
-;  (interactive "NAlternative: ")
-;  (let (start completion)
-;    (save-excursion
-;      (set-buffer (twelf-get-server-buffer))
-;      (goto-char *twelf-server-last-process-mark*)
-;      (if (not (re-search-forward (concat "^" (int-to-string n) "\\. ")
-;                                  (point-max) t))
-;          (error "No alternative %d found in Twelf server buffer." n))
-;      (setq start (point))
-;      (if (not (search-forward " ::" (point-max) t))
-;          (error "List of completions not well-formed."))
-;      (backward-char 3)
-;      (setq completion (buffer-substring start (point))))
-;    (delete-region (point) (mark))
-;    (insert "(" completion ")")
-;    (twelf-show-menu)))
-
-;;;----------------------------------------------------------------------
-;;; Twelf server mode (major mode)
-;;; This is for the buffer with the Twelf server process, to facilitate
-;;; direct interaction (which should rarely be necessary)
-;;;----------------------------------------------------------------------
-
-(defvar twelf-server-mode-map nil
-  "The keymap used in twelf-server mode.")
-
-(cond ((not twelf-server-mode-map)
-       (setq twelf-server-mode-map (copy-keymap comint-mode-map))
-       (install-basic-twelf-keybindings twelf-server-mode-map)
-       ;; C-c C-c is bound to twelf-save-check config in Twelf mode
-       (define-key twelf-server-mode-map "\C-c\C-c" 'twelf-save-check-config)
-       ;; Bind the function shadowed by the previous definition to C-c C-i
-       (define-key twelf-server-mode-map "\C-c\C-i" 'comint-interrupt-subjob)
-       ))
-
-(defconst twelf-server-cd-regexp "^\\s *OS\\.chDir\\s *\\(.*\\)"
-  "Regular expression used to match cd commands in Twelf server buffer.")
-
-(defun looked-at-string (string n)
-  "Substring of STRING consisting of Nth match."
-  (substring string (match-beginning n) (match-end n)))
-
-(defun twelf-server-directory-tracker (input)
-  "Checks input for cd commands and changes default directory in buffer.
-As a side effect, it resets *twelf-error-pos* and *twelf-last-region-sent*
-to indicate interactive input.  Used as comint-input-filter-function in Twelf
-server buffer."
-  (if (twelf-input-filter input)
-      (setq *twelf-last-region-sent* nil))
-  (setq *twelf-last-input-buffer* (current-buffer))
-  (setq *twelf-error-pos* (marker-position (process-mark 
(twelf-server-process))))
-  (cond ((string-match twelf-server-cd-regexp input)
-        (let ((expanded-dir (expand-dir (looked-at-string input 1))))
-          (setq default-directory expanded-dir)
-          (pwd)))
-       ((string-match "^set\\s +chatter\\s +\\([0-9]\\)+" input)
-        (setq twelf-chatter (string-to-number (looked-at-string input 1))))
-       ;;((string-match "^set\\s +trace\\s +\\([0-9]\\)+" input)
-       ;; (setq twelf-trace (string-to-number (looked-at-string input 1))))
-       ((string-match "^set\\s-+\\(\\S-+\\)\\s-+\\(\\w+\\)" input)
-        (if (assoc (looked-at-string input 1) *twelf-track-parms*)
-            (set (cdr (assoc (looked-at-string input 1) *twelf-track-parms*))
-                 (looked-at-string input 2))))))
-
-(defun twelf-input-filter (input)
-  "Function to filter strings before they are saved in input history.
-We filter out all whitespace and anything shorter than two characters."
-  (and (not (string-match "\\`\\s *\\'" input))
-       (> (length input) 1)))
-
-(defun twelf-server-mode ()
-  "Major mode for interacting with an inferior Twelf server process.
-Runs twelf-server-mode-hook.
-
-The following commands are available:
-\\{twelf-server-mode-map}"
-  (interactive)
-  (kill-all-local-variables)
-  ;; Initialize comint parameters
-  (comint-mode)
-  (setq comint-prompt-regexp "^") ;; no prompt
-  (setq comint-input-filter 'twelf-input-filter)
-  ;;changed for XEmacs 19.16
-  ;;(setq comint-input-sentinel 'twelf-server-directory-tracker)
-  (add-hook 'comint-input-filter-functions 'twelf-server-directory-tracker
-           nil t)
-  (twelf-mode-variables)
-  ;; For sequencing through error messages:
-  (make-local-variable '*twelf-error-pos*)
-  (setq *twelf-error-pos* (point-max))
-  ;; Set mode and keymap
-  (setq major-mode 'twelf-server-mode)
-  (setq mode-name "Twelf Server")
-  (setq mode-line-process '(": %s"))
-  (use-local-map twelf-server-mode-map)
-  (twelf-server-add-menu)              ; add Twelf Server menu
-  ;; Run user specified hooks, if any
-  (run-hooks 'twelf-server-mode-hook))
-
-;;;----------------------------------------------------------------------
-;;; Functions to support use of the Twelf server
-;;;----------------------------------------------------------------------
-
-(defun twelf-parse-config ()
-  "Starting at point, parse a configuration file."
-  (let ((filelist nil))
-    (skip-chars-forward *whitespace*)
-    (while (not (eobp))                 ; end of buffer?
-      (cond ((looking-at "%")           ; comment through end of line
-            (end-of-line))
-           (t (let ((begin-point (point))) ; parse filename starting at point
-                (skip-chars-forward (concat "^" *whitespace*))
-                (let* ((file-name (buffer-substring begin-point (point)))
-                       (absolute-file-name
-                        (expand-file-name file-name default-directory)))
-                  (if (file-readable-p absolute-file-name)
-                      (setq filelist (cons absolute-file-name filelist))
-                    (error "File %s not readable." file-name))))))
-      (skip-chars-forward *whitespace*))
-    filelist))
-
-(defun twelf-server-read-config ()
-  "Read the configuration and initialize *twelf-config-list*."
-  (if (or (not (bufferp *twelf-config-buffer*))
-         (null (buffer-name *twelf-config-buffer*)))
-      (error "No current configuration buffer"))
-  (set-buffer *twelf-config-buffer*)
-  (goto-char (point-min))
-  (twelf-parse-config))
-
-(defun twelf-server-sync-config ()
-  "Synchronize the configuration file, buffer, and Twelf server."
-  (if (or (not (bufferp *twelf-config-buffer*))
-         (null (buffer-name *twelf-config-buffer*)))
-      (error "No current configuration buffer"))
-  (if (and twelf-config-mode
-          (not (equal *twelf-config-buffer* (current-buffer)))
-          (yes-or-no-p "Buffer is different from current configuration, 
reconfigure server? "))
-      (twelf-server-configure (buffer-file-name (current-buffer))
-                             "Server OK: Reconfigured"))
-  (save-excursion
-    (set-buffer *twelf-config-buffer*)
-    (if (buffer-modified-p *twelf-config-buffer*)
-       (progn
-         (display-buffer *twelf-config-buffer*)
-         (if (yes-or-no-p "Config buffer has changed, save new version? ")
-             (save-buffer)
-           (message "Checking old configuration"))))
-    (if (not (verify-visited-file-modtime *twelf-config-buffer*))
-       (if (yes-or-no-p "Config file has changed, read new contents? ")
-           (revert-buffer t t)))
-    (if (not (equal (visited-file-modtime) *twelf-config-time*))
-       (progn
-         (display-buffer *twelf-config-buffer*)
-         (if (yes-or-no-p "Config file has changed, reconfigure server? ")
-             (twelf-server-configure (buffer-file-name *twelf-config-buffer*)
-                                   "Server OK: Configured")
-           (if (not (yes-or-no-p "Ask next time? "))
-               (setq *twelf-config-time* (visited-file-modtime))))))))
-
-(defun twelf-get-server-buffer (&optional createp)
-  "Get the current Twelf server buffer.
-Optional argument CREATEP indicates if the buffer should be
-created if it doesn't exist."
-  (if (and (bufferp *twelf-server-buffer*)
-          (not (null (buffer-name *twelf-server-buffer*))))
-      *twelf-server-buffer*
-    (if createp
-       (let ((twelf-server-buffer
-              (get-buffer-create *twelf-server-buffer-name*)))
-         (save-window-excursion
-           (set-buffer twelf-server-buffer)
-           (twelf-server-mode)
-           (setq *twelf-server-buffer* twelf-server-buffer))
-         twelf-server-buffer)
-      (error "No Twelf server buffer"))))
-
-(defun twelf-init-variables ()
-  "Initialize variables that track Twelf server state."
-  (setq twelf-chatter 3)
-  ;;(setq twelf-trace 0)
-  (setq twelf-double-check "false")
-  (setq twelf-print-implicit "false"))
-
-(defun twelf-server (&optional program)
-  "Start an Twelf server process in a buffer named *twelf-server*.
-Any previously existing process is deleted after confirmation.
-Optional argument PROGRAM defaults to the value of the variable
-twelf-server-program.
-This locally re-binds `twelf-server-timeout' to 15 secs."
-  (interactive)
-  (let* ((default-program (if (null program) twelf-server-program program))
-        (default-dir (file-name-directory default-program))
-        (program (expand-file-name
-                  (if (null program)
-                      (read-file-name (concat "Twelf server: (default "
-                                              (file-name-nondirectory
-                                               default-program)
-                                              ") ")
-                                      default-dir
-                                      default-program
-                                      t)
-                    program)))
-        ;; longer timeout during startup
-        (twelf-server-timeout 15))
-    ;; We save the program name as the default for the next time a server is
-    ;; started in this session.
-    (setq twelf-server-program program))
-  (save-window-excursion
-    (let* ((twelf-server-buffer (twelf-get-server-buffer t))
-          (twelf-server-process (get-buffer-process twelf-server-buffer)))
-      (set-buffer twelf-server-buffer)
-      (if (not (null twelf-server-process))
-         (if (yes-or-no-p "Kill current server process? ")
-             (delete-process twelf-server-process)
-           (error "Twelf Server restart aborted")))
-      (goto-char (point-max))
-      (setq *twelf-server-last-process-mark* (point))
-      ;; initialize variables
-      (twelf-init-variables)
-      (start-process *twelf-server-process-name*
-                    twelf-server-buffer
-                    twelf-server-program)
-      (twelf-server-wait)
-      (twelf-server-process))))
-
-(defun twelf-server-process (&optional buffer)
-  "Return the twelf server process, starting one if none exists."
-  (let* ((twelf-server-buffer (if (null buffer) (twelf-get-server-buffer t)
-                             buffer))
-        (twelf-server-process (get-buffer-process twelf-server-buffer)))
-      (if (not (null twelf-server-process))
-         twelf-server-process
-         (twelf-server))))
-
-(defun twelf-server-display (&optional selectp)
-  "Display Twelf server buffer, moving to the end of output.
-With prefix argument also selects the Twelf server buffer."
-  (interactive "P")
-  (display-server-buffer)
-  (if selectp (pop-to-buffer (twelf-get-server-buffer))))
-
-(defun display-server-buffer (&optional buffer)
-  "Display the Twelf server buffer so that the end of output is visible."
-  (let* ((twelf-server-buffer (if (null buffer) (twelf-get-server-buffer)
-                             buffer))
-        (_ (set-buffer twelf-server-buffer))
-        (twelf-server-process (twelf-server-process twelf-server-buffer))
-        (proc-mark (process-mark twelf-server-process))
-        (_ (display-buffer twelf-server-buffer))
-        (twelf-server-window (get-buffer-window twelf-server-buffer)))
-    (if (not (pos-visible-in-window-p proc-mark twelf-server-window))
-       (progn
-         (push-mark proc-mark)
-         (set-window-point twelf-server-window proc-mark)))
-    (sit-for 0)))
-
-(defun twelf-server-send-command (command)
-  "Send a string COMMAND to the Twelf server."
-  (interactive "sCommand: ")
-  (let* ((input (concat command "\n"))
-        (twelf-server-buffer (twelf-get-server-buffer))
-        (twelf-server-process (twelf-server-process twelf-server-buffer)))
-    (if twelf-server-echo-commands
-       (let ((previous-buffer (current-buffer)))
-         (if twelf-server-display-commands
-             (display-server-buffer twelf-server-buffer))
-         (set-buffer twelf-server-buffer)
-         (goto-char (point-max))
-         (insert input)
-         (set-marker (process-mark twelf-server-process) (point-max))
-         (setq *twelf-error-pos* (point-max))
-         (set-buffer previous-buffer)))
-    (setq *twelf-last-input-buffer* twelf-server-buffer)
-    (setq *twelf-server-last-process-mark*
-         (marker-position (process-mark twelf-server-process)))
-    (comint-send-string twelf-server-process input)))
-
-(defun twelf-accept-process-output (process timeout)
-  "Incompatibility workaround for versions of accept-process-output.
-In case the function accepts no TIMEOUT argument, we wait potentially
-forever (until the user aborts, typically with \\[keyboard-quit])."
-  (condition-case nil                  ; do not keep track of error message
-      (accept-process-output process timeout)
-    (wrong-number-of-arguments
-     (accept-process-output process))))
-
-(defun twelf-server-wait (&optional displayp ok-message abort-message)
-  "Wait for server acknowledgment and beep if error occurred.
-If optional argument DISPLAYP is non-NIL, or if an error occurred, the
-Twelf server buffer is displayed.  Optional second and third arguments
-OK-MESSAGE and ABORT-MESSAGE are the strings to show upon successful
-completion or abort of the server which default to \"Server OK\" and
-\"Server ABORT\"."
-  (let* ((chunk-count 0)
-        (last-point *twelf-server-last-process-mark*)
-        (previous-buffer (current-buffer))
-        (previous-match-data (match-data))
-        (twelf-server-buffer (twelf-get-server-buffer))
-        (twelf-server-process (get-buffer-process twelf-server-buffer)))
-    (unwind-protect
-       (catch 'done
-         (set-buffer twelf-server-buffer)
-         (while t
-           (goto-char last-point)
-           (if (re-search-forward "\\(%% OK %%\n\\)\\|\\(%% ABORT %%\n\\)"
-                                  (point-max) 'limit)
-               (cond ((match-beginning 1)
-                      (if displayp
-                          (display-server-buffer twelf-server-buffer))
-                      (message (or ok-message "Server OK"))
-                      (throw 'done nil))
-                     ((match-beginning 2)
-                      (display-server-buffer twelf-server-buffer)
-                      (error (or abort-message "Server ABORT"))
-                      (throw 'done nil)))
-             (cond ((or (not (twelf-accept-process-output
-                              twelf-server-process twelf-server-timeout))
-                        (= last-point (point)))
-                    (display-server-buffer twelf-server-buffer)
-                    (message "Server TIMEOUT, continuing Emacs")
-                    (throw 'done nil))
-                   (t (setq chunk-count (+ chunk-count 1))
-                      (if (= (mod chunk-count 10) 0)
-                          (message (make-string (/ chunk-count 10) ?#)))
-                      (sit-for 0))))))
-      (store-match-data previous-match-data)
-      (set-buffer previous-buffer))))
-
-(defun twelf-server-quit ()
-  "Kill the Twelf server process."
-  (interactive)
-  (twelf-server-send-command "OS.exit"))
-
-(defun twelf-server-interrupt ()
-  "Interrupt the Twelf server process."
-  (interactive)
-  (interrupt-process (twelf-server-process)))
-
-(defun twelf-reset ()
-  "Reset the global signature of Twelf maintained by the server."
-  (interactive)
-  (twelf-server-send-command "reset"))
-
-(defun twelf-config-directory ()
-  "Returns directory with current Twelf server configuration."
-  (let ((config-file (buffer-file-name *twelf-config-buffer*)))
-    (file-name-directory config-file)))
-
-;(defun relativize-file-name (filename dir)
-;  "Relativize FILENAME with respect to DIR, if possible."
-;  (if (string= dir (file-name-directory filename))
-;      (file-name-nondirectory filename)
-;    filename))
-
-(defun twelf-server-configure (config-file &optional ok-message)
-  "Initializes the Twelf server configuration from CONFIG-FILE.
-A configuration file is a list of relative file names in
-dependency order.  Lines starting with % are treated as comments.
-Starts a Twelf servers if necessary."
-  (interactive
-   (list (if twelf-config-mode (buffer-file-name)
-          (expand-file-name
-           (read-file-name "Visit config file: (default sources.cfg) "
-                           default-directory
-                           (concat default-directory "sources.cfg")
-                           nil ; don't require match for now
-                           )))))
-  (let* ((config-file (if (file-directory-p config-file)
-                         (concat config-file "sources.cfg")
-                       config-file))
-        (config-file-os (twelf-convert-standard-filename config-file))
-        (config-dir (file-name-directory config-file))
-        (config-dir-os (twelf-convert-standard-filename config-dir))
-        (config-buffer (set-buffer (or (get-file-buffer config-file)
-                                       (find-file-noselect config-file))))
-        config-list)
-    (setq *twelf-config-buffer* config-buffer)
-    (if (and (not (verify-visited-file-modtime (get-file-buffer config-file)))
-            (yes-or-no-p "Config file has changed, read new contents? "))
-       (revert-buffer t t))
-    (setq config-list (twelf-server-read-config))
-    (twelf-server-process)                ; Start process if necessary
-    (let* ((_ (set-buffer (twelf-get-server-buffer)))
-          (cd-command
-           (if (equal default-directory config-dir)
-               nil
-             (setq default-directory config-dir)
-             (concat "OS.chDir " config-dir-os)))
-          (_ (set-buffer config-buffer)))
-      (cond ((not (null cd-command))
-            (twelf-server-send-command cd-command)
-            (twelf-server-wait nil ""
-                               "Server ABORT: Could not change directory")))
-      (twelf-server-send-command
-       (concat "Config.read " config-file-os))
-      (twelf-server-wait nil (or ok-message "Server OK")
-                      "Server ABORT: Could not be configured")
-      ;; *twelf-config-buffer* should still be current buffer here
-      (setq *twelf-config-time* (visited-file-modtime))
-      (setq *twelf-config-list* config-list))))
-
-;(defun twelf-server-add-file (filename)
-;  "Adds a file to the current configuration."
-;  (interactive
-;   (list (expand-file-name
-;          (read-file-name "File to add: " (twelf-config-directory)))))
-;  (let ((relative-file (file-relative-name filename (twelf-config-directory)))
-;      temp-time)
-;    (save-excursion
-;      (set-buffer *twelf-config-buffer*)
-;      (goto-char (point-max))
-;      (if (not (= (point) (point-min)))
-;          (progn
-;            (backward-char 1)
-;            (if (looking-at "\n")
-;                (forward-char 1)
-;              (forward-char 1)
-;              (insert "\n"))))
-;      (insert (concat relative-file "\n"))
-;      (save-buffer)
-;      (setq temp-time (visited-file-modtime)))
-;    (twelf-server-send-command
-;     (concat "Config.read " (buffer-file-name *twelf-config-buffer*)))
-;    (twelf-server-wait nil "" "Server ABORT: File could not be added to 
configuration")
-;    (setq *twelf-config-list* (cons filename *twelf-config-list*))
-;    (setq *twelf-config-time* temp-time)))
-
-(defun natp (x)
-  "Checks if X is an integer greater or equal to 0."
-  (and (integerp x) (>= x 0)))
-
-(defun twelf-read-nat ()
-  "Reads a natural number from the minibuffer."
-  (let ((num nil))
-    (while (not (natp num))
-      (setq num (read-from-minibuffer "Number: " (if num (prin1-to-string num))
-                                     nil t t))
-      (if (not (natp num)) (beep)))
-    num))
-
-(defun twelf-read-bool ()
-  "Read a boolean in mini-buffer."
-  (completing-read "Boolean: "
-                  '(("true" . true) ("false" . false))
-                  nil t))
-
-(defun twelf-read-limit ()
-  "Read a limit (* or natural number) in mini-buffer."
-  (let ((input (read-string "Limit (* or nat): ")))
-    (if (equal input "*")
-       input
-      (let ((n (string-to-number input)))
-       (if (and (integerp n) (> n 0))
-           n
-         (error "Number must be non-negative integer"))))))
-
-(defun twelf-read-strategy ()
-  "Read a strategy in mini-buffer."
-  (completing-read "Strategy: "
-                  '(("FRS" . "FRS") ("RFS" . "RFS"))
-                  nil t))
-
-(defun twelf-read-value (argtype)
-  "Call the read function appropriate for ARGTYPE and return result."
-  (funcall (cdr (assoc argtype *twelf-read-functions*))))
-
-(defun twelf-set (parm value)
-  "Sets the Twelf parameter PARM to VALUE.
-When called interactively, prompts for parameter and value, supporting
-completion."
-  (interactive
-   (let* ((parm (completing-read
-                "Parameter: " *twelf-parm-table* nil t))
-         (argtype (cdr (assoc parm *twelf-parm-table*)))
-         (value (twelf-read-value argtype)))
-     (list parm value)))
-  (track-parm parm value)              ; track, if necessary
-  (twelf-server-send-command (concat "set " parm " " value)))
-
-(defun twelf-set-parm (parm)
-  "Prompts for and set the value of Twelf parameter PARM.
-Used in menus."
-  (let* ((argtype (cdr (assoc parm *twelf-parm-table*)))
-        (value (and argtype (twelf-read-value argtype))))
-    (if (null argtype)
-       (error "Unknown parameter")
-      (twelf-set parm value))))
-
-(defun track-parm (parm value)
-  "Tracks Twelf parameter values in Emacs."
-  (if (assoc parm *twelf-track-parms*)
-      (set (cdr (assoc parm *twelf-track-parms*)) value)))
-
-(defun twelf-toggle-double-check ()
-  "Toggles doubleCheck parameter of Twelf."
-  (let ((value (if (string-equal twelf-double-check "false")
-                  "true" "false")))
-    (twelf-set "doubleCheck" value)))
-
-(defun twelf-toggle-print-implicit ()
-  "Toggles Print.implicit parameter of Twelf."
-  (let ((value (if (string-equal twelf-print-implicit "false")
-                  "true" "false")))
-    (twelf-set "Print.implicit" value)))
-
-(defun twelf-get (parm)
-  "Prints the value of the Twelf parameter PARM.
-When called interactively, promts for parameter, supporting completion."
-  (interactive (list (completing-read "Parameter: " *twelf-parm-table* nil t)))
-  (twelf-server-send-command (concat "get " parm))
-  (twelf-server-wait)
-  (save-window-excursion
-    (let ((twelf-server-buffer (twelf-get-server-buffer)))
-      (set-buffer twelf-server-buffer)
-      (goto-char *twelf-server-last-process-mark*)
-      ;; We are now at the beginning of the output
-      (end-of-line 1)
-      (message (buffer-substring *twelf-server-last-process-mark* (point))))))
-
-(defun twelf-timers-reset ()
-  "Reset the Twelf timers."
-  (interactive)
-  (twelf-server-send-command "Timers.reset"))
-
-(defun twelf-timers-show ()
-  "Show and reset the Twelf timers."
-  (interactive)
-  (twelf-server-send-command "Timers.show")
-  (twelf-server-wait t))
-
-(defun twelf-timers-check ()
-  "Show the Twelf timers without resetting them."
-  (interactive)
-  (twelf-server-send-command "Timers.show")
-  (twelf-server-wait t))
-
-(defun twelf-server-restart ()
-  "Restarts server and re-initializes configuration.
-This is primarily useful during debugging of the Twelf server code or
-if the Twelf server is hopelessly wedged."
-  (interactive)
-  (twelf-server twelf-server-program)
-  (twelf-server-configure (if *twelf-config-buffer*
-                           (buffer-file-name *twelf-config-buffer*)
-                         "sources.cfg")
-                       "Server configured, now checking...")
-  (twelf-check-config))
-
-;;;----------------------------------------------------------------------
-;;; Twelf Config minor mode
-;;;----------------------------------------------------------------------
-
-(defun twelf-config-mode (&optional prefix)
-  "Toggles minor mode for Twelf configuration files.
-This affects \\<twelf-mode-map>
- twelf-server-configure (\\[twelf-server-configure])
- twelf-save-check-config (\\[twelf-save-check-config])
-"
-  (interactive "P")
-  (make-local-variable 'twelf-config-mode)
-  (cond ((not (assq 'twelf-config-mode minor-mode-alist))
-        (setq minor-mode-alist
-              (cons '(twelf-config-mode " Config") minor-mode-alist))))
-  (cond ((or (not twelf-config-mode) prefix)
-        (setq twelf-config-mode t)
-        (run-hooks 'twelf-config-mode-hook))
-       (t (setq twelf-config-mode t))))
-
-(defun twelf-config-mode-check (&optional buffer)
-  "Switch on the Twelf Config minor mode if the ends in `.cfg'."
-  (if (string-match "\\.cfg$" (buffer-file-name (or buffer (current-buffer))))
-      (twelf-config-mode t)))
-
-;;;----------------------------------------------------------------------
-;;; Support for creating a TAGS file for current Twelf server configuration
-;;;----------------------------------------------------------------------
-
-(defun twelf-tag (&optional tags-filename)
-  "Create tags file for current configuration.
-If the current configuration is sources.cfg, the tags file is TAGS.
-If current configuration is named FILE.cfg, tags file will be named FILE.tag
-Errors are displayed in the Twelf server buffer.
-Optional argument TAGS-FILENAME specifies alternative filename."
-  (interactive)
-  (twelf-server-sync-config)
-  (let* ((error-buffer (twelf-get-server-buffer))
-        (config-filename (buffer-file-name *twelf-config-buffer*))
-        (tags-file
-         (or tags-filename
-             (if (string-equal "sources.cfg"
-                               (file-name-nondirectory config-filename))
-                 (concat (file-name-directory config-filename "TAGS"))
-               (concat (file-name-sans-extension config-filename)
-                       ".tag")))))
-    (save-excursion
-      (set-buffer error-buffer)
-      (goto-char (point-max))
-      (insert "Tagging configuration " config-filename " in file " tags-file 
"\n"))
-    (set-buffer *twelf-config-buffer*)
-    (twelf-tag-files (rev-relativize *twelf-config-list* default-directory)
-                  tags-file error-buffer)
-    (if (get-buffer-process error-buffer)
-       (set-marker (process-mark (get-buffer-process error-buffer))
-                   (point-max)))))
-
-(defun twelf-tag-files (filelist &optional tags-filename error-buffer)
-  "Create tags file for FILELIST, routing errors to buffer *tags-errors*.
-Optional argument TAGS-FILENAME specifies alternative filename (default: TAGS),
-optional argument ERROR-BUFFER specifies alternative buffer for error message
-(default: *tags-errors*)."
-  (let* ((tags-filename (or tags-filename "TAGS"))
-        (tags-buffer (find-file-noselect tags-filename))
-        (error-buffer (or error-buffer (new-temp-buffer "*tags-errors*"))))
-    (save-excursion
-      (set-buffer tags-buffer)
-      (if (equal (point-min) (point-max))
-         nil
-       ;;(pop-to-buffer tags-buffer)
-       ;;(if (yes-or-no-p "Delete current tags information? ")
-       (delete-region (point-min) (point-max))
-       ;;)
-       ))
-    (switch-to-buffer-other-window error-buffer)
-    (while (not (null filelist))
-      (twelf-tag-file (car filelist) tags-buffer error-buffer)
-      (setq filelist (cdr filelist)))
-    (save-excursion
-      (set-buffer tags-buffer)
-      (save-buffer))))
-
-(defun twelf-tag-file (filename tags-buffer error-buffer)
-  "Deposit tag information for FILENAME in TAGS-BUFFER, errors in 
ERROR-BUFFER."
-  (let ((src-buffer (find-file-noselect filename))
-       file-start file-end end-of-id tag-string)
-    (save-excursion
-      (set-buffer tags-buffer)
-      (goto-char (point-max))
-      (insert "\f\n" filename ",0\n")
-      (setq file-start (point))
-      (save-excursion
-       (set-buffer src-buffer)
-       (goto-char (point-min))
-       (while (twelf-next-decl filename error-buffer)
-         (setq end-of-id (point))
-         (beginning-of-line 1)
-         (setq tag-string
-               (concat (buffer-substring (point) end-of-id)
-                       "\C-?" (current-line-absolute) "," (point) "\n"))
-         (goto-char end-of-id)
-         (if (not (twelf-end-of-par))
-             (let ((error-line (current-line-absolute)))
-               (save-excursion
-                 (set-buffer error-buffer)
-                 (goto-char (point-max))
-                 (insert filename ":" (int-to-string error-line)
-                         " Warning: missing period\n"))))
-         (save-excursion
-           (set-buffer tags-buffer)
-           (insert tag-string))))
-      (setq file-end (point-max))
-      (goto-char (- file-start 2))
-      (delete-char 1)
-      (insert (int-to-string (- file-end file-start)))
-      (goto-char (point-max)))))
-
-(defun twelf-next-decl (filename error-buffer)
-  "Set point after the identifier of the next declaration.
-Return the declared identifier or `nil' if none was found.
-FILENAME and ERROR-BUFFER are used if something appears wrong."
-  (let ((id nil)
-       end-of-id
-       beg-of-id)
-    (skip-twelf-comments-and-whitespace)
-    (while (and (not id) (not (eobp)))
-      (setq beg-of-id (point))
-      (if (zerop (skip-chars-forward *twelf-id-chars*))
-         ;; Not looking at id: skip ahead
-         (skip-ahead filename (current-line-absolute) "No identifier"
-                     error-buffer)
-       (setq end-of-id (point))
-       (skip-twelf-comments-and-whitespace)
-       (if (not (looking-at ":"))
-           ;; Not looking at valid decl: skip ahead
-           (skip-ahead filename (current-line-absolute end-of-id) "No colon"
-                       error-buffer)
-         (goto-char end-of-id)
-         (setq id (buffer-substring beg-of-id end-of-id))))
-      (skip-twelf-comments-and-whitespace))
-    id))
-
-(defun skip-ahead (filename line message error-buffer)
-  "Skip ahead when syntactic error was found.
-A parsable error message constited from FILENAME, LINE, and MESSAGE is
-deposited in ERROR-BUFFER."
-  (if error-buffer
-      (save-excursion
-       (set-buffer error-buffer)
-       (goto-char (point-max))
-       (insert filename ":" (int-to-string line) " Warning: " message "\n")
-       (setq *twelf-error-pos* (point))))
-  (twelf-end-of-par))
-
-(defun current-line-absolute (&optional char-pos)
-  "Return line number of CHAR-POS (default: point) in current buffer.
-Ignores any possible buffer restrictions."
-  (1+ (count-lines 1 (or char-pos (point)))))
-
-(defun new-temp-buffer (&optional name)
-  "Create or delete contents of buffer named \"*temp*\" and return it.
-Optional argument NAME specified an alternative name."
-  (if (not name) (setq name "*temp*"))
-  (if (get-buffer name)
-      (save-excursion
-       (set-buffer name)
-       (delete-region (point-min) (point-max))
-       (get-buffer name))
-    (get-buffer-create name)))
-
-(defun rev-relativize (filelist dir)
-  "Reverse and relativize FILELIST with respect to DIR."
-  (let ((newlist nil))
-    (while (not (null filelist))
-      (setq newlist
-           (cons (file-relative-name (car filelist) dir) newlist))
-      (setq filelist (cdr filelist)))
-    newlist))
-
-
-;;;----------------------------------------------------------------------
-;;; Twelf-SML mode
-;;;----------------------------------------------------------------------
-
-(defvar twelf-sml-mode-map nil
-  "The keymap used in Twelf-SML mode.")
-
-(cond ((not twelf-sml-mode-map)
-       ;;(setq twelf-sml-mode-map (full-copy-sparse-keymap comint-mode-map))
-       ;; fixed for Emacs 19.25.  -fp Thu Oct 27 09:08:44 1994
-       (setq twelf-sml-mode-map (copy-keymap comint-mode-map))
-       (install-basic-twelf-keybindings twelf-sml-mode-map)
-       ))
-
-(defconst twelf-sml-prompt-regexp "^\\- \\|^\\?\\- ")
-
-(defun expand-dir (dir)
-  "Expand argument and check that it is a directory."
-  (let ((expanded-dir (file-name-as-directory (expand-file-name dir))))
-    (if (not (file-directory-p expanded-dir))
-       (error "%s is not a directory" dir))
-    expanded-dir))
-
-(defun twelf-sml-cd (dir)
-  "Make DIR become the Twelf-SML process' buffer's default directory and
-furthermore issue an appropriate command to the inferior Twelf-SML process."
-  (interactive "DChange default directory: ")
-  (let ((expanded-dir (expand-dir dir)))
-    (save-excursion
-      (set-buffer (twelf-sml-process-buffer))
-      (setq default-directory expanded-dir)
-      (comint-simple-send (twelf-sml-process) (concat "Twelf.OS.chDir \"" 
expanded-dir "\";")))
-    ;;(pwd)
-    ))
-
-(defconst twelf-sml-cd-regexp "^\\s *cd\\s *\"\\([^\"]*\\)\""
-  "Regular expression used to match cd commands in Twelf-SML buffer.")
-
-(defun twelf-sml-directory-tracker (input)
-  "Checks input for cd commands and changes default directory in buffer.
-As a side-effect, it sets *twelf-last-region-sent* to NIL to indicate 
interactive
-input.  As a second side-effect, it resets the *twelf-error-pos*.
-Used as comint-input-sentinel in Twelf-SML buffer."
-  (if (twelf-input-filter input)
-      (setq *twelf-last-region-sent* nil))
-  (setq *twelf-last-input-buffer* (current-buffer))
-  (setq *twelf-error-pos* (marker-position (process-mark (twelf-sml-process))))
-  (cond ((string-match twelf-sml-cd-regexp input)
-        (let ((expanded-dir (expand-dir (substring input
-                                                   (match-beginning 1)
-                                                   (match-end 1)))))
-          (setq default-directory expanded-dir)
-          (pwd)))))
-
-(defun twelf-sml-mode ()
-  "Major mode for interacting with an inferior Twelf-SML process.
-
-The following commands are available:
-\\{twelf-sml-mode-map}
-
-An Twelf-SML process can be started with \\[twelf-sml].
-
-Customisation: Entry to this mode runs the hooks on twelf-sml-mode-hook.
-
-You can send queries to the inferior Twelf-SML process from other buffers.
-
-Commands:
-Return after the end of the process' output sends the text from the
-    end of process to point.
-Return before the end of the process' output copies the current line
-    to the end of the process' output, and sends it.
-Delete converts tabs to spaces as it moves back.
-Tab indents for Twelf; with argument, shifts rest
-    of expression rigidly with the current line.
-C-M-q does Tab on each line starting within following expression.
-Paragraphs are separated only by blank lines.  % start single comments,
-delimited comments are enclosed in %{...}%.
-If you accidentally suspend your process, use \\[comint-continue-subjob]
-to continue it."
-  (interactive)
-  (kill-all-local-variables)
-  (comint-mode)
-  (setq comint-prompt-regexp twelf-sml-prompt-regexp)
-  (setq comint-input-filter 'twelf-input-filter)
-  ;; changed for XEmacs 19.16 Sat Jun 13 11:28:53 1998
-  (add-hook 'comint-input-filter-functions 'twelf-sml-directory-tracker
-           nil t)
-  (twelf-mode-variables)
-
-  ;; For sequencing through error messages:
-  (make-local-variable '*twelf-error-pos*)
-  (setq *twelf-error-pos* (point-max))
-  ;; Workaround for problem with Lucid Emacs version of comint.el:
-  ;; must exclude double quotes " and must include $ and # in filenames.
-  (make-local-variable 'comint-match-partial-pathname-chars)
-  (setq comint-match-partial-pathname-chars
-       "^][<>{}()!^&*\\|?`'\" \t\n\r\b")
-
-  (setq major-mode 'twelf-sml-mode)
-  (setq mode-name "Twelf-SML")
-  (setq mode-line-process '(": %s"))
-  (use-local-map twelf-sml-mode-map)
-
-  (run-hooks 'twelf-sml-mode-hook))
-
-(defun twelf-sml (&optional cmd)
-  "Run an inferior Twelf-SML process in a buffer *twelf-sml*.
-If there is a process already running in *twelf-sml*, just
-switch to that buffer.  With argument, allows you to change the program
-which defaults to the value of twelf-sml-program.  Runs the hooks from
-twelf-sml-mode-hook (after the comint-mode-hook is run).
-
-Type \\[describe-mode] in the process buffer for a list of commands."
-  (interactive (list (and current-prefix-arg
-                         (read-string "Run Twelf-SML: " twelf-sml-program))))
-  (let ((cmd (or cmd twelf-sml-program)))
-    (cond ((not (comint-check-proc (twelf-sml-process-buffer)))
-          ;; process does not already exist
-          (set-buffer (apply 'make-comint "twelf-sml" cmd nil twelf-sml-args))
-          ;; in case we are using SML mode (for error tracking)
-          (if (boundp 'sml-buffer)
-              (set 'sml-buffer (twelf-sml-process-buffer)))
-          (twelf-sml-mode))))
-  (switch-to-buffer (twelf-sml-process-buffer)))
-
-(defun switch-to-twelf-sml (eob-p)
-  "Switch to the Twelf-SML process buffer.
-With argument, positions cursor at end of buffer."
-  (interactive "P")
-  (if (twelf-sml-process-buffer)
-      (pop-to-buffer (twelf-sml-process-buffer))
-      (error "No current process buffer. "))
-  (cond (eob-p
-        (push-mark)
-        (goto-char (point-max)))))
-
-(defun display-twelf-sml-buffer (&optional buffer)
-  "Display the Twelf-SML buffer so that the end of output is visible."
-  ;; Accept output from Twelf-SML process
-  (sit-for 1)
-  (let* ((twelf-sml-buffer (if (null buffer) (twelf-sml-process-buffer)
-                      buffer))
-        (_ (set-buffer twelf-sml-buffer))
-        (twelf-sml-process (twelf-sml-process))
-        (proc-mark (process-mark twelf-sml-process))
-        (_ (display-buffer twelf-sml-buffer))
-        (twelf-sml-window (get-buffer-window twelf-sml-buffer)))
-    (if (not (pos-visible-in-window-p proc-mark twelf-sml-window))
-       (progn
-         (push-mark proc-mark)
-         (set-window-point twelf-sml-window proc-mark)))))
-
-(defun twelf-sml-send-string (string)
-  "Send the given string to the Twelf-SML process."
-  (setq *twelf-last-input-buffer* (twelf-sml-process-buffer))
-  (comint-send-string (twelf-sml-process) string))
-
-(defun twelf-sml-send-region (start end &optional and-go)
-  "Send the current region to the inferior Twelf-SML process.
-Prefix argument means switch-to-twelf-sml afterwards.
-If the region is short, it is sent directly, via COMINT-SEND-REGION."
-  (interactive "r\nP")
-  (if (> start end)
-      (twelf-sml-send-region end start and-go)
-    ;; (setq twelf-sml-last-region-sent (list (current-buffer) start end))
-    (let ((cur-buffer (current-buffer))
-         (twelf-sml-buffer (twelf-sml-process-buffer)))
-      (switch-to-buffer twelf-sml-buffer)
-      ;; (setq sml-error-pos (marker-position (process-mark 
(twelf-sml-process))))
-      (setq *twelf-last-input-buffer* twelf-sml-buffer)
-      (switch-to-buffer cur-buffer))
-    (comint-send-region (twelf-sml-process) start end)
-    (if (not (string= (buffer-substring (1- end) end) "\n"))
-       (comint-send-string (twelf-sml-process) "\n"))
-    ;; Next two lines mess up when an Twelf error occurs, since the
-    ;; newline is not read and later messes up counting.
-    ;; (if (not and-go)
-    ;;  (comint-send-string (twelf-sml-process) "\n"))
-    (if and-go (switch-to-twelf-sml t)
-      (if twelf-sml-display-queries (display-twelf-sml-buffer)))))
-
-(defun twelf-sml-send-query (&optional and-go)
-  "Send the current declaration to the inferior Twelf-SML process as a query.
-Prefix argument means switch-to-twelf-sml afterwards."
-  (interactive "P")
-  (let* ((par (twelf-current-decl))
-        (query-start (nth 0 par))
-        (query-end (nth 1 par)))
-    (twelf-sml-set-mode 'TWELF)
-    (twelf-sml-send-region query-start query-end and-go)))
-
-(defun twelf-sml-send-newline (&optional and-go)
-  "Send a newline to the inferior Twelf-SML process.
-If a prefix argument is given, switches to Twelf-SML buffer afterwards."
-  (interactive "P")
-  (twelf-sml-send-string "\n")
-  (if and-go (switch-to-twelf-sml t)
-    (if twelf-sml-display-queries (display-twelf-sml-buffer))))
-
-(defun twelf-sml-send-semicolon (&optional and-go)
-  "Send a semi-colon to the inferior Twelf-SML process.
-If a prefix argument is given, switched to Twelf-SML buffer afterwards."
-  (interactive "P")
-  (twelf-sml-send-string ";\n")
-  (if and-go (switch-to-twelf-sml t)
-    (if twelf-sml-display-queries (display-twelf-sml-buffer))))
-
-(defun twelf-sml-status (&optional buffer)
-  "Returns the status of the Twelf-SML process.
-This employs a heuristic, looking at the contents of the Twelf-SML buffer.
-Results:
- NONE --- no process
- ML   --- ML top level
- TWELF  --- Twelf top level
- MORE --- asking whether to find the next solution
- UNKNOWN --- process is running, but can't tell status."
-  (let* ((twelf-sml-buffer (or buffer (twelf-sml-process-buffer)))
-        (twelf-sml-process (get-buffer-process twelf-sml-buffer)))
-    (if (null twelf-sml-process)
-       'NONE
-      (save-excursion
-       (set-buffer twelf-sml-buffer)
-       (let ((buffer-end (buffer-substring (max (point-min) (- (point-max) 3))
-                                           (point-max))))
-         (cond ((string-match "\\?- " buffer-end) 'TWELF)
-               ((string-match "\n- " buffer-end) 'ML)
-               ((string-match "More\\? " buffer-end) 'MORE)
-               (t 'UNKNOWN)))))))
-
-(defvar twelf-sml-init "Twelf.Config.load (Twelf.Config.read 
\"sources.cfg\");\n"
-  "Initial command sent to Twelf-SML process when started during 
twelf-sml-set-mode 'TWELF.")
-
-(defun twelf-sml-set-mode (mode &optional buffer)
-  "Attempts to read and if necessary correct the mode of the Twelf-SML buffer.
-This does not check if the status has been achieved.  It returns NIL
-if the status is unknown and T if it believes the status should have
-been achieved.  This allows for asynchronous operation."
-  (cond
-    ((eq mode 'ML)
-     (let ((status (twelf-sml-status)))
-       (cond ((eq status 'NONE) (twelf-sml) 't)
-            ((eq status 'ML) 't)
-            ((eq status 'TWELF) (twelf-sml-send-string "") 't)
-            ((eq status 'MORE) (twelf-sml-send-string "q\n") 't)
-            ((eq status 'UNKNOWN) nil))))
-    ((eq mode 'TWELF)
-     (let ((status (twelf-sml-status)))
-       (cond ((eq status 'NONE)
-             (twelf-sml)
-             (twelf-sml-send-string twelf-sml-init)
-             (twelf-sml-send-string "Twelf.top ();\n") 't)
-            ((eq status 'ML)
-             (twelf-sml-send-string "Twelf.top ();\n") 't)
-            ((eq status 'TWELF) 't)
-            ((eq status 'MORE) (twelf-sml-send-string "\n") 't)
-            ((eq status 'UNKNOWN) nil))))
-    (t (error "twelf-sml-set-mode: illegal mode %s" mode))))
-
-(defun twelf-sml-quit ()
-  "Kill the Twelf-SML process."
-  (interactive)
-  (kill-process (twelf-sml-process)))
-
-(defun twelf-sml-process-buffer ()
-  "Returns the current Twelf-SML process buffer."
-  (get-buffer "*twelf-sml*"))
-
-(defun twelf-sml-process (&optional buffer)
-  "Returns the current Twelf-SML process."
-  (let ((proc (get-buffer-process (or buffer (twelf-sml-process-buffer)))))
-    (or proc
-       (error "No current process."))))
-
-;;;----------------------------------------------------------------------
-;;; 2Twelf-SML minor mode for Twelf
-;;; Some keybindings now refer to Twelf-SML instead of the Twelf server.
-;;; Toggle with twelf-to-twelf-sml-mode
-;;;----------------------------------------------------------------------
-
-(defvar twelf-to-twelf-sml-mode nil
-  "Non-NIL means the minor mode is in effect.")
-
-(defun install-twelf-to-twelf-sml-keybindings (map)
-  ;; Process commands:
-  (define-key map "\C-c\C-r" 'twelf-sml-send-region)
-  (define-key map "\C-c\C-e" 'twelf-sml-send-query)
-  (define-key map "\C-c\C-m" 'twelf-sml-send-newline)
-  (define-key map "\C-c\n" 'twelf-sml-send-newline)
-  (define-key map "\C-c;" 'twelf-sml-send-semicolon)
-  (define-key map "\C-cd" 'twelf-sml-cd)
-  )
-
-(defvar twelf-to-twelf-sml-mode-map nil
-  "Keymap for twelf-to-twelf-sml minor mode.")
-
-(cond ((not twelf-to-twelf-sml-mode-map)
-       (setq twelf-to-twelf-sml-mode-map (make-sparse-keymap))
-       (install-basic-twelf-keybindings twelf-to-twelf-sml-mode-map)
-       (install-twelf-keybindings twelf-to-twelf-sml-mode-map)
-       ;; The next line shadows certain bindings to refer to
-       ;; Twelf-SML instead of the Twelf server.
-       (install-twelf-to-twelf-sml-keybindings twelf-to-twelf-sml-mode-map)))
-
-(defun twelf-to-twelf-sml-mode (&optional prefix)
-  "Toggles minor mode for sending queries to Twelf-SML instead of Twelf server.
-Specifically:   \\<twelf-to-twelf-sml-mode-map>
- \\[twelf-sml-send-query] (for sending queries),
- \\[twelf-sml-send-newline] (for sending newlines) and
- \\[twelf-sml-send-semicolon] (for sending `;')
-are rebound.
-
-Mode map
-========
-\\{twelf-to-twelf-sml-mode-map}
-"
-  (interactive "P")
-  (make-local-variable 'twelf-to-twelf-sml-mode)
-  (cond ((not (assq 'twelf-to-twelf-sml-mode minor-mode-alist))
-        (setq minor-mode-alist
-              (cons '(twelf-to-twelf-sml-mode " 2Twelf-SML")
-                    minor-mode-alist))))
-  (cond ((or (not twelf-to-twelf-sml-mode) prefix)
-        (setq twelf-to-twelf-sml-mode t)
-        (use-local-map twelf-to-twelf-sml-mode-map)
-        (run-hooks 'twelf-to-twelf-sml-mode-hook))
-       (t
-        (setq twelf-to-twelf-sml-mode nil)
-        (use-local-map twelf-mode-map))))
-
-;;;----------------------------------------------------------------------
-;;; Twelf mode menus
-;;; requires auc-menu utilities
-;;;----------------------------------------------------------------------
-
-(cond
- ((string-match "XEmacs" emacs-version) ;; XEmacs nee Lucid Emacs
-  (defun radio (label callback condition)
-    (vector label callback ':style 'radio ':selected condition))
-  (defun toggle (label callback condition)
-    (vector label callback ':style 'toggle ':selected condition))
-  (defun disable-form (label callback condition)
-    (vector label callback condition))
-  )
- (t ;; FSF Emacs 19
-  (defun radio (label callback condition)
-    (vector label callback t))
-  (defun toggle (label callback condition)
-    (vector label callback t))
-  (defun disable-form (label callback condition)
-    (cond ((symbolp condition) (vector label callback condition))
-         (t (vector label callback t))))
-  ))
-
-(defconst twelf-at-point-menu
-  '("At Point"
-    ["Constant" twelf-type-const t]
-    ;["Type" twelf-type-at-point nil]  ;disabled for Twelf 1.2
-    ;["Expected Type" twelf-expected-type-at-point nil] ;disabled
-    ;["List Completions" twelf-completions-at-point nil]       ;disabled
-    ;["Complete" twelf-complete nil] ;disabled
-    )
-  "Menu for commands applying at point.")
-
-(defconst twelf-server-state-menu
-  '("Server State"
-    ["Configure" twelf-server-configure t]
-    ["Interrupt" twelf-server-interrupt t]
-    ["Reset" twelf-reset t]
-    ["Start" twelf-server t]
-    ["Restart" twelf-server-restart t]
-    ["Quit" twelf-server-quit t])
-  "Menu for commands affecting server state.")
-
-(defconst twelf-error-menu
-  '("Error Tracking"
-    ["Next" twelf-next-error t]
-    ["Goto" twelf-goto-error t])
-  "Menu for error commands.")
-
-(defconst twelf-tags-menu
-  '("Tags"
-    ["Find" find-tag t]
-    ["Find Other Window" find-tag-other-window t]
-    ["Query Replace" tags-query-replace t]
-    ["Search" tags-search t]
-    ["Continue" tags-loop-continue t]
-    ["Create/Update" twelf-tag t])
-  "Menu for tag commands.")
-
-(defun twelf-toggle-server-display-commands ()
-  (setq twelf-server-display-commands (not twelf-server-display-commands)))
-
-(defconst twelf-options-menu
-  `("Options"
-    (, (toggle "Display Commands" '(twelf-toggle-server-display-commands)
-              'twelf-server-display-commands))
-    ("chatter"
-     (, (radio "0" '(twelf-set "chatter" 0) '(= twelf-chatter 0)))
-     (, (radio "1" '(twelf-set "chatter" 1) '(= twelf-chatter 1)))
-     (, (radio "2" '(twelf-set "chatter" 2) '(= twelf-chatter 2)))
-     (, (radio "3*" '(twelf-set "chatter" 3) '(= twelf-chatter 3)))
-     (, (radio "4" '(twelf-set "chatter" 4) '(= twelf-chatter 4)))
-     (, (radio "5" '(twelf-set "chatter" 5) '(= twelf-chatter 5)))
-     (, (radio "6" '(twelf-set "chatter" 6) '(= twelf-chatter 6))))
-    (, (toggle "doubleCheck" '(twelf-toggle-double-check)
-              '(string-equal twelf-double-check "true")))
-    ("Print."
-     (, (toggle "implicit" '(twelf-toggle-print-implicit)
-               '(string-equal twelf-print-implicit "true")))
-     ["depth" (twelf-set-parm "Print.depth") t]
-     ["length" (twelf-set-parm "Print.length") t]
-     ["indent" (twelf-set-parm "Print.indent") t]
-     ["width" (twelf-set-parm "Print.width") t])
-    ("Prover."
-     ["strategy" (twelf-set-parm "Prover.strategy") t]
-     ["maxSplit" (twelf-set-parm "Prover.maxSplit") t]
-     ["maxRecurse" (twelf-set-parm "Prover.maxRecurse") t])
-    ;;["Trace" nil nil]
-    ;; (, (radio "0" '(twelf-set "trace" 0) '(= twelf-trace 0)))
-    ;; (, (radio "1" '(twelf-set "trace 1) '(= twelf-trace 1)))
-    ;; (, (radio "2" '(twelf-set "trace" 2) '(= twelf-trace 2))))
-    ;;["Untrace" nil nil]
-    ;;(, (disable-form "Untrace" '(twelf-set "trace" 0)
-    ;;        '(not (= twelf-trace 0))))
-    ["Reset Menubar" twelf-reset-menu t])
-  "Menu to change options in Twelf mode.")
-
-(defconst twelf-timers-menu
-  '("Timing"
-    ["Show and Reset" twelf-timers-show t]
-    ["Check" twelf-timers-check t]
-    ["Reset" twelf-timers-reset t]))
-
-;(autoload 'toggle-twelf-font-immediate "twelf-font"
-;  "Toggle experimental immediate highlighting in font-lock mode.")
-(autoload 'twelf-font-fontify-decl "twelf-font"
-  "Fontify current declaration using font-lock minor mode.")
-(autoload 'twelf-font-fontify-buffer "twelf-font"
-  "Fontify current buffer using font-lock minor mode.")
-
-(defconst twelf-syntax-menu
-  `("Syntax Highlighting"
-    ["Highlight Declaration" twelf-font-fontify-decl t]
-    ["Highlight Buffer" twelf-font-fontify-buffer t]
-    ;;(, (toggle "Immediate Highlighting" 'toggle-twelf-font-immediate
-    ;;'font-lock-mode))
-    )
-  "Menu for syntax highlighting in Twelf mode.")
-
-(easy-menu-define twelf-menu (list twelf-mode-map)
-  "Menu for Twelf mode.
-This may be selected from the menubar.  In XEmacs, also bound to Button3."
-  (list
-   "Twelf"
-   ["Display Server" twelf-server-display t]
-   ["Check Configuration" twelf-save-check-config t]
-   ["Check File" twelf-save-check-file t]
-   ["Check Declaration" twelf-check-declaration t]
-   twelf-at-point-menu
-   twelf-error-menu
-   twelf-options-menu
-   twelf-syntax-menu
-   twelf-tags-menu
-   twelf-timers-menu
-   twelf-server-state-menu
-   ["Info" twelf-info t]))
-
-(defun twelf-add-menu ()
-  "Add Twelf menu to menubar."
-  (easy-menu-add twelf-menu twelf-mode-map))
-
-(defun twelf-remove-menu ()
-  "Remove Twelf menu from menubar."
-  (easy-menu-remove twelf-menu))
-
-(defun twelf-reset-menu ()
-  "Reset Twelf menu."
-  (twelf-remove-menu)
-  (twelf-add-menu))
-
-;;;----------------------------------------------------------------------
-;;; Twelf Server mode menu
-;;;----------------------------------------------------------------------
-
-(easy-menu-define twelf-server-menu (list twelf-server-mode-map)
-  "Menu for Twelf Server mode.
-This may be selected from the menubar.  In XEmacs, also bound to Button3."
-  (list
-   "Twelf-Server"
-   ;; ["Display Server" twelf-server-display t]
-   ["Check Configuration" twelf-save-check-config t]
-   ;; ["Check File" twelf-save-check-file nil]
-   ;; ["Check Declaration" twelf-check-declaration nil]
-   ;; ["Check Query" twelf-check-query nil]
-   ;; ["Solve Query" twelf-solve-query nil]
-   ;; ["At Point" () nil]
-   twelf-error-menu
-   twelf-options-menu
-   twelf-tags-menu
-   twelf-server-state-menu
-   ["Info" twelf-info t]))
-
-(defun twelf-server-add-menu ()
-  "Add Twelf menu to menubar."
-  (easy-menu-add twelf-server-menu twelf-server-mode-map))
-
-(defun twelf-server-remove-menu ()
-  "Remove Twelf menu from menubar."
-  (easy-menu-remove twelf-server-menu))
-
-(defun twelf-server-reset-menu ()
-  "Reset Twelf menu."
-  (twelf-server-remove-menu)
-  (twelf-server-add-menu))
-
-(provide 'twelf-old)
diff --git a/twelf/twelf.el b/twelf/twelf.el
deleted file mode 100644
index 236846f970..0000000000
--- a/twelf/twelf.el
+++ /dev/null
@@ -1,209 +0,0 @@
-;; twelf.el  Proof General instance for Twelf
-;;
-;; Copyright (C) 2000 LFCS Edinburgh.
-;; License:   GPL (GNU GENERAL PUBLIC LICENSE)
-;; Author:    David Aspinall <David.Aspinall@ed.ac.uk>
-;;
-;; $Id$
-;;
-;;
-;; TODO:
-;;   Info doc menu entry
-;;   X-Symbol upgrade/test?  Mule XE better?
-;;
-
-
-(require 'proof-easy-config)            ; easy configure mechanism
-
-(require 'twelf-font)                  ; font lock configuration
-;; (require 'twelf-old)
-;; FIXME: put parts of old code into twelf-syntax or similar
-
-;;
-;; User configuration settings for Twelf PG
-;;
-(defcustom twelf-root-dir
-  "/usr/local/twelf/"
-  "*Root of twelf installation.  Default /usr/local/twelf suits RPM package."
-  :type 'file
-  :group 'twelf)
-
-(defcustom twelf-info-dir
-  (concat twelf-root-dir "doc/info/")
-  "*Directory of Twelf Infor files."
-  :type 'file
-  :group 'twelf)
-
-;;
-;; Instantiation of Proof General
-;;
-(proof-easy-config 'twelf "Twelf"
- proof-prog-name                "twelf-server"
- proof-assistant-home-page       "http://www.cs.cmu.edu/~twelf/";
-
- proof-terminal-char             ?\.
- proof-script-comment-start             "%"    ;; for inserting comments
- proof-script-comment-end               ""
- proof-script-comment-start-regexp      "%[%{ \t\n\f]" ;; recognizing
- proof-script-comment-end-regexp        "%}\\|\n"      ;; comments
-
- proof-shell-auto-terminate-commands nil ; server commands don't end with .
- proof-shell-strip-crs-from-input nil   ; server needs CRs with readDecl
-
- proof-auto-multiple-files       t
- proof-shell-cd-cmd              "OS.chDir %s"
- proof-shell-interrupt-regexp    "interrupt"
-
- proof-shell-annotated-prompt-regexp "%% [OA][KB]O?R?T? %%\n"
- proof-shell-error-regexp        "Server error:"
- proof-shell-quit-cmd            "quit"
- proof-shell-restart-cmd        "reset"
-
- ;; "Eager annotations" mark messages Proof General should display
- ;; or recognize while the prover is pontificating
- proof-shell-eager-annotation-start
- "^\\[Opening \\|\\[Closing "
- proof-shell-eager-annotation-end "\n"
-
- ;; next setting is just to prevent warning
- proof-save-command-regexp     proof-no-regexp)
-
-
-;; unset: all of the interactive proof commands
-;; These don't really apply, I don't think, because Twelf
-;; only has fully automatic prover at the moment.
-;; Also, there is no concept of "undo" to remove declarations
-;; (can simply repeat them, tho.)
-;; proof-goal-command-regexp       "^%theorem"
-;; proof-save-command-regexp       "" ;; FIXME: empty?
-;; proof-goal-with-hole-regexp     "^%theorem\w-+\\(.*\\)\w-+:"
-;; proof-save-with-hole-regexp     "" ;; FIXME
-;; proof-non-undoables-regexp
-;; proof-goal-command              "%theorem %s."
-;; proof-save-command              "%prove "
-;; remaining strings are left over from Isabelle example
-;; proof-kill-goal-command         "Goal \"PROP no_goal_set\";"
-;; proof-showproof-command         "pr()"
-;; proof-undo-n-times-cmd          "pg_repeat undo %s;"
-;; proof-shell-start-goals-regexp  "Level [0-9]"
-;; proof-shell-end-goals-regexp    "val it"
-;; proof-shell-init-cmd
-;; proof-shell-proof-completed-regexp "^No subgoals!"
-
-
-;;
-;; Twelf server doesn't take declarations directly:
-;; we need to pre-process script input slightly
-;;
-
-(defun twelf-add-read-declaration ()
-  "A hook value for `proof-shell-insert-hook'."
-  (if (eq action 'proof-done-advancing)
-      (setq string (concat "readDecl\n" string))))
-
-(add-hook 'proof-shell-insert-hook 'twelf-add-read-declaration)
-
-
-;;
-;; Syntax table
-;;
-
-;; Taken from old Emacs mode, renamed fns to be convention compliant
-(defun twelf-set-syntax (char entry)
-  (modify-syntax-entry char entry twelf-mode-syntax-table))
-(defun twelf-set-word  (char) (twelf-set-syntax char "w   "))
-(defun twelf-set-symbol (char) (twelf-set-syntax char "_   "))
-
-(defun twelf-map-string (func string)
-  (if (string= "" string)
-      ()
-    (funcall func (string-to-char string))
-    (twelf-map-string func (substring string 1))))
-
-;; A-Z and a-z are already word constituents
-;; For fontification, it would be better if _ and ' were word constituents
-(twelf-map-string
- 'twelf-set-word "!&$^+/<=>?@~|#*`;,-0123456789\\") ; word constituents
-(twelf-map-string 'twelf-set-symbol "_'")         ; symbol constituents
-;; Delimited comments are %{ }%, see 1234 below.
-(twelf-set-syntax ?\ "    ")            ; whitespace
-(twelf-set-syntax ?\t "    ")           ; whitespace
-; da: this old entry is wrong: it says % always starts a comment
-;(twelf-set-syntax ?% "< 14")            ; comment begin
-; This next one is much better,
-(twelf-set-syntax ?% ". 14")            ; comment begin/second char
-(twelf-set-syntax ?\n ">   ")           ; comment end
-(twelf-set-syntax ?: ".   ")            ; punctuation
-(twelf-set-syntax ?. ".   ")            ; punctuation
-(twelf-set-syntax ?\( "()  ")           ; open delimiter
-(twelf-set-syntax ?\) ")(  ")           ; close delimiter
-(twelf-set-syntax ?\[ "(]  ")           ; open delimiter
-(twelf-set-syntax ?\] ")[  ")           ; close delimiter
-;(twelf-set-syntax ?\{ "(}2 ")           ; open delimiter
-;(twelf-set-syntax ?\} "){ 3")           ; close delimiter
-;; Actually, strings are illegal but we include:
-(twelf-set-syntax ?\" "\"   ")          ; string quote
-;; \ is not an escape, but a word constituent (see above)
-;;(twelf-set-syntax ?\\ "/   ")         ; escape
-
-
-
-;;
-;; Syntax highlighting (from twelf-old.el, NEEDS WORK)
-;;
-;; Highlighting is maybe a nuisance for twelf because of its funny syntax.
-;; But font lock could perhaps be got to work with recent versions.
-;; That would be better than the present mechanism, which doesn't lock,
-;; doesn't work well with X Symbol (which really needs locking), and
-;; even breaks the background colouring for some reason (presumably
-;; the Twelf faces)
-
-(require 'twelf-font)
-(add-hook 'twelf-mode-hook 'twelf-mode-extra-config)
-
-(defun twelf-mode-extra-config ()
-  (make-local-hook 'font-lock-after-fontify-buffer-hook)
-  (add-hook 'font-lock-after-fontify-buffer-hook
-           'twelf-font-fontify-buffer nil 'local)
-  (font-lock-mode))
-
-(defconst twelf-syntax-menu
-  '("Syntax Highlighting"
-    ["Highlight Declaration" twelf-font-fontify-decl t]
-    ["Highlight Buffer" twelf-font-fontify-buffer t]
-    ;;(, (toggle "Immediate Highlighting" 'toggle-twelf-font-immediate
-    ;;'font-lock-mode))
-      )
-  "Menu for syntax highlighting in Twelf mode.")
-
-
-;;
-;; Setting Twelf options via Proof General
-;;
-
-(defpacustom chatter 1
-  "Value for chatter."
-  :type 'integer
-  :setting "set chatter %i")
-
-(defpacustom double-check nil
-  "Double-check declarations after type reconstruction."
-  :type 'boolean
-  :setting "set doubleCheck %b")
-(defpacustom print-implicit nil
-  "Show implicit arguments."
-  :type 'boolean
-  :setting "set Print.implict %b")
-
-;; etc
-
-
-;;
-;; Twelf menu
-;;
-
-(defpgdefault menu-entries
-  (cdr twelf-syntax-menu))
-
-
-(provide 'twelf)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]